@eigenpal/docx-editor-vue 1.0.2 → 1.1.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.
package/dist/index.js CHANGED
@@ -1,36 +1,34 @@
1
- import { a as e, c as t, d as n, f as r, i, l as a, n as o, o as s, p as c, r as l, s as u, t as d, u as f } from "./KeyboardShortcutsDialog-BtJB9UOD.js";
2
- import { a as p, c as m, h, i as g, o as _, s as ee, t as v, x as y } from "./MenuBar-D_Dvwb0F.js";
3
- import { t as b } from "./_plugin-vue_export-helper-B52Kst-M.js";
4
- import { n as x } from "./RenderedDomContext-CHc18N_2.js";
5
- import { t as te } from "./zIndex-CxELVe_L.js";
6
- import { n as ne, r as re, t as S } from "./useTableResize-1oSe9Kjk.js";
7
- import { Fragment as C, Teleport as ie, computed as w, createApp as ae, createBlock as T, createCommentVNode as E, createElementBlock as D, createElementVNode as O, createSlots as oe, createStaticVNode as se, createVNode as k, defineComponent as A, h as ce, nextTick as j, normalizeClass as le, normalizeStyle as M, onBeforeUnmount as N, onMounted as P, openBlock as F, ref as I, renderList as L, renderSlot as ue, resolveDynamicComponent as de, shallowRef as fe, toDisplayString as R, unref as z, vModelText as B, watch as V, withCtx as H, withDirectives as U, withKeys as W, withModifiers as G } from "vue";
8
- import { clearFormatting as pe, findHyperlinkRangeAt as K } from "@eigenpal/docx-editor-core/prosemirror/commands/formatting";
9
- import { SIDEBAR_DOCUMENT_SHIFT as me, findWordBoundaries as he, pixelsToEmu as ge, readDocxFileFromInput as q, toArrayBuffer as _e } from "@eigenpal/docx-editor-core/utils";
10
- import { getTableContext as ve } from "@eigenpal/docx-editor-core/prosemirror/extensions/nodes/TableExtension";
11
- import { EditorState as ye, NodeSelection as be, TextSelection as xe } from "prosemirror-state";
12
- import { clickToPositionDom as Se, getCaretPositionFromDom as Ce, getSelectionRectsFromDom as we } from "@eigenpal/docx-editor-core/layout-bridge/clickToPositionDom";
13
- import { IMAGE_LAYOUT_OPTIONS as Te, captureInlinePositionEmu as Ee, deriveLayoutChoice as J, findImageElement as De, isImageLayoutOptionEnabled as Oe, toolbarValueToLayoutTarget as ke } from "@eigenpal/docx-editor-core/layout-painter";
14
- import { EditorView as Ae } from "prosemirror-view";
15
- import { singletonManager as je } from "@eigenpal/docx-editor-core/prosemirror/schema";
16
- import { headerFooterToProseDoc as Me, proseDocToBlocks as Ne } from "@eigenpal/docx-editor-core/prosemirror/conversion";
17
- import "prosemirror-view/style/prosemirror.css";
18
- import { pointsToHalfPoints as Pe, twipsToPixels as Fe } from "@eigenpal/docx-editor-core/utils/units";
19
- import { clickToPositionDom as Y, findBodyPmSpans as X } from "@eigenpal/docx-editor-core/layout-bridge";
20
- import { findPageIndexContainingPmPos as Ie } from "@eigenpal/docx-editor-core/layout-engine";
21
- import { applyStyle as Z, removeTabStop as Le, setIndentFirstLine as Re, setIndentLeft as ze, setIndentRight as Be } from "@eigenpal/docx-editor-core/prosemirror/commands/paragraph";
22
- import { createStyleResolver as Ve } from "@eigenpal/docx-editor-core/prosemirror/styles";
23
- import { insertPageBreak as He } from "@eigenpal/docx-editor-core/prosemirror/commands/pageBreak";
24
- import { mapHexToHighlightName as Ue } from "@eigenpal/docx-editor-core/utils/highlightColors";
25
- import { collectHeadings as We } from "@eigenpal/docx-editor-core/utils/headingCollector";
26
- import { acceptChange as Ge, rejectChange as Ke } from "@eigenpal/docx-editor-core/prosemirror/commands";
27
- import { extractTrackedChanges as qe } from "@eigenpal/docx-editor-core/prosemirror/utils/extractTrackedChanges";
28
- import { TABLE_INSERT_HIDE_DELAY_MS as Je, detectTableInsertHover as Ye } from "@eigenpal/docx-editor-core/layout-bridge/tableInsertHover";
29
- import { openReportIssue as Xe } from "@eigenpal/docx-editor-core/utils/reportIssue";
30
- import { LayoutSelectionGate as Ze } from "@eigenpal/docx-editor-core/prosemirror";
31
- import { createDocumentWithText as Qe, createEmptyDocument as $e } from "@eigenpal/docx-editor-core";
1
+ import { a as e, c as t, d as n, f as r, i, l as a, n as o, o as s, p as c, r as l, s as u, t as d, u as f } from "./KeyboardShortcutsDialog-5ZsgieYf.js";
2
+ import { a as p, c as m, h, i as g, o as _, s as v, t as y, x as b } from "./MenuBar-DLXxthZk.js";
3
+ import { t as x } from "./_plugin-vue_export-helper-B52Kst-M.js";
4
+ import { n as S } from "./RenderedDomContext-CHc18N_2.js";
5
+ import { t as ee } from "./zIndex-CxELVe_L.js";
6
+ import { n as te, r as ne, t as C } from "./useTableResize-BbyKMoa9.js";
7
+ import { Fragment as w, Teleport as T, computed as E, createApp as re, createBlock as ie, createCommentVNode as D, createElementBlock as O, createElementVNode as k, createSlots as ae, createStaticVNode as oe, createVNode as A, defineComponent as j, h as se, nextTick as ce, normalizeClass as M, normalizeStyle as N, onBeforeUnmount as P, onMounted as F, openBlock as I, ref as L, renderList as R, renderSlot as le, resolveDynamicComponent as ue, shallowRef as de, toDisplayString as z, unref as B, vModelText as V, watch as H, withCtx as U, withDirectives as W, withKeys as G, withModifiers as K } from "vue";
8
+ import { NodeSelection as q, TextSelection as fe } from "prosemirror-state";
9
+ import { clickToPositionDom as pe, computeHfCaretRectFromView as me, findBodyPmSpans as he } from "@eigenpal/docx-editor-core/layout-bridge";
10
+ import { clearFormatting as J, findHyperlinkRangeAt as Y } from "@eigenpal/docx-editor-core/prosemirror/commands/formatting";
11
+ import { SIDEBAR_DOCUMENT_SHIFT as ge, findWordBoundaries as _e, loadFontDefinitions as ve, onFontError as ye, pixelsToEmu as be, readDocxFileFromInput as xe, toArrayBuffer as Se } from "@eigenpal/docx-editor-core/utils";
12
+ import { getTableContext as Ce } from "@eigenpal/docx-editor-core/prosemirror/extensions/nodes/TableExtension";
13
+ import { clickToPositionDom as we, getCaretPositionFromDom as Te, getSelectionRectsFromDom as Ee } from "@eigenpal/docx-editor-core/layout-bridge/clickToPositionDom";
14
+ import { IMAGE_LAYOUT_OPTIONS as X, captureInlinePositionEmu as De, deriveLayoutChoice as Oe, findImageElement as ke, isImageLayoutOptionEnabled as Ae, toolbarValueToLayoutTarget as je } from "@eigenpal/docx-editor-core/layout-painter";
15
+ import { proseDocToBlocks as Me } from "@eigenpal/docx-editor-core/prosemirror/conversion";
16
+ import { LayoutSelectionGate as Ne, schema as Pe } from "@eigenpal/docx-editor-core/prosemirror";
17
+ import { pointsToHalfPoints as Fe, twipsToPixels as Ie } from "@eigenpal/docx-editor-core/utils/units";
18
+ import { makeRevisionInfo as Z } from "@eigenpal/docx-editor-core/prosemirror/plugins";
19
+ import { findPageIndexContainingPmPos as Le } from "@eigenpal/docx-editor-core/layout-engine";
20
+ import { applyStyle as Re, removeTabStop as ze, setIndentFirstLine as Be, setIndentLeft as Ve, setIndentRight as He } from "@eigenpal/docx-editor-core/prosemirror/commands/paragraph";
21
+ import { createStyleResolver as Ue } from "@eigenpal/docx-editor-core/prosemirror/styles";
22
+ import { insertPageBreak as We } from "@eigenpal/docx-editor-core/prosemirror/commands/pageBreak";
23
+ import { mapHexToHighlightName as Ge } from "@eigenpal/docx-editor-core/utils/highlightColors";
24
+ import { collectHeadings as Ke } from "@eigenpal/docx-editor-core/utils/headingCollector";
25
+ import { acceptChange as qe, acceptChangeById as Je, insertImageNode as Ye, rejectChange as Xe, rejectChangeById as Ze } from "@eigenpal/docx-editor-core/prosemirror/commands";
26
+ import { extractTrackedChanges as Qe } from "@eigenpal/docx-editor-core/prosemirror/utils/extractTrackedChanges";
27
+ import { TABLE_INSERT_HIDE_DELAY_MS as $e, detectTableInsertHover as et } from "@eigenpal/docx-editor-core/layout-bridge/tableInsertHover";
28
+ import { openReportIssue as tt } from "@eigenpal/docx-editor-core/utils/reportIssue";
29
+ import { createDocumentWithText as nt, createEmptyDocument as rt } from "@eigenpal/docx-editor-core";
32
30
  //#region src/utils/paraTextHelpers.ts
