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