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