33
- function et(e, t) {
31
+ function it(e, t) {
34
32
  if (!t.trim()) return null;
35
33
  let n = null;
36
34
  return e.descendants((e, r) => n ? !1 : e.isTextblock && e.attrs?.paraId === t ? (n = {
@@ -38,11 +36,11 @@ function et(e, t) {
38
36
  to: r + e.nodeSize
39
37
  }, !1) : !0), n;
40
38
  }
41
- function tt(e) {
39
+ function at(e) {
42
40
  let t = [];
43
41
  return e.descendants((e) => !e.isText || !e.text ? !0 : e.marks.some((e) => e.type.name === "insertion") ? !1 : (t.push(e.text), !0)), t.join("");
44
42
  }
45
- function nt(e, t, n) {
43
+ function ot(e, t, n) {
46
44
  if (t >= n) return "";
47
45
  let r = [];
48
46
  return e.nodesBetween(t, n, (e, i) => {
@@ -51,7 +49,7 @@ function nt(e, t, n) {
51
49
  a < o && r.push(e.text.slice(a - i, o - i));
52
50
  }), r.join("");
53
51
  }
54
- function rt(e, t, n, r) {
52
+ function st(e, t, n, r) {
55
53
  if (!r) return null;
56
54
  let i = "", a = [];
57
55
  e.nodesBetween(t, n, (e, t) => {
@@ -78,7 +76,7 @@ function rt(e, t, n, r) {
78
76
  }
79
77
  //#endregion
80
78
  //#region src/utils/refApiQueries.ts
81
- function it(e, t, n) {
79
+ function ct(e, t, n) {
82
80
  if (!e || !t) return [];
83
81
  let r = n?.caseSensitive ?? !1, i = n?.limit ?? 20, a = r ? t : t.toLowerCase(), o = [];
84
82
  return e.state.doc.descendants((e) => {
@@ -86,7 +84,7 @@ function it(e, t, n) {
86
84
  if (!e.isTextblock) return !0;
87
85
  let n = e.attrs?.paraId;
88
86
  if (!n) return !1;
89
- let s = tt(e), c = r ? s : s.toLowerCase(), l = c.indexOf(a);
87
+ let s = at(e), c = r ? s : s.toLowerCase(), l = c.indexOf(a);
90
88
  return l === -1 || c.indexOf(a, l + 1) !== -1 || o.push({
91
89
  paraId: n,
92
90
  match: s.slice(l, l + t.length),
@@ -95,13 +93,13 @@ function it(e, t, n) {
95
93
  }), !1;
96
94
  }), o;
97
95
  }
98
- function at(e) {
96
+ function lt(e) {
99
97
  if (!e) return null;
100
98
  let { selection: t, doc: n } = e.state, r = t.$from, i = r.depth;
101
99
  for (; i > 0 && !r.node(i).isTextblock;) i--;
102
100
  let a = i > 0 ? r.node(i) : null;
103
101
  if (!a) return null;
104
- let o = a.attrs?.paraId ?? null, s = r.start(i), c = s + a.content.size, l = nt(n, s, t.from), u = nt(n, t.from, t.to), d = nt(n, t.to, c);
102
+ let o = a.attrs?.paraId ?? null, s = r.start(i), c = s + a.content.size, l = ot(n, s, t.from), u = ot(n, t.from, t.to), d = ot(n, t.to, c);
105
103
  return {
106
104
  paraId: o,
107
105
  selectedText: u,
@@ -110,7 +108,7 @@ function at(e) {
110
108
  after: d
111
109
  };
112
110
  }
113
- function ot(e, t, n) {
111
+ function ut(e, t, n) {
114
112
  if (!t || !e) return null;
115
113
  let r = t.pages[n - 1];
116
114
  if (!r) return null;
@@ -124,7 +122,7 @@ function ot(e, t, n) {
124
122
  let o = r.attrs?.paraId;
125
123
  !o || i.has(o) || (i.add(o), a.push({
126
124
  paraId: o,
127
- text: tt(r),
125
+ text: at(r),
128
126
  styleId: r.attrs?.styleId ?? void 0
129
127
  }));
130
128
  }
@@ -136,7 +134,7 @@ function ot(e, t, n) {
136
134
  }
137
135
  //#endregion
138
136
  //#region src/components/DecorationLayer.vue
139
- var st = /* @__PURE__ */ A({
137
+ var dt = /* @__PURE__ */ j({
140
138
  __name: "DecorationLayer",
141
139
  props: {
142
140
  getView: { type: Function },
@@ -146,7 +144,7 @@ var st = /* @__PURE__ */ A({
146
144
  syncCoordinator: {}
147
145
  },
148
146
  setup(e) {
149
- let t = e, n = I(null), r = I(0), i = null, a = null;
147
+ let t = e, n = L(null), r = L(0), i = null, a = null;
150
148
  function o() {
151
149
  i !== null && cancelAnimationFrame(i), i = requestAnimationFrame(() => {
152
150
  i = null;
@@ -154,13 +152,13 @@ var st = /* @__PURE__ */ A({
154
152
  !e || !r || !a || t.syncCoordinator.isSafeToRender() && s(e, r, a, t.zoom);
155
153
  });
156
154
  }
157
- P(() => {
155
+ F(() => {
158
156
  a = t.syncCoordinator.onRender(() => {
159
157
  r.value++;
160
158
  }), o();
161
- }), N(() => {
159
+ }), P(() => {
162
160
  i !== null && (cancelAnimationFrame(i), i = null), a?.();
163
- }), V(() => [
161
+ }), H(() => [
164
162
  t.zoom,
165
163
  t.transactionVersion,
166
164
  r.value
@@ -171,7 +169,7 @@ var st = /* @__PURE__ */ A({
171
169
  n.firstChild && n.replaceChildren();
172
170
  return;
173
171
  }
174
- let a = x(t, r), o = a.getContainerOffset(), s = document.createDocumentFragment();
172
+ let a = S(t, r), o = a.getContainerOffset(), s = document.createDocumentFragment();
175
173
  for (let { decoration: t, from: n, to: r } of i) {
176
174
  if (n === r) {
177
175
  let r = l(t, e);
@@ -221,20 +219,20 @@ var st = /* @__PURE__ */ A({
221
219
  function u(e) {
222
220
  return e.type?.attrs ?? null;
223
221
  }
224
- return (e, t) => (F(), D("div", {
222
+ return (e, t) => (I(), O("div", {
225
223
  ref_key: "overlayRef",
226
224
  ref: n,
227
225
  class: "paged-editor__decoration-overlay",
228
226
  "aria-hidden": "true"
229
227
  }, null, 512));
230
228
  }
231
- }), ct = ["data-handle", "onMousedown"], lt = ["title"], ut = {
229
+ }), ft = ["data-handle", "onMousedown"], pt = ["title"], mt = {
232
230
  key: 0,
233
231
  class: "image-overlay__dim"
234
- }, dt = {
232
+ }, ht = {
235
233
  key: 1,
236
234
  class: "image-overlay__dim image-overlay__dim--rotate"
237
- }, ft = 4, pt = 15, mt = /* @__PURE__ */ b(/* @__PURE__ */ A({
235
+ }, gt = 4, _t = 15, vt = /* @__PURE__ */ x(/* @__PURE__ */ j({
238
236
  __name: "ImageSelectionOverlay",
239
237
  props: {
240
238
  imageInfo: {},
@@ -248,8 +246,8 @@ var st = /* @__PURE__ */ A({
248
246
  "context-menu"
249
247
  ],
250
248
  setup(e, { emit: t }) {
251
- let { t: r } = n(), i = e, a = t, o = I(null), s = I(!1), c = I(!1), l = I(!1), u = I(0), d = I(0), f = I(0), p = I(null), m = "se", h = 0, g = 0, _ = 0, ee = 0, v = null, y = null, b = null, x = null;
252
- function ne(e, t) {
249
+ let { t: r } = n(), i = e, a = t, o = L(null), s = L(!1), c = L(!1), l = L(!1), u = L(0), d = L(0), f = L(0), p = L(null), m = "se", h = 0, g = 0, _ = 0, v = 0, y = null, b = null, x = null, S = null;
250
+ function te(e, t) {
253
251
  if (!e) return null;
254
252
  try {
255
253
  let n = e.state.doc.nodeAt(t);
@@ -258,20 +256,20 @@ var st = /* @__PURE__ */ A({
258
256
  return null;
259
257
  }
260
258
  }
261
- function re() {
259
+ function ne() {
262
260
  let e = i.imageInfo;
263
261
  if (!e) return null;
264
262
  if (e.element.isConnected) return e.element;
265
263
  let t = o.value?.closest(".docx-editor-vue__pages-viewport")?.querySelector(".docx-editor-vue__pages");
266
264
  if (!t) return null;
267
265
  for (let n of t.querySelectorAll(`[data-pm-start="${e.pmPos}"]`)) {
268
- let e = De(n);
266
+ let e = ke(n);
269
267
  if (e) return e;
270
268
  }
271
269
  return null;
272
270
  }
273
- function S() {
274
- let e = re();
271
+ function C() {
272
+ let e = ne();
275
273
  if (!e || !o.value) {
276
274
  p.value = null;
277
275
  return;
@@ -289,18 +287,18 @@ var st = /* @__PURE__ */ A({
289
287
  height: r.height / a
290
288
  };
291
289
  }
292
- V(() => i.imageInfo, async () => {
293
- await j(), S();
294
- }, { immediate: !0 }), V(() => i.imageInfo, (e, t, n) => {
290
+ H(() => i.imageInfo, async () => {
291
+ await ce(), C();
292
+ }, { immediate: !0 }), H(() => i.imageInfo, (e, t, n) => {
295
293
  if (!i.imageInfo) return;
296
294
  let r = () => {
297
- y && cancelAnimationFrame(y), y = requestAnimationFrame(S);
295
+ b && cancelAnimationFrame(b), b = requestAnimationFrame(C);
298
296
  }, a = o.value?.closest(".docx-editor-vue__pages-viewport")?.parentElement;
299
297
  a?.addEventListener("scroll", r, { passive: !0 }), window.addEventListener("resize", r, { passive: !0 }), n(() => {
300
- a?.removeEventListener("scroll", r), window.removeEventListener("resize", r), y && cancelAnimationFrame(y);
298
+ a?.removeEventListener("scroll", r), window.removeEventListener("resize", r), b && cancelAnimationFrame(b);
301
299
  });
302
300
  }, { immediate: !0 });
303
- let ie = w(() => s.value ? u.value : p.value?.width || 0), ae = w(() => s.value ? d.value : p.value?.height || 0), T = w(() => {
301
+ let T = E(() => s.value ? u.value : p.value?.width || 0), re = E(() => s.value ? d.value : p.value?.height || 0), ie = E(() => {
304
302
  let e = p.value;
305
303
  if (!e) return {
306
304
  position: "absolute",
@@ -316,11 +314,11 @@ var st = /* @__PURE__ */ A({
316
314
  top: `${e.top}px`,
317
315
  width: `${t}px`,
318
316
  height: `${n}px`,
319
- zIndex: te.imageOverlay,
317
+ zIndex: ee.imageOverlay,
320
318
  pointerEvents: "auto"
321
319
  };
322
- }), oe = w(() => {
323
- let e = ie.value, t = ae.value, n = `${e / 2 - 5}px`, r = `${t / 2 - 5}px`, i = `${e - 5}px`, a = `${t - 5}px`, o = "-5px";
320
+ }), ae = E(() => {
321
+ let e = T.value, t = re.value, n = `${e / 2 - 5}px`, r = `${t / 2 - 5}px`, i = `${e - 5}px`, a = `${t - 5}px`, o = "-5px";
324
322
  return [
325
323
  {
326
324
  pos: "nw",
@@ -387,10 +385,10 @@ var st = /* @__PURE__ */ A({
387
385
  }
388
386
  }
389
387
  ];
390
- }), se = (e) => e.length === 2;
391
- function k(e, t, n, r, i, a) {
388
+ }), oe = (e) => e.length === 2;
389
+ function A(e, t, n, r, i, a) {
392
390
  let o = e.includes("w") ? -1 : +!!e.includes("e"), s = e.includes("n") ? -1 : +!!e.includes("s"), c = r + t * o, l = i + n * s;
393
- if (se(e) && a) {
391
+ if (oe(e) && a) {
394
392
  let e = Math.max(c / r, l / i);
395
393
  c = r * e, l = i * e;
396
394
  }
@@ -399,13 +397,13 @@ var st = /* @__PURE__ */ A({
399
397
  height: s === 0 ? i : Math.max(20, Math.min(2e3, l))
400
398
  };
401
399
  }
402
- function A(e, t) {
403
- !i.imageInfo || !p.value || (m = t, h = e.clientX, g = e.clientY, _ = p.value.width, ee = p.value.height, v = { ...p.value }, u.value = Math.round(_), d.value = Math.round(ee), s.value = !0, a("interact-start"), document.addEventListener("mousemove", ce), document.addEventListener("mouseup", le));
400
+ function j(e, t) {
401
+ !i.imageInfo || !p.value || (m = t, h = e.clientX, g = e.clientY, _ = p.value.width, v = p.value.height, y = { ...p.value }, u.value = Math.round(_), d.value = Math.round(v), s.value = !0, a("interact-start"), document.addEventListener("mousemove", se), document.addEventListener("mouseup", M));
404
402
  }
405
- function ce(e) {
406
- let t = i.zoom, n = (e.clientX - h) / t, r = (e.clientY - g) / t, a = !e.shiftKey, o = k(m, n, r, _, ee, a);
403
+ function se(e) {
404
+ let t = i.zoom, n = (e.clientX - h) / t, r = (e.clientY - g) / t, a = !e.shiftKey, o = A(m, n, r, _, v, a);
407
405
  u.value = Math.round(o.width), d.value = Math.round(o.height);
408
- let s = v;
406
+ let s = y;
409
407
  s && (p.value = {
410
408
  left: m.includes("w") ? s.left + (s.width - o.width) : s.left,
411
409
  top: m.includes("n") ? s.top + (s.height - o.height) : s.top,
@@ -413,14 +411,14 @@ var st = /* @__PURE__ */ A({
413
411
  height: s.height
414
412
  });
415
413
  }
416
- function le() {
417
- document.removeEventListener("mousemove", ce), document.removeEventListener("mouseup", le), s.value = !1, v = null, a("interact-end");
414
+ function M() {
415
+ document.removeEventListener("mousemove", se), document.removeEventListener("mouseup", M), s.value = !1, y = null, a("interact-end");
418
416
  let e = i.view, t = i.imageInfo;
419
417
  if (!e || !t) {
420
- S();
418
+ C();
421
419
  return;
422
420
  }
423
- let n = ne(e, t.pmPos);
421
+ let n = te(e, t.pmPos);
424
422
  if (n) try {
425
423
  e.dispatch(e.state.tr.setNodeMarkup(t.pmPos, void 0, {
426
424
  ...n.attrs,
@@ -428,71 +426,71 @@ var st = /* @__PURE__ */ A({
428
426
  height: d.value
429
427
  }));
430
428
  } catch {}
431
- j(() => S());
429
+ ce(() => C());
432
430
  }
433
- let P = 0, ue = 0, de = 0, fe = 0, B = null, H = null;
434
- function U(e) {
431
+ let F = 0, le = 0, ue = 0, de = 0, V = null, U = null;
432
+ function W(e) {
435
433
  if (!e) return 0;
436
434
  let t = e.match(/rotate\((-?\d+(?:\.\d+)?)deg\)/);
437
435
  return t ? parseFloat(t[1]) : 0;
438
436
  }
439
- function W(e, t) {
437
+ function G(e, t) {
440
438
  let n = /scaleX\(-1\)/.test(e || ""), r = /scaleY\(-1\)/.test(e || ""), i = [], a = (t % 360 + 360) % 360;
441
439
  return a !== 0 && i.push(`rotate(${a}deg)`), n && i.push("scaleX(-1)"), r && i.push("scaleY(-1)"), i.length > 0 ? i.join(" ") : null;
442
440
  }
443
- function pe(e, t) {
444
- return Math.atan2(e - P, -(t - ue)) * 180 / Math.PI;
441
+ function fe(e, t) {
442
+ return Math.atan2(e - F, -(t - le)) * 180 / Math.PI;
445
443
  }
446
- function K(e) {
444
+ function pe(e) {
447
445
  if (!i.imageInfo) return;
448
446
  let t = i.imageInfo.element.getBoundingClientRect();
449
- P = t.left + t.width / 2, ue = t.top + t.height / 2;
450
- let n = ne(i.view, i.imageInfo.pmPos);
451
- B = n && n.attrs.transform || null, fe = U(B), H = i.imageInfo.element.querySelector("img"), de = pe(e.clientX, e.clientY), f.value = fe, l.value = !0, a("interact-start"), document.addEventListener("mousemove", me), document.addEventListener("mouseup", he);
447
+ F = t.left + t.width / 2, le = t.top + t.height / 2;
448
+ let n = te(i.view, i.imageInfo.pmPos);
449
+ V = n && n.attrs.transform || null, de = W(V), U = i.imageInfo.element.querySelector("img"), ue = fe(e.clientX, e.clientY), f.value = de, l.value = !0, a("interact-start"), document.addEventListener("mousemove", me), document.addEventListener("mouseup", he);
452
450
  }
453
451
  function me(e) {
454
- let t = pe(e.clientX, e.clientY) - de, n = fe + t;
455
- e.shiftKey || (n = Math.round(n / pt) * pt), f.value = (n % 360 + 360) % 360, H && (H.style.transform = W(B, f.value) || "");
452
+ let t = fe(e.clientX, e.clientY) - ue, n = de + t;
453
+ e.shiftKey || (n = Math.round(n / _t) * _t), f.value = (n % 360 + 360) % 360, U && (U.style.transform = G(V, f.value) || "");
456
454
  }
457
455
  function he() {
458
456
  document.removeEventListener("mousemove", me), document.removeEventListener("mouseup", he), l.value = !1, a("interact-end");
459
457
  let e = i.view, t = i.imageInfo;
460
458
  try {
461
- let n = e && t ? ne(e, t.pmPos) : null;
459
+ let n = e && t ? te(e, t.pmPos) : null;
462
460
  e && t && n && e.dispatch(e.state.tr.setNodeMarkup(t.pmPos, void 0, {
463
461
  ...n.attrs,
464
- transform: W(n.attrs.transform, f.value)
462
+ transform: G(n.attrs.transform, f.value)
465
463
  }));
466
464
  } catch {} finally {
467
- H && (H.style.transform = ""), H = null, B = null;
465
+ U && (U.style.transform = ""), U = null, V = null;
468
466
  }
469
- j(() => S());
467
+ ce(() => C());
470
468
  }
471
- let q = null;
472
- function _e(e) {
469
+ let J = null;
470
+ function Y(e) {
473
471
  if (!i.imageInfo || !p.value) return;
474
472
  let t = e.clientX, n = e.clientY, r = p.value, o = !1, s = (e) => {
475
473
  let s = e.clientX - t, l = e.clientY - n;
476
- if (!(!o && Math.sqrt(s * s + l * l) < ft)) {
474
+ if (!(!o && Math.sqrt(s * s + l * l) < gt)) {
477
475
  if (!o) {
478
- o = !0, c.value = !0, a("interact-start"), q = document.createElement("div"), q.style.cssText = "position: fixed; pointer-events: none; z-index: 10000; opacity: 0.5; border: 2px dashed #2563eb; border-radius: 4px; background: rgba(37, 99, 235, 0.1);";
476
+ o = !0, c.value = !0, a("interact-start"), J = document.createElement("div"), J.style.cssText = "position: fixed; pointer-events: none; z-index: 10000; opacity: 0.5; border: 2px dashed #2563eb; border-radius: 4px; background: rgba(37, 99, 235, 0.1);";
479
477
  let e = i.zoom;
480
- q.style.width = `${r.width * e}px`, q.style.height = `${r.height * e}px`, document.body.appendChild(q);
478
+ J.style.width = `${r.width * e}px`, J.style.height = `${r.height * e}px`, document.body.appendChild(J);
481
479
  }
482
- if (q) {
480
+ if (J) {
483
481
  let t = i.zoom;
484
- q.style.left = `${e.clientX - r.width * t / 2}px`, q.style.top = `${e.clientY - r.height * t / 2}px`;
482
+ J.style.left = `${e.clientX - r.width * t / 2}px`, J.style.top = `${e.clientY - r.height * t / 2}px`;
485
483
  }
486
484
  }
487
485
  }, l = (e) => {
488
- document.removeEventListener("mousemove", s), document.removeEventListener("mouseup", l), b = null, x = null, q &&= (q.remove(), null), c.value = !1, o && (a("interact-end"), ve(e.clientX, e.clientY));
486
+ document.removeEventListener("mousemove", s), document.removeEventListener("mouseup", l), x = null, S = null, J &&= (J.remove(), null), c.value = !1, o && (a("interact-end"), ge(e.clientX, e.clientY));
489
487
  };
490
- b = s, x = l, document.addEventListener("mousemove", s), document.addEventListener("mouseup", l);
488
+ x = s, S = l, document.addEventListener("mousemove", s), document.addEventListener("mouseup", l);
491
489
  }
492
- function ve(e, t) {
490
+ function ge(e, t) {
493
491
  let n = i.view, r = i.imageInfo;
494
492
  if (!n || !r) return;
495
- let a = ne(n, r.pmPos);
493
+ let a = te(n, r.pmPos);
496
494
  if (!a) return;
497
495
  let s = a.attrs.wrapType, c = a.attrs.displayMode === "float" || (s ? [
498
496
  "square",
@@ -514,80 +512,80 @@ var st = /* @__PURE__ */ A({
514
512
  if (c ||= s[s.length - 1].querySelector(".layout-page-content"), !c) return;
515
513
  let l = c.getBoundingClientRect(), u = i.zoom, d = (e - l.left) / u, f = (t - l.top) / u, p = {
516
514
  horizontal: {
517
- posOffset: ge(d),
515
+ posOffset: be(d),
518
516
  relativeTo: "margin"
519
517
  },
520
518
  vertical: {
521
- posOffset: ge(f),
519
+ posOffset: be(f),
522
520
  relativeTo: "margin"
523
521
  }
524
522
  }, m = n.state.tr.setNodeMarkup(r.pmPos, void 0, {
525
523
  ...a.attrs,
526
524
  position: p
527
525
  });
528
- n.dispatch(m), ye(r.pmPos);
526
+ n.dispatch(m), _e(r.pmPos);
529
527
  } else {
530
528
  let i = o.value?.closest(".docx-editor-vue__pages-viewport")?.querySelector(".docx-editor-vue__pages");
531
529
  if (!i) return;
532
- let s = Se(i, e, t, 1);
530
+ let s = we(i, e, t, 1);
533
531
  if (s == null || s < 0 || s === r.pmPos || s === r.pmPos + 1) return;
534
532
  let c = n.state.tr, l = a.nodeSize;
535
- if (s <= r.pmPos) c = c.delete(r.pmPos, r.pmPos + l), c = c.insert(s, a), n.dispatch(c), ye(s);
533
+ if (s <= r.pmPos) c = c.delete(r.pmPos, r.pmPos + l), c = c.insert(s, a), n.dispatch(c), _e(s);
536
534
  else {
537
535
  c = c.delete(r.pmPos, r.pmPos + l);
538
536
  let e = Math.min(s - l, c.doc.content.size);
539
- c = c.insert(e, a), n.dispatch(c), ye(Math.min(e, n.state.doc.content.size - 1));
537
+ c = c.insert(e, a), n.dispatch(c), _e(Math.min(e, n.state.doc.content.size - 1));
540
538
  }
541
539
  }
542
540
  } catch {}
543
- j(() => S());
541
+ ce(() => C());
544
542
  }
545
- function ye(e) {
543
+ function _e(e) {
546
544
  let t = i.view;
547
545
  if (t) try {
548
- let n = be.create(t.state.doc, e);
546
+ let n = q.create(t.state.doc, e);
549
547
  t.dispatch(t.state.tr.setSelection(n));
550
548
  } catch {}
551
549
  }
552
- return N(() => {
553
- document.removeEventListener("mousemove", ce), document.removeEventListener("mouseup", le), document.removeEventListener("mousemove", me), document.removeEventListener("mouseup", he), b && document.removeEventListener("mousemove", b), x && document.removeEventListener("mouseup", x), q &&= (q.remove(), null), y && cancelAnimationFrame(y);
554
- }), (t, n) => e.imageInfo ? (F(), D("div", {
550
+ return P(() => {
551
+ document.removeEventListener("mousemove", se), document.removeEventListener("mouseup", M), document.removeEventListener("mousemove", me), document.removeEventListener("mouseup", he), x && document.removeEventListener("mousemove", x), S && document.removeEventListener("mouseup", S), J &&= (J.remove(), null), b && cancelAnimationFrame(b);
552
+ }), (t, n) => e.imageInfo ? (I(), O("div", {
555
553
  key: 0,
556
554
  ref_key: "overlayRootRef",
557
555
  ref: o,
558
556
  class: "image-overlay",
559
- style: M(T.value),
560
- onMousedown: n[3] ||= G(() => {}, ["stop"])
557
+ style: N(ie.value),
558
+ onMousedown: n[3] ||= K(() => {}, ["stop"])
561
559
  }, [
562
- n[4] ||= O("div", { class: "image-overlay__border" }, null, -1),
563
- O("div", {
560
+ n[4] ||= k("div", { class: "image-overlay__border" }, null, -1),
561
+ k("div", {
564
562
  class: "image-overlay__body",
565
- style: M({ cursor: c.value ? "grabbing" : "grab" }),
566
- onMousedown: n[0] ||= G((e) => _e(e), ["prevent", "stop"]),
567
- onContextmenu: n[1] ||= G((e) => t.$emit("context-menu", e), ["prevent", "stop"])
563
+ style: N({ cursor: c.value ? "grabbing" : "grab" }),
564
+ onMousedown: n[0] ||= K((e) => Y(e), ["prevent", "stop"]),
565
+ onContextmenu: n[1] ||= K((e) => t.$emit("context-menu", e), ["prevent", "stop"])
568
566
  }, null, 36),
569
- (F(!0), D(C, null, L(oe.value, (e) => (F(), D("div", {
567
+ (I(!0), O(w, null, R(ae.value, (e) => (I(), O("div", {
570
568
  key: e.pos,
571
569
  class: "image-overlay__handle",
572
- style: M(e.style),
570
+ style: N(e.style),
573
571
  "data-handle": e.pos,
574
- onMousedown: G((t) => A(t, e.pos), ["prevent", "stop"])
575
- }, null, 44, ct))), 128)),
576
- n[5] ||= O("div", { class: "image-overlay__rotate-line" }, null, -1),
577
- O("div", {
572
+ onMousedown: K((t) => j(t, e.pos), ["prevent", "stop"])
573
+ }, null, 44, ft))), 128)),
574
+ n[5] ||= k("div", { class: "image-overlay__rotate-line" }, null, -1),
575
+ k("div", {
578
576
  class: "image-overlay__rotate-handle",
579
- style: M({ left: `${ie.value / 2 - 7}px` }),
580
- title: z(r)("imageOverlay.rotate"),
581
- onMousedown: n[2] ||= G((e) => K(e), ["prevent", "stop"])
582
- }, null, 44, lt),
583
- s.value ? (F(), D("div", ut, R(Math.round(u.value)) + " × " + R(Math.round(d.value)), 1)) : E("", !0),
584
- l.value ? (F(), D("div", dt, R(Math.round(f.value)) + "° ", 1)) : E("", !0)
585
- ], 36)) : E("", !0);
586
- }
587
- }), [["__scopeId", "data-v-a6f20ec2"]]), ht = { class: "doc-outline__header" }, gt = { class: "doc-outline__body" }, _t = {
577
+ style: N({ left: `${T.value / 2 - 7}px` }),
578
+ title: B(r)("imageOverlay.rotate"),
579
+ onMousedown: n[2] ||= K((e) => pe(e), ["prevent", "stop"])
580
+ }, null, 44, pt),
581
+ s.value ? (I(), O("div", mt, z(Math.round(u.value)) + " × " + z(Math.round(d.value)), 1)) : D("", !0),
582
+ l.value ? (I(), O("div", ht, z(Math.round(f.value)) + "° ", 1)) : D("", !0)
583
+ ], 36)) : D("", !0);
584
+ }
585
+ }), [["__scopeId", "data-v-a6f20ec2"]]), yt = { class: "doc-outline__header" }, bt = { class: "doc-outline__body" }, xt = {
588
586
  key: 0,
589
587
  class: "doc-outline__empty"
590
- }, vt = ["onMousedown"], yt = /* @__PURE__ */ b(/* @__PURE__ */ A({
588
+ }, St = ["onMousedown"], Ct = /* @__PURE__ */ x(/* @__PURE__ */ j({
591
589
  __name: "DocumentOutline",
592
590
  props: {
593
591
  isOpen: { type: Boolean },
@@ -595,28 +593,28 @@ var st = /* @__PURE__ */ A({
595
593
  },
596
594
  emits: ["close", "navigate"],
597
595
  setup(e) {
598
- return (t, n) => e.isOpen ? (F(), D("nav", {
596
+ return (t, n) => e.isOpen ? (I(), O("nav", {
599
597
  key: 0,
600
598
  class: "doc-outline",
601
599
  role: "navigation",
602
600
  "aria-label": "Document outline",
603
- onMousedown: n[1] ||= G(() => {}, ["stop"])
604
- }, [O("div", ht, [O("button", {
601
+ onMousedown: n[1] ||= K(() => {}, ["stop"])
602
+ }, [k("div", yt, [k("button", {
605
603
  class: "doc-outline__back",
606
604
  title: "Close outline",
607
605
  "aria-label": "Close outline",
608
606
  onClick: n[0] ||= (e) => t.$emit("close")
609
- }, [k(c, {
607
+ }, [A(c, {
610
608
  name: "arrow_back",
611
609
  size: 20
612
- })]), n[2] ||= O("span", { class: "doc-outline__title" }, "Document Outline", -1)]), O("div", gt, [e.headings.length === 0 ? (F(), D("div", _t, " No headings found ")) : E("", !0), (F(!0), D(C, null, L(e.headings, (e, n) => (F(), D("button", {
610
+ })]), n[2] ||= k("span", { class: "doc-outline__title" }, "Document Outline", -1)]), k("div", bt, [e.headings.length === 0 ? (I(), O("div", xt, " No headings found ")) : D("", !0), (I(!0), O(w, null, R(e.headings, (e, n) => (I(), O("button", {
613
611
  key: n,
614
612
  class: "doc-outline__item",
615
- style: M({ paddingLeft: 12 + (e.level - 1) * 16 + "px" }),
616
- onMousedown: G((n) => t.$emit("navigate", e.pmPos), ["prevent"])
617
- }, R(e.text || "(untitled)"), 45, vt))), 128))])], 32)) : E("", !0);
613
+ style: N({ paddingLeft: 12 + (e.level - 1) * 16 + "px" }),
614
+ onMousedown: K((n) => t.$emit("navigate", e.pmPos), ["prevent"])
615
+ }, z(e.text || "(untitled)"), 45, St))), 128))])], 32)) : D("", !0);
618
616
  }
619
- }), [["__scopeId", "data-v-cb2cdc39"]]), bt = /* @__PURE__ */ b(/* @__PURE__ */ A({
617
+ }), [["__scopeId", "data-v-cb2cdc39"]]), wt = /* @__PURE__ */ x(/* @__PURE__ */ j({
620
618
  __name: "PageIndicator",
621
619
  props: {
622
620
  currentPage: {},
@@ -625,24 +623,25 @@ var st = /* @__PURE__ */ A({
625
623
  },
626
624
  setup(e) {
627
625
  let { t } = n();
628
- return (n, r) => (F(), D("div", {
626
+ return (n, r) => (I(), O("div", {
629
627
  class: "docx-editor-vue__page-indicator",
630
- style: M({ opacity: +!!e.visible }),
628
+ style: N({ opacity: +!!e.visible }),
631
629
  "aria-live": "polite",
632
630
  role: "status"
633
- }, R(z(t)("viewer.pageIndicator", {
631
+ }, z(B(t)("viewer.pageIndicator", {
634
632
  current: e.currentPage,
635
633
  total: e.totalPages
636
634
  })), 5));
637
635
  }
638
- }), [["__scopeId", "data-v-d117bf6e"]]), xt = { class: "hf-editor__toolbar" }, St = { class: "hf-editor__label" }, Ct = { class: "hf-editor__actions" }, wt = /* @__PURE__ */ b(/* @__PURE__ */ A({
636
+ }), [["__scopeId", "data-v-d117bf6e"]]), Tt = { class: "hf-editor__label" }, Et = {
637
+ class: "hf-editor__actions",
638
+ style: { position: "relative" }
639
+ }, Dt = /* @__PURE__ */ x(/* @__PURE__ */ j({
639
640
  __name: "InlineHeaderFooterEditor",
640
641
  props: {
641
642
  isOpen: { type: Boolean },
642
643
  position: {},
643
- headerFooter: {},
644
- styles: {},
645
- theme: {},
644
+ view: {},
646
645
  targetRect: {}
647
646
  },
648
647
  emits: [
@@ -651,79 +650,92 @@ var st = /* @__PURE__ */ A({
651
650
  "remove"
652
651
  ],
653
652
  setup(e, { emit: t }) {
654
- let n = e, r = t, i = I(null), a = null, o = I({});
653
+ let n = e, r = t, i = L({}), a = L(!1);
654
+ function o(e) {
655
+ let t = n.view;
656
+ if (!t) return;
657
+ let { $from: r, from: i } = t.state.selection, a = t.state.storedMarks || r.marks(), o = Pe.nodes.field.create({
658
+ fieldType: e,
659
+ instruction: ` ${e} \\* MERGEFORMAT `,
660
+ fieldKind: "simple",
661
+ dirty: !0
662
+ });
663
+ t.dispatch(t.state.tr.insert(i, o.mark(a))), t.focus();
664
+ }
655
665
  function s() {
656
666
  let e = n.targetRect;
657
- e && (o.value = {
667
+ e && (i.value = {
658
668
  position: "absolute",
659
669
  top: `${e.top}px`,
660
670
  left: `${e.left}px`,
661
671
  width: `${e.width}px`,
662
- minHeight: `${Math.max(e.height, 60)}px`,
663
- zIndex: "100"
672
+ height: `${e.height}px`,
673
+ zIndex: "100",
674
+ pointerEvents: "none"
664
675
  });
665
676
  }
666
- V(() => n.isOpen, async (e) => {
667
- e ? (s(), await j(), c()) : l();
668
- }), V(() => n.targetRect, () => {
677
+ H(() => n.isOpen, (e) => {
678
+ e && (s(), n.view?.focus());
679
+ }), H(() => n.targetRect, () => {
669
680
  n.isOpen && s();
670
681
  }, { deep: !0 });
671
682
  function c() {
672
- let e = i.value;
673
- if (!e || a) return;
674
- let t = je, r = Me(n.headerFooter?.content ?? [], {
675
- styles: n.styles ?? void 0,
676
- theme: n.theme ?? null
677
- });
678
- a = new Ae(e, {
679
- state: ye.create({
680
- doc: r,
681
- schema: t.getSchema(),
682
- plugins: t.getPlugins() ?? []
683
- }),
684
- editable: () => !0
685
- }), a.focus();
686
- }
687
- function l() {
688
- a &&= (a.destroy(), null);
689
- }
690
- function u() {
691
- a && (r("save", Ne(a.state.doc)), r("close"));
692
- }
693
- return N(() => {
694
- l();
695
- }), (t, n) => e.isOpen ? (F(), D("div", {
683
+ n.view && (r("save", Me(n.view.state.doc)), r("close"));
684
+ }
685
+ return (t, n) => e.isOpen ? (I(), O("div", {
696
686
  key: 0,
697
687
  class: "hf-editor",
698
- style: M(o.value),
699
- onMousedown: n[2] ||= G(() => {}, ["stop"]),
700
- onContextmenu: n[3] ||= G(() => {}, ["stop"])
701
- }, [O("div", xt, [O("span", St, R(e.position === "header" ? "Header" : "Footer"), 1), O("div", Ct, [
702
- O("button", {
688
+ style: N(i.value)
689
+ }, [k("div", {
690
+ class: M(["hf-editor__toolbar", e.position === "footer" ? "hf-editor__toolbar--below" : "hf-editor__toolbar--above"]),
691
+ onMousedown: n[8] ||= K(() => {}, ["stop"]),
692
+ onContextmenu: n[9] ||= K(() => {}, ["stop"])
693
+ }, [k("span", Tt, z(e.position === "header" ? "Header" : "Footer"), 1), k("div", Et, [
694
+ k("button", {
695
+ class: "hf-editor__btn",
696
+ title: "Options",
697
+ onMousedown: n[0] ||= K(() => {}, ["prevent"]),
698
+ onClick: n[1] ||= (e) => a.value = !a.value
699
+ }, " Options ▾ ", 32),
700
+ a.value ? (I(), O("div", {
701
+ key: 0,
702
+ class: "hf-editor__dropdown",
703
+ onMousedown: n[4] ||= K(() => {}, ["stop"]),
704
+ onContextmenu: n[5] ||= K(() => {}, ["stop"])
705
+ }, [k("button", {
706
+ type: "button",
707
+ class: "hf-editor__dropdown-item",
708
+ onClick: n[2] ||= (e) => {
709
+ a.value = !1, o("PAGE");
710
+ }
711
+ }, " Insert current page number "), k("button", {
712
+ type: "button",
713
+ class: "hf-editor__dropdown-item",
714
+ onClick: n[3] ||= (e) => {
715
+ a.value = !1, o("NUMPAGES");
716
+ }
717
+ }, " Insert total page count ")], 32)) : D("", !0),
718
+ k("button", {
703
719
  class: "hf-editor__btn",
704
720
  title: "Remove",
705
- onMousedown: n[0] ||= G((e) => t.$emit("remove"), ["prevent"])
721
+ onMousedown: n[6] ||= K((e) => t.$emit("remove"), ["prevent"])
706
722
  }, " Remove ", 32),
707
- O("button", {
723
+ k("button", {
708
724
  class: "hf-editor__btn hf-editor__btn--primary",
709
725
  title: "Save",
710
- onMousedown: G(u, ["prevent"])
726
+ onMousedown: K(c, ["prevent"])
711
727
  }, " Save ", 32),
712
- O("button", {
728
+ k("button", {
713
729
  class: "hf-editor__btn",
714
730
  title: "Cancel",
715
- onMousedown: n[1] ||= G((e) => t.$emit("close"), ["prevent"])
731
+ onMousedown: n[7] ||= K((e) => t.$emit("close"), ["prevent"])
716
732
  }, " Cancel ", 32)
717
- ])]), O("div", {
718
- ref_key: "editorRef",
719
- ref: i,
720
- class: "hf-editor__content"
721
- }, null, 512)], 36)) : E("", !0);
733
+ ])], 34)], 4)) : D("", !0);
722
734
  }
723
- }), [["__scopeId", "data-v-343434c4"]]), Tt = {
735
+ }), [["__scopeId", "data-v-e93a9f94"]]), Ot = {
724
736
  key: 0,
725
737
  class: "docx-editor-vue__title-bar"
726
- }, Et = { class: "docx-editor-vue__title-bar-left" }, Dt = { class: "docx-editor-vue__title-bar-center" }, Ot = { class: "docx-editor-vue__title-bar-right" }, kt = /* @__PURE__ */ A({
738
+ }, kt = { class: "docx-editor-vue__title-bar-left" }, At = { class: "docx-editor-vue__title-bar-center" }, jt = { class: "docx-editor-vue__title-bar-right" }, Mt = /* @__PURE__ */ j({
727
739
  __name: "DocxEditorMenuBar",
728
740
  props: {
729
741
  showMenuBar: { type: Boolean },
@@ -742,26 +754,27 @@ var st = /* @__PURE__ */ A({
742
754
  ],
743
755
  setup(e, { emit: t }) {
744
756
  let n = t;
745
- return (t, r) => e.showMenuBar ? (F(), D("div", Tt, [
746
- O("div", Et, [e.renderLogo ? (F(), T(de(e.renderLogo), { key: 0 })) : E("", !0), ue(t.$slots, "title-bar-left")]),
747
- O("div", Dt, [k(g, {
757
+ return (t, r) => e.showMenuBar ? (I(), O("div", Ot, [
758
+ k("div", kt, [e.renderLogo ? (I(), ie(ue(e.renderLogo), { key: 0 })) : D("", !0), le(t.$slots, "title-bar-left")]),
759
+ k("div", At, [A(g, {
748
760
  "model-value": e.documentName,
749
761
  editable: e.documentNameEditable,
750
762
  "onUpdate:modelValue": r[0] ||= (e) => n("rename", e)
751
- }, null, 8, ["model-value", "editable"]), k(v, {
763
+ }, null, 8, ["model-value", "editable"]), A(y, {
752
764
  onAction: r[1] ||= (e) => n("menu-action", e),
753
765
  onInsertTable: r[2] ||= (e, t) => n("insert-table", e, t)
754
766
  })]),
755
- O("div", Ot, [ue(t.$slots, "title-bar-right"), e.renderTitleBarRight ? (F(), T(de(e.renderTitleBarRight), { key: 0 })) : E("", !0)])
756
- ])) : E("", !0);
767
+ k("div", jt, [le(t.$slots, "title-bar-right"), e.renderTitleBarRight ? (I(), ie(ue(e.renderTitleBarRight), { key: 0 })) : D("", !0)])
768
+ ])) : D("", !0);
757
769
  }
758
- }), At = /* @__PURE__ */ A({
770
+ }), Nt = /* @__PURE__ */ j({
759
771
  __name: "DocxEditorDialogs",
760
772
  props: {
761
773
  view: {},
762
774
  bookmarks: {},
763
775
  selectedImagePmPos: {},
764
776
  sectionProperties: {},
777
+ scrollVisiblePositionIntoView: { type: Function },
765
778
  showFindReplace: { type: Boolean },
766
779
  showInsertImage: { type: Boolean },
767
780
  showHyperlink: { type: Boolean },
@@ -786,18 +799,23 @@ var st = /* @__PURE__ */ A({
786
799
  ],
787
800
  setup(t, { emit: n }) {
788
801
  let r = n;
789
- return (n, a) => (F(), D(C, null, [
790
- k(u, {
802
+ return (n, a) => (I(), O(w, null, [
803
+ A(u, {
791
804
  "is-open": t.showFindReplace,
792
805
  view: t.view,
806
+ "scroll-visible-position-into-view": t.scrollVisiblePositionIntoView,
793
807
  onClose: a[0] ||= (e) => r("update:showFindReplace", !1)
794
- }, null, 8, ["is-open", "view"]),
795
- k(s, {
808
+ }, null, 8, [
809
+ "is-open",
810
+ "view",
811
+ "scroll-visible-position-into-view"
812
+ ]),
813
+ A(s, {
796
814
  "is-open": t.showInsertImage,
797
815
  onClose: a[1] ||= (e) => r("update:showInsertImage", !1),
798
816
  onInsert: a[2] ||= (e) => r("insert-image", e)
799
817
  }, null, 8, ["is-open"]),
800
- k(e, {
818
+ A(e, {
801
819
  "is-open": t.showHyperlink,
802
820
  view: t.view,
803
821
  bookmarks: t.bookmarks,
@@ -809,12 +827,12 @@ var st = /* @__PURE__ */ A({
809
827
  "view",
810
828
  "bookmarks"
811
829
  ]),
812
- k(i, {
830
+ A(i, {
813
831
  "is-open": t.showInsertSymbol,
814
832
  onClose: a[6] ||= (e) => r("update:showInsertSymbol", !1),
815
833
  onInsert: a[7] ||= (e) => r("insert-symbol", e)
816
834
  }, null, 8, ["is-open"]),
817
- k(l, {
835
+ A(l, {
818
836
  "is-open": t.showImageProperties,
819
837
  view: t.view,
820
838
  "pm-pos": t.selectedImagePmPos,
@@ -824,22 +842,22 @@ var st = /* @__PURE__ */ A({
824
842
  "view",
825
843
  "pm-pos"
826
844
  ]),
827
- k(o, {
845
+ A(o, {
828
846
  "is-open": t.showPageSetup,
829
847
  "section-properties": t.sectionProperties,
830
848
  onClose: a[9] ||= (e) => r("update:showPageSetup", !1),
831
849
  onApply: a[10] ||= (e) => r("page-setup-apply", e)
832
850
  }, null, 8, ["is-open", "section-properties"]),
833
- k(d, {
851
+ A(d, {
834
852
  "is-open": t.showKeyboardShortcuts,
835
853
  onClose: a[11] ||= (e) => r("update:showKeyboardShortcuts", !1)
836
854
  }, null, 8, ["is-open"])
837
855
  ], 64));
838
856
  }
839
- }), jt = ["disabled", "onMousedown"], Mt = { class: "ctx-menu__label" }, Nt = {
857
+ }), Pt = ["disabled", "onMousedown"], Ft = { class: "ctx-menu__label" }, It = {
840
858
  key: 0,
841
859
  class: "ctx-menu__shortcut"
842
- }, Pt = 220, Ft = 32, It = 10, Lt = /* @__PURE__ */ b(/* @__PURE__ */ A({
860
+ }, Lt = 220, Rt = 32, zt = 10, Bt = /* @__PURE__ */ x(/* @__PURE__ */ j({
843
861
  __name: "TextContextMenu",
844
862
  props: {
845
863
  isOpen: { type: Boolean },
@@ -853,7 +871,7 @@ var st = /* @__PURE__ */ A({
853
871
  },
854
872
  emits: ["close", "action"],
855
873
  setup(e, { emit: t }) {
856
- let n = e, r = t, i = I(null), a = w(() => {
874
+ let n = e, r = t, i = L(null), a = E(() => {
857
875
  let e = [
858
876
  {
859
877
  id: "cut",
@@ -971,9 +989,9 @@ var st = /* @__PURE__ */ A({
971
989
  action: "splitCell",
972
990
  disabled: !n.canSplitCell
973
991
  }), e;
974
- }), o = w(() => {
975
- let e = n.position.x, t = n.position.y, r = a.value.filter((e) => !e.divider).length, i = a.value.filter((e) => e.divider).length, o = r * Ft + i * 9;
976
- return typeof window < "u" && (e + Pt + It > window.innerWidth && (e = window.innerWidth - Pt - It), t + o + It > window.innerHeight && (t = window.innerHeight - o - It)), {
992
+ }), o = E(() => {
993
+ let e = n.position.x, t = n.position.y, r = a.value.filter((e) => !e.divider).length, i = a.value.filter((e) => e.divider).length, o = r * Rt + i * 9;
994
+ return typeof window < "u" && (e + Lt + zt > window.innerWidth && (e = window.innerWidth - Lt - zt), t + o + zt > window.innerHeight && (t = window.innerHeight - o - zt)), {
977
995
  position: "fixed",
978
996
  left: `${e}px`,
979
997
  top: `${t}px`,
@@ -986,50 +1004,50 @@ var st = /* @__PURE__ */ A({
986
1004
  function c(e) {
987
1005
  e.key === "Escape" && r("close");
988
1006
  }
989
- return V(() => n.isOpen, (e) => {
990
- e && j(() => i.value?.focus());
991
- }), (t, n) => (F(), T(ie, { to: "body" }, [e.isOpen ? (F(), D("div", {
1007
+ return H(() => n.isOpen, (e) => {
1008
+ e && ce(() => i.value?.focus());
1009
+ }), (t, n) => (I(), ie(T, { to: "body" }, [e.isOpen ? (I(), O("div", {
992
1010
  key: 0,
993
1011
  class: "ctx-menu-backdrop",
994
1012
  onMousedown: n[0] ||= (e) => t.$emit("close"),
995
- onContextmenu: n[1] ||= G((e) => t.$emit("close"), ["prevent"])
996
- }, null, 32)) : E("", !0), e.isOpen ? (F(), D("div", {
1013
+ onContextmenu: n[1] ||= K((e) => t.$emit("close"), ["prevent"])
1014
+ }, null, 32)) : D("", !0), e.isOpen ? (I(), O("div", {
997
1015
  key: 1,
998
1016
  ref_key: "menuRef",
999
1017
  ref: i,
1000
1018
  class: "ctx-menu",
1001
- style: M(o.value),
1002
- onContextmenu: n[2] ||= G(() => {}, ["prevent"]),
1019
+ style: N(o.value),
1020
+ onContextmenu: n[2] ||= K(() => {}, ["prevent"]),
1003
1021
  onKeydown: c
1004
- }, [(F(!0), D(C, null, L(a.value, (e, t) => (F(), D("button", {
1022
+ }, [(I(!0), O(w, null, R(a.value, (e, t) => (I(), O("button", {
1005
1023
  key: e.id || t,
1006
- class: le(["ctx-menu__item", {
1024
+ class: M(["ctx-menu__item", {
1007
1025
  "ctx-menu__item--disabled": e.disabled,
1008
1026
  "ctx-menu__item--divider": e.divider
1009
1027
  }]),
1010
1028
  disabled: e.disabled,
1011
- onMousedown: G((t) => s(e.action), ["prevent"])
1012
- }, [O("span", Mt, R(e.label), 1), e.shortcut ? (F(), D("span", Nt, R(e.shortcut), 1)) : E("", !0)], 42, jt))), 128))], 36)) : E("", !0)]));
1029
+ onMousedown: K((t) => s(e.action), ["prevent"])
1030
+ }, [k("span", Ft, z(e.label), 1), e.shortcut ? (I(), O("span", It, z(e.shortcut), 1)) : D("", !0)], 42, Pt))), 128))], 36)) : D("", !0)]));
1013
1031
  }
1014
- }), [["__scopeId", "data-v-741c4f71"]]), Rt = ["aria-label"], zt = { class: "image-ctx-menu__icon" }, Bt = { class: "image-ctx-menu__label" }, Vt = {
1032
+ }), [["__scopeId", "data-v-741c4f71"]]), Vt = ["aria-label"], Ht = { class: "image-ctx-menu__icon" }, Ut = { class: "image-ctx-menu__label" }, Wt = {
1015
1033
  key: 1,
1016
1034
  class: "image-ctx-menu__divider",
1017
1035
  role: "separator"
1018
- }, Ht = [
1036
+ }, Gt = [
1019
1037
  "data-wrap-type",
1020
1038
  "data-current",
1021
1039
  "data-disabled",
1022
1040
  "disabled",
1023
1041
  "title",
1024
1042
  "onClick"
1025
- ], Ut = { class: "image-ctx-menu__icon" }, Wt = { class: "image-ctx-menu__label" }, Gt = ["aria-label"], Kt = ["disabled", "onClick"], qt = { class: "image-ctx-menu__label" }, Jt = {
1043
+ ], Kt = { class: "image-ctx-menu__icon" }, qt = { class: "image-ctx-menu__label" }, Jt = ["aria-label"], Yt = ["disabled", "onClick"], Xt = { class: "image-ctx-menu__label" }, Zt = {
1026
1044
  key: 0,
1027
1045
  class: "image-ctx-menu__shortcut"
1028
- }, Yt = {
1046
+ }, Qt = {
1029
1047
  key: 0,
1030
1048
  class: "image-ctx-menu__divider",
1031
1049
  role: "separator"
1032
- }, Q = 18, Xt = 260, Zt = 10, Qt = /* @__PURE__ */ b(/* @__PURE__ */ A({
1050
+ }, $t = 18, en = 260, tn = 10, nn = /* @__PURE__ */ x(/* @__PURE__ */ j({
1033
1051
  __name: "ImageContextMenu",
1034
1052
  props: {
1035
1053
  state: {},
@@ -1050,7 +1068,7 @@ var st = /* @__PURE__ */ A({
1050
1068
  function a() {
1051
1069
  i("open-properties"), i("close");
1052
1070
  }
1053
- let { t: o } = n(), s = I(null), l = Te, u = w(() => r.state ? J(r.state.currentWrapType, r.state.currentCssFloat ?? null) : null), d = {
1071
+ let { t: o } = n(), s = L(null), l = X, u = E(() => r.state ? Oe(r.state.currentWrapType, r.state.currentCssFloat ?? null) : null), d = {
1054
1072
  inline: "wrap_text",
1055
1073
  squareLeft: "format_image_left",
1056
1074
  squareRight: "format_image_right",
@@ -1060,19 +1078,19 @@ var st = /* @__PURE__ */ A({
1060
1078
  function f(e) {
1061
1079
  return d[e];
1062
1080
  }
1063
- let p = w(() => {
1081
+ let p = E(() => {
1064
1082
  if (!r.state) return {};
1065
- let e = Te.length * 36 + 16, t = r.state.position.x, n = r.state.position.y;
1066
- return typeof window < "u" && (t + Xt > window.innerWidth && (t = window.innerWidth - Xt - Zt), n + e > window.innerHeight && (n = window.innerHeight - e - Zt), t < Zt && (t = Zt), n < Zt && (n = Zt)), {
1083
+ let e = X.length * 36 + 16, t = r.state.position.x, n = r.state.position.y;
1084
+ return typeof window < "u" && (t + en > window.innerWidth && (t = window.innerWidth - en - tn), n + e > window.innerHeight && (n = window.innerHeight - e - tn), t < tn && (t = tn), n < tn && (n = tn)), {
1067
1085
  position: "fixed",
1068
1086
  left: `${t}px`,
1069
1087
  top: `${n}px`,
1070
- minWidth: `${Xt}px`,
1088
+ minWidth: `${en}px`,
1071
1089
  zIndex: 400
1072
1090
  };
1073
1091
  });
1074
1092
  function m(e) {
1075
- return r.state ? Oe(e, r.state.currentWrapType) : !1;
1093
+ return r.state ? Ae(e, r.state.currentWrapType) : !1;
1076
1094
  }
1077
1095
  function h(e) {
1078
1096
  m(e) && (i("select", e.choice), i("close"));
@@ -1083,77 +1101,77 @@ var st = /* @__PURE__ */ A({
1083
1101
  function _(e) {
1084
1102
  e.preventDefault(), i("close");
1085
1103
  }
1086
- function ee(e) {
1104
+ function v(e) {
1087
1105
  e.key === "Escape" && (e.preventDefault(), i("close"));
1088
1106
  }
1089
- return (t, n) => (F(), T(ie, { to: "body" }, [e.state && e.state.open ? (F(), D("div", {
1107
+ return (t, n) => (I(), ie(T, { to: "body" }, [e.state && e.state.open ? (I(), O("div", {
1090
1108
  key: 0,
1091
1109
  class: "image-ctx-menu-backdrop",
1092
1110
  onMousedown: _,
1093
- onContextmenu: n[0] ||= G((e) => t.$emit("close"), ["prevent"])
1094
- }, null, 32)) : E("", !0), e.state && e.state.open ? (F(), D("div", {
1111
+ onContextmenu: n[0] ||= K((e) => t.$emit("close"), ["prevent"])
1112
+ }, null, 32)) : D("", !0), e.state && e.state.open ? (I(), O("div", {
1095
1113
  key: 1,
1096
1114
  ref_key: "menuRef",
1097
1115
  ref: s,
1098
1116
  class: "image-ctx-menu",
1099
1117
  role: "menu",
1100
- "aria-label": z(o)("imageWrap.menu.ariaLabel"),
1118
+ "aria-label": B(o)("imageWrap.menu.ariaLabel"),
1101
1119
  "data-testid": "image-context-menu",
1102
- style: M(p.value),
1103
- onContextmenu: n[4] ||= G(() => {}, ["prevent"]),
1104
- onKeydown: ee
1120
+ style: N(p.value),
1121
+ onContextmenu: n[4] ||= K(() => {}, ["prevent"]),
1122
+ onKeydown: v
1105
1123
  }, [
1106
- e.canOpenProperties ? (F(), D("button", {
1124
+ e.canOpenProperties ? (I(), O("button", {
1107
1125
  key: 0,
1108
1126
  type: "button",
1109
1127
  role: "menuitem",
1110
1128
  class: "image-ctx-menu__item",
1111
1129
  "data-action": "open-properties",
1112
- onMousedown: n[1] ||= G(() => {}, ["prevent"]),
1130
+ onMousedown: n[1] ||= K(() => {}, ["prevent"]),
1113
1131
  onClick: a
1114
- }, [O("span", zt, [k(c, {
1132
+ }, [k("span", Ht, [A(c, {
1115
1133
  name: "settings",
1116
- size: Q
1117
- })]), O("span", Bt, R(z(o)("imageWrap.menu.imageProperties")), 1)], 32)) : E("", !0),
1118
- e.canOpenProperties ? (F(), D("div", Vt)) : E("", !0),
1119
- (F(!0), D(C, null, L(z(l), (e) => (F(), D("button", {
1134
+ size: $t
1135
+ })]), k("span", Ut, z(B(o)("imageWrap.menu.imageProperties")), 1)], 32)) : D("", !0),
1136
+ e.canOpenProperties ? (I(), O("div", Wt)) : D("", !0),
1137
+ (I(!0), O(w, null, R(B(l), (e) => (I(), O("button", {
1120
1138
  key: e.choice,
1121
1139
  type: "button",
1122
1140
  role: "menuitem",
1123
- class: le(["image-ctx-menu__item", { "image-ctx-menu__item--current": e.choice === u.value }]),
1141
+ class: M(["image-ctx-menu__item", { "image-ctx-menu__item--current": e.choice === u.value }]),
1124
1142
  "data-wrap-type": e.choice,
1125
1143
  "data-current": e.choice === u.value ? "true" : "false",
1126
1144
  "data-disabled": m(e) ? "false" : "true",
1127
1145
  disabled: !m(e),
1128
- title: z(o)(`imageWrap.menuDesc.${e.i18nDescKey}`),
1129
- onMousedown: n[2] ||= G(() => {}, ["prevent"]),
1146
+ title: B(o)(`imageWrap.menuDesc.${e.i18nDescKey}`),
1147
+ onMousedown: n[2] ||= K(() => {}, ["prevent"]),
1130
1148
  onClick: (t) => h(e)
1131
1149
  }, [
1132
- O("span", Ut, [k(c, {
1150
+ k("span", Kt, [A(c, {
1133
1151
  name: f(e.iconHint),
1134
- size: Q
1152
+ size: $t
1135
1153
  }, null, 8, ["name"])]),
1136
- O("span", Wt, R(z(o)(`imageWrap.menu.${e.i18nLabelKey}`)), 1),
1137
- e.choice === u.value ? (F(), D("span", {
1154
+ k("span", qt, z(B(o)(`imageWrap.menu.${e.i18nLabelKey}`)), 1),
1155
+ e.choice === u.value ? (I(), O("span", {
1138
1156
  key: 0,
1139
1157
  class: "image-ctx-menu__current-dot",
1140
- "aria-label": z(o)("imageWrap.menu.ariaLabel")
1141
- }, "●", 8, Gt)) : E("", !0)
1142
- ], 42, Ht))), 128)),
1143
- e.textActions && e.textActions.length > 0 ? (F(), D(C, { key: 2 }, [n[5] ||= O("div", {
1158
+ "aria-label": B(o)("imageWrap.menu.ariaLabel")
1159
+ }, "●", 8, Jt)) : D("", !0)
1160
+ ], 42, Gt))), 128)),
1161
+ e.textActions && e.textActions.length > 0 ? (I(), O(w, { key: 2 }, [n[5] ||= k("div", {
1144
1162
  class: "image-ctx-menu__divider",
1145
1163
  role: "separator"
1146
- }, null, -1), (F(!0), D(C, null, L(e.textActions, (e, t) => (F(), D(C, { key: `${e.action}-${t}` }, [O("button", {
1164
+ }, null, -1), (I(!0), O(w, null, R(e.textActions, (e, t) => (I(), O(w, { key: `${e.action}-${t}` }, [k("button", {
1147
1165
  type: "button",
1148
1166
  role: "menuitem",
1149
1167
  class: "image-ctx-menu__item image-ctx-menu__item--text",
1150
1168
  disabled: e.disabled,
1151
- onMousedown: n[3] ||= G(() => {}, ["prevent"]),
1169
+ onMousedown: n[3] ||= K(() => {}, ["prevent"]),
1152
1170
  onClick: (t) => g(e)
1153
- }, [O("span", qt, R(e.label), 1), e.shortcut ? (F(), D("span", Jt, R(e.shortcut), 1)) : E("", !0)], 40, Kt), e.dividerAfter ? (F(), D("div", Yt)) : E("", !0)], 64))), 128))], 64)) : E("", !0)
1154
- ], 44, Rt)) : E("", !0)]));
1171
+ }, [k("span", Xt, z(e.label), 1), e.shortcut ? (I(), O("span", Zt, z(e.shortcut), 1)) : D("", !0)], 40, Yt), e.dividerAfter ? (I(), O("div", Qt)) : D("", !0)], 64))), 128))], 64)) : D("", !0)
1172
+ ], 44, Vt)) : D("", !0)]));
1155
1173
  }
1156
- }), [["__scopeId", "data-v-5c21ca8c"]]), $t = /* @__PURE__ */ A({
1174
+ }), [["__scopeId", "data-v-5c21ca8c"]]), rn = /* @__PURE__ */ j({
1157
1175
  __name: "DocxEditorOverlays",
1158
1176
  props: {
1159
1177
  readOnly: { type: Boolean },
@@ -1171,7 +1189,7 @@ var st = /* @__PURE__ */ A({
1171
1189
  ],
1172
1190
  setup(e, { emit: t }) {
1173
1191
  let n = t;
1174
- return (t, r) => (F(), D(C, null, [k(Lt, {
1192
+ return (t, r) => (I(), O(w, null, [A(Bt, {
1175
1193
  "is-open": e.contextMenu.isOpen,
1176
1194
  position: e.contextMenu.position,
1177
1195
  "has-selection": e.contextMenu.hasSelection,
@@ -1191,7 +1209,7 @@ var st = /* @__PURE__ */ A({
1191
1209
  "on-image",
1192
1210
  "can-merge-cells",
1193
1211
  "can-split-cell"
1194
- ]), k(Qt, {
1212
+ ]), A(nn, {
1195
1213
  state: e.imageContextMenu,
1196
1214
  "text-actions": e.imageContextMenuTextActions,
1197
1215
  "can-open-properties": e.canOpenImageProperties,
@@ -1205,7 +1223,7 @@ var st = /* @__PURE__ */ A({
1205
1223
  "can-open-properties"
1206
1224
  ])], 64));
1207
1225
  }
1208
- }), en = ["href", "title"], tn = ["title"], nn = ["title"], rn = ["title"], an = { class: "docx-hyperlink-popup__edit-row" }, $ = ["placeholder", "onKeydown"], on = { class: "docx-hyperlink-popup__edit-row" }, sn = ["onKeydown"], cn = ["disabled"], ln = /* @__PURE__ */ b(/* @__PURE__ */ A({
1226
+ }), an = ["href", "title"], on = ["title"], sn = ["title"], cn = ["title"], ln = { class: "docx-hyperlink-popup__edit-row" }, un = ["placeholder", "onKeydown"], dn = { class: "docx-hyperlink-popup__edit-row" }, fn = ["onKeydown"], pn = ["disabled"], mn = /* @__PURE__ */ x(/* @__PURE__ */ j({
1209
1227
  __name: "HyperlinkPopup",
1210
1228
  props: {
1211
1229
  data: {},
@@ -1219,25 +1237,25 @@ var st = /* @__PURE__ */ A({
1219
1237
  "close"
1220
1238
  ],
1221
1239
  setup(e, { emit: t }) {
1222
- let { t: r } = n(), i = e, a = t, o = I(!1), s = I(""), c = I(""), l = I(null), u = w(() => ({
1240
+ let { t: r } = n(), i = e, a = t, o = L(!1), s = L(""), c = L(""), l = L(null), u = E(() => ({
1223
1241
  left: (i.data?.position.left ?? 0) + "px",
1224
1242
  top: (i.data?.position.top ?? 0) + "px"
1225
1243
  }));
1226
- V(() => i.data?.href, () => {
1244
+ H(() => i.data?.href, () => {
1227
1245
  o.value = !1;
1228
1246
  });
1229
1247
  let d = null, f = null;
1230
1248
  function p() {
1231
1249
  f &&= (clearTimeout(f), null), d &&= (document.removeEventListener("mousedown", d), null);
1232
1250
  }
1233
- V(() => i.data, (e) => {
1251
+ H(() => i.data, (e) => {
1234
1252
  p(), e && (d = (e) => {
1235
1253
  let t = l.value;
1236
1254
  t && !t.contains(e.target) && a("close");
1237
1255
  }, f = setTimeout(() => {
1238
1256
  d && document.addEventListener("mousedown", d);
1239
1257
  }, 0));
1240
- }, { immediate: !0 }), N(p);
1258
+ }, { immediate: !0 }), P(p);
1241
1259
  function m() {
1242
1260
  i.data && (s.value = i.data.displayText, c.value = i.data.href, o.value = !0);
1243
1261
  }
@@ -1247,41 +1265,41 @@ var st = /* @__PURE__ */ A({
1247
1265
  function g() {
1248
1266
  i.data && (a("copy", i.data.href), typeof navigator < "u" && navigator.clipboard && navigator.clipboard.writeText(i.data.href).catch(() => {}));
1249
1267
  }
1250
- return (t, n) => e.data ? (F(), D("div", {
1268
+ return (t, n) => e.data ? (I(), O("div", {
1251
1269
  key: 0,
1252
1270
  ref_key: "popupRef",
1253
1271
  ref: l,
1254
- class: le(["docx-hyperlink-popup", { "docx-hyperlink-popup--edit": o.value }]),
1255
- style: M(u.value),
1256
- onMousedown: n[6] ||= G(() => {}, ["stop"])
1257
- }, [o.value ? (F(), D(C, { key: 1 }, [O("div", an, [U(O("input", {
1272
+ class: M(["docx-hyperlink-popup", { "docx-hyperlink-popup--edit": o.value }]),
1273
+ style: N(u.value),
1274
+ onMousedown: n[6] ||= K(() => {}, ["stop"])
1275
+ }, [o.value ? (I(), O(w, { key: 1 }, [k("div", ln, [W(k("input", {
1258
1276
  class: "docx-hyperlink-popup__input",
1259
- placeholder: z(r)("hyperlinkPopup.displayTextPlaceholder"),
1277
+ placeholder: B(r)("hyperlinkPopup.displayTextPlaceholder"),
1260
1278
  "onUpdate:modelValue": n[2] ||= (e) => s.value = e,
1261
- onKeydown: [W(G(h, ["prevent"]), ["enter"]), n[3] ||= W((e) => t.$emit("close"), ["esc"])]
1262
- }, null, 40, $), [[B, s.value]])]), O("div", on, [U(O("input", {
1279
+ onKeydown: [G(K(h, ["prevent"]), ["enter"]), n[3] ||= G((e) => t.$emit("close"), ["esc"])]
1280
+ }, null, 40, un), [[V, s.value]])]), k("div", dn, [W(k("input", {
1263
1281
  class: "docx-hyperlink-popup__input",
1264
1282
  placeholder: "https://...",
1265
1283
  "onUpdate:modelValue": n[4] ||= (e) => c.value = e,
1266
- onKeydown: [W(G(h, ["prevent"]), ["enter"]), n[5] ||= W((e) => t.$emit("close"), ["esc"])]
1267
- }, null, 40, sn), [[B, c.value]]), O("button", {
1284
+ onKeydown: [G(K(h, ["prevent"]), ["enter"]), n[5] ||= G((e) => t.$emit("close"), ["esc"])]
1285
+ }, null, 40, fn), [[V, c.value]]), k("button", {
1268
1286
  class: "docx-hyperlink-popup__apply",
1269
1287
  disabled: !c.value.trim(),
1270
- onClick: G(h, ["prevent"])
1271
- }, R(z(r)("common.apply")), 9, cn)])], 64)) : (F(), D(C, { key: 0 }, [
1272
- n[10] ||= se("<span class=\"docx-hyperlink-popup__icon\" aria-hidden data-v-9d23bb12><svg width=\"18\" height=\"18\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\" data-v-9d23bb12><circle cx=\"12\" cy=\"12\" r=\"10\" data-v-9d23bb12></circle><path d=\"M2 12h20\" data-v-9d23bb12></path><path d=\"M12 2a15.3 15.3 0 0 1 4 10 15.3 15.3 0 0 1-4 10 15.3 15.3 0 0 1-4-10 15.3 15.3 0 0 1 4-10z\" data-v-9d23bb12></path></svg></span>", 1),
1273
- O("a", {
1288
+ onClick: K(h, ["prevent"])
1289
+ }, z(B(r)("common.apply")), 9, pn)])], 64)) : (I(), O(w, { key: 0 }, [
1290
+ n[10] ||= oe("<span class=\"docx-hyperlink-popup__icon\" aria-hidden data-v-9d23bb12><svg width=\"18\" height=\"18\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\" data-v-9d23bb12><circle cx=\"12\" cy=\"12\" r=\"10\" data-v-9d23bb12></circle><path d=\"M2 12h20\" data-v-9d23bb12></path><path d=\"M12 2a15.3 15.3 0 0 1 4 10 15.3 15.3 0 0 1-4 10 15.3 15.3 0 0 1-4-10 15.3 15.3 0 0 1 4-10z\" data-v-9d23bb12></path></svg></span>", 1),
1291
+ k("a", {
1274
1292
  class: "docx-hyperlink-popup__url",
1275
1293
  href: e.data.href,
1276
1294
  title: e.data.href,
1277
- onClick: n[0] ||= G((n) => t.$emit("navigate", e.data.href), ["prevent"])
1278
- }, R(e.data.href), 9, en),
1279
- n[11] ||= O("span", { class: "docx-hyperlink-popup__sep" }, null, -1),
1280
- O("button", {
1295
+ onClick: n[0] ||= K((n) => t.$emit("navigate", e.data.href), ["prevent"])
1296
+ }, z(e.data.href), 9, an),
1297
+ n[11] ||= k("span", { class: "docx-hyperlink-popup__sep" }, null, -1),
1298
+ k("button", {
1281
1299
  class: "docx-hyperlink-popup__btn",
1282
- title: z(r)("hyperlinkPopup.copyLink"),
1283
- onClick: G(g, ["prevent"])
1284
- }, [...n[7] ||= [O("svg", {
1300
+ title: B(r)("hyperlinkPopup.copyLink"),
1301
+ onClick: K(g, ["prevent"])
1302
+ }, [...n[7] ||= [k("svg", {
1285
1303
  width: "18",
1286
1304
  height: "18",
1287
1305
  viewBox: "0 0 24 24",
@@ -1290,20 +1308,20 @@ var st = /* @__PURE__ */ A({
1290
1308
  "stroke-width": "2",
1291
1309
  "stroke-linecap": "round",
1292
1310
  "stroke-linejoin": "round"
1293
- }, [O("rect", {
1311
+ }, [k("rect", {
1294
1312
  x: "9",
1295
1313
  y: "9",
1296
1314
  width: "13",
1297
1315
  height: "13",
1298
1316
  rx: "2",
1299
1317
  ry: "2"
1300
- }), O("path", { d: "M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1" })], -1)]], 8, tn),
1301
- e.readOnly ? E("", !0) : (F(), D("button", {
1318
+ }), k("path", { d: "M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1" })], -1)]], 8, on),
1319
+ e.readOnly ? D("", !0) : (I(), O("button", {
1302
1320
  key: 0,
1303
1321
  class: "docx-hyperlink-popup__btn",
1304
- title: z(r)("hyperlinkPopup.editLink"),
1305
- onClick: G(m, ["prevent"])
1306
- }, [...n[8] ||= [O("svg", {
1322
+ title: B(r)("hyperlinkPopup.editLink"),
1323
+ onClick: K(m, ["prevent"])
1324
+ }, [...n[8] ||= [k("svg", {
1307
1325
  width: "18",
1308
1326
  height: "18",
1309
1327
  viewBox: "0 0 24 24",
@@ -1312,26 +1330,26 @@ var st = /* @__PURE__ */ A({
1312
1330
  "stroke-width": "2",
1313
1331
  "stroke-linecap": "round",
1314
1332
  "stroke-linejoin": "round"
1315
- }, [O("path", { d: "M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7" }), O("path", { d: "M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z" })], -1)]], 8, nn)),
1316
- e.readOnly ? E("", !0) : (F(), D("button", {
1333
+ }, [k("path", { d: "M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7" }), k("path", { d: "M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z" })], -1)]], 8, sn)),
1334
+ e.readOnly ? D("", !0) : (I(), O("button", {
1317
1335
  key: 1,
1318
1336
  class: "docx-hyperlink-popup__btn",
1319
- title: z(r)("hyperlinkPopup.removeLink"),
1320
- onClick: n[1] ||= G((e) => t.$emit("remove"), ["prevent"])
1321
- }, [...n[9] ||= [se("<svg width=\"18\" height=\"18\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\" data-v-9d23bb12><path d=\"M18.84 12.25l1.72-1.71h-.02a5.004 5.004 0 0 0-.12-7.07 5.006 5.006 0 0 0-6.95 0l-1.72 1.71\" data-v-9d23bb12></path><path d=\"M5.17 11.75l-1.71 1.71a5.004 5.004 0 0 0 .12 7.07 5.006 5.006 0 0 0 6.95 0l1.71-1.71\" data-v-9d23bb12></path><line x1=\"8\" y1=\"2\" x2=\"8\" y2=\"5\" data-v-9d23bb12></line><line x1=\"2\" y1=\"8\" x2=\"5\" y2=\"8\" data-v-9d23bb12></line><line x1=\"16\" y1=\"19\" x2=\"16\" y2=\"22\" data-v-9d23bb12></line><line x1=\"19\" y1=\"16\" x2=\"22\" y2=\"16\" data-v-9d23bb12></line></svg>", 1)]], 8, rn))
1322
- ], 64))], 38)) : E("", !0);
1337
+ title: B(r)("hyperlinkPopup.removeLink"),
1338
+ onClick: n[1] ||= K((e) => t.$emit("remove"), ["prevent"])
1339
+ }, [...n[9] ||= [oe("<svg width=\"18\" height=\"18\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\" data-v-9d23bb12><path d=\"M18.84 12.25l1.72-1.71h-.02a5.004 5.004 0 0 0-.12-7.07 5.006 5.006 0 0 0-6.95 0l-1.72 1.71\" data-v-9d23bb12></path><path d=\"M5.17 11.75l-1.71 1.71a5.004 5.004 0 0 0 .12 7.07 5.006 5.006 0 0 0 6.95 0l1.71-1.71\" data-v-9d23bb12></path><line x1=\"8\" y1=\"2\" x2=\"8\" y2=\"5\" data-v-9d23bb12></line><line x1=\"2\" y1=\"8\" x2=\"5\" y2=\"8\" data-v-9d23bb12></line><line x1=\"16\" y1=\"19\" x2=\"16\" y2=\"22\" data-v-9d23bb12></line><line x1=\"19\" y1=\"16\" x2=\"22\" y2=\"16\" data-v-9d23bb12></line></svg>", 1)]], 8, cn))
1340
+ ], 64))], 38)) : D("", !0);
1323
1341
  }
1324
1342
  }), [["__scopeId", "data-v-9d23bb12"]]);
1325
1343
  //#endregion
1326
1344
  //#region src/composables/useFileIO.ts
1327
- function un(e) {
1328
- let t = I(null);
1345
+ function hn(e) {
1346
+ let t = L(null);
1329
1347
  async function n() {
1330
1348
  await e.nextTick(), e.extractCommentsAndChanges(), e.emit("ready");
1331
1349
  }
1332
1350
  async function r(t) {
1333
1351
  try {
1334
- let r = await q(t);
1352
+ let r = await xe(t);
1335
1353
  if (!r) return;
1336
1354
  await e.loadBuffer(r.buffer), e.emit("update:document", e.getDocument()), e.emit("rename", r.name), await n();
1337
1355
  } catch (t) {
@@ -1370,8 +1388,8 @@ function un(e) {
1370
1388
  }
1371
1389
  //#endregion
1372
1390
  //#region src/composables/useHyperlinkManagement.ts
1373
- function dn(e) {
1374
- let t = I(null);
1391
+ function gn(e) {
1392
+ let t = L(null);
1375
1393
  function n(t) {
1376
1394
  let n = e.editorView.value;
1377
1395
  if (!n) return;
@@ -1399,7 +1417,7 @@ function dn(e) {
1399
1417
  function a(n, r) {
1400
1418
  let i = e.editorView.value;
1401
1419
  if (!i) return;
1402
- let a = K(i.state);
1420
+ let a = Y(i.state);
1403
1421
  if (!a) {
1404
1422
  t.value = null;
1405
1423
  return;
@@ -1413,7 +1431,7 @@ function dn(e) {
1413
1431
  function o() {
1414
1432
  let n = e.editorView.value;
1415
1433
  if (!n) return;
1416
- let r = K(n.state, t.value?.href);
1434
+ let r = Y(n.state, t.value?.href);
1417
1435
  if (!r) {
1418
1436
  t.value = null;
1419
1437
  return;
@@ -1432,27 +1450,27 @@ function dn(e) {
1432
1450
  }
1433
1451
  //#endregion
1434
1452
  //#region src/composables/useFormattingActions.ts
1435
- function fn(e) {
1453
+ function _n(e) {
1436
1454
  function t() {
1437
1455
  let t = e.editorView.value;
1438
- t && (pe(t.state, t.dispatch, t), t.focus());
1456
+ t && (J(t.state, t.dispatch, t), t.focus());
1439
1457
  }
1440
1458
  function n(t) {
1441
1459
  let n = e.editorView.value;
1442
1460
  if (!n) return;
1443
1461
  let r = e.getDocument()?.package?.styles;
1444
1462
  if (r) {
1445
- let e = Ve(r).resolveParagraphStyle(t);
1446
- Z(t, {
1463
+ let e = Ue(r).resolveParagraphStyle(t);
1464
+ Re(t, {
1447
1465
  paragraphFormatting: e.paragraphFormatting,
1448
1466
  runFormatting: e.runFormatting
1449
1467
  })(n.state, (e) => n.dispatch(e));
1450
- } else Z(t)(n.state, (e) => n.dispatch(e));
1468
+ } else Re(t)(n.state, (e) => n.dispatch(e));
1451
1469
  n.focus();
1452
1470
  }
1453
1471
  function r() {
1454
1472
  let t = e.editorView.value;
1455
- t && (He(t.state, (e) => t.dispatch(e), t), t.focus());
1473
+ t && (We(t.state, (e) => t.dispatch(e), t), t.focus());
1456
1474
  }
1457
1475
  function i(t) {
1458
1476
  let n = e.editorView.value;
@@ -1463,11 +1481,11 @@ function fn(e) {
1463
1481
  function a(t) {
1464
1482
  let n = e.editorView.value;
1465
1483
  if (!n) return !1;
1466
- let r = et(n.state.doc, t.paraId);
1484
+ let r = it(n.state.doc, t.paraId);
1467
1485
  if (!r) return !1;
1468
1486
  let i = r.from + 1, a = r.to - 1;
1469
1487
  if (t.search) {
1470
- let e = rt(n.state.doc, r.from, r.to, t.search);
1488
+ let e = st(n.state.doc, r.from, r.to, t.search);
1471
1489
  if (!e) return !1;
1472
1490
  i = e.from, a = e.to;
1473
1491
  }
@@ -1480,7 +1498,7 @@ function fn(e) {
1480
1498
  return s.strike !== void 0 && o.marks.strike && (c = s.strike ? c.addMark(i, a, o.marks.strike.create()) : c.removeMark(i, a, o.marks.strike)), s.color !== void 0 && o.marks.textColor && (c = s.color && (s.color.rgb || s.color.themeColor) ? c.addMark(i, a, o.marks.textColor.create({
1481
1499
  rgb: s.color.rgb ?? null,
1482
1500
  themeColor: s.color.themeColor ?? null
1483
- })) : c.removeMark(i, a, o.marks.textColor)), s.highlight !== void 0 && o.marks.highlight && (c = s.highlight ? c.addMark(i, a, o.marks.highlight.create({ color: Ue(s.highlight) || s.highlight })) : c.removeMark(i, a, o.marks.highlight)), s.fontSize !== void 0 && o.marks.fontSize && (c = s.fontSize > 0 ? c.addMark(i, a, o.marks.fontSize.create({ size: Pe(s.fontSize) })) : c.removeMark(i, a, o.marks.fontSize)), s.fontFamily !== void 0 && o.marks.fontFamily && (c = s.fontFamily && (s.fontFamily.ascii || s.fontFamily.hAnsi) ? c.addMark(i, a, o.marks.fontFamily.create({
1501
+ })) : c.removeMark(i, a, o.marks.textColor)), s.highlight !== void 0 && o.marks.highlight && (c = s.highlight ? c.addMark(i, a, o.marks.highlight.create({ color: Ge(s.highlight) || s.highlight })) : c.removeMark(i, a, o.marks.highlight)), s.fontSize !== void 0 && o.marks.fontSize && (c = s.fontSize > 0 ? c.addMark(i, a, o.marks.fontSize.create({ size: Fe(s.fontSize) })) : c.removeMark(i, a, o.marks.fontSize)), s.fontFamily !== void 0 && o.marks.fontFamily && (c = s.fontFamily && (s.fontFamily.ascii || s.fontFamily.hAnsi) ? c.addMark(i, a, o.marks.fontFamily.create({
1484
1502
  ascii: s.fontFamily.ascii ?? null,
1485
1503
  hAnsi: s.fontFamily.hAnsi ?? s.fontFamily.ascii ?? null
1486
1504
  })) : c.removeMark(i, a, o.marks.fontFamily)), n.dispatch(c), !0;
@@ -1488,17 +1506,17 @@ function fn(e) {
1488
1506
  function o(t) {
1489
1507
  let n = e.editorView.value;
1490
1508
  if (!n) return !1;
1491
- let r = et(n.state.doc, t.paraId);
1509
+ let r = it(n.state.doc, t.paraId);
1492
1510
  if (!r) return !1;
1493
- let i = e.getDocument(), a = i?.package?.styles ? Ve(i.package.styles) : null;
1511
+ let i = e.getDocument(), a = i?.package?.styles ? Ue(i.package.styles) : null;
1494
1512
  if (a && !a.hasParagraphStyle(t.styleId)) return !1;
1495
- let o = n.state.doc.resolve(r.from + 1), s = n.state.doc.resolve(r.to - 1), c = n.state.apply(n.state.tr.setSelection(xe.between(o, s))), l = a ? (() => {
1513
+ let o = n.state.doc.resolve(r.from + 1), s = n.state.doc.resolve(r.to - 1), c = n.state.apply(n.state.tr.setSelection(fe.between(o, s))), l = a ? (() => {
1496
1514
  let e = a.resolveParagraphStyle(t.styleId);
1497
- return Z(t.styleId, {
1515
+ return Re(t.styleId, {
1498
1516
  paragraphFormatting: e.paragraphFormatting,
1499
1517
  runFormatting: e.runFormatting
1500
1518
  });
1501
- })() : Z(t.styleId), u = !1;
1519
+ })() : Re(t.styleId), u = !1;
1502
1520
  return l(c, (e) => {
1503
1521
  u = !0, e.setSelection(n.state.selection.map(e.doc, e.mapping)), n.dispatch(e);
1504
1522
  }), u;
@@ -1514,7 +1532,7 @@ function fn(e) {
1514
1532
  }
1515
1533
  //#endregion
1516
1534
  //#region src/composables/usePageSetupControls.ts
1517
- function pn(e) {
1535
+ function vn(e) {
1518
1536
  function t(t) {
1519
1537
  let n = e.getDocument();
1520
1538
  if (!n?.package?.document) return;
@@ -1541,19 +1559,19 @@ function pn(e) {
1541
1559
  }
1542
1560
  function s(t) {
1543
1561
  let n = e.editorView.value;
1544
- n && ze(t)(n.state, n.dispatch);
1562
+ n && Ve(t)(n.state, n.dispatch);
1545
1563
  }
1546
1564
  function c(t) {
1547
1565
  let n = e.editorView.value;
1548
- n && Be(t)(n.state, n.dispatch);
1566
+ n && He(t)(n.state, n.dispatch);
1549
1567
  }
1550
1568
  function l(t) {
1551
1569
  let n = e.editorView.value;
1552
- n && (t < 0 ? Re(-t, !0)(n.state, n.dispatch) : Re(t, !1)(n.state, n.dispatch));
1570
+ n && (t < 0 ? Be(-t, !0)(n.state, n.dispatch) : Be(t, !1)(n.state, n.dispatch));
1553
1571
  }
1554
1572
  function u(t) {
1555
1573
  let n = e.editorView.value;
1556
- n && Le(t)(n.state, n.dispatch);
1574
+ n && ze(t)(n.state, n.dispatch);
1557
1575
  }
1558
1576
  return {
1559
1577
  handlePageSetupApply: t,
@@ -1569,18 +1587,18 @@ function pn(e) {
1569
1587
  }
1570
1588
  //#endregion
1571
1589
  //#region src/composables/useOutlineSidebar.ts
1572
- function mn(e) {
1590
+ function yn(e) {
1573
1591
  function t() {
1574
1592
  if (!e.showOutline.value) {
1575
1593
  let t = e.editorView.value;
1576
- t && (e.outlineHeadings.value = We(t.state.doc));
1594
+ t && (e.outlineHeadings.value = Ke(t.state.doc));
1577
1595
  }
1578
1596
  e.showOutline.value = !e.showOutline.value;
1579
1597
  }
1580
1598
  function n(t) {
1581
1599
  let n = e.editorView.value;
1582
1600
  if (!n) return;
1583
- let r = n.state.doc.resolve(Math.min(t + 1, n.state.doc.content.size)), i = xe.near(r);
1601
+ let r = n.state.doc.resolve(Math.min(t + 1, n.state.doc.content.size)), i = fe.near(r);
1584
1602
  n.dispatch(n.state.tr.setSelection(i).scrollIntoView()), n.focus();
1585
1603
  }
1586
1604
  function r() {
@@ -1599,7 +1617,7 @@ function mn(e) {
1599
1617
  }
1600
1618
  //#endregion
1601
1619
  //#region src/composables/useKeyboardShortcuts.ts
1602
- function hn(e) {
1620
+ function bn(e) {
1603
1621
  function t(t) {
1604
1622
  if (t.key === "F1") {
1605
1623
  t.preventDefault(), e.showKeyboardShortcuts.value = !0;
@@ -1607,11 +1625,11 @@ function hn(e) {
1607
1625
  }
1608
1626
  e.handleZoomKeyDown(t), (t.ctrlKey || t.metaKey) && (e.disableFindReplaceShortcuts?.() && (t.key === "f" || t.key === "h") || (t.key === "f" || t.key === "h" ? (t.preventDefault(), e.showFindReplace.value = !0) : t.key === "k" ? (t.preventDefault(), e.showHyperlink.value = !0) : t.key === "/" && (t.preventDefault(), e.showKeyboardShortcuts.value = !e.showKeyboardShortcuts.value)));
1609
1627
  }
1610
- return P(() => window.addEventListener("keydown", t)), N(() => window.removeEventListener("keydown", t)), { handleKeyDown: t };
1628
+ return F(() => window.addEventListener("keydown", t)), P(() => window.removeEventListener("keydown", t)), { handleKeyDown: t };
1611
1629
  }
1612
1630
  //#endregion
1613
1631
  //#region src/utils/commentFactories.ts
1614
- function gn(e, t, n, r) {
1632
+ function xn(e, t, n, r) {
1615
1633
  return {
1616
1634
  id: e.reduce((e, t) => Math.max(e, t.id), 0) + 1,
1617
1635
  author: n,
@@ -1633,9 +1651,9 @@ function gn(e, t, n, r) {
1633
1651
  }
1634
1652
  //#endregion
1635
1653
  //#region src/composables/useCommentManagement.ts
1636
- function _n(e) {
1654
+ function Sn(e) {
1637
1655
  function t(t, n, r) {
1638
- return gn(e.getDocument()?.package?.document?.comments ?? [], t, n, r);
1656
+ return xn(e.getDocument()?.package?.document?.comments ?? [], t, n, r);
1639
1657
  }
1640
1658
  function n(n) {
1641
1659
  let r = e.getDocument(), i = e.editorView.value;
@@ -1643,11 +1661,11 @@ function _n(e) {
1643
1661
  r.package.document.comments || (r.package.document.comments = []);
1644
1662
  let a = i.state.schema.marks.comment;
1645
1663
  if (!a) return null;
1646
- let o = et(i.state.doc, n.paraId);
1664
+ let o = it(i.state.doc, n.paraId);
1647
1665
  if (!o) return null;
1648
1666
  let s = o.from + 1, c = o.to - 1;
1649
1667
  if (n.search) {
1650
- let e = rt(i.state.doc, o.from, o.to, n.search);
1668
+ let e = st(i.state.doc, o.from, o.to, n.search);
1651
1669
  if (!e) return null;
1652
1670
  s = e.from, c = e.to;
1653
1671
  }
@@ -1672,14 +1690,14 @@ function _n(e) {
1672
1690
  if (!n) return !1;
1673
1691
  let { schema: r } = n.state;
1674
1692
  if (!r.marks.deletion || !r.marks.insertion) return !1;
1675
- let i = et(n.state.doc, t.paraId);
1693
+ let i = it(n.state.doc, t.paraId);
1676
1694
  if (!i) return !1;
1677
1695
  let a = t.search === "", o = t.replaceWith === "";
1678
1696
  if (a && o) return !1;
1679
1697
  let s, c;
1680
1698
  if (a) s = i.to - 1, c = i.to - 1;
1681
1699
  else {
1682
- let e = rt(n.state.doc, i.from, i.to, t.search);
1700
+ let e = st(n.state.doc, i.from, i.to, t.search);
1683
1701
  if (!e) return !1;
1684
1702
  s = e.from, c = e.to;
1685
1703
  }
@@ -1714,13 +1732,21 @@ function _n(e) {
1714
1732
  }
1715
1733
  function l(t, n) {
1716
1734
  let r = e.editorView.value;
1717
- r && (Ge(t, n)(r.state, r.dispatch), e.extractCommentsAndChanges(), r.focus());
1735
+ r && (qe(t, n)(r.state, r.dispatch), e.extractCommentsAndChanges(), r.focus());
1718
1736
  }
1719
1737
  function u(t, n) {
1720
1738
  let r = e.editorView.value;
1721
- r && (Ke(t, n)(r.state, r.dispatch), e.extractCommentsAndChanges(), r.focus());
1739
+ r && (Xe(t, n)(r.state, r.dispatch), e.extractCommentsAndChanges(), r.focus());
1740
+ }
1741
+ function d(t) {
1742
+ let n = e.editorView.value;
1743
+ n && (Je(t)(n.state, n.dispatch), e.extractCommentsAndChanges(), n.focus());
1744
+ }
1745
+ function f(t) {
1746
+ let n = e.editorView.value;
1747
+ n && (Ze(t)(n.state, n.dispatch), e.extractCommentsAndChanges(), n.focus());
1722
1748
  }
1723
- function d(n, r) {
1749
+ function p(n, r) {
1724
1750
  let i = e.getDocument(), a = e.editorView.value;
1725
1751
  if (!i?.package?.document || !a) return;
1726
1752
  i.package.document.comments || (i.package.document.comments = []);
@@ -1747,23 +1773,25 @@ function _n(e) {
1747
1773
  handleCommentDelete: c,
1748
1774
  handleAcceptChange: l,
1749
1775
  handleRejectChange: u,
1750
- handleTrackedChangeReply: d
1776
+ handleAcceptChangeById: d,
1777
+ handleRejectChangeById: f,
1778
+ handleTrackedChangeReply: p
1751
1779
  };
1752
1780
  }
1753
1781
  //#endregion
1754
1782
  //#region src/utils/domQueries.ts
1755
- function vn(e, t) {
1756
- let n = X(e);
1783
+ function Q(e, t) {
1784
+ let n = he(e);
1757
1785
  for (let e of n) {
1758
1786
  let n = Number(e.dataset.pmStart), r = Number(e.dataset.pmEnd);
1759
1787
  if (!isNaN(n) && !isNaN(r) && t >= n && t <= r) return e;
1760
1788
  }
1761
1789
  return null;
1762
1790
  }
1763
- function yn(e, t, n) {
1791
+ function $(e, t, n) {
1764
1792
  if (!e || !t) return;
1765
1793
  let r = null;
1766
- for (let t of X(e)) {
1794
+ for (let t of he(e)) {
1767
1795
  let e = Number(t.dataset.pmStart), i = Number(t.dataset.pmEnd);
1768
1796
  if (Number.isFinite(e) && Number.isFinite(i) && n >= e && n <= i) {
1769
1797
  r = t;
@@ -1777,21 +1805,21 @@ function yn(e, t, n) {
1777
1805
  behavior: "smooth"
1778
1806
  });
1779
1807
  }
1780
- function bn(e, t, n, r) {
1808
+ function Cn(e, t, n, r) {
1781
1809
  if (!e || !t) return null;
1782
- let i = Y(e, n, r, 1);
1810
+ let i = pe(e, n, r, 1);
1783
1811
  return i === null || i < 0 ? null : Math.min(i, t.state.doc.content.size);
1784
1812
  }
1785
- function xn(e, t, n) {
1813
+ function wn(e, t, n) {
1786
1814
  if (!e) return;
1787
- let r = vn(e, t);
1815
+ let r = Q(e, t);
1788
1816
  if (!r) return;
1789
- let i = r.textContent || "", a = Number(r.dataset.pmStart) || 0, [o, s] = he(i, t - a), c = a + o, l = a + s;
1817
+ let i = r.textContent || "", a = Number(r.dataset.pmStart) || 0, [o, s] = _e(i, t - a), c = a + o, l = a + s;
1790
1818
  c < l && n(c, l);
1791
1819
  }
1792
- function Sn(e, t, n) {
1820
+ function Tn(e, t, n) {
1793
1821
  if (!e) return;
1794
- let r = vn(e, t);
1822
+ let r = Q(e, t);
1795
1823
  if (!r) return;
1796
1824
  let i = r.closest(".layout-paragraph");
1797
1825
  if (!i) return;
@@ -1800,11 +1828,11 @@ function Sn(e, t, n) {
1800
1828
  }
1801
1829
  //#endregion
1802
1830
  //#region src/composables/useCommentLifecycle.ts
1803
- function Cn(e) {
1804
- let t = I(null), n = I(null), r = I(null), i = I(!1);
1831
+ function En(e) {
1832
+ let t = L(null), n = L(null), r = L(null), i = L(!1);
1805
1833
  function a() {
1806
1834
  let t = e.getDocument(), n = e.editorView.value;
1807
- !t || !n || (e.comments.value = [...t.package?.document?.comments ?? []], e.trackedChanges.value = qe(n.state).entries, !i.value && (e.comments.value.length > 0 || e.trackedChanges.value.length > 0) && (e.showSidebar.value = !0, i.value = !0));
1835
+ !t || !n || (e.comments.value = [...t.package?.document?.comments ?? []], e.trackedChanges.value = Qe(n.state).entries, !i.value && (e.comments.value.length > 0 || e.trackedChanges.value.length > 0) && (e.showSidebar.value = !0, i.value = !0));
1808
1836
  }
1809
1837
  function o() {
1810
1838
  e.stateTick.value;
@@ -1823,7 +1851,7 @@ function Cn(e) {
1823
1851
  t.value = null;
1824
1852
  return;
1825
1853
  }
1826
- let s = o.getBoundingClientRect(), c = vn(a, r);
1854
+ let s = o.getBoundingClientRect(), c = Q(a, r);
1827
1855
  if (!c) {
1828
1856
  t.value = null;
1829
1857
  return;
@@ -1885,7 +1913,7 @@ function Cn(e) {
1885
1913
  let i = e.getDocument(), a = e.editorView.value;
1886
1914
  if (!i?.package) return;
1887
1915
  i.package.document.comments || (i.package.document.comments = []);
1888
- let o = gn(i.package.document.comments, t, "User");
1916
+ let o = xn(i.package.document.comments, t, "User");
1889
1917
  i.package.document.comments.push(o), e.comments.value = [...i.package.document.comments];
1890
1918
  let s = n.value;
1891
1919
  if (a && s && s.from !== s.to) {
@@ -1908,15 +1936,15 @@ function Cn(e) {
1908
1936
  function d(t) {
1909
1937
  e.showSidebar.value = !0;
1910
1938
  }
1911
- V([
1939
+ H([
1912
1940
  e.stateTick,
1913
1941
  e.isAddingComment,
1914
1942
  e.zoom
1915
- ], () => o()), V(e.stateTick, () => s());
1943
+ ], () => o()), H(e.stateTick, () => s()), H(e.stateTick, () => a());
1916
1944
  let f = null;
1917
- return P(() => {
1945
+ return F(() => {
1918
1946
  f = new ResizeObserver(() => o()), e.pagesRef.value && f.observe(e.pagesRef.value), window.addEventListener("resize", o);
1919
- }), N(() => {
1947
+ }), P(() => {
1920
1948
  f?.disconnect(), window.removeEventListener("resize", o);
1921
1949
  }), {
1922
1950
  floatingCommentBtn: t,
@@ -1934,8 +1962,8 @@ function Cn(e) {
1934
1962
  }
1935
1963
  //#endregion
1936
1964
  //#region src/composables/useImageActions.ts
1937
- function wn(e) {
1938
- let t = fe(null), n = I(!1), r = w(() => {
1965
+ function Dn(e) {
1966
+ let t = de(null), n = L(!1), r = E(() => {
1939
1967
  e.stateTick.value;
1940
1968
  let n = e.editorView.value, r = t.value;
1941
1969
  if (!n || !r) return null;
@@ -1956,15 +1984,15 @@ function wn(e) {
1956
1984
  alt: t.alt,
1957
1985
  width: t.width,
1958
1986
  height: t.height
1959
- }), { from: a } = n.state.selection, o = n.state.tr.insert(a, i);
1960
- n.dispatch(o.scrollIntoView()), n.focus();
1987
+ });
1988
+ Ye(n.state, n.dispatch, i, n.state.selection.from), n.focus();
1961
1989
  }
1962
1990
  function a(n) {
1963
1991
  let r = e.editorView.value, i = t.value;
1964
1992
  if (!r || !i) return;
1965
- let a = ke(n);
1993
+ let a = je(n);
1966
1994
  if (!a) return;
1967
- let o = r.state.doc.nodeAt(i.pmPos), s = e.getCommands(), c = o?.attrs.wrapType === "inline" && a !== "inline" ? { initialPositionEmu: Ee(i.element, e.zoom.value) } : void 0, l = s.setImageWrapType?.(i.pmPos, a, c);
1995
+ let o = r.state.doc.nodeAt(i.pmPos), s = e.getCommands(), c = o?.attrs.wrapType === "inline" && a !== "inline" ? { initialPositionEmu: De(i.element, e.zoom.value) } : void 0, l = s.setImageWrapType?.(i.pmPos, a, c);
1968
1996
  l && (l(r.state, (e) => r.dispatch(e), r), r.focus());
1969
1997
  }
1970
1998
  function o(n) {
@@ -1993,10 +2021,20 @@ function wn(e) {
1993
2021
  }
1994
2022
  //#endregion
1995
2023
  //#region src/utils/imageClipboard.ts
1996
- function Tn(e, t) {
2024
+ function On(e, t, n) {
2025
+ let r = Z(e.state), i = e.state.schema.marks.insertion;
2026
+ if (!r || !i) return;
2027
+ let a = t.selection.from, o = a - n.nodeSize;
2028
+ o < 0 || t.addMark(o, a, i.create({
2029
+ revisionId: r.revisionId,
2030
+ author: r.author,
2031
+ date: r.date
2032
+ }));
2033
+ }
2034
+ function kn(e, t) {
1997
2035
  return e.getBlob(t);
1998
2036
  }
1999
- function En(e, t) {
2037
+ function An(e, t) {
2000
2038
  let n = e.state.doc.nodeAt(t);
2001
2039
  if (!n || n.type.name !== "image") return;
2002
2040
  let r = `<img src="${n.attrs.src}" data-pm-image="true" data-width="${n.attrs.width ?? ""}" data-height="${n.attrs.height ?? ""}" data-wrap-type="${n.attrs.wrapType ?? ""}" data-display-mode="${n.attrs.displayMode ?? ""}" data-rid="${n.attrs.rId ?? ""}" />`, i = new ClipboardItem({
@@ -2008,13 +2046,13 @@ function En(e, t) {
2008
2046
  e.value = r, document.body.appendChild(e), e.select(), document.execCommand("copy"), document.body.removeChild(e);
2009
2047
  });
2010
2048
  }
2011
- function Dn(e) {
2049
+ function jn(e) {
2012
2050
  return new Promise((t, n) => {
2013
2051
  let r = new FileReader();
2014
2052
  r.onload = () => t(r.result), r.onerror = n, r.readAsDataURL(e);
2015
2053
  });
2016
2054
  }
2017
- function On(e) {
2055
+ function Mn(e) {
2018
2056
  return new Promise((t) => {
2019
2057
  let n = new Image();
2020
2058
  n.onload = () => t({
@@ -2026,13 +2064,13 @@ function On(e) {
2026
2064
  }), n.src = e;
2027
2065
  });
2028
2066
  }
2029
- async function kn(e) {
2067
+ async function Nn(e) {
2030
2068
  try {
2031
2069
  let t = await navigator.clipboard.read();
2032
2070
  for (let n of t) {
2033
2071
  let t = n.types.find((e) => e.startsWith("image/"));
2034
2072
  if (t) {
2035
- let r = await Dn(await Tn(n, t)), i = await On(r), a = i.width, o = i.height;
2073
+ let r = await jn(await kn(n, t)), i = await Mn(r), a = i.width, o = i.height;
2036
2074
  a > 612 && (o = Math.round(612 / a * o), a = 612);
2037
2075
  let s = e.state.schema.nodes.image.create({
2038
2076
  src: r,
@@ -2041,12 +2079,12 @@ async function kn(e) {
2041
2079
  rId: `rId_img_${Date.now()}`,
2042
2080
  wrapType: "inline",
2043
2081
  displayMode: "inline"
2044
- });
2045
- e.dispatch(e.state.tr.replaceSelectionWith(s));
2082
+ }), c = e.state.tr.replaceSelectionWith(s);
2083
+ On(e, c, s), e.dispatch(c);
2046
2084
  return;
2047
2085
  }
2048
2086
  if (n.types.includes("text/html")) {
2049
- let t = await (await Tn(n, "text/html")).text(), r = t.match(/<img[^>]+src="([^"]+)"[^>]*>/i);
2087
+ let t = await (await kn(n, "text/html")).text(), r = t.match(/<img[^>]+src="([^"]+)"[^>]*>/i);
2050
2088
  if (r && r[1]) {
2051
2089
  let n = r[1], i = t.match(/data-width="(\d+)"/), a = t.match(/data-height="(\d+)"/), o = i ? Number(i[1]) : 200, s = a ? Number(a[1]) : 200, c = e.state.schema.nodes.image.create({
2052
2090
  src: n,
@@ -2055,13 +2093,13 @@ async function kn(e) {
2055
2093
  rId: `rId_img_${Date.now()}`,
2056
2094
  wrapType: "inline",
2057
2095
  displayMode: "inline"
2058
- });
2059
- e.dispatch(e.state.tr.replaceSelectionWith(c));
2096
+ }), l = e.state.tr.replaceSelectionWith(c);
2097
+ On(e, l, c), e.dispatch(l);
2060
2098
  return;
2061
2099
  }
2062
2100
  }
2063
2101
  if (n.types.includes("text/plain")) {
2064
- let t = await (await Tn(n, "text/plain")).text();
2102
+ let t = await (await kn(n, "text/plain")).text();
2065
2103
  if (t && t !== "[image]") {
2066
2104
  let { from: n } = e.state.selection;
2067
2105
  e.dispatch(e.state.tr.insertText(t, n));
@@ -2077,14 +2115,14 @@ async function kn(e) {
2077
2115
  }
2078
2116
  }
2079
2117
  }
2080
- function An(e, t) {
2118
+ function Pn(e, t) {
2081
2119
  let n = e.state.doc.nodeAt(t);
2082
2120
  if (!n || n.type.name !== "image") return;
2083
2121
  let r = document.createElement("input");
2084
2122
  r.type = "file", r.accept = "image/*", r.onchange = async () => {
2085
2123
  let i = r.files?.[0];
2086
2124
  if (!i) return;
2087
- let a = await Dn(i), o = await On(a), s = n.attrs.width || o.width, c = n.attrs.height || o.height, l = Math.min(s / o.width, c / o.height), u = Math.round(o.width * l), d = Math.round(o.height * l);
2125
+ let a = await jn(i), o = await Mn(a), s = n.attrs.width || o.width, c = n.attrs.height || o.height, l = Math.min(s / o.width, c / o.height), u = Math.round(o.width * l), d = Math.round(o.height * l);
2088
2126
  try {
2089
2127
  let r = e.state.tr.setNodeMarkup(t, void 0, {
2090
2128
  ...n.attrs,
@@ -2099,8 +2137,8 @@ function An(e, t) {
2099
2137
  }
2100
2138
  //#endregion
2101
2139
  //#region src/composables/useContextMenus.ts
2102
- function jn(e) {
2103
- let { t } = n(), r = I({
2140
+ function Fn(e) {
2141
+ let { t } = n(), r = L({
2104
2142
  isOpen: !1,
2105
2143
  position: {
2106
2144
  x: 0,
@@ -2111,7 +2149,7 @@ function jn(e) {
2111
2149
  onImage: !1,
2112
2150
  canMergeCells: !1,
2113
2151
  canSplitCell: !1
2114
- }), i = I(null), a = w(() => [
2152
+ }), i = L(null), a = E(() => [
2115
2153
  {
2116
2154
  action: "cut",
2117
2155
  label: t("contextMenu.cut"),
@@ -2137,12 +2175,12 @@ function jn(e) {
2137
2175
  function o(t) {
2138
2176
  let n = e.editorView.value;
2139
2177
  if (!n) return;
2140
- let a = t.target, o = De(a);
2178
+ let a = t.target, o = ke(a);
2141
2179
  if (o) {
2142
2180
  let a = Number(o.dataset.pmStart);
2143
2181
  if (!isNaN(a)) {
2144
2182
  try {
2145
- let e = be.create(n.state.doc, a);
2183
+ let e = q.create(n.state.doc, a);
2146
2184
  n.dispatch(n.state.tr.setSelection(e));
2147
2185
  } catch {}
2148
2186
  e.selectedImage.value = {
@@ -2163,7 +2201,7 @@ function jn(e) {
2163
2201
  pmPos: a,
2164
2202
  currentWrapType: n,
2165
2203
  currentCssFloat: c ?? null,
2166
- inlinePositionEmu: n === "inline" ? Ee(o, e.zoom.value) : void 0
2204
+ inlinePositionEmu: n === "inline" ? De(o, e.zoom.value) : void 0
2167
2205
  }, r.value.isOpen = !1;
2168
2206
  return;
2169
2207
  }
@@ -2175,7 +2213,7 @@ function jn(e) {
2175
2213
  e.setPmSelection(a);
2176
2214
  } catch {}
2177
2215
  }
2178
- let s = ve(n.state), { empty: c } = n.state.selection;
2216
+ let s = Ce(n.state), { empty: c } = n.state.selection;
2179
2217
  i.value &&= null, r.value = {
2180
2218
  isOpen: !0,
2181
2219
  position: {
@@ -2204,7 +2242,7 @@ function jn(e) {
2204
2242
  pmPos: a.pmPos,
2205
2243
  currentWrapType: s,
2206
2244
  currentCssFloat: c ?? null,
2207
- inlinePositionEmu: s === "inline" ? Ee(a.element, e.zoom.value) : void 0
2245
+ inlinePositionEmu: s === "inline" ? De(a.element, e.zoom.value) : void 0
2208
2246
  }, r.value.isOpen = !1;
2209
2247
  }
2210
2248
  function c(t) {
@@ -2220,16 +2258,16 @@ function jn(e) {
2220
2258
  switch (t) {
2221
2259
  case "cut":
2222
2260
  if (e.selectedImage.value) {
2223
- En(n, e.selectedImage.value.pmPos);
2261
+ An(n, e.selectedImage.value.pmPos);
2224
2262
  let t = e.selectedImage.value.pmPos, r = n.state.doc.nodeAt(t);
2225
2263
  r && (n.dispatch(n.state.tr.delete(t, t + r.nodeSize)), e.selectedImage.value = null);
2226
2264
  } else document.execCommand("cut");
2227
2265
  break;
2228
2266
  case "copy":
2229
- e.selectedImage.value ? En(n, e.selectedImage.value.pmPos) : document.execCommand("copy");
2267
+ e.selectedImage.value ? An(n, e.selectedImage.value.pmPos) : document.execCommand("copy");
2230
2268
  break;
2231
2269
  case "paste":
2232
- kn(n);
2270
+ Nn(n);
2233
2271
  break;
2234
2272
  case "pasteAsPlainText":
2235
2273
  navigator.clipboard.readText().then((e) => {
@@ -2242,7 +2280,7 @@ function jn(e) {
2242
2280
  break;
2243
2281
  }
2244
2282
  case "selectAll": {
2245
- let e = xe.create(n.state.doc, 0, n.state.doc.content.size);
2283
+ let e = fe.create(n.state.doc, 0, n.state.doc.content.size);
2246
2284
  n.dispatch(n.state.tr.setSelection(e));
2247
2285
  break;
2248
2286
  }
@@ -2250,7 +2288,7 @@ function jn(e) {
2250
2288
  e.selectedImage.value && (e.showImageProperties.value = !0);
2251
2289
  break;
2252
2290
  case "replaceImage":
2253
- e.selectedImage.value && An(n, e.selectedImage.value.pmPos);
2291
+ e.selectedImage.value && Pn(n, e.selectedImage.value.pmPos);
2254
2292
  break;
2255
2293
  case "deleteImage":
2256
2294
  if (e.selectedImage.value) {
@@ -2285,55 +2323,64 @@ function jn(e) {
2285
2323
  }
2286
2324
  //#endregion
2287
2325
  //#region src/composables/usePagesPointer.ts
2288
- var Mn = 500;
2289
- function Nn(e) {
2290
- let t = I(null), n = null;
2326
+ var In = 500;
2327
+ function Ln(e) {
2328
+ let t = L(null), n = null;
2291
2329
  function r() {
2292
2330
  n !== null && (clearTimeout(n), n = null);
2293
2331
  }
2294
- let i = I(null), a = 0, o = null, s = 0, c = !1, l = null, u = I({
2332
+ let i = de(null), a = 0, o = null, s = 0, c = !1, l = null, u = L({
2295
2333
  currentPage: 1,
2296
2334
  totalPages: 1,
2297
2335
  visible: !1
2298
2336
  }), d = null;
2299
2337
  function f(t, n) {
2300
- return bn(e.pagesRef.value, e.editorView.value, t, n);
2338
+ return Cn(e.pagesRef.value, e.editorView.value, t, n);
2301
2339
  }
2302
- function p(t, n) {
2303
- let r = e.editorView.value;
2304
- if (!r) return;
2305
- let i = r.state.doc.resolve(t), a = n === void 0 ? i : r.state.doc.resolve(n), o = xe.between(i, a);
2306
- r.dispatch(r.state.tr.setSelection(o));
2340
+ function p() {
2341
+ let t = i.value;
2342
+ if (t?.headerFooter && e.getHfPmView) {
2343
+ let n = e.getHfPmView(t.headerFooter);
2344
+ if (n) return n;
2345
+ }
2346
+ return e.editorView.value;
2307
2347
  }
2308
- function m(t) {
2309
- yn(e.pagesRef.value, e.pagesViewportRef.value, t);
2348
+ function m(e, t) {
2349
+ let n = p();
2350
+ if (n) try {
2351
+ let r = n.state.doc.resolve(e), i = t === void 0 ? r : n.state.doc.resolve(t), a = fe.between(r, i);
2352
+ n.dispatch(n.state.tr.setSelection(a));
2353
+ } catch {}
2310
2354
  }
2311
2355
  function h(t) {
2312
- xn(e.pagesRef.value, t, p);
2356
+ $(e.pagesRef.value, e.pagesViewportRef.value, t);
2313
2357
  }
2314
2358
  function g(t) {
2315
- Sn(e.pagesRef.value, t, p);
2359
+ wn(e.pagesRef.value, t, m);
2316
2360
  }
2317
2361
  function _(t) {
2362
+ Tn(e.pagesRef.value, t, m);
2363
+ }
2364
+ function v(t) {
2318
2365
  let n = e.editorView.value;
2319
2366
  if (!n) return;
2320
2367
  let r = null;
2321
2368
  if (n.state.doc.descendants((e, n) => r === null ? (e.attrs?.bookmarks)?.some((e) => e.name === t) ? (r = n, !1) : !0 : !1), r !== null) {
2322
- m(r);
2369
+ h(r);
2323
2370
  try {
2324
- p(Math.min(r + 1, n.state.doc.content.size));
2371
+ m(Math.min(r + 1, n.state.doc.content.size));
2325
2372
  } catch {
2326
- p(r);
2373
+ m(r);
2327
2374
  }
2328
2375
  }
2329
2376
  }
2330
- function ee(a) {
2377
+ function y(a) {
2331
2378
  if (e.readOnly.value || c) return;
2332
2379
  let o = e.pagesRef.value;
2333
2380
  if (!o) return;
2334
2381
  let s = e.pagesViewportRef.value;
2335
2382
  if (!s) return;
2336
- let l = Ye({
2383
+ let l = et({
2337
2384
  mouseX: a.clientX,
2338
2385
  mouseY: a.clientY,
2339
2386
  pagesContainer: o,
@@ -2343,7 +2390,7 @@ function Nn(e) {
2343
2390
  if (!l) {
2344
2391
  n === null && (n = setTimeout(() => {
2345
2392
  t.value = null, n = null;
2346
- }, Je));
2393
+ }, $e));
2347
2394
  return;
2348
2395
  }
2349
2396
  let u = s.getBoundingClientRect();
@@ -2354,16 +2401,16 @@ function Nn(e) {
2354
2401
  cellPmPos: l.cellPmPos
2355
2402
  }, r();
2356
2403
  }
2357
- function v(n) {
2404
+ function b(n) {
2358
2405
  n.preventDefault(), n.stopPropagation();
2359
2406
  let r = t.value, i = e.editorView.value;
2360
2407
  if (!r || !i) return;
2361
- let a = i.state.tr.setSelection(xe.create(i.state.doc, r.cellPmPos + 1));
2408
+ let a = i.state.tr.setSelection(fe.create(i.state.doc, r.cellPmPos + 1));
2362
2409
  i.dispatch(a);
2363
2410
  let o = e.getCommands(), s = r.type === "row" ? o.addRowBelow?.() : o.addColumnRight?.();
2364
2411
  s && (s(i.state, (e) => i.dispatch(e), i), t.value = null, i.focus());
2365
2412
  }
2366
- function y(t) {
2413
+ function x(t) {
2367
2414
  let n = t.target?.closest("a[href]");
2368
2415
  if (!n) return;
2369
2416
  t.preventDefault();
@@ -2371,7 +2418,7 @@ function Nn(e) {
2371
2418
  if (!r) return;
2372
2419
  if (r.startsWith("#")) {
2373
2420
  let e = r.slice(1);
2374
- e && _(e);
2421
+ e && v(e);
2375
2422
  return;
2376
2423
  }
2377
2424
  let i = e.editorView.value;
@@ -2389,14 +2436,58 @@ function Nn(e) {
2389
2436
  }
2390
2437
  };
2391
2438
  }
2392
- function b(t) {
2439
+ function S(t) {
2393
2440
  let n = t.target, r = n.closest(".layout-page-header"), a = n.closest(".layout-page-footer"), o = r ?? a;
2394
2441
  if (!o) return;
2395
2442
  let s = r ? "header" : "footer", c = e.getDocument();
2396
2443
  if (!c?.package) return;
2397
- let l = c.package.document?.sections?.[0]?.properties ?? c.package.document?.finalSectionProperties ?? null, u = s === "header" ? l?.headerReferences : l?.footerReferences, d = s === "header" ? c.package.headers : c.package.footers;
2398
- if (!u || !d) return;
2399
- let f = (u.find((e) => e.type === "default") ?? u.find((e) => e.type === "first"))?.rId ?? null, p = f ? d.get(f) ?? null : null, m = e.pagesViewportRef.value;
2444
+ let l = c.package.document?.sections?.[0]?.properties ?? c.package.document?.finalSectionProperties ?? null, u = s === "header" ? l?.headerReferences : l?.footerReferences, d = s === "header" ? c.package.headers : c.package.footers, f = (u?.find((e) => e.type === "default") ?? u?.find((e) => e.type === "first") ?? null)?.rId ?? null, p = f ? d?.get(f) ?? null : null;
2445
+ if (!p) {
2446
+ if (!l) return;
2447
+ let t = "default", n = `rId_new_${s}_${t}`, r = {
2448
+ type: s,
2449
+ hdrFtrType: t,
2450
+ content: [{
2451
+ type: "paragraph",
2452
+ content: []
2453
+ }]
2454
+ }, i = s === "header" ? "headers" : "footers", a = s === "header" ? "headerReferences" : "footerReferences", o = new Map(c.package[i] ?? []);
2455
+ o.set(n, r);
2456
+ let u = c.package.relationships, d = /* @__PURE__ */ new Set();
2457
+ for (let e of u?.values() ?? []) e.target && d.add(e.target);
2458
+ let m = 1;
2459
+ for (; d.has(`${s}${m}.xml`);) m++;
2460
+ let h = s === "header" ? "http://schemas.openxmlformats.org/officeDocument/2006/relationships/header" : "http://schemas.openxmlformats.org/officeDocument/2006/relationships/footer", g = new Map(u);
2461
+ g.set(n, {
2462
+ id: n,
2463
+ type: h,
2464
+ target: `${s}${m}.xml`
2465
+ });
2466
+ let _ = {
2467
+ type: t,
2468
+ rId: n
2469
+ }, v = l && {
2470
+ ...l,
2471
+ [a]: [...l[a] ?? [], _]
2472
+ }, y = {
2473
+ ...c,
2474
+ package: {
2475
+ ...c.package,
2476
+ [i]: o,
2477
+ relationships: g,
2478
+ document: c.package.document ? {
2479
+ ...c.package.document,
2480
+ sections: c.package.document.sections?.map((e, t) => t === 0 ? {
2481
+ ...e,
2482
+ properties: v ?? e.properties
2483
+ } : e),
2484
+ finalSectionProperties: c.package.document.finalSectionProperties === l ? v : c.package.document.finalSectionProperties
2485
+ } : c.package.document
2486
+ }
2487
+ };
2488
+ f = n, p = r, e.setDocument?.(y), e.syncHfPMs?.(), e.reLayout(), e.emit("change", y);
2489
+ }
2490
+ let m = e.pagesViewportRef.value;
2400
2491
  if (!m) return;
2401
2492
  let h = o.getBoundingClientRect(), g = m.getBoundingClientRect(), _ = e.zoom.value || 1;
2402
2493
  i.value = {
@@ -2411,70 +2502,73 @@ function Nn(e) {
2411
2502
  }
2412
2503
  };
2413
2504
  }
2414
- function x(t) {
2505
+ function ee(t) {
2415
2506
  let n = e.getDocument(), r = i.value;
2416
2507
  if (!n?.package || !r) return;
2417
2508
  let a = r.position === "header" ? n.package.headers : n.package.footers;
2418
2509
  if (!a || !r.rId) return;
2419
2510
  let o = a.get(r.rId);
2420
- o && (o.content = t), e.reLayout(), e.emit("change", n);
2511
+ o && (o.content = t), e.syncHfPMs?.(), e.reLayout(), e.emit("change", n);
2421
2512
  }
2422
2513
  function te() {
2423
2514
  let t = e.getDocument(), n = i.value;
2424
2515
  if (!t?.package || !n || !n.rId) return;
2425
2516
  let r = (n.position === "header" ? t.package.headers : t.package.footers)?.get(n.rId);
2426
- r && (r.content = []), i.value = null, e.reLayout(), e.emit("change", t);
2517
+ r && (r.content = []), i.value = null, e.syncHfPMs?.(), e.reLayout(), e.emit("change", t);
2427
2518
  }
2428
2519
  function ne(t) {
2429
2520
  if (t.button !== 0 || e.imageInteracting.value) return;
2430
2521
  let n = e.editorView.value;
2431
- if (!n || !e.readOnly.value && e.tableResize.tryStartResize(t, n)) return;
2432
- let r = t.target, i = De(r);
2433
- if (i) {
2522
+ if (!n) return;
2523
+ let r = t.target;
2524
+ i.value && (r.closest(".layout-page-header") || r.closest(".layout-page-footer") || r.closest(".hf-editor") || (i.value = null, n.focus()));
2525
+ let u = p() ?? n;
2526
+ if (!e.readOnly.value && e.tableResize.tryStartResize(t, u)) return;
2527
+ let d = ke(r);
2528
+ if (d) {
2434
2529
  t.preventDefault(), t.stopPropagation();
2435
- let r = Number(i.dataset.pmStart);
2436
- if (!isNaN(r)) {
2530
+ let n = Number(d.dataset.pmStart);
2531
+ if (!isNaN(n)) {
2437
2532
  try {
2438
- let e = be.create(n.state.doc, r);
2439
- n.dispatch(n.state.tr.setSelection(e));
2533
+ u.dispatch(u.state.tr.setSelection(q.create(u.state.doc, n)));
2440
2534
  } catch {}
2441
2535
  e.selectedImage.value = {
2442
- element: i,
2443
- pmPos: r,
2444
- width: i.offsetWidth,
2445
- height: i.offsetHeight
2536
+ element: d,
2537
+ pmPos: n,
2538
+ width: d.offsetWidth,
2539
+ height: d.offsetHeight
2446
2540
  }, e.clearOverlay();
2447
2541
  }
2448
- n.focus();
2542
+ u.focus();
2449
2543
  return;
2450
2544
  }
2451
2545
  e.selectedImage.value = null, t.preventDefault();
2452
- let u = f(t.clientX, t.clientY);
2453
- if (u === null) {
2454
- n.focus();
2546
+ let h = f(t.clientX, t.clientY);
2547
+ if (h === null) {
2548
+ u.focus();
2455
2549
  return;
2456
2550
  }
2457
- let d = Date.now();
2458
- if (d - a < Mn && o === u ? s++ : s = 1, a = d, o = u, s === 2) h(u);
2459
- else if (s >= 3) g(u), s = 0;
2551
+ let v = Date.now();
2552
+ if (v - a < In && o === h ? s++ : s = 1, a = v, o = h, s === 2) g(h);
2553
+ else if (s >= 3) _(h), s = 0;
2460
2554
  else {
2461
2555
  if (t.shiftKey) {
2462
- let { from: e } = n.state.selection;
2463
- p(e, u);
2464
- } else p(u);
2465
- l = u, c = !0;
2556
+ let { from: e } = u.state.selection;
2557
+ m(e, h);
2558
+ } else m(h);
2559
+ l = h, c = !0;
2466
2560
  }
2467
- n.focus();
2561
+ u.focus();
2468
2562
  }
2469
- function re(e) {
2563
+ function C(e) {
2470
2564
  if (!c || l === null) return;
2471
2565
  let t = f(e.clientX, e.clientY);
2472
- t !== null && t !== l && p(l, t);
2566
+ t !== null && t !== l && m(l, t);
2473
2567
  }
2474
- function S() {
2568
+ function w() {
2475
2569
  c = !1;
2476
2570
  }
2477
- function C() {
2571
+ function T() {
2478
2572
  let t = e.pagesViewportRef.value, n = e.layout.value;
2479
2573
  if (!t || !n || n.pages.length === 0) return;
2480
2574
  let r = t.scrollTop, i = n.pages.length, a = r + t.clientHeight / 2, o = 24, s = 1;
@@ -2497,31 +2591,31 @@ function Nn(e) {
2497
2591
  };
2498
2592
  }, 600);
2499
2593
  }
2500
- return P(() => {
2501
- window.addEventListener("mousemove", re), window.addEventListener("mouseup", S), e.pagesViewportRef.value?.addEventListener("scroll", C, { passive: !0 });
2502
- }), N(() => {
2503
- r(), window.removeEventListener("mousemove", re), window.removeEventListener("mouseup", S), e.pagesViewportRef.value?.removeEventListener("scroll", C), d && clearTimeout(d);
2594
+ return F(() => {
2595
+ window.addEventListener("mousemove", C), window.addEventListener("mouseup", w), e.pagesViewportRef.value?.addEventListener("scroll", T, { passive: !0 });
2596
+ }), P(() => {
2597
+ r(), window.removeEventListener("mousemove", C), window.removeEventListener("mouseup", w), e.pagesViewportRef.value?.removeEventListener("scroll", T), d && clearTimeout(d);
2504
2598
  }), {
2505
2599
  tableInsertButton: t,
2506
2600
  hfEdit: i,
2507
2601
  scrollPageInfo: u,
2508
2602
  resolvePos: f,
2509
- setPmSelection: p,
2510
- scrollVisiblePositionIntoView: m,
2511
- navigateToBookmark: _,
2603
+ setPmSelection: m,
2604
+ scrollVisiblePositionIntoView: h,
2605
+ navigateToBookmark: v,
2512
2606
  handlePagesMouseDown: ne,
2513
- handlePagesMouseMove: ee,
2514
- handlePagesClick: y,
2515
- handlePagesDoubleClick: b,
2516
- handleTableInsertClick: v,
2607
+ handlePagesMouseMove: y,
2608
+ handlePagesClick: x,
2609
+ handlePagesDoubleClick: S,
2610
+ handleTableInsertClick: b,
2517
2611
  clearTableInsertTimer: r,
2518
- handleHfSave: x,
2612
+ handleHfSave: ee,
2519
2613
  handleHfRemove: te
2520
2614
  };
2521
2615
  }
2522
2616
  //#endregion
2523
2617
  //#region src/composables/useSelectionSync.ts
2524
- function Pn(e) {
2618
+ function Rn(e) {
2525
2619
  let t = null, n = null;
2526
2620
  function r() {
2527
2621
  let r = e.pagesRef.value;
@@ -2529,13 +2623,12 @@ function Pn(e) {
2529
2623
  }
2530
2624
  function i() {
2531
2625
  let i = e.pagesRef.value, a = e.editorView.value;
2532
- if (!i || !a) return;
2533
- r();
2626
+ if (!i || !a || (r(), e.isHfEditing?.value)) return;
2534
2627
  let o = a.state.selection;
2535
- if (o instanceof be && o.node.type.name === "image") {
2628
+ if (o instanceof q && o.node.type.name === "image") {
2536
2629
  let t = null;
2537
2630
  for (let e of i.querySelectorAll(`[data-pm-start="${o.from}"]`)) {
2538
- let n = De(e);
2631
+ let n = ke(e);
2539
2632
  if (n) {
2540
2633
  t = n;
2541
2634
  break;
@@ -2555,7 +2648,7 @@ function Pn(e) {
2555
2648
  if (e.selectedImage.value) return;
2556
2649
  let { from: s, to: c, empty: l } = a.state.selection, u = i.scrollTop, d = i.scrollLeft;
2557
2650
  if (l) {
2558
- let e = Ce(i, s, i.getBoundingClientRect());
2651
+ let e = Te(i, s, i.getBoundingClientRect());
2559
2652
  if (e) {
2560
2653
  let r = document.createElement("div");
2561
2654
  r.className = "vue-caret", r.style.cssText = `
@@ -2566,7 +2659,7 @@ function Pn(e) {
2566
2659
  height: ${e.height}px;
2567
2660
  background: #000;
2568
2661
  pointer-events: none;
2569
- z-index: ${te.selectionOverlay};
2662
+ z-index: ${ee.selectionOverlay};
2570
2663
  `, i.appendChild(r), n = r;
2571
2664
  let a = !0;
2572
2665
  t = setInterval(() => {
@@ -2575,7 +2668,7 @@ function Pn(e) {
2575
2668
  }
2576
2669
  return;
2577
2670
  }
2578
- let f = we(i, s, c, i.getBoundingClientRect());
2671
+ let f = Ee(i, s, c, i.getBoundingClientRect());
2579
2672
  for (let e of f) {
2580
2673
  let t = document.createElement("div");
2581
2674
  t.className = "vue-sel-rect", t.style.cssText = `
@@ -2586,11 +2679,11 @@ function Pn(e) {
2586
2679
  height: ${e.height}px;
2587
2680
  background: rgba(66, 133, 244, 0.3);
2588
2681
  pointer-events: none;
2589
- z-index: ${te.selectionOverlay};
2682
+ z-index: ${ee.selectionOverlay};
2590
2683
  `, i.appendChild(t);
2591
2684
  }
2592
2685
  }
2593
- return N(() => {
2686
+ return P(() => {
2594
2687
  r();
2595
2688
  }), {
2596
2689
  clearOverlay: r,
@@ -2599,7 +2692,7 @@ function Pn(e) {
2599
2692
  }
2600
2693
  //#endregion
2601
2694
  //#region src/composables/useMenuActions.ts
2602
- function Fn(e) {
2695
+ function zn(e) {
2603
2696
  function t(t) {
2604
2697
  let n = e.editorView.value;
2605
2698
  if (!n) return;
@@ -2651,7 +2744,7 @@ function Fn(e) {
2651
2744
  e.showKeyboardShortcuts.value = !0;
2652
2745
  break;
2653
2746
  case "reportIssue":
2654
- Xe();
2747
+ tt();
2655
2748
  break;
2656
2749
  case "dirLTR":
2657
2750
  t("setLtr");
@@ -2669,26 +2762,26 @@ function Fn(e) {
2669
2762
  }
2670
2763
  //#endregion
2671
2764
  //#region src/composables/useDocumentLifecycle.ts
2672
- function In(e) {
2765
+ function Bn(e) {
2673
2766
  async function t(t) {
2674
2767
  e.sidebarAutoOpenedRef.value = !1, await e.loadDocumentBuffer(t);
2675
2768
  }
2676
2769
  function n(t) {
2677
2770
  e.sidebarAutoOpenedRef.value = !1, e.loadDocument(t);
2678
2771
  }
2679
- V(e.documentBuffer, (e) => {
2772
+ H(e.documentBuffer, (e) => {
2680
2773
  e && t(e);
2681
- }), V(e.document, (e) => {
2774
+ }), H(e.document, (e) => {
2682
2775
  e && n(e);
2683
- }), P(async () => {
2684
- await j();
2776
+ }), F(async () => {
2777
+ await ce();
2685
2778
  let r = e.documentBuffer(), i = e.document();
2686
2779
  r ? await t(r) : i && n(i);
2687
2780
  });
2688
2781
  }
2689
2782
  //#endregion
2690
2783
  //#region src/composables/useDocxEditorRefApi.ts
2691
- function Ln(e) {
2784
+ function Vn(e) {
2692
2785
  function t() {
2693
2786
  e.onPrint?.(), window.print();
2694
2787
  }
@@ -2724,26 +2817,26 @@ function Ln(e) {
2724
2817
  function c() {
2725
2818
  let t = e.layout.value, n = e.editorView.value;
2726
2819
  if (!t || !n) return 0;
2727
- let r = Ie(t, n.state.selection.from);
2820
+ let r = Le(t, n.state.selection.from);
2728
2821
  return r == null ? 0 : r + 1;
2729
2822
  }
2730
2823
  function l(t) {
2731
2824
  let n = e.editorView.value;
2732
2825
  if (!n) return !1;
2733
- let r = et(n.state.doc, t);
2826
+ let r = it(n.state.doc, t);
2734
2827
  return r ? (e.scrollVisiblePositionIntoView(r.from + 1), !0) : !1;
2735
2828
  }
2736
2829
  function u(t, n) {
2737
- return it(e.editorView.value, t, n);
2830
+ return ct(e.editorView.value, t, n);
2738
2831
  }
2739
2832
  function d() {
2740
- return at(e.editorView.value);
2833
+ return lt(e.editorView.value);
2741
2834
  }
2742
2835
  function f() {
2743
2836
  return e.comments.value;
2744
2837
  }
2745
2838
  function p(t) {
2746
- return ot(e.editorView.value, e.layout.value, t);
2839
+ return ut(e.editorView.value, e.layout.value, t);
2747
2840
  }
2748
2841
  function m(t) {
2749
2842
  return e.contentChangeSubscribers.add(t), () => e.contentChangeSubscribers.delete(t);
@@ -2784,17 +2877,26 @@ function Ln(e) {
2784
2877
  } };
2785
2878
  }
2786
2879
  //#endregion
2880
+ //#region src/composables/useFontLifecycle.ts
2881
+ function Hn(e, t) {
2882
+ H(e, (e) => {
2883
+ ve(e);
2884
+ }, { immediate: !0 });
2885
+ let n = ye(t);
2886
+ P(() => n());
2887
+ }
2888
+ //#endregion
2787
2889
  //#region src/components/DocxEditor.vue?vue&type=script&setup=true&lang.ts
2788
- var Rn = { class: "docx-editor-vue__toolbar-shell" }, zn = {
2890
+ var Un = { class: "docx-editor-vue__toolbar-shell" }, Wn = {
2789
2891
  key: 0,
2790
2892
  class: "docx-editor-vue__error"
2791
- }, Bn = {
2893
+ }, Gn = {
2792
2894
  key: 1,
2793
2895
  class: "docx-editor-vue__loading"
2794
- }, Vn = { class: "docx-editor-vue__editor-area" }, Hn = {
2896
+ }, Kn = { class: "docx-editor-vue__editor-area" }, qn = {
2795
2897
  key: 0,
2796
2898
  class: "docx-editor-vue__vertical-ruler"
2797
- }, Un = ["title"], Wn = ["title", "aria-label"], Gn = /* @__PURE__ */ A({
2899
+ }, Jn = ["title"], Yn = ["title", "aria-label"], Xn = /* @__PURE__ */ j({
2798
2900
  __name: "DocxEditor",
2799
2901
  props: {
2800
2902
  documentBuffer: { default: null },
@@ -2850,6 +2952,7 @@ var Rn = { class: "docx-editor-vue__toolbar-shell" }, zn = {
2850
2952
  default: !0
2851
2953
  },
2852
2954
  fontFamilies: { default: void 0 },
2955
+ fonts: {},
2853
2956
  onPrint: {
2854
2957
  type: Function,
2855
2958
  default: void 0
@@ -2885,52 +2988,104 @@ var Rn = { class: "docx-editor-vue__toolbar-shell" }, zn = {
2885
2988
  "mode-change"
2886
2989
  ],
2887
2990
  setup(e, { expose: n, emit: r }) {
2888
- let i = e, a = r, o = I(i.mode), s = w(() => i.readOnly || o.value === "viewing");
2889
- f(w(() => i.i18n));
2890
- let { t: l } = t(w(() => i.i18n)), u = I(null), d = I(null), g = I(null), v = I(0), b = /* @__PURE__ */ new Set(), x = /* @__PURE__ */ new Set(), te = new Ze(), C = I(!1), ie = I(!1), ae = I(!1), se = I(!1), A = I(!1), ce = I(!1), L = I(i.showOutline), B = I(!1), U = I(!1), W = I(!1), pe = I(null), K = fe([]), he = fe([]), ge = fe([]), { zoom: q, zoomPercent: _e, isMinZoom: ve, isMaxZoom: ye, setZoom: be, zoomIn: xe, zoomOut: Se, handleWheel: Ce, handleKeyDown: we, installShortcuts: Te, ZOOM_PRESETS: Ee } = ne(i.initialZoom);
2991
+ let i = e, a = r, o = L(i.mode), s = E(() => i.readOnly || o.value === "viewing");
2992
+ f(E(() => i.i18n));
2993
+ let { t: l } = t(E(() => i.i18n)), u = L(null), d = L(null), g = L(null), y = L(0), x = /* @__PURE__ */ new Set(), S = /* @__PURE__ */ new Set(), ee = new Ne(), w = L(!1), T = L(!1), re = L(!1), oe = L(!1), j = L(!1), se = L(!1), R = L(i.showOutline), V = L(!1), W = L(!1), G = L(!1), q = L(null), pe = de([]), he = de([]), J = de([]), { zoom: Y, zoomPercent: _e, isMinZoom: ve, isMaxZoom: ye, setZoom: be, zoomIn: xe, zoomOut: Se, handleWheel: Ce, handleKeyDown: we, installShortcuts: Te, ZOOM_PRESETS: Ee } = te(i.initialZoom);
2891
2994
  Te();
2892
- let { editorView: J, isReady: De, parseError: Oe, layout: ke, loadBuffer: Ae, loadDocument: je, save: Me, focus: Ne, destroy: Pe, getDocument: Y, getCommands: X, reLayout: Ie } = re({
2995
+ let { editorView: X, isReady: De, parseError: Oe, layout: ke, loadBuffer: Ae, loadDocument: je, save: Me, focus: Pe, destroy: Fe, getDocument: Z, getCommands: Le, reLayout: Re, getHfPmView: ze, syncHfPMs: Be, setHfTransactionListener: Ve, setDocument: He } = ne({
2893
2996
  hiddenContainer: u,
2894
2997
  pagesContainer: d,
2895
2998
  readOnly: s,
2896
2999
  externalPlugins: i.externalPlugins,
2897
- syncCoordinator: te,
3000
+ syncCoordinator: ee,
3001
+ editorMode: o,
2898
3002
  onChange: (e) => {
2899
- a("change", e), a("update:document", e), b.forEach((t) => t(e));
3003
+ a("change", e), a("update:document", e), x.forEach((t) => t(e));
2900
3004
  },
2901
3005
  onError: (e) => a("error", e),
2902
3006
  onSelectionUpdate: () => {
2903
- v.value++, er();
2904
- let e = at(J.value);
2905
- x.forEach((t) => t(e));
3007
+ y.value++, ur();
3008
+ let e = lt(X.value);
3009
+ S.forEach((t) => t(e));
2906
3010
  }
2907
- }), Z = w(() => {
2908
- v.value;
2909
- let e = Y();
3011
+ }), Ue = E(() => {
3012
+ y.value;
3013
+ let e = Z();
2910
3014
  if (!e?.package?.document) return null;
2911
3015
  let t = e.package.document;
2912
3016
  return t.finalSectionProperties ?? t.sections?.[0]?.properties ?? null;
2913
- }), Le = w(() => (v.value, Y()?.package?.theme ?? i.theme ?? null)), Re = w(() => {
3017
+ }), We = E(() => (y.value, Z()?.package?.theme ?? i.theme ?? null)), Ge = L(null);
3018
+ Hn(() => i.fonts, (e) => a("error", e));
3019
+ let Ke = E(() => $.value?.headerFooter ? ze($.value.headerFooter) ?? null : null);
3020
+ F(() => {
3021
+ Ve((e, t) => {
3022
+ requestAnimationFrame(() => {
3023
+ Ge.value = me(t);
3024
+ let e = $.value;
3025
+ if (!e) return;
3026
+ let n = window.document.querySelector(e.position === "header" ? ".layout-page-header" : ".layout-page-footer"), r = g.value;
3027
+ if (!n || !r) return;
3028
+ let i = n.getBoundingClientRect(), a = r.getBoundingClientRect(), o = Y.value || 1;
3029
+ $.value = {
3030
+ ...e,
3031
+ targetRect: {
3032
+ top: (i.top - a.top + r.scrollTop) / o,
3033
+ left: (i.left - a.left + r.scrollLeft) / o,
3034
+ width: i.width / o,
3035
+ height: i.height / o
3036
+ }
3037
+ };
3038
+ });
3039
+ }), H(() => $.value, (e) => {
3040
+ if (!e) {
3041
+ Ge.value = null;
3042
+ return;
3043
+ }
3044
+ let t = X.value;
3045
+ if (t) {
3046
+ try {
3047
+ let e = t.state.tr.setSelection(fe.create(t.state.doc, 0));
3048
+ t.dispatch(e);
3049
+ } catch {}
3050
+ t.dom.blur?.();
3051
+ }
3052
+ dr.updateSelectionOverlay();
3053
+ });
3054
+ let e = 0;
3055
+ function t() {
3056
+ !$.value || e || (e = requestAnimationFrame(() => {
3057
+ e = 0;
3058
+ let t = $.value;
3059
+ if (!t?.headerFooter) return;
3060
+ let n = ze(t.headerFooter);
3061
+ n && (Ge.value = me(n));
3062
+ }));
3063
+ }
3064
+ window.addEventListener("scroll", t, !0), window.addEventListener("resize", t), P(() => {
3065
+ e && cancelAnimationFrame(e), window.removeEventListener("scroll", t, !0), window.removeEventListener("resize", t);
3066
+ });
3067
+ });
3068
+ let qe = E(() => {
2914
3069
  let e = [];
2915
- return U.value && e.push(`translateX(-${me}px)`), q.value !== 1 && e.push(`scale(${q.value})`), {
3070
+ return W.value && e.push(`translateX(-${ge}px)`), Y.value !== 1 && e.push(`scale(${Y.value})`), {
2916
3071
  transform: e.length > 0 ? e.join(" ") : void 0,
2917
3072
  transformOrigin: "top center",
2918
3073
  transition: "transform 0.2s ease"
2919
3074
  };
2920
- }), ze = w(() => ({
3075
+ }), Je = E(() => ({
2921
3076
  paddingLeft: "20px",
2922
- paddingRight: 20 + (U.value ? me * 2 : 0) + "px",
3077
+ paddingRight: 20 + (W.value ? ge * 2 : 0) + "px",
2923
3078
  transition: "padding 0.2s ease"
2924
- })), Be = w(() => {
2925
- let e = Z.value;
2926
- return Fe(e?.pageWidth ?? 12240) * q.value;
2927
- }), Ve = w(() => {
3079
+ })), Ye = E(() => {
3080
+ let e = Ue.value;
3081
+ return Ie(e?.pageWidth ?? 12240) * Y.value;
3082
+ }), Xe = E(() => {
2928
3083
  let e = /* @__PURE__ */ new Set();
2929
- for (let t of K.value) t.parentId == null && t.done && e.add(t.id);
3084
+ for (let t of pe.value) t.parentId == null && t.done && e.add(t.id);
2930
3085
  return e;
2931
- }), He = w(() => {
2932
- v.value;
2933
- let e = J.value;
3086
+ }), Ze = E(() => {
3087
+ y.value;
3088
+ let e = X.value;
2934
3089
  if (!e) return [];
2935
3090
  let t = /* @__PURE__ */ new Set(), n = [];
2936
3091
  return e.state.doc.descendants((e) => {
@@ -2945,201 +3100,205 @@ var Rn = { class: "docx-editor-vue__toolbar-shell" }, zn = {
2945
3100
  }
2946
3101
  return !0;
2947
3102
  }), n.sort((e, t) => e.name.localeCompare(t.name));
2948
- }), { floatingCommentBtn: Ue, pendingCommentRange: We, addCommentYPosition: Ge, sidebarAutoOpenedRef: Ke, extractCommentsAndChanges: qe, handleAddComment: Je, handleCancelAddComment: Ye, handleStartAddComment: Xe, handleMarkerClick: Qe } = Cn({
2949
- editorView: J,
2950
- getDocument: Y,
2951
- comments: K,
3103
+ }), { floatingCommentBtn: Qe, pendingCommentRange: $e, addCommentYPosition: et, sidebarAutoOpenedRef: tt, extractCommentsAndChanges: nt, handleAddComment: rt, handleCancelAddComment: it, handleStartAddComment: at, handleMarkerClick: ot } = En({
3104
+ editorView: X,
3105
+ getDocument: Z,
3106
+ comments: pe,
2952
3107
  trackedChanges: he,
2953
- resolvedCommentIds: Ve,
2954
- activeSidebarItem: pe,
2955
- showSidebar: U,
2956
- isAddingComment: W,
3108
+ resolvedCommentIds: Xe,
3109
+ activeSidebarItem: q,
3110
+ showSidebar: W,
3111
+ isAddingComment: G,
2957
3112
  readOnly: s,
2958
- zoom: q,
2959
- stateTick: v,
3113
+ zoom: Y,
3114
+ stateTick: y,
2960
3115
  pagesRef: d,
2961
3116
  pagesViewportRef: g,
2962
3117
  emit: a
2963
- }), { docxInputRef: $e, handleDocxFileChange: et, handleDocumentNameChange: tt, downloadCurrentDocument: nt, emitReadyAfterSidebarStateRefresh: rt, loadDocumentBuffer: it, loadDocument: ot, save: ct } = un({
3118
+ }), { docxInputRef: st, handleDocxFileChange: ct, handleDocumentNameChange: ut, downloadCurrentDocument: ft, loadDocumentBuffer: pt, loadDocument: mt, save: ht } = hn({
2964
3119
  loadBuffer: Ae,
2965
3120
  loadParsedDocument: je,
2966
- getDocument: Y,
3121
+ getDocument: Z,
2967
3122
  saveBlob: Me,
2968
- extractCommentsAndChanges: qe,
3123
+ extractCommentsAndChanges: nt,
2969
3124
  emit: a,
2970
3125
  documentName: () => i.documentName,
2971
3126
  onDocumentNameChange: i.onDocumentNameChange,
2972
- nextTick: j
2973
- }), { hyperlinkPopupData: lt, handleHyperlinkSubmit: ut, handleHyperlinkRemove: dt, handleHyperlinkPopupNavigate: ft, handleHyperlinkPopupEdit: pt, handleHyperlinkPopupRemove: ht } = dn({
2974
- editorView: J,
2975
- getCommands: X
2976
- }), { handleClearFormatting: gt, handleApplyStyle: _t, handleInsertPageBreak: vt, handleInsertSymbol: xt, applyFormatting: St, setParagraphStyle: Ct } = fn({
2977
- editorView: J,
2978
- getDocument: Y
2979
- }), { handlePageSetupApply: Tt, handleLeftMarginChange: Et, handleRightMarginChange: Dt, handleTopMarginChange: Ot, handleBottomMarginChange: jt, handleIndentLeftChange: Mt, handleIndentRightChange: Nt, handleFirstLineIndentChange: Pt, handleTabStopRemove: Ft } = pn({
2980
- editorView: J,
2981
- getDocument: Y,
3127
+ nextTick: ce
3128
+ }), { hyperlinkPopupData: gt, handleHyperlinkSubmit: _t, handleHyperlinkRemove: yt, handleHyperlinkPopupNavigate: bt, handleHyperlinkPopupEdit: xt, handleHyperlinkPopupRemove: St } = gn({
3129
+ editorView: X,
3130
+ getCommands: Le
3131
+ }), { handleClearFormatting: Tt, handleApplyStyle: Et, handleInsertPageBreak: Ot, handleInsertSymbol: kt, applyFormatting: At, setParagraphStyle: jt } = _n({
3132
+ editorView: X,
3133
+ getDocument: Z
3134
+ }), { handlePageSetupApply: Pt, handleLeftMarginChange: Ft, handleRightMarginChange: It, handleTopMarginChange: Lt, handleBottomMarginChange: Rt, handleIndentLeftChange: zt, handleIndentRightChange: Bt, handleFirstLineIndentChange: Vt, handleTabStopRemove: Ht } = vn({
3135
+ editorView: X,
3136
+ getDocument: Z,
2982
3137
  readOnly: s,
2983
- stateTick: v,
2984
- reLayout: Ie,
3138
+ stateTick: y,
3139
+ reLayout: Re,
2985
3140
  emit: a
2986
- }), { handleToggleOutline: It, handleOutlineNavigate: Lt, handleToggleSidebar: Rt, handleEditorScrollMouseDown: zt } = mn({
2987
- editorView: J,
2988
- showOutline: L,
2989
- showSidebar: U,
2990
- outlineHeadings: ge,
2991
- activeSidebarItem: pe,
2992
- extractCommentsAndChanges: qe
3141
+ }), { handleToggleOutline: Ut, handleOutlineNavigate: Wt, handleToggleSidebar: Gt, handleEditorScrollMouseDown: Kt } = yn({
3142
+ editorView: X,
3143
+ showOutline: R,
3144
+ showSidebar: W,
3145
+ outlineHeadings: J,
3146
+ activeSidebarItem: q,
3147
+ extractCommentsAndChanges: nt
2993
3148
  });
2994
- hn({
2995
- showKeyboardShortcuts: B,
2996
- showFindReplace: C,
2997
- showHyperlink: ae,
3149
+ bn({
3150
+ showKeyboardShortcuts: V,
3151
+ showFindReplace: w,
3152
+ showHyperlink: re,
2998
3153
  handleZoomKeyDown: we,
2999
3154
  disableFindReplaceShortcuts: () => i.disableFindReplaceShortcuts
3000
3155
  });
3001
- let { addComment: Bt, replyToComment: Vt, resolveComment: Ht, proposeChange: Ut, handleCommentReply: Wt, handleCommentUnresolve: Gt, handleCommentDelete: Kt, handleAcceptChange: qt, handleRejectChange: Jt, handleTrackedChangeReply: Yt } = _n({
3002
- editorView: J,
3003
- getDocument: Y,
3004
- comments: K,
3156
+ let { addComment: qt, replyToComment: Jt, resolveComment: Yt, proposeChange: Xt, handleCommentReply: Zt, handleCommentUnresolve: Qt, handleCommentDelete: $t, handleAcceptChange: en, handleRejectChange: tn, handleAcceptChangeById: nn, handleRejectChangeById: an, handleTrackedChangeReply: on } = Sn({
3157
+ editorView: X,
3158
+ getDocument: Z,
3159
+ comments: pe,
3005
3160
  trackedChanges: he,
3006
- showSidebar: U,
3007
- isAddingComment: W,
3008
- pendingCommentRange: We,
3009
- contentChangeSubscribers: b,
3010
- extractCommentsAndChanges: qe,
3161
+ showSidebar: W,
3162
+ isAddingComment: G,
3163
+ pendingCommentRange: $e,
3164
+ contentChangeSubscribers: x,
3165
+ extractCommentsAndChanges: nt,
3011
3166
  emit: a
3012
- }), { selectedImage: Q, imageInteracting: Xt, imageToolbarContext: Zt, handleInsertImage: Qt, handleToolbarImageWrap: en, handleImageTransform: tn } = wn({
3013
- editorView: J,
3014
- zoom: q,
3015
- stateTick: v,
3016
- getCommands: X
3017
- }), nn = S(), rn = null, { tableInsertButton: an, hfEdit: $, scrollPageInfo: on, resolvePos: sn, setPmSelection: cn, scrollVisiblePositionIntoView: gn, handlePagesMouseDown: vn, handlePagesMouseMove: yn, handlePagesClick: bn, handlePagesDoubleClick: xn, handleTableInsertClick: Sn, clearTableInsertTimer: Tn, handleHfSave: En, handleHfRemove: Dn } = Nn({
3018
- editorView: J,
3167
+ }), { selectedImage: sn, imageInteracting: cn, imageToolbarContext: ln, handleInsertImage: un, handleToolbarImageWrap: dn, handleImageTransform: fn } = Dn({
3168
+ editorView: X,
3169
+ zoom: Y,
3170
+ stateTick: y,
3171
+ getCommands: Le
3172
+ }), pn = C(), xn = null, { tableInsertButton: Q, hfEdit: $, scrollPageInfo: Cn, resolvePos: wn, setPmSelection: Tn, scrollVisiblePositionIntoView: On, handlePagesMouseDown: kn, handlePagesMouseMove: An, handlePagesClick: jn, handlePagesDoubleClick: Mn, handleTableInsertClick: Nn, clearTableInsertTimer: Pn, handleHfSave: In, handleHfRemove: Xn } = Ln({
3173
+ editorView: X,
3019
3174
  pagesRef: d,
3020
3175
  pagesViewportRef: g,
3021
- selectedImage: Q,
3022
- imageInteracting: Xt,
3023
- hyperlinkPopupData: lt,
3176
+ selectedImage: sn,
3177
+ imageInteracting: cn,
3178
+ hyperlinkPopupData: gt,
3024
3179
  readOnly: s,
3025
- zoom: q,
3180
+ zoom: Y,
3026
3181
  layout: ke,
3027
- tableResize: nn,
3028
- getCommands: X,
3029
- getDocument: Y,
3030
- reLayout: Ie,
3182
+ tableResize: pn,
3183
+ getCommands: Le,
3184
+ getDocument: Z,
3185
+ reLayout: Re,
3031
3186
  emit: a,
3032
- clearOverlay: $n
3033
- }), { contextMenu: On, imageContextMenu: kn, imageContextMenuTextActions: An, handleContextMenu: Mn, handleSelectedImageContextMenu: Gn, handleImageWrapSelect: Kn, handleContextMenuAction: qn } = jn({
3034
- editorView: J,
3035
- selectedImage: Q,
3036
- zoom: q,
3037
- showImageProperties: A,
3038
- getCommands: X,
3039
- clearOverlay: $n,
3040
- setPmSelection: cn,
3041
- resolvePos: sn
3042
- }), { handleMenuAction: Jn, handleMenuTableInsert: Yn } = Fn({
3043
- editorView: J,
3044
- getCommands: X,
3045
- docxInputRef: $e,
3046
- showPageSetup: ce,
3047
- showInsertImage: ie,
3048
- showHyperlink: ae,
3049
- showInsertSymbol: se,
3050
- showKeyboardShortcuts: B,
3051
- handleClearFormatting: gt,
3052
- handleInsertPageBreak: vt,
3053
- handleToggleOutline: It,
3054
- handleToggleSidebar: Rt,
3055
- downloadCurrentDocument: nt,
3187
+ clearOverlay: lr,
3188
+ syncHfPMs: Be,
3189
+ getHfPmView: ze,
3190
+ setDocument: He
3191
+ }), { contextMenu: Zn, imageContextMenu: Qn, imageContextMenuTextActions: $n, handleContextMenu: er, handleSelectedImageContextMenu: tr, handleImageWrapSelect: nr, handleContextMenuAction: rr } = Fn({
3192
+ editorView: X,
3193
+ selectedImage: sn,
3194
+ zoom: Y,
3195
+ showImageProperties: j,
3196
+ getCommands: Le,
3197
+ clearOverlay: lr,
3198
+ setPmSelection: Tn,
3199
+ resolvePos: wn
3200
+ }), { handleMenuAction: ir, handleMenuTableInsert: ar } = zn({
3201
+ editorView: X,
3202
+ getCommands: Le,
3203
+ docxInputRef: st,
3204
+ showPageSetup: se,
3205
+ showInsertImage: T,
3206
+ showHyperlink: re,
3207
+ showInsertSymbol: oe,
3208
+ showKeyboardShortcuts: V,
3209
+ handleClearFormatting: Tt,
3210
+ handleInsertPageBreak: Ot,
3211
+ handleToggleOutline: Ut,
3212
+ handleToggleSidebar: Gt,
3213
+ downloadCurrentDocument: ft,
3056
3214
  emit: a
3057
3215
  });
3058
- In({
3216
+ Bn({
3059
3217
  documentBuffer: () => i.documentBuffer,
3060
3218
  document: () => i.document,
3061
- loadDocumentBuffer: it,
3062
- loadDocument: ot,
3063
- sidebarAutoOpenedRef: Ke
3219
+ loadDocumentBuffer: pt,
3220
+ loadDocument: mt,
3221
+ sidebarAutoOpenedRef: tt
3064
3222
  });
3065
- let Xn = () => J.value, Zn = () => d.value;
3066
- V(() => i.mode, (e) => {
3223
+ let or = () => X.value, sr = () => d.value;
3224
+ H(() => i.mode, (e) => {
3067
3225
  e && e !== o.value && (o.value = e);
3068
- }), V(() => i.showOutline, (e) => {
3069
- L.value = !!e;
3226
+ }), H(() => i.showOutline, (e) => {
3227
+ R.value = !!e;
3070
3228
  });
3071
- function Qn(e) {
3229
+ function cr(e) {
3072
3230
  o.value !== e && (o.value = e, a("mode-change", e));
3073
3231
  }
3074
- P(() => {
3075
- rn = nn.install();
3076
- }), N(() => {
3077
- rn?.();
3232
+ F(() => {
3233
+ xn = pn.install();
3234
+ }), P(() => {
3235
+ xn?.();
3078
3236
  });
3079
- function $n() {
3080
- tr.clearOverlay();
3237
+ function lr() {
3238
+ dr.clearOverlay();
3081
3239
  }
3082
- function er() {
3083
- tr.updateSelectionOverlay();
3240
+ function ur() {
3241
+ dr.updateSelectionOverlay();
3084
3242
  }
3085
- let tr = Pn({
3086
- editorView: J,
3243
+ let dr = Rn({
3244
+ editorView: X,
3087
3245
  pagesRef: d,
3088
- selectedImage: Q
3246
+ selectedImage: sn,
3247
+ isHfEditing: E(() => $.value !== null)
3089
3248
  });
3090
- N(() => {
3091
- $n();
3249
+ P(() => {
3250
+ lr();
3092
3251
  });
3093
- let { exposed: nr } = Ln({
3094
- editorView: J,
3252
+ let { exposed: fr } = Vn({
3253
+ editorView: X,
3095
3254
  layout: ke,
3096
3255
  pagesRef: d,
3097
3256
  pagesViewportRef: g,
3098
- zoom: q,
3099
- comments: K,
3100
- focus: Ne,
3101
- destroy: Pe,
3102
- getDocument: Y,
3257
+ zoom: Y,
3258
+ comments: pe,
3259
+ focus: Pe,
3260
+ destroy: Fe,
3261
+ getDocument: Z,
3103
3262
  setZoom: be,
3104
- save: ct,
3105
- loadDocument: ot,
3106
- loadDocumentBuffer: it,
3107
- addComment: Bt,
3108
- replyToComment: Vt,
3109
- resolveComment: Ht,
3110
- proposeChange: Ut,
3111
- applyFormatting: St,
3112
- setParagraphStyle: Ct,
3113
- scrollVisiblePositionIntoView: gn,
3114
- contentChangeSubscribers: b,
3115
- selectionChangeSubscribers: x,
3263
+ save: ht,
3264
+ loadDocument: mt,
3265
+ loadDocumentBuffer: pt,
3266
+ addComment: qt,
3267
+ replyToComment: Jt,
3268
+ resolveComment: Yt,
3269
+ proposeChange: Xt,
3270
+ applyFormatting: At,
3271
+ setParagraphStyle: jt,
3272
+ scrollVisiblePositionIntoView: On,
3273
+ contentChangeSubscribers: x,
3274
+ selectionChangeSubscribers: S,
3116
3275
  onPrint: i.onPrint
3117
3276
  });
3118
- return n(nr), (t, n) => (F(), D("div", {
3119
- class: le([
3277
+ return n(fr), (t, n) => (I(), O("div", {
3278
+ class: M([
3120
3279
  "docx-editor-vue ep-root paged-editor",
3121
3280
  e.className,
3122
3281
  {
3123
3282
  "paged-editor--readonly": s.value,
3124
- "paged-editor--hf-editing": z($) !== null,
3125
- "paged-editor--editing-header": z($)?.position === "header",
3126
- "paged-editor--editing-footer": z($)?.position === "footer"
3283
+ "paged-editor--hf-editing": B($) !== null,
3284
+ "paged-editor--editing-header": B($)?.position === "header",
3285
+ "paged-editor--editing-footer": B($)?.position === "footer"
3127
3286
  }
3128
3287
  ]),
3129
- style: M(e.style)
3288
+ style: N(e.style)
3130
3289
  }, [
3131
- O("div", Rn, [k(kt, {
3290
+ k("div", Un, [A(Mt, {
3132
3291
  "show-menu-bar": e.showMenuBar,
3133
3292
  "document-name": e.documentName,
3134
3293
  "document-name-editable": e.documentNameEditable,
3135
3294
  "render-logo": e.renderLogo,
3136
3295
  "render-title-bar-right": e.renderTitleBarRight,
3137
- onRename: z(tt),
3138
- onMenuAction: z(Jn),
3139
- onInsertTable: z(Yn)
3296
+ onRename: B(ut),
3297
+ onMenuAction: B(ir),
3298
+ onInsertTable: B(ar)
3140
3299
  }, {
3141
- "title-bar-left": H(() => [ue(t.$slots, "title-bar-left")]),
3142
- "title-bar-right": H(() => [ue(t.$slots, "title-bar-right")]),
3300
+ "title-bar-left": U(() => [le(t.$slots, "title-bar-left")]),
3301
+ "title-bar-right": U(() => [le(t.$slots, "title-bar-right")]),
3143
3302
  _: 3
3144
3303
  }, 8, [
3145
3304
  "show-menu-bar",
@@ -3150,37 +3309,37 @@ var Rn = { class: "docx-editor-vue__toolbar-shell" }, zn = {
3150
3309
  "onRename",
3151
3310
  "onMenuAction",
3152
3311
  "onInsertTable"
3153
- ]), e.showToolbar ? (F(), T(y, {
3312
+ ]), e.showToolbar ? (I(), ie(b, {
3154
3313
  key: 0,
3155
- view: z(J),
3156
- "get-commands": z(X),
3157
- "state-tick": v.value,
3158
- "zoom-percent": z(_e),
3159
- "is-min-zoom": z(ve),
3160
- "is-max-zoom": z(ye),
3161
- "zoom-presets": z(Ee),
3314
+ view: B(X),
3315
+ "get-commands": B(Le),
3316
+ "state-tick": y.value,
3317
+ "zoom-percent": B(_e),
3318
+ "is-min-zoom": B(ve),
3319
+ "is-max-zoom": B(ye),
3320
+ "zoom-presets": B(Ee),
3162
3321
  "show-zoom-control": e.showZoomControl,
3163
3322
  "editor-mode": o.value,
3164
- "comments-sidebar-open": U.value,
3165
- "image-context": z(Zt),
3166
- theme: Le.value,
3323
+ "comments-sidebar-open": W.value,
3324
+ "image-context": B(ln),
3325
+ theme: We.value,
3167
3326
  "font-families": e.fontFamilies,
3168
- onInsertLink: n[0] ||= (e) => ae.value = !0,
3169
- onApplyStyle: z(_t),
3170
- onZoomIn: z(xe),
3171
- onZoomOut: z(Se),
3172
- onZoomSet: z(be),
3173
- onToggleSidebar: z(Rt),
3174
- onModeChange: Qn,
3175
- onImageWrapType: z(en),
3176
- onImageProperties: n[1] ||= (e) => A.value = !0,
3177
- onImageTransform: z(tn)
3178
- }, oe({
3179
- "table-context": H(() => [k(h, {
3180
- view: z(J),
3181
- "get-commands": z(X),
3182
- "state-tick": v.value,
3183
- theme: Le.value
3327
+ onInsertLink: n[0] ||= (e) => re.value = !0,
3328
+ onApplyStyle: B(Et),
3329
+ onZoomIn: B(xe),
3330
+ onZoomOut: B(Se),
3331
+ onZoomSet: B(be),
3332
+ onToggleSidebar: B(Gt),
3333
+ onModeChange: cr,
3334
+ onImageWrapType: B(dn),
3335
+ onImageProperties: n[1] ||= (e) => j.value = !0,
3336
+ onImageTransform: B(fn)
3337
+ }, ae({
3338
+ "table-context": U(() => [A(h, {
3339
+ view: B(X),
3340
+ "get-commands": B(Le),
3341
+ "state-tick": y.value,
3342
+ theme: We.value
3184
3343
  }, null, 8, [
3185
3344
  "view",
3186
3345
  "get-commands",
@@ -3190,11 +3349,11 @@ var Rn = { class: "docx-editor-vue__toolbar-shell" }, zn = {
3190
3349
  _: 2
3191
3350
  }, [e.toolbarExtra ? {
3192
3351
  name: "toolbar-extra",
3193
- fn: H(() => [(F(), T(de(e.toolbarExtra)))]),
3352
+ fn: U(() => [(I(), ie(ue(e.toolbarExtra)))]),
3194
3353
  key: "0"
3195
3354
  } : {
3196
3355
  name: "toolbar-extra",
3197
- fn: H(() => [ue(t.$slots, "toolbar-extra")]),
3356
+ fn: U(() => [le(t.$slots, "toolbar-extra")]),
3198
3357
  key: "1"
3199
3358
  }]), 1032, [
3200
3359
  "view",
@@ -3217,31 +3376,32 @@ var Rn = { class: "docx-editor-vue__toolbar-shell" }, zn = {
3217
3376
  "onToggleSidebar",
3218
3377
  "onImageWrapType",
3219
3378
  "onImageTransform"
3220
- ])) : E("", !0)]),
3221
- k(At, {
3222
- "show-find-replace": C.value,
3223
- "onUpdate:showFindReplace": n[2] ||= (e) => C.value = e,
3224
- "show-insert-image": ie.value,
3225
- "onUpdate:showInsertImage": n[3] ||= (e) => ie.value = e,
3226
- "show-hyperlink": ae.value,
3227
- "onUpdate:showHyperlink": n[4] ||= (e) => ae.value = e,
3228
- "show-insert-symbol": se.value,
3229
- "onUpdate:showInsertSymbol": n[5] ||= (e) => se.value = e,
3230
- "show-image-properties": A.value,
3231
- "onUpdate:showImageProperties": n[6] ||= (e) => A.value = e,
3232
- "show-page-setup": ce.value,
3233
- "onUpdate:showPageSetup": n[7] ||= (e) => ce.value = e,
3234
- "show-keyboard-shortcuts": B.value,
3235
- "onUpdate:showKeyboardShortcuts": n[8] ||= (e) => B.value = e,
3236
- view: z(J),
3237
- bookmarks: He.value,
3238
- "selected-image-pm-pos": z(Q)?.pmPos ?? null,
3239
- "section-properties": Z.value,
3240
- onInsertImage: z(Qt),
3241
- onInsertSymbol: z(xt),
3242
- onHyperlinkSubmit: z(ut),
3243
- onHyperlinkRemove: z(dt),
3244
- onPageSetupApply: z(Tt)
3379
+ ])) : D("", !0)]),
3380
+ A(Nt, {
3381
+ "show-find-replace": w.value,
3382
+ "onUpdate:showFindReplace": n[2] ||= (e) => w.value = e,
3383
+ "show-insert-image": T.value,
3384
+ "onUpdate:showInsertImage": n[3] ||= (e) => T.value = e,
3385
+ "show-hyperlink": re.value,
3386
+ "onUpdate:showHyperlink": n[4] ||= (e) => re.value = e,
3387
+ "show-insert-symbol": oe.value,
3388
+ "onUpdate:showInsertSymbol": n[5] ||= (e) => oe.value = e,
3389
+ "show-image-properties": j.value,
3390
+ "onUpdate:showImageProperties": n[6] ||= (e) => j.value = e,
3391
+ "show-page-setup": se.value,
3392
+ "onUpdate:showPageSetup": n[7] ||= (e) => se.value = e,
3393
+ "show-keyboard-shortcuts": V.value,
3394
+ "onUpdate:showKeyboardShortcuts": n[8] ||= (e) => V.value = e,
3395
+ view: B(X),
3396
+ bookmarks: Ze.value,
3397
+ "selected-image-pm-pos": B(sn)?.pmPos ?? null,
3398
+ "section-properties": Ue.value,
3399
+ "scroll-visible-position-into-view": B(On),
3400
+ onInsertImage: B(un),
3401
+ onInsertSymbol: B(kt),
3402
+ onHyperlinkSubmit: B(_t),
3403
+ onHyperlinkRemove: B(yt),
3404
+ onPageSetupApply: B(Pt)
3245
3405
  }, null, 8, [
3246
3406
  "show-find-replace",
3247
3407
  "show-insert-image",
@@ -3254,36 +3414,37 @@ var Rn = { class: "docx-editor-vue__toolbar-shell" }, zn = {
3254
3414
  "bookmarks",
3255
3415
  "selected-image-pm-pos",
3256
3416
  "section-properties",
3417
+ "scroll-visible-position-into-view",
3257
3418
  "onInsertImage",
3258
3419
  "onInsertSymbol",
3259
3420
  "onHyperlinkSubmit",
3260
3421
  "onHyperlinkRemove",
3261
3422
  "onPageSetupApply"
3262
3423
  ]),
3263
- z(Oe) ? (F(), D("div", zn, R(z(Oe)), 1)) : E("", !0),
3264
- !z(De) && !z(Oe) ? (F(), D("div", Bn, "Loading...")) : E("", !0),
3265
- O("div", {
3424
+ B(Oe) ? (I(), O("div", Wn, z(B(Oe)), 1)) : D("", !0),
3425
+ !B(De) && !B(Oe) ? (I(), O("div", Gn, "Loading...")) : D("", !0),
3426
+ k("div", {
3266
3427
  ref_key: "hiddenPmRef",
3267
3428
  ref: u,
3268
3429
  class: "docx-editor-vue__hidden-pm paged-editor__hidden-pm"
3269
3430
  }, null, 512),
3270
- O("div", {
3431
+ k("div", {
3271
3432
  class: "docx-editor-vue__editor-scroll",
3272
- onMousedown: n[31] ||= (...e) => z(zt) && z(zt)(...e)
3273
- }, [e.showRuler && Z.value ? (F(), D("div", {
3433
+ onMousedown: n[31] ||= (...e) => B(Kt) && B(Kt)(...e)
3434
+ }, [e.showRuler && Ue.value ? (I(), O("div", {
3274
3435
  key: 0,
3275
3436
  class: "docx-editor-vue__ruler-row",
3276
- style: M(ze.value)
3277
- }, [k(_, {
3278
- "section-props": Z.value,
3279
- zoom: z(q),
3437
+ style: N(Je.value)
3438
+ }, [A(_, {
3439
+ "section-props": Ue.value,
3440
+ zoom: B(Y),
3280
3441
  editable: !s.value,
3281
- onLeftMarginChange: z(Et),
3282
- onRightMarginChange: z(Dt),
3283
- onIndentLeftChange: z(Mt),
3284
- onIndentRightChange: z(Nt),
3285
- onFirstLineIndentChange: z(Pt),
3286
- onTabStopRemove: z(Ft)
3442
+ onLeftMarginChange: B(Ft),
3443
+ onRightMarginChange: B(It),
3444
+ onIndentLeftChange: B(zt),
3445
+ onIndentRightChange: B(Bt),
3446
+ onFirstLineIndentChange: B(Vt),
3447
+ onTabStopRemove: B(Ht)
3287
3448
  }, null, 8, [
3288
3449
  "section-props",
3289
3450
  "zoom",
@@ -3294,129 +3455,140 @@ var Rn = { class: "docx-editor-vue__toolbar-shell" }, zn = {
3294
3455
  "onIndentRightChange",
3295
3456
  "onFirstLineIndentChange",
3296
3457
  "onTabStopRemove"
3297
- ])], 4)) : E("", !0), O("div", Vn, [
3298
- O("div", {
3458
+ ])], 4)) : D("", !0), k("div", Kn, [
3459
+ k("div", {
3299
3460
  ref_key: "pagesViewportRef",
3300
3461
  ref: g,
3301
3462
  class: "docx-editor-vue__pages-viewport",
3302
- onMousedown: n[22] ||= (...e) => z(vn) && z(vn)(...e),
3303
- onMousemove: n[23] ||= (...e) => z(yn) && z(yn)(...e),
3304
- onClick: n[24] ||= (...e) => z(bn) && z(bn)(...e),
3305
- onDblclick: n[25] ||= (...e) => z(xn) && z(xn)(...e),
3306
- onContextmenu: n[26] ||= G((...e) => z(Mn) && z(Mn)(...e), ["prevent"]),
3307
- onWheel: n[27] ||= (...e) => z(Ce) && z(Ce)(...e)
3463
+ onMousedown: n[22] ||= (...e) => B(kn) && B(kn)(...e),
3464
+ onMousemove: n[23] ||= (...e) => B(An) && B(An)(...e),
3465
+ onClick: n[24] ||= (...e) => B(jn) && B(jn)(...e),
3466
+ onDblclick: n[25] ||= (...e) => B(Mn) && B(Mn)(...e),
3467
+ onContextmenu: n[26] ||= K((...e) => B(er) && B(er)(...e), ["prevent"]),
3468
+ onWheel: n[27] ||= (...e) => B(Ce) && B(Ce)(...e)
3308
3469
  }, [
3309
- e.showRuler && Z.value ? (F(), D("div", Hn, [k(p, {
3310
- "section-props": Z.value,
3311
- zoom: z(q),
3470
+ e.showRuler && Ue.value ? (I(), O("div", qn, [A(p, {
3471
+ "section-props": Ue.value,
3472
+ zoom: B(Y),
3312
3473
  editable: !s.value,
3313
- onTopMarginChange: z(Ot),
3314
- onBottomMarginChange: z(jt)
3474
+ onTopMarginChange: B(Lt),
3475
+ onBottomMarginChange: B(Rt)
3315
3476
  }, null, 8, [
3316
3477
  "section-props",
3317
3478
  "zoom",
3318
3479
  "editable",
3319
3480
  "onTopMarginChange",
3320
3481
  "onBottomMarginChange"
3321
- ])])) : E("", !0),
3322
- O("div", {
3482
+ ])])) : D("", !0),
3483
+ k("div", {
3323
3484
  ref_key: "pagesRef",
3324
3485
  ref: d,
3325
3486
  class: "docx-editor-vue__pages paged-editor__pages",
3326
- style: M(Re.value)
3487
+ style: N(qe.value)
3327
3488
  }, null, 4),
3328
- k(wt, {
3329
- "is-open": z($) !== null,
3330
- position: z($)?.position ?? "header",
3331
- "header-footer": z($)?.headerFooter ?? null,
3332
- styles: z(Y)()?.package?.styles ?? null,
3333
- theme: z(Y)()?.package?.theme ?? null,
3334
- "target-rect": z($)?.targetRect ?? null,
3335
- onSave: z(En),
3489
+ A(Dt, {
3490
+ "is-open": B($) !== null,
3491
+ position: B($)?.position ?? "header",
3492
+ view: Ke.value,
3493
+ "target-rect": B($)?.targetRect ?? null,
3494
+ onSave: B(In),
3336
3495
  onClose: n[9] ||= (e) => $.value = null,
3337
- onRemove: z(Dn)
3496
+ onRemove: B(Xn)
3338
3497
  }, null, 8, [
3339
3498
  "is-open",
3340
3499
  "position",
3341
- "header-footer",
3342
- "styles",
3343
- "theme",
3500
+ "view",
3344
3501
  "target-rect",
3345
3502
  "onSave",
3346
3503
  "onRemove"
3347
3504
  ]),
3348
- k(mt, {
3349
- "image-info": z(Q),
3350
- zoom: z(q),
3351
- view: z(J),
3352
- onOpenProperties: n[10] ||= (e) => A.value = !0,
3353
- onDeselect: n[11] ||= (e) => Q.value = null,
3354
- onInteractStart: n[12] ||= (e) => Xt.value = !0,
3355
- onInteractEnd: n[13] ||= (e) => Xt.value = !1,
3356
- onContextMenu: z(Gn)
3505
+ B($) && Ge.value ? (I(), O("div", {
3506
+ key: 1,
3507
+ "aria-hidden": "true",
3508
+ style: N({
3509
+ position: "fixed",
3510
+ top: `${Ge.value.top}px`,
3511
+ left: `${Ge.value.left}px`,
3512
+ width: "2px",
3513
+ height: `${Ge.value.height}px`,
3514
+ background: "#4285f4",
3515
+ pointerEvents: "none",
3516
+ zIndex: 9999,
3517
+ animation: "hf-caret-blink 1.06s steps(1) infinite"
3518
+ })
3519
+ }, null, 4)) : D("", !0),
3520
+ A(vt, {
3521
+ "image-info": B(sn),
3522
+ zoom: B(Y),
3523
+ view: B(X),
3524
+ onOpenProperties: n[10] ||= (e) => j.value = !0,
3525
+ onDeselect: n[11] ||= (e) => sn.value = null,
3526
+ onInteractStart: n[12] ||= (e) => cn.value = !0,
3527
+ onInteractEnd: n[13] ||= (e) => cn.value = !1,
3528
+ onContextMenu: B(tr)
3357
3529
  }, null, 8, [
3358
3530
  "image-info",
3359
3531
  "zoom",
3360
3532
  "view",
3361
3533
  "onContextMenu"
3362
3534
  ]),
3363
- k(st, {
3364
- "get-view": Xn,
3365
- "get-pages-container": Zn,
3366
- zoom: z(q),
3367
- "transaction-version": v.value,
3368
- "sync-coordinator": z(te)
3535
+ A(dt, {
3536
+ "get-view": or,
3537
+ "get-pages-container": sr,
3538
+ zoom: B(Y),
3539
+ "transaction-version": y.value,
3540
+ "sync-coordinator": B(ee)
3369
3541
  }, null, 8, [
3370
3542
  "zoom",
3371
3543
  "transaction-version",
3372
3544
  "sync-coordinator"
3373
3545
  ]),
3374
- z(Ue) && !W.value && !s.value ? (F(), D("button", {
3375
- key: 1,
3546
+ B(Qe) && !G.value && !s.value ? (I(), O("button", {
3547
+ key: 2,
3376
3548
  type: "button",
3377
3549
  class: "docx-editor-vue__floating-comment",
3378
- style: M({
3379
- top: z(Ue).top + "px",
3380
- left: z(Ue).left + "px"
3550
+ style: N({
3551
+ top: B(Qe).top + "px",
3552
+ left: B(Qe).left + "px"
3381
3553
  }),
3382
- title: z(l)("comments.addComment"),
3383
- onMousedown: n[14] ||= G((...e) => z(Xe) && z(Xe)(...e), ["prevent", "stop"])
3384
- }, [k(c, {
3554
+ title: B(l)("comments.addComment"),
3555
+ onMousedown: n[14] ||= K((...e) => B(at) && B(at)(...e), ["prevent", "stop"])
3556
+ }, [A(c, {
3385
3557
  name: "add_comment",
3386
3558
  size: 16
3387
- })], 44, Un)) : E("", !0),
3388
- z(an) && !s.value ? (F(), D("button", {
3389
- key: 2,
3559
+ })], 44, Jn)) : D("", !0),
3560
+ B(Q) && !s.value ? (I(), O("button", {
3561
+ key: 3,
3390
3562
  type: "button",
3391
3563
  class: "docx-editor-vue__table-insert-btn",
3392
- style: M({
3393
- left: z(an).x + "px",
3394
- top: z(an).y + "px"
3564
+ style: N({
3565
+ left: B(Q).x + "px",
3566
+ top: B(Q).y + "px"
3395
3567
  }),
3396
- title: z(an).type === "row" ? "Insert row below" : "Insert column to the right",
3397
- "aria-label": z(an).type === "row" ? "Insert row below" : "Insert column to the right",
3398
- onMousedown: n[15] ||= (...e) => z(Sn) && z(Sn)(...e),
3399
- onMouseenter: n[16] ||= (...e) => z(Tn) && z(Tn)(...e),
3400
- onMouseleave: n[17] ||= (e) => an.value = null
3401
- }, [...n[36] ||= [O("svg", {
3568
+ title: B(Q).type === "row" ? "Insert row below" : "Insert column to the right",
3569
+ "aria-label": B(Q).type === "row" ? "Insert row below" : "Insert column to the right",
3570
+ onMousedown: n[15] ||= (...e) => B(Nn) && B(Nn)(...e),
3571
+ onMouseenter: n[16] ||= (...e) => B(Pn) && B(Pn)(...e),
3572
+ onMouseleave: n[17] ||= (e) => Q.value = null
3573
+ }, [...n[36] ||= [k("svg", {
3402
3574
  width: "12",
3403
3575
  height: "12",
3404
3576
  viewBox: "0 0 12 12",
3405
3577
  fill: "none"
3406
- }, [O("path", {
3578
+ }, [k("path", {
3407
3579
  d: "M6 1v10M1 6h10",
3408
3580
  stroke: "currentColor",
3409
3581
  "stroke-width": "1.5",
3410
3582
  "stroke-linecap": "round"
3411
- })], -1)]], 44, Wn)) : E("", !0),
3412
- k(ee, {
3413
- comments: K.value,
3583
+ })], -1)]], 44, Yn)) : D("", !0),
3584
+ A(v, {
3585
+ comments: pe.value,
3414
3586
  "pages-container": d.value,
3415
- zoom: z(q),
3416
- "page-width-px": Be.value,
3417
- "sidebar-open": U.value,
3418
- "resolved-comment-ids": Ve.value,
3419
- onMarkerClick: z(Qe)
3587
+ zoom: B(Y),
3588
+ "page-width-px": Ye.value,
3589
+ "sidebar-open": W.value,
3590
+ "resolved-comment-ids": Xe.value,
3591
+ onMarkerClick: B(ot)
3420
3592
  }, null, 8, [
3421
3593
  "comments",
3422
3594
  "pages-container",
@@ -3426,28 +3598,30 @@ var Rn = { class: "docx-editor-vue__toolbar-shell" }, zn = {
3426
3598
  "resolved-comment-ids",
3427
3599
  "onMarkerClick"
3428
3600
  ]),
3429
- k(m, {
3430
- "is-open": U.value,
3431
- comments: K.value,
3601
+ A(m, {
3602
+ "is-open": W.value,
3603
+ comments: pe.value,
3432
3604
  "tracked-changes": he.value,
3433
- "is-adding-comment": W.value,
3434
- "add-comment-y-position": z(Ge),
3605
+ "is-adding-comment": G.value,
3606
+ "add-comment-y-position": B(et),
3435
3607
  "show-resolved": !0,
3436
3608
  "pages-container": d.value,
3437
- "page-width-px": Be.value,
3438
- zoom: z(q),
3439
- "active-item-id": pe.value,
3440
- onClose: n[18] ||= (e) => U.value = !1,
3441
- onAddComment: z(Je),
3442
- onCancelAddComment: z(Ye),
3443
- onCommentReply: z(Wt),
3444
- onCommentResolve: z(Ht),
3445
- onCommentUnresolve: z(Gt),
3446
- onCommentDelete: z(Kt),
3447
- onAcceptChange: z(qt),
3448
- onRejectChange: z(Jt),
3449
- onTrackedChangeReply: z(Yt),
3450
- "onUpdate:activeItemId": n[19] ||= (e) => pe.value = e
3609
+ "page-width-px": Ye.value,
3610
+ zoom: B(Y),
3611
+ "active-item-id": q.value,
3612
+ onClose: n[18] ||= (e) => W.value = !1,
3613
+ onAddComment: B(rt),
3614
+ onCancelAddComment: B(it),
3615
+ onCommentReply: B(Zt),
3616
+ onCommentResolve: B(Yt),
3617
+ onCommentUnresolve: B(Qt),
3618
+ onCommentDelete: B($t),
3619
+ onAcceptChange: B(en),
3620
+ onRejectChange: B(tn),
3621
+ onAcceptChangeById: B(nn),
3622
+ onRejectChangeById: B(an),
3623
+ onTrackedChangeReply: B(on),
3624
+ "onUpdate:activeItemId": n[19] ||= (e) => q.value = e
3451
3625
  }, null, 8, [
3452
3626
  "is-open",
3453
3627
  "comments",
@@ -3466,16 +3640,18 @@ var Rn = { class: "docx-editor-vue__toolbar-shell" }, zn = {
3466
3640
  "onCommentDelete",
3467
3641
  "onAcceptChange",
3468
3642
  "onRejectChange",
3643
+ "onAcceptChangeById",
3644
+ "onRejectChangeById",
3469
3645
  "onTrackedChangeReply"
3470
3646
  ]),
3471
- k(ln, {
3472
- data: z(lt),
3647
+ A(mn, {
3648
+ data: B(gt),
3473
3649
  "read-only": s.value,
3474
- onNavigate: z(ft),
3475
- onCopy: n[20] ||= (e) => lt.value = null,
3476
- onEdit: z(pt),
3477
- onRemove: z(ht),
3478
- onClose: n[21] ||= (e) => lt.value = null
3650
+ onNavigate: B(bt),
3651
+ onCopy: n[20] ||= (e) => gt.value = null,
3652
+ onEdit: B(xt),
3653
+ onRemove: B(St),
3654
+ onClose: n[21] ||= (e) => gt.value = null
3479
3655
  }, null, 8, [
3480
3656
  "data",
3481
3657
  "read-only",
@@ -3484,57 +3660,57 @@ var Rn = { class: "docx-editor-vue__toolbar-shell" }, zn = {
3484
3660
  "onRemove"
3485
3661
  ])
3486
3662
  ], 544),
3487
- !L.value && e.showOutlineButton ? (F(), D("button", {
3663
+ !R.value && e.showOutlineButton ? (I(), O("button", {
3488
3664
  key: 0,
3489
3665
  type: "button",
3490
3666
  class: "docx-editor-vue__outline-toggle",
3491
3667
  title: "Show document outline",
3492
- onClick: n[28] ||= (...e) => z(It) && z(It)(...e),
3493
- onMousedown: n[29] ||= G(() => {}, ["stop"])
3494
- }, [k(c, {
3668
+ onClick: n[28] ||= (...e) => B(Ut) && B(Ut)(...e),
3669
+ onMousedown: n[29] ||= K(() => {}, ["stop"])
3670
+ }, [A(c, {
3495
3671
  name: "format_list_bulleted",
3496
3672
  size: 20
3497
- })], 32)) : E("", !0),
3498
- z(on).totalPages > 1 ? (F(), T(bt, {
3673
+ })], 32)) : D("", !0),
3674
+ B(Cn).totalPages > 1 ? (I(), ie(wt, {
3499
3675
  key: 1,
3500
- "current-page": z(on).currentPage,
3501
- "total-pages": z(on).totalPages,
3502
- visible: z(on).visible
3676
+ "current-page": B(Cn).currentPage,
3677
+ "total-pages": B(Cn).totalPages,
3678
+ visible: B(Cn).visible
3503
3679
  }, null, 8, [
3504
3680
  "current-page",
3505
3681
  "total-pages",
3506
3682
  "visible"
3507
- ])) : E("", !0),
3508
- k(yt, {
3509
- "is-open": L.value,
3510
- headings: ge.value,
3511
- onClose: n[30] ||= (e) => L.value = !1,
3512
- onNavigate: z(Lt)
3683
+ ])) : D("", !0),
3684
+ A(Ct, {
3685
+ "is-open": R.value,
3686
+ headings: J.value,
3687
+ onClose: n[30] ||= (e) => R.value = !1,
3688
+ onNavigate: B(Wt)
3513
3689
  }, null, 8, [
3514
3690
  "is-open",
3515
3691
  "headings",
3516
3692
  "onNavigate"
3517
3693
  ])
3518
3694
  ])], 32),
3519
- O("input", {
3695
+ k("input", {
3520
3696
  ref_key: "docxInputRef",
3521
- ref: $e,
3697
+ ref: st,
3522
3698
  type: "file",
3523
3699
  accept: ".docx,application/vnd.openxmlformats-officedocument.wordprocessingml.document",
3524
3700
  style: { display: "none" },
3525
- onChange: n[32] ||= (...e) => z(et) && z(et)(...e)
3701
+ onChange: n[32] ||= (...e) => B(ct) && B(ct)(...e)
3526
3702
  }, null, 544),
3527
- k($t, {
3703
+ A(rn, {
3528
3704
  "read-only": s.value,
3529
- "context-menu": z(On),
3530
- "image-context-menu": z(kn),
3531
- "image-context-menu-text-actions": z(An),
3532
- "can-open-image-properties": !!z(Q),
3533
- onContextMenuAction: z(qn),
3534
- onCloseContextMenu: n[33] ||= (e) => z(On).isOpen = !1,
3535
- onImageWrapSelect: z(Kn),
3536
- onCloseImageContextMenu: n[34] ||= (e) => kn.value = null,
3537
- onOpenImageProperties: n[35] ||= (e) => A.value = !0
3705
+ "context-menu": B(Zn),
3706
+ "image-context-menu": B(Qn),
3707
+ "image-context-menu-text-actions": B($n),
3708
+ "can-open-image-properties": !!B(sn),
3709
+ onContextMenuAction: B(rr),
3710
+ onCloseContextMenu: n[33] ||= (e) => B(Zn).isOpen = !1,
3711
+ onImageWrapSelect: B(nr),
3712
+ onCloseImageContextMenu: n[34] ||= (e) => Qn.value = null,
3713
+ onOpenImageProperties: n[35] ||= (e) => j.value = !0
3538
3714
  }, null, 8, [
3539
3715
  "read-only",
3540
3716
  "context-menu",
@@ -3549,8 +3725,8 @@ var Rn = { class: "docx-editor-vue__toolbar-shell" }, zn = {
3549
3725
  });
3550
3726
  //#endregion
3551
3727
  //#region src/renderAsync.ts
3552
- async function Kn(e, t, n = {}) {
3553
- let r = e instanceof ArrayBuffer ? e : await _e(e), i = null, a = null, o = !1, s = {
3728
+ async function Zn(e, t, n = {}) {
3729
+ let r = e instanceof ArrayBuffer ? e : await Se(e), i = null, a = null, o = !1, s = {
3554
3730
  save: async () => {
3555
3731
  let e = await (i?.save() ?? Promise.resolve(null));
3556
3732
  return e ? new Blob([e], { type: "application/vnd.openxmlformats-officedocument.wordprocessingml.document" }) : null;
@@ -3571,8 +3747,8 @@ async function Kn(e, t, n = {}) {
3571
3747
  }
3572
3748
  };
3573
3749
  return new Promise((e, c) => {
3574
- a = ae({ setup() {
3575
- return () => ce(Gn, {
3750
+ a = re({ setup() {
3751
+ return () => se(Xn, {
3576
3752
  ...n,
3577
3753
  documentBuffer: r,
3578
3754
  showToolbar: n.showToolbar ?? !0,
@@ -3596,6 +3772,6 @@ async function Kn(e, t, n = {}) {
3596
3772
  }
3597
3773
  //#endregion
3598
3774
  //#region src/index.ts
3599
- var qn = "0.0.2";
3775
+ var Qn = "0.0.2";
3600
3776
  //#endregion
3601
- export { Gn as DocxEditor, qn as VERSION, Qe as createDocumentWithText, $e as createEmptyDocument, r as defaultLocale, a as i18nPlugin, f as provideLocale, Kn as renderAsync, n as useTranslation };
3777
+ export { Xn as DocxEditor, Qn as VERSION, nt as createDocumentWithText, rt as createEmptyDocument, r as defaultLocale, a as i18nPlugin, f as provideLocale, Zn as renderAsync, n as useTranslation };