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