@extable/core 0.3.7 → 0.3.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,16 +1,16 @@
1
- import { D as ft, R as lt, g as Y, c as Ft, s as ne, r as O, m as rt, a as pt, b as mt, d as ct, e as ht, t as $e, C as at, f as Mt, h as Rt, i as Ot, j as Kt, k as de, H as st, l as ut, p as We, n as Vt, o as se, q as le, u as Oe, v as je, w as qe, x as re, y as ze } from "./numberIO-CGTV3-KW.js";
2
- function Ue(c) {
1
+ import { D as wt, R as ct, g as J, c as Bt, s as ae, r as O, m as ht, a as vt, b as bt, d as ut, e as ft, t as Ue, C as dt, f as Et, h as At, i as Ut, j as Nt, k as ge, H as at, l as yt, p as Xe, n as Wt, o as ce, q as he, u as Ge, v as Ye, w as Qe, x as de, y as Je } from "./numberIO-UZ5ksMqf.js";
2
+ function Ze(c) {
3
3
  const t = c.payload;
4
4
  if (!t) return null;
5
5
  const e = t.batchId;
6
6
  return typeof e == "string" && e.length ? e : null;
7
7
  }
8
- class Xe {
8
+ class ti {
9
9
  constructor(t = 100) {
10
10
  this.applied = [], this.undone = [], this.cap = t;
11
11
  }
12
12
  enqueue(t) {
13
- const e = Ue(t), i = this.applied.at(-1);
13
+ const e = Ze(t), i = this.applied.at(-1);
14
14
  for (e && i && i.batchId === e ? i.commands.push(t) : this.applied.push({ batchId: e, commands: [t] }); this.applied.length > this.cap; ) this.applied.shift();
15
15
  this.undone = [];
16
16
  }
@@ -43,7 +43,7 @@ class Xe {
43
43
  this.applied = [], this.undone = [];
44
44
  }
45
45
  }
46
- function Ge(c, t) {
46
+ function ei(c, t) {
47
47
  const e = c.getSchema(), i = c.listRows(), o = (s, l) => {
48
48
  if (!Number.isInteger(s) || !Number.isInteger(l) || s < 0 || s >= i.length || l < 0 || l >= e.columns.length) return null;
49
49
  const a = i[s], r = e.columns[l];
@@ -68,7 +68,7 @@ function Ge(c, t) {
68
68
  }
69
69
  return null;
70
70
  }
71
- class Ye {
71
+ class ii {
72
72
  constructor(t, e, i) {
73
73
  this.lockedRows = /* @__PURE__ */ new Set(), this.mode = "none", this.mode = t, this.server = e, this.user = i;
74
74
  }
@@ -109,7 +109,7 @@ class Ye {
109
109
  return new Set(this.lockedRows);
110
110
  }
111
111
  }
112
- const xt = (c) => c.trim().normalize("NFKC").toLowerCase().replace(/\s+/g, " "), Qe = (c) => {
112
+ const It = (c) => c.trim().normalize("NFKC").toLowerCase().replace(/\s+/g, " "), oi = (c) => {
113
113
  const t = [];
114
114
  if (c)
115
115
  for (const e of c) {
@@ -117,7 +117,7 @@ const xt = (c) => c.trim().normalize("NFKC").toLowerCase().replace(/\s+/g, " "),
117
117
  !i || t.includes(i) || t.push(i);
118
118
  }
119
119
  return t.length === 0 ? t.push("en") : t.includes("en") || t.push("en"), t;
120
- }, Je = (c, t) => {
120
+ }, ni = (c, t) => {
121
121
  const e = c.items.indexOf(t);
122
122
  if (e !== -1)
123
123
  return e;
@@ -128,17 +128,17 @@ const xt = (c) => c.trim().normalize("NFKC").toLowerCase().replace(/\s+/g, " "),
128
128
  return null;
129
129
  const o = c.items.indexOf(i);
130
130
  return o === -1 ? null : o;
131
- }, Ze = (c, t) => {
132
- const e = xt(t);
133
- if (xt(c.id).includes(e))
131
+ }, si = (c, t) => {
132
+ const e = It(t);
133
+ if (It(c.id).includes(e))
134
134
  return !0;
135
135
  for (const i of c.items)
136
- if (xt(i).includes(e))
136
+ if (It(i).includes(e))
137
137
  return !0;
138
138
  return c.aliases ? Object.keys(c.aliases).some(
139
- (i) => xt(i).includes(e)
139
+ (i) => It(i).includes(e)
140
140
  ) : !1;
141
- }, ti = (c, t) => {
141
+ }, li = (c, t) => {
142
142
  if (c.langs.length === 0)
143
143
  return 0;
144
144
  let e = Number.POSITIVE_INFINITY;
@@ -147,10 +147,10 @@ const xt = (c) => c.trim().normalize("NFKC").toLowerCase().replace(/\s+/g, " "),
147
147
  o !== -1 && o < e && (e = o);
148
148
  }
149
149
  return e;
150
- }, ei = (c, t) => !c.langs || c.langs.length === 0 ? !0 : c.langs.some((e) => t.includes(e));
151
- class ii {
150
+ }, ri = (c, t) => !c.langs || c.langs.length === 0 ? !0 : c.langs.some((e) => t.includes(e));
151
+ class ai {
152
152
  constructor(t) {
153
- this.lists = [], this.matchers = [], this.langs = Qe(t?.langs);
153
+ this.lists = [], this.matchers = [], this.langs = oi(t?.langs);
154
154
  }
155
155
  register(t) {
156
156
  const e = this.lists.findIndex((i) => i.id === t.id);
@@ -170,7 +170,7 @@ class ii {
170
170
  e = e.filter((n) => o.has(n.id));
171
171
  }
172
172
  const i = t?.queryText;
173
- return i && (e = e.filter((o) => Ze(o, i))), e;
173
+ return i && (e = e.filter((o) => si(o, i))), e;
174
174
  }
175
175
  match(t, e) {
176
176
  if (t.length === 0)
@@ -178,7 +178,7 @@ class ii {
178
178
  let i = null, o = Number.NEGATIVE_INFINITY;
179
179
  const n = e?.enabledIds ? new Set(e.enabledIds) : null;
180
180
  for (const l of this.matchers) {
181
- if (n && !n.has(l.id) || !ei(l, this.langs))
181
+ if (n && !n.has(l.id) || !ri(l, this.langs))
182
182
  continue;
183
183
  const a = l.match(t);
184
184
  if (!a)
@@ -191,12 +191,12 @@ class ii {
191
191
  state: a.state
192
192
  });
193
193
  }
194
- const s = this.list(e).map((l) => ({ list: l, rank: ti(l, this.langs) })).filter((l) => Number.isFinite(l.rank)).sort((l, a) => l.rank - a.rank);
194
+ const s = this.list(e).map((l) => ({ list: l, rank: li(l, this.langs) })).filter((l) => Number.isFinite(l.rank)).sort((l, a) => l.rank - a.rank);
195
195
  for (const { list: l, rank: a } of s) {
196
196
  const r = [];
197
197
  let h = !1;
198
198
  for (const p of t) {
199
- const m = Je(l, p);
199
+ const m = ni(l, p);
200
200
  if (m === null) {
201
201
  h = !0;
202
202
  break;
@@ -208,8 +208,8 @@ class ii {
208
208
  const d = this.inferStep(l, r);
209
209
  if (d === null)
210
210
  continue;
211
- const u = 10 - a;
212
- u > o && (o = u, i = {
211
+ const f = 10 - a;
212
+ f > o && (o = f, i = {
213
213
  kind: "list",
214
214
  list: l,
215
215
  startIndex: r[r.length - 1] ?? 0,
@@ -244,12 +244,12 @@ class ii {
244
244
  return n >= e ? null : n;
245
245
  }
246
246
  }
247
- const oi = {
247
+ const ci = {
248
248
  id: "weekdays-en-long",
249
249
  mode: "cycle",
250
250
  langs: ["en"],
251
251
  items: ["Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"]
252
- }, ni = {
252
+ }, hi = {
253
253
  id: "weekdays-en-short",
254
254
  mode: "cycle",
255
255
  langs: ["en"],
@@ -259,22 +259,22 @@ const oi = {
259
259
  Thur: "Thu",
260
260
  Thurs: "Thu"
261
261
  }
262
- }, si = {
262
+ }, di = {
263
263
  id: "weekdays-ja-long",
264
264
  mode: "cycle",
265
265
  langs: ["ja"],
266
266
  items: ["月曜日", "火曜日", "水曜日", "木曜日", "金曜日", "土曜日", "日曜日"]
267
- }, li = {
267
+ }, ui = {
268
268
  id: "weekdays-ja-short",
269
269
  mode: "cycle",
270
270
  langs: ["ja"],
271
271
  items: ["月曜", "火曜", "水曜", "木曜", "金曜", "土曜", "日曜"]
272
- }, ri = {
272
+ }, fi = {
273
273
  id: "weekdays-ja-single",
274
274
  mode: "cycle",
275
275
  langs: ["ja"],
276
276
  items: ["月", "火", "水", "木", "金", "土", "日"]
277
- }, ai = {
277
+ }, pi = {
278
278
  id: "months-en-long",
279
279
  mode: "cycle",
280
280
  langs: ["en"],
@@ -292,7 +292,7 @@ const oi = {
292
292
  "November",
293
293
  "December"
294
294
  ]
295
- }, ci = {
295
+ }, mi = {
296
296
  id: "months-en-short",
297
297
  mode: "cycle",
298
298
  langs: ["en"],
@@ -300,32 +300,32 @@ const oi = {
300
300
  aliases: {
301
301
  Sept: "Sep"
302
302
  }
303
- }, hi = {
303
+ }, gi = {
304
304
  id: "months-ja",
305
305
  mode: "cycle",
306
306
  langs: ["ja"],
307
307
  items: ["1月", "2月", "3月", "4月", "5月", "6月", "7月", "8月", "9月", "10月", "11月", "12月"]
308
- }, di = {
308
+ }, yi = {
309
309
  id: "months-ja-traditional",
310
310
  mode: "cycle",
311
311
  langs: ["ja"],
312
312
  items: ["睦月", "如月", "弥生", "卯月", "皐月", "水無月", "文月", "葉月", "長月", "神無月", "霜月", "師走"]
313
- }, ui = {
313
+ }, wi = {
314
314
  id: "quarters-en",
315
315
  mode: "cycle",
316
316
  langs: ["en"],
317
317
  items: ["Q1", "Q2", "Q3", "Q4"]
318
- }, fi = {
318
+ }, vi = {
319
319
  id: "quarters-ja",
320
320
  mode: "cycle",
321
321
  langs: ["ja"],
322
322
  items: ["第1四半期", "第2四半期", "第3四半期", "第4四半期"]
323
- }, pi = {
323
+ }, bi = {
324
324
  id: "zodiac-animals-ja",
325
325
  mode: "cycle",
326
326
  langs: ["ja"],
327
327
  items: ["子", "丑", "寅", "卯", "辰", "巳", "午", "未", "申", "酉", "戌", "亥"]
328
- }, mi = {
328
+ }, Ci = {
329
329
  id: "zodiac-signs-en",
330
330
  mode: "cycle",
331
331
  langs: ["en"],
@@ -343,7 +343,7 @@ const oi = {
343
343
  "Aquarius",
344
344
  "Pisces"
345
345
  ]
346
- }, gi = {
346
+ }, xi = {
347
347
  id: "zodiac-signs-ja",
348
348
  mode: "cycle",
349
349
  langs: ["ja"],
@@ -351,7 +351,7 @@ const oi = {
351
351
  aliases: {
352
352
  さそり座: "蠍座"
353
353
  }
354
- }, yi = {
354
+ }, Si = {
355
355
  id: "directions-16-en",
356
356
  mode: "cycle",
357
357
  langs: ["en"],
@@ -373,7 +373,7 @@ const oi = {
373
373
  "Northwest",
374
374
  "North-Northwest"
375
375
  ]
376
- }, wi = {
376
+ }, Ri = {
377
377
  id: "directions-16-ja",
378
378
  mode: "cycle",
379
379
  langs: ["ja"],
@@ -395,7 +395,7 @@ const oi = {
395
395
  "北西",
396
396
  "北北西"
397
397
  ]
398
- }, vi = {
398
+ }, Mi = {
399
399
  id: "ampm-en",
400
400
  mode: "cycle",
401
401
  langs: ["en"],
@@ -404,12 +404,12 @@ const oi = {
404
404
  "A.M.": "AM",
405
405
  "P.M.": "PM"
406
406
  }
407
- }, Ci = {
407
+ }, ki = {
408
408
  id: "ampm-ja",
409
409
  mode: "cycle",
410
410
  langs: ["ja"],
411
411
  items: ["午前", "午後"]
412
- }, bi = {
412
+ }, Ii = {
413
413
  id: "seasons-en",
414
414
  mode: "cycle",
415
415
  langs: ["en"],
@@ -417,17 +417,17 @@ const oi = {
417
417
  aliases: {
418
418
  Fall: "Autumn"
419
419
  }
420
- }, xi = {
420
+ }, Ti = {
421
421
  id: "seasons-ja",
422
422
  mode: "cycle",
423
423
  langs: ["ja"],
424
424
  items: ["春", "夏", "秋", "冬"]
425
- }, Si = {
425
+ }, Ei = {
426
426
  id: "solfege-ja",
427
427
  mode: "cycle",
428
428
  langs: ["ja"],
429
429
  items: ["ド", "レ", "ミ", "ファ", "ソ", "ラ", "シ"]
430
- }, Mi = {
430
+ }, Ai = {
431
431
  id: "solfege-en",
432
432
  mode: "cycle",
433
433
  langs: ["en"],
@@ -436,7 +436,7 @@ const oi = {
436
436
  So: "Sol",
437
437
  Si: "Ti"
438
438
  }
439
- }, Ri = {
439
+ }, Hi = {
440
440
  id: "greek-letters-en",
441
441
  mode: "cycle",
442
442
  langs: ["en"],
@@ -466,7 +466,7 @@ const oi = {
466
466
  "Psi",
467
467
  "Omega"
468
468
  ]
469
- }, ki = {
469
+ }, Li = {
470
470
  id: "greek-letters-ja",
471
471
  mode: "cycle",
472
472
  langs: ["ja"],
@@ -496,7 +496,7 @@ const oi = {
496
496
  "プサイ",
497
497
  "オメガ"
498
498
  ]
499
- }, Ii = {
499
+ }, Di = {
500
500
  id: "greek-letters-symbols",
501
501
  mode: "cycle",
502
502
  langs: ["en", "ja"],
@@ -529,37 +529,37 @@ const oi = {
529
529
  aliases: {
530
530
  ς: "σ"
531
531
  }
532
- }, Ti = {
532
+ }, Ki = {
533
533
  id: "rokuyo-ja",
534
534
  mode: "cycle",
535
535
  langs: ["ja"],
536
536
  items: ["先勝", "友引", "先負", "仏滅", "大安", "赤口"]
537
- }, Ei = {
537
+ }, _i = {
538
538
  id: "heavenly-stems-ja",
539
539
  mode: "finite",
540
540
  langs: ["ja"],
541
541
  items: ["甲", "乙", "丙", "丁", "戊", "己", "庚", "辛", "壬", "癸"]
542
- }, Ai = {
542
+ }, Fi = {
543
543
  id: "planets-en",
544
544
  mode: "finite",
545
545
  langs: ["en"],
546
546
  items: ["Mercury", "Venus", "Earth", "Mars", "Jupiter", "Saturn", "Uranus", "Neptune"]
547
- }, Hi = {
547
+ }, Vi = {
548
548
  id: "planets-ja",
549
549
  mode: "finite",
550
550
  langs: ["ja"],
551
551
  items: ["水星", "金星", "地球", "火星", "木星", "土星", "天王星", "海王星"]
552
- }, Li = {
552
+ }, Ni = {
553
553
  id: "kuji-in-ja",
554
554
  mode: "finite",
555
555
  langs: ["ja"],
556
556
  items: ["臨", "兵", "闘", "者", "皆", "陣", "烈", "在", "前"]
557
- }, Di = {
557
+ }, Pi = {
558
558
  id: "eight-virtues-ja",
559
559
  mode: "finite",
560
560
  langs: ["ja"],
561
561
  items: ["仁", "義", "礼", "智", "忠", "信", "孝", "悌"]
562
- }, Ki = {
562
+ }, Bi = {
563
563
  id: "element-symbols",
564
564
  mode: "finite",
565
565
  langs: ["ja", "en"],
@@ -683,7 +683,7 @@ const oi = {
683
683
  "Ts",
684
684
  "Og"
685
685
  ]
686
- }, _i = {
686
+ }, Wi = {
687
687
  id: "element-names-ja",
688
688
  mode: "finite",
689
689
  langs: ["ja"],
@@ -807,7 +807,7 @@ const oi = {
807
807
  "テネシン",
808
808
  "オガネソン"
809
809
  ]
810
- }, Fi = {
810
+ }, $i = {
811
811
  id: "shoguns-kamakura-ja",
812
812
  mode: "finite",
813
813
  langs: ["ja"],
@@ -822,7 +822,7 @@ const oi = {
822
822
  "久明親王",
823
823
  "守邦親王"
824
824
  ]
825
- }, Vi = {
825
+ }, Oi = {
826
826
  id: "shoguns-ashikaga-ja",
827
827
  mode: "finite",
828
828
  langs: ["ja"],
@@ -843,7 +843,7 @@ const oi = {
843
843
  "足利義栄",
844
844
  "足利義昭"
845
845
  ]
846
- }, Ni = {
846
+ }, ji = {
847
847
  id: "shoguns-ashikaga-given-ja",
848
848
  mode: "finite",
849
849
  langs: ["ja"],
@@ -864,7 +864,7 @@ const oi = {
864
864
  "義栄",
865
865
  "義昭"
866
866
  ]
867
- }, Pi = {
867
+ }, qi = {
868
868
  id: "shoguns-tokugawa-ja",
869
869
  mode: "finite",
870
870
  langs: ["ja"],
@@ -885,7 +885,7 @@ const oi = {
885
885
  "徳川家茂",
886
886
  "徳川慶喜"
887
887
  ]
888
- }, Bi = {
888
+ }, zi = {
889
889
  id: "shoguns-tokugawa-given-ja",
890
890
  mode: "finite",
891
891
  langs: ["ja"],
@@ -906,7 +906,7 @@ const oi = {
906
906
  "家茂",
907
907
  "慶喜"
908
908
  ]
909
- }, ue = [
909
+ }, ye = [
910
910
  "北海道",
911
911
  "青森県",
912
912
  "岩手県",
@@ -954,7 +954,7 @@ const oi = {
954
954
  "宮崎県",
955
955
  "鹿児島県",
956
956
  "沖縄県"
957
- ], $i = ue.reduce(
957
+ ], Ui = ye.reduce(
958
958
  (c, t) => {
959
959
  if (t === "北海道")
960
960
  return c;
@@ -965,13 +965,13 @@ const oi = {
965
965
  return c;
966
966
  },
967
967
  {}
968
- ), Wi = {
968
+ ), Xi = {
969
969
  id: "prefectures-ja",
970
970
  mode: "finite",
971
971
  langs: ["ja"],
972
- items: ue,
973
- aliases: $i
974
- }, Oi = {
972
+ items: ye,
973
+ aliases: Ui
974
+ }, Gi = {
975
975
  id: "us-states-en",
976
976
  mode: "finite",
977
977
  langs: ["en"],
@@ -1027,7 +1027,7 @@ const oi = {
1027
1027
  "Wisconsin",
1028
1028
  "Wyoming"
1029
1029
  ]
1030
- }, ji = {
1030
+ }, Yi = {
1031
1031
  id: "us-states-abbrev-en",
1032
1032
  mode: "finite",
1033
1033
  langs: ["en"],
@@ -1083,7 +1083,7 @@ const oi = {
1083
1083
  "WI",
1084
1084
  "WY"
1085
1085
  ]
1086
- }, qi = {
1086
+ }, Qi = {
1087
1087
  id: "windows-versions",
1088
1088
  mode: "finite",
1089
1089
  langs: ["ja", "en"],
@@ -1106,7 +1106,7 @@ const oi = {
1106
1106
  "Windows 10",
1107
1107
  "Windows 11"
1108
1108
  ]
1109
- }, zi = {
1109
+ }, Ji = {
1110
1110
  id: "macos-versions",
1111
1111
  mode: "finite",
1112
1112
  langs: ["ja", "en"],
@@ -1134,7 +1134,7 @@ const oi = {
1134
1134
  "Sequoia",
1135
1135
  "Tahoe"
1136
1136
  ]
1137
- }, Ui = {
1137
+ }, Zi = {
1138
1138
  id: "debian-codenames",
1139
1139
  mode: "finite",
1140
1140
  langs: ["ja", "en"],
@@ -1158,13 +1158,7 @@ const oi = {
1158
1158
  "bookworm",
1159
1159
  "trixie"
1160
1160
  ]
1161
- }, Xi = [
1162
- oi,
1163
- ni,
1164
- si,
1165
- li,
1166
- ri,
1167
- ai,
1161
+ }, to = [
1168
1162
  ci,
1169
1163
  hi,
1170
1164
  di,
@@ -1176,12 +1170,12 @@ const oi = {
1176
1170
  yi,
1177
1171
  wi,
1178
1172
  vi,
1179
- Ci,
1180
1173
  bi,
1174
+ Ci,
1181
1175
  xi,
1182
1176
  Si,
1183
- Mi,
1184
1177
  Ri,
1178
+ Mi,
1185
1179
  ki,
1186
1180
  Ii,
1187
1181
  Ti,
@@ -1198,17 +1192,23 @@ const oi = {
1198
1192
  Pi,
1199
1193
  Bi,
1200
1194
  Wi,
1195
+ $i,
1201
1196
  Oi,
1202
1197
  ji,
1203
1198
  qi,
1204
1199
  zi,
1205
- Ui
1206
- ], Tt = (c) => {
1200
+ Xi,
1201
+ Gi,
1202
+ Yi,
1203
+ Qi,
1204
+ Ji,
1205
+ Zi
1206
+ ], Dt = (c) => {
1207
1207
  const t = c % 100;
1208
1208
  if (t >= 11 && t <= 13) return "th";
1209
1209
  const e = c % 10;
1210
1210
  return e === 1 ? "st" : e === 2 ? "nd" : e === 3 ? "rd" : "th";
1211
- }, Nt = {
1211
+ }, $t = {
1212
1212
  1: "first",
1213
1213
  2: "second",
1214
1214
  3: "third",
@@ -1228,7 +1228,7 @@ const oi = {
1228
1228
  17: "seventeenth",
1229
1229
  18: "eighteenth",
1230
1230
  19: "nineteenth"
1231
- }, Pt = {
1231
+ }, Ot = {
1232
1232
  20: "twentieth",
1233
1233
  30: "thirtieth",
1234
1234
  40: "fortieth",
@@ -1237,7 +1237,7 @@ const oi = {
1237
1237
  70: "seventieth",
1238
1238
  80: "eightieth",
1239
1239
  90: "ninetieth"
1240
- }, fe = {
1240
+ }, we = {
1241
1241
  20: "twenty",
1242
1242
  30: "thirty",
1243
1243
  40: "forty",
@@ -1246,46 +1246,46 @@ const oi = {
1246
1246
  70: "seventy",
1247
1247
  80: "eighty",
1248
1248
  90: "ninety"
1249
- }, ae = Object.fromEntries(
1250
- Object.entries(Nt).map(([c, t]) => [t, Number(c)])
1251
- ), Gi = Object.fromEntries(
1252
- Object.entries(Pt).map(([c, t]) => [t, Number(c)])
1253
- ), Yi = Object.fromEntries(
1254
- Object.entries(fe).map(([c, t]) => [t, Number(c)])
1255
- ), pe = (c) => {
1249
+ }, ue = Object.fromEntries(
1250
+ Object.entries($t).map(([c, t]) => [t, Number(c)])
1251
+ ), eo = Object.fromEntries(
1252
+ Object.entries(Ot).map(([c, t]) => [t, Number(c)])
1253
+ ), io = Object.fromEntries(
1254
+ Object.entries(we).map(([c, t]) => [t, Number(c)])
1255
+ ), ve = (c) => {
1256
1256
  const t = c.trim().toLowerCase();
1257
1257
  if (!t) return null;
1258
- const e = ae[t] ?? Gi[t];
1258
+ const e = ue[t] ?? eo[t];
1259
1259
  if (e) return e;
1260
1260
  const i = t.split(/[-\s]+/);
1261
1261
  if (i.length !== 2) return null;
1262
- const o = Yi[i[0] ?? ""], n = ae[i[1] ?? ""];
1262
+ const o = io[i[0] ?? ""], n = ue[i[1] ?? ""];
1263
1263
  return !o || !n ? null : o + n;
1264
- }, me = (c) => {
1264
+ }, be = (c) => {
1265
1265
  if (!Number.isFinite(c) || c <= 0 || Math.floor(c) !== c) return null;
1266
- if (c <= 19) return Nt[c] ?? null;
1266
+ if (c <= 19) return $t[c] ?? null;
1267
1267
  if (c < 100) {
1268
- if (Pt[c]) return Pt[c] ?? null;
1269
- const t = Math.floor(c / 10) * 10, e = c % 10, i = fe[t], o = Nt[e];
1268
+ if (Ot[c]) return Ot[c] ?? null;
1269
+ const t = Math.floor(c / 10) * 10, e = c % 10, i = we[t], o = $t[e];
1270
1270
  return !i || !o ? null : `${i}-${o}`;
1271
1271
  }
1272
1272
  return null;
1273
- }, ce = (c) => {
1273
+ }, fe = (c) => {
1274
1274
  const t = /^(\d+)(st|nd|rd|th)$/i.exec(c);
1275
1275
  if (t) {
1276
1276
  const i = Number(t[1]);
1277
1277
  if (!Number.isFinite(i) || i <= 0) return null;
1278
1278
  const o = t[2]?.toLowerCase();
1279
- return Tt(i) !== o ? null : { value: i, format: "numeric" };
1279
+ return Dt(i) !== o ? null : { value: i, format: "numeric" };
1280
1280
  }
1281
- const e = pe(c);
1281
+ const e = ve(c);
1282
1282
  return e !== null ? { value: e, format: "word" } : null;
1283
- }, Qi = {
1283
+ }, oo = {
1284
1284
  id: "ordinal-en",
1285
1285
  langs: ["en"],
1286
1286
  match(c) {
1287
1287
  if (c.length < 2) return null;
1288
- const t = c.map((n) => ce(n));
1288
+ const t = c.map((n) => fe(n));
1289
1289
  if (t.some((n) => n === null)) return null;
1290
1290
  const e = t[0].format;
1291
1291
  if (t.some((n) => n?.format !== e)) return null;
@@ -1295,29 +1295,29 @@ const oi = {
1295
1295
  return { score: 80, step: o, state: { format: e } };
1296
1296
  },
1297
1297
  createIterator(c, t) {
1298
- const e = ce(c[c.length - 1] ?? ""), i = t.state?.format ?? "numeric";
1298
+ const e = fe(c[c.length - 1] ?? ""), i = t.state?.format ?? "numeric";
1299
1299
  let o = e?.value ?? 0;
1300
1300
  return {
1301
1301
  next() {
1302
1302
  if (o += t.step, o <= 0 || !Number.isFinite(o))
1303
1303
  return { value: void 0, done: !0 };
1304
1304
  if (i === "word") {
1305
- const n = me(o);
1305
+ const n = be(o);
1306
1306
  return n ? { value: n, done: !1 } : { value: void 0, done: !0 };
1307
1307
  }
1308
- return { value: `${o}${Tt(o)}`, done: !1 };
1308
+ return { value: `${o}${Dt(o)}`, done: !1 };
1309
1309
  }
1310
1310
  };
1311
1311
  }
1312
- }, Ji = (c) => {
1313
- for (const t of Xi)
1312
+ }, no = (c) => {
1313
+ for (const t of to)
1314
1314
  c.register(t);
1315
- }, Zi = (c) => {
1316
- c.registerMatch(Qi);
1317
- }, ge = (c) => {
1318
- const t = c ?? ["en", "ja"], e = new ii({ langs: t });
1319
- return Ji(e), Zi(e), e;
1320
- }, to = (c) => {
1315
+ }, so = (c) => {
1316
+ c.registerMatch(oo);
1317
+ }, Ce = (c) => {
1318
+ const t = c ?? ["en", "ja"], e = new ai({ langs: t });
1319
+ return no(e), so(e), e;
1320
+ }, lo = (c) => {
1321
1321
  let t = 0;
1322
1322
  return {
1323
1323
  next() {
@@ -1328,13 +1328,13 @@ const oi = {
1328
1328
  }
1329
1329
  };
1330
1330
  };
1331
- class G {
1331
+ class Q {
1332
1332
  constructor(...t) {
1333
1333
  const e = t;
1334
- this.seed = e, this.kind = e.length === 1 ? "copy" : "seed-repeat", this.iterator = to(e);
1334
+ this.seed = e, this.kind = e.length === 1 ? "copy" : "seed-repeat", this.iterator = lo(e);
1335
1335
  }
1336
1336
  static fromSeed(t, e, i) {
1337
- const o = new G(...t);
1337
+ const o = new Q(...t);
1338
1338
  return o.kind = e, o.iterator = i, o;
1339
1339
  }
1340
1340
  next() {
@@ -1344,11 +1344,11 @@ class G {
1344
1344
  return this;
1345
1345
  }
1346
1346
  }
1347
- const ye = 1e-9, eo = 100, io = (c) => ({
1347
+ const xe = 1e-9, ro = 100, ao = (c) => ({
1348
1348
  next() {
1349
1349
  return { value: c, done: !1 };
1350
1350
  }
1351
- }), he = (c) => {
1351
+ }), pe = (c) => {
1352
1352
  let t = 0;
1353
1353
  return {
1354
1354
  next() {
@@ -1358,28 +1358,28 @@ const ye = 1e-9, eo = 100, io = (c) => ({
1358
1358
  return t += 1, { value: e, done: !1 };
1359
1359
  }
1360
1360
  };
1361
- }, oo = (c, t) => {
1361
+ }, co = (c, t) => {
1362
1362
  let e = 0;
1363
1363
  return {
1364
1364
  next() {
1365
1365
  return e += 1, { value: c + t * e, done: !1 };
1366
1366
  }
1367
1367
  };
1368
- }, no = (c, t) => {
1368
+ }, ho = (c, t) => {
1369
1369
  let e = 0;
1370
1370
  return {
1371
1371
  next() {
1372
1372
  return e += 1, { value: new Date(c.getTime() + t * e), done: !1 };
1373
1373
  }
1374
1374
  };
1375
- }, so = (c, t) => {
1375
+ }, uo = (c, t) => {
1376
1376
  let e = 0;
1377
1377
  return {
1378
1378
  next() {
1379
1379
  return e += 1, { value: c * t ** e, done: !1 };
1380
1380
  }
1381
1381
  };
1382
- }, lo = (c, t) => {
1382
+ }, fo = (c, t) => {
1383
1383
  if (c.kind === "matcher")
1384
1384
  return c.matcher.createIterator(t, { step: c.step, state: c.state });
1385
1385
  const { list: e, startIndex: i, step: o } = c, n = e.items.length;
@@ -1393,7 +1393,7 @@ const ye = 1e-9, eo = 100, io = (c) => ({
1393
1393
  return s = (s + o) % n, { value: e.items[s], done: !1 };
1394
1394
  }
1395
1395
  };
1396
- }, ro = (c) => c.every((t) => typeof t == "number" && Number.isFinite(t)), ao = (c) => c.every((t) => t instanceof Date && !Number.isNaN(t.getTime())), co = (c) => c.every((t) => typeof t == "string"), ho = (c) => {
1396
+ }, po = (c) => c.every((t) => typeof t == "number" && Number.isFinite(t)), mo = (c) => c.every((t) => t instanceof Date && !Number.isNaN(t.getTime())), go = (c) => c.every((t) => typeof t == "string"), yo = (c) => {
1397
1397
  const t = /^(.*?)(-?\d+)([^0-9]*)$/.exec(c);
1398
1398
  if (!t)
1399
1399
  return null;
@@ -1402,13 +1402,13 @@ const ye = 1e-9, eo = 100, io = (c) => ({
1402
1402
  return null;
1403
1403
  const s = i.replace("-", "").length;
1404
1404
  return { prefix: e, num: n, width: s, suffix: o };
1405
- }, uo = (c) => {
1405
+ }, wo = (c) => {
1406
1406
  const t = /^(.*?)(\d+)(st|nd|rd|th)([^0-9]*)$/i.exec(c);
1407
1407
  if (t) {
1408
1408
  const o = Number(t[2]);
1409
1409
  if (!Number.isFinite(o) || o <= 0) return null;
1410
1410
  const n = t[3]?.toLowerCase();
1411
- return Tt(o) !== n ? null : {
1411
+ return Dt(o) !== n ? null : {
1412
1412
  prefix: t[1] ?? "",
1413
1413
  num: o,
1414
1414
  suffix: t[4] ?? "",
@@ -1417,14 +1417,14 @@ const ye = 1e-9, eo = 100, io = (c) => ({
1417
1417
  }
1418
1418
  const e = /^(.*?)([A-Za-z-]+)([^A-Za-z]*)$/.exec(c);
1419
1419
  if (!e) return null;
1420
- const i = pe(e[2] ?? "");
1420
+ const i = ve(e[2] ?? "");
1421
1421
  return i === null ? null : {
1422
1422
  prefix: e[1] ?? "",
1423
1423
  num: i,
1424
1424
  suffix: e[3] ?? "",
1425
1425
  format: "word"
1426
1426
  };
1427
- }, fo = (c, t, e) => {
1427
+ }, vo = (c, t, e) => {
1428
1428
  let i = 0;
1429
1429
  return {
1430
1430
  next() {
@@ -1433,16 +1433,16 @@ const ye = 1e-9, eo = 100, io = (c) => ({
1433
1433
  if (o <= 0 || !Number.isFinite(o))
1434
1434
  return { value: void 0, done: !0 };
1435
1435
  if (c.format === "word") {
1436
- const n = me(o);
1436
+ const n = be(o);
1437
1437
  return n ? { value: `${c.prefix}${n}${c.suffix}`, done: !1 } : { value: void 0, done: !0 };
1438
1438
  }
1439
1439
  return {
1440
- value: `${c.prefix}${o}${Tt(o)}${c.suffix}`,
1440
+ value: `${c.prefix}${o}${Dt(o)}${c.suffix}`,
1441
1441
  done: !1
1442
1442
  };
1443
1443
  }
1444
1444
  };
1445
- }, po = (c, t, e) => {
1445
+ }, bo = (c, t, e) => {
1446
1446
  let i = 0;
1447
1447
  return {
1448
1448
  next() {
@@ -1451,7 +1451,7 @@ const ye = 1e-9, eo = 100, io = (c) => ({
1451
1451
  return { value: `${c.prefix}${n}${s}${c.suffix}`, done: !1 };
1452
1452
  }
1453
1453
  };
1454
- }, we = [
1454
+ }, Se = [
1455
1455
  ["C", 100],
1456
1456
  ["XC", 90],
1457
1457
  ["L", 50],
@@ -1461,39 +1461,39 @@ const ye = 1e-9, eo = 100, io = (c) => ({
1461
1461
  ["V", 5],
1462
1462
  ["IV", 4],
1463
1463
  ["I", 1]
1464
- ], jt = (c) => {
1465
- if (c < 1 || c > eo)
1464
+ ], Xt = (c) => {
1465
+ if (c < 1 || c > ro)
1466
1466
  return null;
1467
1467
  let t = c, e = "";
1468
- for (const [i, o] of we)
1468
+ for (const [i, o] of Se)
1469
1469
  for (; t >= o; )
1470
1470
  e += i, t -= o;
1471
1471
  return e;
1472
- }, ve = (c) => {
1472
+ }, Re = (c) => {
1473
1473
  if (c.length === 0 || c !== c.toUpperCase())
1474
1474
  return null;
1475
1475
  let t = c, e = 0;
1476
- for (const [o, n] of we)
1476
+ for (const [o, n] of Se)
1477
1477
  for (; t.startsWith(o); )
1478
1478
  e += n, t = t.slice(o.length);
1479
1479
  if (t.length > 0)
1480
1480
  return null;
1481
- const i = jt(e);
1481
+ const i = Xt(e);
1482
1482
  return !i || i !== c ? null : e;
1483
- }, mo = (c, t) => {
1483
+ }, Co = (c, t) => {
1484
1484
  let e = 0;
1485
1485
  return {
1486
1486
  next() {
1487
1487
  e += 1;
1488
- const i = c + t * e, o = jt(i);
1488
+ const i = c + t * e, o = Xt(i);
1489
1489
  return o ? { value: o, done: !1 } : { value: void 0, done: !0 };
1490
1490
  }
1491
1491
  };
1492
- }, go = (c) => new RegExp("\\p{White_Space}", "u").test(c) ? "space" : new RegExp("\\p{P}", "u").test(c) ? "punct" : new RegExp("\\p{S}", "u").test(c) ? "symbol" : new RegExp("\\p{Script=Latin}", "u").test(c) ? "latin" : new RegExp("\\p{Script=Han}", "u").test(c) ? "han" : new RegExp("\\p{Script=Hiragana}", "u").test(c) ? "hiragana" : new RegExp("\\p{Script=Katakana}", "u").test(c) ? "katakana" : new RegExp("\\p{N}", "u").test(c) ? "number" : "other", yo = (c) => {
1492
+ }, xo = (c) => new RegExp("\\p{White_Space}", "u").test(c) ? "space" : new RegExp("\\p{P}", "u").test(c) ? "punct" : new RegExp("\\p{S}", "u").test(c) ? "symbol" : new RegExp("\\p{Script=Latin}", "u").test(c) ? "latin" : new RegExp("\\p{Script=Han}", "u").test(c) ? "han" : new RegExp("\\p{Script=Hiragana}", "u").test(c) ? "hiragana" : new RegExp("\\p{Script=Katakana}", "u").test(c) ? "katakana" : new RegExp("\\p{N}", "u").test(c) ? "number" : "other", So = (c) => {
1493
1493
  const t = [];
1494
1494
  let e = "", i = null;
1495
1495
  for (const o of c) {
1496
- const n = go(o);
1496
+ const n = xo(o);
1497
1497
  if (i === n) {
1498
1498
  e += o;
1499
1499
  continue;
@@ -1501,22 +1501,22 @@ const ye = 1e-9, eo = 100, io = (c) => ({
1501
1501
  i !== null && t.push({ value: e, group: i }), e = o, i = n;
1502
1502
  }
1503
1503
  return i !== null && t.push({ value: e, group: i }), t;
1504
- }, wo = (c) => {
1505
- const t = yo(c), e = t.map((l, a) => ({ index: a, num: ve(l.value) })).filter((l) => l.num !== null);
1504
+ }, Ro = (c) => {
1505
+ const t = So(c), e = t.map((l, a) => ({ index: a, num: Re(l.value) })).filter((l) => l.num !== null);
1506
1506
  if (e.length !== 1)
1507
1507
  return null;
1508
1508
  const i = e[0].index, o = e[0].num, n = t.slice(0, i).map((l) => l.value).join(""), s = t.slice(i + 1).map((l) => l.value).join("");
1509
1509
  return { prefix: n, num: o, suffix: s };
1510
- }, vo = (c, t, e) => {
1510
+ }, Mo = (c, t, e) => {
1511
1511
  let i = 0;
1512
1512
  return {
1513
1513
  next() {
1514
1514
  i += 1;
1515
- const o = t + e * i, n = jt(o);
1515
+ const o = t + e * i, n = Xt(o);
1516
1516
  return n ? { value: `${c.prefix}${n}${c.suffix}`, done: !1 } : { value: void 0, done: !0 };
1517
1517
  }
1518
1518
  };
1519
- }, Bt = {
1519
+ }, jt = {
1520
1520
  一: 1,
1521
1521
  二: 2,
1522
1522
  三: 3,
@@ -1526,7 +1526,7 @@ const ye = 1e-9, eo = 100, io = (c) => ({
1526
1526
  七: 7,
1527
1527
  八: 8,
1528
1528
  九: 9
1529
- }, $t = {
1529
+ }, qt = {
1530
1530
  壱: 1,
1531
1531
  弐: 2,
1532
1532
  参: 3,
@@ -1536,42 +1536,42 @@ const ye = 1e-9, eo = 100, io = (c) => ({
1536
1536
  柒: 7,
1537
1537
  捌: 8,
1538
1538
  玖: 9
1539
- }, Ce = {
1539
+ }, Me = {
1540
1540
  十: 10,
1541
1541
  拾: 10,
1542
1542
  百: 100,
1543
1543
  佰: 100,
1544
1544
  千: 1e3,
1545
1545
  仟: 1e3
1546
- }, Co = {
1546
+ }, ko = {
1547
1547
  万: 1e4,
1548
1548
  萬: 1e4
1549
- }, bo = /* @__PURE__ */ new Set([
1550
- ...Object.keys(Bt),
1551
- ...Object.keys($t),
1552
- ...Object.keys(Ce),
1553
- ...Object.keys(Co)
1554
- ]), xo = (c) => bo.has(c), So = (c) => /[壱弐参肆伍陸柒捌玖拾萬佰仟]/.test(c) ? "traditional" : "modern", be = (c) => {
1549
+ }, Io = /* @__PURE__ */ new Set([
1550
+ ...Object.keys(jt),
1551
+ ...Object.keys(qt),
1552
+ ...Object.keys(Me),
1553
+ ...Object.keys(ko)
1554
+ ]), To = (c) => Io.has(c), Eo = (c) => /[壱弐参肆伍陸柒捌玖拾萬佰仟]/.test(c) ? "traditional" : "modern", ke = (c) => {
1555
1555
  if (!c)
1556
1556
  return null;
1557
- const t = So(c);
1557
+ const t = Eo(c);
1558
1558
  if (c.includes("万") || c.includes("萬")) {
1559
1559
  const s = /^([一二三四五六七八九壱弐参肆伍陸柒捌玖])?(万|萬)$/.exec(c);
1560
1560
  if (!s)
1561
1561
  return null;
1562
1562
  const l = s[1];
1563
- return l ? (Bt[l] ?? $t[l]) !== 1 ? null : { num: 1e4, style: t } : { num: 1e4, style: t };
1563
+ return l ? (jt[l] ?? qt[l]) !== 1 ? null : { num: 1e4, style: t } : { num: 1e4, style: t };
1564
1564
  }
1565
1565
  let e = 0, i = 0, o = Number.POSITIVE_INFINITY, n = !1;
1566
1566
  for (const s of c) {
1567
- const l = Bt[s] ?? $t[s];
1567
+ const l = jt[s] ?? qt[s];
1568
1568
  if (l) {
1569
1569
  if (n)
1570
1570
  return null;
1571
1571
  i = l, n = !0;
1572
1572
  continue;
1573
1573
  }
1574
- const a = Ce[s];
1574
+ const a = Me[s];
1575
1575
  if (a) {
1576
1576
  if (a >= o)
1577
1577
  return null;
@@ -1581,13 +1581,13 @@ const ye = 1e-9, eo = 100, io = (c) => ({
1581
1581
  return null;
1582
1582
  }
1583
1583
  return e += i, e <= 0 || e > 1e4 ? null : { num: e, style: t };
1584
- }, Mo = (c) => {
1584
+ }, Ao = (c) => {
1585
1585
  const t = [];
1586
1586
  let e = "", i = 0, o = 0;
1587
1587
  for (const r of c)
1588
- xo(r) ? (e || (i = o), e += r) : e && (t.push({ start: i, end: o, text: e }), e = ""), o += r.length;
1588
+ To(r) ? (e || (i = o), e += r) : e && (t.push({ start: i, end: o, text: e }), e = ""), o += r.length;
1589
1589
  e && t.push({ start: i, end: o, text: e });
1590
- const n = t.map((r) => ({ run: r, parsed: be(r.text) })).filter((r) => r.parsed !== null);
1590
+ const n = t.map((r) => ({ run: r, parsed: ke(r.text) })).filter((r) => r.parsed !== null);
1591
1591
  if (n.length !== 1)
1592
1592
  return null;
1593
1593
  const s = n[0], l = c.slice(0, s.run.start), a = c.slice(s.run.end);
@@ -1597,7 +1597,7 @@ const ye = 1e-9, eo = 100, io = (c) => ({
1597
1597
  suffix: a,
1598
1598
  style: s.parsed.style
1599
1599
  };
1600
- }, xe = (c, t) => {
1600
+ }, Ie = (c, t) => {
1601
1601
  if (!Number.isFinite(c) || c <= 0 || c > 1e4)
1602
1602
  return null;
1603
1603
  const e = t === "traditional" ? ["", "壱", "弐", "参", "肆", "伍", "陸", "柒", "捌", "玖"] : ["", "一", "二", "三", "四", "五", "六", "七", "八", "九"], i = t === "traditional" ? "拾" : "十", o = t === "traditional" ? "萬" : "万";
@@ -1610,53 +1610,53 @@ const ye = 1e-9, eo = 100, io = (c) => ({
1610
1610
  a > 0 && (a > 1 && (s += e[a]), s += "百", n %= 100);
1611
1611
  const r = Math.floor(n / 10);
1612
1612
  return r > 0 && (r > 1 && (s += e[r]), s += i, n %= 10), n > 0 && (s += e[n]), s || null;
1613
- }, Ro = (c, t, e) => {
1613
+ }, Ho = (c, t, e) => {
1614
1614
  let i = 0;
1615
1615
  return {
1616
1616
  next() {
1617
1617
  i += 1;
1618
- const o = c + t * i, n = xe(o, e);
1618
+ const o = c + t * i, n = Ie(o, e);
1619
1619
  return n ? { value: n, done: !1 } : { value: void 0, done: !0 };
1620
1620
  }
1621
1621
  };
1622
- }, ko = (c, t, e) => {
1622
+ }, Lo = (c, t, e) => {
1623
1623
  let i = 0;
1624
1624
  return {
1625
1625
  next() {
1626
1626
  i += 1;
1627
- const o = t + e * i, n = xe(o, c.style);
1627
+ const o = t + e * i, n = Ie(o, c.style);
1628
1628
  return n ? { value: `${c.prefix}${n}${c.suffix}`, done: !1 } : { value: void 0, done: !0 };
1629
1629
  }
1630
1630
  };
1631
- }, tt = (c) => {
1631
+ }, it = (c) => {
1632
1632
  if (c.length < 2)
1633
1633
  return null;
1634
1634
  const t = c[1] - c[0];
1635
1635
  for (let e = 2; e < c.length; e += 1)
1636
- if (Math.abs(c[e] - c[e - 1] - t) > ye)
1636
+ if (Math.abs(c[e] - c[e - 1] - t) > xe)
1637
1637
  return null;
1638
1638
  return t;
1639
- }, Io = (c) => {
1639
+ }, Do = (c) => {
1640
1640
  if (c.length < 2 || c[0] === 0)
1641
1641
  return null;
1642
1642
  const t = c[1] / c[0];
1643
1643
  for (let e = 2; e < c.length; e += 1)
1644
- if (c[e - 1] === 0 || Math.abs(c[e] / c[e - 1] - t) > ye)
1644
+ if (c[e - 1] === 0 || Math.abs(c[e] / c[e - 1] - t) > xe)
1645
1645
  return null;
1646
1646
  return t;
1647
- }, To = (c) => {
1648
- const t = c.map((l) => uo(l));
1647
+ }, Ko = (c) => {
1648
+ const t = c.map((l) => wo(l));
1649
1649
  if (t.every((l) => l !== null)) {
1650
1650
  const l = t, a = l[0];
1651
1651
  if (l.every(
1652
1652
  (r) => r.prefix === a.prefix && r.suffix === a.suffix && r.format === a.format
1653
1653
  )) {
1654
- const r = l.map((d) => d.num), h = tt(r);
1654
+ const r = l.map((d) => d.num), h = it(r);
1655
1655
  if (h !== null) {
1656
1656
  const d = l[l.length - 1];
1657
1657
  return {
1658
1658
  kind: "arithmetic",
1659
- iterator: fo(
1659
+ iterator: vo(
1660
1660
  { prefix: a.prefix, suffix: a.suffix, format: a.format },
1661
1661
  d.num,
1662
1662
  h
@@ -1665,17 +1665,17 @@ const ye = 1e-9, eo = 100, io = (c) => ({
1665
1665
  }
1666
1666
  }
1667
1667
  }
1668
- const e = c.map((l) => ho(l));
1668
+ const e = c.map((l) => yo(l));
1669
1669
  if (e.every(Boolean)) {
1670
1670
  const l = e[0], a = e[e.length - 1];
1671
1671
  if (e.every(
1672
1672
  (r) => r?.prefix === l.prefix && r?.suffix === l.suffix
1673
1673
  )) {
1674
- const r = e.map((d) => d?.num ?? 0), h = tt(r);
1674
+ const r = e.map((d) => d?.num ?? 0), h = it(r);
1675
1675
  if (h !== null)
1676
1676
  return {
1677
1677
  kind: "arithmetic",
1678
- iterator: po(
1678
+ iterator: bo(
1679
1679
  { prefix: a.prefix, suffix: a.suffix, width: a.width },
1680
1680
  a.num,
1681
1681
  h
@@ -1683,43 +1683,43 @@ const ye = 1e-9, eo = 100, io = (c) => ({
1683
1683
  };
1684
1684
  }
1685
1685
  }
1686
- const i = c.map((l) => ve(l));
1686
+ const i = c.map((l) => Re(l));
1687
1687
  if (i.every((l) => l !== null)) {
1688
- const l = i, a = tt(l);
1688
+ const l = i, a = it(l);
1689
1689
  if (a !== null) {
1690
1690
  const r = l[l.length - 1];
1691
1691
  return {
1692
1692
  kind: "arithmetic",
1693
- iterator: mo(r, a)
1693
+ iterator: Co(r, a)
1694
1694
  };
1695
1695
  }
1696
1696
  }
1697
- const o = c.map((l) => be(l));
1697
+ const o = c.map((l) => ke(l));
1698
1698
  if (o.every((l) => l !== null)) {
1699
1699
  const l = o, a = l[0].style;
1700
1700
  if (l.every((r) => r.style === a)) {
1701
- const r = l.map((d) => d.num), h = tt(r);
1701
+ const r = l.map((d) => d.num), h = it(r);
1702
1702
  if (h !== null) {
1703
1703
  const d = l[l.length - 1];
1704
1704
  return {
1705
1705
  kind: "arithmetic",
1706
- iterator: Ro(d.num, h, d.style)
1706
+ iterator: Ho(d.num, h, d.style)
1707
1707
  };
1708
1708
  }
1709
1709
  }
1710
1710
  }
1711
- const n = c.map((l) => wo(l));
1711
+ const n = c.map((l) => Ro(l));
1712
1712
  if (n.every((l) => l !== null)) {
1713
1713
  const l = n, a = l[0];
1714
1714
  if (l.every(
1715
1715
  (r) => r.prefix === a.prefix && r.suffix === a.suffix
1716
1716
  )) {
1717
- const r = l.map((d) => d.num), h = tt(r);
1717
+ const r = l.map((d) => d.num), h = it(r);
1718
1718
  if (h !== null) {
1719
1719
  const d = r[r.length - 1];
1720
1720
  return {
1721
1721
  kind: "arithmetic",
1722
- iterator: vo(
1722
+ iterator: Mo(
1723
1723
  { prefix: a.prefix, suffix: a.suffix },
1724
1724
  d,
1725
1725
  h
@@ -1728,18 +1728,18 @@ const ye = 1e-9, eo = 100, io = (c) => ({
1728
1728
  }
1729
1729
  }
1730
1730
  }
1731
- const s = c.map((l) => Mo(l));
1731
+ const s = c.map((l) => Ao(l));
1732
1732
  if (s.every((l) => l !== null)) {
1733
1733
  const l = s, a = l[0];
1734
1734
  if (l.every(
1735
1735
  (r) => r.prefix === a.prefix && r.suffix === a.suffix && r.style === a.style
1736
1736
  )) {
1737
- const r = l.map((d) => d.num), h = tt(r);
1737
+ const r = l.map((d) => d.num), h = it(r);
1738
1738
  if (h !== null) {
1739
1739
  const d = l[l.length - 1];
1740
1740
  return {
1741
1741
  kind: "arithmetic",
1742
- iterator: ko(
1742
+ iterator: Lo(
1743
1743
  { prefix: a.prefix, suffix: a.suffix, style: a.style },
1744
1744
  d.num,
1745
1745
  h
@@ -1749,55 +1749,55 @@ const ye = 1e-9, eo = 100, io = (c) => ({
1749
1749
  }
1750
1750
  }
1751
1751
  return null;
1752
- }, Eo = (c, t) => {
1752
+ }, _o = (c, t) => {
1753
1753
  const e = t.match(c);
1754
1754
  return e ? {
1755
1755
  kind: "list",
1756
- iterator: lo(e, c)
1756
+ iterator: fo(e, c)
1757
1757
  } : null;
1758
1758
  };
1759
- function _t(c, t) {
1760
- const e = t?.registry ?? ge();
1759
+ function Pt(c, t) {
1760
+ const e = t?.registry ?? Ce();
1761
1761
  if (c.length === 0)
1762
- return G.fromSeed(c, "seed-repeat", he(c));
1762
+ return Q.fromSeed(c, "seed-repeat", pe(c));
1763
1763
  if (c.length === 1)
1764
- return G.fromSeed(c, "copy", io(c[0]));
1765
- if (co(c)) {
1766
- const i = Eo(c, e);
1764
+ return Q.fromSeed(c, "copy", ao(c[0]));
1765
+ if (go(c)) {
1766
+ const i = _o(c, e);
1767
1767
  if (i)
1768
- return G.fromSeed(c, i.kind, i.iterator);
1769
- const o = To(c);
1768
+ return Q.fromSeed(c, i.kind, i.iterator);
1769
+ const o = Ko(c);
1770
1770
  if (o)
1771
- return G.fromSeed(c, o.kind, o.iterator);
1771
+ return Q.fromSeed(c, o.kind, o.iterator);
1772
1772
  }
1773
- if (ro(c)) {
1774
- const i = tt(c);
1773
+ if (po(c)) {
1774
+ const i = it(c);
1775
1775
  if (i !== null)
1776
- return G.fromSeed(
1776
+ return Q.fromSeed(
1777
1777
  c,
1778
1778
  "arithmetic",
1779
- oo(c[c.length - 1], i)
1779
+ co(c[c.length - 1], i)
1780
1780
  );
1781
- const o = Io(c);
1781
+ const o = Do(c);
1782
1782
  if (o !== null)
1783
- return G.fromSeed(
1783
+ return Q.fromSeed(
1784
1784
  c,
1785
1785
  "geometric",
1786
- so(c[c.length - 1], o)
1786
+ uo(c[c.length - 1], o)
1787
1787
  );
1788
1788
  }
1789
- if (ao(c)) {
1790
- const i = c.map((n) => n.getTime()), o = tt(i);
1789
+ if (mo(c)) {
1790
+ const i = c.map((n) => n.getTime()), o = it(i);
1791
1791
  if (o !== null)
1792
- return G.fromSeed(
1792
+ return Q.fromSeed(
1793
1793
  c,
1794
1794
  "arithmetic",
1795
- no(c[c.length - 1], o)
1795
+ ho(c[c.length - 1], o)
1796
1796
  );
1797
1797
  }
1798
- return G.fromSeed(c, "seed-repeat", he(c));
1798
+ return Q.fromSeed(c, "seed-repeat", pe(c));
1799
1799
  }
1800
- function Ao(c) {
1800
+ function Fo(c) {
1801
1801
  return {
1802
1802
  ...c,
1803
1803
  startRow: Math.min(c.startRow, c.endRow),
@@ -1806,7 +1806,7 @@ function Ao(c) {
1806
1806
  endCol: Math.max(c.startCol, c.endCol)
1807
1807
  };
1808
1808
  }
1809
- function Ho(c) {
1809
+ function Vo(c) {
1810
1810
  if (c instanceof Date) return c;
1811
1811
  if (typeof c == "number" && Number.isFinite(c)) return new Date(c);
1812
1812
  if (typeof c == "string") {
@@ -1820,7 +1820,7 @@ function Ho(c) {
1820
1820
  }
1821
1821
  return null;
1822
1822
  }
1823
- function Lo(c) {
1823
+ function No(c) {
1824
1824
  if (c instanceof Date) return c;
1825
1825
  if (typeof c == "number" && Number.isFinite(c)) return new Date(c);
1826
1826
  if (typeof c == "string") {
@@ -1829,9 +1829,9 @@ function Lo(c) {
1829
1829
  }
1830
1830
  return null;
1831
1831
  }
1832
- function Se(c, t) {
1832
+ function Te(c, t) {
1833
1833
  if (t.length !== 1) return null;
1834
- const e = Ao(t[0]);
1834
+ const e = Fo(t[0]);
1835
1835
  if (e.kind !== "cells") return null;
1836
1836
  const i = e.endCol - e.startCol + 1, o = e.endRow - e.startRow + 1;
1837
1837
  if (i !== 1 || o < 1) return null;
@@ -1850,7 +1850,7 @@ function Se(c, t) {
1850
1850
  mode: "sequence"
1851
1851
  } : null : null;
1852
1852
  }
1853
- function Do(c, t, e) {
1853
+ function Po(c, t, e) {
1854
1854
  const i = c.getSchema(), o = c.listRows(), n = i.columns[t.colIndex];
1855
1855
  if (!n) return null;
1856
1856
  const s = [];
@@ -1863,14 +1863,14 @@ function Do(c, t, e) {
1863
1863
  const a = s[s.length - 1];
1864
1864
  return () => a;
1865
1865
  }
1866
- const l = ge(e);
1866
+ const l = Ce(e);
1867
1867
  if (n.type === "number") {
1868
- const a = s.map((u) => typeof u == "number" ? u : Number(u));
1869
- if (!a.every((u) => Number.isFinite(u))) return null;
1870
- const r = _t(a, { registry: l }), h = [];
1868
+ const a = s.map((f) => typeof f == "number" ? f : Number(f));
1869
+ if (!a.every((f) => Number.isFinite(f))) return null;
1870
+ const r = Pt(a, { registry: l }), h = [];
1871
1871
  let d = !1;
1872
- return (u) => {
1873
- for (; !d && h.length < u; ) {
1872
+ return (f) => {
1873
+ for (; !d && h.length < f; ) {
1874
1874
  const p = r.next();
1875
1875
  if (p.done) {
1876
1876
  d = !0;
@@ -1878,18 +1878,18 @@ function Do(c, t, e) {
1878
1878
  }
1879
1879
  h.push(p.value);
1880
1880
  }
1881
- return u <= 0 ? null : h[u - 1] ?? null;
1881
+ return f <= 0 ? null : h[f - 1] ?? null;
1882
1882
  };
1883
1883
  }
1884
1884
  if (n.type === "date" || n.type === "time" || n.type === "datetime") {
1885
1885
  const a = s.map(
1886
- (u) => n.type === "time" ? Ho(u) : Lo(u)
1886
+ (f) => n.type === "time" ? Vo(f) : No(f)
1887
1887
  );
1888
- if (!a.every((u) => u instanceof Date)) return null;
1889
- const r = _t(a, { registry: l }), h = [];
1888
+ if (!a.every((f) => f instanceof Date)) return null;
1889
+ const r = Pt(a, { registry: l }), h = [];
1890
1890
  let d = !1;
1891
- return (u) => {
1892
- for (; !d && h.length < u; ) {
1891
+ return (f) => {
1892
+ for (; !d && h.length < f; ) {
1893
1893
  const p = r.next();
1894
1894
  if (p.done) {
1895
1895
  d = !0;
@@ -1897,14 +1897,14 @@ function Do(c, t, e) {
1897
1897
  }
1898
1898
  h.push(p.value);
1899
1899
  }
1900
- return u <= 0 ? null : h[u - 1] ?? null;
1900
+ return f <= 0 ? null : h[f - 1] ?? null;
1901
1901
  };
1902
1902
  }
1903
1903
  if (n.type === "string") {
1904
- const a = s.map((u) => String(u ?? "")), r = _t(a, { registry: l }), h = [];
1904
+ const a = s.map((f) => String(f ?? "")), r = Pt(a, { registry: l }), h = [];
1905
1905
  let d = !1;
1906
- return (u) => {
1907
- for (; !d && h.length < u; ) {
1906
+ return (f) => {
1907
+ for (; !d && h.length < f; ) {
1908
1908
  const p = r.next();
1909
1909
  if (p.done) {
1910
1910
  d = !0;
@@ -1912,29 +1912,48 @@ function Do(c, t, e) {
1912
1912
  }
1913
1913
  h.push(p.value);
1914
1914
  }
1915
- return u <= 0 ? null : h[u - 1] ?? null;
1915
+ return f <= 0 ? null : h[f - 1] ?? null;
1916
1916
  };
1917
1917
  }
1918
1918
  return null;
1919
1919
  }
1920
- const Me = 12, Re = 14;
1921
- function ke(c, t = Me) {
1920
+ const Ee = 12, Ae = 14;
1921
+ function He(c, t = Ee) {
1922
1922
  return new DOMRect(c.right - t - 1, c.bottom - t - 1, t, t);
1923
1923
  }
1924
- function Ie(c, t, e) {
1924
+ function Le(c, t, e) {
1925
1925
  return c >= e.left && c <= e.right && t >= e.top && t <= e.bottom;
1926
1926
  }
1927
- function kt(c, t, e, i, o) {
1927
+ function Ht(c, t, e, i, o) {
1928
1928
  if (o === "readonly") return !1;
1929
- const n = Se(c, t);
1929
+ const n = Te(c, t);
1930
1930
  return !(!n || !e || e === "__all__" || i === null || i === "__all__" || i === null || i !== n.colKey || c.isReadonly(e, i));
1931
1931
  }
1932
- const Q = '"Inter","Segoe UI",system-ui,-apple-system,"Helvetica Neue",sans-serif', Z = 13.5, Ko = 10;
1933
- function Te(c, t) {
1932
+ const me = (c) => c === !0 || c === "true" || c === "1" || c === 1;
1933
+ function De(c, t, e) {
1934
+ const i = /* @__PURE__ */ new Map();
1935
+ if (t.size === 0) return i;
1936
+ const o = /* @__PURE__ */ new Set();
1937
+ for (const n of c.columns)
1938
+ n && n.type === "boolean" && n.unique && o.add(String(n.key));
1939
+ if (o.size === 0) return i;
1940
+ for (const [n, s] of t)
1941
+ for (const [l, a] of Object.entries(s)) {
1942
+ const r = String(l);
1943
+ if (!o.has(r)) continue;
1944
+ const h = e(n, r), d = me(h), f = me(a);
1945
+ if (d === f) continue;
1946
+ const p = i.get(r) ?? { currentRowId: null, previousRowId: null };
1947
+ f && !d && (p.currentRowId = n), d && !f && (p.previousRowId = n), i.set(r, p);
1948
+ }
1949
+ return i;
1950
+ }
1951
+ const Z = '"Inter","Segoe UI",system-ui,-apple-system,"Helvetica Neue",sans-serif', et = 13.5, Bo = 10;
1952
+ function Ke(c, t) {
1934
1953
  const e = c.sorts?.[0];
1935
1954
  return e && e.key === t ? e.dir : null;
1936
1955
  }
1937
- function Ee(c, t) {
1956
+ function _e(c, t) {
1938
1957
  if ((c.filters ?? []).some((o) => {
1939
1958
  const n = o;
1940
1959
  return n?.kind === "values" && n.key === t;
@@ -1942,27 +1961,27 @@ function Ee(c, t) {
1942
1961
  const i = c.columnDiagnostics?.[t];
1943
1962
  return !!(i?.errors || i?.warnings);
1944
1963
  }
1945
- function _o() {
1964
+ function Wo() {
1946
1965
  return `
1947
1966
  <svg viewBox="0 0 24 24" width="16" height="16" aria-hidden="true" focusable="false">
1948
1967
  <path d="M3 5h18l-7 8v6l-4 2v-8L3 5z" fill="none" stroke="currentColor" stroke-width="2" stroke-linejoin="round"/>
1949
1968
  </svg>
1950
1969
  `.trim();
1951
1970
  }
1952
- function Fo(c) {
1971
+ function $o(c) {
1953
1972
  return `
1954
1973
  <svg viewBox="0 0 24 24" width="16" height="16" aria-hidden="true" focusable="false">
1955
1974
  <path d="${c === "asc" ? "M12 6l6 8H6l6-8z" : "M12 18l-6-8h12l-6 8z"}" fill="currentColor"/>
1956
1975
  </svg>
1957
1976
  `.trim();
1958
1977
  }
1959
- function Vo(c, t, e, i, o, n) {
1978
+ function Oo(c, t, e, i, o, n) {
1960
1979
  const s = Math.min(10, Math.floor(Math.min(i, o) / 2));
1961
1980
  if (s <= 0) return;
1962
1981
  const l = n === "error" ? "#ef4444" : "#f59e0b";
1963
1982
  c.save(), c.fillStyle = l, c.beginPath(), c.moveTo(t + i, e), c.lineTo(t + i - s, e), c.lineTo(t + i, e + s), c.closePath(), c.fill(), c.restore();
1964
1983
  }
1965
- class Ae {
1984
+ class Fe {
1966
1985
  constructor() {
1967
1986
  this.numberFormatCache = /* @__PURE__ */ new Map(), this.dateParseCache = /* @__PURE__ */ new Map();
1968
1987
  }
@@ -1974,17 +1993,17 @@ class Ae {
1974
1993
  parseIsoDate(t) {
1975
1994
  const e = this.dateParseCache.get(t);
1976
1995
  if (e) return e;
1977
- const i = We(t);
1996
+ const i = Xe(t);
1978
1997
  return !i || Number.isNaN(i.getTime()) ? null : (this.dateParseCache.set(t, i), i);
1979
1998
  }
1980
1999
  }
1981
- function No(c, t, e, i, o) {
2000
+ function jo(c, t, e, i, o) {
1982
2001
  c.save(), c.globalAlpha = o, c.strokeStyle = "rgba(15,23,42,1)", c.lineWidth = 2, c.lineJoin = "round", c.beginPath(), c.moveTo(t, e), c.lineTo(t + i, e), c.lineTo(t + Math.round(i * 0.62), e + Math.round(i * 0.46)), c.lineTo(t + Math.round(i * 0.38), e + Math.round(i * 0.46)), c.closePath(), c.stroke(), c.beginPath(), c.moveTo(t + Math.round(i * 0.46), e + Math.round(i * 0.46)), c.lineTo(t + Math.round(i * 0.46), e + i), c.lineTo(t + Math.round(i * 0.54), e + i - 2), c.lineTo(t + Math.round(i * 0.54), e + Math.round(i * 0.46)), c.stroke(), c.restore();
1983
2002
  }
1984
- function Po(c, t, e, i, o, n) {
2003
+ function qo(c, t, e, i, o, n) {
1985
2004
  c.save(), c.globalAlpha = o, c.fillStyle = "rgba(15,23,42,1)", c.beginPath(), n === "asc" ? (c.moveTo(t + i / 2, e), c.lineTo(t + i, e + i), c.lineTo(t, e + i)) : (c.moveTo(t, e), c.lineTo(t + i, e), c.lineTo(t + i / 2, e + i)), c.closePath(), c.fill(), c.restore();
1986
2005
  }
1987
- function Wt(c) {
2006
+ function zt(c) {
1988
2007
  if (Array.isArray(c) && c.every((t) => typeof t == "string"))
1989
2008
  return c;
1990
2009
  if (c && typeof c == "object") {
@@ -1997,17 +2016,17 @@ function Wt(c) {
1997
2016
  }
1998
2017
  return null;
1999
2018
  }
2000
- function He(c) {
2019
+ function Ve(c) {
2001
2020
  if (!c || typeof c != "object") return null;
2002
2021
  const t = c;
2003
2022
  return typeof t.kind == "string" ? null : typeof t.label == "string" && "value" in t ? t.label : null;
2004
2023
  }
2005
- class qt {
2024
+ class Gt {
2006
2025
  constructor(t) {
2007
2026
  this.n = t, this.tree = new Array(t + 1).fill(0);
2008
2027
  }
2009
2028
  static from(t) {
2010
- const e = new qt(t.length);
2029
+ const e = new Gt(t.length);
2011
2030
  for (let i = 0; i < t.length; i += 1) e.add(i, t[i] ?? 0);
2012
2031
  return e;
2013
2032
  }
@@ -2047,9 +2066,9 @@ class qt {
2047
2066
  return Math.min(this.n - 1, i);
2048
2067
  }
2049
2068
  }
2050
- class St {
2069
+ class Tt {
2051
2070
  constructor(t) {
2052
- this.dataModel = t, this.tableEl = null, this.defaultRowHeight = ft, this.rowHeaderWidth = lt, this.activeRowId = null, this.activeColKey = null, this.selection = [], this.valueFormatCache = new Ae(), this.measureCache = /* @__PURE__ */ new Map(), this.frame = 0;
2071
+ this.dataModel = t, this.tableEl = null, this.defaultRowHeight = wt, this.rowHeaderWidth = ct, this.activeRowId = null, this.activeColKey = null, this.selection = [], this.valueFormatCache = new Fe(), this.measureCache = /* @__PURE__ */ new Map(), this.frame = 0;
2053
2072
  }
2054
2073
  mount(t) {
2055
2074
  this.tableEl = document.createElement("table"), this.tableEl.dataset.extableRenderer = "html", t.innerHTML = "", t.appendChild(this.tableEl), this.render();
@@ -2064,14 +2083,20 @@ class St {
2064
2083
  if (this.frame += 1, !this.tableEl) return;
2065
2084
  const e = this.tableEl.parentElement, i = e?.scrollTop ?? 0, o = e?.scrollLeft ?? 0, n = this.dataModel.getSchema(), s = this.dataModel.getView(), l = this.dataModel.listRows();
2066
2085
  this.tableEl.innerHTML = "";
2067
- const a = Y(n, s), r = n.columns.map((p) => Ft(p)), h = r.map((p) => ne(p)), d = this.rowHeaderWidth + a.reduce((p, m) => p + (m ?? 0), 0);
2086
+ const a = J(n, s), r = n.columns.map((m) => Bt(m)), h = r.map((m) => ae(m)), d = this.rowHeaderWidth + a.reduce((m, g) => m + (g ?? 0), 0);
2068
2087
  this.tableEl.style.width = `${d}px`, this.tableEl.appendChild(this.renderHeader(n, a));
2069
- const u = document.createElement("tbody");
2070
- for (const p of l)
2071
- u.appendChild(this.renderRow(p, n, a, r, h));
2072
- this.tableEl.appendChild(u), this.updateActiveClasses(), this.applySelectionClasses(), e && (e.scrollTop = i, e.scrollLeft = o);
2073
- for (const [p, m] of Array.from(this.measureCache.entries()))
2074
- m.frame !== this.frame && this.measureCache.delete(p);
2088
+ const f = De(
2089
+ n,
2090
+ this.dataModel.getPending(),
2091
+ (m, g) => this.dataModel.getRawCell(m, g)
2092
+ ), p = document.createElement("tbody");
2093
+ for (const m of l)
2094
+ p.appendChild(
2095
+ this.renderRow(m, n, a, r, h, f)
2096
+ );
2097
+ this.tableEl.appendChild(p), this.updateActiveClasses(), this.applySelectionClasses(), e && (e.scrollTop = i, e.scrollLeft = o);
2098
+ for (const [m, g] of Array.from(this.measureCache.entries()))
2099
+ g.frame !== this.frame && this.measureCache.delete(m);
2075
2100
  }
2076
2101
  destroy() {
2077
2102
  O(this.tableEl), this.tableEl = null;
@@ -2154,98 +2179,102 @@ class St {
2154
2179
  if (!a) continue;
2155
2180
  const r = document.createElement("th");
2156
2181
  r.dataset.colKey = a.key;
2157
- const h = Te(s, a.key), d = Ee(s, a.key);
2182
+ const h = Ke(s, a.key), d = _e(s, a.key);
2158
2183
  h ? r.dataset.extableSortDir = h : r.removeAttribute("data-extable-sort-dir"), d ? r.dataset.extableFsActive = "1" : r.removeAttribute("data-extable-fs-active");
2159
- const u = document.createElement("div");
2160
- u.className = "extable-col-header";
2184
+ const f = document.createElement("div");
2185
+ f.className = "extable-col-header";
2161
2186
  const p = document.createElement("span");
2162
2187
  p.className = "extable-col-header-text", p.textContent = a.header ?? a.key;
2163
2188
  const m = document.createElement("button");
2164
- m.type = "button", m.className = "extable-filter-sort-trigger", m.dataset.extableFsOpen = "1", m.dataset.extableColKey = a.key, m.title = "Filter / Sort", m.innerHTML = h ? Fo(h) : _o(), u.appendChild(p), u.appendChild(m), r.appendChild(u);
2165
- const b = e[l] ?? a.width;
2166
- b && (r.style.width = `${b}px`), r.dataset.colKey = a.key, this.activeColKey !== null && this.activeColKey === a.key && r.classList.add("extable-active-col-header"), o.appendChild(r);
2189
+ m.type = "button", m.className = "extable-filter-sort-trigger", m.dataset.extableFsOpen = "1", m.dataset.extableColKey = a.key, m.title = "Filter / Sort", m.innerHTML = h ? $o(h) : Wo(), f.appendChild(p), f.appendChild(m), r.appendChild(f);
2190
+ const g = e[l] ?? a.width;
2191
+ g && (r.style.width = `${g}px`), r.dataset.colKey = a.key, this.activeColKey !== null && this.activeColKey === a.key && r.classList.add("extable-active-col-header"), o.appendChild(r);
2167
2192
  }
2168
2193
  return i.appendChild(o), i;
2169
2194
  }
2170
- renderRow(t, e, i, o, n) {
2171
- const s = document.createElement("tr");
2172
- s.dataset.rowId = t.id, s.style.height = `${this.defaultRowHeight}px`, e.columns.some((u) => u && u.type === "boolean" && u.unique && this.dataModel.getCell(t.id, u.key) === !0) && s.classList.add("extable-row--unique-true");
2173
- const a = this.dataModel.getView(), r = document.createElement("th");
2174
- r.scope = "row", r.classList.add("extable-row-header");
2175
- const h = this.dataModel.getDisplayIndex(t.id) ?? "";
2176
- r.textContent = String(h), this.activeRowId === t.id && r.classList.add("extable-active-row-header"), s.appendChild(r);
2177
- for (let u = 0; u < e.columns.length; u += 1) {
2178
- const p = e.columns[u];
2179
- if (!p) continue;
2180
- const m = document.createElement("td");
2181
- m.classList.add("extable-cell"), m.dataset.colKey = p.key, p.type === "boolean" && m.classList.add("extable-boolean");
2182
- const b = this.dataModel.hasPending(t.id, p.key), x = this.dataModel.resolveConditionalStyle(t.id, p), w = this.dataModel.getCellStyle(t.id, p.key), f = !!(w?.textColor || x.delta?.textColor || p.style?.textColor);
2183
- if (!w && !x.delta && !b) {
2184
- const k = n[u] ?? "";
2185
- k && (m.style.cssText = k);
2195
+ renderRow(t, e, i, o, n, s) {
2196
+ const l = document.createElement("tr");
2197
+ l.dataset.rowId = t.id, l.style.height = `${this.defaultRowHeight}px`, e.columns.some((p) => p && p.type === "boolean" && p.unique && this.dataModel.getCell(t.id, p.key) === !0) && l.classList.add("extable-row--unique-true");
2198
+ const r = this.dataModel.getView(), h = document.createElement("th");
2199
+ h.scope = "row", h.classList.add("extable-row-header");
2200
+ const d = this.dataModel.getDisplayIndex(t.id) ?? "";
2201
+ h.textContent = String(d), this.activeRowId === t.id && h.classList.add("extable-active-row-header"), l.appendChild(h);
2202
+ for (let p = 0; p < e.columns.length; p += 1) {
2203
+ const m = e.columns[p];
2204
+ if (!m) continue;
2205
+ const g = document.createElement("td");
2206
+ g.classList.add("extable-cell"), g.dataset.colKey = m.key, m.type === "boolean" && g.classList.add("extable-boolean");
2207
+ const S = this.dataModel.hasPending(t.id, m.key), v = this.dataModel.resolveConditionalStyle(t.id, m), u = this.dataModel.getCellStyle(t.id, m.key), w = !!(u?.textColor || v.delta?.textColor || m.style?.textColor);
2208
+ if (!u && !v.delta && !S) {
2209
+ const I = n[p] ?? "";
2210
+ I && (g.style.cssText = I);
2186
2211
  } else {
2187
- const k = o[u] ?? {}, N = x.delta ? rt(k, x.delta) : k, T = w ? rt(N, w) : N, E = b ? { ...T, textColor: void 0 } : T, H = ne(E);
2188
- H && (m.style.cssText = H);
2212
+ const I = o[p] ?? {}, F = v.delta ? ht(I, v.delta) : I, B = u ? ht(F, u) : F, T = S ? { ...B, textColor: void 0 } : B, E = ae(T);
2213
+ E && (g.style.cssText = E);
2189
2214
  }
2190
- const y = a.wrapText?.[p.key] ?? p.wrapText;
2191
- m.classList.add(y ? "cell-wrap" : "cell-nowrap");
2192
- const g = this.dataModel.getRawCell(t.id, p.key), v = this.dataModel.resolveCellValue(t.id, p), C = v.textOverride ?? (x.forceErrorText ? "#ERROR" : void 0), S = C ? { text: C } : this.formatValue(v.value, p), M = this.dataModel.getCellInteraction(t.id, p.key), L = p.type === "tags" && !C ? Wt(v.value) : null, _ = p.type === "button" || p.type === "link", K = _ ? p.type === "button" ? pt(v.value) : mt(v.value) : null, R = _ ? p.type === "button" ? ct(v.value) : ht(v.value) : "";
2193
- if (L && L.length) {
2194
- const k = document.createElement("div");
2195
- k.className = "extable-tag-list", L.forEach((N, T) => {
2215
+ const y = r.wrapText?.[m.key] ?? m.wrapText;
2216
+ g.classList.add(y ? "cell-wrap" : "cell-nowrap");
2217
+ const C = this.dataModel.getRawCell(t.id, m.key), b = this.dataModel.resolveCellValue(t.id, m), M = b.textOverride ?? (v.forceErrorText ? "#ERROR" : void 0), x = M ? { text: M } : this.formatValue(b.value, m), L = this.dataModel.getCellInteraction(t.id, m.key), K = m.type === "tags" && !M ? zt(b.value) : null, _ = m.type === "button" || m.type === "link", R = _ ? m.type === "button" ? vt(b.value) : bt(b.value) : null, A = _ ? m.type === "button" ? ut(b.value) : ft(b.value) : "";
2218
+ if (K && K.length) {
2219
+ const I = document.createElement("div");
2220
+ I.className = "extable-tag-list", K.forEach((F, B) => {
2221
+ const T = document.createElement("span");
2222
+ T.className = "extable-tag";
2196
2223
  const E = document.createElement("span");
2197
- E.className = "extable-tag";
2198
- const H = document.createElement("span");
2199
- H.className = "extable-tag-label", H.textContent = N;
2200
- const P = document.createElement("button");
2201
- P.type = "button", P.className = "extable-tag-remove", P.dataset.extableTagRemove = "1", P.dataset.extableTagIndex = String(T), P.textContent = "×", (M.readonly || M.disabled) && (P.disabled = !0), E.appendChild(H), E.appendChild(P), k.appendChild(E);
2202
- }), m.replaceChildren(k);
2203
- } else if (_ && !C && K && R) {
2204
- const k = p.type === "button" ? document.createElement("button") : document.createElement("span");
2205
- k instanceof HTMLButtonElement && (k.type = "button"), k.className = p.type === "button" ? "extable-action-button" : "extable-action-link", M.disabled && k.classList.add("extable-action-disabled"), p.type === "link" && f && (k.style.color = "inherit"), k.dataset.extableAction = p.type, k.textContent = R, m.replaceChildren(k);
2206
- } else if (p.type === "boolean" && !C)
2207
- if (p.unique) {
2208
- const k = document.createElement("input");
2209
- k.type = "radio", k.name = `extable-unique-${String(p.key)}`, k.checked = !!v.value, (M.readonly || M.disabled) && (k.disabled = !0), k.className = "extable-unique-radio", k.setAttribute("aria-label", p.header ?? String(p.key)), m.replaceChildren(k);
2224
+ E.className = "extable-tag-label", E.textContent = F;
2225
+ const H = document.createElement("button");
2226
+ H.type = "button", H.className = "extable-tag-remove", H.dataset.extableTagRemove = "1", H.dataset.extableTagIndex = String(B), H.textContent = "×", (L.readonly || L.disabled) && (H.disabled = !0), T.appendChild(E), T.appendChild(H), I.appendChild(T);
2227
+ }), g.replaceChildren(I);
2228
+ } else if (_ && !M && R && A) {
2229
+ const I = m.type === "button" ? document.createElement("button") : document.createElement("span");
2230
+ I instanceof HTMLButtonElement && (I.type = "button"), I.className = m.type === "button" ? "extable-action-button" : "extable-action-link", L.disabled && I.classList.add("extable-action-disabled"), m.type === "link" && w && (I.style.color = "inherit"), I.dataset.extableAction = m.type, I.textContent = A, g.replaceChildren(I);
2231
+ } else if (m.type === "boolean" && !M)
2232
+ if (m.unique) {
2233
+ const I = document.createElement("span");
2234
+ I.className = "extable-unique-radio", I.setAttribute("role", "radio");
2235
+ const F = !!b.value;
2236
+ I.setAttribute("aria-checked", F ? "true" : "false"), (L.readonly || L.disabled) && (I.setAttribute("aria-disabled", "true"), I.classList.add("extable-unique-radio--disabled"));
2237
+ const B = s.get(String(m.key));
2238
+ B?.currentRowId === t.id ? I.classList.add("extable-unique-dot-current") : B?.previousRowId === t.id ? I.classList.add("extable-unique-dot-previous") : F && I.classList.add("extable-unique-dot-default"), I.setAttribute("aria-label", m.header ?? String(m.key)), g.replaceChildren(I);
2210
2239
  } else
2211
- m.textContent = S.text, S.color && (m.style.color = S.color);
2240
+ g.textContent = x.text, x.color && (g.style.color = x.color);
2212
2241
  else
2213
- m.textContent = R || S.text, S.color && (m.style.color = S.color);
2214
- const A = this.dataModel.getCellMarker(t.id, p.key);
2215
- A ? (m.classList.toggle("extable-diag-warning", A.level === "warning"), m.classList.toggle("extable-diag-error", A.level === "error"), m.dataset.extableDiagMessage = A.message) : (m.classList.remove("extable-diag-warning", "extable-diag-error"), m.removeAttribute("data-extable-diag-message"));
2216
- const D = p.style?.align ?? (p.type === "number" || p.type === "int" || p.type === "uint" ? "right" : "left");
2217
- m.classList.add(D === "right" ? "align-right" : "align-left");
2218
- const V = $e(g, v.value, p);
2219
- if (V !== null)
2220
- m.dataset.raw = V;
2242
+ g.textContent = A || x.text, x.color && (g.style.color = x.color);
2243
+ const D = this.dataModel.getCellMarker(t.id, m.key);
2244
+ D ? (g.classList.toggle("extable-diag-warning", D.level === "warning"), g.classList.toggle("extable-diag-error", D.level === "error"), g.dataset.extableDiagMessage = D.message) : (g.classList.remove("extable-diag-warning", "extable-diag-error"), g.removeAttribute("data-extable-diag-message"));
2245
+ const P = m.style?.align ?? (m.type === "number" || m.type === "int" || m.type === "uint" ? "right" : "left");
2246
+ g.classList.add(P === "right" ? "align-right" : "align-left");
2247
+ const j = Ue(C, b.value, m);
2248
+ if (j !== null)
2249
+ g.dataset.raw = j;
2221
2250
  else {
2222
- const k = g == null ? "" : String(g);
2223
- m.dataset.raw = k;
2251
+ const I = C == null ? "" : String(C);
2252
+ g.dataset.raw = I;
2224
2253
  }
2225
- b && m.classList.add("pending"), M.readonly ? (m.classList.add("extable-readonly"), p.formula && m.classList.add("extable-readonly-formula")) : m.classList.add("extable-editable"), M.muted && m.classList.add("extable-readonly-muted"), M.disabled && m.classList.add("extable-disabled"), this.activeRowId === t.id && this.activeColKey !== null && this.activeColKey === p.key && m.classList.add("extable-active-cell"), s.appendChild(m);
2226
- }
2227
- if (e.columns.some((u) => a.wrapText?.[u.key] ?? u.wrapText)) {
2228
- let u = this.defaultRowHeight;
2229
- for (let p = 0; p < e.columns.length; p += 1) {
2230
- const m = e.columns[p];
2231
- if (!m || !m.wrapText) continue;
2232
- const b = i[p] ?? a.columnWidths?.[m.key] ?? m.width ?? 100, x = this.dataModel.resolveCellValue(t.id, m), w = this.dataModel.resolveConditionalStyle(t.id, m), y = x.textOverride ?? (w.forceErrorText ? "#ERROR" : void 0) ? "#ERROR" : this.formatValue(x.value, m).text, g = this.dataModel.getRowVersion(t.id), v = `${t.id}|${m.key}|${g}|${b}|${y}`, C = this.measureCache.get(v);
2233
- if (C) {
2234
- C.frame = this.frame, this.measureCache.set(v, C), u = Math.max(u, C.height);
2254
+ S && g.classList.add("pending"), L.readonly ? (g.classList.add("extable-readonly"), m.formula && g.classList.add("extable-readonly-formula")) : g.classList.add("extable-editable"), L.muted && g.classList.add("extable-readonly-muted"), L.disabled && g.classList.add("extable-disabled"), this.activeRowId === t.id && this.activeColKey !== null && this.activeColKey === m.key && g.classList.add("extable-active-cell"), l.appendChild(g);
2255
+ }
2256
+ if (e.columns.some((p) => r.wrapText?.[p.key] ?? p.wrapText)) {
2257
+ let p = this.defaultRowHeight;
2258
+ for (let m = 0; m < e.columns.length; m += 1) {
2259
+ const g = e.columns[m];
2260
+ if (!g || !g.wrapText) continue;
2261
+ const S = i[m] ?? r.columnWidths?.[g.key] ?? g.width ?? 100, v = this.dataModel.resolveCellValue(t.id, g), u = this.dataModel.resolveConditionalStyle(t.id, g), y = v.textOverride ?? (u.forceErrorText ? "#ERROR" : void 0) ? "#ERROR" : this.formatValue(v.value, g).text, C = this.dataModel.getRowVersion(t.id), b = `${t.id}|${g.key}|${C}|${S}|${y}`, M = this.measureCache.get(b);
2262
+ if (M) {
2263
+ M.frame = this.frame, this.measureCache.set(b, M), p = Math.max(p, M.height);
2235
2264
  continue;
2236
2265
  }
2237
- const S = document.createElement("span");
2238
- S.style.visibility = "hidden", S.style.position = "absolute", S.style.left = "-10000px", S.style.top = "0", S.style.whiteSpace = "pre-wrap", S.style.overflowWrap = "anywhere", S.style.display = "inline-block", S.style.width = `${b}px`, S.textContent = y;
2239
- const M = this.tableEl?.parentElement;
2240
- if (!M) continue;
2241
- M.appendChild(S);
2242
- const L = S.clientHeight + at + Mt + 2;
2243
- S.remove(), this.measureCache.set(v, { height: L, frame: this.frame }), u = Math.max(u, L);
2266
+ const x = document.createElement("span");
2267
+ x.style.visibility = "hidden", x.style.position = "absolute", x.style.left = "-10000px", x.style.top = "0", x.style.whiteSpace = "pre-wrap", x.style.overflowWrap = "anywhere", x.style.display = "inline-block", x.style.width = `${S}px`, x.textContent = y;
2268
+ const L = this.tableEl?.parentElement;
2269
+ if (!L) continue;
2270
+ L.appendChild(x);
2271
+ const K = x.clientHeight + dt + Et + 2;
2272
+ x.remove(), this.measureCache.set(b, { height: K, frame: this.frame }), p = Math.max(p, K);
2244
2273
  }
2245
- s.style.height = `${u}px`, this.dataModel.setRowHeight(t.id, u);
2274
+ l.style.height = `${p}px`, this.dataModel.setRowHeight(t.id, p);
2246
2275
  } else
2247
- s.style.height = `${this.defaultRowHeight}px`, this.dataModel.setRowHeight(t.id, this.defaultRowHeight);
2248
- return s;
2276
+ l.style.height = `${this.defaultRowHeight}px`, this.dataModel.setRowHeight(t.id, this.defaultRowHeight);
2277
+ return l;
2249
2278
  }
2250
2279
  updateActiveClasses() {
2251
2280
  if (!this.tableEl) return;
@@ -2292,8 +2321,8 @@ class St {
2292
2321
  const h = r.querySelector("th.extable-row-header");
2293
2322
  h && h.classList.add("extable-selected");
2294
2323
  const d = Array.from(r.querySelectorAll("td"));
2295
- for (let u = s; u <= l; u += 1) {
2296
- const p = d[u];
2324
+ for (let f = s; f <= l; f += 1) {
2325
+ const p = d[f];
2297
2326
  p && p.classList.add("extable-selected");
2298
2327
  }
2299
2328
  }
@@ -2305,15 +2334,15 @@ class St {
2305
2334
  const i = t;
2306
2335
  if (i.kind === "lookup" && typeof i.label == "string")
2307
2336
  return { text: i.label };
2308
- const o = He(t);
2337
+ const o = Ve(t);
2309
2338
  if (o !== null) return { text: o };
2310
2339
  }
2311
2340
  if (e.type === "button")
2312
- return { text: ct(t) || String(t) };
2341
+ return { text: ut(t) || String(t) };
2313
2342
  if (e.type === "link")
2314
- return { text: ht(t) || String(t) };
2343
+ return { text: ft(t) || String(t) };
2315
2344
  if (e.type === "tags") {
2316
- const i = Wt(t);
2345
+ const i = zt(t);
2317
2346
  if (i) return { text: i.join(", ") };
2318
2347
  }
2319
2348
  if (e.type === "boolean")
@@ -2321,7 +2350,7 @@ class St {
2321
2350
  if (e.type === "number" && typeof t == "number") {
2322
2351
  const i = t, o = e.format;
2323
2352
  if ((o?.format ?? "decimal") === "scientific") {
2324
- const r = Rt(i, { format: "scientific", precision: o?.precision }), h = o?.negativeRed && i < 0 ? "#b91c1c" : void 0;
2353
+ const r = At(i, { format: "scientific", precision: o?.precision }), h = o?.negativeRed && i < 0 ? "#b91c1c" : void 0;
2325
2354
  return { text: r, color: h };
2326
2355
  }
2327
2356
  const s = {};
@@ -2332,7 +2361,7 @@ class St {
2332
2361
  if ((e.type === "int" || e.type === "uint") && typeof t == "number") {
2333
2362
  const i = t, o = e.format, n = o?.format ?? "decimal";
2334
2363
  if (n === "binary" || n === "octal" || n === "hex") {
2335
- const r = Ot(i, n), h = o?.negativeRed && i < 0 ? "#b91c1c" : void 0;
2364
+ const r = Ut(i, n), h = o?.negativeRed && i < 0 ? "#b91c1c" : void 0;
2336
2365
  return { text: r, color: h };
2337
2366
  }
2338
2367
  const s = {
@@ -2343,34 +2372,34 @@ class St {
2343
2372
  return { text: l, color: a };
2344
2373
  }
2345
2374
  if ((e.type === "date" || e.type === "time" || e.type === "datetime") && (t instanceof Date || typeof t == "string")) {
2346
- const i = e.format, o = e.type === "date" ? Kt(i, "date") : e.type === "time" ? Kt(i, "time") : Kt(i, "datetime");
2375
+ const i = e.format, o = e.type === "date" ? Nt(i, "date") : e.type === "time" ? Nt(i, "time") : Nt(i, "datetime");
2347
2376
  let n = null;
2348
- return t instanceof Date ? n = t : n = this.valueFormatCache.parseIsoDate(t), n ? { text: de(n, o) } : { text: String(t) };
2377
+ return t instanceof Date ? n = t : n = this.valueFormatCache.parseIsoDate(t), n ? { text: ge(n, o) } : { text: String(t) };
2349
2378
  }
2350
2379
  return { text: String(t) };
2351
2380
  }
2352
2381
  }
2353
- const z = class z {
2382
+ const U = class U {
2354
2383
  constructor(t, e = () => "direct") {
2355
- this.getEditMode = e, this.root = null, this.canvas = null, this.spacer = null, this.overlayLayer = null, this.tooltip = null, this.tooltipTarget = null, this.tooltipMessage = null, this.rowHeight = ft, this.headerHeight = st, this.lineHeight = 16, this.padding = 12, this.rowHeaderWidth = lt, this.activeRowId = null, this.activeColKey = null, this.selection = [], this.valueFormatCache = new Ae(), this.textMeasureCache = /* @__PURE__ */ new Map(), this.frame = 0, this.cursorTimer = null, this.pendingCursorPoint = null, this.hoverHeaderColKey = null, this.hoverHeaderIcon = !1, this.hoverActionKey = null, this.activeActionKey = null, this.rowHeightCacheKey = null, this.rowHeightMeasuredVersion = /* @__PURE__ */ new Map(), this.rowHeightMeasureRaf = null, this.rowHeightMeasureTask = null, this.heightIndex = null, this.handleClick = (i) => {
2384
+ this.getEditMode = e, this.root = null, this.canvas = null, this.spacer = null, this.overlayLayer = null, this.tooltip = null, this.tooltipTarget = null, this.tooltipMessage = null, this.rowHeight = wt, this.headerHeight = at, this.lineHeight = 16, this.padding = 12, this.rowHeaderWidth = ct, this.activeRowId = null, this.activeColKey = null, this.selection = [], this.valueFormatCache = new Fe(), this.textMeasureCache = /* @__PURE__ */ new Map(), this.frame = 0, this.cursorTimer = null, this.pendingCursorPoint = null, this.hoverHeaderColKey = null, this.hoverHeaderIcon = !1, this.hoverActionKey = null, this.activeActionKey = null, this.rowHeightCacheKey = null, this.rowHeightMeasuredVersion = /* @__PURE__ */ new Map(), this.rowHeightMeasureRaf = null, this.rowHeightMeasureTask = null, this.heightIndex = null, this.handleClick = (i) => {
2356
2385
  if (!this.root || !this.canvas) return;
2357
2386
  const o = this.canvas.getBoundingClientRect(), n = i.clientX - o.left, s = i.clientY - o.top, l = n + this.root.scrollLeft, a = s;
2358
2387
  if (a >= this.headerHeight || l < this.rowHeaderWidth) return;
2359
- const r = this.dataModel.getSchema(), h = this.dataModel.getView(), d = Y(r, h);
2360
- let u = this.rowHeaderWidth, p = -1;
2361
- for (let v = 0; v < d.length; v += 1) {
2362
- const C = d[v] ?? 100;
2363
- if (l >= u && l <= u + C) {
2364
- p = v;
2388
+ const r = this.dataModel.getSchema(), h = this.dataModel.getView(), d = J(r, h);
2389
+ let f = this.rowHeaderWidth, p = -1;
2390
+ for (let C = 0; C < d.length; C += 1) {
2391
+ const b = d[C] ?? 100;
2392
+ if (l >= f && l <= f + b) {
2393
+ p = C;
2365
2394
  break;
2366
2395
  }
2367
- u += C;
2396
+ f += b;
2368
2397
  }
2369
2398
  if (p < 0) return;
2370
2399
  const m = r.columns[p];
2371
2400
  if (!m) return;
2372
- const b = d[p] ?? 100, x = 18, f = u + b - x - 4, y = Math.floor((this.headerHeight - x) / 2);
2373
- l >= f && l <= f + x && a >= y && a <= y + x && this.root.dispatchEvent(
2401
+ const g = d[p] ?? 100, S = 18, u = f + g - S - 4, w = Math.floor((this.headerHeight - S) / 2);
2402
+ l >= u && l <= u + S && a >= w && a <= w + S && this.root.dispatchEvent(
2374
2403
  new CustomEvent("extable:filter-sort-open", { bubbles: !0, detail: { colKey: m.key } })
2375
2404
  );
2376
2405
  }, this.handlePointerMove = (i) => {
@@ -2395,7 +2424,7 @@ const z = class z {
2395
2424
  }
2396
2425
  mount(t) {
2397
2426
  this.root = t, this.canvas = document.createElement("canvas");
2398
- const e = z.MAX_CANVAS_DIM_PX;
2427
+ const e = U.MAX_CANVAS_DIM_PX;
2399
2428
  this.canvas.width = Math.max(1, Math.min(e, Math.floor(t.clientWidth || 600))), this.canvas.height = Math.max(1, Math.min(e, Math.floor(t.clientHeight || 400))), this.canvas.style.width = `${this.canvas.width}px`, this.canvas.style.height = `${this.canvas.height}px`, this.canvas.dataset.extableRenderer = "canvas", this.canvas.style.position = "sticky", this.canvas.style.top = "0", this.canvas.style.left = "0", this.canvas.style.zIndex = "1", this.canvas.style.cursor = "cell", this.canvas.addEventListener("pointermove", this.handlePointerMove), this.canvas.addEventListener("pointerdown", this.handlePointerDown), this.canvas.addEventListener("pointerup", this.handlePointerUp), this.canvas.addEventListener("pointerleave", this.handlePointerLeave), this.canvas.addEventListener("click", this.handleClick), this.spacer = document.createElement("div"), this.spacer.style.width = "1px", this.tooltip && this.tooltip.remove(), this.overlayLayer && this.overlayLayer.remove(), this.overlayLayer = document.createElement("div"), this.overlayLayer.className = "extable-overlay-layer", this.tooltip = document.createElement("div"), this.tooltip.className = "extable-tooltip", this.tooltip.dataset.visible = "0", this.overlayLayer.appendChild(this.tooltip), t.innerHTML = "", t.style.position = "relative", t.appendChild(this.overlayLayer), t.appendChild(this.canvas), t.appendChild(this.spacer), this.render();
2400
2429
  }
2401
2430
  setActiveCell(t, e) {
@@ -2409,149 +2438,162 @@ const z = class z {
2409
2438
  if (this.frame += 1, !this.canvas || !this.root) return;
2410
2439
  const e = this.canvas.getContext("2d");
2411
2440
  if (!e) return;
2412
- e.font = `${Z}px ${Q}`;
2441
+ e.font = `${et}px ${Z}`;
2413
2442
  let i = e.font;
2414
- const o = this.activeRowId === "__all__" && this.activeColKey === "__all__", n = this.dataModel.getSchema(), s = this.dataModel.getView(), l = this.dataModel.listRows(), a = Y(n, s), r = n.columns.map((T) => Ft(T)), h = /* @__PURE__ */ new Map(), d = n.columns.some((T) => s.wrapText?.[T.key] ?? T.wrapText), u = d ? this.getRowHeightCacheKey(n, s, a) : null;
2415
- u !== this.rowHeightCacheKey && (this.rowHeightCacheKey = u, this.rowHeightMeasuredVersion.clear(), this.rowHeightMeasureTask = null), d || this.cancelRowHeightMeasurement(), this.ensureHeightIndex(l, d ? u : null, d);
2416
- const p = this.heightIndex;
2417
- if (!p) return;
2418
- const m = this.rowHeaderWidth + a.reduce((T, E) => T + (E ?? 0), 0), b = t?.clientWidth ?? (this.root.clientWidth || 600), x = t?.clientHeight ?? (this.root.clientHeight || this.canvas.height || 400), w = z.MAX_CANVAS_DIM_PX, f = Math.max(1, Math.min(w, Math.floor(b))), y = Math.max(1, Math.min(w, Math.floor(x)));
2419
- this.canvas.width !== f && (this.canvas.width = f), this.canvas.height !== y && (this.canvas.height = y), this.canvas.style.width = `${f}px`, this.canvas.style.height = `${y}px`, e.font = `${Z}px ${Q}`, i = e.font, this.refreshTooltipPosition();
2420
- const g = t?.scrollTop ?? this.root.scrollTop, v = t?.scrollLeft ?? this.root.scrollLeft, C = (T) => {
2443
+ const o = this.activeRowId === "__all__" && this.activeColKey === "__all__", n = this.dataModel.getSchema(), s = this.dataModel.getView(), l = this.dataModel.listRows(), a = J(n, s), r = n.columns.map((T) => Bt(T)), h = De(
2444
+ n,
2445
+ this.dataModel.getPending(),
2446
+ (T, E) => this.dataModel.getRawCell(T, E)
2447
+ ), d = this.getUniqueDotColors(), f = /* @__PURE__ */ new Map(), p = n.columns.some((T) => s.wrapText?.[T.key] ?? T.wrapText), m = p ? this.getRowHeightCacheKey(n, s, a) : null;
2448
+ m !== this.rowHeightCacheKey && (this.rowHeightCacheKey = m, this.rowHeightMeasuredVersion.clear(), this.rowHeightMeasureTask = null), p || this.cancelRowHeightMeasurement(), this.ensureHeightIndex(l, p ? m : null, p);
2449
+ const g = this.heightIndex;
2450
+ if (!g) return;
2451
+ const S = this.rowHeaderWidth + a.reduce((T, E) => T + (E ?? 0), 0), v = t?.clientWidth ?? (this.root.clientWidth || 600), u = t?.clientHeight ?? (this.root.clientHeight || this.canvas.height || 400), w = U.MAX_CANVAS_DIM_PX, y = Math.max(1, Math.min(w, Math.floor(v))), C = Math.max(1, Math.min(w, Math.floor(u)));
2452
+ this.canvas.width !== y && (this.canvas.width = y), this.canvas.height !== C && (this.canvas.height = C), this.canvas.style.width = `${y}px`, this.canvas.style.height = `${C}px`, e.font = `${et}px ${Z}`, i = e.font, this.refreshTooltipPosition();
2453
+ const b = t?.scrollTop ?? this.root.scrollTop, M = t?.scrollLeft ?? this.root.scrollLeft, x = (T) => {
2421
2454
  const E = T + 1, H = Math.max(
2422
2455
  0,
2423
- Math.min(l.length - 1, p.fenwick.lowerBound(E))
2424
- ), P = p.fenwick.sum(H);
2425
- let F = H, q = 0;
2426
- const j = (this.canvas?.height ?? 0) + this.rowHeight * 2;
2427
- for (let I = H; I < l.length && q < j; I += 1)
2428
- q += p.heights[I] ?? this.rowHeight, F = I + 1;
2429
- return { accum: P, visibleStart: H, visibleEnd: F };
2456
+ Math.min(l.length - 1, g.fenwick.lowerBound(E))
2457
+ ), X = g.fenwick.sum(H);
2458
+ let N = H, z = 0;
2459
+ const q = (this.canvas?.height ?? 0) + this.rowHeight * 2;
2460
+ for (let k = H; k < l.length && z < q; k += 1)
2461
+ z += g.heights[k] ?? this.rowHeight, N = k + 1;
2462
+ return { accum: X, visibleStart: H, visibleEnd: N };
2430
2463
  };
2431
- let S = p.fenwick.total();
2432
- const M = this.canvas?.height ?? this.root.clientHeight, L = Math.max(0, M - this.headerHeight);
2433
- let _ = Math.max(0, S - L), K = Math.max(0, Math.min(g, _)), { accum: R, visibleStart: A, visibleEnd: D } = C(K);
2434
- if (d && u) {
2464
+ let L = g.fenwick.total();
2465
+ const K = this.canvas?.height ?? this.root.clientHeight, _ = Math.max(0, K - this.headerHeight);
2466
+ let R = Math.max(0, L - _), A = Math.max(0, Math.min(b, R)), { accum: D, visibleStart: P, visibleEnd: j } = x(A);
2467
+ if (p && m) {
2435
2468
  const T = {};
2436
- for (let E = A; E < D; E += 1) {
2469
+ for (let E = P; E < j; E += 1) {
2437
2470
  const H = l[E];
2438
2471
  if (!H) continue;
2439
- const P = this.dataModel.getRowVersion(H.id);
2440
- if (this.rowHeightMeasuredVersion.get(H.id) === P) continue;
2441
- const F = this.measureRowHeight(e, H, n, a);
2442
- T[H.id] = F, this.rowHeightMeasuredVersion.set(H.id, P);
2472
+ const X = this.dataModel.getRowVersion(H.id);
2473
+ if (this.rowHeightMeasuredVersion.get(H.id) === X) continue;
2474
+ const N = this.measureRowHeight(e, H, n, a);
2475
+ T[H.id] = N, this.rowHeightMeasuredVersion.set(H.id, X);
2443
2476
  }
2444
- this.applyRowHeightUpdates(T), S = p.fenwick.total(), this.dataModel.setRowHeightsBulk(T), _ = Math.max(0, S - L), K = Math.max(0, Math.min(g, _)), { accum: R, visibleStart: A, visibleEnd: D } = C(K), (this.rowHeightMeasureTask || Object.keys(T).length > 0) && this.scheduleRowHeightMeasurement();
2477
+ this.applyRowHeightUpdates(T), L = g.fenwick.total(), this.dataModel.setRowHeightsBulk(T), R = Math.max(0, L - _), A = Math.max(0, Math.min(b, R)), { accum: D, visibleStart: P, visibleEnd: j } = x(A), (this.rowHeightMeasureTask || Object.keys(T).length > 0) && this.scheduleRowHeightMeasurement();
2445
2478
  }
2446
- this.spacer && (this.spacer.style.height = `${_}px`, this.spacer.style.width = `${m}px`);
2447
- const V = this.rowHeaderWidth - v;
2479
+ this.spacer && (this.spacer.style.height = `${R}px`, this.spacer.style.width = `${S}px`);
2480
+ const I = this.rowHeaderWidth - M;
2448
2481
  e.clearRect(0, 0, this.canvas.width, this.canvas.height), e.fillStyle = "#e5e7eb", e.fillRect(0, 0, this.rowHeaderWidth, this.canvas.height);
2449
- let k = this.headerHeight + R - K;
2450
- for (let T = A; T < D; T += 1) {
2451
- const E = l[T], H = p.heights[T] ?? this.rowHeight;
2452
- e.strokeStyle = "#d0d7de", e.fillStyle = "#e5e7eb", e.fillRect(0, k, this.rowHeaderWidth, H), e.strokeRect(0, k, this.rowHeaderWidth, H);
2453
- const P = this.dataModel.getDisplayIndex(E.id) ?? "";
2454
- this.activeRowId === E.id && (e.fillStyle = "rgba(59,130,246,0.16)", e.fillRect(0, k, this.rowHeaderWidth, H)), e.fillStyle = "#0f172a", e.font = `bold ${Z}px ${Q}`, e.textAlign = "center", e.textBaseline = "middle", e.fillText(String(P), this.rowHeaderWidth / 2, k + H / 2), e.font = i, e.textAlign = "left", e.textBaseline = "alphabetic", e.save(), e.beginPath(), e.rect(
2482
+ let F = this.headerHeight + D - A;
2483
+ for (let T = P; T < j; T += 1) {
2484
+ const E = l[T], H = g.heights[T] ?? this.rowHeight;
2485
+ e.strokeStyle = "#d0d7de", e.fillStyle = "#e5e7eb", e.fillRect(0, F, this.rowHeaderWidth, H), e.strokeRect(0, F, this.rowHeaderWidth, H);
2486
+ const X = this.dataModel.getDisplayIndex(E.id) ?? "";
2487
+ this.activeRowId === E.id && (e.fillStyle = "rgba(59,130,246,0.16)", e.fillRect(0, F, this.rowHeaderWidth, H)), e.fillStyle = "#0f172a", e.font = `bold ${et}px ${Z}`, e.textAlign = "center", e.textBaseline = "middle", e.fillText(String(X), this.rowHeaderWidth / 2, F + H / 2), e.font = i, e.textAlign = "left", e.textBaseline = "alphabetic", e.save(), e.beginPath(), e.rect(
2455
2488
  this.rowHeaderWidth,
2456
2489
  this.headerHeight,
2457
2490
  this.canvas.width - this.rowHeaderWidth,
2458
2491
  this.canvas.height - this.headerHeight
2459
- ), e.clip(), e.translate(V, 0);
2460
- let F = 0, q = "";
2461
- for (let j = 0; j < n.columns.length; j += 1) {
2462
- const I = n.columns[j], $ = a[j] ?? 100;
2463
- if (!I) {
2464
- F += $;
2492
+ ), e.clip(), e.translate(I, 0);
2493
+ let N = 0, z = "";
2494
+ for (let q = 0; q < n.columns.length; q += 1) {
2495
+ const k = n.columns[q], W = a[q] ?? 100;
2496
+ if (!k) {
2497
+ N += W;
2465
2498
  continue;
2466
2499
  }
2467
- const W = this.dataModel.getCellInteraction(E.id, I.key), it = W.muted;
2500
+ const $ = this.dataModel.getCellInteraction(E.id, k.key), st = $.muted;
2468
2501
  e.strokeStyle = "#d0d7de";
2469
- const ot = this.dataModel.resolveConditionalStyle(E.id, I), dt = this.dataModel.getCellStyle(E.id, I.key), zt = r[j] ?? {}, Ut = ot.delta ? rt(zt, ot.delta) : zt, U = dt ? rt(Ut, dt) : Ut, Le = n.columns.some((B) => B && B.type === "boolean" && B.unique && this.dataModel.getCell(E.id, B.key) === !0) ? "rgba(59,130,246,0.06)" : it ? "#f3f4f6" : U.backgroundColor ?? "#ffffff";
2470
- e.fillStyle = Le, e.fillRect(F, k, $, H), e.strokeRect(F, k, $, H);
2471
- const X = this.dataModel.resolveCellValue(E.id, I), Xt = X.textOverride ?? (ot.forceErrorText ? "#ERROR" : void 0), gt = Xt ? { text: "#ERROR" } : this.formatValue(X.value, I), Et = I.type === "button" || I.type === "link", Gt = Et ? I.type === "button" ? pt(X.value) : mt(X.value) : null, Yt = Et ? Gt?.label ?? (I.type === "button" ? ct(X.value) : ht(X.value)) : "", yt = !!(Et && Gt && Yt && !Xt);
2472
- let At = Yt || gt.text;
2473
- I.type === "boolean" && I.unique && (At = X.value === !0 || X.value === "true" || X.value === "1" || X.value === 1 ? "🔵" : "");
2474
- const Qt = I.style?.align ?? (I.type === "number" ? "right" : "left");
2475
- if (this.activeRowId === E.id && this.activeColKey !== null && this.activeColKey === I.key && (e.strokeStyle = "#3b82f6", e.lineWidth = 2, e.strokeRect(F + 1, k + 1, $ - 2, H - 2), e.lineWidth = 1, kt(
2502
+ const lt = this.dataModel.resolveConditionalStyle(E.id, k), pt = this.dataModel.getCellStyle(E.id, k.key), Yt = r[q] ?? {}, Qt = lt.delta ? ht(Yt, lt.delta) : Yt, G = pt ? ht(Qt, pt) : Qt, Ne = n.columns.some((V) => V && V.type === "boolean" && V.unique && this.dataModel.getCell(E.id, V.key) === !0) ? "rgba(59,130,246,0.06)" : st ? "#f3f4f6" : G.backgroundColor ?? "#ffffff";
2503
+ e.fillStyle = Ne, e.fillRect(N, F, W, H), e.strokeRect(N, F, W, H);
2504
+ const Y = this.dataModel.resolveCellValue(E.id, k), Jt = Y.textOverride ?? (lt.forceErrorText ? "#ERROR" : void 0), Ct = Jt ? { text: "#ERROR" } : this.formatValue(Y.value, k), Kt = k.type === "button" || k.type === "link", Zt = Kt ? k.type === "button" ? vt(Y.value) : bt(Y.value) : null, te = Kt ? Zt?.label ?? (k.type === "button" ? ut(Y.value) : ft(Y.value)) : "", xt = !!(Kt && Zt && te && !Jt);
2505
+ let _t = te || Ct.text;
2506
+ const ee = k.type === "boolean" && k.unique;
2507
+ let rt = null;
2508
+ if (ee) {
2509
+ const V = h.get(String(k.key));
2510
+ V?.currentRowId === E.id ? rt = "current" : V?.previousRowId === E.id ? rt = "previous" : rt = Y.value === !0 || Y.value === "true" || Y.value === "1" || Y.value === 1 ? "default" : null, _t = "";
2511
+ }
2512
+ const Ft = k.style?.align ?? (k.type === "number" ? "right" : "left");
2513
+ if (this.activeRowId === E.id && this.activeColKey !== null && this.activeColKey === k.key && (e.strokeStyle = "#3b82f6", e.lineWidth = 2, e.strokeRect(N + 1, F + 1, W - 2, H - 2), e.lineWidth = 1, Ht(
2476
2514
  this.dataModel,
2477
2515
  this.selection,
2478
2516
  this.activeRowId,
2479
2517
  this.activeColKey,
2480
2518
  this.getEditMode()
2481
2519
  ))) {
2482
- const B = Me, nt = F + $ - B - 1, J = k + H - B - 1;
2483
- e.fillStyle = "#3b82f6", e.fillRect(nt, J, B, B), e.strokeStyle = "#ffffff", e.strokeRect(nt + 0.5, J + 0.5, B - 1, B - 1);
2520
+ const V = Ee, nt = N + W - V - 1, tt = F + H - V - 1;
2521
+ e.fillStyle = "#3b82f6", e.fillRect(nt, tt, V, V), e.strokeStyle = "#ffffff", e.strokeRect(nt + 0.5, tt + 0.5, V - 1, V - 1);
2484
2522
  }
2485
- const Jt = yt && I.type === "link" && !it && !U.textColor ? "#2563eb" : void 0, De = this.getEditMode() === "readonly", Ke = !!(gt.color || U.textColor || Jt), _e = !De && I.formula && W.readonly && !it && !Ke ? "#99aaff" : void 0;
2486
- e.fillStyle = this.dataModel.hasPending(E.id, I.key) ? "#b91c1c" : gt.color ? gt.color : it ? "#94a3b8" : Jt ?? U.textColor ?? _e ?? "#0f172a";
2487
- const Zt = s.wrapText?.[I.key] ?? I.wrapText ?? !1, Ht = I.type === "boolean" && (!I.format || I.format === "checkbox"), Fe = I.type === "boolean" && !!(I.format && I.format !== "checkbox");
2488
- if (Ht)
2489
- e.font = i, q = "";
2523
+ const ie = xt && k.type === "link" && !st && !G.textColor ? "#2563eb" : void 0, Pe = this.getEditMode() === "readonly", Be = !!(Ct.color || G.textColor || ie), We = !Pe && k.formula && $.readonly && !st && !Be ? "#99aaff" : void 0;
2524
+ e.fillStyle = this.dataModel.hasPending(E.id, k.key) ? "#b91c1c" : Ct.color ? Ct.color : st ? "#94a3b8" : ie ?? G.textColor ?? We ?? "#0f172a";
2525
+ const oe = s.wrapText?.[k.key] ?? k.wrapText ?? !1, Vt = k.type === "boolean" && (!k.format || k.format === "checkbox"), $e = k.type === "boolean" && !!(k.format && k.format !== "checkbox");
2526
+ if (Vt)
2527
+ e.font = i, z = "";
2490
2528
  else {
2491
- const B = `${U.italic ? "i" : ""}${U.bold ? "b" : ""}`;
2492
- if (B !== q) {
2493
- const nt = h.get(B);
2529
+ const V = `${G.italic ? "i" : ""}${G.bold ? "b" : ""}`;
2530
+ if (V !== z) {
2531
+ const nt = f.get(V);
2494
2532
  if (nt) e.font = nt;
2495
2533
  else {
2496
- const J = U.bold ? "600 " : "", bt = `${U.italic ? "italic " : ""}${J}${Z}px ${Q}`.trim();
2497
- h.set(B, bt), e.font = bt;
2534
+ const tt = G.bold ? "600 " : "", kt = `${G.italic ? "italic " : ""}${tt}${et}px ${Z}`.trim();
2535
+ f.set(V, kt), e.font = kt;
2498
2536
  }
2499
- q = B;
2537
+ z = V;
2500
2538
  }
2501
2539
  }
2502
- const wt = F + ut, vt = k + at, Lt = Math.max(0, $ - ut * 2), Dt = Math.max(0, H - (at + Mt)), Ve = {
2503
- underline: !!U.underline || yt && I.type === "link",
2504
- strike: !!U.strike
2505
- }, et = yt && !Ht ? this.measureTextBounds(
2540
+ const mt = N + yt, gt = F + dt, St = Math.max(0, W - yt * 2), Rt = Math.max(0, H - (dt + Et)), Oe = {
2541
+ underline: !!G.underline || xt && k.type === "link",
2542
+ strike: !!G.strike
2543
+ }, ot = xt && !Vt ? this.measureTextBounds(
2506
2544
  e,
2507
- At,
2508
- wt,
2509
- vt,
2510
- Lt,
2511
- Dt,
2512
- Zt,
2513
- Qt
2545
+ _t,
2546
+ mt,
2547
+ gt,
2548
+ St,
2549
+ Rt,
2550
+ oe,
2551
+ Ft
2514
2552
  ) : null;
2515
- if (yt && I.type === "button" && et) {
2516
- const J = Math.max(wt, et.x - 6), Ct = Math.max(vt, et.y - 4), bt = Math.min(wt + Lt, et.x + et.width + 6), Ne = Math.min(vt + Dt, et.y + et.height + 4), ee = Math.max(0, bt - J), ie = Math.max(0, Ne - Ct);
2553
+ if (xt && k.type === "button" && ot) {
2554
+ const tt = Math.max(mt, ot.x - 6), Mt = Math.max(gt, ot.y - 4), kt = Math.min(mt + St, ot.x + ot.width + 6), je = Math.min(gt + Rt, ot.y + ot.height + 4), se = Math.max(0, kt - tt), le = Math.max(0, je - Mt);
2517
2555
  e.save();
2518
- const oe = `${E.id}::${I.key}::button`, Pe = this.hoverActionKey === oe, Be = this.activeActionKey === oe;
2519
- it ? (e.fillStyle = "#f3f4f6", e.strokeStyle = "#e2e8f0") : Be ? (e.fillStyle = "#cbd5e1", e.strokeStyle = "#94a3b8") : Pe ? (e.fillStyle = "#e2e8f0", e.strokeStyle = "#94a3b8") : (e.fillStyle = "#f8fafc", e.strokeStyle = "#cbd5e1"), e.lineWidth = 1, e.beginPath(), typeof e.roundRect == "function" ? e.roundRect(J, Ct, ee, ie, 6) : e.rect(J, Ct, ee, ie), e.fill(), e.stroke(), e.restore();
2556
+ const re = `${E.id}::${k.key}::button`, qe = this.hoverActionKey === re, ze = this.activeActionKey === re;
2557
+ st ? (e.fillStyle = "#f3f4f6", e.strokeStyle = "#e2e8f0") : ze ? (e.fillStyle = "#cbd5e1", e.strokeStyle = "#94a3b8") : qe ? (e.fillStyle = "#e2e8f0", e.strokeStyle = "#94a3b8") : (e.fillStyle = "#f8fafc", e.strokeStyle = "#cbd5e1"), e.lineWidth = 1, e.beginPath(), typeof e.roundRect == "function" ? e.roundRect(tt, Mt, se, le, 6) : e.rect(tt, Mt, se, le), e.fill(), e.stroke(), e.restore();
2558
+ }
2559
+ if (ee && rt) {
2560
+ const V = rt === "current" ? d.current : rt === "previous" ? d.previous : d.default;
2561
+ this.drawUniqueRadio(e, mt, gt, St, Rt, Ft, V);
2520
2562
  }
2521
2563
  this.drawCellText(
2522
2564
  e,
2523
- At,
2524
- wt,
2525
- vt,
2526
- Lt,
2527
- Dt,
2528
- Zt,
2529
- Qt,
2530
- Ht,
2531
- Fe,
2532
- !!I.unique,
2533
- Ve
2565
+ _t,
2566
+ mt,
2567
+ gt,
2568
+ St,
2569
+ Rt,
2570
+ oe,
2571
+ Ft,
2572
+ Vt,
2573
+ $e,
2574
+ !!k.unique,
2575
+ Oe
2534
2576
  );
2535
- const te = this.dataModel.getCellMarker(E.id, I.key);
2536
- te && Vo(e, F, k, $, H, te.level), F += $;
2577
+ const ne = this.dataModel.getCellMarker(E.id, k.key);
2578
+ ne && Oo(e, N, F, W, H, ne.level), N += W;
2537
2579
  }
2538
- e.restore(), k += H;
2580
+ e.restore(), F += H;
2539
2581
  }
2540
- e.fillStyle = "#e5e7eb", e.fillRect(0, 0, this.canvas.width, this.headerHeight), e.strokeStyle = "#d0d7de", e.strokeRect(0, 0, this.rowHeaderWidth, this.headerHeight), e.fillStyle = "#9ca3af", e.beginPath(), e.moveTo(4, 4), e.lineTo(16, 4), e.lineTo(4, 16), e.closePath(), e.fill(), this.activeRowId && (e.fillStyle = "rgba(59,130,246,0.16)", e.fillRect(0, 0, this.rowHeaderWidth, this.headerHeight)), e.save(), e.beginPath(), e.rect(this.rowHeaderWidth, 0, this.canvas.width - this.rowHeaderWidth, this.headerHeight), e.clip(), e.translate(V, 0);
2541
- let N = 0;
2582
+ e.fillStyle = "#e5e7eb", e.fillRect(0, 0, this.canvas.width, this.headerHeight), e.strokeStyle = "#d0d7de", e.strokeRect(0, 0, this.rowHeaderWidth, this.headerHeight), e.fillStyle = "#9ca3af", e.beginPath(), e.moveTo(4, 4), e.lineTo(16, 4), e.lineTo(4, 16), e.closePath(), e.fill(), this.activeRowId && (e.fillStyle = "rgba(59,130,246,0.16)", e.fillRect(0, 0, this.rowHeaderWidth, this.headerHeight)), e.save(), e.beginPath(), e.rect(this.rowHeaderWidth, 0, this.canvas.width - this.rowHeaderWidth, this.headerHeight), e.clip(), e.translate(I, 0);
2583
+ let B = 0;
2542
2584
  for (let T = 0; T < n.columns.length; T += 1) {
2543
2585
  const E = n.columns[T], H = a[T] ?? 100;
2544
2586
  if (!E) {
2545
- N += H;
2587
+ B += H;
2546
2588
  continue;
2547
2589
  }
2548
- this.activeColKey !== null && this.activeColKey === E.key && (e.fillStyle = "rgba(59,130,246,0.16)", e.fillRect(N, 0, H, this.headerHeight)), e.strokeStyle = "#d0d7de", e.strokeRect(N, 0, H, this.headerHeight), e.fillStyle = "#0f172a", e.font = `bold ${Z}px ${Q}`, e.fillText(E.header ?? E.key, N + 8, this.headerHeight - 8), e.font = i;
2549
- const F = Te(s, E.key), q = Ee(s, E.key), j = this.hoverHeaderColKey !== null && this.hoverHeaderColKey === E.key;
2550
- if (!!F || q || j) {
2551
- const $ = j ? 0.9 : q || F ? 0.75 : 0.45, W = 16, ot = N + H - W - 6, dt = Math.floor((this.headerHeight - W) / 2);
2552
- F ? Po(e, ot + 3, dt + 3, W - 6, $, F) : No(e, ot + 2, dt + 2, W - 4, $);
2590
+ this.activeColKey !== null && this.activeColKey === E.key && (e.fillStyle = "rgba(59,130,246,0.16)", e.fillRect(B, 0, H, this.headerHeight)), e.strokeStyle = "#d0d7de", e.strokeRect(B, 0, H, this.headerHeight), e.fillStyle = "#0f172a", e.font = `bold ${et}px ${Z}`, e.fillText(E.header ?? E.key, B + 8, this.headerHeight - 8), e.font = i;
2591
+ const N = Ke(s, E.key), z = _e(s, E.key), q = this.hoverHeaderColKey !== null && this.hoverHeaderColKey === E.key;
2592
+ if (!!N || z || q) {
2593
+ const W = q ? 0.9 : z || N ? 0.75 : 0.45, $ = 16, lt = B + H - $ - 6, pt = Math.floor((this.headerHeight - $) / 2);
2594
+ N ? qo(e, lt + 3, pt + 3, $ - 6, W, N) : jo(e, lt + 2, pt + 2, $ - 4, W);
2553
2595
  }
2554
- N += H;
2596
+ B += H;
2555
2597
  }
2556
2598
  if (e.restore(), this.selection.length) {
2557
2599
  e.save(), e.beginPath(), e.rect(
@@ -2561,17 +2603,17 @@ const z = class z {
2561
2603
  this.canvas.height - this.headerHeight
2562
2604
  ), e.clip(), e.strokeStyle = "#3b82f6", e.fillStyle = "rgba(59,130,246,0.12)";
2563
2605
  for (const T of this.selection) {
2564
- const E = Math.max(0, Math.min(T.startRow, T.endRow)), H = Math.min(l.length - 1, Math.max(T.startRow, T.endRow)), P = Math.max(0, Math.min(T.startCol, T.endCol)), F = Math.min(
2606
+ const E = Math.max(0, Math.min(T.startRow, T.endRow)), H = Math.min(l.length - 1, Math.max(T.startRow, T.endRow)), X = Math.max(0, Math.min(T.startCol, T.endCol)), N = Math.min(
2565
2607
  n.columns.length - 1,
2566
2608
  Math.max(T.startCol, T.endCol)
2567
- ), q = this.headerHeight + p.fenwick.sum(E) - K, j = p.fenwick.sum(H + 1) - p.fenwick.sum(E);
2568
- let I = this.rowHeaderWidth;
2569
- for (let W = 0; W < P; W += 1)
2570
- I += a[W] ?? 100;
2571
- let $ = 0;
2572
- for (let W = P; W <= F; W += 1)
2573
- $ += a[W] ?? 100;
2574
- I -= v, e.fillRect(I, q, $, j), e.strokeRect(I + 0.5, q + 0.5, $ - 1, j - 1);
2609
+ ), z = this.headerHeight + g.fenwick.sum(E) - A, q = g.fenwick.sum(H + 1) - g.fenwick.sum(E);
2610
+ let k = this.rowHeaderWidth;
2611
+ for (let $ = 0; $ < X; $ += 1)
2612
+ k += a[$] ?? 100;
2613
+ let W = 0;
2614
+ for (let $ = X; $ <= N; $ += 1)
2615
+ W += a[$] ?? 100;
2616
+ k -= M, e.fillRect(k, z, W, q), e.strokeRect(k + 0.5, z + 0.5, W - 1, q - 1);
2575
2617
  }
2576
2618
  e.restore();
2577
2619
  }
@@ -2593,8 +2635,8 @@ const z = class z {
2593
2635
  s.set(a.id, l);
2594
2636
  let r = this.rowHeight;
2595
2637
  if (i && e) {
2596
- const h = this.dataModel.getRowVersion(a.id), d = this.rowHeightMeasuredVersion.get(a.id), u = this.dataModel.getRowHeight(a.id);
2597
- d === h && typeof u == "number" && (r = u);
2638
+ const h = this.dataModel.getRowVersion(a.id), d = this.rowHeightMeasuredVersion.get(a.id), f = this.dataModel.getRowHeight(a.id);
2639
+ d === h && typeof f == "number" && (r = f);
2598
2640
  }
2599
2641
  n[l] = r;
2600
2642
  }
@@ -2603,7 +2645,7 @@ const z = class z {
2603
2645
  rowsRef: t,
2604
2646
  idToIndex: s,
2605
2647
  heights: n,
2606
- fenwick: qt.from(n)
2648
+ fenwick: Gt.from(n)
2607
2649
  };
2608
2650
  }
2609
2651
  applyRowHeightUpdates(t) {
@@ -2632,9 +2674,9 @@ const z = class z {
2632
2674
  if (!this.canvas) return;
2633
2675
  const t = this.canvas.getContext("2d");
2634
2676
  if (!t) return;
2635
- t.font = `${Z}px ${Q}`;
2636
- const e = this.dataModel.getSchema(), i = this.dataModel.getView(), o = Y(e, i);
2637
- if (!e.columns.some((u) => i.wrapText?.[u.key] ?? u.wrapText)) return;
2677
+ t.font = `${et}px ${Z}`;
2678
+ const e = this.dataModel.getSchema(), i = this.dataModel.getView(), o = J(e, i);
2679
+ if (!e.columns.some((f) => i.wrapText?.[f.key] ?? f.wrapText)) return;
2638
2680
  const s = this.getRowHeightCacheKey(e, i, o);
2639
2681
  this.rowHeightCacheKey !== s && (this.rowHeightCacheKey = s, this.rowHeightMeasuredVersion.clear(), this.rowHeightMeasureTask = null);
2640
2682
  const l = this.rowHeightMeasureTask ?? { key: s, nextIndex: 0 };
@@ -2642,13 +2684,13 @@ const z = class z {
2642
2684
  const a = this.dataModel.listRows(), r = {};
2643
2685
  let h = 0;
2644
2686
  const d = performance.now();
2645
- for (; l.nextIndex < a.length && h < z.ROW_HEIGHT_MEASURE_CHUNK && !(performance.now() - d > z.ROW_HEIGHT_MEASURE_TIME_BUDGET_MS); ) {
2646
- const u = a[l.nextIndex];
2647
- if (l.nextIndex += 1, !u) continue;
2648
- const p = this.dataModel.getRowVersion(u.id);
2649
- if (this.rowHeightMeasuredVersion.get(u.id) === p) continue;
2650
- const m = this.measureRowHeight(t, u, e, o);
2651
- r[u.id] = m, this.rowHeightMeasuredVersion.set(u.id, p), h += 1;
2687
+ for (; l.nextIndex < a.length && h < U.ROW_HEIGHT_MEASURE_CHUNK && !(performance.now() - d > U.ROW_HEIGHT_MEASURE_TIME_BUDGET_MS); ) {
2688
+ const f = a[l.nextIndex];
2689
+ if (l.nextIndex += 1, !f) continue;
2690
+ const p = this.dataModel.getRowVersion(f.id);
2691
+ if (this.rowHeightMeasuredVersion.get(f.id) === p) continue;
2692
+ const m = this.measureRowHeight(t, f, e, o);
2693
+ r[f.id] = m, this.rowHeightMeasuredVersion.set(f.id, p), h += 1;
2652
2694
  }
2653
2695
  this.rowHeightMeasureTask = l.nextIndex < a.length ? l : null, this.ensureHeightIndex(a, this.rowHeightCacheKey, !0), this.applyRowHeightUpdates(r), this.dataModel.setRowHeightsBulk(r), this.rowHeightMeasureTask && this.scheduleRowHeightMeasurement();
2654
2696
  }
@@ -2657,11 +2699,11 @@ const z = class z {
2657
2699
  }
2658
2700
  hitTest(t) {
2659
2701
  if (!this.root || !this.canvas) return null;
2660
- const e = this.canvas.getBoundingClientRect(), i = t.clientX - e.left, o = t.clientY - e.top, n = i + this.root.scrollLeft, s = this.dataModel.getSchema(), l = this.dataModel.getView(), a = this.dataModel.listRows(), r = this.headerHeight, h = Y(s, l), d = s.columns.some((R) => l.wrapText?.[R.key] ?? R.wrapText), u = d ? this.getRowHeightCacheKey(s, l, h) : null;
2661
- this.ensureHeightIndex(a, u, d);
2702
+ const e = this.canvas.getBoundingClientRect(), i = t.clientX - e.left, o = t.clientY - e.top, n = i + this.root.scrollLeft, s = this.dataModel.getSchema(), l = this.dataModel.getView(), a = this.dataModel.listRows(), r = this.headerHeight, h = J(s, l), d = s.columns.some((R) => l.wrapText?.[R.key] ?? R.wrapText), f = d ? this.getRowHeightCacheKey(s, l, h) : null;
2703
+ this.ensureHeightIndex(a, f, d);
2662
2704
  const p = this.heightIndex;
2663
2705
  if (!p) return null;
2664
- const m = p.fenwick.total(), b = this.canvas?.height ?? this.root.clientHeight, x = Math.max(0, b - this.headerHeight), w = Math.max(0, m - x), f = Math.max(0, Math.min(this.root.scrollTop, w));
2706
+ const m = p.fenwick.total(), g = this.canvas?.height ?? this.root.clientHeight, S = Math.max(0, g - this.headerHeight), v = Math.max(0, m - S), u = Math.max(0, Math.min(this.root.scrollTop, v));
2665
2707
  if (o < r && i < this.rowHeaderWidth)
2666
2708
  return {
2667
2709
  rowId: "__all__",
@@ -2671,57 +2713,57 @@ const z = class z {
2671
2713
  if (o < r) {
2672
2714
  let R = this.rowHeaderWidth, A = -1;
2673
2715
  for (let D = 0; D < h.length; D += 1) {
2674
- const V = h[D] ?? 100;
2675
- if (n >= R && n <= R + V) {
2716
+ const P = h[D] ?? 100;
2717
+ if (n >= R && n <= R + P) {
2676
2718
  A = D;
2677
2719
  break;
2678
2720
  }
2679
- R += V;
2721
+ R += P;
2680
2722
  }
2681
2723
  if (A >= 0) {
2682
- const D = s.columns[A], V = new DOMRect(
2724
+ const D = s.columns[A], P = new DOMRect(
2683
2725
  e.left + R - this.root.scrollLeft,
2684
2726
  e.top,
2685
2727
  h[A] ?? 100,
2686
2728
  r
2687
2729
  );
2688
- return { rowId: "__header__", colKey: D.key, rect: V };
2730
+ return { rowId: "__header__", colKey: D.key, rect: P };
2689
2731
  }
2690
2732
  return null;
2691
2733
  }
2692
2734
  if (i < this.rowHeaderWidth) {
2693
- const R = o - r + f, A = Math.max(
2735
+ const R = o - r + u, A = Math.max(
2694
2736
  0,
2695
2737
  Math.min(a.length - 1, p.fenwick.lowerBound(R + 1))
2696
2738
  ), D = p.fenwick.sum(A);
2697
2739
  if (A < 0 || A >= a.length) return null;
2698
- const V = a[A], k = e.top + r + D - f, N = new DOMRect(
2740
+ const P = a[A], j = e.top + r + D - u, I = new DOMRect(
2699
2741
  e.left,
2700
- k,
2742
+ j,
2701
2743
  this.rowHeaderWidth,
2702
2744
  p.heights[A] ?? this.rowHeight
2703
2745
  );
2704
- return { rowId: V.id, colKey: null, rect: N };
2746
+ return { rowId: P.id, colKey: null, rect: I };
2705
2747
  }
2706
- const y = o - r + f, g = Math.max(0, Math.min(a.length - 1, p.fenwick.lowerBound(y + 1))), v = p.fenwick.sum(g);
2707
- if (g < 0 || g >= a.length) return null;
2708
- let C = this.rowHeaderWidth, S = -1;
2748
+ const w = o - r + u, y = Math.max(0, Math.min(a.length - 1, p.fenwick.lowerBound(w + 1))), C = p.fenwick.sum(y);
2749
+ if (y < 0 || y >= a.length) return null;
2750
+ let b = this.rowHeaderWidth, M = -1;
2709
2751
  for (let R = 0; R < h.length; R += 1) {
2710
2752
  const A = h[R] ?? 100;
2711
- if (n >= C && n <= C + A) {
2712
- S = R;
2753
+ if (n >= b && n <= b + A) {
2754
+ M = R;
2713
2755
  break;
2714
2756
  }
2715
- C += A;
2716
- }
2717
- if (S === -1) return null;
2718
- const M = a[g], L = s.columns[S], _ = v, K = new DOMRect(
2719
- e.left + C - this.root.scrollLeft,
2720
- e.top + r + _ - this.root.scrollTop,
2721
- h[S] ?? 100,
2722
- p.heights[g] ?? this.rowHeight
2757
+ b += A;
2758
+ }
2759
+ if (M === -1) return null;
2760
+ const x = a[y], L = s.columns[M], K = C, _ = new DOMRect(
2761
+ e.left + b - this.root.scrollLeft,
2762
+ e.top + r + K - this.root.scrollTop,
2763
+ h[M] ?? 100,
2764
+ p.heights[y] ?? this.rowHeight
2723
2765
  );
2724
- return { rowId: M.id, colKey: L.key, rect: K };
2766
+ return { rowId: x.id, colKey: L.key, rect: _ };
2725
2767
  }
2726
2768
  hitTestAction(t) {
2727
2769
  if (!this.root || !this.canvas) return null;
@@ -2731,28 +2773,28 @@ const z = class z {
2731
2773
  if (!o || o.type !== "button" && o.type !== "link") return null;
2732
2774
  const n = this.dataModel.resolveCellValue(e.rowId, o), s = this.dataModel.resolveConditionalStyle(e.rowId, o);
2733
2775
  if (n.textOverride ?? (s.forceErrorText ? "#ERROR" : void 0)) return null;
2734
- const a = o.type === "button" ? pt(n.value) : mt(n.value);
2776
+ const a = o.type === "button" ? vt(n.value) : bt(n.value);
2735
2777
  if (!a || !a.label) return null;
2736
2778
  const r = this.canvas.getContext("2d");
2737
2779
  if (!r) return null;
2738
- const h = Ft(o), d = s.delta ? rt(h, s.delta) : h, u = this.dataModel.getCellStyle(e.rowId, o.key), p = u ? rt(d, u) : d, m = p.bold ? "600 " : "", b = p.italic ? "italic " : "";
2739
- r.save(), r.font = `${b}${m}${Z}px ${Q}`.trim(), r.textBaseline = "alphabetic";
2740
- const w = this.dataModel.getView().wrapText?.[o.key] ?? o.wrapText ?? !1, f = o.style?.align ?? "left", y = e.rect.left + ut, g = e.rect.top + at, v = Math.max(0, e.rect.width - ut * 2), C = Math.max(
2780
+ const h = Bt(o), d = s.delta ? ht(h, s.delta) : h, f = this.dataModel.getCellStyle(e.rowId, o.key), p = f ? ht(d, f) : d, m = p.bold ? "600 " : "", g = p.italic ? "italic " : "";
2781
+ r.save(), r.font = `${g}${m}${et}px ${Z}`.trim(), r.textBaseline = "alphabetic";
2782
+ const v = this.dataModel.getView().wrapText?.[o.key] ?? o.wrapText ?? !1, u = o.style?.align ?? "left", w = e.rect.left + yt, y = e.rect.top + dt, C = Math.max(0, e.rect.width - yt * 2), b = Math.max(
2741
2783
  0,
2742
- e.rect.height - (at + Mt)
2743
- ), S = this.measureTextBounds(
2784
+ e.rect.height - (dt + Et)
2785
+ ), M = this.measureTextBounds(
2744
2786
  r,
2745
2787
  a.label,
2788
+ w,
2746
2789
  y,
2747
- g,
2748
- v,
2749
2790
  C,
2750
- w,
2751
- f
2791
+ b,
2792
+ v,
2793
+ u
2752
2794
  );
2753
- if (r.restore(), !S) return null;
2754
- const M = o.type === "button" ? 6 : 2, L = Math.max(e.rect.left, S.x - M), _ = Math.max(e.rect.top, S.y - M), K = Math.min(e.rect.right, S.x + S.width + M), R = Math.min(e.rect.bottom, S.y + S.height + M);
2755
- return t.clientX >= L && t.clientX <= K && t.clientY >= _ && t.clientY <= R ? { rowId: e.rowId, colKey: String(e.colKey), kind: o.type } : null;
2795
+ if (r.restore(), !M) return null;
2796
+ const x = o.type === "button" ? 6 : 2, L = Math.max(e.rect.left, M.x - x), K = Math.max(e.rect.top, M.y - x), _ = Math.min(e.rect.right, M.x + M.width + x), R = Math.min(e.rect.bottom, M.y + M.height + x);
2797
+ return t.clientX >= L && t.clientX <= _ && t.clientY >= K && t.clientY <= R ? { rowId: e.rowId, colKey: String(e.colKey), kind: o.type } : null;
2756
2798
  }
2757
2799
  isPointInSelection(t, e) {
2758
2800
  if (!this.selection.length) return !1;
@@ -2784,21 +2826,21 @@ const z = class z {
2784
2826
  }
2785
2827
  getCellRect(t, e) {
2786
2828
  if (!this.root || !this.canvas) return null;
2787
- const i = this.canvas.getBoundingClientRect(), o = this.dataModel.getSchema(), n = this.dataModel.getView(), s = this.dataModel.listRows(), l = this.dataModel.getRowIndex(t), a = o.columns.findIndex((b) => b.key === e);
2829
+ const i = this.canvas.getBoundingClientRect(), o = this.dataModel.getSchema(), n = this.dataModel.getView(), s = this.dataModel.listRows(), l = this.dataModel.getRowIndex(t), a = o.columns.findIndex((g) => g.key === e);
2788
2830
  if (l < 0 || a < 0) return null;
2789
- const r = Y(o, n), h = o.columns.some((b) => n.wrapText?.[b.key] ?? b.wrapText), d = h ? this.getRowHeightCacheKey(o, n, r) : null;
2831
+ const r = J(o, n), h = o.columns.some((g) => n.wrapText?.[g.key] ?? g.wrapText), d = h ? this.getRowHeightCacheKey(o, n, r) : null;
2790
2832
  this.ensureHeightIndex(s, d, h);
2791
- const u = this.heightIndex;
2792
- if (!u) return null;
2793
- const p = u.fenwick.sum(l);
2833
+ const f = this.heightIndex;
2834
+ if (!f) return null;
2835
+ const p = f.fenwick.sum(l);
2794
2836
  let m = this.rowHeaderWidth;
2795
- for (let b = 0; b < a; b += 1)
2796
- m += r[b] ?? 100;
2837
+ for (let g = 0; g < a; g += 1)
2838
+ m += r[g] ?? 100;
2797
2839
  return new DOMRect(
2798
2840
  i.left + m - this.root.scrollLeft,
2799
2841
  i.top + this.headerHeight + p - this.root.scrollTop,
2800
2842
  r[a] ?? 100,
2801
- u.heights[l] ?? this.rowHeight
2843
+ f.heights[l] ?? this.rowHeight
2802
2844
  );
2803
2845
  }
2804
2846
  updateCanvasCursor(t, e) {
@@ -2812,36 +2854,36 @@ const z = class z {
2812
2854
  return;
2813
2855
  }
2814
2856
  {
2815
- const d = this.canvas.getBoundingClientRect(), u = t - d.left, p = e - d.top, m = u + this.root.scrollLeft, b = p, x = this.hoverHeaderColKey, w = this.hoverHeaderIcon;
2816
- let f = null, y = !1;
2817
- if (b >= 0 && b < this.headerHeight && m >= this.rowHeaderWidth) {
2818
- const v = this.dataModel.getSchema(), C = this.dataModel.getView(), S = Y(v, C);
2819
- let M = this.rowHeaderWidth, L = -1;
2820
- for (let K = 0; K < S.length; K += 1) {
2821
- const R = S[K] ?? 100;
2822
- if (m >= M && m <= M + R) {
2823
- L = K;
2857
+ const d = this.canvas.getBoundingClientRect(), f = t - d.left, p = e - d.top, m = f + this.root.scrollLeft, g = p, S = this.hoverHeaderColKey, v = this.hoverHeaderIcon;
2858
+ let u = null, w = !1;
2859
+ if (g >= 0 && g < this.headerHeight && m >= this.rowHeaderWidth) {
2860
+ const C = this.dataModel.getSchema(), b = this.dataModel.getView(), M = J(C, b);
2861
+ let x = this.rowHeaderWidth, L = -1;
2862
+ for (let _ = 0; _ < M.length; _ += 1) {
2863
+ const R = M[_] ?? 100;
2864
+ if (m >= x && m <= x + R) {
2865
+ L = _;
2824
2866
  break;
2825
2867
  }
2826
- M += R;
2868
+ x += R;
2827
2869
  }
2828
- const _ = L >= 0 ? v.columns[L] : null;
2829
- if (_) {
2830
- f = _.key;
2831
- const K = S[L] ?? 100, R = 18, D = M + K - R - 4, V = Math.floor((this.headerHeight - R) / 2);
2832
- if (y = m >= D && m <= D + R && b >= V && b <= V + R, m >= M + K - Vt && m <= M + K + Vt && !y) {
2833
- const N = String(x ?? "") !== String(f ?? "") || !!w != !!y;
2834
- this.hoverHeaderColKey = f, this.hoverHeaderIcon = y, this.canvas.style.cursor = "col-resize", this.tooltip && (this.tooltip.dataset.visible = "0"), this.tooltipTarget = null, this.tooltipMessage = null, N && this.render();
2870
+ const K = L >= 0 ? C.columns[L] : null;
2871
+ if (K) {
2872
+ u = K.key;
2873
+ const _ = M[L] ?? 100, R = 18, D = x + _ - R - 4, P = Math.floor((this.headerHeight - R) / 2);
2874
+ if (w = m >= D && m <= D + R && g >= P && g <= P + R, m >= x + _ - Wt && m <= x + _ + Wt && !w) {
2875
+ const I = String(S ?? "") !== String(u ?? "") || !!v != !!w;
2876
+ this.hoverHeaderColKey = u, this.hoverHeaderIcon = w, this.canvas.style.cursor = "col-resize", this.tooltip && (this.tooltip.dataset.visible = "0"), this.tooltipTarget = null, this.tooltipMessage = null, I && this.render();
2835
2877
  return;
2836
2878
  }
2837
2879
  }
2838
2880
  }
2839
- const g = String(x ?? "") !== String(f ?? "") || !!w != !!y;
2840
- if (this.hoverHeaderColKey = f, this.hoverHeaderIcon = y, f !== null) {
2841
- this.canvas.style.cursor = y ? "pointer" : "default", this.tooltip && (this.tooltip.dataset.visible = "0"), this.tooltipTarget = null, this.tooltipMessage = null, g && this.render();
2881
+ const y = String(S ?? "") !== String(u ?? "") || !!v != !!w;
2882
+ if (this.hoverHeaderColKey = u, this.hoverHeaderIcon = w, u !== null) {
2883
+ this.canvas.style.cursor = w ? "pointer" : "default", this.tooltip && (this.tooltip.dataset.visible = "0"), this.tooltipTarget = null, this.tooltipMessage = null, y && this.render();
2842
2884
  return;
2843
2885
  }
2844
- g && this.render();
2886
+ y && this.render();
2845
2887
  }
2846
2888
  let i = "cell";
2847
2889
  const o = this.hitTest(new MouseEvent("mousemove", { clientX: t, clientY: e }));
@@ -2859,8 +2901,8 @@ const z = class z {
2859
2901
  }
2860
2902
  const n = this.dataModel.getCellMarker(o.rowId, o.colKey);
2861
2903
  if (this.tooltip && n) {
2862
- const d = this.tooltipTarget && this.tooltipTarget.rowId === o.rowId && this.tooltipTarget.colKey === o.colKey, u = this.tooltipMessage === n.message;
2863
- if (!d || !u || this.tooltip.dataset.visible !== "1") {
2904
+ const d = this.tooltipTarget && this.tooltipTarget.rowId === o.rowId && this.tooltipTarget.colKey === o.colKey, f = this.tooltipMessage === n.message;
2905
+ if (!d || !f || this.tooltip.dataset.visible !== "1") {
2864
2906
  this.tooltipTarget = { rowId: o.rowId, colKey: o.colKey }, this.tooltipMessage = n.message, this.tooltip.textContent = n.message;
2865
2907
  const p = this.getCellRect(o.rowId, o.colKey);
2866
2908
  p ? (this.positionTooltipAtRect(p), this.tooltip.dataset.visible = "1") : this.tooltip.dataset.visible = "0";
@@ -2879,7 +2921,7 @@ const z = class z {
2879
2921
  this.canvas.style.cursor = "cell";
2880
2922
  return;
2881
2923
  }
2882
- if (this.activeRowId && this.activeColKey !== null && this.activeRowId !== "__all__" && this.activeColKey !== "__all__" && kt(
2924
+ if (this.activeRowId && this.activeColKey !== null && this.activeRowId !== "__all__" && this.activeColKey !== "__all__" && Ht(
2883
2925
  this.dataModel,
2884
2926
  this.selection,
2885
2927
  this.activeRowId,
@@ -2888,8 +2930,8 @@ const z = class z {
2888
2930
  )) {
2889
2931
  const d = this.getCellRect(this.activeRowId, this.activeColKey);
2890
2932
  if (d) {
2891
- const u = ke(d, Re);
2892
- if (Ie(t, e, u)) {
2933
+ const f = He(d, Ae);
2934
+ if (Le(t, e, f)) {
2893
2935
  this.canvas.style.cursor = "crosshair";
2894
2936
  return;
2895
2937
  }
@@ -2904,8 +2946,8 @@ const z = class z {
2904
2946
  for (let l = 0; l < i.columns.length; l += 1) {
2905
2947
  const a = i.columns[l];
2906
2948
  if (!a || !(s.wrapText?.[a.key] ?? a.wrapText)) continue;
2907
- const h = (o[l] ?? 100) - this.padding, d = this.dataModel.resolveCellValue(e.id, a), u = this.dataModel.resolveConditionalStyle(e.id, a), m = d.textOverride ?? (u.forceErrorText ? "#ERROR" : void 0) ? "#ERROR" : this.formatValue(d.value, a).text, x = this.wrapLines(t, m, h).length * this.lineHeight + this.padding;
2908
- n = Math.max(n, x);
2949
+ const h = (o[l] ?? 100) - this.padding, d = this.dataModel.resolveCellValue(e.id, a), f = this.dataModel.resolveConditionalStyle(e.id, a), m = d.textOverride ?? (f.forceErrorText ? "#ERROR" : void 0) ? "#ERROR" : this.formatValue(d.value, a).text, S = this.wrapLines(t, m, h).length * this.lineHeight + this.padding;
2950
+ n = Math.max(n, S);
2909
2951
  }
2910
2952
  return n;
2911
2953
  }
@@ -2925,7 +2967,7 @@ const z = class z {
2925
2967
  }
2926
2968
  l.push(r);
2927
2969
  }
2928
- for (this.textMeasureCache.set(o, { lines: l }); this.textMeasureCache.size > z.TEXT_MEASURE_CACHE_MAX; ) {
2970
+ for (this.textMeasureCache.set(o, { lines: l }); this.textMeasureCache.size > U.TEXT_MEASURE_CACHE_MAX; ) {
2929
2971
  const a = this.textMeasureCache.keys().next().value;
2930
2972
  if (!a) break;
2931
2973
  this.textMeasureCache.delete(a);
@@ -2945,63 +2987,82 @@ const z = class z {
2945
2987
  measureTextBounds(t, e, i, o, n, s, l, a) {
2946
2988
  const r = this.getTextLinesForBounds(t, e, n, l, s);
2947
2989
  if (!r.length) return null;
2948
- let h = Number.POSITIVE_INFINITY, d = Number.NEGATIVE_INFINITY, u = Number.POSITIVE_INFINITY, p = Number.NEGATIVE_INFINITY;
2990
+ let h = Number.POSITIVE_INFINITY, d = Number.NEGATIVE_INFINITY, f = Number.POSITIVE_INFINITY, p = Number.NEGATIVE_INFINITY;
2949
2991
  for (let m = 0; m < r.length; m += 1) {
2950
- const b = r[m] ?? "", x = t.measureText(b).width;
2951
- let w = i;
2952
- a === "right" ? w = i + n - x : a === "center" && (w = i + (n - x) / 2);
2953
- const f = o + this.lineHeight * m, y = f + this.lineHeight;
2954
- h = Math.min(h, w), d = Math.max(d, w + x), u = Math.min(u, f), p = Math.max(p, y);
2992
+ const g = r[m] ?? "", S = t.measureText(g).width;
2993
+ let v = i;
2994
+ a === "right" ? v = i + n - S : a === "center" && (v = i + (n - S) / 2);
2995
+ const u = o + this.lineHeight * m, w = u + this.lineHeight;
2996
+ h = Math.min(h, v), d = Math.max(d, v + S), f = Math.min(f, u), p = Math.max(p, w);
2955
2997
  }
2956
- return !Number.isFinite(h) || !Number.isFinite(u) ? null : new DOMRect(h, u, d - h, p - u);
2998
+ return !Number.isFinite(h) || !Number.isFinite(f) ? null : new DOMRect(h, f, d - h, p - f);
2957
2999
  }
2958
- drawCellText(t, e, i, o, n, s, l, a = "left", r = !1, h = !1, d = !1, u) {
3000
+ drawCellText(t, e, i, o, n, s, l, a = "left", r = !1, h = !1, d = !1, f) {
2959
3001
  t.save(), t.beginPath(), t.rect(i - 4, o - 4, n + 8, s + 8), t.clip();
2960
3002
  const p = t.font;
2961
- r ? d ? t.font = `${Ko}px ${Q}` : t.font = "28px sans-serif" : h && (t.font = `${Z}px ${Q}`);
2962
- const m = this.getTextLinesForBounds(t, e, n, l, s), b = m.length * this.lineHeight, x = o + Math.max(0, Math.floor((s - b) / 2)), w = (f, y) => {
2963
- const g = x + this.lineHeight * y;
2964
- let v = i, C = i;
3003
+ r ? d ? t.font = `${Bo}px ${Z}` : t.font = "28px sans-serif" : h && (t.font = `${et}px ${Z}`);
3004
+ const m = this.getTextLinesForBounds(t, e, n, l, s), g = m.length * this.lineHeight, S = o + Math.max(0, Math.floor((s - g) / 2)), v = (u, w) => {
3005
+ const y = S + this.lineHeight * w;
3006
+ let C = i, b = i;
2965
3007
  if (a === "right")
2966
- t.textAlign = "right", C = i + n, v = C - t.measureText(f).width, t.fillText(f, C, g);
3008
+ t.textAlign = "right", b = i + n, C = b - t.measureText(u).width, t.fillText(u, b, y);
2967
3009
  else if (a === "center") {
2968
3010
  t.textAlign = "center";
2969
- const S = i + n / 2, M = t.measureText(f).width;
2970
- v = S - M / 2, C = S + M / 2, t.fillText(f, S, g);
3011
+ const M = i + n / 2, x = t.measureText(u).width;
3012
+ C = M - x / 2, b = M + x / 2, t.fillText(u, M, y);
2971
3013
  } else
2972
- t.textAlign = "left", v = i, C = i + t.measureText(f).width, t.fillText(f, i, g);
2973
- if (u?.underline || u?.strike) {
2974
- const S = t.strokeStyle, M = t.lineWidth;
2975
- if (t.strokeStyle = t.fillStyle, t.lineWidth = 1, t.beginPath(), u.underline) {
2976
- const L = g + 2;
2977
- t.moveTo(v, L), t.lineTo(C, L);
3014
+ t.textAlign = "left", C = i, b = i + t.measureText(u).width, t.fillText(u, i, y);
3015
+ if (f?.underline || f?.strike) {
3016
+ const M = t.strokeStyle, x = t.lineWidth;
3017
+ if (t.strokeStyle = t.fillStyle, t.lineWidth = 1, t.beginPath(), f.underline) {
3018
+ const L = y + 2;
3019
+ t.moveTo(C, L), t.lineTo(b, L);
2978
3020
  }
2979
- if (u.strike) {
2980
- const L = g - Math.floor(this.lineHeight / 2) + 2;
2981
- t.moveTo(v, L), t.lineTo(C, L);
3021
+ if (f.strike) {
3022
+ const L = y - Math.floor(this.lineHeight / 2) + 2;
3023
+ t.moveTo(C, L), t.lineTo(b, L);
2982
3024
  }
2983
- t.stroke(), t.strokeStyle = S, t.lineWidth = M;
3025
+ t.stroke(), t.strokeStyle = M, t.lineWidth = x;
2984
3026
  }
2985
3027
  };
2986
- for (let f = 0; f < m.length; f += 1)
2987
- w(m[f] ?? "", f + 1);
3028
+ for (let u = 0; u < m.length; u += 1)
3029
+ v(m[u] ?? "", u + 1);
2988
3030
  t.textAlign = "left", t.font = p, t.restore();
2989
3031
  }
3032
+ getUniqueDotColors() {
3033
+ const t = {
3034
+ current: "#ff3b30",
3035
+ previous: "#b0b0b0",
3036
+ default: "#3b82f6"
3037
+ };
3038
+ if (!this.root || typeof getComputedStyle != "function") return t;
3039
+ const e = getComputedStyle(this.root), i = (o, n) => e.getPropertyValue(o).trim() || n;
3040
+ return {
3041
+ current: i("--extable-unique-dot-current", t.current),
3042
+ previous: i("--extable-unique-dot-previous", t.previous),
3043
+ default: i("--extable-unique-dot-default", t.default)
3044
+ };
3045
+ }
3046
+ drawUniqueRadio(t, e, i, o, n, s, l) {
3047
+ const r = Math.max(8, Math.min(12, Math.min(o, n) - 4)) / 2, h = r / 2.2, d = i + n / 2;
3048
+ let f = e + r;
3049
+ s === "right" ? f = e + o - r : s === "center" && (f = e + o / 2), t.save(), t.strokeStyle = l, t.lineWidth = 1.5, t.beginPath(), t.arc(f, d, r, 0, Math.PI * 2), t.stroke(), t.fillStyle = l, t.beginPath(), t.arc(f, d, h, 0, Math.PI * 2), t.fill(), t.restore();
3050
+ }
2990
3051
  formatValue(t, e) {
2991
3052
  if (t == null) return { text: "" };
2992
3053
  if (typeof t == "object") {
2993
3054
  const i = t;
2994
3055
  if (i.kind === "lookup" && typeof i.label == "string")
2995
3056
  return { text: i.label };
2996
- const o = He(t);
3057
+ const o = Ve(t);
2997
3058
  if (o !== null) return { text: o };
2998
3059
  }
2999
3060
  if (e.type === "button")
3000
- return { text: ct(t) || String(t) };
3061
+ return { text: ut(t) || String(t) };
3001
3062
  if (e.type === "link")
3002
- return { text: ht(t) || String(t) };
3063
+ return { text: ft(t) || String(t) };
3003
3064
  if (e.type === "tags") {
3004
- const i = Wt(t);
3065
+ const i = zt(t);
3005
3066
  if (i) return { text: i.join(", ") };
3006
3067
  }
3007
3068
  if (e.type === "boolean")
@@ -3009,7 +3070,7 @@ const z = class z {
3009
3070
  if (e.type === "number" && typeof t == "number") {
3010
3071
  const i = t, o = e.format;
3011
3072
  if ((o?.format ?? "decimal") === "scientific") {
3012
- const r = Rt(i, { format: "scientific", precision: o?.precision }), h = o?.negativeRed && i < 0 ? "#b91c1c" : void 0;
3073
+ const r = At(i, { format: "scientific", precision: o?.precision }), h = o?.negativeRed && i < 0 ? "#b91c1c" : void 0;
3013
3074
  return { text: r, color: h };
3014
3075
  }
3015
3076
  const s = {};
@@ -3020,7 +3081,7 @@ const z = class z {
3020
3081
  if ((e.type === "int" || e.type === "uint") && typeof t == "number") {
3021
3082
  const i = t, o = e.format, n = o?.format ?? "decimal";
3022
3083
  if (n === "binary" || n === "octal" || n === "hex") {
3023
- const r = Ot(i, n), h = o?.negativeRed && i < 0 ? "#b91c1c" : void 0;
3084
+ const r = Ut(i, n), h = o?.negativeRed && i < 0 ? "#b91c1c" : void 0;
3024
3085
  return { text: r, color: h };
3025
3086
  }
3026
3087
  const s = {
@@ -3033,68 +3094,68 @@ const z = class z {
3033
3094
  if ((e.type === "date" || e.type === "time" || e.type === "datetime") && (t instanceof Date || typeof t == "string")) {
3034
3095
  const i = e.format, o = e.type === "date" ? i ?? "yyyy-MM-dd" : e.type === "time" ? i ?? "HH:mm" : i ?? "yyyy-MM-dd'T'HH:mm:ss'Z'";
3035
3096
  let n = null;
3036
- return t instanceof Date ? n = t : n = this.valueFormatCache.parseIsoDate(t), n ? { text: de(n, o) } : { text: String(t) };
3097
+ return t instanceof Date ? n = t : n = this.valueFormatCache.parseIsoDate(t), n ? { text: ge(n, o) } : { text: String(t) };
3037
3098
  }
3038
3099
  return { text: String(t) };
3039
3100
  }
3040
3101
  };
3041
- z.MAX_CANVAS_DIM_PX = 8192, z.ROW_HEIGHT_MEASURE_CHUNK = 500, z.ROW_HEIGHT_MEASURE_TIME_BUDGET_MS = 8, z.TEXT_MEASURE_CACHE_MAX = 2e3;
3042
- let It = z;
3043
- class Bo {
3044
- constructor(t, e, i, o, n, s, l, a, r, h, d, u, p, m, b, x, w) {
3045
- this.dataModel = a, this.onActiveChange = p, this.onSelectionChange = b, this.onUndo = x, this.onRedo = w, this.hitAction = null, this.handleDocumentContextMenu = null, this.selectionRanges = [], this.inputEl = null, this.floatingInputWrapper = null, this.selectionInput = null, this.copyToastEl = null, this.copyToastTimer = null, this.lookupDropdownEl = null, this.lookupDropdownTarget = null, this.lookupCandidates = [], this.lookupHighlightIndex = -1, this.lookupRequestId = 0, this.lookupAbort = null, this.lookupDebounceTimer = null, this.lookupInputCleanup = null, this.lookupRecentHistory = /* @__PURE__ */ new Map(), this.lastCommittedLookupCell = null, this.hoverTooltipEl = null, this.hoverTooltipTarget = null, this.hoverTooltipMessage = null, this.hoverTooltipRequestId = 0, this.hoverTooltipAbort = null, this.externalEditInFlight = !1, this.externalEditRequestId = 0, this.selectionMode = !0, this.lastBooleanCell = null, this.selectionAnchor = null, this.dragging = !1, this.dragStart = null, this.pointerDownClient = null, this.dragMoved = !1, this.dragSelectionChanged = !1, this.suppressNextClick = !1, this.fillDragging = !1, this.fillSource = null, this.fillEndRowIndex = null, this.columnResizing = !1, this.columnResizeState = null, this.rootCursorBackup = null, this.resizeCursorBackup = null, this.lastPointerClient = null, this.autoScrollRaf = null, this.autoScrollActive = !1, this.activeCell = null, this.activeHost = null, this.activeHostOriginalText = null, this.activeOriginalValue = null, this.composing = !1, this.lastCompositionEnd = 0, this.handleInputCompositionStart = () => {
3102
+ U.MAX_CANVAS_DIM_PX = 8192, U.ROW_HEIGHT_MEASURE_CHUNK = 500, U.ROW_HEIGHT_MEASURE_TIME_BUDGET_MS = 8, U.TEXT_MEASURE_CACHE_MAX = 2e3;
3103
+ let Lt = U;
3104
+ class zo {
3105
+ constructor(t, e, i, o, n, s, l, a, r, h, d, f, p, m, g, S, v) {
3106
+ this.dataModel = a, this.onActiveChange = p, this.onSelectionChange = g, this.onUndo = S, this.onRedo = v, this.hitAction = null, this.handleDocumentContextMenu = null, this.selectionRanges = [], this.inputEl = null, this.floatingInputWrapper = null, this.selectionInput = null, this.copyToastEl = null, this.copyToastTimer = null, this.lookupDropdownEl = null, this.lookupDropdownTarget = null, this.lookupCandidates = [], this.lookupHighlightIndex = -1, this.lookupRequestId = 0, this.lookupAbort = null, this.lookupDebounceTimer = null, this.lookupInputCleanup = null, this.lookupRecentHistory = /* @__PURE__ */ new Map(), this.lastCommittedLookupCell = null, this.hoverTooltipEl = null, this.hoverTooltipTarget = null, this.hoverTooltipMessage = null, this.hoverTooltipRequestId = 0, this.hoverTooltipAbort = null, this.externalEditInFlight = !1, this.externalEditRequestId = 0, this.selectionMode = !0, this.lastBooleanCell = null, this.selectionAnchor = null, this.dragging = !1, this.dragStart = null, this.pointerDownClient = null, this.dragMoved = !1, this.dragSelectionChanged = !1, this.suppressNextClick = !1, this.fillDragging = !1, this.fillSource = null, this.fillEndRowIndex = null, this.columnResizing = !1, this.columnResizeState = null, this.rootCursorBackup = null, this.resizeCursorBackup = null, this.lastPointerClient = null, this.autoScrollRaf = null, this.autoScrollActive = !1, this.activeCell = null, this.activeHost = null, this.activeHostOriginalText = null, this.activeOriginalValue = null, this.composing = !1, this.lastCompositionEnd = 0, this.handleInputCompositionStart = () => {
3046
3107
  this.composing = !0;
3047
3108
  }, this.handleInputCompositionEnd = () => {
3048
3109
  this.composing = !1, this.lastCompositionEnd = Date.now();
3049
- }, this.handleSelectionBlur = (f) => {
3050
- f?.relatedTarget instanceof HTMLElement && this.lookupDropdownEl?.contains(f.relatedTarget) || this.teardownSelectionInput();
3051
- }, this.handleRootKeydown = async (f) => {
3052
- if (f.defaultPrevented || !this.selectionMode || this.inputEl || f.isComposing || this.composing || !(typeof navigator < "u" && /mac/i.test(navigator.platform) ? f.metaKey : f.ctrlKey)) return;
3053
- const v = f.key.toLowerCase();
3054
- v === "c" ? (f.preventDefault(), await this.copySelection()) : v === "x" && (f.preventDefault(), await this.copySelection(), this.clearSelectionValues());
3110
+ }, this.handleSelectionBlur = (u) => {
3111
+ u?.relatedTarget instanceof HTMLElement && this.lookupDropdownEl?.contains(u.relatedTarget) || this.teardownSelectionInput();
3112
+ }, this.handleRootKeydown = async (u) => {
3113
+ if (u.defaultPrevented || !this.selectionMode || this.inputEl || u.isComposing || this.composing || !(typeof navigator < "u" && /mac/i.test(navigator.platform) ? u.metaKey : u.ctrlKey)) return;
3114
+ const C = u.key.toLowerCase();
3115
+ C === "c" ? (u.preventDefault(), await this.copySelection()) : C === "x" && (u.preventDefault(), await this.copySelection(), this.clearSelectionValues());
3055
3116
  }, this.handlePointerLeave = () => {
3056
3117
  this.hideHoverTooltip();
3057
- }, this.handlePointerDown = (f) => {
3058
- if (f.button !== 0) return;
3059
- const y = f.target;
3060
- if (y?.closest('button[data-extable-fs-open="1"]') || y?.closest(".extable-filter-sort-trigger") || y?.closest("button.extable-lookup-option") || this.inputEl && f.target && this.inputEl.contains(f.target) || this.inputEl && this.activeCell && this.activeCell.colKey !== null && !this.tryCommitActiveEditor() || this.fillDragging) return;
3061
- const g = this.getColumnResizeHit(f.clientX, f.clientY, f.target);
3062
- if (g) {
3063
- f.preventDefault(), this.beginColumnResize(g.colKey, g.colIndex, f.clientX), this.suppressNextClick = !0;
3118
+ }, this.handlePointerDown = (u) => {
3119
+ if (u.button !== 0) return;
3120
+ const w = u.target;
3121
+ if (w?.closest('button[data-extable-fs-open="1"]') || w?.closest(".extable-filter-sort-trigger") || w?.closest("button.extable-lookup-option") || this.inputEl && u.target && this.inputEl.contains(u.target) || this.inputEl && this.activeCell && this.activeCell.colKey !== null && !this.tryCommitActiveEditor() || this.fillDragging) return;
3122
+ const y = this.getColumnResizeHit(u.clientX, u.clientY, u.target);
3123
+ if (y) {
3124
+ u.preventDefault(), this.beginColumnResize(y.colKey, y.colIndex, u.clientX), this.suppressNextClick = !0;
3064
3125
  try {
3065
- f.target?.setPointerCapture?.(f.pointerId);
3126
+ u.target?.setPointerCapture?.(u.pointerId);
3066
3127
  } catch {
3067
3128
  }
3068
3129
  return;
3069
3130
  }
3070
- const v = this.hitTest(f);
3071
- if (!v || v.rowId === "__all__" && v.colKey === "__all__" || v.colKey === "__all__") return;
3072
- const C = Se(this.dataModel, this.selectionRanges);
3073
- if (C && this.activeCell) {
3074
- const R = this.dataModel.getSchema(), A = this.dataModel.listRows(), D = C.endRowIndex, V = C.colIndex, k = A[D], N = R.columns[V];
3075
- if (k && N) {
3076
- const T = this.findHtmlCellElement(k.id, N.key)?.getBoundingClientRect() ?? this.computeCanvasCellRect(k.id, N.key);
3077
- if (T && kt(
3131
+ const C = this.hitTest(u);
3132
+ if (!C || C.rowId === "__all__" && C.colKey === "__all__" || C.colKey === "__all__") return;
3133
+ const b = Te(this.dataModel, this.selectionRanges);
3134
+ if (b && this.activeCell) {
3135
+ const R = this.dataModel.getSchema(), A = this.dataModel.listRows(), D = b.endRowIndex, P = b.colIndex, j = A[D], I = R.columns[P];
3136
+ if (j && I) {
3137
+ const F = this.findHtmlCellElement(j.id, I.key)?.getBoundingClientRect() ?? this.computeCanvasCellRect(j.id, I.key);
3138
+ if (F && Ht(
3078
3139
  this.dataModel,
3079
3140
  this.selectionRanges,
3080
3141
  this.activeCell.rowId,
3081
3142
  this.activeCell.colKey,
3082
3143
  this.editMode
3083
3144
  )) {
3084
- const E = ke(T, Re);
3085
- if (Ie(f.clientX, f.clientY, E)) {
3086
- f.preventDefault(), this.fillDragging = !0, this.fillSource = C, this.fillEndRowIndex = C.endRowIndex, this.root.dataset.extableFillDragging = "1", this.rootCursorBackup === null && (this.rootCursorBackup = this.root.style.cursor || ""), this.root.style.cursor = "crosshair", this.lastPointerClient = { x: f.clientX, y: f.clientY }, this.dragging = !1, this.dragStart = null, this.suppressNextClick = !0;
3145
+ const B = He(F, Ae);
3146
+ if (Le(u.clientX, u.clientY, B)) {
3147
+ u.preventDefault(), this.fillDragging = !0, this.fillSource = b, this.fillEndRowIndex = b.endRowIndex, this.root.dataset.extableFillDragging = "1", this.rootCursorBackup === null && (this.rootCursorBackup = this.root.style.cursor || ""), this.root.style.cursor = "crosshair", this.lastPointerClient = { x: u.clientX, y: u.clientY }, this.dragging = !1, this.dragStart = null, this.suppressNextClick = !0;
3087
3148
  try {
3088
- f.target?.setPointerCapture?.(f.pointerId);
3149
+ u.target?.setPointerCapture?.(u.pointerId);
3089
3150
  } catch {
3090
3151
  }
3091
3152
  this.selectionRanges = [
3092
3153
  {
3093
3154
  kind: "cells",
3094
- startRow: C.startRowIndex,
3095
- endRow: C.endRowIndex,
3096
- startCol: C.colIndex,
3097
- endCol: C.colIndex
3155
+ startRow: b.startRowIndex,
3156
+ endRow: b.endRowIndex,
3157
+ startCol: b.colIndex,
3158
+ endCol: b.colIndex
3098
3159
  }
3099
3160
  ], this.onSelectionChange(this.selectionRanges), this.startAutoScroll();
3100
3161
  return;
@@ -3102,215 +3163,216 @@ class Bo {
3102
3163
  }
3103
3164
  }
3104
3165
  }
3105
- const S = this.dataModel.getSchema(), M = this.dataModel.listRows(), L = v.rowId === "__header__" ? 0 : this.dataModel.getRowIndex(v.rowId), _ = S.columns.findIndex((R) => String(R.key) === String(v.colKey));
3106
- if (_ < 0) return;
3107
- if (v.rowId === "__header__") {
3108
- if (!M.length) return;
3166
+ const M = this.dataModel.getSchema(), x = this.dataModel.listRows(), L = C.rowId === "__header__" ? 0 : this.dataModel.getRowIndex(C.rowId), K = M.columns.findIndex((R) => String(R.key) === String(C.colKey));
3167
+ if (K < 0) return;
3168
+ if (C.rowId === "__header__") {
3169
+ if (!x.length) return;
3109
3170
  const R = {
3110
3171
  kind: "cells",
3111
3172
  startRow: 0,
3112
- endRow: M.length - 1,
3113
- startCol: _,
3114
- endCol: _
3173
+ endRow: x.length - 1,
3174
+ startCol: K,
3175
+ endCol: K
3115
3176
  };
3116
3177
  this.selectionRanges = [R], this.onSelectionChange(this.selectionRanges), this.dragging = !1, this.selectionMode = !0, this.dragStart = null, this.selectionAnchor = null, this.suppressNextClick = !1;
3117
- const A = M[0], D = S.columns[_];
3178
+ const A = x[0], D = M.columns[K];
3118
3179
  A && D && (this.activeCell = { rowId: A.id, colKey: D.key }, this.onActiveChange(A.id, D.key)), this.focusSelectionInput("");
3119
3180
  return;
3120
3181
  }
3121
3182
  if (L < 0) return;
3122
- const K = v.colKey === null ? "rows" : "cells";
3123
- this.dragging = !0, this.pointerDownClient = { x: f.clientX, y: f.clientY }, this.dragMoved = !1, this.dragSelectionChanged = !1, this.dragStart = { rowIndex: L, colIndex: _, kind: K }, this.suppressNextClick = !1, this.selectionMode = !0, this.selectionAnchor = null, this.lastCommittedLookupCell = null, this.lastPointerClient = { x: f.clientX, y: f.clientY };
3183
+ const _ = C.colKey === null ? "rows" : "cells";
3184
+ this.dragging = !0, this.pointerDownClient = { x: u.clientX, y: u.clientY }, this.dragMoved = !1, this.dragSelectionChanged = !1, this.dragStart = { rowIndex: L, colIndex: K, kind: _ }, this.suppressNextClick = !1, this.selectionMode = !0, this.selectionAnchor = null, this.lastCommittedLookupCell = null, this.lastPointerClient = { x: u.clientX, y: u.clientY };
3124
3185
  try {
3125
- f.target?.setPointerCapture?.(f.pointerId);
3186
+ u.target?.setPointerCapture?.(u.pointerId);
3126
3187
  } catch {
3127
3188
  }
3128
3189
  this.startAutoScroll();
3129
- }, this.handlePointerMove = (f) => {
3130
- if (this.lastPointerClient = { x: f.clientX, y: f.clientY }, this.columnResizing) {
3131
- this.updateColumnResize(f.clientX);
3190
+ }, this.handlePointerMove = (u) => {
3191
+ if (this.lastPointerClient = { x: u.clientX, y: u.clientY }, this.columnResizing) {
3192
+ this.updateColumnResize(u.clientX);
3132
3193
  return;
3133
3194
  }
3134
3195
  if (this.fillDragging && this.fillSource) {
3135
- this.updateFillDragFromClientPoint(f.clientX, f.clientY);
3196
+ this.updateFillDragFromClientPoint(u.clientX, u.clientY);
3136
3197
  return;
3137
3198
  }
3138
3199
  if (!this.dragging || !this.dragStart) {
3139
- this.updateHoverTooltip(f);
3200
+ this.updateHoverTooltip(u);
3140
3201
  return;
3141
3202
  }
3142
3203
  if (!this.dragMoved && this.pointerDownClient) {
3143
- const y = f.clientX - this.pointerDownClient.x, g = f.clientY - this.pointerDownClient.y;
3144
- if (y * y + g * g < 9) return;
3204
+ const w = u.clientX - this.pointerDownClient.x, y = u.clientY - this.pointerDownClient.y;
3205
+ if (w * w + y * y < 9) return;
3145
3206
  this.dragMoved = !0;
3146
3207
  }
3147
- this.updateDragFromClientPoint(f.clientX, f.clientY);
3148
- }, this.handlePointerUp = (f) => {
3208
+ this.updateDragFromClientPoint(u.clientX, u.clientY);
3209
+ }, this.handlePointerUp = (u) => {
3149
3210
  if (this.columnResizing) {
3150
3211
  this.endColumnResize();
3151
3212
  try {
3152
- f.target?.releasePointerCapture?.(f.pointerId);
3213
+ u.target?.releasePointerCapture?.(u.pointerId);
3153
3214
  } catch {
3154
3215
  }
3155
3216
  this.suppressNextClick = !0;
3156
3217
  return;
3157
3218
  }
3158
3219
  if (this.fillDragging && this.fillSource) {
3159
- const g = this.fillSource, v = this.fillEndRowIndex ?? g.endRowIndex;
3220
+ const y = this.fillSource, C = this.fillEndRowIndex ?? y.endRowIndex;
3160
3221
  this.fillDragging = !1, this.fillSource = null, this.fillEndRowIndex = null, this.root.dataset.extableFillDragging = "", this.rootCursorBackup !== null && (this.root.style.cursor = this.rootCursorBackup, this.rootCursorBackup = null), this.stopAutoScroll();
3161
3222
  try {
3162
- f.target?.releasePointerCapture?.(f.pointerId);
3223
+ u.target?.releasePointerCapture?.(u.pointerId);
3163
3224
  } catch {
3164
3225
  }
3165
- this.commitFill(g, v), this.suppressNextClick = !0;
3226
+ this.commitFill(y, C), this.suppressNextClick = !0;
3166
3227
  return;
3167
3228
  }
3168
3229
  if (!this.dragging) return;
3169
3230
  this.dragging = !1, this.dragStart = null;
3170
- const y = this.dragSelectionChanged;
3231
+ const w = this.dragSelectionChanged;
3171
3232
  this.pointerDownClient = null, this.dragMoved = !1, this.dragSelectionChanged = !1, this.stopAutoScroll();
3172
3233
  try {
3173
- f.target?.releasePointerCapture?.(f.pointerId);
3234
+ u.target?.releasePointerCapture?.(u.pointerId);
3174
3235
  } catch {
3175
3236
  }
3176
- if (y && (this.suppressNextClick = !0), this.suppressNextClick && this.activeCell && this.activeCell.colKey !== null) {
3177
- const g = this.dataModel.getCell(this.activeCell.rowId, this.activeCell.colKey);
3178
- this.focusSelectionInput(this.cellToClipboardString(g));
3237
+ if (w && (this.suppressNextClick = !0), this.suppressNextClick && this.activeCell && this.activeCell.colKey !== null) {
3238
+ const y = this.dataModel.getCell(this.activeCell.rowId, this.activeCell.colKey);
3239
+ this.focusSelectionInput(this.cellToClipboardString(y));
3179
3240
  }
3180
- }, this.handleSelectionCopy = (f) => {
3241
+ }, this.handleSelectionCopy = (u) => {
3181
3242
  if (!this.selectionMode) return;
3182
- const y = this.buildSelectionClipboardPayload();
3183
- y && (f.preventDefault(), f.clipboardData?.setData("text/plain", y.text), f.clipboardData?.setData("text/tab-separated-values", y.text), f.clipboardData?.setData("text/html", y.html), this.showCopyToast(`Copied ${y.cellCount} cells`, "info"));
3184
- }, this.handleSelectionCut = (f) => {
3243
+ const w = this.buildSelectionClipboardPayload();
3244
+ w && (u.preventDefault(), u.clipboardData?.setData("text/plain", w.text), u.clipboardData?.setData("text/tab-separated-values", w.text), u.clipboardData?.setData("text/html", w.html), this.showCopyToast(`Copied ${w.cellCount} cells`, "info"));
3245
+ }, this.handleSelectionCut = (u) => {
3185
3246
  if (!this.selectionMode) return;
3186
- const y = this.buildSelectionClipboardPayload();
3187
- y && (f.preventDefault(), f.clipboardData?.setData("text/plain", y.text), f.clipboardData?.setData("text/tab-separated-values", y.text), f.clipboardData?.setData("text/html", y.html), this.clearSelectionValues());
3188
- }, this.handleSelectionPaste = (f) => {
3247
+ const w = this.buildSelectionClipboardPayload();
3248
+ w && (u.preventDefault(), u.clipboardData?.setData("text/plain", w.text), u.clipboardData?.setData("text/tab-separated-values", w.text), u.clipboardData?.setData("text/html", w.html), this.clearSelectionValues());
3249
+ }, this.handleSelectionPaste = (u) => {
3189
3250
  if (!this.selectionMode) return;
3190
- f.preventDefault();
3191
- const y = f.clipboardData?.getData("text/html") ?? "", g = f.clipboardData?.getData("text/tab-separated-values") ?? "", v = f.clipboardData?.getData("text/plain") ?? "", C = this.parseClipboardGrid({ html: y, tsv: g, text: v });
3192
- C && this.applyClipboardGrid(C);
3193
- }, this.handleSelectionCompositionStart = (f) => {
3251
+ u.preventDefault();
3252
+ const w = u.clipboardData?.getData("text/html") ?? "", y = u.clipboardData?.getData("text/tab-separated-values") ?? "", C = u.clipboardData?.getData("text/plain") ?? "", b = this.parseClipboardGrid({ html: w, tsv: y, text: C });
3253
+ b && this.applyClipboardGrid(b);
3254
+ }, this.handleSelectionCompositionStart = (u) => {
3194
3255
  if (!this.selectionMode) return;
3195
- const y = this.activeCell;
3196
- if (!(!y || y.colKey === null)) {
3197
- if (this.isCellReadonly(y.rowId, y.colKey)) {
3198
- f?.preventDefault?.(), f?.stopPropagation?.();
3199
- const g = this.dataModel.getCell(y.rowId, y.colKey), v = this.cellToClipboardString(g);
3200
- this.teardownSelectionInput(), this.focusSelectionInput(v);
3256
+ const w = this.activeCell;
3257
+ if (!(!w || w.colKey === null)) {
3258
+ if (this.isCellReadonly(w.rowId, w.colKey)) {
3259
+ u?.preventDefault?.(), u?.stopPropagation?.();
3260
+ const y = this.dataModel.getCell(w.rowId, w.colKey), C = this.cellToClipboardString(y);
3261
+ this.teardownSelectionInput(), this.focusSelectionInput(C);
3201
3262
  return;
3202
3263
  }
3203
3264
  this.selectionMode = !1, this.openEditorAtActiveCell();
3204
3265
  }
3205
- }, this.handleSelectionBeforeInput = (f) => {
3266
+ }, this.handleSelectionBeforeInput = (u) => {
3206
3267
  if (!this.selectionMode) return;
3207
- const y = this.activeCell;
3208
- if (!(!y || y.colKey === null) && this.isCellReadonly(y.rowId, y.colKey)) {
3209
- f.preventDefault();
3268
+ const w = this.activeCell;
3269
+ if (!(!w || w.colKey === null) && this.isCellReadonly(w.rowId, w.colKey)) {
3270
+ u.preventDefault();
3210
3271
  try {
3211
- const g = this.dataModel.getCell(y.rowId, y.colKey), v = this.cellToClipboardString(g), C = this.ensureSelectionInput();
3212
- C.value = v, C.select();
3272
+ const y = this.dataModel.getCell(w.rowId, w.colKey), C = this.cellToClipboardString(y), b = this.ensureSelectionInput();
3273
+ b.value = C, b.select();
3213
3274
  } catch {
3214
3275
  }
3215
3276
  }
3216
- }, this.handleSelectionKeydown = async (f) => {
3217
- if (!this.activeCell || f.isComposing || this.composing) return;
3277
+ }, this.handleSelectionKeydown = async (u) => {
3278
+ if (!this.activeCell || u.isComposing || this.composing) return;
3218
3279
  if (!this.selectionMode && this.inputEl) {
3219
- this.handleKey(f, document.createElement("div"));
3280
+ this.handleKey(u, document.createElement("div"));
3220
3281
  return;
3221
3282
  }
3222
- if (!this.selectionMode || f.key === "Shift" || f.key === "Control" || f.key === "Alt" || f.key === "Meta" || f.key === "CapsLock" || f.key === "NumLock" || f.key === "ScrollLock")
3283
+ if (!this.selectionMode || u.key === "Shift" || u.key === "Control" || u.key === "Alt" || u.key === "Meta" || u.key === "CapsLock" || u.key === "NumLock" || u.key === "ScrollLock")
3223
3284
  return;
3224
- const y = typeof navigator < "u" && /mac/i.test(navigator.platform);
3225
- if (y ? f.metaKey : f.ctrlKey) {
3226
- const M = f.key.toLowerCase();
3227
- if (M === "z") {
3228
- f.preventDefault(), y && f.shiftKey ? this.onRedo() : this.onUndo(), this.selectionAnchor = null;
3285
+ const w = typeof navigator < "u" && /mac/i.test(navigator.platform);
3286
+ if (w ? u.metaKey : u.ctrlKey) {
3287
+ const x = u.key.toLowerCase();
3288
+ if (x === "z") {
3289
+ u.preventDefault(), w && u.shiftKey ? this.onRedo() : this.onUndo(), this.selectionAnchor = null;
3229
3290
  return;
3230
3291
  }
3231
- if (M === "y") {
3232
- f.preventDefault(), this.onRedo(), this.selectionAnchor = null;
3292
+ if (x === "y") {
3293
+ u.preventDefault(), this.onRedo(), this.selectionAnchor = null;
3233
3294
  return;
3234
3295
  }
3235
- if (M === "c") {
3236
- f.preventDefault(), await this.copySelection(), this.selectionAnchor = null;
3296
+ if (x === "c") {
3297
+ u.preventDefault(), await this.copySelection(), this.selectionAnchor = null;
3237
3298
  return;
3238
3299
  }
3239
- if (M === "x") {
3240
- f.preventDefault(), await this.copySelection(), this.clearSelectionValues(), this.selectionAnchor = null;
3300
+ if (x === "x") {
3301
+ u.preventDefault(), await this.copySelection(), this.clearSelectionValues(), this.selectionAnchor = null;
3241
3302
  return;
3242
3303
  }
3243
- if (M === "v") {
3304
+ if (x === "v") {
3244
3305
  this.selectionAnchor = null;
3245
3306
  return;
3246
3307
  }
3247
3308
  }
3248
- if (f.key === " " && this.activeCell.colKey !== null) {
3249
- const M = this.findColumn(this.activeCell.colKey);
3250
- if (M?.type === "button" || M?.type === "link") {
3251
- f.preventDefault(), this.triggerCellAction(this.activeCell.rowId, this.activeCell.colKey, M.type), this.selectionAnchor = null;
3309
+ if (u.key === " " && this.activeCell.colKey !== null) {
3310
+ const x = this.findColumn(this.activeCell.colKey);
3311
+ if (x?.type === "button" || x?.type === "link") {
3312
+ u.preventDefault(), this.triggerCellAction(this.activeCell.rowId, this.activeCell.colKey, x.type), this.selectionAnchor = null;
3252
3313
  return;
3253
3314
  }
3254
- if (M?.type === "boolean") {
3255
- f.preventDefault(), this.toggleBoolean(this.activeCell.rowId, this.activeCell.colKey), this.selectionAnchor = null;
3315
+ if (x?.type === "boolean") {
3316
+ u.preventDefault(), this.toggleBoolean(this.activeCell.rowId, this.activeCell.colKey), this.selectionAnchor = null;
3256
3317
  return;
3257
3318
  }
3258
3319
  this.selectionAnchor = null;
3259
3320
  return;
3260
3321
  }
3261
- const v = f.key === "Tab", C = f.key === "Enter", S = f.key === "ArrowLeft" || f.key === "ArrowRight" || f.key === "ArrowUp" || f.key === "ArrowDown";
3262
- if (v || C || S) {
3263
- if (f.preventDefault(), this.teardownSelectionInput(), v) {
3264
- this.moveActiveCell(0, f.shiftKey ? -1 : 1, !1);
3322
+ const C = u.key === "Tab", b = u.key === "Enter", M = u.key === "ArrowLeft" || u.key === "ArrowRight" || u.key === "ArrowUp" || u.key === "ArrowDown";
3323
+ if (C || b || M) {
3324
+ if (u.preventDefault(), this.teardownSelectionInput(), C) {
3325
+ this.moveActiveCell(0, u.shiftKey ? -1 : 1, !1);
3265
3326
  return;
3266
3327
  }
3267
- if (C) {
3268
- this.moveActiveCell(f.shiftKey ? -1 : 1, 0, !1);
3328
+ if (b) {
3329
+ this.moveActiveCell(u.shiftKey ? -1 : 1, 0, !1);
3269
3330
  return;
3270
3331
  }
3271
- const M = f.shiftKey;
3272
- f.key === "ArrowLeft" ? this.moveActiveCell(0, -1, M) : f.key === "ArrowRight" ? this.moveActiveCell(0, 1, M) : f.key === "ArrowUp" ? this.moveActiveCell(-1, 0, M) : f.key === "ArrowDown" && this.moveActiveCell(1, 0, M);
3332
+ const x = u.shiftKey;
3333
+ u.key === "ArrowLeft" ? this.moveActiveCell(0, -1, x) : u.key === "ArrowRight" ? this.moveActiveCell(0, 1, x) : u.key === "ArrowUp" ? this.moveActiveCell(-1, 0, x) : u.key === "ArrowDown" && this.moveActiveCell(1, 0, x);
3273
3334
  return;
3274
3335
  }
3275
3336
  if (this.activeCell.colKey !== null && this.isCellReadonly(this.activeCell.rowId, this.activeCell.colKey)) {
3276
- f.preventDefault(), this.selectionAnchor = null;
3337
+ u.preventDefault(), this.selectionAnchor = null;
3277
3338
  return;
3278
3339
  }
3279
3340
  this.selectionMode = !1, this.selectionAnchor = null, this.openEditorAtActiveCell();
3280
- }, this.handleClick = (f) => {
3281
- const y = f.target;
3282
- if (f.button !== 0 || y?.closest("button.extable-lookup-option") || y?.closest('button[data-extable-fs-open="1"]'))
3341
+ }, this.handleClick = (u) => {
3342
+ const w = u.target;
3343
+ if (u.button !== 0 || w?.closest("button.extable-lookup-option") || w?.closest('button[data-extable-fs-open="1"]'))
3283
3344
  return;
3284
3345
  if (this.suppressNextClick) {
3285
3346
  this.suppressNextClick = !1;
3286
3347
  return;
3287
3348
  }
3288
- if (this.inputEl && f.target && this.inputEl.contains(f.target) || this.inputEl && this.activeCell && this.activeCell.colKey !== null && !this.tryCommitActiveEditor())
3349
+ if (this.inputEl && u.target && this.inputEl.contains(u.target) || this.inputEl && this.activeCell && this.activeCell.colKey !== null && !this.tryCommitActiveEditor())
3289
3350
  return;
3290
- const g = this.getHitAtClientPoint(f.clientX, f.clientY, f.target);
3291
- if (f.target?.closest("input.extable-unique-radio") && g) {
3292
- if (g.colKey === null) return;
3293
- const R = this.findColumn(g.colKey);
3351
+ const y = this.getHitAtClientPoint(u.clientX, u.clientY, u.target), C = u.target?.closest(".extable-unique-radio");
3352
+ if (C && y) {
3353
+ if (y.colKey === null) return;
3354
+ const R = this.findColumn(y.colKey);
3294
3355
  if (R && R.type === "boolean" && R.unique) {
3295
- this.toggleBoolean(g.rowId, g.colKey), f.preventDefault();
3356
+ if (this.isCellReadonly(y.rowId, y.colKey) || C.getAttribute("aria-disabled") === "true") return;
3357
+ this.toggleBoolean(y.rowId, y.colKey), u.preventDefault();
3296
3358
  return;
3297
3359
  }
3298
3360
  }
3299
- if (!g) return;
3300
- const C = this.hitAction ? this.hitAction(f) : null;
3301
- if (C) {
3302
- if (C.kind === "tag-remove") {
3303
- if (this.removeTagValue(C.rowId, C.colKey, C.tagIndex)) {
3304
- f.preventDefault();
3361
+ if (!y) return;
3362
+ const b = this.hitAction ? this.hitAction(u) : null;
3363
+ if (b) {
3364
+ if (b.kind === "tag-remove") {
3365
+ if (this.removeTagValue(b.rowId, b.colKey, b.tagIndex)) {
3366
+ u.preventDefault();
3305
3367
  return;
3306
3368
  }
3307
- } else if (this.triggerCellAction(C.rowId, C.colKey, C.kind)) {
3308
- f.preventDefault();
3369
+ } else if (this.triggerCellAction(b.rowId, b.colKey, b.kind)) {
3370
+ u.preventDefault();
3309
3371
  return;
3310
3372
  }
3311
3373
  }
3312
- const S = this.selectionMode && !f.shiftKey && !f.metaKey && !f.ctrlKey && this.activeCell?.rowId === g.rowId && String(this.activeCell?.colKey) === String(g.colKey);
3313
- if (g.rowId === "__all__" && g.colKey === "__all__") {
3374
+ const M = this.selectionMode && !u.shiftKey && !u.metaKey && !u.ctrlKey && this.activeCell?.rowId === y.rowId && String(this.activeCell?.colKey) === String(y.colKey);
3375
+ if (y.rowId === "__all__" && y.colKey === "__all__") {
3314
3376
  const R = this.dataModel.getSchema(), A = this.dataModel.listRows();
3315
3377
  this.teardownInput(!1), A.length && R.columns.length ? (this.selectionRanges = [
3316
3378
  {
@@ -3323,8 +3385,8 @@ class Bo {
3323
3385
  ], this.activeCell = { rowId: "__all__", colKey: "__all__" }, this.onActiveChange("__all__", "__all__"), this.onSelectionChange(this.selectionRanges), this.updateFillHandleFlag(), this.selectionMode = !0, this.selectionAnchor = null, this.focusSelectionInput("")) : (this.activeCell = null, this.onActiveChange("__all__", "__all__"), this.selectionAnchor = null);
3324
3386
  return;
3325
3387
  }
3326
- if (this.onRowSelect(g.rowId), g.rowId === "__header__") {
3327
- const R = this.dataModel.getSchema(), A = this.dataModel.listRows(), D = R.columns.findIndex((V) => String(V.key) === String(g.colKey));
3388
+ if (this.onRowSelect(y.rowId), y.rowId === "__header__") {
3389
+ const R = this.dataModel.getSchema(), A = this.dataModel.listRows(), D = R.columns.findIndex((P) => String(P.key) === String(y.colKey));
3328
3390
  A.length && D >= 0 && (this.selectionRanges = [
3329
3391
  {
3330
3392
  kind: "cells",
@@ -3333,46 +3395,46 @@ class Bo {
3333
3395
  startCol: D,
3334
3396
  endCol: D
3335
3397
  }
3336
- ], this.activeCell = { rowId: A[0].id, colKey: g.colKey }, this.onActiveChange(this.activeCell.rowId, this.activeCell.colKey), this.onSelectionChange(this.selectionRanges), this.updateFillHandleFlag(), this.selectionMode = !0, this.selectionAnchor = null, this.focusSelectionInput(""));
3398
+ ], this.activeCell = { rowId: A[0].id, colKey: y.colKey }, this.onActiveChange(this.activeCell.rowId, this.activeCell.colKey), this.onSelectionChange(this.selectionRanges), this.updateFillHandleFlag(), this.selectionMode = !0, this.selectionAnchor = null, this.focusSelectionInput(""));
3337
3399
  return;
3338
3400
  }
3339
- if (this.applySelectionFromHit(f, g), g.colKey === null || g.colKey === "__all__") {
3401
+ if (this.applySelectionFromHit(u, y), y.colKey === null || y.colKey === "__all__") {
3340
3402
  this.selectionMode = !0, this.selectionAnchor = null, this.focusSelectionInput("");
3341
3403
  return;
3342
3404
  }
3343
- if (g.rowId === "__header__") {
3405
+ if (y.rowId === "__header__") {
3344
3406
  this.selectionMode = !0, this.selectionAnchor = null, this.focusSelectionInput("");
3345
3407
  return;
3346
3408
  }
3347
- if (this.isCellReadonly(g.rowId, g.colKey)) {
3409
+ if (this.isCellReadonly(y.rowId, y.colKey)) {
3348
3410
  this.selectionMode = !0, this.selectionAnchor = null, this.teardownInput(!1);
3349
- const R = this.dataModel.getCell(g.rowId, g.colKey);
3411
+ const R = this.dataModel.getCell(y.rowId, y.colKey);
3350
3412
  this.focusSelectionInput(this.cellToClipboardString(R));
3351
3413
  return;
3352
3414
  }
3353
- if (this.findColumn(g.colKey)?.type === "boolean") {
3354
- const R = this.lastBooleanCell?.rowId === g.rowId && String(this.lastBooleanCell?.colKey) === String(g.colKey);
3355
- if (this.lastBooleanCell = { rowId: g.rowId, colKey: g.colKey }, this.selectionMode = !0, this.selectionAnchor = null, this.teardownInput(!1), this.teardownSelectionInput(), R) {
3356
- this.toggleBoolean(g.rowId, g.colKey), this.focusSelectionInput("");
3415
+ if (this.findColumn(y.colKey)?.type === "boolean") {
3416
+ const R = this.lastBooleanCell?.rowId === y.rowId && String(this.lastBooleanCell?.colKey) === String(y.colKey);
3417
+ if (this.lastBooleanCell = { rowId: y.rowId, colKey: y.colKey }, this.selectionMode = !0, this.selectionAnchor = null, this.teardownInput(!1), this.teardownSelectionInput(), R) {
3418
+ this.toggleBoolean(y.rowId, y.colKey), this.focusSelectionInput("");
3357
3419
  return;
3358
3420
  }
3359
3421
  this.focusSelectionInput("");
3360
3422
  return;
3361
3423
  }
3362
3424
  this.lastBooleanCell = null, this.selectionAnchor = null, this.teardownInput(!1);
3363
- const _ = this.dataModel.getCell(g.rowId, g.colKey), K = this.cellToClipboardString(_);
3364
- this.focusSelectionInput(K), S && (this.selectionMode = !1, this.openEditorAtActiveCell());
3365
- }, this.handleContextMenu = (f) => {
3366
- const y = f.target;
3367
- if (f.ctrlKey) {
3368
- f.preventDefault();
3425
+ const K = this.dataModel.getCell(y.rowId, y.colKey), _ = this.cellToClipboardString(K);
3426
+ this.focusSelectionInput(_), M && (this.selectionMode = !1, this.openEditorAtActiveCell());
3427
+ }, this.handleContextMenu = (u) => {
3428
+ const w = u.target;
3429
+ if (u.ctrlKey) {
3430
+ u.preventDefault();
3369
3431
  return;
3370
3432
  }
3371
- if (!y || !this.root.contains(y)) return;
3372
- f.preventDefault(), f.stopPropagation();
3373
- const g = this.hitTest(f), v = g?.rowId ?? null, C = g?.colKey ?? null;
3374
- this.onContextMenu(v, C, f.clientX, f.clientY);
3375
- }, this.root = t, this.editMode = e, this.onEdit = i, this.onRowSelect = o, this.onMove = n, this.hitTest = s, this.hitAction = l, this.sequenceLangs = r, this.isCellReadonly = h, this.onCellAction = d, this.onViewChange = u, this.onContextMenu = m, this.bind();
3433
+ if (!w || !this.root.contains(w)) return;
3434
+ u.preventDefault(), u.stopPropagation();
3435
+ const y = this.hitTest(u), C = y?.rowId ?? null, b = y?.colKey ?? null;
3436
+ this.onContextMenu(C, b, u.clientX, u.clientY);
3437
+ }, this.root = t, this.editMode = e, this.onEdit = i, this.onRowSelect = o, this.onMove = n, this.hitTest = s, this.hitAction = l, this.sequenceLangs = r, this.isCellReadonly = h, this.onCellAction = d, this.onViewChange = f, this.onContextMenu = m, this.bind();
3376
3438
  }
3377
3439
  setEditMode(t) {
3378
3440
  this.editMode = t;
@@ -3383,9 +3445,9 @@ class Bo {
3383
3445
  this.selectionRanges = [], this.activeCell = null, this.selectionAnchor = null, this.lastBooleanCell = null, this.teardownInput(!0), this.onActiveChange(null, null), this.onSelectionChange(this.selectionRanges), this.updateFillHandleFlag();
3384
3446
  return;
3385
3447
  }
3386
- const i = e.length - 1, o = t.columns.length - 1, n = this.activeCell?.rowId ?? null, s = this.activeCell?.colKey ?? null, l = n ? this.dataModel.getRowIndex(n) : -1, a = s !== null ? t.columns.findIndex((f) => String(f.key) === String(s)) : -1;
3448
+ const i = e.length - 1, o = t.columns.length - 1, n = this.activeCell?.rowId ?? null, s = this.activeCell?.colKey ?? null, l = n ? this.dataModel.getRowIndex(n) : -1, a = s !== null ? t.columns.findIndex((u) => String(u.key) === String(s)) : -1;
3387
3449
  if (l >= 0 && a >= 0) {
3388
- let f = !1;
3450
+ let u = !1;
3389
3451
  if (!this.selectionRanges.length)
3390
3452
  this.selectionRanges = [
3391
3453
  {
@@ -3395,40 +3457,40 @@ class Bo {
3395
3457
  startCol: a,
3396
3458
  endCol: a
3397
3459
  }
3398
- ], f = !0;
3460
+ ], u = !0;
3399
3461
  else {
3400
- const y = this.selectionRanges.map((g) => {
3401
- const v = (S, M) => Math.max(0, Math.min(M, S)), C = {
3402
- ...g,
3403
- startRow: v(g.startRow, i),
3404
- endRow: v(g.endRow, i),
3405
- startCol: v(g.startCol, o),
3406
- endCol: v(g.endCol, o)
3462
+ const w = this.selectionRanges.map((y) => {
3463
+ const C = (M, x) => Math.max(0, Math.min(x, M)), b = {
3464
+ ...y,
3465
+ startRow: C(y.startRow, i),
3466
+ endRow: C(y.endRow, i),
3467
+ startCol: C(y.startCol, o),
3468
+ endCol: C(y.endCol, o)
3407
3469
  };
3408
- return (C.startRow !== g.startRow || C.endRow !== g.endRow || C.startCol !== g.startCol || C.endCol !== g.endCol) && (f = !0), C;
3470
+ return (b.startRow !== y.startRow || b.endRow !== y.endRow || b.startCol !== y.startCol || b.endCol !== y.endCol) && (u = !0), b;
3409
3471
  });
3410
- this.selectionRanges = y;
3472
+ this.selectionRanges = w;
3411
3473
  }
3412
- f && this.onSelectionChange(this.selectionRanges), this.updateFillHandleFlag();
3474
+ u && this.onSelectionChange(this.selectionRanges), this.updateFillHandleFlag();
3413
3475
  return;
3414
3476
  }
3415
3477
  const r = s ?? t.columns[0]?.key ?? "";
3416
- let h = t.columns.findIndex((f) => String(f.key) === String(r));
3478
+ let h = t.columns.findIndex((u) => String(u.key) === String(r));
3417
3479
  h < 0 && (h = 0);
3418
- const d = t.columns[h]?.key ?? "", u = n ? this.dataModel.getBaseRowIndex(n) : 0, p = e[e.length - 1] ?? e[0] ?? null, m = e.find((f) => this.dataModel.getBaseRowIndex(f.id) >= u) ?? p;
3480
+ const d = t.columns[h]?.key ?? "", f = n ? this.dataModel.getBaseRowIndex(n) : 0, p = e[e.length - 1] ?? e[0] ?? null, m = e.find((u) => this.dataModel.getBaseRowIndex(u.id) >= f) ?? p;
3419
3481
  if (!m) return;
3420
- const b = m.id, x = this.dataModel.getRowIndex(b);
3482
+ const g = m.id, S = this.dataModel.getRowIndex(g);
3421
3483
  this.selectionAnchor = null, this.lastBooleanCell = null, this.teardownInput(!1), this.selectionRanges = [
3422
3484
  {
3423
3485
  kind: "cells",
3424
- startRow: x,
3425
- endRow: x,
3486
+ startRow: S,
3487
+ endRow: S,
3426
3488
  startCol: h,
3427
3489
  endCol: h
3428
3490
  }
3429
- ], this.activeCell = { rowId: b, colKey: d }, this.onActiveChange(b, d), this.onSelectionChange(this.selectionRanges), this.ensureVisibleCell(b, d);
3430
- const w = this.dataModel.getCell(b, d);
3431
- this.focusSelectionInput(this.cellToClipboardString(w)), this.updateFillHandleFlag();
3491
+ ], this.activeCell = { rowId: g, colKey: d }, this.onActiveChange(g, d), this.onSelectionChange(this.selectionRanges), this.ensureVisibleCell(g, d);
3492
+ const v = this.dataModel.getCell(g, d);
3493
+ this.focusSelectionInput(this.cellToClipboardString(v)), this.updateFillHandleFlag();
3432
3494
  }
3433
3495
  navigateToCell(t, e) {
3434
3496
  const i = this.dataModel.getSchema(), o = this.dataModel.getRowIndex(t), n = i.columns.findIndex((a) => String(a.key) === String(e));
@@ -3459,7 +3521,7 @@ class Bo {
3459
3521
  }
3460
3522
  updateFillHandleFlag() {
3461
3523
  const t = this.activeCell?.colKey ?? null, e = this.activeCell?.rowId ?? null;
3462
- this.root.dataset.extableFillHandle = kt(
3524
+ this.root.dataset.extableFillHandle = Ht(
3463
3525
  this.dataModel,
3464
3526
  this.selectionRanges,
3465
3527
  e,
@@ -3517,8 +3579,8 @@ class Bo {
3517
3579
  if (!this.copyToastEl) return;
3518
3580
  const t = this.copyToastEl.offsetWidth || 0, e = this.copyToastEl.offsetHeight || 0, i = 16, o = Math.max(0, this.root.scrollLeft + this.root.clientWidth - t - i), n = Math.max(0, this.root.scrollTop + this.root.clientHeight - e - i), s = Math.max(0, this.root.scrollLeft + i), l = Math.max(0, this.root.scrollTop + i), a = this.root.getBoundingClientRect(), r = this.getActiveCellRect();
3519
3581
  if (r) {
3520
- const h = r.right - a.left + this.root.scrollLeft - t + 8, d = r.top - a.top + this.root.scrollTop - e + 8, u = Math.min(o, Math.max(s, h)), p = Math.min(n, Math.max(l, d));
3521
- this.copyToastEl.style.left = `${u}px`, this.copyToastEl.style.top = `${p}px`;
3582
+ const h = r.right - a.left + this.root.scrollLeft - t + 8, d = r.top - a.top + this.root.scrollTop - e + 8, f = Math.min(o, Math.max(s, h)), p = Math.min(n, Math.max(l, d));
3583
+ this.copyToastEl.style.left = `${f}px`, this.copyToastEl.style.top = `${p}px`;
3522
3584
  return;
3523
3585
  }
3524
3586
  this.copyToastEl.style.left = `${o}px`, this.copyToastEl.style.top = `${n}px`;
@@ -3593,7 +3655,7 @@ class Bo {
3593
3655
  this.hoverTooltipAbort = r;
3594
3656
  const h = this.hoverTooltipRequestId += 1;
3595
3657
  this.hoverTooltipTarget = { rowId: o, colKey: i }, this.hoverTooltipMessage = null;
3596
- const d = this.dataModel.getCell(o, i), u = (p) => {
3658
+ const d = this.dataModel.getCell(o, i), f = (p) => {
3597
3659
  if (h !== this.hoverTooltipRequestId || r.signal.aborted) return;
3598
3660
  if (!p) {
3599
3661
  this.hideHoverTooltip();
@@ -3604,18 +3666,18 @@ class Bo {
3604
3666
  };
3605
3667
  try {
3606
3668
  const p = l({ rowId: o, colKey: i, value: d, signal: r.signal });
3607
- p && typeof p.then == "function" ? p.then(u).catch((m) => {
3669
+ p && typeof p.then == "function" ? p.then(f).catch((m) => {
3608
3670
  h === this.hoverTooltipRequestId && (r.signal.aborted || (this.hideHoverTooltip(), this.showCopyToast("Tooltip failed", "error", 1800)));
3609
- }) : u(p);
3671
+ }) : f(p);
3610
3672
  } catch {
3611
3673
  this.hideHoverTooltip(), this.showCopyToast("Tooltip failed", "error", 1800);
3612
3674
  }
3613
3675
  }
3614
3676
  getColumnResizeHit(t, e, i) {
3615
3677
  const o = this.getHitAtClientPoint(t, e, i);
3616
- if (!o || o.rowId !== "__header__" || !o.colKey || o.colKey === "__all__" || Math.abs(t - o.rect.right) > Vt) return null;
3678
+ if (!o || o.rowId !== "__header__" || !o.colKey || o.colKey === "__all__" || Math.abs(t - o.rect.right) > Wt) return null;
3617
3679
  if (!o.element) {
3618
- const r = o.rect.right - 18 - 4, h = o.rect.top + Math.floor((st - 18) / 2);
3680
+ const r = o.rect.right - 18 - 4, h = o.rect.top + Math.floor((at - 18) / 2);
3619
3681
  if (t >= r && t <= r + 18 && e >= h && e <= h + 18) return null;
3620
3682
  }
3621
3683
  const s = this.dataModel.getSchema().columns.findIndex((l) => String(l.key) === String(o.colKey));
@@ -3624,12 +3686,12 @@ class Bo {
3624
3686
  beginColumnResize(t, e, i) {
3625
3687
  const o = this.dataModel.getSchema(), n = this.dataModel.getView(), s = o.columns[e];
3626
3688
  if (!s) return;
3627
- const l = String(t), a = n.columnWidths?.[l] ?? s.width ?? 100, h = Y(o, n)[e] ?? a, d = Math.max(0, h - a), u = je(0, d);
3689
+ const l = String(t), a = n.columnWidths?.[l] ?? s.width ?? 100, h = J(o, n)[e] ?? a, d = Math.max(0, h - a), f = Ye(0, d);
3628
3690
  this.columnResizing = !0, this.columnResizeState = {
3629
3691
  colKey: l,
3630
3692
  startX: i,
3631
3693
  startWidth: a,
3632
- minWidth: u,
3694
+ minWidth: f,
3633
3695
  lastWidth: a
3634
3696
  }, this.resizeCursorBackup === null && (this.resizeCursorBackup = this.root.style.cursor || ""), this.root.style.cursor = "col-resize", this.root.dataset.extableColumnResize = "1";
3635
3697
  }
@@ -3711,7 +3773,7 @@ class Bo {
3711
3773
  const r = this.getCellRect(t, e);
3712
3774
  if (r) {
3713
3775
  const h = this.root.getBoundingClientRect();
3714
- i.style.transform = "none", i.style.left = `${r.left - h.left}px`, i.style.top = `${r.top - h.top}px`, i.style.width = `${r.width}px`, i.style.height = `${r.height}px`, i.style.opacity = "1", i.style.pointerEvents = "auto", i.style.padding = "2px 4px", i.style.border = "none", i.style.background = "#fff", i.style.color = "#000", i.style.fontSize = "14px", i.style.fontFamily = "inherit", i.style.boxSizing = "border-box", i.style.zIndex = "100", i.style.WebkitAppearance = "none", i.style.WebkitUserSelect = "text", i.style.WebkitUserModify = "read-write";
3776
+ i.style.transform = "none", i.style.left = `${r.left - h.left}px`, i.style.top = `${r.top - h.top}px`, i.style.width = `${r.width}px`, i.style.height = `${r.height}px`, i.style.opacity = "1", i.style.pointerEvents = "auto", i.style.padding = "2px 4px", i.style.border = "none", i.style.background = "#fff", i.style.color = "#000", i.style.fontSize = "14px", i.style.fontFamily = "inherit", i.style.boxSizing = "border-box", i.style.zIndex = "100", i.classList.add("extable-editor-input"), i.style.WebkitAppearance = "none", i.style.WebkitUserSelect = "text", i.style.WebkitUserModify = "read-write";
3715
3777
  }
3716
3778
  }
3717
3779
  if (n.recentLookup !== !1) {
@@ -3728,31 +3790,31 @@ class Bo {
3728
3790
  const l = n.debounceMs ?? 250, a = (r) => {
3729
3791
  const h = typeof r == "boolean" ? r : !1, d = i.value;
3730
3792
  this.lookupDebounceTimer && (window.clearTimeout(this.lookupDebounceTimer), this.lookupDebounceTimer = null), this.lookupAbort?.abort(), this.lookupAbort = null, this.lookupRequestId += 1;
3731
- const u = this.lookupRequestId, p = s, m = () => {
3793
+ const f = this.lookupRequestId, p = s, m = () => {
3732
3794
  this.lookupDebounceTimer = null;
3733
- const b = new AbortController();
3734
- this.lookupAbort = b, n.fetchCandidates({ query: d, rowId: t, colKey: e, signal: b.signal }).then((x) => {
3735
- if (u !== this.lookupRequestId || b.signal.aborted || !this.activeCell || this.activeCell.rowId !== t || this.activeCell.colKey !== e)
3795
+ const g = new AbortController();
3796
+ this.lookupAbort = g, n.candidates({ query: d, rowId: t, colKey: e, signal: g.signal }).then((S) => {
3797
+ if (f !== this.lookupRequestId || g.signal.aborted || !this.activeCell || this.activeCell.rowId !== t || this.activeCell.colKey !== e)
3736
3798
  return;
3737
- let w = Array.from(x);
3799
+ let v = Array.from(S);
3738
3800
  if (n.recentLookup !== !1) {
3739
- const y = this.lookupRecentHistory.get(e);
3740
- if (y) {
3741
- w = w.filter((v) => !(v.label === y.label && v.value === y.value));
3742
- const g = { ...y, isRecent: !0 };
3743
- w.unshift(g);
3801
+ const w = this.lookupRecentHistory.get(e);
3802
+ if (w) {
3803
+ v = v.filter((C) => !(C.label === w.label && C.value === w.value));
3804
+ const y = { ...w, isRecent: !0 };
3805
+ v.unshift(y);
3744
3806
  }
3745
3807
  }
3746
- s = w.length;
3747
- const f = w.filter((y) => !y.isRecent);
3748
- if (!n.allowFreeInput && p > 1 && f.length === 1) {
3749
- const y = w.indexOf(f[0]);
3750
- this.lookupCandidates = w, this.lookupHighlightIndex = y, this.commitLookupCandidate(y);
3808
+ s = v.length;
3809
+ const u = v.filter((w) => !w.isRecent);
3810
+ if (!n.allowFreeInput && p > 1 && u.length === 1) {
3811
+ const w = v.indexOf(u[0]);
3812
+ this.lookupCandidates = v, this.lookupHighlightIndex = w, this.commitLookupCandidate(w);
3751
3813
  return;
3752
3814
  }
3753
- this.lookupCandidates = w, this.lookupHighlightIndex = w.length ? 0 : -1, this.renderLookupDropdown();
3754
- }).catch((x) => {
3755
- u === this.lookupRequestId && (b.signal.aborted || (this.hideLookupDropdown(), this.showCopyToast("Lookup failed", "error", 1800)));
3815
+ this.lookupCandidates = v, this.lookupHighlightIndex = v.length ? 0 : -1, this.renderLookupDropdown();
3816
+ }).catch((S) => {
3817
+ f === this.lookupRequestId && (g.signal.aborted || (this.hideLookupDropdown(), this.showCopyToast("Lookup failed", "error", 1800)));
3756
3818
  });
3757
3819
  };
3758
3820
  h ? m() : this.lookupDebounceTimer = window.setTimeout(m, l);
@@ -3794,7 +3856,7 @@ class Bo {
3794
3856
  return t.key === "Escape" ? (t.preventDefault(), this.hideLookupDropdown(), !0) : !1;
3795
3857
  }
3796
3858
  tryStartExternalEditor(t, e) {
3797
- const o = this.findColumn(e)?.edit?.externalEditor?.open;
3859
+ const o = this.findColumn(e)?.edit?.externalEditor;
3798
3860
  if (!o) return !1;
3799
3861
  if (this.editMode === "readonly" || this.isCellReadonly(t, e) || this.externalEditInFlight) return !0;
3800
3862
  const n = this.externalEditRequestId += 1;
@@ -3907,59 +3969,59 @@ class Bo {
3907
3969
  ) ? this.getCanvasCellMetrics(t, e) : null;
3908
3970
  }
3909
3971
  getCanvasCellMetrics(t, e) {
3910
- const i = this.dataModel.getSchema(), o = this.dataModel.getView(), n = this.dataModel.listRows(), s = n.findIndex((x) => x.id === t), l = i.columns.findIndex((x) => String(x.key) === String(e));
3972
+ const i = this.dataModel.getSchema(), o = this.dataModel.getView(), n = this.dataModel.listRows(), s = n.findIndex((S) => S.id === t), l = i.columns.findIndex((S) => String(S.key) === String(e));
3911
3973
  if (s < 0 || l < 0) return null;
3912
- const a = st, r = lt, h = ft, d = Y(i, o);
3913
- let u = r;
3914
- for (let x = 0; x < l; x += 1) u += d[x] ?? 100;
3974
+ const a = at, r = ct, h = wt, d = J(i, o);
3975
+ let f = r;
3976
+ for (let S = 0; S < l; S += 1) f += d[S] ?? 100;
3915
3977
  let p = a;
3916
- for (let x = 0; x < s; x += 1) {
3917
- const w = n[x];
3918
- if (!w) return null;
3919
- const f = this.dataModel.getRowHeight(w.id) ?? h;
3920
- p += f;
3978
+ for (let S = 0; S < s; S += 1) {
3979
+ const v = n[S];
3980
+ if (!v) return null;
3981
+ const u = this.dataModel.getRowHeight(v.id) ?? h;
3982
+ p += u;
3921
3983
  }
3922
- const m = this.dataModel.getRowHeight(t) ?? h, b = d[l] ?? 100;
3923
- return { left: u, top: p, width: b, height: m, rowIndex: s, colIndex: l };
3984
+ const m = this.dataModel.getRowHeight(t) ?? h, g = d[l] ?? 100;
3985
+ return { left: f, top: p, width: g, height: m, rowIndex: s, colIndex: l };
3924
3986
  }
3925
3987
  getActiveCellRect() {
3926
3988
  const t = this.activeCell;
3927
3989
  if (!t) return null;
3928
3990
  const e = this.root.getBoundingClientRect(), i = this.dataModel.getSchema(), o = this.dataModel.getView();
3929
3991
  if (t.rowId === "__all__" && t.colKey === "__all__")
3930
- return new DOMRect(e.left, e.top, lt, st);
3992
+ return new DOMRect(e.left, e.top, ct, at);
3931
3993
  if (t.rowId === "__header__" && t.colKey !== null) {
3932
3994
  const s = this.escapeCssAttrValue(String(t.colKey)), l = this.root.querySelector(`th[data-col-key="${s}"]`);
3933
3995
  if (l) return l.getBoundingClientRect();
3934
3996
  const a = i.columns.findIndex((r) => String(r.key) === String(t.colKey));
3935
3997
  if (a >= 0) {
3936
- const r = Y(i, o);
3937
- let h = lt;
3938
- for (let u = 0; u < a; u += 1) h += r[u] ?? 100;
3998
+ const r = J(i, o);
3999
+ let h = ct;
4000
+ for (let f = 0; f < a; f += 1) h += r[f] ?? 100;
3939
4001
  const d = r[a] ?? 100;
3940
4002
  return new DOMRect(
3941
4003
  e.left + h - this.root.scrollLeft,
3942
4004
  e.top,
3943
4005
  d,
3944
- st
4006
+ at
3945
4007
  );
3946
4008
  }
3947
4009
  }
3948
4010
  if (t.colKey === null) {
3949
4011
  const s = this.dataModel.getRowIndex(t.rowId);
3950
4012
  if (s >= 0) {
3951
- let l = st;
4013
+ let l = at;
3952
4014
  const a = this.dataModel.listRows();
3953
4015
  for (let h = 0; h < s; h += 1) {
3954
4016
  const d = a[h];
3955
4017
  if (!d) break;
3956
- l += this.dataModel.getRowHeight(d.id) ?? ft;
4018
+ l += this.dataModel.getRowHeight(d.id) ?? wt;
3957
4019
  }
3958
- const r = this.dataModel.getRowHeight(t.rowId) ?? ft;
4020
+ const r = this.dataModel.getRowHeight(t.rowId) ?? wt;
3959
4021
  return new DOMRect(
3960
4022
  e.left,
3961
4023
  e.top + l - this.root.scrollTop,
3962
- lt,
4024
+ ct,
3963
4025
  r
3964
4026
  );
3965
4027
  }
@@ -3976,8 +4038,8 @@ class Bo {
3976
4038
  }
3977
4039
  const o = this.getCanvasCellMetrics(t, e);
3978
4040
  if (!o) return;
3979
- const n = o.left, s = o.left + o.width, l = o.top, a = o.top + o.height, r = this.root.scrollLeft, h = this.root.scrollLeft + this.root.clientWidth, d = this.root.scrollTop, u = this.root.scrollTop + this.root.clientHeight;
3980
- n < r ? this.root.scrollLeft = Math.max(0, n) : s > h && (this.root.scrollLeft = Math.max(0, s - this.root.clientWidth)), l < d ? this.root.scrollTop = Math.max(0, l) : a > u && (this.root.scrollTop = Math.max(0, a - this.root.clientHeight));
4041
+ const n = o.left, s = o.left + o.width, l = o.top, a = o.top + o.height, r = this.root.scrollLeft, h = this.root.scrollLeft + this.root.clientWidth, d = this.root.scrollTop, f = this.root.scrollTop + this.root.clientHeight;
4042
+ n < r ? this.root.scrollLeft = Math.max(0, n) : s > h && (this.root.scrollLeft = Math.max(0, s - this.root.clientWidth)), l < d ? this.root.scrollTop = Math.max(0, l) : a > f && (this.root.scrollTop = Math.max(0, a - this.root.clientHeight));
3981
4043
  }
3982
4044
  moveActiveCell(t, e, i = !1) {
3983
4045
  const o = this.dataModel.getSchema(), n = this.dataModel.listRows();
@@ -3990,9 +4052,9 @@ class Bo {
3990
4052
  {
3991
4053
  const d = n[r];
3992
4054
  if (!d) return;
3993
- const u = o.columns[h];
3994
- if (!u) return;
3995
- const p = d.id, m = u.key, b = a ? {
4055
+ const f = o.columns[h];
4056
+ if (!f) return;
4057
+ const p = d.id, m = f.key, g = a ? {
3996
4058
  kind: "cells",
3997
4059
  startRow: a.rowIndex,
3998
4060
  endRow: r,
@@ -4005,9 +4067,9 @@ class Bo {
4005
4067
  startCol: h,
4006
4068
  endCol: h
4007
4069
  };
4008
- this.selectionRanges = [b], this.activeCell = { rowId: p, colKey: m }, this.onActiveChange(p, m), this.onSelectionChange(this.selectionRanges), this.ensureVisibleCell(p, m);
4009
- const x = this.dataModel.getCell(p, m), w = this.cellToClipboardString(x);
4010
- this.focusSelectionInput(w), this.updateFillHandleFlag();
4070
+ this.selectionRanges = [g], this.activeCell = { rowId: p, colKey: m }, this.onActiveChange(p, m), this.onSelectionChange(this.selectionRanges), this.ensureVisibleCell(p, m);
4071
+ const S = this.dataModel.getCell(p, m), v = this.cellToClipboardString(S);
4072
+ this.focusSelectionInput(v), this.updateFillHandleFlag();
4011
4073
  return;
4012
4074
  }
4013
4075
  }
@@ -4072,8 +4134,8 @@ class Bo {
4072
4134
  endCol: h
4073
4135
  };
4074
4136
  this.selectionRanges = [d];
4075
- const u = n[s]?.id ?? i.rowId, p = this.dragStart.kind === "rows" ? o.columns[0]?.key ?? i.colKey : o.columns[l]?.key ?? i.colKey;
4076
- this.activeCell = { rowId: u, colKey: p }, this.onActiveChange(u, p), this.onSelectionChange(this.selectionRanges), this.updateFillHandleFlag();
4137
+ const f = n[s]?.id ?? i.rowId, p = this.dragStart.kind === "rows" ? o.columns[0]?.key ?? i.colKey : o.columns[l]?.key ?? i.colKey;
4138
+ this.activeCell = { rowId: f, colKey: p }, this.onActiveChange(f, p), this.onSelectionChange(this.selectionRanges), this.updateFillHandleFlag();
4077
4139
  }
4078
4140
  updateFillDragFromClientPoint(t, e) {
4079
4141
  if (!this.fillDragging || !this.fillSource) return;
@@ -4129,21 +4191,21 @@ class Bo {
4129
4191
  commitFill(t, e) {
4130
4192
  const i = this.dataModel.getSchema(), o = this.dataModel.listRows(), n = i.columns[t.colIndex];
4131
4193
  if (!n || e <= t.endRowIndex) return;
4132
- const s = Do(this.dataModel, t, this.sequenceLangs);
4194
+ const s = Po(this.dataModel, t, this.sequenceLangs);
4133
4195
  if (!s) return;
4134
4196
  const l = this.editMode === "direct", a = `fill:${Date.now()}:${Math.random().toString(16).slice(2)}`;
4135
4197
  for (let d = t.endRowIndex + 1; d <= e; d += 1) {
4136
- const u = o[d];
4137
- if (!u) break;
4138
- if (this.isCellReadonly(u.id, n.key)) continue;
4139
- const p = d - t.endRowIndex, m = s(p), b = {
4198
+ const f = o[d];
4199
+ if (!f) break;
4200
+ if (this.isCellReadonly(f.id, n.key)) continue;
4201
+ const p = d - t.endRowIndex, m = s(p), g = {
4140
4202
  kind: "edit",
4141
- rowId: u.id,
4203
+ rowId: f.id,
4142
4204
  colKey: n.key,
4143
4205
  next: m,
4144
4206
  payload: { batchId: a }
4145
4207
  };
4146
- this.onEdit(b, l);
4208
+ this.onEdit(g, l);
4147
4209
  }
4148
4210
  const r = o[e];
4149
4211
  if (!r) return;
@@ -4240,9 +4302,9 @@ class Bo {
4240
4302
  if (t instanceof Date) return t.toISOString();
4241
4303
  if (typeof t == "boolean") return t ? "TRUE" : "FALSE";
4242
4304
  if (typeof t == "number") return String(t);
4243
- const e = mt(t);
4305
+ const e = bt(t);
4244
4306
  if (e?.href) return e.href;
4245
- const i = pt(t);
4307
+ const i = vt(t);
4246
4308
  if (i?.label) return i.label;
4247
4309
  if (typeof t == "object") {
4248
4310
  const o = t, n = o.kind;
@@ -4262,14 +4324,14 @@ class Bo {
4262
4324
  const o = [], n = [], s = "border-collapse:collapse;border-spacing:0;", l = "border:1px solid #d0d7de;padding:4px 6px;vertical-align:top;";
4263
4325
  let a = 0;
4264
4326
  for (let d = i.startRow; d <= i.endRow; d += 1) {
4265
- const u = e[d];
4266
- if (!u) continue;
4327
+ const f = e[d];
4328
+ if (!f) continue;
4267
4329
  const p = [], m = [];
4268
- for (let b = i.startCol; b <= i.endCol; b += 1) {
4269
- const x = t.columns[b];
4270
- if (!x) continue;
4271
- const w = this.dataModel.getCell(u.id, x.key), f = this.cellToClipboardString(w);
4272
- p.push(f), m.push(`<td style="${l}">${this.escapeHtml(f)}</td>`), a += 1;
4330
+ for (let g = i.startCol; g <= i.endCol; g += 1) {
4331
+ const S = t.columns[g];
4332
+ if (!S) continue;
4333
+ const v = this.dataModel.getCell(f.id, S.key), u = this.cellToClipboardString(v);
4334
+ p.push(u), m.push(`<td style="${l}">${this.escapeHtml(u)}</td>`), a += 1;
4273
4335
  }
4274
4336
  o.push(p.join(" ")), n.push(`<tr>${m.join("")}</tr>`);
4275
4337
  }
@@ -4334,9 +4396,9 @@ class Bo {
4334
4396
  if (!i) return t;
4335
4397
  if (t === "") return "";
4336
4398
  if (i.type === "number" || i.type === "int" || i.type === "uint") {
4337
- const o = se(t);
4399
+ const o = ce(t);
4338
4400
  if (!o.ok) return t;
4339
- const n = le(o.value, i.type);
4401
+ const n = he(o.value, i.type);
4340
4402
  return n.ok ? n.value : t;
4341
4403
  }
4342
4404
  if (i.type === "boolean") {
@@ -4352,13 +4414,13 @@ class Bo {
4352
4414
  if (!r) break;
4353
4415
  const h = t[a] ?? [];
4354
4416
  for (let d = 0; d < h.length; d += 1) {
4355
- const u = e.columns[n + d];
4356
- if (!u) break;
4357
- if (this.isCellReadonly(r.id, u.key)) continue;
4358
- const p = this.coerceCellValue(h[d] ?? "", u.key), m = {
4417
+ const f = e.columns[n + d];
4418
+ if (!f) break;
4419
+ if (this.isCellReadonly(r.id, f.key)) continue;
4420
+ const p = this.coerceCellValue(h[d] ?? "", f.key), m = {
4359
4421
  kind: "edit",
4360
4422
  rowId: r.id,
4361
- colKey: u.key,
4423
+ colKey: f.key,
4362
4424
  next: p,
4363
4425
  payload: { batchId: l }
4364
4426
  };
@@ -4391,31 +4453,43 @@ class Bo {
4391
4453
  const l = this.normalizeTemporalInitialValue(i.type, e);
4392
4454
  return s.value = l, { control: s, value: l };
4393
4455
  }
4394
- if (i?.type === "enum" || i?.type === "tags") {
4395
- const s = i.enum?.allowCustom ?? i.tags?.allowCustom, l = i.enum?.options ?? i.tags?.options ?? [];
4456
+ if (i?.type === "enum" || i?.type === "tags" || i?.type === "labeled") {
4457
+ const s = i.type === "enum" ? i.enumAllowCustom ?? !1 : i.type === "tags" ? i.tagsAllowCustom ?? !1 : i.enumAllowCustom ?? !1;
4458
+ let l = [];
4459
+ i.type === "enum" && Array.isArray(i.enum) && (l = i.enum), i.type === "tags" && Array.isArray(i.tags) && (l = i.tags), i.type === "labeled" && Array.isArray(i.enum) && (l = i.enum);
4460
+ const a = l.map((f) => {
4461
+ if (typeof f == "string") return f;
4462
+ if (f && typeof f == "object") {
4463
+ const p = f;
4464
+ if (i.type === "labeled") return String(p.label ?? p.value ?? "");
4465
+ if ("value" in p) return String(p.value ?? p.label ?? "");
4466
+ if ("label" in p) return String(p.label ?? "");
4467
+ }
4468
+ return String(f ?? "");
4469
+ });
4396
4470
  if (s === !1) {
4397
- const d = document.createElement("select"), u = document.createElement("option");
4398
- u.value = "", u.textContent = "", d.appendChild(u);
4399
- for (const p of l) {
4400
- const m = document.createElement("option");
4401
- m.value = p, m.textContent = p, e === p && (m.selected = !0), d.appendChild(m);
4471
+ const f = document.createElement("select"), p = document.createElement("option");
4472
+ p.value = "", p.textContent = "", f.appendChild(p);
4473
+ for (const m of a) {
4474
+ const g = document.createElement("option");
4475
+ g.value = m, g.textContent = m, e === m && (g.selected = !0), f.appendChild(g);
4402
4476
  }
4403
- return { control: d, value: e };
4477
+ return { control: f, value: e };
4404
4478
  }
4405
- const a = document.createElement("input");
4406
- a.type = "text";
4407
- const r = `extable-datalist-${String(t)}`;
4408
- a.setAttribute("list", r), a.value = e;
4409
- let h = document.getElementById(r);
4410
- if (!h) {
4411
- h = document.createElement("datalist"), h.id = r;
4412
- for (const d of l) {
4413
- const u = document.createElement("option");
4414
- u.value = d, h.appendChild(u);
4479
+ const r = document.createElement("input");
4480
+ r.type = "text";
4481
+ const h = `extable-datalist-${String(t)}`;
4482
+ r.setAttribute("list", h), r.value = e;
4483
+ let d = document.getElementById(h);
4484
+ if (!d) {
4485
+ d = document.createElement("datalist"), d.id = h;
4486
+ for (const f of a) {
4487
+ const p = document.createElement("option");
4488
+ p.value = f, d.appendChild(p);
4415
4489
  }
4416
- this.root.appendChild(h);
4490
+ this.root.appendChild(d);
4417
4491
  }
4418
- return { control: a, value: e, datalistId: r };
4492
+ return { control: r, value: e, datalistId: h };
4419
4493
  }
4420
4494
  const n = document.createElement("input");
4421
4495
  return n.type = "text", n.value = e, { control: n, value: e };
@@ -4432,10 +4506,10 @@ class Bo {
4432
4506
  if ((i.type === "number" || i.type === "int" || i.type === "uint") && typeof e == "number") {
4433
4507
  if (i.type === "number") {
4434
4508
  const s = i.format;
4435
- return (s?.format ?? "decimal") === "scientific" ? Rt(e, { format: "scientific", precision: s?.precision }) : Rt(e, { format: "decimal", scale: s?.scale });
4509
+ return (s?.format ?? "decimal") === "scientific" ? At(e, { format: "scientific", precision: s?.precision }) : At(e, { format: "decimal", scale: s?.scale });
4436
4510
  }
4437
4511
  const n = i.format?.format ?? "decimal";
4438
- return n === "binary" || n === "octal" || n === "hex" ? Ot(e, n) : String(e);
4512
+ return n === "binary" || n === "octal" || n === "hex" ? Ut(e, n) : String(e);
4439
4513
  }
4440
4514
  return String(e);
4441
4515
  }
@@ -4444,11 +4518,11 @@ class Bo {
4444
4518
  return { ok: !0, value: this.inputEl?.value ?? "" };
4445
4519
  const t = this.findColumn(this.activeCell.colKey);
4446
4520
  if (t && (t.type === "number" || t.type === "int" || t.type === "uint") && this.inputEl instanceof HTMLInputElement) {
4447
- const e = Oe(this.inputEl.value);
4521
+ const e = Ge(this.inputEl.value);
4448
4522
  if (e === "") return { ok: !0, value: "" };
4449
- const i = se(e);
4523
+ const i = ce(e);
4450
4524
  if (!i.ok) return { ok: !1 };
4451
- const o = le(i.value, t.type);
4525
+ const o = he(i.value, t.type);
4452
4526
  return o.ok ? { ok: !0, value: o.value } : { ok: !1 };
4453
4527
  }
4454
4528
  return { ok: !0, value: this.readActiveValue() };
@@ -4466,7 +4540,7 @@ class Bo {
4466
4540
  t.rows = Math.max(1, o), t.style.minHeight = `${i}px`;
4467
4541
  }
4468
4542
  positionFloatingContentBox(t, e) {
4469
- const i = ut, o = at, n = Mt;
4543
+ const i = yt, o = dt, n = Et;
4470
4544
  e.style.left = `${t.left + i}px`, e.style.top = `${t.top + o}px`, e.style.width = `${Math.max(8, t.width - i * 2)}px`, e.style.height = `${Math.max(8, t.height - (o + n))}px`;
4471
4545
  }
4472
4546
  triggerCellAction(t, e, i) {
@@ -4475,11 +4549,11 @@ class Bo {
4475
4549
  const s = this.dataModel.resolveCellValue(t, o), l = this.dataModel.resolveConditionalStyle(t, o);
4476
4550
  if (s.textOverride ?? (l.forceErrorText ? "#ERROR" : void 0)) return !1;
4477
4551
  if (o.type === "button") {
4478
- const r = pt(s.value);
4552
+ const r = vt(s.value);
4479
4553
  return r ? (this.onCellAction({ kind: "button", rowId: t, colKey: e, value: r }), !0) : !1;
4480
4554
  }
4481
4555
  if (o.type === "link") {
4482
- const r = mt(s.value);
4556
+ const r = bt(s.value);
4483
4557
  return r?.href ? (this.openLink(r.href, r.target), !0) : !1;
4484
4558
  }
4485
4559
  return !1;
@@ -4490,7 +4564,7 @@ class Bo {
4490
4564
  if (!o || o.type !== "tags") return !1;
4491
4565
  const n = this.dataModel.getCell(t, e), s = this.normalizeTagValues(n);
4492
4566
  if (!s || i < 0 || i >= s.length) return !1;
4493
- const l = s.filter((d, u) => u !== i), a = n && typeof n == "object" && n.kind === "tags" ? { kind: "tags", values: l } : l, r = {
4567
+ const l = s.filter((d, f) => f !== i), a = n && typeof n == "object" && n.kind === "tags" ? { kind: "tags", values: l } : l, r = {
4494
4568
  kind: "edit",
4495
4569
  rowId: t,
4496
4570
  colKey: e,
@@ -4525,12 +4599,12 @@ class Bo {
4525
4599
  const r = `unique-bool:${Date.now()}:${Math.random().toString(16).slice(2)}`, h = [
4526
4600
  { kind: "edit", rowId: t, colKey: e, next: !0, payload: { batchId: r } }
4527
4601
  ], d = this.dataModel.listRows();
4528
- for (const u of d) {
4529
- if (!u || u.id === t) continue;
4530
- const p = this.dataModel.getCell(u.id, e);
4531
- (p === !0 || p === "true" || p === "1" || p === 1) && h.push({ kind: "edit", rowId: u.id, colKey: e, next: !1, payload: { batchId: r } });
4602
+ for (const f of d) {
4603
+ if (!f || f.id === t) continue;
4604
+ const p = this.dataModel.getCell(f.id, e);
4605
+ (p === !0 || p === "true" || p === "1" || p === 1) && h.push({ kind: "edit", rowId: f.id, colKey: e, next: !1, payload: { batchId: r } });
4532
4606
  }
4533
- for (const u of h) this.onEdit(u, s);
4607
+ for (const f of h) this.onEdit(f, s);
4534
4608
  this.onMove(t);
4535
4609
  return;
4536
4610
  }
@@ -4555,7 +4629,7 @@ class Bo {
4555
4629
  };
4556
4630
  let a = [];
4557
4631
  if (t.shiftKey && this.activeCell) {
4558
- const h = this.activeCell, d = this.dataModel.getRowIndex(h.rowId), u = i.columns.findIndex((m) => String(m.key) === String(h.colKey));
4632
+ const h = this.activeCell, d = this.dataModel.getRowIndex(h.rowId), f = i.columns.findIndex((m) => String(m.key) === String(h.colKey));
4559
4633
  a = [n ? {
4560
4634
  kind: "rows",
4561
4635
  startRow: d,
@@ -4566,7 +4640,7 @@ class Bo {
4566
4640
  kind: "cells",
4567
4641
  startRow: d,
4568
4642
  endRow: o,
4569
- startCol: Math.max(0, u),
4643
+ startCol: Math.max(0, f),
4570
4644
  endCol: Math.max(0, s)
4571
4645
  }];
4572
4646
  } else t.metaKey || t.ctrlKey ? a = [...this.selectionRanges, l] : a = [l];
@@ -4613,15 +4687,15 @@ class Bo {
4613
4687
  const s = o?.initialValueOverride ?? this.getInitialEditValue(i, n), { control: l, value: a } = this.createEditor(i, s), r = l;
4614
4688
  r.value = a;
4615
4689
  const h = r instanceof HTMLInputElement && r.type === "checkbox";
4616
- r.style.width = "100%", r.style.boxSizing = "border-box", r.style.margin = "0", r.style.padding = h ? "0" : "2px 4px", r.style.border = "none", r.style.borderRadius = "0", r.style.boxShadow = "none", r.style.background = "#fff", r.style.color = "#000", r.style.outline = "none", r.style.fontSize = "14px", r.style.fontFamily = "inherit", r.style.lineHeight = "16px", r.style.fontWeight = "inherit", r.style.WebkitAppearance = "none", r.style.WebkitBorderRadius = "0", r.style.WebkitBoxShadow = "none", r.style.WebkitUserSelect = "text", r.style.WebkitUserModify = "read-write", (r instanceof HTMLInputElement || r instanceof HTMLTextAreaElement) && (r.style.visibility = "visible", r.style.opacity = "1", r.style.display = "block"), h && (r.style.width = "auto", r.style.lineHeight = "normal");
4690
+ r.style.width = "100%", r.style.boxSizing = "border-box", r.style.margin = "0", r.style.padding = h ? "0" : "2px 4px", r.style.border = "none", r.style.borderRadius = "0", r.style.boxShadow = "none", r.style.background = "#fff", r.style.color = "#000", r.style.outline = "none", r.style.fontSize = "14px", r.style.fontFamily = "inherit", r.style.lineHeight = "16px", r.style.fontWeight = "inherit", r.classList.add("extable-editor-input"), r.style.WebkitAppearance = "none", r.style.WebkitBorderRadius = "0", r.style.WebkitBoxShadow = "none", r.style.WebkitUserSelect = "text", r.style.WebkitUserModify = "read-write", (r instanceof HTMLInputElement || r instanceof HTMLTextAreaElement) && (r.style.visibility = "visible", r.style.opacity = "1", r.style.display = "block"), h && (r.style.width = "auto", r.style.lineHeight = "normal");
4617
4691
  const d = this.findColumn(i);
4618
- if (r.style.textAlign = d?.style?.align ?? (d?.type === "number" || d?.type === "int" || d?.type === "uint" ? "right" : "left"), r.addEventListener("keydown", (u) => this.handleKey(u, t)), r.addEventListener("focus", () => {
4692
+ if (r.style.textAlign = d?.style?.align ?? (d?.type === "number" || d?.type === "int" || d?.type === "uint" ? "right" : "left"), r.addEventListener("keydown", (f) => this.handleKey(f, t)), r.addEventListener("focus", () => {
4619
4693
  (r instanceof HTMLInputElement || r instanceof HTMLTextAreaElement) && r.select();
4620
4694
  }), this.bindImmediateCommit(r), t.textContent = "", t.appendChild(r), r.tagName.toLowerCase() === "textarea" && requestAnimationFrame(() => {
4621
4695
  r instanceof HTMLTextAreaElement && this.autosize(r);
4622
4696
  }), r.focus({ preventScroll: !0 }), o?.placeCursorAtEnd && (r instanceof HTMLInputElement || r instanceof HTMLTextAreaElement)) {
4623
- const u = r.value.length;
4624
- r.setSelectionRange(u, u);
4697
+ const f = r.value.length;
4698
+ r.setSelectionRange(f, f);
4625
4699
  }
4626
4700
  this.inputEl = r, this.setupLookupEditor(e, i, r);
4627
4701
  }
@@ -4635,8 +4709,8 @@ class Bo {
4635
4709
  this.activeOriginalValue = { rowId: e, colKey: i, value: l };
4636
4710
  const a = o?.initialValueOverride ?? this.getInitialEditValue(i, l), { control: r, value: h } = this.createEditor(i, a), d = r;
4637
4711
  d.value = h;
4638
- const u = d instanceof HTMLInputElement && d.type === "checkbox";
4639
- d.style.width = "100%", d.style.height = "100%", d.style.boxSizing = "border-box", d.style.margin = "0", d.style.padding = u ? "0" : "2px 4px", d.style.border = "none", d.style.borderRadius = "0", d.style.boxShadow = "none", d.style.background = "#fff", d.style.color = "#000", d.style.outline = "none", d.style.fontSize = "14px", d.style.fontFamily = "inherit", d.style.lineHeight = "16px", d.style.fontWeight = "inherit", d.style.WebkitAppearance = "none", d.style.WebkitBorderRadius = "0", d.style.WebkitBoxShadow = "none", d.style.WebkitUserSelect = "text", d.style.WebkitUserModify = "read-write", (d instanceof HTMLInputElement || d instanceof HTMLTextAreaElement) && (d.style.visibility = "visible", d.style.opacity = "1", d.style.display = "block"), u && (d.style.width = "auto", d.style.height = "auto", d.style.lineHeight = "normal");
4712
+ const f = d instanceof HTMLInputElement && d.type === "checkbox";
4713
+ d.style.width = "100%", d.style.height = "100%", d.style.boxSizing = "border-box", d.style.margin = "0", d.style.padding = f ? "0" : "2px 4px", d.style.border = "none", d.style.borderRadius = "0", d.style.boxShadow = "none", d.style.background = "#fff", d.style.color = "#000", d.style.outline = "none", d.style.fontSize = "14px", d.style.fontFamily = "inherit", d.style.lineHeight = "16px", d.style.fontWeight = "inherit", d.classList.add("extable-editor-input"), d.style.WebkitAppearance = "none", d.style.WebkitBorderRadius = "0", d.style.WebkitBoxShadow = "none", d.style.WebkitUserSelect = "text", d.style.WebkitUserModify = "read-write", (d instanceof HTMLInputElement || d instanceof HTMLTextAreaElement) && (d.style.visibility = "visible", d.style.opacity = "1", d.style.display = "block"), f && (d.style.width = "auto", d.style.height = "auto", d.style.lineHeight = "normal");
4640
4714
  const p = this.findColumn(i);
4641
4715
  if (d.style.textAlign = p?.style?.align ?? (p?.type === "number" || p?.type === "int" || p?.type === "uint" ? "right" : "left"), d.style.pointerEvents = "auto", d.addEventListener("keydown", (m) => this.handleKey(m, s)), d.addEventListener("compositionstart", this.handleInputCompositionStart), d.addEventListener("compositionend", this.handleInputCompositionEnd), d.addEventListener("focus", () => {
4642
4716
  (d instanceof HTMLInputElement || d instanceof HTMLTextAreaElement) && d.select();
@@ -4729,19 +4803,19 @@ class Bo {
4729
4803
  this.teardownInput(!1), t.blur();
4730
4804
  }
4731
4805
  teardownInput(t = !1) {
4732
- this.teardownLookupEditor(), this.inputEl && this.inputEl !== this.selectionInput && O(this.inputEl), O(this.floatingInputWrapper), this.activeHost && this.activeHostOriginalText !== null && (this.activeHost.textContent = this.activeHostOriginalText), this.inputEl = null, this.floatingInputWrapper = null, this.activeHost = null, this.activeHostOriginalText = null, this.activeOriginalValue = null, this.composing = !1, t && (this.activeCell = null, this.onActiveChange(null, null), this.hideHoverTooltip());
4806
+ this.teardownLookupEditor(), this.inputEl === this.selectionInput && this.selectionInput && this.selectionInput.classList.remove("extable-editor-input"), this.inputEl && this.inputEl !== this.selectionInput && O(this.inputEl), O(this.floatingInputWrapper), this.activeHost && this.activeHostOriginalText !== null && (this.activeHost.textContent = this.activeHostOriginalText), this.inputEl = null, this.floatingInputWrapper = null, this.activeHost = null, this.activeHostOriginalText = null, this.activeOriginalValue = null, this.composing = !1, t && (this.activeCell = null, this.onActiveChange(null, null), this.hideHoverTooltip());
4733
4807
  }
4734
4808
  }
4735
- const qo = (c) => c;
4736
- class $o {
4809
+ const Qo = (c) => c;
4810
+ class Uo {
4737
4811
  constructor(t) {
4738
4812
  this.shell = null, this.viewportEl = null, this.viewportResizeObserver = null, this.selectionManager = null, this.resizeHandler = null, this.scrollHandler = null, this.viewportState = null, this.rafId = null, this.contextMenu = null, this.contextMenuRowId = null, this.handleGlobalPointer = null, this.toast = null, this.toastTimer = null, this.mounted = !1, this.filterSortSidebar = null, this.filterSortSidebarUnsub = null, this.filterSortKeydown = null, this.filterSortClickCapture = null, this.filterSortOpenEvent = null, this.filterSortActiveColumnKey = null, this.filterSortDraft = null, this.tableStateListeners = /* @__PURE__ */ new Set(), this.selectionListeners = /* @__PURE__ */ new Set(), this.lastTableState = null, this.lastSelectionSnapshot = null, this.lastAction = null, this.selectionRanges = [], this.activeCell = null, this.activeErrors = [], this.rowStateListeners = /* @__PURE__ */ new Set(), this.lastRowStates = /* @__PURE__ */ new Map(), this.root = t.root, this.root.classList.add("extable-root"), this.renderMode = t.options?.renderMode ?? "auto", this.editMode = t.options?.editMode ?? "direct", this.lockMode = t.options?.lockMode ?? "none", this.server = t.options?.server, this.user = t.options?.user, this.sequenceLangs = t.options?.langs;
4739
4813
  const e = t.defaultData ?? null, i = e ?? [];
4740
- this.dataLoaded = e != null, this.dataModel = new qe(
4814
+ this.dataLoaded = e != null, this.dataModel = new Qe(
4741
4815
  i,
4742
4816
  t.schema,
4743
- t.defaultView
4744
- ), this.commandQueue = new Xe(), this.lockManager = new Ye(this.lockMode, this.server, this.user), this.renderer = this.chooseRenderer(this.renderMode), this.applyRootDecor(t.options), this.applyReadonlyClass(), this.loadInitial();
4817
+ t.defaultView ?? {}
4818
+ ), this.commandQueue = new ti(), this.lockManager = new ii(this.lockMode, this.server, this.user), this.renderer = this.chooseRenderer(this.renderMode), this.applyRootDecor(t.options), this.applyReadonlyClass(), this.loadInitial();
4745
4819
  }
4746
4820
  isCellReadonly(t, e) {
4747
4821
  return this.editMode === "readonly" || this.dataModel.isReadonly(t, e);
@@ -4774,7 +4848,7 @@ class $o {
4774
4848
  this.mount();
4775
4849
  }
4776
4850
  applyRootDecor(t) {
4777
- const e = re(t?.defaultClass);
4851
+ const e = de(t?.defaultClass);
4778
4852
  if (e?.length && this.root.classList.add(...e), t?.defaultStyle)
4779
4853
  for (const [i, o] of Object.entries(t.defaultStyle))
4780
4854
  this.root.style[i] = o ?? "";
@@ -4787,9 +4861,9 @@ class $o {
4787
4861
  const e = typeof navigator < "u" ? navigator.userAgent : "";
4788
4862
  return /bot|crawl|spider|playwright|puppeteer|selenium|phantomjs/i.test(e) || typeof navigator < "u" && "userAgentData" in navigator && navigator.userAgentData?.brands?.some(
4789
4863
  (o) => /bot/i.test(o.brand ?? "")
4790
- ) ? new St(this.dataModel) : new It(this.dataModel, () => this.editMode);
4864
+ ) ? new Tt(this.dataModel) : new Lt(this.dataModel, () => this.editMode);
4791
4865
  }
4792
- return t === "html" ? new St(this.dataModel) : new It(this.dataModel, () => this.editMode);
4866
+ return t === "html" ? new Tt(this.dataModel) : new Lt(this.dataModel, () => this.editMode);
4793
4867
  }
4794
4868
  ensureShell() {
4795
4869
  if (this.shell && this.viewportEl && this.shell.parentElement === this.root) return;
@@ -4812,7 +4886,7 @@ class $o {
4812
4886
  this.root.dataset.extable = "loading", this.bindViewport(), this.ensureFilterSort(), this.emitTableState(), this.emitSelection("data");
4813
4887
  return;
4814
4888
  }
4815
- this.selectionManager = new Bo(
4889
+ this.selectionManager = new zo(
4816
4890
  e,
4817
4891
  this.editMode,
4818
4892
  (i, o) => this.handleEdit(i, o),
@@ -4846,7 +4920,7 @@ class $o {
4846
4920
  }
4847
4921
  // editMode/lockMode are configured only at construction time for consistency.
4848
4922
  setRootClass(t) {
4849
- this.root.className = "", this.root.classList.add(...re(t) ?? []);
4923
+ this.root.className = "", this.root.classList.add(...de(t) ?? []);
4850
4924
  }
4851
4925
  setRootStyle(t) {
4852
4926
  for (const [e, i] of Object.entries(t))
@@ -4961,9 +5035,9 @@ class $o {
4961
5035
  if (s.textOverride) return s.textOverride;
4962
5036
  const l = s.value;
4963
5037
  if (n.type === "button")
4964
- return ct(l) || (l == null ? "" : String(l));
5038
+ return ut(l) || (l == null ? "" : String(l));
4965
5039
  if (n.type === "link")
4966
- return ht(l) || (l == null ? "" : String(l));
5040
+ return ft(l) || (l == null ? "" : String(l));
4967
5041
  if (l == null) return "";
4968
5042
  if (l instanceof Date) return l.toISOString();
4969
5043
  if (typeof l == "string") return l;
@@ -5274,7 +5348,7 @@ class $o {
5274
5348
  }
5275
5349
  // Public API: table-level state callbacks
5276
5350
  getTableState() {
5277
- const t = this.renderer instanceof St ? "html" : "canvas", e = this.commandQueue.listApplied(), i = this.editMode === "commit" ? e : [], o = i.length, n = (() => {
5351
+ const t = this.renderer instanceof Tt ? "html" : "canvas", e = this.commandQueue.listApplied(), i = this.editMode === "commit" ? e : [], o = i.length, n = (() => {
5278
5352
  const r = /* @__PURE__ */ new Set();
5279
5353
  for (const h of i)
5280
5354
  h.kind === "edit" && (!h.rowId || h.colKey === void 0 || r.add(`${h.rowId}::${String(h.colKey)}`));
@@ -5289,8 +5363,8 @@ class $o {
5289
5363
  target: { rowId: r.rowId, colKey: r.colKey }
5290
5364
  } : null).filter(Boolean);
5291
5365
  l.sort((r, h) => {
5292
- const d = r.target?.rowId ? this.dataModel.getRowIndex(r.target.rowId) : -1, u = h.target?.rowId ? this.dataModel.getRowIndex(h.target.rowId) : -1;
5293
- if (d !== u) return d - u;
5366
+ const d = r.target?.rowId ? this.dataModel.getRowIndex(r.target.rowId) : -1, f = h.target?.rowId ? this.dataModel.getRowIndex(h.target.rowId) : -1;
5367
+ if (d !== f) return d - f;
5294
5368
  const p = r.target?.colKey !== void 0 ? this.dataModel.getColumnIndex(r.target.colKey) : -1, m = h.target?.colKey !== void 0 ? this.dataModel.getColumnIndex(h.target.colKey) : -1;
5295
5369
  return p !== m ? p - m : r.scope !== h.scope ? r.scope < h.scope ? -1 : 1 : r.message < h.message ? -1 : r.message > h.message ? 1 : 0;
5296
5370
  });
@@ -5330,33 +5404,33 @@ class $o {
5330
5404
  }
5331
5405
  // Public API: selection callbacks
5332
5406
  getSelectionSnapshot() {
5333
- const t = this.selectionRanges, e = this.dataModel.getSchema(), i = this.activeCell, o = i?.rowId ?? null, n = i?.colKey ?? null, s = o ? this.dataModel.getRowIndex(o) : null, l = n !== null ? e.columns.findIndex((w) => String(w.key) === String(n)) : null, a = l !== null && l >= 0 ? e.columns[l] : null, r = o && a ? this.dataModel.resolveCellValue(o, a) : null, h = o && a ? this.dataModel.resolveConditionalStyle(o, a) : null, d = r?.textOverride ?? (h?.forceErrorText ? "#ERROR" : void 0), u = r ? r.value : null, p = (() => {
5407
+ const t = this.selectionRanges, e = this.dataModel.getSchema(), i = this.activeCell, o = i?.rowId ?? null, n = i?.colKey ?? null, s = o ? this.dataModel.getRowIndex(o) : null, l = n !== null ? e.columns.findIndex((v) => String(v.key) === String(n)) : null, a = l !== null && l >= 0 ? e.columns[l] : null, r = o && a ? this.dataModel.resolveCellValue(o, a) : null, h = o && a ? this.dataModel.resolveConditionalStyle(o, a) : null, d = r?.textOverride ?? (h?.forceErrorText ? "#ERROR" : void 0), f = r ? r.value : null, p = (() => {
5334
5408
  if (d) return d;
5335
- const w = u;
5409
+ const v = f;
5336
5410
  if (a?.type === "button")
5337
- return ct(w) || (w == null ? "" : String(w));
5411
+ return ut(v) || (v == null ? "" : String(v));
5338
5412
  if (a?.type === "link")
5339
- return ht(w) || (w == null ? "" : String(w));
5340
- if (w == null) return "";
5341
- if (w instanceof Date) return w.toISOString();
5342
- if (typeof w == "string") return w;
5343
- if (typeof w == "number" || typeof w == "boolean") return String(w);
5344
- if (typeof w == "object") {
5345
- const f = w, y = f.kind;
5346
- if (y === "enum" && typeof f.value == "string") return f.value;
5347
- if (y === "tags" && Array.isArray(f.values))
5348
- return f.values.filter((g) => typeof g == "string").join(", ");
5413
+ return ft(v) || (v == null ? "" : String(v));
5414
+ if (v == null) return "";
5415
+ if (v instanceof Date) return v.toISOString();
5416
+ if (typeof v == "string") return v;
5417
+ if (typeof v == "number" || typeof v == "boolean") return String(v);
5418
+ if (typeof v == "object") {
5419
+ const u = v, w = u.kind;
5420
+ if (w === "enum" && typeof u.value == "string") return u.value;
5421
+ if (w === "tags" && Array.isArray(u.values))
5422
+ return u.values.filter((y) => typeof y == "string").join(", ");
5349
5423
  }
5350
- return String(w);
5351
- })(), m = a?.type ?? null, b = o && n !== null ? this.dataModel.getCellDiagnostic(o, n) : null, x = (() => {
5424
+ return String(v);
5425
+ })(), m = a?.type ?? null, g = o && n !== null ? this.dataModel.getCellDiagnostic(o, n) : null, S = (() => {
5352
5426
  if (!o || !a)
5353
5427
  return { columnStyle: {}, cellStyle: {}, resolved: {} };
5354
- const { columnStyle: w, cellStyle: f, resolved: y } = ze(
5428
+ const { columnStyle: v, cellStyle: u, resolved: w } = Je(
5355
5429
  this.dataModel,
5356
5430
  o,
5357
5431
  a
5358
5432
  );
5359
- return { columnStyle: w, cellStyle: f, resolved: y };
5433
+ return { columnStyle: v, cellStyle: u, resolved: w };
5360
5434
  })();
5361
5435
  return {
5362
5436
  ranges: [...t],
@@ -5364,12 +5438,12 @@ class $o {
5364
5438
  activeRowKey: o,
5365
5439
  activeColumnIndex: l !== null && l >= 0 ? l : null,
5366
5440
  activeColumnKey: n,
5367
- activeValueRaw: u,
5441
+ activeValueRaw: f,
5368
5442
  activeValueDisplay: p,
5369
5443
  activeValueType: m,
5370
- diagnostic: b,
5444
+ diagnostic: g,
5371
5445
  action: this.lastAction,
5372
- styles: x
5446
+ styles: S
5373
5447
  };
5374
5448
  }
5375
5449
  subscribeSelection(t) {
@@ -5421,7 +5495,7 @@ class $o {
5421
5495
  }
5422
5496
  // Public API: value updates
5423
5497
  setCellValue(t, e, i) {
5424
- const o = typeof t == "string" ? t : this.dataModel.listRows()[t]?.id, n = o ? Ge(this.dataModel, { rowId: o, colKey: e }) : null;
5498
+ const o = typeof t == "string" ? t : this.dataModel.listRows()[t]?.id, n = o ? ei(this.dataModel, { rowId: o, colKey: e }) : null;
5425
5499
  if (!n || this.isCellReadonly(n.rowId, n.colKey)) return;
5426
5500
  const s = this.dataModel.getCell(n.rowId, n.colKey), l = typeof i == "function" ? i(s) : i;
5427
5501
  this.handleEdit(
@@ -5437,14 +5511,14 @@ class $o {
5437
5511
  for (let h = s; h <= l; h += 1) {
5438
5512
  const d = i[h];
5439
5513
  if (d)
5440
- for (let u = a; u <= r; u += 1) {
5441
- const p = e.columns[u];
5514
+ for (let f = a; f <= r; f += 1) {
5515
+ const p = e.columns[f];
5442
5516
  if (!p) continue;
5443
5517
  const m = `${d.id}::${String(p.key)}`;
5444
5518
  if (o.has(m) || (o.add(m), this.isCellReadonly(d.id, p.key))) continue;
5445
- const b = this.dataModel.getCell(d.id, p.key), x = typeof t == "function" ? t(b) : t;
5519
+ const g = this.dataModel.getCell(d.id, p.key), S = typeof t == "function" ? t(g) : t;
5446
5520
  this.handleEdit(
5447
- { kind: "edit", rowId: d.id, colKey: p.key, next: x },
5521
+ { kind: "edit", rowId: d.id, colKey: p.key, next: S },
5448
5522
  this.editMode === "direct"
5449
5523
  );
5450
5524
  }
@@ -5537,12 +5611,12 @@ class $o {
5537
5611
  'button[data-extable-fs="apply-filter"]'
5538
5612
  ), d = e.querySelector(
5539
5613
  'button[data-extable-fs="clear-filter"]'
5540
- ), u = e.querySelector('button[data-extable-fs="sort-asc"]'), p = e.querySelector(
5614
+ ), f = e.querySelector('button[data-extable-fs="sort-asc"]'), p = e.querySelector(
5541
5615
  'button[data-extable-fs="sort-desc"]'
5542
5616
  ), m = e.querySelector(
5543
5617
  'button[data-extable-fs="clear-sort"]'
5544
5618
  );
5545
- if (!i || !o || !n || !s || !l || !a || !r || !h || !d || !u || !p || !m) {
5619
+ if (!i || !o || !n || !s || !l || !a || !r || !h || !d || !f || !p || !m) {
5546
5620
  O(e), this.filterSortSidebar = null;
5547
5621
  return;
5548
5622
  }
@@ -5552,18 +5626,18 @@ class $o {
5552
5626
  this.filterSortDraft && (this.filterSortDraft.diagWarnings = n.checked);
5553
5627
  }), s.addEventListener("input", () => {
5554
5628
  this.filterSortDraft && (this.filterSortDraft.search = s.value, this.renderFilterSortValues());
5555
- }), l.addEventListener("change", (b) => {
5556
- const x = b.target?.closest(
5629
+ }), l.addEventListener("change", (g) => {
5630
+ const S = g.target?.closest(
5557
5631
  'input[type="checkbox"][data-fs-val]'
5558
5632
  );
5559
- if (!x || !this.filterSortDraft) return;
5560
- const w = x.dataset.fsVal ?? "";
5561
- w && (w === "__blanks__" ? this.filterSortDraft.includeBlanks = x.checked : x.checked ? this.filterSortDraft.selected.add(w) : this.filterSortDraft.selected.delete(w));
5633
+ if (!S || !this.filterSortDraft) return;
5634
+ const v = S.dataset.fsVal ?? "";
5635
+ v && (v === "__blanks__" ? this.filterSortDraft.includeBlanks = S.checked : S.checked ? this.filterSortDraft.selected.add(v) : this.filterSortDraft.selected.delete(v));
5562
5636
  }), a.addEventListener("click", () => {
5563
- this.filterSortDraft && (this.filterSortDraft.selected = new Set(this.filterSortDraft.values.map((b) => b.key)), this.filterSortDraft.includeBlanks = this.filterSortDraft.hasBlanks, this.renderFilterSortValues());
5637
+ this.filterSortDraft && (this.filterSortDraft.selected = new Set(this.filterSortDraft.values.map((g) => g.key)), this.filterSortDraft.includeBlanks = this.filterSortDraft.hasBlanks, this.renderFilterSortValues());
5564
5638
  }), r.addEventListener("click", () => {
5565
5639
  this.filterSortDraft && (this.filterSortDraft.selected = /* @__PURE__ */ new Set(), this.filterSortDraft.includeBlanks = !1, this.renderFilterSortValues());
5566
- }), h.addEventListener("click", () => this.applyFilterSortDraft()), d.addEventListener("click", () => this.clearFilterSortForActiveColumn()), u.addEventListener("click", () => this.setSortForActiveColumn("asc")), p.addEventListener("click", () => this.setSortForActiveColumn("desc")), m.addEventListener("click", () => this.clearSort()), this.filterSortSidebarUnsub = this.dataModel.subscribe(() => {
5640
+ }), h.addEventListener("click", () => this.applyFilterSortDraft()), d.addEventListener("click", () => this.clearFilterSortForActiveColumn()), f.addEventListener("click", () => this.setSortForActiveColumn("asc")), p.addEventListener("click", () => this.setSortForActiveColumn("desc")), m.addEventListener("click", () => this.clearSort()), this.filterSortSidebarUnsub = this.dataModel.subscribe(() => {
5567
5641
  this.isFilterSortPanelVisible() && this.filterSortActiveColumnKey && (this.buildFilterSortDraft(this.filterSortActiveColumnKey), this.renderFilterSortSidebar());
5568
5642
  });
5569
5643
  }
@@ -5577,18 +5651,18 @@ class $o {
5577
5651
  this.isFilterSortPanelVisible() ? this.hideFilterSortPanel() : this.showFilterSortPanel(t);
5578
5652
  }
5579
5653
  buildFilterSortDraft(t) {
5580
- const e = this.dataModel.getView(), o = this.dataModel.getSchema().columns.find((u) => String(u.key) === String(t));
5654
+ const e = this.dataModel.getView(), o = this.dataModel.getSchema().columns.find((f) => String(f.key) === String(t));
5581
5655
  if (!o) {
5582
5656
  this.filterSortDraft = null;
5583
5657
  return;
5584
5658
  }
5585
- const n = this.filterSortDraft && String(this.filterSortDraft.colKey) === String(o.key) ? this.filterSortDraft.search : "", s = this.dataModel.getDistinctValuesForColumn(o.key), l = s.values.map((u) => ({ ...u, key: this.stableValueKey(u.value) })), a = (e.filters ?? []).find(
5586
- (u) => u.kind === "values" && String(u.key) === String(o.key)
5659
+ const n = this.filterSortDraft && String(this.filterSortDraft.colKey) === String(o.key) ? this.filterSortDraft.search : "", s = this.dataModel.getDistinctValuesForColumn(o.key), l = s.values.map((f) => ({ ...f, key: this.stableValueKey(f.value) })), a = (e.filters ?? []).find(
5660
+ (f) => f.kind === "values" && String(f.key) === String(o.key)
5587
5661
  ), r = /* @__PURE__ */ new Set();
5588
5662
  if (a)
5589
- for (const u of a.values ?? []) r.add(this.stableValueKey(u));
5663
+ for (const f of a.values ?? []) r.add(this.stableValueKey(f));
5590
5664
  else
5591
- for (const u of l) r.add(u.key);
5665
+ for (const f of l) r.add(f.key);
5592
5666
  const h = a ? !!a.includeBlanks : s.hasBlanks, d = e.columnDiagnostics?.[String(o.key)];
5593
5667
  this.filterSortDraft = {
5594
5668
  colKey: o.key,
@@ -5622,8 +5696,8 @@ class $o {
5622
5696
  }
5623
5697
  const h = this.dataModel.getSchema().columns.find((p) => String(p.key) === String(l.colKey))?.header ?? String(l.colKey);
5624
5698
  t.textContent = `Sort/Filter: ${h}`, e.checked = l.diagErrors, i.checked = l.diagWarnings, o.value = l.search;
5625
- const u = this.dataModel.getView().sorts?.find((p) => String(p.key) === String(l.colKey));
5626
- n && (n.dataset.active = u?.dir === "asc" ? "1" : "0"), s && (s.dataset.active = u?.dir === "desc" ? "1" : "0"), this.renderFilterSortValues();
5699
+ const f = this.dataModel.getView().sorts?.find((p) => String(p.key) === String(l.colKey));
5700
+ n && (n.dataset.active = f?.dir === "asc" ? "1" : "0"), s && (s.dataset.active = f?.dir === "desc" ? "1" : "0"), this.renderFilterSortValues();
5627
5701
  }
5628
5702
  renderFilterSortValues() {
5629
5703
  if (!this.filterSortSidebar) return;
@@ -5743,11 +5817,11 @@ class $o {
5743
5817
  this.viewportState = i, this.rafId === null && (this.rafId = requestAnimationFrame(() => this.flushRender()));
5744
5818
  }
5745
5819
  flushRender() {
5746
- this.rafId = null, this.viewportState && (this.selectionManager?.onScroll(this.viewportState.scrollTop, this.viewportState.scrollLeft), !(this.renderer instanceof St) && this.safeRender(this.viewportState));
5820
+ this.rafId = null, this.viewportState && (this.selectionManager?.onScroll(this.viewportState.scrollTop, this.viewportState.scrollLeft), !(this.renderer instanceof Tt) && this.safeRender(this.viewportState));
5747
5821
  }
5748
5822
  }
5749
- function zo(c, t) {
5750
- return new $o({
5823
+ function Jo(c, t) {
5824
+ return new Uo({
5751
5825
  root: document.createElement("div"),
5752
5826
  defaultData: c.data,
5753
5827
  defaultView: c.view,
@@ -5755,13 +5829,13 @@ function zo(c, t) {
5755
5829
  options: t
5756
5830
  });
5757
5831
  }
5758
- function Uo(c, t) {
5832
+ function Zo(c, t) {
5759
5833
  return t.remount(c), t;
5760
5834
  }
5761
5835
  export {
5762
- $o as ExtableCore,
5763
- zo as createTablePlaceholder,
5764
- qo as defineSchema,
5765
- Uo as mountTable
5836
+ Uo as ExtableCore,
5837
+ Jo as createTablePlaceholder,
5838
+ Qo as defineSchema,
5839
+ Zo as mountTable
5766
5840
  };
5767
5841
  //# sourceMappingURL=index.js.map