@w100n/documents 0.15.1 → 0.16.1

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 (43) hide show
  1. package/dist/Compare-M57FG4R3.js +96 -0
  2. package/dist/Compare-M57FG4R3.js.map +1 -0
  3. package/dist/{SheetView-RPQS43XY.js → SheetView-FVLKQR7J.js} +6 -4
  4. package/dist/{SheetView-RPQS43XY.js.map → SheetView-FVLKQR7J.js.map} +1 -1
  5. package/dist/{TextEditor-D6QH2B7O.js → TextEditor-BF6HCNHL.js} +500 -369
  6. package/dist/TextEditor-BF6HCNHL.js.map +1 -0
  7. package/dist/chunk-EQLBYW42.js +458 -0
  8. package/dist/chunk-EQLBYW42.js.map +1 -0
  9. package/dist/{chunk-BGH36LAR.js → chunk-GN3ZOD36.js} +87 -411
  10. package/dist/chunk-GN3ZOD36.js.map +1 -0
  11. package/dist/chunk-LZYITB56.js +1032 -0
  12. package/dist/chunk-LZYITB56.js.map +1 -0
  13. package/dist/{chunk-XR42B3F5.js → chunk-NPVH2YDI.js} +2 -2
  14. package/dist/{chunk-CAPICJ6B.js → chunk-ZAVXCH7V.js} +51 -1032
  15. package/dist/chunk-ZAVXCH7V.js.map +1 -0
  16. package/dist/collab.cjs +367 -200
  17. package/dist/collab.cjs.map +1 -1
  18. package/dist/collab.d.cts +1 -1
  19. package/dist/collab.d.ts +1 -1
  20. package/dist/collab.js +4 -2
  21. package/dist/index.cjs +1680 -1230
  22. package/dist/index.cjs.map +1 -1
  23. package/dist/index.css +187 -0
  24. package/dist/index.css.map +1 -1
  25. package/dist/index.d.cts +2 -2
  26. package/dist/index.d.ts +2 -2
  27. package/dist/index.js +70 -15
  28. package/dist/index.js.map +1 -1
  29. package/dist/kinds.d.cts +1 -1
  30. package/dist/kinds.d.ts +1 -1
  31. package/dist/memory.cjs +25 -2
  32. package/dist/memory.cjs.map +1 -1
  33. package/dist/memory.d.cts +3 -2
  34. package/dist/memory.d.ts +3 -2
  35. package/dist/memory.js +25 -2
  36. package/dist/memory.js.map +1 -1
  37. package/dist/{types-BTsVooZw.d.cts → types-DNcaU6SK.d.cts} +9 -0
  38. package/dist/{types-BTsVooZw.d.ts → types-DNcaU6SK.d.ts} +9 -0
  39. package/package.json +1 -1
  40. package/dist/TextEditor-D6QH2B7O.js.map +0 -1
  41. package/dist/chunk-BGH36LAR.js.map +0 -1
  42. package/dist/chunk-CAPICJ6B.js.map +0 -1
  43. /package/dist/{chunk-XR42B3F5.js.map → chunk-NPVH2YDI.js.map} +0 -0
@@ -4,7 +4,7 @@ import {
4
4
  } from "./chunk-QDH7EZAF.js";
5
5
  import {
6
6
  useLive
7
- } from "./chunk-XR42B3F5.js";
7
+ } from "./chunk-NPVH2YDI.js";
8
8
  import {
9
9
  a4,
10
10
  align,
@@ -13,7 +13,6 @@ import {
13
13
  clear,
14
14
  decide,
15
15
  entries,
16
- fromMarkdown,
17
16
  indent,
18
17
  kit,
19
18
  letter,
@@ -23,19 +22,23 @@ import {
23
22
  replace,
24
23
  searching,
25
24
  spacing,
26
- suggesting,
25
+ suggesting
26
+ } from "./chunk-GN3ZOD36.js";
27
+ import {
28
+ fromMarkdown,
27
29
  toMarkdown,
28
30
  track
29
- } from "./chunk-BGH36LAR.js";
31
+ } from "./chunk-EQLBYW42.js";
30
32
  import {
31
33
  rove,
32
34
  useRestore
33
35
  } from "./chunk-TDP6OJET.js";
36
+ import "./chunk-LZYITB56.js";
34
37
  import {
35
38
  mathml,
36
39
  readDocx,
37
40
  writeDocx
38
- } from "./chunk-CAPICJ6B.js";
41
+ } from "./chunk-ZAVXCH7V.js";
39
42
  import "./chunk-ISOOUYLI.js";
40
43
 
41
44
  // src/editor/TextEditor.tsx
@@ -103,7 +106,7 @@ import {
103
106
  WifiOff,
104
107
  X
105
108
  } from "lucide-react";
106
- import { Fragment as Fragment2, useEffect, useRef as useRef2, useState as useState2 } from "react";
109
+ import { Fragment as Fragment2, useEffect, useRef as useRef3, useState as useState3 } from "react";
107
110
  import { createPortal } from "react-dom";
108
111
 
109
112
  // src/viewers/DocxView.tsx
@@ -156,8 +159,70 @@ function DocxView({ bytes, onOutline, failed }) {
156
159
  ] });
157
160
  }
158
161
 
