@w100n/documents 0.16.2 → 0.16.4

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 (39) hide show
  1. package/dist/{SheetView-S5AFXKPA.js → SheetView-OEKOHMKW.js} +7 -5
  2. package/dist/SheetView-OEKOHMKW.js.map +1 -0
  3. package/dist/{TextEditor-7WQJFUUU.js → TextEditor-5S7FSLIZ.js} +4 -4
  4. package/dist/{chunk-JC4DLTMI.js → chunk-3D2G5NBI.js} +2 -2
  5. package/dist/{chunk-KGAQT5M3.js → chunk-AKJGYZME.js} +3 -3
  6. package/dist/{chunk-KGAQT5M3.js.map → chunk-AKJGYZME.js.map} +1 -1
  7. package/dist/{chunk-LZYITB56.js → chunk-VNXZVOPN.js} +37 -1
  8. package/dist/chunk-VNXZVOPN.js.map +1 -0
  9. package/dist/collab.cjs +37 -1
  10. package/dist/collab.cjs.map +1 -1
  11. package/dist/collab.d.cts +1 -1
  12. package/dist/collab.d.ts +1 -1
  13. package/dist/collab.js +2 -2
  14. package/dist/{grid-AZLMNS7K.js → grid-IR5YFFSF.js} +20 -2
  15. package/dist/grid-IR5YFFSF.js.map +1 -0
  16. package/dist/index.cjs +346 -71
  17. package/dist/index.cjs.map +1 -1
  18. package/dist/index.css +75 -0
  19. package/dist/index.css.map +1 -1
  20. package/dist/index.d.cts +12 -3
  21. package/dist/index.d.ts +12 -3
  22. package/dist/index.js +281 -56
  23. package/dist/index.js.map +1 -1
  24. package/dist/kinds.d.cts +1 -1
  25. package/dist/kinds.d.ts +1 -1
  26. package/dist/memory.cjs +6 -0
  27. package/dist/memory.cjs.map +1 -1
  28. package/dist/memory.d.cts +1 -1
  29. package/dist/memory.d.ts +1 -1
  30. package/dist/memory.js +6 -0
  31. package/dist/memory.js.map +1 -1
  32. package/dist/{types-DNcaU6SK.d.cts → types-BUO0OzOl.d.cts} +5 -0
  33. package/dist/{types-DNcaU6SK.d.ts → types-BUO0OzOl.d.ts} +5 -0
  34. package/package.json +1 -1
  35. package/dist/SheetView-S5AFXKPA.js.map +0 -1
  36. package/dist/chunk-LZYITB56.js.map +0 -1
  37. package/dist/grid-AZLMNS7K.js.map +0 -1
  38. /package/dist/{TextEditor-7WQJFUUU.js.map → TextEditor-5S7FSLIZ.js.map} +0 -0
  39. /package/dist/{chunk-JC4DLTMI.js.map → chunk-3D2G5NBI.js.map} +0 -0
