@stll/folio-vue 0.32.1 → 0.34.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (69) hide show
  1. package/dist/FindReplaceDialog-CfcTl2Ra.cjs +1 -0
  2. package/dist/FindReplaceDialog-DEWjhuOw.js +168 -0
  3. package/dist/HorizontalRuler-Cuk0l4Us.cjs +1 -0
  4. package/dist/HorizontalRuler-TM9dg--R.js +341 -0
  5. package/dist/HyperlinkDialog-BEse_y7R.js +175 -0
  6. package/dist/HyperlinkDialog-Cs1y6aol.cjs +1 -0
  7. package/dist/ImagePropertiesDialog-CTbX2GrE.cjs +1 -0
  8. package/dist/ImagePropertiesDialog-mrJ8S3sl.js +186 -0
  9. package/dist/ImageSelectionOverlay-DULrvfOJ.js +386 -0
  10. package/dist/ImageSelectionOverlay-Dr0lg9WZ.cjs +1 -0
  11. package/dist/InsertSymbolDialog-BjB-Q9EO.js +93 -0
  12. package/dist/InsertSymbolDialog-BsjgPYM-.cjs +1 -0
  13. package/dist/PageSetupDialog-CZ5fE9rz.cjs +1 -0
  14. package/dist/PageSetupDialog-DNNSezj3.js +208 -0
  15. package/dist/SetNumberingValueDialog-ClCYr37D.cjs +1 -0
  16. package/dist/SetNumberingValueDialog-CwLHfO7f.js +54 -0
  17. package/dist/SplitCellDialog-Bfuo5WCO.cjs +1 -0
  18. package/dist/SplitCellDialog-HIg4ZEqt.js +1031 -0
  19. package/dist/StylePicker-BnGGlXOX.cjs +4 -0
  20. package/dist/{StylePicker-DmTN56Yg.js → StylePicker-F3cLPvRE.js} +593 -1100
  21. package/dist/TablePropertiesDialog-CRX9Xgdr.js +102 -0
  22. package/dist/TablePropertiesDialog-ClJSuB0F.cjs +1 -0
  23. package/dist/VerticalRuler-D973NTMv.js +178 -0
  24. package/dist/VerticalRuler-DVi2P_TO.cjs +1 -0
  25. package/dist/WatermarkDialog-BYyBTlDK.cjs +1 -0
  26. package/dist/WatermarkDialog-BoAdQ-qK.js +161 -0
  27. package/dist/components/DocxEditor/types.d.ts +1 -1
  28. package/dist/components/dialogs/recentSymbols.d.ts +7 -0
  29. package/dist/composables/useDocxEditor.d.ts +4 -1
  30. package/dist/composables/useTrackedChanges.d.ts +5 -2
  31. package/dist/composables.cjs +1 -1
  32. package/dist/composables.js +1 -1
  33. package/dist/dialogs.cjs +1 -1
  34. package/dist/dialogs.js +9 -1
  35. package/dist/{SplitCellDialog-BczVYfpm.js → folio-ui-ctJdVP-s.js} +678 -2753
  36. package/dist/folio-ui-u7h3WXUO.cjs +15 -0
  37. package/dist/folio-vue.css +1 -1
  38. package/dist/index.cjs +1 -1
  39. package/dist/index.d.ts +1 -2
  40. package/dist/index.js +1666 -2064
  41. package/dist/messages/ar.cjs +1 -1
  42. package/dist/messages/cs.cjs +1 -1
  43. package/dist/messages/de.cjs +1 -1
  44. package/dist/messages/en.cjs +1 -1
  45. package/dist/messages/es.cjs +1 -1
  46. package/dist/messages/et.cjs +1 -1
  47. package/dist/messages/fr.cjs +1 -1
  48. package/dist/messages/he.cjs +1 -1
  49. package/dist/messages/hi.cjs +1 -1
  50. package/dist/messages/hu.cjs +1 -1
  51. package/dist/messages/lt.cjs +1 -1
  52. package/dist/messages/lv.cjs +1 -1
  53. package/dist/messages/pl.cjs +1 -1
  54. package/dist/messages/pt-BR.cjs +1 -1
  55. package/dist/messages/sk.cjs +1 -1
  56. package/dist/messages/tr.cjs +1 -1
  57. package/dist/messages/zh-CN.cjs +1 -1
  58. package/dist/rolldown-runtime-DbbDpzbe.cjs +1 -0
  59. package/dist/ui.cjs +1 -1
  60. package/dist/ui.js +28 -18
  61. package/dist/useZoom-BKM59EqE.js +1013 -0
  62. package/dist/useZoom-C0dkG1Q4.cjs +1 -0
  63. package/dist/utils/comments.d.ts +1 -1
  64. package/package.json +2 -2
  65. package/dist/SplitCellDialog-CrLHwVLc.cjs +0 -15
  66. package/dist/StylePicker-C0iEQnw6.cjs +0 -4
  67. package/dist/rolldown-runtime-5iZMYShA.cjs +0 -1
  68. package/dist/useZoom-1kmdkmJ4.js +0 -1006
  69. package/dist/useZoom-Bj5B9uT1.cjs +0 -1