162
+ // src/editor/Mentions.tsx
163
+ import { useRef as useRef2, useState as useState2 } from "react";
164
+ import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
165
+ var tagged = (body, people) => people.filter((p) => body.toLocaleLowerCase().includes(`@${p.name.toLocaleLowerCase()}`));
166
+ function Mentions({ value, onChange, onSend, people, label, placeholder, autoFocus }) {
167
+ const field = useRef2(null);
168
+ const [caret, setCaret] = useState2(0);
169
+ const [at, setAt] = useState2(0);
170
+ const [shut, setShut] = useState2(false);
171
+ const typed = /(?:^|\s)@([\p{L}\p{N}.'-]*)$/u.exec(value.slice(0, caret));
172
+ const query = typed?.[1].toLocaleLowerCase() ?? "";
173
+ const found = typed && !shut ? people.filter((p) => p.name.toLocaleLowerCase().split(/\s+/).some((w) => w.startsWith(query)) || p.name.toLocaleLowerCase().startsWith(query)).slice(0, 6) : [];
174
+ const choose = (p) => {
175
+ const start = caret - query.length - 1;
176
+ const next = `${value.slice(0, start)}@${p.name} ${value.slice(caret)}`;
177
+ const end = start + p.name.length + 2;
178
+ onChange(next);
179
+ setCaret(end);
180
+ requestAnimationFrame(() => field.current?.setSelectionRange(end, end));
181
+ };
182
+ return /* @__PURE__ */ jsxs2("span", { className: "w100n-text-mentions", children: [
183
+ /* @__PURE__ */ jsx2(
184
+ "textarea",
185
+ {
186
+ ref: field,
187
+ autoFocus,
188
+ value,
189
+ placeholder,
190
+ "aria-label": label,
191
+ "aria-autocomplete": "list",
192
+ "aria-expanded": found.length > 0,
193
+ onChange: (e) => {
194
+ onChange(e.target.value);
195
+ setCaret(e.target.selectionStart);
196
+ setAt(0);
197
+ setShut(false);
198
+ },
199
+ onClick: (e) => setCaret(e.currentTarget.selectionStart),
200
+ onKeyUp: (e) => {
201
+ if (["ArrowLeft", "ArrowRight", "Home", "End"].includes(e.key)) setCaret(e.currentTarget.selectionStart);
202
+ },
203
+ onKeyDown: (e) => {
204
+ if (found.length && (e.key === "ArrowDown" || e.key === "ArrowUp")) {
205
+ e.preventDefault();
206
+ setAt((at + (e.key === "ArrowDown" ? 1 : found.length - 1)) % found.length);
207
+ } else if (found.length && (e.key === "Enter" || e.key === "Tab") && !e.metaKey && !e.ctrlKey) {
208
+ e.preventDefault();
209
+ choose(found[Math.min(at, found.length - 1)]);
210
+ } else if (found.length && e.key === "Escape") {
211
+ e.stopPropagation();
212
+ setShut(true);
213
+ } else if (e.key === "Enter" && (e.metaKey || e.ctrlKey)) onSend();
214
+ }
215
+ }
216
+ ),
217
+ found.length > 0 && /* @__PURE__ */ jsx2("span", { className: "w100n-text-pop w100n-text-menu w100n-text-people-list", role: "listbox", "aria-label": label, children: found.map((p, i) => /* @__PURE__ */ jsxs2("button", { type: "button", role: "option", "aria-selected": i === Math.min(at, found.length - 1), onMouseDown: (e) => e.preventDefault(), onClick: () => choose(p), children: [
218
+ p.avatarUrl ? /* @__PURE__ */ jsx2("img", { className: "w100n-text-face", src: p.avatarUrl, alt: "" }) : /* @__PURE__ */ jsx2("span", { className: "w100n-text-face", "aria-hidden": true, children: p.name.slice(0, 1).toUpperCase() }),
219
+ /* @__PURE__ */ jsx2("span", { children: p.name })
220
+ ] }, p.id)) })
221
+ ] });
222
+ }
223
+
159
224
  // src/editor/TextEditor.tsx
160
- import { Fragment as Fragment3, jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
225
+ import { Fragment as Fragment3, jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
161
226
  var legal = { width: 816, height: 1344 };
162
227
  var symbols = [
163
228
  ["\xA9", "copyright"],
@@ -229,38 +294,43 @@ function TextEditor({ kind, bytes, t, language, rights, host, together, document
229
294
  const live = useLive(together ? host : void 0, documentId, kind, bytes, source.data?.doc, language, can.edit, onSaved);
230
295
  const shared = live?.ready ? live.wire : null;
231
296
  if (live?.readonly) can.edit = false;
232
- const baseline = useRef2(null);
233
- const anchors = useRef2(/* @__PURE__ */ new Map());
234
- const scroller = useRef2(null);
235
- const root = useRef2(null);
236
- const [pop, setPop] = useState2(null);
237
- const [dialog, setDialog] = useState2(null);
238
- const field = useRef2(null);
239
- const [more, setMore] = useState2(() => typeof localStorage !== "undefined" && localStorage.getItem("w100n-docs-more") === "1");
240
- const [zoom, setZoom] = useState2(null);
241
- const [layout, setLayout] = useState2(null);
242
- const [room, setRoom] = useState2(0);
243
- const [saving, setSaving] = useState2("idle");
244
- const [href, setHref] = useState2("");
245
- const [grid, setGrid] = useState2({ rows: 0, cols: 0 });
246
- const [draft, setDraft] = useState2(null);
247
- const [reply, setReply] = useState2(null);
248
- const [active, setActive] = useState2(null);
249
- const [resolved, setResolved] = useState2(false);
250
- const [posting, setPosting] = useState2("idle");
251
- const [added, setAdded] = useState2([]);
252
- const [changed, setChanged] = useState2({});
253
- const [editing, setEditing] = useState2(null);
254
- const [dropping, setDropping] = useState2(null);
255
- const [failed, setFailed] = useState2(false);
256
- const [paint, setPaint] = useState2(null);
257
- const [query, setQuery] = useState2("");
258
- const [swap, setSwap] = useState2("");
259
- const [matchCase, setMatchCase] = useState2(false);
260
- const [count, setCount] = useState2({ words: 0, pages: 0 });
261
- const [marg, setMarg] = useState2(null);
262
- const [unsetup, setUnsetup] = useState2(false);
263
- const [draft2, setDraft2] = useState2(null);
297
+ const baseline = useRef3(null);
298
+ const anchors = useRef3(/* @__PURE__ */ new Map());
299
+ const scroller = useRef3(null);
300
+ const root = useRef3(null);
301
+ const [pop, setPop] = useState3(null);
302
+ const [spot, setSpot] = useState3({ x: 0, y: 0 });
303
+ const touch = useRef3(false);
304
+ const [spell, setSpell] = useState3(() => typeof localStorage === "undefined" || localStorage.getItem("w100n-docs-spell") !== "0");
305
+ const [dialog, setDialog] = useState3(null);
306
+ const field = useRef3(null);
307
+ const [more, setMore] = useState3(() => typeof localStorage !== "undefined" && localStorage.getItem("w100n-docs-more") === "1");
308
+ const [zoom, setZoom] = useState3(null);
309
+ const [layout, setLayout] = useState3(null);
310
+ const [room, setRoom] = useState3(0);
311
+ const [printed, setPrinted] = useState3(null);
312
+ const flow = docx && !(printed ?? !(room > 0 && room < 640));
313
+ const [saving, setSaving] = useState3("idle");
314
+ const [href, setHref] = useState3("");
315
+ const [grid, setGrid] = useState3({ rows: 0, cols: 0 });
316
+ const [draft, setDraft] = useState3(null);
317
+ const [reply, setReply] = useState3(null);
318
+ const [active, setActive] = useState3(null);
319
+ const [resolved, setResolved] = useState3(false);
320
+ const [posting, setPosting] = useState3("idle");
321
+ const [added, setAdded] = useState3([]);
322
+ const [changed, setChanged] = useState3({});
323
+ const [editing, setEditing] = useState3(null);
324
+ const [dropping, setDropping] = useState3(null);
325
+ const [failed, setFailed] = useState3(false);
326
+ const [paint, setPaint] = useState3(null);
327
+ const [query, setQuery] = useState3("");
328
+ const [swap, setSwap] = useState3("");
329
+ const [matchCase, setMatchCase] = useState3(false);
330
+ const [count, setCount] = useState3({ words: 0, pages: 0 });
331
+ const [marg, setMarg] = useState3(null);
332
+ const [unsetup, setUnsetup] = useState3(false);
333
+ const [draft2, setDraft2] = useState3(null);
264
334
  useRestore(pop !== null);
265
335
  useRestore(editing !== null);
266
336
  useRestore(dropping !== null);
@@ -270,7 +340,7 @@ function TextEditor({ kind, bytes, t, language, rights, host, together, document
270
340
  editable: can.edit && (!live || !!shared),
271
341
  immediatelyRender: true,
272
342
  shouldRerenderOnTransaction: false,
273
- editorProps: { attributes: { class: "w100n-docs-prose w100n-text-body", "aria-label": t.documentText }, transformPastedHTML: cleanPaste },
343
+ editorProps: { attributes: { class: "w100n-docs-prose w100n-text-body", "aria-label": t.documentText, spellcheck: String(spell), lang: language }, transformPastedHTML: cleanPaste },
274
344
  onCreate: ({ editor: made }) => {
275
345
  if (source.data && !live) baseline.current = { bytes, doc: made.state.doc, base: source.data.md && track(source.data.md, made.state.doc) };
276
346
  }
@@ -346,8 +416,8 @@ img { max-width: 100%; } img[data-wrap='left'] { float: left; margin: 0 12pt 6pt
346
416
  };
347
417
  const marginal = marg ?? (source.data && "marginal" in source.data ? source.data.marginal : null) ?? { header: "", footer: "", numbers: false };
348
418
  useEffect(() => {
349
- if (editor && docx && source.data) editor.view.dispatch(editor.state.tr.setMeta(paging, { page, marks: { header: marginal.header, footer: marginal.footer } }));
350
- }, [editor, source.data, page, marginal.header, marginal.footer]);
419
+ if (editor && docx && source.data) editor.view.dispatch(editor.state.tr.setMeta(paging, { page, marks: { header: marginal.header, footer: marginal.footer }, flow }));
420
+ }, [editor, source.data, page, marginal.header, marginal.footer, flow]);
351
421
  useEffect(() => {
352
422
  if (!shared || !docx) return;
353
423
  const map = shared.doc.getMap("setup");
@@ -361,6 +431,8 @@ img { max-width: 100%; } img[data-wrap='left'] { float: left; margin: 0 12pt 6pt
361
431
  return () => map.unobserve(sync);
362
432
  }, [shared, docx]);
363
433
  const loaded = useLoad((signal) => host?.comments ? host.comments(documentId, { signal }) : Promise.resolve([]), [host, documentId]);
434
+ const crowd = useLoad((signal) => host?.people && can.comment ? host.people(documentId, { signal }) : Promise.resolve([]), [host, documentId]);
435
+ const people = (crowd.data ?? []).filter((p) => p.id !== host?.me.id);
364
436
  const all = [...loaded.data ?? [], ...added].flatMap((c) => c.id in changed ? changed[c.id] ?? [] : [c]).filter((c) => !c.replyTo || changed[c.replyTo] !== null);
365
437
  const open = all.filter((c) => !c.replyTo && !c.resolved);
366
438
  const threads = all.filter((c) => !c.replyTo && (resolved || !c.resolved)).sort((a, b) => a.createdAt.localeCompare(b.createdAt));
@@ -461,6 +533,18 @@ img { max-width: 100%; } img[data-wrap='left'] { float: left; margin: 0 12pt 6pt
461
533
  watch.observe(el);
462
534
  return () => watch.disconnect();
463
535
  }, [editor, source.data]);
536
+ useEffect(() => {
537
+ const view = window.visualViewport;
538
+ const el = root.current;
539
+ if (!view || !el) return;
540
+ const lift = () => el.style.setProperty("--kb", `${Math.max(0, innerHeight - view.height - view.offsetTop)}px`);
541
+ view.addEventListener("resize", lift);
542
+ view.addEventListener("scroll", lift);
543
+ return () => {
544
+ view.removeEventListener("resize", lift);
545
+ view.removeEventListener("scroll", lift);
546
+ };
547
+ }, [editor, source.data]);
464
548
  useEffect(() => {
465
549
  const el = root.current;
466
550
  if (!el) return;
@@ -490,11 +574,20 @@ img { max-width: 100%; } img[data-wrap='left'] { float: left; margin: 0 12pt 6pt
490
574
  const close = (e) => {
491
575
  if (!e.target.closest(".w100n-text-pop, [data-pop]")) setPop(null);
492
576
  };
577
+ const off = (e) => {
578
+ if (pop === "context" && (e.type === "scroll" || e.key === "Escape")) setPop(null);
579
+ };
493
580
  document.addEventListener("pointerdown", close);
494
- return () => document.removeEventListener("pointerdown", close);
581
+ window.addEventListener("keydown", off);
582
+ window.addEventListener("scroll", off, true);
583
+ return () => {
584
+ document.removeEventListener("pointerdown", close);
585
+ window.removeEventListener("keydown", off);
586
+ window.removeEventListener("scroll", off, true);
587
+ };
495
588
  }, [pop]);
496
- if (source.error) return docx ? /* @__PURE__ */ jsx2("div", { className: "w100n-docs-scroll", children: /* @__PURE__ */ jsx2(DocxView, { bytes, onOutline, failed: t.failed }) }) : /* @__PURE__ */ jsx2("div", { className: "w100n-docs-empty", children: t.failed });
497
- if (!source.data || !editor || !state || live && !live.ready && !live.late && !live.denied) return /* @__PURE__ */ jsx2("div", { className: "w100n-docs-empty", children: t.loading });
589
+ if (source.error) return docx ? /* @__PURE__ */ jsx3("div", { className: "w100n-docs-scroll", children: /* @__PURE__ */ jsx3(DocxView, { bytes, onOutline, failed: t.failed }) }) : /* @__PURE__ */ jsx3("div", { className: "w100n-docs-empty", children: t.failed });
590
+ if (!source.data || !editor || !state || live && !live.ready && !live.late && !live.denied) return /* @__PURE__ */ jsx3("div", { className: "w100n-docs-empty", children: t.loading });
498
591
  const save = async (auto = false) => {
499
592
  if (live) {
500
593
  if (!can.edit || !live.ready || !live.online || !live.pending || saving === "busy") return false;
@@ -558,7 +651,7 @@ img { max-width: 100%; } img[data-wrap='left'] { float: left; margin: 0 12pt 6pt
558
651
  const { from, to, empty } = editor.state.selection;
559
652
  if (empty || !can.comment) return;
560
653
  editor.view.dispatch(editor.state.tr.setMeta(notes, { pending: { from, to } }));
561
- setDraft({ quote: editor.state.doc.textBetween(from, to, "\n", " "), body: "" });
654
+ setDraft({ quote: editor.state.doc.textBetween(from, to, "\n", " "), body: "", give: false });
562
655
  setPosting("idle");
563
656
  onPanel?.("comments");
564
657
  };
@@ -571,7 +664,7 @@ img { max-width: 100%; } img[data-wrap='left'] { float: left; margin: 0 12pt 6pt
571
664
  setPosting("busy");
572
665
  try {
573
666
  const anchor = uid();
574
- const made = await host.comment(documentId, { body: draft.body.trim(), quote: draft.quote, replyTo: null, anchor });
667
+ const made = await host.comment(documentId, { body: draft.body.trim(), quote: draft.quote, replyTo: null, anchor, assignee: draft.give ? tagged(draft.body, people)[0]?.id ?? null : null });
575
668
  anchors.current.set(made.id, anchor);
576
669
  const range = notes.getState(editor.state).pending;
577
670
  editor.view.dispatch(editor.state.tr.setMeta(notes, { pending: null, spots: [...notes.getState(editor.state).spots, ...range ? [{ id: made.id, ...range }] : []] }));
@@ -624,9 +717,9 @@ img { max-width: 100%; } img[data-wrap='left'] { float: left; margin: 0 12pt 6pt
624
717
  const drops = (c) => mine(c) || c.author.id.startsWith("guest:") && !!rights?.edit;
625
718
  const show = (c) => {
626
719
  setActive(c.id);
627
- const spot = notes.getState(editor.state).spots.find((s) => s.id === c.id);
628
- if (!spot) return;
629
- const at = editor.view.domAtPos(spot.from).node;
720
+ const spot2 = notes.getState(editor.state).spots.find((s) => s.id === c.id);
721
+ if (!spot2) return;
722
+ const at = editor.view.domAtPos(spot2.from).node;
630
723
  (at instanceof HTMLElement ? at : at.parentElement)?.scrollIntoView({ behavior: "smooth", block: "center" });
631
724
  };
632
725
  const suggested = [...state.revs.reduce((all2, c) => {
@@ -639,7 +732,7 @@ img { max-width: 100%; } img[data-wrap='left'] { float: left; margin: 0 12pt 6pt
639
732
  const dom = editor.view.domAtPos(at).node;
640
733
  (dom instanceof HTMLElement ? dom : dom.parentElement)?.scrollIntoView({ behavior: "smooth", block: "center" });
641
734
  };
642
- const percent = zoom ?? (docx && room ? Math.max(10, Math.min(100, Math.floor((room - 24) / page.width * 100))) : 100);
735
+ const percent = zoom ?? (docx && room && !flow ? Math.max(10, Math.min(100, Math.floor((room - 24) / page.width * 100))) : 100);
643
736
  const zoomBy = (d) => setZoom(Math.min(200, Math.max(30, percent + d)));
644
737
  const keys = (e) => {
645
738
  if (e.defaultPrevented) return;
@@ -665,15 +758,15 @@ img { max-width: 100%; } img[data-wrap='left'] { float: left; margin: 0 12pt 6pt
665
758
  else if (key === "]" || key === "[") act(() => indent(editor, key === "]" ? 1 : -1));
666
759
  else if (key === "\\") act(() => clear(editor));
667
760
  else if (key === "enter" && docx) act(() => editor.chain().focus().insertContent({ type: "pageBreak" }).run());
668
- else if (e.shiftKey && docx && ["l", "e", "r", "j"].includes(key)) act(() => align(editor, { l: "left", e: "center", r: "right", j: "justify" }[key]));
761
+ else if (e.shiftKey && ["l", "e", "r", "j"].includes(key)) act(() => align(editor, { l: "left", e: "center", r: "right", j: "justify" }[key]));
669
762
  };
670
763
  const tool = (icon, label, run, pressed, disabled) => {
671
764
  const Icon = icon;
672
- return /* @__PURE__ */ jsx2("button", { type: "button", "aria-label": label, title: label, "aria-pressed": pressed, disabled, onClick: () => {
765
+ return /* @__PURE__ */ jsx3("button", { type: "button", "aria-label": label, title: label, "aria-pressed": pressed, disabled, onClick: () => {
673
766
  run();
674
- }, children: /* @__PURE__ */ jsx2(Icon, { "aria-hidden": true }) });
767
+ }, children: /* @__PURE__ */ jsx3(Icon, { "aria-hidden": true }) });
675
768
  };
676
- const gap = /* @__PURE__ */ jsx2("span", { className: "w100n-pdf-gap" });
769
+ const gap = /* @__PURE__ */ jsx3("span", { className: "w100n-pdf-gap" });
677
770
  const known = source.data.styles;
678
771
  const named = (test) => {
679
772
  const name = known.find(test)?.name;
@@ -692,28 +785,28 @@ img { max-width: 100%; } img[data-wrap='left'] { float: left; margin: 0 12pt 6pt
692
785
  ];
693
786
  const margins = [[t.marginsNormal, [96, 96, 96, 96]], [t.marginsNarrow, [48, 48, 48, 48]], [t.marginsWide, [96, 192, 96, 192]]];
694
787
  const when = (iso) => new Intl.DateTimeFormat(language, { day: "numeric", month: "short", hour: "2-digit", minute: "2-digit" }).format(new Date(iso));
695
- const person = (c) => /* @__PURE__ */ jsxs2("header", { children: [
696
- c.author.avatarUrl ? /* @__PURE__ */ jsx2("img", { className: "w100n-text-face", src: c.author.avatarUrl, alt: "" }) : /* @__PURE__ */ jsx2("span", { className: "w100n-text-face", "aria-hidden": true, children: c.author.name.slice(0, 1).toUpperCase() }),
697
- /* @__PURE__ */ jsxs2("span", { className: "w100n-text-who", children: [
698
- /* @__PURE__ */ jsxs2("b", { children: [
788
+ const person = (c) => /* @__PURE__ */ jsxs3("header", { children: [
789
+ c.author.avatarUrl ? /* @__PURE__ */ jsx3("img", { className: "w100n-text-face", src: c.author.avatarUrl, alt: "" }) : /* @__PURE__ */ jsx3("span", { className: "w100n-text-face", "aria-hidden": true, children: c.author.name.slice(0, 1).toUpperCase() }),
790
+ /* @__PURE__ */ jsxs3("span", { className: "w100n-text-who", children: [
791
+ /* @__PURE__ */ jsxs3("b", { children: [
699
792
  c.author.name,
700
- c.author.id.startsWith("guest:") && /* @__PURE__ */ jsx2("span", { className: "w100n-docs-badge", children: t.guest })
793
+ c.author.id.startsWith("guest:") && /* @__PURE__ */ jsx3("span", { className: "w100n-docs-badge", children: t.guest })
701
794
  ] }),
702
- /* @__PURE__ */ jsx2("small", { children: when(c.createdAt) })
795
+ /* @__PURE__ */ jsx3("small", { children: when(c.createdAt) })
703
796
  ] }),
704
- drops(c) && /* @__PURE__ */ jsxs2("span", { className: "w100n-text-own", onClick: (e) => e.stopPropagation(), children: [
705
- mine(c) && host.editComment && /* @__PURE__ */ jsx2("button", { type: "button", "aria-label": t.editComment, title: t.editComment, onClick: () => {
797
+ drops(c) && /* @__PURE__ */ jsxs3("span", { className: "w100n-text-own", onClick: (e) => e.stopPropagation(), children: [
798
+ mine(c) && host.editComment && /* @__PURE__ */ jsx3("button", { type: "button", "aria-label": t.editComment, title: t.editComment, onClick: () => {
706
799
  setDropping(null);
707
800
  setEditing({ id: c.id, body: c.body });
708
- }, children: /* @__PURE__ */ jsx2(Pencil, { "aria-hidden": true }) }),
709
- host.deleteComment && /* @__PURE__ */ jsx2("button", { type: "button", "data-tone": "red", "aria-label": t.delete, title: t.delete, onClick: () => {
801
+ }, children: /* @__PURE__ */ jsx3(Pencil, { "aria-hidden": true }) }),
802
+ host.deleteComment && /* @__PURE__ */ jsx3("button", { type: "button", "data-tone": "red", "aria-label": t.delete, title: t.delete, onClick: () => {
710
803
  setEditing(null);
711
804
  setDropping(c.id);
712
- }, children: /* @__PURE__ */ jsx2(Trash2, { "aria-hidden": true }) })
805
+ }, children: /* @__PURE__ */ jsx3(Trash2, { "aria-hidden": true }) })
713
806
  ] })
714
807
  ] });
715
- const words = (c) => editing?.id === c.id ? /* @__PURE__ */ jsxs2("div", { className: "w100n-text-reply w100n-text-edit", onClick: (e) => e.stopPropagation(), children: [
716
- /* @__PURE__ */ jsx2(
808
+ const words = (c) => editing?.id === c.id ? /* @__PURE__ */ jsxs3("div", { className: "w100n-text-reply w100n-text-edit", onClick: (e) => e.stopPropagation(), children: [
809
+ /* @__PURE__ */ jsx3(
717
810
  "textarea",
718
811
  {
719
812
  autoFocus: true,
@@ -725,33 +818,33 @@ img { max-width: 100%; } img[data-wrap='left'] { float: left; margin: 0 12pt 6pt
725
818
  }
726
819
  }
727
820
  ),
728
- /* @__PURE__ */ jsxs2("span", { className: "w100n-pdf-dialog-end", children: [
729
- /* @__PURE__ */ jsx2("button", { type: "button", className: "w100n-pdf-link", onClick: () => setEditing(null), children: t.cancel }),
730
- /* @__PURE__ */ jsxs2("button", { type: "button", className: "w100n-docs-action", disabled: !editing.body.trim() || editing.body.trim() === c.body || posting === "busy", onClick: () => void change(c.id, editing.body.trim()), children: [
731
- /* @__PURE__ */ jsx2(Save, { "aria-hidden": true }),
821
+ /* @__PURE__ */ jsxs3("span", { className: "w100n-pdf-dialog-end", children: [
822
+ /* @__PURE__ */ jsx3("button", { type: "button", className: "w100n-pdf-link", onClick: () => setEditing(null), children: t.cancel }),
823
+ /* @__PURE__ */ jsxs3("button", { type: "button", className: "w100n-docs-action", disabled: !editing.body.trim() || editing.body.trim() === c.body || posting === "busy", onClick: () => void change(c.id, editing.body.trim()), children: [
824
+ /* @__PURE__ */ jsx3(Save, { "aria-hidden": true }),
732
825
  t.save
733
826
  ] })
734
827
  ] })
735
- ] }) : dropping === c.id ? /* @__PURE__ */ jsxs2("div", { className: "w100n-text-confirm", role: "group", "aria-label": t.delete, onClick: (e) => e.stopPropagation(), children: [
736
- /* @__PURE__ */ jsx2("p", { children: c.replyTo || !all.some((r) => r.replyTo === c.id) ? t.deleteAsk : t.deleteThread }),
737
- /* @__PURE__ */ jsxs2("span", { className: "w100n-pdf-dialog-end", children: [
738
- /* @__PURE__ */ jsx2("button", { type: "button", className: "w100n-pdf-link", autoFocus: true, onClick: () => setDropping(null), children: t.cancel }),
739
- /* @__PURE__ */ jsxs2("button", { type: "button", className: "w100n-docs-action", "data-tone": "red", disabled: posting === "busy", onClick: () => void change(c.id, null), children: [
740
- /* @__PURE__ */ jsx2(Trash2, { "aria-hidden": true }),
828
+ ] }) : dropping === c.id ? /* @__PURE__ */ jsxs3("div", { className: "w100n-text-confirm", role: "group", "aria-label": t.delete, onClick: (e) => e.stopPropagation(), children: [
829
+ /* @__PURE__ */ jsx3("p", { children: c.replyTo || !all.some((r) => r.replyTo === c.id) ? t.deleteAsk : t.deleteThread }),
830
+ /* @__PURE__ */ jsxs3("span", { className: "w100n-pdf-dialog-end", children: [
831
+ /* @__PURE__ */ jsx3("button", { type: "button", className: "w100n-pdf-link", autoFocus: true, onClick: () => setDropping(null), children: t.cancel }),
832
+ /* @__PURE__ */ jsxs3("button", { type: "button", className: "w100n-docs-action", "data-tone": "red", disabled: posting === "busy", onClick: () => void change(c.id, null), children: [
833
+ /* @__PURE__ */ jsx3(Trash2, { "aria-hidden": true }),
741
834
  t.delete
742
835
  ] })
743
836
  ] })
744
- ] }) : /* @__PURE__ */ jsx2("p", { children: c.body });
837
+ ] }) : /* @__PURE__ */ jsx3("p", { children: c.body });
745
838
  const pick = (next) => setPop(pop === next ? null : next);
746
- const swatches = (list, current, set, none) => /* @__PURE__ */ jsxs2("span", { className: "w100n-text-pop w100n-text-swatches", role: "group", children: [
747
- /* @__PURE__ */ jsx2("button", { type: "button", className: "w100n-text-none", onClick: () => {
839
+ const swatches = (list, current, set, none) => /* @__PURE__ */ jsxs3("span", { className: "w100n-text-pop w100n-text-swatches", role: "group", children: [
840
+ /* @__PURE__ */ jsx3("button", { type: "button", className: "w100n-text-none", onClick: () => {
748
841
  set(null);
749
842
  setPop(null);
750
843
  }, children: none }),
751
- list.map((c, i) => /* @__PURE__ */ jsx2("button", { type: "button", "aria-label": c, "aria-pressed": current === c, onClick: () => {
844
+ list.map((c, i) => /* @__PURE__ */ jsx3("button", { type: "button", "aria-label": c, "aria-pressed": current === c, onClick: () => {
752
845
  set(c);
753
846
  setPop(null);
754
- }, children: /* @__PURE__ */ jsx2("i", { style: { background: c } }) }, i))
847
+ }, children: /* @__PURE__ */ jsx3("i", { style: { background: c } }) }, i))
755
848
  ] });
756
849
  const mod = /Mac|iPhone|iPad/.test(navigator.platform) ? "\u2318" : "Ctrl+";
757
850
  const item = (label, run, more2 = {}) => ({ label, run, ...more2 });
@@ -769,9 +862,10 @@ img { max-width: 100%; } img[data-wrap='left'] { float: left; margin: 0 12pt 6pt
769
862
  item(t.print, print, { keys: `${mod}P` }),
770
863
  ...docx ? ["-", item(t.pageSetup, () => setDraft2({ width: page.width, height: page.height, margins: page.margins.map(cm), ...marginal }))] : []
771
864
  ] : [],
772
- ...can.edit && (file?.formats.length || file?.copy || file?.rename) ? ["-"] : [],
865
+ ...can.edit && (file?.formats.length || file?.copy || file?.rename || file?.template) ? ["-"] : [],
773
866
  ...(file?.formats ?? []).map((f) => item(`${t.downloadAs} ${f === "md" ? "Markdown" : f.toUpperCase()}`, () => file.download(f))),
774
867
  !!file?.copy && item(t.makeCopy, file.copy),
868
+ !!file?.template && item(t.saveTemplate, file.template),
775
869
  !!file?.rename && item(t.rename, file.rename)
776
870
  ]],
777
871
  ["edit", t.menuEdit, can.edit ? [
@@ -783,9 +877,13 @@ img { max-width: 100%; } img[data-wrap='left'] { float: left; margin: 0 12pt 6pt
783
877
  item(t.clearFormat, () => clear(editor), { keys: `${mod}\\` })
784
878
  ] : []],
785
879
  ["view", t.viewTab, [
880
+ docx && item(t.printLayout, () => {
881
+ setPrinted(flow);
882
+ setZoom(null);
883
+ }, { on: !flow }),
786
884
  item(t.zoomIn, () => zoomBy(10)),
787
885
  item(t.zoomOut, () => zoomBy(-10)),
788
- docx && item(t.fitWidth, () => setZoom(null), { on: zoom === null }),
886
+ docx && !flow && item(t.fitWidth, () => setZoom(null), { on: zoom === null }),
789
887
  item(t.fit, () => setZoom(100)),
790
888
  "-",
791
889
  item(t.outline, () => onPanel?.("outline")),
@@ -807,8 +905,8 @@ img { max-width: 100%; } img[data-wrap='left'] { float: left; margin: 0 12pt 6pt
807
905
  can.comment && item(t.addComment, begin, { off: state.empty, keys: `${mod}\u2325M` }),
808
906
  "-",
809
907
  item(t.symbols, () => setDialog({ kind: "symbol", query: "" })),
810
- docx && item(t.formula, () => setDialog({ kind: "formula", latex: "", at: null })),
811
- docx && item(t.footnote, () => setDialog({ kind: "note", text: "", at: null }))
908
+ item(t.formula, () => setDialog({ kind: "formula", latex: "", at: null })),
909
+ item(t.footnote, () => setDialog({ kind: "note", text: "", at: null }))
812
910
  ] : []],
813
911
  ["format", t.menuFormat, can.edit ? [
814
912
  ...styles.map(([key, label, run]) => item(label, run, { on: state.style === key })),
@@ -819,12 +917,9 @@ img { max-width: 100%; } img[data-wrap='left'] { float: left; margin: 0 12pt 6pt
819
917
  item(t.strike, () => editor.chain().focus().toggleStrike().run(), { on: state.strike }),
820
918
  docx && item(t.superscript, () => editor.chain().focus().toggleMark("superscript").run(), { on: state.sup, keys: `${mod}.` }),
821
919
  docx && item(t.subscript, () => editor.chain().focus().toggleMark("subscript").run(), { on: state.sub, keys: `${mod},` }),
822
- ...docx ? [
823
- "-",
824
- ...aligns.map(([, label, value]) => item(label, () => align(editor, value), { on: state.align === value })),
825
- "-",
826
- ...lines.map(([v, label]) => item(`${t.lineSpacing}: ${label}`, () => spacing(editor, { line: v }), { on: state.line === v }))
827
- ] : [],
920
+ "-",
921
+ ...aligns.map(([, label, value]) => item(label, () => align(editor, value), { on: state.align === value })),
922
+ ...docx ? ["-", ...lines.map(([v, label]) => item(`${t.lineSpacing}: ${label}`, () => spacing(editor, { line: v }), { on: state.line === v }))] : [],
828
923
  "-",
829
924
  item(t.bullets, () => editor.chain().focus().toggleBulletList().run(), { on: state.bullets }),
830
925
  item(t.numbers, () => editor.chain().focus().toggleOrderedList().run(), { on: state.numbers }),
@@ -837,19 +932,55 @@ img { max-width: 100%; } img[data-wrap='left'] { float: left; margin: 0 12pt 6pt
837
932
  docx && can.edit && item(t.suggest, suggest, { on: state.suggest }),
838
933
  docx && can.edit && state.revs.length > 0 && item(t.acceptAll, () => decide(editor, true)),
839
934
  docx && can.edit && state.revs.length > 0 && item(t.rejectAll, () => decide(editor, false)),
840
- !!host?.comments && (can.comment || open.length > 0) && item(t.comments, () => onPanel?.("comments"))
935
+ !!host?.comments && (can.comment || open.length > 0) && item(t.comments, () => onPanel?.("comments")),
936
+ can.edit && item(t.spellCheck, () => {
937
+ editor.view.dom.spellcheck = !spell;
938
+ localStorage.setItem("w100n-docs-spell", spell ? "0" : "1");
939
+ setSpell(!spell);
940
+ }, { on: spell })
841
941
  ]]
842
942
  ];
843
- const menu = ([key, label, list]) => /* @__PURE__ */ jsxs2("span", { className: "w100n-text-anchor", children: [
844
- /* @__PURE__ */ jsx2("button", { type: "button", className: "w100n-text-menu-button", "data-pop": true, "aria-haspopup": "menu", "aria-expanded": pop === key, onClick: () => pick(key), children: label }),
845
- pop === key && /* @__PURE__ */ jsx2("span", { className: "w100n-text-pop w100n-text-menu", role: "menu", "aria-label": label, children: list.filter((x) => x !== false).map((x, i) => x === "-" ? /* @__PURE__ */ jsx2("hr", {}, i) : /* @__PURE__ */ jsxs2("button", { type: "button", role: x.on === void 0 ? "menuitem" : "menuitemcheckbox", "aria-checked": x.on, disabled: x.off, onClick: () => {
846
- setPop(null);
847
- x.run();
848
- }, children: [
849
- /* @__PURE__ */ jsx2(Check, { "aria-hidden": true }),
850
- /* @__PURE__ */ jsx2("span", { children: x.label }),
851
- x.keys && /* @__PURE__ */ jsx2("kbd", { children: x.keys })
852
- ] }, i)) })
943
+ const clip = (kind2) => {
944
+ editor.view.focus();
945
+ document.execCommand(kind2);
946
+ };
947
+ const paste = async () => {
948
+ const found2 = await navigator.clipboard.read().catch(() => []);
949
+ const html = found2.find((c) => c.types.includes("text/html"));
950
+ if (html) return editor.view.pasteHTML(await (await html.getType("text/html")).text());
951
+ const plain = found2.find((c) => c.types.includes("text/plain"));
952
+ if (plain) editor.view.pasteText(await (await plain.getType("text/plain")).text());
953
+ };
954
+ const table = editor.isActive("table");
955
+ const near = [
956
+ can.edit && item(t.cut, () => clip("cut"), { off: state.empty, keys: `${mod}X` }),
957
+ item(t.copy, () => clip("copy"), { off: state.empty, keys: `${mod}C` }),
958
+ can.edit && !!navigator.clipboard?.read && item(t.paste, () => void paste(), { keys: `${mod}V` }),
959
+ "-",
960
+ can.comment && item(t.addComment, begin, { off: state.empty, keys: `${mod}\u2325M` }),
961
+ can.edit && item(t.link, linkUp, { keys: `${mod}K` }),
962
+ can.edit && item(t.clearFormat, () => clear(editor), { keys: `${mod}\\` }),
963
+ ...can.edit && table ? [
964
+ "-",
965
+ item(t.rowAbove, () => editor.chain().focus().addRowBefore().run()),
966
+ item(t.rowBelow, () => editor.chain().focus().addRowAfter().run()),
967
+ item(t.columnLeft, () => editor.chain().focus().addColumnBefore().run()),
968
+ item(t.columnRight, () => editor.chain().focus().addColumnAfter().run()),
969
+ item(t.deleteRow, () => editor.chain().focus().deleteRow().run()),
970
+ item(t.deleteColumn, () => editor.chain().focus().deleteColumn().run())
971
+ ] : []
972
+ ];
973
+ const rows = (list) => list.filter((x) => x !== false).filter((x, i, all2) => x !== "-" || i > 0 && all2[i - 1] !== "-" && i < all2.length - 1).map((x, i) => x === "-" ? /* @__PURE__ */ jsx3("hr", {}, i) : /* @__PURE__ */ jsxs3("button", { type: "button", role: x.on === void 0 ? "menuitem" : "menuitemcheckbox", "aria-checked": x.on, disabled: x.off, onClick: () => {
974
+ setPop(null);
975
+ x.run();
976
+ }, children: [
977
+ /* @__PURE__ */ jsx3(Check, { "aria-hidden": true }),
978
+ /* @__PURE__ */ jsx3("span", { children: x.label }),
979
+ x.keys && /* @__PURE__ */ jsx3("kbd", { children: x.keys })
980
+ ] }, i));
981
+ const menu = ([key, label, list]) => /* @__PURE__ */ jsxs3("span", { className: "w100n-text-anchor", children: [
982
+ /* @__PURE__ */ jsx3("button", { type: "button", className: "w100n-text-menu-button", "data-pop": true, "aria-haspopup": "menu", "aria-expanded": pop === key, onClick: () => pick(key), children: label }),
983
+ pop === key && /* @__PURE__ */ jsx3("span", { className: "w100n-text-pop w100n-text-menu", role: "menu", "aria-label": label, children: rows(list) })
853
984
  ] }, key);
854
985
  const seek = (next) => {
855
986
  editor.view.dispatch(editor.state.tr.setMeta(searching, next));
@@ -861,11 +992,11 @@ img { max-width: 100%; } img[data-wrap='left'] { float: left; margin: 0 12pt 6pt
861
992
  }
862
993
  };
863
994
  const found = searching.getState(editor.state);
864
- const finder = /* @__PURE__ */ jsxs2("span", { className: "w100n-text-anchor", children: [
865
- /* @__PURE__ */ jsx2("button", { type: "button", "data-pop": true, "aria-expanded": pop === "find", "aria-label": t.findReplace, title: t.findReplace, onClick: () => pick("find"), children: /* @__PURE__ */ jsx2(Search, { "aria-hidden": true }) }),
866
- pop === "find" && /* @__PURE__ */ jsxs2("span", { className: "w100n-text-pop w100n-text-find", role: "search", "aria-label": t.findReplace, children: [
867
- /* @__PURE__ */ jsxs2("span", { className: "w100n-docs-row", children: [
868
- /* @__PURE__ */ jsx2(
995
+ const finder = /* @__PURE__ */ jsxs3("span", { className: "w100n-text-anchor", children: [
996
+ /* @__PURE__ */ jsx3("button", { type: "button", "data-pop": true, "aria-expanded": pop === "find", "aria-label": t.findReplace, title: t.findReplace, onClick: () => pick("find"), children: /* @__PURE__ */ jsx3(Search, { "aria-hidden": true }) }),
997
+ pop === "find" && /* @__PURE__ */ jsxs3("span", { className: "w100n-text-pop w100n-text-find", role: "search", "aria-label": t.findReplace, children: [
998
+ /* @__PURE__ */ jsxs3("span", { className: "w100n-docs-row", children: [
999
+ /* @__PURE__ */ jsx3(
869
1000
  "input",
870
1001
  {
871
1002
  autoFocus: true,
@@ -885,23 +1016,23 @@ img { max-width: 100%; } img[data-wrap='left'] { float: left; margin: 0 12pt 6pt
885
1016
  }
886
1017
  }
887
1018
  ),
888
- /* @__PURE__ */ jsx2("small", { "aria-live": "polite", children: query ? found?.hits.length ? `${(found.at ?? 0) + 1} / ${found.hits.length}` : t.noHits : "" }),
889
- /* @__PURE__ */ jsx2("button", { type: "button", "aria-label": t.previous, title: t.previous, disabled: !found?.hits.length, onClick: () => seek({ at: found.at - 1 }), children: /* @__PURE__ */ jsx2(ChevronUp, { "aria-hidden": true }) }),
890
- /* @__PURE__ */ jsx2("button", { type: "button", "aria-label": t.next, title: t.next, disabled: !found?.hits.length, onClick: () => seek({ at: found.at + 1 }), children: /* @__PURE__ */ jsx2(ChevronDown, { "aria-hidden": true }) })
1019
+ /* @__PURE__ */ jsx3("small", { "aria-live": "polite", children: query ? found?.hits.length ? `${(found.at ?? 0) + 1} / ${found.hits.length}` : t.noHits : "" }),
1020
+ /* @__PURE__ */ jsx3("button", { type: "button", "aria-label": t.previous, title: t.previous, disabled: !found?.hits.length, onClick: () => seek({ at: found.at - 1 }), children: /* @__PURE__ */ jsx3(ChevronUp, { "aria-hidden": true }) }),
1021
+ /* @__PURE__ */ jsx3("button", { type: "button", "aria-label": t.next, title: t.next, disabled: !found?.hits.length, onClick: () => seek({ at: found.at + 1 }), children: /* @__PURE__ */ jsx3(ChevronDown, { "aria-hidden": true }) })
891
1022
  ] }),
892
- can.edit && /* @__PURE__ */ jsxs2("span", { className: "w100n-docs-row", children: [
893
- /* @__PURE__ */ jsx2("input", { value: swap, placeholder: t.replaceWith, "aria-label": t.replaceWith, onChange: (e) => setSwap(e.target.value) }),
894
- /* @__PURE__ */ jsx2("button", { type: "button", className: "w100n-pdf-link", disabled: !found?.hits.length, onClick: () => {
1023
+ can.edit && /* @__PURE__ */ jsxs3("span", { className: "w100n-docs-row", children: [
1024
+ /* @__PURE__ */ jsx3("input", { value: swap, placeholder: t.replaceWith, "aria-label": t.replaceWith, onChange: (e) => setSwap(e.target.value) }),
1025
+ /* @__PURE__ */ jsx3("button", { type: "button", className: "w100n-pdf-link", disabled: !found?.hits.length, onClick: () => {
895
1026
  replace(editor, swap, false);
896
1027
  seek({});
897
1028
  }, children: t.replaceOne }),
898
- /* @__PURE__ */ jsx2("button", { type: "button", className: "w100n-docs-action", disabled: !found?.hits.length, onClick: () => {
1029
+ /* @__PURE__ */ jsx3("button", { type: "button", className: "w100n-docs-action", disabled: !found?.hits.length, onClick: () => {
899
1030
  replace(editor, swap, true);
900
1031
  seek({});
901
1032
  }, children: t.replaceAll })
902
1033
  ] }),
903
- /* @__PURE__ */ jsxs2("label", { className: "w100n-setup-check", children: [
904
- /* @__PURE__ */ jsx2("input", { type: "checkbox", checked: matchCase, onChange: (e) => {
1034
+ /* @__PURE__ */ jsxs3("label", { className: "w100n-setup-check", children: [
1035
+ /* @__PURE__ */ jsx3("input", { type: "checkbox", checked: matchCase, onChange: (e) => {
905
1036
  setMatchCase(e.target.checked);
906
1037
  seek({ matchCase: e.target.checked, at: 0 });
907
1038
  } }),
@@ -926,47 +1057,47 @@ img { max-width: 100%; } img[data-wrap='left'] { float: left; margin: 0 12pt 6pt
926
1057
  spacing(editor, { line: paint.block.line, after: paint.block.after });
927
1058
  if (!paint.keep) setPaint(null);
928
1059
  };
929
- const fontPicker = /* @__PURE__ */ jsxs2("span", { className: "w100n-text-anchor", children: [
930
- /* @__PURE__ */ jsxs2("button", { type: "button", className: "w100n-text-picker", "data-size": "mid", "data-pop": true, "aria-haspopup": "listbox", "aria-expanded": pop === "font", "aria-label": t.font, title: t.font, onClick: () => pick("font"), children: [
931
- /* @__PURE__ */ jsx2("span", { style: { fontFamily: state.font ?? void 0 }, children: state.font ?? t.defaultFont }),
932
- /* @__PURE__ */ jsx2(ChevronDown, { "aria-hidden": true })
1060
+ const fontPicker = /* @__PURE__ */ jsxs3("span", { className: "w100n-text-anchor", children: [
1061
+ /* @__PURE__ */ jsxs3("button", { type: "button", className: "w100n-text-picker", "data-size": "mid", "data-pop": true, "aria-haspopup": "listbox", "aria-expanded": pop === "font", "aria-label": t.font, title: t.font, onClick: () => pick("font"), children: [
1062
+ /* @__PURE__ */ jsx3("span", { style: { fontFamily: state.font ?? void 0 }, children: state.font ?? t.defaultFont }),
1063
+ /* @__PURE__ */ jsx3(ChevronDown, { "aria-hidden": true })
933
1064
  ] }),
934
- pop === "font" && /* @__PURE__ */ jsxs2("span", { className: "w100n-text-pop w100n-text-styles", role: "listbox", "aria-label": t.font, children: [
935
- /* @__PURE__ */ jsx2("button", { type: "button", role: "option", "aria-selected": !state.font, onClick: () => {
1065
+ pop === "font" && /* @__PURE__ */ jsxs3("span", { className: "w100n-text-pop w100n-text-styles", role: "listbox", "aria-label": t.font, children: [
1066
+ /* @__PURE__ */ jsx3("button", { type: "button", role: "option", "aria-selected": !state.font, onClick: () => {
936
1067
  editor.chain().focus().unsetFontFamily().run();
937
1068
  setPop(null);
938
1069
  }, children: t.defaultFont }),
939
- faces.map((f) => /* @__PURE__ */ jsx2("button", { type: "button", role: "option", "aria-selected": state.font === f, style: { fontFamily: f }, onClick: () => {
1070
+ faces.map((f) => /* @__PURE__ */ jsx3("button", { type: "button", role: "option", "aria-selected": state.font === f, style: { fontFamily: f }, onClick: () => {
940
1071
  editor.chain().focus().setFontFamily(f).run();
941
1072
  setPop(null);
942
1073
  }, children: f }, f))
943
1074
  ] })
944
1075
  ] });
945
- const sizePicker = /* @__PURE__ */ jsxs2("span", { className: "w100n-text-anchor", children: [
946
- /* @__PURE__ */ jsxs2("button", { type: "button", className: "w100n-text-picker", "data-size": "small", "data-pop": true, "aria-haspopup": "listbox", "aria-expanded": pop === "size", "aria-label": t.fontSize, title: t.fontSize, onClick: () => pick("size"), children: [
1076
+ const sizePicker = /* @__PURE__ */ jsxs3("span", { className: "w100n-text-anchor", children: [
1077
+ /* @__PURE__ */ jsxs3("button", { type: "button", className: "w100n-text-picker", "data-size": "small", "data-pop": true, "aria-haspopup": "listbox", "aria-expanded": pop === "size", "aria-label": t.fontSize, title: t.fontSize, onClick: () => pick("size"), children: [
947
1078
  state.size ? parseFloat(state.size) : t.defaultFont,
948
- /* @__PURE__ */ jsx2(ChevronDown, { "aria-hidden": true })
1079
+ /* @__PURE__ */ jsx3(ChevronDown, { "aria-hidden": true })
949
1080
  ] }),
950
- pop === "size" && /* @__PURE__ */ jsxs2("span", { className: "w100n-text-pop w100n-text-styles", role: "listbox", "aria-label": t.fontSize, children: [
951
- /* @__PURE__ */ jsx2("button", { type: "button", role: "option", "aria-selected": !state.size, onClick: () => {
1081
+ pop === "size" && /* @__PURE__ */ jsxs3("span", { className: "w100n-text-pop w100n-text-styles", role: "listbox", "aria-label": t.fontSize, children: [
1082
+ /* @__PURE__ */ jsx3("button", { type: "button", role: "option", "aria-selected": !state.size, onClick: () => {
952
1083
  editor.chain().focus().unsetFontSize().run();
953
1084
  setPop(null);
954
1085
  }, children: t.defaultFont }),
955
- sizes.map((n) => /* @__PURE__ */ jsx2("button", { type: "button", role: "option", "aria-selected": state.size !== null && parseFloat(state.size) === n, onClick: () => {
1086
+ sizes.map((n) => /* @__PURE__ */ jsx3("button", { type: "button", role: "option", "aria-selected": state.size !== null && parseFloat(state.size) === n, onClick: () => {
956
1087
  editor.chain().focus().setFontSize(`${n}pt`).run();
957
1088
  setPop(null);
958
1089
  }, children: n }, n))
959
1090
  ] })
960
1091
  ] });
961
- const spacer = /* @__PURE__ */ jsxs2("span", { className: "w100n-text-anchor", children: [
962
- /* @__PURE__ */ jsx2("button", { type: "button", "data-pop": true, "aria-expanded": pop === "spacing", "aria-label": t.lineSpacing, title: t.lineSpacing, onClick: () => pick("spacing"), children: /* @__PURE__ */ jsx2(UnfoldVertical, { "aria-hidden": true }) }),
963
- pop === "spacing" && /* @__PURE__ */ jsxs2("span", { className: "w100n-text-pop w100n-text-styles", role: "listbox", "aria-label": t.lineSpacing, children: [
964
- lines.map(([v, label]) => /* @__PURE__ */ jsx2("button", { type: "button", role: "option", "aria-selected": state.line === v, onClick: () => {
1092
+ const spacer = /* @__PURE__ */ jsxs3("span", { className: "w100n-text-anchor", children: [
1093
+ /* @__PURE__ */ jsx3("button", { type: "button", "data-pop": true, "aria-expanded": pop === "spacing", "aria-label": t.lineSpacing, title: t.lineSpacing, onClick: () => pick("spacing"), children: /* @__PURE__ */ jsx3(UnfoldVertical, { "aria-hidden": true }) }),
1094
+ pop === "spacing" && /* @__PURE__ */ jsxs3("span", { className: "w100n-text-pop w100n-text-styles", role: "listbox", "aria-label": t.lineSpacing, children: [
1095
+ lines.map(([v, label]) => /* @__PURE__ */ jsx3("button", { type: "button", role: "option", "aria-selected": state.line === v, onClick: () => {
965
1096
  spacing(editor, { line: v });
966
1097
  setPop(null);
967
1098
  }, children: label }, v)),
968
- /* @__PURE__ */ jsx2("hr", {}),
969
- /* @__PURE__ */ jsx2("button", { type: "button", role: "option", "aria-selected": false, onClick: () => {
1099
+ /* @__PURE__ */ jsx3("hr", {}),
1100
+ /* @__PURE__ */ jsx3("button", { type: "button", role: "option", "aria-selected": false, onClick: () => {
970
1101
  spacing(editor, { after: state.after === 0 ? 8 : 0 });
971
1102
  setPop(null);
972
1103
  }, children: state.after === 0 ? t.spaceAfter : t.noSpaceAfter })
@@ -989,18 +1120,18 @@ img { max-width: 100%; } img[data-wrap='left'] { float: left; margin: 0 12pt 6pt
989
1120
  setDraft2(null);
990
1121
  };
991
1122
  const zooms = [50, 75, 90, 100, 125, 150, 200];
992
- const zoomer = /* @__PURE__ */ jsxs2("span", { className: "w100n-text-anchor", children: [
993
- /* @__PURE__ */ jsxs2("button", { type: "button", className: "w100n-text-picker", "data-size": "small", "data-pop": true, "aria-haspopup": "listbox", "aria-expanded": pop === "zoom", "aria-label": t.zoom, title: t.zoom, onClick: () => pick("zoom"), children: [
1123
+ const zoomer = /* @__PURE__ */ jsxs3("span", { className: "w100n-text-anchor", children: [
1124
+ /* @__PURE__ */ jsxs3("button", { type: "button", className: "w100n-text-picker", "data-size": "small", "data-pop": true, "aria-haspopup": "listbox", "aria-expanded": pop === "zoom", "aria-label": t.zoom, title: t.zoom, onClick: () => pick("zoom"), children: [
994
1125
  percent,
995
1126
  "%",
996
- /* @__PURE__ */ jsx2(ChevronDown, { "aria-hidden": true })
1127
+ /* @__PURE__ */ jsx3(ChevronDown, { "aria-hidden": true })
997
1128
  ] }),
998
- pop === "zoom" && /* @__PURE__ */ jsxs2("span", { className: "w100n-text-pop w100n-text-styles", role: "listbox", "aria-label": t.zoom, children: [
999
- docx && /* @__PURE__ */ jsx2("button", { type: "button", role: "option", "aria-selected": zoom === null, onClick: () => {
1129
+ pop === "zoom" && /* @__PURE__ */ jsxs3("span", { className: "w100n-text-pop w100n-text-styles", role: "listbox", "aria-label": t.zoom, children: [
1130
+ docx && /* @__PURE__ */ jsx3("button", { type: "button", role: "option", "aria-selected": zoom === null, onClick: () => {
1000
1131
  setZoom(null);
1001
1132
  setPop(null);
1002
1133
  }, children: t.fitWidth }),
1003
- zooms.map((z) => /* @__PURE__ */ jsxs2("button", { type: "button", role: "option", "aria-selected": zoom === z, onClick: () => {
1134
+ zooms.map((z) => /* @__PURE__ */ jsxs3("button", { type: "button", role: "option", "aria-selected": zoom === z, onClick: () => {
1004
1135
  setZoom(z);
1005
1136
  setPop(null);
1006
1137
  }, children: [
@@ -1010,9 +1141,9 @@ img { max-width: 100%; } img[data-wrap='left'] { float: left; margin: 0 12pt 6pt
1010
1141
  ] })
1011
1142
  ] });
1012
1143
  const Aligned = aligns.find(([, , value]) => value === state.align)?.[0] ?? AlignLeft;
1013
- const aligner = /* @__PURE__ */ jsxs2("span", { className: "w100n-text-anchor", children: [
1014
- /* @__PURE__ */ jsx2("button", { type: "button", "data-pop": true, "aria-expanded": pop === "align", "aria-label": t.align, title: t.align, onClick: () => pick("align"), children: /* @__PURE__ */ jsx2(Aligned, { "aria-hidden": true }) }),
1015
- pop === "align" && /* @__PURE__ */ jsx2("span", { className: "w100n-text-pop", role: "group", "aria-label": t.align, children: /* @__PURE__ */ jsx2("span", { className: "w100n-text-tools", children: aligns.map(([icon, label, value], i) => /* @__PURE__ */ jsx2(Fragment2, { children: tool(icon, label, () => {
1144
+ const aligner = /* @__PURE__ */ jsxs3("span", { className: "w100n-text-anchor", children: [
1145
+ /* @__PURE__ */ jsx3("button", { type: "button", "data-pop": true, "aria-expanded": pop === "align", "aria-label": t.align, title: t.align, onClick: () => pick("align"), children: /* @__PURE__ */ jsx3(Aligned, { "aria-hidden": true }) }),
1146
+ pop === "align" && /* @__PURE__ */ jsx3("span", { className: "w100n-text-pop", role: "group", "aria-label": t.align, children: /* @__PURE__ */ jsx3("span", { className: "w100n-text-tools", children: aligns.map(([icon, label, value], i) => /* @__PURE__ */ jsx3(Fragment2, { children: tool(icon, label, () => {
1016
1147
  align(editor, value);
1017
1148
  setPop(null);
1018
1149
  }, state.align === value) }, i)) }) })
@@ -1021,13 +1152,13 @@ img { max-width: 100%; } img[data-wrap='left'] { float: left; margin: 0 12pt 6pt
1021
1152
  localStorage.setItem("w100n-docs-more", more ? "" : "1");
1022
1153
  setMore(!more);
1023
1154
  };
1024
- const main = can.edit ? /* @__PURE__ */ jsxs2(Fragment3, { children: [
1025
- /* @__PURE__ */ jsxs2("span", { className: "w100n-text-anchor", children: [
1026
- /* @__PURE__ */ jsxs2("button", { type: "button", className: "w100n-text-picker", "data-size": "mid", "data-pop": true, "aria-haspopup": "listbox", "aria-expanded": pop === "style", "aria-label": t.paragraphStyle, title: t.paragraphStyle, onClick: () => pick("style"), children: [
1155
+ const main = can.edit ? /* @__PURE__ */ jsxs3(Fragment3, { children: [
1156
+ /* @__PURE__ */ jsxs3("span", { className: "w100n-text-anchor", children: [
1157
+ /* @__PURE__ */ jsxs3("button", { type: "button", className: "w100n-text-picker", "data-size": "mid", "data-pop": true, "aria-haspopup": "listbox", "aria-expanded": pop === "style", "aria-label": t.paragraphStyle, title: t.paragraphStyle, onClick: () => pick("style"), children: [
1027
1158
  styles.find(([key]) => key === state.style)?.[1] ?? t.normal,
1028
- /* @__PURE__ */ jsx2(ChevronDown, { "aria-hidden": true })
1159
+ /* @__PURE__ */ jsx3(ChevronDown, { "aria-hidden": true })
1029
1160
  ] }),
1030
- pop === "style" && /* @__PURE__ */ jsx2("span", { className: "w100n-text-pop w100n-text-styles", role: "listbox", "aria-label": t.paragraphStyle, children: styles.map(([key, label, run]) => /* @__PURE__ */ jsx2(
1161
+ pop === "style" && /* @__PURE__ */ jsx3("span", { className: "w100n-text-pop w100n-text-styles", role: "listbox", "aria-label": t.paragraphStyle, children: styles.map(([key, label, run]) => /* @__PURE__ */ jsx3(
1031
1162
  "button",
1032
1163
  {
1033
1164
  type: "button",
@@ -1048,48 +1179,48 @@ img { max-width: 100%; } img[data-wrap='left'] { float: left; margin: 0 12pt 6pt
1048
1179
  tool(Italic, t.italic, () => editor.chain().focus().toggleItalic().run(), state.italic),
1049
1180
  docx ? tool(Underline, t.underline, () => editor.chain().focus().toggleUnderline().run(), state.underline) : tool(Strikethrough, t.strike, () => editor.chain().focus().toggleStrike().run(), state.strike),
1050
1181
  !docx && tool(Code, t.code, () => editor.chain().focus().toggleCode().run(), state.code),
1051
- docx && /* @__PURE__ */ jsxs2("span", { className: "w100n-text-anchor", children: [
1052
- /* @__PURE__ */ jsxs2("button", { type: "button", "data-pop": true, "aria-expanded": pop === "color", "aria-label": t.textColour, title: t.textColour, onClick: () => pick("color"), children: [
1053
- /* @__PURE__ */ jsx2(Baseline, { "aria-hidden": true }),
1054
- /* @__PURE__ */ jsx2("i", { className: "w100n-text-bar", style: { background: state.color ?? "currentColor" } })
1182
+ docx && /* @__PURE__ */ jsxs3("span", { className: "w100n-text-anchor", children: [
1183
+ /* @__PURE__ */ jsxs3("button", { type: "button", "data-pop": true, "aria-expanded": pop === "color", "aria-label": t.textColour, title: t.textColour, onClick: () => pick("color"), children: [
1184
+ /* @__PURE__ */ jsx3(Baseline, { "aria-hidden": true }),
1185
+ /* @__PURE__ */ jsx3("i", { className: "w100n-text-bar", style: { background: state.color ?? "currentColor" } })
1055
1186
  ] }),
1056
1187
  pop === "color" && swatches(inks, state.color, (c) => c ? editor.chain().focus().setColor(c).run() : editor.chain().focus().unsetColor().run(), t.automatic)
1057
1188
  ] }),
1058
1189
  gap,
1059
- docx && aligner,
1190
+ aligner,
1060
1191
  tool(List, t.bullets, () => editor.chain().focus().toggleBulletList().run(), state.bullets),
1061
1192
  tool(ListOrdered, t.numbers, () => editor.chain().focus().toggleOrderedList().run(), state.numbers),
1062
1193
  !docx && tool(ListChecks, t.tasks, () => editor.chain().focus().toggleTaskList().run(), state.tasks),
1063
1194
  gap,
1064
- /* @__PURE__ */ jsxs2("span", { className: "w100n-text-anchor", children: [
1065
- /* @__PURE__ */ jsx2("button", { type: "button", "data-pop": true, "aria-expanded": pop === "link", "aria-pressed": state.link, "aria-label": t.link, title: t.link, onClick: () => pop === "link" ? setPop(null) : linkUp(), children: /* @__PURE__ */ jsx2(Link, { "aria-hidden": true }) }),
1066
- pop === "link" && /* @__PURE__ */ jsxs2("span", { className: "w100n-text-pop w100n-text-form", children: [
1067
- /* @__PURE__ */ jsx2("input", { autoFocus: true, value: href, placeholder: t.linkAddress, "aria-label": t.linkAddress, onChange: (e) => setHref(e.target.value), onKeyDown: (e) => {
1195
+ /* @__PURE__ */ jsxs3("span", { className: "w100n-text-anchor", children: [
1196
+ /* @__PURE__ */ jsx3("button", { type: "button", "data-pop": true, "aria-expanded": pop === "link", "aria-pressed": state.link, "aria-label": t.link, title: t.link, onClick: () => pop === "link" ? setPop(null) : linkUp(), children: /* @__PURE__ */ jsx3(Link, { "aria-hidden": true }) }),
1197
+ pop === "link" && /* @__PURE__ */ jsxs3("span", { className: "w100n-text-pop w100n-text-form", children: [
1198
+ /* @__PURE__ */ jsx3("input", { autoFocus: true, value: href, placeholder: t.linkAddress, "aria-label": t.linkAddress, onChange: (e) => setHref(e.target.value), onKeyDown: (e) => {
1068
1199
  if (e.key === "Enter") putLink();
1069
1200
  } }),
1070
- /* @__PURE__ */ jsxs2("span", { className: "w100n-docs-row", children: [
1071
- state.link && /* @__PURE__ */ jsxs2("button", { type: "button", className: "w100n-pdf-link", onClick: () => {
1201
+ /* @__PURE__ */ jsxs3("span", { className: "w100n-docs-row", children: [
1202
+ state.link && /* @__PURE__ */ jsxs3("button", { type: "button", className: "w100n-pdf-link", onClick: () => {
1072
1203
  editor.chain().focus().extendMarkRange("link").unsetLink().run();
1073
1204
  setPop(null);
1074
1205
  }, children: [
1075
- /* @__PURE__ */ jsx2(Link2Off, { "aria-hidden": true }),
1206
+ /* @__PURE__ */ jsx3(Link2Off, { "aria-hidden": true }),
1076
1207
  t.unlink
1077
1208
  ] }),
1078
- /* @__PURE__ */ jsxs2("button", { type: "button", className: "w100n-docs-action", disabled: !href.trim(), onClick: putLink, children: [
1079
- /* @__PURE__ */ jsx2(Link, { "aria-hidden": true }),
1209
+ /* @__PURE__ */ jsxs3("button", { type: "button", className: "w100n-docs-action", disabled: !href.trim(), onClick: putLink, children: [
1210
+ /* @__PURE__ */ jsx3(Link, { "aria-hidden": true }),
1080
1211
  t.apply
1081
1212
  ] })
1082
1213
  ] })
1083
1214
  ] })
1084
1215
  ] }),
1085
1216
  can.comment && tool(MessageSquarePlus, t.addComment, begin, void 0, state.empty),
1086
- /* @__PURE__ */ jsxs2("span", { className: "w100n-text-anchor", children: [
1087
- /* @__PURE__ */ jsx2("button", { type: "button", "data-pop": true, "aria-expanded": pop === "image", "aria-label": t.image, title: t.image, onClick: () => {
1217
+ /* @__PURE__ */ jsxs3("span", { className: "w100n-text-anchor", children: [
1218
+ /* @__PURE__ */ jsx3("button", { type: "button", "data-pop": true, "aria-expanded": pop === "image", "aria-label": t.image, title: t.image, onClick: () => {
1088
1219
  setHref("");
1089
1220
  pick("image");
1090
- }, children: /* @__PURE__ */ jsx2(ImagePlus, { "aria-hidden": true }) }),
1091
- pop === "image" && /* @__PURE__ */ jsxs2("span", { className: "w100n-text-pop w100n-text-form", children: [
1092
- /* @__PURE__ */ jsx2(
1221
+ }, children: /* @__PURE__ */ jsx3(ImagePlus, { "aria-hidden": true }) }),
1222
+ pop === "image" && /* @__PURE__ */ jsxs3("span", { className: "w100n-text-pop w100n-text-form", children: [
1223
+ /* @__PURE__ */ jsx3(
1093
1224
  "input",
1094
1225
  {
1095
1226
  autoFocus: true,
@@ -1105,10 +1236,10 @@ img { max-width: 100%; } img[data-wrap='left'] { float: left; margin: 0 12pt 6pt
1105
1236
  }
1106
1237
  }
1107
1238
  ),
1108
- /* @__PURE__ */ jsxs2("span", { className: "w100n-docs-row", children: [
1109
- docx && /* @__PURE__ */ jsxs2("label", { className: "w100n-pdf-link", children: [
1239
+ /* @__PURE__ */ jsxs3("span", { className: "w100n-docs-row", children: [
1240
+ docx && /* @__PURE__ */ jsxs3("label", { className: "w100n-pdf-link", children: [
1110
1241
  t.chooseFile,
1111
- /* @__PURE__ */ jsx2("input", { type: "file", accept: "image/png,image/jpeg,image/gif", hidden: true, onChange: (e) => {
1242
+ /* @__PURE__ */ jsx3("input", { type: "file", accept: "image/png,image/jpeg,image/gif", hidden: true, onChange: (e) => {
1112
1243
  const file2 = e.target.files?.[0];
1113
1244
  if (!file2) return;
1114
1245
  const reader = new FileReader();
@@ -1119,62 +1250,62 @@ img { max-width: 100%; } img[data-wrap='left'] { float: left; margin: 0 12pt 6pt
1119
1250
  reader.readAsDataURL(file2);
1120
1251
  } })
1121
1252
  ] }),
1122
- /* @__PURE__ */ jsxs2("button", { type: "button", className: "w100n-docs-action", disabled: !href.trim(), onClick: () => {
1253
+ /* @__PURE__ */ jsxs3("button", { type: "button", className: "w100n-docs-action", disabled: !href.trim(), onClick: () => {
1123
1254
  editor.chain().focus().setImage({ src: href.trim() }).run();
1124
1255
  setPop(null);
1125
1256
  }, children: [
1126
- /* @__PURE__ */ jsx2(ImagePlus, { "aria-hidden": true }),
1257
+ /* @__PURE__ */ jsx3(ImagePlus, { "aria-hidden": true }),
1127
1258
  t.put
1128
1259
  ] })
1129
1260
  ] })
1130
1261
  ] })
1131
1262
  ] }),
1132
- /* @__PURE__ */ jsxs2("span", { className: "w100n-text-anchor", children: [
1133
- /* @__PURE__ */ jsx2("button", { type: "button", "data-pop": true, "aria-expanded": pop === "table", "aria-label": t.table, title: t.table, onClick: () => pick("table"), children: /* @__PURE__ */ jsx2(Table, { "aria-hidden": true }) }),
1134
- pop === "table" && /* @__PURE__ */ jsxs2("span", { className: "w100n-text-pop w100n-text-grid", role: "group", "aria-label": t.table, onPointerLeave: () => setGrid({ rows: 0, cols: 0 }), children: [
1135
- /* @__PURE__ */ jsx2("span", { children: Array.from({ length: 48 }, (_, i) => {
1136
- const rows = Math.floor(i / 8) + 1;
1263
+ /* @__PURE__ */ jsxs3("span", { className: "w100n-text-anchor", children: [
1264
+ /* @__PURE__ */ jsx3("button", { type: "button", "data-pop": true, "aria-expanded": pop === "table", "aria-label": t.table, title: t.table, onClick: () => pick("table"), children: /* @__PURE__ */ jsx3(Table, { "aria-hidden": true }) }),
1265
+ pop === "table" && /* @__PURE__ */ jsxs3("span", { className: "w100n-text-pop w100n-text-grid", role: "group", "aria-label": t.table, onPointerLeave: () => setGrid({ rows: 0, cols: 0 }), children: [
1266
+ /* @__PURE__ */ jsx3("span", { children: Array.from({ length: 48 }, (_, i) => {
1267
+ const rows2 = Math.floor(i / 8) + 1;
1137
1268
  const cols = i % 8 + 1;
1138
- return /* @__PURE__ */ jsx2(
1269
+ return /* @__PURE__ */ jsx3(
1139
1270
  "button",
1140
1271
  {
1141
1272
  type: "button",
1142
- "aria-label": `${rows} \xD7 ${cols}`,
1143
- "data-on": rows <= grid.rows && cols <= grid.cols,
1144
- onPointerEnter: () => setGrid({ rows, cols }),
1273
+ "aria-label": `${rows2} \xD7 ${cols}`,
1274
+ "data-on": rows2 <= grid.rows && cols <= grid.cols,
1275
+ onPointerEnter: () => setGrid({ rows: rows2, cols }),
1145
1276
  onClick: () => {
1146
- editor.chain().focus().insertTable({ rows, cols, withHeaderRow: true }).run();
1277
+ editor.chain().focus().insertTable({ rows: rows2, cols, withHeaderRow: true }).run();
1147
1278
  setPop(null);
1148
1279
  }
1149
1280
  },
1150
1281
  i
1151
1282
  );
1152
1283
  }) }),
1153
- /* @__PURE__ */ jsx2("small", { children: grid.rows ? `${grid.rows} \xD7 ${grid.cols}` : t.table })
1284
+ /* @__PURE__ */ jsx3("small", { children: grid.rows ? `${grid.rows} \xD7 ${grid.cols}` : t.table })
1154
1285
  ] })
1155
1286
  ] }),
1156
1287
  gap,
1157
- /* @__PURE__ */ jsx2("button", { type: "button", "aria-expanded": more, "aria-label": more ? t.fewerTools : t.moreTools, title: more ? t.fewerTools : t.moreTools, onClick: widen, children: more ? /* @__PURE__ */ jsx2(ChevronDown, { "aria-hidden": true }) : /* @__PURE__ */ jsx2(ChevronUp, { "aria-hidden": true }) })
1158
- ] }) : /* @__PURE__ */ jsxs2(Fragment3, { children: [
1159
- /* @__PURE__ */ jsxs2("button", { type: "button", className: "w100n-text-word", onClick: () => onPanel?.("outline"), children: [
1160
- /* @__PURE__ */ jsx2(ListTree, { "aria-hidden": true }),
1288
+ /* @__PURE__ */ jsx3("button", { type: "button", "aria-expanded": more, "aria-label": more ? t.fewerTools : t.moreTools, title: more ? t.fewerTools : t.moreTools, onClick: widen, children: more ? /* @__PURE__ */ jsx3(ChevronDown, { "aria-hidden": true }) : /* @__PURE__ */ jsx3(ChevronUp, { "aria-hidden": true }) })
1289
+ ] }) : /* @__PURE__ */ jsxs3(Fragment3, { children: [
1290
+ /* @__PURE__ */ jsxs3("button", { type: "button", className: "w100n-text-word", onClick: () => onPanel?.("outline"), children: [
1291
+ /* @__PURE__ */ jsx3(ListTree, { "aria-hidden": true }),
1161
1292
  t.outline
1162
1293
  ] }),
1163
- can.comment && /* @__PURE__ */ jsxs2(Fragment3, { children: [
1164
- /* @__PURE__ */ jsx2("span", { className: "w100n-text-grow" }),
1165
- /* @__PURE__ */ jsxs2("button", { type: "button", className: "w100n-docs-action", disabled: state.empty, onClick: begin, children: [
1166
- /* @__PURE__ */ jsx2(MessageSquarePlus, { "aria-hidden": true }),
1294
+ can.comment && /* @__PURE__ */ jsxs3(Fragment3, { children: [
1295
+ /* @__PURE__ */ jsx3("span", { className: "w100n-text-grow" }),
1296
+ /* @__PURE__ */ jsxs3("button", { type: "button", className: "w100n-docs-action", disabled: state.empty, onClick: begin, children: [
1297
+ /* @__PURE__ */ jsx3(MessageSquarePlus, { "aria-hidden": true }),
1167
1298
  t.addComment
1168
1299
  ] })
1169
1300
  ] }),
1170
- !!host?.comments && (can.comment || open.length > 0) && /* @__PURE__ */ jsxs2("button", { type: "button", className: "w100n-text-word", onClick: () => onPanel?.("comments"), children: [
1171
- /* @__PURE__ */ jsx2(MessagesSquare, { "aria-hidden": true }),
1301
+ !!host?.comments && (can.comment || open.length > 0) && /* @__PURE__ */ jsxs3("button", { type: "button", className: "w100n-text-word", onClick: () => onPanel?.("comments"), children: [
1302
+ /* @__PURE__ */ jsx3(MessagesSquare, { "aria-hidden": true }),
1172
1303
  t.comments,
1173
- /* @__PURE__ */ jsx2("b", { children: open.length })
1304
+ /* @__PURE__ */ jsx3("b", { children: open.length })
1174
1305
  ] })
1175
1306
  ] });
1176
- const extra = can.edit && more && /* @__PURE__ */ jsxs2(Fragment3, { children: [
1177
- docx && /* @__PURE__ */ jsxs2(Fragment3, { children: [
1307
+ const extra = can.edit && more && /* @__PURE__ */ jsxs3(Fragment3, { children: [
1308
+ docx && /* @__PURE__ */ jsxs3(Fragment3, { children: [
1178
1309
  fontPicker,
1179
1310
  sizePicker,
1180
1311
  gap
@@ -1182,11 +1313,11 @@ img { max-width: 100%; } img[data-wrap='left'] { float: left; margin: 0 12pt 6pt
1182
1313
  docx && tool(Strikethrough, t.strike, () => editor.chain().focus().toggleStrike().run(), state.strike),
1183
1314
  docx && tool(Superscript, t.superscript, () => editor.chain().focus().toggleMark("superscript").run(), state.sup),
1184
1315
  docx && tool(Subscript, t.subscript, () => editor.chain().focus().toggleMark("subscript").run(), state.sub),
1185
- docx && /* @__PURE__ */ jsxs2("span", { className: "w100n-text-anchor", children: [
1186
- /* @__PURE__ */ jsx2("button", { type: "button", "data-pop": true, "aria-expanded": pop === "mark", "aria-pressed": state.glow, "aria-label": t.highlight, title: t.highlight, onClick: () => pick("mark"), children: /* @__PURE__ */ jsx2(Highlighter, { "aria-hidden": true }) }),
1316
+ docx && /* @__PURE__ */ jsxs3("span", { className: "w100n-text-anchor", children: [
1317
+ /* @__PURE__ */ jsx3("button", { type: "button", "data-pop": true, "aria-expanded": pop === "mark", "aria-pressed": state.glow, "aria-label": t.highlight, title: t.highlight, onClick: () => pick("mark"), children: /* @__PURE__ */ jsx3(Highlighter, { "aria-hidden": true }) }),
1187
1318
  pop === "mark" && swatches(glows, null, (c) => c ? editor.chain().focus().setHighlight({ color: c }).run() : editor.chain().focus().unsetHighlight().run(), t.noColour)
1188
1319
  ] }),
1189
- docx && /* @__PURE__ */ jsxs2(Fragment3, { children: [
1320
+ docx && /* @__PURE__ */ jsxs3(Fragment3, { children: [
1190
1321
  gap,
1191
1322
  spacer
1192
1323
  ] }),
@@ -1194,24 +1325,24 @@ img { max-width: 100%; } img[data-wrap='left'] { float: left; margin: 0 12pt 6pt
1194
1325
  tool(ListIndentIncrease, t.indent, () => indent(editor, 1)),
1195
1326
  docx && tool(ListChecks, t.tasks, () => editor.chain().focus().toggleTaskList().run(), state.tasks),
1196
1327
  gap,
1197
- /* @__PURE__ */ jsx2("button", { type: "button", "aria-label": t.painter, title: paint ? t.painterHint : t.painter, "aria-pressed": !!paint, onClick: () => take(false), onDoubleClick: () => take(true), children: /* @__PURE__ */ jsx2(PaintRoller, { "aria-hidden": true }) }),
1328
+ /* @__PURE__ */ jsx3("button", { type: "button", "aria-label": t.painter, title: paint ? t.painterHint : t.painter, "aria-pressed": !!paint, onClick: () => take(false), onDoubleClick: () => take(true), children: /* @__PURE__ */ jsx3(PaintRoller, { "aria-hidden": true }) }),
1198
1329
  tool(RemoveFormatting, t.clearFormat, () => clear(editor)),
1199
- docx && /* @__PURE__ */ jsxs2(Fragment3, { children: [
1330
+ docx && /* @__PURE__ */ jsxs3(Fragment3, { children: [
1200
1331
  gap,
1201
1332
  tool(FilePenLine, t.suggest, suggest, state.suggest)
1202
1333
  ] })
1203
1334
  ] });
1204
- const context = can.edit && (state.table ? /* @__PURE__ */ jsxs2(Fragment3, { children: [
1335
+ const context = can.edit && (state.table ? /* @__PURE__ */ jsxs3(Fragment3, { children: [
1205
1336
  tool(BetweenHorizontalStart, t.rowAbove, () => editor.chain().focus().addRowBefore().run()),
1206
1337
  tool(BetweenHorizontalEnd, t.rowBelow, () => editor.chain().focus().addRowAfter().run()),
1207
1338
  tool(BetweenVerticalStart, t.columnLeft, () => editor.chain().focus().addColumnBefore().run()),
1208
1339
  tool(BetweenVerticalEnd, t.columnRight, () => editor.chain().focus().addColumnAfter().run()),
1209
1340
  tool(PanelTop, t.headerRow, () => editor.chain().focus().toggleHeaderRow().run()),
1210
1341
  docx && tool(TableCellsMerge, t.mergeCells, () => editor.chain().focus().mergeOrSplit().run()),
1211
- docx && /* @__PURE__ */ jsxs2("span", { className: "w100n-text-anchor", children: [
1212
- /* @__PURE__ */ jsxs2("button", { type: "button", "data-pop": true, "aria-expanded": pop === "fill", "aria-label": t.cellFill, title: t.cellFill, onClick: () => pick("fill"), children: [
1213
- /* @__PURE__ */ jsx2(PaintBucket, { "aria-hidden": true }),
1214
- /* @__PURE__ */ jsx2("i", { className: "w100n-text-bar", style: { background: state.fill ?? "transparent" } })
1342
+ docx && /* @__PURE__ */ jsxs3("span", { className: "w100n-text-anchor", children: [
1343
+ /* @__PURE__ */ jsxs3("button", { type: "button", "data-pop": true, "aria-expanded": pop === "fill", "aria-label": t.cellFill, title: t.cellFill, onClick: () => pick("fill"), children: [
1344
+ /* @__PURE__ */ jsx3(PaintBucket, { "aria-hidden": true }),
1345
+ /* @__PURE__ */ jsx3("i", { className: "w100n-text-bar", style: { background: state.fill ?? "transparent" } })
1215
1346
  ] }),
1216
1347
  pop === "fill" && swatches(glows, state.fill, (c) => editor.chain().focus().setCellAttribute("background", c).run(), t.noColour)
1217
1348
  ] }),
@@ -1219,33 +1350,43 @@ img { max-width: 100%; } img[data-wrap='left'] { float: left; margin: 0 12pt 6pt
1219
1350
  tool(TableRowsSplit, t.deleteRow, () => editor.chain().focus().deleteRow().run()),
1220
1351
  tool(TableColumnsSplit, t.deleteColumn, () => editor.chain().focus().deleteColumn().run()),
1221
1352
  tool(Trash2, t.deleteTable, () => editor.chain().focus().deleteTable().run())
1222
- ] }) : state.img && /* @__PURE__ */ jsx2(Fragment3, { children: [[Image, t.wrapInline, "inline"], [PanelLeft, t.wrapLeft, "left"], [PanelRight, t.wrapRight, "right"]].map(([icon, label, value]) => /* @__PURE__ */ jsx2(Fragment2, { children: tool(icon, label, () => editor.chain().focus().updateAttributes("image", { wrap: value === "inline" ? null : value }).run(), state.img === value) }, value)) }));
1223
- const status = (can.edit || live) && /* @__PURE__ */ jsxs2("span", { className: "w100n-text-end", children: [
1224
- live && (live.ready ? !live.online : live.late || live.denied) && /* @__PURE__ */ jsxs2("span", { className: "w100n-text-live", title: live.denied ? void 0 : t.offlineHint, children: [
1225
- /* @__PURE__ */ jsx2(WifiOff, { "aria-hidden": true }),
1353
+ ] }) : state.img && /* @__PURE__ */ jsx3(Fragment3, { children: [[Image, t.wrapInline, "inline"], [PanelLeft, t.wrapLeft, "left"], [PanelRight, t.wrapRight, "right"]].map(([icon, label, value]) => /* @__PURE__ */ jsx3(Fragment2, { children: tool(icon, label, () => editor.chain().focus().updateAttributes("image", { wrap: value === "inline" ? null : value }).run(), state.img === value) }, value)) }));
1354
+ const status = (can.edit || live) && /* @__PURE__ */ jsxs3("span", { className: "w100n-text-end", children: [
1355
+ live && (live.ready ? !live.online : live.late || live.denied) && /* @__PURE__ */ jsxs3("span", { className: "w100n-text-live", title: live.denied ? void 0 : t.offlineHint, children: [
1356
+ /* @__PURE__ */ jsx3(WifiOff, { "aria-hidden": true }),
1226
1357
  live.denied ? t.liveOff : t.offline
1227
1358
  ] }),
1228
- state.suggest && /* @__PURE__ */ jsx2("span", { className: "w100n-docs-badge", children: t.suggesting }),
1229
- can.edit && saving === "failed" && /* @__PURE__ */ jsxs2("button", { type: "button", className: "w100n-text-saved", title: `${t.save} (${mod}S)`, onClick: () => void save(), children: [
1230
- /* @__PURE__ */ jsx2(CloudAlert, { "aria-hidden": true }),
1231
- /* @__PURE__ */ jsx2("span", { children: t.saveFailed })
1359
+ state.suggest && /* @__PURE__ */ jsx3("span", { className: "w100n-docs-badge", children: t.suggesting }),
1360
+ can.edit && saving === "failed" && /* @__PURE__ */ jsxs3("button", { type: "button", className: "w100n-text-saved", title: `${t.save} (${mod}S)`, onClick: () => void save(), children: [
1361
+ /* @__PURE__ */ jsx3(CloudAlert, { "aria-hidden": true }),
1362
+ /* @__PURE__ */ jsx3("span", { children: t.saveFailed })
1232
1363
  ] }),
1233
- live && live.people.length > 0 && /* @__PURE__ */ jsx2("span", { className: "w100n-text-people", role: "group", "aria-label": t.people, children: live.people.map((p) => /* @__PURE__ */ jsx2("span", { className: "w100n-text-face", title: p.me ? `${p.name} (${t.you})` : p.name, style: { "--face": p.color }, children: p.avatarUrl ? /* @__PURE__ */ jsx2("img", { src: p.avatarUrl, alt: "" }) : p.name.split(/\s+/).map((w) => w[0]).join("").slice(0, 2).toUpperCase() }, p.id)) })
1364
+ live && live.people.length > 0 && /* @__PURE__ */ jsx3("span", { className: "w100n-text-people", role: "group", "aria-label": t.people, children: live.people.map((p) => /* @__PURE__ */ jsx3("span", { className: "w100n-text-face", title: p.me ? `${p.name} (${t.you})` : p.name, style: { "--face": p.color }, children: p.avatarUrl ? /* @__PURE__ */ jsx3("img", { src: p.avatarUrl, alt: "" }) : p.name.split(/\s+/).map((w) => w[0]).join("").slice(0, 2).toUpperCase() }, p.id)) })
1234
1365
  ] });
1235
- const menubar = /* @__PURE__ */ jsx2("span", { className: "w100n-text-menus", role: "menubar", "aria-label": t.textTools, children: menus.filter(([, , list]) => list.some((x) => x && x !== "-")).map(menu) });
1366
+ const menubar = /* @__PURE__ */ jsx3("span", { className: "w100n-text-menus", role: "menubar", "aria-label": t.textTools, children: menus.filter(([, , list]) => list.some((x) => x && x !== "-")).map(menu) });
1236
1367
  const keep = (e) => {
1237
1368
  if (e.target.closest("button")) e.preventDefault();
1238
1369
  };
1239
1370
  const sheet = docx ? { "--page-w": `${page.width}px`, "--page-h": `${page.height}px`, "--mt": `${page.margins[0]}px`, "--mr": `${page.margins[1]}px`, "--mb": `${page.margins[2]}px`, "--ml": `${page.margins[3]}px` } : void 0;
1240
- return /* @__PURE__ */ jsxs2("div", { ref: root, className: "w100n-text", "data-kind": kind, "data-docs-find": true, onKeyDown: keys, children: [
1241
- head ? /* @__PURE__ */ jsxs2(Fragment3, { children: [
1242
- head.menus && createPortal(/* @__PURE__ */ jsx2("div", { className: "w100n-text-ribbon w100n-text-docbar", onKeyDown: rove, onPointerDown: keep, children: menubar }), head.menus),
1243
- head.status && status && createPortal(/* @__PURE__ */ jsx2("div", { className: "w100n-text-ribbon w100n-text-docbar", onPointerDown: keep, children: status }), head.status)
1244
- ] }) : /* @__PURE__ */ jsxs2("div", { className: "w100n-text-ribbon w100n-text-top", onKeyDown: rove, onPointerDown: keep, children: [
1371
+ return /* @__PURE__ */ jsxs3("div", { ref: root, className: "w100n-text", "data-kind": kind, "data-docs-find": true, onKeyDown: keys, children: [
1372
+ head ? /* @__PURE__ */ jsxs3(Fragment3, { children: [
1373
+ head.menus && createPortal(/* @__PURE__ */ jsx3("div", { className: "w100n-text-ribbon w100n-text-docbar", onKeyDown: rove, onPointerDown: keep, children: menubar }), head.menus),
1374
+ head.status && status && createPortal(/* @__PURE__ */ jsx3("div", { className: "w100n-text-ribbon w100n-text-docbar", onPointerDown: keep, children: status }), head.status)
1375
+ ] }) : /* @__PURE__ */ jsxs3("div", { className: "w100n-text-ribbon w100n-text-top", onKeyDown: rove, onPointerDown: keep, children: [
1245
1376
  menubar,
1246
1377
  status
1247
1378
  ] }),
1248
- /* @__PURE__ */ jsx2("div", { ref: scroller, className: "w100n-text-scroll", "data-paint": !!paint, onMouseUp: lay, onClick: (e) => {
1379
+ /* @__PURE__ */ jsx3("div", { ref: scroller, className: "w100n-text-scroll", "data-paint": !!paint, onMouseUp: lay, onPointerDown: (e) => {
1380
+ touch.current = e.pointerType === "touch";
1381
+ }, onContextMenu: (e) => {
1382
+ if (touch.current || e.shiftKey || pop === "context" || !e.target.closest(".ProseMirror")) return setPop(null);
1383
+ e.preventDefault();
1384
+ const at = editor.view.posAtCoords({ left: e.clientX, top: e.clientY });
1385
+ const { from, to } = editor.state.selection;
1386
+ if (at && (at.pos < from || at.pos > to)) editor.commands.setTextSelection(at.pos);
1387
+ setSpot({ x: Math.min(e.clientX, innerWidth - 260), y: Math.min(e.clientY, innerHeight - 360) });
1388
+ setPop("context");
1389
+ }, onClick: (e) => {
1249
1390
  const atom = can.edit ? e.target.closest(".w100n-math, sup[data-footnote]") : null;
1250
1391
  if (atom) {
1251
1392
  const at = editor.view.posAtDOM(atom, 0);
@@ -1258,45 +1399,49 @@ img { max-width: 100%; } img[data-wrap='left'] { float: left; margin: 0 12pt 6pt
1258
1399
  if (!id) return;
1259
1400
  setActive(id);
1260
1401
  onPanel?.("comments");
1261
- }, children: /* @__PURE__ */ jsx2("div", { className: "w100n-text-zoomed", style: { zoom: percent / 100 }, children: /* @__PURE__ */ jsx2("div", { className: docx ? "w100n-text-sheet" : "w100n-docs-page w100n-text-column", style: sheet, children: /* @__PURE__ */ jsx2(EditorContent, { editor }) }) }) }),
1262
- /* @__PURE__ */ jsx2("div", { className: "w100n-text-ribbon w100n-text-corner", "data-side": "left", onPointerDown: keep, children: /* @__PURE__ */ jsxs2("div", { className: "w100n-text-tools", role: "group", "aria-label": t.zoom, children: [
1402
+ }, children: /* @__PURE__ */ jsx3("div", { className: "w100n-text-zoomed", style: { zoom: percent / 100 }, children: /* @__PURE__ */ jsx3("div", { className: docx ? `w100n-text-sheet${flow ? " is-flow" : ""}` : "w100n-docs-page w100n-text-column", style: sheet, children: /* @__PURE__ */ jsx3(EditorContent, { editor }) }) }) }),
1403
+ pop === "context" && /* @__PURE__ */ jsxs3("span", { className: "w100n-text-pop w100n-text-menu w100n-text-context", role: "menu", "aria-label": t.textTools, style: { left: spot.x, top: spot.y }, onPointerDown: keep, children: [
1404
+ rows(near),
1405
+ spell && /* @__PURE__ */ jsx3("small", { className: "w100n-text-hint", children: t.spellHint })
1406
+ ] }),
1407
+ /* @__PURE__ */ jsx3("div", { className: "w100n-text-ribbon w100n-text-corner", "data-side": "left", onPointerDown: keep, children: /* @__PURE__ */ jsxs3("div", { className: "w100n-text-tools", role: "group", "aria-label": t.zoom, children: [
1263
1408
  tool(Minus, t.zoomOut, () => zoomBy(-10)),
1264
1409
  zoomer,
1265
1410
  tool(Plus, t.zoomIn, () => zoomBy(10))
1266
1411
  ] }) }),
1267
- /* @__PURE__ */ jsxs2("div", { className: "w100n-text-ribbon w100n-text-island", role: "toolbar", "aria-label": t.textTools, onKeyDown: rove, onPointerDown: keep, children: [
1268
- context && /* @__PURE__ */ jsx2("div", { className: "w100n-text-tools", role: "group", "aria-label": state.table ? t.table : t.image, children: context }),
1269
- extra && /* @__PURE__ */ jsx2("div", { className: "w100n-text-tools", role: "group", "aria-label": t.moreTools, children: extra }),
1270
- /* @__PURE__ */ jsx2("div", { className: "w100n-text-tools", role: "group", "aria-label": t.textTools, children: main })
1412
+ /* @__PURE__ */ jsxs3("div", { className: "w100n-text-ribbon w100n-text-island", role: "toolbar", "aria-label": t.textTools, onKeyDown: rove, onPointerDown: keep, children: [
1413
+ context && /* @__PURE__ */ jsx3("div", { className: "w100n-text-tools", role: "group", "aria-label": state.table ? t.table : t.image, children: context }),
1414
+ extra && /* @__PURE__ */ jsx3("div", { className: "w100n-text-tools", role: "group", "aria-label": t.moreTools, children: extra }),
1415
+ /* @__PURE__ */ jsx3("div", { className: "w100n-text-tools", role: "group", "aria-label": t.textTools, children: main })
1271
1416
  ] }),
1272
- /* @__PURE__ */ jsx2("div", { className: "w100n-text-ribbon w100n-text-corner", "data-side": "right", onPointerDown: keep, children: /* @__PURE__ */ jsxs2("div", { className: "w100n-text-tools", role: "group", "aria-label": t.findReplace, children: [
1273
- can.edit && /* @__PURE__ */ jsxs2(Fragment3, { children: [
1417
+ /* @__PURE__ */ jsx3("div", { className: "w100n-text-ribbon w100n-text-corner", "data-side": "right", onPointerDown: keep, children: /* @__PURE__ */ jsxs3("div", { className: "w100n-text-tools", role: "group", "aria-label": t.findReplace, children: [
1418
+ can.edit && /* @__PURE__ */ jsxs3(Fragment3, { children: [
1274
1419
  tool(Undo2, t.undo, () => editor.chain().focus().undo().run(), void 0, !state.undo),
1275
1420
  tool(Redo2, t.redo, () => editor.chain().focus().redo().run(), void 0, !state.redo),
1276
1421
  gap
1277
1422
  ] }),
1278
1423
  finder
1279
1424
  ] }) }),
1280
- dialog && /* @__PURE__ */ jsx2("div", { className: "w100n-pdf-back", onKeyDown: (e) => {
1425
+ dialog && /* @__PURE__ */ jsx3("div", { className: "w100n-pdf-back", onKeyDown: (e) => {
1281
1426
  if (e.key === "Escape") {
1282
1427
  e.stopPropagation();
1283
1428
  setDialog(null);
1284
1429
  }
1285
- }, children: dialog.kind === "symbol" ? /* @__PURE__ */ jsxs2("div", { className: "w100n-pdf-dialog w100n-insert", role: "dialog", "aria-modal": true, "aria-label": t.symbols, children: [
1286
- /* @__PURE__ */ jsxs2("div", { className: "w100n-new-head", children: [
1287
- /* @__PURE__ */ jsx2("span", { className: "w100n-new-tile", "data-tone": "pink", children: /* @__PURE__ */ jsx2(Omega, { "aria-hidden": true }) }),
1288
- /* @__PURE__ */ jsx2("b", { className: "w100n-pdf-dialog-title", children: t.symbols }),
1289
- /* @__PURE__ */ jsx2("button", { type: "button", className: "w100n-docs-close", onClick: () => setDialog(null), "aria-label": t.close, title: t.close, children: /* @__PURE__ */ jsx2(X, { "aria-hidden": true }) })
1430
+ }, children: dialog.kind === "symbol" ? /* @__PURE__ */ jsxs3("div", { className: "w100n-pdf-dialog w100n-insert", role: "dialog", "aria-modal": true, "aria-label": t.symbols, children: [
1431
+ /* @__PURE__ */ jsxs3("div", { className: "w100n-new-head", children: [
1432
+ /* @__PURE__ */ jsx3("span", { className: "w100n-new-tile", "data-tone": "pink", children: /* @__PURE__ */ jsx3(Omega, { "aria-hidden": true }) }),
1433
+ /* @__PURE__ */ jsx3("b", { className: "w100n-pdf-dialog-title", children: t.symbols }),
1434
+ /* @__PURE__ */ jsx3("button", { type: "button", className: "w100n-docs-close", onClick: () => setDialog(null), "aria-label": t.close, title: t.close, children: /* @__PURE__ */ jsx3(X, { "aria-hidden": true }) })
1290
1435
  ] }),
1291
- /* @__PURE__ */ jsxs2("label", { className: "w100n-docs-field w100n-docs-search", children: [
1292
- /* @__PURE__ */ jsx2(Search, { "aria-hidden": true }),
1293
- /* @__PURE__ */ jsx2("input", { autoFocus: true, value: dialog.query, placeholder: t.symbolSearch, "aria-label": t.symbolSearch, onChange: (e) => setDialog({ kind: "symbol", query: e.target.value }) })
1436
+ /* @__PURE__ */ jsxs3("label", { className: "w100n-docs-field w100n-docs-search", children: [
1437
+ /* @__PURE__ */ jsx3(Search, { "aria-hidden": true }),
1438
+ /* @__PURE__ */ jsx3("input", { autoFocus: true, value: dialog.query, placeholder: t.symbolSearch, "aria-label": t.symbolSearch, onChange: (e) => setDialog({ kind: "symbol", query: e.target.value }) })
1294
1439
  ] }),
1295
- /* @__PURE__ */ jsx2("div", { className: "w100n-insert-grid", role: "group", "aria-label": t.symbols, children: symbols.filter(([ch, name]) => !dialog.query.trim() || name.includes(dialog.query.trim().toLowerCase()) || ch === dialog.query.trim()).map(([ch, name]) => /* @__PURE__ */ jsx2("button", { type: "button", "aria-label": name, title: name, onClick: () => {
1440
+ /* @__PURE__ */ jsx3("div", { className: "w100n-insert-grid", role: "group", "aria-label": t.symbols, children: symbols.filter(([ch, name]) => !dialog.query.trim() || name.includes(dialog.query.trim().toLowerCase()) || ch === dialog.query.trim()).map(([ch, name]) => /* @__PURE__ */ jsx3("button", { type: "button", "aria-label": name, title: name, onClick: () => {
1296
1441
  editor.chain().focus().insertContent(ch).run();
1297
1442
  setDialog(null);
1298
1443
  }, children: ch }, ch)) })
1299
- ] }) : dialog.kind === "formula" ? /* @__PURE__ */ jsxs2("form", { className: "w100n-pdf-dialog w100n-insert", role: "dialog", "aria-modal": true, "aria-label": t.formula, onSubmit: (e) => {
1444
+ ] }) : dialog.kind === "formula" ? /* @__PURE__ */ jsxs3("form", { className: "w100n-pdf-dialog w100n-insert", role: "dialog", "aria-modal": true, "aria-label": t.formula, onSubmit: (e) => {
1300
1445
  e.preventDefault();
1301
1446
  const latex = dialog.latex.trim();
1302
1447
  if (!latex) return;
@@ -1307,14 +1452,13 @@ img { max-width: 100%; } img[data-wrap='left'] { float: left; margin: 0 12pt 6pt
1307
1452
  else editor.chain().focus().insertContent({ type: "math", attrs: { latex } }).run();
1308
1453
  setDialog(null);
1309
1454
  }, children: [
1310
- /* @__PURE__ */ jsxs2("div", { className: "w100n-new-head", children: [
1311
- /* @__PURE__ */ jsx2("span", { className: "w100n-new-tile", "data-tone": "blue", children: /* @__PURE__ */ jsx2(Sigma, { "aria-hidden": true }) }),
1312
- /* @__PURE__ */ jsx2("b", { className: "w100n-pdf-dialog-title", children: t.formula }),
1313
- /* @__PURE__ */ jsx2("span", { className: "w100n-docs-badge", children: t.formulaHint }),
1314
- /* @__PURE__ */ jsx2("button", { type: "button", className: "w100n-docs-close", onClick: () => setDialog(null), "aria-label": t.close, title: t.close, children: /* @__PURE__ */ jsx2(X, { "aria-hidden": true }) })
1455
+ /* @__PURE__ */ jsxs3("div", { className: "w100n-new-head", children: [
1456
+ /* @__PURE__ */ jsx3("span", { className: "w100n-new-tile", "data-tone": "blue", children: /* @__PURE__ */ jsx3(Sigma, { "aria-hidden": true }) }),
1457
+ /* @__PURE__ */ jsx3("b", { className: "w100n-pdf-dialog-title", children: t.formula }),
1458
+ /* @__PURE__ */ jsx3("button", { type: "button", className: "w100n-docs-close", onClick: () => setDialog(null), "aria-label": t.close, title: t.close, children: /* @__PURE__ */ jsx3(X, { "aria-hidden": true }) })
1315
1459
  ] }),
1316
- /* @__PURE__ */ jsx2("input", { ref: field, autoFocus: true, className: "w100n-insert-latex", value: dialog.latex, "aria-label": t.formula, placeholder: "F = 900 + 12 \\\\cdot n", onChange: (e) => setDialog({ ...dialog, latex: e.target.value }) }),
1317
- /* @__PURE__ */ jsx2("div", { className: "w100n-insert-tools", role: "group", "aria-label": t.formula, children: helpers.map(([label, code]) => /* @__PURE__ */ jsx2("button", { type: "button", onClick: () => {
1460
+ /* @__PURE__ */ jsx3("input", { ref: field, autoFocus: true, className: "w100n-insert-latex", value: dialog.latex, "aria-label": t.formula, placeholder: "F = 900 + 12 \\\\cdot n", onChange: (e) => setDialog({ ...dialog, latex: e.target.value }) }),
1461
+ /* @__PURE__ */ jsx3("div", { className: "w100n-insert-tools", role: "group", "aria-label": t.formula, children: helpers.map(([label, code]) => /* @__PURE__ */ jsx3("button", { type: "button", onClick: () => {
1318
1462
  const el = field.current;
1319
1463
  const at = el.selectionStart ?? dialog.latex.length;
1320
1464
  const latex = dialog.latex.slice(0, at) + code + dialog.latex.slice(el.selectionEnd ?? at);
@@ -1325,15 +1469,15 @@ img { max-width: 100%; } img[data-wrap='left'] { float: left; margin: 0 12pt 6pt
1325
1469
  el.setSelectionRange(caret, caret);
1326
1470
  });
1327
1471
  }, children: label }, label)) }),
1328
- /* @__PURE__ */ jsx2("div", { className: "w100n-insert-preview", "aria-live": "polite", dangerouslySetInnerHTML: { __html: dialog.latex.trim() ? mathml(dialog.latex) : "" } }),
1329
- /* @__PURE__ */ jsxs2("span", { className: "w100n-pdf-dialog-end", children: [
1330
- /* @__PURE__ */ jsx2("button", { type: "button", className: "w100n-pdf-link", onClick: () => setDialog(null), children: t.cancel }),
1331
- /* @__PURE__ */ jsxs2("button", { type: "submit", className: "w100n-docs-action", disabled: !dialog.latex.trim(), children: [
1332
- /* @__PURE__ */ jsx2(Check, { "aria-hidden": true }),
1472
+ /* @__PURE__ */ jsx3("div", { className: "w100n-insert-preview", "aria-live": "polite", dangerouslySetInnerHTML: { __html: dialog.latex.trim() ? mathml(dialog.latex) : "" } }),
1473
+ /* @__PURE__ */ jsxs3("span", { className: "w100n-pdf-dialog-end", children: [
1474
+ /* @__PURE__ */ jsx3("button", { type: "button", className: "w100n-pdf-link", onClick: () => setDialog(null), children: t.cancel }),
1475
+ /* @__PURE__ */ jsxs3("button", { type: "submit", className: "w100n-docs-action", disabled: !dialog.latex.trim(), children: [
1476
+ /* @__PURE__ */ jsx3(Check, { "aria-hidden": true }),
1333
1477
  dialog.at !== null ? t.update : t.put
1334
1478
  ] })
1335
1479
  ] })
1336
- ] }) : /* @__PURE__ */ jsxs2("form", { className: "w100n-pdf-dialog w100n-insert", role: "dialog", "aria-modal": true, "aria-label": t.footnote, onSubmit: (e) => {
1480
+ ] }) : /* @__PURE__ */ jsxs3("form", { className: "w100n-pdf-dialog w100n-insert", role: "dialog", "aria-modal": true, "aria-label": t.footnote, onSubmit: (e) => {
1337
1481
  e.preventDefault();
1338
1482
  const text = dialog.text.trim();
1339
1483
  if (!text) return;
@@ -1341,15 +1485,21 @@ img { max-width: 100%; } img[data-wrap='left'] { float: left; margin: 0 12pt 6pt
1341
1485
  tr.setNodeAttribute(dialog.at, "text", text);
1342
1486
  return true;
1343
1487
  }).run();
1344
- else editor.chain().focus().insertContent({ type: "footnote", attrs: { id: null, text } }).run();
1488
+ else {
1489
+ let id = 0;
1490
+ editor.state.doc.descendants((n) => {
1491
+ if (n.type.name === "footnote") id = Math.max(id, Number(n.attrs.id) || 0);
1492
+ });
1493
+ editor.chain().focus().insertContent({ type: "footnote", attrs: { id: docx ? null : String(id + 1), text } }).run();
1494
+ }
1345
1495
  setDialog(null);
1346
1496
  }, children: [
1347
- /* @__PURE__ */ jsxs2("div", { className: "w100n-new-head", children: [
1348
- /* @__PURE__ */ jsx2("span", { className: "w100n-new-tile", "data-tone": "violet", children: /* @__PURE__ */ jsx2(Superscript, { "aria-hidden": true }) }),
1349
- /* @__PURE__ */ jsx2("b", { className: "w100n-pdf-dialog-title", children: t.footnote }),
1350
- /* @__PURE__ */ jsx2("button", { type: "button", className: "w100n-docs-close", onClick: () => setDialog(null), "aria-label": t.close, title: t.close, children: /* @__PURE__ */ jsx2(X, { "aria-hidden": true }) })
1497
+ /* @__PURE__ */ jsxs3("div", { className: "w100n-new-head", children: [
1498
+ /* @__PURE__ */ jsx3("span", { className: "w100n-new-tile", "data-tone": "violet", children: /* @__PURE__ */ jsx3(Superscript, { "aria-hidden": true }) }),
1499
+ /* @__PURE__ */ jsx3("b", { className: "w100n-pdf-dialog-title", children: t.footnote }),
1500
+ /* @__PURE__ */ jsx3("button", { type: "button", className: "w100n-docs-close", onClick: () => setDialog(null), "aria-label": t.close, title: t.close, children: /* @__PURE__ */ jsx3(X, { "aria-hidden": true }) })
1351
1501
  ] }),
1352
- /* @__PURE__ */ jsx2(
1502
+ /* @__PURE__ */ jsx3(
1353
1503
  "textarea",
1354
1504
  {
1355
1505
  autoFocus: true,
@@ -1363,40 +1513,40 @@ img { max-width: 100%; } img[data-wrap='left'] { float: left; margin: 0 12pt 6pt
1363
1513
  }
1364
1514
  }
1365
1515
  ),
1366
- /* @__PURE__ */ jsxs2("span", { className: "w100n-pdf-dialog-end", children: [
1367
- dialog.at !== null && /* @__PURE__ */ jsx2("button", { type: "button", className: "w100n-pdf-link", onClick: () => {
1516
+ /* @__PURE__ */ jsxs3("span", { className: "w100n-pdf-dialog-end", children: [
1517
+ dialog.at !== null && /* @__PURE__ */ jsx3("button", { type: "button", className: "w100n-pdf-link", onClick: () => {
1368
1518
  editor.chain().focus().deleteRange({ from: dialog.at, to: dialog.at + 1 }).run();
1369
1519
  setDialog(null);
1370
1520
  }, children: t.removeFootnote }),
1371
- /* @__PURE__ */ jsx2("button", { type: "button", className: "w100n-pdf-link", onClick: () => setDialog(null), children: t.cancel }),
1372
- /* @__PURE__ */ jsxs2("button", { type: "submit", className: "w100n-docs-action", disabled: !dialog.text.trim(), children: [
1373
- /* @__PURE__ */ jsx2(Check, { "aria-hidden": true }),
1521
+ /* @__PURE__ */ jsx3("button", { type: "button", className: "w100n-pdf-link", onClick: () => setDialog(null), children: t.cancel }),
1522
+ /* @__PURE__ */ jsxs3("button", { type: "submit", className: "w100n-docs-action", disabled: !dialog.text.trim(), children: [
1523
+ /* @__PURE__ */ jsx3(Check, { "aria-hidden": true }),
1374
1524
  dialog.at !== null ? t.update : t.put
1375
1525
  ] })
1376
1526
  ] })
1377
1527
  ] }) }),
1378
- draft2 && /* @__PURE__ */ jsx2("div", { className: "w100n-pdf-back", onKeyDown: (e) => {
1528
+ draft2 && /* @__PURE__ */ jsx3("div", { className: "w100n-pdf-back", onKeyDown: (e) => {
1379
1529
  if (e.key === "Escape") {
1380
1530
  e.stopPropagation();
1381
1531
  setDraft2(null);
1382
1532
  }
1383
- }, children: /* @__PURE__ */ jsxs2("form", { className: "w100n-pdf-dialog w100n-setup", role: "dialog", "aria-modal": true, "aria-label": t.pageSetup, onSubmit: (e) => {
1533
+ }, children: /* @__PURE__ */ jsxs3("form", { className: "w100n-pdf-dialog w100n-setup", role: "dialog", "aria-modal": true, "aria-label": t.pageSetup, onSubmit: (e) => {
1384
1534
  e.preventDefault();
1385
1535
  applySetup();
1386
1536
  }, children: [
1387
- /* @__PURE__ */ jsxs2("div", { className: "w100n-new-head", children: [
1388
- /* @__PURE__ */ jsx2("span", { className: "w100n-new-tile", "data-tone": "blue", children: /* @__PURE__ */ jsx2(Ruler, { "aria-hidden": true }) }),
1389
- /* @__PURE__ */ jsx2("b", { className: "w100n-pdf-dialog-title", children: t.pageSetup }),
1390
- /* @__PURE__ */ jsx2("button", { type: "button", className: "w100n-docs-close", onClick: () => setDraft2(null), "aria-label": t.close, title: t.close, children: /* @__PURE__ */ jsx2(X, { "aria-hidden": true }) })
1537
+ /* @__PURE__ */ jsxs3("div", { className: "w100n-new-head", children: [
1538
+ /* @__PURE__ */ jsx3("span", { className: "w100n-new-tile", "data-tone": "blue", children: /* @__PURE__ */ jsx3(Ruler, { "aria-hidden": true }) }),
1539
+ /* @__PURE__ */ jsx3("b", { className: "w100n-pdf-dialog-title", children: t.pageSetup }),
1540
+ /* @__PURE__ */ jsx3("button", { type: "button", className: "w100n-docs-close", onClick: () => setDraft2(null), "aria-label": t.close, title: t.close, children: /* @__PURE__ */ jsx3(X, { "aria-hidden": true }) })
1391
1541
  ] }),
1392
- /* @__PURE__ */ jsx2("p", { className: "w100n-docs-caption", children: t.pageSize }),
1393
- /* @__PURE__ */ jsx2("div", { className: "w100n-docs-chips", role: "group", "aria-label": t.pageSize, children: [["A4", a4], ["Letter", letter], ["Legal", legal]].map(([label, size]) => {
1542
+ /* @__PURE__ */ jsx3("p", { className: "w100n-docs-caption", children: t.pageSize }),
1543
+ /* @__PURE__ */ jsx3("div", { className: "w100n-docs-chips", role: "group", "aria-label": t.pageSize, children: [["A4", a4], ["Letter", letter], ["Legal", legal]].map(([label, size]) => {
1394
1544
  const land = draft2.width > draft2.height;
1395
1545
  const on = Math.abs(Math.min(draft2.width, draft2.height) - size.width) < 2 && Math.abs(Math.max(draft2.width, draft2.height) - size.height) < 2;
1396
- return /* @__PURE__ */ jsx2("button", { type: "button", "aria-pressed": on, onClick: () => setDraft2({ ...draft2, width: land ? size.height : size.width, height: land ? size.width : size.height }), children: label }, label);
1546
+ return /* @__PURE__ */ jsx3("button", { type: "button", "aria-pressed": on, onClick: () => setDraft2({ ...draft2, width: land ? size.height : size.width, height: land ? size.width : size.height }), children: label }, label);
1397
1547
  }) }),
1398
- /* @__PURE__ */ jsx2("p", { className: "w100n-docs-caption", children: t.orientation }),
1399
- /* @__PURE__ */ jsx2("div", { className: "w100n-docs-chips", role: "group", "aria-label": t.orientation, children: [[false, t.portrait], [true, t.landscape]].map(([land, label]) => /* @__PURE__ */ jsx2(
1548
+ /* @__PURE__ */ jsx3("p", { className: "w100n-docs-caption", children: t.orientation }),
1549
+ /* @__PURE__ */ jsx3("div", { className: "w100n-docs-chips", role: "group", "aria-label": t.orientation, children: [[false, t.portrait], [true, t.landscape]].map(([land, label]) => /* @__PURE__ */ jsx3(
1400
1550
  "button",
1401
1551
  {
1402
1552
  type: "button",
@@ -1408,11 +1558,11 @@ img { max-width: 100%; } img[data-wrap='left'] { float: left; margin: 0 12pt 6pt
1408
1558
  },
1409
1559
  label
1410
1560
  )) }),
1411
- /* @__PURE__ */ jsx2("p", { className: "w100n-docs-caption", children: t.marginsCm }),
1412
- /* @__PURE__ */ jsx2("div", { className: "w100n-docs-chips", role: "group", "aria-label": t.margins, children: margins.map(([label, values]) => /* @__PURE__ */ jsx2("button", { type: "button", "aria-pressed": values.every((v, n) => Math.abs(cm(v) - draft2.margins[n]) < 0.05), onClick: () => setDraft2({ ...draft2, margins: values.map(cm) }), children: label }, label)) }),
1413
- /* @__PURE__ */ jsx2("div", { className: "w100n-setup-grid", children: [t.mTop, t.mRight, t.mBottom, t.mLeft].map((label, n) => /* @__PURE__ */ jsxs2("label", { children: [
1414
- /* @__PURE__ */ jsx2("span", { children: label }),
1415
- /* @__PURE__ */ jsx2(
1561
+ /* @__PURE__ */ jsx3("p", { className: "w100n-docs-caption", children: t.marginsCm }),
1562
+ /* @__PURE__ */ jsx3("div", { className: "w100n-docs-chips", role: "group", "aria-label": t.margins, children: margins.map(([label, values]) => /* @__PURE__ */ jsx3("button", { type: "button", "aria-pressed": values.every((v, n) => Math.abs(cm(v) - draft2.margins[n]) < 0.05), onClick: () => setDraft2({ ...draft2, margins: values.map(cm) }), children: label }, label)) }),
1563
+ /* @__PURE__ */ jsx3("div", { className: "w100n-setup-grid", children: [t.mTop, t.mRight, t.mBottom, t.mLeft].map((label, n) => /* @__PURE__ */ jsxs3("label", { children: [
1564
+ /* @__PURE__ */ jsx3("span", { children: label }),
1565
+ /* @__PURE__ */ jsx3(
1416
1566
  "input",
1417
1567
  {
1418
1568
  className: "w100n-docs-field",
@@ -1425,130 +1575,111 @@ img { max-width: 100%; } img[data-wrap='left'] { float: left; margin: 0 12pt 6pt
1425
1575
  }
1426
1576
  )
1427
1577
  ] }, n)) }),
1428
- /* @__PURE__ */ jsxs2("label", { className: "w100n-setup-line", children: [
1429
- /* @__PURE__ */ jsx2("span", { children: t.headerText }),
1430
- /* @__PURE__ */ jsx2("input", { className: "w100n-docs-field", value: draft2.header, onChange: (e) => setDraft2({ ...draft2, header: e.target.value }) })
1578
+ /* @__PURE__ */ jsxs3("label", { className: "w100n-setup-line", children: [
1579
+ /* @__PURE__ */ jsx3("span", { children: t.headerText }),
1580
+ /* @__PURE__ */ jsx3("input", { className: "w100n-docs-field", value: draft2.header, onChange: (e) => setDraft2({ ...draft2, header: e.target.value }) })
1431
1581
  ] }),
1432
- /* @__PURE__ */ jsxs2("label", { className: "w100n-setup-line", children: [
1433
- /* @__PURE__ */ jsx2("span", { children: t.footerText }),
1434
- /* @__PURE__ */ jsx2("input", { className: "w100n-docs-field", value: draft2.footer, onChange: (e) => setDraft2({ ...draft2, footer: e.target.value }) })
1582
+ /* @__PURE__ */ jsxs3("label", { className: "w100n-setup-line", children: [
1583
+ /* @__PURE__ */ jsx3("span", { children: t.footerText }),
1584
+ /* @__PURE__ */ jsx3("input", { className: "w100n-docs-field", value: draft2.footer, onChange: (e) => setDraft2({ ...draft2, footer: e.target.value }) })
1435
1585
  ] }),
1436
- /* @__PURE__ */ jsxs2("label", { className: "w100n-setup-check", children: [
1437
- /* @__PURE__ */ jsx2("input", { type: "checkbox", checked: draft2.numbers, onChange: (e) => setDraft2({ ...draft2, numbers: e.target.checked }) }),
1586
+ /* @__PURE__ */ jsxs3("label", { className: "w100n-setup-check", children: [
1587
+ /* @__PURE__ */ jsx3("input", { type: "checkbox", checked: draft2.numbers, onChange: (e) => setDraft2({ ...draft2, numbers: e.target.checked }) }),
1438
1588
  t.pageNumbers
1439
1589
  ] }),
1440
- /* @__PURE__ */ jsxs2("div", { className: "w100n-pdf-dialog-end", children: [
1441
- /* @__PURE__ */ jsx2("button", { type: "button", className: "w100n-pdf-link", onClick: () => setDraft2(null), children: t.cancel }),
1442
- /* @__PURE__ */ jsxs2("button", { type: "button", className: "w100n-docs-action", onClick: applySetup, children: [
1443
- /* @__PURE__ */ jsx2(Check, { "aria-hidden": true }),
1590
+ /* @__PURE__ */ jsxs3("div", { className: "w100n-pdf-dialog-end", children: [
1591
+ /* @__PURE__ */ jsx3("button", { type: "button", className: "w100n-pdf-link", onClick: () => setDraft2(null), children: t.cancel }),
1592
+ /* @__PURE__ */ jsxs3("button", { type: "button", className: "w100n-docs-action", onClick: applySetup, children: [
1593
+ /* @__PURE__ */ jsx3(Check, { "aria-hidden": true }),
1444
1594
  t.apply
1445
1595
  ] })
1446
1596
  ] })
1447
1597
  ] }) }),
1448
- slot && createPortal(/* @__PURE__ */ jsxs2("div", { className: "w100n-text-notes", children: [
1449
- draft && /* @__PURE__ */ jsxs2("div", { className: "w100n-text-card w100n-text-draft", children: [
1450
- /* @__PURE__ */ jsx2("blockquote", { children: draft.quote }),
1451
- /* @__PURE__ */ jsx2(
1452
- "textarea",
1453
- {
1454
- autoFocus: true,
1455
- value: draft.body,
1456
- placeholder: t.writeComment,
1457
- "aria-label": t.writeComment,
1458
- onChange: (e) => setDraft({ ...draft, body: e.target.value }),
1459
- onKeyDown: (e) => {
1460
- if (e.key === "Enter" && (e.metaKey || e.ctrlKey)) void post();
1461
- }
1462
- }
1463
- ),
1464
- /* @__PURE__ */ jsxs2("span", { className: "w100n-pdf-dialog-end", children: [
1465
- /* @__PURE__ */ jsx2("button", { type: "button", className: "w100n-pdf-link", onClick: drop, children: t.cancel }),
1466
- /* @__PURE__ */ jsxs2("button", { type: "button", className: "w100n-docs-action", disabled: !draft.body.trim() || posting === "busy", onClick: () => void post(), children: [
1467
- /* @__PURE__ */ jsx2(MessageSquarePlus, { "aria-hidden": true }),
1598
+ slot && createPortal(/* @__PURE__ */ jsxs3("div", { className: "w100n-text-notes", children: [
1599
+ draft && /* @__PURE__ */ jsxs3("div", { className: "w100n-text-card w100n-text-draft", children: [
1600
+ /* @__PURE__ */ jsx3("blockquote", { children: draft.quote }),
1601
+ /* @__PURE__ */ jsx3(Mentions, { autoFocus: true, value: draft.body, placeholder: t.writeComment, label: t.writeComment, people, onChange: (body) => setDraft({ ...draft, body }), onSend: () => void post() }),
1602
+ tagged(draft.body, people).length > 0 && /* @__PURE__ */ jsxs3("label", { className: "w100n-setup-check", children: [
1603
+ /* @__PURE__ */ jsx3("input", { type: "checkbox", checked: draft.give, onChange: (e) => setDraft({ ...draft, give: e.target.checked }) }),
1604
+ t.assignTo.replace("{name}", tagged(draft.body, people)[0].name)
1605
+ ] }),
1606
+ /* @__PURE__ */ jsxs3("span", { className: "w100n-pdf-dialog-end", children: [
1607
+ /* @__PURE__ */ jsx3("button", { type: "button", className: "w100n-pdf-link", onClick: drop, children: t.cancel }),
1608
+ /* @__PURE__ */ jsxs3("button", { type: "button", className: "w100n-docs-action", disabled: !draft.body.trim() || posting === "busy", onClick: () => void post(), children: [
1609
+ /* @__PURE__ */ jsx3(MessageSquarePlus, { "aria-hidden": true }),
1468
1610
  t.post
1469
1611
  ] })
1470
1612
  ] })
1471
1613
  ] }),
1472
- suggested.length > 0 && /* @__PURE__ */ jsxs2(Fragment3, { children: [
1473
- /* @__PURE__ */ jsxs2("p", { className: "w100n-docs-caption", children: [
1474
- /* @__PURE__ */ jsx2(FilePenLine, { "aria-hidden": true }),
1614
+ suggested.length > 0 && /* @__PURE__ */ jsxs3(Fragment3, { children: [
1615
+ /* @__PURE__ */ jsxs3("p", { className: "w100n-docs-caption", children: [
1616
+ /* @__PURE__ */ jsx3(FilePenLine, { "aria-hidden": true }),
1475
1617
  t.suggestions,
1476
- /* @__PURE__ */ jsx2("span", { children: suggested.length })
1618
+ /* @__PURE__ */ jsx3("span", { children: suggested.length })
1477
1619
  ] }),
1478
- suggested.map((c, i) => /* @__PURE__ */ jsxs2("article", { className: "w100n-text-card w100n-text-change", "data-kind": c.kind, onClick: () => jump(c.from), children: [
1479
- /* @__PURE__ */ jsxs2("header", { children: [
1480
- /* @__PURE__ */ jsx2("span", { className: "w100n-text-face", "aria-hidden": true, children: (c.author || "?").slice(0, 1).toUpperCase() }),
1481
- /* @__PURE__ */ jsxs2("span", { className: "w100n-text-who", children: [
1482
- /* @__PURE__ */ jsx2("b", { children: c.author || t.someone }),
1483
- c.date && /* @__PURE__ */ jsx2("small", { children: when(c.date) })
1620
+ suggested.map((c, i) => /* @__PURE__ */ jsxs3("article", { className: "w100n-text-card w100n-text-change", "data-kind": c.kind, onClick: () => jump(c.from), children: [
1621
+ /* @__PURE__ */ jsxs3("header", { children: [
1622
+ /* @__PURE__ */ jsx3("span", { className: "w100n-text-face", "aria-hidden": true, children: (c.author || "?").slice(0, 1).toUpperCase() }),
1623
+ /* @__PURE__ */ jsxs3("span", { className: "w100n-text-who", children: [
1624
+ /* @__PURE__ */ jsx3("b", { children: c.author || t.someone }),
1625
+ c.date && /* @__PURE__ */ jsx3("small", { children: when(c.date) })
1484
1626
  ] })
1485
1627
  ] }),
1486
- /* @__PURE__ */ jsxs2("p", { children: [
1628
+ /* @__PURE__ */ jsxs3("p", { children: [
1487
1629
  c.kind === "insertion" ? t.added : t.removed,
1488
1630
  " ",
1489
- /* @__PURE__ */ jsx2("q", { children: c.text })
1631
+ /* @__PURE__ */ jsx3("q", { children: c.text })
1490
1632
  ] }),
1491
- can.edit && /* @__PURE__ */ jsxs2("span", { className: "w100n-text-actions", onClick: (e) => e.stopPropagation(), children: [
1492
- /* @__PURE__ */ jsxs2("button", { type: "button", className: "w100n-docs-action", "data-tone": "green", onClick: () => decide(editor, true, c.id), children: [
1493
- /* @__PURE__ */ jsx2(Check, { "aria-hidden": true }),
1633
+ can.edit && /* @__PURE__ */ jsxs3("span", { className: "w100n-text-actions", onClick: (e) => e.stopPropagation(), children: [
1634
+ /* @__PURE__ */ jsxs3("button", { type: "button", className: "w100n-docs-action", "data-tone": "green", onClick: () => decide(editor, true, c.id), children: [
1635
+ /* @__PURE__ */ jsx3(Check, { "aria-hidden": true }),
1494
1636
  t.accept
1495
1637
  ] }),
1496
- /* @__PURE__ */ jsxs2("button", { type: "button", className: "w100n-docs-action", "data-tone": "red", onClick: () => decide(editor, false, c.id), children: [
1497
- /* @__PURE__ */ jsx2(X, { "aria-hidden": true }),
1638
+ /* @__PURE__ */ jsxs3("button", { type: "button", className: "w100n-docs-action", "data-tone": "red", onClick: () => decide(editor, false, c.id), children: [
1639
+ /* @__PURE__ */ jsx3(X, { "aria-hidden": true }),
1498
1640
  t.reject
1499
1641
  ] })
1500
1642
  ] })
1501
1643
  ] }, i))
1502
1644
  ] }),
1503
- posting === "failed" && /* @__PURE__ */ jsx2("p", { className: "w100n-docs-muted", role: "alert", children: t.commentFailed }),
1504
- failed && /* @__PURE__ */ jsx2("p", { className: "w100n-docs-muted", role: "alert", children: t.changeFailed }),
1505
- /* @__PURE__ */ jsxs2("div", { className: "w100n-docs-row", children: [
1506
- /* @__PURE__ */ jsxs2("p", { className: "w100n-docs-caption", children: [
1507
- /* @__PURE__ */ jsx2(MessagesSquare, { "aria-hidden": true }),
1645
+ posting === "failed" && /* @__PURE__ */ jsx3("p", { className: "w100n-docs-muted", role: "alert", children: t.commentFailed }),
1646
+ failed && /* @__PURE__ */ jsx3("p", { className: "w100n-docs-muted", role: "alert", children: t.changeFailed }),
1647
+ /* @__PURE__ */ jsxs3("div", { className: "w100n-docs-row", children: [
1648
+ /* @__PURE__ */ jsxs3("p", { className: "w100n-docs-caption", children: [
1649
+ /* @__PURE__ */ jsx3(MessagesSquare, { "aria-hidden": true }),
1508
1650
  t.comments,
1509
- /* @__PURE__ */ jsx2("span", { children: open.length })
1651
+ /* @__PURE__ */ jsx3("span", { children: open.length })
1510
1652
  ] }),
1511
- /* @__PURE__ */ jsx2("span", { className: "w100n-docs-chips", children: /* @__PURE__ */ jsx2("button", { type: "button", "aria-pressed": resolved, onClick: () => setResolved(!resolved), children: t.showResolved }) })
1653
+ /* @__PURE__ */ jsx3("span", { className: "w100n-docs-chips", children: /* @__PURE__ */ jsx3("button", { type: "button", "aria-pressed": resolved, onClick: () => setResolved(!resolved), children: t.showResolved }) })
1512
1654
  ] }),
1513
- !threads.length && !draft && /* @__PURE__ */ jsx2("p", { className: "w100n-docs-muted", children: can.comment ? t.commentHint : t.noComments }),
1514
- threads.map((c) => /* @__PURE__ */ jsxs2("article", { className: "w100n-text-card", "aria-current": active === c.id, "data-resolved": c.resolved, onClick: () => show(c), children: [
1655
+ !threads.length && !draft && /* @__PURE__ */ jsx3("p", { className: "w100n-docs-muted", children: can.comment ? t.commentHint : t.noComments }),
1656
+ threads.map((c) => /* @__PURE__ */ jsxs3("article", { className: "w100n-text-card", "aria-current": active === c.id, "data-resolved": c.resolved, onClick: () => show(c), children: [
1515
1657
  person(c),
1516
- c.quote && /* @__PURE__ */ jsx2("blockquote", { children: c.quote }),
1658
+ c.assignee && /* @__PURE__ */ jsx3("span", { className: "w100n-text-given", "data-me": c.assignee.id === host?.me.id, children: c.assignee.id === host?.me.id ? t.assignedYou : t.assignedTo.replace("{name}", c.assignee.name) }),
1659
+ c.quote && /* @__PURE__ */ jsx3("blockquote", { children: c.quote }),
1517
1660
  words(c),
1518
- all.filter((r) => r.replyTo === c.id).map((r) => /* @__PURE__ */ jsxs2("div", { className: "w100n-text-reply", children: [
1661
+ all.filter((r) => r.replyTo === c.id).map((r) => /* @__PURE__ */ jsxs3("div", { className: "w100n-text-reply", children: [
1519
1662
  person(r),
1520
1663
  words(r)
1521
1664
  ] }, r.id)),
1522
- reply?.id === c.id && /* @__PURE__ */ jsxs2("div", { className: "w100n-text-reply", onClick: (e) => e.stopPropagation(), children: [
1523
- /* @__PURE__ */ jsx2(
1524
- "textarea",
1525
- {
1526
- autoFocus: true,
1527
- value: reply.body,
1528
- placeholder: t.writeComment,
1529
- "aria-label": t.reply,
1530
- onChange: (e) => setReply({ ...reply, body: e.target.value }),
1531
- onKeyDown: (e) => {
1532
- if (e.key === "Enter" && (e.metaKey || e.ctrlKey)) void answer(c);
1533
- }
1534
- }
1535
- ),
1536
- /* @__PURE__ */ jsxs2("span", { className: "w100n-pdf-dialog-end", children: [
1537
- /* @__PURE__ */ jsx2("button", { type: "button", className: "w100n-pdf-link", onClick: () => setReply(null), children: t.cancel }),
1538
- /* @__PURE__ */ jsxs2("button", { type: "button", className: "w100n-docs-action", disabled: !reply.body.trim() || posting === "busy", onClick: () => void answer(c), children: [
1539
- /* @__PURE__ */ jsx2(Reply, { "aria-hidden": true }),
1665
+ reply?.id === c.id && /* @__PURE__ */ jsxs3("div", { className: "w100n-text-reply", onClick: (e) => e.stopPropagation(), children: [
1666
+ /* @__PURE__ */ jsx3(Mentions, { autoFocus: true, value: reply.body, placeholder: t.writeComment, label: t.reply, people, onChange: (body) => setReply({ ...reply, body }), onSend: () => void answer(c) }),
1667
+ /* @__PURE__ */ jsxs3("span", { className: "w100n-pdf-dialog-end", children: [
1668
+ /* @__PURE__ */ jsx3("button", { type: "button", className: "w100n-pdf-link", onClick: () => setReply(null), children: t.cancel }),
1669
+ /* @__PURE__ */ jsxs3("button", { type: "button", className: "w100n-docs-action", disabled: !reply.body.trim() || posting === "busy", onClick: () => void answer(c), children: [
1670
+ /* @__PURE__ */ jsx3(Reply, { "aria-hidden": true }),
1540
1671
  t.reply
1541
1672
  ] })
1542
1673
  ] })
1543
1674
  ] }),
1544
- can.comment && reply?.id !== c.id && /* @__PURE__ */ jsxs2("span", { className: "w100n-text-actions", onClick: (e) => e.stopPropagation(), children: [
1545
- c.resolved && /* @__PURE__ */ jsx2("span", { className: "w100n-docs-badge", children: t.resolved }),
1546
- !c.resolved && /* @__PURE__ */ jsxs2("button", { type: "button", className: "w100n-docs-action", onClick: () => setReply({ id: c.id, body: "" }), children: [
1547
- /* @__PURE__ */ jsx2(Reply, { "aria-hidden": true }),
1675
+ can.comment && reply?.id !== c.id && /* @__PURE__ */ jsxs3("span", { className: "w100n-text-actions", onClick: (e) => e.stopPropagation(), children: [
1676
+ c.resolved && /* @__PURE__ */ jsx3("span", { className: "w100n-docs-badge", children: t.resolved }),
1677
+ !c.resolved && /* @__PURE__ */ jsxs3("button", { type: "button", className: "w100n-docs-action", onClick: () => setReply({ id: c.id, body: "" }), children: [
1678
+ /* @__PURE__ */ jsx3(Reply, { "aria-hidden": true }),
1548
1679
  t.reply
1549
1680
  ] }),
1550
- host?.resolveComment && /* @__PURE__ */ jsxs2("button", { type: "button", className: "w100n-docs-action", "data-tone": "green", onClick: () => void settle(c), children: [
1551
- c.resolved ? /* @__PURE__ */ jsx2(RotateCcw, { "aria-hidden": true }) : /* @__PURE__ */ jsx2(Check, { "aria-hidden": true }),
1681
+ host?.resolveComment && /* @__PURE__ */ jsxs3("button", { type: "button", className: "w100n-docs-action", "data-tone": "green", onClick: () => void settle(c), children: [
1682
+ c.resolved ? /* @__PURE__ */ jsx3(RotateCcw, { "aria-hidden": true }) : /* @__PURE__ */ jsx3(Check, { "aria-hidden": true }),
1552
1683
  c.resolved ? t.reopen : t.resolve
1553
1684
  ] })
1554
1685
  ] })
@@ -1559,4 +1690,4 @@ img { max-width: 100%; } img[data-wrap='left'] { float: left; margin: 0 12pt 6pt
1559
1690
  export {
1560
1691
  TextEditor as default
1561
1692
  };
1562
- //# sourceMappingURL=TextEditor-D6QH2B7O.js.map
1693
+ //# sourceMappingURL=TextEditor-BF6HCNHL.js.map