@devalok/shilp-sutra 0.31.0 → 0.33.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 (278) hide show
  1. package/LICENSE +21 -0
  2. package/dist/_chunks/badge-group.js +123 -172
  3. package/dist/_chunks/date-time-picker.js +851 -0
  4. package/dist/_chunks/document-preview.js +92 -0
  5. package/dist/_chunks/file-preview.js +511 -0
  6. package/dist/_chunks/image-preview.js +90 -0
  7. package/dist/_chunks/mention-suggestion.js +362 -0
  8. package/dist/_chunks/primitives.js +109 -109
  9. package/dist/_chunks/stat-row.js +144 -124
  10. package/dist/_chunks/tiptap.js +11595 -7731
  11. package/dist/_chunks/use-calendar.js +117 -890
  12. package/dist/_chunks/vendor-client.js +1055 -894
  13. package/dist/ai/block-renderer.d.ts +2 -1
  14. package/dist/ai/block-renderer.d.ts.map +1 -1
  15. package/dist/ai/block-renderer.js +30 -29
  16. package/dist/ai/blocks/block-table.d.ts.map +1 -1
  17. package/dist/ai/blocks/confirm.d.ts.map +1 -1
  18. package/dist/ai/blocks/divider.d.ts.map +1 -1
  19. package/dist/ai/blocks/error.d.ts.map +1 -1
  20. package/dist/ai/blocks/info.d.ts.map +1 -1
  21. package/dist/ai/blocks/loading.d.ts.map +1 -1
  22. package/dist/ai/blocks/stat-row.d.ts.map +1 -1
  23. package/dist/ai/blocks/success.d.ts.map +1 -1
  24. package/dist/ai/blocks/text.d.ts.map +1 -1
  25. package/dist/ai/command-bar.d.ts +18 -0
  26. package/dist/ai/command-bar.d.ts.map +1 -1
  27. package/dist/ai/command-bar.js +126 -125
  28. package/dist/ai/conversation.d.ts +13 -1
  29. package/dist/ai/conversation.d.ts.map +1 -1
  30. package/dist/ai/conversation.js +78 -78
  31. package/dist/ai/types.d.ts +0 -1
  32. package/dist/ai/types.d.ts.map +1 -1
  33. package/dist/ai/types.js +0 -1
  34. package/dist/composed/bulk-action-bar.d.ts +6 -4
  35. package/dist/composed/bulk-action-bar.d.ts.map +1 -1
  36. package/dist/composed/bulk-action-bar.js +102 -58
  37. package/dist/composed/command-palette.d.ts +9 -0
  38. package/dist/composed/command-palette.d.ts.map +1 -1
  39. package/dist/composed/command-palette.js +68 -68
  40. package/dist/composed/confirm-dialog.d.ts +1 -1
  41. package/dist/composed/confirm-dialog.d.ts.map +1 -1
  42. package/dist/composed/confirm-dialog.js +10 -10
  43. package/dist/composed/date-picker/date-picker.d.ts +11 -1
  44. package/dist/composed/date-picker/date-picker.d.ts.map +1 -1
  45. package/dist/composed/date-picker/index.js +9 -8
  46. package/dist/composed/date-picker/month-picker.d.ts.map +1 -1
  47. package/dist/composed/date-picker/year-picker.d.ts.map +1 -1
  48. package/dist/composed/deadline-indicator.d.ts +1 -1
  49. package/dist/composed/deadline-indicator.d.ts.map +1 -1
  50. package/dist/composed/deadline-indicator.js +39 -36
  51. package/dist/composed/emoji-picker.d.ts +14 -2
  52. package/dist/composed/emoji-picker.d.ts.map +1 -1
  53. package/dist/composed/emoji-picker.js +66 -55
  54. package/dist/composed/error-boundary.d.ts +21 -1
  55. package/dist/composed/error-boundary.d.ts.map +1 -1
  56. package/dist/composed/error-boundary.js +47 -32
  57. package/dist/composed/extensions/emoji-data.d.ts +35 -0
  58. package/dist/composed/extensions/emoji-data.d.ts.map +1 -0
  59. package/dist/composed/extensions/emoji-node.d.ts +11 -0
  60. package/dist/composed/extensions/emoji-node.d.ts.map +1 -0
  61. package/dist/composed/extensions/emoji-suggestion.d.ts +4 -6
  62. package/dist/composed/extensions/emoji-suggestion.d.ts.map +1 -1
  63. package/dist/composed/extensions/slash-command.d.ts +35 -0
  64. package/dist/composed/extensions/slash-command.d.ts.map +1 -0
  65. package/dist/composed/file-preview/audio-preview.d.ts +7 -0
  66. package/dist/composed/file-preview/audio-preview.d.ts.map +1 -0
  67. package/dist/composed/file-preview/document-preview.d.ts +7 -0
  68. package/dist/composed/file-preview/document-preview.d.ts.map +1 -0
  69. package/dist/composed/file-preview/embed-preview.d.ts +7 -0
  70. package/dist/composed/file-preview/embed-preview.d.ts.map +1 -0
  71. package/dist/composed/file-preview/image-preview.d.ts +7 -0
  72. package/dist/composed/file-preview/image-preview.d.ts.map +1 -0
  73. package/dist/composed/file-preview/shared.d.ts +20 -0
  74. package/dist/composed/file-preview/shared.d.ts.map +1 -0
  75. package/dist/composed/file-preview/video-preview.d.ts +6 -0
  76. package/dist/composed/file-preview/video-preview.d.ts.map +1 -0
  77. package/dist/composed/file-preview.d.ts.map +1 -1
  78. package/dist/composed/file-preview.js +10 -662
  79. package/dist/composed/filter-bar.d.ts +10 -2
  80. package/dist/composed/filter-bar.d.ts.map +1 -1
  81. package/dist/composed/filter-bar.js +42 -43
  82. package/dist/composed/form-section.d.ts +1 -1
  83. package/dist/composed/form-section.d.ts.map +1 -1
  84. package/dist/composed/form-section.js +22 -21
  85. package/dist/composed/index.d.ts +9 -3
  86. package/dist/composed/index.d.ts.map +1 -1
  87. package/dist/composed/index.js +79 -69
  88. package/dist/composed/inline-edit.d.ts +1 -1
  89. package/dist/composed/inline-edit.d.ts.map +1 -1
  90. package/dist/composed/inline-edit.js +33 -32
  91. package/dist/composed/markdown-viewer.d.ts +1 -1
  92. package/dist/composed/markdown-viewer.d.ts.map +1 -1
  93. package/dist/composed/markdown-viewer.js +60 -59
  94. package/dist/composed/master-detail.d.ts +11 -7
  95. package/dist/composed/master-detail.d.ts.map +1 -1
  96. package/dist/composed/master-detail.js +123 -84
  97. package/dist/composed/responsive-overlay.d.ts +8 -0
  98. package/dist/composed/responsive-overlay.d.ts.map +1 -1
  99. package/dist/composed/rich-chat-input/attachment-strip.d.ts +15 -0
  100. package/dist/composed/rich-chat-input/attachment-strip.d.ts.map +1 -0
  101. package/dist/composed/rich-chat-input/audio-player.d.ts +11 -0
  102. package/dist/composed/rich-chat-input/audio-player.d.ts.map +1 -0
  103. package/dist/composed/rich-chat-input/audio-waveform.d.ts +24 -0
  104. package/dist/composed/rich-chat-input/audio-waveform.d.ts.map +1 -0
  105. package/dist/composed/rich-chat-input/chat-toolbar.d.ts +51 -0
  106. package/dist/composed/rich-chat-input/chat-toolbar.d.ts.map +1 -0
  107. package/dist/composed/rich-chat-input/recording-overlay.d.ts +15 -0
  108. package/dist/composed/rich-chat-input/recording-overlay.d.ts.map +1 -0
  109. package/dist/composed/rich-chat-input/reply-banner.d.ts +8 -0
  110. package/dist/composed/rich-chat-input/reply-banner.d.ts.map +1 -0
  111. package/dist/composed/rich-chat-input/schedule-send.d.ts +22 -0
  112. package/dist/composed/rich-chat-input/schedule-send.d.ts.map +1 -0
  113. package/dist/composed/rich-chat-input/use-voice-recorder.d.ts +18 -0
  114. package/dist/composed/rich-chat-input/use-voice-recorder.d.ts.map +1 -0
  115. package/dist/composed/rich-chat-input.d.ts +91 -0
  116. package/dist/composed/rich-chat-input.d.ts.map +1 -0
  117. package/dist/composed/rich-chat-input.js +1861 -0
  118. package/dist/composed/rich-text-editor.d.ts +14 -3
  119. package/dist/composed/rich-text-editor.d.ts.map +1 -1
  120. package/dist/composed/rich-text-editor.js +278 -447
  121. package/dist/composed/schedule-view.d.ts +9 -1
  122. package/dist/composed/schedule-view.d.ts.map +1 -1
  123. package/dist/hooks/index.d.ts +2 -0
  124. package/dist/hooks/index.d.ts.map +1 -1
  125. package/dist/hooks/index.js +8 -4
  126. package/dist/hooks/use-touch-device.d.ts +12 -0
  127. package/dist/hooks/use-touch-device.d.ts.map +1 -0
  128. package/dist/hooks/use-touch-device.js +13 -0
  129. package/dist/hooks/use-viewport-height.d.ts +11 -0
  130. package/dist/hooks/use-viewport-height.d.ts.map +1 -0
  131. package/dist/hooks/use-viewport-height.js +16 -0
  132. package/dist/shell/bottom-navbar.d.ts.map +1 -1
  133. package/dist/shell/bottom-navbar.js +72 -63
  134. package/dist/shell/command-registry.d.ts.map +1 -1
  135. package/dist/shell/notification-center.d.ts.map +1 -1
  136. package/dist/shell/notification-center.js +77 -77
  137. package/dist/shell/top-bar.d.ts +2 -2
  138. package/dist/shell/top-bar.d.ts.map +1 -1
  139. package/dist/shell/top-bar.js +61 -60
  140. package/dist/tailwind/index.cjs +51 -7
  141. package/dist/tailwind/preset.d.ts.map +1 -1
  142. package/dist/tailwind/preset.js +51 -7
  143. package/dist/tokens/primitives.css +3 -1
  144. package/dist/tokens/semantic.css +16 -13
  145. package/dist/ui/autocomplete.d.ts.map +1 -1
  146. package/dist/ui/autocomplete.js +38 -39
  147. package/dist/ui/badge.d.ts +104 -2
  148. package/dist/ui/badge.d.ts.map +1 -1
  149. package/dist/ui/banner.d.ts.map +1 -1
  150. package/dist/ui/banner.js +8 -7
  151. package/dist/ui/button-group.d.ts +27 -37
  152. package/dist/ui/button-group.d.ts.map +1 -1
  153. package/dist/ui/button-group.js +95 -29
  154. package/dist/ui/button.d.ts +2 -2
  155. package/dist/ui/button.d.ts.map +1 -1
  156. package/dist/ui/button.js +118 -134
  157. package/dist/ui/card.js +24 -24
  158. package/dist/ui/charts/area-chart.d.ts +2 -0
  159. package/dist/ui/charts/area-chart.d.ts.map +1 -1
  160. package/dist/ui/charts/bar-chart.d.ts +2 -0
  161. package/dist/ui/charts/bar-chart.d.ts.map +1 -1
  162. package/dist/ui/charts/chart-container.d.ts +2 -0
  163. package/dist/ui/charts/chart-container.d.ts.map +1 -1
  164. package/dist/ui/charts/index.js +583 -577
  165. package/dist/ui/charts/line-chart.d.ts +2 -0
  166. package/dist/ui/charts/line-chart.d.ts.map +1 -1
  167. package/dist/ui/charts/pie-chart.d.ts +2 -0
  168. package/dist/ui/charts/pie-chart.d.ts.map +1 -1
  169. package/dist/ui/charts/radar-chart.d.ts +2 -0
  170. package/dist/ui/charts/radar-chart.d.ts.map +1 -1
  171. package/dist/ui/checkbox.d.ts +2 -0
  172. package/dist/ui/checkbox.d.ts.map +1 -1
  173. package/dist/ui/checkbox.js +36 -27
  174. package/dist/ui/color-input.js +5 -5
  175. package/dist/ui/combobox.d.ts +6 -1
  176. package/dist/ui/combobox.d.ts.map +1 -1
  177. package/dist/ui/combobox.js +1 -1
  178. package/dist/ui/context-menu.js +1 -1
  179. package/dist/ui/data-table-body.d.ts +12 -0
  180. package/dist/ui/data-table-body.d.ts.map +1 -0
  181. package/dist/ui/data-table-body.js +219 -0
  182. package/dist/ui/data-table-bulk-actions.d.ts +19 -0
  183. package/dist/ui/data-table-bulk-actions.d.ts.map +1 -0
  184. package/dist/ui/data-table-bulk-actions.js +61 -0
  185. package/dist/ui/data-table-card.d.ts +9 -0
  186. package/dist/ui/data-table-card.d.ts.map +1 -0
  187. package/dist/ui/data-table-card.js +73 -0
  188. package/dist/ui/data-table-context.d.ts +62 -0
  189. package/dist/ui/data-table-context.d.ts.map +1 -0
  190. package/dist/ui/data-table-context.js +48 -0
  191. package/dist/ui/data-table-header.d.ts +10 -0
  192. package/dist/ui/data-table-header.d.ts.map +1 -0
  193. package/dist/ui/data-table-header.js +141 -0
  194. package/dist/ui/data-table-pagination.d.ts +13 -0
  195. package/dist/ui/data-table-pagination.d.ts.map +1 -0
  196. package/dist/ui/data-table-pagination.js +84 -0
  197. package/dist/ui/data-table.d.ts +11 -9
  198. package/dist/ui/data-table.d.ts.map +1 -1
  199. package/dist/ui/data-table.js +258 -573
  200. package/dist/ui/dialog.d.ts +6 -2
  201. package/dist/ui/dialog.d.ts.map +1 -1
  202. package/dist/ui/dialog.js +84 -82
  203. package/dist/ui/dropdown-menu.js +1 -1
  204. package/dist/ui/hover-card.d.ts +7 -0
  205. package/dist/ui/hover-card.d.ts.map +1 -1
  206. package/dist/ui/hover-card.js +3 -3
  207. package/dist/ui/icon-group.d.ts +2 -4
  208. package/dist/ui/icon-group.d.ts.map +1 -1
  209. package/dist/ui/icon-group.js +22 -23
  210. package/dist/ui/index.d.ts +2 -2
  211. package/dist/ui/index.d.ts.map +1 -1
  212. package/dist/ui/index.js +324 -327
  213. package/dist/ui/label.js +1 -1
  214. package/dist/ui/lib/bottom-sheet.d.ts +16 -0
  215. package/dist/ui/lib/bottom-sheet.d.ts.map +1 -0
  216. package/dist/ui/menubar.d.ts.map +1 -1
  217. package/dist/ui/menubar.js +64 -73
  218. package/dist/ui/navigation-menu.d.ts.map +1 -1
  219. package/dist/ui/navigation-menu.js +40 -44
  220. package/dist/ui/number-input.d.ts.map +1 -1
  221. package/dist/ui/number-input.js +19 -17
  222. package/dist/ui/popover.d.ts.map +1 -1
  223. package/dist/ui/popover.js +107 -32
  224. package/dist/ui/progress-ring.d.ts.map +1 -1
  225. package/dist/ui/progress-ring.js +80 -80
  226. package/dist/ui/progress.js +4 -4
  227. package/dist/ui/radio.d.ts +5 -2
  228. package/dist/ui/radio.d.ts.map +1 -1
  229. package/dist/ui/radio.js +29 -20
  230. package/dist/ui/search-input.d.ts.map +1 -1
  231. package/dist/ui/search-input.js +13 -12
  232. package/dist/ui/segmented-control.d.ts +6 -108
  233. package/dist/ui/segmented-control.d.ts.map +1 -1
  234. package/dist/ui/segmented-control.js +86 -272
  235. package/dist/ui/select.js +5 -5
  236. package/dist/ui/separator.js +5 -5
  237. package/dist/ui/sheet.d.ts +2 -0
  238. package/dist/ui/sheet.d.ts.map +1 -1
  239. package/dist/ui/sheet.js +102 -84
  240. package/dist/ui/sidebar.d.ts.map +1 -1
  241. package/dist/ui/sidebar.js +200 -175
  242. package/dist/ui/slider.js +14 -14
  243. package/dist/ui/split-button.d.ts +45 -0
  244. package/dist/ui/split-button.d.ts.map +1 -0
  245. package/dist/ui/split-button.js +282 -0
  246. package/dist/ui/status-dot.js +8 -8
  247. package/dist/ui/stepper.d.ts.map +1 -1
  248. package/dist/ui/stepper.js +33 -31
  249. package/dist/ui/switch.js +3 -3
  250. package/dist/ui/tabs.js +6 -6
  251. package/dist/ui/toast-types.d.ts +0 -1
  252. package/dist/ui/toast-types.d.ts.map +1 -1
  253. package/dist/ui/toast-types.js +0 -1
  254. package/dist/ui/toast.d.ts.map +1 -1
  255. package/dist/ui/toast.js +156 -150
  256. package/dist/ui/toggle-group.js +1 -1
  257. package/dist/ui/toggle.js +1 -1
  258. package/dist/ui/tooltip.js +3 -3
  259. package/docs/components/composed/emoji-picker.md +9 -0
  260. package/docs/components/composed/rich-chat-input.md +88 -0
  261. package/docs/components/composed/rich-text-editor.md +5 -0
  262. package/docs/components/ui/button-group.md +9 -0
  263. package/docs/components/ui/button.md +4 -0
  264. package/docs/components/ui/data-table-body.md +13 -0
  265. package/docs/components/ui/data-table-bulk-actions.md +13 -0
  266. package/docs/components/ui/data-table-card.md +13 -0
  267. package/docs/components/ui/data-table-context.md +13 -0
  268. package/docs/components/ui/data-table-header.md +13 -0
  269. package/docs/components/ui/data-table-pagination.md +13 -0
  270. package/docs/components/ui/split-button.md +41 -0
  271. package/llms-full.txt +235 -48
  272. package/llms.txt +54 -2
  273. package/package.json +30 -31
  274. package/dist/ui/chip.d.ts +0 -19
  275. package/dist/ui/chip.d.ts.map +0 -1
  276. package/dist/ui/chip.js +0 -14
  277. package/dist/ui/lib/use-ripple.d.ts +0 -14
  278. package/dist/ui/lib/use-ripple.d.ts.map +0 -1