package/dist/index.cjs CHANGED
@@ -98,6 +98,18 @@ var init_text = __esm({
98
98
  retry: "Try again",
99
99
  loading: "Loading",
100
100
  unsupported: "This file cannot be shown yet",
101
+ sendChat: "Send to chat",
102
+ openFile: "Open",
103
+ openTab: "Open in a new tab",
104
+ copyLink: "Copy link",
105
+ linkCopied: "Link copied",
106
+ trash: "Move to trash",
107
+ trashAsk: "Move {name} to trash?",
108
+ trashed: "Moved to trash",
109
+ createdOn: "Created {when}",
110
+ updatedOn: "Updated {when}",
111
+ actionFailed: "Could not do that",
112
+ fileActions: "File actions",
101
113
  teamTemplates: "Team templates",
102
114
  saveTemplate: "Save as template",
103
115
  templateSaved: "Saved to Templates",
@@ -439,6 +451,18 @@ var init_text = __esm({
439
451
  retry: "Spr\xF3buj ponownie",
440
452
  loading: "Wczytywanie",
441
453
  unsupported: "Tego pliku nie da si\u0119 jeszcze pokaza\u0107",
454
+ sendChat: "Wy\u015Blij na czat",
455
+ openFile: "Otw\xF3rz",
456
+ openTab: "Otw\xF3rz w nowej karcie",
457
+ copyLink: "Kopiuj link",
458
+ linkCopied: "Skopiowano link",
459
+ trash: "Przenie\u015B do kosza",
460
+ trashAsk: "Przenie\u015B\u0107 {name} do kosza?",
461
+ trashed: "Przeniesiono do kosza",
462
+ createdOn: "Utworzono {when}",
463
+ updatedOn: "Zmieniono {when}",
464
+ actionFailed: "Nie uda\u0142o si\u0119",
465
+ fileActions: "Dzia\u0142ania na pliku",
442
466
  teamTemplates: "Szablony zespo\u0142u",
443
467
  saveTemplate: "Zapisz jako szablon",
444
468
  templateSaved: "Zapisano w Szablonach",
@@ -780,6 +804,18 @@ var init_text = __esm({
780
804
  retry: "\u0421\u043F\u0440\u043E\u0431\u0443\u0432\u0430\u0442\u0438 \u0449\u0435",
781
805
  loading: "\u0417\u0430\u0432\u0430\u043D\u0442\u0430\u0436\u0435\u043D\u043D\u044F",
782
806
  unsupported: "\u0426\u0435\u0439 \u0444\u0430\u0439\u043B \u043F\u043E\u043A\u0438 \u043D\u0435 \u043C\u043E\u0436\u043D\u0430 \u043F\u043E\u043A\u0430\u0437\u0430\u0442\u0438",
807
+ sendChat: "\u041D\u0430\u0434\u0456\u0441\u043B\u0430\u0442\u0438 \u0432 \u0447\u0430\u0442",
808
+ openFile: "\u0412\u0456\u0434\u043A\u0440\u0438\u0442\u0438",
809
+ openTab: "\u0412\u0456\u0434\u043A\u0440\u0438\u0442\u0438 \u0432 \u043D\u043E\u0432\u0456\u0439 \u0432\u043A\u043B\u0430\u0434\u0446\u0456",
810
+ copyLink: "\u041A\u043E\u043F\u0456\u044E\u0432\u0430\u0442\u0438 \u043F\u043E\u0441\u0438\u043B\u0430\u043D\u043D\u044F",
811
+ linkCopied: "\u041F\u043E\u0441\u0438\u043B\u0430\u043D\u043D\u044F \u0441\u043A\u043E\u043F\u0456\u0439\u043E\u0432\u0430\u043D\u043E",
812
+ trash: "\u0423 \u043A\u043E\u0448\u0438\u043A",
813
+ trashAsk: "\u041F\u0435\u0440\u0435\u043C\u0456\u0441\u0442\u0438\u0442\u0438 {name} \u0443 \u043A\u043E\u0448\u0438\u043A?",
814
+ trashed: "\u041F\u0435\u0440\u0435\u043C\u0456\u0449\u0435\u043D\u043E \u0432 \u043A\u043E\u0448\u0438\u043A",
815
+ createdOn: "\u0421\u0442\u0432\u043E\u0440\u0435\u043D\u043E {when}",
816
+ updatedOn: "\u0417\u043C\u0456\u043D\u0435\u043D\u043E {when}",
817
+ actionFailed: "\u041D\u0435 \u0432\u0434\u0430\u043B\u043E\u0441\u044F",
818
+ fileActions: "\u0414\u0456\u0457 \u0437 \u0444\u0430\u0439\u043B\u043E\u043C",
783
819
  teamTemplates: "\u0428\u0430\u0431\u043B\u043E\u043D\u0438 \u043A\u043E\u043C\u0430\u043D\u0434\u0438",
784
820
  saveTemplate: "\u0417\u0431\u0435\u0440\u0435\u0433\u0442\u0438 \u044F\u043A \u0448\u0430\u0431\u043B\u043E\u043D",
785
821
  templateSaved: "\u0417\u0431\u0435\u0440\u0435\u0436\u0435\u043D\u043E \u0432 Templates",
@@ -4735,7 +4771,7 @@ var init_extensions = __esm({
4735
4771
  var version;
4736
4772
  var init_package = __esm({
4737
4773
  "package.json"() {
4738
- version = "0.16.2";
4774
+ version = "0.16.4";
4739
4775
  }
4740
4776
  });
4741
4777
 
@@ -10080,17 +10116,35 @@ var init_sheets = __esm({
10080
10116
  });
10081
10117
 
10082
10118
  // src/sheets/calm.ts
10083
- var calm;
10119
+ function bolder(injector) {
10120
+ const theme = injector.get(import_core5.ThemeService);
10121
+ const tone = (color2) => theme.isValidThemeColor(color2) ? theme.getColorFromTheme(color2) : color2;
10122
+ const refs3 = new Set(Array.from({ length: 12 }, (_, i) => tone(theme.getColorFromTheme(`loop-color.${i + 1}`))));
10123
+ return injector.get(import_core5.ICommandService).beforeCommandExecuted(({ id, params }) => {
10124
+ if (id !== "doc.command.replace-text-runs") return;
10125
+ params?.body?.textRuns?.forEach((run3) => {
10126
+ if (run3.ts?.cl?.rgb && refs3.has(run3.ts.cl.rgb)) run3.ts.bl = 1;
10127
+ });
10128
+ });
10129
+ }
10130
+ var import_core5, pale, calm;
10084
10131
  var init_calm = __esm({
10085
10132
  "src/sheets/calm.ts"() {
10086
10133
  "use strict";
10087
- calm = (selection) => selection.style?.widgets && Object.values(selection.style.widgets).some(Boolean) ? { ...selection, style: { ...selection.style, widgets: {}, strokeWidth: 2 } } : selection;
10134
+ import_core5 = require("@univerjs/core");
10135
+ pale = (color2) => /^#[0-9a-f]{6}$/i.test(color2) ? `${color2}24` : color2.replace(/^rgb\(([^)]+)\)$/i, "rgba($1, 0.14)");
10136
+ calm = (selection) => {
10137
+ const style = selection.style;
10138
+ if (!style?.widgets || !Object.values(style.widgets).some(Boolean)) return selection;
10139
+ return { ...selection, style: { ...style, widgets: {}, strokeWidth: 3, fill: style.stroke ? pale(style.stroke) : style.fill } };
10140
+ };
10088
10141
  }
10089
10142
  });
10090
10143
 
10091
10144
  // src/sheets/grid.ts
10092
10145
  var grid_exports = {};
10093
10146
  __export(grid_exports, {
10147
+ bolder: () => bolder,
10094
10148
  grid: () => grid2,
10095
10149
  marks: () => marks
10096
10150
  });
@@ -10245,7 +10299,7 @@ function SheetView({ bytes, name, kind, rights, language, theme, onChange, onSav
10245
10299
  setDirty(false);
10246
10300
  const families = new Set([model.book.defaultStyle, ...Object.values(model.book.styles)].map((s) => typeof s === "object" ? s?.ff : null).filter(Boolean));
10247
10301
  const fonts = Promise.race([Promise.all([...families].flatMap((f) => ["", "bold ", "italic "].map((w) => document.fonts.load(`${w}11pt "${f}"`).catch(() => [])))), new Promise((r) => setTimeout(r, 800))]);
10248
- Promise.all([Promise.resolve().then(() => (init_grid(), grid_exports)), fonts]).then(([{ grid: grid3, marks: marks2 }]) => {
10302
+ Promise.all([Promise.resolve().then(() => (init_grid(), grid_exports)), fonts]).then(([{ bolder: bolder2, grid: grid3, marks: marks2 }]) => {
10249
10303
  if (gone) return;
10250
10304
  shared?.doc.off("update", change);
10251
10305
  if (shared && moved) model = extras(shared.doc, build(shared.doc));
@@ -10255,6 +10309,7 @@ function SheetView({ bytes, name, kind, rights, language, theme, onChange, onSav
10255
10309
  const view = grid3(host2, language, edit);
10256
10310
  const { univer, univerAPI: api2 } = view;
10257
10311
  const wb = api2.createWorkbook(model.book);
10312
+ const unbold = bolder2(univer.__getInjector());
10258
10313
  if (model.active) wb.setActiveSheet(model.active);
10259
10314
  if (!edit) wb.setEditable(false);
10260
10315
  const state = { api: api2, model, original: bytes, changes: 0 };
@@ -10294,6 +10349,7 @@ function SheetView({ bytes, name, kind, rights, language, theme, onChange, onSav
10294
10349
  live.current = state;
10295
10350
  stop = () => {
10296
10351
  unbind();
10352
+ unbold.dispose();
10297
10353
  state.marks?.dispose();
10298
10354
  untrack();
10299
10355
  selection.dispose();
@@ -10417,7 +10473,7 @@ function SheetView({ bytes, name, kind, rights, language, theme, onChange, onSav
10417
10473
  const sum = () => {
10418
10474
  const r = range()?.getRange();
10419
10475
  const ws = sheet2();
10420
- const numeric2 = (row2, c) => ws?.getRange(row2, c).getCellData()?.t === import_core5.CellValueType.NUMBER;
10476
+ const numeric2 = (row2, c) => ws?.getRange(row2, c).getCellData()?.t === import_core6.CellValueType.NUMBER;
10421
10477
  if (r && ws) for (const x of autoSum(r, numeric2)) ws.getRange(x.row, x.col).setValue({ f: x.f });
10422
10478
  };
10423
10479
  const shown = formats.find(([, p]) => p === look?.n)?.[0] ?? (look && look.n !== "General" ? look.n : t.general);
@@ -10584,13 +10640,13 @@ function SheetView({ bytes, name, kind, rights, language, theme, onChange, onSav
10584
10640
  ] })
10585
10641
  ] });
10586
10642
  }
10587
- var import_react12, import_lucide_react6, import_core5, import_jsx_runtime8, decimals, letters2, SheetView_default;
10643
+ var import_react12, import_lucide_react6, import_core6, import_jsx_runtime8, decimals, letters2, SheetView_default;
10588
10644
  var init_SheetView = __esm({
10589
10645
  "src/sheets/SheetView.tsx"() {
10590
10646
  "use strict";
10591
10647
  import_react12 = require("react");
10592
10648
  import_lucide_react6 = require("lucide-react");
10593
- import_core5 = require("@univerjs/core");
10649
+ import_core6 = require("@univerjs/core");
10594
10650
  init_live();
10595
10651
  init_focus();
10596
10652
  init_bind();
@@ -10717,6 +10773,7 @@ var index_exports = {};
10717
10773
  __export(index_exports, {
10718
10774
  DocumentOverlay: () => DocumentOverlay,
10719
10775
  DocumentsWorkspace: () => DocumentsWorkspace,
10776
+ FilePreview: () => FilePreview,
10720
10777
  GuestDocument: () => GuestDocument,
10721
10778
  GuestRefused: () => GuestRefused,
10722
10779
  SlidesView: () => SlidesView,
@@ -13827,7 +13884,7 @@ function Thumb({ host, item, label }) {
13827
13884
  /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("i", {}),
13828
13885
  /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("i", {})
13829
13886
  ] }) }),
13830
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "w100n-docs-kind", "data-kind": item.kind, children: label })
13887
+ label && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "w100n-docs-kind", "data-kind": item.kind, children: label })
13831
13888
  ] });
13832
13889
  }
13833
13890
 
@@ -13906,6 +13963,27 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place: pla
13906
13963
  document.addEventListener("pointerdown", close);
13907
13964
  return () => document.removeEventListener("pointerdown", close);
13908
13965
  }, [picking]);
13966
+ const [menu, setMenu] = (0, import_react17.useState)(null);
13967
+ const [naming, setNaming] = (0, import_react17.useState)(null);
13968
+ const [notice, setNotice] = (0, import_react17.useState)(null);
13969
+ const early = (0, import_react17.useRef)(/* @__PURE__ */ new Map());
13970
+ const hover = (0, import_react17.useRef)(0);
13971
+ (0, import_react17.useEffect)(() => {
13972
+ if (!menu) return;
13973
+ const close = (e) => {
13974
+ if (e.type === "pointerdown" && e.target.closest(".w100n-docs-context")) return;
13975
+ if (e.type === "keydown" && e.key !== "Escape") return;
13976
+ setMenu(null);
13977
+ };
13978
+ document.addEventListener("pointerdown", close);
13979
+ window.addEventListener("keydown", close);
13980
+ window.addEventListener("scroll", close, true);
13981
+ return () => {
13982
+ document.removeEventListener("pointerdown", close);
13983
+ window.removeEventListener("keydown", close);
13984
+ window.removeEventListener("scroll", close, true);
13985
+ };
13986
+ }, [menu]);
13909
13987
  const [tab, setTab] = (0, import_react17.useState)("outline");
13910
13988
  const [outline2, setOutline] = (0, import_react17.useState)([]);
13911
13989
  const [reading, setReading] = (0, import_react17.useState)(null);
@@ -13947,9 +14025,15 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place: pla
13947
14025
  document.removeEventListener("visibilitychange", sync);
13948
14026
  };
13949
14027
  }, []);
13950
- const doc = useLoad((signal) => here.documentId ? host.document(here.documentId, { signal }) : Promise.resolve(null), [host, here.documentId]);
14028
+ const take = (id, key2) => {
14029
+ const kept2 = early.current.get(id);
14030
+ const found = kept2 && Date.now() - kept2.at < 15e3 ? kept2[key2] : void 0;
14031
+ if (kept2) delete kept2[key2];
14032
+ return found;
14033
+ };
14034
+ const doc = useLoad((signal) => here.documentId ? take(here.documentId, "doc") ?? host.document(here.documentId, { signal }) : Promise.resolve(null), [host, here.documentId]);
13951
14035
  const versions = useLoad((signal) => here.documentId ? host.versions(here.documentId, { signal }) : Promise.resolve([]), [host, here.documentId]);
13952
- const content = useLoad((signal) => here.documentId ? host.content(here.documentId, versionId, { signal }) : Promise.resolve(null), [host, here.documentId, versionId]);
14036
+ const content = useLoad((signal) => here.documentId ? !versionId && take(here.documentId, "bytes") || host.content(here.documentId, versionId, { signal }) : Promise.resolve(null), [host, here.documentId, versionId]);
13953
14037
  const pdf = doc.data?.kind === "pdf";
13954
14038
  const text = doc.data?.kind === "markdown" || doc.data?.kind === "docx";
13955
14039
  const docbar = text && !versionId && !narrow;
@@ -14081,6 +14165,52 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place: pla
14081
14165
  setKept({ id: file.id, state: "failed" });
14082
14166
  }
14083
14167
  };
14168
+ const warm = (item) => {
14169
+ clearTimeout(hover.current);
14170
+ hover.current = window.setTimeout(() => {
14171
+ if (item.id === here.documentId) return;
14172
+ if (item.kind === "docx" || item.kind === "markdown") void Promise.resolve().then(() => (init_TextEditor(), TextEditor_exports));
14173
+ if (item.kind === "sheet") void Promise.resolve().then(() => (init_SheetView(), SheetView_exports));
14174
+ const kept2 = early.current.get(item.id);
14175
+ if (kept2 && Date.now() - kept2.at < 15e3 || item.size > 5e6) return;
14176
+ const next = { at: Date.now(), doc: host.document(item.id), bytes: host.content(item.id, null) };
14177
+ next.doc.catch(() => {
14178
+ });
14179
+ next.bytes.catch(() => {
14180
+ });
14181
+ early.current.set(item.id, next);
14182
+ }, 150);
14183
+ };
14184
+ const act = async (run3, done) => {
14185
+ setMenu(null);
14186
+ setNotice(null);
14187
+ try {
14188
+ await run3();
14189
+ if (done) setNotice(done);
14190
+ } catch {
14191
+ setNotice(t.actionFailed);
14192
+ }
14193
+ };
14194
+ const fetchFile = async (item) => {
14195
+ const url = URL.createObjectURL(new Blob([await host.content(item.id)]));
14196
+ const link = Object.assign(document.createElement("a"), { href: url, download: item.name });
14197
+ link.click();
14198
+ setTimeout(() => URL.revokeObjectURL(url), 1e3);
14199
+ };
14200
+ const retitle = async (item, draft) => {
14201
+ setNaming(null);
14202
+ const ext = /\.[^.]+$/.exec(item.name)?.[0] ?? "";
14203
+ const name = draft.trim() && (/\.[^.\s]+$/.test(draft.trim()) ? draft.trim() : draft.trim() + ext);
14204
+ if (!name || name === item.name) return;
14205
+ await act(() => host.rename(item.id, name));
14206
+ list.retry();
14207
+ if (item.id === here.documentId) doc.retry();
14208
+ };
14209
+ const drop2 = async (item) => {
14210
+ await act(() => host.remove(item.id), t.trashed);
14211
+ list.retry();
14212
+ if (item.id === here.documentId) go({ spaceId: here.spaceId, documentId: null });
14213
+ };
14084
14214
  const rename = async (file, draft) => {
14085
14215
  setRenaming(null);
14086
14216
  const ext = /\.[^.]+$/.exec(file.name)?.[0] ?? "";
@@ -14327,6 +14457,21 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place: pla
14327
14457
  kept?.id === here.documentId && kept.state === "failed" && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "w100n-docs-muted", role: "alert", children: t.templateFailed }),
14328
14458
  renamed2 === "failed" && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "w100n-docs-muted", children: t.renameFailed }),
