@tempots/beatui 0.19.1 → 0.20.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (124) hide show
  1. package/dist/{2019-D0n7sHsB.js → 2019-B4Mw3glM.js} +2 -2
  2. package/dist/{2019-CfIF9XVA.cjs → 2019-u0Cs1ZdE.cjs} +1 -1
  3. package/dist/{2020-D1ziwonq.cjs → 2020-BcwEHv2O.cjs} +1 -1
  4. package/dist/{2020-BkXWq9F8.js → 2020-BvFyb4Gy.js} +2 -2
  5. package/dist/{ar-DYmDITuw.cjs → ar-DyhaQaJU.cjs} +1 -1
  6. package/dist/{ar-CMndb3tf.js → ar-RkpJ2n6w.js} +1 -1
  7. package/dist/auth/index.cjs.js +1 -1
  8. package/dist/auth/index.es.js +646 -651
  9. package/dist/beatui.css +1 -1
  10. package/dist/{de-Cgy7XJBg.js → de-BdSVR4Zm.js} +1 -1
  11. package/dist/{de-ClQgQrXM.cjs → de-CnZ4Ik2a.cjs} +1 -1
  12. package/dist/{es-j0qszDAW.js → es-B_Qn5EUy.js} +1 -1
  13. package/dist/{es-BN5Mihv0.cjs → es-ZKraCneL.cjs} +1 -1
  14. package/dist/{fa-BUQvM0nj.cjs → fa-D2p_ch4Q.cjs} +1 -1
  15. package/dist/{fa-COUp2ofv.js → fa-jBaLjqfG.js} +1 -1
  16. package/dist/{fr-B5Ar6QcE.js → fr-B0KaMM2j.js} +1 -1
  17. package/dist/{fr-CwvsJDIZ.cjs → fr-CBeo42lQ.cjs} +1 -1
  18. package/dist/{he-HZvvmFUB.cjs → he-BmqEF3o-.cjs} +1 -1
  19. package/dist/{he-D5HTHvKh.js → he-DjeYjcW7.js} +1 -1
  20. package/dist/{hi-Cnr1RtgA.cjs → hi-BAfIFl1n.cjs} +1 -1
  21. package/dist/{hi-Bcc7iEXp.js → hi-DxBQV0uz.js} +1 -1
  22. package/dist/index-4NoQLiJo.cjs +2 -0
  23. package/dist/{index-DSvEBuy-.cjs → index-9UO7Pd64.cjs} +1 -1
  24. package/dist/{index-tuwLQMCb.js → index-B001qopB.js} +3 -3
  25. package/dist/{index-ykojBEwT.js → index-BIUeLQJ1.js} +4 -4
  26. package/dist/{index-FEy4Hwnx.cjs → index-BInDdLXi.cjs} +1 -1
  27. package/dist/{index-BUKtbimR.cjs → index-BWiQR9j3.cjs} +1 -1
  28. package/dist/{index-Dben4dbo.js → index-BX_AooS9.js} +2 -2
  29. package/dist/{index-CRfUh74G.cjs → index-Blq-MoAk.cjs} +1 -1
  30. package/dist/{index-rWglN8IQ.js → index-BnaafQ9o.js} +1 -1
  31. package/dist/{index-BJfVmi_X.js → index-BnbEC2zq.js} +2 -2
  32. package/dist/{index-CHgx0rFt.js → index-C4jYy0NW.js} +2 -2
  33. package/dist/{index-B-d5blto.js → index-C4xio93t.js} +3 -3
  34. package/dist/{index-CFo2nnaI.js → index-C5l1mFuD.js} +2 -2
  35. package/dist/{index-BYk56bqR.cjs → index-CDYYXcsk.cjs} +2 -2
  36. package/dist/{index-CIfx_bs7.cjs → index-CJM_lW9n.cjs} +1 -1
  37. package/dist/{index-D0-d-xdJ.js → index-CaNnYmEs.js} +6 -6
  38. package/dist/{index-BZHMnjr6.cjs → index-CaOzAsWD.cjs} +1 -1
  39. package/dist/{index-BF4pXHo-.js → index-CdvplJG6.js} +4 -4
  40. package/dist/{index-CUs1c8a9.js → index-ClvbjqJL.js} +8 -8
  41. package/dist/{index-DgUJYXoy.cjs → index-CpB78PPQ.cjs} +1 -1
  42. package/dist/{index-B16dbwxM.cjs → index-CpKAa22o.cjs} +1 -1
  43. package/dist/{index-DJ-avKHU.js → index-CpMCZBAl.js} +2 -2
  44. package/dist/{index-2DKUYRWr.js → index-Cs_PxtnZ.js} +1 -1
  45. package/dist/{index-DxG_avr8.cjs → index-CvRJPSEv.cjs} +1 -1
  46. package/dist/{index-DD-MOsCa.js → index-D5nWhHZv.js} +2 -2
  47. package/dist/{index-Cohec4rB.cjs → index-D7o5LhMm.cjs} +1 -1
  48. package/dist/{index-DYIv5X6N.js → index-DC5Cn-TM.js} +2 -2
  49. package/dist/{index-CKRuo2DB.js → index-DCpnqWRN.js} +3 -3
  50. package/dist/{index-BirEb-BA.js → index-DOlgncMG.js} +2178 -2193
  51. package/dist/{index-kk6qFeC5.cjs → index-DOyppfix.cjs} +1 -1
  52. package/dist/{index-DjNMMz5-.cjs → index-DXUQTPON.cjs} +1 -1
  53. package/dist/{index-C9XAXTDx.cjs → index-DdlxwtnE.cjs} +1 -1
  54. package/dist/{index-_OaxQJX1.js → index-DhJIuRg9.js} +4 -4
  55. package/dist/{index-Bg1QLlyj.js → index-DiV6JJiS.js} +3 -3
  56. package/dist/{index-DD8_efWr.cjs → index-Dl-wY6fc.cjs} +1 -1
  57. package/dist/{index-BguvTLHu.cjs → index-DlaVE6S2.cjs} +1 -1
  58. package/dist/index-JHbFZFZF.cjs +8 -0
  59. package/dist/{index-dsitEt8M.cjs → index-Jt6D3QJ7.cjs} +1 -1
  60. package/dist/{index-85k3bgcY.cjs → index-KcBlGDqr.cjs} +1 -1
  61. package/dist/{index-dV4F3c70.js → index-MyVoESdk.js} +3 -3
  62. package/dist/{index-DC4nzG_w.js → index-NysVuvZA.js} +5 -5
  63. package/dist/{index-D-Rzl363.cjs → index-RGCDszX8.cjs} +1 -1
  64. package/dist/{index-CoBM7UvE.js → index-c-O5R5i2.js} +2 -2
  65. package/dist/{index-C4UzgyIA.cjs → index-cjtIcxwt.cjs} +1 -1
  66. package/dist/{index-faGepKVA.js → index-fnMeddEM.js} +2 -2
  67. package/dist/{index-DV7tB1MN.cjs → index-uR3OZ_8K.cjs} +1 -1
  68. package/dist/index.cjs.js +25 -25
  69. package/dist/index.es.js +2248 -2264
  70. package/dist/index.esm-DJRz9AE-.cjs +1 -0
  71. package/dist/{index.esm-CSotgpVw.js → index.esm-DPNh6inz.js} +410 -420
  72. package/dist/{it-CTCKFU5g.js → it-B4qZsicu.js} +1 -1
  73. package/dist/{it-B7KeOLBm.cjs → it-CzKrFTFY.cjs} +1 -1
  74. package/dist/{ja-BGoETTZv.js → ja-BnCSmhkg.js} +1 -1
  75. package/dist/{ja-0ldomgID.cjs → ja-i_9MZ1j0.cjs} +1 -1
  76. package/dist/json-schema/index.cjs.js +1 -1
  77. package/dist/json-schema/index.es.js +1 -1
  78. package/dist/{ko-C4WEkArz.cjs → ko-CF9il-Az.cjs} +1 -1
  79. package/dist/{ko-xHeRs9LU.js → ko-D_gGkjrC.js} +1 -1
  80. package/dist/milkdown/index.cjs.js +1 -1
  81. package/dist/milkdown/index.es.js +1 -1
  82. package/dist/{milkdown-input-BbbZJGDl.js → milkdown-input-CYme9OBn.js} +14757 -14822
  83. package/dist/milkdown-input-KjtVqDzi.cjs +941 -0
  84. package/dist/modal-B-f3LBKr.cjs +1 -0
  85. package/dist/modal-BItfEmu0.js +600 -0
  86. package/dist/monaco/index.cjs.js +2 -2
  87. package/dist/monaco/index.es.js +114 -116
  88. package/dist/{nl-ey2Li7DF.js → nl-CsLCWUFF.js} +1 -1
  89. package/dist/{nl-D-y231ZO.cjs → nl-DfWlqR6T.cjs} +1 -1
  90. package/dist/notice-B7JqE59s.cjs +1 -0
  91. package/dist/notice-CmmpobJd.js +2415 -0
  92. package/dist/{pl-Bf0QaCGx.js → pl-Bsmj1KbZ.js} +1 -1
  93. package/dist/{pl-G6e4Mybr.cjs → pl-wK2sgv7l.cjs} +1 -1
  94. package/dist/{pt-D-_KxA9g.js → pt-BR_NuRJS.js} +1 -1
  95. package/dist/{pt-CD2Eqazl.cjs → pt-DAQIuOPW.cjs} +1 -1
  96. package/dist/{ru-CKh2xgqC.cjs → ru-BnoiCxrw.cjs} +1 -1
  97. package/dist/{ru-Dzbl29K2.js → ru-CiQ_qKD_.js} +1 -1
  98. package/dist/timer-BdH4cK6a.cjs +1 -0
  99. package/dist/timer-CQlK5LhW.js +47 -0
  100. package/dist/{tr-BbpC5gzM.cjs → tr-Bme5PfaE.cjs} +1 -1
  101. package/dist/{tr-yMHT8n7z.js → tr-Q9xP1nE4.js} +1 -1
  102. package/dist/translations-ClgoCEFC.js +1969 -0
  103. package/dist/{translations-DbN-OSLv.js → translations-D4hFMU4P.js} +1 -1
  104. package/dist/translations-DRBh70w8.cjs +2 -0
  105. package/dist/{translations-CXE8Z_Ac.cjs → translations-lnK_6RdU.cjs} +1 -1
  106. package/dist/{ur-kkik6-_r.cjs → ur-B4b39hNV.cjs} +1 -1
  107. package/dist/{ur-CdQA0epV.js → ur-CGTjSoJt.js} +1 -1
  108. package/dist/{vi-A8UmZU3L.js → vi-BF3HTFU9.js} +1 -1
  109. package/dist/{vi-1xtFXJc0.cjs → vi-CSpW181L.cjs} +1 -1
  110. package/dist/{zh-D0nnvX8T.js → zh-BreM8U2w.js} +1 -1
  111. package/dist/{zh-DC_SsXdk.cjs → zh-PeL8FN2c.cjs} +1 -1
  112. package/package.json +5 -5
  113. package/dist/index-B66rNs5i.cjs +0 -2
  114. package/dist/index-DXFKCiah.cjs +0 -8
  115. package/dist/index.esm-8xolKogd.cjs +0 -1
  116. package/dist/milkdown-input-C-Muq7PQ.cjs +0 -941
  117. package/dist/modal-nbZW44XS.js +0 -614
  118. package/dist/modal-wbG_oGOr.cjs +0 -1
  119. package/dist/notice-CIPcSfD5.js +0 -2432
  120. package/dist/notice-Cq02YHoN.cjs +0 -1
  121. package/dist/timer-CcMCjYrq.cjs +0 -1
  122. package/dist/timer-CkgWORR9.js +0 -42
  123. package/dist/translations-DBtfTNnM.js +0 -2005
  124. package/dist/translations-EQ1qPZ0_.cjs +0 -2
