@stll/folio-vue 0.29.0 → 0.30.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -37,29 +37,30 @@ import { ExtensionManager as ze } from "@stll/folio-core/prosemirror/extensions/
37
37
  import { getChangedParagraphIds as Be, hasStructuralChanges as Ve, hasUntrackedChanges as He, repackWithEditorSectionRemovals as Ue } from "@stll/folio-core/prosemirror/extensions/features/ParagraphChangeTrackerExtension";
38
38
  import { createStarterKit as We } from "@stll/folio-core/prosemirror/extensions/StarterKit";
39
39
  import { createNoteReferenceFollower as Ge, heldUnreferencedNotes as Ke, withoutUnreferencedNotes as qe } from "@stll/folio-core/prosemirror/noteReferenceReview";
40
- import { createTemplateDirectivesPlugin as Je } from "@stll/folio-core/prosemirror/plugins/templateDirectives";
41
- import { createTemplatePreviewValuesPlugin as Ye } from "@stll/folio-core/prosemirror/plugins/templatePreviewValues";
42
- import { templateSlashMenuPlugin as Xe } from "@stll/folio-core/prosemirror/plugins/templateSlashMenu";
43
- import { resolveHeaderFooterContent as Ze } from "@stll/folio-core/utils/headerFooter";
44
- import { FindReplaceManager as Qe } from "@stll/folio-core/managers/FindReplaceManager";
45
- import { findInDisplayedDocument as $e } from "@stll/folio-core/prosemirror/findReplaceSelection";
46
- import { replaceFindMatch as et, replaceFindMatches as tt } from "@stll/folio-core/prosemirror/replaceFindMatches";
47
- import { createFindMatchView as nt, getRenderedSearchStories as rt } from "@stll/folio-core/utils/findMatchView";
48
- import { createDefaultFindOptions as it, replaceEligibility as at } from "@stll/folio-core/utils/findReplace";
49
- import { createFindSearchKey as ot, sameFindSearchKey as k } from "@stll/folio-core/utils/findSearchKey";
50
- import { MIN_CELL_WIDTH_TWIPS as st, MIN_ROW_HEIGHT_TWIPS as ct, TWIPS_PER_PIXEL as lt, clampRowResizeDelta as ut, columnResizeCommand as dt, readColumnWidthAt as ft, readColumnWidths as pt, readRowHeight as mt, rightEdgeResizeCommand as ht, rowResizeCommand as gt } from "@stll/folio-core/prosemirror/tableResize";
40
+ import { createDerivedFieldsPlugin as Je } from "@stll/folio-core/prosemirror/plugins/derivedFields";
41
+ import { createTemplateDirectivesPlugin as Ye } from "@stll/folio-core/prosemirror/plugins/templateDirectives";
42
+ import { createTemplatePreviewValuesPlugin as Xe } from "@stll/folio-core/prosemirror/plugins/templatePreviewValues";
43
+ import { templateSlashMenuPlugin as Ze } from "@stll/folio-core/prosemirror/plugins/templateSlashMenu";
44
+ import { resolveHeaderFooterContent as Qe } from "@stll/folio-core/utils/headerFooter";
45
+ import { FindReplaceManager as $e } from "@stll/folio-core/managers/FindReplaceManager";
46
+ import { findInDisplayedDocument as et } from "@stll/folio-core/prosemirror/findReplaceSelection";
47
+ import { replaceFindMatch as tt, replaceFindMatches as nt } from "@stll/folio-core/prosemirror/replaceFindMatches";
48
+ import { createFindMatchView as rt, getRenderedSearchStories as it } from "@stll/folio-core/utils/findMatchView";
49
+ import { createDefaultFindOptions as at, replaceEligibility as ot } from "@stll/folio-core/utils/findReplace";
50
+ import { createFindSearchKey as st, sameFindSearchKey as ct } from "@stll/folio-core/utils/findSearchKey";
51
+ import { MIN_CELL_WIDTH_TWIPS as k, MIN_ROW_HEIGHT_TWIPS as lt, TWIPS_PER_PIXEL as A, clampRowResizeDelta as ut, columnResizeCommand as dt, readColumnWidthAt as ft, readColumnWidths as pt, readRowHeight as mt, rightEdgeResizeCommand as ht, rowResizeCommand as gt } from "@stll/folio-core/prosemirror/tableResize";
51
52
  import { extractTrackedChanges as _t } from "@stll/folio-core/prosemirror/utils/extractTrackedChanges";
52
- import { ZOOM_MAX as A, ZOOM_MIN as vt, ZOOM_STEP as yt } from "@stll/folio-core/utils/zoom";
53
+ import { ZOOM_MAX as vt, ZOOM_MIN as j, ZOOM_STEP as yt } from "@stll/folio-core/utils/zoom";
53
54
  // src/utils/colorMode.ts
54
55
  var bt = "(prefers-color-scheme: dark)";