14329
14459
  docbar && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { ref: setStatusAt, className: "w100n-docs-status" }),
14460
+ host.send && doc.data && !versionId && !doc.data.id.includes(":") && /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
14461
+ "button",
14462
+ {
14463
+ type: "button",
14464
+ className: "w100n-docs-action",
14465
+ "data-tone": "blue",
14466
+ "aria-label": t.sendChat,
14467
+ title: t.sendChat,
14468
+ onClick: () => host.send(doc.data.id),
14469
+ children: [
14470
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_lucide_react10.Send, { "aria-hidden": true }),
14471
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { children: t.sendChat })
14472
+ ]
14473
+ }
14474
+ ),
14330
14475
  sharing && /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("button", { type: "button", className: "w100n-docs-action", "aria-label": t.share, title: t.share, onClick: () => {
14331
14476
  setTab("sharing");
14332
14477
  side2("panel", true);
@@ -14455,17 +14600,56 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place: pla
14455
14600
  sending === "failed" && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("p", { className: "w100n-docs-muted", role: "alert", children: t.uploadFailed }),
14456
14601
  list.error && failed(list.retry),
14457
14602
  list.loading && !list.data && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("p", { className: "w100n-docs-muted", children: t.loading }),
14603
+ notice && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("p", { className: "w100n-docs-muted", role: "status", children: notice }),
14458
14604
  list.data && !shown.length && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("p", { className: "w100n-docs-muted", children: all.length ? t.nothing : t.empty }),
14459
14605
  folders.map((folder2) => /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "w100n-docs-folder", role: "group", "aria-label": folder2 || t.loose, children: [
14460
14606
  folders.length > 1 && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("p", { className: "w100n-docs-group", children: folder2 || t.loose }),
14461
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "w100n-docs-grid", children: shown.filter((item) => !spaceId || (item.folder ?? "") === folder2).map((item) => /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("button", { type: "button", className: "w100n-docs-card", "aria-current": item.id === here.documentId, onClick: () => open(item), title: item.name, children: [
14607
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "w100n-docs-grid", children: shown.filter((item) => !spaceId || (item.folder ?? "") === folder2).map((item) => naming?.id === item.id ? /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "w100n-docs-card", children: [
14462
14608
  /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Thumb, { host, item, label: t.kinds[item.kind] }),
14463
- /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("span", { className: "w100n-docs-card-text", children: [
14464
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("b", { children: item.name }),
14465
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("small", { children: [!spaceId && names2.get(item.spaceId), ago(item.updatedAt)].filter(Boolean).join(" \xB7 ") }),
14466
- inside2.get(item.id) && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("small", { className: "w100n-docs-hit", children: inside2.get(item.id).split(/[«»]/).map((part, i) => i % 2 ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("mark", { children: part }, i) : part) })
14467
- ] })
14468
- ] }, item.id)) })
14609
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "w100n-docs-card-text", children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
14610
+ "input",
14611
+ {
14612
+ className: "w100n-docs-field",
14613
+ autoFocus: true,
14614
+ value: naming.text,
14615
+ "aria-label": t.rename,
14616
+ onFocus: (e) => e.currentTarget.select(),
14617
+ onChange: (e) => setNaming({ ...naming, text: e.target.value }),
14618
+ onBlur: () => void retitle(item, naming.text),
14619
+ onKeyDown: (e) => {
14620
+ if (e.key === "Enter") e.currentTarget.blur();
14621
+ if (e.key === "Escape") {
14622
+ e.stopPropagation();
14623
+ setNaming(null);
14624
+ }
14625
+ }
14626
+ }
14627
+ ) })
14628
+ ] }, item.id) : /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
14629
+ "button",
14630
+ {
14631
+ type: "button",
14632
+ className: "w100n-docs-card",
14633
+ "aria-current": item.id === here.documentId,
14634
+ onClick: () => open(item),
14635
+ title: item.name,
14636
+ onPointerEnter: () => warm(item),
14637
+ onPointerLeave: () => clearTimeout(hover.current),
14638
+ onContextMenu: (e) => {
14639
+ e.preventDefault();
14640
+ setMenu({ item, x: Math.min(e.clientX, innerWidth - 290), y: Math.min(e.clientY, innerHeight - 440), sure: false });
14641
+ },
14642
+ children: [
14643
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Thumb, { host, item, label: t.kinds[item.kind] }),
14644
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("span", { className: "w100n-docs-card-text", children: [
14645
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("b", { children: item.name }),
14646
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("small", { children: [!spaceId && names2.get(item.spaceId), ago(item.updatedAt)].filter(Boolean).join(" \xB7 ") }),
14647
+ inside2.get(item.id) && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("small", { className: "w100n-docs-hit", children: inside2.get(item.id).split(/[«»]/).map((part, i) => i % 2 ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("mark", { children: part }, i) : part) })
14648
+ ] })
14649
+ ]
14650
+ },
14651
+ item.id
14652
+ )) })
14469
14653
  ] }, folder2))
