@virtualansoftware/vs-office-viewer 1.0.1 → 1.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (33) hide show
  1. package/dist/client/assets/DocxViewer-BcXhLJfm.css +1 -0
  2. package/dist/client/assets/DocxViewer-CPMpeQTq.js +58 -0
  3. package/dist/client/assets/LogoIcon-CTf12WP0.js +1 -0
  4. package/dist/client/assets/PptxViewer-Bvr-20MJ.js +59 -0
  5. package/dist/client/assets/PptxViewer-Cn8CqLfg.css +1 -0
  6. package/dist/client/assets/XlsxViewer-CGc0vtBk.js +63 -0
  7. package/dist/client/assets/XlsxViewer-DTxE-neD.css +1 -0
  8. package/dist/client/assets/chevron-right-D0jHq8Hg.js +1 -0
  9. package/dist/client/assets/form-KvBV47dq.js +1 -0
  10. package/dist/client/assets/index-DATp3RB-.js +12 -0
  11. package/dist/client/assets/jszip.min-DhiFe-R7.js +2 -0
  12. package/dist/client/assets/login-aBY8Ktaw.js +1 -0
  13. package/dist/client/assets/register-BB43pNvY.js +1 -0
  14. package/dist/client/assets/rolldown-runtime-aKtaBQYM.js +1 -0
  15. package/dist/client/assets/routes-1JmKig5J.js +2 -0
  16. package/dist/client/assets/styles-F8oSmVJa.css +2 -0
  17. package/dist/client/robots.txt +2 -0
  18. package/dist/server/assets/DocxViewer-Bvu47Jxr.js +544 -0
  19. package/dist/server/assets/LogoIcon-D2qIWtkU.js +93 -0
  20. package/dist/server/assets/PptxViewer-CjRu82CL.js +209 -0
  21. package/dist/server/assets/XlsxViewer-CtBSfYb7.js +870 -0
  22. package/dist/server/assets/_tanstack-start-manifest_v-CQ5gmg8o.js +43 -0
  23. package/dist/server/assets/createMiddleware-BnSPczhK.js +24 -0
  24. package/dist/server/assets/empty-plugin-adapters-D9UWiqvJ.js +5 -0
  25. package/dist/server/assets/form-DY0gQsTv.js +249 -0
  26. package/dist/server/assets/login-hnUq0LLL.js +122 -0
  27. package/dist/server/assets/register-DIFjHkZS.js +164 -0
  28. package/dist/server/assets/router-CJA4LnAB.js +281 -0
  29. package/dist/server/assets/routes-DT9ZAw-E.js +481 -0
  30. package/dist/server/assets/server-vIOK9n3w.js +1595 -0
  31. package/dist/server/assets/start-RYa-0bjt.js +43 -0
  32. package/dist/server/server.js +86 -0
  33. package/package.json +7 -6