@@ -0,0 +1,1013 @@
1
+ import { computed as e, inject as t, onBeforeUnmount as n, onMounted as r, onScopeDispose as i, provide as a, reactive as o, ref as s, shallowRef as c, toRaw as l, toValue as u, watch as d, watchEffect as f } from "vue";
2
+ import { CanonicalSessionRefusalError as p, createHiddenEditorManager as m, createHiddenEditorState as h } from "@stll/folio-core/controller/hiddenEditorManager";
3
+ import { getEditorReadOnlyReason as ee } from "@stll/folio-core/managers/EditorModeManager";
4
+ import { getEditorScrollRoot as g, scrollEditorBy as _ } from "@stll/folio-core/paged-layout/editorScrollRoot";
5
+ import { getMargins as te, getPageSize as ne, twipsToPixels as v } from "@stll/folio-core/paged-layout/sectionGeometry";
6
+ import { readModel as y } from "@stll/folio-core/types/documentModel";
7
+ import { readPaintedTableStart as b } from "@stll/folio-core/utils/paintedPositions";
8
+ import { canonicalReviewHeldRevisionIds as x } from "@stll/folio-core/controller/canonicalReview";
9
+ import { NO_ANONYMIZATION_TERMS as re } from "@stll/folio-core/controller/anonymizationHighlights";
10
+ import { createDisplayListPainterLoader as ie } from "@stll/folio-core/controller/deferredDisplayListPainter";
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";
22
+ import { holdsUniqueParagraphIds as he, openCanonicalDocx as ge, prepareCanonicalDocumentInput as _e } from "@stll/folio-core/docx/canonicalSessionInput";
23
+ import { carryParseFacts as ve, cloneDocumentWithParagraphPropertySources as ye } from "@stll/folio-core/docx/document-clone";
24
+ import { getFootnoteText as be } from "@stll/folio-core/docx/storyPlainText";
25
+ import { convertHeaderFooterPmDocToContent as xe, convertHeaderFooterToContent as Se } from "@stll/folio-core/layout-bridge/convert/headerFooterLayout";
26
+ import { resolveSectionHeaderFooterRefs as Ce } from "@stll/folio-core/layout-engine";
27
+ import { LayoutPainter as we, releaseDisplayPageResources as Te } from "@stll/folio-core/layout-painter";
28
+ import { LayoutSelectionGate as Ee } from "@stll/folio-core/paged-layout/LayoutSelectionGate";
29
+ import { ExtensionManager as De } from "@stll/folio-core/prosemirror/extensions/ExtensionManager";
30
+ import { createStarterKit as Oe } from "@stll/folio-core/prosemirror/extensions/StarterKit";
31
+ import { createTemplateDirectivesPlugin as ke } from "@stll/folio-core/prosemirror/plugins/templateDirectives";
32
+ import { createTemplatePreviewValuesPlugin as Ae } from "@stll/folio-core/prosemirror/plugins/templatePreviewValues";
33
+ import { templateSlashMenuPlugin as je } from "@stll/folio-core/prosemirror/plugins/templateSlashMenu";
34
+ import { resolveHeaderFooterContent as Me } from "@stll/folio-core/utils/headerFooter";
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";
45
+ // src/utils/colorMode.ts
46
+ var F = "(prefers-color-scheme: dark)";
47
+ function I() {
48
+ return typeof window < "u" && typeof window.matchMedia == "function";
49
+ }
50
+ function L(e, t) {
51
+ return e === "dark" || e === "system" && t;
52
+ }
53
+ function Qe(e) {
54
+ if (!I()) return () => {};
55
+ let t = window.matchMedia(F);
56
+ e(t.matches);
57
+ let n = (t) => e(t.matches);
58
+ return t.addEventListener("change", n), () => t.removeEventListener("change", n);
59
+ }
60
+ // src/composables/useColorMode.ts
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)));
65
+ } };
66
+ function $e() {
67
+ let n = t(z, e(() => R)), i = s(!1), a = s(!1);
68
+ return r(() => {
69
+ i.value = !0;
70
+ }), f((e) => {
71
+ i.value && n.value === "system" && e(Qe((e) => {
72
+ a.value = e;
73
+ }));
74
+ }), e(() => L(n.value, i.value && a.value));
75
+ }
76
+ // src/utils/rawDocument.ts
77
+ var et = (e) => H(e, /* @__PURE__ */ new Map()), H = (e, t) => {
78
+ if (typeof e != "object" || !e) return e;
79
+ let n = l(e), r = t.get(n);
80
+ if (r !== void 0) return r;
81
+ t.set(n, n);
82
+ let i = tt(n, t);
83
+ return t.set(n, i), i;
84
+ }, tt = (e, t) => {
85
+ if (ArrayBuffer.isView(e) || e instanceof ArrayBuffer) return e;
86
+ if (e instanceof Map) {
87
+ let n = !1, r = [];
88
+ for (let [i, a] of e) {
89
+ let e = H(i, t), o = H(a, t);
90
+ (e !== i || o !== a) && (n = !0), r.push([e, o]);
91
+ }
92
+ return n ? new Map(r) : e;
93
+ }
94
+ if (e instanceof Set) {
95
+ let n = !1, r = [];
96
+ for (let i of e) {
97
+ let e = H(i, t);
98
+ e !== i && (n = !0), r.push(e);
99
+ }
100
+ return n ? new Set(r) : e;
101
+ }
102
+ if (Array.isArray(e)) {
103
+ let n = !1, r = e.map((e) => {
104
+ let r = H(e, t);
105
+ return r !== e && (n = !0), r;
106
+ });
107
+ return n ? r : e;
108
+ }
109
+ let n = Object.getOwnPropertyDescriptors(e), r = !1;
110
+ for (let e of Reflect.ownKeys(n)) {
111
+ let i = Reflect.get(n, e);
112
+ if (!U(i)) continue;
113
+ let a = H(i.value, t);
114
+ a !== i.value && (r = !0, i.value = a);
115
+ }
116
+ if (!r) return e;
117
+ let i = Object.create(Reflect.getPrototypeOf(e), n);
118
+ return ve(i, e), i;
119
+ }, U = (e) => typeof e == "object" && !!e && "value" in e, nt = 24, rt = "User", it = [], at = [];
120
+ function ot(e) {
121
+ let t = e?.columnCount ?? 1;
122
+ if (t <= 1) return;
123
+ let n = {
124
+ count: t,
125
+ gap: v(e?.columnSpace ?? 720),
126
+ equalWidth: e?.equalWidth ?? !0
127
+ };
128
+ return e?.separator !== void 0 && (n.separator = e.separator), n;
129
+ }
130
+ function st(e, t, n, r, i, a) {
131
+ if (!e) return;
132
+ let o = t ? {
133
+ ...a,
134
+ rId: t
135
+ } : a, s = t ? n?.getView(t) : null;
136
+ return s ? xe(s.state.doc, r, i, o) : Se(e, r, i, o);
137
+ }
138
+ function ct(e, t, n, r, i) {
139
+ if (!e || e.size === 0) return;
140
+ let a = /* @__PURE__ */ new Map();
141
+ for (let [o, s] of e) {
142
+ let e = st(s, o, t, n, r, i);
143
+ e && a.set(o, e);
144
+ }
145
+ return a.size > 0 ? a : void 0;
146
+ }
147
+ function lt(e, t, n) {
148
+ let r = /* @__PURE__ */ new Map();
149
+ if (!n || !n.package.footnotes) return r;
150
+ let i = /* @__PURE__ */ new Map();
151
+ for (let e of n.package.footnotes) e.noteType && e.noteType !== "normal" || i.set(e.id, e);
152
+ for (let [n, a] of e) {
153
+ let e = [];
154
+ for (let n of a) {
155
+ let r = i.get(n);
156
+ if (!r) continue;
157
+ let a = t.get(n), o = a?.displayNumber ?? 0;
158
+ e.push({
159
+ displayNumber: String(o),
160
+ noteId: n,
161
+ text: be(r),
162
+ ...a ? { content: {
163
+ blocks: a.blocks,
164
+ measures: a.measures,
165
+ height: a.height
166
+ } } : {}
167
+ });
168
+ }
169
+ e.length > 0 && r.set(n, e);
170
+ }
171
+ return r;
172
+ }
173
+ var W = /* @__PURE__ */ new Set([
174
+ "black",
175
+ "blue",
176
+ "cyan",
177
+ "darkBlue",
178
+ "darkCyan",
179
+ "darkGray",
180
+ "darkGreen",
181
+ "darkMagenta",
182
+ "darkRed",
183
+ "darkYellow",
184
+ "green",
185
+ "lightGray",
186
+ "magenta",
187
+ "none",
188
+ "red",
189
+ "white",
190
+ "yellow"
191
+ ]);
192
+ function ut(e) {
193
+ let t = [], n = (e, r) => {
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)}`);
195
+ e.forEach((e, t, i) => {
196
+ n(e, `${r}.content[${i}]`);
197
+ });
198
+ };
199
+ return n(e, "doc"), t.join("; ");
200
+ }
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;
204
+ return (e && y(e).package.styles) ?? null;
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() {
215
+ return [
216
+ ...be,
217
+ ...gt() ? [pt, mt] : [],
218
+ ht
219
+ ];
220
+ }
221
+ let q = ae(), J = new Ee(), Y = pe(), vt = le({
222
+ relayout: () => {
223
+ let e = I.value?.state ?? Y.lastEditorState;
224
+ e && Z(e, { reason: "hyphenation-ready" });
225
+ },
226
+ onError: (e) => k?.(e)
227
+ });
228
+ i(vt.cancel), i(se({
229
+ measuredFontSet: () => Y.lastMeasureInputs?.fontSet ?? null,
230
+ relayout: () => {
231
+ if (F) return;
232
+ let e = I.value?.state ?? Y.lastEditorState;
233
+ e && Z(e, { reason: "font-ready" });
234
+ }
235
+ }));
236
+ let yt = new we({
237
+ pageGap: l,
238
+ showShadow: !0
239
+ }), bt = ce({
240
+ getHost: () => Je.value,
241
+ getReadOnly: () => u(o),
242
+ getCanonicalApi: () => $.api,
243
+ readCanonicalDocument: () => $.readCanonicalDocument(),
244
+ onSessionRefusal: (e, t, n) => {
245
+ W.value = e, k?.(n ?? new p({
246
+ ground: t,
247
+ message: e
248
+ }));
249
+ },
250
+ getStyles: Xe,
251
+ onTransaction: ({ rId: e, kind: t, view: n, docChanged: r, selectionChanged: i }) => {
252
+ if (r && (G.value = !0, wt.schedule()), r || i) {
253
+ let { from: r, to: i } = n.state.selection;
254
+ z.value = {
255
+ from: r,
256
+ kind: t,
257
+ rId: e,
258
+ to: i
259
+ }, Ve?.(n.state), q.emit("selectionChange", {
260
+ from: r,
261
+ to: i
262
+ });
263
+ }
264
+ J.requestRender();
265
+ }
266
+ }), X = me({
267
+ getHost: () => r?.value ?? null,
268
+ getCanonicalApi: () => $.api,
269
+ readCanonicalDocument: () => $.readCanonicalDocument(),
270
+ onSessionRefusal: (e, t, n) => {
271
+ W.value = e, k?.(n ?? new p({
272
+ ground: t,
273
+ message: e
274
+ }));
275
+ },
276
+ getStyles: Xe,
277
+ onTransaction: ({ docChanged: e, selectionChanged: t, view: n }) => {
278
+ if (e) {
279
+ G.value = !0;
280
+ let e = j.value;
281
+ e && (j.value = $.readCanonicalDocument() ?? e, Ot()), wt.schedule();
282
+ }
283
+ if (e || t) {
284
+ Ve?.(n.state);
285
+ let { from: e, to: t } = n.state.selection;
286
+ q.emit("selectionChange", {
287
+ from: e,
288
+ to: t
289
+ });
290
+ }
291
+ }
292
+ }), xt = () => {
293
+ bt.sync(), X.sync();
294
+ };
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);
297
+ }
298
+ let Ct = ie({
299
+ onReady: () => {
300
+ if (N || u(f) !== O.displayList) return;
301
+ let e = I.value;
302
+ e && Z(e.state, { reason: "layout-input" });
303
+ },
304
+ onError: (e) => {
305
+ !N && u(f) === O.displayList && k?.(e);
306
+ }
307
+ });
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);
315
+ try {
316
+ St(ue({
317
+ contentWidth: re,
318
+ columns: x,
319
+ pageSize: m,
320
+ margins: h,
321
+ pageGap: l,
322
+ showMarginGuides: u(v) === !0,
323
+ marginGuideColor: u(b),
324
+ ...r ? { displayListPagePainter: r } : {},
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,
334
+ sectionHeaderFooterRefs: Ce(c),
335
+ theme: S,
336
+ sectionProperties: p,
337
+ document: s,
338
+ defaultTabStop: C,
339
+ mirrorMargins: w,
340
+ styles: ie,
341
+ layout: V.value,
342
+ hfPMs: bt,
343
+ painter: yt,
344
+ pagesContainer: o,
345
+ session: Y,
346
+ renderHfFromContentOrPm: st,
347
+ renderHeaderFooterContentByRId: ct,
348
+ readFontSetSignature: oe,
349
+ buildFootnoteRenderItems: lt,
350
+ describeInvalidHighlightMarks: ut,
351
+ emptyTemplatePreviewEntries: it,
352
+ emptyTemplatePreviewHidden: at,
353
+ hyphenationReadiness: vt,
354
+ markupView: u(ee),
355
+ showCommentHighlights: u(g),
356
+ ..._ === void 0 ? {} : { altChunkMarkerText: u(_) }
357
+ }, e, t));
358
+ } catch (e) {
359
+ let t = e instanceof Error ? e : Error(String(e));
360
+ k?.(t);
361
+ }
362
+ }
363
+ let wt = fe({
364
+ readState: () => I.value?.state ?? null,
365
+ runLayout: (e, t) => Z(e, t),
366
+ ...D,
367
+ clock: de
368
+ }), Q = null;
369
+ function Tt() {
370
+ if (Q !== null && (window.clearTimeout(Q), Q = null), I.value && j.value) try {
371
+ let e = $.readCanonicalDocument();
372
+ if (!e) return;
373
+ j.value = e, xt(), Dt(), ft(e);
374
+ } catch (e) {
375
+ k?.(e instanceof Error ? e : Error(String(e)));
376
+ }
377
+ }
378
+ let Et = null;
379
+ function Dt() {
380
+ Et !== null && (window.clearTimeout(Et), Et = null);
381
+ }
382
+ function Ot() {
383
+ Dt(), Et = window.setTimeout(() => {
384
+ if (Et = null, Q !== null) return;
385
+ let e = j.value;
386
+ e && ft(e);
387
+ }, S);
388
+ }
389
+ function kt() {
390
+ Q !== null && window.clearTimeout(Q), Q = window.setTimeout(() => {
391
+ Q = null, Tt();
392
+ }, S);
393
+ }
394
+ let $ = m({
395
+ getHost: () => t.value,
396
+ getDocument: () => j.value,
397
+ getStyles: Xe,
398
+ getExtensionManager: () => K,
399
+ getExternalPlugins: _t,
400
+ getAnonymizationTerms: () => Fe?.() ?? re,
401
+ getDerivedFields: () => Ie?.(),
402
+ getCanonicalRoom: Qe,
403
+ getReadOnly: () => u(o),
404
+ getHistoryShortcuts: () => xe,
405
+ onCanonicalHistory: (e) => Se?.(e),
406
+ onCanonicalHistoryDrop: (e) => Ne?.(e),
407
+ getEditingMode: () => u(w) ?? "editing",
408
+ getSuggestionAuthor: Ye,
409
+ onSessionRefusal: (e, t, n) => {
410
+ k?.(n ?? new p({
411
+ ground: t,
412
+ message: e
413
+ }));
414
+ },
415
+ getDocumentIdentity: () => String(M),
416
+ getDocumentContext: () => j.value,
417
+ onTransaction: jt,
418
+ onCanonicalCompositionLayout: Mt,
419
+ getEmbeddedFontFamilyMap: () => Y.embeddedFontFamilyMap,
420
+ onSelectionChange: (e) => {
421
+ L.value = e, Ve?.(e), q.emit("selectionChange", {
422
+ from: e.selection.from,
423
+ to: e.selection.to
424
+ });
425
+ },
426
+ onKeyDown: () => !1,
427
+ onCopy: () => Ue?.(),
428
+ onCut: () => A?.(),
429
+ onPaste: () => We?.(),
430
+ onReadOnlyEditAttempt: () => Ge?.(),
431
+ onEditorViewReady: Nt,
432
+ onEditorViewDestroy: () => {
433
+ I.value = null, U.value = !1, He?.(null);
434
+ },
435
+ onRemoteSelectionsChange: (e) => {
436
+ R.value = e;
437
+ }
438
+ }), At = $.api.autocomplete.subscribe((t) => e.onAutocompleteChange?.(t));
439
+ d(() => u(Pe), () => {
440
+ R.value = [], $.retryViewCreation(), $.syncExternalDocument();
441
+ }, { immediate: !0 });
442
+ function jt({ newState: e, docChanged: t }) {
443
+ if (L.value = e, t) {
444
+ let e = $.readCanonicalDocument();
445
+ e && (j.value = e, xt()), G.value = !0, J.incrementStateSeq(), wt.schedule(), kt();
446
+ }
447
+ J.requestRender();
448
+ }
449
+ function Mt() {
450
+ let e = I.value;
451
+ e && (L.value = e.state), J.incrementStateSeq(), wt.schedule(), J.requestRender();
452
+ }
453
+ function Nt(e) {
454
+ I.value = e, L.value = e.state, U.value = !0;
455
+ let t = j.value, n = M, r = ++P;
456
+ F = !0;
457
+ let i = () => {
458
+ P === r && (F = !1, N || M !== n || $.getView() !== e || (Z(e.state, { reason: "initial" }), J.requestRender()));
459
+ };
460
+ E(t, e.state.doc).then(i, i), He?.(e), u(o) || requestAnimationFrame(() => {
461
+ I.value === e && !e.hasFocus() && e.focus();
462
+ });
463
+ }
464
+ let Pt = {
465
+ getDocx: async (e) => {
466
+ let t = await Gt(e);
467
+ return t?.tripwireResult && qe?.(t.tripwireResult), t?.buffer ?? null;
468
+ },
469
+ loadDocument: Ht,
470
+ loadDocx: Vt
471
+ }, Ft = T({
472
+ getEditorApi: () => $.api,
473
+ getLayout: () => V.value,
474
+ runLayout: (e, t) => Z(e, t),
475
+ getDocumentIO: () => Pt,
476
+ emitter: q
477
+ });
478
+ d([() => u(w), Ye], () => {
479
+ Ft.setCanonicalMode(u(w) === "suggesting" ? {
480
+ type: "suggesting",
481
+ author: Ye()
482
+ } : { type: "editing" });
483
+ }), d(() => u(o), (e) => {
484
+ $.syncEditable(), e && en(), bt.sync();
485
+ });
486
+ function It(e) {
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);
490
+ if (t) {
491
+ let e = n.indexOf(ht), t = e === -1 ? n.length : e;
492
+ n.splice(t, 0, pt, mt);
493
+ }
494
+ e.updateState(e.state.reconfigure({ plugins: n }));
495
+ }
496
+ d(() => gt(), () => {
497
+ let e = I.value;
498
+ e && It(e);
499
+ });
500
+ function Lt() {
501
+ $.ensureView();
502
+ }
503
+ function Rt() {
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();
505
+ }
506
+ function zt() {
507
+ let e = j.value;
508
+ if (e) try {
509
+ let t = h({
510
+ document: e,
511
+ styles: y(e).package.styles ?? null,
512
+ manager: K,
513
+ externalPlugins: _t(),
514
+ reason: "mount"
515
+ });
516
+ L.value = t;
517
+ let n = M, r = ++P;
518
+ F = !0;
519
+ let i = () => {
520
+ P === r && (F = !1, N || M !== n || j.value !== e || $.getView() || Z(t, { reason: "initial" }));
521
+ };
522
+ E(e, t.doc).then(i, i);
523
+ } catch (e) {
524
+ k?.(e instanceof Error ? e : Error(String(e)));
525
+ }
526
+ }
527
+ d([
528
+ t,
529
+ a,
530
+ Je,
531
+ ...r ? [r] : []
532
+ ], () => {
533
+ t.value && j.value && !$.getView() && Lt(), xt();
534
+ }, { flush: "post" });
535
+ let Bt = 0;
536
+ async function Vt(e) {
537
+ Bt += 1, W.value = null, U.value = !1;
538
+ try {
539
+ let t = await ge(e, { password: u(x) });
540
+ if (t.isErr()) throw t.error;
541
+ let n = t.value.document;
542
+ j.value = n, Rt();
543
+ } catch (e) {
544
+ let t = e instanceof Error ? e : Error(String(e));
545
+ W.value = t.message, k?.(t);
546
+ }
547
+ }
548
+ function Ht(e) {
549
+ let t = Bt += 1;
550
+ W.value = null;
551
+ let n = et(e);
552
+ he(n) ? Wt(n) : Ut(n, t);
553
+ }
554
+ async function Ut(e, t) {
555
+ let n = await _e(e);
556
+ t === Bt && (n.isErr() ? (W.value = n.error.message, k?.(n.error)) : Wt(n.value));
557
+ }
558
+ function Wt(e) {
559
+ j.value = e, Rt();
560
+ }
561
+ async function Gt(e) {
562
+ let t = I.value, n = j.value;
563
+ if (!t || !n) return null;
564
+ try {
565
+ let t = $.api.captureCanonicalSave();
566
+ if (t) {
567
+ let n = u(Ke), { canonicalSaveDiagnosticError: r, serializeCanonicalSave: i } = await import("@stll/folio-core/docx/canonicalSave"), a = await i({
568
+ snapshot: t,
569
+ options: e,
570
+ featureFlags: n
571
+ });
572
+ for (let t of a.diagnostics) e?.onDiagnostic || k?.(r(t));
573
+ return a;
574
+ }
575
+ return null;
576
+ } catch (e) {
577
+ return k?.(e instanceof Error ? e : Error(String(e))), null;
578
+ }
579
+ }
580
+ async function Kt(e) {
581
+ let t = I.value, n = t?.state, r = await Gt({
582
+ onDiagnostic: e?.onDiagnostic,
583
+ onSelectiveDecline: e?.onSelectiveDecline,
584
+ onSerializationPath: e?.onSerializationPath,
585
+ mode: e?.selective === !1 ? C.full : C.preferSelective
586
+ });
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, {
588
+ buffer: r.buffer,
589
+ path: r.path
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;
591
+ }
592
+ function qt() {
593
+ return $.readCanonicalDocument();
594
+ }
595
+ function Jt() {
596
+ return qt();
597
+ }
598
+ function Yt() {
599
+ let e = Jt();
600
+ return e && dt(e);
601
+ }
602
+ function Xt(e) {
603
+ Ht(e);
604
+ }
605
+ function Zt(e) {
606
+ return bt.getView(e);
607
+ }
608
+ function Qt() {
609
+ xt();
610
+ }
611
+ function $t(e) {
612
+ let t = X.activate(e);
613
+ t && (B.value = e, requestAnimationFrame(() => t.focus()));
614
+ }
615
+ function en() {
616
+ X.activate(null), B.value = null;
617
+ }
618
+ function tn() {
619
+ let e = B.value;
620
+ return e ? X.getView(e) : null;
621
+ }
622
+ function nn() {
623
+ return K.getCommands();
624
+ }
625
+ function rn() {
626
+ let e = tn();
627
+ e ? e.focus() : I.value?.focus();
628
+ }
629
+ function an() {
630
+ let e = I.value;
631
+ e && Z(e.state, { reason: "manual" });
632
+ }
633
+ d([
634
+ () => u(v),
635
+ () => u(b),
636
+ () => u(f),
637
+ () => u(ee),
638
+ () => u(g),
639
+ () => u(_)
640
+ ], () => an());
641
+ function on() {
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;
643
+ }
644
+ return i(() => {
645
+ on(), At();
646
+ }), {
647
+ setEmbeddedFontFamilies: (e) => {
648
+ e ? Y.embeddedFontFamilyMap = new Map(e) : delete Y.embeddedFontFamilyMap, $.refreshFonts();
649
+ },
650
+ editor: Ft,
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,
660
+ readDocumentModel: qt,
661
+ sourceBuffer: Ze,
662
+ hiddenEditorWidth: $e,
663
+ layout: V,
664
+ blocks: H,
665
+ measures: tt,
666
+ syncCoordinator: J,
667
+ loadBuffer: Vt,
668
+ loadDocument: Ht,
669
+ save: Kt,
670
+ getDocument: Yt,
671
+ readDocument: Jt,
672
+ setDocument: Xt,
673
+ getHeaderFooterView: Zt,
674
+ syncHeaderFooterViews: Qt,
675
+ openNoteStory: $t,
676
+ closeNoteStory: en,
677
+ getActiveNoteView: tn,
678
+ getCommands: nn,
679
+ focus: rn,
680
+ reLayout: an,
681
+ destroy: on
682
+ };
683
+ }
684
+ // src/composables/useFindReplace.ts
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({
687
+ editingMode: t.value?.editable === !1 ? "viewing" : "editing",
688
+ readOnlyProp: p.value,
689
+ displayMode: f.value
690
+ }), re = e(x), ie = e(() => {
691
+ let e = b.value;
692
+ return x() === null && !!t.value && !!e && ae() && Be(e).status === "allowed";
693
+ }), S = null, C, w = null, T = (e) => {
694
+ let n = t.value?.state.doc;
695
+ return {
696
+ query: _.value,
697
+ options: {
698
+ ...ne,
699
+ displayMode: f.value,
700
+ includeComments: !!l
701
+ },
702
+ document: e,
703
+ ...n ? { bodyVersion: n } : {},
704
+ context: { renderedStories: Re(a.value) }
705
+ };
706
+ }, ae = () => {
707
+ let e = r();
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;
713
+ }, le = () => {
714
+ ce(), _.value = "", E();
715
+ }, ue = (e) => (y.value = e, S?.navigate(e, u), E(), !0), D = (e = "query") => {
716
+ se();
717
+ let i = r(), o = n.value, s = t.value?.state.doc;
718
+ if (!i || !_.value.trim()) return le(), [];
719
+ let c = T(i), u = Pe({
720
+ document: c.document,
721
+ state: t.value?.state ?? null,
722
+ searchText: c.query,
723
+ options: c.options,
724
+ context: c.context
725
+ });
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({
729
+ container: o,
730
+ document: i,
731
+ bodyDoc: s,
732
+ matches: u,
733
+ commentRoot: l?.value ?? void 0,
734
+ layout: a.value
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) => {
739
+ let t = g.goTo(e);
740
+ return t ? ue(t.index) : !1;
741
+ }, me = (e) => {
742
+ let t = g.navigate(e);
743
+ return t ? (ue(t.index), t.match) : null;
744
+ }, O = () => !ae() && (D("refresh"), !0), he = () => {
745
+ let e = x();
746
+ return e !== null && (m?.(e), !0);
747
+ };
748
+ return d(f, () => {
749
+ _.value.trim() && D();
750
+ }), i(() => {
751
+ se(), S?.destroy();
752
+ }), {
753
+ searchText: _,
754
+ replaceText: te,
755
+ options: ne,
756
+ matches: v,
757
+ currentIndex: y,
758
+ currentMatch: b,
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"),
768
+ replaceCurrent: () => {
769
+ let e = t.value;
770
+ if (!e || he() || O()) return !1;
771
+ let n = b.value;
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;
775
+ },
776
+ replaceAll: () => {
777
+ let e = t.value, n = v.value.length;
778
+ if (!e || he() || O()) return {
779
+ replacedCount: 0,
780
+ skippedCount: n
781
+ };
782
+ let r = e.state.doc, i = Ie(e, v.value, te.value);
783
+ return e.state.doc !== r && D(), i;
784
+ },
785
+ clear: le
786
+ };
787
+ }
788
+ function ft(e, t) {
789
+ if (t < e.top + 40) {
790
+ let n = Math.max(0, e.top + 40 - t);
791
+ return -Math.min(12, n / 40 * 12);
792
+ }
793
+ if (t > e.bottom - 40) {
794
+ let n = Math.max(0, t - (e.bottom - 40));
795
+ return Math.min(12, n / 40 * 12);
796
+ }
797
+ return 0;
798
+ }
799
+ // src/composables/useDragAutoScroll.ts
800
+ function K({ pagesContainer: e, onScrollExtendSelection: t }) {
801
+ let n = null, r = 0, a = 0, o = !1;
802
+ function s() {
803
+ return g(e.value);
804
+ }
805
+ function c() {
806
+ o = !1, n !== null && (cancelAnimationFrame(n), n = null);
807
+ }
808
+ function l() {
809
+ if (!o) return;
810
+ let e = s();
811
+ if (!e) return;
812
+ let i = ft(e.getBoundingClientRect(), a);
813
+ i !== 0 && (_(e, i), t(r, a)), n = requestAnimationFrame(l);
814
+ }
815
+ function u() {
816
+ o || (o = !0, n = requestAnimationFrame(l));
817
+ }
818
+ function d(e, t) {
819
+ if (r = e, a = t, !o) {
820
+ let e = s();
821
+ if (!e) return;
822
+ let n = e.getBoundingClientRect();
823
+ (t < n.top + 40 || t > n.bottom - 40) && u();
824
+ }
825
+ }
826
+ return i(() => c()), {
827
+ updateMousePosition: d,
828
+ stopAutoScroll: c
829
+ };
830
+ }
831
+ // src/composables/useTableResize.ts
832
+ function pt({ runCommand: e }) {
833
+ let t = {
834
+ active: !1,
835
+ startX: 0,
836
+ handle: null,
837
+ columnIndex: 0,
838
+ tablePmStart: 0,
839
+ origWidths: {
840
+ left: 0,
841
+ right: 0
842
+ }
843
+ }, n = {
844
+ active: !1,
845
+ startY: 0,
846
+ handle: null,
847
+ rowIndex: 0,
848
+ isEdge: !1,
849
+ tablePmStart: 0,
850
+ origHeight: 0,
851
+ minimumHeight: Ue
852
+ }, r = {
853
+ active: !1,
854
+ startX: 0,
855
+ handle: null,
856
+ columnIndex: 0,
857
+ tablePmStart: 0,
858
+ origWidth: 0
859
+ }, i = null;
860
+ function a() {
861
+ return t.active || n.active || r.active;
862
+ }
863
+ function o(e, a) {
864
+ let o = e.target;
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;
866
+ }
867
+ function s(e) {
868
+ if (t.active && t.handle) {
869
+ e.preventDefault();
870
+ let n = e.clientX - t.startX, r = parseFloat(t.handle.style.left);
871
+ t.handle.style.left = `${r + n}px`, t.startX = e.clientX;
872
+ let i = Math.round(n * A), a = t.origWidths.left + i, o = t.origWidths.right - i;
873
+ a >= He && o >= He && (t.origWidths = {
874
+ left: a,
875
+ right: o
876
+ });
877
+ } else if (n.active && n.handle) {
878
+ e.preventDefault();
879
+ let t = e.clientY - n.startY, r = parseFloat(n.handle.style.top);
880
+ n.startY = e.clientY;
881
+ let i = Math.round(t * A), a = We({
882
+ currentHeight: n.origHeight,
883
+ delta: i,
884
+ minimumHeight: n.minimumHeight
885
+ });
886
+ n.handle.style.top = `${r + a / A}px`, n.origHeight += a;
887
+ } else if (r.active && r.handle) {
888
+ e.preventDefault();
889
+ let t = e.clientX - r.startX, n = parseFloat(r.handle.style.left);
890
+ r.handle.style.left = `${n + t}px`, r.startX = e.clientX;
891
+ let i = Math.round(t * A), a = r.origWidth + i;
892
+ a >= He && (r.origWidth = a);
893
+ }
894
+ }
895
+ function c(a) {
896
+ t.active ? (t.active = !1, t.handle?.classList.remove("dragging"), i && e(i, Ge({
897
+ pmStart: t.tablePmStart,
898
+ colIdx: t.columnIndex,
899
+ newLeft: t.origWidths.left,
900
+ newRight: t.origWidths.right
901
+ })), t.handle = null) : n.active ? (n.active = !1, n.handle?.classList.remove("dragging"), i && e(i, j({
902
+ pmStart: n.tablePmStart,
903
+ rowIdx: n.rowIndex,
904
+ newHeight: n.origHeight
905
+ })), n.handle = null) : r.active && (r.active = !1, r.handle?.classList.remove("dragging"), i && e(i, Ye({
906
+ pmStart: r.tablePmStart,
907
+ colIdx: r.columnIndex,
908
+ newWidth: r.origWidth
909
+ })), r.handle = null);
910
+ }
911
+ function l() {
912
+ return document.addEventListener("mousemove", s), document.addEventListener("mouseup", c), () => {
913
+ document.removeEventListener("mousemove", s), document.removeEventListener("mouseup", c);
914
+ };
915
+ }
916
+ return {
917
+ tryStartResize: o,
918
+ install: l,
919
+ isResizing: a
920
+ };
921
+ }
922
+ function mt(e, t) {
923
+ let n = qe(e, t.tablePmStart, t.columnIndex);
924
+ n && (t.origWidths = n);
925
+ }
926
+ function ht(e, t, n) {
927
+ let r = Je(e, t.tablePmStart, t.rowIndex);
928
+ if (r != null) t.origHeight = r;
929
+ else {
930
+ let e = n.closest(".layout-table")?.querySelector(`[data-row-index="${t.rowIndex}"]`), r = e ? e.getBoundingClientRect().height : 30;
931
+ t.origHeight = Math.round(r * A);
932
+ }
933
+ t.minimumHeight = Math.min(Ue, t.origHeight);
934
+ }
935
+ function gt(e, t) {
936
+ let n = Ke(e, t.tablePmStart, t.columnIndex);
937
+ n != null && (t.origWidth = n);
938
+ }
939
+ // src/composables/useTrackedChanges.ts
940
+ function _t(t, n, r) {
941
+ return e(() => {
942
+ n.value;
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);
958
+ e.heldByLock = {
959
+ accept: t.some((e) => a.accept.has(e)),
960
+ reject: t.some((e) => a.reject.has(e))
961
+ };
962
+ }
963
+ return i;
964
+ });
965
+ }
966
+ // src/composables/useZoom.ts
967
+ var q = N, J = M, Y = [
968
+ .5,
969
+ .75,
970
+ 1,
971
+ 1.25,
972
+ 1.5,
973
+ 2
974
+ ];
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);
977
+ function l(e) {
978
+ i.value = Math.max(q, Math.min(J, Math.round(e * 100) / 100));
979
+ }
980
+ function u() {
981
+ l(i.value + P);
982
+ }
983
+ function d() {
984
+ l(i.value - P);
985
+ }
986
+ function f() {
987
+ l(1);
988
+ }
989
+ function p(e) {
990
+ (e.ctrlKey || e.metaKey) && (e.preventDefault(), e.deltaY < 0 ? u() : d());
991
+ }
992
+ function m(e) {
993
+ (e.ctrlKey || e.metaKey) && (e.shiftKey || e.altKey || (e.key === "=" || e.key === "+" ? (e.preventDefault(), u()) : e.key === "-" ? (e.preventDefault(), d()) : e.key === "0" && (e.preventDefault(), f())));
994
+ }
995
+ function h() {
996
+ r(() => document.addEventListener("keydown", m)), n(() => document.removeEventListener("keydown", m));
997
+ }
998
+ return {
999
+ zoom: i,
1000
+ zoomPercent: a,
1001
+ isMinZoom: o,
1002
+ isMaxZoom: c,
1003
+ setZoom: l,
1004
+ zoomIn: u,
1005
+ zoomOut: d,
1006
+ resetZoom: f,
1007
+ handleWheel: p,
1008
+ handleKeyDown: m,
1009
+ installShortcuts: h,
1010
+ ZOOM_PRESETS: Y
1011
+ };
1012
+ }
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 };