14470
14654
  ] })
14471
14655
  ] }),
@@ -14634,18 +14818,108 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place: pla
14634
14818
  setMaking(false);
14635
14819
  opened2(made2);
14636
14820
  } }),
14821
+ menu && /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "w100n-docs-menu w100n-docs-context", role: "menu", "aria-label": t.fileActions, style: { left: menu.x, top: menu.y }, children: [
14822
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "w100n-docs-context-head", children: [
14823
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("b", { children: menu.item.name }),
14824
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("small", { children: [t.kinds[menu.item.kind], size2(menu.item.size), names2.get(menu.item.spaceId), menu.item.folder].filter(Boolean).join(" \xB7 ") }),
14825
+ menu.item.createdAt && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("small", { children: [t.createdOn.replace("{when}", date(menu.item.createdAt)), menu.item.createdBy?.name].filter(Boolean).join(" \xB7 ") }),
14826
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("small", { children: [t.updatedOn.replace("{when}", ago(menu.item.updatedAt)), menu.item.updatedBy?.name].filter(Boolean).join(" \xB7 ") })
14827
+ ] }),
14828
+ menu.sure ? /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "w100n-docs-context-ask", children: [
14829
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("p", { children: t.trashAsk.replace("{name}", menu.item.name) }),
14830
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("span", { className: "w100n-pdf-dialog-end", children: [
14831
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("button", { type: "button", className: "w100n-pdf-link", onClick: () => setMenu({ ...menu, sure: false }), children: t.cancel }),
14832
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("button", { type: "button", className: "w100n-docs-action", "data-tone": "red", onClick: () => void drop2(menu.item), children: [
14833
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_lucide_react10.Trash2, { "aria-hidden": true }),
14834
+ t.trash
14835
+ ] })
14836
+ ] })
14837
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_jsx_runtime14.Fragment, { children: [
14838
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("button", { type: "button", role: "menuitem", onClick: () => {
14839
+ setMenu(null);
14840
+ open(menu.item);
14841
+ }, children: [
14842
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_lucide_react10.FileText, { "aria-hidden": true }),
14843
+ t.openFile
14844
+ ] }),
14845
+ host.href && /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("button", { type: "button", role: "menuitem", onClick: () => {
14846
+ setMenu(null);
14847
+ window.open(host.href(menu.item.id), "_blank", "noopener");
14848
+ }, children: [
14849
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_lucide_react10.ExternalLink, { "aria-hidden": true }),
14850
+ t.openTab
14851
+ ] }),
14852
+ host.href && /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("button", { type: "button", role: "menuitem", onClick: () => void act(() => navigator.clipboard.writeText(host.href(menu.item.id)), t.linkCopied), children: [
14853
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_lucide_react10.Link, { "aria-hidden": true }),
14854
+ t.copyLink
14855
+ ] }),
14856
+ host.send && /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("button", { type: "button", role: "menuitem", onClick: () => {
14857
+ setMenu(null);
14858
+ host.send(menu.item.id);
14859
+ }, children: [
14860
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_lucide_react10.Send, { "aria-hidden": true }),
14861
+ t.sendChat
14862
+ ] }),
14863
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("hr", {}),
14864
+ host.rename && /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("button", { type: "button", role: "menuitem", onClick: () => {
14865
+ setMenu(null);
14866
+ setNaming({ id: menu.item.id, text: menu.item.name.replace(/\.[^.]+$/, "") });
14867
+ }, children: [
14868
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_lucide_react10.Pencil, { "aria-hidden": true }),
14869
+ t.rename
14870
+ ] }),
14871
+ host.create && /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("button", { type: "button", role: "menuitem", onClick: () => void act(async () => copy2(await host.document(menu.item.id))), children: [
14872
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_lucide_react10.Copy, { "aria-hidden": true }),
14873
+ t.makeCopy
14874
+ ] }),
14875
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("button", { type: "button", role: "menuitem", onClick: () => void act(() => fetchFile(menu.item)), children: [
14876
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_lucide_react10.Download, { "aria-hidden": true }),
14877
+ t.download
14878
+ ] }),
14879
+ host.saveTemplate && /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("button", { type: "button", role: "menuitem", onClick: () => void act(() => host.saveTemplate(menu.item.id), t.templateSaved), children: [
14880
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_lucide_react10.Bookmark, { "aria-hidden": true }),
14881
+ t.saveTemplate
14882
+ ] }),
14883
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("button", { type: "button", role: "menuitem", onClick: () => {
14884
+ setMenu(null);
14885
+ open(menu.item);
14886
+ setTab("details");
14887
+ side2("panel", true);
14888
+ }, children: [
14889
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_lucide_react10.Info, { "aria-hidden": true }),
14890
+ t.details
14891
+ ] }),
14892
+ host.remove && /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_jsx_runtime14.Fragment, { children: [
14893
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("hr", {}),
14894
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("button", { type: "button", role: "menuitem", "data-tone": "red", onClick: () => setMenu({ ...menu, sure: true }), children: [
14895
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_lucide_react10.Trash2, { "aria-hidden": true }),
14896
+ t.trash
14897
+ ] })
14898
+ ] })
14899
+ ] })
14900
+ ] }),
14637
14901
  dialog
