@devalok/shilp-sutra 0.34.0 → 0.36.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.
Files changed (541) hide show
  1. package/LICENSE +21 -21
  2. package/dist/_chunks/badge-group.js +306 -246
  3. package/dist/_chunks/badge-group.js.map +1 -0
  4. package/dist/_chunks/chat.js +518 -0
  5. package/dist/_chunks/chat.js.map +1 -0
  6. package/dist/_chunks/date-picker.js +748 -0
  7. package/dist/_chunks/date-picker.js.map +1 -0
  8. package/dist/_chunks/document-preview.js +109 -90
  9. package/dist/_chunks/document-preview.js.map +1 -0
  10. package/dist/_chunks/file-preview.js +492 -504
  11. package/dist/_chunks/file-preview.js.map +1 -0
  12. package/dist/_chunks/framer.js +5564 -5613
  13. package/dist/_chunks/framer.js.map +1 -0
  14. package/dist/_chunks/image-preview.js +127 -88
  15. package/dist/_chunks/image-preview.js.map +1 -0
  16. package/dist/_chunks/keybinding.js +12 -14
  17. package/dist/_chunks/keybinding.js.map +1 -0
  18. package/dist/_chunks/link-context.js +19 -16
  19. package/dist/_chunks/link-context.js.map +1 -0
  20. package/dist/_chunks/mention-suggestion.js +353 -350
  21. package/dist/_chunks/mention-suggestion.js.map +1 -0
  22. package/dist/_chunks/motion-provider.js +26 -20
  23. package/dist/_chunks/motion-provider.js.map +1 -0
  24. package/dist/_chunks/popover.js +123 -0
  25. package/dist/_chunks/popover.js.map +1 -0
  26. package/dist/_chunks/primitives.js +7585 -6426
  27. package/dist/_chunks/primitives.js.map +1 -0
  28. package/dist/_chunks/rich-chat-input.js +2071 -0
  29. package/dist/_chunks/rich-chat-input.js.map +1 -0
  30. package/dist/_chunks/rolldown-runtime.js +21 -0
  31. package/dist/_chunks/shared.js +126 -0
  32. package/dist/_chunks/shared.js.map +1 -0
  33. package/dist/_chunks/sonner.js +605 -734
  34. package/dist/_chunks/sonner.js.map +1 -0
  35. package/dist/_chunks/stat-row.js +418 -440
  36. package/dist/_chunks/stat-row.js.map +1 -0
  37. package/dist/_chunks/tiptap.js +15850 -19964
  38. package/dist/_chunks/tiptap.js.map +1 -0
  39. package/dist/_chunks/tree-view.js +231 -290
  40. package/dist/_chunks/tree-view.js.map +1 -0
  41. package/dist/_chunks/use-calendar.js +161 -208
  42. package/dist/_chunks/use-calendar.js.map +1 -0
  43. package/dist/_chunks/vendor-client.js +314 -2199
  44. package/dist/_chunks/vendor-client.js.map +1 -0
  45. package/dist/_chunks/vendor-utils.js +1721 -2978
  46. package/dist/_chunks/vendor-utils.js.map +1 -0
  47. package/dist/ai/ai-command-provider.js +23 -17
  48. package/dist/ai/ai-command-provider.js.map +1 -0
  49. package/dist/ai/block-renderer.js +68 -51
  50. package/dist/ai/block-renderer.js.map +1 -0
  51. package/dist/ai/blocks/index.js +2 -12
  52. package/dist/ai/blocks/loading.d.ts.map +1 -1
  53. package/dist/ai/command-bar.js +470 -519
  54. package/dist/ai/command-bar.js.map +1 -0
  55. package/dist/ai/conversation.js +241 -227
  56. package/dist/ai/conversation.js.map +1 -0
  57. package/dist/ai/devadoot-icon.d.ts.map +1 -1
  58. package/dist/ai/index.js +181 -167
  59. package/dist/ai/index.js.map +1 -0
  60. package/dist/ai/types.js +0 -1
  61. package/dist/composed/activity-feed.js +232 -202
  62. package/dist/composed/activity-feed.js.map +1 -0
  63. package/dist/composed/avatar-group.js +164 -222
  64. package/dist/composed/avatar-group.js.map +1 -0
  65. package/dist/composed/bulk-action-bar.js +166 -165
  66. package/dist/composed/bulk-action-bar.js.map +1 -0
  67. package/dist/composed/command-palette.js +290 -308
  68. package/dist/composed/command-palette.js.map +1 -0
  69. package/dist/composed/confirm-dialog.js +28 -48
  70. package/dist/composed/confirm-dialog.js.map +1 -0
  71. package/dist/composed/content-card.js +69 -108
  72. package/dist/composed/content-card.js.map +1 -0
  73. package/dist/composed/date-picker/index.js +3 -13
  74. package/dist/composed/deadline-indicator.js +68 -74
  75. package/dist/composed/deadline-indicator.js.map +1 -0
  76. package/dist/composed/emoji-picker.js +83 -110
  77. package/dist/composed/emoji-picker.js.map +1 -0
  78. package/dist/composed/empty-state.d.ts.map +1 -1
  79. package/dist/composed/empty-state.js +64 -103
  80. package/dist/composed/empty-state.js.map +1 -0
  81. package/dist/composed/error-boundary.js +129 -127
  82. package/dist/composed/error-boundary.js.map +1 -0
  83. package/dist/composed/file-preview.js +2 -12
  84. package/dist/composed/filter-bar.js +98 -130
  85. package/dist/composed/filter-bar.js.map +1 -0
  86. package/dist/composed/form-section.js +61 -45
  87. package/dist/composed/form-section.js.map +1 -0
  88. package/dist/composed/global-loading.js +34 -47
  89. package/dist/composed/global-loading.js.map +1 -0
  90. package/dist/composed/index.js +34 -92
  91. package/dist/composed/inline-edit.js +92 -107
  92. package/dist/composed/inline-edit.js.map +1 -0
  93. package/dist/composed/lib/string-utils.js +8 -8
  94. package/dist/composed/lib/string-utils.js.map +1 -0
  95. package/dist/composed/loading-skeleton.js +103 -171
  96. package/dist/composed/loading-skeleton.js.map +1 -0
  97. package/dist/composed/markdown-viewer.js +187 -139
  98. package/dist/composed/markdown-viewer.js.map +1 -0
  99. package/dist/composed/master-detail.js +147 -156
  100. package/dist/composed/master-detail.js.map +1 -0
  101. package/dist/composed/member-picker.js +46 -49
  102. package/dist/composed/member-picker.js.map +1 -0
  103. package/dist/composed/multi-select-popover.d.ts.map +1 -1
  104. package/dist/composed/multi-select-popover.js +185 -179
  105. package/dist/composed/multi-select-popover.js.map +1 -0
  106. package/dist/composed/page-header.js +54 -76
  107. package/dist/composed/page-header.js.map +1 -0
  108. package/dist/composed/page-skeletons.js +143 -127
  109. package/dist/composed/page-skeletons.js.map +1 -0
  110. package/dist/composed/priority-indicator.js +105 -111
  111. package/dist/composed/priority-indicator.js.map +1 -0
  112. package/dist/composed/responsive-overlay.js +36 -41
  113. package/dist/composed/responsive-overlay.js.map +1 -0
  114. package/dist/composed/rich-chat-input/attachment-strip.d.ts.map +1 -1
  115. package/dist/composed/rich-chat-input/reply-banner.d.ts.map +1 -1
  116. package/dist/composed/rich-chat-input/schedule-send.d.ts.map +1 -1
  117. package/dist/composed/rich-chat-input.d.ts.map +1 -1
  118. package/dist/composed/rich-chat-input.js +2 -1860
  119. package/dist/composed/rich-text-editor.js +561 -424
  120. package/dist/composed/rich-text-editor.js.map +1 -0
  121. package/dist/composed/schedule-view.js +134 -185
  122. package/dist/composed/schedule-view.js.map +1 -0
  123. package/dist/composed/simple-tooltip.js +21 -21
  124. package/dist/composed/simple-tooltip.js.map +1 -0
  125. package/dist/composed/status-badge.d.ts.map +1 -1
  126. package/dist/composed/status-badge.js +133 -137
  127. package/dist/composed/status-badge.js.map +1 -0
  128. package/dist/hooks/index.js +7 -12
  129. package/dist/hooks/use-color-mode.js +28 -25
  130. package/dist/hooks/use-color-mode.js.map +1 -0
  131. package/dist/hooks/use-mobile.js +13 -13
  132. package/dist/hooks/use-mobile.js.map +1 -0
  133. package/dist/hooks/use-toast.js +2 -4
  134. package/dist/hooks/use-touch-device.js +9 -11
  135. package/dist/hooks/use-touch-device.js.map +1 -0
  136. package/dist/hooks/use-viewport-height.js +14 -14
  137. package/dist/hooks/use-viewport-height.js.map +1 -0
  138. package/dist/motion/check-motion-provider.d.ts +3 -0
  139. package/dist/motion/check-motion-provider.d.ts.map +1 -0
  140. package/dist/motion/index.js +17 -11
  141. package/dist/motion/index.js.map +1 -0
  142. package/dist/motion/primitives-index.js +226 -186
  143. package/dist/motion/primitives-index.js.map +1 -0
  144. package/dist/primitives/react-accordion.d.ts +114 -114
  145. package/dist/primitives/react-alert-dialog.d.ts +51 -51
  146. package/dist/primitives/react-aspect-ratio.d.ts +11 -11
  147. package/dist/primitives/react-avatar.d.ts +24 -24
  148. package/dist/primitives/react-checkbox.d.ts +50 -50
  149. package/dist/primitives/react-collapsible.d.ts +33 -33
  150. package/dist/primitives/react-context-menu.d.ts +96 -96
  151. package/dist/primitives/react-dialog.d.ts +103 -103
  152. package/dist/primitives/react-dropdown-menu.d.ts +97 -97
  153. package/dist/primitives/react-hover-card.d.ts +79 -79
  154. package/dist/primitives/react-label.d.ts +10 -10
  155. package/dist/primitives/react-menu.d.ts +169 -169
  156. package/dist/primitives/react-menubar.d.ts +115 -115
  157. package/dist/primitives/react-navigation-menu.d.ts +126 -126
  158. package/dist/primitives/react-popover.d.ts +85 -85
  159. package/dist/primitives/react-progress.d.ts +19 -19
  160. package/dist/primitives/react-radio-group.d.ts +58 -58
  161. package/dist/primitives/react-roving-focus.d.ts +49 -49
  162. package/dist/primitives/react-select.d.ts +137 -137
  163. package/dist/primitives/react-separator.d.ts +21 -21
  164. package/dist/primitives/react-slider.d.ts +75 -75
  165. package/dist/primitives/react-switch.d.ts +21 -21
  166. package/dist/primitives/react-tabs.d.ts +56 -56
  167. package/dist/primitives/react-toast.d.ts +120 -120
  168. package/dist/primitives/react-toggle-group.d.ts +75 -75
  169. package/dist/primitives/react-toggle.d.ts +24 -24
  170. package/dist/primitives/react-tooltip.d.ts +101 -101
  171. package/dist/primitives/react-visually-hidden.d.ts +22 -22
  172. package/dist/shell/app-command-palette.d.ts +2 -0
  173. package/dist/shell/app-command-palette.d.ts.map +1 -1
  174. package/dist/shell/app-command-palette.js +94 -238
  175. package/dist/shell/app-command-palette.js.map +1 -0
  176. package/dist/shell/bottom-navbar.js +150 -190
  177. package/dist/shell/bottom-navbar.js.map +1 -0
  178. package/dist/shell/command-registry.js +13 -14
  179. package/dist/shell/command-registry.js.map +1 -0
  180. package/dist/shell/index.js +10 -20
  181. package/dist/shell/link-context.js +2 -5
  182. package/dist/shell/notification-center.d.ts.map +1 -1
  183. package/dist/shell/notification-center.js +263 -259
  184. package/dist/shell/notification-center.js.map +1 -0
  185. package/dist/shell/notification-preferences.js +241 -184
  186. package/dist/shell/notification-preferences.js.map +1 -0
  187. package/dist/shell/sidebar.js +251 -281
  188. package/dist/shell/sidebar.js.map +1 -0
  189. package/dist/shell/top-bar.js +203 -237
  190. package/dist/shell/top-bar.js.map +1 -0
  191. package/dist/tailwind/index.cjs +473 -442
  192. package/dist/tailwind/index.js +2 -4
  193. package/dist/tailwind/preset.d.ts.map +1 -1
  194. package/dist/tailwind/preset.js +490 -459
  195. package/dist/tailwind/preset.js.map +1 -0
  196. package/dist/tokens/index.css +4 -4
  197. package/dist/tokens/primitives.css +442 -442
  198. package/dist/tokens/semantic.css +742 -547
  199. package/dist/tokens/typography-semantic.css +123 -100
  200. package/dist/tokens/typography.css +422 -422
  201. package/dist/ui/accordion.js +52 -60
  202. package/dist/ui/accordion.js.map +1 -0
  203. package/dist/ui/alert-dialog.d.ts +6 -2
  204. package/dist/ui/alert-dialog.d.ts.map +1 -1
  205. package/dist/ui/alert-dialog.js +112 -156
  206. package/dist/ui/alert-dialog.js.map +1 -0
  207. package/dist/ui/alert.d.ts +3 -2
  208. package/dist/ui/alert.d.ts.map +1 -1
  209. package/dist/ui/alert.js +203 -99
  210. package/dist/ui/alert.js.map +1 -0
  211. package/dist/ui/aspect-ratio.js +13 -16
  212. package/dist/ui/aspect-ratio.js.map +1 -0
  213. package/dist/ui/autocomplete.d.ts.map +1 -1
  214. package/dist/ui/autocomplete.js +137 -148
  215. package/dist/ui/autocomplete.js.map +1 -0
  216. package/dist/ui/avatar.js +196 -169
  217. package/dist/ui/avatar.js.map +1 -0
  218. package/dist/ui/badge-group.js +2 -7
  219. package/dist/ui/badge-indicator.js +42 -51
  220. package/dist/ui/badge-indicator.js.map +1 -0
  221. package/dist/ui/badge.js +2 -15
  222. package/dist/ui/banner.js +76 -68
  223. package/dist/ui/banner.js.map +1 -0
  224. package/dist/ui/breadcrumb.js +65 -84
  225. package/dist/ui/breadcrumb.js.map +1 -0
  226. package/dist/ui/button-group.js +109 -102
  227. package/dist/ui/button-group.js.map +1 -0
  228. package/dist/ui/button-processing.d.ts.map +1 -1
  229. package/dist/ui/button-processing.js +89 -72
  230. package/dist/ui/button-processing.js.map +1 -0
  231. package/dist/ui/button.js +393 -279
  232. package/dist/ui/button.js.map +1 -0
  233. package/dist/ui/card.js +151 -157
  234. package/dist/ui/card.js.map +1 -0
  235. package/dist/ui/charts/bar-chart.d.ts.map +1 -1
  236. package/dist/ui/charts/chart-container.d.ts +2 -0
  237. package/dist/ui/charts/chart-container.d.ts.map +1 -1
  238. package/dist/ui/charts/index.js +1025 -1319
  239. package/dist/ui/charts/index.js.map +1 -0
  240. package/dist/ui/charts/line-chart.d.ts.map +1 -1
  241. package/dist/ui/chat/index.js +2 -11
  242. package/dist/ui/chat/message-input.d.ts.map +1 -1
  243. package/dist/ui/chat/message-list.d.ts +1 -1
  244. package/dist/ui/chat/message-list.d.ts.map +1 -1
  245. package/dist/ui/chat/message.d.ts.map +1 -1
  246. package/dist/ui/chat/system-message.d.ts.map +1 -1
  247. package/dist/ui/checkbox.d.ts.map +1 -1
  248. package/dist/ui/checkbox.js +82 -100
  249. package/dist/ui/checkbox.js.map +1 -0
  250. package/dist/ui/code.js +18 -32
  251. package/dist/ui/code.js.map +1 -0
  252. package/dist/ui/collapsible.js +21 -29
  253. package/dist/ui/collapsible.js.map +1 -0
  254. package/dist/ui/color-input.d.ts.map +1 -1
  255. package/dist/ui/color-input.js +455 -372
  256. package/dist/ui/color-input.js.map +1 -0
  257. package/dist/ui/color-swatch.js +60 -90
  258. package/dist/ui/color-swatch.js.map +1 -0
  259. package/dist/ui/combobox.d.ts +7 -0
  260. package/dist/ui/combobox.d.ts.map +1 -1
  261. package/dist/ui/combobox.js +278 -293
  262. package/dist/ui/combobox.js.map +1 -0
  263. package/dist/ui/container.js +18 -24
  264. package/dist/ui/container.js.map +1 -0
  265. package/dist/ui/context-menu.js +154 -203
  266. package/dist/ui/context-menu.js.map +1 -0
  267. package/dist/ui/data-table-body.js +116 -213
  268. package/dist/ui/data-table-body.js.map +1 -0
  269. package/dist/ui/data-table-bulk-actions.js +43 -59
  270. package/dist/ui/data-table-bulk-actions.js.map +1 -0
  271. package/dist/ui/data-table-card.js +84 -71
  272. package/dist/ui/data-table-card.js.map +1 -0
  273. package/dist/ui/data-table-context.js +39 -42
  274. package/dist/ui/data-table-context.js.map +1 -0
  275. package/dist/ui/data-table-header.js +98 -139
  276. package/dist/ui/data-table-header.js.map +1 -0
  277. package/dist/ui/data-table-pagination.js +69 -82
  278. package/dist/ui/data-table-pagination.js.map +1 -0
  279. package/dist/ui/data-table-toolbar.js +104 -130
  280. package/dist/ui/data-table-toolbar.js.map +1 -0
  281. package/dist/ui/data-table.js +281 -354
  282. package/dist/ui/data-table.js.map +1 -0
  283. package/dist/ui/devalok-grain.js +77 -66
  284. package/dist/ui/devalok-grain.js.map +1 -0
  285. package/dist/ui/dialog.js +118 -151
  286. package/dist/ui/dialog.js.map +1 -0
  287. package/dist/ui/dropdown-menu.js +152 -203
  288. package/dist/ui/dropdown-menu.js.map +1 -0
  289. package/dist/ui/file-upload.js +242 -266
  290. package/dist/ui/file-upload.js.map +1 -0
  291. package/dist/ui/form.d.ts +8 -0
  292. package/dist/ui/form.d.ts.map +1 -1
  293. package/dist/ui/form.js +62 -56
  294. package/dist/ui/form.js.map +1 -0
  295. package/dist/ui/hover-card.js +54 -54
  296. package/dist/ui/hover-card.js.map +1 -0
  297. package/dist/ui/icon-button.js +21 -26
  298. package/dist/ui/icon-button.js.map +1 -0
  299. package/dist/ui/icon-context.js +17 -17
  300. package/dist/ui/icon-context.js.map +1 -0
  301. package/dist/ui/icon-group.js +22 -29
  302. package/dist/ui/icon-group.js.map +1 -0
  303. package/dist/ui/icon.js +201 -121
  304. package/dist/ui/icon.js.map +1 -0
  305. package/dist/ui/index.d.ts +4 -4
  306. package/dist/ui/index.d.ts.map +1 -1
  307. package/dist/ui/index.js +90 -350
  308. package/dist/ui/index.js.map +1 -0
  309. package/dist/ui/input-otp.d.ts +12 -3
  310. package/dist/ui/input-otp.d.ts.map +1 -1
  311. package/dist/ui/input-otp.js +58 -48
  312. package/dist/ui/input-otp.js.map +1 -0
  313. package/dist/ui/input.d.ts.map +1 -1
  314. package/dist/ui/input.js +93 -169
  315. package/dist/ui/input.js.map +1 -0
  316. package/dist/ui/label.d.ts.map +1 -1
  317. package/dist/ui/label.js +23 -23
  318. package/dist/ui/label.js.map +1 -0
  319. package/dist/ui/lib/check-tokens.d.ts +3 -0
  320. package/dist/ui/lib/check-tokens.d.ts.map +1 -0
  321. package/dist/ui/lib/date-utils.js +14 -11
  322. package/dist/ui/lib/date-utils.js.map +1 -0
  323. package/dist/ui/lib/motion.d.ts +15 -4
  324. package/dist/ui/lib/motion.d.ts.map +1 -1
  325. package/dist/ui/lib/motion.js +83 -33
  326. package/dist/ui/lib/motion.js.map +1 -0
  327. package/dist/ui/lib/utils.js +39 -16
  328. package/dist/ui/lib/utils.js.map +1 -0
  329. package/dist/ui/link.js +13 -24
  330. package/dist/ui/link.js.map +1 -0
  331. package/dist/ui/menubar.js +132 -210
  332. package/dist/ui/menubar.js.map +1 -0
  333. package/dist/ui/navigation-menu.js +163 -193
  334. package/dist/ui/navigation-menu.js.map +1 -0
  335. package/dist/ui/number-input.d.ts +16 -1
  336. package/dist/ui/number-input.d.ts.map +1 -1
  337. package/dist/ui/number-input.js +102 -95
  338. package/dist/ui/number-input.js.map +1 -0
  339. package/dist/ui/pagination.js +122 -159
  340. package/dist/ui/pagination.js.map +1 -0
  341. package/dist/ui/popover.js +2 -131
  342. package/dist/ui/progress-ring.d.ts.map +1 -1
  343. package/dist/ui/progress-ring.js +133 -143
  344. package/dist/ui/progress-ring.js.map +1 -0
  345. package/dist/ui/progress.js +51 -95
  346. package/dist/ui/progress.js.map +1 -0
  347. package/dist/ui/radio.d.ts.map +1 -1
  348. package/dist/ui/radio.js +47 -49
  349. package/dist/ui/radio.js.map +1 -0
  350. package/dist/ui/search-input.js +51 -53
  351. package/dist/ui/search-input.js.map +1 -0
  352. package/dist/ui/segmented-control.d.ts +1 -1
  353. package/dist/ui/segmented-control.d.ts.map +1 -1
  354. package/dist/ui/segmented-control.js +95 -114
  355. package/dist/ui/segmented-control.js.map +1 -0
  356. package/dist/ui/select.d.ts.map +1 -1
  357. package/dist/ui/select.js +137 -157
  358. package/dist/ui/select.js.map +1 -0
  359. package/dist/ui/separator.d.ts.map +1 -1
  360. package/dist/ui/separator.js +18 -25
  361. package/dist/ui/separator.js.map +1 -0
  362. package/dist/ui/sheet.js +135 -163
  363. package/dist/ui/sheet.js.map +1 -0
  364. package/dist/ui/sidebar.js +357 -600
  365. package/dist/ui/sidebar.js.map +1 -0
  366. package/dist/ui/skeleton.js +179 -231
  367. package/dist/ui/skeleton.js.map +1 -0
  368. package/dist/ui/slider.d.ts +22 -3
  369. package/dist/ui/slider.d.ts.map +1 -1
  370. package/dist/ui/slider.js +62 -34
  371. package/dist/ui/slider.js.map +1 -0
  372. package/dist/ui/spinner.js +226 -205
  373. package/dist/ui/spinner.js.map +1 -0
  374. package/dist/ui/split-button.d.ts.map +1 -1
  375. package/dist/ui/split-button.js +228 -276
  376. package/dist/ui/split-button.js.map +1 -0
  377. package/dist/ui/stack.js +56 -70
  378. package/dist/ui/stack.js.map +1 -0
  379. package/dist/ui/stat-card.js +259 -251
  380. package/dist/ui/stat-card.js.map +1 -0
  381. package/dist/ui/status-dot.js +67 -63
  382. package/dist/ui/status-dot.js.map +1 -0
  383. package/dist/ui/stepper.d.ts +10 -0
  384. package/dist/ui/stepper.d.ts.map +1 -1
  385. package/dist/ui/stepper.js +124 -168
  386. package/dist/ui/stepper.js.map +1 -0
  387. package/dist/ui/switch.d.ts.map +1 -1
  388. package/dist/ui/switch.js +56 -55
  389. package/dist/ui/switch.js.map +1 -0
  390. package/dist/ui/table.js +57 -90
  391. package/dist/ui/table.js.map +1 -0
  392. package/dist/ui/tabs.d.ts +3 -1
  393. package/dist/ui/tabs.d.ts.map +1 -1
  394. package/dist/ui/tabs.js +159 -156
  395. package/dist/ui/tabs.js.map +1 -0
  396. package/dist/ui/text.d.ts +1 -1
  397. package/dist/ui/text.d.ts.map +1 -1
  398. package/dist/ui/text.js +60 -59
  399. package/dist/ui/text.js.map +1 -0
  400. package/dist/ui/textarea.js +40 -57
  401. package/dist/ui/textarea.js.map +1 -0
  402. package/dist/ui/toast-registry.d.ts +8 -0
  403. package/dist/ui/toast-registry.d.ts.map +1 -0
  404. package/dist/ui/toast-registry.js +13 -0
  405. package/dist/ui/toast-registry.js.map +1 -0
  406. package/dist/ui/toast-types.js +0 -1
  407. package/dist/ui/toast.d.ts.map +1 -1
  408. package/dist/ui/toast.js +559 -536
  409. package/dist/ui/toast.js.map +1 -0
  410. package/dist/ui/toaster.d.ts.map +1 -1
  411. package/dist/ui/toaster.js +24 -33
  412. package/dist/ui/toaster.js.map +1 -0
  413. package/dist/ui/toggle-group.d.ts +2 -0
  414. package/dist/ui/toggle-group.d.ts.map +1 -1
  415. package/dist/ui/toggle-group.js +44 -41
  416. package/dist/ui/toggle-group.js.map +1 -0
  417. package/dist/ui/toggle.d.ts +2 -0
  418. package/dist/ui/toggle.d.ts.map +1 -1
  419. package/dist/ui/toggle.js +44 -40
  420. package/dist/ui/toggle.js.map +1 -0
  421. package/dist/ui/tooltip.js +80 -65
  422. package/dist/ui/tooltip.js.map +1 -0
  423. package/dist/ui/tree-view/index.js +2 -6
  424. package/dist/ui/visually-hidden.js +12 -10
  425. package/dist/ui/visually-hidden.js.map +1 -0
  426. package/docs/components/_header.md +85 -85
  427. package/docs/components/composed/activity-feed.md +62 -62
  428. package/docs/components/composed/avatar-group.md +65 -65
  429. package/docs/components/composed/bulk-action-bar.md +40 -40
  430. package/docs/components/composed/command-palette.md +40 -40
  431. package/docs/components/composed/confirm-dialog.md +46 -46
  432. package/docs/components/composed/content-card.md +36 -36
  433. package/docs/components/composed/date-picker.md +130 -130
  434. package/docs/components/composed/deadline-indicator.md +27 -27
  435. package/docs/components/composed/emoji-picker.md +52 -52
  436. package/docs/components/composed/empty-state.md +53 -53
  437. package/docs/components/composed/error-boundary.md +29 -29
  438. package/docs/components/composed/file-preview.md +40 -40
  439. package/docs/components/composed/filter-bar.md +57 -57
  440. package/docs/components/composed/form-section.md +31 -31
  441. package/docs/components/composed/global-loading.md +27 -27
  442. package/docs/components/composed/inline-edit.md +35 -35
  443. package/docs/components/composed/loading-skeleton.md +51 -51
  444. package/docs/components/composed/markdown-viewer.md +27 -27
  445. package/docs/components/composed/master-detail.md +48 -48
  446. package/docs/components/composed/member-picker.md +35 -35
  447. package/docs/components/composed/multi-select-popover.md +62 -62
  448. package/docs/components/composed/page-header.md +41 -41
  449. package/docs/components/composed/page-skeletons.md +32 -32
  450. package/docs/components/composed/priority-indicator.md +32 -32
  451. package/docs/components/composed/responsive-overlay.md +34 -34
  452. package/docs/components/composed/rich-text-editor.md +82 -82
  453. package/docs/components/composed/schedule-view.md +39 -39
  454. package/docs/components/composed/simple-tooltip.md +33 -33
  455. package/docs/components/composed/status-badge.md +55 -55
  456. package/docs/components/shell/app-command-palette.md +44 -44
  457. package/docs/components/shell/bottom-navbar.md +52 -52
  458. package/docs/components/shell/command-registry.md +48 -48
  459. package/docs/components/shell/link-context.md +41 -41
  460. package/docs/components/shell/notification-center.md +63 -63
  461. package/docs/components/shell/notification-preferences.md +42 -42
  462. package/docs/components/shell/sidebar.md +92 -92
  463. package/docs/components/shell/top-bar.md +143 -143
  464. package/docs/components/ui/accordion.md +51 -51
  465. package/docs/components/ui/alert-dialog.md +61 -61
  466. package/docs/components/ui/alert.md +46 -46
  467. package/docs/components/ui/aspect-ratio.md +25 -25
  468. package/docs/components/ui/autocomplete.md +48 -48
  469. package/docs/components/ui/avatar.md +56 -56
  470. package/docs/components/ui/badge.md +83 -82
  471. package/docs/components/ui/banner.md +42 -42
  472. package/docs/components/ui/breadcrumb.md +37 -37
  473. package/docs/components/ui/button-group.md +41 -41
  474. package/docs/components/ui/button.md +94 -93
  475. package/docs/components/ui/card.md +52 -52
  476. package/docs/components/ui/charts.md +43 -43
  477. package/docs/components/ui/checkbox.md +36 -36
  478. package/docs/components/ui/chip.md +47 -47
  479. package/docs/components/ui/code.md +28 -28
  480. package/docs/components/ui/collapsible.md +40 -40
  481. package/docs/components/ui/color-input.md +91 -91
  482. package/docs/components/ui/color-swatch.md +25 -25
  483. package/docs/components/ui/combobox.md +54 -54
  484. package/docs/components/ui/container.md +26 -26
  485. package/docs/components/ui/context-menu.md +43 -43
  486. package/docs/components/ui/data-table-body.md +1 -1
  487. package/docs/components/ui/data-table-bulk-actions.md +1 -1
  488. package/docs/components/ui/data-table-card.md +1 -1
  489. package/docs/components/ui/data-table-context.md +1 -1
  490. package/docs/components/ui/data-table-header.md +1 -1
  491. package/docs/components/ui/data-table-pagination.md +1 -1
  492. package/docs/components/ui/data-table-toolbar.md +44 -44
  493. package/docs/components/ui/data-table.md +94 -94
  494. package/docs/components/ui/dialog.md +54 -54
  495. package/docs/components/ui/dropdown-menu.md +48 -48
  496. package/docs/components/ui/file-upload.md +41 -41
  497. package/docs/components/ui/form.md +51 -51
  498. package/docs/components/ui/hover-card.md +32 -32
  499. package/docs/components/ui/icon-button.md +40 -40
  500. package/docs/components/ui/input-otp.md +44 -44
  501. package/docs/components/ui/input.md +74 -74
  502. package/docs/components/ui/label.md +25 -25
  503. package/docs/components/ui/link.md +29 -29
  504. package/docs/components/ui/menubar.md +44 -44
  505. package/docs/components/ui/navigation-menu.md +46 -46
  506. package/docs/components/ui/number-input.md +44 -44
  507. package/docs/components/ui/pagination.md +48 -48
  508. package/docs/components/ui/popover.md +30 -30
  509. package/docs/components/ui/progress-ring.md +41 -41
  510. package/docs/components/ui/progress.md +34 -34
  511. package/docs/components/ui/radio.md +34 -34
  512. package/docs/components/ui/search-input.md +43 -43
  513. package/docs/components/ui/segmented-control.md +50 -50
  514. package/docs/components/ui/select.md +53 -53
  515. package/docs/components/ui/separator.md +32 -32
  516. package/docs/components/ui/sheet.md +47 -47
  517. package/docs/components/ui/sidebar.md +72 -72
  518. package/docs/components/ui/skeleton.md +77 -77
  519. package/docs/components/ui/slider.md +29 -29
  520. package/docs/components/ui/spinner.md +54 -54
  521. package/docs/components/ui/stack.md +39 -39
  522. package/docs/components/ui/stat-card.md +61 -61
  523. package/docs/components/ui/status-dot.md +26 -26
  524. package/docs/components/ui/stepper.md +49 -49
  525. package/docs/components/ui/switch.md +47 -47
  526. package/docs/components/ui/table.md +47 -47
  527. package/docs/components/ui/tabs.md +60 -60
  528. package/docs/components/ui/text.md +37 -37
  529. package/docs/components/ui/textarea.md +39 -39
  530. package/docs/components/ui/toast.md +65 -65
  531. package/docs/components/ui/toaster.md +47 -47
  532. package/docs/components/ui/toggle-group.md +43 -43
  533. package/docs/components/ui/toggle.md +37 -37
  534. package/docs/components/ui/tooltip.md +38 -38
  535. package/docs/components/ui/tree-view.md +65 -65
  536. package/docs/components/ui/visually-hidden.md +21 -21
  537. package/llms-full.txt +5266 -5264
  538. package/llms.txt +624 -580
  539. package/package.json +7 -8
  540. package/dist/_chunks/date-time-picker.js +0 -851
  541. package/dist/_chunks/typing-indicator.js +0 -565
