@stll/folio-vue 0.33.0 → 0.34.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.
@@ -5,19 +5,20 @@ import { getEditorScrollRoot as g, scrollEditorBy as _ } from "@stll/folio-core/
5
5
  import { getMargins as te, getPageSize as ne, twipsToPixels as v } from "@stll/folio-core/paged-layout/sectionGeometry";
6
6
  import { readModel as y } from "@stll/folio-core/types/documentModel";
7
7
  import { readPaintedTableStart as b } from "@stll/folio-core/utils/paintedPositions";
8
+ import { canonicalReviewHeldRevisionIds as x } from "@stll/folio-core/controller/canonicalReview";
8
9
  import { NO_ANONYMIZATION_TERMS as re } from "@stll/folio-core/controller/anonymizationHighlights";
9
10
  import { createDisplayListPainterLoader as ie } from "@stll/folio-core/controller/deferredDisplayListPainter";
10
- import { DOCUMENT_CHANGE_NOTIFY_DELAY_MS as ae } from "@stll/folio-core/controller/documentChangeNotification";
11
- import { FOLIO_DOCX_SERIALIZATION_MODE as x, createFolioEditor as S } from "@stll/folio-core/controller/folioEditor";
12
- import { createFolioEditorEmitter as C } from "@stll/folio-core/controller/folioEditorEvents";
13
- import { readFontSetSignature as oe, waitForInitialLayoutFonts as w, watchLayoutFontLoads as se } from "@stll/folio-core/controller/fontReadiness";
14
- import { createHeaderFooterEditorManager as T } from "@stll/folio-core/controller/headerFooterEditorManager";
15
- import { createHyphenationReadiness as ce } from "@stll/folio-core/controller/hyphenationReadiness";
16
- import { runLayoutPipelineWithPainter as le } from "@stll/folio-core/controller/layoutPipelineExecution";
17
- import { TRANSACTION_LAYOUT_TIMING as ue, browserClock as de, createLayoutScheduler as E } from "@stll/folio-core/controller/layoutScheduler";
18
- import { createLayoutSession as fe } from "@stll/folio-core/controller/layoutSession";
19
- import { createNoteEditorManager as pe } from "@stll/folio-core/controller/noteEditorManager";
20
- import { PAGE_RENDERER as me } from "@stll/folio-core/display-list/editor/pageRenderer";
11
+ import { DOCUMENT_CHANGE_NOTIFY_DELAY_MS as S } from "@stll/folio-core/controller/documentChangeNotification";
12
+ import { FOLIO_DOCX_SERIALIZATION_MODE as C, OP_STORIES as w, createFolioEditor as T } from "@stll/folio-core/controller/folioEditor";
13
+ import { createFolioEditorEmitter as ae } from "@stll/folio-core/controller/folioEditorEvents";
14
+ import { readFontSetSignature as oe, waitForInitialLayoutFonts as E, watchLayoutFontLoads as se } from "@stll/folio-core/controller/fontReadiness";
15
+ import { createHeaderFooterEditorManager as ce } from "@stll/folio-core/controller/headerFooterEditorManager";
16
+ import { createHyphenationReadiness as le } from "@stll/folio-core/controller/hyphenationReadiness";
17
+ import { runLayoutPipelineWithPainter as ue } from "@stll/folio-core/controller/layoutPipelineExecution";
18
+ import { TRANSACTION_LAYOUT_TIMING as D, browserClock as de, createLayoutScheduler as fe } from "@stll/folio-core/controller/layoutScheduler";
19
+ import { createLayoutSession as pe } from "@stll/folio-core/controller/layoutSession";
20
+ import { createNoteEditorManager as me } from "@stll/folio-core/controller/noteEditorManager";
21
+ import { PAGE_RENDERER as O } from "@stll/folio-core/display-list/editor/pageRenderer";
21
22
  import { holdsUniqueParagraphIds as he, openCanonicalDocx as ge, prepareCanonicalDocumentInput as _e } from "@stll/folio-core/docx/canonicalSessionInput";
22
23
  import { carryParseFacts as ve, cloneDocumentWithParagraphPropertySources as ye } from "@stll/folio-core/docx/document-clone";
23
24
  import { getFootnoteText as be } from "@stll/folio-core/docx/storyPlainText";
@@ -31,61 +32,61 @@ import { createTemplateDirectivesPlugin as ke } from "@stll/folio-core/prosemirr
31
32
  import { createTemplatePreviewValuesPlugin as Ae } from "@stll/folio-core/prosemirror/plugins/templatePreviewValues";
32
33
  import { templateSlashMenuPlugin as je } from "@stll/folio-core/prosemirror/plugins/templateSlashMenu";
33
34
  import { resolveHeaderFooterContent as Me } from "@stll/folio-core/utils/headerFooter";
34
- import { lockHeldRevisions as Ne, trackedChangeEntryRevisionIds as Pe } from "@stll/folio-core/prosemirror/commands/comments";
35
- import { FindReplaceManager as Fe } from "@stll/folio-core/managers/FindReplaceManager";
36
- import { findInDisplayedDocument as Ie } from "@stll/folio-core/prosemirror/findReplaceSelection";
37
- import { replaceFindMatch as Le, replaceFindMatches as Re } from "@stll/folio-core/prosemirror/replaceFindMatches";
38
- import { createFindMatchView as ze, getRenderedSearchStories as Be } from "@stll/folio-core/utils/findMatchView";
39
- import { createDefaultFindOptions as Ve, replaceEligibility as He } from "@stll/folio-core/utils/findReplace";
40
- import { createFindSearchKey as D, sameFindSearchKey as Ue } from "@stll/folio-core/utils/findSearchKey";
41
- import { MIN_CELL_WIDTH_TWIPS as We, MIN_ROW_HEIGHT_TWIPS as Ge, TWIPS_PER_PIXEL as O, clampRowResizeDelta as Ke, columnResizeCommand as qe, readColumnWidthAt as Je, readColumnWidths as Ye, readRowHeight as Xe, rightEdgeResizeCommand as Ze, rowResizeCommand as k } from "@stll/folio-core/prosemirror/tableResize";
42
- import { extractTrackedChanges as Qe } from "@stll/folio-core/prosemirror/utils/extractTrackedChanges";
43
- import { ZOOM_MAX as $e, ZOOM_MIN as A, ZOOM_STEP as j } from "@stll/folio-core/utils/zoom";
35
+ import { FindReplaceManager as Ne } from "@stll/folio-core/managers/FindReplaceManager";
36
+ import { findInDisplayedDocument as Pe } from "@stll/folio-core/prosemirror/findReplaceSelection";
37
+ import { replaceFindMatch as Fe, replaceFindMatches as Ie } from "@stll/folio-core/prosemirror/replaceFindMatches";
38
+ import { createFindMatchView as Le, getRenderedSearchStories as Re } from "@stll/folio-core/utils/findMatchView";
39
+ import { createDefaultFindOptions as ze, replaceEligibility as Be } from "@stll/folio-core/utils/findReplace";
40
+ import { createFindSearchKey as k, sameFindSearchKey as Ve } from "@stll/folio-core/utils/findSearchKey";
41
+ import { MIN_CELL_WIDTH_TWIPS as He, MIN_ROW_HEIGHT_TWIPS as Ue, TWIPS_PER_PIXEL as A, clampRowResizeDelta as We, columnResizeCommand as Ge, readColumnWidthAt as Ke, readColumnWidths as qe, readRowHeight as Je, rightEdgeResizeCommand as Ye, rowResizeCommand as j } from "@stll/folio-core/prosemirror/tableResize";
42
+ import { trackedChangeEntryRevisionIds as Xe } from "@stll/folio-core/prosemirror/projectionReview";
43
+ import { extractTrackedChanges as Ze } from "@stll/folio-core/prosemirror/utils/extractTrackedChanges";
44
+ import { ZOOM_MAX as M, ZOOM_MIN as N, ZOOM_STEP as P } from "@stll/folio-core/utils/zoom";
44
45
  // src/utils/colorMode.ts
