@tempots/beatui 0.68.0 → 0.71.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 (98) hide show
  1. package/dist/{ar-aMLQTGVh.js → ar-BbgpGwJp.js} +1 -1
  2. package/dist/auth/index.cjs.js +1 -1
  3. package/dist/auth/index.es.js +106 -105
  4. package/dist/beatui.css +401 -0
  5. package/dist/beatui.tailwind.css +401 -0
  6. package/dist/{de-DBFOC44R.js → de-R7lPfyZ4.js} +1 -1
  7. package/dist/deep-merge-CQQCMLwG.js +1636 -0
  8. package/dist/deep-merge-DZxfgKqX.cjs +1 -0
  9. package/dist/duration-input-D-SIoDoo.cjs +1 -0
  10. package/dist/duration-input-DKxZ6OCa.js +277 -0
  11. package/dist/{es-C4xOThaT.js → es-DV0Jr_BZ.js} +1 -1
  12. package/dist/{fa-B7X_xydY.js → fa-DXvHejs9.js} +1 -1
  13. package/dist/{fr-AmjzbxN_.js → fr-D8FOMX0o.js} +1 -1
  14. package/dist/{he-DY-9yiOC.js → he-B19Qsx-u.js} +1 -1
  15. package/dist/{hi-Clkyp5Fu.js → hi-DozFnE3b.js} +1 -1
  16. package/dist/{index-GLoRnI6r.js → index-CYb1YxDX.js} +1 -1
  17. package/dist/{index-CzuXAuLZ.js → index-DdpYvBeh.js} +3 -3
  18. package/dist/index.cjs.js +4 -4
  19. package/dist/index.es.js +2830 -3079
  20. package/dist/{it-BC32WmGF.js → it-But8uzNi.js} +1 -1
  21. package/dist/{ja-JNSZS_Hv.js → ja-DkwTnFdU.js} +1 -1
  22. package/dist/json-schema/index.cjs.js +6 -6
  23. package/dist/json-schema/index.es.js +3459 -3333
  24. package/dist/json-structure/index.cjs.js +1 -0
  25. package/dist/json-structure/index.es.js +3157 -0
  26. package/dist/{ko-B8l0TJp0.js → ko-Cqv-IjhX.js} +1 -1
  27. package/dist/modal-5P9mU_a4.cjs +1 -0
  28. package/dist/{modal-DJWj5M5e.js → modal-MofsfmAe.js} +2 -2
  29. package/dist/{nl-BpYESHP8.js → nl-YSiU3rFI.js} +1 -1
  30. package/dist/notice-Cqq8g17n.js +209 -0
  31. package/dist/notice-DP209Ed8.cjs +1 -0
  32. package/dist/{pl-_sWhGdrs.js → pl-DXmHc2Nh.js} +1 -1
  33. package/dist/prosemirror/index.es.js +1 -1
  34. package/dist/{pt-BmiQvHUz.js → pt-Bf3z_-26.js} +1 -1
  35. package/dist/{ru-DacnqexG.js → ru-Sy00qUeG.js} +1 -1
  36. package/dist/tailwind/vite-plugin.es.js +1 -0
  37. package/dist/{toolbar-Bk5-22ln.js → toolbar-C_Ec0_XC.js} +1 -1
  38. package/dist/{tr-BSS5b_v6.js → tr-BDxG3qd6.js} +1 -1
  39. package/dist/{translations-zGwuSQWQ.js → translations-BmsRhth7.js} +1 -1
  40. package/dist/{translations-BUTBIDsS.js → translations-DQxouiBG.js} +24 -24
  41. package/dist/types/components/form/index.d.ts +1 -0
  42. package/dist/types/components/form/utils/deep-merge.d.ts +27 -0
  43. package/dist/types/components/form/utils/index.d.ts +1 -0
  44. package/dist/types/components/json-schema/controls/generic-control.d.ts +2 -1
  45. package/dist/types/components/json-schema/controls/shared-utils.d.ts +17 -1
  46. package/dist/types/components/json-schema/index.d.ts +2 -0
  47. package/dist/types/components/json-schema/json-schema-form.d.ts +25 -3
  48. package/dist/types/components/json-schema/schema-context.d.ts +3 -0
  49. package/dist/types/components/json-schema/schema-defaults.d.ts +39 -0
  50. package/dist/types/components/json-schema/widgets/widget-customization.d.ts +55 -0
  51. package/dist/types/components/json-structure/controls/any-control.d.ts +15 -0
  52. package/dist/types/components/json-structure/controls/array-control.d.ts +15 -0
  53. package/dist/types/components/json-structure/controls/binary-control.d.ts +15 -0
  54. package/dist/types/components/json-structure/controls/boolean-control.d.ts +15 -0
  55. package/dist/types/components/json-structure/controls/choice-control.d.ts +19 -0
  56. package/dist/types/components/json-structure/controls/decimal-control.d.ts +17 -0
  57. package/dist/types/components/json-structure/controls/deprecation-utils.d.ts +14 -0
  58. package/dist/types/components/json-structure/controls/enum-const-controls.d.ts +22 -0
  59. package/dist/types/components/json-structure/controls/generic-control.d.ts +31 -0
  60. package/dist/types/components/json-structure/controls/index.d.ts +21 -0
  61. package/dist/types/components/json-structure/controls/integer-control.d.ts +18 -0
  62. package/dist/types/components/json-structure/controls/map-control.d.ts +17 -0
  63. package/dist/types/components/json-structure/controls/object-control.d.ts +17 -0
  64. package/dist/types/components/json-structure/controls/set-control.d.ts +15 -0
  65. package/dist/types/components/json-structure/controls/string-control.d.ts +15 -0
  66. package/dist/types/components/json-structure/controls/temporal-control.d.ts +18 -0
  67. package/dist/types/components/json-structure/controls/tuple-control.d.ts +19 -0
  68. package/dist/types/components/json-structure/controls/union-control.d.ts +15 -0
  69. package/dist/types/components/json-structure/controls/uri-control.d.ts +15 -0
  70. package/dist/types/components/json-structure/controls/uuid-control.d.ts +15 -0
  71. package/dist/types/components/json-structure/extends-utils.d.ts +36 -0
  72. package/dist/types/components/json-structure/index.d.ts +25 -0
  73. package/dist/types/components/json-structure/json-structure-form.d.ts +96 -0
  74. package/dist/types/components/json-structure/ref-utils.d.ts +55 -0
  75. package/dist/types/components/json-structure/structure-context.d.ts +176 -0
  76. package/dist/types/components/json-structure/structure-defaults.d.ts +46 -0
  77. package/dist/types/components/json-structure/structure-types.d.ts +173 -0
  78. package/dist/types/components/json-structure/validation/error-transform.d.ts +56 -0
  79. package/dist/types/components/json-structure/validation/index.d.ts +5 -0
  80. package/dist/types/components/json-structure/validation/sdk-validator.d.ts +46 -0
  81. package/dist/types/components/json-structure/widgets/default-widgets.d.ts +27 -0
  82. package/dist/types/components/json-structure/widgets/index.d.ts +6 -0
  83. package/dist/types/components/json-structure/widgets/widget-registry.d.ts +143 -0
  84. package/dist/types/components/json-structure/widgets/widget-utils.d.ts +79 -0
  85. package/dist/types/index.d.ts +1 -0
  86. package/dist/types/json-structure/index.d.ts +9 -0
  87. package/dist/{ur-C6Ky6OCl.js → ur-55zdT2TQ.js} +1 -1
  88. package/dist/{notice-Um1LwKBF.js → use-form-B7A865EM.js} +329 -532
  89. package/dist/use-form-DVJXMMoN.cjs +2 -0
  90. package/dist/{vi-Bx2gx2S0.js → vi-C7K7W0hM.js} +1 -1
  91. package/dist/widget-customization-29Hl2gKT.js +1171 -0
  92. package/dist/widget-customization-BXiewbt-.cjs +1 -0
  93. package/dist/{zh-eixtg-Ce.js → zh-DvJBV9D8.js} +1 -1
  94. package/package.json +10 -2
  95. package/dist/modal-D_paG9Sr.cjs +0 -1
  96. package/dist/notice-CgT9ma2m.cjs +0 -2
  97. package/dist/utils-7JQljUYX.js +0 -2554
  98. package/dist/utils-CPtkOy9f.cjs +0 -1
