@tempots/beatui 0.69.0 → 0.71.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.
Files changed (93) hide show
  1. package/dist/{ar-aMLQTGVh.js → ar-BbgpGwJp.js} +1 -1
  2. package/dist/auth/index.cjs.js +1 -1
  3. package/dist/auth/index.es.js +106 -105
  4. package/dist/beatui.css +401 -0
  5. package/dist/beatui.tailwind.css +401 -0
  6. package/dist/{de-DBFOC44R.js → de-R7lPfyZ4.js} +1 -1
  7. package/dist/deep-merge-CQQCMLwG.js +1636 -0
  8. package/dist/deep-merge-DZxfgKqX.cjs +1 -0
  9. package/dist/duration-input-D-SIoDoo.cjs +1 -0
  10. package/dist/duration-input-DKxZ6OCa.js +277 -0
  11. package/dist/{es-C4xOThaT.js → es-DV0Jr_BZ.js} +1 -1
  12. package/dist/{fa-B7X_xydY.js → fa-DXvHejs9.js} +1 -1
  13. package/dist/{fr-AmjzbxN_.js → fr-D8FOMX0o.js} +1 -1
  14. package/dist/{he-DY-9yiOC.js → he-B19Qsx-u.js} +1 -1
  15. package/dist/{hi-Clkyp5Fu.js → hi-DozFnE3b.js} +1 -1
  16. package/dist/{index-GLoRnI6r.js → index-CYb1YxDX.js} +1 -1
  17. package/dist/{index-CzuXAuLZ.js → index-DdpYvBeh.js} +3 -3
  18. package/dist/index.cjs.js +4 -4
  19. package/dist/index.es.js +2852 -3104
  20. package/dist/{it-BC32WmGF.js → it-But8uzNi.js} +1 -1
  21. package/dist/{ja-JNSZS_Hv.js → ja-DkwTnFdU.js} +1 -1
  22. package/dist/json-schema/index.cjs.js +6 -6
  23. package/dist/json-schema/index.es.js +3099 -2961
  24. package/dist/json-structure/index.cjs.js +1 -0
  25. package/dist/json-structure/index.es.js +3157 -0
  26. package/dist/{ko-B8l0TJp0.js → ko-Cqv-IjhX.js} +1 -1
  27. package/dist/modal-5P9mU_a4.cjs +1 -0
  28. package/dist/{modal-DJWj5M5e.js → modal-MofsfmAe.js} +2 -2
  29. package/dist/{nl-BpYESHP8.js → nl-YSiU3rFI.js} +1 -1
  30. package/dist/notice-Cqq8g17n.js +209 -0
  31. package/dist/notice-DP209Ed8.cjs +1 -0
  32. package/dist/{pl-_sWhGdrs.js → pl-DXmHc2Nh.js} +1 -1
  33. package/dist/prosemirror/index.es.js +1 -1
  34. package/dist/{pt-BmiQvHUz.js → pt-Bf3z_-26.js} +1 -1
  35. package/dist/{ru-DacnqexG.js → ru-Sy00qUeG.js} +1 -1
  36. package/dist/tailwind/vite-plugin.es.js +1 -0
  37. package/dist/{toolbar-Bk5-22ln.js → toolbar-C_Ec0_XC.js} +1 -1
  38. package/dist/{tr-BSS5b_v6.js → tr-BDxG3qd6.js} +1 -1
  39. package/dist/{translations-zGwuSQWQ.js → translations-BmsRhth7.js} +1 -1
  40. package/dist/{translations-BUTBIDsS.js → translations-DQxouiBG.js} +24 -24
  41. package/dist/types/components/form/index.d.ts +1 -0
  42. package/dist/types/components/form/utils/deep-merge.d.ts +27 -0
  43. package/dist/types/components/form/utils/index.d.ts +1 -0
  44. package/dist/types/components/json-schema/index.d.ts +1 -0
  45. package/dist/types/components/json-schema/json-schema-form.d.ts +22 -3
  46. package/dist/types/components/json-schema/schema-defaults.d.ts +39 -0
  47. package/dist/types/components/json-structure/controls/any-control.d.ts +15 -0
  48. package/dist/types/components/json-structure/controls/array-control.d.ts +15 -0
  49. package/dist/types/components/json-structure/controls/binary-control.d.ts +15 -0
  50. package/dist/types/components/json-structure/controls/boolean-control.d.ts +15 -0
  51. package/dist/types/components/json-structure/controls/choice-control.d.ts +19 -0
  52. package/dist/types/components/json-structure/controls/decimal-control.d.ts +17 -0
  53. package/dist/types/components/json-structure/controls/deprecation-utils.d.ts +14 -0
  54. package/dist/types/components/json-structure/controls/enum-const-controls.d.ts +22 -0
  55. package/dist/types/components/json-structure/controls/generic-control.d.ts +31 -0
  56. package/dist/types/components/json-structure/controls/index.d.ts +21 -0
  57. package/dist/types/components/json-structure/controls/integer-control.d.ts +18 -0
  58. package/dist/types/components/json-structure/controls/map-control.d.ts +17 -0
  59. package/dist/types/components/json-structure/controls/object-control.d.ts +17 -0
  60. package/dist/types/components/json-structure/controls/set-control.d.ts +15 -0
  61. package/dist/types/components/json-structure/controls/string-control.d.ts +15 -0
  62. package/dist/types/components/json-structure/controls/temporal-control.d.ts +18 -0
  63. package/dist/types/components/json-structure/controls/tuple-control.d.ts +19 -0
  64. package/dist/types/components/json-structure/controls/union-control.d.ts +15 -0
  65. package/dist/types/components/json-structure/controls/uri-control.d.ts +15 -0
  66. package/dist/types/components/json-structure/controls/uuid-control.d.ts +15 -0
  67. package/dist/types/components/json-structure/extends-utils.d.ts +36 -0
  68. package/dist/types/components/json-structure/index.d.ts +25 -0
  69. package/dist/types/components/json-structure/json-structure-form.d.ts +96 -0
  70. package/dist/types/components/json-structure/ref-utils.d.ts +55 -0
  71. package/dist/types/components/json-structure/structure-context.d.ts +176 -0
  72. package/dist/types/components/json-structure/structure-defaults.d.ts +46 -0
  73. package/dist/types/components/json-structure/structure-types.d.ts +173 -0
  74. package/dist/types/components/json-structure/validation/error-transform.d.ts +56 -0
  75. package/dist/types/components/json-structure/validation/index.d.ts +5 -0
  76. package/dist/types/components/json-structure/validation/sdk-validator.d.ts +46 -0
  77. package/dist/types/components/json-structure/widgets/default-widgets.d.ts +27 -0
  78. package/dist/types/components/json-structure/widgets/index.d.ts +6 -0
  79. package/dist/types/components/json-structure/widgets/widget-registry.d.ts +143 -0
  80. package/dist/types/components/json-structure/widgets/widget-utils.d.ts +79 -0
  81. package/dist/types/json-structure/index.d.ts +9 -0
  82. package/dist/{ur-C6Ky6OCl.js → ur-55zdT2TQ.js} +1 -1
  83. package/dist/{notice-Um1LwKBF.js → use-form-B7A865EM.js} +329 -532
  84. package/dist/use-form-DVJXMMoN.cjs +2 -0
  85. package/dist/{vi-Bx2gx2S0.js → vi-C7K7W0hM.js} +1 -1
  86. package/dist/widget-customization-29Hl2gKT.js +1171 -0
  87. package/dist/widget-customization-BXiewbt-.cjs +1 -0
  88. package/dist/{zh-eixtg-Ce.js → zh-DvJBV9D8.js} +1 -1
  89. package/package.json +10 -2
  90. package/dist/modal-D_paG9Sr.cjs +0 -1
  91. package/dist/notice-CgT9ma2m.cjs +0 -2
  92. package/dist/widget-customization-BcbRhAAR.cjs +0 -1
  93. package/dist/widget-customization-D6Y_Qm7o.js +0 -2788
