@eigenpal/docx-editor-vue 1.2.0 → 1.3.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.
@@ -0,0 +1,3330 @@
1
+ import { d as e, p as t } from "./KeyboardShortcutsDialog-00eb4Ova.js";
2
+ import { t as n } from "./_plugin-vue_export-helper-B52Kst-M.js";
3
+ import { t as r } from "./useCommentSidebarItems-BHomCzpj.js";
4
+ import { Fragment as i, computed as a, createBlock as o, createCommentVNode as s, createElementBlock as c, createElementVNode as l, createTextVNode as u, createVNode as d, defineComponent as f, nextTick as p, normalizeClass as m, normalizeStyle as h, onBeforeUnmount as g, onMounted as _, openBlock as v, reactive as y, ref as b, renderList as x, renderSlot as S, resolveDynamicComponent as C, toDisplayString as w, unref as T, vModelSelect as E, vModelText as D, watch as O, withCtx as k, withDirectives as A, withKeys as j, withModifiers as M } from "vue";
5
+ import { generateThemeTintShadeMatrix as N, resolveColor as P, resolveColorToHex as F, resolveHighlightColor as I } from "@eigenpal/docx-editor-core/utils";
6
+ import { redoDepth as L, undoDepth as R } from "prosemirror-history";
7
+ import { extractSelectionContext as z } from "@eigenpal/docx-editor-core/prosemirror/plugins/selectionTracker";
8
+ import { clearFormatting as B } from "@eigenpal/docx-editor-core/prosemirror/commands/formatting";
9
+ import { normalizeFontFamilies as V } from "@eigenpal/docx-editor-core/utils/fontOptions";
10
+ import { getTableContext as H } from "@eigenpal/docx-editor-core/prosemirror/extensions/nodes/TableExtension";
11
+ import { formatDate as U, getAvatarColor as W, getCommentText as G, getInitials as K, truncateText as q } from "@eigenpal/docx-editor-core/utils/comments";
12
+ import { resolveItemPositions as J } from "@eigenpal/docx-editor-core/plugin-api/resolveItemPositions";
13
+ import { SIDEBAR_DOCUMENT_SHIFT as ee } from "@eigenpal/docx-editor-core/utils/sidebarConstants";
14
+ import { pixelsToTwips as te, twipsToPixels as Y } from "@eigenpal/docx-editor-core/utils/units";
15
+ //#region src/components/ui/ColorPicker.vue?vue&type=script&setup=true&lang.ts
16
+ var X = [
17
+ "disabled",
18
+ "title",
19
+ "aria-label"
20
+ ], ne = [
21
+ "disabled",
22
+ "title",
23
+ "aria-label",
24
+ "aria-expanded"
25
+ ], Z = [
26
+ "disabled",
27
+ "title",
28
+ "aria-label",
29
+ "aria-expanded"
30
+ ], re = { class: "docx-color-picker__button-stack" }, ie = ["aria-label"], ae = {
31
+ key: 0,
32
+ class: "docx-color-picker__auto-icon docx-color-picker__auto-icon--none"
33
+ }, oe = {
34
+ key: 1,
35
+ class: "docx-color-picker__auto-icon docx-color-picker__auto-icon--auto"
36
+ }, se = { class: "docx-color-picker__section-label" }, ce = { class: "docx-color-picker__grid" }, le = [
37
+ "title",
38
+ "aria-label",
39
+ "aria-selected",
40
+ "onClick"
41
+ ], ue = { class: "docx-color-picker__section-label" }, de = { class: "docx-color-picker__grid" }, fe = [
42
+ "title",
43
+ "aria-label",
44
+ "aria-selected",
45
+ "onClick"
46
+ ], pe = { class: "docx-color-picker__section-label" }, me = { class: "docx-color-picker__custom" }, he = ["onKeydown"], ge = ["disabled"], _e = /* @__PURE__ */ n(/* @__PURE__ */ f({
47
+ __name: "ColorPicker",
48
+ props: {
49
+ mode: {},
50
+ value: {},
51
+ theme: {},
52
+ disabled: {
53
+ type: Boolean,
54
+ default: !1
55
+ },
56
+ className: {},
57
+ style: {},
58
+ title: {},
59
+ icon: {},
60
+ autoLabel: {},
61
+ splitButton: {
62
+ type: Boolean,
63
+ default: !0
64
+ },
65
+ defaultColor: {}
66
+ },
67
+ emits: ["change"],
68
+ setup(n, { emit: r }) {
69
+ let o = n, f = r, { t: p } = e(), y = [
70
+ {
71
+ nameKey: "colorPicker.colors.darkRed",
72
+ hex: "C00000"
73
+ },
74
+ {
75
+ nameKey: "colorPicker.colors.red",
76
+ hex: "FF0000"
77
+ },
78
+ {
79
+ nameKey: "colorPicker.colors.orange",
80
+ hex: "FFC000"
81
+ },
82
+ {
83
+ nameKey: "colorPicker.colors.yellow",
84
+ hex: "FFFF00"
85
+ },
86
+ {
87
+ nameKey: "colorPicker.colors.lightGreen",
88
+ hex: "92D050"
89
+ },
90
+ {
91
+ nameKey: "colorPicker.colors.green",
92
+ hex: "00B050"
93
+ },
94
+ {
95
+ nameKey: "colorPicker.colors.lightBlue",
96
+ hex: "00B0F0"
97
+ },
98
+ {
99
+ nameKey: "colorPicker.colors.blue",
100
+ hex: "0070C0"
101
+ },
102
+ {
103
+ nameKey: "colorPicker.colors.darkBlue",
104
+ hex: "002060"
105
+ },
106
+ {
107
+ nameKey: "colorPicker.colors.purple",
108
+ hex: "7030A0"
109
+ }
110
+ ];
111
+ function S(e) {
112
+ return e ? typeof e == "string" ? o.mode === "highlight" ? I(e) || (e === "none" ? "transparent" : e.startsWith("#") ? e : `#${e}`) : e.startsWith("#") ? e : `#${e}` : P(e, o.theme) : o.mode === "text" || o.mode === "border" ? "#000000" : "transparent";
113
+ }
114
+ function C(e) {
115
+ return /^[0-9A-Fa-f]{6}$/.test(e.replace(/^#/, ""));
116
+ }
117
+ function E(e) {
118
+ let t = e.replace(/^#/, "");
119
+ if (t.length !== 6) return !1;
120
+ let n = parseInt(t.slice(0, 2), 16), r = parseInt(t.slice(2, 4), 16), i = parseInt(t.slice(4, 6), 16);
121
+ return (n * 299 + r * 587 + i * 114) / 1e3 > 230;
122
+ }
123
+ function k(e, t) {
124
+ return e ? (typeof e == "string" ? e.replace(/^#/, "").toUpperCase() : F(e, o.theme)) === t.toUpperCase() : !1;
125
+ }
126
+ let L = b(!1), R = b(""), z = b(null), B = b(null), V = b(o.defaultColor ?? (o.mode === "highlight" ? "FFFF00" : o.mode === "border" ? { rgb: "000000" } : { rgb: "FF0000" })), H = a(() => N(o.theme?.colorScheme ?? null)), U = a(() => H.value.flatMap((e, t) => e.map((e, n) => ({
127
+ ...e,
128
+ key: `${t}-${n}`
129
+ })))), W = a(() => S(o.value)), G = a(() => S(V.value)), K = a(() => o.mode === "text" ? p("formattingBar.fontColor") : o.mode === "highlight" ? p("formattingBar.highlightColor") : p("table.borderColor")), q = a(() => o.icon ?? (o.mode === "text" ? "format_color_text" : o.mode === "highlight" ? "ink_highlighter" : "border_color"));
130
+ O(() => [
131
+ o.value,
132
+ o.mode,
133
+ o.theme
134
+ ], () => {
135
+ let e = S(o.value).replace(/^#/, "");
136
+ /^[0-9A-Fa-f]{6}$/.test(e) && (R.value = e.toUpperCase());
137
+ }, { immediate: !0 });
138
+ let J = b({});
139
+ function ee() {
140
+ let e = z.value;
141
+ if (!e) return;
142
+ let t = e.getBoundingClientRect();
143
+ J.value = {
144
+ top: `${t.bottom + 4}px`,
145
+ left: `${t.left}px`
146
+ };
147
+ }
148
+ function te() {
149
+ o.disabled || (L.value || ee(), L.value = !L.value);
150
+ }
151
+ function Y(e, t = !0) {
152
+ t && (V.value = e), f("change", e), L.value = !1;
153
+ }
154
+ function _e() {
155
+ o.disabled || f("change", V.value);
156
+ }
157
+ function ve(e) {
158
+ if (o.mode === "highlight") {
159
+ Y(e.hex);
160
+ return;
161
+ }
162
+ let t = {
163
+ themeColor: e.themeSlot,
164
+ rgb: e.hex
165
+ };
166
+ e.tint && (t.themeTint = e.tint), e.shade && (t.themeShade = e.shade), Y(t);
167
+ }
168
+ function Q(e) {
169
+ Y(o.mode === "highlight" ? e : { rgb: e });
170
+ }
171
+ function ye() {
172
+ Y(o.mode === "highlight" ? "none" : { auto: !0 }, !1);
173
+ }
174
+ function be() {
175
+ let e = R.value.replace(/^#/, "").toUpperCase();
176
+ C(e) && (Y(o.mode === "highlight" ? e : { rgb: e }), R.value = "");
177
+ }
178
+ function xe(e) {
179
+ e.target.tagName !== "INPUT" && e.preventDefault();
180
+ }
181
+ function Se(e) {
182
+ if (!L.value) return;
183
+ let t = e.target;
184
+ z.value?.contains(t) || B.value?.contains(t) || (L.value = !1);
185
+ }
186
+ return _(() => document.addEventListener("mousedown", Se)), g(() => document.removeEventListener("mousedown", Se)), (e, r) => (v(), c("div", {
187
+ ref_key: "containerRef",
188
+ ref: z,
189
+ class: m(["docx-color-picker", n.className]),
190
+ style: h(n.style)
191
+ }, [n.splitButton ? (v(), c("div", {
192
+ key: 0,
193
+ class: m(["docx-color-picker__split", { "is-disabled": n.disabled }])
194
+ }, [l("button", {
195
+ type: "button",
196
+ class: "docx-color-picker__apply",
197
+ disabled: n.disabled,
198
+ title: n.title ?? K.value,
199
+ "aria-label": n.title ?? K.value,
200
+ onMousedown: r[0] ||= M(() => {}, ["prevent"]),
201
+ onClick: _e
202
+ }, [d(t, {
203
+ name: q.value,
204
+ size: 18
205
+ }, null, 8, ["name"]), l("span", {
206
+ class: m(["docx-color-picker__bar", { "is-light": G.value === "transparent" || E(G.value) }]),
207
+ style: h({ background: G.value === "transparent" ? "#fff" : G.value })
208
+ }, null, 6)], 40, X), l("button", {
209
+ type: "button",
210
+ class: m(["docx-color-picker__arrow", { "is-open": L.value }]),
211
+ disabled: n.disabled,
212
+ title: n.title ?? K.value,
213
+ "aria-label": n.title ?? K.value,
214
+ "aria-haspopup": "true",
215
+ "aria-expanded": L.value,
216
+ onMousedown: r[1] ||= M(() => {}, ["prevent"]),
217
+ onClick: te
218
+ }, [d(t, {
219
+ name: "arrow_drop_down",
220
+ size: 18
221
+ })], 42, ne)], 2)) : (v(), c("button", {
222
+ key: 1,
223
+ type: "button",
224
+ class: m(["docx-color-picker__button", { "is-open": L.value }]),
225
+ disabled: n.disabled,
226
+ title: n.title ?? K.value,
227
+ "aria-label": n.title ?? K.value,
228
+ "aria-haspopup": "true",
229
+ "aria-expanded": L.value,
230
+ onMousedown: r[2] ||= M(() => {}, ["prevent"]),
231
+ onClick: te
232
+ }, [l("span", re, [d(t, {
233
+ name: q.value,
234
+ size: 18
235
+ }, null, 8, ["name"]), l("span", {
236
+ class: m(["docx-color-picker__bar", { "is-light": W.value === "transparent" || E(W.value) }]),
237
+ style: h({ background: W.value === "transparent" ? "#fff" : W.value })
238
+ }, null, 6)]), d(t, {
239
+ name: "arrow_drop_down",
240
+ size: 14
241
+ })], 42, Z)), L.value && !n.disabled ? (v(), c("div", {
242
+ key: 2,
243
+ ref_key: "panelRef",
244
+ ref: B,
245
+ class: "docx-color-picker__panel",
246
+ style: h(J.value),
247
+ role: "dialog",
248
+ "aria-label": T(p)("colorPicker.ariaLabel", { type: K.value }),
249
+ onMousedown: xe
250
+ }, [
251
+ l("button", {
252
+ type: "button",
253
+ class: "docx-color-picker__auto",
254
+ onMousedown: r[3] ||= M(() => {}, ["prevent"]),
255
+ onClick: ye
256
+ }, [n.mode === "highlight" ? (v(), c("span", ae, [...r[10] ||= [l("span", { class: "docx-color-picker__auto-slash" }, null, -1)]])) : (v(), c("span", oe)), u(" " + w(n.autoLabel ?? (n.mode === "highlight" ? T(p)("colorPicker.noColor") : T(p)("colorPicker.automatic"))), 1)], 32),
257
+ r[12] ||= l("div", { class: "docx-color-picker__divider" }, null, -1),
258
+ l("div", se, w(T(p)("colorPicker.themeColors")), 1),
259
+ l("div", ce, [(v(!0), c(i, null, x(U.value, (e) => (v(), c("button", {
260
+ key: e.key,
261
+ type: "button",
262
+ class: m(["docx-color-picker__cell", { "is-selected": k(n.value, e.hex) }]),
263
+ style: h({ background: "#" + e.hex }),
264
+ title: e.label,
265
+ "aria-label": e.label,
266
+ "aria-selected": k(n.value, e.hex),
267
+ onMousedown: r[4] ||= M(() => {}, ["prevent"]),
268
+ onClick: (t) => ve(e)
269
+ }, null, 46, le))), 128))]),
270
+ r[13] ||= l("div", { class: "docx-color-picker__divider" }, null, -1),
271
+ l("div", ue, w(T(p)("colorPicker.standardColors")), 1),
272
+ l("div", de, [(v(), c(i, null, x(y, (e) => l("button", {
273
+ key: e.hex,
274
+ type: "button",
275
+ class: m(["docx-color-picker__cell", { "is-selected": k(n.value, e.hex) }]),
276
+ style: h({ background: "#" + e.hex }),
277
+ title: T(p)(e.nameKey),
278
+ "aria-label": T(p)(e.nameKey),
279
+ "aria-selected": k(n.value, e.hex),
280
+ onMousedown: r[5] ||= M(() => {}, ["prevent"]),
281
+ onClick: (t) => Q(e.hex)
282
+ }, null, 46, fe)), 64))]),
283
+ r[14] ||= l("div", { class: "docx-color-picker__divider" }, null, -1),
284
+ l("div", pe, w(T(p)("colorPicker.customColor")), 1),
285
+ l("div", me, [
286
+ r[11] ||= l("span", { class: "docx-color-picker__hash" }, "#", -1),
287
+ A(l("input", {
288
+ "onUpdate:modelValue": r[6] ||= (e) => R.value = e,
289
+ type: "text",
290
+ class: "docx-color-picker__hex",
291
+ placeholder: "FF0000",
292
+ maxlength: "6",
293
+ "aria-label": "Custom hex color",
294
+ onInput: r[7] ||= (e) => R.value = R.value.replace(/[^0-9A-Fa-f]/g, "").slice(0, 6),
295
+ onKeydown: j(M(be, ["prevent"]), ["enter"]),
296
+ onMousedown: r[8] ||= M(() => {}, ["stop"])
297
+ }, null, 40, he), [[D, R.value]]),
298
+ l("button", {
299
+ type: "button",
300
+ class: "docx-color-picker__apply-btn",
301
+ disabled: !C(R.value),
302
+ onMousedown: r[9] ||= M(() => {}, ["prevent"]),
303
+ onClick: be
304
+ }, w(T(p)("common.apply")), 41, ge)
305
+ ])
306
+ ], 44, ie)) : s("", !0)], 6));
307
+ }
308
+ }), [["__scopeId", "data-v-2cbf59ab"]]), ve = 4, Q = /* @__PURE__ */ n(/* @__PURE__ */ f({
309
+ __name: "Popover",
310
+ props: {
311
+ open: { type: Boolean },
312
+ placement: { default: "bottom-left" },
313
+ panelClass: {},
314
+ panelStyle: {},
315
+ closeOnScroll: {
316
+ type: Boolean,
317
+ default: !0
318
+ }
319
+ },
320
+ emits: ["close", "update:open"],
321
+ setup(e, { emit: t }) {
322
+ let n = e, r = t, i = b(null), a = b(null), o = b({ position: "fixed" });
323
+ function l() {
324
+ let e = i.value;
325
+ if (!e) return;
326
+ let t = e.getBoundingClientRect(), r = { position: "fixed" };
327
+ n.placement.startsWith("top") ? (r.bottom = `${Math.round(window.innerHeight - t.top + ve)}px`, r.top = "auto") : (r.top = `${Math.round(t.bottom + ve)}px`, r.bottom = "auto"), n.placement.endsWith("right") ? (r.right = `${Math.round(window.innerWidth - t.right)}px`, r.left = "auto") : (r.left = `${Math.round(t.left)}px`, r.right = "auto"), o.value = r;
328
+ }
329
+ function u() {
330
+ r("update:open", !n.open), n.open && r("close");
331
+ }
332
+ function d() {
333
+ r("update:open", !1), r("close");
334
+ }
335
+ function f(e) {
336
+ if (!n.open) return;
337
+ let t = e.target;
338
+ i.value?.contains(t) || a.value?.contains(t) || d();
339
+ }
340
+ function p(e) {
341
+ e.key === "Escape" && n.open && d();
342
+ }
343
+ function y(e) {
344
+ !n.closeOnScroll || !n.open || a.value?.contains(e.target) || d();
345
+ }
346
+ function x() {
347
+ n.open && l();
348
+ }
349
+ function C() {
350
+ document.addEventListener("mousedown", f), document.addEventListener("keydown", p), window.addEventListener("scroll", y, !0), window.addEventListener("resize", x);
351
+ }
352
+ function w() {
353
+ document.removeEventListener("mousedown", f), document.removeEventListener("keydown", p), window.removeEventListener("scroll", y, !0), window.removeEventListener("resize", x);
354
+ }
355
+ return O(() => n.open, (e) => {
356
+ e ? (l(), C()) : w();
357
+ }), O(() => n.placement, () => n.open && l()), _(() => {
358
+ n.open && (l(), C());
359
+ }), g(w), (t, n) => (v(), c("span", {
360
+ ref_key: "rootRef",
361
+ ref: i,
362
+ class: "docx-popover"
363
+ }, [S(t.$slots, "trigger", {
364
+ toggle: u,
365
+ open: e.open
366
+ }, void 0, !0), e.open ? (v(), c("div", {
367
+ key: 0,
368
+ ref_key: "panelRef",
369
+ ref: a,
370
+ class: m(["docx-popover__panel", e.panelClass]),
371
+ style: h([o.value, e.panelStyle ?? {}]),
372
+ onMousedown: n[0] ||= M(() => {}, ["stop"])
373
+ }, [S(t.$slots, "panel", {}, void 0, !0)], 38)) : s("", !0)], 512));
374
+ }
375
+ }), [["__scopeId", "data-v-20a24bb6"]]), ye = ["title", "onClick"], be = {
376
+ key: 0,
377
+ class: "editing-mode__label"
378
+ }, xe = { class: "editing-mode__panel" }, Se = ["onClick"], Ce = { class: "editing-mode__option-text" }, we = { class: "editing-mode__option-label" }, Te = { class: "editing-mode__option-desc" }, Ee = /* @__PURE__ */ n(/* @__PURE__ */ f({
379
+ __name: "EditingModeDropdown",
380
+ props: { modelValue: {} },
381
+ emits: ["update:modelValue"],
382
+ setup(e, { emit: n }) {
383
+ let r = e, u = n, f = [
384
+ {
385
+ value: "editing",
386
+ label: "Editing",
387
+ icon: "edit_note",
388
+ desc: "Edit document directly"
389
+ },
390
+ {
391
+ value: "suggesting",
392
+ label: "Suggesting",
393
+ icon: "rate_review",
394
+ desc: "Edits become suggestions"
395
+ },
396
+ {
397
+ value: "viewing",
398
+ label: "Viewing",
399
+ icon: "visibility",
400
+ desc: "Read or print final document"
401
+ }
402
+ ], p = b(!1), h = b(!1), y = a(() => f.find((e) => e.value === r.modelValue) ?? f[0]);
403
+ function S(e) {
404
+ u("update:modelValue", e), p.value = !1;
405
+ }
406
+ let C = null;
407
+ function T(e) {
408
+ h.value = e.matches;
409
+ }
410
+ return _(() => {
411
+ C = window.matchMedia("(max-width: 1400px)"), h.value = C.matches, C.addEventListener("change", T);
412
+ }), g(() => C?.removeEventListener("change", T)), (n, r) => (v(), o(Q, {
413
+ open: p.value,
414
+ placement: "bottom-right",
415
+ "onUpdate:open": r[0] ||= (e) => p.value = e,
416
+ onClose: r[1] ||= (e) => p.value = !1
417
+ }, {
418
+ trigger: k(({ toggle: e }) => [l("button", {
419
+ type: "button",
420
+ class: m(["editing-mode__trigger", {
421
+ "editing-mode__trigger--open": p.value,
422
+ "editing-mode__trigger--compact": h.value
423
+ }]),
424
+ title: `${y.value.label} (Ctrl+Shift+E)`,
425
+ onClick: M(e, ["prevent"])
426
+ }, [
427
+ d(t, {
428
+ name: y.value.icon,
429
+ size: 18
430
+ }, null, 8, ["name"]),
431
+ h.value ? s("", !0) : (v(), c("span", be, w(y.value.label), 1)),
432
+ d(t, {
433
+ name: "arrow_drop_down",
434
+ size: 16
435
+ })
436
+ ], 10, ye)]),
437
+ panel: k(() => [l("div", xe, [(v(), c(i, null, x(f, (n) => l("button", {
438
+ key: n.value,
439
+ type: "button",
440
+ class: "editing-mode__option",
441
+ onClick: M((e) => S(n.value), ["prevent"])
442
+ }, [
443
+ d(t, {
444
+ name: n.icon,
445
+ size: 20
446
+ }, null, 8, ["name"]),
447
+ l("span", Ce, [l("span", we, w(n.label), 1), l("span", Te, w(n.desc), 1)]),
448
+ n.value === e.modelValue ? (v(), o(t, {
449
+ key: 0,
450
+ name: "check",
451
+ size: 18,
452
+ class: "editing-mode__check"
453
+ })) : s("", !0)
454
+ ], 8, Se)), 64))])]),
455
+ _: 1
456
+ }, 8, ["open"]));
457
+ }
458
+ }), [["__scopeId", "data-v-5d5c5f86"]]), De = [
459
+ "disabled",
460
+ "aria-label",
461
+ "title",
462
+ "aria-expanded",
463
+ "onClick"
464
+ ], Oe = { class: "docx-icon-grid__panel" }, ke = ["title", "onClick"], Ae = /* @__PURE__ */ n(/* @__PURE__ */ f({
465
+ __name: "IconGridDropdown",
466
+ props: {
467
+ options: {},
468
+ activeValue: {},
469
+ triggerIcon: {},
470
+ tooltipContent: {},
471
+ disabled: { type: Boolean },
472
+ ariaLabel: {}
473
+ },
474
+ emits: ["select"],
475
+ setup(e, { emit: n }) {
476
+ let r = n, a = b(!1);
477
+ function s(e) {
478
+ r("select", e), a.value = !1;
479
+ }
480
+ return (n, r) => (v(), o(Q, {
481
+ open: a.value,
482
+ "onUpdate:open": r[0] ||= (e) => a.value = e,
483
+ onClose: r[1] ||= (e) => a.value = !1
484
+ }, {
485
+ trigger: k(({ toggle: n }) => [l("button", {
486
+ type: "button",
487
+ class: m(["docx-icon-grid__btn", { "docx-icon-grid__btn--open": a.value }]),
488
+ disabled: e.disabled,
489
+ "aria-label": e.ariaLabel ?? e.tooltipContent,
490
+ title: e.tooltipContent,
491
+ "aria-expanded": a.value,
492
+ "aria-haspopup": "true",
493
+ onClick: M(n, ["prevent"])
494
+ }, [d(t, {
495
+ name: e.triggerIcon,
496
+ size: 20
497
+ }, null, 8, ["name"]), d(t, {
498
+ name: "arrow_drop_down",
499
+ size: 14
500
+ })], 10, De)]),
501
+ panel: k(() => [l("div", Oe, [(v(!0), c(i, null, x(e.options, (n) => (v(), c("button", {
502
+ key: n.value,
503
+ type: "button",
504
+ class: m(["docx-icon-grid__option", { "docx-icon-grid__option--active": e.activeValue === n.value }]),
505
+ title: n.label,
506
+ onClick: M((e) => s(n.value), ["prevent"])
507
+ }, [d(t, {
508
+ name: n.iconName,
509
+ size: 18
510
+ }, null, 8, ["name"])], 10, ke))), 128))])]),
511
+ _: 1
512
+ }, 8, ["open"]));
513
+ }
514
+ }), [["__scopeId", "data-v-435b9662"]]), je = /* @__PURE__ */ f({
515
+ __name: "ImageWrapDropdown",
516
+ props: {
517
+ imageContext: {},
518
+ disabled: { type: Boolean }
519
+ },
520
+ emits: ["change"],
521
+ setup(e) {
522
+ let t = e, n = [
523
+ {
524
+ value: "inline",
525
+ label: "In line",
526
+ iconName: "format_image_left"
527
+ },
528
+ {
529
+ value: "wrapRight",
530
+ label: "Float left",
531
+ iconName: "format_image_right"
532
+ },
533
+ {
534
+ value: "wrapLeft",
535
+ label: "Float right",
536
+ iconName: "format_image_left"
537
+ },
538
+ {
539
+ value: "topAndBottom",
540
+ label: "Top & bottom",
541
+ iconName: "horizontal_rule"
542
+ },
543
+ {
544
+ value: "behind",
545
+ label: "Behind text",
546
+ iconName: "flip_to_back"
547
+ },
548
+ {
549
+ value: "inFront",
550
+ label: "In front of text",
551
+ iconName: "flip_to_front"
552
+ }
553
+ ], r = a(() => {
554
+ let e = t.imageContext;
555
+ return e.displayMode === "float" && e.cssFloat === "left" ? "wrapRight" : e.displayMode === "float" && e.cssFloat === "right" ? "wrapLeft" : e.wrapType;
556
+ }), i = a(() => n.find((e) => e.value === r.value) ?? n[0]);
557
+ return (t, a) => (v(), o(Ae, {
558
+ options: n,
559
+ "active-value": r.value,
560
+ "trigger-icon": i.value.iconName,
561
+ "tooltip-content": `Wrap: ${i.value.label}`,
562
+ disabled: e.disabled,
563
+ onSelect: a[0] ||= (e) => t.$emit("change", e)
564
+ }, null, 8, [
565
+ "active-value",
566
+ "trigger-icon",
567
+ "tooltip-content",
568
+ "disabled"
569
+ ]));
570
+ }
571
+ }), Me = /* @__PURE__ */ f({
572
+ __name: "ImageTransformDropdown",
573
+ props: { disabled: { type: Boolean } },
574
+ emits: ["transform"],
575
+ setup(e) {
576
+ let t = [
577
+ {
578
+ value: "rotateCW",
579
+ label: "Rotate clockwise",
580
+ iconName: "rotate_right"
581
+ },
582
+ {
583
+ value: "rotateCCW",
584
+ label: "Rotate counter-clockwise",
585
+ iconName: "rotate_left"
586
+ },
587
+ {
588
+ value: "flipH",
589
+ label: "Flip horizontal",
590
+ iconName: "swap_horiz"
591
+ },
592
+ {
593
+ value: "flipV",
594
+ label: "Flip vertical",
595
+ iconName: "swap_vert"
596
+ }
597
+ ];
598
+ return (n, r) => (v(), o(Ae, {
599
+ options: t,
600
+ "trigger-icon": "rotate_right",
601
+ "tooltip-content": "Rotate / flip",
602
+ disabled: e.disabled,
603
+ onSelect: r[0] ||= (e) => n.$emit("transform", e)
604
+ }, null, 8, ["disabled"]));
605
+ }
606
+ }), Ne = [
607
+ {
608
+ name: "Arial",
609
+ fontFamily: "Arial",
610
+ category: "sans-serif"
611
+ },
612
+ {
613
+ name: "Calibri",
614
+ fontFamily: "Calibri",
615
+ category: "sans-serif"
616
+ },
617
+ {
618
+ name: "Helvetica",
619
+ fontFamily: "Helvetica",
620
+ category: "sans-serif"
621
+ },
622
+ {
623
+ name: "Verdana",
624
+ fontFamily: "Verdana",
625
+ category: "sans-serif"
626
+ },
627
+ {
628
+ name: "Open Sans",
629
+ fontFamily: "Open Sans",
630
+ category: "sans-serif"
631
+ },
632
+ {
633
+ name: "Roboto",
634
+ fontFamily: "Roboto",
635
+ category: "sans-serif"
636
+ },
637
+ {
638
+ name: "Times New Roman",
639
+ fontFamily: "Times New Roman",
640
+ category: "serif"
641
+ },
642
+ {
643
+ name: "Georgia",
644
+ fontFamily: "Georgia",
645
+ category: "serif"
646
+ },
647
+ {
648
+ name: "Cambria",
649
+ fontFamily: "Cambria",
650
+ category: "serif"
651
+ },
652
+ {
653
+ name: "Garamond",
654
+ fontFamily: "Garamond",
655
+ category: "serif"
656
+ },
657
+ {
658
+ name: "Courier New",
659
+ fontFamily: "Courier New",
660
+ category: "monospace"
661
+ },
662
+ {
663
+ name: "Consolas",
664
+ fontFamily: "Consolas",
665
+ category: "monospace"
666
+ }
667
+ ], Pe = [
668
+ 8,
669
+ 9,
670
+ 10,
671
+ 11,
672
+ 12,
673
+ 14,
674
+ 16,
675
+ 18,
676
+ 20,
677
+ 24,
678
+ 28,
679
+ 36,
680
+ 48,
681
+ 72
682
+ ], Fe = [
683
+ {
684
+ id: "Normal",
685
+ label: "Normal",
686
+ previewStyle: { fontSize: "13px" }
687
+ },
688
+ {
689
+ id: "Title",
690
+ label: "Title",
691
+ previewStyle: {
692
+ fontSize: "20px",
693
+ fontWeight: "bold"
694
+ }
695
+ },
696
+ {
697
+ id: "Subtitle",
698
+ label: "Subtitle",
699
+ previewStyle: {
700
+ fontSize: "15px",
701
+ color: "#6b7280"
702
+ }
703
+ },
704
+ {
705
+ id: "Heading1",
706
+ label: "Heading 1",
707
+ previewStyle: {
708
+ fontSize: "18px",
709
+ fontWeight: "bold",
710
+ color: "#4a6c8c"
711
+ }
712
+ },
713
+ {
714
+ id: "Heading2",
715
+ label: "Heading 2",
716
+ previewStyle: {
717
+ fontSize: "16px",
718
+ fontWeight: "bold",
719
+ color: "#4a6c8c"
720
+ }
721
+ },
722
+ {
723
+ id: "Heading3",
724
+ label: "Heading 3",
725
+ previewStyle: {
726
+ fontSize: "14px",
727
+ fontWeight: "bold",
728
+ color: "#4a6c8c"
729
+ }
730
+ }
731
+ ], Ie = [
732
+ {
733
+ label: "Single",
734
+ value: 240
735
+ },
736
+ {
737
+ label: "1.15",
738
+ value: 276
739
+ },
740
+ {
741
+ label: "1.5",
742
+ value: 360
743
+ },
744
+ {
745
+ label: "Double",
746
+ value: 480
747
+ }
748
+ ], Le = [
749
+ .5,
750
+ .75,
751
+ 1,
752
+ 1.25,
753
+ 1.5,
754
+ 2
755
+ ];
756
+ //#endregion
757
+ //#region src/composables/useToolbarDropdowns.ts
758
+ function Re(e) {
759
+ let t = b(null), n = b({
760
+ top: 0,
761
+ left: 0
762
+ });
763
+ function r(t) {
764
+ switch (t) {
765
+ case "zoom": return e.zoom.value;
766
+ case "style": return e.style.value;
767
+ case "font": return e.font.value;
768
+ case "size": return e.size.value;
769
+ case "align": return e.align.value;
770
+ case "spacing": return e.spacing.value;
771
+ default: return null;
772
+ }
773
+ }
774
+ function i(e) {
775
+ let t = r(e);
776
+ if (!t) return;
777
+ let i = t.getBoundingClientRect();
778
+ n.value = {
779
+ top: i.bottom,
780
+ left: i.left
781
+ };
782
+ }
783
+ let o = a(() => ({
784
+ top: n.value.top + "px",
785
+ left: n.value.left + "px"
786
+ }));
787
+ function s(e) {
788
+ t.value !== e && i(e), t.value = t.value === e ? null : e;
789
+ }
790
+ function c(n) {
791
+ let r = [
792
+ e.zoom,
793
+ e.style,
794
+ e.font,
795
+ e.size,
796
+ e.align,
797
+ e.spacing
798
+ ], i = n.target;
799
+ r.some((e) => e.value?.contains(i)) || (t.value = null);
800
+ }
801
+ return _(() => document.addEventListener("mousedown", c)), g(() => document.removeEventListener("mousedown", c)), {
802
+ openDropdown: t,
803
+ dropdownMenuStyle: o,
804
+ toggleDropdown: s
805
+ };
806
+ }
807
+ //#endregion
808
+ //#region src/components/Toolbar.vue?vue&type=script&setup=true&lang.ts
809
+ var ze = {
810
+ key: 0,
811
+ class: "basic-toolbar"
812
+ }, Be = ["disabled"], Ve = ["disabled"], He = ["disabled"], Ue = ["disabled"], We = ["onMousedown"], Ge = ["onMousedown"], Ke = {
813
+ key: 0,
814
+ class: "toolbar-dropdown__group-label"
815
+ }, qe = ["onMousedown"], Je = ["onMousedown"], Ye = ["disabled"], Xe = ["onMousedown"], Ze = /* @__PURE__ */ n(/* @__PURE__ */ f({
816
+ __name: "Toolbar",
817
+ props: {
818
+ view: {},
819
+ getCommands: { type: Function },
820
+ stateTick: {},
821
+ zoomPercent: {},
822
+ isMinZoom: { type: Boolean },
823
+ isMaxZoom: { type: Boolean },
824
+ zoomPresets: {},
825
+ showZoomControl: { type: Boolean },
826
+ editorMode: {},
827
+ commentsSidebarOpen: { type: Boolean },
828
+ imageContext: {},
829
+ theme: {},
830
+ fontFamilies: {}
831
+ },
832
+ emits: [
833
+ "find-replace",
834
+ "insert-table",
835
+ "insert-image",
836
+ "insert-link",
837
+ "insert-symbol",
838
+ "insert-page-break",
839
+ "insert-toc",
840
+ "page-setup",
841
+ "toggle-outline",
842
+ "zoom-in",
843
+ "zoom-out",
844
+ "zoom-set",
845
+ "toggle-sidebar",
846
+ "apply-style",
847
+ "mode-change",
848
+ "image-wrap-type",
849
+ "image-properties",
850
+ "image-transform"
851
+ ],
852
+ setup(e, { emit: n }) {
853
+ let r = e, f = n, p = a(() => r.zoomPercent ?? 100), g = a(() => r.isMinZoom ?? !1), _ = a(() => r.isMaxZoom ?? !1), y = a(() => r.zoomPresets ?? Le), C = a(() => r.showZoomControl ?? !0), E = b(null), D = b(null), O = b(null), k = b(null), A = b(null), j = b(null), { openDropdown: N, dropdownMenuStyle: P, toggleDropdown: F } = Re({
854
+ zoom: j,
855
+ style: E,
856
+ font: D,
857
+ size: O,
858
+ align: k,
859
+ spacing: A
860
+ }), I = a(() => {
861
+ r.stateTick;
862
+ let e = r.view;
863
+ return e ? z(e.state) : {
864
+ hasSelection: !1,
865
+ isMultiParagraph: !1,
866
+ textFormatting: {},
867
+ paragraphFormatting: {},
868
+ startParagraphIndex: 0,
869
+ endParagraphIndex: 0,
870
+ inList: !1,
871
+ activeCommentIds: [],
872
+ inInsertion: !1,
873
+ inDeletion: !1
874
+ };
875
+ }), H = a(() => {
876
+ let e = I.value.textFormatting.fontFamily;
877
+ return e?.ascii || e?.hAnsi || "Arial";
878
+ }), U = a(() => {
879
+ let e = I.value.textFormatting.fontSize;
880
+ return e ? e / 2 : 11;
881
+ }), W = a(() => I.value.paragraphFormatting.alignment || "left"), G = a(() => {
882
+ switch (W.value) {
883
+ case "center": return "format_align_center";
884
+ case "right": return "format_align_right";
885
+ case "both": return "format_align_justify";
886
+ default: return "format_align_left";
887
+ }
888
+ }), K = a(() => {
889
+ let e = I.value.paragraphFormatting.styleId || "Normal";
890
+ return Fe.find((t) => t.id === e)?.label || e;
891
+ }), q = a(() => {
892
+ r.stateTick;
893
+ let e = r.view;
894
+ return e ? R(e.state) > 0 : !1;
895
+ }), J = a(() => {
896
+ r.stateTick;
897
+ let e = r.view;
898
+ return e ? L(e.state) > 0 : !1;
899
+ }), ee = a(() => {
900
+ let e = I.value, t = e.inList && (e.listLevel ?? 0) > 0, n = (e.paragraphFormatting.indentLeft ?? 0) > 0;
901
+ return t || n;
902
+ }), te = a(() => {
903
+ let e = I.value.textFormatting.color?.rgb;
904
+ return e ? e.replace(/^#/, "").toUpperCase() : void 0;
905
+ }), Y = a(() => {
906
+ let e = I.value.textFormatting.highlight;
907
+ if (!(!e || e === "none")) return e.replace(/^#/, "").toUpperCase();
908
+ }), X = a(() => V(r.fontFamilies) ?? Ne), ne = a(() => [
909
+ {
910
+ label: "Sans-serif",
911
+ fonts: X.value.filter((e) => e.category === "sans-serif")
912
+ },
913
+ {
914
+ label: "Serif",
915
+ fonts: X.value.filter((e) => e.category === "serif")
916
+ },
917
+ {
918
+ label: "Monospace",
919
+ fonts: X.value.filter((e) => e.category === "monospace")
920
+ },
921
+ {
922
+ label: "Other",
923
+ fonts: X.value.filter((e) => !e.category || e.category === "other")
924
+ }
925
+ ]);
926
+ function Z(e, ...t) {
927
+ let n = r.view;
928
+ if (!n) return;
929
+ let i = r.getCommands()[e];
930
+ if (!i) {
931
+ console.warn("[Toolbar] command not found:", e);
932
+ return;
933
+ }
934
+ i(...t)(n.state, (e) => n.dispatch(e), n), n.hasFocus() || n.focus(), N.value = null;
935
+ }
936
+ function re(e) {
937
+ Z("setFontFamily", e);
938
+ }
939
+ function ie(e) {
940
+ Z("setFontSize", e * 2);
941
+ }
942
+ function ae() {
943
+ let e = U.value;
944
+ ie(Pe.find((t) => t > e) || e + 2);
945
+ }
946
+ function oe() {
947
+ let e = U.value;
948
+ ie([...Pe].reverse().find((t) => t < e) || Math.max(1, e - 2));
949
+ }
950
+ function se(e) {
951
+ if (typeof e == "object" && e.auto) {
952
+ Z("clearTextColor");
953
+ return;
954
+ }
955
+ Z("setTextColor", typeof e == "string" ? { rgb: e } : e);
956
+ }
957
+ function ce() {
958
+ let e = r.view;
959
+ e && (B(e.state, (t) => e.dispatch(t), e), e.hasFocus() || e.focus());
960
+ }
961
+ function le(e) {
962
+ Z("setHighlight", typeof e == "string" ? e : e.rgb ?? "none");
963
+ }
964
+ function ue(e) {
965
+ f("apply-style", e), N.value = null;
966
+ }
967
+ function de(e) {
968
+ Z("setLineSpacing", e);
969
+ }
970
+ function fe(e) {
971
+ let t = I.value.paragraphFormatting.lineSpacing;
972
+ return t ? Math.abs(t - e) < 10 : e === 240;
973
+ }
974
+ return (n, r) => e.view ? (v(), c("div", ze, [
975
+ l("button", {
976
+ title: "Undo (Ctrl+Z)",
977
+ disabled: !q.value,
978
+ onMousedown: r[0] ||= M((e) => Z("undo"), ["prevent"])
979
+ }, [d(t, { name: "undo" })], 40, Be),
980
+ l("button", {
981
+ title: "Redo (Ctrl+Y)",
982
+ disabled: !J.value,
983
+ onMousedown: r[1] ||= M((e) => Z("redo"), ["prevent"])
984
+ }, [d(t, { name: "redo" })], 40, Ve),
985
+ r[35] ||= l("span", { class: "divider" }, null, -1),
986
+ C.value ? (v(), c("div", {
987
+ key: 0,
988
+ class: "toolbar-dropdown zoom-group",
989
+ ref_key: "zoomDropdownRef",
990
+ ref: j
991
+ }, [
992
+ l("button", {
993
+ class: "size-btn",
994
+ onMousedown: r[2] ||= M((e) => n.$emit("zoom-out"), ["prevent"]),
995
+ disabled: g.value,
996
+ title: "Zoom out"
997
+ }, " − ", 40, He),
998
+ l("button", {
999
+ class: "toolbar-dropdown__trigger zoom-trigger",
1000
+ onMousedown: r[3] ||= M((e) => T(F)("zoom"), ["prevent"]),
1001
+ title: "Zoom level"
1002
+ }, w(p.value) + "% ", 33),
1003
+ l("button", {
1004
+ class: "size-btn",
1005
+ onMousedown: r[4] ||= M((e) => n.$emit("zoom-in"), ["prevent"]),
1006
+ disabled: _.value,
1007
+ title: "Zoom in"
1008
+ }, " + ", 40, Ue),
1009
+ T(N) === "zoom" ? (v(), c("div", {
1010
+ key: 0,
1011
+ style: h(T(P)),
1012
+ class: "toolbar-dropdown__menu zoom-menu"
1013
+ }, [(v(!0), c(i, null, x(y.value, (e) => (v(), c("button", {
1014
+ key: e,
1015
+ class: m(["toolbar-dropdown__item", { active: p.value === Math.round(e * 100) }]),
1016
+ onMousedown: M((t) => n.$emit("zoom-set", e), ["prevent"])
1017
+ }, w(Math.round(e * 100)) + "% ", 43, We))), 128))], 4)) : s("", !0)
1018
+ ], 512)) : s("", !0),
1019
+ r[36] ||= l("span", { class: "divider" }, null, -1),
1020
+ l("div", {
1021
+ class: "toolbar-dropdown",
1022
+ ref_key: "styleDropdownRef",
1023
+ ref: E
1024
+ }, [l("button", {
1025
+ class: "toolbar-dropdown__trigger style-trigger",
1026
+ onMousedown: r[5] ||= M((e) => T(F)("style"), ["prevent"]),
1027
+ title: "Paragraph style"
1028
+ }, [u(w(K.value) + " ", 1), d(t, {
1029
+ class: "chevron",
1030
+ name: "arrow_drop_down",
1031
+ size: 16
1032
+ })], 32), T(N) === "style" ? (v(), c("div", {
1033
+ key: 0,
1034
+ style: h(T(P)),
1035
+ class: "toolbar-dropdown__menu style-menu"
1036
+ }, [(v(!0), c(i, null, x(T(Fe), (e) => (v(), c("button", {
1037
+ key: e.id,
1038
+ class: m(["toolbar-dropdown__item", { active: (I.value.paragraphFormatting.styleId || "Normal") === e.id }]),
1039
+ style: h(e.previewStyle),
1040
+ onMousedown: M((t) => ue(e.id), ["prevent"])
1041
+ }, w(e.label), 47, Ge))), 128))], 4)) : s("", !0)], 512),
1042
+ r[37] ||= l("span", { class: "divider" }, null, -1),
1043
+ l("div", {
1044
+ class: "toolbar-dropdown",
1045
+ ref_key: "fontDropdownRef",
1046
+ ref: D
1047
+ }, [l("button", {
1048
+ class: "toolbar-dropdown__trigger font-trigger",
1049
+ onMousedown: r[6] ||= M((e) => T(F)("font"), ["prevent"]),
1050
+ title: "Font family"
1051
+ }, [u(w(H.value) + " ", 1), d(t, {
1052
+ class: "chevron",
1053
+ name: "arrow_drop_down",
1054
+ size: 16
1055
+ })], 32), T(N) === "font" ? (v(), c("div", {
1056
+ key: 0,
1057
+ style: h(T(P)),
1058
+ class: "toolbar-dropdown__menu font-menu"
1059
+ }, [(v(!0), c(i, null, x(ne.value, (e) => (v(), c(i, { key: e.label }, [e.fonts.length > 0 ? (v(), c("div", Ke, w(e.label), 1)) : s("", !0), (v(!0), c(i, null, x(e.fonts, (e) => (v(), c("button", {
1060
+ key: e.name,
1061
+ class: m(["toolbar-dropdown__item", { active: H.value === e.name }]),
1062
+ style: h({ fontFamily: e.fontFamily }),
1063
+ onMousedown: M((t) => re(e.name), ["prevent"])
1064
+ }, w(e.name), 47, qe))), 128))], 64))), 128))], 4)) : s("", !0)], 512),
1065
+ l("div", {
1066
+ class: "toolbar-dropdown font-size-group",
1067
+ ref_key: "sizeDropdownRef",
1068
+ ref: O
1069
+ }, [
1070
+ l("button", {
1071
+ class: "size-btn",
1072
+ onMousedown: M(oe, ["prevent"]),
1073
+ title: "Decrease font size"
1074
+ }, " − ", 32),
1075
+ l("button", {
1076
+ class: "toolbar-dropdown__trigger size-trigger",
1077
+ onMousedown: r[7] ||= M((e) => T(F)("size"), ["prevent"]),
1078
+ title: "Font size"
1079
+ }, w(U.value), 33),
1080
+ l("button", {
1081
+ class: "size-btn",
1082
+ onMousedown: M(ae, ["prevent"]),
1083
+ title: "Increase font size"
1084
+ }, " + ", 32),
1085
+ T(N) === "size" ? (v(), c("div", {
1086
+ key: 0,
1087
+ style: h(T(P)),
1088
+ class: "toolbar-dropdown__menu size-menu"
1089
+ }, [(v(!0), c(i, null, x(T(Pe), (e) => (v(), c("button", {
1090
+ key: e,
1091
+ class: m(["toolbar-dropdown__item", { active: U.value === e }]),
1092
+ onMousedown: M((t) => ie(e), ["prevent"])
1093
+ }, w(e), 43, Je))), 128))], 4)) : s("", !0)
1094
+ ], 512),
1095
+ r[38] ||= l("span", { class: "divider" }, null, -1),
1096
+ l("button", {
1097
+ title: "Bold (Ctrl+B)",
1098
+ class: m({ active: I.value.textFormatting.bold }),
1099
+ onMousedown: r[8] ||= M((e) => Z("toggleBold"), ["prevent"])
1100
+ }, [d(t, { name: "format_bold" })], 34),
1101
+ l("button", {
1102
+ title: "Italic (Ctrl+I)",
1103
+ class: m({ active: I.value.textFormatting.italic }),
1104
+ onMousedown: r[9] ||= M((e) => Z("toggleItalic"), ["prevent"])
1105
+ }, [d(t, { name: "format_italic" })], 34),
1106
+ l("button", {
1107
+ title: "Underline (Ctrl+U)",
1108
+ class: m({ active: !!I.value.textFormatting.underline }),
1109
+ onMousedown: r[10] ||= M((e) => Z("toggleUnderline"), ["prevent"])
1110
+ }, [d(t, { name: "format_underlined" })], 34),
1111
+ l("button", {
1112
+ title: "Strikethrough",
1113
+ class: m({ active: I.value.textFormatting.strike }),
1114
+ onMousedown: r[11] ||= M((e) => Z("toggleStrike"), ["prevent"])
1115
+ }, [d(t, { name: "strikethrough_s" })], 34),
1116
+ d(_e, {
1117
+ mode: "text",
1118
+ value: te.value,
1119
+ theme: e.theme ?? null,
1120
+ onChange: se
1121
+ }, null, 8, ["value", "theme"]),
1122
+ d(_e, {
1123
+ mode: "highlight",
1124
+ value: Y.value,
1125
+ theme: e.theme ?? null,
1126
+ onChange: le
1127
+ }, null, 8, ["value", "theme"]),
1128
+ l("button", {
1129
+ title: "Insert link (Ctrl+K)",
1130
+ onMousedown: r[12] ||= M((e) => n.$emit("insert-link"), ["prevent"])
1131
+ }, [d(t, { name: "link" })], 32),
1132
+ l("button", {
1133
+ title: "Superscript (Ctrl+Shift+=)",
1134
+ class: m({ active: I.value.textFormatting.vertAlign === "superscript" }),
1135
+ onMousedown: r[13] ||= M((e) => Z("toggleSuperscript"), ["prevent"])
1136
+ }, [d(t, { name: "superscript" })], 34),
1137
+ l("button", {
1138
+ title: "Subscript (Ctrl+=)",
1139
+ class: m({ active: I.value.textFormatting.vertAlign === "subscript" }),
1140
+ onMousedown: r[14] ||= M((e) => Z("toggleSubscript"), ["prevent"])
1141
+ }, [d(t, { name: "subscript" })], 34),
1142
+ r[39] ||= l("span", { class: "divider" }, null, -1),
1143
+ l("div", {
1144
+ class: "toolbar-dropdown",
1145
+ ref_key: "alignDropdownRef",
1146
+ ref: k
1147
+ }, [l("button", {
1148
+ class: "toolbar-dropdown__trigger align-trigger",
1149
+ onMousedown: r[15] ||= M((e) => T(F)("align"), ["prevent"]),
1150
+ title: "Alignment"
1151
+ }, [d(t, { name: G.value }, null, 8, ["name"]), d(t, {
1152
+ class: "chevron",
1153
+ name: "arrow_drop_down",
1154
+ size: 16
1155
+ })], 32), T(N) === "align" ? (v(), c("div", {
1156
+ key: 0,
1157
+ style: h(T(P)),
1158
+ class: "toolbar-dropdown__menu align-menu"
1159
+ }, [
1160
+ l("button", {
1161
+ class: m(["toolbar-dropdown__item dropdown-item--icon", { active: W.value === "left" }]),
1162
+ onMousedown: r[16] ||= M((e) => {
1163
+ Z("alignLeft"), N.value = null;
1164
+ }, ["prevent"])
1165
+ }, [d(t, {
1166
+ name: "format_align_left",
1167
+ size: 18
1168
+ }), r[30] ||= u(" Left (Ctrl+L) ", -1)], 34),
1169
+ l("button", {
1170
+ class: m(["toolbar-dropdown__item dropdown-item--icon", { active: W.value === "center" }]),
1171
+ onMousedown: r[17] ||= M((e) => {
1172
+ Z("alignCenter"), N.value = null;
1173
+ }, ["prevent"])
1174
+ }, [d(t, {
1175
+ name: "format_align_center",
1176
+ size: 18
1177
+ }), r[31] ||= u(" Center (Ctrl+E) ", -1)], 34),
1178
+ l("button", {
1179
+ class: m(["toolbar-dropdown__item dropdown-item--icon", { active: W.value === "right" }]),
1180
+ onMousedown: r[18] ||= M((e) => {
1181
+ Z("alignRight"), N.value = null;
1182
+ }, ["prevent"])
1183
+ }, [d(t, {
1184
+ name: "format_align_right",
1185
+ size: 18
1186
+ }), r[32] ||= u(" Right (Ctrl+R) ", -1)], 34),
1187
+ l("button", {
1188
+ class: m(["toolbar-dropdown__item dropdown-item--icon", { active: W.value === "both" }]),
1189
+ onMousedown: r[19] ||= M((e) => {
1190
+ Z("alignJustify"), N.value = null;
1191
+ }, ["prevent"])
1192
+ }, [d(t, {
1193
+ name: "format_align_justify",
1194
+ size: 18
1195
+ }), r[33] ||= u(" Justify (Ctrl+J) ", -1)], 34)
1196
+ ], 4)) : s("", !0)], 512),
1197
+ l("button", {
1198
+ title: "Bullet List",
1199
+ class: m({ active: I.value.inList && I.value.listType === "bullet" }),
1200
+ onMousedown: r[20] ||= M((e) => Z("toggleBulletList"), ["prevent"])
1201
+ }, [d(t, { name: "format_list_bulleted" })], 34),
1202
+ l("button", {
1203
+ title: "Numbered List",
1204
+ class: m({ active: I.value.inList && I.value.listType === "numbered" }),
1205
+ onMousedown: r[21] ||= M((e) => Z("toggleNumberedList"), ["prevent"])
1206
+ }, [d(t, { name: "format_list_numbered" })], 34),
1207
+ l("button", {
1208
+ title: "Decrease Indent (Shift+Tab)",
1209
+ disabled: !ee.value,
1210
+ onMousedown: r[22] ||= M((e) => Z("outdent"), ["prevent"])
1211
+ }, [d(t, { name: "format_indent_decrease" })], 40, Ye),
1212
+ l("button", {
1213
+ title: "Increase Indent (Tab)",
1214
+ onMousedown: r[23] ||= M((e) => Z("indent"), ["prevent"])
1215
+ }, [d(t, { name: "format_indent_increase" })], 32),
1216
+ l("div", {
1217
+ class: "toolbar-dropdown",
1218
+ ref_key: "spacingDropdownRef",
1219
+ ref: A
1220
+ }, [l("button", {
1221
+ class: "toolbar-dropdown__trigger",
1222
+ onMousedown: r[24] ||= M((e) => T(F)("spacing"), ["prevent"]),
1223
+ title: "Line spacing"
1224
+ }, [d(t, { name: "format_line_spacing" }), d(t, {
1225
+ class: "chevron",
1226
+ name: "arrow_drop_down",
1227
+ size: 16
1228
+ })], 32), T(N) === "spacing" ? (v(), c("div", {
1229
+ key: 0,
1230
+ style: h(T(P)),
1231
+ class: "toolbar-dropdown__menu"
1232
+ }, [(v(!0), c(i, null, x(T(Ie), (e) => (v(), c("button", {
1233
+ key: e.value,
1234
+ class: m(["toolbar-dropdown__item", { active: fe(e.value) }]),
1235
+ onMousedown: M((t) => de(e.value), ["prevent"])
1236
+ }, w(e.label), 43, Xe))), 128))], 4)) : s("", !0)], 512),
1237
+ l("button", {
1238
+ title: "Clear formatting",
1239
+ onMousedown: M(ce, ["prevent"])
1240
+ }, [d(t, { name: "format_clear" })], 32),
1241
+ r[40] ||= l("span", { class: "divider" }, null, -1),
1242
+ l("button", {
1243
+ title: "Comments & Changes",
1244
+ class: m({ active: e.commentsSidebarOpen }),
1245
+ onMousedown: r[25] ||= M((e) => n.$emit("toggle-sidebar"), ["prevent"])
1246
+ }, [d(t, { name: "comment" })], 34),
1247
+ e.imageContext ? (v(), c(i, { key: 1 }, [
1248
+ r[34] ||= l("span", { class: "divider" }, null, -1),
1249
+ d(je, {
1250
+ "image-context": e.imageContext,
1251
+ onChange: r[26] ||= (e) => n.$emit("image-wrap-type", e)
1252
+ }, null, 8, ["image-context"]),
1253
+ d(Me, { onTransform: r[27] ||= (e) => n.$emit("image-transform", e) }),
1254
+ l("button", {
1255
+ title: "Image properties",
1256
+ onMousedown: r[28] ||= M((e) => n.$emit("image-properties"), ["prevent"])
1257
+ }, [d(t, { name: "tune" })], 32)
1258
+ ], 64)) : s("", !0),
1259
+ S(n.$slots, "table-context", {}, void 0, !0),
1260
+ r[41] ||= l("span", { class: "divider" }, null, -1),
1261
+ e.editorMode ? (v(), o(Ee, {
1262
+ key: 2,
1263
+ "model-value": e.editorMode,
1264
+ "onUpdate:modelValue": r[29] ||= (e) => n.$emit("mode-change", e)
1265
+ }, null, 8, ["model-value"])) : s("", !0),
1266
+ S(n.$slots, "toolbar-extra", {}, void 0, !0)
1267
+ ])) : s("", !0);
1268
+ }
1269
+ }), [["__scopeId", "data-v-25c08b74"]]), Qe = /* @__PURE__ */ f({
1270
+ __name: "TableCellFillPicker",
1271
+ props: {
1272
+ disabled: { type: Boolean },
1273
+ theme: {},
1274
+ value: {}
1275
+ },
1276
+ emits: ["change"],
1277
+ setup(t, { emit: n }) {
1278
+ let r = n, { t: i } = e();
1279
+ function a(e) {
1280
+ typeof e == "string" && r("change", e === "none" ? "" : e.replace(/^#/, ""));
1281
+ }
1282
+ return (e, n) => (v(), o(_e, {
1283
+ mode: "highlight",
1284
+ value: t.value,
1285
+ theme: t.theme ?? null,
1286
+ disabled: t.disabled,
1287
+ title: T(i)("table.cellFillColor"),
1288
+ icon: "format_color_fill",
1289
+ "auto-label": T(i)("colorPicker.noColor"),
1290
+ onChange: a
1291
+ }, null, 8, [
1292
+ "value",
1293
+ "theme",
1294
+ "disabled",
1295
+ "title",
1296
+ "auto-label"
1297
+ ]));
1298
+ }
1299
+ }), $e = ["disabled", "onClick"], et = { class: "docx-tbp__panel" }, tt = ["title", "onClick"], nt = /* @__PURE__ */ n(/* @__PURE__ */ f({
1300
+ __name: "TableBorderPicker",
1301
+ props: { disabled: { type: Boolean } },
1302
+ emits: ["change"],
1303
+ setup(e, { emit: n }) {
1304
+ let r = n, a = b(!1), s = [
1305
+ {
1306
+ value: "all",
1307
+ icon: "border_all",
1308
+ label: "All borders"
1309
+ },
1310
+ {
1311
+ value: "none",
1312
+ icon: "border_clear",
1313
+ label: "No borders"
1314
+ },
1315
+ {
1316
+ value: "box",
1317
+ icon: "border_outer",
1318
+ label: "Outside borders"
1319
+ },
1320
+ {
1321
+ value: "inside",
1322
+ icon: "border_inner",
1323
+ label: "Inside borders"
1324
+ },
1325
+ {
1326
+ value: "top",
1327
+ icon: "border_top",
1328
+ label: "Top border"
1329
+ },
1330
+ {
1331
+ value: "bottom",
1332
+ icon: "border_bottom",
1333
+ label: "Bottom border"
1334
+ },
1335
+ {
1336
+ value: "left",
1337
+ icon: "border_left",
1338
+ label: "Left border"
1339
+ },
1340
+ {
1341
+ value: "right",
1342
+ icon: "border_right",
1343
+ label: "Right border"
1344
+ },
1345
+ {
1346
+ value: "insideH",
1347
+ icon: "border_horizontal",
1348
+ label: "Inside horizontal"
1349
+ },
1350
+ {
1351
+ value: "insideV",
1352
+ icon: "border_vertical",
1353
+ label: "Inside vertical"
1354
+ }
1355
+ ];
1356
+ function u(e) {
1357
+ r("change", e), a.value = !1;
1358
+ }
1359
+ return (n, r) => (v(), o(Q, {
1360
+ open: a.value,
1361
+ "onUpdate:open": r[0] ||= (e) => a.value = e,
1362
+ onClose: r[1] ||= (e) => a.value = !1
1363
+ }, {
1364
+ trigger: k(({ toggle: n }) => [l("button", {
1365
+ type: "button",
1366
+ class: "docx-tbp__btn",
1367
+ disabled: e.disabled,
1368
+ title: "Borders",
1369
+ onClick: M(n, ["prevent"])
1370
+ }, [d(t, {
1371
+ name: "border_all",
1372
+ size: 20
1373
+ })], 8, $e)]),
1374
+ panel: k(() => [l("div", et, [(v(), c(i, null, x(s, (e) => l("button", {
1375
+ key: e.value,
1376
+ type: "button",
1377
+ class: "docx-tbp__option",
1378
+ title: e.label,
1379
+ onClick: M((t) => u(e.value), ["prevent"])
1380
+ }, [d(t, {
1381
+ name: e.icon,
1382
+ size: 20
1383
+ }, null, 8, ["name"])], 8, tt)), 64))])]),
1384
+ _: 1
1385
+ }, 8, ["open"]));
1386
+ }
1387
+ }), [["__scopeId", "data-v-51d7b6e0"]]), rt = /* @__PURE__ */ f({
1388
+ __name: "TableBorderColorPicker",
1389
+ props: {
1390
+ disabled: { type: Boolean },
1391
+ theme: {},
1392
+ value: {}
1393
+ },
1394
+ emits: ["change"],
1395
+ setup(t, { emit: n }) {
1396
+ let r = n, { t: i } = e();
1397
+ function a(e) {
1398
+ typeof e == "string" ? r("change", e.replace(/^#/, "")) : e.rgb ? r("change", e.rgb.replace(/^#/, "")) : e.auto && r("change", "000000");
1399
+ }
1400
+ return (e, n) => (v(), o(_e, {
1401
+ mode: "border",
1402
+ value: t.value,
1403
+ theme: t.theme ?? null,
1404
+ disabled: t.disabled,
1405
+ title: T(i)("table.borderColor"),
1406
+ onChange: a
1407
+ }, null, 8, [
1408
+ "value",
1409
+ "theme",
1410
+ "disabled",
1411
+ "title"
1412
+ ]));
1413
+ }
1414
+ }), it = ["disabled", "onClick"], at = { class: "docx-tbwidth__panel" }, ot = ["onClick"], st = { class: "docx-tbwidth__label" }, ct = /* @__PURE__ */ n(/* @__PURE__ */ f({
1415
+ __name: "TableBorderWidthPicker",
1416
+ props: { disabled: { type: Boolean } },
1417
+ emits: ["change"],
1418
+ setup(e, { emit: n }) {
1419
+ let r = n, a = b(!1), s = [
1420
+ {
1421
+ label: "0.5pt",
1422
+ eighths: 4,
1423
+ previewPx: 1
1424
+ },
1425
+ {
1426
+ label: "0.75pt",
1427
+ eighths: 6,
1428
+ previewPx: 1
1429
+ },
1430
+ {
1431
+ label: "1pt",
1432
+ eighths: 8,
1433
+ previewPx: 2
1434
+ },
1435
+ {
1436
+ label: "1.5pt",
1437
+ eighths: 12,
1438
+ previewPx: 2
1439
+ },
1440
+ {
1441
+ label: "2.25pt",
1442
+ eighths: 18,
1443
+ previewPx: 3
1444
+ },
1445
+ {
1446
+ label: "3pt",
1447
+ eighths: 24,
1448
+ previewPx: 4
1449
+ },
1450
+ {
1451
+ label: "4.5pt",
1452
+ eighths: 36,
1453
+ previewPx: 6
1454
+ },
1455
+ {
1456
+ label: "6pt",
1457
+ eighths: 48,
1458
+ previewPx: 8
1459
+ }
1460
+ ];
1461
+ function u(e) {
1462
+ r("change", e), a.value = !1;
1463
+ }
1464
+ return (n, r) => (v(), o(Q, {
1465
+ open: a.value,
1466
+ "onUpdate:open": r[0] ||= (e) => a.value = e,
1467
+ onClose: r[1] ||= (e) => a.value = !1
1468
+ }, {
1469
+ trigger: k(({ toggle: n }) => [l("button", {
1470
+ type: "button",
1471
+ class: "docx-tbwidth__btn",
1472
+ disabled: e.disabled,
1473
+ title: "Border width",
1474
+ onClick: M(n, ["prevent"])
1475
+ }, [d(t, {
1476
+ name: "line_weight",
1477
+ size: 20
1478
+ })], 8, it)]),
1479
+ panel: k(() => [l("div", at, [(v(), c(i, null, x(s, (e) => l("button", {
1480
+ key: e.eighths,
1481
+ type: "button",
1482
+ class: "docx-tbwidth__option",
1483
+ onClick: M((t) => u(e.eighths), ["prevent"])
1484
+ }, [l("span", {
1485
+ class: "docx-tbwidth__preview",
1486
+ style: h({ borderTopWidth: e.previewPx + "px" })
1487
+ }, null, 4), l("span", st, w(e.label), 1)], 8, ot)), 64))])]),
1488
+ _: 1
1489
+ }, 8, ["open"]));
1490
+ }
1491
+ }), [["__scopeId", "data-v-c134095d"]]), lt = [
1492
+ "disabled",
1493
+ "title",
1494
+ "onClick"
1495
+ ], ut = ["aria-label"], dt = ["disabled"], ft = ["disabled"], pt = ["disabled"], mt = ["disabled"], ht = { class: "docx-tmore__section-label" }, gt = { class: "docx-tmore__icon-row" }, _t = ["title"], vt = ["title"], yt = ["title"], bt = { class: "docx-tmore__section-label" }, xt = { class: "docx-tmore__icon-row" }, St = ["title"], Ct = ["title"], wt = ["title"], Tt = { class: "docx-tmore__grow" }, Et = {
1496
+ key: 0,
1497
+ class: "docx-tmore__sub"
1498
+ }, Dt = { class: "docx-tmore__margin-grid" }, Ot = { class: "docx-tmore__field-label" }, kt = ["onUpdate:modelValue"], At = { class: "docx-tmore__grow" }, jt = {
1499
+ key: 1,
1500
+ class: "docx-tmore__sub"
1501
+ }, Mt = { class: "docx-tmore__row-field" }, Nt = { class: "docx-tmore__field-label" }, Pt = { value: "auto" }, Ft = { value: "atLeast" }, It = { value: "exact" }, Lt = {
1502
+ key: 0,
1503
+ class: "docx-tmore__row-field"
1504
+ }, Rt = { class: "docx-tmore__field-label" }, zt = { class: "docx-tmore__grow" }, Bt = {
1505
+ key: 2,
1506
+ class: "docx-tmore__sub docx-tmore__sub--list"
1507
+ }, Vt = /* @__PURE__ */ n(/* @__PURE__ */ f({
1508
+ __name: "TableMoreDropdown",
1509
+ props: {
1510
+ disabled: {
1511
+ type: Boolean,
1512
+ default: !1
1513
+ },
1514
+ canSplit: {
1515
+ type: Boolean,
1516
+ default: !1
1517
+ },
1518
+ canMerge: {
1519
+ type: Boolean,
1520
+ default: !1
1521
+ },
1522
+ rowCount: { default: 0 },
1523
+ columnCount: { default: 0 },
1524
+ currentJustification: { default: "left" }
1525
+ },
1526
+ emits: [
1527
+ "action",
1528
+ "cell-margins",
1529
+ "cell-text-direction",
1530
+ "row-height"
1531
+ ],
1532
+ setup(n, { emit: r }) {
1533
+ let a = n, u = r, { t: f } = e(), p = b(!1), h = b(!1), g = b(!1), _ = b(!1), S = y({
1534
+ top: 0,
1535
+ bottom: 0,
1536
+ left: 108,
1537
+ right: 108
1538
+ }), C = b(0), j = b("atLeast");
1539
+ O(p, (e) => {
1540
+ e || (h.value = !1, g.value = !1, _.value = !1);
1541
+ });
1542
+ function N(e) {
1543
+ return a.disabled ? !0 : e === "splitCell" ? !a.canSplit : e === "mergeCells" ? !a.canMerge : e === "deleteRow" ? (a.rowCount ?? 0) <= 1 : e === "deleteColumn" ? (a.columnCount ?? 0) <= 1 : !1;
1544
+ }
1545
+ function P(e) {
1546
+ N(e) || (u("action", e), p.value = !1);
1547
+ }
1548
+ let F = (e) => {
1549
+ let t = Number(e);
1550
+ return Number.isFinite(t) && t > 0 ? t : 0;
1551
+ };
1552
+ function I() {
1553
+ u("cell-margins", {
1554
+ top: F(S.top),
1555
+ bottom: F(S.bottom),
1556
+ left: F(S.left),
1557
+ right: F(S.right)
1558
+ }), p.value = !1;
1559
+ }
1560
+ function L() {
1561
+ let e = F(C.value);
1562
+ j.value === "auto" || e <= 0 ? u("row-height", { height: null }) : u("row-height", {
1563
+ height: e,
1564
+ rule: j.value
1565
+ }), p.value = !1;
1566
+ }
1567
+ function R(e) {
1568
+ u("cell-text-direction", e), p.value = !1;
1569
+ }
1570
+ return (e, r) => (v(), o(Q, {
1571
+ open: p.value,
1572
+ placement: "bottom-right",
1573
+ "onUpdate:open": r[34] ||= (e) => p.value = e,
1574
+ onClose: r[35] ||= (e) => p.value = !1
1575
+ }, {
1576
+ trigger: k(({ toggle: e }) => [l("button", {
1577
+ type: "button",
1578
+ class: m(["docx-tmore__btn", { "docx-tmore__btn--open": p.value }]),
1579
+ disabled: n.disabled,
1580
+ title: T(f)("tableAdvanced.tableOptions"),
1581
+ onClick: M(e, ["prevent"])
1582
+ }, [d(t, {
1583
+ name: "more_vert",
1584
+ size: 20
1585
+ })], 10, lt)]),
1586
+ panel: k(() => [l("div", {
1587
+ class: "docx-tmore__panel",
1588
+ role: "menu",
1589
+ "aria-label": T(f)("tableAdvanced.tableOptionsMenu")
1590
+ }, [
1591
+ l("button", {
1592
+ type: "button",
1593
+ class: "docx-tmore__item",
1594
+ onClick: r[0] ||= M((e) => P("addRowAbove"), ["prevent"])
1595
+ }, [d(t, {
1596
+ name: "add",
1597
+ size: 18
1598
+ }), l("span", null, w(T(f)("table.insertRowAbove")), 1)]),
1599
+ l("button", {
1600
+ type: "button",
1601
+ class: "docx-tmore__item",
1602
+ onClick: r[1] ||= M((e) => P("addRowBelow"), ["prevent"])
1603
+ }, [d(t, {
1604
+ name: "add",
1605
+ size: 18
1606
+ }), l("span", null, w(T(f)("table.insertRowBelow")), 1)]),
1607
+ l("button", {
1608
+ type: "button",
1609
+ class: "docx-tmore__item",
1610
+ onClick: r[2] ||= M((e) => P("addColumnLeft"), ["prevent"])
1611
+ }, [d(t, {
1612
+ name: "add",
1613
+ size: 18
1614
+ }), l("span", null, w(T(f)("table.insertColumnLeft")), 1)]),
1615
+ l("button", {
1616
+ type: "button",
1617
+ class: "docx-tmore__item",
1618
+ onClick: r[3] ||= M((e) => P("addColumnRight"), ["prevent"])
1619
+ }, [d(t, {
1620
+ name: "add",
1621
+ size: 18
1622
+ }), l("span", null, w(T(f)("table.insertColumnRight")), 1)]),
1623
+ r[38] ||= l("div", { class: "docx-tmore__separator" }, null, -1),
1624
+ l("button", {
1625
+ type: "button",
1626
+ class: "docx-tmore__item",
1627
+ disabled: N("mergeCells"),
1628
+ onClick: r[4] ||= M((e) => P("mergeCells"), ["prevent"])
1629
+ }, [d(t, {
1630
+ name: "call_merge",
1631
+ size: 18
1632
+ }), l("span", null, w(T(f)("table.mergeCells")), 1)], 8, dt),
1633
+ l("button", {
1634
+ type: "button",
1635
+ class: "docx-tmore__item",
1636
+ disabled: N("splitCell"),
1637
+ onClick: r[5] ||= M((e) => P("splitCell"), ["prevent"])
1638
+ }, [d(t, {
1639
+ name: "call_split",
1640
+ size: 18
1641
+ }), l("span", null, w(T(f)("table.splitCell")), 1)], 8, ft),
1642
+ r[39] ||= l("div", { class: "docx-tmore__separator" }, null, -1),
1643
+ l("button", {
1644
+ type: "button",
1645
+ class: "docx-tmore__item docx-tmore__item--danger",
1646
+ disabled: N("deleteRow"),
1647
+ onClick: r[6] ||= M((e) => P("deleteRow"), ["prevent"])
1648
+ }, [d(t, {
1649
+ name: "delete",
1650
+ size: 18
1651
+ }), l("span", null, w(T(f)("table.deleteRow")), 1)], 8, pt),
1652
+ l("button", {
1653
+ type: "button",
1654
+ class: "docx-tmore__item docx-tmore__item--danger",
1655
+ disabled: N("deleteColumn"),
1656
+ onClick: r[7] ||= M((e) => P("deleteColumn"), ["prevent"])
1657
+ }, [d(t, {
1658
+ name: "delete",
1659
+ size: 18
1660
+ }), l("span", null, w(T(f)("table.deleteColumn")), 1)], 8, mt),
1661
+ l("button", {
1662
+ type: "button",
1663
+ class: "docx-tmore__item docx-tmore__item--danger",
1664
+ onClick: r[8] ||= M((e) => P("deleteTable"), ["prevent"])
1665
+ }, [d(t, {
1666
+ name: "delete",
1667
+ size: 18
1668
+ }), l("span", null, w(T(f)("table.deleteTable")), 1)]),
1669
+ r[40] ||= l("div", { class: "docx-tmore__separator" }, null, -1),
1670
+ l("div", ht, w(T(f)("tableAdvanced.verticalAlignment")), 1),
1671
+ l("div", gt, [
1672
+ l("button", {
1673
+ type: "button",
1674
+ class: "docx-tmore__icon-btn",
1675
+ title: T(f)("tableAdvanced.top"),
1676
+ onMousedown: r[9] ||= M(() => {}, ["prevent"]),
1677
+ onClick: r[10] ||= M((e) => P("verticalAlignTop"), ["prevent"])
1678
+ }, [d(t, {
1679
+ name: "vertical_align_top",
1680
+ size: 16
1681
+ })], 40, _t),
1682
+ l("button", {
1683
+ type: "button",
1684
+ class: "docx-tmore__icon-btn",
1685
+ title: T(f)("tableAdvanced.middle"),
1686
+ onMousedown: r[11] ||= M(() => {}, ["prevent"]),
1687
+ onClick: r[12] ||= M((e) => P("verticalAlignMiddle"), ["prevent"])
1688
+ }, [d(t, {
1689
+ name: "vertical_align_center",
1690
+ size: 16
1691
+ })], 40, vt),
1692
+ l("button", {
1693
+ type: "button",
1694
+ class: "docx-tmore__icon-btn",
1695
+ title: T(f)("tableAdvanced.bottom"),
1696
+ onMousedown: r[13] ||= M(() => {}, ["prevent"]),
1697
+ onClick: r[14] ||= M((e) => P("verticalAlignBottom"), ["prevent"])
1698
+ }, [d(t, {
1699
+ name: "vertical_align_bottom",
1700
+ size: 16
1701
+ })], 40, yt)
1702
+ ]),
1703
+ r[41] ||= l("div", { class: "docx-tmore__separator" }, null, -1),
1704
+ l("div", bt, w(T(f)("tableAdvanced.tableAlignment")), 1),
1705
+ l("div", xt, [
1706
+ l("button", {
1707
+ type: "button",
1708
+ class: m(["docx-tmore__icon-btn", { "docx-tmore__icon-btn--active": n.currentJustification === "left" }]),
1709
+ title: T(f)("tableAdvanced.alignTableLeft"),
1710
+ onMousedown: r[15] ||= M(() => {}, ["prevent"]),
1711
+ onClick: r[16] ||= M((e) => P("alignTableLeft"), ["prevent"])
1712
+ }, [d(t, {
1713
+ name: "format_align_left",
1714
+ size: 16
1715
+ })], 42, St),
1716
+ l("button", {
1717
+ type: "button",
1718
+ class: m(["docx-tmore__icon-btn", { "docx-tmore__icon-btn--active": n.currentJustification === "center" }]),
1719
+ title: T(f)("tableAdvanced.alignTableCenter"),
1720
+ onMousedown: r[17] ||= M(() => {}, ["prevent"]),
1721
+ onClick: r[18] ||= M((e) => P("alignTableCenter"), ["prevent"])
1722
+ }, [d(t, {
1723
+ name: "format_align_center",
1724
+ size: 16
1725
+ })], 42, Ct),
1726
+ l("button", {
1727
+ type: "button",
1728
+ class: m(["docx-tmore__icon-btn", { "docx-tmore__icon-btn--active": n.currentJustification === "right" }]),
1729
+ title: T(f)("tableAdvanced.alignTableRight"),
1730
+ onMousedown: r[19] ||= M(() => {}, ["prevent"]),
1731
+ onClick: r[20] ||= M((e) => P("alignTableRight"), ["prevent"])
1732
+ }, [d(t, {
1733
+ name: "format_align_right",
1734
+ size: 16
1735
+ })], 42, wt)
1736
+ ]),
1737
+ r[42] ||= l("div", { class: "docx-tmore__separator" }, null, -1),
1738
+ l("button", {
1739
+ type: "button",
1740
+ class: "docx-tmore__item",
1741
+ onClick: r[21] ||= M((e) => h.value = !h.value, ["prevent"])
1742
+ }, [
1743
+ d(t, {
1744
+ name: "padding",
1745
+ size: 18
1746
+ }),
1747
+ l("span", Tt, w(T(f)("tableAdvanced.cellMargins")), 1),
1748
+ d(t, {
1749
+ name: h.value ? "expand_less" : "expand_more",
1750
+ size: 18
1751
+ }, null, 8, ["name"])
1752
+ ]),
1753
+ h.value ? (v(), c("div", Et, [l("div", Dt, [(v(), c(i, null, x([
1754
+ "top",
1755
+ "bottom",
1756
+ "left",
1757
+ "right"
1758
+ ], (e) => l("label", {
1759
+ key: e,
1760
+ class: "docx-tmore__field"
1761
+ }, [
1762
+ l("span", Ot, w(e), 1),
1763
+ A(l("input", {
1764
+ type: "number",
1765
+ min: "0",
1766
+ step: "20",
1767
+ "onUpdate:modelValue": (t) => S[e] = t,
1768
+ class: "docx-tmore__input"
1769
+ }, null, 8, kt), [[
1770
+ D,
1771
+ S[e],
1772
+ void 0,
1773
+ { number: !0 }
1774
+ ]]),
1775
+ r[36] ||= l("span", { class: "docx-tmore__unit" }, "tw", -1)
1776
+ ])), 64))]), l("button", {
1777
+ type: "button",
1778
+ class: "docx-tmore__apply",
1779
+ onClick: M(I, ["prevent"])
1780
+ }, w(T(f)("common.apply")), 1)])) : s("", !0),
1781
+ l("button", {
1782
+ type: "button",
1783
+ class: "docx-tmore__item",
1784
+ onClick: r[22] ||= M((e) => g.value = !g.value, ["prevent"])
1785
+ }, [
1786
+ d(t, {
1787
+ name: "height",
1788
+ size: 18
1789
+ }),
1790
+ l("span", At, w(T(f)("tableAdvanced.rowHeight")), 1),
1791
+ d(t, {
1792
+ name: g.value ? "expand_less" : "expand_more",
1793
+ size: 18
1794
+ }, null, 8, ["name"])
1795
+ ]),
1796
+ g.value ? (v(), c("div", jt, [
1797
+ l("label", Mt, [l("span", Nt, w(T(f)("tableAdvanced.rule")), 1), A(l("select", {
1798
+ "onUpdate:modelValue": r[23] ||= (e) => j.value = e,
1799
+ class: "docx-tmore__select"
1800
+ }, [
1801
+ l("option", Pt, w(T(f)("tableAdvanced.heightRules.auto")), 1),
1802
+ l("option", Ft, w(T(f)("tableAdvanced.heightRules.atLeast")), 1),
1803
+ l("option", It, w(T(f)("tableAdvanced.heightRules.exact")), 1)
1804
+ ], 512), [[E, j.value]])]),
1805
+ j.value === "auto" ? s("", !0) : (v(), c("label", Lt, [
1806
+ l("span", Rt, w(T(f)("tableAdvanced.height")), 1),
1807
+ A(l("input", {
1808
+ type: "number",
1809
+ min: "0",
1810
+ step: "20",
1811
+ "onUpdate:modelValue": r[24] ||= (e) => C.value = e,
1812
+ class: "docx-tmore__input"
1813
+ }, null, 512), [[
1814
+ D,
1815
+ C.value,
1816
+ void 0,
1817
+ { number: !0 }
1818
+ ]]),
1819
+ r[37] ||= l("span", { class: "docx-tmore__unit" }, "tw", -1)
1820
+ ])),
1821
+ l("button", {
1822
+ type: "button",
1823
+ class: "docx-tmore__apply",
1824
+ onClick: M(L, ["prevent"])
1825
+ }, w(T(f)("common.apply")), 1)
1826
+ ])) : s("", !0),
1827
+ l("button", {
1828
+ type: "button",
1829
+ class: "docx-tmore__item",
1830
+ onClick: r[25] ||= M((e) => _.value = !_.value, ["prevent"])
1831
+ }, [
1832
+ d(t, {
1833
+ name: "text_rotation_none",
1834
+ size: 18
1835
+ }),
1836
+ l("span", zt, w(T(f)("tableAdvanced.textDirection")), 1),
1837
+ d(t, {
1838
+ name: _.value ? "expand_less" : "expand_more",
1839
+ size: 18
1840
+ }, null, 8, ["name"])
1841
+ ]),
1842
+ _.value ? (v(), c("div", Bt, [
1843
+ l("button", {
1844
+ type: "button",
1845
+ class: "docx-tmore__sub-item",
1846
+ onClick: r[26] ||= M((e) => R(null), ["prevent"])
1847
+ }, w(T(f)("tableAdvanced.textDirections.horizontal")), 1),
1848
+ l("button", {
1849
+ type: "button",
1850
+ class: "docx-tmore__sub-item",
1851
+ onClick: r[27] ||= M((e) => R("tbRl"), ["prevent"])
1852
+ }, w(T(f)("tableAdvanced.textDirections.verticalRL")), 1),
1853
+ l("button", {
1854
+ type: "button",
1855
+ class: "docx-tmore__sub-item",
1856
+ onClick: r[28] ||= M((e) => R("btLr"), ["prevent"])
1857
+ }, w(T(f)("tableAdvanced.textDirections.verticalLR")), 1)
1858
+ ])) : s("", !0),
1859
+ r[43] ||= l("div", { class: "docx-tmore__separator" }, null, -1),
1860
+ l("button", {
1861
+ type: "button",
1862
+ class: "docx-tmore__item",
1863
+ onClick: r[29] ||= M((e) => P("toggleHeaderRow"), ["prevent"])
1864
+ }, [d(t, {
1865
+ name: "table_rows",
1866
+ size: 18
1867
+ }), l("span", null, w(T(f)("tableAdvanced.toggleHeaderRow")), 1)]),
1868
+ l("button", {
1869
+ type: "button",
1870
+ class: "docx-tmore__item",
1871
+ onClick: r[30] ||= M((e) => P("distributeColumns"), ["prevent"])
1872
+ }, [d(t, {
1873
+ name: "view_column",
1874
+ size: 18
1875
+ }), l("span", null, w(T(f)("tableAdvanced.distributeColumns")), 1)]),
1876
+ l("button", {
1877
+ type: "button",
1878
+ class: "docx-tmore__item",
1879
+ onClick: r[31] ||= M((e) => P("autoFit"), ["prevent"])
1880
+ }, [d(t, {
1881
+ name: "fit_width",
1882
+ size: 18
1883
+ }), l("span", null, w(T(f)("tableAdvanced.autoFit")), 1)]),
1884
+ l("button", {
1885
+ type: "button",
1886
+ class: "docx-tmore__item",
1887
+ onClick: r[32] ||= M((e) => P("toggleNoWrap"), ["prevent"])
1888
+ }, [d(t, {
1889
+ name: "wrap_text",
1890
+ size: 18
1891
+ }), l("span", null, w(T(f)("tableAdvanced.toggleNoWrap")), 1)]),
1892
+ r[44] ||= l("div", { class: "docx-tmore__separator" }, null, -1),
1893
+ l("button", {
1894
+ type: "button",
1895
+ class: "docx-tmore__item",
1896
+ onClick: r[33] ||= M((e) => P("tableProperties"), ["prevent"])
1897
+ }, [d(t, {
1898
+ name: "settings",
1899
+ size: 18
1900
+ }), l("span", null, w(T(f)("tableAdvanced.tableProperties")), 1)])
1901
+ ], 8, ut)]),
1902
+ _: 1
1903
+ }, 8, ["open"]));
1904
+ }
1905
+ }), [["__scopeId", "data-v-dbab3895"]]), Ht = /* @__PURE__ */ n(/* @__PURE__ */ f({
1906
+ __name: "TableToolbar",
1907
+ props: {
1908
+ view: {},
1909
+ getCommands: { type: Function },
1910
+ stateTick: {},
1911
+ theme: {}
1912
+ },
1913
+ setup(e) {
1914
+ let t = e, n = a(() => {
1915
+ t.stateTick;
1916
+ let e = t.view;
1917
+ return e ? H(e.state) : null;
1918
+ }), r = a(() => !!n.value?.isInTable), o = a(() => {
1919
+ t.stateTick;
1920
+ let e = t.view;
1921
+ if (!e) return !1;
1922
+ let { $from: n } = e.state.selection;
1923
+ for (let e = n.depth; e > 0; e--) if (n.node(e).type.name === "tableCell") {
1924
+ let t = n.node(e), r = t.attrs.colspan || 1, i = t.attrs.rowspan || 1;
1925
+ return r > 1 || i > 1;
1926
+ }
1927
+ return !1;
1928
+ }), u = a(() => !!n.value?.hasMultiCellSelection), f = a(() => n.value?.rowCount ?? 0), p = a(() => n.value?.columnCount ?? 0), m = a(() => {
1929
+ let e = n.value?.table?.attrs?.justification;
1930
+ return e === "center" || e === "right" ? e : "left";
1931
+ }), h = {
1932
+ style: "single",
1933
+ size: 4,
1934
+ color: { rgb: "000000" }
1935
+ };
1936
+ O([() => t.view, () => t.stateTick], () => {
1937
+ let e = t.view;
1938
+ if (!e) return;
1939
+ let n = H(e.state), r = n.cellBorderColor;
1940
+ !r || !n.isInTable || typeof r == "object" && "rgb" in r && typeof r.rgb == "string" && (h.color = { rgb: r.rgb });
1941
+ }, { immediate: !0 });
1942
+ function g(e, ...n) {
1943
+ let r = t.view;
1944
+ if (!r) return !1;
1945
+ let i = t.getCommands()[e];
1946
+ if (typeof i != "function") return !1;
1947
+ let a = i(...n);
1948
+ return typeof a == "function" ? (a(r.state, (e) => r.dispatch(e), r), r.focus(), !0) : !1;
1949
+ }
1950
+ function _(e) {
1951
+ let t = {
1952
+ ...h,
1953
+ color: { ...h.color }
1954
+ };
1955
+ switch (e) {
1956
+ case "all":
1957
+ g("setAllTableBorders", t);
1958
+ return;
1959
+ case "none":
1960
+ g("removeTableBorders");
1961
+ return;
1962
+ case "box":
1963
+ g("setOutsideTableBorders", t);
1964
+ return;
1965
+ case "inside":
1966
+ case "insideH":
1967
+ case "insideV":
1968
+ g("setInsideTableBorders", t);
1969
+ return;
1970
+ case "top":
1971
+ case "bottom":
1972
+ case "left":
1973
+ case "right":
1974
+ g("setCellBorder", e, t, !0);
1975
+ return;
1976
+ }
1977
+ }
1978
+ function y(e) {
1979
+ h.color = { rgb: e.replace(/^#/, "") }, g("setTableBorderColor", e);
1980
+ }
1981
+ function b(e) {
1982
+ h.size = e, g("setTableBorderWidth", e);
1983
+ }
1984
+ function x(e) {
1985
+ g("setCellFillColor", e);
1986
+ }
1987
+ let S = {
1988
+ autoFit: ["autoFitContents"],
1989
+ alignTableLeft: ["setTableProperties", { justification: "left" }],
1990
+ alignTableCenter: ["setTableProperties", { justification: "center" }],
1991
+ alignTableRight: ["setTableProperties", { justification: "right" }],
1992
+ verticalAlignTop: ["setCellVerticalAlign", "top"],
1993
+ verticalAlignMiddle: ["setCellVerticalAlign", "center"],
1994
+ verticalAlignBottom: ["setCellVerticalAlign", "bottom"]
1995
+ };
1996
+ function C(e) {
1997
+ if (e === "tableProperties") return;
1998
+ let t = S[e];
1999
+ t ? g(...t) : g(e);
2000
+ }
2001
+ function w(e) {
2002
+ g("setCellMargins", e);
2003
+ }
2004
+ function T(e) {
2005
+ g("setCellTextDirection", e);
2006
+ }
2007
+ function E(e) {
2008
+ g("setRowHeight", e.height, e.rule);
2009
+ }
2010
+ return (t, n) => r.value ? (v(), c(i, { key: 0 }, [
2011
+ n[0] ||= l("span", { class: "divider" }, null, -1),
2012
+ d(nt, { onChange: _ }),
2013
+ d(rt, {
2014
+ theme: e.theme ?? null,
2015
+ onChange: y
2016
+ }, null, 8, ["theme"]),
2017
+ d(ct, { onChange: b }),
2018
+ d(Qe, {
2019
+ theme: e.theme ?? null,
2020
+ onChange: x
2021
+ }, null, 8, ["theme"]),
2022
+ d(Vt, {
2023
+ "can-split": o.value,
2024
+ "can-merge": u.value,
2025
+ "row-count": f.value,
2026
+ "column-count": p.value,
2027
+ "current-justification": m.value,
2028
+ onAction: C,
2029
+ onCellMargins: w,
2030
+ onCellTextDirection: T,
2031
+ onRowHeight: E
2032
+ }, null, 8, [
2033
+ "can-split",
2034
+ "can-merge",
2035
+ "row-count",
2036
+ "column-count",
2037
+ "current-justification"
2038
+ ])
2039
+ ], 64)) : s("", !0);
2040
+ }
2041
+ }), [["__scopeId", "data-v-56725acf"]]), Ut = /* @__PURE__ */ f({
2042
+ __name: "Avatar",
2043
+ props: {
2044
+ name: { default: "U" },
2045
+ size: { default: 32 }
2046
+ },
2047
+ setup(e) {
2048
+ let t = e, n = a(() => K(t.name || "U")), r = a(() => ({
2049
+ width: t.size + "px",
2050
+ height: t.size + "px",
2051
+ borderRadius: "50%",
2052
+ backgroundColor: W(t.name || "U"),
2053
+ color: "#fff",
2054
+ display: "flex",
2055
+ alignItems: "center",
2056
+ justifyContent: "center",
2057
+ fontSize: t.size === 32 ? "13px" : "11px",
2058
+ fontWeight: 500,
2059
+ flexShrink: 0
2060
+ }));
2061
+ return (e, t) => (v(), c("div", {
2062
+ class: "docx-avatar",
2063
+ style: h(r.value)
2064
+ }, w(n.value), 5));
2065
+ }
2066
+ }), Wt = {
2067
+ key: 0,
2068
+ class: "reply-thread"
2069
+ }, Gt = {
2070
+ key: 0,
2071
+ class: "reply-thread__more"
2072
+ }, Kt = { class: "reply-thread__header" }, qt = { class: "reply-thread__author-block" }, Jt = { class: "reply-thread__author" }, Yt = { class: "reply-thread__date" }, Xt = /* @__PURE__ */ n(/* @__PURE__ */ f({
2073
+ __name: "ReplyThread",
2074
+ props: {
2075
+ replies: {},
2076
+ isExpanded: { type: Boolean }
2077
+ },
2078
+ setup(e) {
2079
+ let t = e, n = a(() => t.isExpanded ? t.replies : t.replies.slice(-1)), r = a(() => t.isExpanded ? 0 : Math.max(0, t.replies.length - 1));
2080
+ return (t, a) => e.replies.length > 0 ? (v(), c("div", Wt, [r.value > 0 ? (v(), c("div", Gt, w(r.value) + " " + w(r.value === 1 ? "reply" : "replies"), 1)) : s("", !0), (v(!0), c(i, null, x(n.value, (t) => (v(), c("div", {
2081
+ key: t.id,
2082
+ class: m(["reply-thread__item", { "reply-thread__item--expanded": e.isExpanded }])
2083
+ }, [l("div", Kt, [d(Ut, {
2084
+ name: t.author,
2085
+ size: 28
2086
+ }, null, 8, ["name"]), l("div", qt, [l("div", Jt, w(t.author || "Unknown"), 1), l("div", Yt, w(T(U)(t.date)), 1)])]), l("div", { class: m(["reply-thread__body", { "reply-thread__body--clamp": !e.isExpanded }]) }, w(T(G)(t.content)), 3)], 2))), 128))])) : s("", !0);
2087
+ }
2088
+ }), [["__scopeId", "data-v-fc8a461d"]]), Zt = ["onKeydown"], Qt = { class: "reply-input__actions" }, $t = ["disabled"], en = /* @__PURE__ */ n(/* @__PURE__ */ f({
2089
+ __name: "ReplyInput",
2090
+ emits: ["submit"],
2091
+ setup(e, { emit: t }) {
2092
+ let n = t, r = b(!1), o = b(""), s = b(null), u = a(() => o.value.trim());
2093
+ function d() {
2094
+ r.value = !0, p(() => s.value?.focus({ preventScroll: !0 }));
2095
+ }
2096
+ function f() {
2097
+ r.value = !1, o.value = "";
2098
+ }
2099
+ function h() {
2100
+ let e = u.value;
2101
+ e && n("submit", e), o.value = "", r.value = !1;
2102
+ }
2103
+ return (e, t) => (v(), c("div", {
2104
+ onClick: t[4] ||= M(() => {}, ["stop"]),
2105
+ onMousedown: t[5] ||= M(() => {}, ["stop"]),
2106
+ class: "reply-input"
2107
+ }, [r.value ? (v(), c(i, { key: 1 }, [A(l("input", {
2108
+ ref_key: "inputRef",
2109
+ ref: s,
2110
+ "onUpdate:modelValue": t[1] ||= (e) => o.value = e,
2111
+ type: "text",
2112
+ placeholder: "Reply",
2113
+ class: "reply-input__field reply-input__field--active",
2114
+ onMousedown: t[2] ||= M(() => {}, ["stop"]),
2115
+ onKeydown: [
2116
+ t[3] ||= M(() => {}, ["stop"]),
2117
+ j(M(h, ["prevent"]), ["enter"]),
2118
+ j(f, ["esc"])
2119
+ ]
2120
+ }, null, 40, Zt), [[D, o.value]]), l("div", Qt, [l("button", {
2121
+ class: "reply-input__cancel",
2122
+ onClick: M(f, ["stop"])
2123
+ }, "Cancel"), l("button", {
2124
+ class: m(["reply-input__submit", { "reply-input__submit--active": u.value }]),
2125
+ disabled: !u.value,
2126
+ onClick: M(h, ["stop"])
2127
+ }, "Reply", 10, $t)])], 64)) : (v(), c("input", {
2128
+ key: 0,
2129
+ readonly: "",
2130
+ placeholder: "Reply",
2131
+ class: "reply-input__field reply-input__field--inactive",
2132
+ onMousedown: t[0] ||= M(() => {}, ["stop"]),
2133
+ onClick: M(d, ["stop"])
2134
+ }, null, 32))], 32));
2135
+ }
2136
+ }), [["__scopeId", "data-v-aa3d5b08"]]), tn = ["data-comment-id"], nn = {
2137
+ key: 0,
2138
+ class: "comment-card__resolved"
2139
+ }, rn = { class: "comment-card__head" }, an = { class: "comment-card__author-block" }, on = { class: "comment-card__author" }, sn = { class: "comment-card__date" }, cn = {
2140
+ key: 0,
2141
+ class: "comment-card__actions"
2142
+ }, ln = ["title"], un = { class: "comment-card__body" }, dn = /* @__PURE__ */ n(/* @__PURE__ */ f({
2143
+ __name: "CommentCard",
2144
+ props: {
2145
+ comment: {},
2146
+ replies: {},
2147
+ expanded: { type: Boolean }
2148
+ },
2149
+ emits: [
2150
+ "click",
2151
+ "reply",
2152
+ "resolve",
2153
+ "unresolve",
2154
+ "delete"
2155
+ ],
2156
+ setup(e, { emit: n }) {
2157
+ let r = e, i = n, a = b(!1);
2158
+ function u() {
2159
+ a.value = !1, i("delete", r.comment.id);
2160
+ }
2161
+ return (n, r) => (v(), c("div", {
2162
+ class: m(["comment-card", { "comment-card--expanded": e.expanded }]),
2163
+ "data-comment-id": e.comment.id,
2164
+ onClick: r[5] ||= (e) => n.$emit("click"),
2165
+ onMousedown: r[6] ||= M(() => {}, ["stop"])
2166
+ }, [
2167
+ e.comment.done ? (v(), c("div", nn, [d(t, {
2168
+ name: "check",
2169
+ size: 12
2170
+ }), r[7] ||= l("span", null, "Resolved", -1)])) : s("", !0),
2171
+ l("div", rn, [
2172
+ d(Ut, {
2173
+ name: e.comment.author,
2174
+ size: 32
2175
+ }, null, 8, ["name"]),
2176
+ l("div", an, [l("div", on, w(e.comment.author || "Unknown"), 1), l("div", sn, w(T(U)(e.comment.date)), 1)]),
2177
+ e.expanded ? (v(), c("div", cn, [
2178
+ l("button", {
2179
+ class: "comment-card__icon-btn",
2180
+ title: e.comment.done ? "Reopen" : "Resolve",
2181
+ onClick: r[0] ||= M((t) => e.comment.done ? n.$emit("unresolve", e.comment.id) : n.$emit("resolve", e.comment.id), ["stop"])
2182
+ }, [d(t, {
2183
+ name: e.comment.done ? "undo" : "check",
2184
+ size: 20
2185
+ }, null, 8, ["name"])], 8, ln),
2186
+ l("button", {
2187
+ class: "comment-card__icon-btn",
2188
+ title: "More options",
2189
+ onClick: r[1] ||= M((e) => a.value = !a.value, ["stop"])
2190
+ }, [d(t, {
2191
+ name: "more_vert",
2192
+ size: 20
2193
+ })]),
2194
+ a.value ? (v(), c("div", {
2195
+ key: 0,
2196
+ class: "comment-card__menu",
2197
+ onClick: r[2] ||= M(() => {}, ["stop"]),
2198
+ onMousedown: r[3] ||= M(() => {}, ["stop"])
2199
+ }, [l("button", {
2200
+ class: "comment-card__menu-item",
2201
+ onClick: u
2202
+ }, "Delete")], 32)) : s("", !0)
2203
+ ])) : s("", !0)
2204
+ ]),
2205
+ l("div", un, w(T(G)(e.comment.content)), 1),
2206
+ d(Xt, {
2207
+ replies: e.replies,
2208
+ "is-expanded": e.expanded
2209
+ }, null, 8, ["replies", "is-expanded"]),
2210
+ e.expanded && !e.comment.done ? (v(), o(en, {
2211
+ key: 1,
2212
+ onSubmit: r[4] ||= (t) => n.$emit("reply", e.comment.id, t)
2213
+ })) : s("", !0)
2214
+ ], 42, tn));
2215
+ }
2216
+ }), [["__scopeId", "data-v-b9e94a26"]]), fn = ["data-comment-id"], pn = /* @__PURE__ */ n(/* @__PURE__ */ f({
2217
+ __name: "ResolvedCommentMarker",
2218
+ props: { comment: {} },
2219
+ emits: ["toggle-expand"],
2220
+ setup(e) {
2221
+ return (n, r) => (v(), c("div", {
2222
+ class: "resolved-comment-marker",
2223
+ "data-comment-id": e.comment.id,
2224
+ "data-comment-resolved": "true",
2225
+ onClick: r[0] ||= (e) => n.$emit("toggle-expand"),
2226
+ onMousedown: r[1] ||= M(() => {}, ["stop"])
2227
+ }, [d(t, {
2228
+ name: "chat_bubble_check",
2229
+ size: 20
2230
+ })], 40, fn));
2231
+ }
2232
+ }), [["__scopeId", "data-v-c3b210c1"]]), mn = { class: "tc-card__head" }, hn = { class: "tc-card__author-block" }, gn = { class: "tc-card__author" }, _n = {
2233
+ key: 0,
2234
+ class: "tc-card__date"
2235
+ }, vn = {
2236
+ key: 0,
2237
+ class: "tc-card__actions"
2238
+ }, yn = ["title"], bn = ["title"], xn = { class: "tc-card__body" }, Sn = { class: "tc-card__deleted" }, Cn = { class: "tc-card__inserted" }, wn = { class: "tc-card__inserted" }, Tn = { class: "tc-card__deleted" }, En = { class: "tc-card__changed" }, Dn = {
2239
+ key: 4,
2240
+ class: "tc-card__inserted"
2241
+ }, On = {
2242
+ key: 5,
2243
+ class: "tc-card__deleted"
2244
+ }, kn = {
2245
+ key: 6,
2246
+ class: "tc-card__inserted"
2247
+ }, An = {
2248
+ key: 7,
2249
+ class: "tc-card__deleted"
2250
+ }, jn = {
2251
+ key: 8,
2252
+ class: "tc-card__changed"
2253
+ }, Mn = {
2254
+ key: 9,
2255
+ class: "tc-card__changed"
2256
+ }, Nn = {
2257
+ key: 10,
2258
+ class: "tc-card__changed"
2259
+ }, Pn = {
2260
+ key: 11,
2261
+ class: "tc-card__changed"
2262
+ }, Fn = {
2263
+ key: 12,
2264
+ class: "tc-card__inserted"
2265
+ }, In = {
2266
+ key: 13,
2267
+ class: "tc-card__deleted"
2268
+ }, Ln = /* @__PURE__ */ n(/* @__PURE__ */ f({
2269
+ __name: "TrackedChangeCard",
2270
+ props: {
2271
+ change: {},
2272
+ expanded: { type: Boolean }
2273
+ },
2274
+ emits: [
2275
+ "click",
2276
+ "accept-by-id",
2277
+ "reject-by-id",
2278
+ "reply"
2279
+ ],
2280
+ setup(n, { emit: r }) {
2281
+ let { t: f } = e(), p = n, h = r, g = a(() => p.change.author || f("trackedChanges.unknown"));
2282
+ function _() {
2283
+ let e = new Set([p.change.revisionId]);
2284
+ p.change.type === "replacement" && p.change.insertionRevisionId != null && e.add(p.change.insertionRevisionId);
2285
+ for (let t of p.change.coalescedRevisionIds ?? []) e.add(t);
2286
+ return [...e];
2287
+ }
2288
+ function y() {
2289
+ for (let e of _()) h("accept-by-id", e);
2290
+ }
2291
+ function b() {
2292
+ for (let e of _()) h("reject-by-id", e);
2293
+ }
2294
+ return (e, r) => (v(), c("div", {
2295
+ class: m(["tc-card", { "tc-card--expanded": n.expanded }]),
2296
+ onClick: r[1] ||= (t) => e.$emit("click"),
2297
+ onMousedown: r[2] ||= M(() => {}, ["stop"])
2298
+ }, [
2299
+ l("div", mn, [
2300
+ d(Ut, {
2301
+ name: g.value,
2302
+ size: 32
2303
+ }, null, 8, ["name"]),
2304
+ l("div", hn, [l("div", gn, w(g.value), 1), n.change.date ? (v(), c("div", _n, w(T(U)(n.change.date)), 1)) : s("", !0)]),
2305
+ n.expanded ? (v(), c("div", vn, [l("button", {
2306
+ class: "tc-card__icon-btn",
2307
+ title: T(f)("common.accept"),
2308
+ onClick: M(y, ["stop"])
2309
+ }, [d(t, {
2310
+ name: "check",
2311
+ size: 20
2312
+ })], 8, yn), l("button", {
2313
+ class: "tc-card__icon-btn",
2314
+ title: T(f)("common.reject"),
2315
+ onClick: M(b, ["stop"])
2316
+ }, [d(t, {
2317
+ name: "close",
2318
+ size: 20
2319
+ })], 8, bn)])) : s("", !0)
2320
+ ]),
2321
+ l("div", xn, [n.change.type === "replacement" ? (v(), c(i, { key: 0 }, [
2322
+ u(w(T(f)("trackedChanges.replaced")) + " ", 1),
2323
+ l("span", Sn, "\"" + w(T(q)(n.change.deletedText || "")) + "\"", 1),
2324
+ u(" " + w(T(f)("trackedChanges.with")) + " ", 1),
2325
+ l("span", Cn, "\"" + w(T(q)(n.change.text)) + "\"", 1)
2326
+ ], 64)) : n.change.type === "paragraphMarkInsertion" ? (v(), c(i, { key: 1 }, [u(w(T(f)("revisions.paragraphMarkInserted")), 1), n.change.text ? (v(), c(i, { key: 0 }, [r[3] ||= u(": ", -1), l("span", wn, "\"" + w(T(q)(n.change.text)) + "\"", 1)], 64)) : s("", !0)], 64)) : n.change.type === "paragraphMarkDeletion" ? (v(), c(i, { key: 2 }, [u(w(T(f)("revisions.paragraphMarkDeleted")), 1), n.change.text ? (v(), c(i, { key: 0 }, [r[4] ||= u(": ", -1), l("span", Tn, "\"" + w(T(q)(n.change.text)) + "\"", 1)], 64)) : s("", !0)], 64)) : n.change.type === "paragraphPropertiesChanged" ? (v(), c(i, { key: 3 }, [u(w(T(f)("revisions.paragraphPropertiesChanged")), 1), n.change.text ? (v(), c(i, { key: 0 }, [r[5] ||= u(": ", -1), l("span", En, "\"" + w(T(q)(n.change.text)) + "\"", 1)], 64)) : s("", !0)], 64)) : n.change.type === "rowInserted" ? (v(), c("span", Dn, w(T(f)("revisions.rowInserted")), 1)) : n.change.type === "rowDeleted" ? (v(), c("span", On, w(T(f)("revisions.rowDeleted")), 1)) : n.change.type === "cellInserted" ? (v(), c("span", kn, w(T(f)("revisions.cellInserted")), 1)) : n.change.type === "cellDeleted" ? (v(), c("span", An, w(T(f)("revisions.cellDeleted")), 1)) : n.change.type === "cellMerged" ? (v(), c("span", jn, w(T(f)("revisions.cellMerged")), 1)) : n.change.type === "rowPropertiesChanged" ? (v(), c("span", Mn, w(T(f)("revisions.rowPropertiesChanged")), 1)) : n.change.type === "cellPropertiesChanged" ? (v(), c("span", Nn, w(T(f)("revisions.cellPropertiesChanged")), 1)) : n.change.type === "tablePropertiesChanged" ? (v(), c("span", Pn, w(T(f)("revisions.tablePropertiesChanged")), 1)) : n.change.type === "tableInserted" ? (v(), c("span", Fn, w(T(f)("revisions.tableInserted")), 1)) : n.change.type === "tableDeleted" ? (v(), c("span", In, w(T(f)("revisions.tableDeleted")), 1)) : (v(), c(i, { key: 14 }, [u(w(n.change.type === "insertion" ? T(f)("trackedChanges.added") : T(f)("trackedChanges.deleted")) + " ", 1), l("span", { class: m(n.change.type === "insertion" ? "tc-card__inserted" : "tc-card__deleted") }, " \"" + w(T(q)(n.change.text)) + "\" ", 3)], 64))]),
2327
+ n.expanded ? (v(), o(en, {
2328
+ key: 0,
2329
+ onSubmit: r[0] ||= (t) => e.$emit("reply", n.change.revisionId, t)
2330
+ })) : s("", !0)
2331
+ ], 34));
2332
+ }
2333
+ }), [["__scopeId", "data-v-317869c0"]]), Rn = ["onKeydown"], zn = { class: "add-comment-card__actions" }, Bn = ["disabled"], Vn = /* @__PURE__ */ n(/* @__PURE__ */ f({
2334
+ __name: "AddCommentCard",
2335
+ emits: ["submit", "cancel"],
2336
+ setup(e, { emit: t }) {
2337
+ let n = t, r = b(""), i = b(null), o = a(() => r.value.trim());
2338
+ _(() => {
2339
+ i.value?.focus({ preventScroll: !0 });
2340
+ });
2341
+ function s() {
2342
+ o.value && (n("submit", o.value), r.value = "");
2343
+ }
2344
+ function u() {
2345
+ n("cancel"), r.value = "";
2346
+ }
2347
+ return (e, t) => (v(), c("div", {
2348
+ class: "add-comment-card",
2349
+ onMousedown: t[3] ||= M(() => {}, ["stop"])
2350
+ }, [A(l("textarea", {
2351
+ ref_key: "inputRef",
2352
+ ref: i,
2353
+ "onUpdate:modelValue": t[0] ||= (e) => r.value = e,
2354
+ class: "add-comment-card__field",
2355
+ placeholder: "Add a comment",
2356
+ onMousedown: t[1] ||= M(() => {}, ["stop"]),
2357
+ onKeydown: [
2358
+ t[2] ||= M(() => {}, ["stop"]),
2359
+ j(M(s, ["exact", "prevent"]), ["enter"]),
2360
+ j(u, ["esc"])
2361
+ ]
2362
+ }, null, 40, Rn), [[D, r.value]]), l("div", zn, [l("button", {
2363
+ class: "add-comment-card__cancel",
2364
+ onClick: u
2365
+ }, "Cancel"), l("button", {
2366
+ class: m(["add-comment-card__submit", { "add-comment-card__submit--active": o.value }]),
2367
+ disabled: !o.value,
2368
+ onClick: s
2369
+ }, "Comment", 10, Bn)])], 32));
2370
+ }
2371
+ }), [["__scopeId", "data-v-cc70979b"]]), Hn = J, Un = ["data-card-id"], Wn = 16, Gn = 300, Kn = /* @__PURE__ */ n(/* @__PURE__ */ f({
2372
+ __name: "UnifiedSidebar",
2373
+ props: {
2374
+ isOpen: { type: Boolean },
2375
+ comments: {},
2376
+ trackedChanges: {},
2377
+ isAddingComment: { type: Boolean },
2378
+ showResolved: { type: Boolean },
2379
+ pagesContainer: {},
2380
+ pageWidthPx: {},
2381
+ zoom: {},
2382
+ activeItemId: {},
2383
+ addCommentYPosition: {}
2384
+ },
2385
+ emits: [
2386
+ "close",
2387
+ "add-comment",
2388
+ "cancel-add-comment",
2389
+ "comment-reply",
2390
+ "comment-resolve",
2391
+ "comment-unresolve",
2392
+ "comment-delete",
2393
+ "accept-change",
2394
+ "reject-change",
2395
+ "accept-change-by-id",
2396
+ "reject-change-by-id",
2397
+ "tracked-change-reply",
2398
+ "update:activeItemId"
2399
+ ],
2400
+ setup(e, { emit: t }) {
2401
+ let n = e, d = t, f = b(null), p = a(() => n.activeItemId === void 0 ? f.value : n.activeItemId);
2402
+ function m(e) {
2403
+ let t = p.value === e ? null : e;
2404
+ f.value = t, d("update:activeItemId", t);
2405
+ }
2406
+ let y = r({
2407
+ comments: a(() => n.comments),
2408
+ trackedChanges: a(() => n.trackedChanges),
2409
+ showResolved: a(() => n.showResolved ?? !1),
2410
+ isAddingComment: a(() => n.isAddingComment ?? !1),
2411
+ addCommentYPosition: a(() => n.addCommentYPosition ?? null)
2412
+ }), S = b(null), E = b(/* @__PURE__ */ new Map()), D = /* @__PURE__ */ new Map(), A = null;
2413
+ function j() {
2414
+ let e = n.pagesContainer, t = y.value;
2415
+ if (!e || t.length === 0) {
2416
+ E.value = /* @__PURE__ */ new Map();
2417
+ return;
2418
+ }
2419
+ let r = e.getBoundingClientRect(), i = /* @__PURE__ */ new Map();
2420
+ for (let t of e.querySelectorAll("[data-comment-id]")) {
2421
+ let e = t.dataset.commentId;
2422
+ e && !i.has(e) && i.set(e, t);
2423
+ }
2424
+ let a = /* @__PURE__ */ new Map();
2425
+ for (let t of e.querySelectorAll(".docx-insertion[data-revision-id]")) {
2426
+ let e = t.dataset.revisionId;
2427
+ e && !a.has(e) && a.set(e, t);
2428
+ }
2429
+ let o = /* @__PURE__ */ new Map();
2430
+ for (let t of e.querySelectorAll(".docx-deletion[data-revision-id]")) {
2431
+ let e = t.dataset.revisionId;
2432
+ e && !o.has(e) && o.set(e, t);
2433
+ }
2434
+ for (let t of e.querySelectorAll(".ep-revision-table[data-revision-id], .ep-revision-row[data-revision-id], .ep-revision-cell[data-revision-id], .layout-revision-pmark[data-revision-id]")) {
2435
+ let e = t.dataset.revisionId;
2436
+ if (!e) continue;
2437
+ let n = t.classList.contains("ep-revision-ins") || t.classList.contains("layout-revision-ins") ? a : o;
2438
+ n.has(e) || n.set(e, t);
2439
+ }
2440
+ let s = /* @__PURE__ */ new Map(), c = (t) => t.getBoundingClientRect().top - r.top + e.scrollTop;
2441
+ for (let e of t) {
2442
+ if (!e.anchorKey) continue;
2443
+ let t;
2444
+ if (e.kind === "comment") t = i.get(String(e.comment.id));
2445
+ else if (e.kind === "tracked-change") {
2446
+ let n = e.change;
2447
+ t = n.type === "deletion" ? o.get(String(n.revisionId)) : a.get(String(n.insertionRevisionId ?? n.revisionId));
2448
+ }
2449
+ t && s.set(e.anchorKey, c(t));
2450
+ }
2451
+ let l = /* @__PURE__ */ new Map(), u = S.value;
2452
+ if (u) for (let e of u.querySelectorAll("[data-card-id]")) {
2453
+ let t = e.dataset.cardId;
2454
+ t && l.set(t, e.offsetHeight);
2455
+ }
2456
+ let d = /* @__PURE__ */ new Map();
2457
+ for (let { item: e, y: n } of Hn(t, s, null, 1, l, D)) d.set(e.id, n);
2458
+ E.value = d;
2459
+ }
2460
+ let N = a(() => {
2461
+ let e = 0;
2462
+ for (let t of E.value.values()) e = Math.max(e, t);
2463
+ return e + 200;
2464
+ }), P = a(() => {
2465
+ let e = p.value;
2466
+ if (!e) return "";
2467
+ if (e.startsWith("comment-")) return `.paged-editor__pages [data-comment-id="${e.slice(8)}"] { background-color: rgba(255, 212, 0, 0.35) !important; border-bottom: 2px solid rgba(255, 212, 0, 0.7) !important; }`;
2468
+ if (e.startsWith("tc-")) {
2469
+ let t = e.split("-")[1];
2470
+ return `
2471
+ .paged-editor__pages .docx-insertion[data-revision-id="${y.value.find((t) => t.id === e)?.change?.insertionRevisionId ?? Number(t)}"] { background-color: rgba(52, 168, 83, 0.2) !important; border-bottom: 2px solid #2e7d32 !important; }
2472
+ .paged-editor__pages .docx-deletion[data-revision-id="${t}"] { background-color: rgba(211, 47, 47, 0.2) !important; text-decoration-thickness: 2px !important; }
2473
+ `;
2474
+ }
2475
+ return "";
2476
+ }), F = a(() => {
2477
+ let e = n.pageWidthPx / 2 + Wn - ee, t = E.value.size > 0 || y.value.length === 0;
2478
+ return {
2479
+ position: "absolute",
2480
+ top: "0",
2481
+ left: `calc(50% + ${e}px)`,
2482
+ width: Gn + "px",
2483
+ opacity: +!!t
2484
+ };
2485
+ });
2486
+ function I(e) {
2487
+ let t = E.value.get(e);
2488
+ return t == null ? {
2489
+ position: "static",
2490
+ marginBottom: "8px"
2491
+ } : {
2492
+ position: "absolute",
2493
+ top: t + "px",
2494
+ left: 0,
2495
+ right: 0,
2496
+ transition: "top 0.15s ease"
2497
+ };
2498
+ }
2499
+ let L = !1;
2500
+ function R() {
2501
+ L || (L = !0, requestAnimationFrame(() => {
2502
+ L = !1, j();
2503
+ }));
2504
+ }
2505
+ O(() => [
2506
+ y.value.length,
2507
+ p.value,
2508
+ n.pagesContainer,
2509
+ n.pageWidthPx,
2510
+ n.zoom,
2511
+ n.isAddingComment,
2512
+ n.addCommentYPosition
2513
+ ], () => R(), { immediate: !0 });
2514
+ function z(e) {
2515
+ let t = e?.parentElement ?? null;
2516
+ for (; t;) {
2517
+ let e = getComputedStyle(t).overflowY;
2518
+ if (e === "auto" || e === "scroll") return t;
2519
+ t = t.parentElement;
2520
+ }
2521
+ return null;
2522
+ }
2523
+ let B = null;
2524
+ function V() {
2525
+ B && B.removeEventListener("scroll", R), B = z(n.pagesContainer), B && B.addEventListener("scroll", R, { passive: !0 });
2526
+ }
2527
+ return _(() => {
2528
+ R(), n.pagesContainer && (A = new ResizeObserver(() => R()), A.observe(n.pagesContainer), V());
2529
+ }), O(() => n.pagesContainer, (e, t) => {
2530
+ A?.disconnect(), A = null, e && (A = new ResizeObserver(() => R()), A.observe(e), V());
2531
+ }), g(() => {
2532
+ A?.disconnect(), B && B.removeEventListener("scroll", R);
2533
+ }), (t, n) => (v(), c(i, null, [P.value ? (v(), o(C("style"), { key: 0 }, {
2534
+ default: k(() => [u(w(P.value), 1)]),
2535
+ _: 1
2536
+ })) : s("", !0), e.isOpen ? (v(), c("aside", {
2537
+ key: 1,
2538
+ ref_key: "rootRef",
2539
+ ref: S,
2540
+ class: "unified-sidebar",
2541
+ style: h(F.value),
2542
+ onMousedown: n[11] ||= M(() => {}, ["stop"])
2543
+ }, [l("div", {
2544
+ class: "unified-sidebar__inner",
2545
+ style: h({ minHeight: N.value + "px" })
2546
+ }, [(v(!0), c(i, null, x(T(y), (e) => (v(), c("div", {
2547
+ key: e.id,
2548
+ class: "unified-sidebar__card-slot",
2549
+ "data-card-id": e.id,
2550
+ style: h(I(e.id))
2551
+ }, [e.kind === "add-comment" ? (v(), o(Vn, {
2552
+ key: 0,
2553
+ onSubmit: n[0] ||= (e) => t.$emit("add-comment", e),
2554
+ onCancel: n[1] ||= (e) => t.$emit("cancel-add-comment")
2555
+ })) : e.kind === "comment" && e.comment.done && p.value !== e.id ? (v(), o(pn, {
2556
+ key: 1,
2557
+ comment: e.comment,
2558
+ onToggleExpand: (t) => m(e.id)
2559
+ }, null, 8, ["comment", "onToggleExpand"])) : e.kind === "comment" ? (v(), o(dn, {
2560
+ key: 2,
2561
+ comment: e.comment,
2562
+ replies: e.replies,
2563
+ expanded: p.value === e.id,
2564
+ onClick: (t) => m(e.id),
2565
+ onReply: n[2] ||= (e, n) => t.$emit("comment-reply", e, n),
2566
+ onResolve: n[3] ||= (e) => t.$emit("comment-resolve", e),
2567
+ onUnresolve: n[4] ||= (e) => t.$emit("comment-unresolve", e),
2568
+ onDelete: n[5] ||= (e) => t.$emit("comment-delete", e)
2569
+ }, null, 8, [
2570
+ "comment",
2571
+ "replies",
2572
+ "expanded",
2573
+ "onClick"
2574
+ ])) : e.kind === "tracked-change" ? (v(), o(Ln, {
2575
+ key: 3,
2576
+ change: e.change,
2577
+ expanded: p.value === e.id,
2578
+ onClick: (t) => m(e.id),
2579
+ onAccept: n[6] ||= (e, n) => t.$emit("accept-change", e, n),
2580
+ onReject: n[7] ||= (e, n) => t.$emit("reject-change", e, n),
2581
+ onAcceptById: n[8] ||= (e) => t.$emit("accept-change-by-id", e),
2582
+ onRejectById: n[9] ||= (e) => t.$emit("reject-change-by-id", e),
2583
+ onReply: n[10] ||= (e, n) => t.$emit("tracked-change-reply", e, n)
2584
+ }, null, 8, [
2585
+ "change",
2586
+ "expanded",
2587
+ "onClick"
2588
+ ])) : s("", !0)], 12, Un))), 128))], 4)], 36)) : s("", !0)], 64));
2589
+ }
2590
+ }), [["__scopeId", "data-v-1d084620"]]), qn = ["title", "onClick"], Jn = /* @__PURE__ */ n(/* @__PURE__ */ f({
2591
+ __name: "CommentMarginMarkers",
2592
+ props: {
2593
+ comments: {},
2594
+ pagesContainer: {},
2595
+ zoom: {},
2596
+ pageWidthPx: {},
2597
+ sidebarOpen: { type: Boolean },
2598
+ resolvedCommentIds: {}
2599
+ },
2600
+ emits: ["marker-click"],
2601
+ setup(e) {
2602
+ let n = e, r = a(() => {
2603
+ if (n.sidebarOpen) return [];
2604
+ let e = n.pagesContainer;
2605
+ if (!e) return [];
2606
+ let t = e.getBoundingClientRect(), r = /* @__PURE__ */ new Map();
2607
+ for (let t of e.querySelectorAll("[data-comment-id]")) {
2608
+ let e = t.dataset.commentId;
2609
+ e && !r.has(e) && r.set(e, t);
2610
+ }
2611
+ let i = [];
2612
+ for (let a of n.comments) {
2613
+ if (a.parentId != null) continue;
2614
+ let o = r.get(String(a.id));
2615
+ if (!o) continue;
2616
+ let s = o.getBoundingClientRect();
2617
+ i.push({
2618
+ comment: a,
2619
+ isResolved: n.resolvedCommentIds.has(a.id),
2620
+ y: (s.top - t.top + e.scrollTop) / n.zoom
2621
+ });
2622
+ }
2623
+ return i;
2624
+ }), o = a(() => ({
2625
+ position: "absolute",
2626
+ top: 0,
2627
+ left: `calc(50% + ${n.pageWidthPx / n.zoom / 2 + 6}px)`,
2628
+ zIndex: 30,
2629
+ pointerEvents: "none"
2630
+ }));
2631
+ return (n, a) => r.value.length > 0 ? (v(), c("div", {
2632
+ key: 0,
2633
+ class: "docx-comment-margin-markers",
2634
+ style: h(o.value),
2635
+ onMousedown: a[0] ||= M(() => {}, ["stop"])
2636
+ }, [(v(!0), c(i, null, x(r.value, (r) => (v(), c("button", {
2637
+ key: r.comment.id,
2638
+ class: "docx-comment-margin-markers__btn",
2639
+ title: r.isResolved ? "Resolved comment" : "Comment",
2640
+ style: h({ top: r.y * e.zoom + "px" }),
2641
+ onClick: (e) => n.$emit("marker-click", r.comment.id)
2642
+ }, [d(t, {
2643
+ name: r.isResolved ? "chat_bubble_check" : "chat_bubble_outline",
2644
+ size: 18
2645
+ }, null, 8, ["name"])], 12, qn))), 128))], 36)) : s("", !0);
2646
+ }
2647
+ }), [["__scopeId", "data-v-a20c82d9"]]), Yn = ["aria-valuemax"], Xn = { class: "docx-horizontal-ruler__ticks" }, Zn = ["title", "onDblclick"], Qn = 12240, $n = 1440, er = 1440, tr = 567, nr = 22, rr = "#4285f4", ir = "#3367d6", ar = "#2a56c6", $ = 5, or = /* @__PURE__ */ n(/* @__PURE__ */ f({
2648
+ __name: "HorizontalRuler",
2649
+ props: {
2650
+ sectionProps: {},
2651
+ zoom: { default: 1 },
2652
+ editable: {
2653
+ type: Boolean,
2654
+ default: !0
2655
+ },
2656
+ showFirstLineIndent: {
2657
+ type: Boolean,
2658
+ default: !1
2659
+ },
2660
+ firstLineIndent: { default: 0 },
2661
+ hangingIndent: {
2662
+ type: Boolean,
2663
+ default: !1
2664
+ },
2665
+ indentLeft: { default: 0 },
2666
+ indentRight: { default: 0 },
2667
+ unit: { default: "inch" },
2668
+ tabStops: {}
2669
+ },
2670
+ emits: [
2671
+ "left-margin-change",
2672
+ "right-margin-change",
2673
+ "first-line-indent-change",
2674
+ "indent-left-change",
2675
+ "indent-right-change",
2676
+ "tab-stop-remove"
2677
+ ],
2678
+ setup(e, { emit: t }) {
2679
+ let n = e, r = t, o = Math.round($ * 1.6), u = b(null), d = b(null), f = b(null), p = b(0), m = b("");
2680
+ function _(e) {
2681
+ return Y(e) * n.zoom;
2682
+ }
2683
+ function y(e) {
2684
+ return Math.round(te(e / n.zoom));
2685
+ }
2686
+ let S = a(() => n.sectionProps?.pageWidth ?? Qn), C = a(() => n.sectionProps?.marginLeft ?? $n), T = a(() => n.sectionProps?.marginRight ?? $n), E = a(() => S.value - C.value - T.value), D = a(() => _(S.value)), O = a(() => _(C.value)), k = a(() => _(T.value)), A = a(() => _(n.indentLeft)), j = a(() => _(n.indentRight)), N = a(() => n.hangingIndent ? -n.firstLineIndent : n.firstLineIndent), P = a(() => _(N.value)), F = a(() => O.value + A.value), I = a(() => D.value - k.value - j.value), L = a(() => O.value + A.value + P.value), R = a(() => ({
2687
+ position: "relative",
2688
+ width: D.value + "px",
2689
+ height: nr + "px",
2690
+ backgroundColor: "transparent",
2691
+ overflow: "visible",
2692
+ userSelect: "none",
2693
+ cursor: d.value ? "ew-resize" : "default"
2694
+ })), z = a(() => ({
2695
+ position: "absolute",
2696
+ top: 0,
2697
+ left: 0,
2698
+ width: O.value + "px",
2699
+ height: nr + "px",
2700
+ backgroundColor: "rgba(0, 0, 0, 0.02)",
2701
+ borderRight: "1px solid rgba(0,0,0,0.06)",
2702
+ cursor: n.editable ? "ew-resize" : "default",
2703
+ zIndex: 1
2704
+ })), B = a(() => ({
2705
+ position: "absolute",
2706
+ top: 0,
2707
+ right: 0,
2708
+ width: k.value + "px",
2709
+ height: nr + "px",
2710
+ backgroundColor: "rgba(0, 0, 0, 0.02)",
2711
+ borderLeft: "1px solid rgba(0,0,0,0.06)",
2712
+ cursor: n.editable ? "ew-resize" : "default",
2713
+ zIndex: 1
2714
+ })), V = a(() => {
2715
+ let e = [];
2716
+ if (n.unit === "inch") {
2717
+ let t = er / 8, n = Math.ceil(S.value / t);
2718
+ for (let r = 0; r <= n; r++) {
2719
+ let n = r * t;
2720
+ if (n > S.value) break;
2721
+ let i = _(n);
2722
+ r % 8 == 0 ? e.push({
2723
+ position: i,
2724
+ height: 10,
2725
+ label: r / 8 > 0 ? String(r / 8) : void 0
2726
+ }) : r % 4 == 0 ? e.push({
2727
+ position: i,
2728
+ height: 6
2729
+ }) : r % 2 == 0 ? e.push({
2730
+ position: i,
2731
+ height: 4
2732
+ }) : e.push({
2733
+ position: i,
2734
+ height: 2
2735
+ });
2736
+ }
2737
+ } else {
2738
+ let t = tr / 10, n = Math.ceil(S.value / t);
2739
+ for (let r = 0; r <= n; r++) {
2740
+ let n = r * t;
2741
+ if (n > S.value) break;
2742
+ let i = _(n);
2743
+ r % 10 == 0 ? e.push({
2744
+ position: i,
2745
+ height: 10,
2746
+ label: r / 10 > 0 ? String(r / 10) : void 0
2747
+ }) : r % 5 == 0 ? e.push({
2748
+ position: i,
2749
+ height: 6
2750
+ }) : e.push({
2751
+ position: i,
2752
+ height: 3
2753
+ });
2754
+ }
2755
+ }
2756
+ return e;
2757
+ }), H = a(() => n.tabStops?.length ? n.tabStops.map((e) => {
2758
+ let t = e.position ?? e.pos ?? 0;
2759
+ return {
2760
+ px: _(t),
2761
+ twips: t,
2762
+ label: U(t)
2763
+ };
2764
+ }) : []);
2765
+ function U(e) {
2766
+ return n.unit === "cm" ? (e / tr).toFixed(1) + " cm" : (e / er).toFixed(2) + "\"";
2767
+ }
2768
+ function W(e) {
2769
+ return d.value === e ? ar : f.value === e ? ir : rr;
2770
+ }
2771
+ function G(e, t, r) {
2772
+ return {
2773
+ position: "absolute",
2774
+ left: t - $ + "px",
2775
+ width: $ * 2 + "px",
2776
+ height: o + 2 + "px",
2777
+ cursor: n.editable ? "ew-resize" : "default",
2778
+ zIndex: r ? 10 : 4,
2779
+ ...e === "down" ? { top: 0 } : { bottom: 0 }
2780
+ };
2781
+ }
2782
+ function K(e, t) {
2783
+ return e === "down" ? {
2784
+ position: "absolute",
2785
+ top: "1px",
2786
+ left: 0,
2787
+ width: 0,
2788
+ height: 0,
2789
+ borderLeft: `${$}px solid transparent`,
2790
+ borderRight: `${$}px solid transparent`,
2791
+ borderTop: `${o}px solid ${t}`,
2792
+ transition: "border-top-color 0.1s"
2793
+ } : {
2794
+ position: "absolute",
2795
+ bottom: "1px",
2796
+ left: 0,
2797
+ width: 0,
2798
+ height: 0,
2799
+ borderLeft: `${$}px solid transparent`,
2800
+ borderRight: `${$}px solid transparent`,
2801
+ borderBottom: `${o}px solid ${t}`,
2802
+ transition: "border-bottom-color 0.1s"
2803
+ };
2804
+ }
2805
+ let q = 0;
2806
+ function J(e, t) {
2807
+ n.editable && (d.value = e, t.clientX, e === "leftMargin" ? q = C.value : e === "rightMargin" ? q = T.value : e === "leftIndent" ? q = n.indentLeft : e === "rightIndent" ? q = n.indentRight : e === "firstLineIndent" && (q = n.firstLineIndent), p.value = t.clientX - (u.value?.getBoundingClientRect().left ?? 0), m.value = U(q), document.addEventListener("mousemove", ee), document.addEventListener("mouseup", X));
2808
+ }
2809
+ function ee(e) {
2810
+ if (!d.value || !u.value) return;
2811
+ let t = u.value.getBoundingClientRect();
2812
+ if (!t) return;
2813
+ let n = e.clientX - t.left;
2814
+ p.value = n;
2815
+ let r = y(n), i = ne(d.value, r);
2816
+ m.value = U(i), Z(d.value, i);
2817
+ }
2818
+ function X(e) {
2819
+ d.value = null, document.removeEventListener("mousemove", ee), document.removeEventListener("mouseup", X);
2820
+ }
2821
+ function ne(e, t) {
2822
+ if (e === "leftMargin") {
2823
+ let e = S.value - T.value - 720;
2824
+ return Math.round(Math.max(0, Math.min(t, e)));
2825
+ }
2826
+ if (e === "rightMargin") {
2827
+ let e = S.value - t, n = S.value - C.value - 720;
2828
+ return Math.round(Math.max(0, Math.min(e, n)));
2829
+ }
2830
+ if (e === "firstLineIndent") {
2831
+ let e = t - (C.value + n.indentLeft), r = E.value - n.indentLeft - n.indentRight - 720;
2832
+ return Math.round(Math.max(-n.indentLeft, Math.min(e, r)));
2833
+ }
2834
+ if (e === "leftIndent") {
2835
+ let e = t - C.value, r = E.value - n.indentRight - 720;
2836
+ return Math.round(Math.max(0, Math.min(e, r)));
2837
+ }
2838
+ let r = S.value - T.value - t, i = E.value - n.indentLeft - 720;
2839
+ return Math.round(Math.max(0, Math.min(r, i)));
2840
+ }
2841
+ function Z(e, t) {
2842
+ switch (e) {
2843
+ case "leftMargin":
2844
+ r("left-margin-change", t);
2845
+ break;
2846
+ case "rightMargin":
2847
+ r("right-margin-change", t);
2848
+ break;
2849
+ case "firstLineIndent":
2850
+ r("first-line-indent-change", t);
2851
+ break;
2852
+ case "leftIndent":
2853
+ r("indent-left-change", t);
2854
+ break;
2855
+ case "rightIndent":
2856
+ r("indent-right-change", t);
2857
+ break;
2858
+ }
2859
+ }
2860
+ return g(() => {
2861
+ document.removeEventListener("mousemove", ee), document.removeEventListener("mouseup", X);
2862
+ }), (t, n) => (v(), c("div", {
2863
+ ref_key: "rulerRef",
2864
+ ref: u,
2865
+ class: "docx-horizontal-ruler",
2866
+ style: h(R.value),
2867
+ role: "slider",
2868
+ "aria-label": "Horizontal ruler",
2869
+ "aria-valuemin": 0,
2870
+ "aria-valuemax": S.value
2871
+ }, [
2872
+ l("div", {
2873
+ class: "docx-horizontal-ruler__margin",
2874
+ style: h(z.value),
2875
+ onMousedown: n[0] ||= M((t) => e.editable ? J("leftMargin", t) : null, ["prevent", "stop"])
2876
+ }, null, 36),
2877
+ l("div", {
2878
+ class: "docx-horizontal-ruler__margin",
2879
+ style: h(B.value),
2880
+ onMousedown: n[1] ||= M((t) => e.editable ? J("rightMargin", t) : null, ["prevent", "stop"])
2881
+ }, null, 36),
2882
+ l("div", Xn, [(v(!0), c(i, null, x(V.value, (e, t) => (v(), c(i, { key: t }, [l("div", {
2883
+ class: "docx-horizontal-ruler__tick-line",
2884
+ style: h({
2885
+ left: e.position + "px",
2886
+ height: e.height + "px"
2887
+ })
2888
+ }, null, 4), e.label ? (v(), c("div", {
2889
+ key: 0,
2890
+ class: "docx-horizontal-ruler__tick-label",
2891
+ style: h({ left: e.position + "px" })
2892
+ }, w(e.label), 5)) : s("", !0)], 64))), 128))]),
2893
+ e.showFirstLineIndent ? (v(), c("div", {
2894
+ key: 0,
2895
+ class: "docx-ruler-indent",
2896
+ style: h(G("down", L.value, d.value === "firstLineIndent")),
2897
+ onMousedown: n[2] ||= M((t) => e.editable ? J("firstLineIndent", t) : null, ["prevent", "stop"]),
2898
+ onMouseenter: n[3] ||= (e) => f.value = "firstLineIndent",
2899
+ onMouseleave: n[4] ||= (e) => f.value = null
2900
+ }, [l("div", { style: h(K("down", W("firstLineIndent"))) }, null, 4)], 36)) : s("", !0),
2901
+ e.editable ? (v(), c("div", {
2902
+ key: 1,
2903
+ class: "docx-ruler-indent",
2904
+ style: h(G("up", F.value, d.value === "leftIndent")),
2905
+ onMousedown: n[5] ||= M((e) => J("leftIndent", e), ["prevent", "stop"]),
2906
+ onMouseenter: n[6] ||= (e) => f.value = "leftIndent",
2907
+ onMouseleave: n[7] ||= (e) => f.value = null
2908
+ }, [l("div", { style: h(K("up", W("leftIndent"))) }, null, 4)], 36)) : s("", !0),
2909
+ e.editable ? (v(), c("div", {
2910
+ key: 2,
2911
+ class: "docx-ruler-indent",
2912
+ style: h(G("down", I.value, d.value === "rightIndent")),
2913
+ onMousedown: n[8] ||= M((e) => J("rightIndent", e), ["prevent", "stop"]),
2914
+ onMouseenter: n[9] ||= (e) => f.value = "rightIndent",
2915
+ onMouseleave: n[10] ||= (e) => f.value = null
2916
+ }, [l("div", { style: h(K("down", W("rightIndent"))) }, null, 4)], 36)) : s("", !0),
2917
+ (v(!0), c(i, null, x(H.value, (e, n) => (v(), c("div", {
2918
+ key: n,
2919
+ class: "docx-horizontal-ruler__tab",
2920
+ style: h({ left: e.px + "px" }),
2921
+ title: `${e.label}`,
2922
+ onDblclick: M((n) => t.$emit("tab-stop-remove", e.twips), ["prevent"])
2923
+ }, "L", 44, Zn))), 128)),
2924
+ d.value && m.value ? (v(), c("div", {
2925
+ key: 3,
2926
+ class: "docx-horizontal-ruler__tooltip",
2927
+ style: h({ left: p.value + "px" })
2928
+ }, w(m.value), 5)) : s("", !0)
2929
+ ], 12, Yn));
2930
+ }
2931
+ }), [["__scopeId", "data-v-5644874e"]]), sr = { class: "docx-vertical-ruler__ticks" }, cr = 15840, lr = 1440, ur = 1440, dr = 567, fr = 20, pr = /* @__PURE__ */ n(/* @__PURE__ */ f({
2932
+ __name: "VerticalRuler",
2933
+ props: {
2934
+ sectionProps: {},
2935
+ zoom: { default: 1 },
2936
+ editable: {
2937
+ type: Boolean,
2938
+ default: !0
2939
+ },
2940
+ unit: { default: "inch" }
2941
+ },
2942
+ emits: ["top-margin-change", "bottom-margin-change"],
2943
+ setup(e, { emit: t }) {
2944
+ let n = e, r = t, o = b(null), u = b(null), d = b(null);
2945
+ function f(e) {
2946
+ return Y(e) * n.zoom;
2947
+ }
2948
+ function p(e) {
2949
+ return Math.round(te(e / n.zoom));
2950
+ }
2951
+ let m = a(() => n.sectionProps?.pageHeight ?? cr), _ = a(() => n.sectionProps?.marginTop ?? lr), y = a(() => n.sectionProps?.marginBottom ?? lr), S = a(() => f(m.value)), C = a(() => f(_.value)), T = a(() => f(y.value)), E = a(() => ({
2952
+ position: "relative",
2953
+ width: fr + "px",
2954
+ height: S.value + "px",
2955
+ backgroundColor: "transparent",
2956
+ overflow: "visible",
2957
+ userSelect: "none",
2958
+ cursor: u.value ? "ns-resize" : "default"
2959
+ })), D = a(() => {
2960
+ let e = [];
2961
+ if (n.unit === "inch") {
2962
+ let t = ur / 8, n = Math.ceil(m.value / t);
2963
+ for (let r = 0; r <= n; r++) {
2964
+ let n = r * t;
2965
+ if (n > m.value) break;
2966
+ let i = f(n);
2967
+ r % 8 == 0 ? e.push({
2968
+ position: i,
2969
+ width: 10,
2970
+ label: r / 8 > 0 ? String(r / 8) : void 0
2971
+ }) : r % 4 == 0 ? e.push({
2972
+ position: i,
2973
+ width: 6
2974
+ }) : r % 2 == 0 ? e.push({
2975
+ position: i,
2976
+ width: 4
2977
+ }) : e.push({
2978
+ position: i,
2979
+ width: 2
2980
+ });
2981
+ }
2982
+ } else {
2983
+ let t = dr / 10, n = Math.ceil(m.value / t);
2984
+ for (let r = 0; r <= n; r++) {
2985
+ let n = r * t;
2986
+ if (n > m.value) break;
2987
+ let i = f(n);
2988
+ r % 10 == 0 ? e.push({
2989
+ position: i,
2990
+ width: 10,
2991
+ label: r / 10 > 0 ? String(r / 10) : void 0
2992
+ }) : r % 5 == 0 ? e.push({
2993
+ position: i,
2994
+ width: 6
2995
+ }) : e.push({
2996
+ position: i,
2997
+ width: 3
2998
+ });
2999
+ }
3000
+ }
3001
+ return e;
3002
+ });
3003
+ function O(e) {
3004
+ return {
3005
+ position: "absolute",
3006
+ top: e - 5 + "px",
3007
+ right: 0,
3008
+ width: fr + "px",
3009
+ height: "10px",
3010
+ cursor: n.editable ? "ns-resize" : "default",
3011
+ zIndex: u.value === null ? 1 : 10
3012
+ };
3013
+ }
3014
+ function k(e) {
3015
+ let t = u.value === e;
3016
+ return d.value, {
3017
+ position: "absolute",
3018
+ top: "0px",
3019
+ right: "2px",
3020
+ width: "0",
3021
+ height: "0",
3022
+ borderTop: "5px solid transparent",
3023
+ borderBottom: "5px solid transparent",
3024
+ borderRight: `8px solid ${t ? "var(--doc-primary-hover, #1557b0)" : "var(--doc-primary, #1a73e8)"}`,
3025
+ transition: "border-right-color 0.1s"
3026
+ };
3027
+ }
3028
+ let A = 0, j = 0;
3029
+ function N(e, t) {
3030
+ n.editable && (u.value = e, A = t.clientY, j = e === "topMargin" ? _.value : y.value, document.addEventListener("mousemove", P), document.addEventListener("mouseup", F));
3031
+ }
3032
+ function P(e) {
3033
+ if (!u.value) return;
3034
+ let t = e.clientY - A, n = p(u.value === "topMargin" ? t : -t), i = m.value - (u.value === "topMargin" ? y.value : _.value) - 720, a = Math.round(Math.max(0, Math.min(j + n, i)));
3035
+ u.value === "topMargin" ? r("top-margin-change", a) : r("bottom-margin-change", a);
3036
+ }
3037
+ function F() {
3038
+ u.value = null, document.removeEventListener("mousemove", P), document.removeEventListener("mouseup", F);
3039
+ }
3040
+ return g(() => {
3041
+ document.removeEventListener("mousemove", P), document.removeEventListener("mouseup", F);
3042
+ }), (t, n) => (v(), c("div", {
3043
+ ref_key: "rulerRef",
3044
+ ref: o,
3045
+ class: "docx-vertical-ruler",
3046
+ style: h(E.value),
3047
+ role: "slider",
3048
+ "aria-label": "Vertical ruler",
3049
+ "aria-orientation": "vertical"
3050
+ }, [
3051
+ l("div", sr, [(v(!0), c(i, null, x(D.value, (e, t) => (v(), c(i, { key: t }, [l("div", {
3052
+ class: "docx-vertical-ruler__tick-line",
3053
+ style: h({
3054
+ top: e.position + "px",
3055
+ width: e.width + "px"
3056
+ })
3057
+ }, null, 4), e.label ? (v(), c("div", {
3058
+ key: 0,
3059
+ class: "docx-vertical-ruler__tick-label",
3060
+ style: h({ top: e.position + "px" })
3061
+ }, w(e.label), 5)) : s("", !0)], 64))), 128))]),
3062
+ e.editable ? (v(), c("div", {
3063
+ key: 0,
3064
+ class: "docx-vertical-ruler__marker",
3065
+ style: h(O(C.value)),
3066
+ onMousedown: n[0] ||= M((e) => N("topMargin", e), ["prevent"]),
3067
+ onMouseenter: n[1] ||= (e) => d.value = "topMargin",
3068
+ onMouseleave: n[2] ||= (e) => d.value = null
3069
+ }, [l("div", { style: h(k("topMargin")) }, null, 4)], 36)) : s("", !0),
3070
+ e.editable ? (v(), c("div", {
3071
+ key: 1,
3072
+ class: "docx-vertical-ruler__marker",
3073
+ style: h(O(S.value - T.value)),
3074
+ onMousedown: n[3] ||= M((e) => N("bottomMargin", e), ["prevent"]),
3075
+ onMouseenter: n[4] ||= (e) => d.value = "bottomMargin",
3076
+ onMouseleave: n[5] ||= (e) => d.value = null
3077
+ }, [l("div", { style: h(k("bottomMargin")) }, null, 4)], 36)) : s("", !0)
3078
+ ], 4));
3079
+ }
3080
+ }), [["__scopeId", "data-v-6e1bbe22"]]), mr = { class: "doc-name" }, hr = ["value"], gr = {
3081
+ key: 1,
3082
+ class: "doc-name__text"
3083
+ }, _r = /* @__PURE__ */ n(/* @__PURE__ */ f({
3084
+ __name: "DocumentName",
3085
+ props: {
3086
+ modelValue: {},
3087
+ editable: {
3088
+ type: Boolean,
3089
+ default: !0
3090
+ }
3091
+ },
3092
+ emits: ["update:modelValue"],
3093
+ setup(e, { emit: t }) {
3094
+ let n = e, r = t, i = a(() => (n.modelValue || "").replace(/\.docx$/i, ""));
3095
+ function o(e) {
3096
+ let t = e.target.value;
3097
+ r("update:modelValue", t.endsWith(".docx") ? t : t + ".docx");
3098
+ }
3099
+ function s(e) {
3100
+ e.target.value.trim() || r("update:modelValue", "Untitled document.docx");
3101
+ }
3102
+ return (t, n) => (v(), c("div", mr, [e.editable ? (v(), c("input", {
3103
+ key: 0,
3104
+ class: "doc-name__input",
3105
+ value: i.value,
3106
+ onInput: o,
3107
+ onBlur: s,
3108
+ placeholder: "Untitled document"
3109
+ }, null, 40, hr)) : (v(), c("span", gr, w(i.value || "Untitled document"), 1))]));
3110
+ }
3111
+ }), [["__scopeId", "data-v-d78ee2fa"]]), vr = ["disabled", "onClick"], yr = {
3112
+ key: 0,
3113
+ class: "docx-menu-dropdown__separator"
3114
+ }, br = ["onMouseenter", "onMouseleave"], xr = ["disabled", "onClick"], Sr = { class: "docx-menu-dropdown__label" }, Cr = {
3115
+ key: 1,
3116
+ class: "docx-menu-dropdown__shortcut"
3117
+ }, wr = {
3118
+ key: 2,
3119
+ class: "docx-menu-dropdown__chevron"
3120
+ }, Tr = {
3121
+ key: 0,
3122
+ class: "docx-menu-dropdown__submenu"
3123
+ }, Er = /* @__PURE__ */ n(/* @__PURE__ */ f({
3124
+ __name: "MenuDropdown",
3125
+ props: {
3126
+ label: {},
3127
+ items: {},
3128
+ disabled: { type: Boolean },
3129
+ showChevron: {
3130
+ type: Boolean,
3131
+ default: !1
3132
+ }
3133
+ },
3134
+ setup(e) {
3135
+ function n(e) {
3136
+ return "type" in e && e.type === "separator";
3137
+ }
3138
+ let r = b(!1), a = b(null);
3139
+ function f() {
3140
+ r.value = !1, a.value = null;
3141
+ }
3142
+ function p(e) {
3143
+ e.disabled || e.submenu || (e.onClick?.(), f());
3144
+ }
3145
+ return (h, g) => (v(), o(Q, {
3146
+ open: r.value,
3147
+ "onUpdate:open": g[2] ||= (e) => r.value = e,
3148
+ onClose: f
3149
+ }, {
3150
+ trigger: k(({ toggle: n }) => [l("button", {
3151
+ type: "button",
3152
+ class: m(["docx-menu-dropdown__trigger", { "docx-menu-dropdown__trigger--open": r.value }]),
3153
+ disabled: e.disabled,
3154
+ onMousedown: g[0] ||= M(() => {}, ["prevent"]),
3155
+ onClick: M(n, ["prevent"])
3156
+ }, [u(w(e.label) + " ", 1), e.showChevron ? (v(), o(t, {
3157
+ key: 0,
3158
+ name: "arrow_drop_down",
3159
+ size: 16
3160
+ })) : s("", !0)], 42, vr)]),
3161
+ panel: k(() => [l("div", {
3162
+ class: "docx-menu-dropdown__menu",
3163
+ onMousedown: g[1] ||= M(() => {}, ["prevent"])
3164
+ }, [(v(!0), c(i, null, x(e.items, (e, r) => (v(), c(i, { key: r }, [n(e) ? (v(), c("div", yr)) : (v(), c("div", {
3165
+ key: 1,
3166
+ class: "docx-menu-dropdown__wrap",
3167
+ onMouseenter: (t) => e.submenu ? a.value = r : void 0,
3168
+ onMouseleave: (t) => e.submenu ? a.value = null : void 0
3169
+ }, [l("button", {
3170
+ type: "button",
3171
+ class: m(["docx-menu-dropdown__item", { "docx-menu-dropdown__item--disabled": e.disabled }]),
3172
+ disabled: e.disabled,
3173
+ onClick: M((t) => p(e), ["prevent"])
3174
+ }, [
3175
+ e.icon ? (v(), o(t, {
3176
+ key: 0,
3177
+ name: e.icon,
3178
+ size: 18
3179
+ }, null, 8, ["name"])) : s("", !0),
3180
+ l("span", Sr, w(e.label), 1),
3181
+ e.shortcut ? (v(), c("span", Cr, w(e.shortcut), 1)) : s("", !0),
3182
+ e.submenu ? (v(), c("span", wr, [d(t, {
3183
+ name: "keyboard_arrow_right",
3184
+ size: 16
3185
+ })])) : s("", !0)
3186
+ ], 10, xr), e.submenu && a.value === r ? (v(), c("div", Tr, [S(h.$slots, "submenu", {
3187
+ item: e,
3188
+ closeMenu: f
3189
+ }, void 0, !0)])) : s("", !0)], 40, br))], 64))), 128))], 32)]),
3190
+ _: 3
3191
+ }, 8, ["open"]));
3192
+ }
3193
+ }), [["__scopeId", "data-v-65cffcb2"]]), Dr = ["aria-selected", "onMouseenter"], Or = { class: "docx-table-grid-inline__label" }, kr = /* @__PURE__ */ n(/* @__PURE__ */ f({
3194
+ __name: "TableGridInline",
3195
+ props: {
3196
+ gridRows: { default: 6 },
3197
+ gridColumns: { default: 6 }
3198
+ },
3199
+ emits: ["insert"],
3200
+ setup(e, { emit: t }) {
3201
+ let n = e, r = t, o = b(0), s = b(0), u = a(() => {
3202
+ let e = [];
3203
+ for (let t = 1; t <= n.gridRows; t++) for (let r = 1; r <= n.gridColumns; r++) e.push({
3204
+ r: t,
3205
+ c: r
3206
+ });
3207
+ return e;
3208
+ });
3209
+ function d() {
3210
+ o.value > 0 && s.value > 0 && r("insert", o.value, s.value);
3211
+ }
3212
+ return (t, n) => (v(), c("div", null, [l("div", {
3213
+ class: "docx-table-grid-inline__grid",
3214
+ style: h({ gridTemplateColumns: `repeat(${e.gridColumns}, 18px)` }),
3215
+ role: "grid",
3216
+ "aria-label": "Table size selector",
3217
+ onMouseleave: n[0] ||= (e) => {
3218
+ o.value = 0, s.value = 0;
3219
+ }
3220
+ }, [(v(!0), c(i, null, x(u.value, (e) => (v(), c("div", {
3221
+ key: `${e.r}-${e.c}`,
3222
+ class: m(["docx-table-grid-inline__cell", { "docx-table-grid-inline__cell--active": e.r <= o.value && e.c <= s.value }]),
3223
+ role: "gridcell",
3224
+ "aria-selected": e.r <= o.value && e.c <= s.value,
3225
+ onMouseenter: (t) => {
3226
+ o.value = e.r, s.value = e.c;
3227
+ },
3228
+ onClick: M(d, ["prevent"])
3229
+ }, null, 42, Dr))), 128))], 36), l("div", Or, w(o.value > 0 && s.value > 0 ? `${s.value} × ${o.value}` : "Select size"), 1)]));
3230
+ }
3231
+ }), [["__scopeId", "data-v-ecd8fc63"]]), Ar = {
3232
+ class: "menu-bar",
3233
+ role: "menubar"
3234
+ }, jr = /* @__PURE__ */ n(/* @__PURE__ */ f({
3235
+ __name: "MenuBar",
3236
+ emits: ["action", "insert-table"],
3237
+ setup(t, { emit: n }) {
3238
+ let r = n, { t: i } = e();
3239
+ function l(e) {
3240
+ return () => r("action", e);
3241
+ }
3242
+ let u = a(() => [
3243
+ {
3244
+ icon: "file_upload",
3245
+ label: i("toolbar.open"),
3246
+ shortcut: i("toolbar.openShortcut"),
3247
+ onClick: l("open")
3248
+ },
3249
+ {
3250
+ icon: "file_download",
3251
+ label: i("toolbar.save"),
3252
+ shortcut: i("toolbar.saveShortcut"),
3253
+ onClick: l("save")
3254
+ },
3255
+ { type: "separator" },
3256
+ {
3257
+ icon: "settings",
3258
+ label: i("toolbar.pageSetup"),
3259
+ onClick: l("pageSetup")
3260
+ }
3261
+ ]), f = a(() => [{
3262
+ icon: "format_textdirection_l_to_r",
3263
+ label: i("toolbar.leftToRight"),
3264
+ onClick: l("dirLTR")
3265
+ }, {
3266
+ icon: "format_textdirection_r_to_l",
3267
+ label: i("toolbar.rightToLeft"),
3268
+ onClick: l("dirRTL")
3269
+ }]), p = a(() => [
3270
+ {
3271
+ icon: "image",
3272
+ label: i("toolbar.image"),
3273
+ onClick: l("insertImage")
3274
+ },
3275
+ {
3276
+ icon: "grid_on",
3277
+ label: i("toolbar.table"),
3278
+ key: "table",
3279
+ submenu: !0
3280
+ },
3281
+ { type: "separator" },
3282
+ {
3283
+ icon: "page_break",
3284
+ label: i("toolbar.pageBreak"),
3285
+ onClick: l("insertPageBreak")
3286
+ },
3287
+ {
3288
+ icon: "format_list_numbered",
3289
+ label: i("toolbar.tableOfContents"),
3290
+ onClick: l("insertTOC")
3291
+ },
3292
+ {
3293
+ icon: "branding_watermark",
3294
+ label: i("toolbar.watermark"),
3295
+ onClick: l("watermark")
3296
+ }
3297
+ ]), m = a(() => [{
3298
+ label: i("toolbar.reportIssue"),
3299
+ onClick: l("reportIssue")
3300
+ }]);
3301
+ return (e, t) => (v(), c("div", Ar, [
3302
+ d(Er, {
3303
+ label: T(i)("toolbar.file"),
3304
+ items: u.value
3305
+ }, null, 8, ["label", "items"]),
3306
+ d(Er, {
3307
+ label: T(i)("toolbar.format"),
3308
+ items: f.value
3309
+ }, null, 8, ["label", "items"]),
3310
+ d(Er, {
3311
+ label: T(i)("toolbar.insert"),
3312
+ items: p.value
3313
+ }, {
3314
+ submenu: k(({ item: e, closeMenu: t }) => [e.key === "table" ? (v(), o(kr, {
3315
+ key: 0,
3316
+ onInsert: (e, n) => {
3317
+ r("insert-table", e, n), t();
3318
+ }
3319
+ }, null, 8, ["onInsert"])) : s("", !0)]),
3320
+ _: 1
3321
+ }, 8, ["label", "items"]),
3322
+ d(Er, {
3323
+ label: T(i)("toolbar.help"),
3324
+ items: m.value
3325
+ }, null, 8, ["label", "items"])
3326
+ ]));
3327
+ }
3328
+ }), [["__scopeId", "data-v-6fc03bf3"]]);
3329
+ //#endregion
3330
+ export { je as C, _e as D, Q as E, Me as S, Ee as T, ct as _, pr as a, Qe as b, Kn as c, pn as d, dn as f, Vt as g, Ht as h, _r as i, Vn as l, Xt as m, kr as n, or as o, en as p, Er as r, Jn as s, jr as t, Ln as u, rt as v, Ae as w, Ze as x, nt as y };