@extable/core 0.3.5 → 0.3.6

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,4 +1,4 @@
1
- import { D as ft, R as st, g as G, c as Ft, s as oe, r as $, m as lt, a as pt, b as mt, d as at, e as ct, t as Be, C as rt, f as Mt, h as kt, i as $t, j as Dt, k as he, H as dt, l as ut, p as $e, n as ne, o as se, q as We, u as Oe, v as le, w as je } from "./numberIO-BhW20Lm1.js";
1
+ import { D as ft, R as st, g as Q, c as _t, s as oe, r as O, m as lt, a as pt, b as mt, d as at, e as ct, t as Be, C as rt, f as Mt, h as kt, i as Wt, j as Kt, k as he, H as dt, l as ut, p as $e, n as ne, o as se, q as We, u as Oe, v as le, w as je } from "./numberIO-BMnYEoog.js";
2
2
  function qe(c) {
3
3
  const t = c.payload;
4
4
  if (!t) return null;
@@ -51,7 +51,7 @@ function ze(c, t) {
51
51
  }, n = (s, l) => {
52
52
  const a = c.getRowIndex(s);
53
53
  if (a < 0) return null;
54
- const r = e.columns.findIndex((d) => d.key === l);
54
+ const r = e.columns.findIndex((h) => h.key === l);
55
55
  return r < 0 ? null : { rowId: s, colKey: l, rowIndex: a, colIndex: r };
56
56
  };
57
57
  if ("rowId" in t && "colKey" in t)
@@ -109,7 +109,7 @@ class Xe {
109
109
  return new Set(this.lockedRows);
110
110
  }
111
111
  }
