@devalok/shilp-sutra 0.30.0 → 0.32.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +82 -239
- package/dist/_chunks/badge-group.js +123 -171
- package/dist/_chunks/document-preview.js +92 -0
- package/dist/_chunks/file-preview.js +511 -0
- package/dist/_chunks/image-preview.js +90 -0
- package/dist/_chunks/primitives.js +109 -109
- package/dist/_chunks/stat-row.js +144 -124
- package/dist/_chunks/use-calendar.js +558 -490
- package/dist/ai/block-renderer.d.ts +2 -1
- package/dist/ai/block-renderer.d.ts.map +1 -1
- package/dist/ai/block-renderer.js +30 -29
- package/dist/ai/blocks/block-table.d.ts.map +1 -1
- package/dist/ai/blocks/confirm.d.ts.map +1 -1
- package/dist/ai/blocks/divider.d.ts.map +1 -1
- package/dist/ai/blocks/error.d.ts.map +1 -1
- package/dist/ai/blocks/info.d.ts.map +1 -1
- package/dist/ai/blocks/loading.d.ts.map +1 -1
- package/dist/ai/blocks/stat-row.d.ts.map +1 -1
- package/dist/ai/blocks/success.d.ts.map +1 -1
- package/dist/ai/blocks/text.d.ts.map +1 -1
- package/dist/ai/command-bar.d.ts +18 -0
- package/dist/ai/command-bar.d.ts.map +1 -1
- package/dist/ai/command-bar.js +126 -125
- package/dist/ai/conversation.d.ts +13 -1
- package/dist/ai/conversation.d.ts.map +1 -1
- package/dist/ai/conversation.js +78 -78
- package/dist/ai/types.d.ts +0 -1
- package/dist/ai/types.d.ts.map +1 -1
- package/dist/ai/types.js +1 -0
- package/dist/composed/bulk-action-bar.d.ts +6 -4
- package/dist/composed/bulk-action-bar.d.ts.map +1 -1
- package/dist/composed/bulk-action-bar.js +102 -58
- package/dist/composed/command-palette.d.ts +9 -0
- package/dist/composed/command-palette.d.ts.map +1 -1
- package/dist/composed/command-palette.js +68 -68
- package/dist/composed/confirm-dialog.d.ts +1 -1
- package/dist/composed/confirm-dialog.d.ts.map +1 -1
- package/dist/composed/confirm-dialog.js +10 -10
- package/dist/composed/content-card.d.ts.map +1 -1
- package/dist/composed/date-picker/date-picker.d.ts +11 -1
- package/dist/composed/date-picker/date-picker.d.ts.map +1 -1
- package/dist/composed/date-picker/month-picker.d.ts.map +1 -1
- package/dist/composed/date-picker/year-picker.d.ts.map +1 -1
- package/dist/composed/deadline-indicator.d.ts +1 -1
- package/dist/composed/deadline-indicator.d.ts.map +1 -1
- package/dist/composed/deadline-indicator.js +39 -36
- package/dist/composed/emoji-picker.d.ts +6 -0
- package/dist/composed/emoji-picker.d.ts.map +1 -1
- package/dist/composed/emoji-picker.js +22 -20
- package/dist/composed/error-boundary.d.ts +21 -1
- package/dist/composed/error-boundary.d.ts.map +1 -1
- package/dist/composed/error-boundary.js +47 -32
- package/dist/composed/file-preview/audio-preview.d.ts +7 -0
- package/dist/composed/file-preview/audio-preview.d.ts.map +1 -0
- package/dist/composed/file-preview/document-preview.d.ts +7 -0
- package/dist/composed/file-preview/document-preview.d.ts.map +1 -0
- package/dist/composed/file-preview/embed-preview.d.ts +7 -0
- package/dist/composed/file-preview/embed-preview.d.ts.map +1 -0
- package/dist/composed/file-preview/image-preview.d.ts +7 -0
- package/dist/composed/file-preview/image-preview.d.ts.map +1 -0
- package/dist/composed/file-preview/shared.d.ts +20 -0
- package/dist/composed/file-preview/shared.d.ts.map +1 -0
- package/dist/composed/file-preview/video-preview.d.ts +6 -0
- package/dist/composed/file-preview/video-preview.d.ts.map +1 -0
- package/dist/composed/file-preview.d.ts.map +1 -1
- package/dist/composed/file-preview.js +10 -662
- package/dist/composed/filter-bar.d.ts +10 -2
- package/dist/composed/filter-bar.d.ts.map +1 -1
- package/dist/composed/filter-bar.js +42 -43
- package/dist/composed/form-section.d.ts +1 -1
- package/dist/composed/form-section.d.ts.map +1 -1
- package/dist/composed/form-section.js +22 -21
- package/dist/composed/index.d.ts +2 -2
- package/dist/composed/index.d.ts.map +1 -1
- package/dist/composed/index.js +58 -57
- package/dist/composed/inline-edit.d.ts +1 -1
- package/dist/composed/inline-edit.d.ts.map +1 -1
- package/dist/composed/inline-edit.js +33 -32
- package/dist/composed/lib/string-utils.d.ts.map +1 -1
- package/dist/composed/loading-skeleton.d.ts.map +1 -1
- package/dist/composed/markdown-viewer.d.ts +1 -1
- package/dist/composed/markdown-viewer.d.ts.map +1 -1
- package/dist/composed/markdown-viewer.js +60 -59
- package/dist/composed/master-detail.d.ts +11 -7
- package/dist/composed/master-detail.d.ts.map +1 -1
- package/dist/composed/master-detail.js +123 -84
- package/dist/composed/page-header.d.ts.map +1 -1
- package/dist/composed/page-skeletons.d.ts.map +1 -1
- package/dist/composed/priority-indicator.d.ts +1 -0
- package/dist/composed/priority-indicator.js +1 -0
- package/dist/composed/responsive-overlay.d.ts +8 -0
- package/dist/composed/responsive-overlay.d.ts.map +1 -1
- package/dist/composed/rich-text-editor.d.ts +11 -3
- package/dist/composed/rich-text-editor.d.ts.map +1 -1
- package/dist/composed/rich-text-editor.js +21 -20
- package/dist/composed/schedule-view.d.ts +9 -1
- package/dist/composed/schedule-view.d.ts.map +1 -1
- package/dist/hooks/index.d.ts +2 -0
- package/dist/hooks/index.d.ts.map +1 -1
- package/dist/hooks/index.js +8 -4
- package/dist/hooks/use-touch-device.d.ts +12 -0
- package/dist/hooks/use-touch-device.d.ts.map +1 -0
- package/dist/hooks/use-touch-device.js +13 -0
- package/dist/hooks/use-viewport-height.d.ts +11 -0
- package/dist/hooks/use-viewport-height.d.ts.map +1 -0
- package/dist/hooks/use-viewport-height.js +16 -0
- package/dist/shell/bottom-navbar.d.ts.map +1 -1
- package/dist/shell/bottom-navbar.js +72 -63
- package/dist/shell/command-registry.d.ts.map +1 -1
- package/dist/shell/notification-center.d.ts.map +1 -1
- package/dist/shell/notification-center.js +77 -77
- package/dist/shell/top-bar.d.ts +2 -2
- package/dist/shell/top-bar.d.ts.map +1 -1
- package/dist/shell/top-bar.js +61 -60
- package/dist/tailwind/index.cjs +51 -7
- package/dist/tailwind/preset.d.ts.map +1 -1
- package/dist/tailwind/preset.js +51 -7
- package/dist/tokens/primitives.css +3 -1
- package/dist/tokens/semantic.css +16 -13
- package/dist/tokens/typography.css +33 -4
- package/dist/ui/alert.d.ts +1 -0
- package/dist/ui/alert.d.ts.map +1 -1
- package/dist/ui/alert.js +42 -37
- package/dist/ui/autocomplete.d.ts.map +1 -1
- package/dist/ui/autocomplete.js +38 -39
- package/dist/ui/badge.d.ts +110 -2
- package/dist/ui/badge.d.ts.map +1 -1
- package/dist/ui/banner.d.ts.map +1 -1
- package/dist/ui/banner.js +8 -7
- package/dist/ui/button.d.ts +2 -2
- package/dist/ui/button.d.ts.map +1 -1
- package/dist/ui/button.js +54 -74
- package/dist/ui/card.d.ts +5 -1
- package/dist/ui/card.d.ts.map +1 -1
- package/dist/ui/card.js +111 -79
- package/dist/ui/charts/area-chart.d.ts +2 -0
- package/dist/ui/charts/area-chart.d.ts.map +1 -1
- package/dist/ui/charts/bar-chart.d.ts +2 -0
- package/dist/ui/charts/bar-chart.d.ts.map +1 -1
- package/dist/ui/charts/chart-container.d.ts +2 -0
- package/dist/ui/charts/chart-container.d.ts.map +1 -1
- package/dist/ui/charts/index.js +583 -577
- package/dist/ui/charts/line-chart.d.ts +2 -0
- package/dist/ui/charts/line-chart.d.ts.map +1 -1
- package/dist/ui/charts/pie-chart.d.ts +2 -0
- package/dist/ui/charts/pie-chart.d.ts.map +1 -1
- package/dist/ui/charts/radar-chart.d.ts +2 -0
- package/dist/ui/charts/radar-chart.d.ts.map +1 -1
- package/dist/ui/checkbox.d.ts +2 -0
- package/dist/ui/checkbox.d.ts.map +1 -1
- package/dist/ui/checkbox.js +36 -27
- package/dist/ui/code.d.ts.map +1 -1
- package/dist/ui/color-input.js +5 -5
- package/dist/ui/combobox.d.ts +6 -1
- package/dist/ui/combobox.d.ts.map +1 -1
- package/dist/ui/combobox.js +1 -1
- package/dist/ui/container.d.ts.map +1 -1
- package/dist/ui/context-menu.js +1 -1
- package/dist/ui/data-table-body.d.ts +12 -0
- package/dist/ui/data-table-body.d.ts.map +1 -0
- package/dist/ui/data-table-body.js +219 -0
- package/dist/ui/data-table-bulk-actions.d.ts +19 -0
- package/dist/ui/data-table-bulk-actions.d.ts.map +1 -0
- package/dist/ui/data-table-bulk-actions.js +61 -0
- package/dist/ui/data-table-card.d.ts +9 -0
- package/dist/ui/data-table-card.d.ts.map +1 -0
- package/dist/ui/data-table-card.js +73 -0
- package/dist/ui/data-table-context.d.ts +62 -0
- package/dist/ui/data-table-context.d.ts.map +1 -0
- package/dist/ui/data-table-context.js +48 -0
- package/dist/ui/data-table-header.d.ts +10 -0
- package/dist/ui/data-table-header.d.ts.map +1 -0
- package/dist/ui/data-table-header.js +141 -0
- package/dist/ui/data-table-pagination.d.ts +13 -0
- package/dist/ui/data-table-pagination.d.ts.map +1 -0
- package/dist/ui/data-table-pagination.js +84 -0
- package/dist/ui/data-table.d.ts +11 -9
- package/dist/ui/data-table.d.ts.map +1 -1
- package/dist/ui/data-table.js +258 -573
- package/dist/ui/dialog.d.ts +6 -2
- package/dist/ui/dialog.d.ts.map +1 -1
- package/dist/ui/dialog.js +84 -82
- package/dist/ui/dropdown-menu.js +1 -1
- package/dist/ui/hover-card.d.ts +7 -0
- package/dist/ui/hover-card.d.ts.map +1 -1
- package/dist/ui/hover-card.js +3 -3
- package/dist/ui/icon-group.d.ts +2 -4
- package/dist/ui/icon-group.d.ts.map +1 -1
- package/dist/ui/icon-group.js +22 -23
- package/dist/ui/index.d.ts +1 -2
- package/dist/ui/index.d.ts.map +1 -1
- package/dist/ui/index.js +94 -99
- package/dist/ui/label.js +1 -1
- package/dist/ui/lib/bottom-sheet.d.ts +16 -0
- package/dist/ui/lib/bottom-sheet.d.ts.map +1 -0
- package/dist/ui/lib/date-utils.d.ts.map +1 -1
- package/dist/ui/lib/motion.d.ts.map +1 -1
- package/dist/ui/lib/utils.d.ts.map +1 -1
- package/dist/ui/menubar.d.ts.map +1 -1
- package/dist/ui/menubar.js +64 -73
- package/dist/ui/navigation-menu.d.ts.map +1 -1
- package/dist/ui/navigation-menu.js +40 -44
- package/dist/ui/number-input.d.ts.map +1 -1
- package/dist/ui/number-input.js +19 -17
- package/dist/ui/popover.d.ts.map +1 -1
- package/dist/ui/popover.js +107 -32
- package/dist/ui/progress-ring.d.ts.map +1 -1
- package/dist/ui/progress-ring.js +80 -80
- package/dist/ui/progress.js +4 -4
- package/dist/ui/radio.d.ts +5 -2
- package/dist/ui/radio.d.ts.map +1 -1
- package/dist/ui/radio.js +29 -20
- package/dist/ui/search-input.d.ts.map +1 -1
- package/dist/ui/search-input.js +13 -12
- package/dist/ui/segmented-control.d.ts +6 -108
- package/dist/ui/segmented-control.d.ts.map +1 -1
- package/dist/ui/segmented-control.js +86 -272
- package/dist/ui/select.d.ts +3 -1
- package/dist/ui/select.d.ts.map +1 -1
- package/dist/ui/select.js +83 -71
- package/dist/ui/separator.js +5 -5
- package/dist/ui/sheet.d.ts +2 -0
- package/dist/ui/sheet.d.ts.map +1 -1
- package/dist/ui/sheet.js +102 -84
- package/dist/ui/sidebar.d.ts.map +1 -1
- package/dist/ui/sidebar.js +200 -175
- package/dist/ui/skeleton.d.ts.map +1 -1
- package/dist/ui/slider.js +14 -14
- package/dist/ui/stack.d.ts.map +1 -1
- package/dist/ui/status-dot.js +8 -8
- package/dist/ui/stepper.d.ts.map +1 -1
- package/dist/ui/stepper.js +33 -31
- package/dist/ui/switch.js +3 -3
- package/dist/ui/table.d.ts.map +1 -1
- package/dist/ui/tabs.d.ts +7 -0
- package/dist/ui/tabs.d.ts.map +1 -1
- package/dist/ui/tabs.js +102 -76
- package/dist/ui/text.d.ts.map +1 -1
- package/dist/ui/toast-types.d.ts +0 -1
- package/dist/ui/toast-types.d.ts.map +1 -1
- package/dist/ui/toast-types.js +0 -1
- package/dist/ui/toast.d.ts.map +1 -1
- package/dist/ui/toast.js +156 -150
- package/dist/ui/toggle-group.js +1 -1
- package/dist/ui/toggle.js +1 -1
- package/dist/ui/tooltip.js +3 -3
- package/dist/ui/visually-hidden.d.ts.map +1 -1
- package/docs/components/ui/alert.md +3 -0
- package/docs/components/ui/badge.md +3 -0
- package/docs/components/ui/card.md +4 -0
- package/docs/components/ui/data-table-body.md +13 -0
- package/docs/components/ui/data-table-bulk-actions.md +13 -0
- package/docs/components/ui/data-table-card.md +13 -0
- package/docs/components/ui/data-table-context.md +13 -0
- package/docs/components/ui/data-table-header.md +13 -0
- package/docs/components/ui/data-table-pagination.md +13 -0
- package/docs/components/ui/select.md +4 -0
- package/docs/components/ui/tabs.md +4 -0
- package/llms-full.txt +97 -48
- package/llms.txt +46 -1
- package/package.json +37 -7
- package/dist/ui/chip.d.ts +0 -19
- package/dist/ui/chip.d.ts.map +0 -1
- package/dist/ui/chip.js +0 -14
- package/dist/ui/lib/use-ripple.d.ts +0 -14
- package/dist/ui/lib/use-ripple.d.ts.map +0 -1
|
@@ -1,665 +1,13 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import {
|
|
11
|
-
import { m as A, A as H } from "../_chunks/framer.js";
|
|
12
|
-
function ce(r, s) {
|
|
13
|
-
if (s) {
|
|
14
|
-
if (s.startsWith("image/")) return "image";
|
|
15
|
-
if (s === "application/pdf") return "pdf";
|
|
16
|
-
if (s.startsWith("video/")) return "video";
|
|
17
|
-
if (s.startsWith("audio/")) return "audio";
|
|
18
|
-
}
|
|
19
|
-
const t = r.split("?")[0].split(".").pop()?.toLowerCase();
|
|
20
|
-
return ["jpg", "jpeg", "png", "gif", "webp", "svg", "avif", "bmp"].includes(t ?? "") ? "image" : t === "pdf" ? "pdf" : ["mp4", "webm", "ogg", "mov"].includes(t ?? "") ? "video" : ["mp3", "wav", "ogg", "aac", "flac"].includes(t ?? "") ? "audio" : r.includes("figma.com") || r.includes("loom.com") || r.includes("youtube.com") || r.includes("youtu.be") || r.includes("vimeo.com") ? "embed" : "image";
|
|
21
|
-
}
|
|
22
|
-
function le(r) {
|
|
23
|
-
const s = r.match(/(?:youtube\.com\/watch\?v=|youtu\.be\/)([^&?]+)/);
|
|
24
|
-
if (s) return `https://www.youtube.com/embed/${s[1]}`;
|
|
25
|
-
const t = r.match(/vimeo\.com\/(\d+)/);
|
|
26
|
-
if (t) return `https://player.vimeo.com/video/${t[1]}`;
|
|
27
|
-
if (r.includes("figma.com")) return `https://www.figma.com/embed?embed_host=share&url=${encodeURIComponent(r)}`;
|
|
28
|
-
const a = r.match(/loom\.com\/share\/([^?]+)/);
|
|
29
|
-
return a ? `https://www.loom.com/embed/${a[1]}` : r;
|
|
30
|
-
}
|
|
31
|
-
function X({
|
|
32
|
-
volume: r,
|
|
33
|
-
muted: s,
|
|
34
|
-
onVolumeChange: t,
|
|
35
|
-
onMuteToggle: a,
|
|
36
|
-
variant: v = "light"
|
|
37
|
-
}) {
|
|
38
|
-
const m = n.useRef(null), [b, h] = n.useState(!1), g = s ? 0 : r;
|
|
39
|
-
function y(x) {
|
|
40
|
-
if (!m.current) return r;
|
|
41
|
-
const E = m.current.getBoundingClientRect();
|
|
42
|
-
return Math.max(0, Math.min(1, (x.clientX - E.left) / E.width));
|
|
43
|
-
}
|
|
44
|
-
function p(x) {
|
|
45
|
-
x.preventDefault(), h(!0);
|
|
46
|
-
const E = y(x);
|
|
47
|
-
t(E), x.target.setPointerCapture(x.pointerId);
|
|
48
|
-
}
|
|
49
|
-
function k(x) {
|
|
50
|
-
b && t(y(x));
|
|
51
|
-
}
|
|
52
|
-
function N() {
|
|
53
|
-
h(!1);
|
|
54
|
-
}
|
|
55
|
-
const f = v === "dark", I = f ? "bg-white/30" : "bg-surface-sunken", D = f ? "bg-white" : "bg-accent-9", C = f ? "bg-white" : "bg-accent-9";
|
|
56
|
-
return /* @__PURE__ */ d("div", { className: "group/vol flex items-center gap-ds-02 shrink-0", children: [
|
|
57
|
-
/* @__PURE__ */ e("button", { onClick: a, className: z("transition-colors", f ? "text-white hover:text-white/80" : "text-surface-fg-muted hover:text-surface-fg"), "aria-label": s ? "Unmute (M)" : "Mute (M)", children: s || r === 0 ? /* @__PURE__ */ e(w, { icon: se, size: "sm" }) : /* @__PURE__ */ e(w, { icon: ie, size: "sm" }) }),
|
|
58
|
-
/* @__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__ */ d(
|
|
59
|
-
"div",
|
|
60
|
-
{
|
|
61
|
-
ref: m,
|
|
62
|
-
className: z("relative w-full h-1 rounded-full cursor-pointer", I),
|
|
63
|
-
onPointerDown: p,
|
|
64
|
-
onPointerMove: k,
|
|
65
|
-
onPointerUp: N,
|
|
66
|
-
role: "slider",
|
|
67
|
-
"aria-label": "Volume",
|
|
68
|
-
"aria-valuenow": Math.round(g * 100),
|
|
69
|
-
"aria-valuemin": 0,
|
|
70
|
-
"aria-valuemax": 100,
|
|
71
|
-
tabIndex: 0,
|
|
72
|
-
children: [
|
|
73
|
-
/* @__PURE__ */ e(
|
|
74
|
-
"div",
|
|
75
|
-
{
|
|
76
|
-
className: z("absolute left-0 top-0 h-full rounded-full transition-[width] duration-75", D),
|
|
77
|
-
style: { width: `${g * 100}%` }
|
|
78
|
-
}
|
|
79
|
-
),
|
|
80
|
-
/* @__PURE__ */ e(
|
|
81
|
-
"div",
|
|
82
|
-
{
|
|
83
|
-
className: z(
|
|
84
|
-
"absolute top-1/2 -translate-y-1/2 h-2.5 w-2.5 rounded-full shadow-raised transition-opacity",
|
|
85
|
-
C,
|
|
86
|
-
b ? "opacity-100 scale-110" : "opacity-0 group-hover/vol:opacity-100"
|
|
87
|
-
),
|
|
88
|
-
style: { left: `${g * 100}%`, marginLeft: "-5px" }
|
|
89
|
-
}
|
|
90
|
-
)
|
|
91
|
-
]
|
|
92
|
-
}
|
|
93
|
-
) })
|
|
94
|
-
] });
|
|
95
|
-
}
|
|
96
|
-
function j(r) {
|
|
97
|
-
if (!isFinite(r) || r < 0) return "0:00";
|
|
98
|
-
const s = Math.floor(r / 3600), t = Math.floor(r % 3600 / 60), a = Math.floor(r % 60);
|
|
99
|
-
return s > 0 ? `${s}:${t.toString().padStart(2, "0")}:${a.toString().padStart(2, "0")}` : `${t}:${a.toString().padStart(2, "0")}`;
|
|
100
|
-
}
|
|
101
|
-
function $({ message: r, url: s }) {
|
|
102
|
-
return /* @__PURE__ */ d("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: [
|
|
103
|
-
/* @__PURE__ */ e(w, { icon: oe, size: "2xl", className: "text-warning-9" }),
|
|
104
|
-
/* @__PURE__ */ d("div", { children: [
|
|
105
|
-
/* @__PURE__ */ e("p", { className: "text-ds-md font-semibold text-surface-fg", children: "Preview unavailable" }),
|
|
106
|
-
/* @__PURE__ */ e("p", { className: "text-ds-sm text-surface-fg-muted mt-ds-01", children: r })
|
|
107
|
-
] }),
|
|
108
|
-
/* @__PURE__ */ e(L, { variant: "outline", size: "xs", startIcon: /* @__PURE__ */ e(w, { icon: W }), asChild: !0, children: /* @__PURE__ */ e("a", { href: s, download: !0, target: "_blank", rel: "noopener noreferrer", children: "Download file" }) })
|
|
109
|
-
] });
|
|
110
|
-
}
|
|
111
|
-
function q({ children: r, className: s }) {
|
|
112
|
-
return /* @__PURE__ */ e(
|
|
113
|
-
A.div,
|
|
114
|
-
{
|
|
115
|
-
initial: { opacity: 0, y: 8 },
|
|
116
|
-
animate: { opacity: 1, y: 0 },
|
|
117
|
-
transition: B.fade,
|
|
118
|
-
className: z(
|
|
119
|
-
"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",
|
|
120
|
-
s
|
|
121
|
-
),
|
|
122
|
-
children: r
|
|
123
|
-
}
|
|
124
|
-
);
|
|
125
|
-
}
|
|
126
|
-
function Z() {
|
|
127
|
-
return /* @__PURE__ */ e("div", { className: "mx-ds-01 h-4 w-px bg-surface-border-subtle" });
|
|
128
|
-
}
|
|
129
|
-
const ue = n.lazy(
|
|
130
|
-
() => import("react-zoom-pan-pinch").then((r) => ({
|
|
131
|
-
default: function({ url: t, alt: a, onError: v }) {
|
|
132
|
-
const { TransformWrapper: m, TransformComponent: b } = r, [h, g] = n.useState(!1), [y, p] = n.useState(!1), [k, N] = n.useState(100), [f, I] = n.useState(!1), D = n.useRef(null), [C, T] = n.useState(!1), x = n.useRef(null);
|
|
133
|
-
return n.useEffect(() => {
|
|
134
|
-
function u(o) {
|
|
135
|
-
const S = D.current;
|
|
136
|
-
if (!S || !S.contains(document.activeElement) && !C) return;
|
|
137
|
-
const P = x.current;
|
|
138
|
-
P && (o.key === "+" || o.key === "=" ? (o.preventDefault(), P.zoomIn()) : o.key === "-" ? (o.preventDefault(), P.zoomOut()) : o.key === "0" ? (o.preventDefault(), P.resetTransform()) : o.key === "f" || o.key === "F" ? (o.preventDefault(), I((i) => !i)) : o.key === "Escape" && f && (o.preventDefault(), I(!1)));
|
|
139
|
-
}
|
|
140
|
-
return document.addEventListener("keydown", u), () => document.removeEventListener("keydown", u);
|
|
141
|
-
}, [C, f]), y ? /* @__PURE__ */ e($, { message: "Could not load image", url: t }) : /* @__PURE__ */ e(
|
|
142
|
-
"div",
|
|
143
|
-
{
|
|
144
|
-
ref: D,
|
|
145
|
-
className: f ? "fixed inset-0 z-50 flex flex-col items-center justify-center bg-black/90 backdrop-blur-sm" : "relative flex flex-col items-center gap-ds-03",
|
|
146
|
-
onMouseEnter: () => T(!0),
|
|
147
|
-
onMouseLeave: () => T(!1),
|
|
148
|
-
tabIndex: -1,
|
|
149
|
-
children: /* @__PURE__ */ e(
|
|
150
|
-
m,
|
|
151
|
-
{
|
|
152
|
-
initialScale: 1,
|
|
153
|
-
minScale: 0.1,
|
|
154
|
-
maxScale: 8,
|
|
155
|
-
centerOnInit: !0,
|
|
156
|
-
doubleClick: { mode: "toggle", step: 2 },
|
|
157
|
-
onTransformed: (u, o) => N(Math.round(o.scale * 100)),
|
|
158
|
-
children: ({ zoomIn: u, zoomOut: o, resetTransform: S, centerView: F }) => (x.current = { zoomIn: u, zoomOut: o, resetTransform: S, centerView: F }, /* @__PURE__ */ d(G, { children: [
|
|
159
|
-
/* @__PURE__ */ d("div", { className: z(
|
|
160
|
-
"overflow-hidden rounded-ds-md bg-surface-sunken",
|
|
161
|
-
f ? "flex-1 w-full" : "max-h-[70vh] max-w-full"
|
|
162
|
-
), children: [
|
|
163
|
-
!h && /* @__PURE__ */ e(V, { className: "h-64 w-full rounded-ds-md" }),
|
|
164
|
-
/* @__PURE__ */ e(
|
|
165
|
-
b,
|
|
166
|
-
{
|
|
167
|
-
wrapperClass: z("!w-full", f && "!h-full"),
|
|
168
|
-
contentClass: "!w-full !flex !items-center !justify-center",
|
|
169
|
-
children: /* @__PURE__ */ e(
|
|
170
|
-
A.img,
|
|
171
|
-
{
|
|
172
|
-
src: t,
|
|
173
|
-
alt: a ?? "",
|
|
174
|
-
onLoad: () => g(!0),
|
|
175
|
-
onError: () => {
|
|
176
|
-
p(!0), v?.("Image failed to load");
|
|
177
|
-
},
|
|
178
|
-
initial: { opacity: 0 },
|
|
179
|
-
animate: { opacity: h ? 1 : 0 },
|
|
180
|
-
transition: B.fade,
|
|
181
|
-
className: z("max-w-full select-none", !h && "hidden", f && "max-h-[90vh] object-contain"),
|
|
182
|
-
draggable: !1
|
|
183
|
-
}
|
|
184
|
-
)
|
|
185
|
-
}
|
|
186
|
-
)
|
|
187
|
-
] }),
|
|
188
|
-
h && /* @__PURE__ */ d(q, { className: f ? "absolute bottom-ds-06" : void 0, children: [
|
|
189
|
-
/* @__PURE__ */ e(L, { variant: "ghost", size: "icon-xs", onClick: () => o(), "aria-label": "Zoom out (-)", children: /* @__PURE__ */ e(w, { icon: Q, size: "sm" }) }),
|
|
190
|
-
/* @__PURE__ */ d("span", { className: "text-ds-xs font-mono text-surface-fg-muted w-12 text-center tabular-nums select-none", children: [
|
|
191
|
-
k,
|
|
192
|
-
"%"
|
|
193
|
-
] }),
|
|
194
|
-
/* @__PURE__ */ e(L, { variant: "ghost", size: "icon-xs", onClick: () => u(), "aria-label": "Zoom in (+)", children: /* @__PURE__ */ e(w, { icon: ee, size: "sm" }) }),
|
|
195
|
-
/* @__PURE__ */ e(Z, {}),
|
|
196
|
-
/* @__PURE__ */ e(L, { variant: "ghost", size: "icon-xs", onClick: () => S(), "aria-label": "Reset zoom (0)", children: /* @__PURE__ */ e(w, { icon: te, size: "sm" }) }),
|
|
197
|
-
/* @__PURE__ */ e(Z, {}),
|
|
198
|
-
/* @__PURE__ */ e(L, { variant: "ghost", size: "icon-xs", onClick: () => I((P) => !P), "aria-label": f ? "Exit fullscreen (Esc)" : "Fullscreen (F)", children: f ? /* @__PURE__ */ e(w, { icon: ne, size: "sm" }) : /* @__PURE__ */ e(w, { icon: O, size: "sm" }) })
|
|
199
|
-
] })
|
|
200
|
-
] }))
|
|
201
|
-
}
|
|
202
|
-
)
|
|
203
|
-
}
|
|
204
|
-
);
|
|
205
|
-
}
|
|
206
|
-
}))
|
|
207
|
-
), de = n.lazy(
|
|
208
|
-
() => import("react-pdf").then((r) => ({
|
|
209
|
-
default: function({ url: t, initialPage: a, onError: v }) {
|
|
210
|
-
const { Document: m, Page: b, pdfjs: h } = r;
|
|
211
|
-
n.useEffect(() => {
|
|
212
|
-
h.GlobalWorkerOptions.workerSrc = `//unpkg.com/pdfjs-dist@${h.version}/build/pdf.worker.min.mjs`;
|
|
213
|
-
}, []);
|
|
214
|
-
const [g, y] = n.useState(0), [p, k] = n.useState(a), [N, f] = n.useState(String(a)), [I, D] = n.useState(!1), C = n.useRef(null), [T, x] = n.useState(!1);
|
|
215
|
-
n.useEffect(() => {
|
|
216
|
-
f(String(p));
|
|
217
|
-
}, [p]), n.useEffect(() => {
|
|
218
|
-
function u(o) {
|
|
219
|
-
const S = C.current;
|
|
220
|
-
!S || !S.contains(document.activeElement) && !T || (o.key === "ArrowRight" || o.key === "ArrowDown" ? (o.preventDefault(), k((P) => Math.min(g, P + 1))) : (o.key === "ArrowLeft" || o.key === "ArrowUp") && (o.preventDefault(), k((P) => Math.max(1, P - 1))));
|
|
221
|
-
}
|
|
222
|
-
return document.addEventListener("keydown", u), () => document.removeEventListener("keydown", u);
|
|
223
|
-
}, [g, T]);
|
|
224
|
-
function E(u) {
|
|
225
|
-
if (u.key === "Enter") {
|
|
226
|
-
const o = parseInt(N, 10);
|
|
227
|
-
o >= 1 && o <= g ? k(o) : f(String(p));
|
|
228
|
-
}
|
|
229
|
-
}
|
|
230
|
-
return I ? /* @__PURE__ */ e($, { message: "Could not load PDF", url: t }) : /* @__PURE__ */ d(
|
|
231
|
-
"div",
|
|
232
|
-
{
|
|
233
|
-
ref: C,
|
|
234
|
-
className: "flex flex-col items-center gap-ds-03",
|
|
235
|
-
onMouseEnter: () => x(!0),
|
|
236
|
-
onMouseLeave: () => x(!1),
|
|
237
|
-
tabIndex: -1,
|
|
238
|
-
children: [
|
|
239
|
-
/* @__PURE__ */ e("div", { className: "overflow-auto max-h-[70vh] rounded-ds-md bg-surface-sunken border border-surface-border", children: /* @__PURE__ */ e(
|
|
240
|
-
m,
|
|
241
|
-
{
|
|
242
|
-
file: t,
|
|
243
|
-
onLoadSuccess: ({ numPages: u }) => y(u),
|
|
244
|
-
onLoadError: () => {
|
|
245
|
-
D(!0), v?.("PDF failed to load");
|
|
246
|
-
},
|
|
247
|
-
loading: /* @__PURE__ */ e(V, { className: "h-[500px] w-[400px]" }),
|
|
248
|
-
error: /* @__PURE__ */ e($, { message: "Failed to load PDF", url: t }),
|
|
249
|
-
children: /* @__PURE__ */ e(H, { mode: "wait", children: /* @__PURE__ */ e(
|
|
250
|
-
A.div,
|
|
251
|
-
{
|
|
252
|
-
initial: { opacity: 0 },
|
|
253
|
-
animate: { opacity: 1 },
|
|
254
|
-
exit: { opacity: 0 },
|
|
255
|
-
transition: B.fade,
|
|
256
|
-
children: /* @__PURE__ */ e(b, { pageNumber: p, renderTextLayer: !1, renderAnnotationLayer: !1 })
|
|
257
|
-
},
|
|
258
|
-
p
|
|
259
|
-
) })
|
|
260
|
-
}
|
|
261
|
-
) }),
|
|
262
|
-
g > 0 && /* @__PURE__ */ d(q, { children: [
|
|
263
|
-
/* @__PURE__ */ e(L, { variant: "ghost", size: "icon-xs", onClick: () => k((u) => Math.max(1, u - 1)), disabled: p <= 1, "aria-label": "Previous page (←)", children: /* @__PURE__ */ e(w, { icon: re, size: "sm" }) }),
|
|
264
|
-
/* @__PURE__ */ d("div", { className: "flex items-center gap-ds-01 text-ds-xs text-surface-fg-muted", children: [
|
|
265
|
-
/* @__PURE__ */ e(
|
|
266
|
-
"input",
|
|
267
|
-
{
|
|
268
|
-
type: "text",
|
|
269
|
-
value: N,
|
|
270
|
-
onChange: (u) => f(u.target.value),
|
|
271
|
-
onKeyDown: E,
|
|
272
|
-
onBlur: () => f(String(p)),
|
|
273
|
-
className: "w-8 bg-transparent text-center font-mono text-surface-fg outline-none focus:bg-surface-raised-hover rounded-ds-sm",
|
|
274
|
-
"aria-label": "Page number"
|
|
275
|
-
}
|
|
276
|
-
),
|
|
277
|
-
/* @__PURE__ */ d("span", { children: [
|
|
278
|
-
"/ ",
|
|
279
|
-
g
|
|
280
|
-
] })
|
|
281
|
-
] }),
|
|
282
|
-
/* @__PURE__ */ e(L, { variant: "ghost", size: "icon-xs", onClick: () => k((u) => Math.min(g, u + 1)), disabled: p >= g, "aria-label": "Next page (→)", children: /* @__PURE__ */ e(w, { icon: ae, size: "sm" }) })
|
|
283
|
-
] })
|
|
284
|
-
]
|
|
285
|
-
}
|
|
286
|
-
);
|
|
287
|
-
}
|
|
288
|
-
}))
|
|
289
|
-
), U = [0.5, 0.75, 1, 1.25, 1.5, 2];
|
|
290
|
-
function fe({ url: r, onError: s }) {
|
|
291
|
-
const t = n.useRef(null), a = n.useRef(null), [v, m] = n.useState(!1), [b, h] = n.useState(0), [g, y] = n.useState(0), [p, k] = n.useState(0), [N, f] = n.useState(!1), [I, D] = n.useState(!1), [C, T] = n.useState(!0), [x, E] = n.useState(1), u = n.useRef(void 0);
|
|
292
|
-
n.useEffect(() => () => clearTimeout(u.current), []), n.useEffect(() => {
|
|
293
|
-
function i(l) {
|
|
294
|
-
const M = a.current;
|
|
295
|
-
if (!M || !M.contains(document.activeElement) && document.activeElement !== M) return;
|
|
296
|
-
const c = t.current;
|
|
297
|
-
if (c)
|
|
298
|
-
switch (l.key) {
|
|
299
|
-
case " ":
|
|
300
|
-
case "k":
|
|
301
|
-
l.preventDefault(), m((R) => (R ? c.pause() : c.play(), !R));
|
|
302
|
-
break;
|
|
303
|
-
case "ArrowRight":
|
|
304
|
-
l.preventDefault(), c.currentTime = Math.min(c.duration, c.currentTime + 5);
|
|
305
|
-
break;
|
|
306
|
-
case "ArrowLeft":
|
|
307
|
-
l.preventDefault(), c.currentTime = Math.max(0, c.currentTime - 5);
|
|
308
|
-
break;
|
|
309
|
-
case "j":
|
|
310
|
-
l.preventDefault(), c.currentTime = Math.max(0, c.currentTime - 10);
|
|
311
|
-
break;
|
|
312
|
-
case "l":
|
|
313
|
-
l.preventDefault(), c.currentTime = Math.min(c.duration, c.currentTime + 10);
|
|
314
|
-
break;
|
|
315
|
-
case "m":
|
|
316
|
-
l.preventDefault(), f((R) => (c.muted = !R, !R));
|
|
317
|
-
break;
|
|
318
|
-
case "f":
|
|
319
|
-
l.preventDefault(), c.requestFullscreen?.();
|
|
320
|
-
break;
|
|
321
|
-
case ">":
|
|
322
|
-
l.preventDefault(), o(1);
|
|
323
|
-
break;
|
|
324
|
-
case "<":
|
|
325
|
-
l.preventDefault(), o(-1);
|
|
326
|
-
break;
|
|
327
|
-
}
|
|
328
|
-
}
|
|
329
|
-
return document.addEventListener("keydown", i), () => document.removeEventListener("keydown", i);
|
|
330
|
-
}, []);
|
|
331
|
-
function o(i) {
|
|
332
|
-
const l = U.indexOf(x), M = Math.max(0, Math.min(U.length - 1, l + i)), c = U[M];
|
|
333
|
-
E(c), t.current && (t.current.playbackRate = c);
|
|
334
|
-
}
|
|
335
|
-
function S() {
|
|
336
|
-
t.current && (v ? t.current.pause() : t.current.play(), m(!v));
|
|
337
|
-
}
|
|
338
|
-
function F(i) {
|
|
339
|
-
if (!t.current || !g) return;
|
|
340
|
-
const l = i.currentTarget.getBoundingClientRect(), M = (i.clientX - l.left) / l.width;
|
|
341
|
-
t.current.currentTime = M * g;
|
|
342
|
-
}
|
|
343
|
-
function P() {
|
|
344
|
-
T(!0), clearTimeout(u.current), v && (u.current = setTimeout(() => T(!1), 3e3));
|
|
345
|
-
}
|
|
346
|
-
return I ? /* @__PURE__ */ e($, { message: "Could not load video", url: r }) : /* @__PURE__ */ d(
|
|
347
|
-
"div",
|
|
348
|
-
{
|
|
349
|
-
ref: a,
|
|
350
|
-
className: "group relative rounded-ds-md bg-black overflow-hidden",
|
|
351
|
-
onMouseMove: P,
|
|
352
|
-
onMouseLeave: () => v && T(!1),
|
|
353
|
-
tabIndex: -1,
|
|
354
|
-
children: [
|
|
355
|
-
/* @__PURE__ */ e(
|
|
356
|
-
"video",
|
|
357
|
-
{
|
|
358
|
-
ref: t,
|
|
359
|
-
src: r,
|
|
360
|
-
className: "max-h-[70vh] w-full",
|
|
361
|
-
onClick: S,
|
|
362
|
-
muted: N,
|
|
363
|
-
onTimeUpdate: () => {
|
|
364
|
-
t.current && (k(t.current.currentTime), t.current.duration && h(t.current.currentTime / t.current.duration * 100));
|
|
365
|
-
},
|
|
366
|
-
onLoadedMetadata: () => y(t.current?.duration ?? 0),
|
|
367
|
-
onEnded: () => {
|
|
368
|
-
m(!1), T(!0);
|
|
369
|
-
},
|
|
370
|
-
onError: () => {
|
|
371
|
-
D(!0), s?.("Video failed to load");
|
|
372
|
-
},
|
|
373
|
-
playsInline: !0
|
|
374
|
-
}
|
|
375
|
-
),
|
|
376
|
-
!v && /* @__PURE__ */ e(
|
|
377
|
-
A.button,
|
|
378
|
-
{
|
|
379
|
-
initial: { opacity: 0, scale: 0.8 },
|
|
380
|
-
animate: { opacity: 1, scale: 1 },
|
|
381
|
-
transition: Y.snappy,
|
|
382
|
-
onClick: S,
|
|
383
|
-
className: "absolute inset-0 flex items-center justify-center bg-black/30",
|
|
384
|
-
"aria-label": "Play video",
|
|
385
|
-
children: /* @__PURE__ */ e("div", { className: "flex h-14 w-14 items-center justify-center rounded-full bg-white/90 shadow-floating", children: /* @__PURE__ */ e(w, { icon: K, size: "xl", className: "text-surface-fg ml-0.5" }) })
|
|
386
|
-
}
|
|
387
|
-
),
|
|
388
|
-
/* @__PURE__ */ e(H, { children: C && g > 0 && /* @__PURE__ */ d(
|
|
389
|
-
A.div,
|
|
390
|
-
{
|
|
391
|
-
initial: { opacity: 0, y: 10 },
|
|
392
|
-
animate: { opacity: 1, y: 0 },
|
|
393
|
-
exit: { opacity: 0, y: 10 },
|
|
394
|
-
transition: B.fade,
|
|
395
|
-
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",
|
|
396
|
-
children: [
|
|
397
|
-
/* @__PURE__ */ d(
|
|
398
|
-
"div",
|
|
399
|
-
{
|
|
400
|
-
className: "relative h-1 w-full cursor-pointer rounded-full bg-white/30 mb-ds-03 group/progress",
|
|
401
|
-
onClick: F,
|
|
402
|
-
role: "slider",
|
|
403
|
-
"aria-label": "Video progress",
|
|
404
|
-
"aria-valuenow": Math.round(b),
|
|
405
|
-
"aria-valuemin": 0,
|
|
406
|
-
"aria-valuemax": 100,
|
|
407
|
-
tabIndex: 0,
|
|
408
|
-
children: [
|
|
409
|
-
/* @__PURE__ */ e(
|
|
410
|
-
"div",
|
|
411
|
-
{
|
|
412
|
-
className: "absolute left-0 top-0 h-full rounded-full bg-white transition-[width] duration-75",
|
|
413
|
-
style: { width: `${b}%` }
|
|
414
|
-
}
|
|
415
|
-
),
|
|
416
|
-
/* @__PURE__ */ e(
|
|
417
|
-
"div",
|
|
418
|
-
{
|
|
419
|
-
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",
|
|
420
|
-
style: { left: `${b}%`, marginLeft: "-6px" }
|
|
421
|
-
}
|
|
422
|
-
)
|
|
423
|
-
]
|
|
424
|
-
}
|
|
425
|
-
),
|
|
426
|
-
/* @__PURE__ */ d("div", { className: "flex items-center gap-ds-03", children: [
|
|
427
|
-
/* @__PURE__ */ e("button", { onClick: S, className: "text-white hover:text-white/80", "aria-label": v ? "Pause" : "Play", children: v ? /* @__PURE__ */ e(w, { icon: _, size: "lg" }) : /* @__PURE__ */ e(w, { icon: K, size: "lg" }) }),
|
|
428
|
-
/* @__PURE__ */ e(
|
|
429
|
-
X,
|
|
430
|
-
{
|
|
431
|
-
volume: N ? 0 : 1,
|
|
432
|
-
muted: N,
|
|
433
|
-
onVolumeChange: (i) => {
|
|
434
|
-
t.current && (t.current.volume = i), i > 0 && N && (f(!1), t.current && (t.current.muted = !1));
|
|
435
|
-
},
|
|
436
|
-
onMuteToggle: () => {
|
|
437
|
-
f(!N), t.current && (t.current.muted = !N);
|
|
438
|
-
},
|
|
439
|
-
variant: "dark"
|
|
440
|
-
}
|
|
441
|
-
),
|
|
442
|
-
/* @__PURE__ */ d("span", { className: "text-[11px] font-mono text-white/70 tabular-nums", children: [
|
|
443
|
-
j(p),
|
|
444
|
-
" / ",
|
|
445
|
-
j(g)
|
|
446
|
-
] }),
|
|
447
|
-
/* @__PURE__ */ e("div", { className: "flex-1" }),
|
|
448
|
-
/* @__PURE__ */ d(
|
|
449
|
-
"button",
|
|
450
|
-
{
|
|
451
|
-
onClick: () => o(1),
|
|
452
|
-
className: "text-[11px] font-mono text-white/70 hover:text-white px-1 rounded-ds-sm hover:bg-white/10 transition-colors",
|
|
453
|
-
"aria-label": `Playback speed: ${x}x`,
|
|
454
|
-
children: [
|
|
455
|
-
x,
|
|
456
|
-
"x"
|
|
457
|
-
]
|
|
458
|
-
}
|
|
459
|
-
),
|
|
460
|
-
/* @__PURE__ */ e(
|
|
461
|
-
"button",
|
|
462
|
-
{
|
|
463
|
-
onClick: () => t.current?.requestFullscreen?.(),
|
|
464
|
-
className: "text-white hover:text-white/80",
|
|
465
|
-
"aria-label": "Fullscreen (F)",
|
|
466
|
-
children: /* @__PURE__ */ e(w, { icon: O, size: "sm" })
|
|
467
|
-
}
|
|
468
|
-
)
|
|
469
|
-
] })
|
|
470
|
-
]
|
|
471
|
-
}
|
|
472
|
-
) })
|
|
473
|
-
]
|
|
474
|
-
}
|
|
475
|
-
);
|
|
476
|
-
}
|
|
477
|
-
function me({ url: r, fileName: s, onError: t }) {
|
|
478
|
-
const a = n.useRef(null), v = n.useRef(null), [m, b] = n.useState(!1), [h, g] = n.useState(0), [y, p] = n.useState(0), [k, N] = n.useState(0), [f, I] = n.useState(1), [D, C] = n.useState(!1), [T, x] = n.useState(!1), [E, u] = n.useState(null);
|
|
479
|
-
n.useEffect(() => {
|
|
480
|
-
function i(l) {
|
|
481
|
-
const M = v.current;
|
|
482
|
-
if (!M || !M.contains(document.activeElement) && document.activeElement !== M) return;
|
|
483
|
-
const c = a.current;
|
|
484
|
-
if (c)
|
|
485
|
-
switch (l.key) {
|
|
486
|
-
case " ":
|
|
487
|
-
l.preventDefault(), b((R) => (R ? c.pause() : c.play(), !R));
|
|
488
|
-
break;
|
|
489
|
-
case "ArrowRight":
|
|
490
|
-
l.preventDefault(), c.currentTime = Math.min(c.duration || 0, c.currentTime + 5);
|
|
491
|
-
break;
|
|
492
|
-
case "ArrowLeft":
|
|
493
|
-
l.preventDefault(), c.currentTime = Math.max(0, c.currentTime - 5);
|
|
494
|
-
break;
|
|
495
|
-
case "m":
|
|
496
|
-
l.preventDefault(), C((R) => (c.muted = !R, !R));
|
|
497
|
-
break;
|
|
498
|
-
}
|
|
499
|
-
}
|
|
500
|
-
return document.addEventListener("keydown", i), () => document.removeEventListener("keydown", i);
|
|
501
|
-
}, []);
|
|
502
|
-
function o() {
|
|
503
|
-
a.current && (m ? a.current.pause() : a.current.play(), b(!m));
|
|
504
|
-
}
|
|
505
|
-
function S(i) {
|
|
506
|
-
if (!a.current || !y) return;
|
|
507
|
-
const l = i.currentTarget.getBoundingClientRect(), M = Math.max(0, Math.min(1, (i.clientX - l.left) / l.width));
|
|
508
|
-
a.current.currentTime = M * y;
|
|
509
|
-
}
|
|
510
|
-
function F(i) {
|
|
511
|
-
if (!y) return;
|
|
512
|
-
const l = i.currentTarget.getBoundingClientRect(), M = (i.clientX - l.left) / l.width;
|
|
513
|
-
u(M * y);
|
|
514
|
-
}
|
|
515
|
-
function P() {
|
|
516
|
-
if (!a.current) return;
|
|
517
|
-
const i = !D;
|
|
518
|
-
C(i), a.current.muted = i;
|
|
519
|
-
}
|
|
520
|
-
return T ? /* @__PURE__ */ e($, { message: "Could not load audio", url: r }) : /* @__PURE__ */ d("div", { ref: v, className: "rounded-ds-lg border border-surface-border bg-surface-raised shadow-raised overflow-hidden", tabIndex: -1, children: [
|
|
521
|
-
/* @__PURE__ */ e(
|
|
522
|
-
"audio",
|
|
523
|
-
{
|
|
524
|
-
ref: a,
|
|
525
|
-
src: r,
|
|
526
|
-
onTimeUpdate: () => {
|
|
527
|
-
a.current && (N(a.current.currentTime), a.current.duration && g(a.current.currentTime / a.current.duration * 100));
|
|
528
|
-
},
|
|
529
|
-
onLoadedMetadata: () => p(a.current?.duration ?? 0),
|
|
530
|
-
onEnded: () => b(!1),
|
|
531
|
-
onError: () => {
|
|
532
|
-
x(!0), t?.("Audio failed to load");
|
|
533
|
-
}
|
|
534
|
-
}
|
|
535
|
-
),
|
|
536
|
-
/* @__PURE__ */ d(
|
|
537
|
-
"div",
|
|
538
|
-
{
|
|
539
|
-
className: "relative h-1 w-full cursor-pointer bg-surface-sunken group/bar",
|
|
540
|
-
onClick: S,
|
|
541
|
-
onMouseMove: F,
|
|
542
|
-
onMouseLeave: () => u(null),
|
|
543
|
-
role: "slider",
|
|
544
|
-
"aria-label": "Audio progress",
|
|
545
|
-
"aria-valuenow": Math.round(h),
|
|
546
|
-
"aria-valuemin": 0,
|
|
547
|
-
"aria-valuemax": 100,
|
|
548
|
-
tabIndex: 0,
|
|
549
|
-
children: [
|
|
550
|
-
/* @__PURE__ */ e(
|
|
551
|
-
"div",
|
|
552
|
-
{
|
|
553
|
-
className: "absolute left-0 top-0 h-full bg-accent-9 transition-[width] duration-75",
|
|
554
|
-
style: { width: `${h}%` }
|
|
555
|
-
}
|
|
556
|
-
),
|
|
557
|
-
E !== null && /* @__PURE__ */ e(
|
|
558
|
-
"div",
|
|
559
|
-
{
|
|
560
|
-
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",
|
|
561
|
-
style: { left: `${E / (y || 1) * 100}%` },
|
|
562
|
-
children: j(E)
|
|
563
|
-
}
|
|
564
|
-
),
|
|
565
|
-
/* @__PURE__ */ e(
|
|
566
|
-
"div",
|
|
567
|
-
{
|
|
568
|
-
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",
|
|
569
|
-
style: { left: `${h}%`, marginLeft: "-5px" }
|
|
570
|
-
}
|
|
571
|
-
)
|
|
572
|
-
]
|
|
573
|
-
}
|
|
574
|
-
),
|
|
575
|
-
/* @__PURE__ */ d("div", { className: "flex items-center gap-ds-04 px-ds-05 py-ds-04", children: [
|
|
576
|
-
/* @__PURE__ */ e(
|
|
577
|
-
L,
|
|
578
|
-
{
|
|
579
|
-
variant: "solid",
|
|
580
|
-
size: "icon-sm",
|
|
581
|
-
onClick: o,
|
|
582
|
-
"aria-label": m ? "Pause" : "Play",
|
|
583
|
-
className: "shrink-0",
|
|
584
|
-
children: m ? /* @__PURE__ */ e(w, { icon: _, size: "sm" }) : /* @__PURE__ */ e(w, { icon: K, size: "sm", className: "ml-0.5" })
|
|
585
|
-
}
|
|
586
|
-
),
|
|
587
|
-
/* @__PURE__ */ d("div", { className: "flex-1 min-w-0", children: [
|
|
588
|
-
s && /* @__PURE__ */ e("p", { className: "text-ds-sm font-semibold text-surface-fg truncate", children: s }),
|
|
589
|
-
/* @__PURE__ */ d("p", { className: "text-ds-xs font-mono text-surface-fg-muted tabular-nums", children: [
|
|
590
|
-
j(k),
|
|
591
|
-
" / ",
|
|
592
|
-
j(y)
|
|
593
|
-
] })
|
|
594
|
-
] }),
|
|
595
|
-
/* @__PURE__ */ e(
|
|
596
|
-
X,
|
|
597
|
-
{
|
|
598
|
-
volume: f,
|
|
599
|
-
muted: D,
|
|
600
|
-
onVolumeChange: (i) => {
|
|
601
|
-
I(i), a.current && (a.current.volume = i), i > 0 && D && (C(!1), a.current && (a.current.muted = !1));
|
|
602
|
-
},
|
|
603
|
-
onMuteToggle: P,
|
|
604
|
-
variant: "light"
|
|
605
|
-
}
|
|
606
|
-
)
|
|
607
|
-
] })
|
|
608
|
-
] });
|
|
609
|
-
}
|
|
610
|
-
function he({ url: r, onError: s }) {
|
|
611
|
-
const [t, a] = n.useState(!1), [v, m] = n.useState(!1), b = le(r);
|
|
612
|
-
return n.useEffect(() => {
|
|
613
|
-
const h = setTimeout(() => {
|
|
614
|
-
t || (m(!0), s?.("Embed timed out"));
|
|
615
|
-
}, 15e3);
|
|
616
|
-
return () => clearTimeout(h);
|
|
617
|
-
}, [t, s]), v ? /* @__PURE__ */ e($, { message: "Could not load embed", url: r }) : /* @__PURE__ */ d("div", { className: "relative w-full rounded-ds-md overflow-hidden", style: { aspectRatio: "16 / 9" }, children: [
|
|
618
|
-
!t && /* @__PURE__ */ e(V, { className: "absolute inset-0" }),
|
|
619
|
-
/* @__PURE__ */ e(
|
|
620
|
-
A.iframe,
|
|
621
|
-
{
|
|
622
|
-
src: b,
|
|
623
|
-
title: "Embedded content",
|
|
624
|
-
onLoad: () => a(!0),
|
|
625
|
-
onError: () => {
|
|
626
|
-
m(!0), s?.("Embed failed to load");
|
|
627
|
-
},
|
|
628
|
-
initial: { opacity: 0 },
|
|
629
|
-
animate: { opacity: t ? 1 : 0 },
|
|
630
|
-
transition: B.fade,
|
|
631
|
-
className: "absolute inset-0 h-full w-full border-none",
|
|
632
|
-
allowFullScreen: !0
|
|
633
|
-
}
|
|
634
|
-
)
|
|
635
|
-
] });
|
|
636
|
-
}
|
|
637
|
-
function Me({
|
|
638
|
-
url: r,
|
|
639
|
-
type: s,
|
|
640
|
-
mimeType: t,
|
|
641
|
-
alt: a,
|
|
642
|
-
initialPage: v = 1,
|
|
643
|
-
fileName: m,
|
|
644
|
-
fileSize: b,
|
|
645
|
-
onError: h,
|
|
646
|
-
className: g,
|
|
647
|
-
...y
|
|
648
|
-
}) {
|
|
649
|
-
const p = s ?? ce(r, t), k = /* @__PURE__ */ e(V, { className: "h-64 w-full rounded-ds-md" });
|
|
650
|
-
return /* @__PURE__ */ d("div", { className: z("flex flex-col gap-ds-03", g), ...y, children: [
|
|
651
|
-
(m || b) && /* @__PURE__ */ d("div", { className: "flex items-center gap-ds-03", children: [
|
|
652
|
-
m && /* @__PURE__ */ e("span", { className: "text-ds-sm font-semibold text-surface-fg truncate", children: m }),
|
|
653
|
-
b && /* @__PURE__ */ e(J, { variant: "subtle", size: "xs", children: b })
|
|
654
|
-
] }),
|
|
655
|
-
p === "image" && /* @__PURE__ */ e(n.Suspense, { fallback: k, children: /* @__PURE__ */ e(ue, { url: r, alt: a, onError: h }) }),
|
|
656
|
-
p === "pdf" && /* @__PURE__ */ e(n.Suspense, { fallback: k, children: /* @__PURE__ */ e(de, { url: r, initialPage: v, onError: h }) }),
|
|
657
|
-
p === "video" && /* @__PURE__ */ e(fe, { url: r, onError: h }),
|
|
658
|
-
p === "audio" && /* @__PURE__ */ e(me, { url: r, fileName: m, onError: h }),
|
|
659
|
-
p === "embed" && /* @__PURE__ */ e(he, { url: r, onError: h }),
|
|
660
|
-
p !== "audio" && /* @__PURE__ */ e("div", { className: "flex justify-end", children: /* @__PURE__ */ e(L, { variant: "ghost", size: "xs", startIcon: /* @__PURE__ */ e(w, { icon: W }), asChild: !0, children: /* @__PURE__ */ e("a", { href: r, download: !0, target: "_blank", rel: "noopener noreferrer", children: "Download" }) }) })
|
|
661
|
-
] });
|
|
662
|
-
}
|
|
2
|
+
import "react/jsx-runtime";
|
|
3
|
+
import "react";
|
|
4
|
+
import "../ui/lib/utils.js";
|
|
5
|
+
import "../ui/skeleton.js";
|
|
6
|
+
import "../ui/button.js";
|
|
7
|
+
import "../ui/icon.js";
|
|
8
|
+
import "../_chunks/badge-group.js";
|
|
9
|
+
import "@tabler/icons-react";
|
|
10
|
+
import { F as l } from "../_chunks/file-preview.js";
|
|
663
11
|
export {
|
|
664
|
-
|
|
12
|
+
l as FilePreview
|
|
665
13
|
};
|