55
- function j() {
56
+ function xt() {
56
57
  return typeof window < "u" && typeof window.matchMedia == "function";
57
58
  }
58
- function xt(e, t) {
59
+ function M(e, t) {
59
60
  return e === "dark" || e === "system" && t;
60
61
  }
61
- function M(e) {
62
- if (!j()) return () => {};
62
+ function St(e) {
63
+ if (!xt()) return () => {};
63
64
  let t = window.matchMedia(bt);
64
65
  e(t.matches);
65
66
  let n = (t) => e(t.matches);
@@ -76,20 +77,20 @@ function L() {
76
77
  return r(() => {
77
78
  i.value = !0;
78
79
  }), f((e) => {
79
- i.value && n.value === "system" && e(M((e) => {
80
+ i.value && n.value === "system" && e(St((e) => {
80
81
  a.value = e;
81
82
  }));
82
- }), e(() => xt(n.value, i.value && a.value));
83
+ }), e(() => M(n.value, i.value && a.value));
83
84
  }
84
85
  // src/utils/rawDocument.ts
85
- var St = (e) => R(e, /* @__PURE__ */ new Map()), R = (e, t) => {
86
+ var Ct = (e) => R(e, /* @__PURE__ */ new Map()), R = (e, t) => {
86
87
  if (typeof e != "object" || !e) return e;
87
88
  let n = l(e), r = t.get(n);
88
89
  if (r !== void 0) return r;
89
90
  t.set(n, n);
90
- let i = z(n, t);
91
+ let i = wt(n, t);
91
92
  return t.set(n, i), i;
92
- }, z = (e, t) => {
93
+ }, wt = (e, t) => {
93
94
  if (ArrayBuffer.isView(e) || e instanceof ArrayBuffer) return e;
94
95
  if (e instanceof Map) {
95
96
  let n = !1, r = [];
@@ -117,15 +118,15 @@ var St = (e) => R(e, /* @__PURE__ */ new Map()), R = (e, t) => {
117
118
  let n = Object.getOwnPropertyDescriptors(e), r = !1;
118
119
  for (let e of Reflect.ownKeys(n)) {
119
120
  let i = Reflect.get(n, e);
120
- if (!Ct(i)) continue;
121
+ if (!z(i)) continue;
121
122
  let a = R(i.value, t);
122
123
  a !== i.value && (r = !0, i.value = a);
123
124
  }
124
125
  if (!r) return e;
125
126
  let i = Object.create(Reflect.getPrototypeOf(e), n);
126
127
  return _(i, e), i;
127
- }, Ct = (e) => typeof e == "object" && !!e && "value" in e, wt = 24, Tt = "User", Et = [], Dt = [];
128
- function Ot(e) {
128
+ }, z = (e) => typeof e == "object" && !!e && "value" in e, Tt = 24, Et = "User", Dt = [], Ot = [];
129
+ function kt(e) {
129
130
  let t = e?.columnCount ?? 1;
130
131
  if (t <= 1) return;
131
132
  let n = {
@@ -135,7 +136,7 @@ function Ot(e) {
135
136
  };
136
137
  return e?.separator !== void 0 && (n.separator = e.separator), n;
137
138
  }
138
- function kt(e, t, n, r, i, a) {
139
+ function At(e, t, n, r, i, a) {
139
140
  if (!e) return;
140
141
  let o = t ? {
141
142
  ...a,
@@ -143,16 +144,16 @@ function kt(e, t, n, r, i, a) {
143
144
  } : a, s = t ? n?.getView(t) : null;
144
145
  return s ? Me(s.state.doc, r, i, o) : Ne(e, r, i, o);
145
146
  }
146
- function At(e, t, n, r, i) {
147
+ function jt(e, t, n, r, i) {
147
148
  if (!e || e.size === 0) return;
148
149
  let a = /* @__PURE__ */ new Map();
149
150
  for (let [o, s] of e) {
150
- let e = kt(s, o, t, n, r, i);
151
+ let e = At(s, o, t, n, r, i);
151
152
  e && a.set(o, e);
152
153
  }
153
154
  return a.size > 0 ? a : void 0;
154
155
  }
155
- function jt(e, t, n) {
156
+ function Mt(e, t, n) {
156
157
  let r = /* @__PURE__ */ new Map();
157
158
  if (!n || !n.package.footnotes) return r;
158
159
  let i = /* @__PURE__ */ new Map();
@@ -178,7 +179,7 @@ function jt(e, t, n) {
178
179
  }
179
180
  return r;
180
181
  }
181
- var B = /* @__PURE__ */ new Set([
182
+ var Nt = /* @__PURE__ */ new Set([
182
183
  "black",
183
184
  "blue",
184
185
  "cyan",
@@ -197,144 +198,145 @@ var B = /* @__PURE__ */ new Set([
197
198
  "white",
198
199
  "yellow"
199
200
  ]);
200
- function Mt(e) {
201
+ function Pt(e) {
201
202
  let t = [], n = (e, r) => {
202
- for (let [n, i] of e.marks.entries()) i.type.name === "highlight" && !B.has(String(i.attrs.color)) && t.push(`${r}.marks[${n}]=${JSON.stringify(i.attrs)}`);
203
+ for (let [n, i] of e.marks.entries()) i.type.name === "highlight" && !Nt.has(String(i.attrs.color)) && t.push(`${r}.marks[${n}]=${JSON.stringify(i.attrs)}`);
203
204
  e.forEach((e, t, i) => {
204
205
  n(e, `${r}.content[${i}]`);
205
206
  });
206
207
  };
207
208
  return n(e, "doc"), t.join("; ");
208
209
  }
209
- function V(e) {
210
- let { comments: t, hiddenContainer: n, hiddenHeaderFooterContainer: r, noteEditorContainer: a, pagesContainer: o, readOnly: l = !1, experimentalSession: f, pageGap: _ = wt, pageRenderer: te, markupView: b = "all-markup", showCommentHighlights: x = !0, altChunkMarkerText: re, showMarginGuides: T, marginGuideColor: E, password: D, editorMode: je, author: Me, externalPlugins: Ne = [], historyShortcuts: Qe = "editor", onCanonicalHistory: $e, onCanonicalHistoryDrop: et, collaboration: tt, getAnonymizationTerms: nt, showTemplateDirectives: rt, onSlashMenuChange: it, onSlashMenuKeyAction: at, onChange: ot, onError: k, onSelectionUpdate: st, onEditorViewReady: ct, onCopy: lt, onCut: ut, onPaste: dt, onReadOnlyEditAttempt: ft, featureFlags: pt, onSelectiveSaveTripwire: mt } = e, ht = () => u(f) ?? (u(tt)?.yXmlFragment === void 0 ? void 0 : "legacy"), gt = r ?? n, _t = () => u(Me) ?? Tt, A = c(null), vt = /* @__PURE__ */ new Set(), yt = () => {
211
- let e = A.value;
210
+ function B(e) {
211
+ let { comments: t, hiddenContainer: n, hiddenHeaderFooterContainer: r, noteEditorContainer: a, pagesContainer: o, readOnly: l = !1, experimentalSession: f, pageGap: _ = Tt, pageRenderer: te, markupView: b = "all-markup", showCommentHighlights: x = !0, altChunkMarkerText: re, showMarginGuides: T, marginGuideColor: E, password: D, editorMode: je, author: Me, externalPlugins: Ne = [], historyShortcuts: $e = "editor", onCanonicalHistory: et, onCanonicalHistoryDrop: tt, collaboration: nt, getAnonymizationTerms: rt, getDerivedFields: it, showTemplateDirectives: at, onSlashMenuChange: ot, onSlashMenuKeyAction: st, onChange: ct, onError: k, onSelectionUpdate: lt, onEditorViewReady: A, onCopy: ut, onCut: dt, onPaste: ft, onReadOnlyEditAttempt: pt, featureFlags: mt, onSelectiveSaveTripwire: ht } = e, gt = () => u(f) ?? (u(nt)?.yXmlFragment === void 0 ? void 0 : "legacy"), _t = r ?? n, vt = () => u(Me) ?? Et, j = c(null), yt = /* @__PURE__ */ new Set(), bt = () => {
212
+ let e = j.value;
212
213
  return (e && w(e).package.styles) ?? null;
213
- }, bt = c(null), j = 0, xt = !1, M = 0, N = !1, P = c(null), F = c(null), I = c(null), L = () => {
214
- let e = u(tt);
214
+ }, xt = c(null), M = 0, St = !1, N = 0, P = !1, F = c(null), I = c(null), L = c(null), R = () => {
215
+ let e = u(nt);
215
216
  return e === void 0 || p(e) ? void 0 : e;
216
- }, R = () => {
217
- let e = u(tt);
217
+ }, wt = () => {
218
+ let e = u(nt);
218
219
  return e !== void 0 && p(e) ? e : void 0;
219
- }, z = c([]), Ct = c(null), B = c(null), V = c(null), Nt = s(0), Pt = c([]), Ft = c([]), It = s(!1), H = s(null), U = s(!1), W = () => oe(u(ht), ie.authorityRouting), Lt = (e) => v(e), Rt = (e) => {
220
- let t = Lt(e);
221
- ot?.(t), qt.emit("docChange", t);
222
- }, zt = (e, t) => {
220
+ }, z = c([]), Nt = c(null), B = c(null), V = c(null), Ft = s(0), It = c([]), Lt = c([]), Rt = s(!1), H = s(null), U = s(!1), W = () => oe(u(gt), ie.authorityRouting), zt = (e) => v(e), Bt = (e) => {
221
+ let t = zt(e);
222
+ ct?.(t), Xt.emit("docChange", t);
223
+ }, Vt = (e, t) => {
223
224
  if (!W()) return !1;
224
225
  let n = new m({
225
226
  ground: { gap: e },
226
227
  message: ae(e, t)
227
228
  });
228
229
  return k?.(n), !0;
229
- }, G = new ze(We({ historyShortcuts: Qe }));
230
+ }, G = new ze(We({ historyShortcuts: $e }));
230
231
  G.buildSchema(), G.initializeRuntime();
231
- let Bt = se(!1), Vt = [Bt], Ht = Je(), Ut = Xe({
232
- onChange: (e) => it?.(e),
233
- onKeyAction: (e) => at?.(e) ?? !1
234
- }), Wt = Ye(), Gt = () => u(rt) === !0;
235
- function Kt() {
232
+ let Ht = se(!1), Ut = [Ht], Wt = Ye(), Gt = Ze({
233
+ onChange: (e) => ot?.(e),
234
+ onKeyAction: (e) => st?.(e) ?? !1
235
+ }), Kt = Xe(), qt = Je(() => it?.()), Jt = () => u(at) === !0;
236
+ function Yt() {
236
237
  return [
237
- Bt,
238
+ Ht,
238
239
  ...Ne,
239
- ...L()?.plugins ?? [],
240
- ...Gt() ? [Ht, Ut] : [],
241
- Wt
240
+ ...R()?.plugins ?? [],
241
+ ...Jt() ? [Wt, Gt] : [],
242
+ Kt,
243
+ qt
242
244
  ];
243
245
  }
244
- let qt = pe(), K = new Le(), q = Ce(), Jt = ve({
246
+ let Xt = pe(), K = new Le(), q = Ce(), Zt = ve({
245
247
  relayout: () => {
246
- let e = P.value?.state ?? q.lastEditorState;
248
+ let e = F.value?.state ?? q.lastEditorState;
247
249
  e && Z(e, { reason: "hyphenation-ready" });
248
250
  },
249
251
  onError: (e) => k?.(e)
250
252
  });
251
- i(Jt.cancel), i(ge({
253
+ i(Zt.cancel), i(ge({
252
254
  measuredFontSet: () => q.lastMeasureInputs?.fontSet ?? null,
253
255
  relayout: () => {
254
- if (N) return;
255
- let e = P.value?.state ?? q.lastEditorState;
256
+ if (P) return;
257
+ let e = F.value?.state ?? q.lastEditorState;
256
258
  e && Z(e, { reason: "font-ready" });
257
259
  }
258
260
  }));
259
- let Yt = new Fe({
261
+ let Qt = new Fe({
260
262
  pageGap: _,
261
263
  showShadow: !0
262
264
  }), J = _e({
263
- getHost: () => gt.value,
265
+ getHost: () => _t.value,
264
266
  getReadOnly: () => u(l),
265
- getDocument: () => A.value,
267
+ getDocument: () => j.value,
266
268
  getCanonicalApi: () => $.api,
267
269
  readCanonicalDocument: () => $.readCanonicalDocument(),
268
- getExperimentalSession: () => u(ht),
270
+ getExperimentalSession: () => u(gt),
269
271
  onSessionRefusal: (e, t, n) => {
270
272
  H.value = e, k?.(n ?? new m({
271
273
  ground: t,
272
274
  message: e
273
275
  }));
274
276
  },
275
- getStyles: yt,
276
- getTheme: () => A.value?.package.theme ?? null,
277
+ getStyles: bt,
278
+ getTheme: () => j.value?.package.theme ?? null,
277
279
  onTransaction: ({ rId: e, kind: t, view: n, docChanged: r, selectionChanged: i }) => {
278
- if (r && (U.value = !0, Qt.schedule()), r || i) {
280
+ if (r && (U.value = !0, tn.schedule()), r || i) {
279
281
  let { from: r, to: i } = n.state.selection;
280
- Ct.value = {
282
+ Nt.value = {
281
283
  from: r,
282
284
  kind: t,
283
285
  rId: e,
284
286
  to: i
285
- }, st?.(n.state), qt.emit("selectionChange", {
287
+ }, lt?.(n.state), Xt.emit("selectionChange", {
286
288
  from: r,
287
289
  to: i
288
290
  });
289
291
  }
290
292
  K.requestRender();
291
293
  }
292
- }), Xt = { current: null }, Y = we({
294
+ }), $t = { current: null }, Y = we({
293
295
  getHost: () => a?.value ?? null,
294
- getPlugins: () => Vt,
295
- getDocument: () => A.value,
296
+ getPlugins: () => Ut,
297
+ getDocument: () => j.value,
296
298
  getCanonicalApi: () => $.api,
297
299
  readCanonicalDocument: () => $.readCanonicalDocument(),
298
- getExperimentalSession: () => u(ht),
300
+ getExperimentalSession: () => u(gt),
299
301
  onSessionRefusal: (e, t, n) => {
300
302
  H.value = e, k?.(n ?? new m({
301
303
  ground: t,
302
304
  message: e
303
305
  }));
304
306
  },
305
- getStyles: yt,
306
- getTheme: () => A.value?.package.theme ?? null,
307
+ getStyles: bt,
308
+ getTheme: () => j.value?.package.theme ?? null,
307
309
  onTransaction: ({ docChanged: e, selectionChanged: t, view: n }) => {
308
310
  if (e) {
309
311
  U.value = !0;
310
- let e = A.value;
311
- e && (A.value = $.readCanonicalDocument() ?? Xt.current?.snapshotDocument(e) ?? e, rn()), Qt.schedule();
312
+ let e = j.value;
313
+ e && (j.value = $.readCanonicalDocument() ?? $t.current?.snapshotDocument(e) ?? e, sn()), tn.schedule();
312
314
  }
313
315
  if (e || t) {
314
- st?.(n.state);
316
+ lt?.(n.state);
315
317
  let { from: e, to: t } = n.state.selection;
316
- qt.emit("selectionChange", {
318
+ Xt.emit("selectionChange", {
317
319
  from: e,
318
320
  to: t
319
321
  });
320
322
  }
321
323
  }
322
324
  });
323
- Xt.current = Y;
325
+ $t.current = Y;
324
326
  let X = () => {
325
327
  J.sync(), Y.sync();
326
328
  };
327
- d(() => u(ht), X);
328
- function Zt(e) {
329
- e.layout && (V.value = e.layout), e.blocks && (Pt.value = e.blocks), e.measures && (Ft.value = e.measures), e.blockLookup && Yt.setBlockLookup(e.blockLookup), e.layout && qt.emit("layoutComplete", e.layout);
329
+ d(() => u(gt), X);
330
+ function en(e) {
331
+ e.layout && (V.value = e.layout), e.blocks && (It.value = e.blocks), e.measures && (Lt.value = e.measures), e.blockLookup && Qt.setBlockLookup(e.blockLookup), e.layout && Xt.emit("layoutComplete", e.layout);
330
332
  }
331
333
  function Z(e, t = {}) {
332
- if (N) return;
333
- let n = o.value, r = n instanceof HTMLDivElement ? n : null, i = A.value, a = i && w(i), s = a?.package.document, c = s?.sections?.[0]?.properties ?? s?.finalSectionProperties ?? null, l = ne(c), d = S(c), f = Ot(c), p = l.w - d.left - d.right;
334
- Nt.value = p;
335
- let m = a?.package.styles ?? null, ee = i?.package.theme ?? null, h = i?.package.settings?.defaultTabStop, g = i?.package.settings?.mirrorMargins === !0, v = Ze(a?.package);
334
+ if (P) return;
335
+ let n = o.value, r = n instanceof HTMLDivElement ? n : null, i = j.value, a = i && w(i), s = a?.package.document, c = s?.sections?.[0]?.properties ?? s?.finalSectionProperties ?? null, l = ne(c), d = S(c), f = kt(c), p = l.w - d.left - d.right;
336
+ Ft.value = p;
337
+ let m = a?.package.styles ?? null, ee = i?.package.theme ?? null, h = i?.package.settings?.defaultTabStop, g = i?.package.settings?.mirrorMargins === !0, v = Qe(a?.package);
336
338
  try {
337
- Zt(ye({
339
+ en(ye({
338
340
  contentWidth: p,
339
341
  columns: f,
340
342
  pageSize: l,
@@ -364,17 +366,17 @@ function V(e) {
364
366
  styles: m,
365
367
  layout: V.value,
366
368
  hfPMs: J,
367
- painter: Yt,
369
+ painter: Qt,
368
370
  pagesContainer: r,
369
371
  session: q,
370
- renderHfFromContentOrPm: kt,
371
- renderHeaderFooterContentByRId: At,
372
+ renderHfFromContentOrPm: At,
373
+ renderHeaderFooterContentByRId: jt,
372
374
  readFontSetSignature: me,
373
- buildFootnoteRenderItems: jt,
374
- describeInvalidHighlightMarks: Mt,
375
- emptyTemplatePreviewEntries: Et,
376
- emptyTemplatePreviewHidden: Dt,
377
- hyphenationReadiness: Jt,
375
+ buildFootnoteRenderItems: Mt,
376
+ describeInvalidHighlightMarks: Pt,
377
+ emptyTemplatePreviewEntries: Dt,
378
+ emptyTemplatePreviewHidden: Ot,
379
+ hyphenationReadiness: Zt,
378
380
  markupView: u(b),
379
381
  showCommentHighlights: u(x),
380
382
  ...re === void 0 ? {} : { altChunkMarkerText: u(re) }
@@ -384,205 +386,206 @@ function V(e) {
384
386
  k?.(t);
385
387
  }
386
388
  }
387
- let Qt = Se({
388
- readState: () => P.value?.state ?? null,
389
+ let tn = Se({
390
+ readState: () => F.value?.state ?? null,
389
391
  runLayout: (e, t) => Z(e, t),
390
392
  ...be,
391
393
  clock: xe
392
- }), Q = null, $t = Ge();
393
- function en() {
394
+ }), Q = null, nn = Ge();
395
+ function rn() {
394
396
  Q !== null && (window.clearTimeout(Q), Q = null);
395
- let e = P.value, t = A.value;
397
+ let e = F.value, t = j.value;
396
398
  if (e && t) try {
397
399
  let n = $.readCanonicalDocument();
398
400
  if (!n && W()) return;
399
- let r = n ?? $t.reconcile(Re(e.state.doc, w(t), { stylesheetSource: { type: "package" } }), e.state.doc);
400
- A.value = r, X(), nn(), Rt(r);
401
+ let r = n ?? nn.reconcile(Re(e.state.doc, w(t), { stylesheetSource: { type: "package" } }), e.state.doc);
402
+ j.value = r, X(), on(), Bt(r);
401
403
  } catch (e) {
402
404
  k?.(e instanceof Error ? e : Error(String(e)));
403
405
  }
404
406
  }
405
- let tn = null;
406
- function nn() {
407
- tn !== null && (window.clearTimeout(tn), tn = null);
407
+ let an = null;
408
+ function on() {
409
+ an !== null && (window.clearTimeout(an), an = null);
408
410
  }
409
- function rn() {
410
- nn(), tn = window.setTimeout(() => {
411
- if (tn = null, Q !== null) return;
412
- let e = A.value;
413
- e && Rt(e);
411
+ function sn() {
412
+ on(), an = window.setTimeout(() => {
413
+ if (an = null, Q !== null) return;
414
+ let e = j.value;
415
+ e && Bt(e);
414
416
  }, ue);
415
417
  }
416
- function an() {
418
+ function cn() {
417
419
  Q !== null && window.clearTimeout(Q), Q = window.setTimeout(() => {
418
- Q = null, en();
420
+ Q = null, rn();
419
421
  }, ue);
420
422
  }
421
423
  let $ = h({
422
424
  getHost: () => n.value,
423
- getDocument: () => A.value,
424
- getStyles: yt,
425
+ getDocument: () => j.value,
426
+ getStyles: bt,
425
427
  getExtensionManager: () => G,
426
- getExternalPlugins: Kt,
427
- getAnonymizationTerms: () => nt?.() ?? le,
428
- getCollaboration: L,
429
- getCollaborationModules: () => I.value,
430
- getCanonicalRoom: R,
428
+ getExternalPlugins: Yt,
429
+ getAnonymizationTerms: () => rt?.() ?? le,
430
+ getDerivedFields: () => it?.(),
431
+ getCollaboration: R,
432
+ getCollaborationModules: () => L.value,
433
+ getCanonicalRoom: wt,
431
434
  getPrecomputedInitialState: () => null,
432
435
  getReadOnly: () => u(l),
433
- getExperimentalSession: () => u(ht),
434
- getHistoryShortcuts: () => Qe,
435
- onCanonicalHistory: (e) => $e?.(e),
436
- onCanonicalHistoryDrop: (e) => et?.(e),
436
+ getExperimentalSession: () => u(gt),
437
+ getHistoryShortcuts: () => $e,
438
+ onCanonicalHistory: (e) => et?.(e),
439
+ onCanonicalHistoryDrop: (e) => tt?.(e),
437
440
  getEditingMode: () => u(je) ?? "editing",
438
- getSuggestionAuthor: _t,
441
+ getSuggestionAuthor: vt,
439
442
  onSessionRefusal: (e, t, n) => {
440
443
  k?.(n ?? new m({
441
444
  ground: t,
442
445
  message: e
443
446
  }));
444
447
  },
445
- getDocumentIdentity: () => String(j),
446
- getDocumentContext: () => A.value,
447
- onTransaction: cn,
448
- onCanonicalCompositionLayout: ln,
448
+ getDocumentIdentity: () => String(M),
449
+ getDocumentContext: () => j.value,
450
+ onTransaction: dn,
451
+ onCanonicalCompositionLayout: fn,
449
452
  getEmbeddedFontFamilyMap: () => q.embeddedFontFamilyMap,
450
453
  onSelectionChange: (e) => {
451
- F.value = e, st?.(e), qt.emit("selectionChange", {
454
+ I.value = e, lt?.(e), Xt.emit("selectionChange", {
452
455
  from: e.selection.from,
453
456
  to: e.selection.to
454
457
  });
455
458
  },
456
459
  onKeyDown: () => !1,
457
- onCopy: () => lt?.(),
458
- onCut: () => ut?.(),
459
- onPaste: () => dt?.(),
460
- onReadOnlyEditAttempt: () => ft?.(),
461
- onEditorViewReady: un,
460
+ onCopy: () => ut?.(),
461
+ onCut: () => dt?.(),
462
+ onPaste: () => ft?.(),
463
+ onReadOnlyEditAttempt: () => pt?.(),
464
+ onEditorViewReady: pn,
462
465
  onEditorViewDestroy: () => {
463
- P.value = null, It.value = !1, ct?.(null);
466
+ F.value = null, Rt.value = !1, A?.(null);
464
467
  },
465
468
  onRemoteSelectionsChange: (e) => {
466
469
  z.value = e;
467
470
  }
468
- }), on = $.api.autocomplete.subscribe((t) => e.onAutocompleteChange?.(t)), sn = () => {
469
- let e = L()?.awareness, t = I.value, n = $.getView();
471
+ }), ln = $.api.autocomplete.subscribe((t) => e.onAutocompleteChange?.(t)), un = () => {
472
+ let e = R()?.awareness, t = L.value, n = $.getView();
470
473
  z.value = e && t && n ? ee(n.state, e, t) : [];
471
474
  };
472
- d(() => u(tt), (e, t, n) => {
475
+ d(() => u(nt), (e, t, n) => {
473
476
  if (z.value = [], !e || p(e)) {
474
- I.value = null, $.retryViewCreation(), $.syncExternalDocument();
477
+ L.value = null, $.retryViewCreation(), $.syncExternalDocument();
475
478
  return;
476
479
  }
477
480
  let r = !1;
478
481
  n(() => {
479
482
  r = !0;
480
- }), I.value = null, O().then((e) => {
481
- r || (I.value = e, $.retryViewCreation(), $.syncExternalDocument(), sn());
483
+ }), L.value = null, O().then((e) => {
484
+ r || (L.value = e, $.retryViewCreation(), $.syncExternalDocument(), un());
482
485
  }, (e) => {
483
- r || (I.value = null, k?.(e instanceof Error ? e : Error(String(e))));
486
+ r || (L.value = null, k?.(e instanceof Error ? e : Error(String(e))));
484
487
  });
485
488
  }, { immediate: !0 }), d(() => ({
486
- awareness: L()?.awareness,
487
- modules: I.value,
488
- view: P.value
489
+ awareness: R()?.awareness,
490
+ modules: L.value,
491
+ view: F.value
489
492
  }), ({ awareness: e, modules: t, view: n }, r, i) => {
490
- R() === void 0 && (!e || !t || !n ? z.value = [] : (e.on("change", sn), sn(), i(() => {
491
- e.off("change", sn), z.value = [];
493
+ wt() === void 0 && (!e || !t || !n ? z.value = [] : (e.on("change", un), un(), i(() => {
494
+ e.off("change", un), z.value = [];
492
495
  })));
493
496
  }, { flush: "post" });
494
- function cn({ newState: e, docChanged: t, transactions: n }) {
495
- F.value = e;
497
+ function dn({ newState: e, docChanged: t, transactions: n }) {
498
+ I.value = e;
496
499
  let r = n[0]?.before;
497
- if (t && r && $t.noteBase(r), t) {
500
+ if (t && r && nn.noteBase(r), t) {
498
501
  let e = $.readCanonicalDocument();
499
- e && (A.value = e, X()), U.value = !0, K.incrementStateSeq(), Qt.schedule(), an();
502
+ e && (j.value = e, X()), U.value = !0, K.incrementStateSeq(), tn.schedule(), cn();
500
503
  }
501
504
  K.requestRender();
502
505
  }
503
- function ln() {
504
- let e = P.value;
505
- e && (F.value = e.state), K.incrementStateSeq(), Qt.schedule(), K.requestRender();
506
+ function fn() {
507
+ let e = F.value;
508
+ e && (I.value = e.state), K.incrementStateSeq(), tn.schedule(), K.requestRender();
506
509
  }
507
- function un(e) {
508
- P.value = e, F.value = e.state, It.value = !0;
509
- let t = A.value, n = j, r = ++M;
510
- N = !0;
510
+ function pn(e) {
511
+ F.value = e, I.value = e.state, Rt.value = !0;
512
+ let t = j.value, n = M, r = ++N;
513
+ P = !0;
511
514
  let i = () => {
512
- M === r && (N = !1, xt || j !== n || $.getView() !== e || (Z(e.state, { reason: "initial" }), K.requestRender()));
515
+ N === r && (P = !1, St || M !== n || $.getView() !== e || (Z(e.state, { reason: "initial" }), K.requestRender()));
513
516
  };
514
- he(t, e.state.doc).then(i, i), pn(e), ct?.(e), u(l) || requestAnimationFrame(() => {
515
- P.value === e && !e.hasFocus() && e.focus();
517
+ he(t, e.state.doc).then(i, i), gn(e), A?.(e), u(l) || requestAnimationFrame(() => {
518
+ F.value === e && !e.hasFocus() && e.focus();
516
519
  });
517
520
  }
518
- let dn = {
521
+ let mn = {
519
522
  getDocx: async (e) => {
520
- let t = await Cn(e);
521
- return t?.tripwireResult && mt?.(t.tripwireResult), t?.buffer ?? null;
523
+ let t = await En(e);
524
+ return t?.tripwireResult && ht?.(t.tripwireResult), t?.buffer ?? null;
522
525
  },
523
- loadDocument: bn,
524
- loadDocx: yn
525
- }, fn = fe({
526
+ loadDocument: Cn,
527
+ loadDocx: Sn
528
+ }, hn = fe({
526
529
  getEditorApi: () => $.api,
527
530
  getLayout: () => V.value,
528
531
  runLayout: (e, t) => Z(e, t),
529
- getDocumentIO: () => dn,
530
- emitter: qt
532
+ getDocumentIO: () => mn,
533
+ emitter: Xt
531
534
  });
532
- function pn(e) {
535
+ function gn(e) {
533
536
  let t = u(je) === "suggesting";
534
- ce(t, e.state, e.dispatch, _t());
537
+ ce(t, e.state, e.dispatch, vt());
535
538
  }
536
- d([() => u(je), _t], () => {
537
- fn.setCanonicalMode(u(je) === "suggesting" ? {
539
+ d([() => u(je), vt], () => {
540
+ hn.setCanonicalMode(u(je) === "suggesting" ? {
538
541
  type: "suggesting",
539
- author: _t()
542
+ author: vt()
540
543
  } : { type: "editing" });
541
- let e = P.value;
542
- e && pn(e);
544
+ let e = F.value;
545
+ e && gn(e);
543
546
  for (let e of Y.listStories()) {
544
547
  let t = Y.getView(e);
545
- t && pn(t);
548
+ t && gn(t);
546
549
  }
547
550
  }), d(() => u(l), (e) => {
548
- $.syncEditable(), e && Mn(), J.sync();
551
+ $.syncEditable(), e && Fn(), J.sync();
549
552
  });
550
- function mn(e) {
551
- let t = Gt();
552
- if (t === e.state.plugins.includes(Ht)) return;
553
- let n = e.state.plugins.filter((e) => e !== Ht && e !== Ut);
553
+ function _n(e) {
554
+ let t = Jt();
555
+ if (t === e.state.plugins.includes(Wt)) return;
556
+ let n = e.state.plugins.filter((e) => e !== Wt && e !== Gt);
554
557
  if (t) {
555
- let e = n.indexOf(Wt), t = e === -1 ? n.length : e;
556
- n.splice(t, 0, Ht, Ut);
558
+ let e = n.indexOf(Kt), t = e === -1 ? n.length : e;
559
+ n.splice(t, 0, Wt, Gt);
557
560
  }
558
561
  e.updateState(e.state.reconfigure({ plugins: n }));
559
562
  }
560
- d(() => Gt(), () => {
561
- let e = P.value;
562
- e && mn(e);
563
+ d(() => Jt(), () => {
564
+ let e = F.value;
565
+ e && _n(e);
563
566
  });
564
- function hn() {
567
+ function vn() {
565
568
  $.ensureView();
566
569
  }
567
- function gn() {
568
- nn(), j += 1, bt.value = A.value?.originalBuffer ?? null, U.value = !1, Ct.value = null, B.value = null, Y.activate(null), Qt.dispose(), $.destroyView(), W() && $.ensureView(), X(), $.ensureView(), $.getView() || _n();
570
+ function yn() {
571
+ on(), M += 1, xt.value = j.value?.originalBuffer ?? null, U.value = !1, Nt.value = null, B.value = null, Y.activate(null), tn.dispose(), $.destroyView(), W() && $.ensureView(), X(), $.ensureView(), $.getView() || bn();
569
572
  }
570
- function _n() {
571
- let e = A.value;
572
- if (e && !L()) try {
573
+ function bn() {
574
+ let e = j.value;
575
+ if (e && !R()) try {
573
576
  let t = g({
574
577
  document: e,
575
578
  styles: w(e).package.styles ?? null,
576
579
  manager: G,
577
- externalPlugins: Kt(),
580
+ externalPlugins: Yt(),
578
581
  collaborationModules: null,
579
582
  reason: "mount"
580
583
  });
581
- F.value = t;
582
- let n = j, r = ++M;
583
- N = !0;
584
+ I.value = t;
585
+ let n = M, r = ++N;
586
+ P = !0;
584
587
  let i = () => {
585
- M === r && (N = !1, xt || j !== n || A.value !== e || $.getView() || Z(t, { reason: "initial" }));
588
+ N === r && (P = !1, St || M !== n || j.value !== e || $.getView() || Z(t, { reason: "initial" }));
586
589
  };
587
590
  he(e, t.doc).then(i, i);
588
591
  } catch (e) {
@@ -592,14 +595,14 @@ function V(e) {
592
595
  d([
593
596
  n,
594
597
  o,
595
- gt,
598
+ _t,
596
599
  ...a ? [a] : []
597
600
  ], () => {
598
- n.value && A.value && !$.getView() && hn(), X();
601
+ n.value && j.value && !$.getView() && vn(), X();
599
602
  }, { flush: "post" });
600
- let vn = 0;
601
- async function yn(e) {
602
- vn += 1, H.value = null, It.value = !1;
603
+ let xn = 0;
604
+ async function Sn(e) {
605
+ xn += 1, H.value = null, Rt.value = !1;
603
606
  try {
604
607
  let t;
605
608
  if (W()) {
@@ -607,27 +610,27 @@ function V(e) {
607
610
  if (n.isErr()) throw n.error;
608
611
  t = n.value.document;
609
612
  } else t = await Ae(e, { password: u(D) });
610
- vt = Ke(t), A.value = t, gn();
613
+ yt = Ke(t), j.value = t, yn();
611
614
  } catch (e) {
612
615
  let t = e instanceof Error ? e : Error(String(e));
613
616
  H.value = t.message, k?.(t);
614
617
  }
615
618
  }
616
- function bn(e) {
617
- let t = vn += 1;
619
+ function Cn(e) {
620
+ let t = xn += 1;
618
621
  H.value = null;
619
- let n = St(e);
620
- !W() || De(n) ? Sn(n) : xn(n, t);
622
+ let n = Ct(e);
623
+ !W() || De(n) ? Tn(n) : wn(n, t);
621
624
  }
622
- async function xn(e, t) {
625
+ async function wn(e, t) {
623
626
  let n = await ke(e);
624
- t === vn && (n.isErr() ? (H.value = n.error.message, k?.(n.error)) : Sn(n.value));
627
+ t === xn && (n.isErr() ? (H.value = n.error.message, k?.(n.error)) : Tn(n.value));
625
628
  }
626
- function Sn(e) {
627
- vt = Ke(e), A.value = e, $t.reset(), gn();
629
+ function Tn(e) {
630
+ yt = Ke(e), j.value = e, nn.reset(), yn();
628
631
  }
629
- async function Cn(e) {
630
- let n = P.value, r = A.value;
632
+ async function En(e) {
633
+ let n = F.value, r = j.value;
631
634
  if (!n || !r) return null;
632
635
  try {
633
636
  let i = $.api.captureCanonicalSave();
@@ -635,14 +638,14 @@ function V(e) {
635
638
  let t = await Ee({
636
639
  snapshot: i,
637
640
  options: e,
638
- featureFlags: u(pt)
641
+ featureFlags: u(mt)
639
642
  });
640
643
  for (let n of t.diagnostics) e?.onDiagnostic || k?.(Te(n));
641
644
  return t;
642
645
  }
643
646
  if (W()) return null;
644
- Q !== null && en();
645
- let a = Y.snapshotDocument(J.snapshotDocument(r)), o = n.state, s = Re(o.doc, w(a), { stylesheetSource: { type: "package" } }), c = qe(t ? y(s, t(), { anchoredInEditor: C(o.doc) }) : s, vt), { resolveSelectiveSaveFlags: l } = await import("@stll/folio-core/docx/selectiveSaveFlags"), d = l(u(pt)), f = c.originalBuffer ?? null, p = d.selectiveSave && e?.mode !== de.full, m = p || d.selectiveSaveTripwire, { repackDocx: ee, createDocx: h } = await import("@stll/folio-core/docx/rezip"), g = null;
647
+ Q !== null && rn();
648
+ let a = Y.snapshotDocument(J.snapshotDocument(r)), o = n.state, s = Re(o.doc, w(a), { stylesheetSource: { type: "package" } }), c = qe(t ? y(s, t(), { anchoredInEditor: C(o.doc) }) : s, yt), { resolveSelectiveSaveFlags: l } = await import("@stll/folio-core/docx/selectiveSaveFlags"), d = l(u(mt)), f = c.originalBuffer ?? null, p = d.selectiveSave && e?.mode !== de.full, m = p || d.selectiveSaveTripwire, { repackDocx: ee, createDocx: h } = await import("@stll/folio-core/docx/rezip"), g = null;
646
649
  if (m && f) {
647
650
  let { attemptSelectiveSave: t } = await import("@stll/folio-core/docx/selectiveSave");
648
651
  g = await t(c, f, {
@@ -664,7 +667,7 @@ function V(e) {
664
667
  v = await S();
665
668
  } catch {}
666
669
  let ne = null;
667
- if (d.selectiveSaveTripwire && v && mt) try {
670
+ if (d.selectiveSaveTripwire && v && ht) try {
668
671
  let { compareSelectiveVsFull: e } = await import("@stll/folio-core/docx/selectiveSaveTripwire");
669
672
  ne = await e(g, v);
670
673
  } catch {}
@@ -679,63 +682,63 @@ function V(e) {
679
682
  return k?.(e instanceof Error ? e : Error(String(e))), null;
680
683
  }
681
684
  }
682
- async function wn(e) {
683
- let t = P.value, n = t?.state, r = await Cn({
685
+ async function Dn(e) {
686
+ let t = F.value, n = t?.state, r = await En({
684
687
  onDiagnostic: e?.onDiagnostic,
685
688
  onSelectiveDecline: e?.onSelectiveDecline,
686
689
  onSerializationPath: e?.onSerializationPath,
687
690
  mode: e?.selective === !1 ? de.full : de.preferSelective
688
691
  });
689
- 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, {
692
+ return r ? (F.value === t && t?.state.doc === n?.doc && (r.version === void 0 || $.api.isCanonicalSaveCurrent(r.version)) && (r.version !== void 0 && $.api.markCanonicalSaved(r.version, {
690
693
  buffer: r.buffer,
691
694
  path: r.path
692
- }), A.value = r.document, X(), U.value = !1), r.tripwireResult && mt?.(r.tripwireResult), new Blob([r.buffer], { type: "application/vnd.openxmlformats-officedocument.wordprocessingml.document" })) : null;
695
+ }), j.value = r.document, X(), U.value = !1), r.tripwireResult && ht?.(r.tripwireResult), new Blob([r.buffer], { type: "application/vnd.openxmlformats-officedocument.wordprocessingml.document" })) : null;
693
696
  }
694
- function Tn() {
697
+ function On() {
695
698
  return $.readCanonicalDocument();
696
699
  }
697
- function En() {
698
- let e = Tn();
700
+ function kn() {
701
+ let e = On();
699
702
  if (e) return e;
700
703
  if (W()) return null;
701
- let t = A.value;
704
+ let t = j.value;
702
705
  if (!t) return null;
703
706
  let n = $.api.getDocument() ?? t;
704
707
  return Y.snapshotDocument(J.snapshotDocument(n));
705
708
  }
706
- function Dn() {
707
- let e = En();
708
- return e && Lt(e);
709
+ function An() {
710
+ let e = kn();
711
+ return e && zt(e);
709
712
  }
710
- function On(e) {
711
- zt(ie.modelEdits, "Direct document model changes are unavailable in this session.") || (A.value = St(e), nn(), bt.value = e.originalBuffer ?? null, X(), B.value && !Y.getView(B.value) && (B.value = null));
713
+ function jn(e) {
714
+ Vt(ie.modelEdits, "Direct document model changes are unavailable in this session.") || (j.value = Ct(e), on(), xt.value = e.originalBuffer ?? null, X(), B.value && !Y.getView(B.value) && (B.value = null));
712
715
  }
713
- function kn(e) {
716
+ function Mn(e) {
714
717
  return J.getView(e);
715
718
  }
716
- function An() {
719
+ function Nn() {
717
720
  X();
718
721
  }
719
- function jn(e) {
722
+ function Pn(e) {
720
723
  let t = Y.activate(e);
721
- t && (pn(t), B.value = e, requestAnimationFrame(() => t.focus()));
724
+ t && (gn(t), B.value = e, requestAnimationFrame(() => t.focus()));
722
725
  }
723
- function Mn() {
726
+ function Fn() {
724
727
  Y.activate(null), B.value = null;
725
728
  }
726
- function Nn() {
729
+ function In() {
727
730
  let e = B.value;
728
731
  return e ? Y.getView(e) : null;
729
732
  }
730
- function Pn() {
733
+ function Ln() {
731
734
  return G.getCommands();
732
735
  }
733
- function Fn() {
734
- let e = Nn();
735
- e ? e.focus() : P.value?.focus();
736
+ function Rn() {
737
+ let e = In();
738
+ e ? e.focus() : F.value?.focus();
736
739
  }
737
- function In() {
738
- let e = P.value;
740
+ function zn() {
741
+ let e = F.value;
739
742
  e && Z(e.state, { reason: "manual" });
740
743
  }
741
744
  d([
@@ -745,59 +748,59 @@ function V(e) {
745
748
  () => u(b),
746
749
  () => u(x),
747
750
  () => u(re)
748
- ], () => In());
749
- function Ln() {
750
- xt = !0, o.value && Ie(o.value), M += 1, N = !1, Qt.dispose(), Q !== null && (window.clearTimeout(Q), Q = null), nn(), $.destroyView(), z.value = [], J.destroy(), Y.destroy(), G.destroy(), F.value = null, V.value = null, A.value = null, bt.value = null, It.value = !1;
751
+ ], () => zn());
752
+ function Bn() {
753
+ St = !0, o.value && Ie(o.value), N += 1, P = !1, tn.dispose(), Q !== null && (window.clearTimeout(Q), Q = null), on(), $.destroyView(), z.value = [], J.destroy(), Y.destroy(), G.destroy(), I.value = null, V.value = null, j.value = null, xt.value = null, Rt.value = !1;
751
754
  }
752
755
  return i(() => {
753
- Ln(), on();
756
+ Bn(), ln();
754
757
  }), {
755
758
  setEmbeddedFontFamilies: (e) => {
756
759
  e ? q.embeddedFontFamilyMap = new Map(e) : delete q.embeddedFontFamilyMap, $.refreshFonts();
757
760
  },
758
- editor: fn,
759
- editorView: P,
760
- editorState: F,
761
+ editor: hn,
762
+ editorView: F,
763
+ editorState: I,
761
764
  remoteSelections: z,
762
- headerFooterSelection: Ct,
765
+ headerFooterSelection: Nt,
763
766
  activeNoteStory: B,
764
- isReady: It,
767
+ isReady: Rt,
765
768
  isDirty: U,
766
769
  parseError: H,
767
- modelDocument: A,
768
- readDocumentModel: Tn,
769
- sourceBuffer: bt,
770
- hiddenEditorWidth: Nt,
770
+ modelDocument: j,
771
+ readDocumentModel: On,
772
+ sourceBuffer: xt,
773
+ hiddenEditorWidth: Ft,
771
774
  layout: V,
772
- blocks: Pt,
773
- measures: Ft,
775
+ blocks: It,
776
+ measures: Lt,
774
777
  syncCoordinator: K,
775
- loadBuffer: yn,
776
- loadDocument: bn,
777
- save: wn,
778
- getDocument: Dn,
779
- readDocument: En,
780
- setDocument: On,
781
- getHeaderFooterView: kn,
782
- syncHeaderFooterViews: An,
783
- openNoteStory: jn,
784
- closeNoteStory: Mn,
785
- getActiveNoteView: Nn,
786
- getCommands: Pn,
787
- focus: Fn,
788
- reLayout: In,
789
- destroy: Ln
778
+ loadBuffer: Sn,
779
+ loadDocument: Cn,
780
+ save: Dn,
781
+ getDocument: An,
782
+ readDocument: kn,
783
+ setDocument: jn,
784
+ getHeaderFooterView: Mn,
785
+ syncHeaderFooterViews: Nn,
786
+ openNoteStory: Pn,
787
+ closeNoteStory: Fn,
788
+ getActiveNoteView: In,
789
+ getCommands: Ln,
790
+ focus: Rn,
791
+ reLayout: zn,
792
+ destroy: Bn
790
793
  };
791
794
  }
792
795
  // src/composables/useFindReplace.ts
793
- function Nt({ editorView: t, pagesRef: n, getDocument: r, layout: a, commentRoot: l, revealComment: u, displayMode: f, readOnly: p, onReadonlyEditAttempt: m, onResultChange: ee }) {
794
- let h = new Qe(), g = s(""), _ = s(""), v = o(it()), y = c([]), b = s(-1), x = e(() => y.value.at(b.value) ?? null), S = () => te({
796
+ function V({ editorView: t, pagesRef: n, getDocument: r, layout: a, commentRoot: l, revealComment: u, displayMode: f, readOnly: p, onReadonlyEditAttempt: m, onResultChange: ee }) {
797
+ let h = new $e(), g = s(""), _ = s(""), v = o(at()), y = c([]), b = s(-1), x = e(() => y.value.at(b.value) ?? null), S = () => te({
795
798
  editingMode: t.value?.editable === !1 ? "viewing" : "editing",
796
799
  readOnlyProp: p.value,
797
800
  displayMode: f.value
798
801
  }), ne = e(S), re = e(() => {
799
802
  let e = x.value;
800
- return S() === null && !!t.value && !!e && w() && at(e).status === "allowed";
803
+ return S() === null && !!t.value && !!e && w() && ot(e).status === "allowed";
801
804
  }), C = null, ie, ae = null, oe = (e) => {
802
805
  let n = t.value?.state.doc;
803
806
  return {
@@ -809,11 +812,11 @@ function Nt({ editorView: t, pagesRef: n, getDocument: r, layout: a, commentRoot
809
812
  },
810
813
  document: e,
811
814
  ...n ? { bodyVersion: n } : {},
812
- context: { renderedStories: rt(a.value) }
815
+ context: { renderedStories: it(a.value) }
813
816
  };
814
817
  }, w = () => {
815
818
  let e = r();
816
- return !!e && k(ae, ot(oe(e)));
819
+ return !!e && ct(ae, st(oe(e)));
817
820
  }, T = () => h.getResult(), E = () => ee(T()), D = () => {
818
821
  clearTimeout(ie), ie = void 0;
819
822
  }, se = () => {
@@ -824,7 +827,7 @@ function Nt({ editorView: t, pagesRef: n, getDocument: r, layout: a, commentRoot
824
827
  D();
825
828
  let i = r(), o = n.value, s = t.value?.state.doc;
826
829
  if (!i || !g.value.trim()) return ce(), [];
827
- let c = oe(i), u = $e({
830
+ let c = oe(i), u = et({
828
831
  document: c.document,
829
832
  state: t.value?.state ?? null,
830
833
  searchText: c.query,
@@ -832,8 +835,8 @@ function Nt({ editorView: t, pagesRef: n, getDocument: r, layout: a, commentRoot
832
835
  context: c.context
833
836
  });
834
837
  if (u === null) return se(), E(), [];
835
- let d = ot(c), f = e === "refresh" && ae?.query === d.query, p = h.setMatches(u, f ? h.getResult()?.currentIndex ?? 0 : 0);
836
- return ae = d, y.value = u, b.value = u.length > 0 ? p.currentIndex : -1, C?.destroy(), C = o ? nt({
838
+ let d = st(c), f = e === "refresh" && ae?.query === d.query, p = h.setMatches(u, f ? h.getResult()?.currentIndex ?? 0 : 0);
839
+ return ae = d, y.value = u, b.value = u.length > 0 ? p.currentIndex : -1, C?.destroy(), C = o ? rt({
837
840
  container: o,
838
841
  document: i,
839
842
  bodyDoc: s,
@@ -843,7 +846,7 @@ function Nt({ editorView: t, pagesRef: n, getDocument: r, layout: a, commentRoot
843
846
  }) : null, C?.paint(b.value), u.at(0) && !f ? le(0) : E(), u;
844
847
  }, ue = () => {
845
848
  D(), ie = setTimeout(() => O("refresh"), 120);
846
- }, de = (e, t) => (g.value = e, Object.assign(v, it(), t), O(), T()), fe = (e) => {
849
+ }, de = (e, t) => (g.value = e, Object.assign(v, at(), t), O(), T()), fe = (e) => {
847
850
  let t = h.goTo(e);
848
851
  return t ? le(t.index) : !1;
849
852
  }, pe = (e) => {
@@ -878,7 +881,7 @@ function Nt({ editorView: t, pagesRef: n, getDocument: r, layout: a, commentRoot
878
881
  if (!e || he() || me()) return !1;
879
882
  let n = x.value;
880
883
  if (!re.value || !n) return !1;
881
- let r = e.state.doc, i = et(e, n, _.value);
884
+ let r = e.state.doc, i = tt(e, n, _.value);
882
885
  return e.state.doc !== r && O("refresh"), i;
883
886
  },
884
887
  replaceAll: () => {
@@ -887,13 +890,13 @@ function Nt({ editorView: t, pagesRef: n, getDocument: r, layout: a, commentRoot
887
890
  replacedCount: 0,
888
891
  skippedCount: n
889
892
  };
890
- let r = e.state.doc, i = tt(e, y.value, _.value);
893
+ let r = e.state.doc, i = nt(e, y.value, _.value);
891
894
  return e.state.doc !== r && O(), i;
892
895
  },
893
896
  clear: ce
894
897
  };
895
898
  }
896
- function Pt(e, t) {
899
+ function Ft(e, t) {
897
900
  if (t < e.top + 40) {
898
901
  let n = Math.max(0, e.top + 40 - t);
899
902
  return -Math.min(12, n / 40 * 12);
@@ -905,7 +908,7 @@ function Pt(e, t) {
905
908
  return 0;
906
909
  }
907
910
  // src/composables/useDragAutoScroll.ts
908
- function Ft({ pagesContainer: e, onScrollExtendSelection: t }) {
911
+ function It({ pagesContainer: e, onScrollExtendSelection: t }) {
909
912
  let n = null, r = 0, a = 0, o = !1;
910
913
  function s() {
911
914
  return b(e.value);
@@ -917,7 +920,7 @@ function Ft({ pagesContainer: e, onScrollExtendSelection: t }) {
917
920
  if (!o) return;
918
921
  let e = s();
919
922
  if (!e) return;
920
- let i = Pt(e.getBoundingClientRect(), a);
923
+ let i = Ft(e.getBoundingClientRect(), a);
921
924
  i !== 0 && (x(e, i), t(r, a)), n = requestAnimationFrame(l);
922
925
  }
923
926
  function u() {
@@ -937,7 +940,7 @@ function Ft({ pagesContainer: e, onScrollExtendSelection: t }) {
937
940
  };
938
941
  }
939
942
  // src/composables/useTableResize.ts
940
- function It({ runCommand: e }) {
943
+ function Lt({ runCommand: e }) {
941
944
  let t = {
942
945
  active: !1,
943
946
  startX: 0,
@@ -956,7 +959,7 @@ function It({ runCommand: e }) {
956
959
  isEdge: !1,
957
960
  tablePmStart: 0,
958
961
  origHeight: 0,
959
- minimumHeight: ct
962
+ minimumHeight: lt
960
963
  }, r = {
961
964
  active: !1,
962
965
  startX: 0,
@@ -970,15 +973,15 @@ function It({ runCommand: e }) {
970
973
  }
971
974
  function o(e, a) {
972
975
  let o = e.target;
973
- 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 = T(o) ?? 0, H(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 = T(o) ?? 0, U(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 = T(o) ?? 0, W(a, r), !0) : !1 : !1;
976
+ 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 = T(o) ?? 0, Rt(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 = T(o) ?? 0, H(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 = T(o) ?? 0, U(a, r), !0) : !1 : !1;
974
977
  }
975
978
  function s(e) {
976
979
  if (t.active && t.handle) {
977
980
  e.preventDefault();
978
981
  let n = e.clientX - t.startX, r = parseFloat(t.handle.style.left);
979
982
  t.handle.style.left = `${r + n}px`, t.startX = e.clientX;
980
- let i = Math.round(n * lt), a = t.origWidths.left + i, o = t.origWidths.right - i;
981
- a >= st && o >= st && (t.origWidths = {
983
+ let i = Math.round(n * A), a = t.origWidths.left + i, o = t.origWidths.right - i;
984
+ a >= k && o >= k && (t.origWidths = {
982
985
  left: a,
983
986
  right: o
984
987
  });
@@ -986,18 +989,18 @@ function It({ runCommand: e }) {
986
989
  e.preventDefault();
987
990
  let t = e.clientY - n.startY, r = parseFloat(n.handle.style.top);
988
991
  n.startY = e.clientY;
989
- let i = Math.round(t * lt), a = ut({
992
+ let i = Math.round(t * A), a = ut({
990
993
  currentHeight: n.origHeight,
991
994
  delta: i,
992
995
  minimumHeight: n.minimumHeight
993
996
  });
994
- n.handle.style.top = `${r + a / lt}px`, n.origHeight += a;
997
+ n.handle.style.top = `${r + a / A}px`, n.origHeight += a;
995
998
  } else if (r.active && r.handle) {
996
999
  e.preventDefault();
997
1000
  let t = e.clientX - r.startX, n = parseFloat(r.handle.style.left);
998
1001
  r.handle.style.left = `${n + t}px`, r.startX = e.clientX;
999
- let i = Math.round(t * lt), a = r.origWidth + i;
1000
- a >= st && (r.origWidth = a);
1002
+ let i = Math.round(t * A), a = r.origWidth + i;
1003
+ a >= k && (r.origWidth = a);
1001
1004
  }
1002
1005
  }
1003
1006
  function c(a) {
@@ -1027,25 +1030,25 @@ function It({ runCommand: e }) {
1027
1030
  isResizing: a
1028
1031
  };
1029
1032
  }
1030
- function H(e, t) {
1033
+ function Rt(e, t) {
1031
1034
  let n = pt(e, t.tablePmStart, t.columnIndex);
1032
1035
  n && (t.origWidths = n);
1033
1036
  }
1034
- function U(e, t, n) {
1037
+ function H(e, t, n) {
1035
1038
  let r = mt(e, t.tablePmStart, t.rowIndex);
1036
1039
  if (r != null) t.origHeight = r;
1037
1040
  else {
1038
1041
  let e = n.closest(".layout-table")?.querySelector(`[data-row-index="${t.rowIndex}"]`), r = e ? e.getBoundingClientRect().height : 30;
1039
- t.origHeight = Math.round(r * lt);
1042
+ t.origHeight = Math.round(r * A);
1040
1043
  }
1041
- t.minimumHeight = Math.min(ct, t.origHeight);
1044
+ t.minimumHeight = Math.min(lt, t.origHeight);
1042
1045
  }
1043
- function W(e, t) {
1046
+ function U(e, t) {
1044
1047
  let n = ft(e, t.tablePmStart, t.columnIndex);
1045
1048
  n != null && (t.origWidth = n);
1046
1049
  }
1047
1050
  // src/composables/useTrackedChanges.ts
1048
- function Lt(t, n) {
1051
+ function W(t, n) {
1049
1052
  return e(() => {
1050
1053
  n.value;
1051
1054
  let e = t.value?.state ?? null, r = _t(e);
@@ -1070,7 +1073,7 @@ function Lt(t, n) {
1070
1073
  });
1071
1074
  }
1072
1075
  // src/composables/useZoom.ts
1073
- var Rt = vt, zt = A, G = [
1076
+ var zt = j, Bt = vt, Vt = [
1074
1077
  .5,
1075
1078
  .75,
1076
1079
  1,
@@ -1078,10 +1081,10 @@ var Rt = vt, zt = A, G = [
1078
1081
  1.5,
1079
1082
  2
1080
1083
  ];
1081
- function Bt(t = 1) {
1082
- let i = s(Math.max(Rt, Math.min(zt, t))), a = e(() => Math.round(i.value * 100)), o = e(() => i.value <= Rt), c = e(() => i.value >= zt);
1084
+ function G(t = 1) {
1085
+ let i = s(Math.max(zt, Math.min(Bt, t))), a = e(() => Math.round(i.value * 100)), o = e(() => i.value <= zt), c = e(() => i.value >= Bt);
1083
1086
  function l(e) {
1084
- i.value = Math.max(Rt, Math.min(zt, Math.round(e * 100) / 100));
1087
+ i.value = Math.max(zt, Math.min(Bt, Math.round(e * 100) / 100));
1085
1088
  }
1086
1089
  function u() {
1087
1090
  l(i.value + yt);
@@ -1113,7 +1116,7 @@ function Bt(t = 1) {
1113
1116
  handleWheel: p,
1114
1117
  handleKeyDown: m,
1115
1118
  installShortcuts: ee,
1116
- ZOOM_PRESETS: G
1119
+ ZOOM_PRESETS: Vt
1117
1120
  };
1118
1121
  }
1119
- export { Ft as a, I as c, L as d, It as i, N as l, _t as n, Nt as o, Lt as r, V as s, Bt as t, F as u };
1122
+ export { It as a, I as c, L as d, Lt as i, N as l, _t as n, V as o, W as r, B as s, G as t, F as u };