@tempots/beatui 0.37.0 → 0.38.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-RaU4YQ5c.js → 2019-CGWicU9n.js} +2 -2
- package/dist/{2019-B1QESOSc.cjs → 2019-DxwU2aOm.cjs} +1 -1
- package/dist/{2020-BAomdSE8.js → 2020-BRNvbMGL.js} +2 -2
- package/dist/{2020-BI-SxTSK.cjs → 2020-DHep9dU6.cjs} +1 -1
- package/dist/auth/index.cjs.js +1 -1
- package/dist/auth/index.es.js +2 -2
- package/dist/beatui.css +62 -28
- package/dist/beatui.tailwind.css +62 -28
- package/dist/{index-BzApzJXc.cjs → index-C5-BM51Y.cjs} +1 -1
- package/dist/{index-Dc9UNC8n.js → index-D41aREgo.js} +1 -1
- package/dist/{index-BKjL6RO2.cjs → index-Dtqe3URb.cjs} +2 -2
- package/dist/{index-BS0NyhvV.js → index-i9pAnFtS.js} +4 -4
- package/dist/index.cjs.js +1 -1
- package/dist/index.es.js +6 -6
- package/dist/json-schema/index.cjs.js +1 -1
- package/dist/json-schema/index.es.js +1 -1
- package/dist/{modal-CxG-RO9B.js → modal--1g8Y5LH.js} +1 -1
- package/dist/{modal-OMSAbIg1.cjs → modal-mA_AFUCI.cjs} +1 -1
- package/dist/{notice-C7o5d8Jw.js → notice-BuYqG6zM.js} +47 -44
- package/dist/{notice-0Xhzr7qR.cjs → notice-DCuZEAQO.cjs} +2 -2
- package/dist/types/components/form/use-form.d.ts +1 -1
- package/dist/{utils-BcIRhDH0.cjs → utils-BD6NGV1v.cjs} +1 -1
- package/dist/{utils-C7619Rp3.js → utils-B_QSuN66.js} +1 -1
- package/package.json +1 -1
|
@@ -499,10 +499,10 @@ const Ie = (...e) => b.span(o.class(z("emphasis")), ...e), le = (...e) => b.span
|
|
|
499
499
|
iconSize: p = "lg"
|
|
500
500
|
} = e, u = a ?? Q("checkbox"), g = `${u}-label`, S = () => {
|
|
501
501
|
if (C.get(r ?? !1)) return;
|
|
502
|
-
const
|
|
503
|
-
i?.(!
|
|
504
|
-
}, v = (
|
|
505
|
-
C.get(r ?? !1) || (
|
|
502
|
+
const h = C.get(s);
|
|
503
|
+
i?.(!h);
|
|
504
|
+
}, v = (h) => {
|
|
505
|
+
C.get(r ?? !1) || (h.key === " " || h.key === "Enter") && (h.preventDefault(), S());
|
|
506
506
|
};
|
|
507
507
|
return U(
|
|
508
508
|
{
|
|
@@ -516,13 +516,13 @@ const Ie = (...e) => b.span(o.class(z("emphasis")), ...e), le = (...e) => b.span
|
|
|
516
516
|
o.class(
|
|
517
517
|
C.map(
|
|
518
518
|
s,
|
|
519
|
-
(
|
|
519
|
+
(h) => h ? "bc-checkbox-input__checkbox--checked" : "bc-checkbox-input__checkbox--unchecked"
|
|
520
520
|
)
|
|
521
521
|
),
|
|
522
522
|
o.class(
|
|
523
523
|
C.map(
|
|
524
524
|
r ?? !1,
|
|
525
|
-
(
|
|
525
|
+
(h) => h ? "bc-checkbox-input__checkbox--disabled" : ""
|
|
526
526
|
)
|
|
527
527
|
),
|
|
528
528
|
o.id(u),
|
|
@@ -530,7 +530,7 @@ const Ie = (...e) => b.span(o.class(z("emphasis")), ...e), le = (...e) => b.span
|
|
|
530
530
|
o.tabindex(
|
|
531
531
|
C.map(
|
|
532
532
|
r ?? !1,
|
|
533
|
-
(
|
|
533
|
+
(h) => h ? -1 : 0
|
|
534
534
|
)
|
|
535
535
|
),
|
|
536
536
|
P.checked(s),
|
|
@@ -544,7 +544,7 @@ const Ie = (...e) => b.span(o.class(z("emphasis")), ...e), le = (...e) => b.span
|
|
|
544
544
|
l,
|
|
545
545
|
c
|
|
546
546
|
)(
|
|
547
|
-
(
|
|
547
|
+
(h, d, f) => h ? d ?? "akar-icons/check-box-fill" : f ?? "akar-icons/box"
|
|
548
548
|
),
|
|
549
549
|
accessibility: "decorative",
|
|
550
550
|
size: p
|
|
@@ -590,18 +590,18 @@ const X = ({
|
|
|
590
590
|
layout: u,
|
|
591
591
|
labelWidth: g
|
|
592
592
|
}, ...S) => {
|
|
593
|
-
const v = c ?? a != null,
|
|
593
|
+
const v = c ?? a != null, h = p ?? !1, d = u ?? "vertical", f = Q("input-wrapper"), E = n ? `${f}-description` : void 0, A = a != null ? `${f}-error` : void 0, x = w(d)((y) => y !== "vertical");
|
|
594
594
|
return b.div(
|
|
595
|
-
o.class(C.map(
|
|
595
|
+
o.class(C.map(d, (y) => ue(y))),
|
|
596
596
|
O(
|
|
597
597
|
w(
|
|
598
|
-
|
|
598
|
+
d,
|
|
599
599
|
g ?? void 0
|
|
600
600
|
)((y, V) => W(y, V) != null),
|
|
601
601
|
() => o.style(
|
|
602
602
|
C.map(
|
|
603
603
|
w(
|
|
604
|
-
|
|
604
|
+
d,
|
|
605
605
|
g ?? void 0
|
|
606
606
|
)((y, V) => W(y, V)),
|
|
607
607
|
(y) => y
|
|
@@ -619,7 +619,7 @@ const X = ({
|
|
|
619
619
|
o.class(
|
|
620
620
|
w(
|
|
621
621
|
v,
|
|
622
|
-
|
|
622
|
+
h
|
|
623
623
|
)(
|
|
624
624
|
(y, V) => he(
|
|
625
625
|
y ?? !1,
|
|
@@ -736,19 +736,19 @@ const Oe = (e) => {
|
|
|
736
736
|
name: "password",
|
|
737
737
|
disabled: c,
|
|
738
738
|
...g
|
|
739
|
-
}, v = T(!0),
|
|
739
|
+
}, v = T(!0), h = w(
|
|
740
740
|
v,
|
|
741
741
|
p
|
|
742
|
-
)((
|
|
743
|
-
return j(q, (
|
|
742
|
+
)((d, f) => d ? f ?? "current-password" : "off");
|
|
743
|
+
return j(q, (d) => {
|
|
744
744
|
const f = w(
|
|
745
|
-
|
|
745
|
+
d.$.passwordPlaceholderText,
|
|
746
746
|
v,
|
|
747
747
|
u
|
|
748
748
|
)((A, x, y) => x ? "•••••••••••••••" : y ?? A), E = b.button(
|
|
749
749
|
o.type("button"),
|
|
750
750
|
o.class("bc-input-container__password-toggle"),
|
|
751
|
-
P.label(
|
|
751
|
+
P.label(d.$.togglePasswordVisibility),
|
|
752
752
|
I.click(() => v.update((A) => !A)),
|
|
753
753
|
O(
|
|
754
754
|
v,
|
|
@@ -763,7 +763,7 @@ const Oe = (e) => {
|
|
|
763
763
|
input: b.input(
|
|
764
764
|
J({
|
|
765
765
|
...S,
|
|
766
|
-
autocomplete:
|
|
766
|
+
autocomplete: h,
|
|
767
767
|
placeholder: f
|
|
768
768
|
}),
|
|
769
769
|
O(
|
|
@@ -1096,8 +1096,8 @@ class ve extends M {
|
|
|
1096
1096
|
const c = l.on((u) => {
|
|
1097
1097
|
const g = this.#e.length - u.length;
|
|
1098
1098
|
g > 0 && (this.#e.splice(u.length, g).forEach((S, v) => {
|
|
1099
|
-
const
|
|
1100
|
-
S.dispose(), this.#s.get(
|
|
1099
|
+
const h = u.length + v;
|
|
1100
|
+
S.dispose(), this.#s.get(h)?.(), this.#s.delete(h), this.#t.delete(h), this.#i.get(h)?.(), this.#i.delete(h), this.#r.delete(h);
|
|
1101
1101
|
}), this.#c(), this.#a());
|
|
1102
1102
|
});
|
|
1103
1103
|
this.length = l.map((u) => u.length), this.#o = this.touched.on(() => {
|
|
@@ -1218,27 +1218,27 @@ function we({
|
|
|
1218
1218
|
validationMode: n,
|
|
1219
1219
|
validateDebounceMs: r
|
|
1220
1220
|
}) {
|
|
1221
|
-
const a = C.deriveProp(e), l = T(D.valid), c = T(!1), p = T(n ?? "touchedOrSubmit"), u = (
|
|
1222
|
-
l.set(
|
|
1221
|
+
const a = C.deriveProp(e), l = T(D.valid), c = T(!1), p = T(n ?? "touchedOrSubmit"), u = (d) => {
|
|
1222
|
+
l.set(d);
|
|
1223
1223
|
};
|
|
1224
1224
|
let g;
|
|
1225
|
-
const S = async (
|
|
1225
|
+
const S = async (d) => {
|
|
1226
1226
|
if (t != null) {
|
|
1227
|
-
const f = await t(
|
|
1227
|
+
const f = await t(d);
|
|
1228
1228
|
u(f);
|
|
1229
1229
|
}
|
|
1230
|
-
}, v = async (
|
|
1231
|
-
a.set(
|
|
1230
|
+
}, v = async (d) => {
|
|
1231
|
+
a.set(d), s?.(d);
|
|
1232
1232
|
const f = p.value;
|
|
1233
1233
|
if (t != null) {
|
|
1234
1234
|
if (f === "onSubmit")
|
|
1235
1235
|
return;
|
|
1236
1236
|
const E = r ?? 0;
|
|
1237
1237
|
E > 0 ? (g && clearTimeout(g), g = setTimeout(() => {
|
|
1238
|
-
S(
|
|
1239
|
-
}, E)) : await S(
|
|
1238
|
+
S(d);
|
|
1239
|
+
}, E)) : await S(d);
|
|
1240
1240
|
}
|
|
1241
|
-
},
|
|
1241
|
+
}, h = new M(
|
|
1242
1242
|
[],
|
|
1243
1243
|
v,
|
|
1244
1244
|
a,
|
|
@@ -1249,9 +1249,9 @@ function we({
|
|
|
1249
1249
|
},
|
|
1250
1250
|
i ?? F
|
|
1251
1251
|
);
|
|
1252
|
-
return
|
|
1252
|
+
return h.onDispose(() => {
|
|
1253
1253
|
c.dispose(), a.dispose(), l.dispose(), p.dispose(), g && clearTimeout(g);
|
|
1254
|
-
}), { controller:
|
|
1254
|
+
}), { controller: h, setStatus: u };
|
|
1255
1255
|
}
|
|
1256
1256
|
function Z(e) {
|
|
1257
1257
|
return B(o.disabled(e.disabled), o.name(e.name));
|
|
@@ -1320,7 +1320,7 @@ function Le({
|
|
|
1320
1320
|
initialValue: e,
|
|
1321
1321
|
validationMode: i ?? "touchedOrSubmit",
|
|
1322
1322
|
validateDebounceMs: n,
|
|
1323
|
-
validate: (i ?? "touchedOrSubmit") === "onSubmit" ? void 0 : async (u) => K(
|
|
1323
|
+
validate: (i ?? "touchedOrSubmit") === "onSubmit" || s == null ? void 0 : async (u) => K(
|
|
1324
1324
|
await s["~standard"].validate(u)
|
|
1325
1325
|
)
|
|
1326
1326
|
}), l = T(!1), c = r.object();
|
|
@@ -1329,10 +1329,13 @@ function Le({
|
|
|
1329
1329
|
setStatus: a,
|
|
1330
1330
|
submit: async (u) => {
|
|
1331
1331
|
if (l.set(!0), u?.preventDefault(), c.markAllTouched(), (i ?? "touchedOrSubmit") === "onSubmit") {
|
|
1332
|
-
const S = c.signal.value, v =
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1332
|
+
const S = c.signal.value, v = s?.["~standard"].validate;
|
|
1333
|
+
if (v == null) {
|
|
1334
|
+
l.set(!1);
|
|
1335
|
+
return;
|
|
1336
|
+
}
|
|
1337
|
+
const h = K(await v(S));
|
|
1338
|
+
if (a(h), h.type === "invalid") {
|
|
1336
1339
|
l.set(!1);
|
|
1337
1340
|
return;
|
|
1338
1341
|
}
|
|
@@ -1389,15 +1392,15 @@ function je({
|
|
|
1389
1392
|
}, ...c) {
|
|
1390
1393
|
const p = C.map(
|
|
1391
1394
|
r,
|
|
1392
|
-
(
|
|
1393
|
-
), u = C.map(e, (
|
|
1395
|
+
(d) => !!d || a != null
|
|
1396
|
+
), u = C.map(e, (d) => d ?? "info"), g = C.map(s, (d) => d ?? "subtle"), S = w(
|
|
1394
1397
|
t,
|
|
1395
1398
|
u
|
|
1396
1399
|
)(
|
|
1397
|
-
(
|
|
1398
|
-
), v = T(!0),
|
|
1400
|
+
(d, f) => d ?? (f === "danger" ? "alert" : "status")
|
|
1401
|
+
), v = T(!0), h = j(
|
|
1399
1402
|
q,
|
|
1400
|
-
(
|
|
1403
|
+
(d) => b.div(
|
|
1401
1404
|
o.class(
|
|
1402
1405
|
w(
|
|
1403
1406
|
u,
|
|
@@ -1431,7 +1434,7 @@ function je({
|
|
|
1431
1434
|
p,
|
|
1432
1435
|
() => ae({
|
|
1433
1436
|
size: "xs",
|
|
1434
|
-
label:
|
|
1437
|
+
label: d.$.closeModal,
|
|
1435
1438
|
onClick: () => {
|
|
1436
1439
|
v.set(!1), a?.();
|
|
1437
1440
|
}
|
|
@@ -1439,7 +1442,7 @@ function je({
|
|
|
1439
1442
|
)
|
|
1440
1443
|
)
|
|
1441
1444
|
);
|
|
1442
|
-
return O(v, () =>
|
|
1445
|
+
return O(v, () => h);
|
|
1443
1446
|
}
|
|
1444
1447
|
export {
|
|
1445
1448
|
ve as A,
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";const s=require("@tempots/dom"),k=require("./translations-DQxg-W9w.cjs"),$=new Map;function M(e){const t=$.get(e)??0;return $.set(e,t+1),`${e}-${t}`}const v={notAsked:{type:"NotAsked"},loading(e=void 0){return{type:"Loading",previousValue:e}},success(e){return{type:"AsyncSuccess",value:e}},failure(e){return{type:"AsyncFailure",error:e}},isSuccess(e){return e.type==="AsyncSuccess"},isFailure(e){return e.type==="AsyncFailure"},isNotAsked(e){return e.type==="NotAsked"},isLoading(e){return e.type==="Loading"},getOrElse(e,t){return v.isSuccess(e)?e.value:t},getOrElseLazy(e,t){return v.isSuccess(e)?e.value:t()},getOrNull(e){return v.isSuccess(e)?e.value:null},getOrUndefined(e){return v.isSuccess(e)?e.value:void 0},getUnsafe:e=>{if(v.isSuccess(e))return e.value;throw v.isFailure(e)?e.error:new Error("Cannot get value from a not-asked or loading result")},match:(e,{success:t,failure:n,loading:a,notAsked:r=a})=>v.isSuccess(e)?t(e.value):v.isFailure(e)?n(e.error):v.isNotAsked(e)?r():a(e.previousValue),whenSuccess:(e,t)=>(v.isSuccess(e)&&t(e.value),e),whenFailure:(e,t)=>(v.isFailure(e)&&t(e.error),e),equals:(e,t,n={valueEquals:(a,r)=>a===r,errorEquals:(a,r)=>a===r})=>e.type==="AsyncSuccess"&&t.type==="AsyncSuccess"?n.valueEquals(e.value,t.value):e.type==="AsyncFailure"&&t.type==="AsyncFailure"?n.errorEquals(e.error,t.error):e.type==="Loading"&&t.type==="Loading"?n.valueEquals(e.previousValue,t.previousValue):e.type==="NotAsked"&&t.type==="NotAsked",all:e=>{const t=[];for(const n of e)if(v.isSuccess(n))t.push(n.value);else return n;return v.success(t)},ofPromise:async e=>{try{const t=await e;return v.success(t)}catch(t){return v.failure(t instanceof Error?t:new Error(String(t)))}}},O=(e,t)=>e===t||e!==e&&t!==t,w={valid:{type:"valid"},invalid(e){return{type:"invalid",error:e}},isValid(e){return e.type==="valid"},isInvalid(e){return e.type==="invalid"},match:(e,t,n)=>w.isValid(e)?t():n(e.error),toResult:(e,t)=>w.match(e,()=>f.success(t),n=>f.failure(n)),whenValid:(e,t)=>(w.isValid(e)&&t(),e),whenInvalid:(e,t)=>(w.isInvalid(e)&&t(e.error),e)},f={success(e){return{type:"Success",value:e}},failure(e){return{type:"Failure",error:e}},map:(e,t)=>e.type==="Success"?f.success(t(e.value)):e,flatMap:(e,t)=>e.type==="Success"?t(e.value):e,toAsync(e){return f.match(e,t=>v.success(t),t=>v.failure(t))},toValidation(e){return f.match(e,()=>w.valid,t=>w.invalid(t))},isSuccess(e){return e.type==="Success"},isFailure(e){return e.type==="Failure"},getOrElse(e,t){return f.isSuccess(e)?e.value:t},getOrElseLazy(e,t){return f.isSuccess(e)?e.value:t()},getOrNull(e){return f.isSuccess(e)?e.value:null},getOrUndefined(e){return f.isSuccess(e)?e.value:void 0},getUnsafe:e=>{if(f.isSuccess(e))return e.value;throw e.error},match:(e,t,n)=>f.isSuccess(e)?t(e.value):n(e.error),whenSuccess:(e,t)=>(f.isSuccess(e)&&t(e.value),e),whenFailure:(e,t)=>(f.isFailure(e)&&t(e.error),e),combine:(e,t,n,a)=>f.match(e,r=>f.match(t,i=>f.success(n(r,i)),i=>f.failure(i)),r=>f.match(t,i=>f.failure(r),i=>f.failure(a(r,i)))),equals:(e,t,n={valueEquals:(a,r)=>a===r,errorEquals:(a,r)=>a===r})=>e.type==="Success"&&t.type==="Success"?n.valueEquals(e.value,t.value):e.type==="Failure"&&t.type==="Failure"?n.errorEquals(e.error,t.error):!1,all:e=>{const t=[];for(const n of e)if(f.isSuccess(n))t.push(n.value);else return n;return f.success(t)}};function x({size:e="sm",icon:t="line-md:close",disabled:n,roundedness:a="full",color:r="base",onClick:i,label:l},...o){return s.Use(k.BeatUII18n,c=>{const d=s.coalesce(l,c.$.closeModal);return k.Button({variant:"text",size:e,roundedness:a,disabled:n,color:r,onClick:i},s.attr.title(d),s.aria.label(d),...o,k.Icon({icon:t,size:e??"sm"}))})}function T(e){return`bc-label bc-label--${e}`}const Z=(...e)=>s.html.span(s.attr.class(T("emphasis")),...e),N=(...e)=>s.html.span(s.attr.class(T("default")),...e),j=(...e)=>s.html.span(s.attr.class(T("muted")),...e),ee=(...e)=>s.html.span(s.attr.class(T("danger")),...e),te=e=>{const{value:t,onBlur:n,onChange:a,placeholder:r,disabled:i,id:l,checkedIcon:o,uncheckedIcon:c,iconSize:d="lg"}=e,u=l??M("checkbox"),b=`${u}-label`,S=()=>{if(s.Value.get(i??!1))return;const p=s.Value.get(t);a?.(!p)},g=p=>{s.Value.get(i??!1)||(p.key===" "||p.key==="Enter")&&(p.preventDefault(),S())};return k.InputContainer({baseContainer:!0,growInput:!1,...e,input:s.html.span(s.attr.class("bc-checkbox-input"),s.html.span(s.attr.class("bc-checkbox-input__checkbox"),s.attr.class(s.Value.map(t,p=>p?"bc-checkbox-input__checkbox--checked":"bc-checkbox-input__checkbox--unchecked")),s.attr.class(s.Value.map(i??!1,p=>p?"bc-checkbox-input__checkbox--disabled":"")),s.attr.id(u),s.attr.role("checkbox"),s.attr.tabindex(s.Value.map(i??!1,p=>p?-1:0)),s.aria.checked(t),s.aria.disabled(i),r!=null?s.aria.labelledby(b):s.Empty,s.on.keydown(g),n!=null?s.on.blur(n):s.Empty,k.Icon({icon:s.computedOf(t,o,c)((p,h,m)=>p?h??"akar-icons/check-box-fill":m??"akar-icons/box"),accessibility:"decorative",size:d})),r!=null?s.html.label(s.attr.class("bc-checkbox-input__label"),s.attr.id(b),s.attr.for(u),j(r)):s.Empty)},s.on.click(S))},q=s.html.span(s.attr.class("bc-input-wrapper__required")," *");function se(e){const t=["bc-input-wrapper"];return e!=="vertical"&&t.push(`bc-input-wrapper--${e}`),t.join(" ")}function ne(e,t){const n=["bc-input-wrapper__label-text"];return e?n.push("bc-input-wrapper__label-text--error"):t?n.push("bc-input-wrapper__label-text--disabled"):n.push("bc-input-wrapper__label-text--default"),n.join(" ")}function L(e,t){if(e==="horizontal-fixed"&&t!=null)return`--input-wrapper-label-width: ${t}`}const F=({required:e,label:t,labelChildren:n,context:a,description:r,content:i,error:l,labelFor:o,hasError:c,disabled:d,layout:u,labelWidth:b},...S)=>{const g=c??l!=null,p=d??!1,h=u??"vertical",m=M("input-wrapper"),C=r?`${m}-description`:void 0,I=l!=null?`${m}-error`:void 0,_=s.computedOf(h)(y=>y!=="vertical");return s.html.div(s.attr.class(s.Value.map(h,y=>se(y))),s.When(s.computedOf(h,b??void 0)((y,E)=>L(y,E)!=null),()=>s.attr.style(s.Value.map(s.computedOf(h,b??void 0)((y,E)=>L(y,E)),y=>y))),t!=null||a!=null?s.html.div(s.attr.class("bc-input-wrapper__header"),s.html.div(s.attr.class("bc-input-wrapper__label-section"),s.html.label(s.attr.class("bc-input-wrapper__label"),o!=null?s.attr.for(o):s.Empty,s.html.span(s.attr.class(s.computedOf(g,p)((y,E)=>ne(y??!1,E??!1))),t),t!=null&&e?q:s.Empty),s.When(s.computedOf(_,r)((y,E)=>y&&E!=null),()=>s.html.div(s.attr.class("bc-input-wrapper__description bc-input-wrapper__description--under-label"),s.attr.id(C),r))),a!=null?N(a):s.Empty,n):s.Empty,s.html.div(s.attr.class("bc-input-wrapper__content"),[C,I].filter(Boolean).length>0?s.dataAttr.describedby([C,I].filter(Boolean).join(" ")):s.Empty,e?s.dataAttr.required("true"):s.Empty,s.When(g,()=>s.dataAttr.invalid("true")),i),s.When(s.computedOf(_,r)((y,E)=>!y&&E!=null),()=>s.html.div(s.attr.class("bc-input-wrapper__description"),s.attr.id(C),r)),l!=null?s.When(g,()=>s.html.div(s.attr.class("bc-input-wrapper__error"),s.attr.id(I),s.aria.live("polite"),s.attr.role("alert"),l)):null,...S)};function re(...e){return s.html.div(s.attr.class("bc-stack"),...e)}const ae=e=>{const t={name:"email",autocomplete:"email",...e},{value:n,before:a,onBlur:r,onChange:i,onInput:l,placeholder:o}=t,c=a??k.Icon({icon:"line-md:email",size:"sm",color:"neutral"});return s.Use(k.BeatUII18n,d=>k.InputContainer({...e,before:c,input:s.input.email(k.CommonInputAttributes(t),s.attr.placeholder(s.coalesce(o,d.$.emailPlaceholderText)),s.attr.value(n),s.attr.class("bc-input"),r!=null?s.on.blur(s.emitValue(r)):s.Empty,i!=null?s.on.change(s.emitValue(i)):s.Empty,l!=null?s.on.input(s.emitValue(l)):s.Empty)}))},ie=e=>{const{value:t,onBlur:n,onChange:a,onInput:r,before:i,after:l,hasError:o,disabled:c,autocomplete:d,placeholder:u,...b}=e,S={name:"password",disabled:c,...b},g=s.prop(!0),p=s.computedOf(g,d)((h,m)=>h?m??"current-password":"off");return s.Use(k.BeatUII18n,h=>{const m=s.computedOf(h.$.passwordPlaceholderText,g,u)((I,_,y)=>_?"•••••••••••••••":y??I),C=s.html.button(s.attr.type("button"),s.attr.class("bc-input-container__password-toggle"),s.aria.label(h.$.togglePasswordVisibility),s.on.click(()=>g.update(I=>!I)),s.When(g,()=>k.Icon({icon:"line-md:watch"}),()=>k.Icon({icon:"line-md:watch-off"})));return k.InputContainer({before:i,disabled:c,hasError:o,input:s.html.input(k.CommonInputAttributes({...S,autocomplete:p,placeholder:m}),s.When(g,()=>s.Fragment(s.attr.type("password")),()=>s.Fragment(s.attr.type("text"))),s.attr.class("bc-input"),s.attr.value(t),n!=null?s.on.blur(s.emitValue(n)):s.Empty,a!=null?s.on.change(s.emitValue(a)):s.Empty,r!=null?s.on.input(s.emitValue(r)):s.Empty),after:l!=null?s.Fragment(C,l):C})})},U=(e,t)=>()=>{e.markTouched(),t?.()},W=(e,t)=>n=>{e.change(n),t?.(n)};function B(e,t){const{controller:n,onBlur:a,onChange:r,...i}=t;return e({id:n.name,disabled:n.disabled,value:n.signal,hasError:n.errorVisible,...i,onChange:W(n,r),onBlur:U(n,a)})}function le(e,t,...n){return F({...t,content:B(e,t)},...n)}function H(e,t){const{toInput:n,fromInput:a,controller:r,...i}=t,l=r.transform(n,a);return B(e,{...i,controller:l})}function oe(e,t,...n){return F({...t,content:H(e,t)},...n)}function ce(e){return e.split(".").map(n=>{const a=n.match(/^\[(\d+)\]$/);return a?Number(a[1]):n})}function z(e){return typeof e=="number"?`[${e}]`:`.${e}`}function R(e){if(e.length===0)return"";const[t,...n]=e;return[typeof t=="number"?`[${t}]`:t,...n.map(z)].join("")}function D(e){return function(n){if(n.type==="valid")return n;let a=n.error;for(const r of e)if(a=a?.dependencies?.[r],a==null)return w.valid;return w.invalid(a)}}class V{path;change;signal;status;error;hasError;touched;errorVisible;dirty;dependencyErrors;#e={disabled:s.prop(!1),touched:s.prop(!1)};#s;#t=s.prop(void 0);parent;disabled;#n=[];disabledOrHasErrors;constructor(t,n,a,r,i,l=O){this.path=t,this.change=n,this.signal=a,this.status=r,this.#s=l,this.#t.set(a.value),this.error=r.map(o=>o?.type==="invalid"?o.error?.message:void 0),this.hasError=this.error.map(o=>o!=null),this.touched=this.#e.touched,i.validationMode?this.errorVisible=s.computedOf(this.hasError,this.touched,i.validationMode)((o,c,d)=>d==="continuous"?!!o:!!o&&!!c):this.errorVisible=s.computedOf(this.hasError,this.touched)((o,c)=>!!o&&!!c),this.dirty=s.computedOf(this.signal,this.#t)((o,c)=>!this.#s(o,c)),this.dependencyErrors=r.map(o=>o?.type==="invalid"?o.error?.dependencies:void 0),this.parent=i,this.disabled=s.computedOf(this.#e.disabled,i.disabled)((o,c)=>o||c),this.disabledOrHasErrors=s.computedOf(this.disabled,this.hasError)((o,c)=>o||c),this.onDispose(()=>{this.#e.disabled.dispose(),this.#e.touched.dispose(),this.disabled.dispose(),this.error.dispose(),this.errorVisible.dispose(),this.dirty.dispose(),this.#t.dispose(),this.dependencyErrors.dispose(),this.disabledOrHasErrors.dispose()})}get name(){return R(this.path)}onDispose=t=>{this.#n.push(t)};dispose=()=>{for(const t of this.#n)try{t()}catch(n){console.error("Error in dispose callback:",n)}this.#n.length=0};setDisabled=t=>{this.#e.disabled.set(t)};disable=()=>this.setDisabled(!0);enable=()=>this.setDisabled(!1);markTouched=()=>{this.#e.touched.set(!0)};resetTouched=()=>{this.#e.touched.set(!1)};markPristine=()=>{this.#t.set(this.signal.value)};reset=()=>{this.change(this.#t.value)};array=(t=O)=>new G(this.path,this.change,this.signal,this.status,this.parent,t);object=(t=O)=>new K(this.path,this.change,this.signal,this.status,this.parent,t);transform=(t,n,a=[],r=O)=>new V([...this.path,...a],i=>this.change(n(i)),this.signal.map(t,r),this.status.map(D(a)),this.parent,r);asyncTransform=(t,n,a,r=[],i=O)=>new V([...this.path,...r],l=>{n(l).then(o=>this.change(o))},this.signal.mapAsync(t,a,void 0,i),this.status.map(D(r)),this.parent,i)}class K extends V{#e=new Map;#s=new Map;#t=new Map;#n=s.prop(!1);touchedDeep=this.#n;#a=new Map;#r=new Map;#l=s.prop(!1);dirtyDeep=this.#l;#c;#u;#o=()=>{let t=!1;for(const n of this.#s.values())if(n){t=!0;break}this.#n.set(this.touched.value||t)};constructor(t,n,a,r,i,l){super(t,n,a.map(c=>c??{},l),r,i,l),this.#c=this.touched.on(()=>{this.#o()}),this.#u=this.dirty.on(()=>{this.#i()});const o=this.signal.on(()=>this.#i());this.onDispose(()=>{for(const c of this.#e.values())c.dispose();this.#e.clear();for(const c of this.#t.values())c();this.#t.clear(),this.#s.clear(),this.#n.dispose();for(const c of this.#r.values())c();this.#r.clear(),this.#a.clear(),this.#l.dispose(),this.#c(),this.#u(),o()})}field=t=>{if(this.#e.has(t))return this.#e.get(t);const n=async l=>{this.change({...this.signal.value,[t]:l})},a=new V([...this.path,t],n,this.signal.map(l=>l[t]),this.status.map(D([t])),{disabled:this.disabled,validationMode:this.parent.validationMode});this.#e.set(t,a);const r=a.touched.on(l=>{this.#s.set(t,l),this.#o()});this.#t.set(t,r);const i=a.dirty.on(l=>{this.#a.set(t,l),this.#i()});return this.#r.set(t,i),a};markAllTouched=()=>{this.markTouched();const t=this.signal.value;for(const n of Object.keys(t))this.field(n).markTouched();for(const n of this.#e.values())n.markTouched()};markAllPristine=()=>{this.markPristine();const t=this.signal.value;for(const n of Object.keys(t))this.field(n).markPristine?.();for(const n of this.#e.values())n.markPristine?.()};#i=()=>{let t=!1;for(const n of this.#a.values())if(n){t=!0;break}this.#l.set(this.dirty.value||t)}}class G extends V{#e=new Array;length;#s=new Map;#t=new Map;#n=s.prop(!1);touchedDeep=this.#n;#a=new Map;#r=new Map;#l=s.prop(!1);dirtyDeep=this.#l;#c;#u;#o=()=>{let t=!1;for(const n of this.#s.values())if(n){t=!0;break}this.#n.set(this.touched.value||t)};constructor(t,n,a,r,i,l){const o=a.map(u=>u??[],l);super(t,n,o,r,i,l);const c=o.on(u=>{const b=this.#e.length-u.length;b>0&&(this.#e.splice(u.length,b).forEach((S,g)=>{const p=u.length+g;S.dispose(),this.#t.get(p)?.(),this.#t.delete(p),this.#s.delete(p),this.#r.get(p)?.(),this.#r.delete(p),this.#a.delete(p)}),this.#o(),this.#i())});this.length=o.map(u=>u.length),this.#c=this.touched.on(()=>{this.#o()}),this.#u=this.dirty.on(()=>{this.#i()});const d=this.signal.on(()=>this.#i());this.onDispose(()=>{for(const u of this.#e)u.dispose();this.length.dispose(),this.#e.length=0,c(),o.dispose();for(const u of this.#t.values())u();this.#t.clear(),this.#s.clear(),this.#n.dispose();for(const u of this.#r.values())u();this.#r.clear(),this.#a.clear(),this.#l.dispose(),this.#c(),this.#u(),d()})}item=t=>{if(this.#e[t])return this.#e[t];const n=async l=>{const o=this.signal.value.slice();o[t]=l,this.change(o)},a=new V([...this.path,t],n,this.signal.map(l=>l[t]),this.status.map(D([t])),{disabled:this.disabled,validationMode:this.parent.validationMode});this.#e[t]=a;const r=a.touched.on(l=>{this.#s.set(t,l),this.#o()});this.#t.set(t,r);const i=a.dirty.on(l=>{this.#a.set(t,l),this.#i()});return this.#r.set(t,i),a};push=(...t)=>{this.change([...this.signal.value,...t])};pop=()=>{this.splice(this.signal.value.length-1,1)};shift=()=>{this.splice(0,1)};unshift=(...t)=>{this.change([...t,...this.signal.value])};removeAt=t=>{this.splice(t,1)};splice=(t,n)=>{const a=this.signal.value.slice();a.splice(t,n),this.change(a)};move=(t,n,a=1)=>{if(a<1||t===n)return;const r=this.signal.value.slice(),i=r.splice(t,a);r.splice(n,0,...i),this.change(r)};markAllTouched=()=>{this.markTouched();const t=this.signal.value.length;for(let n=0;n<t;n++)this.item(n).markTouched()};markAllPristine=()=>{this.markPristine();const t=this.signal.value.length;for(let n=0;n<t;n++)this.item(n).markPristine?.()};#i=()=>{let t=!1;for(const n of this.#a.values())if(n){t=!0;break}this.#l.set(this.dirty.value||t)}}function J(e){function t(n){return typeof n=="number"?n:n.toString()}return e.map(n=>typeof n=="object"&&n.key!=null?t(n.key):t(n))}function Q(e){const t=e.filter(r=>r.path==null||r.path.length===0).map(r=>r.message),n=e.filter(r=>r.path!=null&&r.path.length>0).reduce((r,i)=>{const l=J(i.path),o=l.pop();let c=r;for(const d of l)c.dependencies==null&&(c.dependencies={}),c.dependencies[d]==null&&(c.dependencies[d]={}),c=c.dependencies[d];return c.dependencies==null&&(c.dependencies={}),c.dependencies[o]={message:i.message},r},{}),a=t.join(`
|
|
2
|
-
`);return{...n,message:a!=""?a:void 0}}function X({initialValue:e,onChange:t,validate:n,equals:a,validationMode:r,validateDebounceMs:i}){const l=s.Value.deriveProp(e),o=s.prop(w.valid),c=s.prop(!1),
|
|
1
|
+
"use strict";const s=require("@tempots/dom"),k=require("./translations-DQxg-W9w.cjs"),$=new Map;function M(e){const t=$.get(e)??0;return $.set(e,t+1),`${e}-${t}`}const v={notAsked:{type:"NotAsked"},loading(e=void 0){return{type:"Loading",previousValue:e}},success(e){return{type:"AsyncSuccess",value:e}},failure(e){return{type:"AsyncFailure",error:e}},isSuccess(e){return e.type==="AsyncSuccess"},isFailure(e){return e.type==="AsyncFailure"},isNotAsked(e){return e.type==="NotAsked"},isLoading(e){return e.type==="Loading"},getOrElse(e,t){return v.isSuccess(e)?e.value:t},getOrElseLazy(e,t){return v.isSuccess(e)?e.value:t()},getOrNull(e){return v.isSuccess(e)?e.value:null},getOrUndefined(e){return v.isSuccess(e)?e.value:void 0},getUnsafe:e=>{if(v.isSuccess(e))return e.value;throw v.isFailure(e)?e.error:new Error("Cannot get value from a not-asked or loading result")},match:(e,{success:t,failure:n,loading:a,notAsked:r=a})=>v.isSuccess(e)?t(e.value):v.isFailure(e)?n(e.error):v.isNotAsked(e)?r():a(e.previousValue),whenSuccess:(e,t)=>(v.isSuccess(e)&&t(e.value),e),whenFailure:(e,t)=>(v.isFailure(e)&&t(e.error),e),equals:(e,t,n={valueEquals:(a,r)=>a===r,errorEquals:(a,r)=>a===r})=>e.type==="AsyncSuccess"&&t.type==="AsyncSuccess"?n.valueEquals(e.value,t.value):e.type==="AsyncFailure"&&t.type==="AsyncFailure"?n.errorEquals(e.error,t.error):e.type==="Loading"&&t.type==="Loading"?n.valueEquals(e.previousValue,t.previousValue):e.type==="NotAsked"&&t.type==="NotAsked",all:e=>{const t=[];for(const n of e)if(v.isSuccess(n))t.push(n.value);else return n;return v.success(t)},ofPromise:async e=>{try{const t=await e;return v.success(t)}catch(t){return v.failure(t instanceof Error?t:new Error(String(t)))}}},O=(e,t)=>e===t||e!==e&&t!==t,w={valid:{type:"valid"},invalid(e){return{type:"invalid",error:e}},isValid(e){return e.type==="valid"},isInvalid(e){return e.type==="invalid"},match:(e,t,n)=>w.isValid(e)?t():n(e.error),toResult:(e,t)=>w.match(e,()=>f.success(t),n=>f.failure(n)),whenValid:(e,t)=>(w.isValid(e)&&t(),e),whenInvalid:(e,t)=>(w.isInvalid(e)&&t(e.error),e)},f={success(e){return{type:"Success",value:e}},failure(e){return{type:"Failure",error:e}},map:(e,t)=>e.type==="Success"?f.success(t(e.value)):e,flatMap:(e,t)=>e.type==="Success"?t(e.value):e,toAsync(e){return f.match(e,t=>v.success(t),t=>v.failure(t))},toValidation(e){return f.match(e,()=>w.valid,t=>w.invalid(t))},isSuccess(e){return e.type==="Success"},isFailure(e){return e.type==="Failure"},getOrElse(e,t){return f.isSuccess(e)?e.value:t},getOrElseLazy(e,t){return f.isSuccess(e)?e.value:t()},getOrNull(e){return f.isSuccess(e)?e.value:null},getOrUndefined(e){return f.isSuccess(e)?e.value:void 0},getUnsafe:e=>{if(f.isSuccess(e))return e.value;throw e.error},match:(e,t,n)=>f.isSuccess(e)?t(e.value):n(e.error),whenSuccess:(e,t)=>(f.isSuccess(e)&&t(e.value),e),whenFailure:(e,t)=>(f.isFailure(e)&&t(e.error),e),combine:(e,t,n,a)=>f.match(e,r=>f.match(t,i=>f.success(n(r,i)),i=>f.failure(i)),r=>f.match(t,i=>f.failure(r),i=>f.failure(a(r,i)))),equals:(e,t,n={valueEquals:(a,r)=>a===r,errorEquals:(a,r)=>a===r})=>e.type==="Success"&&t.type==="Success"?n.valueEquals(e.value,t.value):e.type==="Failure"&&t.type==="Failure"?n.errorEquals(e.error,t.error):!1,all:e=>{const t=[];for(const n of e)if(f.isSuccess(n))t.push(n.value);else return n;return f.success(t)}};function x({size:e="sm",icon:t="line-md:close",disabled:n,roundedness:a="full",color:r="base",onClick:i,label:l},...o){return s.Use(k.BeatUII18n,c=>{const p=s.coalesce(l,c.$.closeModal);return k.Button({variant:"text",size:e,roundedness:a,disabled:n,color:r,onClick:i},s.attr.title(p),s.aria.label(p),...o,k.Icon({icon:t,size:e??"sm"}))})}function T(e){return`bc-label bc-label--${e}`}const Z=(...e)=>s.html.span(s.attr.class(T("emphasis")),...e),N=(...e)=>s.html.span(s.attr.class(T("default")),...e),j=(...e)=>s.html.span(s.attr.class(T("muted")),...e),ee=(...e)=>s.html.span(s.attr.class(T("danger")),...e),te=e=>{const{value:t,onBlur:n,onChange:a,placeholder:r,disabled:i,id:l,checkedIcon:o,uncheckedIcon:c,iconSize:p="lg"}=e,u=l??M("checkbox"),b=`${u}-label`,S=()=>{if(s.Value.get(i??!1))return;const h=s.Value.get(t);a?.(!h)},g=h=>{s.Value.get(i??!1)||(h.key===" "||h.key==="Enter")&&(h.preventDefault(),S())};return k.InputContainer({baseContainer:!0,growInput:!1,...e,input:s.html.span(s.attr.class("bc-checkbox-input"),s.html.span(s.attr.class("bc-checkbox-input__checkbox"),s.attr.class(s.Value.map(t,h=>h?"bc-checkbox-input__checkbox--checked":"bc-checkbox-input__checkbox--unchecked")),s.attr.class(s.Value.map(i??!1,h=>h?"bc-checkbox-input__checkbox--disabled":"")),s.attr.id(u),s.attr.role("checkbox"),s.attr.tabindex(s.Value.map(i??!1,h=>h?-1:0)),s.aria.checked(t),s.aria.disabled(i),r!=null?s.aria.labelledby(b):s.Empty,s.on.keydown(g),n!=null?s.on.blur(n):s.Empty,k.Icon({icon:s.computedOf(t,o,c)((h,d,m)=>h?d??"akar-icons/check-box-fill":m??"akar-icons/box"),accessibility:"decorative",size:p})),r!=null?s.html.label(s.attr.class("bc-checkbox-input__label"),s.attr.id(b),s.attr.for(u),j(r)):s.Empty)},s.on.click(S))},q=s.html.span(s.attr.class("bc-input-wrapper__required")," *");function se(e){const t=["bc-input-wrapper"];return e!=="vertical"&&t.push(`bc-input-wrapper--${e}`),t.join(" ")}function ne(e,t){const n=["bc-input-wrapper__label-text"];return e?n.push("bc-input-wrapper__label-text--error"):t?n.push("bc-input-wrapper__label-text--disabled"):n.push("bc-input-wrapper__label-text--default"),n.join(" ")}function L(e,t){if(e==="horizontal-fixed"&&t!=null)return`--input-wrapper-label-width: ${t}`}const F=({required:e,label:t,labelChildren:n,context:a,description:r,content:i,error:l,labelFor:o,hasError:c,disabled:p,layout:u,labelWidth:b},...S)=>{const g=c??l!=null,h=p??!1,d=u??"vertical",m=M("input-wrapper"),C=r?`${m}-description`:void 0,I=l!=null?`${m}-error`:void 0,_=s.computedOf(d)(y=>y!=="vertical");return s.html.div(s.attr.class(s.Value.map(d,y=>se(y))),s.When(s.computedOf(d,b??void 0)((y,E)=>L(y,E)!=null),()=>s.attr.style(s.Value.map(s.computedOf(d,b??void 0)((y,E)=>L(y,E)),y=>y))),t!=null||a!=null?s.html.div(s.attr.class("bc-input-wrapper__header"),s.html.div(s.attr.class("bc-input-wrapper__label-section"),s.html.label(s.attr.class("bc-input-wrapper__label"),o!=null?s.attr.for(o):s.Empty,s.html.span(s.attr.class(s.computedOf(g,h)((y,E)=>ne(y??!1,E??!1))),t),t!=null&&e?q:s.Empty),s.When(s.computedOf(_,r)((y,E)=>y&&E!=null),()=>s.html.div(s.attr.class("bc-input-wrapper__description bc-input-wrapper__description--under-label"),s.attr.id(C),r))),a!=null?N(a):s.Empty,n):s.Empty,s.html.div(s.attr.class("bc-input-wrapper__content"),[C,I].filter(Boolean).length>0?s.dataAttr.describedby([C,I].filter(Boolean).join(" ")):s.Empty,e?s.dataAttr.required("true"):s.Empty,s.When(g,()=>s.dataAttr.invalid("true")),i),s.When(s.computedOf(_,r)((y,E)=>!y&&E!=null),()=>s.html.div(s.attr.class("bc-input-wrapper__description"),s.attr.id(C),r)),l!=null?s.When(g,()=>s.html.div(s.attr.class("bc-input-wrapper__error"),s.attr.id(I),s.aria.live("polite"),s.attr.role("alert"),l)):null,...S)};function re(...e){return s.html.div(s.attr.class("bc-stack"),...e)}const ae=e=>{const t={name:"email",autocomplete:"email",...e},{value:n,before:a,onBlur:r,onChange:i,onInput:l,placeholder:o}=t,c=a??k.Icon({icon:"line-md:email",size:"sm",color:"neutral"});return s.Use(k.BeatUII18n,p=>k.InputContainer({...e,before:c,input:s.input.email(k.CommonInputAttributes(t),s.attr.placeholder(s.coalesce(o,p.$.emailPlaceholderText)),s.attr.value(n),s.attr.class("bc-input"),r!=null?s.on.blur(s.emitValue(r)):s.Empty,i!=null?s.on.change(s.emitValue(i)):s.Empty,l!=null?s.on.input(s.emitValue(l)):s.Empty)}))},ie=e=>{const{value:t,onBlur:n,onChange:a,onInput:r,before:i,after:l,hasError:o,disabled:c,autocomplete:p,placeholder:u,...b}=e,S={name:"password",disabled:c,...b},g=s.prop(!0),h=s.computedOf(g,p)((d,m)=>d?m??"current-password":"off");return s.Use(k.BeatUII18n,d=>{const m=s.computedOf(d.$.passwordPlaceholderText,g,u)((I,_,y)=>_?"•••••••••••••••":y??I),C=s.html.button(s.attr.type("button"),s.attr.class("bc-input-container__password-toggle"),s.aria.label(d.$.togglePasswordVisibility),s.on.click(()=>g.update(I=>!I)),s.When(g,()=>k.Icon({icon:"line-md:watch"}),()=>k.Icon({icon:"line-md:watch-off"})));return k.InputContainer({before:i,disabled:c,hasError:o,input:s.html.input(k.CommonInputAttributes({...S,autocomplete:h,placeholder:m}),s.When(g,()=>s.Fragment(s.attr.type("password")),()=>s.Fragment(s.attr.type("text"))),s.attr.class("bc-input"),s.attr.value(t),n!=null?s.on.blur(s.emitValue(n)):s.Empty,a!=null?s.on.change(s.emitValue(a)):s.Empty,r!=null?s.on.input(s.emitValue(r)):s.Empty),after:l!=null?s.Fragment(C,l):C})})},U=(e,t)=>()=>{e.markTouched(),t?.()},W=(e,t)=>n=>{e.change(n),t?.(n)};function B(e,t){const{controller:n,onBlur:a,onChange:r,...i}=t;return e({id:n.name,disabled:n.disabled,value:n.signal,hasError:n.errorVisible,...i,onChange:W(n,r),onBlur:U(n,a)})}function le(e,t,...n){return F({...t,content:B(e,t)},...n)}function H(e,t){const{toInput:n,fromInput:a,controller:r,...i}=t,l=r.transform(n,a);return B(e,{...i,controller:l})}function oe(e,t,...n){return F({...t,content:H(e,t)},...n)}function ce(e){return e.split(".").map(n=>{const a=n.match(/^\[(\d+)\]$/);return a?Number(a[1]):n})}function z(e){return typeof e=="number"?`[${e}]`:`.${e}`}function R(e){if(e.length===0)return"";const[t,...n]=e;return[typeof t=="number"?`[${t}]`:t,...n.map(z)].join("")}function D(e){return function(n){if(n.type==="valid")return n;let a=n.error;for(const r of e)if(a=a?.dependencies?.[r],a==null)return w.valid;return w.invalid(a)}}class V{path;change;signal;status;error;hasError;touched;errorVisible;dirty;dependencyErrors;#e={disabled:s.prop(!1),touched:s.prop(!1)};#s;#t=s.prop(void 0);parent;disabled;#n=[];disabledOrHasErrors;constructor(t,n,a,r,i,l=O){this.path=t,this.change=n,this.signal=a,this.status=r,this.#s=l,this.#t.set(a.value),this.error=r.map(o=>o?.type==="invalid"?o.error?.message:void 0),this.hasError=this.error.map(o=>o!=null),this.touched=this.#e.touched,i.validationMode?this.errorVisible=s.computedOf(this.hasError,this.touched,i.validationMode)((o,c,p)=>p==="continuous"?!!o:!!o&&!!c):this.errorVisible=s.computedOf(this.hasError,this.touched)((o,c)=>!!o&&!!c),this.dirty=s.computedOf(this.signal,this.#t)((o,c)=>!this.#s(o,c)),this.dependencyErrors=r.map(o=>o?.type==="invalid"?o.error?.dependencies:void 0),this.parent=i,this.disabled=s.computedOf(this.#e.disabled,i.disabled)((o,c)=>o||c),this.disabledOrHasErrors=s.computedOf(this.disabled,this.hasError)((o,c)=>o||c),this.onDispose(()=>{this.#e.disabled.dispose(),this.#e.touched.dispose(),this.disabled.dispose(),this.error.dispose(),this.errorVisible.dispose(),this.dirty.dispose(),this.#t.dispose(),this.dependencyErrors.dispose(),this.disabledOrHasErrors.dispose()})}get name(){return R(this.path)}onDispose=t=>{this.#n.push(t)};dispose=()=>{for(const t of this.#n)try{t()}catch(n){console.error("Error in dispose callback:",n)}this.#n.length=0};setDisabled=t=>{this.#e.disabled.set(t)};disable=()=>this.setDisabled(!0);enable=()=>this.setDisabled(!1);markTouched=()=>{this.#e.touched.set(!0)};resetTouched=()=>{this.#e.touched.set(!1)};markPristine=()=>{this.#t.set(this.signal.value)};reset=()=>{this.change(this.#t.value)};array=(t=O)=>new G(this.path,this.change,this.signal,this.status,this.parent,t);object=(t=O)=>new K(this.path,this.change,this.signal,this.status,this.parent,t);transform=(t,n,a=[],r=O)=>new V([...this.path,...a],i=>this.change(n(i)),this.signal.map(t,r),this.status.map(D(a)),this.parent,r);asyncTransform=(t,n,a,r=[],i=O)=>new V([...this.path,...r],l=>{n(l).then(o=>this.change(o))},this.signal.mapAsync(t,a,void 0,i),this.status.map(D(r)),this.parent,i)}class K extends V{#e=new Map;#s=new Map;#t=new Map;#n=s.prop(!1);touchedDeep=this.#n;#a=new Map;#r=new Map;#l=s.prop(!1);dirtyDeep=this.#l;#c;#u;#o=()=>{let t=!1;for(const n of this.#s.values())if(n){t=!0;break}this.#n.set(this.touched.value||t)};constructor(t,n,a,r,i,l){super(t,n,a.map(c=>c??{},l),r,i,l),this.#c=this.touched.on(()=>{this.#o()}),this.#u=this.dirty.on(()=>{this.#i()});const o=this.signal.on(()=>this.#i());this.onDispose(()=>{for(const c of this.#e.values())c.dispose();this.#e.clear();for(const c of this.#t.values())c();this.#t.clear(),this.#s.clear(),this.#n.dispose();for(const c of this.#r.values())c();this.#r.clear(),this.#a.clear(),this.#l.dispose(),this.#c(),this.#u(),o()})}field=t=>{if(this.#e.has(t))return this.#e.get(t);const n=async l=>{this.change({...this.signal.value,[t]:l})},a=new V([...this.path,t],n,this.signal.map(l=>l[t]),this.status.map(D([t])),{disabled:this.disabled,validationMode:this.parent.validationMode});this.#e.set(t,a);const r=a.touched.on(l=>{this.#s.set(t,l),this.#o()});this.#t.set(t,r);const i=a.dirty.on(l=>{this.#a.set(t,l),this.#i()});return this.#r.set(t,i),a};markAllTouched=()=>{this.markTouched();const t=this.signal.value;for(const n of Object.keys(t))this.field(n).markTouched();for(const n of this.#e.values())n.markTouched()};markAllPristine=()=>{this.markPristine();const t=this.signal.value;for(const n of Object.keys(t))this.field(n).markPristine?.();for(const n of this.#e.values())n.markPristine?.()};#i=()=>{let t=!1;for(const n of this.#a.values())if(n){t=!0;break}this.#l.set(this.dirty.value||t)}}class G extends V{#e=new Array;length;#s=new Map;#t=new Map;#n=s.prop(!1);touchedDeep=this.#n;#a=new Map;#r=new Map;#l=s.prop(!1);dirtyDeep=this.#l;#c;#u;#o=()=>{let t=!1;for(const n of this.#s.values())if(n){t=!0;break}this.#n.set(this.touched.value||t)};constructor(t,n,a,r,i,l){const o=a.map(u=>u??[],l);super(t,n,o,r,i,l);const c=o.on(u=>{const b=this.#e.length-u.length;b>0&&(this.#e.splice(u.length,b).forEach((S,g)=>{const h=u.length+g;S.dispose(),this.#t.get(h)?.(),this.#t.delete(h),this.#s.delete(h),this.#r.get(h)?.(),this.#r.delete(h),this.#a.delete(h)}),this.#o(),this.#i())});this.length=o.map(u=>u.length),this.#c=this.touched.on(()=>{this.#o()}),this.#u=this.dirty.on(()=>{this.#i()});const p=this.signal.on(()=>this.#i());this.onDispose(()=>{for(const u of this.#e)u.dispose();this.length.dispose(),this.#e.length=0,c(),o.dispose();for(const u of this.#t.values())u();this.#t.clear(),this.#s.clear(),this.#n.dispose();for(const u of this.#r.values())u();this.#r.clear(),this.#a.clear(),this.#l.dispose(),this.#c(),this.#u(),p()})}item=t=>{if(this.#e[t])return this.#e[t];const n=async l=>{const o=this.signal.value.slice();o[t]=l,this.change(o)},a=new V([...this.path,t],n,this.signal.map(l=>l[t]),this.status.map(D([t])),{disabled:this.disabled,validationMode:this.parent.validationMode});this.#e[t]=a;const r=a.touched.on(l=>{this.#s.set(t,l),this.#o()});this.#t.set(t,r);const i=a.dirty.on(l=>{this.#a.set(t,l),this.#i()});return this.#r.set(t,i),a};push=(...t)=>{this.change([...this.signal.value,...t])};pop=()=>{this.splice(this.signal.value.length-1,1)};shift=()=>{this.splice(0,1)};unshift=(...t)=>{this.change([...t,...this.signal.value])};removeAt=t=>{this.splice(t,1)};splice=(t,n)=>{const a=this.signal.value.slice();a.splice(t,n),this.change(a)};move=(t,n,a=1)=>{if(a<1||t===n)return;const r=this.signal.value.slice(),i=r.splice(t,a);r.splice(n,0,...i),this.change(r)};markAllTouched=()=>{this.markTouched();const t=this.signal.value.length;for(let n=0;n<t;n++)this.item(n).markTouched()};markAllPristine=()=>{this.markPristine();const t=this.signal.value.length;for(let n=0;n<t;n++)this.item(n).markPristine?.()};#i=()=>{let t=!1;for(const n of this.#a.values())if(n){t=!0;break}this.#l.set(this.dirty.value||t)}}function J(e){function t(n){return typeof n=="number"?n:n.toString()}return e.map(n=>typeof n=="object"&&n.key!=null?t(n.key):t(n))}function Q(e){const t=e.filter(r=>r.path==null||r.path.length===0).map(r=>r.message),n=e.filter(r=>r.path!=null&&r.path.length>0).reduce((r,i)=>{const l=J(i.path),o=l.pop();let c=r;for(const p of l)c.dependencies==null&&(c.dependencies={}),c.dependencies[p]==null&&(c.dependencies[p]={}),c=c.dependencies[p];return c.dependencies==null&&(c.dependencies={}),c.dependencies[o]={message:i.message},r},{}),a=t.join(`
|
|
2
|
+
`);return{...n,message:a!=""?a:void 0}}function X({initialValue:e,onChange:t,validate:n,equals:a,validationMode:r,validateDebounceMs:i}){const l=s.Value.deriveProp(e),o=s.prop(w.valid),c=s.prop(!1),p=s.prop(r??"touchedOrSubmit"),u=d=>{o.set(d)};let b;const S=async d=>{if(n!=null){const m=await n(d);u(m)}},g=async d=>{l.set(d),t?.(d);const m=p.value;if(n!=null){if(m==="onSubmit")return;const C=i??0;C>0?(b&&clearTimeout(b),b=setTimeout(()=>{S(d)},C)):await S(d)}},h=new V([],g,l,o,{disabled:c,validationMode:p},a??O);return h.onDispose(()=>{c.dispose(),l.dispose(),o.dispose(),p.dispose(),b&&clearTimeout(b)}),{controller:h,setStatus:u}}function P(e){return s.Fragment(s.attr.disabled(e.disabled),s.attr.name(e.name))}function ue(e,{triggerOn:t="change"}={}){return s.Fragment(P(e),s.attr.value(e.signal),(t==="input"?s.on.input:s.on.change)(s.emitValue(e.change)))}function he(e,{triggerOn:t="change"}={}){return s.Fragment(P(e),s.attr.valueAsNumber(e.signal),(t==="input"?s.on.input:s.on.change)(s.emitValueAsNumber(e.change)))}function A(e){return e.issues!=null?w.invalid(Q(e.issues)):w.valid}async function de({task:e,errorMessage:t,errorPath:n=["root"],validation:a}){try{const r=await e();return a!=null?a(r):w.valid}catch(r){const i=t??(r instanceof Error?r.message:"Operation failed");return n.length===1&&n[0]==="root"?w.invalid({message:i}):w.invalid({dependencies:Y(n,i)})}}function Y(e,t){if(e.length===1)return{[e[0]]:{message:t}};const[n,...a]=e;return{[n]:{dependencies:Y(a,t)}}}function pe({initialValue:e={},schema:t,onSubmit:n=async()=>w.valid,validationMode:a,validateDebounceMs:r}){const{controller:i,setStatus:l}=X({initialValue:e,validationMode:a??"touchedOrSubmit",validateDebounceMs:r,validate:(a??"touchedOrSubmit")==="onSubmit"||t==null?void 0:async u=>A(await t["~standard"].validate(u))}),o=s.prop(!1),c=i.object();return c.onDispose(o.dispose),{controller:c,setStatus:l,submit:async u=>{if(o.set(!0),u?.preventDefault(),c.markAllTouched(),(a??"touchedOrSubmit")==="onSubmit"){const S=c.signal.value,g=t?.["~standard"].validate;if(g==null){o.set(!1);return}const h=A(await g(S));if(l(h),h.type==="invalid"){o.set(!1);return}}const b=await n(c.signal.value);o.set(!1),b.type==="invalid"&&l(b)},submitting:o}}function me(e){switch(e){case"success":return"material-symbols:check-circle-outline";case"warning":return"material-symbols:warning-outline";case"danger":return"material-symbols:error-outline";case"info":default:return"material-symbols:info-outline"}}function fe(e){switch(e){case"success":return"success";case"warning":return"warning";case"danger":return"danger";case"info":default:return"info"}}function be(e,t,n,a){const r=["bc-notice",`bc-notice--${e}`,`bc-notice--tone-${t}`];return n&&r.push("bc-notice--dismissible"),a&&a.length>0&&r.push(a),r.join(" ")}function ge({variant:e="info",tone:t="subtle",role:n,title:a,icon:r,closable:i=!1,onDismiss:l,class:o},...c){const p=s.Value.map(i,d=>!!d||l!=null),u=s.Value.map(e,d=>d??"info"),b=s.Value.map(t,d=>d??"subtle"),S=s.computedOf(n,u)((d,m)=>d??(m==="danger"?"alert":"status")),g=s.prop(!0),h=s.Use(k.BeatUII18n,d=>s.html.div(s.attr.class(s.computedOf(u,b,p,o)((m,C,I,_)=>be(m,C,I,_))),s.attr.role(s.Value.map(S,m=>m)),s.Unless(s.Value.map(r,m=>m===!1),()=>s.html.div(s.attr.class("bc-notice__icon"),k.Icon({icon:s.computedOf(r,u)((m,C)=>m===void 0?me(C):String(m)),size:"md",color:s.Value.map(u,fe)}))),s.html.div(s.attr.class("bc-notice__body"),s.Ensure(a,m=>s.html.div(s.attr.class("bc-notice__title"),m)),s.html.div(s.attr.class("bc-notice__content"),...c)),s.When(p,()=>x({size:"xs",label:d.$.closeModal,onClick:()=>{g.set(!1),l?.()}}))));return s.When(g,()=>h)}exports.ArrayController=G;exports.BaseControl=B;exports.BaseMappedControl=H;exports.CheckboxInput=te;exports.CloseButton=x;exports.Control=le;exports.Controller=V;exports.DangerLabel=ee;exports.EmailInput=ae;exports.EmphasisLabel=Z;exports.InputWrapper=F;exports.Label=N;exports.MappedControl=oe;exports.MutedLabel=j;exports.Notice=ge;exports.O=O;exports.ObjectController=K;exports.PasswordInput=ie;exports.RequiredSymbol=q;exports.Stack=re;exports.a=w;exports.connectCommonAttributes=P;exports.connectNumberInput=he;exports.connectStringInput=ue;exports.convertStandardSchemaIssues=Q;exports.convertStandardSchemaPathToPath=J;exports.makeMapValidation=D;exports.makeOnBlurHandler=U;exports.makeOnChangeHandler=W;exports.parsePath=ce;exports.pathToString=R;exports.sessionId=M;exports.standardSchemaResultToValidation=A;exports.taskToValidation=de;exports.useController=X;exports.useForm=pe;exports.wrapSegment=z;
|
|
@@ -2,7 +2,7 @@ import { Signal, Value } from '@tempots/dom';
|
|
|
2
2
|
import { StandardSchemaV1 } from './schema/standard-schema-v1';
|
|
3
3
|
import { ControllerValidation, Controller, ObjectController } from './controller';
|
|
4
4
|
export interface UseFormOptions<T> {
|
|
5
|
-
schema
|
|
5
|
+
schema?: StandardSchemaV1<T, T>;
|
|
6
6
|
initialValue?: Value<T>;
|
|
7
7
|
onSubmit?: (value: T) => Promise<ControllerValidation>;
|
|
8
8
|
validationMode?: 'onSubmit' | 'continuous' | 'touchedOrSubmit';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const t=require("@tempots/dom"),At=require("./colors-Qc1mmmfr.cjs"),Dt=require("./timer-DK_yKNwE.cjs"),nt=require("@tempots/ui"),y=require("./translations-DQxg-W9w.cjs"),A=require("./notice-0Xhzr7qR.cjs");class Tt extends Error{constructor(n="Missing implementation"){super(n),this.name="MissingImplementationError"}}const St=e=>Bt(e).split("_").join(" "),Bt=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()),Ot=e=>e.substring(0,1).toUpperCase()+e.substring(1),Ut=e=>{if(typeof Buffer<"u")return Buffer.from(e,"base64").toString("utf8");if(typeof atob<"u")return atob(e);throw new Tt("No implementation found for base64 decoding")};function J({onChange:e,value:n,accept:l="*/*",enableClick:a=!0,content:r,disabled:u=!1,allowMultiple:s}){return t.Use(y.BeatUII18n,c=>{const o=t.Value.deriveProp(n??[]),i=t.prop(!1),m=h=>{h.preventDefault(),h.stopPropagation(),i.value=!0},d=h=>{h.preventDefault(),h.stopPropagation(),(!h.currentTarget||!h.currentTarget.contains(h.relatedTarget))&&(i.value=!1)},b=h=>{h.preventDefault(),h.stopPropagation(),i.value=!1;const g=Array.from(h.dataTransfer?.files||[]);g.length>0&&(o.value=g,e(g))},p=h=>{t.Value.get(a)&&h.currentTarget.querySelector('input[type="file"]')?.click()};let v=null;const f=()=>{if(v==null)return;const h=Array.from(v.files??[]);h.length>0&&(o.value=h,e(h)),v.value=""},V=h=>{t.Value.get(a)&&(h.key==="Enter"||h.key===" ")&&(h.preventDefault(),p(h))};return t.html.div(t.attr.role("button"),t.attr.tabindex(t.Value.map(a,h=>h?0:-1)),t.attr.style("position: relative;"),t.on.dragover(m),t.on.dragleave(d),t.on.drop(b),t.on.click(p),t.on.keydown(V),t.html.input(t.attr.type("file"),t.attr.disabled(u),t.attr.accept(l),t.attr.multiple(s),t.attr.style("position: absolute; left: -9999px; opacity: 0; pointer-events: none;"),t.on.change(f),t.WithElement(h=>(v=h,t.OnDispose(o.on(g=>{const k=globalThis.DataTransfer;if(k!=null){const C=new k;g.forEach(I=>C.items.add(I)),h.files=C.files}}))))),t.aria.label(t.bind(c.$.dropZoneInstructions)(a)),r({files:o,clear:()=>o.value=[],change:o.set}))})}function Nt(e,n){return e.length===n.length&&e.every((l,a)=>l===n[a])}function Lt(e,n){const l=["bc-segmented-control",`bc-segmented-control--size-${e}`];return n&&l.push("bc-segmented-control--disabled"),l.join(" ")}function Rt({options:e,value:n,onChange:l,size:a="md",disabled:r=!1},...u){const s=At.f(e).map(([c,o])=>({key:c,label:o}));return t.WithElement(()=>{const c=Object.fromEntries(s.map((i,m)=>[i.key,m])),o=t.prop(s.map(()=>({left:0,width:0})),Nt);return t.html.div(t.attr.class(t.computedOf(a,r)((i,m)=>Lt(i??"md",m??!1))),t.html.div(t.attr.class("bc-segmented-control__container"),t.html.div(t.attr.class("bc-segmented-control__indicator"),t.style.width(t.computedOf(n,o)((i,m)=>{const{width:d}=m[c[i]??0];return`${d}px`})),t.style.left(t.computedOf(n,o)((i,m)=>{const{left:d}=m[c[i]??0];return`${d}px`}))),s.map(({label:i,key:m},d)=>t.html.button(t.attr.type("button"),t.on.click(b=>{b.preventDefault(),t.Value.get(r)||l?.(m)}),t.attr.disabled(r),t.attr.class("bc-segmented-control__segment"),t.attr.class(t.Value.map(n,b=>b===m?"bc-segmented-control__segment--active":"bc-segmented-control__segment--inactive")),nt.ElementRect(b=>{function p(){o.update(f=>{const V=[...f];return V[d]={width:b.value.width,left:b.value.localLeft},V})}const v=Dt.g(p);return t.OnDispose(v,b.on(p))}),i))),...u)})}function zt(e){const n=e.type.toLowerCase();return n.startsWith("image/")&&(n.includes("jpeg")||n.includes("jpg")||n.includes("png")||n.includes("gif")||n.includes("webp")||n.includes("svg"))}function Wt(e){const n=e.type.toLowerCase();return n.startsWith("image/")?"vscode-icons:file-type-image":n.startsWith("video/")?"vscode-icons:file-type-video":n.startsWith("audio/")?"vscode-icons:file-type-audio":n.includes("pdf")?"vscode-icons:file-type-pdf2":n.includes("word")||n.includes("document")?"vscode-icons:file-type-word":n.includes("excel")||n.includes("spreadsheet")?"vscode-icons:file-type-excel":n.includes("powerpoint")||n.includes("presentation")?"vscode-icons:file-type-powerpoint":n.includes("zip")||n.includes("archive")?"vscode-icons:file-type-zip":n.includes("text")?"vscode-icons:file-type-text":n.includes("json")?"vscode-icons:file-type-json-official":n.includes("csv")?"vscode-icons:file-type-csv":n.includes("xml")?"vscode-icons:file-type-xml":n.includes("yaml")?"vscode-icons:file-type-yaml-official":"vscode-icons:file-type-binary"}function ot(e){return t.When(e.map(zt),()=>{const n=t.prop(null);return e.on(l=>{n.value&&URL.revokeObjectURL(n.value);const a=URL.createObjectURL(l);n.value=a}),t.html.div(t.attr.class("bc-file-input__thumbnail-container"),t.html.img(t.attr.src(n),t.attr.alt(e.map(l=>l.name)),t.attr.class("bc-file-input__thumbnail"),t.OnDispose(()=>{n.value&&URL.revokeObjectURL(n.value)})))},()=>y.Icon({icon:e.map(Wt)}))}const dt=(e,...n)=>{const{value:l=t.prop([]),accept:a="*/*",maxFiles:r,maxFileSize:u,onChange:s,onBlur:c,disabled:o,hasError:i,mode:m="default",showFileList:d=!0,...b}=e,p=l,v=t.Value.map(m,C=>C==="compact"),f=C=>{let I=C;if(r!=null){const x=t.Value.get(r);I=I.slice(0,x)}if(u){const x=t.Value.get(u);I=I.filter(w=>w.size<=x)}s?.(I)},V=C=>{const x=p.value.filter((w,_)=>_!==C);s?.(x)},h=()=>{s?.([])},g=({files:C,clear:I,change:x})=>t.Use(y.BeatUII18n,w=>t.html.div(t.attr.class("bc-file-input__drop-zone"),t.html.div(t.attr.class("bc-file-input__drop-zone-content bc-file-input__drop-zone-content--empty"),y.Icon({icon:"mdi:cloud-upload-outline",size:"xl"}),t.html.div(t.attr.class("bc-file-input__drop-zone-text"),t.bind(w.$.filesInputInstructions)(r,u,w.$.fileSizeUnits.value))))),k=({files:C})=>t.Use(y.BeatUII18n,I=>t.html.div(t.attr.class("bc-file-input__compact-input"),t.When(C.map(x=>x.length>0),()=>t.html.span(t.attr.class("bc-file-input__compact-value"),t.ForEach(C,x=>t.html.span(t.attr.class("bc-file-input__compact-value-item"),ot(x),t.html.span(t.attr.class("bc-file-input__compact-value-item-name"),x.$.name)))),()=>t.html.span(t.attr.class("bc-file-input__compact-placeholder"),y.Icon({icon:"mdi:cloud-upload-outline",size:"sm"})," ",t.bind(I.$.filesInputInstructions)(r,u,I.$.fileSizeUnits.value)))));return t.Use(y.BeatUII18n,C=>y.InputContainer({baseContainer:t.Value.map(v,I=>!I),disabled:o,hasError:i,after:t.When(v,()=>t.When(p.map(({length:I})=>I>0),()=>A.CloseButton({size:"sm",label:C.$.clearAllFiles,disabled:o,onClick:h},t.attr.class("bc-file-input__compact-clear")))),...b,input:t.When(v,()=>t.html.div(t.attr.class("bc-file-input bc-file-input--compact"),J({value:p,accept:a,enableClick:!0,allowMultiple:t.Value.map(r??1/0,I=>I>1),disabled:o,onChange:f,content:k})),()=>t.html.div(t.attr.class("bc-file-input"),J({value:p,accept:a,enableClick:!0,allowMultiple:t.Value.map(r??1/0,I=>I>1),disabled:o,onChange:f,content:g}),t.When(d,()=>t.NotEmpty(p,()=>t.Fragment(t.html.div(t.attr.class("bc-file-input__file-list"),t.ForEach(p,(I,x)=>{const w=x.index;return t.html.div(t.attr.class("bc-file-input__file-item"),t.html.div(t.attr.class("bc-file-input__file-icon"),ot(I)),t.html.div(t.attr.class("bc-file-input__file-info"),t.html.div(t.attr.class("bc-file-input__file-name"),t.attr.title(I.$.name),I.$.name),t.html.div(t.attr.class("bc-file-input__file-meta"),t.computedOf(I.$.size,C.$.fileSizeUnits)((_,M)=>y.formatFileSize(_,{units:M}))," • ",t.computedOf(I.$.type,C.$.unknownType)((_,M)=>_||M))),A.CloseButton({size:"sm",label:C.$.removeFile,disabled:o,onClick:()=>V(w)},t.attr.class("bc-file-input__remove-button")))})),t.When(p.map(({length:I})=>I>1),()=>t.html.div(t.attr.class("bc-file-input__clear-all-button-container"),t.html.button(t.attr.type("button"),t.attr.class("bc-file-input__clear-all-button"),t.attr.disabled(o),C.$.clearAllFiles,t.on.click(I=>{I.preventDefault(),I.stopPropagation(),h()})))))))))},...n))};async function mt(e){return new Promise((n,l)=>{const a=new FileReader;a.readAsDataURL(e),a.onload=()=>{const r=a.result;n(r.split(",")[1])},a.onerror=r=>l(r)})}function Pt(e){return Promise.all(e.map(mt))}function jt(e){if(e.length>=4){if(e[0]===137&&e[1]===80&&e[2]===78&&e[3]===71)return"image/png";if(e[0]===255&&e[1]===216)return"image/jpeg";if(e[0]===71&&e[1]===73&&e[2]===70)return"image/gif";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)return"image/webp"}try{if(new TextDecoder("utf-8").decode(e.slice(0,256)).includes("<svg"))return"image/svg+xml"}catch{}return"application/octet-stream"}function Ht(e){const n=Ut(e??""),l=n.length,a=new Uint8Array(l);for(let r=0;r<l;r++)a[r]=n.charCodeAt(r);return a}function ft(e){const{value:n,onChange:l,onInput:a,...r}=e,u=new Map,s=t.Value.toSignal(n).map(m=>m.map((d,b)=>{const p=u.get(d),v=Ht(d??""),f=p?.type||jt(v),V=p?.name??`file-${b}`,h=v.buffer.slice(v.byteOffset,v.byteOffset+v.byteLength),g=new Blob([h],{type:f});return new File([g],V,{type:f})})),c=m=>d=>{m&&Pt(d).then(b=>{for(const[p,v]of b.entries())u.set(v,{name:d[p].name,type:d[p].type});m(b)})},o=c(l),i=c(a);return dt({...r,value:s,onChange:o,onInput:i})}function Zt(e){const{value:n,onInput:l,onChange:a,...r}=e;return ft({...r,maxFiles:1,value:t.Value.map(n,u=>u==null?[]:[u]),onChange:u=>{a?.(u[0])},onInput:u=>{l?.(u[0])}})}function K(e){const n=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);return n?[parseInt(n[1],16),parseInt(n[2],16),parseInt(n[3],16)]:[0,0,0]}function tt(e,n,l){const a=r=>r.toString(16).padStart(2,"0");return`#${a(Math.max(0,Math.min(255,e)))}${a(Math.max(0,Math.min(255,n)))}${a(Math.max(0,Math.min(255,l)))}`}function qt(e){if(!e)return[0,0,0,1];const l=e.trim().match(/^#?([a-fA-F0-9]{3,4}|[a-fA-F0-9]{6}|[a-fA-F0-9]{8})$/);if(l){const d=l[1];if(d.length===8){const b=parseInt(d.slice(0,2),16),p=parseInt(d.slice(2,4),16),v=parseInt(d.slice(4,6),16),f=parseInt(d.slice(6,8),16)/255;return[b,p,v,f]}if(d.length===6)return[parseInt(d.slice(0,2),16),parseInt(d.slice(2,4),16),parseInt(d.slice(4,6),16),1];if(d.length===4){const b=parseInt(d[0]+d[0],16),p=parseInt(d[1]+d[1],16),v=parseInt(d[2]+d[2],16),f=parseInt(d[3]+d[3],16)/255;return[b,p,v,f]}if(d.length===3){const b=parseInt(d[0]+d[0],16),p=parseInt(d[1]+d[1],16),v=parseInt(d[2]+d[2],16);return[b,p,v,1]}}const a=e.match(/^rgba\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(0|1|0?\.\d+)\s*\)$/i);if(a)return[parseInt(a[1],10),parseInt(a[2],10),parseInt(a[3],10),parseFloat(a[4])];const r=e.match(/^rgb\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*\)$/i);if(r)return[parseInt(r[1],10),parseInt(r[2],10),parseInt(r[3],10),1];const u=e.match(/^hsla?\(\s*([+-]?[\d.]+)(?:deg)?\s*[ ,]?\s*([\d.]+)%\s*[ ,]?\s*([\d.]+)%\s*(?:[/,]\s*(\d?(?:\.\d+)?))?\s*\)$/i);if(u){const d=parseFloat(u[1]),b=parseFloat(u[2]),p=parseFloat(u[3]),v=u[4]!=null?parseFloat(u[4]):1,[f,V,h]=ht(d,b/100,p/100);return[f,V,h,v]}const s=e.match(/^hwb\(\s*([+-]?[\d.]+)(?:deg)?\s*[, ]\s*([\d.]+)%\s*[, ]\s*([\d.]+)%\s*(?:[/]\s*(\d?(?:\.\d+)?))?\s*\)$/i);if(s){const d=parseFloat(s[1]),b=parseFloat(s[2])/100,p=parseFloat(s[3])/100,v=s[4]!=null?parseFloat(s[4]):1,[f,V,h]=Gt(d,b,p);return[f,V,h,v]}const c=e.match(/^oklch\(\s*([+-]?[\d.]+%?)\s+([\d.]+)\s+([+-]?[\d.]+)(?:deg)?(?:\s*\/\s*(\d?(?:\.\d+)?))?\s*\)$/i);if(c){const d=c[1],b=parseFloat(c[2]),p=parseFloat(c[3]),v=c[4]!=null?parseFloat(c[4]):1,f=d.endsWith("%")?Math.max(0,Math.min(1,parseFloat(d)/100)):Math.max(0,Math.min(1,parseFloat(d))),[V,h,g]=Jt(f,b,p);return[V,h,g,v]}const[o,i,m]=K(e);return[o,i,m,1]}const Yt=(e,n,l,a)=>`rgba(${Math.round(e)}, ${Math.round(n)}, ${Math.round(l)}, ${Math.max(0,Math.min(1,Math.round(a*100)/100))})`;function Xt(e){let n=e+1831565813;return function(){return n=Math.imul(n^n>>>15,n|1),n^=n+Math.imul(n^n>>>7,n|61),((n^n>>>14)>>>0)/4294967296}}function ht(e,n,l){e=(e%360+360)%360;const a=(1-Math.abs(2*l-1))*n,r=a*(1-Math.abs(e/60%2-1)),u=l-a/2;let s=0,c=0,o=0;return 0<=e&&e<60?[s,c,o]=[a,r,0]:60<=e&&e<120?[s,c,o]=[r,a,0]:120<=e&&e<180?[s,c,o]=[0,a,r]:180<=e&&e<240?[s,c,o]=[0,r,a]:240<=e&&e<300?[s,c,o]=[r,0,a]:[s,c,o]=[a,0,r],[Math.round((s+u)*255),Math.round((c+u)*255),Math.round((o+u)*255)]}function Gt(e,n,l){e=(e%360+360)%360;const a=n+l;a>1&&(n/=a,l/=a);const[r,u,s]=ht(e,1,.5).map(d=>d/255),c=1-n-l,o=r*c+n,i=u*c+n,m=s*c+n;return[Math.round(o*255),Math.round(i*255),Math.round(m*255)]}function et(e,n,l){e/=255,n/=255,l/=255;const a=Math.max(e,n,l),r=Math.min(e,n,l);let u=0,s=0;const c=(a+r)/2,o=a-r;if(o!==0){switch(s=c>.5?o/(2-a-r):o/(a+r),a){case e:u=(n-l)/o+(n<l?6:0);break;case n:u=(l-e)/o+2;break;default:u=(e-n)/o+4}u*=60}return[Math.round(u),Math.round(s*100),Math.round(c*100)]}function Qt(e,n,l){const[a]=et(e,n,l),r=e/255,u=n/255,s=l/255,c=Math.min(r,u,s),o=1-Math.max(r,u,s);return[a,Math.round(c*100),Math.round(o*100)]}function X(e){const n=e/255;return n<=.04045?n/12.92:Math.pow((n+.055)/1.055,2.4)}function G(e){const n=e<=.0031308?12.92*e:1.055*Math.pow(e,.4166666666666667)-.055;return Math.round(Math.max(0,Math.min(1,n))*255)}function Jt(e,n,l){const a=l*Math.PI/180,r=Math.cos(a)*n,u=Math.sin(a)*n,s=e+.3963377774*r+.2158037573*u,c=e-.1055613458*r-.0638541728*u,o=e-.0894841775*r-1.291485548*u,i=s*s*s,m=c*c*c,d=o*o*o,b=4.0767416621*i-3.3077115913*m+.2309699292*d,p=-1.2684380046*i+2.6097574011*m-.3413193965*d,v=-.0041960863*i-.7034186147*m+1.707614701*d;return[G(b),G(p),G(v)]}function Kt(e,n,l){const a=X(e),r=X(n),u=X(l),s=.4122214708*a+.5363325363*r+.0514459929*u,c=.2119034982*a+.6806995451*r+.1073969566*u,o=.0883024619*a+.2817188376*r+.6299787005*u,i=Math.cbrt(s),m=Math.cbrt(c),d=Math.cbrt(o),b=.2104542553*i+.793617785*m-.0040720468*d,p=1.9779984951*i-2.428592205*m+.4505937099*d,v=.0259040371*i+.7827717662*m-.808675766*d,f=Math.sqrt(p*p+v*v);let V=Math.atan2(v,p)*180/Math.PI;return V<0&&(V+=360),[b,f,V]}function P(e,n,l,a,r,u){switch(r){case"hex":if(u){const s=o=>o.toString(16).padStart(2,"0"),c=Math.max(0,Math.min(255,Math.round(a*255)));return`#${s(e)}${s(n)}${s(l)}${s(c)}`}return tt(e,n,l);case"rgb":return`rgb(${e}, ${n}, ${l})`;case"rgba":return`rgba(${e}, ${n}, ${l}, ${Math.round(a*100)/100})`;case"hsl":{const[s,c,o]=et(e,n,l);return`hsl(${s}, ${c}%, ${o}%)`}case"hsla":{const[s,c,o]=et(e,n,l);return`hsla(${s}, ${c}%, ${o}%, ${Math.round(a*100)/100})`}case"hwb":{const[s,c,o]=Qt(e,n,l);return a<1?`hwb(${s} ${c}% ${o}% / ${Math.round(a*100)/100})`:`hwb(${s} ${c}% ${o}%)`}case"oklch":{const[s,c,o]=Kt(e,n,l),i=(Math.round(s*1e3)/1e3).toFixed(3),m=(Math.round(c*1e3)/1e3).toFixed(3),d=(Math.round(o*10)/10).toFixed(1),b=Math.round(a*100)/100;return u||a<1?`oklch(${i} ${m} ${d} / ${b})`:`oklch(${i} ${m} ${d})`}}}function j(e,n){return n?e==="rgb"?"rgba":e==="hsl"?"hsla":e:e==="rgba"?"rgb":e==="hsla"?"hsl":e}function te(e,n){const[l,a,r]=e,u=l<<16^a<<8^r,s=Xt(u),c=6+Math.floor(s()*5),o=.18+s()*.06,i=[];for(let p=0;p<c;p++){const v=p/c*Math.PI*2,f=n*(1+(s()*2-1)*o),V=Math.cos(v)*f,h=Math.sin(v)*f;i.push({x:V,y:h})}const m=(i[0].x+i[c-1].x)/2,d=(i[0].y+i[c-1].y)/2;let b=`M ${m.toFixed(3)} ${d.toFixed(3)}`;for(let p=0;p<c;p++){const v=i[p],f=i[(p+1)%c],V=(v.x+f.x)/2,h=(v.y+f.y)/2;b+=` Q ${v.x.toFixed(3)} ${v.y.toFixed(3)} ${V.toFixed(3)} ${h.toFixed(3)}`}return b+=" Z",b}const ee=e=>{const{value:n,onBlur:l,onChange:a,onInput:r,displayValue:u,size:s,withAlpha:c}=e,o=t.Value.map(s??32,x=>x),i=t.Value.map(n,x=>qt(x??"#000000")),m=t.Value.map(i,([x,w,_])=>[x,w,_]),d=t.Value.map(i,([,,,x])=>x),b=t.prop(t.Value.get(d)??1),p=t.Value.map(c??!1,x=>x),v=t.Value.map(e.colorTextFormat??"rgb",x=>x),f=t.computedOf(m,b,v,p)(([x,w,_],M,E,$)=>P(x,w,_,M??1,j(E,$),$)),V=t.Value.map(e.colorTextFormat??"hex",x=>x),h=t.Value.map(o,x=>`${-x/2} ${-x/2} ${x} ${x}`),g=t.computedOf(m,o)((x,w)=>te(x,w/2)),k=t.computedOf(m,b,p)(([x,w,_],M,E)=>E||M<1?Yt(x,w,_,M):tt(x,w,_)),C=t.html.div(t.attr.class("bc-color-input__control"),t.attr.class(t.Value.map(p,x=>x?"bc-color-input__control--alpha":"")),t.attr.style(t.computedOf(o)(x=>`min-width:${x+2}px;height:${x+2}px`)),t.svg.svg(t.attr.class("bc-color-input__svg"),t.svgAttr.viewBox(h),t.svg.path(t.svgAttr.d(g),t.svgAttr.fill(k))),t.html.input(t.attr.type("color"),y.CommonInputAttributes(e),t.attr.value(t.Value.map(m,([x,w,_])=>tt(x,w,_))),t.attr.class("bc-input bc-color-input bc-color-input__native"),l!=null?t.on.blur(l):t.Empty,a!=null?t.on.change(x=>{const w=x.target.value;if(!a)return;const[_,M,E]=K(w),$=t.Value.get(b)??1,F=j(t.Value.get(V),t.Value.get(p)),T=P(_,M,E,$,F,t.Value.get(p));a(T)}):t.Empty,r!=null?t.on.input(x=>{const w=x.target.value;if(!r)return;const[_,M,E]=K(w),$=t.Value.get(b)??1,F=j(t.Value.get(V),t.Value.get(p)),T=P(_,M,E,$,F,t.Value.get(p));r(T)}):t.Empty)),I=t.When(p,()=>t.html.input(t.attr.type("range"),t.attr.class("bc-color-input__alpha"),t.attr.min(0),t.attr.max(1),t.attr.step(.01),t.attr.value(t.Value.map(b,x=>String(x??1))),t.attr.disabled(e.disabled),t.on.input(x=>{const w=parseFloat(x.target.value);b.set(w);const[_,M,E]=t.Value.get(m),$=j(t.Value.get(V),t.Value.get(p)),F=P(_,M,E,w,$,t.Value.get(p));r?.(F)}),t.on.change(x=>{const w=parseFloat(x.target.value);b.set(w);const[_,M,E]=t.Value.get(m),$=j(t.Value.get(V),t.Value.get(p)),F=P(_,M,E,w,$,t.Value.get(p));a?.(F)})));return y.InputContainer({baseContainer:!0,...e,growInput:!1,input:C,after:t.Fragment(t.When(u??!1,()=>t.html.span(t.attr.class("bc-color-input__rgb"),f)),I,e.after)})},at="$$tts-exp-",gt=(e,n)=>t.WithElement(l=>{const a=`${at}${e}`;return t.OnDispose(t.Value.on(n,r=>Reflect.set(l,a,r)))}),ne=(e,n)=>{const l=`${at}${e}`;return a=>{n(Reflect.get(a.target,l))}},bt=(e,n)=>{const l=`${at}${e}`;return a=>{const r=a.target,u=r.selectedIndex,s=r.options[u];n(Reflect.get(s,l))}};function ae(e,n,l){const a=["bc-card"];return e!=="default"&&a.push(`bc-card--${e}`),n!=="md"&&a.push(`bc-card--padding-${n}`),l!=="lg"&&a.push(`bc-card--rounded-${l}`),a.join(" ")}function re({variant:e="default",size:n="md",roundedness:l="lg"}={},...a){return t.html.div(t.attr.class(t.computedOf(e,n,l)((r,u,s)=>ae(r??"default",u??"md",s??"lg"))),...a)}function H(...e){return t.html.div(t.attr.class("bc-group"),...e)}const le=({startEditing:e,value:n,onChange:l,placeholder:a,disabled:r})=>{const u=t.Value.deriveProp(e??!1),s=t.prop(!1),c=t.Value.map(r??!1,o=>o);return t.html.div(t.attr.class("bc-editable-text"),t.attr.class(t.Value.map(c,o=>o?"bc-editable-text--disabled":"")),t.aria.disabled(c),t.When(u,()=>t.html.input(t.attr.placeholder(a),t.attr.value(n),t.attr.class("bc-editable-text__input"),nt.AutoSelect(),t.on.keydown(o=>{o.key==="Enter"?u.set(!1):o.key==="Escape"&&(s.set(!0),u.set(!1))}),t.on.blur(t.emitValue(o=>{if(u.set(!1),s.value){s.set(!1);return}l(o)}))),()=>t.html.span(t.on.click(()=>{t.Value.get(c)||u.set(!0)}),t.attr.class("bc-editable-text__display"),t.When(t.Value.map(n,o=>o!=null&&o.trim()!==""),()=>t.html.span(t.attr.class("bc-editable-text__text"),n),()=>t.html.span(t.attr.class("bc-editable-text__placeholder"),a)),t.When(t.Value.map(c,o=>!o),()=>t.html.button(t.attr.type("button"),t.attr.class("bc-editable-text__edit-button"),t.Use(y.BeatUII18n,o=>t.aria.label(o.$.editLabel)),t.on.click(()=>u.set(!0)),y.Icon({icon:"line-md/pencil",color:"neutral"}))))))},vt=(e,n,l)=>t.Ensure(e,a=>t.OneOfType(a,{value:r=>{const u=t.computedOf(r,l)((s,c)=>n(s.value,c));return t.html.option(t.OnDispose(u.dispose),t.attr.selected(u),gt("value",r.$.value),r.$.label)},group:r=>t.html.optgroup(t.attr.label(r.$.group),t.ForEach(r.$.options,u=>vt(u,n,l))),break:()=>t.html.hr()})),xt=e=>{const{value:n,onBlur:l,onChange:a,options:r,unselectedLabel:u,equality:s=(i,m)=>i===m,after:c}=e;let o;return y.InputContainer({...e,after:t.Fragment(y.Icon({icon:"ph:caret-down-bold",color:"neutral",size:"sm"}),c),input:t.html.select(t.WithElement(i=>{o=i;const m=new MutationObserver(d=>{const{removedNodes:b}=d[0];b.length>0&&(o.selectedIndex=0)});return m.observe(i,{childList:!0}),t.OnDispose(()=>m.disconnect())}),y.CommonInputAttributes(e),t.attr.class("bc-native-select bc-input"),t.Use(y.BeatUII18n,i=>t.html.option(t.attr.hidden("hidden"),t.coalesce(u,i.$.selectOne))),t.ForEach(r,i=>vt(i,s,n)),l!=null?t.on.blur(l):t.Empty,a!=null?t.on.change(bt("value",i=>a(i))):t.Empty)},t.on.click(()=>{o?.focus(),typeof o?.showPicker=="function"&&o.showPicker()}))};function It(e){const{controller:n,onChange:l,onBlur:a,...r}=e;return xt({...r,value:n.signal,onChange:A.makeOnChangeHandler(n,l),onBlur:A.makeOnBlurHandler(n,a)})}function se(e){return A.InputWrapper({...e,content:It(e)})}function Vt(e,n,l){const a=e.length.map(r=>r);return t.Fragment(t.OnDispose(()=>a.dispose()),t.Repeat(a,r=>{const u=e.item(r.index),s=[];return t.Fragment(t.OnDispose(()=>{u.dispose(),s.forEach(c=>c())}),n({list:e,item:u,position:r,remove:()=>e.removeAt(r.index),move:c=>{switch(c){case"up":if(r.index===0)return;e.move(r.index,r.index-1);break;case"down":if(r.index===e.length.value-1)return;e.move(r.index,r.index+1);break;case"first":e.move(r.index,0);break;case"last":e.move(r.index,e.length.value-1)}},canMove:c=>{const o=(()=>{switch(c){case"up":return t.signal(r.index>0);case"down":return e.length.map(i=>r.index<i-1)}})();return s.push(()=>o.dispose()),o},cannotMove:c=>{const o=(()=>{switch(c){case"up":return t.signal(r.index===0);case"down":return e.length.map(i=>r.index===i-1)}})();return s.push(()=>o.dispose()),o}}))},l))}const ut={9:{pattern:/^[0-9]$/},A:{pattern:/^[A-Za-z]$/,transform:e=>e.toUpperCase()},"*":{pattern:/^.$/}},oe=e=>e instanceof RegExp;function yt(e,n,l){if(e==null)return[];const a=l?{...ut,...n}:n??ut,r=(s,c)=>{const o=a[c];o?s.push({type:"pattern",name:c,...o}):s.push({type:"literal",char:c})},u=[];if(typeof e=="string"){for(const s of e)r(u,s);return u}for(const s of e)if(typeof s=="string")if(s.length<=1)r(u,s);else for(const c of s)r(u,c);else oe(s)?u.push({type:"pattern",pattern:s}):typeof s=="object"&&s&&u.push(s);return u}function ue(e,n){return l=>{switch(e){case"digits":return/[0-9]/.test(l);case"letters":return/[A-Za-z]/.test(l);case"alphanumeric":return/[A-Za-z0-9]/.test(l);case"custom":return n?.(l)??!0;default:return!0}}}function ct(e,n,l,a,r,u){const s={raw:e,previousConformed:n,cursor:r??e.length,completed:!1},c=a.definitions??{},o=typeof l=="function"?l(e,s):l,i=yt(o,c,a.useDefaultDefinitions??!0),m=ue(a.allowMode,a.allow),d=new Set;for(const $ of i)$.type==="literal"&&d.add($.char);if(a.prefix)for(const $ of a.prefix)d.add($);if(a.suffix)for(const $ of a.suffix)d.add($);const b=Array.from(e).filter($=>m($)&&!d.has($));if(b.length===0)return{value:"",cursor:0,completed:!1};const p=[],v=[];let f=0,V=0,h=0,g=-1;for(const $ of i){if($.type==="literal"){p.push($.char),v.push({kind:"literal",filled:!0});continue}V+=$.optional?0:1;const F=b[f];if(F==null)break;if($.type==="any"){h++,p.push($.transform?$.transform(F):F),v.push({kind:"slot",filled:!0}),g=v.length-1,f++;continue}if($.type==="pattern")if($.pattern.test(F)){h++;const T=$.transform?$.transform(F):F;p.push(T),v.push({kind:"slot",filled:!0}),g=v.length-1,f++}else{f++;continue}}const k=p.join(""),C=(a.prefix??"")+k+(a.suffix??"");let x=(a.prefix??"").length;if(g>=0){let $=g+1;if((u?.policy??"smart")!=="sticky")for(;$<v.length&&v[$].kind==="literal";)$++;x+=$}const w=a.completion?.mode==="min"?(a.completion.minChars??0)<=h:a.completion?.mode==="custom"?!!a.completion.isComplete?.(C):V>0&&h>=V,_=a.pipe?.(C,{...s,completed:w});let M,E=x;return _===!1?(M=n,E=n.length):typeof _=="string"?(M=_,E=_.length):typeof _=="object"&&_?(M=_.value,E=_.cursor??_.value.length):M=C,{value:M,cursor:E,completed:w}}function ce(e,n){const l=n?.strategy??"none";return l==="custom"&&n?.unmask?n.unmask(e):l==="strip"?e.replace(/[^A-Za-z0-9]/g,""):e}const rt=e=>{const{value:n,onBlur:l,onChange:a,onInput:r,onAccept:u,onComplete:s,mask:c,definitions:o,useDefaultDefinitions:i,extraLiterals:m,prefix:d,suffix:b,autofix:p,pipe:v,completion:f,unmask:V,allowMode:h,allow:g,placeholder:k,placeholderOptions:C}=e,I=t.computedOf(n,c,o,i,m,d,b,p,f,V,h,k,C)((w,_,M,E,$,F,T,z,W,R,U,Z,O)=>_?ct(w??"","",_,{definitions:M??{},useDefaultDefinitions:E??!0,extraLiterals:$??[],autofix:z??"none",completion:W??{mode:"mask"},pipe:v??(D=>D),unmask:R??{strategy:"none"},allowMode:U??"all",allow:g,prefix:F,suffix:T}).value:w??""),x=(w,_)=>{const M=w.value??"",E=t.Value.get(n)??"",$=c!=null?t.Value.get(c):null,F=o!=null?t.Value.get(o):void 0,T=i!=null?t.Value.get(i):void 0,z=m!=null?t.Value.get(m):void 0,W=p!=null?t.Value.get(p):void 0,R=f!=null?t.Value.get(f):void 0,U=V!=null?t.Value.get(V):void 0,Z=h!=null?t.Value.get(h):void 0,O=d!=null?t.Value.get(d):void 0,D=b!=null?t.Value.get(b):void 0,{value:N,cursor:Y,completed:lt}=$?ct(M,E,$,{definitions:F??{},useDefaultDefinitions:T??!0,extraLiterals:z??[],autofix:W??"none",completion:R??{mode:"mask"},pipe:v??(Ft=>Ft),unmask:U??{strategy:"none"},allowMode:Z??"all",allow:g,prefix:O,suffix:D},w.selectionStart??M.length,e.cursor?t.Value.get(e.cursor):void 0):{value:M,cursor:M.length,completed:!0};if(N!==M){w.value=N;try{w.setSelectionRange(Y,Y)}catch{}}const st=ce(N,U);u?.({raw:st,conformed:N,completed:lt,cursor:Y}),_==="input"?r?.(N):(a?.(N),lt&&s?.({raw:st,conformed:N}))};return y.InputContainer({...e,input:t.input.text(y.CommonInputAttributes(e),t.attr.value(I),t.attr.class("bc-input"),l!=null?t.on.blur(l):t.Empty,t.WithElement(w=>w instanceof HTMLInputElement?t.Fragment(t.on.input(()=>x(w,"input")),t.on.change(()=>x(w,"change")),t.on.keydown(_=>{if(_.key!=="Backspace"||!(e.cursor?t.Value.get(e.cursor)?.backspaceRubberBand??!0:!0))return;const E=w.selectionStart??0,$=w.selectionEnd??E;if(E!==$||E<=0)return;const F=w.value??"",T=c!=null?t.Value.get(c):null;if(!T)return;const z=o!=null?t.Value.get(o):void 0,W=i!=null?t.Value.get(i):!0,R=d!=null?t.Value.get(d):void 0,U=b!=null?t.Value.get(b):void 0,Z=yt(typeof T=="function"?T(F,{raw:F,previousConformed:F,cursor:E,completed:!1}):T,z??{},W??!0),O=new Set;for(const D of Z)D.type==="literal"&&O.add(D.char);if(R)for(const D of R)O.add(D);if(U)for(const D of U)O.add(D);if(O.has(F[E-1])){let D=E-1;for(;D>=0&&O.has(F[D]);)D--;D>=0&&(_.preventDefault(),_.stopPropagation(),w.value=F.slice(0,D)+F.slice(D+1),x(w,"input"))}})):t.Empty))})};function B(e,n,l){const a=t.Value.map(e,u=>u!=null),r=y.defaultMessages.clearValue;return t.When(a,()=>t.html.button(t.attr.type("button"),t.attr.class("bc-input-container__reset"),t.aria.label(r),t.attr.title(r),t.attr.disabled(n??!1),y.Icon({icon:"mdi:close",size:"sm"}),t.on.click(u=>{u.preventDefault(),u.stopPropagation(),l?.(null)})))}const ie=e=>{const{value:n,onBlur:l,onChange:a,after:r,disabled:u}=e,s=B(n,u,a);return y.InputContainer({...e,input:t.input.date(y.CommonInputAttributes(e),t.attr.valueAsDate(n),t.attr.class("bc-input"),l!=null?t.on.blur(t.emitValue(l)):t.Empty,a!=null?t.on.change(t.emitValueAsNullableDate(a)):t.Empty),after:r!=null?t.Fragment(s,r):s})},pe=e=>{const n=e.getFullYear(),l=e.getMonth()+1,a=e.getDate(),r=e.getHours(),u=e.getMinutes(),s=e.getSeconds();return`${n}-${l.toString().padStart(2,"0")}-${a.toString().padStart(2,"0")}T${r.toString().padStart(2,"0")}:${u.toString().padStart(2,"0")}:${s.toString().padStart(2,"0")}`},de=e=>{const{value:n,onBlur:l,onChange:a,after:r,disabled:u}=e,s=t.Value.map(n,o=>o!=null?pe(o):null),c=B(n,u,a);return y.InputContainer({...e,input:t.input["datetime-local"](y.CommonInputAttributes(e),t.attr.value(t.Value.map(s,o=>o??null)),t.attr.class("bc-input"),l!=null?t.on.blur(t.emitValue(l)):t.Empty,a!=null?t.on.change(t.emitValueAsNullableDateTime(a)):t.Empty),after:r!=null?t.Fragment(c,r):c})},S=e=>typeof e=="string"&&e.trim()===""?null:e,L=e=>e??"",me=e=>{const{value:n,onBlur:l,onChange:a,onInput:r,after:u,disabled:s,...c}=e,o=B(n,s,a);return y.TextInput({...c,value:t.Value.map(n,L),onChange:a!=null?i=>a(S(i)):void 0,onInput:r!=null?i=>r(S(i)):void 0,onBlur:l,after:u!=null?t.Fragment(o,u):o})},fe=e=>{const{value:n,onBlur:l,onChange:a,onInput:r,after:u,disabled:s,...c}=e,o=B(n,s,a);return A.EmailInput({...c,value:t.Value.map(n,L),onChange:a!=null?i=>a(S(i)):void 0,onInput:r!=null?i=>r(S(i)):void 0,onBlur:l,after:u!=null?t.Fragment(o,u):o})},he=e=>{const{value:n,onBlur:l,onChange:a,onInput:r,after:u,disabled:s,...c}=e,o=B(n,s,a);return A.PasswordInput({...c,value:t.Value.map(n,L),onChange:a!=null?i=>a(S(i)):void 0,onInput:r!=null?i=>r(S(i)):void 0,onBlur:l,after:u!=null?t.Fragment(o,u):o})},wt=e=>{const{value:n,onBlur:l,onChange:a,onInput:r,rows:u}=e;return y.InputContainer({...e,input:t.html.textarea(y.CommonInputAttributes(e),t.attr.rows(u??3),t.attr.value(n),t.attr.class("bc-input"),l!=null?t.on.blur(t.emitValue(l)):t.Empty,a!=null?t.on.change(t.emitValue(a)):t.Empty,r!=null?t.on.input(t.emitValue(r)):t.Empty)})},ge=e=>{const{value:n,onBlur:l,onChange:a,onInput:r,after:u,disabled:s,...c}=e,o=B(n,s,a);return wt({...c,value:t.Value.map(n,L),onChange:a!=null?i=>a(S(i)):void 0,onInput:r!=null?i=>r(S(i)):void 0,onBlur:l,after:u!=null?t.Fragment(o,u):o})},be=e=>{const{value:n,step:l,min:a,max:r,onBlur:u,onChange:s,onInput:c,after:o}=e,i=b=>{const p=a!=null?t.Value.get(a):void 0,v=r!=null?t.Value.get(r):void 0;return p!=null&&b<p?p:v!=null&&b>v?v:b},m=l!=null?t.Use(y.BeatUII18n,b=>{const p=t.computedOf(n,a)((h,g)=>g==null?!0:(h??0)>g),v=t.computedOf(n,r)((h,g)=>g==null?!0:(h??0)<g),f=h=>{const g=t.Value.get(n)??0,k=t.Value.get(l),C=h?.shiftKey?10:1,I=g-k*C,x=a!=null?t.Value.get(a):void 0;if(x!=null&&I<x)return;const w=i(I);w!==g&&s&&s(w)},V=h=>{const g=t.Value.get(n)??0,k=t.Value.get(l),C=h?.shiftKey?10:1,I=g+k*C,x=r!=null?t.Value.get(r):void 0;if(x!=null&&I>x)return;const w=i(I);w!==g&&s&&s(w)};return A.Stack(t.attr.class("bc-number-input-steppers"),t.html.button(t.attr.type("button"),t.attr.class("bc-button bc-number-input-steppers-button bc-number-input-steppers-button--increment"),t.attr.disabled(t.computedOf(v,e.disabled??!1)((h,g)=>!h||g)),t.on.click(h=>V(h)),t.aria.label(b.$.incrementValue),y.Icon({icon:"line-md:plus",size:"xs"})),t.html.button(t.attr.type("button"),t.attr.class("bc-button bc-number-input-steppers-button bc-number-input-steppers-button--decrement"),t.attr.disabled(t.computedOf(p,e.disabled??!1)((h,g)=>!h||g)),t.on.click(h=>f(h)),t.aria.label(b.$.decrementValue),y.Icon({icon:"line-md:minus",size:"xs"})))}):null,d=o!=null&&m!=null?t.Fragment(m,o):o??m;return y.InputContainer({...e,input:t.input.number(a!=null?t.Fragment(t.attr.min(a),t.OnDispose(t.Value.on(a,b=>{b<t.Value.get(n)}))):t.Empty,r!=null?t.Fragment(t.attr.max(r),t.OnDispose(t.Value.on(r,b=>{b>t.Value.get(n)}))):t.Empty,y.CommonInputAttributes(e),t.attr.valueAsNumber(n),t.attr.step(l),t.attr.class("bc-input bc-number-input"),u!=null?t.on.blur(t.emitValue(u)):t.Empty,s!=null?t.on.change(t.emitValueAsNumber(s)):t.Empty,c!=null?t.on.input(t.emitValueAsNumber(c)):t.Empty,l!=null?t.on.wheel(b=>{b.preventDefault();const p=t.Value.get(n)??0,v=t.Value.get(l),f=b.shiftKey?10:1,V=b.deltaY<0?v*f:-v*f,h=i(p+V);h!==p&&s&&s(h)}):t.Empty),after:d})},it=e=>{if(e==null||e==="")return null;const n=Number(e);return Number.isNaN(n)?null:n},ve=e=>{const{value:n,step:l,min:a,max:r,onBlur:u,onChange:s,onInput:c,after:o}=e,i=p=>{const v=a!=null?t.Value.get(a):void 0,f=r!=null?t.Value.get(r):void 0;return v!=null&&p<v?v:f!=null&&p>f?f:p},m=(()=>{if(l==null)return null;const p=t.computedOf(n,a)((g,k)=>{const C=g??0;return k==null?!0:C>k}),v=t.computedOf(n,r)((g,k)=>{const C=g??0;return k==null?!0:C<k}),f=g=>{const k=t.Value.get(n)??0,C=t.Value.get(l),I=g?.shiftKey?10:1,x=k-C*I,w=a!=null?t.Value.get(a):void 0;if(w!=null&&x<w)return;const _=i(x);_!==k&&s&&s(_)},V=g=>{const k=t.Value.get(n)??0,C=t.Value.get(l),I=g?.shiftKey?10:1,x=k+C*I,w=r!=null?t.Value.get(r):void 0;if(w!=null&&x>w)return;const _=i(x);_!==k&&s&&s(_)};return((g,k)=>A.Stack(t.attr.class("bc-number-input-steppers"),t.html.button(t.attr.type("button"),t.attr.class("bc-button bc-number-input-steppers-button bc-number-input-steppers-button--increment"),t.attr.disabled(t.computedOf(v,e.disabled??!1)((C,I)=>!C||I)),t.on.click(C=>V(C)),t.aria.label(g),y.Icon({icon:"line-md:plus",size:"xs"})),t.html.button(t.attr.type("button"),t.attr.class("bc-button bc-number-input-steppers-button bc-number-input-steppers-button--decrement"),t.attr.disabled(t.computedOf(p,e.disabled??!1)((C,I)=>!C||I)),t.on.click(C=>f(C)),t.aria.label(k),y.Icon({icon:"line-md:minus",size:"xs"}))))(y.defaultMessages.incrementValue,y.defaultMessages.decrementValue)})(),d=B(n,e.disabled,s),b=o!=null&&m!=null?t.Fragment(m,d,o):o!=null?t.Fragment(d,o):m!=null?t.Fragment(m,d):d;return y.InputContainer({...e,input:t.input.number(a!=null?t.Fragment(t.attr.min(a),t.OnDispose(t.Value.on(a,p=>{}))):t.Empty,r!=null?t.Fragment(t.attr.max(r),t.OnDispose(t.Value.on(r,p=>{}))):t.Empty,y.CommonInputAttributes(e),t.attr.value(t.Value.map(n,p=>p==null?"":String(p))),t.attr.step(l),t.attr.class("bc-input bc-number-input"),u!=null?t.on.blur(t.emitValue(u)):t.Empty,s!=null?t.on.change(t.emitValue(p=>{const v=it(p);s(v)})):t.Empty,c!=null?t.on.input(t.emitValue(p=>{const v=it(p);c(v)})):t.Empty,l!=null?t.on.wheel(p=>{p.preventDefault();const v=t.Value.get(n)??0,f=t.Value.get(l),V=p.shiftKey?10:1,h=p.deltaY<0?f*V:-f*V,g=i(v+h);g!==v&&s&&s(g)}):t.Empty),after:b})},xe=({value:e,onChange:n,onInput:l,onBlur:a,offLabel:r,onLabel:u,disabled:s=!1,size:c="md",id:o,color:i="primary"})=>{const m=o??A.sessionId("switch");function d(f,V){const h=["bc-switch",`bc-switch--size-${V}`,`bc-switch--${V}`];return f&&h.push("bc-switch--disabled"),h.join(" ")}function b(f){const V=f??"primary",h=new Map,g=y.backgroundValue(V,"solid","light"),k=y.backgroundValue(V,"solid","dark");return h.set("--switch-track-on-bg",g.backgroundColor),h.set("--switch-track-on-label",g.textColor),h.set("--switch-track-on-bg-dark",k.backgroundColor),h.set("--switch-track-on-label-dark",k.textColor),h.set("--switch-track-on-border-dark",y.borderColorValue(V,"dark")),Array.from(h.entries()).map(([C,I])=>`${C}: ${I}`).join("; ")}const p=()=>{t.Value.get(s)||(n?.(!t.Value.get(e)),l?.(!t.Value.get(e)))},v=f=>{t.Value.get(s)||(f.key===" "||f.key==="Enter")&&(f.preventDefault(),p())};return t.html.div(t.attr.class(t.computedOf(s??!1,c)((f,V)=>d(f??!1,V??"md"))),t.attr.style(t.computedOf(i)(f=>b(f))),t.attr.id(m),t.attr.role("switch"),t.attr.tabindex(t.Value.map(s,f=>f?-1:0)),t.aria.checked(e),t.aria.disabled(s),t.on.click(p),t.on.keydown(v),a!=null?t.on.blur(a):null,t.html.div(t.attr.class("bc-switch__track"),t.attr.class(t.Value.map(e,f=>f?"bc-switch__track--on":"bc-switch__track--off")),r!=null?t.html.div(t.aria.hidden(!0),t.attr.class("bc-switch__track-label bc-switch__track-label--off"),t.attr.class(t.Value.map(e,f=>f?"bc-switch__track-label--hidden":"bc-switch__track-label--visible")),r):null,u!=null?t.html.div(t.attr.class("bc-switch__track-label bc-switch__track-label--on"),t.attr.class(t.Value.map(e,f=>f?"bc-switch__track-label--visible":"bc-switch__track-label--hidden")),u):null,nt.ElementRect(f=>t.Use(y.Locale,({direction:V})=>t.html.div(t.attr.class("bc-switch__thumb"),t.attr.class(t.Value.map(e,h=>h?"bc-switch__thumb--on":"bc-switch__thumb--off")),t.style.transform(t.computedOf(e,f,c,V)((h,{width:g},k,C)=>{const I=(()=>{switch(k){case"xs":return 5;case"sm":return 5.5;case"md":return 6;case"lg":return 7;case"xl":return 8}})(),x=C==="rtl"?`calc((var(--spacing-base) * ${I}) - ${g}px)`:`calc(${g}px - (var(--spacing-base) * ${I}))`;return h?`translateX(${x})`:"translateX(0)"})))))))},Ct=e=>{const n={type:"pattern",pattern:/[0-9A-Fa-f]/,transform:a=>a.toLowerCase()};return rt({...e,mask:[n,n,n,n,n,n,n,n,"-",n,n,n,n,"-",n,n,n,n,"-",n,n,n,n,"-",n,n,n,n,n,n,n,n,n,n,n,n],placeholder:e.placeholder??"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"})},Ie=e=>{const{value:n,onBlur:l,onChange:a,onInput:r,after:u,disabled:s,...c}=e,o=B(n,s,a);return Ct({...c,value:t.Value.map(n,L),onChange:a!=null?i=>a(S(i)):void 0,onInput:r!=null?i=>r(S(i)):void 0,onBlur:l,after:u!=null?t.Fragment(o,u):o})},Ve="line-md:star-alt-filled",ye="line-md:star-alt",_t=e=>{const{value:n,onChange:l,disabled:a,max:r=5,fullColor:u="yellow",emptyColor:s="neutral",fullIcon:c=Ve,emptyIcon:o=ye,size:i="md",onBlur:m,rounding:d=1}=e,b=()=>{const g=t.Value.get(d);return g>0?g:1},p=g=>Math.min(Math.max(g,0),t.Value.get(r)),v=(g,k)=>{if(t.Value.get(a??!1))return;const I=g.currentTarget.getBoundingClientRect(),x=(g.clientX-I.left)/I.width,w=k-1+x,_=b(),M=Math.ceil(w/_)*_,E=p(M);l?.(E)},f=g=>{if(t.Value.get(a??!1))return;const k=b(),C=t.Value.get(n)??0;let I;switch(g.key){case"ArrowRight":case"ArrowUp":I=p(C+k);break;case"ArrowLeft":case"ArrowDown":I=p(C-k);break;case"Home":I=0;break;case"End":I=t.Value.get(r);break;default:return}g.preventDefault(),l?.(I)},V=t.Value.map(i,g=>`bc-icon--${g}`),h=({index:g,counter:k})=>t.html.span(t.attr.class("bc-rating-input__icon-container"),t.attr.class(V),y.Icon({icon:o,size:i,color:s,tone:"soft"},t.attr.class("bc-rating-input__icon-empty")),t.html.span(t.attr.class("bc-rating-input__icon-clipper"),t.attr.class(V),t.style.width(t.Value.map(n,C=>{const I=Math.floor(C);return I>g?"100%":I<g?"0%":`${(C-g)*100}%`})),y.Icon({icon:c,size:i,color:u,tone:"soft"},t.attr.class("bc-rating-input__icon-full"))),t.on.click(t.emit(C=>v(C,k),{preventDefault:!0,stopPropagation:!0})));return y.InputContainer({baseContainer:!0,growInput:!1,focusableSelector:'[role="slider"]',...e,input:t.html.div(y.CommonInputAttributes(e),t.attr.class("bc-rating-input"),t.attr.role("slider"),t.attr.tabindex(t.Value.map(a??!1,g=>g?-1:0)),t.aria.disabled(a??!1),t.aria.valuemin(0),t.aria.valuemax(t.Value.map(r,g=>g??0)),t.aria.valuenow(t.Value.map(n,g=>g??0)),t.aria.valuetext(t.computedOf(n,r)((g,k)=>{const C=g??0,I=k??0;return`${String(C)} / ${String(I)}`})),t.on.keydown(f),m!=null?t.on.blur(m):null,t.Repeat(r,h))})},we=e=>{const{value:n,onChange:l,onBlur:a,after:r,disabled:u,...s}=e,c=B(n,u,l);return _t({...s,value:t.Value.map(n,o=>o??0),onChange:l,onBlur:a,after:r!=null?t.Fragment(c,r):c})},Ce=e=>{const{value:n,step:l,min:a,max:r,onBlur:u,onChange:s,onInput:c}=e;return y.InputContainer({...e,focusableSelector:'input[type="range"]',input:t.html.input(t.attr.type("range"),y.CommonInputAttributes(e),t.attr.min(a),t.attr.max(r),t.attr.step(l),t.attr.valueAsNumber(n),t.attr.class("bc-input bc-slider-input"),u!=null?t.on.blur(t.emitValueAsNumber(u)):t.Empty,s!=null?t.on.change(t.emitValueAsNumber(s)):t.Empty,c!=null?t.on.input(t.emitValueAsNumber(c)):t.Empty)})},_e=e=>{const{value:n,step:l,min:a,max:r,onBlur:u,onChange:s,onInput:c}=e,o=t.Value.map(n,m=>{if(m!=null)return m;const d=a!=null?t.Value.get(a):void 0;return typeof d=="number"?d:0}),i=B(n,e.disabled,m=>{s?.(m)});return y.InputContainer({...e,focusableSelector:'input[type="range"]',after:i,input:t.html.input(t.attr.type("range"),y.CommonInputAttributes(e),t.attr.min(a),t.attr.max(r),t.attr.step(l),t.attr.valueAsNumber(o),t.attr.class("bc-input bc-slider-input"),u!=null?t.on.blur(t.emitValueAsNumber(u)):t.Empty,s!=null?t.on.change(t.emitValueAsNumber(m=>{s(m)})):t.Empty,c!=null?t.on.input(t.emitValueAsNumber(m=>{c(m)})):t.Empty)},t.Fragment())};let Q=null;async function q(){const e=globalThis;return e.Temporal?e.Temporal:(Q||(Q=Promise.resolve().then(()=>require("./index.esm-DJRz9AE-.cjs")).then(n=>{const l=n.Temporal;return e.Temporal||(e.Temporal=l),l})),Q)}const kt=(e,n)=>n?t.Task(q,{then:e,pending:n.pending,error:n.error}):t.Task(q,e),ke=/^P(\d+([YMWD]|$)){0,4}(T(\d+([HMS]|$)){0,3})?$/i,$e=/^P(?:(\d+Y)?(\d+M)?(\d+W)?(\d+D)?)(T(\d+H)?(\d+M)?(\d+S)?)?$/i;function $t(e){return{mask:null,allowMode:"custom",allow:n=>/[0-9ptwdhms]/i.test(n),pipe:n=>{const l=n.toUpperCase();return l.length===0?l:!l.startsWith("P")||!ke.test(l)?!1:l},completion:{mode:"custom",isComplete:n=>{const l=n.toUpperCase();if(!$e.test(l))return!1;try{return e(l),!0}catch{return!1}}}}}const pt=(e,n)=>{if(e==null)return null;try{return e.Duration.from(n)}catch{return null}},Me=e=>{const{value:n,onChange:l,after:a,disabled:r,onBlur:u}=e,s=()=>{const i=B(n,r,l);return a!=null?t.Fragment(i,a):i},c=e.placeholder!=null?t.Empty:t.attr.placeholder("P0DT0H0M0S");return kt(i=>rt({...e,value:t.Value.map(n,m=>m?.toString()??""),onChange:l?m=>l(m===""?null:i.Duration.from(m)):void 0,onInput:void 0,...$t(i.Duration.from),placeholder:"P0DT0H0M0S",after:s()}),{pending:()=>y.InputContainer({...e,input:t.input.text(y.CommonInputAttributes(e),t.attr.value(t.Value.map(n,i=>i?.toString()??"")),t.attr.class("bc-input"),c,u!=null?t.on.blur(()=>u()):t.Empty,l!=null?t.on.change(i=>{const d=i.currentTarget?.value??"";if(d===""){l(null);return}const b=globalThis.Temporal,p=pt(b,d);if(p!=null){l(p);return}q().then(v=>{const f=pt(v,d);f!=null&&l(f)}).catch(()=>{})}):t.Empty),after:s()})})},Mt=e=>{const{value:n,onBlur:l,onChange:a,onInput:r}=e;return y.InputContainer({...e,input:t.input.url(y.CommonInputAttributes(e),t.attr.value(n),t.attr.class("bc-input"),l!=null?t.on.blur(t.emitValue(l)):t.Empty,a!=null?t.on.change(t.emitValue(a)):t.Empty,r!=null?t.on.input(t.emitValue(r)):t.Empty)})},Ee=e=>{const{value:n,onBlur:l,onChange:a,onInput:r,after:u,disabled:s,...c}=e,o=B(n,s,a);return Mt({...c,value:t.Value.map(n,L),onChange:a!=null?i=>a(S(i)):void 0,onInput:r!=null?i=>r(S(i)):void 0,onBlur:l,after:u!=null?t.Fragment(o,u):o})},Et=e=>{const{controller:n,element:l,separator:a,showMove:r=!0,showRemove:u=!0,showAdd:s=!0,createItem:c,addLabel:o,controlsLayout:i="aside",removeDisabled:m,addDisabled:d}=e,b=t.Value.toSignal(i).map(f=>f==="aside"),p=f=>{const V=t.When(r??!1,()=>t.html.div(t.attr.class("bc-group--align-center"),t.attr.class(b.map(g=>g?"bc-group--direction-column bc-group--gap-1":"bc-group--direction-row bc-group--gap-1")),y.Button({size:"xs",roundedness:"full",variant:"text",onClick:()=>f.move("up"),disabled:f.cannotMove("up")},t.Use(y.BeatUII18n,g=>y.Icon({size:"xs",icon:"line-md:arrow-up",title:g.$.incrementValue}))),y.Button({size:"xs",roundedness:"full",variant:"text",onClick:()=>f.move("down"),disabled:f.cannotMove("down")},t.Use(y.BeatUII18n,g=>y.Icon({size:"xs",icon:"line-md:arrow-down",title:g.$.decrementValue}))))),h=t.When(u,()=>t.Use(y.BeatUII18n,g=>A.CloseButton({size:"xs",label:t.Value.map(g.$.removeItem,k=>k.toLowerCase()),color:"danger",disabled:m,onClick:f.remove})));return g=>t.When(b,()=>H(t.attr.class("bc-group--gap-1 bc-group--align-center"),A.Stack(t.attr.class("bc-stack--grow"),g),A.Stack(t.attr.class("bc-stack--align-center"),t.When(n.signal.map(k=>k.length>1),()=>V),h)),()=>A.Stack(t.attr.class("bc-stack--gap-2"),g,H(t.attr.class("bc-group--gap-2 bc-group--justify-between"),t.When(n.signal.map(k=>k.length>1),()=>V,()=>t.html.div()),h)))},v=t.When(t.computedOf(s,c)((f,V)=>f&&V!=null),()=>H(t.attr.class("bc-group--gap-2 bc-group--align-center bc-group--justify-center"),y.Button({size:"sm",variant:"filled",onClick:()=>n.push(c()),disabled:t.computedOf(n.disabled,d??!1)((f,V)=>f||V)},t.Use(y.BeatUII18n,f=>H(t.attr.class("bc-group--gap-2"),y.Icon({icon:"line-md:plus"}),o??f.$.addLabel)))));return t.Fragment(Vt(n,f=>p(f)(l(f)),a),v)},Fe=(e,...n)=>{const{controller:l,element:a,separator:r,showMove:u,showRemove:s,showAdd:c,createItem:o,addLabel:i,controlsLayout:m,removeDisabled:d,addDisabled:b,...p}=e;return A.InputWrapper({...p,content:Et({controller:l,element:a,separator:r,showMove:u,showRemove:s,showAdd:c,createItem:o,addLabel:i,controlsLayout:m,removeDisabled:d,addDisabled:b})},...n)};class Ae extends A.Controller{branches;activeBranch;#e;#t=new Map;constructor(n,l,a,r,u,s,c=A.O){super(n,l,a,r,u,c),this.branches=s;const o=m=>{for(const d of s)if(d.detect(m))return d.key;return s[0]?.key??"unknown"};this.activeBranch=a.map(o,A.O);const i=m=>{if(this.#t.has(m))return this.#t.get(m);const d=s.find(p=>p.key===m);if(!d)throw new Error(`Unknown branch: ${m}`);const b=new A.Controller([...n,m],p=>{this.change(p)},this.signal.map(p=>d.detect(p)?p:d.defaultValue(),c),r.map(A.makeMapValidation([m])),{disabled:this.disabled,validationMode:this.parent.validationMode},c);return this.#t.set(m,b),b};this.#e=this.activeBranch.map(m=>i(m),A.O),this.onDispose(()=>{for(const m of this.#t.values())m.dispose();this.#t.clear(),this.activeBranch.dispose(),this.#e.dispose()})}get activeController(){return t.Value.get(this.#e)}getBranchController(n){const l=this.branches.find(r=>r.key===n);if(!l)throw new Error(`Unknown branch: ${n}`);if(this.#t.has(n))return this.#t.get(n);const a=new A.Controller([...this.path,n],r=>{this.change(r)},this.signal.map(r=>l.detect(r)?r:l.defaultValue(),A.O),this.status.map(A.makeMapValidation([n])),{disabled:this.disabled,validationMode:this.parent.validationMode},A.O);return this.#t.set(n,a),a}switchToBranch(n,l=!1){const a=this.branches.find(s=>s.key===n);if(!a)throw new Error(`Unknown branch: ${n}`);const r=t.Value.get(this.signal);if(a.detect(r))return!0;if(a.convert){const s=a.convert(r);if(s.ok)return this.change(s.value),!0}if(l&&typeof window=="object"&&typeof window.confirm=="function"&&!window.confirm("Changing type will clear the current value. Continue?"))return!1;const u=a.defaultValue();return this.change(u),!0}get activeBranchDefinition(){const n=t.Value.get(this.activeBranch);return this.branches.find(l=>l.key===n)}}function De(e){return e.transform(n=>n??null,n=>n??void 0)}function Te(e){return e.transform(n=>n??"",n=>n===""?void 0:n)}function Se(e){return e.transform(n=>n??void 0,n=>n??null)}exports.Base64Input=Zt;exports.Base64sInput=ft;exports.BaseListControl=Et;exports.BaseNativeSelectControl=It;exports.Card=re;exports.ColorInput=ee;exports.EditableText=le;exports.Expando=gt;exports.FilesInput=dt;exports.Group=H;exports.ListControl=Fe;exports.ListInput=Vt;exports.MaskInput=rt;exports.NativeSelect=xt;exports.NativeSelectControl=se;exports.NullableDateInput=ie;exports.NullableDateTimeInput=de;exports.NullableDurationInput=Me;exports.NullableEmailInput=fe;exports.NullableNumberInput=ve;exports.NullablePasswordInput=he;exports.NullableRatingInput=we;exports.NullableResetAfter=B;exports.NullableSliderInput=_e;exports.NullableTextArea=ge;exports.NullableTextInput=me;exports.NullableUUIDInput=Ie;exports.NullableUrlInput=Ee;exports.NumberInput=be;exports.RatingInput=_t;exports.SegmentedInput=Rt;exports.SliderInput=Ce;exports.Switch=xe;exports.TextArea=wt;exports.UUIDInput=Ct;exports.UnionController=Ae;exports.UnstyledDropZone=J;exports.UrlInput=Mt;exports.WithTemporal=kt;exports._t=Ot;exports.durationMaskConfig=$t;exports.emitExpando=ne;exports.emitOptionExpando=bt;exports.emptyToNull=S;exports.ensureTemporal=q;exports.fileToBase64=mt;exports.gt=St;exports.nullToEmpty=L;exports.transformEmptyStringToUndefined=Te;exports.transformNullToUndefined=De;exports.transformUndefinedToNull=Se;
|
|
1
|
+
"use strict";const t=require("@tempots/dom"),At=require("./colors-Qc1mmmfr.cjs"),Dt=require("./timer-DK_yKNwE.cjs"),nt=require("@tempots/ui"),y=require("./translations-DQxg-W9w.cjs"),A=require("./notice-DCuZEAQO.cjs");class Tt extends Error{constructor(n="Missing implementation"){super(n),this.name="MissingImplementationError"}}const St=e=>Bt(e).split("_").join(" "),Bt=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()),Ot=e=>e.substring(0,1).toUpperCase()+e.substring(1),Ut=e=>{if(typeof Buffer<"u")return Buffer.from(e,"base64").toString("utf8");if(typeof atob<"u")return atob(e);throw new Tt("No implementation found for base64 decoding")};function J({onChange:e,value:n,accept:l="*/*",enableClick:a=!0,content:r,disabled:u=!1,allowMultiple:s}){return t.Use(y.BeatUII18n,c=>{const o=t.Value.deriveProp(n??[]),i=t.prop(!1),m=h=>{h.preventDefault(),h.stopPropagation(),i.value=!0},d=h=>{h.preventDefault(),h.stopPropagation(),(!h.currentTarget||!h.currentTarget.contains(h.relatedTarget))&&(i.value=!1)},b=h=>{h.preventDefault(),h.stopPropagation(),i.value=!1;const g=Array.from(h.dataTransfer?.files||[]);g.length>0&&(o.value=g,e(g))},p=h=>{t.Value.get(a)&&h.currentTarget.querySelector('input[type="file"]')?.click()};let v=null;const f=()=>{if(v==null)return;const h=Array.from(v.files??[]);h.length>0&&(o.value=h,e(h)),v.value=""},V=h=>{t.Value.get(a)&&(h.key==="Enter"||h.key===" ")&&(h.preventDefault(),p(h))};return t.html.div(t.attr.role("button"),t.attr.tabindex(t.Value.map(a,h=>h?0:-1)),t.attr.style("position: relative;"),t.on.dragover(m),t.on.dragleave(d),t.on.drop(b),t.on.click(p),t.on.keydown(V),t.html.input(t.attr.type("file"),t.attr.disabled(u),t.attr.accept(l),t.attr.multiple(s),t.attr.style("position: absolute; left: -9999px; opacity: 0; pointer-events: none;"),t.on.change(f),t.WithElement(h=>(v=h,t.OnDispose(o.on(g=>{const k=globalThis.DataTransfer;if(k!=null){const C=new k;g.forEach(I=>C.items.add(I)),h.files=C.files}}))))),t.aria.label(t.bind(c.$.dropZoneInstructions)(a)),r({files:o,clear:()=>o.value=[],change:o.set}))})}function Nt(e,n){return e.length===n.length&&e.every((l,a)=>l===n[a])}function Lt(e,n){const l=["bc-segmented-control",`bc-segmented-control--size-${e}`];return n&&l.push("bc-segmented-control--disabled"),l.join(" ")}function Rt({options:e,value:n,onChange:l,size:a="md",disabled:r=!1},...u){const s=At.f(e).map(([c,o])=>({key:c,label:o}));return t.WithElement(()=>{const c=Object.fromEntries(s.map((i,m)=>[i.key,m])),o=t.prop(s.map(()=>({left:0,width:0})),Nt);return t.html.div(t.attr.class(t.computedOf(a,r)((i,m)=>Lt(i??"md",m??!1))),t.html.div(t.attr.class("bc-segmented-control__container"),t.html.div(t.attr.class("bc-segmented-control__indicator"),t.style.width(t.computedOf(n,o)((i,m)=>{const{width:d}=m[c[i]??0];return`${d}px`})),t.style.left(t.computedOf(n,o)((i,m)=>{const{left:d}=m[c[i]??0];return`${d}px`}))),s.map(({label:i,key:m},d)=>t.html.button(t.attr.type("button"),t.on.click(b=>{b.preventDefault(),t.Value.get(r)||l?.(m)}),t.attr.disabled(r),t.attr.class("bc-segmented-control__segment"),t.attr.class(t.Value.map(n,b=>b===m?"bc-segmented-control__segment--active":"bc-segmented-control__segment--inactive")),nt.ElementRect(b=>{function p(){o.update(f=>{const V=[...f];return V[d]={width:b.value.width,left:b.value.localLeft},V})}const v=Dt.g(p);return t.OnDispose(v,b.on(p))}),i))),...u)})}function zt(e){const n=e.type.toLowerCase();return n.startsWith("image/")&&(n.includes("jpeg")||n.includes("jpg")||n.includes("png")||n.includes("gif")||n.includes("webp")||n.includes("svg"))}function Wt(e){const n=e.type.toLowerCase();return n.startsWith("image/")?"vscode-icons:file-type-image":n.startsWith("video/")?"vscode-icons:file-type-video":n.startsWith("audio/")?"vscode-icons:file-type-audio":n.includes("pdf")?"vscode-icons:file-type-pdf2":n.includes("word")||n.includes("document")?"vscode-icons:file-type-word":n.includes("excel")||n.includes("spreadsheet")?"vscode-icons:file-type-excel":n.includes("powerpoint")||n.includes("presentation")?"vscode-icons:file-type-powerpoint":n.includes("zip")||n.includes("archive")?"vscode-icons:file-type-zip":n.includes("text")?"vscode-icons:file-type-text":n.includes("json")?"vscode-icons:file-type-json-official":n.includes("csv")?"vscode-icons:file-type-csv":n.includes("xml")?"vscode-icons:file-type-xml":n.includes("yaml")?"vscode-icons:file-type-yaml-official":"vscode-icons:file-type-binary"}function ot(e){return t.When(e.map(zt),()=>{const n=t.prop(null);return e.on(l=>{n.value&&URL.revokeObjectURL(n.value);const a=URL.createObjectURL(l);n.value=a}),t.html.div(t.attr.class("bc-file-input__thumbnail-container"),t.html.img(t.attr.src(n),t.attr.alt(e.map(l=>l.name)),t.attr.class("bc-file-input__thumbnail"),t.OnDispose(()=>{n.value&&URL.revokeObjectURL(n.value)})))},()=>y.Icon({icon:e.map(Wt)}))}const dt=(e,...n)=>{const{value:l=t.prop([]),accept:a="*/*",maxFiles:r,maxFileSize:u,onChange:s,onBlur:c,disabled:o,hasError:i,mode:m="default",showFileList:d=!0,...b}=e,p=l,v=t.Value.map(m,C=>C==="compact"),f=C=>{let I=C;if(r!=null){const x=t.Value.get(r);I=I.slice(0,x)}if(u){const x=t.Value.get(u);I=I.filter(w=>w.size<=x)}s?.(I)},V=C=>{const x=p.value.filter((w,_)=>_!==C);s?.(x)},h=()=>{s?.([])},g=({files:C,clear:I,change:x})=>t.Use(y.BeatUII18n,w=>t.html.div(t.attr.class("bc-file-input__drop-zone"),t.html.div(t.attr.class("bc-file-input__drop-zone-content bc-file-input__drop-zone-content--empty"),y.Icon({icon:"mdi:cloud-upload-outline",size:"xl"}),t.html.div(t.attr.class("bc-file-input__drop-zone-text"),t.bind(w.$.filesInputInstructions)(r,u,w.$.fileSizeUnits.value))))),k=({files:C})=>t.Use(y.BeatUII18n,I=>t.html.div(t.attr.class("bc-file-input__compact-input"),t.When(C.map(x=>x.length>0),()=>t.html.span(t.attr.class("bc-file-input__compact-value"),t.ForEach(C,x=>t.html.span(t.attr.class("bc-file-input__compact-value-item"),ot(x),t.html.span(t.attr.class("bc-file-input__compact-value-item-name"),x.$.name)))),()=>t.html.span(t.attr.class("bc-file-input__compact-placeholder"),y.Icon({icon:"mdi:cloud-upload-outline",size:"sm"})," ",t.bind(I.$.filesInputInstructions)(r,u,I.$.fileSizeUnits.value)))));return t.Use(y.BeatUII18n,C=>y.InputContainer({baseContainer:t.Value.map(v,I=>!I),disabled:o,hasError:i,after:t.When(v,()=>t.When(p.map(({length:I})=>I>0),()=>A.CloseButton({size:"sm",label:C.$.clearAllFiles,disabled:o,onClick:h},t.attr.class("bc-file-input__compact-clear")))),...b,input:t.When(v,()=>t.html.div(t.attr.class("bc-file-input bc-file-input--compact"),J({value:p,accept:a,enableClick:!0,allowMultiple:t.Value.map(r??1/0,I=>I>1),disabled:o,onChange:f,content:k})),()=>t.html.div(t.attr.class("bc-file-input"),J({value:p,accept:a,enableClick:!0,allowMultiple:t.Value.map(r??1/0,I=>I>1),disabled:o,onChange:f,content:g}),t.When(d,()=>t.NotEmpty(p,()=>t.Fragment(t.html.div(t.attr.class("bc-file-input__file-list"),t.ForEach(p,(I,x)=>{const w=x.index;return t.html.div(t.attr.class("bc-file-input__file-item"),t.html.div(t.attr.class("bc-file-input__file-icon"),ot(I)),t.html.div(t.attr.class("bc-file-input__file-info"),t.html.div(t.attr.class("bc-file-input__file-name"),t.attr.title(I.$.name),I.$.name),t.html.div(t.attr.class("bc-file-input__file-meta"),t.computedOf(I.$.size,C.$.fileSizeUnits)((_,M)=>y.formatFileSize(_,{units:M}))," • ",t.computedOf(I.$.type,C.$.unknownType)((_,M)=>_||M))),A.CloseButton({size:"sm",label:C.$.removeFile,disabled:o,onClick:()=>V(w)},t.attr.class("bc-file-input__remove-button")))})),t.When(p.map(({length:I})=>I>1),()=>t.html.div(t.attr.class("bc-file-input__clear-all-button-container"),t.html.button(t.attr.type("button"),t.attr.class("bc-file-input__clear-all-button"),t.attr.disabled(o),C.$.clearAllFiles,t.on.click(I=>{I.preventDefault(),I.stopPropagation(),h()})))))))))},...n))};async function mt(e){return new Promise((n,l)=>{const a=new FileReader;a.readAsDataURL(e),a.onload=()=>{const r=a.result;n(r.split(",")[1])},a.onerror=r=>l(r)})}function Pt(e){return Promise.all(e.map(mt))}function jt(e){if(e.length>=4){if(e[0]===137&&e[1]===80&&e[2]===78&&e[3]===71)return"image/png";if(e[0]===255&&e[1]===216)return"image/jpeg";if(e[0]===71&&e[1]===73&&e[2]===70)return"image/gif";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)return"image/webp"}try{if(new TextDecoder("utf-8").decode(e.slice(0,256)).includes("<svg"))return"image/svg+xml"}catch{}return"application/octet-stream"}function Ht(e){const n=Ut(e??""),l=n.length,a=new Uint8Array(l);for(let r=0;r<l;r++)a[r]=n.charCodeAt(r);return a}function ft(e){const{value:n,onChange:l,onInput:a,...r}=e,u=new Map,s=t.Value.toSignal(n).map(m=>m.map((d,b)=>{const p=u.get(d),v=Ht(d??""),f=p?.type||jt(v),V=p?.name??`file-${b}`,h=v.buffer.slice(v.byteOffset,v.byteOffset+v.byteLength),g=new Blob([h],{type:f});return new File([g],V,{type:f})})),c=m=>d=>{m&&Pt(d).then(b=>{for(const[p,v]of b.entries())u.set(v,{name:d[p].name,type:d[p].type});m(b)})},o=c(l),i=c(a);return dt({...r,value:s,onChange:o,onInput:i})}function Zt(e){const{value:n,onInput:l,onChange:a,...r}=e;return ft({...r,maxFiles:1,value:t.Value.map(n,u=>u==null?[]:[u]),onChange:u=>{a?.(u[0])},onInput:u=>{l?.(u[0])}})}function K(e){const n=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);return n?[parseInt(n[1],16),parseInt(n[2],16),parseInt(n[3],16)]:[0,0,0]}function tt(e,n,l){const a=r=>r.toString(16).padStart(2,"0");return`#${a(Math.max(0,Math.min(255,e)))}${a(Math.max(0,Math.min(255,n)))}${a(Math.max(0,Math.min(255,l)))}`}function qt(e){if(!e)return[0,0,0,1];const l=e.trim().match(/^#?([a-fA-F0-9]{3,4}|[a-fA-F0-9]{6}|[a-fA-F0-9]{8})$/);if(l){const d=l[1];if(d.length===8){const b=parseInt(d.slice(0,2),16),p=parseInt(d.slice(2,4),16),v=parseInt(d.slice(4,6),16),f=parseInt(d.slice(6,8),16)/255;return[b,p,v,f]}if(d.length===6)return[parseInt(d.slice(0,2),16),parseInt(d.slice(2,4),16),parseInt(d.slice(4,6),16),1];if(d.length===4){const b=parseInt(d[0]+d[0],16),p=parseInt(d[1]+d[1],16),v=parseInt(d[2]+d[2],16),f=parseInt(d[3]+d[3],16)/255;return[b,p,v,f]}if(d.length===3){const b=parseInt(d[0]+d[0],16),p=parseInt(d[1]+d[1],16),v=parseInt(d[2]+d[2],16);return[b,p,v,1]}}const a=e.match(/^rgba\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(0|1|0?\.\d+)\s*\)$/i);if(a)return[parseInt(a[1],10),parseInt(a[2],10),parseInt(a[3],10),parseFloat(a[4])];const r=e.match(/^rgb\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*\)$/i);if(r)return[parseInt(r[1],10),parseInt(r[2],10),parseInt(r[3],10),1];const u=e.match(/^hsla?\(\s*([+-]?[\d.]+)(?:deg)?\s*[ ,]?\s*([\d.]+)%\s*[ ,]?\s*([\d.]+)%\s*(?:[/,]\s*(\d?(?:\.\d+)?))?\s*\)$/i);if(u){const d=parseFloat(u[1]),b=parseFloat(u[2]),p=parseFloat(u[3]),v=u[4]!=null?parseFloat(u[4]):1,[f,V,h]=ht(d,b/100,p/100);return[f,V,h,v]}const s=e.match(/^hwb\(\s*([+-]?[\d.]+)(?:deg)?\s*[, ]\s*([\d.]+)%\s*[, ]\s*([\d.]+)%\s*(?:[/]\s*(\d?(?:\.\d+)?))?\s*\)$/i);if(s){const d=parseFloat(s[1]),b=parseFloat(s[2])/100,p=parseFloat(s[3])/100,v=s[4]!=null?parseFloat(s[4]):1,[f,V,h]=Gt(d,b,p);return[f,V,h,v]}const c=e.match(/^oklch\(\s*([+-]?[\d.]+%?)\s+([\d.]+)\s+([+-]?[\d.]+)(?:deg)?(?:\s*\/\s*(\d?(?:\.\d+)?))?\s*\)$/i);if(c){const d=c[1],b=parseFloat(c[2]),p=parseFloat(c[3]),v=c[4]!=null?parseFloat(c[4]):1,f=d.endsWith("%")?Math.max(0,Math.min(1,parseFloat(d)/100)):Math.max(0,Math.min(1,parseFloat(d))),[V,h,g]=Jt(f,b,p);return[V,h,g,v]}const[o,i,m]=K(e);return[o,i,m,1]}const Yt=(e,n,l,a)=>`rgba(${Math.round(e)}, ${Math.round(n)}, ${Math.round(l)}, ${Math.max(0,Math.min(1,Math.round(a*100)/100))})`;function Xt(e){let n=e+1831565813;return function(){return n=Math.imul(n^n>>>15,n|1),n^=n+Math.imul(n^n>>>7,n|61),((n^n>>>14)>>>0)/4294967296}}function ht(e,n,l){e=(e%360+360)%360;const a=(1-Math.abs(2*l-1))*n,r=a*(1-Math.abs(e/60%2-1)),u=l-a/2;let s=0,c=0,o=0;return 0<=e&&e<60?[s,c,o]=[a,r,0]:60<=e&&e<120?[s,c,o]=[r,a,0]:120<=e&&e<180?[s,c,o]=[0,a,r]:180<=e&&e<240?[s,c,o]=[0,r,a]:240<=e&&e<300?[s,c,o]=[r,0,a]:[s,c,o]=[a,0,r],[Math.round((s+u)*255),Math.round((c+u)*255),Math.round((o+u)*255)]}function Gt(e,n,l){e=(e%360+360)%360;const a=n+l;a>1&&(n/=a,l/=a);const[r,u,s]=ht(e,1,.5).map(d=>d/255),c=1-n-l,o=r*c+n,i=u*c+n,m=s*c+n;return[Math.round(o*255),Math.round(i*255),Math.round(m*255)]}function et(e,n,l){e/=255,n/=255,l/=255;const a=Math.max(e,n,l),r=Math.min(e,n,l);let u=0,s=0;const c=(a+r)/2,o=a-r;if(o!==0){switch(s=c>.5?o/(2-a-r):o/(a+r),a){case e:u=(n-l)/o+(n<l?6:0);break;case n:u=(l-e)/o+2;break;default:u=(e-n)/o+4}u*=60}return[Math.round(u),Math.round(s*100),Math.round(c*100)]}function Qt(e,n,l){const[a]=et(e,n,l),r=e/255,u=n/255,s=l/255,c=Math.min(r,u,s),o=1-Math.max(r,u,s);return[a,Math.round(c*100),Math.round(o*100)]}function X(e){const n=e/255;return n<=.04045?n/12.92:Math.pow((n+.055)/1.055,2.4)}function G(e){const n=e<=.0031308?12.92*e:1.055*Math.pow(e,.4166666666666667)-.055;return Math.round(Math.max(0,Math.min(1,n))*255)}function Jt(e,n,l){const a=l*Math.PI/180,r=Math.cos(a)*n,u=Math.sin(a)*n,s=e+.3963377774*r+.2158037573*u,c=e-.1055613458*r-.0638541728*u,o=e-.0894841775*r-1.291485548*u,i=s*s*s,m=c*c*c,d=o*o*o,b=4.0767416621*i-3.3077115913*m+.2309699292*d,p=-1.2684380046*i+2.6097574011*m-.3413193965*d,v=-.0041960863*i-.7034186147*m+1.707614701*d;return[G(b),G(p),G(v)]}function Kt(e,n,l){const a=X(e),r=X(n),u=X(l),s=.4122214708*a+.5363325363*r+.0514459929*u,c=.2119034982*a+.6806995451*r+.1073969566*u,o=.0883024619*a+.2817188376*r+.6299787005*u,i=Math.cbrt(s),m=Math.cbrt(c),d=Math.cbrt(o),b=.2104542553*i+.793617785*m-.0040720468*d,p=1.9779984951*i-2.428592205*m+.4505937099*d,v=.0259040371*i+.7827717662*m-.808675766*d,f=Math.sqrt(p*p+v*v);let V=Math.atan2(v,p)*180/Math.PI;return V<0&&(V+=360),[b,f,V]}function P(e,n,l,a,r,u){switch(r){case"hex":if(u){const s=o=>o.toString(16).padStart(2,"0"),c=Math.max(0,Math.min(255,Math.round(a*255)));return`#${s(e)}${s(n)}${s(l)}${s(c)}`}return tt(e,n,l);case"rgb":return`rgb(${e}, ${n}, ${l})`;case"rgba":return`rgba(${e}, ${n}, ${l}, ${Math.round(a*100)/100})`;case"hsl":{const[s,c,o]=et(e,n,l);return`hsl(${s}, ${c}%, ${o}%)`}case"hsla":{const[s,c,o]=et(e,n,l);return`hsla(${s}, ${c}%, ${o}%, ${Math.round(a*100)/100})`}case"hwb":{const[s,c,o]=Qt(e,n,l);return a<1?`hwb(${s} ${c}% ${o}% / ${Math.round(a*100)/100})`:`hwb(${s} ${c}% ${o}%)`}case"oklch":{const[s,c,o]=Kt(e,n,l),i=(Math.round(s*1e3)/1e3).toFixed(3),m=(Math.round(c*1e3)/1e3).toFixed(3),d=(Math.round(o*10)/10).toFixed(1),b=Math.round(a*100)/100;return u||a<1?`oklch(${i} ${m} ${d} / ${b})`:`oklch(${i} ${m} ${d})`}}}function j(e,n){return n?e==="rgb"?"rgba":e==="hsl"?"hsla":e:e==="rgba"?"rgb":e==="hsla"?"hsl":e}function te(e,n){const[l,a,r]=e,u=l<<16^a<<8^r,s=Xt(u),c=6+Math.floor(s()*5),o=.18+s()*.06,i=[];for(let p=0;p<c;p++){const v=p/c*Math.PI*2,f=n*(1+(s()*2-1)*o),V=Math.cos(v)*f,h=Math.sin(v)*f;i.push({x:V,y:h})}const m=(i[0].x+i[c-1].x)/2,d=(i[0].y+i[c-1].y)/2;let b=`M ${m.toFixed(3)} ${d.toFixed(3)}`;for(let p=0;p<c;p++){const v=i[p],f=i[(p+1)%c],V=(v.x+f.x)/2,h=(v.y+f.y)/2;b+=` Q ${v.x.toFixed(3)} ${v.y.toFixed(3)} ${V.toFixed(3)} ${h.toFixed(3)}`}return b+=" Z",b}const ee=e=>{const{value:n,onBlur:l,onChange:a,onInput:r,displayValue:u,size:s,withAlpha:c}=e,o=t.Value.map(s??32,x=>x),i=t.Value.map(n,x=>qt(x??"#000000")),m=t.Value.map(i,([x,w,_])=>[x,w,_]),d=t.Value.map(i,([,,,x])=>x),b=t.prop(t.Value.get(d)??1),p=t.Value.map(c??!1,x=>x),v=t.Value.map(e.colorTextFormat??"rgb",x=>x),f=t.computedOf(m,b,v,p)(([x,w,_],M,E,$)=>P(x,w,_,M??1,j(E,$),$)),V=t.Value.map(e.colorTextFormat??"hex",x=>x),h=t.Value.map(o,x=>`${-x/2} ${-x/2} ${x} ${x}`),g=t.computedOf(m,o)((x,w)=>te(x,w/2)),k=t.computedOf(m,b,p)(([x,w,_],M,E)=>E||M<1?Yt(x,w,_,M):tt(x,w,_)),C=t.html.div(t.attr.class("bc-color-input__control"),t.attr.class(t.Value.map(p,x=>x?"bc-color-input__control--alpha":"")),t.attr.style(t.computedOf(o)(x=>`min-width:${x+2}px;height:${x+2}px`)),t.svg.svg(t.attr.class("bc-color-input__svg"),t.svgAttr.viewBox(h),t.svg.path(t.svgAttr.d(g),t.svgAttr.fill(k))),t.html.input(t.attr.type("color"),y.CommonInputAttributes(e),t.attr.value(t.Value.map(m,([x,w,_])=>tt(x,w,_))),t.attr.class("bc-input bc-color-input bc-color-input__native"),l!=null?t.on.blur(l):t.Empty,a!=null?t.on.change(x=>{const w=x.target.value;if(!a)return;const[_,M,E]=K(w),$=t.Value.get(b)??1,F=j(t.Value.get(V),t.Value.get(p)),T=P(_,M,E,$,F,t.Value.get(p));a(T)}):t.Empty,r!=null?t.on.input(x=>{const w=x.target.value;if(!r)return;const[_,M,E]=K(w),$=t.Value.get(b)??1,F=j(t.Value.get(V),t.Value.get(p)),T=P(_,M,E,$,F,t.Value.get(p));r(T)}):t.Empty)),I=t.When(p,()=>t.html.input(t.attr.type("range"),t.attr.class("bc-color-input__alpha"),t.attr.min(0),t.attr.max(1),t.attr.step(.01),t.attr.value(t.Value.map(b,x=>String(x??1))),t.attr.disabled(e.disabled),t.on.input(x=>{const w=parseFloat(x.target.value);b.set(w);const[_,M,E]=t.Value.get(m),$=j(t.Value.get(V),t.Value.get(p)),F=P(_,M,E,w,$,t.Value.get(p));r?.(F)}),t.on.change(x=>{const w=parseFloat(x.target.value);b.set(w);const[_,M,E]=t.Value.get(m),$=j(t.Value.get(V),t.Value.get(p)),F=P(_,M,E,w,$,t.Value.get(p));a?.(F)})));return y.InputContainer({baseContainer:!0,...e,growInput:!1,input:C,after:t.Fragment(t.When(u??!1,()=>t.html.span(t.attr.class("bc-color-input__rgb"),f)),I,e.after)})},at="$$tts-exp-",gt=(e,n)=>t.WithElement(l=>{const a=`${at}${e}`;return t.OnDispose(t.Value.on(n,r=>Reflect.set(l,a,r)))}),ne=(e,n)=>{const l=`${at}${e}`;return a=>{n(Reflect.get(a.target,l))}},bt=(e,n)=>{const l=`${at}${e}`;return a=>{const r=a.target,u=r.selectedIndex,s=r.options[u];n(Reflect.get(s,l))}};function ae(e,n,l){const a=["bc-card"];return e!=="default"&&a.push(`bc-card--${e}`),n!=="md"&&a.push(`bc-card--padding-${n}`),l!=="lg"&&a.push(`bc-card--rounded-${l}`),a.join(" ")}function re({variant:e="default",size:n="md",roundedness:l="lg"}={},...a){return t.html.div(t.attr.class(t.computedOf(e,n,l)((r,u,s)=>ae(r??"default",u??"md",s??"lg"))),...a)}function H(...e){return t.html.div(t.attr.class("bc-group"),...e)}const le=({startEditing:e,value:n,onChange:l,placeholder:a,disabled:r})=>{const u=t.Value.deriveProp(e??!1),s=t.prop(!1),c=t.Value.map(r??!1,o=>o);return t.html.div(t.attr.class("bc-editable-text"),t.attr.class(t.Value.map(c,o=>o?"bc-editable-text--disabled":"")),t.aria.disabled(c),t.When(u,()=>t.html.input(t.attr.placeholder(a),t.attr.value(n),t.attr.class("bc-editable-text__input"),nt.AutoSelect(),t.on.keydown(o=>{o.key==="Enter"?u.set(!1):o.key==="Escape"&&(s.set(!0),u.set(!1))}),t.on.blur(t.emitValue(o=>{if(u.set(!1),s.value){s.set(!1);return}l(o)}))),()=>t.html.span(t.on.click(()=>{t.Value.get(c)||u.set(!0)}),t.attr.class("bc-editable-text__display"),t.When(t.Value.map(n,o=>o!=null&&o.trim()!==""),()=>t.html.span(t.attr.class("bc-editable-text__text"),n),()=>t.html.span(t.attr.class("bc-editable-text__placeholder"),a)),t.When(t.Value.map(c,o=>!o),()=>t.html.button(t.attr.type("button"),t.attr.class("bc-editable-text__edit-button"),t.Use(y.BeatUII18n,o=>t.aria.label(o.$.editLabel)),t.on.click(()=>u.set(!0)),y.Icon({icon:"line-md/pencil",color:"neutral"}))))))},vt=(e,n,l)=>t.Ensure(e,a=>t.OneOfType(a,{value:r=>{const u=t.computedOf(r,l)((s,c)=>n(s.value,c));return t.html.option(t.OnDispose(u.dispose),t.attr.selected(u),gt("value",r.$.value),r.$.label)},group:r=>t.html.optgroup(t.attr.label(r.$.group),t.ForEach(r.$.options,u=>vt(u,n,l))),break:()=>t.html.hr()})),xt=e=>{const{value:n,onBlur:l,onChange:a,options:r,unselectedLabel:u,equality:s=(i,m)=>i===m,after:c}=e;let o;return y.InputContainer({...e,after:t.Fragment(y.Icon({icon:"ph:caret-down-bold",color:"neutral",size:"sm"}),c),input:t.html.select(t.WithElement(i=>{o=i;const m=new MutationObserver(d=>{const{removedNodes:b}=d[0];b.length>0&&(o.selectedIndex=0)});return m.observe(i,{childList:!0}),t.OnDispose(()=>m.disconnect())}),y.CommonInputAttributes(e),t.attr.class("bc-native-select bc-input"),t.Use(y.BeatUII18n,i=>t.html.option(t.attr.hidden("hidden"),t.coalesce(u,i.$.selectOne))),t.ForEach(r,i=>vt(i,s,n)),l!=null?t.on.blur(l):t.Empty,a!=null?t.on.change(bt("value",i=>a(i))):t.Empty)},t.on.click(()=>{o?.focus(),typeof o?.showPicker=="function"&&o.showPicker()}))};function It(e){const{controller:n,onChange:l,onBlur:a,...r}=e;return xt({...r,value:n.signal,onChange:A.makeOnChangeHandler(n,l),onBlur:A.makeOnBlurHandler(n,a)})}function se(e){return A.InputWrapper({...e,content:It(e)})}function Vt(e,n,l){const a=e.length.map(r=>r);return t.Fragment(t.OnDispose(()=>a.dispose()),t.Repeat(a,r=>{const u=e.item(r.index),s=[];return t.Fragment(t.OnDispose(()=>{u.dispose(),s.forEach(c=>c())}),n({list:e,item:u,position:r,remove:()=>e.removeAt(r.index),move:c=>{switch(c){case"up":if(r.index===0)return;e.move(r.index,r.index-1);break;case"down":if(r.index===e.length.value-1)return;e.move(r.index,r.index+1);break;case"first":e.move(r.index,0);break;case"last":e.move(r.index,e.length.value-1)}},canMove:c=>{const o=(()=>{switch(c){case"up":return t.signal(r.index>0);case"down":return e.length.map(i=>r.index<i-1)}})();return s.push(()=>o.dispose()),o},cannotMove:c=>{const o=(()=>{switch(c){case"up":return t.signal(r.index===0);case"down":return e.length.map(i=>r.index===i-1)}})();return s.push(()=>o.dispose()),o}}))},l))}const ut={9:{pattern:/^[0-9]$/},A:{pattern:/^[A-Za-z]$/,transform:e=>e.toUpperCase()},"*":{pattern:/^.$/}},oe=e=>e instanceof RegExp;function yt(e,n,l){if(e==null)return[];const a=l?{...ut,...n}:n??ut,r=(s,c)=>{const o=a[c];o?s.push({type:"pattern",name:c,...o}):s.push({type:"literal",char:c})},u=[];if(typeof e=="string"){for(const s of e)r(u,s);return u}for(const s of e)if(typeof s=="string")if(s.length<=1)r(u,s);else for(const c of s)r(u,c);else oe(s)?u.push({type:"pattern",pattern:s}):typeof s=="object"&&s&&u.push(s);return u}function ue(e,n){return l=>{switch(e){case"digits":return/[0-9]/.test(l);case"letters":return/[A-Za-z]/.test(l);case"alphanumeric":return/[A-Za-z0-9]/.test(l);case"custom":return n?.(l)??!0;default:return!0}}}function ct(e,n,l,a,r,u){const s={raw:e,previousConformed:n,cursor:r??e.length,completed:!1},c=a.definitions??{},o=typeof l=="function"?l(e,s):l,i=yt(o,c,a.useDefaultDefinitions??!0),m=ue(a.allowMode,a.allow),d=new Set;for(const $ of i)$.type==="literal"&&d.add($.char);if(a.prefix)for(const $ of a.prefix)d.add($);if(a.suffix)for(const $ of a.suffix)d.add($);const b=Array.from(e).filter($=>m($)&&!d.has($));if(b.length===0)return{value:"",cursor:0,completed:!1};const p=[],v=[];let f=0,V=0,h=0,g=-1;for(const $ of i){if($.type==="literal"){p.push($.char),v.push({kind:"literal",filled:!0});continue}V+=$.optional?0:1;const F=b[f];if(F==null)break;if($.type==="any"){h++,p.push($.transform?$.transform(F):F),v.push({kind:"slot",filled:!0}),g=v.length-1,f++;continue}if($.type==="pattern")if($.pattern.test(F)){h++;const T=$.transform?$.transform(F):F;p.push(T),v.push({kind:"slot",filled:!0}),g=v.length-1,f++}else{f++;continue}}const k=p.join(""),C=(a.prefix??"")+k+(a.suffix??"");let x=(a.prefix??"").length;if(g>=0){let $=g+1;if((u?.policy??"smart")!=="sticky")for(;$<v.length&&v[$].kind==="literal";)$++;x+=$}const w=a.completion?.mode==="min"?(a.completion.minChars??0)<=h:a.completion?.mode==="custom"?!!a.completion.isComplete?.(C):V>0&&h>=V,_=a.pipe?.(C,{...s,completed:w});let M,E=x;return _===!1?(M=n,E=n.length):typeof _=="string"?(M=_,E=_.length):typeof _=="object"&&_?(M=_.value,E=_.cursor??_.value.length):M=C,{value:M,cursor:E,completed:w}}function ce(e,n){const l=n?.strategy??"none";return l==="custom"&&n?.unmask?n.unmask(e):l==="strip"?e.replace(/[^A-Za-z0-9]/g,""):e}const rt=e=>{const{value:n,onBlur:l,onChange:a,onInput:r,onAccept:u,onComplete:s,mask:c,definitions:o,useDefaultDefinitions:i,extraLiterals:m,prefix:d,suffix:b,autofix:p,pipe:v,completion:f,unmask:V,allowMode:h,allow:g,placeholder:k,placeholderOptions:C}=e,I=t.computedOf(n,c,o,i,m,d,b,p,f,V,h,k,C)((w,_,M,E,$,F,T,z,W,R,U,Z,O)=>_?ct(w??"","",_,{definitions:M??{},useDefaultDefinitions:E??!0,extraLiterals:$??[],autofix:z??"none",completion:W??{mode:"mask"},pipe:v??(D=>D),unmask:R??{strategy:"none"},allowMode:U??"all",allow:g,prefix:F,suffix:T}).value:w??""),x=(w,_)=>{const M=w.value??"",E=t.Value.get(n)??"",$=c!=null?t.Value.get(c):null,F=o!=null?t.Value.get(o):void 0,T=i!=null?t.Value.get(i):void 0,z=m!=null?t.Value.get(m):void 0,W=p!=null?t.Value.get(p):void 0,R=f!=null?t.Value.get(f):void 0,U=V!=null?t.Value.get(V):void 0,Z=h!=null?t.Value.get(h):void 0,O=d!=null?t.Value.get(d):void 0,D=b!=null?t.Value.get(b):void 0,{value:N,cursor:Y,completed:lt}=$?ct(M,E,$,{definitions:F??{},useDefaultDefinitions:T??!0,extraLiterals:z??[],autofix:W??"none",completion:R??{mode:"mask"},pipe:v??(Ft=>Ft),unmask:U??{strategy:"none"},allowMode:Z??"all",allow:g,prefix:O,suffix:D},w.selectionStart??M.length,e.cursor?t.Value.get(e.cursor):void 0):{value:M,cursor:M.length,completed:!0};if(N!==M){w.value=N;try{w.setSelectionRange(Y,Y)}catch{}}const st=ce(N,U);u?.({raw:st,conformed:N,completed:lt,cursor:Y}),_==="input"?r?.(N):(a?.(N),lt&&s?.({raw:st,conformed:N}))};return y.InputContainer({...e,input:t.input.text(y.CommonInputAttributes(e),t.attr.value(I),t.attr.class("bc-input"),l!=null?t.on.blur(l):t.Empty,t.WithElement(w=>w instanceof HTMLInputElement?t.Fragment(t.on.input(()=>x(w,"input")),t.on.change(()=>x(w,"change")),t.on.keydown(_=>{if(_.key!=="Backspace"||!(e.cursor?t.Value.get(e.cursor)?.backspaceRubberBand??!0:!0))return;const E=w.selectionStart??0,$=w.selectionEnd??E;if(E!==$||E<=0)return;const F=w.value??"",T=c!=null?t.Value.get(c):null;if(!T)return;const z=o!=null?t.Value.get(o):void 0,W=i!=null?t.Value.get(i):!0,R=d!=null?t.Value.get(d):void 0,U=b!=null?t.Value.get(b):void 0,Z=yt(typeof T=="function"?T(F,{raw:F,previousConformed:F,cursor:E,completed:!1}):T,z??{},W??!0),O=new Set;for(const D of Z)D.type==="literal"&&O.add(D.char);if(R)for(const D of R)O.add(D);if(U)for(const D of U)O.add(D);if(O.has(F[E-1])){let D=E-1;for(;D>=0&&O.has(F[D]);)D--;D>=0&&(_.preventDefault(),_.stopPropagation(),w.value=F.slice(0,D)+F.slice(D+1),x(w,"input"))}})):t.Empty))})};function B(e,n,l){const a=t.Value.map(e,u=>u!=null),r=y.defaultMessages.clearValue;return t.When(a,()=>t.html.button(t.attr.type("button"),t.attr.class("bc-input-container__reset"),t.aria.label(r),t.attr.title(r),t.attr.disabled(n??!1),y.Icon({icon:"mdi:close",size:"sm"}),t.on.click(u=>{u.preventDefault(),u.stopPropagation(),l?.(null)})))}const ie=e=>{const{value:n,onBlur:l,onChange:a,after:r,disabled:u}=e,s=B(n,u,a);return y.InputContainer({...e,input:t.input.date(y.CommonInputAttributes(e),t.attr.valueAsDate(n),t.attr.class("bc-input"),l!=null?t.on.blur(t.emitValue(l)):t.Empty,a!=null?t.on.change(t.emitValueAsNullableDate(a)):t.Empty),after:r!=null?t.Fragment(s,r):s})},pe=e=>{const n=e.getFullYear(),l=e.getMonth()+1,a=e.getDate(),r=e.getHours(),u=e.getMinutes(),s=e.getSeconds();return`${n}-${l.toString().padStart(2,"0")}-${a.toString().padStart(2,"0")}T${r.toString().padStart(2,"0")}:${u.toString().padStart(2,"0")}:${s.toString().padStart(2,"0")}`},de=e=>{const{value:n,onBlur:l,onChange:a,after:r,disabled:u}=e,s=t.Value.map(n,o=>o!=null?pe(o):null),c=B(n,u,a);return y.InputContainer({...e,input:t.input["datetime-local"](y.CommonInputAttributes(e),t.attr.value(t.Value.map(s,o=>o??null)),t.attr.class("bc-input"),l!=null?t.on.blur(t.emitValue(l)):t.Empty,a!=null?t.on.change(t.emitValueAsNullableDateTime(a)):t.Empty),after:r!=null?t.Fragment(c,r):c})},S=e=>typeof e=="string"&&e.trim()===""?null:e,L=e=>e??"",me=e=>{const{value:n,onBlur:l,onChange:a,onInput:r,after:u,disabled:s,...c}=e,o=B(n,s,a);return y.TextInput({...c,value:t.Value.map(n,L),onChange:a!=null?i=>a(S(i)):void 0,onInput:r!=null?i=>r(S(i)):void 0,onBlur:l,after:u!=null?t.Fragment(o,u):o})},fe=e=>{const{value:n,onBlur:l,onChange:a,onInput:r,after:u,disabled:s,...c}=e,o=B(n,s,a);return A.EmailInput({...c,value:t.Value.map(n,L),onChange:a!=null?i=>a(S(i)):void 0,onInput:r!=null?i=>r(S(i)):void 0,onBlur:l,after:u!=null?t.Fragment(o,u):o})},he=e=>{const{value:n,onBlur:l,onChange:a,onInput:r,after:u,disabled:s,...c}=e,o=B(n,s,a);return A.PasswordInput({...c,value:t.Value.map(n,L),onChange:a!=null?i=>a(S(i)):void 0,onInput:r!=null?i=>r(S(i)):void 0,onBlur:l,after:u!=null?t.Fragment(o,u):o})},wt=e=>{const{value:n,onBlur:l,onChange:a,onInput:r,rows:u}=e;return y.InputContainer({...e,input:t.html.textarea(y.CommonInputAttributes(e),t.attr.rows(u??3),t.attr.value(n),t.attr.class("bc-input"),l!=null?t.on.blur(t.emitValue(l)):t.Empty,a!=null?t.on.change(t.emitValue(a)):t.Empty,r!=null?t.on.input(t.emitValue(r)):t.Empty)})},ge=e=>{const{value:n,onBlur:l,onChange:a,onInput:r,after:u,disabled:s,...c}=e,o=B(n,s,a);return wt({...c,value:t.Value.map(n,L),onChange:a!=null?i=>a(S(i)):void 0,onInput:r!=null?i=>r(S(i)):void 0,onBlur:l,after:u!=null?t.Fragment(o,u):o})},be=e=>{const{value:n,step:l,min:a,max:r,onBlur:u,onChange:s,onInput:c,after:o}=e,i=b=>{const p=a!=null?t.Value.get(a):void 0,v=r!=null?t.Value.get(r):void 0;return p!=null&&b<p?p:v!=null&&b>v?v:b},m=l!=null?t.Use(y.BeatUII18n,b=>{const p=t.computedOf(n,a)((h,g)=>g==null?!0:(h??0)>g),v=t.computedOf(n,r)((h,g)=>g==null?!0:(h??0)<g),f=h=>{const g=t.Value.get(n)??0,k=t.Value.get(l),C=h?.shiftKey?10:1,I=g-k*C,x=a!=null?t.Value.get(a):void 0;if(x!=null&&I<x)return;const w=i(I);w!==g&&s&&s(w)},V=h=>{const g=t.Value.get(n)??0,k=t.Value.get(l),C=h?.shiftKey?10:1,I=g+k*C,x=r!=null?t.Value.get(r):void 0;if(x!=null&&I>x)return;const w=i(I);w!==g&&s&&s(w)};return A.Stack(t.attr.class("bc-number-input-steppers"),t.html.button(t.attr.type("button"),t.attr.class("bc-button bc-number-input-steppers-button bc-number-input-steppers-button--increment"),t.attr.disabled(t.computedOf(v,e.disabled??!1)((h,g)=>!h||g)),t.on.click(h=>V(h)),t.aria.label(b.$.incrementValue),y.Icon({icon:"line-md:plus",size:"xs"})),t.html.button(t.attr.type("button"),t.attr.class("bc-button bc-number-input-steppers-button bc-number-input-steppers-button--decrement"),t.attr.disabled(t.computedOf(p,e.disabled??!1)((h,g)=>!h||g)),t.on.click(h=>f(h)),t.aria.label(b.$.decrementValue),y.Icon({icon:"line-md:minus",size:"xs"})))}):null,d=o!=null&&m!=null?t.Fragment(m,o):o??m;return y.InputContainer({...e,input:t.input.number(a!=null?t.Fragment(t.attr.min(a),t.OnDispose(t.Value.on(a,b=>{b<t.Value.get(n)}))):t.Empty,r!=null?t.Fragment(t.attr.max(r),t.OnDispose(t.Value.on(r,b=>{b>t.Value.get(n)}))):t.Empty,y.CommonInputAttributes(e),t.attr.valueAsNumber(n),t.attr.step(l),t.attr.class("bc-input bc-number-input"),u!=null?t.on.blur(t.emitValue(u)):t.Empty,s!=null?t.on.change(t.emitValueAsNumber(s)):t.Empty,c!=null?t.on.input(t.emitValueAsNumber(c)):t.Empty,l!=null?t.on.wheel(b=>{b.preventDefault();const p=t.Value.get(n)??0,v=t.Value.get(l),f=b.shiftKey?10:1,V=b.deltaY<0?v*f:-v*f,h=i(p+V);h!==p&&s&&s(h)}):t.Empty),after:d})},it=e=>{if(e==null||e==="")return null;const n=Number(e);return Number.isNaN(n)?null:n},ve=e=>{const{value:n,step:l,min:a,max:r,onBlur:u,onChange:s,onInput:c,after:o}=e,i=p=>{const v=a!=null?t.Value.get(a):void 0,f=r!=null?t.Value.get(r):void 0;return v!=null&&p<v?v:f!=null&&p>f?f:p},m=(()=>{if(l==null)return null;const p=t.computedOf(n,a)((g,k)=>{const C=g??0;return k==null?!0:C>k}),v=t.computedOf(n,r)((g,k)=>{const C=g??0;return k==null?!0:C<k}),f=g=>{const k=t.Value.get(n)??0,C=t.Value.get(l),I=g?.shiftKey?10:1,x=k-C*I,w=a!=null?t.Value.get(a):void 0;if(w!=null&&x<w)return;const _=i(x);_!==k&&s&&s(_)},V=g=>{const k=t.Value.get(n)??0,C=t.Value.get(l),I=g?.shiftKey?10:1,x=k+C*I,w=r!=null?t.Value.get(r):void 0;if(w!=null&&x>w)return;const _=i(x);_!==k&&s&&s(_)};return((g,k)=>A.Stack(t.attr.class("bc-number-input-steppers"),t.html.button(t.attr.type("button"),t.attr.class("bc-button bc-number-input-steppers-button bc-number-input-steppers-button--increment"),t.attr.disabled(t.computedOf(v,e.disabled??!1)((C,I)=>!C||I)),t.on.click(C=>V(C)),t.aria.label(g),y.Icon({icon:"line-md:plus",size:"xs"})),t.html.button(t.attr.type("button"),t.attr.class("bc-button bc-number-input-steppers-button bc-number-input-steppers-button--decrement"),t.attr.disabled(t.computedOf(p,e.disabled??!1)((C,I)=>!C||I)),t.on.click(C=>f(C)),t.aria.label(k),y.Icon({icon:"line-md:minus",size:"xs"}))))(y.defaultMessages.incrementValue,y.defaultMessages.decrementValue)})(),d=B(n,e.disabled,s),b=o!=null&&m!=null?t.Fragment(m,d,o):o!=null?t.Fragment(d,o):m!=null?t.Fragment(m,d):d;return y.InputContainer({...e,input:t.input.number(a!=null?t.Fragment(t.attr.min(a),t.OnDispose(t.Value.on(a,p=>{}))):t.Empty,r!=null?t.Fragment(t.attr.max(r),t.OnDispose(t.Value.on(r,p=>{}))):t.Empty,y.CommonInputAttributes(e),t.attr.value(t.Value.map(n,p=>p==null?"":String(p))),t.attr.step(l),t.attr.class("bc-input bc-number-input"),u!=null?t.on.blur(t.emitValue(u)):t.Empty,s!=null?t.on.change(t.emitValue(p=>{const v=it(p);s(v)})):t.Empty,c!=null?t.on.input(t.emitValue(p=>{const v=it(p);c(v)})):t.Empty,l!=null?t.on.wheel(p=>{p.preventDefault();const v=t.Value.get(n)??0,f=t.Value.get(l),V=p.shiftKey?10:1,h=p.deltaY<0?f*V:-f*V,g=i(v+h);g!==v&&s&&s(g)}):t.Empty),after:b})},xe=({value:e,onChange:n,onInput:l,onBlur:a,offLabel:r,onLabel:u,disabled:s=!1,size:c="md",id:o,color:i="primary"})=>{const m=o??A.sessionId("switch");function d(f,V){const h=["bc-switch",`bc-switch--size-${V}`,`bc-switch--${V}`];return f&&h.push("bc-switch--disabled"),h.join(" ")}function b(f){const V=f??"primary",h=new Map,g=y.backgroundValue(V,"solid","light"),k=y.backgroundValue(V,"solid","dark");return h.set("--switch-track-on-bg",g.backgroundColor),h.set("--switch-track-on-label",g.textColor),h.set("--switch-track-on-bg-dark",k.backgroundColor),h.set("--switch-track-on-label-dark",k.textColor),h.set("--switch-track-on-border-dark",y.borderColorValue(V,"dark")),Array.from(h.entries()).map(([C,I])=>`${C}: ${I}`).join("; ")}const p=()=>{t.Value.get(s)||(n?.(!t.Value.get(e)),l?.(!t.Value.get(e)))},v=f=>{t.Value.get(s)||(f.key===" "||f.key==="Enter")&&(f.preventDefault(),p())};return t.html.div(t.attr.class(t.computedOf(s??!1,c)((f,V)=>d(f??!1,V??"md"))),t.attr.style(t.computedOf(i)(f=>b(f))),t.attr.id(m),t.attr.role("switch"),t.attr.tabindex(t.Value.map(s,f=>f?-1:0)),t.aria.checked(e),t.aria.disabled(s),t.on.click(p),t.on.keydown(v),a!=null?t.on.blur(a):null,t.html.div(t.attr.class("bc-switch__track"),t.attr.class(t.Value.map(e,f=>f?"bc-switch__track--on":"bc-switch__track--off")),r!=null?t.html.div(t.aria.hidden(!0),t.attr.class("bc-switch__track-label bc-switch__track-label--off"),t.attr.class(t.Value.map(e,f=>f?"bc-switch__track-label--hidden":"bc-switch__track-label--visible")),r):null,u!=null?t.html.div(t.attr.class("bc-switch__track-label bc-switch__track-label--on"),t.attr.class(t.Value.map(e,f=>f?"bc-switch__track-label--visible":"bc-switch__track-label--hidden")),u):null,nt.ElementRect(f=>t.Use(y.Locale,({direction:V})=>t.html.div(t.attr.class("bc-switch__thumb"),t.attr.class(t.Value.map(e,h=>h?"bc-switch__thumb--on":"bc-switch__thumb--off")),t.style.transform(t.computedOf(e,f,c,V)((h,{width:g},k,C)=>{const I=(()=>{switch(k){case"xs":return 5;case"sm":return 5.5;case"md":return 6;case"lg":return 7;case"xl":return 8}})(),x=C==="rtl"?`calc((var(--spacing-base) * ${I}) - ${g}px)`:`calc(${g}px - (var(--spacing-base) * ${I}))`;return h?`translateX(${x})`:"translateX(0)"})))))))},Ct=e=>{const n={type:"pattern",pattern:/[0-9A-Fa-f]/,transform:a=>a.toLowerCase()};return rt({...e,mask:[n,n,n,n,n,n,n,n,"-",n,n,n,n,"-",n,n,n,n,"-",n,n,n,n,"-",n,n,n,n,n,n,n,n,n,n,n,n],placeholder:e.placeholder??"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"})},Ie=e=>{const{value:n,onBlur:l,onChange:a,onInput:r,after:u,disabled:s,...c}=e,o=B(n,s,a);return Ct({...c,value:t.Value.map(n,L),onChange:a!=null?i=>a(S(i)):void 0,onInput:r!=null?i=>r(S(i)):void 0,onBlur:l,after:u!=null?t.Fragment(o,u):o})},Ve="line-md:star-alt-filled",ye="line-md:star-alt",_t=e=>{const{value:n,onChange:l,disabled:a,max:r=5,fullColor:u="yellow",emptyColor:s="neutral",fullIcon:c=Ve,emptyIcon:o=ye,size:i="md",onBlur:m,rounding:d=1}=e,b=()=>{const g=t.Value.get(d);return g>0?g:1},p=g=>Math.min(Math.max(g,0),t.Value.get(r)),v=(g,k)=>{if(t.Value.get(a??!1))return;const I=g.currentTarget.getBoundingClientRect(),x=(g.clientX-I.left)/I.width,w=k-1+x,_=b(),M=Math.ceil(w/_)*_,E=p(M);l?.(E)},f=g=>{if(t.Value.get(a??!1))return;const k=b(),C=t.Value.get(n)??0;let I;switch(g.key){case"ArrowRight":case"ArrowUp":I=p(C+k);break;case"ArrowLeft":case"ArrowDown":I=p(C-k);break;case"Home":I=0;break;case"End":I=t.Value.get(r);break;default:return}g.preventDefault(),l?.(I)},V=t.Value.map(i,g=>`bc-icon--${g}`),h=({index:g,counter:k})=>t.html.span(t.attr.class("bc-rating-input__icon-container"),t.attr.class(V),y.Icon({icon:o,size:i,color:s,tone:"soft"},t.attr.class("bc-rating-input__icon-empty")),t.html.span(t.attr.class("bc-rating-input__icon-clipper"),t.attr.class(V),t.style.width(t.Value.map(n,C=>{const I=Math.floor(C);return I>g?"100%":I<g?"0%":`${(C-g)*100}%`})),y.Icon({icon:c,size:i,color:u,tone:"soft"},t.attr.class("bc-rating-input__icon-full"))),t.on.click(t.emit(C=>v(C,k),{preventDefault:!0,stopPropagation:!0})));return y.InputContainer({baseContainer:!0,growInput:!1,focusableSelector:'[role="slider"]',...e,input:t.html.div(y.CommonInputAttributes(e),t.attr.class("bc-rating-input"),t.attr.role("slider"),t.attr.tabindex(t.Value.map(a??!1,g=>g?-1:0)),t.aria.disabled(a??!1),t.aria.valuemin(0),t.aria.valuemax(t.Value.map(r,g=>g??0)),t.aria.valuenow(t.Value.map(n,g=>g??0)),t.aria.valuetext(t.computedOf(n,r)((g,k)=>{const C=g??0,I=k??0;return`${String(C)} / ${String(I)}`})),t.on.keydown(f),m!=null?t.on.blur(m):null,t.Repeat(r,h))})},we=e=>{const{value:n,onChange:l,onBlur:a,after:r,disabled:u,...s}=e,c=B(n,u,l);return _t({...s,value:t.Value.map(n,o=>o??0),onChange:l,onBlur:a,after:r!=null?t.Fragment(c,r):c})},Ce=e=>{const{value:n,step:l,min:a,max:r,onBlur:u,onChange:s,onInput:c}=e;return y.InputContainer({...e,focusableSelector:'input[type="range"]',input:t.html.input(t.attr.type("range"),y.CommonInputAttributes(e),t.attr.min(a),t.attr.max(r),t.attr.step(l),t.attr.valueAsNumber(n),t.attr.class("bc-input bc-slider-input"),u!=null?t.on.blur(t.emitValueAsNumber(u)):t.Empty,s!=null?t.on.change(t.emitValueAsNumber(s)):t.Empty,c!=null?t.on.input(t.emitValueAsNumber(c)):t.Empty)})},_e=e=>{const{value:n,step:l,min:a,max:r,onBlur:u,onChange:s,onInput:c}=e,o=t.Value.map(n,m=>{if(m!=null)return m;const d=a!=null?t.Value.get(a):void 0;return typeof d=="number"?d:0}),i=B(n,e.disabled,m=>{s?.(m)});return y.InputContainer({...e,focusableSelector:'input[type="range"]',after:i,input:t.html.input(t.attr.type("range"),y.CommonInputAttributes(e),t.attr.min(a),t.attr.max(r),t.attr.step(l),t.attr.valueAsNumber(o),t.attr.class("bc-input bc-slider-input"),u!=null?t.on.blur(t.emitValueAsNumber(u)):t.Empty,s!=null?t.on.change(t.emitValueAsNumber(m=>{s(m)})):t.Empty,c!=null?t.on.input(t.emitValueAsNumber(m=>{c(m)})):t.Empty)},t.Fragment())};let Q=null;async function q(){const e=globalThis;return e.Temporal?e.Temporal:(Q||(Q=Promise.resolve().then(()=>require("./index.esm-DJRz9AE-.cjs")).then(n=>{const l=n.Temporal;return e.Temporal||(e.Temporal=l),l})),Q)}const kt=(e,n)=>n?t.Task(q,{then:e,pending:n.pending,error:n.error}):t.Task(q,e),ke=/^P(\d+([YMWD]|$)){0,4}(T(\d+([HMS]|$)){0,3})?$/i,$e=/^P(?:(\d+Y)?(\d+M)?(\d+W)?(\d+D)?)(T(\d+H)?(\d+M)?(\d+S)?)?$/i;function $t(e){return{mask:null,allowMode:"custom",allow:n=>/[0-9ptwdhms]/i.test(n),pipe:n=>{const l=n.toUpperCase();return l.length===0?l:!l.startsWith("P")||!ke.test(l)?!1:l},completion:{mode:"custom",isComplete:n=>{const l=n.toUpperCase();if(!$e.test(l))return!1;try{return e(l),!0}catch{return!1}}}}}const pt=(e,n)=>{if(e==null)return null;try{return e.Duration.from(n)}catch{return null}},Me=e=>{const{value:n,onChange:l,after:a,disabled:r,onBlur:u}=e,s=()=>{const i=B(n,r,l);return a!=null?t.Fragment(i,a):i},c=e.placeholder!=null?t.Empty:t.attr.placeholder("P0DT0H0M0S");return kt(i=>rt({...e,value:t.Value.map(n,m=>m?.toString()??""),onChange:l?m=>l(m===""?null:i.Duration.from(m)):void 0,onInput:void 0,...$t(i.Duration.from),placeholder:"P0DT0H0M0S",after:s()}),{pending:()=>y.InputContainer({...e,input:t.input.text(y.CommonInputAttributes(e),t.attr.value(t.Value.map(n,i=>i?.toString()??"")),t.attr.class("bc-input"),c,u!=null?t.on.blur(()=>u()):t.Empty,l!=null?t.on.change(i=>{const d=i.currentTarget?.value??"";if(d===""){l(null);return}const b=globalThis.Temporal,p=pt(b,d);if(p!=null){l(p);return}q().then(v=>{const f=pt(v,d);f!=null&&l(f)}).catch(()=>{})}):t.Empty),after:s()})})},Mt=e=>{const{value:n,onBlur:l,onChange:a,onInput:r}=e;return y.InputContainer({...e,input:t.input.url(y.CommonInputAttributes(e),t.attr.value(n),t.attr.class("bc-input"),l!=null?t.on.blur(t.emitValue(l)):t.Empty,a!=null?t.on.change(t.emitValue(a)):t.Empty,r!=null?t.on.input(t.emitValue(r)):t.Empty)})},Ee=e=>{const{value:n,onBlur:l,onChange:a,onInput:r,after:u,disabled:s,...c}=e,o=B(n,s,a);return Mt({...c,value:t.Value.map(n,L),onChange:a!=null?i=>a(S(i)):void 0,onInput:r!=null?i=>r(S(i)):void 0,onBlur:l,after:u!=null?t.Fragment(o,u):o})},Et=e=>{const{controller:n,element:l,separator:a,showMove:r=!0,showRemove:u=!0,showAdd:s=!0,createItem:c,addLabel:o,controlsLayout:i="aside",removeDisabled:m,addDisabled:d}=e,b=t.Value.toSignal(i).map(f=>f==="aside"),p=f=>{const V=t.When(r??!1,()=>t.html.div(t.attr.class("bc-group--align-center"),t.attr.class(b.map(g=>g?"bc-group--direction-column bc-group--gap-1":"bc-group--direction-row bc-group--gap-1")),y.Button({size:"xs",roundedness:"full",variant:"text",onClick:()=>f.move("up"),disabled:f.cannotMove("up")},t.Use(y.BeatUII18n,g=>y.Icon({size:"xs",icon:"line-md:arrow-up",title:g.$.incrementValue}))),y.Button({size:"xs",roundedness:"full",variant:"text",onClick:()=>f.move("down"),disabled:f.cannotMove("down")},t.Use(y.BeatUII18n,g=>y.Icon({size:"xs",icon:"line-md:arrow-down",title:g.$.decrementValue}))))),h=t.When(u,()=>t.Use(y.BeatUII18n,g=>A.CloseButton({size:"xs",label:t.Value.map(g.$.removeItem,k=>k.toLowerCase()),color:"danger",disabled:m,onClick:f.remove})));return g=>t.When(b,()=>H(t.attr.class("bc-group--gap-1 bc-group--align-center"),A.Stack(t.attr.class("bc-stack--grow"),g),A.Stack(t.attr.class("bc-stack--align-center"),t.When(n.signal.map(k=>k.length>1),()=>V),h)),()=>A.Stack(t.attr.class("bc-stack--gap-2"),g,H(t.attr.class("bc-group--gap-2 bc-group--justify-between"),t.When(n.signal.map(k=>k.length>1),()=>V,()=>t.html.div()),h)))},v=t.When(t.computedOf(s,c)((f,V)=>f&&V!=null),()=>H(t.attr.class("bc-group--gap-2 bc-group--align-center bc-group--justify-center"),y.Button({size:"sm",variant:"filled",onClick:()=>n.push(c()),disabled:t.computedOf(n.disabled,d??!1)((f,V)=>f||V)},t.Use(y.BeatUII18n,f=>H(t.attr.class("bc-group--gap-2"),y.Icon({icon:"line-md:plus"}),o??f.$.addLabel)))));return t.Fragment(Vt(n,f=>p(f)(l(f)),a),v)},Fe=(e,...n)=>{const{controller:l,element:a,separator:r,showMove:u,showRemove:s,showAdd:c,createItem:o,addLabel:i,controlsLayout:m,removeDisabled:d,addDisabled:b,...p}=e;return A.InputWrapper({...p,content:Et({controller:l,element:a,separator:r,showMove:u,showRemove:s,showAdd:c,createItem:o,addLabel:i,controlsLayout:m,removeDisabled:d,addDisabled:b})},...n)};class Ae extends A.Controller{branches;activeBranch;#e;#t=new Map;constructor(n,l,a,r,u,s,c=A.O){super(n,l,a,r,u,c),this.branches=s;const o=m=>{for(const d of s)if(d.detect(m))return d.key;return s[0]?.key??"unknown"};this.activeBranch=a.map(o,A.O);const i=m=>{if(this.#t.has(m))return this.#t.get(m);const d=s.find(p=>p.key===m);if(!d)throw new Error(`Unknown branch: ${m}`);const b=new A.Controller([...n,m],p=>{this.change(p)},this.signal.map(p=>d.detect(p)?p:d.defaultValue(),c),r.map(A.makeMapValidation([m])),{disabled:this.disabled,validationMode:this.parent.validationMode},c);return this.#t.set(m,b),b};this.#e=this.activeBranch.map(m=>i(m),A.O),this.onDispose(()=>{for(const m of this.#t.values())m.dispose();this.#t.clear(),this.activeBranch.dispose(),this.#e.dispose()})}get activeController(){return t.Value.get(this.#e)}getBranchController(n){const l=this.branches.find(r=>r.key===n);if(!l)throw new Error(`Unknown branch: ${n}`);if(this.#t.has(n))return this.#t.get(n);const a=new A.Controller([...this.path,n],r=>{this.change(r)},this.signal.map(r=>l.detect(r)?r:l.defaultValue(),A.O),this.status.map(A.makeMapValidation([n])),{disabled:this.disabled,validationMode:this.parent.validationMode},A.O);return this.#t.set(n,a),a}switchToBranch(n,l=!1){const a=this.branches.find(s=>s.key===n);if(!a)throw new Error(`Unknown branch: ${n}`);const r=t.Value.get(this.signal);if(a.detect(r))return!0;if(a.convert){const s=a.convert(r);if(s.ok)return this.change(s.value),!0}if(l&&typeof window=="object"&&typeof window.confirm=="function"&&!window.confirm("Changing type will clear the current value. Continue?"))return!1;const u=a.defaultValue();return this.change(u),!0}get activeBranchDefinition(){const n=t.Value.get(this.activeBranch);return this.branches.find(l=>l.key===n)}}function De(e){return e.transform(n=>n??null,n=>n??void 0)}function Te(e){return e.transform(n=>n??"",n=>n===""?void 0:n)}function Se(e){return e.transform(n=>n??void 0,n=>n??null)}exports.Base64Input=Zt;exports.Base64sInput=ft;exports.BaseListControl=Et;exports.BaseNativeSelectControl=It;exports.Card=re;exports.ColorInput=ee;exports.EditableText=le;exports.Expando=gt;exports.FilesInput=dt;exports.Group=H;exports.ListControl=Fe;exports.ListInput=Vt;exports.MaskInput=rt;exports.NativeSelect=xt;exports.NativeSelectControl=se;exports.NullableDateInput=ie;exports.NullableDateTimeInput=de;exports.NullableDurationInput=Me;exports.NullableEmailInput=fe;exports.NullableNumberInput=ve;exports.NullablePasswordInput=he;exports.NullableRatingInput=we;exports.NullableResetAfter=B;exports.NullableSliderInput=_e;exports.NullableTextArea=ge;exports.NullableTextInput=me;exports.NullableUUIDInput=Ie;exports.NullableUrlInput=Ee;exports.NumberInput=be;exports.RatingInput=_t;exports.SegmentedInput=Rt;exports.SliderInput=Ce;exports.Switch=xe;exports.TextArea=wt;exports.UUIDInput=Ct;exports.UnionController=Ae;exports.UnstyledDropZone=J;exports.UrlInput=Mt;exports.WithTemporal=kt;exports._t=Ot;exports.durationMaskConfig=$t;exports.emitExpando=ne;exports.emitOptionExpando=bt;exports.emptyToNull=S;exports.ensureTemporal=q;exports.fileToBase64=mt;exports.gt=St;exports.nullToEmpty=L;exports.transformEmptyStringToUndefined=Te;exports.transformNullToUndefined=De;exports.transformUndefinedToNull=Se;
|
|
@@ -3,7 +3,7 @@ import { f as se } from "./colors-WfmhQ5e1.js";
|
|
|
3
3
|
import { g as re } from "./timer-DzWb416P.js";
|
|
4
4
|
import { ElementRect as jt, AutoSelect as le } from "@tempots/ui";
|
|
5
5
|
import { a as X, b as O, f as ae, I as z, C as j, d as yt, T as oe, L as ce, c as Vt, e as ie, B as gt } from "./translations-iam7PITs.js";
|
|
6
|
-
import { C as $t, m as ue, d as pe, I as Ht, E as de, P as fe, S as ct, s as me, e as bt, O as lt, f as Lt } from "./notice-
|
|
6
|
+
import { C as $t, m as ue, d as pe, I as Ht, E as de, P as fe, S as ct, s as me, e as bt, O as lt, f as Lt } from "./notice-BuYqG6zM.js";
|
|
7
7
|
class he extends Error {
|
|
8
8
|
constructor(e = "Missing implementation") {
|
|
9
9
|
super(e), this.name = "MissingImplementationError";
|