@nouxwell/tabula-vue 0.0.0-stage → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js ADDED
@@ -0,0 +1,4640 @@
1
+ import { Fragment as e, computed as t, createBlock as n, createCommentVNode as r, createElementBlock as i, createElementVNode as a, createTextVNode as o, createVNode as s, defineComponent as c, mergeModels as l, nextTick as u, normalizeClass as d, normalizeStyle as f, onBeforeUnmount as p, onMounted as m, openBlock as h, ref as g, renderList as _, renderSlot as v, shallowRef as y, toDisplayString as b, toRaw as x, unref as S, useId as C, useModel as w, vModelCheckbox as T, vModelSelect as E, vModelText as D, watch as O, withDirectives as ee, withKeys as k, withModifiers as A } from "vue";
2
+ import { REDO_ORIGIN as j, RowView as M, Selection as N, SheetValidator as te, TabulaError as ne, UNDO_ORIGIN as re, UndoHistory as ie, VALUE_SETTINGS as P, adjustValue as ae, arrangeColumns as oe, autoColumnWidth as se, clampColumnWidth as ce, distinctValues as le, editText as ue, fillValues as de, filterKeys as fe, findCells as pe, formatCell as F, formulaParts as me, hasRange as he, headerDisplayText as ge, mapDraft as _e, parseTsv as ve, readInput as ye, replaceCells as be, resolveColumnSizing as xe, rowOrder as Se, rowStyles as Ce, rowsMatching as we, suggestRenames as Te, summarizeCells as Ee, toTsv as De, valueProblem as Oe, withColumn as ke, withDefaults as Ae } from "@nouxwell/tabula-core";
3
+ // src/address.ts
4
+ function je(e) {
5
+ let t = "";
6
+ for (let n = Math.floor(e) + 1; n > 0; n = Math.floor((n - 1) / 26)) t = String.fromCharCode(65 + (n - 1) % 26) + t;
7
+ return t;
8
+ }
9
+ function Me(e) {
10
+ let t = /^\s*([A-Za-z]{1,3})\s*(\d{1,9})\s*$/.exec(e), n = t?.[1], r = t?.[2];
11
+ if (n === void 0 || r === void 0) return null;
12
+ let i = 0;
13
+ for (let e of n.toUpperCase()) i = i * 26 + (e.charCodeAt(0) - 64);
14
+ let a = Number(r);
15
+ return a > 0 ? {
16
+ col: i - 1,
17
+ row: a
18
+ } : null;
19
+ }
20
+ // src/ScrollThumbs.vue?vue&type=script&setup=true&lang.ts
21
+ var I = 2, L = 9, Ne = 24, Pe = /* @__PURE__ */ c({
22
+ __name: "ScrollThumbs",
23
+ props: {
24
+ target: {},
25
+ insetTop: { default: 0 },
26
+ insetLeft: { default: 0 },
27
+ layer: { default: void 0 }
28
+ },
29
+ setup(t) {
30
+ let n = t, a = y(null), o = y(null), s = y(null), c = 0, l = null, u = null, m = null;
31
+ function g(e, t, n, r, i) {
32
+ let a = t - e, o = e - r - 4 - i;
33
+ if (a < 1 || o < Ne) return null;
34
+ let s = Math.max(0, e - r) / Math.max(1, t - r), c = Math.min(o, Math.max(Ne, Math.round(o * s)));
35
+ return {
36
+ start: r + I,
37
+ length: o,
38
+ thumb: c,
39
+ range: a,
40
+ at: n
41
+ };
42
+ }
43
+ let _ = {
44
+ x: null,
45
+ y: null
46
+ };
47
+ function v() {
48
+ c = 0;
49
+ let e = n.target;
50
+ if (!e) {
51
+ a.value = o.value = null, _ = {
52
+ x: null,
53
+ y: null
54
+ };
55
+ return;
56
+ }
57
+ let t = e.scrollWidth - e.clientWidth >= 1, r = e.scrollHeight - e.clientHeight >= 1, i = g(e.clientHeight, e.scrollHeight, e.scrollTop, n.insetTop, t ? L : 0), s = g(e.clientWidth, e.scrollWidth, e.scrollLeft, n.insetLeft, r ? L : 0);
58
+ _ = {
59
+ x: s,
60
+ y: i
61
+ }, a.value = i ? {
62
+ top: `${e.offsetTop + i.start + (i.length - i.thumb) * i.at / i.range}px`,
63
+ left: `${e.offsetLeft + e.clientWidth}px`,
64
+ height: `${i.thumb}px`
65
+ } : null, o.value = s ? {
66
+ top: `${e.offsetTop + e.clientHeight}px`,
67
+ left: `${e.offsetLeft + s.start + (s.length - s.thumb) * s.at / s.range}px`,
68
+ width: `${s.thumb}px`
69
+ } : null;
70
+ }
71
+ function b() {
72
+ c === 0 && (c = requestAnimationFrame(v));
73
+ }
74
+ function x(e) {
75
+ l = new ResizeObserver(b), l.observe(e);
76
+ for (let t of Array.from(e.children)) l.observe(t);
77
+ u = new MutationObserver(b), u.observe(e, {
78
+ childList: !0,
79
+ attributes: !0,
80
+ attributeFilter: ["style", "class"]
81
+ }), e.addEventListener("scroll", b, { passive: !0 });
82
+ }
83
+ function S(e) {
84
+ l?.disconnect(), u?.disconnect(), l = u = null, e?.removeEventListener("scroll", b);
85
+ }
86
+ O(() => n.target, (e, t) => {
87
+ S(t ?? null), e && x(e), b();
88
+ }, { immediate: !0 }), O(() => [n.insetTop, n.insetLeft], b);
89
+ function C(e, t) {
90
+ let r = n.target, i = _[t];
91
+ e.button === 0 && r && i && (e.preventDefault(), e.stopPropagation(), e.currentTarget.setPointerCapture(e.pointerId), m = {
92
+ axis: t,
93
+ from: t === "y" ? e.clientY : e.clientX,
94
+ scroll: t === "y" ? r.scrollTop : r.scrollLeft,
95
+ ratio: i.range / Math.max(1, i.length - i.thumb)
96
+ }, s.value = t);
97
+ }
98
+ function w(e) {
99
+ let t = n.target;
100
+ if (!m || !t) return;
101
+ let r = (m.axis === "y" ? e.clientY : e.clientX) - m.from;
102
+ m.axis === "y" ? t.scrollTop = m.scroll + r * m.ratio : t.scrollLeft = m.scroll + r * m.ratio;
103
+ }
104
+ function T() {
105
+ m = null, s.value = null;
106
+ }
107
+ return p(() => {
108
+ S(n.target), cancelAnimationFrame(c);
109
+ }), (n, c) => (h(), i(e, null, [a.value ? (h(), i("div", {
110
+ key: 0,
111
+ class: d(["tabula-thumb is-vertical", { "is-dragging": s.value === "y" }]),
112
+ style: f([a.value, t.layer === void 0 ? {} : { zIndex: t.layer }]),
113
+ "aria-hidden": "true",
114
+ onPointerdown: c[0] ||= (e) => C(e, "y"),
115
+ onPointermove: w,
116
+ onPointerup: T,
117
+ onPointercancel: T,
118
+ onMousedown: c[1] ||= A(() => {}, ["prevent", "stop"])
119
+ }, null, 38)) : r("", !0), o.value ? (h(), i("div", {
120
+ key: 1,
121
+ class: d(["tabula-thumb is-horizontal", { "is-dragging": s.value === "x" }]),
122
+ style: f([o.value, t.layer === void 0 ? {} : { zIndex: t.layer }]),
123
+ "aria-hidden": "true",
124
+ onPointerdown: c[2] ||= (e) => C(e, "x"),
125
+ onPointermove: w,
126
+ onPointerup: T,
127
+ onPointercancel: T,
128
+ onMousedown: c[3] ||= A(() => {}, ["prevent", "stop"])
129
+ }, null, 38)) : r("", !0)], 64));
130
+ }
131
+ });
132
+ // src/alignment.ts
133
+ function Fe(e) {
134
+ switch (e.type) {
135
+ case "integer":
136
+ case "decimal":
137
+ case "money":
138
+ case "quantity":
139
+ case "percent": return "right";
140
+ case "bool":
141
+ case "date":
142
+ case "datetime": return "center";
143
+ default: return "left";
144
+ }
145
+ }
146
+ // src/messages.ts
147
+ var R = {
148
+ tr: {
149
+ required: () => "Bu alan zorunlu.",
150
+ not_a_number: (e) => `“${e.value}” sayı olarak okunamadı.`,
151
+ not_an_integer: (e) => `“${e.value}” tam sayı değil.`,
152
+ not_a_date: (e) => `“${e.value}” tarih olarak okunamadı. Örnek: ${Ye(e.format)}`,
153
+ not_a_boolean: (e) => `“${e.value}” Evet/Hayır değeri değil. Kabul edilenler: ${e.accepted}`,
154
+ not_an_option: (e) => `“${e.value}” listede yok. Seçenekler: ${e.options || "(seçenek yok)"}`,
155
+ not_matched: (e) => `“${e.value}” bir kayıtla eşleşmedi; listeden seçin.`,
156
+ min_value: (e, t) => `En az ${Je(e.min, t)} olmalı.`,
157
+ max_value: (e, t) => `En fazla ${Je(e.max, t)} olabilir.`,
158
+ min_length: (e) => `En az ${e.min} karakter olmalı; ${e.length} karakter.`,
159
+ max_length: (e) => `En fazla ${e.max} karakter olabilir; ${e.length} karakter.`,
160
+ not_unique: (e) => `Bu değer kolonda ${e.count} kez geçiyor; bir kez geçmeli.`,
161
+ formula_error: (e) => `Formül hesaplanamadı: ${e.error}${Ze(e.error, "tr")}`,
162
+ check_filled: (e) => `Bu alan zorunlu${V(e, "tr")}.`,
163
+ check_empty: (e) => `Bu alan boş bırakılmalı${V(e, "tr")}.`,
164
+ check_compare: (e) => `${z.tr[e.op ?? ""]?.(e.operand ?? "") ?? ""}${V(e, "tr")}.`
165
+ },
166
+ en: {
167
+ required: () => "This field is required.",
168
+ not_a_number: (e) => `“${e.value}” could not be read as a number.`,
169
+ not_an_integer: (e) => `“${e.value}” is not a whole number.`,
170
+ not_a_date: (e) => `“${e.value}” could not be read as a date. For example: ${Ye(e.format)}`,
171
+ not_a_boolean: (e) => `“${e.value}” is not a Yes/No value. Accepted: ${e.accepted}`,
172
+ not_an_option: (e) => `“${e.value}” is not in the list. Options: ${e.options || "(no options)"}`,
173
+ not_matched: (e) => `“${e.value}” is not matched to a record; pick one from the list.`,
174
+ min_value: (e, t) => `Must be at least ${Je(e.min, t)}.`,
175
+ max_value: (e, t) => `Must be at most ${Je(e.max, t)}.`,
176
+ min_length: (e) => `Must be at least ${e.min} characters; it is ${e.length}.`,
177
+ max_length: (e) => `Must be at most ${e.max} characters; it is ${e.length}.`,
178
+ not_unique: (e) => `This value appears ${e.count} times in the column; it may appear once.`,
179
+ formula_error: (e) => `The formula could not be worked out: ${e.error}${Ze(e.error, "en")}`,
180
+ check_filled: (e) => `This field is required${V(e, "en")}.`,
181
+ check_empty: (e) => `This field must be left empty${V(e, "en")}.`,
182
+ check_compare: (e) => `${z.en[e.op ?? ""]?.(e.operand ?? "") ?? ""}${V(e, "en")}.`
183
+ }
184
+ }, z = {
185
+ tr: {
186
+ "=": (e) => `${e} ile aynı olmalı`,
187
+ "!=": (e) => `${e} ile aynı olamaz`,
188
+ "<": (e) => `${e} değerinden küçük olmalı`,
189
+ "<=": (e) => `${e} değerinden büyük olamaz`,
190
+ ">": (e) => `${e} değerinden büyük olmalı`,
191
+ ">=": (e) => `${e} değerinden küçük olamaz`
192
+ },
193
+ en: {
194
+ "=": (e) => `Must equal ${e}`,
195
+ "!=": (e) => `Cannot equal ${e}`,
196
+ "<": (e) => `Must be less than ${e}`,
197
+ "<=": (e) => `Cannot be greater than ${e}`,
198
+ ">": (e) => `Must be greater than ${e}`,
199
+ ">=": (e) => `Cannot be less than ${e}`
200
+ }
201
+ }, B = {
202
+ "=": "=",
203
+ "!=": "≠",
204
+ "<": "<",
205
+ "<=": "≤",
206
+ ">": ">",
207
+ ">=": "≥"
208
+ };
209
+ function V(e, t) {
210
+ let n = Number(e.when ?? "0"), r = [];
211
+ for (let i = 0; i < n; i++) {
212
+ let n = e[`when${i}Field`] ?? "", a = e[`when${i}Op`] ?? "", o = e[`when${i}Value`] ?? "";
213
+ a === "filled" || a === "empty" ? r.push(`${n} ${t === "tr" ? a === "filled" ? "dolu" : "boş" : `is ${a}`}`) : r.push(`${n} ${B[a] ?? a} ${o}`);
214
+ }
215
+ return r.length === 0 ? "" : t === "tr" ? ` (${r.join(" ve ")} olduğunda)` : ` when ${r.join(" and ")}`;
216
+ }
217
+ var Ie = {
218
+ tr: {
219
+ title: "Sorunlar",
220
+ errors: "hata",
221
+ warnings: "uyarı",
222
+ stale: "yeniden kontrol",
223
+ rows: "satır",
224
+ none: "Sorun yok.",
225
+ previous: "Önceki",
226
+ next: "Sonraki",
227
+ row: "Satır",
228
+ sheet: "Sayfa",
229
+ recheck: "Değişti, yeniden kontrol edilmeli",
230
+ more: "sorun daha",
231
+ onlyIssueRows: "Yalnız sorunlu satırlar",
232
+ refresh: "Yenile",
233
+ refreshHint: "Süzgeci tablonun şimdiki hâline yeniden uygula",
234
+ local: "Tarayıcı",
235
+ server: "Sunucu",
236
+ goToCell: "Hücreye git",
237
+ open: "Sorunları göster",
238
+ close: "Kapat"
239
+ },
240
+ en: {
241
+ title: "Issues",
242
+ errors: "errors",
243
+ warnings: "warnings",
244
+ stale: "to check again",
245
+ rows: "rows",
246
+ none: "No issues.",
247
+ previous: "Previous",
248
+ next: "Next",
249
+ row: "Row",
250
+ sheet: "Sheet",
251
+ recheck: "Changed, to be checked again",
252
+ more: "more issues",
253
+ onlyIssueRows: "Only rows with issues",
254
+ refresh: "Refresh",
255
+ refreshHint: "Apply the filter again to the sheet as it is now",
256
+ local: "Browser",
257
+ server: "Server",
258
+ goToCell: "Go to cell",
259
+ open: "Show issues",
260
+ close: "Close"
261
+ }
262
+ }, Le = {
263
+ tr: {
264
+ title: "İşlenecekler",
265
+ create: "yeni kayıt",
266
+ update: "güncelleme",
267
+ unchanged: "değişmeyen",
268
+ unknown: "bilinmeyen",
269
+ warned: "uyarılı",
270
+ createOne: "Yeni kayıt",
271
+ updateOne: "Güncelleme",
272
+ unchangedOne: "Değişmeyen",
273
+ unknownOne: "Bilinmiyor",
274
+ all: "Tümü",
275
+ filterCreate: "Yeni",
276
+ filterUpdate: "Güncelleme",
277
+ filterUnchanged: "Değişmeyen",
278
+ filterUnknown: "Bilinmeyen",
279
+ filterWarned: "Uyarılı",
280
+ filters: "Satırları süz",
281
+ row: "Satır",
282
+ empty: "boş",
283
+ same: "Sunucudaki kayıtla aynı; bir şey değişmeyecek.",
284
+ noChanges: "Sunucu hangi alanların değişeceğini bildirmedi.",
285
+ unknownRow: "Ne olacağı bilinmiyor.",
286
+ noPlan: "Sunucu satırların ne olacağını bildirmedi; yalnız sayıları belli.",
287
+ stale: "Tablo son kontrolden sonra değişti; önizleme eski olabilir.",
288
+ sent: "satır gönderilecek",
289
+ more: "{n} satır daha göster",
290
+ none: "Bu süzgeçte satır yok."
291
+ },
292
+ en: {
293
+ title: "To be processed",
294
+ create: "new",
295
+ update: "updates",
296
+ unchanged: "unchanged",
297
+ unknown: "unknown",
298
+ warned: "with warnings",
299
+ createOne: "New record",
300
+ updateOne: "Update",
301
+ unchangedOne: "Unchanged",
302
+ unknownOne: "Unknown",
303
+ all: "All",
304
+ filterCreate: "New",
305
+ filterUpdate: "Updates",
306
+ filterUnchanged: "Unchanged",
307
+ filterUnknown: "Unknown",
308
+ filterWarned: "Warnings",
309
+ filters: "Filter the rows",
310
+ row: "Row",
311
+ empty: "empty",
312
+ same: "The same as the record on the server; nothing will change.",
313
+ noChanges: "The server did not say which fields will change.",
314
+ unknownRow: "What it will do is not known.",
315
+ noPlan: "The server did not say what the rows will do; only their number is known.",
316
+ stale: "The sheet changed after the last check; the preview may be out of date.",
317
+ sent: "rows to send",
318
+ more: "Show {n} more rows",
319
+ none: "No rows under this filter."
320
+ }
321
+ }, Re = {
322
+ tr: {
323
+ saved: "{date} tarihinde kaydedildi · {rows} satır · şema {from}. sürüm, şimdi {to}. sürüm",
324
+ fromHead: "Taslaktaki alan",
325
+ toHead: "Şimdiki alan",
326
+ drop: "Bırak, değerler silinir",
327
+ otherType: "tür farklı",
328
+ suggested: "Önerilen",
329
+ moves: "{n} değer taşınır",
330
+ losing: "{n} satırdaki değer silinecek",
331
+ noValues: "Değeri yok",
332
+ retyped: "Türü değişti: {from} → {to}",
333
+ unreadable: "{n} değer yeni türde okunamıyor; açılınca işaretlenir",
334
+ added: "Yeni alan",
335
+ addedNote: "boş açılır",
336
+ same: "{n} alan aynı",
337
+ mapped: "{n} alan eşlendi",
338
+ dropped: "{n} alan bırakılıyor",
339
+ string: "Metin",
340
+ integer: "Tam sayı",
341
+ decimal: "Ondalık",
342
+ money: "Para",
343
+ quantity: "Miktar",
344
+ percent: "Yüzde",
345
+ bool: "Evet/Hayır",
346
+ date: "Tarih",
347
+ datetime: "Tarih ve saat",
348
+ options: "Seçenek",
349
+ lookup: "Kayıt"
350
+ },
351
+ en: {
352
+ saved: "Saved {date} · {rows} rows · schema version {from}, now {to}",
353
+ fromHead: "Field in the draft",
354
+ toHead: "Field now",
355
+ drop: "Drop, values are deleted",
356
+ otherType: "other type",
357
+ suggested: "Suggested",
358
+ moves: "{n} values move",
359
+ losing: "Values in {n} rows will be deleted",
360
+ noValues: "No values",
361
+ retyped: "Type changed: {from} → {to}",
362
+ unreadable: "{n} values cannot be read as the new type; they open marked",
363
+ added: "New field",
364
+ addedNote: "opens empty",
365
+ same: "{n} fields unchanged",
366
+ mapped: "{n} fields mapped",
367
+ dropped: "{n} fields dropped",
368
+ string: "Text",
369
+ integer: "Whole number",
370
+ decimal: "Decimal",
371
+ money: "Money",
372
+ quantity: "Quantity",
373
+ percent: "Percent",
374
+ bool: "Yes/no",
375
+ date: "Date",
376
+ datetime: "Date and time",
377
+ options: "Option",
378
+ lookup: "Record"
379
+ }
380
+ }, ze = {
381
+ tr: {
382
+ sheets: "Sayfalar",
383
+ add: "Sayfa ekle",
384
+ menu: "Sayfa seçenekleri",
385
+ rename: "Yeniden adlandır",
386
+ duplicate: "Çoğalt",
387
+ remove: "Sayfayı sil",
388
+ name: "Sayfanın adı",
389
+ errors: "{n} hata",
390
+ done: "İşlendi",
391
+ doubleClick: "çift tık",
392
+ moveLeft: "Sola taşı",
393
+ moveRight: "Sağa taşı"
394
+ },
395
+ en: {
396
+ sheets: "Sheets",
397
+ add: "Add a sheet",
398
+ menu: "Sheet options",
399
+ rename: "Rename",
400
+ duplicate: "Duplicate",
401
+ remove: "Delete sheet",
402
+ name: "Sheet name",
403
+ errors: "{n} errors",
404
+ done: "Processed",
405
+ doubleClick: "double click",
406
+ moveLeft: "Move left",
407
+ moveRight: "Move right"
408
+ }
409
+ }, Be = {
410
+ tr: {
411
+ formulaBar: "Formül çubuğu",
412
+ address: "Hücre adresi",
413
+ addressHint: "Bir adres yazıp Enter'a basın, örneğin D9",
414
+ noAddress: "Böyle bir hücre yok",
415
+ value: "Hücrenin değeri",
416
+ formulaHint: "Formülle hesaplanan sütun: yazılmaz; okuduğu sütunlar tabloda aynı renkte",
417
+ statusBar: "Durum çubuğu",
418
+ rows: "satır",
419
+ issues: "sorun",
420
+ selected: "Seçili",
421
+ sum: "Toplam",
422
+ average: "Ortalama"
423
+ },
424
+ en: {
425
+ formulaBar: "Formula bar",
426
+ address: "Cell address",
427
+ addressHint: "Type an address and press Enter, such as D9",
428
+ noAddress: "There is no such cell",
429
+ value: "The cell's value",
430
+ formulaHint: "A column worked out by its formula: not typed into; the columns it reads are in the same colours",
431
+ statusBar: "Status bar",
432
+ rows: "rows",
433
+ issues: "issues",
434
+ selected: "Selected",
435
+ sum: "Sum",
436
+ average: "Average"
437
+ }
438
+ }, Ve = {
439
+ tr: {
440
+ title: "Bul ve değiştir",
441
+ find: "Bul",
442
+ replace: "Değiştir",
443
+ where: "Nerede",
444
+ selection: "Seçimde",
445
+ column: "Sütunda",
446
+ sheet: "Tabloda",
447
+ matchCase: "Büyük ve küçük harf ayrı",
448
+ whole: "Hücrenin tamamı eşleşsin",
449
+ wholeShort: "Tam hücre",
450
+ count: "{current} / {total} hücre",
451
+ none: "Bulunamadı",
452
+ previous: "Önceki",
453
+ next: "Sonraki",
454
+ replaceOne: "Değiştir",
455
+ replaceAll: "Tümünü değiştir",
456
+ close: "Kapat",
457
+ replaced: "{n} hücre değişti",
458
+ skipped: "{n} hücre değiştirilemedi"
459
+ },
460
+ en: {
461
+ title: "Find and replace",
462
+ find: "Find",
463
+ replace: "Replace",
464
+ where: "Where",
465
+ selection: "In the selection",
466
+ column: "In the column",
467
+ sheet: "In the sheet",
468
+ matchCase: "Match case",
469
+ whole: "Match the whole cell",
470
+ wholeShort: "Whole cell",
471
+ count: "{current} of {total} cells",
472
+ none: "Not found",
473
+ previous: "Previous",
474
+ next: "Next",
475
+ replaceOne: "Replace",
476
+ replaceAll: "Replace all",
477
+ close: "Close",
478
+ replaced: "{n} cells replaced",
479
+ skipped: "{n} cells could not be changed"
480
+ }
481
+ }, H = {
482
+ tr: {
483
+ succeeded: "İşlendi",
484
+ failed: "İşlenemedi",
485
+ skipped: "İşlenmedi",
486
+ sending: "Gönderiliyor",
487
+ recheck: "Değişti, yeniden kontrol edilmeli",
488
+ searching: "Aranıyor…",
489
+ none: "Eşleşen kayıt yok",
490
+ more: "Daha fazlası var; aramayı daraltın",
491
+ unavailable: "Arama yapılamadı",
492
+ columnMenu: "Kolon seçenekleri",
493
+ pin: "Sabitle",
494
+ unpin: "Sabitlemeyi kaldır",
495
+ hide: "Gizle",
496
+ showHidden: "Gizli kolonları göster",
497
+ sortAsc: "Artan sırala",
498
+ sortDesc: "Azalan sırala",
499
+ sortClear: "Sıralamayı kaldır",
500
+ filter: "Filtrele…",
501
+ filterClear: "Filtreyi kaldır",
502
+ filterTitle: "Filtre",
503
+ filtered: "Filtre uygulanmış",
504
+ search: "Değerlerde ara",
505
+ selectAll: "Tümünü seç",
506
+ empty: "(Boş)",
507
+ from: "En az",
508
+ to: "En çok",
509
+ apply: "Uygula",
510
+ clear: "Temizle",
511
+ cancel: "Vazgeç",
512
+ moreValues: "değer listede yok; arayarak bulun",
513
+ badBound: "Bu değer okunamadı; sütunun yazdığı gibi yazın.",
514
+ fillHandle: "Doldurmak için sürükleyin; çift tıklayınca yandaki sütun bitene dek aşağı doldurur.",
515
+ picked: "seçili · aramak için yazın",
516
+ pickHint: "Boşluk ya da tık seçer; Enter yazar, Esc vazgeçer.",
517
+ cellMenu: "Hücre menüsü",
518
+ cut: "Kes",
519
+ copy: "Kopyala",
520
+ paste: "Yapıştır",
521
+ clearCells: "İçeriği temizle",
522
+ fillDown: "Aşağı doldur",
523
+ fillRight: "Sağa doldur",
524
+ insertAbove: "Üste satır ekle",
525
+ insertBelow: "Alta satır ekle",
526
+ removeRows: "Satırları sil",
527
+ filterValue: "Bu değere göre süz",
528
+ pasteRefused: "Tarayıcı panoyu okumaya izin vermedi; Ctrl+V ile yapıştırın.",
529
+ totals: "Alttaki satırda ne gösterilsin",
530
+ totalSum: "Toplam",
531
+ totalAverage: "Ortalama",
532
+ totalMin: "En az",
533
+ totalMax: "En çok"
534
+ },
535
+ en: {
536
+ cellMenu: "Cell menu",
537
+ cut: "Cut",
538
+ copy: "Copy",
539
+ paste: "Paste",
540
+ clearCells: "Clear contents",
541
+ fillDown: "Fill down",
542
+ fillRight: "Fill right",
543
+ insertAbove: "Insert row above",
544
+ insertBelow: "Insert row below",
545
+ removeRows: "Delete rows",
546
+ filterValue: "Filter by this value",
547
+ pasteRefused: "The browser did not let the clipboard be read; paste with Ctrl+V.",
548
+ totals: "What the row at the bottom shows",
549
+ totalSum: "Sum",
550
+ totalAverage: "Average",
551
+ totalMin: "Smallest",
552
+ totalMax: "Largest",
553
+ succeeded: "Processed",
554
+ failed: "Failed",
555
+ skipped: "Not processed",
556
+ sending: "Being sent",
557
+ recheck: "Changed, to be checked again",
558
+ searching: "Searching…",
559
+ none: "No matching records",
560
+ more: "There are more; narrow the search",
561
+ unavailable: "The search could not be made",
562
+ columnMenu: "Column options",
563
+ pin: "Pin",
564
+ unpin: "Unpin",
565
+ hide: "Hide",
566
+ showHidden: "Show hidden columns",
567
+ sortAsc: "Sort ascending",
568
+ sortDesc: "Sort descending",
569
+ sortClear: "Remove sort",
570
+ filter: "Filter…",
571
+ filterClear: "Clear filter",
572
+ filterTitle: "Filter",
573
+ filtered: "Filtered",
574
+ search: "Search the values",
575
+ selectAll: "Select all",
576
+ empty: "(Empty)",
577
+ from: "From",
578
+ to: "To",
579
+ apply: "Apply",
580
+ clear: "Clear",
581
+ cancel: "Cancel",
582
+ moreValues: "more values not listed; search to find them",
583
+ badBound: "This value cannot be read; write it as the column does.",
584
+ fillHandle: "Drag to fill; double-click to fill down as far as the column beside goes.",
585
+ picked: "picked · type to search",
586
+ pickHint: "Space or a click ticks; Enter writes, Esc cancels."
587
+ }
588
+ };
589
+ function He(e, t, n) {
590
+ if (e.source !== "local") return e.message;
591
+ let r = e.params[`message.${t}`];
592
+ if (r) return r;
593
+ let i = R[t][e.code];
594
+ return i ? i(e.params, n) : e.message;
595
+ }
596
+ function Ue(e, t, n, r) {
597
+ let i = (e) => t.has(e) ? t.field(e).label : e, a = (e) => e.other === null ? e.value === null || !t.has(e.field) ? "" : F(t.field(e.field), e.value, r) : i(e.other), o = { when: String(e.when.length) };
598
+ e.when.forEach((e, t) => {
599
+ o[`when${t}Field`] = i(e.field), o[`when${t}Op`] = e.op, o[`when${t}Value`] = a(e);
600
+ });
601
+ let s = i(e.assert.field), c = e.assert.op, l;
602
+ if (c === "filled" || c === "empty") l = n === "tr" ? `${s} ${c === "filled" ? "dolu" : "boş"} olmalı` : `${s} must be ${c === "filled" ? "filled" : "empty"}`;
603
+ else {
604
+ let t = z[n][c]?.(a(e.assert)) ?? "";
605
+ l = n === "tr" ? `${s}, ${t}` : `${s}: ${t.charAt(0).toLowerCase()}${t.slice(1)}`;
606
+ }
607
+ return `${l}${V(o, n)}`;
608
+ }
609
+ var We = [
610
+ "sayı1",
611
+ "sayı2",
612
+ "…"
613
+ ], Ge = [
614
+ "number1",
615
+ "number2",
616
+ "…"
617
+ ], Ke = {
618
+ tr: {
619
+ ABS: {
620
+ params: ["sayı"],
621
+ short: "işaretsiz değer",
622
+ text: "Sayının işaretsiz değeri: -5 için 5."
623
+ },
624
+ AND: {
625
+ params: [
626
+ "koşul1",
627
+ "koşul2",
628
+ "…"
629
+ ],
630
+ short: "hepsi doğruysa",
631
+ text: "Koşulların hepsi doğruysa DOĞRU, biri yanlışsa YANLIŞ."
632
+ },
633
+ AVERAGE: {
634
+ params: We,
635
+ short: "ortalama",
636
+ text: "Sayıların ortalaması; boş alanlar sayılmaz."
637
+ },
638
+ CONCAT: {
639
+ params: [
640
+ "metin1",
641
+ "metin2",
642
+ "…"
643
+ ],
644
+ short: "metinleri birleştirir",
645
+ text: "Metinleri art arda ekler."
646
+ },
647
+ IF: {
648
+ params: [
649
+ "koşul",
650
+ "doğruysa",
651
+ "yanlışsa"
652
+ ],
653
+ short: "koşula göre değer",
654
+ text: "Koşul doğruysa ikinci değeri, değilse üçüncüyü verir; yalnız gereken hesaplanır."
655
+ },
656
+ IFERROR: {
657
+ params: ["değer", "hatada"],
658
+ short: "hata yerine değer",
659
+ text: "Değer bir hataysa (#DIV/0! gibi) yerine ikinci değeri verir."
660
+ },
661
+ ISBLANK: {
662
+ params: ["değer"],
663
+ short: "boş mu",
664
+ text: "Değer boşsa DOĞRU."
665
+ },
666
+ LEN: {
667
+ params: ["metin"],
668
+ short: "karakter sayısı",
669
+ text: "Metindeki karakter sayısı."
670
+ },
671
+ MAX: {
672
+ params: We,
673
+ short: "en büyük değer",
674
+ text: "En büyük sayı; boş alanlar sayılmaz."
675
+ },
676
+ MIN: {
677
+ params: We,
678
+ short: "en küçük değer",
679
+ text: "En küçük sayı; boş alanlar sayılmaz."
680
+ },
681
+ NOT: {
682
+ params: ["koşul"],
683
+ short: "tersi",
684
+ text: "Koşul doğruysa YANLIŞ, yanlışsa DOĞRU."
685
+ },
686
+ OR: {
687
+ params: [
688
+ "koşul1",
689
+ "koşul2",
690
+ "…"
691
+ ],
692
+ short: "biri doğruysa",
693
+ text: "Koşullardan biri doğruysa DOĞRU, hepsi yanlışsa YANLIŞ."
694
+ },
695
+ ROUND: {
696
+ params: ["sayı", "basamak"],
697
+ short: "yuvarlar",
698
+ text: "Sayıyı verilen ondalık basamağa yuvarlar: yarım ve üstü yukarı."
699
+ },
700
+ ROUNDDOWN: {
701
+ params: ["sayı", "basamak"],
702
+ short: "aşağı yuvarlar",
703
+ text: "Sayıyı verilen basamakta sıfıra doğru keser."
704
+ },
705
+ ROUNDUP: {
706
+ params: ["sayı", "basamak"],
707
+ short: "yukarı yuvarlar",
708
+ text: "Sayıyı verilen basamakta sıfırdan uzağa yuvarlar."
709
+ },
710
+ SUM: {
711
+ params: We,
712
+ short: "toplam",
713
+ text: "Sayıların toplamı; boş alanlar sayılmaz."
714
+ }
715
+ },
716
+ en: {
717
+ ABS: {
718
+ params: ["number"],
719
+ short: "without its sign",
720
+ text: "The number without its sign: 5 for -5."
721
+ },
722
+ AND: {
723
+ params: [
724
+ "condition1",
725
+ "condition2",
726
+ "…"
727
+ ],
728
+ short: "true if all are",
729
+ text: "TRUE when every condition holds, FALSE when one does not."
730
+ },
731
+ AVERAGE: {
732
+ params: Ge,
733
+ short: "average",
734
+ text: "The average of the numbers; empty fields are not counted."
735
+ },
736
+ CONCAT: {
737
+ params: [
738
+ "text1",
739
+ "text2",
740
+ "…"
741
+ ],
742
+ short: "joins texts",
743
+ text: "The texts one after another."
744
+ },
745
+ IF: {
746
+ params: [
747
+ "condition",
748
+ "if true",
749
+ "if false"
750
+ ],
751
+ short: "a value by a condition",
752
+ text: "The second value when the condition holds, the third when not; only the one needed is worked out."
753
+ },
754
+ IFERROR: {
755
+ params: ["value", "on error"],
756
+ short: "a value for an error",
757
+ text: "The second value in place of the first when it is an error, such as #DIV/0!."
758
+ },
759
+ ISBLANK: {
760
+ params: ["value"],
761
+ short: "is it empty",
762
+ text: "TRUE when the value is empty."
763
+ },
764
+ LEN: {
765
+ params: ["text"],
766
+ short: "number of characters",
767
+ text: "How many characters the text has."
768
+ },
769
+ MAX: {
770
+ params: Ge,
771
+ short: "the largest",
772
+ text: "The largest number; empty fields are not counted."
773
+ },
774
+ MIN: {
775
+ params: Ge,
776
+ short: "the smallest",
777
+ text: "The smallest number; empty fields are not counted."
778
+ },
779
+ NOT: {
780
+ params: ["condition"],
781
+ short: "the opposite",
782
+ text: "FALSE when the condition holds, TRUE when not."
783
+ },
784
+ OR: {
785
+ params: [
786
+ "condition1",
787
+ "condition2",
788
+ "…"
789
+ ],
790
+ short: "true if one is",
791
+ text: "TRUE when a condition holds, FALSE when none does."
792
+ },
793
+ ROUND: {
794
+ params: ["number", "places"],
795
+ short: "rounds",
796
+ text: "The number rounded to the decimal places given: a half and above goes up."
797
+ },
798
+ ROUNDDOWN: {
799
+ params: ["number", "places"],
800
+ short: "rounds down",
801
+ text: "The number cut towards zero at the places given."
802
+ },
803
+ ROUNDUP: {
804
+ params: ["number", "places"],
805
+ short: "rounds up",
806
+ text: "The number rounded away from zero at the places given."
807
+ },
808
+ SUM: {
809
+ params: Ge,
810
+ short: "sum",
811
+ text: "The sum of the numbers; empty fields are not counted."
812
+ }
813
+ }
814
+ };
815
+ function qe(e, t) {
816
+ return Ke[t][e.toUpperCase()] ?? null;
817
+ }
818
+ function Je(e, t) {
819
+ return (e ?? "").replace(".", t.decimalSeparator);
820
+ }
821
+ function Ye(e) {
822
+ let t = {
823
+ d: "31",
824
+ j: "31",
825
+ m: "12",
826
+ n: "12",
827
+ Y: "2026",
828
+ y: "26",
829
+ H: "13",
830
+ G: "13",
831
+ i: "45",
832
+ s: "00"
833
+ }, n = "", r = e ?? "";
834
+ for (let e = 0; e < r.length; e++) {
835
+ let i = r.charAt(e);
836
+ i === "\\" ? (e++, n += r.charAt(e)) : i !== "!" && i !== "|" && (n += t[i] ?? i);
837
+ }
838
+ return n;
839
+ }
840
+ var Xe = {
841
+ tr: {
842
+ "#DIV/0!": "sıfıra bölme",
843
+ "#VALUE!": "bir değer beklenen türde değil",
844
+ "#NAME?": "bilinmeyen fonksiyon",
845
+ "#NUM!": "sayı olarak hesaplanamıyor"
846
+ },
847
+ en: {
848
+ "#DIV/0!": "a division by zero",
849
+ "#VALUE!": "a value is not of the kind expected",
850
+ "#NAME?": "an unknown function",
851
+ "#NUM!": "not a number that can be worked out"
852
+ }
853
+ };
854
+ function Ze(e, t) {
855
+ let n = Xe[t][e ?? ""];
856
+ return n ? ` (${n})` : "";
857
+ }
858
+ // src/measure.ts
859
+ function Qe(e) {
860
+ let t = getComputedStyle(e), n = document.createElement("canvas").getContext("2d");
861
+ if (!n) {
862
+ let e = Number.parseFloat(t.fontSize) || 13;
863
+ return (t) => t.length * e * .6;
864
+ }
865
+ return n.font = `${t.fontStyle} ${t.fontWeight} ${t.fontSize} ${t.fontFamily}`, (e) => n.measureText(e).width;
866
+ }
867
+ function $e(e) {
868
+ let t = getComputedStyle(e);
869
+ return (Number.parseFloat(t.paddingLeft) || 0) + (Number.parseFloat(t.paddingRight) || 0);
870
+ }
871
+ // src/TabulaGrid.vue?vue&type=script&setup=true&lang.ts
872
+ var et = [
873
+ "tabindex",
874
+ "data-tabula-theme",
875
+ "aria-rowcount",
876
+ "aria-colcount",
877
+ "aria-readonly",
878
+ "aria-activedescendant"
879
+ ], tt = [
880
+ "aria-colindex",
881
+ "aria-sort",
882
+ "title",
883
+ "onMousedown"
884
+ ], nt = ["textContent"], rt = {
885
+ key: 1,
886
+ class: "tabula-grid-fx",
887
+ "aria-hidden": "true"
888
+ }, it = { class: "tabula-grid-th-text" }, at = {
889
+ key: 2,
890
+ class: "tabula-grid-required",
891
+ "aria-hidden": "true"
892
+ }, ot = {
893
+ key: 3,
894
+ class: "tabula-grid-sort",
895
+ "aria-hidden": "true"
896
+ }, st = ["aria-label"], ct = ["aria-label", "onMousedown"], lt = ["onMousedown", "onDblclick"], ut = [
897
+ "aria-colindex",
898
+ "aria-sort",
899
+ "title",
900
+ "onMousedown"
901
+ ], dt = ["textContent"], ft = {
902
+ key: 1,
903
+ class: "tabula-grid-fx",
904
+ "aria-hidden": "true"
905
+ }, pt = { class: "tabula-grid-th-text" }, mt = {
906
+ key: 2,
907
+ class: "tabula-grid-required",
908
+ "aria-hidden": "true"
909
+ }, ht = {
910
+ key: 3,
911
+ class: "tabula-grid-sort",
912
+ "aria-hidden": "true"
913
+ }, gt = ["aria-label"], _t = ["aria-label", "onMousedown"], vt = ["onMousedown", "onDblclick"], yt = ["title", "onMousedown"], bt = ["data-version"], xt = ["data-row"], St = [
914
+ "id",
915
+ "aria-colindex",
916
+ "aria-selected",
917
+ "aria-readonly",
918
+ "aria-invalid",
919
+ "title"
920
+ ], Ct = ["title"], wt = [
921
+ "aria-rowindex",
922
+ "data-row",
923
+ "aria-owns"
924
+ ], Tt = [
925
+ "id",
926
+ "aria-colindex",
927
+ "aria-selected",
928
+ "aria-readonly",
929
+ "aria-invalid",
930
+ "title"
931
+ ], Et = ["title"], Dt = [
932
+ "aria-label",
933
+ "role",
934
+ "aria-autocomplete",
935
+ "aria-expanded",
936
+ "aria-controls",
937
+ "aria-activedescendant",
938
+ "placeholder"
939
+ ], Ot = { class: "tabula-grid-sr" }, kt = { value: "sum" }, At = { value: "average" }, jt = { value: "min" }, Mt = { value: "max" }, Nt = ["aria-multiselectable"], Pt = [
940
+ "id",
941
+ "aria-selected",
942
+ "aria-disabled",
943
+ "onMousedown",
944
+ "onMousemove"
945
+ ], Ft = {
946
+ key: 0,
947
+ class: "tabula-grid-option-check",
948
+ "aria-hidden": "true"
949
+ }, It = { class: "tabula-grid-option-label" }, Lt = {
950
+ key: 1,
951
+ class: "tabula-grid-option-description"
952
+ }, Rt = {
953
+ key: 0,
954
+ class: "tabula-grid-list-note",
955
+ role: "presentation"
956
+ }, zt = {
957
+ key: 1,
958
+ class: "tabula-grid-list-note",
959
+ role: "presentation"
960
+ }, Bt = ["aria-label"], Vt = ["disabled"], Ht = ["aria-label"], Ut = ["textContent"], Wt = ["textContent"], Gt = {
961
+ key: 0,
962
+ class: "tabula-grid-menu-line",
963
+ role: "separator"
964
+ }, Kt = {
965
+ key: 1,
966
+ class: "tabula-grid-menu-item"
967
+ }, qt = [
968
+ "aria-expanded",
969
+ "data-key",
970
+ "disabled",
971
+ "onClick",
972
+ "onMouseenter"
973
+ ], Jt = ["textContent"], Yt = ["aria-label"], Xt = ["disabled", "onClick"], Zt = ["textContent"], Qt = ["textContent"], $t = [
974
+ "data-key",
975
+ "disabled",
976
+ "onClick"
977
+ ], en = ["textContent"], tn = ["textContent"], nn = ["aria-label"], rn = { class: "tabula-grid-filter-title" }, an = {
978
+ key: 0,
979
+ class: "tabula-grid-filter-range"
980
+ }, on = {
981
+ key: 1,
982
+ class: "tabula-grid-filter-problem",
983
+ role: "alert"
984
+ }, sn = ["placeholder", "aria-label"], cn = { class: "tabula-grid-filter-all" }, ln = ["checked", "indeterminate"], un = ["checked", "onChange"], dn = { class: "tabula-grid-filter-value" }, fn = { class: "tabula-grid-filter-count" }, pn = {
985
+ key: 2,
986
+ class: "tabula-grid-filter-more"
987
+ }, mn = { class: "tabula-grid-filter-buttons" }, hn = 32, gn = 20, _n = 6, vn = 2, yn = 6, bn = 5e3, xn = 10, Sn = 22, Cn = 8, wn = 150, Tn = "columns", En = 6, Dn = /* @__PURE__ */ c({
988
+ __name: "TabulaGrid",
989
+ props: /*@__PURE__*/ l({
990
+ schema: {
991
+ type: Object,
992
+ required: !0
993
+ },
994
+ store: {
995
+ type: Object,
996
+ required: !0
997
+ },
998
+ columnSizing: {
999
+ type: Object,
1000
+ default: void 0
1001
+ },
1002
+ columnOverrides: {
1003
+ type: Object,
1004
+ default: void 0
1005
+ },
1006
+ readonly: {
1007
+ type: Boolean,
1008
+ default: !1
1009
+ },
1010
+ theme: {
1011
+ type: String,
1012
+ default: "light"
1013
+ },
1014
+ valueSettings: {
1015
+ type: Object,
1016
+ default: () => P.tr
1017
+ },
1018
+ rowHeight: {
1019
+ type: Number,
1020
+ default: 30
1021
+ },
1022
+ issues: {
1023
+ type: Object,
1024
+ default: void 0
1025
+ },
1026
+ results: {
1027
+ type: Object,
1028
+ default: void 0
1029
+ },
1030
+ view: {
1031
+ type: Object,
1032
+ default: void 0
1033
+ },
1034
+ lookups: {
1035
+ type: Object,
1036
+ default: void 0
1037
+ },
1038
+ history: {
1039
+ type: Object,
1040
+ default: void 0
1041
+ },
1042
+ changes: {
1043
+ type: Object,
1044
+ default: void 0
1045
+ },
1046
+ columnLetters: {
1047
+ type: Boolean,
1048
+ default: !1
1049
+ },
1050
+ menuItems: {
1051
+ type: Array,
1052
+ default: () => []
1053
+ },
1054
+ locale: {
1055
+ type: String,
1056
+ default: "tr"
1057
+ },
1058
+ marks: {
1059
+ type: Object,
1060
+ default: void 0
1061
+ },
1062
+ found: {
1063
+ type: Object,
1064
+ default: void 0
1065
+ },
1066
+ fit: {
1067
+ type: Boolean,
1068
+ default: !1
1069
+ },
1070
+ totals: {
1071
+ type: Boolean,
1072
+ default: !1
1073
+ },
1074
+ zoom: {
1075
+ type: Number,
1076
+ default: 1
1077
+ }
1078
+ }, {
1079
+ columnWidths: { default: () => ({}) },
1080
+ columnWidthsModifiers: {},
1081
+ columns: { default: () => ({}) },
1082
+ columnsModifiers: {},
1083
+ filters: { default: () => ({}) },
1084
+ filtersModifiers: {},
1085
+ sort: { default: null },
1086
+ sortModifiers: {}
1087
+ }),
1088
+ emits: /*@__PURE__*/ l(["menu", "find"], [
1089
+ "update:columnWidths",
1090
+ "update:columns",
1091
+ "update:filters",
1092
+ "update:sort"
1093
+ ]),
1094
+ setup(c, { expose: l, emit: v }) {
1095
+ let T = c, k = v, P = w(c, "columnWidths"), pe = w(c, "columns"), _e = w(c, "filters"), be = w(c, "sort"), Te = {
1096
+ ArrowUp: "up",
1097
+ ArrowDown: "down",
1098
+ ArrowLeft: "left",
1099
+ ArrowRight: "right"
1100
+ }, Oe = {
1101
+ up: {
1102
+ row: -1,
1103
+ col: 0
1104
+ },
1105
+ down: {
1106
+ row: 1,
1107
+ col: 0
1108
+ },
1109
+ left: {
1110
+ row: 0,
1111
+ col: -1
1112
+ },
1113
+ right: {
1114
+ row: 0,
1115
+ col: 1
1116
+ }
1117
+ }, I = y(x(T.store)), L = y(x(T.schema)), Ne = t(() => oe(L.value.fields, pe.value)), R = t(() => Ne.value.fields), z = t(() => Ne.value.pinned), B = new N(0, 0), V = y(0), Ie = y(0), Le = y(0), Re = C(), ze = g(null), Be = g(null), Ve = g(null), Ue = g(null), We = g(null), Ge = g(null), Ke = g(null), qe = g(null), Je = g(null), Ye = t(() => R.value.map((e) => xe(T.columnSizing, T.columnOverrides?.[e.key]))), Xe = y([]), Ze = y(null), Dn = y(0), U = t(() => Math.max(16, Math.round(T.rowHeight * T.zoom))), On = t(() => {
1118
+ let e = R.value.map((e, t) => {
1119
+ let n = Ye.value[t] ?? xe();
1120
+ if (Ze.value?.key === e.key) return Ze.value.width;
1121
+ let r = P.value[e.key];
1122
+ return r === void 0 ? Math.max(Xe.value[t] ?? n.minWidth, Math.round(n.minWidth * T.zoom)) : Math.round(ce(r, n) * T.zoom);
1123
+ });
1124
+ return T.fit ? kn(e) : e;
1125
+ });
1126
+ function kn(e) {
1127
+ let t = Dn.value - e.reduce((e, t) => e + t, 0) - xn, n = R.value.flatMap((e, t) => P.value[e.key] === void 0 && Ze.value?.key !== e.key ? [t] : []), r = n.reduce((t, n) => t + (e[n] ?? 0), 0);
1128
+ if (t <= 0 || r <= 0) return e;
1129
+ let i = [...e], a = t;
1130
+ return n.forEach((o, s) => {
1131
+ let c = s === n.length - 1 ? a : Math.floor(t * (e[o] ?? 0) / r);
1132
+ i[o] = (i[o] ?? 0) + c, a -= c;
1133
+ }), i;
1134
+ }
1135
+ let W = t(() => {
1136
+ let e = [0];
1137
+ for (let t of On.value) e.push((e[e.length - 1] ?? 0) + t);
1138
+ return e;
1139
+ }), An = t(() => W.value[W.value.length - 1] ?? 0), jn = t(() => W.value[z.value] ?? 0), Mn = t(() => Le.value * U.value), G = t(() => Math.max(44, String(Math.max(Le.value, 1)).length * 8 + 20)), Nn = t(() => On.value.map((e, t) => `left:${W.value[t] ?? 0}px;width:${e}px`)), Pn = t(() => hn + (T.columnLetters ? gn : 0)), Fn = t(() => pe.value.formats ?? {}), In = t(() => R.value.map((e) => {
1140
+ let t = Fn.value[e.key]?.align ?? Fe(e), n = t === "left" ? "" : `is-${t}`;
1141
+ return Ln(e) ? n : `${n} is-readonly`;
1142
+ }));
1143
+ function Ln(e) {
1144
+ return e !== void 0 && e.editable && !T.readonly;
1145
+ }
1146
+ function Rn(e) {
1147
+ let t = R.value[e];
1148
+ return t?.formula ? `${t.label}\n= ${t.formula}` : t?.label;
1149
+ }
1150
+ function zn(e) {
1151
+ let t = R.value[e], n = Ye.value[e];
1152
+ return t && n ? ge(t.label, n.headerDisplayMaxLength) : "";
1153
+ }
1154
+ function Bn(e) {
1155
+ return `left:${(e < z.value ? 0 : G.value) + (W.value[e] ?? 0)}px;width:${On.value[e] ?? 0}px`;
1156
+ }
1157
+ function Vn(e) {
1158
+ let t = W.value, n = 0, r = Math.max(0, R.value.length - 1);
1159
+ for (; n < r;) {
1160
+ let i = n + r + 1 >> 1;
1161
+ (t[i] ?? 0) <= e ? n = i : r = i - 1;
1162
+ }
1163
+ return n;
1164
+ }
1165
+ function Hn() {
1166
+ let e = Ge.value;
1167
+ if (!e) return;
1168
+ let t = Qe(e), n = $e(e), r = t(" *");
1169
+ Xe.value = R.value.map((e, i) => {
1170
+ let a = Ye.value[i] ?? xe(), o = t(zn(i)) + n + (e.required ? r : 0) + yn;
1171
+ return se(o, a);
1172
+ });
1173
+ }
1174
+ function Un(e) {
1175
+ let t = R.value[e], n = Ye.value[e];
1176
+ if (!t || !n || !Ge.value || !Je.value) return;
1177
+ let r = Qe(Ge.value), i = Qe(Je.value), a = $e(Je.value), o = r(zn(e)) + $e(Ge.value) + (t.required ? r(" *") : 0) + yn, s = Q.value, c = Math.max(1, Math.ceil(s.size / bn));
1178
+ for (let e = 0; e < s.size; e += c) {
1179
+ let n = s.rowIdAt(e), r = n === void 0 ? "" : F(t, I.value.get(n, t.key), T.valueSettings);
1180
+ r !== "" && (o = Math.max(o, i(r) + a));
1181
+ }
1182
+ Wn(t.key, se(o, n));
1183
+ }
1184
+ function Wn(e, t) {
1185
+ let n = Math.round(t / T.zoom);
1186
+ P.value[e] !== n && (P.value = Object.freeze({
1187
+ ...P.value,
1188
+ [e]: n
1189
+ }));
1190
+ }
1191
+ let Gn = y(0), Kn = y(-1), qn = y(0), Jn = y(-1), Yn = y(1), Xn = y(1), Zn = t(() => tr(Gn.value, Kn.value)), Qn = t(() => tr(qn.value, Jn.value)), $n = t(() => tr(0, z.value - 1)), er = y(0);
1192
+ function tr(e, t) {
1193
+ let n = [];
1194
+ for (let r = e; r <= t; r++) n.push(r);
1195
+ return n;
1196
+ }
1197
+ function nr() {
1198
+ let e = Be.value;
1199
+ return {
1200
+ width: Math.max(0, (e?.clientWidth ?? 0) - G.value),
1201
+ height: Math.max(0, (e?.clientHeight ?? 0) - Pn.value)
1202
+ };
1203
+ }
1204
+ function rr() {
1205
+ let e = Be.value;
1206
+ if (!e) return;
1207
+ let { width: t, height: n } = nr();
1208
+ Dn.value = t;
1209
+ let r = Le.value, i = R.value.length, a = e.scrollTop, o = e.scrollLeft, s = Math.max(1, Math.min(...On.value, Infinity));
1210
+ Yn.value = Math.ceil(n / U.value) + 12 + 2, Xn.value = Math.max(1, Math.min(i, Math.ceil(t / s) + 4 + 2)), Gn.value = Math.max(0, Math.floor(a / U.value) - _n), Kn.value = Math.min(r - 1, Math.floor((a + n) / U.value) + _n);
1211
+ let c = z.value;
1212
+ er.value = o, qn.value = i <= c ? c : Math.max(c, Vn(o + jn.value) - vn), Jn.value = i <= c ? c - 1 : Math.min(i - 1, Vn(o + t) + vn), _i.value && Oi();
1213
+ }
1214
+ function ir(e = B.head) {
1215
+ let t = Be.value;
1216
+ if (!t || !e) return;
1217
+ let { width: n, height: r } = nr(), i = e.row * U.value, a = W.value[e.col] ?? 0, o = W.value[e.col + 1] ?? a;
1218
+ i < t.scrollTop ? t.scrollTop = i : i + U.value > t.scrollTop + r && (t.scrollTop = i + U.value - r), e.col < z.value || (a < t.scrollLeft + jn.value ? t.scrollLeft = a - jn.value : o > t.scrollLeft + n && (t.scrollLeft = Math.min(a - jn.value, o - n)));
1219
+ }
1220
+ function ar(e, t) {
1221
+ V.value;
1222
+ let n = Q.value.rowIdAt(e), r = R.value[t];
1223
+ if (n === void 0 || r === void 0) return "";
1224
+ let i = I.value.get(n, r.key), a = F(r, i, T.valueSettings, { decimals: Fn.value[r.key]?.decimals });
1225
+ return or(r) && sr(i) > 0 ? `+${a}` : a;
1226
+ }
1227
+ function or(e) {
1228
+ return "tone" in e && e.tone === "sign";
1229
+ }
1230
+ function sr(e) {
1231
+ return typeof e == "number" ? Math.sign(e) : typeof e != "string" || !/^-?\d+(\.\d+)?$/.test(e) || /^-?0+(\.0+)?$/.test(e) ? 0 : e.startsWith("-") ? -1 : 1;
1232
+ }
1233
+ function cr(e, t) {
1234
+ let n = R.value[t];
1235
+ if (n === void 0 || !or(n)) return;
1236
+ V.value;
1237
+ let r = Q.value.rowIdAt(e), i = r === void 0 ? 0 : sr(I.value.get(r, n.key));
1238
+ return i > 0 ? "is-positive" : i < 0 ? "is-negative" : void 0;
1239
+ }
1240
+ let lr = y(0);
1241
+ O(() => x(T.marks), (e, t, n) => {
1242
+ lr.value++, e && n(e.subscribe(() => lr.value++));
1243
+ }, { immediate: !0 });
1244
+ let ur = /* @__PURE__ */ new Map(), dr = -1;
1245
+ O([L, () => T.valueSettings], () => ur.clear());
1246
+ function fr(e) {
1247
+ let t = L.value.styles;
1248
+ if (t.length === 0) return null;
1249
+ dr !== V.value && (ur.clear(), dr = V.value);
1250
+ let n = ur.get(e);
1251
+ if (!n) {
1252
+ let r = L.value;
1253
+ n = Ce(t, (e) => r.field(e), (t) => I.value.get(e, t), T.valueSettings), ur.set(e, n);
1254
+ }
1255
+ return n;
1256
+ }
1257
+ function pr(e, t) {
1258
+ V.value, lr.value;
1259
+ let n = Q.value.rowIdAt(e), r = R.value[t];
1260
+ if (n === void 0 || r === void 0) return;
1261
+ let i = fr(n), a = i?.get(null), o = i?.get(r.key), s = x(T.marks)?.get(n, r.key) ?? null, c = s?.fill ?? o?.fill ?? a?.fill ?? null, l = s?.color ?? o?.color ?? a?.color ?? null, u = [];
1262
+ return c && u.push(`is-fill-${c}`), l && u.push(`is-text-${l}`), (s?.bold || o?.bold || a?.bold) && u.push("is-bold"), s?.italic && u.push("is-italic"), u.length > 0 ? u.join(" ") : void 0;
1263
+ }
1264
+ let mr = t(() => {
1265
+ let e = T.found;
1266
+ return e ? new Set(e.cells.map((e) => JSON.stringify([e.rowId, e.field]))) : null;
1267
+ });
1268
+ function hr(e, t) {
1269
+ let n = mr.value;
1270
+ if (!n || n.size === 0) return;
1271
+ let r = Q.value.rowIdAt(e), i = R.value[t];
1272
+ if (r === void 0 || i === void 0) return;
1273
+ let a = T.found?.current;
1274
+ return a && a.rowId === r && a.field === i.key ? "is-found-current" : n.has(JSON.stringify([r, i.key])) ? "is-found" : void 0;
1275
+ }
1276
+ function gr() {
1277
+ let e = zr.value;
1278
+ if (!e) return [];
1279
+ let t = [];
1280
+ for (let n = e.top; n <= e.bottom; n++) {
1281
+ let r = Q.value.rowIdAt(n);
1282
+ if (r !== void 0) for (let n = e.left; n <= e.right; n++) {
1283
+ let e = R.value[n];
1284
+ e && t.push({
1285
+ rowId: r,
1286
+ field: e.key
1287
+ });
1288
+ }
1289
+ }
1290
+ return t;
1291
+ }
1292
+ function _r() {
1293
+ let e = zr.value;
1294
+ return e ? R.value.slice(e.left, e.right + 1).map((e) => e.key) : [];
1295
+ }
1296
+ function vr(e) {
1297
+ let t = x(T.marks), n = gr();
1298
+ return !t || n.length === 0 ? !1 : (t.mark(n, e), !0);
1299
+ }
1300
+ function yr(e) {
1301
+ let t = x(T.marks), n = gr();
1302
+ return !t || n.length === 0 ? !1 : (t.toggle(n, e), !0);
1303
+ }
1304
+ function br() {
1305
+ let e = x(T.marks), t = gr();
1306
+ return !e || t.length === 0 ? !1 : (e.clear(t), !0);
1307
+ }
1308
+ function xr(e, t) {
1309
+ return L.value.has(t) && Ln(L.value.field(t)) && !jr(e);
1310
+ }
1311
+ let Sr = g("sum"), Cr = t(() => {
1312
+ if (!T.totals) return null;
1313
+ V.value, va.value;
1314
+ let e = Q.value;
1315
+ return R.value.map((t) => {
1316
+ if (!lo.has(t.type)) return null;
1317
+ let n = Ee(function* () {
1318
+ for (let n = 0; n < e.size; n++) {
1319
+ let r = e.rowIdAt(n);
1320
+ r !== void 0 && (yield {
1321
+ field: t,
1322
+ value: I.value.get(r, t.key)
1323
+ });
1324
+ }
1325
+ }())[Sr.value];
1326
+ return n === null ? "" : F(t, n, T.valueSettings, { decimals: Fn.value[t.key]?.decimals });
1327
+ });
1328
+ });
1329
+ function wr(e) {
1330
+ let t = e < z.value ? 0 : er.value;
1331
+ return `left:${G.value + (W.value[e] ?? 0) - t}px;width:${On.value[e] ?? 0}px`;
1332
+ }
1333
+ function Tr(e, t) {
1334
+ let n = x(T.changes);
1335
+ if (!n) return;
1336
+ Ea.value;
1337
+ let r = Q.value.rowIdAt(e), i = R.value[t];
1338
+ return r !== void 0 && i !== void 0 && n.isChanged(r, i.key) ? "is-changed" : void 0;
1339
+ }
1340
+ function Er(e, t) {
1341
+ wa.value;
1342
+ let n = Q.value.rowIdAt(e), r = R.value[t];
1343
+ return n === void 0 || r === void 0 ? [] : Ca.value.issuesAt(n, r.key);
1344
+ }
1345
+ function Dr(e) {
1346
+ let t = e.filter((e) => !e.stale);
1347
+ return t.length > 0 ? t.some((e) => e.severity === "error") ? "is-error" : "is-warning" : e.length > 0 ? "is-stale" : void 0;
1348
+ }
1349
+ function Or(e, t) {
1350
+ return Dr(Er(e, t));
1351
+ }
1352
+ function kr(e) {
1353
+ return e.length === 0 ? void 0 : e.map((e) => {
1354
+ let t = He(e, T.locale, T.valueSettings);
1355
+ return e.stale ? `${H[T.locale].recheck}: ${t}` : t;
1356
+ }).join("\n");
1357
+ }
1358
+ function Ar(e, t) {
1359
+ return kr(Er(e, t));
1360
+ }
1361
+ function jr(e) {
1362
+ return Da.value?.isLocked(e) ?? !1;
1363
+ }
1364
+ function Mr(e) {
1365
+ Oa.value;
1366
+ let t = Q.value.rowIdAt(e);
1367
+ return t !== void 0 && jr(t);
1368
+ }
1369
+ function Nr(e) {
1370
+ let t = Da.value?.resultOf(e) ?? null;
1371
+ return Da.value?.isLocked(e) && t?.outcome !== "succeeded" ? "sending" : t?.outcome ?? null;
1372
+ }
1373
+ function Pr(e) {
1374
+ Oa.value, wa.value;
1375
+ let t = Q.value.rowIdAt(e);
1376
+ if (t === void 0) return [];
1377
+ let n = Nr(t), r = Dr(Ca.value.rowIssues(t));
1378
+ return [n ? `is-${n}` : "", r ?? ""].filter(Boolean);
1379
+ }
1380
+ function Fr(e) {
1381
+ wa.value;
1382
+ let t = Q.value.rowIdAt(e);
1383
+ if (t === void 0 || !Ca.value.hasIssues(t)) return;
1384
+ let n = [...Ca.value.rowIssues(t)];
1385
+ for (let e of L.value.fields) n.push(...Ca.value.issuesAt(t, e.key));
1386
+ return Dr(n);
1387
+ }
1388
+ function Ir(e) {
1389
+ Oa.value, wa.value;
1390
+ let t = Q.value.rowIdAt(e);
1391
+ if (t === void 0) return;
1392
+ let n = Nr(t), r = [n ? H[T.locale][n] : void 0, kr(Ca.value.rowIssues(t))].filter(Boolean).join("\n");
1393
+ return r === "" ? void 0 : r;
1394
+ }
1395
+ function Lr(e, t) {
1396
+ return ye(e, t, T.valueSettings).value;
1397
+ }
1398
+ function Rr(e, t) {
1399
+ let n = Q.value.rowIdAt(e), r = R.value[t];
1400
+ return n === void 0 || r === void 0 || I.value.get(n, r.key) === null;
1401
+ }
1402
+ let K = t(() => (Ie.value, B.active)), zr = t(() => (Ie.value, B.range)), Br = t(() => K.value ? `${Re}-${K.value.row}-${K.value.col}` : void 0), Vr = t(() => {
1403
+ let e = K.value, t = e ? R.value[e.col] : void 0;
1404
+ return e && t ? `${t.label}: ${ar(e.row, e.col)}` : void 0;
1405
+ });
1406
+ function Hr(e, t) {
1407
+ return K.value !== null && K.value.row === e && K.value.col === t;
1408
+ }
1409
+ function Ur(e, t) {
1410
+ let n = zr.value;
1411
+ return n !== null && e >= n.top && e <= n.bottom && t >= n.left && t <= n.right;
1412
+ }
1413
+ function Wr(e) {
1414
+ return zr.value !== null && e >= zr.value.top && e <= zr.value.bottom;
1415
+ }
1416
+ function Gr(e) {
1417
+ return zr.value !== null && e >= zr.value.left && e <= zr.value.right;
1418
+ }
1419
+ function Kr(e, t = 0) {
1420
+ let n = W.value[e.left] ?? 0;
1421
+ return {
1422
+ transform: `translate(${n + t}px, ${e.top * U.value}px)`,
1423
+ width: `${(W.value[e.right + 1] ?? n) - n}px`,
1424
+ height: `${(e.bottom - e.top + 1) * U.value}px`
1425
+ };
1426
+ }
1427
+ function qr(e) {
1428
+ let t = z.value;
1429
+ return {
1430
+ pinned: e && e.left < t ? Kr({
1431
+ ...e,
1432
+ right: Math.min(e.right, t - 1)
1433
+ }) : null,
1434
+ free: e && e.right >= t ? Kr({
1435
+ ...e,
1436
+ left: Math.max(e.left, t)
1437
+ }) : null
1438
+ };
1439
+ }
1440
+ let Jr = t(() => qr(zr.value)), Yr = t(() => {
1441
+ let e = zr.value;
1442
+ if (!e || T.readonly || q.value) return null;
1443
+ let t = Math.min(W.value[e.right + 1] ?? 0, An.value - 4), n = Math.min((e.bottom + 1) * U.value, Mn.value - 4);
1444
+ return {
1445
+ pinned: e.right < z.value,
1446
+ style: { transform: `translate(${t}px, ${n}px)` }
1447
+ };
1448
+ }), Xr = t(() => {
1449
+ let e = Ki.value;
1450
+ return e?.target ? qr(Ji(e.source, e.target)) : null;
1451
+ }), Zr = t(() => K.value !== null && K.value.col < z.value), Qr = t(() => {
1452
+ let e = K.value;
1453
+ return e ? Kr({
1454
+ top: e.row,
1455
+ bottom: e.row,
1456
+ left: e.col,
1457
+ right: e.col
1458
+ }) : {};
1459
+ }), $r = t(() => {
1460
+ let e = K.value;
1461
+ return e && Zr.value ? Kr({
1462
+ top: e.row,
1463
+ bottom: e.row,
1464
+ left: e.col,
1465
+ right: e.col
1466
+ }, er.value) : Qr.value;
1467
+ }), q = y(null), J = g(""), ei = null, ti = t(() => {
1468
+ let e = q.value;
1469
+ if (!e) return {};
1470
+ let t = On.value[e.col] ?? 0, n = An.value - (W.value[e.col] ?? 0), r = ei ? ei(J.value) + Sn : t;
1471
+ return {
1472
+ ...$r.value,
1473
+ width: `${Math.min(Math.max(t, r), Math.max(t, n))}px`
1474
+ };
1475
+ });
1476
+ function ni() {
1477
+ u(() => We.value?.focus({ preventScroll: !0 }));
1478
+ }
1479
+ function ri(e) {
1480
+ e.target === ze.value && ni();
1481
+ }
1482
+ function ii(e) {
1483
+ let t = B.active, n = t ? R.value[t.col] : void 0, r = t ? Q.value.rowIdAt(t.row) : void 0;
1484
+ if (!t || !Ln(n) || r === void 0 || Mr(t.row)) return !1;
1485
+ ei = Je.value ? Qe(Je.value) : null;
1486
+ let i = I.value.get(r, n.key);
1487
+ return Z.value = n.type === "options" && n.multiple ? new Set(e === "enter" || !Array.isArray(i) ? [] : i.map((e) => String(e))) : null, q.value = {
1488
+ row: t.row,
1489
+ col: t.col,
1490
+ original: ue(n, i, T.valueSettings),
1491
+ mode: e
1492
+ }, ir(), !0;
1493
+ }
1494
+ function ai() {
1495
+ ii("edit") && (J.value = Z.value ? "" : q.value?.original ?? "", u(() => {
1496
+ let e = We.value;
1497
+ e?.focus({ preventScroll: !0 }), e?.setSelectionRange(e.value.length, e.value.length);
1498
+ }));
1499
+ }
1500
+ function oi(e) {
1501
+ if (q.value || e.isComposing) return;
1502
+ let t = e.target, n = t.value;
1503
+ n !== "" && (ii("enter") ? J.value = n : (t.value = "", J.value = ""));
1504
+ }
1505
+ function si() {
1506
+ q.value || ii("enter");
1507
+ }
1508
+ function ci(e) {
1509
+ e.isComposing || e.keyCode === 229 || (q.value ? Mi(e) : Pi(e));
1510
+ }
1511
+ function li() {
1512
+ Y(!1);
1513
+ }
1514
+ function Y(e = !0) {
1515
+ let t = q.value;
1516
+ if (!t) return;
1517
+ let n = J.value, r = Z.value;
1518
+ q.value = null, J.value = "", Z.value = null;
1519
+ let i = Q.value.rowIdAt(t.row), a = R.value[t.col];
1520
+ if (i !== void 0 && a?.type === "options" && r && n.trim() === "") {
1521
+ let e = a.options.filter((e) => r.has(String(e.value))).map((e) => e.value), t = e.length === 0 ? null : Object.freeze(e);
1522
+ JSON.stringify(t) !== JSON.stringify(I.value.get(i, a.key)) && I.value.setCell(i, a.key, t);
1523
+ } else i !== void 0 && a !== void 0 && n !== t.original && I.value.setCell(i, a.key, Lr(a, n));
1524
+ e && ni();
1525
+ }
1526
+ function ui() {
1527
+ q.value = null, J.value = "", Z.value = null, ni();
1528
+ }
1529
+ let di = y([]), X = y(-1), fi = y(null), pi = y(null), mi = `${Re}-list`, hi = null, gi = null, _i = t(() => q.value !== null && (di.value.length > 0 || fi.value !== null)), Z = y(null), vi = t(() => {
1530
+ let e = q.value ? R.value[q.value.col] : void 0;
1531
+ return e?.type === "options" || e?.type === "lookup" && T.lookups ? e : null;
1532
+ });
1533
+ function yi(e) {
1534
+ return e.trim().toLocaleLowerCase(T.locale);
1535
+ }
1536
+ function bi() {
1537
+ hi !== null && (clearTimeout(hi), hi = null), gi?.abort(), gi = null;
1538
+ }
1539
+ function xi() {
1540
+ bi(), di.value = [], X.value = -1, fi.value = null;
1541
+ }
1542
+ function Si(e, t) {
1543
+ let n = yi(t), r = e.filter((e) => !e.disabled), i = r.filter((e) => yi(e.label) === n), a = i.length === 1 ? i[0] : i.length === 0 && r.length === 1 ? r[0] : void 0;
1544
+ return a ? e.indexOf(a) : -1;
1545
+ }
1546
+ function Ci(e, t, n) {
1547
+ di.value = e, X.value = Z.value && e.length > 0 ? Math.max(0, Si(e, t)) : Si(e, t), fi.value = n, u(Oi);
1548
+ }
1549
+ function wi() {
1550
+ let e = vi.value, t = J.value;
1551
+ if (bi(), e?.type === "options") {
1552
+ let n = yi(t), r = e.options.filter((e) => n === "" || yi(e.label).includes(n) || yi(String(e.value)) === n).map((e) => ({
1553
+ key: String(e.value),
1554
+ label: e.label,
1555
+ description: null,
1556
+ disabled: !1,
1557
+ value: e.value
1558
+ }));
1559
+ r.length > 0 ? Ci(r, t, null) : xi();
1560
+ } else e?.type !== "lookup" || t.trim() === "" ? xi() : (fi.value = "searching", u(Oi), hi = setTimeout(() => void Ti(e.key, t), wn));
1561
+ }
1562
+ async function Ti(e, t) {
1563
+ let n = T.lookups, r = new AbortController();
1564
+ hi = null, gi = r;
1565
+ try {
1566
+ let i = await n?.search(e, t, r.signal, Cn);
1567
+ if (gi !== r || !i) return;
1568
+ let a = i.items.map((e) => ({
1569
+ key: String(e.id),
1570
+ label: e.label,
1571
+ description: e.description ?? null,
1572
+ disabled: e.disabled === !0,
1573
+ value: Object.freeze({
1574
+ id: e.id,
1575
+ label: e.label
1576
+ })
1577
+ }));
1578
+ Ci(a, t, a.length === 0 ? "none" : i.more ? "more" : null);
1579
+ } catch {
1580
+ gi === r && Ci([], t, "unavailable");
1581
+ } finally {
1582
+ gi === r && (gi = null);
1583
+ }
1584
+ }
1585
+ O([q, J], () => wi());
1586
+ function Ei(e) {
1587
+ let t = di.value;
1588
+ for (let n = 1; n <= t.length; n++) {
1589
+ let r = (X.value + e * n + t.length * 2) % t.length;
1590
+ if (!t[r]?.disabled) {
1591
+ X.value = r;
1592
+ return;
1593
+ }
1594
+ }
1595
+ }
1596
+ function Di(e) {
1597
+ let t = di.value[e], n = q.value;
1598
+ if (!t || t.disabled || !n) return !1;
1599
+ if (Z.value) {
1600
+ let n = new Set(Z.value);
1601
+ return n.delete(t.key) || n.add(t.key), Z.value = n, J.value === "" ? X.value = e : J.value = "", !0;
1602
+ }
1603
+ let r = Q.value.rowIdAt(n.row), i = R.value[n.col];
1604
+ return q.value = null, J.value = "", xi(), r !== void 0 && i && I.value.setCell(r, i.key, t.value), ni(), !0;
1605
+ }
1606
+ function Oi() {
1607
+ let e = We.value, t = ze.value, n = t?.querySelector(".tabula-grid-list");
1608
+ if (!e || !t || !_i.value) {
1609
+ pi.value = null;
1610
+ return;
1611
+ }
1612
+ let r = e.getBoundingClientRect(), i = t.getBoundingClientRect(), a = n?.offsetHeight ?? 0, o = i.bottom - r.bottom, s = a > o && r.top - i.top > o;
1613
+ pi.value = {
1614
+ left: r.left - i.left,
1615
+ top: s ? r.top - i.top - a : r.bottom - i.top,
1616
+ width: r.width
1617
+ };
1618
+ }
1619
+ function ki(e) {
1620
+ return e.key === "ArrowDown" || e.key === "ArrowUp" ? (Ei(e.key === "ArrowDown" ? 1 : -1), !0) : Z.value ? Ai(e) : e.key === "Escape" ? (xi(), !0) : (e.key === "Enter" || e.key === "Tab") && X.value >= 0 && Di(X.value) ? (e.key === "Enter" ? Ni(e.shiftKey ? -1 : 1, 0) : Ni(0, e.shiftKey ? -1 : 1), !0) : !1;
1621
+ }
1622
+ function Ai(e) {
1623
+ let t = J.value.trim() !== "";
1624
+ return e.key === " " && !t && X.value >= 0 || e.key === "Enter" && t && X.value >= 0 ? Di(X.value) : !1;
1625
+ }
1626
+ function ji() {
1627
+ let e = B.active;
1628
+ return (e ? R.value[e.col] : void 0)?.type !== "options" || !ii("edit") ? !1 : (J.value = "", u(() => We.value?.focus({ preventScroll: !0 })), !0);
1629
+ }
1630
+ function Mi(e) {
1631
+ let t = q.value;
1632
+ if (t) {
1633
+ if (_i.value && ki(e)) e.preventDefault();
1634
+ else {
1635
+ if (e.key === "Enter") Y(), Ni(e.shiftKey ? -1 : 1, 0);
1636
+ else if (e.key === "Tab") Y(), Ni(0, e.shiftKey ? -1 : 1);
1637
+ else if (e.key === "Escape") ui();
1638
+ else if (t.mode === "enter" && Te[e.key] !== void 0) {
1639
+ let t = Oe[Te[e.key]];
1640
+ Y(), Ni(t.row, t.col);
1641
+ } else return;
1642
+ e.preventDefault();
1643
+ }
1644
+ }
1645
+ }
1646
+ function Ni(e, t, n = !1) {
1647
+ B.move(e, t, { extend: n }), ir();
1648
+ }
1649
+ function Pi(e) {
1650
+ let t = e.ctrlKey || e.metaKey, n = e.shiftKey, r = (n ? B.head : B.active) ?? {
1651
+ row: 0,
1652
+ col: 0
1653
+ }, i = Math.max(1, Math.floor(nr().height / U.value) - 1), a = Te[e.key], o = Ii(e);
1654
+ if (o !== null) e.preventDefault(), Li(o);
1655
+ else if (e.altKey && e.key === "ArrowDown" && ji()) e.preventDefault();
1656
+ else {
1657
+ if (a !== void 0) {
1658
+ if (t) B.jump(a, Rr, { extend: n });
1659
+ else {
1660
+ let e = Oe[a];
1661
+ B.move(e.row, e.col, { extend: n });
1662
+ }
1663
+ } else switch (e.key) {
1664
+ case "Tab": {
1665
+ let e = B.active?.col ?? 0;
1666
+ if (n ? e <= 0 : e >= R.value.length - 1) return;
1667
+ B.move(0, n ? -1 : 1);
1668
+ break;
1669
+ }
1670
+ case "Enter":
1671
+ B.move(n ? -1 : 1, 0);
1672
+ break;
1673
+ case "Home":
1674
+ B.moveTo(t ? 0 : r.row, 0, { extend: n });
1675
+ break;
1676
+ case "End":
1677
+ B.moveTo(t ? Infinity : r.row, Infinity, { extend: n });
1678
+ break;
1679
+ case "PageDown":
1680
+ B.move(i, 0, { extend: n });
1681
+ break;
1682
+ case "PageUp":
1683
+ B.move(-i, 0, { extend: n });
1684
+ break;
1685
+ case "F2":
1686
+ ai();
1687
+ break;
1688
+ case "Delete":
1689
+ case "Backspace":
1690
+ Wi("clear");
1691
+ break;
1692
+ default: if (!Fi(e, t)) return;
1693
+ }
1694
+ e.preventDefault(), ir();
1695
+ }
1696
+ }
1697
+ function Fi(e, t) {
1698
+ let n = e.ctrlKey && e.altKey;
1699
+ if (e.key === " " && e.shiftKey && !t) {
1700
+ let e = B.active;
1701
+ return e && B.selectRows(e.row), !0;
1702
+ }
1703
+ if (e.key === " " && t && !e.shiftKey) {
1704
+ let e = B.active;
1705
+ return e && B.selectColumns(e.col), !0;
1706
+ }
1707
+ if (t && !n && e.key.toLowerCase() === "a") return B.selectAll(), !0;
1708
+ if (e.key === "ContextMenu" || e.key === "F10" && e.shiftKey && !t) return Oo(null), !0;
1709
+ if (t && !n && (e.key === "+" || e.code === "NumpadAdd") && !T.readonly) {
1710
+ let e = B.range;
1711
+ return e && e.left === 0 && e.right >= R.value.length - 1 ? yo("above") : e && B.selectRows(e.top, e.bottom), !0;
1712
+ }
1713
+ if (t && !n && (e.key === "-" || e.code === "NumpadSubtract") && !T.readonly) {
1714
+ let e = B.range;
1715
+ return e && e.left === 0 && e.right >= R.value.length - 1 ? vo() : e && B.selectRows(e.top, e.bottom), !0;
1716
+ }
1717
+ let r = e.key.toLowerCase();
1718
+ return t && !n && !e.shiftKey && (r === "b" || r === "i") && x(T.marks) ? (yr(r === "b" ? "bold" : "italic"), !0) : t && !n && !e.shiftKey && r === "h" ? (k("find"), !0) : t && !n && !e.shiftKey && (r === "d" || r === "r") && !T.readonly ? (na(r === "d" ? "down" : "right"), !0) : !1;
1719
+ }
1720
+ function Ii(e) {
1721
+ let t = e.key.toLowerCase();
1722
+ return !(e.ctrlKey || e.metaKey) || e.altKey || t !== "z" && t !== "y" ? null : t === "y" || e.shiftKey ? "redo" : "undo";
1723
+ }
1724
+ function Li(e) {
1725
+ if (T.readonly) return !1;
1726
+ Y(!1);
1727
+ try {
1728
+ return (e === "undo" ? Sa.value.undo() : Sa.value.redo()) !== null;
1729
+ } catch (e) {
1730
+ if (e instanceof ne && e.code === "conflict") return !1;
1731
+ throw e;
1732
+ }
1733
+ }
1734
+ function Ri(e) {
1735
+ let t = Q.value, n = new Map(R.value.flatMap((e, t) => e.formula === null ? [[e.key, t]] : [])), r = {
1736
+ top: Infinity,
1737
+ left: Infinity,
1738
+ bottom: -1,
1739
+ right: -1
1740
+ }, i = {
1741
+ top: Infinity,
1742
+ bottom: -1
1743
+ }, a = Infinity;
1744
+ for (let o of e.operations) if (o.kind === "set") {
1745
+ let e = t.indexOf(o.rowId), i = n.get(o.field);
1746
+ e >= 0 && i !== void 0 && (r.top = Math.min(r.top, e), r.bottom = Math.max(r.bottom, e), r.left = Math.min(r.left, i), r.right = Math.max(r.right, i));
1747
+ } else if (o.kind === "insert") for (let e of o.rows) {
1748
+ let n = t.indexOf(e.rowId);
1749
+ n >= 0 && (i.top = Math.min(i.top, n), i.bottom = Math.max(i.bottom, n));
1750
+ }
1751
+ else a = Math.min(a, o.rows[0]?.index ?? Infinity);
1752
+ q.value = null, J.value = "", r.bottom >= 0 ? (B.moveTo(r.top, r.left), B.moveTo(r.bottom, r.right, { extend: !0 })) : i.bottom >= 0 ? B.selectRows(i.top, i.bottom) : a !== Infinity && B.moveTo(a, B.active?.col ?? 0), ir(B.active);
1753
+ }
1754
+ function zi(e) {
1755
+ let t = [];
1756
+ for (let n = e.top; n <= e.bottom; n++) {
1757
+ let r = [];
1758
+ for (let t = e.left; t <= e.right; t++) r.push(ar(n, t));
1759
+ t.push(r);
1760
+ }
1761
+ return De(t);
1762
+ }
1763
+ function Bi(e) {
1764
+ let t = B.range;
1765
+ !q.value && t && e.clipboardData && (e.clipboardData.setData("text/plain", zi(t)), e.preventDefault());
1766
+ }
1767
+ function Vi(e) {
1768
+ q.value || T.readonly || (Bi(e), Wi("cut"));
1769
+ }
1770
+ function Hi(e) {
1771
+ q.value || T.readonly || !B.range || (e.preventDefault(), Ui(e.clipboardData?.getData("text/plain") ?? ""));
1772
+ }
1773
+ function Ui(e) {
1774
+ let t = B.range, n = ve(e);
1775
+ if (T.readonly || !t || n.length === 0) return;
1776
+ let r = n.length === 1 && n[0]?.length === 1 && (t.bottom > t.top || t.right > t.left), i = r ? t.bottom - t.top + 1 : n.length, a = r ? t.right - t.left + 1 : Math.max(...n.map((e) => e.length)), o = I.value, s = R.value;
1777
+ o.transact(() => {
1778
+ let e = Q.value.size, c = t.top + i - e, l = c > 0 ? o.appendRows(Ae(L.value, c)) : [], u = (t) => t < e ? Q.value.rowIdAt(t) : l[t - e];
1779
+ for (let e = 0; e < i; e++) {
1780
+ let i = u(t.top + e);
1781
+ for (let c = 0; c < a && t.left + c < s.length; c++) {
1782
+ let a = s[t.left + c], l = r ? n[0]?.[0] : n[e]?.[c];
1783
+ i !== void 0 && Ln(a) && l !== void 0 && !jr(i) && o.setCell(i, a.key, Lr(a, l));
1784
+ }
1785
+ }
1786
+ }, { origin: "paste" }), B.moveTo(t.top, t.left), B.moveTo(t.top + i - 1, Math.min(t.left + a, s.length) - 1, { extend: !0 }), ir();
1787
+ }
1788
+ function Wi(e) {
1789
+ let t = B.range;
1790
+ if (!t || T.readonly) return;
1791
+ let n = I.value;
1792
+ n.transact(() => {
1793
+ for (let e = t.top; e <= t.bottom; e++) {
1794
+ let r = Q.value.rowIdAt(e);
1795
+ for (let e = t.left; e <= t.right; e++) {
1796
+ let t = R.value[e];
1797
+ r !== void 0 && Ln(t) && !jr(r) && n.setCell(r, t.key, null);
1798
+ }
1799
+ }
1800
+ }, { origin: e });
1801
+ }
1802
+ let Gi = /* @__PURE__ */ new Set([
1803
+ "string",
1804
+ "integer",
1805
+ "decimal",
1806
+ "money",
1807
+ "quantity",
1808
+ "percent",
1809
+ "bool",
1810
+ "date",
1811
+ "datetime"
1812
+ ]), Ki = y(null);
1813
+ function qi(e, t, n) {
1814
+ return n === null || e.key === t.key || e.type === t.type && Gi.has(t.type) ? n : Lr(t, F(e, n, T.valueSettings));
1815
+ }
1816
+ function Ji(e, t) {
1817
+ return {
1818
+ top: e.top + Math.min(0, t.rows),
1819
+ bottom: e.bottom + Math.max(0, t.rows),
1820
+ left: e.left + Math.min(0, t.cols),
1821
+ right: e.right + Math.max(0, t.cols)
1822
+ };
1823
+ }
1824
+ function Yi(e, t) {
1825
+ let n = t.row > e.bottom ? t.row - e.bottom : Math.min(0, t.row - e.top), r = t.col > e.right ? t.col - e.right : Math.min(0, t.col - e.left);
1826
+ return n === 0 && r === 0 ? null : {
1827
+ rows: n,
1828
+ cols: r
1829
+ };
1830
+ }
1831
+ function Xi(e, t, n) {
1832
+ T.readonly || t.rows === 0 && t.cols === 0 || I.value.transact(() => {
1833
+ t.rows !== 0 && Zi(e, t.rows, n), t.cols !== 0 && Qi(Ji(e, {
1834
+ rows: t.rows,
1835
+ cols: 0
1836
+ }), t.cols, n);
1837
+ }, { origin: "fill" });
1838
+ }
1839
+ function Zi(e, t, n) {
1840
+ let r = I.value, i = Q.value, a = {
1841
+ backward: t < 0,
1842
+ mode: n
1843
+ }, o = Math.abs(t);
1844
+ for (let t = e.left; t <= e.right; t++) {
1845
+ let n = R.value[t];
1846
+ if (!Ln(n)) continue;
1847
+ let s = tr(e.top, e.bottom).map((e) => {
1848
+ let t = i.rowIdAt(e);
1849
+ return t === void 0 ? null : r.get(t, n.key);
1850
+ });
1851
+ de(n, s, o, a).forEach((t, o) => {
1852
+ let s = i.rowIdAt(a.backward ? e.top - 1 - o : e.bottom + 1 + o);
1853
+ s !== void 0 && !jr(s) && r.setCell(s, n.key, t);
1854
+ });
1855
+ }
1856
+ }
1857
+ function Qi(e, t, n) {
1858
+ let r = I.value, i = Q.value, a = {
1859
+ backward: t < 0,
1860
+ mode: n
1861
+ }, o = Math.abs(t), s = R.value.slice(e.left, e.right + 1), c = s[0], l = c && Gi.has(c.type) && s.every((e) => e.type === c.type) ? c : null, u = de(null, s.map((e, t) => t), o, a);
1862
+ for (let t = e.top; t <= e.bottom; t++) {
1863
+ let n = i.rowIdAt(t);
1864
+ if (n === void 0 || jr(n)) continue;
1865
+ let c = s.map((e) => r.get(n, e.key)), d = l ? de(l, c, o, a) : null;
1866
+ for (let t = 0; t < o; t++) {
1867
+ let i = R.value[a.backward ? e.left - 1 - t : e.right + 1 + t], o = u[t] ?? 0, f = l ?? s[o];
1868
+ Ln(i) && f && r.setCell(n, i.key, qi(f, i, d ? d[t] ?? null : c[o] ?? null));
1869
+ }
1870
+ }
1871
+ }
1872
+ function $i(e) {
1873
+ B.moveTo(e.top, e.left), B.moveTo(e.bottom, e.right, { extend: !0 }), ir();
1874
+ }
1875
+ function ea(e) {
1876
+ let t = B.range;
1877
+ e.button === 0 && t && !T.readonly && (sa(e), Ki.value = {
1878
+ source: t,
1879
+ target: null
1880
+ }, ia((e) => {
1881
+ let n = oa(e);
1882
+ n && (Ki.value = {
1883
+ source: t,
1884
+ target: Yi(t, n)
1885
+ });
1886
+ }, (e) => {
1887
+ let n = Ki.value?.target ?? null;
1888
+ Ki.value = null, e && n && (Xi(t, n, e.ctrlKey || e.altKey ? "alternate" : "auto"), $i(Ji(t, n)));
1889
+ }));
1890
+ }
1891
+ function ta() {
1892
+ let e = B.range;
1893
+ if (!e || T.readonly) return;
1894
+ let t = [e.left - 1, e.right + 1].find((t) => t >= 0 && t < R.value.length && !Rr(e.bottom + 1, t));
1895
+ if (t === void 0) return;
1896
+ let n = e.bottom + 1;
1897
+ for (; n + 1 < Le.value && !Rr(n + 1, t);) n++;
1898
+ let r = {
1899
+ rows: n - e.bottom,
1900
+ cols: 0
1901
+ };
1902
+ Xi(e, r, "auto"), $i(Ji(e, r));
1903
+ }
1904
+ function na(e) {
1905
+ let t = B.range;
1906
+ if (!t) return;
1907
+ if (e === "down") {
1908
+ let e = t.bottom > t.top ? t.top : t.top - 1;
1909
+ e >= 0 && Xi({
1910
+ ...t,
1911
+ top: e,
1912
+ bottom: e
1913
+ }, {
1914
+ rows: t.bottom - e,
1915
+ cols: 0
1916
+ }, "copy");
1917
+ return;
1918
+ }
1919
+ let n = t.right > t.left ? t.left : t.left - 1;
1920
+ n >= 0 && Xi({
1921
+ ...t,
1922
+ left: n,
1923
+ right: n
1924
+ }, {
1925
+ rows: 0,
1926
+ cols: t.right - n
1927
+ }, "copy");
1928
+ }
1929
+ let ra = null;
1930
+ function ia(e, t) {
1931
+ ra?.();
1932
+ let n = (r) => {
1933
+ window.removeEventListener("mousemove", e), window.removeEventListener("mouseup", n), ra = null, t?.(r instanceof MouseEvent ? r : null);
1934
+ };
1935
+ window.addEventListener("mousemove", e), window.addEventListener("mouseup", n), ra = n;
1936
+ }
1937
+ function aa(e, t, n) {
1938
+ return Math.min(n, Math.max(t, e));
1939
+ }
1940
+ function oa(e) {
1941
+ let t = Ue.value;
1942
+ if (!t || Le.value === 0 || R.value.length === 0) return null;
1943
+ let n = t.getBoundingClientRect();
1944
+ return {
1945
+ row: aa(Math.floor((e.clientY - n.top) / U.value), 0, Le.value - 1),
1946
+ col: la(e.clientX)
1947
+ };
1948
+ }
1949
+ function sa(e) {
1950
+ e.preventDefault(), Y(!1), ni();
1951
+ }
1952
+ function ca(e) {
1953
+ if (e.button !== 0 || q.value && e.target === We.value) return;
1954
+ sa(e);
1955
+ let t = oa(e);
1956
+ t && (B.moveTo(t.row, t.col, { extend: e.shiftKey }), ia((e) => {
1957
+ let t = oa(e);
1958
+ t && B.moveTo(t.row, t.col, { extend: !0 });
1959
+ }));
1960
+ }
1961
+ function la(e) {
1962
+ let t = Be.value, n = e - (t?.getBoundingClientRect().left ?? 0) - G.value;
1963
+ return z.value > 0 && n < jn.value ? Vn(Math.max(0, n)) : Vn(aa(n + (t?.scrollLeft ?? 0), 0, Math.max(0, An.value - 1)));
1964
+ }
1965
+ function ua(e) {
1966
+ let t = Ve.value?.getBoundingClientRect();
1967
+ return aa(Math.floor((e - (t?.top ?? 0)) / U.value), 0, Math.max(0, Le.value - 1));
1968
+ }
1969
+ function da(e, t) {
1970
+ if (e.button !== 0) return;
1971
+ sa(e);
1972
+ let n = e.shiftKey && B.active ? B.active.col : t;
1973
+ B.selectColumns(n, t), ia((e) => B.selectColumns(n, la(e.clientX)));
1974
+ }
1975
+ function fa(e, t) {
1976
+ if (e.button !== 0) return;
1977
+ sa(e);
1978
+ let n = e.shiftKey && B.active ? B.active.row : t;
1979
+ B.selectRows(n, t), ia((e) => B.selectRows(n, ua(e.clientY)));
1980
+ }
1981
+ function pa(e) {
1982
+ e.button === 0 && (sa(e), B.selectAll());
1983
+ }
1984
+ function ma(e, t) {
1985
+ let n = R.value[t], r = Ye.value[t];
1986
+ if (e.button !== 0 || !n || !r) return;
1987
+ let i = e.clientX, a = On.value[t] ?? r.minWidth;
1988
+ ia((e) => {
1989
+ Ze.value = {
1990
+ key: n.key,
1991
+ width: ce(a + e.clientX - i, r)
1992
+ };
1993
+ }, () => {
1994
+ let e = Ze.value;
1995
+ Ze.value = null, e && e.width !== a && Wn(e.key, e.width);
1996
+ });
1997
+ }
1998
+ function ha() {
1999
+ Le.value = Q.value.size, B.resize(Le.value, R.value.length), rr();
2000
+ }
2001
+ let ga = B.subscribe(() => {
2002
+ Ie.value++;
2003
+ }), _a = null, Q = y(x(T.view) ?? (_a = new M(I.value))), va = y(0);
2004
+ O(() => x(T.store), (e, t, n) => {
2005
+ I.value = e, q.value = null, ha(), V.value++, n(e.subscribe((e) => {
2006
+ V.value++, Q.value.size !== Le.value && ha(), (e.origin === re || e.origin === j) && Ri(e);
2007
+ }));
2008
+ }, { immediate: !0 }), O(() => [x(T.view), I.value], ([e, t], n, r) => {
2009
+ e ? (_a?.dispose(), _a = null, Q.value = e) : _a && n === void 0 || (_a?.dispose(), _a = new M(t), Q.value = _a), va.value++, ha(), r(Q.value.subscribe(() => {
2010
+ va.value++, V.value++, ha();
2011
+ }));
2012
+ }, { immediate: !0 });
2013
+ let ya = t(() => (va.value, Q.value.arranged));
2014
+ function ba(e) {
2015
+ va.value;
2016
+ let t = ya.value ? Q.value.rowIdAt(e) : void 0;
2017
+ return t === void 0 ? e + 1 : I.value.indexOf(t) + 1;
2018
+ }
2019
+ let xa = null, Sa = y(x(T.history) ?? (xa = new ie(I.value)));
2020
+ O(() => [x(T.history), I.value], ([e, t]) => {
2021
+ xa?.dispose(), xa = e ? null : new ie(t), Sa.value = e ?? xa;
2022
+ }), O(() => x(T.schema), (e) => {
2023
+ L.value = e, q.value = null, ha();
2024
+ });
2025
+ let Ca = y(x(T.issues) ?? new te(L.value, I.value, T.valueSettings)), wa = y(0), Ta = T.issues ? null : Ca.value;
2026
+ O(() => [
2027
+ x(T.issues),
2028
+ L.value,
2029
+ I.value
2030
+ ], ([e, t, n], r, i) => {
2031
+ e ? (Ta?.dispose(), Ta = null, Ca.value = e) : Ta && r === void 0 || (Ta?.dispose(), Ta = new te(t, n, T.valueSettings), Ca.value = Ta), wa.value++, i(Ca.value.subscribe(() => wa.value++));
2032
+ }, { immediate: !0 });
2033
+ let Ea = y(0);
2034
+ O(() => x(T.changes), (e, t, n) => {
2035
+ Ea.value++, e && n(e.subscribe(() => Ea.value++));
2036
+ }, { immediate: !0 });
2037
+ let Da = y(x(T.results)), Oa = y(0);
2038
+ O(() => x(T.results), (e, t, n) => {
2039
+ Da.value = e, Oa.value++, e && n(e.subscribe(() => Oa.value++));
2040
+ }, { immediate: !0 }), O(() => T.valueSettings, (e) => {
2041
+ Ta?.setSettings(e);
2042
+ }), O(Ye, () => Hn()), O(() => T.zoom, () => void u(() => Hn())), O(Ne, () => {
2043
+ q.value = null, Pa(), ko(), ha();
2044
+ });
2045
+ let ka = y(null), Aa = null, ja = t(() => (pe.value.hidden ?? []).filter((e) => L.value.has(e)).length);
2046
+ function Ma(e, t) {
2047
+ let n = ze.value, r = e.currentTarget;
2048
+ if (!n || !r) return;
2049
+ let i = r.getBoundingClientRect();
2050
+ Na(t, i.left, i.bottom);
2051
+ }
2052
+ function Na(e, t, n) {
2053
+ let r = ze.value;
2054
+ if (!r) return;
2055
+ Y(!1), Pa(), ko();
2056
+ let i = r.getBoundingClientRect();
2057
+ ka.value = {
2058
+ col: e,
2059
+ left: t - i.left,
2060
+ top: n - i.top
2061
+ };
2062
+ let a = (e) => {
2063
+ let t = r.querySelector(".tabula-grid-menu");
2064
+ e.target instanceof Node && t?.contains(e.target) || Pa();
2065
+ };
2066
+ window.addEventListener("mousedown", a, !0), Aa = () => window.removeEventListener("mousedown", a, !0), u(() => r.querySelector(".tabula-grid-menu button")?.focus());
2067
+ }
2068
+ function Pa(e = !1) {
2069
+ Aa?.(), Aa = null, ka.value = null, e && ni();
2070
+ }
2071
+ function Fa(e) {
2072
+ let t = ka.value, n = t ? R.value[t.col] : void 0;
2073
+ e === "filter" && t ? (Pa(), Za(t.col, t.left, t.top)) : (Pa(!0), e === "sortAsc" || e === "sortDesc" ? n && (be.value = Object.freeze({
2074
+ key: n.key,
2075
+ direction: e === "sortAsc" ? "asc" : "desc"
2076
+ })) : e === "sortClear" ? be.value = null : e === "filterClear" ? n && no(n.key, null) : e === "showHidden" ? pe.value = Object.freeze({
2077
+ ...pe.value,
2078
+ hidden: []
2079
+ }) : n && (pe.value = ke(pe.value, n.key, e === "hide" ? { hidden: !0 } : { pinned: e === "pin" })));
2080
+ }
2081
+ function Ia(e) {
2082
+ let t = [...ze.value?.querySelectorAll(".tabula-grid-menu button:not(:disabled)") ?? []], n = t.indexOf(document.activeElement);
2083
+ if (e.key === "Escape") Pa(!0);
2084
+ else if (e.key === "ArrowDown" || e.key === "ArrowUp") t[(n + (e.key === "ArrowDown" ? 1 : -1) + t.length) % t.length]?.focus();
2085
+ else return;
2086
+ e.preventDefault();
2087
+ }
2088
+ O([
2089
+ _e,
2090
+ be,
2091
+ Q,
2092
+ () => T.locale
2093
+ ], ([e, t, n]) => {
2094
+ Object.keys(e).some((e) => L.value.has(e)) ? n.filter(we(I.value, L.value, e), Tn) : n.clear(Tn), n.sort(t && L.value.has(t.key) ? Se(I.value, L.value, t, T.locale) : null);
2095
+ }, { immediate: !0 });
2096
+ function La(e) {
2097
+ let t = R.value[e];
2098
+ return t && be.value?.key === t.key ? be.value.direction : null;
2099
+ }
2100
+ function Ra(e) {
2101
+ let t = R.value[e];
2102
+ return t !== void 0 && _e.value[t.key] !== void 0;
2103
+ }
2104
+ function za(e) {
2105
+ let t = La(e);
2106
+ return t === "asc" ? "ascending" : t === "desc" ? "descending" : void 0;
2107
+ }
2108
+ let $ = y(null), Ba = g(""), Va = y(/* @__PURE__ */ new Set()), Ha = g(""), Ua = g(""), Wa = g(null), Ga = null;
2109
+ function Ka(e) {
2110
+ let t = $.value?.field;
2111
+ if (e.key === "" || !t) return H[T.locale].empty ?? "";
2112
+ let n = t.type === "options" && t.multiple && !Array.isArray(e.value) ? [e.value] : e.value;
2113
+ return F(t, n, T.valueSettings);
2114
+ }
2115
+ let qa = t(() => {
2116
+ let e = $.value, t = yi(Ba.value);
2117
+ return e ? t === "" ? e.values : e.values.filter((e) => yi(Ka(e)).includes(t)) : [];
2118
+ }), Ja = t(() => qa.value.every((e) => Va.value.has(e.key))), Ya = t(() => qa.value.some((e) => Va.value.has(e.key)));
2119
+ function Xa(e, t) {
2120
+ return t === null ? "" : ue(e, t, T.valueSettings);
2121
+ }
2122
+ function Za(e, t, n) {
2123
+ let r = R.value[e];
2124
+ if (!r) return;
2125
+ let i = { ..._e.value };
2126
+ delete i[r.key];
2127
+ let a = we(I.value, L.value, i), o = I.value.rowIds().filter((e) => a(e)), { values: s, more: c } = le(I.value, r, o, { locale: T.locale }), l = _e.value[r.key];
2128
+ $.value = {
2129
+ col: e,
2130
+ field: r,
2131
+ left: t,
2132
+ top: n,
2133
+ values: s,
2134
+ more: c,
2135
+ range: he(r)
2136
+ }, Ba.value = "", Wa.value = null, Va.value = new Set(l?.kind === "values" ? l.keys : s.map((e) => e.key)), Ha.value = l?.kind === "range" ? Xa(r, l.from) : "", Ua.value = l?.kind === "range" ? Xa(r, l.to) : "";
2137
+ let d = ze.value, f = (e) => {
2138
+ let t = d?.querySelector(".tabula-grid-filter");
2139
+ e.target instanceof Node && t?.contains(e.target) || Qa();
2140
+ };
2141
+ window.addEventListener("mousedown", f, !0), Ga = () => window.removeEventListener("mousedown", f, !0), u(() => d?.querySelector(".tabula-grid-filter input")?.focus());
2142
+ }
2143
+ function Qa(e = !1) {
2144
+ Ga?.(), Ga = null, $.value = null, e && ni();
2145
+ }
2146
+ function $a(e) {
2147
+ let t = new Set(Va.value);
2148
+ t.has(e) ? t.delete(e) : t.add(e), Va.value = t;
2149
+ }
2150
+ function eo() {
2151
+ let e = new Set(Va.value), t = !Ja.value;
2152
+ for (let n of qa.value) t ? e.add(n.key) : e.delete(n.key);
2153
+ Va.value = e;
2154
+ }
2155
+ function to(e, t) {
2156
+ if (t.trim() === "") return null;
2157
+ let { value: n, problem: r } = ye(e, t, T.valueSettings);
2158
+ return r === null && typeof n == "string" ? n : void 0;
2159
+ }
2160
+ function no(e, t) {
2161
+ let n = { ..._e.value };
2162
+ t ? n[e] = t : delete n[e], _e.value = Object.freeze(n);
2163
+ }
2164
+ function ro() {
2165
+ let e = $.value;
2166
+ if (!e) return;
2167
+ let t = e.field.key;
2168
+ if (e.range && (Ha.value.trim() !== "" || Ua.value.trim() !== "")) {
2169
+ let n = to(e.field, Ha.value), r = to(e.field, Ua.value);
2170
+ if (n === void 0 || r === void 0) {
2171
+ Wa.value = H[T.locale].badBound ?? null;
2172
+ return;
2173
+ }
2174
+ no(t, {
2175
+ kind: "range",
2176
+ from: n,
2177
+ to: r
2178
+ });
2179
+ } else {
2180
+ let n = Ba.value.trim() !== "", r = (n ? qa.value : e.values).filter((e) => Va.value.has(e.key)).map((e) => e.key);
2181
+ no(t, !n && r.length === e.values.length && e.more === 0 ? null : {
2182
+ kind: "values",
2183
+ keys: r
2184
+ });
2185
+ }
2186
+ Qa(!0);
2187
+ }
2188
+ function io() {
2189
+ let e = $.value;
2190
+ e && no(e.field.key, null), Qa(!0);
2191
+ }
2192
+ function ao(e) {
2193
+ e.key === "Escape" ? (e.preventDefault(), Qa(!0)) : e.key === "Enter" && e.target.tagName === "INPUT" && e.target.type !== "checkbox" && (e.preventDefault(), ro());
2194
+ }
2195
+ O(W, () => rr()), O(() => U.value, () => rr());
2196
+ let oo = null;
2197
+ m(() => {
2198
+ Hn(), rr(), Be.value && (oo = new ResizeObserver(() => rr()), oo.observe(Be.value)), document.fonts?.ready.then(() => Hn());
2199
+ }), p(() => {
2200
+ bi(), Pa(), Qa(), Ta?.dispose(), xa?.dispose(), _a?.dispose(), oo?.disconnect(), ra?.(), ga();
2201
+ });
2202
+ function so(e, t) {
2203
+ return co(e, t ?? null, !0);
2204
+ }
2205
+ function co(e, t, n, r = !0) {
2206
+ if (!Q.value.show(e)) return !1;
2207
+ let i = Q.value.indexOf(e);
2208
+ if (i < 0) return !1;
2209
+ Y(!1);
2210
+ let a = t ? R.value.findIndex((e) => e.key === t) : -1;
2211
+ return t && a < 0 && n && pe.value.hidden?.includes(t) ? (pe.value = ke(pe.value, t, { hidden: !1 }), u(() => co(e, t, !1, r)), !0) : (B.moveTo(i, a < 0 ? B.active?.col ?? 0 : a), ir(), r && ni(), !0);
2212
+ }
2213
+ let lo = /* @__PURE__ */ new Set([
2214
+ "integer",
2215
+ "decimal",
2216
+ "money",
2217
+ "quantity",
2218
+ "percent"
2219
+ ]), uo = t(() => {
2220
+ V.value, Oa.value;
2221
+ let e = K.value, t = e ? R.value[e.col] : void 0, n = e ? Q.value.rowIdAt(e.row) : void 0;
2222
+ if (!e || t === void 0 || n === void 0) return null;
2223
+ let r = t.formula ? Object.freeze(me(t.formula, L.value.fields)) : null;
2224
+ return Object.freeze({
2225
+ rowId: n,
2226
+ field: t,
2227
+ address: `${je(e.col)}${ba(e.row)}`,
2228
+ text: ue(t, I.value.get(n, t.key), T.valueSettings),
2229
+ editable: Ln(t) && !jr(n),
2230
+ formula: r,
2231
+ references: r ? [...new Set(r.flatMap((e) => e.field ? [e.field] : []))] : []
2232
+ });
2233
+ }), fo = t(() => new Map((uo.value?.references ?? []).map((e, t) => [e, t % En])));
2234
+ function po(e, t) {
2235
+ let n = R.value[t], r = n ? fo.value.get(n.key) : void 0;
2236
+ if (r !== void 0) return `is-ref tabula-ref-${r}${e !== null && K.value?.row === e ? " is-ref-here" : ""}`;
2237
+ }
2238
+ let mo = t(() => {
2239
+ V.value;
2240
+ let e = zr.value;
2241
+ if (!e) return null;
2242
+ let t = Q.value, n = R.value.slice(e.left, e.right + 1), r = `${je(e.left)}${ba(e.top)}`, i = `${je(e.right)}${ba(e.bottom)}`;
2243
+ return Object.freeze({
2244
+ ...Ee(function* () {
2245
+ for (let r = e.top; r <= e.bottom; r++) {
2246
+ let e = t.rowIdAt(r);
2247
+ if (e !== void 0) for (let t of n) yield {
2248
+ field: t,
2249
+ value: I.value.get(e, t.key)
2250
+ };
2251
+ }
2252
+ }()),
2253
+ address: r === i ? r : `${r}:${i}`,
2254
+ rows: e.bottom - e.top + 1,
2255
+ columns: n.length,
2256
+ field: n.find((e) => lo.has(e.type)) ?? null
2257
+ });
2258
+ });
2259
+ function ho(e) {
2260
+ let t = Me(e), n = t ? R.value[t.col] : void 0, r = t ? I.value.rowIdAt(t.row - 1) : void 0;
2261
+ return n !== void 0 && r !== void 0 && co(r, n.key, !1);
2262
+ }
2263
+ function go(e, t, n) {
2264
+ let r = L.value.has(t) ? L.value.field(t) : void 0;
2265
+ return !Ln(r) || !I.value.has(e) || jr(e) ? !1 : (q.value && Y(!1), n !== ue(r, I.value.get(e, t), T.valueSettings) && I.value.setCell(e, t, Lr(r, n)), !0);
2266
+ }
2267
+ function _o(e) {
2268
+ let t = B.range;
2269
+ if (!t || T.readonly) return 0;
2270
+ Y(!1);
2271
+ let n = I.value, r = 0;
2272
+ return n.transact(() => {
2273
+ for (let i = t.top; i <= t.bottom; i++) {
2274
+ let a = Q.value.rowIdAt(i);
2275
+ if (!(a === void 0 || jr(a))) for (let i = t.left; i <= t.right; i++) {
2276
+ let t = R.value[i];
2277
+ if (!Ln(t) || t.formula) continue;
2278
+ let o = ae(t, n.get(a, t.key), e, T.valueSettings);
2279
+ o !== null && (n.setCell(a, t.key, o), r++);
2280
+ }
2281
+ }
2282
+ }, { origin: "adjust" }), r;
2283
+ }
2284
+ function vo() {
2285
+ let e = B.range;
2286
+ if (!e || T.readonly) return 0;
2287
+ Y(!1);
2288
+ let t = [];
2289
+ for (let n = e.top; n <= e.bottom; n++) {
2290
+ let e = Q.value.rowIdAt(n), r = e !== void 0 && jr(e) && Da.value?.resultOf(e)?.outcome !== "succeeded";
2291
+ e !== void 0 && !r && t.push(e);
2292
+ }
2293
+ return t.length > 0 && (I.value.transact(() => I.value.removeRows(t), { origin: "remove" }), B.moveTo(e.top, B.active?.col ?? 0)), t.length;
2294
+ }
2295
+ function yo(e) {
2296
+ let t = B.range;
2297
+ if (!t || T.readonly) return [];
2298
+ Y(!1);
2299
+ let n = I.value, r = Q.value.rowIdAt(e === "above" ? t.top : t.bottom), i = r === void 0 ? n.size : n.indexOf(r) + +(e === "below"), a = [];
2300
+ n.transact(() => {
2301
+ a = n.insertRows(i, Ae(L.value, t.bottom - t.top + 1));
2302
+ }, { origin: "insert" });
2303
+ let o = Q.value.indexOf(a[0] ?? ""), s = Q.value.indexOf(a[a.length - 1] ?? "");
2304
+ return o >= 0 && (B.selectRows(o, Math.max(o, s)), ir()), a;
2305
+ }
2306
+ let bo = y(null), xo = g(null), So = g(!1), Co = null, wo = typeof navigator < "u" && /Mac|iPhone|iPad/.test(navigator.platform);
2307
+ function To(e) {
2308
+ return wo ? `⌘${e}` : `Ctrl+${e}`;
2309
+ }
2310
+ let Eo = t(() => {
2311
+ let e = bo.value, t = H[T.locale], n = T.readonly;
2312
+ if (!e) return [];
2313
+ let r = [
2314
+ {
2315
+ key: "tabula:cut",
2316
+ label: t.cut ?? "",
2317
+ shortcut: To("X"),
2318
+ disabled: n
2319
+ },
2320
+ {
2321
+ key: "tabula:copy",
2322
+ label: t.copy ?? "",
2323
+ shortcut: To("C")
2324
+ },
2325
+ {
2326
+ key: "tabula:paste",
2327
+ label: t.paste ?? "",
2328
+ shortcut: To("V"),
2329
+ disabled: n || typeof navigator > "u" || !navigator.clipboard?.readText
2330
+ },
2331
+ null
2332
+ ];
2333
+ return e.kind === "cell" && r.push({
2334
+ key: "tabula:clear",
2335
+ label: t.clearCells ?? "",
2336
+ shortcut: "Delete",
2337
+ disabled: n
2338
+ }, {
2339
+ key: "tabula:fillDown",
2340
+ label: t.fillDown ?? "",
2341
+ shortcut: To("D"),
2342
+ disabled: n
2343
+ }, {
2344
+ key: "tabula:fillRight",
2345
+ label: t.fillRight ?? "",
2346
+ shortcut: To("R"),
2347
+ disabled: n
2348
+ }, null), r.push({
2349
+ key: "tabula:insertAbove",
2350
+ label: t.insertAbove ?? "",
2351
+ shortcut: To("+"),
2352
+ disabled: n
2353
+ }, {
2354
+ key: "tabula:insertBelow",
2355
+ label: t.insertBelow ?? "",
2356
+ disabled: n
2357
+ }, {
2358
+ key: "tabula:removeRows",
2359
+ label: t.removeRows ?? "",
2360
+ shortcut: To("−"),
2361
+ disabled: n
2362
+ }), T.menuItems.length > 0 && r.push(null, ...T.menuItems), e.kind === "cell" && r.push(null, {
2363
+ key: "tabula:filterValue",
2364
+ label: t.filterValue ?? ""
2365
+ }, {
2366
+ key: "tabula:sortAsc",
2367
+ label: t.sortAsc ?? ""
2368
+ }, {
2369
+ key: "tabula:sortDesc",
2370
+ label: t.sortDesc ?? ""
2371
+ }), r;
2372
+ });
2373
+ function Do(e) {
2374
+ let t = e.target instanceof Element ? e.target : null;
2375
+ if (q.value || t?.closest(".tabula-grid-filter") || (e.preventDefault(), t?.closest(".tabula-grid-menu"))) return;
2376
+ if (t === We.value || e.clientX === 0 && e.clientY === 0) {
2377
+ Oo(null);
2378
+ return;
2379
+ }
2380
+ let n = t?.closest(".tabula-grid-th");
2381
+ if (n) {
2382
+ let t = Number(n.getAttribute("aria-colindex")) - 1;
2383
+ t >= 0 && Na(t, e.clientX, e.clientY);
2384
+ return;
2385
+ }
2386
+ if (sa(e), t?.closest(".tabula-grid-rh")) {
2387
+ let t = ua(e.clientY), n = B.range;
2388
+ n && n.left === 0 && n.right >= R.value.length - 1 && t >= n.top && t <= n.bottom || B.selectRows(t), Oo({
2389
+ kind: "row",
2390
+ x: e.clientX,
2391
+ y: e.clientY
2392
+ });
2393
+ return;
2394
+ }
2395
+ let r = oa(e);
2396
+ r && !Ur(r.row, r.col) && B.moveTo(r.row, r.col), Oo({
2397
+ kind: "cell",
2398
+ x: e.clientX,
2399
+ y: e.clientY
2400
+ });
2401
+ }
2402
+ function Oo(e) {
2403
+ let t = ze.value, n = B.active;
2404
+ if (!t || !n) return;
2405
+ Y(!1), Pa(), ko();
2406
+ let r = e;
2407
+ if (!r) {
2408
+ let e = t.querySelector(".tabula-grid-active")?.getBoundingClientRect();
2409
+ r = {
2410
+ kind: "cell",
2411
+ x: e?.left ?? 0,
2412
+ y: e?.bottom ?? 0
2413
+ };
2414
+ }
2415
+ let i = r.kind === "cell" ? Er(n.row, n.col) : [];
2416
+ bo.value = {
2417
+ kind: r.kind,
2418
+ left: r.x,
2419
+ top: r.y,
2420
+ issues: i.map((e) => He(e, T.locale, T.valueSettings))
2421
+ };
2422
+ let a = (e) => {
2423
+ let n = t.querySelector(".tabula-grid-context");
2424
+ e.target instanceof Node && n?.contains(e.target) || ko();
2425
+ };
2426
+ window.addEventListener("mousedown", a, !0), Co = () => window.removeEventListener("mousedown", a, !0), u(() => {
2427
+ let e = t.querySelector(".tabula-grid-context"), n = bo.value;
2428
+ if (!e || !n) return;
2429
+ let r = e.offsetWidth, i = e.offsetHeight, a = Math.max(8, Math.min(n.left, window.innerWidth - r - 8)), o = Math.max(8, Math.min(n.top, window.innerHeight - i - 8));
2430
+ (a !== n.left || o !== n.top) && (bo.value = {
2431
+ ...n,
2432
+ left: a,
2433
+ top: o
2434
+ }), e.querySelector("button:not(:disabled)")?.focus();
2435
+ });
2436
+ }
2437
+ function ko(e = !1) {
2438
+ Co?.(), Co = null, bo.value = null, xo.value = null, So.value = !1, e && ni();
2439
+ }
2440
+ function Ao(e) {
2441
+ if (e.disabled) return;
2442
+ if (e.children && e.children.length > 0) {
2443
+ xo.value = xo.value === e.key ? null : e.key;
2444
+ return;
2445
+ }
2446
+ if (e.key === "tabula:paste") {
2447
+ jo();
2448
+ return;
2449
+ }
2450
+ ko(!0);
2451
+ let t = B.range, n = B.active, r = n ? R.value[n.col] : void 0, i = n ? Q.value.rowIdAt(n.row) : void 0;
2452
+ switch (e.key) {
2453
+ case "tabula:copy":
2454
+ case "tabula:cut":
2455
+ t && (navigator.clipboard?.writeText(zi(t)).catch(() => void 0), e.key === "tabula:cut" && Wi("cut"));
2456
+ break;
2457
+ case "tabula:clear":
2458
+ Wi("clear");
2459
+ break;
2460
+ case "tabula:fillDown":
2461
+ na("down");
2462
+ break;
2463
+ case "tabula:fillRight":
2464
+ na("right");
2465
+ break;
2466
+ case "tabula:insertAbove":
2467
+ yo("above");
2468
+ break;
2469
+ case "tabula:insertBelow":
2470
+ yo("below");
2471
+ break;
2472
+ case "tabula:removeRows":
2473
+ vo();
2474
+ break;
2475
+ case "tabula:filterValue":
2476
+ r && i !== void 0 && no(r.key, {
2477
+ kind: "values",
2478
+ keys: fe(r, I.value.get(i, r.key))
2479
+ });
2480
+ break;
2481
+ case "tabula:sortAsc":
2482
+ case "tabula:sortDesc":
2483
+ r && (be.value = Object.freeze({
2484
+ key: r.key,
2485
+ direction: e.key === "tabula:sortAsc" ? "asc" : "desc"
2486
+ }));
2487
+ break;
2488
+ default: k("menu", e.key);
2489
+ }
2490
+ }
2491
+ async function jo() {
2492
+ try {
2493
+ let e = await navigator.clipboard.readText();
2494
+ ko(!0), Ui(e);
2495
+ } catch {
2496
+ So.value = !0;
2497
+ }
2498
+ }
2499
+ function Mo(e) {
2500
+ let t = ze.value?.querySelector(".tabula-grid-context"), n = document.activeElement, r = !!n?.closest(".tabula-grid-submenu"), i = [...(r ? n?.closest(".tabula-grid-submenu") : t)?.querySelectorAll(r ? "button:not(:disabled)" : ":scope > button:not(:disabled), :scope > .tabula-grid-menu-item > button:not(:disabled)") ?? []], a = i.indexOf(n);
2501
+ if (e.key === "ArrowDown" || e.key === "ArrowUp") i[(a + (e.key === "ArrowDown" ? 1 : -1) + i.length) % i.length]?.focus();
2502
+ else if (e.key === "ArrowRight" && !r && n?.dataset.key) {
2503
+ let e = Eo.value.find((e) => e?.key === n.dataset.key);
2504
+ e?.children?.length && (xo.value = e.key, u(() => t?.querySelector(".tabula-grid-submenu button:not(:disabled)")?.focus()));
2505
+ } else if ((e.key === "ArrowLeft" || e.key === "Escape") && r) {
2506
+ let e = xo.value;
2507
+ xo.value = null, u(() => t?.querySelector(`button[data-key="${e}"]`)?.focus());
2508
+ } else if (e.key === "Escape" || e.key === "Tab") ko(!0);
2509
+ else return;
2510
+ e.preventDefault();
2511
+ }
2512
+ function No() {
2513
+ let e = B.active, t = Be.value;
2514
+ return Object.freeze({
2515
+ rowId: e ? Q.value.rowIdAt(e.row) ?? null : null,
2516
+ field: e ? R.value[e.col]?.key ?? null : null,
2517
+ top: t?.scrollTop ?? 0,
2518
+ left: t?.scrollLeft ?? 0
2519
+ });
2520
+ }
2521
+ function Po(e) {
2522
+ let t = e.rowId === null ? -1 : Q.value.indexOf(e.rowId), n = e.field === null ? -1 : R.value.findIndex((t) => t.key === e.field);
2523
+ t >= 0 && n >= 0 && B.moveTo(t, n);
2524
+ let r = Be.value;
2525
+ r && (r.scrollTop = e.top, r.scrollLeft = e.left, rr());
2526
+ }
2527
+ function Fo(e, t) {
2528
+ let n = R.value.findIndex((e) => e.key === t), r = I.value.indexOf(e);
2529
+ return n < 0 || r < 0 ? null : `${je(n)}${r + 1}`;
2530
+ }
2531
+ let Io = t(() => (V.value, va.value, Object.freeze({
2532
+ shown: Q.value.size,
2533
+ total: I.value.size
2534
+ }))), Lo = t(() => (wa.value, Ca.value.summary()));
2535
+ function Ro(e, t) {
2536
+ return F(e, t, T.valueSettings);
2537
+ }
2538
+ return l({
2539
+ selection: B,
2540
+ cell: uo,
2541
+ selected: mo,
2542
+ rows: Io,
2543
+ issueSummary: Lo,
2544
+ formatValue: Ro,
2545
+ goTo: so,
2546
+ goToAddress: ho,
2547
+ writeCell: go,
2548
+ adjustSelection: _o,
2549
+ removeRows: vo,
2550
+ insertRows: yo,
2551
+ addressOf: Fo,
2552
+ position: No,
2553
+ restorePosition: Po,
2554
+ focus: ni,
2555
+ autoFit: Un,
2556
+ selectedCells: gr,
2557
+ selectedFields: _r,
2558
+ markSelection: vr,
2559
+ toggleSelection: yr,
2560
+ clearSelectionMarks: br,
2561
+ canEdit: xr,
2562
+ showCell: (e, t) => co(e, t ?? null, !0, !1),
2563
+ shownFields: () => R.value.map((e) => e.key),
2564
+ undo: () => (ni(), Li("undo")),
2565
+ redo: () => (ni(), Li("redo"))
2566
+ }), (t, l) => (h(), i("div", {
2567
+ ref_key: "root",
2568
+ ref: ze,
2569
+ class: d(["tabula-grid tabula-theme", {
2570
+ "is-filtered": ya.value,
2571
+ "is-scrolled-x": er.value > 0,
2572
+ "is-filling": Ki.value,
2573
+ "has-letters": c.columnLetters
2574
+ }]),
2575
+ role: "grid",
2576
+ tabindex: K.value ? -1 : 0,
2577
+ "data-tabula-theme": c.theme,
2578
+ style: f({
2579
+ "--tabula-row-height": `${U.value}px`,
2580
+ "--tabula-zoom": c.zoom
2581
+ }),
2582
+ "aria-rowcount": Le.value + 1,
2583
+ "aria-colcount": R.value.length,
2584
+ "aria-readonly": c.readonly || void 0,
2585
+ "aria-multiselectable": "true",
2586
+ "aria-activedescendant": Br.value,
2587
+ onFocus: ri,
2588
+ onCopy: Bi,
2589
+ onCut: Vi,
2590
+ onPaste: Hi,
2591
+ onContextmenu: Do
2592
+ }, [
2593
+ a("div", {
2594
+ ref_key: "scroller",
2595
+ ref: Be,
2596
+ class: "tabula-grid-scroller tabula-scroll",
2597
+ onScrollPassive: rr
2598
+ }, [a("div", {
2599
+ class: "tabula-grid-sheet",
2600
+ style: f({
2601
+ width: `${G.value + An.value + xn}px`,
2602
+ height: `${Pn.value + Mn.value + xn}px`
2603
+ })
2604
+ }, [
2605
+ a("div", {
2606
+ class: "tabula-grid-head",
2607
+ role: "row",
2608
+ "aria-rowindex": "1",
2609
+ style: f({
2610
+ width: `${G.value + An.value}px`,
2611
+ height: `${Pn.value}px`
2612
+ })
2613
+ }, [
2614
+ a("div", {
2615
+ class: "tabula-grid-corner",
2616
+ style: f({ width: `${G.value}px` }),
2617
+ onMousedown: pa
2618
+ }, null, 36),
2619
+ z.value > 0 ? (h(), i("div", {
2620
+ key: 0,
2621
+ class: "tabula-grid-head-pinned",
2622
+ style: f({
2623
+ left: `${G.value}px`,
2624
+ width: `${jn.value}px`
2625
+ })
2626
+ }, [(h(!0), i(e, null, _($n.value, (e) => (h(), i("div", {
2627
+ key: e,
2628
+ class: d(["tabula-grid-th is-pinned", [{
2629
+ "is-right": In.value[e]?.includes("is-right"),
2630
+ "is-center": In.value[e]?.includes("is-center"),
2631
+ "is-selected": Gr(e)
2632
+ }, po(null, e)]]),
2633
+ role: "columnheader",
2634
+ "aria-colindex": e + 1,
2635
+ "aria-sort": za(e),
2636
+ style: f(Bn(e)),
2637
+ title: Rn(e),
2638
+ onMousedown: (t) => da(t, e)
2639
+ }, [
2640
+ c.columnLetters ? (h(), i("span", {
2641
+ key: 0,
2642
+ class: "tabula-grid-th-letter",
2643
+ "aria-hidden": "true",
2644
+ textContent: b(S(je)(e))
2645
+ }, null, 8, nt)) : r("", !0),
2646
+ R.value[e]?.formula ? (h(), i("span", rt, "ƒx")) : r("", !0),
2647
+ a("span", it, b(zn(e)), 1),
2648
+ R.value[e]?.required ? (h(), i("span", at, "*")) : r("", !0),
2649
+ La(e) ? (h(), i("span", ot, b(La(e) === "asc" ? "↑" : "↓"), 1)) : r("", !0),
2650
+ Ra(e) ? (h(), i("svg", {
2651
+ key: 4,
2652
+ class: "tabula-grid-filtered",
2653
+ viewBox: "0 0 24 24",
2654
+ role: "img",
2655
+ "aria-label": S(H)[c.locale].filtered
2656
+ }, [...l[18] ||= [a("path", { d: "M3 5h18l-7 8v6l-4 2v-8Z" }, null, -1)]], 8, st)) : r("", !0),
2657
+ a("button", {
2658
+ type: "button",
2659
+ class: "tabula-grid-th-menu",
2660
+ tabindex: "-1",
2661
+ "aria-label": S(H)[c.locale].columnMenu,
2662
+ onMousedown: A((t) => Ma(t, e), ["stop", "prevent"])
2663
+ }, " ⋯ ", 40, ct),
2664
+ Ye.value[e]?.resizable ? (h(), i("span", {
2665
+ key: 5,
2666
+ class: "tabula-grid-resize",
2667
+ "aria-hidden": "true",
2668
+ onMousedown: A((t) => ma(t, e), ["stop"]),
2669
+ onDblclick: A((t) => Un(e), ["stop"])
2670
+ }, null, 40, lt)) : r("", !0)
2671
+ ], 46, tt))), 128))], 4)) : r("", !0),
2672
+ (h(!0), i(e, null, _(Qn.value, (e) => (h(), i("div", {
2673
+ key: e % Xn.value,
2674
+ class: d(["tabula-grid-th", [{
2675
+ "is-right": In.value[e]?.includes("is-right"),
2676
+ "is-center": In.value[e]?.includes("is-center"),
2677
+ "is-selected": Gr(e)
2678
+ }, po(null, e)]]),
2679
+ role: "columnheader",
2680
+ "aria-colindex": e + 1,
2681
+ "aria-sort": za(e),
2682
+ style: f(Bn(e)),
2683
+ title: Rn(e),
2684
+ onMousedown: (t) => da(t, e)
2685
+ }, [
2686
+ c.columnLetters ? (h(), i("span", {
2687
+ key: 0,
2688
+ class: "tabula-grid-th-letter",
2689
+ "aria-hidden": "true",
2690
+ textContent: b(S(je)(e))
2691
+ }, null, 8, dt)) : r("", !0),
2692
+ R.value[e]?.formula ? (h(), i("span", ft, "ƒx")) : r("", !0),
2693
+ a("span", pt, b(zn(e)), 1),
2694
+ R.value[e]?.required ? (h(), i("span", mt, "*")) : r("", !0),
2695
+ La(e) ? (h(), i("span", ht, b(La(e) === "asc" ? "↑" : "↓"), 1)) : r("", !0),
2696
+ Ra(e) ? (h(), i("svg", {
2697
+ key: 4,
2698
+ class: "tabula-grid-filtered",
2699
+ viewBox: "0 0 24 24",
2700
+ role: "img",
2701
+ "aria-label": S(H)[c.locale].filtered
2702
+ }, [...l[19] ||= [a("path", { d: "M3 5h18l-7 8v6l-4 2v-8Z" }, null, -1)]], 8, gt)) : r("", !0),
2703
+ a("button", {
2704
+ type: "button",
2705
+ class: "tabula-grid-th-menu",
2706
+ tabindex: "-1",
2707
+ "aria-label": S(H)[c.locale].columnMenu,
2708
+ onMousedown: A((t) => Ma(t, e), ["stop", "prevent"])
2709
+ }, " ⋯ ", 40, _t),
2710
+ Ye.value[e]?.resizable ? (h(), i("span", {
2711
+ key: 5,
2712
+ class: "tabula-grid-resize",
2713
+ "aria-hidden": "true",
2714
+ onMousedown: A((t) => ma(t, e), ["stop"]),
2715
+ onDblclick: A((t) => Un(e), ["stop"])
2716
+ }, null, 40, vt)) : r("", !0)
2717
+ ], 46, ut))), 128))
2718
+ ], 4),
2719
+ a("div", {
2720
+ ref_key: "gutter",
2721
+ ref: Ve,
2722
+ class: "tabula-grid-gutter",
2723
+ "aria-hidden": "true",
2724
+ style: f({
2725
+ width: `${G.value}px`,
2726
+ height: `${Mn.value}px`
2727
+ })
2728
+ }, [(h(!0), i(e, null, _(Zn.value, (e) => (h(), i("div", {
2729
+ key: e % Yn.value,
2730
+ class: d(["tabula-grid-rh", [{ "is-selected": Wr(e) }, Pr(e)]]),
2731
+ title: Ir(e),
2732
+ style: f({ transform: `translateY(${e * U.value}px)` }),
2733
+ onMousedown: (t) => fa(t, e)
2734
+ }, [o(b(ba(e)) + " ", 1), Fr(e) ? (h(), i("span", {
2735
+ key: 0,
2736
+ class: d(["tabula-grid-rh-mark", Fr(e)])
2737
+ }, null, 2)) : r("", !0)], 46, yt))), 128))], 4),
2738
+ a("div", {
2739
+ ref_key: "body",
2740
+ ref: Ue,
2741
+ class: "tabula-grid-body",
2742
+ "data-version": V.value,
2743
+ style: f({
2744
+ top: `${Pn.value}px`,
2745
+ left: `${G.value}px`,
2746
+ width: `${An.value}px`,
2747
+ height: `${Mn.value}px`
2748
+ }),
2749
+ onMousedown: ca,
2750
+ onDblclick: l[2] ||= (e) => ai()
2751
+ }, [
2752
+ z.value > 0 ? (h(), i("div", {
2753
+ key: 0,
2754
+ class: "tabula-grid-pinned",
2755
+ style: f({
2756
+ left: `${G.value}px`,
2757
+ width: `${jn.value}px`,
2758
+ height: `${Mn.value}px`
2759
+ })
2760
+ }, [
2761
+ (h(!0), i(e, null, _(Zn.value, (t) => (h(), i("div", {
2762
+ key: t % Yn.value,
2763
+ class: d(["tabula-grid-row", { "is-locked": Mr(t) }]),
2764
+ role: "presentation",
2765
+ "data-row": t,
2766
+ style: f({ transform: `translateY(${t * U.value}px)` })
2767
+ }, [(h(!0), i(e, null, _($n.value, (e) => (h(), i("div", {
2768
+ id: `${S(Re)}-${t}-${e}`,
2769
+ key: e,
2770
+ class: d(["tabula-grid-cell", [
2771
+ In.value[e],
2772
+ Or(t, e),
2773
+ cr(t, e),
2774
+ Tr(t, e),
2775
+ po(t, e),
2776
+ pr(t, e),
2777
+ hr(t, e)
2778
+ ]]),
2779
+ role: "gridcell",
2780
+ "aria-colindex": e + 1,
2781
+ "aria-selected": Ur(t, e),
2782
+ "aria-readonly": !Ln(R.value[e]) || Mr(t) || void 0,
2783
+ "aria-invalid": Or(t, e) === "is-error" ? "true" : void 0,
2784
+ style: f(Nn.value[e]),
2785
+ title: Ar(t, e)
2786
+ }, b(ar(t, e)), 15, St))), 128))], 14, xt))), 128)),
2787
+ Jr.value.pinned ? (h(), i("div", {
2788
+ key: 0,
2789
+ class: "tabula-grid-range",
2790
+ style: f(Jr.value.pinned)
2791
+ }, null, 4)) : r("", !0),
2792
+ K.value && Zr.value ? (h(), i("div", {
2793
+ key: 1,
2794
+ class: "tabula-grid-active",
2795
+ style: f(Qr.value)
2796
+ }, null, 4)) : r("", !0),
2797
+ Xr.value?.pinned ? (h(), i("div", {
2798
+ key: 2,
2799
+ class: "tabula-grid-fill-preview",
2800
+ style: f(Xr.value.pinned)
2801
+ }, null, 4)) : r("", !0),
2802
+ Yr.value?.pinned ? (h(), i("div", {
2803
+ key: 3,
2804
+ class: "tabula-grid-fill",
2805
+ style: f(Yr.value.style),
2806
+ title: S(H)[c.locale].fillHandle,
2807
+ "aria-hidden": "true",
2808
+ onMousedown: A(ea, ["stop"]),
2809
+ onDblclick: A(ta, ["stop"])
2810
+ }, null, 44, Ct)) : r("", !0)
2811
+ ], 4)) : r("", !0),
2812
+ (h(!0), i(e, null, _(Zn.value, (t) => (h(), i("div", {
2813
+ key: t % Yn.value,
2814
+ class: d(["tabula-grid-row", { "is-locked": Mr(t) }]),
2815
+ role: "row",
2816
+ "aria-rowindex": t + 2,
2817
+ "data-row": t,
2818
+ "aria-owns": z.value > 0 ? $n.value.map((e) => `${S(Re)}-${t}-${e}`).join(" ") : void 0,
2819
+ style: f({ transform: `translateY(${t * U.value}px)` })
2820
+ }, [(h(!0), i(e, null, _(Qn.value, (e) => (h(), i("div", {
2821
+ id: Hr(t, e) ? Br.value : void 0,
2822
+ key: e % Xn.value,
2823
+ class: d(["tabula-grid-cell", [
2824
+ In.value[e],
2825
+ Or(t, e),
2826
+ cr(t, e),
2827
+ Tr(t, e),
2828
+ po(t, e),
2829
+ pr(t, e),
2830
+ hr(t, e)
2831
+ ]]),
2832
+ role: "gridcell",
2833
+ "aria-colindex": e + 1,
2834
+ "aria-selected": Ur(t, e),
2835
+ "aria-readonly": !Ln(R.value[e]) || Mr(t) || void 0,
2836
+ "aria-invalid": Or(t, e) === "is-error" ? "true" : void 0,
2837
+ style: f(Nn.value[e]),
2838
+ title: Ar(t, e)
2839
+ }, b(ar(t, e)), 15, Tt))), 128))], 14, wt))), 128)),
2840
+ Jr.value.free ? (h(), i("div", {
2841
+ key: 1,
2842
+ class: "tabula-grid-range",
2843
+ style: f(Jr.value.free)
2844
+ }, null, 4)) : r("", !0),
2845
+ K.value && !Zr.value ? (h(), i("div", {
2846
+ key: 2,
2847
+ class: "tabula-grid-active",
2848
+ style: f(Qr.value)
2849
+ }, null, 4)) : r("", !0),
2850
+ Xr.value?.free ? (h(), i("div", {
2851
+ key: 3,
2852
+ class: "tabula-grid-fill-preview",
2853
+ style: f(Xr.value.free)
2854
+ }, null, 4)) : r("", !0),
2855
+ Yr.value && !Yr.value.pinned ? (h(), i("div", {
2856
+ key: 4,
2857
+ class: "tabula-grid-fill",
2858
+ style: f(Yr.value.style),
2859
+ title: S(H)[c.locale].fillHandle,
2860
+ "aria-hidden": "true",
2861
+ onMousedown: A(ea, ["stop"]),
2862
+ onDblclick: A(ta, ["stop"])
2863
+ }, null, 44, Et)) : r("", !0),
2864
+ K.value ? ee((h(), i("input", {
2865
+ key: 5,
2866
+ ref_key: "editor",
2867
+ ref: We,
2868
+ "onUpdate:modelValue": l[0] ||= (e) => J.value = e,
2869
+ class: d(["tabula-grid-input", q.value ? ["is-editing", In.value[q.value.col]] : void 0]),
2870
+ style: f(q.value ? ti.value : $r.value),
2871
+ "aria-label": Vr.value,
2872
+ role: vi.value ? "combobox" : void 0,
2873
+ "aria-autocomplete": vi.value ? "list" : void 0,
2874
+ "aria-expanded": vi.value ? _i.value : void 0,
2875
+ "aria-controls": vi.value ? mi : void 0,
2876
+ "aria-activedescendant": _i.value && X.value >= 0 ? `${mi}-${X.value}` : void 0,
2877
+ placeholder: Z.value ? `${Z.value.size} ${S(H)[c.locale].picked}` : void 0,
2878
+ autocomplete: "off",
2879
+ spellcheck: "false",
2880
+ onKeydown: ci,
2881
+ onInput: oi,
2882
+ onCompositionstart: si,
2883
+ onBlur: li,
2884
+ onMousedown: l[1] ||= A(() => {}, ["stop"])
2885
+ }, null, 46, Dt)), [[D, J.value]]) : r("", !0)
2886
+ ], 44, bt)
2887
+ ], 4)], 544),
2888
+ s(Pe, {
2889
+ target: Be.value,
2890
+ "inset-top": Pn.value,
2891
+ "inset-left": G.value + jn.value
2892
+ }, null, 8, [
2893
+ "target",
2894
+ "inset-top",
2895
+ "inset-left"
2896
+ ]),
2897
+ Cr.value ? (h(), i("div", {
2898
+ key: 0,
2899
+ class: "tabula-grid-totals",
2900
+ role: "row",
2901
+ style: f({ height: `${U.value}px` })
2902
+ }, [(h(!0), i(e, null, _([...$n.value, ...Qn.value.filter((e) => e >= z.value)], (t) => (h(), i(e, { key: t }, [Cr.value[t] === null ? r("", !0) : (h(), i("div", {
2903
+ key: 0,
2904
+ class: d(["tabula-grid-totals-cell", { "is-pinned": t < z.value }]),
2905
+ role: "gridcell",
2906
+ style: f(wr(t))
2907
+ }, b(Cr.value[t]), 7))], 64))), 128)), a("label", {
2908
+ class: "tabula-grid-totals-kind",
2909
+ style: f({ width: `${G.value + (Cr.value[0] === null ? On.value[0] ?? 0 : 0)}px` })
2910
+ }, [a("span", Ot, b(S(H)[c.locale].totals), 1), ee(a("select", { "onUpdate:modelValue": l[3] ||= (e) => Sr.value = e }, [
2911
+ a("option", kt, b(S(H)[c.locale].totalSum), 1),
2912
+ a("option", At, b(S(H)[c.locale].totalAverage), 1),
2913
+ a("option", jt, b(S(H)[c.locale].totalMin), 1),
2914
+ a("option", Mt, b(S(H)[c.locale].totalMax), 1)
2915
+ ], 512), [[E, Sr.value]])], 4)], 4)) : r("", !0),
2916
+ _i.value ? (h(), i("ul", {
2917
+ key: 1,
2918
+ id: mi,
2919
+ ref_key: "suggestionList",
2920
+ ref: Ke,
2921
+ class: d(["tabula-grid-list tabula-scroll", { "is-multiple": Z.value }]),
2922
+ role: "listbox",
2923
+ "aria-multiselectable": Z.value ? "true" : void 0,
2924
+ style: f(pi.value ? {
2925
+ left: `${pi.value.left}px`,
2926
+ top: `${pi.value.top}px`,
2927
+ minWidth: `${pi.value.width}px`
2928
+ } : { visibility: "hidden" })
2929
+ }, [
2930
+ (h(!0), i(e, null, _(di.value, (e, t) => (h(), i("li", {
2931
+ id: `${mi}-${t}`,
2932
+ key: e.key,
2933
+ class: d(["tabula-grid-option", {
2934
+ "is-highlighted": t === X.value,
2935
+ "is-disabled": e.disabled,
2936
+ "is-picked": Z.value?.has(e.key)
2937
+ }]),
2938
+ role: "option",
2939
+ "aria-selected": Z.value ? Z.value.has(e.key) : t === X.value,
2940
+ "aria-disabled": e.disabled || void 0,
2941
+ onMousedown: A((e) => Di(t), ["prevent"]),
2942
+ onMousemove: (n) => e.disabled || (X.value = t)
2943
+ }, [
2944
+ Z.value ? (h(), i("span", Ft)) : r("", !0),
2945
+ a("span", It, b(e.label), 1),
2946
+ e.description ? (h(), i("span", Lt, b(e.description), 1)) : r("", !0)
2947
+ ], 42, Pt))), 128)),
2948
+ fi.value ? (h(), i("li", Rt, b(S(H)[c.locale][fi.value]), 1)) : r("", !0),
2949
+ Z.value ? (h(), i("li", zt, b(S(H)[c.locale].pickHint), 1)) : r("", !0)
2950
+ ], 14, Nt)) : r("", !0),
2951
+ _i.value ? (h(), n(Pe, {
2952
+ key: 2,
2953
+ target: Ke.value,
2954
+ layer: 5
2955
+ }, null, 8, ["target"])) : r("", !0),
2956
+ ka.value ? (h(), i("div", {
2957
+ key: 3,
2958
+ class: "tabula-grid-menu",
2959
+ role: "menu",
2960
+ "aria-label": S(H)[c.locale].columnMenu,
2961
+ style: f({
2962
+ left: `${ka.value.left}px`,
2963
+ top: `${ka.value.top}px`
2964
+ }),
2965
+ onKeydown: Ia
2966
+ }, [
2967
+ a("button", {
2968
+ type: "button",
2969
+ role: "menuitem",
2970
+ class: "tabula-grid-menu-sort-asc",
2971
+ onClick: l[4] ||= (e) => Fa("sortAsc")
2972
+ }, b(S(H)[c.locale].sortAsc), 1),
2973
+ a("button", {
2974
+ type: "button",
2975
+ role: "menuitem",
2976
+ class: "tabula-grid-menu-sort-desc",
2977
+ onClick: l[5] ||= (e) => Fa("sortDesc")
2978
+ }, b(S(H)[c.locale].sortDesc), 1),
2979
+ La(ka.value.col) ? (h(), i("button", {
2980
+ key: 0,
2981
+ type: "button",
2982
+ role: "menuitem",
2983
+ class: "tabula-grid-menu-sort-clear",
2984
+ onClick: l[6] ||= (e) => Fa("sortClear")
2985
+ }, b(S(H)[c.locale].sortClear), 1)) : r("", !0),
2986
+ l[20] ||= a("span", {
2987
+ class: "tabula-grid-menu-line",
2988
+ role: "separator"
2989
+ }, null, -1),
2990
+ a("button", {
2991
+ type: "button",
2992
+ role: "menuitem",
2993
+ class: "tabula-grid-menu-filter",
2994
+ onClick: l[7] ||= (e) => Fa("filter")
2995
+ }, b(S(H)[c.locale].filter), 1),
2996
+ Ra(ka.value.col) ? (h(), i("button", {
2997
+ key: 1,
2998
+ type: "button",
2999
+ role: "menuitem",
3000
+ class: "tabula-grid-menu-filter-clear",
3001
+ onClick: l[8] ||= (e) => Fa("filterClear")
3002
+ }, b(S(H)[c.locale].filterClear), 1)) : r("", !0),
3003
+ l[21] ||= a("span", {
3004
+ class: "tabula-grid-menu-line",
3005
+ role: "separator"
3006
+ }, null, -1),
3007
+ a("button", {
3008
+ type: "button",
3009
+ role: "menuitem",
3010
+ class: "tabula-grid-menu-pin",
3011
+ onClick: l[9] ||= (e) => Fa(ka.value.col < z.value ? "unpin" : "pin")
3012
+ }, b(ka.value.col < z.value ? S(H)[c.locale].unpin : S(H)[c.locale].pin), 1),
3013
+ a("button", {
3014
+ type: "button",
3015
+ role: "menuitem",
3016
+ class: "tabula-grid-menu-hide",
3017
+ disabled: R.value.length <= 1,
3018
+ onClick: l[10] ||= (e) => Fa("hide")
3019
+ }, b(S(H)[c.locale].hide), 9, Vt),
3020
+ ja.value > 0 ? (h(), i("button", {
3021
+ key: 2,
3022
+ type: "button",
3023
+ role: "menuitem",
3024
+ class: "tabula-grid-menu-show",
3025
+ onClick: l[11] ||= (e) => Fa("showHidden")
3026
+ }, b(S(H)[c.locale].showHidden) + " (" + b(ja.value) + ") ", 1)) : r("", !0)
3027
+ ], 44, Bt)) : r("", !0),
3028
+ bo.value ? (h(), i("div", {
3029
+ key: 4,
3030
+ class: "tabula-grid-menu tabula-grid-context",
3031
+ role: "menu",
3032
+ "aria-label": S(H)[c.locale].cellMenu,
3033
+ style: f({
3034
+ left: `${bo.value.left}px`,
3035
+ top: `${bo.value.top}px`
3036
+ }),
3037
+ onKeydown: Mo,
3038
+ onContextmenu: l[13] ||= A(() => {}, ["prevent"])
3039
+ }, [
3040
+ So.value ? (h(), i("p", {
3041
+ key: 0,
3042
+ class: "tabula-grid-menu-note is-hint",
3043
+ role: "status",
3044
+ textContent: b(S(H)[c.locale].pasteRefused)
3045
+ }, null, 8, Ut)) : r("", !0),
3046
+ bo.value.issues.length > 0 ? (h(), i(e, { key: 1 }, [(h(!0), i(e, null, _(bo.value.issues, (e, t) => (h(), i("p", {
3047
+ key: t,
3048
+ class: "tabula-grid-menu-note",
3049
+ textContent: b(e)
3050
+ }, null, 8, Wt))), 128)), l[22] ||= a("span", {
3051
+ class: "tabula-grid-menu-line",
3052
+ role: "separator"
3053
+ }, null, -1)], 64)) : r("", !0),
3054
+ (h(!0), i(e, null, _(Eo.value, (t, n) => (h(), i(e, { key: t?.key ?? `line-${n}` }, [t === null ? (h(), i("span", Gt)) : t.children?.length ? (h(), i("div", Kt, [a("button", {
3055
+ type: "button",
3056
+ role: "menuitem",
3057
+ "aria-haspopup": "menu",
3058
+ "aria-expanded": xo.value === t.key,
3059
+ "data-key": t.key,
3060
+ disabled: t.disabled,
3061
+ onClick: (e) => Ao(t),
3062
+ onMouseenter: (e) => xo.value = t.key
3063
+ }, [a("span", { textContent: b(t.label) }, null, 8, Jt), l[23] ||= a("span", {
3064
+ class: "tabula-grid-menu-key",
3065
+ "aria-hidden": "true"
3066
+ }, "▸", -1)], 40, qt), xo.value === t.key ? (h(), i("div", {
3067
+ key: 0,
3068
+ class: "tabula-grid-menu tabula-grid-submenu",
3069
+ role: "menu",
3070
+ "aria-label": t.label
3071
+ }, [(h(!0), i(e, null, _(t.children, (e) => (h(), i("button", {
3072
+ key: e.key,
3073
+ type: "button",
3074
+ role: "menuitem",
3075
+ disabled: e.disabled,
3076
+ onClick: (t) => Ao(e)
3077
+ }, [a("span", { textContent: b(e.label) }, null, 8, Zt), e.shortcut ? (h(), i("span", {
3078
+ key: 0,
3079
+ class: "tabula-grid-menu-key",
3080
+ textContent: b(e.shortcut)
3081
+ }, null, 8, Qt)) : r("", !0)], 8, Xt))), 128))], 8, Yt)) : r("", !0)])) : (h(), i("button", {
3082
+ key: 2,
3083
+ type: "button",
3084
+ role: "menuitem",
3085
+ "data-key": t.key,
3086
+ disabled: t.disabled,
3087
+ onClick: (e) => Ao(t),
3088
+ onMouseenter: l[12] ||= (e) => xo.value = null
3089
+ }, [a("span", { textContent: b(t.label) }, null, 8, en), t.shortcut ? (h(), i("span", {
3090
+ key: 0,
3091
+ class: "tabula-grid-menu-key",
3092
+ textContent: b(t.shortcut)
3093
+ }, null, 8, tn)) : r("", !0)], 40, $t))], 64))), 128))
3094
+ ], 44, Ht)) : r("", !0),
3095
+ $.value ? (h(), i("div", {
3096
+ key: 5,
3097
+ class: "tabula-grid-filter",
3098
+ role: "dialog",
3099
+ "aria-label": `${S(H)[c.locale].filterTitle}: ${$.value.field.label}`,
3100
+ style: f({
3101
+ left: `${$.value.left}px`,
3102
+ top: `${$.value.top}px`
3103
+ }),
3104
+ onKeydown: ao
3105
+ }, [
3106
+ a("strong", rn, b($.value.field.label), 1),
3107
+ $.value.range ? (h(), i("div", an, [a("label", null, [a("span", null, b(S(H)[c.locale].from), 1), ee(a("input", {
3108
+ "onUpdate:modelValue": l[14] ||= (e) => Ha.value = e,
3109
+ class: "tabula-grid-filter-from",
3110
+ type: "text",
3111
+ autocomplete: "off"
3112
+ }, null, 512), [[D, Ha.value]])]), a("label", null, [a("span", null, b(S(H)[c.locale].to), 1), ee(a("input", {
3113
+ "onUpdate:modelValue": l[15] ||= (e) => Ua.value = e,
3114
+ class: "tabula-grid-filter-to",
3115
+ type: "text",
3116
+ autocomplete: "off"
3117
+ }, null, 512), [[D, Ua.value]])])])) : r("", !0),
3118
+ Wa.value ? (h(), i("p", on, b(Wa.value), 1)) : r("", !0),
3119
+ ee(a("input", {
3120
+ "onUpdate:modelValue": l[16] ||= (e) => Ba.value = e,
3121
+ class: "tabula-grid-filter-search",
3122
+ type: "search",
3123
+ autocomplete: "off",
3124
+ placeholder: S(H)[c.locale].search,
3125
+ "aria-label": S(H)[c.locale].search
3126
+ }, null, 8, sn), [[D, Ba.value]]),
3127
+ a("label", cn, [a("input", {
3128
+ type: "checkbox",
3129
+ checked: Ja.value,
3130
+ indeterminate: Ya.value && !Ja.value,
3131
+ onChange: eo
3132
+ }, null, 40, ln), o(" " + b(S(H)[c.locale].selectAll), 1)]),
3133
+ a("ul", {
3134
+ ref_key: "filterList",
3135
+ ref: qe,
3136
+ class: "tabula-grid-filter-list tabula-scroll"
3137
+ }, [(h(!0), i(e, null, _(qa.value, (e) => (h(), i("li", { key: e.key }, [a("label", null, [
3138
+ a("input", {
3139
+ type: "checkbox",
3140
+ checked: Va.value.has(e.key),
3141
+ onChange: (t) => $a(e.key)
3142
+ }, null, 40, un),
3143
+ a("span", dn, b(Ka(e)), 1),
3144
+ a("span", fn, b(e.count), 1)
3145
+ ])]))), 128))], 512),
3146
+ s(Pe, { target: qe.value }, null, 8, ["target"]),
3147
+ $.value.more > 0 ? (h(), i("p", pn, " +" + b($.value.more) + " " + b(S(H)[c.locale].moreValues), 1)) : r("", !0),
3148
+ a("div", mn, [
3149
+ a("button", {
3150
+ type: "button",
3151
+ class: "tabula-grid-filter-apply",
3152
+ onClick: ro
3153
+ }, b(S(H)[c.locale].apply), 1),
3154
+ a("button", {
3155
+ type: "button",
3156
+ class: "tabula-grid-filter-clear",
3157
+ onClick: io
3158
+ }, b(S(H)[c.locale].clear), 1),
3159
+ a("button", {
3160
+ type: "button",
3161
+ class: "tabula-grid-filter-cancel",
3162
+ onClick: l[17] ||= (e) => Qa(!0)
3163
+ }, b(S(H)[c.locale].cancel), 1)
3164
+ ])
3165
+ ], 44, nn)) : r("", !0),
3166
+ a("div", {
3167
+ ref_key: "headerProbe",
3168
+ ref: Ge,
3169
+ class: "tabula-grid-th tabula-grid-probe",
3170
+ "aria-hidden": "true"
3171
+ }, null, 512),
3172
+ a("div", {
3173
+ ref_key: "cellProbe",
3174
+ ref: Je,
3175
+ class: "tabula-grid-cell tabula-grid-probe",
3176
+ "aria-hidden": "true"
3177
+ }, null, 512)
3178
+ ], 46, et));
3179
+ }
3180
+ }), U = ["data-tabula-theme", "aria-label"], On = ["aria-expanded", "aria-label"], kn = [
3181
+ "role",
3182
+ "aria-modal",
3183
+ "aria-label"
3184
+ ], W = {
3185
+ key: 0,
3186
+ class: "tabula-issues-handle",
3187
+ "aria-hidden": "true"
3188
+ }, An = { class: "tabula-issues-head" }, jn = { class: "tabula-issues-titles" }, Mn = { class: "tabula-issues-title" }, G = { class: "tabula-issues-nav" }, Nn = ["disabled"], Pn = ["disabled"], Fn = ["aria-label"], In = { class: "tabula-issues-counts" }, Ln = { class: "tabula-issues-count is-error" }, Rn = {
3189
+ key: 0,
3190
+ class: "tabula-issues-count is-warning"
3191
+ }, zn = {
3192
+ key: 1,
3193
+ class: "tabula-issues-count is-stale"
3194
+ }, Bn = { class: "tabula-issues-rows" }, Vn = {
3195
+ key: 0,
3196
+ class: "tabula-issues-filter"
3197
+ }, Hn = ["title"], Un = {
3198
+ key: 1,
3199
+ class: "tabula-issues-none"
3200
+ }, Wn = ["onClick"], Gn = { class: "tabula-issues-line" }, Kn = { class: "tabula-issues-where" }, qn = ["textContent"], Jn = { class: "tabula-issues-source" }, Yn = ["textContent"], Xn = { class: "tabula-issues-text" }, Zn = {
3201
+ key: 1,
3202
+ class: "tabula-issues-recheck"
3203
+ }, Qn = {
3204
+ key: 2,
3205
+ class: "tabula-issues-go",
3206
+ "aria-hidden": "true"
3207
+ }, $n = {
3208
+ key: 0,
3209
+ class: "tabula-issues-more"
3210
+ }, er = {
3211
+ key: 4,
3212
+ class: "tabula-issues-actions"
3213
+ }, tr = /* @__PURE__ */ c({
3214
+ __name: "TabulaIssues",
3215
+ props: /*@__PURE__*/ l({
3216
+ issues: {
3217
+ type: Object,
3218
+ required: !0
3219
+ },
3220
+ schema: {
3221
+ type: Object,
3222
+ required: !0
3223
+ },
3224
+ store: {
3225
+ type: Object,
3226
+ required: !0
3227
+ },
3228
+ locale: {
3229
+ type: String,
3230
+ default: "tr"
3231
+ },
3232
+ valueSettings: {
3233
+ type: Object,
3234
+ default: () => P.tr
3235
+ },
3236
+ theme: {
3237
+ type: String,
3238
+ default: "light"
3239
+ },
3240
+ limit: {
3241
+ type: Number,
3242
+ default: 500
3243
+ },
3244
+ variant: {
3245
+ type: String,
3246
+ default: "panel"
3247
+ },
3248
+ addressOf: {
3249
+ type: Function,
3250
+ default: void 0
3251
+ },
3252
+ nameField: {
3253
+ type: String,
3254
+ default: null
3255
+ },
3256
+ closable: {
3257
+ type: Boolean,
3258
+ default: !1
3259
+ }
3260
+ }, {
3261
+ onlyIssueRows: { type: Boolean },
3262
+ onlyIssueRowsModifiers: {},
3263
+ open: {
3264
+ type: Boolean,
3265
+ default: !1
3266
+ },
3267
+ openModifiers: {}
3268
+ }),
3269
+ emits: /*@__PURE__*/ l([
3270
+ "select",
3271
+ "refreshRows",
3272
+ "close"
3273
+ ], ["update:onlyIssueRows", "update:open"]),
3274
+ setup(s, { expose: c, emit: l }) {
3275
+ let u = s, f = l, p = w(s, "onlyIssueRows"), m = w(s, "open"), C = t(() => u.variant === "sheet");
3276
+ function E() {
3277
+ m.value = !1, f("close");
3278
+ }
3279
+ let D = y(0), k = y(null);
3280
+ O(() => x(u.issues), (e, t, n) => {
3281
+ D.value++, n(e.subscribe(() => D.value++));
3282
+ }, { immediate: !0 });
3283
+ let A = t(() => (D.value, x(u.issues).issues())), j = t(() => (D.value, x(u.issues).summary())), M = t(() => A.value.slice(0, u.limit)), N = t(() => Ie[u.locale]), te = g(null);
3284
+ function ne(e) {
3285
+ if (e.rowId === null) return N.value.sheet ?? "";
3286
+ let t = x(u.store), n = x(u.schema);
3287
+ return [`${N.value.row} ${t.indexOf(e.rowId) + 1}`, e.field !== null && n.has(e.field) ? n.field(e.field).label : ""].filter(Boolean).join(" · ");
3288
+ }
3289
+ function re(e) {
3290
+ return e.rowId !== null && e.field !== null && u.addressOf ? u.addressOf(e.rowId, e.field) : null;
3291
+ }
3292
+ function ie(e) {
3293
+ let t = x(u.schema);
3294
+ if (e.rowId === null || u.nameField === null || !t.has(u.nameField)) return "";
3295
+ let n = x(u.store).get(e.rowId, u.nameField);
3296
+ return F(t.field(u.nameField), n, u.valueSettings);
3297
+ }
3298
+ function P(e) {
3299
+ return [e.stale ? "is-stale" : `is-${e.severity}`, e.id === k.value ? "is-current" : ""];
3300
+ }
3301
+ function ae(e) {
3302
+ return e.source === "local" ? N.value.local ?? "" : N.value.server ?? "";
3303
+ }
3304
+ let oe = t(() => {
3305
+ let e = j.value, t = [
3306
+ e.errors > 0 ? `${e.errors} ${N.value.errors}` : "",
3307
+ e.warnings > 0 ? `${e.warnings} ${N.value.warnings}` : "",
3308
+ e.stale > 0 ? `${e.stale} ${N.value.stale}` : ""
3309
+ ].filter(Boolean);
3310
+ return t.length > 0 ? t.join(" · ") : N.value.none ?? "";
3311
+ }), se = t(() => {
3312
+ let e = j.value;
3313
+ return e.errors > 0 ? "is-error" : e.warnings > 0 ? "is-warning" : e.stale > 0 ? "is-stale" : "is-clear";
3314
+ });
3315
+ function ce(e) {
3316
+ k.value = e.id, m.value = !1, f("select", e);
3317
+ }
3318
+ function le(e) {
3319
+ let t = A.value;
3320
+ if (t.length === 0) return;
3321
+ let n = t.findIndex((e) => e.id === k.value), r = t[n < 0 ? e > 0 ? 0 : t.length - 1 : (n + e + t.length) % t.length];
3322
+ r && ce(r);
3323
+ }
3324
+ return c({
3325
+ next: () => le(1),
3326
+ previous: () => le(-1)
3327
+ }), (t, c) => (h(), i("section", {
3328
+ class: d(["tabula-issues tabula-theme", {
3329
+ "is-sheet": C.value,
3330
+ "is-open": C.value && m.value
3331
+ }]),
3332
+ "data-tabula-theme": s.theme,
3333
+ "aria-label": N.value.title
3334
+ }, [
3335
+ C.value ? (h(), i("button", {
3336
+ key: 0,
3337
+ type: "button",
3338
+ class: d(["tabula-issues-bar", se.value]),
3339
+ "aria-expanded": m.value,
3340
+ "aria-label": `${N.value.open}: ${oe.value}`,
3341
+ onClick: c[0] ||= (e) => m.value = !0
3342
+ }, [
3343
+ c[6] ||= a("span", {
3344
+ class: "tabula-issues-dot",
3345
+ "aria-hidden": "true"
3346
+ }, null, -1),
3347
+ a("span", null, b(oe.value), 1),
3348
+ c[7] ||= a("svg", {
3349
+ class: "tabula-issues-chevron",
3350
+ viewBox: "0 0 24 24",
3351
+ "aria-hidden": "true"
3352
+ }, [a("path", { d: "m6 15 6-6 6 6" })], -1)
3353
+ ], 10, On)) : r("", !0),
3354
+ C.value && m.value ? (h(), i("div", {
3355
+ key: 1,
3356
+ class: "tabula-issues-scrim",
3357
+ "aria-hidden": "true",
3358
+ onClick: c[1] ||= (e) => m.value = !1
3359
+ })) : r("", !0),
3360
+ !C.value || m.value ? (h(), i("div", {
3361
+ key: 2,
3362
+ class: "tabula-issues-body",
3363
+ role: C.value ? "dialog" : void 0,
3364
+ "aria-modal": C.value ? "true" : void 0,
3365
+ "aria-label": C.value ? N.value.title : void 0
3366
+ }, [
3367
+ C.value ? (h(), i("span", W)) : r("", !0),
3368
+ a("header", An, [
3369
+ a("div", jn, [
3370
+ a("strong", Mn, b(N.value.title), 1),
3371
+ a("span", G, [a("button", {
3372
+ type: "button",
3373
+ disabled: A.value.length === 0,
3374
+ onClick: c[2] ||= (e) => le(-1)
3375
+ }, b(N.value.previous), 9, Nn), a("button", {
3376
+ type: "button",
3377
+ disabled: A.value.length === 0,
3378
+ onClick: c[3] ||= (e) => le(1)
3379
+ }, b(N.value.next), 9, Pn)]),
3380
+ C.value || s.closable ? (h(), i("button", {
3381
+ key: 0,
3382
+ type: "button",
3383
+ class: "tabula-issues-close",
3384
+ "aria-label": N.value.close,
3385
+ onClick: E
3386
+ }, [...c[8] ||= [a("svg", {
3387
+ viewBox: "0 0 24 24",
3388
+ "aria-hidden": "true"
3389
+ }, [a("path", { d: "M18 6 6 18M6 6l12 12" })], -1)]], 8, Fn)) : r("", !0)
3390
+ ]),
3391
+ a("div", In, [
3392
+ a("span", Ln, [c[9] ||= a("span", {
3393
+ class: "tabula-issues-dot",
3394
+ "aria-hidden": "true"
3395
+ }, null, -1), o(" " + b(j.value.errors) + " " + b(N.value.errors), 1)]),
3396
+ j.value.warnings > 0 ? (h(), i("span", Rn, [c[10] ||= a("span", {
3397
+ class: "tabula-issues-dot",
3398
+ "aria-hidden": "true"
3399
+ }, null, -1), o(" " + b(j.value.warnings) + " " + b(N.value.warnings), 1)])) : r("", !0),
3400
+ j.value.stale > 0 ? (h(), i("span", zn, [c[11] ||= a("span", {
3401
+ class: "tabula-issues-dot",
3402
+ "aria-hidden": "true"
3403
+ }, null, -1), o(" " + b(j.value.stale) + " " + b(N.value.stale), 1)])) : r("", !0),
3404
+ a("span", Bn, b(j.value.rows) + " " + b(N.value.rows), 1)
3405
+ ]),
3406
+ p.value === void 0 ? r("", !0) : (h(), i("span", Vn, [a("label", null, [ee(a("input", {
3407
+ "onUpdate:modelValue": c[4] ||= (e) => p.value = e,
3408
+ type: "checkbox"
3409
+ }, null, 512), [[T, p.value]]), o(" " + b(N.value.onlyIssueRows), 1)]), p.value ? (h(), i("button", {
3410
+ key: 0,
3411
+ type: "button",
3412
+ title: N.value.refreshHint,
3413
+ onClick: c[5] ||= (e) => f("refreshRows")
3414
+ }, b(N.value.refresh), 9, Hn)) : r("", !0)]))
3415
+ ]),
3416
+ A.value.length === 0 ? (h(), i("p", Un, b(N.value.none), 1)) : (h(), i("ul", {
3417
+ key: 2,
3418
+ ref_key: "list",
3419
+ ref: te,
3420
+ class: "tabula-issues-list tabula-scroll"
3421
+ }, [(h(!0), i(e, null, _(M.value, (e) => (h(), i("li", { key: e.id }, [a("button", {
3422
+ type: "button",
3423
+ class: d(["tabula-issues-item", P(e)]),
3424
+ onClick: (t) => ce(e)
3425
+ }, [
3426
+ a("span", Gn, [
3427
+ c[12] ||= a("span", {
3428
+ class: "tabula-issues-dot",
3429
+ "aria-hidden": "true"
3430
+ }, null, -1),
3431
+ a("span", Kn, b(ne(e)), 1),
3432
+ re(e) ? (h(), i("span", {
3433
+ key: 0,
3434
+ class: "tabula-issues-address",
3435
+ textContent: b(re(e))
3436
+ }, null, 8, qn)) : r("", !0),
3437
+ a("span", Jn, b(ae(e)), 1)
3438
+ ]),
3439
+ ie(e) ? (h(), i("span", {
3440
+ key: 0,
3441
+ class: "tabula-issues-name",
3442
+ textContent: b(ie(e))
3443
+ }, null, 8, Yn)) : r("", !0),
3444
+ a("span", Xn, b(S(He)(e, s.locale, s.valueSettings)), 1),
3445
+ e.stale ? (h(), i("span", Zn, b(N.value.recheck), 1)) : r("", !0),
3446
+ e.rowId === null ? r("", !0) : (h(), i("span", Qn, b(N.value.goToCell), 1))
3447
+ ], 10, Wn)]))), 128)), A.value.length > M.value.length ? (h(), i("li", $n, " +" + b(A.value.length - M.value.length) + " " + b(N.value.more), 1)) : r("", !0)], 512)),
3448
+ A.value.length > 0 ? (h(), n(Pe, {
3449
+ key: 3,
3450
+ target: te.value
3451
+ }, null, 8, ["target"])) : r("", !0),
3452
+ t.$slots.actions ? (h(), i("div", er, [v(t.$slots, "actions")])) : r("", !0)
3453
+ ], 8, kn)) : r("", !0)
3454
+ ], 10, U));
3455
+ }
3456
+ }), nr = ["data-tabula-theme", "aria-label"], rr = [
3457
+ "value",
3458
+ "aria-label",
3459
+ "aria-invalid",
3460
+ "title"
3461
+ ], ir = ["aria-label", "title"], ar = ["textContent"], or = [
3462
+ "value",
3463
+ "readonly",
3464
+ "aria-label",
3465
+ "onKeydown"
3466
+ ], sr = /* @__PURE__ */ c({
3467
+ __name: "TabulaFormulaBar",
3468
+ props: {
3469
+ grid: {
3470
+ type: Object,
3471
+ default: null
3472
+ },
3473
+ locale: {
3474
+ type: String,
3475
+ default: "tr"
3476
+ },
3477
+ theme: {
3478
+ type: String,
3479
+ default: "light"
3480
+ }
3481
+ },
3482
+ setup(n) {
3483
+ let r = n, o = t(() => Be[r.locale]), s = t(() => r.grid?.cell ?? null), c = t(() => s.value?.formula ?? null);
3484
+ function l(e) {
3485
+ let t = e === null ? -1 : s.value?.references.indexOf(e) ?? -1;
3486
+ return t < 0 ? void 0 : ["tabula-formula-ref", `tabula-ref-${t % 6}`];
3487
+ }
3488
+ let u = y(null), f = g(null), p = g(null), m = g(!1), v = t(() => f.value ?? s.value?.text ?? "");
3489
+ O(() => s.value?.address, () => {
3490
+ m.value = !1;
3491
+ });
3492
+ function x(e) {
3493
+ let t = s.value;
3494
+ t?.editable && (f.value === null && (u.value = {
3495
+ rowId: t.rowId,
3496
+ key: t.field.key
3497
+ }), f.value = e.target.value);
3498
+ }
3499
+ function S(e) {
3500
+ let t = u.value, n = f.value;
3501
+ f.value = null, u.value = null, t && n !== null && r.grid?.writeCell(t.rowId, t.key, n), e && r.grid?.focus();
3502
+ }
3503
+ function C() {
3504
+ f.value = null, u.value = null, r.grid?.focus();
3505
+ }
3506
+ function w(e) {
3507
+ if (e.key === "Enter") {
3508
+ e.preventDefault();
3509
+ let t = r.grid?.goToAddress(p.value ?? s.value?.address ?? "") ?? !1;
3510
+ m.value = !t, t && (p.value = null);
3511
+ } else e.key === "Escape" && (e.preventDefault(), p.value = null, m.value = !1, r.grid?.focus());
3512
+ }
3513
+ function T() {
3514
+ p.value = null, m.value = !1;
3515
+ }
3516
+ function E(e) {
3517
+ e.target.select();
3518
+ }
3519
+ return (t, r) => (h(), i("div", {
3520
+ class: "tabula-formula tabula-theme",
3521
+ "data-tabula-theme": n.theme,
3522
+ role: "group",
3523
+ "aria-label": o.value.formulaBar
3524
+ }, [
3525
+ a("input", {
3526
+ class: d(["tabula-formula-address", { "is-wrong": m.value }]),
3527
+ type: "text",
3528
+ spellcheck: "false",
3529
+ autocomplete: "off",
3530
+ value: p.value ?? s.value?.address ?? "",
3531
+ "aria-label": o.value.address,
3532
+ "aria-invalid": m.value || void 0,
3533
+ title: m.value ? o.value.noAddress : o.value.addressHint,
3534
+ onFocus: E,
3535
+ onInput: r[0] ||= (e) => p.value = e.target.value,
3536
+ onKeydown: w,
3537
+ onBlur: T
3538
+ }, null, 42, rr),
3539
+ r[4] ||= a("span", {
3540
+ class: "tabula-formula-fx",
3541
+ "aria-hidden": "true"
3542
+ }, "ƒx", -1),
3543
+ c.value === null ? (h(), i("input", {
3544
+ key: 1,
3545
+ class: "tabula-formula-value",
3546
+ type: "text",
3547
+ spellcheck: "false",
3548
+ autocomplete: "off",
3549
+ value: v.value,
3550
+ readonly: !s.value?.editable,
3551
+ "aria-label": o.value.value,
3552
+ onInput: x,
3553
+ onKeydown: [r[1] ||= k(A((e) => S(!0), ["prevent"]), ["enter"]), k(A(C, ["prevent"]), ["escape"])],
3554
+ onBlur: r[2] ||= (e) => S(!1)
3555
+ }, null, 40, or)) : (h(), i("div", {
3556
+ key: 0,
3557
+ class: "tabula-formula-value is-formula",
3558
+ role: "textbox",
3559
+ "aria-readonly": "true",
3560
+ tabindex: "0",
3561
+ "aria-label": o.value.value,
3562
+ title: o.value.formulaHint
3563
+ }, [r[3] ||= a("span", null, "=", -1), (h(!0), i(e, null, _(c.value, (e, t) => (h(), i("span", {
3564
+ key: t,
3565
+ class: d(l(e.field)),
3566
+ textContent: b(e.text)
3567
+ }, null, 10, ar))), 128))], 8, ir))
3568
+ ], 8, nr));
3569
+ }
3570
+ }), cr = ["data-tabula-theme", "aria-label"], lr = {
3571
+ key: 0,
3572
+ class: "tabula-status-start"
3573
+ }, ur = { class: "tabula-status-info" }, dr = { class: "tabula-status-rows" }, fr = { class: "tabula-status-selected" }, pr = { class: "tabula-status-address" }, mr = { class: "tabula-status-sum" }, hr = {
3574
+ key: 0,
3575
+ class: "tabula-status-average"
3576
+ }, gr = {
3577
+ key: 1,
3578
+ class: "tabula-status-end"
3579
+ }, _r = /* @__PURE__ */ c({
3580
+ __name: "TabulaStatusBar",
3581
+ props: {
3582
+ grid: {
3583
+ type: Object,
3584
+ default: null
3585
+ },
3586
+ locale: {
3587
+ type: String,
3588
+ default: "tr"
3589
+ },
3590
+ theme: {
3591
+ type: String,
3592
+ default: "light"
3593
+ }
3594
+ },
3595
+ setup(n) {
3596
+ let s = n, c = t(() => Be[s.locale]);
3597
+ function l(e) {
3598
+ return e.toLocaleString(s.locale === "tr" ? "tr-TR" : "en-US");
3599
+ }
3600
+ let u = t(() => {
3601
+ let e = s.grid?.rows;
3602
+ return e ? e.shown === e.total ? `${l(e.total)} ${c.value.rows}` : `${l(e.shown)} / ${l(e.total)} ${c.value.rows}` : "";
3603
+ }), d = t(() => {
3604
+ let e = s.grid?.issueSummary;
3605
+ return e ? e.errors + e.warnings : 0;
3606
+ }), f = t(() => s.grid?.selected ?? null), p = t(() => {
3607
+ let e = f.value, t = s.grid;
3608
+ return !t || !e || e.field === null || e.sum === null || e.rows * e.columns < 2 ? null : {
3609
+ sum: t.formatValue(e.field, e.sum),
3610
+ average: e.average === null ? null : t.formatValue(e.field, e.average)
3611
+ };
3612
+ });
3613
+ return (t, s) => (h(), i("div", {
3614
+ class: "tabula-status tabula-theme",
3615
+ "data-tabula-theme": n.theme,
3616
+ role: "group",
3617
+ "aria-label": c.value.statusBar
3618
+ }, [
3619
+ t.$slots.start ? (h(), i("div", lr, [v(t.$slots, "start")])) : r("", !0),
3620
+ a("div", ur, [
3621
+ a("span", dr, [o(b(u.value) + " ", 1), d.value > 0 ? (h(), i(e, { key: 0 }, [o("· " + b(l(d.value)) + " " + b(c.value.issues), 1)], 64)) : r("", !0)]),
3622
+ f.value ? (h(), i(e, { key: 0 }, [s[0] ||= a("span", {
3623
+ class: "tabula-status-sep",
3624
+ "aria-hidden": "true"
3625
+ }, null, -1), a("span", fr, [o(b(c.value.selected) + ": ", 1), a("span", pr, b(f.value.address), 1)])], 64)) : r("", !0),
3626
+ p.value ? (h(), i(e, { key: 1 }, [a("span", mr, [o(b(c.value.sum) + ": ", 1), a("strong", null, b(p.value.sum), 1)]), p.value.average ? (h(), i("span", hr, [o(b(c.value.average) + ": ", 1), a("strong", null, b(p.value.average), 1)])) : r("", !0)], 64)) : r("", !0)
3627
+ ]),
3628
+ t.$slots.end ? (h(), i("div", gr, [v(t.$slots, "end")])) : r("", !0)
3629
+ ], 8, cr));
3630
+ }
3631
+ }), vr = ["data-tabula-theme", "aria-label"], yr = ["textContent"], br = { class: "tabula-preview-counts" }, xr = ["textContent"], Sr = ["textContent"], Cr = ["textContent"], wr = ["textContent"], Tr = ["aria-label"], Er = [
3632
+ "aria-pressed",
3633
+ "onClick",
3634
+ "textContent"
3635
+ ], Dr = {
3636
+ key: 3,
3637
+ class: "tabula-preview-list"
3638
+ }, Or = ["data-row-id", "onClick"], kr = { class: "tabula-preview-name" }, Ar = ["textContent"], jr = ["textContent"], Mr = ["textContent"], Nr = { class: "tabula-preview-changes" }, Pr = ["textContent"], Fr = ["textContent"], Ir = ["textContent"], Lr = ["textContent"], Rr = ["textContent"], K = ["textContent"], zr = { key: 1 }, Br = ["textContent"], Vr = /* @__PURE__ */ c({
3639
+ __name: "TabulaPreview",
3640
+ props: {
3641
+ session: {
3642
+ type: Object,
3643
+ required: !0
3644
+ },
3645
+ plan: {
3646
+ type: Object,
3647
+ required: !0
3648
+ },
3649
+ nameField: {
3650
+ type: String,
3651
+ default: null
3652
+ },
3653
+ locale: {
3654
+ type: String,
3655
+ default: "tr"
3656
+ },
3657
+ valueSettings: {
3658
+ type: Object,
3659
+ default: () => P.tr
3660
+ },
3661
+ theme: {
3662
+ type: String,
3663
+ default: "light"
3664
+ },
3665
+ limit: {
3666
+ type: Number,
3667
+ default: 100
3668
+ }
3669
+ },
3670
+ emits: ["select"],
3671
+ setup(n, { emit: o }) {
3672
+ let s = n, c = o, l = [
3673
+ "create",
3674
+ "update",
3675
+ "unchanged",
3676
+ "unknown"
3677
+ ], u = {
3678
+ all: "all",
3679
+ create: "filterCreate",
3680
+ update: "filterUpdate",
3681
+ unchanged: "filterUnchanged",
3682
+ unknown: "filterUnknown",
3683
+ warned: "filterWarned"
3684
+ }, f = g("all"), p = g(s.limit), m = t(() => Le[s.locale]);
3685
+ O([() => s.plan, f], () => {
3686
+ p.value = s.limit;
3687
+ });
3688
+ let v = t(() => {
3689
+ let e = x(s.session), t = /* @__PURE__ */ new Map();
3690
+ for (let n of s.plan.rows) {
3691
+ let r = [...e.issues.rowIssues(n.rowId), ...e.schema.fields.flatMap((t) => e.issues.issuesAt(n.rowId, t.key))].filter((e) => e.severity === "warning" && !e.stale);
3692
+ r.length > 0 && t.set(n.rowId, r);
3693
+ }
3694
+ return t;
3695
+ }), y = t(() => s.plan.rows.length > 0 && s.plan.counts.unknown === s.plan.rows.length), S = t(() => {
3696
+ let e = [{
3697
+ key: "all",
3698
+ count: s.plan.rows.length
3699
+ }];
3700
+ for (let t of l) s.plan.counts[t] > 0 && e.push({
3701
+ key: t,
3702
+ count: s.plan.counts[t]
3703
+ });
3704
+ return v.value.size > 0 && e.push({
3705
+ key: "warned",
3706
+ count: v.value.size
3707
+ }), e;
3708
+ }), C = t(() => {
3709
+ let e = s.plan.rows;
3710
+ return f.value === "all" ? e : f.value === "warned" ? e.filter((e) => v.value.has(e.rowId)) : e.filter((e) => e.action === f.value);
3711
+ }), w = t(() => C.value.slice(0, p.value)), T = t(() => Math.min(s.limit, C.value.length - w.value.length));
3712
+ function E(e) {
3713
+ let t = x(s.session);
3714
+ return s.nameField === null || !t.schema.has(s.nameField) ? "" : F(t.schema.field(s.nameField), t.store.get(e, s.nameField), s.valueSettings);
3715
+ }
3716
+ function D(e) {
3717
+ return `${m.value.row} ${x(s.session).store.indexOf(e) + 1}`;
3718
+ }
3719
+ function ee(e) {
3720
+ let t = x(s.session).schema;
3721
+ return t.has(e.field) ? t.field(e.field).label : e.field;
3722
+ }
3723
+ function k(e, t) {
3724
+ let n = x(s.session).schema, r = n.has(e.field) ? F(n.field(e.field), t, s.valueSettings) : "";
3725
+ return r === "" ? m.value.empty ?? "" : r;
3726
+ }
3727
+ function A(e) {
3728
+ return e.action === "create" ? e.changes.filter((e) => e.field !== s.nameField) : e.changes;
3729
+ }
3730
+ function j(e) {
3731
+ return e === null || e === "";
3732
+ }
3733
+ function M(e) {
3734
+ switch (e.action) {
3735
+ case "unchanged": return m.value.same ?? "";
3736
+ case "unknown": return m.value.unknownRow ?? "";
3737
+ case "update": return e.changes.length === 0 ? m.value.noChanges ?? "" : "";
3738
+ default: return "";
3739
+ }
3740
+ }
3741
+ function N(e) {
3742
+ return `${s.plan.counts[e]} ${m.value[e]}`;
3743
+ }
3744
+ function te(e, t) {
3745
+ let n = m.value[u[e]] ?? "";
3746
+ return e === "all" ? n : `${n} · ${t}`;
3747
+ }
3748
+ function ne(e) {
3749
+ return He(e, s.locale, s.valueSettings);
3750
+ }
3751
+ return (t, o) => (h(), i("section", {
3752
+ class: "tabula-preview tabula-theme",
3753
+ "data-tabula-theme": n.theme,
3754
+ "aria-label": m.value.title
3755
+ }, [
3756
+ n.plan.current ? r("", !0) : (h(), i("p", {
3757
+ key: 0,
3758
+ class: "tabula-preview-stale",
3759
+ role: "status",
3760
+ textContent: b(m.value.stale)
3761
+ }, null, 8, yr)),
3762
+ a("div", br, [y.value ? (h(), i("span", {
3763
+ key: 0,
3764
+ class: "tabula-preview-chip is-unknown",
3765
+ textContent: b(`${n.plan.rows.length} ${m.value.sent}`)
3766
+ }, null, 8, xr)) : (h(), i(e, { key: 1 }, _(l, (t) => (h(), i(e, { key: t }, [n.plan.counts[t] > 0 ? (h(), i("span", {
3767
+ key: 0,
3768
+ class: d(["tabula-preview-chip", `is-${t}`]),
3769
+ textContent: b(N(t))
3770
+ }, null, 10, Sr)) : r("", !0)], 64))), 64)), v.value.size > 0 ? (h(), i("span", {
3771
+ key: 2,
3772
+ class: "tabula-preview-chip is-warned",
3773
+ textContent: b(`${v.value.size} ${m.value.warned}`)
3774
+ }, null, 8, Cr)) : r("", !0)]),
3775
+ y.value ? (h(), i("p", {
3776
+ key: 1,
3777
+ class: "tabula-preview-note",
3778
+ textContent: b(m.value.noPlan)
3779
+ }, null, 8, wr)) : r("", !0),
3780
+ S.value.length > 2 ? (h(), i("div", {
3781
+ key: 2,
3782
+ class: "tabula-preview-filters",
3783
+ role: "group",
3784
+ "aria-label": m.value.filters
3785
+ }, [(h(!0), i(e, null, _(S.value, (e) => (h(), i("button", {
3786
+ key: e.key,
3787
+ type: "button",
3788
+ class: d({ "is-on": f.value === e.key }),
3789
+ "aria-pressed": f.value === e.key,
3790
+ onClick: (t) => f.value = e.key,
3791
+ textContent: b(te(e.key, e.count))
3792
+ }, null, 10, Er))), 128))], 8, Tr)) : r("", !0),
3793
+ !y.value || v.value.size > 0 ? (h(), i("ul", Dr, [
3794
+ (h(!0), i(e, null, _(w.value, (t) => (h(), i("li", { key: t.rowId }, [a("button", {
3795
+ type: "button",
3796
+ class: d(["tabula-preview-row", `is-${t.action}`]),
3797
+ "data-row-id": t.rowId,
3798
+ onClick: (e) => c("select", t.rowId)
3799
+ }, [
3800
+ a("span", kr, [E(t.rowId) ? (h(), i("strong", {
3801
+ key: 0,
3802
+ textContent: b(E(t.rowId))
3803
+ }, null, 8, Ar)) : r("", !0), a("span", {
3804
+ class: "tabula-preview-number",
3805
+ textContent: b(D(t.rowId))
3806
+ }, null, 8, jr)]),
3807
+ a("span", {
3808
+ class: d(["tabula-preview-action", `is-${t.action}`]),
3809
+ textContent: b(m.value[`${t.action}One`])
3810
+ }, null, 10, Mr),
3811
+ a("span", Nr, [
3812
+ (h(!0), i(e, null, _(A(t), (n) => (h(), i("span", {
3813
+ key: n.field,
3814
+ class: "tabula-preview-change"
3815
+ }, [
3816
+ a("span", {
3817
+ class: "tabula-preview-field",
3818
+ textContent: b(ee(n))
3819
+ }, null, 8, Pr),
3820
+ t.action === "update" ? (h(), i(e, { key: 0 }, [a("s", {
3821
+ class: d(["tabula-preview-before", { "is-empty": j(n.before) }]),
3822
+ textContent: b(k(n, n.before))
3823
+ }, null, 10, Fr), o[1] ||= a("span", {
3824
+ class: "tabula-preview-arrow",
3825
+ "aria-hidden": "true"
3826
+ }, "→", -1)], 64)) : r("", !0),
3827
+ a("strong", {
3828
+ class: d(["tabula-preview-after", { "is-empty": j(n.after) }]),
3829
+ textContent: b(k(n, n.after))
3830
+ }, null, 10, Ir)
3831
+ ]))), 128)),
3832
+ M(t) ? (h(), i("span", {
3833
+ key: 0,
3834
+ class: "tabula-preview-quiet",
3835
+ textContent: b(M(t))
3836
+ }, null, 8, Lr)) : r("", !0),
3837
+ (h(!0), i(e, null, _(v.value.get(t.rowId) ?? [], (e) => (h(), i("span", {
3838
+ key: e.id,
3839
+ class: "tabula-preview-warning",
3840
+ textContent: b(ne(e))
3841
+ }, null, 8, Rr))), 128))
3842
+ ])
3843
+ ], 10, Or)]))), 128)),
3844
+ C.value.length === 0 ? (h(), i("li", {
3845
+ key: 0,
3846
+ class: "tabula-preview-quiet",
3847
+ textContent: b(m.value.none)
3848
+ }, null, 8, K)) : r("", !0),
3849
+ T.value > 0 ? (h(), i("li", zr, [a("button", {
3850
+ type: "button",
3851
+ class: "tabula-preview-more",
3852
+ onClick: o[0] ||= (e) => p.value += n.limit,
3853
+ textContent: b((m.value.more ?? "").replace("{n}", String(T.value)))
3854
+ }, null, 8, Br)])) : r("", !0)
3855
+ ])) : r("", !0)
3856
+ ], 8, vr));
3857
+ }
3858
+ }), Hr = ["data-tabula-theme"], Ur = ["textContent"], Wr = {
3859
+ class: "tabula-mapping-head",
3860
+ "aria-hidden": "true"
3861
+ }, Gr = ["textContent"], Kr = ["textContent"], qr = { class: "tabula-mapping-name" }, Jr = ["textContent"], Yr = ["textContent"], Xr = ["textContent"], Zr = { class: "tabula-mapping-target" }, Qr = [
3862
+ "aria-label",
3863
+ "value",
3864
+ "onChange"
3865
+ ], $r = ["textContent"], q = ["value", "textContent"], J = { class: "tabula-mapping-notes" }, ei = ["textContent"], ti = ["textContent"], ni = ["textContent"], ri = ["textContent"], ii = ["textContent"], ai = { class: "tabula-mapping-name" }, oi = ["textContent"], si = ["textContent"], ci = ["textContent"], li = { class: "tabula-mapping-target" }, Y = ["textContent"], ui = { class: "tabula-mapping-notes" }, di = ["textContent"], X = ["textContent"], fi = { class: "tabula-mapping-target" }, pi = ["textContent"], mi = { class: "tabula-mapping-notes" }, hi = ["textContent"], gi = ["textContent"], _i = {
3866
+ key: 0,
3867
+ class: "tabula-mapping-same"
3868
+ }, Z = ["textContent"], vi = ["textContent"], yi = ["textContent"], bi = /* @__PURE__ */ c({
3869
+ __name: "TabulaDraftMapping",
3870
+ props: /*@__PURE__*/ l({
3871
+ draft: {
3872
+ type: Object,
3873
+ required: !0
3874
+ },
3875
+ schema: {
3876
+ type: Object,
3877
+ required: !0
3878
+ },
3879
+ locale: {
3880
+ type: String,
3881
+ default: "tr"
3882
+ },
3883
+ valueSettings: {
3884
+ type: Object,
3885
+ default: () => P.tr
3886
+ },
3887
+ theme: {
3888
+ type: String,
3889
+ default: "light"
3890
+ }
3891
+ }, {
3892
+ rename: { default: () => ({}) },
3893
+ renameModifiers: {}
3894
+ }),
3895
+ emits: ["update:rename"],
3896
+ setup(n) {
3897
+ let o = n, s = w(n, "rename"), c = t(() => Re[o.locale]), l = t(() => x(o.schema)), u = t(() => _e(x(o.draft), l.value, {
3898
+ rename: s.value,
3899
+ settings: o.valueSettings
3900
+ })), f = t(() => Te(x(o.draft), l.value)), p = t(() => u.value.fields.filter((e) => !l.value.has(e.key))), m = t(() => u.value.fields.filter((e) => l.value.has(e.key) && l.value.field(e.key).type !== e.type)), g = t(() => u.value.fields.filter((e) => l.value.has(e.key) && l.value.field(e.key).type === e.type)), v = t(() => u.value.added.map((e) => l.value.field(e))), y = t(() => new Set(x(o.draft).fields.map((e) => e.key))), S = t(() => {
3901
+ let e = x(o.draft), t = new Intl.DateTimeFormat(o.locale === "tr" ? "tr-TR" : "en-GB", {
3902
+ dateStyle: "long",
3903
+ timeStyle: "short"
3904
+ }).format(new Date(e.savedAt));
3905
+ return A(c.value.saved, {
3906
+ date: t,
3907
+ rows: e.rows.length,
3908
+ from: e.schemaVersion,
3909
+ to: l.value.schemaVersion
3910
+ });
3911
+ }), C = t(() => {
3912
+ let e = p.value.filter((e) => e.target !== null).length, t = p.value.length - e;
3913
+ return [e > 0 ? A(c.value.mapped, { n: e }) : "", t > 0 ? A(c.value.dropped, { n: t }) : ""].filter(Boolean).join(" · ");
3914
+ });
3915
+ function T(e) {
3916
+ let t = new Set(Object.entries(s.value).flatMap(([t, n]) => t === e.key ? [] : [n]));
3917
+ return l.value.fields.filter((e) => !y.value.has(e.key) && !t.has(e.key)).map((t) => ({
3918
+ key: t.key,
3919
+ label: t.type === e.type ? t.label : `${t.label} (${c.value.otherType})`
3920
+ }));
3921
+ }
3922
+ function E(e, t) {
3923
+ let n = { ...s.value };
3924
+ t === "" ? delete n[e.key] : n[e.key] = t, s.value = n;
3925
+ }
3926
+ function D(e) {
3927
+ return e.label ?? e.key;
3928
+ }
3929
+ function O(e) {
3930
+ return c.value[e] ?? e;
3931
+ }
3932
+ function ee(e, t) {
3933
+ let n = e.target === null ? null : l.value.field(e.target);
3934
+ return n && Oe(n, t, o.valueSettings) === null ? F(n, t, o.valueSettings) : typeof t == "object" && t && !Array.isArray(t) && "label" in t ? String(t.label) : Array.isArray(t) ? t.join(", ") : String(t);
3935
+ }
3936
+ function k(e) {
3937
+ let t = e.samples.map((t) => ee(e, t)).join(" · ");
3938
+ return e.filled > e.samples.length ? `${t} …` : t;
3939
+ }
3940
+ function A(e, t) {
3941
+ let n = new Intl.NumberFormat(o.locale === "tr" ? "tr-TR" : "en-GB");
3942
+ return (e ?? "").replace(/\{(\w+)\}/g, (e, r) => {
3943
+ let i = t[r];
3944
+ return typeof i == "number" ? n.format(i) : i ?? "";
3945
+ });
3946
+ }
3947
+ return (t, o) => (h(), i("section", {
3948
+ class: "tabula-mapping tabula-theme",
3949
+ "data-tabula-theme": n.theme
3950
+ }, [
3951
+ a("p", {
3952
+ class: "tabula-mapping-saved",
3953
+ textContent: b(S.value)
3954
+ }, null, 8, Ur),
3955
+ a("div", Wr, [
3956
+ a("span", { textContent: b(c.value.fromHead) }, null, 8, Gr),
3957
+ o[0] ||= a("span", null, null, -1),
3958
+ a("span", { textContent: b(c.value.toHead) }, null, 8, Kr)
3959
+ ]),
3960
+ (h(!0), i(e, null, _(p.value, (t) => (h(), i("div", {
3961
+ key: t.key,
3962
+ class: "tabula-mapping-row"
3963
+ }, [
3964
+ a("span", qr, [
3965
+ a("strong", { textContent: b(D(t)) }, null, 8, Jr),
3966
+ a("span", {
3967
+ class: "tabula-mapping-kind",
3968
+ textContent: b(`${O(t.type)} · ${t.key}`)
3969
+ }, null, 8, Yr),
3970
+ t.filled > 0 ? (h(), i("span", {
3971
+ key: 0,
3972
+ class: "tabula-mapping-samples",
3973
+ textContent: b(k(t))
3974
+ }, null, 8, Xr)) : r("", !0)
3975
+ ]),
3976
+ o[1] ||= a("span", {
3977
+ class: "tabula-mapping-arrow",
3978
+ "aria-hidden": "true"
3979
+ }, "→", -1),
3980
+ a("span", Zr, [a("select", {
3981
+ class: d(["tabula-mapping-select", {
3982
+ "is-dropped": t.target === null,
3983
+ "is-suggested": t.target !== null && f.value[t.key] === t.target
3984
+ }]),
3985
+ "aria-label": `${D(t)}: ${c.value.toHead}`,
3986
+ value: t.target ?? "",
3987
+ onChange: (e) => E(t, e.target.value)
3988
+ }, [a("option", {
3989
+ value: "",
3990
+ textContent: b(c.value.drop)
3991
+ }, null, 8, $r), (h(!0), i(e, null, _(T(t), (e) => (h(), i("option", {
3992
+ key: e.key,
3993
+ value: e.key,
3994
+ textContent: b(e.label)
3995
+ }, null, 8, q))), 128))], 42, Qr), a("span", J, [t.target === null ? (h(), i(e, { key: 0 }, [t.filled > 0 ? (h(), i("span", {
3996
+ key: 0,
3997
+ class: "tabula-mapping-tag is-lost",
3998
+ textContent: b(A(c.value.losing, { n: t.filled }))
3999
+ }, null, 8, ei)) : (h(), i("span", {
4000
+ key: 1,
4001
+ class: "tabula-mapping-quiet",
4002
+ textContent: b(c.value.noValues)
4003
+ }, null, 8, ti))], 64)) : (h(), i(e, { key: 1 }, [
4004
+ f.value[t.key] === t.target ? (h(), i("span", {
4005
+ key: 0,
4006
+ class: "tabula-mapping-tag is-suggested",
4007
+ textContent: b(c.value.suggested)
4008
+ }, null, 8, ni)) : r("", !0),
4009
+ a("span", {
4010
+ class: "tabula-mapping-quiet",
4011
+ textContent: b(A(c.value.moves, { n: t.filled }))
4012
+ }, null, 8, ri),
4013
+ t.unreadable > 0 ? (h(), i("span", {
4014
+ key: 1,
4015
+ class: "tabula-mapping-tag is-warned",
4016
+ textContent: b(A(c.value.unreadable, { n: t.unreadable }))
4017
+ }, null, 8, ii)) : r("", !0)
4018
+ ], 64))])])
4019
+ ]))), 128)),
4020
+ (h(!0), i(e, null, _(m.value, (e) => (h(), i("div", {
4021
+ key: e.key,
4022
+ class: "tabula-mapping-row"
4023
+ }, [
4024
+ a("span", ai, [
4025
+ a("strong", { textContent: b(D(e)) }, null, 8, oi),
4026
+ a("span", {
4027
+ class: "tabula-mapping-kind",
4028
+ textContent: b(e.key)
4029
+ }, null, 8, si),
4030
+ e.filled > 0 ? (h(), i("span", {
4031
+ key: 0,
4032
+ class: "tabula-mapping-samples",
4033
+ textContent: b(k(e))
4034
+ }, null, 8, ci)) : r("", !0)
4035
+ ]),
4036
+ o[2] ||= a("span", {
4037
+ class: "tabula-mapping-arrow",
4038
+ "aria-hidden": "true"
4039
+ }, "→", -1),
4040
+ a("span", li, [a("strong", {
4041
+ class: "tabula-mapping-fixed",
4042
+ textContent: b(l.value.field(e.key).label)
4043
+ }, null, 8, Y), a("span", ui, [a("span", {
4044
+ class: "tabula-mapping-tag is-warned",
4045
+ textContent: b(A(c.value.retyped, {
4046
+ from: O(e.type),
4047
+ to: O(l.value.field(e.key).type)
4048
+ }))
4049
+ }, null, 8, di), e.unreadable > 0 ? (h(), i("span", {
4050
+ key: 0,
4051
+ class: "tabula-mapping-quiet",
4052
+ textContent: b(A(c.value.unreadable, { n: e.unreadable }))
4053
+ }, null, 8, X)) : r("", !0)])])
4054
+ ]))), 128)),
4055
+ (h(!0), i(e, null, _(v.value, (e) => (h(), i("div", {
4056
+ key: e.key,
4057
+ class: "tabula-mapping-row"
4058
+ }, [
4059
+ o[3] ||= a("span", { class: "tabula-mapping-quiet" }, "—", -1),
4060
+ o[4] ||= a("span", {
4061
+ class: "tabula-mapping-arrow",
4062
+ "aria-hidden": "true"
4063
+ }, "→", -1),
4064
+ a("span", fi, [a("strong", {
4065
+ class: "tabula-mapping-fixed",
4066
+ textContent: b(e.label)
4067
+ }, null, 8, pi), a("span", mi, [a("span", {
4068
+ class: "tabula-mapping-tag is-new",
4069
+ textContent: b(c.value.added)
4070
+ }, null, 8, hi), a("span", {
4071
+ class: "tabula-mapping-quiet",
4072
+ textContent: b(c.value.addedNote)
4073
+ }, null, 8, gi)])])
4074
+ ]))), 128)),
4075
+ g.value.length > 0 ? (h(), i("p", _i, [a("span", {
4076
+ class: "tabula-mapping-tag",
4077
+ textContent: b(A(c.value.same, { n: g.value.length }))
4078
+ }, null, 8, Z), a("span", { textContent: b(g.value.map(D).join(", ")) }, null, 8, vi)])) : r("", !0),
4079
+ C.value ? (h(), i("p", {
4080
+ key: 1,
4081
+ class: "tabula-mapping-summary",
4082
+ role: "status",
4083
+ textContent: b(C.value)
4084
+ }, null, 8, yi)) : r("", !0)
4085
+ ], 8, Hr));
4086
+ }
4087
+ }), xi = ["data-tabula-theme"], Si = ["aria-label"], Ci = [
4088
+ "data-tab",
4089
+ "aria-selected",
4090
+ "aria-disabled",
4091
+ "tabindex",
4092
+ "onClick",
4093
+ "onPointerdown",
4094
+ "onDblclick",
4095
+ "onKeydown",
4096
+ "onContextmenu"
4097
+ ], wi = ["aria-label", "onKeydown"], Ti = ["textContent"], Ei = [
4098
+ "title",
4099
+ "aria-label",
4100
+ "textContent"
4101
+ ], Di = ["title", "aria-label"], Oi = [
4102
+ "aria-label",
4103
+ "title",
4104
+ "disabled"
4105
+ ], ki = ["aria-label"], Ai = ["textContent"], ji = ["textContent"], Mi = ["textContent"], Ni = ["disabled"], Pi = ["textContent"], Fi = ["textContent"], Ii = ["disabled"], Li = ["textContent"], Ri = ["textContent"], zi = ["disabled", "textContent"], Bi = /* @__PURE__ */ c({
4106
+ __name: "TabulaSheetTabs",
4107
+ props: /*@__PURE__*/ l({
4108
+ tabs: {
4109
+ type: Array,
4110
+ required: !0
4111
+ },
4112
+ disabled: {
4113
+ type: Boolean,
4114
+ default: !1
4115
+ },
4116
+ locale: {
4117
+ type: String,
4118
+ default: "tr"
4119
+ },
4120
+ theme: {
4121
+ type: String,
4122
+ default: "light"
4123
+ }
4124
+ }, {
4125
+ active: { required: !0 },
4126
+ activeModifiers: {}
4127
+ }),
4128
+ emits: /*@__PURE__*/ l([
4129
+ "add",
4130
+ "rename",
4131
+ "duplicate",
4132
+ "remove",
4133
+ "move"
4134
+ ], ["update:active"]),
4135
+ setup(n, { emit: o }) {
4136
+ let s = n, c = o, l = w(n, "active"), m = t(() => ze[s.locale]), v = g(null), y = g(null), x = g(""), S = g(null), C = null;
4137
+ function T(e) {
4138
+ !s.disabled && e !== l.value && (l.value = e);
4139
+ }
4140
+ function E(e) {
4141
+ let t = s.tabs.find((t) => t.id === e);
4142
+ !s.disabled && t && (de(), y.value = e, x.value = t.name, u(() => {
4143
+ let e = v.value?.querySelector(".tabula-tabs-rename");
4144
+ e?.focus(), e?.select();
4145
+ }));
4146
+ }
4147
+ function O() {
4148
+ let e = y.value, t = x.value.trim(), n = s.tabs.find((t) => t.id === e);
4149
+ y.value = null, e !== null && n && t !== "" && t !== n.name && c("rename", e, t), M(e);
4150
+ }
4151
+ function j() {
4152
+ let e = y.value;
4153
+ y.value = null, M(e);
4154
+ }
4155
+ function M(e) {
4156
+ u(() => v.value?.querySelector(`[data-tab="${e ?? l.value}"]`)?.focus());
4157
+ }
4158
+ function N(e, t) {
4159
+ let n = s.tabs.findIndex((e) => e.id === t);
4160
+ if ((e.ctrlKey || e.metaKey) && e.shiftKey && (e.key === "ArrowRight" || e.key === "ArrowLeft")) te(t, e.key === "ArrowRight" ? 1 : -1);
4161
+ else if (e.key === "ArrowRight" || e.key === "ArrowLeft") {
4162
+ let t = s.tabs[(n + (e.key === "ArrowRight" ? 1 : -1) + s.tabs.length) % s.tabs.length];
4163
+ M(t?.id ?? null);
4164
+ } else if (e.key === "Home" || e.key === "End") M((e.key === "Home" ? s.tabs[0] : s.tabs[s.tabs.length - 1])?.id ?? null);
4165
+ else if (e.key === "Enter" || e.key === " ") T(t);
4166
+ else if (e.key === "F2") E(t);
4167
+ else if (e.key === "ContextMenu" || e.key === "F10" && e.shiftKey) {
4168
+ let n = e.currentTarget.getBoundingClientRect();
4169
+ ue(t, n.left, n.top);
4170
+ } else return;
4171
+ e.preventDefault();
4172
+ }
4173
+ function te(e, t) {
4174
+ let n = s.tabs.findIndex((t) => t.id === e), r = n + t;
4175
+ !s.disabled && n >= 0 && r >= 0 && r < s.tabs.length && (c("move", e, r), M(e));
4176
+ }
4177
+ let ne = g(null), re = null, ie = !1;
4178
+ function P(e, t) {
4179
+ if (e.button !== 0 || s.disabled || y.value !== null || s.tabs.length < 2) return;
4180
+ let n = s.tabs.findIndex((e) => e.id === t), r = e.clientX;
4181
+ ne.value = {
4182
+ id: t,
4183
+ from: n,
4184
+ to: n,
4185
+ moved: !1
4186
+ };
4187
+ let i = (e) => {
4188
+ let t = ne.value;
4189
+ t && (t.moved || Math.abs(e.clientX - r) >= 5) && (ne.value = {
4190
+ ...t,
4191
+ moved: !0,
4192
+ to: oe(e.clientX, t.from)
4193
+ });
4194
+ }, a = () => {
4195
+ let e = ne.value;
4196
+ ae(), e?.moved && (ie = !0, setTimeout(() => ie = !1, 0), e.to !== e.from && c("move", e.id, e.to));
4197
+ }, o = (e) => {
4198
+ e.key === "Escape" && (e.preventDefault(), ae());
4199
+ };
4200
+ window.addEventListener("pointermove", i), window.addEventListener("pointerup", a), window.addEventListener("pointercancel", ae), window.addEventListener("keydown", o, !0), re = () => {
4201
+ window.removeEventListener("pointermove", i), window.removeEventListener("pointerup", a), window.removeEventListener("pointercancel", ae), window.removeEventListener("keydown", o, !0);
4202
+ };
4203
+ }
4204
+ p(ae);
4205
+ function ae() {
4206
+ re?.(), re = null, ne.value = null;
4207
+ }
4208
+ function oe(e, t) {
4209
+ let n = [...v.value?.querySelectorAll(".tabula-tabs-tab") ?? []], r = n.length;
4210
+ for (let [t, i] of n.entries()) {
4211
+ let n = i.getBoundingClientRect();
4212
+ if (e < n.left + n.width / 2) {
4213
+ r = t;
4214
+ break;
4215
+ }
4216
+ }
4217
+ return r > t ? r - 1 : r;
4218
+ }
4219
+ function se(e) {
4220
+ let t = ne.value;
4221
+ if (!t?.moved || t.to === t.from) return;
4222
+ let n = t.to > t.from ? t.to + 1 : t.to;
4223
+ return n === e ? "is-drop-before" : n === s.tabs.length && e === s.tabs.length - 1 ? "is-drop-after" : void 0;
4224
+ }
4225
+ function ce(e) {
4226
+ ie || T(e);
4227
+ }
4228
+ function le(e, t) {
4229
+ e.preventDefault(), ue(t, e.clientX, e.clientY);
4230
+ }
4231
+ function ue(e, t, n) {
4232
+ if (s.disabled) return;
4233
+ de(), S.value = {
4234
+ id: e,
4235
+ left: t,
4236
+ top: n
4237
+ };
4238
+ let r = (e) => {
4239
+ e.target instanceof Element && e.target.closest(".tabula-tabs-menu") || de();
4240
+ };
4241
+ window.addEventListener("mousedown", r, !0), C = () => window.removeEventListener("mousedown", r, !0), u(() => {
4242
+ let e = v.value?.parentElement?.querySelector(".tabula-tabs-menu");
4243
+ if (!e || !S.value) return;
4244
+ let t = Math.max(8, Math.min(S.value.left, window.innerWidth - e.offsetWidth - 8)), n = Math.max(8, S.value.top - e.offsetHeight - 4);
4245
+ S.value = {
4246
+ ...S.value,
4247
+ left: t,
4248
+ top: n
4249
+ }, e.querySelector("button")?.focus();
4250
+ });
4251
+ }
4252
+ function de() {
4253
+ C?.(), C = null, S.value = null;
4254
+ }
4255
+ function fe(e) {
4256
+ let t = S.value?.id;
4257
+ de(), t && (e === "rename" ? E(t) : e === "duplicate" ? c("duplicate", t) : e === "left" || e === "right" ? te(t, e === "right" ? 1 : -1) : c("remove", t));
4258
+ }
4259
+ function pe(e) {
4260
+ let t = [...e.currentTarget.querySelectorAll("button:not(:disabled)")], n = t.indexOf(document.activeElement);
4261
+ if (e.key === "ArrowDown" || e.key === "ArrowUp") t[(n + (e.key === "ArrowDown" ? 1 : -1) + t.length) % t.length]?.focus();
4262
+ else if (e.key === "Escape" || e.key === "Tab") {
4263
+ let e = S.value?.id ?? null;
4264
+ de(), M(e);
4265
+ } else return;
4266
+ e.preventDefault();
4267
+ }
4268
+ let F = t(() => S.value ? s.tabs.findIndex((e) => e.id === S.value?.id) : -1), me = typeof navigator < "u" && /Mac|iPhone|iPad/.test(navigator.platform);
4269
+ function he(e) {
4270
+ return me ? `⌘⇧${e}` : `Ctrl+Shift+${e}`;
4271
+ }
4272
+ function ge(e) {
4273
+ return (m.value.errors ?? "").replace("{n}", String(e));
4274
+ }
4275
+ return (t, o) => (h(), i("div", {
4276
+ class: d(["tabula-tabs tabula-theme", { "is-disabled": n.disabled }]),
4277
+ "data-tabula-theme": n.theme
4278
+ }, [
4279
+ a("div", {
4280
+ ref_key: "list",
4281
+ ref: v,
4282
+ class: "tabula-tabs-list",
4283
+ role: "tablist",
4284
+ "aria-label": m.value.sheets
4285
+ }, [(h(!0), i(e, null, _(n.tabs, (e, t) => (h(), i("div", {
4286
+ key: e.id,
4287
+ class: d(["tabula-tabs-tab", [{
4288
+ "is-active": e.id === l.value,
4289
+ "is-dragging": ne.value?.moved && ne.value.id === e.id
4290
+ }, se(t)]]),
4291
+ role: "tab",
4292
+ "data-tab": e.id,
4293
+ "aria-selected": e.id === l.value,
4294
+ "aria-disabled": n.disabled || void 0,
4295
+ tabindex: e.id === l.value ? 0 : -1,
4296
+ onClick: (t) => ce(e.id),
4297
+ onPointerdown: (t) => P(t, e.id),
4298
+ onDblclick: (t) => E(e.id),
4299
+ onKeydown: (t) => N(t, e.id),
4300
+ onContextmenu: (t) => le(t, e.id)
4301
+ }, [y.value === e.id ? ee((h(), i("input", {
4302
+ key: 0,
4303
+ "onUpdate:modelValue": o[0] ||= (e) => x.value = e,
4304
+ class: "tabula-tabs-rename",
4305
+ type: "text",
4306
+ maxlength: "60",
4307
+ "aria-label": m.value.name,
4308
+ onKeydown: [
4309
+ k(A(O, ["prevent"]), ["enter"]),
4310
+ k(A(j, ["prevent"]), ["escape"]),
4311
+ o[1] ||= A(() => {}, ["stop"])
4312
+ ],
4313
+ onBlur: O,
4314
+ onClick: o[2] ||= A(() => {}, ["stop"])
4315
+ }, null, 40, wi)), [[D, x.value]]) : (h(), i("span", {
4316
+ key: 1,
4317
+ class: "tabula-tabs-name",
4318
+ textContent: b(e.name)
4319
+ }, null, 8, Ti)), (e.errors ?? 0) > 0 ? (h(), i("span", {
4320
+ key: 2,
4321
+ class: "tabula-tabs-badge is-error",
4322
+ title: ge(e.errors ?? 0),
4323
+ "aria-label": ge(e.errors ?? 0),
4324
+ textContent: b(e.errors)
4325
+ }, null, 8, Ei)) : e.done ? (h(), i("span", {
4326
+ key: 3,
4327
+ class: "tabula-tabs-badge is-done",
4328
+ title: m.value.done,
4329
+ "aria-label": m.value.done,
4330
+ textContent: "✓"
4331
+ }, null, 8, Di)) : r("", !0)], 42, Ci))), 128))], 8, Si),
4332
+ a("button", {
4333
+ type: "button",
4334
+ class: "tabula-tabs-add",
4335
+ "aria-label": m.value.add,
4336
+ title: m.value.add,
4337
+ disabled: n.disabled,
4338
+ onClick: o[3] ||= (e) => c("add")
4339
+ }, " + ", 8, Oi),
4340
+ S.value ? (h(), i("div", {
4341
+ key: 0,
4342
+ class: "tabula-tabs-menu",
4343
+ role: "menu",
4344
+ "aria-label": m.value.menu,
4345
+ style: f({
4346
+ left: `${S.value.left}px`,
4347
+ top: `${S.value.top}px`
4348
+ }),
4349
+ onKeydown: pe,
4350
+ onContextmenu: o[9] ||= A(() => {}, ["prevent"])
4351
+ }, [
4352
+ a("button", {
4353
+ type: "button",
4354
+ role: "menuitem",
4355
+ onClick: o[4] ||= (e) => fe("rename")
4356
+ }, [a("span", { textContent: b(m.value.rename) }, null, 8, Ai), a("span", {
4357
+ class: "tabula-tabs-key",
4358
+ textContent: b(`F2 · ${m.value.doubleClick}`)
4359
+ }, null, 8, ji)]),
4360
+ a("button", {
4361
+ type: "button",
4362
+ role: "menuitem",
4363
+ onClick: o[5] ||= (e) => fe("duplicate"),
4364
+ textContent: b(m.value.duplicate)
4365
+ }, null, 8, Mi),
4366
+ a("button", {
4367
+ type: "button",
4368
+ role: "menuitem",
4369
+ disabled: F.value <= 0,
4370
+ onClick: o[6] ||= (e) => fe("left")
4371
+ }, [a("span", { textContent: b(m.value.moveLeft) }, null, 8, Pi), a("span", {
4372
+ class: "tabula-tabs-key",
4373
+ textContent: b(he("←"))
4374
+ }, null, 8, Fi)], 8, Ni),
4375
+ a("button", {
4376
+ type: "button",
4377
+ role: "menuitem",
4378
+ disabled: F.value >= n.tabs.length - 1,
4379
+ onClick: o[7] ||= (e) => fe("right")
4380
+ }, [a("span", { textContent: b(m.value.moveRight) }, null, 8, Li), a("span", {
4381
+ class: "tabula-tabs-key",
4382
+ textContent: b(he("→"))
4383
+ }, null, 8, Ri)], 8, Ii),
4384
+ o[10] ||= a("span", {
4385
+ class: "tabula-tabs-line",
4386
+ role: "separator"
4387
+ }, null, -1),
4388
+ a("button", {
4389
+ type: "button",
4390
+ role: "menuitem",
4391
+ class: "is-danger",
4392
+ disabled: n.tabs.length <= 1,
4393
+ onClick: o[8] ||= (e) => fe("remove"),
4394
+ textContent: b(m.value.remove)
4395
+ }, null, 8, zi)
4396
+ ], 44, ki)) : r("", !0)
4397
+ ], 10, xi));
4398
+ }
4399
+ }), Vi = ["data-tabula-theme", "aria-label"], Hi = { class: "tabula-find-field" }, Ui = { class: "tabula-find-field" }, Wi = ["aria-label"], Gi = ["aria-pressed", "disabled"], Ki = ["aria-pressed", "disabled"], qi = ["aria-pressed"], Ji = [
4400
+ "aria-pressed",
4401
+ "title",
4402
+ "aria-label"
4403
+ ], Yi = ["aria-pressed", "title"], Xi = {
4404
+ class: "tabula-find-count",
4405
+ role: "status"
4406
+ }, Zi = ["aria-label", "disabled"], Qi = ["aria-label", "disabled"], $i = { class: "tabula-find-actions" }, ea = {
4407
+ key: 0,
4408
+ class: "tabula-find-note",
4409
+ role: "status"
4410
+ }, ta = ["disabled"], na = ["disabled"], ra = ["aria-label"], ia = 120, aa = /* @__PURE__ */ c({
4411
+ __name: "TabulaFind",
4412
+ props: /*@__PURE__*/ l({
4413
+ grid: {
4414
+ type: Object,
4415
+ default: null
4416
+ },
4417
+ store: {
4418
+ type: Object,
4419
+ required: !0
4420
+ },
4421
+ schema: {
4422
+ type: Object,
4423
+ required: !0
4424
+ },
4425
+ view: {
4426
+ type: Object,
4427
+ default: void 0
4428
+ },
4429
+ valueSettings: {
4430
+ type: Object,
4431
+ default: () => P.tr
4432
+ },
4433
+ locale: {
4434
+ type: String,
4435
+ default: "tr"
4436
+ },
4437
+ theme: {
4438
+ type: String,
4439
+ default: "light"
4440
+ }
4441
+ }, {
4442
+ open: {
4443
+ type: Boolean,
4444
+ default: !1
4445
+ },
4446
+ openModifiers: {},
4447
+ found: { default: null },
4448
+ foundModifiers: {}
4449
+ }),
4450
+ emits: /*@__PURE__*/ l(["replaced"], ["update:open", "update:found"]),
4451
+ setup(e, { emit: n }) {
4452
+ let o = e, s = n, c = w(e, "open"), l = w(e, "found"), d = t(() => Ve[o.locale]), f = g(""), m = g(""), _ = g("sheet"), v = g(!1), S = g(!1), C = g(0), T = y([]), E = g(null), k = y([]), A = g(null), j = g(null), M = null, N = null, te = t(() => A.value && o.schema.has(A.value) ? o.schema.field(A.value).label : null), ne = t(() => f.value === "" ? "" : T.value.length === 0 ? d.value.none : (d.value.count ?? "").replace("{current}", String(C.value + 1)).replace("{total}", String(T.value.length)));
4453
+ function re(e) {
4454
+ return JSON.stringify([e.rowId, e.field]);
4455
+ }
4456
+ function ie() {
4457
+ return {
4458
+ settings: o.valueSettings,
4459
+ matchCase: v.value,
4460
+ whole: S.value,
4461
+ locale: o.locale === "tr" ? "tr-TR" : "en"
4462
+ };
4463
+ }
4464
+ function P() {
4465
+ let e = x(o.store), t = x(o.schema), n = x(o.view), r = n ? Array.from({ length: n.size }, (e, t) => n.rowIdAt(t)).filter((e) => e !== void 0) : e.rowIds(), i = o.grid?.shownFields() ?? t.keys(), a;
4466
+ if (_.value === "selection") {
4467
+ let n = new Set(k.value.map(re)), o = new Set(k.value.map((e) => e.rowId)), s = new Set(k.value.map((e) => e.field));
4468
+ a = pe(e, t, r.filter((e) => o.has(e)), i.filter((e) => s.has(e)), f.value, ie()).filter((e) => n.has(re(e)));
4469
+ } else {
4470
+ let n = _.value === "column" ? A.value ? [A.value] : [] : i;
4471
+ a = pe(e, t, r, n, f.value, ie());
4472
+ }
4473
+ T.value = a, C.value = Math.min(C.value, Math.max(0, a.length - 1)), oe();
4474
+ }
4475
+ function ae() {
4476
+ M !== null && clearTimeout(M), M = setTimeout(() => {
4477
+ M = null, P();
4478
+ }, ia);
4479
+ }
4480
+ function oe() {
4481
+ l.value = c.value && f.value !== "" ? {
4482
+ cells: T.value,
4483
+ current: T.value[C.value] ?? null
4484
+ } : null;
4485
+ }
4486
+ function se(e) {
4487
+ let t = T.value.length;
4488
+ t !== 0 && (C.value = (C.value + e + t) % t, oe(), ce());
4489
+ }
4490
+ function ce() {
4491
+ let e = T.value[C.value];
4492
+ e && o.grid?.showCell(e.rowId, e.field);
4493
+ }
4494
+ function le(e) {
4495
+ let t = be(x(o.store), x(o.schema), e, f.value, m.value, {
4496
+ ...ie(),
4497
+ editable: (e, t) => o.grid?.canEdit(e, t) ?? !0
4498
+ });
4499
+ E.value = t.skipped > 0 ? `${(d.value.replaced ?? "").replace("{n}", String(t.replaced))} · ${(d.value.skipped ?? "").replace("{n}", String(t.skipped))}` : (d.value.replaced ?? "").replace("{n}", String(t.replaced)), s("replaced", t.replaced, t.skipped), P();
4500
+ }
4501
+ function ue() {
4502
+ let e = T.value[C.value];
4503
+ e && (le([e]), ce());
4504
+ }
4505
+ function de() {
4506
+ le(T.value);
4507
+ }
4508
+ function fe() {
4509
+ c.value = !1, o.grid?.focus();
4510
+ }
4511
+ function F(e) {
4512
+ e.key === "Enter" ? (e.preventDefault(), se(e.shiftKey ? -1 : 1)) : e.key === "Escape" && (e.preventDefault(), fe());
4513
+ }
4514
+ function me(e) {
4515
+ e.key === "Enter" ? (e.preventDefault(), ue()) : e.key === "Escape" && (e.preventDefault(), fe());
4516
+ }
4517
+ return O(f, () => {
4518
+ C.value = 0, E.value = null, ae();
4519
+ }), O([
4520
+ _,
4521
+ v,
4522
+ S
4523
+ ], () => {
4524
+ C.value = 0, P();
4525
+ }), O(c, (e) => {
4526
+ N?.(), N = null, e ? (k.value = o.grid?.selectedCells() ?? [], A.value = o.grid?.selectedFields()[0] ?? null, _.value = k.value.length > 1 ? "selection" : "sheet", N = x(o.store).subscribe(() => ae()), P(), u(() => {
4527
+ j.value?.focus(), j.value?.select();
4528
+ })) : (l.value = null, E.value = null);
4529
+ }, { immediate: !0 }), p(() => {
4530
+ N?.(), M !== null && clearTimeout(M);
4531
+ }), (t, n) => c.value ? (h(), i("div", {
4532
+ key: 0,
4533
+ class: "tabula-find tabula-theme",
4534
+ "data-tabula-theme": e.theme,
4535
+ role: "search",
4536
+ "aria-label": d.value.title
4537
+ }, [
4538
+ a("label", Hi, [a("span", null, b(d.value.find), 1), ee(a("input", {
4539
+ ref_key: "findInput",
4540
+ ref: j,
4541
+ "onUpdate:modelValue": n[0] ||= (e) => f.value = e,
4542
+ type: "text",
4543
+ spellcheck: "false",
4544
+ onKeydown: F
4545
+ }, null, 544), [[D, f.value]])]),
4546
+ a("label", Ui, [a("span", null, b(d.value.replace), 1), ee(a("input", {
4547
+ "onUpdate:modelValue": n[1] ||= (e) => m.value = e,
4548
+ type: "text",
4549
+ spellcheck: "false",
4550
+ onKeydown: me
4551
+ }, null, 544), [[D, m.value]])]),
4552
+ a("span", {
4553
+ class: "tabula-find-scope",
4554
+ role: "group",
4555
+ "aria-label": d.value.where
4556
+ }, [
4557
+ a("button", {
4558
+ type: "button",
4559
+ "aria-pressed": _.value === "selection",
4560
+ disabled: k.value.length < 2,
4561
+ onClick: n[2] ||= (e) => _.value = "selection"
4562
+ }, b(d.value.selection), 9, Gi),
4563
+ a("button", {
4564
+ type: "button",
4565
+ "aria-pressed": _.value === "column",
4566
+ disabled: !A.value,
4567
+ onClick: n[3] ||= (e) => _.value = "column"
4568
+ }, b(te.value ? `${d.value.column}: ${te.value}` : d.value.column), 9, Ki),
4569
+ a("button", {
4570
+ type: "button",
4571
+ "aria-pressed": _.value === "sheet",
4572
+ onClick: n[4] ||= (e) => _.value = "sheet"
4573
+ }, b(d.value.sheet), 9, qi)
4574
+ ], 8, Wi),
4575
+ a("button", {
4576
+ type: "button",
4577
+ class: "tabula-find-toggle",
4578
+ "aria-pressed": v.value,
4579
+ title: d.value.matchCase,
4580
+ "aria-label": d.value.matchCase,
4581
+ onClick: n[5] ||= (e) => v.value = !v.value
4582
+ }, " Aa ", 8, Ji),
4583
+ a("button", {
4584
+ type: "button",
4585
+ class: "tabula-find-toggle",
4586
+ "aria-pressed": S.value,
4587
+ title: d.value.whole,
4588
+ onClick: n[6] ||= (e) => S.value = !S.value
4589
+ }, b(d.value.wholeShort), 9, Yi),
4590
+ a("span", Xi, b(ne.value), 1),
4591
+ a("button", {
4592
+ type: "button",
4593
+ class: "tabula-find-icon",
4594
+ "aria-label": d.value.previous,
4595
+ disabled: T.value.length === 0,
4596
+ onClick: n[7] ||= (e) => se(-1)
4597
+ }, [...n[9] ||= [a("svg", {
4598
+ viewBox: "0 0 24 24",
4599
+ "aria-hidden": "true"
4600
+ }, [a("path", { d: "m18 15-6-6-6 6" })], -1)]], 8, Zi),
4601
+ a("button", {
4602
+ type: "button",
4603
+ class: "tabula-find-icon",
4604
+ "aria-label": d.value.next,
4605
+ disabled: T.value.length === 0,
4606
+ onClick: n[8] ||= (e) => se(1)
4607
+ }, [...n[10] ||= [a("svg", {
4608
+ viewBox: "0 0 24 24",
4609
+ "aria-hidden": "true"
4610
+ }, [a("path", { d: "m6 9 6 6 6-6" })], -1)]], 8, Qi),
4611
+ a("span", $i, [
4612
+ E.value ? (h(), i("span", ea, b(E.value), 1)) : r("", !0),
4613
+ a("button", {
4614
+ type: "button",
4615
+ class: "tabula-find-button",
4616
+ disabled: T.value.length === 0,
4617
+ onClick: ue
4618
+ }, b(d.value.replaceOne), 9, ta),
4619
+ a("button", {
4620
+ type: "button",
4621
+ class: "tabula-find-button is-primary",
4622
+ disabled: T.value.length === 0,
4623
+ onClick: de
4624
+ }, b(d.value.replaceAll), 9, na),
4625
+ a("button", {
4626
+ type: "button",
4627
+ class: "tabula-find-icon",
4628
+ "aria-label": d.value.close,
4629
+ onClick: fe
4630
+ }, [...n[11] ||= [a("svg", {
4631
+ viewBox: "0 0 24 24",
4632
+ "aria-hidden": "true"
4633
+ }, [a("path", { d: "M18 6 6 18M6 6l12 12" })], -1)]], 8, ra)
4634
+ ])
4635
+ ], 8, Vi)) : r("", !0);
4636
+ }
4637
+ });
4638
+ export { Be as BAR_TEXT, Re as DRAFT_TEXT, Ve as FIND_TEXT, H as GRID_TEXT, Ie as PANEL_TEXT, Le as PREVIEW_TEXT, ze as TABS_TEXT, bi as TabulaDraftMapping, aa as TabulaFind, sr as TabulaFormulaBar, Dn as TabulaGrid, tr as TabulaIssues, Vr as TabulaPreview, Bi as TabulaSheetTabs, _r as TabulaStatusBar, je as columnName, Ye as dateExample, Ue as describeCheck, qe as functionHelp, He as issueText, Me as parseAddress };
4639
+
4640
+ //# sourceMappingURL=index.js.map