@w100n/documents 0.16.4 → 0.18.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. package/dist/{Compare-M57FG4R3.js → Compare-RHAUAKUJ.js} +2 -2
  2. package/dist/{SheetView-OEKOHMKW.js → SheetView-43JDIP7D.js} +5 -5
  3. package/dist/{TextEditor-5S7FSLIZ.js → TextEditor-CYS4U5XA.js} +119 -27
  4. package/dist/TextEditor-CYS4U5XA.js.map +1 -0
  5. package/dist/{chunk-VNXZVOPN.js → chunk-BWU6FPPZ.js} +956 -1
  6. package/dist/chunk-BWU6FPPZ.js.map +1 -0
  7. package/dist/{chunk-3D2G5NBI.js → chunk-DATYTA4H.js} +2 -2
  8. package/dist/{chunk-EQLBYW42.js → chunk-GSIPTCQH.js} +9 -1
  9. package/dist/chunk-GSIPTCQH.js.map +1 -0
  10. package/dist/chunk-Z5STMOD6.js +39 -0
  11. package/dist/chunk-Z5STMOD6.js.map +1 -0
  12. package/dist/{chunk-AKJGYZME.js → chunk-ZCSHH24C.js} +67 -832
  13. package/dist/chunk-ZCSHH24C.js.map +1 -0
  14. package/dist/collab.cjs +197 -2
  15. package/dist/collab.cjs.map +1 -1
  16. package/dist/collab.d.cts +1 -1
  17. package/dist/collab.d.ts +1 -1
  18. package/dist/collab.js +3 -3
  19. package/dist/index.cjs +1437 -543
  20. package/dist/index.cjs.map +1 -1
  21. package/dist/index.css +330 -0
  22. package/dist/index.css.map +1 -1
  23. package/dist/index.d.cts +2 -2
  24. package/dist/index.d.ts +2 -2
  25. package/dist/index.js +1080 -497
  26. package/dist/index.js.map +1 -1
  27. package/dist/kinds.d.cts +1 -1
  28. package/dist/kinds.d.ts +1 -1
  29. package/dist/memory.cjs +34 -5
  30. package/dist/memory.cjs.map +1 -1
  31. package/dist/memory.d.cts +1 -1
  32. package/dist/memory.d.ts +1 -1
  33. package/dist/memory.js +34 -5
  34. package/dist/memory.js.map +1 -1
  35. package/dist/{types-BUO0OzOl.d.cts → types-DyonaPQf.d.cts} +12 -1
  36. package/dist/{types-BUO0OzOl.d.ts → types-DyonaPQf.d.ts} +12 -1
  37. package/package.json +1 -1
  38. package/dist/TextEditor-5S7FSLIZ.js.map +0 -1
  39. package/dist/chunk-AKJGYZME.js.map +0 -1
  40. package/dist/chunk-EQLBYW42.js.map +0 -1
  41. package/dist/chunk-VNXZVOPN.js.map +0 -1
  42. /package/dist/{Compare-M57FG4R3.js.map → Compare-RHAUAKUJ.js.map} +0 -0
  43. /package/dist/{SheetView-OEKOHMKW.js.map → SheetView-43JDIP7D.js.map} +0 -0
  44. /package/dist/{chunk-3D2G5NBI.js.map → chunk-DATYTA4H.js.map} +0 -0
package/dist/index.js CHANGED
@@ -5,6 +5,9 @@ import {
5
5
  matches,
6
6
  readable
7
7
  } from "./chunk-2CA3HQTI.js";
8
+ import {
9
+ findNote
10
+ } from "./chunk-Z5STMOD6.js";
8
11
  import {
9
12
  useLoad
10
13
  } from "./chunk-QDH7EZAF.js";
@@ -14,7 +17,7 @@ import {
14
17
  } from "./chunk-TDP6OJET.js";