112
- const bt = (c) => c.trim().normalize("NFKC").toLowerCase().replace(/\s+/g, " "), Ge = (c) => {
112
+ const xt = (c) => c.trim().normalize("NFKC").toLowerCase().replace(/\s+/g, " "), Ge = (c) => {
113
113
  const t = [];
114
114
  if (c)
115
115
  for (const e of c) {
@@ -129,14 +129,14 @@ const bt = (c) => c.trim().normalize("NFKC").toLowerCase().replace(/\s+/g, " "),
129
129
  const o = c.items.indexOf(i);
130
130
  return o === -1 ? null : o;
131
131
  }, Qe = (c, t) => {
132
- const e = bt(t);
133
- if (bt(c.id).includes(e))
132
+ const e = xt(t);
133
+ if (xt(c.id).includes(e))
134
134
  return !0;
135
135
  for (const i of c.items)
136
- if (bt(i).includes(e))
136
+ if (xt(i).includes(e))
137
137
  return !0;
138
138
  return c.aliases ? Object.keys(c.aliases).some(
139
- (i) => bt(i).includes(e)
139
+ (i) => xt(i).includes(e)
140
140
  ) : !1;
141
141
  }, Je = (c, t) => {
142
142
  if (c.langs.length === 0)
@@ -194,26 +194,26 @@ class ti {
194
194
  const s = this.list(e).map((l) => ({ list: l, rank: Je(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
- let d = !1;
197
+ let h = !1;
198
198
  for (const p of t) {
199
- const g = Ye(l, p);
200
- if (g === null) {
201
- d = !0;
199
+ const m = Ye(l, p);
200
+ if (m === null) {
201
+ h = !0;
202
202
  break;
203
203
  }
204
- r.push(g);
204
+ r.push(m);
205
205
  }
206
- if (d)
206
+ if (h)
207
207
  continue;
208
- const h = this.inferStep(l, r);
209
- if (h === null)
208
+ const d = this.inferStep(l, r);
209
+ if (d === null)
210
210
  continue;
211
211
  const u = 10 - a;
212
212
  u > o && (o = u, i = {
213
213
  kind: "list",
214
214
  list: l,
215
215
  startIndex: r[r.length - 1] ?? 0,
216
- step: h
216
+ step: d
217
217
  });
218
218
  }
219
219
  return i;
@@ -422,12 +422,12 @@ const ei = {
422
422
  mode: "cycle",
423
423
  langs: ["ja"],
424
424
  items: ["春", "夏", "秋", "冬"]
425
- }, xi = {
425
+ }, bi = {
426
426
  id: "solfege-ja",
427
427
  mode: "cycle",
428
428
  langs: ["ja"],
429
429
  items: ["ド", "レ", "ミ", "ファ", "ソ", "ラ", "シ"]
430
- }, bi = {
430
+ }, xi = {
431
431
  id: "solfege-en",
432
432
  mode: "cycle",
433
433
  langs: ["en"],
@@ -1179,8 +1179,8 @@ const ei = {
1179
1179
  wi,
1180
1180
  vi,
1181
1181
  Ci,
1182
- xi,
1183
1182
  bi,
1183
+ xi,
1184
1184
  Si,
1185
1185
  Mi,
1186
1186
  ki,
@@ -1208,7 +1208,7 @@ const ei = {
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
- }, _t = {
1211
+ }, Vt = {
1212
1212
  1: "first",
1213
1213
  2: "second",
1214
1214
  3: "third",
@@ -1228,7 +1228,7 @@ const ei = {
1228
1228
  17: "seventeenth",
1229
1229
  18: "eighteenth",
1230
1230
  19: "nineteenth"
1231
- }, Vt = {
1231
+ }, Nt = {
1232
1232
  20: "twentieth",
1233
1233
  30: "thirtieth",
1234
1234
  40: "fortieth",
@@ -1247,9 +1247,9 @@ const ei = {
1247
1247
  80: "eighty",
1248
1248
  90: "ninety"
1249
1249
  }, re = Object.fromEntries(
1250
- Object.entries(_t).map(([c, t]) => [t, Number(c)])
1251
- ), zi = Object.fromEntries(
1252
1250
  Object.entries(Vt).map(([c, t]) => [t, Number(c)])
1251
+ ), zi = Object.fromEntries(
1252
+ Object.entries(Nt).map(([c, t]) => [t, Number(c)])
1253
1253
  ), Xi = Object.fromEntries(
1254
1254
  Object.entries(ue).map(([c, t]) => [t, Number(c)])
1255
1255
  ), fe = (c) => {
@@ -1263,10 +1263,10 @@ const ei = {
1263
1263
  return !o || !n ? null : o + n;
1264
1264
  }, pe = (c) => {
1265
1265
  if (!Number.isFinite(c) || c <= 0 || Math.floor(c) !== c) return null;
1266
- if (c <= 19) return _t[c] ?? null;
1266
+ if (c <= 19) return Vt[c] ?? null;
1267
1267
  if (c < 100) {
1268
- if (Vt[c]) return Vt[c] ?? null;
1269
- const t = Math.floor(c / 10) * 10, e = c % 10, i = ue[t], o = _t[e];
1268
+ if (Nt[c]) return Nt[c] ?? null;
1269
+ const t = Math.floor(c / 10) * 10, e = c % 10, i = ue[t], o = Vt[e];
1270
1270
  return !i || !o ? null : `${i}-${o}`;
1271
1271
  }
1272
1272
  return null;
@@ -1328,13 +1328,13 @@ const ei = {
1328
1328
  }
1329
1329
  };
1330
1330
  };
1331
- class X {
1331
+ class G {
1332
1332
  constructor(...t) {
1333
1333
  const e = t;
1334
1334
  this.seed = e, this.kind = e.length === 1 ? "copy" : "seed-repeat", this.iterator = Ji(e);
1335
1335
  }
1336
1336
  static fromSeed(t, e, i) {
1337
- const o = new X(...t);
1337
+ const o = new G(...t);
1338
1338
  return o.kind = e, o.iterator = i, o;
1339
1339
  }
1340
1340
  next() {
@@ -1461,7 +1461,7 @@ const ge = 1e-9, Zi = 100, to = (c) => ({
1461
1461
  ["V", 5],
1462
1462
  ["IV", 4],
1463
1463
  ["I", 1]
1464
- ], Wt = (c) => {
1464
+ ], Ot = (c) => {
1465
1465
  if (c < 1 || c > Zi)
1466
1466
  return null;
1467
1467
  let t = c, e = "";
@@ -1478,14 +1478,14 @@ const ge = 1e-9, Zi = 100, to = (c) => ({
1478
1478
  e += n, t = t.slice(o.length);
1479
1479
  if (t.length > 0)
1480
1480
  return null;
1481
- const i = Wt(e);
1481
+ const i = Ot(e);
1482
1482
  return !i || i !== c ? null : e;
1483
1483
  }, fo = (c, t) => {
1484
1484
  let e = 0;
1485
1485
  return {
1486
1486
  next() {
1487
1487
  e += 1;
1488
- const i = c + t * e, o = Wt(i);
1488
+ const i = c + t * e, o = Ot(i);
1489
1489
  return o ? { value: o, done: !1 } : { value: void 0, done: !0 };
1490
1490
  }
1491
1491
  };
@@ -1512,11 +1512,11 @@ const ge = 1e-9, Zi = 100, to = (c) => ({
1512
1512
  return {
1513
1513
  next() {
1514
1514
  i += 1;
1515
- const o = t + e * i, n = Wt(o);
1515
+ const o = t + e * i, n = Ot(o);
1516
1516
  return n ? { value: `${c.prefix}${n}${c.suffix}`, done: !1 } : { value: void 0, done: !0 };
1517
1517
  }
1518
1518
  };
1519
- }, Nt = {
1519
+ }, Pt = {
1520
1520
  一: 1,
1521
1521
  二: 2,
1522
1522
  三: 3,
@@ -1526,7 +1526,7 @@ const ge = 1e-9, Zi = 100, to = (c) => ({
1526
1526
  七: 7,
1527
1527
  八: 8,
1528
1528
  九: 9
1529
- }, Pt = {
1529
+ }, Bt = {
1530
1530
  壱: 1,
1531
1531
  弐: 2,
1532
1532
  参: 3,
@@ -1547,24 +1547,24 @@ const ge = 1e-9, Zi = 100, to = (c) => ({
1547
1547
  万: 1e4,
1548
1548
  萬: 1e4
1549
1549
  }, vo = /* @__PURE__ */ new Set([
1550
- ...Object.keys(Nt),
1551
1550
  ...Object.keys(Pt),
1551
+ ...Object.keys(Bt),
1552
1552
  ...Object.keys(ve),
1553
1553
  ...Object.keys(wo)
1554
- ]), Co = (c) => vo.has(c), xo = (c) => /[壱弐参肆伍陸柒捌玖拾萬佰仟]/.test(c) ? "traditional" : "modern", Ce = (c) => {
1554
+ ]), Co = (c) => vo.has(c), bo = (c) => /[壱弐参肆伍陸柒捌玖拾萬佰仟]/.test(c) ? "traditional" : "modern", Ce = (c) => {
1555
1555
  if (!c)
1556
1556
  return null;
1557
- const t = xo(c);
1557
+ const t = bo(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 ? (Nt[l] ?? Pt[l]) !== 1 ? null : { num: 1e4, style: t } : { num: 1e4, style: t };
1563
+ return l ? (Pt[l] ?? Bt[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 = Nt[s] ?? Pt[s];
1567
+ const l = Pt[s] ?? Bt[s];
1568
1568
  if (l) {
1569
1569
  if (n)
1570
1570
  return null;
@@ -1581,7 +1581,7 @@ const ge = 1e-9, Zi = 100, to = (c) => ({
1581
1581
  return null;
1582
1582
  }
1583
1583
  return e += i, e <= 0 || e > 1e4 ? null : { num: e, style: t };
1584
- }, bo = (c) => {
1584
+ }, xo = (c) => {
1585
1585
  const t = [];
1586
1586
  let e = "", i = 0, o = 0;
1587
1587
  for (const r of c)
@@ -1597,7 +1597,7 @@ const ge = 1e-9, Zi = 100, to = (c) => ({
1597
1597
  suffix: a,
1598
1598
  style: s.parsed.style
1599
1599
  };
1600
- }, xe = (c, t) => {
1600
+ }, be = (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" ? "萬" : "万";
@@ -1615,7 +1615,7 @@ const ge = 1e-9, Zi = 100, to = (c) => ({
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 = be(o, e);
1619
1619
  return n ? { value: n, done: !1 } : { value: void 0, done: !0 };
1620
1620
  }
1621
1621
  };
@@ -1624,11 +1624,11 @@ const ge = 1e-9, Zi = 100, to = (c) => ({
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 = be(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
- }, Z = (c) => {
1631
+ }, tt = (c) => {
1632
1632
  if (c.length < 2)
1633
1633
  return null;
1634
1634
  const t = c[1] - c[0];
@@ -1651,15 +1651,15 @@ const ge = 1e-9, Zi = 100, to = (c) => ({
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((h) => h.num), d = Z(r);
1655
- if (d !== null) {
1656
- const h = l[l.length - 1];
1654
+ const r = l.map((d) => d.num), h = tt(r);
1655
+ if (h !== null) {
1656
+ const d = l[l.length - 1];
1657
1657
  return {
1658
1658
  kind: "arithmetic",
1659
1659
  iterator: ho(
1660
1660
  { prefix: a.prefix, suffix: a.suffix, format: a.format },
1661
- h.num,
1662
- d
1661
+ d.num,
1662
+ h
1663
1663
  )
1664
1664
  };
1665
1665
  }
@@ -1671,21 +1671,21 @@ const ge = 1e-9, Zi = 100, to = (c) => ({
1671
1671
  if (e.every(
1672
1672
  (r) => r?.prefix === l.prefix && r?.suffix === l.suffix
1673
1673
  )) {
1674
- const r = e.map((h) => h?.num ?? 0), d = Z(r);
1675
- if (d !== null)
1674
+ const r = e.map((d) => d?.num ?? 0), h = tt(r);
1675
+ if (h !== null)
1676
1676
  return {
1677
1677
  kind: "arithmetic",
1678
1678
  iterator: uo(
1679
1679
  { prefix: a.prefix, suffix: a.suffix, width: a.width },
1680
1680
  a.num,
1681
- d
1681
+ h
1682
1682
  )
1683
1683
  };
1684
1684
  }
1685
1685
  }
1686
1686
  const i = c.map((l) => we(l));
1687
1687
  if (i.every((l) => l !== null)) {
1688
- const l = i, a = Z(l);
1688
+ const l = i, a = tt(l);
1689
1689
  if (a !== null) {
1690
1690
  const r = l[l.length - 1];
1691
1691
  return {
@@ -1698,12 +1698,12 @@ const ge = 1e-9, Zi = 100, to = (c) => ({
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((h) => h.num), d = Z(r);
1702
- if (d !== null) {
1703
- const h = l[l.length - 1];
1701
+ const r = l.map((d) => d.num), h = tt(r);
1702
+ if (h !== null) {
1703
+ const d = l[l.length - 1];
1704
1704
  return {
1705
1705
  kind: "arithmetic",
1706
- iterator: So(h.num, d, h.style)
1706
+ iterator: So(d.num, h, d.style)
1707
1707
  };
1708
1708
  }
1709
1709
  }
@@ -1714,35 +1714,35 @@ const ge = 1e-9, Zi = 100, to = (c) => ({
1714
1714
  if (l.every(
1715
1715
  (r) => r.prefix === a.prefix && r.suffix === a.suffix
1716
1716
  )) {
1717
- const r = l.map((h) => h.num), d = Z(r);
1718
- if (d !== null) {
1719
- const h = r[r.length - 1];
1717
+ const r = l.map((d) => d.num), h = tt(r);
1718
+ if (h !== null) {
1719
+ const d = r[r.length - 1];
1720
1720
  return {
1721
1721
  kind: "arithmetic",
1722
1722
  iterator: yo(
1723
1723
  { prefix: a.prefix, suffix: a.suffix },
1724
- h,
1725
- d
1724
+ d,
1725
+ h
1726
1726
  )
1727
1727
  };
1728
1728
  }
1729
1729
  }
1730
1730
  }
1731
- const s = c.map((l) => bo(l));
1731
+ const s = c.map((l) => xo(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((h) => h.num), d = Z(r);
1738
- if (d !== null) {
1739
- const h = l[l.length - 1];
1737
+ const r = l.map((d) => d.num), h = tt(r);
1738
+ if (h !== null) {
1739
+ const d = l[l.length - 1];
1740
1740
  return {
1741
1741
  kind: "arithmetic",
1742
1742
  iterator: Mo(
1743
1743
  { prefix: a.prefix, suffix: a.suffix, style: a.style },
1744
- h.num,
1745
- d
1744
+ d.num,
1745
+ h
1746
1746
  )
1747
1747
  };
1748
1748
  }
@@ -1756,46 +1756,46 @@ const ge = 1e-9, Zi = 100, to = (c) => ({
1756
1756
  iterator: no(e, c)
1757
1757
  } : null;
1758
1758
  };
1759
- function Kt(c, t) {
1759
+ function Ft(c, t) {
1760
1760
  const e = t?.registry ?? me();
1761
1761
  if (c.length === 0)
1762
- return X.fromSeed(c, "seed-repeat", ce(c));
1762
+ return G.fromSeed(c, "seed-repeat", ce(c));
1763
1763
  if (c.length === 1)
1764
- return X.fromSeed(c, "copy", to(c[0]));
1764
+ return G.fromSeed(c, "copy", to(c[0]));
1765
1765
  if (ro(c)) {
1766
1766
  const i = Io(c, e);
1767
1767
  if (i)
1768
- return X.fromSeed(c, i.kind, i.iterator);
1768
+ return G.fromSeed(c, i.kind, i.iterator);
1769
1769
  const o = Ro(c);
1770
1770
  if (o)
1771
- return X.fromSeed(c, o.kind, o.iterator);
1771
+ return G.fromSeed(c, o.kind, o.iterator);
1772
1772
  }
1773
1773
  if (so(c)) {
1774
- const i = Z(c);
1774
+ const i = tt(c);
1775
1775
  if (i !== null)
1776
- return X.fromSeed(
1776
+ return G.fromSeed(
1777
1777
  c,
1778
1778
  "arithmetic",
1779
1779
  eo(c[c.length - 1], i)
1780
1780
  );
1781
1781
  const o = ko(c);
1782
1782
  if (o !== null)
1783
- return X.fromSeed(
1783
+ return G.fromSeed(
1784
1784
  c,
1785
1785
  "geometric",
1786
1786
  oo(c[c.length - 1], o)
1787
1787
  );
1788
1788
  }
1789
1789
  if (lo(c)) {
1790
- const i = c.map((n) => n.getTime()), o = Z(i);
1790
+ const i = c.map((n) => n.getTime()), o = tt(i);
1791
1791
  if (o !== null)
1792
- return X.fromSeed(
1792
+ return G.fromSeed(
1793
1793
  c,
1794
1794
  "arithmetic",
1795
1795
  io(c[c.length - 1], o)
1796
1796
  );
1797
1797
  }
1798
- return X.fromSeed(c, "seed-repeat", ce(c));
1798
+ return G.fromSeed(c, "seed-repeat", ce(c));
1799
1799
  }
1800
1800
  function To(c) {
1801
1801
  return {
@@ -1829,7 +1829,7 @@ function Ao(c) {
1829
1829
  }
1830
1830
  return null;
1831
1831
  }
1832
- function be(c, t) {
1832
+ function xe(c, t) {
1833
1833
  if (t.length !== 1) return null;
1834
1834
  const e = To(t[0]);
1835
1835
  if (e.kind !== "cells") return null;
@@ -1867,18 +1867,18 @@ function Ho(c, t, e) {
1867
1867
  if (n.type === "number") {
1868
1868
  const a = s.map((u) => typeof u == "number" ? u : Number(u));
1869
1869
  if (!a.every((u) => Number.isFinite(u))) return null;
1870
- const r = Kt(a, { registry: l }), d = [];
1871
- let h = !1;
1870
+ const r = Ft(a, { registry: l }), h = [];
1871
+ let d = !1;
1872
1872
  return (u) => {
1873
- for (; !h && d.length < u; ) {
1873
+ for (; !d && h.length < u; ) {
1874
1874
  const p = r.next();
1875
1875
  if (p.done) {
1876
- h = !0;
1876
+ d = !0;
1877
1877
  break;
1878
1878
  }
1879
- d.push(p.value);
1879
+ h.push(p.value);
1880
1880
  }
1881
- return u <= 0 ? null : d[u - 1] ?? null;
1881
+ return u <= 0 ? null : h[u - 1] ?? null;
1882
1882
  };
1883
1883
  }
1884
1884
  if (n.type === "date" || n.type === "time" || n.type === "datetime") {
@@ -1886,33 +1886,33 @@ function Ho(c, t, e) {
1886
1886
  (u) => n.type === "time" ? Eo(u) : Ao(u)
1887
1887
  );
1888
1888
  if (!a.every((u) => u instanceof Date)) return null;
1889
- const r = Kt(a, { registry: l }), d = [];
1890
- let h = !1;
1889
+ const r = Ft(a, { registry: l }), h = [];
1890
+ let d = !1;
1891
1891
  return (u) => {
1892
- for (; !h && d.length < u; ) {
1892
+ for (; !d && h.length < u; ) {
1893
1893
  const p = r.next();
1894
1894
  if (p.done) {
1895
- h = !0;
1895
+ d = !0;
1896
1896
  break;
1897
1897
  }
1898
- d.push(p.value);
1898
+ h.push(p.value);
1899
1899
  }
1900
- return u <= 0 ? null : d[u - 1] ?? null;
1900
+ return u <= 0 ? null : h[u - 1] ?? null;
1901
1901
  };
1902
1902
  }
1903
1903
  if (n.type === "string") {
1904
- const a = s.map((u) => String(u ?? "")), r = Kt(a, { registry: l }), d = [];
1905
- let h = !1;
1904
+ const a = s.map((u) => String(u ?? "")), r = Ft(a, { registry: l }), h = [];
1905
+ let d = !1;
1906
1906
  return (u) => {
1907
- for (; !h && d.length < u; ) {
1907
+ for (; !d && h.length < u; ) {
1908
1908
  const p = r.next();
1909
1909
  if (p.done) {
1910
- h = !0;
1910
+ d = !0;
1911
1911
  break;
1912
1912
  }
1913
- d.push(p.value);
1913
+ h.push(p.value);
1914
1914
  }
1915
- return u <= 0 ? null : d[u - 1] ?? null;
1915
+ return u <= 0 ? null : h[u - 1] ?? null;
1916
1916
  };
1917
1917
  }
1918
1918
  return null;
@@ -1926,10 +1926,10 @@ function Re(c, t, e) {
1926
1926
  }
1927
1927
  function Rt(c, t, e, i, o) {
1928
1928
  if (o === "readonly") return !1;
1929
- const n = be(c, t);
1929
+ const n = xe(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', J = 13.5;
1932
+ const Y = '"Inter","Segoe UI",system-ui,-apple-system,"Helvetica Neue",sans-serif', Z = 13.5, Lo = 10;
1933
1933
  function Ie(c, t) {
1934
1934
  const e = c.sorts?.[0];
1935
1935
  return e && e.key === t ? e.dir : null;
@@ -1942,21 +1942,21 @@ function Te(c, t) {
1942
1942
  const i = c.columnDiagnostics?.[t];
1943
1943
  return !!(i?.errors || i?.warnings);
1944
1944
  }
1945
- function Lo() {
1945
+ function Do() {
1946
1946
  return `
1947
1947
  <svg viewBox="0 0 24 24" width="16" height="16" aria-hidden="true" focusable="false">
1948
1948
  <path d="M3 5h18l-7 8v6l-4 2v-8L3 5z" fill="none" stroke="currentColor" stroke-width="2" stroke-linejoin="round"/>
1949
1949
  </svg>
1950
1950
  `.trim();
1951
1951
  }
1952
- function Do(c) {
1952
+ function Ko(c) {
1953
1953
  return `
1954
1954
  <svg viewBox="0 0 24 24" width="16" height="16" aria-hidden="true" focusable="false">
1955
1955
  <path d="${c === "asc" ? "M12 6l6 8H6l6-8z" : "M12 18l-6-8h12l-6 8z"}" fill="currentColor"/>
1956
1956
  </svg>
1957
1957
  `.trim();
1958
1958
  }
1959
- function Ko(c, t, e, i, o, n) {
1959
+ function Fo(c, t, e, i, o, n) {
1960
1960
  const s = Math.min(10, Math.floor(Math.min(i, o) / 2));
1961
1961
  if (s <= 0) return;
1962
1962
  const l = n === "error" ? "#ef4444" : "#f59e0b";
@@ -1978,13 +1978,13 @@ class Ee {
1978
1978
  return !i || Number.isNaN(i.getTime()) ? null : (this.dateParseCache.set(t, i), i);
1979
1979
  }
1980
1980
  }
1981
- function Fo(c, t, e, i, o) {
1981
+ function _o(c, t, e, i, o) {
1982
1982
  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
1983
  }
1984
- function _o(c, t, e, i, o, n) {
1984
+ function Vo(c, t, e, i, o, n) {
1985
1985
  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
1986
  }
1987
- function Bt(c) {
1987
+ function $t(c) {
1988
1988
  if (Array.isArray(c) && c.every((t) => typeof t == "string"))
1989
1989
  return c;
1990
1990
  if (c && typeof c == "object") {
@@ -2002,12 +2002,12 @@ function Ae(c) {
2002
2002
  const t = c;
2003
2003
  return typeof t.kind == "string" ? null : typeof t.label == "string" && "value" in t ? t.label : null;
2004
2004
  }
2005
- class Ot {
2005
+ class jt {
2006
2006
  constructor(t) {
2007
2007
  this.n = t, this.tree = new Array(t + 1).fill(0);
2008
2008
  }
2009
2009
  static from(t) {
2010
- const e = new Ot(t.length);
2010
+ const e = new jt(t.length);
2011
2011
  for (let i = 0; i < t.length; i += 1) e.add(i, t[i] ?? 0);
2012
2012
  return e;
2013
2013
  }
@@ -2064,17 +2064,17 @@ class St {
2064
2064
  if (this.frame += 1, !this.tableEl) return;
2065
2065
  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
2066
  this.tableEl.innerHTML = "";
2067
- const a = G(n, s), r = n.columns.map((p) => Ft(p)), d = r.map((p) => oe(p)), h = this.rowHeaderWidth + a.reduce((p, g) => p + (g ?? 0), 0);
2068
- this.tableEl.style.width = `${h}px`, this.tableEl.appendChild(this.renderHeader(n, a));
2067
+ const a = Q(n, s), r = n.columns.map((p) => _t(p)), h = r.map((p) => oe(p)), d = this.rowHeaderWidth + a.reduce((p, m) => p + (m ?? 0), 0);
2068
+ this.tableEl.style.width = `${d}px`, this.tableEl.appendChild(this.renderHeader(n, a));
2069
2069
  const u = document.createElement("tbody");
2070
2070
  for (const p of l)
2071
- u.appendChild(this.renderRow(p, n, a, r, d));
2071
+ u.appendChild(this.renderRow(p, n, a, r, h));
2072
2072
  this.tableEl.appendChild(u), this.updateActiveClasses(), this.applySelectionClasses(), e && (e.scrollTop = i, e.scrollLeft = o);
2073
- for (const [p, g] of Array.from(this.measureCache.entries()))
2074
- g.frame !== this.frame && this.measureCache.delete(p);
2073
+ for (const [p, m] of Array.from(this.measureCache.entries()))
2074
+ m.frame !== this.frame && this.measureCache.delete(p);
2075
2075
  }
2076
2076
  destroy() {
2077
- $(this.tableEl), this.tableEl = null;
2077
+ O(this.tableEl), this.tableEl = null;
2078
2078
  }
2079
2079
  getCellElements() {
2080
2080
  return this.tableEl?.querySelectorAll("tr[data-row-id] td[data-col-key]") ?? null;
@@ -2116,12 +2116,12 @@ class St {
2116
2116
  if (i && !i.disabled) {
2117
2117
  const a = i.closest("td[data-col-key]"), r = a?.closest("tr[data-row-id]");
2118
2118
  if (!a || !r) return null;
2119
- const d = i.dataset.extableTagIndex, h = d ? Number.parseInt(d, 10) : Number.NaN;
2120
- return Number.isFinite(h) ? {
2119
+ const h = i.dataset.extableTagIndex, d = h ? Number.parseInt(h, 10) : Number.NaN;
2120
+ return Number.isFinite(d) ? {
2121
2121
  rowId: r.dataset.rowId ?? "",
2122
2122
  colKey: a.dataset.colKey ?? "",
2123
2123
  kind: "tag-remove",
2124
- tagIndex: h
2124
+ tagIndex: d
2125
2125
  } : null;
2126
2126
  }
2127
2127
  const o = e.closest("[data-extable-action]");
@@ -2146,89 +2146,95 @@ class St {
2146
2146
  if (!a) continue;
2147
2147
  const r = document.createElement("th");
2148
2148
  r.dataset.colKey = a.key;
2149
- const d = Ie(s, a.key), h = Te(s, a.key);
2150
- d ? r.dataset.extableSortDir = d : r.removeAttribute("data-extable-sort-dir"), h ? r.dataset.extableFsActive = "1" : r.removeAttribute("data-extable-fs-active");
2149
+ const h = Ie(s, a.key), d = Te(s, a.key);
2150
+ h ? r.dataset.extableSortDir = h : r.removeAttribute("data-extable-sort-dir"), d ? r.dataset.extableFsActive = "1" : r.removeAttribute("data-extable-fs-active");
2151
2151
  const u = document.createElement("div");
2152
2152
  u.className = "extable-col-header";
2153
2153
  const p = document.createElement("span");
2154
2154
  p.className = "extable-col-header-text", p.textContent = a.header ?? a.key;
2155
- const g = document.createElement("button");
2156
- g.type = "button", g.className = "extable-filter-sort-trigger", g.dataset.extableFsOpen = "1", g.dataset.extableColKey = a.key, g.title = "Filter / Sort", g.innerHTML = d ? Do(d) : Lo(), u.appendChild(p), u.appendChild(g), r.appendChild(u);
2157
- const v = e[l] ?? a.width;
2158
- v && (r.style.width = `${v}px`), r.dataset.colKey = a.key, this.activeColKey !== null && this.activeColKey === a.key && r.classList.add("extable-active-col-header"), o.appendChild(r);
2155
+ const m = document.createElement("button");
2156
+ 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 ? Ko(h) : Do(), u.appendChild(p), u.appendChild(m), r.appendChild(u);
2157
+ const C = e[l] ?? a.width;
2158
+ C && (r.style.width = `${C}px`), r.dataset.colKey = a.key, this.activeColKey !== null && this.activeColKey === a.key && r.classList.add("extable-active-col-header"), o.appendChild(r);
2159
2159
  }
2160
2160
  return i.appendChild(o), i;
2161
2161
  }
2162
2162
  renderRow(t, e, i, o, n) {
2163
2163
  const s = document.createElement("tr");
2164
- s.dataset.rowId = t.id, s.style.height = `${this.defaultRowHeight}px`;
2165
- const l = this.dataModel.getView(), a = document.createElement("th");
2166
- a.scope = "row", a.classList.add("extable-row-header");
2167
- const r = this.dataModel.getDisplayIndex(t.id) ?? "";
2168
- a.textContent = String(r), this.activeRowId === t.id && a.classList.add("extable-active-row-header"), s.appendChild(a);
2169
- for (let h = 0; h < e.columns.length; h += 1) {
2170
- const u = e.columns[h];
2171
- if (!u) continue;
2172
- const p = document.createElement("td");
2173
- p.classList.add("extable-cell"), p.dataset.colKey = u.key, u.type === "boolean" && p.classList.add("extable-boolean");
2174
- const g = this.dataModel.hasPending(t.id, u.key), v = this.dataModel.resolveConditionalStyle(t.id, u), C = this.dataModel.getCellStyle(t.id, u.key), f = !!(C?.textColor || v.delta?.textColor || u.style?.textColor);
2175
- if (!C && !v.delta && !g) {
2176
- const T = n[h] ?? "";
2177
- T && (p.style.cssText = T);
2164
+ 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");
2165
+ const a = this.dataModel.getView(), r = document.createElement("th");
2166
+ r.scope = "row", r.classList.add("extable-row-header");
2167
+ const h = this.dataModel.getDisplayIndex(t.id) ?? "";
2168
+ r.textContent = String(h), this.activeRowId === t.id && r.classList.add("extable-active-row-header"), s.appendChild(r);
2169
+ for (let u = 0; u < e.columns.length; u += 1) {
2170
+ const p = e.columns[u];
2171
+ if (!p) continue;
2172
+ const m = document.createElement("td");
2173
+ m.classList.add("extable-cell"), m.dataset.colKey = p.key, p.type === "boolean" && m.classList.add("extable-boolean");
2174
+ const C = this.dataModel.hasPending(t.id, p.key), x = this.dataModel.resolveConditionalStyle(t.id, p), f = this.dataModel.getCellStyle(t.id, p.key), g = !!(f?.textColor || x.delta?.textColor || p.style?.textColor);
2175
+ if (!f && !x.delta && !C) {
2176
+ const M = n[u] ?? "";
2177
+ M && (m.style.cssText = M);
2178
2178
  } else {
2179
- const T = o[h] ?? {}, F = v.delta ? lt(T, v.delta) : T, N = C ? lt(F, C) : F, k = g ? { ...N, textColor: void 0 } : N, A = oe(k);
2180
- A && (p.style.cssText = A);
2179
+ const M = o[u] ?? {}, B = x.delta ? lt(M, x.delta) : M, A = f ? lt(B, f) : B, H = C ? { ...A, textColor: void 0 } : A, E = oe(H);
2180
+ E && (m.style.cssText = E);
2181
2181
  }
2182
- const y = l.wrapText?.[u.key] ?? u.wrapText;
2183
- p.classList.add(y ? "cell-wrap" : "cell-nowrap");
2184
- const m = this.dataModel.getRawCell(t.id, u.key), w = this.dataModel.resolveCellValue(t.id, u), b = w.textOverride ?? (v.forceErrorText ? "#ERROR" : void 0), S = b ? { text: b } : this.formatValue(w.value, u), x = this.dataModel.getCellInteraction(t.id, u.key), E = u.type === "tags" && !b ? Bt(w.value) : null, V = u.type === "button" || u.type === "link", L = V ? u.type === "button" ? pt(w.value) : mt(w.value) : null, H = V ? u.type === "button" ? at(w.value) : ct(w.value) : "";
2185
- if (E && E.length) {
2186
- const T = document.createElement("div");
2187
- T.className = "extable-tag-list", E.forEach((F, N) => {
2188
- const k = document.createElement("span");
2189
- k.className = "extable-tag";
2190
- const A = document.createElement("span");
2191
- A.className = "extable-tag-label", A.textContent = F;
2192
- const R = document.createElement("button");
2193
- R.type = "button", R.className = "extable-tag-remove", R.dataset.extableTagRemove = "1", R.dataset.extableTagIndex = String(N), R.textContent = "×", (x.readonly || x.disabled) && (R.disabled = !0), k.appendChild(A), k.appendChild(R), T.appendChild(k);
2194
- }), p.replaceChildren(T);
2195
- } else if (V && !b && L && H) {
2196
- const T = u.type === "button" ? document.createElement("button") : document.createElement("span");
2197
- T instanceof HTMLButtonElement && (T.type = "button"), T.className = u.type === "button" ? "extable-action-button" : "extable-action-link", x.disabled && T.classList.add("extable-action-disabled"), u.type === "link" && f && (T.style.color = "inherit"), T.dataset.extableAction = u.type, T.textContent = H, p.replaceChildren(T);
2198
- } else
2199
- p.textContent = H || S.text, S.color && (p.style.color = S.color);
2200
- const M = this.dataModel.getCellMarker(t.id, u.key);
2201
- M ? (p.classList.toggle("extable-diag-warning", M.level === "warning"), p.classList.toggle("extable-diag-error", M.level === "error"), p.dataset.extableDiagMessage = M.message) : (p.classList.remove("extable-diag-warning", "extable-diag-error"), p.removeAttribute("data-extable-diag-message"));
2202
- const D = u.style?.align ?? (u.type === "number" || u.type === "int" || u.type === "uint" ? "right" : "left");
2203
- p.classList.add(D === "right" ? "align-right" : "align-left");
2204
- const K = Be(m, w.value, u);
2205
- if (K !== null)
2206
- p.dataset.raw = K;
2182
+ const y = a.wrapText?.[p.key] ?? p.wrapText;
2183
+ m.classList.add(y ? "cell-wrap" : "cell-nowrap");
2184
+ const w = this.dataModel.getRawCell(t.id, p.key), b = this.dataModel.resolveCellValue(t.id, p), S = b.textOverride ?? (x.forceErrorText ? "#ERROR" : void 0), v = S ? { text: S } : this.formatValue(b.value, p), I = this.dataModel.getCellInteraction(t.id, p.key), D = p.type === "tags" && !S ? $t(b.value) : null, K = p.type === "button" || p.type === "link", T = K ? p.type === "button" ? pt(b.value) : mt(b.value) : null, k = K ? p.type === "button" ? at(b.value) : ct(b.value) : "";
2185
+ if (D && D.length) {
2186
+ const M = document.createElement("div");
2187
+ M.className = "extable-tag-list", D.forEach((B, A) => {
2188
+ const H = document.createElement("span");
2189
+ H.className = "extable-tag";
2190
+ const E = document.createElement("span");
2191
+ E.className = "extable-tag-label", E.textContent = B;
2192
+ const N = document.createElement("button");
2193
+ N.type = "button", N.className = "extable-tag-remove", N.dataset.extableTagRemove = "1", N.dataset.extableTagIndex = String(A), N.textContent = "×", (I.readonly || I.disabled) && (N.disabled = !0), H.appendChild(E), H.appendChild(N), M.appendChild(H);
2194
+ }), m.replaceChildren(M);
2195
+ } else if (K && !S && T && k) {
2196
+ const M = p.type === "button" ? document.createElement("button") : document.createElement("span");
2197
+ M instanceof HTMLButtonElement && (M.type = "button"), M.className = p.type === "button" ? "extable-action-button" : "extable-action-link", I.disabled && M.classList.add("extable-action-disabled"), p.type === "link" && g && (M.style.color = "inherit"), M.dataset.extableAction = p.type, M.textContent = k, m.replaceChildren(M);
2198
+ } else if (p.type === "boolean" && !S)
2199
+ if (p.unique) {
2200
+ const M = document.createElement("input");
2201
+ M.type = "radio", M.name = `extable-unique-${String(p.key)}`, M.checked = !!b.value, (I.readonly || I.disabled) && (M.disabled = !0), M.className = "extable-unique-radio", M.setAttribute("aria-label", p.header ?? String(p.key)), m.replaceChildren(M);
2202
+ } else
2203
+ m.textContent = v.text, v.color && (m.style.color = v.color);
2204
+ else
2205
+ m.textContent = k || v.text, v.color && (m.style.color = v.color);
2206
+ const L = this.dataModel.getCellMarker(t.id, p.key);
2207
+ L ? (m.classList.toggle("extable-diag-warning", L.level === "warning"), m.classList.toggle("extable-diag-error", L.level === "error"), m.dataset.extableDiagMessage = L.message) : (m.classList.remove("extable-diag-warning", "extable-diag-error"), m.removeAttribute("data-extable-diag-message"));
2208
+ const F = p.style?.align ?? (p.type === "number" || p.type === "int" || p.type === "uint" ? "right" : "left");
2209
+ m.classList.add(F === "right" ? "align-right" : "align-left");
2210
+ const V = Be(w, b.value, p);
2211
+ if (V !== null)
2212
+ m.dataset.raw = V;
2207
2213
  else {
2208
- const T = m == null ? "" : String(m);
2209
- p.dataset.raw = T;
2214
+ const M = w == null ? "" : String(w);
2215
+ m.dataset.raw = M;
2210
2216
  }
2211
- g && p.classList.add("pending"), x.readonly ? (p.classList.add("extable-readonly"), u.formula && p.classList.add("extable-readonly-formula")) : p.classList.add("extable-editable"), x.muted && p.classList.add("extable-readonly-muted"), x.disabled && p.classList.add("extable-disabled"), this.activeRowId === t.id && this.activeColKey !== null && this.activeColKey === u.key && p.classList.add("extable-active-cell"), s.appendChild(p);
2212
- }
2213
- if (e.columns.some((h) => l.wrapText?.[h.key] ?? h.wrapText)) {
2214
- let h = this.defaultRowHeight;
2215
- for (let u = 0; u < e.columns.length; u += 1) {
2216
- const p = e.columns[u];
2217
- if (!p || !p.wrapText) continue;
2218
- const g = i[u] ?? l.columnWidths?.[p.key] ?? p.width ?? 100, v = this.dataModel.resolveCellValue(t.id, p), C = this.dataModel.resolveConditionalStyle(t.id, p), y = v.textOverride ?? (C.forceErrorText ? "#ERROR" : void 0) ? "#ERROR" : this.formatValue(v.value, p).text, m = this.dataModel.getRowVersion(t.id), w = `${t.id}|${p.key}|${m}|${g}|${y}`, b = this.measureCache.get(w);
2219
- if (b) {
2220
- b.frame = this.frame, this.measureCache.set(w, b), h = Math.max(h, b.height);
2217
+ C && m.classList.add("pending"), I.readonly ? (m.classList.add("extable-readonly"), p.formula && m.classList.add("extable-readonly-formula")) : m.classList.add("extable-editable"), I.muted && m.classList.add("extable-readonly-muted"), I.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);
2218
+ }
2219
+ if (e.columns.some((u) => a.wrapText?.[u.key] ?? u.wrapText)) {
2220
+ let u = this.defaultRowHeight;
2221
+ for (let p = 0; p < e.columns.length; p += 1) {
2222
+ const m = e.columns[p];
2223
+ if (!m || !m.wrapText) continue;
2224
+ const C = i[p] ?? a.columnWidths?.[m.key] ?? m.width ?? 100, x = this.dataModel.resolveCellValue(t.id, m), f = this.dataModel.resolveConditionalStyle(t.id, m), y = x.textOverride ?? (f.forceErrorText ? "#ERROR" : void 0) ? "#ERROR" : this.formatValue(x.value, m).text, w = this.dataModel.getRowVersion(t.id), b = `${t.id}|${m.key}|${w}|${C}|${y}`, S = this.measureCache.get(b);
2225
+ if (S) {
2226
+ S.frame = this.frame, this.measureCache.set(b, S), u = Math.max(u, S.height);
2221
2227
  continue;
2222
2228
  }
2223
- const S = document.createElement("span");
2224
- 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 = `${g}px`, S.textContent = y;
2225
- const x = this.tableEl?.parentElement;
2226
- if (!x) continue;
2227
- x.appendChild(S);
2228
- const E = S.clientHeight + rt + Mt + 2;
2229
- S.remove(), this.measureCache.set(w, { height: E, frame: this.frame }), h = Math.max(h, E);
2229
+ const v = document.createElement("span");
2230
+ v.style.visibility = "hidden", v.style.position = "absolute", v.style.left = "-10000px", v.style.top = "0", v.style.whiteSpace = "pre-wrap", v.style.overflowWrap = "anywhere", v.style.display = "inline-block", v.style.width = `${C}px`, v.textContent = y;
2231
+ const I = this.tableEl?.parentElement;
2232
+ if (!I) continue;
2233
+ I.appendChild(v);
2234
+ const D = v.clientHeight + rt + Mt + 2;
2235
+ v.remove(), this.measureCache.set(b, { height: D, frame: this.frame }), u = Math.max(u, D);
2230
2236
  }
2231
- s.style.height = `${h}px`, this.dataModel.setRowHeight(t.id, h);
2237
+ s.style.height = `${u}px`, this.dataModel.setRowHeight(t.id, u);
2232
2238
  } else
2233
2239
  s.style.height = `${this.defaultRowHeight}px`, this.dataModel.setRowHeight(t.id, this.defaultRowHeight);
2234
2240
  return s;
@@ -2275,11 +2281,11 @@ class St {
2275
2281
  for (let a = o; a <= n; a += 1) {
2276
2282
  const r = t[a];
2277
2283
  if (!r) continue;
2278
- const d = r.querySelector("th.extable-row-header");
2279
- d && d.classList.add("extable-selected");
2280
- const h = Array.from(r.querySelectorAll("td"));
2284
+ const h = r.querySelector("th.extable-row-header");
2285
+ h && h.classList.add("extable-selected");
2286
+ const d = Array.from(r.querySelectorAll("td"));
2281
2287
  for (let u = s; u <= l; u += 1) {
2282
- const p = h[u];
2288
+ const p = d[u];
2283
2289
  p && p.classList.add("extable-selected");
2284
2290
  }
2285
2291
  }
@@ -2299,7 +2305,7 @@ class St {
2299
2305
  if (e.type === "link")
2300
2306
  return { text: ct(t) || String(t) };
2301
2307
  if (e.type === "tags") {
2302
- const i = Bt(t);
2308
+ const i = $t(t);
2303
2309
  if (i) return { text: i.join(", ") };
2304
2310
  }
2305
2311
  if (e.type === "boolean")
@@ -2307,8 +2313,8 @@ class St {
2307
2313
  if (e.type === "number" && typeof t == "number") {
2308
2314
  const i = t, o = e.format;
2309
2315
  if ((o?.format ?? "decimal") === "scientific") {
2310
- const r = kt(i, { format: "scientific", precision: o?.precision }), d = o?.negativeRed && i < 0 ? "#b91c1c" : void 0;
2311
- return { text: r, color: d };
2316
+ const r = kt(i, { format: "scientific", precision: o?.precision }), h = o?.negativeRed && i < 0 ? "#b91c1c" : void 0;
2317
+ return { text: r, color: h };
2312
2318
  }
2313
2319
  const s = {};
2314
2320
  o?.scale !== void 0 && (s.minimumFractionDigits = o.scale, s.maximumFractionDigits = o.scale), s.useGrouping = !!o?.thousandSeparator;
@@ -2318,8 +2324,8 @@ class St {
2318
2324
  if ((e.type === "int" || e.type === "uint") && typeof t == "number") {
2319
2325
  const i = t, o = e.format, n = o?.format ?? "decimal";
2320
2326
  if (n === "binary" || n === "octal" || n === "hex") {
2321
- const r = $t(i, n), d = o?.negativeRed && i < 0 ? "#b91c1c" : void 0;
2322
- return { text: r, color: d };
2327
+ const r = Wt(i, n), h = o?.negativeRed && i < 0 ? "#b91c1c" : void 0;
2328
+ return { text: r, color: h };
2323
2329
  }
2324
2330
  const s = {
2325
2331
  minimumFractionDigits: 0,
@@ -2329,23 +2335,23 @@ class St {
2329
2335
  return { text: l, color: a };
2330
2336
  }
2331
2337
  if ((e.type === "date" || e.type === "time" || e.type === "datetime") && (t instanceof Date || typeof t == "string")) {
2332
- const i = e.format, o = e.type === "date" ? Dt(i, "date") : e.type === "time" ? Dt(i, "time") : Dt(i, "datetime");
2338
+ const i = e.format, o = e.type === "date" ? Kt(i, "date") : e.type === "time" ? Kt(i, "time") : Kt(i, "datetime");
2333
2339
  let n = null;
2334
2340
  return t instanceof Date ? n = t : n = this.valueFormatCache.parseIsoDate(t), n ? { text: he(n, o) } : { text: String(t) };
2335
2341
  }
2336
2342
  return { text: String(t) };
2337
2343
  }
2338
2344
  }
2339
- const q = class q {
2345
+ const U = class U {
2340
2346
  constructor(t, e = () => "direct") {
2341
2347
  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 = dt, this.lineHeight = 16, this.padding = 12, this.rowHeaderWidth = st, this.activeRowId = null, this.activeColKey = null, this.selection = [], this.valueFormatCache = new Ee(), 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) => {
2342
2348
  if (!this.root || !this.canvas) return;
2343
2349
  const o = this.canvas.getBoundingClientRect(), n = i.clientX - o.left, s = i.clientY - o.top, l = n + this.root.scrollLeft, a = s;
2344
2350
  if (a >= this.headerHeight || l < this.rowHeaderWidth) return;
2345
- const r = this.dataModel.getSchema(), d = this.dataModel.getView(), h = G(r, d);
2351
+ const r = this.dataModel.getSchema(), h = this.dataModel.getView(), d = Q(r, h);
2346
2352
  let u = this.rowHeaderWidth, p = -1;
2347
- for (let b = 0; b < h.length; b += 1) {
2348
- const S = h[b] ?? 100;
2353
+ for (let b = 0; b < d.length; b += 1) {
2354
+ const S = d[b] ?? 100;
2349
2355
  if (l >= u && l <= u + S) {
2350
2356
  p = b;
2351
2357
  break;
@@ -2353,11 +2359,11 @@ const q = class q {
2353
2359
  u += S;
2354
2360
  }
2355
2361
  if (p < 0) return;
2356
- const g = r.columns[p];
2357
- if (!g) return;
2358
- const v = h[p] ?? 100, C = 18, y = u + v - C - 4, m = Math.floor((this.headerHeight - C) / 2);
2359
- l >= y && l <= y + C && a >= m && a <= m + C && this.root.dispatchEvent(
2360
- new CustomEvent("extable:filter-sort-open", { bubbles: !0, detail: { colKey: g.key } })
2362
+ const m = r.columns[p];
2363
+ if (!m) return;
2364
+ const C = d[p] ?? 100, x = 18, g = u + C - x - 4, y = Math.floor((this.headerHeight - x) / 2);
2365
+ l >= g && l <= g + x && a >= y && a <= y + x && this.root.dispatchEvent(
2366
+ new CustomEvent("extable:filter-sort-open", { bubbles: !0, detail: { colKey: m.key } })
2361
2367
  );
2362
2368
  }, this.handlePointerMove = (i) => {
2363
2369
  this.pendingCursorPoint = { x: i.clientX, y: i.clientY }, !this.cursorTimer && (this.cursorTimer = window.setTimeout(() => {
@@ -2381,7 +2387,7 @@ const q = class q {
2381
2387
  }
2382
2388
  mount(t) {
2383
2389
  this.root = t, this.canvas = document.createElement("canvas");
2384
- const e = q.MAX_CANVAS_DIM_PX;
2390
+ const e = U.MAX_CANVAS_DIM_PX;
2385
2391
  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();
2386
2392
  }
2387
2393
  setActiveCell(t, e) {
@@ -2395,145 +2401,149 @@ const q = class q {
2395
2401
  if (this.frame += 1, !this.canvas || !this.root) return;
2396
2402
  const e = this.canvas.getContext("2d");
2397
2403
  if (!e) return;
2398
- e.font = `${J}px ${Q}`;
2404
+ e.font = `${Z}px ${Y}`;
2399
2405
  let i = e.font;
2400
- const o = this.activeRowId === "__all__" && this.activeColKey === "__all__", n = this.dataModel.getSchema(), s = this.dataModel.getView(), l = this.dataModel.listRows(), a = G(n, s), r = n.columns.map((k) => Ft(k)), d = /* @__PURE__ */ new Map(), h = n.columns.some((k) => s.wrapText?.[k.key] ?? k.wrapText), u = h ? this.getRowHeightCacheKey(n, s, a) : null;
2401
- u !== this.rowHeightCacheKey && (this.rowHeightCacheKey = u, this.rowHeightMeasuredVersion.clear(), this.rowHeightMeasureTask = null), h || this.cancelRowHeightMeasurement(), this.ensureHeightIndex(l, h ? u : null, h);
2406
+ const o = this.activeRowId === "__all__" && this.activeColKey === "__all__", n = this.dataModel.getSchema(), s = this.dataModel.getView(), l = this.dataModel.listRows(), a = Q(n, s), r = n.columns.map((A) => _t(A)), h = /* @__PURE__ */ new Map(), d = n.columns.some((A) => s.wrapText?.[A.key] ?? A.wrapText), u = d ? this.getRowHeightCacheKey(n, s, a) : null;
2407
+ u !== this.rowHeightCacheKey && (this.rowHeightCacheKey = u, this.rowHeightMeasuredVersion.clear(), this.rowHeightMeasureTask = null), d || this.cancelRowHeightMeasurement(), this.ensureHeightIndex(l, d ? u : null, d);
2402
2408
  const p = this.heightIndex;
2403
2409
  if (!p) return;
2404
- const g = this.rowHeaderWidth + a.reduce((k, A) => k + (A ?? 0), 0), v = t?.clientWidth ?? (this.root.clientWidth || 600), C = t?.clientHeight ?? (this.root.clientHeight || this.canvas.height || 400), f = q.MAX_CANVAS_DIM_PX, y = Math.max(1, Math.min(f, Math.floor(v))), m = Math.max(1, Math.min(f, Math.floor(C)));
2405
- this.canvas.width !== y && (this.canvas.width = y), this.canvas.height !== m && (this.canvas.height = m), this.canvas.style.width = `${y}px`, this.canvas.style.height = `${m}px`, e.font = `${J}px ${Q}`, i = e.font, this.refreshTooltipPosition();
2406
- const w = t?.scrollTop ?? this.root.scrollTop, b = t?.scrollLeft ?? this.root.scrollLeft, S = (k) => {
2407
- const A = k + 1, R = Math.max(
2410
+ const m = this.rowHeaderWidth + a.reduce((A, H) => A + (H ?? 0), 0), C = t?.clientWidth ?? (this.root.clientWidth || 600), x = t?.clientHeight ?? (this.root.clientHeight || this.canvas.height || 400), f = U.MAX_CANVAS_DIM_PX, g = Math.max(1, Math.min(f, Math.floor(C))), y = Math.max(1, Math.min(f, Math.floor(x)));
2411
+ this.canvas.width !== g && (this.canvas.width = g), this.canvas.height !== y && (this.canvas.height = y), this.canvas.style.width = `${g}px`, this.canvas.style.height = `${y}px`, e.font = `${Z}px ${Y}`, i = e.font, this.refreshTooltipPosition();
2412
+ const w = t?.scrollTop ?? this.root.scrollTop, b = t?.scrollLeft ?? this.root.scrollLeft, S = (A) => {
2413
+ const H = A + 1, E = Math.max(
2408
2414
  0,
2409
- Math.min(l.length - 1, p.fenwick.lowerBound(A))
2410
- ), U = p.fenwick.sum(R);
2411
- let _ = R, O = 0;
2412
- const W = (this.canvas?.height ?? 0) + this.rowHeight * 2;
2413
- for (let I = R; I < l.length && O < W; I += 1)
2414
- O += p.heights[I] ?? this.rowHeight, _ = I + 1;
2415
- return { accum: U, visibleStart: R, visibleEnd: _ };
2415
+ Math.min(l.length - 1, p.fenwick.lowerBound(H))
2416
+ ), N = p.fenwick.sum(E);
2417
+ let _ = E, q = 0;
2418
+ const j = (this.canvas?.height ?? 0) + this.rowHeight * 2;
2419
+ for (let R = E; R < l.length && q < j; R += 1)
2420
+ q += p.heights[R] ?? this.rowHeight, _ = R + 1;
2421
+ return { accum: N, visibleStart: E, visibleEnd: _ };
2416
2422
  };
2417
- let x = p.fenwick.total();
2418
- const E = this.canvas?.height ?? this.root.clientHeight, V = Math.max(0, E - this.headerHeight);
2419
- let L = Math.max(0, x - V), H = Math.max(0, Math.min(w, L)), { accum: M, visibleStart: D, visibleEnd: K } = S(H);
2420
- if (h && u) {
2421
- const k = {};
2422
- for (let A = D; A < K; A += 1) {
2423
- const R = l[A];
2424
- if (!R) continue;
2425
- const U = this.dataModel.getRowVersion(R.id);
2426
- if (this.rowHeightMeasuredVersion.get(R.id) === U) continue;
2427
- const _ = this.measureRowHeight(e, R, n, a);
2428
- k[R.id] = _, this.rowHeightMeasuredVersion.set(R.id, U);
2423
+ let v = p.fenwick.total();
2424
+ const I = this.canvas?.height ?? this.root.clientHeight, D = Math.max(0, I - this.headerHeight);
2425
+ let K = Math.max(0, v - D), T = Math.max(0, Math.min(w, K)), { accum: k, visibleStart: L, visibleEnd: F } = S(T);
2426
+ if (d && u) {
2427
+ const A = {};
2428
+ for (let H = L; H < F; H += 1) {
2429
+ const E = l[H];
2430
+ if (!E) continue;
2431
+ const N = this.dataModel.getRowVersion(E.id);
2432
+ if (this.rowHeightMeasuredVersion.get(E.id) === N) continue;
2433
+ const _ = this.measureRowHeight(e, E, n, a);
2434
+ A[E.id] = _, this.rowHeightMeasuredVersion.set(E.id, N);
2429
2435
  }
2430
- this.applyRowHeightUpdates(k), x = p.fenwick.total(), this.dataModel.setRowHeightsBulk(k), L = Math.max(0, x - V), H = Math.max(0, Math.min(w, L)), { accum: M, visibleStart: D, visibleEnd: K } = S(H), (this.rowHeightMeasureTask || Object.keys(k).length > 0) && this.scheduleRowHeightMeasurement();
2436
+ this.applyRowHeightUpdates(A), v = p.fenwick.total(), this.dataModel.setRowHeightsBulk(A), K = Math.max(0, v - D), T = Math.max(0, Math.min(w, K)), { accum: k, visibleStart: L, visibleEnd: F } = S(T), (this.rowHeightMeasureTask || Object.keys(A).length > 0) && this.scheduleRowHeightMeasurement();
2431
2437
  }
2432
- this.spacer && (this.spacer.style.height = `${L}px`, this.spacer.style.width = `${g}px`);
2433
- const T = this.rowHeaderWidth - b;
2438
+ this.spacer && (this.spacer.style.height = `${K}px`, this.spacer.style.width = `${m}px`);
2439
+ const V = this.rowHeaderWidth - b;
2434
2440
  e.clearRect(0, 0, this.canvas.width, this.canvas.height), e.fillStyle = "#e5e7eb", e.fillRect(0, 0, this.rowHeaderWidth, this.canvas.height);
2435
- let F = this.headerHeight + M - H;
2436
- for (let k = D; k < K; k += 1) {
2437
- const A = l[k], R = p.heights[k] ?? this.rowHeight;
2438
- e.strokeStyle = "#d0d7de", e.fillStyle = "#e5e7eb", e.fillRect(0, F, this.rowHeaderWidth, R), e.strokeRect(0, F, this.rowHeaderWidth, R);
2439
- const U = this.dataModel.getDisplayIndex(A.id) ?? "";
2440
- this.activeRowId === A.id && (e.fillStyle = "rgba(59,130,246,0.16)", e.fillRect(0, F, this.rowHeaderWidth, R)), e.fillStyle = "#0f172a", e.font = `bold ${J}px ${Q}`, e.textAlign = "center", e.textBaseline = "middle", e.fillText(String(U), this.rowHeaderWidth / 2, F + R / 2), e.font = i, e.textAlign = "left", e.textBaseline = "alphabetic", e.save(), e.beginPath(), e.rect(
2441
+ let M = this.headerHeight + k - T;
2442
+ for (let A = L; A < F; A += 1) {
2443
+ const H = l[A], E = p.heights[A] ?? this.rowHeight;
2444
+ e.strokeStyle = "#d0d7de", e.fillStyle = "#e5e7eb", e.fillRect(0, M, this.rowHeaderWidth, E), e.strokeRect(0, M, this.rowHeaderWidth, E);
2445
+ const N = this.dataModel.getDisplayIndex(H.id) ?? "";
2446
+ this.activeRowId === H.id && (e.fillStyle = "rgba(59,130,246,0.16)", e.fillRect(0, M, this.rowHeaderWidth, E)), e.fillStyle = "#0f172a", e.font = `bold ${Z}px ${Y}`, e.textAlign = "center", e.textBaseline = "middle", e.fillText(String(N), this.rowHeaderWidth / 2, M + E / 2), e.font = i, e.textAlign = "left", e.textBaseline = "alphabetic", e.save(), e.beginPath(), e.rect(
2441
2447
  this.rowHeaderWidth,
2442
2448
  this.headerHeight,
2443
2449
  this.canvas.width - this.rowHeaderWidth,
2444
2450
  this.canvas.height - this.headerHeight
2445
- ), e.clip(), e.translate(T, 0);
2446
- let _ = 0, O = "";
2447
- for (let W = 0; W < n.columns.length; W += 1) {
2448
- const I = n.columns[W], P = a[W] ?? 100;
2449
- if (!I) {
2450
- _ += P;
2451
+ ), e.clip(), e.translate(V, 0);
2452
+ let _ = 0, q = "";
2453
+ for (let j = 0; j < n.columns.length; j += 1) {
2454
+ const R = n.columns[j], $ = a[j] ?? 100;
2455
+ if (!R) {
2456
+ _ += $;
2451
2457
  continue;
2452
2458
  }
2453
- const B = this.dataModel.getCellInteraction(A.id, I.key), et = B.muted;
2459
+ const W = this.dataModel.getCellInteraction(H.id, R.key), it = W.muted;
2454
2460
  e.strokeStyle = "#d0d7de";
2455
- const it = this.dataModel.resolveConditionalStyle(A.id, I), ht = this.dataModel.getCellStyle(A.id, I.key), jt = r[W] ?? {}, qt = it.delta ? lt(jt, it.delta) : jt, z = ht ? lt(qt, ht) : qt, He = et ? "#f3f4f6" : z.backgroundColor ?? "#ffffff";
2456
- e.fillStyle = He, e.fillRect(_, F, P, R), e.strokeRect(_, F, P, R);
2457
- const ot = this.dataModel.resolveCellValue(A.id, I), Ut = ot.textOverride ?? (it.forceErrorText ? "#ERROR" : void 0), gt = Ut ? { text: "#ERROR" } : this.formatValue(ot.value, I), Et = I.type === "button" || I.type === "link", zt = Et ? I.type === "button" ? pt(ot.value) : mt(ot.value) : null, Xt = Et ? zt?.label ?? (I.type === "button" ? at(ot.value) : ct(ot.value)) : "", yt = !!(Et && zt && Xt && !Ut), Gt = Xt || gt.text, Yt = I.style?.align ?? (I.type === "number" ? "right" : "left");
2458
- if (this.activeRowId === A.id && this.activeColKey !== null && this.activeColKey === I.key && (e.strokeStyle = "#3b82f6", e.lineWidth = 2, e.strokeRect(_ + 1, F + 1, P - 2, R - 2), e.lineWidth = 1, Rt(
2461
+ const ot = this.dataModel.resolveConditionalStyle(H.id, R), ht = this.dataModel.getCellStyle(H.id, R.key), qt = r[j] ?? {}, Ut = ot.delta ? lt(qt, ot.delta) : qt, z = ht ? lt(Ut, ht) : Ut, He = n.columns.some((P) => P && P.type === "boolean" && P.unique && this.dataModel.getCell(H.id, P.key) === !0) ? "rgba(59,130,246,0.06)" : it ? "#f3f4f6" : z.backgroundColor ?? "#ffffff";
2462
+ e.fillStyle = He, e.fillRect(_, M, $, E), e.strokeRect(_, M, $, E);
2463
+ const X = this.dataModel.resolveCellValue(H.id, R), zt = X.textOverride ?? (ot.forceErrorText ? "#ERROR" : void 0), gt = zt ? { text: "#ERROR" } : this.formatValue(X.value, R), Et = R.type === "button" || R.type === "link", Xt = Et ? R.type === "button" ? pt(X.value) : mt(X.value) : null, Gt = Et ? Xt?.label ?? (R.type === "button" ? at(X.value) : ct(X.value)) : "", yt = !!(Et && Xt && Gt && !zt);
2464
+ let At = Gt || gt.text;
2465
+ R.type === "boolean" && R.unique && (At = X.value === !0 || X.value === "true" || X.value === "1" || X.value === 1 ? "🔵" : "");
2466
+ const Yt = R.style?.align ?? (R.type === "number" ? "right" : "left");
2467
+ if (this.activeRowId === H.id && this.activeColKey !== null && this.activeColKey === R.key && (e.strokeStyle = "#3b82f6", e.lineWidth = 2, e.strokeRect(_ + 1, M + 1, $ - 2, E - 2), e.lineWidth = 1, Rt(
2459
2468
  this.dataModel,
2460
2469
  this.selection,
2461
2470
  this.activeRowId,
2462
2471
  this.activeColKey,
2463
2472
  this.getEditMode()
2464
2473
  ))) {
2465
- const j = Se, nt = _ + P - j - 1, Y = F + R - j - 1;
2466
- e.fillStyle = "#3b82f6", e.fillRect(nt, Y, j, j), e.strokeStyle = "#ffffff", e.strokeRect(nt + 0.5, Y + 0.5, j - 1, j - 1);
2474
+ const P = Se, nt = _ + $ - P - 1, J = M + E - P - 1;
2475
+ e.fillStyle = "#3b82f6", e.fillRect(nt, J, P, P), e.strokeStyle = "#ffffff", e.strokeRect(nt + 0.5, J + 0.5, P - 1, P - 1);
2467
2476
  }
2468
- const Qt = yt && I.type === "link" && !et && !z.textColor ? "#2563eb" : void 0, Le = this.getEditMode() === "readonly", De = !!(gt.color || z.textColor || Qt), Ke = !Le && I.formula && B.readonly && !et && !De ? "#99aaff" : void 0;
2469
- e.fillStyle = this.dataModel.hasPending(A.id, I.key) ? "#b91c1c" : gt.color ? gt.color : et ? "#94a3b8" : Qt ?? z.textColor ?? Ke ?? "#0f172a";
2470
- const Jt = s.wrapText?.[I.key] ?? I.wrapText ?? !1, At = I.type === "boolean" && (!I.format || I.format === "checkbox"), Fe = I.type === "boolean" && !!(I.format && I.format !== "checkbox");
2471
- if (At)
2472
- e.font = i, O = "";
2477
+ const Qt = yt && R.type === "link" && !it && !z.textColor ? "#2563eb" : void 0, Le = this.getEditMode() === "readonly", De = !!(gt.color || z.textColor || Qt), Ke = !Le && R.formula && W.readonly && !it && !De ? "#99aaff" : void 0;
2478
+ e.fillStyle = this.dataModel.hasPending(H.id, R.key) ? "#b91c1c" : gt.color ? gt.color : it ? "#94a3b8" : Qt ?? z.textColor ?? Ke ?? "#0f172a";
2479
+ const Jt = s.wrapText?.[R.key] ?? R.wrapText ?? !1, Ht = R.type === "boolean" && (!R.format || R.format === "checkbox"), Fe = R.type === "boolean" && !!(R.format && R.format !== "checkbox");
2480
+ if (Ht)
2481
+ e.font = i, q = "";
2473
2482
  else {
2474
- const j = `${z.italic ? "i" : ""}${z.bold ? "b" : ""}`;
2475
- if (j !== O) {
2476
- const nt = d.get(j);
2483
+ const P = `${z.italic ? "i" : ""}${z.bold ? "b" : ""}`;
2484
+ if (P !== q) {
2485
+ const nt = h.get(P);
2477
2486
  if (nt) e.font = nt;
2478
2487
  else {
2479
- const Y = z.bold ? "600 " : "", xt = `${z.italic ? "italic " : ""}${Y}${J}px ${Q}`.trim();
2480
- d.set(j, xt), e.font = xt;
2488
+ const J = z.bold ? "600 " : "", bt = `${z.italic ? "italic " : ""}${J}${Z}px ${Y}`.trim();
2489
+ h.set(P, bt), e.font = bt;
2481
2490
  }
2482
- O = j;
2491
+ q = P;
2483
2492
  }
2484
2493
  }
2485
- const wt = _ + ut, vt = F + rt, Ht = Math.max(0, P - ut * 2), Lt = Math.max(0, R - (rt + Mt)), _e = {
2486
- underline: !!z.underline || yt && I.type === "link",
2494
+ const wt = _ + ut, vt = M + rt, Lt = Math.max(0, $ - ut * 2), Dt = Math.max(0, E - (rt + Mt)), _e = {
2495
+ underline: !!z.underline || yt && R.type === "link",
2487
2496
  strike: !!z.strike
2488
- }, tt = yt && !At ? this.measureTextBounds(
2497
+ }, et = yt && !Ht ? this.measureTextBounds(
2489
2498
  e,
2490
- Gt,
2499
+ At,
2491
2500
  wt,
2492
2501
  vt,
2493
- Ht,
2494
2502
  Lt,
2503
+ Dt,
2495
2504
  Jt,
2496
2505
  Yt
2497
2506
  ) : null;
2498
- if (yt && I.type === "button" && tt) {
2499
- const Y = Math.max(wt, tt.x - 6), Ct = Math.max(vt, tt.y - 4), xt = Math.min(wt + Ht, tt.x + tt.width + 6), Ve = Math.min(vt + Lt, tt.y + tt.height + 4), te = Math.max(0, xt - Y), ee = Math.max(0, Ve - Ct);
2507
+ if (yt && R.type === "button" && et) {
2508
+ 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), Ve = Math.min(vt + Dt, et.y + et.height + 4), te = Math.max(0, bt - J), ee = Math.max(0, Ve - Ct);
2500
2509
  e.save();
2501
- const ie = `${A.id}::${I.key}::button`, Ne = this.hoverActionKey === ie, Pe = this.activeActionKey === ie;
2502
- et ? (e.fillStyle = "#f3f4f6", e.strokeStyle = "#e2e8f0") : Pe ? (e.fillStyle = "#cbd5e1", e.strokeStyle = "#94a3b8") : Ne ? (e.fillStyle = "#e2e8f0", e.strokeStyle = "#94a3b8") : (e.fillStyle = "#f8fafc", e.strokeStyle = "#cbd5e1"), e.lineWidth = 1, e.beginPath(), typeof e.roundRect == "function" ? e.roundRect(Y, Ct, te, ee, 6) : e.rect(Y, Ct, te, ee), e.fill(), e.stroke(), e.restore();
2510
+ const ie = `${H.id}::${R.key}::button`, Ne = this.hoverActionKey === ie, Pe = this.activeActionKey === ie;
2511
+ it ? (e.fillStyle = "#f3f4f6", e.strokeStyle = "#e2e8f0") : Pe ? (e.fillStyle = "#cbd5e1", e.strokeStyle = "#94a3b8") : Ne ? (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, te, ee, 6) : e.rect(J, Ct, te, ee), e.fill(), e.stroke(), e.restore();
2503
2512
  }
2504
2513
  this.drawCellText(
2505
2514
  e,
2506
- Gt,
2515
+ At,
2507
2516
  wt,
2508
2517
  vt,
2509
- Ht,
2510
2518
  Lt,
2519
+ Dt,
2511
2520
  Jt,
2512
2521
  Yt,
2513
- At,
2522
+ Ht,
2514
2523
  Fe,
2524
+ !!R.unique,
2515
2525
  _e
2516
2526
  );
2517
- const Zt = this.dataModel.getCellMarker(A.id, I.key);
2518
- Zt && Ko(e, _, F, P, R, Zt.level), _ += P;
2527
+ const Zt = this.dataModel.getCellMarker(H.id, R.key);
2528
+ Zt && Fo(e, _, M, $, E, Zt.level), _ += $;
2519
2529
  }
2520
- e.restore(), F += R;
2530
+ e.restore(), M += E;
2521
2531
  }
2522
- 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(T, 0);
2523
- let N = 0;
2524
- for (let k = 0; k < n.columns.length; k += 1) {
2525
- const A = n.columns[k], R = a[k] ?? 100;
2526
- if (!A) {
2527
- N += R;
2532
+ 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);
2533
+ let B = 0;
2534
+ for (let A = 0; A < n.columns.length; A += 1) {
2535
+ const H = n.columns[A], E = a[A] ?? 100;
2536
+ if (!H) {
2537
+ B += E;
2528
2538
  continue;
2529
2539
  }
2530
- this.activeColKey !== null && this.activeColKey === A.key && (e.fillStyle = "rgba(59,130,246,0.16)", e.fillRect(N, 0, R, this.headerHeight)), e.strokeStyle = "#d0d7de", e.strokeRect(N, 0, R, this.headerHeight), e.fillStyle = "#0f172a", e.font = `bold ${J}px ${Q}`, e.fillText(A.header ?? A.key, N + 8, this.headerHeight - 8), e.font = i;
2531
- const _ = Ie(s, A.key), O = Te(s, A.key), W = this.hoverHeaderColKey !== null && this.hoverHeaderColKey === A.key;
2532
- if (!!_ || O || W) {
2533
- const P = W ? 0.9 : O || _ ? 0.75 : 0.45, B = 16, it = N + R - B - 6, ht = Math.floor((this.headerHeight - B) / 2);
2534
- _ ? _o(e, it + 3, ht + 3, B - 6, P, _) : Fo(e, it + 2, ht + 2, B - 4, P);
2540
+ this.activeColKey !== null && this.activeColKey === H.key && (e.fillStyle = "rgba(59,130,246,0.16)", e.fillRect(B, 0, E, this.headerHeight)), e.strokeStyle = "#d0d7de", e.strokeRect(B, 0, E, this.headerHeight), e.fillStyle = "#0f172a", e.font = `bold ${Z}px ${Y}`, e.fillText(H.header ?? H.key, B + 8, this.headerHeight - 8), e.font = i;
2541
+ const _ = Ie(s, H.key), q = Te(s, H.key), j = this.hoverHeaderColKey !== null && this.hoverHeaderColKey === H.key;
2542
+ if (!!_ || q || j) {
2543
+ const $ = j ? 0.9 : q || _ ? 0.75 : 0.45, W = 16, ot = B + E - W - 6, ht = Math.floor((this.headerHeight - W) / 2);
2544
+ _ ? Vo(e, ot + 3, ht + 3, W - 6, $, _) : _o(e, ot + 2, ht + 2, W - 4, $);
2535
2545
  }
2536
- N += R;
2546
+ B += E;
2537
2547
  }
2538
2548
  if (e.restore(), this.selection.length) {
2539
2549
  e.save(), e.beginPath(), e.rect(
@@ -2542,18 +2552,18 @@ const q = class q {
2542
2552
  this.canvas.width - this.rowHeaderWidth,
2543
2553
  this.canvas.height - this.headerHeight
2544
2554
  ), e.clip(), e.strokeStyle = "#3b82f6", e.fillStyle = "rgba(59,130,246,0.12)";
2545
- for (const k of this.selection) {
2546
- const A = Math.max(0, Math.min(k.startRow, k.endRow)), R = Math.min(l.length - 1, Math.max(k.startRow, k.endRow)), U = Math.max(0, Math.min(k.startCol, k.endCol)), _ = Math.min(
2555
+ for (const A of this.selection) {
2556
+ const H = Math.max(0, Math.min(A.startRow, A.endRow)), E = Math.min(l.length - 1, Math.max(A.startRow, A.endRow)), N = Math.max(0, Math.min(A.startCol, A.endCol)), _ = Math.min(
2547
2557
  n.columns.length - 1,
2548
- Math.max(k.startCol, k.endCol)
2549
- ), O = this.headerHeight + p.fenwick.sum(A) - H, W = p.fenwick.sum(R + 1) - p.fenwick.sum(A);
2550
- let I = this.rowHeaderWidth;
2551
- for (let B = 0; B < U; B += 1)
2552
- I += a[B] ?? 100;
2553
- let P = 0;
2554
- for (let B = U; B <= _; B += 1)
2555
- P += a[B] ?? 100;
2556
- I -= b, e.fillRect(I, O, P, W), e.strokeRect(I + 0.5, O + 0.5, P - 1, W - 1);
2558
+ Math.max(A.startCol, A.endCol)
2559
+ ), q = this.headerHeight + p.fenwick.sum(H) - T, j = p.fenwick.sum(E + 1) - p.fenwick.sum(H);
2560
+ let R = this.rowHeaderWidth;
2561
+ for (let W = 0; W < N; W += 1)
2562
+ R += a[W] ?? 100;
2563
+ let $ = 0;
2564
+ for (let W = N; W <= _; W += 1)
2565
+ $ += a[W] ?? 100;
2566
+ R -= b, e.fillRect(R, q, $, j), e.strokeRect(R + 0.5, q + 0.5, $ - 1, j - 1);
2557
2567
  }
2558
2568
  e.restore();
2559
2569
  }
@@ -2563,7 +2573,7 @@ const q = class q {
2563
2573
  }
2564
2574
  }
2565
2575
  destroy() {
2566
- this.cancelRowHeightMeasurement(), this.heightIndex = null, this.canvas && (this.canvas.removeEventListener("pointermove", this.handlePointerMove), this.canvas.removeEventListener("pointerdown", this.handlePointerDown), this.canvas.removeEventListener("pointerup", this.handlePointerUp), this.canvas.removeEventListener("pointerleave", this.handlePointerLeave), this.canvas.removeEventListener("click", this.handleClick)), this.cursorTimer && (window.clearTimeout(this.cursorTimer), this.cursorTimer = null), this.pendingCursorPoint = null, $(this.canvas), $(this.spacer), $(this.overlayLayer), $(this.tooltip), this.canvas = null, this.spacer = null, this.overlayLayer = null, this.tooltip = null, this.tooltipTarget = null, this.tooltipMessage = null, this.root = null;
2576
+ this.cancelRowHeightMeasurement(), this.heightIndex = null, this.canvas && (this.canvas.removeEventListener("pointermove", this.handlePointerMove), this.canvas.removeEventListener("pointerdown", this.handlePointerDown), this.canvas.removeEventListener("pointerup", this.handlePointerUp), this.canvas.removeEventListener("pointerleave", this.handlePointerLeave), this.canvas.removeEventListener("click", this.handleClick)), this.cursorTimer && (window.clearTimeout(this.cursorTimer), this.cursorTimer = null), this.pendingCursorPoint = null, O(this.canvas), O(this.spacer), O(this.overlayLayer), O(this.tooltip), this.canvas = null, this.spacer = null, this.overlayLayer = null, this.tooltip = null, this.tooltipTarget = null, this.tooltipMessage = null, this.root = null;
2567
2577
  }
2568
2578
  ensureHeightIndex(t, e, i) {
2569
2579
  const o = this.heightIndex;
@@ -2575,8 +2585,8 @@ const q = class q {
2575
2585
  s.set(a.id, l);
2576
2586
  let r = this.rowHeight;
2577
2587
  if (i && e) {
2578
- const d = this.dataModel.getRowVersion(a.id), h = this.rowHeightMeasuredVersion.get(a.id), u = this.dataModel.getRowHeight(a.id);
2579
- h === d && typeof u == "number" && (r = u);
2588
+ const h = this.dataModel.getRowVersion(a.id), d = this.rowHeightMeasuredVersion.get(a.id), u = this.dataModel.getRowHeight(a.id);
2589
+ d === h && typeof u == "number" && (r = u);
2580
2590
  }
2581
2591
  n[l] = r;
2582
2592
  }
@@ -2585,7 +2595,7 @@ const q = class q {
2585
2595
  rowsRef: t,
2586
2596
  idToIndex: s,
2587
2597
  heights: n,
2588
- fenwick: Ot.from(n)
2598
+ fenwick: jt.from(n)
2589
2599
  };
2590
2600
  }
2591
2601
  applyRowHeightUpdates(t) {
@@ -2614,23 +2624,23 @@ const q = class q {
2614
2624
  if (!this.canvas) return;
2615
2625
  const t = this.canvas.getContext("2d");
2616
2626
  if (!t) return;
2617
- t.font = `${J}px ${Q}`;
2618
- const e = this.dataModel.getSchema(), i = this.dataModel.getView(), o = G(e, i);
2627
+ t.font = `${Z}px ${Y}`;
2628
+ const e = this.dataModel.getSchema(), i = this.dataModel.getView(), o = Q(e, i);
2619
2629
  if (!e.columns.some((u) => i.wrapText?.[u.key] ?? u.wrapText)) return;
2620
2630
  const s = this.getRowHeightCacheKey(e, i, o);
2621
2631
  this.rowHeightCacheKey !== s && (this.rowHeightCacheKey = s, this.rowHeightMeasuredVersion.clear(), this.rowHeightMeasureTask = null);
2622
2632
  const l = this.rowHeightMeasureTask ?? { key: s, nextIndex: 0 };
2623
2633
  if (l.key !== s) return;
2624
2634
  const a = this.dataModel.listRows(), r = {};
2625
- let d = 0;
2626
- const h = performance.now();
2627
- for (; l.nextIndex < a.length && d < q.ROW_HEIGHT_MEASURE_CHUNK && !(performance.now() - h > q.ROW_HEIGHT_MEASURE_TIME_BUDGET_MS); ) {
2635
+ let h = 0;
2636
+ const d = performance.now();
2637
+ for (; l.nextIndex < a.length && h < U.ROW_HEIGHT_MEASURE_CHUNK && !(performance.now() - d > U.ROW_HEIGHT_MEASURE_TIME_BUDGET_MS); ) {
2628
2638
  const u = a[l.nextIndex];
2629
2639
  if (l.nextIndex += 1, !u) continue;
2630
2640
  const p = this.dataModel.getRowVersion(u.id);
2631
2641
  if (this.rowHeightMeasuredVersion.get(u.id) === p) continue;
2632
- const g = this.measureRowHeight(t, u, e, o);
2633
- r[u.id] = g, this.rowHeightMeasuredVersion.set(u.id, p), d += 1;
2642
+ const m = this.measureRowHeight(t, u, e, o);
2643
+ r[u.id] = m, this.rowHeightMeasuredVersion.set(u.id, p), h += 1;
2634
2644
  }
2635
2645
  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();
2636
2646
  }
@@ -2639,11 +2649,11 @@ const q = class q {
2639
2649
  }
2640
2650
  hitTest(t) {
2641
2651
  if (!this.root || !this.canvas) return null;
2642
- 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, d = G(s, l), h = s.columns.some((M) => l.wrapText?.[M.key] ?? M.wrapText), u = h ? this.getRowHeightCacheKey(s, l, d) : null;
2643
- this.ensureHeightIndex(a, u, h);
2652
+ 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 = Q(s, l), d = s.columns.some((k) => l.wrapText?.[k.key] ?? k.wrapText), u = d ? this.getRowHeightCacheKey(s, l, h) : null;
2653
+ this.ensureHeightIndex(a, u, d);
2644
2654
  const p = this.heightIndex;
2645
2655
  if (!p) return null;
2646
- const g = p.fenwick.total(), v = this.canvas?.height ?? this.root.clientHeight, C = Math.max(0, v - this.headerHeight), f = Math.max(0, g - C), y = Math.max(0, Math.min(this.root.scrollTop, f));
2656
+ const m = p.fenwick.total(), C = this.canvas?.height ?? this.root.clientHeight, x = Math.max(0, C - this.headerHeight), f = Math.max(0, m - x), g = Math.max(0, Math.min(this.root.scrollTop, f));
2647
2657
  if (o < r && i < this.rowHeaderWidth)
2648
2658
  return {
2649
2659
  rowId: "__all__",
@@ -2651,65 +2661,65 @@ const q = class q {
2651
2661
  rect: new DOMRect(e.left, e.top, this.rowHeaderWidth, r)
2652
2662
  };
2653
2663
  if (o < r) {
2654
- let M = this.rowHeaderWidth, D = -1;
2655
- for (let K = 0; K < d.length; K += 1) {
2656
- const T = d[K] ?? 100;
2657
- if (n >= M && n <= M + T) {
2658
- D = K;
2664
+ let k = this.rowHeaderWidth, L = -1;
2665
+ for (let F = 0; F < h.length; F += 1) {
2666
+ const V = h[F] ?? 100;
2667
+ if (n >= k && n <= k + V) {
2668
+ L = F;
2659
2669
  break;
2660
2670
  }
2661
- M += T;
2671
+ k += V;
2662
2672
  }
2663
- if (D >= 0) {
2664
- const K = s.columns[D], T = new DOMRect(
2665
- e.left + M - this.root.scrollLeft,
2673
+ if (L >= 0) {
2674
+ const F = s.columns[L], V = new DOMRect(
2675
+ e.left + k - this.root.scrollLeft,
2666
2676
  e.top,
2667
- d[D] ?? 100,
2677
+ h[L] ?? 100,
2668
2678
  r
2669
2679
  );
2670
- return { rowId: "__header__", colKey: K.key, rect: T };
2680
+ return { rowId: "__header__", colKey: F.key, rect: V };
2671
2681
  }
2672
2682
  return null;
2673
2683
  }
2674
2684
  if (i < this.rowHeaderWidth) {
2675
- const M = o - r + y, D = Math.max(
2685
+ const k = o - r + g, L = Math.max(
2676
2686
  0,
2677
- Math.min(a.length - 1, p.fenwick.lowerBound(M + 1))
2678
- ), K = p.fenwick.sum(D);
2679
- if (D < 0 || D >= a.length) return null;
2680
- const T = a[D], F = e.top + r + K - y, N = new DOMRect(
2687
+ Math.min(a.length - 1, p.fenwick.lowerBound(k + 1))
2688
+ ), F = p.fenwick.sum(L);
2689
+ if (L < 0 || L >= a.length) return null;
2690
+ const V = a[L], M = e.top + r + F - g, B = new DOMRect(
2681
2691
  e.left,
2682
- F,
2692
+ M,
2683
2693
  this.rowHeaderWidth,
2684
- p.heights[D] ?? this.rowHeight
2694
+ p.heights[L] ?? this.rowHeight
2685
2695
  );
2686
- return { rowId: T.id, colKey: null, rect: N };
2696
+ return { rowId: V.id, colKey: null, rect: B };
2687
2697
  }
2688
- const m = o - r + y, w = Math.max(0, Math.min(a.length - 1, p.fenwick.lowerBound(m + 1))), b = p.fenwick.sum(w);
2698
+ const y = o - r + g, w = Math.max(0, Math.min(a.length - 1, p.fenwick.lowerBound(y + 1))), b = p.fenwick.sum(w);
2689
2699
  if (w < 0 || w >= a.length) return null;
2690
- let S = this.rowHeaderWidth, x = -1;
2691
- for (let M = 0; M < d.length; M += 1) {
2692
- const D = d[M] ?? 100;
2693
- if (n >= S && n <= S + D) {
2694
- x = M;
2700
+ let S = this.rowHeaderWidth, v = -1;
2701
+ for (let k = 0; k < h.length; k += 1) {
2702
+ const L = h[k] ?? 100;
2703
+ if (n >= S && n <= S + L) {
2704
+ v = k;
2695
2705
  break;
2696
2706
  }
2697
- S += D;
2707
+ S += L;
2698
2708
  }
2699
- if (x === -1) return null;
2700
- const E = a[w], V = s.columns[x], L = b, H = new DOMRect(
2709
+ if (v === -1) return null;
2710
+ const I = a[w], D = s.columns[v], K = b, T = new DOMRect(
2701
2711
  e.left + S - this.root.scrollLeft,
2702
- e.top + r + L - this.root.scrollTop,
2703
- d[x] ?? 100,
2712
+ e.top + r + K - this.root.scrollTop,
2713
+ h[v] ?? 100,
2704
2714
  p.heights[w] ?? this.rowHeight
2705
2715
  );
2706
- return { rowId: E.id, colKey: V.key, rect: H };
2716
+ return { rowId: I.id, colKey: D.key, rect: T };
2707
2717
  }
2708
2718
  hitTestAction(t) {
2709
2719
  if (!this.root || !this.canvas) return null;
2710
2720
  const e = this.hitTest(t);
2711
2721
  if (!e || !e.rowId || !e.colKey || e.rowId === "__all__" || e.rowId === "__header__") return null;
2712
- const o = this.dataModel.getSchema().columns.find((D) => String(D.key) === String(e.colKey));
2722
+ const o = this.dataModel.getSchema().columns.find((L) => String(L.key) === String(e.colKey));
2713
2723
  if (!o || o.type !== "button" && o.type !== "link") return null;
2714
2724
  const n = this.dataModel.resolveCellValue(e.rowId, o), s = this.dataModel.resolveConditionalStyle(e.rowId, o);
2715
2725
  if (n.textOverride ?? (s.forceErrorText ? "#ERROR" : void 0)) return null;
@@ -2717,24 +2727,24 @@ const q = class q {
2717
2727
  if (!a || !a.label) return null;
2718
2728
  const r = this.canvas.getContext("2d");
2719
2729
  if (!r) return null;
2720
- const d = Ft(o), h = s.delta ? lt(d, s.delta) : d, u = this.dataModel.getCellStyle(e.rowId, o.key), p = u ? lt(h, u) : h, g = p.bold ? "600 " : "", v = p.italic ? "italic " : "";
2721
- r.save(), r.font = `${v}${g}${J}px ${Q}`.trim(), r.textBaseline = "alphabetic";
2722
- const f = this.dataModel.getView().wrapText?.[o.key] ?? o.wrapText ?? !1, y = o.style?.align ?? "left", m = e.rect.left + ut, w = e.rect.top + rt, b = Math.max(0, e.rect.width - ut * 2), S = Math.max(
2730
+ const h = _t(o), d = s.delta ? lt(h, s.delta) : h, u = this.dataModel.getCellStyle(e.rowId, o.key), p = u ? lt(d, u) : d, m = p.bold ? "600 " : "", C = p.italic ? "italic " : "";
2731
+ r.save(), r.font = `${C}${m}${Z}px ${Y}`.trim(), r.textBaseline = "alphabetic";
2732
+ const f = this.dataModel.getView().wrapText?.[o.key] ?? o.wrapText ?? !1, g = o.style?.align ?? "left", y = e.rect.left + ut, w = e.rect.top + rt, b = Math.max(0, e.rect.width - ut * 2), S = Math.max(
2723
2733
  0,
2724
2734
  e.rect.height - (rt + Mt)
2725
- ), x = this.measureTextBounds(
2735
+ ), v = this.measureTextBounds(
2726
2736
  r,
2727
2737
  a.label,
2728
- m,
2738
+ y,
2729
2739
  w,
2730
2740
  b,
2731
2741
  S,
2732
2742
  f,
2733
- y
2743
+ g
2734
2744
  );
2735
- if (r.restore(), !x) return null;
2736
- const E = o.type === "button" ? 6 : 2, V = Math.max(e.rect.left, x.x - E), L = Math.max(e.rect.top, x.y - E), H = Math.min(e.rect.right, x.x + x.width + E), M = Math.min(e.rect.bottom, x.y + x.height + E);
2737
- return t.clientX >= V && t.clientX <= H && t.clientY >= L && t.clientY <= M ? { rowId: e.rowId, colKey: String(e.colKey), kind: o.type } : null;
2745
+ if (r.restore(), !v) return null;
2746
+ const I = o.type === "button" ? 6 : 2, D = Math.max(e.rect.left, v.x - I), K = Math.max(e.rect.top, v.y - I), T = Math.min(e.rect.right, v.x + v.width + I), k = Math.min(e.rect.bottom, v.y + v.height + I);
2747
+ return t.clientX >= D && t.clientX <= T && t.clientY >= K && t.clientY <= k ? { rowId: e.rowId, colKey: String(e.colKey), kind: o.type } : null;
2738
2748
  }
2739
2749
  isPointInSelection(t, e) {
2740
2750
  if (!this.selection.length) return !1;
@@ -2742,8 +2752,8 @@ const q = class q {
2742
2752
  if (o < 0 || n < 0) return !1;
2743
2753
  for (const s of this.selection) {
2744
2754
  if (s.kind !== "cells") continue;
2745
- const l = Math.min(s.startRow, s.endRow), a = Math.max(s.startRow, s.endRow), r = Math.min(s.startCol, s.endCol), d = Math.max(s.startCol, s.endCol);
2746
- if (o >= l && o <= a && n >= r && n <= d)
2755
+ const l = Math.min(s.startRow, s.endRow), a = Math.max(s.startRow, s.endRow), r = Math.min(s.startCol, s.endCol), h = Math.max(s.startCol, s.endCol);
2756
+ if (o >= l && o <= a && n >= r && n <= h)
2747
2757
  return !0;
2748
2758
  }
2749
2759
  return !1;
@@ -2766,18 +2776,18 @@ const q = class q {
2766
2776
  }
2767
2777
  getCellRect(t, e) {
2768
2778
  if (!this.root || !this.canvas) return null;
2769
- 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((v) => v.key === e);
2779
+ 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((C) => C.key === e);
2770
2780
  if (l < 0 || a < 0) return null;
2771
- const r = G(o, n), d = o.columns.some((v) => n.wrapText?.[v.key] ?? v.wrapText), h = d ? this.getRowHeightCacheKey(o, n, r) : null;
2772
- this.ensureHeightIndex(s, h, d);
2781
+ const r = Q(o, n), h = o.columns.some((C) => n.wrapText?.[C.key] ?? C.wrapText), d = h ? this.getRowHeightCacheKey(o, n, r) : null;
2782
+ this.ensureHeightIndex(s, d, h);
2773
2783
  const u = this.heightIndex;
2774
2784
  if (!u) return null;
2775
2785
  const p = u.fenwick.sum(l);
2776
- let g = this.rowHeaderWidth;
2777
- for (let v = 0; v < a; v += 1)
2778
- g += r[v] ?? 100;
2786
+ let m = this.rowHeaderWidth;
2787
+ for (let C = 0; C < a; C += 1)
2788
+ m += r[C] ?? 100;
2779
2789
  return new DOMRect(
2780
- i.left + g - this.root.scrollLeft,
2790
+ i.left + m - this.root.scrollLeft,
2781
2791
  i.top + this.headerHeight + p - this.root.scrollTop,
2782
2792
  r[a] ?? 100,
2783
2793
  u.heights[l] ?? this.rowHeight
@@ -2790,29 +2800,29 @@ const q = class q {
2790
2800
  return;
2791
2801
  }
2792
2802
  {
2793
- const h = this.canvas.getBoundingClientRect(), u = t - h.left, p = e - h.top, g = u + this.root.scrollLeft, v = p, C = this.hoverHeaderColKey, f = this.hoverHeaderIcon;
2794
- let y = null, m = !1;
2795
- if (v >= 0 && v < this.headerHeight && g >= this.rowHeaderWidth) {
2796
- const b = this.dataModel.getSchema(), S = this.dataModel.getView(), x = G(b, S);
2797
- let E = this.rowHeaderWidth, V = -1;
2798
- for (let H = 0; H < x.length; H += 1) {
2799
- const M = x[H] ?? 100;
2800
- if (g >= E && g <= E + M) {
2801
- V = H;
2803
+ const d = this.canvas.getBoundingClientRect(), u = t - d.left, p = e - d.top, m = u + this.root.scrollLeft, C = p, x = this.hoverHeaderColKey, f = this.hoverHeaderIcon;
2804
+ let g = null, y = !1;
2805
+ if (C >= 0 && C < this.headerHeight && m >= this.rowHeaderWidth) {
2806
+ const b = this.dataModel.getSchema(), S = this.dataModel.getView(), v = Q(b, S);
2807
+ let I = this.rowHeaderWidth, D = -1;
2808
+ for (let T = 0; T < v.length; T += 1) {
2809
+ const k = v[T] ?? 100;
2810
+ if (m >= I && m <= I + k) {
2811
+ D = T;
2802
2812
  break;
2803
2813
  }
2804
- E += M;
2814
+ I += k;
2805
2815
  }
2806
- const L = V >= 0 ? b.columns[V] : null;
2807
- if (L) {
2808
- y = L.key;
2809
- const H = x[V] ?? 100, M = 18, K = E + H - M - 4, T = Math.floor((this.headerHeight - M) / 2);
2810
- m = g >= K && g <= K + M && v >= T && v <= T + M;
2816
+ const K = D >= 0 ? b.columns[D] : null;
2817
+ if (K) {
2818
+ g = K.key;
2819
+ const T = v[D] ?? 100, k = 18, F = I + T - k - 4, V = Math.floor((this.headerHeight - k) / 2);
2820
+ y = m >= F && m <= F + k && C >= V && C <= V + k;
2811
2821
  }
2812
2822
  }
2813
- const w = String(C ?? "") !== String(y ?? "") || !!f != !!m;
2814
- if (this.hoverHeaderColKey = y, this.hoverHeaderIcon = m, y !== null) {
2815
- this.canvas.style.cursor = m ? "pointer" : "default", this.tooltip && (this.tooltip.dataset.visible = "0"), this.tooltipTarget = null, this.tooltipMessage = null, w && this.render();
2823
+ const w = String(x ?? "") !== String(g ?? "") || !!f != !!y;
2824
+ if (this.hoverHeaderColKey = g, this.hoverHeaderIcon = y, g !== null) {
2825
+ this.canvas.style.cursor = y ? "pointer" : "default", this.tooltip && (this.tooltip.dataset.visible = "0"), this.tooltipTarget = null, this.tooltipMessage = null, w && this.render();
2816
2826
  return;
2817
2827
  }
2818
2828
  w && this.render();
@@ -2833,8 +2843,8 @@ const q = class q {
2833
2843
  }
2834
2844
  const n = this.dataModel.getCellMarker(o.rowId, o.colKey);
2835
2845
  if (this.tooltip && n) {
2836
- const h = this.tooltipTarget && this.tooltipTarget.rowId === o.rowId && this.tooltipTarget.colKey === o.colKey, u = this.tooltipMessage === n.message;
2837
- if (!h || !u || this.tooltip.dataset.visible !== "1") {
2846
+ const d = this.tooltipTarget && this.tooltipTarget.rowId === o.rowId && this.tooltipTarget.colKey === o.colKey, u = this.tooltipMessage === n.message;
2847
+ if (!d || !u || this.tooltip.dataset.visible !== "1") {
2838
2848
  this.tooltipTarget = { rowId: o.rowId, colKey: o.colKey }, this.tooltipMessage = n.message, this.tooltip.textContent = n.message;
2839
2849
  const p = this.getCellRect(o.rowId, o.colKey);
2840
2850
  p ? (this.positionTooltipAtRect(p), this.tooltip.dataset.visible = "1") : this.tooltip.dataset.visible = "0";
@@ -2860,16 +2870,16 @@ const q = class q {
2860
2870
  this.activeColKey,
2861
2871
  this.getEditMode()
2862
2872
  )) {
2863
- const h = this.getCellRect(this.activeRowId, this.activeColKey);
2864
- if (h) {
2865
- const u = ke(h, Me);
2873
+ const d = this.getCellRect(this.activeRowId, this.activeColKey);
2874
+ if (d) {
2875
+ const u = ke(d, Me);
2866
2876
  if (Re(t, e, u)) {
2867
2877
  this.canvas.style.cursor = "crosshair";
2868
2878
  return;
2869
2879
  }
2870
2880
  }
2871
2881
  }
2872
- const r = this.dataModel.getSchema().columns.find((h) => h.key === o.colKey);
2882
+ const r = this.dataModel.getSchema().columns.find((d) => d.key === o.colKey);
2873
2883
  this.dataModel.getCellInteraction(o.rowId, o.colKey).readonly || r?.type === "boolean" ? i = "default" : i = "text", this.canvas.style.cursor = i;
2874
2884
  }
2875
2885
  measureRowHeight(t, e, i, o) {
@@ -2878,8 +2888,8 @@ const q = class q {
2878
2888
  for (let l = 0; l < i.columns.length; l += 1) {
2879
2889
  const a = i.columns[l];
2880
2890
  if (!a || !(s.wrapText?.[a.key] ?? a.wrapText)) continue;
2881
- const d = (o[l] ?? 100) - this.padding, h = this.dataModel.resolveCellValue(e.id, a), u = this.dataModel.resolveConditionalStyle(e.id, a), g = h.textOverride ?? (u.forceErrorText ? "#ERROR" : void 0) ? "#ERROR" : this.formatValue(h.value, a).text, C = this.wrapLines(t, g, d).length * this.lineHeight + this.padding;
2882
- n = Math.max(n, C);
2891
+ 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;
2892
+ n = Math.max(n, x);
2883
2893
  }
2884
2894
  return n;
2885
2895
  }
@@ -2892,14 +2902,14 @@ const q = class q {
2892
2902
  for (const a of s) {
2893
2903
  let r = a;
2894
2904
  for (; t.measureText(r).width > i && r.length > 1; ) {
2895
- let d = r.length;
2896
- for (; d > 1 && t.measureText(r.slice(0, d)).width > i; )
2897
- d -= 1;
2898
- l.push(r.slice(0, d)), r = r.slice(d);
2905
+ let h = r.length;
2906
+ for (; h > 1 && t.measureText(r.slice(0, h)).width > i; )
2907
+ h -= 1;
2908
+ l.push(r.slice(0, h)), r = r.slice(h);
2899
2909
  }
2900
2910
  l.push(r);
2901
2911
  }
2902
- for (this.textMeasureCache.set(o, { lines: l }); this.textMeasureCache.size > q.TEXT_MEASURE_CACHE_MAX; ) {
2912
+ for (this.textMeasureCache.set(o, { lines: l }); this.textMeasureCache.size > U.TEXT_MEASURE_CACHE_MAX; ) {
2903
2913
  const a = this.textMeasureCache.keys().next().value;
2904
2914
  if (!a) break;
2905
2915
  this.textMeasureCache.delete(a);
@@ -2919,47 +2929,47 @@ const q = class q {
2919
2929
  measureTextBounds(t, e, i, o, n, s, l, a) {
2920
2930
  const r = this.getTextLinesForBounds(t, e, n, l, s);
2921
2931
  if (!r.length) return null;
2922
- let d = Number.POSITIVE_INFINITY, h = Number.NEGATIVE_INFINITY, u = Number.POSITIVE_INFINITY, p = Number.NEGATIVE_INFINITY;
2923
- for (let g = 0; g < r.length; g += 1) {
2924
- const v = r[g] ?? "", C = t.measureText(v).width;
2932
+ let h = Number.POSITIVE_INFINITY, d = Number.NEGATIVE_INFINITY, u = Number.POSITIVE_INFINITY, p = Number.NEGATIVE_INFINITY;
2933
+ for (let m = 0; m < r.length; m += 1) {
2934
+ const C = r[m] ?? "", x = t.measureText(C).width;
2925
2935
  let f = i;
2926
- a === "right" ? f = i + n - C : a === "center" && (f = i + (n - C) / 2);
2927
- const y = o + this.lineHeight * g, m = y + this.lineHeight;
2928
- d = Math.min(d, f), h = Math.max(h, f + C), u = Math.min(u, y), p = Math.max(p, m);
2936
+ a === "right" ? f = i + n - x : a === "center" && (f = i + (n - x) / 2);
2937
+ const g = o + this.lineHeight * m, y = g + this.lineHeight;
2938
+ h = Math.min(h, f), d = Math.max(d, f + x), u = Math.min(u, g), p = Math.max(p, y);
2929
2939
  }
2930
- return !Number.isFinite(d) || !Number.isFinite(u) ? null : new DOMRect(d, u, h - d, p - u);
2940
+ return !Number.isFinite(h) || !Number.isFinite(u) ? null : new DOMRect(h, u, d - h, p - u);
2931
2941
  }
2932
- drawCellText(t, e, i, o, n, s, l, a = "left", r = !1, d = !1, h) {
2942
+ drawCellText(t, e, i, o, n, s, l, a = "left", r = !1, h = !1, d = !1, u) {
2933
2943
  t.save(), t.beginPath(), t.rect(i - 4, o - 4, n + 8, s + 8), t.clip();
2934
- const u = t.font;
2935
- r ? t.font = "28px sans-serif" : d && (t.font = `${J}px ${Q}`);
2936
- const p = this.getTextLinesForBounds(t, e, n, l, s), g = p.length * this.lineHeight, v = o + Math.max(0, Math.floor((s - g) / 2)), C = (f, y) => {
2937
- const m = v + this.lineHeight * y;
2938
- let w = i, b = i;
2944
+ const p = t.font;
2945
+ r ? d ? t.font = `${Lo}px ${Y}` : t.font = "28px sans-serif" : h && (t.font = `${Z}px ${Y}`);
2946
+ const m = this.getTextLinesForBounds(t, e, n, l, s), C = m.length * this.lineHeight, x = o + Math.max(0, Math.floor((s - C) / 2)), f = (g, y) => {
2947
+ const w = x + this.lineHeight * y;
2948
+ let b = i, S = i;
2939
2949
  if (a === "right")
2940
- t.textAlign = "right", b = i + n, w = b - t.measureText(f).width, t.fillText(f, b, m);
2950
+ t.textAlign = "right", S = i + n, b = S - t.measureText(g).width, t.fillText(g, S, w);
2941
2951
  else if (a === "center") {
2942
2952
  t.textAlign = "center";
2943
- const S = i + n / 2, x = t.measureText(f).width;
2944
- w = S - x / 2, b = S + x / 2, t.fillText(f, S, m);
2953
+ const v = i + n / 2, I = t.measureText(g).width;
2954
+ b = v - I / 2, S = v + I / 2, t.fillText(g, v, w);
2945
2955
  } else
2946
- t.textAlign = "left", w = i, b = i + t.measureText(f).width, t.fillText(f, i, m);
2947
- if (h?.underline || h?.strike) {
2948
- const S = t.strokeStyle, x = t.lineWidth;
2949
- if (t.strokeStyle = t.fillStyle, t.lineWidth = 1, t.beginPath(), h.underline) {
2950
- const E = m + 2;
2951
- t.moveTo(w, E), t.lineTo(b, E);
2956
+ t.textAlign = "left", b = i, S = i + t.measureText(g).width, t.fillText(g, i, w);
2957
+ if (u?.underline || u?.strike) {
2958
+ const v = t.strokeStyle, I = t.lineWidth;
2959
+ if (t.strokeStyle = t.fillStyle, t.lineWidth = 1, t.beginPath(), u.underline) {
2960
+ const D = w + 2;
2961
+ t.moveTo(b, D), t.lineTo(S, D);
2952
2962
  }
2953
- if (h.strike) {
2954
- const E = m - Math.floor(this.lineHeight / 2) + 2;
2955
- t.moveTo(w, E), t.lineTo(b, E);
2963
+ if (u.strike) {
2964
+ const D = w - Math.floor(this.lineHeight / 2) + 2;
2965
+ t.moveTo(b, D), t.lineTo(S, D);
2956
2966
  }
2957
- t.stroke(), t.strokeStyle = S, t.lineWidth = x;
2967
+ t.stroke(), t.strokeStyle = v, t.lineWidth = I;
2958
2968
  }
2959
2969
  };
2960
- for (let f = 0; f < p.length; f += 1)
2961
- C(p[f] ?? "", f + 1);
2962
- t.textAlign = "left", t.font = u, t.restore();
2970
+ for (let g = 0; g < m.length; g += 1)
2971
+ f(m[g] ?? "", g + 1);
2972
+ t.textAlign = "left", t.font = p, t.restore();
2963
2973
  }
2964
2974
  formatValue(t, e) {
2965
2975
  if (t == null) return { text: "" };
@@ -2975,7 +2985,7 @@ const q = class q {
2975
2985
  if (e.type === "link")
2976
2986
  return { text: ct(t) || String(t) };
2977
2987
  if (e.type === "tags") {
2978
- const i = Bt(t);
2988
+ const i = $t(t);
2979
2989
  if (i) return { text: i.join(", ") };
2980
2990
  }
2981
2991
  if (e.type === "boolean")
@@ -2983,8 +2993,8 @@ const q = class q {
2983
2993
  if (e.type === "number" && typeof t == "number") {
2984
2994
  const i = t, o = e.format;
2985
2995
  if ((o?.format ?? "decimal") === "scientific") {
2986
- const r = kt(i, { format: "scientific", precision: o?.precision }), d = o?.negativeRed && i < 0 ? "#b91c1c" : void 0;
2987
- return { text: r, color: d };
2996
+ const r = kt(i, { format: "scientific", precision: o?.precision }), h = o?.negativeRed && i < 0 ? "#b91c1c" : void 0;
2997
+ return { text: r, color: h };
2988
2998
  }
2989
2999
  const s = {};
2990
3000
  o?.scale !== void 0 && (s.minimumFractionDigits = o.scale, s.maximumFractionDigits = o.scale), s.useGrouping = !!o?.thousandSeparator;
@@ -2994,8 +3004,8 @@ const q = class q {
2994
3004
  if ((e.type === "int" || e.type === "uint") && typeof t == "number") {
2995
3005
  const i = t, o = e.format, n = o?.format ?? "decimal";
2996
3006
  if (n === "binary" || n === "octal" || n === "hex") {
2997
- const r = $t(i, n), d = o?.negativeRed && i < 0 ? "#b91c1c" : void 0;
2998
- return { text: r, color: d };
3007
+ const r = Wt(i, n), h = o?.negativeRed && i < 0 ? "#b91c1c" : void 0;
3008
+ return { text: r, color: h };
2999
3009
  }
3000
3010
  const s = {
3001
3011
  minimumFractionDigits: 0,
@@ -3012,11 +3022,11 @@ const q = class q {
3012
3022
  return { text: String(t) };
3013
3023
  }
3014
3024
  };
3015
- q.MAX_CANVAS_DIM_PX = 8192, q.ROW_HEIGHT_MEASURE_CHUNK = 500, q.ROW_HEIGHT_MEASURE_TIME_BUDGET_MS = 8, q.TEXT_MEASURE_CACHE_MAX = 2e3;
3016
- let It = q;
3017
- class Vo {
3018
- constructor(t, e, i, o, n, s, l, a, r, d, h, u, p, g, v, C) {
3019
- this.dataModel = a, this.onActiveChange = u, this.onSelectionChange = g, this.onUndo = v, this.onRedo = C, 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.rootCursorBackup = 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 = () => {
3025
+ 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;
3026
+ let It = U;
3027
+ class No {
3028
+ constructor(t, e, i, o, n, s, l, a, r, h, d, u, p, m, C, x) {
3029
+ this.dataModel = a, this.onActiveChange = u, this.onSelectionChange = m, this.onUndo = C, this.onRedo = x, 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.rootCursorBackup = 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 = () => {
3020
3030
  this.composing = !0;
3021
3031
  }, this.handleInputCompositionEnd = () => {
3022
3032
  this.composing = !1, this.lastCompositionEnd = Date.now();
@@ -3030,24 +3040,24 @@ class Vo {
3030
3040
  this.hideHoverTooltip();
3031
3041
  }, this.handlePointerDown = (f) => {
3032
3042
  if (f.button !== 0) return;
3033
- const y = f.target;
3034
- 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;
3035
- const m = this.hitTest(f);
3036
- if (!m || m.rowId === "__all__" && m.colKey === "__all__" || m.colKey === "__all__") return;
3037
- const w = be(this.dataModel, this.selectionRanges);
3043
+ const g = f.target;
3044
+ if (g?.closest('button[data-extable-fs-open="1"]') || g?.closest(".extable-filter-sort-trigger") || g?.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;
3045
+ const y = this.hitTest(f);
3046
+ if (!y || y.rowId === "__all__" && y.colKey === "__all__" || y.colKey === "__all__") return;
3047
+ const w = xe(this.dataModel, this.selectionRanges);
3038
3048
  if (w && this.activeCell) {
3039
- const L = this.dataModel.getSchema(), H = this.dataModel.listRows(), M = w.endRowIndex, D = w.colIndex, K = H[M], T = L.columns[D];
3040
- if (K && T) {
3041
- const F = this.findHtmlCellElement(K.id, T.key)?.getBoundingClientRect() ?? this.computeCanvasCellRect(K.id, T.key);
3042
- if (F && Rt(
3049
+ const K = this.dataModel.getSchema(), T = this.dataModel.listRows(), k = w.endRowIndex, L = w.colIndex, F = T[k], V = K.columns[L];
3050
+ if (F && V) {
3051
+ const M = this.findHtmlCellElement(F.id, V.key)?.getBoundingClientRect() ?? this.computeCanvasCellRect(F.id, V.key);
3052
+ if (M && Rt(
3043
3053
  this.dataModel,
3044
3054
  this.selectionRanges,
3045
3055
  this.activeCell.rowId,
3046
3056
  this.activeCell.colKey,
3047
3057
  this.editMode
3048
3058
  )) {
3049
- const N = ke(F, Me);
3050
- if (Re(f.clientX, f.clientY, N)) {
3059
+ const B = ke(M, Me);
3060
+ if (Re(f.clientX, f.clientY, B)) {
3051
3061
  f.preventDefault(), this.fillDragging = !0, this.fillSource = w, this.fillEndRowIndex = w.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;
3052
3062
  try {
3053
3063
  f.target?.setPointerCapture?.(f.pointerId);
@@ -3067,25 +3077,25 @@ class Vo {
3067
3077
  }
3068
3078
  }
3069
3079
  }
3070
- const b = this.dataModel.getSchema(), S = this.dataModel.listRows(), x = m.rowId === "__header__" ? 0 : this.dataModel.getRowIndex(m.rowId), E = b.columns.findIndex((L) => String(L.key) === String(m.colKey));
3071
- if (E < 0) return;
3072
- if (m.rowId === "__header__") {
3080
+ const b = this.dataModel.getSchema(), S = this.dataModel.listRows(), v = y.rowId === "__header__" ? 0 : this.dataModel.getRowIndex(y.rowId), I = b.columns.findIndex((K) => String(K.key) === String(y.colKey));
3081
+ if (I < 0) return;
3082
+ if (y.rowId === "__header__") {
3073
3083
  if (!S.length) return;
3074
- const L = {
3084
+ const K = {
3075
3085
  kind: "cells",
3076
3086
  startRow: 0,
3077
3087
  endRow: S.length - 1,
3078
- startCol: E,
3079
- endCol: E
3088
+ startCol: I,
3089
+ endCol: I
3080
3090
  };
3081
- this.selectionRanges = [L], this.onSelectionChange(this.selectionRanges), this.dragging = !1, this.selectionMode = !0, this.dragStart = null, this.selectionAnchor = null, this.suppressNextClick = !1;
3082
- const H = S[0], M = b.columns[E];
3083
- H && M && (this.activeCell = { rowId: H.id, colKey: M.key }, this.onActiveChange(H.id, M.key)), this.focusSelectionInput("");
3091
+ this.selectionRanges = [K], this.onSelectionChange(this.selectionRanges), this.dragging = !1, this.selectionMode = !0, this.dragStart = null, this.selectionAnchor = null, this.suppressNextClick = !1;
3092
+ const T = S[0], k = b.columns[I];
3093
+ T && k && (this.activeCell = { rowId: T.id, colKey: k.key }, this.onActiveChange(T.id, k.key)), this.focusSelectionInput("");
3084
3094
  return;
3085
3095
  }
3086
- if (x < 0) return;
3087
- const V = m.colKey === null ? "rows" : "cells";
3088
- this.dragging = !0, this.pointerDownClient = { x: f.clientX, y: f.clientY }, this.dragMoved = !1, this.dragSelectionChanged = !1, this.dragStart = { rowIndex: x, colIndex: E, kind: V }, this.suppressNextClick = !1, this.selectionMode = !0, this.selectionAnchor = null, this.lastCommittedLookupCell = null, this.lastPointerClient = { x: f.clientX, y: f.clientY };
3096
+ if (v < 0) return;
3097
+ const D = y.colKey === null ? "rows" : "cells";
3098
+ this.dragging = !0, this.pointerDownClient = { x: f.clientX, y: f.clientY }, this.dragMoved = !1, this.dragSelectionChanged = !1, this.dragStart = { rowIndex: v, colIndex: I, kind: D }, this.suppressNextClick = !1, this.selectionMode = !0, this.selectionAnchor = null, this.lastCommittedLookupCell = null, this.lastPointerClient = { x: f.clientX, y: f.clientY };
3089
3099
  try {
3090
3100
  f.target?.setPointerCapture?.(f.pointerId);
3091
3101
  } catch {
@@ -3101,54 +3111,54 @@ class Vo {
3101
3111
  return;
3102
3112
  }
3103
3113
  if (!this.dragMoved && this.pointerDownClient) {
3104
- const y = f.clientX - this.pointerDownClient.x, m = f.clientY - this.pointerDownClient.y;
3105
- if (y * y + m * m < 9) return;
3114
+ const g = f.clientX - this.pointerDownClient.x, y = f.clientY - this.pointerDownClient.y;
3115
+ if (g * g + y * y < 9) return;
3106
3116
  this.dragMoved = !0;
3107
3117
  }
3108
3118
  this.updateDragFromClientPoint(f.clientX, f.clientY);
3109
3119
  }, this.handlePointerUp = (f) => {
3110
3120
  if (this.fillDragging && this.fillSource) {
3111
- const m = this.fillSource, w = this.fillEndRowIndex ?? m.endRowIndex;
3121
+ const y = this.fillSource, w = this.fillEndRowIndex ?? y.endRowIndex;
3112
3122
  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();
3113
3123
  try {
3114
3124
  f.target?.releasePointerCapture?.(f.pointerId);
3115
3125
  } catch {
3116
3126
  }
3117
- this.commitFill(m, w), this.suppressNextClick = !0;
3127
+ this.commitFill(y, w), this.suppressNextClick = !0;
3118
3128
  return;
3119
3129
  }
3120
3130
  if (!this.dragging) return;
3121
3131
  this.dragging = !1, this.dragStart = null;
3122
- const y = this.dragSelectionChanged;
3132
+ const g = this.dragSelectionChanged;
3123
3133
  this.pointerDownClient = null, this.dragMoved = !1, this.dragSelectionChanged = !1, this.stopAutoScroll();
3124
3134
  try {
3125
3135
  f.target?.releasePointerCapture?.(f.pointerId);
3126
3136
  } catch {
3127
3137
  }
3128
- if (y && (this.suppressNextClick = !0), this.suppressNextClick && this.activeCell && this.activeCell.colKey !== null) {
3129
- const m = this.dataModel.getCell(this.activeCell.rowId, this.activeCell.colKey);
3130
- this.focusSelectionInput(this.cellToClipboardString(m));
3138
+ if (g && (this.suppressNextClick = !0), this.suppressNextClick && this.activeCell && this.activeCell.colKey !== null) {
3139
+ const y = this.dataModel.getCell(this.activeCell.rowId, this.activeCell.colKey);
3140
+ this.focusSelectionInput(this.cellToClipboardString(y));
3131
3141
  }
3132
3142
  }, this.handleSelectionCopy = (f) => {
3133
3143
  if (!this.selectionMode) return;
3134
- const y = this.buildSelectionClipboardPayload();
3135
- 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"));
3144
+ const g = this.buildSelectionClipboardPayload();
3145
+ g && (f.preventDefault(), f.clipboardData?.setData("text/plain", g.text), f.clipboardData?.setData("text/tab-separated-values", g.text), f.clipboardData?.setData("text/html", g.html), this.showCopyToast(`Copied ${g.cellCount} cells`, "info"));
3136
3146
  }, this.handleSelectionCut = (f) => {
3137
3147
  if (!this.selectionMode) return;
3138
- const y = this.buildSelectionClipboardPayload();
3139
- 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());
3148
+ const g = this.buildSelectionClipboardPayload();
3149
+ g && (f.preventDefault(), f.clipboardData?.setData("text/plain", g.text), f.clipboardData?.setData("text/tab-separated-values", g.text), f.clipboardData?.setData("text/html", g.html), this.clearSelectionValues());
3140
3150
  }, this.handleSelectionPaste = (f) => {
3141
3151
  if (!this.selectionMode) return;
3142
3152
  f.preventDefault();
3143
- const y = f.clipboardData?.getData("text/html") ?? "", m = f.clipboardData?.getData("text/tab-separated-values") ?? "", w = f.clipboardData?.getData("text/plain") ?? "", b = this.parseClipboardGrid({ html: y, tsv: m, text: w });
3153
+ const g = f.clipboardData?.getData("text/html") ?? "", y = f.clipboardData?.getData("text/tab-separated-values") ?? "", w = f.clipboardData?.getData("text/plain") ?? "", b = this.parseClipboardGrid({ html: g, tsv: y, text: w });
3144
3154
  b && this.applyClipboardGrid(b);
3145
3155
  }, this.handleSelectionCompositionStart = (f) => {
3146
3156
  if (!this.selectionMode) return;
3147
- const y = this.activeCell;
3148
- if (!(!y || y.colKey === null)) {
3149
- if (this.isCellReadonly(y.rowId, y.colKey)) {
3157
+ const g = this.activeCell;
3158
+ if (!(!g || g.colKey === null)) {
3159
+ if (this.isCellReadonly(g.rowId, g.colKey)) {
3150
3160
  f?.preventDefault?.(), f?.stopPropagation?.();
3151
- const m = this.dataModel.getCell(y.rowId, y.colKey), w = this.cellToClipboardString(m);
3161
+ const y = this.dataModel.getCell(g.rowId, g.colKey), w = this.cellToClipboardString(y);
3152
3162
  this.teardownSelectionInput(), this.focusSelectionInput(w);
3153
3163
  return;
3154
3164
  }
@@ -3156,11 +3166,11 @@ class Vo {
3156
3166
  }
3157
3167
  }, this.handleSelectionBeforeInput = (f) => {
3158
3168
  if (!this.selectionMode) return;
3159
- const y = this.activeCell;
3160
- if (!(!y || y.colKey === null) && this.isCellReadonly(y.rowId, y.colKey)) {
3169
+ const g = this.activeCell;
3170
+ if (!(!g || g.colKey === null) && this.isCellReadonly(g.rowId, g.colKey)) {
3161
3171
  f.preventDefault();
3162
3172
  try {
3163
- const m = this.dataModel.getCell(y.rowId, y.colKey), w = this.cellToClipboardString(m), b = this.ensureSelectionInput();
3173
+ const y = this.dataModel.getCell(g.rowId, g.colKey), w = this.cellToClipboardString(y), b = this.ensureSelectionInput();
3164
3174
  b.value = w, b.select();
3165
3175
  } catch {
3166
3176
  }
@@ -3173,37 +3183,37 @@ class Vo {
3173
3183
  }
3174
3184
  if (!this.selectionMode || f.key === "Shift" || f.key === "Control" || f.key === "Alt" || f.key === "Meta" || f.key === "CapsLock" || f.key === "NumLock" || f.key === "ScrollLock")
3175
3185
  return;
3176
- const y = typeof navigator < "u" && /mac/i.test(navigator.platform);
3177
- if (y ? f.metaKey : f.ctrlKey) {
3178
- const x = f.key.toLowerCase();
3179
- if (x === "z") {
3180
- f.preventDefault(), y && f.shiftKey ? this.onRedo() : this.onUndo(), this.selectionAnchor = null;
3186
+ const g = typeof navigator < "u" && /mac/i.test(navigator.platform);
3187
+ if (g ? f.metaKey : f.ctrlKey) {
3188
+ const v = f.key.toLowerCase();
3189
+ if (v === "z") {
3190
+ f.preventDefault(), g && f.shiftKey ? this.onRedo() : this.onUndo(), this.selectionAnchor = null;
3181
3191
  return;
3182
3192
  }
3183
- if (x === "y") {
3193
+ if (v === "y") {
3184
3194
  f.preventDefault(), this.onRedo(), this.selectionAnchor = null;
3185
3195
  return;
3186
3196
  }
3187
- if (x === "c") {
3197
+ if (v === "c") {
3188
3198
  f.preventDefault(), await this.copySelection(), this.selectionAnchor = null;
3189
3199
  return;
3190
3200
  }
3191
- if (x === "x") {
3201
+ if (v === "x") {
3192
3202
  f.preventDefault(), await this.copySelection(), this.clearSelectionValues(), this.selectionAnchor = null;
3193
3203
  return;
3194
3204
  }
3195
- if (x === "v") {
3205
+ if (v === "v") {
3196
3206
  this.selectionAnchor = null;
3197
3207
  return;
3198
3208
  }
3199
3209
  }
3200
3210
  if (f.key === " " && this.activeCell.colKey !== null) {
3201
- const x = this.findColumn(this.activeCell.colKey);
3202
- if (x?.type === "button" || x?.type === "link") {
3203
- f.preventDefault(), this.triggerCellAction(this.activeCell.rowId, this.activeCell.colKey, x.type), this.selectionAnchor = null;
3211
+ const v = this.findColumn(this.activeCell.colKey);
3212
+ if (v?.type === "button" || v?.type === "link") {
3213
+ f.preventDefault(), this.triggerCellAction(this.activeCell.rowId, this.activeCell.colKey, v.type), this.selectionAnchor = null;
3204
3214
  return;
3205
3215
  }
3206
- if (x?.type === "boolean") {
3216
+ if (v?.type === "boolean") {
3207
3217
  f.preventDefault(), this.toggleBoolean(this.activeCell.rowId, this.activeCell.colKey), this.selectionAnchor = null;
3208
3218
  return;
3209
3219
  }
@@ -3220,8 +3230,8 @@ class Vo {
3220
3230
  this.moveActiveCell(f.shiftKey ? -1 : 1, 0, !1);
3221
3231
  return;
3222
3232
  }
3223
- const x = f.shiftKey;
3224
- f.key === "ArrowLeft" ? this.moveActiveCell(0, -1, x) : f.key === "ArrowRight" ? this.moveActiveCell(0, 1, x) : f.key === "ArrowUp" ? this.moveActiveCell(-1, 0, x) : f.key === "ArrowDown" && this.moveActiveCell(1, 0, x);
3233
+ const v = f.shiftKey;
3234
+ f.key === "ArrowLeft" ? this.moveActiveCell(0, -1, v) : f.key === "ArrowRight" ? this.moveActiveCell(0, 1, v) : f.key === "ArrowUp" ? this.moveActiveCell(-1, 0, v) : f.key === "ArrowDown" && this.moveActiveCell(1, 0, v);
3225
3235
  return;
3226
3236
  }
3227
3237
  if (this.activeCell.colKey !== null && this.isCellReadonly(this.activeCell.rowId, this.activeCell.colKey)) {
@@ -3230,8 +3240,8 @@ class Vo {
3230
3240
  }
3231
3241
  this.selectionMode = !1, this.selectionAnchor = null, this.openEditorAtActiveCell();
3232
3242
  }, this.handleClick = (f) => {
3233
- const y = f.target;
3234
- if (f.button !== 0 || y?.closest("button.extable-lookup-option") || y?.closest('button[data-extable-fs-open="1"]'))
3243
+ const g = f.target;
3244
+ if (f.button !== 0 || g?.closest("button.extable-lookup-option") || g?.closest('button[data-extable-fs-open="1"]'))
3235
3245
  return;
3236
3246
  if (this.suppressNextClick) {
3237
3247
  this.suppressNextClick = !1;
@@ -3239,84 +3249,92 @@ class Vo {
3239
3249
  }
3240
3250
  if (this.inputEl && f.target && this.inputEl.contains(f.target) || this.inputEl && this.activeCell && this.activeCell.colKey !== null && !this.tryCommitActiveEditor())
3241
3251
  return;
3242
- const m = this.getHitAtClientPoint(f.clientX, f.clientY, f.target);
3243
- if (!m) return;
3244
- const w = this.hitAction ? this.hitAction(f) : null;
3245
- if (w) {
3246
- if (w.kind === "tag-remove") {
3247
- if (this.removeTagValue(w.rowId, w.colKey, w.tagIndex)) {
3252
+ const y = this.getHitAtClientPoint(f.clientX, f.clientY, f.target);
3253
+ if (f.target?.closest("input.extable-unique-radio") && y) {
3254
+ if (y.colKey === null) return;
3255
+ const T = this.findColumn(y.colKey);
3256
+ if (T && T.type === "boolean" && T.unique) {
3257
+ this.toggleBoolean(y.rowId, y.colKey), f.preventDefault();
3258
+ return;
3259
+ }
3260
+ }
3261
+ if (!y) return;
3262
+ const b = this.hitAction ? this.hitAction(f) : null;
3263
+ if (b) {
3264
+ if (b.kind === "tag-remove") {
3265
+ if (this.removeTagValue(b.rowId, b.colKey, b.tagIndex)) {
3248
3266
  f.preventDefault();
3249
3267
  return;
3250
3268
  }
3251
- } else if (this.triggerCellAction(w.rowId, w.colKey, w.kind)) {
3269
+ } else if (this.triggerCellAction(b.rowId, b.colKey, b.kind)) {
3252
3270
  f.preventDefault();
3253
3271
  return;
3254
3272
  }
3255
3273
  }
3256
- const b = this.selectionMode && !f.shiftKey && !f.metaKey && !f.ctrlKey && this.activeCell?.rowId === m.rowId && String(this.activeCell?.colKey) === String(m.colKey);
3257
- if (m.rowId === "__all__" && m.colKey === "__all__") {
3258
- const L = this.dataModel.getSchema(), H = this.dataModel.listRows();
3259
- this.teardownInput(!1), H.length && L.columns.length ? (this.selectionRanges = [
3274
+ const S = this.selectionMode && !f.shiftKey && !f.metaKey && !f.ctrlKey && this.activeCell?.rowId === y.rowId && String(this.activeCell?.colKey) === String(y.colKey);
3275
+ if (y.rowId === "__all__" && y.colKey === "__all__") {
3276
+ const T = this.dataModel.getSchema(), k = this.dataModel.listRows();
3277
+ this.teardownInput(!1), k.length && T.columns.length ? (this.selectionRanges = [
3260
3278
  {
3261
3279
  kind: "cells",
3262
3280
  startRow: 0,
3263
- endRow: H.length - 1,
3281
+ endRow: k.length - 1,
3264
3282
  startCol: 0,
3265
- endCol: L.columns.length - 1
3283
+ endCol: T.columns.length - 1
3266
3284
  }
3267
3285
  ], 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);
3268
3286
  return;
3269
3287
  }
3270
- if (this.onRowSelect(m.rowId), m.rowId === "__header__") {
3271
- const L = this.dataModel.getSchema(), H = this.dataModel.listRows(), M = L.columns.findIndex((D) => String(D.key) === String(m.colKey));
3272
- H.length && M >= 0 && (this.selectionRanges = [
3288
+ if (this.onRowSelect(y.rowId), y.rowId === "__header__") {
3289
+ const T = this.dataModel.getSchema(), k = this.dataModel.listRows(), L = T.columns.findIndex((F) => String(F.key) === String(y.colKey));
3290
+ k.length && L >= 0 && (this.selectionRanges = [
3273
3291
  {
3274
3292
  kind: "cells",
3275
3293
  startRow: 0,
3276
- endRow: H.length - 1,
3277
- startCol: M,
3278
- endCol: M
3294
+ endRow: k.length - 1,
3295
+ startCol: L,
3296
+ endCol: L
3279
3297
  }
3280
- ], this.activeCell = { rowId: H[0].id, colKey: m.colKey }, this.onActiveChange(this.activeCell.rowId, this.activeCell.colKey), this.onSelectionChange(this.selectionRanges), this.updateFillHandleFlag(), this.selectionMode = !0, this.selectionAnchor = null, this.focusSelectionInput(""));
3298
+ ], this.activeCell = { rowId: k[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(""));
3281
3299
  return;
3282
3300
  }
3283
- if (this.applySelectionFromHit(f, m), m.colKey === null || m.colKey === "__all__") {
3301
+ if (this.applySelectionFromHit(f, y), y.colKey === null || y.colKey === "__all__") {
3284
3302
  this.selectionMode = !0, this.selectionAnchor = null, this.focusSelectionInput("");
3285
3303
  return;
3286
3304
  }
3287
- if (m.rowId === "__header__") {
3305
+ if (y.rowId === "__header__") {
3288
3306
  this.selectionMode = !0, this.selectionAnchor = null, this.focusSelectionInput("");
3289
3307
  return;
3290
3308
  }
3291
- if (this.isCellReadonly(m.rowId, m.colKey)) {
3309
+ if (this.isCellReadonly(y.rowId, y.colKey)) {
3292
3310
  this.selectionMode = !0, this.selectionAnchor = null, this.teardownInput(!1);
3293
- const L = this.dataModel.getCell(m.rowId, m.colKey);
3294
- this.focusSelectionInput(this.cellToClipboardString(L));
3311
+ const T = this.dataModel.getCell(y.rowId, y.colKey);
3312
+ this.focusSelectionInput(this.cellToClipboardString(T));
3295
3313
  return;
3296
3314
  }
3297
- if (this.findColumn(m.colKey)?.type === "boolean") {
3298
- const L = this.lastBooleanCell?.rowId === m.rowId && String(this.lastBooleanCell?.colKey) === String(m.colKey);
3299
- if (this.lastBooleanCell = { rowId: m.rowId, colKey: m.colKey }, this.selectionMode = !0, this.selectionAnchor = null, this.teardownInput(!1), this.teardownSelectionInput(), L) {
3300
- this.toggleBoolean(m.rowId, m.colKey), this.focusSelectionInput("");
3315
+ if (this.findColumn(y.colKey)?.type === "boolean") {
3316
+ const T = this.lastBooleanCell?.rowId === y.rowId && String(this.lastBooleanCell?.colKey) === String(y.colKey);
3317
+ if (this.lastBooleanCell = { rowId: y.rowId, colKey: y.colKey }, this.selectionMode = !0, this.selectionAnchor = null, this.teardownInput(!1), this.teardownSelectionInput(), T) {
3318
+ this.toggleBoolean(y.rowId, y.colKey), this.focusSelectionInput("");
3301
3319
  return;
3302
3320
  }
3303
3321
  this.focusSelectionInput("");
3304
3322
  return;
3305
3323
  }
3306
3324
  this.lastBooleanCell = null, this.selectionAnchor = null, this.teardownInput(!1);
3307
- const E = this.dataModel.getCell(m.rowId, m.colKey), V = this.cellToClipboardString(E);
3308
- this.focusSelectionInput(V), b && (this.selectionMode = !1, this.openEditorAtActiveCell());
3325
+ const D = this.dataModel.getCell(y.rowId, y.colKey), K = this.cellToClipboardString(D);
3326
+ this.focusSelectionInput(K), S && (this.selectionMode = !1, this.openEditorAtActiveCell());
3309
3327
  }, this.handleContextMenu = (f) => {
3310
- const y = f.target;
3328
+ const g = f.target;
3311
3329
  if (f.ctrlKey) {
3312
3330
  f.preventDefault();
3313
3331
  return;
3314
3332
  }
3315
- if (!y || !this.root.contains(y)) return;
3333
+ if (!g || !this.root.contains(g)) return;
3316
3334
  f.preventDefault(), f.stopPropagation();
3317
- const m = this.hitTest(f), w = m?.rowId ?? null, b = m?.colKey ?? null;
3335
+ const y = this.hitTest(f), w = y?.rowId ?? null, b = y?.colKey ?? null;
3318
3336
  this.onContextMenu(w, b, f.clientX, f.clientY);
3319
- }, 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 = d, this.onCellAction = h, this.onContextMenu = p, this.bind();
3337
+ }, 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.onContextMenu = p, this.bind();
3320
3338
  }
3321
3339
  setEditMode(t) {
3322
3340
  this.editMode = t;
@@ -3327,9 +3345,9 @@ class Vo {
3327
3345
  this.selectionRanges = [], this.activeCell = null, this.selectionAnchor = null, this.lastBooleanCell = null, this.teardownInput(!0), this.onActiveChange(null, null), this.onSelectionChange(this.selectionRanges), this.updateFillHandleFlag();
3328
3346
  return;
3329
3347
  }
3330
- 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((y) => String(y.key) === String(s)) : -1;
3348
+ 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((g) => String(g.key) === String(s)) : -1;
3331
3349
  if (l >= 0 && a >= 0) {
3332
- let y = !1;
3350
+ let g = !1;
3333
3351
  if (!this.selectionRanges.length)
3334
3352
  this.selectionRanges = [
3335
3353
  {
@@ -3339,39 +3357,39 @@ class Vo {
3339
3357
  startCol: a,
3340
3358
  endCol: a
3341
3359
  }
3342
- ], y = !0;
3360
+ ], g = !0;
3343
3361
  else {
3344
- const m = this.selectionRanges.map((w) => {
3345
- const b = (x, E) => Math.max(0, Math.min(E, x)), S = {
3362
+ const y = this.selectionRanges.map((w) => {
3363
+ const b = (v, I) => Math.max(0, Math.min(I, v)), S = {
3346
3364
  ...w,
3347
3365
  startRow: b(w.startRow, i),
3348
3366
  endRow: b(w.endRow, i),
3349
3367
  startCol: b(w.startCol, o),
3350
3368
  endCol: b(w.endCol, o)
3351
3369
  };
3352
- return (S.startRow !== w.startRow || S.endRow !== w.endRow || S.startCol !== w.startCol || S.endCol !== w.endCol) && (y = !0), S;
3370
+ return (S.startRow !== w.startRow || S.endRow !== w.endRow || S.startCol !== w.startCol || S.endCol !== w.endCol) && (g = !0), S;
3353
3371
  });
3354
- this.selectionRanges = m;
3372
+ this.selectionRanges = y;
3355
3373
  }
3356
- y && this.onSelectionChange(this.selectionRanges), this.updateFillHandleFlag();
3374
+ g && this.onSelectionChange(this.selectionRanges), this.updateFillHandleFlag();
3357
3375
  return;
3358
3376
  }
3359
3377
  const r = s ?? t.columns[0]?.key ?? "";
3360
- let d = t.columns.findIndex((y) => String(y.key) === String(r));
3361
- d < 0 && (d = 0);
3362
- const h = t.columns[d]?.key ?? "", u = n ? this.dataModel.getBaseRowIndex(n) : 0, p = e[e.length - 1] ?? e[0] ?? null, g = e.find((y) => this.dataModel.getBaseRowIndex(y.id) >= u) ?? p;
3363
- if (!g) return;
3364
- const v = g.id, C = this.dataModel.getRowIndex(v);
3378
+ let h = t.columns.findIndex((g) => String(g.key) === String(r));
3379
+ h < 0 && (h = 0);
3380
+ const d = t.columns[h]?.key ?? "", u = n ? this.dataModel.getBaseRowIndex(n) : 0, p = e[e.length - 1] ?? e[0] ?? null, m = e.find((g) => this.dataModel.getBaseRowIndex(g.id) >= u) ?? p;
3381
+ if (!m) return;
3382
+ const C = m.id, x = this.dataModel.getRowIndex(C);
3365
3383
  this.selectionAnchor = null, this.lastBooleanCell = null, this.teardownInput(!1), this.selectionRanges = [
3366
3384
  {
3367
3385
  kind: "cells",
3368
- startRow: C,
3369
- endRow: C,
3370
- startCol: d,
3371
- endCol: d
3386
+ startRow: x,
3387
+ endRow: x,
3388
+ startCol: h,
3389
+ endCol: h
3372
3390
  }
3373
- ], this.activeCell = { rowId: v, colKey: h }, this.onActiveChange(v, h), this.onSelectionChange(this.selectionRanges), this.ensureVisibleCell(v, h);
3374
- const f = this.dataModel.getCell(v, h);
3391
+ ], this.activeCell = { rowId: C, colKey: d }, this.onActiveChange(C, d), this.onSelectionChange(this.selectionRanges), this.ensureVisibleCell(C, d);
3392
+ const f = this.dataModel.getCell(C, d);
3375
3393
  this.focusSelectionInput(this.cellToClipboardString(f)), this.updateFillHandleFlag();
3376
3394
  }
3377
3395
  navigateToCell(t, e) {
@@ -3393,7 +3411,7 @@ class Vo {
3393
3411
  this.teardownInput(!0);
3394
3412
  }
3395
3413
  destroy() {
3396
- this.root.removeEventListener("click", this.handleClick), this.root.removeEventListener("pointerdown", this.handlePointerDown), this.root.removeEventListener("pointermove", this.handlePointerMove), this.root.removeEventListener("pointerup", this.handlePointerUp), this.root.removeEventListener("pointercancel", this.handlePointerUp), this.root.removeEventListener("pointerleave", this.handlePointerLeave), this.root.removeEventListener("keydown", this.handleRootKeydown), this.handleDocumentContextMenu && document.removeEventListener("contextmenu", this.handleDocumentContextMenu, !0), this.teardownInput(!0), this.teardownSelectionInput(), this.teardownCopyToast(), $(this.lookupDropdownEl), this.lookupDropdownEl = null, this.hideHoverTooltip(), this.teardownHoverTooltip(), this.stopAutoScroll();
3414
+ this.root.removeEventListener("click", this.handleClick), this.root.removeEventListener("pointerdown", this.handlePointerDown), this.root.removeEventListener("pointermove", this.handlePointerMove), this.root.removeEventListener("pointerup", this.handlePointerUp), this.root.removeEventListener("pointercancel", this.handlePointerUp), this.root.removeEventListener("pointerleave", this.handlePointerLeave), this.root.removeEventListener("keydown", this.handleRootKeydown), this.handleDocumentContextMenu && document.removeEventListener("contextmenu", this.handleDocumentContextMenu, !0), this.teardownInput(!0), this.teardownSelectionInput(), this.teardownCopyToast(), O(this.lookupDropdownEl), this.lookupDropdownEl = null, this.hideHoverTooltip(), this.teardownHoverTooltip(), this.stopAutoScroll();
3397
3415
  }
3398
3416
  onScroll(t, e) {
3399
3417
  this.positionCopyToast(), this.refreshHoverTooltipPosition(), this.refreshLookupDropdownPosition();
@@ -3455,13 +3473,13 @@ class Vo {
3455
3473
  return e.className = "extable-toast", e.dataset.extableCopyToast = "1", e.style.position = "absolute", e.style.left = "0", e.style.top = "0", e.style.pointerEvents = "none", e.style.zIndex = "1000", e.style.display = "none", e.style.margin = "0", this.root.appendChild(e), this.copyToastEl = e, e;
3456
3474
  }
3457
3475
  teardownCopyToast() {
3458
- this.copyToastTimer && (window.clearTimeout(this.copyToastTimer), this.copyToastTimer = null), this.copyToastEl && (this.copyToastEl.style.display = "none", $(this.copyToastEl), this.copyToastEl = null);
3476
+ this.copyToastTimer && (window.clearTimeout(this.copyToastTimer), this.copyToastTimer = null), this.copyToastEl && (this.copyToastEl.style.display = "none", O(this.copyToastEl), this.copyToastEl = null);
3459
3477
  }
3460
3478
  positionCopyToast() {
3461
3479
  if (!this.copyToastEl) return;
3462
3480
  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();
3463
3481
  if (r) {
3464
- const d = r.right - a.left + this.root.scrollLeft - t + 8, h = r.top - a.top + this.root.scrollTop - e + 8, u = Math.min(o, Math.max(s, d)), p = Math.min(n, Math.max(l, h));
3482
+ 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));
3465
3483
  this.copyToastEl.style.left = `${u}px`, this.copyToastEl.style.top = `${p}px`;
3466
3484
  return;
3467
3485
  }
@@ -3480,7 +3498,7 @@ class Vo {
3480
3498
  return e.className = "extable-tooltip", e.dataset.visible = "0", e.style.position = "absolute", e.style.left = "0", e.style.top = "0", e.style.pointerEvents = "none", e.style.zIndex = "1000", this.root.appendChild(e), this.hoverTooltipEl = e, e;
3481
3499
  }
3482
3500
  teardownHoverTooltip() {
3483
- this.hoverTooltipAbort?.abort(), this.hoverTooltipAbort = null, this.hoverTooltipRequestId += 1, this.hoverTooltipTarget = null, this.hoverTooltipMessage = null, $(this.hoverTooltipEl), this.hoverTooltipEl = null;
3501
+ this.hoverTooltipAbort?.abort(), this.hoverTooltipAbort = null, this.hoverTooltipRequestId += 1, this.hoverTooltipTarget = null, this.hoverTooltipMessage = null, O(this.hoverTooltipEl), this.hoverTooltipEl = null;
3484
3502
  }
3485
3503
  hideHoverTooltip() {
3486
3504
  this.hoverTooltipEl && (this.hoverTooltipEl.dataset.visible = "0"), this.hoverTooltipTarget = null, this.hoverTooltipMessage = null, this.hoverTooltipAbort?.abort(), this.hoverTooltipAbort = null, this.hoverTooltipRequestId += 1;
@@ -3494,8 +3512,8 @@ class Vo {
3494
3512
  if (!e) return;
3495
3513
  const i = 8, o = this.root.getBoundingClientRect(), n = this.root.clientWidth, s = this.root.clientHeight;
3496
3514
  let l = t.right - o.left + i, a = t.top - o.top + i, r = "right";
3497
- const d = e.getBoundingClientRect();
3498
- l + d.width > n && (l = Math.max(0, t.left - o.left - d.width - i), r = "left"), a + d.height > s && (a = Math.max(0, s - d.height - i)), e.style.left = `${l}px`, e.style.top = `${a}px`, e.dataset.side = r;
3515
+ const h = e.getBoundingClientRect();
3516
+ l + h.width > n && (l = Math.max(0, t.left - o.left - h.width - i), r = "left"), a + h.height > s && (a = Math.max(0, s - h.height - i)), e.style.left = `${l}px`, e.style.top = `${a}px`, e.dataset.side = r;
3499
3517
  }
3500
3518
  refreshHoverTooltipPosition() {
3501
3519
  const t = this.hoverTooltipEl;
@@ -3535,21 +3553,21 @@ class Vo {
3535
3553
  this.hoverTooltipAbort?.abort();
3536
3554
  const r = new AbortController();
3537
3555
  this.hoverTooltipAbort = r;
3538
- const d = this.hoverTooltipRequestId += 1;
3556
+ const h = this.hoverTooltipRequestId += 1;
3539
3557
  this.hoverTooltipTarget = { rowId: o, colKey: i }, this.hoverTooltipMessage = null;
3540
- const h = this.dataModel.getCell(o, i), u = (p) => {
3541
- if (d !== this.hoverTooltipRequestId || r.signal.aborted) return;
3558
+ const d = this.dataModel.getCell(o, i), u = (p) => {
3559
+ if (h !== this.hoverTooltipRequestId || r.signal.aborted) return;
3542
3560
  if (!p) {
3543
3561
  this.hideHoverTooltip();
3544
3562
  return;
3545
3563
  }
3546
- const g = this.ensureHoverTooltip();
3547
- this.hoverTooltipMessage = p, g.textContent = p, this.positionTooltipAtRect(e.rect), g.dataset.visible = "1";
3564
+ const m = this.ensureHoverTooltip();
3565
+ this.hoverTooltipMessage = p, m.textContent = p, this.positionTooltipAtRect(e.rect), m.dataset.visible = "1";
3548
3566
  };
3549
3567
  try {
3550
- const p = l({ rowId: o, colKey: i, value: h, signal: r.signal });
3551
- p && typeof p.then == "function" ? p.then(u).catch((g) => {
3552
- d === this.hoverTooltipRequestId && (r.signal.aborted || (this.hideHoverTooltip(), this.showCopyToast("Tooltip failed", "error", 1800)));
3568
+ const p = l({ rowId: o, colKey: i, value: d, signal: r.signal });
3569
+ p && typeof p.then == "function" ? p.then(u).catch((m) => {
3570
+ h === this.hoverTooltipRequestId && (r.signal.aborted || (this.hideHoverTooltip(), this.showCopyToast("Tooltip failed", "error", 1800)));
3553
3571
  }) : u(p);
3554
3572
  } catch {
3555
3573
  this.hideHoverTooltip(), this.showCopyToast("Tooltip failed", "error", 1800);
@@ -3621,52 +3639,52 @@ class Vo {
3621
3639
  i.readOnly = !1, i.inputMode = "text";
3622
3640
  const r = this.getCellRect(t, e);
3623
3641
  if (r) {
3624
- const d = this.root.getBoundingClientRect();
3625
- i.style.transform = "none", i.style.left = `${r.left - d.left}px`, i.style.top = `${r.top - d.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";
3642
+ const h = this.root.getBoundingClientRect();
3643
+ 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";
3626
3644
  }
3627
3645
  }
3628
3646
  if (n.recentLookup !== !1) {
3629
3647
  const r = this.dataModel.getCell(t, e);
3630
3648
  if (typeof r == "object" && r !== null) {
3631
- const d = r;
3632
- typeof d.label == "string" && "value" in d && !d.kind && this.lookupRecentHistory.set(e, {
3633
- label: d.label,
3634
- value: d.value
3649
+ const h = r;
3650
+ typeof h.label == "string" && "value" in h && !h.kind && this.lookupRecentHistory.set(e, {
3651
+ label: h.label,
3652
+ value: h.value
3635
3653
  });
3636
3654
  }
3637
3655
  }
3638
3656
  let s = -1;
3639
3657
  const l = n.debounceMs ?? 250, a = (r) => {
3640
- const d = typeof r == "boolean" ? r : !1, h = i.value;
3658
+ const h = typeof r == "boolean" ? r : !1, d = i.value;
3641
3659
  this.lookupDebounceTimer && (window.clearTimeout(this.lookupDebounceTimer), this.lookupDebounceTimer = null), this.lookupAbort?.abort(), this.lookupAbort = null, this.lookupRequestId += 1;
3642
- const u = this.lookupRequestId, p = s, g = () => {
3660
+ const u = this.lookupRequestId, p = s, m = () => {
3643
3661
  this.lookupDebounceTimer = null;
3644
- const v = new AbortController();
3645
- this.lookupAbort = v, n.fetchCandidates({ query: h, rowId: t, colKey: e, signal: v.signal }).then((C) => {
3646
- if (u !== this.lookupRequestId || v.signal.aborted || !this.activeCell || this.activeCell.rowId !== t || this.activeCell.colKey !== e)
3662
+ const C = new AbortController();
3663
+ this.lookupAbort = C, n.fetchCandidates({ query: d, rowId: t, colKey: e, signal: C.signal }).then((x) => {
3664
+ if (u !== this.lookupRequestId || C.signal.aborted || !this.activeCell || this.activeCell.rowId !== t || this.activeCell.colKey !== e)
3647
3665
  return;
3648
- let f = Array.from(C);
3666
+ let f = Array.from(x);
3649
3667
  if (n.recentLookup !== !1) {
3650
- const m = this.lookupRecentHistory.get(e);
3651
- if (m) {
3652
- f = f.filter((b) => !(b.label === m.label && b.value === m.value));
3653
- const w = { ...m, isRecent: !0 };
3668
+ const y = this.lookupRecentHistory.get(e);
3669
+ if (y) {
3670
+ f = f.filter((b) => !(b.label === y.label && b.value === y.value));
3671
+ const w = { ...y, isRecent: !0 };
3654
3672
  f.unshift(w);
3655
3673
  }
3656
3674
  }
3657
3675
  s = f.length;
3658
- const y = f.filter((m) => !m.isRecent);
3659
- if (!n.allowFreeInput && p > 1 && y.length === 1) {
3660
- const m = f.indexOf(y[0]);
3661
- this.lookupCandidates = f, this.lookupHighlightIndex = m, this.commitLookupCandidate(m);
3676
+ const g = f.filter((y) => !y.isRecent);
3677
+ if (!n.allowFreeInput && p > 1 && g.length === 1) {
3678
+ const y = f.indexOf(g[0]);
3679
+ this.lookupCandidates = f, this.lookupHighlightIndex = y, this.commitLookupCandidate(y);
3662
3680
  return;
3663
3681
  }
3664
3682
  this.lookupCandidates = f, this.lookupHighlightIndex = f.length ? 0 : -1, this.renderLookupDropdown();
3665
- }).catch((C) => {
3666
- u === this.lookupRequestId && (v.signal.aborted || (this.hideLookupDropdown(), this.showCopyToast("Lookup failed", "error", 1800)));
3683
+ }).catch((x) => {
3684
+ u === this.lookupRequestId && (C.signal.aborted || (this.hideLookupDropdown(), this.showCopyToast("Lookup failed", "error", 1800)));
3667
3685
  });
3668
3686
  };
3669
- d ? g() : this.lookupDebounceTimer = window.setTimeout(g, l);
3687
+ h ? m() : this.lookupDebounceTimer = window.setTimeout(m, l);
3670
3688
  };
3671
3689
  i.addEventListener("input", a), this.lookupInputCleanup = () => i.removeEventListener("input", a), a(!0);
3672
3690
  }
@@ -3764,18 +3782,18 @@ class Vo {
3764
3782
  a.readOnly = !1, a.inputMode = "text";
3765
3783
  const r = this.getCellRect(e, i);
3766
3784
  if (r) {
3767
- const d = this.root.getBoundingClientRect();
3768
- a.style.transform = "none", a.style.left = `${r.left - d.left}px`, a.style.top = `${r.top - d.top}px`, a.style.width = `${r.width}px`, a.style.height = `${r.height}px`, a.style.opacity = "1", a.style.pointerEvents = "auto", a.style.padding = "2px 4px", a.style.border = "none", a.style.background = "#fff", a.style.color = "#000", a.style.fontSize = "14px", a.style.fontFamily = "inherit", a.style.boxSizing = "border-box", a.style.zIndex = "100", a.style.WebkitAppearance = "none", a.style.WebkitUserSelect = "text", a.style.WebkitUserModify = "read-write";
3785
+ const h = this.root.getBoundingClientRect();
3786
+ a.style.transform = "none", a.style.left = `${r.left - h.left}px`, a.style.top = `${r.top - h.top}px`, a.style.width = `${r.width}px`, a.style.height = `${r.height}px`, a.style.opacity = "1", a.style.pointerEvents = "auto", a.style.padding = "2px 4px", a.style.border = "none", a.style.background = "#fff", a.style.color = "#000", a.style.fontSize = "14px", a.style.fontFamily = "inherit", a.style.boxSizing = "border-box", a.style.zIndex = "100", a.style.WebkitAppearance = "none", a.style.WebkitUserSelect = "text", a.style.WebkitUserModify = "read-write";
3769
3787
  }
3770
3788
  if (t?.initialValueOverride !== void 0)
3771
3789
  a.value = t.initialValueOverride;
3772
3790
  else {
3773
- const d = this.dataModel.getCell(e, i);
3774
- a.value = this.getInitialEditValue(i, d);
3791
+ const h = this.dataModel.getCell(e, i);
3792
+ a.value = this.getInitialEditValue(i, h);
3775
3793
  }
3776
3794
  if (this.inputEl = a, this.activeOriginalValue = { rowId: e, colKey: i, value: this.dataModel.getCell(e, i) }, o?.edit?.lookup && this.setupLookupEditor(e, i, a), a.focus({ preventScroll: !0 }), t?.placeCursorAtEnd) {
3777
- const d = a.value.length;
3778
- a.setSelectionRange(d, d);
3795
+ const h = a.value.length;
3796
+ a.setSelectionRange(h, h);
3779
3797
  }
3780
3798
  return;
3781
3799
  }
@@ -3818,20 +3836,20 @@ class Vo {
3818
3836
  ) ? this.getCanvasCellMetrics(t, e) : null;
3819
3837
  }
3820
3838
  getCanvasCellMetrics(t, e) {
3821
- const i = this.dataModel.getSchema(), o = this.dataModel.getView(), n = this.dataModel.listRows(), s = n.findIndex((C) => C.id === t), l = i.columns.findIndex((C) => String(C.key) === String(e));
3839
+ 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));
3822
3840
  if (s < 0 || l < 0) return null;
3823
- const a = dt, r = st, d = ft, h = G(i, o);
3841
+ const a = dt, r = st, h = ft, d = Q(i, o);
3824
3842
  let u = r;
3825
- for (let C = 0; C < l; C += 1) u += h[C] ?? 100;
3843
+ for (let x = 0; x < l; x += 1) u += d[x] ?? 100;
3826
3844
  let p = a;
3827
- for (let C = 0; C < s; C += 1) {
3828
- const f = n[C];
3845
+ for (let x = 0; x < s; x += 1) {
3846
+ const f = n[x];
3829
3847
  if (!f) return null;
3830
- const y = this.dataModel.getRowHeight(f.id) ?? d;
3831
- p += y;
3848
+ const g = this.dataModel.getRowHeight(f.id) ?? h;
3849
+ p += g;
3832
3850
  }
3833
- const g = this.dataModel.getRowHeight(t) ?? d, v = h[l] ?? 100;
3834
- return { left: u, top: p, width: v, height: g, rowIndex: s, colIndex: l };
3851
+ const m = this.dataModel.getRowHeight(t) ?? h, C = d[l] ?? 100;
3852
+ return { left: u, top: p, width: C, height: m, rowIndex: s, colIndex: l };
3835
3853
  }
3836
3854
  getActiveCellRect() {
3837
3855
  const t = this.activeCell;
@@ -3844,14 +3862,14 @@ class Vo {
3844
3862
  if (l) return l.getBoundingClientRect();
3845
3863
  const a = i.columns.findIndex((r) => String(r.key) === String(t.colKey));
3846
3864
  if (a >= 0) {
3847
- const r = G(i, o);
3848
- let d = st;
3849
- for (let u = 0; u < a; u += 1) d += r[u] ?? 100;
3850
- const h = r[a] ?? 100;
3865
+ const r = Q(i, o);
3866
+ let h = st;
3867
+ for (let u = 0; u < a; u += 1) h += r[u] ?? 100;
3868
+ const d = r[a] ?? 100;
3851
3869
  return new DOMRect(
3852
- e.left + d - this.root.scrollLeft,
3870
+ e.left + h - this.root.scrollLeft,
3853
3871
  e.top,
3854
- h,
3872
+ d,
3855
3873
  dt
3856
3874
  );
3857
3875
  }
@@ -3861,10 +3879,10 @@ class Vo {
3861
3879
  if (s >= 0) {
3862
3880
  let l = dt;
3863
3881
  const a = this.dataModel.listRows();
3864
- for (let d = 0; d < s; d += 1) {
3865
- const h = a[d];
3866
- if (!h) break;
3867
- l += this.dataModel.getRowHeight(h.id) ?? ft;
3882
+ for (let h = 0; h < s; h += 1) {
3883
+ const d = a[h];
3884
+ if (!d) break;
3885
+ l += this.dataModel.getRowHeight(d.id) ?? ft;
3868
3886
  }
3869
3887
  const r = this.dataModel.getRowHeight(t.rowId) ?? ft;
3870
3888
  return new DOMRect(
@@ -3887,8 +3905,8 @@ class Vo {
3887
3905
  }
3888
3906
  const o = this.getCanvasCellMetrics(t, e);
3889
3907
  if (!o) return;
3890
- const n = o.left, s = o.left + o.width, l = o.top, a = o.top + o.height, r = this.root.scrollLeft, d = this.root.scrollLeft + this.root.clientWidth, h = this.root.scrollTop, u = this.root.scrollTop + this.root.clientHeight;
3891
- n < r ? this.root.scrollLeft = Math.max(0, n) : s > d && (this.root.scrollLeft = Math.max(0, s - this.root.clientWidth)), l < h ? this.root.scrollTop = Math.max(0, l) : a > u && (this.root.scrollTop = Math.max(0, a - this.root.clientHeight));
3908
+ 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;
3909
+ 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));
3892
3910
  }
3893
3911
  moveActiveCell(t, e, i = !1) {
3894
3912
  const o = this.dataModel.getSchema(), n = this.dataModel.listRows();
@@ -3897,27 +3915,27 @@ class Vo {
3897
3915
  this.lastCommittedLookupCell = null, i || (this.selectionAnchor = null);
3898
3916
  const a = i && this.selectionAnchor ? this.selectionAnchor : i ? { rowIndex: s, colIndex: l } : null;
3899
3917
  i && !this.selectionAnchor && (this.selectionAnchor = { rowIndex: s, colIndex: l });
3900
- const r = Math.max(0, Math.min(n.length - 1, s + t)), d = Math.max(0, Math.min(o.columns.length - 1, l + e));
3918
+ const r = Math.max(0, Math.min(n.length - 1, s + t)), h = Math.max(0, Math.min(o.columns.length - 1, l + e));
3901
3919
  {
3902
- const h = n[r];
3903
- if (!h) return;
3904
- const u = o.columns[d];
3920
+ const d = n[r];
3921
+ if (!d) return;
3922
+ const u = o.columns[h];
3905
3923
  if (!u) return;
3906
- const p = h.id, g = u.key, v = a ? {
3924
+ const p = d.id, m = u.key, C = a ? {
3907
3925
  kind: "cells",
3908
3926
  startRow: a.rowIndex,
3909
3927
  endRow: r,
3910
3928
  startCol: a.colIndex,
3911
- endCol: d
3929
+ endCol: h
3912
3930
  } : {
3913
3931
  kind: "cells",
3914
3932
  startRow: r,
3915
3933
  endRow: r,
3916
- startCol: d,
3917
- endCol: d
3934
+ startCol: h,
3935
+ endCol: h
3918
3936
  };
3919
- this.selectionRanges = [v], this.activeCell = { rowId: p, colKey: g }, this.onActiveChange(p, g), this.onSelectionChange(this.selectionRanges), this.ensureVisibleCell(p, g);
3920
- const C = this.dataModel.getCell(p, g), f = this.cellToClipboardString(C);
3937
+ this.selectionRanges = [C], this.activeCell = { rowId: p, colKey: m }, this.onActiveChange(p, m), this.onSelectionChange(this.selectionRanges), this.ensureVisibleCell(p, m);
3938
+ const x = this.dataModel.getCell(p, m), f = this.cellToClipboardString(x);
3921
3939
  this.focusSelectionInput(f), this.updateFillHandleFlag();
3922
3940
  return;
3923
3941
  }
@@ -3935,10 +3953,10 @@ class Vo {
3935
3953
  };
3936
3954
  const l = o.closest("th.extable-row-header:not(.extable-corner)");
3937
3955
  if (l) {
3938
- const h = l.closest("tr[data-row-id]");
3939
- if (h)
3956
+ const d = l.closest("tr[data-row-id]");
3957
+ if (d)
3940
3958
  return {
3941
- rowId: h.dataset.rowId ?? "",
3959
+ rowId: d.dataset.rowId ?? "",
3942
3960
  colKey: null,
3943
3961
  element: l,
3944
3962
  rect: l.getBoundingClientRect()
@@ -3952,10 +3970,10 @@ class Vo {
3952
3970
  element: a,
3953
3971
  rect: a.getBoundingClientRect()
3954
3972
  };
3955
- const r = o.closest("td[data-col-key]"), d = r?.closest("tr[data-row-id]");
3956
- if (r && d)
3973
+ const r = o.closest("td[data-col-key]"), h = r?.closest("tr[data-row-id]");
3974
+ if (r && h)
3957
3975
  return {
3958
- rowId: d.dataset.rowId ?? "",
3976
+ rowId: h.dataset.rowId ?? "",
3959
3977
  colKey: r.dataset.colKey ?? "",
3960
3978
  element: r,
3961
3979
  rect: r.getBoundingClientRect()
@@ -3971,18 +3989,18 @@ class Vo {
3971
3989
  return;
3972
3990
  const o = this.dataModel.getSchema(), n = this.dataModel.listRows(), s = this.dataModel.getRowIndex(i.rowId);
3973
3991
  if (s < 0) return;
3974
- const l = this.dragStart.kind === "rows" ? o.columns.length - 1 : o.columns.findIndex((g) => String(g.key) === String(i.colKey));
3992
+ const l = this.dragStart.kind === "rows" ? o.columns.length - 1 : o.columns.findIndex((m) => String(m.key) === String(i.colKey));
3975
3993
  if (l < 0) return;
3976
- const a = this.dragStart.rowIndex, r = this.dragStart.kind === "rows" ? 0 : this.dragStart.colIndex, d = this.dragStart.kind === "rows" ? o.columns.length - 1 : l;
3977
- (s !== a || d !== r) && (this.dragSelectionChanged = !0);
3978
- const h = {
3994
+ const a = this.dragStart.rowIndex, r = this.dragStart.kind === "rows" ? 0 : this.dragStart.colIndex, h = this.dragStart.kind === "rows" ? o.columns.length - 1 : l;
3995
+ (s !== a || h !== r) && (this.dragSelectionChanged = !0);
3996
+ const d = {
3979
3997
  kind: this.dragStart.kind,
3980
3998
  startRow: a,
3981
3999
  endRow: s,
3982
4000
  startCol: r,
3983
- endCol: d
4001
+ endCol: h
3984
4002
  };
3985
- this.selectionRanges = [h];
4003
+ this.selectionRanges = [d];
3986
4004
  const u = n[s]?.id ?? i.rowId, p = this.dragStart.kind === "rows" ? o.columns[0]?.key ?? i.colKey : o.columns[l]?.key ?? i.colKey;
3987
4005
  this.activeCell = { rowId: u, colKey: p }, this.onActiveChange(u, p), this.onSelectionChange(this.selectionRanges), this.updateFillHandleFlag();
3988
4006
  }
@@ -3995,10 +4013,10 @@ class Vo {
3995
4013
  const a = Math.max(this.fillSource.endRowIndex, s);
3996
4014
  if (this.fillEndRowIndex !== a) {
3997
4015
  this.fillEndRowIndex = a;
3998
- const r = n[a]?.id ?? i.rowId, d = o.columns[this.fillSource.colIndex];
3999
- if (!d) return;
4000
- const h = d.key;
4001
- this.activeCell = { rowId: r, colKey: h }, this.onActiveChange(r, h), this.selectionRanges = [
4016
+ const r = n[a]?.id ?? i.rowId, h = o.columns[this.fillSource.colIndex];
4017
+ if (!h) return;
4018
+ const d = h.key;
4019
+ this.activeCell = { rowId: r, colKey: d }, this.onActiveChange(r, d), this.selectionRanges = [
4002
4020
  {
4003
4021
  kind: "cells",
4004
4022
  startRow: this.fillSource.startRowIndex,
@@ -4043,18 +4061,18 @@ class Vo {
4043
4061
  const s = Ho(this.dataModel, t, this.sequenceLangs);
4044
4062
  if (!s) return;
4045
4063
  const l = this.editMode === "direct", a = `fill:${Date.now()}:${Math.random().toString(16).slice(2)}`;
4046
- for (let h = t.endRowIndex + 1; h <= e; h += 1) {
4047
- const u = o[h];
4064
+ for (let d = t.endRowIndex + 1; d <= e; d += 1) {
4065
+ const u = o[d];
4048
4066
  if (!u) break;
4049
4067
  if (this.isCellReadonly(u.id, n.key)) continue;
4050
- const p = h - t.endRowIndex, g = s(p), v = {
4068
+ const p = d - t.endRowIndex, m = s(p), C = {
4051
4069
  kind: "edit",
4052
4070
  rowId: u.id,
4053
4071
  colKey: n.key,
4054
- next: g,
4072
+ next: m,
4055
4073
  payload: { batchId: a }
4056
4074
  };
4057
- this.onEdit(v, l);
4075
+ this.onEdit(C, l);
4058
4076
  }
4059
4077
  const r = o[e];
4060
4078
  if (!r) return;
@@ -4067,12 +4085,12 @@ class Vo {
4067
4085
  endCol: t.colIndex
4068
4086
  }
4069
4087
  ], this.activeCell = { rowId: r.id, colKey: n.key }, this.onActiveChange(r.id, n.key), this.onSelectionChange(this.selectionRanges), this.updateFillHandleFlag(), this.ensureVisibleCell(r.id, n.key);
4070
- const d = this.dataModel.getCell(r.id, n.key);
4071
- this.focusSelectionInput(this.cellToClipboardString(d));
4088
+ const h = this.dataModel.getCell(r.id, n.key);
4089
+ this.focusSelectionInput(this.cellToClipboardString(h));
4072
4090
  }
4073
4091
  teardownSelectionInput() {
4074
4092
  const t = this.selectionInput;
4075
- t && (this.selectionInput = null, t.removeEventListener("keydown", this.handleSelectionKeydown), t.removeEventListener("beforeinput", this.handleSelectionBeforeInput), t.removeEventListener("compositionstart", this.handleSelectionCompositionStart), t.removeEventListener("copy", this.handleSelectionCopy), t.removeEventListener("cut", this.handleSelectionCut), t.removeEventListener("paste", this.handleSelectionPaste), t.removeEventListener("blur", this.handleSelectionBlur), $(t));
4093
+ t && (this.selectionInput = null, t.removeEventListener("keydown", this.handleSelectionKeydown), t.removeEventListener("beforeinput", this.handleSelectionBeforeInput), t.removeEventListener("compositionstart", this.handleSelectionCompositionStart), t.removeEventListener("copy", this.handleSelectionCopy), t.removeEventListener("cut", this.handleSelectionCut), t.removeEventListener("paste", this.handleSelectionPaste), t.removeEventListener("blur", this.handleSelectionBlur), O(t));
4076
4094
  }
4077
4095
  async copySelection() {
4078
4096
  const t = this.buildSelectionClipboardPayload();
@@ -4172,21 +4190,21 @@ class Vo {
4172
4190
  if (!i || i.kind !== "cells") return null;
4173
4191
  const o = [], n = [], s = "border-collapse:collapse;border-spacing:0;", l = "border:1px solid #d0d7de;padding:4px 6px;vertical-align:top;";
4174
4192
  let a = 0;
4175
- for (let h = i.startRow; h <= i.endRow; h += 1) {
4176
- const u = e[h];
4193
+ for (let d = i.startRow; d <= i.endRow; d += 1) {
4194
+ const u = e[d];
4177
4195
  if (!u) continue;
4178
- const p = [], g = [];
4179
- for (let v = i.startCol; v <= i.endCol; v += 1) {
4180
- const C = t.columns[v];
4181
- if (!C) continue;
4182
- const f = this.dataModel.getCell(u.id, C.key), y = this.cellToClipboardString(f);
4183
- p.push(y), g.push(`<td style="${l}">${this.escapeHtml(y)}</td>`), a += 1;
4196
+ const p = [], m = [];
4197
+ for (let C = i.startCol; C <= i.endCol; C += 1) {
4198
+ const x = t.columns[C];
4199
+ if (!x) continue;
4200
+ const f = this.dataModel.getCell(u.id, x.key), g = this.cellToClipboardString(f);
4201
+ p.push(g), m.push(`<td style="${l}">${this.escapeHtml(g)}</td>`), a += 1;
4184
4202
  }
4185
- o.push(p.join(" ")), n.push(`<tr>${g.join("")}</tr>`);
4203
+ o.push(p.join(" ")), n.push(`<tr>${m.join("")}</tr>`);
4186
4204
  }
4187
4205
  const r = o.join(`\r
4188
- `), d = `<table style="${s}"><tbody>${n.join("")}</tbody></table>`;
4189
- return { text: r, html: d, cellCount: a };
4206
+ `), h = `<table style="${s}"><tbody>${n.join("")}</tbody></table>`;
4207
+ return { text: r, html: h, cellCount: a };
4190
4208
  }
4191
4209
  clearSelectionValues() {
4192
4210
  const t = this.dataModel.getSchema(), e = this.dataModel.listRows(), i = this.getCopyRange();
@@ -4198,14 +4216,14 @@ class Vo {
4198
4216
  for (let a = i.startCol; a <= i.endCol; a += 1) {
4199
4217
  const r = t.columns[a];
4200
4218
  if (!r || this.isCellReadonly(l.id, r.key)) continue;
4201
- const d = r.type === "boolean" ? !1 : "", h = {
4219
+ const h = r.type === "boolean" ? !1 : "", d = {
4202
4220
  kind: "edit",
4203
4221
  rowId: l.id,
4204
4222
  colKey: r.key,
4205
- next: d,
4223
+ next: h,
4206
4224
  payload: { batchId: n }
4207
4225
  };
4208
- this.onEdit(h, o);
4226
+ this.onEdit(d, o);
4209
4227
  }
4210
4228
  }
4211
4229
  }
@@ -4261,19 +4279,19 @@ class Vo {
4261
4279
  for (let a = 0; a < t.length; a += 1) {
4262
4280
  const r = i[o + a];
4263
4281
  if (!r) break;
4264
- const d = t[a] ?? [];
4265
- for (let h = 0; h < d.length; h += 1) {
4266
- const u = e.columns[n + h];
4282
+ const h = t[a] ?? [];
4283
+ for (let d = 0; d < h.length; d += 1) {
4284
+ const u = e.columns[n + d];
4267
4285
  if (!u) break;
4268
4286
  if (this.isCellReadonly(r.id, u.key)) continue;
4269
- const p = this.coerceCellValue(d[h] ?? "", u.key), g = {
4287
+ const p = this.coerceCellValue(h[d] ?? "", u.key), m = {
4270
4288
  kind: "edit",
4271
4289
  rowId: r.id,
4272
4290
  colKey: u.key,
4273
4291
  next: p,
4274
4292
  payload: { batchId: l }
4275
4293
  };
4276
- this.onEdit(g, s);
4294
+ this.onEdit(m, s);
4277
4295
  }
4278
4296
  }
4279
4297
  }
@@ -4305,26 +4323,26 @@ class Vo {
4305
4323
  if (i?.type === "enum" || i?.type === "tags") {
4306
4324
  const s = i.enum?.allowCustom ?? i.tags?.allowCustom, l = i.enum?.options ?? i.tags?.options ?? [];
4307
4325
  if (s === !1) {
4308
- const h = document.createElement("select"), u = document.createElement("option");
4309
- u.value = "", u.textContent = "", h.appendChild(u);
4326
+ const d = document.createElement("select"), u = document.createElement("option");
4327
+ u.value = "", u.textContent = "", d.appendChild(u);
4310
4328
  for (const p of l) {
4311
- const g = document.createElement("option");
4312
- g.value = p, g.textContent = p, e === p && (g.selected = !0), h.appendChild(g);
4329
+ const m = document.createElement("option");
4330
+ m.value = p, m.textContent = p, e === p && (m.selected = !0), d.appendChild(m);
4313
4331
  }
4314
- return { control: h, value: e };
4332
+ return { control: d, value: e };
4315
4333
  }
4316
4334
  const a = document.createElement("input");
4317
4335
  a.type = "text";
4318
4336
  const r = `extable-datalist-${String(t)}`;
4319
4337
  a.setAttribute("list", r), a.value = e;
4320
- let d = document.getElementById(r);
4321
- if (!d) {
4322
- d = document.createElement("datalist"), d.id = r;
4323
- for (const h of l) {
4338
+ let h = document.getElementById(r);
4339
+ if (!h) {
4340
+ h = document.createElement("datalist"), h.id = r;
4341
+ for (const d of l) {
4324
4342
  const u = document.createElement("option");
4325
- u.value = h, d.appendChild(u);
4343
+ u.value = d, h.appendChild(u);
4326
4344
  }
4327
- this.root.appendChild(d);
4345
+ this.root.appendChild(h);
4328
4346
  }
4329
4347
  return { control: a, value: e, datalistId: r };
4330
4348
  }
@@ -4346,7 +4364,7 @@ class Vo {
4346
4364
  return (s?.format ?? "decimal") === "scientific" ? kt(e, { format: "scientific", precision: s?.precision }) : kt(e, { format: "decimal", scale: s?.scale });
4347
4365
  }
4348
4366
  const n = i.format?.format ?? "decimal";
4349
- return n === "binary" || n === "octal" || n === "hex" ? $t(e, n) : String(e);
4367
+ return n === "binary" || n === "octal" || n === "hex" ? Wt(e, n) : String(e);
4350
4368
  }
4351
4369
  return String(e);
4352
4370
  }
@@ -4401,13 +4419,13 @@ class Vo {
4401
4419
  if (!o || o.type !== "tags") return !1;
4402
4420
  const n = this.dataModel.getCell(t, e), s = this.normalizeTagValues(n);
4403
4421
  if (!s || i < 0 || i >= s.length) return !1;
4404
- const l = s.filter((h, u) => u !== i), a = n && typeof n == "object" && n.kind === "tags" ? { kind: "tags", values: l } : l, r = {
4422
+ const l = s.filter((d, u) => u !== i), a = n && typeof n == "object" && n.kind === "tags" ? { kind: "tags", values: l } : l, r = {
4405
4423
  kind: "edit",
4406
4424
  rowId: t,
4407
4425
  colKey: e,
4408
4426
  next: a
4409
- }, d = this.editMode === "direct";
4410
- return this.onEdit(r, d), !0;
4427
+ }, h = this.editMode === "direct";
4428
+ return this.onEdit(r, h), !0;
4411
4429
  }
4412
4430
  normalizeTagValues(t) {
4413
4431
  if (Array.isArray(t) && t.every((e) => typeof e == "string"))
@@ -4429,11 +4447,27 @@ class Vo {
4429
4447
  i.href = t, i.target = e ?? "_self", i.rel = "noopener noreferrer", i.style.display = "none", document.body.appendChild(i), i.click(), i.remove();
4430
4448
  }
4431
4449
  toggleBoolean(t, e) {
4432
- const i = this.dataModel.getCell(t, e), s = { kind: "edit", rowId: t, colKey: e, next: !(i === !0 || i === "true" || i === "1" || i === 1) }, l = this.editMode === "direct";
4433
- this.onEdit(s, l), this.onMove(t);
4450
+ const i = this.dataModel.getCell(t, e), o = i === !0 || i === "true" || i === "1" || i === 1, n = this.findColumn(e), s = this.editMode === "direct";
4451
+ if (n && n.unique) {
4452
+ if (o)
4453
+ return;
4454
+ const r = `unique-bool:${Date.now()}:${Math.random().toString(16).slice(2)}`, h = [
4455
+ { kind: "edit", rowId: t, colKey: e, next: !0, payload: { batchId: r } }
4456
+ ], d = this.dataModel.listRows();
4457
+ for (const u of d) {
4458
+ if (!u || u.id === t) continue;
4459
+ const p = this.dataModel.getCell(u.id, e);
4460
+ (p === !0 || p === "true" || p === "1" || p === 1) && h.push({ kind: "edit", rowId: u.id, colKey: e, next: !1, payload: { batchId: r } });
4461
+ }
4462
+ for (const u of h) this.onEdit(u, s);
4463
+ this.onMove(t);
4464
+ return;
4465
+ }
4466
+ const a = { kind: "edit", rowId: t, colKey: e, next: !o };
4467
+ this.onEdit(a, s), this.onMove(t);
4434
4468
  }
4435
4469
  applySelectionFromHit(t, e) {
4436
- const i = this.dataModel.getSchema(), o = this.dataModel.getRowIndex(e.rowId), n = e.colKey === null, s = n ? i.columns.length > 0 ? 0 : -1 : i.columns.findIndex((d) => String(d.key) === String(e.colKey));
4470
+ const i = this.dataModel.getSchema(), o = this.dataModel.getRowIndex(e.rowId), n = e.colKey === null, s = n ? i.columns.length > 0 ? 0 : -1 : i.columns.findIndex((h) => String(h.key) === String(e.colKey));
4437
4471
  if (s < 0) return;
4438
4472
  const l = n ? {
4439
4473
  kind: "rows",
@@ -4450,16 +4484,16 @@ class Vo {
4450
4484
  };
4451
4485
  let a = [];
4452
4486
  if (t.shiftKey && this.activeCell) {
4453
- const d = this.activeCell, h = this.dataModel.getRowIndex(d.rowId), u = i.columns.findIndex((g) => String(g.key) === String(d.colKey));
4487
+ const h = this.activeCell, d = this.dataModel.getRowIndex(h.rowId), u = i.columns.findIndex((m) => String(m.key) === String(h.colKey));
4454
4488
  a = [n ? {
4455
4489
  kind: "rows",
4456
- startRow: h,
4490
+ startRow: d,
4457
4491
  endRow: o,
4458
4492
  startCol: 0,
4459
4493
  endCol: i.columns.length - 1
4460
4494
  } : {
4461
4495
  kind: "cells",
4462
- startRow: h,
4496
+ startRow: d,
4463
4497
  endRow: o,
4464
4498
  startCol: Math.max(0, u),
4465
4499
  endCol: Math.max(0, s)
@@ -4507,10 +4541,10 @@ class Vo {
4507
4541
  this.activeOriginalValue = { rowId: e, colKey: i, value: n };
4508
4542
  const s = o?.initialValueOverride ?? this.getInitialEditValue(i, n), { control: l, value: a } = this.createEditor(i, s), r = l;
4509
4543
  r.value = a;
4510
- const d = r instanceof HTMLInputElement && r.type === "checkbox";
4511
- r.style.width = "100%", r.style.boxSizing = "border-box", r.style.margin = "0", r.style.padding = d ? "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"), d && (r.style.width = "auto", r.style.lineHeight = "normal");
4512
- const h = this.findColumn(i);
4513
- if (r.style.textAlign = h?.style?.align ?? (h?.type === "number" || h?.type === "int" || h?.type === "uint" ? "right" : "left"), r.addEventListener("keydown", (u) => this.handleKey(u, t)), r.addEventListener("focus", () => {
4544
+ const h = r instanceof HTMLInputElement && r.type === "checkbox";
4545
+ 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");
4546
+ const d = this.findColumn(i);
4547
+ 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", () => {
4514
4548
  (r instanceof HTMLInputElement || r instanceof HTMLTextAreaElement) && r.select();
4515
4549
  }), this.bindImmediateCommit(r), t.textContent = "", t.appendChild(r), r.tagName.toLowerCase() === "textarea" && requestAnimationFrame(() => {
4516
4550
  r instanceof HTMLTextAreaElement && this.autosize(r);
@@ -4528,20 +4562,20 @@ class Vo {
4528
4562
  this.activeHost = s, this.activeHostOriginalText = null, s.style.position = "absolute", s.style.display = "block", s.style.visibility = "visible", s.dataset.extableFloating = "fixed", s.style.pointerEvents = "auto", s.style.padding = "0", s.style.zIndex = "10";
4529
4563
  const l = this.dataModel.getCell(e, i);
4530
4564
  this.activeOriginalValue = { rowId: e, colKey: i, value: l };
4531
- const a = o?.initialValueOverride ?? this.getInitialEditValue(i, l), { control: r, value: d } = this.createEditor(i, a), h = r;
4532
- h.value = d;
4533
- const u = h instanceof HTMLInputElement && h.type === "checkbox";
4534
- h.style.width = "100%", h.style.height = "100%", h.style.boxSizing = "border-box", h.style.margin = "0", h.style.padding = u ? "0" : "2px 4px", h.style.border = "none", h.style.borderRadius = "0", h.style.boxShadow = "none", h.style.background = "#fff", h.style.color = "#000", h.style.outline = "none", h.style.fontSize = "14px", h.style.fontFamily = "inherit", h.style.lineHeight = "16px", h.style.fontWeight = "inherit", h.style.WebkitAppearance = "none", h.style.WebkitBorderRadius = "0", h.style.WebkitBoxShadow = "none", h.style.WebkitUserSelect = "text", h.style.WebkitUserModify = "read-write", (h instanceof HTMLInputElement || h instanceof HTMLTextAreaElement) && (h.style.visibility = "visible", h.style.opacity = "1", h.style.display = "block"), u && (h.style.width = "auto", h.style.height = "auto", h.style.lineHeight = "normal");
4565
+ const a = o?.initialValueOverride ?? this.getInitialEditValue(i, l), { control: r, value: h } = this.createEditor(i, a), d = r;
4566
+ d.value = h;
4567
+ const u = d instanceof HTMLInputElement && d.type === "checkbox";
4568
+ 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");
4535
4569
  const p = this.findColumn(i);
4536
- if (h.style.textAlign = p?.style?.align ?? (p?.type === "number" || p?.type === "int" || p?.type === "uint" ? "right" : "left"), h.style.pointerEvents = "auto", h.addEventListener("keydown", (g) => this.handleKey(g, s)), h.addEventListener("compositionstart", this.handleInputCompositionStart), h.addEventListener("compositionend", this.handleInputCompositionEnd), h.addEventListener("focus", () => {
4537
- (h instanceof HTMLInputElement || h instanceof HTMLTextAreaElement) && h.select();
4538
- }), this.bindImmediateCommit(h), s.appendChild(h), h.tagName.toLowerCase() === "textarea" && requestAnimationFrame(() => {
4539
- h instanceof HTMLTextAreaElement && this.autosize(h);
4540
- }), this.root.appendChild(s), this.positionFloatingContentBox(n, s), h.focus({ preventScroll: !0 }), o?.placeCursorAtEnd && (h instanceof HTMLInputElement || h instanceof HTMLTextAreaElement)) {
4541
- const g = h.value.length;
4542
- h.setSelectionRange(g, g);
4570
+ 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", () => {
4571
+ (d instanceof HTMLInputElement || d instanceof HTMLTextAreaElement) && d.select();
4572
+ }), this.bindImmediateCommit(d), s.appendChild(d), d.tagName.toLowerCase() === "textarea" && requestAnimationFrame(() => {
4573
+ d instanceof HTMLTextAreaElement && this.autosize(d);
4574
+ }), this.root.appendChild(s), this.positionFloatingContentBox(n, s), d.focus({ preventScroll: !0 }), o?.placeCursorAtEnd && (d instanceof HTMLInputElement || d instanceof HTMLTextAreaElement)) {
4575
+ const m = d.value.length;
4576
+ d.setSelectionRange(m, m);
4543
4577
  }
4544
- this.inputEl = h, this.floatingInputWrapper = s, this.setupLookupEditor(e, i, h);
4578
+ this.inputEl = d, this.floatingInputWrapper = s, this.setupLookupEditor(e, i, d);
4545
4579
  }
4546
4580
  handleKey(t, e) {
4547
4581
  if (!this.activeCell || !this.inputEl) return;
@@ -4549,9 +4583,9 @@ class Vo {
4549
4583
  if (t.isComposing || this.composing || i - this.lastCompositionEnd < 24 || this.handleLookupKeydown(t)) return;
4550
4584
  const { rowId: o, colKey: n } = this.activeCell;
4551
4585
  if (n === null) return;
4552
- const s = this.inputEl.tagName.toLowerCase() === "textarea", l = t.key === "Enter" && t.altKey, a = (r, d) => {
4553
- const h = this.readActiveValueForCommit();
4554
- h.ok && (this.commitEdit(o, n, h.value), this.onMove(o), this.teardownInput(!1), this.moveActiveCell(r, d));
4586
+ const s = this.inputEl.tagName.toLowerCase() === "textarea", l = t.key === "Enter" && t.altKey, a = (r, h) => {
4587
+ const d = this.readActiveValueForCommit();
4588
+ d.ok && (this.commitEdit(o, n, d.value), this.onMove(o), this.teardownInput(!1), this.moveActiveCell(r, h));
4555
4589
  };
4556
4590
  if (t.key === "Tab") {
4557
4591
  t.preventDefault(), a(0, t.shiftKey ? -1 : 1);
@@ -4565,8 +4599,8 @@ class Vo {
4565
4599
  }
4566
4600
  if (t.key === "Escape") {
4567
4601
  if (t.preventDefault(), this.cancelEdit(e), this.onMove(), this.activeCell && this.activeCell.colKey !== null) {
4568
- const r = this.dataModel.getCell(this.activeCell.rowId, this.activeCell.colKey), d = this.cellToClipboardString(r);
4569
- this.focusSelectionInput(d);
4602
+ const r = this.dataModel.getCell(this.activeCell.rowId, this.activeCell.colKey), h = this.cellToClipboardString(r);
4603
+ this.focusSelectionInput(h);
4570
4604
  }
4571
4605
  } else t.key === "Backspace" && this.inputEl.value === "" && (t.preventDefault(), this.commitEdit(o, n, ""), this.onMove(o), this.teardownInput(!1), this.moveActiveCell(0, 0));
4572
4606
  }
@@ -4610,25 +4644,25 @@ class Vo {
4610
4644
  this.teardownInput(!1), t.blur();
4611
4645
  return;
4612
4646
  }
4613
- const { rowId: i, colKey: o } = e, n = this.activeOriginalValue && this.activeOriginalValue.rowId === i && this.activeOriginalValue.colKey === o ? this.activeOriginalValue.value : this.dataModel.getCell(i, o), s = this.dataModel.getCell(i, o), l = (d) => d ?? "", a = l(n), r = l(s);
4647
+ const { rowId: i, colKey: o } = e, n = this.activeOriginalValue && this.activeOriginalValue.rowId === i && this.activeOriginalValue.colKey === o ? this.activeOriginalValue.value : this.dataModel.getCell(i, o), s = this.dataModel.getCell(i, o), l = (h) => h ?? "", a = l(n), r = l(s);
4614
4648
  if (!Object.is(r, a)) {
4615
- const d = {
4649
+ const h = {
4616
4650
  kind: "edit",
4617
4651
  rowId: i,
4618
4652
  colKey: o,
4619
4653
  next: a,
4620
4654
  prev: r
4621
4655
  };
4622
- this.onEdit(d, !0);
4656
+ this.onEdit(h, !0);
4623
4657
  }
4624
4658
  this.teardownInput(!1), t.blur();
4625
4659
  }
4626
4660
  teardownInput(t = !1) {
4627
- this.teardownLookupEditor(), this.inputEl && this.inputEl !== this.selectionInput && $(this.inputEl), $(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());
4661
+ 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());
4628
4662
  }
4629
4663
  }
4630
- const $o = (c) => c;
4631
- class No {
4664
+ const Oo = (c) => c;
4665
+ class Po {
4632
4666
  constructor(t) {
4633
4667
  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;
4634
4668
  const e = t.defaultData ?? null, i = e ?? [];
@@ -4707,7 +4741,7 @@ class No {
4707
4741
  this.root.dataset.extable = "loading", this.bindViewport(), this.ensureFilterSort(), this.emitTableState(), this.emitSelection("data");
4708
4742
  return;
4709
4743
  }
4710
- this.selectionManager = new Vo(
4744
+ this.selectionManager = new No(
4711
4745
  e,
4712
4746
  this.editMode,
4713
4747
  (i, o) => this.handleEdit(i, o),
@@ -4866,7 +4900,7 @@ class No {
4866
4900
  const a = l;
4867
4901
  if (a.kind === "enum" && typeof a.value == "string") return a.value;
4868
4902
  if (a.kind === "tags" && Array.isArray(a.values))
4869
- return a.values.filter((d) => typeof d == "string").join(", ");
4903
+ return a.values.filter((h) => typeof h == "string").join(", ");
4870
4904
  }
4871
4905
  return String(l);
4872
4906
  }
@@ -5087,8 +5121,8 @@ class No {
5087
5121
  for (const r of Array.from(
5088
5122
  this.contextMenu.querySelectorAll("button[data-action]")
5089
5123
  )) {
5090
- const d = r.dataset.action;
5091
- d === "undo" ? r.disabled = !this.commandQueue.canUndo() : d === "redo" && (r.disabled = !this.commandQueue.canRedo());
5124
+ const h = r.dataset.action;
5125
+ h === "undo" ? r.disabled = !this.commandQueue.canUndo() : h === "redo" && (r.disabled = !this.commandQueue.canRedo());
5092
5126
  }
5093
5127
  const o = window.innerWidth, n = window.innerHeight, s = { width: 220, height: 160 };
5094
5128
  let l = e, a = i;
@@ -5161,7 +5195,7 @@ class No {
5161
5195
  }, document.addEventListener("pointerdown", this.handleGlobalPointer, !0);
5162
5196
  }
5163
5197
  unbindViewport() {
5164
- this.resizeHandler && window.removeEventListener("resize", this.resizeHandler), this.scrollHandler && this.getScrollHost().removeEventListener("scroll", this.scrollHandler), this.rafId !== null && (cancelAnimationFrame(this.rafId), this.rafId = null), this.handleGlobalPointer && (document.removeEventListener("pointerdown", this.handleGlobalPointer, !0), this.handleGlobalPointer = null), this.contextMenu && (this.contextMenu.hidePopover?.(), this.contextMenu.parentElement && $(this.contextMenu), this.contextMenu = null), this.toast && (this.toast.hidePopover?.(), this.toast.parentElement && $(this.toast), this.toast = null);
5198
+ this.resizeHandler && window.removeEventListener("resize", this.resizeHandler), this.scrollHandler && this.getScrollHost().removeEventListener("scroll", this.scrollHandler), this.rafId !== null && (cancelAnimationFrame(this.rafId), this.rafId = null), this.handleGlobalPointer && (document.removeEventListener("pointerdown", this.handleGlobalPointer, !0), this.handleGlobalPointer = null), this.contextMenu && (this.contextMenu.hidePopover?.(), this.contextMenu.parentElement && O(this.contextMenu), this.contextMenu = null), this.toast && (this.toast.hidePopover?.(), this.toast.parentElement && O(this.toast), this.toast = null);
5165
5199
  }
5166
5200
  remount(t) {
5167
5201
  this.unbindViewport(), this.teardownFilterSort(), this.selectionManager?.destroy(), this.renderer.destroy(), this.root = t, this.applyReadonlyClass(), this.shell = null, this.viewportEl = null, this.viewportResizeObserver?.disconnect(), this.viewportResizeObserver = null, this.renderer = this.chooseRenderer(this.renderMode), this.mounted = !1, this.mount(!0);
@@ -5170,8 +5204,8 @@ class No {
5170
5204
  getTableState() {
5171
5205
  const t = this.renderer instanceof St ? "html" : "canvas", e = this.commandQueue.listApplied(), i = this.editMode === "commit" ? e : [], o = i.length, n = (() => {
5172
5206
  const r = /* @__PURE__ */ new Set();
5173
- for (const d of i)
5174
- d.kind === "edit" && (!d.rowId || d.colKey === void 0 || r.add(`${d.rowId}::${String(d.colKey)}`));
5207
+ for (const h of i)
5208
+ h.kind === "edit" && (!h.rowId || h.colKey === void 0 || r.add(`${h.rowId}::${String(h.colKey)}`));
5175
5209
  return r.size;
5176
5210
  })(), s = this.dataModel.getValidationErrors().map((r) => ({
5177
5211
  scope: "validation",
@@ -5182,11 +5216,11 @@ class No {
5182
5216
  message: r.diag.message,
5183
5217
  target: { rowId: r.rowId, colKey: r.colKey }
5184
5218
  } : null).filter(Boolean);
5185
- l.sort((r, d) => {
5186
- const h = r.target?.rowId ? this.dataModel.getRowIndex(r.target.rowId) : -1, u = d.target?.rowId ? this.dataModel.getRowIndex(d.target.rowId) : -1;
5187
- if (h !== u) return h - u;
5188
- const p = r.target?.colKey !== void 0 ? this.dataModel.getColumnIndex(r.target.colKey) : -1, g = d.target?.colKey !== void 0 ? this.dataModel.getColumnIndex(d.target.colKey) : -1;
5189
- return p !== g ? p - g : r.scope !== d.scope ? r.scope < d.scope ? -1 : 1 : r.message < d.message ? -1 : r.message > d.message ? 1 : 0;
5219
+ l.sort((r, h) => {
5220
+ const d = r.target?.rowId ? this.dataModel.getRowIndex(r.target.rowId) : -1, u = h.target?.rowId ? this.dataModel.getRowIndex(h.target.rowId) : -1;
5221
+ if (d !== u) return d - u;
5222
+ 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;
5223
+ 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;
5190
5224
  });
5191
5225
  const a = [
5192
5226
  ...s,
@@ -5224,8 +5258,8 @@ class No {
5224
5258
  }
5225
5259
  // Public API: selection callbacks
5226
5260
  getSelectionSnapshot() {
5227
- 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((f) => String(f.key) === String(n)) : null, a = l !== null && l >= 0 ? e.columns[l] : null, r = o && a ? this.dataModel.resolveCellValue(o, a) : null, d = o && a ? this.dataModel.resolveConditionalStyle(o, a) : null, h = r?.textOverride ?? (d?.forceErrorText ? "#ERROR" : void 0), u = r ? r.value : null, p = (() => {
5228
- if (h) return h;
5261
+ 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((f) => String(f.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 = (() => {
5262
+ if (d) return d;
5229
5263
  const f = u;
5230
5264
  if (a?.type === "button")
5231
5265
  return at(f) || (f == null ? "" : String(f));
@@ -5236,21 +5270,21 @@ class No {
5236
5270
  if (typeof f == "string") return f;
5237
5271
  if (typeof f == "number" || typeof f == "boolean") return String(f);
5238
5272
  if (typeof f == "object") {
5239
- const y = f, m = y.kind;
5240
- if (m === "enum" && typeof y.value == "string") return y.value;
5241
- if (m === "tags" && Array.isArray(y.values))
5242
- return y.values.filter((w) => typeof w == "string").join(", ");
5273
+ const g = f, y = g.kind;
5274
+ if (y === "enum" && typeof g.value == "string") return g.value;
5275
+ if (y === "tags" && Array.isArray(g.values))
5276
+ return g.values.filter((w) => typeof w == "string").join(", ");
5243
5277
  }
5244
5278
  return String(f);
5245
- })(), g = a?.type ?? null, v = o && n !== null ? this.dataModel.getCellDiagnostic(o, n) : null, C = (() => {
5279
+ })(), m = a?.type ?? null, C = o && n !== null ? this.dataModel.getCellDiagnostic(o, n) : null, x = (() => {
5246
5280
  if (!o || !a)
5247
5281
  return { columnStyle: {}, cellStyle: {}, resolved: {} };
5248
- const { columnStyle: f, cellStyle: y, resolved: m } = je(
5282
+ const { columnStyle: f, cellStyle: g, resolved: y } = je(
5249
5283
  this.dataModel,
5250
5284
  o,
5251
5285
  a
5252
5286
  );
5253
- return { columnStyle: f, cellStyle: y, resolved: m };
5287
+ return { columnStyle: f, cellStyle: g, resolved: y };
5254
5288
  })();
5255
5289
  return {
5256
5290
  ranges: [...t],
@@ -5260,10 +5294,10 @@ class No {
5260
5294
  activeColumnKey: n,
5261
5295
  activeValueRaw: u,
5262
5296
  activeValueDisplay: p,
5263
- activeValueType: g,
5264
- diagnostic: v,
5297
+ activeValueType: m,
5298
+ diagnostic: C,
5265
5299
  action: this.lastAction,
5266
- styles: C
5300
+ styles: x
5267
5301
  };
5268
5302
  }
5269
5303
  subscribeSelection(t) {
@@ -5328,17 +5362,17 @@ class No {
5328
5362
  for (const n of this.selectionRanges) {
5329
5363
  if (n.kind !== "cells") continue;
5330
5364
  const s = Math.min(n.startRow, n.endRow), l = Math.max(n.startRow, n.endRow), a = Math.min(n.startCol, n.endCol), r = Math.max(n.startCol, n.endCol);
5331
- for (let d = s; d <= l; d += 1) {
5332
- const h = i[d];
5333
- if (h)
5365
+ for (let h = s; h <= l; h += 1) {
5366
+ const d = i[h];
5367
+ if (d)
5334
5368
  for (let u = a; u <= r; u += 1) {
5335
5369
  const p = e.columns[u];
5336
5370
  if (!p) continue;
5337
- const g = `${h.id}::${String(p.key)}`;
5338
- if (o.has(g) || (o.add(g), this.isCellReadonly(h.id, p.key))) continue;
5339
- const v = this.dataModel.getCell(h.id, p.key), C = typeof t == "function" ? t(v) : t;
5371
+ const m = `${d.id}::${String(p.key)}`;
5372
+ if (o.has(m) || (o.add(m), this.isCellReadonly(d.id, p.key))) continue;
5373
+ const C = this.dataModel.getCell(d.id, p.key), x = typeof t == "function" ? t(C) : t;
5340
5374
  this.handleEdit(
5341
- { kind: "edit", rowId: h.id, colKey: p.key, next: C },
5375
+ { kind: "edit", rowId: d.id, colKey: p.key, next: x },
5342
5376
  this.editMode === "direct"
5343
5377
  );
5344
5378
  }
@@ -5427,17 +5461,17 @@ class No {
5427
5461
  `, t.appendChild(e), this.filterSortSidebar = e;
5428
5462
  const i = e.querySelector('button[data-extable-fs="close"]'), o = e.querySelector('input[data-extable-fs="col-errors"]'), n = e.querySelector(
5429
5463
  'input[data-extable-fs="col-warnings"]'
5430
- ), s = e.querySelector('input[data-extable-fs="search"]'), l = e.querySelector('[data-extable-fs="values"]'), a = e.querySelector('button[data-extable-fs="select-all"]'), r = e.querySelector('button[data-extable-fs="select-none"]'), d = e.querySelector(
5464
+ ), s = e.querySelector('input[data-extable-fs="search"]'), l = e.querySelector('[data-extable-fs="values"]'), a = e.querySelector('button[data-extable-fs="select-all"]'), r = e.querySelector('button[data-extable-fs="select-none"]'), h = e.querySelector(
5431
5465
  'button[data-extable-fs="apply-filter"]'
5432
- ), h = e.querySelector(
5466
+ ), d = e.querySelector(
5433
5467
  'button[data-extable-fs="clear-filter"]'
5434
5468
  ), u = e.querySelector('button[data-extable-fs="sort-asc"]'), p = e.querySelector(
5435
5469
  'button[data-extable-fs="sort-desc"]'
5436
- ), g = e.querySelector(
5470
+ ), m = e.querySelector(
5437
5471
  'button[data-extable-fs="clear-sort"]'
5438
5472
  );
5439
- if (!i || !o || !n || !s || !l || !a || !r || !d || !h || !u || !p || !g) {
5440
- $(e), this.filterSortSidebar = null;
5473
+ if (!i || !o || !n || !s || !l || !a || !r || !h || !d || !u || !p || !m) {
5474
+ O(e), this.filterSortSidebar = null;
5441
5475
  return;
5442
5476
  }
5443
5477
  i.addEventListener("click", () => this.hideFilterSortPanel()), o.addEventListener("change", () => {
@@ -5446,18 +5480,18 @@ class No {
5446
5480
  this.filterSortDraft && (this.filterSortDraft.diagWarnings = n.checked);
5447
5481
  }), s.addEventListener("input", () => {
5448
5482
  this.filterSortDraft && (this.filterSortDraft.search = s.value, this.renderFilterSortValues());
5449
- }), l.addEventListener("change", (v) => {
5450
- const C = v.target?.closest(
5483
+ }), l.addEventListener("change", (C) => {
5484
+ const x = C.target?.closest(
5451
5485
  'input[type="checkbox"][data-fs-val]'
5452
5486
  );
5453
- if (!C || !this.filterSortDraft) return;
5454
- const f = C.dataset.fsVal ?? "";
5455
- f && (f === "__blanks__" ? this.filterSortDraft.includeBlanks = C.checked : C.checked ? this.filterSortDraft.selected.add(f) : this.filterSortDraft.selected.delete(f));
5487
+ if (!x || !this.filterSortDraft) return;
5488
+ const f = x.dataset.fsVal ?? "";
5489
+ f && (f === "__blanks__" ? this.filterSortDraft.includeBlanks = x.checked : x.checked ? this.filterSortDraft.selected.add(f) : this.filterSortDraft.selected.delete(f));
5456
5490
  }), a.addEventListener("click", () => {
5457
- this.filterSortDraft && (this.filterSortDraft.selected = new Set(this.filterSortDraft.values.map((v) => v.key)), this.filterSortDraft.includeBlanks = this.filterSortDraft.hasBlanks, this.renderFilterSortValues());
5491
+ this.filterSortDraft && (this.filterSortDraft.selected = new Set(this.filterSortDraft.values.map((C) => C.key)), this.filterSortDraft.includeBlanks = this.filterSortDraft.hasBlanks, this.renderFilterSortValues());
5458
5492
  }), r.addEventListener("click", () => {
5459
5493
  this.filterSortDraft && (this.filterSortDraft.selected = /* @__PURE__ */ new Set(), this.filterSortDraft.includeBlanks = !1, this.renderFilterSortValues());
5460
- }), d.addEventListener("click", () => this.applyFilterSortDraft()), h.addEventListener("click", () => this.clearFilterSortForActiveColumn()), u.addEventListener("click", () => this.setSortForActiveColumn("asc")), p.addEventListener("click", () => this.setSortForActiveColumn("desc")), g.addEventListener("click", () => this.clearSort()), this.filterSortSidebarUnsub = this.dataModel.subscribe(() => {
5494
+ }), 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(() => {
5461
5495
  this.isFilterSortPanelVisible() && this.filterSortActiveColumnKey && (this.buildFilterSortDraft(this.filterSortActiveColumnKey), this.renderFilterSortSidebar());
5462
5496
  });
5463
5497
  }
@@ -5483,15 +5517,15 @@ class No {
5483
5517
  for (const u of a.values ?? []) r.add(this.stableValueKey(u));
5484
5518
  else
5485
5519
  for (const u of l) r.add(u.key);
5486
- const d = a ? !!a.includeBlanks : s.hasBlanks, h = e.columnDiagnostics?.[String(o.key)];
5520
+ const h = a ? !!a.includeBlanks : s.hasBlanks, d = e.columnDiagnostics?.[String(o.key)];
5487
5521
  this.filterSortDraft = {
5488
5522
  colKey: o.key,
5489
5523
  values: l,
5490
5524
  hasBlanks: s.hasBlanks,
5491
5525
  selected: r,
5492
- includeBlanks: d,
5493
- diagErrors: !!h?.errors,
5494
- diagWarnings: !!h?.warnings,
5526
+ includeBlanks: h,
5527
+ diagErrors: !!d?.errors,
5528
+ diagWarnings: !!d?.warnings,
5495
5529
  search: n
5496
5530
  };
5497
5531
  }
@@ -5514,8 +5548,8 @@ class No {
5514
5548
  t.textContent = "Sort/Filter", e.checked = !1, i.checked = !1, o.value = "", n && (n.dataset.active = "0"), s && (s.dataset.active = "0"), this.renderFilterSortValues();
5515
5549
  return;
5516
5550
  }
5517
- const d = this.dataModel.getSchema().columns.find((p) => String(p.key) === String(l.colKey))?.header ?? String(l.colKey);
5518
- t.textContent = `Sort/Filter: ${d}`, e.checked = l.diagErrors, i.checked = l.diagWarnings, o.value = l.search;
5551
+ const h = this.dataModel.getSchema().columns.find((p) => String(p.key) === String(l.colKey))?.header ?? String(l.colKey);
5552
+ t.textContent = `Sort/Filter: ${h}`, e.checked = l.diagErrors, i.checked = l.diagWarnings, o.value = l.search;
5519
5553
  const u = this.dataModel.getView().sorts?.find((p) => String(p.key) === String(l.colKey));
5520
5554
  n && (n.dataset.active = u?.dir === "asc" ? "1" : "0"), s && (s.dataset.active = u?.dir === "desc" ? "1" : "0"), this.renderFilterSortValues();
5521
5555
  }
@@ -5598,7 +5632,7 @@ class No {
5598
5632
  this.setView(e), this.filterSortActiveColumnKey !== null && (this.buildFilterSortDraft(this.filterSortActiveColumnKey), this.renderFilterSortSidebar());
5599
5633
  }
5600
5634
  teardownFilterSort() {
5601
- this.filterSortSidebarUnsub?.(), this.filterSortSidebarUnsub = null, this.filterSortSidebar && ($(this.filterSortSidebar), this.filterSortSidebar = null), this.filterSortKeydown && (document.removeEventListener("keydown", this.filterSortKeydown, !0), this.filterSortKeydown = null), this.filterSortClickCapture && ((this.viewportEl ?? this.root).removeEventListener(
5635
+ this.filterSortSidebarUnsub?.(), this.filterSortSidebarUnsub = null, this.filterSortSidebar && (O(this.filterSortSidebar), this.filterSortSidebar = null), this.filterSortKeydown && (document.removeEventListener("keydown", this.filterSortKeydown, !0), this.filterSortKeydown = null), this.filterSortClickCapture && ((this.viewportEl ?? this.root).removeEventListener(
5602
5636
  "click",
5603
5637
  this.filterSortClickCapture,
5604
5638
  !0
@@ -5640,8 +5674,8 @@ class No {
5640
5674
  this.rafId = null, this.viewportState && (this.selectionManager?.onScroll(this.viewportState.scrollTop, this.viewportState.scrollLeft), !(this.renderer instanceof St) && this.safeRender(this.viewportState));
5641
5675
  }
5642
5676
  }
5643
- function Wo(c, t) {
5644
- return new No({
5677
+ function jo(c, t) {
5678
+ return new Po({
5645
5679
  root: document.createElement("div"),
5646
5680
  defaultData: c.data,
5647
5681
  defaultView: c.view,
@@ -5649,13 +5683,13 @@ function Wo(c, t) {
5649
5683
  options: t
5650
5684
  });
5651
5685
  }
5652
- function Oo(c, t) {
5686
+ function qo(c, t) {
5653
5687
  return t.remount(c), t;
5654
5688
  }
5655
5689
  export {
5656
- No as ExtableCore,
5657
- Wo as createTablePlaceholder,
5658
- $o as defineSchema,
5659
- Oo as mountTable
5690
+ Po as ExtableCore,
5691
+ jo as createTablePlaceholder,
5692
+ Oo as defineSchema,
5693
+ qo as mountTable
5660
5694
  };
5661
5695
  //# sourceMappingURL=index.js.map