@@ -0,0 +1 @@
1
+ "use strict";const e=require("@tempots/dom"),F=require("./deep-merge-DZxfgKqX.cjs"),M=require("./translations-hMQlZmD4.cjs"),X=require("@tempots/ui"),q=require("./notice-DP209Ed8.cjs"),pt=require("./use-form-DVJXMMoN.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),u=parseInt(s,10);return l>=0&&l<=255&&c>=0&&c<=255&&u>=0&&u<=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),u=parseInt(o,10),i=parseInt(s,10),p=parseFloat(l);return c>=0&&c<=255&&u>=0&&u<=255&&i>=0&&i<=255&&p>=0&&p<=1}function K(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),u=parseInt(s,10);return l>=0&&l<=360&&c>=0&&c<=100&&u>=0&&u<=100}function mt(t){return P(t)||z(t)||Y(t)||K(t)}function Q(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 O(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=Q(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 gt(t,n){const a=R(t),r=R(n);if(!a||!r)return null;const o=(i,p,d)=>{const[f,m,y]=[i,p,d].map(w=>(w=w/255,w<=.03928?w/12.92:Math.pow((w+.055)/1.055,2.4)));return .2126*f+.7152*m+.0722*y},s=o(a.r,a.g,a.b),l=o(r.r,r.g,r.b),c=Math.max(s,l),u=Math.min(s,l);return(c+.05)/(u+.05)}function Z(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 i=a[1];if(i.length===8){const p=parseInt(i.slice(0,2),16),d=parseInt(i.slice(2,4),16),f=parseInt(i.slice(4,6),16),m=parseInt(i.slice(6,8),16)/255;return[p,d,f,m]}if(i.length===6)return[parseInt(i.slice(0,2),16),parseInt(i.slice(2,4),16),parseInt(i.slice(4,6),16),1];if(i.length===4){const p=parseInt(i[0]+i[0],16),d=parseInt(i[1]+i[1],16),f=parseInt(i[2]+i[2],16),m=parseInt(i[3]+i[3],16)/255;return[p,d,f,m]}if(i.length===3){const p=parseInt(i[0]+i[0],16),d=parseInt(i[1]+i[1],16),f=parseInt(i[2]+i[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 i=parseFloat(s[1]),p=parseFloat(s[2]),d=parseFloat(s[3]),f=s[4]!=null?parseFloat(s[4]):1,[m,y,w]=j(i,p/100,d/100);return[m,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 i=parseFloat(l[1]),p=parseFloat(l[2])/100,d=parseFloat(l[3])/100,f=l[4]!=null?parseFloat(l[4]):1,[m,y,w]=tt(i,p,d);return[m,y,w,f]}const c=t.match(/^oklch\(\s*([+-]?[\d.]+%?)\s+([\d.]+)\s+([+-]?[\d.]+)(?:deg)?(?:\s*\/\s*(\d?(?:\.\d+)?))?\s*\)$/i);if(c){const i=c[1],p=parseFloat(c[2]),d=parseFloat(c[3]),f=c[4]!=null?parseFloat(c[4]):1,m=i.endsWith("%")?Math.max(0,Math.min(1,parseFloat(i)/100)):Math.max(0,Math.min(1,parseFloat(i))),[y,w,b]=nt(m,p,d);return[y,w,b,f]}const u=R(t);return u?[u.r,u.g,u.b,1]:[0,0,0,1]}function G(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,u=0;return 0<=t&&t<60?[l,c,u]=[r,o,0]:60<=t&&t<120?[l,c,u]=[o,r,0]:120<=t&&t<180?[l,c,u]=[0,r,o]:180<=t&&t<240?[l,c,u]=[0,o,r]:240<=t&&t<300?[l,c,u]=[o,0,r]:[l,c,u]=[r,0,o],[Math.round((l+s)*255),Math.round((c+s)*255),Math.round((u+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,u=o*c+n,i=s*c+n,p=l*c+n;return[Math.round(u*255),Math.round(i*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,u=r-o;if(u!==0){switch(l=c>.5?u/(2-r-o):u/(r+o),r){case t:s=(n-a)/u+(n<a?6:0);break;case n:s=(a-t)/u+2;break;default:s=(t-n)/u+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),u=1-Math.max(o,s,l);return[r,Math.round(c*100),Math.round(u*100)]}function D(t){const n=t/255;return n<=.04045?n/12.92:Math.pow((n+.055)/1.055,2.4)}function B(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,u=t-.0894841775*o-1.291485548*s,i=l*l*l,p=c*c*c,d=u*u*u,f=4.0767416621*i-3.3077115913*p+.2309699292*d,m=-1.2684380046*i+2.6097574011*p-.3413193965*d,y=-.0041960863*i-.7034186147*p+1.707614701*d;return[B(f),B(m),B(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,u=.0883024619*r+.2817188376*o+.6299787005*s,i=Math.cbrt(l),p=Math.cbrt(c),d=Math.cbrt(u),f=.2104542553*i+.793617785*p-.0040720468*d,m=1.9779984951*i-2.428592205*p+.4505937099*d,y=.0259040371*i+.7827717662*p-.808675766*d,w=Math.sqrt(m*m+y*y);let b=Math.atan2(y,m)*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=u=>u.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 O(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,u]=L(t,n,a);return`hsl(${l}, ${c}%, ${u}%)`}case"hsla":{const[l,c,u]=L(t,n,a);return`hsla(${l}, ${c}%, ${u}%, ${Math.round(r*100)/100})`}case"hwb":{const[l,c,u]=et(t,n,a);return r<1?`hwb(${l} ${c}% ${u}% / ${Math.round(r*100)/100})`:`hwb(${l} ${c}% ${u}%)`}case"oklch":{const[l,c,u]=rt(t,n,a),i=(Math.round(l*1e3)/1e3).toFixed(3),p=(Math.round(c*1e3)/1e3).toFixed(3),d=(Math.round(u*10)/10).toFixed(1),f=Math.round(r*100)/100;return s||r<1?`oklch(${i} ${p} ${d} / ${f})`:`oklch(${i} ${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=F.$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 m=s.get(d),y=ft(d??""),w=m?.type||ht(y),b=m?.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[m,y]of f.entries())s.set(y,{name:d[m].name,type:d[m].type});p(f)})},u=c(a),i=c(r);return F.FilesInput({...o,value:l,onChange:u,onInput:i})}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),u=.18+l()*.06,i=[];for(let m=0;m<c;m++){const y=m/c*Math.PI*2,w=n*(1+(l()*2-1)*u),b=Math.cos(y)*w,x=Math.sin(y)*w;i.push({x:b,y:x})}const p=(i[0].x+i[c-1].x)/2,d=(i[0].y+i[c-1].y)/2;let f=`M ${p.toFixed(3)} ${d.toFixed(3)}`;for(let m=0;m<c;m++){const y=i[m],w=i[(m+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,u=e.Value.map(l??32,g=>g),i=e.Value.map(n,g=>Z(g??"#000000")),p=e.Value.map(i,([g,I,V])=>[g,I,V]),d=e.Value.map(i,([,,,g])=>g),f=e.prop(e.Value.get(d)??1),m=e.Value.map(c??!1,g=>g),y=e.Value.map(t.colorTextFormat??"rgb",g=>g),w=e.computedOf(p,f,y,m)(([g,I,V],T,A,k)=>N(g,I,V,T??1,S(A,k),k)),b=e.Value.map(t.colorTextFormat??"hex",g=>g),x=e.Value.map(u,g=>`${-g/2} ${-g/2} ${g} ${g}`),h=e.computedOf(p,u)((g,I)=>yt(g,I/2)),_=e.computedOf(p,f,m)(([g,I,V],T,A)=>A||T<1?G(g,I,V,T):O(g,I,V)),C=e.html.div(e.attr.class("bc-color-swatch-input__control"),e.attr.class(e.Value.map(m,g=>g?"bc-color-swatch-input__control--alpha":"")),e.attr.style(e.computedOf(u)(g=>`min-width:${g+2}px;height:${g+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(_))),e.html.input(e.attr.type("color"),M.CommonInputAttributes(t),e.attr.value(e.Value.map(p,([g,I,V])=>O(g,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(g=>{const I=g.target.value;if(!r)return;const{r:V,g:T,b:A}=R(I)??{r:0,g:0,b:0},k=e.Value.get(f)??1,v=S(e.Value.get(b),e.Value.get(m)),U=N(V,T,A,k,v,e.Value.get(m));r(U)}):e.Empty,o!=null?e.on.input(g=>{const I=g.target.value;if(!o)return;const{r:V,g:T,b:A}=R(I)??{r:0,g:0,b:0},k=e.Value.get(f)??1,v=S(e.Value.get(b),e.Value.get(m)),U=N(V,T,A,k,v,e.Value.get(m));o(U)}):e.Empty)),$=e.When(m,()=>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,g=>String(g??1))),e.attr.disabled(t.disabled),e.on.input(g=>{const I=parseFloat(g.target.value);f.set(I);const[V,T,A]=e.Value.get(p),k=S(e.Value.get(b),e.Value.get(m)),v=N(V,T,A,I,k,e.Value.get(m));o?.(v)}),e.on.change(g=>{const I=parseFloat(g.target.value);f.set(I);const[V,T,A]=e.Value.get(p),k=S(e.Value.get(b),e.Value.get(m)),v=N(V,T,A,I,k,e.Value.get(m));r?.(v)})));return M.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)),$,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 Mt=({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,u=>u);return e.html.div(e.attr.class("bc-editable-text"),e.attr.class(e.Value.map(c,u=>u?"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(u=>{u.key==="Enter"?s.set(!1):u.key==="Escape"&&(l.set(!0),s.set(!1))}),e.on.blur(e.emitValue(u=>{if(s.set(!1),l.value){l.set(!1);return}a(u)}))),()=>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,u=>u!=null&&u.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,u=>!u),()=>e.html.button(e.attr.type("button"),e.attr.class("bc-editable-text__edit-button"),e.Use(M.BeatUII18n,u=>e.aria.label(u.$.editLabel)),e.on.click(()=>s.set(!0)),M.Icon({icon:"line-md/pencil",color:"neutral"}))))))},$t=t=>{const{value:n,onBlur:a,onChange:r,onInput:o,after:s,disabled:l}=t,c=F.NullableResetAfter(n,l,r??o);return M.InputContainer({...t,input:e.input.date(M.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,i=>i!=null?Vt(i):null),u=F.NullableResetAfter(n,l,r??o);return M.InputContainer({...t,input:e.input["datetime-local"](M.CommonInputAttributes(t),e.attr.value(e.Value.map(c,i=>i??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(u,s):u})},W=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,...u}=n,i=F.NullableResetAfter(a,c,o??s);return t({...u,disabled:c,value:e.Value.map(a,ot),onChange:o!=null?p=>o(W(p)):void 0,onInput:s!=null?p=>s(W(p)):void 0,onBlur:r,after:l!=null?e.Fragment(i,l):i})}}const _t=E(q.EmailInput),Tt=E(M.TextInput),At=E(q.PasswordInput),kt=E(F.TextArea),Ft=({value:t,onChange:n,onInput:a,onBlur:r,offLabel:o,onLabel:s,disabled:l=!1,size:c="md",id:u,color:i="primary",tabIndex:p=0})=>{const d=u??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 m(b){const x=b??"primary",h=new Map,_=M.backgroundValue(x,"solid","light"),C=M.backgroundValue(x,"solid","dark");return h.set("--switch-track-on-bg",_.backgroundColor),h.set("--switch-track-on-label",_.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",M.borderColorValue(x,"dark")),Array.from(h.entries()).map(([$,g])=>`${$}: ${g}`).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(i)(b=>m(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(M.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:_},C,$)=>{const g=(()=>{switch(C){case"xs":return 5;case"sm":return 5.5;case"md":return 6;case"lg":return 7;case"xl":return 8}})(),I=$==="rtl"?`calc((var(--spacing-base) * ${g}) - ${_}px)`:`calc(${_}px - (var(--spacing-base) * ${g}))`;return h?`translateX(${I})`:"translateX(0)"})))))))},vt=E(F.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:u=St,size:i="md",onBlur:p,rounding:d=1}=t,f=()=>{const h=e.Value.get(d);return h>0?h:1},m=h=>Math.min(Math.max(h,0),e.Value.get(o)),y=(h,_)=>{if(e.Value.get(r??!1))return;const $=h.currentTarget.getBoundingClientRect(),g=(h.clientX-$.left)/$.width,I=_-1+g,V=f(),T=Math.ceil(I/V)*V,A=m(T);a?.(A)},w=h=>{if(e.Value.get(r??!1))return;const _=f(),C=e.Value.get(n)??0;let $;switch(h.key){case"ArrowRight":case"ArrowUp":$=m(C+_);break;case"ArrowLeft":case"ArrowDown":$=m(C-_);break;case"Home":$=0;break;case"End":$=e.Value.get(o);break;default:return}h.preventDefault(),a?.($)},b=e.Value.map(i,h=>`bc-icon--${h}`),x=({index:h,counter:_})=>e.html.span(e.attr.class("bc-rating-input__icon-container"),e.attr.class(b),M.Icon({icon:u,size:i,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 $=Math.floor(C);return $>h?"100%":$<h?"0%":`${(C-h)*100}%`})),M.Icon({icon:c,size:i,color:s,tone:"soft"},e.attr.class("bc-rating-input__icon-full"))),e.on.click(e.emit(C=>y(C,_),{preventDefault:!0,stopPropagation:!0})));return M.InputContainer({baseContainer:!0,growInput:!1,focusableSelector:'[role="slider"]',...t,input:e.html.div(M.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,_)=>{const C=h??0,$=_??0;return`${String(C)} / ${String($)}`})),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,u=F.NullableResetAfter(n,l,a??r);return lt({...c,value:e.Value.map(n,i=>i??0),onChange:a,onInput:r,onBlur:o,after:s!=null?e.Fragment(u,s):u})},Et=t=>{const{value:n,step:a,min:r,max:o,onBlur:s,onChange:l,onInput:c}=t;return M.InputContainer({...t,focusableSelector:'input[type="range"]',input:e.html.input(e.attr.type("range"),M.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,u=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}),i=F.NullableResetAfter(n,t.disabled,l??c);return M.InputContainer({...t,focusableSelector:'input[type="range"]',after:i,input:e.html.input(e.attr.type("range"),M.CommonInputAttributes(t),e.attr.min(r),e.attr.max(o),e.attr.step(a),e.attr.valueAsNumber(u),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())},Bt=E(F.UrlInput),H=["description","comment","notes","text"];function Ot(t){if(typeof t=="boolean")return H;const n=t["x:ui"];return n&&Array.isArray(n.textAreaTriggers)?[...H,...n.textAreaTriggers]:H}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 ut(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(Ot(t).some(c=>s.includes(c.toLowerCase())))return{widget:"textarea",source:"heuristics"}}}}class it{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=ut(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 it;function Ut(t,n,a){return{name:t,factory:n,displayName:a?.displayName||t,priority:a?.priority??100,...a}}function Ht(t,n,a){return{name:a?.name||`custom-${t}`,factory:n,displayName:a?.displayName||`${t} widget`,priority:a?.priority??75,matcher:r=>r.definition.format===t,...a}}function Wt(t,n,a,r){return{name:r?.name||`custom-${t}-${n}`,factory:a,displayName:r?.displayName||`${t}:${n} widget`,priority:r?.priority??80,matcher:o=>{const s=o.definition;return s.type===t&&s.format===n},...r}}exports.Base64Input=bt;exports.Base64sInput=st;exports.Card=xt;exports.ColorSwatchInput=wt;exports.EditableText=Mt;exports.NullableDateInput=$t;exports.NullableDateTimeInput=Ct;exports.NullableEmailInput=_t;exports.NullablePasswordInput=At;exports.NullableRatingInput=Rt;exports.NullableSliderInput=Dt;exports.NullableTextArea=kt;exports.NullableTextInput=Tt;exports.NullableUUIDInput=vt;exports.NullableUrlInput=Bt;exports.RatingInput=lt;exports.SliderInput=Et;exports.Switch=Ft;exports.WidgetRegistry=it;exports.emptyToNull=W;exports.fileToBase64=at;exports.forFormat=Ht;exports.forTypeAndFormat=Wt;exports.forXUI=Ut;exports.formatColor=N;exports.getContrastRatio=gt;exports.getXUIConfig=ct;exports.globalWidgetRegistry=Lt;exports.hexToRgb=R;exports.hslToRgb=j;exports.hwbToRgb=tt;exports.isValidColor=mt;exports.isValidHexColor=P;exports.isValidHslColor=K;exports.isValidRgbColor=z;exports.isValidRgbaColor=Y;exports.linearToSrgb=B;exports.mulberry32=J;exports.normalizeHexColor=Q;exports.nullToEmpty=ot;exports.oklchToRgb=nt;exports.parseAnyColor=Z;exports.resolveEffectiveFormat=S;exports.resolveWidget=ut;exports.rgbToHex=O;exports.rgbToHsl=L;exports.rgbToHwb=et;exports.rgbToOklch=rt;exports.srgbToLinear=D;exports.toRgbaString=G;
@@ -1,4 +1,4 @@
1
- import { f as r } from "./translations-BUTBIDsS.js";
1
+ import { f as r } from "./translations-DQxouiBG.js";
2
2
  const d = {
3
3
  loadingExtended: "正在加载,请稍候",
4
4
  loadingShort: "加载中...",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tempots/beatui",
3
- "version": "0.69.0",
3
+ "version": "0.71.0",
4
4
  "type": "module",
5
5
  "main": "dist/index.umd.js",
6
6
  "module": "dist/index.es.js",
@@ -24,6 +24,12 @@
24
24
  "require": "./dist/json-schema/index.cjs.js",
25
25
  "default": "./dist/json-schema/index.es.js"
26
26
  },
27
+ "./json-structure": {
28
+ "types": "./dist/types/json-structure/index.d.ts",
29
+ "import": "./dist/json-structure/index.es.js",
30
+ "require": "./dist/json-structure/index.cjs.js",
31
+ "default": "./dist/json-structure/index.es.js"
32
+ },
27
33
  "./monaco": {
28
34
  "types": "./dist/types/monaco/index.d.ts",
29
35
  "import": "./dist/monaco/index.es.js",
@@ -137,6 +143,7 @@
137
143
  "@types/node": "22.15.18",
138
144
  "@typescript-eslint/eslint-plugin": "8.46.0",
139
145
  "@typescript-eslint/parser": "8.46.0",
146
+ "@vitest/coverage-v8": "^3.2.4",
140
147
  "eslint": "9.37.0",
141
148
  "eslint-config-prettier": "10.1.8",
142
149
  "jsdom": "26.1.0",
@@ -176,9 +183,10 @@
176
183
  "build:watch": "node scripts/build-css-entries.mjs && vite build --watch",
177
184
  "test": "vitest run",
178
185
  "test:watch": "vitest",
186
+ "test:coverage": "vitest run --coverage",
179
187
  "lint": "eslint . --ext .ts",
180
188
  "format": "prettier --write \"src/**/*.{ts,js,json,css,html,md}\"",
181
- "typecheck": "tsc --noEmit",
189
+ "typecheck": "tsc -p tsconfig.typecheck.json --noEmit",
182
190
  "clean": "rm -rf dist",
183
191
  "release:ensure-login": "node scripts/ensure-npm-login.mjs",
184
192
  "release:patch": "pnpm run release:ensure-login && pnpm run release:prepare && pnpm version patch && pnpm run release:publish && pnpm run release:commit",
@@ -1 +0,0 @@
1
- "use strict";const r=require("@tempots/dom"),w=require("./timer-DK_yKNwE.cjs"),q=require("./notice-CgT9ma2m.cjs"),O=require("./translations-hMQlZmD4.cjs"),_=["a[href]","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])",'[tabindex]:not([tabindex="-1"])','[contenteditable="true"]',"audio[controls]","video[controls]","details > summary:first-of-type","details[open]"].join(", ");function P(o){return Array.from(o.querySelectorAll(_)).filter(t=>{const s=t;return s.offsetWidth>0&&s.offsetHeight>0&&!s.hasAttribute("inert")&&window.getComputedStyle(s).visibility!=="hidden"})}function V(o={}){const{active:t=!0,escapeDeactivates:s=!0,onEscape:e,initialFocus:n,returnFocus:a,clickOutsideDeactivates:i=!1,onClickOutside:d}=o;return r.WithElement(p=>{let f=t,h=null,c=[];typeof document<"u"&&(h=document.activeElement);const v=()=>{c=P(p)},b=u=>{if(f){if(s&&u.key==="Escape"){u.preventDefault(),e?.();return}if(u.key==="Tab"){if(v(),c.length===0){u.preventDefault();return}const l=c.indexOf(document.activeElement);u.shiftKey?l<=0&&(u.preventDefault(),c[c.length-1]?.focus()):l>=c.length-1&&(u.preventDefault(),c[0]?.focus())}}},g=u=>{if(!f||!i)return;const l=u.target;p.contains(l)||d?.()},y=()=>{if(!f)return;v();let u=null;typeof n=="function"?u=n():n?u=n:c.length>0&&(u=c[0]),u&&setTimeout(()=>{u?.focus()},50),document.addEventListener("keydown",b,!0),i&&document.addEventListener("click",g,!0)},A=()=>{f=!1,document.removeEventListener("keydown",b,!0),document.removeEventListener("click",g,!0);let u=null;typeof a=="function"?u=a():a?u=a:h&&(u=h),u&&document.body.contains(u)&&setTimeout(()=>{u?.focus()},0)};return setTimeout(()=>y(),0),r.OnDispose(()=>{A()})})}function U(o={}){return{activate:()=>V({...o,active:!0}),deactivate:()=>V({...o,active:!1})}}function B({initialStatus:o="closed",openedAfter:t,closedAfter:s}){const e=r.prop(o),n=()=>{e.set("start-opening")},a=()=>{e.set("start-closing")},i=e.map(l=>l!=="closed"&&l!=="start-closing"&&l!=="closing"),d=l=>{l?n():a()},p=()=>{d(!i.value)},f=[],h=l=>{f.push(e.on(x=>{x==="closed"&&l()}))};let c=()=>{};e.on(l=>{switch(c(),l){case"start-opening":c=w.g(()=>e.set("opening"));break;case"opening":c=t(()=>e.set("opened"));break;case"start-closing":c=w.g(()=>e.set("closing"));break;case"closing":c=s(()=>e.set("closed"));break;case"closed":c=()=>{};break}}),e.onDispose(()=>{f.forEach(l=>l()),c()});const v=e.map(l=>l==="closed"),b=e.map(l=>l==="start-opening"),g=e.map(l=>l==="opening"),y=e.map(l=>l==="opened"),A=e.map(l=>l==="closing"),u=e.map(l=>l==="start-closing");return{status:e,open:n,close:a,toggle:p,setOpen:d,display:i,isClosed:v,isStartOpening:b,isOpening:g,isOpened:y,isClosing:A,isStartClosing:u,dispose:()=>e.dispose(),listenOnClosed:h}}function z({initialStatus:o="closed",duration:t,openDuration:s=t??500,closeDuration:e=t??500}={}){return B({initialStatus:o,openedAfter:n=>w.T(n,s),closedAfter:n=>w.T(n,e)})}function M(o,t){let s=!1,e=null;function n(){s||(s=!0,o.removeEventListener("transitionend",a),o.removeEventListener("animationend",i),e&&(clearTimeout(e),e=null),t())}function a(f){f.target===o&&n()}function i(f){f.target===o&&n()}const d=()=>{if(typeof o.getAnimations>"u"){e=setTimeout(n,16);return}o.addEventListener("transitionend",a),o.addEventListener("animationend",i),o.getAnimations().length===0&&(e=setTimeout(n,1e3))},p=w.g(d);return()=>{s=!0,p(),e&&(clearTimeout(e),e=null),o.removeEventListener("transitionend",a),o.removeEventListener("animationend",i)}}function F({initialStatus:o="closed",element:t}={}){let s=t;return{setElement:e=>{s=e},...B({initialStatus:o,openedAfter:e=>s==null?(e(),()=>{}):M(s,e),closedAfter:e=>s==null?(e(),()=>{}):M(s,e)})}}function R(o){if(o==null)return"";const t=[];return o.fade&&t.push("fade"),o.slide&&t.push(`slide-${o.slide}`),o.scale!=null&&t.push("scale"),t.length>0?t.join(" "):"none"}function H(o){if(o==null)return"";const t=[];return o.scale!=null&&typeof o.scale=="number"&&t.push(`--scale-factor: ${o.scale}`),o.transformOrigin!=null&&t.push(`--transform-origin: ${o.transformOrigin}`),o.duration!=null&&t.push(`--animation-duration: ${o.duration}ms`),o.easing!=null&&t.push(`--animation-easing: ${o.easing}`),t.join("; ")}function D({animation:o,status:t}){const s=r.computedOf(o,t)((n,a)=>{if(n==null)return`bc-animated-toggle bc-animated-toggle--${a}`;const i=a==="start-opening"||a==="opening"||a==="opened";let d;return"enter"in n||"exit"in n?d=i?n.enter:n.exit:d=n,`bc-animated-toggle bc-animated-toggle--${R(d)} bc-animated-toggle--${a}`}),e=r.computedOf(o,t)((n,a)=>{if(n==null)return"";const i=a==="start-opening"||a==="opening"||a==="opened";let d;return"enter"in n||"exit"in n?d=i?n.enter:n.exit:d=n,H(d)});return r.Fragment(r.attr.class(s),r.attr.style(e))}function K({initialStatus:o="closed",animation:t},s){return r.WithElement(e=>{const{setElement:n,dispose:a,...i}=F({initialStatus:o,element:e});return n(e),r.Fragment(D({status:i.status,animation:t}),r.OnDispose(a),s(i))})}function j(o){return{"~standard":{version:1,vendor:"beatui-custom",validate:s=>{const e=o.validate(s);return e.success?{value:e.data}:{issues:e.errors.map(n=>({message:n.message,path:n.path}))}},types:void 0},safeParse:s=>{const e=o.validate(s);return e.success?{success:!0,data:e.data}:{success:!1,error:{errors:e.errors.map(n=>({message:n.message,path:n.path?.map(a=>typeof a=="object"&&"key"in a?a.key.toString():a.toString())||[]}))}}}}}class k{optional(){return new N(this)}default(t){return new G(this,t)}schema(){return j(this)}}class T extends k{minLength;maxLength;pattern;customValidations=[];validate(t){if(typeof t!="string")return{success:!1,errors:[{message:"Expected string"}]};const s=[];this.minLength!==void 0&&t.length<this.minLength&&s.push({message:`Must be at least ${this.minLength} characters`}),this.maxLength!==void 0&&t.length>this.maxLength&&s.push({message:`Must be at most ${this.maxLength} characters`}),this.pattern&&!this.pattern.test(t)&&s.push({message:"Invalid format"});for(const e of this.customValidations){const n=e(t);n&&s.push({message:n})}return s.length>0?{success:!1,errors:s}:{success:!0,data:t}}min(t,s){const e=new T;return e.minLength=t,e.maxLength=this.maxLength,e.pattern=this.pattern,e.customValidations=[...this.customValidations],s&&e.customValidations.push(n=>n.length<t?s:null),e}max(t,s){const e=new T;return e.minLength=this.minLength,e.maxLength=t,e.pattern=this.pattern,e.customValidations=[...this.customValidations],s&&e.customValidations.push(n=>n.length>t?s:null),e}regex(t,s){const e=new T;return e.minLength=this.minLength,e.maxLength=this.maxLength,e.pattern=t,e.customValidations=[...this.customValidations],s&&e.customValidations.push(n=>t.test(n)?null:s),e}email(t="Please enter a valid email address"){const s=/^[^\s@]+@[^\s@]+\.[^\s@]+$/,e=new T;return e.minLength=this.minLength,e.maxLength=this.maxLength,e.pattern=this.pattern,e.customValidations=[...this.customValidations,n=>s.test(n)?null:t],e}refine(t){const s=new T;return s.minLength=this.minLength,s.maxLength=this.maxLength,s.pattern=this.pattern,s.customValidations=[...this.customValidations,t],s}}class C extends k{mustBeTrue=!1;trueMessage;validate(t){return typeof t!="boolean"?{success:!1,errors:[{message:"Expected boolean"}]}:this.mustBeTrue&&t!==!0?{success:!1,errors:[{message:this.trueMessage||"Must be true"}]}:{success:!0,data:t}}refine(t,s){const e=new C;e.mustBeTrue=this.mustBeTrue,e.trueMessage=this.trueMessage;const n=e.validate.bind(e);return e.validate=a=>{const i=n(a);return i.success?t(i.data)?i:{success:!1,errors:[{message:s}]}:i},e}literal(t,s){const e=new C;return e.mustBeTrue=!0,e.trueMessage=s,e}}class N extends k{constructor(t){super(),this.inner=t}validate(t){if(t===void 0)return{success:!0,data:void 0};const s=this.inner.validate(t);return s.success?{success:!0,data:s.data}:{success:!1,errors:s.errors}}}class G extends k{constructor(t,s){super(),this.inner=t,this.defaultValue=s}validate(t){return t===void 0?{success:!0,data:this.defaultValue}:this.inner.validate(t)}}class $ extends k{constructor(t){super(),this.shape=t}validate(t){if(typeof t!="object"||t===null||Array.isArray(t))return{success:!1,errors:[{message:"Expected object"}]};const s=t,e={},n=[];for(const[a,i]of Object.entries(this.shape)){const d=i.validate(s[a]);if(d.success)e[a]=d.data;else for(const p of d.errors)n.push({message:p.message,path:[a,...p.path||[]]})}return n.length>0?{success:!1,errors:n}:{success:!0,data:e}}refine(t,s){const e=new $(this.shape),n=e.validate.bind(e);return e.validate=a=>{const i=n(a);if(!i.success)return i;const d=t(i.data);return d?{success:!1,errors:[{message:d,path:s?.path}]}:{success:!0,data:i.data}},e}}const J=()=>new T,Q=()=>new C,X=o=>new $(o);function I(o){return r.WithBrowserCtx(t=>{const s=[],e=()=>s.forEach(a=>a());return o(({effect:a="opaque",mode:i="capturing",onClickOutside:d,onEscape:p,content:f,container:h="body"})=>{h==="body"&&(t=t.makePortal("body"));const c=F();c.listenOnClosed(e);let v=()=>{},b=()=>{};const g=E=>{E.key==="Escape"&&(p?.(),c.close())},y=()=>{d?.(),c.close()},A=E=>{v(),b(),E==="capturing"?(document.addEventListener("keydown",g),v=()=>document.removeEventListener("keydown",g),t.element.addEventListener("mousedown",y),b=()=>t.element.removeEventListener("mousedown",y)):(v=()=>{},b=()=>{})},u=r.Value.on(i,A);s.push(u),s.push(()=>{c.dispose(),v(),b()});const l=()=>{const E=new Set;for(const m of t.element.querySelectorAll(":scope > :not([data-overlay])"))m.hasAttribute("inert")?E.add(m):m.setAttribute("inert","");return s.push(()=>{for(const m of t.element.querySelectorAll(":scope > :not([data-overlay])"))E.has(m)||m.removeAttribute("inert");E.clear()}),document.activeElement?.blur?.(),r.html.div(r.WithElement(m=>c.setElement(m)),r.dataAttr.status(c.status.map(String)),r.dataAttr.overlay("true"),r.attr.class(r.computedOf(a??"opaque",i)((m,L)=>`bc-overlay bc-overlay--effect-${m} bc-overlay--mode-${L}`)),f)},x=r.render(l(),t.element,{disposeWithParent:!0,clear:!1,providers:t.providers});s.push(x),w.g(()=>c.open())},e)})}function W(o,t){const{size:s="md",dismissable:e=!0,showCloseButton:n=!0,onClose:a,overlayEffect:i="opaque",container:d="body",position:p="center"}=o;return I((f,h)=>{let c=()=>{};return t(g=>{c=h;const y=r.prop("capturing");r.Value.on(e,m=>{y.set(m?"capturing":"non-capturing")});const A=r.computedOf(g.header!=null,n)((m,L)=>m||L),u=q.sessionId("modal"),l=`${u}-header`,x=`${u}-body`,E=r.html.div(r.attr.class(r.computedOf(s,p)((m,L)=>`bc-modal bc-modal--size-${m} bc-modal--container-${d} bc-modal--position-${L}`)),r.attr.role("dialog"),r.aria.modal(!0),...g.header?[r.aria.labelledby(l)]:[],r.aria.describedby(x),r.attr.tabindex(-1),r.attr.id(u),r.dataAttr.focusTrap("true"),r.on.mousedown(m=>m.stopPropagation()),V({escapeDeactivates:!1,initialFocus:()=>{const m=document.getElementById(u);if(!m)return null;const L=m.querySelector('[aria-label="Close modal"]');if(L)return L;const S=m.querySelector('button, input, select, textarea, [tabindex]:not([tabindex="-1"])');return S||m}}),r.html.div(r.attr.class("bc-modal__content"),r.When(A,()=>r.html.div(r.attr.class("bc-modal__header"),r.html.div(r.attr.class("bc-modal__title"),...g.header?[r.attr.id(l)]:[],g.header),r.When(n,()=>r.Use(O.BeatUII18n,m=>q.CloseButton({size:"sm",label:m.$.closeModal,onClick:()=>{c(),h()}}))))),r.html.div(r.attr.class("bc-modal__body"),r.attr.id(x),g.body),g.footer&&r.html.div(r.attr.class("bc-modal__footer"),g.footer)));f({mode:y,effect:i??"opaque",container:d,content:E,onClickOutside:()=>{a?.(),h()},onEscape:()=>{a?.(),h()}})},()=>{c(),h()})})}function Y(o,t){const{confirmText:s,cancelText:e,onConfirm:n,onCancel:a,...i}=o;return r.Use(O.BeatUII18n,d=>W({showCloseButton:!1,...i},(p,f)=>{const h=()=>{n?.(),f()},c=()=>{a?.(),f()};return t(b=>{p({body:b,footer:r.Fragment(r.attr.class("bc-modal__actions"),O.Button({variant:"outline",onClick:c},r.coalesce(e,d.$.cancel)),O.Button({color:"primary",variant:"filled",onClick:h},r.coalesce(s,d.$.confirm)))})},f)}))}exports.AnimatedToggle=K;exports.AnimatedToggleClass=D;exports.BooleanValidator=C;exports.ConfirmModal=Y;exports.FocusTrap=V;exports.Modal=W;exports.ObjectValidator=$;exports.Overlay=I;exports.StringValidator=T;exports.boolean=Q;exports.createStandardSchema=j;exports.object=X;exports.string=J;exports.useAnimatedElementToggle=F;exports.useAnimatedToggle=B;exports.useFocusTrap=U;exports.useTimedToggle=z;
@@ -1,2 +0,0 @@
1
- "use strict";const s=require("@tempots/dom"),v=require("./translations-hMQlZmD4.cjs"),L=new Map;function D(e){const t=L.get(e)??0;return L.set(e,t+1),`${e}-${t}`}const y={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 y.isSuccess(e)?e.value:t},getOrElseLazy(e,t){return y.isSuccess(e)?e.value:t()},getOrNull(e){return y.isSuccess(e)?e.value:null},getOrUndefined(e){return y.isSuccess(e)?e.value:void 0},getUnsafe:e=>{if(y.isSuccess(e))return e.value;throw y.isFailure(e)?e.error:new Error("Cannot get value from a not-asked or loading result")},match:(e,{success:t,failure:n,loading:r,notAsked:a=r})=>y.isSuccess(e)?t(e.value):y.isFailure(e)?n(e.error):y.isNotAsked(e)?a():r(e.previousValue),whenSuccess:(e,t)=>(y.isSuccess(e)&&t(e.value),e),whenFailure:(e,t)=>(y.isFailure(e)&&t(e.error),e),equals:(e,t,n={valueEquals:(r,a)=>r===a,errorEquals:(r,a)=>r===a})=>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(y.isSuccess(n))t.push(n.value);else return n;return y.success(t)},ofPromise:async e=>{try{const t=await e;return y.success(t)}catch(t){return y.failure(t instanceof Error?t:new Error(String(t)))}}},T=(e,t)=>e===t||e!==e&&t!==t,k={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)=>k.isValid(e)?t():n(e.error),toResult:(e,t)=>k.match(e,()=>f.success(t),n=>f.failure(n)),whenValid:(e,t)=>(k.isValid(e)&&t(),e),whenInvalid:(e,t)=>(k.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=>y.success(t),t=>y.failure(t))},toValidation(e){return f.match(e,()=>k.valid,t=>k.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,r)=>f.match(e,a=>f.match(t,i=>f.success(n(a,i)),i=>f.failure(i)),a=>f.match(t,i=>f.failure(a),i=>f.failure(r(a,i)))),equals:(e,t,n={valueEquals:(r,a)=>r===a,errorEquals:(r,a)=>r===a})=>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 N({size:e="sm",icon:t="line-md:close",disabled:n,roundedness:r="full",color:a="base",onClick:i,label:o},...l){return s.Use(v.BeatUII18n,c=>{const p=s.coalesce(o,c.$.closeModal);return v.Button({variant:"text",size:e,roundedness:r,disabled:n,color:a,onClick:i},s.attr.title(p),s.aria.label(p),...l,v.Icon({icon:t,size:e??"sm"}))})}function F(e){return`bc-label bc-label--${e}`}const ee=(...e)=>s.html.span(s.attr.class(F("emphasis")),...e),j=(...e)=>s.html.span(s.attr.class(F("default")),...e),q=(...e)=>s.html.span(s.attr.class(F("muted")),...e),te=(...e)=>s.html.span(s.attr.class(F("danger")),...e),se=e=>{const{value:t,onBlur:n,onChange:r,placeholder:a,disabled:i,id:o,checkedIcon:l,uncheckedIcon:c,iconSize:p="lg"}=e,h=o??D("checkbox"),m=`${h}-label`,w=()=>{if(s.Value.get(i??!1))return;const u=s.Value.get(t);r?.(!u)},b=u=>{s.Value.get(i??!1)||(u.key===" "||u.key==="Enter")&&(u.preventDefault(),w())};return v.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,u=>u?"bc-checkbox-input__checkbox--checked":"bc-checkbox-input__checkbox--unchecked")),s.attr.class(s.Value.map(i??!1,u=>u?"bc-checkbox-input__checkbox--disabled":"")),s.attr.id(h),s.attr.role("checkbox"),s.attr.tabindex(s.Value.map(i??!1,u=>u?-1:0)),s.aria.checked(t),s.aria.disabled(i),a!=null?s.aria.labelledby(m):s.Empty,s.on.keydown(b),n!=null?s.on.blur(n):s.Empty,v.Icon({icon:s.computedOf(t,l,c)((u,d,g)=>u?d??"akar-icons/check-box-fill":g??"akar-icons/box"),accessibility:"decorative",size:p})),a!=null?s.html.label(s.attr.class("bc-checkbox-input__label"),s.attr.id(m),s.attr.for(h),q(a)):s.Empty)},s.on.click(w))},U=s.html.span(s.attr.class("bc-input-wrapper__required")," *");function ne(e){const t=["bc-input-wrapper"];return e!=="vertical"&&t.push(`bc-input-wrapper--${e}`),t.join(" ")}function re(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 ae(e,t){if(e==="horizontal-fixed"&&t!=null)return`--input-wrapper-label-width: ${t}`}const P=({fullWidth:e=!1,required:t,label:n,labelChildren:r,context:a,description:i,content:o,error:l,labelFor:c,hasError:p,disabled:h,layout:m,labelWidth:w},...b)=>{const u=p??l!=null,d=h??!1,g=m??"vertical",I=D("input-wrapper"),C=i?`${I}-description`:void 0,_=l!=null?`${I}-error`:void 0,A=s.computedOf(g)(S=>S!=="vertical"),Z=s.computedOf(g,w??void 0)((S,V)=>ae(S,V));return s.html.div(s.attr.class(s.Value.map(g,S=>ne(S))),s.attr.class(s.Value.map(e,S=>S?"bc-input-wrapper--full-width":"")),s.attr.style(Z),n!=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"),c!=null?s.attr.for(c):s.Empty,s.html.span(s.attr.class(s.computedOf(u,d)((S,V)=>re(S??!1,V??!1))),n),n!=null&&t?U:s.Empty),s.When(s.computedOf(A,i)((S,V)=>S&&V!=null),()=>s.html.div(s.attr.class("bc-input-wrapper__description bc-input-wrapper__description--under-label"),s.attr.id(C),i))),a!=null?j(a):s.Empty,r):s.Empty,s.html.div(s.attr.class("bc-input-wrapper__content"),[C,_].filter(Boolean).length>0?s.dataAttr.describedby([C,_].filter(Boolean).join(" ")):s.Empty,t?s.dataAttr.required("true"):s.Empty,s.When(u,()=>s.dataAttr.invalid("true")),o),s.When(s.computedOf(A,i)((S,V)=>!S&&V!=null),()=>s.html.div(s.attr.class("bc-input-wrapper__description"),s.attr.id(C),i)),s.When(u,()=>s.html.div(s.attr.class("bc-input-wrapper__error"),s.attr.id(_),s.aria.live("polite"),s.attr.role("alert"),l)),...b)};function ie(...e){return s.html.div(s.attr.class("bc-stack"),...e)}const le=e=>{const t={name:"email",autocomplete:"email",...e},{value:n,before:r,onBlur:a,onChange:i,onInput:o,placeholder:l}=t,c=r??v.InputIcon({icon:"line-md:email",size:e.size,color:"neutral"});return s.Use(v.BeatUII18n,p=>v.InputContainer({...e,before:c,input:s.input.email(v.CommonInputAttributes(t),s.attr.placeholder(s.coalesce(l,p.$.emailPlaceholderText)),s.attr.value(n),s.attr.class("bc-input"),a!=null?s.on.blur(s.emitValue(a)):s.Empty,i!=null?s.on.change(s.emitValue(i)):s.Empty,o!=null?s.on.input(s.emitValue(o)):s.Empty)}))},oe=e=>{const{value:t,onBlur:n,onChange:r,onInput:a,before:i,after:o,hasError:l,disabled:c,autocomplete:p,placeholder:h,...m}=e,w={name:"password",disabled:c,...m},b=s.prop(!0),u=s.computedOf(b,p)((d,g)=>d?g??"current-password":"off");return s.Use(v.BeatUII18n,d=>{const g=s.computedOf(d.$.passwordPlaceholderText,b,h)((C,_,A)=>_?"•••••••••••••••":A??C),I=s.html.button(s.attr.type("button"),s.attr.class("bc-input-container__password-toggle"),s.aria.label(d.$.togglePasswordVisibility),s.on.click(()=>b.update(C=>!C)),s.When(b,()=>v.Icon({icon:"line-md:watch"}),()=>v.Icon({icon:"line-md:watch-off"})));return v.InputContainer({before:i,disabled:c,hasError:l,input:s.html.input(v.CommonInputAttributes({...w,autocomplete:u,placeholder:g}),s.When(b,()=>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,r!=null?s.on.change(s.emitValue(r)):s.Empty,a!=null?s.on.input(s.emitValue(a)):s.Empty),after:o!=null?s.Fragment(I,o):I})})},W=(e,t)=>()=>{e.markTouched(),t?.()},M=(e,t)=>n=>{e.change(n),t?.(n)};function $(e,t){const{controller:n,onBlur:r,onChange:a,id:i,triggerOn:o,...l}=t;return e({id:i??n.name,disabled:n.disabled,value:n.signal,hasError:n.errorVisible,name:n.name,...l,onInput:o==="input"?M(n,a):void 0,onChange:o!=="input"?M(n,a):void 0,onBlur:W(n,r)})}function ce(e,{id:t,labelFor:n,...r},...a){const i=t??r.controller.name??D("control"),o=n??i;return P({...r,hasError:r.controller.errorVisible,error:s.TextNode(r.controller.error.map(l=>l??"")),labelFor:o,content:$(l=>e({...l,id:i}),r)},...a)}function z(e,t){const{toInput:n,fromInput:r,controller:a,...i}=t,o=a.transform(n,r);return $(e,{...i,controller:o})}function ue(e,{id:t,labelFor:n,...r},...a){const i=t??r.controller.name??D("control");return P({...r,labelFor:n??i,content:z(e,{...r,id:i})},...a)}function he(e){return e.split(".").map(n=>{const r=n.match(/^\[(\d+)\]$/);return r?Number(r[1]):n})}function H(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(H)].join("")}function O(e){return function(n){if(n.type==="valid")return n;let r=n.error;for(const a of e)if(r=r?.dependencies?.[a],r==null)return k.valid;return k.invalid(r)}}class E{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,r,a,i,o=T){this.path=t,this.change=n,this.signal=r,this.status=a,this.#s=o,this.#t.set(r.value),this.error=a.map(l=>l?.type==="invalid"?l.error?.message:void 0),this.hasError=this.error.map(l=>l!=null),this.touched=this.#e.touched,i.validationMode?this.errorVisible=s.computedOf(this.hasError,this.touched,i.validationMode)((l,c,p)=>p==="eager"?!!l:!!l&&!!c):this.errorVisible=s.computedOf(this.hasError,this.touched)((l,c)=>!!l&&!!c),this.dirty=s.computedOf(this.signal,this.#t)((l,c)=>!this.#s(l,c)),this.dependencyErrors=a.map(l=>l?.type==="invalid"?l.error?.dependencies:void 0),this.parent=i,this.disabled=s.computedOf(this.#e.disabled,i.disabled)((l,c)=>l||c),this.disabledOrHasErrors=s.computedOf(this.disabled,this.hasError)((l,c)=>l||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=T)=>new G(this.path,this.change,this.signal,this.status,this.parent,t);object=(t=T)=>new K(this.path,this.change,this.signal,this.status,this.parent,t);transform=(t,n,r=[],a=T)=>new E([...this.path,...r],i=>this.change(n(i)),this.signal.map(t,a),this.status.map(O(r)),this.parent,a);asyncTransform=(t,n,r,a=[],i=T)=>new E([...this.path,...a],o=>{n(o).then(l=>this.change(l))},this.signal.mapAsync(t,r,void 0,i),this.status.map(O(a)),this.parent,i)}class K extends E{#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,r,a,i,o){super(t,n,r.map(c=>c??{},o),a,i,o),this.#c=this.touched.on(()=>{this.#o()}),this.#u=this.dirty.on(()=>{this.#i()});const l=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(),l()})}field=t=>{if(this.#e.has(t))return this.#e.get(t);const n=async o=>{this.change({...this.signal.value,[t]:o})},r=new E([...this.path,t],n,this.signal.map(o=>o[t]),this.status.map(O([t])),{disabled:this.disabled,validationMode:this.parent.validationMode});this.#e.set(t,r);const a=r.touched.on(o=>{this.#s.set(t,o),this.#o()});this.#t.set(t,a);const i=r.dirty.on(o=>{this.#a.set(t,o),this.#i()});return this.#r.set(t,i),r};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 E{#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,r,a,i,o){const l=r.map(h=>h??[],o);super(t,n,l,a,i,o);const c=l.on(h=>{const m=this.#e.length-h.length;m>0&&(this.#e.splice(h.length,m).forEach((w,b)=>{const u=h.length+b;w.dispose(),this.#t.get(u)?.(),this.#t.delete(u),this.#s.delete(u),this.#r.get(u)?.(),this.#r.delete(u),this.#a.delete(u)}),this.#o(),this.#i())});this.length=l.map(h=>h.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 h of this.#e)h.dispose();this.length.dispose(),this.#e.length=0,c(),l.dispose();for(const h of this.#t.values())h();this.#t.clear(),this.#s.clear(),this.#n.dispose();for(const h of this.#r.values())h();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 o=>{const l=this.signal.value.slice();l[t]=o,this.change(l)},r=new E([...this.path,t],n,this.signal.map(o=>o[t]),this.status.map(O([t])),{disabled:this.disabled,validationMode:this.parent.validationMode});this.#e[t]=r;const a=r.touched.on(o=>{this.#s.set(t,o),this.#o()});this.#t.set(t,a);const i=r.dirty.on(o=>{this.#a.set(t,o),this.#i()});return this.#r.set(t,i),r};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 r=this.signal.value.slice();r.splice(t,n),this.change(r)};move=(t,n,r=1)=>{if(r<1||t===n)return;const a=this.signal.value.slice(),i=a.splice(t,r);a.splice(n,0,...i),this.change(a)};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(a=>a.path==null||a.path.length===0).map(a=>a.message),n=e.filter(a=>a.path!=null&&a.path.length>0).reduce((a,i)=>{const o=J(i.path),l=o.pop();let c=a;for(const p of o)c.dependencies==null&&(c.dependencies={}),c.dependencies[p]==null&&(c.dependencies[p]={}),c=c.dependencies[p];return c.dependencies==null&&(c.dependencies={}),c.dependencies[l]={message:i.message},a},{}),r=t.join(`
2
- `);return{...n,message:r!=""?r:void 0}}function X({initialValue:e,onChange:t,validate:n,equals:r,validationMode:a,validateDebounceMs:i}){const o=s.Value.deriveProp(e),l=s.prop(k.valid),c=s.prop(!1),p=s.prop(a??"onTouched"),h=d=>{l.set(d)};let m;const w=async d=>{if(n!=null){const g=await n(d);h(g)}},b=async d=>{o.set(d),t?.(d);const g=p.value;if(n!=null){if(g==="onSubmit")return;const I=i??0;I>0?(m&&clearTimeout(m),m=setTimeout(()=>{w(d)},I)):await w(d)}},u=new E([],b,o,l,{disabled:c,validationMode:p},r??T);return u.onDispose(()=>{c.dispose(),o.dispose(),l.dispose(),p.dispose(),m&&clearTimeout(m)}),{controller:u,setStatus:h}}function x(e){return s.Fragment(s.attr.disabled(e.disabled),s.attr.name(e.name))}function de(e,{triggerOn:t="change"}={}){return s.Fragment(x(e),s.attr.value(e.signal),(t==="input"?s.on.input:s.on.change)(s.emitValue(e.change)))}function pe(e,{triggerOn:t="change"}={}){return s.Fragment(x(e),s.attr.valueAsNumber(e.signal),(t==="input"?s.on.input:s.on.change)(s.emitValueAsNumber(e.change)))}function B(e){return e.issues!=null?k.invalid(Q(e.issues)):k.valid}async function me({task:e,errorMessage:t,errorPath:n=["root"],validation:r}){try{const a=await e();return r!=null?r(a):k.valid}catch(a){const i=t??(a instanceof Error?a.message:"Operation failed");return n.length===1&&n[0]==="root"?k.invalid({message:i}):k.invalid({dependencies:Y(n,i)})}}function Y(e,t){if(e.length===1)return{[e[0]]:{message:t}};const[n,...r]=e;return{[n]:{dependencies:Y(r,t)}}}function fe({initialValue:e={},schema:t,onSubmit:n=async()=>k.valid,validationMode:r,validateDebounceMs:a}){const{controller:i,setStatus:o}=X({initialValue:e,validationMode:r??"onTouched",validateDebounceMs:a,validate:(r??"onTouched")==="onSubmit"||t==null?void 0:async h=>B(await t["~standard"].validate(h))}),l=s.prop(!1),c=i.object();return c.onDispose(l.dispose),{controller:c,setStatus:o,submit:async h=>{if(l.set(!0),h?.preventDefault(),c.markAllTouched(),t!=null){const w=c.signal.value,b=B(await t["~standard"].validate(w));if(o(b),b.type==="invalid"){l.set(!1);return}}const m=await n(c.signal.value);l.set(!1),m.type==="invalid"&&o(m)},submitting:l}}function be(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 ge(e){switch(e){case"success":return"success";case"warning":return"warning";case"danger":return"danger";case"info":default:return"info"}}function ye(e,t,n,r){const a=["bc-notice",`bc-notice--${e}`,`bc-notice--tone-${t}`];return n&&a.push("bc-notice--dismissible"),r&&r.length>0&&a.push(r),a.join(" ")}function ve({variant:e="info",tone:t="subtle",role:n,title:r,icon:a,closable:i=!1,onDismiss:o,class:l},...c){const p=s.prop(!0);return s.When(p,()=>{const h=s.Value.map(i,u=>!!u||o!=null),m=s.Value.map(e,u=>u??"info"),w=s.Value.map(t,u=>u??"subtle"),b=s.computedOf(n,m)((u,d)=>u??(d==="danger"?"alert":"status"));return s.Use(v.BeatUII18n,u=>s.html.div(s.attr.class(s.computedOf(m,w,h,l)((d,g,I,C)=>ye(d,g,I,C))),s.attr.role(s.Value.map(b,d=>d)),s.Unless(s.Value.map(a,d=>d===!1),()=>s.html.div(s.attr.class("bc-notice__icon"),v.Icon({icon:s.computedOf(a,m)((d,g)=>d===void 0?be(g):String(d)),size:"md",color:s.Value.map(m,ge)}))),s.html.div(s.attr.class("bc-notice__body"),s.Ensure(r,d=>s.html.div(s.attr.class("bc-notice__title"),d)),s.html.div(s.attr.class("bc-notice__content"),...c)),s.When(h,()=>N({size:"xs",label:u.$.closeModal,onClick:()=>{p.set(!1),o?.()}}))))})}exports.ArrayController=G;exports.BaseControl=$;exports.BaseMappedControl=z;exports.CheckboxInput=se;exports.CloseButton=N;exports.Control=ce;exports.Controller=E;exports.DangerLabel=te;exports.EmailInput=le;exports.EmphasisLabel=ee;exports.InputWrapper=P;exports.Label=j;exports.MappedControl=ue;exports.MutedLabel=q;exports.Notice=ve;exports.O=T;exports.ObjectController=K;exports.PasswordInput=oe;exports.RequiredSymbol=U;exports.Stack=ie;exports.a=k;exports.connectCommonAttributes=x;exports.connectNumberInput=pe;exports.connectStringInput=de;exports.convertStandardSchemaIssues=Q;exports.convertStandardSchemaPathToPath=J;exports.makeMapValidation=O;exports.makeOnBlurHandler=W;exports.makeOnChangeHandler=M;exports.parsePath=he;exports.pathToString=R;exports.sessionId=D;exports.standardSchemaResultToValidation=B;exports.taskToValidation=me;exports.useController=X;exports.useForm=fe;exports.wrapSegment=H;
@@ -1 +0,0 @@
1
- "use strict";const t=require("@tempots/dom"),qt=require("./colors-B9fcMxa_.cjs"),Yt=require("./timer-DK_yKNwE.cjs"),at=require("@tempots/ui"),I=require("./translations-hMQlZmD4.cjs"),E=require("./notice-CgT9ma2m.cjs");function st(e){if(typeof e!="string")return!1;const n=e.startsWith("#")?e.slice(1):e;return/^[0-9A-Fa-f]{3}$|^[0-9A-Fa-f]{6}$/.test(n)}function gt(e){if(typeof e!="string")return!1;const n=/^rgb\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*\)$/i,r=e.match(n);if(!r)return!1;const[,a,s,o]=r,l=parseInt(a,10),u=parseInt(s,10),i=parseInt(o,10);return l>=0&&l<=255&&u>=0&&u<=255&&i>=0&&i<=255}function ht(e){if(typeof e!="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,r=e.match(n);if(!r)return!1;const[,a,s,o,l]=r,u=parseInt(a,10),i=parseInt(s,10),c=parseInt(o,10),p=parseFloat(l);return u>=0&&u<=255&&i>=0&&i<=255&&c>=0&&c<=255&&p>=0&&p<=1}function bt(e){if(typeof e!="string")return!1;const n=/^hsl\(\s*(\d{1,3})\s*,\s*(\d{1,3})%\s*,\s*(\d{1,3})%\s*\)$/i,r=e.match(n);if(!r)return!1;const[,a,s,o]=r,l=parseInt(a,10),u=parseInt(s,10),i=parseInt(o,10);return l>=0&&l<=360&&u>=0&&u<=100&&i>=0&&i<=100}function Gt(e){return st(e)||gt(e)||ht(e)||bt(e)}function yt(e){if(!st(e))return null;let n=e.startsWith("#")?e.slice(1):e;return n.length===3&&(n=n.split("").map(r=>r+r).join("")),`#${n.toLowerCase()}`}function G(e,n,r){const a=s=>{const o=Math.round(Math.max(0,Math.min(255,s))).toString(16);return o.length===1?"0"+o:o};return`#${a(e)}${a(n)}${a(r)}`}function z(e){const n=yt(e);if(!n)return null;const r=/^#([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(n);return r?{r:parseInt(r[1],16),g:parseInt(r[2],16),b:parseInt(r[3],16)}:null}function Qt(e,n){const r=z(e),a=z(n);if(!r||!a)return null;const s=(c,p,f)=>{const[h,m,v]=[c,p,f].map(w=>(w=w/255,w<=.03928?w/12.92:Math.pow((w+.055)/1.055,2.4)));return .2126*h+.7152*m+.0722*v},o=s(r.r,r.g,r.b),l=s(a.r,a.g,a.b),u=Math.max(o,l),i=Math.min(o,l);return(u+.05)/(i+.05)}function vt(e){if(!e)return[0,0,0,1];const r=e.trim().match(/^#?([a-fA-F0-9]{3,4}|[a-fA-F0-9]{6}|[a-fA-F0-9]{8})$/);if(r){const c=r[1];if(c.length===8){const p=parseInt(c.slice(0,2),16),f=parseInt(c.slice(2,4),16),h=parseInt(c.slice(4,6),16),m=parseInt(c.slice(6,8),16)/255;return[p,f,h,m]}if(c.length===6)return[parseInt(c.slice(0,2),16),parseInt(c.slice(2,4),16),parseInt(c.slice(4,6),16),1];if(c.length===4){const p=parseInt(c[0]+c[0],16),f=parseInt(c[1]+c[1],16),h=parseInt(c[2]+c[2],16),m=parseInt(c[3]+c[3],16)/255;return[p,f,h,m]}if(c.length===3){const p=parseInt(c[0]+c[0],16),f=parseInt(c[1]+c[1],16),h=parseInt(c[2]+c[2],16);return[p,f,h,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 s=e.match(/^rgb\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*\)$/i);if(s)return[parseInt(s[1],10),parseInt(s[2],10),parseInt(s[3],10),1];const o=e.match(/^hsla?\(\s*([+-]?[\d.]+)(?:deg)?\s*[ ,]?\s*([\d.]+)%\s*[ ,]?\s*([\d.]+)%\s*(?:[/,]\s*(\d?(?:\.\d+)?))?\s*\)$/i);if(o){const c=parseFloat(o[1]),p=parseFloat(o[2]),f=parseFloat(o[3]),h=o[4]!=null?parseFloat(o[4]):1,[m,v,w]=lt(c,p/100,f/100);return[m,v,w,h]}const l=e.match(/^hwb\(\s*([+-]?[\d.]+)(?:deg)?\s*[, ]\s*([\d.]+)%\s*[, ]\s*([\d.]+)%\s*(?:[/]\s*(\d?(?:\.\d+)?))?\s*\)$/i);if(l){const c=parseFloat(l[1]),p=parseFloat(l[2])/100,f=parseFloat(l[3])/100,h=l[4]!=null?parseFloat(l[4]):1,[m,v,w]=It(c,p,f);return[m,v,w,h]}const u=e.match(/^oklch\(\s*([+-]?[\d.]+%?)\s+([\d.]+)\s+([+-]?[\d.]+)(?:deg)?(?:\s*\/\s*(\d?(?:\.\d+)?))?\s*\)$/i);if(u){const c=u[1],p=parseFloat(u[2]),f=parseFloat(u[3]),h=u[4]!=null?parseFloat(u[4]):1,m=c.endsWith("%")?Math.max(0,Math.min(1,parseFloat(c)/100)):Math.max(0,Math.min(1,parseFloat(c))),[v,w,x]=Ct(m,p,f);return[v,w,x,h]}const i=z(e);return i?[i.r,i.g,i.b,1]:[0,0,0,1]}function xt(e,n,r,a){return`rgba(${Math.round(e)}, ${Math.round(n)}, ${Math.round(r)}, ${Math.max(0,Math.min(1,Math.round(a*100)/100))})`}function wt(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 lt(e,n,r){e=(e%360+360)%360;const a=(1-Math.abs(2*r-1))*n,s=a*(1-Math.abs(e/60%2-1)),o=r-a/2;let l=0,u=0,i=0;return 0<=e&&e<60?[l,u,i]=[a,s,0]:60<=e&&e<120?[l,u,i]=[s,a,0]:120<=e&&e<180?[l,u,i]=[0,a,s]:180<=e&&e<240?[l,u,i]=[0,s,a]:240<=e&&e<300?[l,u,i]=[s,0,a]:[l,u,i]=[a,0,s],[Math.round((l+o)*255),Math.round((u+o)*255),Math.round((i+o)*255)]}function It(e,n,r){e=(e%360+360)%360;const a=n+r;a>1&&(n/=a,r/=a);const[s,o,l]=lt(e,1,.5).map(f=>f/255),u=1-n-r,i=s*u+n,c=o*u+n,p=l*u+n;return[Math.round(i*255),Math.round(c*255),Math.round(p*255)]}function Q(e,n,r){e/=255,n/=255,r/=255;const a=Math.max(e,n,r),s=Math.min(e,n,r);let o=0,l=0;const u=(a+s)/2,i=a-s;if(i!==0){switch(l=u>.5?i/(2-a-s):i/(a+s),a){case e:o=(n-r)/i+(n<r?6:0);break;case n:o=(r-e)/i+2;break;default:o=(e-n)/i+4}o*=60}return[Math.round(o),Math.round(l*100),Math.round(u*100)]}function Vt(e,n,r){const[a]=Q(e,n,r),s=e/255,o=n/255,l=r/255,u=Math.min(s,o,l),i=1-Math.max(s,o,l);return[a,Math.round(u*100),Math.round(i*100)]}function X(e){const n=e/255;return n<=.04045?n/12.92:Math.pow((n+.055)/1.055,2.4)}function q(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 Ct(e,n,r){const a=r*Math.PI/180,s=Math.cos(a)*n,o=Math.sin(a)*n,l=e+.3963377774*s+.2158037573*o,u=e-.1055613458*s-.0638541728*o,i=e-.0894841775*s-1.291485548*o,c=l*l*l,p=u*u*u,f=i*i*i,h=4.0767416621*c-3.3077115913*p+.2309699292*f,m=-1.2684380046*c+2.6097574011*p-.3413193965*f,v=-.0041960863*c-.7034186147*p+1.707614701*f;return[q(h),q(m),q(v)]}function _t(e,n,r){const a=X(e),s=X(n),o=X(r),l=.4122214708*a+.5363325363*s+.0514459929*o,u=.2119034982*a+.6806995451*s+.1073969566*o,i=.0883024619*a+.2817188376*s+.6299787005*o,c=Math.cbrt(l),p=Math.cbrt(u),f=Math.cbrt(i),h=.2104542553*c+.793617785*p-.0040720468*f,m=1.9779984951*c-2.428592205*p+.4505937099*f,v=.0259040371*c+.7827717662*p-.808675766*f,w=Math.sqrt(m*m+v*v);let x=Math.atan2(v,m)*180/Math.PI;return x<0&&(x+=360),[h,w,x]}function R(e,n,r,a,s,o){switch(s){case"hex":if(o){const l=i=>i.toString(16).padStart(2,"0"),u=Math.max(0,Math.min(255,Math.round(a*255)));return`#${l(e)}${l(n)}${l(r)}${l(u)}`}return G(e,n,r);case"rgb":return`rgb(${e}, ${n}, ${r})`;case"rgba":return`rgba(${e}, ${n}, ${r}, ${Math.round(a*100)/100})`;case"hsl":{const[l,u,i]=Q(e,n,r);return`hsl(${l}, ${u}%, ${i}%)`}case"hsla":{const[l,u,i]=Q(e,n,r);return`hsla(${l}, ${u}%, ${i}%, ${Math.round(a*100)/100})`}case"hwb":{const[l,u,i]=Vt(e,n,r);return a<1?`hwb(${l} ${u}% ${i}% / ${Math.round(a*100)/100})`:`hwb(${l} ${u}% ${i}%)`}case"oklch":{const[l,u,i]=_t(e,n,r),c=(Math.round(l*1e3)/1e3).toFixed(3),p=(Math.round(u*1e3)/1e3).toFixed(3),f=(Math.round(i*10)/10).toFixed(1),h=Math.round(a*100)/100;return o||a<1?`oklch(${c} ${p} ${f} / ${h})`:`oklch(${c} ${p} ${f})`}}}function L(e,n){return n?e==="rgb"?"rgba":e==="hsl"?"hsla":e:e==="rgba"?"rgb":e==="hsla"?"hsl":e}class Jt extends Error{constructor(n="Missing implementation"){super(n),this.name="MissingImplementationError"}}const Kt=e=>te(e).split("_").join(" "),te=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()),ee=e=>e.substring(0,1).toUpperCase()+e.substring(1),ne=e=>{if(typeof Buffer<"u")return Buffer.from(e,"base64").toString("utf8");if(typeof atob<"u")return atob(e);throw new Jt("No implementation found for base64 decoding")};function Y({onChange:e,value:n,accept:r="*/*",enableClick:a=!0,content:s,disabled:o=!1,allowMultiple:l}){return t.Use(I.BeatUII18n,u=>{const i=t.Value.deriveProp(n??[]),c=t.prop(!1),p=b=>{b.preventDefault(),b.stopPropagation(),c.value=!0},f=b=>{b.preventDefault(),b.stopPropagation(),(!b.currentTarget||!b.currentTarget.contains(b.relatedTarget))&&(c.value=!1)},h=b=>{b.preventDefault(),b.stopPropagation(),c.value=!1;const d=Array.from(b.dataTransfer?.files||[]);d.length>0&&(i.value=d,e(d,"dragdrop"))},m=b=>{t.Value.get(a)&&b.currentTarget.querySelector('input[type="file"]')?.click()};let v=null;const w=()=>{if(v==null)return;const b=Array.from(v.files??[]);b.length>0&&(i.value=b,e(b,"click")),v.value=""},x=b=>{t.Value.get(a)&&(b.key==="Enter"||b.key===" ")&&(b.preventDefault(),m(b))};return t.html.div(t.attr.role("button"),t.attr.tabindex(t.Value.map(a,b=>b?0:-1)),t.attr.style("position: relative;"),t.on.dragover(p),t.on.dragleave(f),t.on.drop(h),t.on.click(m),t.on.keydown(x),t.html.input(t.attr.type("file"),t.attr.disabled(o),t.attr.accept(r),t.attr.multiple(l),t.attr.style("position: absolute; left: -9999px; opacity: 0; pointer-events: none;"),t.on.change(w),t.WithElement(b=>(v=b,i.on(d=>{const _=globalThis.DataTransfer;if(_!=null){const $=new _;d.forEach(k=>$.items.add(k)),b.files=$.files}}),t.Empty))),t.aria.label(t.bind(u.$.dropZoneInstructions)(a)),s({files:i,clear:()=>i.value=[],change:i.set}))})}function re(e,n){return e.length===n.length&&e.every((r,a)=>r===n[a])}function ae(e,n){const r=["bc-segmented-input",`bc-segmented-input--size-${e}`];return n&&r.push("bc-segmented-input--disabled"),r.join(" ")}function se({options:e,value:n,onChange:r,size:a="md",disabled:s=!1},...o){const l=qt.f(e).map(([u,i])=>({key:u,label:i}));return t.WithElement(()=>{const u=Object.fromEntries(l.map((c,p)=>[c.key,p])),i=t.prop(l.map(()=>({left:0,width:0})),re);return t.html.div(t.attr.class(t.computedOf(a,s)((c,p)=>ae(c??"md",p??!1))),t.html.div(t.attr.class("bc-segmented-input__container"),t.html.div(t.attr.class("bc-segmented-input__indicator"),t.style.width(t.computedOf(n,i)((c,p)=>{const{width:f}=p[u[c]??0];return`${f}px`})),t.style.left(t.computedOf(n,i)((c,p)=>{const{left:f}=p[u[c]??0];return`${f}px`}))),l.map(({label:c,key:p},f)=>t.html.button(t.attr.type("button"),t.on.click(h=>{h.preventDefault(),t.Value.get(s)||r?.(p)}),t.attr.disabled(s),t.attr.class("bc-segmented-input__segment"),t.attr.class(t.Value.map(n,h=>h===p?"bc-segmented-input__segment--active":"bc-segmented-input__segment--inactive")),at.ElementRect(h=>{function m(){i.update(w=>{const x=[...w];return x[f]={width:h.value.width,left:h.value.localLeft},x})}const v=Yt.g(m);return t.OnDispose(v,h.on(m))}),c))),...o)})}function le(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 oe(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 tt(e){return t.When(e.map(le),()=>{const n=t.prop(null);return e.on(r=>{n.value&&URL.revokeObjectURL(n.value);const a=URL.createObjectURL(r);n.value=a}),t.html.div(t.OnDispose(()=>{n.value&&URL.revokeObjectURL(n.value)}),t.attr.class("bc-file-input__thumbnail-container"),t.html.img(t.attr.src(n),t.attr.alt(e.map(r=>r.name)),t.attr.class("bc-file-input__thumbnail")))},()=>I.Icon({icon:e.map(oe)}))}const $t=(e,...n)=>{const{value:r=t.prop([]),accept:a="*/*",maxFiles:s,maxFileSize:o,onChange:l,onBlur:u,disabled:i,hasError:c,mode:p="default",showFileList:f=!0,...h}=e,m=r,v=t.Value.map(p,y=>y==="input"),w=t.Value.map(p,y=>y==="compact"),x=y=>{let g=y;if(s!=null){const V=t.Value.get(s);g=g.slice(0,V)}if(o){const V=t.Value.get(o);g=g.filter(M=>M.size<=V)}l?.(g)},b=y=>{const V=m.value.filter((M,T)=>T!==y);l?.(V)},d=()=>{l?.([])},_=({files:y,clear:g,change:V})=>t.Use(I.BeatUII18n,M=>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"),I.Icon({icon:"mdi:cloud-upload-outline",size:"xl"}),t.html.div(t.attr.class("bc-file-input__drop-zone-text"),t.bind(M.$.filesInputInstructions)(s,o,M.$.fileSizeUnits.value))))),$=({files:y})=>t.Use(I.BeatUII18n,g=>t.html.div(t.attr.class("bc-file-input__compact-drop-zone"),t.When(y.map(V=>V.length>0),()=>t.html.div(t.attr.class("bc-file-input__compact-file-list"),t.ForEach(y,(V,M)=>{const T=M.index;return t.html.div(t.attr.class("bc-file-input__compact-file-item"),t.html.div(t.attr.class("bc-file-input__compact-file-icon"),tt(V)),t.html.div(t.attr.class("bc-file-input__compact-file-info"),t.html.div(t.attr.class("bc-file-input__compact-file-name"),t.attr.title(V.$.name),V.$.name),t.html.div(t.attr.class("bc-file-input__compact-file-meta"),t.computedOf(V.$.size,g.$.fileSizeUnits)((C,A)=>I.formatFileSize(C,{units:A}))," • ",t.computedOf(V.$.type,g.$.unknownType)((C,A)=>C||A))),E.CloseButton({size:"sm",label:g.$.removeFile,disabled:i,onClick:()=>b(T)},t.attr.class("bc-file-input__compact-remove-button")))})),()=>t.html.div(t.attr.class("bc-file-input__compact-placeholder"),I.Icon({icon:"mdi:cloud-upload-outline",size:"lg"}),t.html.div(t.attr.class("bc-file-input__compact-placeholder-text"),t.bind(g.$.filesInputInstructions)(s,o,g.$.fileSizeUnits.value)))))),k=({files:y})=>t.Use(I.BeatUII18n,g=>t.html.div(t.attr.class("bc-file-input__compact-input"),t.When(y.map(V=>V.length>0),()=>t.html.span(t.attr.class("bc-file-input__compact-value"),t.ForEach(y,V=>t.html.span(t.attr.class("bc-file-input__compact-value-item"),tt(V),t.html.span(t.attr.class("bc-file-input__compact-value-item-name"),V.$.name)))),()=>t.html.span(t.attr.class("bc-file-input__compact-placeholder"),I.Icon({icon:"mdi:cloud-upload-outline",size:"md"})," ",t.bind(g.$.filesInputInstructions)(s,o,g.$.fileSizeUnits.value)))));return t.Use(I.BeatUII18n,y=>I.InputContainer({baseContainer:t.Value.map(v,g=>!g),disabled:i,hasError:c,after:t.When(v,()=>t.When(m.map(({length:g})=>g>0),()=>E.CloseButton({size:"sm",label:y.$.clearAllFiles,disabled:i,onClick:d},t.attr.class("bc-file-input__compact-clear")))),...h,input:t.When(v,()=>t.html.div(t.attr.class("bc-file-input bc-file-input--input"),Y({value:m,accept:a,enableClick:!0,allowMultiple:t.Value.map(s??1/0,g=>g>1),disabled:i,onChange:x,content:k})),()=>t.When(w,()=>t.html.div(t.attr.class("bc-file-input bc-file-input--compact"),Y({value:m,accept:a,enableClick:!0,allowMultiple:t.Value.map(s??1/0,g=>g>1),disabled:i,onChange:x,content:$})),()=>t.html.div(t.attr.class("bc-file-input"),Y({value:m,accept:a,enableClick:!0,allowMultiple:t.Value.map(s??1/0,g=>g>1),disabled:i,onChange:x,content:_}),t.When(f,()=>t.NotEmpty(m,()=>t.Fragment(t.html.div(t.attr.class("bc-file-input__file-list"),t.ForEach(m,(g,V)=>{const M=V.index;return t.html.div(t.attr.class("bc-file-input__file-item"),t.html.div(t.attr.class("bc-file-input__file-icon"),tt(g)),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(g.$.name),g.$.name),t.html.div(t.attr.class("bc-file-input__file-meta"),t.computedOf(g.$.size,y.$.fileSizeUnits)((T,C)=>I.formatFileSize(T,{units:C}))," • ",t.computedOf(g.$.type,y.$.unknownType)((T,C)=>T||C))),E.CloseButton({size:"sm",label:y.$.removeFile,disabled:i,onClick:()=>b(M)},t.attr.class("bc-file-input__remove-button")))})),t.When(m.map(({length:g})=>g>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(i),y.$.clearAllFiles,t.on.click(g=>{g.preventDefault(),g.stopPropagation(),d()}))))))))))},...n))};async function kt(e){return new Promise((n,r)=>{const a=new FileReader;a.readAsDataURL(e),a.onload=()=>{const s=a.result;n(s.split(",")[1])},a.onerror=s=>r(s)})}function ie(e){return Promise.all(e.map(kt))}function ue(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 ce(e){const n=ne(e??""),r=n.length,a=new Uint8Array(r);for(let s=0;s<r;s++)a[s]=n.charCodeAt(s);return a}function Mt(e){const{value:n,onChange:r,onInput:a,...s}=e,o=new Map,l=t.Value.toSignal(n).map(p=>p.map((f,h)=>{const m=o.get(f),v=ce(f??""),w=m?.type||ue(v),x=m?.name??`file-${h}`,b=v.buffer.slice(v.byteOffset,v.byteOffset+v.byteLength),d=new Blob([b],{type:w});return new File([d],x,{type:w})})),u=p=>f=>{p&&ie(f).then(h=>{for(const[m,v]of h.entries())o.set(v,{name:f[m].name,type:f[m].type});p(h)})},i=u(r),c=u(a);return $t({...s,value:l,onChange:i,onInput:c})}function pe(e){const{value:n,onInput:r,onChange:a,...s}=e;return Mt({...s,maxFiles:1,value:t.Value.map(n,o=>o==null?[]:[o]),onChange:o=>{a?.(o[0])},onInput:o=>{r?.(o[0])}})}function me(e,n){const[r,a,s]=e,o=r<<16^a<<8^s,l=wt(o),u=6+Math.floor(l()*5),i=.18+l()*.06,c=[];for(let m=0;m<u;m++){const v=m/u*Math.PI*2,w=n*(1+(l()*2-1)*i),x=Math.cos(v)*w,b=Math.sin(v)*w;c.push({x,y:b})}const p=(c[0].x+c[u-1].x)/2,f=(c[0].y+c[u-1].y)/2;let h=`M ${p.toFixed(3)} ${f.toFixed(3)}`;for(let m=0;m<u;m++){const v=c[m],w=c[(m+1)%u],x=(v.x+w.x)/2,b=(v.y+w.y)/2;h+=` Q ${v.x.toFixed(3)} ${v.y.toFixed(3)} ${x.toFixed(3)} ${b.toFixed(3)}`}return h+=" Z",h}const de=e=>{const{value:n,onBlur:r,onChange:a,onInput:s,displayValue:o,size:l,withAlpha:u}=e,i=t.Value.map(l??32,y=>y),c=t.Value.map(n,y=>vt(y??"#000000")),p=t.Value.map(c,([y,g,V])=>[y,g,V]),f=t.Value.map(c,([,,,y])=>y),h=t.prop(t.Value.get(f)??1),m=t.Value.map(u??!1,y=>y),v=t.Value.map(e.colorTextFormat??"rgb",y=>y),w=t.computedOf(p,h,v,m)(([y,g,V],M,T,C)=>R(y,g,V,M??1,L(T,C),C)),x=t.Value.map(e.colorTextFormat??"hex",y=>y),b=t.Value.map(i,y=>`${-y/2} ${-y/2} ${y} ${y}`),d=t.computedOf(p,i)((y,g)=>me(y,g/2)),_=t.computedOf(p,h,m)(([y,g,V],M,T)=>T||M<1?xt(y,g,V,M):G(y,g,V)),$=t.html.div(t.attr.class("bc-color-swatch-input__control"),t.attr.class(t.Value.map(m,y=>y?"bc-color-swatch-input__control--alpha":"")),t.attr.style(t.computedOf(i)(y=>`min-width:${y+2}px;height:${y+2}px`)),t.svg.svg(t.attr.class("bc-color-swatch-input__svg"),t.svgAttr.viewBox(b),t.svg.path(t.svgAttr.d(d),t.svgAttr.fill(_))),t.html.input(t.attr.type("color"),I.CommonInputAttributes(e),t.attr.value(t.Value.map(p,([y,g,V])=>G(y,g,V))),t.attr.class("bc-input bc-color-swatch-input bc-color-swatch-input__native"),r!=null?t.on.blur(r):t.Empty,a!=null?t.on.change(y=>{const g=y.target.value;if(!a)return;const{r:V,g:M,b:T}=z(g)??{r:0,g:0,b:0},C=t.Value.get(h)??1,A=L(t.Value.get(x),t.Value.get(m)),S=R(V,M,T,C,A,t.Value.get(m));a(S)}):t.Empty,s!=null?t.on.input(y=>{const g=y.target.value;if(!s)return;const{r:V,g:M,b:T}=z(g)??{r:0,g:0,b:0},C=t.Value.get(h)??1,A=L(t.Value.get(x),t.Value.get(m)),S=R(V,M,T,C,A,t.Value.get(m));s(S)}):t.Empty)),k=t.When(m,()=>t.html.input(t.attr.type("range"),t.attr.class("bc-color-swatch-input__alpha"),t.attr.min(0),t.attr.max(1),t.attr.step(.01),t.attr.value(t.Value.map(h,y=>String(y??1))),t.attr.disabled(e.disabled),t.on.input(y=>{const g=parseFloat(y.target.value);h.set(g);const[V,M,T]=t.Value.get(p),C=L(t.Value.get(x),t.Value.get(m)),A=R(V,M,T,g,C,t.Value.get(m));s?.(A)}),t.on.change(y=>{const g=parseFloat(y.target.value);h.set(g);const[V,M,T]=t.Value.get(p),C=L(t.Value.get(x),t.Value.get(m)),A=R(V,M,T,g,C,t.Value.get(m));a?.(A)})));return I.InputContainer({baseContainer:!0,...e,growInput:!1,input:$,after:t.Fragment(t.When(o??!1,()=>t.html.span(t.attr.class("bc-color-swatch-input__rgb"),w)),k,e.after)})},ot="$$tts-exp-",Tt=(e,n)=>t.WithElement(r=>{const a=`${ot}${e}`;return t.OnDispose(t.Value.on(n,s=>Reflect.set(r,a,s)))}),fe=(e,n)=>{const r=`${ot}${e}`;return a=>{n(Reflect.get(a.target,r))}},At=(e,n)=>{const r=`${ot}${e}`;return a=>{const s=a.target,o=s.selectedIndex,l=s.options[o];n(Reflect.get(l,r))}};function ge(e,n,r){const a=["bc-card"];return e!=="default"&&a.push(`bc-card--${e}`),n!=="md"&&a.push(`bc-card--padding-${n}`),r!=="lg"&&a.push(`bc-card--rounded-${r}`),a.join(" ")}function he({variant:e="default",size:n="md",roundedness:r="lg"}={},...a){return t.html.div(t.attr.class(t.computedOf(e,n,r)((s,o,l)=>ge(s??"default",o??"md",l??"lg"))),...a)}function H(...e){return t.html.div(t.attr.class("bc-group"),...e)}const be=({startEditing:e,value:n,onChange:r,placeholder:a,disabled:s})=>{const o=t.Value.deriveProp(e??!1),l=t.prop(!1),u=t.Value.map(s??!1,i=>i);return t.html.div(t.attr.class("bc-editable-text"),t.attr.class(t.Value.map(u,i=>i?"bc-editable-text--disabled":"")),t.aria.disabled(u),t.When(o,()=>t.html.input(t.attr.placeholder(a),t.attr.value(n),t.attr.class("bc-editable-text__input"),at.AutoSelect(),t.on.keydown(i=>{i.key==="Enter"?o.set(!1):i.key==="Escape"&&(l.set(!0),o.set(!1))}),t.on.blur(t.emitValue(i=>{if(o.set(!1),l.value){l.set(!1);return}r(i)}))),()=>t.html.span(t.on.click(()=>{t.Value.get(u)||o.set(!0)}),t.attr.class("bc-editable-text__display"),t.When(t.Value.map(n,i=>i!=null&&i.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(u,i=>!i),()=>t.html.button(t.attr.type("button"),t.attr.class("bc-editable-text__edit-button"),t.Use(I.BeatUII18n,i=>t.aria.label(i.$.editLabel)),t.on.click(()=>o.set(!0)),I.Icon({icon:"line-md/pencil",color:"neutral"}))))))},Et=(e,n,r)=>t.Ensure(e,a=>t.OneOfType(a,{value:s=>{const o=t.computedOf(s,r)((l,u)=>n(l.value,u));return t.html.option(t.attr.selected(o),Tt("value",s.$.value),s.$.label)},group:s=>t.html.optgroup(t.attr.label(s.$.group),t.ForEach(s.$.options,o=>Et(o,n,r))),break:()=>t.html.hr()})),Ft=e=>{const{value:n,onBlur:r,onChange:a,options:s,unselectedLabel:o,equality:l=(c,p)=>c===p,after:u}=e;let i;return I.InputContainer({...e,after:t.Fragment(I.InputIcon({icon:"ph:caret-down-bold",color:"neutral",size:"sm"}),u),input:t.html.select(t.WithElement(c=>{i=c;const p=new MutationObserver(f=>{const{removedNodes:h}=f[0];h.length>0&&(i.selectedIndex=0)});return p.observe(c,{childList:!0}),t.OnDispose(()=>p.disconnect())}),I.CommonInputAttributes(e),t.attr.class("bc-native-select bc-input"),t.Use(I.BeatUII18n,c=>t.html.option(t.attr.hidden("hidden"),t.coalesce(o,c.$.selectOne))),t.ForEach(s,c=>Et(c,l,n)),r!=null?t.on.blur(r):t.Empty,a!=null?t.on.change(At("value",c=>a(c))):t.Empty)},t.on.click(()=>{i?.focus(),typeof i?.showPicker=="function"&&i.showPicker()}))};function St(e){const{controller:n,onChange:r,onBlur:a,...s}=e;return Ft({...s,value:n.signal,onChange:E.makeOnChangeHandler(n,r),onBlur:E.makeOnBlurHandler(n,a)})}function ye(e){return E.InputWrapper({...e,content:St(e)})}function Dt(e,n,r){const a=e.length.map(s=>s);return t.Fragment(t.Repeat(a,s=>{const o=e.item(s.index),l=[];return t.Fragment(t.OnDispose(()=>{l.forEach(u=>u())}),n({list:e,item:o,position:s,remove:()=>e.removeAt(s.index),move:u=>{switch(u){case"up":if(s.index===0)return;e.move(s.index,s.index-1);break;case"down":if(s.index===e.length.value-1)return;e.move(s.index,s.index+1);break;case"first":e.move(s.index,0);break;case"last":e.move(s.index,e.length.value-1)}},canMove:u=>{const i=(()=>{switch(u){case"up":return t.signal(s.index>0);case"down":return e.length.map(c=>s.index<c-1)}})();return l.push(()=>i.dispose()),i},cannotMove:u=>{const i=(()=>{switch(u){case"up":return t.signal(s.index===0);case"down":return e.length.map(c=>s.index===c-1)}})();return l.push(()=>i.dispose()),i}}))},r))}const pt={9:{pattern:/^[0-9]$/},A:{pattern:/^[A-Za-z]$/,transform:e=>e.toUpperCase()},"*":{pattern:/^.$/}},ve=e=>e instanceof RegExp;function Ut(e,n,r){if(e==null)return[];const a=r?{...pt,...n}:n??pt,s=(l,u)=>{const i=a[u];i?l.push({type:"pattern",name:u,...i}):l.push({type:"literal",char:u})},o=[];if(typeof e=="string"){for(const l of e)s(o,l);return o}for(const l of e)if(typeof l=="string")if(l.length<=1)s(o,l);else for(const u of l)s(o,u);else ve(l)?o.push({type:"pattern",pattern:l}):typeof l=="object"&&l&&o.push(l);return o}function xe(e,n){return r=>{switch(e){case"digits":return/[0-9]/.test(r);case"letters":return/[A-Za-z]/.test(r);case"alphanumeric":return/[A-Za-z0-9]/.test(r);case"custom":return n?.(r)??!0;default:return!0}}}function mt(e,n,r,a,s,o){const l={raw:e,previousConformed:n,cursor:s??e.length,completed:!1},u=a.definitions??{},i=typeof r=="function"?r(e,l):r,c=Ut(i,u,a.useDefaultDefinitions??!0),p=xe(a.allowMode,a.allow),f=new Set;for(const C of c)C.type==="literal"&&f.add(C.char);if(a.prefix)for(const C of a.prefix)f.add(C);if(a.suffix)for(const C of a.suffix)f.add(C);const h=Array.from(e).filter(C=>p(C)&&!f.has(C));if(h.length===0)return{value:"",cursor:0,completed:!1};const m=[],v=[];let w=0,x=0,b=0,d=-1;for(const C of c){if(C.type==="literal"){m.push(C.char),v.push({kind:"literal",filled:!0});continue}x+=C.optional?0:1;const A=h[w];if(A==null)break;if(C.type==="any"){b++,m.push(C.transform?C.transform(A):A),v.push({kind:"slot",filled:!0}),d=v.length-1,w++;continue}if(C.type==="pattern")if(C.pattern.test(A)){b++;const S=C.transform?C.transform(A):A;m.push(S),v.push({kind:"slot",filled:!0}),d=v.length-1,w++}else{w++;continue}}const _=m.join(""),$=(a.prefix??"")+_+(a.suffix??"");let y=(a.prefix??"").length;if(d>=0){let C=d+1;if((o?.policy??"smart")!=="sticky")for(;C<v.length&&v[C].kind==="literal";)C++;y+=C}const g=a.completion?.mode==="min"?(a.completion.minChars??0)<=b:a.completion?.mode==="custom"?!!a.completion.isComplete?.($):x>0&&b>=x,V=a.pipe?.($,{...l,completed:g});let M,T=y;return V===!1?(M=n,T=n.length):typeof V=="string"?(M=V,T=V.length):typeof V=="object"&&V?(M=V.value,T=V.cursor??V.value.length):M=$,{value:M,cursor:T,completed:g}}function we(e,n){const r=n?.strategy??"none";return r==="custom"&&n?.unmask?n.unmask(e):r==="strip"?e.replace(/[^A-Za-z0-9]/g,""):e}const it=e=>{const{value:n,onBlur:r,onChange:a,onInput:s,onAccept:o,onComplete:l,mask:u,definitions:i,useDefaultDefinitions:c,extraLiterals:p,prefix:f,suffix:h,autofix:m,pipe:v,completion:w,unmask:x,allowMode:b,allow:d,placeholder:_,placeholderOptions:$}=e,k=t.computedOf(n,u,i,c,p,f,h,m,w,x,b,_,$)((g,V,M,T,C,A,S,P,j,O,B,Z,D)=>V?mt(g??"","",V,{definitions:M??{},useDefaultDefinitions:T??!0,extraLiterals:C??[],autofix:P??"none",completion:j??{mode:"mask"},pipe:v??(F=>F),unmask:O??{strategy:"none"},allowMode:B??"all",allow:d,prefix:A,suffix:S}).value:g??""),y=(g,V)=>{const M=g.value??"",T=t.Value.get(n)??"",C=u!=null?t.Value.get(u):null,A=i!=null?t.Value.get(i):void 0,S=c!=null?t.Value.get(c):void 0,P=p!=null?t.Value.get(p):void 0,j=m!=null?t.Value.get(m):void 0,O=w!=null?t.Value.get(w):void 0,B=x!=null?t.Value.get(x):void 0,Z=b!=null?t.Value.get(b):void 0,D=f!=null?t.Value.get(f):void 0,F=h!=null?t.Value.get(h):void 0,{value:N,cursor:K,completed:ut}=C?mt(M,T,C,{definitions:A??{},useDefaultDefinitions:S??!0,extraLiterals:P??[],autofix:j??"none",completion:O??{mode:"mask"},pipe:v??(Xt=>Xt),unmask:B??{strategy:"none"},allowMode:Z??"all",allow:d,prefix:D,suffix:F},g.selectionStart??M.length,e.cursor?t.Value.get(e.cursor):void 0):{value:M,cursor:M.length,completed:!0};if(N!==M){g.value=N;try{g.setSelectionRange(K,K)}catch{}}const ct=we(N,B);o?.({raw:ct,conformed:N,completed:ut,cursor:K}),V==="input"?s?.(N):(a?.(N),ut&&l?.({raw:ct,conformed:N}))};return t.Fragment(I.InputContainer({...e,input:t.input.text(I.CommonInputAttributes(e),t.attr.value(k),t.attr.class("bc-input"),r!=null?t.on.blur(r):t.Empty,t.WithElement(g=>g instanceof HTMLInputElement?t.Fragment(t.on.input(()=>y(g,"input")),t.on.change(()=>y(g,"change")),t.on.keydown(V=>{if(V.key!=="Backspace"||!(e.cursor?t.Value.get(e.cursor)?.backspaceRubberBand??!0:!0))return;const T=g.selectionStart??0,C=g.selectionEnd??T;if(T!==C||T<=0)return;const A=g.value??"",S=u!=null?t.Value.get(u):null;if(!S)return;const P=i!=null?t.Value.get(i):void 0,j=c!=null?t.Value.get(c):!0,O=f!=null?t.Value.get(f):void 0,B=h!=null?t.Value.get(h):void 0,Z=Ut(typeof S=="function"?S(A,{raw:A,previousConformed:A,cursor:T,completed:!1}):S,P??{},j??!0),D=new Set;for(const F of Z)F.type==="literal"&&D.add(F.char);if(O)for(const F of O)D.add(F);if(B)for(const F of B)D.add(F);if(D.has(A[T-1])){let F=T-1;for(;F>=0&&D.has(A[F]);)F--;F>=0&&(V.preventDefault(),V.stopPropagation(),g.value=A.slice(0,F)+A.slice(F+1),y(g,"input"))}})):t.Empty))}))};function U(e,n,r){const a=t.Value.map(e,o=>o!=null),s=I.defaultMessages.clearValue;return t.Fragment(t.When(a,()=>t.html.button(t.attr.type("button"),t.attr.class("bc-input-container__reset"),t.aria.label(s),t.attr.title(s),t.attr.disabled(n??!1),I.Icon({icon:"mdi:close",size:"sm"}),t.on.click(o=>{o.stopPropagation(),r?.(null)}))))}const Ie=e=>{const{value:n,onBlur:r,onChange:a,onInput:s,after:o,disabled:l}=e,u=U(n,l,a??s);return I.InputContainer({...e,input:t.input.date(I.CommonInputAttributes(e),t.attr.valueAsDate(n),t.attr.class("bc-input"),r!=null?t.on.blur(t.emitValue(r)):t.Empty,a!=null?t.on.change(t.emitValueAsNullableDate(a)):t.Empty,s!=null?t.on.input(t.emitValueAsNullableDate(s)):t.Empty),after:o!=null?t.Fragment(u,o):u})},Ve=e=>{const n=e.getFullYear(),r=e.getMonth()+1,a=e.getDate(),s=e.getHours(),o=e.getMinutes(),l=e.getSeconds();return`${n}-${r.toString().padStart(2,"0")}-${a.toString().padStart(2,"0")}T${s.toString().padStart(2,"0")}:${o.toString().padStart(2,"0")}:${l.toString().padStart(2,"0")}`},Ce=e=>{const{value:n,onBlur:r,onChange:a,onInput:s,after:o,disabled:l}=e,u=t.Value.map(n,c=>c!=null?Ve(c):null),i=U(n,l,a??s);return I.InputContainer({...e,input:t.input["datetime-local"](I.CommonInputAttributes(e),t.attr.value(t.Value.map(u,c=>c??null)),t.attr.class("bc-input"),r!=null?t.on.blur(t.emitValue(r)):t.Empty,a!=null?t.on.change(t.emitValueAsNullableDateTime(a)):t.Empty,s!=null?t.on.input(t.emitValueAsNullableDateTime(s)):t.Empty),after:o!=null?t.Fragment(i,o):i})},rt=e=>typeof e=="string"&&e.trim()===""?null:e,Bt=e=>e??"";function W(e){return n=>{const{value:r,onBlur:a,onChange:s,onInput:o,after:l,disabled:u,...i}=n,c=U(r,u,s??o);return e({...i,disabled:u,value:t.Value.map(r,Bt),onChange:s!=null?p=>s(rt(p)):void 0,onInput:o!=null?p=>o(rt(p)):void 0,onBlur:a,after:l!=null?t.Fragment(c,l):c})}}const _e=W(E.EmailInput),$e=W(I.TextInput),ke=W(E.PasswordInput),Nt=e=>{const{value:n,onBlur:r,onChange:a,onInput:s,rows:o}=e;return I.InputContainer({baseContainer:!0,...e,input:t.html.textarea(t.attr.class(t.computedOf(e.size??"md")(l=>I.generateInputContainerInputClasses(!1,l??"md"))),I.CommonInputAttributes(e),t.attr.rows(o??3),t.attr.value(n),t.attr.class("bc-input"),r!=null?t.on.blur(t.emitValue(r)):t.Empty,a!=null?t.on.change(t.emitValue(a)):t.Empty,s!=null?t.on.input(t.emitValue(s)):t.Empty)})},Me=W(Nt),Te=e=>{const{value:n,step:r,min:a,max:s,onBlur:o,onChange:l,onInput:u,after:i}=e,c=h=>{const m=a!=null?t.Value.get(a):void 0,v=s!=null?t.Value.get(s):void 0;return m!=null&&h<m?m:v!=null&&h>v?v:h},p=r!=null?t.Use(I.BeatUII18n,h=>{const m=t.computedOf(n,a)((b,d)=>d==null?!0:(b??0)>d),v=t.computedOf(n,s)((b,d)=>d==null?!0:(b??0)<d),w=b=>{const d=t.Value.get(n)??0,_=t.Value.get(r),$=b?.shiftKey?10:1,k=d-_*$,y=a!=null?t.Value.get(a):void 0;if(y!=null&&k<y)return;const g=c(k);g!==d&&l&&l(g)},x=b=>{const d=t.Value.get(n)??0,_=t.Value.get(r),$=b?.shiftKey?10:1,k=d+_*$,y=s!=null?t.Value.get(s):void 0;if(y!=null&&k>y)return;const g=c(k);g!==d&&l&&l(g)};return E.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)((b,d)=>!b||d)),t.on.click(b=>x(b)),t.aria.label(h.$.incrementValue),I.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(m,e.disabled??!1)((b,d)=>!b||d)),t.on.click(b=>w(b)),t.aria.label(h.$.decrementValue),I.Icon({icon:"line-md:minus",size:"xs"})))}):null,f=i!=null&&p!=null?t.Fragment(p,i):i??p;return I.InputContainer({...e,input:t.input.number(a!=null?t.Fragment(t.attr.min(a),t.OnDispose(t.Value.on(a,h=>{h<t.Value.get(n)}))):t.Empty,s!=null?t.Fragment(t.attr.max(s),t.OnDispose(t.Value.on(s,h=>{h>t.Value.get(n)}))):t.Empty,I.CommonInputAttributes(e),t.attr.valueAsNumber(n),t.attr.step(r),t.attr.class("bc-input bc-number-input"),o!=null?t.on.blur(t.emitValue(o)):t.Empty,l!=null?t.on.change(t.emitValueAsNumber(l)):t.Empty,u!=null?t.on.input(t.emitValueAsNumber(u)):t.Empty,r!=null?t.on.wheel(h=>{h.preventDefault();const m=t.Value.get(n)??0,v=t.Value.get(r),w=h.shiftKey?10:1,x=h.deltaY<0?v*w:-v*w,b=c(m+x);b!==m&&l&&l(b)}):t.Empty),after:f})},dt=e=>{if(e==null||e==="")return null;const n=Number(e);return Number.isNaN(n)?null:n},Ae=e=>{const{value:n,step:r,min:a,max:s,onBlur:o,onChange:l,onInput:u,after:i}=e,c=m=>{const v=a!=null?t.Value.get(a):void 0,w=s!=null?t.Value.get(s):void 0;return v!=null&&m<v?v:w!=null&&m>w?w:m},p=(()=>{if(r==null)return null;const m=t.computedOf(n,a)((d,_)=>{const $=d??0;return _==null?!0:$>_}),v=t.computedOf(n,s)((d,_)=>{const $=d??0;return _==null?!0:$<_}),w=d=>{const _=t.Value.get(n)??0,$=t.Value.get(r),k=d?.shiftKey?10:1,y=_-$*k,g=a!=null?t.Value.get(a):void 0;if(g!=null&&y<g)return;const V=c(y);V!==_&&l&&l(V)},x=d=>{const _=t.Value.get(n)??0,$=t.Value.get(r),k=d?.shiftKey?10:1,y=_+$*k,g=s!=null?t.Value.get(s):void 0;if(g!=null&&y>g)return;const V=c(y);V!==_&&l&&l(V)};return((d,_)=>E.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)(($,k)=>!$||k)),t.on.click($=>x($)),t.aria.label(d),I.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(m,e.disabled??!1)(($,k)=>!$||k)),t.on.click($=>w($)),t.aria.label(_),I.Icon({icon:"line-md:minus",size:"xs"}))))(I.defaultMessages.incrementValue,I.defaultMessages.decrementValue)})(),f=U(n,e.disabled,l??u),h=i!=null&&p!=null?t.Fragment(p,f,i):i!=null?t.Fragment(f,i):p!=null?t.Fragment(p,f):f;return I.InputContainer({...e,input:t.input.number(a!=null?t.attr.min(a):t.Empty,s!=null?t.attr.max(s):t.Empty,I.CommonInputAttributes(e),t.attr.value(t.Value.map(n,m=>m==null?"":String(m))),t.attr.step(r),t.attr.class("bc-input bc-number-input"),o!=null?t.on.blur(t.emitValue(o)):t.Empty,l!=null?t.on.change(t.emitValue(m=>{const v=dt(m);l(v)})):t.Empty,u!=null?t.on.input(t.emitValue(m=>{const v=dt(m);u(v)})):t.Empty,r!=null?t.on.wheel(m=>{m.preventDefault();const v=t.Value.get(n)??0,w=t.Value.get(r),x=m.shiftKey?10:1,b=m.deltaY<0?w*x:-w*x,d=c(v+b);d!==v&&l&&l(d)}):t.Empty),after:h})},Ee=({value:e,onChange:n,onInput:r,onBlur:a,offLabel:s,onLabel:o,disabled:l=!1,size:u="md",id:i,color:c="primary",tabIndex:p=0})=>{const f=i??E.sessionId("switch");function h(x,b){const d=["bc-switch",`bc-switch--size-${b}`,`bc-switch--${b}`];return x&&d.push("bc-switch--disabled"),d.join(" ")}function m(x){const b=x??"primary",d=new Map,_=I.backgroundValue(b,"solid","light"),$=I.backgroundValue(b,"solid","dark");return d.set("--switch-track-on-bg",_.backgroundColor),d.set("--switch-track-on-label",_.textColor),d.set("--switch-track-on-bg-dark",$.backgroundColor),d.set("--switch-track-on-label-dark",$.textColor),d.set("--switch-track-on-border-dark",I.borderColorValue(b,"dark")),Array.from(d.entries()).map(([k,y])=>`${k}: ${y}`).join("; ")}const v=()=>{t.Value.get(l)||(n?.(!t.Value.get(e)),r?.(!t.Value.get(e)))},w=x=>{t.Value.get(l)||(x.key===" "||x.key==="Enter")&&(x.preventDefault(),v())};return t.html.div(t.attr.class(t.computedOf(l??!1,u)((x,b)=>h(x??!1,b??"md"))),t.attr.style(t.computedOf(c)(x=>m(x))),t.attr.id(f),t.attr.role("switch"),t.attr.tabindex(t.computedOf(l??!1,p)((x,b)=>x?-1:b??0)),t.aria.checked(e),t.aria.disabled(l),t.on.click(v),t.on.keydown(w),a!=null?t.on.blur(a):null,t.html.div(t.attr.class("bc-switch__track"),t.attr.class(t.Value.map(e,x=>x?"bc-switch__track--on":"bc-switch__track--off")),s!=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,x=>x?"bc-switch__track-label--hidden":"bc-switch__track-label--visible")),s):null,o!=null?t.html.div(t.attr.class("bc-switch__track-label bc-switch__track-label--on"),t.attr.class(t.Value.map(e,x=>x?"bc-switch__track-label--visible":"bc-switch__track-label--hidden")),o):null,at.ElementRect(x=>t.Use(I.Locale,({direction:b})=>t.html.div(t.attr.class("bc-switch__thumb"),t.attr.class(t.Value.map(e,d=>d?"bc-switch__thumb--on":"bc-switch__thumb--off")),t.style.transform(t.computedOf(e,x,u,b)((d,{width:_},$,k)=>{const y=(()=>{switch($){case"xs":return 5;case"sm":return 5.5;case"md":return 6;case"lg":return 7;case"xl":return 8}})(),g=k==="rtl"?`calc((var(--spacing-base) * ${y}) - ${_}px)`:`calc(${_}px - (var(--spacing-base) * ${y}))`;return d?`translateX(${g})`:"translateX(0)"})))))))},Ot=e=>{const n={type:"pattern",pattern:/[0-9A-Fa-f]/,transform:a=>a.toLowerCase()};return it({...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"})},Fe=W(Ot),Se="line-md:star-alt-filled",De="line-md:star-alt",Rt=e=>{const{value:n,onChange:r,disabled:a,max:s=5,fullColor:o="yellow",emptyColor:l="neutral",fullIcon:u=Se,emptyIcon:i=De,size:c="md",onBlur:p,rounding:f=1}=e,h=()=>{const d=t.Value.get(f);return d>0?d:1},m=d=>Math.min(Math.max(d,0),t.Value.get(s)),v=(d,_)=>{if(t.Value.get(a??!1))return;const k=d.currentTarget.getBoundingClientRect(),y=(d.clientX-k.left)/k.width,g=_-1+y,V=h(),M=Math.ceil(g/V)*V,T=m(M);r?.(T)},w=d=>{if(t.Value.get(a??!1))return;const _=h(),$=t.Value.get(n)??0;let k;switch(d.key){case"ArrowRight":case"ArrowUp":k=m($+_);break;case"ArrowLeft":case"ArrowDown":k=m($-_);break;case"Home":k=0;break;case"End":k=t.Value.get(s);break;default:return}d.preventDefault(),r?.(k)},x=t.Value.map(c,d=>`bc-icon--${d}`),b=({index:d,counter:_})=>t.html.span(t.attr.class("bc-rating-input__icon-container"),t.attr.class(x),I.Icon({icon:i,size:c,color:l,tone:"soft"},t.attr.class("bc-rating-input__icon-empty")),t.html.span(t.attr.class("bc-rating-input__icon-clipper"),t.attr.class(x),t.style.width(t.Value.map(n,$=>{const k=Math.floor($);return k>d?"100%":k<d?"0%":`${($-d)*100}%`})),I.Icon({icon:u,size:c,color:o,tone:"soft"},t.attr.class("bc-rating-input__icon-full"))),t.on.click(t.emit($=>v($,_),{preventDefault:!0,stopPropagation:!0})));return I.InputContainer({baseContainer:!0,growInput:!1,focusableSelector:'[role="slider"]',...e,input:t.html.div(I.CommonInputAttributes(e),t.attr.class("bc-rating-input"),t.attr.role("slider"),t.attr.tabindex(t.Value.map(a??!1,d=>d?-1:0)),t.aria.disabled(a??!1),t.aria.valuemin(0),t.aria.valuemax(t.Value.map(s,d=>d??0)),t.aria.valuenow(t.Value.map(n,d=>d??0)),t.aria.valuetext(t.computedOf(n,s)((d,_)=>{const $=d??0,k=_??0;return`${String($)} / ${String(k)}`})),t.on.keydown(w),p!=null?t.on.blur(p):null,t.Repeat(s,b))})},Ue=e=>{const{value:n,onChange:r,onInput:a,onBlur:s,after:o,disabled:l,...u}=e,i=U(n,l,r??a);return Rt({...u,value:t.Value.map(n,c=>c??0),onChange:r,onInput:a,onBlur:s,after:o!=null?t.Fragment(i,o):i})},Be=e=>{const{value:n,step:r,min:a,max:s,onBlur:o,onChange:l,onInput:u}=e;return I.InputContainer({...e,focusableSelector:'input[type="range"]',input:t.html.input(t.attr.type("range"),I.CommonInputAttributes(e),t.attr.min(a),t.attr.max(s),t.attr.step(r),t.attr.valueAsNumber(n),t.attr.class("bc-input bc-slider-input"),o!=null?t.on.blur(t.emitValueAsNumber(o)):t.Empty,l!=null?t.on.change(t.emitValueAsNumber(l)):t.Empty,u!=null?t.on.input(t.emitValueAsNumber(u)):t.Empty)})},Ne=e=>{const{value:n,step:r,min:a,max:s,onBlur:o,onChange:l,onInput:u}=e,i=t.Value.map(n,p=>{if(p!=null)return p;const f=a!=null?t.Value.get(a):void 0;return typeof f=="number"?f:0}),c=U(n,e.disabled,l??u);return I.InputContainer({...e,focusableSelector:'input[type="range"]',after:c,input:t.html.input(t.attr.type("range"),I.CommonInputAttributes(e),t.attr.min(a),t.attr.max(s),t.attr.step(r),t.attr.valueAsNumber(i),t.attr.class("bc-input bc-slider-input"),o!=null?t.on.blur(t.emitValueAsNumber(o)):t.Empty,l!=null?t.on.change(t.emitValueAsNumber(p=>{l(p)})):t.Empty,u!=null?t.on.input(t.emitValueAsNumber(p=>{u(p)})):t.Empty)},t.Fragment())};let et=null;async function J(){const e=globalThis;return e.Temporal?e.Temporal:(et||(et=Promise.resolve().then(()=>require("./index.esm-DJRz9AE-.cjs")).then(n=>{const r=n.Temporal;return e.Temporal||(e.Temporal=r),r})),et)}const Lt=(e,n)=>n?t.Task(J,{then:e,pending:n.pending,error:n.error}):t.Task(J,e),Oe=/^P(\d+([YMWD]|$)){0,4}(T(\d+([HMS]|$)){0,3})?$/i,Re=/^P(?:(\d+Y)?(\d+M)?(\d+W)?(\d+D)?)(T(\d+H)?(\d+M)?(\d+S)?)?$/i;function zt(e){return{mask:null,allowMode:"custom",allow:n=>/[0-9ptwdhms]/i.test(n),pipe:n=>{const r=n.toUpperCase();return r.length===0?r:!r.startsWith("P")||!Oe.test(r)?!1:r},completion:{mode:"custom",isComplete:n=>{const r=n.toUpperCase();if(!Re.test(r))return!1;try{return e(r),!0}catch{return!1}}}}}const ft=(e,n)=>{if(e==null)return null;try{return e.Duration.from(n)}catch{return null}},Le=e=>{const{value:n,onChange:r,onInput:a,after:s,disabled:o,onBlur:l}=e,u=()=>{const p=U(n,o,r??a);return s!=null?t.Fragment(p,s):p},i=e.placeholder!=null?t.Empty:t.attr.placeholder("P0DT0H0M0S");return Lt(p=>it({...e,value:t.Value.map(n,f=>f?.toString()??""),onChange:r?f=>r(f===""?null:p.Duration.from(f)):void 0,onInput:void 0,...zt(p.Duration.from),placeholder:"P0DT0H0M0S",after:u()}),{pending:()=>{const p=f=>h=>{const v=h.currentTarget?.value??"";if(v===""){f(null);return}const w=globalThis.Temporal,x=ft(w,v);if(x!=null){f(x);return}J().then(b=>{const d=ft(b,v);d!=null&&f(d)}).catch(()=>{})};return I.InputContainer({...e,input:t.input.text(I.CommonInputAttributes(e),t.attr.value(t.Value.map(n,f=>f?.toString()??"")),t.attr.class("bc-input"),i,l!=null?t.on.blur(()=>l()):t.Empty,r!=null?t.on.change(p(r)):t.Empty,a!=null?t.on.input(p(a)):t.Empty),after:u()})}})},Wt=e=>{const{value:n,onBlur:r,onChange:a,onInput:s}=e;return I.InputContainer({...e,input:t.input.url(I.CommonInputAttributes(e),t.attr.value(n),t.attr.class("bc-input"),r!=null?t.on.blur(t.emitValue(r)):t.Empty,a!=null?t.on.change(t.emitValue(a)):t.Empty,s!=null?t.on.input(t.emitValue(s)):t.Empty)})},ze=W(Wt),Pt=e=>{const{controller:n,element:r,separator:a,showMove:s=!0,showRemove:o=!0,showAdd:l=!0,createItem:u,addLabel:i,controlsLayout:c="aside",removeDisabled:p,addDisabled:f}=e,h=t.Value.toSignal(c).map(w=>w==="aside"),m=w=>{const x=t.When(s??!1,()=>t.html.div(t.attr.class("bc-group--align-center"),t.attr.class(h.map(d=>d?"bc-group--direction-column bc-group--gap-1":"bc-group--direction-row bc-group--gap-1")),I.Button({size:"xs",roundedness:"full",variant:"text",onClick:()=>w.move("up"),disabled:w.cannotMove("up")},t.Use(I.BeatUII18n,d=>I.Icon({size:"xs",icon:"line-md:arrow-up",title:d.$.incrementValue}))),I.Button({size:"xs",roundedness:"full",variant:"text",onClick:()=>w.move("down"),disabled:w.cannotMove("down")},t.Use(I.BeatUII18n,d=>I.Icon({size:"xs",icon:"line-md:arrow-down",title:d.$.decrementValue}))))),b=t.When(o,()=>t.Use(I.BeatUII18n,d=>E.CloseButton({size:"xs",label:t.Value.map(d.$.removeItem,_=>_.toLowerCase()),color:"danger",disabled:p,onClick:w.remove})));return d=>t.When(h,()=>H(t.attr.class("bc-group--gap-1 bc-group--align-center"),E.Stack(t.attr.class("bc-stack--grow"),d),E.Stack(t.attr.class("bc-stack--align-center"),t.When(n.signal.map(_=>_.length>1),()=>x),b)),()=>E.Stack(t.attr.class("bc-stack--gap-2"),d,H(t.attr.class("bc-group--gap-2 bc-group--justify-between"),t.When(n.signal.map(_=>_.length>1),()=>x,()=>t.html.div()),b)))},v=t.When(t.computedOf(l,u)((w,x)=>w&&x!=null),()=>H(t.attr.class("bc-group--gap-2 bc-group--align-center bc-group--justify-center"),I.Button({size:"sm",variant:"filled",onClick:()=>n.push(u()),disabled:t.computedOf(n.disabled,f??!1)((w,x)=>w||x)},t.Use(I.BeatUII18n,w=>H(t.attr.class("bc-group--gap-2"),I.Icon({icon:"line-md:plus"}),i??w.$.addLabel)))));return t.Fragment(Dt(n,w=>m(w)(r(w)),a),v)},We=(e,...n)=>{const{controller:r,element:a,separator:s,showMove:o,showRemove:l,showAdd:u,createItem:i,addLabel:c,controlsLayout:p,removeDisabled:f,addDisabled:h,...m}=e;return E.InputWrapper({...m,content:Pt({controller:r,element:a,separator:s,showMove:o,showRemove:l,showAdd:u,createItem:i,addLabel:c,controlsLayout:p,removeDisabled:f,addDisabled:h})},...n)};class Pe extends E.Controller{branches;activeBranch;#e;#t=new Map;constructor(n,r,a,s,o,l,u=E.O){super(n,r,a,s,o,u),this.branches=l;const i=p=>{for(const f of l)if(f.detect(p))return f.key;return l[0]?.key??"unknown"};this.activeBranch=a.map(i,E.O);const c=p=>{if(this.#t.has(p))return this.#t.get(p);const f=l.find(m=>m.key===p);if(!f)throw new Error(`Unknown branch: ${p}`);const h=new E.Controller([...n,p],m=>{this.change(m)},this.signal.map(m=>f.detect(m)?m:f.defaultValue(),u),s.map(E.makeMapValidation([p])),{disabled:this.disabled,validationMode:this.parent.validationMode},u);return this.#t.set(p,h),h};this.#e=this.activeBranch.map(p=>c(p),E.O),this.onDispose(()=>{for(const p of this.#t.values())p.dispose();this.#t.clear(),this.activeBranch.dispose(),this.#e.dispose()})}get activeController(){return t.Value.get(this.#e)}getBranchController(n){const r=this.branches.find(s=>s.key===n);if(!r)throw new Error(`Unknown branch: ${n}`);if(this.#t.has(n))return this.#t.get(n);const a=new E.Controller([...this.path,n],s=>{this.change(s)},this.signal.map(s=>r.detect(s)?s:r.defaultValue(),E.O),this.status.map(E.makeMapValidation([n])),{disabled:this.disabled,validationMode:this.parent.validationMode},E.O);return this.#t.set(n,a),a}switchToBranch(n,r=!1){const a=this.branches.find(l=>l.key===n);if(!a)throw new Error(`Unknown branch: ${n}`);const s=t.Value.get(this.signal);if(a.detect(s))return!0;if(a.convert){const l=a.convert(s);if(l.ok)return this.change(l.value),!0}if(r&&typeof window=="object"&&typeof window.confirm=="function"&&!window.confirm("Changing type will clear the current value. Continue?"))return!1;const o=a.defaultValue();return this.change(o),!0}get activeBranchDefinition(){const n=t.Value.get(this.activeBranch);return this.branches.find(r=>r.key===n)}}function je(e){return e.transform(n=>n??null,n=>n??void 0)}function He(e){return e.transform(n=>n??"",n=>n===""?void 0:n)}function Ze(e){return e.transform(n=>n??void 0,n=>n??null)}const nt=["description","comment","notes","text"];function Xe(e){if(typeof e=="boolean")return nt;const n=e["x:ui"];return n&&Array.isArray(n.textAreaTriggers)?[...nt,...n.textAreaTriggers]:nt}function jt(e){if(typeof e=="boolean")return;const n=e["x:ui"];if(n!=null&&(typeof n=="string"||typeof n=="object"&&n!==null))return n}function Ht(e,n){if(typeof e=="boolean")return;const r=jt(e);if(typeof r=="object"&&typeof r.widget=="string")return{widget:r.widget,source:"explicit-widget",options:r};const a=typeof r=="string"?r:typeof r=="object"&&typeof r.format=="string"?r.format:void 0;if(a)return{widget:a,source:"explicit-format",options:typeof r=="object"?r:void 0};if(typeof e.format=="string")return{widget:{datetime:"date-time",base64:"binary",bytes:"binary",iri:"uri","iri-reference":"uri-reference","idn-hostname":"hostname"}[e.format]||e.format,source:"schema-format"};if(e.contentMediaType==="text/markdown")return{widget:"markdown",source:"schema-media"};if(e.contentMediaType!=null||e.contentEncoding==="base64")return{widget:"binary",source:"schema-media",options:{mediaType:e.contentMediaType,encoding:e.contentEncoding}};if(e.enum!=null)return{widget:"enum",source:"constraints"};if(e.const!=null)return{widget:"const",source:"constraints"};if((e.type==="number"||e.type==="integer"||Array.isArray(e.type)&&e.type.some(o=>o==="number"||o==="integer"))&&e.minimum!=null&&e.maximum!=null)return e.maximum-e.minimum<=5&&e.minimum>=0&&e.minimum<=1&&(e.multipleOf==null||e.multipleOf>=1)?{widget:"rating",source:"constraints",options:{max:e.maximum}}:{widget:"slider",source:"constraints",options:{min:e.minimum,max:e.maximum,step:e.multipleOf}};if(e.type==="string"){if(e.minLength!=null&&e.minLength>20||e.maxLength!=null&&e.maxLength>100)return{widget:"textarea",source:"heuristics"};if(n){const o=n.toLowerCase();if(o.includes("password")||o.includes("secret"))return{widget:"password",source:"heuristics"};if(o.includes("email"))return{widget:"email",source:"heuristics"};if(o.includes("url")||o.includes("link"))return{widget:"url",source:"heuristics"};if(o.includes("color"))return{widget:"color",source:"heuristics"};if(Xe(e).some(u=>o.includes(u.toLowerCase())))return{widget:"textarea",source:"heuristics"}}}}class Zt{widgets=new Map;typeMapping=new Map;register(n,r){if(this.widgets.set(n,r),r.supportedTypes)for(const a of r.supportedTypes)this.typeMapping.has(a)||this.typeMapping.set(a,[]),this.typeMapping.get(a).push(n),this.typeMapping.get(a).sort((s,o)=>{const l=this.widgets.get(s)?.priority||0;return(this.widgets.get(o)?.priority||0)-l})}unregister(n){const r=this.widgets.get(n);if(r&&(this.widgets.delete(n),r.supportedTypes))for(const a of r.supportedTypes){const s=this.typeMapping.get(a);if(s){const o=s.indexOf(n);o>=0&&s.splice(o,1),s.length===0&&this.typeMapping.delete(a)}}}get(n){return this.widgets.get(n)}getAll(){return new Map(this.widgets)}getForType(n){return(this.typeMapping.get(n)||[]).map(a=>this.widgets.get(a)).filter(Boolean)}findBestWidget(n){const r=Ht(n.definition,n.name);if(r?.widget){const s=this.widgets.get(r.widget);if(s)return{name:r.widget,registration:s,resolved:r}}const a=[];for(const[s,o]of this.widgets.entries())if(o.matcher)try{o.matcher(n)&&a.push({name:s,registration:o,priority:o.priority??0})}catch(l){console.warn(`Error in matcher for widget "${s}":`,l)}if(a.length>0){a.sort((o,l)=>l.priority-o.priority);const s=a[0];return{name:s.name,registration:s.registration,resolved:{widget:s.name,source:"heuristics"}}}if(typeof n.definition=="object"&&n.definition.type){const s=Array.isArray(n.definition.type)?n.definition.type[0]:n.definition.type,o=this.getForType(s);if(o.length>0){const l=this.typeMapping.get(s)[0];return{name:l,registration:o[0],resolved:{widget:l,source:"type-fallback"}}}}return null}}const qe=new Zt;function Ye(e,n,r){return{name:e,factory:n,displayName:r?.displayName||e,priority:r?.priority??100,...r}}function Ge(e,n,r){return{name:r?.name||`custom-${e}`,factory:n,displayName:r?.displayName||`${e} widget`,priority:r?.priority??75,matcher:a=>a.definition.format===e,...r}}function Qe(e,n,r,a){return{name:a?.name||`custom-${e}-${n}`,factory:r,displayName:a?.displayName||`${e}:${n} widget`,priority:a?.priority??80,matcher:s=>{const o=s.definition;return o.type===e&&o.format===n},...a}}exports.Base64Input=pe;exports.Base64sInput=Mt;exports.BaseListControl=Pt;exports.BaseNativeSelectControl=St;exports.Card=he;exports.ColorSwatchInput=de;exports.EditableText=be;exports.Expando=Tt;exports.FilesInput=$t;exports.Group=H;exports.ListControl=We;exports.ListInput=Dt;exports.MaskInput=it;exports.NativeSelect=Ft;exports.NativeSelectControl=ye;exports.NullableDateInput=Ie;exports.NullableDateTimeInput=Ce;exports.NullableDurationInput=Le;exports.NullableEmailInput=_e;exports.NullableNumberInput=Ae;exports.NullablePasswordInput=ke;exports.NullableRatingInput=Ue;exports.NullableResetAfter=U;exports.NullableSliderInput=Ne;exports.NullableTextArea=Me;exports.NullableTextInput=$e;exports.NullableUUIDInput=Fe;exports.NullableUrlInput=ze;exports.NumberInput=Te;exports.RatingInput=Rt;exports.SegmentedInput=se;exports.SliderInput=Be;exports.Switch=Ee;exports.TextArea=Nt;exports.UUIDInput=Ot;exports.UnionController=Pe;exports.UnstyledDropZone=Y;exports.UrlInput=Wt;exports.WidgetRegistry=Zt;exports.WithTemporal=Lt;exports._t=ee;exports.durationMaskConfig=zt;exports.emitExpando=fe;exports.emitOptionExpando=At;exports.emptyToNull=rt;exports.ensureTemporal=J;exports.fileToBase64=kt;exports.forFormat=Ge;exports.forTypeAndFormat=Qe;exports.forXUI=Ye;exports.formatColor=R;exports.getContrastRatio=Qt;exports.getXUIConfig=jt;exports.globalWidgetRegistry=qe;exports.gt=Kt;exports.hexToRgb=z;exports.hslToRgb=lt;exports.hwbToRgb=It;exports.isValidColor=Gt;exports.isValidHexColor=st;exports.isValidHslColor=bt;exports.isValidRgbColor=gt;exports.isValidRgbaColor=ht;exports.linearToSrgb=q;exports.mulberry32=wt;exports.normalizeHexColor=yt;exports.nullToEmpty=Bt;exports.oklchToRgb=Ct;exports.parseAnyColor=vt;exports.resolveEffectiveFormat=L;exports.resolveWidget=Ht;exports.rgbToHex=G;exports.rgbToHsl=Q;exports.rgbToHwb=Vt;exports.rgbToOklch=_t;exports.srgbToLinear=X;exports.toRgbaString=xt;exports.transformEmptyStringToUndefined=He;exports.transformNullToUndefined=je;exports.transformUndefinedToNull=Ze;