bank20baht-ui 0.4.0 → 0.4.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,20 +1,20 @@
1
- import { nothing as h, html as n, svg as A } from "lit";
2
- import { property as l, customElement as u, state as y, query as Et } from "lit/decorators.js";
3
- import { B as $, b as ne, h as q, a as W } from "./base-CajA2aCO.js";
4
- import { t as v } from "./i18n-BcPL9_Jh.js";
5
- import { n as ve, k as Lt, o as ps, i as Rt, p as ds, d as se, a as as, m as Me, v as Ae, c as us, g as bs, l as fs } from "./display-DQRcvsn7.js";
6
- import { repeat as Oe } from "lit/directives/repeat.js";
7
- import { html as ee, unsafeStatic as is } from "lit/static-html.js";
8
- import { c as ms, r as U } from "./baht-toast-CD1WrOYr.js";
9
- import { live as rt } from "lit/directives/live.js";
10
- import { ifDefined as L } from "lit/directives/if-defined.js";
11
- import vs from "flatpickr";
12
- var $s = Object.defineProperty, ys = Object.getOwnPropertyDescriptor, he = (t, e, i, a) => {
13
- for (var s = a > 1 ? void 0 : a ? ys(e, i) : e, r = t.length - 1, o; r >= 0; r--)
1
+ import { nothing as h, html as n, svg as L } from "lit";
2
+ import { property as l, customElement as b, state as y, query as It } from "lit/decorators.js";
3
+ import { B as g, b as he, h as S, a as Y } from "./base-CajA2aCO.js";
4
+ import { t as m } from "./i18n-BcPL9_Jh.js";
5
+ import { n as $e, k as Nt, o as ds, i as zt, p as us, d as ae, a as rs, m as Ae, v as Le, c as bs, g as fs, l as ms } from "./display-DQRcvsn7.js";
6
+ import { repeat as Ce } from "lit/directives/repeat.js";
7
+ import { html as se, unsafeStatic as os } from "lit/static-html.js";
8
+ import { c as vs, r as W } from "./baht-toast-CD1WrOYr.js";
9
+ import { live as lt } from "lit/directives/live.js";
10
+ import { ifDefined as N } from "lit/directives/if-defined.js";
11
+ import $s from "flatpickr";
12
+ var ys = Object.defineProperty, gs = Object.getOwnPropertyDescriptor, ce = (t, e, i, a) => {
13
+ for (var s = a > 1 ? void 0 : a ? gs(e, i) : e, r = t.length - 1, o; r >= 0; r--)
14
14
  (o = t[r]) && (s = (a ? o(e, i, s) : o(s)) || s);
15
- return a && s && $s(e, i, s), s;
15
+ return a && s && ys(e, i, s), s;
16
16
  };
17
- let zt = class extends $ {
17
+ let Vt = class extends g {
18
18
  constructor() {
19
19
  super(...arguments), this.tone = "neutral", this.label = "", this.dot = null;
20
20
  }
@@ -28,50 +28,50 @@ let zt = class extends $ {
28
28
  </span>`;
29
29
  }
30
30
  };
31
- he([
31
+ ce([
32
32
  l()
33
- ], zt.prototype, "tone", 2);
34
- he([
33
+ ], Vt.prototype, "tone", 2);
34
+ ce([
35
35
  l()
36
- ], zt.prototype, "label", 2);
37
- he([
36
+ ], Vt.prototype, "label", 2);
37
+ ce([
38
38
  l({ attribute: !1 })
39
- ], zt.prototype, "dot", 2);
40
- zt = he([
41
- u("baht-badge")
42
- ], zt);
43
- var gs = Object.defineProperty, ws = Object.getOwnPropertyDescriptor, Ie = (t, e, i, a) => {
44
- for (var s = a > 1 ? void 0 : a ? ws(e, i) : e, r = t.length - 1, o; r >= 0; r--)
39
+ ], Vt.prototype, "dot", 2);
40
+ Vt = ce([
41
+ b("baht-badge")
42
+ ], Vt);
43
+ var ws = Object.defineProperty, xs = Object.getOwnPropertyDescriptor, Me = (t, e, i, a) => {
44
+ for (var s = a > 1 ? void 0 : a ? xs(e, i) : e, r = t.length - 1, o; r >= 0; r--)
45
45
  (o = t[r]) && (s = (a ? o(e, i, s) : o(s)) || s);
46
- return a && s && gs(e, i, s), s;
46
+ return a && s && ws(e, i, s), s;
47
47
  };
48
- let ae = class extends $ {
48
+ let ie = class extends g {
49
49
  constructor() {
50
50
  super(...arguments), this.variant = "inline", this.code = "";
51
51
  }
52
52
  firstUpdated() {
53
53
  const t = this.renderRoot.querySelector(this.variant === "block" ? "pre" : "code");
54
- t && ne(this, t);
54
+ t && he(this, t);
55
55
  }
56
56
  render() {
57
57
  return this.variant === "block" ? n`<pre class="baht-code baht-code--block" tabindex="0">${this.code}</pre>` : n`<code class="baht-code">${this.code}</code>`;
58
58
  }
59
59
  };
60
- Ie([
60
+ Me([
61
61
  l()
62
- ], ae.prototype, "variant", 2);
63
- Ie([
62
+ ], ie.prototype, "variant", 2);
63
+ Me([
64
64
  l()
65
- ], ae.prototype, "code", 2);
66
- ae = Ie([
67
- u("baht-code")
68
- ], ae);
69
- var xs = Object.defineProperty, _s = Object.getOwnPropertyDescriptor, $t = (t, e, i, a) => {
70
- for (var s = a > 1 ? void 0 : a ? _s(e, i) : e, r = t.length - 1, o; r >= 0; r--)
65
+ ], ie.prototype, "code", 2);
66
+ ie = Me([
67
+ b("baht-code")
68
+ ], ie);
69
+ var _s = Object.defineProperty, ks = Object.getOwnPropertyDescriptor, gt = (t, e, i, a) => {
70
+ for (var s = a > 1 ? void 0 : a ? ks(e, i) : e, r = t.length - 1, o; r >= 0; r--)
71
71
  (o = t[r]) && (s = (a ? o(e, i, s) : o(s)) || s);
72
- return a && s && xs(e, i, s), s;
72
+ return a && s && _s(e, i, s), s;
73
73
  };
74
- let nt = class extends $ {
74
+ let ht = class extends g {
75
75
  constructor() {
76
76
  super(...arguments), this.page = 1, this.totalPages = 1, this.variant = "numbered", this.siblings = 1, this.hasNext = !1, this.hasPrev = !1;
77
77
  }
@@ -99,7 +99,7 @@ let nt = class extends $ {
99
99
  const { page: t, totalPages: e, siblings: i } = this, a = /* @__PURE__ */ new Set([1, e]);
100
100
  for (let c = t - i; c <= t + i; c++)
101
101
  c >= 1 && c <= e && a.add(c);
102
- const s = [...a].sort((c, m) => c - m), r = [];
102
+ const s = [...a].sort((c, f) => c - f), r = [];
103
103
  let o = 0;
104
104
  for (const c of s)
105
105
  o && c - o === 2 ? r.push(o + 1) : o && c - o > 2 && r.push(null), r.push(c), o = c;
@@ -126,34 +126,34 @@ let nt = class extends $ {
126
126
  </nav>`;
127
127
  }
128
128
  };
129
- $t([
129
+ gt([
130
130
  l({ type: Number })
131
- ], nt.prototype, "page", 2);
132
- $t([
131
+ ], ht.prototype, "page", 2);
132
+ gt([
133
133
  l({ type: Number, attribute: "total-pages" })
134
- ], nt.prototype, "totalPages", 2);
135
- $t([
134
+ ], ht.prototype, "totalPages", 2);
135
+ gt([
136
136
  l()
137
- ], nt.prototype, "variant", 2);
138
- $t([
137
+ ], ht.prototype, "variant", 2);
138
+ gt([
139
139
  l({ type: Number })
140
- ], nt.prototype, "siblings", 2);
141
- $t([
140
+ ], ht.prototype, "siblings", 2);
141
+ gt([
142
142
  l({ type: Boolean, attribute: "has-next" })
143
- ], nt.prototype, "hasNext", 2);
144
- $t([
143
+ ], ht.prototype, "hasNext", 2);
144
+ gt([
145
145
  l({ type: Boolean, attribute: "has-prev" })
146
- ], nt.prototype, "hasPrev", 2);
147
- nt = $t([
148
- u("baht-pagination")
149
- ], nt);
150
- var ks = Object.defineProperty, Ps = Object.getOwnPropertyDescriptor, C = (t, e, i, a) => {
151
- for (var s = a > 1 ? void 0 : a ? Ps(e, i) : e, r = t.length - 1, o; r >= 0; r--)
146
+ ], ht.prototype, "hasPrev", 2);
147
+ ht = gt([
148
+ b("baht-pagination")
149
+ ], ht);
150
+ var Ps = Object.defineProperty, Os = Object.getOwnPropertyDescriptor, O = (t, e, i, a) => {
151
+ for (var s = a > 1 ? void 0 : a ? Os(e, i) : e, r = t.length - 1, o; r >= 0; r--)
152
152
  (o = t[r]) && (s = (a ? o(e, i, s) : o(s)) || s);
153
- return a && s && ks(e, i, s), s;
153
+ return a && s && Ps(e, i, s), s;
154
154
  };
155
- const Os = " › ", $e = (t) => t !== null && typeof t == "object" && !Array.isArray(t) && !(t instanceof Date), te = (t) => t.replace(/_/g, " ").replace(/\b\w/g, (e) => e.toUpperCase());
156
- let P = class extends $ {
155
+ const Cs = " › ", ye = (t) => t !== null && typeof t == "object" && !Array.isArray(t) && !(t instanceof Date), ee = (t) => t.replace(/_/g, " ").replace(/\b\w/g, (e) => e.toUpperCase());
156
+ let k = class extends g {
157
157
  constructor() {
158
158
  super(...arguments), this.items = [], this.columns = {}, this.loading = !1, this.error = !1, this.errorMessage = "Couldn't load data. Try again.", this.emptyMessage = "No records yet.", this.showIndex = !0, this.indexOffset = 0, this.skeletonRows = 10, this.rowKey = "", this.clickable = !0, this.renderers = {}, this.visibleColumns = [], this.columnPicker = !0, this.page = 1, this.totalPages = 1, this.cursorMode = !1, this.hasNext = !1, this.hasPrev = !1, this.pickerOpen = !1, this.pickedColumns = null, this.draftColumns = [], this.pickAvail = [], this.pickSel = [], this.expanded = [], this.pickerPreviousFocus = null, this.onPickerKeydown = (t) => {
159
159
  t.key === "Escape" ? this.closePicker() : t.key === "Tab" && this.trapPickerFocus(t);
@@ -178,7 +178,7 @@ let P = class extends $ {
178
178
  r != null && r.contains(s) ? t.shiftKey && s === i ? (a.focus(), t.preventDefault()) : !t.shiftKey && s === a && (i.focus(), t.preventDefault()) : (i.focus(), t.preventDefault());
179
179
  }
180
180
  disconnectedCallback() {
181
- super.disconnectedCallback(), q() && document.removeEventListener("keydown", this.onPickerKeydown);
181
+ super.disconnectedCallback(), S() && document.removeEventListener("keydown", this.onPickerKeydown);
182
182
  }
183
183
  willUpdate(t) {
184
184
  t.has("visibleColumns") && !t.has("columns") && (this.pickedColumns = null);
@@ -191,10 +191,10 @@ let P = class extends $ {
191
191
  if (!t) return {};
192
192
  const e = {};
193
193
  for (const [i, a] of Object.entries(t))
194
- e[i] = $e(a) ? {
195
- label: te(i),
196
- fields: Object.fromEntries(Object.keys(a).map((s) => [s, te(s)]))
197
- } : te(i);
194
+ e[i] = ye(a) ? {
195
+ label: ee(i),
196
+ fields: Object.fromEntries(Object.keys(a).map((s) => [s, ee(s)]))
197
+ } : ee(i);
198
198
  return e;
199
199
  }
200
200
  /** Walk a dotted key through the spec; undefined when no such column exists. */
@@ -233,25 +233,25 @@ let P = class extends $ {
233
233
  for (const a of t.split(".")) {
234
234
  const s = i == null ? void 0 : i[a];
235
235
  if (s === void 0) {
236
- e.push(te(a)), i = void 0;
236
+ e.push(ee(a)), i = void 0;
237
237
  continue;
238
238
  }
239
239
  e.push(typeof s == "string" ? s : s.label), i = typeof s == "string" ? void 0 : s.fields;
240
240
  }
241
- return e.join(Os);
241
+ return e.join(Cs);
242
242
  }
243
243
  /** The row's value at a dotted key (`requester.department`). */
244
244
  static valueAt(t, e) {
245
245
  let i = t;
246
246
  for (const a of e.split(".")) {
247
- if (!$e(i)) return;
247
+ if (!ye(i)) return;
248
248
  i = i[a];
249
249
  }
250
250
  return i;
251
251
  }
252
252
  // ---- picker -----------------------------------------------------------
253
253
  openPicker() {
254
- this.draftColumns = this.columnKeys.slice(), this.pickAvail = [], this.pickSel = [], this.pickerOpen = !0, this.pickerPreviousFocus = document.activeElement, q() && document.addEventListener("keydown", this.onPickerKeydown), this.updateComplete.then(() => {
254
+ this.draftColumns = this.columnKeys.slice(), this.pickAvail = [], this.pickSel = [], this.pickerOpen = !0, this.pickerPreviousFocus = document.activeElement, S() && document.addEventListener("keydown", this.onPickerKeydown), this.updateComplete.then(() => {
255
255
  var t;
256
256
  this.pickerOpen && ((t = this.pickerFocusables()[0]) == null || t.focus());
257
257
  });
@@ -259,7 +259,7 @@ let P = class extends $ {
259
259
  closePicker() {
260
260
  var e;
261
261
  if (!this.pickerOpen) return;
262
- this.pickerOpen = !1, q() && document.removeEventListener("keydown", this.onPickerKeydown);
262
+ this.pickerOpen = !1, S() && document.removeEventListener("keydown", this.onPickerKeydown);
263
263
  const t = this.pickerPreviousFocus;
264
264
  this.pickerPreviousFocus = null, t != null && t.isConnected && ((e = t.focus) == null || e.call(t));
265
265
  }
@@ -309,9 +309,9 @@ let P = class extends $ {
309
309
  );
310
310
  }
311
311
  cell(t, e) {
312
- const i = this.renderers[e], a = P.valueAt(t, e);
312
+ const i = this.renderers[e], a = k.valueAt(t, e);
313
313
  if (i) return i(a, t);
314
- if ($e(a)) {
314
+ if (ye(a)) {
315
315
  const s = a.name ?? a.label ?? a.title ?? a.id;
316
316
  return s == null ? "" : String(s);
317
317
  }
@@ -380,7 +380,7 @@ let P = class extends $ {
380
380
  </li>`;
381
381
  }
382
382
  renderColumnModal() {
383
- const t = this.allColumnKeys, e = this.allPaths().filter((a) => !this.draftColumns.includes(a)).length, i = (a) => (s) => a(P.selectedValues(s));
383
+ const t = this.allColumnKeys, e = this.allPaths().filter((a) => !this.draftColumns.includes(a)).length, i = (a) => (s) => a(k.selectedValues(s));
384
384
  return n`<div
385
385
  class="baht-table-picker-scrim"
386
386
  @click=${(a) => a.target === a.currentTarget && this.closePicker()}
@@ -456,90 +456,90 @@ let P = class extends $ {
456
456
  </div>`;
457
457
  }
458
458
  };
459
- C([
459
+ O([
460
460
  l({ attribute: !1 })
461
- ], P.prototype, "items", 2);
462
- C([
461
+ ], k.prototype, "items", 2);
462
+ O([
463
463
  l({ attribute: !1 })
464
- ], P.prototype, "columns", 2);
465
- C([
464
+ ], k.prototype, "columns", 2);
465
+ O([
466
466
  l({ type: Boolean })
467
- ], P.prototype, "loading", 2);
468
- C([
467
+ ], k.prototype, "loading", 2);
468
+ O([
469
469
  l({ type: Boolean })
470
- ], P.prototype, "error", 2);
471
- C([
470
+ ], k.prototype, "error", 2);
471
+ O([
472
472
  l({ attribute: "error-message" })
473
- ], P.prototype, "errorMessage", 2);
474
- C([
473
+ ], k.prototype, "errorMessage", 2);
474
+ O([
475
475
  l({ attribute: "empty-message" })
476
- ], P.prototype, "emptyMessage", 2);
477
- C([
476
+ ], k.prototype, "emptyMessage", 2);
477
+ O([
478
478
  l({ type: Boolean, attribute: "show-index" })
479
- ], P.prototype, "showIndex", 2);
480
- C([
479
+ ], k.prototype, "showIndex", 2);
480
+ O([
481
481
  l({ type: Number, attribute: "index-offset" })
482
- ], P.prototype, "indexOffset", 2);
483
- C([
482
+ ], k.prototype, "indexOffset", 2);
483
+ O([
484
484
  l({ type: Number, attribute: "skeleton-rows" })
485
- ], P.prototype, "skeletonRows", 2);
486
- C([
485
+ ], k.prototype, "skeletonRows", 2);
486
+ O([
487
487
  l({ attribute: "row-key" })
488
- ], P.prototype, "rowKey", 2);
489
- C([
488
+ ], k.prototype, "rowKey", 2);
489
+ O([
490
490
  l({ type: Boolean })
491
- ], P.prototype, "clickable", 2);
492
- C([
491
+ ], k.prototype, "clickable", 2);
492
+ O([
493
493
  l({ attribute: !1 })
494
- ], P.prototype, "renderers", 2);
495
- C([
494
+ ], k.prototype, "renderers", 2);
495
+ O([
496
496
  l({ attribute: !1 })
497
- ], P.prototype, "visibleColumns", 2);
498
- C([
497
+ ], k.prototype, "visibleColumns", 2);
498
+ O([
499
499
  l({ type: Boolean, attribute: "column-picker" })
500
- ], P.prototype, "columnPicker", 2);
501
- C([
500
+ ], k.prototype, "columnPicker", 2);
501
+ O([
502
502
  l({ type: Number })
503
- ], P.prototype, "page", 2);
504
- C([
503
+ ], k.prototype, "page", 2);
504
+ O([
505
505
  l({ type: Number, attribute: "total-pages" })
506
- ], P.prototype, "totalPages", 2);
507
- C([
506
+ ], k.prototype, "totalPages", 2);
507
+ O([
508
508
  l({ type: Boolean, attribute: "cursor-mode" })
509
- ], P.prototype, "cursorMode", 2);
510
- C([
509
+ ], k.prototype, "cursorMode", 2);
510
+ O([
511
511
  l({ type: Boolean, attribute: "has-next" })
512
- ], P.prototype, "hasNext", 2);
513
- C([
512
+ ], k.prototype, "hasNext", 2);
513
+ O([
514
514
  l({ type: Boolean, attribute: "has-prev" })
515
- ], P.prototype, "hasPrev", 2);
516
- C([
515
+ ], k.prototype, "hasPrev", 2);
516
+ O([
517
517
  y()
518
- ], P.prototype, "pickerOpen", 2);
519
- C([
518
+ ], k.prototype, "pickerOpen", 2);
519
+ O([
520
520
  y()
521
- ], P.prototype, "pickedColumns", 2);
522
- C([
521
+ ], k.prototype, "pickedColumns", 2);
522
+ O([
523
523
  y()
524
- ], P.prototype, "draftColumns", 2);
525
- C([
524
+ ], k.prototype, "draftColumns", 2);
525
+ O([
526
526
  y()
527
- ], P.prototype, "pickAvail", 2);
528
- C([
527
+ ], k.prototype, "pickAvail", 2);
528
+ O([
529
529
  y()
530
- ], P.prototype, "pickSel", 2);
531
- C([
530
+ ], k.prototype, "pickSel", 2);
531
+ O([
532
532
  y()
533
- ], P.prototype, "expanded", 2);
534
- P = C([
535
- u("baht-table")
536
- ], P);
537
- var Cs = Object.defineProperty, Ds = Object.getOwnPropertyDescriptor, dt = (t, e, i, a) => {
538
- for (var s = a > 1 ? void 0 : a ? Ds(e, i) : e, r = t.length - 1, o; r >= 0; r--)
533
+ ], k.prototype, "expanded", 2);
534
+ k = O([
535
+ b("baht-table")
536
+ ], k);
537
+ var Ds = Object.defineProperty, Fs = Object.getOwnPropertyDescriptor, ut = (t, e, i, a) => {
538
+ for (var s = a > 1 ? void 0 : a ? Fs(e, i) : e, r = t.length - 1, o; r >= 0; r--)
539
539
  (o = t[r]) && (s = (a ? o(e, i, s) : o(s)) || s);
540
- return a && s && Cs(e, i, s), s;
540
+ return a && s && Ds(e, i, s), s;
541
541
  };
542
- let at = class extends $ {
542
+ let rt = class extends g {
543
543
  constructor() {
544
544
  super(...arguments), this.items = [], this.loading = !1, this.error = !1, this.errorMessage = "Couldn't load data. Try again.", this.emptyMessage = "Nothing here yet.", this.skeletonRows = 5, this.clickable = !0;
545
545
  }
@@ -585,36 +585,36 @@ let at = class extends $ {
585
585
  return n`<div class="baht-list" role=${t ? "list" : h}>${this.renderRows()}</div>`;
586
586
  }
587
587
  };
588
- dt([
588
+ ut([
589
589
  l({ attribute: !1 })
590
- ], at.prototype, "items", 2);
591
- dt([
590
+ ], rt.prototype, "items", 2);
591
+ ut([
592
592
  l({ type: Boolean })
593
- ], at.prototype, "loading", 2);
594
- dt([
593
+ ], rt.prototype, "loading", 2);
594
+ ut([
595
595
  l({ type: Boolean })
596
- ], at.prototype, "error", 2);
597
- dt([
596
+ ], rt.prototype, "error", 2);
597
+ ut([
598
598
  l({ attribute: "error-message" })
599
- ], at.prototype, "errorMessage", 2);
600
- dt([
599
+ ], rt.prototype, "errorMessage", 2);
600
+ ut([
601
601
  l({ attribute: "empty-message" })
602
- ], at.prototype, "emptyMessage", 2);
603
- dt([
602
+ ], rt.prototype, "emptyMessage", 2);
603
+ ut([
604
604
  l({ type: Number, attribute: "skeleton-rows" })
605
- ], at.prototype, "skeletonRows", 2);
606
- dt([
605
+ ], rt.prototype, "skeletonRows", 2);
606
+ ut([
607
607
  l({ type: Boolean })
608
- ], at.prototype, "clickable", 2);
609
- at = dt([
610
- u("baht-list")
611
- ], at);
612
- var Fs = Object.defineProperty, Es = Object.getOwnPropertyDescriptor, Wt = (t, e, i, a) => {
613
- for (var s = a > 1 ? void 0 : a ? Es(e, i) : e, r = t.length - 1, o; r >= 0; r--)
608
+ ], rt.prototype, "clickable", 2);
609
+ rt = ut([
610
+ b("baht-list")
611
+ ], rt);
612
+ var Es = Object.defineProperty, Bs = Object.getOwnPropertyDescriptor, Jt = (t, e, i, a) => {
613
+ for (var s = a > 1 ? void 0 : a ? Bs(e, i) : e, r = t.length - 1, o; r >= 0; r--)
614
614
  (o = t[r]) && (s = (a ? o(e, i, s) : o(s)) || s);
615
- return a && s && Fs(e, i, s), s;
615
+ return a && s && Es(e, i, s), s;
616
616
  };
617
- let _t = class extends $ {
617
+ let Pt = class extends g {
618
618
  constructor() {
619
619
  super(...arguments), this.text = "", this.position = "top", this.dismissed = !1;
620
620
  }
@@ -633,7 +633,7 @@ let _t = class extends $ {
633
633
  t ? (t.setAttribute("aria-describedby", this.tooltipId), this.anchorEl.removeAttribute("tabindex"), this.anchorEl.removeAttribute("aria-describedby")) : (this.anchorEl.setAttribute("tabindex", "0"), this.anchorEl.setAttribute("aria-describedby", this.tooltipId));
634
634
  }
635
635
  firstUpdated() {
636
- ne(this, this.anchorEl), this.wireDescribedBy(), setTimeout(() => this.isConnected && this.wireDescribedBy(), 0);
636
+ he(this, this.anchorEl), this.wireDescribedBy(), setTimeout(() => this.isConnected && this.wireDescribedBy(), 0);
637
637
  }
638
638
  onKeydown(t) {
639
639
  t.key === "Escape" && (this.dismissed = !0);
@@ -653,27 +653,27 @@ let _t = class extends $ {
653
653
  </span>`;
654
654
  }
655
655
  };
656
- Wt([
656
+ Jt([
657
657
  l()
658
- ], _t.prototype, "text", 2);
659
- Wt([
658
+ ], Pt.prototype, "text", 2);
659
+ Jt([
660
660
  l()
661
- ], _t.prototype, "position", 2);
662
- Wt([
663
- Et(".baht-tooltip-anchor")
664
- ], _t.prototype, "anchorEl", 2);
665
- Wt([
661
+ ], Pt.prototype, "position", 2);
662
+ Jt([
663
+ It(".baht-tooltip-anchor")
664
+ ], Pt.prototype, "anchorEl", 2);
665
+ Jt([
666
666
  y()
667
- ], _t.prototype, "dismissed", 2);
668
- _t = Wt([
669
- u("baht-tooltip")
670
- ], _t);
671
- var Bs = Object.defineProperty, Is = Object.getOwnPropertyDescriptor, Bt = (t, e, i, a) => {
672
- for (var s = a > 1 ? void 0 : a ? Is(e, i) : e, r = t.length - 1, o; r >= 0; r--)
667
+ ], Pt.prototype, "dismissed", 2);
668
+ Pt = Jt([
669
+ b("baht-tooltip")
670
+ ], Pt);
671
+ var Is = Object.defineProperty, Ms = Object.getOwnPropertyDescriptor, Mt = (t, e, i, a) => {
672
+ for (var s = a > 1 ? void 0 : a ? Ms(e, i) : e, r = t.length - 1, o; r >= 0; r--)
673
673
  (o = t[r]) && (s = (a ? o(e, i, s) : o(s)) || s);
674
- return a && s && Bs(e, i, s), s;
674
+ return a && s && Is(e, i, s), s;
675
675
  };
676
- let bt = class extends $ {
676
+ let mt = class extends g {
677
677
  constructor() {
678
678
  super(...arguments), this.tone = "info", this.heading = "", this.message = "", this.dismissible = !1, this.dismissed = !1, this.generation = 0;
679
679
  }
@@ -689,7 +689,7 @@ let bt = class extends $ {
689
689
  e();
690
690
  return;
691
691
  }
692
- i.classList.add("baht-alert--leaving"), ms(i, e);
692
+ i.classList.add("baht-alert--leaving"), vs(i, e);
693
693
  }
694
694
  render() {
695
695
  return this.dismissed ? h : n`<div class="baht-alert baht-alert--${this.tone}" role="alert">
@@ -697,34 +697,34 @@ let bt = class extends $ {
697
697
  ${this.heading ? n`<div class="baht-alert-title">${this.heading}</div>` : h}
698
698
  ${this.message ? n`<div class="baht-alert-message">${this.message}</div>` : h}
699
699
  </div>
700
- ${this.dismissible ? n`<button type="button" class="baht-alert-dismiss" aria-label=${v("dismiss")} @click=${() => this.dismiss()}>×</button>` : h}
700
+ ${this.dismissible ? n`<button type="button" class="baht-alert-dismiss" aria-label=${m("dismiss")} @click=${() => this.dismiss()}>×</button>` : h}
701
701
  </div>`;
702
702
  }
703
703
  };
704
- Bt([
704
+ Mt([
705
705
  l()
706
- ], bt.prototype, "tone", 2);
707
- Bt([
706
+ ], mt.prototype, "tone", 2);
707
+ Mt([
708
708
  l()
709
- ], bt.prototype, "heading", 2);
710
- Bt([
709
+ ], mt.prototype, "heading", 2);
710
+ Mt([
711
711
  l()
712
- ], bt.prototype, "message", 2);
713
- Bt([
712
+ ], mt.prototype, "message", 2);
713
+ Mt([
714
714
  l({ type: Boolean })
715
- ], bt.prototype, "dismissible", 2);
716
- Bt([
715
+ ], mt.prototype, "dismissible", 2);
716
+ Mt([
717
717
  y()
718
- ], bt.prototype, "dismissed", 2);
719
- bt = Bt([
720
- u("baht-alert")
721
- ], bt);
722
- var js = Object.defineProperty, Ss = Object.getOwnPropertyDescriptor, It = (t, e, i, a) => {
718
+ ], mt.prototype, "dismissed", 2);
719
+ mt = Mt([
720
+ b("baht-alert")
721
+ ], mt);
722
+ var js = Object.defineProperty, Ss = Object.getOwnPropertyDescriptor, jt = (t, e, i, a) => {
723
723
  for (var s = a > 1 ? void 0 : a ? Ss(e, i) : e, r = t.length - 1, o; r >= 0; r--)
724
724
  (o = t[r]) && (s = (a ? o(e, i, s) : o(s)) || s);
725
725
  return a && s && js(e, i, s), s;
726
726
  };
727
- let ft = class extends $ {
727
+ let vt = class extends g {
728
728
  constructor() {
729
729
  super(...arguments), this.value = 0, this.max = 5, this.readonly = !1, this.label = "Rating", this.hover = 0;
730
730
  }
@@ -777,30 +777,30 @@ let ft = class extends $ {
777
777
  </div>`;
778
778
  }
779
779
  };
780
- It([
780
+ jt([
781
781
  l({ type: Number })
782
- ], ft.prototype, "value", 2);
783
- It([
782
+ ], vt.prototype, "value", 2);
783
+ jt([
784
784
  l({ type: Number })
785
- ], ft.prototype, "max", 2);
786
- It([
785
+ ], vt.prototype, "max", 2);
786
+ jt([
787
787
  l({ type: Boolean })
788
- ], ft.prototype, "readonly", 2);
789
- It([
788
+ ], vt.prototype, "readonly", 2);
789
+ jt([
790
790
  l()
791
- ], ft.prototype, "label", 2);
792
- It([
791
+ ], vt.prototype, "label", 2);
792
+ jt([
793
793
  y()
794
- ], ft.prototype, "hover", 2);
795
- ft = It([
796
- u("baht-rating")
797
- ], ft);
798
- var Ts = Object.defineProperty, Ms = Object.getOwnPropertyDescriptor, ut = (t, e, i, a) => {
799
- for (var s = a > 1 ? void 0 : a ? Ms(e, i) : e, r = t.length - 1, o; r >= 0; r--)
794
+ ], vt.prototype, "hover", 2);
795
+ vt = jt([
796
+ b("baht-rating")
797
+ ], vt);
798
+ var Ts = Object.defineProperty, As = Object.getOwnPropertyDescriptor, bt = (t, e, i, a) => {
799
+ for (var s = a > 1 ? void 0 : a ? As(e, i) : e, r = t.length - 1, o; r >= 0; r--)
800
800
  (o = t[r]) && (s = (a ? o(e, i, s) : o(s)) || s);
801
801
  return a && s && Ts(e, i, s), s;
802
802
  };
803
- let it = class extends $ {
803
+ let ot = class extends g {
804
804
  constructor() {
805
805
  super(...arguments), this.value = 0, this.min = 0, this.max = 100, this.step = 1, this.label = "", this.disabled = !1, this.showValue = !0;
806
806
  }
@@ -821,7 +821,7 @@ let it = class extends $ {
821
821
  type="range"
822
822
  id=${this.inputId}
823
823
  aria-label=${this.label ? h : "Value"}
824
- .value=${rt(String(this.value))}
824
+ .value=${lt(String(this.value))}
825
825
  min=${this.min}
826
826
  max=${this.max}
827
827
  step=${this.step}
@@ -833,36 +833,36 @@ let it = class extends $ {
833
833
  </div>`;
834
834
  }
835
835
  };
836
- ut([
836
+ bt([
837
837
  l({ type: Number })
838
- ], it.prototype, "value", 2);
839
- ut([
838
+ ], ot.prototype, "value", 2);
839
+ bt([
840
840
  l({ type: Number })
841
- ], it.prototype, "min", 2);
842
- ut([
841
+ ], ot.prototype, "min", 2);
842
+ bt([
843
843
  l({ type: Number })
844
- ], it.prototype, "max", 2);
845
- ut([
844
+ ], ot.prototype, "max", 2);
845
+ bt([
846
846
  l({ type: Number })
847
- ], it.prototype, "step", 2);
848
- ut([
847
+ ], ot.prototype, "step", 2);
848
+ bt([
849
849
  l()
850
- ], it.prototype, "label", 2);
851
- ut([
850
+ ], ot.prototype, "label", 2);
851
+ bt([
852
852
  l({ type: Boolean })
853
- ], it.prototype, "disabled", 2);
854
- ut([
853
+ ], ot.prototype, "disabled", 2);
854
+ bt([
855
855
  l({ type: Boolean, attribute: "show-value" })
856
- ], it.prototype, "showValue", 2);
857
- it = ut([
858
- u("baht-range")
859
- ], it);
860
- var As = Object.defineProperty, Ls = Object.getOwnPropertyDescriptor, jt = (t, e, i, a) => {
861
- for (var s = a > 1 ? void 0 : a ? Ls(e, i) : e, r = t.length - 1, o; r >= 0; r--)
856
+ ], ot.prototype, "showValue", 2);
857
+ ot = bt([
858
+ b("baht-range")
859
+ ], ot);
860
+ var Ls = Object.defineProperty, Ns = Object.getOwnPropertyDescriptor, St = (t, e, i, a) => {
861
+ for (var s = a > 1 ? void 0 : a ? Ns(e, i) : e, r = t.length - 1, o; r >= 0; r--)
862
862
  (o = t[r]) && (s = (a ? o(e, i, s) : o(s)) || s);
863
- return a && s && As(e, i, s), s;
863
+ return a && s && Ls(e, i, s), s;
864
864
  };
865
- let mt = class extends $ {
865
+ let $t = class extends g {
866
866
  constructor() {
867
867
  super(...arguments), this.length = 6, this.value = "", this.disabled = !1, this.mode = "numeric", this.label = "One-time code", this._chars = [], this._lastValue = "", this._wasFull = !1;
868
868
  }
@@ -936,7 +936,7 @@ let mt = class extends $ {
936
936
  inputmode=${this.mode === "numeric" ? "numeric" : "text"}
937
937
  maxlength="1"
938
938
  autocomplete=${e === 0 ? "one-time-code" : "off"}
939
- aria-label=${v("otpCharacter", { i: e + 1, n: this.length })}
939
+ aria-label=${m("otpCharacter", { i: e + 1, n: this.length })}
940
940
  .value=${t}
941
941
  ?disabled=${this.disabled}
942
942
  @input=${(i) => this.onInput(e, i)}
@@ -946,30 +946,30 @@ let mt = class extends $ {
946
946
  </div>`;
947
947
  }
948
948
  };
949
- jt([
949
+ St([
950
950
  l({ type: Number })
951
- ], mt.prototype, "length", 2);
952
- jt([
951
+ ], $t.prototype, "length", 2);
952
+ St([
953
953
  l()
954
- ], mt.prototype, "value", 2);
955
- jt([
954
+ ], $t.prototype, "value", 2);
955
+ St([
956
956
  l({ type: Boolean })
957
- ], mt.prototype, "disabled", 2);
958
- jt([
957
+ ], $t.prototype, "disabled", 2);
958
+ St([
959
959
  l()
960
- ], mt.prototype, "mode", 2);
961
- jt([
960
+ ], $t.prototype, "mode", 2);
961
+ St([
962
962
  l()
963
- ], mt.prototype, "label", 2);
964
- mt = jt([
965
- u("baht-otp")
966
- ], mt);
967
- var Ns = Object.defineProperty, qs = Object.getOwnPropertyDescriptor, St = (t, e, i, a) => {
968
- for (var s = a > 1 ? void 0 : a ? qs(e, i) : e, r = t.length - 1, o; r >= 0; r--)
963
+ ], $t.prototype, "label", 2);
964
+ $t = St([
965
+ b("baht-otp")
966
+ ], $t);
967
+ var qs = Object.defineProperty, Rs = Object.getOwnPropertyDescriptor, Tt = (t, e, i, a) => {
968
+ for (var s = a > 1 ? void 0 : a ? Rs(e, i) : e, r = t.length - 1, o; r >= 0; r--)
969
969
  (o = t[r]) && (s = (a ? o(e, i, s) : o(s)) || s);
970
- return a && s && Ns(e, i, s), s;
970
+ return a && s && qs(e, i, s), s;
971
971
  };
972
- let vt = class extends $ {
972
+ let yt = class extends g {
973
973
  constructor() {
974
974
  super(...arguments), this.options = [], this.selected = [], this.multiple = !0, this.disabled = !1, this.label = "Filters";
975
975
  }
@@ -993,30 +993,30 @@ let vt = class extends $ {
993
993
  </div>`;
994
994
  }
995
995
  };
996
- St([
996
+ Tt([
997
997
  l({ attribute: !1 })
998
- ], vt.prototype, "options", 2);
999
- St([
998
+ ], yt.prototype, "options", 2);
999
+ Tt([
1000
1000
  l({ attribute: !1 })
1001
- ], vt.prototype, "selected", 2);
1002
- St([
1001
+ ], yt.prototype, "selected", 2);
1002
+ Tt([
1003
1003
  l({ type: Boolean })
1004
- ], vt.prototype, "multiple", 2);
1005
- St([
1004
+ ], yt.prototype, "multiple", 2);
1005
+ Tt([
1006
1006
  l({ type: Boolean })
1007
- ], vt.prototype, "disabled", 2);
1008
- St([
1007
+ ], yt.prototype, "disabled", 2);
1008
+ Tt([
1009
1009
  l()
1010
- ], vt.prototype, "label", 2);
1011
- vt = St([
1012
- u("baht-filter")
1013
- ], vt);
1014
- var Rs = Object.defineProperty, zs = Object.getOwnPropertyDescriptor, ce = (t, e, i, a) => {
1015
- for (var s = a > 1 ? void 0 : a ? zs(e, i) : e, r = t.length - 1, o; r >= 0; r--)
1010
+ ], yt.prototype, "label", 2);
1011
+ yt = Tt([
1012
+ b("baht-filter")
1013
+ ], yt);
1014
+ var zs = Object.defineProperty, Vs = Object.getOwnPropertyDescriptor, pe = (t, e, i, a) => {
1015
+ for (var s = a > 1 ? void 0 : a ? Vs(e, i) : e, r = t.length - 1, o; r >= 0; r--)
1016
1016
  (o = t[r]) && (s = (a ? o(e, i, s) : o(s)) || s);
1017
- return a && s && Rs(e, i, s), s;
1017
+ return a && s && zs(e, i, s), s;
1018
1018
  };
1019
- let Vt = class extends $ {
1019
+ let Kt = class extends g {
1020
1020
  constructor() {
1021
1021
  super(...arguments), this.variant = "rect", this.width = "100%", this.height = "";
1022
1022
  }
@@ -1029,24 +1029,24 @@ let Vt = class extends $ {
1029
1029
  ></span>`;
1030
1030
  }
1031
1031
  };
1032
- ce([
1032
+ pe([
1033
1033
  l()
1034
- ], Vt.prototype, "variant", 2);
1035
- ce([
1034
+ ], Kt.prototype, "variant", 2);
1035
+ pe([
1036
1036
  l()
1037
- ], Vt.prototype, "width", 2);
1038
- ce([
1037
+ ], Kt.prototype, "width", 2);
1038
+ pe([
1039
1039
  l()
1040
- ], Vt.prototype, "height", 2);
1041
- Vt = ce([
1042
- u("baht-skeleton")
1043
- ], Vt);
1044
- var Vs = Object.defineProperty, Ks = Object.getOwnPropertyDescriptor, Jt = (t, e, i, a) => {
1045
- for (var s = a > 1 ? void 0 : a ? Ks(e, i) : e, r = t.length - 1, o; r >= 0; r--)
1040
+ ], Kt.prototype, "height", 2);
1041
+ Kt = pe([
1042
+ b("baht-skeleton")
1043
+ ], Kt);
1044
+ var Ks = Object.defineProperty, Us = Object.getOwnPropertyDescriptor, Yt = (t, e, i, a) => {
1045
+ for (var s = a > 1 ? void 0 : a ? Us(e, i) : e, r = t.length - 1, o; r >= 0; r--)
1046
1046
  (o = t[r]) && (s = (a ? o(e, i, s) : o(s)) || s);
1047
- return a && s && Vs(e, i, s), s;
1047
+ return a && s && Ks(e, i, s), s;
1048
1048
  };
1049
- let kt = class extends $ {
1049
+ let Ot = class extends g {
1050
1050
  constructor() {
1051
1051
  super(...arguments), this.value = null, this.tone = "primary", this.showLabel = !1, this.label = "Progress";
1052
1052
  }
@@ -1067,27 +1067,27 @@ let kt = class extends $ {
1067
1067
  </div>`;
1068
1068
  }
1069
1069
  };
1070
- Jt([
1070
+ Yt([
1071
1071
  l({ type: Number })
1072
- ], kt.prototype, "value", 2);
1073
- Jt([
1072
+ ], Ot.prototype, "value", 2);
1073
+ Yt([
1074
1074
  l()
1075
- ], kt.prototype, "tone", 2);
1076
- Jt([
1075
+ ], Ot.prototype, "tone", 2);
1076
+ Yt([
1077
1077
  l({ type: Boolean, attribute: "show-label" })
1078
- ], kt.prototype, "showLabel", 2);
1079
- Jt([
1078
+ ], Ot.prototype, "showLabel", 2);
1079
+ Yt([
1080
1080
  l()
1081
- ], kt.prototype, "label", 2);
1082
- kt = Jt([
1083
- u("baht-progress")
1084
- ], kt);
1085
- var Us = Object.defineProperty, Hs = Object.getOwnPropertyDescriptor, je = (t, e, i, a) => {
1086
- for (var s = a > 1 ? void 0 : a ? Hs(e, i) : e, r = t.length - 1, o; r >= 0; r--)
1081
+ ], Ot.prototype, "label", 2);
1082
+ Ot = Yt([
1083
+ b("baht-progress")
1084
+ ], Ot);
1085
+ var Hs = Object.defineProperty, Gs = Object.getOwnPropertyDescriptor, je = (t, e, i, a) => {
1086
+ for (var s = a > 1 ? void 0 : a ? Gs(e, i) : e, r = t.length - 1, o; r >= 0; r--)
1087
1087
  (o = t[r]) && (s = (a ? o(e, i, s) : o(s)) || s);
1088
- return a && s && Us(e, i, s), s;
1088
+ return a && s && Hs(e, i, s), s;
1089
1089
  };
1090
- let ie = class extends $ {
1090
+ let re = class extends g {
1091
1091
  constructor() {
1092
1092
  super(...arguments), this.size = "md", this.label = "Loading";
1093
1093
  }
@@ -1098,24 +1098,24 @@ let ie = class extends $ {
1098
1098
  };
1099
1099
  je([
1100
1100
  l()
1101
- ], ie.prototype, "size", 2);
1101
+ ], re.prototype, "size", 2);
1102
1102
  je([
1103
1103
  l()
1104
- ], ie.prototype, "label", 2);
1105
- ie = je([
1106
- u("baht-spinner")
1107
- ], ie);
1108
- var Gs = Object.defineProperty, Ws = Object.getOwnPropertyDescriptor, Yt = (t, e, i, a) => {
1109
- for (var s = a > 1 ? void 0 : a ? Ws(e, i) : e, r = t.length - 1, o; r >= 0; r--)
1104
+ ], re.prototype, "label", 2);
1105
+ re = je([
1106
+ b("baht-spinner")
1107
+ ], re);
1108
+ var Ws = Object.defineProperty, Js = Object.getOwnPropertyDescriptor, Xt = (t, e, i, a) => {
1109
+ for (var s = a > 1 ? void 0 : a ? Js(e, i) : e, r = t.length - 1, o; r >= 0; r--)
1110
1110
  (o = t[r]) && (s = (a ? o(e, i, s) : o(s)) || s);
1111
- return a && s && Gs(e, i, s), s;
1111
+ return a && s && Ws(e, i, s), s;
1112
1112
  };
1113
- let Pt = class extends $ {
1113
+ let Ct = class extends g {
1114
1114
  constructor() {
1115
1115
  super(...arguments), this.heading = "", this.subtitle = "", this.hero = !1;
1116
1116
  }
1117
1117
  firstUpdated() {
1118
- ne(this, this.bodyEl);
1118
+ he(this, this.bodyEl);
1119
1119
  }
1120
1120
  render() {
1121
1121
  return n`<div class="baht-card${this.hero ? " baht-card--hero" : ""}">
@@ -1125,32 +1125,32 @@ let Pt = class extends $ {
1125
1125
  </div>`;
1126
1126
  }
1127
1127
  };
1128
- Yt([
1128
+ Xt([
1129
1129
  l()
1130
- ], Pt.prototype, "heading", 2);
1131
- Yt([
1130
+ ], Ct.prototype, "heading", 2);
1131
+ Xt([
1132
1132
  l()
1133
- ], Pt.prototype, "subtitle", 2);
1134
- Yt([
1133
+ ], Ct.prototype, "subtitle", 2);
1134
+ Xt([
1135
1135
  l({ type: Boolean })
1136
- ], Pt.prototype, "hero", 2);
1137
- Yt([
1138
- Et(".baht-card-body")
1139
- ], Pt.prototype, "bodyEl", 2);
1140
- Pt = Yt([
1141
- u("baht-card")
1142
- ], Pt);
1143
- var Js = Object.defineProperty, Ys = Object.getOwnPropertyDescriptor, pe = (t, e, i, a) => {
1144
- for (var s = a > 1 ? void 0 : a ? Ys(e, i) : e, r = t.length - 1, o; r >= 0; r--)
1136
+ ], Ct.prototype, "hero", 2);
1137
+ Xt([
1138
+ It(".baht-card-body")
1139
+ ], Ct.prototype, "bodyEl", 2);
1140
+ Ct = Xt([
1141
+ b("baht-card")
1142
+ ], Ct);
1143
+ var Ys = Object.defineProperty, Xs = Object.getOwnPropertyDescriptor, de = (t, e, i, a) => {
1144
+ for (var s = a > 1 ? void 0 : a ? Xs(e, i) : e, r = t.length - 1, o; r >= 0; r--)
1145
1145
  (o = t[r]) && (s = (a ? o(e, i, s) : o(s)) || s);
1146
- return a && s && Js(e, i, s), s;
1146
+ return a && s && Ys(e, i, s), s;
1147
1147
  };
1148
- let Kt = class extends $ {
1148
+ let Ut = class extends g {
1149
1149
  constructor() {
1150
1150
  super(...arguments), this.legend = "", this.disabled = !1;
1151
1151
  }
1152
1152
  firstUpdated() {
1153
- ne(this, this.bodyEl);
1153
+ he(this, this.bodyEl);
1154
1154
  }
1155
1155
  render() {
1156
1156
  return n`<fieldset class="baht-fieldset" ?disabled=${this.disabled}>
@@ -1159,24 +1159,24 @@ let Kt = class extends $ {
1159
1159
  </fieldset>`;
1160
1160
  }
1161
1161
  };
1162
- pe([
1162
+ de([
1163
1163
  l()
1164
- ], Kt.prototype, "legend", 2);
1165
- pe([
1164
+ ], Ut.prototype, "legend", 2);
1165
+ de([
1166
1166
  l({ type: Boolean })
1167
- ], Kt.prototype, "disabled", 2);
1168
- pe([
1169
- Et(".baht-fieldset-body")
1170
- ], Kt.prototype, "bodyEl", 2);
1171
- Kt = pe([
1172
- u("baht-fieldset")
1173
- ], Kt);
1174
- var Xs = Object.defineProperty, Zs = Object.getOwnPropertyDescriptor, rs = (t, e, i, a) => {
1175
- for (var s = a > 1 ? void 0 : a ? Zs(e, i) : e, r = t.length - 1, o; r >= 0; r--)
1167
+ ], Ut.prototype, "disabled", 2);
1168
+ de([
1169
+ It(".baht-fieldset-body")
1170
+ ], Ut.prototype, "bodyEl", 2);
1171
+ Ut = de([
1172
+ b("baht-fieldset")
1173
+ ], Ut);
1174
+ var Zs = Object.defineProperty, Qs = Object.getOwnPropertyDescriptor, ls = (t, e, i, a) => {
1175
+ for (var s = a > 1 ? void 0 : a ? Qs(e, i) : e, r = t.length - 1, o; r >= 0; r--)
1176
1176
  (o = t[r]) && (s = (a ? o(e, i, s) : o(s)) || s);
1177
- return a && s && Xs(e, i, s), s;
1177
+ return a && s && Zs(e, i, s), s;
1178
1178
  };
1179
- let Ce = class extends $ {
1179
+ let De = class extends g {
1180
1180
  constructor() {
1181
1181
  super(...arguments), this.items = [];
1182
1182
  }
@@ -1200,18 +1200,18 @@ let Ce = class extends $ {
1200
1200
  </div>`;
1201
1201
  }
1202
1202
  };
1203
- rs([
1203
+ ls([
1204
1204
  l({ attribute: !1 })
1205
- ], Ce.prototype, "items", 2);
1206
- Ce = rs([
1207
- u("baht-timeline")
1208
- ], Ce);
1209
- var Qs = Object.defineProperty, ta = Object.getOwnPropertyDescriptor, de = (t, e, i, a) => {
1210
- for (var s = a > 1 ? void 0 : a ? ta(e, i) : e, r = t.length - 1, o; r >= 0; r--)
1205
+ ], De.prototype, "items", 2);
1206
+ De = ls([
1207
+ b("baht-timeline")
1208
+ ], De);
1209
+ var ta = Object.defineProperty, ea = Object.getOwnPropertyDescriptor, ue = (t, e, i, a) => {
1210
+ for (var s = a > 1 ? void 0 : a ? ea(e, i) : e, r = t.length - 1, o; r >= 0; r--)
1211
1211
  (o = t[r]) && (s = (a ? o(e, i, s) : o(s)) || s);
1212
- return a && s && Qs(e, i, s), s;
1212
+ return a && s && ta(e, i, s), s;
1213
1213
  };
1214
- let Ot = class extends $ {
1214
+ let Dt = class extends g {
1215
1215
  constructor() {
1216
1216
  super(...arguments), this.items = [], this.multiple = !1, this.openSet = /* @__PURE__ */ new Set(), this.itemsFingerprint = "";
1217
1217
  }
@@ -1220,7 +1220,7 @@ let Ot = class extends $ {
1220
1220
  }
1221
1221
  willUpdate(t) {
1222
1222
  if (t.has("items")) {
1223
- const e = Ot.fingerprint(this.items);
1223
+ const e = Dt.fingerprint(this.items);
1224
1224
  e !== this.itemsFingerprint && (this.itemsFingerprint = e, this.openSet = new Set(this.items.flatMap((i, a) => i.open ? [a] : [])));
1225
1225
  }
1226
1226
  }
@@ -1252,24 +1252,24 @@ let Ot = class extends $ {
1252
1252
  </div>`;
1253
1253
  }
1254
1254
  };
1255
- de([
1255
+ ue([
1256
1256
  l({ attribute: !1 })
1257
- ], Ot.prototype, "items", 2);
1258
- de([
1257
+ ], Dt.prototype, "items", 2);
1258
+ ue([
1259
1259
  l({ type: Boolean })
1260
- ], Ot.prototype, "multiple", 2);
1261
- de([
1260
+ ], Dt.prototype, "multiple", 2);
1261
+ ue([
1262
1262
  y()
1263
- ], Ot.prototype, "openSet", 2);
1264
- Ot = de([
1265
- u("baht-accordion")
1266
- ], Ot);
1267
- var ea = Object.defineProperty, sa = Object.getOwnPropertyDescriptor, Xt = (t, e, i, a) => {
1268
- for (var s = a > 1 ? void 0 : a ? sa(e, i) : e, r = t.length - 1, o; r >= 0; r--)
1263
+ ], Dt.prototype, "openSet", 2);
1264
+ Dt = ue([
1265
+ b("baht-accordion")
1266
+ ], Dt);
1267
+ var sa = Object.defineProperty, aa = Object.getOwnPropertyDescriptor, Zt = (t, e, i, a) => {
1268
+ for (var s = a > 1 ? void 0 : a ? aa(e, i) : e, r = t.length - 1, o; r >= 0; r--)
1269
1269
  (o = t[r]) && (s = (a ? o(e, i, s) : o(s)) || s);
1270
- return a && s && ea(e, i, s), s;
1270
+ return a && s && sa(e, i, s), s;
1271
1271
  };
1272
- let Ct = class extends $ {
1272
+ let Ft = class extends g {
1273
1273
  constructor() {
1274
1274
  super(...arguments), this.href = "", this.label = "", this.external = !1, this.externalHint = "opens in new tab";
1275
1275
  }
@@ -1282,27 +1282,27 @@ let Ct = class extends $ {
1282
1282
  >${this.label}${this.external ? n` <span class="baht-link-external" aria-hidden="true">↗</span><span class="baht-visually-hidden"> (${this.externalHint})</span>` : h}</a>`;
1283
1283
  }
1284
1284
  };
1285
- Xt([
1285
+ Zt([
1286
1286
  l()
1287
- ], Ct.prototype, "href", 2);
1288
- Xt([
1287
+ ], Ft.prototype, "href", 2);
1288
+ Zt([
1289
1289
  l()
1290
- ], Ct.prototype, "label", 2);
1291
- Xt([
1290
+ ], Ft.prototype, "label", 2);
1291
+ Zt([
1292
1292
  l({ type: Boolean })
1293
- ], Ct.prototype, "external", 2);
1294
- Xt([
1293
+ ], Ft.prototype, "external", 2);
1294
+ Zt([
1295
1295
  l({ attribute: "external-hint" })
1296
- ], Ct.prototype, "externalHint", 2);
1297
- Ct = Xt([
1298
- u("baht-link")
1299
- ], Ct);
1300
- var aa = Object.defineProperty, ia = Object.getOwnPropertyDescriptor, Se = (t, e, i, a) => {
1301
- for (var s = a > 1 ? void 0 : a ? ia(e, i) : e, r = t.length - 1, o; r >= 0; r--)
1296
+ ], Ft.prototype, "externalHint", 2);
1297
+ Ft = Zt([
1298
+ b("baht-link")
1299
+ ], Ft);
1300
+ var ia = Object.defineProperty, ra = Object.getOwnPropertyDescriptor, Se = (t, e, i, a) => {
1301
+ for (var s = a > 1 ? void 0 : a ? ra(e, i) : e, r = t.length - 1, o; r >= 0; r--)
1302
1302
  (o = t[r]) && (s = (a ? o(e, i, s) : o(s)) || s);
1303
- return a && s && aa(e, i, s), s;
1303
+ return a && s && ia(e, i, s), s;
1304
1304
  };
1305
- let re = class extends $ {
1305
+ let oe = class extends g {
1306
1306
  constructor() {
1307
1307
  super(...arguments), this.items = [], this.separator = "›";
1308
1308
  }
@@ -1329,28 +1329,28 @@ let re = class extends $ {
1329
1329
  };
1330
1330
  Se([
1331
1331
  l({ attribute: !1 })
1332
- ], re.prototype, "items", 2);
1332
+ ], oe.prototype, "items", 2);
1333
1333
  Se([
1334
1334
  l()
1335
- ], re.prototype, "separator", 2);
1336
- re = Se([
1337
- u("baht-breadcrumbs")
1338
- ], re);
1339
- var ra = Object.getOwnPropertyDescriptor, oa = (t, e, i, a) => {
1340
- for (var s = a > 1 ? void 0 : a ? ra(e, i) : e, r = t.length - 1, o; r >= 0; r--)
1335
+ ], oe.prototype, "separator", 2);
1336
+ oe = Se([
1337
+ b("baht-breadcrumbs")
1338
+ ], oe);
1339
+ var oa = Object.getOwnPropertyDescriptor, la = (t, e, i, a) => {
1340
+ for (var s = a > 1 ? void 0 : a ? oa(e, i) : e, r = t.length - 1, o; r >= 0; r--)
1341
1341
  (o = t[r]) && (s = o(s) || s);
1342
1342
  return s;
1343
1343
  };
1344
- let Le = class extends W {
1344
+ let Ne = class extends Y {
1345
1345
  renderControl() {
1346
1346
  return n`<input
1347
1347
  class="baht-control baht-control--text"
1348
1348
  id=${this.controlId}
1349
1349
  type=${this.field.type === "email" ? "email" : this.field.type === "password" ? "password" : "text"}
1350
- .value=${rt(this.shownValue == null ? "" : String(this.shownValue))}
1351
- placeholder=${L(this.field.placeholder)}
1352
- maxlength=${L(this.field.max_length)}
1353
- autocomplete=${L(this.field.autocomplete)}
1350
+ .value=${lt(this.shownValue == null ? "" : String(this.shownValue))}
1351
+ placeholder=${N(this.field.placeholder)}
1352
+ maxlength=${N(this.field.max_length)}
1353
+ autocomplete=${N(this.field.autocomplete)}
1354
1354
  ?disabled=${this.disabled}
1355
1355
  ?readonly=${this.readonly}
1356
1356
  ?required=${this.required}
@@ -1360,24 +1360,24 @@ let Le = class extends W {
1360
1360
  />`;
1361
1361
  }
1362
1362
  };
1363
- Le = oa([
1364
- u("baht-input")
1365
- ], Le);
1366
- var la = Object.getOwnPropertyDescriptor, na = (t, e, i, a) => {
1367
- for (var s = a > 1 ? void 0 : a ? la(e, i) : e, r = t.length - 1, o; r >= 0; r--)
1363
+ Ne = la([
1364
+ b("baht-input")
1365
+ ], Ne);
1366
+ var na = Object.getOwnPropertyDescriptor, ha = (t, e, i, a) => {
1367
+ for (var s = a > 1 ? void 0 : a ? na(e, i) : e, r = t.length - 1, o; r >= 0; r--)
1368
1368
  (o = t[r]) && (s = o(s) || s);
1369
1369
  return s;
1370
1370
  };
1371
- let Ne = class extends W {
1371
+ let qe = class extends Y {
1372
1372
  renderControl() {
1373
1373
  return n`<textarea
1374
1374
  class="baht-control baht-control--textarea"
1375
1375
  id=${this.controlId}
1376
- .value=${rt(this.shownValue == null ? "" : String(this.shownValue))}
1377
- placeholder=${L(this.field.placeholder)}
1378
- maxlength=${L(this.field.max_length)}
1376
+ .value=${lt(this.shownValue == null ? "" : String(this.shownValue))}
1377
+ placeholder=${N(this.field.placeholder)}
1378
+ maxlength=${N(this.field.max_length)}
1379
1379
  rows=${this.field.rows ?? 3}
1380
- autocomplete=${L(this.field.autocomplete)}
1380
+ autocomplete=${N(this.field.autocomplete)}
1381
1381
  ?disabled=${this.disabled}
1382
1382
  ?readonly=${this.readonly}
1383
1383
  ?required=${this.required}
@@ -1387,25 +1387,25 @@ let Ne = class extends W {
1387
1387
  ></textarea>`;
1388
1388
  }
1389
1389
  };
1390
- Ne = na([
1391
- u("baht-textarea")
1392
- ], Ne);
1393
- var ha = Object.getOwnPropertyDescriptor, ca = (t, e, i, a) => {
1394
- for (var s = a > 1 ? void 0 : a ? ha(e, i) : e, r = t.length - 1, o; r >= 0; r--)
1390
+ qe = ha([
1391
+ b("baht-textarea")
1392
+ ], qe);
1393
+ var ca = Object.getOwnPropertyDescriptor, pa = (t, e, i, a) => {
1394
+ for (var s = a > 1 ? void 0 : a ? ca(e, i) : e, r = t.length - 1, o; r >= 0; r--)
1395
1395
  (o = t[r]) && (s = o(s) || s);
1396
1396
  return s;
1397
1397
  };
1398
- let qe = class extends W {
1398
+ let Re = class extends Y {
1399
1399
  renderControl() {
1400
1400
  return n`<input
1401
1401
  class="baht-control baht-control--number"
1402
1402
  id=${this.controlId}
1403
1403
  type="number"
1404
- .value=${rt(this.shownValue == null ? "" : String(this.shownValue))}
1405
- placeholder=${L(this.field.placeholder)}
1406
- min=${L(this.field.min)}
1407
- max=${L(this.field.max)}
1408
- step=${L(this.field.step)}
1404
+ .value=${lt(this.shownValue == null ? "" : String(this.shownValue))}
1405
+ placeholder=${N(this.field.placeholder)}
1406
+ min=${N(this.field.min)}
1407
+ max=${N(this.field.max)}
1408
+ step=${N(this.field.step)}
1409
1409
  ?disabled=${this.disabled}
1410
1410
  ?readonly=${this.readonly}
1411
1411
  ?required=${this.required}
@@ -1418,23 +1418,23 @@ let qe = class extends W {
1418
1418
  />`;
1419
1419
  }
1420
1420
  };
1421
- qe = ca([
1422
- u("baht-number")
1423
- ], qe);
1424
- var pa = Object.defineProperty, da = Object.getOwnPropertyDescriptor, Te = (t, e, i, a) => {
1425
- for (var s = a > 1 ? void 0 : a ? da(e, i) : e, r = t.length - 1, o; r >= 0; r--)
1421
+ Re = pa([
1422
+ b("baht-number")
1423
+ ], Re);
1424
+ var da = Object.defineProperty, ua = Object.getOwnPropertyDescriptor, Te = (t, e, i, a) => {
1425
+ for (var s = a > 1 ? void 0 : a ? ua(e, i) : e, r = t.length - 1, o; r >= 0; r--)
1426
1426
  (o = t[r]) && (s = (a ? o(e, i, s) : o(s)) || s);
1427
- return a && s && pa(e, i, s), s;
1427
+ return a && s && da(e, i, s), s;
1428
1428
  };
1429
- const ua = 500;
1430
- let oe = class extends W {
1429
+ const ba = 500;
1430
+ let le = class extends Y {
1431
1431
  constructor() {
1432
1432
  super(...arguments), this.open = !1, this.active = 0, this.typeBuffer = "", this.onDocMousedown = (t) => {
1433
1433
  this.contains(t.target) || this.close();
1434
1434
  };
1435
1435
  }
1436
1436
  disconnectedCallback() {
1437
- super.disconnectedCallback(), clearTimeout(this.typeTimer), q() && document.removeEventListener("mousedown", this.onDocMousedown);
1437
+ super.disconnectedCallback(), clearTimeout(this.typeTimer), S() && document.removeEventListener("mousedown", this.onDocMousedown);
1438
1438
  }
1439
1439
  get listId() {
1440
1440
  return `${this.controlId}-list`;
@@ -1445,7 +1445,7 @@ let oe = class extends W {
1445
1445
  /** Placeholder row first (picks `null`), then the field's options. */
1446
1446
  get rows() {
1447
1447
  return [
1448
- { key: "", label: this.field.placeholder ?? v("choose") },
1448
+ { key: "", label: this.field.placeholder ?? m("choose") },
1449
1449
  ...this.field.options ?? []
1450
1450
  ];
1451
1451
  }
@@ -1469,10 +1469,10 @@ let oe = class extends W {
1469
1469
  (e = t == null ? void 0 : t.scrollIntoView) == null || e.call(t, { block: "nearest" });
1470
1470
  }
1471
1471
  openList() {
1472
- !this.interactive || this.open || (this.active = this.selectedIndex, this.open = !0, q() && document.addEventListener("mousedown", this.onDocMousedown));
1472
+ !this.interactive || this.open || (this.active = this.selectedIndex, this.open = !0, S() && document.addEventListener("mousedown", this.onDocMousedown));
1473
1473
  }
1474
1474
  close() {
1475
- this.open && (this.open = !1, q() && document.removeEventListener("mousedown", this.onDocMousedown));
1475
+ this.open && (this.open = !1, S() && document.removeEventListener("mousedown", this.onDocMousedown));
1476
1476
  }
1477
1477
  toggle() {
1478
1478
  this.open ? this.close() : this.openList();
@@ -1490,7 +1490,7 @@ let oe = class extends W {
1490
1490
  }
1491
1491
  /** Type-to-select: first option (after the highlighted one) starting with the buffer. */
1492
1492
  typeahead(t) {
1493
- clearTimeout(this.typeTimer), this.typeBuffer += t.toLowerCase(), this.typeTimer = setTimeout(() => this.typeBuffer = "", ua);
1493
+ clearTimeout(this.typeTimer), this.typeBuffer += t.toLowerCase(), this.typeTimer = setTimeout(() => this.typeBuffer = "", ba);
1494
1494
  const e = this.rows, i = this.typeBuffer.length === 1 ? this.active + 1 : this.active;
1495
1495
  for (let a = 0; a < e.length; a++) {
1496
1496
  const s = (i + a) % e.length;
@@ -1586,19 +1586,19 @@ let oe = class extends W {
1586
1586
  };
1587
1587
  Te([
1588
1588
  y()
1589
- ], oe.prototype, "open", 2);
1589
+ ], le.prototype, "open", 2);
1590
1590
  Te([
1591
1591
  y()
1592
- ], oe.prototype, "active", 2);
1593
- oe = Te([
1594
- u("baht-select")
1595
- ], oe);
1596
- var ba = Object.getOwnPropertyDescriptor, fa = (t, e, i, a) => {
1597
- for (var s = a > 1 ? void 0 : a ? ba(e, i) : e, r = t.length - 1, o; r >= 0; r--)
1592
+ ], le.prototype, "active", 2);
1593
+ le = Te([
1594
+ b("baht-select")
1595
+ ], le);
1596
+ var fa = Object.getOwnPropertyDescriptor, ma = (t, e, i, a) => {
1597
+ for (var s = a > 1 ? void 0 : a ? fa(e, i) : e, r = t.length - 1, o; r >= 0; r--)
1598
1598
  (o = t[r]) && (s = o(s) || s);
1599
1599
  return s;
1600
1600
  };
1601
- let Re = class extends W {
1601
+ let ze = class extends Y {
1602
1602
  get selected() {
1603
1603
  return Array.isArray(this.value) ? this.value : [];
1604
1604
  }
@@ -1618,7 +1618,7 @@ let Re = class extends W {
1618
1618
  <input
1619
1619
  type="checkbox"
1620
1620
  value=${t.key}
1621
- .checked=${rt(this.selected.includes(t.key))}
1621
+ .checked=${lt(this.selected.includes(t.key))}
1622
1622
  ?disabled=${this.disabled || this.readonly}
1623
1623
  @change=${(e) => this.toggle(t.key, e.target.checked)}
1624
1624
  />
@@ -1628,15 +1628,15 @@ let Re = class extends W {
1628
1628
  </div>`;
1629
1629
  }
1630
1630
  };
1631
- Re = fa([
1632
- u("baht-multiselect")
1633
- ], Re);
1634
- var ma = Object.getOwnPropertyDescriptor, va = (t, e, i, a) => {
1635
- for (var s = a > 1 ? void 0 : a ? ma(e, i) : e, r = t.length - 1, o; r >= 0; r--)
1631
+ ze = ma([
1632
+ b("baht-multiselect")
1633
+ ], ze);
1634
+ var va = Object.getOwnPropertyDescriptor, $a = (t, e, i, a) => {
1635
+ for (var s = a > 1 ? void 0 : a ? va(e, i) : e, r = t.length - 1, o; r >= 0; r--)
1636
1636
  (o = t[r]) && (s = o(s) || s);
1637
1637
  return s;
1638
1638
  };
1639
- let ze = class extends W {
1639
+ let Ve = class extends Y {
1640
1640
  /** Label sits beside the box, so suppress the block label. */
1641
1641
  renderLabel() {
1642
1642
  return h;
@@ -1646,7 +1646,7 @@ let ze = class extends W {
1646
1646
  <input
1647
1647
  type="checkbox"
1648
1648
  id=${this.controlId}
1649
- .checked=${rt(this.value === !0)}
1649
+ .checked=${lt(this.value === !0)}
1650
1650
  ?disabled=${this.disabled || this.readonly}
1651
1651
  ?required=${this.required}
1652
1652
  aria-invalid=${this.invalid}
@@ -1659,15 +1659,15 @@ let ze = class extends W {
1659
1659
  </label>`;
1660
1660
  }
1661
1661
  };
1662
- ze = va([
1663
- u("baht-checkbox")
1664
- ], ze);
1665
- var $a = Object.getOwnPropertyDescriptor, ya = (t, e, i, a) => {
1666
- for (var s = a > 1 ? void 0 : a ? $a(e, i) : e, r = t.length - 1, o; r >= 0; r--)
1662
+ Ve = $a([
1663
+ b("baht-checkbox")
1664
+ ], Ve);
1665
+ var ya = Object.getOwnPropertyDescriptor, ga = (t, e, i, a) => {
1666
+ for (var s = a > 1 ? void 0 : a ? ya(e, i) : e, r = t.length - 1, o; r >= 0; r--)
1667
1667
  (o = t[r]) && (s = o(s) || s);
1668
1668
  return s;
1669
1669
  };
1670
- let Ve = class extends W {
1670
+ let Ke = class extends Y {
1671
1671
  renderControl() {
1672
1672
  return n`<div
1673
1673
  class="baht-control baht-control--radio"
@@ -1683,7 +1683,7 @@ let Ve = class extends W {
1683
1683
  type="radio"
1684
1684
  name=${this.controlId}
1685
1685
  value=${t.key}
1686
- .checked=${rt(this.value === t.key)}
1686
+ .checked=${lt(this.value === t.key)}
1687
1687
  ?disabled=${this.disabled || this.readonly}
1688
1688
  @change=${() => this.emitInput(t.key)}
1689
1689
  />
@@ -1693,15 +1693,15 @@ let Ve = class extends W {
1693
1693
  </div>`;
1694
1694
  }
1695
1695
  };
1696
- Ve = ya([
1697
- u("baht-radio")
1698
- ], Ve);
1699
- var ga = Object.getOwnPropertyDescriptor, wa = (t, e, i, a) => {
1700
- for (var s = a > 1 ? void 0 : a ? ga(e, i) : e, r = t.length - 1, o; r >= 0; r--)
1696
+ Ke = ga([
1697
+ b("baht-radio")
1698
+ ], Ke);
1699
+ var wa = Object.getOwnPropertyDescriptor, xa = (t, e, i, a) => {
1700
+ for (var s = a > 1 ? void 0 : a ? wa(e, i) : e, r = t.length - 1, o; r >= 0; r--)
1701
1701
  (o = t[r]) && (s = o(s) || s);
1702
1702
  return s;
1703
1703
  };
1704
- let Ke = class extends W {
1704
+ let Ue = class extends Y {
1705
1705
  renderLabel() {
1706
1706
  return h;
1707
1707
  }
@@ -1712,7 +1712,7 @@ let Ke = class extends W {
1712
1712
  role="switch"
1713
1713
  id=${this.controlId}
1714
1714
  aria-checked=${this.value === !0 ? "true" : "false"}
1715
- .checked=${rt(this.value === !0)}
1715
+ .checked=${lt(this.value === !0)}
1716
1716
  ?disabled=${this.disabled || this.readonly}
1717
1717
  ?required=${this.required}
1718
1718
  aria-invalid=${this.invalid}
@@ -1726,15 +1726,15 @@ let Ke = class extends W {
1726
1726
  </label>`;
1727
1727
  }
1728
1728
  };
1729
- Ke = wa([
1730
- u("baht-toggle")
1731
- ], Ke);
1732
- var xa = Object.getOwnPropertyDescriptor, _a = (t, e, i, a) => {
1733
- for (var s = a > 1 ? void 0 : a ? xa(e, i) : e, r = t.length - 1, o; r >= 0; r--)
1729
+ Ue = xa([
1730
+ b("baht-toggle")
1731
+ ], Ue);
1732
+ var _a = Object.getOwnPropertyDescriptor, ka = (t, e, i, a) => {
1733
+ for (var s = a > 1 ? void 0 : a ? _a(e, i) : e, r = t.length - 1, o; r >= 0; r--)
1734
1734
  (o = t[r]) && (s = o(s) || s);
1735
1735
  return s;
1736
1736
  };
1737
- let Ue = class extends W {
1737
+ let He = class extends Y {
1738
1738
  constructor() {
1739
1739
  super(...arguments), this.lastEmitted = null;
1740
1740
  }
@@ -1744,7 +1744,7 @@ let Ue = class extends W {
1744
1744
  id=${this.controlId}
1745
1745
  type="text"
1746
1746
  autocomplete="off"
1747
- placeholder=${L(this.field.placeholder)}
1747
+ placeholder=${N(this.field.placeholder)}
1748
1748
  ?disabled=${this.disabled}
1749
1749
  ?readonly=${this.readonly}
1750
1750
  ?required=${this.required}
@@ -1765,7 +1765,7 @@ let Ue = class extends W {
1765
1765
  return;
1766
1766
  }
1767
1767
  if (!this.fp || this.fp.input !== e || t.has("field") || t.has("disabled") || t.has("readonly")) {
1768
- this.teardown(), this.fp = vs(e, this.options());
1768
+ this.teardown(), this.fp = $s(e, this.options());
1769
1769
  return;
1770
1770
  }
1771
1771
  t.has("value") && (this.lastEmitted = null, this.syncValue());
@@ -1778,10 +1778,10 @@ let Ue = class extends W {
1778
1778
  syncValue() {
1779
1779
  if (!this.fp) return;
1780
1780
  const t = this.datesOf(this.value);
1781
- Ge(this.fp.selectedDates, t) || (t.length === 0 ? this.fp.clear(!1) : this.fp.setDate(t, !1));
1781
+ We(this.fp.selectedDates, t) || (t.length === 0 ? this.fp.clear(!1) : this.fp.setDate(t, !1));
1782
1782
  }
1783
1783
  options() {
1784
- const t = this.field, e = ve(t), i = Lt(t.min), a = Lt(t.max);
1784
+ const t = this.field, e = $e(t), i = Nt(t.min), a = Nt(t.max);
1785
1785
  return {
1786
1786
  static: !0,
1787
1787
  disableMobile: !0,
@@ -1793,7 +1793,7 @@ let Ue = class extends W {
1793
1793
  defaultDate: this.datesOf(this.value),
1794
1794
  ...i ? { minDate: i } : {},
1795
1795
  ...a ? { maxDate: a } : {},
1796
- disable: We(t),
1796
+ disable: Je(t),
1797
1797
  onReady: (s, r, o) => this.mountFooter(o),
1798
1798
  onOpen: () => this.refreshFooter(),
1799
1799
  onChange: (s) => {
@@ -1810,9 +1810,9 @@ let Ue = class extends W {
1810
1810
  const e = document.createElement("div");
1811
1811
  e.className = "baht-datepicker-footer";
1812
1812
  const i = document.createElement("button");
1813
- i.type = "button", i.className = "baht-button baht-button--sm baht-datepicker-today", i.textContent = v("today"), i.addEventListener("click", () => this.pickToday());
1813
+ i.type = "button", i.className = "baht-button baht-button--sm baht-datepicker-today", i.textContent = m("today"), i.addEventListener("click", () => this.pickToday());
1814
1814
  const a = document.createElement("button");
1815
- a.type = "button", a.className = "baht-button baht-button--danger baht-button--sm baht-datepicker-clear", a.textContent = v("clear"), a.addEventListener("click", () => {
1815
+ a.type = "button", a.className = "baht-button baht-button--danger baht-button--sm baht-datepicker-clear", a.textContent = m("clear"), a.addEventListener("click", () => {
1816
1816
  var s, r;
1817
1817
  (s = this.fp) == null || s.clear(), (r = this.fp) == null || r.close();
1818
1818
  }), e.append(i, a), t.calendarContainer.appendChild(e), this.todayBtn = i, this.clearBtn = a, this.refreshFooter(t);
@@ -1824,15 +1824,15 @@ let Ue = class extends W {
1824
1824
  t && (this.todayBtn && (this.todayBtn.disabled = !this.todayAllowed()), this.clearBtn && (this.clearBtn.disabled = t.selectedDates.length === 0));
1825
1825
  }
1826
1826
  todayAllowed() {
1827
- const t = xt(/* @__PURE__ */ new Date()), e = Lt(this.field.min), i = Lt(this.field.max);
1828
- if (e && t < xt(e) || i && t > xt(i)) return !1;
1829
- for (const a of We(this.field) ?? [])
1827
+ const t = kt(/* @__PURE__ */ new Date()), e = Nt(this.field.min), i = Nt(this.field.max);
1828
+ if (e && t < kt(e) || i && t > kt(i)) return !1;
1829
+ for (const a of Je(this.field) ?? [])
1830
1830
  if (a instanceof Date) {
1831
- if (He(a, t)) return !1;
1831
+ if (Ge(a, t)) return !1;
1832
1832
  } else if (typeof a == "function") {
1833
1833
  if (a(t)) return !1;
1834
1834
  } else if (typeof a == "object" && "from" in a) {
1835
- const s = xt(new Date(a.from)), r = xt(new Date(a.to));
1835
+ const s = kt(new Date(a.from)), r = kt(new Date(a.to));
1836
1836
  if (t >= s && t <= r) return !1;
1837
1837
  }
1838
1838
  return !0;
@@ -1840,13 +1840,13 @@ let Ue = class extends W {
1840
1840
  pickToday() {
1841
1841
  const t = this.fp;
1842
1842
  if (!t || !this.todayAllowed()) return;
1843
- const e = xt(/* @__PURE__ */ new Date());
1844
- switch (ve(this.field)) {
1843
+ const e = kt(/* @__PURE__ */ new Date());
1844
+ switch ($e(this.field)) {
1845
1845
  case "range":
1846
1846
  t.setDate([e, e], !0);
1847
1847
  break;
1848
1848
  case "multiple": {
1849
- t.selectedDates.some((a) => He(a, e)) || t.setDate([...t.selectedDates, e], !0);
1849
+ t.selectedDates.some((a) => Ge(a, e)) || t.setDate([...t.selectedDates, e], !0);
1850
1850
  break;
1851
1851
  }
1852
1852
  default:
@@ -1856,16 +1856,16 @@ let Ue = class extends W {
1856
1856
  }
1857
1857
  emitIfChanged(t) {
1858
1858
  const e = this.lastEmitted ?? this.datesOf(this.value);
1859
- Ge(t, e) || (this.lastEmitted = [...t], this.emitInput(this.toValue(t)));
1859
+ We(t, e) || (this.lastEmitted = [...t], this.emitInput(this.toValue(t)));
1860
1860
  }
1861
1861
  /** Host value (any mode) -> the Date list flatpickr works with. */
1862
1862
  datesOf(t) {
1863
- return ps(t).map(Lt).filter((e) => e !== null);
1863
+ return ds(t).map(Nt).filter((e) => e !== null);
1864
1864
  }
1865
1865
  /** flatpickr's selection -> the value shape of the field's mode. */
1866
1866
  toValue(t) {
1867
- const e = t.map(Rt);
1868
- switch (ve(this.field)) {
1867
+ const e = t.map(zt);
1868
+ switch ($e(this.field)) {
1869
1869
  case "range":
1870
1870
  return e.length === 2 ? [e[0], e[1]] : null;
1871
1871
  case "multiple":
@@ -1875,44 +1875,44 @@ let Ue = class extends W {
1875
1875
  }
1876
1876
  }
1877
1877
  };
1878
- Ue = _a([
1879
- u("baht-datepicker")
1880
- ], Ue);
1881
- function xt(t) {
1878
+ He = ka([
1879
+ b("baht-datepicker")
1880
+ ], He);
1881
+ function kt(t) {
1882
1882
  return new Date(t.getFullYear(), t.getMonth(), t.getDate());
1883
1883
  }
1884
- function He(t, e) {
1885
- return Rt(t) === Rt(e);
1886
- }
1887
1884
  function Ge(t, e) {
1888
- return t.length !== e.length ? !1 : t.every((i, a) => Rt(i) === Rt(e[a]));
1885
+ return zt(t) === zt(e);
1886
+ }
1887
+ function We(t, e) {
1888
+ return t.length !== e.length ? !1 : t.every((i, a) => zt(i) === zt(e[a]));
1889
1889
  }
1890
- function We(t) {
1890
+ function Je(t) {
1891
1891
  const e = [];
1892
1892
  for (const a of t.disabled_dates ?? []) {
1893
- const s = ds(a);
1893
+ const s = us(a);
1894
1894
  s && e.push(s[0].getTime() === s[1].getTime() ? s[0] : { from: s[0], to: s[1] });
1895
1895
  }
1896
1896
  const i = t.disabled_weekdays;
1897
1897
  return i != null && i.length && e.push((a) => i.includes(a.getDay())), e;
1898
1898
  }
1899
- var ka = Object.defineProperty, Pa = Object.getOwnPropertyDescriptor, Zt = (t, e, i, a) => {
1900
- for (var s = a > 1 ? void 0 : a ? Pa(e, i) : e, r = t.length - 1, o; r >= 0; r--)
1899
+ var Pa = Object.defineProperty, Oa = Object.getOwnPropertyDescriptor, Qt = (t, e, i, a) => {
1900
+ for (var s = a > 1 ? void 0 : a ? Oa(e, i) : e, r = t.length - 1, o; r >= 0; r--)
1901
1901
  (o = t[r]) && (s = (a ? o(e, i, s) : o(s)) || s);
1902
- return a && s && ka(e, i, s), s;
1902
+ return a && s && Pa(e, i, s), s;
1903
1903
  };
1904
- function Je(t) {
1904
+ function Ye(t) {
1905
1905
  return t !== null && typeof t == "object" && typeof t.url == "string";
1906
1906
  }
1907
- function ye(t) {
1907
+ function ge(t) {
1908
1908
  return t >= 1024 * 1024 ? `${(t / 1024 / 1024).toFixed(1)} MB` : t >= 1024 ? `${Math.round(t / 1024)} KB` : `${t} B`;
1909
1909
  }
1910
- let Dt = class extends W {
1910
+ let Et = class extends Y {
1911
1911
  constructor() {
1912
1912
  super(...arguments), this.uploadingCount = 0, this.uploadError = null, this.rejectedNames = [];
1913
1913
  }
1914
1914
  get refs() {
1915
- return Array.isArray(this.value) ? this.value.filter(Je) : Je(this.value) ? [this.value] : [];
1915
+ return Array.isArray(this.value) ? this.value.filter(Ye) : Ye(this.value) ? [this.value] : [];
1916
1916
  }
1917
1917
  emitRefs(t) {
1918
1918
  this.emitInput(this.field.multiple ? t : t[0] ?? null);
@@ -1925,7 +1925,7 @@ let Dt = class extends W {
1925
1925
  try {
1926
1926
  e.push(await this.uploader(i));
1927
1927
  } catch {
1928
- this.uploadError = v("uploadFailed");
1928
+ this.uploadError = m("uploadFailed");
1929
1929
  } finally {
1930
1930
  this.uploadingCount -= 1;
1931
1931
  }
@@ -1950,7 +1950,7 @@ let Dt = class extends W {
1950
1950
  const t = [];
1951
1951
  return this.field.accept && t.push(
1952
1952
  this.field.accept.split(",").map((e) => e.trim()).join(", ")
1953
- ), this.field.max_size && t.push(v("uploadMaxSize", { size: ye(this.field.max_size) })), t.join(" · ");
1953
+ ), this.field.max_size && t.push(m("uploadMaxSize", { size: ge(this.field.max_size) })), t.join(" · ");
1954
1954
  }
1955
1955
  renderControl() {
1956
1956
  const t = this.disabled || this.readonly || this.uploadingCount > 0, e = this.hintText(), i = [
@@ -1973,7 +1973,7 @@ let Dt = class extends W {
1973
1973
  class="baht-control baht-control--file baht-dropzone-input"
1974
1974
  id=${this.controlId}
1975
1975
  type="file"
1976
- accept=${L(this.field.accept)}
1976
+ accept=${N(this.field.accept)}
1977
1977
  ?multiple=${this.field.multiple}
1978
1978
  ?disabled=${t}
1979
1979
  ?required=${this.required}
@@ -1981,83 +1981,83 @@ let Dt = class extends W {
1981
1981
  aria-describedby=${this.describedBy}
1982
1982
  @change=${(a) => this.onPick(a)}
1983
1983
  />
1984
- <span class="baht-dropzone-icon" aria-hidden="true">${U("upload")}</span>
1984
+ <span class="baht-dropzone-icon" aria-hidden="true">${W("upload")}</span>
1985
1985
  <span class="baht-dropzone-text">
1986
1986
  <label class="baht-dropzone-action" for=${this.controlId}
1987
- >${this.field.multiple ? v("chooseFiles") : v("chooseFile")}</label
1987
+ >${this.field.multiple ? m("chooseFiles") : m("chooseFile")}</label
1988
1988
  >
1989
- <span class="baht-dropzone-or">${v("orDropHere")}</span>
1989
+ <span class="baht-dropzone-or">${m("orDropHere")}</span>
1990
1990
  </span>
1991
1991
  ${e ? n`<span class="baht-dropzone-hint">${e}</span>` : h}
1992
1992
  </div>
1993
- ${this.uploadingCount > 0 ? n`<p class="baht-file-status" role="status">${v("uploading")}</p>` : h}
1993
+ ${this.uploadingCount > 0 ? n`<p class="baht-file-status" role="status">${m("uploading")}</p>` : h}
1994
1994
  ${this.uploadError ? n`<p class="baht-error" role="alert">${this.uploadError}</p>` : h}
1995
1995
  ${this.rejectedNames.length > 0 ? n`<p class="baht-error baht-file-rejected" role="alert">
1996
- ${v("fileRejectedTooLarge", { names: this.rejectedNames.join(", ") })}
1996
+ ${m("fileRejectedTooLarge", { names: this.rejectedNames.join(", ") })}
1997
1997
  </p>` : h}
1998
1998
  ${this.captured.map(
1999
1999
  (a) => n`<span class="baht-file-chip">
2000
2000
  <span class="baht-file-name">${a.name}</span>
2001
- <span class="baht-file-size">${ye(a.size)}</span>
2001
+ <span class="baht-file-size">${ge(a.size)}</span>
2002
2002
  </span>`
2003
2003
  )}
2004
2004
  ${this.refs.map(
2005
2005
  (a) => n`<span class="baht-file-chip">
2006
2006
  <a href=${a.url} target="_blank" rel="noreferrer"
2007
- >${a.name}<span class="baht-visually-hidden"> (${v("opensInNewTab")})</span></a
2007
+ >${a.name}<span class="baht-visually-hidden"> (${m("opensInNewTab")})</span></a
2008
2008
  >
2009
- <span class="baht-file-size">${ye(a.size)}</span>
2009
+ <span class="baht-file-size">${ge(a.size)}</span>
2010
2010
  ${this.disabled || this.readonly ? h : n`<button
2011
2011
  type="button"
2012
2012
  class="baht-file-remove"
2013
- aria-label=${v("removeFile")}
2014
- title=${v("removeFile")}
2013
+ aria-label=${m("removeFile")}
2014
+ title=${m("removeFile")}
2015
2015
  @click=${() => this.emitRefs(this.refs.filter((s) => s !== a))}
2016
2016
  >
2017
- ${U("close")}
2017
+ ${W("close")}
2018
2018
  </button>`}
2019
2019
  </span>`
2020
2020
  )}`;
2021
2021
  }
2022
2022
  };
2023
- Zt([
2023
+ Qt([
2024
2024
  l({ attribute: !1 })
2025
- ], Dt.prototype, "uploader", 2);
2026
- Zt([
2025
+ ], Et.prototype, "uploader", 2);
2026
+ Qt([
2027
2027
  y()
2028
- ], Dt.prototype, "uploadingCount", 2);
2029
- Zt([
2028
+ ], Et.prototype, "uploadingCount", 2);
2029
+ Qt([
2030
2030
  y()
2031
- ], Dt.prototype, "uploadError", 2);
2032
- Zt([
2031
+ ], Et.prototype, "uploadError", 2);
2032
+ Qt([
2033
2033
  y()
2034
- ], Dt.prototype, "rejectedNames", 2);
2035
- Dt = Zt([
2036
- u("baht-file")
2037
- ], Dt);
2038
- var Oa = Object.defineProperty, Ca = Object.getOwnPropertyDescriptor, I = (t, e, i, a) => {
2039
- for (var s = a > 1 ? void 0 : a ? Ca(e, i) : e, r = t.length - 1, o; r >= 0; r--)
2034
+ ], Et.prototype, "rejectedNames", 2);
2035
+ Et = Qt([
2036
+ b("baht-file")
2037
+ ], Et);
2038
+ var Ca = Object.defineProperty, Da = Object.getOwnPropertyDescriptor, I = (t, e, i, a) => {
2039
+ for (var s = a > 1 ? void 0 : a ? Da(e, i) : e, r = t.length - 1, o; r >= 0; r--)
2040
2040
  (o = t[r]) && (s = (a ? o(e, i, s) : o(s)) || s);
2041
- return a && s && Oa(e, i, s), s;
2041
+ return a && s && Ca(e, i, s), s;
2042
2042
  };
2043
- function Da(t, e) {
2043
+ function Fa(t, e) {
2044
2044
  return e.split(".").reduce((i, a) => {
2045
2045
  if (i !== null && typeof i == "object") return i[a];
2046
2046
  }, t);
2047
2047
  }
2048
- function Fa(t, e) {
2048
+ function Ea(t, e) {
2049
2049
  const i = t.trim();
2050
2050
  if (!i) return null;
2051
2051
  try {
2052
2052
  const a = JSON.parse(i);
2053
2053
  if (typeof a == "string") return a;
2054
- const s = e ? Da(a, e) : a;
2054
+ const s = e ? Fa(a, e) : a;
2055
2055
  return typeof s == "string" && s ? s : null;
2056
2056
  } catch {
2057
2057
  return /^(https?:\/\/|\/|data:|blob:)/.test(i) ? i : null;
2058
2058
  }
2059
2059
  }
2060
- function Ea(t) {
2060
+ function Ba(t) {
2061
2061
  const i = (t.split(/[?#]/)[0] ?? t).split("/").filter(Boolean).pop() ?? t;
2062
2062
  try {
2063
2063
  return decodeURIComponent(i);
@@ -2065,10 +2065,10 @@ function Ea(t) {
2065
2065
  return i;
2066
2066
  }
2067
2067
  }
2068
- function ge(t) {
2068
+ function we(t) {
2069
2069
  return t >= 1024 * 1024 ? `${(t / 1024 / 1024).toFixed(1)} MB` : t >= 1024 ? `${Math.round(t / 1024)} KB` : `${t} B`;
2070
2070
  }
2071
- let F = class extends $ {
2071
+ let F = class extends g {
2072
2072
  constructor() {
2073
2073
  super(...arguments), this.url = "", this.method = "POST", this.fieldName = "file", this.responseKey = "url", this.headers = {}, this.withCredentials = !1, this.value = null, this.label = "", this.hint = "", this.multiple = !1, this.disabled = !1, this.required = !1, this.error = null, this.pending = [], this.rejectedNames = [], this.dragging = !1, this.known = /* @__PURE__ */ new Map(), this.seq = 0;
2074
2074
  }
@@ -2079,7 +2079,7 @@ let F = class extends $ {
2079
2079
  return `baht-upload-${this.uid}`;
2080
2080
  }
2081
2081
  fileFor(t) {
2082
- return this.known.get(t) ?? { name: Ea(t), size: 0, url: t };
2082
+ return this.known.get(t) ?? { name: Ba(t), size: 0, url: t };
2083
2083
  }
2084
2084
  /** Empty the value (does not delete anything on the server). */
2085
2085
  clear() {
@@ -2139,7 +2139,7 @@ let F = class extends $ {
2139
2139
  })
2140
2140
  );
2141
2141
  }, e.onload = () => {
2142
- const a = e.status >= 200 && e.status < 300, s = a ? Fa(e.responseText, this.responseKey) : null;
2142
+ const a = e.status >= 200 && e.status < 300, s = a ? Ea(e.responseText, this.responseKey) : null;
2143
2143
  if (!a || !s) return this.failed(t, a ? 0 : e.status);
2144
2144
  this.known.set(s, {
2145
2145
  name: t.file.name,
@@ -2152,7 +2152,7 @@ let F = class extends $ {
2152
2152
  i.append(this.fieldName || "file", t.file, t.file.name), e.send(i);
2153
2153
  }
2154
2154
  failed(t, e) {
2155
- const i = v("uploadFailed");
2155
+ const i = m("uploadFailed");
2156
2156
  this.patch(t.id, { error: i, percent: 0 }), this.dispatchEvent(
2157
2157
  new CustomEvent("baht-upload-error", {
2158
2158
  detail: { file: t.file, status: e, message: i },
@@ -2171,7 +2171,7 @@ let F = class extends $ {
2171
2171
  const t = [];
2172
2172
  return this.accept && t.push(
2173
2173
  this.accept.split(",").map((e) => e.trim()).join(", ")
2174
- ), this.maxSize && t.push(v("uploadMaxSize", { size: ge(this.maxSize) })), t.join(" · ");
2174
+ ), this.maxSize && t.push(m("uploadMaxSize", { size: we(this.maxSize) })), t.join(" · ");
2175
2175
  }
2176
2176
  render() {
2177
2177
  const t = this.pending.some((c) => !c.error), e = !!this.error, i = this.hint || this.defaultHint(), a = i ? `${this.inputId}-hint` : void 0, s = this.error ? `${this.inputId}-error` : void 0, r = [a, s].filter(Boolean).join(" ") || void 0, o = [
@@ -2194,22 +2194,22 @@ let F = class extends $ {
2194
2194
  class="baht-dropzone-input"
2195
2195
  id=${this.inputId}
2196
2196
  type="file"
2197
- accept=${L(this.accept)}
2197
+ accept=${N(this.accept)}
2198
2198
  ?multiple=${this.multiple}
2199
2199
  ?disabled=${this.disabled}
2200
2200
  ?required=${this.required}
2201
2201
  aria-invalid=${e ? "true" : "false"}
2202
- aria-describedby=${L(r)}
2202
+ aria-describedby=${N(r)}
2203
2203
  @change=${(c) => this.onPick(c)}
2204
2204
  />
2205
- <span class="baht-dropzone-icon" aria-hidden="true">${U("upload")}</span>
2205
+ <span class="baht-dropzone-icon" aria-hidden="true">${W("upload")}</span>
2206
2206
  <span class="baht-dropzone-text">
2207
2207
  <label class="baht-dropzone-action" for=${this.inputId}
2208
- >${this.multiple ? v("chooseFiles") : v("chooseFile")}</label
2208
+ >${this.multiple ? m("chooseFiles") : m("chooseFile")}</label
2209
2209
  >
2210
- <span class="baht-dropzone-or">${v("orDropHere")}</span>
2210
+ <span class="baht-dropzone-or">${m("orDropHere")}</span>
2211
2211
  </span>
2212
- ${i ? n`<span class="baht-dropzone-hint" id=${L(a)}>${i}</span>` : h}
2212
+ ${i ? n`<span class="baht-dropzone-hint" id=${N(a)}>${i}</span>` : h}
2213
2213
  </div>
2214
2214
 
2215
2215
  ${this.pending.length > 0 || this.urls.length > 0 ? n`<ul class="baht-upload-list" aria-live="polite" aria-busy=${t ? "true" : "false"}>
@@ -2217,50 +2217,50 @@ let F = class extends $ {
2217
2217
  ${this.pending.map((c) => this.renderPending(c))}
2218
2218
  </ul>` : h}
2219
2219
  ${this.rejectedNames.length > 0 ? n`<p class="baht-error" role="alert">
2220
- ${v("fileRejectedTooLarge", { names: this.rejectedNames.join(", ") })}
2220
+ ${m("fileRejectedTooLarge", { names: this.rejectedNames.join(", ") })}
2221
2221
  </p>` : h}
2222
- ${this.error ? n`<p class="baht-error" id=${L(s)} role="alert">${this.error}</p>` : h}
2222
+ ${this.error ? n`<p class="baht-error" id=${N(s)} role="alert">${this.error}</p>` : h}
2223
2223
  </div>`;
2224
2224
  }
2225
2225
  renderStored(t) {
2226
2226
  const e = this.fileFor(t);
2227
2227
  return n`<li class="baht-file-chip baht-file-chip--done">
2228
- <span class="baht-file-chip-icon" aria-hidden="true">${U("check")}</span>
2228
+ <span class="baht-file-chip-icon" aria-hidden="true">${W("check")}</span>
2229
2229
  <a class="baht-file-name" href=${t} target="_blank" rel="noreferrer"
2230
- >${e.name}<span class="baht-visually-hidden"> (${v("opensInNewTab")})</span></a
2230
+ >${e.name}<span class="baht-visually-hidden"> (${m("opensInNewTab")})</span></a
2231
2231
  >
2232
- ${e.size > 0 ? n`<span class="baht-file-size">${ge(e.size)}</span>` : h}
2232
+ ${e.size > 0 ? n`<span class="baht-file-size">${we(e.size)}</span>` : h}
2233
2233
  ${this.disabled ? h : n`<button
2234
2234
  type="button"
2235
2235
  class="baht-file-remove"
2236
- aria-label=${v("removeFile")}
2237
- title=${v("removeFile")}
2236
+ aria-label=${m("removeFile")}
2237
+ title=${m("removeFile")}
2238
2238
  @click=${() => this.emitValue(this.urls.filter((i) => i !== t))}
2239
2239
  >
2240
- ${U("close")}
2240
+ ${W("close")}
2241
2241
  </button>`}
2242
2242
  </li>`;
2243
2243
  }
2244
2244
  renderPending(t) {
2245
2245
  return n`<li class="baht-file-chip ${t.error ? "baht-file-chip--error" : "baht-file-chip--busy"}">
2246
2246
  <span class="baht-file-name">${t.file.name}</span>
2247
- <span class="baht-file-size">${ge(t.file.size)}</span>
2247
+ <span class="baht-file-size">${we(t.file.size)}</span>
2248
2248
  ${t.error ? n`<span class="baht-file-status baht-file-status--error" role="alert">${t.error}</span>
2249
2249
  <button type="button" class="baht-upload-retry" @click=${() => this.retry(t)}>
2250
- ${v("retry")}
2250
+ ${m("retry")}
2251
2251
  </button>
2252
2252
  <button
2253
2253
  type="button"
2254
2254
  class="baht-file-remove"
2255
- aria-label=${v("removeFile")}
2256
- title=${v("removeFile")}
2255
+ aria-label=${m("removeFile")}
2256
+ title=${m("removeFile")}
2257
2257
  @click=${() => this.dismiss(t)}
2258
2258
  >
2259
- ${U("close")}
2259
+ ${W("close")}
2260
2260
  </button>` : n`<span
2261
2261
  class="baht-upload-bar"
2262
2262
  role="progressbar"
2263
- aria-label=${v("uploading")}
2263
+ aria-label=${m("uploading")}
2264
2264
  aria-valuemin="0"
2265
2265
  aria-valuemax="100"
2266
2266
  aria-valuenow=${String(t.percent)}
@@ -2324,50 +2324,50 @@ I([
2324
2324
  y()
2325
2325
  ], F.prototype, "dragging", 2);
2326
2326
  F = I([
2327
- u("baht-upload")
2327
+ b("baht-upload")
2328
2328
  ], F);
2329
- var Ba = Object.defineProperty, Ia = Object.getOwnPropertyDescriptor, os = (t, e, i, a) => {
2330
- for (var s = a > 1 ? void 0 : a ? Ia(e, i) : e, r = t.length - 1, o; r >= 0; r--)
2329
+ var Ia = Object.defineProperty, Ma = Object.getOwnPropertyDescriptor, ns = (t, e, i, a) => {
2330
+ for (var s = a > 1 ? void 0 : a ? Ma(e, i) : e, r = t.length - 1, o; r >= 0; r--)
2331
2331
  (o = t[r]) && (s = (a ? o(e, i, s) : o(s)) || s);
2332
- return a && s && Ba(e, i, s), s;
2332
+ return a && s && Ia(e, i, s), s;
2333
2333
  };
2334
- let De = class extends $ {
2334
+ let Fe = class extends g {
2335
2335
  render() {
2336
2336
  if (!this.field) return h;
2337
2337
  const t = this.field.variant ?? "body";
2338
2338
  return n`<div class="baht-text baht-text--${t}">${this.field.text ?? this.field.label ?? ""}</div>`;
2339
2339
  }
2340
2340
  };
2341
- os([
2341
+ ns([
2342
2342
  l({ attribute: !1 })
2343
- ], De.prototype, "field", 2);
2344
- De = os([
2345
- u("baht-text")
2346
- ], De);
2347
- var ja = Object.defineProperty, Sa = Object.getOwnPropertyDescriptor, ls = (t, e, i, a) => {
2343
+ ], Fe.prototype, "field", 2);
2344
+ Fe = ns([
2345
+ b("baht-text")
2346
+ ], Fe);
2347
+ var ja = Object.defineProperty, Sa = Object.getOwnPropertyDescriptor, hs = (t, e, i, a) => {
2348
2348
  for (var s = a > 1 ? void 0 : a ? Sa(e, i) : e, r = t.length - 1, o; r >= 0; r--)
2349
2349
  (o = t[r]) && (s = (a ? o(e, i, s) : o(s)) || s);
2350
2350
  return a && s && ja(e, i, s), s;
2351
2351
  };
2352
- let Fe = class extends $ {
2352
+ let Ee = class extends g {
2353
2353
  render() {
2354
2354
  return this.field ? n`<div class="baht-section">
2355
2355
  <span class="baht-section-label">${this.field.text ?? this.field.label ?? ""}</span>
2356
2356
  </div>` : h;
2357
2357
  }
2358
2358
  };
2359
- ls([
2359
+ hs([
2360
2360
  l({ attribute: !1 })
2361
- ], Fe.prototype, "field", 2);
2362
- Fe = ls([
2363
- u("baht-section")
2364
- ], Fe);
2365
- var Ta = Object.defineProperty, Ma = Object.getOwnPropertyDescriptor, ue = (t, e, i, a) => {
2366
- for (var s = a > 1 ? void 0 : a ? Ma(e, i) : e, r = t.length - 1, o; r >= 0; r--)
2361
+ ], Ee.prototype, "field", 2);
2362
+ Ee = hs([
2363
+ b("baht-section")
2364
+ ], Ee);
2365
+ var Ta = Object.defineProperty, Aa = Object.getOwnPropertyDescriptor, be = (t, e, i, a) => {
2366
+ for (var s = a > 1 ? void 0 : a ? Aa(e, i) : e, r = t.length - 1, o; r >= 0; r--)
2367
2367
  (o = t[r]) && (s = (a ? o(e, i, s) : o(s)) || s);
2368
2368
  return a && s && Ta(e, i, s), s;
2369
2369
  };
2370
- let Ut = class extends $ {
2370
+ let Ht = class extends g {
2371
2371
  constructor() {
2372
2372
  super(...arguments), this.total = 0, this.label = "", this.color = "";
2373
2373
  }
@@ -2381,31 +2381,31 @@ let Ut = class extends $ {
2381
2381
  </div>`;
2382
2382
  }
2383
2383
  };
2384
- ue([
2384
+ be([
2385
2385
  l({ type: Number })
2386
- ], Ut.prototype, "total", 2);
2387
- ue([
2386
+ ], Ht.prototype, "total", 2);
2387
+ be([
2388
2388
  l()
2389
- ], Ut.prototype, "label", 2);
2390
- ue([
2389
+ ], Ht.prototype, "label", 2);
2390
+ be([
2391
2391
  l()
2392
- ], Ut.prototype, "color", 2);
2393
- Ut = ue([
2394
- u("baht-stat-chart")
2395
- ], Ut);
2396
- var Aa = Object.defineProperty, Tt = (t, e, i, a) => {
2392
+ ], Ht.prototype, "color", 2);
2393
+ Ht = be([
2394
+ b("baht-stat-chart")
2395
+ ], Ht);
2396
+ var La = Object.defineProperty, At = (t, e, i, a) => {
2397
2397
  for (var s = void 0, r = t.length - 1, o; r >= 0; r--)
2398
2398
  (o = t[r]) && (s = o(e, i, s) || s);
2399
- return s && Aa(e, i, s), s;
2399
+ return s && La(e, i, s), s;
2400
2400
  };
2401
- const La = 10;
2402
- function lt(t, e) {
2403
- return e && t === 0 ? e : `var(--baht-chart-${t % La + 1})`;
2401
+ const Na = 10;
2402
+ function ft(t, e) {
2403
+ return e && t === 0 ? e : `var(--baht-chart-${t % Na + 1})`;
2404
2404
  }
2405
- function Ye(t, e = 5) {
2405
+ function Xe(t, e = 5) {
2406
2406
  return `var(--baht-chart-seq-${Math.min(e - 1, Math.max(0, t)) + 1})`;
2407
2407
  }
2408
- function qt(t, e = "number", i = "THB") {
2408
+ function Rt(t, e = "number", i = "THB") {
2409
2409
  if (!Number.isFinite(t)) return "—";
2410
2410
  switch (e) {
2411
2411
  case "currency":
@@ -2429,22 +2429,22 @@ function qt(t, e = "number", i = "THB") {
2429
2429
  return new Intl.NumberFormat("en-US", { maximumFractionDigits: 0 }).format(t);
2430
2430
  }
2431
2431
  }
2432
- function Ee(t, e = 4) {
2432
+ function Be(t, e = 4) {
2433
2433
  if (!Number.isFinite(t) || t <= 0) return [0, 1];
2434
2434
  const i = t / (Math.max(1, e) + 1), a = 10 ** Math.floor(Math.log10(i)), s = [1, 2, 2.5, 5, 10].map((c) => c * a).find((c) => c >= i - 1e-9) ?? 10 * a, r = Math.ceil(t / s) * s, o = [];
2435
2435
  for (let c = 0; c <= r + s / 1e3; c += s) o.push(Number(c.toFixed(10)));
2436
2436
  return o;
2437
2437
  }
2438
- function le(t, e) {
2438
+ function ne(t, e) {
2439
2439
  const [i, a] = t, [s, r] = e, o = a - i;
2440
2440
  return !Number.isFinite(o) || o === 0 ? () => s : (c) => s + (c - i) / o * (r - s);
2441
2441
  }
2442
- function Na(t, e, i = "Other") {
2442
+ function qa(t, e, i = "Other") {
2443
2443
  if (t.length <= e) return t;
2444
2444
  const a = t.slice(0, e - 1), s = t.slice(e - 1).reduce((r, o) => r + o.count, 0);
2445
2445
  return [...a, { label: i, count: s }];
2446
2446
  }
2447
- function be(t, e, i, a = "View as table") {
2447
+ function fe(t, e, i, a = "View as table") {
2448
2448
  return n`<details class="baht-chart-table">
2449
2449
  <summary>${a}</summary>
2450
2450
  <table>
@@ -2466,13 +2466,13 @@ function be(t, e, i, a = "View as table") {
2466
2466
  </table>
2467
2467
  </details>`;
2468
2468
  }
2469
- class Q extends $ {
2469
+ class st extends g {
2470
2470
  constructor() {
2471
2471
  super(...arguments), this.emptyMessage = "No data to chart", this.loading = !1, this.showTable = !0, this.format = "number", this.currency = "THB", this.held = null;
2472
2472
  }
2473
2473
  /** Value → display text using this chart's `format` / `currency`. */
2474
2474
  fmt(e) {
2475
- return qt(e, this.format, this.currency);
2475
+ return Rt(e, this.format, this.currency);
2476
2476
  }
2477
2477
  /**
2478
2478
  * The snapshot to draw. While `loading` is set the previous one is returned,
@@ -2495,21 +2495,21 @@ class Q extends $ {
2495
2495
  * untrusted data (interaction.md).
2496
2496
  */
2497
2497
  showTip(e, i) {
2498
- var g;
2498
+ var $;
2499
2499
  const a = this.tipEl;
2500
2500
  if (!a) return;
2501
2501
  a.textContent = i, a.hidden = !1;
2502
2502
  const s = this.querySelector(".baht-chart");
2503
2503
  if (!s || typeof s.getBoundingClientRect != "function") return;
2504
2504
  const r = s.getBoundingClientRect(), o = e;
2505
- let c, m;
2505
+ let c, f;
2506
2506
  if (typeof o.clientX == "number" && (o.clientX !== 0 || o.clientY !== 0))
2507
- c = o.clientX - r.left, m = o.clientY - r.top;
2507
+ c = o.clientX - r.left, f = o.clientY - r.top;
2508
2508
  else {
2509
- const _ = e.currentTarget, p = (g = _ == null ? void 0 : _.getBoundingClientRect) == null ? void 0 : g.call(_);
2510
- c = p ? p.left + p.width / 2 - r.left : 0, m = p ? p.top - r.top : 0;
2509
+ const w = e.currentTarget, p = ($ = w == null ? void 0 : w.getBoundingClientRect) == null ? void 0 : $.call(w);
2510
+ c = p ? p.left + p.width / 2 - r.left : 0, f = p ? p.top - r.top : 0;
2511
2511
  }
2512
- a.style.left = `${Math.round(c)}px`, a.style.top = `${Math.round(m)}px`;
2512
+ a.style.left = `${Math.round(c)}px`, a.style.top = `${Math.round(f)}px`;
2513
2513
  }
2514
2514
  /** Hide the tooltip (pointerleave / blur). */
2515
2515
  hideTip() {
@@ -2538,78 +2538,78 @@ class Q extends $ {
2538
2538
  </div>`;
2539
2539
  }
2540
2540
  }
2541
- Tt([
2541
+ At([
2542
2542
  l({ attribute: "empty-message" })
2543
- ], Q.prototype, "emptyMessage");
2544
- Tt([
2543
+ ], st.prototype, "emptyMessage");
2544
+ At([
2545
2545
  l({ type: Boolean, reflect: !0 })
2546
- ], Q.prototype, "loading");
2547
- Tt([
2546
+ ], st.prototype, "loading");
2547
+ At([
2548
2548
  l({ type: Boolean, attribute: "show-table" })
2549
- ], Q.prototype, "showTable");
2550
- Tt([
2549
+ ], st.prototype, "showTable");
2550
+ At([
2551
2551
  l()
2552
- ], Q.prototype, "format");
2553
- Tt([
2552
+ ], st.prototype, "format");
2553
+ At([
2554
2554
  l()
2555
- ], Q.prototype, "currency");
2556
- Tt([
2557
- Et(".baht-chart-tooltip")
2558
- ], Q.prototype, "tipEl");
2559
- var qa = Object.defineProperty, Ra = Object.getOwnPropertyDescriptor, yt = (t, e, i, a) => {
2560
- for (var s = a > 1 ? void 0 : a ? Ra(e, i) : e, r = t.length - 1, o; r >= 0; r--)
2555
+ ], st.prototype, "currency");
2556
+ At([
2557
+ It(".baht-chart-tooltip")
2558
+ ], st.prototype, "tipEl");
2559
+ var Ra = Object.defineProperty, za = Object.getOwnPropertyDescriptor, wt = (t, e, i, a) => {
2560
+ for (var s = a > 1 ? void 0 : a ? za(e, i) : e, r = t.length - 1, o; r >= 0; r--)
2561
2561
  (o = t[r]) && (s = (a ? o(e, i, s) : o(s)) || s);
2562
- return a && s && qa(e, i, s), s;
2562
+ return a && s && Ra(e, i, s), s;
2563
2563
  };
2564
- let ht = class extends $ {
2564
+ let ct = class extends g {
2565
2565
  constructor() {
2566
2566
  super(...arguments), this.values = [], this.width = 96, this.height = 24, this.accentLast = !0, this.color = "", this.label = "";
2567
2567
  }
2568
2568
  render() {
2569
- const t = (this.values ?? []).filter((k) => Number.isFinite(k));
2569
+ const t = (this.values ?? []).filter((x) => Number.isFinite(x));
2570
2570
  if (t.length < 2) return h;
2571
- const e = Math.max(16, this.width), i = Math.max(8, this.height), a = 3, s = Math.min(...t), r = Math.max(...t), o = le([0, t.length - 1], [a, e - a]), c = le([s, r === s ? s + 1 : r], [i - a, a]), m = t.map((k, b) => `${o(b).toFixed(2)},${c(k).toFixed(2)}`).join(" "), g = o(t.length - 1), _ = c(t[t.length - 1]), p = this.color || "var(--baht-chart-muted)", f = this.label || `Trend of ${t.length} points`;
2571
+ const e = Math.max(16, this.width), i = Math.max(8, this.height), a = 3, s = Math.min(...t), r = Math.max(...t), o = ne([0, t.length - 1], [a, e - a]), c = ne([s, r === s ? s + 1 : r], [i - a, a]), f = t.map((x, u) => `${o(u).toFixed(2)},${c(x).toFixed(2)}`).join(" "), $ = o(t.length - 1), w = c(t[t.length - 1]), p = this.color || "var(--baht-chart-muted)", P = this.label || `Trend of ${t.length} points`;
2572
2572
  return n`<svg
2573
2573
  class="baht-sparkline"
2574
2574
  width=${e}
2575
2575
  height=${i}
2576
2576
  viewBox="0 0 ${e} ${i}"
2577
2577
  role="img"
2578
- aria-label=${f}
2578
+ aria-label=${P}
2579
2579
  >
2580
- ${A`<polyline class="baht-sparkline-line" points=${m} fill="none" stroke=${p}/>`}
2581
- ${this.accentLast ? A`<circle class="baht-sparkline-dot" cx=${g.toFixed(2)} cy=${_.toFixed(2)} r="3"
2580
+ ${L`<polyline class="baht-sparkline-line" points=${f} fill="none" stroke=${p}/>`}
2581
+ ${this.accentLast ? L`<circle class="baht-sparkline-dot" cx=${$.toFixed(2)} cy=${w.toFixed(2)} r="3"
2582
2582
  fill="var(--baht-chart-1)"/>` : h}
2583
2583
  </svg>`;
2584
2584
  }
2585
2585
  };
2586
- yt([
2586
+ wt([
2587
2587
  l({ type: Array })
2588
- ], ht.prototype, "values", 2);
2589
- yt([
2588
+ ], ct.prototype, "values", 2);
2589
+ wt([
2590
2590
  l({ type: Number })
2591
- ], ht.prototype, "width", 2);
2592
- yt([
2591
+ ], ct.prototype, "width", 2);
2592
+ wt([
2593
2593
  l({ type: Number })
2594
- ], ht.prototype, "height", 2);
2595
- yt([
2594
+ ], ct.prototype, "height", 2);
2595
+ wt([
2596
2596
  l({ type: Boolean, attribute: "accent-last" })
2597
- ], ht.prototype, "accentLast", 2);
2598
- yt([
2597
+ ], ct.prototype, "accentLast", 2);
2598
+ wt([
2599
2599
  l()
2600
- ], ht.prototype, "color", 2);
2601
- yt([
2600
+ ], ct.prototype, "color", 2);
2601
+ wt([
2602
2602
  l()
2603
- ], ht.prototype, "label", 2);
2604
- ht = yt([
2605
- u("baht-sparkline")
2606
- ], ht);
2607
- var za = Object.defineProperty, Va = Object.getOwnPropertyDescriptor, J = (t, e, i, a) => {
2608
- for (var s = a > 1 ? void 0 : a ? Va(e, i) : e, r = t.length - 1, o; r >= 0; r--)
2603
+ ], ct.prototype, "label", 2);
2604
+ ct = wt([
2605
+ b("baht-sparkline")
2606
+ ], ct);
2607
+ var Va = Object.defineProperty, Ka = Object.getOwnPropertyDescriptor, X = (t, e, i, a) => {
2608
+ for (var s = a > 1 ? void 0 : a ? Ka(e, i) : e, r = t.length - 1, o; r >= 0; r--)
2609
2609
  (o = t[r]) && (s = (a ? o(e, i, s) : o(s)) || s);
2610
- return a && s && za(e, i, s), s;
2610
+ return a && s && Va(e, i, s), s;
2611
2611
  };
2612
- let z = class extends $ {
2612
+ let K = class extends g {
2613
2613
  constructor() {
2614
2614
  super(...arguments), this.label = "", this.value = 0, this.format = "number", this.currency = "THB", this.delta = null, this.deltaKind = "pct", this.deltaLabel = "", this.upIsGood = !0, this.trend = [], this.size = "md";
2615
2615
  }
@@ -2624,19 +2624,20 @@ let z = class extends $ {
2624
2624
  }
2625
2625
  get deltaText() {
2626
2626
  const t = this.delta ?? 0, e = Math.abs(t);
2627
- return this.deltaKind === "pct" ? `${qt(e / 100, "percent")}` : qt(e, this.format, this.currency);
2627
+ return this.deltaKind === "pct" ? `${Rt(e / 100, "percent")}` : Rt(e, this.format, this.currency);
2628
2628
  }
2629
2629
  render() {
2630
2630
  const t = this.delta != null && Number.isFinite(this.delta), e = this.tone, i = (this.delta ?? 0) > 0 ? "up" : (this.delta ?? 0) < 0 ? "down" : "flat";
2631
2631
  return n`<div class="baht-stat${this.size === "hero" ? " baht-stat--hero" : ""}">
2632
2632
  ${this.label ? n`<div class="baht-stat-label">${this.label}</div>` : h}
2633
- <div class="baht-stat-value">${qt(this.value, this.format, this.currency)}</div>
2633
+ <div class="baht-stat-value">${Rt(this.value, this.format, this.currency)}</div>
2634
2634
  ${t ? n`<div class="baht-stat-delta baht-stat-delta--${e}">
2635
2635
  <span class="baht-stat-arrow" aria-hidden="true">${this.arrow}</span>
2636
2636
  <span class="baht-stat-delta-value">${this.deltaText}</span>
2637
2637
  <span class="baht-visually-hidden">${i}</span>
2638
2638
  ${this.deltaLabel ? n`<span class="baht-stat-delta-label">${this.deltaLabel}</span>` : h}
2639
2639
  </div>` : h}
2640
+ ${!t && this.deltaLabel ? n`<div class="baht-stat-caption">${this.deltaLabel}</div>` : h}
2640
2641
  ${this.trend.length > 1 ? n`<baht-sparkline
2641
2642
  class="baht-stat-trend"
2642
2643
  .values=${this.trend}
@@ -2645,46 +2646,46 @@ let z = class extends $ {
2645
2646
  </div>`;
2646
2647
  }
2647
2648
  };
2648
- J([
2649
+ X([
2649
2650
  l()
2650
- ], z.prototype, "label", 2);
2651
- J([
2651
+ ], K.prototype, "label", 2);
2652
+ X([
2652
2653
  l({ type: Number })
2653
- ], z.prototype, "value", 2);
2654
- J([
2654
+ ], K.prototype, "value", 2);
2655
+ X([
2655
2656
  l()
2656
- ], z.prototype, "format", 2);
2657
- J([
2657
+ ], K.prototype, "format", 2);
2658
+ X([
2658
2659
  l()
2659
- ], z.prototype, "currency", 2);
2660
- J([
2660
+ ], K.prototype, "currency", 2);
2661
+ X([
2661
2662
  l({ type: Number })
2662
- ], z.prototype, "delta", 2);
2663
- J([
2663
+ ], K.prototype, "delta", 2);
2664
+ X([
2664
2665
  l({ attribute: "delta-kind" })
2665
- ], z.prototype, "deltaKind", 2);
2666
- J([
2666
+ ], K.prototype, "deltaKind", 2);
2667
+ X([
2667
2668
  l({ attribute: "delta-label" })
2668
- ], z.prototype, "deltaLabel", 2);
2669
- J([
2669
+ ], K.prototype, "deltaLabel", 2);
2670
+ X([
2670
2671
  l({ type: Boolean, attribute: "up-is-good" })
2671
- ], z.prototype, "upIsGood", 2);
2672
- J([
2672
+ ], K.prototype, "upIsGood", 2);
2673
+ X([
2673
2674
  l({ type: Array })
2674
- ], z.prototype, "trend", 2);
2675
- J([
2675
+ ], K.prototype, "trend", 2);
2676
+ X([
2676
2677
  l()
2677
- ], z.prototype, "size", 2);
2678
- z = J([
2679
- u("baht-stat")
2680
- ], z);
2681
- var Ka = Object.defineProperty, Ua = Object.getOwnPropertyDescriptor, Mt = (t, e, i, a) => {
2682
- for (var s = a > 1 ? void 0 : a ? Ua(e, i) : e, r = t.length - 1, o; r >= 0; r--)
2678
+ ], K.prototype, "size", 2);
2679
+ K = X([
2680
+ b("baht-stat")
2681
+ ], K);
2682
+ var Ua = Object.defineProperty, Ha = Object.getOwnPropertyDescriptor, Lt = (t, e, i, a) => {
2683
+ for (var s = a > 1 ? void 0 : a ? Ha(e, i) : e, r = t.length - 1, o; r >= 0; r--)
2683
2684
  (o = t[r]) && (s = (a ? o(e, i, s) : o(s)) || s);
2684
- return a && s && Ka(e, i, s), s;
2685
+ return a && s && Ua(e, i, s), s;
2685
2686
  };
2686
- const Xe = 6;
2687
- let H = class extends Q {
2687
+ const Ze = 6;
2688
+ let J = class extends st {
2688
2689
  constructor() {
2689
2690
  super(...arguments), this.groups = [], this.total = null, this.color = "", this.centerLabel = "records", this.otherLabel = "Other";
2690
2691
  }
@@ -2692,24 +2693,24 @@ let H = class extends Q {
2692
2693
  const t = this.hold(this.groups ?? []);
2693
2694
  if (t.length === 0)
2694
2695
  return n`<div class=${this.rootClass("baht-donut-chart")}>${this.renderEmpty()}</div>`;
2695
- const e = Na(t, Xe, this.otherLabel), i = e.reduce((p, f) => p + f.count, 0) || 1, a = this.total ?? t.reduce((p, f) => p + f.count, 0), s = H.R, r = 2 * Math.PI * s, o = e.length > 1 ? H.GAP : 0, c = t.length > Xe;
2696
- let m = 0;
2697
- const g = e.map((p, f) => {
2698
- const k = p.count / i, b = Math.max(0, k * r - o), w = {
2696
+ const e = qa(t, Ze, this.otherLabel), i = e.reduce((p, P) => p + P.count, 0) || 1, a = this.total ?? t.reduce((p, P) => p + P.count, 0), s = J.R, r = 2 * Math.PI * s, o = e.length > 1 ? J.GAP : 0, c = t.length > Ze;
2697
+ let f = 0;
2698
+ const $ = e.map((p, P) => {
2699
+ const x = p.count / i, u = Math.max(0, x * r - o), v = {
2699
2700
  ...p,
2700
- frac: k,
2701
- dash: `${b} ${r - b}`,
2702
- offset: -m * r,
2701
+ frac: x,
2702
+ dash: `${u} ${r - u}`,
2703
+ offset: -f * r,
2703
2704
  // the folded tail is grey — never a generated ninth hue
2704
- color: c && f === e.length - 1 ? "var(--baht-chart-muted)" : lt(f, this.color || void 0)
2705
+ color: c && P === e.length - 1 ? "var(--baht-chart-muted)" : ft(P, this.color || void 0)
2705
2706
  };
2706
- return m += k, w;
2707
- }), _ = `${a} ${this.centerLabel}: ${g.map((p) => `${p.label || "(empty)"} ${p.count} (${Math.round(p.frac * 100)}%)`).join(", ")}`;
2707
+ return f += x, v;
2708
+ }), w = `${a} ${this.centerLabel}: ${$.map((p) => `${p.label || "(empty)"} ${p.count} (${Math.round(p.frac * 100)}%)`).join(", ")}`;
2708
2709
  return n`<div class=${this.rootClass("baht-donut-chart")}>
2709
- <svg width="160" height="160" viewBox="0 0 160 160" role="img" aria-label=${_}>
2710
+ <svg width="160" height="160" viewBox="0 0 160 160" role="img" aria-label=${w}>
2710
2711
  <g transform="translate(80,80) rotate(-90)">
2711
- ${g.map(
2712
- (p) => A`<circle r=${s} cx="0" cy="0" fill="none" stroke=${p.color}
2712
+ ${$.map(
2713
+ (p) => L`<circle r=${s} cx="0" cy="0" fill="none" stroke=${p.color}
2713
2714
  stroke-width="22" stroke-dasharray=${p.dash} stroke-dashoffset=${p.offset}/>`
2714
2715
  )}
2715
2716
  </g>
@@ -2717,7 +2718,7 @@ let H = class extends Q {
2717
2718
  <text x="80" y="94" text-anchor="middle" class="baht-donut-chart-sub">${this.centerLabel}</text>
2718
2719
  </svg>
2719
2720
  <div class="baht-chart-legend">
2720
- ${g.map(
2721
+ ${$.map(
2721
2722
  (p) => n`<div class="baht-chart-legend-row">
2722
2723
  <span class="baht-chart-swatch" style="background:${p.color}" aria-hidden="true"></span>
2723
2724
  <span class="baht-chart-legend-label">${p.label || "(empty)"}</span>
@@ -2726,10 +2727,10 @@ let H = class extends Q {
2726
2727
  </div>`
2727
2728
  )}
2728
2729
  </div>
2729
- ${this.showTable ? be(
2730
+ ${this.showTable ? fe(
2730
2731
  `${a} ${this.centerLabel}`,
2731
2732
  ["Slice", "Value", "Share"],
2732
- g.map((p) => [
2733
+ $.map((p) => [
2733
2734
  p.label || "(empty)",
2734
2735
  this.fmt(p.count),
2735
2736
  `${Math.round(p.frac * 100)}%`
@@ -2738,35 +2739,60 @@ let H = class extends Q {
2738
2739
  </div>`;
2739
2740
  }
2740
2741
  };
2741
- H.R = 54;
2742
- H.GAP = 2;
2743
- Mt([
2742
+ J.R = 54;
2743
+ J.GAP = 2;
2744
+ Lt([
2744
2745
  l({ attribute: !1 })
2745
- ], H.prototype, "groups", 2);
2746
- Mt([
2746
+ ], J.prototype, "groups", 2);
2747
+ Lt([
2747
2748
  l({ type: Number })
2748
- ], H.prototype, "total", 2);
2749
- Mt([
2749
+ ], J.prototype, "total", 2);
2750
+ Lt([
2750
2751
  l()
2751
- ], H.prototype, "color", 2);
2752
- Mt([
2752
+ ], J.prototype, "color", 2);
2753
+ Lt([
2753
2754
  l({ attribute: "center-label" })
2754
- ], H.prototype, "centerLabel", 2);
2755
- Mt([
2755
+ ], J.prototype, "centerLabel", 2);
2756
+ Lt([
2756
2757
  l({ attribute: "other-label" })
2757
- ], H.prototype, "otherLabel", 2);
2758
- H = Mt([
2759
- u("baht-donut-chart")
2760
- ], H);
2761
- var Ha = Object.defineProperty, Ga = Object.getOwnPropertyDescriptor, K = (t, e, i, a) => {
2762
- for (var s = a > 1 ? void 0 : a ? Ga(e, i) : e, r = t.length - 1, o; r >= 0; r--)
2758
+ ], J.prototype, "otherLabel", 2);
2759
+ J = Lt([
2760
+ b("baht-donut-chart")
2761
+ ], J);
2762
+ var Ga = Object.defineProperty, Wa = Object.getOwnPropertyDescriptor, V = (t, e, i, a) => {
2763
+ for (var s = a > 1 ? void 0 : a ? Wa(e, i) : e, r = t.length - 1, o; r >= 0; r--)
2763
2764
  (o = t[r]) && (s = (a ? o(e, i, s) : o(s)) || s);
2764
- return a && s && Ha(e, i, s), s;
2765
+ return a && s && Ga(e, i, s), s;
2765
2766
  };
2766
- const Ze = 24;
2767
- let R = class extends Q {
2767
+ const Qe = 24, ts = 2, Ja = 56, Ya = 26;
2768
+ let z = class extends st {
2768
2769
  constructor() {
2769
- super(...arguments), this.groups = [], this.series = [], this.categories = [], this.orientation = "horizontal", this.stacked = !1, this.compare = [], this.markers = [], this.labelValues = "ends", this.emphasis = null, this.color = "", this.label = "";
2770
+ super(...arguments), this.groups = [], this.series = [], this.categories = [], this.orientation = "horizontal", this.stacked = !1, this.compare = [], this.compareLabel = "Previous period", this.markers = [], this.labelValues = "ends", this.emphasis = null, this.color = "", this.label = "", this.band = 0;
2771
+ }
2772
+ connectedCallback() {
2773
+ super.connectedCallback(), !(!S() || typeof ResizeObserver > "u") && (this.resizeObserver = new ResizeObserver(() => this.measure()), this.resizeObserver.observe(this));
2774
+ }
2775
+ disconnectedCallback() {
2776
+ var t;
2777
+ (t = this.resizeObserver) == null || t.disconnect(), this.resizeObserver = void 0, super.disconnectedCallback();
2778
+ }
2779
+ firstUpdated() {
2780
+ S() && queueMicrotask(() => this.measure());
2781
+ }
2782
+ /** Host width → px per category. Never runs on the server (`hasDom` guard). */
2783
+ measure() {
2784
+ var r;
2785
+ if (!S() || !this.isConnected || this.orientation !== "vertical") return;
2786
+ const t = this.columnCount;
2787
+ if (t === 0) return;
2788
+ const e = ((r = this.getBoundingClientRect) == null ? void 0 : r.call(this).width) ?? 0;
2789
+ if (!e) return;
2790
+ const a = (Math.max(0, e - Ja) - ts * (t - 1)) / t, s = a > 0 ? Math.floor(a * 100) / 100 : 0;
2791
+ Math.abs(s - this.band) > 0.01 && (this.band = s);
2792
+ }
2793
+ get columnCount() {
2794
+ const t = this.model.series;
2795
+ return t.length === 0 ? 0 : Math.max(...t.map((e) => e.values.length));
2770
2796
  }
2771
2797
  /** The series actually drawn — `groups` is normalised into one series. */
2772
2798
  get model() {
@@ -2782,7 +2808,7 @@ let R = class extends Q {
2782
2808
  }
2783
2809
  colorFor(t, e, i) {
2784
2810
  const a = this.model.series[t];
2785
- return this.emphasis != null && !(i ? t === this.emphasis : e === this.emphasis) ? "var(--baht-chart-muted)" : lt(i ? t : 0, this.color || (a == null ? void 0 : a.color) || void 0);
2811
+ return this.emphasis != null && !(i ? t === this.emphasis : e === this.emphasis) ? "var(--baht-chart-muted)" : ft(i ? t : 0, this.color || (a == null ? void 0 : a.color) || void 0);
2786
2812
  }
2787
2813
  render() {
2788
2814
  const t = this.hold(this.model);
@@ -2792,7 +2818,7 @@ let R = class extends Q {
2792
2818
  domainMax(t, e, i) {
2793
2819
  const a = Math.max(...t.map((c) => c.values.length)), s = Array.from(
2794
2820
  { length: a },
2795
- (c, m) => e ? t.reduce((g, _) => g + (_.values[m] ?? 0), 0) : Math.max(...t.map((g) => g.values[m] ?? 0))
2821
+ (c, f) => e ? t.reduce(($, w) => $ + (w.values[f] ?? 0), 0) : Math.max(...t.map(($) => $.values[f] ?? 0))
2796
2822
  ), r = Math.max(
2797
2823
  1,
2798
2824
  ...s,
@@ -2800,284 +2826,345 @@ let R = class extends Q {
2800
2826
  ...(this.markers ?? []).map((c) => c.value)
2801
2827
  );
2802
2828
  if (i) return r;
2803
- const o = Ee(r, 4);
2829
+ const o = Be(r, 4);
2804
2830
  return o[o.length - 1] ?? r;
2805
2831
  }
2806
2832
  tableTwin(t, e, i) {
2807
- var s;
2833
+ var r;
2808
2834
  if (!this.showTable) return h;
2809
- const a = ["Category", ...t.map((r) => r.name || "Value")];
2810
- return (s = this.compare) != null && s.length && a.push("Previous"), be(
2811
- this.label || "Bar chart data",
2812
- a,
2813
- Array.from({ length: i }, (r, o) => {
2814
- var m;
2815
- const c = [
2816
- e[o] || "(empty)",
2817
- ...t.map((g) => this.fmt(g.values[o] ?? 0))
2818
- ];
2819
- return (m = this.compare) != null && m.length && c.push(this.fmt(this.compare[o] ?? 0)), c;
2820
- })
2821
- );
2835
+ const a = ["Category", ...t.map((o) => o.name || "Value")];
2836
+ (r = this.compare) != null && r.length && a.push(this.compareLabel);
2837
+ const s = Array.from({ length: i }, (o, c) => {
2838
+ var $;
2839
+ const f = [
2840
+ e[c] || "(empty)",
2841
+ ...t.map((w) => this.fmt(w.values[c] ?? 0))
2842
+ ];
2843
+ return ($ = this.compare) != null && $.length && f.push(this.fmt(this.compare[c] ?? 0)), f;
2844
+ });
2845
+ for (const o of this.markers ?? [])
2846
+ s.push([
2847
+ `${o.label ?? "Target"}${o.category ? ` (${o.category})` : ""}`,
2848
+ this.fmt(o.value),
2849
+ ...Array.from({ length: a.length - 2 }, () => "—")
2850
+ ]);
2851
+ return fe(this.label || "Bar chart data", a, s);
2822
2852
  }
2823
2853
  /** Markers with no `category` span the chart; the rest ride their own row. */
2824
2854
  markersFor(t) {
2825
2855
  return (this.markers ?? []).filter((e) => !e.category || e.category === t);
2826
2856
  }
2857
+ /** Markers that apply to every row / column. */
2858
+ get chartMarkers() {
2859
+ return (this.markers ?? []).filter((t) => !t.category);
2860
+ }
2861
+ /** What a marker reads as: its own label, else its formatted value. */
2862
+ markerText(t) {
2863
+ return t.label ? `${t.label} ${this.fmt(t.value)}` : this.fmt(t.value);
2864
+ }
2865
+ /**
2866
+ * Marker lines, positioned along the value axis. The label is drawn separately
2867
+ * (`markerLabels`) as real text — a `title` attribute alone never reaches AT.
2868
+ */
2827
2869
  markerOverlay(t, e) {
2828
2870
  return this.markersFor(e).map(
2829
2871
  (i) => n`<span
2830
2872
  class="baht-bar-chart-marker"
2831
2873
  style=${`left:${Math.min(100, i.value / t * 100).toFixed(2)}%`}
2832
- title=${i.label ?? this.fmt(i.value)}
2833
2874
  aria-hidden="true"
2834
2875
  ></span>`
2835
2876
  );
2836
2877
  }
2878
+ /**
2879
+ * Marker labels, sorted along the axis and thinned so neighbours never collide:
2880
+ * a dropped label keeps its line, and its value still reads in the table twin.
2881
+ */
2882
+ placedMarkers(t) {
2883
+ const e = [], i = [...this.chartMarkers].sort((a, s) => a.value - s.value);
2884
+ for (const a of i) {
2885
+ const s = Math.min(100, Math.max(0, a.value / t * 100)), r = e[e.length - 1];
2886
+ r && s - r.pct < 12 || e.push({ m: a, pct: s });
2887
+ }
2888
+ return e;
2889
+ }
2890
+ /** Legend rows: one per series, plus the muted `compare` key when it is set. */
2891
+ legendEntries(t) {
2892
+ const e = t.map((i, a) => ({
2893
+ label: i.name || "Value",
2894
+ color: ft(a, i.color)
2895
+ }));
2896
+ return (this.compare ?? []).length > 0 && e.push({ label: this.compareLabel, color: "var(--baht-chart-muted)" }), e;
2897
+ }
2837
2898
  renderHorizontal(t) {
2838
- const { series: e, categories: i, legacy: a } = t, s = e.length > 1, r = Math.max(...e.map((p) => p.values.length)), o = this.domainMax(e, this.stacked, a), c = (this.compare ?? []).length > 0, m = (this.stacked ? 1 : e.length) + (c ? 1 : 0), g = Math.min(Ze, Math.max(6, Math.floor(48 / m))), _ = Array.from({ length: r }, (p, f) => {
2839
- const k = i[f] || "(empty)", b = e.reduce((O, At) => O + (At.values[f] ?? 0), 0), w = `${k}: ${e.map((O) => `${O.name ? `${O.name} ` : ""}${this.fmt(O.values[f] ?? 0)}`).join(", ")}${c ? `, previous ${this.fmt(this.compare[f] ?? 0)}` : ""}`, D = e.map((O, At) => ({
2840
- value: O.values[f] ?? 0,
2841
- color: this.colorFor(At, f, s),
2842
- name: O.name
2899
+ const { series: e, categories: i, legacy: a } = t, s = e.length > 1, r = Math.max(...e.map((P) => P.values.length)), o = this.domainMax(e, this.stacked, a), c = (this.compare ?? []).length > 0, f = (this.stacked ? 1 : e.length) + (c ? 1 : 0), $ = Math.min(Qe, Math.max(6, Math.floor(48 / f))), w = Array.from({ length: r }, (P, x) => {
2900
+ const u = i[x] || "(empty)", v = e.reduce((C, R) => C + (R.values[x] ?? 0), 0), D = `${u}: ${e.map((C) => `${C.name ? `${C.name} ` : ""}${this.fmt(C.values[x] ?? 0)}`).join(", ")}${c ? `, previous ${this.fmt(this.compare[x] ?? 0)}` : ""}`, G = e.map((C, R) => ({
2901
+ value: C.values[x] ?? 0,
2902
+ color: this.colorFor(R, x, s),
2903
+ name: C.name
2843
2904
  }));
2844
2905
  return n`<div class="baht-bar-chart-row">
2845
- <span class="baht-bar-chart-label" title=${k}>${k}</span>
2906
+ <span class="baht-bar-chart-label" title=${u}>${u}</span>
2846
2907
  <div
2847
2908
  class="baht-bar-chart-track${this.stacked ? " baht-bar-chart-track--stacked" : ""}"
2848
2909
  tabindex="0"
2849
2910
  role="button"
2850
- aria-label=${w}
2851
- @pointermove=${(O) => this.showTip(O, w)}
2911
+ aria-label=${D}
2912
+ @pointermove=${(C) => this.showTip(C, D)}
2852
2913
  @pointerleave=${() => this.hideTip()}
2853
- @focus=${(O) => this.showTip(O, w)}
2914
+ @focus=${(C) => this.showTip(C, D)}
2854
2915
  @blur=${() => this.hideTip()}
2855
2916
  >
2856
- ${this.markerOverlay(o, k)}
2917
+ ${this.markerOverlay(o, u)}
2857
2918
  <div class="baht-bar-chart-bars">
2858
- ${this.stacked ? n`<div class="baht-bar-chart-stack" style=${`height:${g}px`}>
2859
- ${D.map(
2860
- (O) => n`<div
2919
+ ${this.stacked ? n`<div class="baht-bar-chart-stack" style=${`height:${$}px`}>
2920
+ ${G.map(
2921
+ (C) => n`<div
2861
2922
  class="baht-bar-chart-bar baht-bar-chart-bar--segment"
2862
- style=${`width:${Math.max(0, O.value / o * 100)}%;background:${O.color}`}
2923
+ style=${`width:${Math.max(0, C.value / o * 100)}%;background:${C.color}`}
2863
2924
  ></div>`
2864
2925
  )}
2865
- </div>` : D.map(
2866
- (O) => n`<div
2926
+ </div>` : G.map(
2927
+ (C) => n`<div
2867
2928
  class="baht-bar-chart-bar"
2868
- style=${`width:${Math.max(2, O.value / o * 100)}%;height:${g}px;background:${O.color}`}
2929
+ style=${`width:${Math.max(2, C.value / o * 100)}%;height:${$}px;background:${C.color}`}
2869
2930
  ></div>`
2870
2931
  )}
2871
2932
  ${c ? n`<div
2872
2933
  class="baht-bar-chart-bar baht-bar-chart-bar--compare"
2873
- style=${`width:${Math.max(2, (this.compare[f] ?? 0) / o * 100)}%;height:${Math.min(8, g)}px`}
2934
+ style=${`width:${Math.max(2, (this.compare[x] ?? 0) / o * 100)}%;height:${Math.min(8, $)}px`}
2874
2935
  ></div>` : h}
2875
2936
  </div>
2876
2937
  </div>
2877
2938
  ${this.labelValues === "ends" ? n`<span class="baht-bar-chart-count"
2878
- >${a ? e[0].values[f] ?? 0 : this.fmt(this.stacked ? b : e[0].values[f] ?? 0)}</span
2939
+ >${a ? e[0].values[x] ?? 0 : this.fmt(this.stacked ? v : e[0].values[x] ?? 0)}</span
2879
2940
  >` : h}
2880
2941
  </div>`;
2881
- });
2942
+ }), p = this.placedMarkers(o);
2882
2943
  return n`<div class=${this.rootClass("baht-bar-chart")}>
2883
- ${_}
2944
+ ${p.length > 0 ? n`<div class="baht-bar-chart-row baht-bar-chart-row--markers">
2945
+ <span class="baht-bar-chart-label"></span>
2946
+ <div class="baht-bar-chart-markbar">
2947
+ ${p.map(
2948
+ ({ m: P, pct: x }) => n`<span
2949
+ class="baht-bar-chart-marker-label"
2950
+ style=${`left:${x.toFixed(2)}%;transform:translateX(${x > 88 ? "-100%" : x < 12 ? "0" : "-50%"})`}
2951
+ >${this.markerText(P)}</span
2952
+ >`
2953
+ )}
2954
+ </div>
2955
+ ${this.labelValues === "ends" ? n`<span class="baht-bar-chart-count"></span>` : h}
2956
+ </div>` : h}
2957
+ ${w}
2884
2958
  ${this.renderTooltip()}
2885
- ${this.renderLegend(e.map((p, f) => ({ label: p.name, color: lt(f, p.color) })))}
2959
+ ${this.renderLegend(this.legendEntries(e))}
2886
2960
  ${this.tableTwin(e, i, r)}
2887
2961
  </div>`;
2888
2962
  }
2889
2963
  renderVertical(t) {
2890
- const { series: e, categories: i, legacy: a } = t, s = e.length > 1, r = Math.max(...e.map((f) => f.values.length)), o = this.domainMax(e, this.stacked, a), c = Ee(o, 4), m = (this.compare ?? []).length > 0, g = (this.stacked ? 1 : e.length) + (m ? 1 : 0), _ = Math.min(Ze, Math.max(4, Math.floor(48 / g))), p = this.label || `Column chart, ${r} categories. ${i.map((f, k) => `${f} ${this.fmt(e[0].values[k] ?? 0)}`).join(", ")}`;
2964
+ const { series: e, categories: i, legacy: a } = t, s = e.length > 1, r = Math.max(...e.map((v) => v.values.length)), o = this.domainMax(e, this.stacked, a), c = Be(o, 4), f = (this.compare ?? []).length > 0, $ = (this.stacked ? 1 : e.length) + (f ? 1 : 0), w = this.band > 0 ? (this.band - ts) / $ : 48 / $, p = Math.min(Qe, Math.max(2, Math.floor(w))), P = this.band > 0 ? Math.max(1, Math.ceil(Ya / Math.max(1, this.band))) : Math.max(1, Math.ceil(r / 12)), x = this.chartMarkers.map((v) => this.markerText(v)), u = this.label || `Column chart, ${r} categories. ${i.map((v, D) => `${v} ${this.fmt(e[0].values[D] ?? 0)}`).join(", ")}${x.length ? `. Reference lines: ${x.join(", ")}` : ""}`;
2891
2965
  return n`<div class=${this.rootClass("baht-bar-chart baht-bar-chart--vertical")}>
2892
- <div class="baht-bar-chart-plot" role="img" aria-label=${p}>
2966
+ <div class="baht-bar-chart-plot" role="img" aria-label=${u}>
2893
2967
  <div class="baht-bar-chart-yaxis" aria-hidden="true">
2894
- ${[...c].reverse().map((f) => n`<span class="baht-chart-tick-text">${this.fmt(f)}</span>`)}
2968
+ ${[...c].reverse().map((v) => n`<span class="baht-chart-tick-text">${this.fmt(v)}</span>`)}
2895
2969
  </div>
2896
2970
  <div class="baht-bar-chart-grid">
2897
- ${(this.markers ?? []).filter((f) => !f.category).map(
2898
- (f) => n`<span
2899
- class="baht-bar-chart-marker baht-bar-chart-marker--horizontal"
2900
- style=${`bottom:${Math.min(100, f.value / o * 100).toFixed(2)}%`}
2901
- title=${f.label ?? this.fmt(f.value)}
2902
- aria-hidden="true"
2903
- ></span>`
2971
+ ${this.chartMarkers.map(
2972
+ (v) => n`<span
2973
+ class="baht-bar-chart-marker baht-bar-chart-marker--horizontal"
2974
+ style=${`bottom:${Math.min(100, v.value / o * 100).toFixed(2)}%`}
2975
+ aria-hidden="true"
2976
+ ></span>`
2977
+ )}
2978
+ ${this.placedMarkers(o).map(
2979
+ ({ m: v, pct: D }) => n`<span
2980
+ class="baht-bar-chart-marker-label baht-bar-chart-marker-label--end"
2981
+ style=${`bottom:${D.toFixed(2)}%`}
2982
+ >${this.markerText(v)}</span
2983
+ >`
2904
2984
  )}
2905
2985
  ${[...c].reverse().map(() => n`<span class="baht-chart-grid-rule" aria-hidden="true"></span>`)}
2906
2986
  <div class="baht-bar-chart-columns">
2907
- ${Array.from({ length: r }, (f, k) => {
2908
- const b = i[k] || "(empty)", w = `${b}: ${e.map((D) => `${D.name ? `${D.name} ` : ""}${this.fmt(D.values[k] ?? 0)}`).join(", ")}`;
2987
+ ${Array.from({ length: r }, (v, D) => {
2988
+ const G = i[D] || "(empty)", C = `${G}: ${e.map((R) => `${R.name ? `${R.name} ` : ""}${this.fmt(R.values[D] ?? 0)}`).join(", ")}`;
2909
2989
  return n`<div
2910
2990
  class="baht-bar-chart-column"
2991
+ style=${this.band > 0 ? `flex:0 0 auto;width:${this.band}px` : h}
2911
2992
  tabindex="0"
2912
2993
  role="button"
2913
- aria-label=${w}
2914
- @pointermove=${(D) => this.showTip(D, w)}
2994
+ aria-label=${C}
2995
+ @pointermove=${(R) => this.showTip(R, C)}
2915
2996
  @pointerleave=${() => this.hideTip()}
2916
- @focus=${(D) => this.showTip(D, w)}
2997
+ @focus=${(R) => this.showTip(R, C)}
2917
2998
  @blur=${() => this.hideTip()}
2918
2999
  >
2919
3000
  <div class="baht-bar-chart-column-bars">
2920
3001
  ${e.map(
2921
- (D, O) => n`<div
3002
+ (R, d) => n`<div
2922
3003
  class="baht-bar-chart-col"
2923
- style=${`height:${Math.max(1, (D.values[k] ?? 0) / o * 100)}%;width:${_}px;background:${this.colorFor(O, k, s)}`}
3004
+ style=${`height:${Math.max(1, (R.values[D] ?? 0) / o * 100)}%;width:${p}px;background:${this.colorFor(d, D, s)}`}
2924
3005
  ></div>`
2925
3006
  )}
2926
- ${m ? n`<div
3007
+ ${f ? n`<div
2927
3008
  class="baht-bar-chart-col baht-bar-chart-col--compare"
2928
- style=${`height:${Math.max(1, (this.compare[k] ?? 0) / o * 100)}%;width:${Math.min(8, _)}px`}
3009
+ style=${`height:${Math.max(1, (this.compare[D] ?? 0) / o * 100)}%;width:${Math.min(8, p)}px`}
2929
3010
  ></div>` : h}
2930
3011
  </div>
2931
- <span class="baht-bar-chart-xlabel">${b}</span>
3012
+ ${D % P === 0 ? n`<span class="baht-bar-chart-xlabel">${G}</span>` : h}
2932
3013
  </div>`;
2933
3014
  })}
2934
3015
  </div>
2935
3016
  </div>
2936
3017
  </div>
2937
3018
  ${this.renderTooltip()}
2938
- ${this.renderLegend(e.map((f, k) => ({ label: f.name, color: lt(k, f.color) })))}
3019
+ ${this.renderLegend(this.legendEntries(e))}
2939
3020
  ${this.tableTwin(e, i, r)}
2940
3021
  </div>`;
2941
3022
  }
2942
3023
  };
2943
- K([
3024
+ V([
2944
3025
  l({ attribute: !1 })
2945
- ], R.prototype, "groups", 2);
2946
- K([
3026
+ ], z.prototype, "groups", 2);
3027
+ V([
2947
3028
  l({ attribute: !1 })
2948
- ], R.prototype, "series", 2);
2949
- K([
3029
+ ], z.prototype, "series", 2);
3030
+ V([
2950
3031
  l({ attribute: !1 })
2951
- ], R.prototype, "categories", 2);
2952
- K([
3032
+ ], z.prototype, "categories", 2);
3033
+ V([
2953
3034
  l()
2954
- ], R.prototype, "orientation", 2);
2955
- K([
3035
+ ], z.prototype, "orientation", 2);
3036
+ V([
2956
3037
  l({ type: Boolean })
2957
- ], R.prototype, "stacked", 2);
2958
- K([
3038
+ ], z.prototype, "stacked", 2);
3039
+ V([
2959
3040
  l({ attribute: !1 })
2960
- ], R.prototype, "compare", 2);
2961
- K([
3041
+ ], z.prototype, "compare", 2);
3042
+ V([
3043
+ l({ attribute: "compare-label" })
3044
+ ], z.prototype, "compareLabel", 2);
3045
+ V([
2962
3046
  l({ attribute: !1 })
2963
- ], R.prototype, "markers", 2);
2964
- K([
3047
+ ], z.prototype, "markers", 2);
3048
+ V([
2965
3049
  l({ attribute: "label-values" })
2966
- ], R.prototype, "labelValues", 2);
2967
- K([
3050
+ ], z.prototype, "labelValues", 2);
3051
+ V([
2968
3052
  l({ type: Number })
2969
- ], R.prototype, "emphasis", 2);
2970
- K([
3053
+ ], z.prototype, "emphasis", 2);
3054
+ V([
2971
3055
  l()
2972
- ], R.prototype, "color", 2);
2973
- K([
3056
+ ], z.prototype, "color", 2);
3057
+ V([
2974
3058
  l()
2975
- ], R.prototype, "label", 2);
2976
- R = K([
2977
- u("baht-bar-chart")
2978
- ], R);
2979
- var Wa = Object.defineProperty, Ja = Object.getOwnPropertyDescriptor, ot = (t, e, i, a) => {
2980
- for (var s = a > 1 ? void 0 : a ? Ja(e, i) : e, r = t.length - 1, o; r >= 0; r--)
3059
+ ], z.prototype, "label", 2);
3060
+ V([
3061
+ y()
3062
+ ], z.prototype, "band", 2);
3063
+ z = V([
3064
+ b("baht-bar-chart")
3065
+ ], z);
3066
+ var Xa = Object.defineProperty, Za = Object.getOwnPropertyDescriptor, nt = (t, e, i, a) => {
3067
+ for (var s = a > 1 ? void 0 : a ? Za(e, i) : e, r = t.length - 1, o; r >= 0; r--)
2981
3068
  (o = t[r]) && (s = (a ? o(e, i, s) : o(s)) || s);
2982
- return a && s && Wa(e, i, s), s;
3069
+ return a && s && Xa(e, i, s), s;
2983
3070
  };
2984
- const Qe = 640, we = 260, B = { top: 14, right: 72, bottom: 30, left: 60 };
2985
- let Z = class extends Q {
3071
+ const es = 640, xe = 260, B = { top: 14, right: 72, bottom: 30, left: 60 };
3072
+ let et = class extends st {
2986
3073
  constructor() {
2987
3074
  super(...arguments), this.series = [], this.categories = [], this.area = !1, this.markers = [], this.forecast = 0, this.baseline = null, this.labelValues = "ends", this.label = "", this.crosshairAt = null;
2988
3075
  }
2989
3076
  get plot() {
2990
- return { w: Qe - B.left - B.right, h: we - B.top - B.bottom };
3077
+ return { w: es - B.left - B.right, h: xe - B.top - B.bottom };
2991
3078
  }
2992
3079
  render() {
2993
3080
  const t = this.hold({
2994
3081
  series: (this.series ?? []).filter((d) => {
2995
- var x;
2996
- return d && ((x = d.values) == null ? void 0 : x.length);
3082
+ var _;
3083
+ return d && ((_ = d.values) == null ? void 0 : _.length);
2997
3084
  }),
2998
3085
  categories: this.categories ?? []
2999
3086
  }), { series: e, categories: i } = t;
3000
3087
  if (e.length === 0)
3001
3088
  return n`<div class=${this.rootClass("baht-line-chart")}>${this.renderEmpty()}</div>`;
3002
- const a = Math.max(...e.map((d) => d.values.length)), s = e.flatMap((d) => d.values).filter((d) => Number.isFinite(d)), r = Math.max(0, ...s, ...(this.markers ?? []).map((d) => d.value)), o = Ee(r, 4), c = o[o.length - 1] ?? 1, { w: m, h: g } = this.plot, _ = le([0, Math.max(1, a - 1)], [B.left, B.left + m]), p = le([0, c], [B.top + g, B.top]), f = Math.max(0, a - 1 - Math.max(0, this.forecast)), k = (d, x, X) => d.slice(x, X + 1).map((et, st) => `${st === 0 ? "M" : "L"}${_(x + st).toFixed(2)},${p(et).toFixed(2)}`).join(" "), b = e.map((d, x) => ({
3003
- i: x,
3089
+ const a = Math.max(...e.map((d) => d.values.length)), s = e.flatMap((d) => d.values).filter((d) => Number.isFinite(d)), r = Math.max(0, ...s, ...(this.markers ?? []).map((d) => d.value)), o = Be(r, 4), c = o[o.length - 1] ?? 1, { w: f, h: $ } = this.plot, w = ne([0, Math.max(1, a - 1)], [B.left, B.left + f]), p = ne([0, c], [B.top + $, B.top]), P = Math.max(0, a - 1 - Math.max(0, this.forecast)), x = (d, _, tt) => d.slice(_, tt + 1).map((at, it) => `${it === 0 ? "M" : "L"}${w(_ + it).toFixed(2)},${p(at).toFixed(2)}`).join(" "), u = e.map((d, _) => ({
3090
+ i: _,
3004
3091
  name: d.name,
3005
3092
  value: d.values[d.values.length - 1] ?? 0,
3006
3093
  yPos: p(d.values[d.values.length - 1] ?? 0),
3007
- color: lt(x, d.color)
3008
- })), w = [...b].sort((d, x) => d.yPos - x.yPos), D = w.some((d, x) => x > 0 && d.yPos - w[x - 1].yPos < 15), O = this.labelValues === "ends" && !D, At = Math.max(1, Math.ceil(a / 8)), cs = this.label || `Line chart, ${e.length} series over ${a} points. ${e.map((d, x) => `${d.name}: ${this.fmt(b[x].value)} at the end`).join(". ")}`;
3094
+ color: ft(_, d.color)
3095
+ })), v = [...u].sort((d, _) => d.yPos - _.yPos), D = v.some((d, _) => _ > 0 && d.yPos - v[_ - 1].yPos < 15), G = this.labelValues === "ends" && !D, C = Math.max(1, Math.ceil(a / 8)), R = this.label || `Line chart, ${e.length} series over ${a} points. ${e.map((d, _) => `${d.name}: ${this.fmt(u[_].value)} at the end`).join(". ")}`;
3009
3096
  return n`<div class=${this.rootClass("baht-line-chart")}>
3010
3097
  <svg
3011
3098
  class="baht-chart-svg"
3012
- viewBox="0 0 ${Qe} ${we}"
3099
+ viewBox="0 0 ${es} ${xe}"
3013
3100
  preserveAspectRatio="xMidYMid meet"
3014
3101
  role="img"
3015
- aria-label=${cs}
3102
+ aria-label=${R}
3016
3103
  >
3017
3104
  ${o.map(
3018
- (d) => A`
3019
- <line class="baht-chart-grid-line" x1=${B.left} x2=${B.left + m}
3105
+ (d) => L`
3106
+ <line class="baht-chart-grid-line" x1=${B.left} x2=${B.left + f}
3020
3107
  y1=${p(d).toFixed(2)} y2=${p(d).toFixed(2)}/>
3021
3108
  <text class="baht-chart-tick" x=${B.left - 8} y=${(p(d) + 4).toFixed(2)}
3022
3109
  text-anchor="end">${this.fmt(d)}</text>`
3023
3110
  )}
3024
3111
  ${this.baseline != null ? [
3025
- A`<line class="baht-chart-baseline" x1=${B.left} x2=${B.left + m}
3112
+ L`<line class="baht-chart-baseline" x1=${B.left} x2=${B.left + f}
3026
3113
  y1=${p(this.baseline).toFixed(2)} y2=${p(this.baseline).toFixed(2)}/>`
3027
3114
  ] : []}
3028
3115
  ${(this.markers ?? []).map(
3029
- (d) => A`
3030
- <line class="baht-chart-marker-line" x1=${B.left} x2=${B.left + m}
3116
+ (d) => L`
3117
+ <line class="baht-chart-marker-line" x1=${B.left} x2=${B.left + f}
3031
3118
  y1=${p(d.value).toFixed(2)} y2=${p(d.value).toFixed(2)}/>
3032
- <text class="baht-chart-marker-label" x=${B.left + m} y=${(p(d.value) - 5).toFixed(2)}
3119
+ <text class="baht-chart-marker-label" x=${B.left + f} y=${(p(d.value) - 5).toFixed(2)}
3033
3120
  text-anchor="end">${d.label ?? this.fmt(d.value)}</text>`
3034
3121
  )}
3035
- ${this.area && e.length === 1 ? A`<path class="baht-chart-area" fill=${lt(0, e[0].color)}
3036
- d=${`${k(e[0].values, 0, a - 1)} L${_(a - 1).toFixed(2)},${p(0).toFixed(2)} L${_(0).toFixed(2)},${p(0).toFixed(2)} Z`}/>` : h}
3037
- ${e.map((d, x) => {
3038
- const X = lt(x, d.color), et = [
3039
- A`<path class="baht-chart-line" d=${k(d.values, 0, f)} stroke=${X} fill="none"/>`
3122
+ ${this.area && e.length === 1 ? L`<path class="baht-chart-area" fill=${ft(0, e[0].color)}
3123
+ d=${`${x(e[0].values, 0, a - 1)} L${w(a - 1).toFixed(2)},${p(0).toFixed(2)} L${w(0).toFixed(2)},${p(0).toFixed(2)} Z`}/>` : h}
3124
+ ${e.map((d, _) => {
3125
+ const tt = ft(_, d.color), at = [
3126
+ L`<path class="baht-chart-line" d=${x(d.values, 0, P)} stroke=${tt} fill="none"/>`
3040
3127
  ];
3041
- return f < a - 1 && et.push(
3042
- A`<path class="baht-chart-line baht-chart-line--forecast" d=${k(d.values, f, a - 1)}
3043
- stroke=${X} fill="none"/>`
3044
- ), et.push(
3045
- A`<circle class="baht-chart-end-dot" cx=${_(a - 1).toFixed(2)}
3046
- cy=${p(d.values[d.values.length - 1] ?? 0).toFixed(2)} r="4" fill=${X}/>`
3047
- ), et;
3128
+ return P < a - 1 && at.push(
3129
+ L`<path class="baht-chart-line baht-chart-line--forecast" d=${x(d.values, P, a - 1)}
3130
+ stroke=${tt} fill="none"/>`
3131
+ ), at.push(
3132
+ L`<circle class="baht-chart-end-dot" cx=${w(a - 1).toFixed(2)}
3133
+ cy=${p(d.values[d.values.length - 1] ?? 0).toFixed(2)} r="4" fill=${tt}/>`
3134
+ ), at;
3048
3135
  })}
3049
- ${O ? b.map(
3050
- (d) => A`
3051
- <text class="baht-chart-end-label" x=${_(a - 1) + 10} y=${(d.yPos + 4).toFixed(2)}
3136
+ ${G ? u.map(
3137
+ (d) => L`
3138
+ <text class="baht-chart-end-label" x=${w(a - 1) + 10} y=${(d.yPos + 4).toFixed(2)}
3052
3139
  text-anchor="start">${this.fmt(d.value)}</text>`
3053
3140
  ) : h}
3054
3141
  ${i.map(
3055
- (d, x) => x % At === 0 ? A`<text class="baht-chart-tick" x=${_(x).toFixed(2)} y=${we - 10} text-anchor="middle">${d}</text>` : h
3142
+ (d, _) => _ % C === 0 ? L`<text class="baht-chart-tick" x=${w(_).toFixed(2)} y=${xe - 10} text-anchor="middle">${d}</text>` : h
3056
3143
  )}
3057
- ${Array.from({ length: a }, (d, x) => {
3058
- const X = m / Math.max(1, a - 1), et = `${i[x] ?? `Point ${x + 1}`}: ${e.map((st) => `${st.name} ${this.fmt(st.values[x] ?? 0)}`).join(", ")}`;
3059
- return A`<rect class="baht-chart-hit" x=${(_(x) - X / 2).toFixed(2)} y=${B.top}
3060
- width=${Math.max(24, X).toFixed(2)} height=${g} tabindex="0" role="button"
3061
- aria-label=${et}
3062
- @pointermove=${(st) => this.onHover(st, x, et)}
3144
+ ${Array.from({ length: a }, (d, _) => {
3145
+ const tt = f / Math.max(1, a - 1), at = `${i[_] ?? `Point ${_ + 1}`}: ${e.map((it) => `${it.name} ${this.fmt(it.values[_] ?? 0)}`).join(", ")}`;
3146
+ return L`<rect class="baht-chart-hit" x=${(w(_) - tt / 2).toFixed(2)} y=${B.top}
3147
+ width=${Math.max(24, tt).toFixed(2)} height=${$} tabindex="0" role="button"
3148
+ aria-label=${at}
3149
+ @pointermove=${(it) => this.onHover(it, _, at)}
3063
3150
  @pointerleave=${() => this.onLeave()}
3064
- @focus=${(st) => this.onHover(st, x, et)}
3151
+ @focus=${(it) => this.onHover(it, _, at)}
3065
3152
  @blur=${() => this.onLeave()}/>`;
3066
3153
  })}
3067
- ${this.crosshairAt != null ? A`<line class="baht-chart-crosshair" x1=${_(this.crosshairAt).toFixed(2)}
3068
- x2=${_(this.crosshairAt).toFixed(2)} y1=${B.top} y2=${B.top + g}/>` : h}
3154
+ ${this.crosshairAt != null ? L`<line class="baht-chart-crosshair" x1=${w(this.crosshairAt).toFixed(2)}
3155
+ x2=${w(this.crosshairAt).toFixed(2)} y1=${B.top} y2=${B.top + $}/>` : h}
3069
3156
  </svg>
3070
3157
  ${this.renderTooltip()}
3071
3158
  ${this.renderLegend(
3072
- e.map((d, x) => ({ label: d.name, color: lt(x, d.color) })),
3159
+ e.map((d, _) => ({ label: d.name, color: ft(_, d.color) })),
3073
3160
  "line"
3074
3161
  )}
3075
- ${this.showTable ? be(
3162
+ ${this.showTable ? fe(
3076
3163
  this.label || "Line chart data",
3077
3164
  ["Point", ...e.map((d) => d.name)],
3078
- Array.from({ length: a }, (d, x) => [
3079
- i[x] ?? `Point ${x + 1}`,
3080
- ...e.map((X) => this.fmt(X.values[x] ?? 0))
3165
+ Array.from({ length: a }, (d, _) => [
3166
+ i[_] ?? `Point ${_ + 1}`,
3167
+ ...e.map((tt) => this.fmt(tt.values[_] ?? 0))
3081
3168
  ])
3082
3169
  ) : h}
3083
3170
  </div>`;
@@ -3089,85 +3176,85 @@ let Z = class extends Q {
3089
3176
  this.crosshairAt = null, this.requestUpdate(), this.hideTip();
3090
3177
  }
3091
3178
  };
3092
- ot([
3179
+ nt([
3093
3180
  l({ attribute: !1 })
3094
- ], Z.prototype, "series", 2);
3095
- ot([
3181
+ ], et.prototype, "series", 2);
3182
+ nt([
3096
3183
  l({ attribute: !1 })
3097
- ], Z.prototype, "categories", 2);
3098
- ot([
3184
+ ], et.prototype, "categories", 2);
3185
+ nt([
3099
3186
  l({ type: Boolean })
3100
- ], Z.prototype, "area", 2);
3101
- ot([
3187
+ ], et.prototype, "area", 2);
3188
+ nt([
3102
3189
  l({ attribute: !1 })
3103
- ], Z.prototype, "markers", 2);
3104
- ot([
3190
+ ], et.prototype, "markers", 2);
3191
+ nt([
3105
3192
  l({ type: Number })
3106
- ], Z.prototype, "forecast", 2);
3107
- ot([
3193
+ ], et.prototype, "forecast", 2);
3194
+ nt([
3108
3195
  l({ type: Number })
3109
- ], Z.prototype, "baseline", 2);
3110
- ot([
3196
+ ], et.prototype, "baseline", 2);
3197
+ nt([
3111
3198
  l({ attribute: "label-values" })
3112
- ], Z.prototype, "labelValues", 2);
3113
- ot([
3199
+ ], et.prototype, "labelValues", 2);
3200
+ nt([
3114
3201
  l()
3115
- ], Z.prototype, "label", 2);
3116
- Z = ot([
3117
- u("baht-line-chart")
3118
- ], Z);
3119
- var Ya = Object.defineProperty, Xa = Object.getOwnPropertyDescriptor, gt = (t, e, i, a) => {
3120
- for (var s = a > 1 ? void 0 : a ? Xa(e, i) : e, r = t.length - 1, o; r >= 0; r--)
3202
+ ], et.prototype, "label", 2);
3203
+ et = nt([
3204
+ b("baht-line-chart")
3205
+ ], et);
3206
+ var Qa = Object.defineProperty, ti = Object.getOwnPropertyDescriptor, xt = (t, e, i, a) => {
3207
+ for (var s = a > 1 ? void 0 : a ? ti(e, i) : e, r = t.length - 1, o; r >= 0; r--)
3121
3208
  (o = t[r]) && (s = (a ? o(e, i, s) : o(s)) || s);
3122
- return a && s && Ya(e, i, s), s;
3209
+ return a && s && Qa(e, i, s), s;
3123
3210
  };
3124
- const xe = 22, Nt = 24, ts = 34, _e = 18, Za = ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"];
3125
- function ke(t) {
3211
+ const _e = 22, qt = 24, ss = 34, ke = 18, ei = ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"];
3212
+ function Pe(t) {
3126
3213
  const e = /^(\d{4})-(\d{2})-(\d{2})/.exec(t ?? "");
3127
3214
  return e ? new Date(Date.UTC(+e[1], +e[2] - 1, +e[3])) : null;
3128
3215
  }
3129
- function Pe(t) {
3216
+ function Oe(t) {
3130
3217
  return t.toISOString().slice(0, 10);
3131
3218
  }
3132
- let ct = class extends Q {
3219
+ let pt = class extends st {
3133
3220
  constructor() {
3134
3221
  super(...arguments), this.values = [], this.from = "", this.to = "", this.lessLabel = "Less", this.moreLabel = "More", this.label = "";
3135
3222
  }
3136
3223
  get range() {
3137
- const t = (this.values ?? []).map((a) => ke(a.date)).filter((a) => !!a), e = ke(this.from) ?? (t.length ? new Date(Math.min(...t.map((a) => +a))) : null), i = ke(this.to) ?? (t.length ? new Date(Math.max(...t.map((a) => +a))) : null);
3224
+ const t = (this.values ?? []).map((a) => Pe(a.date)).filter((a) => !!a), e = Pe(this.from) ?? (t.length ? new Date(Math.min(...t.map((a) => +a))) : null), i = Pe(this.to) ?? (t.length ? new Date(Math.max(...t.map((a) => +a))) : null);
3138
3225
  return !e || !i || +i < +e ? null : { start: e, end: i };
3139
3226
  }
3140
3227
  render() {
3141
3228
  const t = this.hold({ values: this.values ?? [], range: this.range }), e = t.range;
3142
3229
  if (!e || t.values.length === 0)
3143
3230
  return n`<div class=${this.rootClass("baht-heatmap")}>${this.renderEmpty()}</div>`;
3144
- const i = new Map(t.values.map((b) => [b.date.slice(0, 10), b.value])), a = [], s = new Date(e.start), r = (e.start.getUTCDay() + 6) % 7;
3231
+ const i = new Map(t.values.map((u) => [u.date.slice(0, 10), u.value])), a = [], s = new Date(e.start), r = (e.start.getUTCDay() + 6) % 7;
3145
3232
  let o = 0;
3146
3233
  for (; +s <= +e.end; ) {
3147
- const b = Pe(s), w = (s.getUTCDay() + 6) % 7, D = Math.floor((r + o) / 7);
3148
- a.push({ iso: b, value: i.has(b) ? i.get(b) : null, col: D, row: w }), s.setUTCDate(s.getUTCDate() + 1), o += 1;
3234
+ const u = Oe(s), v = (s.getUTCDay() + 6) % 7, D = Math.floor((r + o) / 7);
3235
+ a.push({ iso: u, value: i.has(u) ? i.get(u) : null, col: D, row: v }), s.setUTCDate(s.getUTCDate() + 1), o += 1;
3149
3236
  }
3150
- const c = Math.max(1, ...a.map((b) => b.col + 1)), m = ts + c * Nt, g = _e + 7 * Nt + 4, _ = Math.max(1, ...a.map((b) => b.value ?? 0)), p = (b) => Math.min(4, Math.max(0, Math.ceil(b / _ * 5) - 1)), f = a.reduce((b, w) => b + (w.value ?? 0), 0), k = this.label || `Calendar heatmap, ${a.length} days from ${Pe(e.start)} to ${Pe(e.end)}, total ${this.fmt(f)}`;
3237
+ const c = Math.max(1, ...a.map((u) => u.col + 1)), f = ss + c * qt, $ = ke + 7 * qt + 4, w = Math.max(1, ...a.map((u) => u.value ?? 0)), p = (u) => Math.min(4, Math.max(0, Math.ceil(u / w * 5) - 1)), P = a.reduce((u, v) => u + (v.value ?? 0), 0), x = this.label || `Calendar heatmap, ${a.length} days from ${Oe(e.start)} to ${Oe(e.end)}, total ${this.fmt(P)}`;
3151
3238
  return n`<div class=${this.rootClass("baht-heatmap")}>
3152
3239
  <svg
3153
3240
  class="baht-chart-svg baht-heatmap-svg"
3154
- width=${m}
3155
- height=${g}
3156
- viewBox="0 0 ${m} ${g}"
3241
+ width=${f}
3242
+ height=${$}
3243
+ viewBox="0 0 ${f} ${$}"
3157
3244
  preserveAspectRatio="xMinYMin meet"
3158
3245
  role="img"
3159
- aria-label=${k}
3246
+ aria-label=${x}
3160
3247
  >
3161
- ${Za.map(
3162
- (b, w) => w % 2 === 0 ? A`<text class="baht-chart-tick" x="0" y=${_e + w * Nt + xe / 2 + 4}>${b}</text>` : h
3248
+ ${ei.map(
3249
+ (u, v) => v % 2 === 0 ? L`<text class="baht-chart-tick" x="0" y=${ke + v * qt + _e / 2 + 4}>${u}</text>` : h
3163
3250
  )}
3164
- ${a.map((b) => {
3165
- const w = b.value == null ? `${b.iso}: no activity` : `${b.iso}: ${this.fmt(b.value)}`, D = b.value == null || b.value <= 0 ? "var(--baht-chart-grid)" : Ye(p(b.value));
3166
- return A`<rect class="baht-heatmap-cell" x=${ts + b.col * Nt} y=${_e + b.row * Nt}
3167
- width=${xe} height=${xe} rx="3" fill=${D} tabindex="0" role="button" aria-label=${w}
3168
- @pointermove=${(O) => this.showTip(O, w)}
3251
+ ${a.map((u) => {
3252
+ const v = u.value == null ? `${u.iso}: no activity` : `${u.iso}: ${this.fmt(u.value)}`, D = u.value == null || u.value <= 0 ? "var(--baht-chart-grid)" : Xe(p(u.value));
3253
+ return L`<rect class="baht-heatmap-cell" x=${ss + u.col * qt} y=${ke + u.row * qt}
3254
+ width=${_e} height=${_e} rx="3" fill=${D} tabindex="0" role="button" aria-label=${v}
3255
+ @pointermove=${(G) => this.showTip(G, v)}
3169
3256
  @pointerleave=${() => this.hideTip()}
3170
- @focus=${(O) => this.showTip(O, w)}
3257
+ @focus=${(G) => this.showTip(G, v)}
3171
3258
  @blur=${() => this.hideTip()}/>`;
3172
3259
  })}
3173
3260
  </svg>
@@ -3175,73 +3262,79 @@ let ct = class extends Q {
3175
3262
  <div class="baht-heatmap-scale">
3176
3263
  <span class="baht-heatmap-scale-label">${this.lessLabel}</span>
3177
3264
  ${[0, 1, 2, 3, 4].map(
3178
- (b) => n`<span
3265
+ (u) => n`<span
3179
3266
  class="baht-chart-swatch"
3180
- style=${`background:${Ye(b)}`}
3267
+ style=${`background:${Xe(u)}`}
3181
3268
  aria-hidden="true"
3182
3269
  ></span>`
3183
3270
  )}
3184
3271
  <span class="baht-heatmap-scale-label">${this.moreLabel}</span>
3185
3272
  </div>
3186
- ${this.showTable ? be(
3273
+ ${this.showTable ? fe(
3187
3274
  this.label || "Calendar heatmap data",
3188
3275
  ["Date", "Value"],
3189
- a.map((b) => [b.iso, b.value == null ? "—" : this.fmt(b.value)])
3276
+ a.map((u) => [u.iso, u.value == null ? "—" : this.fmt(u.value)])
3190
3277
  ) : h}
3191
3278
  </div>`;
3192
3279
  }
3193
3280
  };
3194
- gt([
3281
+ xt([
3195
3282
  l({ attribute: !1 })
3196
- ], ct.prototype, "values", 2);
3197
- gt([
3283
+ ], pt.prototype, "values", 2);
3284
+ xt([
3198
3285
  l()
3199
- ], ct.prototype, "from", 2);
3200
- gt([
3286
+ ], pt.prototype, "from", 2);
3287
+ xt([
3201
3288
  l()
3202
- ], ct.prototype, "to", 2);
3203
- gt([
3289
+ ], pt.prototype, "to", 2);
3290
+ xt([
3204
3291
  l({ attribute: "less-label" })
3205
- ], ct.prototype, "lessLabel", 2);
3206
- gt([
3292
+ ], pt.prototype, "lessLabel", 2);
3293
+ xt([
3207
3294
  l({ attribute: "more-label" })
3208
- ], ct.prototype, "moreLabel", 2);
3209
- gt([
3295
+ ], pt.prototype, "moreLabel", 2);
3296
+ xt([
3210
3297
  l()
3211
- ], ct.prototype, "label", 2);
3212
- ct = gt([
3213
- u("baht-heatmap")
3214
- ], ct);
3215
- var Qa = Object.defineProperty, ti = Object.getOwnPropertyDescriptor, tt = (t, e, i, a) => {
3216
- for (var s = a > 1 ? void 0 : a ? ti(e, i) : e, r = t.length - 1, o; r >= 0; r--)
3298
+ ], pt.prototype, "label", 2);
3299
+ pt = xt([
3300
+ b("baht-heatmap")
3301
+ ], pt);
3302
+ var si = Object.defineProperty, ai = Object.getOwnPropertyDescriptor, Z = (t, e, i, a) => {
3303
+ for (var s = a > 1 ? void 0 : a ? ai(e, i) : e, r = t.length - 1, o; r >= 0; r--)
3217
3304
  (o = t[r]) && (s = (a ? o(e, i, s) : o(s)) || s);
3218
- return a && s && Qa(e, i, s), s;
3305
+ return a && s && si(e, i, s), s;
3219
3306
  };
3220
- let G = class extends $ {
3307
+ let U = class extends g {
3221
3308
  constructor() {
3222
- super(...arguments), this.value = 0, this.max = 100, this.label = "", this.format = "number", this.currency = "THB", this.thresholds = { warning: 0.8, danger: 1 }, this.expected = null, this.overLabel = "Over budget", this.nearLabel = "Near limit";
3309
+ super(...arguments), this.value = 0, this.max = 100, this.label = "", this.format = "number", this.currency = "THB", this.thresholds = { warning: 0.8, danger: 1 }, this.expected = null, this.overLabel = "Over budget", this.atLabel = "At budget", this.nearLabel = "Near limit";
3223
3310
  }
3224
3311
  get fraction() {
3225
3312
  const t = this.max || 1, e = this.value / t;
3226
3313
  return Number.isFinite(e) ? Math.max(0, e) : 0;
3227
3314
  }
3228
- /** `ok` | `warning` | `danger`, from the fraction and the thresholds. */
3315
+ /**
3316
+ * `ok` | `warning` | `danger`, from the fraction and the thresholds. `danger` is
3317
+ * strictly **above** its threshold: spending exactly the budget is not
3318
+ * overspending, so it reads as the warning tone with an "At budget" status.
3319
+ * `warning` stays inclusive (`>=`).
3320
+ */
3229
3321
  get severity() {
3230
3322
  const { warning: t, danger: e } = this.thresholds ?? { warning: 0.8, danger: 1 }, i = this.fraction;
3231
- return i >= e ? "danger" : i >= t ? "warning" : "ok";
3323
+ return i > e ? "danger" : i >= t ? "warning" : "ok";
3232
3324
  }
3233
3325
  get statusText() {
3234
- const t = this.severity;
3235
- return t === "danger" ? this.overLabel : t === "warning" ? this.nearLabel : "";
3326
+ const { danger: t } = this.thresholds ?? { danger: 1 }, e = this.severity;
3327
+ return e === "danger" ? this.overLabel : e === "warning" ? this.fraction >= t ? this.atLabel : this.nearLabel : "";
3236
3328
  }
3237
3329
  render() {
3238
- const t = this.severity, e = Math.min(100, this.fraction * 100), i = (o) => qt(o, this.format, this.currency), a = this.expected != null && Number.isFinite(this.expected) && this.max ? Math.min(100, Math.max(0, this.expected / this.max * 100)) : null, s = `${i(this.value)} of ${i(this.max)}`, r = t === "danger" ? "!" : t === "warning" ? "△" : "";
3330
+ var c;
3331
+ const t = this.severity, e = Math.min(100, this.fraction * 100), i = (f) => Rt(f, this.format, this.currency), a = this.expected != null && Number.isFinite(this.expected) && this.max ? Math.min(100, Math.max(0, this.expected / this.max * 100)) : null, s = `${i(this.value)} of ${i(this.max)}`, r = t === "warning" && this.fraction >= (((c = this.thresholds) == null ? void 0 : c.danger) ?? 1), o = t === "danger" ? "!" : r ? "=" : t === "warning" ? "△" : "";
3239
3332
  return n`<div class="baht-meter baht-meter--${t}">
3240
3333
  <div class="baht-meter-head">
3241
3334
  ${this.label ? n`<span class="baht-meter-label">${this.label}</span>` : h}
3242
3335
  <span class="baht-meter-value">${s}</span>
3243
3336
  ${this.statusText ? n`<span class="baht-meter-status"
3244
- ><span class="baht-meter-icon" aria-hidden="true">${r}</span
3337
+ ><span class="baht-meter-icon" aria-hidden="true">${o}</span
3245
3338
  >${this.statusText}</span
3246
3339
  >` : h}
3247
3340
  </div>
@@ -3265,42 +3358,45 @@ let G = class extends $ {
3265
3358
  </div>`;
3266
3359
  }
3267
3360
  };
3268
- tt([
3361
+ Z([
3269
3362
  l({ type: Number })
3270
- ], G.prototype, "value", 2);
3271
- tt([
3363
+ ], U.prototype, "value", 2);
3364
+ Z([
3272
3365
  l({ type: Number })
3273
- ], G.prototype, "max", 2);
3274
- tt([
3366
+ ], U.prototype, "max", 2);
3367
+ Z([
3275
3368
  l()
3276
- ], G.prototype, "label", 2);
3277
- tt([
3369
+ ], U.prototype, "label", 2);
3370
+ Z([
3278
3371
  l()
3279
- ], G.prototype, "format", 2);
3280
- tt([
3372
+ ], U.prototype, "format", 2);
3373
+ Z([
3281
3374
  l()
3282
- ], G.prototype, "currency", 2);
3283
- tt([
3375
+ ], U.prototype, "currency", 2);
3376
+ Z([
3284
3377
  l({ attribute: !1 })
3285
- ], G.prototype, "thresholds", 2);
3286
- tt([
3378
+ ], U.prototype, "thresholds", 2);
3379
+ Z([
3287
3380
  l({ type: Number })
3288
- ], G.prototype, "expected", 2);
3289
- tt([
3381
+ ], U.prototype, "expected", 2);
3382
+ Z([
3290
3383
  l({ attribute: "over-label" })
3291
- ], G.prototype, "overLabel", 2);
3292
- tt([
3384
+ ], U.prototype, "overLabel", 2);
3385
+ Z([
3386
+ l({ attribute: "at-label" })
3387
+ ], U.prototype, "atLabel", 2);
3388
+ Z([
3293
3389
  l({ attribute: "near-label" })
3294
- ], G.prototype, "nearLabel", 2);
3295
- G = tt([
3296
- u("baht-meter")
3297
- ], G);
3298
- var ei = Object.defineProperty, si = Object.getOwnPropertyDescriptor, fe = (t, e, i, a) => {
3299
- for (var s = a > 1 ? void 0 : a ? si(e, i) : e, r = t.length - 1, o; r >= 0; r--)
3390
+ ], U.prototype, "nearLabel", 2);
3391
+ U = Z([
3392
+ b("baht-meter")
3393
+ ], U);
3394
+ var ii = Object.defineProperty, ri = Object.getOwnPropertyDescriptor, me = (t, e, i, a) => {
3395
+ for (var s = a > 1 ? void 0 : a ? ri(e, i) : e, r = t.length - 1, o; r >= 0; r--)
3300
3396
  (o = t[r]) && (s = (a ? o(e, i, s) : o(s)) || s);
3301
- return a && s && ei(e, i, s), s;
3397
+ return a && s && ii(e, i, s), s;
3302
3398
  };
3303
- let Ht = class extends $ {
3399
+ let Gt = class extends g {
3304
3400
  constructor() {
3305
3401
  super(...arguments), this.icon = "🗂️", this.message = "Nothing to display", this.hint = "";
3306
3402
  }
@@ -3312,24 +3408,24 @@ let Ht = class extends $ {
3312
3408
  </div>`;
3313
3409
  }
3314
3410
  };
3315
- fe([
3411
+ me([
3316
3412
  l()
3317
- ], Ht.prototype, "icon", 2);
3318
- fe([
3413
+ ], Gt.prototype, "icon", 2);
3414
+ me([
3319
3415
  l()
3320
- ], Ht.prototype, "message", 2);
3321
- fe([
3416
+ ], Gt.prototype, "message", 2);
3417
+ me([
3322
3418
  l()
3323
- ], Ht.prototype, "hint", 2);
3324
- Ht = fe([
3325
- u("baht-empty-state")
3326
- ], Ht);
3327
- var ai = Object.defineProperty, ii = Object.getOwnPropertyDescriptor, Qt = (t, e, i, a) => {
3328
- for (var s = a > 1 ? void 0 : a ? ii(e, i) : e, r = t.length - 1, o; r >= 0; r--)
3419
+ ], Gt.prototype, "hint", 2);
3420
+ Gt = me([
3421
+ b("baht-empty-state")
3422
+ ], Gt);
3423
+ var oi = Object.defineProperty, li = Object.getOwnPropertyDescriptor, te = (t, e, i, a) => {
3424
+ for (var s = a > 1 ? void 0 : a ? li(e, i) : e, r = t.length - 1, o; r >= 0; r--)
3329
3425
  (o = t[r]) && (s = (a ? o(e, i, s) : o(s)) || s);
3330
- return a && s && ai(e, i, s), s;
3426
+ return a && s && oi(e, i, s), s;
3331
3427
  };
3332
- let Ft = class extends $ {
3428
+ let Bt = class extends g {
3333
3429
  constructor() {
3334
3430
  super(...arguments), this.icon = "⚠️", this.heading = "Something went wrong", this.message = "", this.retryLabel = "";
3335
3431
  }
@@ -3345,27 +3441,27 @@ let Ft = class extends $ {
3345
3441
  </div>`;
3346
3442
  }
3347
3443
  };
3348
- Qt([
3444
+ te([
3349
3445
  l()
3350
- ], Ft.prototype, "icon", 2);
3351
- Qt([
3446
+ ], Bt.prototype, "icon", 2);
3447
+ te([
3352
3448
  l()
3353
- ], Ft.prototype, "heading", 2);
3354
- Qt([
3449
+ ], Bt.prototype, "heading", 2);
3450
+ te([
3355
3451
  l()
3356
- ], Ft.prototype, "message", 2);
3357
- Qt([
3452
+ ], Bt.prototype, "message", 2);
3453
+ te([
3358
3454
  l({ attribute: "retry-label" })
3359
- ], Ft.prototype, "retryLabel", 2);
3360
- Ft = Qt([
3361
- u("baht-error-state")
3362
- ], Ft);
3363
- var ri = Object.defineProperty, oi = Object.getOwnPropertyDescriptor, wt = (t, e, i, a) => {
3364
- for (var s = a > 1 ? void 0 : a ? oi(e, i) : e, r = t.length - 1, o; r >= 0; r--)
3455
+ ], Bt.prototype, "retryLabel", 2);
3456
+ Bt = te([
3457
+ b("baht-error-state")
3458
+ ], Bt);
3459
+ var ni = Object.defineProperty, hi = Object.getOwnPropertyDescriptor, _t = (t, e, i, a) => {
3460
+ for (var s = a > 1 ? void 0 : a ? hi(e, i) : e, r = t.length - 1, o; r >= 0; r--)
3365
3461
  (o = t[r]) && (s = (a ? o(e, i, s) : o(s)) || s);
3366
- return a && s && ri(e, i, s), s;
3462
+ return a && s && ni(e, i, s), s;
3367
3463
  };
3368
- let pt = class extends $ {
3464
+ let dt = class extends g {
3369
3465
  constructor() {
3370
3466
  super(...arguments), this.value = {}, this.keyPlaceholder = "key", this.valuePlaceholder = "value", this.add_label = "Add row", this.disabled = !1, this.rows = [{ k: "", v: "" }], this.syncedJson = "";
3371
3467
  }
@@ -3422,7 +3518,7 @@ let pt = class extends $ {
3422
3518
  aria-label="Remove row ${e + 1}"
3423
3519
  ?disabled=${this.disabled}
3424
3520
  @click=${() => this.commit(this.rows.filter((i, a) => a !== e))}
3425
- >${U("close")}</button>
3521
+ >${W("close")}</button>
3426
3522
  </div>`
3427
3523
  )}
3428
3524
  <button
@@ -3430,37 +3526,37 @@ let pt = class extends $ {
3430
3526
  class="baht-keyvalue-add"
3431
3527
  ?disabled=${this.disabled}
3432
3528
  @click=${this.addRow}
3433
- >${U("plus")}${this.add_label}</button>
3529
+ >${W("plus")}${this.add_label}</button>
3434
3530
  </div>`;
3435
3531
  }
3436
3532
  };
3437
- wt([
3533
+ _t([
3438
3534
  l({ attribute: !1 })
3439
- ], pt.prototype, "value", 2);
3440
- wt([
3535
+ ], dt.prototype, "value", 2);
3536
+ _t([
3441
3537
  l({ attribute: "key-placeholder" })
3442
- ], pt.prototype, "keyPlaceholder", 2);
3443
- wt([
3538
+ ], dt.prototype, "keyPlaceholder", 2);
3539
+ _t([
3444
3540
  l({ attribute: "value-placeholder" })
3445
- ], pt.prototype, "valuePlaceholder", 2);
3446
- wt([
3541
+ ], dt.prototype, "valuePlaceholder", 2);
3542
+ _t([
3447
3543
  l({ attribute: "add-label" })
3448
- ], pt.prototype, "add_label", 2);
3449
- wt([
3544
+ ], dt.prototype, "add_label", 2);
3545
+ _t([
3450
3546
  l({ type: Boolean })
3451
- ], pt.prototype, "disabled", 2);
3452
- wt([
3547
+ ], dt.prototype, "disabled", 2);
3548
+ _t([
3453
3549
  y()
3454
- ], pt.prototype, "rows", 2);
3455
- pt = wt([
3456
- u("baht-keyvalue-editor")
3457
- ], pt);
3458
- var li = Object.defineProperty, ni = Object.getOwnPropertyDescriptor, M = (t, e, i, a) => {
3459
- for (var s = a > 1 ? void 0 : a ? ni(e, i) : e, r = t.length - 1, o; r >= 0; r--)
3550
+ ], dt.prototype, "rows", 2);
3551
+ dt = _t([
3552
+ b("baht-keyvalue-editor")
3553
+ ], dt);
3554
+ var ci = Object.defineProperty, pi = Object.getOwnPropertyDescriptor, A = (t, e, i, a) => {
3555
+ for (var s = a > 1 ? void 0 : a ? pi(e, i) : e, r = t.length - 1, o; r >= 0; r--)
3460
3556
  (o = t[r]) && (s = (a ? o(e, i, s) : o(s)) || s);
3461
- return a && s && li(e, i, s), s;
3557
+ return a && s && ci(e, i, s), s;
3462
3558
  };
3463
- let S = class extends $ {
3559
+ let j = class extends g {
3464
3560
  constructor() {
3465
3561
  super(...arguments), this.label = "Reference", this.value = "", this.display = "", this.placeholder = "", this.disabled = !1, this.invalid = !1, this.href = "", this.lookupLabel = "Look up records", this.debounce = 200, this.fetcher = null, this.open = !1, this.term = "", this.options = [], this.loading = !1, this.activeIndex = -1, this.fetchSeq = 0, this.onDocMousedown = (t) => {
3466
3562
  this.contains(t.target) || this.close();
@@ -3470,16 +3566,16 @@ let S = class extends $ {
3470
3566
  return `baht-refpicker-list-${this.uid}`;
3471
3567
  }
3472
3568
  disconnectedCallback() {
3473
- super.disconnectedCallback(), clearTimeout(this.timer), q() && document.removeEventListener("mousedown", this.onDocMousedown);
3569
+ super.disconnectedCallback(), clearTimeout(this.timer), S() && document.removeEventListener("mousedown", this.onDocMousedown);
3474
3570
  }
3475
3571
  openLookup() {
3476
- this.disabled || this.open || (this.open = !0, this.term = "", this.activeIndex = -1, q() && document.addEventListener("mousedown", this.onDocMousedown), this.search(""), this.updateComplete.then(() => {
3572
+ this.disabled || this.open || (this.open = !0, this.term = "", this.activeIndex = -1, S() && document.addEventListener("mousedown", this.onDocMousedown), this.search(""), this.updateComplete.then(() => {
3477
3573
  var t;
3478
3574
  return (t = this.inputEl) == null ? void 0 : t.focus();
3479
3575
  }));
3480
3576
  }
3481
3577
  close() {
3482
- this.open && (this.open = !1, this.loading = !1, clearTimeout(this.timer), q() && document.removeEventListener("mousedown", this.onDocMousedown));
3578
+ this.open && (this.open = !1, this.loading = !1, clearTimeout(this.timer), S() && document.removeEventListener("mousedown", this.onDocMousedown));
3483
3579
  }
3484
3580
  search(t) {
3485
3581
  clearTimeout(this.timer), this.timer = setTimeout(async () => {
@@ -3554,7 +3650,7 @@ let S = class extends $ {
3554
3650
  aria-label="Clear"
3555
3651
  @mousedown=${(e) => e.preventDefault()}
3556
3652
  @click=${() => this.clear()}
3557
- >${U("close")}</button>` : h}
3653
+ >${W("close")}</button>` : h}
3558
3654
  </div>
3559
3655
  <button
3560
3656
  type="button"
@@ -3563,13 +3659,13 @@ let S = class extends $ {
3563
3659
  title=${this.lookupLabel}
3564
3660
  ?disabled=${this.disabled}
3565
3661
  @click=${() => this.open ? this.close() : this.openLookup()}
3566
- >${U("search")}</button>
3662
+ >${W("search")}</button>
3567
3663
  ${this.value && this.href ? n`<a
3568
3664
  class="baht-refpicker-open"
3569
3665
  href=${this.href}
3570
3666
  aria-label="Open record"
3571
3667
  title="Open record"
3572
- >${U("external")}</a>` : h}
3668
+ >${W("external")}</a>` : h}
3573
3669
  <div
3574
3670
  class="baht-refpicker-list"
3575
3671
  id=${this.listboxId}
@@ -3596,63 +3692,63 @@ let S = class extends $ {
3596
3692
  </div>`;
3597
3693
  }
3598
3694
  };
3599
- M([
3695
+ A([
3600
3696
  l()
3601
- ], S.prototype, "label", 2);
3602
- M([
3697
+ ], j.prototype, "label", 2);
3698
+ A([
3603
3699
  l()
3604
- ], S.prototype, "value", 2);
3605
- M([
3700
+ ], j.prototype, "value", 2);
3701
+ A([
3606
3702
  l()
3607
- ], S.prototype, "display", 2);
3608
- M([
3703
+ ], j.prototype, "display", 2);
3704
+ A([
3609
3705
  l()
3610
- ], S.prototype, "placeholder", 2);
3611
- M([
3706
+ ], j.prototype, "placeholder", 2);
3707
+ A([
3612
3708
  l({ type: Boolean })
3613
- ], S.prototype, "disabled", 2);
3614
- M([
3709
+ ], j.prototype, "disabled", 2);
3710
+ A([
3615
3711
  l({ type: Boolean })
3616
- ], S.prototype, "invalid", 2);
3617
- M([
3712
+ ], j.prototype, "invalid", 2);
3713
+ A([
3618
3714
  l()
3619
- ], S.prototype, "href", 2);
3620
- M([
3715
+ ], j.prototype, "href", 2);
3716
+ A([
3621
3717
  l({ attribute: "lookup-label" })
3622
- ], S.prototype, "lookupLabel", 2);
3623
- M([
3718
+ ], j.prototype, "lookupLabel", 2);
3719
+ A([
3624
3720
  l({ type: Number })
3625
- ], S.prototype, "debounce", 2);
3626
- M([
3721
+ ], j.prototype, "debounce", 2);
3722
+ A([
3627
3723
  l({ attribute: !1 })
3628
- ], S.prototype, "fetcher", 2);
3629
- M([
3724
+ ], j.prototype, "fetcher", 2);
3725
+ A([
3630
3726
  y()
3631
- ], S.prototype, "open", 2);
3632
- M([
3727
+ ], j.prototype, "open", 2);
3728
+ A([
3633
3729
  y()
3634
- ], S.prototype, "term", 2);
3635
- M([
3730
+ ], j.prototype, "term", 2);
3731
+ A([
3636
3732
  y()
3637
- ], S.prototype, "options", 2);
3638
- M([
3733
+ ], j.prototype, "options", 2);
3734
+ A([
3639
3735
  y()
3640
- ], S.prototype, "loading", 2);
3641
- M([
3736
+ ], j.prototype, "loading", 2);
3737
+ A([
3642
3738
  y()
3643
- ], S.prototype, "activeIndex", 2);
3644
- M([
3645
- Et("input")
3646
- ], S.prototype, "inputEl", 2);
3647
- S = M([
3648
- u("baht-reference-picker")
3649
- ], S);
3650
- var hi = Object.defineProperty, ci = Object.getOwnPropertyDescriptor, j = (t, e, i, a) => {
3651
- for (var s = a > 1 ? void 0 : a ? ci(e, i) : e, r = t.length - 1, o; r >= 0; r--)
3739
+ ], j.prototype, "activeIndex", 2);
3740
+ A([
3741
+ It("input")
3742
+ ], j.prototype, "inputEl", 2);
3743
+ j = A([
3744
+ b("baht-reference-picker")
3745
+ ], j);
3746
+ var di = Object.defineProperty, ui = Object.getOwnPropertyDescriptor, M = (t, e, i, a) => {
3747
+ for (var s = a > 1 ? void 0 : a ? ui(e, i) : e, r = t.length - 1, o; r >= 0; r--)
3652
3748
  (o = t[r]) && (s = (a ? o(e, i, s) : o(s)) || s);
3653
- return a && s && hi(e, i, s), s;
3749
+ return a && s && di(e, i, s), s;
3654
3750
  };
3655
- let E = class extends $ {
3751
+ let E = class extends g {
3656
3752
  constructor() {
3657
3753
  super(...arguments), this.label = "Search", this.value = "", this.placeholder = "", this.disabled = !1, this.invalid = !1, this.options = [], this.fetcher = null, this.debounce = 150, this.minChars = 1, this.maxItems = 8, this.freeText = !0, this.autocomplete = "off", this.term = "", this.open = !1, this.results = [], this.loading = !1, this.activeIndex = -1, this.fetchSeq = 0, this.picked = null, this.lastPicked = null, this.onDocMousedown = (t) => {
3658
3754
  this.contains(t.target) || this.close();
@@ -3668,7 +3764,7 @@ let E = class extends $ {
3668
3764
  return `${this.listboxId}-${t}`;
3669
3765
  }
3670
3766
  disconnectedCallback() {
3671
- super.disconnectedCallback(), clearTimeout(this.timer), q() && document.removeEventListener("mousedown", this.onDocMousedown);
3767
+ super.disconnectedCallback(), clearTimeout(this.timer), S() && document.removeEventListener("mousedown", this.onDocMousedown);
3672
3768
  }
3673
3769
  willUpdate(t) {
3674
3770
  super.willUpdate(t), t.has("value") && this.timer === void 0 && (this.term = this.value);
@@ -3715,10 +3811,10 @@ let E = class extends $ {
3715
3811
  this.activeIndex !== t && (this.activeIndex = t);
3716
3812
  }
3717
3813
  listen() {
3718
- q() && document.addEventListener("mousedown", this.onDocMousedown);
3814
+ S() && document.addEventListener("mousedown", this.onDocMousedown);
3719
3815
  }
3720
3816
  close() {
3721
- q() && document.removeEventListener("mousedown", this.onDocMousedown), this.open && (this.open = !1, this.activeIndex = -1);
3817
+ S() && document.removeEventListener("mousedown", this.onDocMousedown), this.open && (this.open = !1, this.activeIndex = -1);
3722
3818
  }
3723
3819
  // ---- events ------------------------------------------------------------
3724
3820
  emitChange(t, e) {
@@ -3798,7 +3894,7 @@ let E = class extends $ {
3798
3894
  aria-invalid=${this.invalid ? "true" : h}
3799
3895
  autocomplete=${this.autocomplete}
3800
3896
  placeholder=${this.placeholder || h}
3801
- .value=${rt(this.term)}
3897
+ .value=${lt(this.term)}
3802
3898
  ?disabled=${this.disabled}
3803
3899
  @input=${(i) => this.onInput(i)}
3804
3900
  @keydown=${(i) => this.onKeydown(i)}
@@ -3835,64 +3931,64 @@ let E = class extends $ {
3835
3931
  </div>`;
3836
3932
  }
3837
3933
  };
3838
- j([
3934
+ M([
3839
3935
  l()
3840
3936
  ], E.prototype, "label", 2);
3841
- j([
3937
+ M([
3842
3938
  l()
3843
3939
  ], E.prototype, "value", 2);
3844
- j([
3940
+ M([
3845
3941
  l()
3846
3942
  ], E.prototype, "placeholder", 2);
3847
- j([
3943
+ M([
3848
3944
  l({ type: Boolean })
3849
3945
  ], E.prototype, "disabled", 2);
3850
- j([
3946
+ M([
3851
3947
  l({ type: Boolean })
3852
3948
  ], E.prototype, "invalid", 2);
3853
- j([
3949
+ M([
3854
3950
  l({ attribute: !1 })
3855
3951
  ], E.prototype, "options", 2);
3856
- j([
3952
+ M([
3857
3953
  l({ attribute: !1 })
3858
3954
  ], E.prototype, "fetcher", 2);
3859
- j([
3955
+ M([
3860
3956
  l({ type: Number })
3861
3957
  ], E.prototype, "debounce", 2);
3862
- j([
3958
+ M([
3863
3959
  l({ type: Number, attribute: "min-chars" })
3864
3960
  ], E.prototype, "minChars", 2);
3865
- j([
3961
+ M([
3866
3962
  l({ type: Number, attribute: "max-items" })
3867
3963
  ], E.prototype, "maxItems", 2);
3868
- j([
3964
+ M([
3869
3965
  l({ attribute: "free-text", converter: (t) => t !== "false" })
3870
3966
  ], E.prototype, "freeText", 2);
3871
- j([
3967
+ M([
3872
3968
  l()
3873
3969
  ], E.prototype, "autocomplete", 2);
3874
- j([
3970
+ M([
3875
3971
  y()
3876
3972
  ], E.prototype, "term", 2);
3877
- j([
3973
+ M([
3878
3974
  y()
3879
3975
  ], E.prototype, "open", 2);
3880
- j([
3976
+ M([
3881
3977
  y()
3882
3978
  ], E.prototype, "results", 2);
3883
- j([
3979
+ M([
3884
3980
  y()
3885
3981
  ], E.prototype, "loading", 2);
3886
- j([
3982
+ M([
3887
3983
  y()
3888
3984
  ], E.prototype, "activeIndex", 2);
3889
- j([
3890
- Et("input")
3985
+ M([
3986
+ It("input")
3891
3987
  ], E.prototype, "inputEl", 2);
3892
- E = j([
3893
- u("baht-typeahead")
3988
+ E = M([
3989
+ b("baht-typeahead")
3894
3990
  ], E);
3895
- const ns = {
3991
+ const cs = {
3896
3992
  text: "baht-input",
3897
3993
  email: "baht-input",
3898
3994
  password: "baht-input",
@@ -3909,22 +4005,22 @@ const ns = {
3909
4005
  section: "baht-section",
3910
4006
  repeater: "baht-repeater"
3911
4007
  };
3912
- var pi = Object.defineProperty, di = Object.getOwnPropertyDescriptor, hs = (t, e, i, a) => {
3913
- for (var s = a > 1 ? void 0 : a ? di(e, i) : e, r = t.length - 1, o; r >= 0; r--)
4008
+ var bi = Object.defineProperty, fi = Object.getOwnPropertyDescriptor, ps = (t, e, i, a) => {
4009
+ for (var s = a > 1 ? void 0 : a ? fi(e, i) : e, r = t.length - 1, o; r >= 0; r--)
3914
4010
  (o = t[r]) && (s = (a ? o(e, i, s) : o(s)) || s);
3915
- return a && s && pi(e, i, s), s;
4011
+ return a && s && bi(e, i, s), s;
3916
4012
  };
3917
- const ui = {
4013
+ const mi = {
3918
4014
  "1/4": "baht-field--w-1-4",
3919
4015
  "1/2": "baht-field--w-1-2",
3920
4016
  "3/4": "baht-field--w-3-4",
3921
4017
  full: "baht-field--w-full"
3922
- }, es = /* @__PURE__ */ new Map();
3923
- function bi(t) {
3924
- let e = es.get(t);
3925
- return e || (e = is(t), es.set(t, e)), e;
4018
+ }, as = /* @__PURE__ */ new Map();
4019
+ function vi(t) {
4020
+ let e = as.get(t);
4021
+ return e || (e = os(t), as.set(t, e)), e;
3926
4022
  }
3927
- let Be = class extends W {
4023
+ let Ie = class extends Y {
3928
4024
  constructor() {
3929
4025
  super(...arguments), this.rowErrors = [];
3930
4026
  }
@@ -3944,7 +4040,7 @@ let Be = class extends W {
3944
4040
  addRow() {
3945
4041
  const t = {};
3946
4042
  for (const e of this.subFields)
3947
- e.type === "label" || e.type === "section" || (t[e.key] = se(e));
4043
+ e.type === "label" || e.type === "section" || (t[e.key] = ae(e));
3948
4044
  this.emitInput([...this.rows, t]);
3949
4045
  }
3950
4046
  removeRow(t) {
@@ -3953,7 +4049,7 @@ let Be = class extends W {
3953
4049
  /** Pending keystrokes in any row land in the array before the host reads it. */
3954
4050
  flushTyped() {
3955
4051
  var t;
3956
- if (!q()) return super.flushTyped();
4052
+ if (!S()) return super.flushTyped();
3957
4053
  for (const e of this.querySelectorAll(".baht-repeater-row > .baht-field > *"))
3958
4054
  (t = e.flushTyped) == null || t.call(e);
3959
4055
  super.flushTyped();
@@ -3969,17 +4065,17 @@ let Be = class extends W {
3969
4065
  * focus, same as <baht-form> — and the whole thing renders on the server.
3970
4066
  */
3971
4067
  renderSub(t, e, i) {
3972
- const a = ns[i.type];
4068
+ const a = cs[i.type];
3973
4069
  if (!a) return h;
3974
- const s = bi(a), r = ui[i.width ?? "full"] ?? "baht-field--w-full", o = (c) => {
4070
+ const s = vi(a), r = mi[i.width ?? "full"] ?? "baht-field--w-full", o = (c) => {
3975
4071
  c.stopPropagation();
3976
- const { value: m } = c.detail;
3977
- this.patchRow(e, i.key, m);
4072
+ const { value: f } = c.detail;
4073
+ this.patchRow(e, i.key, f);
3978
4074
  };
3979
4075
  return n`<div class="baht-field ${r}" data-key=${i.key} data-type=${i.type}>
3980
- ${ee`<${s}
4076
+ ${se`<${s}
3981
4077
  .field=${i}
3982
- .value=${Object.hasOwn(t, i.key) ? t[i.key] : se(i)}
4078
+ .value=${Object.hasOwn(t, i.key) ? t[i.key] : ae(i)}
3983
4079
  .disabled=${this.disabled}
3984
4080
  .readonly=${this.readonly}
3985
4081
  .required=${!!i.required}
@@ -3998,16 +4094,16 @@ let Be = class extends W {
3998
4094
  aria-labelledby=${this.field.label ? this.labelId : h}
3999
4095
  aria-describedby=${this.describedBy}
4000
4096
  >
4001
- ${Oe(
4097
+ ${Ce(
4002
4098
  t,
4003
4099
  (a, s) => s,
4004
4100
  (a, s) => n`<div
4005
4101
  class="baht-repeater-row"
4006
4102
  data-row=${s}
4007
4103
  role="group"
4008
- aria-label=${v("row", { n: s + 1 })}
4104
+ aria-label=${m("row", { n: s + 1 })}
4009
4105
  >
4010
- ${Oe(
4106
+ ${Ce(
4011
4107
  this.subFields,
4012
4108
  (r) => r.key,
4013
4109
  (r) => this.renderSub(a, s, r)
@@ -4015,8 +4111,8 @@ let Be = class extends W {
4015
4111
  ${e ? n`<button
4016
4112
  type="button"
4017
4113
  class="baht-repeater-remove"
4018
- aria-label=${v("removeRowN", { n: s + 1 })}
4019
- title=${v("removeRowN", { n: s + 1 })}
4114
+ aria-label=${m("removeRowN", { n: s + 1 })}
4115
+ title=${m("removeRowN", { n: s + 1 })}
4020
4116
  @click=${() => this.removeRow(s)}
4021
4117
  >
4022
4118
  ✕
@@ -4029,23 +4125,23 @@ let Be = class extends W {
4029
4125
  ?disabled=${this.disabled || i}
4030
4126
  @click=${() => this.addRow()}
4031
4127
  >
4032
- + ${this.field.add_label ?? v("addRow")}
4128
+ + ${this.field.add_label ?? m("addRow")}
4033
4129
  </button>`}
4034
4130
  </div>`;
4035
4131
  }
4036
4132
  };
4037
- hs([
4133
+ ps([
4038
4134
  l({ attribute: !1 })
4039
- ], Be.prototype, "rowErrors", 2);
4040
- Be = hs([
4041
- u("baht-repeater")
4042
- ], Be);
4043
- var fi = Object.defineProperty, mi = Object.getOwnPropertyDescriptor, me = (t, e, i, a) => {
4044
- for (var s = a > 1 ? void 0 : a ? mi(e, i) : e, r = t.length - 1, o; r >= 0; r--)
4135
+ ], Ie.prototype, "rowErrors", 2);
4136
+ Ie = ps([
4137
+ b("baht-repeater")
4138
+ ], Ie);
4139
+ var $i = Object.defineProperty, yi = Object.getOwnPropertyDescriptor, ve = (t, e, i, a) => {
4140
+ for (var s = a > 1 ? void 0 : a ? yi(e, i) : e, r = t.length - 1, o; r >= 0; r--)
4045
4141
  (o = t[r]) && (s = (a ? o(e, i, s) : o(s)) || s);
4046
- return a && s && fi(e, i, s), s;
4142
+ return a && s && $i(e, i, s), s;
4047
4143
  };
4048
- let Gt = class extends $ {
4144
+ let Wt = class extends g {
4049
4145
  constructor() {
4050
4146
  super(...arguments), this.steps = [], this.current = 0, this.variant = "default";
4051
4147
  }
@@ -4053,7 +4149,7 @@ let Gt = class extends $ {
4053
4149
  const t = this.variant === "sidebar";
4054
4150
  return n`<ol
4055
4151
  class="baht-steps ${t ? "baht-steps--sidebar" : ""}"
4056
- aria-label=${v("step", { current: this.current + 1, total: this.steps.length })}
4152
+ aria-label=${m("step", { current: this.current + 1, total: this.steps.length })}
4057
4153
  >
4058
4154
  ${this.steps.map((e, i) => {
4059
4155
  const a = i < this.current ? "done" : i === this.current ? "current" : "todo";
@@ -4063,40 +4159,40 @@ let Gt = class extends $ {
4063
4159
  >
4064
4160
  ${t ? h : n`<span class="baht-step-marker" aria-hidden="true">${a === "done" ? "✓" : i + 1}</span>`}
4065
4161
  <span class="baht-step-label">${e}</span>
4066
- ${a === "done" ? n`<span class="baht-visually-hidden"> (${v("stepDone")})</span>` : a === "current" ? n`<span class="baht-visually-hidden"> (${v("stepCurrent")})</span>` : h}
4162
+ ${a === "done" ? n`<span class="baht-visually-hidden"> (${m("stepDone")})</span>` : a === "current" ? n`<span class="baht-visually-hidden"> (${m("stepCurrent")})</span>` : h}
4067
4163
  </li>`;
4068
4164
  })}
4069
4165
  </ol>`;
4070
4166
  }
4071
4167
  };
4072
- me([
4168
+ ve([
4073
4169
  l({ attribute: !1 })
4074
- ], Gt.prototype, "steps", 2);
4075
- me([
4170
+ ], Wt.prototype, "steps", 2);
4171
+ ve([
4076
4172
  l({ type: Number })
4077
- ], Gt.prototype, "current", 2);
4078
- me([
4173
+ ], Wt.prototype, "current", 2);
4174
+ ve([
4079
4175
  l()
4080
- ], Gt.prototype, "variant", 2);
4081
- Gt = me([
4082
- u("baht-steps")
4083
- ], Gt);
4084
- var vi = Object.defineProperty, $i = Object.getOwnPropertyDescriptor, Y = (t, e, i, a) => {
4085
- for (var s = a > 1 ? void 0 : a ? $i(e, i) : e, r = t.length - 1, o; r >= 0; r--)
4176
+ ], Wt.prototype, "variant", 2);
4177
+ Wt = ve([
4178
+ b("baht-steps")
4179
+ ], Wt);
4180
+ var gi = Object.defineProperty, wi = Object.getOwnPropertyDescriptor, Q = (t, e, i, a) => {
4181
+ for (var s = a > 1 ? void 0 : a ? wi(e, i) : e, r = t.length - 1, o; r >= 0; r--)
4086
4182
  (o = t[r]) && (s = (a ? o(e, i, s) : o(s)) || s);
4087
- return a && s && vi(e, i, s), s;
4183
+ return a && s && gi(e, i, s), s;
4088
4184
  };
4089
- const yi = {
4185
+ const xi = {
4090
4186
  "1/4": "baht-field--w-1-4",
4091
4187
  "1/2": "baht-field--w-1-2",
4092
4188
  "3/4": "baht-field--w-3-4",
4093
4189
  full: "baht-field--w-full"
4094
- }, ss = /* @__PURE__ */ new Map();
4095
- function gi(t) {
4096
- let e = ss.get(t);
4097
- return e || (e = is(t), ss.set(t, e)), e;
4190
+ }, is = /* @__PURE__ */ new Map();
4191
+ function _i(t) {
4192
+ let e = is.get(t);
4193
+ return e || (e = os(t), is.set(t, e)), e;
4098
4194
  }
4099
- let V = class extends $ {
4195
+ let H = class extends g {
4100
4196
  constructor() {
4101
4197
  super(...arguments), this.value = {}, this.registry = {}, this.options = {}, this.fieldStates = {}, this.flags = {}, this.readonly = !1, this.edits = {}, this.errors = [], this.dynamicOptions = /* @__PURE__ */ new Map(), this.optionsSnapshots = /* @__PURE__ */ new Map(), this.optionsEpoch = /* @__PURE__ */ new Map(), this.warnedViews = /* @__PURE__ */ new Set(), this.flagCache = {};
4102
4198
  }
@@ -4104,7 +4200,7 @@ let V = class extends $ {
4104
4200
  return this.form ? ((this.flagCache.form !== this.form || this.flagCache.flags !== this.flags) && (this.flagCache = {
4105
4201
  form: this.form,
4106
4202
  flags: this.flags,
4107
- out: as(this.form, this.flags)
4203
+ out: rs(this.form, this.flags)
4108
4204
  }), this.flagCache.out) : this.form;
4109
4205
  }
4110
4206
  willUpdate(t) {
@@ -4120,7 +4216,7 @@ let V = class extends $ {
4120
4216
  const t = this.getData();
4121
4217
  for (const a of ((e = this.effectiveForm) == null ? void 0 : e.fields) ?? []) {
4122
4218
  if (!a.options_from) continue;
4123
- const s = JSON.stringify((a.options_deps ?? []).map((m) => t[m] ?? null));
4219
+ const s = JSON.stringify((a.options_deps ?? []).map((f) => t[f] ?? null));
4124
4220
  if (this.optionsSnapshots.get(a.key) === s) continue;
4125
4221
  this.optionsSnapshots.set(a.key, s);
4126
4222
  const r = (this.optionsEpoch.get(a.key) ?? 0) + 1;
@@ -4131,10 +4227,10 @@ let V = class extends $ {
4131
4227
  continue;
4132
4228
  }
4133
4229
  const c = o(t);
4134
- c instanceof Promise ? c.then((m) => {
4135
- this.optionsEpoch.get(a.key) === r && (this.dynamicOptions.set(a.key, m), this.requestUpdate());
4136
- }).catch((m) => {
4137
- console.warn(`[bahtui] options fetcher "${a.options_from}" failed`, m), this.optionsEpoch.get(a.key) === r && this.optionsSnapshots.delete(a.key);
4230
+ c instanceof Promise ? c.then((f) => {
4231
+ this.optionsEpoch.get(a.key) === r && (this.dynamicOptions.set(a.key, f), this.requestUpdate());
4232
+ }).catch((f) => {
4233
+ console.warn(`[bahtui] options fetcher "${a.options_from}" failed`, f), this.optionsEpoch.get(a.key) === r && this.optionsSnapshots.delete(a.key);
4138
4234
  }) : this.dynamicOptions.set(a.key, c);
4139
4235
  }
4140
4236
  }
@@ -4149,13 +4245,13 @@ let V = class extends $ {
4149
4245
  for (; e.length > 0; ) {
4150
4246
  const r = e.shift();
4151
4247
  for (const o of ((a = this.effectiveForm) == null ? void 0 : a.fields) ?? [])
4152
- !((s = o.options_deps) != null && s.includes(r)) || i.has(o.key) || (i.add(o.key), this.edits = { ...this.edits, [o.key]: se(o) }, e.push(o.key));
4248
+ !((s = o.options_deps) != null && s.includes(r)) || i.has(o.key) || (i.add(o.key), this.edits = { ...this.edits, [o.key]: ae(o) }, e.push(o.key));
4153
4249
  }
4154
4250
  }
4155
4251
  get sortedFields() {
4156
4252
  if (!this.form) return [];
4157
- const t = Me(this.effectiveForm, this.view);
4158
- return t || (this.view !== void 0 && !this.warnedViews.has(this.view) && (this.warnedViews.add(this.view), console.warn(`[bahtui] unknown view "${this.view}" — showing the full form`)), Me(this.effectiveForm) ?? []);
4253
+ const t = Ae(this.effectiveForm, this.view);
4254
+ return t || (this.view !== void 0 && !this.warnedViews.has(this.view) && (this.warnedViews.add(this.view), console.warn(`[bahtui] unknown view "${this.view}" — showing the full form`)), Ae(this.effectiveForm) ?? []);
4159
4255
  }
4160
4256
  stateFor(t) {
4161
4257
  return this.fieldStates[t.key] ?? {
@@ -4167,13 +4263,13 @@ let V = class extends $ {
4167
4263
  };
4168
4264
  }
4169
4265
  valueFor(t) {
4170
- return Object.hasOwn(this.edits, t.key) ? this.edits[t.key] : Object.hasOwn(this.value, t.key) ? this.value[t.key] : se(t);
4266
+ return Object.hasOwn(this.edits, t.key) ? this.edits[t.key] : Object.hasOwn(this.value, t.key) ? this.value[t.key] : ae(t);
4171
4267
  }
4172
4268
  // ---- public API (spec 01 §6) ----
4173
4269
  /** Debounced keystrokes still in a control land in `edits` before anyone reads them. */
4174
4270
  flushTyped() {
4175
4271
  var t;
4176
- if (q())
4272
+ if (S())
4177
4273
  for (const e of this.querySelectorAll(":scope > .baht-form > .baht-field > *"))
4178
4274
  (t = e.flushTyped) == null || t.call(e);
4179
4275
  }
@@ -4195,7 +4291,7 @@ let V = class extends $ {
4195
4291
  const s = this.stateFor(a);
4196
4292
  if (!s.visible) continue;
4197
4293
  const r = s.required === !!a.required ? a : { ...a, required: s.required };
4198
- t.push(...Ae(r, this.valueFor(a), this.registry, e));
4294
+ t.push(...Le(r, this.valueFor(a), this.registry, e));
4199
4295
  }
4200
4296
  this.errors = t;
4201
4297
  const i = { valid: t.length === 0, errors: t };
@@ -4225,7 +4321,7 @@ let V = class extends $ {
4225
4321
  const e = this.stateFor(t);
4226
4322
  if (!e.visible) return [];
4227
4323
  const i = this.getData(), a = e.required === !!t.required ? t : { ...t, required: e.required };
4228
- return Ae(a, this.valueFor(t), this.registry, i);
4324
+ return Le(a, this.valueFor(t), this.registry, i);
4229
4325
  }
4230
4326
  /** `validateOn: 'blur'` — validate just the field the user left, same as
4231
4327
  * how errors are shown elsewhere (merged into `this.errors`, painted by
@@ -4236,51 +4332,51 @@ let V = class extends $ {
4236
4332
  this.errors = [...i, ...e];
4237
4333
  }
4238
4334
  renderField(t) {
4239
- var k, b;
4240
- const e = ns[t.type];
4335
+ var x, u;
4336
+ const e = cs[t.type];
4241
4337
  if (!e)
4242
4338
  return console.warn(`[bahtui] unknown field type "${t.type}" — skipped`), h;
4243
- const i = this.stateFor(t), a = yi[t.width ?? "full"] ?? "baht-field--w-full", s = ((k = this.errors.find((w) => w.key === t.key)) == null ? void 0 : k.message) ?? null;
4339
+ const i = this.stateFor(t), a = xi[t.width ?? "full"] ?? "baht-field--w-full", s = ((x = this.errors.find((v) => v.key === t.key)) == null ? void 0 : x.message) ?? null;
4244
4340
  if (this.readonly && t.type !== "label" && t.type !== "section")
4245
4341
  return this.renderReadonlyField(t, a, i.visible);
4246
- const r = t.options_from ? { ...t, options: this.dynamicOptions.get(t.key) ?? t.options ?? [] } : t, o = this.valueFor(t), c = !i.enabled, m = this.readonly || i.readonly, g = this.options.inputDebounce, _ = (w) => this.onControlInput(t.key, w), p = gi(e);
4247
- let f;
4342
+ const r = t.options_from ? { ...t, options: this.dynamicOptions.get(t.key) ?? t.options ?? [] } : t, o = this.valueFor(t), c = !i.enabled, f = this.readonly || i.readonly, $ = this.options.inputDebounce, w = (v) => this.onControlInput(t.key, v), p = _i(e);
4343
+ let P;
4248
4344
  if (t.type === "repeater") {
4249
- const w = this.errors.filter((D) => D.key.startsWith(`${t.key}[`));
4250
- f = ee`<${p}
4345
+ const v = this.errors.filter((D) => D.key.startsWith(`${t.key}[`));
4346
+ P = se`<${p}
4251
4347
  .field=${r}
4252
4348
  .value=${o}
4253
4349
  .disabled=${c}
4254
- .readonly=${m}
4350
+ .readonly=${f}
4255
4351
  .required=${i.required}
4256
4352
  .error=${s}
4257
- .debounce=${g}
4258
- .rowErrors=${w}
4259
- @baht-input=${_}
4353
+ .debounce=${$}
4354
+ .rowErrors=${v}
4355
+ @baht-input=${w}
4260
4356
  ></${p}>`;
4261
4357
  } else if (t.type === "file") {
4262
- let w;
4263
- t.uploader && (w = (b = this.registry.uploaders) == null ? void 0 : b[t.uploader], w || console.warn(`[bahtui] unknown uploader "${t.uploader}" — capture only`)), f = ee`<${p}
4358
+ let v;
4359
+ t.uploader && (v = (u = this.registry.uploaders) == null ? void 0 : u[t.uploader], v || console.warn(`[bahtui] unknown uploader "${t.uploader}" — capture only`)), P = se`<${p}
4264
4360
  .field=${r}
4265
4361
  .value=${o}
4266
4362
  .disabled=${c}
4267
- .readonly=${m}
4363
+ .readonly=${f}
4268
4364
  .required=${i.required}
4269
4365
  .error=${s}
4270
- .debounce=${g}
4271
- .uploader=${w}
4272
- @baht-input=${_}
4366
+ .debounce=${$}
4367
+ .uploader=${v}
4368
+ @baht-input=${w}
4273
4369
  ></${p}>`;
4274
4370
  } else
4275
- f = ee`<${p}
4371
+ P = se`<${p}
4276
4372
  .field=${r}
4277
4373
  .value=${o}
4278
4374
  .disabled=${c}
4279
- .readonly=${m}
4375
+ .readonly=${f}
4280
4376
  .required=${i.required}
4281
4377
  .error=${s}
4282
- .debounce=${g}
4283
- @baht-input=${_}
4378
+ .debounce=${$}
4379
+ @baht-input=${w}
4284
4380
  ></${p}>`;
4285
4381
  return n`<div
4286
4382
  class="baht-field ${a} ${i.visible ? "" : "baht-field--hidden"}"
@@ -4289,7 +4385,7 @@ let V = class extends $ {
4289
4385
  data-testid="${this.form.form_id}.${t.key}"
4290
4386
  @focusout=${() => this.onFieldBlur(t)}
4291
4387
  >
4292
- ${f}
4388
+ ${P}
4293
4389
  </div>`;
4294
4390
  }
4295
4391
  /**
@@ -4302,7 +4398,7 @@ let V = class extends $ {
4302
4398
  i && this.onFieldInput(i, e);
4303
4399
  }
4304
4400
  renderReadonlyField(t, e, i) {
4305
- const a = t.options_from ? this.dynamicOptions.get(t.key) ?? t.options ?? [] : t.options, s = us(t, this.valueFor(t), a), r = s.kind === "empty" ? n`<span class="baht-readonly-value baht-readonly-value--empty">${v("emptyValue")}</span>` : s.kind === "text" ? n`<span class="baht-readonly-value">${s.text}</span>` : s.kind === "chips" ? n`<span class="baht-readonly-value baht-readonly-chips"
4401
+ const a = t.options_from ? this.dynamicOptions.get(t.key) ?? t.options ?? [] : t.options, s = bs(t, this.valueFor(t), a), r = s.kind === "empty" ? n`<span class="baht-readonly-value baht-readonly-value--empty">${m("emptyValue")}</span>` : s.kind === "text" ? n`<span class="baht-readonly-value">${s.text}</span>` : s.kind === "chips" ? n`<span class="baht-readonly-value baht-readonly-chips"
4306
4402
  >${s.items.map((o) => n`<span class="baht-readonly-chip">${o}</span>`)}</span
4307
4403
  >` : n`<div class="baht-readonly-rows">
4308
4404
  ${s.rows.map(
@@ -4328,7 +4424,7 @@ let V = class extends $ {
4328
4424
  }
4329
4425
  render() {
4330
4426
  return n`<div class="baht-form ${this.readonly ? "baht-form--readonly" : ""}">
4331
- ${Oe(
4427
+ ${Ce(
4332
4428
  this.sortedFields,
4333
4429
  (t) => t.key,
4334
4430
  (t) => this.renderField(t)
@@ -4336,45 +4432,45 @@ let V = class extends $ {
4336
4432
  </div>`;
4337
4433
  }
4338
4434
  };
4339
- Y([
4435
+ Q([
4340
4436
  l({ attribute: !1 })
4341
- ], V.prototype, "form", 2);
4342
- Y([
4437
+ ], H.prototype, "form", 2);
4438
+ Q([
4343
4439
  l({ attribute: !1 })
4344
- ], V.prototype, "value", 2);
4345
- Y([
4440
+ ], H.prototype, "value", 2);
4441
+ Q([
4346
4442
  l({ attribute: !1 })
4347
- ], V.prototype, "registry", 2);
4348
- Y([
4443
+ ], H.prototype, "registry", 2);
4444
+ Q([
4349
4445
  l({ attribute: !1 })
4350
- ], V.prototype, "options", 2);
4351
- Y([
4446
+ ], H.prototype, "options", 2);
4447
+ Q([
4352
4448
  l({ attribute: !1 })
4353
- ], V.prototype, "fieldStates", 2);
4354
- Y([
4449
+ ], H.prototype, "fieldStates", 2);
4450
+ Q([
4355
4451
  l({ type: String })
4356
- ], V.prototype, "view", 2);
4357
- Y([
4452
+ ], H.prototype, "view", 2);
4453
+ Q([
4358
4454
  l({ attribute: !1 })
4359
- ], V.prototype, "flags", 2);
4360
- Y([
4455
+ ], H.prototype, "flags", 2);
4456
+ Q([
4361
4457
  l({ type: Boolean })
4362
- ], V.prototype, "readonly", 2);
4363
- Y([
4458
+ ], H.prototype, "readonly", 2);
4459
+ Q([
4364
4460
  y()
4365
- ], V.prototype, "edits", 2);
4366
- Y([
4461
+ ], H.prototype, "edits", 2);
4462
+ Q([
4367
4463
  y()
4368
- ], V.prototype, "errors", 2);
4369
- V = Y([
4370
- u("baht-form")
4371
- ], V);
4372
- var wi = Object.defineProperty, xi = Object.getOwnPropertyDescriptor, N = (t, e, i, a) => {
4373
- for (var s = a > 1 ? void 0 : a ? xi(e, i) : e, r = t.length - 1, o; r >= 0; r--)
4464
+ ], H.prototype, "errors", 2);
4465
+ H = Q([
4466
+ b("baht-form")
4467
+ ], H);
4468
+ var ki = Object.defineProperty, Pi = Object.getOwnPropertyDescriptor, q = (t, e, i, a) => {
4469
+ for (var s = a > 1 ? void 0 : a ? Pi(e, i) : e, r = t.length - 1, o; r >= 0; r--)
4374
4470
  (o = t[r]) && (s = (a ? o(e, i, s) : o(s)) || s);
4375
- return a && s && wi(e, i, s), s;
4471
+ return a && s && ki(e, i, s), s;
4376
4472
  };
4377
- let T = class extends $ {
4473
+ let T = class extends g {
4378
4474
  constructor() {
4379
4475
  super(...arguments), this.value = {}, this.registry = {}, this.validateGate = !0, this.showBack = !0, this.flags = {}, this.showSteps = !1, this.stepsVariant = "default", this.data = {}, this.derived = null, this.current = null, this.approvalError = null, this.history = [], this.flagCache = {};
4380
4476
  }
@@ -4385,7 +4481,7 @@ let T = class extends $ {
4385
4481
  return this.workflow ? ((this.flagCache.workflow !== this.workflow || this.flagCache.flags !== this.flags) && (this.flagCache = {
4386
4482
  workflow: this.workflow,
4387
4483
  flags: this.flags,
4388
- out: as(this.workflow, this.flags)
4484
+ out: rs(this.workflow, this.flags)
4389
4485
  }), this.flagCache.out) : this.workflow;
4390
4486
  }
4391
4487
  willUpdate(t) {
@@ -4393,7 +4489,7 @@ let T = class extends $ {
4393
4489
  t.has("workflow") || t.has("value") ? (this.data = structuredClone(this.value ?? {}), this.reevaluate(), this.history = [], this.current = ((e = this.visibleForms[0]) == null ? void 0 : e.form_name) ?? null, this.approvalError = null) : t.has("flags") && (this.reevaluate(), this.current && !this.visibleForms.some((a) => a.form_name === this.current) && (this.current = ((i = this.visibleForms[0]) == null ? void 0 : i.form_name) ?? null));
4394
4490
  }
4395
4491
  reevaluate() {
4396
- this.derived = bs(this.effectiveWorkflow, this.data), this.data = this.derived.data;
4492
+ this.derived = fs(this.effectiveWorkflow, this.data), this.data = this.derived.data;
4397
4493
  }
4398
4494
  /** Forms in ascending order whose derived visibility is true. */
4399
4495
  get visibleForms() {
@@ -4413,7 +4509,7 @@ let T = class extends $ {
4413
4509
  if (!this.current) return "end";
4414
4510
  const t = this.effectiveWorkflow;
4415
4511
  if (t.transitions && t.transitions.length > 0)
4416
- return fs(t, this.current, this.data);
4512
+ return ms(t, this.current, this.data);
4417
4513
  const e = this.visibleForms, i = e.findIndex((s) => s.form_name === this.current);
4418
4514
  return ((a = e[i + 1]) == null ? void 0 : a.form_name) ?? "end";
4419
4515
  }
@@ -4490,12 +4586,12 @@ let T = class extends $ {
4490
4586
  this.decide("rejected");
4491
4587
  }
4492
4588
  decide(t) {
4493
- var m;
4589
+ var f;
4494
4590
  const e = this.currentForm;
4495
4591
  if (!e || e.kind !== "approval") return;
4496
- const i = e.approval ?? {}, a = String(((m = this.data[e.form_name]) == null ? void 0 : m.comment) ?? ""), s = i.comment ?? "optional";
4592
+ const i = e.approval ?? {}, a = String(((f = this.data[e.form_name]) == null ? void 0 : f.comment) ?? ""), s = i.comment ?? "optional";
4497
4593
  if ((s === "required" || s === "requireOnReject" && t === "rejected") && a.trim() === "") {
4498
- this.approvalError = v("commentRequired");
4594
+ this.approvalError = m("commentRequired");
4499
4595
  return;
4500
4596
  }
4501
4597
  this.approvalError = null, this.data = {
@@ -4509,7 +4605,7 @@ let T = class extends $ {
4509
4605
  }
4510
4606
  this.emit("baht-reject", o);
4511
4607
  const c = i.on_reject ?? { action: "end" };
4512
- c.action === "goto" && this.visibleForms.some((g) => g.form_name === c.form) ? this.gotoForm(c.form) : this.emit("baht-complete", { data: this.getData(), status: "rejected" });
4608
+ c.action === "goto" && this.visibleForms.some(($) => $.form_name === c.form) ? this.gotoForm(c.form) : this.emit("baht-complete", { data: this.getData(), status: "rejected" });
4513
4609
  }
4514
4610
  /** Jump back to a visible form, truncating the history to that point. */
4515
4611
  gotoForm(t) {
@@ -4558,7 +4654,7 @@ let T = class extends $ {
4558
4654
  const e = ((a = t.approval) == null ? void 0 : a.comment) ?? "optional", i = this.summary_forms(t);
4559
4655
  return n`<div class="baht-approval">
4560
4656
  <div class="baht-approval-summary">
4561
- ${i.length === 0 ? n`<p class="baht-approval-empty">${v("nothingToReview")}</p>` : i.map(
4657
+ ${i.length === 0 ? n`<p class="baht-approval-empty">${m("nothingToReview")}</p>` : i.map(
4562
4658
  (r) => n`<section class="baht-approval-group">
4563
4659
  <h4 class="baht-approval-group-title">${r.form_name}</h4>
4564
4660
  <baht-form
@@ -4572,7 +4668,7 @@ let T = class extends $ {
4572
4668
  </div>
4573
4669
  ${e !== "hidden" ? n`<label class="baht-approval-comment">
4574
4670
  <span class="baht-approval-comment-label">
4575
- ${v("comment")}${e === "required" ? v("commentRequiredSuffix") : ""}
4671
+ ${m("comment")}${e === "required" ? m("commentRequiredSuffix") : ""}
4576
4672
  </span>
4577
4673
  <textarea
4578
4674
  rows="3"
@@ -4596,7 +4692,7 @@ let T = class extends $ {
4596
4692
  data-testid="${this.workflow.workflow_id}.${t.form_name}"
4597
4693
  >
4598
4694
  <div class="baht-visually-hidden" role="status">
4599
- ${v("step", { current: a + 1, total: i.length })}
4695
+ ${m("step", { current: a + 1, total: i.length })}
4600
4696
  </div>
4601
4697
  ${this.showSteps ? n`<baht-steps
4602
4698
  .steps=${i.map((o) => o.form_name)}
@@ -4616,7 +4712,7 @@ let T = class extends $ {
4616
4712
  data-testid="${this.workflow.workflow_id}.back"
4617
4713
  @click=${() => this.back()}
4618
4714
  >
4619
- ${this.backLabel ?? v("back")}
4715
+ ${this.backLabel ?? m("back")}
4620
4716
  </button>` : h}
4621
4717
  ${e ? n`<button
4622
4718
  type="button"
@@ -4624,7 +4720,7 @@ let T = class extends $ {
4624
4720
  data-testid="${this.workflow.workflow_id}.reject"
4625
4721
  @click=${() => this.decide("rejected")}
4626
4722
  >
4627
- ${((s = t.approval) == null ? void 0 : s.reject_label) ?? v("reject")}
4723
+ ${((s = t.approval) == null ? void 0 : s.reject_label) ?? m("reject")}
4628
4724
  </button>
4629
4725
  <button
4630
4726
  type="button"
@@ -4632,123 +4728,123 @@ let T = class extends $ {
4632
4728
  data-testid="${this.workflow.workflow_id}.approve"
4633
4729
  @click=${() => this.decide("approved")}
4634
4730
  >
4635
- ${((r = t.approval) == null ? void 0 : r.approve_label) ?? v("approve")}
4731
+ ${((r = t.approval) == null ? void 0 : r.approve_label) ?? m("approve")}
4636
4732
  </button>` : n`<button type="button" class="baht-button baht-button--next"
4637
4733
  data-testid="${this.workflow.workflow_id}.next"
4638
4734
  @click=${() => this.next()}
4639
4735
  >
4640
- ${this.isLast ? this.submitLabel ?? v("submit") : this.nextLabel ?? v("next")}
4736
+ ${this.isLast ? this.submitLabel ?? m("submit") : this.nextLabel ?? m("next")}
4641
4737
  </button>`}
4642
4738
  </div>
4643
4739
  </div>`;
4644
4740
  }
4645
4741
  };
4646
- N([
4742
+ q([
4647
4743
  l({ attribute: !1 })
4648
4744
  ], T.prototype, "workflow", 2);
4649
- N([
4745
+ q([
4650
4746
  l({ attribute: !1 })
4651
4747
  ], T.prototype, "value", 2);
4652
- N([
4748
+ q([
4653
4749
  l({ attribute: !1 })
4654
4750
  ], T.prototype, "registry", 2);
4655
- N([
4751
+ q([
4656
4752
  l({ type: Boolean, attribute: "validate-gate" })
4657
4753
  ], T.prototype, "validateGate", 2);
4658
- N([
4754
+ q([
4659
4755
  l({ attribute: "next-label" })
4660
4756
  ], T.prototype, "nextLabel", 2);
4661
- N([
4757
+ q([
4662
4758
  l({ attribute: "submit-label" })
4663
4759
  ], T.prototype, "submitLabel", 2);
4664
- N([
4760
+ q([
4665
4761
  l({ attribute: "back-label" })
4666
4762
  ], T.prototype, "backLabel", 2);
4667
- N([
4763
+ q([
4668
4764
  l({ type: Boolean, attribute: "show-back" })
4669
4765
  ], T.prototype, "showBack", 2);
4670
- N([
4766
+ q([
4671
4767
  l({ attribute: !1 })
4672
4768
  ], T.prototype, "flags", 2);
4673
- N([
4769
+ q([
4674
4770
  l({ type: Boolean, attribute: "show-steps" })
4675
4771
  ], T.prototype, "showSteps", 2);
4676
- N([
4772
+ q([
4677
4773
  l({ attribute: "steps-variant" })
4678
4774
  ], T.prototype, "stepsVariant", 2);
4679
- N([
4775
+ q([
4680
4776
  y()
4681
4777
  ], T.prototype, "data", 2);
4682
- N([
4778
+ q([
4683
4779
  y()
4684
4780
  ], T.prototype, "derived", 2);
4685
- N([
4781
+ q([
4686
4782
  y()
4687
4783
  ], T.prototype, "current", 2);
4688
- N([
4784
+ q([
4689
4785
  y()
4690
4786
  ], T.prototype, "approvalError", 2);
4691
- T = N([
4692
- u("baht-workflow")
4787
+ T = q([
4788
+ b("baht-workflow")
4693
4789
  ], T);
4694
4790
  export {
4695
- Ye as $,
4696
- nt as A,
4697
- Ot as B,
4698
- kt as C,
4699
- Ve as D,
4700
- it as E,
4701
- ft as F,
4702
- S as G,
4703
- Be as H,
4704
- Fe as I,
4705
- oe as J,
4706
- Vt as K,
4707
- ht as L,
4708
- ie as M,
4709
- z as N,
4710
- Ut as O,
4711
- Gt as P,
4712
- P as Q,
4713
- De as R,
4714
- Ne as S,
4715
- Ce as T,
4716
- Ke as U,
4717
- _t as V,
4791
+ Xe as $,
4792
+ ht as A,
4793
+ Dt as B,
4794
+ Ot as C,
4795
+ Ke as D,
4796
+ ot as E,
4797
+ vt as F,
4798
+ j as G,
4799
+ Ie as H,
4800
+ Ee as I,
4801
+ le as J,
4802
+ Kt as K,
4803
+ ct as L,
4804
+ re as M,
4805
+ K as N,
4806
+ Ht as O,
4807
+ Wt as P,
4808
+ k as Q,
4809
+ Fe as R,
4810
+ qe as S,
4811
+ De as T,
4812
+ Ue as U,
4813
+ Pt as V,
4718
4814
  E as W,
4719
4815
  F as X,
4720
4816
  T as Y,
4721
- ns as Z,
4722
- lt as _,
4723
- bt as a,
4724
- Na as a0,
4725
- qt as a1,
4726
- le as a2,
4727
- Ee as a3,
4728
- be as a4,
4729
- zt as b,
4730
- R as c,
4731
- re as d,
4732
- Pt as e,
4733
- Q as f,
4734
- ze as g,
4735
- ae as h,
4736
- Ue as i,
4737
- H as j,
4738
- Ht as k,
4739
- Ft as l,
4740
- Kt as m,
4741
- Dt as n,
4742
- vt as o,
4743
- V as p,
4744
- ct as q,
4745
- Le as r,
4746
- pt as s,
4747
- Z as t,
4748
- Ct as u,
4749
- at as v,
4750
- G as w,
4751
- Re as x,
4752
- qe as y,
4753
- mt as z
4817
+ cs as Z,
4818
+ ft as _,
4819
+ mt as a,
4820
+ qa as a0,
4821
+ Rt as a1,
4822
+ ne as a2,
4823
+ Be as a3,
4824
+ fe as a4,
4825
+ Vt as b,
4826
+ z as c,
4827
+ oe as d,
4828
+ Ct as e,
4829
+ st as f,
4830
+ Ve as g,
4831
+ ie as h,
4832
+ He as i,
4833
+ J as j,
4834
+ Gt as k,
4835
+ Bt as l,
4836
+ Ut as m,
4837
+ Et as n,
4838
+ yt as o,
4839
+ H as p,
4840
+ pt as q,
4841
+ Ne as r,
4842
+ dt as s,
4843
+ et as t,
4844
+ Ft as u,
4845
+ rt as v,
4846
+ U as w,
4847
+ ze as x,
4848
+ Re as y,
4849
+ $t as z
4754
4850
  };