@@ -0,0 +1,1636 @@
1
+ import { Use as F, Value as p, prop as ae, html as v, attr as l, on as $, WithElement as te, Empty as T, aria as G, bind as oe, computedOf as V, style as we, OnDispose as ne, When as U, NotEmpty as Oe, Fragment as E, ForEach as K, coalesce as Fe, Ensure as Ne, OneOfType as Re, Repeat as je, signal as _e, input as le, emitValue as j, emitValueAsNumber as ke, Task as Ce } from "@tempots/dom";
2
+ import { f as Pe } from "./colors-pQZlNrwM.js";
3
+ import { g as We } from "./timer-DzWb416P.js";
4
+ import { ElementRect as Ze } from "@tempots/ui";
5
+ import { a as N, b as W, f as $e, c as O, C as Y, I as He, g as ge, h as Ye, B as pe } from "./translations-DQxouiBG.js";
6
+ import { C as ce, m as qe, d as Ge, I as Ae, S as ee, e as fe, O as Q, f as Ie } from "./use-form-B7A865EM.js";
7
+ class Je extends Error {
8
+ constructor(e = "Missing implementation") {
9
+ super(e), this.name = "MissingImplementationError";
10
+ }
11
+ }
12
+ const _t = (t) => Xe(t).split("_").join(" "), Xe = (t) => (t = t.replace(/::/g, "/"), t = t.replace(/([A-Z]+)([A-Z][a-z])/g, "$1_$2"), t = t.replace(/([a-z\d])([A-Z])/g, "$1_$2"), t = t.replace(/-/g, "_"), t.toLowerCase()), kt = (t) => t.substring(0, 1).toUpperCase() + t.substring(1), Ct = (t) => {
13
+ if (typeof Buffer < "u")
14
+ return Buffer.from(t, "base64").toString("utf8");
15
+ if (typeof atob < "u")
16
+ return atob(t);
17
+ throw new Je(
18
+ "No implementation found for base64 decoding"
19
+ );
20
+ };
21
+ function de({
22
+ onChange: t,
23
+ value: e,
24
+ accept: n = "*/*",
25
+ enableClick: s = !0,
26
+ content: r,
27
+ disabled: b = !1,
28
+ allowMultiple: i
29
+ }) {
30
+ return F(N, (g) => {
31
+ const f = p.deriveProp(e ?? []), m = ae(!1), a = (c) => {
32
+ c.preventDefault(), c.stopPropagation(), m.value = !0;
33
+ }, h = (c) => {
34
+ c.preventDefault(), c.stopPropagation(), (!c.currentTarget || !c.currentTarget.contains(c.relatedTarget)) && (m.value = !1);
35
+ }, _ = (c) => {
36
+ c.preventDefault(), c.stopPropagation(), m.value = !1;
37
+ const d = Array.from(c.dataTransfer?.files || []);
38
+ d.length > 0 && (f.value = d, t(d, "dragdrop"));
39
+ }, u = (c) => {
40
+ p.get(s) && c.currentTarget.querySelector(
41
+ 'input[type="file"]'
42
+ )?.click();
43
+ };
44
+ let x = null;
45
+ const y = () => {
46
+ if (x == null) return;
47
+ const c = Array.from(x.files ?? []);
48
+ c.length > 0 && (f.value = c, t(c, "click")), x.value = "";
49
+ }, I = (c) => {
50
+ p.get(s) && (c.key === "Enter" || c.key === " ") && (c.preventDefault(), u(c));
51
+ };
52
+ return v.div(
53
+ l.role("button"),
54
+ l.tabindex(
55
+ p.map(s, (c) => c ? 0 : -1)
56
+ ),
57
+ l.style("position: relative;"),
58
+ $.dragover(a),
59
+ $.dragleave(h),
60
+ $.drop(_),
61
+ $.click(u),
62
+ $.keydown(I),
63
+ // Hidden file input
64
+ v.input(
65
+ l.type("file"),
66
+ l.disabled(b),
67
+ l.accept(n),
68
+ l.multiple(i),
69
+ l.style(
70
+ "position: absolute; left: -9999px; opacity: 0; pointer-events: none;"
71
+ ),
72
+ $.change(y),
73
+ te((c) => (x = c, f.on((d) => {
74
+ const D = globalThis.DataTransfer;
75
+ if (D != null) {
76
+ const z = new D();
77
+ d.forEach((B) => z.items.add(B)), c.files = z.files;
78
+ }
79
+ }), T))
80
+ ),
81
+ // Screen reader instructions
82
+ G.label(oe(g.$.dropZoneInstructions)(s)),
83
+ // Content
84
+ r({ files: f, clear: () => f.value = [], change: f.set })
85
+ );
86
+ });
87
+ }
88
+ function Qe(t, e) {
89
+ return t.length === e.length && t.every((n, s) => n === e[s]);
90
+ }
91
+ function Ke(t, e) {
92
+ const n = ["bc-segmented-input", `bc-segmented-input--size-${t}`];
93
+ return e && n.push("bc-segmented-input--disabled"), n.join(" ");
94
+ }
95
+ function $t({
96
+ options: t,
97
+ value: e,
98
+ onChange: n,
99
+ size: s = "md",
100
+ disabled: r = !1
101
+ }, ...b) {
102
+ const i = Pe(t).map(([g, f]) => ({
103
+ key: g,
104
+ label: f
105
+ }));
106
+ return te(() => {
107
+ const g = Object.fromEntries(
108
+ i.map((m, a) => [m.key, a])
109
+ ), f = ae(
110
+ i.map(() => ({ left: 0, width: 0 })),
111
+ Qe
112
+ );
113
+ return v.div(
114
+ l.class(
115
+ V(
116
+ s,
117
+ r
118
+ )(
119
+ (m, a) => Ke(m ?? "md", a ?? !1)
120
+ )
121
+ ),
122
+ v.div(
123
+ l.class("bc-segmented-input__container"),
124
+ v.div(
125
+ l.class("bc-segmented-input__indicator"),
126
+ we.width(
127
+ V(
128
+ e,
129
+ f
130
+ )((m, a) => {
131
+ const { width: h } = a[g[m] ?? 0];
132
+ return `${h}px`;
133
+ })
134
+ ),
135
+ we.left(
136
+ V(
137
+ e,
138
+ f
139
+ )((m, a) => {
140
+ const { left: h } = a[g[m] ?? 0];
141
+ return `${h}px`;
142
+ })
143
+ )
144
+ ),
145
+ // clickable buttons
146
+ i.map(({ label: m, key: a }, h) => v.button(
147
+ l.type("button"),
148
+ $.click((_) => {
149
+ _.preventDefault(), p.get(r) || n?.(a);
150
+ }),
151
+ l.disabled(r),
152
+ l.class("bc-segmented-input__segment"),
153
+ l.class(
154
+ p.map(e, (_) => _ === a ? "bc-segmented-input__segment--active" : "bc-segmented-input__segment--inactive")
155
+ ),
156
+ Ze((_) => {
157
+ function u() {
158
+ f.update((y) => {
159
+ const I = [...y];
160
+ return I[h] = {
161
+ width: _.value.width,
162
+ left: _.value.localLeft
163
+ }, I;
164
+ });
165
+ }
166
+ const x = We(u);
167
+ return ne(x, _.on(u));
168
+ }),
169
+ m
170
+ ))
171
+ ),
172
+ ...b
173
+ );
174
+ });
175
+ }
176
+ function et(t) {
177
+ const e = t.type.toLowerCase();
178
+ return e.startsWith("image/") && (e.includes("jpeg") || e.includes("jpg") || e.includes("png") || e.includes("gif") || e.includes("webp") || e.includes("svg"));
179
+ }
180
+ function tt(t) {
181
+ const e = t.type.toLowerCase();
182
+ return e.startsWith("image/") ? "vscode-icons:file-type-image" : e.startsWith("video/") ? "vscode-icons:file-type-video" : e.startsWith("audio/") ? "vscode-icons:file-type-audio" : e.includes("pdf") ? "vscode-icons:file-type-pdf2" : e.includes("word") || e.includes("document") ? "vscode-icons:file-type-word" : e.includes("excel") || e.includes("spreadsheet") ? "vscode-icons:file-type-excel" : e.includes("powerpoint") || e.includes("presentation") ? "vscode-icons:file-type-powerpoint" : e.includes("zip") || e.includes("archive") ? "vscode-icons:file-type-zip" : e.includes("text") ? "vscode-icons:file-type-text" : e.includes("json") ? "vscode-icons:file-type-json-official" : e.includes("csv") ? "vscode-icons:file-type-csv" : e.includes("xml") ? "vscode-icons:file-type-xml" : e.includes("yaml") ? "vscode-icons:file-type-yaml-official" : "vscode-icons:file-type-binary";
183
+ }
184
+ function me(t) {
185
+ return U(
186
+ t.map(et),
187
+ () => {
188
+ const e = ae(null);
189
+ return t.on((n) => {
190
+ e.value && URL.revokeObjectURL(e.value);
191
+ const s = URL.createObjectURL(n);
192
+ e.value = s;
193
+ }), v.div(
194
+ ne(() => {
195
+ e.value && URL.revokeObjectURL(e.value);
196
+ }),
197
+ l.class("bc-file-input__thumbnail-container"),
198
+ v.img(
199
+ l.src(e),
200
+ l.alt(t.map((n) => n.name)),
201
+ l.class("bc-file-input__thumbnail")
202
+ )
203
+ );
204
+ },
205
+ () => O({ icon: t.map(tt) })
206
+ );
207
+ }
208
+ const It = (t, ...e) => {
209
+ const {
210
+ value: n = ae([]),
211
+ accept: s = "*/*",
212
+ maxFiles: r,
213
+ maxFileSize: b,
214
+ onChange: i,
215
+ onBlur: g,
216
+ disabled: f,
217
+ hasError: m,
218
+ mode: a = "default",
219
+ showFileList: h = !0,
220
+ ..._
221
+ } = t, u = n, x = p.map(a, (C) => C === "input"), y = p.map(a, (C) => C === "compact"), I = (C) => {
222
+ let o = C;
223
+ if (r != null) {
224
+ const w = p.get(r);
225
+ o = o.slice(0, w);
226
+ }
227
+ if (b) {
228
+ const w = p.get(b);
229
+ o = o.filter((S) => S.size <= w);
230
+ }
231
+ i?.(o);
232
+ }, c = (C) => {
233
+ const w = u.value.filter((S, M) => M !== C);
234
+ i?.(w);
235
+ }, d = () => {
236
+ i?.([]);
237
+ }, D = ({
238
+ files: C,
239
+ clear: o,
240
+ change: w
241
+ }) => F(
242
+ N,
243
+ (S) => v.div(
244
+ l.class("bc-file-input__drop-zone"),
245
+ v.div(
246
+ l.class(
247
+ "bc-file-input__drop-zone-content bc-file-input__drop-zone-content--empty"
248
+ ),
249
+ O({ icon: "mdi:cloud-upload-outline", size: "xl" }),
250
+ v.div(
251
+ l.class("bc-file-input__drop-zone-text"),
252
+ oe(S.$.filesInputInstructions)(
253
+ r,
254
+ b,
255
+ S.$.fileSizeUnits.value
256
+ )
257
+ )
258
+ )
259
+ )
260
+ ), z = ({
261
+ files: C
262
+ }) => F(
263
+ N,
264
+ (o) => v.div(
265
+ l.class("bc-file-input__compact-drop-zone"),
266
+ U(
267
+ C.map((w) => w.length > 0),
268
+ () => v.div(
269
+ l.class("bc-file-input__compact-file-list"),
270
+ K(C, (w, S) => {
271
+ const M = S.index;
272
+ return v.div(
273
+ l.class("bc-file-input__compact-file-item"),
274
+ v.div(
275
+ l.class("bc-file-input__compact-file-icon"),
276
+ me(w)
277
+ ),
278
+ v.div(
279
+ l.class("bc-file-input__compact-file-info"),
280
+ v.div(
281
+ l.class("bc-file-input__compact-file-name"),
282
+ l.title(w.$.name),
283
+ w.$.name
284
+ ),
285
+ v.div(
286
+ l.class("bc-file-input__compact-file-meta"),
287
+ V(
288
+ w.$.size,
289
+ o.$.fileSizeUnits
290
+ )((k, A) => $e(k, { units: A })),
291
+ " • ",
292
+ V(
293
+ w.$.type,
294
+ o.$.unknownType
295
+ )((k, A) => k || A)
296
+ )
297
+ ),
298
+ ce(
299
+ {
300
+ size: "sm",
301
+ label: o.$.removeFile,
302
+ disabled: f,
303
+ onClick: () => c(M)
304
+ },
305
+ l.class("bc-file-input__compact-remove-button")
306
+ )
307
+ );
308
+ })
309
+ ),
310
+ () => v.div(
311
+ l.class("bc-file-input__compact-placeholder"),
312
+ O({ icon: "mdi:cloud-upload-outline", size: "lg" }),
313
+ v.div(
314
+ l.class("bc-file-input__compact-placeholder-text"),
315
+ oe(o.$.filesInputInstructions)(
316
+ r,
317
+ b,
318
+ o.$.fileSizeUnits.value
319
+ )
320
+ )
321
+ )
322
+ )
323
+ )
324
+ ), B = ({
325
+ files: C
326
+ }) => F(
327
+ N,
328
+ (o) => v.div(
329
+ l.class("bc-file-input__compact-input"),
330
+ U(
331
+ C.map((w) => w.length > 0),
332
+ () => v.span(
333
+ l.class("bc-file-input__compact-value"),
334
+ K(
335
+ C,
336
+ (w) => v.span(
337
+ l.class("bc-file-input__compact-value-item"),
338
+ me(w),
339
+ v.span(
340
+ l.class("bc-file-input__compact-value-item-name"),
341
+ w.$.name
342
+ )
343
+ )
344
+ )
345
+ ),
346
+ () => v.span(
347
+ l.class("bc-file-input__compact-placeholder"),
348
+ O({ icon: "mdi:cloud-upload-outline", size: "md" }),
349
+ " ",
350
+ oe(o.$.filesInputInstructions)(
351
+ r,
352
+ b,
353
+ o.$.fileSizeUnits.value
354
+ )
355
+ )
356
+ )
357
+ )
358
+ );
359
+ return F(
360
+ N,
361
+ (C) => W(
362
+ {
363
+ baseContainer: p.map(x, (o) => !o),
364
+ disabled: f,
365
+ hasError: m,
366
+ after: U(
367
+ x,
368
+ () => U(
369
+ u.map(({ length: o }) => o > 0),
370
+ () => ce(
371
+ {
372
+ size: "sm",
373
+ label: C.$.clearAllFiles,
374
+ disabled: f,
375
+ onClick: d
376
+ },
377
+ l.class("bc-file-input__compact-clear")
378
+ )
379
+ )
380
+ ),
381
+ ..._,
382
+ input: U(
383
+ x,
384
+ () => v.div(
385
+ l.class("bc-file-input bc-file-input--input"),
386
+ de({
387
+ value: u,
388
+ accept: s,
389
+ enableClick: !0,
390
+ allowMultiple: p.map(r ?? 1 / 0, (o) => o > 1),
391
+ disabled: f,
392
+ onChange: I,
393
+ content: B
394
+ })
395
+ ),
396
+ () => U(
397
+ y,
398
+ () => v.div(
399
+ l.class("bc-file-input bc-file-input--compact"),
400
+ de({
401
+ value: u,
402
+ accept: s,
403
+ enableClick: !0,
404
+ allowMultiple: p.map(r ?? 1 / 0, (o) => o > 1),
405
+ disabled: f,
406
+ onChange: I,
407
+ content: z
408
+ })
409
+ ),
410
+ () => v.div(
411
+ l.class("bc-file-input"),
412
+ de({
413
+ value: u,
414
+ accept: s,
415
+ enableClick: !0,
416
+ allowMultiple: p.map(r ?? 1 / 0, (o) => o > 1),
417
+ disabled: f,
418
+ onChange: I,
419
+ content: D
420
+ }),
421
+ U(
422
+ h,
423
+ () => Oe(
424
+ u,
425
+ () => E(
426
+ v.div(
427
+ l.class("bc-file-input__file-list"),
428
+ K(u, (o, w) => {
429
+ const S = w.index;
430
+ return v.div(
431
+ l.class("bc-file-input__file-item"),
432
+ v.div(
433
+ l.class("bc-file-input__file-icon"),
434
+ me(o)
435
+ ),
436
+ v.div(
437
+ l.class("bc-file-input__file-info"),
438
+ v.div(
439
+ l.class("bc-file-input__file-name"),
440
+ l.title(o.$.name),
441
+ o.$.name
442
+ ),
443
+ v.div(
444
+ l.class("bc-file-input__file-meta"),
445
+ V(
446
+ o.$.size,
447
+ C.$.fileSizeUnits
448
+ )(
449
+ (M, k) => $e(M, { units: k })
450
+ ),
451
+ " • ",
452
+ V(
453
+ o.$.type,
454
+ C.$.unknownType
455
+ )((M, k) => M || k)
456
+ )
457
+ ),
458
+ ce(
459
+ {
460
+ size: "sm",
461
+ label: C.$.removeFile,
462
+ disabled: f,
463
+ onClick: () => c(S)
464
+ },
465
+ l.class("bc-file-input__remove-button")
466
+ )
467
+ );
468
+ })
469
+ ),
470
+ U(
471
+ u.map(({ length: o }) => o > 1),
472
+ () => v.div(
473
+ l.class(
474
+ "bc-file-input__clear-all-button-container"
475
+ ),
476
+ v.button(
477
+ l.type("button"),
478
+ l.class("bc-file-input__clear-all-button"),
479
+ l.disabled(f),
480
+ C.$.clearAllFiles,
481
+ $.click((o) => {
482
+ o.preventDefault(), o.stopPropagation(), d();
483
+ })
484
+ )
485
+ )
486
+ )
487
+ )
488
+ )
489
+ )
490
+ )
491
+ )
492
+ )
493
+ },
494
+ ...e
495
+ )
496
+ );
497
+ }, ve = "$$tts-exp-", nt = (t, e) => te((n) => {
498
+ const s = `${ve}${t}`;
499
+ return ne(p.on(e, (r) => Reflect.set(n, s, r)));
500
+ }), Dt = (t, e) => {
501
+ const n = `${ve}${t}`;
502
+ return (s) => {
503
+ e(Reflect.get(s.target, n));
504
+ };
505
+ }, lt = (t, e) => {
506
+ const n = `${ve}${t}`;
507
+ return (s) => {
508
+ const r = s.target, b = r.selectedIndex, i = r.options[b];
509
+ e(Reflect.get(i, n));
510
+ };
511
+ };
512
+ function re(...t) {
513
+ return v.div(l.class("bc-group"), ...t);
514
+ }
515
+ const Be = (t, e, n) => Ne(
516
+ t,
517
+ (s) => Re(s, {
518
+ value: (r) => {
519
+ const b = V(
520
+ r,
521
+ n
522
+ )((i, g) => e(i.value, g));
523
+ return v.option(
524
+ l.selected(b),
525
+ nt("value", r.$.value),
526
+ r.$.label
527
+ );
528
+ },
529
+ group: (r) => v.optgroup(
530
+ l.label(r.$.group),
531
+ K(
532
+ r.$.options,
533
+ (b) => Be(
534
+ b,
535
+ e,
536
+ n
537
+ )
538
+ )
539
+ ),
540
+ break: () => v.hr()
541
+ })
542
+ ), st = (t) => {
543
+ const {
544
+ value: e,
545
+ onBlur: n,
546
+ onChange: s,
547
+ options: r,
548
+ unselectedLabel: b,
549
+ equality: i = (m, a) => m === a,
550
+ after: g
551
+ } = t;
552
+ let f;
553
+ return W(
554
+ {
555
+ ...t,
556
+ after: E(
557
+ He({
558
+ icon: "ph:caret-down-bold",
559
+ color: "neutral",
560
+ size: "sm"
561
+ }),
562
+ g
563
+ ),
564
+ input: v.select(
565
+ te((m) => {
566
+ f = m;
567
+ const a = new MutationObserver((h) => {
568
+ const { removedNodes: _ } = h[0];
569
+ _.length > 0 && (f.selectedIndex = 0);
570
+ });
571
+ return a.observe(m, { childList: !0 }), ne(() => a.disconnect());
572
+ }),
573
+ Y(t),
574
+ l.class("bc-native-select bc-input"),
575
+ F(
576
+ N,
577
+ (m) => v.option(
578
+ l.hidden("hidden"),
579
+ Fe(b, m.$.selectOne)
580
+ )
581
+ ),
582
+ K(r, (m) => Be(m, i, e)),
583
+ n != null ? $.blur(n) : T,
584
+ s != null ? $.change(lt("value", (m) => s(m))) : T
585
+ )
586
+ },
587
+ $.click(() => {
588
+ if (f?.focus(), typeof f?.showPicker == "function")
589
+ try {
590
+ f.showPicker();
591
+ } catch {
592
+ }
593
+ })
594
+ );
595
+ };
596
+ function rt(t) {
597
+ const { controller: e, onChange: n, onBlur: s, ...r } = t;
598
+ return st({
599
+ ...r,
600
+ value: e.signal,
601
+ onChange: Ge(e, n),
602
+ onBlur: qe(e, s)
603
+ });
604
+ }
605
+ function zt(t) {
606
+ return Ae({
607
+ ...t,
608
+ content: rt(t)
609
+ });
610
+ }
611
+ function it(t, e, n) {
612
+ const s = t.length.map((r) => r);
613
+ return E(
614
+ je(
615
+ s,
616
+ (r) => {
617
+ const b = t.item(r.index), i = [];
618
+ return E(
619
+ ne(() => {
620
+ i.forEach((g) => g());
621
+ }),
622
+ e({
623
+ list: t,
624
+ item: b,
625
+ position: r,
626
+ remove: () => t.removeAt(r.index),
627
+ move: (g) => {
628
+ switch (g) {
629
+ case "up":
630
+ if (r.index === 0) return;
631
+ t.move(r.index, r.index - 1);
632
+ break;
633
+ case "down":
634
+ if (r.index === t.length.value - 1) return;
635
+ t.move(r.index, r.index + 1);
636
+ break;
637
+ case "first":
638
+ t.move(r.index, 0);
639
+ break;
640
+ case "last":
641
+ t.move(r.index, t.length.value - 1);
642
+ }
643
+ },
644
+ canMove: (g) => {
645
+ const f = (() => {
646
+ switch (g) {
647
+ case "up":
648
+ return _e(r.index > 0);
649
+ case "down":
650
+ return t.length.map((m) => r.index < m - 1);
651
+ }
652
+ })();
653
+ return i.push(() => f.dispose()), f;
654
+ },
655
+ cannotMove: (g) => {
656
+ const f = (() => {
657
+ switch (g) {
658
+ case "up":
659
+ return _e(r.index === 0);
660
+ case "down":
661
+ return t.length.map((m) => r.index === m - 1);
662
+ }
663
+ })();
664
+ return i.push(() => f.dispose()), f;
665
+ }
666
+ })
667
+ );
668
+ },
669
+ n
670
+ )
671
+ );
672
+ }
673
+ const De = {
674
+ 9: { pattern: /^[0-9]$/ },
675
+ A: { pattern: /^[A-Za-z]$/, transform: (t) => t.toUpperCase() },
676
+ "*": { pattern: /^.$/ }
677
+ }, ot = (t) => t instanceof RegExp;
678
+ function Ve(t, e, n) {
679
+ if (t == null) return [];
680
+ const s = n ? { ...De, ...e } : e ?? De, r = (i, g) => {
681
+ const f = s[g];
682
+ f ? i.push({ type: "pattern", name: g, ...f }) : i.push({ type: "literal", char: g });
683
+ }, b = [];
684
+ if (typeof t == "string") {
685
+ for (const i of t) r(b, i);
686
+ return b;
687
+ }
688
+ for (const i of t)
689
+ if (typeof i == "string")
690
+ if (i.length <= 1) r(b, i);
691
+ else for (const g of i) r(b, g);
692
+ else ot(i) ? b.push({ type: "pattern", pattern: i }) : typeof i == "object" && i && b.push(i);
693
+ return b;
694
+ }
695
+ function ct(t, e) {
696
+ return (n) => {
697
+ switch (t) {
698
+ case "digits":
699
+ return /[0-9]/.test(n);
700
+ case "letters":
701
+ return /[A-Za-z]/.test(n);
702
+ case "alphanumeric":
703
+ return /[A-Za-z0-9]/.test(n);
704
+ case "custom":
705
+ return e?.(n) ?? !0;
706
+ default:
707
+ return !0;
708
+ }
709
+ };
710
+ }
711
+ function ze(t, e, n, s, r, b) {
712
+ const i = {
713
+ raw: t,
714
+ previousConformed: e,
715
+ cursor: r ?? t.length,
716
+ completed: !1
717
+ }, g = s.definitions ?? {}, f = typeof n == "function" ? n(t, i) : n, m = Ve(
718
+ f,
719
+ g,
720
+ s.useDefaultDefinitions ?? !0
721
+ ), a = ct(s.allowMode, s.allow), h = /* @__PURE__ */ new Set();
722
+ for (const k of m) k.type === "literal" && h.add(k.char);
723
+ if (s.prefix) for (const k of s.prefix) h.add(k);
724
+ if (s.suffix) for (const k of s.suffix) h.add(k);
725
+ const _ = Array.from(t).filter((k) => a(k) && !h.has(k));
726
+ if (_.length === 0) return { value: "", cursor: 0, completed: !1 };
727
+ const u = [], x = [];
728
+ let y = 0, I = 0, c = 0, d = -1;
729
+ for (const k of m) {
730
+ if (k.type === "literal") {
731
+ u.push(k.char), x.push({ kind: "literal", filled: !0 });
732
+ continue;
733
+ }
734
+ I += k.optional ? 0 : 1;
735
+ const A = _[y];
736
+ if (A == null)
737
+ break;
738
+ if (k.type === "any") {
739
+ c++, u.push(k.transform ? k.transform(A) : A), x.push({ kind: "slot", filled: !0 }), d = x.length - 1, y++;
740
+ continue;
741
+ }
742
+ if (k.type === "pattern")
743
+ if (k.pattern.test(A)) {
744
+ c++;
745
+ const R = k.transform ? k.transform(A) : A;
746
+ u.push(R), x.push({ kind: "slot", filled: !0 }), d = x.length - 1, y++;
747
+ } else {
748
+ y++;
749
+ continue;
750
+ }
751
+ }
752
+ const D = u.join(""), z = (s.prefix ?? "") + D + (s.suffix ?? "");
753
+ let C = (s.prefix ?? "").length;
754
+ if (d >= 0) {
755
+ let k = d + 1;
756
+ if ((b?.policy ?? "smart") !== "sticky")
757
+ for (; k < x.length && x[k].kind === "literal"; ) k++;
758
+ C += k;
759
+ }
760
+ const o = s.completion?.mode === "min" ? (s.completion.minChars ?? 0) <= c : s.completion?.mode === "custom" ? !!s.completion.isComplete?.(z) : I > 0 && c >= I, w = s.pipe?.(z, { ...i, completed: o });
761
+ let S, M = C;
762
+ return w === !1 ? (S = e, M = e.length) : typeof w == "string" ? (S = w, M = w.length) : typeof w == "object" && w ? (S = w.value, M = w.cursor ?? w.value.length) : S = z, { value: S, cursor: M, completed: o };
763
+ }
764
+ function at(t, e) {
765
+ const n = e?.strategy ?? "none";
766
+ return n === "custom" && e?.unmask ? e.unmask(t) : n === "strip" ? t.replace(/[^A-Za-z0-9]/g, "") : t;
767
+ }
768
+ const Le = (t) => {
769
+ const {
770
+ value: e,
771
+ onBlur: n,
772
+ onChange: s,
773
+ onInput: r,
774
+ onAccept: b,
775
+ onComplete: i,
776
+ mask: g,
777
+ definitions: f,
778
+ useDefaultDefinitions: m,
779
+ extraLiterals: a,
780
+ prefix: h,
781
+ suffix: _,
782
+ autofix: u,
783
+ pipe: x,
784
+ completion: y,
785
+ unmask: I,
786
+ allowMode: c,
787
+ allow: d,
788
+ placeholder: D,
789
+ placeholderOptions: z
790
+ } = t, B = V(
791
+ e,
792
+ g,
793
+ f,
794
+ m,
795
+ a,
796
+ h,
797
+ _,
798
+ u,
799
+ y,
800
+ I,
801
+ c,
802
+ D,
803
+ z
804
+ )((o, w, S, M, k, A, R, J, X, q, Z, se, P) => w ? ze(o ?? "", "", w, {
805
+ definitions: S ?? {},
806
+ useDefaultDefinitions: M ?? !0,
807
+ extraLiterals: k ?? [],
808
+ autofix: J ?? "none",
809
+ completion: X ?? { mode: "mask" },
810
+ pipe: x ?? ((L) => L),
811
+ unmask: q ?? { strategy: "none" },
812
+ allowMode: Z ?? "all",
813
+ allow: d,
814
+ prefix: A,
815
+ suffix: R
816
+ }).value : o ?? ""), C = (o, w) => {
817
+ const S = o.value ?? "", M = p.get(e) ?? "", k = g != null ? p.get(g) : null, A = f != null ? p.get(f) : void 0, R = m != null ? p.get(m) : void 0, J = a != null ? p.get(a) : void 0, X = u != null ? p.get(u) : void 0, q = y != null ? p.get(y) : void 0, Z = I != null ? p.get(I) : void 0, se = c != null ? p.get(c) : void 0, P = h != null ? p.get(h) : void 0, L = _ != null ? p.get(_) : void 0, {
818
+ value: H,
819
+ cursor: ue,
820
+ completed: xe
821
+ } = k ? ze(
822
+ S,
823
+ M,
824
+ k,
825
+ {
826
+ definitions: A ?? {},
827
+ useDefaultDefinitions: R ?? !0,
828
+ extraLiterals: J ?? [],
829
+ autofix: X ?? "none",
830
+ completion: q ?? { mode: "mask" },
831
+ pipe: x ?? ((Ee) => Ee),
832
+ unmask: Z ?? { strategy: "none" },
833
+ allowMode: se ?? "all",
834
+ allow: d,
835
+ prefix: P,
836
+ suffix: L
837
+ },
838
+ o.selectionStart ?? S.length,
839
+ t.cursor ? p.get(t.cursor) : void 0
840
+ ) : { value: S, cursor: S.length, completed: !0 };
841
+ if (H !== S) {
842
+ o.value = H;
843
+ try {
844
+ o.setSelectionRange(ue, ue);
845
+ } catch {
846
+ }
847
+ }
848
+ const ye = at(H, Z);
849
+ b?.({
850
+ raw: ye,
851
+ conformed: H,
852
+ completed: xe,
853
+ cursor: ue
854
+ }), w === "input" ? r?.(H) : (s?.(H), xe && i?.({ raw: ye, conformed: H }));
855
+ };
856
+ return E(
857
+ W({
858
+ ...t,
859
+ input: le.text(
860
+ Y(t),
861
+ l.value(B),
862
+ l.class("bc-input"),
863
+ n != null ? $.blur(n) : T,
864
+ te(
865
+ (o) => o instanceof HTMLInputElement ? E(
866
+ $.input(() => C(o, "input")),
867
+ $.change(() => C(o, "change")),
868
+ $.keydown((w) => {
869
+ if (w.key !== "Backspace" || !(t.cursor ? p.get(t.cursor)?.backspaceRubberBand ?? !0 : !0)) return;
870
+ const M = o.selectionStart ?? 0, k = o.selectionEnd ?? M;
871
+ if (M !== k || M <= 0) return;
872
+ const A = o.value ?? "", R = g != null ? p.get(g) : null;
873
+ if (!R) return;
874
+ const J = f != null ? p.get(f) : void 0, X = m != null ? p.get(m) : !0, q = h != null ? p.get(h) : void 0, Z = _ != null ? p.get(_) : void 0, se = Ve(
875
+ typeof R == "function" ? R(A, {
876
+ raw: A,
877
+ previousConformed: A,
878
+ cursor: M,
879
+ completed: !1
880
+ }) : R,
881
+ J ?? {},
882
+ X ?? !0
883
+ ), P = /* @__PURE__ */ new Set();
884
+ for (const L of se)
885
+ L.type === "literal" && P.add(L.char);
886
+ if (q) for (const L of q) P.add(L);
887
+ if (Z) for (const L of Z) P.add(L);
888
+ if (P.has(A[M - 1])) {
889
+ let L = M - 1;
890
+ for (; L >= 0 && P.has(A[L]); ) L--;
891
+ L >= 0 && (w.preventDefault(), w.stopPropagation(), o.value = A.slice(0, L) + A.slice(L + 1), C(o, "input"));
892
+ }
893
+ })
894
+ ) : T
895
+ )
896
+ )
897
+ })
898
+ );
899
+ };
900
+ function Ue(t, e, n) {
901
+ const s = p.map(t, (b) => b != null), r = ge.clearValue;
902
+ return E(
903
+ U(
904
+ s,
905
+ () => v.button(
906
+ l.type("button"),
907
+ l.class("bc-input-container__reset"),
908
+ G.label(r),
909
+ l.title(r),
910
+ l.disabled(e ?? !1),
911
+ O({ icon: "mdi:close", size: "sm" }),
912
+ $.click((b) => {
913
+ b.stopPropagation(), n?.(null);
914
+ })
915
+ )
916
+ )
917
+ );
918
+ }
919
+ const Tt = (t) => {
920
+ const { value: e, onBlur: n, onChange: s, onInput: r, rows: b } = t;
921
+ return W({
922
+ baseContainer: !0,
923
+ ...t,
924
+ input: v.textarea(
925
+ l.class(
926
+ V(t.size ?? "md")(
927
+ (i) => Ye(
928
+ !1,
929
+ i ?? "md"
930
+ )
931
+ )
932
+ ),
933
+ Y(t),
934
+ l.rows(b ?? 3),
935
+ l.value(e),
936
+ l.class("bc-input"),
937
+ n != null ? $.blur(j(n)) : T,
938
+ s != null ? $.change(j(s)) : T,
939
+ r != null ? $.input(j(r)) : T
940
+ )
941
+ });
942
+ }, St = (t) => {
943
+ const { value: e, step: n, min: s, max: r, onBlur: b, onChange: i, onInput: g, after: f } = t, m = (_) => {
944
+ const u = s != null ? p.get(s) : void 0, x = r != null ? p.get(r) : void 0;
945
+ return u != null && _ < u ? u : x != null && _ > x ? x : _;
946
+ }, a = n != null ? F(N, (_) => {
947
+ const u = V(
948
+ e,
949
+ s
950
+ )((c, d) => d == null ? !0 : (c ?? 0) > d), x = V(
951
+ e,
952
+ r
953
+ )((c, d) => d == null ? !0 : (c ?? 0) < d), y = (c) => {
954
+ const d = p.get(e) ?? 0, D = p.get(n), z = c?.shiftKey ? 10 : 1, B = d - D * z, C = s != null ? p.get(s) : void 0;
955
+ if (C != null && B < C)
956
+ return;
957
+ const o = m(B);
958
+ o !== d && i && i(o);
959
+ }, I = (c) => {
960
+ const d = p.get(e) ?? 0, D = p.get(n), z = c?.shiftKey ? 10 : 1, B = d + D * z, C = r != null ? p.get(r) : void 0;
961
+ if (C != null && B > C)
962
+ return;
963
+ const o = m(B);
964
+ o !== d && i && i(o);
965
+ };
966
+ return ee(
967
+ l.class("bc-number-input-steppers"),
968
+ // Increment second
969
+ v.button(
970
+ l.type("button"),
971
+ l.class(
972
+ "bc-button bc-number-input-steppers-button bc-number-input-steppers-button--increment"
973
+ ),
974
+ l.disabled(
975
+ V(
976
+ x,
977
+ t.disabled ?? !1
978
+ )((c, d) => !c || d)
979
+ ),
980
+ $.click((c) => I(c)),
981
+ G.label(_.$.incrementValue),
982
+ O({ icon: "line-md:plus", size: "xs" })
983
+ ),
984
+ // Decrement first (matches tests expecting first button to be decrement)
985
+ v.button(
986
+ l.type("button"),
987
+ l.class(
988
+ "bc-button bc-number-input-steppers-button bc-number-input-steppers-button--decrement"
989
+ ),
990
+ l.disabled(
991
+ V(
992
+ u,
993
+ t.disabled ?? !1
994
+ )((c, d) => !c || d)
995
+ ),
996
+ $.click((c) => y(c)),
997
+ G.label(_.$.decrementValue),
998
+ O({ icon: "line-md:minus", size: "xs" })
999
+ )
1000
+ );
1001
+ }) : null, h = f != null && a != null ? E(a, f) : f ?? a;
1002
+ return W({
1003
+ ...t,
1004
+ input: le.number(
1005
+ s != null ? l.min(s) : T,
1006
+ r != null ? l.max(r) : T,
1007
+ Y(t),
1008
+ l.valueAsNumber(e),
1009
+ l.step(n),
1010
+ l.class("bc-input bc-number-input"),
1011
+ b != null ? $.blur(j(b)) : T,
1012
+ i != null ? $.change(ke(i)) : T,
1013
+ g != null ? $.input(ke(g)) : T,
1014
+ // Add wheel event support when step is defined
1015
+ n != null ? $.wheel((_) => {
1016
+ _.preventDefault();
1017
+ const u = p.get(e) ?? 0, x = p.get(n), y = _.shiftKey ? 10 : 1, I = _.deltaY < 0 ? x * y : -x * y, c = m(u + I);
1018
+ c !== u && i && i(c);
1019
+ }) : T
1020
+ ),
1021
+ after: h
1022
+ });
1023
+ }, Te = (t) => {
1024
+ if (t == null || t === "") return null;
1025
+ const e = Number(t);
1026
+ return Number.isNaN(e) ? null : e;
1027
+ }, Mt = (t) => {
1028
+ const { value: e, step: n, min: s, max: r, onBlur: b, onChange: i, onInput: g, after: f } = t, m = (u) => {
1029
+ const x = s != null ? p.get(s) : void 0, y = r != null ? p.get(r) : void 0;
1030
+ return x != null && u < x ? x : y != null && u > y ? y : u;
1031
+ }, a = (() => {
1032
+ if (n == null) return null;
1033
+ const u = V(
1034
+ e,
1035
+ s
1036
+ )((d, D) => {
1037
+ const z = d ?? 0;
1038
+ return D == null ? !0 : z > D;
1039
+ }), x = V(
1040
+ e,
1041
+ r
1042
+ )((d, D) => {
1043
+ const z = d ?? 0;
1044
+ return D == null ? !0 : z < D;
1045
+ }), y = (d) => {
1046
+ const D = p.get(e) ?? 0, z = p.get(n), B = d?.shiftKey ? 10 : 1, C = D - z * B, o = s != null ? p.get(s) : void 0;
1047
+ if (o != null && C < o) return;
1048
+ const w = m(C);
1049
+ w !== D && i && i(w);
1050
+ }, I = (d) => {
1051
+ const D = p.get(e) ?? 0, z = p.get(n), B = d?.shiftKey ? 10 : 1, C = D + z * B, o = r != null ? p.get(r) : void 0;
1052
+ if (o != null && C > o) return;
1053
+ const w = m(C);
1054
+ w !== D && i && i(w);
1055
+ };
1056
+ return ((d, D) => ee(
1057
+ l.class("bc-number-input-steppers"),
1058
+ v.button(
1059
+ l.type("button"),
1060
+ l.class(
1061
+ "bc-button bc-number-input-steppers-button bc-number-input-steppers-button--increment"
1062
+ ),
1063
+ l.disabled(
1064
+ V(
1065
+ x,
1066
+ t.disabled ?? !1
1067
+ )((z, B) => !z || B)
1068
+ ),
1069
+ $.click((z) => I(z)),
1070
+ G.label(d),
1071
+ O({ icon: "line-md:plus", size: "xs" })
1072
+ ),
1073
+ v.button(
1074
+ l.type("button"),
1075
+ l.class(
1076
+ "bc-button bc-number-input-steppers-button bc-number-input-steppers-button--decrement"
1077
+ ),
1078
+ l.disabled(
1079
+ V(
1080
+ u,
1081
+ t.disabled ?? !1
1082
+ )((z, B) => !z || B)
1083
+ ),
1084
+ $.click((z) => y(z)),
1085
+ G.label(D),
1086
+ O({ icon: "line-md:minus", size: "xs" })
1087
+ )
1088
+ ))(
1089
+ ge.incrementValue,
1090
+ ge.decrementValue
1091
+ );
1092
+ })(), h = Ue(
1093
+ e,
1094
+ t.disabled,
1095
+ i ?? g
1096
+ ), _ = f != null && a != null ? E(a, h, f) : f != null ? E(h, f) : a != null ? E(a, h) : h;
1097
+ return W({
1098
+ ...t,
1099
+ input: le.number(
1100
+ // min/max attributes and reactive watchers (no forced correction)
1101
+ s != null ? l.min(s) : T,
1102
+ r != null ? l.max(r) : T,
1103
+ Y(t),
1104
+ // Represent null as empty string so the field can be cleared
1105
+ l.value(p.map(e, (u) => u == null ? "" : String(u))),
1106
+ l.step(n),
1107
+ l.class("bc-input bc-number-input"),
1108
+ b != null ? $.blur(j(b)) : T,
1109
+ i != null ? $.change(
1110
+ j((u) => {
1111
+ const x = Te(u);
1112
+ i(x);
1113
+ })
1114
+ ) : T,
1115
+ g != null ? $.input(
1116
+ j((u) => {
1117
+ const x = Te(u);
1118
+ g(x);
1119
+ })
1120
+ ) : T,
1121
+ // Wheel support when step is defined
1122
+ n != null ? $.wheel((u) => {
1123
+ u.preventDefault();
1124
+ const x = p.get(e) ?? 0, y = p.get(n), I = u.shiftKey ? 10 : 1, c = u.deltaY < 0 ? y * I : -y * I, d = m(x + c);
1125
+ d !== x && i && i(d);
1126
+ }) : T
1127
+ ),
1128
+ after: _
1129
+ });
1130
+ }, At = (t) => {
1131
+ const e = {
1132
+ type: "pattern",
1133
+ pattern: /[0-9A-Fa-f]/,
1134
+ transform: (s) => s.toLowerCase()
1135
+ };
1136
+ return Le({
1137
+ ...t,
1138
+ mask: [
1139
+ e,
1140
+ e,
1141
+ e,
1142
+ e,
1143
+ e,
1144
+ e,
1145
+ e,
1146
+ e,
1147
+ "-",
1148
+ e,
1149
+ e,
1150
+ e,
1151
+ e,
1152
+ "-",
1153
+ e,
1154
+ e,
1155
+ e,
1156
+ e,
1157
+ "-",
1158
+ e,
1159
+ e,
1160
+ e,
1161
+ e,
1162
+ "-",
1163
+ e,
1164
+ e,
1165
+ e,
1166
+ e,
1167
+ e,
1168
+ e,
1169
+ e,
1170
+ e,
1171
+ e,
1172
+ e,
1173
+ e,
1174
+ e
1175
+ ],
1176
+ // Sensible default placeholder; can be overridden via options.placeholder
1177
+ placeholder: t.placeholder ?? "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
1178
+ });
1179
+ };
1180
+ let be = null;
1181
+ async function he() {
1182
+ const t = globalThis;
1183
+ return t.Temporal ? t.Temporal : (be || (be = import("./index.esm-DPNh6inz.js").then((e) => {
1184
+ const n = e.Temporal;
1185
+ return t.Temporal || (t.Temporal = n), n;
1186
+ })), be);
1187
+ }
1188
+ const ut = (t, e) => e ? Ce(he, {
1189
+ then: t,
1190
+ pending: e.pending,
1191
+ error: e.error
1192
+ }) : Ce(he, t), pt = /^P(\d+([YMWD]|$)){0,4}(T(\d+([HMS]|$)){0,3})?$/i, ft = /^P(?:(\d+Y)?(\d+M)?(\d+W)?(\d+D)?)(T(\d+H)?(\d+M)?(\d+S)?)?$/i;
1193
+ function dt(t) {
1194
+ return {
1195
+ mask: null,
1196
+ allowMode: "custom",
1197
+ allow: (e) => /[0-9ptwdhms]/i.test(e),
1198
+ pipe: (e) => {
1199
+ const n = e.toUpperCase();
1200
+ return n.length === 0 ? n : !n.startsWith("P") || !pt.test(n) ? !1 : n;
1201
+ },
1202
+ completion: {
1203
+ mode: "custom",
1204
+ isComplete: (e) => {
1205
+ const n = e.toUpperCase();
1206
+ if (!ft.test(n)) return !1;
1207
+ try {
1208
+ return t(n), !0;
1209
+ } catch {
1210
+ return !1;
1211
+ }
1212
+ }
1213
+ }
1214
+ };
1215
+ }
1216
+ const Se = (t, e) => {
1217
+ if (t == null) return null;
1218
+ try {
1219
+ return t.Duration.from(e);
1220
+ } catch {
1221
+ return null;
1222
+ }
1223
+ }, Bt = (t) => {
1224
+ const { value: e, onChange: n, onInput: s, after: r, disabled: b, onBlur: i } = t, g = () => {
1225
+ const a = Ue(e, b, n ?? s);
1226
+ return r != null ? E(a, r) : a;
1227
+ }, f = t.placeholder != null ? T : l.placeholder("P0DT0H0M0S");
1228
+ return ut(
1229
+ (a) => Le({
1230
+ ...t,
1231
+ value: p.map(e, (h) => h?.toString() ?? ""),
1232
+ onChange: n ? (h) => n(h === "" ? null : a.Duration.from(h)) : void 0,
1233
+ onInput: void 0,
1234
+ ...dt(a.Duration.from),
1235
+ placeholder: "P0DT0H0M0S",
1236
+ after: g()
1237
+ }),
1238
+ { pending: () => {
1239
+ const a = (h) => (_) => {
1240
+ const x = _.currentTarget?.value ?? "";
1241
+ if (x === "") {
1242
+ h(null);
1243
+ return;
1244
+ }
1245
+ const y = globalThis.Temporal, I = Se(y, x);
1246
+ if (I != null) {
1247
+ h(I);
1248
+ return;
1249
+ }
1250
+ he().then((c) => {
1251
+ const d = Se(c, x);
1252
+ d != null && h(d);
1253
+ }).catch(() => {
1254
+ });
1255
+ };
1256
+ return W({
1257
+ ...t,
1258
+ input: le.text(
1259
+ Y(t),
1260
+ l.value(p.map(e, (h) => h?.toString() ?? "")),
1261
+ l.class("bc-input"),
1262
+ f,
1263
+ i != null ? $.blur(() => i()) : T,
1264
+ n != null ? $.change(a(n)) : T,
1265
+ s != null ? $.input(a(s)) : T
1266
+ ),
1267
+ after: g()
1268
+ });
1269
+ } }
1270
+ );
1271
+ }, Vt = (t) => {
1272
+ const { value: e, onBlur: n, onChange: s, onInput: r } = t;
1273
+ return W({
1274
+ ...t,
1275
+ input: le.url(
1276
+ Y(t),
1277
+ l.value(e),
1278
+ l.class("bc-input"),
1279
+ n != null ? $.blur(j(n)) : T,
1280
+ s != null ? $.change(j(s)) : T,
1281
+ r != null ? $.input(j(r)) : T
1282
+ )
1283
+ });
1284
+ }, mt = (t) => {
1285
+ const {
1286
+ controller: e,
1287
+ element: n,
1288
+ separator: s,
1289
+ showMove: r = !0,
1290
+ showRemove: b = !0,
1291
+ showAdd: i = !0,
1292
+ createItem: g,
1293
+ addLabel: f,
1294
+ controlsLayout: m = "aside",
1295
+ removeDisabled: a,
1296
+ addDisabled: h
1297
+ } = t, _ = p.toSignal(m).map((y) => y === "aside"), u = (y) => {
1298
+ const I = U(
1299
+ r ?? !1,
1300
+ () => v.div(
1301
+ l.class("bc-group--align-center"),
1302
+ l.class(
1303
+ _.map(
1304
+ (d) => d ? "bc-group--direction-column bc-group--gap-1" : "bc-group--direction-row bc-group--gap-1"
1305
+ )
1306
+ ),
1307
+ pe(
1308
+ {
1309
+ size: "xs",
1310
+ roundedness: "full",
1311
+ variant: "text",
1312
+ onClick: () => y.move("up"),
1313
+ disabled: y.cannotMove("up")
1314
+ },
1315
+ F(
1316
+ N,
1317
+ (d) => O({
1318
+ size: "xs",
1319
+ icon: "line-md:arrow-up",
1320
+ title: d.$.incrementValue
1321
+ })
1322
+ )
1323
+ ),
1324
+ pe(
1325
+ {
1326
+ size: "xs",
1327
+ roundedness: "full",
1328
+ variant: "text",
1329
+ onClick: () => y.move("down"),
1330
+ disabled: y.cannotMove("down")
1331
+ },
1332
+ F(
1333
+ N,
1334
+ (d) => O({
1335
+ size: "xs",
1336
+ icon: "line-md:arrow-down",
1337
+ title: d.$.decrementValue
1338
+ })
1339
+ )
1340
+ )
1341
+ )
1342
+ ), c = U(
1343
+ b,
1344
+ () => F(
1345
+ N,
1346
+ (d) => ce({
1347
+ size: "xs",
1348
+ // Use a lowercase label to satisfy tests that query with [aria-label*="remove"]
1349
+ label: p.map(d.$.removeItem, (D) => D.toLowerCase()),
1350
+ color: "danger",
1351
+ disabled: a,
1352
+ onClick: y.remove
1353
+ })
1354
+ )
1355
+ );
1356
+ return (d) => U(
1357
+ _,
1358
+ () => re(
1359
+ l.class("bc-group--gap-1 bc-group--align-center"),
1360
+ ee(l.class("bc-stack--grow"), d),
1361
+ ee(
1362
+ l.class("bc-stack--align-center"),
1363
+ U(
1364
+ e.signal.map((D) => D.length > 1),
1365
+ () => I
1366
+ ),
1367
+ c
1368
+ )
1369
+ ),
1370
+ () => ee(
1371
+ l.class("bc-stack--gap-2"),
1372
+ d,
1373
+ re(
1374
+ l.class("bc-group--gap-2 bc-group--justify-between"),
1375
+ U(
1376
+ e.signal.map((D) => D.length > 1),
1377
+ () => I,
1378
+ () => v.div()
1379
+ ),
1380
+ c
1381
+ )
1382
+ )
1383
+ );
1384
+ }, x = U(
1385
+ V(i, g)((y, I) => y && I != null),
1386
+ () => re(
1387
+ l.class(
1388
+ "bc-group--gap-2 bc-group--align-center bc-group--justify-center"
1389
+ ),
1390
+ pe(
1391
+ {
1392
+ size: "sm",
1393
+ variant: "filled",
1394
+ onClick: () => e.push(g()),
1395
+ disabled: V(
1396
+ e.disabled,
1397
+ h ?? !1
1398
+ )(
1399
+ (y, I) => y || I
1400
+ )
1401
+ },
1402
+ F(
1403
+ N,
1404
+ (y) => re(
1405
+ l.class("bc-group--gap-2"),
1406
+ O({ icon: "line-md:plus" }),
1407
+ f ?? y.$.addLabel
1408
+ )
1409
+ )
1410
+ )
1411
+ )
1412
+ );
1413
+ return E(
1414
+ it(
1415
+ e,
1416
+ (y) => u(y)(n(y)),
1417
+ s
1418
+ ),
1419
+ x
1420
+ );
1421
+ }, Lt = (t, ...e) => {
1422
+ const {
1423
+ controller: n,
1424
+ element: s,
1425
+ separator: r,
1426
+ showMove: b,
1427
+ showRemove: i,
1428
+ showAdd: g,
1429
+ createItem: f,
1430
+ addLabel: m,
1431
+ controlsLayout: a,
1432
+ removeDisabled: h,
1433
+ addDisabled: _,
1434
+ ...u
1435
+ } = t;
1436
+ return Ae(
1437
+ {
1438
+ ...u,
1439
+ content: mt({
1440
+ controller: n,
1441
+ element: s,
1442
+ separator: r,
1443
+ showMove: b,
1444
+ showRemove: i,
1445
+ showAdd: g,
1446
+ createItem: f,
1447
+ addLabel: m,
1448
+ controlsLayout: a,
1449
+ removeDisabled: h,
1450
+ addDisabled: _
1451
+ })
1452
+ },
1453
+ ...e
1454
+ );
1455
+ };
1456
+ class Ut extends fe {
1457
+ branches;
1458
+ activeBranch;
1459
+ #t;
1460
+ #e = /* @__PURE__ */ new Map();
1461
+ constructor(e, n, s, r, b, i, g = Q) {
1462
+ super(e, n, s, r, b, g), this.branches = i;
1463
+ const f = (a) => {
1464
+ for (const h of i)
1465
+ if (h.detect(a))
1466
+ return h.key;
1467
+ return i[0]?.key ?? "unknown";
1468
+ };
1469
+ this.activeBranch = s.map(f, Q);
1470
+ const m = (a) => {
1471
+ if (this.#e.has(a))
1472
+ return this.#e.get(a);
1473
+ const h = i.find((u) => u.key === a);
1474
+ if (!h)
1475
+ throw new Error(`Unknown branch: ${a}`);
1476
+ const _ = new fe(
1477
+ [...e, a],
1478
+ (u) => {
1479
+ this.change(u);
1480
+ },
1481
+ this.signal.map(
1482
+ (u) => h.detect(u) ? u : h.defaultValue(),
1483
+ g
1484
+ ),
1485
+ r.map(Ie([a])),
1486
+ {
1487
+ disabled: this.disabled,
1488
+ validationMode: this.parent.validationMode
1489
+ },
1490
+ g
1491
+ );
1492
+ return this.#e.set(a, _), _;
1493
+ };
1494
+ this.#t = this.activeBranch.map(
1495
+ (a) => m(a),
1496
+ Q
1497
+ ), this.onDispose(() => {
1498
+ for (const a of this.#e.values())
1499
+ a.dispose();
1500
+ this.#e.clear(), this.activeBranch.dispose(), this.#t.dispose();
1501
+ });
1502
+ }
1503
+ /**
1504
+ * Get the controller for the currently active branch
1505
+ */
1506
+ get activeController() {
1507
+ return p.get(this.#t);
1508
+ }
1509
+ /**
1510
+ * Get a controller for a specific branch
1511
+ */
1512
+ getBranchController(e) {
1513
+ const n = this.branches.find((r) => r.key === e);
1514
+ if (!n)
1515
+ throw new Error(`Unknown branch: ${e}`);
1516
+ if (this.#e.has(e))
1517
+ return this.#e.get(e);
1518
+ const s = new fe(
1519
+ [...this.path, e],
1520
+ (r) => {
1521
+ this.change(r);
1522
+ },
1523
+ this.signal.map(
1524
+ (r) => n.detect(r) ? r : n.defaultValue(),
1525
+ Q
1526
+ ),
1527
+ this.status.map(Ie([e])),
1528
+ {
1529
+ disabled: this.disabled,
1530
+ validationMode: this.parent.validationMode
1531
+ },
1532
+ Q
1533
+ );
1534
+ return this.#e.set(e, s), s;
1535
+ }
1536
+ /**
1537
+ * Switch to a different branch
1538
+ */
1539
+ switchToBranch(e, n = !1) {
1540
+ const s = this.branches.find((i) => i.key === e);
1541
+ if (!s)
1542
+ throw new Error(`Unknown branch: ${e}`);
1543
+ const r = p.get(this.signal);
1544
+ if (s.detect(r))
1545
+ return !0;
1546
+ if (s.convert) {
1547
+ const i = s.convert(r);
1548
+ if (i.ok)
1549
+ return this.change(i.value), !0;
1550
+ }
1551
+ if (n && typeof window == "object" && typeof window.confirm == "function" && !window.confirm(
1552
+ "Changing type will clear the current value. Continue?"
1553
+ ))
1554
+ return !1;
1555
+ const b = s.defaultValue();
1556
+ return this.change(b), !0;
1557
+ }
1558
+ /**
1559
+ * Get the current active branch definition
1560
+ */
1561
+ get activeBranchDefinition() {
1562
+ const e = p.get(this.activeBranch);
1563
+ return this.branches.find((n) => n.key === e);
1564
+ }
1565
+ }
1566
+ function Et(t) {
1567
+ return t.transform(
1568
+ (e) => e ?? null,
1569
+ (e) => e ?? void 0
1570
+ );
1571
+ }
1572
+ function Ot(t) {
1573
+ return t.transform(
1574
+ (e) => e ?? "",
1575
+ (e) => e === "" ? void 0 : e
1576
+ );
1577
+ }
1578
+ function Ft(t) {
1579
+ return t.transform(
1580
+ (e) => e ?? void 0,
1581
+ (e) => e ?? null
1582
+ );
1583
+ }
1584
+ function ie(t) {
1585
+ return t !== null && typeof t == "object" && !Array.isArray(t) && Object.prototype.toString.call(t) === "[object Object]";
1586
+ }
1587
+ function bt(t, e) {
1588
+ if (e == null)
1589
+ return Me(t);
1590
+ if (t == null)
1591
+ return e;
1592
+ if (ie(t) && ie(e)) {
1593
+ const n = { ...e };
1594
+ for (const s of Object.keys(t))
1595
+ n[s] === void 0 ? n[s] = Me(t[s]) : ie(t[s]) && ie(n[s]) && (n[s] = bt(t[s], n[s]));
1596
+ return n;
1597
+ }
1598
+ return e;
1599
+ }
1600
+ function Me(t) {
1601
+ return typeof structuredClone == "function" ? structuredClone(t) : JSON.parse(JSON.stringify(t));
1602
+ }
1603
+ export {
1604
+ Ct as $,
1605
+ mt as B,
1606
+ nt as E,
1607
+ It as F,
1608
+ re as G,
1609
+ Lt as L,
1610
+ Le as M,
1611
+ Ue as N,
1612
+ $t as S,
1613
+ Tt as T,
1614
+ At as U,
1615
+ ut as W,
1616
+ kt as _,
1617
+ Vt as a,
1618
+ Mt as b,
1619
+ St as c,
1620
+ dt as d,
1621
+ Bt as e,
1622
+ st as f,
1623
+ _t as g,
1624
+ zt as h,
1625
+ Ut as i,
1626
+ bt as j,
1627
+ de as k,
1628
+ Et as l,
1629
+ Ft as m,
1630
+ it as n,
1631
+ rt as o,
1632
+ Dt as p,
1633
+ lt as q,
1634
+ he as r,
1635
+ Ot as t
1636
+ };