14638
14902
  ] });
14639
14903
  }
14640
14904
 
14641
- // src/GuestDocument.tsx
14905
+ // src/FilePreview.tsx
14642
14906
  var import_react18 = require("react");
14907
+ var import_jsx_runtime15 = require("react/jsx-runtime");
14908
+ function FilePreview({ url, name, mimeType, size: size2 = 0, bytes, pdfWorker }) {
14909
+ const [source] = (0, import_react18.useState)(() => ({ pdfWorker, content: () => bytes ? bytes(url) : fetch(url, { credentials: "include" }).then((res) => res.ok ? res.arrayBuffer() : Promise.reject(new Error(String(res.status)))) }));
14910
+ const kind = kindOf(name, mimeType);
14911
+ if (!kind) return null;
14912
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "w100n-preview", children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Thumb, { host: source, item: { id: url.split("?")[0], spaceId: "", name, kind, size: size2, updatedAt: "" } }) });
14913
+ }
14914
+
14915
+ // src/GuestDocument.tsx
14916
+ var import_react19 = require("react");
14643
14917
  var import_lucide_react11 = require("lucide-react");
14644
14918
  init_text();
14645
14919
  init_useLoad();
14646
- var import_jsx_runtime15 = require("react/jsx-runtime");
14647
- var TextEditor4 = (0, import_react18.lazy)(() => Promise.resolve().then(() => (init_TextEditor(), TextEditor_exports)));
14648
- var SheetView4 = (0, import_react18.lazy)(() => Promise.resolve().then(() => (init_SheetView(), SheetView_exports)));
14920
+ var import_jsx_runtime16 = require("react/jsx-runtime");
14921
+ var TextEditor4 = (0, import_react19.lazy)(() => Promise.resolve().then(() => (init_TextEditor(), TextEditor_exports)));
14922
+ var SheetView4 = (0, import_react19.lazy)(() => Promise.resolve().then(() => (init_SheetView(), SheetView_exports)));
14649
14923
  var icons4 = { docx: import_lucide_react11.FileText, markdown: import_lucide_react11.FileType, pdf: import_lucide_react11.Files, sheet: import_lucide_react11.FileSpreadsheet, slides: import_lucide_react11.Presentation };