@@ -0,0 +1,92 @@
1
+ "use client";
2
+ import { jsx as e, jsxs as c } from "react/jsx-runtime";
3
+ import * as n from "react";
4
+ import { tweens as D } from "../ui/lib/motion.js";
5
+ import { Skeleton as L } from "../ui/skeleton.js";
6
+ import { Button as v } from "../ui/button.js";
7
+ import { Icon as x } from "../ui/icon.js";
8
+ import { IconChevronLeft as N, IconChevronRight as I } from "@tabler/icons-react";
9
+ import { pdfjs as b, Document as A, Page as F } from "react-pdf";
10
+ import { E as k, T as C } from "./file-preview.js";
11
+ import { A as M, m as j } from "./framer.js";
12
+ function $({ url: l, initialPage: u, onError: w }) {
13
+ n.useEffect(() => {
14
+ b.GlobalWorkerOptions.workerSrc = `//unpkg.com/pdfjs-dist@${b.version}/build/pdf.worker.min.mjs`;
15
+ }, []);
16
+ const [a, y] = n.useState(0), [o, s] = n.useState(u), [m, i] = n.useState(String(u)), [P, S] = n.useState(!1), f = n.useRef(null), [p, g] = n.useState(!1);
17
+ n.useEffect(() => {
18
+ i(String(o));
19
+ }, [o]), n.useEffect(() => {
20
+ function t(r) {
21
+ const h = f.current;
22
+ !h || !h.contains(document.activeElement) && !p || (r.key === "ArrowRight" || r.key === "ArrowDown" ? (r.preventDefault(), s((d) => Math.min(a, d + 1))) : (r.key === "ArrowLeft" || r.key === "ArrowUp") && (r.preventDefault(), s((d) => Math.max(1, d - 1))));
23
+ }
24
+ return document.addEventListener("keydown", t), () => document.removeEventListener("keydown", t);
25
+ }, [a, p]);
26
+ function E(t) {
27
+ if (t.key === "Enter") {
28
+ const r = parseInt(m, 10);
29
+ r >= 1 && r <= a ? s(r) : i(String(o));
30
+ }
31
+ }
32
+ return P ? /* @__PURE__ */ e(k, { message: "Could not load PDF", url: l }) : /* @__PURE__ */ c(
33
+ "div",
34
+ {
35
+ ref: f,
36
+ className: "flex flex-col items-center gap-ds-03",
37
+ onMouseEnter: () => g(!0),
38
+ onMouseLeave: () => g(!1),
39
+ tabIndex: -1,
40
+ children: [
41
+ /* @__PURE__ */ e("div", { className: "overflow-auto max-h-[70vh] rounded-ds-md bg-surface-sunken border border-surface-border", children: /* @__PURE__ */ e(
42
+ A,
43
+ {
44
+ file: l,
45
+ onLoadSuccess: ({ numPages: t }) => y(t),
46
+ onLoadError: () => {
47
+ S(!0), w?.("PDF failed to load");
48
+ },
49
+ loading: /* @__PURE__ */ e(L, { className: "h-[500px] w-[400px]" }),
50
+ error: /* @__PURE__ */ e(k, { message: "Failed to load PDF", url: l }),
51
+ children: /* @__PURE__ */ e(M, { mode: "wait", children: /* @__PURE__ */ e(
52
+ j.div,
53
+ {
54
+ initial: { opacity: 0 },
55
+ animate: { opacity: 1 },
56
+ exit: { opacity: 0 },
57
+ transition: D.fade,
58
+ children: /* @__PURE__ */ e(F, { pageNumber: o, renderTextLayer: !1, renderAnnotationLayer: !1 })
59
+ },
60
+ o
61
+ ) })
62
+ }
63
+ ) }),
64
+ a > 0 && /* @__PURE__ */ c(C, { children: [
65
+ /* @__PURE__ */ e(v, { variant: "ghost", size: "icon-xs", onClick: () => s((t) => Math.max(1, t - 1)), disabled: o <= 1, "aria-label": "Previous page (←)", title: "Previous page", children: /* @__PURE__ */ e(x, { icon: N, size: "sm" }) }),
66
+ /* @__PURE__ */ c("div", { className: "flex items-center gap-ds-01 text-ds-xs text-surface-fg-muted", children: [
67
+ /* @__PURE__ */ e(
68
+ "input",
69
+ {
70
+ type: "text",
71
+ value: m,
72
+ onChange: (t) => i(t.target.value),
73
+ onKeyDown: E,
74
+ onBlur: () => i(String(o)),
75
+ className: "w-8 bg-transparent text-center font-mono text-surface-fg outline-none focus:bg-surface-raised-hover rounded-ds-sm",
76
+ "aria-label": "Page number"
77
+ }
78
+ ),
79
+ /* @__PURE__ */ c("span", { children: [
80
+ "/ ",
81
+ a
82
+ ] })
83
+ ] }),
84
+ /* @__PURE__ */ e(v, { variant: "ghost", size: "icon-xs", onClick: () => s((t) => Math.min(a, t + 1)), disabled: o >= a, "aria-label": "Next page (→)", title: "Next page", children: /* @__PURE__ */ e(x, { icon: I, size: "sm" }) })
85
+ ] })
86
+ ]
87
+ }
88
+ );
89
+ }
90
+ export {
91
+ $ as default
92
+ };
@@ -0,0 +1,511 @@
1
+ "use client";
2
+ import { jsxs as u, jsx as e } from "react/jsx-runtime";
3
+ import * as a from "react";
4
+ import { cn as D } from "../ui/lib/utils.js";
5
+ import { Skeleton as X } from "../ui/skeleton.js";
6
+ import { Button as V } from "../ui/button.js";
7
+ import { Icon as x } from "../ui/icon.js";
8
+ import { B as q } from "./badge-group.js";
9
+ import { IconAlertTriangle as H, IconDownload as _, IconVolumeOff as O, IconVolume as Y, IconPlayerPlay as F, IconPlayerPause as K, IconMaximize as G } from "@tabler/icons-react";
10
+ import { tweens as j, springs as J } from "../ui/lib/motion.js";
11
+ import { m as $, A as Q } from "./framer.js";
12
+ function U({ message: t, url: o }) {
13
+ return /* @__PURE__ */ u("div", { className: "flex flex-col items-center justify-center gap-ds-04 rounded-ds-md border border-surface-border bg-surface-sunken p-ds-08 text-center", children: [
14
+ /* @__PURE__ */ e(x, { icon: H, size: "2xl", className: "text-warning-9" }),
15
+ /* @__PURE__ */ u("div", { children: [
16
+ /* @__PURE__ */ e("p", { className: "text-ds-md font-semibold text-surface-fg", children: "Preview unavailable" }),
17
+ /* @__PURE__ */ e("p", { className: "text-ds-sm text-surface-fg-muted mt-ds-01", children: t })
18
+ ] }),
19
+ /* @__PURE__ */ e(V, { variant: "outline", size: "xs", startIcon: /* @__PURE__ */ e(x, { icon: _ }), asChild: !0, children: /* @__PURE__ */ e("a", { href: o, download: !0, target: "_blank", rel: "noopener noreferrer", children: "Download file" }) })
20
+ ] });
21
+ }
22
+ function pe({ children: t, className: o }) {
23
+ return /* @__PURE__ */ e(
24
+ $.div,
25
+ {
26
+ initial: { opacity: 0, y: 8 },
27
+ animate: { opacity: 1, y: 0 },
28
+ transition: j.fade,
29
+ className: D(
30
+ "flex items-center gap-ds-01 rounded-ds-md border border-surface-border bg-surface-overlay/95 px-ds-02 py-ds-01 shadow-floating backdrop-blur-sm",
31
+ o
32
+ ),
33
+ children: t
34
+ }
35
+ );
36
+ }
37
+ function ge() {
38
+ return /* @__PURE__ */ e("div", { className: "mx-ds-01 h-4 w-px bg-surface-border-subtle" });
39
+ }
40
+ function W({
41
+ volume: t,
42
+ muted: o,
43
+ onVolumeChange: r,
44
+ onMuteToggle: n,
45
+ variant: d = "light"
46
+ }) {
47
+ const l = a.useRef(null), [f, m] = a.useState(!1), v = o ? 0 : t;
48
+ function g(p) {
49
+ if (!l.current) return t;
50
+ const M = l.current.getBoundingClientRect();
51
+ return Math.max(0, Math.min(1, (p.clientX - M.left) / M.width));
52
+ }
53
+ function b(p) {
54
+ p.preventDefault(), m(!0);
55
+ const M = g(p);
56
+ r(M), p.target.setPointerCapture(p.pointerId);
57
+ }
58
+ function N(p) {
59
+ f && r(g(p));
60
+ }
61
+ function y() {
62
+ m(!1);
63
+ }
64
+ const k = d === "dark", R = k ? "bg-white/30" : "bg-surface-sunken", T = k ? "bg-white" : "bg-accent-9", P = k ? "bg-white" : "bg-accent-9";
65
+ return /* @__PURE__ */ u("div", { className: "group/vol flex items-center gap-ds-02 shrink-0", children: [
66
+ /* @__PURE__ */ e("button", { onClick: n, className: D("transition-colors", k ? "text-white hover:text-white/80" : "text-surface-fg-muted hover:text-surface-fg"), "aria-label": o ? "Unmute (M)" : "Mute (M)", title: o ? "Unmute" : "Mute", children: o || t === 0 ? /* @__PURE__ */ e(x, { icon: O, size: "sm" }) : /* @__PURE__ */ e(x, { icon: Y, size: "sm" }) }),
67
+ /* @__PURE__ */ e("div", { className: "w-0 overflow-hidden group-hover/vol:w-20 transition-[width] duration-200 ease-productive-standard flex items-center", children: /* @__PURE__ */ u(
68
+ "div",
69
+ {
70
+ ref: l,
71
+ className: D("relative w-full h-1 rounded-full cursor-pointer", R),
72
+ onPointerDown: b,
73
+ onPointerMove: N,
74
+ onPointerUp: y,
75
+ role: "slider",
76
+ "aria-label": "Volume",
77
+ "aria-valuenow": Math.round(v * 100),
78
+ "aria-valuemin": 0,
79
+ "aria-valuemax": 100,
80
+ tabIndex: 0,
81
+ children: [
82
+ /* @__PURE__ */ e(
83
+ "div",
84
+ {
85
+ className: D("absolute left-0 top-0 h-full rounded-full transition-[width] duration-75", T),
86
+ style: { width: `${v * 100}%` }
87
+ }
88
+ ),
89
+ /* @__PURE__ */ e(
90
+ "div",
91
+ {
92
+ className: D(
93
+ "absolute top-1/2 -translate-y-1/2 h-2.5 w-2.5 rounded-full shadow-raised transition-opacity",
94
+ P,
95
+ f ? "opacity-100 scale-110" : "opacity-0 group-hover/vol:opacity-100"
96
+ ),
97
+ style: { left: `${v * 100}%`, marginLeft: "-5px" }
98
+ }
99
+ )
100
+ ]
101
+ }
102
+ ) })
103
+ ] });
104
+ }
105
+ function L(t) {
106
+ if (!isFinite(t) || t < 0) return "0:00";
107
+ const o = Math.floor(t / 3600), r = Math.floor(t % 3600 / 60), n = Math.floor(t % 60);
108
+ return o > 0 ? `${o}:${r.toString().padStart(2, "0")}:${n.toString().padStart(2, "0")}` : `${r}:${n.toString().padStart(2, "0")}`;
109
+ }
110
+ const B = [0.5, 0.75, 1, 1.25, 1.5, 2];
111
+ function Z({ url: t, onError: o }) {
112
+ const r = a.useRef(null), n = a.useRef(null), [d, l] = a.useState(!1), [f, m] = a.useState(0), [v, g] = a.useState(0), [b, N] = a.useState(0), [y, k] = a.useState(!1), [R, T] = a.useState(!1), [P, C] = a.useState(!0), [p, M] = a.useState(1), S = a.useRef(void 0);
113
+ a.useEffect(() => () => clearTimeout(S.current), []), a.useEffect(() => {
114
+ function c(s) {
115
+ const h = n.current;
116
+ if (!h || !h.contains(document.activeElement) && document.activeElement !== h) return;
117
+ const i = r.current;
118
+ if (i)
119
+ switch (s.key) {
120
+ case " ":
121
+ case "k":
122
+ s.preventDefault(), l((w) => (w ? i.pause() : i.play(), !w));
123
+ break;
124
+ case "ArrowRight":
125
+ s.preventDefault(), i.currentTime = Math.min(i.duration, i.currentTime + 5);
126
+ break;
127
+ case "ArrowLeft":
128
+ s.preventDefault(), i.currentTime = Math.max(0, i.currentTime - 5);
129
+ break;
130
+ case "j":
131
+ s.preventDefault(), i.currentTime = Math.max(0, i.currentTime - 10);
132
+ break;
133
+ case "l":
134
+ s.preventDefault(), i.currentTime = Math.min(i.duration, i.currentTime + 10);
135
+ break;
136
+ case "m":
137
+ s.preventDefault(), k((w) => (i.muted = !w, !w));
138
+ break;
139
+ case "f":
140
+ s.preventDefault(), i.requestFullscreen?.();
141
+ break;
142
+ case ">":
143
+ s.preventDefault(), E(1);
144
+ break;
145
+ case "<":
146
+ s.preventDefault(), E(-1);
147
+ break;
148
+ }
149
+ }
150
+ return document.addEventListener("keydown", c), () => document.removeEventListener("keydown", c);
151
+ }, []);
152
+ function E(c) {
153
+ const s = B.indexOf(p), h = Math.max(0, Math.min(B.length - 1, s + c)), i = B[h];
154
+ M(i), r.current && (r.current.playbackRate = i);
155
+ }
156
+ function I() {
157
+ r.current && (d ? r.current.pause() : r.current.play(), l(!d));
158
+ }
159
+ function z(c) {
160
+ if (!r.current || !v) return;
161
+ const s = c.currentTarget.getBoundingClientRect(), h = (c.clientX - s.left) / s.width;
162
+ r.current.currentTime = h * v;
163
+ }
164
+ function A() {
165
+ C(!0), clearTimeout(S.current), d && (S.current = setTimeout(() => C(!1), 3e3));
166
+ }
167
+ return R ? /* @__PURE__ */ e(U, { message: "Could not load video", url: t }) : /* @__PURE__ */ u(
168
+ "div",
169
+ {
170
+ ref: n,
171
+ className: "group relative rounded-ds-md bg-black overflow-hidden",
172
+ onMouseMove: A,
173
+ onMouseLeave: () => d && C(!1),
174
+ tabIndex: -1,
175
+ children: [
176
+ /* @__PURE__ */ e(
177
+ "video",
178
+ {
179
+ ref: r,
180
+ src: t,
181
+ className: "max-h-[70vh] w-full",
182
+ onClick: I,
183
+ muted: y,
184
+ onTimeUpdate: () => {
185
+ r.current && (N(r.current.currentTime), r.current.duration && m(r.current.currentTime / r.current.duration * 100));
186
+ },
187
+ onLoadedMetadata: () => g(r.current?.duration ?? 0),
188
+ onEnded: () => {
189
+ l(!1), C(!0);
190
+ },
191
+ onError: () => {
192
+ T(!0), o?.("Video failed to load");
193
+ },
194
+ playsInline: !0
195
+ }
196
+ ),
197
+ !d && /* @__PURE__ */ e(
198
+ $.button,
199
+ {
200
+ initial: { opacity: 0, scale: 0.8 },
201
+ animate: { opacity: 1, scale: 1 },
202
+ transition: J.snappy,
203
+ onClick: I,
204
+ className: "absolute inset-0 flex items-center justify-center bg-black/30",
205
+ "aria-label": "Play video",
206
+ children: /* @__PURE__ */ e("div", { className: "flex h-14 w-14 items-center justify-center rounded-full bg-white/90 shadow-floating", children: /* @__PURE__ */ e(x, { icon: F, size: "xl", className: "text-surface-fg ml-0.5" }) })
207
+ }
208
+ ),
209
+ /* @__PURE__ */ e(Q, { children: P && v > 0 && /* @__PURE__ */ u(
210
+ $.div,
211
+ {
212
+ initial: { opacity: 0, y: 10 },
213
+ animate: { opacity: 1, y: 0 },
214
+ exit: { opacity: 0, y: 10 },
215
+ transition: j.fade,
216
+ className: "absolute bottom-0 left-0 right-0 bg-gradient-to-t from-black/80 to-transparent px-ds-04 pb-ds-04 pt-ds-08",
217
+ children: [
218
+ /* @__PURE__ */ u(
219
+ "div",
220
+ {
221
+ className: "relative h-1 w-full cursor-pointer rounded-full bg-white/30 mb-ds-03 group/progress",
222
+ onClick: z,
223
+ role: "slider",
224
+ "aria-label": "Video progress",
225
+ "aria-valuenow": Math.round(f),
226
+ "aria-valuemin": 0,
227
+ "aria-valuemax": 100,
228
+ tabIndex: 0,
229
+ children: [
230
+ /* @__PURE__ */ e(
231
+ "div",
232
+ {
233
+ className: "absolute left-0 top-0 h-full rounded-full bg-white transition-[width] duration-75",
234
+ style: { width: `${f}%` }
235
+ }
236
+ ),
237
+ /* @__PURE__ */ e(
238
+ "div",
239
+ {
240
+ className: "absolute top-1/2 -translate-y-1/2 h-3 w-3 rounded-full bg-white shadow-raised opacity-0 group-hover/progress:opacity-100 transition-opacity",
241
+ style: { left: `${f}%`, marginLeft: "-6px" }
242
+ }
243
+ )
244
+ ]
245
+ }
246
+ ),
247
+ /* @__PURE__ */ u("div", { className: "flex items-center gap-ds-03", children: [
248
+ /* @__PURE__ */ e("button", { onClick: I, className: "text-white hover:text-white/80", "aria-label": d ? "Pause" : "Play", title: d ? "Pause" : "Play", children: d ? /* @__PURE__ */ e(x, { icon: K, size: "lg" }) : /* @__PURE__ */ e(x, { icon: F, size: "lg" }) }),
249
+ /* @__PURE__ */ e(
250
+ W,
251
+ {
252
+ volume: y ? 0 : 1,
253
+ muted: y,
254
+ onVolumeChange: (c) => {
255
+ r.current && (r.current.volume = c), c > 0 && y && (k(!1), r.current && (r.current.muted = !1));
256
+ },
257
+ onMuteToggle: () => {
258
+ k(!y), r.current && (r.current.muted = !y);
259
+ },
260
+ variant: "dark"
261
+ }
262
+ ),
263
+ /* @__PURE__ */ u("span", { className: "text-[11px] font-mono text-white/70 tabular-nums", children: [
264
+ L(b),
265
+ " / ",
266
+ L(v)
267
+ ] }),
268
+ /* @__PURE__ */ e("div", { className: "flex-1" }),
269
+ /* @__PURE__ */ u(
270
+ "button",
271
+ {
272
+ onClick: () => E(1),
273
+ className: "text-[11px] font-mono text-white/70 hover:text-white px-1 rounded-ds-sm hover:bg-white/10 transition-colors",
274
+ "aria-label": `Playback speed: ${p}x`,
275
+ children: [
276
+ p,
277
+ "x"
278
+ ]
279
+ }
280
+ ),
281
+ /* @__PURE__ */ e(
282
+ "button",
283
+ {
284
+ onClick: () => r.current?.requestFullscreen?.(),
285
+ className: "text-white hover:text-white/80",
286
+ "aria-label": "Fullscreen (F)",
287
+ title: "Fullscreen",
288
+ children: /* @__PURE__ */ e(x, { icon: G, size: "sm" })
289
+ }
290
+ )
291
+ ] })
292
+ ]
293
+ }
294
+ ) })
295
+ ]
296
+ }
297
+ );
298
+ }
299
+ function ee({ url: t, fileName: o, onError: r }) {
300
+ const n = a.useRef(null), d = a.useRef(null), [l, f] = a.useState(!1), [m, v] = a.useState(0), [g, b] = a.useState(0), [N, y] = a.useState(0), [k, R] = a.useState(1), [T, P] = a.useState(!1), [C, p] = a.useState(!1), [M, S] = a.useState(null);
301
+ a.useEffect(() => {
302
+ function c(s) {
303
+ const h = d.current;
304
+ if (!h || !h.contains(document.activeElement) && document.activeElement !== h) return;
305
+ const i = n.current;
306
+ if (i)
307
+ switch (s.key) {
308
+ case " ":
309
+ s.preventDefault(), f((w) => (w ? i.pause() : i.play(), !w));
310
+ break;
311
+ case "ArrowRight":
312
+ s.preventDefault(), i.currentTime = Math.min(i.duration || 0, i.currentTime + 5);
313
+ break;
314
+ case "ArrowLeft":
315
+ s.preventDefault(), i.currentTime = Math.max(0, i.currentTime - 5);
316
+ break;
317
+ case "m":
318
+ s.preventDefault(), P((w) => (i.muted = !w, !w));
319
+ break;
320
+ }
321
+ }
322
+ return document.addEventListener("keydown", c), () => document.removeEventListener("keydown", c);
323
+ }, []);
324
+ function E() {
325
+ n.current && (l ? n.current.pause() : n.current.play(), f(!l));
326
+ }
327
+ function I(c) {
328
+ if (!n.current || !g) return;
329
+ const s = c.currentTarget.getBoundingClientRect(), h = Math.max(0, Math.min(1, (c.clientX - s.left) / s.width));
330
+ n.current.currentTime = h * g;
331
+ }
332
+ function z(c) {
333
+ if (!g) return;
334
+ const s = c.currentTarget.getBoundingClientRect(), h = (c.clientX - s.left) / s.width;
335
+ S(h * g);
336
+ }
337
+ function A() {
338
+ if (!n.current) return;
339
+ const c = !T;
340
+ P(c), n.current.muted = c;
341
+ }
342
+ return C ? /* @__PURE__ */ e(U, { message: "Could not load audio", url: t }) : /* @__PURE__ */ u("div", { ref: d, className: "rounded-ds-lg border border-surface-border bg-surface-raised shadow-raised overflow-hidden", tabIndex: -1, children: [
343
+ /* @__PURE__ */ e(
344
+ "audio",
345
+ {
346
+ ref: n,
347
+ src: t,
348
+ onTimeUpdate: () => {
349
+ n.current && (y(n.current.currentTime), n.current.duration && v(n.current.currentTime / n.current.duration * 100));
350
+ },
351
+ onLoadedMetadata: () => b(n.current?.duration ?? 0),
352
+ onEnded: () => f(!1),
353
+ onError: () => {
354
+ p(!0), r?.("Audio failed to load");
355
+ }
356
+ }
357
+ ),
358
+ /* @__PURE__ */ u(
359
+ "div",
360
+ {
361
+ className: "relative h-1 w-full cursor-pointer bg-surface-sunken group/bar",
362
+ onClick: I,
363
+ onMouseMove: z,
364
+ onMouseLeave: () => S(null),
365
+ role: "slider",
366
+ "aria-label": "Audio progress",
367
+ "aria-valuenow": Math.round(m),
368
+ "aria-valuemin": 0,
369
+ "aria-valuemax": 100,
370
+ tabIndex: 0,
371
+ children: [
372
+ /* @__PURE__ */ e(
373
+ "div",
374
+ {
375
+ className: "absolute left-0 top-0 h-full bg-accent-9 transition-[width] duration-75",
376
+ style: { width: `${m}%` }
377
+ }
378
+ ),
379
+ M !== null && /* @__PURE__ */ e(
380
+ "div",
381
+ {
382
+ className: "absolute -top-7 -translate-x-1/2 rounded-ds-sm bg-surface-overlay px-1.5 py-0.5 text-[10px] font-mono text-surface-fg shadow-floating pointer-events-none",
383
+ style: { left: `${M / (g || 1) * 100}%` },
384
+ children: L(M)
385
+ }
386
+ ),
387
+ /* @__PURE__ */ e(
388
+ "div",
389
+ {
390
+ className: "absolute top-1/2 -translate-y-1/2 h-2.5 w-2.5 rounded-full bg-accent-9 shadow-raised opacity-0 group-hover/bar:opacity-100 transition-opacity",
391
+ style: { left: `${m}%`, marginLeft: "-5px" }
392
+ }
393
+ )
394
+ ]
395
+ }
396
+ ),
397
+ /* @__PURE__ */ u("div", { className: "flex items-center gap-ds-04 px-ds-05 py-ds-04", children: [
398
+ /* @__PURE__ */ e(
399
+ V,
400
+ {
401
+ variant: "solid",
402
+ size: "icon-sm",
403
+ onClick: E,
404
+ "aria-label": l ? "Pause" : "Play",
405
+ title: l ? "Pause" : "Play",
406
+ className: "shrink-0",
407
+ children: l ? /* @__PURE__ */ e(x, { icon: K, size: "sm" }) : /* @__PURE__ */ e(x, { icon: F, size: "sm", className: "ml-0.5" })
408
+ }
409
+ ),
410
+ /* @__PURE__ */ u("div", { className: "flex-1 min-w-0", children: [
411
+ o && /* @__PURE__ */ e("p", { className: "text-ds-sm font-semibold text-surface-fg truncate", children: o }),
412
+ /* @__PURE__ */ u("p", { className: "text-ds-xs font-mono text-surface-fg-muted tabular-nums", children: [
413
+ L(N),
414
+ " / ",
415
+ L(g)
416
+ ] })
417
+ ] }),
418
+ /* @__PURE__ */ e(
419
+ W,
420
+ {
421
+ volume: k,
422
+ muted: T,
423
+ onVolumeChange: (c) => {
424
+ R(c), n.current && (n.current.volume = c), c > 0 && T && (P(!1), n.current && (n.current.muted = !1));
425
+ },
426
+ onMuteToggle: A,
427
+ variant: "light"
428
+ }
429
+ )
430
+ ] })
431
+ ] });
432
+ }
433
+ function te({ url: t, embedUrl: o, onError: r }) {
434
+ const [n, d] = a.useState(!1), [l, f] = a.useState(!1);
435
+ return a.useEffect(() => {
436
+ const m = setTimeout(() => {
437
+ n || (f(!0), r?.("Embed timed out"));
438
+ }, 15e3);
439
+ return () => clearTimeout(m);
440
+ }, [n, r]), l ? /* @__PURE__ */ e(U, { message: "Could not load embed", url: t }) : /* @__PURE__ */ u("div", { className: "relative w-full rounded-ds-md overflow-hidden", style: { aspectRatio: "16 / 9" }, children: [
441
+ !n && /* @__PURE__ */ e(X, { className: "absolute inset-0" }),
442
+ /* @__PURE__ */ e(
443
+ $.iframe,
444
+ {
445
+ src: o,
446
+ title: "Embedded content",
447
+ onLoad: () => d(!0),
448
+ onError: () => {
449
+ f(!0), r?.("Embed failed to load");
450
+ },
451
+ initial: { opacity: 0 },
452
+ animate: { opacity: n ? 1 : 0 },
453
+ transition: j.fade,
454
+ className: "absolute inset-0 h-full w-full border-none",
455
+ allowFullScreen: !0
456
+ }
457
+ )
458
+ ] });
459
+ }
460
+ const re = a.lazy(() => import("./image-preview.js")), ne = a.lazy(() => import("./document-preview.js"));
461
+ function ae(t, o) {
462
+ if (o) {
463
+ if (o.startsWith("image/")) return "image";
464
+ if (o === "application/pdf") return "pdf";
465
+ if (o.startsWith("video/")) return "video";
466
+ if (o.startsWith("audio/")) return "audio";
467
+ }
468
+ const r = t.split("?")[0].split(".").pop()?.toLowerCase();
469
+ return ["jpg", "jpeg", "png", "gif", "webp", "svg", "avif", "bmp"].includes(r ?? "") ? "image" : r === "pdf" ? "pdf" : ["mp4", "webm", "ogg", "mov"].includes(r ?? "") ? "video" : ["mp3", "wav", "ogg", "aac", "flac"].includes(r ?? "") ? "audio" : t.includes("figma.com") || t.includes("loom.com") || t.includes("youtube.com") || t.includes("youtu.be") || t.includes("vimeo.com") ? "embed" : "image";
470
+ }
471
+ function oe(t) {
472
+ const o = t.match(/(?:youtube\.com\/watch\?v=|youtu\.be\/)([^&?]+)/);
473
+ if (o) return `https://www.youtube.com/embed/${o[1]}`;
474
+ const r = t.match(/vimeo\.com\/(\d+)/);
475
+ if (r) return `https://player.vimeo.com/video/${r[1]}`;
476
+ if (t.includes("figma.com")) return `https://www.figma.com/embed?embed_host=share&url=${encodeURIComponent(t)}`;
477
+ const n = t.match(/loom\.com\/share\/([^?]+)/);
478
+ return n ? `https://www.loom.com/embed/${n[1]}` : t;
479
+ }
480
+ function ve({
481
+ url: t,
482
+ type: o,
483
+ mimeType: r,
484
+ alt: n,
485
+ initialPage: d = 1,
486
+ fileName: l,
487
+ fileSize: f,
488
+ onError: m,
489
+ className: v,
490
+ ...g
491
+ }) {
492
+ const b = o ?? ae(t, r), N = /* @__PURE__ */ e(X, { className: "h-64 w-full rounded-ds-md" });
493
+ return /* @__PURE__ */ u("div", { className: D("flex flex-col gap-ds-03", v), ...g, children: [
494
+ (l || f) && /* @__PURE__ */ u("div", { className: "flex items-center gap-ds-03", children: [
495
+ l && /* @__PURE__ */ e("span", { className: "text-ds-sm font-semibold text-surface-fg truncate", children: l }),
496
+ f && /* @__PURE__ */ e(q, { variant: "subtle", size: "xs", children: f })
497
+ ] }),
498
+ b === "image" && /* @__PURE__ */ e(a.Suspense, { fallback: N, children: /* @__PURE__ */ e(re, { url: t, alt: n, onError: m }) }),
499
+ b === "pdf" && /* @__PURE__ */ e(a.Suspense, { fallback: N, children: /* @__PURE__ */ e(ne, { url: t, initialPage: d, onError: m }) }),
500
+ b === "video" && /* @__PURE__ */ e(Z, { url: t, onError: m }),
501
+ b === "audio" && /* @__PURE__ */ e(ee, { url: t, fileName: l, onError: m }),
502
+ b === "embed" && /* @__PURE__ */ e(te, { url: t, embedUrl: oe(t), onError: m }),
503
+ b !== "audio" && /* @__PURE__ */ e("div", { className: "flex justify-end", children: /* @__PURE__ */ e(V, { variant: "ghost", size: "xs", startIcon: /* @__PURE__ */ e(x, { icon: _ }), asChild: !0, children: /* @__PURE__ */ e("a", { href: t, download: !0, target: "_blank", rel: "noopener noreferrer", children: "Download" }) }) })
504
+ ] });
505
+ }
506
+ export {
507
+ U as E,
508
+ ve as F,
509
+ pe as T,
510
+ ge as a
511
+ };