@tempots/beatui 0.53.0 → 0.54.1

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