@tempots/beatui 1.5.0 → 1.6.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/ar-Wr6gMs-M.cjs +1 -0
- package/dist/{ar-C-kUt6f9.js → ar-fdUqbCvM.js} +154 -1
- package/dist/auth/index.cjs.js +1 -1
- package/dist/auth/index.es.js +1 -1
- package/dist/auth-divider-DewHpITQ.cjs +1 -0
- package/dist/{auth-divider-BIATan1F.js → auth-divider-qnJuYK-x.js} +7 -7
- package/dist/beatui.css +1711 -132
- package/dist/beatui.tailwind.css +1711 -132
- package/dist/better-auth/index.cjs.js +1 -1
- package/dist/better-auth/index.es.js +5 -5
- package/dist/{modal-BHlp4QeT.js → custom-validation-BetUqAEz.js} +186 -186
- package/dist/custom-validation-CLscGHY4.cjs +1 -0
- package/dist/{de-CP0kbElb.js → de-C5-k5Eov.js} +156 -3
- package/dist/de-DZqdSEta.cjs +1 -0
- package/dist/deep-merge-D90SW1Ci.cjs +1 -0
- package/dist/deep-merge-ZVigk5Qf.js +1765 -0
- package/dist/{duration-input-C5il_E0F.cjs → duration-input-4AQnQpyo.cjs} +1 -1
- package/dist/{duration-input-DoCCrqOG.js → duration-input-GMBmT1BE.js} +4 -4
- package/dist/{editor-toolbar-group-QVdBUbB8.cjs → editor-toolbar-group-C_ft_T8D.cjs} +1 -1
- package/dist/{editor-toolbar-group-DWUWUO-B.js → editor-toolbar-group-FpOHrmtx.js} +2 -2
- package/dist/es-CJgYfRap.cjs +1 -0
- package/dist/{es-BtIkcnsw.js → es-h6jmoF4X.js} +156 -3
- package/dist/fa-BQ5PzwNY.cjs +1 -0
- package/dist/{fa-11-rZmQ-.js → fa-BuxK837l.js} +154 -1
- package/dist/fr-Bv3TG44U.cjs +1 -0
- package/dist/{fr-C-L2F8w2.js → fr-BwILQ9G2.js} +165 -12
- package/dist/he-5LbvgMCC.cjs +1 -0
- package/dist/{he-Bu1xGoQ9.js → he-yC9Sc7JD.js} +154 -1
- package/dist/{hi-CewH-MAH.js → hi-Da7rcCpP.js} +154 -1
- package/dist/hi-YWhWcG_L.cjs +1 -0
- package/dist/{index-BGKz2Nol.js → index-DI8bf9oC.js} +175 -172
- package/dist/index-DeUj-5ph.cjs +1 -0
- package/dist/index.cjs.js +4 -4
- package/dist/index.es.js +11548 -8326
- package/dist/{input-container-CO3DNqpp.js → input-container-8JFB11xN.js} +1 -1
- package/dist/{input-container-BkPcNDaZ.cjs → input-container-CyOgiiQD.cjs} +1 -1
- package/dist/it-BxOIJE45.cjs +1 -0
- package/dist/{it-5hiKQO_p.js → it-Yeklau78.js} +156 -3
- package/dist/ja-CNhjK06P.cjs +1 -0
- package/dist/{ja-CGfEmZrm.js → ja-Dxj9Q5Yd.js} +155 -2
- package/dist/json-schema/index.cjs.js +1 -1
- package/dist/json-schema/index.es.js +10 -10
- package/dist/json-schema-display/index.cjs.js +1 -1
- package/dist/json-schema-display/index.es.js +1 -1
- package/dist/json-structure/index.cjs.js +1 -1
- package/dist/json-structure/index.es.js +5 -5
- package/dist/ko-DgkqcXTs.cjs +1 -0
- package/dist/{ko-DZthvREd.js → ko-gn_MsegK.js} +154 -1
- package/dist/lexical/index.cjs.js +1 -1
- package/dist/lexical/index.es.js +4 -4
- package/dist/nl-Dy9lmbBO.cjs +1 -0
- package/dist/{nl-CcKyHlQ7.js → nl-vHNFtXXb.js} +162 -9
- package/dist/{notice-BXKtBEiC.js → notice-B6ojfenv.js} +4 -4
- package/dist/{notice-BBnSXYUc.cjs → notice-p2IqXS5-.cjs} +1 -1
- package/dist/{oneof-branch-detection-DSzC0PkO.js → oneof-branch-detection-Q_jxvJIA.js} +1 -1
- package/dist/{oneof-branch-detection-BEkAezNi.cjs → oneof-branch-detection-xDDDdYRk.cjs} +1 -1
- package/dist/pl-BtYbtsmG.cjs +1 -0
- package/dist/{pl-Mwtjp4MV.js → pl-C0UdHla0.js} +184 -31
- package/dist/prosemirror/index.cjs.js +1 -1
- package/dist/prosemirror/index.es.js +4 -4
- package/dist/pt-CtNmqQ1X.cjs +1 -0
- package/dist/{pt-BaTsY-8f.js → pt-DGKtfN0d.js} +156 -3
- package/dist/ru-BaL_NPRU.cjs +1 -0
- package/dist/{ru-CvbGmz5s.js → ru-CpXYLt-v.js} +154 -1
- package/dist/tailwind/preset.cjs.js +1 -1
- package/dist/tailwind/preset.es.js +1 -1
- package/dist/tailwind/vite-plugin.cjs.js +1 -1
- package/dist/tailwind/vite-plugin.es.js +1 -1
- package/dist/{text-input-D_IxFd0M.cjs → text-input-DS5zlXb2.cjs} +1 -1
- package/dist/{text-input-BAn02BzO.js → text-input-NJypZSnE.js} +1 -1
- package/dist/{toolbar-CnecqhaU.cjs → toolbar-BBwfe8U9.cjs} +1 -1
- package/dist/{toolbar-BKan3NHw.js → toolbar-BF2L6WKC.js} +1 -1
- package/dist/{tr-YFqQdZjM.js → tr-DIFZDFW_.js} +156 -3
- package/dist/tr-DwOd87oB.cjs +1 -0
- package/dist/{translations-CxDUnbXn.js → translations-5cXBrENb.js} +1 -1
- package/dist/{translations-DT5QQ4WO.js → translations-BCMP-h52.js} +269 -115
- package/dist/{translations-C_-cObaF.cjs → translations-BqWc0ZHz.cjs} +1 -1
- package/dist/translations-EwEmHe3v.cjs +1 -0
- package/dist/types/beatui-i18n/default.d.ts +109 -0
- package/dist/types/beatui-i18n/locales/en.d.ts +109 -0
- package/dist/types/beatui-i18n/translations.d.ts +109 -0
- package/dist/types/components/button/copy-button.d.ts +42 -0
- package/dist/types/components/button/index.d.ts +1 -0
- package/dist/types/components/button/toggle-button-group.d.ts +2 -2
- package/dist/types/components/button/toggle-button.d.ts +2 -2
- package/dist/types/components/data/date-picker-shared.d.ts +2 -5
- package/dist/types/components/data/date-picker.d.ts +1 -1
- package/dist/types/components/data/date-range-picker.d.ts +1 -1
- package/dist/types/components/data/index.d.ts +3 -0
- package/dist/types/components/data/stat-card.d.ts +108 -0
- package/dist/types/components/data/time-picker.d.ts +54 -0
- package/dist/types/components/data/virtual-scrolling/index.d.ts +1 -0
- package/dist/types/components/data/virtual-scrolling/virtual-list.d.ts +91 -0
- package/dist/types/components/form/input/checkbox-input.d.ts +1 -1
- package/dist/types/components/form/input/color-input.d.ts +1 -1
- package/dist/types/components/form/input/color-picker/canvas-draw.d.ts +12 -0
- package/dist/types/components/form/input/color-picker/channel-picker.d.ts +71 -0
- package/dist/types/components/form/input/color-picker/hex-color-picker.d.ts +20 -0
- package/dist/types/components/form/input/color-picker/hsl-color-picker.d.ts +14 -0
- package/dist/types/components/form/input/color-picker/hwb-color-picker.d.ts +15 -0
- package/dist/types/components/form/input/color-picker/index.d.ts +7 -0
- package/dist/types/components/form/input/color-picker/oklch-color-picker.d.ts +15 -0
- package/dist/types/components/form/input/color-picker/rgb-color-picker.d.ts +17 -0
- package/dist/types/components/form/input/color-swatch-input.d.ts +1 -1
- package/dist/types/components/form/input/combobox-input.d.ts +1 -1
- package/dist/types/components/form/input/date-input.d.ts +1 -1
- package/dist/types/components/form/input/date-range-select-base.d.ts +23 -0
- package/dist/types/components/form/input/date-range-select.d.ts +64 -0
- package/dist/types/components/form/input/date-select.d.ts +52 -0
- package/dist/types/components/form/input/date-time-input.d.ts +1 -1
- package/dist/types/components/form/input/date-time-select-base.d.ts +23 -0
- package/dist/types/components/form/input/date-time-select.d.ts +66 -0
- package/dist/types/components/form/input/dropdown-input.d.ts +1 -1
- package/dist/types/components/form/input/email-input.d.ts +1 -1
- package/dist/types/components/form/input/index.d.ts +17 -0
- package/dist/types/components/form/input/nullable-date-select.d.ts +55 -0
- package/dist/types/components/form/input/nullable-date-time-select.d.ts +68 -0
- package/dist/types/components/form/input/nullable-time-select.d.ts +64 -0
- package/dist/types/components/form/input/number-input.d.ts +5 -40
- package/dist/types/components/form/input/number-stepper.d.ts +53 -0
- package/dist/types/components/form/input/open-date-range-select.d.ts +75 -0
- package/dist/types/components/form/input/otp-input.d.ts +2 -2
- package/dist/types/components/form/input/password-input.d.ts +1 -1
- package/dist/types/components/form/input/radio-group.d.ts +1 -1
- package/dist/types/components/form/input/range-slider.d.ts +4 -4
- package/dist/types/components/form/input/rating-input.d.ts +1 -1
- package/dist/types/components/form/input/segmented-input.d.ts +6 -2
- package/dist/types/components/form/input/segmented-select.d.ts +84 -0
- package/dist/types/components/form/input/slider-input.d.ts +2 -2
- package/dist/types/components/form/input/sortable-list.d.ts +68 -0
- package/dist/types/components/form/input/switch.d.ts +1 -1
- package/dist/types/components/form/input/text-area.d.ts +1 -1
- package/dist/types/components/form/input/text-input.d.ts +1 -1
- package/dist/types/components/form/input/time-format.d.ts +31 -0
- package/dist/types/components/form/input/time-select-base.d.ts +23 -0
- package/dist/types/components/form/input/time-select.d.ts +61 -0
- package/dist/types/components/form/input/transfer-list.d.ts +56 -0
- package/dist/types/components/form/input/tri-state-checkbox-input.d.ts +1 -1
- package/dist/types/components/form/input/url-input.d.ts +1 -1
- package/dist/types/components/layout/nine-slice-scroll-view.d.ts +1 -1
- package/dist/types/components/navigation/index.d.ts +1 -0
- package/dist/types/components/navigation/stepper.d.ts +102 -0
- package/dist/types/components/overlay/index.d.ts +1 -1
- package/dist/types/components/overlay/spotlight.d.ts +62 -0
- package/dist/types/utils/index.d.ts +0 -1
- package/dist/ur-D9nLchps.cjs +1 -0
- package/dist/{ur-CdnwwnG_.js → ur-DBst-TXc.js} +154 -1
- package/dist/{use-form-CP6nftVl.cjs → use-form-Dcra7GeE.cjs} +1 -1
- package/dist/{use-form-CmQdxpOi.js → use-form-NfobsGNl.js} +2 -2
- package/dist/{vi-Bwvz1d_n.js → vi-DQOJp32U.js} +183 -30
- package/dist/vi-Dg1aiMr5.cjs +1 -0
- package/dist/widget-customization-BtkexHgm.js +1458 -0
- package/dist/widget-customization-pqmtsraC.cjs +1 -0
- package/dist/{zh-hy7Uw6c5.js → zh-DPK4HXl2.js} +154 -1
- package/dist/zh-tbwSTbmn.cjs +1 -0
- package/package.json +9 -9
- package/dist/ar-Dc56zcjW.cjs +0 -1
- package/dist/auth-divider-CVKfA8Cp.cjs +0 -1
- package/dist/de-DboQlEC4.cjs +0 -1
- package/dist/deep-merge-B33Qtlmw.cjs +0 -1
- package/dist/deep-merge-BUsrE2v4.js +0 -1704
- package/dist/es-CAmE_0Ph.cjs +0 -1
- package/dist/fa-D9LrFZdW.cjs +0 -1
- package/dist/fr-DKogQyss.cjs +0 -1
- package/dist/he-CVx91Jdr.cjs +0 -1
- package/dist/hi-BgrHV72l.cjs +0 -1
- package/dist/index-DFF7Uahh.cjs +0 -1
- package/dist/it-B1rA1F9l.cjs +0 -1
- package/dist/ja-DZnjjqoi.cjs +0 -1
- package/dist/ko-CDnYKYWU.cjs +0 -1
- package/dist/modal-BmpfNL48.cjs +0 -1
- package/dist/nl-Bj8QnDEY.cjs +0 -1
- package/dist/pl-BmuuxxVd.cjs +0 -1
- package/dist/pt-RiC0yeVA.cjs +0 -1
- package/dist/ru-pRqtOQHF.cjs +0 -1
- package/dist/tr-B9JhBJeL.cjs +0 -1
- package/dist/translations-qefRsdGi.cjs +0 -1
- package/dist/types/components/overlay/command-palette.d.ts +0 -17
- package/dist/types/utils/color.d.ts +0 -346
- package/dist/ur-BZakU0iv.cjs +0 -1
- package/dist/vi-D1nly0nb.cjs +0 -1
- package/dist/widget-customization-B0y-eesp.cjs +0 -1
- package/dist/widget-customization-CKbR4Dsg.js +0 -1066
- package/dist/zh-DBk7sSD9.cjs +0 -1
|
@@ -0,0 +1,1765 @@
|
|
|
1
|
+
import { Task as ye, Use as E, Value as p, prop as te, html as h, attr as l, on as C, WithElement as ne, Empty as z, aria as K, bind as oe, OnDispose as se, coalesce as Re, ForEach as X, Fragment as W, Ensure as Pe, OneOfType as je, computedOf as V, input as le, emitValue as Z, emitValueAsNumber as we, When as F, style as _e, MapSignal as We, NotEmpty as Ze, Repeat as He, signal as ke } from "@tempots/dom";
|
|
2
|
+
import { I as q, a as qe, B as be } from "./input-container-8JFB11xN.js";
|
|
3
|
+
import { C as J, m as Ye } from "./text-input-NJypZSnE.js";
|
|
4
|
+
import { F as Ve, m as Ge, c as Je, C as ce, d as fe, e as Ce } from "./use-form-NfobsGNl.js";
|
|
5
|
+
import { B as j, d as ae, I as N, L as Xe, b as De, f as Ie } from "./translations-BCMP-h52.js";
|
|
6
|
+
import { S as Ae } from "./stack-BLMteGTn.js";
|
|
7
|
+
import { objectEntries as Qe, delayedAnimationFrame as Ke, strictEqual as ee } from "@tempots/std";
|
|
8
|
+
import { ElementRect as et } from "@tempots/ui";
|
|
9
|
+
let pe = null;
|
|
10
|
+
async function he() {
|
|
11
|
+
const t = globalThis;
|
|
12
|
+
return t.Temporal ? t.Temporal : (pe || (pe = import("./index.esm-By0m3ki1.js").then((e) => {
|
|
13
|
+
const n = e.Temporal;
|
|
14
|
+
return t.Temporal || (t.Temporal = n), n;
|
|
15
|
+
})), pe);
|
|
16
|
+
}
|
|
17
|
+
const tt = (t, e) => e ? ye(he, {
|
|
18
|
+
then: t,
|
|
19
|
+
pending: e.pending,
|
|
20
|
+
error: e.error
|
|
21
|
+
}) : ye(he, t);
|
|
22
|
+
function de({
|
|
23
|
+
onChange: t,
|
|
24
|
+
value: e,
|
|
25
|
+
accept: n = "*/*",
|
|
26
|
+
enableClick: s = !0,
|
|
27
|
+
content: r,
|
|
28
|
+
disabled: g = !1,
|
|
29
|
+
allowMultiple: o
|
|
30
|
+
}) {
|
|
31
|
+
return E(j, (d) => {
|
|
32
|
+
const x = p.deriveProp(e ?? []), y = te(!1), u = (f) => {
|
|
33
|
+
f.preventDefault(), f.stopPropagation(), y.value = !0;
|
|
34
|
+
}, v = (f) => {
|
|
35
|
+
f.preventDefault(), f.stopPropagation(), (!f.currentTarget || !f.currentTarget.contains(f.relatedTarget)) && (y.value = !1);
|
|
36
|
+
}, k = (f) => {
|
|
37
|
+
f.preventDefault(), f.stopPropagation(), y.value = !1;
|
|
38
|
+
const D = Array.from(f.dataTransfer?.files || []);
|
|
39
|
+
D.length > 0 && (x.value = D, t(D, "dragdrop"));
|
|
40
|
+
}, i = (f) => {
|
|
41
|
+
p.get(s) && f.currentTarget.querySelector(
|
|
42
|
+
'input[type="file"]'
|
|
43
|
+
)?.click();
|
|
44
|
+
};
|
|
45
|
+
let a = null;
|
|
46
|
+
const I = () => {
|
|
47
|
+
if (a == null) return;
|
|
48
|
+
const f = Array.from(a.files ?? []);
|
|
49
|
+
f.length > 0 && (x.value = f, t(f, "click")), a.value = "";
|
|
50
|
+
}, $ = (f) => {
|
|
51
|
+
p.get(s) && (f.key === "Enter" || f.key === " ") && (f.preventDefault(), i(f));
|
|
52
|
+
};
|
|
53
|
+
return h.div(
|
|
54
|
+
l.role("button"),
|
|
55
|
+
l.tabindex(
|
|
56
|
+
p.map(s, (f) => f ? 0 : -1)
|
|
57
|
+
),
|
|
58
|
+
l.style("position: relative;"),
|
|
59
|
+
C.dragover(u),
|
|
60
|
+
C.dragleave(v),
|
|
61
|
+
C.drop(k),
|
|
62
|
+
C.click(i),
|
|
63
|
+
C.keydown($),
|
|
64
|
+
// Hidden file input
|
|
65
|
+
h.input(
|
|
66
|
+
l.type("file"),
|
|
67
|
+
l.disabled(g),
|
|
68
|
+
l.accept(n),
|
|
69
|
+
l.multiple(o),
|
|
70
|
+
l.style(
|
|
71
|
+
"position: absolute; left: -9999px; opacity: 0; pointer-events: none;"
|
|
72
|
+
),
|
|
73
|
+
C.change(I),
|
|
74
|
+
ne((f) => (a = f, x.on((D) => {
|
|
75
|
+
const B = globalThis.DataTransfer;
|
|
76
|
+
if (B != null) {
|
|
77
|
+
const M = new B();
|
|
78
|
+
D.forEach((T) => M.items.add(T)), f.files = M.files;
|
|
79
|
+
}
|
|
80
|
+
}), z))
|
|
81
|
+
),
|
|
82
|
+
// Screen reader instructions
|
|
83
|
+
K.label(oe(d.$.dropZoneInstructions)(s)),
|
|
84
|
+
// Content
|
|
85
|
+
r({
|
|
86
|
+
files: x,
|
|
87
|
+
clear: () => x.value = [],
|
|
88
|
+
change: (f) => x.set(f)
|
|
89
|
+
})
|
|
90
|
+
);
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
const ge = "$$tts-exp-", nt = (t, e) => ne((n) => {
|
|
94
|
+
const s = `${ge}${t}`;
|
|
95
|
+
return se(p.on(e, (r) => Reflect.set(n, s, r)));
|
|
96
|
+
}), Tt = (t, e) => {
|
|
97
|
+
const n = `${ge}${t}`;
|
|
98
|
+
return (s) => {
|
|
99
|
+
e(Reflect.get(s.target, n));
|
|
100
|
+
};
|
|
101
|
+
}, $e = (t, e) => {
|
|
102
|
+
const n = `${ge}${t}`;
|
|
103
|
+
return (s) => {
|
|
104
|
+
const r = s.target, g = r.selectedIndex, o = r.options[g];
|
|
105
|
+
e(Reflect.get(o, n));
|
|
106
|
+
};
|
|
107
|
+
}, Fe = (t, e, n) => Pe(
|
|
108
|
+
t,
|
|
109
|
+
(s) => je(s, {
|
|
110
|
+
value: (r) => {
|
|
111
|
+
const g = V(
|
|
112
|
+
r,
|
|
113
|
+
n
|
|
114
|
+
)((o, d) => e(o.value, d));
|
|
115
|
+
return h.option(
|
|
116
|
+
l.selected(g),
|
|
117
|
+
nt("value", r.$.value),
|
|
118
|
+
r.$.label
|
|
119
|
+
);
|
|
120
|
+
},
|
|
121
|
+
group: (r) => h.optgroup(
|
|
122
|
+
l.label(r.$.group),
|
|
123
|
+
X(
|
|
124
|
+
r.$.options,
|
|
125
|
+
(g) => Fe(
|
|
126
|
+
g,
|
|
127
|
+
e,
|
|
128
|
+
n
|
|
129
|
+
)
|
|
130
|
+
)
|
|
131
|
+
),
|
|
132
|
+
break: () => h.hr()
|
|
133
|
+
})
|
|
134
|
+
), st = (t) => {
|
|
135
|
+
const {
|
|
136
|
+
value: e,
|
|
137
|
+
onBlur: n,
|
|
138
|
+
onChange: s,
|
|
139
|
+
onInput: r,
|
|
140
|
+
options: g,
|
|
141
|
+
unselectedLabel: o,
|
|
142
|
+
equality: d = (u, v) => u === v,
|
|
143
|
+
after: x
|
|
144
|
+
} = t;
|
|
145
|
+
let y;
|
|
146
|
+
return q(
|
|
147
|
+
{
|
|
148
|
+
...t,
|
|
149
|
+
after: W(
|
|
150
|
+
qe({
|
|
151
|
+
icon: "ph:caret-up-down-bold",
|
|
152
|
+
color: "neutral",
|
|
153
|
+
size: "sm"
|
|
154
|
+
}),
|
|
155
|
+
x
|
|
156
|
+
),
|
|
157
|
+
input: h.select(
|
|
158
|
+
ne((u) => {
|
|
159
|
+
y = u;
|
|
160
|
+
const v = new MutationObserver((k) => {
|
|
161
|
+
const { removedNodes: i } = k[0];
|
|
162
|
+
i.length > 0 && (y.selectedIndex = 0);
|
|
163
|
+
});
|
|
164
|
+
return v.observe(u, { childList: !0 }), se(() => v.disconnect());
|
|
165
|
+
}),
|
|
166
|
+
J(t),
|
|
167
|
+
l.class("bc-native-select bc-input"),
|
|
168
|
+
E(
|
|
169
|
+
j,
|
|
170
|
+
(u) => h.option(
|
|
171
|
+
l.hidden("hidden"),
|
|
172
|
+
Re(o, u.$.selectOne)
|
|
173
|
+
)
|
|
174
|
+
),
|
|
175
|
+
X(g, (u) => Fe(u, d, e)),
|
|
176
|
+
n != null ? C.blur(n) : z,
|
|
177
|
+
s != null ? C.change($e("value", (u) => s(u))) : z,
|
|
178
|
+
r != null ? C.input($e("value", (u) => r(u))) : z
|
|
179
|
+
)
|
|
180
|
+
},
|
|
181
|
+
C.click(() => {
|
|
182
|
+
if (y?.focus(), typeof y?.showPicker == "function")
|
|
183
|
+
try {
|
|
184
|
+
y.showPicker();
|
|
185
|
+
} catch {
|
|
186
|
+
}
|
|
187
|
+
})
|
|
188
|
+
);
|
|
189
|
+
};
|
|
190
|
+
function lt(t) {
|
|
191
|
+
const { controller: e, onChange: n, onBlur: s, ...r } = t;
|
|
192
|
+
return st({
|
|
193
|
+
...r,
|
|
194
|
+
value: e.signal,
|
|
195
|
+
onChange: Je(e, n),
|
|
196
|
+
onBlur: Ge(e, s)
|
|
197
|
+
});
|
|
198
|
+
}
|
|
199
|
+
function Lt(t) {
|
|
200
|
+
return Ve({
|
|
201
|
+
...t,
|
|
202
|
+
content: lt(t)
|
|
203
|
+
});
|
|
204
|
+
}
|
|
205
|
+
function Ue(t, e, n) {
|
|
206
|
+
const s = p.map(t, (o) => o != null), r = V(
|
|
207
|
+
s,
|
|
208
|
+
e ?? !1
|
|
209
|
+
)((o, d) => !o || d), g = ae.clearValue;
|
|
210
|
+
return h.button(
|
|
211
|
+
l.type("button"),
|
|
212
|
+
l.class("bc-input-container__reset"),
|
|
213
|
+
K.label(g),
|
|
214
|
+
l.title(g),
|
|
215
|
+
l.disabled(r),
|
|
216
|
+
N({ icon: "mdi:close", size: "sm" }),
|
|
217
|
+
C.click((o) => {
|
|
218
|
+
o.stopPropagation(), n?.(null);
|
|
219
|
+
})
|
|
220
|
+
);
|
|
221
|
+
}
|
|
222
|
+
function Me(...t) {
|
|
223
|
+
return h.div(l.class("bc-group"), ...t);
|
|
224
|
+
}
|
|
225
|
+
function rt(t) {
|
|
226
|
+
const e = String(t), n = e.indexOf(".");
|
|
227
|
+
return n === -1 ? 0 : e.length - n - 1;
|
|
228
|
+
}
|
|
229
|
+
function Q(t, e) {
|
|
230
|
+
const n = rt(e);
|
|
231
|
+
if (n === 0) return Math.round(t);
|
|
232
|
+
const s = Math.pow(10, n);
|
|
233
|
+
return Math.round(t * s) / s;
|
|
234
|
+
}
|
|
235
|
+
function it(t) {
|
|
236
|
+
if (t >= 1) return 0;
|
|
237
|
+
const e = t.toString(), n = e.indexOf(".");
|
|
238
|
+
return n === -1 ? 0 : e.length - n - 1;
|
|
239
|
+
}
|
|
240
|
+
const zt = (t) => {
|
|
241
|
+
const {
|
|
242
|
+
value: e,
|
|
243
|
+
step: n,
|
|
244
|
+
min: s,
|
|
245
|
+
max: r,
|
|
246
|
+
onBlur: g,
|
|
247
|
+
onChange: o,
|
|
248
|
+
onInput: d,
|
|
249
|
+
after: x,
|
|
250
|
+
unit: y,
|
|
251
|
+
formatted: u
|
|
252
|
+
} = t, v = (T) => {
|
|
253
|
+
const w = s != null ? p.get(s) : void 0, c = r != null ? p.get(r) : void 0;
|
|
254
|
+
return w != null && T < w ? w : c != null && T > c ? c : T;
|
|
255
|
+
}, k = n != null ? E(j, (T) => {
|
|
256
|
+
const w = V(
|
|
257
|
+
e,
|
|
258
|
+
s
|
|
259
|
+
)((_, b) => b == null ? !0 : (_ ?? 0) > b), c = V(
|
|
260
|
+
e,
|
|
261
|
+
r
|
|
262
|
+
)((_, b) => b == null ? !0 : (_ ?? 0) < b), m = (_) => {
|
|
263
|
+
const b = p.get(e) ?? 0, L = p.get(n), U = _?.shiftKey ? 10 : 1, R = Q(
|
|
264
|
+
b - L * U,
|
|
265
|
+
L
|
|
266
|
+
), P = s != null ? p.get(s) : void 0;
|
|
267
|
+
if (P != null && R < P)
|
|
268
|
+
return;
|
|
269
|
+
const O = v(R);
|
|
270
|
+
O !== b && (o?.(O), d?.(O));
|
|
271
|
+
}, S = (_) => {
|
|
272
|
+
const b = p.get(e) ?? 0, L = p.get(n), U = _?.shiftKey ? 10 : 1, R = Q(
|
|
273
|
+
b + L * U,
|
|
274
|
+
L
|
|
275
|
+
), P = r != null ? p.get(r) : void 0;
|
|
276
|
+
if (P != null && R > P)
|
|
277
|
+
return;
|
|
278
|
+
const O = v(R);
|
|
279
|
+
O !== b && (o?.(O), d?.(O));
|
|
280
|
+
};
|
|
281
|
+
return Ae(
|
|
282
|
+
l.class("bc-number-input-steppers"),
|
|
283
|
+
// Increment second
|
|
284
|
+
h.button(
|
|
285
|
+
l.type("button"),
|
|
286
|
+
l.class(
|
|
287
|
+
"bc-button bc-number-input-steppers-button bc-number-input-steppers-button--increment"
|
|
288
|
+
),
|
|
289
|
+
l.disabled(
|
|
290
|
+
V(
|
|
291
|
+
c,
|
|
292
|
+
t.disabled ?? !1
|
|
293
|
+
)((_, b) => !_ || b)
|
|
294
|
+
),
|
|
295
|
+
C.click((_) => S(_)),
|
|
296
|
+
K.label(T.$.incrementValue),
|
|
297
|
+
N({ icon: "line-md:plus", size: "xs" })
|
|
298
|
+
),
|
|
299
|
+
// Decrement first (matches tests expecting first button to be decrement)
|
|
300
|
+
h.button(
|
|
301
|
+
l.type("button"),
|
|
302
|
+
l.class(
|
|
303
|
+
"bc-button bc-number-input-steppers-button bc-number-input-steppers-button--decrement"
|
|
304
|
+
),
|
|
305
|
+
l.disabled(
|
|
306
|
+
V(
|
|
307
|
+
w,
|
|
308
|
+
t.disabled ?? !1
|
|
309
|
+
)((_, b) => !_ || b)
|
|
310
|
+
),
|
|
311
|
+
C.click((_) => m(_)),
|
|
312
|
+
K.label(T.$.decrementValue),
|
|
313
|
+
N({ icon: "line-md:minus", size: "xs" })
|
|
314
|
+
)
|
|
315
|
+
);
|
|
316
|
+
}) : null, a = [y != null ? h.span(l.class("bc-number-input-unit"), y) : null, k, x].filter(
|
|
317
|
+
(T) => T != null
|
|
318
|
+
), I = a.length > 1 ? W(...a) : a.length === 1 ? a[0] : void 0, f = u != null && p.get(u) ? te(!1) : null, D = le.number(
|
|
319
|
+
s != null ? l.min(s) : z,
|
|
320
|
+
r != null ? l.max(r) : z,
|
|
321
|
+
J(t),
|
|
322
|
+
l.valueAsNumber(e),
|
|
323
|
+
l.step(n),
|
|
324
|
+
l.class("bc-input bc-number-input"),
|
|
325
|
+
f != null ? l.class(
|
|
326
|
+
V(
|
|
327
|
+
f,
|
|
328
|
+
u ?? !1
|
|
329
|
+
)((T, w) => w && !T ? "bc-number-input--hidden" : "")
|
|
330
|
+
) : z,
|
|
331
|
+
C.focus(() => f?.set(!0)),
|
|
332
|
+
C.blur(() => {
|
|
333
|
+
f?.set(!1), g?.();
|
|
334
|
+
}),
|
|
335
|
+
g != null && f == null ? C.blur(Z(g)) : z,
|
|
336
|
+
o != null ? C.change(we(o)) : z,
|
|
337
|
+
d != null ? C.input(we(d)) : z,
|
|
338
|
+
// Add wheel event support when step is defined
|
|
339
|
+
n != null ? C.wheel((T) => {
|
|
340
|
+
T.preventDefault();
|
|
341
|
+
const w = p.get(e) ?? 0, c = p.get(n), m = T.shiftKey ? 10 : 1, S = T.deltaY < 0 ? c * m : -c * m, _ = v(Q(w + S, c));
|
|
342
|
+
_ !== w && (o?.(_), d?.(_));
|
|
343
|
+
}) : z
|
|
344
|
+
), B = f != null ? E(Xe, ({ locale: T }) => {
|
|
345
|
+
const w = V(
|
|
346
|
+
f,
|
|
347
|
+
u ?? !1
|
|
348
|
+
)((m, S) => S && !m), c = V(
|
|
349
|
+
e,
|
|
350
|
+
T,
|
|
351
|
+
n
|
|
352
|
+
)((m, S, _) => {
|
|
353
|
+
if (m == null || isNaN(m)) return "";
|
|
354
|
+
const b = _ != null ? it(_) : void 0;
|
|
355
|
+
try {
|
|
356
|
+
return new Intl.NumberFormat(S, {
|
|
357
|
+
minimumFractionDigits: b,
|
|
358
|
+
maximumFractionDigits: b
|
|
359
|
+
}).format(m);
|
|
360
|
+
} catch {
|
|
361
|
+
return String(m);
|
|
362
|
+
}
|
|
363
|
+
});
|
|
364
|
+
return F(
|
|
365
|
+
w,
|
|
366
|
+
() => h.span(l.class("bc-number-input-formatted"), c)
|
|
367
|
+
);
|
|
368
|
+
}) : null, M = B != null ? W(D, B) : D;
|
|
369
|
+
return q({
|
|
370
|
+
...t,
|
|
371
|
+
input: M,
|
|
372
|
+
after: I
|
|
373
|
+
});
|
|
374
|
+
};
|
|
375
|
+
function ot(t, e) {
|
|
376
|
+
return t.length === e.length && t.every((n, s) => n === e[s]);
|
|
377
|
+
}
|
|
378
|
+
function ct(t, e, n) {
|
|
379
|
+
const s = ["bc-segmented-input", `bc-segmented-input--size-${t}`];
|
|
380
|
+
return n === "squared" && s.push("bc-segmented-input--squared"), e && s.push("bc-segmented-input--disabled"), s.join(" ");
|
|
381
|
+
}
|
|
382
|
+
function at(t) {
|
|
383
|
+
if (t == null) return "";
|
|
384
|
+
const e = /* @__PURE__ */ new Map(), n = De(t, "solid", "light"), s = De(t, "solid", "dark");
|
|
385
|
+
return e.set("--si-indicator-bg", n.backgroundColor), e.set("--si-active-text", n.textColor), e.set("--si-indicator-bg-dark", s.backgroundColor), e.set("--si-active-text-dark", s.textColor), Array.from(e.entries()).map(([r, g]) => `${r}: ${g}`).join("; ");
|
|
386
|
+
}
|
|
387
|
+
function Bt({
|
|
388
|
+
options: t,
|
|
389
|
+
value: e,
|
|
390
|
+
onChange: n,
|
|
391
|
+
size: s = "md",
|
|
392
|
+
disabled: r = !1,
|
|
393
|
+
variant: g = "pill",
|
|
394
|
+
color: o,
|
|
395
|
+
subset: d
|
|
396
|
+
}, ...x) {
|
|
397
|
+
const y = Qe(t).map(([v, k]) => ({
|
|
398
|
+
key: v,
|
|
399
|
+
label: k
|
|
400
|
+
})), u = d || y.map((v) => v.key);
|
|
401
|
+
return ne(() => {
|
|
402
|
+
const v = Object.fromEntries(
|
|
403
|
+
y.map((i, a) => [i.key, a])
|
|
404
|
+
), k = te(
|
|
405
|
+
y.map(() => ({ left: 0, width: 0 })),
|
|
406
|
+
ot
|
|
407
|
+
);
|
|
408
|
+
return h.div(
|
|
409
|
+
l.class(
|
|
410
|
+
V(
|
|
411
|
+
s,
|
|
412
|
+
r,
|
|
413
|
+
g
|
|
414
|
+
)(
|
|
415
|
+
(i, a, I) => ct(
|
|
416
|
+
i ?? "md",
|
|
417
|
+
a ?? !1,
|
|
418
|
+
I ?? "pill"
|
|
419
|
+
)
|
|
420
|
+
)
|
|
421
|
+
),
|
|
422
|
+
l.style(
|
|
423
|
+
o != null ? p.map(o, (i) => at(i)) : ""
|
|
424
|
+
),
|
|
425
|
+
h.div(
|
|
426
|
+
l.class("bc-segmented-input__container"),
|
|
427
|
+
h.div(
|
|
428
|
+
l.class("bc-segmented-input__indicator"),
|
|
429
|
+
_e.width(
|
|
430
|
+
V(
|
|
431
|
+
e,
|
|
432
|
+
k
|
|
433
|
+
)((i, a) => {
|
|
434
|
+
const { width: I } = a[v[i] ?? 0];
|
|
435
|
+
return `${I}px`;
|
|
436
|
+
})
|
|
437
|
+
),
|
|
438
|
+
_e.left(
|
|
439
|
+
V(
|
|
440
|
+
e,
|
|
441
|
+
k
|
|
442
|
+
)((i, a) => {
|
|
443
|
+
const { left: I } = a[v[i] ?? 0];
|
|
444
|
+
return `${I}px`;
|
|
445
|
+
})
|
|
446
|
+
)
|
|
447
|
+
),
|
|
448
|
+
// clickable buttons
|
|
449
|
+
X(u, (i, { index: a }) => {
|
|
450
|
+
const I = i.map(
|
|
451
|
+
($) => y.find((f) => f.key === $)?.label
|
|
452
|
+
);
|
|
453
|
+
return h.button(
|
|
454
|
+
l.type("button"),
|
|
455
|
+
C.click(($) => {
|
|
456
|
+
$.preventDefault(), p.get(r) || n?.(i.value);
|
|
457
|
+
}),
|
|
458
|
+
l.disabled(r),
|
|
459
|
+
l.class("bc-segmented-input__segment"),
|
|
460
|
+
l.class(
|
|
461
|
+
V(
|
|
462
|
+
e,
|
|
463
|
+
i
|
|
464
|
+
)(($, f) => $ === f ? "bc-segmented-input__segment--active" : "bc-segmented-input__segment--inactive")
|
|
465
|
+
),
|
|
466
|
+
et(($) => {
|
|
467
|
+
function f() {
|
|
468
|
+
k.update((B) => {
|
|
469
|
+
const M = [...B];
|
|
470
|
+
return M[a] = {
|
|
471
|
+
width: $.value.width,
|
|
472
|
+
left: $.value.localLeft
|
|
473
|
+
}, M;
|
|
474
|
+
});
|
|
475
|
+
}
|
|
476
|
+
const D = Ke(f);
|
|
477
|
+
return se(D, $.on(f));
|
|
478
|
+
}),
|
|
479
|
+
We(I, ($) => $)
|
|
480
|
+
);
|
|
481
|
+
})
|
|
482
|
+
),
|
|
483
|
+
...x
|
|
484
|
+
);
|
|
485
|
+
});
|
|
486
|
+
}
|
|
487
|
+
function ut(t) {
|
|
488
|
+
const e = t.type.toLowerCase();
|
|
489
|
+
return e.startsWith("image/") && (e.includes("jpeg") || e.includes("jpg") || e.includes("png") || e.includes("gif") || e.includes("webp") || e.includes("svg"));
|
|
490
|
+
}
|
|
491
|
+
function ft(t) {
|
|
492
|
+
const e = t.type.toLowerCase();
|
|
493
|
+
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";
|
|
494
|
+
}
|
|
495
|
+
function me(t) {
|
|
496
|
+
return F(
|
|
497
|
+
t.map(ut),
|
|
498
|
+
() => {
|
|
499
|
+
const e = te(null);
|
|
500
|
+
return t.on((n) => {
|
|
501
|
+
e.value && URL.revokeObjectURL(e.value);
|
|
502
|
+
const s = URL.createObjectURL(n);
|
|
503
|
+
e.value = s;
|
|
504
|
+
}), h.div(
|
|
505
|
+
se(() => {
|
|
506
|
+
e.value && URL.revokeObjectURL(e.value);
|
|
507
|
+
}),
|
|
508
|
+
l.class("bc-file-input__thumbnail-container"),
|
|
509
|
+
h.img(
|
|
510
|
+
l.src(e),
|
|
511
|
+
l.alt(t.map((n) => n.name)),
|
|
512
|
+
l.class("bc-file-input__thumbnail")
|
|
513
|
+
)
|
|
514
|
+
);
|
|
515
|
+
},
|
|
516
|
+
() => N({ icon: t.map(ft) })
|
|
517
|
+
);
|
|
518
|
+
}
|
|
519
|
+
const Vt = (t, ...e) => {
|
|
520
|
+
const {
|
|
521
|
+
value: n = te([]),
|
|
522
|
+
accept: s = "*/*",
|
|
523
|
+
maxFiles: r,
|
|
524
|
+
maxFileSize: g,
|
|
525
|
+
onChange: o,
|
|
526
|
+
onBlur: d,
|
|
527
|
+
disabled: x,
|
|
528
|
+
hasError: y,
|
|
529
|
+
mode: u = "default",
|
|
530
|
+
showFileList: v = !0,
|
|
531
|
+
...k
|
|
532
|
+
} = t, i = n, a = p.map(u, (w) => w === "input"), I = p.map(u, (w) => w === "compact"), $ = (w) => {
|
|
533
|
+
let c = w;
|
|
534
|
+
if (r != null) {
|
|
535
|
+
const m = p.get(r);
|
|
536
|
+
c = c.slice(0, m);
|
|
537
|
+
}
|
|
538
|
+
if (g) {
|
|
539
|
+
const m = p.get(g);
|
|
540
|
+
c = c.filter((S) => S.size <= m);
|
|
541
|
+
}
|
|
542
|
+
o?.(c);
|
|
543
|
+
}, f = (w) => {
|
|
544
|
+
const m = i.value.filter((S, _) => _ !== w);
|
|
545
|
+
o?.(m);
|
|
546
|
+
}, D = () => {
|
|
547
|
+
o?.([]);
|
|
548
|
+
}, B = ({
|
|
549
|
+
files: w,
|
|
550
|
+
clear: c,
|
|
551
|
+
change: m
|
|
552
|
+
}) => E(
|
|
553
|
+
j,
|
|
554
|
+
(S) => h.div(
|
|
555
|
+
l.class("bc-file-input__drop-zone"),
|
|
556
|
+
h.div(
|
|
557
|
+
l.class(
|
|
558
|
+
"bc-file-input__drop-zone-content bc-file-input__drop-zone-content--empty"
|
|
559
|
+
),
|
|
560
|
+
N({ icon: "mdi:cloud-upload-outline", size: "xl" }),
|
|
561
|
+
h.div(
|
|
562
|
+
l.class("bc-file-input__drop-zone-text"),
|
|
563
|
+
oe(S.$.filesInputInstructions)(
|
|
564
|
+
r,
|
|
565
|
+
g,
|
|
566
|
+
S.$.fileSizeUnits.value
|
|
567
|
+
)
|
|
568
|
+
)
|
|
569
|
+
)
|
|
570
|
+
)
|
|
571
|
+
), M = ({
|
|
572
|
+
files: w
|
|
573
|
+
}) => E(
|
|
574
|
+
j,
|
|
575
|
+
(c) => h.div(
|
|
576
|
+
l.class("bc-file-input__compact-drop-zone"),
|
|
577
|
+
F(
|
|
578
|
+
w.map((m) => m.length > 0),
|
|
579
|
+
() => h.div(
|
|
580
|
+
l.class("bc-file-input__compact-file-list"),
|
|
581
|
+
X(w, (m, S) => {
|
|
582
|
+
const _ = S.index;
|
|
583
|
+
return h.div(
|
|
584
|
+
l.class("bc-file-input__compact-file-item"),
|
|
585
|
+
h.div(
|
|
586
|
+
l.class("bc-file-input__compact-file-icon"),
|
|
587
|
+
me(m)
|
|
588
|
+
),
|
|
589
|
+
h.div(
|
|
590
|
+
l.class("bc-file-input__compact-file-info"),
|
|
591
|
+
h.div(
|
|
592
|
+
l.class("bc-file-input__compact-file-name"),
|
|
593
|
+
l.title(m.$.name),
|
|
594
|
+
m.$.name
|
|
595
|
+
),
|
|
596
|
+
h.div(
|
|
597
|
+
l.class("bc-file-input__compact-file-meta"),
|
|
598
|
+
V(
|
|
599
|
+
m.$.size,
|
|
600
|
+
c.$.fileSizeUnits
|
|
601
|
+
)((b, L) => Ie(b, { units: L })),
|
|
602
|
+
" • ",
|
|
603
|
+
V(
|
|
604
|
+
m.$.type,
|
|
605
|
+
c.$.unknownType
|
|
606
|
+
)((b, L) => b || L)
|
|
607
|
+
)
|
|
608
|
+
),
|
|
609
|
+
ce(
|
|
610
|
+
{
|
|
611
|
+
size: "sm",
|
|
612
|
+
label: c.$.removeFile,
|
|
613
|
+
disabled: x,
|
|
614
|
+
onClick: () => f(_)
|
|
615
|
+
},
|
|
616
|
+
l.class("bc-file-input__compact-remove-button")
|
|
617
|
+
)
|
|
618
|
+
);
|
|
619
|
+
})
|
|
620
|
+
),
|
|
621
|
+
() => h.div(
|
|
622
|
+
l.class("bc-file-input__compact-placeholder"),
|
|
623
|
+
N({ icon: "mdi:cloud-upload-outline", size: "lg" }),
|
|
624
|
+
h.div(
|
|
625
|
+
l.class("bc-file-input__compact-placeholder-text"),
|
|
626
|
+
oe(c.$.filesInputInstructions)(
|
|
627
|
+
r,
|
|
628
|
+
g,
|
|
629
|
+
c.$.fileSizeUnits.value
|
|
630
|
+
)
|
|
631
|
+
)
|
|
632
|
+
)
|
|
633
|
+
)
|
|
634
|
+
)
|
|
635
|
+
), T = ({
|
|
636
|
+
files: w
|
|
637
|
+
}) => E(
|
|
638
|
+
j,
|
|
639
|
+
(c) => h.div(
|
|
640
|
+
l.class("bc-file-input__compact-input"),
|
|
641
|
+
F(
|
|
642
|
+
w.map((m) => m.length > 0),
|
|
643
|
+
() => h.span(
|
|
644
|
+
l.class("bc-file-input__compact-value"),
|
|
645
|
+
X(
|
|
646
|
+
w,
|
|
647
|
+
(m) => h.span(
|
|
648
|
+
l.class("bc-file-input__compact-value-item"),
|
|
649
|
+
me(m),
|
|
650
|
+
h.span(
|
|
651
|
+
l.class("bc-file-input__compact-value-item-name"),
|
|
652
|
+
m.$.name
|
|
653
|
+
)
|
|
654
|
+
)
|
|
655
|
+
)
|
|
656
|
+
),
|
|
657
|
+
() => h.span(
|
|
658
|
+
l.class("bc-file-input__compact-placeholder"),
|
|
659
|
+
N({ icon: "mdi:cloud-upload-outline", size: "md" }),
|
|
660
|
+
" ",
|
|
661
|
+
oe(c.$.filesInputInstructions)(
|
|
662
|
+
r,
|
|
663
|
+
g,
|
|
664
|
+
c.$.fileSizeUnits.value
|
|
665
|
+
)
|
|
666
|
+
)
|
|
667
|
+
)
|
|
668
|
+
)
|
|
669
|
+
);
|
|
670
|
+
return E(
|
|
671
|
+
j,
|
|
672
|
+
(w) => q(
|
|
673
|
+
{
|
|
674
|
+
baseContainer: p.map(a, (c) => !c),
|
|
675
|
+
disabled: x,
|
|
676
|
+
hasError: y,
|
|
677
|
+
after: F(
|
|
678
|
+
a,
|
|
679
|
+
() => F(
|
|
680
|
+
i.map(({ length: c }) => c > 0),
|
|
681
|
+
() => ce(
|
|
682
|
+
{
|
|
683
|
+
size: "sm",
|
|
684
|
+
label: w.$.clearAllFiles,
|
|
685
|
+
disabled: x,
|
|
686
|
+
onClick: D
|
|
687
|
+
},
|
|
688
|
+
l.class("bc-file-input__compact-clear")
|
|
689
|
+
)
|
|
690
|
+
)
|
|
691
|
+
),
|
|
692
|
+
...k,
|
|
693
|
+
input: F(
|
|
694
|
+
a,
|
|
695
|
+
() => h.div(
|
|
696
|
+
l.class("bc-file-input bc-file-input--input"),
|
|
697
|
+
de({
|
|
698
|
+
value: i,
|
|
699
|
+
accept: s,
|
|
700
|
+
enableClick: !0,
|
|
701
|
+
allowMultiple: p.map(r ?? 1 / 0, (c) => c > 1),
|
|
702
|
+
disabled: x,
|
|
703
|
+
onChange: $,
|
|
704
|
+
content: T
|
|
705
|
+
})
|
|
706
|
+
),
|
|
707
|
+
() => F(
|
|
708
|
+
I,
|
|
709
|
+
() => h.div(
|
|
710
|
+
l.class("bc-file-input bc-file-input--compact"),
|
|
711
|
+
de({
|
|
712
|
+
value: i,
|
|
713
|
+
accept: s,
|
|
714
|
+
enableClick: !0,
|
|
715
|
+
allowMultiple: p.map(r ?? 1 / 0, (c) => c > 1),
|
|
716
|
+
disabled: x,
|
|
717
|
+
onChange: $,
|
|
718
|
+
content: M
|
|
719
|
+
})
|
|
720
|
+
),
|
|
721
|
+
() => h.div(
|
|
722
|
+
l.class("bc-file-input"),
|
|
723
|
+
de({
|
|
724
|
+
value: i,
|
|
725
|
+
accept: s,
|
|
726
|
+
enableClick: !0,
|
|
727
|
+
allowMultiple: p.map(r ?? 1 / 0, (c) => c > 1),
|
|
728
|
+
disabled: x,
|
|
729
|
+
onChange: $,
|
|
730
|
+
content: B
|
|
731
|
+
}),
|
|
732
|
+
F(
|
|
733
|
+
v,
|
|
734
|
+
() => Ze(
|
|
735
|
+
i,
|
|
736
|
+
() => W(
|
|
737
|
+
h.div(
|
|
738
|
+
l.class("bc-file-input__file-list"),
|
|
739
|
+
X(i, (c, m) => {
|
|
740
|
+
const S = m.index;
|
|
741
|
+
return h.div(
|
|
742
|
+
l.class("bc-file-input__file-item"),
|
|
743
|
+
h.div(
|
|
744
|
+
l.class("bc-file-input__file-icon"),
|
|
745
|
+
me(c)
|
|
746
|
+
),
|
|
747
|
+
h.div(
|
|
748
|
+
l.class("bc-file-input__file-info"),
|
|
749
|
+
h.div(
|
|
750
|
+
l.class("bc-file-input__file-name"),
|
|
751
|
+
l.title(c.$.name),
|
|
752
|
+
c.$.name
|
|
753
|
+
),
|
|
754
|
+
h.div(
|
|
755
|
+
l.class("bc-file-input__file-meta"),
|
|
756
|
+
V(
|
|
757
|
+
c.$.size,
|
|
758
|
+
w.$.fileSizeUnits
|
|
759
|
+
)(
|
|
760
|
+
(_, b) => Ie(_, { units: b })
|
|
761
|
+
),
|
|
762
|
+
" • ",
|
|
763
|
+
V(
|
|
764
|
+
c.$.type,
|
|
765
|
+
w.$.unknownType
|
|
766
|
+
)((_, b) => _ || b)
|
|
767
|
+
)
|
|
768
|
+
),
|
|
769
|
+
ce(
|
|
770
|
+
{
|
|
771
|
+
size: "sm",
|
|
772
|
+
label: w.$.removeFile,
|
|
773
|
+
disabled: x,
|
|
774
|
+
onClick: () => f(S)
|
|
775
|
+
},
|
|
776
|
+
l.class("bc-file-input__remove-button")
|
|
777
|
+
)
|
|
778
|
+
);
|
|
779
|
+
})
|
|
780
|
+
),
|
|
781
|
+
F(
|
|
782
|
+
i.map(({ length: c }) => c > 1),
|
|
783
|
+
() => h.div(
|
|
784
|
+
l.class(
|
|
785
|
+
"bc-file-input__clear-all-button-container"
|
|
786
|
+
),
|
|
787
|
+
h.button(
|
|
788
|
+
l.type("button"),
|
|
789
|
+
l.class("bc-file-input__clear-all-button"),
|
|
790
|
+
l.disabled(x),
|
|
791
|
+
w.$.clearAllFiles,
|
|
792
|
+
C.click((c) => {
|
|
793
|
+
c.preventDefault(), c.stopPropagation(), D();
|
|
794
|
+
})
|
|
795
|
+
)
|
|
796
|
+
)
|
|
797
|
+
)
|
|
798
|
+
)
|
|
799
|
+
)
|
|
800
|
+
)
|
|
801
|
+
)
|
|
802
|
+
)
|
|
803
|
+
)
|
|
804
|
+
},
|
|
805
|
+
...e
|
|
806
|
+
)
|
|
807
|
+
);
|
|
808
|
+
};
|
|
809
|
+
function pt(t, e, n) {
|
|
810
|
+
const s = t.length.map((r) => r);
|
|
811
|
+
return He(
|
|
812
|
+
s,
|
|
813
|
+
(r) => {
|
|
814
|
+
const g = t.item(r.index), o = [];
|
|
815
|
+
return W(
|
|
816
|
+
se(() => {
|
|
817
|
+
o.forEach((d) => d());
|
|
818
|
+
}),
|
|
819
|
+
e({
|
|
820
|
+
list: t,
|
|
821
|
+
item: g,
|
|
822
|
+
position: r,
|
|
823
|
+
remove: () => t.removeAt(r.index),
|
|
824
|
+
move: (d) => {
|
|
825
|
+
switch (d) {
|
|
826
|
+
case "up":
|
|
827
|
+
if (r.index === 0) return;
|
|
828
|
+
t.move(r.index, r.index - 1);
|
|
829
|
+
break;
|
|
830
|
+
case "down":
|
|
831
|
+
if (r.index === t.length.value - 1) return;
|
|
832
|
+
t.move(r.index, r.index + 1);
|
|
833
|
+
break;
|
|
834
|
+
case "first":
|
|
835
|
+
t.move(r.index, 0);
|
|
836
|
+
break;
|
|
837
|
+
case "last":
|
|
838
|
+
t.move(r.index, t.length.value - 1);
|
|
839
|
+
}
|
|
840
|
+
},
|
|
841
|
+
canMove: (d) => {
|
|
842
|
+
const x = (() => {
|
|
843
|
+
switch (d) {
|
|
844
|
+
case "up":
|
|
845
|
+
return ke(r.index > 0);
|
|
846
|
+
case "down":
|
|
847
|
+
return t.length.map((y) => r.index < y - 1);
|
|
848
|
+
}
|
|
849
|
+
})();
|
|
850
|
+
return o.push(() => x.dispose()), x;
|
|
851
|
+
},
|
|
852
|
+
cannotMove: (d) => {
|
|
853
|
+
const x = (() => {
|
|
854
|
+
switch (d) {
|
|
855
|
+
case "up":
|
|
856
|
+
return ke(r.index === 0);
|
|
857
|
+
case "down":
|
|
858
|
+
return t.length.map((y) => r.index === y - 1);
|
|
859
|
+
}
|
|
860
|
+
})();
|
|
861
|
+
return o.push(() => x.dispose()), x;
|
|
862
|
+
}
|
|
863
|
+
})
|
|
864
|
+
);
|
|
865
|
+
},
|
|
866
|
+
n
|
|
867
|
+
);
|
|
868
|
+
}
|
|
869
|
+
const Se = {
|
|
870
|
+
9: { pattern: /^[0-9]$/ },
|
|
871
|
+
A: { pattern: /^[A-Za-z]$/, transform: (t) => t.toUpperCase() },
|
|
872
|
+
"*": { pattern: /^.$/ }
|
|
873
|
+
}, dt = (t) => t instanceof RegExp;
|
|
874
|
+
function Oe(t, e, n) {
|
|
875
|
+
if (t == null) return [];
|
|
876
|
+
const s = n ? { ...Se, ...e } : e ?? Se, r = (o, d) => {
|
|
877
|
+
const x = s[d];
|
|
878
|
+
x ? o.push({ type: "pattern", name: d, ...x }) : o.push({ type: "literal", char: d });
|
|
879
|
+
}, g = [];
|
|
880
|
+
if (typeof t == "string") {
|
|
881
|
+
for (const o of t) r(g, o);
|
|
882
|
+
return g;
|
|
883
|
+
}
|
|
884
|
+
for (const o of t)
|
|
885
|
+
if (typeof o == "string")
|
|
886
|
+
if (o.length <= 1) r(g, o);
|
|
887
|
+
else for (const d of o) r(g, d);
|
|
888
|
+
else dt(o) ? g.push({ type: "pattern", pattern: o }) : typeof o == "object" && o && g.push(o);
|
|
889
|
+
return g;
|
|
890
|
+
}
|
|
891
|
+
function mt(t, e) {
|
|
892
|
+
return (n) => {
|
|
893
|
+
switch (t) {
|
|
894
|
+
case "digits":
|
|
895
|
+
return /[0-9]/.test(n);
|
|
896
|
+
case "letters":
|
|
897
|
+
return /[A-Za-z]/.test(n);
|
|
898
|
+
case "alphanumeric":
|
|
899
|
+
return /[A-Za-z0-9]/.test(n);
|
|
900
|
+
case "custom":
|
|
901
|
+
return e?.(n) ?? !0;
|
|
902
|
+
default:
|
|
903
|
+
return !0;
|
|
904
|
+
}
|
|
905
|
+
};
|
|
906
|
+
}
|
|
907
|
+
function Te(t, e, n, s, r, g) {
|
|
908
|
+
const o = {
|
|
909
|
+
raw: t,
|
|
910
|
+
previousConformed: e,
|
|
911
|
+
cursor: r ?? t.length,
|
|
912
|
+
completed: !1
|
|
913
|
+
}, d = s.definitions ?? {}, x = typeof n == "function" ? n(t, o) : n, y = Oe(
|
|
914
|
+
x,
|
|
915
|
+
d,
|
|
916
|
+
s.useDefaultDefinitions ?? !0
|
|
917
|
+
), u = mt(s.allowMode, s.allow), v = /* @__PURE__ */ new Set();
|
|
918
|
+
for (const b of y) b.type === "literal" && v.add(b.char);
|
|
919
|
+
if (s.prefix) for (const b of s.prefix) v.add(b);
|
|
920
|
+
if (s.suffix) for (const b of s.suffix) v.add(b);
|
|
921
|
+
const k = Array.from(t).filter((b) => u(b) && !v.has(b));
|
|
922
|
+
if (k.length === 0) return { value: "", cursor: 0, completed: !1 };
|
|
923
|
+
const i = [], a = [];
|
|
924
|
+
let I = 0, $ = 0, f = 0, D = -1;
|
|
925
|
+
for (const b of y) {
|
|
926
|
+
if (b.type === "literal") {
|
|
927
|
+
i.push(b.char), a.push({ kind: "literal", filled: !0 });
|
|
928
|
+
continue;
|
|
929
|
+
}
|
|
930
|
+
$ += b.optional ? 0 : 1;
|
|
931
|
+
const L = k[I];
|
|
932
|
+
if (L == null)
|
|
933
|
+
break;
|
|
934
|
+
if (b.type === "any") {
|
|
935
|
+
f++, i.push(b.transform ? b.transform(L) : L), a.push({ kind: "slot", filled: !0 }), D = a.length - 1, I++;
|
|
936
|
+
continue;
|
|
937
|
+
}
|
|
938
|
+
if (b.type === "pattern")
|
|
939
|
+
if (b.pattern.test(L)) {
|
|
940
|
+
f++;
|
|
941
|
+
const U = b.transform ? b.transform(L) : L;
|
|
942
|
+
i.push(U), a.push({ kind: "slot", filled: !0 }), D = a.length - 1, I++;
|
|
943
|
+
} else {
|
|
944
|
+
I++;
|
|
945
|
+
continue;
|
|
946
|
+
}
|
|
947
|
+
}
|
|
948
|
+
const B = i.join(""), M = (s.prefix ?? "") + B + (s.suffix ?? "");
|
|
949
|
+
let w = (s.prefix ?? "").length;
|
|
950
|
+
if (D >= 0) {
|
|
951
|
+
let b = D + 1;
|
|
952
|
+
if ((g?.policy ?? "smart") !== "sticky")
|
|
953
|
+
for (; b < a.length && a[b].kind === "literal"; ) b++;
|
|
954
|
+
w += b;
|
|
955
|
+
}
|
|
956
|
+
const c = s.completion?.mode === "min" ? (s.completion.minChars ?? 0) <= f : s.completion?.mode === "custom" ? !!s.completion.isComplete?.(M) : $ > 0 && f >= $, m = s.pipe?.(M, { ...o, completed: c });
|
|
957
|
+
let S, _ = w;
|
|
958
|
+
return m === !1 ? (S = e, _ = e.length) : typeof m == "string" ? (S = m, _ = m.length) : typeof m == "object" && m ? (S = m.value, _ = m.cursor ?? m.value.length) : S = M, { value: S, cursor: _, completed: c };
|
|
959
|
+
}
|
|
960
|
+
function bt(t, e) {
|
|
961
|
+
const n = e?.strategy ?? "none";
|
|
962
|
+
return n === "custom" && e?.unmask ? e.unmask(t) : n === "strip" ? t.replace(/[^A-Za-z0-9]/g, "") : t;
|
|
963
|
+
}
|
|
964
|
+
const Ee = (t) => {
|
|
965
|
+
const {
|
|
966
|
+
value: e,
|
|
967
|
+
onBlur: n,
|
|
968
|
+
onChange: s,
|
|
969
|
+
onInput: r,
|
|
970
|
+
onAccept: g,
|
|
971
|
+
onComplete: o,
|
|
972
|
+
mask: d,
|
|
973
|
+
definitions: x,
|
|
974
|
+
useDefaultDefinitions: y,
|
|
975
|
+
extraLiterals: u,
|
|
976
|
+
prefix: v,
|
|
977
|
+
suffix: k,
|
|
978
|
+
autofix: i,
|
|
979
|
+
pipe: a,
|
|
980
|
+
completion: I,
|
|
981
|
+
unmask: $,
|
|
982
|
+
allowMode: f,
|
|
983
|
+
allow: D,
|
|
984
|
+
placeholder: B,
|
|
985
|
+
placeholderOptions: M
|
|
986
|
+
} = t, T = V(
|
|
987
|
+
e,
|
|
988
|
+
d,
|
|
989
|
+
x,
|
|
990
|
+
y,
|
|
991
|
+
u,
|
|
992
|
+
v,
|
|
993
|
+
k,
|
|
994
|
+
i,
|
|
995
|
+
I,
|
|
996
|
+
$,
|
|
997
|
+
f,
|
|
998
|
+
B,
|
|
999
|
+
M
|
|
1000
|
+
)((c, m, S, _, b, L, U, R, P, O, Y, re, H) => m ? Te(c ?? "", "", m, {
|
|
1001
|
+
definitions: S ?? {},
|
|
1002
|
+
useDefaultDefinitions: _ ?? !0,
|
|
1003
|
+
extraLiterals: b ?? [],
|
|
1004
|
+
autofix: R ?? "none",
|
|
1005
|
+
completion: P ?? { mode: "mask" },
|
|
1006
|
+
pipe: a ?? ((A) => A),
|
|
1007
|
+
unmask: O ?? { strategy: "none" },
|
|
1008
|
+
allowMode: Y ?? "all",
|
|
1009
|
+
allow: D,
|
|
1010
|
+
prefix: L,
|
|
1011
|
+
suffix: U
|
|
1012
|
+
}).value : c ?? ""), w = (c, m) => {
|
|
1013
|
+
const S = c.value ?? "", _ = p.get(e) ?? "", b = d != null ? p.get(d) : null, L = x != null ? p.get(x) : void 0, U = y != null ? p.get(y) : void 0, R = u != null ? p.get(u) : void 0, P = i != null ? p.get(i) : void 0, O = I != null ? p.get(I) : void 0, Y = $ != null ? p.get($) : void 0, re = f != null ? p.get(f) : void 0, H = v != null ? p.get(v) : void 0, A = k != null ? p.get(k) : void 0, {
|
|
1014
|
+
value: G,
|
|
1015
|
+
cursor: ue,
|
|
1016
|
+
completed: ve
|
|
1017
|
+
} = b ? Te(
|
|
1018
|
+
S,
|
|
1019
|
+
_,
|
|
1020
|
+
b,
|
|
1021
|
+
{
|
|
1022
|
+
definitions: L ?? {},
|
|
1023
|
+
useDefaultDefinitions: U ?? !0,
|
|
1024
|
+
extraLiterals: R ?? [],
|
|
1025
|
+
autofix: P ?? "none",
|
|
1026
|
+
completion: O ?? { mode: "mask" },
|
|
1027
|
+
pipe: a ?? ((Ne) => Ne),
|
|
1028
|
+
unmask: Y ?? { strategy: "none" },
|
|
1029
|
+
allowMode: re ?? "all",
|
|
1030
|
+
allow: D,
|
|
1031
|
+
prefix: H,
|
|
1032
|
+
suffix: A
|
|
1033
|
+
},
|
|
1034
|
+
c.selectionStart ?? S.length,
|
|
1035
|
+
t.cursor ? p.get(t.cursor) : void 0
|
|
1036
|
+
) : { value: S, cursor: S.length, completed: !0 };
|
|
1037
|
+
if (G !== S) {
|
|
1038
|
+
c.value = G;
|
|
1039
|
+
try {
|
|
1040
|
+
c.setSelectionRange(ue, ue);
|
|
1041
|
+
} catch {
|
|
1042
|
+
}
|
|
1043
|
+
}
|
|
1044
|
+
const xe = bt(G, Y);
|
|
1045
|
+
g?.({
|
|
1046
|
+
raw: xe,
|
|
1047
|
+
conformed: G,
|
|
1048
|
+
completed: ve,
|
|
1049
|
+
cursor: ue
|
|
1050
|
+
}), m === "input" ? r?.(G) : (s?.(G), ve && o?.({ raw: xe, conformed: G }));
|
|
1051
|
+
};
|
|
1052
|
+
return q({
|
|
1053
|
+
...t,
|
|
1054
|
+
input: le.text(
|
|
1055
|
+
J(t),
|
|
1056
|
+
l.value(T),
|
|
1057
|
+
l.class("bc-input"),
|
|
1058
|
+
n != null ? C.blur(n) : z,
|
|
1059
|
+
ne(
|
|
1060
|
+
(c) => c instanceof HTMLInputElement ? W(
|
|
1061
|
+
C.input(() => w(c, "input")),
|
|
1062
|
+
C.change(() => w(c, "change")),
|
|
1063
|
+
C.keydown((m) => {
|
|
1064
|
+
if (m.key !== "Backspace" || !(t.cursor ? p.get(t.cursor)?.backspaceRubberBand ?? !0 : !0)) return;
|
|
1065
|
+
const _ = c.selectionStart ?? 0, b = c.selectionEnd ?? _;
|
|
1066
|
+
if (_ !== b || _ <= 0) return;
|
|
1067
|
+
const L = c.value ?? "", U = d != null ? p.get(d) : null;
|
|
1068
|
+
if (!U) return;
|
|
1069
|
+
const R = x != null ? p.get(x) : void 0, P = y != null ? p.get(y) : !0, O = v != null ? p.get(v) : void 0, Y = k != null ? p.get(k) : void 0, re = Oe(
|
|
1070
|
+
typeof U == "function" ? U(L, {
|
|
1071
|
+
raw: L,
|
|
1072
|
+
previousConformed: L,
|
|
1073
|
+
cursor: _,
|
|
1074
|
+
completed: !1
|
|
1075
|
+
}) : U,
|
|
1076
|
+
R ?? {},
|
|
1077
|
+
P ?? !0
|
|
1078
|
+
), H = /* @__PURE__ */ new Set();
|
|
1079
|
+
for (const A of re)
|
|
1080
|
+
A.type === "literal" && H.add(A.char);
|
|
1081
|
+
if (O) for (const A of O) H.add(A);
|
|
1082
|
+
if (Y) for (const A of Y) H.add(A);
|
|
1083
|
+
if (H.has(L[_ - 1])) {
|
|
1084
|
+
let A = _ - 1;
|
|
1085
|
+
for (; A >= 0 && H.has(L[A]); ) A--;
|
|
1086
|
+
A >= 0 && (m.preventDefault(), m.stopPropagation(), c.value = L.slice(0, A) + L.slice(A + 1), w(c, "input"));
|
|
1087
|
+
}
|
|
1088
|
+
})
|
|
1089
|
+
) : z
|
|
1090
|
+
)
|
|
1091
|
+
)
|
|
1092
|
+
});
|
|
1093
|
+
}, At = (t) => {
|
|
1094
|
+
const { value: e, onBlur: n, onChange: s, onInput: r, rows: g } = t;
|
|
1095
|
+
return q({
|
|
1096
|
+
...t,
|
|
1097
|
+
input: h.textarea(
|
|
1098
|
+
J(t),
|
|
1099
|
+
l.rows(g ?? 3),
|
|
1100
|
+
l.value(e),
|
|
1101
|
+
l.class("bc-input"),
|
|
1102
|
+
n != null ? C.blur(Z(n)) : z,
|
|
1103
|
+
s != null ? C.change(Z(s)) : z,
|
|
1104
|
+
r != null ? C.input(Z(r)) : z
|
|
1105
|
+
)
|
|
1106
|
+
});
|
|
1107
|
+
}, Le = (t) => {
|
|
1108
|
+
if (t == null || t === "") return null;
|
|
1109
|
+
const e = Number(t);
|
|
1110
|
+
return Number.isNaN(e) ? null : e;
|
|
1111
|
+
}, Ft = (t) => {
|
|
1112
|
+
const { value: e, step: n, min: s, max: r, onBlur: g, onChange: o, onInput: d, after: x } = t, y = (i) => {
|
|
1113
|
+
const a = s != null ? p.get(s) : void 0, I = r != null ? p.get(r) : void 0;
|
|
1114
|
+
return a != null && i < a ? a : I != null && i > I ? I : i;
|
|
1115
|
+
}, u = (() => {
|
|
1116
|
+
if (n == null) return null;
|
|
1117
|
+
const i = V(
|
|
1118
|
+
e,
|
|
1119
|
+
s
|
|
1120
|
+
)((D, B) => {
|
|
1121
|
+
const M = D ?? 0;
|
|
1122
|
+
return B == null ? !0 : M > B;
|
|
1123
|
+
}), a = V(
|
|
1124
|
+
e,
|
|
1125
|
+
r
|
|
1126
|
+
)((D, B) => {
|
|
1127
|
+
const M = D ?? 0;
|
|
1128
|
+
return B == null ? !0 : M < B;
|
|
1129
|
+
}), I = (D) => {
|
|
1130
|
+
const B = p.get(e) ?? 0, M = p.get(n), T = D?.shiftKey ? 10 : 1, w = Q(B - M * T, M), c = s != null ? p.get(s) : void 0;
|
|
1131
|
+
if (c != null && w < c) return;
|
|
1132
|
+
const m = y(w);
|
|
1133
|
+
m !== B && (o?.(m), d?.(m));
|
|
1134
|
+
}, $ = (D) => {
|
|
1135
|
+
const B = p.get(e) ?? 0, M = p.get(n), T = D?.shiftKey ? 10 : 1, w = Q(B + M * T, M), c = r != null ? p.get(r) : void 0;
|
|
1136
|
+
if (c != null && w > c) return;
|
|
1137
|
+
const m = y(w);
|
|
1138
|
+
m !== B && (o?.(m), d?.(m));
|
|
1139
|
+
};
|
|
1140
|
+
return ((D, B) => Ae(
|
|
1141
|
+
l.class("bc-number-input-steppers"),
|
|
1142
|
+
h.button(
|
|
1143
|
+
l.type("button"),
|
|
1144
|
+
l.class(
|
|
1145
|
+
"bc-button bc-number-input-steppers-button bc-number-input-steppers-button--increment"
|
|
1146
|
+
),
|
|
1147
|
+
l.disabled(
|
|
1148
|
+
V(
|
|
1149
|
+
a,
|
|
1150
|
+
t.disabled ?? !1
|
|
1151
|
+
)((M, T) => !M || T)
|
|
1152
|
+
),
|
|
1153
|
+
C.click((M) => $(M)),
|
|
1154
|
+
K.label(D),
|
|
1155
|
+
N({ icon: "line-md:plus", size: "xs" })
|
|
1156
|
+
),
|
|
1157
|
+
h.button(
|
|
1158
|
+
l.type("button"),
|
|
1159
|
+
l.class(
|
|
1160
|
+
"bc-button bc-number-input-steppers-button bc-number-input-steppers-button--decrement"
|
|
1161
|
+
),
|
|
1162
|
+
l.disabled(
|
|
1163
|
+
V(
|
|
1164
|
+
i,
|
|
1165
|
+
t.disabled ?? !1
|
|
1166
|
+
)((M, T) => !M || T)
|
|
1167
|
+
),
|
|
1168
|
+
C.click((M) => I(M)),
|
|
1169
|
+
K.label(B),
|
|
1170
|
+
N({ icon: "line-md:minus", size: "xs" })
|
|
1171
|
+
)
|
|
1172
|
+
))(
|
|
1173
|
+
ae.incrementValue,
|
|
1174
|
+
ae.decrementValue
|
|
1175
|
+
);
|
|
1176
|
+
})(), v = Ue(
|
|
1177
|
+
e,
|
|
1178
|
+
t.disabled,
|
|
1179
|
+
o ?? d
|
|
1180
|
+
), k = x != null && u != null ? W(u, v, x) : x != null ? W(v, x) : u != null ? W(u, v) : v;
|
|
1181
|
+
return q({
|
|
1182
|
+
...t,
|
|
1183
|
+
input: le.number(
|
|
1184
|
+
// min/max attributes and reactive watchers (no forced correction)
|
|
1185
|
+
s != null ? l.min(s) : z,
|
|
1186
|
+
r != null ? l.max(r) : z,
|
|
1187
|
+
J(t),
|
|
1188
|
+
// Represent null as empty string so the field can be cleared
|
|
1189
|
+
l.value(p.map(e, (i) => i == null ? "" : String(i))),
|
|
1190
|
+
l.step(n),
|
|
1191
|
+
l.class("bc-input bc-number-input"),
|
|
1192
|
+
g != null ? C.blur(Z(g)) : z,
|
|
1193
|
+
o != null ? C.change(
|
|
1194
|
+
Z((i) => {
|
|
1195
|
+
const a = Le(i);
|
|
1196
|
+
o(a);
|
|
1197
|
+
})
|
|
1198
|
+
) : z,
|
|
1199
|
+
d != null ? C.input(
|
|
1200
|
+
Z((i) => {
|
|
1201
|
+
const a = Le(i);
|
|
1202
|
+
d(a);
|
|
1203
|
+
})
|
|
1204
|
+
) : z,
|
|
1205
|
+
// Wheel support when step is defined
|
|
1206
|
+
n != null ? C.wheel((i) => {
|
|
1207
|
+
i.preventDefault();
|
|
1208
|
+
const a = p.get(e) ?? 0, I = p.get(n), $ = i.shiftKey ? 10 : 1, f = i.deltaY < 0 ? I * $ : -I * $, D = y(Q(a + f, I));
|
|
1209
|
+
D !== a && (o?.(D), d?.(D));
|
|
1210
|
+
}) : z
|
|
1211
|
+
),
|
|
1212
|
+
after: k
|
|
1213
|
+
});
|
|
1214
|
+
}, Ut = (t) => {
|
|
1215
|
+
const e = {
|
|
1216
|
+
type: "pattern",
|
|
1217
|
+
pattern: /[0-9A-Fa-f]/,
|
|
1218
|
+
transform: (r) => r.toLowerCase()
|
|
1219
|
+
}, n = [
|
|
1220
|
+
e,
|
|
1221
|
+
e,
|
|
1222
|
+
e,
|
|
1223
|
+
e,
|
|
1224
|
+
e,
|
|
1225
|
+
e,
|
|
1226
|
+
e,
|
|
1227
|
+
e,
|
|
1228
|
+
"-",
|
|
1229
|
+
e,
|
|
1230
|
+
e,
|
|
1231
|
+
e,
|
|
1232
|
+
e,
|
|
1233
|
+
"-",
|
|
1234
|
+
e,
|
|
1235
|
+
e,
|
|
1236
|
+
e,
|
|
1237
|
+
e,
|
|
1238
|
+
"-",
|
|
1239
|
+
e,
|
|
1240
|
+
e,
|
|
1241
|
+
e,
|
|
1242
|
+
e,
|
|
1243
|
+
"-",
|
|
1244
|
+
e,
|
|
1245
|
+
e,
|
|
1246
|
+
e,
|
|
1247
|
+
e,
|
|
1248
|
+
e,
|
|
1249
|
+
e,
|
|
1250
|
+
e,
|
|
1251
|
+
e,
|
|
1252
|
+
e,
|
|
1253
|
+
e,
|
|
1254
|
+
e,
|
|
1255
|
+
e
|
|
1256
|
+
], s = t.class ? p.map(t.class, (r) => `bc-uuid-input ${r}`) : "bc-uuid-input";
|
|
1257
|
+
return Ee({
|
|
1258
|
+
...t,
|
|
1259
|
+
class: s,
|
|
1260
|
+
mask: n,
|
|
1261
|
+
// Sensible default placeholder; can be overridden via options.placeholder
|
|
1262
|
+
placeholder: t.placeholder ?? "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
|
|
1263
|
+
});
|
|
1264
|
+
}, ht = /^P(\d+([YMWD]|$)){0,4}(T(\d+([HMS]|$)){0,3})?$/i, gt = /^P(?:(\d+Y)?(\d+M)?(\d+W)?(\d+D)?)(T(\d+H)?(\d+M)?(\d+S)?)?$/i;
|
|
1265
|
+
function vt(t) {
|
|
1266
|
+
return {
|
|
1267
|
+
mask: null,
|
|
1268
|
+
allowMode: "custom",
|
|
1269
|
+
allow: (e) => /[0-9ptwdhms]/i.test(e),
|
|
1270
|
+
pipe: (e) => {
|
|
1271
|
+
const n = e.toUpperCase();
|
|
1272
|
+
return n.length === 0 ? n : !n.startsWith("P") || !ht.test(n) ? !1 : n;
|
|
1273
|
+
},
|
|
1274
|
+
completion: {
|
|
1275
|
+
mode: "custom",
|
|
1276
|
+
isComplete: (e) => {
|
|
1277
|
+
const n = e.toUpperCase();
|
|
1278
|
+
if (!gt.test(n)) return !1;
|
|
1279
|
+
try {
|
|
1280
|
+
return t(n), !0;
|
|
1281
|
+
} catch {
|
|
1282
|
+
return !1;
|
|
1283
|
+
}
|
|
1284
|
+
}
|
|
1285
|
+
}
|
|
1286
|
+
};
|
|
1287
|
+
}
|
|
1288
|
+
const ze = (t, e) => {
|
|
1289
|
+
if (t == null) return null;
|
|
1290
|
+
try {
|
|
1291
|
+
return t.Duration.from(e);
|
|
1292
|
+
} catch {
|
|
1293
|
+
return null;
|
|
1294
|
+
}
|
|
1295
|
+
}, Ot = (t) => {
|
|
1296
|
+
const { value: e, onChange: n, onInput: s, after: r, disabled: g, onBlur: o } = t, d = () => {
|
|
1297
|
+
const u = Ue(e, g, n ?? s);
|
|
1298
|
+
return r != null ? W(u, r) : u;
|
|
1299
|
+
}, x = t.placeholder != null ? z : l.placeholder("P0DT0H0M0S");
|
|
1300
|
+
return tt(
|
|
1301
|
+
(u) => {
|
|
1302
|
+
const v = Ye(
|
|
1303
|
+
t,
|
|
1304
|
+
(k) => k?.toString() ?? "",
|
|
1305
|
+
(k) => k === "" ? null : u.Duration.from(k)
|
|
1306
|
+
);
|
|
1307
|
+
return Ee({
|
|
1308
|
+
...v,
|
|
1309
|
+
onInput: void 0,
|
|
1310
|
+
...vt(u.Duration.from),
|
|
1311
|
+
placeholder: "P0DT0H0M0S",
|
|
1312
|
+
after: d()
|
|
1313
|
+
});
|
|
1314
|
+
},
|
|
1315
|
+
{ pending: () => {
|
|
1316
|
+
const u = (v) => (k) => {
|
|
1317
|
+
const a = k.currentTarget?.value ?? "";
|
|
1318
|
+
if (a === "") {
|
|
1319
|
+
v(null);
|
|
1320
|
+
return;
|
|
1321
|
+
}
|
|
1322
|
+
const I = globalThis.Temporal, $ = ze(I, a);
|
|
1323
|
+
if ($ != null) {
|
|
1324
|
+
v($);
|
|
1325
|
+
return;
|
|
1326
|
+
}
|
|
1327
|
+
he().then((f) => {
|
|
1328
|
+
const D = ze(f, a);
|
|
1329
|
+
D != null && v(D);
|
|
1330
|
+
}).catch(() => {
|
|
1331
|
+
});
|
|
1332
|
+
};
|
|
1333
|
+
return q({
|
|
1334
|
+
...t,
|
|
1335
|
+
input: le.text(
|
|
1336
|
+
J(t),
|
|
1337
|
+
l.value(p.map(e, (v) => v?.toString() ?? "")),
|
|
1338
|
+
l.class("bc-input"),
|
|
1339
|
+
x,
|
|
1340
|
+
o != null ? C.blur(() => o()) : z,
|
|
1341
|
+
n != null ? C.change(u(n)) : z,
|
|
1342
|
+
s != null ? C.input(u(s)) : z
|
|
1343
|
+
),
|
|
1344
|
+
after: d()
|
|
1345
|
+
});
|
|
1346
|
+
} }
|
|
1347
|
+
);
|
|
1348
|
+
}, Et = (t) => {
|
|
1349
|
+
const { value: e, onBlur: n, onChange: s, onInput: r } = t;
|
|
1350
|
+
return q({
|
|
1351
|
+
...t,
|
|
1352
|
+
input: le.url(
|
|
1353
|
+
J(t),
|
|
1354
|
+
l.value(e),
|
|
1355
|
+
l.class("bc-input"),
|
|
1356
|
+
n != null ? C.blur(Z(n)) : z,
|
|
1357
|
+
s != null ? C.change(Z(s)) : z,
|
|
1358
|
+
r != null ? C.input(Z(r)) : z
|
|
1359
|
+
)
|
|
1360
|
+
});
|
|
1361
|
+
};
|
|
1362
|
+
function xt(t, e) {
|
|
1363
|
+
const {
|
|
1364
|
+
onMove: n,
|
|
1365
|
+
cannotMoveUp: s,
|
|
1366
|
+
cannotMoveDown: r,
|
|
1367
|
+
onRemove: g,
|
|
1368
|
+
showMove: o = !0,
|
|
1369
|
+
showRemove: d = !0,
|
|
1370
|
+
removeDisabled: x,
|
|
1371
|
+
showMoveButtons: y = !0,
|
|
1372
|
+
layout: u = "aside"
|
|
1373
|
+
} = t, v = p.toSignal(u).map((a) => a === "aside"), k = F(
|
|
1374
|
+
o,
|
|
1375
|
+
() => h.div(
|
|
1376
|
+
l.class("bc-list-item-controls__move"),
|
|
1377
|
+
be(
|
|
1378
|
+
{
|
|
1379
|
+
size: "xs",
|
|
1380
|
+
roundedness: "full",
|
|
1381
|
+
variant: "text",
|
|
1382
|
+
onClick: () => n("up"),
|
|
1383
|
+
disabled: s
|
|
1384
|
+
},
|
|
1385
|
+
E(
|
|
1386
|
+
j,
|
|
1387
|
+
(a) => N({
|
|
1388
|
+
size: "xs",
|
|
1389
|
+
icon: "line-md:arrow-up",
|
|
1390
|
+
title: a.$.incrementValue
|
|
1391
|
+
})
|
|
1392
|
+
)
|
|
1393
|
+
),
|
|
1394
|
+
be(
|
|
1395
|
+
{
|
|
1396
|
+
size: "xs",
|
|
1397
|
+
roundedness: "full",
|
|
1398
|
+
variant: "text",
|
|
1399
|
+
onClick: () => n("down"),
|
|
1400
|
+
disabled: r
|
|
1401
|
+
},
|
|
1402
|
+
E(
|
|
1403
|
+
j,
|
|
1404
|
+
(a) => N({
|
|
1405
|
+
size: "xs",
|
|
1406
|
+
icon: "line-md:arrow-down",
|
|
1407
|
+
title: a.$.decrementValue
|
|
1408
|
+
})
|
|
1409
|
+
)
|
|
1410
|
+
)
|
|
1411
|
+
)
|
|
1412
|
+
), i = F(
|
|
1413
|
+
d,
|
|
1414
|
+
() => E(
|
|
1415
|
+
j,
|
|
1416
|
+
(a) => ce({
|
|
1417
|
+
size: "xs",
|
|
1418
|
+
label: p.map(a.$.removeItem, (I) => I.toLowerCase()),
|
|
1419
|
+
color: "danger",
|
|
1420
|
+
disabled: x,
|
|
1421
|
+
onClick: g
|
|
1422
|
+
})
|
|
1423
|
+
)
|
|
1424
|
+
);
|
|
1425
|
+
return F(
|
|
1426
|
+
v,
|
|
1427
|
+
() => h.div(
|
|
1428
|
+
l.class("bc-list-item-controls bc-list-item-controls--aside"),
|
|
1429
|
+
h.div(l.class("bc-list-item-controls__content"), e),
|
|
1430
|
+
h.div(
|
|
1431
|
+
l.class("bc-list-item-controls__actions"),
|
|
1432
|
+
F(y, () => k),
|
|
1433
|
+
i
|
|
1434
|
+
)
|
|
1435
|
+
),
|
|
1436
|
+
() => h.div(
|
|
1437
|
+
l.class("bc-list-item-controls bc-list-item-controls--below"),
|
|
1438
|
+
h.div(l.class("bc-list-item-controls__content"), e),
|
|
1439
|
+
h.div(
|
|
1440
|
+
l.class("bc-list-item-controls__actions"),
|
|
1441
|
+
F(
|
|
1442
|
+
y,
|
|
1443
|
+
() => k,
|
|
1444
|
+
() => h.div()
|
|
1445
|
+
),
|
|
1446
|
+
i
|
|
1447
|
+
)
|
|
1448
|
+
)
|
|
1449
|
+
);
|
|
1450
|
+
}
|
|
1451
|
+
const yt = (t) => {
|
|
1452
|
+
const {
|
|
1453
|
+
controller: e,
|
|
1454
|
+
element: n,
|
|
1455
|
+
separator: s,
|
|
1456
|
+
showMove: r = !0,
|
|
1457
|
+
showRemove: g = !0,
|
|
1458
|
+
showAdd: o = !0,
|
|
1459
|
+
createItem: d,
|
|
1460
|
+
addLabel: x,
|
|
1461
|
+
controlsLayout: y = "aside",
|
|
1462
|
+
removeDisabled: u,
|
|
1463
|
+
addDisabled: v
|
|
1464
|
+
} = t, k = F(
|
|
1465
|
+
V(o, d)((i, a) => i && a != null),
|
|
1466
|
+
() => Me(
|
|
1467
|
+
l.class(
|
|
1468
|
+
"bc-group--gap-2 bc-group--align-center bc-group--justify-center"
|
|
1469
|
+
),
|
|
1470
|
+
be(
|
|
1471
|
+
{
|
|
1472
|
+
size: "sm",
|
|
1473
|
+
variant: "filled",
|
|
1474
|
+
onClick: () => e.push(d()),
|
|
1475
|
+
disabled: V(
|
|
1476
|
+
e.disabled,
|
|
1477
|
+
v ?? !1
|
|
1478
|
+
)(
|
|
1479
|
+
(i, a) => i || a
|
|
1480
|
+
)
|
|
1481
|
+
},
|
|
1482
|
+
E(
|
|
1483
|
+
j,
|
|
1484
|
+
(i) => Me(
|
|
1485
|
+
l.class("bc-group--gap-2"),
|
|
1486
|
+
N({ icon: "line-md:plus" }),
|
|
1487
|
+
x ?? i.$.addLabel
|
|
1488
|
+
)
|
|
1489
|
+
)
|
|
1490
|
+
)
|
|
1491
|
+
)
|
|
1492
|
+
);
|
|
1493
|
+
return W(
|
|
1494
|
+
pt(
|
|
1495
|
+
e,
|
|
1496
|
+
(i) => xt(
|
|
1497
|
+
{
|
|
1498
|
+
onMove: i.move,
|
|
1499
|
+
cannotMoveUp: i.cannotMove("up"),
|
|
1500
|
+
cannotMoveDown: i.cannotMove("down"),
|
|
1501
|
+
onRemove: i.remove,
|
|
1502
|
+
showMove: r,
|
|
1503
|
+
showRemove: g,
|
|
1504
|
+
removeDisabled: u,
|
|
1505
|
+
showMoveButtons: e.signal.map((a) => a.length > 1),
|
|
1506
|
+
layout: y
|
|
1507
|
+
},
|
|
1508
|
+
n(i)
|
|
1509
|
+
),
|
|
1510
|
+
s
|
|
1511
|
+
),
|
|
1512
|
+
k
|
|
1513
|
+
);
|
|
1514
|
+
}, Nt = (t, ...e) => {
|
|
1515
|
+
const {
|
|
1516
|
+
controller: n,
|
|
1517
|
+
element: s,
|
|
1518
|
+
separator: r,
|
|
1519
|
+
showMove: g,
|
|
1520
|
+
showRemove: o,
|
|
1521
|
+
showAdd: d,
|
|
1522
|
+
createItem: x,
|
|
1523
|
+
addLabel: y,
|
|
1524
|
+
controlsLayout: u,
|
|
1525
|
+
removeDisabled: v,
|
|
1526
|
+
addDisabled: k,
|
|
1527
|
+
...i
|
|
1528
|
+
} = t;
|
|
1529
|
+
return Ve(
|
|
1530
|
+
{
|
|
1531
|
+
...i,
|
|
1532
|
+
content: yt({
|
|
1533
|
+
controller: n,
|
|
1534
|
+
element: s,
|
|
1535
|
+
separator: r,
|
|
1536
|
+
showMove: g,
|
|
1537
|
+
showRemove: o,
|
|
1538
|
+
showAdd: d,
|
|
1539
|
+
createItem: x,
|
|
1540
|
+
addLabel: y,
|
|
1541
|
+
controlsLayout: u,
|
|
1542
|
+
removeDisabled: v,
|
|
1543
|
+
addDisabled: k
|
|
1544
|
+
})
|
|
1545
|
+
},
|
|
1546
|
+
...e
|
|
1547
|
+
);
|
|
1548
|
+
};
|
|
1549
|
+
class Rt extends fe {
|
|
1550
|
+
/** The immutable list of branch definitions for this union */
|
|
1551
|
+
branches;
|
|
1552
|
+
/** Reactive signal containing the key of the currently active branch */
|
|
1553
|
+
activeBranch;
|
|
1554
|
+
/** @internal Reactive signal containing the controller for the active branch */
|
|
1555
|
+
#t;
|
|
1556
|
+
/** @internal Cache of lazily-created branch controllers */
|
|
1557
|
+
#e = /* @__PURE__ */ new Map();
|
|
1558
|
+
/**
|
|
1559
|
+
* Creates a new UnionController.
|
|
1560
|
+
*
|
|
1561
|
+
* @param path - The path segments identifying this controller in the form tree
|
|
1562
|
+
* @param change - Callback to propagate value changes to the parent
|
|
1563
|
+
* @param signal - Reactive signal holding the current union value
|
|
1564
|
+
* @param status - Reactive signal holding the current validation status
|
|
1565
|
+
* @param parent - Parent context providing disabled state and optional validation mode
|
|
1566
|
+
* @param branches - Array of branch definitions describing the possible value types
|
|
1567
|
+
* @param equals - Optional equality function for comparing values. Defaults to `strictEqual`.
|
|
1568
|
+
*/
|
|
1569
|
+
constructor(e, n, s, r, g, o, d = ee) {
|
|
1570
|
+
super(e, n, s, r, g, d), this.branches = o;
|
|
1571
|
+
const x = (u) => {
|
|
1572
|
+
for (const v of o)
|
|
1573
|
+
if (v.detect(u))
|
|
1574
|
+
return v.key;
|
|
1575
|
+
return o[0]?.key ?? "unknown";
|
|
1576
|
+
};
|
|
1577
|
+
this.activeBranch = s.map(x, ee);
|
|
1578
|
+
const y = (u) => {
|
|
1579
|
+
if (this.#e.has(u))
|
|
1580
|
+
return this.#e.get(u);
|
|
1581
|
+
const v = o.find((i) => i.key === u);
|
|
1582
|
+
if (!v)
|
|
1583
|
+
throw new Error(`Unknown branch: ${u}`);
|
|
1584
|
+
const k = new fe(
|
|
1585
|
+
[...e, u],
|
|
1586
|
+
(i) => {
|
|
1587
|
+
this.change(i);
|
|
1588
|
+
},
|
|
1589
|
+
this.signal.map(
|
|
1590
|
+
(i) => v.detect(i) ? i : v.defaultValue(),
|
|
1591
|
+
d
|
|
1592
|
+
),
|
|
1593
|
+
r.map(Ce([u])),
|
|
1594
|
+
{
|
|
1595
|
+
disabled: this.disabled,
|
|
1596
|
+
validationMode: this.parent.validationMode
|
|
1597
|
+
},
|
|
1598
|
+
d
|
|
1599
|
+
);
|
|
1600
|
+
return this.#e.set(u, k), k;
|
|
1601
|
+
};
|
|
1602
|
+
this.#t = this.activeBranch.map(
|
|
1603
|
+
(u) => y(u),
|
|
1604
|
+
ee
|
|
1605
|
+
), this.onDispose(() => {
|
|
1606
|
+
for (const u of this.#e.values())
|
|
1607
|
+
u.dispose();
|
|
1608
|
+
this.#e.clear(), this.activeBranch.dispose(), this.#t.dispose();
|
|
1609
|
+
});
|
|
1610
|
+
}
|
|
1611
|
+
/**
|
|
1612
|
+
* Gets the controller for the currently active branch.
|
|
1613
|
+
*
|
|
1614
|
+
* The returned controller's value and type correspond to the branch that
|
|
1615
|
+
* matches the current union value.
|
|
1616
|
+
*
|
|
1617
|
+
* @returns The `Controller<unknown>` for the active branch
|
|
1618
|
+
*/
|
|
1619
|
+
get activeController() {
|
|
1620
|
+
return p.get(this.#t);
|
|
1621
|
+
}
|
|
1622
|
+
/**
|
|
1623
|
+
* Gets or creates a controller for a specific branch by key.
|
|
1624
|
+
*
|
|
1625
|
+
* Controllers are created lazily and cached for subsequent calls.
|
|
1626
|
+
*
|
|
1627
|
+
* @param branchKey - The unique key of the branch to get a controller for
|
|
1628
|
+
* @returns The `Controller<unknown>` for the specified branch
|
|
1629
|
+
* @throws Error if the branch key is not found in the branches array
|
|
1630
|
+
*/
|
|
1631
|
+
getBranchController(e) {
|
|
1632
|
+
const n = this.branches.find((r) => r.key === e);
|
|
1633
|
+
if (!n)
|
|
1634
|
+
throw new Error(`Unknown branch: ${e}`);
|
|
1635
|
+
if (this.#e.has(e))
|
|
1636
|
+
return this.#e.get(e);
|
|
1637
|
+
const s = new fe(
|
|
1638
|
+
[...this.path, e],
|
|
1639
|
+
(r) => {
|
|
1640
|
+
this.change(r);
|
|
1641
|
+
},
|
|
1642
|
+
this.signal.map(
|
|
1643
|
+
(r) => n.detect(r) ? r : n.defaultValue(),
|
|
1644
|
+
ee
|
|
1645
|
+
),
|
|
1646
|
+
this.status.map(Ce([e])),
|
|
1647
|
+
{
|
|
1648
|
+
disabled: this.disabled,
|
|
1649
|
+
validationMode: this.parent.validationMode
|
|
1650
|
+
},
|
|
1651
|
+
ee
|
|
1652
|
+
);
|
|
1653
|
+
return this.#e.set(e, s), s;
|
|
1654
|
+
}
|
|
1655
|
+
/**
|
|
1656
|
+
* Switches the union value to a different branch.
|
|
1657
|
+
*
|
|
1658
|
+
* Attempts the following in order:
|
|
1659
|
+
* 1. If already on the target branch, returns `true` immediately
|
|
1660
|
+
* 2. If the branch has a `convert` function, tries to convert the current value
|
|
1661
|
+
* 3. If conversion fails and `confirmChange` is true, prompts the user with `window.confirm`
|
|
1662
|
+
* 4. Sets the value to the branch's default value
|
|
1663
|
+
*
|
|
1664
|
+
* @param branchKey - The key of the branch to switch to
|
|
1665
|
+
* @param confirmChange - If true, prompts the user before losing the current value when conversion fails
|
|
1666
|
+
* @returns `true` if the switch was successful, `false` if the user cancelled
|
|
1667
|
+
* @throws Error if the branch key is not found in the branches array
|
|
1668
|
+
*/
|
|
1669
|
+
switchToBranch(e, n = !1) {
|
|
1670
|
+
const s = this.branches.find((o) => o.key === e);
|
|
1671
|
+
if (!s)
|
|
1672
|
+
throw new Error(`Unknown branch: ${e}`);
|
|
1673
|
+
const r = p.get(this.signal);
|
|
1674
|
+
if (s.detect(r))
|
|
1675
|
+
return !0;
|
|
1676
|
+
if (s.convert) {
|
|
1677
|
+
const o = s.convert(r);
|
|
1678
|
+
if (o.ok)
|
|
1679
|
+
return this.change(o.value), !0;
|
|
1680
|
+
}
|
|
1681
|
+
if (n && typeof window == "object" && typeof window.confirm == "function" && !window.confirm(ae.changeTypeConfirmation))
|
|
1682
|
+
return !1;
|
|
1683
|
+
const g = s.defaultValue();
|
|
1684
|
+
return this.change(g), !0;
|
|
1685
|
+
}
|
|
1686
|
+
/**
|
|
1687
|
+
* Gets the {@link UnionBranch} definition for the currently active branch.
|
|
1688
|
+
*
|
|
1689
|
+
* @returns The active branch definition, or `undefined` if no branch matches
|
|
1690
|
+
*/
|
|
1691
|
+
get activeBranchDefinition() {
|
|
1692
|
+
const e = p.get(this.activeBranch);
|
|
1693
|
+
return this.branches.find((n) => n.key === e);
|
|
1694
|
+
}
|
|
1695
|
+
}
|
|
1696
|
+
function Pt(t) {
|
|
1697
|
+
return t.transform(
|
|
1698
|
+
(e) => e ?? null,
|
|
1699
|
+
(e) => e ?? void 0
|
|
1700
|
+
);
|
|
1701
|
+
}
|
|
1702
|
+
function jt(t) {
|
|
1703
|
+
return t.transform(
|
|
1704
|
+
(e) => e ?? "",
|
|
1705
|
+
(e) => e === "" ? void 0 : e
|
|
1706
|
+
);
|
|
1707
|
+
}
|
|
1708
|
+
function Wt(t) {
|
|
1709
|
+
return t.transform(
|
|
1710
|
+
(e) => e ?? void 0,
|
|
1711
|
+
(e) => e ?? null
|
|
1712
|
+
);
|
|
1713
|
+
}
|
|
1714
|
+
function ie(t) {
|
|
1715
|
+
return t !== null && typeof t == "object" && !Array.isArray(t) && Object.prototype.toString.call(t) === "[object Object]";
|
|
1716
|
+
}
|
|
1717
|
+
function wt(t, e) {
|
|
1718
|
+
if (e == null)
|
|
1719
|
+
return Be(t);
|
|
1720
|
+
if (t == null)
|
|
1721
|
+
return e;
|
|
1722
|
+
if (ie(t) && ie(e)) {
|
|
1723
|
+
const n = { ...e };
|
|
1724
|
+
for (const s of Object.keys(t))
|
|
1725
|
+
n[s] === void 0 ? n[s] = Be(t[s]) : ie(t[s]) && ie(n[s]) && (n[s] = wt(t[s], n[s]));
|
|
1726
|
+
return n;
|
|
1727
|
+
}
|
|
1728
|
+
return e;
|
|
1729
|
+
}
|
|
1730
|
+
function Be(t) {
|
|
1731
|
+
return typeof structuredClone == "function" ? structuredClone(t) : JSON.parse(JSON.stringify(t));
|
|
1732
|
+
}
|
|
1733
|
+
export {
|
|
1734
|
+
yt as B,
|
|
1735
|
+
nt as E,
|
|
1736
|
+
Vt as F,
|
|
1737
|
+
Me as G,
|
|
1738
|
+
Nt as L,
|
|
1739
|
+
Ee as M,
|
|
1740
|
+
Ue as N,
|
|
1741
|
+
Bt as S,
|
|
1742
|
+
At as T,
|
|
1743
|
+
Ut as U,
|
|
1744
|
+
tt as W,
|
|
1745
|
+
Et as a,
|
|
1746
|
+
st as b,
|
|
1747
|
+
Ot as c,
|
|
1748
|
+
vt as d,
|
|
1749
|
+
jt as e,
|
|
1750
|
+
Ft as f,
|
|
1751
|
+
zt as g,
|
|
1752
|
+
Lt as h,
|
|
1753
|
+
Rt as i,
|
|
1754
|
+
wt as j,
|
|
1755
|
+
lt as k,
|
|
1756
|
+
pt as l,
|
|
1757
|
+
xt as m,
|
|
1758
|
+
de as n,
|
|
1759
|
+
Tt as o,
|
|
1760
|
+
$e as p,
|
|
1761
|
+
he as q,
|
|
1762
|
+
Q as r,
|
|
1763
|
+
Wt as s,
|
|
1764
|
+
Pt as t
|
|
1765
|
+
};
|