14650
14924
  var GuestRefused = class extends Error {
14651
14925
  constructor(reason, file = "", sharedBy = "") {
@@ -14671,14 +14945,14 @@ var remember = (name) => {
14671
14945
  };
14672
14946
  function GuestDocument({ host, language = "en", theme = "light", brand }) {
14673
14947
  const t = texts[language];
14674
- const [ask, setAsk] = (0, import_react18.useState)(() => ({ name: remembered() || void 0 }));
14675
- const [typed, setTyped] = (0, import_react18.useState)("");
14676
- const [name, setName] = (0, import_react18.useState)(remembered);
14677
- const named3 = (0, import_react18.useRef)(name);
14678
- const [slot, setSlot] = (0, import_react18.useState)(null);
14679
- const [saving, setSaving] = (0, import_react18.useState)("idle");
14948
+ const [ask, setAsk] = (0, import_react19.useState)(() => ({ name: remembered() || void 0 }));
14949
+ const [typed, setTyped] = (0, import_react19.useState)("");
14950
+ const [name, setName] = (0, import_react19.useState)(remembered);
14951
+ const named3 = (0, import_react19.useRef)(name);
14952
+ const [slot, setSlot] = (0, import_react19.useState)(null);
14953
+ const [saving, setSaving] = (0, import_react19.useState)("idle");
14680
14954
  const opened2 = useLoad((signal) => host.open(ask, { signal }), [host, ask]);
14681
- const [notes3] = (0, import_react18.useState)(() => ({
14955
+ const [notes3] = (0, import_react19.useState)(() => ({
14682
14956
  me: { id: "", name: "" },
14683
14957
  spaces: async () => [],
14684
14958
  documents: async () => [],
@@ -14705,17 +14979,17 @@ function GuestDocument({ host, language = "en", theme = "light", brand }) {
14705
14979
  const top = (file2, badge) => {
14706
14980
  const kind2 = file2 ? kindOf(file2.name, file2.mimeType) : null;
14707
14981
  const Kind = kind2 ? icons4[kind2] : import_lucide_react11.FileText;
14708
- return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("header", { className: "w100n-docs-bar w100n-guest-bar", children: [
14709
- brand && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "w100n-guest-brand", children: brand }),
14710
- file2 && /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_jsx_runtime15.Fragment, { children: [
14711
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "w100n-docs-tile", "data-kind": kind2, children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Kind, { "aria-hidden": true }) }),
14712
- /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "w100n-docs-heading", children: [
14713
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("strong", { className: "w100n-docs-title", children: file2.name }),
14714
- file2.sharedBy && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "w100n-docs-crumbs", children: t.sharedBy.replace("{name}", file2.sharedBy) })
14982
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("header", { className: "w100n-docs-bar w100n-guest-bar", children: [
14983
+ brand && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "w100n-guest-brand", children: brand }),
14984
+ file2 && /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(import_jsx_runtime16.Fragment, { children: [
14985
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "w100n-docs-tile", "data-kind": kind2, children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Kind, { "aria-hidden": true }) }),
14986
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "w100n-docs-heading", children: [
14987
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("strong", { className: "w100n-docs-title", children: file2.name }),
14988
+ file2.sharedBy && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "w100n-docs-crumbs", children: t.sharedBy.replace("{name}", file2.sharedBy) })
14715
14989
  ] }),
14716
- badge && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "w100n-docs-badge", "data-kind": kind2, children: badge }),
14717
- file2.download && /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "w100n-docs-end", children: [
14718
- (kind2 === "docx" || kind2 === "markdown" || kind2 === "sheet" || kind2 === "slides") && /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
14990
+ badge && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "w100n-docs-badge", "data-kind": kind2, children: badge }),
14991
+ file2.download && /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "w100n-docs-end", children: [
14992
+ (kind2 === "docx" || kind2 === "markdown" || kind2 === "sheet" || kind2 === "slides") && /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
14719
14993
  "button",
14720
14994
  {
14721
14995
  type: "button",
@@ -14726,25 +15000,25 @@ function GuestDocument({ host, language = "en", theme = "light", brand }) {
14726
15000
  "aria-label": t.pdfCopy,
14727
15001
  title: t.pdfCopy,
14728
15002
  children: [
14729
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_lucide_react11.FileDown, { "aria-hidden": true }),
14730
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { children: t.pdfCopy })
15003
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_lucide_react11.FileDown, { "aria-hidden": true }),
15004
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { children: t.pdfCopy })
14731
15005
  ]
14732
15006
  }
14733
15007
  ),
14734
- /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("button", { type: "button", className: "w100n-docs-action", "data-tone": "blue", disabled: saving === "busy", onClick: () => void download("file"), "aria-label": t.download, title: t.download, children: [
14735
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_lucide_react11.Download, { "aria-hidden": true }),
14736
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { children: t.download })
15008
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("button", { type: "button", className: "w100n-docs-action", "data-tone": "blue", disabled: saving === "busy", onClick: () => void download("file"), "aria-label": t.download, title: t.download, children: [
15009
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_lucide_react11.Download, { "aria-hidden": true }),
15010
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { children: t.download })
14737
15011
  ] })
