@tempots/beatui 0.77.0 → 0.78.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{ar-CefikVG3.cjs → ar-DNoFBb9J.cjs} +1 -1
- package/dist/{ar-BbgpGwJp.js → ar-D__6gR_P.js} +1 -1
- package/dist/auth/index.cjs.js +1 -1
- package/dist/auth/index.es.js +5 -5
- package/dist/{colors-B9fcMxa_.cjs → colors-B2yrgHSW.cjs} +1 -1
- package/dist/{colors-pQZlNrwM.js → colors-DPo9GEJR.js} +6 -6
- package/dist/{de-ZRnkggf5.cjs → de-AwUkK0rS.cjs} +1 -1
- package/dist/{de-R7lPfyZ4.js → de-DmKpCTuQ.js} +1 -1
- package/dist/{deep-merge-E6b9KE6l.js → deep-merge-Bsqkvp9-.js} +5 -5
- package/dist/{deep-merge-DBUbjJYt.cjs → deep-merge-cQgRrtGF.cjs} +1 -1
- package/dist/{duration-input-j7bVks-S.js → duration-input-DcZf0Dyd.js} +3 -3
- package/dist/{duration-input-CsygvJJ_.cjs → duration-input-Dt6riwzu.cjs} +1 -1
- package/dist/{es-DV0Jr_BZ.js → es-BDZ5UJLS.js} +1 -1
- package/dist/{es-IkNtVSp2.cjs → es-D-d2AIlX.cjs} +1 -1
- package/dist/{fa-DXvHejs9.js → fa-CuPgy1cj.js} +1 -1
- package/dist/{fa-B-byOhgU.cjs → fa-D7rRdG8c.cjs} +1 -1
- package/dist/{fr-F0ZegdR2.cjs → fr-0er_BWMt.cjs} +1 -1
- package/dist/{fr-D8FOMX0o.js → fr-DmyMO3lB.js} +1 -1
- package/dist/{he-B19Qsx-u.js → he-C3RHfs6R.js} +1 -1
- package/dist/{he-BcEFNuYz.cjs → he-R2veUyP3.cjs} +1 -1
- package/dist/{hi-CarXvOJD.cjs → hi-C9UP7NGG.cjs} +1 -1
- package/dist/{hi-DozFnE3b.js → hi-YnvrXBht.js} +1 -1
- package/dist/hls.light.min-Bhrf47iR.cjs +27 -0
- package/dist/{hls.light.min-BHW1Af0w.js → hls.light.min-C6VwviEa.js} +1095 -1087
- package/dist/{index-B7lXSIXm.cjs → index-BGwNJNop.cjs} +19 -19
- package/dist/{index-DKl26ILa.js → index-CCMjK4fD.js} +1 -1
- package/dist/{index-gSTSk9KZ.cjs → index-CdVc1Y2V.cjs} +1 -1
- package/dist/{index-CyyNsVT9.cjs → index-DE2tjivA.cjs} +1 -1
- package/dist/{index-DdpYvBeh.js → index-Dbu1ZPpw.js} +1095 -1044
- package/dist/{index-wPyoqxuj.js → index-DiEcd7ZV.js} +2 -6
- package/dist/{index-CpZh_Snx.js → index-DklKfzD4.js} +1 -1
- package/dist/{index-CYb1YxDX.js → index-mPVib4v9.js} +1 -1
- package/dist/index.cjs.js +2 -2
- package/dist/index.es.js +21 -21
- package/dist/index.esm-C6lZ02yY.cjs +1 -0
- package/dist/{index.esm-DPNh6inz.js → index.esm-ChUrm4xR.js} +80 -80
- package/dist/{it-But8uzNi.js → it-CWLwlDXe.js} +1 -1
- package/dist/{it-ops3Czzi.cjs → it-Cxt1_D4h.cjs} +1 -1
- package/dist/{ja-2dzONSkh.cjs → ja-CpDovHPb.cjs} +1 -1
- package/dist/{ja-DkwTnFdU.js → ja-DthjgDtM.js} +1 -1
- package/dist/json-schema/index.cjs.js +8 -8
- package/dist/json-schema/index.es.js +3970 -3923
- package/dist/json-structure/index.cjs.js +1 -1
- package/dist/json-structure/index.es.js +5 -5
- package/dist/{ko-uVJEhtyQ.cjs → ko-M_MCTNuN.cjs} +1 -1
- package/dist/{ko-Cqv-IjhX.js → ko-joDK7ONT.js} +1 -1
- package/dist/markdown/index.es.js +1 -1
- package/dist/{modal-rLbLQYhb.cjs → modal-D3NQ6ZgO.cjs} +1 -1
- package/dist/{modal--5-j6x0s.js → modal-oWbT46Rc.js} +28 -28
- package/dist/monaco/index.cjs.js +2 -2
- package/dist/monaco/index.es.js +11 -11
- package/dist/{nl-DXnbYulJ.cjs → nl-DGhIOGxN.cjs} +1 -1
- package/dist/{nl-YSiU3rFI.js → nl-DmoWeXUt.js} +1 -1
- package/dist/{notice-BvS1_9Va.js → notice-C0Brmeyi.js} +2 -2
- package/dist/{notice-BGaJ4k0O.cjs → notice-DYBLXglS.cjs} +1 -1
- package/dist/{pl-DXmHc2Nh.js → pl-8hl5VXnm.js} +1 -1
- package/dist/{pl-RbiIBA3C.cjs → pl-DocnXix_.cjs} +1 -1
- package/dist/prosemirror/index.cjs.js +1 -1
- package/dist/prosemirror/index.es.js +1 -1
- package/dist/{pt-Bf3z_-26.js → pt-BfYK9Rl3.js} +1 -1
- package/dist/{pt-BAecyAv-.cjs → pt-DO2Zcuqv.cjs} +1 -1
- package/dist/{ru-DZ4gJ6yr.cjs → ru-D9KCOBqN.cjs} +1 -1
- package/dist/{ru-Sy00qUeG.js → ru-eA_dNkJz.js} +1 -1
- package/dist/tailwind/index.cjs.js +1 -1
- package/dist/tailwind/index.es.js +1 -1
- package/dist/tailwind/preset.cjs.js +1 -1
- package/dist/tailwind/preset.es.js +2 -2
- package/dist/tailwind/vite-plugin.cjs.js +1 -1
- package/dist/tailwind/vite-plugin.es.js +1 -1
- package/dist/timer-BJHOsuS6.cjs +1 -0
- package/dist/timer-Rd2sKnvH.js +65 -0
- package/dist/{toolbar-C_Ec0_XC.js → toolbar-CdY5huSG.js} +1 -1
- package/dist/{toolbar-wEm8iNet.cjs → toolbar-DoRPrs-s.cjs} +1 -1
- package/dist/{tr-7jGF_acJ.cjs → tr-BBmQvRSa.cjs} +1 -1
- package/dist/{tr-BDxG3qd6.js → tr-CdqbnopM.js} +1 -1
- package/dist/{translations-DQxouiBG.js → translations-BEMKy6-W.js} +19 -19
- package/dist/{translations-BmsRhth7.js → translations-CVfr2JXG.js} +1 -1
- package/dist/{translations-C7HVMcOQ.cjs → translations-D_Vu2mbd.cjs} +1 -1
- package/dist/{translations-hMQlZmD4.cjs → translations-eUtMHN9s.cjs} +1 -1
- package/dist/{ur-55zdT2TQ.js → ur-D9sr_I1M.js} +1 -1
- package/dist/{ur-ZT6fZFId.cjs → ur-u5qjZsKM.cjs} +1 -1
- package/dist/use-form-DMiCxK26.js +1731 -0
- package/dist/use-form-pSErMD6z.cjs +2 -0
- package/dist/{vi-C7K7W0hM.js → vi-0f97dtZb.js} +1 -1
- package/dist/{vi-tNs62pgs.cjs → vi-_w5RE8el.cjs} +1 -1
- package/dist/{widget-customization-DKlfR6Qb.cjs → widget-customization-WNWmH_gX.cjs} +1 -1
- package/dist/{widget-customization-DfBf7gGp.js → widget-customization-nxbAoCx5.js} +4 -4
- package/dist/{zh-CBnP8_Lf.cjs → zh-6cQcHbf6.cjs} +1 -1
- package/dist/{zh-DvJBV9D8.js → zh-C7HcUKhE.js} +1 -1
- package/package.json +7 -4
- package/dist/hls.light.min-D3hUMpII.cjs +0 -27
- package/dist/index.esm-DJRz9AE-.cjs +0 -1
- package/dist/timer-DK_yKNwE.cjs +0 -1
- package/dist/timer-DzWb416P.js +0 -51
- package/dist/use-form-B4D58mxd.cjs +0 -2
- package/dist/use-form-DzA1RSrN.js +0 -1325
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";const r=require("@tempots/dom"),F=require("./translations-eUtMHN9s.cjs"),P=new Map;function I(e){const s=P.get(e)??0;return P.set(e,s+1),`${e}-${s}`}const n={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,s){return n.isSuccess(e)?e.value:s},getOrElseLazy(e,s){return n.isSuccess(e)?e.value:s()},getOrNull(e){return n.isSuccess(e)?e.value:null},getOrUndefined(e){return n.isSuccess(e)?e.value:void 0},getUnsafe:e=>{if(n.isSuccess(e))return e.value;throw n.isFailure(e)?e.error:new Error("Cannot get value from a not-asked or loading result")},match:(e,{success:s,failure:t,loading:a,notAsked:i=a})=>n.isSuccess(e)?s(e.value):n.isFailure(e)?t(e.error):n.isNotAsked(e)?i():a(e.previousValue),effect:(e,s)=>{switch(e.type){case"AsyncSuccess":s.success?s.success(e.value):s.else?.();break;case"AsyncFailure":s.failure?s.failure(e.error):s.else?.();break;case"Loading":s.loading?s.loading(e.previousValue):s.else?.();break;case"NotAsked":s.notAsked?s.notAsked():s.else?.();break}return e},whenSuccess:(e,s)=>(n.isSuccess(e)&&s(e.value),e),whenFailure:(e,s)=>(n.isFailure(e)&&s(e.error),e),equals:(e,s,t={valueEquals:(a,i)=>a===i,errorEquals:(a,i)=>a===i})=>e.type==="AsyncSuccess"&&s.type==="AsyncSuccess"?t.valueEquals(e.value,s.value):e.type==="AsyncFailure"&&s.type==="AsyncFailure"?t.errorEquals(e.error,s.error):e.type==="Loading"&&s.type==="Loading"?t.valueEquals(e.previousValue,s.previousValue):e.type==="NotAsked"&&s.type==="NotAsked",all:e=>{const s=[];for(const t of e)if(n.isSuccess(t))s.push(t.value);else return t;return n.success(s)},ofPromise:async e=>{try{const s=await e;return n.success(s)}catch(s){return n.failure(s instanceof Error?s:new Error(String(s)))}},map:(e,s)=>{switch(e.type){case"AsyncSuccess":return n.success(s(e.value));case"NotAsked":return n.notAsked;case"AsyncFailure":return n.failure(e.error);case"Loading":return n.loading(e.previousValue!=null?s(e.previousValue):void 0)}},flatMap:(e,s)=>{switch(e.type){case"AsyncSuccess":return s(e.value);case"NotAsked":return n.notAsked;case"AsyncFailure":return n.failure(e.error);case"Loading":return n.loading()}},mapError:(e,s)=>{switch(e.type){case"AsyncSuccess":return n.success(e.value);case"NotAsked":return n.notAsked;case"AsyncFailure":return n.failure(s(e.error));case"Loading":return n.loading(e.previousValue)}},flatMapError:(e,s)=>{switch(e.type){case"AsyncSuccess":return n.success(e.value);case"NotAsked":return n.notAsked;case"AsyncFailure":return s(e.error);case"Loading":return n.loading(e.previousValue)}},toResult:e=>{switch(e.type){case"AsyncSuccess":return{type:"Success",value:e.value};case"AsyncFailure":return{type:"Failure",error:e.error};case"NotAsked":case"Loading":return}},isSettled(e){return e.type==="AsyncSuccess"||e.type==="AsyncFailure"},recover:(e,s)=>{switch(e.type){case"AsyncSuccess":return n.success(e.value);case"NotAsked":return n.notAsked;case"AsyncFailure":return n.success(s(e.error));case"Loading":return n.loading(e.previousValue)}},ap:(e,s)=>n.isSuccess(e)&&n.isSuccess(s)?n.success(e.value(s.value)):n.isFailure(e)?n.failure(e.error):n.isFailure(s)?n.failure(s.error):n.isLoading(e)||n.isLoading(s)?n.loading():n.notAsked,map2:(e,s,t)=>n.isSuccess(e)&&n.isSuccess(s)?n.success(t(e.value,s.value)):n.isFailure(e)?n.failure(e.error):n.isFailure(s)?n.failure(s.error):n.isLoading(e)||n.isLoading(s)?n.loading():n.notAsked,map3:(e,s,t,a)=>n.isSuccess(e)&&n.isSuccess(s)&&n.isSuccess(t)?n.success(a(e.value,s.value,t.value)):n.isFailure(e)?n.failure(e.error):n.isFailure(s)?n.failure(s.error):n.isFailure(t)?n.failure(t.error):n.isLoading(e)||n.isLoading(s)||n.isLoading(t)?n.loading():n.notAsked},E=(e,s)=>e===s||e!==e&&s!==s,h={valid:{type:"valid"},invalid(e){return{type:"invalid",error:e}},isValid(e){return e.type==="valid"},isInvalid(e){return e.type==="invalid"},match:(e,s,t)=>h.isValid(e)?s():t(e.error),toResult:(e,s)=>h.match(e,()=>o.success(s),t=>o.failure(t)),effect:(e,s)=>(e.type==="valid"?s.valid?s.valid():s.else?.():s.invalid?s.invalid(e.error):s.else?.(),e),whenValid:(e,s)=>(h.isValid(e)&&s(),e),whenInvalid:(e,s)=>(h.isInvalid(e)&&s(e.error),e),mapError:(e,s)=>e.type==="invalid"?h.invalid(s(e.error)):e,flatMapError:(e,s)=>e.type==="invalid"?s(e.error):e,combine:(e,s,t)=>h.isValid(e)&&h.isValid(s)?h.valid:h.isInvalid(e)&&h.isInvalid(s)?h.invalid(t(e.error,s.error)):h.isInvalid(e)?e:s,all:e=>{for(const s of e)if(h.isInvalid(s))return s;return h.valid},allErrors:e=>{const s=[];for(const t of e)h.isInvalid(t)&&s.push(t.error);return s.length>0?h.invalid(s):h.valid},equals:(e,s,t=(a,i)=>a===i)=>e.type==="valid"&&s.type==="valid"?!0:e.type==="invalid"&&s.type==="invalid"?t(e.error,s.error):!1,recover:e=>h.valid,getError:e=>{if(h.isInvalid(e))return e.error},getErrorOrElse:(e,s)=>h.isInvalid(e)?e.error:s},o={success(e){return{type:"Success",value:e}},failure(e){return{type:"Failure",error:e}},map:(e,s)=>e.type==="Success"?o.success(s(e.value)):e,flatMap:(e,s)=>e.type==="Success"?s(e.value):e,toAsync(e){return o.match(e,s=>n.success(s),s=>n.failure(s))},toValidation(e){return o.match(e,()=>h.valid,s=>h.invalid(s))},isSuccess(e){return e.type==="Success"},isFailure(e){return e.type==="Failure"},getOrElse(e,s){return o.isSuccess(e)?e.value:s},getOrElseLazy(e,s){return o.isSuccess(e)?e.value:s()},getOrNull(e){return o.isSuccess(e)?e.value:null},getOrUndefined(e){return o.isSuccess(e)?e.value:void 0},getUnsafe:e=>{if(o.isSuccess(e))return e.value;throw e.error},match:(e,s,t)=>o.isSuccess(e)?s(e.value):t(e.error),effect:(e,s)=>(e.type==="Success"?s.success?s.success(e.value):s.else?.():s.failure?s.failure(e.error):s.else?.(),e),whenSuccess:(e,s)=>(o.isSuccess(e)&&s(e.value),e),whenFailure:(e,s)=>(o.isFailure(e)&&s(e.error),e),combine:(e,s,t,a)=>o.match(e,i=>o.match(s,l=>o.success(t(i,l)),l=>o.failure(l)),i=>o.match(s,l=>o.failure(i),l=>o.failure(a(i,l)))),equals:(e,s,t={valueEquals:(a,i)=>a===i,errorEquals:(a,i)=>a===i})=>e.type==="Success"&&s.type==="Success"?t.valueEquals(e.value,s.value):e.type==="Failure"&&s.type==="Failure"?t.errorEquals(e.error,s.error):!1,all:e=>{const s=[];for(const t of e)if(o.isSuccess(t))s.push(t.value);else return t;return o.success(s)},mapError:(e,s)=>e.type==="Failure"?o.failure(s(e.error)):e,flatMapError:(e,s)=>e.type==="Failure"?s(e.error):e,recover:(e,s)=>e.type==="Failure"?{type:"Success",value:s(e.error)}:e,ap:(e,s)=>o.isSuccess(e)&&o.isSuccess(s)?o.success(e.value(s.value)):o.isFailure(e)?o.failure(e.error):o.failure(s.error),map2:(e,s,t)=>o.isSuccess(e)&&o.isSuccess(s)?o.success(t(e.value,s.value)):o.isFailure(e)?o.failure(e.error):o.failure(s.error),map3:(e,s,t,a)=>o.isSuccess(e)&&o.isSuccess(s)&&o.isSuccess(t)?o.success(a(e.value,s.value,t.value)):o.isFailure(e)?o.failure(e.error):o.isFailure(s)?o.failure(s.error):o.failure(t.error),ofPromise:async e=>{try{const s=await e;return o.success(s)}catch(s){return o.failure(s instanceof Error?s:new Error(String(s)))}},swap:e=>o.isSuccess(e)?o.failure(e.value):o.success(e.error),fromNullable:(e,s)=>e==null?o.failure(s):o.success(e),fromNullableLazy:(e,s)=>e==null?o.failure(s()):o.success(e),tryCatch:e=>{try{return o.success(e())}catch(s){return o.failure(s instanceof Error?s:new Error(String(s)))}}};function Z({size:e="sm",icon:s="line-md:close",disabled:t,roundedness:a="full",color:i="base",onClick:l,label:u},...c){return r.Use(F.BeatUII18n,d=>{const m=r.coalesce(u,d.$.closeModal);return F.Button({variant:"text",size:e,roundedness:a,disabled:t,color:i,onClick:l},r.attr.title(m),r.aria.label(m),...c,F.Icon({icon:s,size:e??"sm"}))})}function T(e){return`bc-label bc-label--${e}`}const ee=(...e)=>r.html.span(r.attr.class(T("emphasis")),...e),q=(...e)=>r.html.span(r.attr.class(T("default")),...e),$=(...e)=>r.html.span(r.attr.class(T("muted")),...e),se=(...e)=>r.html.span(r.attr.class(T("danger")),...e),te=e=>{const{value:s,onBlur:t,onChange:a,placeholder:i,disabled:l,id:u,checkedIcon:c,uncheckedIcon:d,iconSize:m="lg"}=e,p=u??I("checkbox"),v=`${p}-label`,b=()=>{if(r.Value.get(l??!1))return;const f=r.Value.get(s);a?.(!f)},k=f=>{r.Value.get(l??!1)||(f.key===" "||f.key==="Enter")&&(f.preventDefault(),b())};return F.InputContainer({baseContainer:!0,growInput:!1,...e,input:r.html.span(r.attr.class("bc-checkbox-input"),r.html.span(r.attr.class("bc-checkbox-input__checkbox"),r.attr.class(r.Value.map(s,f=>f?"bc-checkbox-input__checkbox--checked":"bc-checkbox-input__checkbox--unchecked")),r.attr.class(r.Value.map(l??!1,f=>f?"bc-checkbox-input__checkbox--disabled":"")),r.attr.id(p),r.attr.role("checkbox"),r.attr.tabindex(r.Value.map(l??!1,f=>f?-1:0)),r.aria.checked(s),r.aria.disabled(l),i!=null?r.aria.labelledby(v):r.Empty,r.on.keydown(k),t!=null?r.on.blur(t):r.Empty,F.Icon({icon:r.computedOf(s,c,d)((f,y,S)=>f?y??"akar-icons/check-box-fill":S??"akar-icons/box"),accessibility:"decorative",size:m})),i!=null?r.html.label(r.attr.class("bc-checkbox-input__label"),r.attr.id(v),r.attr.for(p),$(i)):r.Empty)},r.on.click(b))},j=r.html.span(r.attr.class("bc-input-wrapper__required")," *");function re(e){const s=["bc-input-wrapper"];return e!=="vertical"&&s.push(`bc-input-wrapper--${e}`),s.join(" ")}function ae(e,s){const t=["bc-input-wrapper__label-text"];return e?t.push("bc-input-wrapper__label-text--error"):s?t.push("bc-input-wrapper__label-text--disabled"):t.push("bc-input-wrapper__label-text--default"),t.join(" ")}function ie(e,s){if(e==="horizontal-fixed"&&s!=null)return`--input-wrapper-label-width: ${s}`}const M=({fullWidth:e=!1,required:s,label:t,labelChildren:a,context:i,description:l,content:u,error:c,labelFor:d,hasError:m,disabled:p,layout:v,labelWidth:b},...k)=>{const f=m??c!=null,y=p??!1,S=v??"vertical",C=I("input-wrapper"),D=l?`${C}-description`:void 0,O=c!=null?`${C}-error`:void 0,B=r.computedOf(S)(g=>g!=="vertical"),Y=r.computedOf(S,b??void 0)((g,A)=>ie(g,A));return r.html.div(r.attr.class(r.Value.map(S,g=>re(g))),r.attr.class(r.Value.map(e,g=>g?"bc-input-wrapper--full-width":"")),r.attr.style(Y),t!=null||i!=null?r.html.div(r.attr.class("bc-input-wrapper__header"),r.html.div(r.attr.class("bc-input-wrapper__label-section"),r.html.label(r.attr.class("bc-input-wrapper__label"),d!=null?r.attr.for(d):r.Empty,r.html.span(r.attr.class(r.computedOf(f,y)((g,A)=>ae(g??!1,A??!1))),t),t!=null&&s?j:r.Empty),r.When(r.computedOf(B,l)((g,A)=>g&&A!=null),()=>r.html.div(r.attr.class("bc-input-wrapper__description bc-input-wrapper__description--under-label"),r.attr.id(D),l))),i!=null?q(i):r.Empty,a):r.Empty,r.html.div(r.attr.class("bc-input-wrapper__content"),[D,O].filter(Boolean).length>0?r.dataAttr.describedby([D,O].filter(Boolean).join(" ")):r.Empty,s?r.dataAttr.required("true"):r.Empty,r.When(f,()=>r.dataAttr.invalid("true")),u),r.When(r.computedOf(B,l)((g,A)=>!g&&A!=null),()=>r.html.div(r.attr.class("bc-input-wrapper__description"),r.attr.id(D),l)),r.When(f,()=>r.html.div(r.attr.class("bc-input-wrapper__error"),r.attr.id(O),r.aria.live("polite"),r.attr.role("alert"),c)),...k)};function ne(...e){return r.html.div(r.attr.class("bc-stack"),...e)}const H=((e,s)=>()=>{e.markTouched(),s?.()}),_=(e,s)=>t=>{e.change(t),s?.(t)};function N(e,s){const{controller:t,onBlur:a,onChange:i,id:l,triggerOn:u,...c}=s;return e({id:l??t.name,disabled:t.disabled,value:t.signal,hasError:t.errorVisible,name:t.name,...c,onInput:u==="input"?_(t,i):void 0,onChange:u!=="input"?_(t,i):void 0,onBlur:H(t,a)})}function le(e,{id:s,labelFor:t,...a},...i){const l=s??a.controller.name??I("control"),u=t??l;return M({...a,hasError:a.controller.errorVisible,error:r.TextNode(a.controller.error.map(c=>c??"")),labelFor:u,content:N(c=>e({...c,id:l}),a)},...i)}function z(e,s){const{toInput:t,fromInput:a,controller:i,...l}=s,u=i.transform(t,a);return N(e,{...l,controller:u})}function ce(e,{id:s,labelFor:t,...a},...i){const l=s??a.controller.name??I("control");return M({...a,labelFor:t??l,content:z(e,{...a,id:l})},...i)}function oe(e){return e.split(".").map(t=>{const a=t.match(/^\[(\d+)\]$/);return a?Number(a[1]):t})}function W(e){return typeof e=="number"?`[${e}]`:`.${e}`}function R(e){if(e.length===0)return"";const[s,...t]=e;return[typeof s=="number"?`[${s}]`:s,...t.map(W)].join("")}const ue={valid:h.valid,invalid(e){return h.invalid({message:e})},invalidFields(e){const s={};for(const[t,a]of Object.entries(e))s[t]=typeof a=="string"?{message:a}:a;return h.invalid({dependencies:s})},fromError(e){return h.invalid(e)}};function V(e){return function(t){if(t.type==="valid")return t;let a=t.error;for(const i of e)if(a=a?.dependencies?.[i],a==null)return h.valid;return h.invalid(a)}}class w{path;change;signal;status;error;hasError;touched;errorVisible;dirty;dependencyErrors;#e={disabled:r.prop(!1),touched:r.prop(!1)};#t;#s=r.prop(void 0);parent;disabled;#r=[];disabledOrHasErrors;constructor(s,t,a,i,l,u=E){this.path=s,this.change=t,this.signal=a,this.status=i,this.#t=u,this.#s.set(a.value),this.error=i.map(c=>c?.type==="invalid"?c.error?.message:void 0),this.hasError=this.error.map(c=>c!=null),this.touched=this.#e.touched,l.validationMode?this.errorVisible=r.computedOf(this.hasError,this.touched,l.validationMode)((c,d,m)=>m==="eager"?!!c:!!c&&!!d):this.errorVisible=r.computedOf(this.hasError,this.touched)((c,d)=>!!c&&!!d),this.dirty=r.computedOf(this.signal,this.#s)((c,d)=>!this.#t(c,d)),this.dependencyErrors=i.map(c=>c?.type==="invalid"?c.error?.dependencies:void 0),this.parent=l,this.disabled=r.computedOf(this.#e.disabled,l.disabled)((c,d)=>c||d),this.disabledOrHasErrors=r.computedOf(this.disabled,this.hasError)((c,d)=>c||d),this.onDispose(()=>{this.#e.disabled.dispose(),this.#e.touched.dispose(),this.disabled.dispose(),this.error.dispose(),this.errorVisible.dispose(),this.dirty.dispose(),this.#s.dispose(),this.dependencyErrors.dispose(),this.disabledOrHasErrors.dispose()})}get name(){return R(this.path)}onDispose=s=>{this.#r.push(s)};dispose=()=>{for(const s of this.#r)try{s()}catch(t){console.error("Error in dispose callback:",t)}this.#r.length=0};setDisabled=s=>{this.#e.disabled.set(s)};disable=()=>this.setDisabled(!0);enable=()=>this.setDisabled(!1);markTouched=()=>{this.#e.touched.set(!0)};resetTouched=()=>{this.#e.touched.set(!1)};markPristine=()=>{this.#s.set(this.signal.value)};reset=()=>{this.change(this.#s.value)};array=(s=E)=>new K(this.path,this.change,this.signal,this.status,this.parent,s);object=(s=E)=>new U(this.path,this.change,this.signal,this.status,this.parent,s);transform=(s,t,a=[],i=E)=>new w([...this.path,...a],l=>this.change(t(l)),this.signal.map(s,i),this.status.map(V(a)),this.parent,i);asyncTransform=(s,t,a,i=[],l=E)=>new w([...this.path,...i],u=>{t(u).then(c=>this.change(c))},this.signal.mapAsync(s,a,void 0,l),this.status.map(V(i)),this.parent,l)}class U extends w{#e=new Map;#t=new Map;#s=new Map;#r=r.prop(!1);touchedDeep=this.#r;#i=new Map;#a=new Map;#l=r.prop(!1);dirtyDeep=this.#l;#o;#u;#c=()=>{let s=!1;for(const t of this.#t.values())if(t){s=!0;break}this.#r.set(this.touched.value||s)};constructor(s,t,a,i,l,u){super(s,t,a.map(d=>d??{},u),i,l,u),this.#o=this.touched.on(()=>{this.#c()}),this.#u=this.dirty.on(()=>{this.#n()});const c=this.signal.on(()=>this.#n());this.onDispose(()=>{for(const d of this.#e.values())d.dispose();this.#e.clear();for(const d of this.#s.values())d();this.#s.clear(),this.#t.clear(),this.#r.dispose();for(const d of this.#a.values())d();this.#a.clear(),this.#i.clear(),this.#l.dispose(),this.#o(),this.#u(),c()})}field=s=>{if(this.#e.has(s))return this.#e.get(s);const t=async u=>{this.change({...this.signal.value,[s]:u})},a=new w([...this.path,s],t,this.signal.map(u=>u[s]),this.status.map(V([s])),{disabled:this.disabled,validationMode:this.parent.validationMode});this.#e.set(s,a);const i=a.touched.on(u=>{this.#t.set(s,u),this.#c()});this.#s.set(s,i);const l=a.dirty.on(u=>{this.#i.set(s,u),this.#n()});return this.#a.set(s,l),a};markAllTouched=()=>{this.markTouched();const s=this.signal.value;for(const t of Object.keys(s))this.field(t).markTouched();for(const t of this.#e.values())t.markTouched()};markAllPristine=()=>{this.markPristine();const s=this.signal.value;for(const t of Object.keys(s))this.field(t).markPristine?.();for(const t of this.#e.values())t.markPristine?.()};#n=()=>{let s=!1;for(const t of this.#i.values())if(t){s=!0;break}this.#l.set(this.dirty.value||s)}}class K extends w{#e=new Array;length;#t=new Map;#s=new Map;#r=r.prop(!1);touchedDeep=this.#r;#i=new Map;#a=new Map;#l=r.prop(!1);dirtyDeep=this.#l;#o;#u;#c=()=>{let s=!1;for(const t of this.#t.values())if(t){s=!0;break}this.#r.set(this.touched.value||s)};constructor(s,t,a,i,l,u){const c=a.map(p=>p??[],u);super(s,t,c,i,l,u);const d=c.on(p=>{const v=this.#e.length-p.length;v>0&&(this.#e.splice(p.length,v).forEach((b,k)=>{const f=p.length+k;b.dispose(),this.#s.get(f)?.(),this.#s.delete(f),this.#t.delete(f),this.#a.get(f)?.(),this.#a.delete(f),this.#i.delete(f)}),this.#c(),this.#n())});this.length=c.map(p=>p.length),this.#o=this.touched.on(()=>{this.#c()}),this.#u=this.dirty.on(()=>{this.#n()});const m=this.signal.on(()=>this.#n());this.onDispose(()=>{for(const p of this.#e)p.dispose();this.length.dispose(),this.#e.length=0,d(),c.dispose();for(const p of this.#s.values())p();this.#s.clear(),this.#t.clear(),this.#r.dispose();for(const p of this.#a.values())p();this.#a.clear(),this.#i.clear(),this.#l.dispose(),this.#o(),this.#u(),m()})}item=s=>{if(this.#e[s])return this.#e[s];const t=async u=>{const c=this.signal.value.slice();c[s]=u,this.change(c)},a=new w([...this.path,s],t,this.signal.map(u=>u[s]),this.status.map(V([s])),{disabled:this.disabled,validationMode:this.parent.validationMode});this.#e[s]=a;const i=a.touched.on(u=>{this.#t.set(s,u),this.#c()});this.#s.set(s,i);const l=a.dirty.on(u=>{this.#i.set(s,u),this.#n()});return this.#a.set(s,l),a};push=(...s)=>{this.change([...this.signal.value,...s])};pop=()=>{this.splice(this.signal.value.length-1,1)};shift=()=>{this.splice(0,1)};unshift=(...s)=>{this.change([...s,...this.signal.value])};removeAt=s=>{this.splice(s,1)};splice=(s,t)=>{const a=this.signal.value.slice();a.splice(s,t),this.change(a)};move=(s,t,a=1)=>{if(a<1||s===t)return;const i=this.signal.value.slice(),l=i.splice(s,a);i.splice(t,0,...l),this.change(i)};markAllTouched=()=>{this.markTouched();const s=this.signal.value.length;for(let t=0;t<s;t++)this.item(t).markTouched()};markAllPristine=()=>{this.markPristine();const s=this.signal.value.length;for(let t=0;t<s;t++)this.item(t).markPristine?.()};#n=()=>{let s=!1;for(const t of this.#i.values())if(t){s=!0;break}this.#l.set(this.dirty.value||s)}}function G(e){function s(t){return typeof t=="number"?t:t.toString()}return e.map(t=>typeof t=="object"&&t.key!=null?s(t.key):s(t))}function J(e){const s=e.filter(i=>i.path==null||i.path.length===0).map(i=>i.message),t=e.filter(i=>i.path!=null&&i.path.length>0).reduce((i,l)=>{const u=G(l.path),c=u.pop();let d=i;for(const m of u)d.dependencies==null&&(d.dependencies={}),d.dependencies[m]==null&&(d.dependencies[m]={}),d=d.dependencies[m];return d.dependencies==null&&(d.dependencies={}),d.dependencies[c]={message:l.message},i},{}),a=s.join(`
|
|
2
|
+
`);return{...t,message:a!=""?a:void 0}}function Q({initialValue:e,onChange:s,validate:t,equals:a,validationMode:i,validateDebounceMs:l}){const u=r.Value.deriveProp(e),c=r.prop(h.valid),d=r.prop(!1),m=r.prop(i??"onTouched"),p=y=>{c.set(y)};let v;const b=async y=>{if(t!=null){const S=await t(y);p(S)}},k=async y=>{u.set(y),s?.(y);const S=m.value;if(t!=null){if(S==="onSubmit")return;const C=l??0;C>0?(v&&clearTimeout(v),v=setTimeout(()=>{b(y)},C)):await b(y)}},f=new w([],k,u,c,{disabled:d,validationMode:m},a??E);return f.onDispose(()=>{d.dispose(),u.dispose(),c.dispose(),m.dispose(),v&&clearTimeout(v)}),{controller:f,setStatus:p}}function x(e){return r.Fragment(r.attr.disabled(e.disabled),r.attr.name(e.name))}function de(e,{triggerOn:s="change"}={}){return r.Fragment(x(e),r.attr.value(e.signal),(s==="input"?r.on.input:r.on.change)(r.emitValue(e.change)))}function he(e,{triggerOn:s="change"}={}){return r.Fragment(x(e),r.attr.valueAsNumber(e.signal),(s==="input"?r.on.input:r.on.change)(r.emitValueAsNumber(e.change)))}function L(e){return e.issues!=null?h.invalid(J(e.issues)):h.valid}async function pe({task:e,errorMessage:s,errorPath:t=["root"],validation:a}){try{const i=await e();return a!=null?a(i):h.valid}catch(i){const l=s??(i instanceof Error?i.message:"Operation failed");return t.length===1&&t[0]==="root"?h.invalid({message:l}):h.invalid({dependencies:X(t,l)})}}function X(e,s){if(e.length===1)return{[e[0]]:{message:s}};const[t,...a]=e;return{[t]:{dependencies:X(a,s)}}}function fe({initialValue:e={},schema:s,onSubmit:t=async()=>h.valid,validationMode:a,validateDebounceMs:i}){const{controller:l,setStatus:u}=Q({initialValue:e,validationMode:a??"onTouched",validateDebounceMs:i,validate:(a??"onTouched")==="onSubmit"||s==null?void 0:async p=>L(await s["~standard"].validate(p))}),c=r.prop(!1),d=l.object();return d.onDispose(c.dispose),{controller:d,setStatus:u,submit:async p=>{if(c.set(!0),p?.preventDefault(),d.markAllTouched(),s!=null){const b=d.signal.value,k=L(await s["~standard"].validate(b));if(u(k),k.type==="invalid"){c.set(!1);return}}const v=await t(d.signal.value);c.set(!1),v.type==="invalid"&&u(v)},submitting:c}}exports.ArrayController=K;exports.BaseControl=N;exports.BaseMappedControl=z;exports.CheckboxInput=te;exports.CloseButton=Z;exports.Control=le;exports.Controller=w;exports.ControllerValidation=ue;exports.DangerLabel=se;exports.EmphasisLabel=ee;exports.InputWrapper=M;exports.Label=q;exports.MappedControl=ce;exports.MutedLabel=$;exports.O=E;exports.ObjectController=U;exports.RequiredSymbol=j;exports.Stack=ne;exports.connectCommonAttributes=x;exports.connectNumberInput=he;exports.connectStringInput=de;exports.convertStandardSchemaIssues=J;exports.convertStandardSchemaPathToPath=G;exports.i=h;exports.makeMapValidation=V;exports.makeOnBlurHandler=H;exports.makeOnChangeHandler=_;exports.parsePath=oe;exports.pathToString=R;exports.sessionId=I;exports.standardSchemaResultToValidation=L;exports.taskToValidation=pe;exports.useController=Q;exports.useForm=fe;exports.wrapSegment=W;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("./translations-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("./translations-eUtMHN9s.cjs"),h={loadingExtended:"Đang tải, vui lòng đợi",loadingShort:"Đang tải...",locale:"Ngôn ngữ",iconDescription:"Biểu tượng",loadingIcon:"Biểu tượng tải",failedToLoadIcon:"Không thể tải biểu tượng",editLabel:"Chỉnh sửa",selectOne:"Chọn một",selectMany:"Chọn nhiều",noResults:"Không có kết quả",passwordPlaceholderText:"Mật khẩu bí mật",togglePasswordVisibility:"Chuyển đổi hiển thị mật khẩu",toggleMenu:"Chuyển đổi menu",toggleAside:"Chuyển đổi bảng bên",mainNavigation:"Điều hướng chính",sidebar:"Thanh bên",closeDrawer:"Đóng ngăn kéo",closeModal:"Đóng modal",confirm:"Xác nhận",cancel:"Hủy",addLabel:"Thêm",removeItem:"Xóa mục",currentLocale:"Tiếng Việt",ar:"Tiếng Ả Rập",de:"Tiếng Đức",en:"Tiếng Anh",es:"Tiếng Tây Ban Nha",fr:"Tiếng Pháp",hi:"Tiếng Hindi",it:"Tiếng Ý",ja:"Tiếng Nhật",ko:"Tiếng Hàn",nl:"Tiếng Hà Lan",pl:"Tiếng Ba Lan",pt:"Tiếng Bồ Đào Nha",ru:"Tiếng Nga",tr:"Tiếng Thổ Nhĩ Kỳ",vi:"Tiếng Việt",zh:"Tiếng Trung",he:"Tiếng Do Thái",fa:"Tiếng Ba Tư",ur:"Tiếng Urdu",emailPlaceholderText:"Nhập email của bạn",incrementValue:"Tăng giá trị",decrementValue:"Giảm giá trị",dropZoneInstructions:n=>n?"Nhấp để chọn hoặc kéo tệp vào đây, hoặc nhấn Enter hoặc Space để mở trình chọn tệp":"Kéo tệp vào đây",fileSizeUnits:["Byte","KB","MB","GB","TB"],removeFile:"Xóa tệp",clearAllFiles:"Xóa tất cả tệp",clearValue:"Xóa giá trị",unknownType:"Loại không xác định",filesInputInstructions:(n,i,e)=>{let o=n==null||n>1?"Nhấp để chọn hoặc kéo tệp vào đây":"Nhấp để chọn hoặc kéo một tệp vào đây";if(n||i){const t=[];if(n!=null&&n>1&&t.push(`tối đa ${n} tệp`),i&&e){const a=l.formatFileSize(i,{units:e});t.push(`mỗi tệp tối đa ${a}`)}t.length>0&&(o+=` (${t.join(", ")})`)}return o},prosemirror:{bold:"Bold",italic:"Italic",code:"Code",link:"Link",removeLink:"Remove Link",heading:n=>`Heading ${n}`,bulletList:"Bullet List",orderedList:"Ordered List",blockquote:"Blockquote",codeBlock:"Code Block",horizontalRule:"Horizontal Rule",linkUrlPlaceholder:"https://example.com"},pdfPageViewer:{loading:"Đang tải PDF...",loadFailed:"Không thể tải PDF",invalidPdf:"Tệp PDF không hợp lệ",pageOutOfRange:(n,i)=>`Trang ${n} nằm ngoài phạm vi (1-${i})`,renderFailed:"Không thể hiển thị trang PDF"}};exports.default=h;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const e=require("@tempots/dom"),k=require("./deep-merge-DBUbjJYt.cjs"),$=require("./translations-hMQlZmD4.cjs"),X=require("@tempots/ui"),q=require("./notice-BGaJ4k0O.cjs"),pt=require("./use-form-B4D58mxd.cjs");function P(t){if(typeof t!="string")return!1;const n=t.startsWith("#")?t.slice(1):t;return/^[0-9A-Fa-f]{3}$|^[0-9A-Fa-f]{6}$/.test(n)}function z(t){if(typeof t!="string")return!1;const n=/^rgb\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*\)$/i,a=t.match(n);if(!a)return!1;const[,r,o,s]=a,l=parseInt(r,10),c=parseInt(o,10),i=parseInt(s,10);return l>=0&&l<=255&&c>=0&&c<=255&&i>=0&&i<=255}function Y(t){if(typeof t!="string")return!1;const n=/^rgba\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(0|1|0?\.\d+)\s*\)$/i,a=t.match(n);if(!a)return!1;const[,r,o,s,l]=a,c=parseInt(r,10),i=parseInt(o,10),u=parseInt(s,10),p=parseFloat(l);return c>=0&&c<=255&&i>=0&&i<=255&&u>=0&&u<=255&&p>=0&&p<=1}function G(t){if(typeof t!="string")return!1;const n=/^hsl\(\s*(\d{1,3})\s*,\s*(\d{1,3})%\s*,\s*(\d{1,3})%\s*\)$/i,a=t.match(n);if(!a)return!1;const[,r,o,s]=a,l=parseInt(r,10),c=parseInt(o,10),i=parseInt(s,10);return l>=0&&l<=360&&c>=0&&c<=100&&i>=0&&i<=100}function gt(t){return P(t)||z(t)||Y(t)||G(t)}function K(t){if(!P(t))return null;let n=t.startsWith("#")?t.slice(1):t;return n.length===3&&(n=n.split("").map(a=>a+a).join("")),`#${n.toLowerCase()}`}function B(t,n,a){const r=o=>{const s=Math.round(Math.max(0,Math.min(255,o))).toString(16);return s.length===1?"0"+s:s};return`#${r(t)}${r(n)}${r(a)}`}function R(t){const n=K(t);if(!n)return null;const a=/^#([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(n);return a?{r:parseInt(a[1],16),g:parseInt(a[2],16),b:parseInt(a[3],16)}:null}function mt(t,n){const a=R(t),r=R(n);if(!a||!r)return null;const o=(u,p,d)=>{const[f,g,y]=[u,p,d].map(w=>(w=w/255,w<=.03928?w/12.92:Math.pow((w+.055)/1.055,2.4)));return .2126*f+.7152*g+.0722*y},s=o(a.r,a.g,a.b),l=o(r.r,r.g,r.b),c=Math.max(s,l),i=Math.min(s,l);return(c+.05)/(i+.05)}function Q(t){if(!t)return[0,0,0,1];const a=t.trim().match(/^#?([a-fA-F0-9]{3,4}|[a-fA-F0-9]{6}|[a-fA-F0-9]{8})$/);if(a){const u=a[1];if(u.length===8){const p=parseInt(u.slice(0,2),16),d=parseInt(u.slice(2,4),16),f=parseInt(u.slice(4,6),16),g=parseInt(u.slice(6,8),16)/255;return[p,d,f,g]}if(u.length===6)return[parseInt(u.slice(0,2),16),parseInt(u.slice(2,4),16),parseInt(u.slice(4,6),16),1];if(u.length===4){const p=parseInt(u[0]+u[0],16),d=parseInt(u[1]+u[1],16),f=parseInt(u[2]+u[2],16),g=parseInt(u[3]+u[3],16)/255;return[p,d,f,g]}if(u.length===3){const p=parseInt(u[0]+u[0],16),d=parseInt(u[1]+u[1],16),f=parseInt(u[2]+u[2],16);return[p,d,f,1]}}const r=t.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(r)return[parseInt(r[1],10),parseInt(r[2],10),parseInt(r[3],10),parseFloat(r[4])];const o=t.match(/^rgb\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*\)$/i);if(o)return[parseInt(o[1],10),parseInt(o[2],10),parseInt(o[3],10),1];const s=t.match(/^hsla?\(\s*([+-]?[\d.]+)(?:deg)?\s*[ ,]?\s*([\d.]+)%\s*[ ,]?\s*([\d.]+)%\s*(?:[/,]\s*(\d?(?:\.\d+)?))?\s*\)$/i);if(s){const u=parseFloat(s[1]),p=parseFloat(s[2]),d=parseFloat(s[3]),f=s[4]!=null?parseFloat(s[4]):1,[g,y,w]=j(u,p/100,d/100);return[g,y,w,f]}const l=t.match(/^hwb\(\s*([+-]?[\d.]+)(?:deg)?\s*[, ]\s*([\d.]+)%\s*[, ]\s*([\d.]+)%\s*(?:[/]\s*(\d?(?:\.\d+)?))?\s*\)$/i);if(l){const u=parseFloat(l[1]),p=parseFloat(l[2])/100,d=parseFloat(l[3])/100,f=l[4]!=null?parseFloat(l[4]):1,[g,y,w]=tt(u,p,d);return[g,y,w,f]}const c=t.match(/^oklch\(\s*([+-]?[\d.]+%?)\s+([\d.]+)\s+([+-]?[\d.]+)(?:deg)?(?:\s*\/\s*(\d?(?:\.\d+)?))?\s*\)$/i);if(c){const u=c[1],p=parseFloat(c[2]),d=parseFloat(c[3]),f=c[4]!=null?parseFloat(c[4]):1,g=u.endsWith("%")?Math.max(0,Math.min(1,parseFloat(u)/100)):Math.max(0,Math.min(1,parseFloat(u))),[y,w,b]=nt(g,p,d);return[y,w,b,f]}const i=R(t);return i?[i.r,i.g,i.b,1]:[0,0,0,1]}function Z(t,n,a,r){return`rgba(${Math.round(t)}, ${Math.round(n)}, ${Math.round(a)}, ${Math.max(0,Math.min(1,Math.round(r*100)/100))})`}function J(t){let n=t+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 j(t,n,a){t=(t%360+360)%360;const r=(1-Math.abs(2*a-1))*n,o=r*(1-Math.abs(t/60%2-1)),s=a-r/2;let l=0,c=0,i=0;return 0<=t&&t<60?[l,c,i]=[r,o,0]:60<=t&&t<120?[l,c,i]=[o,r,0]:120<=t&&t<180?[l,c,i]=[0,r,o]:180<=t&&t<240?[l,c,i]=[0,o,r]:240<=t&&t<300?[l,c,i]=[o,0,r]:[l,c,i]=[r,0,o],[Math.round((l+s)*255),Math.round((c+s)*255),Math.round((i+s)*255)]}function tt(t,n,a){t=(t%360+360)%360;const r=n+a;r>1&&(n/=r,a/=r);const[o,s,l]=j(t,1,.5).map(d=>d/255),c=1-n-a,i=o*c+n,u=s*c+n,p=l*c+n;return[Math.round(i*255),Math.round(u*255),Math.round(p*255)]}function L(t,n,a){t/=255,n/=255,a/=255;const r=Math.max(t,n,a),o=Math.min(t,n,a);let s=0,l=0;const c=(r+o)/2,i=r-o;if(i!==0){switch(l=c>.5?i/(2-r-o):i/(r+o),r){case t:s=(n-a)/i+(n<a?6:0);break;case n:s=(a-t)/i+2;break;default:s=(t-n)/i+4}s*=60}return[Math.round(s),Math.round(l*100),Math.round(c*100)]}function et(t,n,a){const[r]=L(t,n,a),o=t/255,s=n/255,l=a/255,c=Math.min(o,s,l),i=1-Math.max(o,s,l);return[r,Math.round(c*100),Math.round(i*100)]}function D(t){const n=t/255;return n<=.04045?n/12.92:Math.pow((n+.055)/1.055,2.4)}function O(t){const n=t<=.0031308?12.92*t:1.055*Math.pow(t,.4166666666666667)-.055;return Math.round(Math.max(0,Math.min(1,n))*255)}function nt(t,n,a){const r=a*Math.PI/180,o=Math.cos(r)*n,s=Math.sin(r)*n,l=t+.3963377774*o+.2158037573*s,c=t-.1055613458*o-.0638541728*s,i=t-.0894841775*o-1.291485548*s,u=l*l*l,p=c*c*c,d=i*i*i,f=4.0767416621*u-3.3077115913*p+.2309699292*d,g=-1.2684380046*u+2.6097574011*p-.3413193965*d,y=-.0041960863*u-.7034186147*p+1.707614701*d;return[O(f),O(g),O(y)]}function rt(t,n,a){const r=D(t),o=D(n),s=D(a),l=.4122214708*r+.5363325363*o+.0514459929*s,c=.2119034982*r+.6806995451*o+.1073969566*s,i=.0883024619*r+.2817188376*o+.6299787005*s,u=Math.cbrt(l),p=Math.cbrt(c),d=Math.cbrt(i),f=.2104542553*u+.793617785*p-.0040720468*d,g=1.9779984951*u-2.428592205*p+.4505937099*d,y=.0259040371*u+.7827717662*p-.808675766*d,w=Math.sqrt(g*g+y*y);let b=Math.atan2(y,g)*180/Math.PI;return b<0&&(b+=360),[f,w,b]}function N(t,n,a,r,o,s){switch(o){case"hex":if(s){const l=i=>i.toString(16).padStart(2,"0"),c=Math.max(0,Math.min(255,Math.round(r*255)));return`#${l(t)}${l(n)}${l(a)}${l(c)}`}return B(t,n,a);case"rgb":return`rgb(${t}, ${n}, ${a})`;case"rgba":return`rgba(${t}, ${n}, ${a}, ${Math.round(r*100)/100})`;case"hsl":{const[l,c,i]=L(t,n,a);return`hsl(${l}, ${c}%, ${i}%)`}case"hsla":{const[l,c,i]=L(t,n,a);return`hsla(${l}, ${c}%, ${i}%, ${Math.round(r*100)/100})`}case"hwb":{const[l,c,i]=et(t,n,a);return r<1?`hwb(${l} ${c}% ${i}% / ${Math.round(r*100)/100})`:`hwb(${l} ${c}% ${i}%)`}case"oklch":{const[l,c,i]=rt(t,n,a),u=(Math.round(l*1e3)/1e3).toFixed(3),p=(Math.round(c*1e3)/1e3).toFixed(3),d=(Math.round(i*10)/10).toFixed(1),f=Math.round(r*100)/100;return s||r<1?`oklch(${u} ${p} ${d} / ${f})`:`oklch(${u} ${p} ${d})`}}}function S(t,n){return n?t==="rgb"?"rgba":t==="hsl"?"hsla":t:t==="rgba"?"rgb":t==="hsla"?"hsl":t}async function at(t){return new Promise((n,a)=>{const r=new FileReader;r.readAsDataURL(t),r.onload=()=>{const o=r.result;n(o.split(",")[1])},r.onerror=o=>a(o)})}function dt(t){return Promise.all(t.map(at))}function ht(t){if(t.length>=4){if(t[0]===137&&t[1]===80&&t[2]===78&&t[3]===71)return"image/png";if(t[0]===255&&t[1]===216)return"image/jpeg";if(t[0]===71&&t[1]===73&&t[2]===70)return"image/gif";if(t[0]===82&&t[1]===73&&t[2]===70&&t[3]===70&&t.length>=12&&t[8]===87&&t[9]===69&&t[10]===66&&t[11]===80)return"image/webp"}try{if(new TextDecoder("utf-8").decode(t.slice(0,256)).includes("<svg"))return"image/svg+xml"}catch{}return"application/octet-stream"}function ft(t){const n=k.$t(t??""),a=n.length,r=new Uint8Array(a);for(let o=0;o<a;o++)r[o]=n.charCodeAt(o);return r}function st(t){const{value:n,onChange:a,onInput:r,...o}=t,s=new Map,l=e.Value.toSignal(n).map(p=>p.map((d,f)=>{const g=s.get(d),y=ft(d??""),w=g?.type||ht(y),b=g?.name??`file-${f}`,x=y.buffer.slice(y.byteOffset,y.byteOffset+y.byteLength),h=new Blob([x],{type:w});return new File([h],b,{type:w})})),c=p=>d=>{p&&dt(d).then(f=>{for(const[g,y]of f.entries())s.set(y,{name:d[g].name,type:d[g].type});p(f)})},i=c(a),u=c(r);return k.FilesInput({...o,value:l,onChange:i,onInput:u})}function bt(t){const{value:n,onInput:a,onChange:r,...o}=t;return st({...o,maxFiles:1,value:e.Value.map(n,s=>s==null?[]:[s]),onChange:s=>{r?.(s[0])},onInput:s=>{a?.(s[0])}})}function yt(t,n){const[a,r,o]=t,s=a<<16^r<<8^o,l=J(s),c=6+Math.floor(l()*5),i=.18+l()*.06,u=[];for(let g=0;g<c;g++){const y=g/c*Math.PI*2,w=n*(1+(l()*2-1)*i),b=Math.cos(y)*w,x=Math.sin(y)*w;u.push({x:b,y:x})}const p=(u[0].x+u[c-1].x)/2,d=(u[0].y+u[c-1].y)/2;let f=`M ${p.toFixed(3)} ${d.toFixed(3)}`;for(let g=0;g<c;g++){const y=u[g],w=u[(g+1)%c],b=(y.x+w.x)/2,x=(y.y+w.y)/2;f+=` Q ${y.x.toFixed(3)} ${y.y.toFixed(3)} ${b.toFixed(3)} ${x.toFixed(3)}`}return f+=" Z",f}const wt=t=>{const{value:n,onBlur:a,onChange:r,onInput:o,displayValue:s,size:l,withAlpha:c}=t,i=e.Value.map(l??32,m=>m),u=e.Value.map(n,m=>Q(m??"#000000")),p=e.Value.map(u,([m,I,V])=>[m,I,V]),d=e.Value.map(u,([,,,m])=>m),f=e.prop(e.Value.get(d)??1),g=e.Value.map(c??!1,m=>m),y=e.Value.map(t.colorTextFormat??"rgb",m=>m),w=e.computedOf(p,f,y,g)(([m,I,V],_,A,F)=>N(m,I,V,_??1,S(A,F),F)),b=e.Value.map(t.colorTextFormat??"hex",m=>m),x=e.Value.map(i,m=>`${-m/2} ${-m/2} ${m} ${m}`),h=e.computedOf(p,i)((m,I)=>yt(m,I/2)),T=e.computedOf(p,f,g)(([m,I,V],_,A)=>A||_<1?Z(m,I,V,_):B(m,I,V)),C=e.html.div(e.attr.class("bc-color-swatch-input__control"),e.attr.class(e.Value.map(g,m=>m?"bc-color-swatch-input__control--alpha":"")),e.attr.style(e.computedOf(i)(m=>`min-width:${m+2}px;height:${m+2}px`)),e.svg.svg(e.attr.class("bc-color-swatch-input__svg"),e.svgAttr.viewBox(x),e.svg.path(e.svgAttr.d(h),e.svgAttr.fill(T))),e.html.input(e.attr.type("color"),$.CommonInputAttributes(t),e.attr.value(e.Value.map(p,([m,I,V])=>B(m,I,V))),e.attr.class("bc-input bc-color-swatch-input bc-color-swatch-input__native"),a!=null?e.on.blur(a):e.Empty,r!=null?e.on.change(m=>{const I=m.target.value;if(!r)return;const{r:V,g:_,b:A}=R(I)??{r:0,g:0,b:0},F=e.Value.get(f)??1,v=S(e.Value.get(b),e.Value.get(g)),U=N(V,_,A,F,v,e.Value.get(g));r(U)}):e.Empty,o!=null?e.on.input(m=>{const I=m.target.value;if(!o)return;const{r:V,g:_,b:A}=R(I)??{r:0,g:0,b:0},F=e.Value.get(f)??1,v=S(e.Value.get(b),e.Value.get(g)),U=N(V,_,A,F,v,e.Value.get(g));o(U)}):e.Empty)),M=e.When(g,()=>e.html.input(e.attr.type("range"),e.attr.class("bc-color-swatch-input__alpha"),e.attr.min(0),e.attr.max(1),e.attr.step(.01),e.attr.value(e.Value.map(f,m=>String(m??1))),e.attr.disabled(t.disabled),e.on.input(m=>{const I=parseFloat(m.target.value);f.set(I);const[V,_,A]=e.Value.get(p),F=S(e.Value.get(b),e.Value.get(g)),v=N(V,_,A,I,F,e.Value.get(g));o?.(v)}),e.on.change(m=>{const I=parseFloat(m.target.value);f.set(I);const[V,_,A]=e.Value.get(p),F=S(e.Value.get(b),e.Value.get(g)),v=N(V,_,A,I,F,e.Value.get(g));r?.(v)})));return $.InputContainer({baseContainer:!0,...t,growInput:!1,input:C,after:e.Fragment(e.When(s??!1,()=>e.html.span(e.attr.class("bc-color-swatch-input__rgb"),w)),M,t.after)})};function It(t,n,a){const r=["bc-card"];return t!=="default"&&r.push(`bc-card--${t}`),n!=="md"&&r.push(`bc-card--padding-${n}`),a!=="lg"&&r.push(`bc-card--rounded-${a}`),r.join(" ")}function xt({variant:t="default",size:n="md",roundedness:a="lg"}={},...r){return e.html.div(e.attr.class(e.computedOf(t,n,a)((o,s,l)=>It(o??"default",s??"md",l??"lg"))),...r)}const $t=({startEditing:t,value:n,onChange:a,placeholder:r,disabled:o})=>{const s=e.Value.deriveProp(t??!1),l=e.prop(!1),c=e.Value.map(o??!1,i=>i);return e.html.div(e.attr.class("bc-editable-text"),e.attr.class(e.Value.map(c,i=>i?"bc-editable-text--disabled":"")),e.aria.disabled(c),e.When(s,()=>e.html.input(e.attr.placeholder(r),e.attr.value(n),e.attr.class("bc-editable-text__input"),X.AutoSelect(),e.on.keydown(i=>{i.key==="Enter"?s.set(!1):i.key==="Escape"&&(l.set(!0),s.set(!1))}),e.on.blur(e.emitValue(i=>{if(s.set(!1),l.value){l.set(!1);return}a(i)}))),()=>e.html.span(e.on.click(()=>{e.Value.get(c)||s.set(!0)}),e.attr.class("bc-editable-text__display"),e.When(e.Value.map(n,i=>i!=null&&i.trim()!==""),()=>e.html.span(e.attr.class("bc-editable-text__text"),n),()=>e.html.span(e.attr.class("bc-editable-text__placeholder"),r)),e.When(e.Value.map(c,i=>!i),()=>e.html.button(e.attr.type("button"),e.attr.class("bc-editable-text__edit-button"),e.Use($.BeatUII18n,i=>e.aria.label(i.$.editLabel)),e.on.click(()=>s.set(!0)),$.Icon({icon:"line-md/pencil",color:"neutral"}))))))},Mt=t=>{const{value:n,onBlur:a,onChange:r,onInput:o,after:s,disabled:l}=t,c=k.NullableResetAfter(n,l,r??o);return $.InputContainer({...t,input:e.input.date($.CommonInputAttributes(t),e.attr.valueAsDate(n),e.attr.class("bc-input"),a!=null?e.on.blur(e.emitValue(a)):e.Empty,r!=null?e.on.change(e.emitValueAsNullableDate(r)):e.Empty,o!=null?e.on.input(e.emitValueAsNullableDate(o)):e.Empty),after:s!=null?e.Fragment(c,s):c})},Vt=t=>{const n=t.getFullYear(),a=t.getMonth()+1,r=t.getDate(),o=t.getHours(),s=t.getMinutes(),l=t.getSeconds();return`${n}-${a.toString().padStart(2,"0")}-${r.toString().padStart(2,"0")}T${o.toString().padStart(2,"0")}:${s.toString().padStart(2,"0")}:${l.toString().padStart(2,"0")}`},Ct=t=>{const{value:n,onBlur:a,onChange:r,onInput:o,after:s,disabled:l}=t,c=e.Value.map(n,u=>u!=null?Vt(u):null),i=k.NullableResetAfter(n,l,r??o);return $.InputContainer({...t,input:e.input["datetime-local"]($.CommonInputAttributes(t),e.attr.value(e.Value.map(c,u=>u??null)),e.attr.class("bc-input"),a!=null?e.on.blur(e.emitValue(a)):e.Empty,r!=null?e.on.change(e.emitValueAsNullableDateTime(r)):e.Empty,o!=null?e.on.input(e.emitValueAsNullableDateTime(o)):e.Empty),after:s!=null?e.Fragment(i,s):i})},H=t=>typeof t=="string"&&t.trim()===""?null:t,ot=t=>t??"";function E(t){return n=>{const{value:a,onBlur:r,onChange:o,onInput:s,after:l,disabled:c,...i}=n,u=k.NullableResetAfter(a,c,o??s);return t({...i,disabled:c,value:e.Value.map(a,ot),onChange:o!=null?p=>o(H(p)):void 0,onInput:s!=null?p=>s(H(p)):void 0,onBlur:r,after:l!=null?e.Fragment(u,l):u})}}const Tt=E(q.EmailInput),_t=E($.TextInput),At=E(q.PasswordInput),Ft=E(k.TextArea),kt=({value:t,onChange:n,onInput:a,onBlur:r,offLabel:o,onLabel:s,disabled:l=!1,size:c="md",id:i,color:u="primary",tabIndex:p=0})=>{const d=i??pt.sessionId("switch");function f(b,x){const h=["bc-switch",`bc-switch--size-${x}`,`bc-switch--${x}`];return b&&h.push("bc-switch--disabled"),h.join(" ")}function g(b){const x=b??"primary",h=new Map,T=$.backgroundValue(x,"solid","light"),C=$.backgroundValue(x,"solid","dark");return h.set("--switch-track-on-bg",T.backgroundColor),h.set("--switch-track-on-label",T.textColor),h.set("--switch-track-on-bg-dark",C.backgroundColor),h.set("--switch-track-on-label-dark",C.textColor),h.set("--switch-track-on-border-dark",$.borderColorValue(x,"dark")),Array.from(h.entries()).map(([M,m])=>`${M}: ${m}`).join("; ")}const y=()=>{e.Value.get(l)||(n?.(!e.Value.get(t)),a?.(!e.Value.get(t)))},w=b=>{e.Value.get(l)||(b.key===" "||b.key==="Enter")&&(b.preventDefault(),y())};return e.html.div(e.attr.class(e.computedOf(l??!1,c)((b,x)=>f(b??!1,x??"md"))),e.attr.style(e.computedOf(u)(b=>g(b))),e.attr.id(d),e.attr.role("switch"),e.attr.tabindex(e.computedOf(l??!1,p)((b,x)=>b?-1:x??0)),e.aria.checked(t),e.aria.disabled(l),e.on.click(y),e.on.keydown(w),r!=null?e.on.blur(r):null,e.html.div(e.attr.class("bc-switch__track"),e.attr.class(e.Value.map(t,b=>b?"bc-switch__track--on":"bc-switch__track--off")),o!=null?e.html.div(e.aria.hidden(!0),e.attr.class("bc-switch__track-label bc-switch__track-label--off"),e.attr.class(e.Value.map(t,b=>b?"bc-switch__track-label--hidden":"bc-switch__track-label--visible")),o):null,s!=null?e.html.div(e.attr.class("bc-switch__track-label bc-switch__track-label--on"),e.attr.class(e.Value.map(t,b=>b?"bc-switch__track-label--visible":"bc-switch__track-label--hidden")),s):null,X.ElementRect(b=>e.Use($.Locale,({direction:x})=>e.html.div(e.attr.class("bc-switch__thumb"),e.attr.class(e.Value.map(t,h=>h?"bc-switch__thumb--on":"bc-switch__thumb--off")),e.style.transform(e.computedOf(t,b,c,x)((h,{width:T},C,M)=>{const m=(()=>{switch(C){case"xs":return 5;case"sm":return 5.5;case"md":return 6;case"lg":return 7;case"xl":return 8}})(),I=M==="rtl"?`calc((var(--spacing-base) * ${m}) - ${T}px)`:`calc(${T}px - (var(--spacing-base) * ${m}))`;return h?`translateX(${I})`:"translateX(0)"})))))))},vt=E(k.UUIDInput),Nt="line-md:star-alt-filled",St="line-md:star-alt",lt=t=>{const{value:n,onChange:a,disabled:r,max:o=5,fullColor:s="yellow",emptyColor:l="neutral",fullIcon:c=Nt,emptyIcon:i=St,size:u="md",onBlur:p,rounding:d=1}=t,f=()=>{const h=e.Value.get(d);return h>0?h:1},g=h=>Math.min(Math.max(h,0),e.Value.get(o)),y=(h,T)=>{if(e.Value.get(r??!1))return;const M=h.currentTarget.getBoundingClientRect(),m=(h.clientX-M.left)/M.width,I=T-1+m,V=f(),_=Math.ceil(I/V)*V,A=g(_);a?.(A)},w=h=>{if(e.Value.get(r??!1))return;const T=f(),C=e.Value.get(n)??0;let M;switch(h.key){case"ArrowRight":case"ArrowUp":M=g(C+T);break;case"ArrowLeft":case"ArrowDown":M=g(C-T);break;case"Home":M=0;break;case"End":M=e.Value.get(o);break;default:return}h.preventDefault(),a?.(M)},b=e.Value.map(u,h=>`bc-icon--${h}`),x=({index:h,counter:T})=>e.html.span(e.attr.class("bc-rating-input__icon-container"),e.attr.class(b),$.Icon({icon:i,size:u,color:l,tone:"soft"},e.attr.class("bc-rating-input__icon-empty")),e.html.span(e.attr.class("bc-rating-input__icon-clipper"),e.attr.class(b),e.style.width(e.Value.map(n,C=>{const M=Math.floor(C);return M>h?"100%":M<h?"0%":`${(C-h)*100}%`})),$.Icon({icon:c,size:u,color:s,tone:"soft"},e.attr.class("bc-rating-input__icon-full"))),e.on.click(e.emit(C=>y(C,T),{preventDefault:!0,stopPropagation:!0})));return $.InputContainer({baseContainer:!0,growInput:!1,focusableSelector:'[role="slider"]',...t,input:e.html.div($.CommonInputAttributes(t),e.attr.class("bc-rating-input"),e.attr.role("slider"),e.attr.tabindex(e.Value.map(r??!1,h=>h?-1:0)),e.aria.disabled(r??!1),e.aria.valuemin(0),e.aria.valuemax(e.Value.map(o,h=>h??0)),e.aria.valuenow(e.Value.map(n,h=>h??0)),e.aria.valuetext(e.computedOf(n,o)((h,T)=>{const C=h??0,M=T??0;return`${String(C)} / ${String(M)}`})),e.on.keydown(w),p!=null?e.on.blur(p):null,e.Repeat(o,x))})},Rt=t=>{const{value:n,onChange:a,onInput:r,onBlur:o,after:s,disabled:l,...c}=t,i=k.NullableResetAfter(n,l,a??r);return lt({...c,value:e.Value.map(n,u=>u??0),onChange:a,onInput:r,onBlur:o,after:s!=null?e.Fragment(i,s):i})},Et=t=>{const{value:n,step:a,min:r,max:o,onBlur:s,onChange:l,onInput:c}=t;return $.InputContainer({...t,focusableSelector:'input[type="range"]',input:e.html.input(e.attr.type("range"),$.CommonInputAttributes(t),e.attr.min(r),e.attr.max(o),e.attr.step(a),e.attr.valueAsNumber(n),e.attr.class("bc-input bc-slider-input"),s!=null?e.on.blur(e.emitValueAsNumber(s)):e.Empty,l!=null?e.on.change(e.emitValueAsNumber(l)):e.Empty,c!=null?e.on.input(e.emitValueAsNumber(c)):e.Empty)})},Dt=t=>{const{value:n,step:a,min:r,max:o,onBlur:s,onChange:l,onInput:c}=t,i=e.Value.map(n,p=>{if(p!=null)return p;const d=r!=null?e.Value.get(r):void 0;return typeof d=="number"?d:0}),u=k.NullableResetAfter(n,t.disabled,l??c);return $.InputContainer({...t,focusableSelector:'input[type="range"]',after:u,input:e.html.input(e.attr.type("range"),$.CommonInputAttributes(t),e.attr.min(r),e.attr.max(o),e.attr.step(a),e.attr.valueAsNumber(i),e.attr.class("bc-input bc-slider-input"),s!=null?e.on.blur(e.emitValueAsNumber(s)):e.Empty,l!=null?e.on.change(e.emitValueAsNumber(p=>{l(p)})):e.Empty,c!=null?e.on.input(e.emitValueAsNumber(p=>{c(p)})):e.Empty)},e.Fragment())},Ot=E(k.UrlInput),W=["description","comment","notes","text"];function Bt(t){if(typeof t=="boolean")return W;const n=t["x:ui"];return n&&Array.isArray(n.textAreaTriggers)?[...W,...n.textAreaTriggers]:W}function ct(t){if(typeof t=="boolean")return;const n=t["x:ui"];if(n!=null&&(typeof n=="string"||typeof n=="object"&&n!==null))return n}function it(t,n){if(typeof t=="boolean")return;const a=ct(t);if(typeof a=="object"&&typeof a.widget=="string")return{widget:a.widget,source:"explicit-widget",options:a};const r=typeof a=="string"?a:typeof a=="object"&&typeof a.format=="string"?a.format:void 0;if(r)return{widget:r,source:"explicit-format",options:typeof a=="object"?a:void 0};if(typeof t.format=="string")return{widget:{datetime:"date-time",base64:"binary",bytes:"binary",iri:"uri","iri-reference":"uri-reference","idn-hostname":"hostname"}[t.format]||t.format,source:"schema-format"};if(t.contentMediaType==="text/markdown")return{widget:"markdown",source:"schema-media"};if(t.contentMediaType!=null||t.contentEncoding==="base64")return{widget:"binary",source:"schema-media",options:{mediaType:t.contentMediaType,encoding:t.contentEncoding}};if(t.enum!=null)return{widget:"enum",source:"constraints"};if(t.const!=null)return{widget:"const",source:"constraints"};if((t.type==="number"||t.type==="integer"||Array.isArray(t.type)&&t.type.some(s=>s==="number"||s==="integer"))&&t.minimum!=null&&t.maximum!=null)return t.maximum-t.minimum<=5&&t.minimum>=0&&t.minimum<=1&&(t.multipleOf==null||t.multipleOf>=1)?{widget:"rating",source:"constraints",options:{max:t.maximum}}:{widget:"slider",source:"constraints",options:{min:t.minimum,max:t.maximum,step:t.multipleOf}};if(t.type==="string"){if(t.minLength!=null&&t.minLength>20||t.maxLength!=null&&t.maxLength>100)return{widget:"textarea",source:"heuristics"};if(n){const s=n.toLowerCase();if(s.includes("password")||s.includes("secret"))return{widget:"password",source:"heuristics"};if(s.includes("email"))return{widget:"email",source:"heuristics"};if(s.includes("url")||s.includes("link"))return{widget:"url",source:"heuristics"};if(s.includes("color"))return{widget:"color",source:"heuristics"};if(Bt(t).some(c=>s.includes(c.toLowerCase())))return{widget:"textarea",source:"heuristics"}}}}class ut{widgets=new Map;typeMapping=new Map;register(n,a){if(this.widgets.set(n,a),a.supportedTypes)for(const r of a.supportedTypes)this.typeMapping.has(r)||this.typeMapping.set(r,[]),this.typeMapping.get(r).push(n),this.typeMapping.get(r).sort((o,s)=>{const l=this.widgets.get(o)?.priority||0;return(this.widgets.get(s)?.priority||0)-l})}unregister(n){const a=this.widgets.get(n);if(a&&(this.widgets.delete(n),a.supportedTypes))for(const r of a.supportedTypes){const o=this.typeMapping.get(r);if(o){const s=o.indexOf(n);s>=0&&o.splice(s,1),o.length===0&&this.typeMapping.delete(r)}}}get(n){return this.widgets.get(n)}getAll(){return new Map(this.widgets)}getForType(n){return(this.typeMapping.get(n)||[]).map(r=>this.widgets.get(r)).filter(Boolean)}findBestWidget(n){const a=it(n.definition,n.name);if(a?.widget){const o=this.widgets.get(a.widget);if(o)return{name:a.widget,registration:o,resolved:a}}const r=[];for(const[o,s]of this.widgets.entries())if(s.matcher)try{s.matcher(n)&&r.push({name:o,registration:s,priority:s.priority??0})}catch(l){console.warn(`Error in matcher for widget "${o}":`,l)}if(r.length>0){r.sort((s,l)=>l.priority-s.priority);const o=r[0];return{name:o.name,registration:o.registration,resolved:{widget:o.name,source:"heuristics"}}}if(typeof n.definition=="object"&&n.definition.type){const o=Array.isArray(n.definition.type)?n.definition.type[0]:n.definition.type,s=this.getForType(o);if(s.length>0){const l=this.typeMapping.get(o)[0];return{name:l,registration:s[0],resolved:{widget:l,source:"type-fallback"}}}}return null}}const Lt=new ut;function Ut(t,n,a){return{factory:n,matcher:r=>{const s=r.definition["x:ui"];return s===t||typeof s=="object"&&s!==null&&s.widget===t},displayName:a?.displayName??t,priority:a?.priority??100,...a}}function Wt(t,n,a){return{factory:n,matcher:r=>r.definition.format===t,displayName:a?.displayName??`${t} widget`,priority:a?.priority??75,...a}}function Ht(t,n,a,r){return{factory:a,matcher:o=>{const s=o.definition;return s.type===t&&s.format===n},displayName:r?.displayName??`${t}:${n} widget`,priority:r?.priority??80,...r}}function Pt(t){const n=t?.logPrefix??"WIDGET_DIAG",a=t?.filterFn??(()=>!0);return{factory:()=>null,displayName:"Diagnostic Widget (never matches)",priority:-1e3,matcher:r=>{if(!a(r))return!1;const o=r.definition,s={name:r.name,path:r.path.map(String),type:o?.type,hasRegistry:r.widgetRegistry!==void 0,definition:o};return console.log(`[${n}] name="${s.name??"ROOT"}" path=[${s.path.join(", ")}] type="${s.type??"unknown"}" hasRegistry=${s.hasRegistry}`),t?.onProcess?.(s),!1}}}exports.Base64Input=bt;exports.Base64sInput=st;exports.Card=xt;exports.ColorSwatchInput=wt;exports.EditableText=$t;exports.NullableDateInput=Mt;exports.NullableDateTimeInput=Ct;exports.NullableEmailInput=Tt;exports.NullablePasswordInput=At;exports.NullableRatingInput=Rt;exports.NullableSliderInput=Dt;exports.NullableTextArea=Ft;exports.NullableTextInput=_t;exports.NullableUUIDInput=vt;exports.NullableUrlInput=Ot;exports.RatingInput=lt;exports.SliderInput=Et;exports.Switch=kt;exports.WidgetRegistry=ut;exports.createDiagnosticWidget=Pt;exports.emptyToNull=H;exports.fileToBase64=at;exports.forFormat=Wt;exports.forTypeAndFormat=Ht;exports.forXUI=Ut;exports.formatColor=N;exports.getContrastRatio=mt;exports.getXUIConfig=ct;exports.globalWidgetRegistry=Lt;exports.hexToRgb=R;exports.hslToRgb=j;exports.hwbToRgb=tt;exports.isValidColor=gt;exports.isValidHexColor=P;exports.isValidHslColor=G;exports.isValidRgbColor=z;exports.isValidRgbaColor=Y;exports.linearToSrgb=O;exports.mulberry32=J;exports.normalizeHexColor=K;exports.nullToEmpty=ot;exports.oklchToRgb=nt;exports.parseAnyColor=Q;exports.resolveEffectiveFormat=S;exports.resolveWidget=it;exports.rgbToHex=B;exports.rgbToHsl=L;exports.rgbToHwb=et;exports.rgbToOklch=rt;exports.srgbToLinear=D;exports.toRgbaString=Z;
|
|
1
|
+
"use strict";const e=require("@tempots/dom"),k=require("./deep-merge-cQgRrtGF.cjs"),$=require("./translations-eUtMHN9s.cjs"),X=require("@tempots/ui"),q=require("./notice-DYBLXglS.cjs"),pt=require("./use-form-pSErMD6z.cjs");function P(t){if(typeof t!="string")return!1;const n=t.startsWith("#")?t.slice(1):t;return/^[0-9A-Fa-f]{3}$|^[0-9A-Fa-f]{6}$/.test(n)}function z(t){if(typeof t!="string")return!1;const n=/^rgb\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*\)$/i,a=t.match(n);if(!a)return!1;const[,r,o,s]=a,l=parseInt(r,10),c=parseInt(o,10),i=parseInt(s,10);return l>=0&&l<=255&&c>=0&&c<=255&&i>=0&&i<=255}function Y(t){if(typeof t!="string")return!1;const n=/^rgba\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(0|1|0?\.\d+)\s*\)$/i,a=t.match(n);if(!a)return!1;const[,r,o,s,l]=a,c=parseInt(r,10),i=parseInt(o,10),u=parseInt(s,10),p=parseFloat(l);return c>=0&&c<=255&&i>=0&&i<=255&&u>=0&&u<=255&&p>=0&&p<=1}function G(t){if(typeof t!="string")return!1;const n=/^hsl\(\s*(\d{1,3})\s*,\s*(\d{1,3})%\s*,\s*(\d{1,3})%\s*\)$/i,a=t.match(n);if(!a)return!1;const[,r,o,s]=a,l=parseInt(r,10),c=parseInt(o,10),i=parseInt(s,10);return l>=0&&l<=360&&c>=0&&c<=100&&i>=0&&i<=100}function gt(t){return P(t)||z(t)||Y(t)||G(t)}function K(t){if(!P(t))return null;let n=t.startsWith("#")?t.slice(1):t;return n.length===3&&(n=n.split("").map(a=>a+a).join("")),`#${n.toLowerCase()}`}function B(t,n,a){const r=o=>{const s=Math.round(Math.max(0,Math.min(255,o))).toString(16);return s.length===1?"0"+s:s};return`#${r(t)}${r(n)}${r(a)}`}function R(t){const n=K(t);if(!n)return null;const a=/^#([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(n);return a?{r:parseInt(a[1],16),g:parseInt(a[2],16),b:parseInt(a[3],16)}:null}function mt(t,n){const a=R(t),r=R(n);if(!a||!r)return null;const o=(u,p,d)=>{const[f,g,y]=[u,p,d].map(w=>(w=w/255,w<=.03928?w/12.92:Math.pow((w+.055)/1.055,2.4)));return .2126*f+.7152*g+.0722*y},s=o(a.r,a.g,a.b),l=o(r.r,r.g,r.b),c=Math.max(s,l),i=Math.min(s,l);return(c+.05)/(i+.05)}function Q(t){if(!t)return[0,0,0,1];const a=t.trim().match(/^#?([a-fA-F0-9]{3,4}|[a-fA-F0-9]{6}|[a-fA-F0-9]{8})$/);if(a){const u=a[1];if(u.length===8){const p=parseInt(u.slice(0,2),16),d=parseInt(u.slice(2,4),16),f=parseInt(u.slice(4,6),16),g=parseInt(u.slice(6,8),16)/255;return[p,d,f,g]}if(u.length===6)return[parseInt(u.slice(0,2),16),parseInt(u.slice(2,4),16),parseInt(u.slice(4,6),16),1];if(u.length===4){const p=parseInt(u[0]+u[0],16),d=parseInt(u[1]+u[1],16),f=parseInt(u[2]+u[2],16),g=parseInt(u[3]+u[3],16)/255;return[p,d,f,g]}if(u.length===3){const p=parseInt(u[0]+u[0],16),d=parseInt(u[1]+u[1],16),f=parseInt(u[2]+u[2],16);return[p,d,f,1]}}const r=t.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(r)return[parseInt(r[1],10),parseInt(r[2],10),parseInt(r[3],10),parseFloat(r[4])];const o=t.match(/^rgb\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*\)$/i);if(o)return[parseInt(o[1],10),parseInt(o[2],10),parseInt(o[3],10),1];const s=t.match(/^hsla?\(\s*([+-]?[\d.]+)(?:deg)?\s*[ ,]?\s*([\d.]+)%\s*[ ,]?\s*([\d.]+)%\s*(?:[/,]\s*(\d?(?:\.\d+)?))?\s*\)$/i);if(s){const u=parseFloat(s[1]),p=parseFloat(s[2]),d=parseFloat(s[3]),f=s[4]!=null?parseFloat(s[4]):1,[g,y,w]=j(u,p/100,d/100);return[g,y,w,f]}const l=t.match(/^hwb\(\s*([+-]?[\d.]+)(?:deg)?\s*[, ]\s*([\d.]+)%\s*[, ]\s*([\d.]+)%\s*(?:[/]\s*(\d?(?:\.\d+)?))?\s*\)$/i);if(l){const u=parseFloat(l[1]),p=parseFloat(l[2])/100,d=parseFloat(l[3])/100,f=l[4]!=null?parseFloat(l[4]):1,[g,y,w]=tt(u,p,d);return[g,y,w,f]}const c=t.match(/^oklch\(\s*([+-]?[\d.]+%?)\s+([\d.]+)\s+([+-]?[\d.]+)(?:deg)?(?:\s*\/\s*(\d?(?:\.\d+)?))?\s*\)$/i);if(c){const u=c[1],p=parseFloat(c[2]),d=parseFloat(c[3]),f=c[4]!=null?parseFloat(c[4]):1,g=u.endsWith("%")?Math.max(0,Math.min(1,parseFloat(u)/100)):Math.max(0,Math.min(1,parseFloat(u))),[y,w,b]=nt(g,p,d);return[y,w,b,f]}const i=R(t);return i?[i.r,i.g,i.b,1]:[0,0,0,1]}function Z(t,n,a,r){return`rgba(${Math.round(t)}, ${Math.round(n)}, ${Math.round(a)}, ${Math.max(0,Math.min(1,Math.round(r*100)/100))})`}function J(t){let n=t+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 j(t,n,a){t=(t%360+360)%360;const r=(1-Math.abs(2*a-1))*n,o=r*(1-Math.abs(t/60%2-1)),s=a-r/2;let l=0,c=0,i=0;return 0<=t&&t<60?[l,c,i]=[r,o,0]:60<=t&&t<120?[l,c,i]=[o,r,0]:120<=t&&t<180?[l,c,i]=[0,r,o]:180<=t&&t<240?[l,c,i]=[0,o,r]:240<=t&&t<300?[l,c,i]=[o,0,r]:[l,c,i]=[r,0,o],[Math.round((l+s)*255),Math.round((c+s)*255),Math.round((i+s)*255)]}function tt(t,n,a){t=(t%360+360)%360;const r=n+a;r>1&&(n/=r,a/=r);const[o,s,l]=j(t,1,.5).map(d=>d/255),c=1-n-a,i=o*c+n,u=s*c+n,p=l*c+n;return[Math.round(i*255),Math.round(u*255),Math.round(p*255)]}function L(t,n,a){t/=255,n/=255,a/=255;const r=Math.max(t,n,a),o=Math.min(t,n,a);let s=0,l=0;const c=(r+o)/2,i=r-o;if(i!==0){switch(l=c>.5?i/(2-r-o):i/(r+o),r){case t:s=(n-a)/i+(n<a?6:0);break;case n:s=(a-t)/i+2;break;default:s=(t-n)/i+4}s*=60}return[Math.round(s),Math.round(l*100),Math.round(c*100)]}function et(t,n,a){const[r]=L(t,n,a),o=t/255,s=n/255,l=a/255,c=Math.min(o,s,l),i=1-Math.max(o,s,l);return[r,Math.round(c*100),Math.round(i*100)]}function D(t){const n=t/255;return n<=.04045?n/12.92:Math.pow((n+.055)/1.055,2.4)}function O(t){const n=t<=.0031308?12.92*t:1.055*Math.pow(t,.4166666666666667)-.055;return Math.round(Math.max(0,Math.min(1,n))*255)}function nt(t,n,a){const r=a*Math.PI/180,o=Math.cos(r)*n,s=Math.sin(r)*n,l=t+.3963377774*o+.2158037573*s,c=t-.1055613458*o-.0638541728*s,i=t-.0894841775*o-1.291485548*s,u=l*l*l,p=c*c*c,d=i*i*i,f=4.0767416621*u-3.3077115913*p+.2309699292*d,g=-1.2684380046*u+2.6097574011*p-.3413193965*d,y=-.0041960863*u-.7034186147*p+1.707614701*d;return[O(f),O(g),O(y)]}function rt(t,n,a){const r=D(t),o=D(n),s=D(a),l=.4122214708*r+.5363325363*o+.0514459929*s,c=.2119034982*r+.6806995451*o+.1073969566*s,i=.0883024619*r+.2817188376*o+.6299787005*s,u=Math.cbrt(l),p=Math.cbrt(c),d=Math.cbrt(i),f=.2104542553*u+.793617785*p-.0040720468*d,g=1.9779984951*u-2.428592205*p+.4505937099*d,y=.0259040371*u+.7827717662*p-.808675766*d,w=Math.sqrt(g*g+y*y);let b=Math.atan2(y,g)*180/Math.PI;return b<0&&(b+=360),[f,w,b]}function N(t,n,a,r,o,s){switch(o){case"hex":if(s){const l=i=>i.toString(16).padStart(2,"0"),c=Math.max(0,Math.min(255,Math.round(r*255)));return`#${l(t)}${l(n)}${l(a)}${l(c)}`}return B(t,n,a);case"rgb":return`rgb(${t}, ${n}, ${a})`;case"rgba":return`rgba(${t}, ${n}, ${a}, ${Math.round(r*100)/100})`;case"hsl":{const[l,c,i]=L(t,n,a);return`hsl(${l}, ${c}%, ${i}%)`}case"hsla":{const[l,c,i]=L(t,n,a);return`hsla(${l}, ${c}%, ${i}%, ${Math.round(r*100)/100})`}case"hwb":{const[l,c,i]=et(t,n,a);return r<1?`hwb(${l} ${c}% ${i}% / ${Math.round(r*100)/100})`:`hwb(${l} ${c}% ${i}%)`}case"oklch":{const[l,c,i]=rt(t,n,a),u=(Math.round(l*1e3)/1e3).toFixed(3),p=(Math.round(c*1e3)/1e3).toFixed(3),d=(Math.round(i*10)/10).toFixed(1),f=Math.round(r*100)/100;return s||r<1?`oklch(${u} ${p} ${d} / ${f})`:`oklch(${u} ${p} ${d})`}}}function S(t,n){return n?t==="rgb"?"rgba":t==="hsl"?"hsla":t:t==="rgba"?"rgb":t==="hsla"?"hsl":t}async function at(t){return new Promise((n,a)=>{const r=new FileReader;r.readAsDataURL(t),r.onload=()=>{const o=r.result;n(o.split(",")[1])},r.onerror=o=>a(o)})}function dt(t){return Promise.all(t.map(at))}function ht(t){if(t.length>=4){if(t[0]===137&&t[1]===80&&t[2]===78&&t[3]===71)return"image/png";if(t[0]===255&&t[1]===216)return"image/jpeg";if(t[0]===71&&t[1]===73&&t[2]===70)return"image/gif";if(t[0]===82&&t[1]===73&&t[2]===70&&t[3]===70&&t.length>=12&&t[8]===87&&t[9]===69&&t[10]===66&&t[11]===80)return"image/webp"}try{if(new TextDecoder("utf-8").decode(t.slice(0,256)).includes("<svg"))return"image/svg+xml"}catch{}return"application/octet-stream"}function ft(t){const n=k.$t(t??""),a=n.length,r=new Uint8Array(a);for(let o=0;o<a;o++)r[o]=n.charCodeAt(o);return r}function st(t){const{value:n,onChange:a,onInput:r,...o}=t,s=new Map,l=e.Value.toSignal(n).map(p=>p.map((d,f)=>{const g=s.get(d),y=ft(d??""),w=g?.type||ht(y),b=g?.name??`file-${f}`,x=y.buffer.slice(y.byteOffset,y.byteOffset+y.byteLength),h=new Blob([x],{type:w});return new File([h],b,{type:w})})),c=p=>d=>{p&&dt(d).then(f=>{for(const[g,y]of f.entries())s.set(y,{name:d[g].name,type:d[g].type});p(f)})},i=c(a),u=c(r);return k.FilesInput({...o,value:l,onChange:i,onInput:u})}function bt(t){const{value:n,onInput:a,onChange:r,...o}=t;return st({...o,maxFiles:1,value:e.Value.map(n,s=>s==null?[]:[s]),onChange:s=>{r?.(s[0])},onInput:s=>{a?.(s[0])}})}function yt(t,n){const[a,r,o]=t,s=a<<16^r<<8^o,l=J(s),c=6+Math.floor(l()*5),i=.18+l()*.06,u=[];for(let g=0;g<c;g++){const y=g/c*Math.PI*2,w=n*(1+(l()*2-1)*i),b=Math.cos(y)*w,x=Math.sin(y)*w;u.push({x:b,y:x})}const p=(u[0].x+u[c-1].x)/2,d=(u[0].y+u[c-1].y)/2;let f=`M ${p.toFixed(3)} ${d.toFixed(3)}`;for(let g=0;g<c;g++){const y=u[g],w=u[(g+1)%c],b=(y.x+w.x)/2,x=(y.y+w.y)/2;f+=` Q ${y.x.toFixed(3)} ${y.y.toFixed(3)} ${b.toFixed(3)} ${x.toFixed(3)}`}return f+=" Z",f}const wt=t=>{const{value:n,onBlur:a,onChange:r,onInput:o,displayValue:s,size:l,withAlpha:c}=t,i=e.Value.map(l??32,m=>m),u=e.Value.map(n,m=>Q(m??"#000000")),p=e.Value.map(u,([m,I,V])=>[m,I,V]),d=e.Value.map(u,([,,,m])=>m),f=e.prop(e.Value.get(d)??1),g=e.Value.map(c??!1,m=>m),y=e.Value.map(t.colorTextFormat??"rgb",m=>m),w=e.computedOf(p,f,y,g)(([m,I,V],_,A,F)=>N(m,I,V,_??1,S(A,F),F)),b=e.Value.map(t.colorTextFormat??"hex",m=>m),x=e.Value.map(i,m=>`${-m/2} ${-m/2} ${m} ${m}`),h=e.computedOf(p,i)((m,I)=>yt(m,I/2)),T=e.computedOf(p,f,g)(([m,I,V],_,A)=>A||_<1?Z(m,I,V,_):B(m,I,V)),C=e.html.div(e.attr.class("bc-color-swatch-input__control"),e.attr.class(e.Value.map(g,m=>m?"bc-color-swatch-input__control--alpha":"")),e.attr.style(e.computedOf(i)(m=>`min-width:${m+2}px;height:${m+2}px`)),e.svg.svg(e.attr.class("bc-color-swatch-input__svg"),e.svgAttr.viewBox(x),e.svg.path(e.svgAttr.d(h),e.svgAttr.fill(T))),e.html.input(e.attr.type("color"),$.CommonInputAttributes(t),e.attr.value(e.Value.map(p,([m,I,V])=>B(m,I,V))),e.attr.class("bc-input bc-color-swatch-input bc-color-swatch-input__native"),a!=null?e.on.blur(a):e.Empty,r!=null?e.on.change(m=>{const I=m.target.value;if(!r)return;const{r:V,g:_,b:A}=R(I)??{r:0,g:0,b:0},F=e.Value.get(f)??1,v=S(e.Value.get(b),e.Value.get(g)),U=N(V,_,A,F,v,e.Value.get(g));r(U)}):e.Empty,o!=null?e.on.input(m=>{const I=m.target.value;if(!o)return;const{r:V,g:_,b:A}=R(I)??{r:0,g:0,b:0},F=e.Value.get(f)??1,v=S(e.Value.get(b),e.Value.get(g)),U=N(V,_,A,F,v,e.Value.get(g));o(U)}):e.Empty)),M=e.When(g,()=>e.html.input(e.attr.type("range"),e.attr.class("bc-color-swatch-input__alpha"),e.attr.min(0),e.attr.max(1),e.attr.step(.01),e.attr.value(e.Value.map(f,m=>String(m??1))),e.attr.disabled(t.disabled),e.on.input(m=>{const I=parseFloat(m.target.value);f.set(I);const[V,_,A]=e.Value.get(p),F=S(e.Value.get(b),e.Value.get(g)),v=N(V,_,A,I,F,e.Value.get(g));o?.(v)}),e.on.change(m=>{const I=parseFloat(m.target.value);f.set(I);const[V,_,A]=e.Value.get(p),F=S(e.Value.get(b),e.Value.get(g)),v=N(V,_,A,I,F,e.Value.get(g));r?.(v)})));return $.InputContainer({baseContainer:!0,...t,growInput:!1,input:C,after:e.Fragment(e.When(s??!1,()=>e.html.span(e.attr.class("bc-color-swatch-input__rgb"),w)),M,t.after)})};function It(t,n,a){const r=["bc-card"];return t!=="default"&&r.push(`bc-card--${t}`),n!=="md"&&r.push(`bc-card--padding-${n}`),a!=="lg"&&r.push(`bc-card--rounded-${a}`),r.join(" ")}function xt({variant:t="default",size:n="md",roundedness:a="lg"}={},...r){return e.html.div(e.attr.class(e.computedOf(t,n,a)((o,s,l)=>It(o??"default",s??"md",l??"lg"))),...r)}const $t=({startEditing:t,value:n,onChange:a,placeholder:r,disabled:o})=>{const s=e.Value.deriveProp(t??!1),l=e.prop(!1),c=e.Value.map(o??!1,i=>i);return e.html.div(e.attr.class("bc-editable-text"),e.attr.class(e.Value.map(c,i=>i?"bc-editable-text--disabled":"")),e.aria.disabled(c),e.When(s,()=>e.html.input(e.attr.placeholder(r),e.attr.value(n),e.attr.class("bc-editable-text__input"),X.AutoSelect(),e.on.keydown(i=>{i.key==="Enter"?s.set(!1):i.key==="Escape"&&(l.set(!0),s.set(!1))}),e.on.blur(e.emitValue(i=>{if(s.set(!1),l.value){l.set(!1);return}a(i)}))),()=>e.html.span(e.on.click(()=>{e.Value.get(c)||s.set(!0)}),e.attr.class("bc-editable-text__display"),e.When(e.Value.map(n,i=>i!=null&&i.trim()!==""),()=>e.html.span(e.attr.class("bc-editable-text__text"),n),()=>e.html.span(e.attr.class("bc-editable-text__placeholder"),r)),e.When(e.Value.map(c,i=>!i),()=>e.html.button(e.attr.type("button"),e.attr.class("bc-editable-text__edit-button"),e.Use($.BeatUII18n,i=>e.aria.label(i.$.editLabel)),e.on.click(()=>s.set(!0)),$.Icon({icon:"line-md/pencil",color:"neutral"}))))))},Mt=t=>{const{value:n,onBlur:a,onChange:r,onInput:o,after:s,disabled:l}=t,c=k.NullableResetAfter(n,l,r??o);return $.InputContainer({...t,input:e.input.date($.CommonInputAttributes(t),e.attr.valueAsDate(n),e.attr.class("bc-input"),a!=null?e.on.blur(e.emitValue(a)):e.Empty,r!=null?e.on.change(e.emitValueAsNullableDate(r)):e.Empty,o!=null?e.on.input(e.emitValueAsNullableDate(o)):e.Empty),after:s!=null?e.Fragment(c,s):c})},Vt=t=>{const n=t.getFullYear(),a=t.getMonth()+1,r=t.getDate(),o=t.getHours(),s=t.getMinutes(),l=t.getSeconds();return`${n}-${a.toString().padStart(2,"0")}-${r.toString().padStart(2,"0")}T${o.toString().padStart(2,"0")}:${s.toString().padStart(2,"0")}:${l.toString().padStart(2,"0")}`},Ct=t=>{const{value:n,onBlur:a,onChange:r,onInput:o,after:s,disabled:l}=t,c=e.Value.map(n,u=>u!=null?Vt(u):null),i=k.NullableResetAfter(n,l,r??o);return $.InputContainer({...t,input:e.input["datetime-local"]($.CommonInputAttributes(t),e.attr.value(e.Value.map(c,u=>u??null)),e.attr.class("bc-input"),a!=null?e.on.blur(e.emitValue(a)):e.Empty,r!=null?e.on.change(e.emitValueAsNullableDateTime(r)):e.Empty,o!=null?e.on.input(e.emitValueAsNullableDateTime(o)):e.Empty),after:s!=null?e.Fragment(i,s):i})},H=t=>typeof t=="string"&&t.trim()===""?null:t,ot=t=>t??"";function E(t){return n=>{const{value:a,onBlur:r,onChange:o,onInput:s,after:l,disabled:c,...i}=n,u=k.NullableResetAfter(a,c,o??s);return t({...i,disabled:c,value:e.Value.map(a,ot),onChange:o!=null?p=>o(H(p)):void 0,onInput:s!=null?p=>s(H(p)):void 0,onBlur:r,after:l!=null?e.Fragment(u,l):u})}}const Tt=E(q.EmailInput),_t=E($.TextInput),At=E(q.PasswordInput),Ft=E(k.TextArea),kt=({value:t,onChange:n,onInput:a,onBlur:r,offLabel:o,onLabel:s,disabled:l=!1,size:c="md",id:i,color:u="primary",tabIndex:p=0})=>{const d=i??pt.sessionId("switch");function f(b,x){const h=["bc-switch",`bc-switch--size-${x}`,`bc-switch--${x}`];return b&&h.push("bc-switch--disabled"),h.join(" ")}function g(b){const x=b??"primary",h=new Map,T=$.backgroundValue(x,"solid","light"),C=$.backgroundValue(x,"solid","dark");return h.set("--switch-track-on-bg",T.backgroundColor),h.set("--switch-track-on-label",T.textColor),h.set("--switch-track-on-bg-dark",C.backgroundColor),h.set("--switch-track-on-label-dark",C.textColor),h.set("--switch-track-on-border-dark",$.borderColorValue(x,"dark")),Array.from(h.entries()).map(([M,m])=>`${M}: ${m}`).join("; ")}const y=()=>{e.Value.get(l)||(n?.(!e.Value.get(t)),a?.(!e.Value.get(t)))},w=b=>{e.Value.get(l)||(b.key===" "||b.key==="Enter")&&(b.preventDefault(),y())};return e.html.div(e.attr.class(e.computedOf(l??!1,c)((b,x)=>f(b??!1,x??"md"))),e.attr.style(e.computedOf(u)(b=>g(b))),e.attr.id(d),e.attr.role("switch"),e.attr.tabindex(e.computedOf(l??!1,p)((b,x)=>b?-1:x??0)),e.aria.checked(t),e.aria.disabled(l),e.on.click(y),e.on.keydown(w),r!=null?e.on.blur(r):null,e.html.div(e.attr.class("bc-switch__track"),e.attr.class(e.Value.map(t,b=>b?"bc-switch__track--on":"bc-switch__track--off")),o!=null?e.html.div(e.aria.hidden(!0),e.attr.class("bc-switch__track-label bc-switch__track-label--off"),e.attr.class(e.Value.map(t,b=>b?"bc-switch__track-label--hidden":"bc-switch__track-label--visible")),o):null,s!=null?e.html.div(e.attr.class("bc-switch__track-label bc-switch__track-label--on"),e.attr.class(e.Value.map(t,b=>b?"bc-switch__track-label--visible":"bc-switch__track-label--hidden")),s):null,X.ElementRect(b=>e.Use($.Locale,({direction:x})=>e.html.div(e.attr.class("bc-switch__thumb"),e.attr.class(e.Value.map(t,h=>h?"bc-switch__thumb--on":"bc-switch__thumb--off")),e.style.transform(e.computedOf(t,b,c,x)((h,{width:T},C,M)=>{const m=(()=>{switch(C){case"xs":return 5;case"sm":return 5.5;case"md":return 6;case"lg":return 7;case"xl":return 8}})(),I=M==="rtl"?`calc((var(--spacing-base) * ${m}) - ${T}px)`:`calc(${T}px - (var(--spacing-base) * ${m}))`;return h?`translateX(${I})`:"translateX(0)"})))))))},vt=E(k.UUIDInput),Nt="line-md:star-alt-filled",St="line-md:star-alt",lt=t=>{const{value:n,onChange:a,disabled:r,max:o=5,fullColor:s="yellow",emptyColor:l="neutral",fullIcon:c=Nt,emptyIcon:i=St,size:u="md",onBlur:p,rounding:d=1}=t,f=()=>{const h=e.Value.get(d);return h>0?h:1},g=h=>Math.min(Math.max(h,0),e.Value.get(o)),y=(h,T)=>{if(e.Value.get(r??!1))return;const M=h.currentTarget.getBoundingClientRect(),m=(h.clientX-M.left)/M.width,I=T-1+m,V=f(),_=Math.ceil(I/V)*V,A=g(_);a?.(A)},w=h=>{if(e.Value.get(r??!1))return;const T=f(),C=e.Value.get(n)??0;let M;switch(h.key){case"ArrowRight":case"ArrowUp":M=g(C+T);break;case"ArrowLeft":case"ArrowDown":M=g(C-T);break;case"Home":M=0;break;case"End":M=e.Value.get(o);break;default:return}h.preventDefault(),a?.(M)},b=e.Value.map(u,h=>`bc-icon--${h}`),x=({index:h,counter:T})=>e.html.span(e.attr.class("bc-rating-input__icon-container"),e.attr.class(b),$.Icon({icon:i,size:u,color:l,tone:"soft"},e.attr.class("bc-rating-input__icon-empty")),e.html.span(e.attr.class("bc-rating-input__icon-clipper"),e.attr.class(b),e.style.width(e.Value.map(n,C=>{const M=Math.floor(C);return M>h?"100%":M<h?"0%":`${(C-h)*100}%`})),$.Icon({icon:c,size:u,color:s,tone:"soft"},e.attr.class("bc-rating-input__icon-full"))),e.on.click(e.emit(C=>y(C,T),{preventDefault:!0,stopPropagation:!0})));return $.InputContainer({baseContainer:!0,growInput:!1,focusableSelector:'[role="slider"]',...t,input:e.html.div($.CommonInputAttributes(t),e.attr.class("bc-rating-input"),e.attr.role("slider"),e.attr.tabindex(e.Value.map(r??!1,h=>h?-1:0)),e.aria.disabled(r??!1),e.aria.valuemin(0),e.aria.valuemax(e.Value.map(o,h=>h??0)),e.aria.valuenow(e.Value.map(n,h=>h??0)),e.aria.valuetext(e.computedOf(n,o)((h,T)=>{const C=h??0,M=T??0;return`${String(C)} / ${String(M)}`})),e.on.keydown(w),p!=null?e.on.blur(p):null,e.Repeat(o,x))})},Rt=t=>{const{value:n,onChange:a,onInput:r,onBlur:o,after:s,disabled:l,...c}=t,i=k.NullableResetAfter(n,l,a??r);return lt({...c,value:e.Value.map(n,u=>u??0),onChange:a,onInput:r,onBlur:o,after:s!=null?e.Fragment(i,s):i})},Et=t=>{const{value:n,step:a,min:r,max:o,onBlur:s,onChange:l,onInput:c}=t;return $.InputContainer({...t,focusableSelector:'input[type="range"]',input:e.html.input(e.attr.type("range"),$.CommonInputAttributes(t),e.attr.min(r),e.attr.max(o),e.attr.step(a),e.attr.valueAsNumber(n),e.attr.class("bc-input bc-slider-input"),s!=null?e.on.blur(e.emitValueAsNumber(s)):e.Empty,l!=null?e.on.change(e.emitValueAsNumber(l)):e.Empty,c!=null?e.on.input(e.emitValueAsNumber(c)):e.Empty)})},Dt=t=>{const{value:n,step:a,min:r,max:o,onBlur:s,onChange:l,onInput:c}=t,i=e.Value.map(n,p=>{if(p!=null)return p;const d=r!=null?e.Value.get(r):void 0;return typeof d=="number"?d:0}),u=k.NullableResetAfter(n,t.disabled,l??c);return $.InputContainer({...t,focusableSelector:'input[type="range"]',after:u,input:e.html.input(e.attr.type("range"),$.CommonInputAttributes(t),e.attr.min(r),e.attr.max(o),e.attr.step(a),e.attr.valueAsNumber(i),e.attr.class("bc-input bc-slider-input"),s!=null?e.on.blur(e.emitValueAsNumber(s)):e.Empty,l!=null?e.on.change(e.emitValueAsNumber(p=>{l(p)})):e.Empty,c!=null?e.on.input(e.emitValueAsNumber(p=>{c(p)})):e.Empty)},e.Fragment())},Ot=E(k.UrlInput),W=["description","comment","notes","text"];function Bt(t){if(typeof t=="boolean")return W;const n=t["x:ui"];return n&&Array.isArray(n.textAreaTriggers)?[...W,...n.textAreaTriggers]:W}function ct(t){if(typeof t=="boolean")return;const n=t["x:ui"];if(n!=null&&(typeof n=="string"||typeof n=="object"&&n!==null))return n}function it(t,n){if(typeof t=="boolean")return;const a=ct(t);if(typeof a=="object"&&typeof a.widget=="string")return{widget:a.widget,source:"explicit-widget",options:a};const r=typeof a=="string"?a:typeof a=="object"&&typeof a.format=="string"?a.format:void 0;if(r)return{widget:r,source:"explicit-format",options:typeof a=="object"?a:void 0};if(typeof t.format=="string")return{widget:{datetime:"date-time",base64:"binary",bytes:"binary",iri:"uri","iri-reference":"uri-reference","idn-hostname":"hostname"}[t.format]||t.format,source:"schema-format"};if(t.contentMediaType==="text/markdown")return{widget:"markdown",source:"schema-media"};if(t.contentMediaType!=null||t.contentEncoding==="base64")return{widget:"binary",source:"schema-media",options:{mediaType:t.contentMediaType,encoding:t.contentEncoding}};if(t.enum!=null)return{widget:"enum",source:"constraints"};if(t.const!=null)return{widget:"const",source:"constraints"};if((t.type==="number"||t.type==="integer"||Array.isArray(t.type)&&t.type.some(s=>s==="number"||s==="integer"))&&t.minimum!=null&&t.maximum!=null)return t.maximum-t.minimum<=5&&t.minimum>=0&&t.minimum<=1&&(t.multipleOf==null||t.multipleOf>=1)?{widget:"rating",source:"constraints",options:{max:t.maximum}}:{widget:"slider",source:"constraints",options:{min:t.minimum,max:t.maximum,step:t.multipleOf}};if(t.type==="string"){if(t.minLength!=null&&t.minLength>20||t.maxLength!=null&&t.maxLength>100)return{widget:"textarea",source:"heuristics"};if(n){const s=n.toLowerCase();if(s.includes("password")||s.includes("secret"))return{widget:"password",source:"heuristics"};if(s.includes("email"))return{widget:"email",source:"heuristics"};if(s.includes("url")||s.includes("link"))return{widget:"url",source:"heuristics"};if(s.includes("color"))return{widget:"color",source:"heuristics"};if(Bt(t).some(c=>s.includes(c.toLowerCase())))return{widget:"textarea",source:"heuristics"}}}}class ut{widgets=new Map;typeMapping=new Map;register(n,a){if(this.widgets.set(n,a),a.supportedTypes)for(const r of a.supportedTypes)this.typeMapping.has(r)||this.typeMapping.set(r,[]),this.typeMapping.get(r).push(n),this.typeMapping.get(r).sort((o,s)=>{const l=this.widgets.get(o)?.priority||0;return(this.widgets.get(s)?.priority||0)-l})}unregister(n){const a=this.widgets.get(n);if(a&&(this.widgets.delete(n),a.supportedTypes))for(const r of a.supportedTypes){const o=this.typeMapping.get(r);if(o){const s=o.indexOf(n);s>=0&&o.splice(s,1),o.length===0&&this.typeMapping.delete(r)}}}get(n){return this.widgets.get(n)}getAll(){return new Map(this.widgets)}getForType(n){return(this.typeMapping.get(n)||[]).map(r=>this.widgets.get(r)).filter(Boolean)}findBestWidget(n){const a=it(n.definition,n.name);if(a?.widget){const o=this.widgets.get(a.widget);if(o)return{name:a.widget,registration:o,resolved:a}}const r=[];for(const[o,s]of this.widgets.entries())if(s.matcher)try{s.matcher(n)&&r.push({name:o,registration:s,priority:s.priority??0})}catch(l){console.warn(`Error in matcher for widget "${o}":`,l)}if(r.length>0){r.sort((s,l)=>l.priority-s.priority);const o=r[0];return{name:o.name,registration:o.registration,resolved:{widget:o.name,source:"heuristics"}}}if(typeof n.definition=="object"&&n.definition.type){const o=Array.isArray(n.definition.type)?n.definition.type[0]:n.definition.type,s=this.getForType(o);if(s.length>0){const l=this.typeMapping.get(o)[0];return{name:l,registration:s[0],resolved:{widget:l,source:"type-fallback"}}}}return null}}const Lt=new ut;function Ut(t,n,a){return{factory:n,matcher:r=>{const s=r.definition["x:ui"];return s===t||typeof s=="object"&&s!==null&&s.widget===t},displayName:a?.displayName??t,priority:a?.priority??100,...a}}function Wt(t,n,a){return{factory:n,matcher:r=>r.definition.format===t,displayName:a?.displayName??`${t} widget`,priority:a?.priority??75,...a}}function Ht(t,n,a,r){return{factory:a,matcher:o=>{const s=o.definition;return s.type===t&&s.format===n},displayName:r?.displayName??`${t}:${n} widget`,priority:r?.priority??80,...r}}function Pt(t){const n=t?.logPrefix??"WIDGET_DIAG",a=t?.filterFn??(()=>!0);return{factory:()=>null,displayName:"Diagnostic Widget (never matches)",priority:-1e3,matcher:r=>{if(!a(r))return!1;const o=r.definition,s={name:r.name,path:r.path.map(String),type:o?.type,hasRegistry:r.widgetRegistry!==void 0,definition:o};return console.log(`[${n}] name="${s.name??"ROOT"}" path=[${s.path.join(", ")}] type="${s.type??"unknown"}" hasRegistry=${s.hasRegistry}`),t?.onProcess?.(s),!1}}}exports.Base64Input=bt;exports.Base64sInput=st;exports.Card=xt;exports.ColorSwatchInput=wt;exports.EditableText=$t;exports.NullableDateInput=Mt;exports.NullableDateTimeInput=Ct;exports.NullableEmailInput=Tt;exports.NullablePasswordInput=At;exports.NullableRatingInput=Rt;exports.NullableSliderInput=Dt;exports.NullableTextArea=Ft;exports.NullableTextInput=_t;exports.NullableUUIDInput=vt;exports.NullableUrlInput=Ot;exports.RatingInput=lt;exports.SliderInput=Et;exports.Switch=kt;exports.WidgetRegistry=ut;exports.createDiagnosticWidget=Pt;exports.emptyToNull=H;exports.fileToBase64=at;exports.forFormat=Wt;exports.forTypeAndFormat=Ht;exports.forXUI=Ut;exports.formatColor=N;exports.getContrastRatio=mt;exports.getXUIConfig=ct;exports.globalWidgetRegistry=Lt;exports.hexToRgb=R;exports.hslToRgb=j;exports.hwbToRgb=tt;exports.isValidColor=gt;exports.isValidHexColor=P;exports.isValidHslColor=G;exports.isValidRgbColor=z;exports.isValidRgbaColor=Y;exports.linearToSrgb=O;exports.mulberry32=J;exports.normalizeHexColor=K;exports.nullToEmpty=ot;exports.oklchToRgb=nt;exports.parseAnyColor=Q;exports.resolveEffectiveFormat=S;exports.resolveWidget=it;exports.rgbToHex=B;exports.rgbToHsl=L;exports.rgbToHwb=et;exports.rgbToOklch=rt;exports.srgbToLinear=D;exports.toRgbaString=Z;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { Value as p, prop as ot, computedOf as D, html as _, attr as u, svg as et, svgAttr as Y, on as $, Empty as A, When as W, Fragment as E, aria as N, emitValue as tt, Use as ct, input as it, emitValueAsNullableDate as nt, emitValueAsNullableDateTime as st, style as lt, Repeat as gt, emit as dt, emitValueAsNumber as B } from "@tempots/dom";
|
|
2
|
-
import { F as ht, $ as mt, N as X, T as ft, U as bt, a as yt } from "./deep-merge-
|
|
3
|
-
import { C as V, b as U, a as wt, c as Q, T as xt, L as $t, d as rt, e as Mt } from "./translations-
|
|
2
|
+
import { F as ht, $ as mt, N as X, T as ft, U as bt, a as yt } from "./deep-merge-Bsqkvp9-.js";
|
|
3
|
+
import { C as V, b as U, a as wt, c as Q, T as xt, L as $t, d as rt, e as Mt } from "./translations-BEMKy6-W.js";
|
|
4
4
|
import { AutoSelect as It, ElementRect as _t } from "@tempots/ui";
|
|
5
|
-
import { E as kt, P as Tt } from "./notice-
|
|
6
|
-
import { s as Ct } from "./use-form-
|
|
5
|
+
import { E as kt, P as Tt } from "./notice-C0Brmeyi.js";
|
|
6
|
+
import { s as Ct } from "./use-form-DMiCxK26.js";
|
|
7
7
|
function ut(t) {
|
|
8
8
|
if (typeof t != "string") return !1;
|
|
9
9
|
const e = t.startsWith("#") ? t.slice(1) : t;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("./translations-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("./translations-eUtMHN9s.cjs"),a={loadingExtended:"正在加载,请稍候",loadingShort:"加载中...",locale:"语言",iconDescription:"图标",loadingIcon:"加载图标",failedToLoadIcon:"图标加载失败",editLabel:"编辑",selectOne:"选择一个",selectMany:"选择多个",noResults:"无结果",passwordPlaceholderText:"密码",togglePasswordVisibility:"切换密码可见性",toggleMenu:"切换菜单",toggleAside:"切换侧边栏",mainNavigation:"主导航",sidebar:"侧边栏",closeDrawer:"关闭抽屉",closeModal:"关闭模态框",confirm:"确认",cancel:"取消",addLabel:"添加",removeItem:"删除项目",currentLocale:"简体中文",ar:"阿拉伯语",de:"德语",en:"英语",es:"西班牙语",fr:"法语",hi:" Hindi",it:"意大利语",ja:"日语",ko:"韩语",nl:"荷兰语",pl:"波兰语",pt:"葡萄牙语",ru:"俄语",tr:"土耳其语",vi:"越南语",zh:"简体中文",he:"希伯来语",fa:"波斯语",ur:"乌尔都语",emailPlaceholderText:"请输入邮箱",incrementValue:"增加值",decrementValue:"减少值",dropZoneInstructions:e=>e?"点击选择或将文件拖拽到此处,或按 Enter 或空格键打开文件选择器":"将文件拖拽到此处",fileSizeUnits:["字节","KB","MB","GB","TB"],removeFile:"删除文件",clearAllFiles:"清除所有文件",clearValue:"清除值",unknownType:"未知类型",filesInputInstructions:(e,o,t)=>{let n=(e==null||e>1,"点击选择或将文件拖拽到此处");if(e||o){const l=[];if(e!=null&&e>1&&l.push(`最多${e}个文件`),o&&t){const i=r.formatFileSize(o,{units:t});l.push(`每个最大${i}`)}l.length>0&&(n+=` (${l.join(",")})`)}return n},prosemirror:{bold:"Bold",italic:"Italic",code:"Code",link:"Link",removeLink:"Remove Link",heading:e=>`Heading ${e}`,bulletList:"Bullet List",orderedList:"Ordered List",blockquote:"Blockquote",codeBlock:"Code Block",horizontalRule:"Horizontal Rule",linkUrlPlaceholder:"https://example.com"},pdfPageViewer:{loading:"正在加载PDF...",loadFailed:"加载PDF失败",invalidPdf:"无效的PDF文件",pageOutOfRange:(e,o)=>`页面 ${e} 超出范围 (1-${o})`,renderFailed:"渲染PDF页面失败"}};exports.default=a;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tempots/beatui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.78.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "dist/index.umd.js",
|
|
6
6
|
"module": "dist/index.es.js",
|
|
@@ -116,13 +116,16 @@
|
|
|
116
116
|
"registry": "https://registry.npmjs.org/"
|
|
117
117
|
},
|
|
118
118
|
"peerDependencies": {
|
|
119
|
-
"@tempots/dom": "35.0.
|
|
120
|
-
"@tempots/std": "0.
|
|
121
|
-
"@tempots/ui": "14.0.
|
|
119
|
+
"@tempots/dom": "^35.0.3",
|
|
120
|
+
"@tempots/std": "~0.25.2",
|
|
121
|
+
"@tempots/ui": "^14.0.3"
|
|
122
122
|
},
|
|
123
123
|
"devDependencies": {
|
|
124
124
|
"@eslint/js": "^9.39.1",
|
|
125
|
+
"@tempots/dom": "^35.0.3",
|
|
125
126
|
"@tempots/eslint-plugin": "0.6.0",
|
|
127
|
+
"@tempots/std": "~0.25.2",
|
|
128
|
+
"@tempots/ui": "^14.0.3",
|
|
126
129
|
"@testing-library/dom": "10.4.0",
|
|
127
130
|
"@types/markdown-it": "^14.1.2",
|
|
128
131
|
"@types/node": "22.15.18",
|