xiaodao-spreader 0.1.2 → 0.1.4

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.
@@ -1,5 +1,5 @@
1
- import { defineComponent as kn, computed as I, useModel as Rn, reactive as wl, ref as N, onMounted as Mn, nextTick as J, watch as Ve, onBeforeUnmount as Tn, openBlock as j, createElementBlock as P, normalizeStyle as Ce, createElementVNode as $, Fragment as Yt, renderList as Ut, withModifiers as ue, normalizeClass as vt, toDisplayString as dt, unref as se, createCommentVNode as Fe, createBlock as Dn, Teleport as Hn, mergeModels as _n } from "vue";
2
- const w = 52, y = 24, Je = 100, Ze = 24, Q = 11, En = 50, $n = {
1
+ import { defineComponent as Kt, ref as T, computed as E, watch as Je, nextTick as re, onMounted as so, onBeforeUnmount as ll, openBlock as x, createElementBlock as z, normalizeStyle as Le, normalizeClass as ie, toDisplayString as Ye, createElementVNode as d, createCommentVNode as ye, createBlock as ne, Teleport as ae, createVNode as ke, Transition as Nt, withCtx as Gt, Fragment as Qe, renderList as ot, withModifiers as he, unref as I, withDirectives as qa, vShow as Za, useModel as Ja, reactive as Yo, mergeModels as Qa } from "vue";
2
+ const W = 52, N = 24, It = 100, Xo = 24, Qt = 30, el = 24, Al = 1e3, tl = 500, Oe = 11, er = 50, tr = {
3
3
  "zh-CN": {
4
4
  insert: "插入",
5
5
  delete: "删除",
@@ -17,7 +17,95 @@ const w = 52, y = 24, Je = 100, Ze = 24, Q = 11, En = 50, $n = {
17
17
  scrollLeft: "向左滚动",
18
18
  scrollRight: "向右滚动",
19
19
  calculate: "计算",
20
- sum: "求和"
20
+ sum: "求和",
21
+ undo: "撤销",
22
+ redo: "重做",
23
+ paintFormat: "格式刷",
24
+ clearFormat: "清除格式",
25
+ fontFamily: "字体",
26
+ fontSize: "字号",
27
+ fontSizeIncrease: "增大字号",
28
+ fontSizeDecrease: "减小字号",
29
+ bold: "加粗",
30
+ italic: "斜体",
31
+ underline: "下划线",
32
+ strikethrough: "删除线",
33
+ fontColor: "文字颜色",
34
+ fillColor: "填充颜色",
35
+ borders: "边框",
36
+ hAlign: "水平对齐",
37
+ vAlign: "垂直对齐",
38
+ alignLeft: "左端对齐",
39
+ alignCenter: "居中对齐",
40
+ alignRight: "右端对齐",
41
+ alignTop: "顶端对齐",
42
+ alignMiddle: "垂直居中",
43
+ alignBottom: "底端对齐",
44
+ wrap: "自动换行",
45
+ borderBottom: "下框线",
46
+ borderTop: "上框线",
47
+ borderLeft: "左框线",
48
+ borderRight: "右框线",
49
+ borderNone: "无框线",
50
+ borderAll: "所有框线",
51
+ borderOuter: "外框线",
52
+ borderThickOuter: "粗外框线",
53
+ fontDefault: "默认",
54
+ rowHeight: "行高",
55
+ colWidth: "列宽",
56
+ autoRowHeight: "自动行高",
57
+ defaultColWidth: "默认列宽",
58
+ ok: "确定",
59
+ cancel: "取消",
60
+ dimNumberError: "请输入数字",
61
+ dimRangeError: "请输入 {min}~{max} 之间的数值",
62
+ colorAutomatic: "自动",
63
+ colorNoFill: "无填充",
64
+ colorWhite: "白色",
65
+ colorBlack: "黑色",
66
+ colorLightGray: "浅灰",
67
+ colorLightBlue: "浅蓝",
68
+ colorLightOrange: "浅橙",
69
+ colorLightYellow: "浅黄",
70
+ colorLightGreen: "浅绿",
71
+ colorPaleBlue: "淡蓝",
72
+ colorPaleOrange: "淡橙",
73
+ colorPaleYellow: "淡黄",
74
+ colorPaleGreen: "淡绿",
75
+ colorSilver: "银色",
76
+ colorSkyBlue: "天蓝",
77
+ colorCoral: "珊瑚",
78
+ colorGold: "金色",
79
+ colorMint: "薄荷",
80
+ colorGray: "灰色",
81
+ colorMediumBlue: "中蓝",
82
+ colorOrange: "橙色",
83
+ colorAmber: "琥珀",
84
+ colorMediumGreen: "中绿",
85
+ colorDarkGray: "深灰",
86
+ colorRoyalBlue: "宝蓝",
87
+ colorRed: "红色",
88
+ colorDarkGold: "深金",
89
+ colorDarkGreen: "深绿",
90
+ colorCharcoal: "炭灰",
91
+ colorDeepBlue: "深蓝",
92
+ colorDarkRed: "深红",
93
+ colorOlive: "橄榄",
94
+ colorForest: "森林",
95
+ colorSlate: "石板灰",
96
+ colorNavy: "藏青",
97
+ colorCrimson: "绯红",
98
+ colorDarkOlive: "深橄榄",
99
+ colorDeepForest: "深林",
100
+ colorDarkSlate: "深石板灰",
101
+ colorMidnight: "午夜蓝",
102
+ colorMaroon: "栗色",
103
+ colorCoffee: "咖啡色",
104
+ colorEvergreen: "常青",
105
+ colorDarkNavy: "深藏青",
106
+ colorDarkMaroon: "深栗",
107
+ colorDarkCoffee: "深咖",
108
+ colorInkGreen: "墨绿"
21
109
  },
22
110
  "en-US": {
23
111
  insert: "Insert",
@@ -36,14 +124,142 @@ const w = 52, y = 24, Je = 100, Ze = 24, Q = 11, En = 50, $n = {
36
124
  scrollLeft: "Scroll left",
37
125
  scrollRight: "Scroll right",
38
126
  calculate: "Calculate",
39
- sum: "Sum"
127
+ sum: "Sum",
128
+ undo: "Undo",
129
+ redo: "Redo",
130
+ paintFormat: "Paint Format",
131
+ clearFormat: "Clear Format",
132
+ fontFamily: "Font Family",
133
+ fontSize: "Font Size",
134
+ fontSizeIncrease: "Increase Font Size",
135
+ fontSizeDecrease: "Decrease Font Size",
136
+ bold: "Bold",
137
+ italic: "Italic",
138
+ underline: "Underline",
139
+ strikethrough: "Strikethrough",
140
+ fontColor: "Font Color",
141
+ fillColor: "Fill Color",
142
+ borders: "Borders",
143
+ hAlign: "Horizontal Align",
144
+ vAlign: "Vertical Align",
145
+ alignLeft: "Align Left",
146
+ alignCenter: "Align Center",
147
+ alignRight: "Align Right",
148
+ alignTop: "Align Top",
149
+ alignMiddle: "Align Middle",
150
+ alignBottom: "Align Bottom",
151
+ wrap: "Wrap Text",
152
+ borderBottom: "Bottom Border",
153
+ borderTop: "Top Border",
154
+ borderLeft: "Left Border",
155
+ borderRight: "Right Border",
156
+ borderNone: "No Border",
157
+ borderAll: "All Borders",
158
+ borderOuter: "Outside Borders",
159
+ borderThickOuter: "Thick Box Border",
160
+ fontDefault: "Default",
161
+ rowHeight: "Row Height",
162
+ colWidth: "Column Width",
163
+ autoRowHeight: "Auto Row Height",
164
+ defaultColWidth: "Default Column Width",
165
+ ok: "OK",
166
+ cancel: "Cancel",
167
+ dimNumberError: "Please enter a number",
168
+ dimRangeError: "Please enter a value between {min} and {max}",
169
+ colorAutomatic: "Automatic",
170
+ colorNoFill: "No Fill",
171
+ colorWhite: "White",
172
+ colorBlack: "Black",
173
+ colorLightGray: "Light Gray",
174
+ colorLightBlue: "Light Blue",
175
+ colorLightOrange: "Light Orange",
176
+ colorLightYellow: "Light Yellow",
177
+ colorLightGreen: "Light Green",
178
+ colorPaleBlue: "Pale Blue",
179
+ colorPaleOrange: "Pale Orange",
180
+ colorPaleYellow: "Pale Yellow",
181
+ colorPaleGreen: "Pale Green",
182
+ colorSilver: "Silver",
183
+ colorSkyBlue: "Sky Blue",
184
+ colorCoral: "Coral",
185
+ colorGold: "Gold",
186
+ colorMint: "Mint",
187
+ colorGray: "Gray",
188
+ colorMediumBlue: "Medium Blue",
189
+ colorOrange: "Orange",
190
+ colorAmber: "Amber",
191
+ colorMediumGreen: "Medium Green",
192
+ colorDarkGray: "Dark Gray",
193
+ colorRoyalBlue: "Royal Blue",
194
+ colorRed: "Red",
195
+ colorDarkGold: "Dark Gold",
196
+ colorDarkGreen: "Dark Green",
197
+ colorCharcoal: "Charcoal",
198
+ colorDeepBlue: "Deep Blue",
199
+ colorDarkRed: "Dark Red",
200
+ colorOlive: "Olive",
201
+ colorForest: "Forest",
202
+ colorSlate: "Slate",
203
+ colorNavy: "Navy",
204
+ colorCrimson: "Crimson",
205
+ colorDarkOlive: "Dark Olive",
206
+ colorDeepForest: "Deep Forest",
207
+ colorDarkSlate: "Dark Slate",
208
+ colorMidnight: "Midnight",
209
+ colorMaroon: "Maroon",
210
+ colorCoffee: "Coffee",
211
+ colorEvergreen: "Evergreen",
212
+ colorDarkNavy: "Dark Navy",
213
+ colorDarkMaroon: "Dark Maroon",
214
+ colorDarkCoffee: "Dark Coffee",
215
+ colorInkGreen: "Ink Green"
40
216
  }
41
217
  };
42
- function C(u, f) {
43
- var s;
44
- return ((s = $n[u]) == null ? void 0 : s[f]) ?? f;
218
+ function C(a, p) {
219
+ var c;
220
+ return ((c = tr[a]) == null ? void 0 : c[p]) ?? p;
45
221
  }
46
- const In = {
222
+ const no = '-apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif', dt = 10, lr = [
223
+ { label: "", value: "" },
224
+ { label: "微软雅黑", value: '"Microsoft YaHei", "微软雅黑", sans-serif' },
225
+ { label: "宋体", value: '"SimSun", "宋体", serif' },
226
+ { label: "黑体", value: '"SimHei", "黑体", sans-serif' },
227
+ { label: "楷体", value: '"KaiTi", "楷体", serif' },
228
+ { label: "Arial", value: "Arial, sans-serif" },
229
+ { label: "Arial Black", value: '"Arial Black", sans-serif' },
230
+ { label: "Times New Roman", value: '"Times New Roman", serif' },
231
+ { label: "Courier New", value: '"Courier New", monospace' },
232
+ { label: "Verdana", value: "Verdana, sans-serif" },
233
+ { label: "Georgia", value: "Georgia, serif" },
234
+ { label: "Impact", value: "Impact, sans-serif" },
235
+ { label: "Tahoma", value: "Tahoma, sans-serif" },
236
+ { label: "Trebuchet MS", value: '"Trebuchet MS", sans-serif' },
237
+ { label: "Comic Sans MS", value: '"Comic Sans MS", cursive' }
238
+ ], or = [
239
+ { label: "9", value: 9 },
240
+ { label: "10", value: 10 },
241
+ { label: "11", value: 11 },
242
+ { label: "12", value: 12 },
243
+ { label: "13", value: 13 },
244
+ { label: "14", value: 14 },
245
+ { label: "16", value: 16 },
246
+ { label: "18", value: 18 },
247
+ { label: "20", value: 20 },
248
+ { label: "24", value: 24 },
249
+ { label: "28", value: 28 },
250
+ { label: "32", value: 32 },
251
+ { label: "36", value: 36 },
252
+ { label: "48", value: 48 },
253
+ { label: "72", value: 72 }
254
+ ], nr = '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"><line x1="3" y1="6" x2="19" y2="6"/><line x1="3" y1="12" x2="15" y2="12"/><line x1="3" y1="18" x2="17" y2="18"/></svg>', ar = '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"><line x1="3" y1="6" x2="21" y2="6"/><line x1="6" y1="12" x2="18" y2="12"/><line x1="4" y1="18" x2="20" y2="18"/></svg>', rr = '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"><line x1="5" y1="6" x2="21" y2="6"/><line x1="9" y1="12" x2="21" y2="12"/><line x1="7" y1="18" x2="21" y2="18"/></svg>', ir = '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"><line x1="6" y1="7" x2="6" y2="20"/><line x1="12" y1="7" x2="12" y2="16"/><line x1="18" y1="7" x2="18" y2="20"/><line x1="4" y1="3" x2="20" y2="3"/></svg>', sr = '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"><line x1="6" y1="4" x2="6" y2="20"/><line x1="12" y1="8" x2="12" y2="16"/><line x1="18" y1="4" x2="18" y2="20"/></svg>', ur = '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"><line x1="6" y1="4" x2="6" y2="17"/><line x1="12" y1="8" x2="12" y2="17"/><line x1="18" y1="4" x2="18" y2="17"/><line x1="4" y1="21" x2="20" y2="21"/></svg>', cr = [
255
+ { value: "left", labelKey: "alignLeft", icon: nr },
256
+ { value: "center", labelKey: "alignCenter", icon: ar },
257
+ { value: "right", labelKey: "alignRight", icon: rr }
258
+ ], dr = [
259
+ { value: "top", labelKey: "alignTop", icon: ir },
260
+ { value: "middle", labelKey: "alignMiddle", icon: sr },
261
+ { value: "bottom", labelKey: "alignBottom", icon: ur }
262
+ ], vr = {
47
263
  bg: "#f4f4f4",
48
264
  gridBg: "#ffffff",
49
265
  headerBg: "#e8e8e8",
@@ -91,8 +307,14 @@ const In = {
91
307
  scrollBtnColor: "#666",
92
308
  scrollBtnHoverBg: "#d0d0d0",
93
309
  scrollBtnActiveBg: "#c0c0c0",
94
- scrollTrackBg: "rgba(0,0,0,0.06)"
95
- }, Wn = {
310
+ scrollTrackBg: "rgba(0,0,0,0.06)",
311
+ toolbarBg: "#f7f7f7",
312
+ toolbarBorder: "#d8d8d8",
313
+ toolbarBtnColor: "#444",
314
+ toolbarBtnHoverBg: "#e6e6e6",
315
+ toolbarBtnDisabledColor: "#b0b0b0",
316
+ toolbarBtnActiveColor: "#0078d7"
317
+ }, fr = {
96
318
  bg: "#1e1e1e",
97
319
  gridBg: "#252526",
98
320
  headerBg: "#252525",
@@ -140,208 +362,1546 @@ const In = {
140
362
  scrollBtnColor: "#999",
141
363
  scrollBtnHoverBg: "#3d3d3d",
142
364
  scrollBtnActiveBg: "#4d4d4d",
143
- scrollTrackBg: "rgba(255,255,255,0.05)"
144
- };
145
- function ce(u) {
146
- let f = "", s = u;
365
+ scrollTrackBg: "rgba(255,255,255,0.05)",
366
+ toolbarBg: "#2a2a2a",
367
+ toolbarBorder: "#3e3e3e",
368
+ toolbarBtnColor: "#ccc",
369
+ toolbarBtnHoverBg: "#3a3a3a",
370
+ toolbarBtnDisabledColor: "#666",
371
+ toolbarBtnActiveColor: "#4ea1ff"
372
+ }, br = ["title"], hr = ["innerHTML"], mr = {
373
+ key: 1,
374
+ class: "sp-dropdown__value"
375
+ }, pr = ["disabled"], gr = ["onClick"], yr = ["innerHTML"], wr = { class: "sp-dropdown__item-label" }, kr = ["disabled"], Cr = /* @__PURE__ */ Kt({
376
+ __name: "dropdown",
377
+ props: {
378
+ modelValue: {},
379
+ options: {},
380
+ width: { default: "auto" },
381
+ menuWidth: { default: void 0 },
382
+ visibleCount: { default: 8 },
383
+ title: { default: "" },
384
+ modelOpen: { type: Boolean, default: void 0 },
385
+ hideTrigger: { type: Boolean, default: !1 },
386
+ align: { default: "left" }
387
+ },
388
+ emits: ["update:modelValue", "change", "update:modelOpen"],
389
+ setup(a, { emit: p }) {
390
+ const c = a, b = p, i = T(!1), B = T(0), F = T(null), m = T(null), $ = T(null), k = T({ top: 0, up: !1 }), y = T(0), A = T(!1), K = E(() => c.options.find((V) => String(V.value) === String(c.modelValue))), L = E(() => c.menuWidth), G = E(() => Math.min(c.visibleCount, c.options.length)), S = E(() => c.options.slice(B.value, B.value + G.value)), O = E(() => B.value > 0), Y = E(() => B.value + G.value < c.options.length), ee = E(() => c.options.length > G.value);
391
+ function te(V) {
392
+ B.value = Math.max(0, Math.min(c.options.length - G.value, B.value + V));
393
+ }
394
+ function Xe() {
395
+ i.value = !0, c.modelOpen !== void 0 && b("update:modelOpen", !0);
396
+ const V = F.value;
397
+ if (!V)
398
+ return;
399
+ const P = V.getBoundingClientRect(), D = G.value * 22 + (ee.value ? 2 * 15 : 0) + 8, oe = window.innerHeight - P.bottom - 4 < D && P.top - 4 > D;
400
+ c.align === "right" ? k.value = {
401
+ right: window.innerWidth - P.right,
402
+ top: oe ? P.top - D - 4 : P.bottom + 4,
403
+ up: oe
404
+ } : k.value = {
405
+ left: P.left,
406
+ top: oe ? P.top - D - 4 : P.bottom + 4,
407
+ up: oe
408
+ };
409
+ const Ct = c.options.findIndex((nt) => String(nt.value) === String(c.modelValue));
410
+ B.value = Ct >= 0 ? Math.max(0, Math.min(Ct - Math.floor(G.value / 2), c.options.length - G.value)) : 0;
411
+ }
412
+ function se() {
413
+ i.value = !1, c.modelOpen !== void 0 && b("update:modelOpen", !1);
414
+ }
415
+ function _e() {
416
+ i.value ? se() : Xe();
417
+ }
418
+ function De(V) {
419
+ b("update:modelValue", V.value), b("change", V.value), se();
420
+ }
421
+ function je(V) {
422
+ var D, j;
423
+ if (!i.value)
424
+ return;
425
+ const P = V.target;
426
+ (D = F.value) != null && D.contains(P) || (j = $.value) != null && j.contains(P) || se();
427
+ }
428
+ function H(V) {
429
+ i.value && (V.preventDefault(), te(V.deltaY > 0 ? 1 : -1));
430
+ }
431
+ Je(i, (V) => {
432
+ re(() => {
433
+ var P, D;
434
+ V ? (P = m.value) == null || P.addEventListener("wheel", H, { passive: !1 }) : (D = m.value) == null || D.removeEventListener("wheel", H);
435
+ });
436
+ }), Je(() => c.modelOpen, (V) => {
437
+ V !== void 0 && V !== i.value && (V ? Xe() : se());
438
+ });
439
+ function le(V) {
440
+ i.value && (y.value = V.touches[0].clientY, A.value = !0);
441
+ }
442
+ function u(V) {
443
+ if (!i.value || !A.value)
444
+ return;
445
+ const P = V.touches[0].clientY - y.value;
446
+ Math.abs(P) > 5 && (te(P < 0 ? 1 : -1), y.value = V.touches[0].clientY);
447
+ }
448
+ function w() {
449
+ A.value = !1;
450
+ }
451
+ function ue(V) {
452
+ V.key === "Escape" && se();
453
+ }
454
+ return so(() => {
455
+ document.addEventListener("mousedown", je), window.addEventListener("resize", se), window.addEventListener("scroll", se, !0);
456
+ }), ll(() => {
457
+ document.removeEventListener("mousedown", je), window.removeEventListener("resize", se), window.removeEventListener("scroll", se, !0);
458
+ }), (V, P) => {
459
+ var D, j;
460
+ return x(), z("div", {
461
+ ref_key: "rootRef",
462
+ ref: F,
463
+ class: "sp-dropdown",
464
+ style: Le(typeof a.width == "number" ? { width: a.width + "px" } : { width: a.width })
465
+ }, [
466
+ a.hideTrigger ? ye("", !0) : (x(), z("button", {
467
+ key: 0,
468
+ type: "button",
469
+ class: ie(["sp-dropdown__trigger", { "sp-dropdown__trigger--open": i.value }]),
470
+ title: a.title,
471
+ onClick: _e
472
+ }, [
473
+ (D = K.value) != null && D.icon ? (x(), z("span", {
474
+ key: 0,
475
+ class: "sp-dropdown__icon",
476
+ innerHTML: K.value.icon
477
+ }, null, 8, hr)) : (x(), z("span", mr, Ye(((j = K.value) == null ? void 0 : j.label) ?? ""), 1)),
478
+ P[2] || (P[2] = d("svg", {
479
+ class: "sp-dropdown__caret",
480
+ viewBox: "0 0 1024 1024",
481
+ fill: "currentColor"
482
+ }, [
483
+ d("path", { d: "M180.053333 361.386667a32 32 0 0 1 45.226667 0L512 648.106667l286.72-286.72a32 32 0 1 1 45.226667 45.226666l-309.333334 309.333334a32 32 0 0 1-45.226666 0L180.053333 406.613333a32 32 0 0 1 0-45.226666z" })
484
+ ], -1))
485
+ ], 10, br)),
486
+ (x(), ne(ae, { to: "body" }, [
487
+ ke(Nt, { name: "menu-pop" }, {
488
+ default: Gt(() => [
489
+ i.value ? (x(), z("div", {
490
+ key: 0,
491
+ ref_key: "menuRef",
492
+ ref: $,
493
+ class: ie(["sp-dropdown__menu", { "sp-dropdown__menu--up": k.value.up }]),
494
+ style: Le({ left: k.value.left !== void 0 ? k.value.left + "px" : void 0, right: k.value.right !== void 0 ? k.value.right + "px" : void 0, top: k.value.top + "px", minWidth: L.value !== void 0 ? typeof L.value == "number" ? L.value + "px" : L.value : void 0 }),
495
+ onKeydown: ue
496
+ }, [
497
+ ee.value ? (x(), z("button", {
498
+ key: 0,
499
+ type: "button",
500
+ class: ie(["sp-dropdown__nav", { "sp-dropdown__nav--disabled": !O.value }]),
501
+ disabled: !O.value,
502
+ onClick: P[0] || (P[0] = (oe) => te(-1))
503
+ }, [...P[3] || (P[3] = [
504
+ d("svg", {
505
+ viewBox: "0 0 1024 1024",
506
+ fill: "currentColor"
507
+ }, [
508
+ d("path", { d: "M180.053333 662.613333a32 32 0 0 0 45.226667 0L512 375.893333l286.72 286.72a32 32 0 1 0 45.226667-45.226666l-309.333334-309.333334a32 32 0 0 0-45.226666 0l-309.333334 309.333334a32 32 0 0 0 0 45.226666z" })
509
+ ], -1)
510
+ ])], 10, pr)) : ye("", !0),
511
+ d("div", {
512
+ ref_key: "listRef",
513
+ ref: m,
514
+ class: "sp-dropdown__list",
515
+ onTouchstart: le,
516
+ onTouchmove: u,
517
+ onTouchend: w
518
+ }, [
519
+ (x(!0), z(Qe, null, ot(S.value, (oe) => (x(), z("button", {
520
+ key: String(oe.value),
521
+ type: "button",
522
+ class: ie(["sp-dropdown__item", { "sp-dropdown__item--active": String(oe.value) === String(a.modelValue) }]),
523
+ onClick: (Ct) => De(oe)
524
+ }, [
525
+ oe.icon ? (x(), z("span", {
526
+ key: 0,
527
+ class: "sp-dropdown__item-icon",
528
+ innerHTML: oe.icon
529
+ }, null, 8, yr)) : ye("", !0),
530
+ d("span", wr, Ye(oe.label), 1)
531
+ ], 10, gr))), 128))
532
+ ], 544),
533
+ ee.value ? (x(), z("button", {
534
+ key: 1,
535
+ type: "button",
536
+ class: ie(["sp-dropdown__nav", { "sp-dropdown__nav--disabled": !Y.value }]),
537
+ disabled: !Y.value,
538
+ onClick: P[1] || (P[1] = (oe) => te(1))
539
+ }, [...P[4] || (P[4] = [
540
+ d("svg", {
541
+ viewBox: "0 0 1024 1024",
542
+ fill: "currentColor"
543
+ }, [
544
+ d("path", { d: "M180.053333 361.386667a32 32 0 0 1 45.226667 0L512 648.106667l286.72-286.72a32 32 0 1 1 45.226667 45.226666l-309.333334 309.333334a32 32 0 0 1-45.226666 0L180.053333 406.613333a32 32 0 0 1 0-45.226666z" })
545
+ ], -1)
546
+ ])], 10, kr)) : ye("", !0)
547
+ ], 38)) : ye("", !0)
548
+ ]),
549
+ _: 1
550
+ })
551
+ ]))
552
+ ], 4);
553
+ };
554
+ }
555
+ }), Vt = (a, p) => {
556
+ const c = a.__vccOpts || a;
557
+ for (const [b, i] of p)
558
+ c[b] = i;
559
+ return c;
560
+ }, El = /* @__PURE__ */ Vt(Cr, [["__scopeId", "data-v-0fc61adc"]]), xr = ["title", "onClick"], Br = /* @__PURE__ */ Kt({
561
+ __name: "colorPicker",
562
+ props: {
563
+ modelOpen: { type: Boolean, default: void 0 },
564
+ colorKey: { default: "text" },
565
+ currentColor: { default: "" },
566
+ locale: { default: "zh-CN" }
567
+ },
568
+ emits: ["update:modelValue", "change", "update:modelOpen"],
569
+ setup(a, { expose: p, emit: c }) {
570
+ const b = a, i = c, B = [
571
+ [
572
+ { key: "colorAutomatic", value: "" },
573
+ { key: "colorLightBlue", value: "#DEEBF7" },
574
+ { key: "colorLightOrange", value: "#FCE4D6" },
575
+ { key: "colorLightYellow", value: "#FFE79A" },
576
+ { key: "colorLightGreen", value: "#E2EFDA" }
577
+ ],
578
+ [
579
+ { key: "colorLightGray", value: "#F2F2F2" },
580
+ { key: "colorPaleBlue", value: "#BDD7EE" },
581
+ { key: "colorPaleOrange", value: "#F8CBAD" },
582
+ { key: "colorPaleYellow", value: "#FFD966" },
583
+ { key: "colorPaleGreen", value: "#C6EFCE" }
584
+ ],
585
+ [
586
+ { key: "colorSilver", value: "#D9D9D9" },
587
+ { key: "colorSkyBlue", value: "#9BC2E6" },
588
+ { key: "colorCoral", value: "#F4B183" },
589
+ { key: "colorGold", value: "#FFC000" },
590
+ { key: "colorMint", value: "#A9D18E" }
591
+ ],
592
+ [
593
+ { key: "colorGray", value: "#BFBFBF" },
594
+ { key: "colorMediumBlue", value: "#6FA8DC" },
595
+ { key: "colorOrange", value: "#ED7D31" },
596
+ { key: "colorAmber", value: "#F1C232" },
597
+ { key: "colorMediumGreen", value: "#70AD47" }
598
+ ],
599
+ [
600
+ { key: "colorDarkGray", value: "#A5A5A5" },
601
+ { key: "colorRoyalBlue", value: "#4A86E8" },
602
+ { key: "colorRed", value: "#E06666" },
603
+ { key: "colorDarkGold", value: "#BF8F00" },
604
+ { key: "colorDarkGreen", value: "#548235" }
605
+ ],
606
+ [
607
+ { key: "colorCharcoal", value: "#808080" },
608
+ { key: "colorDeepBlue", value: "#2E75B6" },
609
+ { key: "colorDarkRed", value: "#CC4125" },
610
+ { key: "colorOlive", value: "#806000" },
611
+ { key: "colorForest", value: "#375623" }
612
+ ],
613
+ [
614
+ { key: "colorSlate", value: "#595959" },
615
+ { key: "colorNavy", value: "#1F4E79" },
616
+ { key: "colorCrimson", value: "#993300" },
617
+ { key: "colorDarkOlive", value: "#5C4500" },
618
+ { key: "colorDeepForest", value: "#2D6A4F" }
619
+ ],
620
+ [
621
+ { key: "colorDarkSlate", value: "#404040" },
622
+ { key: "colorMidnight", value: "#17375E" },
623
+ { key: "colorMaroon", value: "#5A1E00" },
624
+ { key: "colorCoffee", value: "#3D3000" },
625
+ { key: "colorEvergreen", value: "#1B4332" }
626
+ ],
627
+ [
628
+ { key: "colorBlack", value: "#000000" },
629
+ { key: "colorDarkNavy", value: "#0C2340" },
630
+ { key: "colorDarkMaroon", value: "#2E0A00" },
631
+ { key: "colorDarkCoffee", value: "#1F1800" },
632
+ { key: "colorInkGreen", value: "#081C15" }
633
+ ]
634
+ ], F = [
635
+ [
636
+ { key: "colorNoFill", value: "" },
637
+ { key: "colorLightBlue", value: "#DEEBF7" },
638
+ { key: "colorLightOrange", value: "#FCE4D6" },
639
+ { key: "colorLightYellow", value: "#FFE79A" },
640
+ { key: "colorLightGreen", value: "#E2EFDA" }
641
+ ],
642
+ [
643
+ { key: "colorWhite", value: "#FFFFFF" },
644
+ { key: "colorPaleBlue", value: "#BDD7EE" },
645
+ { key: "colorPaleOrange", value: "#F8CBAD" },
646
+ { key: "colorPaleYellow", value: "#FFD966" },
647
+ { key: "colorPaleGreen", value: "#C6EFCE" }
648
+ ],
649
+ [
650
+ { key: "colorLightGray", value: "#F2F2F2" },
651
+ { key: "colorSkyBlue", value: "#9BC2E6" },
652
+ { key: "colorCoral", value: "#F4B183" },
653
+ { key: "colorGold", value: "#FFC000" },
654
+ { key: "colorMint", value: "#A9D18E" }
655
+ ],
656
+ [
657
+ { key: "colorSilver", value: "#D9D9D9" },
658
+ { key: "colorMediumBlue", value: "#6FA8DC" },
659
+ { key: "colorOrange", value: "#ED7D31" },
660
+ { key: "colorAmber", value: "#F1C232" },
661
+ { key: "colorMediumGreen", value: "#70AD47" }
662
+ ],
663
+ [
664
+ { key: "colorGray", value: "#BFBFBF" },
665
+ { key: "colorRoyalBlue", value: "#4A86E8" },
666
+ { key: "colorRed", value: "#E06666" },
667
+ { key: "colorDarkGold", value: "#BF8F00" },
668
+ { key: "colorDarkGreen", value: "#548235" }
669
+ ],
670
+ [
671
+ { key: "colorDarkGray", value: "#A5A5A5" },
672
+ { key: "colorDeepBlue", value: "#2E75B6" },
673
+ { key: "colorDarkRed", value: "#CC4125" },
674
+ { key: "colorOlive", value: "#806000" },
675
+ { key: "colorForest", value: "#375623" }
676
+ ],
677
+ [
678
+ { key: "colorCharcoal", value: "#808080" },
679
+ { key: "colorNavy", value: "#1F4E79" },
680
+ { key: "colorCrimson", value: "#993300" },
681
+ { key: "colorDarkOlive", value: "#5C4500" },
682
+ { key: "colorDeepForest", value: "#2D6A4F" }
683
+ ],
684
+ [
685
+ { key: "colorSlate", value: "#595959" },
686
+ { key: "colorMidnight", value: "#17375E" },
687
+ { key: "colorMaroon", value: "#5A1E00" },
688
+ { key: "colorCoffee", value: "#3D3000" },
689
+ { key: "colorEvergreen", value: "#1B4332" }
690
+ ],
691
+ [
692
+ { key: "colorDarkSlate", value: "#404040" },
693
+ { key: "colorDarkNavy", value: "#0C2340" },
694
+ { key: "colorDarkMaroon", value: "#2E0A00" },
695
+ { key: "colorDarkCoffee", value: "#1F1800" },
696
+ { key: "colorInkGreen", value: "#081C15" }
697
+ ]
698
+ ], m = E(
699
+ () => b.colorKey === "fill" ? F : B
700
+ );
701
+ function $(Y) {
702
+ return C(b.locale, Y);
703
+ }
704
+ function k(Y) {
705
+ const ee = b.currentColor;
706
+ return !ee && !Y ? !0 : ee ? ee.toLowerCase() === Y.toLowerCase() : !1;
707
+ }
708
+ const y = T(!1), A = T(null), K = T(null);
709
+ Je(() => b.modelOpen, (Y) => {
710
+ Y !== void 0 && Y !== y.value && (Y ? G() : S());
711
+ });
712
+ function L(Y) {
713
+ const ee = A.value;
714
+ ee && !ee.contains(Y.target) && S();
715
+ }
716
+ function G() {
717
+ y.value = !0, b.modelOpen !== void 0 && i("update:modelOpen", !0), re(() => {
718
+ document.addEventListener("mousedown", L);
719
+ });
720
+ }
721
+ function S() {
722
+ y.value = !1, b.modelOpen !== void 0 && i("update:modelOpen", !1), document.removeEventListener("mousedown", L);
723
+ }
724
+ function O(Y) {
725
+ i("update:modelValue", Y), i("change", Y), S();
726
+ }
727
+ return ll(() => {
728
+ document.removeEventListener("mousedown", L);
729
+ }), p({ open: y, openMenu: G, close: S }), (Y, ee) => (x(), z("div", {
730
+ ref_key: "rootRef",
731
+ ref: A,
732
+ class: "color-picker"
733
+ }, [
734
+ ke(Nt, { name: "menu-pop" }, {
735
+ default: Gt(() => [
736
+ y.value ? (x(), z("div", {
737
+ key: 0,
738
+ ref_key: "menuRef",
739
+ ref: K,
740
+ class: "color-picker__menu",
741
+ onMousedown: ee[0] || (ee[0] = he(() => {
742
+ }, ["stop"]))
743
+ }, [
744
+ (x(!0), z(Qe, null, ot(m.value, (te, Xe) => (x(), z("div", {
745
+ key: Xe,
746
+ class: "color-picker__row"
747
+ }, [
748
+ (x(!0), z(Qe, null, ot(te, (se) => (x(), z("button", {
749
+ key: se.value,
750
+ class: ie(["color-picker__swatch", { "color-picker__swatch--selected": k(se.value) }]),
751
+ title: $(se.key),
752
+ style: Le({
753
+ background: se.value || "transparent",
754
+ border: se.value ? "1px solid rgba(0,0,0,0.15)" : "1px dashed #999"
755
+ }),
756
+ onClick: (_e) => O(se.value)
757
+ }, null, 14, xr))), 128))
758
+ ]))), 128))
759
+ ], 544)) : ye("", !0)
760
+ ]),
761
+ _: 1
762
+ })
763
+ ], 512));
764
+ }
765
+ }), _o = /* @__PURE__ */ Vt(Br, [["__scopeId", "data-v-c262a5e5"]]), Sr = ["title", "onClick"], Mr = {
766
+ viewBox: "0 0 30 30",
767
+ class: "border-picker__icon"
768
+ }, Rr = ["x1", "y1", "x2", "y2", "stroke-width", "stroke-dasharray", "stroke-linecap"], Dr = { class: "border-picker__label" }, Tr = /* @__PURE__ */ Kt({
769
+ __name: "borderPicker",
770
+ props: {
771
+ modelOpen: { type: Boolean, default: void 0 },
772
+ locale: { default: "zh-CN" },
773
+ currentBorder: { default: "none" }
774
+ },
775
+ emits: ["update:modelOpen", "change"],
776
+ setup(a, { expose: p, emit: c }) {
777
+ const b = a, i = c, B = [
778
+ { key: "bottom", i18nKey: "borderBottom" },
779
+ { key: "top", i18nKey: "borderTop" },
780
+ { key: "left", i18nKey: "borderLeft" },
781
+ { key: "right", i18nKey: "borderRight" },
782
+ { key: "none", i18nKey: "borderNone" },
783
+ { key: "all", i18nKey: "borderAll" },
784
+ { key: "outer", i18nKey: "borderOuter" },
785
+ { key: "thickOuter", i18nKey: "borderThickOuter" }
786
+ ], F = [
787
+ { name: "top", x1: 4, y1: 4, x2: 26, y2: 4 },
788
+ { name: "bottom", x1: 4, y1: 26, x2: 26, y2: 26 },
789
+ { name: "left", x1: 4, y1: 4, x2: 4, y2: 26 },
790
+ { name: "right", x1: 26, y1: 4, x2: 26, y2: 26 },
791
+ { name: "vMid", x1: 15, y1: 4, x2: 15, y2: 26 },
792
+ { name: "hMid", x1: 4, y1: 15, x2: 26, y2: 15 }
793
+ ], m = {
794
+ bottom: ["bottom"],
795
+ top: ["top"],
796
+ left: ["left"],
797
+ right: ["right"],
798
+ none: [],
799
+ all: ["top", "bottom", "left", "right", "vMid", "hMid"],
800
+ outer: ["top", "bottom", "left", "right"],
801
+ thickOuter: ["top", "bottom", "left", "right"]
802
+ }, $ = {
803
+ bottom: [],
804
+ top: [],
805
+ left: [],
806
+ right: [],
807
+ none: [],
808
+ all: [],
809
+ outer: [],
810
+ thickOuter: ["top", "bottom", "left", "right"]
811
+ };
812
+ function k(O, Y) {
813
+ return $[O].includes(Y) ? "thick" : m[O].includes(Y) ? "solid" : "dashed";
814
+ }
815
+ const y = T(!1), A = T(null);
816
+ Je(() => b.modelOpen, (O) => {
817
+ O !== void 0 && O !== y.value && (O ? L() : G());
818
+ });
819
+ function K(O) {
820
+ const Y = A.value;
821
+ Y && !Y.contains(O.target) && G();
822
+ }
823
+ function L() {
824
+ y.value = !0, b.modelOpen !== void 0 && i("update:modelOpen", !0), re(() => {
825
+ document.addEventListener("mousedown", K);
826
+ });
827
+ }
828
+ function G() {
829
+ y.value = !1, b.modelOpen !== void 0 && i("update:modelOpen", !1), document.removeEventListener("mousedown", K);
830
+ }
831
+ function S(O) {
832
+ i("change", O), G();
833
+ }
834
+ return ll(() => {
835
+ document.removeEventListener("mousedown", K);
836
+ }), p({ open: y, openMenu: L, close: G }), (O, Y) => (x(), z("div", {
837
+ ref_key: "rootRef",
838
+ ref: A,
839
+ class: "border-picker"
840
+ }, [
841
+ ke(Nt, { name: "menu-pop" }, {
842
+ default: Gt(() => [
843
+ y.value ? (x(), z("div", {
844
+ key: 0,
845
+ class: "border-picker__menu",
846
+ onMousedown: Y[0] || (Y[0] = he(() => {
847
+ }, ["stop"]))
848
+ }, [
849
+ (x(), z(Qe, null, ot(B, (ee) => d("button", {
850
+ key: ee.key,
851
+ class: "border-picker__item",
852
+ title: I(C)(a.locale, ee.i18nKey),
853
+ onClick: (te) => S(ee.key)
854
+ }, [
855
+ (x(), z("svg", Mr, [
856
+ (x(), z(Qe, null, ot(F, (te) => d("line", {
857
+ key: te.name,
858
+ x1: te.x1,
859
+ y1: te.y1,
860
+ x2: te.x2,
861
+ y2: te.y2,
862
+ stroke: "currentColor",
863
+ "stroke-width": k(ee.key, te.name) === "thick" ? 3 : 1.5,
864
+ "stroke-dasharray": k(ee.key, te.name) === "dashed" ? "0 4" : "none",
865
+ "stroke-linecap": k(ee.key, te.name) === "dashed" ? "round" : "square"
866
+ }, null, 8, Rr)), 64))
867
+ ])),
868
+ d("span", Dr, Ye(I(C)(a.locale, ee.i18nKey)), 1)
869
+ ], 8, Sr)), 64))
870
+ ], 32)) : ye("", !0)
871
+ ]),
872
+ _: 1
873
+ })
874
+ ], 512));
875
+ }
876
+ }), Fr = /* @__PURE__ */ Vt(Tr, [["__scopeId", "data-v-c9b0ba80"]]), Ar = {
877
+ class: "tb-item",
878
+ "data-key": "undo"
879
+ }, Er = ["title", "disabled"], Or = {
880
+ class: "tb-item",
881
+ "data-key": "redo"
882
+ }, Lr = ["title", "disabled"], $r = {
883
+ class: "tb-item",
884
+ "data-key": "paint"
885
+ }, zr = ["title", "disabled"], Hr = {
886
+ class: "tb-item",
887
+ "data-key": "clear"
888
+ }, Ir = ["title", "disabled"], Wr = {
889
+ class: "tb-item",
890
+ "data-key": "font"
891
+ }, Nr = {
892
+ class: "tb-item",
893
+ "data-key": "fontSize"
894
+ }, Gr = { class: "toolbar-font-size" }, Pr = ["value", "title"], Kr = ["title"], Vr = ["title", "disabled"], Ur = ["title", "disabled"], Yr = {
895
+ class: "tb-item",
896
+ "data-key": "bold"
897
+ }, Xr = ["title", "disabled"], _r = {
898
+ class: "tb-item",
899
+ "data-key": "italic"
900
+ }, jr = ["title", "disabled"], qr = {
901
+ class: "tb-item",
902
+ "data-key": "underline"
903
+ }, Zr = ["title", "disabled"], Jr = {
904
+ class: "tb-item",
905
+ "data-key": "strike"
906
+ }, Qr = ["title", "disabled"], ei = {
907
+ class: "tb-item",
908
+ "data-key": "textColor"
909
+ }, ti = { class: "toolbar-split" }, li = ["title", "disabled"], oi = {
910
+ viewBox: "0 0 1024 1024",
911
+ fill: "currentColor"
912
+ }, ni = ["fill"], ai = ["title", "disabled"], ri = {
913
+ class: "tb-item",
914
+ "data-key": "fillColor"
915
+ }, ii = { class: "toolbar-split" }, si = ["title", "disabled"], ui = {
916
+ viewBox: "0 0 1024 1024",
917
+ fill: "currentColor"
918
+ }, ci = ["fill"], di = ["title", "disabled"], vi = {
919
+ class: "tb-item",
920
+ "data-key": "border"
921
+ }, fi = { class: "toolbar-split" }, bi = ["title", "disabled"], hi = {
922
+ viewBox: "0 0 30 30",
923
+ fill: "none",
924
+ stroke: "currentColor"
925
+ }, mi = ["x1", "y1", "x2", "y2", "stroke-width", "stroke-dasharray", "stroke-linecap"], pi = ["title", "disabled"], gi = {
926
+ class: "tb-item",
927
+ "data-key": "hAlign"
928
+ }, yi = {
929
+ class: "tb-item",
930
+ "data-key": "vAlign"
931
+ }, wi = {
932
+ class: "tb-item",
933
+ "data-key": "wrap"
934
+ }, ki = ["title"], ao = 2, Ci = 6, xi = 34, Bi = /* @__PURE__ */ Kt({
935
+ __name: "toolbar",
936
+ props: {
937
+ locale: {},
938
+ canUndo: { type: Boolean },
939
+ canRedo: { type: Boolean },
940
+ paintFmtActive: { type: Boolean },
941
+ hasSelection: { type: Boolean },
942
+ fontFamilyOptions: {},
943
+ fontSizeOptions: {},
944
+ selFontFamily: {},
945
+ selFontSize: {},
946
+ fontSizeInput: {},
947
+ fontSizeMenuOpen: { type: Boolean },
948
+ selFontWeight: { type: Boolean },
949
+ selFontStyle: { type: Boolean },
950
+ selUnderline: { type: Boolean },
951
+ selStrikethrough: { type: Boolean },
952
+ selTextColor: {},
953
+ textColorMenuOpen: { type: Boolean },
954
+ selFillColor: {},
955
+ fillColorMenuOpen: { type: Boolean },
956
+ cachedTextColor: {},
957
+ cachedFillColor: {},
958
+ borderMenuOpen: { type: Boolean },
959
+ cachedBorder: {},
960
+ selHAlign: {},
961
+ selVAlign: {},
962
+ selWrap: { type: Boolean },
963
+ hAlignOptions: {},
964
+ vAlignOptions: {}
965
+ },
966
+ emits: ["undo", "redo", "paint-format", "clear-format", "font-family-change", "font-size-input", "font-size-blur", "font-size-keydown", "font-size-change", "update:font-size-menu-open", "font-size-toggle", "font-size-step-up", "font-size-step-down", "bold-toggle", "italic-toggle", "underline-toggle", "strikethrough-toggle", "text-color-change", "update:text-color-menu-open", "fill-color-change", "update:fill-color-menu-open", "apply-text-color", "apply-fill-color", "update:border-menu-open", "border-change", "apply-border", "h-align-change", "v-align-change", "wrap-toggle"],
967
+ setup(a, { emit: p }) {
968
+ const c = [
969
+ { name: "top", x1: 4, y1: 4, x2: 26, y2: 4 },
970
+ { name: "bottom", x1: 4, y1: 26, x2: 26, y2: 26 },
971
+ { name: "left", x1: 4, y1: 4, x2: 4, y2: 26 },
972
+ { name: "right", x1: 26, y1: 4, x2: 26, y2: 26 },
973
+ { name: "vMid", x1: 15, y1: 4, x2: 15, y2: 26 },
974
+ { name: "hMid", x1: 4, y1: 15, x2: 26, y2: 15 }
975
+ ], b = {
976
+ bottom: ["bottom"],
977
+ top: ["top"],
978
+ left: ["left"],
979
+ right: ["right"],
980
+ none: [],
981
+ all: ["top", "bottom", "left", "right", "vMid", "hMid"],
982
+ outer: ["top", "bottom", "left", "right"],
983
+ thickOuter: ["top", "bottom", "left", "right"]
984
+ }, i = {
985
+ bottom: [],
986
+ top: [],
987
+ left: [],
988
+ right: [],
989
+ none: [],
990
+ all: [],
991
+ outer: [],
992
+ thickOuter: ["top", "bottom", "left", "right"]
993
+ };
994
+ function B(le, u) {
995
+ return i[le].includes(u) ? "thick" : b[le].includes(u) ? "solid" : "dashed";
996
+ }
997
+ const F = [
998
+ "undo",
999
+ "redo",
1000
+ "paint",
1001
+ "clear",
1002
+ "sep1",
1003
+ "font",
1004
+ "fontSize",
1005
+ "sep2",
1006
+ "bold",
1007
+ "italic",
1008
+ "underline",
1009
+ "strike",
1010
+ "sep3",
1011
+ "textColor",
1012
+ "fillColor",
1013
+ "border",
1014
+ "sep4",
1015
+ "hAlign",
1016
+ "vAlign",
1017
+ "wrap"
1018
+ ], m = T(null), $ = T(null), k = T(null), y = T(/* @__PURE__ */ new Set()), A = T(!1), K = T(!1), L = /* @__PURE__ */ new Map(), G = E(() => y.value.size > 0);
1019
+ function S(le) {
1020
+ return y.value.has(le);
1021
+ }
1022
+ function O() {
1023
+ if (!m.value)
1024
+ return;
1025
+ m.value.querySelectorAll(".tb-item").forEach((u) => {
1026
+ const w = u.dataset.key;
1027
+ w && L.set(w, u.offsetWidth);
1028
+ });
1029
+ }
1030
+ function Y(le, u) {
1031
+ if (le.size !== u.size)
1032
+ return !1;
1033
+ for (const w of le)
1034
+ if (!u.has(w))
1035
+ return !1;
1036
+ return !0;
1037
+ }
1038
+ function ee() {
1039
+ if (!m.value)
1040
+ return;
1041
+ const le = m.value.clientWidth - Ci * 2;
1042
+ if (le <= 0)
1043
+ return;
1044
+ L.size === 0 && O();
1045
+ let u = 0;
1046
+ for (const ue of F)
1047
+ u += (L.get(ue) ?? 0) + ao;
1048
+ const w = /* @__PURE__ */ new Set();
1049
+ if (u > le) {
1050
+ const ue = le - xi - ao;
1051
+ let V = 0;
1052
+ for (let P = 0; P < F.length; P++) {
1053
+ const D = F[P], j = (L.get(D) ?? 0) + ao;
1054
+ if (V + j > ue) {
1055
+ for (let oe = P; oe < F.length; oe++)
1056
+ w.add(F[oe]);
1057
+ break;
1058
+ }
1059
+ V += j;
1060
+ }
1061
+ }
1062
+ Y(w, y.value) || (y.value = w, w.size === 0 && (A.value = !1));
1063
+ }
1064
+ let te = null;
1065
+ const Xe = T(0), se = E(() => {
1066
+ const le = k.value;
1067
+ if (!le)
1068
+ return { position: "fixed", top: "0px", right: "0px" };
1069
+ Xe.value;
1070
+ const u = le.getBoundingClientRect();
1071
+ return {
1072
+ position: "fixed",
1073
+ top: `${u.bottom + 4}px`,
1074
+ right: `${window.innerWidth - u.right}px`
1075
+ };
1076
+ });
1077
+ function _e() {
1078
+ A.value && (Xe.value++, re(() => ee()));
1079
+ }
1080
+ function De(le) {
1081
+ var w, ue;
1082
+ if (!A.value)
1083
+ return;
1084
+ const u = le.target;
1085
+ (w = $.value) != null && w.contains(u) || (ue = k.value) != null && ue.contains(u) || (K.value = !0, A.value = !1, re(() => {
1086
+ K.value = !1;
1087
+ }));
1088
+ }
1089
+ function je() {
1090
+ A.value = !A.value;
1091
+ }
1092
+ so(() => {
1093
+ re(() => {
1094
+ O(), ee();
1095
+ }), m.value && (te = new ResizeObserver(() => {
1096
+ A.value || ee();
1097
+ }), te.observe(m.value)), document.addEventListener("mousedown", De, !0), window.addEventListener("resize", _e);
1098
+ }), ll(() => {
1099
+ te == null || te.disconnect(), document.removeEventListener("mousedown", De, !0), window.removeEventListener("resize", _e);
1100
+ });
1101
+ const H = p;
1102
+ return (le, u) => (x(), z(Qe, null, [
1103
+ d("div", {
1104
+ ref_key: "rootEl",
1105
+ ref: m,
1106
+ class: "toolbar"
1107
+ }, [
1108
+ (x(), ne(ae, {
1109
+ disabled: !S("undo"),
1110
+ to: $.value ?? void 0
1111
+ }, [
1112
+ d("div", Ar, [
1113
+ d("button", {
1114
+ class: ie(["toolbar-btn", { "toolbar-btn--disabled": !a.canUndo }]),
1115
+ title: I(C)(a.locale, "undo"),
1116
+ disabled: !a.canUndo,
1117
+ onClick: u[0] || (u[0] = (w) => H("undo"))
1118
+ }, [...u[35] || (u[35] = [
1119
+ d("svg", {
1120
+ class: "toolbar-btn__icon",
1121
+ viewBox: "0 0 1024 1024",
1122
+ fill: "currentColor"
1123
+ }, [
1124
+ d("path", { d: "M596.16 284.064H258.56l101.376-101.44a31.968 31.968 0 1 0-45.248-45.216L178.56 273.504c-11.904 11.872-18.496 27.84-18.56 44.8a63.04 63.04 0 0 0 18.56 45.28l136.128 136.16a31.904 31.904 0 0 0 45.248 0 31.968 31.968 0 0 0 0-45.248l-106.752-106.496H596.16c114.88 0 208.32 93.312 208.32 208s-93.44 208-208.32 208h-223.36a32 32 0 0 0 0 64h223.36c150.144 0 272.32-122.016 272.32-272 0-149.984-122.176-272-272.32-272" })
1125
+ ], -1)
1126
+ ])], 10, Er)
1127
+ ])
1128
+ ], 8, ["disabled", "to"])),
1129
+ (x(), ne(ae, {
1130
+ disabled: !S("redo"),
1131
+ to: $.value ?? void 0
1132
+ }, [
1133
+ d("div", Or, [
1134
+ d("button", {
1135
+ class: ie(["toolbar-btn", { "toolbar-btn--disabled": !a.canRedo }]),
1136
+ title: I(C)(a.locale, "redo"),
1137
+ disabled: !a.canRedo,
1138
+ onClick: u[1] || (u[1] = (w) => H("redo"))
1139
+ }, [...u[36] || (u[36] = [
1140
+ d("svg", {
1141
+ class: "toolbar-btn__icon",
1142
+ viewBox: "0 0 1024 1024",
1143
+ fill: "currentColor"
1144
+ }, [
1145
+ d("path", {
1146
+ transform: "translate(1024, 0) scale(-1, 1)",
1147
+ d: "M596.16 284.064H258.56l101.376-101.44a31.968 31.968 0 1 0-45.248-45.216L178.56 273.504c-11.904 11.872-18.496 27.84-18.56 44.8a63.04 63.04 0 0 0 18.56 45.28l136.128 136.16a31.904 31.904 0 0 0 45.248 0 31.968 31.968 0 0 0 0-45.248l-106.752-106.496H596.16c114.88 0 208.32 93.312 208.32 208s-93.44 208-208.32 208h-223.36a32 32 0 0 0 0 64h223.36c150.144 0 272.32-122.016 272.32-272 0-149.984-122.176-272-272.32-272"
1148
+ })
1149
+ ], -1)
1150
+ ])], 10, Lr)
1151
+ ])
1152
+ ], 8, ["disabled", "to"])),
1153
+ (x(), ne(ae, {
1154
+ disabled: !S("paint"),
1155
+ to: $.value ?? void 0
1156
+ }, [
1157
+ d("div", $r, [
1158
+ d("button", {
1159
+ class: ie(["toolbar-btn", { "toolbar-btn--active": a.paintFmtActive }]),
1160
+ title: I(C)(a.locale, "paintFormat"),
1161
+ disabled: !a.hasSelection,
1162
+ onClick: u[2] || (u[2] = (w) => H("paint-format"))
1163
+ }, [...u[37] || (u[37] = [
1164
+ d("svg", {
1165
+ class: "toolbar-btn__icon",
1166
+ viewBox: "0 0 1024 1024",
1167
+ fill: "currentColor"
1168
+ }, [
1169
+ d("path", { d: "M722.285714 438.857143a36.571429 36.571429 0 0 1-36.571428 36.571428h-512a36.571429 36.571429 0 0 1-36.571429-36.571428V164.571429a36.571429 36.571429 0 0 1 36.571429-36.571429h512a36.571429 36.571429 0 0 1 36.571428 36.571429V256h128a36.571429 36.571429 0 0 1 36.571429 36.571429v294.4a36.571429 36.571429 0 0 1-31.890286 36.278857L448 675.766857V859.428571a36.571429 36.571429 0 0 1-32.292571 36.315429l-4.278858 0.256a36.571429 36.571429 0 0 1-36.571428-36.571429v-215.771428a36.571429 36.571429 0 0 1 31.890286-36.278857l406.966857-52.553143V329.142857h-91.428572v109.714286z m-73.142857-237.714286h-438.857143V402.285714h438.857143V201.142857z" })
1170
+ ], -1)
1171
+ ])], 10, zr)
1172
+ ])
1173
+ ], 8, ["disabled", "to"])),
1174
+ (x(), ne(ae, {
1175
+ disabled: !S("clear"),
1176
+ to: $.value ?? void 0
1177
+ }, [
1178
+ d("div", Hr, [
1179
+ d("button", {
1180
+ class: ie(["toolbar-btn", { "toolbar-btn--disabled": !a.hasSelection }]),
1181
+ title: I(C)(a.locale, "clearFormat"),
1182
+ disabled: !a.hasSelection,
1183
+ onClick: u[3] || (u[3] = (w) => H("clear-format"))
1184
+ }, [...u[38] || (u[38] = [
1185
+ d("svg", {
1186
+ class: "toolbar-btn__icon",
1187
+ viewBox: "0 0 1024 1024",
1188
+ fill: "currentColor"
1189
+ }, [
1190
+ d("path", { d: "M672.748 105.674c-3.666-3.799-8.778-5.949-14.125-5.949-5.341 0-10.459 2.15-14.119 5.949L10.418 754.633c-7.789 8.163-7.789 20.798 0 28.967l123.353 126.213c7.782 7.979 23.113 14.461 34.111 14.461h395.042c12.774-0.742 24.882-5.854 34.162-14.461l416.525-426.362c7.751-8.163 7.751-20.76 0-28.916l-340.92-348.861h0.057zM557.85 832.801c-9.273 8.582-21.343 13.707-34.111 14.461H217.888c-12.781-0.742-24.882-5.867-34.162-14.461l-58.074-59.482c-7.782-8.163-7.782-20.804 0-28.967l232.333-237.87c3.666-3.799 8.778-5.949 14.125-5.949s10.453 2.15 14.119 5.949l231.102 236.551c7.744 8.157 7.744 20.753 0 28.916l-59.539 60.909 0.058-0.057z m0 0" })
1191
+ ], -1)
1192
+ ])], 10, Ir)
1193
+ ])
1194
+ ], 8, ["disabled", "to"])),
1195
+ (x(), ne(ae, {
1196
+ disabled: !S("sep1"),
1197
+ to: $.value ?? void 0
1198
+ }, [
1199
+ u[39] || (u[39] = d("div", {
1200
+ class: "tb-item",
1201
+ "data-key": "sep1"
1202
+ }, [
1203
+ d("div", { class: "toolbar-sep" })
1204
+ ], -1))
1205
+ ], 8, ["disabled", "to"])),
1206
+ (x(), ne(ae, {
1207
+ disabled: !S("font"),
1208
+ to: $.value ?? void 0
1209
+ }, [
1210
+ d("div", Wr, [
1211
+ ke(El, {
1212
+ class: "toolbar-font",
1213
+ "model-value": a.selFontFamily,
1214
+ options: a.fontFamilyOptions,
1215
+ width: 110,
1216
+ "visible-count": 8,
1217
+ title: I(C)(a.locale, "fontFamily"),
1218
+ onChange: u[4] || (u[4] = (w) => H("font-family-change", w))
1219
+ }, null, 8, ["model-value", "options", "title"])
1220
+ ])
1221
+ ], 8, ["disabled", "to"])),
1222
+ (x(), ne(ae, {
1223
+ disabled: !S("fontSize"),
1224
+ to: $.value ?? void 0
1225
+ }, [
1226
+ d("div", Nr, [
1227
+ d("div", Gr, [
1228
+ d("input", {
1229
+ class: "toolbar-font-size__input",
1230
+ type: "number",
1231
+ min: "5",
1232
+ max: "72",
1233
+ step: "1",
1234
+ value: a.fontSizeInput,
1235
+ title: I(C)(a.locale, "fontSize"),
1236
+ onInput: u[5] || (u[5] = (w) => H("font-size-input", w.target.value)),
1237
+ onBlur: u[6] || (u[6] = (w) => H("font-size-blur")),
1238
+ onKeydown: u[7] || (u[7] = (w) => H("font-size-keydown", w))
1239
+ }, null, 40, Pr),
1240
+ ke(El, {
1241
+ class: "toolbar-font-size__dropdown",
1242
+ "model-value": a.selFontSize,
1243
+ options: a.fontSizeOptions,
1244
+ width: 56,
1245
+ "menu-width": 56,
1246
+ "visible-count": 9,
1247
+ title: I(C)(a.locale, "fontSize"),
1248
+ "hide-trigger": !0,
1249
+ "model-open": a.fontSizeMenuOpen,
1250
+ "onUpdate:modelOpen": u[8] || (u[8] = (w) => H("update:font-size-menu-open", w)),
1251
+ onChange: u[9] || (u[9] = (w) => H("font-size-change", w))
1252
+ }, null, 8, ["model-value", "options", "title", "model-open"]),
1253
+ d("button", {
1254
+ class: "toolbar-font-size__btn",
1255
+ type: "button",
1256
+ title: I(C)(a.locale, "fontSize"),
1257
+ onMousedown: u[10] || (u[10] = he(() => {
1258
+ }, ["prevent"])),
1259
+ onClick: u[11] || (u[11] = (w) => H("font-size-toggle"))
1260
+ }, [...u[40] || (u[40] = [
1261
+ d("svg", {
1262
+ viewBox: "0 0 1024 1024",
1263
+ fill: "currentColor"
1264
+ }, [
1265
+ d("path", { d: "M180.053333 361.386667a32 32 0 0 1 45.226667 0L512 648.106667l286.72-286.72a32 32 0 1 1 45.226667 45.226666l-309.333334 309.333334a32 32 0 0 1-45.226666 0L180.053333 406.613333a32 32 0 0 1 0-45.226666z" })
1266
+ ], -1)
1267
+ ])], 40, Kr),
1268
+ d("button", {
1269
+ class: "toolbar-btn toolbar-btn--step",
1270
+ type: "button",
1271
+ title: I(C)(a.locale, "fontSizeDecrease"),
1272
+ disabled: !a.hasSelection,
1273
+ onMousedown: u[12] || (u[12] = he(() => {
1274
+ }, ["prevent"])),
1275
+ onClick: u[13] || (u[13] = (w) => H("font-size-step-down"))
1276
+ }, [...u[41] || (u[41] = [
1277
+ d("svg", {
1278
+ viewBox: "0 0 1024 1024",
1279
+ fill: "currentColor"
1280
+ }, [
1281
+ d("path", { d: "M481.28 125.95a29.506 29.506 0 0 0-27.45-18.7h-63.34c-12.13 0-23.02 7.42-27.45 18.7L67.94 876.46c-7.61 19.35 6.66 40.29 27.45 40.29h35.47c12.26 0 23.24-7.58 27.58-19.04l80.89-213.35h364.54l81.94 213.46a29.51 29.51 0 0 0 27.54 18.93h35.56c20.8 0 35.06-20.94 27.45-40.29L481.28 125.95zM273.47 594.06l145.38-384.38h2.2l147.58 384.38H273.47zM928.64 195.74h-177c-16.29 0-29.5 13.21-29.5 29.5s13.21 29.5 29.5 29.5h177c16.29 0 29.5-13.21 29.5-29.5s-13.21-29.5-29.5-29.5z" })
1282
+ ], -1)
1283
+ ])], 40, Vr),
1284
+ d("button", {
1285
+ class: "toolbar-btn toolbar-btn--step",
1286
+ type: "button",
1287
+ title: I(C)(a.locale, "fontSizeIncrease"),
1288
+ disabled: !a.hasSelection,
1289
+ onMousedown: u[14] || (u[14] = he(() => {
1290
+ }, ["prevent"])),
1291
+ onClick: u[15] || (u[15] = (w) => H("font-size-step-up"))
1292
+ }, [...u[42] || (u[42] = [
1293
+ d("svg", {
1294
+ viewBox: "0 0 1024 1024",
1295
+ fill: "currentColor"
1296
+ }, [
1297
+ d("path", { d: "M481.28 125.95a29.506 29.506 0 0 0-27.45-18.7h-63.34c-12.13 0-23.02 7.42-27.45 18.7L67.94 876.46c-7.61 19.35 6.66 40.29 27.45 40.29h35.47c12.26 0 23.24-7.58 27.58-19.04l80.89-213.35h364.54l81.94 213.46a29.51 29.51 0 0 0 27.54 18.93h35.56c20.8 0 35.06-20.94 27.45-40.29L481.28 125.95zM273.47 594.06l145.38-384.38h2.2l147.58 384.38H273.47zM928.64 195.74h-59v-59c0-16.29-13.21-29.5-29.5-29.5s-29.5 13.21-29.5 29.5v59h-59c-16.29 0-29.5 13.21-29.5 29.5s13.21 29.5 29.5 29.5h59v59c0 16.29 13.21 29.5 29.5 29.5s29.5-13.21 29.5-29.5v-59h59c16.29 0 29.5-13.21 29.5-29.5s-13.21-29.5-29.5-29.5z" })
1298
+ ], -1)
1299
+ ])], 40, Ur)
1300
+ ])
1301
+ ])
1302
+ ], 8, ["disabled", "to"])),
1303
+ (x(), ne(ae, {
1304
+ disabled: !S("sep2"),
1305
+ to: $.value ?? void 0
1306
+ }, [
1307
+ u[43] || (u[43] = d("div", {
1308
+ class: "tb-item",
1309
+ "data-key": "sep2"
1310
+ }, [
1311
+ d("div", { class: "toolbar-sep" })
1312
+ ], -1))
1313
+ ], 8, ["disabled", "to"])),
1314
+ (x(), ne(ae, {
1315
+ disabled: !S("bold"),
1316
+ to: $.value ?? void 0
1317
+ }, [
1318
+ d("div", Yr, [
1319
+ d("button", {
1320
+ class: ie(["toolbar-btn", { "toolbar-btn--active": a.selFontWeight }]),
1321
+ title: I(C)(a.locale, "bold"),
1322
+ disabled: !a.hasSelection,
1323
+ onClick: u[16] || (u[16] = (w) => H("bold-toggle"))
1324
+ }, [...u[44] || (u[44] = [
1325
+ d("svg", {
1326
+ viewBox: "0 0 1024 1024",
1327
+ fill: "currentColor"
1328
+ }, [
1329
+ d("g", { transform: "translate(102.4, 102.4) scale(0.8)" }, [
1330
+ d("path", { d: "M733.610667 467.712A267.562667 267.562667 0 0 0 548.010667 10.581333H183.466667a53.333333 53.333333 0 0 0 0 106.666667h43.221333a10.666667 10.666667 0 0 1 10.666667 10.666667V896a10.666667 10.666667 0 0 1-10.666667 10.666667H183.466667a53.333333 53.333333 0 1 0 0 106.666666h425.088a287.658667 287.658667 0 0 0 125.013333-545.536z m-185.6-350.464a160.512 160.512 0 0 1 0 320.981333H354.688a10.666667 10.666667 0 0 1-10.666667-10.666666V128a10.666667 10.666667 0 0 1 10.666667-10.666667z m60.586666 789.333333H354.688a10.666667 10.666667 0 0 1-10.666667-10.666666v-340.352a10.666667 10.666667 0 0 1 10.666667-10.666667H608.597333a180.864 180.864 0 0 1 0 361.685333z" })
1331
+ ])
1332
+ ], -1)
1333
+ ])], 10, Xr)
1334
+ ])
1335
+ ], 8, ["disabled", "to"])),
1336
+ (x(), ne(ae, {
1337
+ disabled: !S("italic"),
1338
+ to: $.value ?? void 0
1339
+ }, [
1340
+ d("div", _r, [
1341
+ d("button", {
1342
+ class: ie(["toolbar-btn", { "toolbar-btn--active": a.selFontStyle }]),
1343
+ title: I(C)(a.locale, "italic"),
1344
+ disabled: !a.hasSelection,
1345
+ onClick: u[17] || (u[17] = (w) => H("italic-toggle"))
1346
+ }, [...u[45] || (u[45] = [
1347
+ d("svg", {
1348
+ viewBox: "0 0 1024 1024",
1349
+ fill: "currentColor"
1350
+ }, [
1351
+ d("g", { transform: "translate(102.4, 102.4) scale(0.8)" }, [
1352
+ d("path", { d: "M960 10.581333h-325.845333a53.333333 53.333333 0 0 0 0 106.666667h46.336a10.666667 10.666667 0 0 1 9.002666 16.384L203.946667 896.725333a21.333333 21.333333 0 0 1-18.005334 9.856H64a53.333333 53.333333 0 0 0 0 106.666667h325.845333a53.333333 53.333333 0 0 0 0-106.666667H343.509333a10.666667 10.666667 0 0 1-9.002666-16.384L820.053333 127.146667a21.333333 21.333333 0 0 1 18.005334-9.898667H960a53.333333 53.333333 0 0 0 0-106.666667z" })
1353
+ ])
1354
+ ], -1)
1355
+ ])], 10, jr)
1356
+ ])
1357
+ ], 8, ["disabled", "to"])),
1358
+ (x(), ne(ae, {
1359
+ disabled: !S("underline"),
1360
+ to: $.value ?? void 0
1361
+ }, [
1362
+ d("div", qr, [
1363
+ d("button", {
1364
+ class: ie(["toolbar-btn", { "toolbar-btn--active": a.selUnderline }]),
1365
+ title: I(C)(a.locale, "underline"),
1366
+ disabled: !a.hasSelection,
1367
+ onClick: u[18] || (u[18] = (w) => H("underline-toggle"))
1368
+ }, [...u[46] || (u[46] = [
1369
+ d("svg", {
1370
+ viewBox: "0 0 1024 1024",
1371
+ fill: "currentColor"
1372
+ }, [
1373
+ d("g", { transform: "translate(102.4, 102.4) scale(0.8)" }, [
1374
+ d("path", { d: "M960 906.581333h-896a53.333333 53.333333 0 0 0 0 106.666667h896a53.333333 53.333333 0 0 0 0-106.666667zM84.394667 117.248h58.154666a10.666667 10.666667 0 0 1 10.666667 10.666667v363.648a358.784 358.784 0 0 0 717.568 0V128a10.666667 10.666667 0 0 1 10.666667-10.666667h58.154666a53.333333 53.333333 0 0 0 0-106.666666H695.466667a53.333333 53.333333 0 0 0 0 106.666666h58.154666a10.666667 10.666667 0 0 1 10.666667 10.666667v363.648a252.117333 252.117333 0 0 1-504.234667 0V128a10.666667 10.666667 0 0 1 10.666667-10.666667H328.533333a53.333333 53.333333 0 1 0 0-106.666666H84.394667a53.333333 53.333333 0 0 0 0 106.666666z" })
1375
+ ])
1376
+ ], -1)
1377
+ ])], 10, Zr)
1378
+ ])
1379
+ ], 8, ["disabled", "to"])),
1380
+ (x(), ne(ae, {
1381
+ disabled: !S("strike"),
1382
+ to: $.value ?? void 0
1383
+ }, [
1384
+ d("div", Jr, [
1385
+ d("button", {
1386
+ class: ie(["toolbar-btn", { "toolbar-btn--active": a.selStrikethrough }]),
1387
+ title: I(C)(a.locale, "strikethrough"),
1388
+ disabled: !a.hasSelection,
1389
+ onClick: u[19] || (u[19] = (w) => H("strikethrough-toggle"))
1390
+ }, [...u[47] || (u[47] = [
1391
+ d("svg", {
1392
+ viewBox: "0 0 1024 1024",
1393
+ fill: "currentColor"
1394
+ }, [
1395
+ d("g", { transform: "translate(102.4, 102.4) scale(0.8)" }, [
1396
+ d("path", { d: "M1013.333333 552.618667A53.333333 53.333333 0 0 0 960 499.2h-381.269333a20.992 20.992 0 0 1-12.032-3.84c-30.805333-21.888-63.232-41.856-94.634667-61.098667-119.466667-73.173333-192-123.733333-192-207.488 0-95.36 94.165333-109.610667 150.314667-109.610666a193.706667 193.706667 0 0 1 131.456 32.597333 113.578667 113.578667 0 0 1 19.072 84.906667v12.8a53.333333 53.333333 0 1 0 106.666666 0v-11.434667a208.512 208.512 0 0 0-49.706666-161.152C595.157333 31.616 527.317333 10.581333 430.549333 10.581333c-156.074667 0-256.981333 84.864-256.981333 216.277334 0 118.314667 80.725333 192.512 170.666667 252.885333a10.666667 10.666667 0 0 1-5.930667 19.541333H64a53.333333 53.333333 0 0 0 0 106.666667h468.352a10.709333 10.709333 0 0 1 6.784 2.474667 185.130667 185.130667 0 0 1 82.432 147.882666c0 139.434667-146.176 150.272-191.018667 150.272-77.397333 0-133.930667-17.28-163.584-50.048a144.810667 144.810667 0 0 1-27.733333-115.2 53.333333 53.333333 0 0 0-106.154667-10.496A245.76 245.76 0 0 0 187.733333 928.128c51.2 56.490667 132.864 85.333333 242.688 85.333333 178.090667 0 297.685333-103.253333 297.685334-256.938666a258.517333 258.517333 0 0 0-36.224-134.272 10.666667 10.666667 0 0 1 9.216-16.085334H960a53.333333 53.333333 0 0 0 53.333333-53.546666z" })
1397
+ ])
1398
+ ], -1)
1399
+ ])], 10, Qr)
1400
+ ])
1401
+ ], 8, ["disabled", "to"])),
1402
+ (x(), ne(ae, {
1403
+ disabled: !S("sep3"),
1404
+ to: $.value ?? void 0
1405
+ }, [
1406
+ u[48] || (u[48] = d("div", {
1407
+ class: "tb-item",
1408
+ "data-key": "sep3"
1409
+ }, [
1410
+ d("div", { class: "toolbar-sep" })
1411
+ ], -1))
1412
+ ], 8, ["disabled", "to"])),
1413
+ (x(), ne(ae, {
1414
+ disabled: !S("textColor"),
1415
+ to: $.value ?? void 0
1416
+ }, [
1417
+ d("div", ei, [
1418
+ d("div", ti, [
1419
+ d("button", {
1420
+ class: "toolbar-btn toolbar-split__main",
1421
+ title: I(C)(a.locale, "fontColor"),
1422
+ disabled: !a.hasSelection,
1423
+ onClick: u[20] || (u[20] = (w) => H("apply-text-color"))
1424
+ }, [
1425
+ (x(), z("svg", oi, [
1426
+ u[49] || (u[49] = d("g", { transform: "translate(102.4, 102.4) scale(0.8)" }, [
1427
+ d("path", { d: "M663.120842 529.946947H364.759579l-84.07579 212.884211a53.894737 53.894737 0 0 1-50.122105 34.169263h-14.551579a34.869895 34.869895 0 0 1-32.498526-47.696842L443.715368 70.063158a53.894737 53.894737 0 0 1 50.122106-34.115369h41.768421a53.894737 53.894737 0 0 1 50.176 34.277053l257.670737 659.078737a34.977684 34.977684 0 0 1-32.552421 47.696842h-14.389895a53.894737 53.894737 0 0 1-50.229895-34.277053l-83.159579-212.776421z m-35.139368-89.788631l-113.340632-289.953684-114.472421 289.953684h227.813053z" })
1428
+ ], -1)),
1429
+ d("path", {
1430
+ d: "M62.895 844.369m53.895 0l790.474 0q53.895 0 53.895 53.895l0 26.947q0 53.895-53.895 53.895l-790.474 0q-53.895 0-53.895-53.895l0-26.947q0-53.895 53.895-53.895z",
1431
+ fill: a.cachedTextColor || "#000000"
1432
+ }, null, 8, ni)
1433
+ ]))
1434
+ ], 8, li),
1435
+ d("button", {
1436
+ class: "toolbar-btn toolbar-split__arrow",
1437
+ title: I(C)(a.locale, "fontColor"),
1438
+ disabled: !a.hasSelection,
1439
+ onClick: u[21] || (u[21] = (w) => H("update:text-color-menu-open", !a.textColorMenuOpen))
1440
+ }, [...u[50] || (u[50] = [
1441
+ d("svg", {
1442
+ viewBox: "0 0 1024 1024",
1443
+ fill: "currentColor"
1444
+ }, [
1445
+ d("path", { d: "M180.053 361.387a32 32 0 0 1 45.227 0L512 648.107l286.72-286.72a32 32 0 1 1 45.227 45.227l-309.334 309.333a32 32 0 0 1-45.226 0L180.053 406.613a32 32 0 0 1 0-45.226z" })
1446
+ ], -1)
1447
+ ])], 8, ai),
1448
+ ke(_o, {
1449
+ "model-open": a.textColorMenuOpen,
1450
+ "color-key": "text",
1451
+ "current-color": a.selTextColor,
1452
+ locale: a.locale,
1453
+ "onUpdate:modelOpen": u[22] || (u[22] = (w) => H("update:text-color-menu-open", w)),
1454
+ onChange: u[23] || (u[23] = (w) => H("text-color-change", w))
1455
+ }, null, 8, ["model-open", "current-color", "locale"])
1456
+ ])
1457
+ ])
1458
+ ], 8, ["disabled", "to"])),
1459
+ (x(), ne(ae, {
1460
+ disabled: !S("fillColor"),
1461
+ to: $.value ?? void 0
1462
+ }, [
1463
+ d("div", ri, [
1464
+ d("div", ii, [
1465
+ d("button", {
1466
+ class: "toolbar-btn toolbar-split__main",
1467
+ title: I(C)(a.locale, "fillColor"),
1468
+ disabled: !a.hasSelection,
1469
+ onClick: u[24] || (u[24] = (w) => H("apply-fill-color"))
1470
+ }, [
1471
+ (x(), z("svg", ui, [
1472
+ u[51] || (u[51] = d("path", { d: "M447.018667 37.952l352.298666 352.298667c6.613333 6.613333 6.613333 17.344 0 23.957333L446.101333 767.424a16.938667 16.938667 0 0 1-23.957333 0L121.429333 466.688a16.938667 16.938667 0 0 1 0-23.957333L428.608 135.552 388.992 96a8.469333 8.469333 0 0 1 0-11.989333l46.058667-46.037334a8.469333 8.469333 0 0 1 11.968 0z m346.325333 517.461333l57.514667 60.074667c31.744 33.194667 31.744 86.997333 0 120.192a78.869333 78.869333 0 0 1-115.008 0c-31.765333-33.194667-31.765333-86.997333 0-120.192l57.493333-60.074667zM486.101333 193.066667l-261.12 261.12 20.458667 20.458666 380.16-1.728 70.186667-70.186666-209.706667-209.664z" }, null, -1)),
1473
+ d("path", {
1474
+ d: "M85.333333 853.333333m8.896 0l835.541334 0q8.896 0 8.896 8.896l0 110.208q0 8.896-8.896 8.896l-835.541334 0q-8.896 0-8.896-8.896l0-110.208q0-8.896 8.896-8.896Z",
1475
+ fill: a.cachedFillColor || "currentColor"
1476
+ }, null, 8, ci)
1477
+ ]))
1478
+ ], 8, si),
1479
+ d("button", {
1480
+ class: "toolbar-btn toolbar-split__arrow",
1481
+ title: I(C)(a.locale, "fillColor"),
1482
+ disabled: !a.hasSelection,
1483
+ onClick: u[25] || (u[25] = (w) => H("update:fill-color-menu-open", !a.fillColorMenuOpen))
1484
+ }, [...u[52] || (u[52] = [
1485
+ d("svg", {
1486
+ viewBox: "0 0 1024 1024",
1487
+ fill: "currentColor"
1488
+ }, [
1489
+ d("path", { d: "M180.053 361.387a32 32 0 0 1 45.227 0L512 648.107l286.72-286.72a32 32 0 1 1 45.227 45.227l-309.334 309.333a32 32 0 0 1-45.226 0L180.053 406.613a32 32 0 0 1 0-45.226z" })
1490
+ ], -1)
1491
+ ])], 8, di),
1492
+ ke(_o, {
1493
+ "model-open": a.fillColorMenuOpen,
1494
+ "color-key": "fill",
1495
+ "current-color": a.selFillColor,
1496
+ locale: a.locale,
1497
+ "onUpdate:modelOpen": u[26] || (u[26] = (w) => H("update:fill-color-menu-open", w)),
1498
+ onChange: u[27] || (u[27] = (w) => H("fill-color-change", w))
1499
+ }, null, 8, ["model-open", "current-color", "locale"])
1500
+ ])
1501
+ ])
1502
+ ], 8, ["disabled", "to"])),
1503
+ (x(), ne(ae, {
1504
+ disabled: !S("border"),
1505
+ to: $.value ?? void 0
1506
+ }, [
1507
+ d("div", vi, [
1508
+ d("div", fi, [
1509
+ d("button", {
1510
+ class: "toolbar-btn toolbar-split__main",
1511
+ title: I(C)(a.locale, "borders"),
1512
+ disabled: !a.hasSelection,
1513
+ onClick: u[28] || (u[28] = (w) => H("apply-border"))
1514
+ }, [
1515
+ (x(), z("svg", hi, [
1516
+ (x(), z(Qe, null, ot(c, (w) => d("line", {
1517
+ key: w.name,
1518
+ x1: w.x1,
1519
+ y1: w.y1,
1520
+ x2: w.x2,
1521
+ y2: w.y2,
1522
+ "stroke-width": B(a.cachedBorder, w.name) === "thick" ? 3 : 1.5,
1523
+ "stroke-dasharray": B(a.cachedBorder, w.name) === "dashed" ? "0 4" : "none",
1524
+ "stroke-linecap": B(a.cachedBorder, w.name) === "dashed" ? "round" : "square"
1525
+ }, null, 8, mi)), 64))
1526
+ ]))
1527
+ ], 8, bi),
1528
+ d("button", {
1529
+ class: "toolbar-btn toolbar-split__arrow",
1530
+ title: I(C)(a.locale, "borders"),
1531
+ disabled: !a.hasSelection,
1532
+ onClick: u[29] || (u[29] = (w) => H("update:border-menu-open", !a.borderMenuOpen))
1533
+ }, [...u[53] || (u[53] = [
1534
+ d("svg", {
1535
+ viewBox: "0 0 1024 1024",
1536
+ fill: "currentColor"
1537
+ }, [
1538
+ d("path", { d: "M180.053 361.387a32 32 0 0 1 45.227 0L512 648.107l286.72-286.72a32 32 0 1 1 45.227 45.227l-309.334 309.333a32 32 0 0 1-45.226 0L180.053 406.613a32 32 0 0 1 0-45.226z" })
1539
+ ], -1)
1540
+ ])], 8, pi),
1541
+ ke(Fr, {
1542
+ "model-open": a.borderMenuOpen,
1543
+ locale: a.locale,
1544
+ "current-border": a.cachedBorder,
1545
+ "onUpdate:modelOpen": u[30] || (u[30] = (w) => H("update:border-menu-open", w)),
1546
+ onChange: u[31] || (u[31] = (w) => H("border-change", w))
1547
+ }, null, 8, ["model-open", "locale", "current-border"])
1548
+ ])
1549
+ ])
1550
+ ], 8, ["disabled", "to"])),
1551
+ (x(), ne(ae, {
1552
+ disabled: !S("sep4"),
1553
+ to: $.value ?? void 0
1554
+ }, [
1555
+ u[54] || (u[54] = d("div", {
1556
+ class: "tb-item",
1557
+ "data-key": "sep4"
1558
+ }, [
1559
+ d("div", { class: "toolbar-sep" })
1560
+ ], -1))
1561
+ ], 8, ["disabled", "to"])),
1562
+ (x(), ne(ae, {
1563
+ disabled: !S("hAlign"),
1564
+ to: $.value ?? void 0
1565
+ }, [
1566
+ d("div", gi, [
1567
+ ke(El, {
1568
+ class: "toolbar-align",
1569
+ "model-value": a.selHAlign,
1570
+ options: a.hAlignOptions,
1571
+ width: 44,
1572
+ "visible-count": 3,
1573
+ align: "right",
1574
+ title: I(C)(a.locale, "hAlign"),
1575
+ onChange: u[32] || (u[32] = (w) => H("h-align-change", w))
1576
+ }, null, 8, ["model-value", "options", "title"])
1577
+ ])
1578
+ ], 8, ["disabled", "to"])),
1579
+ (x(), ne(ae, {
1580
+ disabled: !S("vAlign"),
1581
+ to: $.value ?? void 0
1582
+ }, [
1583
+ d("div", yi, [
1584
+ ke(El, {
1585
+ class: "toolbar-align",
1586
+ "model-value": a.selVAlign,
1587
+ options: a.vAlignOptions,
1588
+ width: 44,
1589
+ "visible-count": 3,
1590
+ align: "right",
1591
+ title: I(C)(a.locale, "vAlign"),
1592
+ onChange: u[33] || (u[33] = (w) => H("v-align-change", w))
1593
+ }, null, 8, ["model-value", "options", "title"])
1594
+ ]),
1595
+ d("div", wi, [
1596
+ d("button", {
1597
+ class: ie(["toolbar-btn", { "toolbar-btn--active": a.selWrap }]),
1598
+ type: "button",
1599
+ title: I(C)(a.locale, "wrap"),
1600
+ onClick: u[34] || (u[34] = (w) => H("wrap-toggle"))
1601
+ }, [...u[55] || (u[55] = [
1602
+ d("svg", {
1603
+ viewBox: "0 0 1024 1024",
1604
+ fill: "currentColor"
1605
+ }, [
1606
+ d("path", { d: "M896 179.2a38.4 38.4 0 0 0-76.8 0v665.6a38.4 38.4 0 0 0 76.8 0v-665.6zM204.8 281.6A38.4 38.4 0 0 0 204.8 358.4h179.2a38.4 38.4 0 0 0 0-76.8H204.8zM550.4 281.6a38.4 38.4 0 0 0 0 76.8h51.2c35.328 0 64 28.672 64 64v179.2c0 35.328-28.672 64-64 64H246.272l36.864-36.864a38.4 38.4 0 1 0-54.272-54.272l-102.4 102.4a38.4 38.4 0 0 0 0 54.272l102.4 102.4a38.4 38.4 0 0 0 54.272-54.272l-36.864-36.864h355.328a140.8 140.8 0 0 0 140.8-140.8v-179.2a140.8 140.8 0 0 0-140.8-140.8h-51.2z" })
1607
+ ], -1)
1608
+ ])], 10, ki)
1609
+ ])
1610
+ ], 8, ["disabled", "to"])),
1611
+ G.value ? (x(), z("button", {
1612
+ key: 0,
1613
+ ref_key: "moreBtnEl",
1614
+ ref: k,
1615
+ class: ie(["toolbar-more", { "toolbar-more--active": A.value }]),
1616
+ type: "button",
1617
+ onClick: je
1618
+ }, [...u[56] || (u[56] = [
1619
+ d("svg", {
1620
+ viewBox: "0 0 1024 1024",
1621
+ fill: "currentColor"
1622
+ }, [
1623
+ d("circle", {
1624
+ cx: "512",
1625
+ cy: "160",
1626
+ r: "96"
1627
+ }),
1628
+ d("circle", {
1629
+ cx: "512",
1630
+ cy: "512",
1631
+ r: "96"
1632
+ }),
1633
+ d("circle", {
1634
+ cx: "512",
1635
+ cy: "864",
1636
+ r: "96"
1637
+ })
1638
+ ], -1)
1639
+ ])], 2)) : ye("", !0)
1640
+ ], 512),
1641
+ (x(), ne(ae, { to: "body" }, [
1642
+ ke(Nt, { name: "menu-pop" }, {
1643
+ default: Gt(() => [
1644
+ qa(d("div", {
1645
+ ref_key: "overflowMenuEl",
1646
+ ref: $,
1647
+ class: ie(["overflow-menu", { "no-anim": K.value }]),
1648
+ style: Le(se.value)
1649
+ }, null, 6), [
1650
+ [Za, A.value]
1651
+ ])
1652
+ ]),
1653
+ _: 1
1654
+ })
1655
+ ]))
1656
+ ], 64));
1657
+ }
1658
+ }), Si = /* @__PURE__ */ Vt(Bi, [["__scopeId", "data-v-1bf472fc"]]), Mi = { class: "tab-list" }, Ri = ["onClick", "onDblclick", "onContextmenu"], Di = ["value"], Ti = {
1659
+ key: 1,
1660
+ class: "tab-item__name"
1661
+ }, Fi = ["title"], Ai = /* @__PURE__ */ Kt({
1662
+ __name: "tabbar",
1663
+ props: {
1664
+ locale: {},
1665
+ sheets: {},
1666
+ activeSheetIndex: {},
1667
+ renTab: {},
1668
+ renTabVal: {}
1669
+ },
1670
+ emits: ["tab-click", "tab-dblclick", "tab-contextmenu", "tab-rename-input", "tab-rename-keydown", "tab-rename-commit", "tabbar-contextmenu", "add-sheet"],
1671
+ setup(a, { emit: p }) {
1672
+ const c = p;
1673
+ return (b, i) => (x(), z("div", {
1674
+ class: "tab-bar",
1675
+ onContextmenu: i[5] || (i[5] = (B) => c("tabbar-contextmenu", B))
1676
+ }, [
1677
+ d("div", Mi, [
1678
+ (x(!0), z(Qe, null, ot(a.sheets, (B, F) => (x(), z("div", {
1679
+ key: B.id,
1680
+ class: ie(["tab-item", { "tab-item--active": F === a.activeSheetIndex }]),
1681
+ onClick: (m) => c("tab-click", F),
1682
+ onDblclick: he((m) => c("tab-dblclick", F), ["prevent"]),
1683
+ onContextmenu: (m) => c("tab-contextmenu", { ev: m, i: F })
1684
+ }, [
1685
+ a.renTab === F ? (x(), z("input", {
1686
+ key: 0,
1687
+ class: "tab-rename-input",
1688
+ value: a.renTabVal,
1689
+ onInput: i[0] || (i[0] = (m) => c("tab-rename-input", m.target.value)),
1690
+ onKeydown: i[1] || (i[1] = (m) => c("tab-rename-keydown", m)),
1691
+ onBlur: i[2] || (i[2] = (m) => c("tab-rename-commit")),
1692
+ onClick: i[3] || (i[3] = he(() => {
1693
+ }, ["stop"]))
1694
+ }, null, 40, Di)) : (x(), z("span", Ti, Ye(B.name), 1))
1695
+ ], 42, Ri))), 128))
1696
+ ]),
1697
+ d("button", {
1698
+ class: "tab-bar__add-btn",
1699
+ title: I(C)(a.locale, "addSheet"),
1700
+ onClick: i[4] || (i[4] = (B) => c("add-sheet"))
1701
+ }, " + ", 8, Fi)
1702
+ ], 32));
1703
+ }
1704
+ }), Ei = /* @__PURE__ */ Vt(Ai, [["__scopeId", "data-v-49f54625"]]);
1705
+ function Ue(a) {
1706
+ let p = "", c = a;
147
1707
  do
148
- f = String.fromCharCode(65 + s % 26) + f, s = Math.floor(s / 26) - 1;
149
- while (s >= 0);
150
- return f;
1708
+ p = String.fromCharCode(65 + c % 26) + p, c = Math.floor(c / 26) - 1;
1709
+ while (c >= 0);
1710
+ return p;
151
1711
  }
152
- function Kt(u) {
153
- let f = 0;
154
- for (let s = 0; s < u.length; s++)
155
- f = f * 26 + (u.toUpperCase().charCodeAt(s) - 64);
156
- return f - 1;
1712
+ function io(a) {
1713
+ let p = 0;
1714
+ for (let c = 0; c < a.length; c++)
1715
+ p = p * 26 + (a.toUpperCase().charCodeAt(c) - 64);
1716
+ return p - 1;
157
1717
  }
158
- function Se(u) {
159
- if (u == null)
1718
+ function wt(a) {
1719
+ if (a == null)
160
1720
  return null;
161
- if (typeof u == "number")
162
- return u;
163
- if (typeof u == "string") {
164
- const f = parseFloat(u);
165
- return u.endsWith("%") || isNaN(f) ? null : f;
1721
+ if (typeof a == "number")
1722
+ return a;
1723
+ if (typeof a == "string") {
1724
+ const p = parseFloat(a);
1725
+ return a.endsWith("%") || isNaN(p) ? null : p;
166
1726
  }
167
1727
  return null;
168
1728
  }
169
- function jt(u) {
170
- navigator.clipboard.writeText(u).catch(() => {
171
- const f = document.createElement("textarea");
172
- f.value = u, f.style.position = "fixed", f.style.opacity = "0", document.body.appendChild(f), f.select(), document.execCommand("copy"), document.body.removeChild(f);
1729
+ function ro(a) {
1730
+ navigator.clipboard.writeText(a).catch(() => {
1731
+ const p = document.createElement("textarea");
1732
+ p.value = a, p.style.position = "fixed", p.style.opacity = "0", document.body.appendChild(p), p.select(), document.execCommand("copy"), document.body.removeChild(p);
173
1733
  });
174
1734
  }
175
- function Xe(u, f) {
176
- return `${u},${f}`;
1735
+ function Pt(a, p) {
1736
+ return `${a},${p}`;
177
1737
  }
178
- function ht(u, f, s) {
179
- const c = u.match(/^\$?([A-Z]+)\$?(\d+)$/i);
180
- if (!c)
1738
+ function Ol(a, p, c) {
1739
+ const b = a.match(/^\$?([A-Z]+)\$?(\d+)$/i);
1740
+ if (!b)
181
1741
  return null;
182
- const r = Kt(c[1]), m = parseInt(c[2], 10) - 1;
183
- return r < 0 || r >= f || m < 0 || m >= s ? null : { col: r, row: m };
1742
+ const i = io(b[1]), B = parseInt(b[2], 10) - 1;
1743
+ return i < 0 || i >= p || B < 0 || B >= c ? null : { col: i, row: B };
184
1744
  }
185
- function ke(u, f) {
186
- if (!f)
1745
+ function kt(a, p) {
1746
+ if (!p)
187
1747
  return { x: 0, y: 0 };
188
- const s = f.getBoundingClientRect();
189
- return { x: u.clientX - s.left, y: u.clientY - s.top };
1748
+ const c = p.getBoundingClientRect();
1749
+ return { x: a.clientX - c.left, y: a.clientY - c.top };
190
1750
  }
191
- function An(u, f, s) {
192
- const c = u.split(":");
193
- if (c.length !== 2)
1751
+ function Oi(a, p, c) {
1752
+ const b = a.split(":");
1753
+ if (b.length !== 2)
194
1754
  return null;
195
- const r = ht(c[0], f, s), m = ht(c[1], f, s);
196
- return !r || !m ? null : {
197
- sc: Math.min(r.col, m.col),
198
- sr: Math.min(r.row, m.row),
199
- ec: Math.max(r.col, m.col),
200
- er: Math.max(r.row, m.row)
1755
+ const i = Ol(b[0], p, c), B = Ol(b[1], p, c);
1756
+ return !i || !B ? null : {
1757
+ sc: Math.min(i.col, B.col),
1758
+ sr: Math.min(i.row, B.row),
1759
+ ec: Math.max(i.col, B.col),
1760
+ er: Math.max(i.row, B.row)
201
1761
  };
202
1762
  }
203
- function Nn(u, f, s, c, r) {
204
- const m = s[Xe(u, f)];
205
- if (!m)
1763
+ function Li(a, p, c, b, i) {
1764
+ const B = c[Pt(a, p)];
1765
+ if (!B)
206
1766
  return 0;
207
- const k = m.value;
208
- if (k.startsWith("="))
209
- return Bl(Xe(u, f), s, c, r) ?? 0;
210
- const b = parseFloat(k);
211
- return isNaN(b) ? 0 : b;
1767
+ const F = B.value;
1768
+ if (F.startsWith("="))
1769
+ return Zo(Pt(a, p), c, b, i) ?? 0;
1770
+ const m = parseFloat(F);
1771
+ return isNaN(m) ? 0 : m;
212
1772
  }
213
- const Oe = /* @__PURE__ */ new Map();
214
- function yl() {
215
- Oe.clear();
1773
+ const Wt = /* @__PURE__ */ new Map();
1774
+ function jo() {
1775
+ Wt.clear();
216
1776
  }
217
- function Bl(u, f, s, c) {
218
- return Ln(u, f, s, c);
1777
+ function Zo(a, p, c, b) {
1778
+ return $i(a, p, c, b);
219
1779
  }
220
- function Ln(u, f, s, c, r) {
221
- if (Oe.has(u))
1780
+ function $i(a, p, c, b, i) {
1781
+ if (Wt.has(a))
222
1782
  return NaN;
223
- Oe.set(u, NaN);
224
- const m = f[u];
225
- if (!m)
1783
+ Wt.set(a, NaN);
1784
+ const B = p[a];
1785
+ if (!B)
226
1786
  return NaN;
227
- const k = m.value;
228
- if (!k.startsWith("=")) {
229
- const g = parseFloat(k), h = isNaN(g) ? 0 : g;
230
- return Oe.set(u, h), h;
1787
+ const F = B.value;
1788
+ if (!F.startsWith("=")) {
1789
+ const k = parseFloat(F), y = isNaN(k) ? 0 : k;
1790
+ return Wt.set(a, y), y;
231
1791
  }
232
- const b = k.slice(1).trim();
233
- if (b.toUpperCase().startsWith("SUM(") && b.endsWith(")")) {
234
- const g = b.slice(4, -1).trim(), h = An(g, s, c);
235
- if (h) {
236
- let R = 0;
237
- for (let O = h.sc; O <= h.ec; O++)
238
- for (let H = h.sr; H <= h.er; H++)
239
- R += Nn(O, H, f, s, c);
240
- return isNaN(R) ? NaN : (Oe.set(u, R), R);
1792
+ const m = F.slice(1).trim();
1793
+ if (m.toUpperCase().startsWith("SUM(") && m.endsWith(")")) {
1794
+ const k = m.slice(4, -1).trim(), y = Oi(k, c, b);
1795
+ if (y) {
1796
+ let A = 0;
1797
+ for (let K = y.sc; K <= y.ec; K++)
1798
+ for (let L = y.sr; L <= y.er; L++)
1799
+ A += Li(K, L, p, c, b);
1800
+ return isNaN(A) ? NaN : (Wt.set(a, A), A);
241
1801
  }
242
1802
  return NaN;
243
1803
  }
244
1804
  return NaN;
245
1805
  }
246
- function xl(u, f, s) {
247
- const c = [], r = /(\$?[A-Z]+\$?\d+)(?::(\$?[A-Z]+\$?\d+))?/gi;
248
- let m;
249
- for (; (m = r.exec(u)) !== null; ) {
250
- const k = ht(m[1], f, s);
251
- if (k)
252
- if (m[2]) {
253
- const b = ht(m[2], f, s);
254
- if (!b)
1806
+ function Jo(a, p, c) {
1807
+ const b = [], i = /(\$?[A-Z]+\$?\d+)(?::(\$?[A-Z]+\$?\d+))?/gi;
1808
+ let B;
1809
+ for (; (B = i.exec(a)) !== null; ) {
1810
+ const F = Ol(B[1], p, c);
1811
+ if (F)
1812
+ if (B[2]) {
1813
+ const m = Ol(B[2], p, c);
1814
+ if (!m)
255
1815
  continue;
256
- for (let Y = Math.min(k.col, b.col); Y <= Math.max(k.col, b.col); Y++)
257
- for (let g = Math.min(k.row, b.row); g <= Math.max(k.row, b.row); g++)
258
- c.push(Xe(Y, g));
1816
+ for (let $ = Math.min(F.col, m.col); $ <= Math.max(F.col, m.col); $++)
1817
+ for (let k = Math.min(F.row, m.row); k <= Math.max(F.row, m.row); k++)
1818
+ b.push(Pt($, k));
259
1819
  } else
260
- c.push(Xe(k.col, k.row));
1820
+ b.push(Pt(F.col, F.row));
261
1821
  }
262
- return c;
1822
+ return b;
263
1823
  }
264
- function Fn(u, f, s, c, r) {
265
- const m = s[Xe(u, f)];
266
- if (!m)
1824
+ function zi(a, p, c, b, i) {
1825
+ const B = c[Pt(a, p)];
1826
+ if (!B)
267
1827
  return "";
268
- const k = m.value;
269
- if (!k.startsWith("="))
270
- return k;
271
- const b = Bl(Xe(u, f), s, c, r);
272
- return isNaN(b) ? "#ERROR" : String(b);
1828
+ const F = B.value;
1829
+ if (!F.startsWith("="))
1830
+ return F;
1831
+ const m = Zo(Pt(a, p), c, b, i);
1832
+ return isNaN(m) ? "#ERROR" : String(m);
273
1833
  }
274
- function On(u, f, s, c, r, m) {
275
- return f === 0 && s === 0 ? u : u.replace(
1834
+ function Hi(a, p, c, b, i, B) {
1835
+ return p === 0 && c === 0 ? a : a.replace(
276
1836
  /(\$?)([A-Z]+)(\$?)(\d+)/gi,
277
- (k, b, Y, g, h) => {
278
- const R = b ? Kt(Y) : Kt(Y) + f, O = g ? parseInt(h, 10) - 1 : parseInt(h, 10) - 1 + s;
279
- let H;
280
- R < 0 ? H = "A" : R >= c ? H = m(c - 1) : H = m(R);
281
- let E;
282
- return O < 0 ? E = "1" : O >= r ? E = String(r) : E = String(O + 1), (b || "") + H + (g || "") + E;
1837
+ (F, m, $, k, y) => {
1838
+ const A = m ? io($) : io($) + p, K = k ? parseInt(y, 10) - 1 : parseInt(y, 10) - 1 + c;
1839
+ let L;
1840
+ A < 0 ? L = "A" : A >= b ? L = B(b - 1) : L = B(A);
1841
+ let G;
1842
+ return K < 0 ? G = "1" : K >= i ? G = String(i) : G = String(K + 1), (m || "") + L + (k || "") + G;
283
1843
  }
284
1844
  );
285
1845
  }
286
- class Xn {
1846
+ class Ii {
287
1847
  constructor() {
288
1848
  this.deps = /* @__PURE__ */ new Map(), this.rev = /* @__PURE__ */ new Map(), this.dirty = /* @__PURE__ */ new Set();
289
1849
  }
290
- clear(f) {
291
- var c;
292
- const s = this.deps.get(f);
293
- if (s) {
294
- for (const r of s)
295
- (c = this.rev.get(r)) == null || c.delete(f);
296
- this.deps.delete(f);
1850
+ clear(p) {
1851
+ var b;
1852
+ const c = this.deps.get(p);
1853
+ if (c) {
1854
+ for (const i of c)
1855
+ (b = this.rev.get(i)) == null || b.delete(p);
1856
+ this.deps.delete(p);
297
1857
  }
298
1858
  }
299
- set(f, s) {
300
- if (this.clear(f), s.length !== 0) {
301
- this.deps.set(f, s);
302
- for (const c of s)
303
- this.rev.has(c) || this.rev.set(c, /* @__PURE__ */ new Set()), this.rev.get(c).add(f);
1859
+ set(p, c) {
1860
+ if (this.clear(p), c.length !== 0) {
1861
+ this.deps.set(p, c);
1862
+ for (const b of c)
1863
+ this.rev.has(b) || this.rev.set(b, /* @__PURE__ */ new Set()), this.rev.get(b).add(p);
304
1864
  }
305
1865
  }
306
- markDirty(f) {
307
- const s = [f];
308
- for (; s.length > 0; ) {
309
- const c = s.pop(), r = this.rev.get(c);
310
- if (r)
311
- for (const m of r)
312
- this.dirty.has(m) || (this.dirty.add(m), s.push(m));
1866
+ markDirty(p) {
1867
+ const c = [p];
1868
+ for (; c.length > 0; ) {
1869
+ const b = c.pop(), i = this.rev.get(b);
1870
+ if (i)
1871
+ for (const B of i)
1872
+ this.dirty.has(B) || (this.dirty.add(B), c.push(B));
313
1873
  }
314
1874
  }
315
1875
  getDirtyAndClear() {
316
- const f = this.dirty;
317
- return this.dirty = /* @__PURE__ */ new Set(), f;
1876
+ const p = this.dirty;
1877
+ return this.dirty = /* @__PURE__ */ new Set(), p;
318
1878
  }
319
1879
  /** 从 cells 快照重建所有依赖关系 */
320
- rebuild(f, s, c) {
321
- this.deps.clear(), this.rev.clear(), this.dirty.clear(), Oe.clear();
322
- for (const [r, m] of Object.entries(f))
323
- if (m.value.startsWith("=")) {
324
- const k = xl(m.value.slice(1), s, c);
325
- this.set(r, k);
1880
+ rebuild(p, c, b) {
1881
+ this.deps.clear(), this.rev.clear(), this.dirty.clear(), Wt.clear();
1882
+ for (const [i, B] of Object.entries(p))
1883
+ if (B.value.startsWith("=")) {
1884
+ const F = Jo(B.value.slice(1), c, b);
1885
+ this.set(i, F);
326
1886
  }
327
1887
  }
328
1888
  }
329
- function Yn(u, f, s, c) {
330
- const r = {}, m = c(f), k = c(s);
331
- return m != null && (r.width = `${m}px`), k != null && (r.height = `${k}px`), r["--sp-formula-bar-bg"] = u.formulaBarBg, r["--sp-formula-bar-border"] = u.formulaBarBorder, r["--sp-formula-bar-label-color"] = u.formulaBarLabelText, r["--sp-formula-bar-label-bg"] = u.formulaBarLabelBg, r["--sp-formula-bar-label-border"] = u.formulaBarLabelBorder, r["--sp-formula-bar-input-bg"] = u.formulaBarInputBg, r["--sp-formula-bar-input-border"] = u.formulaBarInputBorder, r["--sp-formula-bar-input-color"] = u.formulaBarInputText, r["--sp-formula-bar-input-focus-border"] = u.formulaBarInputFocusBorder, r["--sp-formula-bar-input-focus-shadow"] = u.formulaBarInputFocusShadow, r["--sp-wrapper-bg"] = u.wrapperBg, r["--sp-cell-editor-border"] = u.cellEditorBorder, r["--sp-cell-editor-color"] = u.cellEditorText, r["--sp-cell-editor-bg"] = u.cellEditorBg, r["--sp-cell-editor-shadow"] = u.cellEditorShadow, r["--sp-tab-bar-bg"] = u.tabBarBg, r["--sp-tab-bar-border"] = u.tabBarBorder, r["--sp-tab-active-bg"] = u.tabActiveBg, r["--sp-tab-active-color"] = u.tabActiveText, r["--sp-tab-active-border"] = u.tabActiveBorder, r["--sp-tab-inactive-bg"] = u.tabInactiveBg, r["--sp-tab-inactive-color"] = u.tabInactiveText, r["--sp-tab-inactive-border"] = u.tabInactiveBorder, r["--sp-tab-hover-bg"] = u.tabHoverBg, r["--sp-tab-add-btn-color"] = u.tabAddBtnColor, r["--sp-tab-add-btn-hover-bg"] = u.tabAddBtnHoverBg, r["--sp-tab-scroll-btn-color"] = u.tabScrollBtnColor, r["--sp-tab-scroll-btn-hover-bg"] = u.tabScrollBtnHoverBg, r["--sp-scroll-thumb"] = u.scrollbarThumb, r["--sp-scroll-thumb-hover"] = u.scrollbarThumbHover, r["--sp-scroll-btn-bg"] = u.scrollBtnBg, r["--sp-scroll-btn-color"] = u.scrollBtnColor, r["--sp-scroll-btn-hover-bg"] = u.scrollBtnHoverBg, r["--sp-scroll-btn-active-bg"] = u.scrollBtnActiveBg, r["--sp-scroll-track-bg"] = u.scrollTrackBg, r;
1889
+ function Wi(a, p, c, b) {
1890
+ const i = {}, B = b(p), F = b(c);
1891
+ return B != null && (i.width = `${B}px`), F != null && (i.height = `${F}px`), i["--sp-formula-bar-bg"] = a.formulaBarBg, i["--sp-formula-bar-border"] = a.formulaBarBorder, i["--sp-formula-bar-label-color"] = a.formulaBarLabelText, i["--sp-formula-bar-label-bg"] = a.formulaBarLabelBg, i["--sp-formula-bar-label-border"] = a.formulaBarLabelBorder, i["--sp-formula-bar-input-bg"] = a.formulaBarInputBg, i["--sp-formula-bar-input-border"] = a.formulaBarInputBorder, i["--sp-formula-bar-input-color"] = a.formulaBarInputText, i["--sp-formula-bar-input-focus-border"] = a.formulaBarInputFocusBorder, i["--sp-formula-bar-input-focus-shadow"] = a.formulaBarInputFocusShadow, i["--sp-wrapper-bg"] = a.wrapperBg, i["--sp-cell-editor-border"] = a.cellEditorBorder, i["--sp-cell-editor-color"] = a.cellEditorText, i["--sp-cell-editor-bg"] = a.cellEditorBg, i["--sp-cell-editor-shadow"] = a.cellEditorShadow, i["--sp-tab-bar-bg"] = a.tabBarBg, i["--sp-tab-bar-border"] = a.tabBarBorder, i["--sp-tab-active-bg"] = a.tabActiveBg, i["--sp-tab-active-color"] = a.tabActiveText, i["--sp-tab-active-border"] = a.tabActiveBorder, i["--sp-tab-inactive-bg"] = a.tabInactiveBg, i["--sp-tab-inactive-color"] = a.tabInactiveText, i["--sp-tab-inactive-border"] = a.tabInactiveBorder, i["--sp-tab-hover-bg"] = a.tabHoverBg, i["--sp-tab-add-btn-color"] = a.tabAddBtnColor, i["--sp-tab-add-btn-hover-bg"] = a.tabAddBtnHoverBg, i["--sp-tab-scroll-btn-color"] = a.tabScrollBtnColor, i["--sp-tab-scroll-btn-hover-bg"] = a.tabScrollBtnHoverBg, i["--sp-scroll-thumb"] = a.scrollbarThumb, i["--sp-scroll-thumb-hover"] = a.scrollbarThumbHover, i["--sp-scroll-btn-bg"] = a.scrollBtnBg, i["--sp-scroll-btn-color"] = a.scrollBtnColor, i["--sp-scroll-btn-hover-bg"] = a.scrollBtnHoverBg, i["--sp-scroll-btn-active-bg"] = a.scrollBtnActiveBg, i["--sp-scroll-track-bg"] = a.scrollTrackBg, i["--sp-toolbar-bg"] = a.toolbarBg, i["--sp-toolbar-border"] = a.toolbarBorder, i["--sp-toolbar-btn-color"] = a.toolbarBtnColor, i["--sp-toolbar-btn-hover-bg"] = a.toolbarBtnHoverBg, i["--sp-toolbar-btn-disabled-color"] = a.toolbarBtnDisabledColor, i["--sp-toolbar-btn-active-color"] = a.toolbarBtnActiveColor, i;
332
1892
  }
333
- const Un = { class: "tab-list" }, jn = ["onClick", "onDblclick", "onContextmenu"], Kn = ["value"], Pn = {
334
- key: 1,
335
- class: "tab-item__name"
336
- }, zn = ["title"], Vn = { class: "formula-bar" }, Jn = { class: "formula-bar__cell-label" }, Zn = ["value"], qn = ["value"], Gn = ["title"], Qn = ["title"], eo = ["title"], to = ["title"], lo = {
1893
+ const Ni = { class: "formula-bar" }, Gi = { class: "formula-bar__cell-label" }, Pi = ["value"], Ki = ["value"], Vi = ["title"], Ui = ["title"], Yi = ["title"], Xi = ["title"], _i = {
337
1894
  key: 2,
338
1895
  class: "sb-corner"
339
- }, no = ["onClick", "onMouseenter"], oo = { class: "context-menu__label" }, ao = {
1896
+ }, ji = ["onClick", "onMouseenter"], qi = { class: "context-menu__label" }, Zi = {
340
1897
  key: 0,
341
1898
  class: "context-menu__arrow"
342
- }, ro = ["onClick"], uo = /* @__PURE__ */ kn({
1899
+ }, Ji = ["onClick"], Qi = { class: "dim-panel__title" }, es = { class: "dim-panel__body" }, ts = ["value"], ls = {
1900
+ key: 0,
1901
+ class: "dim-panel__error"
1902
+ }, os = { class: "dim-panel__footer" }, ns = "\0", qo = "#444", as = /* @__PURE__ */ Kt({
343
1903
  __name: "spreader",
344
- props: /* @__PURE__ */ _n({
1904
+ props: /* @__PURE__ */ Qa({
345
1905
  rowCount: { default: 200 },
346
1906
  colCount: { default: 26 },
347
1907
  width: {},
@@ -353,173 +1913,548 @@ const Un = { class: "tab-list" }, jn = ["onClick", "onDblclick", "onContextmenu"
353
1913
  dataModifiers: {}
354
1914
  }),
355
1915
  emits: ["update:data"],
356
- setup(u) {
357
- const f = u, s = I(() => f.locale === "zh-CN" ? "zh-CN" : "en-US"), c = f.colCount, r = f.rowCount, m = Rn(u, "data");
358
- let k = "";
359
- const b = wl({}), Y = new Xn(), g = N(null), h = N({ col: 0, row: 0 }), R = N(null), O = N(""), H = N(new Array(c).fill(Je)), E = N(new Array(r).fill(Ze)), M = N(0), T = N(0), he = I(() => {
1916
+ setup(a) {
1917
+ const p = a, c = E(() => p.locale === "zh-CN" ? "zh-CN" : "en-US"), b = p.colCount, i = p.rowCount, B = Ja(a, "data");
1918
+ let F = "";
1919
+ const m = Yo({}), $ = new Ii(), k = T(null), y = T({ col: 0, row: 0 }), A = T(null), K = T(""), L = T(new Array(b).fill(It)), G = T(new Array(i).fill(void 0)), S = T(0), O = T(0), Y = (Xo - dt) / 2, ee = /* @__PURE__ */ new Map();
1920
+ let te = null;
1921
+ function Xe(e, t, l, n) {
1922
+ const o = `${n} ${l} ${t}px ${e}`, r = ee.get(o);
1923
+ if (r)
1924
+ return r;
1925
+ te || (te = document.createElement("canvas"));
1926
+ const s = te.getContext("2d");
1927
+ if (!s)
1928
+ return { ascent: t * 0.8, descent: t * 0.2 };
1929
+ s.font = o;
1930
+ const f = s.measureText("M"), h = f.actualBoundingBoxAscent, R = f.actualBoundingBoxDescent, fe = h || t * 0.8, de = R || t * 0.2, ve = Math.max(fe, t * 0.5), J = Math.max(de, t * 0.15), pe = { ascent: ve, descent: J };
1931
+ return ee.set(o, pe), pe;
1932
+ }
1933
+ function se(e, t, l, n) {
1934
+ if (!t)
1935
+ return [""];
1936
+ const o = t.split(`
1937
+ `), r = [];
1938
+ for (const s of o)
1939
+ if (!n || l <= 0)
1940
+ r.push(s);
1941
+ else {
1942
+ let f = "";
1943
+ for (let h = 0; h < s.length; h++) {
1944
+ const R = s[h], fe = f + R;
1945
+ e.measureText(fe).width > l && f ? (r.push(f), f = R) : f = fe;
1946
+ }
1947
+ r.push(f);
1948
+ }
1949
+ return r;
1950
+ }
1951
+ function _e(e, t) {
1952
+ var n;
1953
+ const l = (n = m[D(e, t)]) == null ? void 0 : n.style;
1954
+ return typeof (l == null ? void 0 : l.fontSize) == "number" && l.fontSize > 0 ? l.fontSize : dt;
1955
+ }
1956
+ const De = E(() => {
360
1957
  const e = [0];
361
- for (let t = 0; t < c; t++)
362
- e.push(e[t] + H.value[t]);
1958
+ for (let t = 0; t < b; t++)
1959
+ e.push(e[t] + L.value[t]);
363
1960
  return e;
364
- }), pe = I(() => {
1961
+ });
1962
+ function je(e) {
1963
+ var fe;
1964
+ const t = G.value[e];
1965
+ if (t != null && t > 0)
1966
+ return t;
1967
+ let l = dt, n = l * 0.8, o = l * 0.2, r = 1;
1968
+ const s = te ? te.getContext("2d") : null;
1969
+ for (let de = 0; de < b; de++) {
1970
+ const ve = _e(de, e), J = (fe = m[D(de, e)]) == null ? void 0 : fe.style, pe = typeof (J == null ? void 0 : J.fontFamily) == "string" && J.fontFamily ? J.fontFamily : no, Ne = (J == null ? void 0 : J.fontWeight) === "bold" ? "bold" : "normal", ut = (J == null ? void 0 : J.fontStyle) === "italic" ? "italic" : "normal", Ae = Ct(de, e);
1971
+ if (Ae && s) {
1972
+ s.font = `${ut} ${Ne} ${ve}px ${pe}`;
1973
+ const Ge = Ae.split(`
1974
+ `)[0] || Ae, ct = s.measureText(Ge), we = ct.actualBoundingBoxAscent, qe = ct.actualBoundingBoxDescent, gt = we || ve * 0.8, Pe = qe || ve * 0.2, Ke = Math.max(gt, ve * 0.5), M = Math.max(Pe, ve * 0.15);
1975
+ Ke > n && (n = Ke), M > o && (o = M), ve > l && (l = ve);
1976
+ const X = (J == null ? void 0 : J.wrap) === "wrap";
1977
+ let U;
1978
+ if (X) {
1979
+ const be = L.value[de];
1980
+ U = se(s, Ae, Math.max(0, be - 10), !0).length, U > r && (r = U);
1981
+ } else
1982
+ U = Ae.split(`
1983
+ `).length, U > r && (r = U);
1984
+ } else if (ve > l) {
1985
+ l = ve;
1986
+ const Ge = Xe(pe, ve, Ne, ut);
1987
+ Ge.ascent > n && (n = Ge.ascent), Ge.descent > o && (o = Ge.descent);
1988
+ }
1989
+ }
1990
+ const f = l, h = Y * 2 + r * f;
1991
+ return Math.min(tl, Math.max(Xo, Math.round(h)));
1992
+ }
1993
+ const H = E(() => {
365
1994
  const e = [0];
366
- for (let t = 0; t < r; t++)
367
- e.push(e[t] + E.value[t]);
1995
+ for (let t = 0; t < i; t++)
1996
+ e.push(e[t] + je(t));
368
1997
  return e;
369
- }), pt = I(() => he.value[c]), bt = I(() => pe.value[r]);
370
- function ee(e, t) {
371
- h.value = { col: e, row: t }, g.value = { startCol: e, startRow: t, endCol: e, endRow: t };
372
- }
373
- function te(e, t, n, l) {
374
- h.value = { col: e, row: t }, g.value = {
375
- startCol: Math.min(e, n),
376
- startRow: Math.min(t, l),
377
- endCol: Math.max(e, n),
378
- endRow: Math.max(t, l)
1998
+ }), le = E(() => De.value[b]), u = E(() => H.value[i]);
1999
+ function w(e, t) {
2000
+ y.value = { col: e, row: t }, k.value = { startCol: e, startRow: t, endCol: e, endRow: t };
2001
+ }
2002
+ function ue(e, t, l, n) {
2003
+ y.value = { col: e, row: t }, k.value = {
2004
+ startCol: Math.min(e, l),
2005
+ startRow: Math.min(t, n),
2006
+ endCol: Math.max(e, l),
2007
+ endRow: Math.max(t, n)
379
2008
  };
380
2009
  }
381
- function mt() {
382
- te(0, 0, c - 1, r - 1);
2010
+ function V() {
2011
+ ue(0, 0, b - 1, i - 1);
383
2012
  }
384
- function Pt(e, t) {
385
- const n = g.value;
386
- return n ? e >= n.startCol && e <= n.endCol && t >= n.startRow && t <= n.endRow : !1;
2013
+ function P(e, t) {
2014
+ const l = k.value;
2015
+ return l ? e >= l.startCol && e <= l.endCol && t >= l.startRow && t <= l.endRow : !1;
387
2016
  }
388
- function L(e, t) {
2017
+ function D(e, t) {
389
2018
  return `${e},${t}`;
390
2019
  }
391
- function X(e) {
392
- Reflect.deleteProperty(b, e);
2020
+ function j(e) {
2021
+ Reflect.deleteProperty(m, e);
393
2022
  }
394
- function Re(e, t) {
395
- var n;
396
- return ((n = b[L(e, t)]) == null ? void 0 : n.value) ?? "";
2023
+ function oe(e, t) {
2024
+ var l;
2025
+ return ((l = m[D(e, t)]) == null ? void 0 : l.value) ?? "";
397
2026
  }
398
- function Cl(e, t) {
399
- return yl(), Fn(e, t, b, c, r);
2027
+ function Ct(e, t) {
2028
+ return jo(), zi(e, t, m, b, i);
400
2029
  }
401
- function Me(e, t, n) {
402
- var d;
403
- const l = L(e, t);
404
- if (yl(), n === "" || n == null) {
405
- Y.clear(l), X(l), Y.markDirty(l);
2030
+ function nt(e, t, l) {
2031
+ var s;
2032
+ const n = D(e, t);
2033
+ if (jo(), l === "" || l == null) {
2034
+ $.clear(n), j(n), $.markDirty(n);
406
2035
  return;
407
2036
  }
408
- const o = String(n), a = ((d = b[l]) == null ? void 0 : d.style) ?? null;
409
- b[l] = { value: o, style: a }, o.startsWith("=") ? Y.set(l, xl(o.slice(1), c, r)) : Y.clear(l), Y.markDirty(l);
2037
+ const o = String(l), r = ((s = m[n]) == null ? void 0 : s.style) ?? null;
2038
+ m[n] = { value: o, style: r }, o.startsWith("=") ? $.set(n, Jo(o.slice(1), b, i)) : $.clear(n), $.markDirty(n);
410
2039
  }
411
- function zt(e, t, n, l) {
2040
+ function uo(e, t, l, n) {
412
2041
  for (let o = e; o <= t; o++)
413
- for (let a = n; a <= l; a++) {
414
- const d = L(o, a);
415
- Y.clear(d), X(d), Y.markDirty(d);
2042
+ for (let r = l; r <= n; r++) {
2043
+ const s = D(o, r);
2044
+ $.clear(s), j(s), $.markDirty(s);
416
2045
  }
417
2046
  }
418
- function ve(e) {
419
- R.value || (R.value = { ...h.value }, O.value = e ?? Re(h.value.col, h.value.row));
2047
+ function at(e) {
2048
+ A.value || (A.value = { ...y.value }, K.value = e ?? oe(y.value.col, y.value.row));
420
2049
  }
421
- function be() {
422
- R.value && (Me(R.value.col, R.value.row, O.value), R.value = null, O.value = "");
2050
+ function rt() {
2051
+ A.value && (q(), nt(A.value.col, A.value.row, K.value), A.value = null, K.value = "");
423
2052
  }
424
- function me() {
425
- R.value = null, O.value = "";
2053
+ function vt() {
2054
+ A.value = null, K.value = "";
426
2055
  }
427
- function ie(e, t) {
428
- ee(
429
- Math.max(0, Math.min(c - 1, h.value.col + e)),
430
- Math.max(0, Math.min(r - 1, h.value.row + t))
2056
+ function et(e, t) {
2057
+ w(
2058
+ Math.max(0, Math.min(b - 1, y.value.col + e)),
2059
+ Math.max(0, Math.min(i - 1, y.value.row + t))
431
2060
  );
432
2061
  }
433
- function W(e, t) {
434
- const n = Math.max(0, U.w - w - Q), l = Math.max(0, U.h - y - Q), o = he.value[e], a = pe.value[t], d = H.value[e], p = E.value[t];
435
- let B = M.value, S = T.value;
436
- o < B ? B = o : o + d > B + n && (B = o + d - n), a < S ? S = a : a + p > S + l && (S = a + p - l), z(B, S);
2062
+ function ce(e, t) {
2063
+ const l = Math.max(0, ge.w - W - Oe), n = Math.max(0, ge.h - N - Oe), o = De.value[e], r = H.value[t], s = L.value[e], f = je(t);
2064
+ let h = S.value, R = O.value;
2065
+ o < h ? h = o : o + s > h + l && (h = o + s - l), r < R ? R = r : r + f > R + n && (R = r + f - n), Ce(h, R);
437
2066
  }
438
- function le(e) {
439
- const t = he.value;
440
- if (e < 0 || e >= t[c])
2067
+ function $e(e) {
2068
+ const t = De.value;
2069
+ if (e < 0 || e >= t[b])
441
2070
  return -1;
442
- let n = 0, l = c - 1;
443
- for (; n < l; ) {
444
- const o = n + l + 1 >> 1;
445
- t[o] <= e ? n = o : l = o - 1;
2071
+ let l = 0, n = b - 1;
2072
+ for (; l < n; ) {
2073
+ const o = l + n + 1 >> 1;
2074
+ t[o] <= e ? l = o : n = o - 1;
446
2075
  }
447
- return n;
2076
+ return l;
448
2077
  }
449
- function ne(e) {
450
- const t = pe.value;
451
- if (e < 0 || e >= t[r])
2078
+ function ze(e) {
2079
+ const t = H.value;
2080
+ if (e < 0 || e >= t[i])
452
2081
  return -1;
453
- let n = 0, l = r - 1;
454
- for (; n < l; ) {
455
- const o = n + l + 1 >> 1;
456
- t[o] <= e ? n = o : l = o - 1;
2082
+ let l = 0, n = i - 1;
2083
+ for (; l < n; ) {
2084
+ const o = l + n + 1 >> 1;
2085
+ t[o] <= e ? l = o : n = o - 1;
457
2086
  }
458
- return n;
2087
+ return l;
459
2088
  }
460
- const de = N([]), qe = N([]);
461
- function gt() {
462
- const e = {};
463
- for (const [t, n] of Object.entries(b))
464
- e[t] = { value: n.value, style: n.style };
465
- return { cells: e, colWidths: [...H.value], rowHeights: [...E.value] };
2089
+ const tt = T([]), Ut = T([]);
2090
+ function co(e) {
2091
+ const t = {};
2092
+ for (const [l, n] of Object.entries(e))
2093
+ t[l] = { value: n.value, style: n.style };
2094
+ return t;
466
2095
  }
467
- function Vt(e) {
468
- Object.keys(b).forEach((t) => X(t)), Object.assign(b, e.cells), H.value = e.colWidths, E.value = e.rowHeights, Y.rebuild(b, c, r);
2096
+ function Ll() {
2097
+ return xt(), {
2098
+ sheets: Z.value.map((e) => ({
2099
+ id: e.id,
2100
+ name: e.name,
2101
+ cells: co(e.cells),
2102
+ selection: e.selection ? { ...e.selection } : null,
2103
+ activeCell: e.activeCell ? { ...e.activeCell } : { col: 0, row: 0 },
2104
+ scrollX: e.scrollX,
2105
+ scrollY: e.scrollY,
2106
+ colWidths: [...e.colWidths],
2107
+ rowHeights: [...e.rowHeights]
2108
+ })),
2109
+ activeSheetIndex: Se.value
2110
+ };
469
2111
  }
470
- function K() {
471
- const e = gt(), t = de.value[de.value.length - 1];
472
- t && JSON.stringify(t) === JSON.stringify(e) || (de.value.push(e), qe.value = [], de.value.length > En && de.value.shift());
2112
+ function vo(e) {
2113
+ Z.value = e.sheets.map((t) => ({ ...t, cells: co(t.cells) })), st(Math.max(0, Math.min(e.activeSheetIndex, Z.value.length - 1))), $.rebuild(m, b, i);
473
2114
  }
474
- function Sl() {
475
- de.value.length && (qe.value.push(gt()), Vt(de.value.pop()), g.value = null, v());
2115
+ function q() {
2116
+ const e = Ll(), t = tt.value[tt.value.length - 1];
2117
+ t && JSON.stringify(t) === JSON.stringify(e) || (tt.value.push(e), Ut.value = [], tt.value.length > er && tt.value.shift());
476
2118
  }
477
- function kl() {
478
- qe.value.length && (de.value.push(gt()), Vt(qe.value.pop()), g.value = null, v());
2119
+ function fo() {
2120
+ tt.value.length && (Ut.value.push(Ll()), vo(tt.value.pop()), g(), re(Q));
479
2121
  }
480
- let Jt = null;
481
- function Ge() {
482
- const e = g.value;
2122
+ function bo() {
2123
+ Ut.value.length && (tt.value.push(Ll()), vo(Ut.value.pop()), g(), re(Q));
2124
+ }
2125
+ const Qo = E(() => tt.value.length > 0), en = E(() => Ut.value.length > 0), tn = E(() => !!k.value), ft = T(null);
2126
+ function ln() {
2127
+ var l;
2128
+ const e = k.value;
483
2129
  if (!e)
484
2130
  return;
485
- Jt = { ...e };
2131
+ const t = {};
2132
+ for (let n = e.startCol; n <= e.endCol; n++)
2133
+ for (let o = e.startRow; o <= e.endRow; o++)
2134
+ t[`${n - e.startCol},${o - e.startRow}`] = ((l = m[D(n, o)]) == null ? void 0 : l.style) ?? null;
2135
+ ft.value = { styles: t };
2136
+ }
2137
+ function on() {
2138
+ var l;
2139
+ const e = ft.value, t = k.value;
2140
+ if (!(!e || !t)) {
2141
+ q();
2142
+ for (let n = t.startCol; n <= t.endCol; n++)
2143
+ for (let o = t.startRow; o <= t.endRow; o++) {
2144
+ const r = e.styles[`${n - t.startCol},${o - t.startRow}`] ?? null, s = D(n, o), f = ((l = m[s]) == null ? void 0 : l.value) ?? "";
2145
+ f === "" && r === null ? j(s) : m[s] = { value: f, style: r };
2146
+ }
2147
+ ft.value = null, g(), Q();
2148
+ }
2149
+ }
2150
+ function nn() {
2151
+ var t;
2152
+ const e = k.value;
2153
+ if (e) {
2154
+ q();
2155
+ for (let l = e.startCol; l <= e.endCol; l++)
2156
+ for (let n = e.startRow; n <= e.endRow; n++) {
2157
+ const o = D(l, n), r = ((t = m[o]) == null ? void 0 : t.value) ?? "";
2158
+ r === "" ? j(o) : m[o] = { value: r, style: null };
2159
+ }
2160
+ g(), Q();
2161
+ }
2162
+ }
2163
+ const an = E(
2164
+ () => lr.map((e) => ({ ...e, label: e.value === "" ? C(c.value, "fontDefault") : e.label }))
2165
+ ), rn = E(
2166
+ () => or.map((e) => ({ ...e, label: String(e.value) }))
2167
+ ), sn = E(() => {
2168
+ var n;
2169
+ const e = k.value;
2170
+ if (!e)
2171
+ return "";
2172
+ let t, l = !1;
2173
+ for (let o = e.startCol; o <= e.endCol && !l; o++)
2174
+ for (let r = e.startRow; r <= e.endRow && !l; r++) {
2175
+ const s = (n = m[D(o, r)]) == null ? void 0 : n.style, f = typeof (s == null ? void 0 : s.fontFamily) == "string" ? s.fontFamily : "";
2176
+ t === void 0 ? t = f : f !== t && (l = !0);
2177
+ }
2178
+ return l ? ns : t ?? "";
2179
+ }), Te = E(() => {
2180
+ const e = k.value;
2181
+ if (!e)
2182
+ return dt;
2183
+ let t, l = !1;
2184
+ for (let n = e.startCol; n <= e.endCol && !l; n++)
2185
+ for (let o = e.startRow; o <= e.endRow && !l; o++) {
2186
+ const r = _e(n, o);
2187
+ t === void 0 ? t = r : r !== t && (l = !0);
2188
+ }
2189
+ return l ? 0 : t ?? dt;
2190
+ });
2191
+ function me(e, t) {
2192
+ var n, o;
2193
+ const l = k.value;
2194
+ if (l) {
2195
+ q();
2196
+ for (let r = l.startCol; r <= l.endCol; r++)
2197
+ for (let s = l.startRow; s <= l.endRow; s++) {
2198
+ const f = D(r, s), h = ((n = m[f]) == null ? void 0 : n.value) ?? "", R = (o = m[f]) != null && o.style ? { ...m[f].style } : {};
2199
+ t === "" || t === null || t === void 0 || t === 0 ? delete R[e] : R[e] = t;
2200
+ const fe = Object.keys(R).length ? R : null;
2201
+ h === "" && fe === null ? j(f) : m[f] = { value: h, style: fe };
2202
+ }
2203
+ g(), Q();
2204
+ }
2205
+ }
2206
+ function un(e) {
2207
+ me("fontFamily", e === "" ? "" : e);
2208
+ }
2209
+ function cn(e) {
2210
+ me("fontSize", e), bt.value = !1;
2211
+ }
2212
+ const dn = E(
2213
+ () => cr.map((e) => ({ label: C(c.value, e.labelKey), value: e.value, icon: e.icon }))
2214
+ ), vn = E(
2215
+ () => dr.map((e) => ({ label: C(c.value, e.labelKey), value: e.value, icon: e.icon }))
2216
+ ), fn = E(() => {
2217
+ var n;
2218
+ const e = k.value;
2219
+ if (!e)
2220
+ return "left";
2221
+ const t = (n = m[D(e.startCol, e.startRow)]) == null ? void 0 : n.style, l = typeof (t == null ? void 0 : t.textAlign) == "string" ? t.textAlign : "";
2222
+ return l === "center" || l === "right" ? l : "left";
2223
+ }), bn = E(() => {
2224
+ var n;
2225
+ const e = k.value;
2226
+ if (!e)
2227
+ return "top";
2228
+ const t = (n = m[D(e.startCol, e.startRow)]) == null ? void 0 : n.style, l = typeof (t == null ? void 0 : t.verticalAlign) == "string" ? t.verticalAlign : "";
2229
+ return l === "middle" || l === "bottom" ? l : "top";
2230
+ }), ho = E(() => {
2231
+ var l;
2232
+ const e = k.value;
2233
+ if (!e)
2234
+ return !1;
2235
+ const t = (l = m[D(e.startCol, e.startRow)]) == null ? void 0 : l.style;
2236
+ return (t == null ? void 0 : t.wrap) === "wrap";
2237
+ });
2238
+ function hn(e) {
2239
+ me("textAlign", e);
2240
+ }
2241
+ function mn(e) {
2242
+ me("verticalAlign", e);
2243
+ }
2244
+ function pn() {
2245
+ if (!k.value)
2246
+ return;
2247
+ const t = ho.value;
2248
+ me("wrap", t ? void 0 : "wrap");
2249
+ }
2250
+ const it = T(""), bt = T(!1);
2251
+ Je(Te, (e) => {
2252
+ it.value = e === 0 ? "" : String(e);
2253
+ }, { immediate: !0 });
2254
+ function gn(e) {
2255
+ const t = e.replace(/[^\d]/g, "");
2256
+ it.value = t;
2257
+ const l = parseInt(t, 10);
2258
+ !isNaN(l) && l >= 5 && l <= 72 && l !== Te.value && me("fontSize", l);
2259
+ }
2260
+ function yn() {
2261
+ const e = it.value.trim();
2262
+ if (!e) {
2263
+ it.value = Te.value === 0 ? "" : String(Te.value);
2264
+ return;
2265
+ }
2266
+ let t = parseInt(e, 10);
2267
+ isNaN(t) ? t = Te.value === 0 ? dt : Te.value : t = Math.max(5, Math.min(72, t)), it.value = String(t), t !== Te.value && me("fontSize", t);
2268
+ }
2269
+ function wn(e) {
2270
+ e.key === "Enter" && e.target.blur();
2271
+ }
2272
+ function kn(e) {
2273
+ bt.value = !bt.value;
2274
+ }
2275
+ function Cn() {
2276
+ const e = Te.value === 0 ? dt : Te.value, t = Math.min(72, e + 1);
2277
+ me("fontSize", t), it.value = String(t), bt.value = !1;
2278
+ }
2279
+ function xn() {
2280
+ const e = Te.value === 0 ? dt : Te.value, t = Math.max(5, e - 1);
2281
+ me("fontSize", t), it.value = String(t), bt.value = !1;
2282
+ }
2283
+ function ol(e) {
2284
+ var o;
2285
+ const t = k.value;
2286
+ if (!t)
2287
+ return !1;
2288
+ let l, n = !1;
2289
+ for (let r = t.startCol; r <= t.endCol && !n; r++)
2290
+ for (let s = t.startRow; s <= t.endRow && !n; s++) {
2291
+ const f = (o = m[D(r, s)]) == null ? void 0 : o.style, h = !!(f != null && f[e]);
2292
+ l === void 0 ? l = h : h !== l && (n = !0);
2293
+ }
2294
+ return !n && l === !0;
2295
+ }
2296
+ const mo = E(() => ol("fontWeight")), po = E(() => ol("fontStyle")), go = E(() => ol("underline")), yo = E(() => ol("strikethrough"));
2297
+ function Bn() {
2298
+ me("fontWeight", mo.value ? "" : "bold");
2299
+ }
2300
+ function Sn() {
2301
+ me("fontStyle", po.value ? "" : "italic");
2302
+ }
2303
+ function Mn() {
2304
+ me("underline", go.value ? "" : "underline");
2305
+ }
2306
+ function Rn() {
2307
+ me("strikethrough", yo.value ? "" : "line-through");
2308
+ }
2309
+ const nl = T(""), al = T(""), $l = T(!1), zl = T(!1);
2310
+ function Dn(e) {
2311
+ wo.value = e, e && ($l.value = !1, zl.value = !1);
2312
+ }
2313
+ function Tn(e) {
2314
+ nl.value = e, me("color", e === "" ? "" : e);
2315
+ }
2316
+ function Fn(e) {
2317
+ al.value = e, me("backgroundColor", e === "" ? "" : e);
2318
+ }
2319
+ function An() {
2320
+ me("color", nl.value === "" ? "" : nl.value);
2321
+ }
2322
+ function En() {
2323
+ me("backgroundColor", al.value === "" ? "" : al.value);
2324
+ }
2325
+ const On = E(() => {
2326
+ var n;
2327
+ const e = k.value;
2328
+ if (!e)
2329
+ return "";
2330
+ let t, l = !1;
2331
+ for (let o = e.startCol; o <= e.endCol && !l; o++)
2332
+ for (let r = e.startRow; r <= e.endRow && !l; r++) {
2333
+ const s = (n = m[D(o, r)]) == null ? void 0 : n.style, f = typeof (s == null ? void 0 : s.color) == "string" ? s.color : "";
2334
+ t === void 0 ? t = f : f !== t && (l = !0);
2335
+ }
2336
+ return l ? "" : t ?? "";
2337
+ }), Ln = E(() => {
2338
+ var n;
2339
+ const e = k.value;
2340
+ if (!e)
2341
+ return "";
2342
+ let t, l = !1;
2343
+ for (let o = e.startCol; o <= e.endCol && !l; o++)
2344
+ for (let r = e.startRow; r <= e.endRow && !l; r++) {
2345
+ const s = (n = m[D(o, r)]) == null ? void 0 : n.style, f = typeof (s == null ? void 0 : s.backgroundColor) == "string" ? s.backgroundColor : "";
2346
+ t === void 0 ? t = f : f !== t && (l = !0);
2347
+ }
2348
+ return l ? "" : t ?? "";
2349
+ }), Hl = T("none"), wo = T(!1);
2350
+ function $n(e, t, l, n) {
2351
+ const o = l === n.startRow, r = l === n.endRow, s = t === n.startCol, f = t === n.endCol, h = { top: 0, bottom: 0, left: 0, right: 0 };
2352
+ switch (e) {
2353
+ case "none":
2354
+ return h;
2355
+ case "bottom":
2356
+ r && (h.bottom = 1);
2357
+ break;
2358
+ case "top":
2359
+ o && (h.top = 1);
2360
+ break;
2361
+ case "left":
2362
+ s && (h.left = 1);
2363
+ break;
2364
+ case "right":
2365
+ f && (h.right = 1);
2366
+ break;
2367
+ case "all":
2368
+ h.top = 1, h.bottom = 1, h.left = 1, h.right = 1;
2369
+ break;
2370
+ case "outer":
2371
+ o && (h.top = 1), r && (h.bottom = 1), s && (h.left = 1), f && (h.right = 1);
2372
+ break;
2373
+ case "thickOuter":
2374
+ o && (h.top = 2), r && (h.bottom = 2), s && (h.left = 2), f && (h.right = 2);
2375
+ break;
2376
+ }
2377
+ return h;
2378
+ }
2379
+ function ko(e) {
2380
+ Hl.value = e;
2381
+ const t = k.value;
2382
+ if (t) {
2383
+ if (q(), e === "none")
2384
+ for (let l = t.startCol; l <= t.endCol; l++)
2385
+ for (let n = t.startRow; n <= t.endRow; n++)
2386
+ Co(l, n, { top: 0, bottom: 0, left: 0, right: 0 }, !0);
2387
+ else
2388
+ for (let l = t.startCol; l <= t.endCol; l++)
2389
+ for (let n = t.startRow; n <= t.endRow; n++) {
2390
+ const o = $n(e, l, n, t);
2391
+ Co(l, n, o, !1);
2392
+ }
2393
+ g(), Q();
2394
+ }
2395
+ }
2396
+ function Co(e, t, l, n = !0) {
2397
+ var de, ve;
2398
+ const o = D(e, t), r = ((de = m[o]) == null ? void 0 : de.value) ?? "", s = (ve = m[o]) != null && ve.style ? { ...m[o].style } : {}, f = ["Top", "Bottom", "Left", "Right"], h = [l.top, l.bottom, l.left, l.right];
2399
+ for (let J = 0; J < 4; J++) {
2400
+ const pe = `border${f[J]}Width`;
2401
+ h[J] === 0 ? n && delete s[pe] : (s[pe] = h[J], s.borderColor = qo);
2402
+ }
2403
+ f.some((J) => s[`border${J}Width`] !== void 0) || delete s.borderColor;
2404
+ const fe = Object.keys(s).length ? s : null;
2405
+ r === "" && fe === null ? j(o) : m[o] = { value: r, style: fe };
2406
+ }
2407
+ function zn() {
2408
+ ko(Hl.value);
2409
+ }
2410
+ function xo(e, t, l) {
2411
+ var o;
2412
+ const n = (o = m[D(e, t)]) == null ? void 0 : o.style;
2413
+ return (n == null ? void 0 : n[`border${l}Width`]) || 0;
2414
+ }
2415
+ let Bo = null;
2416
+ function rl() {
2417
+ const e = k.value;
2418
+ if (!e)
2419
+ return;
2420
+ Bo = { ...e };
486
2421
  const t = [];
487
- for (let n = e.startRow; n <= e.endRow; n++) {
488
- const l = [];
2422
+ for (let l = e.startRow; l <= e.endRow; l++) {
2423
+ const n = [];
489
2424
  for (let o = e.startCol; o <= e.endCol; o++)
490
- l.push(Re(o, n));
491
- t.push(l.join(" "));
2425
+ n.push(oe(o, l));
2426
+ t.push(n.join(" "));
492
2427
  }
493
- jt(t.join(`
2428
+ ro(t.join(`
494
2429
  `));
495
2430
  }
496
- function Qe() {
497
- const e = g.value;
2431
+ function il() {
2432
+ const e = k.value;
498
2433
  if (e) {
499
- if (e.startCol === 0 && e.endCol === c - 1) {
2434
+ if (e.startCol === 0 && e.endCol === b - 1) {
500
2435
  const t = [];
501
- for (let n = e.startRow; n <= e.endRow; n++) {
502
- const l = [];
503
- for (let o = 0; o < c; o++)
504
- l.push(Re(o, n));
505
- t.push(l.join(" "));
2436
+ for (let l = e.startRow; l <= e.endRow; l++) {
2437
+ const n = [];
2438
+ for (let o = 0; o < b; o++)
2439
+ n.push(oe(o, l));
2440
+ t.push(n.join(" "));
506
2441
  }
507
- jt(t.join(`
2442
+ ro(t.join(`
508
2443
  `));
509
- } else if (e.startRow === 0 && e.endRow === r - 1) {
2444
+ } else if (e.startRow === 0 && e.endRow === i - 1) {
510
2445
  const t = [];
511
- for (let n = 0; n < r; n++) {
512
- const l = [];
2446
+ for (let l = 0; l < i; l++) {
2447
+ const n = [];
513
2448
  for (let o = e.startCol; o <= e.endCol; o++)
514
- l.push(Re(o, n));
515
- t.push(l.join(" "));
2449
+ n.push(oe(o, l));
2450
+ t.push(n.join(" "));
516
2451
  }
517
- jt(t.join(`
2452
+ ro(t.join(`
518
2453
  `));
519
2454
  }
520
2455
  }
521
2456
  }
522
- async function Ye() {
2457
+ async function Yt() {
523
2458
  let e = "";
524
2459
  try {
525
2460
  e = await navigator.clipboard.readText();
@@ -528,186 +2463,186 @@ const Un = { class: "tab-list" }, jn = ["onClick", "onDblclick", "onContextmenu"
528
2463
  }
529
2464
  if (!e && e !== "")
530
2465
  return;
531
- const t = e.split(/\r?\n/), n = h.value, l = Jt;
2466
+ const t = e.split(/\r?\n/), l = y.value, n = Bo;
532
2467
  for (let o = 0; o < t.length; o++) {
533
- const a = t[o].split(" ");
534
- for (let d = 0; d < a.length; d++) {
535
- const p = n.col + d, B = n.row + o;
536
- if (p < c && B < r) {
537
- let S = a[d];
538
- S.startsWith("=") && l && (S = On(
539
- S,
540
- p - (l.startCol + d),
541
- B - (l.startRow + o),
542
- c,
543
- r,
544
- ce
545
- )), Me(p, B, S);
2468
+ const r = t[o].split(" ");
2469
+ for (let s = 0; s < r.length; s++) {
2470
+ const f = l.col + s, h = l.row + o;
2471
+ if (f < b && h < i) {
2472
+ let R = r[s];
2473
+ R.startsWith("=") && n && (R = Hi(
2474
+ R,
2475
+ f - (n.startCol + s),
2476
+ h - (n.startRow + o),
2477
+ b,
2478
+ i,
2479
+ Ue
2480
+ )), nt(f, h, R);
546
2481
  }
547
2482
  }
548
2483
  }
549
2484
  }
550
- function wt() {
551
- if (Ge(), g.value) {
552
- const e = g.value;
553
- zt(e.startCol, e.endCol, e.startRow, e.endRow), v();
2485
+ function Il() {
2486
+ if (rl(), k.value) {
2487
+ const e = k.value;
2488
+ uo(e.startCol, e.endCol, e.startRow, e.endRow), g();
554
2489
  }
555
2490
  }
556
- function yt() {
557
- if (g.value) {
558
- const e = g.value;
559
- zt(e.startCol, e.endCol, e.startRow, e.endRow), v();
2491
+ function Wl() {
2492
+ if (k.value) {
2493
+ const e = k.value;
2494
+ uo(e.startCol, e.endCol, e.startRow, e.endRow), g();
560
2495
  }
561
2496
  }
562
- function Rl() {
563
- const e = g.value;
2497
+ function Hn() {
2498
+ const e = k.value;
564
2499
  if (!e)
565
2500
  return;
566
- K();
567
- const t = e.startCol, n = e.startRow, l = e.endCol, o = e.endRow;
568
- if (n === o)
569
- if (l + 1 < c) {
570
- const a = `${ce(t)}${n + 1}:${ce(l)}${n + 1}`;
571
- Me(l + 1, n, `=SUM(${a})`);
2501
+ q();
2502
+ const t = e.startCol, l = e.startRow, n = e.endCol, o = e.endRow;
2503
+ if (l === o)
2504
+ if (n + 1 < b) {
2505
+ const r = `${Ue(t)}${l + 1}:${Ue(n)}${l + 1}`;
2506
+ nt(n + 1, l, `=SUM(${r})`);
572
2507
  } else {
573
- const a = `${ce(t)}${n + 1}:${ce(l - 1)}${n + 1}`;
574
- Me(l, n, `=SUM(${a})`);
2508
+ const r = `${Ue(t)}${l + 1}:${Ue(n - 1)}${l + 1}`;
2509
+ nt(n, l, `=SUM(${r})`);
575
2510
  }
576
2511
  else
577
- for (let a = t; a <= l; a++)
578
- if (o + 1 < r) {
579
- const d = `${ce(a)}${n + 1}:${ce(a)}${o + 1}`;
580
- Me(a, o + 1, `=SUM(${d})`);
2512
+ for (let r = t; r <= n; r++)
2513
+ if (o + 1 < i) {
2514
+ const s = `${Ue(r)}${l + 1}:${Ue(r)}${o + 1}`;
2515
+ nt(r, o + 1, `=SUM(${s})`);
581
2516
  } else {
582
- const d = `${ce(a)}${n + 1}:${ce(a)}${o}`;
583
- Me(a, o, `=SUM(${d})`);
2517
+ const s = `${Ue(r)}${l + 1}:${Ue(r)}${o}`;
2518
+ nt(r, o, `=SUM(${s})`);
584
2519
  }
585
- v(), A();
586
- }
587
- function Ml(e, t) {
588
- const n = t - e + 1;
589
- for (let l = e; l <= t; l++)
590
- for (let o = 0; o < c; o++)
591
- X(L(o, l));
592
- for (let l = e; l < r - n; l++) {
593
- for (let o = 0; o < c; o++) {
594
- const a = L(o, l + n), d = L(o, l);
595
- b[a] ? (b[d] = b[a], X(a)) : X(d);
2520
+ g(), Q();
2521
+ }
2522
+ function In(e, t) {
2523
+ const l = t - e + 1;
2524
+ for (let n = e; n <= t; n++)
2525
+ for (let o = 0; o < b; o++)
2526
+ j(D(o, n));
2527
+ for (let n = e; n < i - l; n++) {
2528
+ for (let o = 0; o < b; o++) {
2529
+ const r = D(o, n + l), s = D(o, n);
2530
+ m[r] ? (m[s] = m[r], j(r)) : j(s);
596
2531
  }
597
- E.value[l] = E.value[l + n];
2532
+ G.value[n] = G.value[n + l];
598
2533
  }
599
- for (let l = r - n; l < r; l++) {
600
- for (let o = 0; o < c; o++)
601
- X(L(o, l));
602
- E.value[l] = Ze;
2534
+ for (let n = i - l; n < i; n++) {
2535
+ for (let o = 0; o < b; o++)
2536
+ j(D(o, n));
2537
+ G.value[n] = void 0;
603
2538
  }
604
2539
  }
605
- function Tl(e, t) {
606
- const n = t - e + 1;
607
- if (!(t >= r - 1)) {
608
- for (let l = r - 1; l > t; l--) {
609
- for (let o = 0; o < c; o++) {
610
- const a = L(o, l - n), d = L(o, l);
611
- b[a] ? b[d] = b[a] : X(d);
2540
+ function Wn(e, t) {
2541
+ const l = t - e + 1;
2542
+ if (!(t >= i - 1)) {
2543
+ for (let n = i - 1; n > t; n--) {
2544
+ for (let o = 0; o < b; o++) {
2545
+ const r = D(o, n - l), s = D(o, n);
2546
+ m[r] ? m[s] = m[r] : j(s);
612
2547
  }
613
- E.value[l] = E.value[l - n];
2548
+ G.value[n] = G.value[n - l];
614
2549
  }
615
- for (let l = t + 1; l <= t + n; l++) {
616
- for (let o = 0; o < c; o++)
617
- X(L(o, l));
618
- E.value[l] = Ze;
2550
+ for (let n = t + 1; n <= t + l; n++) {
2551
+ for (let o = 0; o < b; o++)
2552
+ j(D(o, n));
2553
+ G.value[n] = void 0;
619
2554
  }
620
2555
  }
621
2556
  }
622
- function Dl(e, t) {
623
- const n = t - e + 1;
624
- if (!(t >= c - 1)) {
625
- for (let l = c - 1; l > t; l--) {
626
- for (let o = 0; o < r; o++) {
627
- const a = L(l - n, o), d = L(l, o);
628
- b[a] ? b[d] = b[a] : X(d);
2557
+ function Nn(e, t) {
2558
+ const l = t - e + 1;
2559
+ if (!(t >= b - 1)) {
2560
+ for (let n = b - 1; n > t; n--) {
2561
+ for (let o = 0; o < i; o++) {
2562
+ const r = D(n - l, o), s = D(n, o);
2563
+ m[r] ? m[s] = m[r] : j(s);
629
2564
  }
630
- H.value[l] = H.value[l - n];
2565
+ L.value[n] = L.value[n - l];
631
2566
  }
632
- for (let l = t + 1; l <= t + n; l++) {
633
- for (let o = 0; o < r; o++)
634
- X(L(l, o));
635
- H.value[l] = Je;
2567
+ for (let n = t + 1; n <= t + l; n++) {
2568
+ for (let o = 0; o < i; o++)
2569
+ j(D(n, o));
2570
+ L.value[n] = It;
636
2571
  }
637
2572
  }
638
2573
  }
639
- function Hl(e, t) {
640
- const n = t - e + 1;
641
- for (let l = e; l <= t; l++)
642
- for (let o = 0; o < r; o++)
643
- X(L(l, o));
644
- for (let l = e; l < c - n; l++) {
645
- for (let o = 0; o < r; o++) {
646
- const a = L(l + n, o), d = L(l, o);
647
- b[a] ? (b[d] = b[a], X(a)) : X(d);
2574
+ function Gn(e, t) {
2575
+ const l = t - e + 1;
2576
+ for (let n = e; n <= t; n++)
2577
+ for (let o = 0; o < i; o++)
2578
+ j(D(n, o));
2579
+ for (let n = e; n < b - l; n++) {
2580
+ for (let o = 0; o < i; o++) {
2581
+ const r = D(n + l, o), s = D(n, o);
2582
+ m[r] ? (m[s] = m[r], j(r)) : j(s);
648
2583
  }
649
- H.value[l] = H.value[l + n];
2584
+ L.value[n] = L.value[n + l];
650
2585
  }
651
- for (let l = c - n; l < c; l++) {
652
- for (let o = 0; o < r; o++)
653
- X(L(l, o));
654
- H.value[l] = Je;
2586
+ for (let n = b - l; n < b; n++) {
2587
+ for (let o = 0; o < i; o++)
2588
+ j(D(n, o));
2589
+ L.value[n] = It;
655
2590
  }
656
2591
  }
657
- let Zt = 0;
658
- function qt() {
659
- return Zt++, `s_${Zt}`;
2592
+ let So = 0;
2593
+ function Mo() {
2594
+ return So++, `s_${So}`;
660
2595
  }
661
- function et(e) {
2596
+ function sl(e) {
662
2597
  return {
663
- id: qt(),
2598
+ id: Mo(),
664
2599
  name: e,
665
2600
  cells: {},
666
2601
  selection: { startCol: 0, startRow: 0, endCol: 0, endRow: 0 },
667
2602
  activeCell: { col: 0, row: 0 },
668
2603
  scrollX: 0,
669
2604
  scrollY: 0,
670
- colWidths: new Array(c).fill(Je),
671
- rowHeights: new Array(r).fill(Ze)
2605
+ colWidths: new Array(b).fill(It),
2606
+ rowHeights: new Array(i).fill(void 0)
672
2607
  };
673
2608
  }
674
- const D = N([et("Sheet1")]), Z = N(0);
675
- function Ue() {
676
- const e = D.value[Z.value];
677
- e && (e.cells = { ...b }, e.selection = g.value ? { ...g.value } : null, e.activeCell = { ...h.value }, e.scrollX = M.value, e.scrollY = T.value, e.colWidths = [...H.value], e.rowHeights = [...E.value]);
2609
+ const Z = T([sl("Sheet1")]), Se = T(0);
2610
+ function xt() {
2611
+ const e = Z.value[Se.value];
2612
+ e && (e.cells = { ...m }, e.selection = k.value ? { ...k.value } : null, e.activeCell = { ...y.value }, e.scrollX = S.value, e.scrollY = O.value, e.colWidths = [...L.value], e.rowHeights = [...G.value]);
678
2613
  }
679
- function ge(e) {
680
- const t = D.value[e];
681
- t && (Object.keys(b).forEach((n) => X(n)), Object.assign(b, t.cells), g.value = t.selection ? { ...t.selection } : null, h.value = { ...t.activeCell }, M.value = t.scrollX, T.value = t.scrollY, H.value = [...t.colWidths], E.value = [...t.rowHeights], Z.value = e);
2614
+ function st(e) {
2615
+ const t = Z.value[e];
2616
+ t && (Object.keys(m).forEach((l) => j(l)), Object.assign(m, t.cells), k.value = t.selection ? { ...t.selection } : null, y.value = { ...t.activeCell }, S.value = t.scrollX, O.value = t.scrollY, L.value = [...t.colWidths], G.value = [...t.rowHeights], Se.value = e);
682
2617
  }
683
- function _l(e) {
684
- e === Z.value || e < 0 || e >= D.value.length || (me(), Ue(), ge(e));
2618
+ function Pn(e) {
2619
+ e === Se.value || e < 0 || e >= Z.value.length || (vt(), xt(), st(e));
685
2620
  }
686
- function Bt(e) {
687
- return me(), Ue(), D.value.push(et(`Sheet${D.value.length + 1}`)), ge(D.value.length - 1), D.value.length - 1;
2621
+ function Nl(e) {
2622
+ return q(), vt(), xt(), Z.value.push(sl(`Sheet${Z.value.length + 1}`)), st(Z.value.length - 1), Z.value.length - 1;
688
2623
  }
689
- function El(e) {
690
- return D.value.length <= 1 || (me(), D.value.splice(e, 1), ge(Math.min(e, D.value.length - 1))), Z.value;
2624
+ function Kn(e) {
2625
+ return Z.value.length <= 1 || (q(), vt(), Z.value.splice(e, 1), st(Math.min(e, Z.value.length - 1))), Se.value;
691
2626
  }
692
- function $l(e, t) {
693
- D.value[e] && t.trim() && (D.value[e].name = t.trim());
2627
+ function Vn(e, t) {
2628
+ Z.value[e] && t.trim() && (q(), Z.value[e].name = t.trim());
694
2629
  }
695
- function Il(e) {
696
- me(), Ue();
697
- const t = D.value[e];
2630
+ function Un(e) {
2631
+ q(), vt(), xt();
2632
+ const t = Z.value[e];
698
2633
  if (!t)
699
2634
  return e;
700
- let n = t.name;
701
- const l = n.match(/^(.*?)\s*\((\d+)\)$/);
702
- let o = l ? parseInt(l[2], 10) + 1 : 2;
703
- l && (n = l[1]);
704
- let a = `${n} (${o})`;
705
- const d = new Set(D.value.map((B) => B.name));
706
- for (; d.has(a); )
707
- o++, a = `${n} (${o})`;
708
- const p = {
709
- id: qt(),
710
- name: a,
2635
+ let l = t.name;
2636
+ const n = l.match(/^(.*?)\s*\((\d+)\)$/);
2637
+ let o = n ? parseInt(n[2], 10) + 1 : 2;
2638
+ n && (l = n[1]);
2639
+ let r = `${l} (${o})`;
2640
+ const s = new Set(Z.value.map((h) => h.name));
2641
+ for (; s.has(r); )
2642
+ o++, r = `${l} (${o})`;
2643
+ const f = {
2644
+ id: Mo(),
2645
+ name: r,
711
2646
  cells: { ...t.cells },
712
2647
  selection: t.selection ? { ...t.selection } : null,
713
2648
  activeCell: t.activeCell ? { ...t.activeCell } : { col: 0, row: 0 },
@@ -716,466 +2651,638 @@ const Un = { class: "tab-list" }, jn = ["onClick", "onDblclick", "onContextmenu"
716
2651
  colWidths: [...t.colWidths],
717
2652
  rowHeights: [...t.rowHeights]
718
2653
  };
719
- return D.value.splice(e + 1, 0, p), ge(e + 1), e + 1;
2654
+ return Z.value.splice(e + 1, 0, f), st(e + 1), e + 1;
720
2655
  }
721
- function Gt(e, t) {
722
- const n = e + t;
723
- if (n < 0 || n >= D.value.length)
2656
+ function Ro(e, t) {
2657
+ const l = e + t;
2658
+ if (l < 0 || l >= Z.value.length)
724
2659
  return;
725
- const l = Z.value, o = D.value.splice(e, 1)[0];
726
- D.value.splice(n, 0, o), l === e ? Z.value = n : e < l && n >= l ? Z.value = l - 1 : e > l && n <= l && (Z.value = l + 1), v();
727
- }
728
- const Wl = I(() => D.value.length);
729
- function A() {
730
- Ue();
731
- const e = D.value.map((n) => {
732
- const l = {};
733
- for (const [p, B] of Object.entries(n.cells))
734
- l[p] = { value: B.value }, B.style && (l[p].style = B.style);
735
- const o = { name: n.name, cells: l }, a = {};
736
- for (let p = 0; p < n.colWidths.length; p++)
737
- n.colWidths[p] !== 100 && (a[p] = n.colWidths[p]);
738
- Object.keys(a).length && (o.colWidths = a);
739
- const d = {};
740
- for (let p = 0; p < n.rowHeights.length; p++)
741
- n.rowHeights[p] !== 24 && (d[p] = n.rowHeights[p]);
742
- return Object.keys(d).length && (o.rowHeights = d), o;
2660
+ q();
2661
+ const n = Se.value, o = Z.value.splice(e, 1)[0];
2662
+ Z.value.splice(l, 0, o), n === e ? Se.value = l : e < n && l >= n ? Se.value = n - 1 : e > n && l <= n && (Se.value = n + 1), g();
2663
+ }
2664
+ const Yn = E(() => Z.value.length);
2665
+ function Q() {
2666
+ xt();
2667
+ const e = Z.value.map((l) => {
2668
+ const n = {};
2669
+ for (const [f, h] of Object.entries(l.cells))
2670
+ n[f] = { value: h.value }, h.style && (n[f].style = h.style);
2671
+ const o = { name: l.name, cells: n }, r = {};
2672
+ for (let f = 0; f < l.colWidths.length; f++)
2673
+ l.colWidths[f] !== 100 && (r[f] = l.colWidths[f]);
2674
+ Object.keys(r).length && (o.colWidths = r);
2675
+ const s = {};
2676
+ for (let f = 0; f < l.rowHeights.length; f++) {
2677
+ const h = l.rowHeights[f];
2678
+ h != null && (s[f] = h);
2679
+ }
2680
+ return Object.keys(s).length && (o.rowHeights = s), o;
743
2681
  }), t = JSON.stringify(e);
744
- t !== k && (k = t, m.value = e);
2682
+ t !== F && (F = t, B.value = e);
745
2683
  }
746
- let xt = !1;
747
- function Qt() {
748
- xt || (xt = !0, Promise.resolve().then(() => {
749
- xt = !1, A();
2684
+ let Gl = !1;
2685
+ function Do() {
2686
+ Gl || (Gl = !0, Promise.resolve().then(() => {
2687
+ Gl = !1, Q();
750
2688
  }));
751
2689
  }
752
- const el = I(() => f.theme === "dark" ? Wn : In), Al = I(() => Yn(el.value, f.width, f.height, Se)), we = N(null), oe = N(null), Ct = N(null), St = N(null), U = wl({ w: 800, h: 600 }), Te = I(() => Math.max(0, pt.value - Math.max(0, U.w - w - Q))), De = I(() => Math.max(0, bt.value - Math.max(0, U.h - y - Q)));
753
- function z(e, t) {
754
- const n = Math.max(0, U.w - w - Q), l = Math.max(0, U.h - y - Q);
755
- M.value = Math.max(0, Math.min(e ?? M.value, Math.max(0, pt.value - n))), T.value = Math.max(0, Math.min(t ?? T.value, Math.max(0, bt.value - l)));
2690
+ const To = E(() => p.theme === "dark" ? fr : vr), Xn = E(() => Wi(To.value, p.width, p.height, wt)), ht = T(null), He = T(null), ul = T(null), Pl = T(null), ge = Yo({ w: 800, h: 600 }), Bt = E(() => Math.max(0, le.value - Math.max(0, ge.w - W - Oe))), St = E(() => Math.max(0, u.value - Math.max(0, ge.h - N - Oe)));
2691
+ function Ce(e, t) {
2692
+ const l = Math.max(0, ge.w - W - Oe), n = Math.max(0, ge.h - N - Oe);
2693
+ S.value = Math.max(0, Math.min(e ?? S.value, Math.max(0, le.value - l))), O.value = Math.max(0, Math.min(t ?? O.value, Math.max(0, u.value - n)));
756
2694
  }
757
- function Nl() {
2695
+ function _n() {
758
2696
  var e;
759
2697
  return typeof window > "u" ? !1 : !((e = window.matchMedia) != null && e.call(window, "(hover: none) and (pointer: coarse)").matches);
760
2698
  }
761
- function V(e = !1) {
762
- J(() => {
763
- const t = Ct.value;
2699
+ function Me(e = !1) {
2700
+ re(() => {
2701
+ const t = ul.value;
764
2702
  if (t) {
765
- if (!R.value && !Nl()) {
2703
+ if (!A.value && !_n()) {
766
2704
  document.activeElement === t && t.blur();
767
2705
  return;
768
2706
  }
769
- t.focus(), e && t.select();
2707
+ t.focus({ preventScroll: !0 }), e && t.select();
770
2708
  }
771
2709
  });
772
2710
  }
773
- function Ll() {
774
- V();
2711
+ function jn() {
2712
+ Me();
775
2713
  }
776
- let kt = !1, i = null, je = 1;
777
- function v() {
778
- kt || (kt = !0, requestAnimationFrame(() => {
779
- kt = !1, Fl();
2714
+ let Kl = !1, v = null, Xt = 1;
2715
+ function g() {
2716
+ Kl || (Kl = !0, requestAnimationFrame(() => {
2717
+ Kl = !1, qn();
780
2718
  }));
781
2719
  }
782
- function Fl() {
783
- const e = oe.value;
2720
+ function qn() {
2721
+ var gt, Pe, Ke;
2722
+ const e = He.value;
784
2723
  if (!e)
785
2724
  return;
786
- const t = we.value;
787
- if (!t || (i = e.getContext("2d"), !i))
2725
+ const t = ht.value;
2726
+ if (!t || (v = e.getContext("2d"), !v))
788
2727
  return;
789
- je = window.devicePixelRatio || 1;
790
- const n = t.getBoundingClientRect(), l = n.width, o = n.height;
791
- U.w = l, U.h = o, e.width = l * je, e.height = o * je, e.style.width = l + "px", e.style.height = o + "px", i.setTransform(je, 0, 0, je, 0, 0);
792
- const a = M.value, d = T.value, p = w, B = y, S = el.value, Ft = he.value, Ot = pe.value, vl = H.value, dl = E.value, it = Math.max(0, le(a));
793
- let hl = it;
794
- for (let x = it; x < c && !(p + Ft[x] - a >= l); x++)
795
- hl = x;
796
- const pl = hl, ft = Math.max(0, ne(d));
797
- let bl = ft;
798
- for (let x = ft; x < r && !(B + Ot[x] - d >= o); x++)
799
- bl = x;
800
- const ml = bl;
801
- i.fillStyle = S.bg, i.fillRect(0, 0, l, o), i.fillStyle = S.gridBg, i.fillRect(p, B, l - p, o - B), i.save(), i.beginPath(), i.rect(p + 0.5, B + 0.5, l - p - 1, o - B - 1), i.clip();
802
- const G = g.value, Xt = R.value;
803
- for (let x = ft; x <= ml; x++)
804
- for (let _ = it; _ <= pl; _++) {
805
- const F = p + Ft[_] - a, xe = B + Ot[x] - d, ze = vl[_], Le = dl[x];
806
- if (!(F + ze < p || xe + Le < B || F > l || xe > o) && (Pt(_, x) && (i.fillStyle = S.selectionBg, i.fillRect(F, xe, ze, Le)), h.value.col === _ && h.value.row === x && (i.strokeStyle = S.activeCellBorder, i.lineWidth = 2, i.strokeRect(F + 1, xe + 1, ze - 2, Le - 2)), i.strokeStyle = S.gridLine, i.lineWidth = 0.5, i.strokeRect(F + 0.25, xe + 0.25, ze - 0.5, Le - 0.5), !(Xt && Xt.col === _ && Xt.row === x))) {
807
- const gl = Cl(_, x);
808
- gl && (i.fillStyle = S.cellText, i.font = '13px -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif', i.textBaseline = "middle", i.save(), i.beginPath(), i.rect(F + 5, xe + 1, ze - 10, Le - 2), i.clip(), i.fillText(gl, F + 5, xe + Le / 2 + 0.5), i.restore());
2728
+ Xt = window.devicePixelRatio || 1;
2729
+ const l = t.getBoundingClientRect(), n = l.width, o = l.height;
2730
+ ge.w = n, ge.h = o, e.width = n * Xt, e.height = o * Xt, e.style.width = n + "px", e.style.height = o + "px", v.setTransform(Xt, 0, 0, Xt, 0, 0);
2731
+ const r = S.value, s = O.value, f = W, h = N, R = To.value, fe = De.value, de = H.value, ve = L.value, J = [];
2732
+ for (let M = 0; M < i; M++)
2733
+ J[M] = de[M + 1] - de[M];
2734
+ const pe = Math.max(0, $e(r));
2735
+ let Ne = pe;
2736
+ for (let M = pe; M < b && !(f + fe[M] - r >= n); M++)
2737
+ Ne = M;
2738
+ const ut = Ne, Ae = Math.max(0, ze(s));
2739
+ let Ge = Ae;
2740
+ for (let M = Ae; M < i && !(h + de[M] - s >= o); M++)
2741
+ Ge = M;
2742
+ const ct = Ge;
2743
+ v.fillStyle = R.bg, v.fillRect(0, 0, n, o), v.fillStyle = R.gridBg, v.fillRect(f, h, n - f, o - h), v.save(), v.beginPath(), v.rect(f + 0.5, h + 0.5, n - f - 1, o - h - 1), v.clip();
2744
+ const we = k.value, qe = A.value;
2745
+ for (let M = Ae; M <= ct; M++)
2746
+ for (let X = pe; X <= ut; X++) {
2747
+ const U = f + fe[X] - r, be = h + de[M] - s, Re = ve[X], Ve = J[M];
2748
+ if (U + Re < f || be + Ve < h || U > n || be > o)
2749
+ continue;
2750
+ P(X, M) && (v.fillStyle = R.selectionBg, v.fillRect(U, be, Re, Ve)), y.value.col === X && y.value.row === M && (v.strokeStyle = R.activeCellBorder, v.lineWidth = 2, v.strokeRect(U + 1, be + 1, Re - 2, Ve - 2)), v.strokeStyle = R.gridLine, v.lineWidth = 0.5, v.strokeRect(U + 0.25, be + 0.25, Re - 0.5, Ve - 0.5);
2751
+ const xl = (gt = m[D(X, M)]) == null ? void 0 : gt.style, Ko = typeof (xl == null ? void 0 : xl.backgroundColor) == "string" ? xl.backgroundColor : "";
2752
+ if (Ko && (v.fillStyle = Ko, v.fillRect(U, be, Re, Ve)), !(qe && qe.col === X && qe.row === M)) {
2753
+ const Be = Ct(X, M);
2754
+ if (Be) {
2755
+ const _ = (Pe = m[D(X, M)]) == null ? void 0 : Pe.style, Ot = _e(X, M), Ka = typeof (_ == null ? void 0 : _.fontFamily) == "string" && _.fontFamily ? _.fontFamily : no, Va = (_ == null ? void 0 : _.fontWeight) === "bold" ? "bold" : "normal", Ua = (_ == null ? void 0 : _.fontStyle) === "italic" ? "italic" : "normal", Ya = (_ == null ? void 0 : _.underline) === "underline", Xa = (_ == null ? void 0 : _.strikethrough) === "line-through", oo = typeof (_ == null ? void 0 : _.color) == "string" ? _.color : "", Vo = typeof (_ == null ? void 0 : _.textAlign) == "string" ? _.textAlign : "left", Uo = typeof (_ == null ? void 0 : _.verticalAlign) == "string" ? _.verticalAlign : "top";
2756
+ v.fillStyle = oo || R.cellText, v.font = `${Ua} ${Va} ${Ot}px ${Ka}`, v.textBaseline = "alphabetic", v.save(), v.beginPath(), v.rect(U + 5, be + 1, Re - 10, Ve - 2), v.clip();
2757
+ const _a = (_ == null ? void 0 : _.wrap) === "wrap", Zt = se(v, Be, Re - 10, _a);
2758
+ let Lt = 0, yt = 0;
2759
+ for (const $t of Zt) {
2760
+ const Jt = v.measureText($t), zt = Jt.actualBoundingBoxAscent, Ht = Jt.actualBoundingBoxDescent, Ze = zt || Ot * 0.8, Fl = Ht || Ot * 0.2;
2761
+ Lt = Math.max(Lt, Ze), yt = Math.max(yt, Fl);
2762
+ }
2763
+ Lt = Math.max(Lt, Ot * 0.5), yt = Math.max(yt, Ot * 0.15);
2764
+ const Dl = Ot, ja = Zt.length * Dl;
2765
+ let Tl;
2766
+ Uo === "middle" ? Tl = be + (Ve - ja) / 2 + Lt : Uo === "bottom" ? Tl = be + Ve - Y - yt - (Zt.length - 1) * Dl : Tl = be + Y + Lt;
2767
+ for (let $t = 0; $t < Zt.length; $t++) {
2768
+ const Jt = Zt[$t], zt = Tl + $t * Dl, Ht = v.measureText(Jt);
2769
+ let Ze;
2770
+ if (Vo === "center" ? Ze = U + Re / 2 - Ht.width / 2 : Vo === "right" ? Ze = U + Re - 5 - Ht.width : Ze = U + 5, v.fillText(Jt, Ze, zt), Ya && (v.strokeStyle = oo || R.cellText, v.lineWidth = 1, v.beginPath(), v.moveTo(Ze, zt + yt + 1), v.lineTo(Ze + Ht.width, zt + yt + 1), v.stroke()), Xa) {
2771
+ v.strokeStyle = oo || R.cellText, v.lineWidth = 1;
2772
+ const Fl = zt - Dl * 0.25;
2773
+ v.beginPath(), v.moveTo(Ze, Fl), v.lineTo(Ze + Ht.width, Fl), v.stroke();
2774
+ }
2775
+ }
2776
+ v.restore();
2777
+ }
2778
+ }
2779
+ const Ee = (Ke = m[D(X, M)]) == null ? void 0 : Ke.style, Ga = (Ee == null ? void 0 : Ee.borderTopWidth) || 0, Pa = (Ee == null ? void 0 : Ee.borderLeftWidth) || 0, Bl = (Ee == null ? void 0 : Ee.borderBottomWidth) || 0, Sl = (Ee == null ? void 0 : Ee.borderRightWidth) || 0, Ml = Math.max(Ga, xo(X, M - 1, "Bottom")), Rl = Math.max(Pa, xo(X - 1, M, "Right"));
2780
+ if (Ml > 0 || Rl > 0 || Bl > 0 || Sl > 0) {
2781
+ if (v.strokeStyle = qo, Ml > 0) {
2782
+ v.lineWidth = Ml, v.beginPath();
2783
+ const Be = be + Ml / 2 - 0.5;
2784
+ v.moveTo(U, Be), v.lineTo(U + Re, Be), v.stroke();
2785
+ }
2786
+ if (Rl > 0) {
2787
+ v.lineWidth = Rl, v.beginPath();
2788
+ const Be = U + Rl / 2 - 0.5;
2789
+ v.moveTo(Be, be), v.lineTo(Be, be + Ve), v.stroke();
2790
+ }
2791
+ if (M === ct && Bl > 0) {
2792
+ v.lineWidth = Bl, v.beginPath();
2793
+ const Be = be + Ve - Bl / 2 + 0.5;
2794
+ v.moveTo(U, Be), v.lineTo(U + Re, Be), v.stroke();
2795
+ }
2796
+ if (X === ut && Sl > 0) {
2797
+ v.lineWidth = Sl, v.beginPath();
2798
+ const Be = U + Re - Sl / 2 + 0.5;
2799
+ v.moveTo(Be, be), v.lineTo(Be, be + Ve), v.stroke();
2800
+ }
809
2801
  }
810
2802
  }
811
- i.restore(), i.fillStyle = S.headerBg, i.fillRect(p, 0, l - p, B);
812
- for (let x = it; x <= pl; x++) {
813
- const _ = p + Ft[x] - a, F = vl[x];
814
- _ + F < p || _ > l || (G && x >= G.startCol && x <= G.endCol && (i.fillStyle = S.selectionBg, i.fillRect(_, 0, F, B)), i.strokeStyle = S.headerBorder, i.lineWidth = 0.5, i.strokeRect(_ + 0.25, 0.25, F - 0.5, B - 0.5), G && x >= G.startCol && x <= G.endCol && (i.strokeStyle = S.activeCellBorder, i.lineWidth = 2, i.beginPath(), i.moveTo(_, B - 1), i.lineTo(_ + F, B - 1), i.stroke()), i.fillStyle = S.headerText, i.font = '11px -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif', i.textAlign = "center", i.textBaseline = "middle", i.fillText(ce(x), _ + F / 2, B / 2));
2803
+ v.restore(), v.fillStyle = R.headerBg, v.fillRect(f, 0, n - f, h);
2804
+ for (let M = pe; M <= ut; M++) {
2805
+ const X = f + fe[M] - r, U = ve[M];
2806
+ X + U < f || X > n || (we && M >= we.startCol && M <= we.endCol && (v.fillStyle = R.selectionBg, v.fillRect(X, 0, U, h)), v.strokeStyle = R.headerBorder, v.lineWidth = 0.5, v.strokeRect(X + 0.25, 0.25, U - 0.5, h - 0.5), we && M >= we.startCol && M <= we.endCol && (v.strokeStyle = R.activeCellBorder, v.lineWidth = 2, v.beginPath(), v.moveTo(X, h - 1), v.lineTo(X + U, h - 1), v.stroke()), v.fillStyle = R.headerText, v.font = '11px -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif', v.textAlign = "center", v.textBaseline = "middle", v.fillText(Ue(M), X + U / 2, h / 2));
815
2807
  }
816
- i.strokeStyle = S.headerSep, i.lineWidth = 1, i.beginPath(), i.moveTo(p, B + 0.5), i.lineTo(l, B + 0.5), i.stroke(), i.fillStyle = S.headerBg, i.fillRect(0, B, p, o - B);
817
- for (let x = ft; x <= ml; x++) {
818
- const _ = B + Ot[x] - d, F = dl[x];
819
- _ + F < B || _ > o || (G && x >= G.startRow && x <= G.endRow && (i.fillStyle = S.selectionBg, i.fillRect(0, _, p, F)), i.strokeStyle = S.headerBorder, i.lineWidth = 0.5, i.strokeRect(0.25, _ + 0.25, p - 0.5, F - 0.5), G && x >= G.startRow && x <= G.endRow && (i.strokeStyle = S.activeCellBorder, i.lineWidth = 2, i.beginPath(), i.moveTo(p - 1, _), i.lineTo(p - 1, _ + F), i.stroke()), i.fillStyle = S.headerText, i.font = '11px -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif', i.textAlign = "center", i.textBaseline = "middle", i.fillText(String(x + 1), p / 2, _ + F / 2 + 0.5));
2808
+ v.strokeStyle = R.headerSep, v.lineWidth = 1, v.beginPath(), v.moveTo(f, h + 0.5), v.lineTo(n, h + 0.5), v.stroke(), v.fillStyle = R.headerBg, v.fillRect(0, h, f, o - h);
2809
+ for (let M = Ae; M <= ct; M++) {
2810
+ const X = h + de[M] - s, U = J[M];
2811
+ X + U < h || X > o || (we && M >= we.startRow && M <= we.endRow && (v.fillStyle = R.selectionBg, v.fillRect(0, X, f, U)), v.strokeStyle = R.headerBorder, v.lineWidth = 0.5, v.strokeRect(0.25, X + 0.25, f - 0.5, U - 0.5), we && M >= we.startRow && M <= we.endRow && (v.strokeStyle = R.activeCellBorder, v.lineWidth = 2, v.beginPath(), v.moveTo(f - 1, X), v.lineTo(f - 1, X + U), v.stroke()), v.fillStyle = R.headerText, v.font = '11px -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif', v.textAlign = "center", v.textBaseline = "middle", v.fillText(String(M + 1), f / 2, X + U / 2 + 0.5));
820
2812
  }
821
- i.strokeStyle = S.headerSep, i.lineWidth = 1, i.beginPath(), i.moveTo(p + 0.5, B), i.lineTo(p + 0.5, o), i.stroke(), i.fillStyle = S.headerBg, i.fillRect(0, 0, p, B), i.strokeStyle = S.headerSep, i.lineWidth = 1, i.strokeRect(0.5, 0.5, p - 0.5, B - 0.5);
2813
+ v.strokeStyle = R.headerSep, v.lineWidth = 1, v.beginPath(), v.moveTo(f + 0.5, h), v.lineTo(f + 0.5, o), v.stroke(), v.fillStyle = R.headerBg, v.fillRect(0, 0, f, h), v.strokeStyle = R.headerSep, v.lineWidth = 1, v.strokeRect(0.5, 0.5, f - 0.5, h - 0.5);
822
2814
  }
823
- const Ol = I(() => ce(h.value.col) + String(h.value.row + 1)), Xl = I(() => R.value ? O.value : Re(h.value.col, h.value.row));
824
- function Yl() {
825
- R.value || (W(h.value.col, h.value.row), O.value = Re(h.value.col, h.value.row), ve(), v());
2815
+ const Zn = E(() => Ue(y.value.col) + String(y.value.row + 1)), Jn = E(() => A.value ? K.value : oe(y.value.col, y.value.row));
2816
+ function Qn() {
2817
+ A.value || (ce(y.value.col, y.value.row), K.value = oe(y.value.col, y.value.row), at(), g());
826
2818
  }
827
- function Ul(e) {
828
- O.value = e.target.value;
2819
+ function ea(e) {
2820
+ K.value = e.target.value;
829
2821
  }
830
- function jl(e) {
831
- var t, n;
832
- e.key === "Enter" ? (e.preventDefault(), be(), ie(0, 1), W(h.value.col, h.value.row), (t = St.value) == null || t.blur(), v(), V()) : e.key === "Escape" && (e.preventDefault(), me(), (n = St.value) == null || n.blur(), v(), V());
2822
+ function ta(e) {
2823
+ var t, l;
2824
+ e.key === "Enter" ? (e.preventDefault(), rt(), et(0, 1), ce(y.value.col, y.value.row), (t = Pl.value) == null || t.blur(), g(), Me()) : e.key === "Escape" && (e.preventDefault(), vt(), (l = Pl.value) == null || l.blur(), g(), Me());
833
2825
  }
834
- function Kl() {
2826
+ function la() {
835
2827
  setTimeout(() => {
836
- R.value && (be(), v());
2828
+ A.value && (rt(), g());
837
2829
  }, 0);
838
2830
  }
839
- const ye = N(null), He = N("");
840
- function Pl(e) {
841
- ye.value === null && (_l(e), v());
2831
+ const mt = T(null), Mt = T("");
2832
+ function oa(e) {
2833
+ mt.value === null && (Pn(e), g());
842
2834
  }
843
- function tl(e) {
844
- e !== Z.value && (Ue(), ge(e), v()), ye.value = e, He.value = D.value[e].name, J(() => {
2835
+ function Fo(e) {
2836
+ e !== Se.value && (xt(), st(e), g()), mt.value = e, Mt.value = Z.value[e].name, re(() => {
845
2837
  const t = document.querySelector(".tab-rename-input");
846
2838
  t == null || t.focus(), t == null || t.select();
847
2839
  });
848
2840
  }
849
- function ll() {
850
- ye.value !== null && ($l(ye.value, He.value), J(A)), ye.value = null, He.value = "";
2841
+ function Ao() {
2842
+ mt.value !== null && (Vn(mt.value, Mt.value), re(Q)), mt.value = null, Mt.value = "";
851
2843
  }
852
- function zl() {
853
- ye.value = null, He.value = "";
2844
+ function na() {
2845
+ mt.value = null, Mt.value = "";
854
2846
  }
855
- function Vl(e) {
856
- e.key === "Enter" ? (e.preventDefault(), ll()) : e.key === "Escape" && (e.preventDefault(), zl());
2847
+ function aa(e) {
2848
+ e.key === "Enter" ? (e.preventDefault(), Ao()) : e.key === "Escape" && (e.preventDefault(), na());
857
2849
  }
858
- const fe = N(null);
859
- let Ke = null;
860
- function nl() {
861
- Ke && (document.removeEventListener("click", Ke), Ke = null);
2850
+ const lt = T(null);
2851
+ let _t = null;
2852
+ function Eo() {
2853
+ _t && (document.removeEventListener("click", _t), _t = null);
862
2854
  }
863
- function _e(e, t, n) {
864
- nl();
865
- const l = 140, o = n.length * 28 + 8, a = window.innerWidth, d = window.innerHeight;
866
- e + l > a && (e -= l), t + o > d && (t -= o), fe.value = { x: e, y: t, items: n }, Ke = () => {
867
- fe.value = null, nl();
868
- }, setTimeout(() => document.addEventListener("click", Ke, { once: !0 }), 0);
2855
+ function Rt(e, t, l) {
2856
+ Eo();
2857
+ const n = 140, o = l.length * 28 + 8, r = window.innerWidth, s = window.innerHeight;
2858
+ e + n > r && (e -= n), t + o > s && (t -= o), lt.value = { x: e, y: t, items: l }, _t = () => {
2859
+ lt.value = null, Eo();
2860
+ }, setTimeout(() => document.addEventListener("click", _t, { once: !0 }), 0);
869
2861
  }
870
- const tt = N(!1);
871
- function Jl(e, t) {
2862
+ const cl = T(!1);
2863
+ function ra(e, t) {
872
2864
  if (!t.children) {
873
- tt.value = !1;
2865
+ cl.value = !1;
874
2866
  return;
875
2867
  }
876
- const l = e.currentTarget.querySelector(".context-submenu");
877
- if (!l) {
878
- tt.value = !1;
2868
+ const n = e.currentTarget.querySelector(".context-submenu");
2869
+ if (!n) {
2870
+ cl.value = !1;
879
2871
  return;
880
2872
  }
881
- const o = l.getBoundingClientRect();
882
- tt.value = o.right > window.innerWidth;
2873
+ const o = n.getBoundingClientRect();
2874
+ cl.value = o.right > window.innerWidth;
883
2875
  }
884
- function Zl(e, t) {
885
- e.preventDefault(), e.stopPropagation(), _e(e.clientX, e.clientY, [
2876
+ function ia(e, t) {
2877
+ e.preventDefault(), e.stopPropagation(), Rt(e.clientX, e.clientY, [
886
2878
  {
887
- label: C(s.value, "insert"),
2879
+ label: C(c.value, "insert"),
888
2880
  action: () => {
889
- Bt(), v();
2881
+ Nl(), g();
890
2882
  }
891
2883
  },
892
- { label: C(s.value, "copy"), action: () => {
893
- Il(t);
2884
+ { label: C(c.value, "copy"), action: () => {
2885
+ Un(t);
894
2886
  } },
895
- { label: C(s.value, "rename"), action: () => {
896
- tl(t);
2887
+ { label: C(c.value, "rename"), action: () => {
2888
+ Fo(t);
897
2889
  } },
898
2890
  {
899
- label: C(s.value, "delete"),
2891
+ label: C(c.value, "delete"),
900
2892
  action: () => {
901
- El(t), v();
2893
+ Kn(t), g();
902
2894
  },
903
- disabled: Wl.value <= 1
2895
+ disabled: Yn.value <= 1
904
2896
  },
905
- { label: C(s.value, "moveSheetLeft"), action: () => {
906
- Gt(t, -1);
2897
+ { label: C(c.value, "moveSheetLeft"), action: () => {
2898
+ Ro(t, -1);
907
2899
  }, disabled: t === 0 },
908
- { label: C(s.value, "moveSheetRight"), action: () => {
909
- Gt(t, 1);
910
- }, disabled: t === D.value.length - 1 }
2900
+ { label: C(c.value, "moveSheetRight"), action: () => {
2901
+ Ro(t, 1);
2902
+ }, disabled: t === Z.value.length - 1 }
911
2903
  ]);
912
2904
  }
913
- function ql(e) {
914
- e.preventDefault(), !(e.target.closest(".tab-item") || e.target.closest(".tab-bar__add-btn")) && _e(e.clientX, e.clientY, [
2905
+ function sa(e) {
2906
+ e.preventDefault(), !(e.target.closest(".tab-item") || e.target.closest(".tab-bar__add-btn")) && Rt(e.clientX, e.clientY, [
915
2907
  {
916
- label: C(s.value, "insert"),
2908
+ label: C(c.value, "insert"),
917
2909
  action: () => {
918
- Bt(), v();
2910
+ Nl(), g();
919
2911
  }
920
2912
  }
921
2913
  ]);
922
2914
  }
923
- function Gl(e) {
924
- e.preventDefault(), mt(), v(), _e(e.clientX, e.clientY, [
2915
+ function ua(e) {
2916
+ e.preventDefault(), V(), g(), Rt(e.clientX, e.clientY, [
925
2917
  {
926
- label: C(s.value, "cut"),
2918
+ label: C(c.value, "cut"),
927
2919
  action: () => {
928
- wt(), A();
2920
+ Il(), Q();
929
2921
  }
930
2922
  },
931
- { label: C(s.value, "copy"), action: () => Ge() },
2923
+ { label: C(c.value, "copy"), action: () => rl() },
932
2924
  {
933
- label: C(s.value, "paste"),
2925
+ label: C(c.value, "paste"),
934
2926
  action: () => {
935
- K(), Ye().then(() => {
936
- v(), J(A);
2927
+ q(), Yt().then(() => {
2928
+ g(), re(Q);
937
2929
  });
938
2930
  }
939
2931
  },
940
- { label: C(s.value, "delete"), action: () => {
941
- K(), yt();
942
- for (let t = 0; t < c; t++)
943
- H.value[t] = Je;
944
- for (let t = 0; t < r; t++)
945
- E.value[t] = Ze;
946
- v(), A();
2932
+ { label: C(c.value, "delete"), action: () => {
2933
+ q(), Wl();
2934
+ for (let t = 0; t < b; t++)
2935
+ L.value[t] = It;
2936
+ for (let t = 0; t < i; t++)
2937
+ G.value[t] = void 0;
2938
+ g(), Q();
947
2939
  } }
948
2940
  ]);
949
2941
  }
950
- function Ql(e, t) {
2942
+ function ca(e, t) {
951
2943
  e.preventDefault();
952
- const n = g.value;
953
- n && n.startCol === 0 && n.endCol === c - 1 && t >= n.startRow && t <= n.endRow || (te(0, t, c - 1, t), v());
954
- const l = g.value;
955
- _e(e.clientX, e.clientY, [
2944
+ const l = e.clientX, n = e.clientY, o = k.value;
2945
+ o && o.startCol === 0 && o.endCol === b - 1 && t >= o.startRow && t <= o.endRow || (ue(0, t, b - 1, t), g());
2946
+ const r = k.value;
2947
+ Rt(e.clientX, e.clientY, [
956
2948
  {
957
- label: C(s.value, "insert"),
2949
+ label: C(c.value, "insert"),
958
2950
  action: () => {
959
- K(), Tl(l.startRow, l.endRow), v(), A();
2951
+ q(), Wn(r.startRow, r.endRow), g(), Q();
960
2952
  },
961
- disabled: l.endRow >= r - 1
2953
+ disabled: r.endRow >= i - 1
962
2954
  },
963
- { label: C(s.value, "cut"), action: () => {
964
- K(), Qe();
965
- for (let o = l.startRow; o <= l.endRow; o++)
966
- for (let a = 0; a < c; a++)
967
- X(L(a, o));
968
- v(), A();
2955
+ { label: C(c.value, "cut"), action: () => {
2956
+ q(), il();
2957
+ for (let s = r.startRow; s <= r.endRow; s++)
2958
+ for (let f = 0; f < b; f++)
2959
+ j(D(f, s));
2960
+ g(), Q();
969
2961
  } },
970
- { label: C(s.value, "copy"), action: () => Qe() },
2962
+ { label: C(c.value, "copy"), action: () => il() },
971
2963
  {
972
- label: C(s.value, "paste"),
2964
+ label: C(c.value, "paste"),
973
2965
  action: () => {
974
- K(), Ye().then(() => {
975
- v(), J(A);
2966
+ q(), Yt().then(() => {
2967
+ g(), re(Q);
976
2968
  });
977
2969
  }
978
2970
  },
979
2971
  {
980
- label: C(s.value, "delete"),
2972
+ label: C(c.value, "delete"),
981
2973
  action: () => {
982
- K(), Ml(l.startRow, l.endRow), v(), A();
2974
+ q(), In(r.startRow, r.endRow), g(), Q();
983
2975
  }
2976
+ },
2977
+ { label: `${C(c.value, "rowHeight")}...`, action: () => $o("row", l, n) },
2978
+ {
2979
+ label: C(c.value, "autoRowHeight"),
2980
+ action: () => ma()
984
2981
  }
985
2982
  ]);
986
2983
  }
987
- function en(e, t) {
2984
+ function da(e, t) {
988
2985
  e.preventDefault();
989
- const n = g.value;
990
- n && n.startRow === 0 && n.endRow === r - 1 && t >= n.startCol && t <= n.endCol || (te(t, 0, t, r - 1), v());
991
- const l = g.value;
992
- _e(e.clientX, e.clientY, [
2986
+ const l = e.clientX, n = e.clientY, o = k.value;
2987
+ o && o.startRow === 0 && o.endRow === i - 1 && t >= o.startCol && t <= o.endCol || (ue(t, 0, t, i - 1), g());
2988
+ const r = k.value;
2989
+ Rt(e.clientX, e.clientY, [
993
2990
  {
994
- label: C(s.value, "insert"),
2991
+ label: C(c.value, "insert"),
995
2992
  action: () => {
996
- K(), Dl(l.startCol, l.endCol), v(), A();
2993
+ q(), Nn(r.startCol, r.endCol), g(), Q();
997
2994
  },
998
- disabled: l.endCol >= c - 1
2995
+ disabled: r.endCol >= b - 1
999
2996
  },
1000
- { label: C(s.value, "cut"), action: () => {
1001
- K(), Qe();
1002
- for (let o = l.startCol; o <= l.endCol; o++)
1003
- for (let a = 0; a < r; a++)
1004
- X(L(o, a));
1005
- v(), A();
2997
+ { label: C(c.value, "cut"), action: () => {
2998
+ q(), il();
2999
+ for (let s = r.startCol; s <= r.endCol; s++)
3000
+ for (let f = 0; f < i; f++)
3001
+ j(D(s, f));
3002
+ g(), Q();
1006
3003
  } },
1007
- { label: C(s.value, "copy"), action: () => Qe() },
3004
+ { label: C(c.value, "copy"), action: () => il() },
1008
3005
  {
1009
- label: C(s.value, "paste"),
3006
+ label: C(c.value, "paste"),
1010
3007
  action: () => {
1011
- K(), Ye().then(() => {
1012
- v(), J(A);
3008
+ q(), Yt().then(() => {
3009
+ g(), re(Q);
1013
3010
  });
1014
3011
  }
1015
3012
  },
1016
3013
  {
1017
- label: C(s.value, "delete"),
3014
+ label: C(c.value, "delete"),
1018
3015
  action: () => {
1019
- K(), Hl(l.startCol, l.endCol), v(), A();
3016
+ q(), Gn(r.startCol, r.endCol), g(), Q();
1020
3017
  }
3018
+ },
3019
+ { label: `${C(c.value, "colWidth")}...`, action: () => $o("col", l, n) },
3020
+ {
3021
+ label: C(c.value, "defaultColWidth"),
3022
+ action: () => pa()
1021
3023
  }
1022
3024
  ]);
1023
3025
  }
1024
- function tn(e, t, n) {
1025
- e.preventDefault(), Pt(t, n) || (ee(t, n), v());
1026
- const l = g.value, o = !!(l && l.startCol === l.endCol && l.startRow === l.endRow);
1027
- _e(e.clientX, e.clientY, [
3026
+ function va(e, t, l) {
3027
+ e.preventDefault(), P(t, l) || (w(t, l), g());
3028
+ const n = k.value, o = !!(n && n.startCol === n.endCol && n.startRow === n.endRow);
3029
+ Rt(e.clientX, e.clientY, [
1028
3030
  {
1029
- label: C(s.value, "cut"),
3031
+ label: C(c.value, "cut"),
1030
3032
  action: () => {
1031
- wt(), A();
3033
+ Il(), Q();
1032
3034
  }
1033
3035
  },
1034
- { label: C(s.value, "copy"), action: () => Ge() },
3036
+ { label: C(c.value, "copy"), action: () => rl() },
1035
3037
  {
1036
- label: C(s.value, "paste"),
3038
+ label: C(c.value, "paste"),
1037
3039
  action: () => {
1038
- K(), Ye().then(() => {
1039
- v(), J(A);
3040
+ q(), Yt().then(() => {
3041
+ g(), re(Q);
1040
3042
  });
1041
3043
  }
1042
3044
  },
1043
3045
  {
1044
- label: C(s.value, "delete"),
3046
+ label: C(c.value, "delete"),
1045
3047
  action: () => {
1046
- K(), yt(), v(), A();
3048
+ q(), Wl(), g(), Q();
1047
3049
  }
1048
3050
  },
1049
3051
  {
1050
- label: C(s.value, "calculate"),
3052
+ label: C(c.value, "calculate"),
1051
3053
  children: [
1052
- { label: C(s.value, "sum"), action: Rl, disabled: o }
3054
+ { label: C(c.value, "sum"), action: Hn, disabled: o }
1053
3055
  ]
1054
3056
  }
1055
3057
  ]);
1056
3058
  }
1057
- const ln = I(() => {
1058
- const e = !R.value, t = R.value ?? h.value, n = t.col, l = t.row;
1059
- return {
1060
- left: `${w + he.value[n] - M.value}px`,
1061
- top: `${y + pe.value[l] - T.value}px`,
1062
- width: `${H.value[n]}px`,
1063
- height: `${E.value[l]}px`,
3059
+ const Oo = T(null), xe = T(null);
3060
+ let jt = null;
3061
+ function Lo() {
3062
+ jt && (document.removeEventListener("mousedown", jt), jt = null);
3063
+ }
3064
+ function $o(e, t, l) {
3065
+ Lo();
3066
+ const n = k.value;
3067
+ let o = "";
3068
+ if (n) {
3069
+ const R = e === "row" ? je(n.startRow) : L.value[n.startCol];
3070
+ o = R != null && R > 0 ? String(Math.round(R)) : "";
3071
+ }
3072
+ const r = 220, s = 118;
3073
+ let f = t, h = l;
3074
+ f + r > window.innerWidth && (f = window.innerWidth - r - 8), h + s > window.innerHeight && (h = window.innerHeight - s - 8), f < 8 && (f = 8), h < 8 && (h = 8), xe.value = { type: e, x: f, y: h, value: o, error: "" }, jt = () => {
3075
+ xe.value = null;
3076
+ }, setTimeout(() => document.addEventListener("mousedown", jt, { once: !0 }), 0), re(() => {
3077
+ const R = Oo.value;
3078
+ R && (R.focus(), R.select());
3079
+ });
3080
+ }
3081
+ function fa(e) {
3082
+ const t = xe.value;
3083
+ if (!t)
3084
+ return;
3085
+ const l = e.target, n = l.value, o = n.replace(/[^\d]/g, "");
3086
+ t.value = o, n !== o && (l.value = o), t.error = "";
3087
+ }
3088
+ function ba(e) {
3089
+ e.key === "Enter" ? (e.preventDefault(), zo()) : e.key === "Escape" && dl();
3090
+ }
3091
+ function ha() {
3092
+ const e = xe.value;
3093
+ if (!e)
3094
+ return;
3095
+ const t = e.value.trim(), l = Number(t), n = e.type === "row", o = n ? el : Qt, r = n ? tl : Al;
3096
+ if (t === "" || !Number.isFinite(l)) {
3097
+ dl();
3098
+ return;
3099
+ }
3100
+ const s = Math.max(o, Math.min(r, Math.round(l)));
3101
+ e.value = String(s), e.error = "";
3102
+ }
3103
+ function zo() {
3104
+ const e = xe.value, t = k.value;
3105
+ if (!e || !t)
3106
+ return;
3107
+ const l = e.value.trim(), n = Number(l), o = e.type === "row", r = o ? el : Qt, s = o ? tl : Al;
3108
+ if (l === "" || !Number.isFinite(n)) {
3109
+ e.error = C(c.value, "dimNumberError");
3110
+ return;
3111
+ }
3112
+ if (n < r || n > s) {
3113
+ e.error = C(c.value, "dimRangeError").replace("{min}", String(r)).replace("{max}", String(s));
3114
+ return;
3115
+ }
3116
+ const f = n;
3117
+ if (q(), o)
3118
+ for (let h = t.startRow; h <= t.endRow; h++)
3119
+ G.value[h] = f;
3120
+ else
3121
+ for (let h = t.startCol; h <= t.endCol; h++)
3122
+ L.value[h] = f;
3123
+ g(), Q(), dl();
3124
+ }
3125
+ function dl() {
3126
+ Lo(), xe.value = null;
3127
+ }
3128
+ function ma() {
3129
+ const e = k.value;
3130
+ if (e) {
3131
+ q();
3132
+ for (let t = e.startRow; t <= e.endRow; t++)
3133
+ G.value[t] = void 0;
3134
+ g(), Q();
3135
+ }
3136
+ }
3137
+ function pa() {
3138
+ const e = k.value;
3139
+ if (e) {
3140
+ q();
3141
+ for (let t = e.startCol; t <= e.endCol; t++)
3142
+ L.value[t] = It;
3143
+ g(), Q();
3144
+ }
3145
+ }
3146
+ const ga = E(() => {
3147
+ var M;
3148
+ const e = !A.value, t = A.value ?? y.value, l = t.col, n = t.row, o = (M = m[D(l, n)]) == null ? void 0 : M.style, r = _e(l, n), s = typeof (o == null ? void 0 : o.fontFamily) == "string" && o.fontFamily ? o.fontFamily : no, f = (o == null ? void 0 : o.fontWeight) === "bold" ? "bold" : "normal", h = (o == null ? void 0 : o.fontStyle) === "italic" ? "italic" : "normal", R = (o == null ? void 0 : o.underline) === "underline" ? "underline" : (o == null ? void 0 : o.strikethrough) === "line-through" ? "line-through" : "none", fe = (o == null ? void 0 : o.underline) === "underline" && (o == null ? void 0 : o.strikethrough) === "line-through" ? "underline line-through" : R, de = typeof (o == null ? void 0 : o.color) == "string" ? o.color : void 0, ve = typeof (o == null ? void 0 : o.backgroundColor) == "string" ? o.backgroundColor : void 0, J = typeof (o == null ? void 0 : o.textAlign) == "string" ? o.textAlign : "left", pe = typeof (o == null ? void 0 : o.verticalAlign) == "string" ? o.verticalAlign : "top", Ne = je(n), ut = 2, { ascent: Ae, descent: Ge } = Xe(s, r, f, h), ct = Ae + Ge, qe = (K.value ? K.value.split(`
3149
+ `).length : 1) * ct, gt = Y - ut;
3150
+ let Pe = 0, Ke = 0;
3151
+ return pe === "middle" ? (Pe = Math.floor((Ne - qe) / 2), Ke = Math.max(0, Ne - qe - Pe)) : pe === "top" ? (Pe = gt, Ke = Math.max(0, Ne - qe - Pe)) : pe === "bottom" && (Ke = gt, Pe = Math.max(0, Ne - qe - Ke)), {
3152
+ left: `${W + De.value[l] - S.value}px`,
3153
+ top: `${N + H.value[n] - O.value}px`,
3154
+ width: `${L.value[l]}px`,
3155
+ height: `${Ne}px`,
3156
+ fontFamily: s,
3157
+ fontSize: `${r}px`,
3158
+ lineHeight: 1,
3159
+ fontWeight: f,
3160
+ fontStyle: h,
3161
+ textDecoration: fe,
3162
+ textAlign: J,
3163
+ paddingTop: `${Pe}px`,
3164
+ paddingRight: "3px",
3165
+ paddingBottom: `${Ke}px`,
3166
+ paddingLeft: "3px",
1064
3167
  opacity: e ? 0 : 1,
1065
3168
  pointerEvents: e ? "none" : "auto",
1066
- color: e ? "transparent" : void 0,
3169
+ color: e ? "transparent" : de,
1067
3170
  caretColor: e ? "transparent" : void 0,
1068
3171
  borderColor: e ? "transparent" : void 0,
1069
- background: e ? "transparent" : void 0,
3172
+ background: e ? "transparent" : ve,
1070
3173
  boxShadow: e ? "none" : void 0
1071
3174
  };
1072
- }), nn = I(() => Math.max(0, U.w - w - Q)), on = I(() => Math.max(0, U.h - y - Q)), lt = I(() => Math.max(0, nn.value - 11 * 2)), nt = I(() => Math.max(0, on.value - 11 * 2));
1073
- function Rt() {
1074
- return Math.max(0, U.w - w - Q);
1075
- }
1076
- function Mt() {
1077
- return Math.max(0, U.h - y - Q);
1078
- }
1079
- const ot = I(() => Te.value <= 0 ? lt.value : Math.max(24, Rt() / pt.value * lt.value)), Tt = I(() => Te.value <= 0 ? 0 : M.value / Te.value * (lt.value - ot.value)), at = I(() => De.value <= 0 ? nt.value : Math.max(24, Mt() / bt.value * nt.value)), Dt = I(() => De.value <= 0 ? 0 : T.value / De.value * (nt.value - at.value));
1080
- let Be = null, rt = 0, ut = 0;
1081
- function an(e) {
1082
- e.preventDefault(), Be = "v", rt = e.clientY, ut = T.value, document.addEventListener("mousemove", Ht), document.addEventListener("mouseup", _t);
1083
- }
1084
- function rn(e) {
1085
- e.preventDefault(), Be = "h", rt = e.clientX, ut = M.value, document.addEventListener("mousemove", Ht), document.addEventListener("mouseup", _t);
1086
- }
1087
- function Ht(e) {
1088
- if (Be === "v") {
1089
- const n = (e.clientY - rt) / (nt.value - at.value);
1090
- z(null, ut + n * De.value), v();
1091
- } else if (Be === "h") {
1092
- const n = (e.clientX - rt) / (lt.value - ot.value);
1093
- z(ut + n * Te.value, null), v();
3175
+ }), ya = E(() => Math.max(0, ge.w - W - Oe)), wa = E(() => Math.max(0, ge.h - N - Oe)), vl = E(() => Math.max(0, ya.value - 11 * 2)), fl = E(() => Math.max(0, wa.value - 11 * 2));
3176
+ function Vl() {
3177
+ return Math.max(0, ge.w - W - Oe);
3178
+ }
3179
+ function Ul() {
3180
+ return Math.max(0, ge.h - N - Oe);
3181
+ }
3182
+ const bl = E(() => Bt.value <= 0 ? vl.value : Math.max(24, Vl() / le.value * vl.value)), Yl = E(() => Bt.value <= 0 ? 0 : S.value / Bt.value * (vl.value - bl.value)), hl = E(() => St.value <= 0 ? fl.value : Math.max(24, Ul() / u.value * fl.value)), Xl = E(() => St.value <= 0 ? 0 : O.value / St.value * (fl.value - hl.value));
3183
+ let pt = null, ml = 0, pl = 0;
3184
+ function ka(e) {
3185
+ e.preventDefault(), pt = "v", ml = e.clientY, pl = O.value, document.addEventListener("mousemove", _l), document.addEventListener("mouseup", jl);
3186
+ }
3187
+ function Ca(e) {
3188
+ e.preventDefault(), pt = "h", ml = e.clientX, pl = S.value, document.addEventListener("mousemove", _l), document.addEventListener("mouseup", jl);
3189
+ }
3190
+ function _l(e) {
3191
+ if (pt === "v") {
3192
+ const l = (e.clientY - ml) / (fl.value - hl.value);
3193
+ Ce(null, pl + l * St.value), g();
3194
+ } else if (pt === "h") {
3195
+ const l = (e.clientX - ml) / (vl.value - bl.value);
3196
+ Ce(pl + l * Bt.value, null), g();
1094
3197
  }
1095
3198
  }
1096
- function _t() {
1097
- Be = null, document.removeEventListener("mousemove", Ht), document.removeEventListener("mouseup", _t);
3199
+ function jl() {
3200
+ pt = null, document.removeEventListener("mousemove", _l), document.removeEventListener("mouseup", jl);
1098
3201
  }
1099
- function un(e) {
1100
- if (Be)
3202
+ function xa(e) {
3203
+ if (pt)
1101
3204
  return;
1102
- const t = e.currentTarget.getBoundingClientRect(), n = e.clientY - t.top;
1103
- n < Dt.value ? z(null, T.value - Mt()) : n > Dt.value + at.value && z(null, T.value + Mt()), v();
3205
+ const t = e.currentTarget.getBoundingClientRect(), l = e.clientY - t.top;
3206
+ l < Xl.value ? Ce(null, O.value - Ul()) : l > Xl.value + hl.value && Ce(null, O.value + Ul()), g();
1104
3207
  }
1105
- function sn(e) {
1106
- if (Be)
3208
+ function Ba(e) {
3209
+ if (pt)
1107
3210
  return;
1108
- const t = e.currentTarget.getBoundingClientRect(), n = e.clientX - t.left;
1109
- n < Tt.value ? z(M.value - Rt(), null) : n > Tt.value + ot.value && z(M.value + Rt(), null), v();
3211
+ const t = e.currentTarget.getBoundingClientRect(), l = e.clientX - t.left;
3212
+ l < Yl.value ? Ce(S.value - Vl(), null) : l > Yl.value + bl.value && Ce(S.value + Vl(), null), g();
1110
3213
  }
1111
- let Ee = !1, ae = 0, re = 0, $e = !1, Ie = !1, ol = 0, al = 0, We = 0, st = 0, Et = 0, $t = 0, rl = 0, ul = 0, Pe = !1, It = !1, Ae = 0, Ne = 0, Wt = 0, sl = -1, cl = -1;
1112
- function cn(e) {
3214
+ let Dt = !1, Ie = 0, We = 0, Tt = !1, Ft = !1, gl = 0, yl = 0, wl = 0, kl = 0, ql = 0, Zl = 0, Ho = 0, Io = 0, qt = !1, Jl = !1, At = 0, Et = 0, Ql = 0, Wo = -1, No = -1;
3215
+ function Sa(e) {
1113
3216
  if (e.button !== 0)
1114
3217
  return;
1115
- e.preventDefault(), fe.value = null;
1116
- const t = ke(e, oe.value);
1117
- if (t.y < y && t.x >= w) {
1118
- const o = t.x - w + M.value, a = le(o);
1119
- if (a >= 0 && Math.abs(t.x - (w + he.value[a + 1] - M.value)) <= 4) {
1120
- $e = !0, ol = a, We = H.value[a], st = o, v();
3218
+ e.preventDefault(), lt.value = null;
3219
+ const t = kt(e, He.value);
3220
+ if (t.y < N && t.x >= W) {
3221
+ const o = t.x - W + S.value, r = $e(o);
3222
+ if (r >= 0 && Math.abs(t.x - (W + De.value[r + 1] - S.value)) <= 4) {
3223
+ q(), Tt = !0, gl = r, wl = L.value[r], kl = o, g();
1121
3224
  return;
1122
3225
  }
1123
3226
  }
1124
- if (t.x < w && t.y >= y) {
1125
- const o = t.y - y + T.value, a = ne(o);
1126
- if (a >= 0 && Math.abs(t.y - (y + pe.value[a + 1] - T.value)) <= 4) {
1127
- Ie = !0, al = a, We = E.value[a], st = o, v();
3227
+ if (t.x < W && t.y >= N) {
3228
+ const o = t.y - N + O.value, r = ze(o);
3229
+ if (r >= 0 && Math.abs(t.y - (N + H.value[r + 1] - O.value)) <= 4) {
3230
+ q(), Ft = !0, yl = r, wl = je(r), kl = o, g();
1128
3231
  return;
1129
3232
  }
1130
3233
  }
1131
- if (t.x < w || t.y < y) {
1132
- if (t.y < y && t.x >= w) {
1133
- const o = le(t.x - w + M.value);
1134
- o >= 0 && (te(o, 0, o, r - 1), Ee = !0, ae = o, re = 0);
1135
- } else if (t.x < w && t.y >= y) {
1136
- const o = ne(t.y - y + T.value);
1137
- o >= 0 && (te(0, o, c - 1, o), Ee = !0, ae = 0, re = o);
3234
+ if (t.x < W || t.y < N) {
3235
+ if (rt(), t.y < N && t.x >= W) {
3236
+ const o = $e(t.x - W + S.value);
3237
+ o >= 0 && (ue(o, 0, o, i - 1), Dt = !0, Ie = o, We = 0);
3238
+ } else if (t.x < W && t.y >= N) {
3239
+ const o = ze(t.y - N + O.value);
3240
+ o >= 0 && (ue(0, o, b - 1, o), Dt = !0, Ie = 0, We = o);
1138
3241
  } else
1139
- t.x < w && t.y < y && mt();
1140
- v();
3242
+ t.x < W && t.y < N && V();
3243
+ g();
1141
3244
  return;
1142
3245
  }
1143
- const n = le(t.x - w + M.value), l = ne(t.y - y + T.value);
1144
- if (!(n < 0 || l < 0)) {
1145
- if (be(), e.shiftKey && g.value) {
1146
- const o = g.value;
1147
- te(o.startCol, o.startRow, n, l);
3246
+ const l = $e(t.x - W + S.value), n = ze(t.y - N + O.value);
3247
+ if (!(l < 0 || n < 0)) {
3248
+ if (rt(), e.shiftKey && k.value) {
3249
+ const o = k.value;
3250
+ ue(o.startCol, o.startRow, l, n);
1148
3251
  } else
1149
- ee(n, l);
1150
- Ee = !0, ae = n, re = l, V(), v();
3252
+ w(l, n);
3253
+ Dt = !0, Ie = l, We = n, Me(), g();
1151
3254
  }
1152
3255
  }
1153
- function fn(e) {
1154
- if ($e) {
1155
- const a = ke(e, oe.value).x - w + M.value - st;
1156
- We + a >= 30 && (H.value[ol] = We + a), v();
3256
+ function Ma(e) {
3257
+ if (Tt) {
3258
+ const r = kt(e, He.value).x - W + S.value - kl, s = wl + r;
3259
+ s >= Qt && s <= Al ? L.value[gl] = s : s < Qt ? L.value[gl] = Qt : L.value[gl] = Al, g();
1157
3260
  return;
1158
3261
  }
1159
- if (Ie) {
1160
- const a = ke(e, oe.value).y - y + T.value - st;
1161
- We + a >= 24 && (E.value[al] = We + a), v();
3262
+ if (Ft) {
3263
+ const r = kt(e, He.value).y - N + O.value - kl, s = wl + r;
3264
+ s >= el && s <= tl ? G.value[yl] = s : s < el ? G.value[yl] = el : G.value[yl] = tl, g();
1162
3265
  return;
1163
3266
  }
1164
- if (!Ee) {
1165
- const o = oe.value;
3267
+ if (!Dt) {
3268
+ const o = He.value;
1166
3269
  if (!o)
1167
3270
  return;
1168
- const a = ke(e, o);
1169
- if (a.y < y && a.x >= w) {
1170
- const d = le(a.x - w + M.value);
1171
- if (d >= 0 && Math.abs(a.x - (w + he.value[d + 1] - M.value)) <= 4) {
3271
+ if (ft.value) {
3272
+ o.style.cursor = "copy";
3273
+ return;
3274
+ }
3275
+ const r = kt(e, o);
3276
+ if (r.y < N && r.x >= W) {
3277
+ const s = $e(r.x - W + S.value);
3278
+ if (s >= 0 && Math.abs(r.x - (W + De.value[s + 1] - S.value)) <= 4) {
1172
3279
  o.style.cursor = "col-resize";
1173
3280
  return;
1174
3281
  }
1175
3282
  }
1176
- if (a.x < w && a.y >= y) {
1177
- const d = ne(a.y - y + T.value);
1178
- if (d >= 0 && Math.abs(a.y - (y + pe.value[d + 1] - T.value)) <= 4) {
3283
+ if (r.x < W && r.y >= N) {
3284
+ const s = ze(r.y - N + O.value);
3285
+ if (s >= 0 && Math.abs(r.y - (N + H.value[s + 1] - O.value)) <= 4) {
1179
3286
  o.style.cursor = "row-resize";
1180
3287
  return;
1181
3288
  }
@@ -1183,450 +3290,553 @@ const Un = { class: "tab-list" }, jn = ["onClick", "onDblclick", "onContextmenu"
1183
3290
  o.style.cursor = "cell";
1184
3291
  return;
1185
3292
  }
1186
- const t = ke(e, oe.value);
1187
- if (ae < 0 || re < 0)
3293
+ const t = kt(e, He.value);
3294
+ if (Ie < 0 || We < 0)
1188
3295
  return;
1189
- if (t.x < w || t.y < y) {
1190
- if (t.y < y && t.x >= w) {
1191
- const o = le(t.x - w + M.value);
1192
- o >= 0 && te(Math.min(ae, o), 0, Math.max(ae, o), r - 1);
1193
- } else if (t.x < w && t.y >= y) {
1194
- const o = ne(t.y - y + T.value);
1195
- o >= 0 && te(0, Math.min(re, o), c - 1, Math.max(re, o));
3296
+ if (t.x < W || t.y < N) {
3297
+ if (t.y < N && t.x >= W) {
3298
+ const o = $e(t.x - W + S.value);
3299
+ o >= 0 && ue(Math.min(Ie, o), 0, Math.max(Ie, o), i - 1);
3300
+ } else if (t.x < W && t.y >= N) {
3301
+ const o = ze(t.y - N + O.value);
3302
+ o >= 0 && ue(0, Math.min(We, o), b - 1, Math.max(We, o));
1196
3303
  }
1197
- v();
3304
+ g();
1198
3305
  return;
1199
3306
  }
1200
- const n = le(t.x - w + M.value), l = ne(t.y - y + T.value);
1201
- n < 0 || l < 0 || (re === 0 && ae >= 0 && g.value && g.value.startRow === 0 && g.value.endRow === r - 1 ? te(Math.min(ae, n), 0, Math.max(ae, n), r - 1) : ae === 0 && re >= 0 && g.value && g.value.startCol === 0 && g.value.endCol === c - 1 ? te(0, Math.min(re, l), c - 1, Math.max(re, l)) : te(ae, re, n, l), v());
3307
+ const l = $e(t.x - W + S.value), n = ze(t.y - N + O.value);
3308
+ l < 0 || n < 0 || (We === 0 && Ie >= 0 && k.value && k.value.startRow === 0 && k.value.endRow === i - 1 ? ue(Math.min(Ie, l), 0, Math.max(Ie, l), i - 1) : Ie === 0 && We >= 0 && k.value && k.value.startCol === 0 && k.value.endCol === b - 1 ? ue(0, Math.min(We, n), b - 1, Math.max(We, n)) : ue(Ie, We, l, n), g());
1202
3309
  }
1203
- function vn() {
1204
- const e = $e || Ie;
1205
- Ee = !1, $e = !1, Ie = !1, e && Qt();
3310
+ function Ra(e) {
3311
+ const t = Tt || Ft;
3312
+ Dt = !1, Tt = !1, Ft = !1, t && Do(), ft.value && on();
1206
3313
  }
1207
- function dn() {
1208
- const e = $e || Ie;
1209
- Ee = !1, $e = !1, Ie = !1, e && Qt();
3314
+ function Da() {
3315
+ const e = Tt || Ft;
3316
+ Dt = !1, Tt = !1, Ft = !1, e && Do();
1210
3317
  }
1211
- function hn(e) {
3318
+ function Ta(e) {
1212
3319
  e.preventDefault();
1213
- const t = ke(e, oe.value);
1214
- if (t.x < w && t.y < y) {
1215
- Gl(e);
3320
+ const t = kt(e, He.value);
3321
+ if (t.x < W && t.y < N) {
3322
+ ua(e);
1216
3323
  return;
1217
3324
  }
1218
- if (t.y < y && t.x >= w) {
1219
- const n = le(t.x - w + M.value);
1220
- n >= 0 && en(e, n);
3325
+ if (t.y < N && t.x >= W) {
3326
+ const l = $e(t.x - W + S.value);
3327
+ l >= 0 && da(e, l);
1221
3328
  return;
1222
3329
  }
1223
- if (t.x < w && t.y >= y) {
1224
- const n = ne(t.y - y + T.value);
1225
- n >= 0 && Ql(e, n);
3330
+ if (t.x < W && t.y >= N) {
3331
+ const l = ze(t.y - N + O.value);
3332
+ l >= 0 && ca(e, l);
1226
3333
  return;
1227
3334
  }
1228
- if (t.x >= w && t.y >= y) {
1229
- const n = le(t.x - w + M.value), l = ne(t.y - y + T.value);
1230
- n >= 0 && l >= 0 && tn(e, n, l);
3335
+ if (t.x >= W && t.y >= N) {
3336
+ const l = $e(t.x - W + S.value), n = ze(t.y - N + O.value);
3337
+ l >= 0 && n >= 0 && va(e, l, n);
1231
3338
  }
1232
3339
  }
1233
- function pn(e) {
1234
- const t = ke(e, oe.value);
1235
- if (t.x < w || t.y < y)
3340
+ function Fa(e) {
3341
+ const t = kt(e, He.value);
3342
+ if (t.x < W || t.y < N)
1236
3343
  return;
1237
- const n = le(t.x - w + M.value), l = ne(t.y - y + T.value);
1238
- n < 0 || l < 0 || (ee(n, l), W(n, l), ve(), v(), V());
3344
+ const l = $e(t.x - W + S.value), n = ze(t.y - N + O.value);
3345
+ l < 0 || n < 0 || (w(l, n), ce(l, n), at(), g(), Me());
1239
3346
  }
1240
- function bn(e) {
1241
- z(M.value + e.deltaX, T.value + e.deltaY), v();
3347
+ function Aa(e) {
3348
+ Ce(S.value + e.deltaX, O.value + e.deltaY), g();
1242
3349
  }
1243
- function mn(e) {
3350
+ function Ea(e) {
1244
3351
  if (e.touches.length !== 1) {
1245
- Pe = !1;
3352
+ qt = !1;
1246
3353
  return;
1247
3354
  }
1248
- const t = e.touches[0], n = oe.value;
1249
- if (!n)
3355
+ const t = e.touches[0], l = He.value;
3356
+ if (!l)
1250
3357
  return;
1251
- const l = n.getBoundingClientRect(), o = t.clientX - l.left, a = t.clientY - l.top;
1252
- o >= w && a >= y && (e.preventDefault(), Pe = !0, It = !1, Et = o, $t = a, rl = M.value, ul = T.value, Ae = le(o - w + M.value), Ne = ne(a - y + T.value));
3358
+ const n = l.getBoundingClientRect(), o = t.clientX - n.left, r = t.clientY - n.top;
3359
+ o >= W && r >= N && (e.preventDefault(), qt = !0, Jl = !1, ql = o, Zl = r, Ho = S.value, Io = O.value, At = $e(o - W + S.value), Et = ze(r - N + O.value));
1253
3360
  }
1254
- function gn(e) {
1255
- if (!Pe || e.touches.length !== 1)
3361
+ function Oa(e) {
3362
+ if (!qt || e.touches.length !== 1)
1256
3363
  return;
1257
- const t = e.touches[0], n = oe.value;
1258
- if (!n)
3364
+ const t = e.touches[0], l = He.value;
3365
+ if (!l)
1259
3366
  return;
1260
- const l = n.getBoundingClientRect(), o = t.clientX - l.left, a = t.clientY - l.top;
1261
- (Math.abs(o - Et) > 8 || Math.abs(a - $t) > 8) && (It = !0, e.preventDefault(), z(rl + (Et - o), ul + ($t - a)), v());
3367
+ const n = l.getBoundingClientRect(), o = t.clientX - n.left, r = t.clientY - n.top;
3368
+ (Math.abs(o - ql) > 8 || Math.abs(r - Zl) > 8) && (Jl = !0, e.preventDefault(), Ce(Ho + (ql - o), Io + (Zl - r)), g());
1262
3369
  }
1263
- function wn() {
1264
- if (Pe && (Pe = !1, !It && Ae >= 0 && Ne >= 0)) {
3370
+ function La() {
3371
+ if (qt && (qt = !1, !Jl && At >= 0 && Et >= 0)) {
1265
3372
  const e = Date.now();
1266
- Ae === sl && Ne === cl && e - Wt < 300 ? (ee(Ae, Ne), ve(), v(), V(), Wt = 0) : (be(), ee(Ae, Ne), v(), Wt = e), sl = Ae, cl = Ne, V();
3373
+ At === Wo && Et === No && e - Ql < 300 ? (w(At, Et), at(), g(), Me(), Ql = 0) : (rt(), w(At, Et), g(), Ql = e), Wo = At, No = Et, Me();
1267
3374
  }
1268
3375
  }
1269
- function At(e) {
3376
+ function eo(e) {
1270
3377
  return e.isComposing || e.key === "Process" || e.keyCode === 229;
1271
3378
  }
1272
- function il(e) {
3379
+ function Go(e) {
1273
3380
  return e.key.length === 1 && !e.ctrlKey && !e.metaKey && !e.altKey;
1274
3381
  }
1275
- function fl(e) {
1276
- if (R.value)
3382
+ function Po(e) {
3383
+ if (A.value)
1277
3384
  return;
1278
- const t = e.ctrlKey || e.metaKey, n = e.shiftKey;
3385
+ const t = e.ctrlKey || e.metaKey, l = e.shiftKey;
1279
3386
  switch (!0) {
1280
3387
  case (t && (e.key === "c" || e.key === "C")):
1281
- e.preventDefault(), Ge();
3388
+ e.preventDefault(), rl();
1282
3389
  return;
1283
3390
  case (t && (e.key === "x" || e.key === "X")):
1284
- e.preventDefault(), wt();
3391
+ e.preventDefault(), Il();
1285
3392
  return;
1286
3393
  case (t && (e.key === "z" || e.key === "Z")):
1287
- e.preventDefault(), Sl();
3394
+ e.preventDefault(), fo();
1288
3395
  return;
1289
3396
  case (t && (e.key === "y" || e.key === "Y")):
1290
- e.preventDefault(), kl();
3397
+ e.preventDefault(), bo();
1291
3398
  return;
1292
3399
  case (t && (e.key === "v" || e.key === "V")):
1293
- e.preventDefault(), K(), Ye().then(() => {
1294
- v(), J(A);
3400
+ e.preventDefault(), q(), Yt().then(() => {
3401
+ g(), re(Q);
1295
3402
  });
1296
3403
  return;
1297
3404
  case (t && (e.key === "a" || e.key === "A")):
1298
- e.preventDefault(), mt(), v();
3405
+ e.preventDefault(), V(), g();
1299
3406
  return;
1300
3407
  case (t && e.key === "Home"):
1301
- e.preventDefault(), ee(0, 0), W(0, 0), v();
3408
+ e.preventDefault(), w(0, 0), ce(0, 0), g();
1302
3409
  return;
1303
3410
  case (t && e.key === "End"):
1304
- e.preventDefault(), ee(c - 1, r - 1), W(c - 1, r - 1), v();
3411
+ e.preventDefault(), w(b - 1, i - 1), ce(b - 1, i - 1), g();
1305
3412
  return;
1306
3413
  case e.key === "Home":
1307
- e.preventDefault(), ee(0, h.value.row), W(0, h.value.row), v();
3414
+ e.preventDefault(), w(0, y.value.row), ce(0, y.value.row), g();
1308
3415
  return;
1309
3416
  case e.key === "End":
1310
- e.preventDefault(), ee(c - 1, h.value.row), W(c - 1, h.value.row), v();
3417
+ e.preventDefault(), w(b - 1, y.value.row), ce(b - 1, y.value.row), g();
1311
3418
  return;
1312
3419
  case e.key === "ArrowUp":
1313
- e.preventDefault(), ie(0, -1), W(h.value.col, h.value.row), v();
3420
+ e.preventDefault(), et(0, -1), ce(y.value.col, y.value.row), g();
1314
3421
  return;
1315
3422
  case e.key === "ArrowDown":
1316
- e.preventDefault(), ie(0, 1), W(h.value.col, h.value.row), v();
3423
+ e.preventDefault(), et(0, 1), ce(y.value.col, y.value.row), g();
1317
3424
  return;
1318
3425
  case e.key === "ArrowLeft":
1319
- e.preventDefault(), ie(-1, 0), W(h.value.col, h.value.row), v();
3426
+ e.preventDefault(), et(-1, 0), ce(y.value.col, y.value.row), g();
1320
3427
  return;
1321
3428
  case e.key === "ArrowRight":
1322
- e.preventDefault(), ie(1, 0), W(h.value.col, h.value.row), v();
3429
+ e.preventDefault(), et(1, 0), ce(y.value.col, y.value.row), g();
1323
3430
  return;
1324
3431
  case e.key === "Tab":
1325
- e.preventDefault(), ie(n ? -1 : 1, 0), W(h.value.col, h.value.row), v();
3432
+ e.preventDefault(), et(l ? -1 : 1, 0), ce(y.value.col, y.value.row), g();
1326
3433
  return;
1327
3434
  case e.key === "Enter":
1328
- e.preventDefault(), ie(0, n ? -1 : 1), W(h.value.col, h.value.row), v();
3435
+ e.preventDefault(), et(0, l ? -1 : 1), ce(y.value.col, y.value.row), g();
1329
3436
  return;
1330
3437
  case e.key === "F2":
1331
- e.preventDefault(), W(h.value.col, h.value.row), ve(), v(), V();
3438
+ e.preventDefault(), ce(y.value.col, y.value.row), at(), g(), Me();
1332
3439
  return;
1333
3440
  case e.key === "Delete":
1334
3441
  case e.key === "Backspace":
1335
- e.preventDefault(), K(), yt(), v();
3442
+ e.preventDefault(), q(), Wl(), g();
1336
3443
  return;
1337
3444
  case e.key === "Escape":
1338
- e.preventDefault(), me(), v();
3445
+ e.preventDefault(), vt(), ft.value = null, g();
1339
3446
  return;
1340
- case il(e):
1341
- if (At(e)) {
1342
- W(h.value.col, h.value.row), ve(""), v(), V();
3447
+ case Go(e):
3448
+ if (eo(e)) {
3449
+ ce(y.value.col, y.value.row), at(""), g(), Me();
1343
3450
  return;
1344
3451
  }
1345
- e.preventDefault(), W(h.value.col, h.value.row), ve(e.key), v(), J(() => {
1346
- const l = Ct.value;
1347
- l && (l.focus(), l.setSelectionRange(1, 1));
3452
+ e.preventDefault(), ce(y.value.col, y.value.row), at(e.key), g(), re(() => {
3453
+ const n = ul.value;
3454
+ n && (n.focus(), n.setSelectionRange(1, 1));
1348
3455
  });
1349
3456
  return;
1350
3457
  }
1351
3458
  }
1352
- let Nt = !1, Lt = !1;
1353
- function yn(e) {
3459
+ let to = !1, lo = !1;
3460
+ function $a(e) {
1354
3461
  const t = e.target.value;
1355
- if (!R.value) {
1356
- W(h.value.col, h.value.row), ve(t), v();
3462
+ if (!A.value) {
3463
+ ce(y.value.col, y.value.row), at(t), g();
1357
3464
  return;
1358
3465
  }
1359
- O.value = t;
3466
+ K.value = t;
1360
3467
  }
1361
- function Bn() {
1362
- Nt = !0, R.value || (W(h.value.col, h.value.row), ve(""), v());
3468
+ function za() {
3469
+ to = !0, A.value || (ce(y.value.col, y.value.row), at(""), g());
1363
3470
  }
1364
- function xn(e) {
1365
- Nt = !1, Lt = !0, setTimeout(() => {
1366
- Lt = !1;
1367
- }, 0), O.value = e.target.value;
3471
+ function Ha(e) {
3472
+ to = !1, lo = !0, setTimeout(() => {
3473
+ lo = !1;
3474
+ }, 0), K.value = e.target.value;
1368
3475
  }
1369
- function Cn(e) {
1370
- if (!R.value) {
1371
- if (il(e) || At(e))
3476
+ function Ia(e) {
3477
+ if (!A.value) {
3478
+ if (Go(e) || eo(e))
1372
3479
  return;
1373
- fl(e);
3480
+ Po(e);
1374
3481
  return;
1375
3482
  }
1376
- Nt || At(e) || Lt && (e.key === "Enter" || e.key === "Escape") || (e.key === "Enter" ? (e.preventDefault(), be(), ie(0, 1), W(h.value.col, h.value.row), v(), V()) : e.key === "Tab" ? (e.preventDefault(), be(), ie(e.shiftKey ? -1 : 1, 0), W(h.value.col, h.value.row), v(), V()) : e.key === "Escape" && (e.preventDefault(), me(), v(), V()));
3483
+ if (!(to || eo(e)) && !(lo && (e.key === "Enter" || e.key === "Escape")))
3484
+ if (e.key === "Enter" && (e.altKey || e.metaKey)) {
3485
+ e.preventDefault();
3486
+ const t = ul.value;
3487
+ if (!t)
3488
+ return;
3489
+ const l = t.selectionStart ?? t.value.length, n = t.selectionEnd ?? t.value.length, o = t.value, r = o.slice(0, l) + `
3490
+ ` + o.slice(n);
3491
+ K.value = r, t.value = r, t.selectionStart = t.selectionEnd = l + 1, g();
3492
+ } else
3493
+ e.key === "Enter" ? (e.preventDefault(), rt(), et(0, 1), ce(y.value.col, y.value.row), g(), Me()) : e.key === "Tab" ? (e.preventDefault(), rt(), et(e.shiftKey ? -1 : 1, 0), ce(y.value.col, y.value.row), g(), Me()) : e.key === "Escape" && (e.preventDefault(), vt(), g(), Me());
1377
3494
  }
1378
- function Sn() {
3495
+ function Wa(e) {
3496
+ A.value;
3497
+ }
3498
+ function Na() {
1379
3499
  setTimeout(() => {
1380
- R.value && (be(), v());
3500
+ A.value && (rt(), g());
1381
3501
  }, 0);
1382
3502
  }
1383
- function ct() {
3503
+ function Cl() {
1384
3504
  var t;
1385
- const e = (t = we.value) == null ? void 0 : t.getBoundingClientRect();
3505
+ const e = (t = ht.value) == null ? void 0 : t.getBoundingClientRect();
1386
3506
  if (e) {
1387
- const n = Se(f.width), l = Se(f.height);
1388
- n != null ? U.w = n : U.w = e.width, l != null ? U.h = l : U.h = e.height;
3507
+ const l = wt(p.width), n = wt(p.height);
3508
+ l != null ? ge.w = l : ge.w = e.width, n != null ? ge.h = n : ge.h = e.height;
1389
3509
  }
1390
- z(null, null), v();
1391
- }
1392
- let q = null;
1393
- return Mn(() => {
1394
- const e = Se(f.width), t = Se(f.height);
1395
- (e == null || t == null) && (q = new ResizeObserver(() => ct()), we.value && q.observe(we.value)), J(() => {
1396
- ct(), V();
1397
- }), ee(0, 0), m.value && m.value.length > 0 && (k = JSON.stringify(m.value), D.value = m.value.map((n) => {
1398
- const l = et(n.name);
1399
- for (const [o, a] of Object.entries(n.cells))
1400
- l.cells[o] = { value: a.value, style: a.style ?? null };
1401
- if (n.colWidths)
1402
- for (const [o, a] of Object.entries(n.colWidths)) {
1403
- const d = Number(o);
1404
- d >= 0 && d < c && a >= 30 && (l.colWidths[d] = a);
3510
+ Ce(null, null), g();
3511
+ }
3512
+ let Fe = null;
3513
+ return so(() => {
3514
+ const e = wt(p.width), t = wt(p.height);
3515
+ (e == null || t == null) && (Fe = new ResizeObserver(() => Cl()), ht.value && Fe.observe(ht.value)), re(() => {
3516
+ Cl(), Me();
3517
+ }), w(0, 0), B.value && B.value.length > 0 && (F = JSON.stringify(B.value), Z.value = B.value.map((l) => {
3518
+ const n = sl(l.name);
3519
+ for (const [o, r] of Object.entries(l.cells))
3520
+ n.cells[o] = { value: r.value, style: r.style ?? null };
3521
+ if (l.colWidths)
3522
+ for (const [o, r] of Object.entries(l.colWidths)) {
3523
+ const s = Number(o);
3524
+ s >= 0 && s < b && r >= 30 && (n.colWidths[s] = r);
1405
3525
  }
1406
- if (n.rowHeights)
1407
- for (const [o, a] of Object.entries(n.rowHeights)) {
1408
- const d = Number(o);
1409
- d >= 0 && d < r && a >= 24 && (l.rowHeights[d] = a);
3526
+ if (l.rowHeights)
3527
+ for (const [o, r] of Object.entries(l.rowHeights)) {
3528
+ const s = Number(o);
3529
+ s >= 0 && s < i && r >= 24 && (n.rowHeights[s] = r);
1410
3530
  }
1411
- return l;
1412
- }), D.value.length > 0 && ge(0));
1413
- }), Ve(() => [f.width, f.height], () => {
1414
- const e = Se(f.width), t = Se(f.height);
1415
- e != null && t != null ? (q == null || q.disconnect(), q = null) : !q && we.value && (q = new ResizeObserver(() => ct()), q.observe(we.value)), J(() => ct());
1416
- }), Ve(() => f.theme, () => v()), Ve(() => ({ ...b }), () => J(A), { deep: !1 }), Ve(Z, () => J(A)), Ve(() => m.value, (e) => {
3531
+ return n;
3532
+ }), Z.value.length > 0 && st(0));
3533
+ }), Je(() => [p.width, p.height], () => {
3534
+ const e = wt(p.width), t = wt(p.height);
3535
+ e != null && t != null ? (Fe == null || Fe.disconnect(), Fe = null) : !Fe && ht.value && (Fe = new ResizeObserver(() => Cl()), Fe.observe(ht.value)), re(() => Cl());
3536
+ }), Je(() => p.theme, () => g()), Je(() => ({ ...m }), () => re(Q), { deep: !1 }), Je(Se, () => re(Q)), Je(() => B.value, (e) => {
1417
3537
  if (!e || e.length === 0)
1418
3538
  return;
1419
3539
  const t = JSON.stringify(e);
1420
- t !== k && (k = t, D.value = e.map((n) => {
1421
- const l = et(n.name);
1422
- for (const [o, a] of Object.entries(n.cells))
1423
- l.cells[o] = { value: a.value, style: a.style ?? null };
1424
- if (n.colWidths)
1425
- for (const [o, a] of Object.entries(n.colWidths)) {
1426
- const d = Number(o);
1427
- d >= 0 && d < c && a >= 30 && (l.colWidths[d] = a);
3540
+ t !== F && (F = t, Z.value = e.map((l) => {
3541
+ const n = sl(l.name);
3542
+ for (const [o, r] of Object.entries(l.cells))
3543
+ n.cells[o] = { value: r.value, style: r.style ?? null };
3544
+ if (l.colWidths)
3545
+ for (const [o, r] of Object.entries(l.colWidths)) {
3546
+ const s = Number(o);
3547
+ s >= 0 && s < b && r >= 30 && (n.colWidths[s] = r);
1428
3548
  }
1429
- if (n.rowHeights)
1430
- for (const [o, a] of Object.entries(n.rowHeights)) {
1431
- const d = Number(o);
1432
- d >= 0 && d < r && a >= 24 && (l.rowHeights[d] = a);
3549
+ if (l.rowHeights)
3550
+ for (const [o, r] of Object.entries(l.rowHeights)) {
3551
+ const s = Number(o);
3552
+ s >= 0 && s < i && r >= 24 && (n.rowHeights[s] = r);
1433
3553
  }
1434
- return l;
1435
- }), D.value.length > 0 && ge(0), v());
1436
- }, { deep: !0 }), Tn(() => {
1437
- q == null || q.disconnect();
1438
- }), (e, t) => (j(), P("div", {
3554
+ return n;
3555
+ }), Z.value.length > 0 && st(0), g());
3556
+ }, { deep: !0 }), ll(() => {
3557
+ Fe == null || Fe.disconnect();
3558
+ }), (e, t) => (x(), z("div", {
1439
3559
  class: "spreadsheet-outer",
1440
- style: Ce(Al.value)
3560
+ style: Le(Xn.value)
1441
3561
  }, [
1442
- $("div", {
1443
- class: "tab-bar",
1444
- onContextmenu: ql
1445
- }, [
1446
- $("div", Un, [
1447
- (j(!0), P(Yt, null, Ut(D.value, (n, l) => (j(), P("div", {
1448
- key: n.id,
1449
- class: vt(["tab-item", { "tab-item--active": l === Z.value }]),
1450
- onClick: (o) => Pl(l),
1451
- onDblclick: ue((o) => tl(l), ["prevent"]),
1452
- onContextmenu: (o) => Zl(o, l)
1453
- }, [
1454
- ye.value === l ? (j(), P("input", {
1455
- key: 0,
1456
- class: "tab-rename-input",
1457
- value: He.value,
1458
- onInput: t[0] || (t[0] = (o) => He.value = o.target.value),
1459
- onKeydown: Vl,
1460
- onBlur: ll,
1461
- onClick: t[1] || (t[1] = ue(() => {
1462
- }, ["stop"]))
1463
- }, null, 40, Kn)) : (j(), P("span", Pn, dt(n.name), 1))
1464
- ], 42, jn))), 128))
1465
- ]),
1466
- $("button", {
1467
- class: "tab-bar__add-btn",
1468
- title: se(C)(s.value, "addSheet"),
1469
- onClick: t[2] || (t[2] = (n) => {
1470
- Bt(), v();
1471
- })
1472
- }, " + ", 8, zn)
1473
- ], 32),
1474
- $("div", Vn, [
1475
- $("div", Jn, dt(Ol.value), 1),
1476
- $("input", {
3562
+ ke(Si, {
3563
+ locale: c.value,
3564
+ "can-undo": Qo.value,
3565
+ "can-redo": en.value,
3566
+ "paint-fmt-active": ft.value !== null,
3567
+ "has-selection": tn.value,
3568
+ "font-family-options": an.value,
3569
+ "font-size-options": rn.value,
3570
+ "sel-font-family": sn.value,
3571
+ "sel-font-size": Te.value,
3572
+ "font-size-input": it.value,
3573
+ "font-size-menu-open": bt.value,
3574
+ "sel-font-weight": mo.value,
3575
+ "sel-font-style": po.value,
3576
+ "sel-underline": go.value,
3577
+ "sel-strikethrough": yo.value,
3578
+ "sel-text-color": On.value,
3579
+ "text-color-menu-open": $l.value,
3580
+ "sel-fill-color": Ln.value,
3581
+ "fill-color-menu-open": zl.value,
3582
+ "cached-text-color": nl.value,
3583
+ "cached-fill-color": al.value,
3584
+ "border-menu-open": wo.value,
3585
+ "cached-border": Hl.value,
3586
+ "h-align-options": dn.value,
3587
+ "v-align-options": vn.value,
3588
+ "sel-h-align": fn.value,
3589
+ "sel-v-align": bn.value,
3590
+ "sel-wrap": ho.value,
3591
+ onUndo: t[0] || (t[0] = (l) => fo()),
3592
+ onRedo: t[1] || (t[1] = (l) => bo()),
3593
+ onPaintFormat: ln,
3594
+ onClearFormat: t[2] || (t[2] = (l) => nn()),
3595
+ onFontFamilyChange: t[3] || (t[3] = (l) => un(l)),
3596
+ onFontSizeInput: t[4] || (t[4] = (l) => gn(l)),
3597
+ onFontSizeBlur: yn,
3598
+ onFontSizeKeydown: t[5] || (t[5] = (l) => wn(l)),
3599
+ onFontSizeChange: t[6] || (t[6] = (l) => cn(l)),
3600
+ "onUpdate:fontSizeMenuOpen": t[7] || (t[7] = (l) => bt.value = l),
3601
+ onFontSizeToggle: t[8] || (t[8] = (l) => kn()),
3602
+ onFontSizeStepUp: Cn,
3603
+ onFontSizeStepDown: xn,
3604
+ onBoldToggle: Bn,
3605
+ onItalicToggle: Sn,
3606
+ onUnderlineToggle: Mn,
3607
+ onStrikethroughToggle: Rn,
3608
+ onTextColorChange: t[9] || (t[9] = (l) => Tn(l)),
3609
+ "onUpdate:textColorMenuOpen": t[10] || (t[10] = (l) => $l.value = l),
3610
+ onFillColorChange: t[11] || (t[11] = (l) => Fn(l)),
3611
+ "onUpdate:fillColorMenuOpen": t[12] || (t[12] = (l) => zl.value = l),
3612
+ onApplyTextColor: An,
3613
+ onApplyFillColor: En,
3614
+ "onUpdate:borderMenuOpen": t[13] || (t[13] = (l) => Dn(l)),
3615
+ onBorderChange: t[14] || (t[14] = (l) => ko(l)),
3616
+ onApplyBorder: zn,
3617
+ onHAlignChange: t[15] || (t[15] = (l) => hn(l)),
3618
+ onVAlignChange: t[16] || (t[16] = (l) => mn(l)),
3619
+ onWrapToggle: pn
3620
+ }, null, 8, ["locale", "can-undo", "can-redo", "paint-fmt-active", "has-selection", "font-family-options", "font-size-options", "sel-font-family", "sel-font-size", "font-size-input", "font-size-menu-open", "sel-font-weight", "sel-font-style", "sel-underline", "sel-strikethrough", "sel-text-color", "text-color-menu-open", "sel-fill-color", "fill-color-menu-open", "cached-text-color", "cached-fill-color", "border-menu-open", "cached-border", "h-align-options", "v-align-options", "sel-h-align", "sel-v-align", "sel-wrap"]),
3621
+ d("div", Ni, [
3622
+ d("div", Gi, Ye(Zn.value), 1),
3623
+ d("input", {
1477
3624
  ref_key: "formulaBarRef",
1478
- ref: St,
3625
+ ref: Pl,
1479
3626
  class: "formula-bar__input",
1480
- value: Xl.value,
1481
- onFocus: Yl,
1482
- onInput: Ul,
1483
- onKeydown: jl,
1484
- onBlur: Kl
1485
- }, null, 40, Zn)
3627
+ value: Jn.value,
3628
+ onFocus: Qn,
3629
+ onInput: ea,
3630
+ onKeydown: ta,
3631
+ onBlur: la
3632
+ }, null, 40, Pi)
1486
3633
  ]),
1487
- $("div", {
3634
+ d("div", {
1488
3635
  ref_key: "wrapperRef",
1489
- ref: we,
3636
+ ref: ht,
1490
3637
  class: "spreadsheet-wrapper"
1491
3638
  }, [
1492
- $("canvas", {
3639
+ d("canvas", {
1493
3640
  ref_key: "canvasRef",
1494
- ref: oe,
3641
+ ref: He,
1495
3642
  class: "grid-canvas",
1496
3643
  tabindex: "0",
1497
- onMousedown: cn,
1498
- onMousemove: fn,
1499
- onMouseup: vn,
1500
- onMouseleave: dn,
1501
- onDblclick: pn,
1502
- onWheel: ue(bn, ["prevent"]),
1503
- onFocus: Ll,
1504
- onKeydown: fl,
1505
- onContextmenu: hn,
1506
- onTouchstart: ue(mn, ["prevent"]),
1507
- onTouchmove: ue(gn, ["prevent"]),
1508
- onTouchend: wn
3644
+ onMousedown: Sa,
3645
+ onMousemove: Ma,
3646
+ onMouseup: Ra,
3647
+ onMouseleave: Da,
3648
+ onDblclick: Fa,
3649
+ onWheel: he(Aa, ["prevent"]),
3650
+ onFocus: jn,
3651
+ onKeydown: Po,
3652
+ onContextmenu: Ta,
3653
+ onTouchstart: he(Ea, ["prevent"]),
3654
+ onTouchmove: he(Oa, ["prevent"]),
3655
+ onTouchend: La
1509
3656
  }, null, 544),
1510
- $("input", {
3657
+ d("textarea", {
1511
3658
  ref_key: "editInputRef",
1512
- ref: Ct,
3659
+ ref: ul,
1513
3660
  class: "cell-editor",
1514
- value: O.value,
1515
- style: Ce(ln.value),
1516
- onInput: yn,
1517
- onKeydown: Cn,
1518
- onCompositionstart: Bn,
1519
- onCompositionend: xn,
1520
- onBlur: Sn
1521
- }, null, 44, qn),
1522
- De.value > 0 ? (j(), P("div", {
3661
+ value: K.value,
3662
+ style: Le(ga.value),
3663
+ onInput: $a,
3664
+ onKeydown: Ia,
3665
+ onCompositionstart: za,
3666
+ onCompositionend: Ha,
3667
+ onBlur: Na,
3668
+ onPaste: Wa
3669
+ }, null, 44, Ki),
3670
+ St.value > 0 ? (x(), z("div", {
1523
3671
  key: 0,
1524
3672
  class: "v-scrollbar",
1525
- style: Ce({ top: se(y) + "px", height: `calc(100% - ${se(y) + se(Q)}px)` })
3673
+ style: Le({ top: I(N) + "px", height: `calc(100% - ${I(N) + I(Oe)}px)` })
1526
3674
  }, [
1527
- $("button", {
3675
+ d("button", {
1528
3676
  class: "sb-btn sb-btn--up",
1529
- title: se(C)(s.value, "scrollUp"),
1530
- onMousedown: t[3] || (t[3] = ue((n) => {
1531
- z(null, T.value - 50), v();
3677
+ title: I(C)(c.value, "scrollUp"),
3678
+ onMousedown: t[17] || (t[17] = he((l) => {
3679
+ Ce(null, O.value - 50), g();
1532
3680
  }, ["prevent"]))
1533
- }, [...t[8] || (t[8] = [
1534
- $("span", { class: "sb-arrow sb-arrow--up" }, null, -1)
1535
- ])], 40, Gn),
1536
- $("div", {
3681
+ }, [...t[31] || (t[31] = [
3682
+ d("span", { class: "sb-arrow sb-arrow--up" }, null, -1)
3683
+ ])], 40, Vi),
3684
+ d("div", {
1537
3685
  class: "sb-track sb-track--v",
1538
- onMousedown: un
3686
+ onMousedown: xa
1539
3687
  }, [
1540
- $("div", {
3688
+ d("div", {
1541
3689
  class: "sb-thumb sb-thumb--v",
1542
- style: Ce({ top: Dt.value + "px", height: at.value + "px" }),
1543
- onMousedown: an
3690
+ style: Le({ top: Xl.value + "px", height: hl.value + "px" }),
3691
+ onMousedown: ka
1544
3692
  }, null, 36)
1545
3693
  ], 32),
1546
- $("button", {
3694
+ d("button", {
1547
3695
  class: "sb-btn sb-btn--down",
1548
- title: se(C)(s.value, "scrollDown"),
1549
- onMousedown: t[4] || (t[4] = ue((n) => {
1550
- z(null, T.value + 50), v();
3696
+ title: I(C)(c.value, "scrollDown"),
3697
+ onMousedown: t[18] || (t[18] = he((l) => {
3698
+ Ce(null, O.value + 50), g();
1551
3699
  }, ["prevent"]))
1552
- }, [...t[9] || (t[9] = [
1553
- $("span", { class: "sb-arrow sb-arrow--down" }, null, -1)
1554
- ])], 40, Qn)
1555
- ], 4)) : Fe("", !0),
1556
- Te.value > 0 ? (j(), P("div", {
3700
+ }, [...t[32] || (t[32] = [
3701
+ d("span", { class: "sb-arrow sb-arrow--down" }, null, -1)
3702
+ ])], 40, Ui)
3703
+ ], 4)) : ye("", !0),
3704
+ Bt.value > 0 ? (x(), z("div", {
1557
3705
  key: 1,
1558
3706
  class: "h-scrollbar",
1559
- style: Ce({ left: se(w) + "px", width: `calc(100% - ${se(w) + se(Q)}px)` })
3707
+ style: Le({ left: I(W) + "px", width: `calc(100% - ${I(W) + I(Oe)}px)` })
1560
3708
  }, [
1561
- $("button", {
3709
+ d("button", {
1562
3710
  class: "sb-btn sb-btn--left",
1563
- title: se(C)(s.value, "scrollLeft"),
1564
- onMousedown: t[5] || (t[5] = ue((n) => {
1565
- z(M.value - 50, null), v();
3711
+ title: I(C)(c.value, "scrollLeft"),
3712
+ onMousedown: t[19] || (t[19] = he((l) => {
3713
+ Ce(S.value - 50, null), g();
1566
3714
  }, ["prevent"]))
1567
- }, [...t[10] || (t[10] = [
1568
- $("span", { class: "sb-arrow sb-arrow--left" }, null, -1)
1569
- ])], 40, eo),
1570
- $("div", {
3715
+ }, [...t[33] || (t[33] = [
3716
+ d("span", { class: "sb-arrow sb-arrow--left" }, null, -1)
3717
+ ])], 40, Yi),
3718
+ d("div", {
1571
3719
  class: "sb-track sb-track--h",
1572
- onMousedown: sn
3720
+ onMousedown: Ba
1573
3721
  }, [
1574
- $("div", {
3722
+ d("div", {
1575
3723
  class: "sb-thumb sb-thumb--h",
1576
- style: Ce({ left: Tt.value + "px", width: ot.value + "px" }),
1577
- onMousedown: rn
3724
+ style: Le({ left: Yl.value + "px", width: bl.value + "px" }),
3725
+ onMousedown: Ca
1578
3726
  }, null, 36)
1579
3727
  ], 32),
1580
- $("button", {
3728
+ d("button", {
1581
3729
  class: "sb-btn sb-btn--right",
1582
- title: se(C)(s.value, "scrollRight"),
1583
- onMousedown: t[6] || (t[6] = ue((n) => {
1584
- z(M.value + 50, null), v();
3730
+ title: I(C)(c.value, "scrollRight"),
3731
+ onMousedown: t[20] || (t[20] = he((l) => {
3732
+ Ce(S.value + 50, null), g();
1585
3733
  }, ["prevent"]))
1586
- }, [...t[11] || (t[11] = [
1587
- $("span", { class: "sb-arrow sb-arrow--right" }, null, -1)
1588
- ])], 40, to)
1589
- ], 4)) : Fe("", !0),
1590
- Te.value > 0 && De.value > 0 ? (j(), P("div", lo)) : Fe("", !0)
3734
+ }, [...t[34] || (t[34] = [
3735
+ d("span", { class: "sb-arrow sb-arrow--right" }, null, -1)
3736
+ ])], 40, Xi)
3737
+ ], 4)) : ye("", !0),
3738
+ Bt.value > 0 && St.value > 0 ? (x(), z("div", _i)) : ye("", !0)
1591
3739
  ], 512),
1592
- (j(), Dn(Hn, { to: "body" }, [
1593
- fe.value ? (j(), P("div", {
1594
- key: 0,
1595
- class: "context-menu",
1596
- style: Ce({ left: fe.value.x + "px", top: fe.value.y + "px" }),
1597
- onClick: t[7] || (t[7] = ue(() => {
1598
- }, ["stop"]))
1599
- }, [
1600
- (j(!0), P(Yt, null, Ut(fe.value.items, (n, l) => (j(), P("div", {
1601
- key: l,
1602
- class: vt(["context-menu__item", { "context-menu__item--disabled": n.disabled }]),
1603
- onClick: (o) => !n.disabled && n.action && (n.action(), fe.value = null),
1604
- onMouseenter: (o) => Jl(o, n)
1605
- }, [
1606
- $("span", oo, dt(n.label), 1),
1607
- n.children ? (j(), P("span", ao)) : Fe("", !0),
1608
- n.children ? (j(), P("div", {
1609
- key: 1,
1610
- class: vt(["context-submenu", { "context-submenu--left": tt.value }])
3740
+ ke(Ei, {
3741
+ locale: c.value,
3742
+ sheets: Z.value,
3743
+ "active-sheet-index": Se.value,
3744
+ "ren-tab": mt.value,
3745
+ "ren-tab-val": Mt.value,
3746
+ onTabClick: t[21] || (t[21] = (l) => oa(l)),
3747
+ onTabDblclick: t[22] || (t[22] = (l) => Fo(l)),
3748
+ onTabContextmenu: t[23] || (t[23] = (l) => ia(l.ev, l.i)),
3749
+ onTabRenameInput: t[24] || (t[24] = (l) => Mt.value = l),
3750
+ onTabRenameKeydown: t[25] || (t[25] = (l) => aa(l)),
3751
+ onTabRenameCommit: Ao,
3752
+ onTabbarContextmenu: t[26] || (t[26] = (l) => sa(l)),
3753
+ onAddSheet: t[27] || (t[27] = (l) => {
3754
+ Nl(), g();
3755
+ })
3756
+ }, null, 8, ["locale", "sheets", "active-sheet-index", "ren-tab", "ren-tab-val"]),
3757
+ (x(), ne(ae, { to: "body" }, [
3758
+ ke(Nt, { name: "menu-pop" }, {
3759
+ default: Gt(() => [
3760
+ lt.value ? (x(), z("div", {
3761
+ key: 0,
3762
+ class: "context-menu",
3763
+ style: Le({ left: lt.value.x + "px", top: lt.value.y + "px" }),
3764
+ onClick: t[28] || (t[28] = he(() => {
3765
+ }, ["stop"]))
3766
+ }, [
3767
+ (x(!0), z(Qe, null, ot(lt.value.items, (l, n) => (x(), z("div", {
3768
+ key: n,
3769
+ class: ie(["context-menu__item", { "context-menu__item--disabled": l.disabled }]),
3770
+ onClick: (o) => !l.disabled && l.action && (l.action(), lt.value = null),
3771
+ onMouseenter: (o) => ra(o, l)
3772
+ }, [
3773
+ d("span", qi, Ye(l.label), 1),
3774
+ l.children ? (x(), z("span", Zi)) : ye("", !0),
3775
+ l.children ? (x(), z("div", {
3776
+ key: 1,
3777
+ class: ie(["context-submenu", { "context-submenu--left": cl.value }])
3778
+ }, [
3779
+ (x(!0), z(Qe, null, ot(l.children, (o, r) => (x(), z("div", {
3780
+ key: r,
3781
+ class: ie(["context-menu__item", { "context-menu__item--disabled": o.disabled }]),
3782
+ onClick: he((s) => !o.disabled && o.action && (o.action(), lt.value = null), ["stop"])
3783
+ }, Ye(o.label), 11, Ji))), 128))
3784
+ ], 2)) : ye("", !0)
3785
+ ], 42, ji))), 128))
3786
+ ], 4)) : ye("", !0)
3787
+ ]),
3788
+ _: 1
3789
+ })
3790
+ ])),
3791
+ (x(), ne(ae, { to: "body" }, [
3792
+ ke(Nt, { name: "menu-pop" }, {
3793
+ default: Gt(() => [
3794
+ xe.value ? (x(), z("div", {
3795
+ key: 0,
3796
+ class: "dim-panel",
3797
+ style: Le({ left: xe.value.x + "px", top: xe.value.y + "px" }),
3798
+ onMousedown: t[29] || (t[29] = he(() => {
3799
+ }, ["stop"])),
3800
+ onClick: t[30] || (t[30] = he(() => {
3801
+ }, ["stop"]))
1611
3802
  }, [
1612
- (j(!0), P(Yt, null, Ut(n.children, (o, a) => (j(), P("div", {
1613
- key: a,
1614
- class: vt(["context-menu__item", { "context-menu__item--disabled": o.disabled }]),
1615
- onClick: ue((d) => !o.disabled && o.action && (o.action(), fe.value = null), ["stop"])
1616
- }, dt(o.label), 11, ro))), 128))
1617
- ], 2)) : Fe("", !0)
1618
- ], 42, no))), 128))
1619
- ], 4)) : Fe("", !0)
3803
+ d("div", Qi, Ye(xe.value.type === "row" ? I(C)(c.value, "rowHeight") : I(C)(c.value, "colWidth")), 1),
3804
+ d("div", es, [
3805
+ d("input", {
3806
+ ref_key: "dimInputRef",
3807
+ ref: Oo,
3808
+ class: ie(["dim-panel__input", { "dim-panel__input--error": xe.value.error }]),
3809
+ type: "number",
3810
+ step: "1",
3811
+ min: "1",
3812
+ inputmode: "numeric",
3813
+ value: xe.value.value,
3814
+ onInput: fa,
3815
+ onKeydown: ba,
3816
+ onBlur: ha
3817
+ }, null, 42, ts),
3818
+ t[35] || (t[35] = d("span", { class: "dim-panel__unit" }, "px", -1))
3819
+ ]),
3820
+ xe.value.error ? (x(), z("div", ls, Ye(xe.value.error), 1)) : ye("", !0),
3821
+ d("div", os, [
3822
+ d("button", {
3823
+ class: "dim-panel__btn dim-panel__btn--primary",
3824
+ onClick: zo
3825
+ }, Ye(I(C)(c.value, "ok")), 1),
3826
+ d("button", {
3827
+ class: "dim-panel__btn",
3828
+ onClick: dl
3829
+ }, Ye(I(C)(c.value, "cancel")), 1)
3830
+ ])
3831
+ ], 36)) : ye("", !0)
3832
+ ]),
3833
+ _: 1
3834
+ })
1620
3835
  ]))
1621
3836
  ], 4));
1622
3837
  }
1623
- }), so = (u, f) => {
1624
- const s = u.__vccOpts || u;
1625
- for (const [c, r] of f)
1626
- s[c] = r;
1627
- return s;
1628
- }, io = /* @__PURE__ */ so(uo, [["__scopeId", "data-v-5100e6d6"]]);
3838
+ }), is = /* @__PURE__ */ Vt(as, [["__scopeId", "data-v-c6748ebf"]]);
1629
3839
  export {
1630
- io as Spreader,
1631
- io as default
3840
+ is as Spreader,
3841
+ is as default
1632
3842
  };