14738
15012
  ] })
14739
15013
  ] })
14740
15014
  ] });
14741
15015
  };
14742
- const gate = (tone, Icon, title, body, form) => /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "w100n-docs w100n-guest", "data-theme": theme, children: [
15016
+ const gate = (tone, Icon, title, body, form) => /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "w100n-docs w100n-guest", "data-theme": theme, children: [
14743
15017
  top(null, null),
14744
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "w100n-guest-gate", children: /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "w100n-guest-card", children: [
14745
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "w100n-share-tile", "data-tone": tone, children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Icon, { "aria-hidden": true }) }),
14746
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("h2", { children: title }),
14747
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("p", { children: body }),
15018
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "w100n-guest-gate", children: /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "w100n-guest-card", children: [
15019
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "w100n-share-tile", "data-tone": tone, children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Icon, { "aria-hidden": true }) }),
15020
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("h2", { children: title }),
15021
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("p", { children: body }),
14748
15022
  form
14749
15023
  ] }) })
14750
15024
  ] });
@@ -14760,7 +15034,7 @@ function GuestDocument({ host, language = "en", theme = "light", brand }) {
14760
15034
  password ? import_lucide_react11.Lock : import_lucide_react11.UserRound,
14761
15035
  refused.file || t.documents,
14762
15036
  shared + (password ? t.passwordAsk : t.nameAsk),
14763
- /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("form", { className: "w100n-guest-form", onSubmit: (e) => {
15037
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("form", { className: "w100n-guest-form", onSubmit: (e) => {
14764
15038
  e.preventDefault();
14765
15039
  if (!typed.trim()) return;
14766
15040
  if (password) setAsk({ ...ask, password: typed });
@@ -14770,7 +15044,7 @@ function GuestDocument({ host, language = "en", theme = "light", brand }) {
14770
15044
  }
14771
15045
  setTyped("");
14772
15046
  }, children: [
14773
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
15047
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
14774
15048
  "input",
14775
15049
  {
14776
15050
  className: "w100n-share-input",
@@ -14783,21 +15057,21 @@ function GuestDocument({ host, language = "en", theme = "light", brand }) {
14783
15057
  onChange: (e) => setTyped(e.target.value)
14784
15058
  }
14785
15059
  ),
14786
- refused.reason === "wrong" && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("p", { className: "w100n-docs-muted", role: "alert", children: t.wrongPassword }),
14787
- /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("button", { type: "submit", className: "w100n-docs-action", disabled: !typed.trim(), children: [
14788
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_lucide_react11.Eye, { "aria-hidden": true }),
15060
+ refused.reason === "wrong" && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("p", { className: "w100n-docs-muted", role: "alert", children: t.wrongPassword }),
15061
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("button", { type: "submit", className: "w100n-docs-action", disabled: !typed.trim(), children: [
15062
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_lucide_react11.Eye, { "aria-hidden": true }),
14789
15063
  t.openDoc
14790
15064
  ] })
14791
15065
  ] })
14792
15066
  );
14793
15067
  }
14794
15068
  if (refused?.reason === "busy") return gate("slate", import_lucide_react11.Ban, t.failed, t.tooMany);
14795
- return gate("slate", import_lucide_react11.Ban, t.failed, "", /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("button", { type: "button", className: "w100n-docs-action", onClick: opened2.retry, children: t.retry }));
15069
+ return gate("slate", import_lucide_react11.Ban, t.failed, "", /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("button", { type: "button", className: "w100n-docs-action", onClick: opened2.retry, children: t.retry }));
14796
15070
  }
14797
15071
  const file = opened2.data;
14798
- if (!file) return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "w100n-docs w100n-guest", "data-theme": theme, children: [
15072
+ if (!file) return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "w100n-docs w100n-guest", "data-theme": theme, children: [
14799
15073
  top(null, null),
14800
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "w100n-docs-empty", children: t.loading })
15074
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "w100n-docs-empty", children: t.loading })
14801
15075
  ] });