45
- var M = "(prefers-color-scheme: dark)";
46
- function N() {
46
+ var F = "(prefers-color-scheme: dark)";
47
+ function I() {
47
48
  return typeof window < "u" && typeof window.matchMedia == "function";
48
49
  }
49
- function P(e, t) {
50
+ function L(e, t) {
50
51
  return e === "dark" || e === "system" && t;
51
52
  }
52
- function F(e) {
53
- if (!N()) return () => {};
54
- let t = window.matchMedia(M);
53
+ function Qe(e) {
54
+ if (!I()) return () => {};
55
+ let t = window.matchMedia(F);
55
56
  e(t.matches);
56
57
  let n = (t) => e(t.matches);
57
58
  return t.addEventListener("change", n), () => t.removeEventListener("change", n);
58
59
  }
59
60
  // src/composables/useColorMode.ts
60
- var I = "light", L = Symbol("folioColorMode"), et = (t = I) => {
61
- a(L, e(() => u(t)));
62
- }, R = { install(t, n = I) {
63
- t.provide(L, e(() => u(n)));
61
+ var R = "light", z = Symbol("folioColorMode"), B = (t = R) => {
62
+ a(z, e(() => u(t)));
63
+ }, V = { install(t, n = R) {
64
+ t.provide(z, e(() => u(n)));
64
65
  } };
65
- function z() {
66
- let n = t(L, e(() => I)), i = s(!1), a = s(!1);
66
+ function $e() {
67
+ let n = t(z, e(() => R)), i = s(!1), a = s(!1);
67
68
  return r(() => {
68
69
  i.value = !0;
69
70
  }), f((e) => {
70
- i.value && n.value === "system" && e(F((e) => {
71
+ i.value && n.value === "system" && e(Qe((e) => {
71
72
  a.value = e;
72
73
  }));
73
- }), e(() => P(n.value, i.value && a.value));
74
+ }), e(() => L(n.value, i.value && a.value));
74
75
  }
75
76
  // src/utils/rawDocument.ts
76
- var tt = (e) => B(e, /* @__PURE__ */ new Map()), B = (e, t) => {
77
+ var et = (e) => H(e, /* @__PURE__ */ new Map()), H = (e, t) => {
77
78
  if (typeof e != "object" || !e) return e;
78
79
  let n = l(e), r = t.get(n);
79
80
  if (r !== void 0) return r;
80
81
  t.set(n, n);
81
- let i = nt(n, t);
82
+ let i = tt(n, t);
82
83
  return t.set(n, i), i;
83
- }, nt = (e, t) => {
84
+ }, tt = (e, t) => {
84
85
  if (ArrayBuffer.isView(e) || e instanceof ArrayBuffer) return e;
85
86
  if (e instanceof Map) {
86
87
  let n = !1, r = [];
87
88
  for (let [i, a] of e) {
88
- let e = B(i, t), o = B(a, t);
89
+ let e = H(i, t), o = H(a, t);
89
90
  (e !== i || o !== a) && (n = !0), r.push([e, o]);
90
91
  }
91
92
  return n ? new Map(r) : e;
@@ -93,14 +94,14 @@ var tt = (e) => B(e, /* @__PURE__ */ new Map()), B = (e, t) => {
93
94
  if (e instanceof Set) {
94
95
  let n = !1, r = [];
95
96
  for (let i of e) {
96
- let e = B(i, t);
97
+ let e = H(i, t);
97
98
  e !== i && (n = !0), r.push(e);
98
99
  }
99
100
  return n ? new Set(r) : e;
100
101
  }
101
102
  if (Array.isArray(e)) {
102
103
  let n = !1, r = e.map((e) => {
103
- let r = B(e, t);
104
+ let r = H(e, t);
104
105
  return r !== e && (n = !0), r;
105
106
  });
106
107
  return n ? r : e;
@@ -108,15 +109,15 @@ var tt = (e) => B(e, /* @__PURE__ */ new Map()), B = (e, t) => {
108
109
  let n = Object.getOwnPropertyDescriptors(e), r = !1;
109
110
  for (let e of Reflect.ownKeys(n)) {
110
111
  let i = Reflect.get(n, e);
111
- if (!rt(i)) continue;
112
- let a = B(i.value, t);
112
+ if (!U(i)) continue;
113
+ let a = H(i.value, t);
113
114
  a !== i.value && (r = !0, i.value = a);
114
115
  }
115
116
  if (!r) return e;
116
117
  let i = Object.create(Reflect.getPrototypeOf(e), n);
117
118
  return ve(i, e), i;
118
- }, rt = (e) => typeof e == "object" && !!e && "value" in e, it = 24, at = "User", ot = [], st = [];
119
- function ct(e) {
119
+ }, U = (e) => typeof e == "object" && !!e && "value" in e, nt = 24, rt = "User", it = [], at = [];
120
+ function ot(e) {
120
121
  let t = e?.columnCount ?? 1;
121
122
  if (t <= 1) return;
122
123
  let n = {
@@ -126,7 +127,7 @@ function ct(e) {
126
127
  };
127
128
  return e?.separator !== void 0 && (n.separator = e.separator), n;
128
129
  }
129
- function lt(e, t, n, r, i, a) {
130
+ function st(e, t, n, r, i, a) {
130
131
  if (!e) return;
131
132
  let o = t ? {
132
133
  ...a,
@@ -134,16 +135,16 @@ function lt(e, t, n, r, i, a) {
134
135
  } : a, s = t ? n?.getView(t) : null;
135
136
  return s ? xe(s.state.doc, r, i, o) : Se(e, r, i, o);
136
137
  }
137
- function ut(e, t, n, r, i) {
138
+ function ct(e, t, n, r, i) {
138
139
  if (!e || e.size === 0) return;
139
140
  let a = /* @__PURE__ */ new Map();
140
141
  for (let [o, s] of e) {
141
- let e = lt(s, o, t, n, r, i);
142
+ let e = st(s, o, t, n, r, i);
142
143
  e && a.set(o, e);
143
144
  }
144
145
  return a.size > 0 ? a : void 0;
145
146
  }
146
- function dt(e, t, n) {
147
+ function lt(e, t, n) {
147
148
  let r = /* @__PURE__ */ new Map();
148
149
  if (!n || !n.package.footnotes) return r;
149
150
  let i = /* @__PURE__ */ new Map();
@@ -169,7 +170,7 @@ function dt(e, t, n) {
169
170
  }
170
171
  return r;
171
172
  }
172
- var V = /* @__PURE__ */ new Set([
173
+ var W = /* @__PURE__ */ new Set([
173
174
  "black",
174
175
  "blue",
175
176
  "cyan",
@@ -188,190 +189,190 @@ var V = /* @__PURE__ */ new Set([
188
189
  "white",
189
190
  "yellow"
190
191
  ]);
191
- function ft(e) {
192
+ function ut(e) {
192
193
  let t = [], n = (e, r) => {
193
- for (let [n, i] of e.marks.entries()) i.type.name === "highlight" && !V.has(String(i.attrs.color)) && t.push(`${r}.marks[${n}]=${JSON.stringify(i.attrs)}`);
194
+ for (let [n, i] of e.marks.entries()) i.type.name === "highlight" && !W.has(String(i.attrs.color)) && t.push(`${r}.marks[${n}]=${JSON.stringify(i.attrs)}`);
194
195
  e.forEach((e, t, i) => {
195
196
  n(e, `${r}.content[${i}]`);
196
197
  });
197
198
  };
198
199
  return n(e, "doc"), t.join("; ");
199
200
  }
200
- function H(e) {
201
- let { hiddenContainer: t, hiddenHeaderFooterContainer: n, noteEditorContainer: r, pagesContainer: a, readOnly: o = !1, pageGap: l = it, pageRenderer: f, markupView: ee = "all-markup", showCommentHighlights: g = !0, altChunkMarkerText: _, showMarginGuides: v, marginGuideColor: b, password: ve, editorMode: be, author: xe, externalPlugins: Se = [], historyShortcuts: Ne = "editor", onCanonicalHistory: Pe, onCanonicalHistoryDrop: Fe, collaboration: Ie, getAnonymizationTerms: Le, getDerivedFields: Re, showTemplateDirectives: ze, onSlashMenuChange: Be, onSlashMenuKeyAction: Ve, onChange: He, onError: D, onSelectionUpdate: Ue, onEditorViewReady: We, onCopy: Ge, onCut: O, onPaste: Ke, onReadOnlyEditAttempt: qe, featureFlags: Je, onSelectiveSaveTripwire: Ye } = e, Xe = n ?? t, Ze = () => u(xe) ?? at, k = c(null), Qe = () => {
202
- let e = k.value;
201
+ function G(e) {
202
+ let { hiddenContainer: t, hiddenHeaderFooterContainer: n, noteEditorContainer: r, pagesContainer: a, readOnly: o = !1, pageGap: l = nt, pageRenderer: f, markupView: ee = "all-markup", showCommentHighlights: g = !0, altChunkMarkerText: _, showMarginGuides: v, marginGuideColor: b, password: x, editorMode: w, author: ve, externalPlugins: be = [], historyShortcuts: xe = "editor", onCanonicalHistory: Se, onCanonicalHistoryDrop: Ne, collaboration: Pe, getAnonymizationTerms: Fe, getDerivedFields: Ie, showTemplateDirectives: Le, onSlashMenuChange: Re, onSlashMenuKeyAction: ze, onChange: Be, onError: k, onSelectionUpdate: Ve, onEditorViewReady: He, onCopy: Ue, onCut: A, onPaste: We, onReadOnlyEditAttempt: Ge, featureFlags: Ke, onSelectiveSaveTripwire: qe } = e, Je = n ?? t, Ye = () => u(ve) ?? rt, j = c(null), Xe = () => {
203
+ let e = j.value;
203
204
  return (e && y(e).package.styles) ?? null;
204
- }, $e = c(null), A = 0, j = !1, M = 0, N = !1, P = c(null), F = c(null), I = () => u(Ie), L = c([]), et = c(null), R = c(null), z = c(null), B = s(0), nt = c([]), rt = c([]), V = s(!1), H = s(null), U = s(!1), pt = (e) => ye(e), mt = (e) => {
205
- let t = pt(e);
206
- He?.(t), G.emit("docChange", t);
207
- }, W = new De(Oe({ historyShortcuts: Ne }));
208
- W.buildSchema(), W.initializeRuntime();
209
- let ht = ke(), gt = je({
210
- onChange: (e) => Be?.(e),
211
- onKeyAction: (e) => Ve?.(e) ?? !1
212
- }), _t = Ae(), vt = () => u(ze) === !0;
213
- function yt() {
205
+ }, Ze = c(null), M = 0, N = !1, P = 0, F = !1, I = c(null), L = c(null), Qe = () => u(Pe), R = c([]), z = c(null), B = c(null), V = c(null), $e = s(0), H = c([]), tt = c([]), U = s(!1), W = s(null), G = s(!1), dt = (e) => ye(e), ft = (e) => {
206
+ let t = dt(e);
207
+ Be?.(t), q.emit("docChange", t);
208
+ }, K = new De(Oe({ historyShortcuts: xe }));
209
+ K.buildSchema(), K.initializeRuntime();
210
+ let pt = ke(), mt = je({
211
+ onChange: (e) => Re?.(e),
212
+ onKeyAction: (e) => ze?.(e) ?? !1
213
+ }), ht = Ae(), gt = () => u(Le) === !0;
214
+ function _t() {
214
215
  return [
215
- ...Se,
216
- ...vt() ? [ht, gt] : [],
217
- _t
216
+ ...be,
217
+ ...gt() ? [pt, mt] : [],
218
+ ht
218
219
  ];
219
220
  }
220
- let G = C(), K = new Ee(), q = fe(), bt = ce({
221
+ let q = ae(), J = new Ee(), Y = pe(), vt = le({
221
222
  relayout: () => {
222
- let e = P.value?.state ?? q.lastEditorState;
223
- e && X(e, { reason: "hyphenation-ready" });
223
+ let e = I.value?.state ?? Y.lastEditorState;
224
+ e && Z(e, { reason: "hyphenation-ready" });
224
225
  },
225
- onError: (e) => D?.(e)
226
+ onError: (e) => k?.(e)
226
227
  });
227
- i(bt.cancel), i(se({
228
- measuredFontSet: () => q.lastMeasureInputs?.fontSet ?? null,
228
+ i(vt.cancel), i(se({
229
+ measuredFontSet: () => Y.lastMeasureInputs?.fontSet ?? null,
229
230
  relayout: () => {
230
- if (N) return;
231
- let e = P.value?.state ?? q.lastEditorState;
232
- e && X(e, { reason: "font-ready" });
231
+ if (F) return;
232
+ let e = I.value?.state ?? Y.lastEditorState;
233
+ e && Z(e, { reason: "font-ready" });
233
234
  }
234
235
  }));
235
- let xt = new we({
236
+ let yt = new we({
236
237
  pageGap: l,
237
238
  showShadow: !0
238
- }), St = T({
239
- getHost: () => Xe.value,
239
+ }), bt = ce({
240
+ getHost: () => Je.value,
240
241
  getReadOnly: () => u(o),
241
242
  getCanonicalApi: () => $.api,
242
243
  readCanonicalDocument: () => $.readCanonicalDocument(),
243
244
  onSessionRefusal: (e, t, n) => {
244
- H.value = e, D?.(n ?? new p({
245
+ W.value = e, k?.(n ?? new p({
245
246
  ground: t,
246
247
  message: e
247
248
  }));
248
249
  },
249
- getStyles: Qe,
250
+ getStyles: Xe,
250
251
  onTransaction: ({ rId: e, kind: t, view: n, docChanged: r, selectionChanged: i }) => {
251
- if (r && (U.value = !0, Z.schedule()), r || i) {
252
+ if (r && (G.value = !0, wt.schedule()), r || i) {
252
253
  let { from: r, to: i } = n.state.selection;
253
- et.value = {
254
+ z.value = {
254
255
  from: r,
255
256
  kind: t,
256
257
  rId: e,
257
258
  to: i
258
- }, Ue?.(n.state), G.emit("selectionChange", {
259
+ }, Ve?.(n.state), q.emit("selectionChange", {
259
260
  from: r,
260
261
  to: i
261
262
  });
262
263
  }
263
- K.requestRender();
264
+ J.requestRender();
264
265
  }
265
- }), J = pe({
266
+ }), X = me({
266
267
  getHost: () => r?.value ?? null,
267
268
  getCanonicalApi: () => $.api,
268
269
  readCanonicalDocument: () => $.readCanonicalDocument(),
269
270
  onSessionRefusal: (e, t, n) => {
270
- H.value = e, D?.(n ?? new p({
271
+ W.value = e, k?.(n ?? new p({
271
272
  ground: t,
272
273
  message: e
273
274
  }));
274
275
  },
275
- getStyles: Qe,
276
+ getStyles: Xe,
276
277
  onTransaction: ({ docChanged: e, selectionChanged: t, view: n }) => {
277
278
  if (e) {
278
- U.value = !0;
279
- let e = k.value;
280
- e && (k.value = $.readCanonicalDocument() ?? e, Ot()), Z.schedule();
279
+ G.value = !0;
280
+ let e = j.value;
281
+ e && (j.value = $.readCanonicalDocument() ?? e, Ot()), wt.schedule();
281
282
  }
282
283
  if (e || t) {
283
- Ue?.(n.state);
284
+ Ve?.(n.state);
284
285
  let { from: e, to: t } = n.state.selection;
285
- G.emit("selectionChange", {
286
+ q.emit("selectionChange", {
286
287
  from: e,
287
288
  to: t
288
289
  });
289
290
  }
290
291
  }
291
- }), Y = () => {
292
- St.sync(), J.sync();
292
+ }), xt = () => {
293
+ bt.sync(), X.sync();
293
294
  };
294
- function Ct(e) {
295
- e.layout && (z.value = e.layout), e.blocks && (nt.value = e.blocks), e.measures && (rt.value = e.measures), e.blockLookup && xt.setBlockLookup(e.blockLookup), e.layout && G.emit("layoutComplete", e.layout);
295
+ function St(e) {
296
+ e.layout && (V.value = e.layout), e.blocks && (H.value = e.blocks), e.measures && (tt.value = e.measures), e.blockLookup && yt.setBlockLookup(e.blockLookup), e.layout && q.emit("layoutComplete", e.layout);
296
297
  }
297
- let wt = ie({
298
+ let Ct = ie({
298
299
  onReady: () => {
299
- if (j || u(f) !== me.displayList) return;
300
- let e = P.value;
301
- e && X(e.state, { reason: "layout-input" });
300
+ if (N || u(f) !== O.displayList) return;
301
+ let e = I.value;
302
+ e && Z(e.state, { reason: "layout-input" });
302
303
  },
303
304
  onError: (e) => {
304
- !j && u(f) === me.displayList && D?.(e);
305
+ !N && u(f) === O.displayList && k?.(e);
305
306
  }
306
307
  });
307
- function X(e, t = {}) {
308
- if (N) return;
309
- let n = u(f), r = n === me.displayList ? wt() : void 0;
310
- if (n === me.displayList && !r) return;
311
- let i = a.value, o = i instanceof HTMLDivElement ? i : null, s = k.value, c = s && y(s), d = c?.package.document, p = d?.sections?.[0]?.properties ?? d?.finalSectionProperties ?? null, m = ne(p), h = te(p), re = ct(p), ie = m.w - h.left - h.right;
312
- B.value = ie;
313
- let ae = c?.package.styles ?? null, x = s?.package.theme ?? null, S = s?.package.settings?.defaultTabStop, C = s?.package.settings?.mirrorMargins === !0, w = Me(c?.package);
308
+ function Z(e, t = {}) {
309
+ if (F) return;
310
+ let n = u(f), r = n === O.displayList ? Ct() : void 0;
311
+ if (n === O.displayList && !r) return;
312
+ let i = a.value, o = i instanceof HTMLDivElement ? i : null, s = j.value, c = s && y(s), d = c?.package.document, p = d?.sections?.[0]?.properties ?? d?.finalSectionProperties ?? null, m = ne(p), h = te(p), x = ot(p), re = m.w - h.left - h.right;
313
+ $e.value = re;
314
+ let ie = c?.package.styles ?? null, S = s?.package.theme ?? null, C = s?.package.settings?.defaultTabStop, w = s?.package.settings?.mirrorMargins === !0, T = Me(c?.package);
314
315
  try {
315
- Ct(le({
316
- contentWidth: ie,
317
- columns: re,
316
+ St(ue({
317
+ contentWidth: re,
318
+ columns: x,
318
319
  pageSize: m,
319
320
  margins: h,
320
321
  pageGap: l,
321
322
  showMarginGuides: u(v) === !0,
322
323
  marginGuideColor: u(b),
323
324
  ...r ? { displayListPagePainter: r } : {},
324
- syncCoordinator: K,
325
- headerContent: w.headerContent,
326
- footerContent: w.footerContent,
327
- firstPageHeaderContent: w.firstPageHeaderContent,
328
- firstPageFooterContent: w.firstPageFooterContent,
329
- headerContentRId: w.activeHeaderRId,
330
- footerContentRId: w.activeFooterRId,
331
- firstPageHeaderContentRId: w.activeFirstHeaderRId,
332
- firstPageFooterContentRId: w.activeFirstFooterRId,
325
+ syncCoordinator: J,
326
+ headerContent: T.headerContent,
327
+ footerContent: T.footerContent,
328
+ firstPageHeaderContent: T.firstPageHeaderContent,
329
+ firstPageFooterContent: T.firstPageFooterContent,
330
+ headerContentRId: T.activeHeaderRId,
331
+ footerContentRId: T.activeFooterRId,
332
+ firstPageHeaderContentRId: T.activeFirstHeaderRId,
333
+ firstPageFooterContentRId: T.activeFirstFooterRId,
333
334
  sectionHeaderFooterRefs: Ce(c),
334
- theme: x,
335
+ theme: S,
335
336
  sectionProperties: p,
336
337
  document: s,
337
- defaultTabStop: S,
338
- mirrorMargins: C,
339
- styles: ae,
340
- layout: z.value,
341
- hfPMs: St,
342
- painter: xt,
338
+ defaultTabStop: C,
339
+ mirrorMargins: w,
340
+ styles: ie,
341
+ layout: V.value,
342
+ hfPMs: bt,
343
+ painter: yt,
343
344
  pagesContainer: o,
344
- session: q,
345
- renderHfFromContentOrPm: lt,
346
- renderHeaderFooterContentByRId: ut,
345
+ session: Y,
346
+ renderHfFromContentOrPm: st,
347
+ renderHeaderFooterContentByRId: ct,
347
348
  readFontSetSignature: oe,
348
- buildFootnoteRenderItems: dt,
349
- describeInvalidHighlightMarks: ft,
350
- emptyTemplatePreviewEntries: ot,
351
- emptyTemplatePreviewHidden: st,
352
- hyphenationReadiness: bt,
349
+ buildFootnoteRenderItems: lt,
350
+ describeInvalidHighlightMarks: ut,
351
+ emptyTemplatePreviewEntries: it,
352
+ emptyTemplatePreviewHidden: at,
353
+ hyphenationReadiness: vt,
353
354
  markupView: u(ee),
354
355
  showCommentHighlights: u(g),
355
356
  ..._ === void 0 ? {} : { altChunkMarkerText: u(_) }
356
357
  }, e, t));
357
358
  } catch (e) {
358
359
  let t = e instanceof Error ? e : Error(String(e));
359
- D?.(t);
360
+ k?.(t);
360
361
  }
361
362
  }
362
- let Z = E({
363
- readState: () => P.value?.state ?? null,
364
- runLayout: (e, t) => X(e, t),
365
- ...ue,
363
+ let wt = fe({
364
+ readState: () => I.value?.state ?? null,
365
+ runLayout: (e, t) => Z(e, t),
366
+ ...D,
366
367
  clock: de
367
368
  }), Q = null;
368
369
  function Tt() {
369
- if (Q !== null && (window.clearTimeout(Q), Q = null), P.value && k.value) try {
370
+ if (Q !== null && (window.clearTimeout(Q), Q = null), I.value && j.value) try {
370
371
  let e = $.readCanonicalDocument();
371
372
  if (!e) return;
372
- k.value = e, Y(), Dt(), mt(e);
373
+ j.value = e, xt(), Dt(), ft(e);
373
374
  } catch (e) {
374
- D?.(e instanceof Error ? e : Error(String(e)));
375
+ k?.(e instanceof Error ? e : Error(String(e)));
375
376
  }
376
377
  }
377
378
  let Et = null;
@@ -381,212 +382,212 @@ function H(e) {
381
382
  function Ot() {
382
383
  Dt(), Et = window.setTimeout(() => {
383
384
  if (Et = null, Q !== null) return;
384
- let e = k.value;
385
- e && mt(e);
386
- }, ae);
385
+ let e = j.value;
386
+ e && ft(e);
387
+ }, S);
387
388
  }
388
389
  function kt() {
389
390
  Q !== null && window.clearTimeout(Q), Q = window.setTimeout(() => {
390
391
  Q = null, Tt();
391
- }, ae);
392
+ }, S);
392
393
  }
393
394
  let $ = m({
394
395
  getHost: () => t.value,
395
- getDocument: () => k.value,
396
- getStyles: Qe,
397
- getExtensionManager: () => W,
398
- getExternalPlugins: yt,
399
- getAnonymizationTerms: () => Le?.() ?? re,
400
- getDerivedFields: () => Re?.(),
401
- getCanonicalRoom: I,
396
+ getDocument: () => j.value,
397
+ getStyles: Xe,
398
+ getExtensionManager: () => K,
399
+ getExternalPlugins: _t,
400
+ getAnonymizationTerms: () => Fe?.() ?? re,
401
+ getDerivedFields: () => Ie?.(),
402
+ getCanonicalRoom: Qe,
402
403
  getReadOnly: () => u(o),
403
- getHistoryShortcuts: () => Ne,
404
- onCanonicalHistory: (e) => Pe?.(e),
405
- onCanonicalHistoryDrop: (e) => Fe?.(e),
406
- getEditingMode: () => u(be) ?? "editing",
407
- getSuggestionAuthor: Ze,
404
+ getHistoryShortcuts: () => xe,
405
+ onCanonicalHistory: (e) => Se?.(e),
406
+ onCanonicalHistoryDrop: (e) => Ne?.(e),
407
+ getEditingMode: () => u(w) ?? "editing",
408
+ getSuggestionAuthor: Ye,
408
409
  onSessionRefusal: (e, t, n) => {
409
- D?.(n ?? new p({
410
+ k?.(n ?? new p({
410
411
  ground: t,
411
412
  message: e
412
413
  }));
413
414
  },
414
- getDocumentIdentity: () => String(A),
415
- getDocumentContext: () => k.value,
415
+ getDocumentIdentity: () => String(M),
416
+ getDocumentContext: () => j.value,
416
417
  onTransaction: jt,
417
418
  onCanonicalCompositionLayout: Mt,
418
- getEmbeddedFontFamilyMap: () => q.embeddedFontFamilyMap,
419
+ getEmbeddedFontFamilyMap: () => Y.embeddedFontFamilyMap,
419
420
  onSelectionChange: (e) => {
420
- F.value = e, Ue?.(e), G.emit("selectionChange", {
421
+ L.value = e, Ve?.(e), q.emit("selectionChange", {
421
422
  from: e.selection.from,
422
423
  to: e.selection.to
423
424
  });
424
425
  },
425
426
  onKeyDown: () => !1,
426
- onCopy: () => Ge?.(),
427
- onCut: () => O?.(),
428
- onPaste: () => Ke?.(),
429
- onReadOnlyEditAttempt: () => qe?.(),
427
+ onCopy: () => Ue?.(),
428
+ onCut: () => A?.(),
429
+ onPaste: () => We?.(),
430
+ onReadOnlyEditAttempt: () => Ge?.(),
430
431
  onEditorViewReady: Nt,
431
432
  onEditorViewDestroy: () => {
432
- P.value = null, V.value = !1, We?.(null);
433
+ I.value = null, U.value = !1, He?.(null);
433
434
  },
434
435
  onRemoteSelectionsChange: (e) => {
435
- L.value = e;
436
+ R.value = e;
436
437
  }
437
438
  }), At = $.api.autocomplete.subscribe((t) => e.onAutocompleteChange?.(t));
438
- d(() => u(Ie), () => {
439
- L.value = [], $.retryViewCreation(), $.syncExternalDocument();
439
+ d(() => u(Pe), () => {
440
+ R.value = [], $.retryViewCreation(), $.syncExternalDocument();
440
441
  }, { immediate: !0 });
441
442
  function jt({ newState: e, docChanged: t }) {
442
- if (F.value = e, t) {
443
+ if (L.value = e, t) {
443
444
  let e = $.readCanonicalDocument();
444
- e && (k.value = e, Y()), U.value = !0, K.incrementStateSeq(), Z.schedule(), kt();
445
+ e && (j.value = e, xt()), G.value = !0, J.incrementStateSeq(), wt.schedule(), kt();
445
446
  }
446
- K.requestRender();
447
+ J.requestRender();
447
448
  }
448
449
  function Mt() {
449
- let e = P.value;
450
- e && (F.value = e.state), K.incrementStateSeq(), Z.schedule(), K.requestRender();
450
+ let e = I.value;
451
+ e && (L.value = e.state), J.incrementStateSeq(), wt.schedule(), J.requestRender();
451
452
  }
452
453
  function Nt(e) {
453
- P.value = e, F.value = e.state, V.value = !0;
454
- let t = k.value, n = A, r = ++M;
455
- N = !0;
454
+ I.value = e, L.value = e.state, U.value = !0;
455
+ let t = j.value, n = M, r = ++P;
456
+ F = !0;
456
457
  let i = () => {
457
- M === r && (N = !1, j || A !== n || $.getView() !== e || (X(e.state, { reason: "initial" }), K.requestRender()));
458
+ P === r && (F = !1, N || M !== n || $.getView() !== e || (Z(e.state, { reason: "initial" }), J.requestRender()));
458
459
  };
459
- w(t, e.state.doc).then(i, i), We?.(e), u(o) || requestAnimationFrame(() => {
460
- P.value === e && !e.hasFocus() && e.focus();
460
+ E(t, e.state.doc).then(i, i), He?.(e), u(o) || requestAnimationFrame(() => {
461
+ I.value === e && !e.hasFocus() && e.focus();
461
462
  });
462
463
  }
463
464
  let Pt = {
464
465
  getDocx: async (e) => {
465
466
  let t = await Gt(e);
466
- return t?.tripwireResult && Ye?.(t.tripwireResult), t?.buffer ?? null;
467
+ return t?.tripwireResult && qe?.(t.tripwireResult), t?.buffer ?? null;
467
468
  },
468
469
  loadDocument: Ht,
469
470
  loadDocx: Vt
470
- }, Ft = S({
471
+ }, Ft = T({
471
472
  getEditorApi: () => $.api,
472
- getLayout: () => z.value,
473
- runLayout: (e, t) => X(e, t),
473
+ getLayout: () => V.value,
474
+ runLayout: (e, t) => Z(e, t),
474
475
  getDocumentIO: () => Pt,
475
- emitter: G
476
+ emitter: q
476
477
  });
477
- d([() => u(be), Ze], () => {
478
- Ft.setCanonicalMode(u(be) === "suggesting" ? {
478
+ d([() => u(w), Ye], () => {
479
+ Ft.setCanonicalMode(u(w) === "suggesting" ? {
479
480
  type: "suggesting",
480
- author: Ze()
481
+ author: Ye()
481
482
  } : { type: "editing" });
482
483
  }), d(() => u(o), (e) => {
483
- $.syncEditable(), e && en(), St.sync();
484
+ $.syncEditable(), e && en(), bt.sync();
484
485
  });
485
486
  function It(e) {
486
- let t = vt();
487
- if (t === e.state.plugins.includes(ht)) return;
488
- let n = e.state.plugins.filter((e) => e !== ht && e !== gt);
487
+ let t = gt();
488
+ if (t === e.state.plugins.includes(pt)) return;
489
+ let n = e.state.plugins.filter((e) => e !== pt && e !== mt);
489
490
  if (t) {
490
- let e = n.indexOf(_t), t = e === -1 ? n.length : e;
491
- n.splice(t, 0, ht, gt);
491
+ let e = n.indexOf(ht), t = e === -1 ? n.length : e;
492
+ n.splice(t, 0, pt, mt);
492
493
  }
493
494
  e.updateState(e.state.reconfigure({ plugins: n }));
494
495
  }
495
- d(() => vt(), () => {
496
- let e = P.value;
496
+ d(() => gt(), () => {
497
+ let e = I.value;
497
498
  e && It(e);
498
499
  });
499
500
  function Lt() {
500
501
  $.ensureView();
501
502
  }
502
503
  function Rt() {
503
- Dt(), A += 1, $e.value = k.value?.originalBuffer ?? null, U.value = !1, et.value = null, R.value = null, J.activate(null), Z.dispose(), $.destroyView(), $.ensureView(), Y(), $.ensureView(), $.getView() || zt();
504
+ Dt(), M += 1, Ze.value = j.value?.originalBuffer ?? null, G.value = !1, z.value = null, B.value = null, X.activate(null), wt.dispose(), $.destroyView(), $.ensureView(), xt(), $.ensureView(), $.getView() || zt();
504
505
  }
505
506
  function zt() {
506
- let e = k.value;
507
+ let e = j.value;
507
508
  if (e) try {
508
509
  let t = h({
509
510
  document: e,
510
511
  styles: y(e).package.styles ?? null,
511
- manager: W,
512
- externalPlugins: yt(),
512
+ manager: K,
513
+ externalPlugins: _t(),
513
514
  reason: "mount"
514
515
  });
515
- F.value = t;
516
- let n = A, r = ++M;
517
- N = !0;
516
+ L.value = t;
517
+ let n = M, r = ++P;
518
+ F = !0;
518
519
  let i = () => {
519
- M === r && (N = !1, j || A !== n || k.value !== e || $.getView() || X(t, { reason: "initial" }));
520
+ P === r && (F = !1, N || M !== n || j.value !== e || $.getView() || Z(t, { reason: "initial" }));
520
521
  };
521
- w(e, t.doc).then(i, i);
522
+ E(e, t.doc).then(i, i);
522
523
  } catch (e) {
523
- D?.(e instanceof Error ? e : Error(String(e)));
524
+ k?.(e instanceof Error ? e : Error(String(e)));
524
525
  }
525
526
  }
526
527
  d([
527
528
  t,
528
529
  a,
529
- Xe,
530
+ Je,
530
531
  ...r ? [r] : []
531
532
  ], () => {
532
- t.value && k.value && !$.getView() && Lt(), Y();
533
+ t.value && j.value && !$.getView() && Lt(), xt();
533
534
  }, { flush: "post" });
534
535
  let Bt = 0;
535
536
  async function Vt(e) {
536
- Bt += 1, H.value = null, V.value = !1;
537
+ Bt += 1, W.value = null, U.value = !1;
537
538
  try {
538
- let t = await ge(e, { password: u(ve) });
539
+ let t = await ge(e, { password: u(x) });
539
540
  if (t.isErr()) throw t.error;
540
541
  let n = t.value.document;
541
- k.value = n, Rt();
542
+ j.value = n, Rt();
542
543
  } catch (e) {
543
544
  let t = e instanceof Error ? e : Error(String(e));
544
- H.value = t.message, D?.(t);
545
+ W.value = t.message, k?.(t);
545
546
  }
546
547
  }
547
548
  function Ht(e) {
548
549
  let t = Bt += 1;
549
- H.value = null;
550
- let n = tt(e);
550
+ W.value = null;
551
+ let n = et(e);
551
552
  he(n) ? Wt(n) : Ut(n, t);
552
553
  }
553
554
  async function Ut(e, t) {
554
555
  let n = await _e(e);
555
- t === Bt && (n.isErr() ? (H.value = n.error.message, D?.(n.error)) : Wt(n.value));
556
+ t === Bt && (n.isErr() ? (W.value = n.error.message, k?.(n.error)) : Wt(n.value));
556
557
  }
557
558
  function Wt(e) {
558
- k.value = e, Rt();
559
+ j.value = e, Rt();
559
560
  }
560
561
  async function Gt(e) {
561
- let t = P.value, n = k.value;
562
+ let t = I.value, n = j.value;
562
563
  if (!t || !n) return null;
563
564
  try {
564
565
  let t = $.api.captureCanonicalSave();
565
566
  if (t) {
566
- let n = u(Je), { canonicalSaveDiagnosticError: r, serializeCanonicalSave: i } = await import("@stll/folio-core/docx/canonicalSave"), a = await i({
567
+ let n = u(Ke), { canonicalSaveDiagnosticError: r, serializeCanonicalSave: i } = await import("@stll/folio-core/docx/canonicalSave"), a = await i({
567
568
  snapshot: t,
568
569
  options: e,
569
570
  featureFlags: n
570
571
  });
571
- for (let t of a.diagnostics) e?.onDiagnostic || D?.(r(t));
572
+ for (let t of a.diagnostics) e?.onDiagnostic || k?.(r(t));
572
573
  return a;
573
574
  }
574
575
  return null;
575
576
  } catch (e) {
576
- return D?.(e instanceof Error ? e : Error(String(e))), null;
577
+ return k?.(e instanceof Error ? e : Error(String(e))), null;
577
578
  }
578
579
  }
579
580
  async function Kt(e) {
580
- let t = P.value, n = t?.state, r = await Gt({
581
+ let t = I.value, n = t?.state, r = await Gt({
581
582
  onDiagnostic: e?.onDiagnostic,
582
583
  onSelectiveDecline: e?.onSelectiveDecline,
583
584
  onSerializationPath: e?.onSerializationPath,
584
- mode: e?.selective === !1 ? x.full : x.preferSelective
585
+ mode: e?.selective === !1 ? C.full : C.preferSelective
585
586
  });
586
- return r ? (P.value === t && t?.state.doc === n?.doc && (r.version === void 0 || $.api.isCanonicalSaveCurrent(r.version)) && (r.version !== void 0 && $.api.markCanonicalSaved(r.version, {
587
+ return r ? (I.value === t && t?.state.doc === n?.doc && (r.version === void 0 || $.api.isCanonicalSaveCurrent(r.version)) && (r.version !== void 0 && $.api.markCanonicalSaved(r.version, {
587
588
  buffer: r.buffer,
588
589
  path: r.path
589
- }), k.value = r.document, Y(), U.value = !1), r.tripwireResult && Ye?.(r.tripwireResult), new Blob([r.buffer], { type: "application/vnd.openxmlformats-officedocument.wordprocessingml.document" })) : null;
590
+ }), j.value = r.document, xt(), G.value = !1), r.tripwireResult && qe?.(r.tripwireResult), new Blob([r.buffer], { type: "application/vnd.openxmlformats-officedocument.wordprocessingml.document" })) : null;
590
591
  }
591
592
  function qt() {
592
593
  return $.readCanonicalDocument();
@@ -596,38 +597,38 @@ function H(e) {
596
597
  }
597
598
  function Yt() {
598
599
  let e = Jt();
599
- return e && pt(e);
600
+ return e && dt(e);
600
601
  }
601
602
  function Xt(e) {
602
603
  Ht(e);
603
604
  }
604
605
  function Zt(e) {
605
- return St.getView(e);
606
+ return bt.getView(e);
606
607
  }
607
608
  function Qt() {
608
- Y();
609
+ xt();
609
610
  }
610
611
  function $t(e) {
611
- let t = J.activate(e);
612
- t && (R.value = e, requestAnimationFrame(() => t.focus()));
612
+ let t = X.activate(e);
613
+ t && (B.value = e, requestAnimationFrame(() => t.focus()));
613
614
  }
614
615
  function en() {
615
- J.activate(null), R.value = null;
616
+ X.activate(null), B.value = null;
616
617
  }
617
618
  function tn() {
618
- let e = R.value;
619
- return e ? J.getView(e) : null;
619
+ let e = B.value;
620
+ return e ? X.getView(e) : null;
620
621
  }
621
622
  function nn() {
622
- return W.getCommands();
623
+ return K.getCommands();
623
624
  }
624
625
  function rn() {
625
626
  let e = tn();
626
- e ? e.focus() : P.value?.focus();
627
+ e ? e.focus() : I.value?.focus();
627
628
  }
628
629
  function an() {
629
- let e = P.value;
630
- e && X(e.state, { reason: "manual" });
630
+ let e = I.value;
631
+ e && Z(e.state, { reason: "manual" });
631
632
  }
632
633
  d([
633
634
  () => u(v),
@@ -638,31 +639,31 @@ function H(e) {
638
639
  () => u(_)
639
640
  ], () => an());
640
641
  function on() {
641
- j = !0, a.value && Te(a.value), M += 1, N = !1, Z.dispose(), Q !== null && (window.clearTimeout(Q), Q = null), Dt(), $.destroyView(), L.value = [], St.destroy(), J.destroy(), W.destroy(), F.value = null, z.value = null, k.value = null, $e.value = null, V.value = !1;
642
+ N = !0, a.value && Te(a.value), P += 1, F = !1, wt.dispose(), Q !== null && (window.clearTimeout(Q), Q = null), Dt(), $.destroyView(), R.value = [], bt.destroy(), X.destroy(), K.destroy(), L.value = null, V.value = null, j.value = null, Ze.value = null, U.value = !1;
642
643
  }
643
644
  return i(() => {
644
645
  on(), At();
645
646
  }), {
646
647
  setEmbeddedFontFamilies: (e) => {
647
- e ? q.embeddedFontFamilyMap = new Map(e) : delete q.embeddedFontFamilyMap, $.refreshFonts();
648
+ e ? Y.embeddedFontFamilyMap = new Map(e) : delete Y.embeddedFontFamilyMap, $.refreshFonts();
648
649
  },
649
650
  editor: Ft,
650
- editorView: P,
651
- editorState: F,
652
- remoteSelections: L,
653
- headerFooterSelection: et,
654
- activeNoteStory: R,
655
- isReady: V,
656
- isDirty: U,
657
- parseError: H,
658
- modelDocument: k,
651
+ editorView: I,
652
+ editorState: L,
653
+ remoteSelections: R,
654
+ headerFooterSelection: z,
655
+ activeNoteStory: B,
656
+ isReady: U,
657
+ isDirty: G,
658
+ parseError: W,
659
+ modelDocument: j,
659
660
  readDocumentModel: qt,
660
- sourceBuffer: $e,
661
- hiddenEditorWidth: B,
662
- layout: z,
663
- blocks: nt,
664
- measures: rt,
665
- syncCoordinator: K,
661
+ sourceBuffer: Ze,
662
+ hiddenEditorWidth: $e,
663
+ layout: V,
664
+ blocks: H,
665
+ measures: tt,
666
+ syncCoordinator: J,
666
667
  loadBuffer: Vt,
667
668
  loadDocument: Ht,
668
669
  save: Kt,
@@ -681,15 +682,15 @@ function H(e) {
681
682
  };
682
683
  }
683
684
  // src/composables/useFindReplace.ts
684
- function U({ editorView: t, pagesRef: n, getDocument: r, layout: a, commentRoot: l, revealComment: u, displayMode: f, readOnly: p, onReadonlyEditAttempt: m, onResultChange: h }) {
685
- let g = new Fe(), _ = s(""), te = s(""), ne = o(Ve()), v = c([]), y = s(-1), b = e(() => v.value.at(y.value) ?? null), re = () => ee({
685
+ function dt({ editorView: t, pagesRef: n, getDocument: r, layout: a, commentRoot: l, revealComment: u, displayMode: f, readOnly: p, onReadonlyEditAttempt: m, onResultChange: h }) {
686
+ let g = new Ne(), _ = s(""), te = s(""), ne = o(ze()), v = c([]), y = s(-1), b = e(() => v.value.at(y.value) ?? null), x = () => ee({
686
687
  editingMode: t.value?.editable === !1 ? "viewing" : "editing",
687
688
  readOnlyProp: p.value,
688
689
  displayMode: f.value
689
- }), ie = e(re), ae = e(() => {
690
+ }), re = e(x), ie = e(() => {
690
691
  let e = b.value;
691
- return re() === null && !!t.value && !!e && w() && He(e).status === "allowed";
692
- }), x = null, S, C = null, oe = (e) => {
692
+ return x() === null && !!t.value && !!e && ae() && Be(e).status === "allowed";
693
+ }), S = null, C, w = null, T = (e) => {
693
694
  let n = t.value?.state.doc;
694
695
  return {
695
696
  query: _.value,
@@ -700,54 +701,54 @@ function U({ editorView: t, pagesRef: n, getDocument: r, layout: a, commentRoot:
700
701
  },
701
702
  document: e,
702
703
  ...n ? { bodyVersion: n } : {},
703
- context: { renderedStories: Be(a.value) }
704
+ context: { renderedStories: Re(a.value) }
704
705
  };
705
- }, w = () => {
706
+ }, ae = () => {
706
707
  let e = r();
707
- return !!e && Ue(C, D(oe(e)));
708
- }, se = () => g.getResult(), T = () => h(se()), ce = () => {
709
- clearTimeout(S), S = void 0;
708
+ return !!e && Ve(w, k(T(e)));
709
+ }, oe = () => g.getResult(), E = () => h(oe()), se = () => {
710
+ clearTimeout(C), C = void 0;
711
+ }, ce = () => {
712
+ se(), g.clear(), S?.destroy(), S = null, v.value = [], w = null, y.value = -1;
710
713
  }, le = () => {
711
- ce(), g.clear(), x?.destroy(), x = null, v.value = [], C = null, y.value = -1;
712
- }, ue = () => {
713
- le(), _.value = "", T();
714
- }, de = (e) => (y.value = e, x?.navigate(e, u), T(), !0), E = (e = "query") => {
715
- ce();
714
+ ce(), _.value = "", E();
715
+ }, ue = (e) => (y.value = e, S?.navigate(e, u), E(), !0), D = (e = "query") => {
716
+ se();
716
717
  let i = r(), o = n.value, s = t.value?.state.doc;
717
- if (!i || !_.value.trim()) return ue(), [];
718
- let c = oe(i), u = Ie({
718
+ if (!i || !_.value.trim()) return le(), [];
719
+ let c = T(i), u = Pe({
719
720
  document: c.document,
720
721
  state: t.value?.state ?? null,
721
722
  searchText: c.query,
722
723
  options: c.options,
723
724
  context: c.context
724
725
  });
725
- if (u === null) return le(), T(), [];
726
- let d = D(c), f = e === "refresh" && C?.query === d.query, p = g.setMatches(u, f ? g.getResult()?.currentIndex ?? 0 : 0);
727
- return C = d, v.value = u, y.value = u.length > 0 ? p.currentIndex : -1, x?.destroy(), x = o ? ze({
726
+ if (u === null) return ce(), E(), [];
727
+ let d = k(c), f = e === "refresh" && w?.query === d.query, p = g.setMatches(u, f ? g.getResult()?.currentIndex ?? 0 : 0);
728
+ return w = d, v.value = u, y.value = u.length > 0 ? p.currentIndex : -1, S?.destroy(), S = o ? Le({
728
729
  container: o,
729
730
  document: i,
730
731
  bodyDoc: s,
731
732
  matches: u,
732
733
  commentRoot: l?.value ?? void 0,
733
734
  layout: a.value
734
- }) : null, x?.paint(y.value), u.at(0) && !f ? de(0) : T(), u;
735
- }, fe = () => {
736
- ce(), S = setTimeout(() => E("refresh"), 120);
737
- }, pe = (e, t) => (_.value = e, Object.assign(ne, Ve(), t), E(), se()), me = (e) => {
735
+ }) : null, S?.paint(y.value), u.at(0) && !f ? ue(0) : E(), u;
736
+ }, de = () => {
737
+ se(), C = setTimeout(() => D("refresh"), 120);
738
+ }, fe = (e, t) => (_.value = e, Object.assign(ne, ze(), t), D(), oe()), pe = (e) => {
738
739
  let t = g.goTo(e);
739
- return t ? de(t.index) : !1;
740
- }, he = (e) => {
740
+ return t ? ue(t.index) : !1;
741
+ }, me = (e) => {
741
742
  let t = g.navigate(e);
742
- return t ? (de(t.index), t.match) : null;
743
- }, ge = () => !w() && (E("refresh"), !0), _e = () => {
744
- let e = re();
743
+ return t ? (ue(t.index), t.match) : null;
744
+ }, O = () => !ae() && (D("refresh"), !0), he = () => {
745
+ let e = x();
745
746
  return e !== null && (m?.(e), !0);
746
747
  };
747
748
  return d(f, () => {
748
- _.value.trim() && E();
749
+ _.value.trim() && D();
749
750
  }), i(() => {
750
- ce(), x?.destroy();
751
+ se(), S?.destroy();
751
752
  }), {
752
753
  searchText: _,
753
754
  replaceText: te,
@@ -755,36 +756,36 @@ function U({ editorView: t, pagesRef: n, getDocument: r, layout: a, commentRoot:
755
756
  matches: v,
756
757
  currentIndex: y,
757
758
  currentMatch: b,
758
- canReplaceCurrent: ae,
759
- replacementRefusal: ie,
760
- performSearch: E,
761
- scheduleSearch: fe,
762
- find: pe,
763
- getFindResult: se,
764
- goToMatch: me,
765
- findNext: () => he("next"),
766
- findPrevious: () => he("previous"),
759
+ canReplaceCurrent: ie,
760
+ replacementRefusal: re,
761
+ performSearch: D,
762
+ scheduleSearch: de,
763
+ find: fe,
764
+ getFindResult: oe,
765
+ goToMatch: pe,
766
+ findNext: () => me("next"),
767
+ findPrevious: () => me("previous"),
767
768
  replaceCurrent: () => {
768
769
  let e = t.value;
769
- if (!e || _e() || ge()) return !1;
770
+ if (!e || he() || O()) return !1;
770
771
  let n = b.value;
771
- if (!ae.value || !n) return !1;
772
- let r = e.state.doc, i = Le(e, n, te.value);
773
- return e.state.doc !== r && E("refresh"), i;
772
+ if (!ie.value || !n) return !1;
773
+ let r = e.state.doc, i = Fe(e, n, te.value);
774
+ return e.state.doc !== r && D("refresh"), i;
774
775
  },
775
776
  replaceAll: () => {
776
777
  let e = t.value, n = v.value.length;
777
- if (!e || _e() || ge()) return {
778
+ if (!e || he() || O()) return {
778
779
  replacedCount: 0,
779
780
  skippedCount: n
780
781
  };
781
- let r = e.state.doc, i = Re(e, v.value, te.value);
782
- return e.state.doc !== r && E(), i;
782
+ let r = e.state.doc, i = Ie(e, v.value, te.value);
783
+ return e.state.doc !== r && D(), i;
783
784
  },
784
- clear: ue
785
+ clear: le
785
786
  };
786
787
  }
787
- function pt(e, t) {
788
+ function ft(e, t) {
788
789
  if (t < e.top + 40) {
789
790
  let n = Math.max(0, e.top + 40 - t);
790
791
  return -Math.min(12, n / 40 * 12);
@@ -796,7 +797,7 @@ function pt(e, t) {
796
797
  return 0;
797
798
  }
798
799
  // src/composables/useDragAutoScroll.ts
799
- function mt({ pagesContainer: e, onScrollExtendSelection: t }) {
800
+ function K({ pagesContainer: e, onScrollExtendSelection: t }) {
800
801
  let n = null, r = 0, a = 0, o = !1;
801
802
  function s() {
802
803
  return g(e.value);
@@ -808,7 +809,7 @@ function mt({ pagesContainer: e, onScrollExtendSelection: t }) {
808
809
  if (!o) return;
809
810
  let e = s();
810
811
  if (!e) return;
811
- let i = pt(e.getBoundingClientRect(), a);
812
+ let i = ft(e.getBoundingClientRect(), a);
812
813
  i !== 0 && (_(e, i), t(r, a)), n = requestAnimationFrame(l);
813
814
  }
814
815
  function u() {
@@ -828,7 +829,7 @@ function mt({ pagesContainer: e, onScrollExtendSelection: t }) {
828
829
  };
829
830
  }
830
831
  // src/composables/useTableResize.ts
831
- function W({ runCommand: e }) {
832
+ function pt({ runCommand: e }) {
832
833
  let t = {
833
834
  active: !1,
834
835
  startX: 0,
@@ -847,7 +848,7 @@ function W({ runCommand: e }) {
847
848
  isEdge: !1,
848
849
  tablePmStart: 0,
849
850
  origHeight: 0,
850
- minimumHeight: Ge
851
+ minimumHeight: Ue
851
852
  }, r = {
852
853
  active: !1,
853
854
  startX: 0,
@@ -861,15 +862,15 @@ function W({ runCommand: e }) {
861
862
  }
862
863
  function o(e, a) {
863
864
  let o = e.target;
864
- return o instanceof HTMLElement ? o.classList.contains("layout-table-resize-handle") ? (e.preventDefault(), e.stopPropagation(), i = a, t.active = !0, t.startX = e.clientX, t.handle = o, o.classList.add("dragging"), t.columnIndex = parseInt(o.dataset.columnIndex ?? "0", 10), t.tablePmStart = b(o) ?? 0, ht(a, t), !0) : o.classList.contains("layout-table-row-resize-handle") || o.classList.contains("layout-table-edge-handle-bottom") ? (e.preventDefault(), e.stopPropagation(), i = a, n.active = !0, n.startY = e.clientY, n.handle = o, n.isEdge = o.dataset.isEdge === "bottom", o.classList.add("dragging"), n.rowIndex = parseInt(o.dataset.rowIndex ?? "0", 10), n.tablePmStart = b(o) ?? 0, gt(a, n, o), !0) : o.classList.contains("layout-table-edge-handle-right") ? (e.preventDefault(), e.stopPropagation(), i = a, r.active = !0, r.startX = e.clientX, r.handle = o, o.classList.add("dragging"), r.columnIndex = parseInt(o.dataset.columnIndex ?? "0", 10), r.tablePmStart = b(o) ?? 0, _t(a, r), !0) : !1 : !1;
865
+ return o instanceof HTMLElement ? o.classList.contains("layout-table-resize-handle") ? (e.preventDefault(), e.stopPropagation(), i = a, t.active = !0, t.startX = e.clientX, t.handle = o, o.classList.add("dragging"), t.columnIndex = parseInt(o.dataset.columnIndex ?? "0", 10), t.tablePmStart = b(o) ?? 0, mt(a, t), !0) : o.classList.contains("layout-table-row-resize-handle") || o.classList.contains("layout-table-edge-handle-bottom") ? (e.preventDefault(), e.stopPropagation(), i = a, n.active = !0, n.startY = e.clientY, n.handle = o, n.isEdge = o.dataset.isEdge === "bottom", o.classList.add("dragging"), n.rowIndex = parseInt(o.dataset.rowIndex ?? "0", 10), n.tablePmStart = b(o) ?? 0, ht(a, n, o), !0) : o.classList.contains("layout-table-edge-handle-right") ? (e.preventDefault(), e.stopPropagation(), i = a, r.active = !0, r.startX = e.clientX, r.handle = o, o.classList.add("dragging"), r.columnIndex = parseInt(o.dataset.columnIndex ?? "0", 10), r.tablePmStart = b(o) ?? 0, gt(a, r), !0) : !1 : !1;
865
866
  }
866
867
  function s(e) {
867
868
  if (t.active && t.handle) {
868
869
  e.preventDefault();
869
870
  let n = e.clientX - t.startX, r = parseFloat(t.handle.style.left);
870
871
  t.handle.style.left = `${r + n}px`, t.startX = e.clientX;
871
- let i = Math.round(n * O), a = t.origWidths.left + i, o = t.origWidths.right - i;
872
- a >= We && o >= We && (t.origWidths = {
872
+ let i = Math.round(n * A), a = t.origWidths.left + i, o = t.origWidths.right - i;
873
+ a >= He && o >= He && (t.origWidths = {
873
874
  left: a,
874
875
  right: o
875
876
  });
@@ -877,31 +878,31 @@ function W({ runCommand: e }) {
877
878
  e.preventDefault();
878
879
  let t = e.clientY - n.startY, r = parseFloat(n.handle.style.top);
879
880
  n.startY = e.clientY;
880
- let i = Math.round(t * O), a = Ke({
881
+ let i = Math.round(t * A), a = We({
881
882
  currentHeight: n.origHeight,
882
883
  delta: i,
883
884
  minimumHeight: n.minimumHeight
884
885
  });
885
- n.handle.style.top = `${r + a / O}px`, n.origHeight += a;
886
+ n.handle.style.top = `${r + a / A}px`, n.origHeight += a;
886
887
  } else if (r.active && r.handle) {
887
888
  e.preventDefault();
888
889
  let t = e.clientX - r.startX, n = parseFloat(r.handle.style.left);
889
890
  r.handle.style.left = `${n + t}px`, r.startX = e.clientX;
890
- let i = Math.round(t * O), a = r.origWidth + i;
891
- a >= We && (r.origWidth = a);
891
+ let i = Math.round(t * A), a = r.origWidth + i;
892
+ a >= He && (r.origWidth = a);
892
893
  }
893
894
  }
894
895
  function c(a) {
895
- t.active ? (t.active = !1, t.handle?.classList.remove("dragging"), i && e(i, qe({
896
+ t.active ? (t.active = !1, t.handle?.classList.remove("dragging"), i && e(i, Ge({
896
897
  pmStart: t.tablePmStart,
897
898
  colIdx: t.columnIndex,
898
899
  newLeft: t.origWidths.left,
899
900
  newRight: t.origWidths.right
900
- })), t.handle = null) : n.active ? (n.active = !1, n.handle?.classList.remove("dragging"), i && e(i, k({
901
+ })), t.handle = null) : n.active ? (n.active = !1, n.handle?.classList.remove("dragging"), i && e(i, j({
901
902
  pmStart: n.tablePmStart,
902
903
  rowIdx: n.rowIndex,
903
904
  newHeight: n.origHeight
904
- })), n.handle = null) : r.active && (r.active = !1, r.handle?.classList.remove("dragging"), i && e(i, Ze({
905
+ })), n.handle = null) : r.active && (r.active = !1, r.handle?.classList.remove("dragging"), i && e(i, Ye({
905
906
  pmStart: r.tablePmStart,
906
907
  colIdx: r.columnIndex,
907
908
  newWidth: r.origWidth
@@ -918,50 +919,52 @@ function W({ runCommand: e }) {
918
919
  isResizing: a
919
920
  };
920
921
  }
921
- function ht(e, t) {
922
- let n = Ye(e, t.tablePmStart, t.columnIndex);
922
+ function mt(e, t) {
923
+ let n = qe(e, t.tablePmStart, t.columnIndex);
923
924
  n && (t.origWidths = n);
924
925
  }
925
- function gt(e, t, n) {
926
- let r = Xe(e, t.tablePmStart, t.rowIndex);
926
+ function ht(e, t, n) {
927
+ let r = Je(e, t.tablePmStart, t.rowIndex);
927
928
  if (r != null) t.origHeight = r;
928
929
  else {
929
930
  let e = n.closest(".layout-table")?.querySelector(`[data-row-index="${t.rowIndex}"]`), r = e ? e.getBoundingClientRect().height : 30;
930
- t.origHeight = Math.round(r * O);
931
+ t.origHeight = Math.round(r * A);
931
932
  }
932
- t.minimumHeight = Math.min(Ge, t.origHeight);
933
+ t.minimumHeight = Math.min(Ue, t.origHeight);
933
934
  }
934
- function _t(e, t) {
935
- let n = Je(e, t.tablePmStart, t.columnIndex);
935
+ function gt(e, t) {
936
+ let n = Ke(e, t.tablePmStart, t.columnIndex);
936
937
  n != null && (t.origWidth = n);
937
938
  }
938
939
  // src/composables/useTrackedChanges.ts
939
- function vt(t, n) {
940
+ function _t(t, n, r) {
940
941
  return e(() => {
941
942
  n.value;
942
- let e = t.value?.state ?? null, r = Qe(e);
943
- if (e === null) return r;
944
- let i = {
945
- accept: Ne(e, "accept"),
946
- reject: Ne(e, "reject")
947
- };
948
- if (i.accept.size === 0 && i.reject.size === 0) return r;
949
- let a = r.entries;
950
- for (let e of a) {
951
- let t = Pe(e);
943
+ let e = t.value?.state ?? null, i = Ze(e);
944
+ if (e === null || !r) return i;
945
+ let a = x({
946
+ editor: r,
947
+ state: e,
948
+ story: w.MAIN,
949
+ target: {
950
+ type: "revisions",
951
+ ids: i.entries.flatMap(Xe)
952
+ }
953
+ });
954
+ if (a.accept.size === 0 && a.reject.size === 0) return i;
955
+ let o = i.entries;
956
+ for (let e of o) {
957
+ let t = Xe(e);
952
958
  e.heldByLock = {
953
- accept: t.some((e) => i.accept.has(e)),
954
- reject: t.some((e) => i.reject.has(e))
959
+ accept: t.some((e) => a.accept.has(e)),
960
+ reject: t.some((e) => a.reject.has(e))
955
961
  };
956
962
  }
957
- return {
958
- ...r,
959
- entries: a
960
- };
963
+ return i;
961
964
  });
962
965
  }
963
966
  // src/composables/useZoom.ts
964
- var yt = A, G = $e, K = [
967
+ var q = N, J = M, Y = [
965
968
  .5,
966
969
  .75,
967
970
  1,
@@ -969,16 +972,16 @@ var yt = A, G = $e, K = [
969
972
  1.5,
970
973
  2
971
974
  ];
972
- function q(t = 1) {
973
- let i = s(Math.max(yt, Math.min(G, t))), a = e(() => Math.round(i.value * 100)), o = e(() => i.value <= yt), c = e(() => i.value >= G);
975
+ function vt(t = 1) {
976
+ let i = s(Math.max(q, Math.min(J, t))), a = e(() => Math.round(i.value * 100)), o = e(() => i.value <= q), c = e(() => i.value >= J);
974
977
  function l(e) {
975
- i.value = Math.max(yt, Math.min(G, Math.round(e * 100) / 100));
978
+ i.value = Math.max(q, Math.min(J, Math.round(e * 100) / 100));
976
979
  }
977
980
  function u() {
978
- l(i.value + j);
981
+ l(i.value + P);
979
982
  }
980
983
  function d() {
981
- l(i.value - j);
984
+ l(i.value - P);
982
985
  }
983
986
  function f() {
984
987
  l(1);
@@ -1004,7 +1007,7 @@ function q(t = 1) {
1004
1007
  handleWheel: p,
1005
1008
  handleKeyDown: m,
1006
1009
  installShortcuts: h,
1007
- ZOOM_PRESETS: K
1010
+ ZOOM_PRESETS: Y
1008
1011
  };
1009
1012
  }
1010
- export { mt as a, R as c, z as d, W as i, I as l, Qe as n, U as o, vt as r, H as s, q as t, et as u };
1013
+ export { K as a, V as c, $e as d, pt as i, R as l, Ze as n, dt as o, _t as r, G as s, vt as t, B as u };