15
18
  import {
16
19
  texts
17
- } from "./chunk-VNXZVOPN.js";
20
+ } from "./chunk-BWU6FPPZ.js";
18
21
  import {
19
22
  escape,
20
23
  readDocx,
@@ -870,7 +873,7 @@ function SlidesView({ html, name, rights, language = "en", theme = "light", base
870
873
  };
871
874
  const fit = (box, pad = 0) => box.w > pad && box.h > pad ? Math.min((box.w - pad) / deck.width, (box.h - pad) / deck.height) : 0.5;
872
875
  const byKey = (a, b) => deck.slides[a].key < deck.slides[b].key ? -1 : 1;
873
- const around = (i) => [i - 1, i, i + 1].filter((k) => k >= 0 && k < count).sort(byKey);
876
+ const around2 = (i) => [i - 1, i, i + 1].filter((k) => k >= 0 && k < count).sort(byKey);
874
877
  const caption = (i) => `${t.slide} ${i + 1}${deck.slides[i].title ? `: ${deck.slides[i].title}` : ""}`;
875
878
  const post = (id, msg) => frames.current.get(id)?.contentWindow?.postMessage(msg, "*");
876
879
  const frame = (id, page, scale, title, hidden = false, still = false) => /* @__PURE__ */ jsx("span", { className: "w100n-slides-frame", "data-hidden": hidden || void 0, style: { width: Math.round(deck.width * scale), height: Math.round(deck.height * scale) }, children: /* @__PURE__ */ jsx(
@@ -1209,7 +1212,7 @@ function SlidesView({ html, name, rights, language = "en", theme = "light", base
1209
1212
  s.key
1210
1213
  )) }) }),
1211
1214
  /* @__PURE__ */ jsxs("div", { className: "w100n-slides-main", children: [
1212
- /* @__PURE__ */ jsx("div", { ref: stageRef, className: "w100n-slides-stage", style: { "--w100n-ratio": `${deck.width} / ${deck.height}` }, children: around(index).map((i) => {
1215
+ /* @__PURE__ */ jsx("div", { ref: stageRef, className: "w100n-slides-stage", style: { "--w100n-ratio": `${deck.width} / ${deck.height}` }, children: around2(index).map((i) => {
1213
1216
  const id = `m:${deck.slides[i].key}:${epoch}`;
1214
1217
  return frame(id, frozen(deck.slides[i], id, "edit"), fit(stageBox, 32), caption(i), i !== index);
1215
1218
  }) }),
@@ -1236,7 +1239,7 @@ function SlidesView({ html, name, rights, language = "en", theme = "light", base
1236
1239
  back();
1237
1240
  },
1238
1241
  children: [
1239
- around(nav.at).map((i) => {
1242
+ around2(nav.at).map((i) => {
1240
1243
  const id = `p:${deck.slides[i].key}:${epoch}`;
1241
1244
  return frame(id, frozen(deck.slides[i], id, "present"), fit(showBox), caption(i), i !== nav.at, true);
1242
1245
  }),
@@ -2409,8 +2412,8 @@ function PdfView({ bytes, t, language, worker, rights, host, documentId, onSaved
2409
2412
 
2410
2413
  // src/DocumentOverlay.tsx
2411
2414
  import { jsx as jsx5, jsxs as jsxs5 } from "react/jsx-runtime";
2412
- var TextEditor = lazy(() => import("./TextEditor-5S7FSLIZ.js"));
2413
- var SheetView = lazy(() => import("./SheetView-OEKOHMKW.js"));
2415
+ var TextEditor = lazy(() => import("./TextEditor-CYS4U5XA.js"));
2416
+ var SheetView = lazy(() => import("./SheetView-43JDIP7D.js"));
2414
2417
  var icons = { docx: FileText, markdown: FileType, pdf: Files, sheet: FileSpreadsheet, slides: Presentation };
2415
2418
  var read = { view: true, comment: false, edit: false };
2416
2419
  var quiet = () => {
@@ -2514,27 +2517,32 @@ function DocumentOverlay({ source, name, mimeType, info, download, actions, onCl
2514
2517
  }
2515
2518
 
2516
2519
  // src/DocumentsWorkspace.tsx
2517
- import { lazy as lazy2, Suspense as Suspense2, useEffect as useEffect6, useLayoutEffect as useLayoutEffect3, useRef as useRef6, useState as useState9 } from "react";
2520
+ import { lazy as lazy2, Suspense as Suspense2, useEffect as useEffect6, useLayoutEffect as useLayoutEffect3, useRef as useRef6, useState as useState11 } from "react";
2518
2521
  import { flushSync } from "react-dom";
2519
2522
  import {
2520
2523
  Bookmark,
2521
2524
  Check as Check2,
2522
- ChevronDown as ChevronDown2,
2523
- ChevronRight as ChevronRight2,
2525
+ ChevronDown as ChevronDown3,
2526
+ ChevronRight as ChevronRight3,
2524
2527
  Copy as Copy3,
2525
2528
  Download as Download3,
2526
2529
  ExternalLink as ExternalLink2,
2527
2530
  FileDiff,
2528
2531
  FileDown,
2529
2532
  Link as Link2,
2533
+ Link2 as Link22,
2530
2534
  Pencil,
2531
2535
  Send,
2532
2536
  Trash2 as Trash24,
2533
2537
  FilePlus,
2534
- FileSpreadsheet as FileSpreadsheet3,
2535
- FileText as FileText3,
2536
- FileType as FileType3,
2537
- Files as Files2,
2538
+ FileSpreadsheet as FileSpreadsheet4,
2539
+ FileText as FileText4,
2540
+ FileType as FileType6,
2541
+ Files as Files3,
2542
+ Folder as Folder2,
2543
+ FolderInput,
2544
+ FolderPlus,
2545
+ FolderTree,
2538
2546
  History,
2539
2547
  Info,
2540
2548
  LayoutGrid,
@@ -2545,19 +2553,196 @@ import {
2545
2553
  PanelLeftOpen,
2546
2554
  PanelRightClose,
2547
2555
  PanelRightOpen,
2548
- Plus as Plus4,
2549
- Presentation as Presentation3,
2556
+ Plus as Plus5,
2557
+ Presentation as Presentation4,
2550
2558
  RotateCcw as RotateCcw2,
2551
- Search as Search2,
2559
+ Search as Search3,
2552
2560
  Share2,
2553
2561
  Signature,
2554
2562
  Upload,
2555
2563
  X as X6
2556
2564
  } from "lucide-react";
2557
2565
 
2566
+ // src/Backlinks.tsx
2567
+ import { FileType as FileType2 } from "lucide-react";
2568
+ import { Fragment as Fragment5, jsx as jsx6, jsxs as jsxs6 } from "react/jsx-runtime";
2569
+ var wikis = /\[\[([^[\]\n|]+?)(?:\|([^[\]\n]+?))?\]\]/g;
2570
+ var around = (text, from, to) => ({
2571
+ before: text.slice(Math.max(0, from - 70), from).replace(/^\S*\s/, "").replace(/\s+/g, " "),
2572
+ hit: text.slice(from, to),
2573
+ after: text.slice(to, to + 90).replace(/\s\S*$/, "").replace(/\s+/g, " ")
2574
+ });
2575
+ function mentions(current, notes, texts2) {
2576
+ const name = current.name.replace(/\.(md|markdown)$/i, "");
2577
+ const plain = new RegExp(`(^|[^\\p{L}\\p{N}])(${name.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")})(?![\\p{L}\\p{N}])`, "iu");
2578
+ const linked = [];
2579
+ const unlinked = [];
2580
+ for (const item of notes) {
2581
+ if (item.id === current.id) continue;
2582
+ const text = texts2.get(item.id);
2583
+ if (!text) continue;
2584
+ let link = null;
2585
+ for (const m2 of text.matchAll(wikis)) {
2586
+ if (findNote(notes, m2[1])?.id !== current.id) continue;
2587
+ link = { item, ...around(text, m2.index, m2.index + m2[0].length), hit: m2[2] ?? m2[1] };
2588
+ break;
2589
+ }
2590
+ if (link) {
2591
+ linked.push(link);
2592
+ continue;
2593
+ }
2594
+ const bare3 = text.replace(wikis, (m2) => " ".repeat(m2.length));
2595
+ const m = plain.exec(bare3);
2596
+ if (m) unlinked.push({ item, ...around(text, m.index + m[1].length, m.index + m[0].length) });
2597
+ }
2598
+ return { linked, unlinked };
2599
+ }
2600
+ function Backlinks({ host, current, notes, t, onOpen }) {
2601
+ const others = notes.filter((item) => item.id !== current.id);
2602
+ const found = useLoad(async (signal) => {
2603
+ const texts2 = /* @__PURE__ */ new Map();
2604
+ const queue = [...others];
2605
+ const reader = new TextDecoder();
2606
+ await Promise.all(Array.from({ length: 6 }, async () => {
2607
+ for (let item = queue.shift(); item; item = queue.shift()) {
2608
+ try {
2609
+ texts2.set(item.id, reader.decode(await host.content(item.id, null, { signal })));
2610
+ } catch {
2611
+ if (signal.aborted) return;
2612
+ }
2613
+ }
2614
+ }));
2615
+ return mentions(current, notes, texts2);
2616
+ }, [host, current.id, current.name, others.map((item) => `${item.id}:${item.updatedAt}`).join()]);
2617
+ if (found.loading && !found.data) return /* @__PURE__ */ jsx6("p", { className: "w100n-docs-muted", children: t.loading });
2618
+ if (found.error) return /* @__PURE__ */ jsx6("p", { className: "w100n-docs-muted", children: t.failed });
2619
+ const { linked, unlinked } = found.data;
2620
+ const card = (m) => /* @__PURE__ */ jsxs6("button", { type: "button", className: "w100n-links-card", onClick: () => onOpen(m.item), children: [
2621
+ /* @__PURE__ */ jsxs6("b", { children: [
2622
+ /* @__PURE__ */ jsx6(FileType2, { "aria-hidden": true }),
2623
+ m.item.name.replace(/\.(md|markdown)$/i, "")
2624
+ ] }),
2625
+ /* @__PURE__ */ jsxs6("small", { children: [
2626
+ "\u2026",
2627
+ m.before,
2628
+ /* @__PURE__ */ jsx6("mark", { children: m.hit }),
2629
+ m.after,
2630
+ "\u2026"
2631
+ ] }),
2632
+ m.item.folder && /* @__PURE__ */ jsx6("small", { className: "w100n-links-folder", children: m.item.folder })
2633
+ ] }, m.item.id);
2634
+ return /* @__PURE__ */ jsxs6("div", { className: "w100n-links", children: [
2635
+ /* @__PURE__ */ jsxs6("p", { className: "w100n-docs-caption", children: [
2636
+ t.linked,
2637
+ /* @__PURE__ */ jsx6("span", { children: linked.length })
2638
+ ] }),
2639
+ linked.length ? linked.map(card) : /* @__PURE__ */ jsx6("p", { className: "w100n-docs-muted", children: t.noBacklinks }),
2640
+ unlinked.length > 0 && /* @__PURE__ */ jsxs6(Fragment5, { children: [
2641
+ /* @__PURE__ */ jsxs6("p", { className: "w100n-docs-caption", children: [
2642
+ t.unlinked,
2643
+ /* @__PURE__ */ jsx6("span", { children: unlinked.length })
2644
+ ] }),
2645
+ unlinked.map(card)
2646
+ ] })
2647
+ ] });
2648
+ }
2649
+
2650
+ // src/Jump.tsx
2651
+ import { useState as useState6 } from "react";
2652
+ import { Command, FileType as FileType3, Plus as Plus2, Search as Search2 } from "lucide-react";
2653
+ import { Fragment as Fragment6, jsx as jsx7, jsxs as jsxs7 } from "react/jsx-runtime";
2654
+ var bare2 = (name) => name.replace(/\.(md|markdown)$/i, "");
2655
+ function rank(item, q) {
2656
+ const name = bare2(item.name).toLowerCase();
2657
+ if (!q) return 2;
2658
+ if (name.startsWith(q)) return 0;
2659
+ if (name.split(/[\s_.-]+/).some((w) => w.startsWith(q))) return 1;
2660
+ if (name.includes(q)) return 2;
2661
+ let at = 0;
2662
+ for (const ch of q) {
2663
+ at = name.indexOf(ch, at) + 1;
2664
+ if (!at) return -1;
2665
+ }
2666
+ return 3;
2667
+ }
2668
+ var lit = (text, q) => {
2669
+ const at = q ? text.toLowerCase().indexOf(q) : -1;
2670
+ return at < 0 ? text : /* @__PURE__ */ jsxs7(Fragment6, { children: [
2671
+ text.slice(0, at),
2672
+ /* @__PURE__ */ jsx7("mark", { children: text.slice(at, at + q.length) }),
2673
+ text.slice(at + q.length)
2674
+ ] });
2675
+ };
2676
+ function Jump({ mode, items, actions, t, place, onOpen, onCreate, onClose }) {
2677
+ const [query, setQuery] = useState6("");
2678
+ const [at, setAt] = useState6(0);
2679
+ const q = query.trim().toLowerCase();
2680
+ const found = mode === "open" ? items.map((item) => ({ item, r: rank(item, q) })).filter((x) => x.r >= 0).sort((a, b) => a.r - b.r || bare2(a.item.name).localeCompare(bare2(b.item.name))).slice(0, 30).map((x) => x.item) : [];
2681
+ const doing = mode === "run" ? actions.filter((a) => !q || a.label.toLowerCase().includes(q)) : [];
2682
+ const make2 = mode === "open" && onCreate && query.trim() && !found.some((item) => bare2(item.name).toLowerCase() === q);
2683
+ const total = found.length + doing.length + (make2 ? 1 : 0);
2684
+ const pick = Math.min(at, Math.max(0, total - 1));
2685
+ const go = (i) => {
2686
+ onClose();
2687
+ if (i < found.length) onOpen(found[i]);
2688
+ else if (mode === "run") doing[i]?.run();
2689
+ else if (make2) onCreate(query.trim());
2690
+ };
2691
+ return /* @__PURE__ */ jsx7("div", { className: "w100n-jump-back", onPointerDown: (e) => {
2692
+ if (e.target === e.currentTarget) onClose();
2693
+ }, children: /* @__PURE__ */ jsxs7("div", { className: "w100n-jump", role: "dialog", "aria-modal": true, "aria-label": mode === "open" ? t.openNote : t.commands, children: [
2694
+ /* @__PURE__ */ jsxs7("label", { className: "w100n-jump-field", children: [
2695
+ mode === "open" ? /* @__PURE__ */ jsx7(Search2, { "aria-hidden": true }) : /* @__PURE__ */ jsx7(Command, { "aria-hidden": true }),
2696
+ /* @__PURE__ */ jsx7(
2697
+ "input",
2698
+ {
2699
+ autoFocus: true,
2700
+ value: query,
2701
+ placeholder: mode === "open" ? t.findNote : t.commands,
2702
+ "aria-label": mode === "open" ? t.findNote : t.commands,
2703
+ onChange: (e) => {
2704
+ setQuery(e.target.value);
2705
+ setAt(0);
2706
+ },
2707
+ onKeyDown: (e) => {
2708
+ if (e.key === "ArrowDown" || e.key === "ArrowUp") {
2709
+ e.preventDefault();
2710
+ if (total) setAt((pick + (e.key === "ArrowDown" ? 1 : total - 1)) % total);
2711
+ } else if (e.key === "Enter") {
2712
+ e.preventDefault();
2713
+ if (total) go(pick);
2714
+ } else if (e.key === "Escape") {
2715
+ e.stopPropagation();
2716
+ onClose();
2717
+ }
2718
+ }
2719
+ }
2720
+ )
2721
+ ] }),
2722
+ /* @__PURE__ */ jsxs7("div", { className: "w100n-jump-list", role: "listbox", "aria-label": mode === "open" ? t.openNote : t.commands, children: [
2723
+ found.map((item, i) => /* @__PURE__ */ jsxs7("button", { type: "button", role: "option", "aria-selected": i === pick, onPointerMove: () => setAt(i), onClick: () => go(i), children: [
2724
+ /* @__PURE__ */ jsx7(FileType3, { "aria-hidden": true }),
2725
+ /* @__PURE__ */ jsx7("span", { children: lit(bare2(item.name), q) }),
2726
+ /* @__PURE__ */ jsx7("small", { children: place(item) })
2727
+ ] }, item.id)),
2728
+ doing.map((a, i) => /* @__PURE__ */ jsxs7("button", { type: "button", role: "option", "aria-selected": i === pick, onPointerMove: () => setAt(i), onClick: () => go(i), children: [
2729
+ /* @__PURE__ */ jsx7(a.icon, { "aria-hidden": true }),
2730
+ /* @__PURE__ */ jsx7("span", { children: lit(a.label, q) }),
2731
+ a.keys && /* @__PURE__ */ jsx7("kbd", { children: a.keys })
2732
+ ] }, a.id)),
2733
+ make2 && /* @__PURE__ */ jsxs7("button", { type: "button", role: "option", "aria-selected": pick === found.length, onPointerMove: () => setAt(found.length), onClick: () => go(found.length), children: [
2734
+ /* @__PURE__ */ jsx7(Plus2, { "aria-hidden": true }),
2735
+ /* @__PURE__ */ jsx7("span", { children: t.createNote.replace("{name}", query.trim()) })
2736
+ ] }),
2737
+ !total && /* @__PURE__ */ jsx7("p", { className: "w100n-docs-muted", children: t.noNote })
2738
+ ] }),
2739
+ /* @__PURE__ */ jsx7("p", { className: "w100n-jump-keys", children: mode === "open" ? t.keysOpen : t.keysRun })
2740
+ ] }) });
2741
+ }
2742
+
2558
2743
  // src/NewDocument.tsx
2559
- import { Check, FileSpreadsheet as FileSpreadsheet2, FileText as FileText2, FileType as FileType2, Plus as Plus2, Presentation as Presentation2, X as X5 } from "lucide-react";
2560
- import { useId as useId3, useState as useState6 } from "react";
2744
+ import { Check, FileSpreadsheet as FileSpreadsheet2, FileText as FileText2, FileType as FileType4, Plus as Plus3, Presentation as Presentation2, X as X5 } from "lucide-react";
2745
+ import { useId as useId3, useState as useState7 } from "react";
2561
2746
 
2562
2747
  // src/blank.ts
2563
2748
  import { strToU8, zipSync } from "fflate";
@@ -2680,19 +2865,19 @@ function blank2(kind, name, template = "blank") {
2680
2865
  }
2681
2866
 
2682
2867
  // src/NewDocument.tsx
2683
- import { Fragment as Fragment5, jsx as jsx6, jsxs as jsxs6 } from "react/jsx-runtime";
2684
- var icons2 = { docx: FileText2, markdown: FileType2, sheet: FileSpreadsheet2, slides: Presentation2 };
2868
+ import { Fragment as Fragment7, jsx as jsx8, jsxs as jsxs8 } from "react/jsx-runtime";
2869
+ var icons2 = { docx: FileText2, markdown: FileType4, sheet: FileSpreadsheet2, slides: Presentation2 };
2685
2870
  var shaped = ["blank", "letter", "contract", "notes", "invoice", "report"];
2686
2871
  function NewDocument({ host, t, onClose, onMade }) {
2687
2872
  const id = useId3();
2688
- const [kind, setKind] = useState6("docx");
2689
- const [template, setTemplate] = useState6("blank");
2690
- const [name, setName] = useState6("");
2691
- const [team, setTeam] = useState6(null);
2873
+ const [kind, setKind] = useState7("docx");
2874
+ const [template, setTemplate] = useState7("blank");
2875
+ const [name, setName] = useState7("");
2876
+ const [team, setTeam] = useState7(null);
2692
2877
  const shared = useLoad((signal) => host.templates ? host.templates({ signal }) : Promise.resolve([]), [host]);
2693
2878
  const ours = (shared.data ?? []).filter((item) => item.kind === kind);
2694
2879
  const stem = (file) => file.replace(/\.[^.]+$/, "");
2695
- const [state, setState] = useState6("idle");
2880
+ const [state, setState] = useState7("idle");
2696
2881
  useRestore(true);
2697
2882
  const choices = kind === "docx" || kind === "markdown" ? shaped : ["blank"];
2698
2883
  const make2 = async () => {
@@ -2706,77 +2891,77 @@ function NewDocument({ host, t, onClose, onMade }) {
2706
2891
  setState("failed");
2707
2892
  }
2708
2893
  };
2709
- return /* @__PURE__ */ jsx6("div", { className: "w100n-pdf-back", onKeyDown: (e) => {
2894
+ return /* @__PURE__ */ jsx8("div", { className: "w100n-pdf-back", onKeyDown: (e) => {
2710
2895
  if (e.key === "Escape") {
2711
2896
  e.stopPropagation();
2712
2897
  onClose();
2713
2898
  }
2714
- }, children: /* @__PURE__ */ jsxs6("form", { className: "w100n-pdf-dialog w100n-new", role: "dialog", "aria-modal": true, "aria-labelledby": `${id}t`, onSubmit: (e) => {
2899
+ }, children: /* @__PURE__ */ jsxs8("form", { className: "w100n-pdf-dialog w100n-new", role: "dialog", "aria-modal": true, "aria-labelledby": `${id}t`, onSubmit: (e) => {
2715
2900
  e.preventDefault();
2716
2901
  void make2();
2717
2902
  }, children: [
2718
- /* @__PURE__ */ jsxs6("div", { className: "w100n-new-head", children: [
2719
- /* @__PURE__ */ jsx6("span", { className: "w100n-new-tile", children: /* @__PURE__ */ jsx6(Plus2, { "aria-hidden": true }) }),
2720
- /* @__PURE__ */ jsx6("b", { id: `${id}t`, className: "w100n-pdf-dialog-title", children: t.newTitle }),
2721
- /* @__PURE__ */ jsx6("button", { type: "button", className: "w100n-docs-close", onClick: onClose, "aria-label": t.close, title: t.close, children: /* @__PURE__ */ jsx6(X5, { "aria-hidden": true }) })
2903
+ /* @__PURE__ */ jsxs8("div", { className: "w100n-new-head", children: [
2904
+ /* @__PURE__ */ jsx8("span", { className: "w100n-new-tile", children: /* @__PURE__ */ jsx8(Plus3, { "aria-hidden": true }) }),
2905
+ /* @__PURE__ */ jsx8("b", { id: `${id}t`, className: "w100n-pdf-dialog-title", children: t.newTitle }),
2906
+ /* @__PURE__ */ jsx8("button", { type: "button", className: "w100n-docs-close", onClick: onClose, "aria-label": t.close, title: t.close, children: /* @__PURE__ */ jsx8(X5, { "aria-hidden": true }) })
2722
2907
  ] }),
2723
- /* @__PURE__ */ jsx6("div", { role: "radiogroup", "aria-label": t.kind, className: "w100n-new-kinds", children: Object.keys(icons2).map((item) => {
2908
+ /* @__PURE__ */ jsx8("div", { role: "radiogroup", "aria-label": t.kind, className: "w100n-new-kinds", children: Object.keys(icons2).map((item) => {
2724
2909
  const Icon = icons2[item];
2725
- return /* @__PURE__ */ jsxs6("button", { type: "button", role: "radio", "aria-checked": kind === item, "data-kind": item, onClick: () => {
2910
+ return /* @__PURE__ */ jsxs8("button", { type: "button", role: "radio", "aria-checked": kind === item, "data-kind": item, onClick: () => {
2726
2911
  setKind(item);
2727
2912
  setTeam(null);
2728
2913
  if (item === "sheet" || item === "slides") setTemplate("blank");
2729
2914
  }, children: [
2730
- /* @__PURE__ */ jsx6("span", { className: "w100n-docs-tile", "data-kind": item, children: /* @__PURE__ */ jsx6(Icon, { "aria-hidden": true }) }),
2731
- /* @__PURE__ */ jsxs6("span", { children: [
2732
- /* @__PURE__ */ jsx6("b", { children: t.newKinds[item] }),
2733
- /* @__PURE__ */ jsx6("small", { children: t.kindHints[item] })
2915
+ /* @__PURE__ */ jsx8("span", { className: "w100n-docs-tile", "data-kind": item, children: /* @__PURE__ */ jsx8(Icon, { "aria-hidden": true }) }),
2916
+ /* @__PURE__ */ jsxs8("span", { children: [
2917
+ /* @__PURE__ */ jsx8("b", { children: t.newKinds[item] }),
2918
+ /* @__PURE__ */ jsx8("small", { children: t.kindHints[item] })
2734
2919
  ] })
2735
2920
  ] }, item);
2736
2921
  }) }),
2737
- /* @__PURE__ */ jsx6("p", { className: "w100n-docs-caption", children: t.startFrom }),
2738
- /* @__PURE__ */ jsx6("div", { role: "radiogroup", "aria-label": t.startFrom, className: "w100n-new-templates", children: choices.map((item) => /* @__PURE__ */ jsxs6("button", { type: "button", role: "radio", "aria-checked": !team && template === item, onClick: () => {
2922
+ /* @__PURE__ */ jsx8("p", { className: "w100n-docs-caption", children: t.startFrom }),
2923
+ /* @__PURE__ */ jsx8("div", { role: "radiogroup", "aria-label": t.startFrom, className: "w100n-new-templates", children: choices.map((item) => /* @__PURE__ */ jsxs8("button", { type: "button", role: "radio", "aria-checked": !team && template === item, onClick: () => {
2739
2924
  setTeam(null);
2740
2925
  setTemplate(item);
2741
2926
  }, children: [
2742
- /* @__PURE__ */ jsx6("span", { className: "w100n-new-sheet", "data-blank": item === "blank", children: item === "blank" ? /* @__PURE__ */ jsx6(Plus2, { "aria-hidden": true }) : /* @__PURE__ */ jsxs6(Fragment5, { children: [
2743
- /* @__PURE__ */ jsx6("i", { "data-head": true }),
2744
- /* @__PURE__ */ jsx6("i", {}),
2745
- /* @__PURE__ */ jsx6("i", {}),
2746
- /* @__PURE__ */ jsx6("i", { "data-accent": true }),
2747
- /* @__PURE__ */ jsx6("i", {}),
2748
- /* @__PURE__ */ jsx6("i", {})
2927
+ /* @__PURE__ */ jsx8("span", { className: "w100n-new-sheet", "data-blank": item === "blank", children: item === "blank" ? /* @__PURE__ */ jsx8(Plus3, { "aria-hidden": true }) : /* @__PURE__ */ jsxs8(Fragment7, { children: [
2928
+ /* @__PURE__ */ jsx8("i", { "data-head": true }),
2929
+ /* @__PURE__ */ jsx8("i", {}),
2930
+ /* @__PURE__ */ jsx8("i", {}),
2931
+ /* @__PURE__ */ jsx8("i", { "data-accent": true }),
2932
+ /* @__PURE__ */ jsx8("i", {}),
2933
+ /* @__PURE__ */ jsx8("i", {})
2749
2934
  ] }) }),
2750
- /* @__PURE__ */ jsx6("span", { children: t.templates[item] })
2935
+ /* @__PURE__ */ jsx8("span", { children: t.templates[item] })
2751
2936
  ] }, item)) }),
2752
- ours.length > 0 && /* @__PURE__ */ jsxs6(Fragment5, { children: [
2753
- /* @__PURE__ */ jsx6("p", { className: "w100n-docs-caption", children: t.teamTemplates }),
2754
- /* @__PURE__ */ jsx6("div", { role: "radiogroup", "aria-label": t.teamTemplates, className: "w100n-new-templates", children: ours.map((item) => /* @__PURE__ */ jsxs6("button", { type: "button", role: "radio", "aria-checked": team?.id === item.id, onClick: () => setTeam(item), children: [
2755
- /* @__PURE__ */ jsxs6("span", { className: "w100n-new-sheet", children: [
2756
- /* @__PURE__ */ jsx6("i", { "data-head": true }),
2757
- /* @__PURE__ */ jsx6("i", {}),
2758
- /* @__PURE__ */ jsx6("i", { "data-accent": true }),
2759
- /* @__PURE__ */ jsx6("i", {}),
2760
- /* @__PURE__ */ jsx6("i", {})
2937
+ ours.length > 0 && /* @__PURE__ */ jsxs8(Fragment7, { children: [
2938
+ /* @__PURE__ */ jsx8("p", { className: "w100n-docs-caption", children: t.teamTemplates }),
2939
+ /* @__PURE__ */ jsx8("div", { role: "radiogroup", "aria-label": t.teamTemplates, className: "w100n-new-templates", children: ours.map((item) => /* @__PURE__ */ jsxs8("button", { type: "button", role: "radio", "aria-checked": team?.id === item.id, onClick: () => setTeam(item), children: [
2940
+ /* @__PURE__ */ jsxs8("span", { className: "w100n-new-sheet", children: [
2941
+ /* @__PURE__ */ jsx8("i", { "data-head": true }),
2942
+ /* @__PURE__ */ jsx8("i", {}),
2943
+ /* @__PURE__ */ jsx8("i", { "data-accent": true }),
2944
+ /* @__PURE__ */ jsx8("i", {}),
2945
+ /* @__PURE__ */ jsx8("i", {})
2761
2946
  ] }),
2762
- /* @__PURE__ */ jsx6("span", { title: item.name, children: stem(item.name) })
2947
+ /* @__PURE__ */ jsx8("span", { title: item.name, children: stem(item.name) })
2763
2948
  ] }, item.id)) })
2764
2949
  ] }),
2765
- /* @__PURE__ */ jsxs6("div", { className: "w100n-new-fields", children: [
2766
- /* @__PURE__ */ jsxs6("label", { children: [
2767
- /* @__PURE__ */ jsx6("span", { className: "w100n-docs-caption", children: t.name }),
2768
- /* @__PURE__ */ jsx6("input", { className: "w100n-docs-field", autoFocus: true, value: name, onChange: (e) => setName(e.target.value), placeholder: team ? stem(team.name) : template === "blank" ? t.untitled : t.templates[template] })
2950
+ /* @__PURE__ */ jsxs8("div", { className: "w100n-new-fields", children: [
2951
+ /* @__PURE__ */ jsxs8("label", { children: [
2952
+ /* @__PURE__ */ jsx8("span", { className: "w100n-docs-caption", children: t.name }),
2953
+ /* @__PURE__ */ jsx8("input", { className: "w100n-docs-field", autoFocus: true, value: name, onChange: (e) => setName(e.target.value), placeholder: team ? stem(team.name) : template === "blank" ? t.untitled : t.templates[template] })
2769
2954
  ] }),
2770
- host.createIn && /* @__PURE__ */ jsxs6("div", { children: [
2771
- /* @__PURE__ */ jsx6("span", { className: "w100n-docs-caption", children: t.savesTo }),
2772
- /* @__PURE__ */ jsx6("span", { className: "w100n-docs-field w100n-new-place", children: host.createIn })
2955
+ host.createIn && /* @__PURE__ */ jsxs8("div", { children: [
2956
+ /* @__PURE__ */ jsx8("span", { className: "w100n-docs-caption", children: t.savesTo }),
2957
+ /* @__PURE__ */ jsx8("span", { className: "w100n-docs-field w100n-new-place", children: host.createIn })
2773
2958
  ] })
2774
2959
  ] }),
2775
- state === "failed" && /* @__PURE__ */ jsx6("p", { className: "w100n-docs-muted", role: "alert", children: t.makeFailed }),
2776
- /* @__PURE__ */ jsxs6("div", { className: "w100n-pdf-dialog-end", children: [
2777
- /* @__PURE__ */ jsx6("button", { type: "button", className: "w100n-pdf-link", onClick: onClose, children: t.cancel }),
2778
- /* @__PURE__ */ jsxs6("button", { type: "submit", className: "w100n-docs-action", disabled: state === "busy", children: [
2779
- /* @__PURE__ */ jsx6(Check, { "aria-hidden": true }),
2960
+ state === "failed" && /* @__PURE__ */ jsx8("p", { className: "w100n-docs-muted", role: "alert", children: t.makeFailed }),
2961
+ /* @__PURE__ */ jsxs8("div", { className: "w100n-pdf-dialog-end", children: [
2962
+ /* @__PURE__ */ jsx8("button", { type: "button", className: "w100n-pdf-link", onClick: onClose, children: t.cancel }),
2963
+ /* @__PURE__ */ jsxs8("button", { type: "submit", className: "w100n-docs-action", disabled: state === "busy", children: [
2964
+ /* @__PURE__ */ jsx8(Check, { "aria-hidden": true }),
2780
2965
  state === "busy" ? t.making : t.make
2781
2966
  ] })
2782
2967
  ] })
@@ -2784,9 +2969,9 @@ function NewDocument({ host, t, onClose, onMade }) {
2784
2969
  }
2785
2970
 
2786
2971
  // src/Sharing.tsx
2787
- import { useState as useState7 } from "react";
2788
- import { Ban, CalendarDays, Clock, Copy as Copy2, Download as Download2, Eye, Link, Lock, MessageSquarePlus, Plus as Plus3, Users } from "lucide-react";
2789
- import { Fragment as Fragment6, jsx as jsx7, jsxs as jsxs7 } from "react/jsx-runtime";
2972
+ import { useState as useState8 } from "react";
2973
+ import { Ban, CalendarDays, Clock, Copy as Copy2, Download as Download2, Eye, Link, Lock, MessageSquarePlus, Plus as Plus4, Users } from "lucide-react";
2974
+ import { Fragment as Fragment8, jsx as jsx9, jsxs as jsxs9 } from "react/jsx-runtime";
2790
2975
  var blank3 = { id: null, comment: false, download: false, askName: true, works: "30", day: "", password: false, secret: "", had: false };
2791
2976
  var local = (iso) => {
2792
2977
  const at = new Date(iso);
@@ -2794,9 +2979,9 @@ var local = (iso) => {
2794
2979
  };
2795
2980
  function Sharing({ host, doc, t, language, team }) {
2796
2981
  const links = useLoad((signal) => host.links(doc.id, { signal }), [host, doc.id]);
2797
- const [form, setForm] = useState7(null);
2798
- const [state, setState] = useState7("idle");
2799
- const [copied, setCopied] = useState7(null);
2982
+ const [form, setForm] = useState8(null);
2983
+ const [state, setState] = useState8("idle");
2984
+ const [copied, setCopied] = useState8(null);
2800
2985
  const text = doc.kind === "docx" || doc.kind === "markdown";
2801
2986
  const rules = new Intl.PluralRules(language);
2802
2987
  const count = (n, forms) => `${n} ${forms[rules.select(n)] ?? forms.other}`;
@@ -2858,31 +3043,31 @@ function Sharing({ host, doc, t, language, team }) {
2858
3043
  setCopied(null);
2859
3044
  }
2860
3045
  };
2861
- if (form) return /* @__PURE__ */ jsxs7("div", { className: "w100n-share", children: [
2862
- /* @__PURE__ */ jsxs7("p", { className: "w100n-docs-caption", children: [
2863
- /* @__PURE__ */ jsx7(Link, { "aria-hidden": true }),
3046
+ if (form) return /* @__PURE__ */ jsxs9("div", { className: "w100n-share", children: [
3047
+ /* @__PURE__ */ jsxs9("p", { className: "w100n-docs-caption", children: [
3048
+ /* @__PURE__ */ jsx9(Link, { "aria-hidden": true }),
2864
3049
  form.id ? t.changeLink : t.newLink
2865
3050
  ] }),
2866
- text && /* @__PURE__ */ jsxs7("div", { className: "w100n-share-field", children: [
2867
- /* @__PURE__ */ jsx7("span", { children: t.guestsCan }),
2868
- /* @__PURE__ */ jsxs7("div", { className: "w100n-docs-chips", children: [
2869
- /* @__PURE__ */ jsxs7("button", { type: "button", "aria-pressed": !form.comment, onClick: () => setForm({ ...form, comment: false }), children: [
2870
- /* @__PURE__ */ jsx7(Eye, { "aria-hidden": true }),
3051
+ text && /* @__PURE__ */ jsxs9("div", { className: "w100n-share-field", children: [
3052
+ /* @__PURE__ */ jsx9("span", { children: t.guestsCan }),
3053
+ /* @__PURE__ */ jsxs9("div", { className: "w100n-docs-chips", children: [
3054
+ /* @__PURE__ */ jsxs9("button", { type: "button", "aria-pressed": !form.comment, onClick: () => setForm({ ...form, comment: false }), children: [
3055
+ /* @__PURE__ */ jsx9(Eye, { "aria-hidden": true }),
2871
3056
  t.canRead
2872
3057
  ] }),
2873
- /* @__PURE__ */ jsxs7("button", { type: "button", "aria-pressed": form.comment, onClick: () => setForm({ ...form, comment: true }), children: [
2874
- /* @__PURE__ */ jsx7(MessageSquarePlus, { "aria-hidden": true }),
3058
+ /* @__PURE__ */ jsxs9("button", { type: "button", "aria-pressed": form.comment, onClick: () => setForm({ ...form, comment: true }), children: [
3059
+ /* @__PURE__ */ jsx9(MessageSquarePlus, { "aria-hidden": true }),
2875
3060
  t.canComment
2876
3061
  ] })
2877
3062
  ] })
2878
3063
  ] }),
2879
- /* @__PURE__ */ jsxs7("div", { className: "w100n-share-field", children: [
2880
- /* @__PURE__ */ jsx7("span", { children: t.linkWorks }),
2881
- /* @__PURE__ */ jsx7("div", { className: "w100n-docs-chips", children: [["7", t.days7], ["30", t.days30], ["off", t.untilTurnOff], ["day", t.pickDay]].map(([key, label]) => /* @__PURE__ */ jsxs7("button", { type: "button", "aria-pressed": form.works === key, onClick: () => setForm({ ...form, works: key }), children: [
2882
- key === "day" && /* @__PURE__ */ jsx7(CalendarDays, { "aria-hidden": true }),
3064
+ /* @__PURE__ */ jsxs9("div", { className: "w100n-share-field", children: [
3065
+ /* @__PURE__ */ jsx9("span", { children: t.linkWorks }),
3066
+ /* @__PURE__ */ jsx9("div", { className: "w100n-docs-chips", children: [["7", t.days7], ["30", t.days30], ["off", t.untilTurnOff], ["day", t.pickDay]].map(([key, label]) => /* @__PURE__ */ jsxs9("button", { type: "button", "aria-pressed": form.works === key, onClick: () => setForm({ ...form, works: key }), children: [
3067
+ key === "day" && /* @__PURE__ */ jsx9(CalendarDays, { "aria-hidden": true }),
2883
3068
  label
2884
3069
  ] }, key)) }),
2885
- form.works === "day" && /* @__PURE__ */ jsx7(
3070
+ form.works === "day" && /* @__PURE__ */ jsx9(
2886
3071
  "input",
2887
3072
  {
2888
3073
  type: "date",
@@ -2894,14 +3079,14 @@ function Sharing({ host, doc, t, language, team }) {
2894
3079
  }
2895
3080
  )
2896
3081
  ] }),
2897
- /* @__PURE__ */ jsxs7("label", { className: "w100n-share-toggle", children: [
2898
- /* @__PURE__ */ jsx7("input", { type: "checkbox", checked: form.password, onChange: (e) => setForm({ ...form, password: e.target.checked }) }),
2899
- /* @__PURE__ */ jsxs7("span", { children: [
2900
- /* @__PURE__ */ jsx7("b", { children: t.passwordOn }),
2901
- /* @__PURE__ */ jsx7("small", { children: t.passwordHint })
3082
+ /* @__PURE__ */ jsxs9("label", { className: "w100n-share-toggle", children: [
3083
+ /* @__PURE__ */ jsx9("input", { type: "checkbox", checked: form.password, onChange: (e) => setForm({ ...form, password: e.target.checked }) }),
3084
+ /* @__PURE__ */ jsxs9("span", { children: [
3085
+ /* @__PURE__ */ jsx9("b", { children: t.passwordOn }),
3086
+ /* @__PURE__ */ jsx9("small", { children: t.passwordHint })
2902
3087
  ] })
2903
3088
  ] }),
2904
- form.password && /* @__PURE__ */ jsx7(
3089
+ form.password && /* @__PURE__ */ jsx9(
2905
3090
  "input",
2906
3091
  {
2907
3092
  type: "password",
@@ -2913,120 +3098,120 @@ function Sharing({ host, doc, t, language, team }) {
2913
3098
  onChange: (e) => setForm({ ...form, secret: e.target.value })
2914
3099
  }
2915
3100
  ),
2916
- /* @__PURE__ */ jsxs7("label", { className: "w100n-share-toggle", children: [
2917
- /* @__PURE__ */ jsx7("input", { type: "checkbox", checked: form.download, onChange: (e) => setForm({ ...form, download: e.target.checked }) }),
2918
- /* @__PURE__ */ jsxs7("span", { children: [
2919
- /* @__PURE__ */ jsx7("b", { children: t.downloadFile }),
2920
- /* @__PURE__ */ jsx7("small", { children: t.downloadHint })
3101
+ /* @__PURE__ */ jsxs9("label", { className: "w100n-share-toggle", children: [
3102
+ /* @__PURE__ */ jsx9("input", { type: "checkbox", checked: form.download, onChange: (e) => setForm({ ...form, download: e.target.checked }) }),
3103
+ /* @__PURE__ */ jsxs9("span", { children: [
3104
+ /* @__PURE__ */ jsx9("b", { children: t.downloadFile }),
3105
+ /* @__PURE__ */ jsx9("small", { children: t.downloadHint })
2921
3106
  ] })
2922
3107
  ] }),
2923
- /* @__PURE__ */ jsxs7("label", { className: "w100n-share-toggle", children: [
2924
- /* @__PURE__ */ jsx7("input", { type: "checkbox", checked: form.askName, onChange: (e) => setForm({ ...form, askName: e.target.checked }) }),
2925
- /* @__PURE__ */ jsxs7("span", { children: [
2926
- /* @__PURE__ */ jsx7("b", { children: t.askName }),
2927
- /* @__PURE__ */ jsx7("small", { children: t.askNameHint })
3108
+ /* @__PURE__ */ jsxs9("label", { className: "w100n-share-toggle", children: [
3109
+ /* @__PURE__ */ jsx9("input", { type: "checkbox", checked: form.askName, onChange: (e) => setForm({ ...form, askName: e.target.checked }) }),
3110
+ /* @__PURE__ */ jsxs9("span", { children: [
3111
+ /* @__PURE__ */ jsx9("b", { children: t.askName }),
3112
+ /* @__PURE__ */ jsx9("small", { children: t.askNameHint })
2928
3113
  ] })
2929
3114
  ] }),
2930
- /* @__PURE__ */ jsx7("p", { className: "w100n-docs-muted", children: t.lastSaved }),
2931
- state === "failed" && /* @__PURE__ */ jsx7("p", { className: "w100n-docs-muted", role: "alert", children: t.shareFailed }),
2932
- /* @__PURE__ */ jsxs7("span", { className: "w100n-pdf-dialog-end", children: [
2933
- /* @__PURE__ */ jsx7("button", { type: "button", className: "w100n-pdf-link", onClick: () => {
3115
+ /* @__PURE__ */ jsx9("p", { className: "w100n-docs-muted", children: t.lastSaved }),
3116
+ state === "failed" && /* @__PURE__ */ jsx9("p", { className: "w100n-docs-muted", role: "alert", children: t.shareFailed }),
3117
+ /* @__PURE__ */ jsxs9("span", { className: "w100n-pdf-dialog-end", children: [
3118
+ /* @__PURE__ */ jsx9("button", { type: "button", className: "w100n-pdf-link", onClick: () => {
2934
3119
  setForm(null);
2935
3120
  setState("idle");
2936
3121
  }, children: t.cancel }),
2937
- /* @__PURE__ */ jsxs7("button", { type: "button", className: "w100n-docs-action", disabled: !ready || state === "busy", onClick: () => void submit(), children: [
2938
- /* @__PURE__ */ jsx7(Link, { "aria-hidden": true }),
3122
+ /* @__PURE__ */ jsxs9("button", { type: "button", className: "w100n-docs-action", disabled: !ready || state === "busy", onClick: () => void submit(), children: [
3123
+ /* @__PURE__ */ jsx9(Link, { "aria-hidden": true }),
2939
3124
  form.id ? t.saveLink : t.makeLink
2940
3125
  ] })
2941
3126
  ] })
2942
3127
  ] });
2943
3128
  const on = links.data ?? [];
2944
- return /* @__PURE__ */ jsxs7("div", { className: "w100n-share", children: [
2945
- /* @__PURE__ */ jsxs7("p", { className: "w100n-docs-caption", children: [
2946
- /* @__PURE__ */ jsx7(Link, { "aria-hidden": true }),
3129
+ return /* @__PURE__ */ jsxs9("div", { className: "w100n-share", children: [
3130
+ /* @__PURE__ */ jsxs9("p", { className: "w100n-docs-caption", children: [
3131
+ /* @__PURE__ */ jsx9(Link, { "aria-hidden": true }),
2947
3132
  t.guestLinks,
2948
- on.length > 0 && /* @__PURE__ */ jsx7("span", { children: on.filter((l) => !l.ended).length })
3133
+ on.length > 0 && /* @__PURE__ */ jsx9("span", { children: on.filter((l) => !l.ended).length })
2949
3134
  ] }),
2950
- links.error && /* @__PURE__ */ jsxs7("div", { className: "w100n-docs-note", children: [
3135
+ links.error && /* @__PURE__ */ jsxs9("div", { className: "w100n-docs-note", children: [
2951
3136
  t.failed,
2952
- /* @__PURE__ */ jsx7("button", { type: "button", onClick: links.retry, children: t.retry })
3137
+ /* @__PURE__ */ jsx9("button", { type: "button", onClick: links.retry, children: t.retry })
2953
3138
  ] }),
2954
- links.data && !on.length && /* @__PURE__ */ jsx7("p", { className: "w100n-docs-muted", children: t.noLinks }),
2955
- state === "failed" && /* @__PURE__ */ jsx7("p", { className: "w100n-docs-muted", role: "alert", children: t.shareFailed }),
2956
- on.map((l) => /* @__PURE__ */ jsxs7("article", { className: "w100n-share-link", "data-ended": l.ended, children: [
2957
- /* @__PURE__ */ jsxs7("header", { children: [
2958
- /* @__PURE__ */ jsx7("span", { className: "w100n-share-tile", "data-tone": l.comment ? "amber" : "blue", children: l.comment ? /* @__PURE__ */ jsx7(MessageSquarePlus, { "aria-hidden": true }) : /* @__PURE__ */ jsx7(Eye, { "aria-hidden": true }) }),
2959
- /* @__PURE__ */ jsxs7("span", { children: [
2960
- /* @__PURE__ */ jsx7("b", { children: l.comment ? t.commentLink : t.viewLink }),
2961
- /* @__PURE__ */ jsxs7("small", { children: [
3139
+ links.data && !on.length && /* @__PURE__ */ jsx9("p", { className: "w100n-docs-muted", children: t.noLinks }),
3140
+ state === "failed" && /* @__PURE__ */ jsx9("p", { className: "w100n-docs-muted", role: "alert", children: t.shareFailed }),
3141
+ on.map((l) => /* @__PURE__ */ jsxs9("article", { className: "w100n-share-link", "data-ended": l.ended, children: [
3142
+ /* @__PURE__ */ jsxs9("header", { children: [
3143
+ /* @__PURE__ */ jsx9("span", { className: "w100n-share-tile", "data-tone": l.comment ? "amber" : "blue", children: l.comment ? /* @__PURE__ */ jsx9(MessageSquarePlus, { "aria-hidden": true }) : /* @__PURE__ */ jsx9(Eye, { "aria-hidden": true }) }),
3144
+ /* @__PURE__ */ jsxs9("span", { children: [
3145
+ /* @__PURE__ */ jsx9("b", { children: l.comment ? t.commentLink : t.viewLink }),
3146
+ /* @__PURE__ */ jsxs9("small", { children: [
2962
3147
  t.madeBy.replace("{name}", l.createdBy.name),
2963
3148
  " \xB7 ",
2964
3149
  day(l.createdAt)
2965
3150
  ] })
2966
3151
  ] })
2967
3152
  ] }),
2968
- /* @__PURE__ */ jsxs7("div", { className: "w100n-share-chips", children: [
2969
- /* @__PURE__ */ jsxs7("span", { children: [
2970
- /* @__PURE__ */ jsx7(Clock, { "aria-hidden": true }),
3153
+ /* @__PURE__ */ jsxs9("div", { className: "w100n-share-chips", children: [
3154
+ /* @__PURE__ */ jsxs9("span", { children: [
3155
+ /* @__PURE__ */ jsx9(Clock, { "aria-hidden": true }),
2971
3156
  l.ended ? t.linkEnded : l.endsAt ? t.endsOn.replace("{date}", day(l.endsAt)) : t.untilOff
2972
3157
  ] }),
2973
- l.download && /* @__PURE__ */ jsxs7("span", { children: [
2974
- /* @__PURE__ */ jsx7(Download2, { "aria-hidden": true }),
3158
+ l.download && /* @__PURE__ */ jsxs9("span", { children: [
3159
+ /* @__PURE__ */ jsx9(Download2, { "aria-hidden": true }),
2975
3160
  t.downloadOn
2976
3161
  ] }),
2977
- l.password && /* @__PURE__ */ jsxs7("span", { children: [
2978
- /* @__PURE__ */ jsx7(Lock, { "aria-hidden": true }),
3162
+ l.password && /* @__PURE__ */ jsxs9("span", { children: [
3163
+ /* @__PURE__ */ jsx9(Lock, { "aria-hidden": true }),
2979
3164
  t.passwordOn
2980
3165
  ] }),
2981
- /* @__PURE__ */ jsxs7("span", { children: [
2982
- /* @__PURE__ */ jsx7(Eye, { "aria-hidden": true }),
3166
+ /* @__PURE__ */ jsxs9("span", { children: [
3167
+ /* @__PURE__ */ jsx9(Eye, { "aria-hidden": true }),
2983
3168
  count(l.guests.reduce((n, g) => n + g.opens, 0), t.openForms)
2984
3169
  ] })
2985
3170
  ] }),
2986
- /* @__PURE__ */ jsxs7("div", { className: "w100n-share-url", children: [
2987
- /* @__PURE__ */ jsx7("span", { children: l.url.replace(/^https?:\/\//, "") }),
2988
- /* @__PURE__ */ jsxs7("button", { type: "button", className: "w100n-docs-action", "data-tone": "blue", onClick: () => void copy(l), children: [
2989
- /* @__PURE__ */ jsx7(Copy2, { "aria-hidden": true }),
3171
+ /* @__PURE__ */ jsxs9("div", { className: "w100n-share-url", children: [
3172
+ /* @__PURE__ */ jsx9("span", { children: l.url.replace(/^https?:\/\//, "") }),
3173
+ /* @__PURE__ */ jsxs9("button", { type: "button", className: "w100n-docs-action", "data-tone": "blue", onClick: () => void copy(l), children: [
3174
+ /* @__PURE__ */ jsx9(Copy2, { "aria-hidden": true }),
2990
3175
  copied === l.id ? t.copied : t.copy
2991
3176
  ] })
2992
3177
  ] }),
2993
- l.guests.length > 0 && /* @__PURE__ */ jsx7("div", { className: "w100n-share-who", children: l.guests.map((g, i) => /* @__PURE__ */ jsxs7("div", { children: [
2994
- /* @__PURE__ */ jsx7("span", { className: "w100n-text-face", "aria-hidden": true, children: (g.name || "?").slice(0, 1).toUpperCase() }),
2995
- /* @__PURE__ */ jsx7("b", { children: g.name || t.unnamed }),
2996
- /* @__PURE__ */ jsxs7("small", { children: [
3178
+ l.guests.length > 0 && /* @__PURE__ */ jsx9("div", { className: "w100n-share-who", children: l.guests.map((g, i) => /* @__PURE__ */ jsxs9("div", { children: [
3179
+ /* @__PURE__ */ jsx9("span", { className: "w100n-text-face", "aria-hidden": true, children: (g.name || "?").slice(0, 1).toUpperCase() }),
3180
+ /* @__PURE__ */ jsx9("b", { children: g.name || t.unnamed }),
3181
+ /* @__PURE__ */ jsxs9("small", { children: [
2997
3182
  g.comments ? count(g.comments, t.commentForms) : count(g.opens, t.openForms),
2998
3183
  " \xB7 ",
2999
3184
  ago(g.lastAt)
3000
3185
  ] })
3001
3186
  ] }, i)) }),
3002
- /* @__PURE__ */ jsxs7("div", { className: "w100n-share-tools", children: [
3003
- /* @__PURE__ */ jsxs7("button", { type: "button", className: "w100n-docs-action", "data-tone": "slate", disabled: state === "busy", onClick: () => edit(l), children: [
3004
- /* @__PURE__ */ jsx7(Clock, { "aria-hidden": true }),
3187
+ /* @__PURE__ */ jsxs9("div", { className: "w100n-share-tools", children: [
3188
+ /* @__PURE__ */ jsxs9("button", { type: "button", className: "w100n-docs-action", "data-tone": "slate", disabled: state === "busy", onClick: () => edit(l), children: [
3189
+ /* @__PURE__ */ jsx9(Clock, { "aria-hidden": true }),
3005
3190
  t.changeLink
3006
3191
  ] }),
3007
- /* @__PURE__ */ jsxs7("button", { type: "button", className: "w100n-docs-action", "data-tone": "red", disabled: state === "busy", onClick: () => void off(l), children: [
3008
- /* @__PURE__ */ jsx7(Ban, { "aria-hidden": true }),
3192
+ /* @__PURE__ */ jsxs9("button", { type: "button", className: "w100n-docs-action", "data-tone": "red", disabled: state === "busy", onClick: () => void off(l), children: [
3193
+ /* @__PURE__ */ jsx9(Ban, { "aria-hidden": true }),
3009
3194
  t.turnOff
3010
3195
  ] })
3011
3196
  ] })
3012
3197
  ] }, l.id)),
3013
- /* @__PURE__ */ jsxs7("button", { type: "button", className: "w100n-docs-action w100n-share-new", onClick: () => {
3198
+ /* @__PURE__ */ jsxs9("button", { type: "button", className: "w100n-docs-action w100n-share-new", onClick: () => {
3014
3199
  setState("idle");
3015
3200
  setForm(blank3);
3016
3201
  }, children: [
3017
- /* @__PURE__ */ jsx7(Plus3, { "aria-hidden": true }),
3202
+ /* @__PURE__ */ jsx9(Plus4, { "aria-hidden": true }),
3018
3203
  t.newLink
3019
3204
  ] }),
3020
- team && /* @__PURE__ */ jsxs7(Fragment6, { children: [
3021
- /* @__PURE__ */ jsxs7("p", { className: "w100n-docs-caption", children: [
3022
- /* @__PURE__ */ jsx7(Users, { "aria-hidden": true }),
3205
+ team && /* @__PURE__ */ jsxs9(Fragment8, { children: [
3206
+ /* @__PURE__ */ jsxs9("p", { className: "w100n-docs-caption", children: [
3207
+ /* @__PURE__ */ jsx9(Users, { "aria-hidden": true }),
3023
3208
  t.inTeam
3024
3209
  ] }),
3025
- /* @__PURE__ */ jsxs7("div", { className: "w100n-share-team", children: [
3026
- /* @__PURE__ */ jsx7("span", { className: "w100n-share-tile", children: /* @__PURE__ */ jsx7(Users, { "aria-hidden": true }) }),
3027
- /* @__PURE__ */ jsxs7("span", { children: [
3028
- /* @__PURE__ */ jsx7("b", { children: t.peopleOf.replace("{space}", team) }),
3029
- /* @__PURE__ */ jsx7("small", { children: t.teamHint })
3210
+ /* @__PURE__ */ jsxs9("div", { className: "w100n-share-team", children: [
3211
+ /* @__PURE__ */ jsx9("span", { className: "w100n-share-tile", children: /* @__PURE__ */ jsx9(Users, { "aria-hidden": true }) }),
3212
+ /* @__PURE__ */ jsxs9("span", { children: [
3213
+ /* @__PURE__ */ jsx9("b", { children: t.peopleOf.replace("{space}", team) }),
3214
+ /* @__PURE__ */ jsx9("small", { children: t.teamHint })
3030
3215
  ] })
3031
3216
  ] })
3032
3217
  ] })
@@ -3034,7 +3219,7 @@ function Sharing({ host, doc, t, language, team }) {
3034
3219
  }
3035
3220
 
3036
3221
  // src/Thumb.tsx
3037
- import { useEffect as useEffect5, useRef as useRef5, useState as useState8 } from "react";
3222
+ import { useEffect as useEffect5, useRef as useRef5, useState as useState9 } from "react";
3038
3223
 
3039
3224
  // src/preview.ts
3040
3225
  var cache = /* @__PURE__ */ new Map();
@@ -3087,11 +3272,11 @@ function preview(host, doc) {
3087
3272
  }
3088
3273
 
3089
3274
  // src/Thumb.tsx
3090
- import { Fragment as Fragment7, jsx as jsx8, jsxs as jsxs8 } from "react/jsx-runtime";
3275
+ import { Fragment as Fragment9, jsx as jsx10, jsxs as jsxs10 } from "react/jsx-runtime";
3091
3276
  function Thumb({ host, item, label }) {
3092
3277
  const box = useRef5(null);
3093
- const [seen, setSeen] = useState8(false);
3094
- const [shot, setShot] = useState8(null);
3278
+ const [seen, setSeen] = useState9(false);
3279
+ const [shot, setShot] = useState9(null);
3095
3280
  useEffect5(() => {
3096
3281
  if (item.thumbnailUrl || item.excerpt || typeof IntersectionObserver === "undefined") return;
3097
3282
  const watch = new IntersectionObserver((entries) => {
@@ -3113,45 +3298,219 @@ function Thumb({ host, item, label }) {
3113
3298
  const text = item.excerpt ?? shot?.text ?? "";
3114
3299
  const lines = text.split("\n").filter((line) => !line.trim().startsWith("```")).map((line) => line.replace(/^#+\s*/, "").replace(/[*_`>|]/g, "").trim()).filter(Boolean);
3115
3300
  const image = item.thumbnailUrl ?? shot?.image;
3116
- return /* @__PURE__ */ jsxs8("span", { ref: box, className: "w100n-docs-thumb", "data-kind": item.kind, children: [
3117
- image ? /* @__PURE__ */ jsx8("img", { src: image, alt: "" }) : /* @__PURE__ */ jsx8("span", { className: "w100n-docs-paper", "aria-hidden": true, children: lines.length ? /* @__PURE__ */ jsxs8(Fragment7, { children: [
3118
- /* @__PURE__ */ jsx8("b", { children: lines[0] }),
3301
+ return /* @__PURE__ */ jsxs10("span", { ref: box, className: "w100n-docs-thumb", "data-kind": item.kind, children: [
3302
+ image ? /* @__PURE__ */ jsx10("img", { src: image, alt: "" }) : /* @__PURE__ */ jsx10("span", { className: "w100n-docs-paper", "aria-hidden": true, children: lines.length ? /* @__PURE__ */ jsxs10(Fragment9, { children: [
3303
+ /* @__PURE__ */ jsx10("b", { children: lines[0] }),
3119
3304
  lines.slice(1, 14).join(" ")
3120
- ] }) : /* @__PURE__ */ jsxs8(Fragment7, { children: [
3121
- /* @__PURE__ */ jsx8("i", {}),
3122
- /* @__PURE__ */ jsx8("i", {}),
3123
- /* @__PURE__ */ jsx8("i", {}),
3124
- /* @__PURE__ */ jsx8("i", {}),
3125
- /* @__PURE__ */ jsx8("i", {})
3305
+ ] }) : /* @__PURE__ */ jsxs10(Fragment9, { children: [
3306
+ /* @__PURE__ */ jsx10("i", {}),
3307
+ /* @__PURE__ */ jsx10("i", {}),
3308
+ /* @__PURE__ */ jsx10("i", {}),
3309
+ /* @__PURE__ */ jsx10("i", {}),
3310
+ /* @__PURE__ */ jsx10("i", {})
3126
3311
  ] }) }),
3127
- label && /* @__PURE__ */ jsx8("span", { className: "w100n-docs-kind", "data-kind": item.kind, children: label })
3312
+ label && /* @__PURE__ */ jsx10("span", { className: "w100n-docs-kind", "data-kind": item.kind, children: label })
3313
+ ] });
3314
+ }
3315
+
3316
+ // src/Tree.tsx
3317
+ import { useState as useState10 } from "react";
3318
+ import { ChevronDown as ChevronDown2, ChevronRight as ChevronRight2, FileSpreadsheet as FileSpreadsheet3, FileText as FileText3, FileType as FileType5, Files as Files2, Folder, Presentation as Presentation3 } from "lucide-react";
3319
+ import { Fragment as Fragment10, jsx as jsx11, jsxs as jsxs11 } from "react/jsx-runtime";
3320
+ var icons3 = { docx: FileText3, markdown: FileType5, pdf: Files2, sheet: FileSpreadsheet3, slides: Presentation3 };
3321
+ var dragged = "application/x-w100n-document";
3322
+ function grow(items, folders, names2, spaceId, other) {
3323
+ const root = { key: "", name: "", at: spaceId ? { spaceId, folder: "" } : null, folders: [], files: [], count: 0 };
3324
+ const step = (from, name, at, count) => {
3325
+ const key = `${from.key}/${name}`;
3326
+ let next = from.folders.find((f) => f.key === key);
3327
+ if (!next) from.folders.push(next = { key, name, at, folders: [], files: [], count: 0 });
3328
+ if (count) next.count++;
3329
+ return next;
3330
+ };
3331
+ const reach = (space, folder2, count) => {
3332
+ if (count) root.count++;
3333
+ let at = spaceId ? root : step(root, names2.get(space) ?? other, { spaceId: space, folder: "" }, count);
3334
+ let path = "";
3335
+ for (const part of folder2.split("/").filter(Boolean)) {
3336
+ path = path ? `${path}/${part}` : part;
3337
+ at = step(at, part, { spaceId: space, folder: path }, count);
3338
+ }
3339
+ return at;
3340
+ };
3341
+ if (!spaceId) {
3342
+ for (const id of names2.keys()) if (folders.has(id)) reach(id, "", false);
3343
+ }
3344
+ for (const [space, paths] of folders) for (const path of paths) reach(space, path, false);
3345
+ for (const item of items) reach(item.spaceId, item.folder ?? "", true).files.push(item);
3346
+ const sort = (b) => {
3347
+ b.folders.sort((x, y) => x.name.localeCompare(y.name));
3348
+ b.files.sort((x, y) => x.name.localeCompare(y.name));
3349
+ b.folders.forEach(sort);
3350
+ };
3351
+ sort(root);
3352
+ return root;
3353
+ }
3354
+ var remembered = () => {
3355
+ try {
3356
+ return new Set(JSON.parse(localStorage.getItem("w100n-docs-closed") ?? "[]"));
3357
+ } catch {
3358
+ return /* @__PURE__ */ new Set();
3359
+ }
3360
+ };
3361
+ function Tree({ items, folders, names: names2, spaceId, current, t, edit, onOpen, onMenu, onFolderMenu, onMove, onEdit, onEditDone, onWarm }) {
3362
+ const [closed, setClosed] = useState10(remembered);
3363
+ const [over, setOver] = useState10(null);
3364
+ const flip = (key) => {
3365
+ const next = new Set(closed);
3366
+ if (!next.delete(key)) next.add(key);
3367
+ setClosed(next);
3368
+ localStorage.setItem("w100n-docs-closed", JSON.stringify([...next]));
3369
+ };
3370
+ const field = (pad, label) => /* @__PURE__ */ jsx11(
3371
+ "input",
3372
+ {
3373
+ className: "w100n-tree-row w100n-tree-input",
3374
+ style: { paddingLeft: pad },
3375
+ autoFocus: true,
3376
+ value: edit.text,
3377
+ "aria-label": label,
3378
+ onFocus: (e) => e.currentTarget.select(),
3379
+ onChange: (e) => onEdit(e.target.value),
3380
+ onBlur: onEditDone,
3381
+ onKeyDown: (e) => {
3382
+ if (e.key === "Enter") e.currentTarget.blur();
3383
+ if (e.key === "Escape") {
3384
+ e.stopPropagation();
3385
+ onEdit(null);
3386
+ }
3387
+ }
3388
+ }
3389
+ );
3390
+ const target = (b) => onMove && b.at ? {
3391
+ onDragOver: (e) => {
3392
+ if (!e.dataTransfer.types.includes(dragged)) return;
3393
+ e.preventDefault();
3394
+ e.stopPropagation();
3395
+ setOver(b.key);
3396
+ },
3397
+ onDragLeave: () => setOver(null),
3398
+ onDrop: (e) => {
3399
+ const id = e.dataTransfer.getData(dragged);
3400
+ setOver(null);
3401
+ if (!id) return;
3402
+ e.preventDefault();
3403
+ e.stopPropagation();
3404
+ onMove(id, b.at);
3405
+ }
3406
+ } : {};
3407
+ const branch = (b, depth) => /* @__PURE__ */ jsxs11(Fragment10, { children: [
3408
+ edit?.key === `new:${b.key}` && field(24 + depth * 16, t.folderName),
3409
+ b.folders.map((f) => {
3410
+ const open = !closed.has(f.key) || edit?.key === `new:${f.key}`;
3411
+ return /* @__PURE__ */ jsxs11("div", { role: "group", "aria-label": f.name, "data-over": over === f.key || void 0, ...target(f), children: [
3412
+ edit?.key === `dir:${f.key}` ? field(24 + depth * 16, t.renameFolder) : /* @__PURE__ */ jsxs11(
3413
+ "button",
3414
+ {
3415
+ type: "button",
3416
+ className: "w100n-tree-row",
3417
+ "aria-expanded": open,
3418
+ style: { paddingLeft: 24 + depth * 16 },
3419
+ onClick: () => flip(f.key),
3420
+ onContextMenu: onFolderMenu && f.at ? (e) => {
3421
+ e.preventDefault();
3422
+ e.stopPropagation();
3423
+ onFolderMenu(f.at, f.key, e);
3424
+ } : void 0,
3425
+ children: [
3426
+ open ? /* @__PURE__ */ jsx11(ChevronDown2, { "aria-hidden": true, className: "w100n-tree-fold" }) : /* @__PURE__ */ jsx11(ChevronRight2, { "aria-hidden": true, className: "w100n-tree-fold" }),
3427
+ /* @__PURE__ */ jsx11(Folder, { "aria-hidden": true }),
3428
+ /* @__PURE__ */ jsx11("span", { children: f.name }),
3429
+ f.count > 0 && /* @__PURE__ */ jsx11("small", { children: f.count })
3430
+ ]
3431
+ }
3432
+ ),
3433
+ open && branch(f, depth + 1)
3434
+ ] }, f.key);
3435
+ }),
3436
+ b.files.map((item) => {
3437
+ const Icon = icons3[item.kind];
3438
+ if (edit?.key === `file:${item.id}`) return /* @__PURE__ */ jsx11("div", { children: field(24 + depth * 16, t.rename) }, item.id);
3439
+ return /* @__PURE__ */ jsxs11(
3440
+ "button",
3441
+ {
3442
+ type: "button",
3443
+ className: "w100n-tree-row",
3444
+ "aria-current": item.id === current,
3445
+ title: item.name,
3446
+ style: { paddingLeft: 24 + depth * 16 },
3447
+ draggable: !!onMove,
3448
+ onDragStart: (e) => {
3449
+ e.dataTransfer.setData(dragged, item.id);
3450
+ e.dataTransfer.effectAllowed = "move";
3451
+ },
3452
+ onClick: () => onOpen(item),
3453
+ onPointerEnter: () => onWarm(item),
3454
+ onPointerLeave: () => onWarm(null),
3455
+ onContextMenu: (e) => {
3456
+ e.preventDefault();
3457
+ e.stopPropagation();
3458
+ onMenu(item, e);
3459
+ },
3460
+ children: [
3461
+ /* @__PURE__ */ jsx11(Icon, { "aria-hidden": true }),
3462
+ /* @__PURE__ */ jsx11("span", { children: item.name.replace(/\.[^.]+$/, "") }),
3463
+ item.kind !== "markdown" && /* @__PURE__ */ jsx11("small", { className: "w100n-tree-kind", children: t.kinds[item.kind] })
3464
+ ]
3465
+ },
3466
+ item.id
3467
+ );
3468
+ })
3128
3469
  ] });
3470
+ const root = grow(items, folders, names2, spaceId, t.elsewhere);
3471
+ return /* @__PURE__ */ jsx11(
3472
+ "nav",
3473
+ {
3474
+ className: "w100n-tree",
3475
+ "aria-label": t.tree,
3476
+ "data-over": over === "" || void 0,
3477
+ ...target(root),
3478
+ onContextMenu: onFolderMenu && root.at ? (e) => {
3479
+ e.preventDefault();
3480
+ onFolderMenu(root.at, "", e);
3481
+ } : void 0,
3482
+ children: branch(root, 0)
3483
+ }
3484
+ );
3129
3485
  }
3130
3486
 
3131
3487
  // src/DocumentsWorkspace.tsx
3132
- import { Fragment as Fragment8, jsx as jsx9, jsxs as jsxs9 } from "react/jsx-runtime";
3133
- var TextEditor2 = lazy2(() => import("./TextEditor-5S7FSLIZ.js"));
3134
- var SheetView2 = lazy2(() => import("./SheetView-OEKOHMKW.js"));
3135
- var Compare = lazy2(() => import("./Compare-M57FG4R3.js"));
3136
- var icons3 = { docx: FileText3, markdown: FileType3, pdf: Files2, sheet: FileSpreadsheet3, slides: Presentation3 };
3488
+ import { Fragment as Fragment11, jsx as jsx12, jsxs as jsxs12 } from "react/jsx-runtime";
3489
+ var TextEditor2 = lazy2(() => import("./TextEditor-CYS4U5XA.js"));
3490
+ var SheetView2 = lazy2(() => import("./SheetView-43JDIP7D.js"));
3491
+ var Compare = lazy2(() => import("./Compare-RHAUAKUJ.js"));
3492
+ var icons4 = { docx: FileText4, markdown: FileType6, pdf: Files3, sheet: FileSpreadsheet4, slides: Presentation4 };
3137
3493
  function DocumentsWorkspace({ host, language = "en", theme = "light", place, onPlace, start, end, aside, actions }) {
3138
3494
  const t = texts[language];
3139
- const [own, setOwn] = useState9({ spaceId: null, documentId: null });
3495
+ const [own, setOwn] = useState11({ spaceId: null, documentId: null });
3140
3496
  const here = place ?? own;
3141
3497
  const go = (next) => {
3142
3498
  setOwn(next);
3143
3499
  onPlace?.(next);
3144
3500
  };
3145
- const [query, setQuery] = useState9("");
3146
- const [picked, setPicked] = useState9([]);
3147
- const [typing, setTyping] = useState9(false);
3148
- const [menusAt, setMenusAt] = useState9(null);
3149
- const [renaming, setRenaming] = useState9(null);
3150
- const [renamed, setRenamed] = useState9("idle");
3151
- const [statusAt, setStatusAt] = useState9(null);
3152
- const [listOpen, setListOpen] = useState9(true);
3153
- const [panelOpen, setPanelOpen] = useState9(true);
3154
- const [narrow, setNarrow] = useState9(false);
3501
+ const [query, setQuery] = useState11("");
3502
+ const [picked, setPicked] = useState11([]);
3503
+ const [typing, setTyping] = useState11(false);
3504
+ const [menusAt, setMenusAt] = useState11(null);
3505
+ const [renaming, setRenaming] = useState11(null);
3506
+ const [renamed, setRenamed] = useState11("idle");
3507
+ const [statusAt, setStatusAt] = useState11(null);
3508
+ const [listOpen, setListOpen] = useState11(true);
3509
+ const [shape2, setShape] = useState11(() => typeof localStorage !== "undefined" && localStorage.getItem("w100n-docs-view") === "tree" ? "tree" : "cards");
3510
+ const [jump, setJump] = useState11(null);
3511
+ const finder = useRef6(null);
3512
+ const [panelOpen, setPanelOpen] = useState11(true);
3513
+ const [narrow, setNarrow] = useState11(false);
3155
3514
  const body = useRef6(null);
3156
3515
  const listButton = useRef6(null);
3157
3516
  const panelButton = useRef6(null);
@@ -3176,8 +3535,8 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place, onP
3176
3535
  watch.observe(el);
3177
3536
  return () => watch.disconnect();
3178
3537
  }, [here.documentId]);
3179
- const [picking, setPicking] = useState9(false);
3180
- const [adding, setAdding] = useState9(false);
3538
+ const [picking, setPicking] = useState11(false);
3539
+ const [adding, setAdding] = useState11(false);
3181
3540
  useEffect6(() => {
3182
3541
  if (!adding) return;
3183
3542
  const close = (e) => {
@@ -3202,17 +3561,20 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place, onP
3202
3561
  document.addEventListener("pointerdown", close);
3203
3562
  return () => document.removeEventListener("pointerdown", close);
3204
3563
  }, [picking]);
3205
- const [menu, setMenu] = useState9(null);
3206
- const [naming, setNaming] = useState9(null);
3207
- const [notice, setNotice] = useState9(null);
3564
+ const [menu, setMenu] = useState11(null);
3565
+ const [spot2, setSpot] = useState11(null);
3566
+ const [edit, setEdit] = useState11(null);
3567
+ const [naming, setNaming] = useState11(null);
3568
+ const [notice, setNotice] = useState11(null);
3208
3569
  const early = useRef6(/* @__PURE__ */ new Map());
3209
3570
  const hover = useRef6(0);
3210
3571
  useEffect6(() => {
3211
- if (!menu) return;
3572
+ if (!menu && !spot2) return;
3212
3573
  const close = (e) => {
3213
3574
  if (e.type === "pointerdown" && e.target.closest(".w100n-docs-context")) return;
3214
3575
  if (e.type === "keydown" && e.key !== "Escape") return;
3215
3576
  setMenu(null);
3577
+ setSpot(null);
3216
3578
  };
3217
3579
  document.addEventListener("pointerdown", close);
3218
3580
  window.addEventListener("keydown", close);
@@ -3222,22 +3584,22 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place, onP
3222
3584
  window.removeEventListener("keydown", close);
3223
3585
  window.removeEventListener("scroll", close, true);
3224
3586
  };
3225
- }, [menu]);
3226
- const [tab, setTab] = useState9("outline");
3227
- const [outline, setOutline] = useState9([]);
3228
- const [reading, setReading] = useState9(null);
3229
- const [hunt, setHunt] = useState9("");
3230
- const [fold, setFold] = useState9({});
3231
- const [version, setVersion] = useState9({ documentId: null, id: null });
3587
+ }, [menu, spot2]);
3588
+ const [tab, setTab] = useState11("outline");
3589
+ const [outline, setOutline] = useState11([]);
3590
+ const [reading, setReading] = useState11(null);
3591
+ const [hunt, setHunt] = useState11("");
3592
+ const [fold, setFold] = useState11({});
3593
+ const [version, setVersion] = useState11({ documentId: null, id: null });
3232
3594
  const versionId = version.documentId === here.documentId ? version.id : null;
3233
- const [comparing, setComparing] = useState9(false);
3234
- const [restoring, setRestoring] = useState9("idle");
3235
- const [exporting, setExporting] = useState9("idle");
3236
- const [copying, setCopying] = useState9("idle");
3237
- const [kept, setKept] = useState9(null);
3238
- const [box, setBox] = useState9(null);
3239
- const [making, setMaking] = useState9(false);
3240
- const [sending, setSending] = useState9("idle");
3595
+ const [comparing, setComparing] = useState11(false);
3596
+ const [restoring, setRestoring] = useState11("idle");
3597
+ const [exporting, setExporting] = useState11("idle");
3598
+ const [copying, setCopying] = useState11("idle");
3599
+ const [kept, setKept] = useState11(null);
3600
+ const [box, setBox] = useState11(null);
3601
+ const [making, setMaking] = useState11(false);
3602
+ const [sending, setSending] = useState11("idle");
3241
3603
  const upload = useRef6(null);
3242
3604
  const spaces = useLoad((signal) => host.spaces({ signal }), [host]);
3243
3605
  const single = spaces.data?.length === 1 ? spaces.data[0].id : null;
@@ -3249,11 +3611,17 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place, onP
3249
3611
  const all2 = await host.spaces({ signal });
3250
3612
  return (await Promise.all(all2.map((item) => host.documents(item.id, { signal })))).flat();
3251
3613
  }, [host, spaceId]);
3614
+ const dirs = useLoad(async (signal) => {
3615
+ if (!host.folders) return /* @__PURE__ */ new Map();
3616
+ const ids = spaceId ? [spaceId] : (await host.spaces({ signal })).map((item) => item.id);
3617
+ return new Map(await Promise.all(ids.map(async (id) => [id, await host.folders(id, { signal })])));
3618
+ }, [host, spaceId]);
3252
3619
  useEffect6(() => {
3253
3620
  const sync = () => {
3254
3621
  if (document.visibilityState !== "visible") return;
3255
3622
  spaces.retry();
3256
3623
  list.retry();
3624
+ dirs.retry();
3257
3625
  };
3258
3626
  const timer = window.setInterval(sync, 3e4);
3259
3627
  window.addEventListener("focus", sync);
@@ -3302,9 +3670,9 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place, onP
3302
3670
  return new Intl.DateTimeFormat(language, { day: "numeric", month: "short", year: "numeric" }).format(new Date(iso));
3303
3671
  };
3304
3672
  const size = (bytes) => bytes < 1024 ? `${bytes} B` : bytes < 1048576 ? `${(bytes / 1024).toFixed(0)} KB` : `${(bytes / 1048576).toFixed(1)} MB`;
3305
- const failed = (retry) => /* @__PURE__ */ jsxs9("div", { className: "w100n-docs-note", children: [
3673
+ const failed = (retry) => /* @__PURE__ */ jsxs12("div", { className: "w100n-docs-note", children: [
3306
3674
  t.failed,
3307
- /* @__PURE__ */ jsx9("button", { type: "button", onClick: retry, children: t.retry })
3675
+ /* @__PURE__ */ jsx12("button", { type: "button", onClick: retry, children: t.retry })
3308
3676
  ] });
3309
3677
  const { ask, dialog } = useUnsaved(guard, t);
3310
3678
  const side = (which, open2) => {
@@ -3316,12 +3684,21 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place, onP
3316
3684
  if (which === "list") (open2 ? listClose : listButton).current?.focus();
3317
3685
  else (open2 ? panel.current?.querySelector('[aria-selected="true"]') : panelButton.current)?.focus();
3318
3686
  };
3687
+ const leave = (then) => {
3688
+ const save = doc.data?.kind === "markdown" ? guard.current : null;
3689
+ if (!save) return ask(then);
3690
+ void save().then((ok) => {
3691
+ if (!ok) return ask(then);
3692
+ guard.current = null;
3693
+ then();
3694
+ });
3695
+ };
3319
3696
  const open = (item) => {
3320
3697
  if (item.id === here.documentId) {
3321
3698
  if (narrow) setListOpen(false);
3322
3699
  return;
3323
3700
  }
3324
- ask(() => {
3701
+ leave(() => {
3325
3702
  setOutline([]);
3326
3703
  setHunt("");
3327
3704
  setFold({});
@@ -3408,8 +3785,8 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place, onP
3408
3785
  clearTimeout(hover.current);
3409
3786
  hover.current = window.setTimeout(() => {
3410
3787
  if (item.id === here.documentId) return;
3411
- if (item.kind === "docx" || item.kind === "markdown") void import("./TextEditor-5S7FSLIZ.js");
3412
- if (item.kind === "sheet") void import("./SheetView-OEKOHMKW.js");
3788
+ if (item.kind === "docx" || item.kind === "markdown") void import("./TextEditor-CYS4U5XA.js");
3789
+ if (item.kind === "sheet") void import("./SheetView-43JDIP7D.js");
3413
3790
  const kept2 = early.current.get(item.id);
3414
3791
  if (kept2 && Date.now() - kept2.at < 15e3 || item.size > 5e6) return;
3415
3792
  const next = { at: Date.now(), doc: host.document(item.id), bytes: host.content(item.id, null) };
@@ -3422,6 +3799,7 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place, onP
3422
3799
  };
3423
3800
  const act = async (run2, done) => {
3424
3801
  setMenu(null);
3802
+ setSpot(null);
3425
3803
  setNotice(null);
3426
3804
  try {
3427
3805
  await run2();
@@ -3478,8 +3856,79 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place, onP
3478
3856
  setSending("failed");
3479
3857
  }
3480
3858
  };
3481
- let stage = /* @__PURE__ */ jsxs9("div", { className: "w100n-docs-empty", children: [
3482
- /* @__PURE__ */ jsx9(FileText3, { "aria-hidden": true }),
3859
+ const refresh = () => {
3860
+ list.retry();
3861
+ dirs.retry();
3862
+ };
3863
+ const moveTo = (item, to) => {
3864
+ if (item.spaceId === to.spaceId && (item.folder ?? "") === to.folder) return setMenu(null);
3865
+ void act(() => host.move(item.id, to)).then(refresh);
3866
+ };
3867
+ const folderNamed = (at) => at.folder.split("/").pop() || names2.get(at.spaceId) || t.topLevel;
3868
+ const commit = () => {
3869
+ if (!edit) return;
3870
+ setEdit(null);
3871
+ const text2 = edit.text.trim();
3872
+ if (text2) void edit.run(text2);
3873
+ };
3874
+ const notes = doc.data?.kind === "markdown" ? all.filter((item) => item.kind === "markdown" && item.spaceId === doc.data.spaceId) : [];
3875
+ const note = async (name, show, at) => {
3876
+ try {
3877
+ const made = await host.create({ name: `${name}.md`, bytes: new TextEncoder().encode("").buffer, mimeType: "text/markdown", near: at ? void 0 : here.documentId ?? void 0, at });
3878
+ list.retry();
3879
+ if (show) opened(made);
3880
+ return made.id;
3881
+ } catch {
3882
+ setNotice(t.actionFailed);
3883
+ return null;
3884
+ }
3885
+ };
3886
+ const wiki = doc.data?.kind === "markdown" ? {
3887
+ notes: notes.map(({ id, name, folder: folder2 }) => ({ id, name, folder: folder2 })),
3888
+ open: (id) => {
3889
+ const item = all.find((x) => x.id === id);
3890
+ if (item) open(item);
3891
+ },
3892
+ create: host.create ? (name) => note(name, false) : void 0
3893
+ } : void 0;
3894
+ const panelOn = (next) => {
3895
+ setTab(next);
3896
+ side("panel", true);
3897
+ };
3898
+ const current = doc.data && all.find((item) => item.id === doc.data.id);
3899
+ const commands = [
3900
+ ...host.create ? [{ id: "new", label: t.newNote, icon: FilePlus, keys: "\u2318N", run: () => void note(t.untitled, true) }] : [],
3901
+ { id: "open", label: t.openNote, icon: Search3, keys: "\u2318O", run: () => setJump("open") },
3902
+ { id: "search", label: t.searchAll, icon: Search3, run: () => {
3903
+ side("list", true);
3904
+ requestAnimationFrame(() => finder.current?.focus());
3905
+ } },
3906
+ ...doc.data ? [
3907
+ { id: "outline", label: t.showOutline, icon: ListTree, run: () => panelOn("outline") },
3908
+ ...doc.data.kind === "markdown" ? [{ id: "links", label: t.showLinks, icon: Link22, run: () => panelOn("links") }] : [],
3909
+ { id: "versions", label: t.showVersions, icon: History, run: () => panelOn("versions") },
3910
+ ...text && host.comments ? [{ id: "comments", label: t.showComments, icon: MessagesSquare, run: () => panelOn("comments") }] : [],
3911
+ ...host.send && !doc.data.id.includes(":") ? [{ id: "send", label: t.sendChat, icon: Send, run: () => host.send(doc.data.id) }] : [],
3912
+ ...host.rename && doc.data.rights.edit ? [{ id: "rename", label: t.rename, icon: Pencil, run: () => setRenaming(doc.data.name.replace(/\.[^.]+$/, "")) }] : [],
3913
+ ...host.remove && current ? [{ id: "trash", label: t.trash, icon: Trash24, run: () => void drop2(current) }] : []
3914
+ ] : []
3915
+ ];
3916
+ useEffect6(() => {
3917
+ const press = (e) => {
3918
+ if (!(e.metaKey || e.ctrlKey) || e.altKey || e.shiftKey) return;
3919
+ const key = e.key.toLowerCase();
3920
+ if (key === "o" || key === "p" && doc.data?.kind !== "docx" && doc.data?.kind !== "pdf" || key === "n" && host.create && doc.data?.kind === "markdown") {
3921
+ e.preventDefault();
3922
+ e.stopPropagation();
3923
+ if (key === "n") void note(t.untitled, true);
3924
+ else setJump(key === "o" ? "open" : "run");
3925
+ }
3926
+ };
3927
+ window.addEventListener("keydown", press, true);
3928
+ return () => window.removeEventListener("keydown", press, true);
3929
+ });
3930
+ let stage = /* @__PURE__ */ jsxs12("div", { className: "w100n-docs-empty", children: [
3931
+ /* @__PURE__ */ jsx12(FileText4, { "aria-hidden": true }),
3483
3932
  t.pick
3484
3933
  ] });
3485
3934
  if (here.documentId) {
@@ -3487,9 +3936,9 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place, onP
3487
3936
  doc.retry();
3488
3937
  content.retry();
3489
3938
  });
3490
- else if (!doc.data || !content.data) stage = /* @__PURE__ */ jsx9("div", { className: "w100n-docs-empty", children: t.loading });
3491
- else if (comparing && versionId && (doc.data.kind === "markdown" || doc.data.kind === "docx")) stage = /* @__PURE__ */ jsx9(Suspense2, { fallback: /* @__PURE__ */ jsx9("div", { className: "w100n-docs-empty", children: t.loading }), children: /* @__PURE__ */ jsx9(Compare, { host, documentId: doc.data.id, kind: doc.data.kind, older: content.data, t }, versionId) });
3492
- else if (doc.data.kind === "markdown" || doc.data.kind === "docx") stage = /* @__PURE__ */ jsx9(Suspense2, { fallback: /* @__PURE__ */ jsx9("div", { className: "w100n-docs-empty", children: t.loading }), children: /* @__PURE__ */ jsx9(
3939
+ else if (!doc.data || !content.data) stage = /* @__PURE__ */ jsx12("div", { className: "w100n-docs-empty", children: t.loading });
3940
+ else if (comparing && versionId && (doc.data.kind === "markdown" || doc.data.kind === "docx")) stage = /* @__PURE__ */ jsx12(Suspense2, { fallback: /* @__PURE__ */ jsx12("div", { className: "w100n-docs-empty", children: t.loading }), children: /* @__PURE__ */ jsx12(Compare, { host, documentId: doc.data.id, kind: doc.data.kind, older: content.data, t }, versionId) });
3941
+ else if (doc.data.kind === "markdown" || doc.data.kind === "docx") stage = /* @__PURE__ */ jsx12(Suspense2, { fallback: /* @__PURE__ */ jsx12("div", { className: "w100n-docs-empty", children: t.loading }), children: /* @__PURE__ */ jsx12(
3493
3942
  TextEditor2,
3494
3943
  {
3495
3944
  kind: doc.data.kind,
@@ -3510,6 +3959,7 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place, onP
3510
3959
  slot: tab === "comments" && panelOpen ? box : null,
3511
3960
  head: docbar ? { menus: menusAt, status: statusAt } : void 0,
3512
3961
  guard,
3962
+ wiki: versionId ? void 0 : wiki,
3513
3963
  file: versionId ? void 0 : {
3514
3964
  formats: host.exportAs ? doc.data.exports ?? [] : [],
3515
3965
  download: (f) => void exportAs(doc.data, f),
@@ -3525,7 +3975,7 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place, onP
3525
3975
  },
3526
3976
  doc.data.id
3527
3977
  ) });
3528
- else if (doc.data.kind === "pdf") stage = /* @__PURE__ */ jsx9(
3978
+ else if (doc.data.kind === "pdf") stage = /* @__PURE__ */ jsx12(
3529
3979
  PdfView,
3530
3980
  {
3531
3981
  bytes: content.data,
@@ -3547,7 +3997,7 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place, onP
3547
3997
  },
3548
3998
  `${doc.data.id}:${versionId ?? ""}`
3549
3999
  );
3550
- else if (doc.data.kind === "slides") stage = /* @__PURE__ */ jsx9(
4000
+ else if (doc.data.kind === "slides") stage = /* @__PURE__ */ jsx12(
3551
4001
  SlidesView,
3552
4002
  {
3553
4003
  html: new TextDecoder().decode(content.data),
@@ -3557,8 +4007,8 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place, onP
3557
4007
  theme,
3558
4008
  onOutline: setOutline,
3559
4009
  guard,
3560
- onSaveRequest: host.save && !versionId ? async (bytes, note) => {
3561
- await host.save(doc.data.id, bytes, note);
4010
+ onSaveRequest: host.save && !versionId ? async (bytes, note2) => {
4011
+ await host.save(doc.data.id, bytes, note2);
3562
4012
  versions.retry();
3563
4013
  doc.retry();
3564
4014
  list.retry();
@@ -3566,7 +4016,7 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place, onP
3566
4016
  },
3567
4017
  doc.data.id
3568
4018
  );
3569
- else if (doc.data.kind === "sheet") stage = /* @__PURE__ */ jsx9(Suspense2, { fallback: /* @__PURE__ */ jsx9("div", { className: "w100n-docs-empty", children: t.loading }), children: /* @__PURE__ */ jsx9(
4019
+ else if (doc.data.kind === "sheet") stage = /* @__PURE__ */ jsx12(Suspense2, { fallback: /* @__PURE__ */ jsx12("div", { className: "w100n-docs-empty", children: t.loading }), children: /* @__PURE__ */ jsx12(
3570
4020
  SheetView2,
3571
4021
  {
3572
4022
  bytes: content.data,
@@ -3584,8 +4034,8 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place, onP
3584
4034
  doc.retry();
3585
4035
  list.retry();
3586
4036
  },
3587
- onSaveRequest: versionId || !host.save ? void 0 : async (bytes, note) => {
3588
- await host.save(doc.data.id, bytes, note);
4037
+ onSaveRequest: versionId || !host.save ? void 0 : async (bytes, note2) => {
4038
+ await host.save(doc.data.id, bytes, note2);
3589
4039
  versions.retry();
3590
4040
  doc.retry();
3591
4041
  list.retry();
@@ -3593,9 +4043,9 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place, onP
3593
4043
  },
3594
4044
  `${doc.data.id}:${versionId ?? ""}`
3595
4045
  ) });
3596
- else stage = /* @__PURE__ */ jsx9("div", { className: "w100n-docs-empty", children: t.unsupported });
4046
+ else stage = /* @__PURE__ */ jsx12("div", { className: "w100n-docs-empty", children: t.unsupported });
3597
4047
  }
3598
- const Kind = doc.data ? icons3[doc.data.kind] : FileText3;
4048
+ const Kind = doc.data ? icons4[doc.data.kind] : FileText4;
3599
4049
  const top = Math.min(...outline.map((h) => h.level));
3600
4050
  const chapters = outline.reduce((all2, h) => {
3601
4051
  if (h.level === top || !all2.length) all2.push({ head: h, subs: [] });
@@ -3608,12 +4058,17 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place, onP
3608
4058
  const hit = (h) => words.every((w) => h.text.toLocaleLowerCase().includes(w));
3609
4059
  const reach = (h) => h.go ? h.go() : document.getElementById(h.id)?.scrollIntoView({ behavior: "smooth", block: "start" });
3610
4060
  const crumbs = doc.data ? [names2.get(doc.data.spaceId), doc.data.folder].filter(Boolean) : space ? [space.name] : [];
3611
- const panelTabs = [["outline", ListTree, t.outline], ["versions", History, t.versions], ["details", Info, t.details]];
4061
+ const panelTabs = [
4062
+ ["outline", ListTree, t.outline],
4063
+ ...doc.data?.kind === "markdown" ? [["links", Link22, t.links]] : [],
4064
+ ["versions", History, t.versions],
4065
+ ["details", Info, t.details]
4066
+ ];
3612
4067
  if (pdf && host.signatures) panelTabs.push(["signatures", Signature, t.signatures]);
3613
4068
  if (text && host.comments && !versionId) panelTabs.push(["comments", MessagesSquare, t.comments]);
3614
4069
  const sharing = !!host.links && !!doc.data?.rights.edit && !versionId;
3615
4070
  if (sharing) panelTabs.push(["sharing", Share2, t.sharing]);
3616
- const listToggle = /* @__PURE__ */ jsx9(
4071
+ const listToggle = /* @__PURE__ */ jsx12(
3617
4072
  "button",
3618
4073
  {
3619
4074
  ref: listButton,
@@ -3623,10 +4078,10 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place, onP
3623
4078
  onClick: () => side("list", !listOpen),
3624
4079
  "aria-label": listOpen ? t.closeList : t.openList,
3625
4080
  title: listOpen ? t.closeList : t.openList,
3626
- children: listOpen ? /* @__PURE__ */ jsx9(PanelLeftClose, { "aria-hidden": true }) : /* @__PURE__ */ jsx9(PanelLeftOpen, { "aria-hidden": true })
4081
+ children: listOpen ? /* @__PURE__ */ jsx12(PanelLeftClose, { "aria-hidden": true }) : /* @__PURE__ */ jsx12(PanelLeftOpen, { "aria-hidden": true })
3627
4082
  }
3628
4083
  );
3629
- const panelToggle = doc.data && /* @__PURE__ */ jsx9(
4084
+ const panelToggle = doc.data && /* @__PURE__ */ jsx12(
3630
4085
  "button",
3631
4086
  {
3632
4087
  ref: panelButton,
@@ -3636,16 +4091,16 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place, onP
3636
4091
  onClick: () => side("panel", !panelOpen),
3637
4092
  "aria-label": panelOpen ? t.closePanel : t.openPanel,
3638
4093
  title: panelOpen ? t.closePanel : t.openPanel,
3639
- children: panelOpen ? /* @__PURE__ */ jsx9(PanelRightClose, { "aria-hidden": true }) : /* @__PURE__ */ jsx9(PanelRightOpen, { "aria-hidden": true })
4094
+ children: panelOpen ? /* @__PURE__ */ jsx12(PanelRightClose, { "aria-hidden": true }) : /* @__PURE__ */ jsx12(PanelRightOpen, { "aria-hidden": true })
3640
4095
  }
3641
4096
  );
3642
- return /* @__PURE__ */ jsxs9("div", { className: "w100n-docs", "data-theme": theme, children: [
3643
- /* @__PURE__ */ jsxs9("header", { className: "w100n-docs-bar", children: [
3644
- start && /* @__PURE__ */ jsx9("span", { className: "w100n-docs-start w100n-docs-slot", children: slot(start) }),
4097
+ return /* @__PURE__ */ jsxs12("div", { className: "w100n-docs", "data-theme": theme, children: [
4098
+ /* @__PURE__ */ jsxs12("header", { className: "w100n-docs-bar", children: [
4099
+ start && /* @__PURE__ */ jsx12("span", { className: "w100n-docs-start w100n-docs-slot", children: slot(start) }),
3645
4100
  narrow && listToggle,
3646
- /* @__PURE__ */ jsx9("span", { className: "w100n-docs-tile", "data-kind": doc.data?.kind, children: /* @__PURE__ */ jsx9(Kind, { "aria-hidden": true }) }),
3647
- /* @__PURE__ */ jsxs9("div", { className: "w100n-docs-heading", children: [
3648
- renaming !== null && doc.data ? /* @__PURE__ */ jsx9(
4101
+ /* @__PURE__ */ jsx12("span", { className: "w100n-docs-tile", "data-kind": doc.data?.kind, children: /* @__PURE__ */ jsx12(Kind, { "aria-hidden": true }) }),
4102
+ /* @__PURE__ */ jsxs12("div", { className: "w100n-docs-heading", children: [
4103
+ renaming !== null && doc.data ? /* @__PURE__ */ jsx12(
3649
4104
  "input",
3650
4105
  {
3651
4106
  className: "w100n-docs-title w100n-docs-rename",
@@ -3663,7 +4118,7 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place, onP
3663
4118
  }
3664
4119
  }
3665
4120
  }
3666
- ) : /* @__PURE__ */ jsx9(
4121
+ ) : /* @__PURE__ */ jsx12(
3667
4122
  "strong",
3668
4123
  {
3669
4124
  className: "w100n-docs-title",
@@ -3672,31 +4127,31 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place, onP
3672
4127
  children: doc.data?.name ?? t.documents
3673
4128
  }
3674
4129
  ),
3675
- docbar ? /* @__PURE__ */ jsx9("div", { ref: setMenusAt, className: "w100n-docs-menus" }) : crumbs.length > 0 ? /* @__PURE__ */ jsx9("span", { className: "w100n-docs-crumbs", children: crumbs.map((item, i) => /* @__PURE__ */ jsxs9("span", { children: [
3676
- i > 0 && /* @__PURE__ */ jsx9(ChevronRight2, { "aria-hidden": true }),
4130
+ docbar ? /* @__PURE__ */ jsx12("div", { ref: setMenusAt, className: "w100n-docs-menus" }) : crumbs.length > 0 ? /* @__PURE__ */ jsx12("span", { className: "w100n-docs-crumbs", children: crumbs.map((item, i) => /* @__PURE__ */ jsxs12("span", { children: [
4131
+ i > 0 && /* @__PURE__ */ jsx12(ChevronRight3, { "aria-hidden": true }),
3677
4132
  item
3678
- ] }, i)) }) : /* @__PURE__ */ jsx9("span", { className: "w100n-docs-hint", children: t.hint })
4133
+ ] }, i)) }) : /* @__PURE__ */ jsx12("span", { className: "w100n-docs-hint", children: t.hint })
3679
4134
  ] }),
3680
- versionId && /* @__PURE__ */ jsx9("span", { className: "w100n-docs-badge", children: versions.data?.find((v) => v.id === versionId) && date(versions.data.find((v) => v.id === versionId).createdAt) }),
3681
- versionId && text && /* @__PURE__ */ jsxs9("button", { type: "button", className: "w100n-docs-action", "data-tone": "blue", "aria-pressed": comparing, onClick: () => setComparing(!comparing), children: [
3682
- /* @__PURE__ */ jsx9(FileDiff, { "aria-hidden": true }),
4135
+ versionId && /* @__PURE__ */ jsx12("span", { className: "w100n-docs-badge", children: versions.data?.find((v) => v.id === versionId) && date(versions.data.find((v) => v.id === versionId).createdAt) }),
4136
+ versionId && text && /* @__PURE__ */ jsxs12("button", { type: "button", className: "w100n-docs-action", "data-tone": "blue", "aria-pressed": comparing, onClick: () => setComparing(!comparing), children: [
4137
+ /* @__PURE__ */ jsx12(FileDiff, { "aria-hidden": true }),
3683
4138
  comparing ? t.hideChanges : t.showChanges
3684
4139
  ] }),
3685
- versionId && here.documentId && host.restore && doc.data?.rights.edit && /* @__PURE__ */ jsxs9("button", { type: "button", className: "w100n-docs-action", disabled: restoring === "busy", onClick: () => void restore(here.documentId, versionId), children: [
3686
- /* @__PURE__ */ jsx9(RotateCcw2, { "aria-hidden": true }),
4140
+ versionId && here.documentId && host.restore && doc.data?.rights.edit && /* @__PURE__ */ jsxs12("button", { type: "button", className: "w100n-docs-action", disabled: restoring === "busy", onClick: () => void restore(here.documentId, versionId), children: [
4141
+ /* @__PURE__ */ jsx12(RotateCcw2, { "aria-hidden": true }),
3687
4142
  t.restore
3688
4143
  ] }),
3689
- restoring === "failed" && /* @__PURE__ */ jsx9("span", { className: "w100n-docs-muted", children: t.restoreFailed }),
3690
- doc.data?.convert && host.copyAs && !versionId && /* @__PURE__ */ jsxs9("button", { type: "button", className: "w100n-docs-action", "data-tone": "green", disabled: copying === "busy", onClick: () => void copyAs(doc.data), children: [
3691
- /* @__PURE__ */ jsx9(FileSpreadsheet3, { "aria-hidden": true }),
4144
+ restoring === "failed" && /* @__PURE__ */ jsx12("span", { className: "w100n-docs-muted", children: t.restoreFailed }),
4145
+ doc.data?.convert && host.copyAs && !versionId && /* @__PURE__ */ jsxs12("button", { type: "button", className: "w100n-docs-action", "data-tone": "green", disabled: copying === "busy", onClick: () => void copyAs(doc.data), children: [
4146
+ /* @__PURE__ */ jsx12(FileSpreadsheet4, { "aria-hidden": true }),
3692
4147
  t.copyAs
3693
4148
  ] }),
3694
- copying === "failed" && /* @__PURE__ */ jsx9("span", { className: "w100n-docs-muted", children: t.copyFailed }),
3695
- kept?.id === here.documentId && kept.state === "done" && /* @__PURE__ */ jsx9("span", { className: "w100n-docs-muted", role: "status", children: t.templateSaved }),
3696
- kept?.id === here.documentId && kept.state === "failed" && /* @__PURE__ */ jsx9("span", { className: "w100n-docs-muted", role: "alert", children: t.templateFailed }),
3697
- renamed === "failed" && /* @__PURE__ */ jsx9("span", { className: "w100n-docs-muted", children: t.renameFailed }),
3698
- docbar && /* @__PURE__ */ jsx9("span", { ref: setStatusAt, className: "w100n-docs-status" }),
3699
- host.send && doc.data && !versionId && !doc.data.id.includes(":") && /* @__PURE__ */ jsxs9(
4149
+ copying === "failed" && /* @__PURE__ */ jsx12("span", { className: "w100n-docs-muted", children: t.copyFailed }),
4150
+ kept?.id === here.documentId && kept.state === "done" && /* @__PURE__ */ jsx12("span", { className: "w100n-docs-muted", role: "status", children: t.templateSaved }),
4151
+ kept?.id === here.documentId && kept.state === "failed" && /* @__PURE__ */ jsx12("span", { className: "w100n-docs-muted", role: "alert", children: t.templateFailed }),
4152
+ renamed === "failed" && /* @__PURE__ */ jsx12("span", { className: "w100n-docs-muted", children: t.renameFailed }),
4153
+ docbar && /* @__PURE__ */ jsx12("span", { ref: setStatusAt, className: "w100n-docs-status" }),
4154
+ host.send && doc.data && !versionId && !doc.data.id.includes(":") && /* @__PURE__ */ jsxs12(
3700
4155
  "button",
3701
4156
  {
3702
4157
  type: "button",
@@ -3706,146 +4161,182 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place, onP
3706
4161
  title: t.sendChat,
3707
4162
  onClick: () => host.send(doc.data.id),
3708
4163
  children: [
3709
- /* @__PURE__ */ jsx9(Send, { "aria-hidden": true }),
3710
- /* @__PURE__ */ jsx9("span", { children: t.sendChat })
4164
+ /* @__PURE__ */ jsx12(Send, { "aria-hidden": true }),
4165
+ /* @__PURE__ */ jsx12("span", { children: t.sendChat })
3711
4166
  ]
3712
4167
  }
3713
4168
  ),
3714
- sharing && /* @__PURE__ */ jsxs9("button", { type: "button", className: "w100n-docs-action", "aria-label": t.share, title: t.share, onClick: () => {
4169
+ sharing && /* @__PURE__ */ jsxs12("button", { type: "button", className: "w100n-docs-action", "aria-label": t.share, title: t.share, onClick: () => {
3715
4170
  setTab("sharing");
3716
4171
  side("panel", true);
3717
4172
  }, children: [
3718
- /* @__PURE__ */ jsx9(Share2, { "aria-hidden": true }),
3719
- /* @__PURE__ */ jsx9("span", { children: t.share })
4173
+ /* @__PURE__ */ jsx12(Share2, { "aria-hidden": true }),
4174
+ /* @__PURE__ */ jsx12("span", { children: t.share })
3720
4175
  ] }),
3721
4176
  doc.data && !versionId && actions?.(doc.data),
3722
4177
  narrow && panelToggle,
3723
- end && /* @__PURE__ */ jsx9("div", { className: "w100n-docs-end w100n-docs-slot", children: slot(end) })
4178
+ end && /* @__PURE__ */ jsx12("div", { className: "w100n-docs-end w100n-docs-slot", children: slot(end) })
3724
4179
  ] }),
3725
- /* @__PURE__ */ jsxs9("div", { ref: body, className: "w100n-docs-body", children: [
3726
- listOpen && /* @__PURE__ */ jsxs9("aside", { className: "w100n-docs-side w100n-docs-list", "aria-label": t.documents, children: [
3727
- /* @__PURE__ */ jsxs9("div", { className: "w100n-docs-head", children: [
3728
- /* @__PURE__ */ jsxs9("div", { className: "w100n-docs-row", children: [
3729
- /* @__PURE__ */ jsxs9("p", { className: "w100n-docs-caption", children: [
3730
- /* @__PURE__ */ jsx9(Files2, { "aria-hidden": true }),
4180
+ /* @__PURE__ */ jsxs12("div", { ref: body, className: "w100n-docs-body", children: [
4181
+ listOpen && /* @__PURE__ */ jsxs12("aside", { className: "w100n-docs-side w100n-docs-list", "aria-label": t.documents, children: [
4182
+ /* @__PURE__ */ jsxs12("div", { className: "w100n-docs-head", children: [
4183
+ /* @__PURE__ */ jsxs12("div", { className: "w100n-docs-row", children: [
4184
+ /* @__PURE__ */ jsxs12("p", { className: "w100n-docs-caption", children: [
4185
+ /* @__PURE__ */ jsx12(Files3, { "aria-hidden": true }),
3731
4186
  t.documents,
3732
- /* @__PURE__ */ jsx9("span", { children: all.length })
4187
+ /* @__PURE__ */ jsx12("span", { children: all.length })
3733
4188
  ] }),
3734
- host.create && /* @__PURE__ */ jsxs9("div", { className: "w100n-docs-new", onKeyDown: (e) => {
4189
+ host.create && /* @__PURE__ */ jsxs12("div", { className: "w100n-docs-new", onKeyDown: (e) => {
3735
4190
  if (e.key === "Escape" && adding) {
3736
4191
  e.stopPropagation();
3737
4192
  setAdding(false);
3738
4193
  }
3739
4194
  }, children: [
3740
- /* @__PURE__ */ jsxs9("button", { type: "button", className: "w100n-docs-action", "aria-haspopup": "menu", "aria-expanded": adding, disabled: sending === "busy", onClick: () => setAdding(!adding), children: [
3741
- /* @__PURE__ */ jsx9(Plus4, { "aria-hidden": true }),
3742
- /* @__PURE__ */ jsx9("span", { children: sending === "busy" ? t.uploading : t.create }),
3743
- /* @__PURE__ */ jsx9(ChevronDown2, { "aria-hidden": true })
4195
+ /* @__PURE__ */ jsxs12("button", { type: "button", className: "w100n-docs-action", "aria-haspopup": "menu", "aria-expanded": adding, disabled: sending === "busy", onClick: () => setAdding(!adding), children: [
4196
+ /* @__PURE__ */ jsx12(Plus5, { "aria-hidden": true }),
4197
+ /* @__PURE__ */ jsx12("span", { children: sending === "busy" ? t.uploading : t.create }),
4198
+ /* @__PURE__ */ jsx12(ChevronDown3, { "aria-hidden": true })
3744
4199
  ] }),
3745
- adding && /* @__PURE__ */ jsxs9("div", { role: "menu", className: "w100n-docs-menu", children: [
3746
- /* @__PURE__ */ jsxs9("button", { type: "button", role: "menuitem", onClick: () => {
4200
+ adding && /* @__PURE__ */ jsxs12("div", { role: "menu", className: "w100n-docs-menu", children: [
4201
+ /* @__PURE__ */ jsxs12("button", { type: "button", role: "menuitem", onClick: () => {
3747
4202
  setAdding(false);
3748
4203
  setMaking(true);
3749
4204
  }, children: [
3750
- /* @__PURE__ */ jsx9("span", { className: "w100n-docs-all", children: /* @__PURE__ */ jsx9(FilePlus, { "aria-hidden": true }) }),
3751
- /* @__PURE__ */ jsx9("b", { children: t.newTitle })
4205
+ /* @__PURE__ */ jsx12("span", { className: "w100n-docs-all", children: /* @__PURE__ */ jsx12(FilePlus, { "aria-hidden": true }) }),
4206
+ /* @__PURE__ */ jsx12("b", { children: t.newTitle })
3752
4207
  ] }),
3753
- /* @__PURE__ */ jsxs9("button", { type: "button", role: "menuitem", onClick: () => {
4208
+ /* @__PURE__ */ jsxs12("button", { type: "button", role: "menuitem", onClick: () => {
3754
4209
  setAdding(false);
3755
4210
  upload.current.click();
3756
4211
  }, children: [
3757
- /* @__PURE__ */ jsx9("span", { className: "w100n-docs-all", children: /* @__PURE__ */ jsx9(Upload, { "aria-hidden": true }) }),
3758
- /* @__PURE__ */ jsx9("b", { children: t.uploadFile })
4212
+ /* @__PURE__ */ jsx12("span", { className: "w100n-docs-all", children: /* @__PURE__ */ jsx12(Upload, { "aria-hidden": true }) }),
4213
+ /* @__PURE__ */ jsx12("b", { children: t.uploadFile })
3759
4214
  ] })
3760
4215
  ] }),
3761
- /* @__PURE__ */ jsx9("input", { ref: upload, type: "file", hidden: true, "aria-label": t.uploadFile, accept: ".docx,.md,.markdown,.pdf,.xlsx,.csv,.html,.htm", onChange: (e) => {
4216
+ /* @__PURE__ */ jsx12("input", { ref: upload, type: "file", hidden: true, "aria-label": t.uploadFile, accept: ".docx,.md,.markdown,.pdf,.xlsx,.csv,.html,.htm", onChange: (e) => {
3762
4217
  const file = e.target.files?.[0];
3763
4218
  e.target.value = "";
3764
4219
  if (file) void send(file);
3765
4220
  } })
3766
4221
  ] }),
3767
- /* @__PURE__ */ jsx9("button", { ref: listClose, type: "button", className: "w100n-docs-close", onClick: () => side("list", false), "aria-label": t.closeList, title: t.closeList, children: /* @__PURE__ */ jsx9(X6, { "aria-hidden": true }) })
4222
+ /* @__PURE__ */ jsx12("button", { ref: listClose, type: "button", className: "w100n-docs-close", onClick: () => side("list", false), "aria-label": t.closeList, title: t.closeList, children: /* @__PURE__ */ jsx12(X6, { "aria-hidden": true }) })
3768
4223
  ] }),
3769
- (spaces.data?.length ?? 0) > 1 && /* @__PURE__ */ jsxs9("div", { className: "w100n-docs-picker", onKeyDown: (e) => {
4224
+ (spaces.data?.length ?? 0) > 1 && /* @__PURE__ */ jsxs12("div", { className: "w100n-docs-picker", onKeyDown: (e) => {
3770
4225
  if (e.key !== "Escape" || !picking) return;
3771
4226
  e.stopPropagation();
3772
4227
  setPicking(false);
3773
4228
  e.currentTarget.querySelector("button").focus();
3774
4229
  }, children: [
3775
- /* @__PURE__ */ jsxs9("button", { type: "button", className: "w100n-docs-field", "aria-haspopup": "listbox", "aria-expanded": picking, onClick: () => setPicking(!picking), children: [
3776
- space ? /* @__PURE__ */ jsx9("span", { className: "w100n-docs-dot", style: { background: space.color ?? void 0 } }) : /* @__PURE__ */ jsx9("span", { className: "w100n-docs-all", children: /* @__PURE__ */ jsx9(LayoutGrid, { "aria-hidden": true }) }),
3777
- /* @__PURE__ */ jsx9("b", { children: space?.name ?? t.allProjects }),
3778
- !space && /* @__PURE__ */ jsx9("span", { className: "w100n-docs-count", children: all.length }),
3779
- /* @__PURE__ */ jsx9(ChevronDown2, { "aria-hidden": true })
4230
+ /* @__PURE__ */ jsxs12("button", { type: "button", className: "w100n-docs-field", "aria-haspopup": "listbox", "aria-expanded": picking, onClick: () => setPicking(!picking), children: [
4231
+ space ? /* @__PURE__ */ jsx12("span", { className: "w100n-docs-dot", style: { background: space.color ?? void 0 } }) : /* @__PURE__ */ jsx12("span", { className: "w100n-docs-all", children: /* @__PURE__ */ jsx12(LayoutGrid, { "aria-hidden": true }) }),
4232
+ /* @__PURE__ */ jsx12("b", { children: space?.name ?? t.allProjects }),
4233
+ !space && /* @__PURE__ */ jsx12("span", { className: "w100n-docs-count", children: all.length }),
4234
+ /* @__PURE__ */ jsx12(ChevronDown3, { "aria-hidden": true })
3780
4235
  ] }),
3781
- picking && /* @__PURE__ */ jsxs9("div", { role: "listbox", className: "w100n-docs-menu", children: [
3782
- /* @__PURE__ */ jsxs9("button", { type: "button", role: "option", "aria-selected": !spaceId, onClick: () => pick(null), children: [
3783
- /* @__PURE__ */ jsx9("span", { className: "w100n-docs-all", children: /* @__PURE__ */ jsx9(LayoutGrid, { "aria-hidden": true }) }),
3784
- /* @__PURE__ */ jsx9("b", { children: t.allProjects }),
3785
- !spaceId && /* @__PURE__ */ jsx9(Check2, { "aria-hidden": true })
4236
+ picking && /* @__PURE__ */ jsxs12("div", { role: "listbox", className: "w100n-docs-menu", children: [
4237
+ /* @__PURE__ */ jsxs12("button", { type: "button", role: "option", "aria-selected": !spaceId, onClick: () => pick(null), children: [
4238
+ /* @__PURE__ */ jsx12("span", { className: "w100n-docs-all", children: /* @__PURE__ */ jsx12(LayoutGrid, { "aria-hidden": true }) }),
4239
+ /* @__PURE__ */ jsx12("b", { children: t.allProjects }),
4240
+ !spaceId && /* @__PURE__ */ jsx12(Check2, { "aria-hidden": true })
3786
4241
  ] }),
3787
- groups.map((group) => /* @__PURE__ */ jsxs9("div", { role: "group", "aria-label": group || void 0, children: [
3788
- group && /* @__PURE__ */ jsx9("p", { className: "w100n-docs-menu-caption", children: group }),
3789
- (spaces.data ?? []).filter((item) => (item.group ?? "") === group).map((item) => /* @__PURE__ */ jsxs9("button", { type: "button", role: "option", "aria-selected": item.id === spaceId, onClick: () => pick(item.id), children: [
3790
- /* @__PURE__ */ jsx9("span", { className: "w100n-docs-dot", style: { background: item.color ?? void 0 } }),
3791
- /* @__PURE__ */ jsx9("b", { children: item.name }),
3792
- !spaceId && counts.get(item.id) ? /* @__PURE__ */ jsx9("span", { className: "w100n-docs-count", children: counts.get(item.id) }) : null,
3793
- item.id === spaceId && /* @__PURE__ */ jsx9(Check2, { "aria-hidden": true })
4242
+ groups.map((group) => /* @__PURE__ */ jsxs12("div", { role: "group", "aria-label": group || void 0, children: [
4243
+ group && /* @__PURE__ */ jsx12("p", { className: "w100n-docs-menu-caption", children: group }),
4244
+ (spaces.data ?? []).filter((item) => (item.group ?? "") === group).map((item) => /* @__PURE__ */ jsxs12("button", { type: "button", role: "option", "aria-selected": item.id === spaceId, onClick: () => pick(item.id), children: [
4245
+ /* @__PURE__ */ jsx12("span", { className: "w100n-docs-dot", style: { background: item.color ?? void 0 } }),
4246
+ /* @__PURE__ */ jsx12("b", { children: item.name }),
4247
+ !spaceId && counts.get(item.id) ? /* @__PURE__ */ jsx12("span", { className: "w100n-docs-count", children: counts.get(item.id) }) : null,
4248
+ item.id === spaceId && /* @__PURE__ */ jsx12(Check2, { "aria-hidden": true })
3794
4249
  ] }, item.id))
3795
4250
  ] }, group))
3796
4251
  ] })
3797
4252
  ] }),
3798
- /* @__PURE__ */ jsxs9("div", { className: "w100n-docs-filters", children: [
3799
- /* @__PURE__ */ jsxs9("label", { className: "w100n-docs-field w100n-docs-search", children: [
3800
- /* @__PURE__ */ jsx9(Search2, { "aria-hidden": true }),
3801
- /* @__PURE__ */ jsx9("input", { value: query, onChange: (event) => setQuery(event.target.value), placeholder: t.search, "aria-label": t.search })
4253
+ /* @__PURE__ */ jsxs12("div", { className: "w100n-docs-filters", children: [
4254
+ /* @__PURE__ */ jsxs12("label", { className: "w100n-docs-field w100n-docs-search", children: [
4255
+ /* @__PURE__ */ jsx12(Search3, { "aria-hidden": true }),
4256
+ /* @__PURE__ */ jsx12("input", { ref: finder, value: query, onChange: (event) => setQuery(event.target.value), placeholder: t.search, "aria-label": t.search }),
4257
+ /* @__PURE__ */ jsx12("kbd", { children: "\u2318O" })
3802
4258
  ] }),
3803
- present.length > 1 && /* @__PURE__ */ jsxs9("div", { className: "w100n-docs-types", onKeyDown: (e) => {
4259
+ present.length > 1 && /* @__PURE__ */ jsxs12("div", { className: "w100n-docs-types", onKeyDown: (e) => {
3804
4260
  if (e.key !== "Escape" || !typing) return;
3805
4261
  e.stopPropagation();
3806
4262
  setTyping(false);
3807
4263
  e.currentTarget.querySelector("button").focus();
3808
4264
  }, children: [
3809
- /* @__PURE__ */ jsxs9("button", { type: "button", className: "w100n-docs-field", "aria-haspopup": "listbox", "aria-expanded": typing, "data-on": picked.length > 0, onClick: () => setTyping(!typing), children: [
3810
- /* @__PURE__ */ jsx9(ListFilter, { "aria-hidden": true }),
3811
- /* @__PURE__ */ jsx9("b", { children: t.typeFilter }),
3812
- picked.length > 0 && /* @__PURE__ */ jsx9("span", { className: "w100n-docs-badge", children: picked.length }),
3813
- /* @__PURE__ */ jsx9(ChevronDown2, { "aria-hidden": true })
4265
+ /* @__PURE__ */ jsxs12("button", { type: "button", className: "w100n-docs-field", "aria-haspopup": "listbox", "aria-expanded": typing, "data-on": picked.length > 0, onClick: () => setTyping(!typing), children: [
4266
+ /* @__PURE__ */ jsx12(ListFilter, { "aria-hidden": true }),
4267
+ /* @__PURE__ */ jsx12("b", { children: t.typeFilter }),
4268
+ picked.length > 0 && /* @__PURE__ */ jsx12("span", { className: "w100n-docs-badge", children: picked.length }),
4269
+ /* @__PURE__ */ jsx12(ChevronDown3, { "aria-hidden": true })
3814
4270
  ] }),
3815
- typing && /* @__PURE__ */ jsxs9("div", { role: "listbox", "aria-multiselectable": true, "aria-label": t.kind, className: "w100n-docs-menu", children: [
4271
+ typing && /* @__PURE__ */ jsxs12("div", { role: "listbox", "aria-multiselectable": true, "aria-label": t.kind, className: "w100n-docs-menu", children: [
3816
4272
  present.map((item) => {
3817
- const Icon = icons3[item];
4273
+ const Icon = icons4[item];
3818
4274
  const on = picked.includes(item);
3819
- return /* @__PURE__ */ jsxs9("button", { type: "button", role: "option", "aria-selected": on, onClick: () => setPicked(on ? picked.filter((k) => k !== item) : [...picked, item]), children: [
3820
- /* @__PURE__ */ jsx9("span", { className: "w100n-docs-box", children: on && /* @__PURE__ */ jsx9(Check2, { "aria-hidden": true }) }),
3821
- /* @__PURE__ */ jsx9("span", { className: "w100n-docs-tile", "data-kind": item, children: /* @__PURE__ */ jsx9(Icon, { "aria-hidden": true }) }),
3822
- /* @__PURE__ */ jsx9("b", { children: t.kinds[item] }),
3823
- /* @__PURE__ */ jsx9("span", { className: "w100n-docs-count", children: all.filter((doc2) => doc2.kind === item).length })
4275
+ return /* @__PURE__ */ jsxs12("button", { type: "button", role: "option", "aria-selected": on, onClick: () => setPicked(on ? picked.filter((k) => k !== item) : [...picked, item]), children: [
4276
+ /* @__PURE__ */ jsx12("span", { className: "w100n-docs-box", children: on && /* @__PURE__ */ jsx12(Check2, { "aria-hidden": true }) }),
4277
+ /* @__PURE__ */ jsx12("span", { className: "w100n-docs-tile", "data-kind": item, children: /* @__PURE__ */ jsx12(Icon, { "aria-hidden": true }) }),
4278
+ /* @__PURE__ */ jsx12("b", { children: t.kinds[item] }),
4279
+ /* @__PURE__ */ jsx12("span", { className: "w100n-docs-count", children: all.filter((doc2) => doc2.kind === item).length })
3824
4280
  ] }, item);
3825
4281
  }),
3826
- /* @__PURE__ */ jsxs9("div", { className: "w100n-docs-menu-foot", children: [
3827
- /* @__PURE__ */ jsx9("button", { type: "button", onClick: () => setPicked(present), children: t.selectAll }),
3828
- /* @__PURE__ */ jsx9("button", { type: "button", onClick: () => setPicked([]), children: t.clearPick })
4282
+ /* @__PURE__ */ jsxs12("div", { className: "w100n-docs-menu-foot", children: [
4283
+ /* @__PURE__ */ jsx12("button", { type: "button", onClick: () => setPicked(present), children: t.selectAll }),
4284
+ /* @__PURE__ */ jsx12("button", { type: "button", onClick: () => setPicked([]), children: t.clearPick })
3829
4285
  ] })
3830
4286
  ] })
3831
4287
  ] })
3832
4288
  ] }),
3833
- picked.length > 0 && /* @__PURE__ */ jsx9("div", { className: "w100n-docs-chips", role: "group", "aria-label": t.kind, children: picked.map((item) => /* @__PURE__ */ jsxs9("button", { type: "button", "aria-pressed": true, "aria-label": `${t.clearPick}: ${t.kinds[item]}`, onClick: () => setPicked(picked.filter((k) => k !== item)), children: [
4289
+ /* @__PURE__ */ jsx12("div", { className: "w100n-docs-shape", role: "radiogroup", "aria-label": t.tree, children: [["tree", FolderTree, t.tree], ["cards", LayoutGrid, t.cards]].map(([key, Icon, label]) => /* @__PURE__ */ jsxs12("button", { type: "button", role: "radio", "aria-checked": shape2 === key, onClick: () => {
4290
+ setShape(key);
4291
+ localStorage.setItem("w100n-docs-view", key);
4292
+ }, children: [
4293
+ /* @__PURE__ */ jsx12(Icon, { "aria-hidden": true }),
4294
+ label
4295
+ ] }, key)) }),
4296
+ picked.length > 0 && /* @__PURE__ */ jsx12("div", { className: "w100n-docs-chips", role: "group", "aria-label": t.kind, children: picked.map((item) => /* @__PURE__ */ jsxs12("button", { type: "button", "aria-pressed": true, "aria-label": `${t.clearPick}: ${t.kinds[item]}`, onClick: () => setPicked(picked.filter((k) => k !== item)), children: [
3834
4297
  t.kinds[item],
3835
- /* @__PURE__ */ jsx9(X6, { "aria-hidden": true })
4298
+ /* @__PURE__ */ jsx12(X6, { "aria-hidden": true })
3836
4299
  ] }, item)) })
3837
4300
  ] }),
3838
- /* @__PURE__ */ jsxs9("div", { className: "w100n-docs-cards", children: [
3839
- sending === "failed" && /* @__PURE__ */ jsx9("p", { className: "w100n-docs-muted", role: "alert", children: t.uploadFailed }),
4301
+ /* @__PURE__ */ jsxs12("div", { className: "w100n-docs-cards", children: [
4302
+ sending === "failed" && /* @__PURE__ */ jsx12("p", { className: "w100n-docs-muted", role: "alert", children: t.uploadFailed }),
3840
4303
  list.error && failed(list.retry),
3841
- list.loading && !list.data && /* @__PURE__ */ jsx9("p", { className: "w100n-docs-muted", children: t.loading }),
3842
- notice && /* @__PURE__ */ jsx9("p", { className: "w100n-docs-muted", role: "status", children: notice }),
3843
- list.data && !shown.length && /* @__PURE__ */ jsx9("p", { className: "w100n-docs-muted", children: all.length ? t.nothing : t.empty }),
3844
- folders.map((folder2) => /* @__PURE__ */ jsxs9("div", { className: "w100n-docs-folder", role: "group", "aria-label": folder2 || t.loose, children: [
3845
- folders.length > 1 && /* @__PURE__ */ jsx9("p", { className: "w100n-docs-group", children: folder2 || t.loose }),
3846
- /* @__PURE__ */ jsx9("div", { className: "w100n-docs-grid", children: shown.filter((item) => !spaceId || (item.folder ?? "") === folder2).map((item) => naming?.id === item.id ? /* @__PURE__ */ jsxs9("div", { className: "w100n-docs-card", children: [
3847
- /* @__PURE__ */ jsx9(Thumb, { host, item, label: t.kinds[item.kind] }),
3848
- /* @__PURE__ */ jsx9("span", { className: "w100n-docs-card-text", children: /* @__PURE__ */ jsx9(
4304
+ list.loading && !list.data && /* @__PURE__ */ jsx12("p", { className: "w100n-docs-muted", children: t.loading }),
4305
+ notice && /* @__PURE__ */ jsx12("p", { className: "w100n-docs-muted", role: "status", children: notice }),
4306
+ list.data && !shown.length && /* @__PURE__ */ jsx12("p", { className: "w100n-docs-muted", children: all.length ? t.nothing : t.empty }),
4307
+ shape2 === "tree" && list.data && /* @__PURE__ */ jsx12(
4308
+ Tree,
4309
+ {
4310
+ items: shown,
4311
+ folders: query.trim() || picked.length ? /* @__PURE__ */ new Map() : dirs.data ?? /* @__PURE__ */ new Map(),
4312
+ names: names2,
4313
+ spaceId,
4314
+ current: here.documentId,
4315
+ t,
4316
+ edit,
4317
+ onEdit: (text2) => setEdit(text2 === null ? null : edit && { ...edit, text: text2 }),
4318
+ onEditDone: commit,
4319
+ onOpen: open,
4320
+ onMenu: (item, e) => {
4321
+ setSpot(null);
4322
+ setMenu({ item, x: Math.min(e.clientX, innerWidth - 290), y: Math.min(e.clientY, innerHeight - 440), sure: false });
4323
+ },
4324
+ onFolderMenu: host.create || host.makeFolder ? (at, key, e) => {
4325
+ setMenu(null);
4326
+ setSpot({ at, key, x: Math.min(e.clientX, innerWidth - 250), y: Math.min(e.clientY, innerHeight - 260), sure: false });
4327
+ } : void 0,
4328
+ onMove: host.move ? (id, to) => {
4329
+ const item = all.find((x) => x.id === id);
4330
+ if (item) moveTo(item, to);
4331
+ } : void 0,
4332
+ onWarm: (item) => item ? warm(item) : clearTimeout(hover.current)
4333
+ }
4334
+ ),
4335
+ shape2 === "cards" && folders.map((folder2) => /* @__PURE__ */ jsxs12("div", { className: "w100n-docs-folder", role: "group", "aria-label": folder2 || t.loose, children: [
4336
+ folders.length > 1 && /* @__PURE__ */ jsx12("p", { className: "w100n-docs-group", children: folder2 || t.loose }),
4337
+ /* @__PURE__ */ jsx12("div", { className: "w100n-docs-grid", children: shown.filter((item) => !spaceId || (item.folder ?? "") === folder2).map((item) => naming?.id === item.id ? /* @__PURE__ */ jsxs12("div", { className: "w100n-docs-card", children: [
4338
+ /* @__PURE__ */ jsx12(Thumb, { host, item, label: t.kinds[item.kind] }),
4339
+ /* @__PURE__ */ jsx12("span", { className: "w100n-docs-card-text", children: /* @__PURE__ */ jsx12(
3849
4340
  "input",
3850
4341
  {
3851
4342
  className: "w100n-docs-field",
@@ -3864,7 +4355,7 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place, onP
3864
4355
  }
3865
4356
  }
3866
4357
  ) })
3867
- ] }, item.id) : /* @__PURE__ */ jsxs9(
4358
+ ] }, item.id) : /* @__PURE__ */ jsxs12(
3868
4359
  "button",
3869
4360
  {
3870
4361
  type: "button",
@@ -3879,11 +4370,11 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place, onP
3879
4370
  setMenu({ item, x: Math.min(e.clientX, innerWidth - 290), y: Math.min(e.clientY, innerHeight - 440), sure: false });
3880
4371
  },
3881
4372
  children: [
3882
- /* @__PURE__ */ jsx9(Thumb, { host, item, label: t.kinds[item.kind] }),
3883
- /* @__PURE__ */ jsxs9("span", { className: "w100n-docs-card-text", children: [
3884
- /* @__PURE__ */ jsx9("b", { children: item.name }),
3885
- /* @__PURE__ */ jsx9("small", { children: [!spaceId && names2.get(item.spaceId), ago(item.updatedAt)].filter(Boolean).join(" \xB7 ") }),
3886
- inside.get(item.id) && /* @__PURE__ */ jsx9("small", { className: "w100n-docs-hit", children: inside.get(item.id).split(/[«»]/).map((part, i) => i % 2 ? /* @__PURE__ */ jsx9("mark", { children: part }, i) : part) })
4373
+ /* @__PURE__ */ jsx12(Thumb, { host, item, label: t.kinds[item.kind] }),
4374
+ /* @__PURE__ */ jsxs12("span", { className: "w100n-docs-card-text", children: [
4375
+ /* @__PURE__ */ jsx12("b", { children: item.name }),
4376
+ /* @__PURE__ */ jsx12("small", { children: [!spaceId && names2.get(item.spaceId), ago(item.updatedAt)].filter(Boolean).join(" \xB7 ") }),
4377
+ inside.get(item.id) && /* @__PURE__ */ jsx12("small", { className: "w100n-docs-hit", children: inside.get(item.id).split(/[«»]/).map((part, i) => i % 2 ? /* @__PURE__ */ jsx12("mark", { children: part }, i) : part) })
3887
4378
  ] })
3888
4379
  ]
3889
4380
  },
@@ -3893,31 +4384,31 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place, onP
3893
4384
  ] })
3894
4385
  ] }),
3895
4386
  !narrow && !listOpen && listToggle,
3896
- /* @__PURE__ */ jsxs9("main", { className: "w100n-docs-stage", children: [
4387
+ /* @__PURE__ */ jsxs12("main", { className: "w100n-docs-stage", children: [
3897
4388
  !narrow && !panelOpen && panelToggle,
3898
- /* @__PURE__ */ jsx9("div", { className: "w100n-docs-bare", children: stage })
4389
+ /* @__PURE__ */ jsx12("div", { className: "w100n-docs-bare", children: stage })
3899
4390
  ] }),
3900
- doc.data && panelOpen && /* @__PURE__ */ jsxs9("aside", { ref: panel, className: "w100n-docs-side w100n-docs-panel", "aria-label": t.details, children: [
3901
- /* @__PURE__ */ jsx9("div", { className: "w100n-docs-head", children: /* @__PURE__ */ jsxs9("div", { className: "w100n-docs-row", children: [
3902
- /* @__PURE__ */ jsx9("div", { className: "w100n-docs-tabs", role: "tablist", "aria-label": t.details, "data-compact": panelTabs.length > 3, onKeyDown: rove, children: panelTabs.map(([key, Icon, label]) => /* @__PURE__ */ jsxs9("button", { type: "button", role: "tab", "aria-selected": tab === key, tabIndex: tab === key ? 0 : -1, "aria-label": label, title: label, onClick: () => setTab(key), children: [
3903
- /* @__PURE__ */ jsx9(Icon, { "aria-hidden": true }),
3904
- (panelTabs.length < 4 || tab === key && panelTabs.length < 5) && /* @__PURE__ */ jsx9("span", { children: label })
4391
+ doc.data && panelOpen && /* @__PURE__ */ jsxs12("aside", { ref: panel, className: "w100n-docs-side w100n-docs-panel", "aria-label": t.details, children: [
4392
+ /* @__PURE__ */ jsx12("div", { className: "w100n-docs-head", children: /* @__PURE__ */ jsxs12("div", { className: "w100n-docs-row", children: [
4393
+ /* @__PURE__ */ jsx12("div", { className: "w100n-docs-tabs", role: "tablist", "aria-label": t.details, "data-compact": panelTabs.length > 3, onKeyDown: rove, children: panelTabs.map(([key, Icon, label]) => /* @__PURE__ */ jsxs12("button", { type: "button", role: "tab", "aria-selected": tab === key, tabIndex: tab === key ? 0 : -1, "aria-label": label, title: label, onClick: () => setTab(key), children: [
4394
+ /* @__PURE__ */ jsx12(Icon, { "aria-hidden": true }),
4395
+ (panelTabs.length < 4 || tab === key && panelTabs.length < 5) && /* @__PURE__ */ jsx12("span", { children: label })
3905
4396
  ] }, key)) }),
3906
- /* @__PURE__ */ jsx9("button", { type: "button", className: "w100n-docs-close", onClick: () => side("panel", false), "aria-label": t.closePanel, title: t.closePanel, children: /* @__PURE__ */ jsx9(X6, { "aria-hidden": true }) })
4397
+ /* @__PURE__ */ jsx12("button", { type: "button", className: "w100n-docs-close", onClick: () => side("panel", false), "aria-label": t.closePanel, title: t.closePanel, children: /* @__PURE__ */ jsx12(X6, { "aria-hidden": true }) })
3907
4398
  ] }) }),
3908
- /* @__PURE__ */ jsxs9("div", { className: "w100n-docs-panel-body", role: "tabpanel", "aria-label": panelTabs.find(([key]) => key === tab)?.[2], children: [
3909
- tab === "outline" && (outline.length ? /* @__PURE__ */ jsxs9("nav", { className: "w100n-docs-outline", "aria-label": t.outline, children: [
3910
- now && /* @__PURE__ */ jsxs9("div", { className: "w100n-docs-reading", children: [
3911
- /* @__PURE__ */ jsx9("span", { children: /* @__PURE__ */ jsx9("i", { style: { width: `${Math.round(now.progress * 100)}%` } }) }),
3912
- /* @__PURE__ */ jsxs9("small", { children: [
4399
+ /* @__PURE__ */ jsxs12("div", { className: "w100n-docs-panel-body", role: "tabpanel", "aria-label": panelTabs.find(([key]) => key === tab)?.[2], children: [
4400
+ tab === "outline" && (outline.length ? /* @__PURE__ */ jsxs12("nav", { className: "w100n-docs-outline", "aria-label": t.outline, children: [
4401
+ now && /* @__PURE__ */ jsxs12("div", { className: "w100n-docs-reading", children: [
4402
+ /* @__PURE__ */ jsx12("span", { children: /* @__PURE__ */ jsx12("i", { style: { width: `${Math.round(now.progress * 100)}%` } }) }),
4403
+ /* @__PURE__ */ jsxs12("small", { children: [
3913
4404
  Math.round(now.progress * 100),
3914
4405
  "% ",
3915
4406
  t.read
3916
4407
  ] })
3917
4408
  ] }),
3918
- outline.length > 8 && /* @__PURE__ */ jsxs9("label", { className: "w100n-docs-field w100n-docs-search", children: [
3919
- /* @__PURE__ */ jsx9(Search2, { "aria-hidden": true }),
3920
- /* @__PURE__ */ jsx9("input", { value: hunt, onChange: (e) => setHunt(e.target.value), placeholder: t.findHeading, "aria-label": t.findHeading })
4409
+ outline.length > 8 && /* @__PURE__ */ jsxs12("label", { className: "w100n-docs-field w100n-docs-search", children: [
4410
+ /* @__PURE__ */ jsx12(Search3, { "aria-hidden": true }),
4411
+ /* @__PURE__ */ jsx12("input", { value: hunt, onChange: (e) => setHunt(e.target.value), placeholder: t.findHeading, "aria-label": t.findHeading })
3921
4412
  ] }),
3922
4413
  chapters.map((c, i) => {
3923
4414
  const subs = words.length ? c.subs.filter(hit) : c.subs;
@@ -3925,13 +4416,13 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place, onP
3925
4416
  const opened2 = words.length > 0 || (fold[c.head.id] ?? i === reached);
3926
4417
  const named = /^(\d+)[.)]?\s+(.+)$/.exec(c.head.text);
3927
4418
  const mark = c.subs.findIndex((s) => s.id === now?.id);
3928
- return /* @__PURE__ */ jsxs9("div", { className: "w100n-docs-chapter", "data-state": reached < 0 ? void 0 : i < reached ? "done" : i === reached ? "now" : void 0, children: [
3929
- /* @__PURE__ */ jsxs9("div", { className: "w100n-docs-chapter-row", children: [
3930
- /* @__PURE__ */ jsxs9("button", { type: "button", className: "w100n-docs-chapter-go", "aria-label": c.head.text, "aria-current": now?.id === c.head.id ? "location" : void 0, onClick: () => reach(c.head), children: [
3931
- /* @__PURE__ */ jsx9("span", { className: "w100n-docs-chapter-num", children: named ? named[1] : /* @__PURE__ */ jsx9(Bookmark, { "aria-hidden": true }) }),
3932
- /* @__PURE__ */ jsx9("b", { children: named ? named[2] : c.head.text })
4419
+ return /* @__PURE__ */ jsxs12("div", { className: "w100n-docs-chapter", "data-state": reached < 0 ? void 0 : i < reached ? "done" : i === reached ? "now" : void 0, children: [
4420
+ /* @__PURE__ */ jsxs12("div", { className: "w100n-docs-chapter-row", children: [
4421
+ /* @__PURE__ */ jsxs12("button", { type: "button", className: "w100n-docs-chapter-go", "aria-label": c.head.text, "aria-current": now?.id === c.head.id ? "location" : void 0, onClick: () => reach(c.head), children: [
4422
+ /* @__PURE__ */ jsx12("span", { className: "w100n-docs-chapter-num", children: named ? named[1] : /* @__PURE__ */ jsx12(Bookmark, { "aria-hidden": true }) }),
4423
+ /* @__PURE__ */ jsx12("b", { children: named ? named[2] : c.head.text })
3933
4424
  ] }),
3934
- c.subs.length > 0 && /* @__PURE__ */ jsxs9(
4425
+ c.subs.length > 0 && /* @__PURE__ */ jsxs12(
3935
4426
  "button",
3936
4427
  {
3937
4428
  type: "button",
@@ -3941,13 +4432,13 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place, onP
3941
4432
  title: opened2 ? t.hideSections : t.showSections,
3942
4433
  onClick: () => setFold({ ...fold, [c.head.id]: !opened2 }),
3943
4434
  children: [
3944
- /* @__PURE__ */ jsx9("small", { children: c.subs.length }),
3945
- opened2 ? /* @__PURE__ */ jsx9(ChevronDown2, { "aria-hidden": true }) : /* @__PURE__ */ jsx9(ChevronRight2, { "aria-hidden": true })
4435
+ /* @__PURE__ */ jsx12("small", { children: c.subs.length }),
4436
+ opened2 ? /* @__PURE__ */ jsx12(ChevronDown3, { "aria-hidden": true }) : /* @__PURE__ */ jsx12(ChevronRight3, { "aria-hidden": true })
3946
4437
  ]
3947
4438
  }
3948
4439
  )
3949
4440
  ] }),
3950
- opened2 && subs.length > 0 && /* @__PURE__ */ jsx9("div", { className: "w100n-docs-sections", children: subs.map((s) => /* @__PURE__ */ jsxs9(
4441
+ opened2 && subs.length > 0 && /* @__PURE__ */ jsx12("div", { className: "w100n-docs-sections", children: subs.map((s) => /* @__PURE__ */ jsxs12(
3951
4442
  "button",
3952
4443
  {
3953
4444
  type: "button",
@@ -3956,7 +4447,7 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place, onP
3956
4447
  "data-state": i < reached || i === reached && c.subs.indexOf(s) < mark ? "done" : void 0,
3957
4448
  "aria-current": now?.id === s.id ? "location" : void 0,
3958
4449
  children: [
3959
- /* @__PURE__ */ jsx9("i", { "aria-hidden": true }),
4450
+ /* @__PURE__ */ jsx12("i", { "aria-hidden": true }),
3960
4451
  s.text
3961
4452
  ]
3962
4453
  },
@@ -3964,46 +4455,47 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place, onP
3964
4455
  )) })
3965
4456
  ] }, c.head.id);
3966
4457
  })
3967
- ] }) : /* @__PURE__ */ jsx9("p", { className: "w100n-docs-muted", children: t.noOutline })),
3968
- tab === "versions" && /* @__PURE__ */ jsxs9("div", { className: "w100n-docs-versions", children: [
4458
+ ] }) : /* @__PURE__ */ jsx12("p", { className: "w100n-docs-muted", children: t.noOutline })),
4459
+ tab === "links" && doc.data.kind === "markdown" && /* @__PURE__ */ jsx12(Backlinks, { host, current: doc.data, notes, t, onOpen: open }),
4460
+ tab === "versions" && /* @__PURE__ */ jsxs12("div", { className: "w100n-docs-versions", children: [
3969
4461
  versions.error && failed(versions.retry),
3970
- (versions.data ?? []).map((item) => /* @__PURE__ */ jsxs9(
4462
+ (versions.data ?? []).map((item) => /* @__PURE__ */ jsxs12(
3971
4463
  "button",
3972
4464
  {
3973
4465
  type: "button",
3974
4466
  "aria-pressed": (versionId ?? "current") === item.id || !versionId && item.current,
3975
4467
  onClick: () => view(item.current ? null : item.id),
3976
4468
  children: [
3977
- /* @__PURE__ */ jsxs9("b", { children: [
4469
+ /* @__PURE__ */ jsxs12("b", { children: [
3978
4470
  date(item.createdAt),
3979
- item.current && /* @__PURE__ */ jsx9("span", { className: "w100n-docs-badge", children: t.current })
4471
+ item.current && /* @__PURE__ */ jsx12("span", { className: "w100n-docs-badge", children: t.current })
3980
4472
  ] }),
3981
- /* @__PURE__ */ jsx9("small", { children: [item.author?.name, size(item.size), item.note].filter(Boolean).join(" \xB7 ") })
4473
+ /* @__PURE__ */ jsx12("small", { children: [item.author?.name, size(item.size), item.note].filter(Boolean).join(" \xB7 ") })
3982
4474
  ]
3983
4475
  },
3984
4476
  item.id
3985
4477
  ))
3986
4478
  ] }),
3987
- tab === "details" && /* @__PURE__ */ jsxs9("dl", { className: "w100n-docs-details", children: [
3988
- /* @__PURE__ */ jsx9("dt", { children: t.kind }),
3989
- /* @__PURE__ */ jsx9("dd", { children: t.kinds[doc.data.kind] }),
3990
- /* @__PURE__ */ jsx9("dt", { children: t.size }),
3991
- /* @__PURE__ */ jsx9("dd", { children: size(doc.data.size) }),
3992
- /* @__PURE__ */ jsx9("dt", { children: t.updated }),
3993
- /* @__PURE__ */ jsx9("dd", { children: date(doc.data.updatedAt) }),
3994
- doc.data.updatedBy && /* @__PURE__ */ jsxs9(Fragment8, { children: [
3995
- /* @__PURE__ */ jsx9("dt", { children: t.by }),
3996
- /* @__PURE__ */ jsx9("dd", { children: doc.data.updatedBy.name })
4479
+ tab === "details" && /* @__PURE__ */ jsxs12("dl", { className: "w100n-docs-details", children: [
4480
+ /* @__PURE__ */ jsx12("dt", { children: t.kind }),
4481
+ /* @__PURE__ */ jsx12("dd", { children: t.kinds[doc.data.kind] }),
4482
+ /* @__PURE__ */ jsx12("dt", { children: t.size }),
4483
+ /* @__PURE__ */ jsx12("dd", { children: size(doc.data.size) }),
4484
+ /* @__PURE__ */ jsx12("dt", { children: t.updated }),
4485
+ /* @__PURE__ */ jsx12("dd", { children: date(doc.data.updatedAt) }),
4486
+ doc.data.updatedBy && /* @__PURE__ */ jsxs12(Fragment11, { children: [
4487
+ /* @__PURE__ */ jsx12("dt", { children: t.by }),
4488
+ /* @__PURE__ */ jsx12("dd", { children: doc.data.updatedBy.name })
3997
4489
  ] }),
3998
- /* @__PURE__ */ jsx9("dt", { children: t.rights }),
3999
- /* @__PURE__ */ jsx9("dd", { children: [doc.data.rights.view && t.view, doc.data.rights.comment && t.comment, doc.data.rights.edit && t.edit].filter(Boolean).join(", ") })
4490
+ /* @__PURE__ */ jsx12("dt", { children: t.rights }),
4491
+ /* @__PURE__ */ jsx12("dd", { children: [doc.data.rights.view && t.view, doc.data.rights.comment && t.comment, doc.data.rights.edit && t.edit].filter(Boolean).join(", ") })
4000
4492
  ] }),
4001
- tab === "details" && host.exportAs && !!doc.data.exports?.length && /* @__PURE__ */ jsxs9("div", { className: "w100n-docs-about", children: [
4002
- /* @__PURE__ */ jsxs9("p", { className: "w100n-docs-caption", children: [
4003
- /* @__PURE__ */ jsx9(FileDown, { "aria-hidden": true }),
4493
+ tab === "details" && host.exportAs && !!doc.data.exports?.length && /* @__PURE__ */ jsxs12("div", { className: "w100n-docs-about", children: [
4494
+ /* @__PURE__ */ jsxs12("p", { className: "w100n-docs-caption", children: [
4495
+ /* @__PURE__ */ jsx12(FileDown, { "aria-hidden": true }),
4004
4496
  t.exportAs
4005
4497
  ] }),
4006
- /* @__PURE__ */ jsx9("div", { className: "w100n-docs-chips", children: doc.data.exports.map((format) => /* @__PURE__ */ jsxs9(
4498
+ /* @__PURE__ */ jsx12("div", { className: "w100n-docs-chips", children: doc.data.exports.map((format) => /* @__PURE__ */ jsxs12(
4007
4499
  "button",
4008
4500
  {
4009
4501
  type: "button",
@@ -4011,22 +4503,22 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place, onP
4011
4503
  disabled: exporting === "busy",
4012
4504
  onClick: () => void exportAs(doc.data, format),
4013
4505
  children: [
4014
- /* @__PURE__ */ jsx9(FileDown, { "aria-hidden": true }),
4506
+ /* @__PURE__ */ jsx12(FileDown, { "aria-hidden": true }),
4015
4507
  format.toUpperCase()
4016
4508
  ]
4017
4509
  },
4018
4510
  format
4019
4511
  )) }),
4020
- exporting === "failed" && /* @__PURE__ */ jsx9("p", { className: "w100n-docs-muted", children: t.exportFailed })
4512
+ exporting === "failed" && /* @__PURE__ */ jsx12("p", { className: "w100n-docs-muted", children: t.exportFailed })
4021
4513
  ] }),
4022
- tab === "comments" && /* @__PURE__ */ jsx9("div", { ref: setBox }),
4023
- tab === "sharing" && sharing && /* @__PURE__ */ jsx9(Sharing, { host, doc: doc.data, t, language, team: names2.get(doc.data.spaceId) }),
4024
- tab === "signatures" && /* @__PURE__ */ jsxs9("div", { className: "w100n-docs-versions", children: [
4514
+ tab === "comments" && /* @__PURE__ */ jsx12("div", { ref: setBox }),
4515
+ tab === "sharing" && sharing && /* @__PURE__ */ jsx12(Sharing, { host, doc: doc.data, t, language, team: names2.get(doc.data.spaceId) }),
4516
+ tab === "signatures" && /* @__PURE__ */ jsxs12("div", { className: "w100n-docs-versions", children: [
4025
4517
  signatures.error && failed(signatures.retry),
4026
- signatures.data?.length === 0 && /* @__PURE__ */ jsx9("p", { className: "w100n-docs-muted", children: t.noSignatures }),
4518
+ signatures.data?.length === 0 && /* @__PURE__ */ jsx12("p", { className: "w100n-docs-muted", children: t.noSignatures }),
4027
4519
  (signatures.data ?? []).map((entry) => {
4028
4520
  const signed = versions.data?.find((v) => v.id === entry.versionId);
4029
- return /* @__PURE__ */ jsxs9(
4521
+ return /* @__PURE__ */ jsxs12(
4030
4522
  "button",
4031
4523
  {
4032
4524
  type: "button",
@@ -4034,15 +4526,15 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place, onP
4034
4526
  "aria-pressed": !!signed && (versionId ?? versions.data?.find((v) => v.current)?.id) === signed.id,
4035
4527
  onClick: () => view(signed.current ? null : signed.id),
4036
4528
  children: [
4037
- /* @__PURE__ */ jsxs9("b", { children: [
4529
+ /* @__PURE__ */ jsxs12("b", { children: [
4038
4530
  entry.signer.name,
4039
- /* @__PURE__ */ jsxs9("span", { className: "w100n-docs-badge", children: [
4531
+ /* @__PURE__ */ jsxs12("span", { className: "w100n-docs-badge", children: [
4040
4532
  t.page,
4041
4533
  " ",
4042
4534
  entry.page
4043
4535
  ] })
4044
4536
  ] }),
4045
- /* @__PURE__ */ jsx9("small", { children: [date(entry.signedAt), t.methods[entry.method], signed && (signed.current ? t.current : `${t.version} ${date(signed.createdAt)}`)].filter(Boolean).join(" \xB7 ") })
4537
+ /* @__PURE__ */ jsx12("small", { children: [date(entry.signedAt), t.methods[entry.method], signed && (signed.current ? t.current : `${t.version} ${date(signed.createdAt)}`)].filter(Boolean).join(" \xB7 ") })
4046
4538
  ]
4047
4539
  },
4048
4540
  entry.id
@@ -4053,88 +4545,179 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place, onP
4053
4545
  ] })
4054
4546
  ] })
4055
4547
  ] }),
4056
- making && /* @__PURE__ */ jsx9(NewDocument, { host, t, onClose: () => setMaking(false), onMade: (made) => {
4548
+ jump && /* @__PURE__ */ jsx12(
4549
+ Jump,
4550
+ {
4551
+ mode: jump,
4552
+ items: all,
4553
+ actions: commands,
4554
+ t,
4555
+ onClose: () => setJump(null),
4556
+ onOpen: open,
4557
+ onCreate: host.create ? (name) => void note(name, true) : void 0,
4558
+ place: (item) => [!spaceId && names2.get(item.spaceId), item.folder].filter(Boolean).join(" / ")
4559
+ }
4560
+ ),
4561
+ making && /* @__PURE__ */ jsx12(NewDocument, { host, t, onClose: () => setMaking(false), onMade: (made) => {
4057
4562
  setMaking(false);
4058
4563
  opened(made);
4059
4564
  } }),
4060
- menu && /* @__PURE__ */ jsxs9("div", { className: "w100n-docs-menu w100n-docs-context", role: "menu", "aria-label": t.fileActions, style: { left: menu.x, top: menu.y }, children: [
4061
- /* @__PURE__ */ jsxs9("div", { className: "w100n-docs-context-head", children: [
4062
- /* @__PURE__ */ jsx9("b", { children: menu.item.name }),
4063
- /* @__PURE__ */ jsx9("small", { children: [t.kinds[menu.item.kind], size(menu.item.size), names2.get(menu.item.spaceId), menu.item.folder].filter(Boolean).join(" \xB7 ") }),
4064
- menu.item.createdAt && /* @__PURE__ */ jsx9("small", { children: [t.createdOn.replace("{when}", date(menu.item.createdAt)), menu.item.createdBy?.name].filter(Boolean).join(" \xB7 ") }),
4065
- /* @__PURE__ */ jsx9("small", { children: [t.updatedOn.replace("{when}", ago(menu.item.updatedAt)), menu.item.updatedBy?.name].filter(Boolean).join(" \xB7 ") })
4565
+ menu && /* @__PURE__ */ jsxs12("div", { className: "w100n-docs-menu w100n-docs-context", role: "menu", "aria-label": t.fileActions, style: { left: menu.x, top: menu.y }, children: [
4566
+ /* @__PURE__ */ jsxs12("div", { className: "w100n-docs-context-head", children: [
4567
+ /* @__PURE__ */ jsx12("b", { children: menu.item.name }),
4568
+ /* @__PURE__ */ jsx12("small", { children: [t.kinds[menu.item.kind], size(menu.item.size), names2.get(menu.item.spaceId), menu.item.folder].filter(Boolean).join(" \xB7 ") }),
4569
+ menu.item.createdAt && /* @__PURE__ */ jsx12("small", { children: [t.createdOn.replace("{when}", date(menu.item.createdAt)), menu.item.createdBy?.name].filter(Boolean).join(" \xB7 ") }),
4570
+ /* @__PURE__ */ jsx12("small", { children: [t.updatedOn.replace("{when}", ago(menu.item.updatedAt)), menu.item.updatedBy?.name].filter(Boolean).join(" \xB7 ") })
4066
4571
  ] }),
4067
- menu.sure ? /* @__PURE__ */ jsxs9("div", { className: "w100n-docs-context-ask", children: [
4068
- /* @__PURE__ */ jsx9("p", { children: t.trashAsk.replace("{name}", menu.item.name) }),
4069
- /* @__PURE__ */ jsxs9("span", { className: "w100n-pdf-dialog-end", children: [
4070
- /* @__PURE__ */ jsx9("button", { type: "button", className: "w100n-pdf-link", onClick: () => setMenu({ ...menu, sure: false }), children: t.cancel }),
4071
- /* @__PURE__ */ jsxs9("button", { type: "button", className: "w100n-docs-action", "data-tone": "red", onClick: () => void drop2(menu.item), children: [
4072
- /* @__PURE__ */ jsx9(Trash24, { "aria-hidden": true }),
4572
+ menu.moving ? /* @__PURE__ */ jsx12("div", { className: "w100n-docs-context-list", children: ["", ...dirs.data.get(menu.item.spaceId)].map((folder2) => /* @__PURE__ */ jsxs12(
4573
+ "button",
4574
+ {
4575
+ type: "button",
4576
+ role: "menuitem",
4577
+ disabled: (menu.item.folder ?? "") === folder2,
4578
+ onClick: () => moveTo(menu.item, { spaceId: menu.item.spaceId, folder: folder2 }),
4579
+ style: { paddingLeft: 10 + 14 * (folder2 ? folder2.split("/").length : 0) },
4580
+ children: [
4581
+ /* @__PURE__ */ jsx12(Folder2, { "aria-hidden": true }),
4582
+ folder2 ? folder2.split("/").pop() : names2.get(menu.item.spaceId) ?? t.topLevel
4583
+ ]
4584
+ },
4585
+ folder2
4586
+ )) }) : menu.sure ? /* @__PURE__ */ jsxs12("div", { className: "w100n-docs-context-ask", children: [
4587
+ /* @__PURE__ */ jsx12("p", { children: t.trashAsk.replace("{name}", menu.item.name) }),
4588
+ /* @__PURE__ */ jsxs12("span", { className: "w100n-pdf-dialog-end", children: [
4589
+ /* @__PURE__ */ jsx12("button", { type: "button", className: "w100n-pdf-link", onClick: () => setMenu({ ...menu, sure: false }), children: t.cancel }),
4590
+ /* @__PURE__ */ jsxs12("button", { type: "button", className: "w100n-docs-action", "data-tone": "red", onClick: () => void drop2(menu.item), children: [
4591
+ /* @__PURE__ */ jsx12(Trash24, { "aria-hidden": true }),
4073
4592
  t.trash
4074
4593
  ] })
4075
4594
  ] })
4076
- ] }) : /* @__PURE__ */ jsxs9(Fragment8, { children: [
4077
- /* @__PURE__ */ jsxs9("button", { type: "button", role: "menuitem", onClick: () => {
4595
+ ] }) : /* @__PURE__ */ jsxs12(Fragment11, { children: [
4596
+ /* @__PURE__ */ jsxs12("button", { type: "button", role: "menuitem", onClick: () => {
4078
4597
  setMenu(null);
4079
4598
  open(menu.item);
4080
4599
  }, children: [
4081
- /* @__PURE__ */ jsx9(FileText3, { "aria-hidden": true }),
4600
+ /* @__PURE__ */ jsx12(FileText4, { "aria-hidden": true }),
4082
4601
  t.openFile
4083
4602
  ] }),
4084
- host.href && /* @__PURE__ */ jsxs9("button", { type: "button", role: "menuitem", onClick: () => {
4603
+ host.href && /* @__PURE__ */ jsxs12("button", { type: "button", role: "menuitem", onClick: () => {
4085
4604
  setMenu(null);
4086
4605
  window.open(host.href(menu.item.id), "_blank", "noopener");
4087
4606
  }, children: [
4088
- /* @__PURE__ */ jsx9(ExternalLink2, { "aria-hidden": true }),
4607
+ /* @__PURE__ */ jsx12(ExternalLink2, { "aria-hidden": true }),
4089
4608
  t.openTab
4090
4609
  ] }),
4091
- host.href && /* @__PURE__ */ jsxs9("button", { type: "button", role: "menuitem", onClick: () => void act(() => navigator.clipboard.writeText(host.href(menu.item.id)), t.linkCopied), children: [
4092
- /* @__PURE__ */ jsx9(Link2, { "aria-hidden": true }),
4610
+ host.href && /* @__PURE__ */ jsxs12("button", { type: "button", role: "menuitem", onClick: () => void act(() => navigator.clipboard.writeText(host.href(menu.item.id)), t.linkCopied), children: [
4611
+ /* @__PURE__ */ jsx12(Link2, { "aria-hidden": true }),
4093
4612
  t.copyLink
4094
4613
  ] }),
4095
- host.send && /* @__PURE__ */ jsxs9("button", { type: "button", role: "menuitem", onClick: () => {
4614
+ host.send && /* @__PURE__ */ jsxs12("button", { type: "button", role: "menuitem", onClick: () => {
4096
4615
  setMenu(null);
4097
4616
  host.send(menu.item.id);
4098
4617
  }, children: [
4099
- /* @__PURE__ */ jsx9(Send, { "aria-hidden": true }),
4618
+ /* @__PURE__ */ jsx12(Send, { "aria-hidden": true }),
4100
4619
  t.sendChat
4101
4620
  ] }),
4102
- /* @__PURE__ */ jsx9("hr", {}),
4103
- host.rename && /* @__PURE__ */ jsxs9("button", { type: "button", role: "menuitem", onClick: () => {
4621
+ /* @__PURE__ */ jsx12("hr", {}),
4622
+ host.rename && /* @__PURE__ */ jsxs12("button", { type: "button", role: "menuitem", onClick: () => {
4623
+ const item = menu.item;
4104
4624
  setMenu(null);
4105
- setNaming({ id: menu.item.id, text: menu.item.name.replace(/\.[^.]+$/, "") });
4625
+ if (shape2 === "tree") setEdit({ key: `file:${item.id}`, text: item.name.replace(/\.[^.]+$/, ""), run: (text2) => retitle(item, text2) });
4626
+ else setNaming({ id: item.id, text: item.name.replace(/\.[^.]+$/, "") });
4106
4627
  }, children: [
4107
- /* @__PURE__ */ jsx9(Pencil, { "aria-hidden": true }),
4628
+ /* @__PURE__ */ jsx12(Pencil, { "aria-hidden": true }),
4108
4629
  t.rename
4109
4630
  ] }),
4110
- host.create && /* @__PURE__ */ jsxs9("button", { type: "button", role: "menuitem", onClick: () => void act(async () => copy(await host.document(menu.item.id))), children: [
4111
- /* @__PURE__ */ jsx9(Copy3, { "aria-hidden": true }),
4631
+ host.move && dirs.data?.has(menu.item.spaceId) && /* @__PURE__ */ jsxs12("button", { type: "button", role: "menuitem", "aria-haspopup": "menu", onClick: () => setMenu({ ...menu, moving: true }), children: [
4632
+ /* @__PURE__ */ jsx12(FolderInput, { "aria-hidden": true }),
4633
+ t.moveTo
4634
+ ] }),
4635
+ host.create && /* @__PURE__ */ jsxs12("button", { type: "button", role: "menuitem", onClick: () => void act(async () => copy(await host.document(menu.item.id))), children: [
4636
+ /* @__PURE__ */ jsx12(Copy3, { "aria-hidden": true }),
4112
4637
  t.makeCopy
4113
4638
  ] }),
4114
- /* @__PURE__ */ jsxs9("button", { type: "button", role: "menuitem", onClick: () => void act(() => fetchFile(menu.item)), children: [
4115
- /* @__PURE__ */ jsx9(Download3, { "aria-hidden": true }),
4639
+ /* @__PURE__ */ jsxs12("button", { type: "button", role: "menuitem", onClick: () => void act(() => fetchFile(menu.item)), children: [
4640
+ /* @__PURE__ */ jsx12(Download3, { "aria-hidden": true }),
4116
4641
  t.download
4117
4642
  ] }),
4118
- host.saveTemplate && /* @__PURE__ */ jsxs9("button", { type: "button", role: "menuitem", onClick: () => void act(() => host.saveTemplate(menu.item.id), t.templateSaved), children: [
4119
- /* @__PURE__ */ jsx9(Bookmark, { "aria-hidden": true }),
4643
+ host.saveTemplate && /* @__PURE__ */ jsxs12("button", { type: "button", role: "menuitem", onClick: () => void act(() => host.saveTemplate(menu.item.id), t.templateSaved), children: [
4644
+ /* @__PURE__ */ jsx12(Bookmark, { "aria-hidden": true }),
4120
4645
  t.saveTemplate
4121
4646
  ] }),
4122
- /* @__PURE__ */ jsxs9("button", { type: "button", role: "menuitem", onClick: () => {
4647
+ /* @__PURE__ */ jsxs12("button", { type: "button", role: "menuitem", onClick: () => {
4123
4648
  setMenu(null);
4124
4649
  open(menu.item);
4125
4650
  setTab("details");
4126
4651
  side("panel", true);
4127
4652
  }, children: [
4128
- /* @__PURE__ */ jsx9(Info, { "aria-hidden": true }),
4653
+ /* @__PURE__ */ jsx12(Info, { "aria-hidden": true }),
4129
4654
  t.details
4130
4655
  ] }),
4131
- host.remove && /* @__PURE__ */ jsxs9(Fragment8, { children: [
4132
- /* @__PURE__ */ jsx9("hr", {}),
4133
- /* @__PURE__ */ jsxs9("button", { type: "button", role: "menuitem", "data-tone": "red", onClick: () => setMenu({ ...menu, sure: true }), children: [
4134
- /* @__PURE__ */ jsx9(Trash24, { "aria-hidden": true }),
4656
+ host.remove && /* @__PURE__ */ jsxs12(Fragment11, { children: [
4657
+ /* @__PURE__ */ jsx12("hr", {}),
4658
+ /* @__PURE__ */ jsxs12("button", { type: "button", role: "menuitem", "data-tone": "red", onClick: () => setMenu({ ...menu, sure: true }), children: [
4659
+ /* @__PURE__ */ jsx12(Trash24, { "aria-hidden": true }),
4660
+ t.trash
4661
+ ] })
4662
+ ] })
4663
+ ] })
4664
+ ] }),
4665
+ spot2 && /* @__PURE__ */ jsxs12("div", { className: "w100n-docs-menu w100n-docs-context", role: "menu", "aria-label": t.folderActions, style: { left: spot2.x, top: spot2.y }, children: [
4666
+ /* @__PURE__ */ jsxs12("div", { className: "w100n-docs-context-head", children: [
4667
+ /* @__PURE__ */ jsx12("b", { children: folderNamed(spot2.at) }),
4668
+ spot2.at.folder && /* @__PURE__ */ jsx12("small", { children: [names2.get(spot2.at.spaceId), ...spot2.at.folder.split("/").slice(0, -1)].filter(Boolean).join(" / ") })
4669
+ ] }),
4670
+ spot2.sure ? /* @__PURE__ */ jsxs12("div", { className: "w100n-docs-context-ask", children: [
4671
+ /* @__PURE__ */ jsx12("p", { children: t.folderTrashAsk.replace("{name}", folderNamed(spot2.at)) }),
4672
+ /* @__PURE__ */ jsxs12("span", { className: "w100n-pdf-dialog-end", children: [
4673
+ /* @__PURE__ */ jsx12("button", { type: "button", className: "w100n-pdf-link", onClick: () => setSpot({ ...spot2, sure: false }), children: t.cancel }),
4674
+ /* @__PURE__ */ jsxs12("button", { type: "button", className: "w100n-docs-action", "data-tone": "red", onClick: () => {
4675
+ const at = spot2.at;
4676
+ const inside2 = doc.data && doc.data.spaceId === at.spaceId && `${doc.data.folder ?? ""}/`.startsWith(`${at.folder}/`);
4677
+ void act(() => host.removeFolder(at), t.trashed).then(() => {
4678
+ refresh();
4679
+ if (inside2) go({ spaceId: here.spaceId, documentId: null });
4680
+ });
4681
+ }, children: [
4682
+ /* @__PURE__ */ jsx12(Trash24, { "aria-hidden": true }),
4135
4683
  t.trash
4136
4684
  ] })
4137
4685
  ] })
4686
+ ] }) : /* @__PURE__ */ jsxs12(Fragment11, { children: [
4687
+ host.create && /* @__PURE__ */ jsxs12("button", { type: "button", role: "menuitem", onClick: () => {
4688
+ const at = spot2.at;
4689
+ setSpot(null);
4690
+ void note(t.untitled, true, at);
4691
+ }, children: [
4692
+ /* @__PURE__ */ jsx12(FilePlus, { "aria-hidden": true }),
4693
+ t.newNoteHere
4694
+ ] }),
4695
+ host.makeFolder && /* @__PURE__ */ jsxs12("button", { type: "button", role: "menuitem", onClick: () => {
4696
+ const at = spot2.at;
4697
+ setSpot(null);
4698
+ setEdit({ key: `new:${spot2.key}`, text: t.newFolder, run: (name) => act(() => host.makeFolder(at, name)).then(refresh) });
4699
+ }, children: [
4700
+ /* @__PURE__ */ jsx12(FolderPlus, { "aria-hidden": true }),
4701
+ t.newFolder
4702
+ ] }),
4703
+ spot2.at.folder && host.renameFolder && /* @__PURE__ */ jsxs12(Fragment11, { children: [
4704
+ /* @__PURE__ */ jsx12("hr", {}),
4705
+ /* @__PURE__ */ jsxs12("button", { type: "button", role: "menuitem", onClick: () => {
4706
+ const at = spot2.at;
4707
+ setSpot(null);
4708
+ setEdit({ key: `dir:${spot2.key}`, text: folderNamed(at), run: (name) => name === folderNamed(at) ? Promise.resolve() : act(() => host.renameFolder(at, name)).then(refresh) });
4709
+ }, children: [
4710
+ /* @__PURE__ */ jsx12(Pencil, { "aria-hidden": true }),
4711
+ t.renameFolder
4712
+ ] })
4713
+ ] }),
4714
+ spot2.at.folder && host.removeFolder && /* @__PURE__ */ jsxs12(Fragment11, { children: [
4715
+ /* @__PURE__ */ jsx12("hr", {}),
4716
+ /* @__PURE__ */ jsxs12("button", { type: "button", role: "menuitem", "data-tone": "red", onClick: () => setSpot({ ...spot2, sure: true }), children: [
4717
+ /* @__PURE__ */ jsx12(Trash24, { "aria-hidden": true }),
4718
+ t.trashFolder
4719
+ ] })
4720
+ ] })
4138
4721
  ] })
4139
4722
  ] }),
4140
4723
  dialog
@@ -4142,22 +4725,22 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place, onP
4142
4725
  }
4143
4726
 
4144
4727
  // src/FilePreview.tsx
4145
- import { useState as useState10 } from "react";
4146
- import { jsx as jsx10 } from "react/jsx-runtime";
4728
+ import { useState as useState12 } from "react";
4729
+ import { jsx as jsx13 } from "react/jsx-runtime";
4147
4730
  function FilePreview({ url, name, mimeType, size = 0, bytes, pdfWorker }) {
4148
- const [source] = useState10(() => ({ pdfWorker, content: () => bytes ? bytes(url) : fetch(url, { credentials: "include" }).then((res) => res.ok ? res.arrayBuffer() : Promise.reject(new Error(String(res.status)))) }));
4731
+ const [source] = useState12(() => ({ pdfWorker, content: () => bytes ? bytes(url) : fetch(url, { credentials: "include" }).then((res) => res.ok ? res.arrayBuffer() : Promise.reject(new Error(String(res.status)))) }));
4149
4732
  const kind = kindOf(name, mimeType);
4150
4733
  if (!kind) return null;
4151
- return /* @__PURE__ */ jsx10("span", { className: "w100n-preview", children: /* @__PURE__ */ jsx10(Thumb, { host: source, item: { id: url.split("?")[0], spaceId: "", name, kind, size, updatedAt: "" } }) });
4734
+ return /* @__PURE__ */ jsx13("span", { className: "w100n-preview", children: /* @__PURE__ */ jsx13(Thumb, { host: source, item: { id: url.split("?")[0], spaceId: "", name, kind, size, updatedAt: "" } }) });
4152
4735
  }
4153
4736
 
4154
4737
  // src/GuestDocument.tsx
4155
- import { lazy as lazy3, Suspense as Suspense3, useRef as useRef7, useState as useState11 } from "react";
4156
- import { Ban as Ban2, Download as Download4, Eye as Eye2, FileDown as FileDown2, FileSpreadsheet as FileSpreadsheet4, FileText as FileText4, FileType as FileType4, Files as Files3, Lock as Lock2, Presentation as Presentation4, UserRound } from "lucide-react";
4157
- import { Fragment as Fragment9, jsx as jsx11, jsxs as jsxs10 } from "react/jsx-runtime";
4158
- var TextEditor3 = lazy3(() => import("./TextEditor-5S7FSLIZ.js"));
4159
- var SheetView3 = lazy3(() => import("./SheetView-OEKOHMKW.js"));
4160
- var icons4 = { docx: FileText4, markdown: FileType4, pdf: Files3, sheet: FileSpreadsheet4, slides: Presentation4 };
4738
+ import { lazy as lazy3, Suspense as Suspense3, useRef as useRef7, useState as useState13 } from "react";
4739
+ import { Ban as Ban2, Download as Download4, Eye as Eye2, FileDown as FileDown2, FileSpreadsheet as FileSpreadsheet5, FileText as FileText5, FileType as FileType7, Files as Files4, Lock as Lock2, Presentation as Presentation5, UserRound } from "lucide-react";
4740
+ import { Fragment as Fragment12, jsx as jsx14, jsxs as jsxs13 } from "react/jsx-runtime";
4741
+ var TextEditor3 = lazy3(() => import("./TextEditor-CYS4U5XA.js"));
4742
+ var SheetView3 = lazy3(() => import("./SheetView-43JDIP7D.js"));
4743
+ var icons5 = { docx: FileText5, markdown: FileType7, pdf: Files4, sheet: FileSpreadsheet5, slides: Presentation5 };
4161
4744
  var GuestRefused = class extends Error {
4162
4745
  constructor(reason, file = "", sharedBy = "") {
4163
4746
  super(reason);
@@ -4166,7 +4749,7 @@ var GuestRefused = class extends Error {
4166
4749
  this.sharedBy = sharedBy;
4167
4750
  }
4168
4751
  };
4169
- var remembered = () => {
4752
+ var remembered2 = () => {
4170
4753
  try {
4171
4754
  return localStorage.getItem("w100n-guest-name") ?? "";
4172
4755
  } catch {
@@ -4182,14 +4765,14 @@ var remember = (name) => {
4182
4765
  };
4183
4766
  function GuestDocument({ host, language = "en", theme = "light", brand }) {
4184
4767
  const t = texts[language];
4185
- const [ask, setAsk] = useState11(() => ({ name: remembered() || void 0 }));
4186
- const [typed, setTyped] = useState11("");
4187
- const [name, setName] = useState11(remembered);
4768
+ const [ask, setAsk] = useState13(() => ({ name: remembered2() || void 0 }));
4769
+ const [typed, setTyped] = useState13("");
4770
+ const [name, setName] = useState13(remembered2);
4188
4771
  const named = useRef7(name);
4189
- const [slot, setSlot] = useState11(null);
4190
- const [saving, setSaving] = useState11("idle");
4772
+ const [slot, setSlot] = useState13(null);
4773
+ const [saving, setSaving] = useState13("idle");
4191
4774
  const opened = useLoad((signal) => host.open(ask, { signal }), [host, ask]);
4192
- const [notes] = useState11(() => ({
4775
+ const [notes] = useState13(() => ({
4193
4776
  me: { id: "", name: "" },
4194
4777
  spaces: async () => [],
4195
4778
  documents: async () => [],
@@ -4215,18 +4798,18 @@ function GuestDocument({ host, language = "en", theme = "light", brand }) {
4215
4798
  };
4216
4799
  const top = (file2, badge) => {
4217
4800
  const kind2 = file2 ? kindOf(file2.name, file2.mimeType) : null;
4218
- const Kind = kind2 ? icons4[kind2] : FileText4;
4219
- return /* @__PURE__ */ jsxs10("header", { className: "w100n-docs-bar w100n-guest-bar", children: [
4220
- brand && /* @__PURE__ */ jsx11("span", { className: "w100n-guest-brand", children: brand }),
4221
- file2 && /* @__PURE__ */ jsxs10(Fragment9, { children: [
4222
- /* @__PURE__ */ jsx11("span", { className: "w100n-docs-tile", "data-kind": kind2, children: /* @__PURE__ */ jsx11(Kind, { "aria-hidden": true }) }),
4223
- /* @__PURE__ */ jsxs10("div", { className: "w100n-docs-heading", children: [
4224
- /* @__PURE__ */ jsx11("strong", { className: "w100n-docs-title", children: file2.name }),
4225
- file2.sharedBy && /* @__PURE__ */ jsx11("span", { className: "w100n-docs-crumbs", children: t.sharedBy.replace("{name}", file2.sharedBy) })
4801
+ const Kind = kind2 ? icons5[kind2] : FileText5;
4802
+ return /* @__PURE__ */ jsxs13("header", { className: "w100n-docs-bar w100n-guest-bar", children: [
4803
+ brand && /* @__PURE__ */ jsx14("span", { className: "w100n-guest-brand", children: brand }),
4804
+ file2 && /* @__PURE__ */ jsxs13(Fragment12, { children: [
4805
+ /* @__PURE__ */ jsx14("span", { className: "w100n-docs-tile", "data-kind": kind2, children: /* @__PURE__ */ jsx14(Kind, { "aria-hidden": true }) }),
4806
+ /* @__PURE__ */ jsxs13("div", { className: "w100n-docs-heading", children: [
4807
+ /* @__PURE__ */ jsx14("strong", { className: "w100n-docs-title", children: file2.name }),
4808
+ file2.sharedBy && /* @__PURE__ */ jsx14("span", { className: "w100n-docs-crumbs", children: t.sharedBy.replace("{name}", file2.sharedBy) })
4226
4809
  ] }),
4227
- badge && /* @__PURE__ */ jsx11("span", { className: "w100n-docs-badge", "data-kind": kind2, children: badge }),
4228
- file2.download && /* @__PURE__ */ jsxs10("div", { className: "w100n-docs-end", children: [
4229
- (kind2 === "docx" || kind2 === "markdown" || kind2 === "sheet" || kind2 === "slides") && /* @__PURE__ */ jsxs10(
4810
+ badge && /* @__PURE__ */ jsx14("span", { className: "w100n-docs-badge", "data-kind": kind2, children: badge }),
4811
+ file2.download && /* @__PURE__ */ jsxs13("div", { className: "w100n-docs-end", children: [
4812
+ (kind2 === "docx" || kind2 === "markdown" || kind2 === "sheet" || kind2 === "slides") && /* @__PURE__ */ jsxs13(
4230
4813
  "button",
4231
4814
  {
4232
4815
  type: "button",
@@ -4237,25 +4820,25 @@ function GuestDocument({ host, language = "en", theme = "light", brand }) {
4237
4820
  "aria-label": t.pdfCopy,
4238
4821
  title: t.pdfCopy,
4239
4822
  children: [
4240
- /* @__PURE__ */ jsx11(FileDown2, { "aria-hidden": true }),
4241
- /* @__PURE__ */ jsx11("span", { children: t.pdfCopy })
4823
+ /* @__PURE__ */ jsx14(FileDown2, { "aria-hidden": true }),
4824
+ /* @__PURE__ */ jsx14("span", { children: t.pdfCopy })
4242
4825
  ]
4243
4826
  }
4244
4827
  ),
4245
- /* @__PURE__ */ jsxs10("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: [
4246
- /* @__PURE__ */ jsx11(Download4, { "aria-hidden": true }),
4247
- /* @__PURE__ */ jsx11("span", { children: t.download })
4828
+ /* @__PURE__ */ jsxs13("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: [
4829
+ /* @__PURE__ */ jsx14(Download4, { "aria-hidden": true }),
4830
+ /* @__PURE__ */ jsx14("span", { children: t.download })
4248
4831
  ] })
4249
4832
  ] })
4250
4833
  ] })
4251
4834
  ] });
4252
4835
  };
4253
- const gate = (tone, Icon, title, body, form) => /* @__PURE__ */ jsxs10("div", { className: "w100n-docs w100n-guest", "data-theme": theme, children: [
4836
+ const gate = (tone, Icon, title, body, form) => /* @__PURE__ */ jsxs13("div", { className: "w100n-docs w100n-guest", "data-theme": theme, children: [
4254
4837
  top(null, null),
4255
- /* @__PURE__ */ jsx11("div", { className: "w100n-guest-gate", children: /* @__PURE__ */ jsxs10("div", { className: "w100n-guest-card", children: [
4256
- /* @__PURE__ */ jsx11("span", { className: "w100n-share-tile", "data-tone": tone, children: /* @__PURE__ */ jsx11(Icon, { "aria-hidden": true }) }),
4257
- /* @__PURE__ */ jsx11("h2", { children: title }),
4258
- /* @__PURE__ */ jsx11("p", { children: body }),
4838
+ /* @__PURE__ */ jsx14("div", { className: "w100n-guest-gate", children: /* @__PURE__ */ jsxs13("div", { className: "w100n-guest-card", children: [
4839
+ /* @__PURE__ */ jsx14("span", { className: "w100n-share-tile", "data-tone": tone, children: /* @__PURE__ */ jsx14(Icon, { "aria-hidden": true }) }),
4840
+ /* @__PURE__ */ jsx14("h2", { children: title }),
4841
+ /* @__PURE__ */ jsx14("p", { children: body }),
4259
4842
  form
4260
4843
  ] }) })
4261
4844
  ] });
@@ -4271,7 +4854,7 @@ function GuestDocument({ host, language = "en", theme = "light", brand }) {
4271
4854
  password ? Lock2 : UserRound,
4272
4855
  refused.file || t.documents,
4273
4856
  shared + (password ? t.passwordAsk : t.nameAsk),
4274
- /* @__PURE__ */ jsxs10("form", { className: "w100n-guest-form", onSubmit: (e) => {
4857
+ /* @__PURE__ */ jsxs13("form", { className: "w100n-guest-form", onSubmit: (e) => {
4275
4858
  e.preventDefault();
4276
4859
  if (!typed.trim()) return;
4277
4860
  if (password) setAsk({ ...ask, password: typed });
@@ -4281,7 +4864,7 @@ function GuestDocument({ host, language = "en", theme = "light", brand }) {
4281
4864
  }
4282
4865
  setTyped("");
4283
4866
  }, children: [
4284
- /* @__PURE__ */ jsx11(
4867
+ /* @__PURE__ */ jsx14(
4285
4868
  "input",
4286
4869
  {
4287
4870
  className: "w100n-share-input",
@@ -4294,21 +4877,21 @@ function GuestDocument({ host, language = "en", theme = "light", brand }) {
4294
4877
  onChange: (e) => setTyped(e.target.value)
4295
4878
  }
4296
4879
  ),
4297
- refused.reason === "wrong" && /* @__PURE__ */ jsx11("p", { className: "w100n-docs-muted", role: "alert", children: t.wrongPassword }),
4298
- /* @__PURE__ */ jsxs10("button", { type: "submit", className: "w100n-docs-action", disabled: !typed.trim(), children: [
4299
- /* @__PURE__ */ jsx11(Eye2, { "aria-hidden": true }),
4880
+ refused.reason === "wrong" && /* @__PURE__ */ jsx14("p", { className: "w100n-docs-muted", role: "alert", children: t.wrongPassword }),
4881
+ /* @__PURE__ */ jsxs13("button", { type: "submit", className: "w100n-docs-action", disabled: !typed.trim(), children: [
4882
+ /* @__PURE__ */ jsx14(Eye2, { "aria-hidden": true }),
4300
4883
  t.openDoc
4301
4884
  ] })
4302
4885
  ] })
4303
4886
  );
4304
4887
  }
4305
4888
  if (refused?.reason === "busy") return gate("slate", Ban2, t.failed, t.tooMany);
4306
- return gate("slate", Ban2, t.failed, "", /* @__PURE__ */ jsx11("button", { type: "button", className: "w100n-docs-action", onClick: opened.retry, children: t.retry }));
4889
+ return gate("slate", Ban2, t.failed, "", /* @__PURE__ */ jsx14("button", { type: "button", className: "w100n-docs-action", onClick: opened.retry, children: t.retry }));
4307
4890
  }
4308
4891
  const file = opened.data;
4309
- if (!file) return /* @__PURE__ */ jsxs10("div", { className: "w100n-docs w100n-guest", "data-theme": theme, children: [
4892
+ if (!file) return /* @__PURE__ */ jsxs13("div", { className: "w100n-docs w100n-guest", "data-theme": theme, children: [
4310
4893
  top(null, null),
4311
- /* @__PURE__ */ jsx11("div", { className: "w100n-docs-empty", children: t.loading })
4894
+ /* @__PURE__ */ jsx14("div", { className: "w100n-docs-empty", children: t.loading })
4312
4895
  ] });
4313
4896
  const kind = kindOf(file.name, file.mimeType);
4314
4897
  const text = kind === "docx" || kind === "markdown";
@@ -4316,23 +4899,23 @@ function GuestDocument({ host, language = "en", theme = "light", brand }) {
4316
4899
  const rights = { view: true, comment: talk, edit: false };
4317
4900
  const quiet2 = () => {
4318
4901
  };
4319
- let stage = /* @__PURE__ */ jsx11("div", { className: "w100n-docs-empty", children: t.unsupported });
4320
- if (text) stage = /* @__PURE__ */ jsx11(Suspense3, { fallback: /* @__PURE__ */ jsx11("div", { className: "w100n-docs-empty", children: t.loading }), children: /* @__PURE__ */ jsx11(TextEditor3, { kind, bytes: file.bytes, t, language, rights, host: talk ? notes : void 0, documentId: file.id, onOutline: quiet2, slot: talk ? slot : null }) });
4321
- else if (kind === "pdf") stage = /* @__PURE__ */ jsx11(PdfView, { bytes: file.bytes, t, language, worker: host.pdfWorker, rights, documentId: file.id, onOutline: quiet2 });
4322
- else if (kind === "slides") stage = /* @__PURE__ */ jsx11(SlidesView, { html: new TextDecoder().decode(file.bytes), name: file.name, rights, language, theme, onOutline: quiet2 });
4323
- else if (kind === "sheet") stage = /* @__PURE__ */ jsx11(Suspense3, { fallback: /* @__PURE__ */ jsx11("div", { className: "w100n-docs-empty", children: t.loading }), children: /* @__PURE__ */ jsx11(SheetView3, { bytes: file.bytes, name: file.name, kind: /\.csv$/i.test(file.name) || file.mimeType === "text/csv" ? "csv" : "xlsx", rights, language, theme, documentId: file.id }) });
4324
- return /* @__PURE__ */ jsxs10("div", { className: "w100n-docs w100n-guest", "data-theme": theme, children: [
4902
+ let stage = /* @__PURE__ */ jsx14("div", { className: "w100n-docs-empty", children: t.unsupported });
4903
+ if (text) stage = /* @__PURE__ */ jsx14(Suspense3, { fallback: /* @__PURE__ */ jsx14("div", { className: "w100n-docs-empty", children: t.loading }), children: /* @__PURE__ */ jsx14(TextEditor3, { kind, bytes: file.bytes, t, language, rights, host: talk ? notes : void 0, documentId: file.id, onOutline: quiet2, slot: talk ? slot : null }) });
4904
+ else if (kind === "pdf") stage = /* @__PURE__ */ jsx14(PdfView, { bytes: file.bytes, t, language, worker: host.pdfWorker, rights, documentId: file.id, onOutline: quiet2 });
4905
+ else if (kind === "slides") stage = /* @__PURE__ */ jsx14(SlidesView, { html: new TextDecoder().decode(file.bytes), name: file.name, rights, language, theme, onOutline: quiet2 });
4906
+ else if (kind === "sheet") stage = /* @__PURE__ */ jsx14(Suspense3, { fallback: /* @__PURE__ */ jsx14("div", { className: "w100n-docs-empty", children: t.loading }), children: /* @__PURE__ */ jsx14(SheetView3, { bytes: file.bytes, name: file.name, kind: /\.csv$/i.test(file.name) || file.mimeType === "text/csv" ? "csv" : "xlsx", rights, language, theme, documentId: file.id }) });
4907
+ return /* @__PURE__ */ jsxs13("div", { className: "w100n-docs w100n-guest", "data-theme": theme, children: [
4325
4908
  top(file, talk ? t.badgeComment : t.badgeRead),
4326
- saving === "failed" && /* @__PURE__ */ jsx11("p", { className: "w100n-docs-muted w100n-guest-note", role: "alert", children: t.exportFailed }),
4327
- /* @__PURE__ */ jsxs10("div", { className: "w100n-docs-body w100n-guest-body", children: [
4328
- /* @__PURE__ */ jsx11("main", { className: "w100n-docs-stage", children: /* @__PURE__ */ jsx11("div", { className: "w100n-docs-bare", children: stage }) }),
4329
- talk && /* @__PURE__ */ jsx11("aside", { className: "w100n-docs-side w100n-docs-panel w100n-guest-panel", "aria-label": t.comments, children: /* @__PURE__ */ jsxs10("div", { className: "w100n-docs-panel-body", children: [
4330
- /* @__PURE__ */ jsxs10("label", { className: "w100n-share-field", children: [
4331
- /* @__PURE__ */ jsx11("span", { children: t.yourName }),
4332
- /* @__PURE__ */ jsx11("input", { className: "w100n-share-input", value: name, autoComplete: "name", placeholder: t.yourName, onChange: (e) => typeName(e.target.value) })
4909
+ saving === "failed" && /* @__PURE__ */ jsx14("p", { className: "w100n-docs-muted w100n-guest-note", role: "alert", children: t.exportFailed }),
4910
+ /* @__PURE__ */ jsxs13("div", { className: "w100n-docs-body w100n-guest-body", children: [
4911
+ /* @__PURE__ */ jsx14("main", { className: "w100n-docs-stage", children: /* @__PURE__ */ jsx14("div", { className: "w100n-docs-bare", children: stage }) }),
4912
+ talk && /* @__PURE__ */ jsx14("aside", { className: "w100n-docs-side w100n-docs-panel w100n-guest-panel", "aria-label": t.comments, children: /* @__PURE__ */ jsxs13("div", { className: "w100n-docs-panel-body", children: [
4913
+ /* @__PURE__ */ jsxs13("label", { className: "w100n-share-field", children: [
4914
+ /* @__PURE__ */ jsx14("span", { children: t.yourName }),
4915
+ /* @__PURE__ */ jsx14("input", { className: "w100n-share-input", value: name, autoComplete: "name", placeholder: t.yourName, onChange: (e) => typeName(e.target.value) })
4333
4916
  ] }),
4334
- /* @__PURE__ */ jsx11("p", { className: "w100n-docs-muted", children: name.trim() ? t.nameHint : t.nameNeeded }),
4335
- /* @__PURE__ */ jsx11("div", { ref: setSlot })
4917
+ /* @__PURE__ */ jsx14("p", { className: "w100n-docs-muted", children: name.trim() ? t.nameHint : t.nameNeeded }),
4918
+ /* @__PURE__ */ jsx14("div", { ref: setSlot })
4336
4919
  ] }) })
4337
4920
  ] })
4338
4921
  ] });