@@ -0,0 +1,2415 @@
1
+ import { Use as R, Value as i, prop as K, html as $, attr as l, on as k, WithElement as ne, OnDispose as j, aria as O, bind as $e, computedOf as V, style as pe, When as E, NotEmpty as Ye, Fragment as L, ForEach as de, svg as De, svgAttr as be, Empty as D, emitValue as P, coalesce as Xe, Ensure as Ne, OneOfType as qe, Repeat as ze, signal as Ae, input as se, emitValueAsNullableDate as Ge, emitValueAsNullableDateTime as Qe, emitValueAsNumber as G, emit as Je, Task as Ke, Unless as et } from "@tempots/dom";
2
+ import { g as tt } from "./timer-CQlK5LhW.js";
3
+ import { ElementRect as Re, AutoSelect as nt } from "@tempots/ui";
4
+ import { B as W, e as H, f as st, C as me, I as N, g as Y, h as rt, i as at, j as Oe, k as ye, T as lt, E as ot, P as ct, S as te, s as it, L as ut, l as ft, G as fe, a as ge, n as ve, O as oe, o as Fe } from "./translations-ClgoCEFC.js";
5
+ const pt = (e) => Object.entries(e);
6
+ class dt extends Error {
7
+ constructor(t = "Missing implementation") {
8
+ super(t), this.name = "MissingImplementationError";
9
+ }
10
+ }
11
+ const cn = (e) => mt(e).split("_").join(" "), mt = (e) => (e = e.replace(/::/g, "/"), e = e.replace(/([A-Z]+)([A-Z][a-z])/g, "$1_$2"), e = e.replace(/([a-z\d])([A-Z])/g, "$1_$2"), e = e.replace(/-/g, "_"), e.toLowerCase()), un = (e) => e.substring(0, 1).toUpperCase() + e.substring(1), ht = (e) => {
12
+ if (typeof Buffer < "u")
13
+ return Buffer.from(e, "base64").toString("utf8");
14
+ if (typeof atob < "u")
15
+ return atob(e);
16
+ throw new dt(
17
+ "No implementation found for base64 decoding"
18
+ );
19
+ };
20
+ function Be({
21
+ onChange: e,
22
+ value: t,
23
+ accept: r = "*/*",
24
+ enableClick: n = !0,
25
+ content: s,
26
+ disabled: o = !1,
27
+ allowMultiple: a
28
+ }) {
29
+ return R(W, (u) => {
30
+ const c = i.deriveProp(t ?? []), p = K(!1), h = (b) => {
31
+ b.preventDefault(), b.stopPropagation(), p.value = !0;
32
+ }, d = (b) => {
33
+ b.preventDefault(), b.stopPropagation(), (!b.currentTarget || !b.currentTarget.contains(b.relatedTarget)) && (p.value = !1);
34
+ }, g = (b) => {
35
+ b.preventDefault(), b.stopPropagation(), p.value = !1;
36
+ const x = Array.from(b.dataTransfer?.files || []);
37
+ x.length > 0 && (c.value = x, e(x));
38
+ }, f = (b) => {
39
+ i.get(n) && b.currentTarget.querySelector(
40
+ 'input[type="file"]'
41
+ )?.click();
42
+ };
43
+ let m = null;
44
+ const w = () => {
45
+ if (m == null) return;
46
+ const b = Array.from(m.files ?? []);
47
+ b.length > 0 && (c.value = b, e(b)), m.value = "";
48
+ }, _ = (b) => {
49
+ i.get(n) && (b.key === "Enter" || b.key === " ") && (b.preventDefault(), f(b));
50
+ };
51
+ return $.div(
52
+ l.role("button"),
53
+ l.tabindex(
54
+ i.map(n, (b) => b ? 0 : -1)
55
+ ),
56
+ l.style("position: relative;"),
57
+ k.dragover(h),
58
+ k.dragleave(d),
59
+ k.drop(g),
60
+ k.click(f),
61
+ k.keydown(_),
62
+ // Hidden file input
63
+ $.input(
64
+ l.type("file"),
65
+ l.disabled(o),
66
+ l.accept(r),
67
+ l.multiple(a),
68
+ l.style(
69
+ "position: absolute; left: -9999px; opacity: 0; pointer-events: none;"
70
+ ),
71
+ k.change(w),
72
+ ne((b) => (m = b, j(
73
+ c.on((x) => {
74
+ const S = globalThis.DataTransfer;
75
+ if (S != null) {
76
+ const C = new S();
77
+ x.forEach((y) => C.items.add(y)), b.files = C.files;
78
+ }
79
+ })
80
+ )))
81
+ ),
82
+ // Screen reader instructions
83
+ O.label($e(u.$.dropZoneInstructions)(n)),
84
+ // Content
85
+ s({ files: c, clear: () => c.value = [], change: c.set })
86
+ );
87
+ });
88
+ }
89
+ function bt(e, t) {
90
+ return e.length === t.length && e.every((r, n) => r === t[n]);
91
+ }
92
+ function gt(e, t) {
93
+ const r = [
94
+ "bc-segmented-control",
95
+ `bu-text-${e}`,
96
+ `bc-segmented-control--${e}`
97
+ ];
98
+ return t && r.push("bc-segmented-control--disabled"), r.join(" ");
99
+ }
100
+ function fn({
101
+ options: e,
102
+ value: t,
103
+ onChange: r,
104
+ size: n = "md",
105
+ disabled: s = !1
106
+ }, ...o) {
107
+ const a = pt(e).map(([u, c]) => ({
108
+ key: u,
109
+ label: c
110
+ }));
111
+ return ne(() => {
112
+ const u = Object.fromEntries(
113
+ a.map((p, h) => [p.key, h])
114
+ ), c = K(
115
+ a.map(() => ({ left: 0, width: 0 })),
116
+ bt
117
+ );
118
+ return $.div(
119
+ l.class(
120
+ V(
121
+ n,
122
+ s
123
+ )(
124
+ (p, h) => gt(p ?? "md", h ?? !1)
125
+ )
126
+ ),
127
+ $.div(
128
+ l.class("bc-segmented-control__container"),
129
+ $.div(
130
+ l.class("bc-segmented-control__indicator"),
131
+ pe.width(
132
+ V(
133
+ t,
134
+ c
135
+ )((p, h) => {
136
+ const { width: d } = h[u[p] ?? 0];
137
+ return `${d}px`;
138
+ })
139
+ ),
140
+ pe.left(
141
+ V(
142
+ t,
143
+ c
144
+ )((p, h) => {
145
+ const { left: d } = h[u[p] ?? 0];
146
+ return `${d}px`;
147
+ })
148
+ )
149
+ ),
150
+ // clickable buttons
151
+ a.map(({ label: p, key: h }, d) => $.button(
152
+ k.click((g) => {
153
+ g.preventDefault(), i.get(s) || r?.(h);
154
+ }),
155
+ l.disabled(s),
156
+ l.class("bc-segmented-control__segment"),
157
+ l.class(
158
+ i.map(t, (g) => g === h ? "bc-segmented-control__segment--active" : "bc-segmented-control__segment--inactive")
159
+ ),
160
+ Re((g) => {
161
+ function f() {
162
+ c.update((w) => {
163
+ const _ = [...w];
164
+ return _[d] = {
165
+ width: g.value.width,
166
+ left: g.value.localLeft
167
+ }, _;
168
+ });
169
+ }
170
+ const m = tt(f);
171
+ return j(m, g.on(f));
172
+ }),
173
+ p
174
+ ))
175
+ ),
176
+ ...o
177
+ );
178
+ });
179
+ }
180
+ function vt(e) {
181
+ const t = e.type.toLowerCase();
182
+ return t.startsWith("image/") && (t.includes("jpeg") || t.includes("jpg") || t.includes("png") || t.includes("gif") || t.includes("webp") || t.includes("svg"));
183
+ }
184
+ function xt(e) {
185
+ const t = e.type.toLowerCase();
186
+ return t.startsWith("image/") ? "vscode-icons:file-type-image" : t.startsWith("video/") ? "vscode-icons:file-type-video" : t.startsWith("audio/") ? "vscode-icons:file-type-audio" : t.includes("pdf") ? "vscode-icons:file-type-pdf2" : t.includes("word") || t.includes("document") ? "vscode-icons:file-type-word" : t.includes("excel") || t.includes("spreadsheet") ? "vscode-icons:file-type-excel" : t.includes("powerpoint") || t.includes("presentation") ? "vscode-icons:file-type-powerpoint" : t.includes("zip") || t.includes("archive") ? "vscode-icons:file-type-zip" : t.includes("text") ? "vscode-icons:file-type-text" : t.includes("json") ? "vscode-icons:file-type-json-official" : t.includes("csv") ? "vscode-icons:file-type-csv" : t.includes("xml") ? "vscode-icons:file-type-xml" : t.includes("yaml") ? "vscode-icons:file-type-yaml-official" : "vscode-icons:file-type-binary";
187
+ }
188
+ function Ve(e) {
189
+ return E(
190
+ e.map(vt),
191
+ () => {
192
+ const t = K(null);
193
+ return e.on((r) => {
194
+ t.value && URL.revokeObjectURL(t.value);
195
+ const n = URL.createObjectURL(r);
196
+ t.value = n;
197
+ }), $.div(
198
+ l.class("bc-file-input__thumbnail-container"),
199
+ $.img(
200
+ l.src(t),
201
+ l.alt(e.map((r) => r.name)),
202
+ l.class("bc-file-input__thumbnail"),
203
+ j(() => {
204
+ t.value && URL.revokeObjectURL(t.value);
205
+ })
206
+ )
207
+ );
208
+ },
209
+ () => N({ icon: e.map(xt) })
210
+ );
211
+ }
212
+ const wt = (e, ...t) => {
213
+ const {
214
+ value: r = K([]),
215
+ accept: n = "*/*",
216
+ maxFiles: s,
217
+ maxFileSize: o,
218
+ onChange: a,
219
+ onBlur: u,
220
+ disabled: c,
221
+ hasError: p,
222
+ mode: h = "default",
223
+ showFileList: d = !0,
224
+ ...g
225
+ } = e, f = r, m = i.map(h, (C) => C === "compact"), w = (C) => {
226
+ let y = C;
227
+ if (s != null) {
228
+ const v = i.get(s);
229
+ y = y.slice(0, v);
230
+ }
231
+ if (o) {
232
+ const v = i.get(o);
233
+ y = y.filter((I) => I.size <= v);
234
+ }
235
+ a?.(y);
236
+ }, _ = (C) => {
237
+ const v = f.value.filter((I, M) => M !== C);
238
+ a?.(v);
239
+ }, b = () => {
240
+ a?.([]);
241
+ }, x = ({
242
+ files: C,
243
+ clear: y,
244
+ change: v
245
+ }) => R(
246
+ W,
247
+ (I) => $.div(
248
+ l.class("bc-file-input__drop-zone"),
249
+ $.div(
250
+ l.class(
251
+ "bc-file-input__drop-zone-content bc-file-input__drop-zone-content--empty"
252
+ ),
253
+ N({ icon: "mdi:cloud-upload-outline", size: "xl" }),
254
+ $.div(
255
+ l.class("bc-file-input__drop-zone-text"),
256
+ $e(I.$.filesInputInstructions)(
257
+ s,
258
+ o,
259
+ I.$.fileSizeUnits.value
260
+ )
261
+ )
262
+ )
263
+ )
264
+ ), S = ({
265
+ files: C
266
+ }) => R(
267
+ W,
268
+ (y) => $.div(
269
+ l.class("bc-file-input__compact-input"),
270
+ E(
271
+ C.map((v) => v.length > 0),
272
+ () => $.span(
273
+ l.class("bc-file-input__compact-value"),
274
+ de(
275
+ C,
276
+ (v) => $.span(
277
+ l.class("bc-file-input__compact-value-item"),
278
+ Ve(v),
279
+ $.span(
280
+ l.class("bc-file-input__compact-value-item-name"),
281
+ v.$.name
282
+ )
283
+ )
284
+ )
285
+ ),
286
+ () => $.span(
287
+ l.class("bc-file-input__compact-placeholder"),
288
+ N({ icon: "mdi:cloud-upload-outline", size: "sm" }),
289
+ " ",
290
+ $e(y.$.filesInputInstructions)(
291
+ s,
292
+ o,
293
+ y.$.fileSizeUnits.value
294
+ )
295
+ )
296
+ )
297
+ )
298
+ );
299
+ return R(
300
+ W,
301
+ (C) => H(
302
+ {
303
+ baseContainer: i.map(m, (y) => !y),
304
+ disabled: c,
305
+ hasError: p,
306
+ after: E(
307
+ m,
308
+ () => E(
309
+ f.map(({ length: y }) => y > 0),
310
+ () => me(
311
+ {
312
+ size: "sm",
313
+ label: C.$.clearAllFiles,
314
+ disabled: c,
315
+ onClick: b
316
+ },
317
+ l.class("bc-file-input__compact-clear")
318
+ )
319
+ )
320
+ ),
321
+ ...g,
322
+ input: E(
323
+ m,
324
+ () => $.div(
325
+ l.class("bc-file-input bc-file-input--compact"),
326
+ Be({
327
+ value: f,
328
+ accept: n,
329
+ enableClick: !0,
330
+ allowMultiple: i.map(s ?? 1 / 0, (y) => y > 1),
331
+ disabled: c,
332
+ onChange: w,
333
+ content: S
334
+ })
335
+ ),
336
+ () => $.div(
337
+ l.class("bc-file-input"),
338
+ Be({
339
+ value: f,
340
+ accept: n,
341
+ enableClick: !0,
342
+ allowMultiple: i.map(s ?? 1 / 0, (y) => y > 1),
343
+ disabled: c,
344
+ onChange: w,
345
+ content: x
346
+ }),
347
+ E(
348
+ d,
349
+ () => Ye(
350
+ f,
351
+ () => L(
352
+ $.div(
353
+ l.class("bc-file-input__file-list"),
354
+ de(f, (y, v) => {
355
+ const I = v.index;
356
+ return $.div(
357
+ l.class("bc-file-input__file-item"),
358
+ $.div(
359
+ l.class("bc-file-input__file-icon"),
360
+ Ve(y)
361
+ ),
362
+ $.div(
363
+ l.class("bc-file-input__file-info"),
364
+ $.div(
365
+ l.class("bc-file-input__file-name"),
366
+ l.title(y.$.name),
367
+ y.$.name
368
+ ),
369
+ $.div(
370
+ l.class("bc-file-input__file-meta"),
371
+ V(
372
+ y.$.size,
373
+ C.$.fileSizeUnits
374
+ )(
375
+ (M, A) => st(M, { units: A })
376
+ ),
377
+ " • ",
378
+ V(
379
+ y.$.type,
380
+ C.$.unknownType
381
+ )((M, A) => M || A)
382
+ )
383
+ ),
384
+ me(
385
+ {
386
+ size: "sm",
387
+ label: C.$.removeFile,
388
+ disabled: c,
389
+ onClick: () => _(I)
390
+ },
391
+ l.class("bc-file-input__remove-button")
392
+ )
393
+ );
394
+ })
395
+ ),
396
+ E(
397
+ f.map(({ length: y }) => y > 1),
398
+ () => $.div(
399
+ l.class(
400
+ "bc-file-input__clear-all-button-container"
401
+ ),
402
+ $.button(
403
+ l.type("button"),
404
+ l.class("bc-file-input__clear-all-button"),
405
+ l.disabled(c),
406
+ C.$.clearAllFiles,
407
+ k.click((y) => {
408
+ y.preventDefault(), y.stopPropagation(), b();
409
+ })
410
+ )
411
+ )
412
+ )
413
+ )
414
+ )
415
+ )
416
+ )
417
+ )
418
+ },
419
+ ...t
420
+ )
421
+ );
422
+ };
423
+ async function _t(e) {
424
+ return new Promise((t, r) => {
425
+ const n = new FileReader();
426
+ n.readAsDataURL(e), n.onload = () => {
427
+ const s = n.result;
428
+ t(s.split(",")[1]);
429
+ }, n.onerror = (s) => r(s);
430
+ });
431
+ }
432
+ function $t(e) {
433
+ return Promise.all(e.map(_t));
434
+ }
435
+ function yt(e) {
436
+ if (e.length >= 4) {
437
+ if (e[0] === 137 && e[1] === 80 && e[2] === 78 && e[3] === 71)
438
+ return "image/png";
439
+ if (e[0] === 255 && e[1] === 216) return "image/jpeg";
440
+ if (e[0] === 71 && e[1] === 73 && e[2] === 70)
441
+ return "image/gif";
442
+ if (e[0] === 82 && e[1] === 73 && e[2] === 70 && e[3] === 70 && e.length >= 12 && e[8] === 87 && e[9] === 69 && e[10] === 66 && e[11] === 80)
443
+ return "image/webp";
444
+ }
445
+ try {
446
+ if (new TextDecoder("utf-8").decode(e.slice(0, 256)).includes("<svg")) return "image/svg+xml";
447
+ } catch {
448
+ }
449
+ return "application/octet-stream";
450
+ }
451
+ function It(e) {
452
+ const t = ht(e ?? ""), r = t.length, n = new Uint8Array(r);
453
+ for (let s = 0; s < r; s++) n[s] = t.charCodeAt(s);
454
+ return n;
455
+ }
456
+ function Ct(e) {
457
+ const {
458
+ value: t,
459
+ onChange: r,
460
+ onInput: n,
461
+ ...s
462
+ } = e, o = /* @__PURE__ */ new Map(), a = i.toSignal(t).map((h) => h.map((d, g) => {
463
+ const f = o.get(d), m = It(d ?? ""), w = f?.type || yt(m), _ = f?.name ?? `file-${g}`, b = m.buffer.slice(
464
+ m.byteOffset,
465
+ m.byteOffset + m.byteLength
466
+ ), x = new Blob([b], { type: w });
467
+ return new File([x], _, { type: w });
468
+ })), u = (h) => (d) => {
469
+ h && $t(d).then((g) => {
470
+ for (const [f, m] of g.entries())
471
+ o.set(m, { name: d[f].name, type: d[f].type });
472
+ h(g);
473
+ });
474
+ }, c = u(r), p = u(n);
475
+ return wt({
476
+ ...s,
477
+ value: a,
478
+ onChange: c,
479
+ onInput: p
480
+ });
481
+ }
482
+ function pn(e) {
483
+ const {
484
+ value: t,
485
+ onInput: r,
486
+ onChange: n,
487
+ ...s
488
+ } = e;
489
+ return Ct({
490
+ ...s,
491
+ maxFiles: 1,
492
+ value: i.map(t, (o) => o == null ? [] : [o]),
493
+ onChange: (o) => {
494
+ n?.(o[0]);
495
+ },
496
+ onInput: (o) => {
497
+ r?.(o[0]);
498
+ }
499
+ });
500
+ }
501
+ function Ie(e) {
502
+ const t = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);
503
+ return t ? [parseInt(t[1], 16), parseInt(t[2], 16), parseInt(t[3], 16)] : [0, 0, 0];
504
+ }
505
+ function Ce(e, t, r) {
506
+ const n = (s) => s.toString(16).padStart(2, "0");
507
+ return `#${n(Math.max(0, Math.min(255, e)))}${n(
508
+ Math.max(0, Math.min(255, t))
509
+ )}${n(Math.max(0, Math.min(255, r)))}`;
510
+ }
511
+ function kt(e) {
512
+ if (!e) return [0, 0, 0, 1];
513
+ const r = e.trim().match(
514
+ /^#?([a-fA-F0-9]{3,4}|[a-fA-F0-9]{6}|[a-fA-F0-9]{8})$/
515
+ );
516
+ if (r) {
517
+ const d = r[1];
518
+ if (d.length === 8) {
519
+ const g = parseInt(d.slice(0, 2), 16), f = parseInt(d.slice(2, 4), 16), m = parseInt(d.slice(4, 6), 16), w = parseInt(d.slice(6, 8), 16) / 255;
520
+ return [g, f, m, w];
521
+ }
522
+ if (d.length === 6)
523
+ return [
524
+ parseInt(d.slice(0, 2), 16),
525
+ parseInt(d.slice(2, 4), 16),
526
+ parseInt(d.slice(4, 6), 16),
527
+ 1
528
+ ];
529
+ if (d.length === 4) {
530
+ const g = parseInt(d[0] + d[0], 16), f = parseInt(d[1] + d[1], 16), m = parseInt(d[2] + d[2], 16), w = parseInt(d[3] + d[3], 16) / 255;
531
+ return [g, f, m, w];
532
+ }
533
+ if (d.length === 3) {
534
+ const g = parseInt(d[0] + d[0], 16), f = parseInt(d[1] + d[1], 16), m = parseInt(d[2] + d[2], 16);
535
+ return [g, f, m, 1];
536
+ }
537
+ }
538
+ const n = e.match(
539
+ /^rgba\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(0|1|0?\.\d+)\s*\)$/i
540
+ );
541
+ if (n)
542
+ return [
543
+ parseInt(n[1], 10),
544
+ parseInt(n[2], 10),
545
+ parseInt(n[3], 10),
546
+ parseFloat(n[4])
547
+ ];
548
+ const s = e.match(
549
+ /^rgb\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*\)$/i
550
+ );
551
+ if (s)
552
+ return [parseInt(s[1], 10), parseInt(s[2], 10), parseInt(s[3], 10), 1];
553
+ const o = e.match(
554
+ /^hsla?\(\s*([+-]?[\d.]+)(?:deg)?\s*[ ,]?\s*([\d.]+)%\s*[ ,]?\s*([\d.]+)%\s*(?:[/,]\s*(\d?(?:\.\d+)?))?\s*\)$/i
555
+ );
556
+ if (o) {
557
+ const d = parseFloat(o[1]), g = parseFloat(o[2]), f = parseFloat(o[3]), m = o[4] != null ? parseFloat(o[4]) : 1, [w, _, b] = Pe(d, g / 100, f / 100);
558
+ return [w, _, b, m];
559
+ }
560
+ const a = e.match(
561
+ /^hwb\(\s*([+-]?[\d.]+)(?:deg)?\s*[, ]\s*([\d.]+)%\s*[, ]\s*([\d.]+)%\s*(?:[/]\s*(\d?(?:\.\d+)?))?\s*\)$/i
562
+ );
563
+ if (a) {
564
+ const d = parseFloat(a[1]), g = parseFloat(a[2]) / 100, f = parseFloat(a[3]) / 100, m = a[4] != null ? parseFloat(a[4]) : 1, [w, _, b] = Tt(d, g, f);
565
+ return [w, _, b, m];
566
+ }
567
+ const u = e.match(
568
+ /^oklch\(\s*([+-]?[\d.]+%?)\s+([\d.]+)\s+([+-]?[\d.]+)(?:deg)?(?:\s*\/\s*(\d?(?:\.\d+)?))?\s*\)$/i
569
+ );
570
+ if (u) {
571
+ const d = u[1], g = parseFloat(u[2]), f = parseFloat(u[3]), m = u[4] != null ? parseFloat(u[4]) : 1, w = d.endsWith("%") ? Math.max(0, Math.min(1, parseFloat(d) / 100)) : Math.max(0, Math.min(1, parseFloat(d))), [_, b, x] = At(w, g, f);
572
+ return [_, b, x, m];
573
+ }
574
+ const [c, p, h] = Ie(e);
575
+ return [c, p, h, 1];
576
+ }
577
+ const Mt = (e, t, r, n) => `rgba(${Math.round(e)}, ${Math.round(t)}, ${Math.round(r)}, ${Math.max(
578
+ 0,
579
+ Math.min(1, Math.round(n * 100) / 100)
580
+ )})`;
581
+ function St(e) {
582
+ let t = e + 1831565813;
583
+ return function() {
584
+ return t = Math.imul(t ^ t >>> 15, t | 1), t ^= t + Math.imul(t ^ t >>> 7, t | 61), ((t ^ t >>> 14) >>> 0) / 4294967296;
585
+ };
586
+ }
587
+ function Pe(e, t, r) {
588
+ e = (e % 360 + 360) % 360;
589
+ const n = (1 - Math.abs(2 * r - 1)) * t, s = n * (1 - Math.abs(e / 60 % 2 - 1)), o = r - n / 2;
590
+ let a = 0, u = 0, c = 0;
591
+ return 0 <= e && e < 60 ? [a, u, c] = [n, s, 0] : 60 <= e && e < 120 ? [a, u, c] = [s, n, 0] : 120 <= e && e < 180 ? [a, u, c] = [0, n, s] : 180 <= e && e < 240 ? [a, u, c] = [0, s, n] : 240 <= e && e < 300 ? [a, u, c] = [s, 0, n] : [a, u, c] = [n, 0, s], [
592
+ Math.round((a + o) * 255),
593
+ Math.round((u + o) * 255),
594
+ Math.round((c + o) * 255)
595
+ ];
596
+ }
597
+ function Tt(e, t, r) {
598
+ e = (e % 360 + 360) % 360;
599
+ const n = t + r;
600
+ n > 1 && (t /= n, r /= n);
601
+ const [s, o, a] = Pe(e, 1, 0.5).map((d) => d / 255), u = 1 - t - r, c = s * u + t, p = o * u + t, h = a * u + t;
602
+ return [Math.round(c * 255), Math.round(p * 255), Math.round(h * 255)];
603
+ }
604
+ function ke(e, t, r) {
605
+ e /= 255, t /= 255, r /= 255;
606
+ const n = Math.max(e, t, r), s = Math.min(e, t, r);
607
+ let o = 0, a = 0;
608
+ const u = (n + s) / 2, c = n - s;
609
+ if (c !== 0) {
610
+ switch (a = u > 0.5 ? c / (2 - n - s) : c / (n + s), n) {
611
+ case e:
612
+ o = (t - r) / c + (t < r ? 6 : 0);
613
+ break;
614
+ case t:
615
+ o = (r - e) / c + 2;
616
+ break;
617
+ default:
618
+ o = (e - t) / c + 4;
619
+ }
620
+ o *= 60;
621
+ }
622
+ return [Math.round(o), Math.round(a * 100), Math.round(u * 100)];
623
+ }
624
+ function Dt(e, t, r) {
625
+ const [n] = ke(e, t, r), s = e / 255, o = t / 255, a = r / 255, u = Math.min(s, o, a), c = 1 - Math.max(s, o, a);
626
+ return [n, Math.round(u * 100), Math.round(c * 100)];
627
+ }
628
+ function xe(e) {
629
+ const t = e / 255;
630
+ return t <= 0.04045 ? t / 12.92 : Math.pow((t + 0.055) / 1.055, 2.4);
631
+ }
632
+ function we(e) {
633
+ const t = e <= 31308e-7 ? 12.92 * e : 1.055 * Math.pow(e, 0.4166666666666667) - 0.055;
634
+ return Math.round(Math.max(0, Math.min(1, t)) * 255);
635
+ }
636
+ function At(e, t, r) {
637
+ const n = r * Math.PI / 180, s = Math.cos(n) * t, o = Math.sin(n) * t, a = e + 0.3963377774 * s + 0.2158037573 * o, u = e - 0.1055613458 * s - 0.0638541728 * o, c = e - 0.0894841775 * s - 1.291485548 * o, p = a * a * a, h = u * u * u, d = c * c * c, g = 4.0767416621 * p - 3.3077115913 * h + 0.2309699292 * d, f = -1.2684380046 * p + 2.6097574011 * h - 0.3413193965 * d, m = -0.0041960863 * p - 0.7034186147 * h + 1.707614701 * d;
638
+ return [we(g), we(f), we(m)];
639
+ }
640
+ function Ft(e, t, r) {
641
+ const n = xe(e), s = xe(t), o = xe(r), a = 0.4122214708 * n + 0.5363325363 * s + 0.0514459929 * o, u = 0.2119034982 * n + 0.6806995451 * s + 0.1073969566 * o, c = 0.0883024619 * n + 0.2817188376 * s + 0.6299787005 * o, p = Math.cbrt(a), h = Math.cbrt(u), d = Math.cbrt(c), g = 0.2104542553 * p + 0.793617785 * h - 0.0040720468 * d, f = 1.9779984951 * p - 2.428592205 * h + 0.4505937099 * d, m = 0.0259040371 * p + 0.7827717662 * h - 0.808675766 * d, w = Math.sqrt(f * f + m * m);
642
+ let _ = Math.atan2(m, f) * 180 / Math.PI;
643
+ return _ < 0 && (_ += 360), [g, w, _];
644
+ }
645
+ function ce(e, t, r, n, s, o) {
646
+ switch (s) {
647
+ case "hex":
648
+ if (o) {
649
+ const a = (c) => c.toString(16).padStart(2, "0"), u = Math.max(0, Math.min(255, Math.round(n * 255)));
650
+ return `#${a(e)}${a(t)}${a(r)}${a(u)}`;
651
+ }
652
+ return Ce(e, t, r);
653
+ case "rgb":
654
+ return `rgb(${e}, ${t}, ${r})`;
655
+ case "rgba":
656
+ return `rgba(${e}, ${t}, ${r}, ${Math.round(n * 100) / 100})`;
657
+ case "hsl": {
658
+ const [a, u, c] = ke(e, t, r);
659
+ return `hsl(${a}, ${u}%, ${c}%)`;
660
+ }
661
+ case "hsla": {
662
+ const [a, u, c] = ke(e, t, r);
663
+ return `hsla(${a}, ${u}%, ${c}%, ${Math.round(n * 100) / 100})`;
664
+ }
665
+ case "hwb": {
666
+ const [a, u, c] = Dt(e, t, r);
667
+ return n < 1 ? `hwb(${a} ${u}% ${c}% / ${Math.round(n * 100) / 100})` : `hwb(${a} ${u}% ${c}%)`;
668
+ }
669
+ case "oklch": {
670
+ const [a, u, c] = Ft(e, t, r), p = (Math.round(a * 1e3) / 1e3).toFixed(3), h = (Math.round(u * 1e3) / 1e3).toFixed(3), d = (Math.round(c * 10) / 10).toFixed(1), g = Math.round(n * 100) / 100;
671
+ return o || n < 1 ? `oklch(${p} ${h} ${d} / ${g})` : `oklch(${p} ${h} ${d})`;
672
+ }
673
+ }
674
+ }
675
+ function ie(e, t) {
676
+ return t ? e === "rgb" ? "rgba" : e === "hsl" ? "hsla" : e : e === "rgba" ? "rgb" : e === "hsla" ? "hsl" : e;
677
+ }
678
+ function Bt(e, t) {
679
+ const [r, n, s] = e, o = r << 16 ^ n << 8 ^ s, a = St(o), u = 6 + Math.floor(a() * 5), c = 0.18 + a() * 0.06, p = [];
680
+ for (let f = 0; f < u; f++) {
681
+ const m = f / u * Math.PI * 2, w = t * (1 + (a() * 2 - 1) * c), _ = Math.cos(m) * w, b = Math.sin(m) * w;
682
+ p.push({ x: _, y: b });
683
+ }
684
+ const h = (p[0].x + p[u - 1].x) / 2, d = (p[0].y + p[u - 1].y) / 2;
685
+ let g = `M ${h.toFixed(3)} ${d.toFixed(3)}`;
686
+ for (let f = 0; f < u; f++) {
687
+ const m = p[f], w = p[(f + 1) % u], _ = (m.x + w.x) / 2, b = (m.y + w.y) / 2;
688
+ g += ` Q ${m.x.toFixed(3)} ${m.y.toFixed(3)} ${_.toFixed(3)} ${b.toFixed(3)}`;
689
+ }
690
+ return g += " Z", g;
691
+ }
692
+ const dn = (e) => {
693
+ const { value: t, onBlur: r, onChange: n, onInput: s, displayValue: o, size: a, withAlpha: u } = e, c = i.map(a ?? 32, (v) => v), p = i.map(t, (v) => kt(v ?? "#000000")), h = i.map(
694
+ p,
695
+ ([v, I, M]) => [v, I, M]
696
+ ), d = i.map(p, ([, , , v]) => v), g = K(i.get(d) ?? 1), f = i.map(u ?? !1, (v) => v), m = i.map(
697
+ e.colorTextFormat ?? "rgb",
698
+ (v) => v
699
+ ), w = V(
700
+ h,
701
+ g,
702
+ m,
703
+ f
704
+ )(
705
+ ([v, I, M], A, F, T) => ce(v, I, M, A ?? 1, ie(F, T), T)
706
+ ), _ = i.map(
707
+ e.colorTextFormat ?? "hex",
708
+ (v) => v
709
+ ), b = i.map(c, (v) => `-${v / 2} -${v / 2} ${v} ${v}`), x = V(
710
+ h,
711
+ c
712
+ )((v, I) => Bt(v, I / 2)), S = V(
713
+ h,
714
+ g,
715
+ f
716
+ )(
717
+ ([v, I, M], A, F) => F || A < 1 ? Mt(v, I, M, A) : Ce(v, I, M)
718
+ ), C = $.div(
719
+ l.class("bc-color-input__control"),
720
+ l.class(
721
+ i.map(
722
+ f,
723
+ (v) => v ? "bc-color-input__control--alpha" : ""
724
+ )
725
+ ),
726
+ l.style(V(c)((v) => `width:${v}px;height:${v}px`)),
727
+ // The SVG blob preview
728
+ De.svg(
729
+ l.class("bc-color-input__svg"),
730
+ be.viewBox(b),
731
+ De.path(be.d(x), be.fill(S))
732
+ ),
733
+ // Invisible native input overlays the blob for picker and accessibility
734
+ $.input(
735
+ l.type("color"),
736
+ Y(e),
737
+ // Native color input needs hex without alpha
738
+ l.value(i.map(h, ([v, I, M]) => Ce(v, I, M))),
739
+ l.class("bc-input bc-color-input bc-color-input__native"),
740
+ r != null ? k.blur(r) : D,
741
+ n != null ? k.change((v) => {
742
+ const I = v.target.value;
743
+ if (!n) return;
744
+ const [M, A, F] = Ie(I), T = i.get(g) ?? 1, B = ie(
745
+ i.get(_),
746
+ i.get(f)
747
+ ), z = ce(M, A, F, T, B, i.get(f));
748
+ n(z);
749
+ }) : D,
750
+ s != null ? k.input((v) => {
751
+ const I = v.target.value;
752
+ if (!s) return;
753
+ const [M, A, F] = Ie(I), T = i.get(g) ?? 1, B = ie(
754
+ i.get(_),
755
+ i.get(f)
756
+ ), z = ce(M, A, F, T, B, i.get(f));
757
+ s(z);
758
+ }) : D
759
+ )
760
+ ), y = E(
761
+ f,
762
+ () => $.input(
763
+ l.type("range"),
764
+ l.class("bc-color-input__alpha"),
765
+ l.min(0),
766
+ l.max(1),
767
+ l.step(0.01),
768
+ l.value(i.map(g, (v) => String(v ?? 1))),
769
+ l.disabled(e.disabled),
770
+ k.input((v) => {
771
+ const I = parseFloat(v.target.value);
772
+ g.set(I);
773
+ const [M, A, F] = i.get(h), T = ie(
774
+ i.get(_),
775
+ i.get(f)
776
+ ), B = ce(M, A, F, I, T, i.get(f));
777
+ s?.(B);
778
+ }),
779
+ k.change((v) => {
780
+ const I = parseFloat(v.target.value);
781
+ g.set(I);
782
+ const [M, A, F] = i.get(h), T = ie(
783
+ i.get(_),
784
+ i.get(f)
785
+ ), B = ce(M, A, F, I, T, i.get(f));
786
+ n?.(B);
787
+ })
788
+ )
789
+ );
790
+ return H({
791
+ baseContainer: !0,
792
+ ...e,
793
+ // ensure our control does not try to grow
794
+ growInput: !1,
795
+ input: C,
796
+ // If caller provided an `after`, append RGB before it
797
+ after: L(
798
+ E(
799
+ o ?? !1,
800
+ () => $.span(l.class("bc-color-input__rgb"), w)
801
+ ),
802
+ y,
803
+ e.after
804
+ )
805
+ });
806
+ }, Me = "$$tts-exp-", Vt = (e, t) => ne((r) => {
807
+ const n = `${Me}${e}`;
808
+ return j(i.on(t, (s) => Reflect.set(r, n, s)));
809
+ }), mn = (e, t) => {
810
+ const r = `${Me}${e}`;
811
+ return (n) => {
812
+ t(Reflect.get(n.target, r));
813
+ };
814
+ }, Lt = (e, t) => {
815
+ const r = `${Me}${e}`;
816
+ return (n) => {
817
+ const s = n.target, o = s.selectedIndex, a = s.options[o];
818
+ t(Reflect.get(a, r));
819
+ };
820
+ };
821
+ function Et(e, t, r) {
822
+ const n = ["bc-card"];
823
+ return e !== "default" && n.push(`bc-card--${e}`), t !== "md" && n.push(`bc-card--padding-${t}`), r !== "lg" && n.push(`bc-card--rounded-${r}`), n.join(" ");
824
+ }
825
+ function hn({ variant: e = "default", size: t = "md", roundedness: r = "lg" } = {}, ...n) {
826
+ return $.div(
827
+ l.class(
828
+ V(
829
+ e,
830
+ t,
831
+ r
832
+ )(
833
+ (s, o, a) => Et(
834
+ s ?? "default",
835
+ o ?? "md",
836
+ a ?? "lg"
837
+ )
838
+ )
839
+ ),
840
+ ...n
841
+ );
842
+ }
843
+ const bn = ({
844
+ startEditing: e,
845
+ value: t,
846
+ onChange: r,
847
+ placeholder: n,
848
+ disabled: s
849
+ }) => {
850
+ const o = i.deriveProp(e ?? !1), a = K(!1), u = i.map(s ?? !1, (c) => c);
851
+ return $.div(
852
+ l.class("bc-editable-text"),
853
+ l.class(
854
+ i.map(
855
+ u,
856
+ (c) => c ? "bc-editable-text--disabled" : ""
857
+ )
858
+ ),
859
+ O.disabled(u),
860
+ E(
861
+ o,
862
+ () => $.input(
863
+ l.placeholder(n),
864
+ l.value(t),
865
+ l.class("bc-editable-text__input"),
866
+ nt(),
867
+ k.keydown((c) => {
868
+ c.key === "Enter" ? o.set(!1) : c.key === "Escape" && (a.set(!0), o.set(!1));
869
+ }),
870
+ k.blur(
871
+ P((c) => {
872
+ if (o.set(!1), a.value) {
873
+ a.set(!1);
874
+ return;
875
+ }
876
+ r(c);
877
+ })
878
+ )
879
+ ),
880
+ () => $.span(
881
+ k.click(() => {
882
+ i.get(u) || o.set(!0);
883
+ }),
884
+ l.class("bc-editable-text__display"),
885
+ E(
886
+ i.map(t, (c) => c != null && c.trim() !== ""),
887
+ () => $.span(l.class("bc-editable-text__text"), t),
888
+ () => $.span(
889
+ l.class("bc-editable-text__placeholder"),
890
+ n
891
+ )
892
+ ),
893
+ E(
894
+ i.map(u, (c) => !c),
895
+ () => $.button(
896
+ l.class("bc-editable-text__edit-button"),
897
+ R(W, (c) => O.label(c.$.editLabel)),
898
+ k.click(() => o.set(!0)),
899
+ N({ icon: "line-md/pencil", color: "neutral" })
900
+ )
901
+ )
902
+ )
903
+ )
904
+ );
905
+ }, je = (e, t, r) => Ne(
906
+ e,
907
+ (n) => qe(n, {
908
+ value: (s) => {
909
+ const o = V(
910
+ s,
911
+ r
912
+ )((a, u) => t(a.value, u));
913
+ return $.option(
914
+ j(o.dispose),
915
+ l.selected(o),
916
+ Vt("value", s.$.value),
917
+ s.$.label
918
+ );
919
+ },
920
+ group: (s) => $.optgroup(
921
+ l.label(s.$.group),
922
+ de(
923
+ s.$.options,
924
+ (o) => je(
925
+ o,
926
+ t,
927
+ r
928
+ )
929
+ )
930
+ ),
931
+ break: () => $.hr()
932
+ })
933
+ ), Ut = (e) => {
934
+ const {
935
+ value: t,
936
+ onBlur: r,
937
+ onChange: n,
938
+ options: s,
939
+ unselectedLabel: o,
940
+ equality: a = (p, h) => p === h,
941
+ after: u
942
+ } = e;
943
+ let c;
944
+ return H(
945
+ {
946
+ ...e,
947
+ after: L(
948
+ N({
949
+ icon: "ph:caret-down-bold",
950
+ color: "neutral",
951
+ size: "sm"
952
+ }),
953
+ u
954
+ ),
955
+ input: $.select(
956
+ ne((p) => {
957
+ c = p;
958
+ const h = new MutationObserver((d) => {
959
+ const { removedNodes: g } = d[0];
960
+ g.length > 0 && (c.selectedIndex = 0);
961
+ });
962
+ return h.observe(p, { childList: !0 }), j(() => h.disconnect());
963
+ }),
964
+ Y(e),
965
+ l.class("bc-native-select bc-input bu-w-full"),
966
+ R(
967
+ W,
968
+ (p) => $.option(
969
+ l.hidden("hidden"),
970
+ Xe(o, p.$.selectOne)
971
+ )
972
+ ),
973
+ de(s, (p) => je(p, a, t)),
974
+ r != null ? k.blur(r) : D,
975
+ n != null ? k.change(Lt("value", (p) => n(p))) : D
976
+ )
977
+ },
978
+ k.click(() => {
979
+ c?.focus(), typeof c?.showPicker == "function" && c.showPicker();
980
+ })
981
+ );
982
+ };
983
+ function Nt(e) {
984
+ const { controller: t, onChange: r, onBlur: n, ...s } = e;
985
+ return Ut({
986
+ ...s,
987
+ value: t.value,
988
+ onChange: at(t, r),
989
+ onBlur: rt(t, n)
990
+ });
991
+ }
992
+ function gn(e) {
993
+ return Oe({
994
+ ...e,
995
+ content: Nt(e)
996
+ });
997
+ }
998
+ function zt(e, t, r) {
999
+ const n = e.length.map((s) => s);
1000
+ return L(
1001
+ j(() => n.dispose()),
1002
+ ze(
1003
+ n,
1004
+ (s) => {
1005
+ const o = e.item(s.index), a = [];
1006
+ return L(
1007
+ j(() => {
1008
+ o.dispose(), a.forEach((u) => u());
1009
+ }),
1010
+ t({
1011
+ list: e,
1012
+ item: o,
1013
+ position: s,
1014
+ remove: () => e.removeAt(s.index),
1015
+ move: (u) => {
1016
+ switch (u) {
1017
+ case "up":
1018
+ if (s.index === 0) return;
1019
+ e.move(s.index, s.index - 1);
1020
+ break;
1021
+ case "down":
1022
+ if (s.index === e.length.value - 1) return;
1023
+ e.move(s.index, s.index + 1);
1024
+ break;
1025
+ case "first":
1026
+ e.move(s.index, 0);
1027
+ break;
1028
+ case "last":
1029
+ e.move(s.index, e.length.value - 1);
1030
+ }
1031
+ },
1032
+ canMove: (u) => {
1033
+ const c = (() => {
1034
+ switch (u) {
1035
+ case "up":
1036
+ return Ae(s.index > 0);
1037
+ case "down":
1038
+ return e.length.map((p) => s.index < p - 1);
1039
+ }
1040
+ })();
1041
+ return a.push(() => c.dispose()), c;
1042
+ },
1043
+ cannotMove: (u) => {
1044
+ const c = (() => {
1045
+ switch (u) {
1046
+ case "up":
1047
+ return Ae(s.index === 0);
1048
+ case "down":
1049
+ return e.length.map((p) => s.index === p - 1);
1050
+ }
1051
+ })();
1052
+ return a.push(() => c.dispose()), c;
1053
+ }
1054
+ })
1055
+ );
1056
+ },
1057
+ r
1058
+ )
1059
+ );
1060
+ }
1061
+ const Le = {
1062
+ 9: { pattern: /^[0-9]$/ },
1063
+ A: { pattern: /^[A-Za-z]$/, transform: (e) => e.toUpperCase() },
1064
+ "*": { pattern: /^.$/ }
1065
+ }, Rt = (e) => e instanceof RegExp;
1066
+ function He(e, t, r) {
1067
+ if (e == null) return [];
1068
+ const n = r ? { ...Le, ...t } : t ?? Le, s = (a, u) => {
1069
+ const c = n[u];
1070
+ c ? a.push({ type: "pattern", name: u, ...c }) : a.push({ type: "literal", char: u });
1071
+ }, o = [];
1072
+ if (typeof e == "string") {
1073
+ for (const a of e) s(o, a);
1074
+ return o;
1075
+ }
1076
+ for (const a of e)
1077
+ if (typeof a == "string")
1078
+ if (a.length <= 1) s(o, a);
1079
+ else for (const u of a) s(o, u);
1080
+ else Rt(a) ? o.push({ type: "pattern", pattern: a }) : typeof a == "object" && a && o.push(a);
1081
+ return o;
1082
+ }
1083
+ function Ot(e, t) {
1084
+ return (r) => {
1085
+ switch (e) {
1086
+ case "digits":
1087
+ return /[0-9]/.test(r);
1088
+ case "letters":
1089
+ return /[A-Za-z]/.test(r);
1090
+ case "alphanumeric":
1091
+ return /[A-Za-z0-9]/.test(r);
1092
+ case "custom":
1093
+ return t?.(r) ?? !0;
1094
+ default:
1095
+ return !0;
1096
+ }
1097
+ };
1098
+ }
1099
+ function Ee(e, t, r, n, s, o) {
1100
+ const a = {
1101
+ raw: e,
1102
+ previousConformed: t,
1103
+ cursor: s ?? e.length,
1104
+ completed: !1
1105
+ }, u = n.definitions ?? {}, c = typeof r == "function" ? r(e, a) : r, p = He(
1106
+ c,
1107
+ u,
1108
+ n.useDefaultDefinitions ?? !0
1109
+ ), h = Ot(n.allowMode, n.allow), d = /* @__PURE__ */ new Set();
1110
+ for (const T of p) T.type === "literal" && d.add(T.char);
1111
+ if (n.prefix) for (const T of n.prefix) d.add(T);
1112
+ if (n.suffix) for (const T of n.suffix) d.add(T);
1113
+ const g = Array.from(e).filter((T) => h(T) && !d.has(T));
1114
+ if (g.length === 0) return { value: "", cursor: 0, completed: !1 };
1115
+ const f = [], m = [];
1116
+ let w = 0, _ = 0, b = 0, x = -1;
1117
+ for (const T of p) {
1118
+ if (T.type === "literal") {
1119
+ f.push(T.char), m.push({ kind: "literal", filled: !0 });
1120
+ continue;
1121
+ }
1122
+ _ += T.optional ? 0 : 1;
1123
+ const B = g[w];
1124
+ if (B == null)
1125
+ break;
1126
+ if (T.type === "any") {
1127
+ b++, f.push(T.transform ? T.transform(B) : B), m.push({ kind: "slot", filled: !0 }), x = m.length - 1, w++;
1128
+ continue;
1129
+ }
1130
+ if (T.type === "pattern")
1131
+ if (T.pattern.test(B)) {
1132
+ b++;
1133
+ const z = T.transform ? T.transform(B) : B;
1134
+ f.push(z), m.push({ kind: "slot", filled: !0 }), x = m.length - 1, w++;
1135
+ } else {
1136
+ w++;
1137
+ continue;
1138
+ }
1139
+ }
1140
+ const S = f.join(""), C = (n.prefix ?? "") + S + (n.suffix ?? "");
1141
+ let v = (n.prefix ?? "").length;
1142
+ if (x >= 0) {
1143
+ let T = x + 1;
1144
+ if ((o?.policy ?? "smart") !== "sticky")
1145
+ for (; T < m.length && m[T].kind === "literal"; ) T++;
1146
+ v += T;
1147
+ }
1148
+ const I = n.completion?.mode === "min" ? (n.completion.minChars ?? 0) <= b : n.completion?.mode === "custom" ? !!n.completion.isComplete?.(C) : _ > 0 && b >= _, M = n.pipe?.(C, { ...a, completed: I });
1149
+ let A, F = v;
1150
+ return M === !1 ? (A = t, F = t.length) : typeof M == "string" ? (A = M, F = M.length) : typeof M == "object" && M ? (A = M.value, F = M.cursor ?? M.value.length) : A = C, { value: A, cursor: F, completed: I };
1151
+ }
1152
+ function Pt(e, t) {
1153
+ const r = t?.strategy ?? "none";
1154
+ return r === "custom" && t?.unmask ? t.unmask(e) : r === "strip" ? e.replace(/[^A-Za-z0-9]/g, "") : e;
1155
+ }
1156
+ const We = (e) => {
1157
+ const {
1158
+ value: t,
1159
+ onBlur: r,
1160
+ onChange: n,
1161
+ onInput: s,
1162
+ onAccept: o,
1163
+ onComplete: a,
1164
+ mask: u,
1165
+ definitions: c,
1166
+ useDefaultDefinitions: p,
1167
+ extraLiterals: h,
1168
+ prefix: d,
1169
+ suffix: g,
1170
+ autofix: f,
1171
+ pipe: m,
1172
+ completion: w,
1173
+ unmask: _,
1174
+ allowMode: b,
1175
+ allow: x,
1176
+ placeholder: S,
1177
+ placeholderOptions: C
1178
+ } = e, y = V(
1179
+ t,
1180
+ u,
1181
+ c,
1182
+ p,
1183
+ h,
1184
+ d,
1185
+ g,
1186
+ f,
1187
+ w,
1188
+ _,
1189
+ b,
1190
+ S,
1191
+ C
1192
+ )((I, M, A, F, T, B, z, ae, le, ee, Q, ue, q) => M ? Ee(I ?? "", "", M, {
1193
+ definitions: A ?? {},
1194
+ useDefaultDefinitions: F ?? !0,
1195
+ extraLiterals: T ?? [],
1196
+ autofix: ae ?? "none",
1197
+ completion: le ?? { mode: "mask" },
1198
+ pipe: m ?? ((U) => U),
1199
+ unmask: ee ?? { strategy: "none" },
1200
+ allowMode: Q ?? "all",
1201
+ allow: x,
1202
+ prefix: B,
1203
+ suffix: z
1204
+ }).value : I ?? ""), v = (I, M) => {
1205
+ const A = I.value ?? "", F = i.get(t) ?? "", T = u != null ? i.get(u) : null, B = c != null ? i.get(c) : void 0, z = p != null ? i.get(p) : void 0, ae = h != null ? i.get(h) : void 0, le = f != null ? i.get(f) : void 0, ee = w != null ? i.get(w) : void 0, Q = _ != null ? i.get(_) : void 0, ue = b != null ? i.get(b) : void 0, q = d != null ? i.get(d) : void 0, U = g != null ? i.get(g) : void 0, {
1206
+ value: J,
1207
+ cursor: he,
1208
+ completed: Se
1209
+ } = T ? Ee(
1210
+ A,
1211
+ F,
1212
+ T,
1213
+ {
1214
+ definitions: B ?? {},
1215
+ useDefaultDefinitions: z ?? !0,
1216
+ extraLiterals: ae ?? [],
1217
+ autofix: le ?? "none",
1218
+ completion: ee ?? { mode: "mask" },
1219
+ pipe: m ?? ((Ze) => Ze),
1220
+ unmask: Q ?? { strategy: "none" },
1221
+ allowMode: ue ?? "all",
1222
+ allow: x,
1223
+ prefix: q,
1224
+ suffix: U
1225
+ },
1226
+ I.selectionStart ?? A.length,
1227
+ e.cursor ? i.get(e.cursor) : void 0
1228
+ ) : { value: A, cursor: A.length, completed: !0 };
1229
+ if (J !== A) {
1230
+ I.value = J;
1231
+ try {
1232
+ I.setSelectionRange(he, he);
1233
+ } catch {
1234
+ }
1235
+ }
1236
+ const Te = Pt(J, Q);
1237
+ o?.({
1238
+ raw: Te,
1239
+ conformed: J,
1240
+ completed: Se,
1241
+ cursor: he
1242
+ }), M === "input" ? s?.(J) : (n?.(J), Se && a?.({ raw: Te, conformed: J }));
1243
+ };
1244
+ return H({
1245
+ ...e,
1246
+ input: se.text(
1247
+ Y(e),
1248
+ l.value(y),
1249
+ l.class("bc-input"),
1250
+ r != null ? k.blur(r) : D,
1251
+ ne(
1252
+ (I) => I instanceof HTMLInputElement ? L(
1253
+ k.input(() => v(I, "input")),
1254
+ k.change(() => v(I, "change")),
1255
+ k.keydown((M) => {
1256
+ if (M.key !== "Backspace" || !(e.cursor ? i.get(e.cursor)?.backspaceRubberBand ?? !0 : !0)) return;
1257
+ const F = I.selectionStart ?? 0, T = I.selectionEnd ?? F;
1258
+ if (F !== T || F <= 0) return;
1259
+ const B = I.value ?? "", z = u != null ? i.get(u) : null;
1260
+ if (!z) return;
1261
+ const ae = c != null ? i.get(c) : void 0, le = p != null ? i.get(p) : !0, ee = d != null ? i.get(d) : void 0, Q = g != null ? i.get(g) : void 0, ue = He(
1262
+ typeof z == "function" ? z(B, {
1263
+ raw: B,
1264
+ previousConformed: B,
1265
+ cursor: F,
1266
+ completed: !1
1267
+ }) : z,
1268
+ ae ?? {},
1269
+ le ?? !0
1270
+ ), q = /* @__PURE__ */ new Set();
1271
+ for (const U of ue)
1272
+ U.type === "literal" && q.add(U.char);
1273
+ if (ee) for (const U of ee) q.add(U);
1274
+ if (Q) for (const U of Q) q.add(U);
1275
+ if (q.has(B[F - 1])) {
1276
+ let U = F - 1;
1277
+ for (; U >= 0 && q.has(B[U]); ) U--;
1278
+ U >= 0 && (M.preventDefault(), M.stopPropagation(), I.value = B.slice(0, U) + B.slice(U + 1), v(I, "input"));
1279
+ }
1280
+ })
1281
+ ) : D
1282
+ )
1283
+ )
1284
+ });
1285
+ };
1286
+ function X(e, t, r) {
1287
+ const n = i.map(e, (o) => o != null), s = ye.clearValue;
1288
+ return E(
1289
+ n,
1290
+ () => $.button(
1291
+ l.type("button"),
1292
+ l.class("bc-input-container__reset bu-text-light-gray"),
1293
+ O.label(s),
1294
+ l.title(s),
1295
+ l.disabled(t ?? !1),
1296
+ N({ icon: "mdi:close", size: "sm" }),
1297
+ k.click((o) => {
1298
+ o.preventDefault(), o.stopPropagation(), r?.(null);
1299
+ })
1300
+ )
1301
+ );
1302
+ }
1303
+ const vn = (e) => {
1304
+ const { value: t, onBlur: r, onChange: n, after: s, disabled: o } = e, a = X(t, o, n);
1305
+ return H({
1306
+ ...e,
1307
+ input: se.date(
1308
+ Y(e),
1309
+ l.valueAsDate(t),
1310
+ l.class("bc-input"),
1311
+ r != null ? k.blur(P(r)) : D,
1312
+ n != null ? k.change(Ge(n)) : D
1313
+ ),
1314
+ after: s != null ? L(a, s) : a
1315
+ });
1316
+ }, jt = (e) => {
1317
+ const t = e.getFullYear(), r = e.getMonth() + 1, n = e.getDate(), s = e.getHours(), o = e.getMinutes(), a = e.getSeconds();
1318
+ return `${t}-${r.toString().padStart(2, "0")}-${n.toString().padStart(2, "0")}T${s.toString().padStart(2, "0")}:${o.toString().padStart(2, "0")}:${a.toString().padStart(2, "0")}`;
1319
+ }, xn = (e) => {
1320
+ const { value: t, onBlur: r, onChange: n, after: s, disabled: o } = e, a = i.map(t, (c) => c != null ? jt(c) : null), u = X(t, o, n);
1321
+ return H({
1322
+ ...e,
1323
+ input: se["datetime-local"](
1324
+ Y(e),
1325
+ l.value(i.map(a, (c) => c ?? null)),
1326
+ l.class("bc-input"),
1327
+ r != null ? k.blur(P(r)) : D,
1328
+ n != null ? k.change(Qe(n)) : D
1329
+ ),
1330
+ after: s != null ? L(u, s) : u
1331
+ });
1332
+ }, Z = (e) => typeof e == "string" && e.trim() === "" ? null : e, re = (e) => e ?? "", wn = (e) => {
1333
+ const { value: t, onBlur: r, onChange: n, onInput: s, after: o, disabled: a, ...u } = e, c = X(t, a, n);
1334
+ return lt({
1335
+ ...u,
1336
+ value: i.map(t, re),
1337
+ onChange: n != null ? (p) => n(Z(p)) : void 0,
1338
+ onInput: s != null ? (p) => s(Z(p)) : void 0,
1339
+ onBlur: r,
1340
+ after: o != null ? L(c, o) : c
1341
+ });
1342
+ }, _n = (e) => {
1343
+ const { value: t, onBlur: r, onChange: n, onInput: s, after: o, disabled: a, ...u } = e, c = X(t, a, n);
1344
+ return ot({
1345
+ ...u,
1346
+ value: i.map(t, re),
1347
+ onChange: n != null ? (p) => n(Z(p)) : void 0,
1348
+ onInput: s != null ? (p) => s(Z(p)) : void 0,
1349
+ onBlur: r,
1350
+ after: o != null ? L(c, o) : c
1351
+ });
1352
+ }, $n = (e) => {
1353
+ const { value: t, onBlur: r, onChange: n, onInput: s, after: o, disabled: a, ...u } = e, c = X(t, a, n);
1354
+ return ct({
1355
+ ...u,
1356
+ value: i.map(t, re),
1357
+ onChange: n != null ? (p) => n(Z(p)) : void 0,
1358
+ onInput: s != null ? (p) => s(Z(p)) : void 0,
1359
+ onBlur: r,
1360
+ after: o != null ? L(c, o) : c
1361
+ });
1362
+ }, Ht = (e) => {
1363
+ const { value: t, onBlur: r, onChange: n, onInput: s, rows: o } = e;
1364
+ return H({
1365
+ ...e,
1366
+ input: $.textarea(
1367
+ Y(e),
1368
+ l.rows(o ?? 3),
1369
+ l.value(t),
1370
+ l.class("bc-input"),
1371
+ r != null ? k.blur(P(r)) : D,
1372
+ n != null ? k.change(P(n)) : D,
1373
+ s != null ? k.input(P(s)) : D
1374
+ )
1375
+ });
1376
+ }, yn = (e) => {
1377
+ const { value: t, onBlur: r, onChange: n, onInput: s, after: o, disabled: a, ...u } = e, c = X(t, a, n);
1378
+ return Ht({
1379
+ ...u,
1380
+ value: i.map(t, re),
1381
+ onChange: n != null ? (p) => n(Z(p)) : void 0,
1382
+ onInput: s != null ? (p) => s(Z(p)) : void 0,
1383
+ onBlur: r,
1384
+ after: o != null ? L(c, o) : c
1385
+ });
1386
+ }, In = (e) => {
1387
+ const { value: t, step: r, min: n, max: s, onBlur: o, onChange: a, onInput: u, after: c } = e, p = (g) => {
1388
+ const f = n != null ? i.get(n) : void 0, m = s != null ? i.get(s) : void 0;
1389
+ return f != null && g < f ? f : m != null && g > m ? m : g;
1390
+ }, h = r != null ? R(W, (g) => {
1391
+ const f = V(
1392
+ t,
1393
+ n
1394
+ )((b, x) => x == null ? !0 : (b ?? 0) > x), m = V(
1395
+ t,
1396
+ s
1397
+ )((b, x) => x == null ? !0 : (b ?? 0) < x), w = (b) => {
1398
+ const x = i.get(t) ?? 0, S = i.get(r), C = b?.shiftKey ? 10 : 1, y = x - S * C, v = n != null ? i.get(n) : void 0;
1399
+ if (v != null && y < v)
1400
+ return;
1401
+ const I = p(y);
1402
+ I !== x && a && a(I);
1403
+ }, _ = (b) => {
1404
+ const x = i.get(t) ?? 0, S = i.get(r), C = b?.shiftKey ? 10 : 1, y = x + S * C, v = s != null ? i.get(s) : void 0;
1405
+ if (v != null && y > v)
1406
+ return;
1407
+ const I = p(y);
1408
+ I !== x && a && a(I);
1409
+ };
1410
+ return te(
1411
+ l.class("bc-number-input-steppers"),
1412
+ // Increment second
1413
+ $.button(
1414
+ l.class(
1415
+ "bc-button bc-number-input-steppers-button bc-number-input-steppers-button--increment"
1416
+ ),
1417
+ l.disabled(
1418
+ V(
1419
+ m,
1420
+ e.disabled ?? !1
1421
+ )((b, x) => !b || x)
1422
+ ),
1423
+ k.click((b) => _(b)),
1424
+ O.label(g.$.incrementValue),
1425
+ N({ icon: "line-md:plus", size: "xs" })
1426
+ ),
1427
+ // Decrement first (matches tests expecting first button to be decrement)
1428
+ $.button(
1429
+ l.class(
1430
+ "bc-button bc-number-input-steppers-button bc-number-input-steppers-button--decrement"
1431
+ ),
1432
+ l.disabled(
1433
+ V(
1434
+ f,
1435
+ e.disabled ?? !1
1436
+ )((b, x) => !b || x)
1437
+ ),
1438
+ k.click((b) => w(b)),
1439
+ O.label(g.$.decrementValue),
1440
+ N({ icon: "line-md:minus", size: "xs" })
1441
+ )
1442
+ );
1443
+ }) : null, d = c != null && h != null ? L(h, c) : c ?? h;
1444
+ return H({
1445
+ ...e,
1446
+ input: se.number(
1447
+ n != null ? L(
1448
+ l.min(n),
1449
+ j(
1450
+ i.on(n, (g) => {
1451
+ g < i.get(t);
1452
+ })
1453
+ )
1454
+ ) : D,
1455
+ s != null ? L(
1456
+ l.max(s),
1457
+ j(
1458
+ i.on(s, (g) => {
1459
+ g > i.get(t);
1460
+ })
1461
+ )
1462
+ ) : D,
1463
+ Y(e),
1464
+ l.valueAsNumber(t),
1465
+ l.step(r),
1466
+ l.class("bc-input bc-number-input"),
1467
+ o != null ? k.blur(P(o)) : D,
1468
+ a != null ? k.change(G(a)) : D,
1469
+ u != null ? k.input(G(u)) : D,
1470
+ // Add wheel event support when step is defined
1471
+ r != null ? k.wheel((g) => {
1472
+ g.preventDefault();
1473
+ const f = i.get(t) ?? 0, m = i.get(r), w = g.shiftKey ? 10 : 1, _ = g.deltaY < 0 ? m * w : -m * w, b = p(f + _);
1474
+ b !== f && a && a(b);
1475
+ }) : D
1476
+ ),
1477
+ after: d
1478
+ });
1479
+ }, Ue = (e) => {
1480
+ if (e == null || e === "") return null;
1481
+ const t = Number(e);
1482
+ return Number.isNaN(t) ? null : t;
1483
+ }, Cn = (e) => {
1484
+ const { value: t, step: r, min: n, max: s, onBlur: o, onChange: a, onInput: u, after: c } = e, p = (f) => {
1485
+ const m = n != null ? i.get(n) : void 0, w = s != null ? i.get(s) : void 0;
1486
+ return m != null && f < m ? m : w != null && f > w ? w : f;
1487
+ }, h = (() => {
1488
+ if (r == null) return null;
1489
+ const f = V(
1490
+ t,
1491
+ n
1492
+ )((x, S) => {
1493
+ const C = x ?? 0;
1494
+ return S == null ? !0 : C > S;
1495
+ }), m = V(
1496
+ t,
1497
+ s
1498
+ )((x, S) => {
1499
+ const C = x ?? 0;
1500
+ return S == null ? !0 : C < S;
1501
+ }), w = (x) => {
1502
+ const S = i.get(t) ?? 0, C = i.get(r), y = x?.shiftKey ? 10 : 1, v = S - C * y, I = n != null ? i.get(n) : void 0;
1503
+ if (I != null && v < I) return;
1504
+ const M = p(v);
1505
+ M !== S && a && a(M);
1506
+ }, _ = (x) => {
1507
+ const S = i.get(t) ?? 0, C = i.get(r), y = x?.shiftKey ? 10 : 1, v = S + C * y, I = s != null ? i.get(s) : void 0;
1508
+ if (I != null && v > I) return;
1509
+ const M = p(v);
1510
+ M !== S && a && a(M);
1511
+ };
1512
+ return ((x, S) => te(
1513
+ l.class("bc-number-input-steppers"),
1514
+ $.button(
1515
+ l.class(
1516
+ "bc-button bc-number-input-steppers-button bc-number-input-steppers-button--increment"
1517
+ ),
1518
+ l.disabled(
1519
+ V(
1520
+ m,
1521
+ e.disabled ?? !1
1522
+ )((C, y) => !C || y)
1523
+ ),
1524
+ k.click((C) => _(C)),
1525
+ O.label(x),
1526
+ N({ icon: "line-md:plus", size: "xs" })
1527
+ ),
1528
+ $.button(
1529
+ l.class(
1530
+ "bc-button bc-number-input-steppers-button bc-number-input-steppers-button--decrement"
1531
+ ),
1532
+ l.disabled(
1533
+ V(
1534
+ f,
1535
+ e.disabled ?? !1
1536
+ )((C, y) => !C || y)
1537
+ ),
1538
+ k.click((C) => w(C)),
1539
+ O.label(S),
1540
+ N({ icon: "line-md:minus", size: "xs" })
1541
+ )
1542
+ ))(
1543
+ ye.incrementValue,
1544
+ ye.decrementValue
1545
+ );
1546
+ })(), d = X(t, e.disabled, a), g = c != null && h != null ? L(h, d, c) : c != null ? L(d, c) : h != null ? L(h, d) : d;
1547
+ return H({
1548
+ ...e,
1549
+ input: se.number(
1550
+ // min/max attributes and reactive watchers (no forced correction)
1551
+ n != null ? L(
1552
+ l.min(n),
1553
+ j(
1554
+ i.on(n, (f) => {
1555
+ })
1556
+ )
1557
+ ) : D,
1558
+ s != null ? L(
1559
+ l.max(s),
1560
+ j(
1561
+ i.on(s, (f) => {
1562
+ })
1563
+ )
1564
+ ) : D,
1565
+ Y(e),
1566
+ // Represent null as empty string so the field can be cleared
1567
+ l.value(i.map(t, (f) => f == null ? "" : String(f))),
1568
+ l.step(r),
1569
+ l.class("bc-input bc-number-input"),
1570
+ o != null ? k.blur(P(o)) : D,
1571
+ a != null ? k.change(
1572
+ P((f) => {
1573
+ const m = Ue(f);
1574
+ a(m);
1575
+ })
1576
+ ) : D,
1577
+ u != null ? k.input(
1578
+ P((f) => {
1579
+ const m = Ue(f);
1580
+ u(m);
1581
+ })
1582
+ ) : D,
1583
+ // Wheel support when step is defined
1584
+ r != null ? k.wheel((f) => {
1585
+ f.preventDefault();
1586
+ const m = i.get(t) ?? 0, w = i.get(r), _ = f.shiftKey ? 10 : 1, b = f.deltaY < 0 ? w * _ : -w * _, x = p(m + b);
1587
+ x !== m && a && a(x);
1588
+ }) : D
1589
+ ),
1590
+ after: g
1591
+ });
1592
+ }, kn = ({
1593
+ value: e,
1594
+ onChange: t,
1595
+ offLabel: r,
1596
+ onLabel: n,
1597
+ label: s,
1598
+ disabled: o = !1,
1599
+ size: a = "md",
1600
+ id: u
1601
+ }) => {
1602
+ const c = u ?? it("switch"), p = `${c}-label`;
1603
+ function h(f, m) {
1604
+ const w = ["bc-switch", `bu-text-${m}`, `bc-switch--${m}`];
1605
+ return f && w.push("bc-switch--disabled"), w.join(" ");
1606
+ }
1607
+ const d = () => {
1608
+ i.get(o) || t(!i.get(e));
1609
+ }, g = (f) => {
1610
+ i.get(o) || (f.key === " " || f.key === "Enter") && (f.preventDefault(), d());
1611
+ };
1612
+ return $.div(
1613
+ l.class(
1614
+ V(
1615
+ o ?? !1,
1616
+ a
1617
+ )(
1618
+ (f, m) => h(f ?? !1, m ?? "md")
1619
+ )
1620
+ ),
1621
+ l.id(c),
1622
+ l.role("switch"),
1623
+ l.tabindex(
1624
+ i.map(o, (f) => f ? -1 : 0)
1625
+ ),
1626
+ O.checked(e),
1627
+ O.disabled(o),
1628
+ O.labelledby(s != null ? p : void 0),
1629
+ k.click(d),
1630
+ k.keydown(g),
1631
+ s != null ? ut(l.id(p), l.class(`bu-text-${a} bu-nowrap`), s) : null,
1632
+ $.div(
1633
+ l.class("bc-switch__track"),
1634
+ l.class(
1635
+ i.map(
1636
+ e,
1637
+ (f) => f ? "bc-switch__track--on" : "bc-switch__track--off"
1638
+ )
1639
+ ),
1640
+ r != null ? $.div(
1641
+ O.hidden(!0),
1642
+ l.class("bc-switch__track-label bc-switch__track-label--off"),
1643
+ l.class(
1644
+ i.map(
1645
+ e,
1646
+ (f) => f ? "bc-switch__track-label--hidden" : "bc-switch__track-label--visible"
1647
+ )
1648
+ ),
1649
+ r
1650
+ ) : null,
1651
+ n != null ? $.div(
1652
+ l.class("bc-switch__track-label bc-switch__track-label--on"),
1653
+ l.class(
1654
+ i.map(
1655
+ e,
1656
+ (f) => f ? "bc-switch__track-label--visible" : "bc-switch__track-label--hidden"
1657
+ )
1658
+ ),
1659
+ n
1660
+ ) : null,
1661
+ Re(
1662
+ (f) => R(
1663
+ ft,
1664
+ ({ direction: m }) => $.div(
1665
+ l.class("bc-switch__thumb"),
1666
+ l.class(
1667
+ i.map(
1668
+ e,
1669
+ (w) => w ? "bc-switch__thumb--on" : "bc-switch__thumb--off"
1670
+ )
1671
+ ),
1672
+ pe.transform(
1673
+ V(
1674
+ e,
1675
+ f,
1676
+ a,
1677
+ m
1678
+ )((w, { width: _ }, b, x) => {
1679
+ const S = (() => {
1680
+ switch (b) {
1681
+ case "xs":
1682
+ return 5;
1683
+ case "sm":
1684
+ return 5.5;
1685
+ case "md":
1686
+ return 6;
1687
+ case "lg":
1688
+ return 7;
1689
+ case "xl":
1690
+ return 8;
1691
+ }
1692
+ })(), C = x === "rtl" ? `calc((var(--spacing-base) * ${S}) - ${_}px)` : `calc(${_}px - (var(--spacing-base) * ${S}))`;
1693
+ return w ? `translateX(${C})` : "translateX(0)";
1694
+ })
1695
+ )
1696
+ )
1697
+ )
1698
+ )
1699
+ )
1700
+ );
1701
+ }, Wt = (e) => {
1702
+ const t = {
1703
+ type: "pattern",
1704
+ pattern: /[0-9A-Fa-f]/,
1705
+ transform: (n) => n.toLowerCase()
1706
+ };
1707
+ return We({
1708
+ ...e,
1709
+ mask: [
1710
+ t,
1711
+ t,
1712
+ t,
1713
+ t,
1714
+ t,
1715
+ t,
1716
+ t,
1717
+ t,
1718
+ "-",
1719
+ t,
1720
+ t,
1721
+ t,
1722
+ t,
1723
+ "-",
1724
+ t,
1725
+ t,
1726
+ t,
1727
+ t,
1728
+ "-",
1729
+ t,
1730
+ t,
1731
+ t,
1732
+ t,
1733
+ "-",
1734
+ t,
1735
+ t,
1736
+ t,
1737
+ t,
1738
+ t,
1739
+ t,
1740
+ t,
1741
+ t,
1742
+ t,
1743
+ t,
1744
+ t,
1745
+ t
1746
+ ],
1747
+ // Sensible default placeholder; can be overridden via options.placeholder
1748
+ placeholder: e.placeholder ?? "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
1749
+ });
1750
+ }, Mn = (e) => {
1751
+ const { value: t, onBlur: r, onChange: n, onInput: s, after: o, disabled: a, ...u } = e, c = X(t, a, n);
1752
+ return Wt({
1753
+ ...u,
1754
+ value: i.map(t, re),
1755
+ onChange: n != null ? (p) => n(Z(p)) : void 0,
1756
+ onInput: s != null ? (p) => s(Z(p)) : void 0,
1757
+ onBlur: r,
1758
+ after: o != null ? L(c, o) : c
1759
+ });
1760
+ }, Zt = "line-md:star-alt-filled", Yt = "line-md:star-alt", Xt = (e) => {
1761
+ const {
1762
+ value: t,
1763
+ onChange: r,
1764
+ disabled: n,
1765
+ max: s = 5,
1766
+ fullColor: o = "yellow",
1767
+ emptyColor: a = "neutral",
1768
+ fullIcon: u = Zt,
1769
+ emptyIcon: c = Yt,
1770
+ size: p = "md",
1771
+ onBlur: h,
1772
+ rounding: d = 1
1773
+ } = e, g = () => {
1774
+ const x = i.get(d);
1775
+ return x > 0 ? x : 1;
1776
+ }, f = (x) => Math.min(Math.max(x, 0), i.get(s)), m = (x, S) => {
1777
+ if (i.get(n ?? !1)) return;
1778
+ const y = x.currentTarget.getBoundingClientRect(), v = (x.clientX - y.left) / y.width, I = S - 1 + v, M = g(), A = Math.ceil(I / M) * M, F = f(A);
1779
+ r?.(F);
1780
+ }, w = (x) => {
1781
+ if (i.get(n ?? !1)) return;
1782
+ const S = g(), C = i.get(t) ?? 0;
1783
+ let y;
1784
+ switch (x.key) {
1785
+ case "ArrowRight":
1786
+ case "ArrowUp":
1787
+ y = f(C + S);
1788
+ break;
1789
+ case "ArrowLeft":
1790
+ case "ArrowDown":
1791
+ y = f(C - S);
1792
+ break;
1793
+ case "Home":
1794
+ y = 0;
1795
+ break;
1796
+ case "End":
1797
+ y = i.get(s);
1798
+ break;
1799
+ default:
1800
+ return;
1801
+ }
1802
+ x.preventDefault(), r?.(y);
1803
+ }, _ = i.map(p, (x) => `bc-icon--${x}`), b = ({ index: x, counter: S }) => $.span(
1804
+ l.class("bc-rating-input__icon-container"),
1805
+ l.class(_),
1806
+ N(
1807
+ { icon: c, size: p },
1808
+ l.class("bc-rating-input__icon-empty"),
1809
+ l.class(i.map(a, (C) => `bu-fg-soft-${C}`))
1810
+ ),
1811
+ $.span(
1812
+ l.class("bc-rating-input__icon-clipper"),
1813
+ l.class(_),
1814
+ l.class(i.map(o, (C) => `bu-fg-soft-${C}`)),
1815
+ pe.width(
1816
+ i.map(t, (C) => {
1817
+ const y = Math.floor(C);
1818
+ return y > x ? "100%" : y < x ? "0%" : `${(C - x) * 100}%`;
1819
+ })
1820
+ ),
1821
+ N({ icon: u, size: p }, l.class("bc-rating-input__icon-full"))
1822
+ ),
1823
+ k.click(
1824
+ Je((C) => m(C, S), {
1825
+ preventDefault: !0,
1826
+ stopPropagation: !0
1827
+ })
1828
+ )
1829
+ );
1830
+ return H({
1831
+ baseContainer: !0,
1832
+ growInput: !1,
1833
+ focusableSelector: '[role="slider"]',
1834
+ ...e,
1835
+ input: $.div(
1836
+ // Common input attributes (id, required, invalid, custom classes, etc.)
1837
+ Y(e),
1838
+ l.class("bc-rating-input"),
1839
+ // ARIA slider semantics
1840
+ l.role("slider"),
1841
+ l.tabindex(i.map(n ?? !1, (x) => x ? -1 : 0)),
1842
+ O.disabled(n ?? !1),
1843
+ // Keyboard & focus handlers
1844
+ k.keydown(w),
1845
+ h != null ? k.blur(h) : null,
1846
+ // Reactive ARIA value attributes
1847
+ ne((x) => {
1848
+ const S = (v, I) => x.setAttribute(v, I);
1849
+ S("aria-valuemin", "0"), S("aria-valuemax", String(i.get(s))), S("aria-valuenow", String(i.get(t) ?? 0)), S(
1850
+ "aria-valuetext",
1851
+ `${String(i.get(t) ?? 0)} / ${String(i.get(s))}`
1852
+ );
1853
+ const C = i.on(s, (v) => S("aria-valuemax", String(v))), y = i.on(t, (v) => {
1854
+ S("aria-valuenow", String(v ?? 0)), S("aria-valuetext", `${String(v ?? 0)} / ${String(i.get(s))}`);
1855
+ });
1856
+ return j(() => {
1857
+ C(), y();
1858
+ });
1859
+ }),
1860
+ ze(s, b)
1861
+ )
1862
+ });
1863
+ }, Sn = (e) => {
1864
+ const { value: t, onChange: r, onBlur: n, after: s, disabled: o, ...a } = e, u = X(t, o, r);
1865
+ return Xt({
1866
+ ...a,
1867
+ // Map null -> 0 for display so the control shows as empty when null
1868
+ value: i.map(t, (c) => c ?? 0),
1869
+ // Pass through numeric changes; clear button will call onChange(null)
1870
+ onChange: r,
1871
+ onBlur: n,
1872
+ after: s != null ? L(u, s) : u
1873
+ });
1874
+ }, Tn = (e) => {
1875
+ const { value: t, step: r, min: n, max: s, onBlur: o, onChange: a, onInput: u } = e;
1876
+ return H({
1877
+ ...e,
1878
+ // Make sure clicks anywhere focus the range input
1879
+ focusableSelector: 'input[type="range"]',
1880
+ input: $.input(
1881
+ l.type("range"),
1882
+ Y(e),
1883
+ l.min(n),
1884
+ l.max(s),
1885
+ l.step(r),
1886
+ // Using value as number to keep it in sync
1887
+ l.valueAsNumber(t),
1888
+ l.class("bc-input bc-slider-input"),
1889
+ o != null ? k.blur(G(o)) : D,
1890
+ a != null ? k.change(G(a)) : D,
1891
+ u != null ? k.input(G(u)) : D
1892
+ )
1893
+ });
1894
+ }, Dn = (e) => {
1895
+ const { value: t, step: r, min: n, max: s, onBlur: o, onChange: a, onInput: u } = e, c = i.map(t, (h) => {
1896
+ if (h != null) return h;
1897
+ const d = n != null ? i.get(n) : void 0;
1898
+ return typeof d == "number" ? d : 0;
1899
+ }), p = X(t, e.disabled, (h) => {
1900
+ a?.(h);
1901
+ });
1902
+ return H(
1903
+ {
1904
+ ...e,
1905
+ focusableSelector: 'input[type="range"]',
1906
+ after: p,
1907
+ input: $.input(
1908
+ l.type("range"),
1909
+ Y(e),
1910
+ l.min(n),
1911
+ l.max(s),
1912
+ l.step(r),
1913
+ l.valueAsNumber(c),
1914
+ l.class("bc-input bc-slider-input"),
1915
+ o != null ? k.blur(G(o)) : D,
1916
+ a != null ? k.change(
1917
+ G((h) => {
1918
+ a(h);
1919
+ })
1920
+ ) : D,
1921
+ u != null ? k.input(
1922
+ G((h) => {
1923
+ u(h);
1924
+ })
1925
+ ) : D
1926
+ )
1927
+ },
1928
+ // Ensure container grows input naturally
1929
+ L()
1930
+ );
1931
+ };
1932
+ let _e = null;
1933
+ async function qt() {
1934
+ const e = globalThis;
1935
+ return e.Temporal ? e.Temporal : (_e || (_e = import("./index.esm-DPNh6inz.js").then((t) => {
1936
+ const r = t.Temporal;
1937
+ return e.Temporal || (e.Temporal = r), r;
1938
+ })), _e);
1939
+ }
1940
+ const Gt = (e) => Ke(qt, e), Qt = /^P(\d+([YMWD]|$)){0,4}(T(\d+([HMS]|$)){0,3})?$/i, Jt = /^P(?:(\d+Y)?(\d+M)?(\d+W)?(\d+D)?)(T(\d+H)?(\d+M)?(\d+S)?)?$/i;
1941
+ function Kt(e) {
1942
+ return {
1943
+ mask: null,
1944
+ allowMode: "custom",
1945
+ allow: (t) => /[0-9ptwdhms]/i.test(t),
1946
+ pipe: (t) => {
1947
+ const r = t.toUpperCase();
1948
+ return r.length === 0 ? r : !r.startsWith("P") || !Qt.test(r) ? !1 : r;
1949
+ },
1950
+ completion: {
1951
+ mode: "custom",
1952
+ isComplete: (t) => {
1953
+ const r = t.toUpperCase();
1954
+ if (!Jt.test(r)) return !1;
1955
+ try {
1956
+ return e(r), !0;
1957
+ } catch {
1958
+ return !1;
1959
+ }
1960
+ }
1961
+ }
1962
+ };
1963
+ }
1964
+ const An = (e) => {
1965
+ const { value: t, onChange: r, after: n, disabled: s } = e, o = X(t, s, r);
1966
+ return Gt(
1967
+ (a) => We({
1968
+ ...e,
1969
+ value: i.map(t, (u) => u?.toString() ?? ""),
1970
+ onChange: r ? (u) => r(u === "" ? null : a.Duration.from(u)) : void 0,
1971
+ onInput: void 0,
1972
+ ...Kt(a.Duration.from),
1973
+ placeholder: "P0DT0H0M0S",
1974
+ after: n != null ? L(o, n) : o
1975
+ })
1976
+ );
1977
+ }, en = (e) => {
1978
+ const { value: t, onBlur: r, onChange: n, onInput: s } = e;
1979
+ return H({
1980
+ ...e,
1981
+ input: se.url(
1982
+ Y(e),
1983
+ l.value(t),
1984
+ l.class("bc-input"),
1985
+ r != null ? k.blur(P(r)) : D,
1986
+ n != null ? k.change(P(n)) : D,
1987
+ s != null ? k.input(P(s)) : D
1988
+ )
1989
+ });
1990
+ }, Fn = (e) => {
1991
+ const { value: t, onBlur: r, onChange: n, onInput: s, after: o, disabled: a, ...u } = e, c = X(t, a, n);
1992
+ return en({
1993
+ ...u,
1994
+ value: i.map(t, re),
1995
+ onChange: n != null ? (p) => n(Z(p)) : void 0,
1996
+ onInput: s != null ? (p) => s(Z(p)) : void 0,
1997
+ onBlur: r,
1998
+ after: o != null ? L(c, o) : c
1999
+ });
2000
+ }, Bn = (e, ...t) => {
2001
+ const {
2002
+ element: r,
2003
+ separator: n,
2004
+ showMove: s = !0,
2005
+ showRemove: o = !0,
2006
+ showAdd: a = !0,
2007
+ createItem: u,
2008
+ addLabel: c,
2009
+ controlsLayout: p = "aside",
2010
+ ...h
2011
+ } = e, d = i.toSignal(p).map((m) => m === "aside"), g = (m) => {
2012
+ const w = E(
2013
+ s ?? !1,
2014
+ () => $.div(
2015
+ l.class("bu-items-center"),
2016
+ l.class(
2017
+ d.map(
2018
+ (b) => b ? "bu-flex-col" : "bu-flex-row bu-gap-1"
2019
+ )
2020
+ ),
2021
+ ge(
2022
+ {
2023
+ size: "xs",
2024
+ roundedness: "full",
2025
+ variant: "text",
2026
+ onClick: () => m.move("up"),
2027
+ disabled: m.cannotMove("up")
2028
+ },
2029
+ R(
2030
+ W,
2031
+ (b) => N({
2032
+ size: "xs",
2033
+ icon: "line-md:arrow-up",
2034
+ title: b.$.incrementValue
2035
+ })
2036
+ )
2037
+ ),
2038
+ ge(
2039
+ {
2040
+ size: "xs",
2041
+ roundedness: "full",
2042
+ variant: "text",
2043
+ onClick: () => m.move("down"),
2044
+ disabled: m.cannotMove("down")
2045
+ },
2046
+ R(
2047
+ W,
2048
+ (b) => N({
2049
+ size: "xs",
2050
+ icon: "line-md:arrow-down",
2051
+ title: b.$.decrementValue
2052
+ })
2053
+ )
2054
+ )
2055
+ )
2056
+ ), _ = E(
2057
+ o,
2058
+ () => R(
2059
+ W,
2060
+ (b) => me({
2061
+ size: "xs",
2062
+ // Use a lowercase label to satisfy tests that query with [aria-label*="remove"]
2063
+ label: i.map(b.$.removeItem, (x) => x.toLowerCase()),
2064
+ color: "error",
2065
+ disabled: e.removeDisabled,
2066
+ onClick: m.remove
2067
+ })
2068
+ )
2069
+ );
2070
+ return (b) => E(
2071
+ d,
2072
+ () => fe(
2073
+ l.class("bu-gap-1 bu-items-center"),
2074
+ te(l.class("bu-flex-grow"), b),
2075
+ te(
2076
+ l.class("bu-items-center"),
2077
+ E(
2078
+ e.controller.value.map((x) => x.length > 1),
2079
+ () => w
2080
+ ),
2081
+ _
2082
+ )
2083
+ ),
2084
+ () => te(
2085
+ l.class("bu-gap-2"),
2086
+ b,
2087
+ fe(
2088
+ l.class("bu-gap-2 bu-justify-between"),
2089
+ E(
2090
+ e.controller.value.map((x) => x.length > 1),
2091
+ () => w,
2092
+ () => $.div()
2093
+ ),
2094
+ _
2095
+ )
2096
+ )
2097
+ );
2098
+ }, f = E(
2099
+ V(a, u)((m, w) => m && w != null),
2100
+ () => fe(
2101
+ l.class("bu-gap-2 bu-items-center bu-justify-center"),
2102
+ ge(
2103
+ {
2104
+ size: "sm",
2105
+ variant: "filled",
2106
+ onClick: () => h.controller.push(u()),
2107
+ disabled: V(
2108
+ h.controller.disabled,
2109
+ e.addDisabled ?? !1
2110
+ )((m, w) => m || w)
2111
+ },
2112
+ R(
2113
+ W,
2114
+ (m) => fe(
2115
+ l.class("bu-gap-2"),
2116
+ N({ icon: "line-md:plus" }),
2117
+ c ?? m.$.addLabel
2118
+ )
2119
+ )
2120
+ )
2121
+ )
2122
+ );
2123
+ return Oe(
2124
+ {
2125
+ ...h,
2126
+ content: te(
2127
+ l.class("bu-gap-2"),
2128
+ zt(
2129
+ h.controller,
2130
+ (m) => g(m)(r(m)),
2131
+ n
2132
+ ),
2133
+ f
2134
+ )
2135
+ },
2136
+ ...t
2137
+ );
2138
+ };
2139
+ class Vn extends ve {
2140
+ branches;
2141
+ activeBranch;
2142
+ #t;
2143
+ #e = /* @__PURE__ */ new Map();
2144
+ constructor(t, r, n, s, o, a, u = oe) {
2145
+ super(t, r, n, s, o, u), this.branches = a;
2146
+ const c = (h) => {
2147
+ for (const d of a)
2148
+ if (d.detect(h))
2149
+ return d.key;
2150
+ return a[0]?.key ?? "unknown";
2151
+ };
2152
+ this.activeBranch = n.map(c, oe);
2153
+ const p = (h) => {
2154
+ if (this.#e.has(h))
2155
+ return this.#e.get(h);
2156
+ const d = a.find((f) => f.key === h);
2157
+ if (!d)
2158
+ throw new Error(`Unknown branch: ${h}`);
2159
+ const g = new ve(
2160
+ [...t, h],
2161
+ (f) => {
2162
+ this.change(f);
2163
+ },
2164
+ n.map(
2165
+ (f) => d.detect(f) ? f : d.defaultValue(),
2166
+ u
2167
+ ),
2168
+ s.map(Fe([h])),
2169
+ {
2170
+ disabled: this.disabled,
2171
+ validationMode: this.parent.validationMode
2172
+ },
2173
+ u
2174
+ );
2175
+ return this.#e.set(h, g), g;
2176
+ };
2177
+ this.#t = this.activeBranch.map(
2178
+ (h) => p(h),
2179
+ oe
2180
+ ), this.onDispose(() => {
2181
+ for (const h of this.#e.values())
2182
+ h.dispose();
2183
+ this.#e.clear(), this.activeBranch.dispose(), this.#t.dispose();
2184
+ });
2185
+ }
2186
+ /**
2187
+ * Get the controller for the currently active branch
2188
+ */
2189
+ get activeController() {
2190
+ return i.get(this.#t);
2191
+ }
2192
+ /**
2193
+ * Get a controller for a specific branch
2194
+ */
2195
+ getBranchController(t) {
2196
+ const r = this.branches.find((s) => s.key === t);
2197
+ if (!r)
2198
+ throw new Error(`Unknown branch: ${t}`);
2199
+ if (this.#e.has(t))
2200
+ return this.#e.get(t);
2201
+ const n = new ve(
2202
+ [...this.path, t],
2203
+ (s) => {
2204
+ this.change(s);
2205
+ },
2206
+ this.value.map(
2207
+ (s) => r.detect(s) ? s : r.defaultValue(),
2208
+ oe
2209
+ ),
2210
+ this.status.map(Fe([t])),
2211
+ {
2212
+ disabled: this.disabled,
2213
+ validationMode: this.parent.validationMode
2214
+ },
2215
+ oe
2216
+ );
2217
+ return this.#e.set(t, n), n;
2218
+ }
2219
+ /**
2220
+ * Switch to a different branch
2221
+ */
2222
+ switchToBranch(t, r = !1) {
2223
+ const n = this.branches.find((a) => a.key === t);
2224
+ if (!n)
2225
+ throw new Error(`Unknown branch: ${t}`);
2226
+ const s = i.get(this.value);
2227
+ if (n.detect(s))
2228
+ return !0;
2229
+ if (n.convert) {
2230
+ const a = n.convert(s);
2231
+ if (a.ok)
2232
+ return this.change(a.value), !0;
2233
+ }
2234
+ if (r && typeof window == "object" && typeof window.confirm == "function" && !window.confirm(
2235
+ "Changing type will clear the current value. Continue?"
2236
+ ))
2237
+ return !1;
2238
+ const o = n.defaultValue();
2239
+ return this.change(o), !0;
2240
+ }
2241
+ /**
2242
+ * Get the current active branch definition
2243
+ */
2244
+ get activeBranchDefinition() {
2245
+ const t = i.get(this.activeBranch);
2246
+ return this.branches.find((r) => r.key === t);
2247
+ }
2248
+ }
2249
+ function Ln(e) {
2250
+ return e.transform(
2251
+ (t) => t ?? null,
2252
+ (t) => t ?? void 0
2253
+ );
2254
+ }
2255
+ function En(e) {
2256
+ return e.transform(
2257
+ (t) => t ?? "",
2258
+ (t) => t === "" ? void 0 : t
2259
+ );
2260
+ }
2261
+ function Un(e) {
2262
+ return e.transform(
2263
+ (t) => t ?? void 0,
2264
+ (t) => t ?? null
2265
+ );
2266
+ }
2267
+ function tn(e) {
2268
+ switch (e) {
2269
+ case "success":
2270
+ return "material-symbols:check-circle-outline";
2271
+ case "warning":
2272
+ return "material-symbols:warning-outline";
2273
+ case "error":
2274
+ return "material-symbols:error-outline";
2275
+ case "info":
2276
+ default:
2277
+ return "material-symbols:info-outline";
2278
+ }
2279
+ }
2280
+ function nn(e) {
2281
+ switch (e) {
2282
+ case "success":
2283
+ return "success";
2284
+ case "warning":
2285
+ return "warning";
2286
+ case "error":
2287
+ return "error";
2288
+ case "info":
2289
+ default:
2290
+ return "info";
2291
+ }
2292
+ }
2293
+ function sn(e, t, r, n) {
2294
+ const s = [
2295
+ "bc-notice",
2296
+ `bc-notice--${e}`,
2297
+ `bc-notice--tone-${t}`
2298
+ ];
2299
+ return r && s.push("bc-notice--dismissible"), n && n.length > 0 && s.push(n), s.join(" ");
2300
+ }
2301
+ function Nn({
2302
+ variant: e = "info",
2303
+ tone: t = "subtle",
2304
+ role: r,
2305
+ title: n,
2306
+ icon: s,
2307
+ closable: o = !1,
2308
+ onDismiss: a,
2309
+ class: u
2310
+ }, ...c) {
2311
+ const p = i.map(
2312
+ o,
2313
+ (w) => !!w || a != null
2314
+ ), h = i.map(e, (w) => w ?? "info"), d = i.map(t, (w) => w ?? "subtle"), g = V(
2315
+ r,
2316
+ h
2317
+ )((w, _) => w ?? (_ === "error" ? "alert" : "status")), f = K(!0), m = R(
2318
+ W,
2319
+ (w) => $.div(
2320
+ l.class(
2321
+ V(
2322
+ h,
2323
+ d,
2324
+ p,
2325
+ u
2326
+ )((_, b, x, S) => sn(_, b, x, S))
2327
+ ),
2328
+ // Accessibility role mapping (always defined)
2329
+ l.role(i.map(g, (_) => _)),
2330
+ et(
2331
+ i.map(s, (_) => _ === !1),
2332
+ () => $.div(
2333
+ l.class("bc-notice__icon"),
2334
+ N({
2335
+ icon: V(
2336
+ s,
2337
+ h
2338
+ )((_, b) => _ === void 0 ? tn(b) : String(_)),
2339
+ size: "md",
2340
+ color: i.map(h, nn)
2341
+ })
2342
+ )
2343
+ ),
2344
+ $.div(
2345
+ l.class("bc-notice__body"),
2346
+ Ne(n, (_) => $.div(l.class("bc-notice__title"), _)),
2347
+ $.div(l.class("bc-notice__content"), ...c)
2348
+ ),
2349
+ E(
2350
+ p,
2351
+ () => me({
2352
+ size: "xs",
2353
+ label: w.$.closeModal,
2354
+ onClick: () => {
2355
+ f.set(!1), a?.();
2356
+ }
2357
+ })
2358
+ )
2359
+ )
2360
+ );
2361
+ return E(f, () => m);
2362
+ }
2363
+ export {
2364
+ Sn as A,
2365
+ pn as B,
2366
+ dn as C,
2367
+ Tn as D,
2368
+ Vt as E,
2369
+ wt as F,
2370
+ Dn as G,
2371
+ An as H,
2372
+ en as I,
2373
+ Fn as J,
2374
+ hn as K,
2375
+ Bn as L,
2376
+ We as M,
2377
+ Ut as N,
2378
+ mn as O,
2379
+ Lt as P,
2380
+ Nn as Q,
2381
+ Xt as R,
2382
+ fn as S,
2383
+ Ht as T,
2384
+ Be as U,
2385
+ qt as V,
2386
+ Gt as W,
2387
+ cn as X,
2388
+ un as _,
2389
+ X as a,
2390
+ Vn as b,
2391
+ En as c,
2392
+ Kt as d,
2393
+ Z as e,
2394
+ pt as f,
2395
+ Un as g,
2396
+ _t as h,
2397
+ Ct as i,
2398
+ bn as j,
2399
+ zt as k,
2400
+ Nt as l,
2401
+ gn as m,
2402
+ re as n,
2403
+ vn as o,
2404
+ xn as p,
2405
+ _n as q,
2406
+ $n as r,
2407
+ yn as s,
2408
+ Ln as t,
2409
+ wn as u,
2410
+ In as v,
2411
+ Cn as w,
2412
+ kn as x,
2413
+ Wt as y,
2414
+ Mn as z
2415
+ };