14802
15076
  const kind = kindOf(file.name, file.mimeType);
14803
15077
  const text = kind === "docx" || kind === "markdown";
@@ -14805,23 +15079,23 @@ function GuestDocument({ host, language = "en", theme = "light", brand }) {
14805
15079
  const rights = { view: true, comment: talk, edit: false };
14806
15080
  const quiet3 = () => {
14807
15081
  };
14808
- let stage = /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "w100n-docs-empty", children: t.unsupported });
14809
- if (text) stage = /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_react18.Suspense, { fallback: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "w100n-docs-empty", children: t.loading }), children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(TextEditor4, { kind, bytes: file.bytes, t, language, rights, host: talk ? notes3 : void 0, documentId: file.id, onOutline: quiet3, slot: talk ? slot : null }) });
14810
- else if (kind === "pdf") stage = /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(PdfView, { bytes: file.bytes, t, language, worker: host.pdfWorker, rights, documentId: file.id, onOutline: quiet3 });
14811
- else if (kind === "slides") stage = /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(SlidesView, { html: new TextDecoder().decode(file.bytes), name: file.name, rights, language, theme, onOutline: quiet3 });
14812
- else if (kind === "sheet") stage = /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_react18.Suspense, { fallback: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "w100n-docs-empty", children: t.loading }), children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(SheetView4, { bytes: file.bytes, name: file.name, kind: /\.csv$/i.test(file.name) || file.mimeType === "text/csv" ? "csv" : "xlsx", rights, language, theme, documentId: file.id }) });
14813
- return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "w100n-docs w100n-guest", "data-theme": theme, children: [
15082
+ let stage = /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "w100n-docs-empty", children: t.unsupported });
15083
+ if (text) stage = /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_react19.Suspense, { fallback: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "w100n-docs-empty", children: t.loading }), children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(TextEditor4, { kind, bytes: file.bytes, t, language, rights, host: talk ? notes3 : void 0, documentId: file.id, onOutline: quiet3, slot: talk ? slot : null }) });
15084
+ else if (kind === "pdf") stage = /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(PdfView, { bytes: file.bytes, t, language, worker: host.pdfWorker, rights, documentId: file.id, onOutline: quiet3 });
15085
+ else if (kind === "slides") stage = /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(SlidesView, { html: new TextDecoder().decode(file.bytes), name: file.name, rights, language, theme, onOutline: quiet3 });
15086
+ else if (kind === "sheet") stage = /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_react19.Suspense, { fallback: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "w100n-docs-empty", children: t.loading }), children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(SheetView4, { bytes: file.bytes, name: file.name, kind: /\.csv$/i.test(file.name) || file.mimeType === "text/csv" ? "csv" : "xlsx", rights, language, theme, documentId: file.id }) });
15087
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "w100n-docs w100n-guest", "data-theme": theme, children: [
14814
15088
  top(file, talk ? t.badgeComment : t.badgeRead),
14815
- saving === "failed" && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("p", { className: "w100n-docs-muted w100n-guest-note", role: "alert", children: t.exportFailed }),
14816
- /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "w100n-docs-body w100n-guest-body", children: [
14817
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("main", { className: "w100n-docs-stage", children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "w100n-docs-bare", children: stage }) }),
14818
- talk && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("aside", { className: "w100n-docs-side w100n-docs-panel w100n-guest-panel", "aria-label": t.comments, children: /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "w100n-docs-panel-body", children: [
14819
- /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("label", { className: "w100n-share-field", children: [
14820
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { children: t.yourName }),
14821
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("input", { className: "w100n-share-input", value: name, autoComplete: "name", placeholder: t.yourName, onChange: (e) => typeName(e.target.value) })
15089
+ saving === "failed" && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("p", { className: "w100n-docs-muted w100n-guest-note", role: "alert", children: t.exportFailed }),
15090
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "w100n-docs-body w100n-guest-body", children: [
15091
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("main", { className: "w100n-docs-stage", children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "w100n-docs-bare", children: stage }) }),
15092
+ talk && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("aside", { className: "w100n-docs-side w100n-docs-panel w100n-guest-panel", "aria-label": t.comments, children: /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "w100n-docs-panel-body", children: [
15093
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("label", { className: "w100n-share-field", children: [
15094
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { children: t.yourName }),
15095
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("input", { className: "w100n-share-input", value: name, autoComplete: "name", placeholder: t.yourName, onChange: (e) => typeName(e.target.value) })
14822
15096
  ] }),
14823
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("p", { className: "w100n-docs-muted", children: name.trim() ? t.nameHint : t.nameNeeded }),
14824
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { ref: setSlot })
15097
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("p", { className: "w100n-docs-muted", children: name.trim() ? t.nameHint : t.nameNeeded }),
15098
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { ref: setSlot })
14825
15099
  ] }) })
14826
15100
  ] })
14827
15101
  ] });
@@ -14833,6 +15107,7 @@ init_docx();
14833
15107
  0 && (module.exports = {
14834
15108
  DocumentOverlay,
14835
15109
  DocumentsWorkspace,
15110
+ FilePreview,
14836
15111
  GuestDocument,
14837
15112
  GuestRefused,
14838
15113
  SlidesView,