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