@@ -0,0 +1,481 @@
1
+ import { t as LogoIcon } from "./LogoIcon-D2qIWtkU.js";
2
+ import { Suspense, lazy, useCallback, useEffect, useRef, useState } from "react";
3
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
4
+ import { AlertCircle, ChevronDown, FileText, FileWarning, Loader2, Presentation, Sheet, UploadCloud, X } from "lucide-react";
5
+ //#region src/components/FileDropzone.tsx
6
+ function FileDropzone({ onFile, config }) {
7
+ const inputRef = useRef(null);
8
+ const [dragging, setDragging] = useState(false);
9
+ const [wrongType, setWrongType] = useState(false);
10
+ const handleFiles = useCallback((files) => {
11
+ const file = files?.[0];
12
+ if (!file) return;
13
+ const ext = "." + (file.name.split(".").pop()?.toLowerCase() ?? "");
14
+ if (!config.accept.split(",").map((s) => s.trim()).includes(ext)) {
15
+ setWrongType(true);
16
+ setTimeout(() => setWrongType(false), 3e3);
17
+ return;
18
+ }
19
+ onFile(file);
20
+ }, [onFile, config.accept]);
21
+ const { icon: Icon, iconStyle, heading, description, dropHint, subtitle } = config;
22
+ return /* @__PURE__ */ jsxs("div", {
23
+ className: "mx-auto flex w-full max-w-2xl flex-col items-center px-6",
24
+ children: [
25
+ /* @__PURE__ */ jsx("div", {
26
+ className: "mb-8",
27
+ children: /* @__PURE__ */ jsx("div", {
28
+ className: "flex h-18 w-18 items-center justify-center rounded-2xl",
29
+ style: iconStyle,
30
+ children: /* @__PURE__ */ jsx(Icon, {
31
+ className: "h-9 w-9 text-white",
32
+ strokeWidth: 1.5
33
+ })
34
+ })
35
+ }),
36
+ /* @__PURE__ */ jsx("h1", {
37
+ className: "text-center text-3xl font-bold tracking-tight text-foreground sm:text-4xl",
38
+ children: heading
39
+ }),
40
+ /* @__PURE__ */ jsx("p", {
41
+ className: "mt-3 max-w-md text-center text-muted-foreground",
42
+ children: description
43
+ }),
44
+ /* @__PURE__ */ jsxs("button", {
45
+ type: "button",
46
+ onClick: () => inputRef.current?.click(),
47
+ onDragOver: (e) => {
48
+ e.preventDefault();
49
+ setDragging(true);
50
+ },
51
+ onDragLeave: () => setDragging(false),
52
+ onDrop: (e) => {
53
+ e.preventDefault();
54
+ setDragging(false);
55
+ handleFiles(e.dataTransfer.files);
56
+ },
57
+ className: `mt-10 flex w-full flex-col items-center justify-center gap-4 rounded-2xl border-2 border-dashed px-8 py-16 text-center transition-colors ${wrongType ? "border-red-300 bg-red-50/70" : dragging ? "border-primary bg-accent" : "border-page-border bg-page hover:border-primary/50"}`,
58
+ children: [wrongType ? /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(AlertCircle, { className: "h-10 w-10 text-red-400" }), /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("p", {
59
+ className: "font-medium text-red-600",
60
+ children: "Wrong file type"
61
+ }), /* @__PURE__ */ jsxs("p", {
62
+ className: "mt-1 text-sm text-red-400",
63
+ children: [
64
+ "This section only accepts ",
65
+ config.accept,
66
+ " files"
67
+ ]
68
+ })] })] }) : /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(UploadCloud, { className: "h-10 w-10 text-muted-foreground" }), /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("p", {
69
+ className: "font-medium text-foreground",
70
+ children: dropHint
71
+ }), /* @__PURE__ */ jsx("p", {
72
+ className: "mt-1 text-sm text-muted-foreground",
73
+ children: subtitle
74
+ })] })] }), /* @__PURE__ */ jsx("input", {
75
+ ref: inputRef,
76
+ type: "file",
77
+ accept: config.accept,
78
+ className: "hidden",
79
+ onChange: (e) => handleFiles(e.target.files)
80
+ })]
81
+ })
82
+ ]
83
+ });
84
+ }
85
+ //#endregion
86
+ //#region src/routes/index.tsx?tsr-split=component
87
+ var DocxViewer = lazy(() => import("./DocxViewer-Bvu47Jxr.js").then((m) => ({ default: m.DocxViewer })));
88
+ var XlsxViewer = lazy(() => import("./XlsxViewer-CtBSfYb7.js").then((m) => ({ default: m.XlsxViewer })));
89
+ var PptxViewer = lazy(() => import("./PptxViewer-CjRu82CL.js").then((m) => ({ default: m.PptxViewer })));
90
+ function detectKind(name) {
91
+ const ext = name.split(".").pop()?.toLowerCase();
92
+ if (ext === "docx") return "docx";
93
+ if (ext === "xlsx") return "xlsx";
94
+ if (ext === "pptx") return "pptx";
95
+ return "unsupported";
96
+ }
97
+ var KIND_META = {
98
+ docx: {
99
+ label: "Word Document",
100
+ icon: FileText,
101
+ cls: "bg-word text-word-foreground"
102
+ },
103
+ xlsx: {
104
+ label: "Excel Spreadsheet",
105
+ icon: Sheet,
106
+ cls: "bg-excel text-excel-foreground"
107
+ },
108
+ pptx: {
109
+ label: "PowerPoint Presentation",
110
+ icon: Presentation,
111
+ cls: "bg-powerpoint text-powerpoint-foreground"
112
+ }
113
+ };
114
+ var navItems = [
115
+ {
116
+ id: "docs",
117
+ label: "Docs Viewer",
118
+ icon: FileText,
119
+ color: "text-slate-400",
120
+ activeColor: "text-blue-600",
121
+ accentColor: "bg-blue-600",
122
+ activeBg: "bg-blue-50"
123
+ },
124
+ {
125
+ id: "excel",
126
+ label: "Excel Viewer",
127
+ icon: Sheet,
128
+ color: "text-slate-400",
129
+ activeColor: "text-emerald-600",
130
+ accentColor: "bg-emerald-500",
131
+ activeBg: "bg-emerald-50"
132
+ },
133
+ {
134
+ id: "ppt",
135
+ label: "PPT Viewer",
136
+ icon: Presentation,
137
+ color: "text-slate-400",
138
+ activeColor: "text-orange-500",
139
+ accentColor: "bg-orange-400",
140
+ activeBg: "bg-orange-50"
141
+ }
142
+ ];
143
+ var kindToView = {
144
+ docx: "docs",
145
+ xlsx: "excel",
146
+ pptx: "ppt"
147
+ };
148
+ var VIEW_CONFIG = {
149
+ docs: {
150
+ accept: ".docx",
151
+ icon: FileText,
152
+ iconStyle: {
153
+ background: "linear-gradient(145deg, #1e40af 0%, #2563eb 55%, #93c5fd 100%)",
154
+ boxShadow: "0 0 0 1px rgba(37,99,235,0.18), inset 0 1px 0 rgba(255,255,255,0.18), 0 4px 20px rgba(37,99,235,0.38)"
155
+ },
156
+ heading: "Word Document Viewer",
157
+ description: "Open Word documents directly in your browser — text, tables, images and charts rendered locally. Nothing leaves your device.",
158
+ dropHint: "Drop your .docx file here, or click to browse",
159
+ subtitle: "Accepts .docx files only"
160
+ },
161
+ excel: {
162
+ accept: ".xlsx",
163
+ icon: Sheet,
164
+ iconStyle: {
165
+ background: "linear-gradient(145deg, #166534 0%, #16a34a 55%, #86efac 100%)",
166
+ boxShadow: "0 0 0 1px rgba(22,163,74,0.18), inset 0 1px 0 rgba(255,255,255,0.18), 0 4px 20px rgba(22,163,74,0.38)"
167
+ },
168
+ heading: "Excel Spreadsheet Viewer",
169
+ description: "Open Excel spreadsheets directly in your browser — cell styles, merged cells and formulas rendered locally. Nothing leaves your device.",
170
+ dropHint: "Drop your .xlsx file here, or click to browse",
171
+ subtitle: "Accepts .xlsx files only"
172
+ },
173
+ ppt: {
174
+ accept: ".pptx",
175
+ icon: Presentation,
176
+ iconStyle: {
177
+ background: "linear-gradient(145deg, #9a3412 0%, #ea580c 55%, #fdba74 100%)",
178
+ boxShadow: "0 0 0 1px rgba(234,88,12,0.18), inset 0 1px 0 rgba(255,255,255,0.18), 0 4px 20px rgba(234,88,12,0.38)"
179
+ },
180
+ heading: "PowerPoint Viewer",
181
+ description: "Open PowerPoint presentations directly in your browser — all slides, layouts and charts rendered locally. Nothing leaves your device.",
182
+ dropHint: "Drop your .pptx file here, or click to browse",
183
+ subtitle: "Accepts .pptx files only"
184
+ }
185
+ };
186
+ var SIDEBAR_COLLAPSED = 72;
187
+ var SIDEBAR_EXPANDED = 264;
188
+ var ICON_INSET = 24;
189
+ var EASE = "cubic-bezier(0.4, 0, 0.2, 1)";
190
+ var SIDEBAR_TR = `width 300ms ${EASE}, box-shadow 300ms ${EASE}`;
191
+ var LABEL_TR = "opacity 180ms ease, max-width 300ms ease, margin-left 280ms ease";
192
+ function Index() {
193
+ const [doc, setDoc] = useState(null);
194
+ const [mounted, setMounted] = useState(false);
195
+ const [activeView, setActiveView] = useState("docs");
196
+ const [expanded, setExpanded] = useState(false);
197
+ const [pptMode, setPptMode] = useState("scroll");
198
+ const [docMode, setDocMode] = useState("scroll");
199
+ useEffect(() => setMounted(true), []);
200
+ const openFile = async (file) => {
201
+ const data = await file.arrayBuffer();
202
+ const kind = detectKind(file.name);
203
+ setDoc({
204
+ name: file.name,
205
+ kind,
206
+ data
207
+ });
208
+ if (kind !== "unsupported") setActiveView(kindToView[kind]);
209
+ };
210
+ const closeDoc = () => setDoc(null);
211
+ const meta = doc && doc.kind !== "unsupported" ? KIND_META[doc.kind] : null;
212
+ const DocIcon = meta?.icon ?? FileWarning;
213
+ const sidebarW = expanded ? SIDEBAR_EXPANDED : SIDEBAR_COLLAPSED;
214
+ return /* @__PURE__ */ jsxs("div", {
215
+ className: "flex h-screen flex-col bg-slate-50",
216
+ children: [/* @__PURE__ */ jsxs("header", {
217
+ className: "fixed inset-x-0 top-0 z-30 flex h-[72px] items-center justify-between border-b border-slate-200/70 bg-white px-8",
218
+ style: { boxShadow: "0 1px 4px 0 rgba(15,23,42,0.07)" },
219
+ children: [/* @__PURE__ */ jsxs("div", {
220
+ className: "flex items-center gap-3.5",
221
+ children: [/* @__PURE__ */ jsx("div", {
222
+ className: "flex h-[48px] w-[48px] shrink-0 items-center justify-center rounded-[14px]",
223
+ style: {
224
+ backgroundColor: "#2563eb",
225
+ boxShadow: "0 0 0 1px rgba(37,99,235,0.22), inset 0 1px 0 rgba(255,255,255,0.15), 0 6px 22px 0 rgba(37,99,235,0.30)"
226
+ },
227
+ children: /* @__PURE__ */ jsx(LogoIcon, { size: 24 })
228
+ }), /* @__PURE__ */ jsxs("div", {
229
+ className: "flex select-none flex-col justify-center",
230
+ style: { gap: 1 },
231
+ children: [/* @__PURE__ */ jsx("span", {
232
+ className: "text-[11px] font-semibold uppercase tracking-[0.22em] text-blue-600",
233
+ children: "Office"
234
+ }), /* @__PURE__ */ jsx("span", {
235
+ className: "text-[24px] font-bold leading-none tracking-[-0.03em] text-slate-900",
236
+ children: "Viewer"
237
+ })]
238
+ })]
239
+ }), (activeView === "ppt" || activeView === "docs" || doc) && /* @__PURE__ */ jsxs("div", {
240
+ className: "flex items-center gap-3",
241
+ children: [
242
+ activeView === "docs" && /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("span", {
243
+ className: "select-none text-[12.5px] font-medium text-slate-400",
244
+ children: "View Mode"
245
+ }), /* @__PURE__ */ jsxs("div", {
246
+ className: "relative",
247
+ children: [/* @__PURE__ */ jsxs("select", {
248
+ value: docMode,
249
+ onChange: (e) => setDocMode(e.target.value),
250
+ className: "appearance-none cursor-pointer rounded-lg border border-slate-200 bg-white py-2 pl-3.5 pr-8 text-[13px] font-medium text-slate-700 shadow-sm transition-colors hover:border-slate-300 focus:border-blue-400 focus:outline-none focus:ring-2 focus:ring-blue-400/20",
251
+ children: [/* @__PURE__ */ jsx("option", {
252
+ value: "scroll",
253
+ children: "Continuous Scroll"
254
+ }), /* @__PURE__ */ jsx("option", {
255
+ value: "navigation",
256
+ children: "Page Navigation"
257
+ })]
258
+ }), /* @__PURE__ */ jsx(ChevronDown, { className: "pointer-events-none absolute right-2.5 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-slate-400" })]
259
+ })] }),
260
+ activeView === "ppt" && /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("span", {
261
+ className: "select-none text-[12.5px] font-medium text-slate-400",
262
+ children: "View Mode"
263
+ }), /* @__PURE__ */ jsxs("div", {
264
+ className: "relative",
265
+ children: [/* @__PURE__ */ jsxs("select", {
266
+ value: pptMode,
267
+ onChange: (e) => setPptMode(e.target.value),
268
+ className: "appearance-none cursor-pointer rounded-lg border border-slate-200 bg-white py-2 pl-3.5 pr-8 text-[13px] font-medium text-slate-700 shadow-sm transition-colors hover:border-slate-300 focus:border-blue-400 focus:outline-none focus:ring-2 focus:ring-blue-400/20",
269
+ children: [/* @__PURE__ */ jsx("option", {
270
+ value: "scroll",
271
+ children: "Vertical Scroll"
272
+ }), /* @__PURE__ */ jsx("option", {
273
+ value: "navigation",
274
+ children: "Slide Navigation"
275
+ })]
276
+ }), /* @__PURE__ */ jsx(ChevronDown, { className: "pointer-events-none absolute right-2.5 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-slate-400" })]
277
+ })] }),
278
+ (activeView === "ppt" || activeView === "docs") && doc && /* @__PURE__ */ jsx("div", { className: "h-5 w-px shrink-0 bg-slate-200" }),
279
+ doc && /* @__PURE__ */ jsxs(Fragment, { children: [
280
+ /* @__PURE__ */ jsx("span", {
281
+ className: `flex h-8.5 w-8.5 shrink-0 items-center justify-center rounded-xl ${meta?.cls ?? "bg-slate-100 text-slate-500"}`,
282
+ children: /* @__PURE__ */ jsx(DocIcon, { className: "h-4.25 w-4.25" })
283
+ }),
284
+ /* @__PURE__ */ jsx("span", {
285
+ className: "max-w-90 truncate text-[14px] font-medium text-slate-600",
286
+ children: doc.name
287
+ }),
288
+ /* @__PURE__ */ jsx("div", { className: "mx-1 h-5 w-px shrink-0 bg-slate-200" }),
289
+ /* @__PURE__ */ jsxs("button", {
290
+ onClick: closeDoc,
291
+ className: "inline-flex items-center gap-1.5 rounded-xl border border-slate-200 bg-white px-4 py-1.75 text-[13.5px] font-medium text-slate-600 transition-all duration-150 hover:border-slate-300 hover:bg-slate-50 hover:text-slate-900",
292
+ children: [/* @__PURE__ */ jsx(X, { className: "h-3.5 w-3.5" }), "Close file"]
293
+ })
294
+ ] })
295
+ ]
296
+ })]
297
+ }), /* @__PURE__ */ jsxs("div", {
298
+ className: "flex flex-1 overflow-hidden pt-[72px]",
299
+ children: [/* @__PURE__ */ jsxs("aside", {
300
+ onMouseEnter: () => setExpanded(true),
301
+ onMouseLeave: () => setExpanded(false),
302
+ style: {
303
+ width: sidebarW,
304
+ transition: SIDEBAR_TR,
305
+ boxShadow: expanded ? "3px 0 28px 0 rgba(15,23,42,0.11)" : "3px 0 0 0 rgba(15,23,42,0)"
306
+ },
307
+ className: "fixed bottom-0 left-0 top-[72px] z-[25] flex flex-col overflow-hidden border-r border-slate-200/70 bg-white",
308
+ children: [
309
+ /* @__PURE__ */ jsx("div", {
310
+ className: "shrink-0 px-3 pb-2 pt-8",
311
+ style: { minHeight: 52 },
312
+ children: /* @__PURE__ */ jsx("p", {
313
+ className: "select-none whitespace-nowrap pl-0.75 text-[10.5px] font-semibold uppercase tracking-[0.11em] text-slate-400",
314
+ style: {
315
+ opacity: expanded ? 1 : 0,
316
+ transition: "opacity 200ms ease"
317
+ },
318
+ children: "Viewers"
319
+ })
320
+ }),
321
+ /* @__PURE__ */ jsx("nav", {
322
+ className: "flex flex-col gap-1",
323
+ children: navItems.map(({ id, label, icon: Icon, color, activeColor, accentColor, activeBg }) => {
324
+ const isActive = activeView === id;
325
+ const chipBg = isActive ? activeBg : !expanded ? "group-hover:bg-slate-100" : "";
326
+ return /* @__PURE__ */ jsxs("div", {
327
+ className: "group relative",
328
+ children: [
329
+ isActive && /* @__PURE__ */ jsx("div", { className: `absolute bottom-1.5 left-0 top-1.5 w-0.5 rounded-r-full ${accentColor}` }),
330
+ /* @__PURE__ */ jsxs("button", {
331
+ onClick: () => {
332
+ setActiveView(id);
333
+ if (doc && doc.kind !== "unsupported" && kindToView[doc.kind] !== id) closeDoc();
334
+ },
335
+ style: {
336
+ paddingLeft: expanded ? ICON_INSET : (SIDEBAR_COLLAPSED - 40) / 2,
337
+ paddingRight: expanded ? 8 : (SIDEBAR_COLLAPSED - 40) / 2
338
+ },
339
+ className: `relative flex w-full items-center rounded-md transition-colors duration-150 ${expanded ? "py-3.5" : "py-3"} ${isActive ? activeColor : `${color} hover:text-slate-600 ${expanded ? "hover:bg-slate-50" : ""}`}`,
340
+ children: [/* @__PURE__ */ jsx("div", {
341
+ className: `flex h-10 w-10 shrink-0 items-center justify-center rounded-xl transition-colors duration-200 ${chipBg}`,
342
+ children: /* @__PURE__ */ jsx(Icon, {
343
+ className: "h-5 w-5 shrink-0",
344
+ strokeWidth: isActive ? 2.25 : 1.75
345
+ })
346
+ }), /* @__PURE__ */ jsx("span", {
347
+ style: {
348
+ maxWidth: expanded ? 160 : 0,
349
+ opacity: expanded ? 1 : 0,
350
+ marginLeft: expanded ? 12 : 0,
351
+ overflow: "hidden",
352
+ whiteSpace: "nowrap",
353
+ transition: LABEL_TR
354
+ },
355
+ className: "text-[14.5px] font-medium tracking-[-0.01em]",
356
+ children: label
357
+ })]
358
+ }),
359
+ !expanded && /* @__PURE__ */ jsxs("div", {
360
+ className: "pointer-events-none absolute left-full top-1/2 z-50 ml-3 -translate-y-1/2 whitespace-nowrap rounded-lg bg-slate-900 px-3 py-1.75 text-[13px] font-medium text-white opacity-0 shadow-xl transition-opacity duration-150 group-hover:opacity-100",
361
+ children: [label, /* @__PURE__ */ jsx("span", { className: "absolute right-full top-1/2 -translate-y-1/2 border-4 border-transparent border-r-slate-900" })]
362
+ })
363
+ ]
364
+ }, id);
365
+ })
366
+ }),
367
+ /* @__PURE__ */ jsx("div", {
368
+ className: "mt-auto border-t border-slate-100 px-[22px] py-5",
369
+ style: {
370
+ opacity: expanded ? 1 : 0,
371
+ transition: "opacity 200ms ease"
372
+ },
373
+ children: /* @__PURE__ */ jsx("p", {
374
+ className: "whitespace-nowrap text-[12px] leading-relaxed text-slate-400",
375
+ children: ".docx · .xlsx · .pptx"
376
+ })
377
+ })
378
+ ]
379
+ }), /* @__PURE__ */ jsxs("div", {
380
+ style: { marginLeft: SIDEBAR_COLLAPSED },
381
+ className: "flex flex-1 flex-col overflow-hidden",
382
+ children: [/* @__PURE__ */ jsxs("main", {
383
+ className: `flex-1 ${doc?.kind === "pptx" && pptMode === "navigation" ? "overflow-hidden" : "overflow-auto"}`,
384
+ children: [
385
+ !doc && /* @__PURE__ */ jsx("div", {
386
+ className: "flex min-h-full items-center justify-center px-8 py-16",
387
+ children: /* @__PURE__ */ jsx("div", {
388
+ className: "w-full max-w-150",
389
+ children: /* @__PURE__ */ jsx(FileDropzone, {
390
+ onFile: openFile,
391
+ config: VIEW_CONFIG[activeView]
392
+ }, activeView)
393
+ })
394
+ }),
395
+ doc && !mounted && /* @__PURE__ */ jsx("div", {
396
+ className: "flex h-full items-center justify-center",
397
+ children: /* @__PURE__ */ jsx(Loader2, { className: "h-8 w-8 animate-spin text-slate-300" })
398
+ }),
399
+ doc && mounted && doc.kind === "unsupported" && /* @__PURE__ */ jsx("div", {
400
+ className: "flex h-full items-center justify-center p-12",
401
+ children: /* @__PURE__ */ jsxs("div", {
402
+ className: "mx-auto w-full max-w-md rounded-2xl border border-slate-200 bg-white px-12 py-12 text-center",
403
+ style: { boxShadow: "0 1px 4px 0 rgba(15,23,42,0.06)" },
404
+ children: [
405
+ /* @__PURE__ */ jsx(FileWarning, { className: "mx-auto h-12 w-12 text-slate-300" }),
406
+ /* @__PURE__ */ jsx("h2", {
407
+ className: "mt-6 text-[20px] font-semibold tracking-tight text-slate-800",
408
+ children: "Unsupported file type"
409
+ }),
410
+ /* @__PURE__ */ jsxs("p", {
411
+ className: "mt-3 text-[14.5px] leading-relaxed text-slate-500",
412
+ children: [
413
+ "Please use a supported format:",
414
+ " ",
415
+ /* @__PURE__ */ jsx("strong", {
416
+ className: "font-semibold text-slate-700",
417
+ children: ".docx"
418
+ }),
419
+ ",",
420
+ " ",
421
+ /* @__PURE__ */ jsx("strong", {
422
+ className: "font-semibold text-slate-700",
423
+ children: ".xlsx"
424
+ }),
425
+ " or",
426
+ " ",
427
+ /* @__PURE__ */ jsx("strong", {
428
+ className: "font-semibold text-slate-700",
429
+ children: ".pptx"
430
+ }),
431
+ ".",
432
+ /* @__PURE__ */ jsx("br", {}),
433
+ "Legacy formats (.doc, .xls, .ppt) are not supported."
434
+ ]
435
+ }),
436
+ /* @__PURE__ */ jsx("button", {
437
+ onClick: closeDoc,
438
+ className: "mt-8 rounded-xl bg-blue-600 px-7 py-[10px] text-[14px] font-semibold text-white transition-colors duration-150 hover:bg-blue-700",
439
+ children: "Try another file"
440
+ })
441
+ ]
442
+ })
443
+ }),
444
+ doc && mounted && doc.kind !== "unsupported" && /* @__PURE__ */ jsxs(Suspense, {
445
+ fallback: /* @__PURE__ */ jsx("div", {
446
+ className: "flex h-full items-center justify-center",
447
+ children: /* @__PURE__ */ jsx(Loader2, { className: "h-8 w-8 animate-spin text-slate-300" })
448
+ }),
449
+ children: [
450
+ doc.kind === "docx" && /* @__PURE__ */ jsx(DocxViewer, {
451
+ data: doc.data,
452
+ mode: docMode
453
+ }),
454
+ doc.kind === "xlsx" && /* @__PURE__ */ jsx(XlsxViewer, { data: doc.data }),
455
+ doc.kind === "pptx" && /* @__PURE__ */ jsx(PptxViewer, {
456
+ data: doc.data,
457
+ mode: pptMode
458
+ })
459
+ ]
460
+ })
461
+ ]
462
+ }), /* @__PURE__ */ jsx("footer", {
463
+ className: "shrink-0 border-t border-slate-200/70 bg-white px-8 py-3",
464
+ children: /* @__PURE__ */ jsxs("p", {
465
+ className: "text-center text-[12px] text-slate-400",
466
+ children: [
467
+ "Powered by",
468
+ " ",
469
+ /* @__PURE__ */ jsx("span", {
470
+ className: "font-semibold text-slate-500",
471
+ children: "Virtualan Software"
472
+ })
473
+ ]
474
+ })
475
+ })]
476
+ })]
477
+ })]
478
+ });
479
+ }
480
+ //#endregion
481
+ export { Index as component };