@@ -1,1861 +1,3 @@
1
1
  "use client";
2
- import { jsx as e, jsxs as h, Fragment as wt } from "react/jsx-runtime";
3
- import * as a from "react";
4
- import { useState as be, useRef as K, useCallback as le, useEffect as kt } from "react";
5
- import * as Ct from "react-dom";
6
- import { q as Nt, i as St, e as Rt, g as At } from "../_chunks/vendor-client.js";
7
- import { g as Xe, h as Dt, j as Et, e as W, c as zt, i as Tt, P as Mt, a as It, C as Pt, d as Bt, u as Lt, E as _t, B as Ht } from "../_chunks/tiptap.js";
8
- import { F as jt, E as $t, c as Ft, a as qt, l as Ut, b as Ot } from "../_chunks/mention-suggestion.js";
9
- import { createRoot as Kt } from "react-dom/client";
10
- import { cn as z } from "../ui/lib/utils.js";
11
- import { IconX as me, IconClock as Pe, IconPencil as Wt, IconCalendarEvent as qe, IconFile as Vt, IconBold as Qe, IconItalic as Ge, IconUnderline as Je, IconStrikethrough as Ze, IconHighlight as et, IconList as Yt, IconListNumbers as Xt, IconBlockquote as Qt, IconLink as Gt, IconCode as tt, IconAt as Jt, IconMoodSmile as rt, IconSlash as Zt, IconPlayerPause as er, IconPlayerPlay as tr, IconPlus as rr, IconTextSize as nr, IconTrash as Ue, IconSquare as Oe, IconSend as ze, IconMicrophone as sr, IconChevronDown as ir } from "@tabler/icons-react";
12
- import { Icon as g } from "../ui/icon.js";
13
- import { m as G, A as fe, u as or } from "../_chunks/framer.js";
14
- import { Button as Q } from "../ui/button.js";
15
- import { u as ar, C as cr } from "../_chunks/use-calendar.js";
16
- import { Dialog as lr, DialogContent as dr, DialogHeader as ur, DialogTitle as fr, DialogFooter as mr } from "../ui/dialog.js";
17
- import { SplitButton as hr } from "../ui/split-button.js";
18
- import { emojiDataLoaders as Ke } from "./emoji-picker.js";
19
- import { Spinner as pr } from "../ui/spinner.js";
20
- import { useColorMode as gr } from "../hooks/use-color-mode.js";
21
- import { useIsMobile as br } from "../hooks/use-mobile.js";
22
- const Ie = a.forwardRef(
23
- ({ groups: r, query: n, command: t }, i) => {
24
- const [s, d] = a.useState(0), u = a.useMemo(() => {
25
- const c = n.toLowerCase(), m = [];
26
- return r.forEach((p, N) => {
27
- p.commands.forEach((w) => {
28
- (!c || w.label.toLowerCase().includes(c) || w.description?.toLowerCase().includes(c)) && m.push({ command: w, groupIndex: N });
29
- });
30
- }), m;
31
- }, [r, n]);
32
- if (a.useEffect(() => d(0), [u]), a.useImperativeHandle(i, () => ({
33
- onKeyDown: ({ event: c }) => c.key === "ArrowUp" ? (d((m) => (m + u.length - 1) % u.length), !0) : c.key === "ArrowDown" ? (d((m) => (m + 1) % u.length), !0) : c.key === "Enter" ? (u[s] && t(u[s].command), !0) : !1
34
- })), !u.length) return null;
35
- const f = [];
36
- let o = 0;
37
- for (const c of u) {
38
- const m = r[c.groupIndex].label;
39
- let p = f[f.length - 1];
40
- (!p || p.label !== m) && (p = { label: m, items: [] }, f.push(p)), p.items.push({ command: c.command, flatIndex: o }), o++;
41
- }
42
- return /* @__PURE__ */ e(
43
- "div",
44
- {
45
- role: "listbox",
46
- "aria-label": "Slash commands",
47
- className: "z-popover max-h-[320px] min-w-[220px] overflow-x-hidden overflow-y-auto rounded-ds-lg border border-surface-border-strong bg-surface-overlay p-ds-02 shadow-floating",
48
- children: f.map((c, m) => /* @__PURE__ */ h("div", { role: "group", "aria-label": c.label, children: [
49
- m > 0 && /* @__PURE__ */ e("div", { className: "my-ds-01 border-t border-surface-border" }),
50
- /* @__PURE__ */ e("div", { className: "px-ds-03 py-ds-01 text-ds-xs font-medium text-surface-fg-subtle", children: c.label }),
51
- c.items.map(({ command: p, flatIndex: N }) => {
52
- const w = p.icon;
53
- return /* @__PURE__ */ h(
54
- "button",
55
- {
56
- type: "button",
57
- role: "option",
58
- "aria-selected": N === s,
59
- onClick: () => t(p),
60
- className: z(
61
- "flex w-full items-center gap-ds-03 rounded-ds-md px-ds-03 py-ds-02 text-left cursor-pointer",
62
- N === s ? "bg-surface-raised-hover" : "hover:bg-surface-raised-hover"
63
- ),
64
- children: [
65
- w && /* @__PURE__ */ e("span", { className: "flex h-4 w-4 shrink-0 items-center justify-center text-surface-fg-muted", children: /* @__PURE__ */ e(w, { className: "h-4 w-4" }) }),
66
- /* @__PURE__ */ h("div", { className: "flex flex-col", children: [
67
- /* @__PURE__ */ e("span", { className: "text-ds-sm text-surface-fg", children: p.label }),
68
- p.description && /* @__PURE__ */ e("span", { className: "text-ds-xs text-surface-fg-subtle", children: p.description })
69
- ] })
70
- ]
71
- },
72
- p.id
73
- );
74
- })
75
- ] }, c.label))
76
- }
77
- );
78
- }
79
- );
80
- Ie.displayName = "SlashCommandList";
81
- function vr(r) {
82
- return () => {
83
- let n = null, t = null, i = null;
84
- return {
85
- onStart: (s) => {
86
- t = document.createElement("div"), t.style.position = "absolute", t.style.zIndex = "1400";
87
- const d = s.clientRect?.();
88
- d && (t.style.left = `${d.left}px`, t.style.top = `${d.bottom + 4}px`), document.body.appendChild(t), n = Kt(t), n.render(
89
- /* @__PURE__ */ e(
90
- Ie,
91
- {
92
- ref: (u) => {
93
- i = u;
94
- },
95
- groups: r,
96
- query: s.query,
97
- command: (u) => s.command(u)
98
- }
99
- )
100
- );
101
- },
102
- onUpdate: (s) => {
103
- if (!n || !t) return;
104
- const d = s.clientRect?.();
105
- d && (t.style.left = `${d.left}px`, t.style.top = `${d.bottom + 4}px`), n.render(
106
- /* @__PURE__ */ e(
107
- Ie,
108
- {
109
- ref: (u) => {
110
- i = u;
111
- },
112
- groups: r,
113
- query: s.query,
114
- command: (u) => s.command(u)
115
- }
116
- )
117
- );
118
- },
119
- onKeyDown: (s) => s.event.key === "Escape" ? (t && (n?.unmount(), t.remove(), t = null, n = null), !0) : i?.onKeyDown(s) ?? !1,
120
- onExit: () => {
121
- t && (n?.unmount(), t.remove(), t = null, n = null);
122
- }
123
- };
124
- };
125
- }
126
- function xr(r) {
127
- const n = r.flatMap((t) => t.commands);
128
- return Xe.create({
129
- name: "slashCommand",
130
- addProseMirrorPlugins() {
131
- return [
132
- Dt({
133
- pluginKey: new Et("slashCommand"),
134
- editor: this.editor,
135
- char: "/",
136
- startOfLine: !0,
137
- allowSpaces: !1,
138
- items: ({ query: t }) => {
139
- if (!t) return n.slice(0, 8);
140
- const i = t.toLowerCase();
141
- return n.filter(
142
- (s) => s.label.toLowerCase().includes(i) || s.description?.toLowerCase().includes(i)
143
- ).slice(0, 8);
144
- },
145
- command: ({ editor: t, range: i, props: s }) => {
146
- t.chain().focus().deleteRange(i).run(), s.action(t);
147
- },
148
- render: vr(r)
149
- })
150
- ];
151
- }
152
- });
153
- }
154
- function yr({ author: r, preview: n, onDismiss: t }) {
155
- return /* @__PURE__ */ e(
156
- G.div,
157
- {
158
- initial: { height: 0, opacity: 0 },
159
- animate: { height: "auto", opacity: 1 },
160
- exit: { height: 0, opacity: 0 },
161
- transition: { duration: 0.24, ease: [0.2, 0, 0.38, 0.9] },
162
- className: "overflow-hidden",
163
- children: /* @__PURE__ */ h(
164
- "div",
165
- {
166
- role: "status",
167
- "aria-label": `Replying to ${r}`,
168
- className: "flex items-center gap-ds-03 border-b border-surface-border px-ds-04 py-ds-02b",
169
- children: [
170
- /* @__PURE__ */ h("div", { className: "flex-1 min-w-0", children: [
171
- /* @__PURE__ */ h("span", { className: "text-ds-sm font-semibold text-surface-fg", children: [
172
- "Replying to ",
173
- r
174
- ] }),
175
- /* @__PURE__ */ e("span", { className: "mx-ds-02 text-surface-fg-subtle", children: "·" }),
176
- /* @__PURE__ */ e("span", { className: "text-ds-sm text-surface-fg-muted truncate", children: n })
177
- ] }),
178
- /* @__PURE__ */ e(
179
- "button",
180
- {
181
- type: "button",
182
- onClick: t,
183
- className: z(
184
- "inline-flex h-ds-xs-plus w-ds-xs-plus items-center justify-center rounded-ds-md touch-target",
185
- "text-surface-fg-subtle hover:text-surface-fg hover:bg-surface-raised-hover",
186
- "transition-colors duration-fast-01 ease-productive-standard",
187
- "active:scale-95"
188
- ),
189
- "aria-label": "Cancel reply",
190
- title: "Cancel reply",
191
- children: /* @__PURE__ */ e(g, { icon: me, size: "xs" })
192
- }
193
- )
194
- ]
195
- }
196
- )
197
- }
198
- );
199
- }
200
- function wr() {
201
- const r = /* @__PURE__ */ new Date(), n = r.getHours(), t = [], i = (u, f = 0) => {
202
- const o = new Date(r);
203
- return o.setDate(o.getDate() + f), o.setHours(u, 0, 0, 0), o;
204
- }, s = (u) => {
205
- const f = new Date(r), o = f.getDay(), c = o === 0 ? 1 : o === 1 ? 7 : 8 - o;
206
- return f.setDate(f.getDate() + c), f.setHours(u, 0, 0, 0), f;
207
- };
208
- n < 9 ? (t.push({ label: "Later this morning · 9:00 AM", date: i(9) }), t.push({ label: "This afternoon · 1:00 PM", date: i(13) }), t.push({ label: "This evening · 6:00 PM", date: i(18) })) : n < 13 ? (t.push({ label: "This afternoon · 1:00 PM", date: i(13) }), t.push({ label: "This evening · 6:00 PM", date: i(18) }), t.push({ label: "Tomorrow morning · 9:00 AM", date: i(9, 1) })) : n < 18 ? (t.push({ label: "This evening · 6:00 PM", date: i(18) }), t.push({ label: "Tomorrow morning · 9:00 AM", date: i(9, 1) }), t.push({ label: "Tomorrow afternoon · 1:00 PM", date: i(13, 1) })) : (t.push({ label: "Tomorrow morning · 9:00 AM", date: i(9, 1) }), t.push({ label: "Tomorrow afternoon · 1:00 PM", date: i(13, 1) }));
209
- const d = s(9);
210
- return d.getTime() - r.getTime() > 2880 * 60 * 1e3 && t.push({ label: "Next Monday · 9:00 AM", date: d }), t;
211
- }
212
- function nt({ value: r, onChange: n }) {
213
- const t = r.getHours() % 12 || 12, i = r.getMinutes(), s = r.getHours() >= 12, d = (o) => {
214
- const c = new Date(r);
215
- c.setHours(s ? o % 12 + 12 : o % 12), n(c);
216
- }, u = (o) => {
217
- const c = new Date(r);
218
- c.setMinutes(o), n(c);
219
- }, f = (o) => {
220
- const c = new Date(r), m = c.getHours();
221
- o && m < 12 ? c.setHours(m + 12) : !o && m >= 12 && c.setHours(m - 12), n(c);
222
- };
223
- return /* @__PURE__ */ h("div", { className: "flex items-center gap-ds-02", children: [
224
- /* @__PURE__ */ e(
225
- "select",
226
- {
227
- value: t,
228
- onChange: (o) => d(Number(o.target.value)),
229
- className: "h-ds-sm rounded-ds-md border border-surface-border-strong bg-surface-raised px-ds-02 text-ds-sm text-surface-fg focus:outline-hidden focus:ring-2 focus:ring-accent-9",
230
- "aria-label": "Hour",
231
- children: Array.from({ length: 12 }, (o, c) => c + 1).map((o) => /* @__PURE__ */ e("option", { value: o, children: o }, o))
232
- }
233
- ),
234
- /* @__PURE__ */ e("span", { className: "text-ds-sm text-surface-fg-subtle font-medium", children: ":" }),
235
- /* @__PURE__ */ e(
236
- "select",
237
- {
238
- value: i - i % 5,
239
- onChange: (o) => u(Number(o.target.value)),
240
- className: "h-ds-sm rounded-ds-md border border-surface-border-strong bg-surface-raised px-ds-02 text-ds-sm text-surface-fg focus:outline-hidden focus:ring-2 focus:ring-accent-9",
241
- "aria-label": "Minute",
242
- children: Array.from({ length: 12 }, (o, c) => c * 5).map((o) => /* @__PURE__ */ e("option", { value: o, children: String(o).padStart(2, "0") }, o))
243
- }
244
- ),
245
- /* @__PURE__ */ h("div", { className: "inline-flex rounded-ds-md border border-surface-border-strong overflow-hidden", children: [
246
- /* @__PURE__ */ e(
247
- "button",
248
- {
249
- type: "button",
250
- onClick: () => f(!1),
251
- className: z(
252
- "px-ds-02b py-ds-01 text-ds-xs font-medium transition-colors duration-fast-01",
253
- s ? "bg-surface-raised text-surface-fg-subtle hover:bg-surface-raised-hover" : "bg-accent-9 text-white"
254
- ),
255
- children: "AM"
256
- }
257
- ),
258
- /* @__PURE__ */ e(
259
- "button",
260
- {
261
- type: "button",
262
- onClick: () => f(!0),
263
- className: z(
264
- "px-ds-02b py-ds-01 text-ds-xs font-medium transition-colors duration-fast-01",
265
- s ? "bg-accent-9 text-white" : "bg-surface-raised text-surface-fg-subtle hover:bg-surface-raised-hover"
266
- ),
267
- children: "PM"
268
- }
269
- )
270
- ] })
271
- ] });
272
- }
273
- function kr({
274
- value: r,
275
- onChange: n,
276
- minDate: t
277
- }) {
278
- const i = /* @__PURE__ */ new Date(), s = r ?? (() => {
279
- const o = new Date(i);
280
- return o.setHours(o.getHours() + 1, 0, 0, 0), o;
281
- })(), d = `${s.getFullYear()}-${String(s.getMonth() + 1).padStart(2, "0")}-${String(s.getDate()).padStart(2, "0")}`, u = (o) => {
282
- const c = o.target.value.split("-");
283
- if (c.length !== 3) return;
284
- const m = new Date(s);
285
- m.setFullYear(Number(c[0]), Number(c[1]) - 1, Number(c[2])), n(m);
286
- }, f = t ? `${t.getFullYear()}-${String(t.getMonth() + 1).padStart(2, "0")}-${String(t.getDate()).padStart(2, "0")}` : void 0;
287
- return /* @__PURE__ */ h("div", { className: "space-y-ds-03", children: [
288
- /* @__PURE__ */ h("div", { className: "flex items-center justify-between", children: [
289
- /* @__PURE__ */ e("span", { className: "text-ds-xs font-medium text-surface-fg-subtle", children: "Date" }),
290
- /* @__PURE__ */ e(
291
- "input",
292
- {
293
- type: "date",
294
- value: d,
295
- min: f,
296
- onChange: u,
297
- className: "h-ds-sm rounded-ds-md border border-surface-border-strong bg-surface-raised px-ds-03 text-ds-sm text-surface-fg focus:outline-hidden focus:ring-2 focus:ring-accent-9"
298
- }
299
- )
300
- ] }),
301
- /* @__PURE__ */ h("div", { className: "flex items-center justify-between", children: [
302
- /* @__PURE__ */ e("span", { className: "text-ds-xs font-medium text-surface-fg-subtle", children: "Time" }),
303
- /* @__PURE__ */ e(nt, { value: s, onChange: n })
304
- ] })
305
- ] });
306
- }
307
- function Cr({
308
- value: r,
309
- onChange: n,
310
- minDate: t
311
- }) {
312
- const i = /* @__PURE__ */ new Date(), s = r ?? (() => {
313
- const c = new Date(i);
314
- return c.setHours(c.getHours() + 1, 0, 0, 0), c;
315
- })(), { currentMonth: d, goToPreviousMonth: u, goToNextMonth: f } = ar(s);
316
- return /* @__PURE__ */ h("div", { className: "space-y-ds-03", children: [
317
- /* @__PURE__ */ e(
318
- cr,
319
- {
320
- currentMonth: d,
321
- selected: s,
322
- onSelect: (c) => {
323
- const m = new Date(c);
324
- m.setHours(s.getHours(), s.getMinutes(), 0, 0), n(m);
325
- },
326
- onMonthChange: (c) => {
327
- c < d ? u() : f();
328
- },
329
- minDate: t,
330
- className: "w-full"
331
- }
332
- ),
333
- /* @__PURE__ */ h("div", { className: "flex items-center justify-between border-t border-surface-border pt-ds-03", children: [
334
- /* @__PURE__ */ e("span", { className: "text-ds-xs font-medium text-surface-fg-subtle", children: "Time" }),
335
- /* @__PURE__ */ e(nt, { value: s, onChange: n })
336
- ] })
337
- ] });
338
- }
339
- function Nr({ onSchedule: r, onClose: n, onOpenDialog: t }) {
340
- const [i, s] = a.useState(!1), [d, u] = a.useState(null), f = a.useMemo(() => wr(), []), o = (m) => {
341
- r(m), n();
342
- }, c = () => {
343
- d && d > /* @__PURE__ */ new Date() && (r(d), n(), u(null), s(!1));
344
- };
345
- return i ? /* @__PURE__ */ h("div", { className: "p-ds-04", style: { minWidth: 270 }, children: [
346
- /* @__PURE__ */ h("div", { className: "mb-ds-03 flex items-center justify-between", children: [
347
- /* @__PURE__ */ e("p", { className: "text-ds-sm font-medium text-surface-fg", children: "Pick date & time" }),
348
- /* @__PURE__ */ e(
349
- "button",
350
- {
351
- type: "button",
352
- onClick: () => s(!1),
353
- className: "inline-flex items-center justify-center rounded-ds-md p-ds-01 text-surface-fg-subtle hover:bg-surface-raised-hover hover:text-surface-fg transition-colors",
354
- "aria-label": "Back to presets",
355
- children: /* @__PURE__ */ e(g, { icon: me, size: "sm" })
356
- }
357
- )
358
- ] }),
359
- /* @__PURE__ */ e(
360
- kr,
361
- {
362
- value: d,
363
- onChange: u,
364
- minDate: /* @__PURE__ */ new Date()
365
- }
366
- ),
367
- /* @__PURE__ */ e("div", { className: "mt-ds-03 flex justify-end", children: /* @__PURE__ */ e(
368
- Q,
369
- {
370
- variant: "solid",
371
- size: "sm",
372
- onClick: c,
373
- disabled: !d || d <= /* @__PURE__ */ new Date(),
374
- children: "Confirm"
375
- }
376
- ) })
377
- ] }) : /* @__PURE__ */ h("div", { className: "p-ds-02", style: { minWidth: 260 }, children: [
378
- /* @__PURE__ */ e("p", { className: "px-ds-03 py-ds-01 text-ds-xs font-medium text-surface-fg-subtle", children: "Schedule send" }),
379
- f.map((m, p) => /* @__PURE__ */ h(
380
- "button",
381
- {
382
- type: "button",
383
- onClick: () => o(m.date),
384
- className: "flex w-full items-center gap-ds-03 rounded-ds-md px-ds-03 py-ds-02b text-ds-sm text-surface-fg hover:bg-surface-raised-hover transition-colors duration-fast-01",
385
- children: [
386
- /* @__PURE__ */ e(g, { icon: Pe, size: "sm", className: "shrink-0 text-surface-fg-muted" }),
387
- m.label
388
- ]
389
- },
390
- p
391
- )),
392
- /* @__PURE__ */ e("div", { className: "mx-ds-02 my-ds-02 h-px bg-surface-border" }),
393
- /* @__PURE__ */ h(
394
- "button",
395
- {
396
- type: "button",
397
- onClick: () => s(!0),
398
- className: "flex w-full items-center gap-ds-03 rounded-ds-md px-ds-03 py-ds-02b text-ds-sm text-surface-fg hover:bg-surface-raised-hover transition-colors duration-fast-01",
399
- children: [
400
- /* @__PURE__ */ e(g, { icon: qe, size: "sm", className: "shrink-0 text-accent-11" }),
401
- "Pick date & time..."
402
- ]
403
- }
404
- ),
405
- t && /* @__PURE__ */ h(
406
- "button",
407
- {
408
- type: "button",
409
- onClick: () => {
410
- t(), n();
411
- },
412
- className: "flex w-full items-center gap-ds-03 rounded-ds-md px-ds-03 py-ds-02b text-ds-sm text-surface-fg hover:bg-surface-raised-hover transition-colors duration-fast-01",
413
- children: [
414
- /* @__PURE__ */ e(g, { icon: qe, size: "sm", className: "shrink-0 text-surface-fg-muted" }),
415
- "Open full picker..."
416
- ]
417
- }
418
- )
419
- ] });
420
- }
421
- function Sr({ open: r, onOpenChange: n, onSchedule: t, initialDate: i }) {
422
- const [s, d] = a.useState(i ?? null);
423
- return a.useEffect(() => {
424
- r && d(i ?? null);
425
- }, [r, i]), /* @__PURE__ */ e(lr, { open: r, onOpenChange: n, children: /* @__PURE__ */ h(dr, { className: "sm:max-w-[380px]", children: [
426
- /* @__PURE__ */ e(ur, { children: /* @__PURE__ */ e(fr, { children: i ? "Reschedule message" : "Schedule send" }) }),
427
- /* @__PURE__ */ e(
428
- Cr,
429
- {
430
- value: s,
431
- onChange: d,
432
- minDate: /* @__PURE__ */ new Date()
433
- }
434
- ),
435
- /* @__PURE__ */ h(mr, { className: "gap-ds-02", children: [
436
- /* @__PURE__ */ e(Q, { variant: "soft", onClick: () => n(!1), children: "Cancel" }),
437
- /* @__PURE__ */ e(
438
- Q,
439
- {
440
- variant: "solid",
441
- onClick: () => {
442
- s && s > /* @__PURE__ */ new Date() && (t(s), n(!1));
443
- },
444
- disabled: !s || s <= /* @__PURE__ */ new Date(),
445
- children: i ? "Reschedule" : "Schedule"
446
- }
447
- )
448
- ] })
449
- ] }) });
450
- }
451
- function Rr(r) {
452
- const n = /* @__PURE__ */ new Date(), t = new Date(n);
453
- t.setDate(t.getDate() + 1);
454
- const i = r.toDateString() === n.toDateString(), s = r.toDateString() === t.toDateString(), d = r.toLocaleTimeString(void 0, { hour: "numeric", minute: "2-digit" });
455
- return i ? `Today at ${d}` : s ? `Tomorrow at ${d}` : `${r.toLocaleDateString(void 0, { weekday: "short", month: "short", day: "numeric" })} at ${d}`;
456
- }
457
- function Ar({ date: r, onClear: n, onEdit: t }) {
458
- return /* @__PURE__ */ e(
459
- G.div,
460
- {
461
- initial: { height: 0, opacity: 0 },
462
- animate: { height: "auto", opacity: 1 },
463
- exit: { height: 0, opacity: 0 },
464
- transition: { duration: 0.15 },
465
- className: "overflow-hidden",
466
- children: /* @__PURE__ */ h("div", { className: "flex items-center gap-ds-03 px-ds-04 py-ds-02b text-ds-xs text-accent-11 bg-accent-2 border-b border-accent-4", children: [
467
- /* @__PURE__ */ e(g, { icon: Pe, size: "xs", className: "shrink-0" }),
468
- /* @__PURE__ */ h("span", { className: "flex-1 truncate", children: [
469
- "Scheduled for ",
470
- Rr(r)
471
- ] }),
472
- t && /* @__PURE__ */ e(
473
- "button",
474
- {
475
- type: "button",
476
- onClick: t,
477
- className: "inline-flex shrink-0 items-center justify-center rounded-ds-sm p-ds-01 hover:bg-accent-3 transition-colors",
478
- "aria-label": "Edit schedule",
479
- children: /* @__PURE__ */ e(g, { icon: Wt, size: "xs" })
480
- }
481
- ),
482
- /* @__PURE__ */ e(
483
- "button",
484
- {
485
- type: "button",
486
- onClick: n,
487
- className: "inline-flex shrink-0 items-center justify-center rounded-ds-sm p-ds-01 hover:bg-accent-3 transition-colors",
488
- "aria-label": "Cancel schedule",
489
- children: /* @__PURE__ */ e(g, { icon: me, size: "xs" })
490
- }
491
- )
492
- ] })
493
- }
494
- );
495
- }
496
- function We(r) {
497
- return r < 1024 ? `${r} B` : r < 1024 * 1024 ? `${(r / 1024).toFixed(1)} KB` : `${(r / (1024 * 1024)).toFixed(1)} MB`;
498
- }
499
- function Dr({
500
- attachments: r,
501
- onRemoveAttachment: n
502
- }) {
503
- return /* @__PURE__ */ e(
504
- G.div,
505
- {
506
- initial: { height: 0, opacity: 0 },
507
- animate: { height: "auto", opacity: 1 },
508
- exit: { height: 0, opacity: 0 },
509
- transition: { duration: 0.24, ease: [0.2, 0, 0.38, 0.9] },
510
- className: "overflow-hidden",
511
- children: /* @__PURE__ */ e(
512
- "div",
513
- {
514
- role: "list",
515
- "aria-label": "Attachments",
516
- className: "flex gap-ds-02 overflow-x-auto px-ds-04 py-ds-02b border-b border-surface-border",
517
- children: /* @__PURE__ */ e(fe, { initial: !1, children: r.map(
518
- (t) => t.type === "image" ? /* @__PURE__ */ h(
519
- G.div,
520
- {
521
- role: "listitem",
522
- "aria-label": `Image: ${t.name}`,
523
- layout: !0,
524
- initial: { scale: 0, opacity: 0 },
525
- animate: { scale: 1, opacity: 1 },
526
- exit: { scale: 0.95, opacity: 0 },
527
- transition: {
528
- layout: { type: "spring", stiffness: 400, damping: 30 },
529
- scale: { type: "spring", stiffness: 400, damping: 30 },
530
- opacity: { duration: 0.11 }
531
- },
532
- className: "relative h-12 w-12 shrink-0 group",
533
- children: [
534
- /* @__PURE__ */ e(
535
- "img",
536
- {
537
- src: t.url,
538
- alt: t.name,
539
- className: "h-full w-full rounded-ds-md object-cover"
540
- }
541
- ),
542
- /* @__PURE__ */ e(
543
- "button",
544
- {
545
- onClick: () => n(t.id),
546
- className: "absolute -top-1 -right-1 h-ico-sm w-ico-sm rounded-full bg-error-9 text-error-fg flex items-center justify-center opacity-0 group-hover:opacity-100 transition-opacity duration-fast-02",
547
- "aria-label": `Remove ${t.name}`,
548
- title: "Remove",
549
- children: /* @__PURE__ */ e(g, { icon: me, size: "xs" })
550
- }
551
- ),
552
- t.uploading && /* @__PURE__ */ e("div", { className: "absolute inset-0 rounded-ds-md bg-surface-overlay/50 flex items-center justify-center", children: /* @__PURE__ */ e(pr, { size: "sm" }) })
553
- ]
554
- },
555
- t.id
556
- ) : /* @__PURE__ */ h(
557
- G.div,
558
- {
559
- role: "listitem",
560
- "aria-label": `File: ${t.name}, ${We(t.size)}`,
561
- layout: !0,
562
- initial: { scale: 0, opacity: 0 },
563
- animate: { scale: 1, opacity: 1 },
564
- exit: { scale: 0.95, opacity: 0 },
565
- transition: {
566
- layout: { type: "spring", stiffness: 400, damping: 30 },
567
- scale: { type: "spring", stiffness: 400, damping: 30 },
568
- opacity: { duration: 0.11 }
569
- },
570
- className: "flex items-center gap-ds-02 shrink-0 rounded-ds-md bg-surface-raised px-ds-03 py-ds-01 group",
571
- children: [
572
- /* @__PURE__ */ e(
573
- g,
574
- {
575
- icon: Vt,
576
- size: "xs",
577
- className: "text-surface-fg-muted"
578
- }
579
- ),
580
- /* @__PURE__ */ e("span", { className: "text-ds-xs text-surface-fg-muted truncate max-w-[120px]", children: t.name }),
581
- /* @__PURE__ */ e("span", { className: "text-ds-xs text-surface-fg-subtle", children: We(t.size) }),
582
- /* @__PURE__ */ e(
583
- "button",
584
- {
585
- onClick: () => n(t.id),
586
- className: "text-surface-fg-subtle hover:text-error-11 opacity-0 group-hover:opacity-100 transition-opacity duration-fast-02",
587
- "aria-label": `Remove ${t.name}`,
588
- title: "Remove",
589
- children: /* @__PURE__ */ e(g, { icon: me, size: "xs" })
590
- }
591
- )
592
- ]
593
- },
594
- t.id
595
- )
596
- ) })
597
- }
598
- )
599
- }
600
- );
601
- }
602
- const Be = a.forwardRef(
603
- function({
604
- mode: n,
605
- analyserNode: t,
606
- data: i,
607
- progress: s = 0,
608
- barWidth: d = 3,
609
- barGap: u = 2,
610
- barCount: f = 40,
611
- height: o = 32,
612
- className: c,
613
- ...m
614
- }, p) {
615
- const [N, w] = a.useState(
616
- () => new Array(f).fill(0.05)
617
- ), B = a.useRef(0), R = a.useRef(N);
618
- a.useEffect(() => {
619
- if (n !== "live" || !t) return;
620
- const k = new Uint8Array(t.frequencyBinCount), T = 0.3, S = () => {
621
- t.getByteFrequencyData(k);
622
- const A = Math.floor(k.length / f), U = new Array(f);
623
- for (let M = 0; M < f; M++) {
624
- let y = 0;
625
- for (let _ = 0; _ < A; _++)
626
- y += k[M * A + _];
627
- const $ = y / (A * 255);
628
- U[M] = R.current[M] + ($ - R.current[M]) * T;
629
- }
630
- R.current = U, w(U), B.current = requestAnimationFrame(S);
631
- };
632
- return B.current = requestAnimationFrame(S), () => cancelAnimationFrame(B.current);
633
- }, [n, t, f]), a.useEffect(() => {
634
- if (!(n !== "static" || !i))
635
- if (i.length === f)
636
- w(i);
637
- else {
638
- const k = new Array(f), T = i.length / f;
639
- for (let S = 0; S < f; S++) {
640
- const A = Math.floor(S * T);
641
- k[S] = i[Math.min(A, i.length - 1)];
642
- }
643
- w(k);
644
- }
645
- }, [n, i, f]);
646
- const P = f * (d + u) - u, j = a.useMemo(
647
- () => N.map((k, T) => {
648
- const S = Math.max(2, k * o), A = T * (d + u), U = (o - S) / 2, M = n === "static" && s > 0 && T / f <= s;
649
- return /* @__PURE__ */ e(
650
- "rect",
651
- {
652
- x: A,
653
- y: U,
654
- width: d,
655
- height: S,
656
- rx: d / 2,
657
- fill: M ? "var(--color-accent-9)" : "var(--color-surface-border)"
658
- },
659
- T
660
- );
661
- }),
662
- [N, s, n, d, u, f, o]
663
- );
664
- return /* @__PURE__ */ e(
665
- "svg",
666
- {
667
- ref: p,
668
- height: o,
669
- viewBox: `0 0 ${P} ${o}`,
670
- preserveAspectRatio: "none",
671
- "aria-hidden": "true",
672
- className: z("shrink-0", c),
673
- ...m,
674
- children: j
675
- }
676
- );
677
- }
678
- );
679
- Be.displayName = "AudioWaveform";
680
- function Er(r) {
681
- const n = Math.floor(r / 60), t = Math.floor(r % 60);
682
- return {
683
- minutes: String(n),
684
- separator: ":",
685
- secs: t.toString().padStart(2, "0")
686
- };
687
- }
688
- function st({
689
- duration: r,
690
- analyserNode: n,
691
- maxDuration: t,
692
- onCancel: i
693
- }) {
694
- const s = or();
695
- a.useEffect(() => {
696
- const m = (p) => {
697
- p.key === "Escape" && i();
698
- };
699
- return document.addEventListener("keydown", m), () => document.removeEventListener("keydown", m);
700
- }, [i]);
701
- const d = t != null && t > 0 && r >= t - 10, u = t != null && t > 0 && r >= t - 5, f = u ? "animate-[pulse_500ms_ease-in-out_infinite]" : "animate-[pulse_1s_ease-in-out_infinite]", o = Er(r), c = u ? "text-error-11" : d ? "text-warning-11" : "text-surface-fg";
702
- return /* @__PURE__ */ h(
703
- "div",
704
- {
705
- role: "status",
706
- "aria-live": "polite",
707
- "aria-label": "Recording voice message",
708
- className: "absolute inset-0 flex items-center gap-ds-03 px-ds-04 py-ds-03 bg-surface-raised-hover rounded-ds-lg z-10",
709
- children: [
710
- /* @__PURE__ */ e(
711
- "span",
712
- {
713
- className: z(
714
- "w-ds-02b h-ds-02b shrink-0 rounded-ds-full bg-error-9",
715
- s ? "opacity-100" : f
716
- ),
717
- "aria-hidden": "true"
718
- }
719
- ),
720
- /* @__PURE__ */ h(
721
- "span",
722
- {
723
- className: z(
724
- "text-ds-sm font-mono tabular-nums whitespace-nowrap",
725
- c
726
- ),
727
- "aria-label": `${o.minutes} minutes ${o.secs} seconds`,
728
- children: [
729
- o.minutes,
730
- /* @__PURE__ */ e(
731
- "span",
732
- {
733
- className: s ? void 0 : "animate-[blink_1s_step-end_infinite]",
734
- "aria-hidden": "true",
735
- children: o.separator
736
- }
737
- ),
738
- o.secs
739
- ]
740
- }
741
- ),
742
- /* @__PURE__ */ e("div", { className: "flex-1 min-w-0 overflow-hidden", children: /* @__PURE__ */ e(
743
- Be,
744
- {
745
- mode: "live",
746
- analyserNode: n,
747
- height: 24,
748
- barCount: 60,
749
- className: "w-full"
750
- }
751
- ) })
752
- ]
753
- }
754
- );
755
- }
756
- st.displayName = "RecordingOverlay";
757
- const it = a.createContext(null);
758
- function H() {
759
- const r = a.useContext(it);
760
- if (!r) throw new Error("Toolbar primitives must be used inside <ChatToolbar>");
761
- return r;
762
- }
763
- function q({
764
- onClick: r,
765
- isActive: n,
766
- disabled: t,
767
- title: i,
768
- children: s,
769
- className: d
770
- }) {
771
- const { disabled: u } = H();
772
- return /* @__PURE__ */ e(
773
- "button",
774
- {
775
- type: "button",
776
- onClick: r,
777
- disabled: t ?? u,
778
- title: i,
779
- "aria-label": i,
780
- "aria-pressed": n,
781
- className: z(
782
- "inline-flex h-ds-xs-plus items-center justify-center rounded-ds-md touch-target",
783
- !d?.includes("w-") && "w-ds-xs-plus",
784
- "transition-[color,background-color,transform] duration-fast-01 ease-productive-standard",
785
- "hover:bg-surface-raised-hover hover:text-surface-fg",
786
- "active:scale-95",
787
- "disabled:pointer-events-none disabled:opacity-action-disabled",
788
- n ? "bg-surface-raised-hover text-accent-11" : "text-surface-fg-subtle",
789
- d
790
- ),
791
- children: s
792
- }
793
- );
794
- }
795
- function Te() {
796
- return /* @__PURE__ */ e("div", { className: "h-4 w-px bg-surface-border-subtle mx-ds-01" });
797
- }
798
- function ve({ children: r, className: n }) {
799
- return /* @__PURE__ */ e("div", { className: z("flex items-center gap-ds-01", n), children: r });
800
- }
801
- function zr() {
802
- const { editor: r } = H(), { isActive: n } = W({
803
- editor: r,
804
- selector: ({ editor: t }) => ({ isActive: t.isActive("bold") })
805
- });
806
- return /* @__PURE__ */ e(q, { onClick: () => r.chain().focus().toggleBold().run(), isActive: n, title: "Bold", children: /* @__PURE__ */ e(g, { icon: Qe, size: "xs" }) });
807
- }
808
- function Tr() {
809
- const { editor: r } = H(), { isActive: n } = W({
810
- editor: r,
811
- selector: ({ editor: t }) => ({ isActive: t.isActive("italic") })
812
- });
813
- return /* @__PURE__ */ e(q, { onClick: () => r.chain().focus().toggleItalic().run(), isActive: n, title: "Italic", children: /* @__PURE__ */ e(g, { icon: Ge, size: "xs" }) });
814
- }
815
- function Mr() {
816
- const { editor: r } = H(), { isActive: n } = W({
817
- editor: r,
818
- selector: ({ editor: t }) => ({ isActive: t.isActive("underline") })
819
- });
820
- return /* @__PURE__ */ e(q, { onClick: () => r.chain().focus().toggleUnderline().run(), isActive: n, title: "Underline", children: /* @__PURE__ */ e(g, { icon: Je, size: "xs" }) });
821
- }
822
- function Ir() {
823
- const { editor: r } = H(), { isActive: n } = W({
824
- editor: r,
825
- selector: ({ editor: t }) => ({ isActive: t.isActive("strike") })
826
- });
827
- return /* @__PURE__ */ e(q, { onClick: () => r.chain().focus().toggleStrike().run(), isActive: n, title: "Strikethrough", children: /* @__PURE__ */ e(g, { icon: Ze, size: "xs" }) });
828
- }
829
- function Pr() {
830
- const { editor: r } = H(), { isActive: n } = W({
831
- editor: r,
832
- selector: ({ editor: t }) => ({ isActive: t.isActive("highlight") })
833
- });
834
- return /* @__PURE__ */ e(q, { onClick: () => r.chain().focus().toggleHighlight().run(), isActive: n, title: "Highlight", children: /* @__PURE__ */ e(g, { icon: et, size: "xs" }) });
835
- }
836
- function Br() {
837
- const { editor: r } = H(), { isActive: n } = W({
838
- editor: r,
839
- selector: ({ editor: t }) => ({ isActive: t.isActive("code") })
840
- });
841
- return /* @__PURE__ */ e(q, { onClick: () => r.chain().focus().toggleCode().run(), isActive: n, title: "Inline code", children: /* @__PURE__ */ e(g, { icon: tt, size: "xs" }) });
842
- }
843
- function Lr() {
844
- const { editor: r } = H(), { isActive: n } = W({
845
- editor: r,
846
- selector: ({ editor: t }) => ({ isActive: t.isActive("bulletList") })
847
- });
848
- return /* @__PURE__ */ e(q, { onClick: () => r.chain().focus().toggleBulletList().run(), isActive: n, title: "Bullet list", children: /* @__PURE__ */ e(g, { icon: Yt, size: "xs" }) });
849
- }
850
- function _r() {
851
- const { editor: r } = H(), { isActive: n } = W({
852
- editor: r,
853
- selector: ({ editor: t }) => ({ isActive: t.isActive("orderedList") })
854
- });
855
- return /* @__PURE__ */ e(q, { onClick: () => r.chain().focus().toggleOrderedList().run(), isActive: n, title: "Ordered list", children: /* @__PURE__ */ e(g, { icon: Xt, size: "xs" }) });
856
- }
857
- function Hr() {
858
- const { editor: r } = H(), { isActive: n } = W({
859
- editor: r,
860
- selector: ({ editor: t }) => ({ isActive: t.isActive("blockquote") })
861
- });
862
- return /* @__PURE__ */ e(q, { onClick: () => r.chain().focus().toggleBlockquote().run(), isActive: n, title: "Quote", children: /* @__PURE__ */ e(g, { icon: Qt, size: "xs" }) });
863
- }
864
- function jr() {
865
- const { editor: r } = H(), { isActive: n } = W({
866
- editor: r,
867
- selector: ({ editor: t }) => ({ isActive: t.isActive("link") })
868
- });
869
- return /* @__PURE__ */ e(
870
- q,
871
- {
872
- onClick: () => {
873
- const t = window.prompt("URL");
874
- t && r.chain().focus().setLink({ href: t }).run();
875
- },
876
- isActive: n,
877
- title: "Link",
878
- children: /* @__PURE__ */ e(g, { icon: Gt, size: "xs" })
879
- }
880
- );
881
- }
882
- function $r() {
883
- const { editor: r } = H();
884
- return /* @__PURE__ */ e(q, { onClick: () => r.chain().focus().insertContent("@").run(), title: "Mention", children: /* @__PURE__ */ e(g, { icon: Jt, size: "xs" }) });
885
- }
886
- function Fr() {
887
- const { editor: r } = H();
888
- return /* @__PURE__ */ e(q, { onClick: () => r.chain().focus().insertContent(":").run(), title: "Emoji", children: /* @__PURE__ */ e(g, { icon: rt, size: "xs" }) });
889
- }
890
- function qr() {
891
- const { editor: r } = H();
892
- return /* @__PURE__ */ e(q, { onClick: () => r.chain().focus().insertContent("/").run(), title: "Slash command", children: /* @__PURE__ */ e(g, { icon: Zt, size: "xs" }) });
893
- }
894
- function Ur({ items: r, isMobile: n, hasMentions: t, hasSlashCommands: i }) {
895
- const s = (d) => !r || r.includes(d);
896
- return /* @__PURE__ */ h(wt, { children: [
897
- !n && /* @__PURE__ */ h(ve, { children: [
898
- s("bold") && /* @__PURE__ */ e(zr, {}),
899
- s("italic") && /* @__PURE__ */ e(Tr, {}),
900
- s("underline") && /* @__PURE__ */ e(Mr, {}),
901
- s("strike") && /* @__PURE__ */ e(Ir, {}),
902
- s("highlight") && /* @__PURE__ */ e(Pr, {})
903
- ] }),
904
- !n && /* @__PURE__ */ e(Te, {}),
905
- !n && /* @__PURE__ */ h(ve, { children: [
906
- s("bulletList") && /* @__PURE__ */ e(Lr, {}),
907
- s("orderedList") && /* @__PURE__ */ e(_r, {})
908
- ] }),
909
- !n && (s("blockquote") || s("link") || s("code")) && /* @__PURE__ */ e(Te, {}),
910
- !n && /* @__PURE__ */ h(ve, { children: [
911
- s("blockquote") && /* @__PURE__ */ e(Hr, {}),
912
- s("link") && /* @__PURE__ */ e(jr, {}),
913
- s("code") && /* @__PURE__ */ e(Br, {})
914
- ] }),
915
- !n && (t || i) && /* @__PURE__ */ e(Te, {}),
916
- /* @__PURE__ */ h(ve, { children: [
917
- t && s("mention") && /* @__PURE__ */ e($r, {}),
918
- s("emoji") && /* @__PURE__ */ e(Fr, {}),
919
- i && s("slash") && /* @__PURE__ */ e(qr, {})
920
- ] })
921
- ] });
922
- }
923
- function Ve({
924
- editor: r,
925
- toolbar: n,
926
- isMobile: t,
927
- hasMentions: i,
928
- hasSlashCommands: s,
929
- disabled: d
930
- }) {
931
- if (n === !1) return null;
932
- const u = typeof n != "boolean" && !Array.isArray(n), f = Array.isArray(n) ? n : null;
933
- return /* @__PURE__ */ e(it.Provider, { value: { editor: r, disabled: d }, children: /* @__PURE__ */ e(
934
- "div",
935
- {
936
- role: "toolbar",
937
- "aria-label": "Text formatting",
938
- className: "flex flex-wrap items-center gap-ds-01 border-t border-surface-border px-ds-04 py-ds-02b",
939
- children: u ? (
940
- // Consumer provides their own toolbar content
941
- n
942
- ) : (
943
- // Default layout (full or whitelist)
944
- /* @__PURE__ */ e(Ur, { items: f, isMobile: t, hasMentions: i, hasSlashCommands: s })
945
- )
946
- }
947
- ) });
948
- }
949
- const Me = [1, 1.5, 2];
950
- function Ye(r) {
951
- const n = Math.floor(r / 60), t = Math.floor(r % 60);
952
- return `${n}:${t.toString().padStart(2, "0")}`;
953
- }
954
- const ot = a.forwardRef(
955
- function({ src: n, duration: t, waveformData: i, className: s, ...d }, u) {
956
- const f = a.useRef(null), o = a.useRef(null), [c, m] = a.useState(!1), [p, N] = a.useState(0), [w, B] = a.useState(0), [R, P] = a.useState(null), j = a.useMemo(() => {
957
- if (typeof n == "string") return n;
958
- const y = URL.createObjectURL(n);
959
- return P(y), y;
960
- }, [n]);
961
- a.useEffect(() => () => {
962
- R && URL.revokeObjectURL(R);
963
- }, [R]), a.useEffect(() => {
964
- const y = f.current;
965
- if (!y) return;
966
- const $ = () => N(y.currentTime), _ = () => {
967
- m(!1), N(0);
968
- };
969
- return y.addEventListener("timeupdate", $), y.addEventListener("ended", _), () => {
970
- y.removeEventListener("timeupdate", $), y.removeEventListener("ended", _);
971
- };
972
- }, []);
973
- const k = a.useCallback(() => {
974
- const y = f.current;
975
- y && (c ? (y.pause(), m(!1)) : (y.play(), m(!0)));
976
- }, [c]), T = a.useCallback(
977
- (y) => {
978
- (y.key === " " || y.key === "Enter") && (y.preventDefault(), k());
979
- },
980
- [k]
981
- ), S = a.useCallback(
982
- (y) => {
983
- const $ = f.current, _ = o.current;
984
- if (!$ || !_ || t <= 0) return;
985
- const te = _.getBoundingClientRect(), J = y.clientX - te.left, I = Math.max(0, Math.min(1, J / te.width));
986
- $.currentTime = I * t, N($.currentTime);
987
- },
988
- [t]
989
- ), A = a.useCallback(() => {
990
- const y = (w + 1) % Me.length;
991
- B(y), f.current && (f.current.playbackRate = Me[y]);
992
- }, [w]), U = t > 0 ? p / t : 0, M = Me[w];
993
- return /* @__PURE__ */ h(
994
- "div",
995
- {
996
- ref: u,
997
- role: "group",
998
- "aria-label": "Voice message player",
999
- className: z("flex items-center gap-ds-03", s),
1000
- ...d,
1001
- children: [
1002
- /* @__PURE__ */ e("audio", { ref: f, src: j, preload: "metadata" }),
1003
- /* @__PURE__ */ e(
1004
- "button",
1005
- {
1006
- type: "button",
1007
- onClick: k,
1008
- onKeyDown: T,
1009
- "aria-label": c ? "Pause voice message" : "Play voice message",
1010
- className: "inline-flex h-8 w-8 shrink-0 items-center justify-center rounded-ds-full bg-accent-9 text-accent-fg hover:bg-accent-10 active:scale-95 transition-colors duration-fast-01 focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-accent-9 focus-visible:ring-offset-2",
1011
- children: c ? /* @__PURE__ */ e(er, { size: 16, stroke: 2, "aria-hidden": "true" }) : /* @__PURE__ */ e(tr, { size: 16, stroke: 2, "aria-hidden": "true" })
1012
- }
1013
- ),
1014
- /* @__PURE__ */ e(
1015
- Be,
1016
- {
1017
- ref: o,
1018
- mode: "static",
1019
- data: i,
1020
- progress: U,
1021
- className: "cursor-pointer",
1022
- onClick: S
1023
- }
1024
- ),
1025
- /* @__PURE__ */ h("span", { className: "text-ds-xs tabular-nums text-surface-fg-subtle whitespace-nowrap", children: [
1026
- Ye(p),
1027
- " / ",
1028
- Ye(t)
1029
- ] }),
1030
- /* @__PURE__ */ h(
1031
- "button",
1032
- {
1033
- type: "button",
1034
- onClick: A,
1035
- "aria-label": `Playback speed ${M}x`,
1036
- className: "shrink-0 text-ds-xs bg-surface-raised rounded-ds-full px-ds-02 py-[1px] hover:bg-surface-raised-hover tabular-nums transition-colors duration-fast-01 focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-accent-9 focus-visible:ring-offset-2",
1037
- children: [
1038
- M,
1039
- "x"
1040
- ]
1041
- }
1042
- )
1043
- ]
1044
- }
1045
- );
1046
- }
1047
- );
1048
- ot.displayName = "AudioPlayer";
1049
- function Or() {
1050
- return typeof MediaRecorder < "u" && MediaRecorder.isTypeSupported("audio/webm;codecs=opus") ? "audio/webm;codecs=opus" : typeof MediaRecorder < "u" && MediaRecorder.isTypeSupported("audio/mp4") ? "audio/mp4" : "";
1051
- }
1052
- function Kr(r) {
1053
- const { maxDuration: n, onComplete: t } = r, [i, s] = be("idle"), [d, u] = be(0), [f, o] = be(null), [c, m] = be([]), p = K(null), N = K(null), w = K(null), B = K([]), R = K(null), P = K(null), j = K(null), k = K(null), T = K(0), S = K([]), A = K(!1), U = K(t);
1054
- U.current = t;
1055
- const M = le(() => {
1056
- R.current !== null && (clearInterval(R.current), R.current = null), P.current !== null && (clearInterval(P.current), P.current = null), j.current !== null && (clearTimeout(j.current), j.current = null), w.current && (w.current.getTracks().forEach((I) => I.stop()), w.current = null), N.current && (N.current.close().catch(() => {
1057
- }), N.current = null), k.current = null, o(null), p.current = null, B.current = [];
1058
- }, []), y = le(async () => {
1059
- if (typeof MediaRecorder > "u")
1060
- throw new Error(
1061
- "MediaRecorder is not supported in this browser. Voice recording requires a modern browser with MediaRecorder support."
1062
- );
1063
- const I = await navigator.mediaDevices.getUserMedia({ audio: !0 });
1064
- w.current = I;
1065
- const F = Or(), Z = F ? new MediaRecorder(I, { mimeType: F }) : new MediaRecorder(I);
1066
- p.current = Z, B.current = [], A.current = !1;
1067
- const V = new AudioContext();
1068
- N.current = V;
1069
- const xe = V.createMediaStreamSource(I), D = V.createAnalyser();
1070
- D.fftSize = 256, D.smoothingTimeConstant = 0.7, xe.connect(D), k.current = D, o(D), Z.ondataavailable = (L) => {
1071
- L.data.size > 0 && B.current.push(L.data);
1072
- }, Z.onstop = () => {
1073
- if (A.current)
1074
- M(), s("idle"), u(0), m([]);
1075
- else {
1076
- const L = new Blob(B.current, {
1077
- type: Z.mimeType || "audio/webm"
1078
- }), ae = T.current, O = S.current;
1079
- M(), s("idle"), u(0), m([]), U.current(L, ae, O);
1080
- }
1081
- }, Z.start(), u(0), T.current = 0, R.current = setInterval(() => {
1082
- T.current += 1, u((L) => L + 1);
1083
- }, 1e3);
1084
- const Y = new Uint8Array(D.frequencyBinCount);
1085
- m([]), S.current = [], P.current = setInterval(() => {
1086
- if (k.current) {
1087
- k.current.getByteFrequencyData(Y);
1088
- let L = 0;
1089
- for (let O = 0; O < Y.length; O++)
1090
- L += Y[O];
1091
- const ae = L / Y.length / 255;
1092
- S.current = [...S.current, ae], m((O) => [...O, ae]);
1093
- }
1094
- }, 100), n !== void 0 && n > 0 && (j.current = setTimeout(() => {
1095
- p.current && p.current.state !== "inactive" && p.current.stop();
1096
- }, n * 1e3)), s("recording");
1097
- }, [n, M]), $ = le(() => {
1098
- p.current && p.current.state !== "inactive" && (A.current = !1, p.current.stop());
1099
- }, []), _ = le(() => {
1100
- p.current && p.current.state !== "inactive" ? (A.current = !0, p.current.stop()) : (M(), s("idle"), u(0), m([]));
1101
- }, [M]), te = le(() => {
1102
- p.current && p.current.state === "recording" && (p.current.pause(), R.current !== null && (clearInterval(R.current), R.current = null), P.current !== null && (clearInterval(P.current), P.current = null), s("paused"));
1103
- }, []), J = le(() => {
1104
- if (p.current && p.current.state === "paused") {
1105
- p.current.resume(), R.current = setInterval(() => {
1106
- T.current += 1, u((F) => F + 1);
1107
- }, 1e3);
1108
- const I = new Uint8Array(
1109
- k.current?.frequencyBinCount ?? 128
1110
- );
1111
- P.current = setInterval(() => {
1112
- if (k.current) {
1113
- k.current.getByteFrequencyData(I);
1114
- let F = 0;
1115
- for (let V = 0; V < I.length; V++)
1116
- F += I[V];
1117
- const Z = F / I.length / 255;
1118
- S.current = [...S.current, Z], m((V) => [...V, Z]);
1119
- }
1120
- }, 100), s("recording");
1121
- }
1122
- }, []);
1123
- return kt(() => () => {
1124
- R.current !== null && clearInterval(R.current), P.current !== null && clearInterval(P.current), j.current !== null && clearTimeout(j.current), p.current && p.current.state !== "inactive" && p.current.stop(), w.current && w.current.getTracks().forEach((I) => I.stop()), N.current && N.current.close().catch(() => {
1125
- });
1126
- }, []), {
1127
- state: i,
1128
- duration: d,
1129
- analyserNode: f,
1130
- waveformData: c,
1131
- start: y,
1132
- stop: $,
1133
- cancel: _,
1134
- pause: te,
1135
- resume: J
1136
- };
1137
- }
1138
- const Wr = {
1139
- compact: { minHeight: 44, maxHeight: 256, showToolbar: !0, toolbarPosition: "bottom" },
1140
- expanded: { minHeight: 96, maxHeight: 384, showToolbar: !0, toolbarPosition: "bottom" },
1141
- minimal: { minHeight: 44, maxHeight: 128, showToolbar: !1, toolbarPosition: "bottom" },
1142
- inline: { minHeight: 40, maxHeight: 160, showToolbar: !1, toolbarPosition: "top" }
1143
- }, Vr = [
1144
- "prose prose-sm max-w-none focus:outline-hidden",
1145
- "font-body text-ds-md leading-relaxed text-surface-fg",
1146
- "[&_p.is-editor-empty:first-child]:relative",
1147
- "[&_p.is-editor-empty:first-child::before]:text-surface-fg-subtle [&_p.is-editor-empty:first-child::before]:content-[attr(data-placeholder)] [&_p.is-editor-empty:first-child::before]:pointer-events-none [&_p.is-editor-empty:first-child::before]:absolute [&_p.is-editor-empty:first-child::before]:left-0 [&_p.is-editor-empty:first-child::before]:top-0 [&_p.is-editor-empty:first-child::before]:w-full [&_p.is-editor-empty:first-child::before]:truncate",
1148
- "[&_p]:mb-ds-01 [&_p]:text-surface-fg",
1149
- "[&_p:last-child]:mb-0",
1150
- "[&_ul]:ml-ds-04 [&_ul]:list-disc [&_ol]:ml-ds-04 [&_ol]:list-decimal",
1151
- "[&_li]:text-surface-fg",
1152
- "[&_code]:rounded [&_code]:bg-surface-raised [&_code]:px-ds-02 [&_code]:py-[1px] [&_code]:text-ds-md [&_code]:text-accent-11",
1153
- "[&_strong]:font-semibold [&_strong]:text-surface-fg",
1154
- "[[&_mark]:rounded-sm_mark]:rounded-xs [&_mark]:bg-warning-3 [&_mark]:px-[2px]",
1155
- "[&_a]:text-accent-11 [&_a]:underline",
1156
- "[&_.mention]:rounded-ds-sm [&_.mention]:bg-accent-2 [&_.mention]:px-ds-02 [&_.mention]:py-[1px] [&_.mention]:font-medium [&_.mention]:text-accent-11"
1157
- ].join(" ");
1158
- function Yr({ options: r }) {
1159
- const [n, t] = a.useState(!1), i = a.useRef(null);
1160
- return a.useEffect(() => {
1161
- if (!n) return;
1162
- const s = (d) => {
1163
- i.current && !i.current.contains(d.target) && t(!1);
1164
- };
1165
- return document.addEventListener("mousedown", s), () => document.removeEventListener("mousedown", s);
1166
- }, [n]), /* @__PURE__ */ h("div", { ref: i, className: "relative", children: [
1167
- /* @__PURE__ */ e(
1168
- "button",
1169
- {
1170
- type: "button",
1171
- onClick: () => t((s) => !s),
1172
- title: "More send options",
1173
- "aria-label": "More send options",
1174
- "aria-expanded": n,
1175
- className: z(
1176
- "inline-flex h-ds-xs-plus w-5 items-center justify-center rounded-ds-md touch-target",
1177
- "text-surface-fg-subtle hover:bg-surface-raised-hover hover:text-surface-fg",
1178
- "transition-colors duration-fast-01 ease-productive-standard",
1179
- n && "bg-surface-raised-hover text-surface-fg"
1180
- ),
1181
- children: /* @__PURE__ */ e(g, { icon: ir, size: "xs" })
1182
- }
1183
- ),
1184
- n && /* @__PURE__ */ h("div", { className: "absolute bottom-full right-0 mb-ds-02 min-w-[200px] rounded-ds-lg border border-surface-border-strong bg-surface-overlay p-ds-02 shadow-floating z-popover", children: [
1185
- /* @__PURE__ */ e("p", { className: "px-ds-03 py-ds-01 text-ds-xs font-medium text-surface-fg-subtle", children: "Send options" }),
1186
- r.map((s, d) => /* @__PURE__ */ h(
1187
- "button",
1188
- {
1189
- type: "button",
1190
- onClick: () => {
1191
- s.onSelect(), t(!1);
1192
- },
1193
- className: "flex w-full items-center gap-ds-03 rounded-ds-md px-ds-03 py-ds-02 text-ds-sm text-surface-fg hover:bg-surface-raised-hover transition-colors duration-fast-01",
1194
- children: [
1195
- s.icon && /* @__PURE__ */ e(s.icon, { className: "h-ico-sm w-ico-sm text-surface-fg-muted" }),
1196
- s.label
1197
- ]
1198
- },
1199
- d
1200
- ))
1201
- ] })
1202
- ] });
1203
- }
1204
- const Xr = a.lazy(() => import("@emoji-mart/react"));
1205
- function Qr({ set: r = "native", onSelect: n, onClose: t }) {
1206
- const [i, s] = a.useState(null), { colorMode: d } = gr(), u = a.useRef(null);
1207
- a.useEffect(() => {
1208
- (Ke[r] ?? Ke.native)().then((c) => s(c.default));
1209
- }, [r]), a.useEffect(() => {
1210
- const o = (c) => {
1211
- u.current && !u.current.contains(c.target) && t();
1212
- };
1213
- return document.addEventListener("mousedown", o), () => document.removeEventListener("mousedown", o);
1214
- }, [t]), a.useEffect(() => {
1215
- const o = (c) => {
1216
- c.key === "Escape" && t();
1217
- };
1218
- return document.addEventListener("keydown", o), () => document.removeEventListener("keydown", o);
1219
- }, [t]);
1220
- const f = /* @__PURE__ */ e("div", { className: "flex h-[350px] w-[352px] items-center justify-center rounded-ds-lg border border-surface-border-strong bg-surface-overlay shadow-floating", children: /* @__PURE__ */ e("span", { className: "text-ds-sm text-surface-fg-subtle", children: "Loading..." }) });
1221
- return /* @__PURE__ */ e("div", { ref: u, className: "rounded-ds-lg border border-surface-border-strong bg-surface-overlay shadow-floating overflow-hidden", children: i ? /* @__PURE__ */ e(a.Suspense, { fallback: f, children: /* @__PURE__ */ e(
1222
- Xr,
1223
- {
1224
- data: i,
1225
- set: r,
1226
- onEmojiSelect: (o) => n({ id: o.id, native: o.native }),
1227
- theme: d === "dark" ? "dark" : "light",
1228
- previewPosition: "none",
1229
- skinTonePosition: "none"
1230
- }
1231
- ) }) : f });
1232
- }
1233
- function de({
1234
- onClick: r,
1235
- isActive: n = !1,
1236
- title: t,
1237
- children: i
1238
- }) {
1239
- return /* @__PURE__ */ e(
1240
- "button",
1241
- {
1242
- type: "button",
1243
- onClick: r,
1244
- title: t,
1245
- "aria-label": t,
1246
- "aria-pressed": n,
1247
- className: z(
1248
- "inline-flex h-ds-xs-plus w-ds-xs-plus items-center justify-center rounded-ds-md touch-target",
1249
- "transition-colors duration-fast-01 ease-productive-standard",
1250
- "hover:bg-surface-raised-hover",
1251
- n ? "bg-surface-raised-hover text-accent-11" : "text-surface-fg-subtle"
1252
- ),
1253
- children: i
1254
- }
1255
- );
1256
- }
1257
- function Gr({ editor: r }) {
1258
- const n = W({
1259
- editor: r,
1260
- selector: ({ editor: t }) => ({
1261
- isBold: t.isActive("bold"),
1262
- isItalic: t.isActive("italic"),
1263
- isUnderline: t.isActive("underline"),
1264
- isStrike: t.isActive("strike"),
1265
- isHighlight: t.isActive("highlight"),
1266
- isCode: t.isActive("code")
1267
- })
1268
- });
1269
- return /* @__PURE__ */ h(
1270
- Ht,
1271
- {
1272
- editor: r,
1273
- className: "flex gap-ds-01 rounded-ds-lg border border-surface-border-strong bg-surface-overlay p-ds-02 shadow-floating",
1274
- children: [
1275
- /* @__PURE__ */ e(de, { onClick: () => r.chain().focus().toggleBold().run(), isActive: n.isBold, title: "Bold", children: /* @__PURE__ */ e(g, { icon: Qe, size: "xs" }) }),
1276
- /* @__PURE__ */ e(de, { onClick: () => r.chain().focus().toggleItalic().run(), isActive: n.isItalic, title: "Italic", children: /* @__PURE__ */ e(g, { icon: Ge, size: "xs" }) }),
1277
- /* @__PURE__ */ e(de, { onClick: () => r.chain().focus().toggleUnderline().run(), isActive: n.isUnderline, title: "Underline", children: /* @__PURE__ */ e(g, { icon: Je, size: "xs" }) }),
1278
- /* @__PURE__ */ e(de, { onClick: () => r.chain().focus().toggleStrike().run(), isActive: n.isStrike, title: "Strikethrough", children: /* @__PURE__ */ e(g, { icon: Ze, size: "xs" }) }),
1279
- /* @__PURE__ */ e(de, { onClick: () => r.chain().focus().toggleHighlight().run(), isActive: n.isHighlight, title: "Highlight", children: /* @__PURE__ */ e(g, { icon: et, size: "xs" }) }),
1280
- /* @__PURE__ */ e(de, { onClick: () => r.chain().focus().toggleCode().run(), isActive: n.isCode, title: "Code", children: /* @__PURE__ */ e(g, { icon: tt, size: "xs" }) })
1281
- ]
1282
- }
1283
- );
1284
- }
1285
- const Jr = a.forwardRef(
1286
- function({
1287
- onSubmit: n,
1288
- placeholder: t = "Type a message...",
1289
- disabled: i = !1,
1290
- content: s = "",
1291
- variant: d = "compact",
1292
- enterBehavior: u = "send",
1293
- maxLength: f,
1294
- charCountDisplay: o = "near-limit",
1295
- mentions: c,
1296
- onMentionSearch: m,
1297
- onMentionSelect: p,
1298
- onFileUpload: N,
1299
- onImageUpload: w,
1300
- slashCommands: B,
1301
- onVoiceRecord: R,
1302
- onTranscribe: P,
1303
- maxDuration: j,
1304
- replyTo: k,
1305
- onTyping: T,
1306
- onEmpty: S,
1307
- isStreaming: A = !1,
1308
- onCancel: U,
1309
- leadingSlot: M,
1310
- trailingSlot: y,
1311
- disclaimer: $,
1312
- toolbar: _ = !0,
1313
- sendOptions: te,
1314
- onSchedule: J,
1315
- actionButton: I,
1316
- emojiSet: F = "native",
1317
- className: Z,
1318
- ...V
1319
- }, xe) {
1320
- const [D, Y] = a.useState("idle"), [L, ae] = a.useState(!1), [O, ye] = a.useState(!1), [re, he] = a.useState(null), [at, we] = a.useState(!1), [ct, Le] = a.useState(!1), [_e, lt] = a.useState(0), ke = a.useRef(null), Ce = a.useRef(null);
1321
- a.useEffect(() => {
1322
- if (!O || !ke.current || !Ce.current) return;
1323
- const l = ke.current, v = Ce.current, C = () => {
1324
- Nt(l, v, {
1325
- placement: "top-end",
1326
- middleware: [St(8), Rt(), At({ padding: 8 })]
1327
- }).then(({ x, y: E }) => {
1328
- Object.assign(v.style, { left: `${x}px`, top: `${E}px` });
1329
- });
1330
- };
1331
- return C(), window.addEventListener("scroll", C, !0), window.addEventListener("resize", C), () => {
1332
- window.removeEventListener("scroll", C, !0), window.removeEventListener("resize", C);
1333
- };
1334
- }, [O]);
1335
- const [ce, ne] = a.useState([]), [ee, Ne] = a.useState(null), [dt, Se] = a.useState(!1), He = a.useRef(null), ut = a.useRef(null), Re = a.useRef(void 0), Ae = a.useRef(void 0), De = a.useRef(u);
1336
- De.current = u;
1337
- const je = br(), pe = Wr[d], ft = pe.maxHeight, se = Kr({
1338
- maxDuration: j,
1339
- onComplete: async (l, v, C) => {
1340
- if (R?.(l, v), P) {
1341
- const x = await P(l, v);
1342
- if (x != null) {
1343
- b?.chain().focus().insertContent(x).run(), Y("idle");
1344
- return;
1345
- }
1346
- }
1347
- Ne({ blob: l, duration: v, waveformData: C }), Y("review");
1348
- }
1349
- }), mt = a.useCallback(() => {
1350
- se.start(), Y("recording");
1351
- }, [se]), ht = a.useCallback(() => {
1352
- se.stop();
1353
- }, [se]), $e = a.useCallback(() => {
1354
- se.cancel(), Y("idle");
1355
- }, [se]), pt = a.useMemo(() => {
1356
- const l = [
1357
- Tt.configure({
1358
- heading: !1,
1359
- horizontalRule: !1,
1360
- codeBlock: !1,
1361
- blockquote: !1,
1362
- // v3: Underline + Link included in StarterKit
1363
- link: {
1364
- openOnClick: !1,
1365
- HTMLAttributes: { class: "text-accent-11 underline" }
1366
- }
1367
- }),
1368
- Mt.configure({ placeholder: t }),
1369
- It.configure({ multicolor: !1 }),
1370
- zt,
1371
- Pt.configure({ limit: f || void 0 }),
1372
- jt,
1373
- $t,
1374
- Ft(F),
1375
- // Enter-to-send
1376
- Xe.create({
1377
- name: "enterToSend",
1378
- addKeyboardShortcuts() {
1379
- return {
1380
- Enter: () => De.current === "send" ? (Ae.current?.(), !0) : !1,
1381
- "Shift-Enter": () => De.current === "send" ? (this.editor.commands.splitBlock(), !0) : !1,
1382
- "Mod-Enter": () => (Ae.current?.(), !0)
1383
- };
1384
- }
1385
- })
1386
- ];
1387
- return (c || m) && l.push(
1388
- Bt.configure({
1389
- HTMLAttributes: { class: "mention" },
1390
- suggestion: {
1391
- items: async ({ query: v }) => m ? await m(v) : c ? c.filter((C) => C.label.toLowerCase().includes(v.toLowerCase())).slice(0, 8) : [],
1392
- render: qt(p)
1393
- }
1394
- })
1395
- ), B && l.push(xr(B)), l;
1396
- }, [t, f, F, !!c, !!m, !!B]), b = Lt({
1397
- immediatelyRender: !1,
1398
- // SSR-safe — prevents hydration mismatch in Next.js
1399
- extensions: pt,
1400
- content: s || void 0,
1401
- editable: !i,
1402
- editorProps: {
1403
- attributes: {
1404
- class: Vr
1405
- },
1406
- handlePaste: (l, v) => {
1407
- const C = Array.from(v.clipboardData?.files ?? []);
1408
- return C.length > 0 ? (C.forEach(ue), !0) : !1;
1409
- }
1410
- }
1411
- }), Ee = a.useCallback(() => {
1412
- if (!b) return;
1413
- const l = !b.isEmpty, v = ce.length > 0, C = !!ee;
1414
- if (!l && !v && !C || A) return;
1415
- const x = {
1416
- html: l ? b.getHTML() : "",
1417
- plainText: l ? b.getText() : ""
1418
- };
1419
- v && (x.attachments = ce.filter((E) => !E.uploading && E.url).map((E) => ({ url: E.url, name: E.name, size: E.size, type: E.type }))), C && (x.voiceNote = { blob: ee.blob, duration: ee.duration }), re && J ? J(x, re) : n(x), b.commands.clearContent(), ne([]), Ne(null), he(null), Y("idle");
1420
- }, [b, ce, ee, A, n, J, re]);
1421
- Ae.current = Ee, a.useEffect(() => {
1422
- if (!b || !T) return;
1423
- const l = () => {
1424
- T(!0), clearTimeout(Re.current), Re.current = setTimeout(() => T(!1), 2e3);
1425
- };
1426
- return b.on("update", l), () => {
1427
- b.off("update", l), clearTimeout(Re.current);
1428
- };
1429
- }, [b, T]), a.useEffect(() => {
1430
- if (!b || !S) return;
1431
- const l = () => {
1432
- S(b.isEmpty);
1433
- };
1434
- return b.on("update", l), l(), () => {
1435
- b.off("update", l);
1436
- };
1437
- }, [b, S]);
1438
- const ue = a.useCallback(async (l) => {
1439
- const v = Math.random().toString(36).slice(2), C = l.type.startsWith("image/");
1440
- ne((x) => [...x, {
1441
- id: v,
1442
- name: l.name,
1443
- size: l.size,
1444
- type: C ? "image" : "file",
1445
- uploading: !0
1446
- }]);
1447
- try {
1448
- if (C && w) {
1449
- const x = await w(l);
1450
- ne((E) => E.map((X) => X.id === v ? { ...X, url: x, uploading: !1 } : X));
1451
- } else if (N) {
1452
- const x = await N(l);
1453
- ne((E) => E.map((X) => X.id === v ? { ...X, url: x.url, name: x.name, size: x.size, uploading: !1 } : X));
1454
- } else if (C) {
1455
- const x = URL.createObjectURL(l);
1456
- ne((E) => E.map((X) => X.id === v ? { ...X, url: x, uploading: !1 } : X));
1457
- } else
1458
- ne((x) => x.filter((E) => E.id !== v));
1459
- } catch {
1460
- ne((x) => x.filter((E) => E.id !== v));
1461
- }
1462
- }, [N, w]), gt = a.useCallback((l) => {
1463
- ne((v) => v.filter((C) => C.id !== l));
1464
- }, []), bt = a.useCallback((l) => {
1465
- l.preventDefault(), Se(!1), Array.from(l.dataTransfer.files).forEach(ue);
1466
- }, [ue]), vt = a.useCallback((l) => {
1467
- Array.from(l.target.files || []).forEach(ue), l.target.value = "";
1468
- }, [ue]), xt = a.useCallback(() => {
1469
- Ne(null), Y("idle");
1470
- }, []), Fe = W({
1471
- editor: b,
1472
- selector: ({ editor: l }) => l ? { editorIsEmpty: l.isEmpty } : null
1473
- })?.editorIsEmpty ?? !0;
1474
- a.useEffect(() => {
1475
- if (!b) return;
1476
- const l = () => {
1477
- const v = b.state.doc.textBetween(0, b.state.doc.content.size, void 0, " ");
1478
- lt(v.length);
1479
- };
1480
- return l(), b.on("update", l), () => {
1481
- b.off("update", l);
1482
- };
1483
- }, [b]);
1484
- const ge = !Fe || ce.length > 0 || !!ee, yt = L || D === "review" || d === "expanded", ie = "icon-md", oe = "md";
1485
- return /* @__PURE__ */ h(
1486
- "div",
1487
- {
1488
- ref: xe,
1489
- className: z(
1490
- "border-t border-surface-border-subtle px-ds-05 py-ds-04",
1491
- "flex items-center gap-ds-03",
1492
- Z
1493
- ),
1494
- ...V,
1495
- children: [
1496
- I !== !1 && (I ?? (N || w ? /* @__PURE__ */ e(
1497
- Q,
1498
- {
1499
- variant: "solid",
1500
- size: "icon-md",
1501
- onClick: () => He.current?.click(),
1502
- title: "Attach",
1503
- "aria-label": "Attach file",
1504
- className: "shrink-0",
1505
- children: /* @__PURE__ */ e(g, { icon: rr, size: "md" })
1506
- }
1507
- ) : null)),
1508
- /* @__PURE__ */ h(
1509
- "div",
1510
- {
1511
- role: "region",
1512
- "aria-label": "Message composer",
1513
- className: z(
1514
- "flex-1 min-w-0 overflow-hidden rounded-ds-lg border border-surface-border-strong bg-surface-raised-hover",
1515
- "transition-[color,background-color,border-color,box-shadow] duration-fast-02 ease-productive-standard",
1516
- "hover:bg-surface-raised-active",
1517
- "focus-within:ring-2 focus-within:ring-accent-9 focus-within:ring-offset-2 focus-within:border-accent-9",
1518
- D === "recording" && "border-error-7/30",
1519
- dt && "border-dashed border-accent-7 bg-accent-2",
1520
- i && "opacity-action-disabled cursor-not-allowed"
1521
- ),
1522
- onFocus: () => Le(!0),
1523
- onBlur: (l) => {
1524
- l.currentTarget.contains(l.relatedTarget) || Le(!1);
1525
- },
1526
- onDragOver: (l) => {
1527
- l.preventDefault(), Se(!0);
1528
- },
1529
- onDragLeave: () => Se(!1),
1530
- onDrop: bt,
1531
- children: [
1532
- M,
1533
- /* @__PURE__ */ e(fe, { children: k && /* @__PURE__ */ e(
1534
- yr,
1535
- {
1536
- author: k.author,
1537
- preview: k.preview,
1538
- onDismiss: k.onDismiss
1539
- },
1540
- "reply"
1541
- ) }),
1542
- /* @__PURE__ */ e(fe, { children: re && /* @__PURE__ */ e(
1543
- Ar,
1544
- {
1545
- date: re,
1546
- onEdit: () => we(!0),
1547
- onClear: () => he(null)
1548
- },
1549
- "schedule"
1550
- ) }),
1551
- /* @__PURE__ */ e(fe, { children: ce.length > 0 && /* @__PURE__ */ e(
1552
- Dr,
1553
- {
1554
- attachments: ce,
1555
- onRemoveAttachment: gt
1556
- },
1557
- "attachments"
1558
- ) }),
1559
- pe.toolbarPosition === "top" && b && /* @__PURE__ */ e(
1560
- "div",
1561
- {
1562
- className: z(
1563
- "grid transition-[grid-template-rows,opacity] duration-moderate-01 ease-productive-standard",
1564
- L ? "grid-rows-[1fr] opacity-100" : "grid-rows-[0fr] opacity-0 pointer-events-none"
1565
- ),
1566
- children: /* @__PURE__ */ e("div", { className: "overflow-hidden", children: /* @__PURE__ */ e(
1567
- Ve,
1568
- {
1569
- editor: b,
1570
- toolbar: _,
1571
- isMobile: !1,
1572
- hasMentions: !!(c || m),
1573
- hasSlashCommands: !!B,
1574
- disabled: i
1575
- }
1576
- ) })
1577
- }
1578
- ),
1579
- /* @__PURE__ */ h("div", { className: "relative", children: [
1580
- D === "recording" && /* @__PURE__ */ e(
1581
- st,
1582
- {
1583
- duration: se.duration,
1584
- analyserNode: se.analyserNode,
1585
- maxDuration: j,
1586
- onCancel: $e
1587
- }
1588
- ),
1589
- /* @__PURE__ */ h(
1590
- "div",
1591
- {
1592
- ref: ut,
1593
- className: z(
1594
- "flex items-center px-ds-04 py-ds-03 cursor-text [&_.tiptap]:w-full [&_.tiptap]:outline-hidden",
1595
- D === "recording" && "invisible"
1596
- ),
1597
- style: {
1598
- minHeight: pe.minHeight,
1599
- maxHeight: ft,
1600
- overflowY: "auto"
1601
- },
1602
- onClick: () => b?.commands.focus(),
1603
- children: [
1604
- /* @__PURE__ */ e("div", { className: "flex-1 min-w-0", children: /* @__PURE__ */ e(_t, { editor: b }) }),
1605
- b && D !== "recording" && /* @__PURE__ */ h("div", { className: "flex items-center gap-ds-01 shrink-0 ml-ds-03", children: [
1606
- /* @__PURE__ */ e(
1607
- "button",
1608
- {
1609
- type: "button",
1610
- onClick: () => ae((l) => !l),
1611
- title: L ? "Hide formatting" : "Show formatting",
1612
- "aria-label": L ? "Hide formatting" : "Show formatting",
1613
- "aria-pressed": L,
1614
- className: z(
1615
- "inline-flex h-ds-xs-plus w-ds-xs-plus items-center justify-center rounded-ds-md touch-target",
1616
- "transition-colors duration-fast-01 ease-productive-standard",
1617
- "hover:bg-surface-raised-hover",
1618
- L ? "bg-surface-raised-hover text-accent-11" : "text-surface-fg-subtle"
1619
- ),
1620
- children: /* @__PURE__ */ e(g, { icon: nr, size: "xs" })
1621
- }
1622
- ),
1623
- /* @__PURE__ */ h("div", { className: "relative", children: [
1624
- /* @__PURE__ */ e(
1625
- "button",
1626
- {
1627
- ref: ke,
1628
- type: "button",
1629
- onClick: () => ye((l) => !l),
1630
- title: "Emoji",
1631
- "aria-label": "Emoji",
1632
- className: z(
1633
- "inline-flex h-ds-xs-plus w-ds-xs-plus items-center justify-center rounded-ds-md touch-target transition-colors duration-fast-01",
1634
- O ? "bg-surface-raised-hover text-accent-11" : "text-surface-fg-subtle hover:bg-surface-raised-hover hover:text-surface-fg"
1635
- ),
1636
- children: /* @__PURE__ */ e(g, { icon: rt, size: "xs" })
1637
- }
1638
- ),
1639
- O && Ct.createPortal(
1640
- /* @__PURE__ */ e("div", { ref: Ce, className: "absolute z-popover", style: { top: 0, left: 0 }, children: /* @__PURE__ */ e(
1641
- Qr,
1642
- {
1643
- set: F,
1644
- onSelect: async ({ id: l, native: v }) => {
1645
- const C = await Ut(F), x = Ot(C, l);
1646
- x ? b.chain().focus().insertContent({
1647
- type: "emojiNode",
1648
- attrs: { id: l, native: x.native, set: F, x: x.x, y: x.y }
1649
- }).run() : b.chain().focus().insertContent(v).run(), ye(!1);
1650
- },
1651
- onClose: () => ye(!1)
1652
- }
1653
- ) }),
1654
- document.body
1655
- )
1656
- ] })
1657
- ] })
1658
- ]
1659
- }
1660
- )
1661
- ] }),
1662
- D === "review" && ee && /* @__PURE__ */ h("div", { className: "flex items-center gap-ds-03 px-ds-04 py-ds-02b border-b border-surface-border", children: [
1663
- /* @__PURE__ */ e(
1664
- ot,
1665
- {
1666
- src: ee.blob,
1667
- duration: ee.duration,
1668
- waveformData: ee.waveformData,
1669
- className: "flex-1"
1670
- }
1671
- ),
1672
- /* @__PURE__ */ e(
1673
- Q,
1674
- {
1675
- variant: "ghost",
1676
- size: "icon-sm",
1677
- onClick: xt,
1678
- "aria-label": "Discard voice note",
1679
- title: "Discard voice note",
1680
- className: "text-surface-fg-subtle hover:text-error-11",
1681
- children: /* @__PURE__ */ e(g, { icon: Ue, size: "sm" })
1682
- }
1683
- )
1684
- ] }),
1685
- je && b && !Fe && /* @__PURE__ */ e(Gr, { editor: b }),
1686
- pe.toolbarPosition === "bottom" && b && /* @__PURE__ */ e(
1687
- "div",
1688
- {
1689
- className: z(
1690
- "grid transition-[grid-template-rows,opacity] duration-moderate-01 ease-productive-standard",
1691
- yt ? "grid-rows-[1fr] opacity-100" : "grid-rows-[0fr] opacity-0 pointer-events-none"
1692
- ),
1693
- children: /* @__PURE__ */ e("div", { className: "overflow-hidden", children: /* @__PURE__ */ e(
1694
- Ve,
1695
- {
1696
- editor: b,
1697
- toolbar: _,
1698
- isMobile: je,
1699
- hasMentions: !!(c || m),
1700
- hasSlashCommands: !!B,
1701
- disabled: i
1702
- }
1703
- ) })
1704
- }
1705
- ),
1706
- f && o !== "hidden" && (() => {
1707
- const l = _e / f, v = o === "always", C = o === "focus" && ct, x = (o === "near-limit" || !o) && l >= 0.8;
1708
- return v || C || x || l >= 1 ? /* @__PURE__ */ h("div", { className: z(
1709
- "flex justify-end px-ds-04 pb-ds-02 text-ds-xs tabular-nums transition-opacity duration-fast-01",
1710
- l >= 1 ? "text-error-11 font-medium" : l >= 0.9 ? "text-warning-11" : "text-surface-fg-subtle"
1711
- ), children: [
1712
- _e,
1713
- "/",
1714
- f
1715
- ] }) : null;
1716
- })(),
1717
- y,
1718
- /* @__PURE__ */ e(
1719
- "input",
1720
- {
1721
- ref: He,
1722
- type: "file",
1723
- multiple: !0,
1724
- className: "hidden",
1725
- onChange: vt
1726
- }
1727
- )
1728
- ]
1729
- }
1730
- ),
1731
- /* @__PURE__ */ h("div", { className: "flex items-center gap-ds-02 shrink-0", children: [
1732
- te && te.length > 0 && D !== "recording" && /* @__PURE__ */ e(Yr, { options: te }),
1733
- /* @__PURE__ */ h(fe, { mode: "popLayout", initial: !1, children: [
1734
- D === "recording" && /* @__PURE__ */ h(
1735
- G.div,
1736
- {
1737
- initial: { scale: 0.8, opacity: 0 },
1738
- animate: { scale: 1, opacity: 1 },
1739
- exit: { scale: 0.8, opacity: 0 },
1740
- transition: { duration: 0.15 },
1741
- className: "flex items-center gap-ds-02",
1742
- children: [
1743
- /* @__PURE__ */ e(Q, { variant: "soft", size: ie, onClick: $e, "aria-label": "Cancel recording", title: "Cancel recording", className: "text-surface-fg-subtle hover:text-error-11", children: /* @__PURE__ */ e(g, { icon: Ue, size: oe }) }),
1744
- /* @__PURE__ */ e(Q, { variant: "solid", size: ie, color: "error", onClick: ht, "aria-label": "Stop recording", title: "Stop recording", children: /* @__PURE__ */ e(g, { icon: Oe, size: oe }) })
1745
- ]
1746
- },
1747
- "recording"
1748
- ),
1749
- A && D !== "recording" && /* @__PURE__ */ e(
1750
- G.div,
1751
- {
1752
- initial: { scale: 0.8, opacity: 0 },
1753
- animate: { scale: 1, opacity: 1 },
1754
- exit: { scale: 0.8, opacity: 0 },
1755
- transition: { duration: 0.15 },
1756
- children: /* @__PURE__ */ e(Q, { variant: "solid", size: ie, color: "error", onClick: U, "aria-label": "Stop", title: "Stop", children: /* @__PURE__ */ e(g, { icon: Oe, size: oe }) })
1757
- },
1758
- "streaming"
1759
- ),
1760
- !A && D !== "recording" && ge && J && /* @__PURE__ */ e(
1761
- G.div,
1762
- {
1763
- initial: { scale: 0.8, opacity: 0 },
1764
- animate: { scale: 1, opacity: 1 },
1765
- exit: { scale: 0.8, opacity: 0 },
1766
- transition: { duration: 0.15 },
1767
- children: /* @__PURE__ */ e(
1768
- hr,
1769
- {
1770
- onClick: Ee,
1771
- disabled: i,
1772
- "aria-label": re ? "Schedule send" : "Send",
1773
- size: ie,
1774
- dropdownContent: /* @__PURE__ */ e(
1775
- Nr,
1776
- {
1777
- onSchedule: (l) => he(l),
1778
- onClose: () => {
1779
- },
1780
- onOpenDialog: () => we(!0)
1781
- }
1782
- ),
1783
- children: /* @__PURE__ */ e(g, { icon: re ? Pe : ze, size: oe })
1784
- }
1785
- )
1786
- },
1787
- "split-send"
1788
- ),
1789
- !A && D !== "recording" && ge && !J && /* @__PURE__ */ e(
1790
- G.div,
1791
- {
1792
- initial: { scale: 0.8, opacity: 0 },
1793
- animate: { scale: 1, opacity: 1 },
1794
- exit: { scale: 0.8, opacity: 0 },
1795
- transition: { duration: 0.15 },
1796
- children: /* @__PURE__ */ e(Q, { variant: "solid", size: ie, onClick: Ee, disabled: i, "aria-label": "Send", title: "Send", children: /* @__PURE__ */ e(g, { icon: ze, size: oe }) })
1797
- },
1798
- "send"
1799
- ),
1800
- !A && D !== "recording" && !ge && R && /* @__PURE__ */ e(
1801
- G.div,
1802
- {
1803
- initial: { scale: 0.8, opacity: 0 },
1804
- animate: { scale: 1, opacity: 1 },
1805
- exit: { scale: 0.8, opacity: 0 },
1806
- transition: { duration: 0.15 },
1807
- children: /* @__PURE__ */ e(Q, { variant: "soft", size: ie, onClick: mt, "aria-label": "Record voice message", title: "Record voice message", children: /* @__PURE__ */ e(g, { icon: sr, size: oe }) })
1808
- },
1809
- "mic"
1810
- ),
1811
- !A && D !== "recording" && !ge && !R && /* @__PURE__ */ e(
1812
- G.div,
1813
- {
1814
- initial: { scale: 0.8, opacity: 0 },
1815
- animate: { scale: 1, opacity: 1 },
1816
- exit: { scale: 0.8, opacity: 0 },
1817
- transition: { duration: 0.15 },
1818
- children: /* @__PURE__ */ e(Q, { variant: "solid", size: ie, disabled: !0, "aria-label": "Send", title: "Send", children: /* @__PURE__ */ e(g, { icon: ze, size: oe }) })
1819
- },
1820
- "send-disabled"
1821
- )
1822
- ] })
1823
- ] }),
1824
- $ && /* @__PURE__ */ e("p", { className: "mt-ds-02 text-center text-ds-xs text-surface-fg-subtle/50", children: $ }),
1825
- J && /* @__PURE__ */ e(
1826
- Sr,
1827
- {
1828
- open: at,
1829
- onOpenChange: we,
1830
- onSchedule: (l) => he(l),
1831
- initialDate: re
1832
- }
1833
- )
1834
- ]
1835
- }
1836
- );
1837
- }
1838
- );
1839
- Jr.displayName = "RichChatInput";
1840
- export {
1841
- ot as AudioPlayer,
1842
- Be as AudioWaveform,
1843
- Hr as BlockquoteButton,
1844
- zr as BoldButton,
1845
- Lr as BulletListButton,
1846
- Br as CodeButton,
1847
- Fr as EmojiButton,
1848
- Pr as HighlightButton,
1849
- Tr as ItalicButton,
1850
- jr as LinkButton,
1851
- $r as MentionButton,
1852
- _r as OrderedListButton,
1853
- Jr as RichChatInput,
1854
- qr as SlashCommandButton,
1855
- Ir as StrikeButton,
1856
- q as ToolbarButton,
1857
- Te as ToolbarDivider,
1858
- ve as ToolbarGroup,
1859
- Mr as UnderlineButton,
1860
- Kr as useVoiceRecorder
1861
- };
2
+ import { _ as e, a as t, b as n, c as r, d as i, f as a, g as o, h as s, i as c, l, m as u, n as d, o as f, p, r as m, s as h, t as g, u as _, v, y } from "../_chunks/rich-chat-input.js";
3
+ export { m as AudioPlayer, n as AudioWaveform, c as BlockquoteButton, t as BoldButton, f as BulletListButton, h as CodeButton, r as EmojiButton, l as HighlightButton, _ as ItalicButton, i as LinkButton, a as MentionButton, p as OrderedListButton, g as RichChatInput, u as SlashCommandButton, s as StrikeButton, o as ToolbarButton, e as ToolbarDivider, v as ToolbarGroup, y as UnderlineButton, d as useVoiceRecorder };