@epam/ai-dial-ui-kit 0.14.0-dev.46 → 0.14.0-dev.49

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.
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const x=require("./use-file-manager-tabs-dJ-RvTEw.cjs"),Ae=require("./Switch-CUKClcEz.cjs"),n=require("react/jsx-runtime"),h=require("react"),H=require("@tabler/icons-react"),se=require("classnames"),F=require("./DateCellRenderer-BVM-Q8yx.cjs"),V=require("./icon-CrGVkVpG.cjs"),I=require("./merge-classes-Dipy1Ih1.cjs"),L=require("./DateCellRenderer-BYItGoO_.cjs"),T=require("./IconButton-DWqoaBWf.cjs"),Kn=require("react-dom"),ot=require("./lazy-B1eG0EeX.cjs"),le=require("@floating-ui/react"),ae=require("./icon-DhjrDQ8I.cjs");function Wn(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const r in e)if(r!=="default"){const s=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,s.get?s:{enumerable:!0,get:()=>e[r]})}}return t.default=e,Object.freeze(t)}const gr=Wn(h),He=({label:e,className:t,icon:r,selected:s,closable:a,onClick:i,onRemove:o})=>{const l=I.mergeClasses("flex items-center gap-1 cursor-pointer dial-tiny-text px-2 h-[24px] border text-primary rounded-[8px]",s?"hover:bg-controls-accent-primary-alpha-active bg-accent-primary-alpha border-accent-primary":"bg-neutral border-primary",t);return n.jsxs("div",{className:l,onClick:i,children:[n.jsx(F.DialIcon,{icon:r}),n.jsx(F.DialEllipsisTooltip,{text:e}),a&&o&&n.jsx(x.DialButton,{className:"p-0",iconAfter:n.jsx(H.IconX,{size:V.DIAL_ICON_SIZE.SM}),onClick:c=>o(c)})]},e)},Jt=({label:e="Error",className:t})=>n.jsx(He,{label:e,className:I.mergeClasses("dial-tiny-semi-text cursor-default rounded-[120px] border-transparent bg-error text-error",t)});var st=(e=>(e.Default="default",e.Compact="compact",e))(st||{});const qn={[st.Default]:{container:"bg-layer-3",title:"dial-small-text text-secondary",value:"dial-display2-text text-primary",showDescription:!0},[st.Compact]:{container:"bg-layer-2",title:"dial-tiny-text text-secondary",value:"dial-body-semi-text text-primary",showDescription:!1}},Zn=({title:e,value:t,description:r,variant:s=st.Default,error:a,isLoading:i,className:o,delta:l,deltaPositive:c,deltaUnit:d,compareValues:u})=>{const f=qn[s],g=c!==void 0?c:(l??0)>=0,p=l===void 0?null:`${l>=0?`+${l}`:String(l)}${d??""}`;return n.jsxs("div",{className:I.mergeClasses("flex flex-col rounded-lg border border-secondary p-4",a||i?"gap-2":"gap-1",f.container,o),children:[l!==void 0?n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("span",{className:f.title,children:e}),n.jsx("span",{className:I.mergeClasses("dial-tiny-semi-text rounded-[120px] border border-transparent px-2",g?"bg-success text-success":"bg-error text-error"),children:p})]}):n.jsx("span",{className:f.title,children:e}),a?n.jsx(Jt,{className:"self-start"}):i?n.jsx(x.DialLoader,{fullWidth:!1,className:"self-start"}):u?n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsxs("div",{className:"flex min-w-0 flex-1 flex-col gap-0.5",children:[n.jsx(F.DialEllipsisTooltip,{text:u[0].title,className:"dial-tiny-text text-secondary"}),n.jsx("span",{className:f.value,children:u[0].value})]}),n.jsx("div",{className:"h-4 w-px flex-shrink-0 bg-controls-disable-accent"}),n.jsxs("div",{className:"flex min-w-0 flex-1 flex-col gap-0.5",children:[n.jsx(F.DialEllipsisTooltip,{text:u[1].title,className:"dial-tiny-text text-secondary"}),n.jsx("span",{className:f.value,children:u[1].value})]})]}):n.jsx("span",{className:f.value,children:t}),!a&&!i&&f.showDescription&&r!=null&&r!==!1&&n.jsx("span",{className:"dial-tiny-text text-secondary",children:r})]})},er=[{from:0,to:.1,color:"#F26B5B"},{from:.1,to:.2,color:"#E5764A"},{from:.2,to:.3,color:"#E08C3F"},{from:.3,to:.4,color:"#D9A638"},{from:.4,to:.5,color:"#D4BE3A"},{from:.5,to:.6,color:"#B8C94A"},{from:.6,to:.7,color:"#7EC96B"},{from:.7,to:.8,color:"#4ECBA8"},{from:.8,to:.9,color:"#4EC5C5"},{from:.9,to:1,color:"#4DC87A"},{from:1,to:1,color:"#30E070"}],Yn=(e,t)=>t<=0?0:Math.min(Math.max(e/t,0),1),Xn=(e,t)=>{if(e<=0)return;let r;for(const s of t)(s.from===s.to?e>=s.from:e>s.from&&e<=s.to)&&(r=s.color);return r},ut=({value:e,maxValue:t=1,error:r,isLoading:s,title:a,valueLabel:i,colorMap:o=er,className:l,titleClassName:c,valueClassName:d,inline:u,ariaLabel:f})=>{const g=e==null,p=!!(r||s||!g),m=Yn(g?0:e,t),y=Xn(m,o),b=i??(g?"—":e),v=f??(typeof a=="string"?a:void 0),C=r||s,N=r?n.jsx(Jt,{}):s?n.jsx(x.DialLoader,{fullWidth:!1}):n.jsx("span",{className:I.mergeClasses("shrink-0 tabular-nums text-end",u?"dial-small-text min-w-[5ch] text-primary":"dial-small-semi-text text-primary",d),children:b}),S=p?n.jsx("div",{role:"progressbar","aria-valuenow":r||s||typeof e!="number"?void 0:e,"aria-valuemin":0,"aria-valuemax":t,"aria-label":v,className:I.mergeClasses("w-full overflow-hidden rounded-sm",u?"h-1":"h-2",r?"bg-error":"bg-layer-1"),children:!C&&n.jsx("div",{className:"h-full rounded-sm transition-[width] duration-300",style:{width:`${m*100}%`,backgroundColor:y}})}):null,D=n.jsx("span",{className:I.mergeClasses("dial-small-text text-primary",c),children:a});return u?n.jsxs("div",{className:I.mergeClasses("flex flex-row items-center gap-2",l),children:[n.jsx("div",{className:"w-1/2 min-w-0",children:D}),n.jsxs("div",{className:"flex w-1/2 flex-row items-center gap-2",children:[n.jsx("div",{className:"min-w-0 flex-1",children:S}),N]})]}):n.jsxs("div",{className:I.mergeClasses("flex flex-col gap-1",l),children:[n.jsxs("div",{className:"flex flex-row items-center justify-between gap-2",children:[D,N]}),S]})},Ur=({title:e,description:t,children:r,expanded:s,defaultExpanded:a=!1,disabled:i,nonCollapsible:o,onToggle:l,className:c,headerClassName:d,contentClassName:u})=>{const f=s!==void 0,[g,p]=h.useState(a),m=o?!0:f?s:g,y=h.useId(),b=()=>{if(i)return;const v=!m;f||p(v),l?.(v)};return n.jsxs("div",{className:I.mergeClasses("rounded border border-secondary",c),children:[n.jsxs("button",{type:"button","aria-expanded":m,"aria-controls":y,disabled:i||o,onClick:b,className:I.mergeClasses("flex w-full items-center gap-2 p-4 text-left",i?"cursor-not-allowed":"cursor-pointer",o&&"cursor-default",d),children:[!o&&n.jsx(F.DialIcon,{className:se("text-secondary transition-transform",m&&"rotate-90"),icon:n.jsx(H.IconChevronRight,{size:V.DIAL_ICON_SIZE.SM})}),n.jsx("span",{className:"dial-body-text text-primary",children:e}),t!=null&&t!==!1&&n.jsx("span",{className:"dial-tiny-text text-secondary",children:t})]}),m&&n.jsx("div",{id:y,role:"region",className:I.mergeClasses("px-4 pb-4",u),children:r})]})},Qn=({title:e,titleTooltip:t,description:r,data:s,compareData:a,compareLabels:i,maxValue:o,colorMap:l,defaultExpanded:c=!0,nonCollapsible:d,isLoading:u,onBarClick:f,inline:g,barTitleClassName:p,barValueClassName:m,barClassName:y,barDescriptions:b,className:v})=>{const C=Object.entries(s),N=g?I.mergeClasses("text-secondary",p):p,S=i?"dial-tiny-text text-secondary":void 0,D=t?n.jsx(T.DialTooltip,{tooltip:t,children:e}):e,w=a?[...new Set([...Object.keys(s),...Object.keys(a)])]:[],R="cursor-pointer rounded-sm text-left focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent-primary",_="group flex flex-col gap-1.5",O=I.mergeClasses("flex flex-col gap-1.5 pl-2",f&&"group-hover:bg-accent-primary-alpha group-focus-visible:bg-accent-primary-alpha",y);return n.jsx(Ur,{title:D,description:r,defaultExpanded:c,nonCollapsible:d,className:v,children:n.jsx("div",{className:I.mergeClasses("flex flex-col",a?"gap-4":g?"gap-2":"gap-3"),children:u?n.jsx(x.DialLoader,{fullWidth:!1,className:"self-center"}):a?w.map(A=>{const j=A in s?s[A]:null,P=A in a?a[A]:null,G=typeof j=="number"&&typeof P=="number"?parseFloat((P-j).toFixed(3)):null,ee=G!=null&&G!==0,$=ee&&G>0,k=ee?$?`+${G}`:String(G):null,z=b?.[A],q=n.jsx("span",{className:"dial-small-text text-secondary",children:A}),X=n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"flex items-center gap-2",children:[z?n.jsx(T.DialTooltip,{tooltip:z,children:q}):q,k!=null&&n.jsx("span",{className:I.mergeClasses("dial-tiny-semi-text rounded-[120px] border border-transparent px-2",$?"bg-success text-success":"bg-error text-error"),children:k})]}),n.jsxs("div",{className:O,children:[n.jsx(ut,{title:i?.[0],value:j,maxValue:o,colorMap:l,inline:g,titleClassName:S,ariaLabel:A}),n.jsx(ut,{title:i?.[1],value:P,maxValue:o,colorMap:l,inline:g,titleClassName:S,ariaLabel:`${A} compare`})]})]});return f?n.jsx("button",{type:"button",onClick:()=>f(A,j),className:I.mergeClasses(_,R),children:X},A):n.jsx("div",{className:_,children:X},A)}):C.map(([A,j])=>{const P=n.jsx(ut,{title:A,value:j,maxValue:o,colorMap:l,inline:g,titleClassName:N,valueClassName:m,className:y}),B=f?n.jsx("button",{type:"button",onClick:()=>f(A,j),className:R,children:P}):P,G=b?.[A];return G?n.jsx(T.DialTooltip,{tooltip:G,triggerClassName:"flex flex-col",children:B},A):n.jsx(h.Fragment,{children:B},A)})})})},Jn="#FF4E50",es=(e,t)=>{let r=-1;return t.forEach((s,a)=>{(s.from===s.to?e>=s.from:e>s.from&&e<=s.to)&&(r=a)}),r},hr=(e,t)=>{const r=t.map(()=>0);let s=0;e.forEach(c=>{if(c<=0){s+=1;return}const d=es(c,t);d>=0&&(r[d]+=1)});const a=Math.max(0,s,...r),i=c=>a>0?c/a:0,o={from:0,to:0,color:Jn,count:s,ratio:i(s),isZeroBucket:!0},l=t.map((c,d)=>({from:c.from,to:c.to,color:c.color,count:r[d],ratio:i(r[d]),isZeroBucket:!1}));return[o,...l]},Kr=e=>e<=0?2:e%2===0?e:e+1,ts=e=>{const t=Kr(e);return[t,t/2,0]},Ot=e=>`${Math.round(e*100)/100}`,Wr=(e,t)=>e===t?Ot(e):`${Ot(e)}-${Ot(t)}`,At=128,rs=(e,t)=>{const r=Wr(e,t);return e===t?`scored ${r}`:`scored between ${r}`},mr=(e,t,r,s,a)=>n.jsxs("div",{className:"flex flex-col gap-0.5",children:[e&&n.jsx("strong",{children:e}),n.jsxs("span",{children:[t," out of ",r," ",s]}),n.jsx("span",{children:rs(a.from,a.to)})]}),ns=({title:e,values:t,colorMap:r=er,valueTitle:s="values",showCount:a,isLoading:i,className:o,compareValues:l,valueSetLabel:c,compareValueSetLabel:d})=>{const u=hr(t,r),f=l?hr(l,r):void 0,g=t.length,p=l?.length??0,m=Math.max(g,p),y=Kr(m),b=ts(m),v=D=>D.map(w=>({...w,ratio:y>0?w.count/y:0})),C=v(u),N=f?v(f):void 0,S=(D,w,R,_)=>{if(D.count===0)return n.jsx("div",{className:"flex h-full flex-1 items-end","aria-hidden":"true",children:n.jsx("div",{className:"min-h-2 w-full rounded-sm",style:{height:`${D.ratio*100}%`}})});const O=_?{backgroundImage:`repeating-linear-gradient(135deg, ${D.color} 0px, ${D.color} 1px, transparent 1px, transparent 4px)`,borderColor:D.color}:{backgroundColor:D.color};return n.jsx(T.DialTooltip,{placement:"bottom",tooltip:w,triggerClassName:"flex h-full flex-1 items-end",children:n.jsx("div",{role:"img","aria-label":R,className:"flex min-h-2 w-full items-center justify-center rounded-sm border border-transparent",style:{height:`${D.ratio*100}%`,...O},children:a&&n.jsx("span",{className:"dial-tiny-semi-text text-primary",children:D.count})})})};return n.jsxs("div",{className:I.mergeClasses("flex flex-col gap-2",o),children:[n.jsx("span",{className:"dial-small-text text-primary",children:e}),i?n.jsx("div",{className:"flex items-center justify-center",style:{height:At},children:n.jsx(x.DialLoader,{fullWidth:!1})}):n.jsxs("div",{className:"grid grid-cols-[auto_minmax(0,1fr)] gap-x-2 gap-y-1",children:[n.jsx("div",{"data-histogram-y-axis":!0,"aria-hidden":"true",className:"relative",style:{height:At},children:b.map((D,w)=>n.jsx("span",{className:"dial-tiny-text absolute right-0 whitespace-nowrap text-secondary",style:{top:`${w/(b.length-1)*100}%`,transform:"translateY(-50%)"},children:D},D))}),n.jsxs("div",{className:"relative min-w-0",children:[b.map((D,w)=>n.jsx("div",{"data-histogram-grid":!0,className:"pointer-events-none absolute inset-x-0 border-t border-primary",style:{top:`${w/(b.length-1)*100}%`}},D)),n.jsx("div",{className:"relative flex items-end gap-1",style:{height:At},children:N?C.map((D,w)=>{const R=N[w],_=`${D.count} out of ${g} ${s}`,O=`${R.count} out of ${p} ${s}`;return n.jsxs("div",{className:"flex h-full flex-1 items-end",children:[S(D,mr(c,D.count,g,s,D),_,!0),S(R,mr(d,R.count,p,s,R),O,!1)]},w)}):C.map((D,w)=>{const R=`${D.count} out of ${g} ${s}`;return D.count===0?n.jsx("div",{className:"flex h-full flex-1 items-end","aria-hidden":"true",children:n.jsx("div",{className:"min-h-2 w-full rounded-sm",style:{height:`${D.ratio*100}%`}})},w):n.jsx(T.DialTooltip,{placement:"bottom",tooltip:R,triggerClassName:"flex h-full flex-1 items-end",children:n.jsx("div",{role:"img","aria-label":R,className:I.mergeClasses("flex min-h-2 w-full items-center justify-center rounded-sm border","border-transparent"),style:{height:`${D.ratio*100}%`,backgroundColor:D.color},children:a&&D.count>0&&n.jsx("span",{className:"dial-tiny-semi-text text-primary",children:D.count})})},w)})})]}),n.jsx("div",{}),n.jsx("div",{"data-histogram-x-axis":!0,className:"flex gap-1",children:C.map((D,w)=>n.jsx("span",{className:"dial-caption-text flex-1 text-center text-secondary",children:Wr(D.from,D.to)},w))})]})]})},ss=({value:e,max:t=100,size:r=T.ElementSize.Standard,labelProps:s,valueLabel:a,id:i,className:o,"aria-label":l,...c})=>{const d=h.useId(),u=i??d,f=!!s?.label,g=f?s?.id??`${u}-label`:void 0,p=t>0?t:0,m=Number.isFinite(e)?e:0,y=Math.min(Math.max(m,0),p),b=p>0?y/p*100:0,v=n.jsx("div",{...c,id:u,role:"progressbar","aria-valuenow":y,"aria-valuemin":0,"aria-valuemax":p,"aria-labelledby":g,"aria-label":T.resolveAccessibleName(l,f?void 0:"Progress"),className:I.mergeClasses("w-full overflow-hidden rounded-full bg-control-disable-primary",r===T.ElementSize.Small?"h-1":"h-2",o),children:n.jsx("div",{style:{width:`${b}%`},className:"h-full rounded-full bg-control-accent transition-[width] duration-300 motion-reduce:transition-none"})});return!f&&!a?v:n.jsxs("div",{className:"flex w-full flex-col gap-1",children:[n.jsxs("div",{className:"flex items-baseline gap-2",children:[s&&n.jsx(L.Label,{...s,id:g}),a&&n.jsx("span",{className:"dial-tiny-text text-secondary ml-auto shrink-0",children:a})]}),v]})},as=7,is=2,os=e=>e<=0?[]:Array.from({length:e},(t,r)=>r+1);var ft=(e=>(e.Active="active",e.Adjacent="adjacent",e.Far="far",e))(ft||{});const ls=(e,t,r)=>e===t?"active":r<as||Math.abs(e-t)<=is?"adjacent":"far",cs=({page:e,totalPages:t,onPageChange:r,className:s})=>{const a=os(t);return n.jsxs("nav",{"aria-label":"Pagination",className:I.mergeClasses("flex items-center gap-2",s),children:[n.jsx(T.DialIconButton,{icon:n.jsx(H.IconCaretLeftFilled,{size:V.DIAL_ICON_SIZE.SM,className:"text-secondary"}),size:T.ElementSize.Small,className:"!p-0 items-center flex justify-center",disabled:e<=1,onClick:()=>r(e-1),"aria-label":"Previous page"}),n.jsx("div",{className:"flex flex-row items-center gap-2",children:a.map(i=>{const o=ls(i,e,t);return n.jsx("button",{type:"button",onClick:()=>r(i),"aria-label":`Page ${i}`,"aria-current":i===e?"page":void 0,className:I.mergeClasses("dial-pagination-dot rounded-full focus-visible:outline outline-offset-0 transition-all duration-300 ease-in-out",o===ft.Active&&"h-[8px] w-[32px]",o===ft.Adjacent&&"size-[8px]",o===ft.Far&&"size-[4px]")},i)})}),n.jsx(T.DialIconButton,{icon:n.jsx(H.IconCaretRightFilled,{size:V.DIAL_ICON_SIZE.SM,className:"text-secondary"}),size:T.ElementSize.Small,className:"!p-0 items-center flex justify-center",disabled:e>=t,onClick:()=>r(e+1),"aria-label":"Next page"})]})},Gt=({label:e,id:t,checked:r,indeterminate:s,disabled:a,ariaLabel:i,onChange:o,className:l,...c})=>{const d=h.useCallback(p=>{o?.(p.target.checked,t)},[o,t]),u=se("flex flex-row items-center cursor-pointer text-accent-primary small-medium min-w-0",`${r||s?"":'before:content-[""] before:inline-block before:w-[18px] before:h-[18px] before:border before:border-hover before:rounded'}`,a?"pointer-events-none text-secondary before:border-icon-secondary before:bg-layer-4":"",l),f=se("border rounded",a?"bg-layer-4 border-icon-secondary":""),g=()=>s?n.jsx(H.IconMinus,{className:f,...V.BASE_ICON_PROPS}):r?n.jsx(H.IconCheck,{className:f,...V.BASE_ICON_PROPS}):null;return n.jsxs("label",{...c,className:u,htmlFor:t,"aria-description":c["aria-description"]||F.ariaDescription,children:[g(),e&&(typeof e=="string"?n.jsx(F.DialEllipsisTooltip,{text:e,className:"ml-2 text-primary"}):e),n.jsx("input",{type:"checkbox",role:"checkbox",name:t,onChange:d,id:t,checked:r,"aria-checked":s?"mixed":r,"aria-disabled":a||void 0,"aria-label":e?void 0:i,className:"invisible size-0"})]})};var ve=(e=>(e.VALID="valid",e.ERROR="error",e))(ve||{});const ds=(e,t)=>{if(t===e.id)switch(e.status){case ve.VALID:return"border-accent-secondary text-primary";case ve.ERROR:return"border-red-900 text-primary";default:return"border-accent-primary text-primary"}switch(e.status){case ve.VALID:return"border-primary text-primary";case ve.ERROR:return"border-red-900 text-error";default:return"border-primary text-secondary"}},us=(e,t)=>{if(t===e.id)switch(e.status){case ve.VALID:return"bg-accent-secondary";case ve.ERROR:return"bg-red-400";default:return"bg-accent-primary"}switch(e.status){case ve.VALID:return"bg-accent-secondary";case ve.ERROR:return"bg-red-400";default:return"bg-layer-4"}},fs=({step:e,index:t,currentStep:r,onChangeStep:s})=>{const a="h-[32px] flex flex-1 min-w-[180px] items-center dial-tiny-text cursor-pointer dial-step",i="w-[22px] h-[22px] flex justify-center items-center mr-2 rounded-full text-white",o=()=>r===e.id&&e.status===ve.ERROR?n.jsx(H.IconExclamationCircle,{stroke:2,size:V.DIAL_ICON_SIZE.SM}):r!==e.id&&e.status===ve.VALID?n.jsx(H.IconCheck,{stroke:2,size:V.DIAL_ICON_SIZE.SM}):t+1;return n.jsxs("button",{className:se(a,ds(e,r)),onClick:()=>s(e.id),children:[n.jsx("span",{className:se(i,us(e,r)),children:o()}),n.jsx("span",{children:e.name})]})},ps=({steps:e,currentStep:t,onChangeStep:r})=>{const s=a=>{const i=e.findIndex(c=>c.id===t),o=e.findIndex(c=>c.id===a);if(a===t)return;(e.slice(0,o).every(c=>c.status===ve.VALID)||o<i)&&r(a)};return n.jsx("div",{id:"steps",className:"flex gap-x-3",children:e.map((a,i)=>n.jsx(fs,{currentStep:t,onChangeStep:s,step:a,index:i},a.id))})},_t=e=>(e.toString().split(".")[1]??"").length,gs=({value:e,min:t=0,max:r=1,step:s=.1,disabled:a=!1,labelProps:i,labels:o,formatValue:l,onChange:c,className:d,trackClassName:u,fillClassName:f,thumbClassName:g,labelsClassName:p,"aria-label":m,"aria-labelledby":y,...b})=>{const v=h.useRef(null),C=Math.max(0,Math.min(100,(e-t)/(r-t)*100)),N=_t(s),S=l?l(e):e.toFixed(N),D=h.useCallback(O=>{const A=v.current;if(!A)return e;const j=A.getBoundingClientRect(),P=(O-j.left)/j.width,B=t+P*(r-t),G=_t(s),ee=parseFloat((Math.round((B-t)/s)*s+t).toFixed(G));return Math.min(r,Math.max(t,ee))},[t,r,s,e]),w=h.useCallback(O=>{a||(O.currentTarget.setPointerCapture(O.pointerId),c?.(D(O.clientX)))},[a,D,c]),R=h.useCallback(O=>{a||O.buttons===0||c?.(D(O.clientX))},[a,D,c]),_=h.useCallback(O=>{if(a)return;const A=_t(s),j=G=>parseFloat((Math.round((G-t)/s)*s+t).toFixed(A)),P=G=>Math.min(r,Math.max(t,G));let B=e;switch(O.key){case"ArrowRight":case"ArrowUp":B=P(j(e+s));break;case"ArrowLeft":case"ArrowDown":B=P(j(e-s));break;case"Home":B=t;break;case"End":B=r;break;default:return}O.preventDefault(),B!==e&&c?.(B)},[a,e,s,t,r,c]);return n.jsxs("div",{className:I.mergeClasses("flex flex-col",a&&"pointer-events-none opacity-50",d),...b,children:[i&&n.jsx(Ae.DialLabel,{...i,htmlFor:b.id}),n.jsxs("div",{ref:v,className:"relative flex h-[38px] cursor-pointer items-center",onPointerDown:w,onPointerMove:R,children:[n.jsx("div",{className:I.mergeClasses("pointer-events-none absolute inset-x-0 h-3 rounded-[10px] bg-layer-1",u)}),n.jsx("div",{className:I.mergeClasses("pointer-events-none absolute left-0 h-3 rounded-[10px] bg-controls-accent-primary",f),style:{width:`${C}%`}}),n.jsx("div",{role:"slider",tabIndex:a?-1:0,"aria-valuenow":e,"aria-valuemin":t,"aria-valuemax":r,"aria-disabled":a||void 0,"aria-label":m,"aria-labelledby":y,className:I.mergeClasses("dial-small-text absolute -translate-x-1/2 flex size-[38px] cursor-grab select-none items-center justify-center rounded-full bg-layer-3 text-primary shadow focus:outline-none focus-visible:ring-2 focus-visible:ring-focus",g),style:{left:`${C}%`},onKeyDown:_,children:S})]}),o&&n.jsx("div",{className:I.mergeClasses("dial-tiny-text flex text-secondary",p),children:o.length===3?n.jsxs(n.Fragment,{children:[n.jsx("span",{children:o[0]}),n.jsx("span",{className:"flex-1 text-center",children:o[1]}),n.jsx("span",{children:o[2]})]}):n.jsxs(n.Fragment,{children:[n.jsx("span",{children:o[0]}),n.jsx("span",{className:"ml-auto",children:o[1]})]})})]})},hs=({label:e,text:t,tooltip:r,children:s,postfix:a,className:i})=>n.jsxs("div",{className:I.mergeClasses("flex flex-col",s?"":"max-w-[200px]",i),children:[e&&n.jsx("label",{className:"dial-tiny-text mb-2 text-secondary",children:e}),s||n.jsxs("div",{className:"flex flex-row items-center gap-x-2",children:[n.jsx(T.DialTooltip,{triggerClassName:"text-primary flex-1 min-w-0",tooltip:r||t,children:t}),a||null]})]}),qr=h.createContext({dragDropManager:void 0});function De(e){return"Minified Redux error #"+e+"; visit https://redux.js.org/Errors?code="+e+" for the full message or use the non-minified dev environment for full errors. "}var xr=(function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"})(),br=function(){return Math.random().toString(36).substring(7).split("").join(".")},vr={INIT:"@@redux/INIT"+br(),REPLACE:"@@redux/REPLACE"+br()};function ms(e){if(typeof e!="object"||e===null)return!1;for(var t=e;Object.getPrototypeOf(t)!==null;)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t}function xs(e){if(e===void 0)return"undefined";if(e===null)return"null";var t=typeof e;switch(t){case"boolean":case"string":case"number":case"symbol":case"function":return t}if(Array.isArray(e))return"array";if(ys(e))return"date";if(vs(e))return"error";var r=bs(e);switch(r){case"Symbol":case"Promise":case"WeakMap":case"WeakSet":case"Map":case"Set":return r}return t.slice(8,-1).toLowerCase().replace(/\s/g,"")}function bs(e){return typeof e.constructor=="function"?e.constructor.name:null}function vs(e){return e instanceof Error||typeof e.message=="string"&&e.constructor&&typeof e.constructor.stackTraceLimit=="number"}function ys(e){return e instanceof Date?!0:typeof e.toDateString=="function"&&typeof e.getDate=="function"&&typeof e.setDate=="function"}function Ke(e){var t=typeof e;return process.env.NODE_ENV!=="production"&&(t=xs(e)),t}function Zr(e,t,r){var s;if(typeof t=="function"&&typeof r=="function"||typeof r=="function"&&typeof arguments[3]=="function")throw new Error(process.env.NODE_ENV==="production"?De(0):"It looks like you are passing several store enhancers to createStore(). This is not supported. Instead, compose them together to a single function. See https://redux.js.org/tutorials/fundamentals/part-4-store#creating-a-store-with-enhancers for an example.");if(typeof t=="function"&&typeof r>"u"&&(r=t,t=void 0),typeof r<"u"){if(typeof r!="function")throw new Error(process.env.NODE_ENV==="production"?De(1):"Expected the enhancer to be a function. Instead, received: '"+Ke(r)+"'");return r(Zr)(e,t)}if(typeof e!="function")throw new Error(process.env.NODE_ENV==="production"?De(2):"Expected the root reducer to be a function. Instead, received: '"+Ke(e)+"'");var a=e,i=t,o=[],l=o,c=!1;function d(){l===o&&(l=o.slice())}function u(){if(c)throw new Error(process.env.NODE_ENV==="production"?De(3):"You may not call store.getState() while the reducer is executing. The reducer has already received the state as an argument. Pass it down from the top reducer instead of reading it from the store.");return i}function f(y){if(typeof y!="function")throw new Error(process.env.NODE_ENV==="production"?De(4):"Expected the listener to be a function. Instead, received: '"+Ke(y)+"'");if(c)throw new Error(process.env.NODE_ENV==="production"?De(5):"You may not call store.subscribe() while the reducer is executing. If you would like to be notified after the store has been updated, subscribe from a component and invoke store.getState() in the callback to access the latest state. See https://redux.js.org/api/store#subscribelistener for more details.");var b=!0;return d(),l.push(y),function(){if(b){if(c)throw new Error(process.env.NODE_ENV==="production"?De(6):"You may not unsubscribe from a store listener while the reducer is executing. See https://redux.js.org/api/store#subscribelistener for more details.");b=!1,d();var C=l.indexOf(y);l.splice(C,1),o=null}}}function g(y){if(!ms(y))throw new Error(process.env.NODE_ENV==="production"?De(7):"Actions must be plain objects. Instead, the actual type was: '"+Ke(y)+"'. You may need to add middleware to your store setup to handle dispatching other values, such as 'redux-thunk' to handle dispatching functions. See https://redux.js.org/tutorials/fundamentals/part-4-store#middleware and https://redux.js.org/tutorials/fundamentals/part-6-async-logic#using-the-redux-thunk-middleware for examples.");if(typeof y.type>"u")throw new Error(process.env.NODE_ENV==="production"?De(8):'Actions may not have an undefined "type" property. You may have misspelled an action type string constant.');if(c)throw new Error(process.env.NODE_ENV==="production"?De(9):"Reducers may not dispatch actions.");try{c=!0,i=a(i,y)}finally{c=!1}for(var b=o=l,v=0;v<b.length;v++){var C=b[v];C()}return y}function p(y){if(typeof y!="function")throw new Error(process.env.NODE_ENV==="production"?De(10):"Expected the nextReducer to be a function. Instead, received: '"+Ke(y));a=y,g({type:vr.REPLACE})}function m(){var y,b=f;return y={subscribe:function(C){if(typeof C!="object"||C===null)throw new Error(process.env.NODE_ENV==="production"?De(11):"Expected the observer to be an object. Instead, received: '"+Ke(C)+"'");function N(){C.next&&C.next(u())}N();var S=b(N);return{unsubscribe:S}}},y[xr]=function(){return this},y}return g({type:vr.INIT}),s={dispatch:g,subscribe:f,getState:u,replaceReducer:p},s[xr]=m,s}function W(e,t,...r){if(Ds()&&t===void 0)throw new Error("invariant requires an error message argument");if(!e){let s;if(t===void 0)s=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{let a=0;s=new Error(t.replace(/%s/g,function(){return r[a++]})),s.name="Invariant Violation"}throw s.framesToPop=1,s}}function Ds(){return typeof process<"u"&&process.env.NODE_ENV==="production"}function Cs(e,t,r){return t.split(".").reduce((s,a)=>s&&s[a]?s[a]:r||null,e)}function Ns(e,t){return e.filter(r=>r!==t)}function Yr(e){return typeof e=="object"}function Is(e,t){const r=new Map,s=i=>{r.set(i,r.has(i)?r.get(i)+1:1)};e.forEach(s),t.forEach(s);const a=[];return r.forEach((i,o)=>{i===1&&a.push(o)}),a}function Ss(e,t){return e.filter(r=>t.indexOf(r)>-1)}const tr="dnd-core/INIT_COORDS",vt="dnd-core/BEGIN_DRAG",rr="dnd-core/PUBLISH_DRAG_SOURCE",yt="dnd-core/HOVER",Dt="dnd-core/DROP",Ct="dnd-core/END_DRAG";function yr(e,t){return{type:tr,payload:{sourceClientOffset:t||null,clientOffset:e||null}}}const js={type:tr,payload:{clientOffset:null,sourceClientOffset:null}};function Ts(e){return function(r=[],s={publishSource:!0}){const{publishSource:a=!0,clientOffset:i,getSourceClientOffset:o}=s,l=e.getMonitor(),c=e.getRegistry();e.dispatch(yr(i)),ws(r,l,c);const d=As(r,l);if(d==null){e.dispatch(js);return}let u=null;if(i){if(!o)throw new Error("getSourceClientOffset must be defined");Es(o),u=o(d)}e.dispatch(yr(i,u));const g=c.getSource(d).beginDrag(l,d);if(g==null)return;Os(g),c.pinSource(d);const p=c.getSourceType(d);return{type:vt,payload:{itemType:p,item:g,sourceId:d,clientOffset:i||null,sourceClientOffset:u||null,isSourcePublic:!!a}}}}function ws(e,t,r){W(!t.isDragging(),"Cannot call beginDrag while dragging."),e.forEach(function(s){W(r.getSource(s),"Expected sourceIds to be registered.")})}function Es(e){W(typeof e=="function","When clientOffset is provided, getSourceClientOffset must be a function.")}function Os(e){W(Yr(e),"Item must be an object.")}function As(e,t){let r=null;for(let s=e.length-1;s>=0;s--)if(t.canDragSource(e[s])){r=e[s];break}return r}function _s(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Rs(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{},s=Object.keys(r);typeof Object.getOwnPropertySymbols=="function"&&(s=s.concat(Object.getOwnPropertySymbols(r).filter(function(a){return Object.getOwnPropertyDescriptor(r,a).enumerable}))),s.forEach(function(a){_s(e,a,r[a])})}return e}function ks(e){return function(r={}){const s=e.getMonitor(),a=e.getRegistry();Ps(s),Fs(s).forEach((o,l)=>{const c=Ls(o,l,a,s),d={type:Dt,payload:{dropResult:Rs({},r,c)}};e.dispatch(d)})}}function Ps(e){W(e.isDragging(),"Cannot call drop while not dragging."),W(!e.didDrop(),"Cannot call drop twice during one drag operation.")}function Ls(e,t,r,s){const a=r.getTarget(e);let i=a?a.drop(s,e):void 0;return Ms(i),typeof i>"u"&&(i=t===0?{}:s.getDropResult()),i}function Ms(e){W(typeof e>"u"||Yr(e),"Drop result must either be an object or undefined.")}function Fs(e){const t=e.getTargetIds().filter(e.canDropOnTarget,e);return t.reverse(),t}function Bs(e){return function(){const r=e.getMonitor(),s=e.getRegistry();zs(r);const a=r.getSourceId();return a!=null&&(s.getSource(a,!0).endDrag(r,a),s.unpinSource()),{type:Ct}}}function zs(e){W(e.isDragging(),"Cannot call endDrag while not dragging.")}function Ut(e,t){return t===null?e===null:Array.isArray(e)?e.some(r=>r===t):e===t}function $s(e){return function(r,{clientOffset:s}={}){Hs(r);const a=r.slice(0),i=e.getMonitor(),o=e.getRegistry(),l=i.getItemType();return Gs(a,o,l),Vs(a,i,o),Us(a,i,o),{type:yt,payload:{targetIds:a,clientOffset:s||null}}}}function Hs(e){W(Array.isArray(e),"Expected targetIds to be an array.")}function Vs(e,t,r){W(t.isDragging(),"Cannot call hover while not dragging."),W(!t.didDrop(),"Cannot call hover after drop.");for(let s=0;s<e.length;s++){const a=e[s];W(e.lastIndexOf(a)===s,"Expected targetIds to be unique in the passed array.");const i=r.getTarget(a);W(i,"Expected targetIds to be registered.")}}function Gs(e,t,r){for(let s=e.length-1;s>=0;s--){const a=e[s],i=t.getTargetType(a);Ut(i,r)||e.splice(s,1)}}function Us(e,t,r){e.forEach(function(s){r.getTarget(s).hover(t,s)})}function Ks(e){return function(){if(e.getMonitor().isDragging())return{type:rr}}}function Ws(e){return{beginDrag:Ts(e),publishDragSource:Ks(e),hover:$s(e),drop:ks(e),endDrag:Bs(e)}}class qs{receiveBackend(t){this.backend=t}getMonitor(){return this.monitor}getBackend(){return this.backend}getRegistry(){return this.monitor.registry}getActions(){const t=this,{dispatch:r}=this.store;function s(i){return(...o)=>{const l=i.apply(t,o);typeof l<"u"&&r(l)}}const a=Ws(this);return Object.keys(a).reduce((i,o)=>{const l=a[o];return i[o]=s(l),i},{})}dispatch(t){this.store.dispatch(t)}constructor(t,r){this.isSetUp=!1,this.handleRefCountChange=()=>{const s=this.store.getState().refCount>0;this.backend&&(s&&!this.isSetUp?(this.backend.setup(),this.isSetUp=!0):!s&&this.isSetUp&&(this.backend.teardown(),this.isSetUp=!1))},this.store=t,this.monitor=r,t.subscribe(this.handleRefCountChange)}}function Zs(e,t){return{x:e.x+t.x,y:e.y+t.y}}function Xr(e,t){return{x:e.x-t.x,y:e.y-t.y}}function Ys(e){const{clientOffset:t,initialClientOffset:r,initialSourceClientOffset:s}=e;return!t||!r||!s?null:Xr(Zs(t,s),r)}function Xs(e){const{clientOffset:t,initialClientOffset:r}=e;return!t||!r?null:Xr(t,r)}const rt=[],nr=[];rt.__IS_NONE__=!0;nr.__IS_ALL__=!0;function Qs(e,t){return e===rt?!1:e===nr||typeof t>"u"?!0:Ss(t,e).length>0}class Js{subscribeToStateChange(t,r={}){const{handlerIds:s}=r;W(typeof t=="function","listener must be a function."),W(typeof s>"u"||Array.isArray(s),"handlerIds, when specified, must be an array of strings.");let a=this.store.getState().stateId;const i=()=>{const o=this.store.getState(),l=o.stateId;try{l===a||l===a+1&&!Qs(o.dirtyHandlerIds,s)||t()}finally{a=l}};return this.store.subscribe(i)}subscribeToOffsetChange(t){W(typeof t=="function","listener must be a function.");let r=this.store.getState().dragOffset;const s=()=>{const a=this.store.getState().dragOffset;a!==r&&(r=a,t())};return this.store.subscribe(s)}canDragSource(t){if(!t)return!1;const r=this.registry.getSource(t);return W(r,`Expected to find a valid source. sourceId=${t}`),this.isDragging()?!1:r.canDrag(this,t)}canDropOnTarget(t){if(!t)return!1;const r=this.registry.getTarget(t);if(W(r,`Expected to find a valid target. targetId=${t}`),!this.isDragging()||this.didDrop())return!1;const s=this.registry.getTargetType(t),a=this.getItemType();return Ut(s,a)&&r.canDrop(this,t)}isDragging(){return!!this.getItemType()}isDraggingSource(t){if(!t)return!1;const r=this.registry.getSource(t,!0);if(W(r,`Expected to find a valid source. sourceId=${t}`),!this.isDragging()||!this.isSourcePublic())return!1;const s=this.registry.getSourceType(t),a=this.getItemType();return s!==a?!1:r.isDragging(this,t)}isOverTarget(t,r={shallow:!1}){if(!t)return!1;const{shallow:s}=r;if(!this.isDragging())return!1;const a=this.registry.getTargetType(t),i=this.getItemType();if(i&&!Ut(a,i))return!1;const o=this.getTargetIds();if(!o.length)return!1;const l=o.indexOf(t);return s?l===o.length-1:l>-1}getItemType(){return this.store.getState().dragOperation.itemType}getItem(){return this.store.getState().dragOperation.item}getSourceId(){return this.store.getState().dragOperation.sourceId}getTargetIds(){return this.store.getState().dragOperation.targetIds}getDropResult(){return this.store.getState().dragOperation.dropResult}didDrop(){return this.store.getState().dragOperation.didDrop}isSourcePublic(){return!!this.store.getState().dragOperation.isSourcePublic}getInitialClientOffset(){return this.store.getState().dragOffset.initialClientOffset}getInitialSourceClientOffset(){return this.store.getState().dragOffset.initialSourceClientOffset}getClientOffset(){return this.store.getState().dragOffset.clientOffset}getSourceClientOffset(){return Ys(this.store.getState().dragOffset)}getDifferenceFromInitialOffset(){return Xs(this.store.getState().dragOffset)}constructor(t,r){this.store=t,this.registry=r}}const Dr=typeof global<"u"?global:self,Qr=Dr.MutationObserver||Dr.WebKitMutationObserver;function Jr(e){return function(){const r=setTimeout(a,0),s=setInterval(a,50);function a(){clearTimeout(r),clearInterval(s),e()}}}function ea(e){let t=1;const r=new Qr(e),s=document.createTextNode("");return r.observe(s,{characterData:!0}),function(){t=-t,s.data=t}}const ta=typeof Qr=="function"?ea:Jr;class ra{enqueueTask(t){const{queue:r,requestFlush:s}=this;r.length||(s(),this.flushing=!0),r[r.length]=t}constructor(){this.queue=[],this.pendingErrors=[],this.flushing=!1,this.index=0,this.capacity=1024,this.flush=()=>{const{queue:t}=this;for(;this.index<t.length;){const r=this.index;if(this.index++,t[r].call(),this.index>this.capacity){for(let s=0,a=t.length-this.index;s<a;s++)t[s]=t[s+this.index];t.length-=this.index,this.index=0}}t.length=0,this.index=0,this.flushing=!1},this.registerPendingError=t=>{this.pendingErrors.push(t),this.requestErrorThrow()},this.requestFlush=ta(this.flush),this.requestErrorThrow=Jr(()=>{if(this.pendingErrors.length)throw this.pendingErrors.shift()})}}class na{call(){try{this.task&&this.task()}catch(t){this.onError(t)}finally{this.task=null,this.release(this)}}constructor(t,r){this.onError=t,this.release=r,this.task=null}}class sa{create(t){const r=this.freeTasks,s=r.length?r.pop():new na(this.onError,a=>r[r.length]=a);return s.task=t,s}constructor(t){this.onError=t,this.freeTasks=[]}}const en=new ra,aa=new sa(en.registerPendingError);function ia(e){en.enqueueTask(aa.create(e))}const sr="dnd-core/ADD_SOURCE",ar="dnd-core/ADD_TARGET",ir="dnd-core/REMOVE_SOURCE",Nt="dnd-core/REMOVE_TARGET";function oa(e){return{type:sr,payload:{sourceId:e}}}function la(e){return{type:ar,payload:{targetId:e}}}function ca(e){return{type:ir,payload:{sourceId:e}}}function da(e){return{type:Nt,payload:{targetId:e}}}function ua(e){W(typeof e.canDrag=="function","Expected canDrag to be a function."),W(typeof e.beginDrag=="function","Expected beginDrag to be a function."),W(typeof e.endDrag=="function","Expected endDrag to be a function.")}function fa(e){W(typeof e.canDrop=="function","Expected canDrop to be a function."),W(typeof e.hover=="function","Expected hover to be a function."),W(typeof e.drop=="function","Expected beginDrag to be a function.")}function Kt(e,t){if(t&&Array.isArray(e)){e.forEach(r=>Kt(r,!1));return}W(typeof e=="string"||typeof e=="symbol",t?"Type can only be a string, a symbol, or an array of either.":"Type can only be a string or a symbol.")}var Ce;(function(e){e.SOURCE="SOURCE",e.TARGET="TARGET"})(Ce||(Ce={}));let pa=0;function ga(){return pa++}function ha(e){const t=ga().toString();switch(e){case Ce.SOURCE:return`S${t}`;case Ce.TARGET:return`T${t}`;default:throw new Error(`Unknown Handler Role: ${e}`)}}function Cr(e){switch(e[0]){case"S":return Ce.SOURCE;case"T":return Ce.TARGET;default:throw new Error(`Cannot parse handler ID: ${e}`)}}function Nr(e,t){const r=e.entries();let s=!1;do{const{done:a,value:[,i]}=r.next();if(i===t)return!0;s=!!a}while(!s);return!1}class ma{addSource(t,r){Kt(t),ua(r);const s=this.addHandler(Ce.SOURCE,t,r);return this.store.dispatch(oa(s)),s}addTarget(t,r){Kt(t,!0),fa(r);const s=this.addHandler(Ce.TARGET,t,r);return this.store.dispatch(la(s)),s}containsHandler(t){return Nr(this.dragSources,t)||Nr(this.dropTargets,t)}getSource(t,r=!1){return W(this.isSourceId(t),"Expected a valid source ID."),r&&t===this.pinnedSourceId?this.pinnedSource:this.dragSources.get(t)}getTarget(t){return W(this.isTargetId(t),"Expected a valid target ID."),this.dropTargets.get(t)}getSourceType(t){return W(this.isSourceId(t),"Expected a valid source ID."),this.types.get(t)}getTargetType(t){return W(this.isTargetId(t),"Expected a valid target ID."),this.types.get(t)}isSourceId(t){return Cr(t)===Ce.SOURCE}isTargetId(t){return Cr(t)===Ce.TARGET}removeSource(t){W(this.getSource(t),"Expected an existing source."),this.store.dispatch(ca(t)),ia(()=>{this.dragSources.delete(t),this.types.delete(t)})}removeTarget(t){W(this.getTarget(t),"Expected an existing target."),this.store.dispatch(da(t)),this.dropTargets.delete(t),this.types.delete(t)}pinSource(t){const r=this.getSource(t);W(r,"Expected an existing source."),this.pinnedSourceId=t,this.pinnedSource=r}unpinSource(){W(this.pinnedSource,"No source is pinned at the time."),this.pinnedSourceId=null,this.pinnedSource=null}addHandler(t,r,s){const a=ha(t);return this.types.set(a,r),t===Ce.SOURCE?this.dragSources.set(a,s):t===Ce.TARGET&&this.dropTargets.set(a,s),a}constructor(t){this.types=new Map,this.dragSources=new Map,this.dropTargets=new Map,this.pinnedSourceId=null,this.pinnedSource=null,this.store=t}}const xa=(e,t)=>e===t;function ba(e,t){return!e&&!t?!0:!e||!t?!1:e.x===t.x&&e.y===t.y}function va(e,t,r=xa){if(e.length!==t.length)return!1;for(let s=0;s<e.length;++s)if(!r(e[s],t[s]))return!1;return!0}function ya(e=rt,t){switch(t.type){case yt:break;case sr:case ar:case Nt:case ir:return rt;case vt:case rr:case Ct:case Dt:default:return nr}const{targetIds:r=[],prevTargetIds:s=[]}=t.payload,a=Is(r,s);if(!(a.length>0||!va(r,s)))return rt;const o=s[s.length-1],l=r[r.length-1];return o!==l&&(o&&a.push(o),l&&a.push(l)),a}function Da(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Ca(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{},s=Object.keys(r);typeof Object.getOwnPropertySymbols=="function"&&(s=s.concat(Object.getOwnPropertySymbols(r).filter(function(a){return Object.getOwnPropertyDescriptor(r,a).enumerable}))),s.forEach(function(a){Da(e,a,r[a])})}return e}const Ir={initialSourceClientOffset:null,initialClientOffset:null,clientOffset:null};function Na(e=Ir,t){const{payload:r}=t;switch(t.type){case tr:case vt:return{initialSourceClientOffset:r.sourceClientOffset,initialClientOffset:r.clientOffset,clientOffset:r.clientOffset};case yt:return ba(e.clientOffset,r.clientOffset)?e:Ca({},e,{clientOffset:r.clientOffset});case Ct:case Dt:return Ir;default:return e}}function Ia(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function We(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{},s=Object.keys(r);typeof Object.getOwnPropertySymbols=="function"&&(s=s.concat(Object.getOwnPropertySymbols(r).filter(function(a){return Object.getOwnPropertyDescriptor(r,a).enumerable}))),s.forEach(function(a){Ia(e,a,r[a])})}return e}const Sa={itemType:null,item:null,sourceId:null,targetIds:[],dropResult:null,didDrop:!1,isSourcePublic:null};function ja(e=Sa,t){const{payload:r}=t;switch(t.type){case vt:return We({},e,{itemType:r.itemType,item:r.item,sourceId:r.sourceId,isSourcePublic:r.isSourcePublic,dropResult:null,didDrop:!1});case rr:return We({},e,{isSourcePublic:!0});case yt:return We({},e,{targetIds:r.targetIds});case Nt:return e.targetIds.indexOf(r.targetId)===-1?e:We({},e,{targetIds:Ns(e.targetIds,r.targetId)});case Dt:return We({},e,{dropResult:r.dropResult,didDrop:!0,targetIds:[]});case Ct:return We({},e,{itemType:null,item:null,sourceId:null,dropResult:null,didDrop:!1,isSourcePublic:null,targetIds:[]});default:return e}}function Ta(e=0,t){switch(t.type){case sr:case ar:return e+1;case ir:case Nt:return e-1;default:return e}}function wa(e=0){return e+1}function Ea(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Oa(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{},s=Object.keys(r);typeof Object.getOwnPropertySymbols=="function"&&(s=s.concat(Object.getOwnPropertySymbols(r).filter(function(a){return Object.getOwnPropertyDescriptor(r,a).enumerable}))),s.forEach(function(a){Ea(e,a,r[a])})}return e}function Aa(e={},t){return{dirtyHandlerIds:ya(e.dirtyHandlerIds,{type:t.type,payload:Oa({},t.payload,{prevTargetIds:Cs(e,"dragOperation.targetIds",[])})}),dragOffset:Na(e.dragOffset,t),refCount:Ta(e.refCount,t),dragOperation:ja(e.dragOperation,t),stateId:wa(e.stateId)}}function _a(e,t=void 0,r={},s=!1){const a=Ra(s),i=new Js(a,new ma(a)),o=new qs(a,i),l=e(o,t,r);return o.receiveBackend(l),o}function Ra(e){const t=typeof window<"u"&&window.__REDUX_DEVTOOLS_EXTENSION__;return Zr(Aa,e&&t&&t({name:"dnd-core",instanceId:"dnd-core"}))}function ka(e,t){if(e==null)return{};var r=Pa(e,t),s,a;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a<i.length;a++)s=i[a],!(t.indexOf(s)>=0)&&Object.prototype.propertyIsEnumerable.call(e,s)&&(r[s]=e[s])}return r}function Pa(e,t){if(e==null)return{};var r={},s=Object.keys(e),a,i;for(i=0;i<s.length;i++)a=s[i],!(t.indexOf(a)>=0)&&(r[a]=e[a]);return r}let Sr=0;const pt=Symbol.for("__REACT_DND_CONTEXT_INSTANCE__");var La=h.memo(function(t){var{children:r}=t,s=ka(t,["children"]);const[a,i]=Ma(s);return h.useEffect(()=>{if(i){const o=tn();return++Sr,()=>{--Sr===0&&(o[pt]=null)}}},[]),n.jsx(qr.Provider,{value:a,children:r})});function Ma(e){if("manager"in e)return[{dragDropManager:e.manager},!1];const t=Fa(e.backend,e.context,e.options,e.debugMode),r=!e.context;return[t,r]}function Fa(e,t=tn(),r,s){const a=t;return a[pt]||(a[pt]={dragDropManager:_a(e,t,r,s)}),a[pt]}function tn(){return typeof global<"u"?global:window}var Rt,jr;function Ba(){return jr||(jr=1,Rt=function e(t,r){if(t===r)return!0;if(t&&r&&typeof t=="object"&&typeof r=="object"){if(t.constructor!==r.constructor)return!1;var s,a,i;if(Array.isArray(t)){if(s=t.length,s!=r.length)return!1;for(a=s;a--!==0;)if(!e(t[a],r[a]))return!1;return!0}if(t.constructor===RegExp)return t.source===r.source&&t.flags===r.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===r.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===r.toString();if(i=Object.keys(t),s=i.length,s!==Object.keys(r).length)return!1;for(a=s;a--!==0;)if(!Object.prototype.hasOwnProperty.call(r,i[a]))return!1;for(a=s;a--!==0;){var o=i[a];if(!e(t[o],r[o]))return!1}return!0}return t!==t&&r!==r}),Rt}var za=Ba();const $a=x.getDefaultExportFromCjs(za),Ve=typeof window<"u"?h.useLayoutEffect:h.useEffect;function Ha(e,t,r){const[s,a]=h.useState(()=>t(e)),i=h.useCallback(()=>{const o=t(e);$a(s,o)||(a(o),r&&r())},[s,e,r]);return Ve(i),[s,i]}function Va(e,t,r){const[s,a]=Ha(e,t,r);return Ve(function(){const o=e.getHandlerId();if(o!=null)return e.subscribeToStateChange(a,{handlerIds:[o]})},[e,a]),s}function rn(e,t,r){return Va(t,e||(()=>({})),()=>r.reconnect())}function nn(e,t){const r=[...t||[]];return t==null&&typeof e!="function"&&r.push(e),h.useMemo(()=>typeof e=="function"?e():e,r)}function Ga(e){return h.useMemo(()=>e.hooks.dragSource(),[e])}function Ua(e){return h.useMemo(()=>e.hooks.dragPreview(),[e])}let kt=!1,Pt=!1;class Ka{receiveHandlerId(t){this.sourceId=t}getHandlerId(){return this.sourceId}canDrag(){W(!kt,"You may not call monitor.canDrag() inside your canDrag() implementation. Read more: http://react-dnd.github.io/react-dnd/docs/api/drag-source-monitor");try{return kt=!0,this.internalMonitor.canDragSource(this.sourceId)}finally{kt=!1}}isDragging(){if(!this.sourceId)return!1;W(!Pt,"You may not call monitor.isDragging() inside your isDragging() implementation. Read more: http://react-dnd.github.io/react-dnd/docs/api/drag-source-monitor");try{return Pt=!0,this.internalMonitor.isDraggingSource(this.sourceId)}finally{Pt=!1}}subscribeToStateChange(t,r){return this.internalMonitor.subscribeToStateChange(t,r)}isDraggingSource(t){return this.internalMonitor.isDraggingSource(t)}isOverTarget(t,r){return this.internalMonitor.isOverTarget(t,r)}getTargetIds(){return this.internalMonitor.getTargetIds()}isSourcePublic(){return this.internalMonitor.isSourcePublic()}getSourceId(){return this.internalMonitor.getSourceId()}subscribeToOffsetChange(t){return this.internalMonitor.subscribeToOffsetChange(t)}canDragSource(t){return this.internalMonitor.canDragSource(t)}canDropOnTarget(t){return this.internalMonitor.canDropOnTarget(t)}getItemType(){return this.internalMonitor.getItemType()}getItem(){return this.internalMonitor.getItem()}getDropResult(){return this.internalMonitor.getDropResult()}didDrop(){return this.internalMonitor.didDrop()}getInitialClientOffset(){return this.internalMonitor.getInitialClientOffset()}getInitialSourceClientOffset(){return this.internalMonitor.getInitialSourceClientOffset()}getSourceClientOffset(){return this.internalMonitor.getSourceClientOffset()}getClientOffset(){return this.internalMonitor.getClientOffset()}getDifferenceFromInitialOffset(){return this.internalMonitor.getDifferenceFromInitialOffset()}constructor(t){this.sourceId=null,this.internalMonitor=t.getMonitor()}}let Lt=!1;class Wa{receiveHandlerId(t){this.targetId=t}getHandlerId(){return this.targetId}subscribeToStateChange(t,r){return this.internalMonitor.subscribeToStateChange(t,r)}canDrop(){if(!this.targetId)return!1;W(!Lt,"You may not call monitor.canDrop() inside your canDrop() implementation. Read more: http://react-dnd.github.io/react-dnd/docs/api/drop-target-monitor");try{return Lt=!0,this.internalMonitor.canDropOnTarget(this.targetId)}finally{Lt=!1}}isOver(t){return this.targetId?this.internalMonitor.isOverTarget(this.targetId,t):!1}getItemType(){return this.internalMonitor.getItemType()}getItem(){return this.internalMonitor.getItem()}getDropResult(){return this.internalMonitor.getDropResult()}didDrop(){return this.internalMonitor.didDrop()}getInitialClientOffset(){return this.internalMonitor.getInitialClientOffset()}getInitialSourceClientOffset(){return this.internalMonitor.getInitialSourceClientOffset()}getSourceClientOffset(){return this.internalMonitor.getSourceClientOffset()}getClientOffset(){return this.internalMonitor.getClientOffset()}getDifferenceFromInitialOffset(){return this.internalMonitor.getDifferenceFromInitialOffset()}constructor(t){this.targetId=null,this.internalMonitor=t.getMonitor()}}function qa(e,t,r){const s=r.getRegistry(),a=s.addTarget(e,t);return[a,()=>s.removeTarget(a)]}function Za(e,t,r){const s=r.getRegistry(),a=s.addSource(e,t);return[a,()=>s.removeSource(a)]}function Wt(e,t,r,s){let a;if(a!==void 0)return!!a;if(e===t)return!0;if(typeof e!="object"||!e||typeof t!="object"||!t)return!1;const i=Object.keys(e),o=Object.keys(t);if(i.length!==o.length)return!1;const l=Object.prototype.hasOwnProperty.bind(t);for(let c=0;c<i.length;c++){const d=i[c];if(!l(d))return!1;const u=e[d],f=t[d];if(a=void 0,a===!1||a===void 0&&u!==f)return!1}return!0}function qt(e){return e!==null&&typeof e=="object"&&Object.prototype.hasOwnProperty.call(e,"current")}function Ya(e){if(typeof e.type=="string")return;const t=e.type.displayName||e.type.name||"the component";throw new Error(`Only native element nodes can now be passed to React DnD connectors.You can either wrap ${t} into a <div>, or turn it into a drag source or a drop target itself.`)}function Xa(e){return(t=null,r=null)=>{if(!h.isValidElement(t)){const i=t;return e(i,r),i}const s=t;return Ya(s),Qa(s,r?i=>e(i,r):e)}}function sn(e){const t={};return Object.keys(e).forEach(r=>{const s=e[r];if(r.endsWith("Ref"))t[r]=e[r];else{const a=Xa(s);t[r]=()=>a}}),t}function Tr(e,t){typeof e=="function"?e(t):e.current=t}function Qa(e,t){const r=e.ref;return W(typeof r!="string","Cannot connect React DnD to an element with an existing string ref. Please convert it to use a callback ref instead, or wrap it into a <span> or <div>. Read more: https://reactjs.org/docs/refs-and-the-dom.html#callback-refs"),r?h.cloneElement(e,{ref:s=>{Tr(r,s),Tr(t,s)}}):h.cloneElement(e,{ref:t})}class Ja{receiveHandlerId(t){this.handlerId!==t&&(this.handlerId=t,this.reconnect())}get connectTarget(){return this.dragSource}get dragSourceOptions(){return this.dragSourceOptionsInternal}set dragSourceOptions(t){this.dragSourceOptionsInternal=t}get dragPreviewOptions(){return this.dragPreviewOptionsInternal}set dragPreviewOptions(t){this.dragPreviewOptionsInternal=t}reconnect(){const t=this.reconnectDragSource();this.reconnectDragPreview(t)}reconnectDragSource(){const t=this.dragSource,r=this.didHandlerIdChange()||this.didConnectedDragSourceChange()||this.didDragSourceOptionsChange();return r&&this.disconnectDragSource(),this.handlerId?t?(r&&(this.lastConnectedHandlerId=this.handlerId,this.lastConnectedDragSource=t,this.lastConnectedDragSourceOptions=this.dragSourceOptions,this.dragSourceUnsubscribe=this.backend.connectDragSource(this.handlerId,t,this.dragSourceOptions)),r):(this.lastConnectedDragSource=t,r):r}reconnectDragPreview(t=!1){const r=this.dragPreview,s=t||this.didHandlerIdChange()||this.didConnectedDragPreviewChange()||this.didDragPreviewOptionsChange();if(s&&this.disconnectDragPreview(),!!this.handlerId){if(!r){this.lastConnectedDragPreview=r;return}s&&(this.lastConnectedHandlerId=this.handlerId,this.lastConnectedDragPreview=r,this.lastConnectedDragPreviewOptions=this.dragPreviewOptions,this.dragPreviewUnsubscribe=this.backend.connectDragPreview(this.handlerId,r,this.dragPreviewOptions))}}didHandlerIdChange(){return this.lastConnectedHandlerId!==this.handlerId}didConnectedDragSourceChange(){return this.lastConnectedDragSource!==this.dragSource}didConnectedDragPreviewChange(){return this.lastConnectedDragPreview!==this.dragPreview}didDragSourceOptionsChange(){return!Wt(this.lastConnectedDragSourceOptions,this.dragSourceOptions)}didDragPreviewOptionsChange(){return!Wt(this.lastConnectedDragPreviewOptions,this.dragPreviewOptions)}disconnectDragSource(){this.dragSourceUnsubscribe&&(this.dragSourceUnsubscribe(),this.dragSourceUnsubscribe=void 0)}disconnectDragPreview(){this.dragPreviewUnsubscribe&&(this.dragPreviewUnsubscribe(),this.dragPreviewUnsubscribe=void 0,this.dragPreviewNode=null,this.dragPreviewRef=null)}get dragSource(){return this.dragSourceNode||this.dragSourceRef&&this.dragSourceRef.current}get dragPreview(){return this.dragPreviewNode||this.dragPreviewRef&&this.dragPreviewRef.current}clearDragSource(){this.dragSourceNode=null,this.dragSourceRef=null}clearDragPreview(){this.dragPreviewNode=null,this.dragPreviewRef=null}constructor(t){this.hooks=sn({dragSource:(r,s)=>{this.clearDragSource(),this.dragSourceOptions=s||null,qt(r)?this.dragSourceRef=r:this.dragSourceNode=r,this.reconnectDragSource()},dragPreview:(r,s)=>{this.clearDragPreview(),this.dragPreviewOptions=s||null,qt(r)?this.dragPreviewRef=r:this.dragPreviewNode=r,this.reconnectDragPreview()}}),this.handlerId=null,this.dragSourceRef=null,this.dragSourceOptionsInternal=null,this.dragPreviewRef=null,this.dragPreviewOptionsInternal=null,this.lastConnectedHandlerId=null,this.lastConnectedDragSource=null,this.lastConnectedDragSourceOptions=null,this.lastConnectedDragPreview=null,this.lastConnectedDragPreviewOptions=null,this.backend=t}}class ei{get connectTarget(){return this.dropTarget}reconnect(){const t=this.didHandlerIdChange()||this.didDropTargetChange()||this.didOptionsChange();t&&this.disconnectDropTarget();const r=this.dropTarget;if(this.handlerId){if(!r){this.lastConnectedDropTarget=r;return}t&&(this.lastConnectedHandlerId=this.handlerId,this.lastConnectedDropTarget=r,this.lastConnectedDropTargetOptions=this.dropTargetOptions,this.unsubscribeDropTarget=this.backend.connectDropTarget(this.handlerId,r,this.dropTargetOptions))}}receiveHandlerId(t){t!==this.handlerId&&(this.handlerId=t,this.reconnect())}get dropTargetOptions(){return this.dropTargetOptionsInternal}set dropTargetOptions(t){this.dropTargetOptionsInternal=t}didHandlerIdChange(){return this.lastConnectedHandlerId!==this.handlerId}didDropTargetChange(){return this.lastConnectedDropTarget!==this.dropTarget}didOptionsChange(){return!Wt(this.lastConnectedDropTargetOptions,this.dropTargetOptions)}disconnectDropTarget(){this.unsubscribeDropTarget&&(this.unsubscribeDropTarget(),this.unsubscribeDropTarget=void 0)}get dropTarget(){return this.dropTargetNode||this.dropTargetRef&&this.dropTargetRef.current}clearDropTarget(){this.dropTargetRef=null,this.dropTargetNode=null}constructor(t){this.hooks=sn({dropTarget:(r,s)=>{this.clearDropTarget(),this.dropTargetOptions=s,qt(r)?this.dropTargetRef=r:this.dropTargetNode=r,this.reconnect()}}),this.handlerId=null,this.dropTargetRef=null,this.dropTargetOptionsInternal=null,this.lastConnectedHandlerId=null,this.lastConnectedDropTarget=null,this.lastConnectedDropTargetOptions=null,this.backend=t}}function Xe(){const{dragDropManager:e}=h.useContext(qr);return W(e!=null,"Expected drag drop context"),e}function ti(e,t){const r=Xe(),s=h.useMemo(()=>new Ja(r.getBackend()),[r]);return Ve(()=>(s.dragSourceOptions=e||null,s.reconnect(),()=>s.disconnectDragSource()),[s,e]),Ve(()=>(s.dragPreviewOptions=t||null,s.reconnect(),()=>s.disconnectDragPreview()),[s,t]),s}function ri(){const e=Xe();return h.useMemo(()=>new Ka(e),[e])}class ni{beginDrag(){const t=this.spec,r=this.monitor;let s=null;return typeof t.item=="object"?s=t.item:typeof t.item=="function"?s=t.item(r):s={},s??null}canDrag(){const t=this.spec,r=this.monitor;return typeof t.canDrag=="boolean"?t.canDrag:typeof t.canDrag=="function"?t.canDrag(r):!0}isDragging(t,r){const s=this.spec,a=this.monitor,{isDragging:i}=s;return i?i(a):r===t.getSourceId()}endDrag(){const t=this.spec,r=this.monitor,s=this.connector,{end:a}=t;a&&a(r.getItem(),r),s.reconnect()}constructor(t,r,s){this.spec=t,this.monitor=r,this.connector=s}}function si(e,t,r){const s=h.useMemo(()=>new ni(e,t,r),[t,r]);return h.useEffect(()=>{s.spec=e},[e]),s}function ai(e){return h.useMemo(()=>{const t=e.type;return W(t!=null,"spec.type must be defined"),t},[e])}function ii(e,t,r){const s=Xe(),a=si(e,t,r),i=ai(e);Ve(function(){if(i!=null){const[l,c]=Za(i,a,s);return t.receiveHandlerId(l),r.receiveHandlerId(l),c}},[s,t,r,a,i])}function oi(e,t){const r=nn(e,t);W(!r.begin,"useDrag::spec.begin was deprecated in v14. Replace spec.begin() with spec.item(). (see more here - https://react-dnd.github.io/react-dnd/docs/api/use-drag)");const s=ri(),a=ti(r.options,r.previewOptions);return ii(r,s,a),[rn(r.collect,s,a),Ga(a),Ua(a)]}function li(e){return h.useMemo(()=>e.hooks.dropTarget(),[e])}function ci(e){const t=Xe(),r=h.useMemo(()=>new ei(t.getBackend()),[t]);return Ve(()=>(r.dropTargetOptions=e||null,r.reconnect(),()=>r.disconnectDropTarget()),[e]),r}function di(){const e=Xe();return h.useMemo(()=>new Wa(e),[e])}function ui(e){const{accept:t}=e;return h.useMemo(()=>(W(e.accept!=null,"accept must be defined"),Array.isArray(t)?t:[t]),[t])}class fi{canDrop(){const t=this.spec,r=this.monitor;return t.canDrop?t.canDrop(r.getItem(),r):!0}hover(){const t=this.spec,r=this.monitor;t.hover&&t.hover(r.getItem(),r)}drop(){const t=this.spec,r=this.monitor;if(t.drop)return t.drop(r.getItem(),r)}constructor(t,r){this.spec=t,this.monitor=r}}function pi(e,t){const r=h.useMemo(()=>new fi(e,t),[t]);return h.useEffect(()=>{r.spec=e},[e]),r}function gi(e,t,r){const s=Xe(),a=pi(e,t),i=ui(e);Ve(function(){const[l,c]=qa(i,a,s);return t.receiveHandlerId(l),r.receiveHandlerId(l),c},[s,t,a,r,i.map(o=>o.toString()).join("|")])}function or(e,t){const r=nn(e,t),s=di(),a=ci(r.options);return gi(r,s,a),[rn(r.collect,s,a),li(a)]}const wr="column",hi="flex items-center",mi="mr-3 cursor-move text-secondary",xi=({id:e,children:t,className:r,onFind:s,onMove:a,ariaLabel:i="Drag item"})=>{const o=h.useRef(null),l=h.useRef(null),c=typeof s=="function"?s(e):-1,[{isDragging:d},u,f]=oi(()=>({type:wr,item:{id:e,originalIndex:c},collect:p=>{const m=p.getItem();return{isDragging:p.isDragging()&&m?.id===e}},end:(p,m)=>{if(!p)return;!m.didDrop()&&typeof a=="function"&&p.originalIndex>-1&&a(p.id,p.originalIndex)}}),[e,c,a]),[,g]=or(()=>({accept:wr,hover:p=>{if(!(!p||p.id===e)&&typeof s=="function"&&typeof a=="function"){const m=s(e);a(p.id,m)}}}),[s,a,e]);return f(g(l)),u(o),n.jsxs("div",{ref:l,className:I.mergeClasses(hi,r),style:{opacity:d?0:1},"aria-roledescription":"Draggable item",children:[n.jsx("div",{ref:o,className:mi,"aria-label":i,children:n.jsx(H.IconGripVertical,{...V.BASE_ICON_PROPS})}),t]})},It=({iconClassName:e,label:t,...r})=>t?n.jsx(x.DialDangerButton,{...r,label:t,appearance:T.ButtonAppearance.Ghost,iconBefore:n.jsx(H.IconTrashX,{...V.BASE_ICON_PROPS,className:e||""})}):n.jsx(F.DialDangerIconButton,{...r,appearance:T.ButtonAppearance.Ghost,icon:n.jsx(H.IconTrashX,{...V.BASE_ICON_PROPS,className:e||""})}),bi=({className:e="",value:t,onChange:r,error:s,containerClassName:a,resize:i=!1,labelProps:o,caption:l,id:c,...d})=>{const u=I.mergeClasses("dial-textarea dial-input px-3 py-2",d.invalid&&"dial-input-error",d.disabled&&"dial-input-disable",i?"resize":"resize-none",e);return n.jsxs("div",{className:I.mergeClasses("flex flex-col gap-y-1",a),children:[o&&n.jsx(Ae.DialLabel,{...o,htmlFor:c}),n.jsx("textarea",{id:c,value:t||"",className:u,onChange:f=>r?.(f.currentTarget.value),...d}),n.jsx(x.DialErrorText,{text:s}),!s&&n.jsx(x.DialCaptionText,{text:l})]})},vi="inline-flex items-center rounded bg-layer-3",yi="flex flex-1 items-center justify-center gap-2 h-7 px-3 py-1 border border-primary dial-small-text whitespace-nowrap focus-visible:outline outline-offset-0 focus-visible:relative focus-visible:z-10",Di="relative z-10 bg-controls-accent-primary-alpha-active text-primary",Ci="text-secondary hover:text-primary",Ni="text-controls-disable-accent cursor-not-allowed hover:text-controls-disable-accent",Ii=({options:e,value:t,onChange:r,disabled:s,className:a,ariaLabel:i})=>{const o=h.useCallback(l=>{if(s)return;const c=e.filter(g=>!g.disabled);if(c.length===0)return;const d=c.findIndex(g=>g.value===t);let u=null;switch(l.key){case"ArrowRight":case"ArrowDown":u=(d+1)%c.length;break;case"ArrowLeft":case"ArrowUp":u=(d-1+c.length)%c.length;break;case"Home":u=0;break;case"End":u=c.length-1;break;default:return}l.preventDefault();const f=c[u];f&&f.value!==t&&r(f.value)},[s,e,t,r]);return n.jsx("div",{role:"tablist","aria-label":i,className:I.mergeClasses(vi,a),children:e.map((l,c)=>{const d=l.value===t,u=c===0,f=c===e.length-1,g=s||l.disabled;return n.jsxs("button",{type:"button",role:"tab","aria-selected":d,tabIndex:d?0:-1,disabled:g,onClick:()=>r(l.value),onKeyDown:o,className:I.mergeClasses(yi,!f&&"-mr-px",u&&"rounded-l",f&&"rounded-r",d?Di:Ci,g&&Ni),children:[l.icon,l.label]},l.value)})})},Mt=8,Si=24,an=({initialTags:e=[],label:t,required:r,elementId:s,placeholder:a,captionDescription:i,errorText:o,invalid:l,disabled:c,collapseTagOverflow:d=!1,readOnly:u=!1,containerClassName:f,tagClassName:g,onChange:p})=>{const m=h.useRef(null),y=h.useRef([]),b=h.useRef(null),[v,C]=h.useState(e),[N,S]=h.useState(""),[D,w]=h.useState(!1),[R,_]=h.useState(e.length),O=h.useCallback(k=>z=>{y.current[k]=z},[]),A=h.useCallback(()=>{if(!d)return;const k=m.current;if(!k)return;const z=k.offsetWidth;if(z===0)return;const q=b.current?.offsetWidth??0,ie=z-(u?0:Si)-Mt;let ne=0,K=0;for(let re=0;re<v.length;re++){const de=y.current[re];if(!de)continue;const ue=de.offsetWidth+Mt;if(ne+ue>ie)break;ne+=ue,K++}if(K<v.length&&K>0)for(;ne+q>ie&&K>0;){K--;const re=y.current[K]?.offsetWidth??0;ne-=re+Mt}_(K)},[d,u,v.length]),j=k=>{const z=k.trim().replace(/,$/,"");if(z&&!v.includes(z)){const q=[z,...v];C(q),p?.(q)}},P=k=>{(k.key===","||k.key==="Enter")&&(k.preventDefault(),j(N),S(""))},B=()=>{N.trim()&&(j(N),S(""))},G=k=>{const z=v.filter((q,X)=>X!==k);C(z),p?.(z)},ee=()=>o?n.jsx(x.DialErrorText,{text:o}):i?n.jsx(x.DialCaptionText,{text:i}):null;h.useEffect(()=>{if(d)return;const k=new ResizeObserver(()=>{if(m.current){const z=m.current.scrollHeight>m.current.clientHeight+10;w(z)}});return m.current&&k.observe(m.current),()=>k.disconnect()},[v,d]),h.useEffect(()=>{if(!d){_(v.length);return}_(v.length);const k=new ResizeObserver(()=>{A()}),z=m.current;return z&&k.observe(z),A(),()=>k.disconnect()},[d,A,v]),h.useEffect(()=>{C(e)},[JSON.stringify(e)]);const $=n.jsxs("div",{ref:m,className:se("flex gap-2 items-center relative",d?"flex-nowrap overflow-hidden w-full min-w-0":se("flex-wrap",D?"flex-col-reverse":"flex-row"),f),children:[(d?v.slice(0,R):v).map((k,z)=>n.jsx(He,{label:k,className:g,closable:!c&&!u,onRemove:!c&&!u?()=>G(z):void 0},k+z)),d&&R<v.length&&n.jsx(T.DialTooltip,{tooltip:v.slice(R).join(", "),triggerClassName:"inline-flex shrink-0 cursor-pointer",children:n.jsx(He,{label:`+${v.length-R}`})}),!u&&n.jsx("input",{id:s,type:"text",value:N,onChange:k=>S(k.target.value),onKeyDown:P,onBlur:B,className:se("dial-input outline-none !border-none w-full flex-1 !p-1 !h-auto",d?"min-w-0":"min-w-[100px]"),placeholder:a??"",disabled:c}),d&&n.jsxs("div",{className:"absolute left-0 top-0 invisible pointer-events-none h-0 overflow-hidden whitespace-nowrap","aria-hidden":!0,children:[v.map((k,z)=>n.jsx("div",{ref:O(z),className:"inline-flex shrink-0",children:n.jsx(He,{label:k,className:g,closable:!c&&!u,onRemove:!c&&!u?()=>G(z):void 0})},`measure-${k}-${z}`)),n.jsx("div",{ref:b,className:"inline-flex shrink-0",children:n.jsx(He,{label:`+${v.length}`})})]})]});return u?$:n.jsxs("div",{className:"flex flex-col gap-2 w-full",children:[n.jsx(Ae.DialLabel,{label:t,required:r,htmlFor:s}),n.jsx("div",{className:se("dial-input min-h-[38px] p-[6px]",l&&"dial-input-error",c&&"dial-input-disable"),children:$}),ee()]})},on=({selectedItems:e,placeholder:t,collapseTagOverflow:r=!1,listClassName:s,listElementClassName:a})=>e?.length?n.jsx(an,{readOnly:!0,initialTags:e,collapseTagOverflow:r,containerClassName:s,tagClassName:a}):t?n.jsx("span",{className:"text-secondary",children:t}):null,Ft=e=>gr.createElement("svg",{width:18,height:18,viewBox:"0 0 18 18",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},gr.createElement("path",{d:"M2.25 13.5V12C2.25 11.5858 2.58579 11.25 3 11.25C3.41421 11.25 3.75 11.5858 3.75 12V13.5C3.75 13.6989 3.82907 13.8896 3.96973 14.0303C4.11038 14.1709 4.30109 14.25 4.5 14.25H6C6.41421 14.25 6.75 14.5858 6.75 15C6.75 15.4142 6.41421 15.75 6 15.75H4.5C3.90326 15.75 3.33114 15.5128 2.90918 15.0908C2.48722 14.6689 2.25 14.0967 2.25 13.5ZM14.25 6V4.5C14.25 4.30109 14.1709 4.11038 14.0303 3.96973C13.8896 3.82907 13.6989 3.75 13.5 3.75H12C11.5858 3.75 11.25 3.41421 11.25 3C11.25 2.58579 11.5858 2.25 12 2.25H13.5C14.0967 2.25 14.6689 2.48722 15.0908 2.90918C15.5128 3.33114 15.75 3.90326 15.75 4.5V6C15.75 6.41421 15.4142 6.75 15 6.75C14.5858 6.75 14.25 6.41421 14.25 6Z",fill:"currentColor"})),ln=({children:e,open:t,disabled:r=!1,selectedValue:s,valueClassName:a,inputClassName:i,onOpen:o,elementId:l,errorText:c,invalid:d,emptyValueText:u,placeholder:f,editable:g=!1,onValueChange:p,collapseTagOverflow:m=!1,iconBefore:y})=>{const b=Array.isArray(s)&&s.length>0,v=typeof s=="string"&&!!s.trim(),C=b||v?s:f?void 0:u,N=r?void 0:o,S=h.useCallback(_=>{p?.(_.target.value)},[p]),D=()=>n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:se("dial-input px-3 py-2 dial-input-field flex flex-row items-center gap-x-2 w-full justify-between",i,r&&"dial-input-disable",(c||d)&&"dial-input-error"),children:[n.jsxs("div",{className:"flex flex-row items-center gap-x-2 flex-1 min-w-0",children:[y&&n.jsx(F.DialIcon,{icon:y}),n.jsx("input",{type:"text",className:se("flex-1 min-w-0 bg-transparent outline-none border-none p-0 dial-small-text text-primary placeholder:text-secondary",a),value:typeof s=="string"?s:"",placeholder:f||u,onChange:S,disabled:r,id:l,"aria-label":"input-popup-field"})]}),!r&&n.jsx("button",{type:"button",className:"shrink-0 cursor-pointer bg-transparent border-none p-0 ml-1",onClick:o,"aria-label":"open-popup",children:n.jsx(F.DialIcon,{icon:n.jsx(Ft,{role:"img",width:V.BASE_ICON_SIZE,height:V.BASE_ICON_SIZE})})})]}),n.jsx(x.DialErrorText,{text:c})]}),w=()=>n.jsxs(n.Fragment,{children:[n.jsx("button",{type:"button",className:"w-full",onClick:N,"aria-label":"open-popup",id:l,children:n.jsxs("div",{className:se("dial-input px-3 py-2 dial-input-field flex flex-row items-center gap-x-2 w-full justify-between cursor-pointer",i,r&&"dial-input-disable",(c||d)&&"dial-input-error"),children:[n.jsxs("div",{className:"flex flex-row items-center gap-x-2 flex-1 min-w-0",children:[y&&n.jsx(F.DialIcon,{icon:y}),n.jsx(T.DialTooltip,{tooltip:C==null?void 0:String(C),children:C||!f?n.jsx("span",{className:a,children:C}):n.jsx("span",{className:"text-secondary",children:f})})]}),!r&&n.jsx("div",{className:"shrink-0",children:n.jsx(F.DialIcon,{icon:n.jsx(Ft,{role:"img",width:V.BASE_ICON_SIZE,height:V.BASE_ICON_SIZE})})})]})}),n.jsx(x.DialErrorText,{text:c})]}),R=()=>n.jsx("div",{className:"w-full",onClick:N,children:n.jsxs("div",{className:se("dial-input px-3 py-2 flex flex-row items-center gap-x-2 w-full justify-between cursor-pointer",r&&"dial-input-disable"),children:[n.jsxs("div",{className:"flex flex-row items-center gap-x-2 flex-1 min-w-0",children:[y&&n.jsx(F.DialIcon,{icon:y}),n.jsx(on,{placeholder:f,selectedItems:C,collapseTagOverflow:m})]}),!r&&n.jsx("div",{className:"ml-1",children:n.jsx(F.DialIcon,{icon:n.jsx(Ft,{role:"img",width:V.BASE_ICON_SIZE,height:V.BASE_ICON_SIZE})})})]})});return n.jsxs(n.Fragment,{children:[b?R():g?D():w(),t&&Kn.createPortal(e,document.body)]})},ji=({label:e,htmlFor:t,disabled:r,selectedValue:s,radioButtons:a,customInputValue:i,valueClassName:o,inputClassName:l,emptyValueText:c,placeholder:d,onClose:u,header:f,portalId:g,onApply:p,onCancel:m,cancelButtonTitle:y="Cancel",applyButtonTitle:b="Apply",isValid:v,selectedRadioValue:C,onChangeRadioField:N,id:S,size:D=x.PopupSize.Md})=>{const[w,R]=h.useState(!1),_=h.useCallback(()=>{r||R(!0)},[r]),O=h.useCallback(()=>{R(!1),u?.()},[u]),A=h.useCallback(()=>{m?.(),O()},[m,O]),j=h.useCallback(()=>{p(),O()},[p,O]);return n.jsxs("div",{className:"flex flex-col gap-1",children:[n.jsx(Ae.DialLabel,{label:e,htmlFor:t}),n.jsx(ln,{disabled:r,open:w,selectedValue:i??a.find(P=>P.id===s)?.name,valueClassName:o,inputClassName:se(l,"py-2","px-3"),emptyValueText:c,placeholder:d,onOpen:_,children:n.jsx(x.DialPopup,{open:w,onClose:A,header:f,portalId:g,size:D,footer:n.jsxs("div",{className:"flex flex-row items-center justify-end gap-2 px-6 py-4",children:[n.jsx(x.DialNeutralButton,{label:y,onClick:A}),n.jsx(x.DialPrimaryButton,{label:b,onClick:j,disabled:!v})]}),children:n.jsx("div",{className:"px-6 py-4",children:n.jsx(x.DialRadioGroup,{radioButtons:a,labelClassName:"dial-small-text",activeRadioButton:C,onChange:N,elementId:S,orientation:x.RadioGroupOrientation.Column})})})})]})},Ti="Create",wi="Cancel",Ei="flex items-center justify-end gap-2 px-6 py-3",Oi=({header:e,open:t=!1,submitLabel:r=Ti,cancelLabel:s=wi,isLoading:a=!1,disableSubmitButton:i=!1,className:o,submitClassName:l,onClose:c,onSubmit:d,onCancel:u,children:f,dividers:g=!0,size:p=x.PopupSize.Md,footer:m})=>{const y=a?null:n.jsxs("div",{className:Ei,children:[n.jsx(x.DialNeutralButton,{label:s,onClick:()=>u?u():c?.()}),n.jsx(x.DialPrimaryButton,{className:l,label:r,disabled:i,onClick:()=>d()})]}),b=h.useCallback(()=>a?n.jsx("div",{className:"px-6 py-4 h-[120px]",children:n.jsx(x.DialLoader,{size:50})}):f??null,[f,a]);return n.jsx(x.DialPopup,{open:t,header:e,className:o,dividers:g,onClose:()=>c?.(),footer:m??y,size:p,children:b()})},Ai=/^0+\.(\d+)?$/,_i=/^0+/,Zt=({integer:e,onChange:t,min:r,max:s,onKeyDown:a,onPaste:i,...o})=>{const l=u=>!u||u==="-"?u:String(u)?.match(Ai)?String(u)?.replace(_i,"0"):Number(u),c=u=>{if([".","-","+","e","E"].includes(u.key)){u.preventDefault();return}x.handleKeyDown(u,"number",r,s)},d=u=>{const f=u.clipboardData.getData("text"),g=f.replace(/\D/g,"");if(g!==f&&(u.preventDefault(),g)){const p=u.currentTarget,m=p.selectionStart??0,y=p.selectionEnd??0,b=p.value.slice(0,m)+g+p.value.slice(y);t?.(l(b))}};return n.jsx(x.DialInput,{type:"number",min:r,max:s,onChange:u=>t?.(l(u)),onKeyDown:e?c:a,onPaste:e?d:i,...o})},Ri=({onClick:e})=>n.jsx(H.IconEyeOff,{...V.BASE_ICON_PROPS,className:"text-primary",onClick:e,role:"button","aria-label":"hide"}),ki=({onClick:e})=>n.jsx(H.IconEye,{...V.BASE_ICON_PROPS,className:"text-primary",onClick:e,role:"button","aria-label":"show"}),cn=({...e})=>{const[t,r]=h.useState(!1),s=h.useCallback(a=>{r(a)},[]);return n.jsx(x.DialInput,{type:t?"text":"password",...e,iconAfter:e.disabled?null:t?n.jsx(Ri,{onClick:()=>s(!1)}):n.jsx(ki,{onClick:()=>s(!0)})})},dn=({options:e,selectedValues:t,handleRemoveTag:r})=>n.jsx("div",{className:"flex flex-wrap w-full items-center gap-1",children:t.map(s=>{const a=e.find(o=>o.value===s)?.label??s,i=e.find(o=>o.value===s)?.icon;return n.jsx(He,{label:a,onRemove:o=>r?.(o,s),icon:i?n.jsx(F.DialIcon,{icon:i}):null,className:"max-w-full"},s)})});var ht=(e=>(e.Sm="sm",e.Md="md",e))(ht||{}),mt=(e=>(e.Primary="Primary",e.Secondary="Secondary",e))(mt||{});const Pi="dial-input flex w-full items-center justify-between gap-2 dial-small-text cursor-pointer",Li="w-full rounded flex flex-col",nt="flex w-full items-center justify-between gap-2 px-3 h-[34px] dial-small-text text-primary truncate hover:bg-accent-primary-alpha focus:bg-accent-primary-alpha focus:outline-none",Mi="bg-accent-primary-alpha",Yt="bg-accent-primary-alpha border-l border-accent-primary border-1",xt="opacity-75",Fi=352,Bi=4,zi=n.jsx(H.IconChevronDown,{size:V.DIAL_ICON_SIZE.SM}),$i=({opt:e,selectedValues:t,onSelect:r})=>{const{isOpen:s,refs:a,floatingStyles:i,context:o,getReferenceProps:l,getFloatingProps:c}=F.useSubMenuFloating(Bi,"listbox",!!e.disabled),d=e.children?.some(u=>t.includes(u.value));return n.jsxs(n.Fragment,{children:[n.jsxs("button",{ref:a.setReference,type:"button",role:"option","aria-haspopup":"listbox","aria-expanded":s,"aria-selected":!!d,"aria-disabled":!!e.disabled,disabled:e.disabled,className:se(nt,d&&Yt,e.disabled&&xt),...l(),children:[n.jsxs("div",{className:"flex items-center gap-2 w-full min-w-0",children:[e.icon&&n.jsx(F.DialIcon,{icon:e.icon}),n.jsx(F.DialEllipsisTooltip,{text:e.labelNode??e.label})]}),n.jsx(H.IconChevronRight,{size:14,className:"shrink-0"})]}),s&&n.jsx(F.SubMenuPanel,{refs:a,floatingStyles:i,context:o,getFloatingProps:c,role:"listbox",className:"w-max py-1",children:e.children.map(u=>{const f=t.includes(u.value);return n.jsx("button",{type:"button",role:"option","aria-selected":f,"aria-disabled":!!u.disabled,disabled:u.disabled,className:se(nt,f&&Yt,u.disabled&&xt),onClick:()=>!u.disabled&&r(u.value),children:n.jsxs("div",{className:"flex items-center gap-2 w-full",children:[u.icon&&n.jsx(F.DialIcon,{icon:u.icon}),n.jsx(F.DialEllipsisTooltip,{text:u.labelNode??u.label})]})},u.value)})})]})},ke=({options:e,multiple:t=!1,elementId:r,value:s,defaultValue:a,variant:i=mt.Primary,size:o=ht.Md,prefix:l,customSelectedValue:c,placeholder:d="Select...",searchable:u=!1,searchSize:f=T.ElementSize.Standard,searchPlaceholder:g,selectAll:p=!1,invalid:m,selectAllLabel:y="Select all",emptyStateTitle:b="No options available",emptyStateDescription:v,emptyStateIcon:C,disabled:N=!1,className:S,listClassName:D,closable:w=!1,header:R,footer:_,onClose:O,onChange:A,inlineSearch:j=!1,dismissRef:P,onFooterClick:B,open:G,onOpenChange:ee,onInlineQueryChange:$,customMultiSelectTagsRenderer:k})=>{const z=h.useId(),[q,X]=h.useState(!1),ie=G!==void 0,ne=ie?!!G:q,K=h.useCallback(E=>{ie||X(E),ee?.(E)},[ie,ee]),[re,de]=h.useState(j&&c||""),ue=h.useRef(null),ce=h.useCallback(E=>{E!==re&&(de(E||""),$?.(E||""))},[$,re]),pe=s!==void 0,[ge,fe]=h.useState(a),U=pe?s:ge,Y=h.useMemo(()=>t?Array.isArray(U)?U:[]:typeof U=="string"?[U]:[],[U,t]),Ne=h.useMemo(()=>{const E=re.trim().toLowerCase();return E?e.filter(Q=>Q.label.toLowerCase().includes(E)):e},[e,re]);h.useEffect(()=>{!ne&&!j&&ce("")},[j,ne,ce]);const Me=h.useRef(c);h.useEffect(()=>{j&&c!==Me.current&&(ne||(Me.current=c,ce(c||"")))},[c,j,ne,ce]);const he=h.useCallback(E=>{pe||fe(E),A?.(E)},[pe,A]),Fe=h.useCallback(E=>{if(t){const Q=new Set(Y);Q.has(E)?Q.delete(E):Q.add(E),he(Array.from(Q));return}if(he(E),j){const Q=e.find(xe=>xe.value===E)??e.flatMap(xe=>xe.children??[]).find(xe=>xe.value===E);Q&&ce(Q.label)}K(!1)},[t,he,j,K,Y,e,ce]),je=h.useCallback((E,Q)=>{if(E.stopPropagation(),!t){he("");return}const xe=Y.filter(Et=>Et!==Q);he(xe)},[t,Y,he]),te=h.useMemo(()=>Ne.filter(E=>!E.disabled),[Ne]),_e=h.useMemo(()=>te.filter(E=>Y.includes(E.value)).length,[te,Y]),Ie=h.useCallback(E=>{j&&!t&&!E&&Fe(re),K(E)},[Fe,j,t,re,K]),{allSelectedInFiltered:Be,someSelectedInFiltered:tt}=h.useMemo(()=>{const E=te.length>0&&_e===te.length;return{allSelectedInFiltered:E,someSelectedInFiltered:_e>0&&!E}},[te,_e]),ye=h.useCallback(()=>{if(!(!t||te.length===0))if(Be){const E=new Set(te.map(Q=>Q.value));he(Y.filter(Q=>!E.has(Q)))}else{const E=new Set(Y);te.forEach(Q=>E.add(Q.value)),he(Array.from(E))}},[Be,t,te,Y,he]),ze=Y.length>0;h.useEffect(()=>{ne&&j&&!t&&!N&&requestAnimationFrame(()=>{const E=ue.current;if(!E)return;E.focus();const Q=E.value?.length??0;E.setSelectionRange?.(Q,Q)})},[ne,j,t,N]);const Re=!t&&ze?Y[0]:void 0,me=h.useMemo(()=>Re?e.find(E=>E.value===Re)??e.flatMap(E=>E.children??[]).find(E=>E.value===Re):void 0,[e,Re]),wt=h.useCallback(()=>t?ze?k?.(e,Y,je)||n.jsx(dn,{options:e,selectedValues:Y,handleRemoveTag:je}):n.jsx("span",{className:"text-secondary truncate",children:d}):me?n.jsxs(n.Fragment,{children:[me.icon&&n.jsx(F.DialIcon,{icon:me.icon}),n.jsx(F.DialEllipsisTooltip,{text:me.labelNode??(l?`${l} ${me.label}`:me.label)}),me?.description&&n.jsx("div",{className:"text-secondary dial-small-text",children:me.description})]}):c&&s?c:n.jsx("span",{className:"text-secondary truncate",children:d}),[ze,t,c,l,s,d,me,e,Y,je,k]);h.useImperativeHandle(P,()=>({dismiss:()=>{K(!1)}}));const Te=h.useCallback(()=>{ce(Y.length===1?me?.label??re:"")},[re,Y.length,ce,me?.label]),$e=h.useCallback(()=>{N||(K(!ne),j&&!t&&(Te(),ue.current?.focus()))},[N,j,ne,t,Te,K]);return n.jsx(F.DialDropdown,{open:ne,onOpenChange:Ie,disabled:N,closable:w,onClose:O,placement:"bottom-start",allowedPlacements:["bottom-start","top-start"],maxDropdownHeight:u?null:Fi,listClassName:D,renderOverlay:()=>n.jsxs("div",{id:`list-${r||z}`,role:"listbox","aria-multiselectable":t||void 0,className:Li,children:[R&&n.jsx(n.Fragment,{children:typeof R=="function"?R():R}),(u||w)&&e.length>8&&n.jsxs("div",{className:"flex items-center gap-2 px-2 pt-2",children:[u&&n.jsx(x.DialSearch,{size:f,placeholder:g,onChange:ce,value:re,id:`search-${r||z}`,containerClassName:I.mergeClasses(x.SIZE_CONFIG[f].containerClassName,"w-full")}),w&&n.jsx(x.DialButton,{"aria-label":"Close select",className:"shrink-0",iconBefore:n.jsx(H.IconX,{size:V.DIAL_ICON_SIZE.SM}),onClick:E=>{O?.(E),K(!1)}})]}),t&&p&&te.length>0&&n.jsx("div",{className:se(nt,"mt-2"),children:n.jsx(Gt,{id:`${r||z}-selectAll`,label:y,checked:Be,indeterminate:tt,onChange:ye,ariaLabel:y})}),n.jsx("div",{className:se("overflow-y-auto max-h-[352px]",j&&Ne.length===0?"":"py-1"),children:Ne.length===0?!j&&n.jsx("div",{className:"px-2 py-3",children:n.jsx(F.DialNoDataContent,{icon:C??n.jsx(H.IconClipboardX,{size:V.DIAL_ICON_SIZE.LG,stroke:.5}),title:b,description:v})}):Ne.map(E=>{const Q=Y.includes(E.value);return t?n.jsxs("div",{role:"option","aria-selected":Q,"aria-disabled":!!E.disabled,className:se(nt,Q&&Mi,E.disabled&&xt,"w-full"),children:[n.jsx(Gt,{id:`${r||z}-${E.value}`,label:n.jsxs("span",{className:"flex w-full flex-1 pl-2 min-w-0 items-center gap-2 text-primary",children:[E.icon&&n.jsx(F.DialIcon,{icon:E.icon}),n.jsx("span",{className:"truncate",children:E.labelNode??E.label})]}),checked:Q,disabled:E.disabled,onChange:()=>!E.disabled&&Fe(E.value),ariaLabel:E.label}),E.description&&n.jsx("div",{className:"text-secondary dial-small-text",children:E.description})]},E.value):E.children?.length?n.jsx($i,{opt:E,selectedValues:Y,onSelect:Fe},E.value):n.jsx("button",{role:"option",type:"button","aria-selected":Q,"aria-disabled":!!E.disabled,disabled:E.disabled,className:se(nt,Q&&Yt,E.disabled&&xt),onClick:()=>!E.disabled&&Fe(E.value),children:n.jsxs("div",{className:"flex items-center gap-2 w-full",children:[E.icon&&n.jsx(F.DialIcon,{icon:E.icon}),n.jsx(F.DialEllipsisTooltip,{text:E.labelNode??E.label}),E.description&&n.jsx("div",{className:"text-secondary dial-small-text",children:E.description})]})},E.value)})}),_&&n.jsx("div",{onClick:E=>{B?.(E),B&&K(!1)},children:typeof _=="function"?_():_})]}),children:n.jsxs("div",{role:"button",tabIndex:0,"aria-roledescription":"button to open select list","aria-haspopup":"listbox","aria-expanded":ne,"aria-controls":`list-${r||z}`,className:I.mergeClasses(Pi,N&&"opacity-75 !cursor-not-allowed !border-primary",o===ht.Sm?"min-h-[25px] px-1.5 py-1":"min-h-[38px] px-3 py-2",m&&"dial-input-error",i===mt.Secondary?"!bg-layer-4 !h-auto":"",S),onMouseDown:E=>{N||j&&!t&&(Te(),E.preventDefault())},onClick:()=>{$e()},onKeyDown:E=>{(E.key===" "||E.code==="Space")&&(E.preventDefault(),$e())},children:[j&&!t?n.jsx("div",{className:"flex min-w-0 items-center gap-2 text-primary flex-1",children:n.jsx("input",{id:`inline-${r||z}`,type:"text",placeholder:g??d,value:re||"",onChange:E=>ce(E.currentTarget.value.trimStart()),onFocus:()=>!N&&K(!0),onMouseDown:E=>{Te(),E.stopPropagation()},onClick:E=>{E.stopPropagation()},onKeyDown:E=>{E.stopPropagation()},className:"bg-transparent outline-none w-full dial-small-text",ref:ue,disabled:N,"aria-disabled":N,autoComplete:"off"})}):n.jsx("div",{className:"flex w-full min-w-0 items-center gap-2 text-primary",children:wt()}),!j&&n.jsx(F.DialIcon,{icon:zi,className:se("text-primary",ne&&"rotate-180")})]})})},Hi=({label:e,required:t,captionDescription:r,containerClassName:s,selectClassName:a,error:i,id:o,caption:l,readonly:c,value:d,defaultEmptyText:u,...f})=>{const g=h.useCallback(()=>{if(!d||Array.isArray(d)&&d.length===0)return u??"None";if(Array.isArray(d))return n.jsx(dn,{options:f.options,selectedValues:d});{const p=f.options?.find(m=>m.value===d);return n.jsx("span",{"aria-readonly":!0,className:"text-primary",children:p?.label||d})}},[d,f.options,u]);return n.jsx(x.DialFormItem,{id:o,label:e,required:t,description:l,error:i,captionDescription:r,className:s,readonly:c,value:g(),defaultEmptyText:u,children:n.jsx(ke,{className:a,value:d,elementId:o,invalid:!!i,...f})})};function un(e){let t=null;return()=>(t==null&&(t=e()),t)}function Vi(e,t){return e.filter(r=>r!==t)}function Gi(e,t){const r=new Set,s=i=>r.add(i);e.forEach(s),t.forEach(s);const a=[];return r.forEach(i=>a.push(i)),a}class Ui{enter(t){const r=this.entered.length,s=a=>this.isNodeInDocument(a)&&(!a.contains||a.contains(t));return this.entered=Gi(this.entered.filter(s),[t]),r===0&&this.entered.length>0}leave(t){const r=this.entered.length;return this.entered=Vi(this.entered.filter(this.isNodeInDocument),t),r>0&&this.entered.length===0}reset(){this.entered=[]}constructor(t){this.entered=[],this.isNodeInDocument=t}}class Ki{initializeExposedProperties(){Object.keys(this.config.exposeProperties).forEach(t=>{Object.defineProperty(this.item,t,{configurable:!0,enumerable:!0,get(){return console.warn(`Browser doesn't allow reading "${t}" until the drop event.`),null}})})}loadDataTransfer(t){if(t){const r={};Object.keys(this.config.exposeProperties).forEach(s=>{const a=this.config.exposeProperties[s];a!=null&&(r[s]={value:a(t,this.config.matchesTypes),configurable:!0,enumerable:!0})}),Object.defineProperties(this.item,r)}}canDrag(){return!0}beginDrag(){return this.item}isDragging(t,r){return r===t.getSourceId()}endDrag(){}constructor(t){this.config=t,this.item={},this.initializeExposedProperties()}}const St="__NATIVE_FILE__",fn="__NATIVE_URL__",pn="__NATIVE_TEXT__",gn="__NATIVE_HTML__",Er=Object.freeze(Object.defineProperty({__proto__:null,FILE:St,HTML:gn,TEXT:pn,URL:fn},Symbol.toStringTag,{value:"Module"}));function Bt(e,t,r){const s=t.reduce((a,i)=>a||e.getData(i),"");return s??r}const Xt={[St]:{exposeProperties:{files:e=>Array.prototype.slice.call(e.files),items:e=>e.items,dataTransfer:e=>e},matchesTypes:["Files"]},[gn]:{exposeProperties:{html:(e,t)=>Bt(e,t,""),dataTransfer:e=>e},matchesTypes:["Html","text/html"]},[fn]:{exposeProperties:{urls:(e,t)=>Bt(e,t,"").split(`
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const x=require("./use-file-manager-tabs-DjdR_mYM.cjs"),Ae=require("./Switch-CUKClcEz.cjs"),n=require("react/jsx-runtime"),h=require("react"),H=require("@tabler/icons-react"),se=require("classnames"),F=require("./DateCellRenderer-BVM-Q8yx.cjs"),V=require("./icon-CrGVkVpG.cjs"),I=require("./merge-classes-Dipy1Ih1.cjs"),L=require("./DateCellRenderer-D437_mi0.cjs"),T=require("./IconButton-DWqoaBWf.cjs"),Kn=require("react-dom"),ot=require("./lazy-B1eG0EeX.cjs"),le=require("@floating-ui/react"),ae=require("./icon-DhjrDQ8I.cjs");function Wn(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const r in e)if(r!=="default"){const s=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,s.get?s:{enumerable:!0,get:()=>e[r]})}}return t.default=e,Object.freeze(t)}const gr=Wn(h),He=({label:e,className:t,icon:r,selected:s,closable:a,onClick:i,onRemove:o})=>{const l=I.mergeClasses("flex items-center gap-1 cursor-pointer dial-tiny-text px-2 h-[24px] border text-primary rounded-[8px]",s?"hover:bg-controls-accent-primary-alpha-active bg-accent-primary-alpha border-accent-primary":"bg-neutral border-primary",t);return n.jsxs("div",{className:l,onClick:i,children:[n.jsx(F.DialIcon,{icon:r}),n.jsx(F.DialEllipsisTooltip,{text:e}),a&&o&&n.jsx(x.DialButton,{className:"p-0",iconAfter:n.jsx(H.IconX,{size:V.DIAL_ICON_SIZE.SM}),onClick:c=>o(c)})]},e)},Jt=({label:e="Error",className:t})=>n.jsx(He,{label:e,className:I.mergeClasses("dial-tiny-semi-text cursor-default rounded-[120px] border-transparent bg-error text-error",t)});var st=(e=>(e.Default="default",e.Compact="compact",e))(st||{});const qn={[st.Default]:{container:"bg-layer-3",title:"dial-small-text text-secondary",value:"dial-display2-text text-primary",showDescription:!0},[st.Compact]:{container:"bg-layer-2",title:"dial-tiny-text text-secondary",value:"dial-body-semi-text text-primary",showDescription:!1}},Zn=({title:e,value:t,description:r,variant:s=st.Default,error:a,isLoading:i,className:o,delta:l,deltaPositive:c,deltaUnit:d,compareValues:u})=>{const f=qn[s],g=c!==void 0?c:(l??0)>=0,p=l===void 0?null:`${l>=0?`+${l}`:String(l)}${d??""}`;return n.jsxs("div",{className:I.mergeClasses("flex flex-col rounded-lg border border-secondary p-4",a||i?"gap-2":"gap-1",f.container,o),children:[l!==void 0?n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("span",{className:f.title,children:e}),n.jsx("span",{className:I.mergeClasses("dial-tiny-semi-text rounded-[120px] border border-transparent px-2",g?"bg-success text-success":"bg-error text-error"),children:p})]}):n.jsx("span",{className:f.title,children:e}),a?n.jsx(Jt,{className:"self-start"}):i?n.jsx(x.DialLoader,{fullWidth:!1,className:"self-start"}):u?n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsxs("div",{className:"flex min-w-0 flex-1 flex-col gap-0.5",children:[n.jsx(F.DialEllipsisTooltip,{text:u[0].title,className:"dial-tiny-text text-secondary"}),n.jsx("span",{className:f.value,children:u[0].value})]}),n.jsx("div",{className:"h-4 w-px flex-shrink-0 bg-controls-disable-accent"}),n.jsxs("div",{className:"flex min-w-0 flex-1 flex-col gap-0.5",children:[n.jsx(F.DialEllipsisTooltip,{text:u[1].title,className:"dial-tiny-text text-secondary"}),n.jsx("span",{className:f.value,children:u[1].value})]})]}):n.jsx("span",{className:f.value,children:t}),!a&&!i&&f.showDescription&&r!=null&&r!==!1&&n.jsx("span",{className:"dial-tiny-text text-secondary",children:r})]})},er=[{from:0,to:.1,color:"#F26B5B"},{from:.1,to:.2,color:"#E5764A"},{from:.2,to:.3,color:"#E08C3F"},{from:.3,to:.4,color:"#D9A638"},{from:.4,to:.5,color:"#D4BE3A"},{from:.5,to:.6,color:"#B8C94A"},{from:.6,to:.7,color:"#7EC96B"},{from:.7,to:.8,color:"#4ECBA8"},{from:.8,to:.9,color:"#4EC5C5"},{from:.9,to:1,color:"#4DC87A"},{from:1,to:1,color:"#30E070"}],Yn=(e,t)=>t<=0?0:Math.min(Math.max(e/t,0),1),Xn=(e,t)=>{if(e<=0)return;let r;for(const s of t)(s.from===s.to?e>=s.from:e>s.from&&e<=s.to)&&(r=s.color);return r},ut=({value:e,maxValue:t=1,error:r,isLoading:s,title:a,valueLabel:i,colorMap:o=er,className:l,titleClassName:c,valueClassName:d,inline:u,ariaLabel:f})=>{const g=e==null,p=!!(r||s||!g),m=Yn(g?0:e,t),y=Xn(m,o),b=i??(g?"—":e),v=f??(typeof a=="string"?a:void 0),C=r||s,N=r?n.jsx(Jt,{}):s?n.jsx(x.DialLoader,{fullWidth:!1}):n.jsx("span",{className:I.mergeClasses("shrink-0 tabular-nums text-end",u?"dial-small-text min-w-[5ch] text-primary":"dial-small-semi-text text-primary",d),children:b}),S=p?n.jsx("div",{role:"progressbar","aria-valuenow":r||s||typeof e!="number"?void 0:e,"aria-valuemin":0,"aria-valuemax":t,"aria-label":v,className:I.mergeClasses("w-full overflow-hidden rounded-sm",u?"h-1":"h-2",r?"bg-error":"bg-layer-1"),children:!C&&n.jsx("div",{className:"h-full rounded-sm transition-[width] duration-300",style:{width:`${m*100}%`,backgroundColor:y}})}):null,D=n.jsx("span",{className:I.mergeClasses("dial-small-text text-primary",c),children:a});return u?n.jsxs("div",{className:I.mergeClasses("flex flex-row items-center gap-2",l),children:[n.jsx("div",{className:"w-1/2 min-w-0",children:D}),n.jsxs("div",{className:"flex w-1/2 flex-row items-center gap-2",children:[n.jsx("div",{className:"min-w-0 flex-1",children:S}),N]})]}):n.jsxs("div",{className:I.mergeClasses("flex flex-col gap-1",l),children:[n.jsxs("div",{className:"flex flex-row items-center justify-between gap-2",children:[D,N]}),S]})},Ur=({title:e,description:t,children:r,expanded:s,defaultExpanded:a=!1,disabled:i,nonCollapsible:o,onToggle:l,className:c,headerClassName:d,contentClassName:u})=>{const f=s!==void 0,[g,p]=h.useState(a),m=o?!0:f?s:g,y=h.useId(),b=()=>{if(i)return;const v=!m;f||p(v),l?.(v)};return n.jsxs("div",{className:I.mergeClasses("rounded border border-secondary",c),children:[n.jsxs("button",{type:"button","aria-expanded":m,"aria-controls":y,disabled:i||o,onClick:b,className:I.mergeClasses("flex w-full items-center gap-2 p-4 text-left",i?"cursor-not-allowed":"cursor-pointer",o&&"cursor-default",d),children:[!o&&n.jsx(F.DialIcon,{className:se("text-secondary transition-transform",m&&"rotate-90"),icon:n.jsx(H.IconChevronRight,{size:V.DIAL_ICON_SIZE.SM})}),n.jsx("span",{className:"dial-body-text text-primary",children:e}),t!=null&&t!==!1&&n.jsx("span",{className:"dial-tiny-text text-secondary",children:t})]}),m&&n.jsx("div",{id:y,role:"region",className:I.mergeClasses("px-4 pb-4",u),children:r})]})},Qn=({title:e,titleTooltip:t,description:r,data:s,compareData:a,compareLabels:i,maxValue:o,colorMap:l,defaultExpanded:c=!0,nonCollapsible:d,isLoading:u,onBarClick:f,inline:g,barTitleClassName:p,barValueClassName:m,barClassName:y,barDescriptions:b,className:v})=>{const C=Object.entries(s),N=g?I.mergeClasses("text-secondary",p):p,S=i?"dial-tiny-text text-secondary":void 0,D=t?n.jsx(T.DialTooltip,{tooltip:t,children:e}):e,w=a?[...new Set([...Object.keys(s),...Object.keys(a)])]:[],R="cursor-pointer rounded-sm text-left focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent-primary",_="group flex flex-col gap-1.5",O=I.mergeClasses("flex flex-col gap-1.5 pl-2",f&&"group-hover:bg-accent-primary-alpha group-focus-visible:bg-accent-primary-alpha",y);return n.jsx(Ur,{title:D,description:r,defaultExpanded:c,nonCollapsible:d,className:v,children:n.jsx("div",{className:I.mergeClasses("flex flex-col",a?"gap-4":g?"gap-2":"gap-3"),children:u?n.jsx(x.DialLoader,{fullWidth:!1,className:"self-center"}):a?w.map(A=>{const j=A in s?s[A]:null,P=A in a?a[A]:null,G=typeof j=="number"&&typeof P=="number"?parseFloat((P-j).toFixed(3)):null,ee=G!=null&&G!==0,$=ee&&G>0,k=ee?$?`+${G}`:String(G):null,z=b?.[A],q=n.jsx("span",{className:"dial-small-text text-secondary",children:A}),X=n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"flex items-center gap-2",children:[z?n.jsx(T.DialTooltip,{tooltip:z,children:q}):q,k!=null&&n.jsx("span",{className:I.mergeClasses("dial-tiny-semi-text rounded-[120px] border border-transparent px-2",$?"bg-success text-success":"bg-error text-error"),children:k})]}),n.jsxs("div",{className:O,children:[n.jsx(ut,{title:i?.[0],value:j,maxValue:o,colorMap:l,inline:g,titleClassName:S,ariaLabel:A}),n.jsx(ut,{title:i?.[1],value:P,maxValue:o,colorMap:l,inline:g,titleClassName:S,ariaLabel:`${A} compare`})]})]});return f?n.jsx("button",{type:"button",onClick:()=>f(A,j),className:I.mergeClasses(_,R),children:X},A):n.jsx("div",{className:_,children:X},A)}):C.map(([A,j])=>{const P=n.jsx(ut,{title:A,value:j,maxValue:o,colorMap:l,inline:g,titleClassName:N,valueClassName:m,className:y}),B=f?n.jsx("button",{type:"button",onClick:()=>f(A,j),className:R,children:P}):P,G=b?.[A];return G?n.jsx(T.DialTooltip,{tooltip:G,triggerClassName:"flex flex-col",children:B},A):n.jsx(h.Fragment,{children:B},A)})})})},Jn="#FF4E50",es=(e,t)=>{let r=-1;return t.forEach((s,a)=>{(s.from===s.to?e>=s.from:e>s.from&&e<=s.to)&&(r=a)}),r},hr=(e,t)=>{const r=t.map(()=>0);let s=0;e.forEach(c=>{if(c<=0){s+=1;return}const d=es(c,t);d>=0&&(r[d]+=1)});const a=Math.max(0,s,...r),i=c=>a>0?c/a:0,o={from:0,to:0,color:Jn,count:s,ratio:i(s),isZeroBucket:!0},l=t.map((c,d)=>({from:c.from,to:c.to,color:c.color,count:r[d],ratio:i(r[d]),isZeroBucket:!1}));return[o,...l]},Kr=e=>e<=0?2:e%2===0?e:e+1,ts=e=>{const t=Kr(e);return[t,t/2,0]},Ot=e=>`${Math.round(e*100)/100}`,Wr=(e,t)=>e===t?Ot(e):`${Ot(e)}-${Ot(t)}`,At=128,rs=(e,t)=>{const r=Wr(e,t);return e===t?`scored ${r}`:`scored between ${r}`},mr=(e,t,r,s,a)=>n.jsxs("div",{className:"flex flex-col gap-0.5",children:[e&&n.jsx("strong",{children:e}),n.jsxs("span",{children:[t," out of ",r," ",s]}),n.jsx("span",{children:rs(a.from,a.to)})]}),ns=({title:e,values:t,colorMap:r=er,valueTitle:s="values",showCount:a,isLoading:i,className:o,compareValues:l,valueSetLabel:c,compareValueSetLabel:d})=>{const u=hr(t,r),f=l?hr(l,r):void 0,g=t.length,p=l?.length??0,m=Math.max(g,p),y=Kr(m),b=ts(m),v=D=>D.map(w=>({...w,ratio:y>0?w.count/y:0})),C=v(u),N=f?v(f):void 0,S=(D,w,R,_)=>{if(D.count===0)return n.jsx("div",{className:"flex h-full flex-1 items-end","aria-hidden":"true",children:n.jsx("div",{className:"min-h-2 w-full rounded-sm",style:{height:`${D.ratio*100}%`}})});const O=_?{backgroundImage:`repeating-linear-gradient(135deg, ${D.color} 0px, ${D.color} 1px, transparent 1px, transparent 4px)`,borderColor:D.color}:{backgroundColor:D.color};return n.jsx(T.DialTooltip,{placement:"bottom",tooltip:w,triggerClassName:"flex h-full flex-1 items-end",children:n.jsx("div",{role:"img","aria-label":R,className:"flex min-h-2 w-full items-center justify-center rounded-sm border border-transparent",style:{height:`${D.ratio*100}%`,...O},children:a&&n.jsx("span",{className:"dial-tiny-semi-text text-primary",children:D.count})})})};return n.jsxs("div",{className:I.mergeClasses("flex flex-col gap-2",o),children:[n.jsx("span",{className:"dial-small-text text-primary",children:e}),i?n.jsx("div",{className:"flex items-center justify-center",style:{height:At},children:n.jsx(x.DialLoader,{fullWidth:!1})}):n.jsxs("div",{className:"grid grid-cols-[auto_minmax(0,1fr)] gap-x-2 gap-y-1",children:[n.jsx("div",{"data-histogram-y-axis":!0,"aria-hidden":"true",className:"relative",style:{height:At},children:b.map((D,w)=>n.jsx("span",{className:"dial-tiny-text absolute right-0 whitespace-nowrap text-secondary",style:{top:`${w/(b.length-1)*100}%`,transform:"translateY(-50%)"},children:D},D))}),n.jsxs("div",{className:"relative min-w-0",children:[b.map((D,w)=>n.jsx("div",{"data-histogram-grid":!0,className:"pointer-events-none absolute inset-x-0 border-t border-primary",style:{top:`${w/(b.length-1)*100}%`}},D)),n.jsx("div",{className:"relative flex items-end gap-1",style:{height:At},children:N?C.map((D,w)=>{const R=N[w],_=`${D.count} out of ${g} ${s}`,O=`${R.count} out of ${p} ${s}`;return n.jsxs("div",{className:"flex h-full flex-1 items-end",children:[S(D,mr(c,D.count,g,s,D),_,!0),S(R,mr(d,R.count,p,s,R),O,!1)]},w)}):C.map((D,w)=>{const R=`${D.count} out of ${g} ${s}`;return D.count===0?n.jsx("div",{className:"flex h-full flex-1 items-end","aria-hidden":"true",children:n.jsx("div",{className:"min-h-2 w-full rounded-sm",style:{height:`${D.ratio*100}%`}})},w):n.jsx(T.DialTooltip,{placement:"bottom",tooltip:R,triggerClassName:"flex h-full flex-1 items-end",children:n.jsx("div",{role:"img","aria-label":R,className:I.mergeClasses("flex min-h-2 w-full items-center justify-center rounded-sm border","border-transparent"),style:{height:`${D.ratio*100}%`,backgroundColor:D.color},children:a&&D.count>0&&n.jsx("span",{className:"dial-tiny-semi-text text-primary",children:D.count})})},w)})})]}),n.jsx("div",{}),n.jsx("div",{"data-histogram-x-axis":!0,className:"flex gap-1",children:C.map((D,w)=>n.jsx("span",{className:"dial-caption-text flex-1 text-center text-secondary",children:Wr(D.from,D.to)},w))})]})]})},ss=({value:e,max:t=100,size:r=T.ElementSize.Standard,labelProps:s,valueLabel:a,id:i,className:o,"aria-label":l,...c})=>{const d=h.useId(),u=i??d,f=!!s?.label,g=f?s?.id??`${u}-label`:void 0,p=t>0?t:0,m=Number.isFinite(e)?e:0,y=Math.min(Math.max(m,0),p),b=p>0?y/p*100:0,v=n.jsx("div",{...c,id:u,role:"progressbar","aria-valuenow":y,"aria-valuemin":0,"aria-valuemax":p,"aria-labelledby":g,"aria-label":T.resolveAccessibleName(l,f?void 0:"Progress"),className:I.mergeClasses("w-full overflow-hidden rounded-full bg-control-disable-primary",r===T.ElementSize.Small?"h-1":"h-2",o),children:n.jsx("div",{style:{width:`${b}%`},className:"h-full rounded-full bg-control-accent transition-[width] duration-300 motion-reduce:transition-none"})});return!f&&!a?v:n.jsxs("div",{className:"flex w-full flex-col gap-1",children:[n.jsxs("div",{className:"flex items-baseline gap-2",children:[s&&n.jsx(L.Label,{...s,id:g}),a&&n.jsx("span",{className:"dial-tiny-text text-secondary ml-auto shrink-0",children:a})]}),v]})},as=7,is=2,os=e=>e<=0?[]:Array.from({length:e},(t,r)=>r+1);var ft=(e=>(e.Active="active",e.Adjacent="adjacent",e.Far="far",e))(ft||{});const ls=(e,t,r)=>e===t?"active":r<as||Math.abs(e-t)<=is?"adjacent":"far",cs=({page:e,totalPages:t,onPageChange:r,className:s})=>{const a=os(t);return n.jsxs("nav",{"aria-label":"Pagination",className:I.mergeClasses("flex items-center gap-2",s),children:[n.jsx(T.DialIconButton,{icon:n.jsx(H.IconCaretLeftFilled,{size:V.DIAL_ICON_SIZE.SM,className:"text-secondary"}),size:T.ElementSize.Small,className:"!p-0 items-center flex justify-center",disabled:e<=1,onClick:()=>r(e-1),"aria-label":"Previous page"}),n.jsx("div",{className:"flex flex-row items-center gap-2",children:a.map(i=>{const o=ls(i,e,t);return n.jsx("button",{type:"button",onClick:()=>r(i),"aria-label":`Page ${i}`,"aria-current":i===e?"page":void 0,className:I.mergeClasses("dial-pagination-dot rounded-full focus-visible:outline outline-offset-0 transition-all duration-300 ease-in-out",o===ft.Active&&"h-[8px] w-[32px]",o===ft.Adjacent&&"size-[8px]",o===ft.Far&&"size-[4px]")},i)})}),n.jsx(T.DialIconButton,{icon:n.jsx(H.IconCaretRightFilled,{size:V.DIAL_ICON_SIZE.SM,className:"text-secondary"}),size:T.ElementSize.Small,className:"!p-0 items-center flex justify-center",disabled:e>=t,onClick:()=>r(e+1),"aria-label":"Next page"})]})},Gt=({label:e,id:t,checked:r,indeterminate:s,disabled:a,ariaLabel:i,onChange:o,className:l,...c})=>{const d=h.useCallback(p=>{o?.(p.target.checked,t)},[o,t]),u=se("flex flex-row items-center cursor-pointer text-accent-primary small-medium min-w-0",`${r||s?"":'before:content-[""] before:inline-block before:w-[18px] before:h-[18px] before:border before:border-hover before:rounded'}`,a?"pointer-events-none text-secondary before:border-icon-secondary before:bg-layer-4":"",l),f=se("border rounded",a?"bg-layer-4 border-icon-secondary":""),g=()=>s?n.jsx(H.IconMinus,{className:f,...V.BASE_ICON_PROPS}):r?n.jsx(H.IconCheck,{className:f,...V.BASE_ICON_PROPS}):null;return n.jsxs("label",{...c,className:u,htmlFor:t,"aria-description":c["aria-description"]||F.ariaDescription,children:[g(),e&&(typeof e=="string"?n.jsx(F.DialEllipsisTooltip,{text:e,className:"ml-2 text-primary"}):e),n.jsx("input",{type:"checkbox",role:"checkbox",name:t,onChange:d,id:t,checked:r,"aria-checked":s?"mixed":r,"aria-disabled":a||void 0,"aria-label":e?void 0:i,className:"invisible size-0"})]})};var ve=(e=>(e.VALID="valid",e.ERROR="error",e))(ve||{});const ds=(e,t)=>{if(t===e.id)switch(e.status){case ve.VALID:return"border-accent-secondary text-primary";case ve.ERROR:return"border-red-900 text-primary";default:return"border-accent-primary text-primary"}switch(e.status){case ve.VALID:return"border-primary text-primary";case ve.ERROR:return"border-red-900 text-error";default:return"border-primary text-secondary"}},us=(e,t)=>{if(t===e.id)switch(e.status){case ve.VALID:return"bg-accent-secondary";case ve.ERROR:return"bg-red-400";default:return"bg-accent-primary"}switch(e.status){case ve.VALID:return"bg-accent-secondary";case ve.ERROR:return"bg-red-400";default:return"bg-layer-4"}},fs=({step:e,index:t,currentStep:r,onChangeStep:s})=>{const a="h-[32px] flex flex-1 min-w-[180px] items-center dial-tiny-text cursor-pointer dial-step",i="w-[22px] h-[22px] flex justify-center items-center mr-2 rounded-full text-white",o=()=>r===e.id&&e.status===ve.ERROR?n.jsx(H.IconExclamationCircle,{stroke:2,size:V.DIAL_ICON_SIZE.SM}):r!==e.id&&e.status===ve.VALID?n.jsx(H.IconCheck,{stroke:2,size:V.DIAL_ICON_SIZE.SM}):t+1;return n.jsxs("button",{className:se(a,ds(e,r)),onClick:()=>s(e.id),children:[n.jsx("span",{className:se(i,us(e,r)),children:o()}),n.jsx("span",{children:e.name})]})},ps=({steps:e,currentStep:t,onChangeStep:r})=>{const s=a=>{const i=e.findIndex(c=>c.id===t),o=e.findIndex(c=>c.id===a);if(a===t)return;(e.slice(0,o).every(c=>c.status===ve.VALID)||o<i)&&r(a)};return n.jsx("div",{id:"steps",className:"flex gap-x-3",children:e.map((a,i)=>n.jsx(fs,{currentStep:t,onChangeStep:s,step:a,index:i},a.id))})},_t=e=>(e.toString().split(".")[1]??"").length,gs=({value:e,min:t=0,max:r=1,step:s=.1,disabled:a=!1,labelProps:i,labels:o,formatValue:l,onChange:c,className:d,trackClassName:u,fillClassName:f,thumbClassName:g,labelsClassName:p,"aria-label":m,"aria-labelledby":y,...b})=>{const v=h.useRef(null),C=Math.max(0,Math.min(100,(e-t)/(r-t)*100)),N=_t(s),S=l?l(e):e.toFixed(N),D=h.useCallback(O=>{const A=v.current;if(!A)return e;const j=A.getBoundingClientRect(),P=(O-j.left)/j.width,B=t+P*(r-t),G=_t(s),ee=parseFloat((Math.round((B-t)/s)*s+t).toFixed(G));return Math.min(r,Math.max(t,ee))},[t,r,s,e]),w=h.useCallback(O=>{a||(O.currentTarget.setPointerCapture(O.pointerId),c?.(D(O.clientX)))},[a,D,c]),R=h.useCallback(O=>{a||O.buttons===0||c?.(D(O.clientX))},[a,D,c]),_=h.useCallback(O=>{if(a)return;const A=_t(s),j=G=>parseFloat((Math.round((G-t)/s)*s+t).toFixed(A)),P=G=>Math.min(r,Math.max(t,G));let B=e;switch(O.key){case"ArrowRight":case"ArrowUp":B=P(j(e+s));break;case"ArrowLeft":case"ArrowDown":B=P(j(e-s));break;case"Home":B=t;break;case"End":B=r;break;default:return}O.preventDefault(),B!==e&&c?.(B)},[a,e,s,t,r,c]);return n.jsxs("div",{className:I.mergeClasses("flex flex-col",a&&"pointer-events-none opacity-50",d),...b,children:[i&&n.jsx(Ae.DialLabel,{...i,htmlFor:b.id}),n.jsxs("div",{ref:v,className:"relative flex h-[38px] cursor-pointer items-center",onPointerDown:w,onPointerMove:R,children:[n.jsx("div",{className:I.mergeClasses("pointer-events-none absolute inset-x-0 h-3 rounded-[10px] bg-layer-1",u)}),n.jsx("div",{className:I.mergeClasses("pointer-events-none absolute left-0 h-3 rounded-[10px] bg-controls-accent-primary",f),style:{width:`${C}%`}}),n.jsx("div",{role:"slider",tabIndex:a?-1:0,"aria-valuenow":e,"aria-valuemin":t,"aria-valuemax":r,"aria-disabled":a||void 0,"aria-label":m,"aria-labelledby":y,className:I.mergeClasses("dial-small-text absolute -translate-x-1/2 flex size-[38px] cursor-grab select-none items-center justify-center rounded-full bg-layer-3 text-primary shadow focus:outline-none focus-visible:ring-2 focus-visible:ring-focus",g),style:{left:`${C}%`},onKeyDown:_,children:S})]}),o&&n.jsx("div",{className:I.mergeClasses("dial-tiny-text flex text-secondary",p),children:o.length===3?n.jsxs(n.Fragment,{children:[n.jsx("span",{children:o[0]}),n.jsx("span",{className:"flex-1 text-center",children:o[1]}),n.jsx("span",{children:o[2]})]}):n.jsxs(n.Fragment,{children:[n.jsx("span",{children:o[0]}),n.jsx("span",{className:"ml-auto",children:o[1]})]})})]})},hs=({label:e,text:t,tooltip:r,children:s,postfix:a,className:i})=>n.jsxs("div",{className:I.mergeClasses("flex flex-col",s?"":"max-w-[200px]",i),children:[e&&n.jsx("label",{className:"dial-tiny-text mb-2 text-secondary",children:e}),s||n.jsxs("div",{className:"flex flex-row items-center gap-x-2",children:[n.jsx(T.DialTooltip,{triggerClassName:"text-primary flex-1 min-w-0",tooltip:r||t,children:t}),a||null]})]}),qr=h.createContext({dragDropManager:void 0});function De(e){return"Minified Redux error #"+e+"; visit https://redux.js.org/Errors?code="+e+" for the full message or use the non-minified dev environment for full errors. "}var xr=(function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"})(),br=function(){return Math.random().toString(36).substring(7).split("").join(".")},vr={INIT:"@@redux/INIT"+br(),REPLACE:"@@redux/REPLACE"+br()};function ms(e){if(typeof e!="object"||e===null)return!1;for(var t=e;Object.getPrototypeOf(t)!==null;)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t}function xs(e){if(e===void 0)return"undefined";if(e===null)return"null";var t=typeof e;switch(t){case"boolean":case"string":case"number":case"symbol":case"function":return t}if(Array.isArray(e))return"array";if(ys(e))return"date";if(vs(e))return"error";var r=bs(e);switch(r){case"Symbol":case"Promise":case"WeakMap":case"WeakSet":case"Map":case"Set":return r}return t.slice(8,-1).toLowerCase().replace(/\s/g,"")}function bs(e){return typeof e.constructor=="function"?e.constructor.name:null}function vs(e){return e instanceof Error||typeof e.message=="string"&&e.constructor&&typeof e.constructor.stackTraceLimit=="number"}function ys(e){return e instanceof Date?!0:typeof e.toDateString=="function"&&typeof e.getDate=="function"&&typeof e.setDate=="function"}function Ke(e){var t=typeof e;return process.env.NODE_ENV!=="production"&&(t=xs(e)),t}function Zr(e,t,r){var s;if(typeof t=="function"&&typeof r=="function"||typeof r=="function"&&typeof arguments[3]=="function")throw new Error(process.env.NODE_ENV==="production"?De(0):"It looks like you are passing several store enhancers to createStore(). This is not supported. Instead, compose them together to a single function. See https://redux.js.org/tutorials/fundamentals/part-4-store#creating-a-store-with-enhancers for an example.");if(typeof t=="function"&&typeof r>"u"&&(r=t,t=void 0),typeof r<"u"){if(typeof r!="function")throw new Error(process.env.NODE_ENV==="production"?De(1):"Expected the enhancer to be a function. Instead, received: '"+Ke(r)+"'");return r(Zr)(e,t)}if(typeof e!="function")throw new Error(process.env.NODE_ENV==="production"?De(2):"Expected the root reducer to be a function. Instead, received: '"+Ke(e)+"'");var a=e,i=t,o=[],l=o,c=!1;function d(){l===o&&(l=o.slice())}function u(){if(c)throw new Error(process.env.NODE_ENV==="production"?De(3):"You may not call store.getState() while the reducer is executing. The reducer has already received the state as an argument. Pass it down from the top reducer instead of reading it from the store.");return i}function f(y){if(typeof y!="function")throw new Error(process.env.NODE_ENV==="production"?De(4):"Expected the listener to be a function. Instead, received: '"+Ke(y)+"'");if(c)throw new Error(process.env.NODE_ENV==="production"?De(5):"You may not call store.subscribe() while the reducer is executing. If you would like to be notified after the store has been updated, subscribe from a component and invoke store.getState() in the callback to access the latest state. See https://redux.js.org/api/store#subscribelistener for more details.");var b=!0;return d(),l.push(y),function(){if(b){if(c)throw new Error(process.env.NODE_ENV==="production"?De(6):"You may not unsubscribe from a store listener while the reducer is executing. See https://redux.js.org/api/store#subscribelistener for more details.");b=!1,d();var C=l.indexOf(y);l.splice(C,1),o=null}}}function g(y){if(!ms(y))throw new Error(process.env.NODE_ENV==="production"?De(7):"Actions must be plain objects. Instead, the actual type was: '"+Ke(y)+"'. You may need to add middleware to your store setup to handle dispatching other values, such as 'redux-thunk' to handle dispatching functions. See https://redux.js.org/tutorials/fundamentals/part-4-store#middleware and https://redux.js.org/tutorials/fundamentals/part-6-async-logic#using-the-redux-thunk-middleware for examples.");if(typeof y.type>"u")throw new Error(process.env.NODE_ENV==="production"?De(8):'Actions may not have an undefined "type" property. You may have misspelled an action type string constant.');if(c)throw new Error(process.env.NODE_ENV==="production"?De(9):"Reducers may not dispatch actions.");try{c=!0,i=a(i,y)}finally{c=!1}for(var b=o=l,v=0;v<b.length;v++){var C=b[v];C()}return y}function p(y){if(typeof y!="function")throw new Error(process.env.NODE_ENV==="production"?De(10):"Expected the nextReducer to be a function. Instead, received: '"+Ke(y));a=y,g({type:vr.REPLACE})}function m(){var y,b=f;return y={subscribe:function(C){if(typeof C!="object"||C===null)throw new Error(process.env.NODE_ENV==="production"?De(11):"Expected the observer to be an object. Instead, received: '"+Ke(C)+"'");function N(){C.next&&C.next(u())}N();var S=b(N);return{unsubscribe:S}}},y[xr]=function(){return this},y}return g({type:vr.INIT}),s={dispatch:g,subscribe:f,getState:u,replaceReducer:p},s[xr]=m,s}function W(e,t,...r){if(Ds()&&t===void 0)throw new Error("invariant requires an error message argument");if(!e){let s;if(t===void 0)s=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{let a=0;s=new Error(t.replace(/%s/g,function(){return r[a++]})),s.name="Invariant Violation"}throw s.framesToPop=1,s}}function Ds(){return typeof process<"u"&&process.env.NODE_ENV==="production"}function Cs(e,t,r){return t.split(".").reduce((s,a)=>s&&s[a]?s[a]:r||null,e)}function Ns(e,t){return e.filter(r=>r!==t)}function Yr(e){return typeof e=="object"}function Is(e,t){const r=new Map,s=i=>{r.set(i,r.has(i)?r.get(i)+1:1)};e.forEach(s),t.forEach(s);const a=[];return r.forEach((i,o)=>{i===1&&a.push(o)}),a}function Ss(e,t){return e.filter(r=>t.indexOf(r)>-1)}const tr="dnd-core/INIT_COORDS",vt="dnd-core/BEGIN_DRAG",rr="dnd-core/PUBLISH_DRAG_SOURCE",yt="dnd-core/HOVER",Dt="dnd-core/DROP",Ct="dnd-core/END_DRAG";function yr(e,t){return{type:tr,payload:{sourceClientOffset:t||null,clientOffset:e||null}}}const js={type:tr,payload:{clientOffset:null,sourceClientOffset:null}};function Ts(e){return function(r=[],s={publishSource:!0}){const{publishSource:a=!0,clientOffset:i,getSourceClientOffset:o}=s,l=e.getMonitor(),c=e.getRegistry();e.dispatch(yr(i)),ws(r,l,c);const d=As(r,l);if(d==null){e.dispatch(js);return}let u=null;if(i){if(!o)throw new Error("getSourceClientOffset must be defined");Es(o),u=o(d)}e.dispatch(yr(i,u));const g=c.getSource(d).beginDrag(l,d);if(g==null)return;Os(g),c.pinSource(d);const p=c.getSourceType(d);return{type:vt,payload:{itemType:p,item:g,sourceId:d,clientOffset:i||null,sourceClientOffset:u||null,isSourcePublic:!!a}}}}function ws(e,t,r){W(!t.isDragging(),"Cannot call beginDrag while dragging."),e.forEach(function(s){W(r.getSource(s),"Expected sourceIds to be registered.")})}function Es(e){W(typeof e=="function","When clientOffset is provided, getSourceClientOffset must be a function.")}function Os(e){W(Yr(e),"Item must be an object.")}function As(e,t){let r=null;for(let s=e.length-1;s>=0;s--)if(t.canDragSource(e[s])){r=e[s];break}return r}function _s(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Rs(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{},s=Object.keys(r);typeof Object.getOwnPropertySymbols=="function"&&(s=s.concat(Object.getOwnPropertySymbols(r).filter(function(a){return Object.getOwnPropertyDescriptor(r,a).enumerable}))),s.forEach(function(a){_s(e,a,r[a])})}return e}function ks(e){return function(r={}){const s=e.getMonitor(),a=e.getRegistry();Ps(s),Fs(s).forEach((o,l)=>{const c=Ls(o,l,a,s),d={type:Dt,payload:{dropResult:Rs({},r,c)}};e.dispatch(d)})}}function Ps(e){W(e.isDragging(),"Cannot call drop while not dragging."),W(!e.didDrop(),"Cannot call drop twice during one drag operation.")}function Ls(e,t,r,s){const a=r.getTarget(e);let i=a?a.drop(s,e):void 0;return Ms(i),typeof i>"u"&&(i=t===0?{}:s.getDropResult()),i}function Ms(e){W(typeof e>"u"||Yr(e),"Drop result must either be an object or undefined.")}function Fs(e){const t=e.getTargetIds().filter(e.canDropOnTarget,e);return t.reverse(),t}function Bs(e){return function(){const r=e.getMonitor(),s=e.getRegistry();zs(r);const a=r.getSourceId();return a!=null&&(s.getSource(a,!0).endDrag(r,a),s.unpinSource()),{type:Ct}}}function zs(e){W(e.isDragging(),"Cannot call endDrag while not dragging.")}function Ut(e,t){return t===null?e===null:Array.isArray(e)?e.some(r=>r===t):e===t}function $s(e){return function(r,{clientOffset:s}={}){Hs(r);const a=r.slice(0),i=e.getMonitor(),o=e.getRegistry(),l=i.getItemType();return Gs(a,o,l),Vs(a,i,o),Us(a,i,o),{type:yt,payload:{targetIds:a,clientOffset:s||null}}}}function Hs(e){W(Array.isArray(e),"Expected targetIds to be an array.")}function Vs(e,t,r){W(t.isDragging(),"Cannot call hover while not dragging."),W(!t.didDrop(),"Cannot call hover after drop.");for(let s=0;s<e.length;s++){const a=e[s];W(e.lastIndexOf(a)===s,"Expected targetIds to be unique in the passed array.");const i=r.getTarget(a);W(i,"Expected targetIds to be registered.")}}function Gs(e,t,r){for(let s=e.length-1;s>=0;s--){const a=e[s],i=t.getTargetType(a);Ut(i,r)||e.splice(s,1)}}function Us(e,t,r){e.forEach(function(s){r.getTarget(s).hover(t,s)})}function Ks(e){return function(){if(e.getMonitor().isDragging())return{type:rr}}}function Ws(e){return{beginDrag:Ts(e),publishDragSource:Ks(e),hover:$s(e),drop:ks(e),endDrag:Bs(e)}}class qs{receiveBackend(t){this.backend=t}getMonitor(){return this.monitor}getBackend(){return this.backend}getRegistry(){return this.monitor.registry}getActions(){const t=this,{dispatch:r}=this.store;function s(i){return(...o)=>{const l=i.apply(t,o);typeof l<"u"&&r(l)}}const a=Ws(this);return Object.keys(a).reduce((i,o)=>{const l=a[o];return i[o]=s(l),i},{})}dispatch(t){this.store.dispatch(t)}constructor(t,r){this.isSetUp=!1,this.handleRefCountChange=()=>{const s=this.store.getState().refCount>0;this.backend&&(s&&!this.isSetUp?(this.backend.setup(),this.isSetUp=!0):!s&&this.isSetUp&&(this.backend.teardown(),this.isSetUp=!1))},this.store=t,this.monitor=r,t.subscribe(this.handleRefCountChange)}}function Zs(e,t){return{x:e.x+t.x,y:e.y+t.y}}function Xr(e,t){return{x:e.x-t.x,y:e.y-t.y}}function Ys(e){const{clientOffset:t,initialClientOffset:r,initialSourceClientOffset:s}=e;return!t||!r||!s?null:Xr(Zs(t,s),r)}function Xs(e){const{clientOffset:t,initialClientOffset:r}=e;return!t||!r?null:Xr(t,r)}const rt=[],nr=[];rt.__IS_NONE__=!0;nr.__IS_ALL__=!0;function Qs(e,t){return e===rt?!1:e===nr||typeof t>"u"?!0:Ss(t,e).length>0}class Js{subscribeToStateChange(t,r={}){const{handlerIds:s}=r;W(typeof t=="function","listener must be a function."),W(typeof s>"u"||Array.isArray(s),"handlerIds, when specified, must be an array of strings.");let a=this.store.getState().stateId;const i=()=>{const o=this.store.getState(),l=o.stateId;try{l===a||l===a+1&&!Qs(o.dirtyHandlerIds,s)||t()}finally{a=l}};return this.store.subscribe(i)}subscribeToOffsetChange(t){W(typeof t=="function","listener must be a function.");let r=this.store.getState().dragOffset;const s=()=>{const a=this.store.getState().dragOffset;a!==r&&(r=a,t())};return this.store.subscribe(s)}canDragSource(t){if(!t)return!1;const r=this.registry.getSource(t);return W(r,`Expected to find a valid source. sourceId=${t}`),this.isDragging()?!1:r.canDrag(this,t)}canDropOnTarget(t){if(!t)return!1;const r=this.registry.getTarget(t);if(W(r,`Expected to find a valid target. targetId=${t}`),!this.isDragging()||this.didDrop())return!1;const s=this.registry.getTargetType(t),a=this.getItemType();return Ut(s,a)&&r.canDrop(this,t)}isDragging(){return!!this.getItemType()}isDraggingSource(t){if(!t)return!1;const r=this.registry.getSource(t,!0);if(W(r,`Expected to find a valid source. sourceId=${t}`),!this.isDragging()||!this.isSourcePublic())return!1;const s=this.registry.getSourceType(t),a=this.getItemType();return s!==a?!1:r.isDragging(this,t)}isOverTarget(t,r={shallow:!1}){if(!t)return!1;const{shallow:s}=r;if(!this.isDragging())return!1;const a=this.registry.getTargetType(t),i=this.getItemType();if(i&&!Ut(a,i))return!1;const o=this.getTargetIds();if(!o.length)return!1;const l=o.indexOf(t);return s?l===o.length-1:l>-1}getItemType(){return this.store.getState().dragOperation.itemType}getItem(){return this.store.getState().dragOperation.item}getSourceId(){return this.store.getState().dragOperation.sourceId}getTargetIds(){return this.store.getState().dragOperation.targetIds}getDropResult(){return this.store.getState().dragOperation.dropResult}didDrop(){return this.store.getState().dragOperation.didDrop}isSourcePublic(){return!!this.store.getState().dragOperation.isSourcePublic}getInitialClientOffset(){return this.store.getState().dragOffset.initialClientOffset}getInitialSourceClientOffset(){return this.store.getState().dragOffset.initialSourceClientOffset}getClientOffset(){return this.store.getState().dragOffset.clientOffset}getSourceClientOffset(){return Ys(this.store.getState().dragOffset)}getDifferenceFromInitialOffset(){return Xs(this.store.getState().dragOffset)}constructor(t,r){this.store=t,this.registry=r}}const Dr=typeof global<"u"?global:self,Qr=Dr.MutationObserver||Dr.WebKitMutationObserver;function Jr(e){return function(){const r=setTimeout(a,0),s=setInterval(a,50);function a(){clearTimeout(r),clearInterval(s),e()}}}function ea(e){let t=1;const r=new Qr(e),s=document.createTextNode("");return r.observe(s,{characterData:!0}),function(){t=-t,s.data=t}}const ta=typeof Qr=="function"?ea:Jr;class ra{enqueueTask(t){const{queue:r,requestFlush:s}=this;r.length||(s(),this.flushing=!0),r[r.length]=t}constructor(){this.queue=[],this.pendingErrors=[],this.flushing=!1,this.index=0,this.capacity=1024,this.flush=()=>{const{queue:t}=this;for(;this.index<t.length;){const r=this.index;if(this.index++,t[r].call(),this.index>this.capacity){for(let s=0,a=t.length-this.index;s<a;s++)t[s]=t[s+this.index];t.length-=this.index,this.index=0}}t.length=0,this.index=0,this.flushing=!1},this.registerPendingError=t=>{this.pendingErrors.push(t),this.requestErrorThrow()},this.requestFlush=ta(this.flush),this.requestErrorThrow=Jr(()=>{if(this.pendingErrors.length)throw this.pendingErrors.shift()})}}class na{call(){try{this.task&&this.task()}catch(t){this.onError(t)}finally{this.task=null,this.release(this)}}constructor(t,r){this.onError=t,this.release=r,this.task=null}}class sa{create(t){const r=this.freeTasks,s=r.length?r.pop():new na(this.onError,a=>r[r.length]=a);return s.task=t,s}constructor(t){this.onError=t,this.freeTasks=[]}}const en=new ra,aa=new sa(en.registerPendingError);function ia(e){en.enqueueTask(aa.create(e))}const sr="dnd-core/ADD_SOURCE",ar="dnd-core/ADD_TARGET",ir="dnd-core/REMOVE_SOURCE",Nt="dnd-core/REMOVE_TARGET";function oa(e){return{type:sr,payload:{sourceId:e}}}function la(e){return{type:ar,payload:{targetId:e}}}function ca(e){return{type:ir,payload:{sourceId:e}}}function da(e){return{type:Nt,payload:{targetId:e}}}function ua(e){W(typeof e.canDrag=="function","Expected canDrag to be a function."),W(typeof e.beginDrag=="function","Expected beginDrag to be a function."),W(typeof e.endDrag=="function","Expected endDrag to be a function.")}function fa(e){W(typeof e.canDrop=="function","Expected canDrop to be a function."),W(typeof e.hover=="function","Expected hover to be a function."),W(typeof e.drop=="function","Expected beginDrag to be a function.")}function Kt(e,t){if(t&&Array.isArray(e)){e.forEach(r=>Kt(r,!1));return}W(typeof e=="string"||typeof e=="symbol",t?"Type can only be a string, a symbol, or an array of either.":"Type can only be a string or a symbol.")}var Ce;(function(e){e.SOURCE="SOURCE",e.TARGET="TARGET"})(Ce||(Ce={}));let pa=0;function ga(){return pa++}function ha(e){const t=ga().toString();switch(e){case Ce.SOURCE:return`S${t}`;case Ce.TARGET:return`T${t}`;default:throw new Error(`Unknown Handler Role: ${e}`)}}function Cr(e){switch(e[0]){case"S":return Ce.SOURCE;case"T":return Ce.TARGET;default:throw new Error(`Cannot parse handler ID: ${e}`)}}function Nr(e,t){const r=e.entries();let s=!1;do{const{done:a,value:[,i]}=r.next();if(i===t)return!0;s=!!a}while(!s);return!1}class ma{addSource(t,r){Kt(t),ua(r);const s=this.addHandler(Ce.SOURCE,t,r);return this.store.dispatch(oa(s)),s}addTarget(t,r){Kt(t,!0),fa(r);const s=this.addHandler(Ce.TARGET,t,r);return this.store.dispatch(la(s)),s}containsHandler(t){return Nr(this.dragSources,t)||Nr(this.dropTargets,t)}getSource(t,r=!1){return W(this.isSourceId(t),"Expected a valid source ID."),r&&t===this.pinnedSourceId?this.pinnedSource:this.dragSources.get(t)}getTarget(t){return W(this.isTargetId(t),"Expected a valid target ID."),this.dropTargets.get(t)}getSourceType(t){return W(this.isSourceId(t),"Expected a valid source ID."),this.types.get(t)}getTargetType(t){return W(this.isTargetId(t),"Expected a valid target ID."),this.types.get(t)}isSourceId(t){return Cr(t)===Ce.SOURCE}isTargetId(t){return Cr(t)===Ce.TARGET}removeSource(t){W(this.getSource(t),"Expected an existing source."),this.store.dispatch(ca(t)),ia(()=>{this.dragSources.delete(t),this.types.delete(t)})}removeTarget(t){W(this.getTarget(t),"Expected an existing target."),this.store.dispatch(da(t)),this.dropTargets.delete(t),this.types.delete(t)}pinSource(t){const r=this.getSource(t);W(r,"Expected an existing source."),this.pinnedSourceId=t,this.pinnedSource=r}unpinSource(){W(this.pinnedSource,"No source is pinned at the time."),this.pinnedSourceId=null,this.pinnedSource=null}addHandler(t,r,s){const a=ha(t);return this.types.set(a,r),t===Ce.SOURCE?this.dragSources.set(a,s):t===Ce.TARGET&&this.dropTargets.set(a,s),a}constructor(t){this.types=new Map,this.dragSources=new Map,this.dropTargets=new Map,this.pinnedSourceId=null,this.pinnedSource=null,this.store=t}}const xa=(e,t)=>e===t;function ba(e,t){return!e&&!t?!0:!e||!t?!1:e.x===t.x&&e.y===t.y}function va(e,t,r=xa){if(e.length!==t.length)return!1;for(let s=0;s<e.length;++s)if(!r(e[s],t[s]))return!1;return!0}function ya(e=rt,t){switch(t.type){case yt:break;case sr:case ar:case Nt:case ir:return rt;case vt:case rr:case Ct:case Dt:default:return nr}const{targetIds:r=[],prevTargetIds:s=[]}=t.payload,a=Is(r,s);if(!(a.length>0||!va(r,s)))return rt;const o=s[s.length-1],l=r[r.length-1];return o!==l&&(o&&a.push(o),l&&a.push(l)),a}function Da(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Ca(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{},s=Object.keys(r);typeof Object.getOwnPropertySymbols=="function"&&(s=s.concat(Object.getOwnPropertySymbols(r).filter(function(a){return Object.getOwnPropertyDescriptor(r,a).enumerable}))),s.forEach(function(a){Da(e,a,r[a])})}return e}const Ir={initialSourceClientOffset:null,initialClientOffset:null,clientOffset:null};function Na(e=Ir,t){const{payload:r}=t;switch(t.type){case tr:case vt:return{initialSourceClientOffset:r.sourceClientOffset,initialClientOffset:r.clientOffset,clientOffset:r.clientOffset};case yt:return ba(e.clientOffset,r.clientOffset)?e:Ca({},e,{clientOffset:r.clientOffset});case Ct:case Dt:return Ir;default:return e}}function Ia(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function We(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{},s=Object.keys(r);typeof Object.getOwnPropertySymbols=="function"&&(s=s.concat(Object.getOwnPropertySymbols(r).filter(function(a){return Object.getOwnPropertyDescriptor(r,a).enumerable}))),s.forEach(function(a){Ia(e,a,r[a])})}return e}const Sa={itemType:null,item:null,sourceId:null,targetIds:[],dropResult:null,didDrop:!1,isSourcePublic:null};function ja(e=Sa,t){const{payload:r}=t;switch(t.type){case vt:return We({},e,{itemType:r.itemType,item:r.item,sourceId:r.sourceId,isSourcePublic:r.isSourcePublic,dropResult:null,didDrop:!1});case rr:return We({},e,{isSourcePublic:!0});case yt:return We({},e,{targetIds:r.targetIds});case Nt:return e.targetIds.indexOf(r.targetId)===-1?e:We({},e,{targetIds:Ns(e.targetIds,r.targetId)});case Dt:return We({},e,{dropResult:r.dropResult,didDrop:!0,targetIds:[]});case Ct:return We({},e,{itemType:null,item:null,sourceId:null,dropResult:null,didDrop:!1,isSourcePublic:null,targetIds:[]});default:return e}}function Ta(e=0,t){switch(t.type){case sr:case ar:return e+1;case ir:case Nt:return e-1;default:return e}}function wa(e=0){return e+1}function Ea(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Oa(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{},s=Object.keys(r);typeof Object.getOwnPropertySymbols=="function"&&(s=s.concat(Object.getOwnPropertySymbols(r).filter(function(a){return Object.getOwnPropertyDescriptor(r,a).enumerable}))),s.forEach(function(a){Ea(e,a,r[a])})}return e}function Aa(e={},t){return{dirtyHandlerIds:ya(e.dirtyHandlerIds,{type:t.type,payload:Oa({},t.payload,{prevTargetIds:Cs(e,"dragOperation.targetIds",[])})}),dragOffset:Na(e.dragOffset,t),refCount:Ta(e.refCount,t),dragOperation:ja(e.dragOperation,t),stateId:wa(e.stateId)}}function _a(e,t=void 0,r={},s=!1){const a=Ra(s),i=new Js(a,new ma(a)),o=new qs(a,i),l=e(o,t,r);return o.receiveBackend(l),o}function Ra(e){const t=typeof window<"u"&&window.__REDUX_DEVTOOLS_EXTENSION__;return Zr(Aa,e&&t&&t({name:"dnd-core",instanceId:"dnd-core"}))}function ka(e,t){if(e==null)return{};var r=Pa(e,t),s,a;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a<i.length;a++)s=i[a],!(t.indexOf(s)>=0)&&Object.prototype.propertyIsEnumerable.call(e,s)&&(r[s]=e[s])}return r}function Pa(e,t){if(e==null)return{};var r={},s=Object.keys(e),a,i;for(i=0;i<s.length;i++)a=s[i],!(t.indexOf(a)>=0)&&(r[a]=e[a]);return r}let Sr=0;const pt=Symbol.for("__REACT_DND_CONTEXT_INSTANCE__");var La=h.memo(function(t){var{children:r}=t,s=ka(t,["children"]);const[a,i]=Ma(s);return h.useEffect(()=>{if(i){const o=tn();return++Sr,()=>{--Sr===0&&(o[pt]=null)}}},[]),n.jsx(qr.Provider,{value:a,children:r})});function Ma(e){if("manager"in e)return[{dragDropManager:e.manager},!1];const t=Fa(e.backend,e.context,e.options,e.debugMode),r=!e.context;return[t,r]}function Fa(e,t=tn(),r,s){const a=t;return a[pt]||(a[pt]={dragDropManager:_a(e,t,r,s)}),a[pt]}function tn(){return typeof global<"u"?global:window}var Rt,jr;function Ba(){return jr||(jr=1,Rt=function e(t,r){if(t===r)return!0;if(t&&r&&typeof t=="object"&&typeof r=="object"){if(t.constructor!==r.constructor)return!1;var s,a,i;if(Array.isArray(t)){if(s=t.length,s!=r.length)return!1;for(a=s;a--!==0;)if(!e(t[a],r[a]))return!1;return!0}if(t.constructor===RegExp)return t.source===r.source&&t.flags===r.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===r.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===r.toString();if(i=Object.keys(t),s=i.length,s!==Object.keys(r).length)return!1;for(a=s;a--!==0;)if(!Object.prototype.hasOwnProperty.call(r,i[a]))return!1;for(a=s;a--!==0;){var o=i[a];if(!e(t[o],r[o]))return!1}return!0}return t!==t&&r!==r}),Rt}var za=Ba();const $a=x.getDefaultExportFromCjs(za),Ve=typeof window<"u"?h.useLayoutEffect:h.useEffect;function Ha(e,t,r){const[s,a]=h.useState(()=>t(e)),i=h.useCallback(()=>{const o=t(e);$a(s,o)||(a(o),r&&r())},[s,e,r]);return Ve(i),[s,i]}function Va(e,t,r){const[s,a]=Ha(e,t,r);return Ve(function(){const o=e.getHandlerId();if(o!=null)return e.subscribeToStateChange(a,{handlerIds:[o]})},[e,a]),s}function rn(e,t,r){return Va(t,e||(()=>({})),()=>r.reconnect())}function nn(e,t){const r=[...t||[]];return t==null&&typeof e!="function"&&r.push(e),h.useMemo(()=>typeof e=="function"?e():e,r)}function Ga(e){return h.useMemo(()=>e.hooks.dragSource(),[e])}function Ua(e){return h.useMemo(()=>e.hooks.dragPreview(),[e])}let kt=!1,Pt=!1;class Ka{receiveHandlerId(t){this.sourceId=t}getHandlerId(){return this.sourceId}canDrag(){W(!kt,"You may not call monitor.canDrag() inside your canDrag() implementation. Read more: http://react-dnd.github.io/react-dnd/docs/api/drag-source-monitor");try{return kt=!0,this.internalMonitor.canDragSource(this.sourceId)}finally{kt=!1}}isDragging(){if(!this.sourceId)return!1;W(!Pt,"You may not call monitor.isDragging() inside your isDragging() implementation. Read more: http://react-dnd.github.io/react-dnd/docs/api/drag-source-monitor");try{return Pt=!0,this.internalMonitor.isDraggingSource(this.sourceId)}finally{Pt=!1}}subscribeToStateChange(t,r){return this.internalMonitor.subscribeToStateChange(t,r)}isDraggingSource(t){return this.internalMonitor.isDraggingSource(t)}isOverTarget(t,r){return this.internalMonitor.isOverTarget(t,r)}getTargetIds(){return this.internalMonitor.getTargetIds()}isSourcePublic(){return this.internalMonitor.isSourcePublic()}getSourceId(){return this.internalMonitor.getSourceId()}subscribeToOffsetChange(t){return this.internalMonitor.subscribeToOffsetChange(t)}canDragSource(t){return this.internalMonitor.canDragSource(t)}canDropOnTarget(t){return this.internalMonitor.canDropOnTarget(t)}getItemType(){return this.internalMonitor.getItemType()}getItem(){return this.internalMonitor.getItem()}getDropResult(){return this.internalMonitor.getDropResult()}didDrop(){return this.internalMonitor.didDrop()}getInitialClientOffset(){return this.internalMonitor.getInitialClientOffset()}getInitialSourceClientOffset(){return this.internalMonitor.getInitialSourceClientOffset()}getSourceClientOffset(){return this.internalMonitor.getSourceClientOffset()}getClientOffset(){return this.internalMonitor.getClientOffset()}getDifferenceFromInitialOffset(){return this.internalMonitor.getDifferenceFromInitialOffset()}constructor(t){this.sourceId=null,this.internalMonitor=t.getMonitor()}}let Lt=!1;class Wa{receiveHandlerId(t){this.targetId=t}getHandlerId(){return this.targetId}subscribeToStateChange(t,r){return this.internalMonitor.subscribeToStateChange(t,r)}canDrop(){if(!this.targetId)return!1;W(!Lt,"You may not call monitor.canDrop() inside your canDrop() implementation. Read more: http://react-dnd.github.io/react-dnd/docs/api/drop-target-monitor");try{return Lt=!0,this.internalMonitor.canDropOnTarget(this.targetId)}finally{Lt=!1}}isOver(t){return this.targetId?this.internalMonitor.isOverTarget(this.targetId,t):!1}getItemType(){return this.internalMonitor.getItemType()}getItem(){return this.internalMonitor.getItem()}getDropResult(){return this.internalMonitor.getDropResult()}didDrop(){return this.internalMonitor.didDrop()}getInitialClientOffset(){return this.internalMonitor.getInitialClientOffset()}getInitialSourceClientOffset(){return this.internalMonitor.getInitialSourceClientOffset()}getSourceClientOffset(){return this.internalMonitor.getSourceClientOffset()}getClientOffset(){return this.internalMonitor.getClientOffset()}getDifferenceFromInitialOffset(){return this.internalMonitor.getDifferenceFromInitialOffset()}constructor(t){this.targetId=null,this.internalMonitor=t.getMonitor()}}function qa(e,t,r){const s=r.getRegistry(),a=s.addTarget(e,t);return[a,()=>s.removeTarget(a)]}function Za(e,t,r){const s=r.getRegistry(),a=s.addSource(e,t);return[a,()=>s.removeSource(a)]}function Wt(e,t,r,s){let a;if(a!==void 0)return!!a;if(e===t)return!0;if(typeof e!="object"||!e||typeof t!="object"||!t)return!1;const i=Object.keys(e),o=Object.keys(t);if(i.length!==o.length)return!1;const l=Object.prototype.hasOwnProperty.bind(t);for(let c=0;c<i.length;c++){const d=i[c];if(!l(d))return!1;const u=e[d],f=t[d];if(a=void 0,a===!1||a===void 0&&u!==f)return!1}return!0}function qt(e){return e!==null&&typeof e=="object"&&Object.prototype.hasOwnProperty.call(e,"current")}function Ya(e){if(typeof e.type=="string")return;const t=e.type.displayName||e.type.name||"the component";throw new Error(`Only native element nodes can now be passed to React DnD connectors.You can either wrap ${t} into a <div>, or turn it into a drag source or a drop target itself.`)}function Xa(e){return(t=null,r=null)=>{if(!h.isValidElement(t)){const i=t;return e(i,r),i}const s=t;return Ya(s),Qa(s,r?i=>e(i,r):e)}}function sn(e){const t={};return Object.keys(e).forEach(r=>{const s=e[r];if(r.endsWith("Ref"))t[r]=e[r];else{const a=Xa(s);t[r]=()=>a}}),t}function Tr(e,t){typeof e=="function"?e(t):e.current=t}function Qa(e,t){const r=e.ref;return W(typeof r!="string","Cannot connect React DnD to an element with an existing string ref. Please convert it to use a callback ref instead, or wrap it into a <span> or <div>. Read more: https://reactjs.org/docs/refs-and-the-dom.html#callback-refs"),r?h.cloneElement(e,{ref:s=>{Tr(r,s),Tr(t,s)}}):h.cloneElement(e,{ref:t})}class Ja{receiveHandlerId(t){this.handlerId!==t&&(this.handlerId=t,this.reconnect())}get connectTarget(){return this.dragSource}get dragSourceOptions(){return this.dragSourceOptionsInternal}set dragSourceOptions(t){this.dragSourceOptionsInternal=t}get dragPreviewOptions(){return this.dragPreviewOptionsInternal}set dragPreviewOptions(t){this.dragPreviewOptionsInternal=t}reconnect(){const t=this.reconnectDragSource();this.reconnectDragPreview(t)}reconnectDragSource(){const t=this.dragSource,r=this.didHandlerIdChange()||this.didConnectedDragSourceChange()||this.didDragSourceOptionsChange();return r&&this.disconnectDragSource(),this.handlerId?t?(r&&(this.lastConnectedHandlerId=this.handlerId,this.lastConnectedDragSource=t,this.lastConnectedDragSourceOptions=this.dragSourceOptions,this.dragSourceUnsubscribe=this.backend.connectDragSource(this.handlerId,t,this.dragSourceOptions)),r):(this.lastConnectedDragSource=t,r):r}reconnectDragPreview(t=!1){const r=this.dragPreview,s=t||this.didHandlerIdChange()||this.didConnectedDragPreviewChange()||this.didDragPreviewOptionsChange();if(s&&this.disconnectDragPreview(),!!this.handlerId){if(!r){this.lastConnectedDragPreview=r;return}s&&(this.lastConnectedHandlerId=this.handlerId,this.lastConnectedDragPreview=r,this.lastConnectedDragPreviewOptions=this.dragPreviewOptions,this.dragPreviewUnsubscribe=this.backend.connectDragPreview(this.handlerId,r,this.dragPreviewOptions))}}didHandlerIdChange(){return this.lastConnectedHandlerId!==this.handlerId}didConnectedDragSourceChange(){return this.lastConnectedDragSource!==this.dragSource}didConnectedDragPreviewChange(){return this.lastConnectedDragPreview!==this.dragPreview}didDragSourceOptionsChange(){return!Wt(this.lastConnectedDragSourceOptions,this.dragSourceOptions)}didDragPreviewOptionsChange(){return!Wt(this.lastConnectedDragPreviewOptions,this.dragPreviewOptions)}disconnectDragSource(){this.dragSourceUnsubscribe&&(this.dragSourceUnsubscribe(),this.dragSourceUnsubscribe=void 0)}disconnectDragPreview(){this.dragPreviewUnsubscribe&&(this.dragPreviewUnsubscribe(),this.dragPreviewUnsubscribe=void 0,this.dragPreviewNode=null,this.dragPreviewRef=null)}get dragSource(){return this.dragSourceNode||this.dragSourceRef&&this.dragSourceRef.current}get dragPreview(){return this.dragPreviewNode||this.dragPreviewRef&&this.dragPreviewRef.current}clearDragSource(){this.dragSourceNode=null,this.dragSourceRef=null}clearDragPreview(){this.dragPreviewNode=null,this.dragPreviewRef=null}constructor(t){this.hooks=sn({dragSource:(r,s)=>{this.clearDragSource(),this.dragSourceOptions=s||null,qt(r)?this.dragSourceRef=r:this.dragSourceNode=r,this.reconnectDragSource()},dragPreview:(r,s)=>{this.clearDragPreview(),this.dragPreviewOptions=s||null,qt(r)?this.dragPreviewRef=r:this.dragPreviewNode=r,this.reconnectDragPreview()}}),this.handlerId=null,this.dragSourceRef=null,this.dragSourceOptionsInternal=null,this.dragPreviewRef=null,this.dragPreviewOptionsInternal=null,this.lastConnectedHandlerId=null,this.lastConnectedDragSource=null,this.lastConnectedDragSourceOptions=null,this.lastConnectedDragPreview=null,this.lastConnectedDragPreviewOptions=null,this.backend=t}}class ei{get connectTarget(){return this.dropTarget}reconnect(){const t=this.didHandlerIdChange()||this.didDropTargetChange()||this.didOptionsChange();t&&this.disconnectDropTarget();const r=this.dropTarget;if(this.handlerId){if(!r){this.lastConnectedDropTarget=r;return}t&&(this.lastConnectedHandlerId=this.handlerId,this.lastConnectedDropTarget=r,this.lastConnectedDropTargetOptions=this.dropTargetOptions,this.unsubscribeDropTarget=this.backend.connectDropTarget(this.handlerId,r,this.dropTargetOptions))}}receiveHandlerId(t){t!==this.handlerId&&(this.handlerId=t,this.reconnect())}get dropTargetOptions(){return this.dropTargetOptionsInternal}set dropTargetOptions(t){this.dropTargetOptionsInternal=t}didHandlerIdChange(){return this.lastConnectedHandlerId!==this.handlerId}didDropTargetChange(){return this.lastConnectedDropTarget!==this.dropTarget}didOptionsChange(){return!Wt(this.lastConnectedDropTargetOptions,this.dropTargetOptions)}disconnectDropTarget(){this.unsubscribeDropTarget&&(this.unsubscribeDropTarget(),this.unsubscribeDropTarget=void 0)}get dropTarget(){return this.dropTargetNode||this.dropTargetRef&&this.dropTargetRef.current}clearDropTarget(){this.dropTargetRef=null,this.dropTargetNode=null}constructor(t){this.hooks=sn({dropTarget:(r,s)=>{this.clearDropTarget(),this.dropTargetOptions=s,qt(r)?this.dropTargetRef=r:this.dropTargetNode=r,this.reconnect()}}),this.handlerId=null,this.dropTargetRef=null,this.dropTargetOptionsInternal=null,this.lastConnectedHandlerId=null,this.lastConnectedDropTarget=null,this.lastConnectedDropTargetOptions=null,this.backend=t}}function Xe(){const{dragDropManager:e}=h.useContext(qr);return W(e!=null,"Expected drag drop context"),e}function ti(e,t){const r=Xe(),s=h.useMemo(()=>new Ja(r.getBackend()),[r]);return Ve(()=>(s.dragSourceOptions=e||null,s.reconnect(),()=>s.disconnectDragSource()),[s,e]),Ve(()=>(s.dragPreviewOptions=t||null,s.reconnect(),()=>s.disconnectDragPreview()),[s,t]),s}function ri(){const e=Xe();return h.useMemo(()=>new Ka(e),[e])}class ni{beginDrag(){const t=this.spec,r=this.monitor;let s=null;return typeof t.item=="object"?s=t.item:typeof t.item=="function"?s=t.item(r):s={},s??null}canDrag(){const t=this.spec,r=this.monitor;return typeof t.canDrag=="boolean"?t.canDrag:typeof t.canDrag=="function"?t.canDrag(r):!0}isDragging(t,r){const s=this.spec,a=this.monitor,{isDragging:i}=s;return i?i(a):r===t.getSourceId()}endDrag(){const t=this.spec,r=this.monitor,s=this.connector,{end:a}=t;a&&a(r.getItem(),r),s.reconnect()}constructor(t,r,s){this.spec=t,this.monitor=r,this.connector=s}}function si(e,t,r){const s=h.useMemo(()=>new ni(e,t,r),[t,r]);return h.useEffect(()=>{s.spec=e},[e]),s}function ai(e){return h.useMemo(()=>{const t=e.type;return W(t!=null,"spec.type must be defined"),t},[e])}function ii(e,t,r){const s=Xe(),a=si(e,t,r),i=ai(e);Ve(function(){if(i!=null){const[l,c]=Za(i,a,s);return t.receiveHandlerId(l),r.receiveHandlerId(l),c}},[s,t,r,a,i])}function oi(e,t){const r=nn(e,t);W(!r.begin,"useDrag::spec.begin was deprecated in v14. Replace spec.begin() with spec.item(). (see more here - https://react-dnd.github.io/react-dnd/docs/api/use-drag)");const s=ri(),a=ti(r.options,r.previewOptions);return ii(r,s,a),[rn(r.collect,s,a),Ga(a),Ua(a)]}function li(e){return h.useMemo(()=>e.hooks.dropTarget(),[e])}function ci(e){const t=Xe(),r=h.useMemo(()=>new ei(t.getBackend()),[t]);return Ve(()=>(r.dropTargetOptions=e||null,r.reconnect(),()=>r.disconnectDropTarget()),[e]),r}function di(){const e=Xe();return h.useMemo(()=>new Wa(e),[e])}function ui(e){const{accept:t}=e;return h.useMemo(()=>(W(e.accept!=null,"accept must be defined"),Array.isArray(t)?t:[t]),[t])}class fi{canDrop(){const t=this.spec,r=this.monitor;return t.canDrop?t.canDrop(r.getItem(),r):!0}hover(){const t=this.spec,r=this.monitor;t.hover&&t.hover(r.getItem(),r)}drop(){const t=this.spec,r=this.monitor;if(t.drop)return t.drop(r.getItem(),r)}constructor(t,r){this.spec=t,this.monitor=r}}function pi(e,t){const r=h.useMemo(()=>new fi(e,t),[t]);return h.useEffect(()=>{r.spec=e},[e]),r}function gi(e,t,r){const s=Xe(),a=pi(e,t),i=ui(e);Ve(function(){const[l,c]=qa(i,a,s);return t.receiveHandlerId(l),r.receiveHandlerId(l),c},[s,t,a,r,i.map(o=>o.toString()).join("|")])}function or(e,t){const r=nn(e,t),s=di(),a=ci(r.options);return gi(r,s,a),[rn(r.collect,s,a),li(a)]}const wr="column",hi="flex items-center",mi="mr-3 cursor-move text-secondary",xi=({id:e,children:t,className:r,onFind:s,onMove:a,ariaLabel:i="Drag item"})=>{const o=h.useRef(null),l=h.useRef(null),c=typeof s=="function"?s(e):-1,[{isDragging:d},u,f]=oi(()=>({type:wr,item:{id:e,originalIndex:c},collect:p=>{const m=p.getItem();return{isDragging:p.isDragging()&&m?.id===e}},end:(p,m)=>{if(!p)return;!m.didDrop()&&typeof a=="function"&&p.originalIndex>-1&&a(p.id,p.originalIndex)}}),[e,c,a]),[,g]=or(()=>({accept:wr,hover:p=>{if(!(!p||p.id===e)&&typeof s=="function"&&typeof a=="function"){const m=s(e);a(p.id,m)}}}),[s,a,e]);return f(g(l)),u(o),n.jsxs("div",{ref:l,className:I.mergeClasses(hi,r),style:{opacity:d?0:1},"aria-roledescription":"Draggable item",children:[n.jsx("div",{ref:o,className:mi,"aria-label":i,children:n.jsx(H.IconGripVertical,{...V.BASE_ICON_PROPS})}),t]})},It=({iconClassName:e,label:t,...r})=>t?n.jsx(x.DialDangerButton,{...r,label:t,appearance:T.ButtonAppearance.Ghost,iconBefore:n.jsx(H.IconTrashX,{...V.BASE_ICON_PROPS,className:e||""})}):n.jsx(F.DialDangerIconButton,{...r,appearance:T.ButtonAppearance.Ghost,icon:n.jsx(H.IconTrashX,{...V.BASE_ICON_PROPS,className:e||""})}),bi=({className:e="",value:t,onChange:r,error:s,containerClassName:a,resize:i=!1,labelProps:o,caption:l,id:c,...d})=>{const u=I.mergeClasses("dial-textarea dial-input px-3 py-2",d.invalid&&"dial-input-error",d.disabled&&"dial-input-disable",i?"resize":"resize-none",e);return n.jsxs("div",{className:I.mergeClasses("flex flex-col gap-y-1",a),children:[o&&n.jsx(Ae.DialLabel,{...o,htmlFor:c}),n.jsx("textarea",{id:c,value:t||"",className:u,onChange:f=>r?.(f.currentTarget.value),...d}),n.jsx(x.DialErrorText,{text:s}),!s&&n.jsx(x.DialCaptionText,{text:l})]})},vi="inline-flex items-center rounded bg-layer-3",yi="flex flex-1 items-center justify-center gap-2 h-7 px-3 py-1 border border-primary dial-small-text whitespace-nowrap focus-visible:outline outline-offset-0 focus-visible:relative focus-visible:z-10",Di="relative z-10 bg-controls-accent-primary-alpha-active text-primary",Ci="text-secondary hover:text-primary",Ni="text-controls-disable-accent cursor-not-allowed hover:text-controls-disable-accent",Ii=({options:e,value:t,onChange:r,disabled:s,className:a,ariaLabel:i})=>{const o=h.useCallback(l=>{if(s)return;const c=e.filter(g=>!g.disabled);if(c.length===0)return;const d=c.findIndex(g=>g.value===t);let u=null;switch(l.key){case"ArrowRight":case"ArrowDown":u=(d+1)%c.length;break;case"ArrowLeft":case"ArrowUp":u=(d-1+c.length)%c.length;break;case"Home":u=0;break;case"End":u=c.length-1;break;default:return}l.preventDefault();const f=c[u];f&&f.value!==t&&r(f.value)},[s,e,t,r]);return n.jsx("div",{role:"tablist","aria-label":i,className:I.mergeClasses(vi,a),children:e.map((l,c)=>{const d=l.value===t,u=c===0,f=c===e.length-1,g=s||l.disabled;return n.jsxs("button",{type:"button",role:"tab","aria-selected":d,tabIndex:d?0:-1,disabled:g,onClick:()=>r(l.value),onKeyDown:o,className:I.mergeClasses(yi,!f&&"-mr-px",u&&"rounded-l",f&&"rounded-r",d?Di:Ci,g&&Ni),children:[l.icon,l.label]},l.value)})})},Mt=8,Si=24,an=({initialTags:e=[],label:t,required:r,elementId:s,placeholder:a,captionDescription:i,errorText:o,invalid:l,disabled:c,collapseTagOverflow:d=!1,readOnly:u=!1,containerClassName:f,tagClassName:g,onChange:p})=>{const m=h.useRef(null),y=h.useRef([]),b=h.useRef(null),[v,C]=h.useState(e),[N,S]=h.useState(""),[D,w]=h.useState(!1),[R,_]=h.useState(e.length),O=h.useCallback(k=>z=>{y.current[k]=z},[]),A=h.useCallback(()=>{if(!d)return;const k=m.current;if(!k)return;const z=k.offsetWidth;if(z===0)return;const q=b.current?.offsetWidth??0,ie=z-(u?0:Si)-Mt;let ne=0,K=0;for(let re=0;re<v.length;re++){const de=y.current[re];if(!de)continue;const ue=de.offsetWidth+Mt;if(ne+ue>ie)break;ne+=ue,K++}if(K<v.length&&K>0)for(;ne+q>ie&&K>0;){K--;const re=y.current[K]?.offsetWidth??0;ne-=re+Mt}_(K)},[d,u,v.length]),j=k=>{const z=k.trim().replace(/,$/,"");if(z&&!v.includes(z)){const q=[z,...v];C(q),p?.(q)}},P=k=>{(k.key===","||k.key==="Enter")&&(k.preventDefault(),j(N),S(""))},B=()=>{N.trim()&&(j(N),S(""))},G=k=>{const z=v.filter((q,X)=>X!==k);C(z),p?.(z)},ee=()=>o?n.jsx(x.DialErrorText,{text:o}):i?n.jsx(x.DialCaptionText,{text:i}):null;h.useEffect(()=>{if(d)return;const k=new ResizeObserver(()=>{if(m.current){const z=m.current.scrollHeight>m.current.clientHeight+10;w(z)}});return m.current&&k.observe(m.current),()=>k.disconnect()},[v,d]),h.useEffect(()=>{if(!d){_(v.length);return}_(v.length);const k=new ResizeObserver(()=>{A()}),z=m.current;return z&&k.observe(z),A(),()=>k.disconnect()},[d,A,v]),h.useEffect(()=>{C(e)},[JSON.stringify(e)]);const $=n.jsxs("div",{ref:m,className:se("flex gap-2 items-center relative",d?"flex-nowrap overflow-hidden w-full min-w-0":se("flex-wrap",D?"flex-col-reverse":"flex-row"),f),children:[(d?v.slice(0,R):v).map((k,z)=>n.jsx(He,{label:k,className:g,closable:!c&&!u,onRemove:!c&&!u?()=>G(z):void 0},k+z)),d&&R<v.length&&n.jsx(T.DialTooltip,{tooltip:v.slice(R).join(", "),triggerClassName:"inline-flex shrink-0 cursor-pointer",children:n.jsx(He,{label:`+${v.length-R}`})}),!u&&n.jsx("input",{id:s,type:"text",value:N,onChange:k=>S(k.target.value),onKeyDown:P,onBlur:B,className:se("dial-input outline-none !border-none w-full flex-1 !p-1 !h-auto",d?"min-w-0":"min-w-[100px]"),placeholder:a??"",disabled:c}),d&&n.jsxs("div",{className:"absolute left-0 top-0 invisible pointer-events-none h-0 overflow-hidden whitespace-nowrap","aria-hidden":!0,children:[v.map((k,z)=>n.jsx("div",{ref:O(z),className:"inline-flex shrink-0",children:n.jsx(He,{label:k,className:g,closable:!c&&!u,onRemove:!c&&!u?()=>G(z):void 0})},`measure-${k}-${z}`)),n.jsx("div",{ref:b,className:"inline-flex shrink-0",children:n.jsx(He,{label:`+${v.length}`})})]})]});return u?$:n.jsxs("div",{className:"flex flex-col gap-2 w-full",children:[n.jsx(Ae.DialLabel,{label:t,required:r,htmlFor:s}),n.jsx("div",{className:se("dial-input min-h-[38px] p-[6px]",l&&"dial-input-error",c&&"dial-input-disable"),children:$}),ee()]})},on=({selectedItems:e,placeholder:t,collapseTagOverflow:r=!1,listClassName:s,listElementClassName:a})=>e?.length?n.jsx(an,{readOnly:!0,initialTags:e,collapseTagOverflow:r,containerClassName:s,tagClassName:a}):t?n.jsx("span",{className:"text-secondary",children:t}):null,Ft=e=>gr.createElement("svg",{width:18,height:18,viewBox:"0 0 18 18",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},gr.createElement("path",{d:"M2.25 13.5V12C2.25 11.5858 2.58579 11.25 3 11.25C3.41421 11.25 3.75 11.5858 3.75 12V13.5C3.75 13.6989 3.82907 13.8896 3.96973 14.0303C4.11038 14.1709 4.30109 14.25 4.5 14.25H6C6.41421 14.25 6.75 14.5858 6.75 15C6.75 15.4142 6.41421 15.75 6 15.75H4.5C3.90326 15.75 3.33114 15.5128 2.90918 15.0908C2.48722 14.6689 2.25 14.0967 2.25 13.5ZM14.25 6V4.5C14.25 4.30109 14.1709 4.11038 14.0303 3.96973C13.8896 3.82907 13.6989 3.75 13.5 3.75H12C11.5858 3.75 11.25 3.41421 11.25 3C11.25 2.58579 11.5858 2.25 12 2.25H13.5C14.0967 2.25 14.6689 2.48722 15.0908 2.90918C15.5128 3.33114 15.75 3.90326 15.75 4.5V6C15.75 6.41421 15.4142 6.75 15 6.75C14.5858 6.75 14.25 6.41421 14.25 6Z",fill:"currentColor"})),ln=({children:e,open:t,disabled:r=!1,selectedValue:s,valueClassName:a,inputClassName:i,onOpen:o,elementId:l,errorText:c,invalid:d,emptyValueText:u,placeholder:f,editable:g=!1,onValueChange:p,collapseTagOverflow:m=!1,iconBefore:y})=>{const b=Array.isArray(s)&&s.length>0,v=typeof s=="string"&&!!s.trim(),C=b||v?s:f?void 0:u,N=r?void 0:o,S=h.useCallback(_=>{p?.(_.target.value)},[p]),D=()=>n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:se("dial-input px-3 py-2 dial-input-field flex flex-row items-center gap-x-2 w-full justify-between",i,r&&"dial-input-disable",(c||d)&&"dial-input-error"),children:[n.jsxs("div",{className:"flex flex-row items-center gap-x-2 flex-1 min-w-0",children:[y&&n.jsx(F.DialIcon,{icon:y}),n.jsx("input",{type:"text",className:se("flex-1 min-w-0 bg-transparent outline-none border-none p-0 dial-small-text text-primary placeholder:text-secondary",a),value:typeof s=="string"?s:"",placeholder:f||u,onChange:S,disabled:r,id:l,"aria-label":"input-popup-field"})]}),!r&&n.jsx("button",{type:"button",className:"shrink-0 cursor-pointer bg-transparent border-none p-0 ml-1",onClick:o,"aria-label":"open-popup",children:n.jsx(F.DialIcon,{icon:n.jsx(Ft,{role:"img",width:V.BASE_ICON_SIZE,height:V.BASE_ICON_SIZE})})})]}),n.jsx(x.DialErrorText,{text:c})]}),w=()=>n.jsxs(n.Fragment,{children:[n.jsx("button",{type:"button",className:"w-full",onClick:N,"aria-label":"open-popup",id:l,children:n.jsxs("div",{className:se("dial-input px-3 py-2 dial-input-field flex flex-row items-center gap-x-2 w-full justify-between cursor-pointer",i,r&&"dial-input-disable",(c||d)&&"dial-input-error"),children:[n.jsxs("div",{className:"flex flex-row items-center gap-x-2 flex-1 min-w-0",children:[y&&n.jsx(F.DialIcon,{icon:y}),n.jsx(T.DialTooltip,{tooltip:C==null?void 0:String(C),children:C||!f?n.jsx("span",{className:a,children:C}):n.jsx("span",{className:"text-secondary",children:f})})]}),!r&&n.jsx("div",{className:"shrink-0",children:n.jsx(F.DialIcon,{icon:n.jsx(Ft,{role:"img",width:V.BASE_ICON_SIZE,height:V.BASE_ICON_SIZE})})})]})}),n.jsx(x.DialErrorText,{text:c})]}),R=()=>n.jsx("div",{className:"w-full",onClick:N,children:n.jsxs("div",{className:se("dial-input px-3 py-2 flex flex-row items-center gap-x-2 w-full justify-between cursor-pointer",r&&"dial-input-disable"),children:[n.jsxs("div",{className:"flex flex-row items-center gap-x-2 flex-1 min-w-0",children:[y&&n.jsx(F.DialIcon,{icon:y}),n.jsx(on,{placeholder:f,selectedItems:C,collapseTagOverflow:m})]}),!r&&n.jsx("div",{className:"ml-1",children:n.jsx(F.DialIcon,{icon:n.jsx(Ft,{role:"img",width:V.BASE_ICON_SIZE,height:V.BASE_ICON_SIZE})})})]})});return n.jsxs(n.Fragment,{children:[b?R():g?D():w(),t&&Kn.createPortal(e,document.body)]})},ji=({label:e,htmlFor:t,disabled:r,selectedValue:s,radioButtons:a,customInputValue:i,valueClassName:o,inputClassName:l,emptyValueText:c,placeholder:d,onClose:u,header:f,portalId:g,onApply:p,onCancel:m,cancelButtonTitle:y="Cancel",applyButtonTitle:b="Apply",isValid:v,selectedRadioValue:C,onChangeRadioField:N,id:S,size:D=x.PopupSize.Md})=>{const[w,R]=h.useState(!1),_=h.useCallback(()=>{r||R(!0)},[r]),O=h.useCallback(()=>{R(!1),u?.()},[u]),A=h.useCallback(()=>{m?.(),O()},[m,O]),j=h.useCallback(()=>{p(),O()},[p,O]);return n.jsxs("div",{className:"flex flex-col gap-1",children:[n.jsx(Ae.DialLabel,{label:e,htmlFor:t}),n.jsx(ln,{disabled:r,open:w,selectedValue:i??a.find(P=>P.id===s)?.name,valueClassName:o,inputClassName:se(l,"py-2","px-3"),emptyValueText:c,placeholder:d,onOpen:_,children:n.jsx(x.DialPopup,{open:w,onClose:A,header:f,portalId:g,size:D,footer:n.jsxs("div",{className:"flex flex-row items-center justify-end gap-2 px-6 py-4",children:[n.jsx(x.DialNeutralButton,{label:y,onClick:A}),n.jsx(x.DialPrimaryButton,{label:b,onClick:j,disabled:!v})]}),children:n.jsx("div",{className:"px-6 py-4",children:n.jsx(x.DialRadioGroup,{radioButtons:a,labelClassName:"dial-small-text",activeRadioButton:C,onChange:N,elementId:S,orientation:x.RadioGroupOrientation.Column})})})})]})},Ti="Create",wi="Cancel",Ei="flex items-center justify-end gap-2 px-6 py-3",Oi=({header:e,open:t=!1,submitLabel:r=Ti,cancelLabel:s=wi,isLoading:a=!1,disableSubmitButton:i=!1,className:o,submitClassName:l,onClose:c,onSubmit:d,onCancel:u,children:f,dividers:g=!0,size:p=x.PopupSize.Md,footer:m})=>{const y=a?null:n.jsxs("div",{className:Ei,children:[n.jsx(x.DialNeutralButton,{label:s,onClick:()=>u?u():c?.()}),n.jsx(x.DialPrimaryButton,{className:l,label:r,disabled:i,onClick:()=>d()})]}),b=h.useCallback(()=>a?n.jsx("div",{className:"px-6 py-4 h-[120px]",children:n.jsx(x.DialLoader,{size:50})}):f??null,[f,a]);return n.jsx(x.DialPopup,{open:t,header:e,className:o,dividers:g,onClose:()=>c?.(),footer:m??y,size:p,children:b()})},Ai=/^0+\.(\d+)?$/,_i=/^0+/,Zt=({integer:e,onChange:t,min:r,max:s,onKeyDown:a,onPaste:i,...o})=>{const l=u=>!u||u==="-"?u:String(u)?.match(Ai)?String(u)?.replace(_i,"0"):Number(u),c=u=>{if([".","-","+","e","E"].includes(u.key)){u.preventDefault();return}x.handleKeyDown(u,"number",r,s)},d=u=>{const f=u.clipboardData.getData("text"),g=f.replace(/\D/g,"");if(g!==f&&(u.preventDefault(),g)){const p=u.currentTarget,m=p.selectionStart??0,y=p.selectionEnd??0,b=p.value.slice(0,m)+g+p.value.slice(y);t?.(l(b))}};return n.jsx(x.DialInput,{type:"number",min:r,max:s,onChange:u=>t?.(l(u)),onKeyDown:e?c:a,onPaste:e?d:i,...o})},Ri=({onClick:e})=>n.jsx(H.IconEyeOff,{...V.BASE_ICON_PROPS,className:"text-primary",onClick:e,role:"button","aria-label":"hide"}),ki=({onClick:e})=>n.jsx(H.IconEye,{...V.BASE_ICON_PROPS,className:"text-primary",onClick:e,role:"button","aria-label":"show"}),cn=({...e})=>{const[t,r]=h.useState(!1),s=h.useCallback(a=>{r(a)},[]);return n.jsx(x.DialInput,{type:t?"text":"password",...e,iconAfter:e.disabled?null:t?n.jsx(Ri,{onClick:()=>s(!1)}):n.jsx(ki,{onClick:()=>s(!0)})})},dn=({options:e,selectedValues:t,handleRemoveTag:r})=>n.jsx("div",{className:"flex flex-wrap w-full items-center gap-1",children:t.map(s=>{const a=e.find(o=>o.value===s)?.label??s,i=e.find(o=>o.value===s)?.icon;return n.jsx(He,{label:a,onRemove:o=>r?.(o,s),icon:i?n.jsx(F.DialIcon,{icon:i}):null,className:"max-w-full"},s)})});var ht=(e=>(e.Sm="sm",e.Md="md",e))(ht||{}),mt=(e=>(e.Primary="Primary",e.Secondary="Secondary",e))(mt||{});const Pi="dial-input flex w-full items-center justify-between gap-2 dial-small-text cursor-pointer",Li="w-full rounded flex flex-col",nt="flex w-full items-center justify-between gap-2 px-3 h-[34px] dial-small-text text-primary truncate hover:bg-accent-primary-alpha focus:bg-accent-primary-alpha focus:outline-none",Mi="bg-accent-primary-alpha",Yt="bg-accent-primary-alpha border-l border-accent-primary border-1",xt="opacity-75",Fi=352,Bi=4,zi=n.jsx(H.IconChevronDown,{size:V.DIAL_ICON_SIZE.SM}),$i=({opt:e,selectedValues:t,onSelect:r})=>{const{isOpen:s,refs:a,floatingStyles:i,context:o,getReferenceProps:l,getFloatingProps:c}=F.useSubMenuFloating(Bi,"listbox",!!e.disabled),d=e.children?.some(u=>t.includes(u.value));return n.jsxs(n.Fragment,{children:[n.jsxs("button",{ref:a.setReference,type:"button",role:"option","aria-haspopup":"listbox","aria-expanded":s,"aria-selected":!!d,"aria-disabled":!!e.disabled,disabled:e.disabled,className:se(nt,d&&Yt,e.disabled&&xt),...l(),children:[n.jsxs("div",{className:"flex items-center gap-2 w-full min-w-0",children:[e.icon&&n.jsx(F.DialIcon,{icon:e.icon}),n.jsx(F.DialEllipsisTooltip,{text:e.labelNode??e.label})]}),n.jsx(H.IconChevronRight,{size:14,className:"shrink-0"})]}),s&&n.jsx(F.SubMenuPanel,{refs:a,floatingStyles:i,context:o,getFloatingProps:c,role:"listbox",className:"w-max py-1",children:e.children.map(u=>{const f=t.includes(u.value);return n.jsx("button",{type:"button",role:"option","aria-selected":f,"aria-disabled":!!u.disabled,disabled:u.disabled,className:se(nt,f&&Yt,u.disabled&&xt),onClick:()=>!u.disabled&&r(u.value),children:n.jsxs("div",{className:"flex items-center gap-2 w-full",children:[u.icon&&n.jsx(F.DialIcon,{icon:u.icon}),n.jsx(F.DialEllipsisTooltip,{text:u.labelNode??u.label})]})},u.value)})})]})},ke=({options:e,multiple:t=!1,elementId:r,value:s,defaultValue:a,variant:i=mt.Primary,size:o=ht.Md,prefix:l,customSelectedValue:c,placeholder:d="Select...",searchable:u=!1,searchSize:f=T.ElementSize.Standard,searchPlaceholder:g,selectAll:p=!1,invalid:m,selectAllLabel:y="Select all",emptyStateTitle:b="No options available",emptyStateDescription:v,emptyStateIcon:C,disabled:N=!1,className:S,listClassName:D,closable:w=!1,header:R,footer:_,onClose:O,onChange:A,inlineSearch:j=!1,dismissRef:P,onFooterClick:B,open:G,onOpenChange:ee,onInlineQueryChange:$,customMultiSelectTagsRenderer:k})=>{const z=h.useId(),[q,X]=h.useState(!1),ie=G!==void 0,ne=ie?!!G:q,K=h.useCallback(E=>{ie||X(E),ee?.(E)},[ie,ee]),[re,de]=h.useState(j&&c||""),ue=h.useRef(null),ce=h.useCallback(E=>{E!==re&&(de(E||""),$?.(E||""))},[$,re]),pe=s!==void 0,[ge,fe]=h.useState(a),U=pe?s:ge,Y=h.useMemo(()=>t?Array.isArray(U)?U:[]:typeof U=="string"?[U]:[],[U,t]),Ne=h.useMemo(()=>{const E=re.trim().toLowerCase();return E?e.filter(Q=>Q.label.toLowerCase().includes(E)):e},[e,re]);h.useEffect(()=>{!ne&&!j&&ce("")},[j,ne,ce]);const Me=h.useRef(c);h.useEffect(()=>{j&&c!==Me.current&&(ne||(Me.current=c,ce(c||"")))},[c,j,ne,ce]);const he=h.useCallback(E=>{pe||fe(E),A?.(E)},[pe,A]),Fe=h.useCallback(E=>{if(t){const Q=new Set(Y);Q.has(E)?Q.delete(E):Q.add(E),he(Array.from(Q));return}if(he(E),j){const Q=e.find(xe=>xe.value===E)??e.flatMap(xe=>xe.children??[]).find(xe=>xe.value===E);Q&&ce(Q.label)}K(!1)},[t,he,j,K,Y,e,ce]),je=h.useCallback((E,Q)=>{if(E.stopPropagation(),!t){he("");return}const xe=Y.filter(Et=>Et!==Q);he(xe)},[t,Y,he]),te=h.useMemo(()=>Ne.filter(E=>!E.disabled),[Ne]),_e=h.useMemo(()=>te.filter(E=>Y.includes(E.value)).length,[te,Y]),Ie=h.useCallback(E=>{j&&!t&&!E&&Fe(re),K(E)},[Fe,j,t,re,K]),{allSelectedInFiltered:Be,someSelectedInFiltered:tt}=h.useMemo(()=>{const E=te.length>0&&_e===te.length;return{allSelectedInFiltered:E,someSelectedInFiltered:_e>0&&!E}},[te,_e]),ye=h.useCallback(()=>{if(!(!t||te.length===0))if(Be){const E=new Set(te.map(Q=>Q.value));he(Y.filter(Q=>!E.has(Q)))}else{const E=new Set(Y);te.forEach(Q=>E.add(Q.value)),he(Array.from(E))}},[Be,t,te,Y,he]),ze=Y.length>0;h.useEffect(()=>{ne&&j&&!t&&!N&&requestAnimationFrame(()=>{const E=ue.current;if(!E)return;E.focus();const Q=E.value?.length??0;E.setSelectionRange?.(Q,Q)})},[ne,j,t,N]);const Re=!t&&ze?Y[0]:void 0,me=h.useMemo(()=>Re?e.find(E=>E.value===Re)??e.flatMap(E=>E.children??[]).find(E=>E.value===Re):void 0,[e,Re]),wt=h.useCallback(()=>t?ze?k?.(e,Y,je)||n.jsx(dn,{options:e,selectedValues:Y,handleRemoveTag:je}):n.jsx("span",{className:"text-secondary truncate",children:d}):me?n.jsxs(n.Fragment,{children:[me.icon&&n.jsx(F.DialIcon,{icon:me.icon}),n.jsx(F.DialEllipsisTooltip,{text:me.labelNode??(l?`${l} ${me.label}`:me.label)}),me?.description&&n.jsx("div",{className:"text-secondary dial-small-text",children:me.description})]}):c&&s?c:n.jsx("span",{className:"text-secondary truncate",children:d}),[ze,t,c,l,s,d,me,e,Y,je,k]);h.useImperativeHandle(P,()=>({dismiss:()=>{K(!1)}}));const Te=h.useCallback(()=>{ce(Y.length===1?me?.label??re:"")},[re,Y.length,ce,me?.label]),$e=h.useCallback(()=>{N||(K(!ne),j&&!t&&(Te(),ue.current?.focus()))},[N,j,ne,t,Te,K]);return n.jsx(F.DialDropdown,{open:ne,onOpenChange:Ie,disabled:N,closable:w,onClose:O,placement:"bottom-start",allowedPlacements:["bottom-start","top-start"],maxDropdownHeight:u?null:Fi,listClassName:D,renderOverlay:()=>n.jsxs("div",{id:`list-${r||z}`,role:"listbox","aria-multiselectable":t||void 0,className:Li,children:[R&&n.jsx(n.Fragment,{children:typeof R=="function"?R():R}),(u||w)&&e.length>8&&n.jsxs("div",{className:"flex items-center gap-2 px-2 pt-2",children:[u&&n.jsx(x.DialSearch,{size:f,placeholder:g,onChange:ce,value:re,id:`search-${r||z}`,containerClassName:I.mergeClasses(x.SIZE_CONFIG[f].containerClassName,"w-full")}),w&&n.jsx(x.DialButton,{"aria-label":"Close select",className:"shrink-0",iconBefore:n.jsx(H.IconX,{size:V.DIAL_ICON_SIZE.SM}),onClick:E=>{O?.(E),K(!1)}})]}),t&&p&&te.length>0&&n.jsx("div",{className:se(nt,"mt-2"),children:n.jsx(Gt,{id:`${r||z}-selectAll`,label:y,checked:Be,indeterminate:tt,onChange:ye,ariaLabel:y})}),n.jsx("div",{className:se("overflow-y-auto max-h-[352px]",j&&Ne.length===0?"":"py-1"),children:Ne.length===0?!j&&n.jsx("div",{className:"px-2 py-3",children:n.jsx(F.DialNoDataContent,{icon:C??n.jsx(H.IconClipboardX,{size:V.DIAL_ICON_SIZE.LG,stroke:.5}),title:b,description:v})}):Ne.map(E=>{const Q=Y.includes(E.value);return t?n.jsxs("div",{role:"option","aria-selected":Q,"aria-disabled":!!E.disabled,className:se(nt,Q&&Mi,E.disabled&&xt,"w-full"),children:[n.jsx(Gt,{id:`${r||z}-${E.value}`,label:n.jsxs("span",{className:"flex w-full flex-1 pl-2 min-w-0 items-center gap-2 text-primary",children:[E.icon&&n.jsx(F.DialIcon,{icon:E.icon}),n.jsx("span",{className:"truncate",children:E.labelNode??E.label})]}),checked:Q,disabled:E.disabled,onChange:()=>!E.disabled&&Fe(E.value),ariaLabel:E.label}),E.description&&n.jsx("div",{className:"text-secondary dial-small-text",children:E.description})]},E.value):E.children?.length?n.jsx($i,{opt:E,selectedValues:Y,onSelect:Fe},E.value):n.jsx("button",{role:"option",type:"button","aria-selected":Q,"aria-disabled":!!E.disabled,disabled:E.disabled,className:se(nt,Q&&Yt,E.disabled&&xt),onClick:()=>!E.disabled&&Fe(E.value),children:n.jsxs("div",{className:"flex items-center gap-2 w-full",children:[E.icon&&n.jsx(F.DialIcon,{icon:E.icon}),n.jsx(F.DialEllipsisTooltip,{text:E.labelNode??E.label}),E.description&&n.jsx("div",{className:"text-secondary dial-small-text",children:E.description})]})},E.value)})}),_&&n.jsx("div",{onClick:E=>{B?.(E),B&&K(!1)},children:typeof _=="function"?_():_})]}),children:n.jsxs("div",{role:"button",tabIndex:0,"aria-roledescription":"button to open select list","aria-haspopup":"listbox","aria-expanded":ne,"aria-controls":`list-${r||z}`,className:I.mergeClasses(Pi,N&&"opacity-75 !cursor-not-allowed !border-primary",o===ht.Sm?"min-h-[25px] px-1.5 py-1":"min-h-[38px] px-3 py-2",m&&"dial-input-error",i===mt.Secondary?"!bg-layer-4 !h-auto":"",S),onMouseDown:E=>{N||j&&!t&&(Te(),E.preventDefault())},onClick:()=>{$e()},onKeyDown:E=>{(E.key===" "||E.code==="Space")&&(E.preventDefault(),$e())},children:[j&&!t?n.jsx("div",{className:"flex min-w-0 items-center gap-2 text-primary flex-1",children:n.jsx("input",{id:`inline-${r||z}`,type:"text",placeholder:g??d,value:re||"",onChange:E=>ce(E.currentTarget.value.trimStart()),onFocus:()=>!N&&K(!0),onMouseDown:E=>{Te(),E.stopPropagation()},onClick:E=>{E.stopPropagation()},onKeyDown:E=>{E.stopPropagation()},className:"bg-transparent outline-none w-full dial-small-text",ref:ue,disabled:N,"aria-disabled":N,autoComplete:"off"})}):n.jsx("div",{className:"flex w-full min-w-0 items-center gap-2 text-primary",children:wt()}),!j&&n.jsx(F.DialIcon,{icon:zi,className:se("text-primary",ne&&"rotate-180")})]})})},Hi=({label:e,required:t,captionDescription:r,containerClassName:s,selectClassName:a,error:i,id:o,caption:l,readonly:c,value:d,defaultEmptyText:u,...f})=>{const g=h.useCallback(()=>{if(!d||Array.isArray(d)&&d.length===0)return u??"None";if(Array.isArray(d))return n.jsx(dn,{options:f.options,selectedValues:d});{const p=f.options?.find(m=>m.value===d);return n.jsx("span",{"aria-readonly":!0,className:"text-primary",children:p?.label||d})}},[d,f.options,u]);return n.jsx(x.DialFormItem,{id:o,label:e,required:t,description:l,error:i,captionDescription:r,className:s,readonly:c,value:g(),defaultEmptyText:u,children:n.jsx(ke,{className:a,value:d,elementId:o,invalid:!!i,...f})})};function un(e){let t=null;return()=>(t==null&&(t=e()),t)}function Vi(e,t){return e.filter(r=>r!==t)}function Gi(e,t){const r=new Set,s=i=>r.add(i);e.forEach(s),t.forEach(s);const a=[];return r.forEach(i=>a.push(i)),a}class Ui{enter(t){const r=this.entered.length,s=a=>this.isNodeInDocument(a)&&(!a.contains||a.contains(t));return this.entered=Gi(this.entered.filter(s),[t]),r===0&&this.entered.length>0}leave(t){const r=this.entered.length;return this.entered=Vi(this.entered.filter(this.isNodeInDocument),t),r>0&&this.entered.length===0}reset(){this.entered=[]}constructor(t){this.entered=[],this.isNodeInDocument=t}}class Ki{initializeExposedProperties(){Object.keys(this.config.exposeProperties).forEach(t=>{Object.defineProperty(this.item,t,{configurable:!0,enumerable:!0,get(){return console.warn(`Browser doesn't allow reading "${t}" until the drop event.`),null}})})}loadDataTransfer(t){if(t){const r={};Object.keys(this.config.exposeProperties).forEach(s=>{const a=this.config.exposeProperties[s];a!=null&&(r[s]={value:a(t,this.config.matchesTypes),configurable:!0,enumerable:!0})}),Object.defineProperties(this.item,r)}}canDrag(){return!0}beginDrag(){return this.item}isDragging(t,r){return r===t.getSourceId()}endDrag(){}constructor(t){this.config=t,this.item={},this.initializeExposedProperties()}}const St="__NATIVE_FILE__",fn="__NATIVE_URL__",pn="__NATIVE_TEXT__",gn="__NATIVE_HTML__",Er=Object.freeze(Object.defineProperty({__proto__:null,FILE:St,HTML:gn,TEXT:pn,URL:fn},Symbol.toStringTag,{value:"Module"}));function Bt(e,t,r){const s=t.reduce((a,i)=>a||e.getData(i),"");return s??r}const Xt={[St]:{exposeProperties:{files:e=>Array.prototype.slice.call(e.files),items:e=>e.items,dataTransfer:e=>e},matchesTypes:["Files"]},[gn]:{exposeProperties:{html:(e,t)=>Bt(e,t,""),dataTransfer:e=>e},matchesTypes:["Html","text/html"]},[fn]:{exposeProperties:{urls:(e,t)=>Bt(e,t,"").split(`
2
2
  `),dataTransfer:e=>e},matchesTypes:["Url","text/uri-list"]},[pn]:{exposeProperties:{text:(e,t)=>Bt(e,t,""),dataTransfer:e=>e},matchesTypes:["Text","text/plain"]}};function Wi(e,t){const r=Xt[e];if(!r)throw new Error(`native type ${e} has no configuration`);const s=new Ki(r);return s.loadDataTransfer(t),s}function zt(e){if(!e)return null;const t=Array.prototype.slice.call(e.types||[]);return Object.keys(Xt).filter(r=>{const s=Xt[r];return s?.matchesTypes?s.matchesTypes.some(a=>t.indexOf(a)>-1):!1})[0]||null}const qi=un(()=>/firefox/i.test(navigator.userAgent)),hn=un(()=>!!window.safari);class Or{interpolate(t){const{xs:r,ys:s,c1s:a,c2s:i,c3s:o}=this;let l=r.length-1;if(t===r[l])return s[l];let c=0,d=o.length-1,u;for(;c<=d;){u=Math.floor(.5*(c+d));const p=r[u];if(p<t)c=u+1;else if(p>t)d=u-1;else return s[u]}l=Math.max(0,d);const f=t-r[l],g=f*f;return s[l]+a[l]*f+i[l]*g+o[l]*f*g}constructor(t,r){const{length:s}=t,a=[];for(let p=0;p<s;p++)a.push(p);a.sort((p,m)=>t[p]<t[m]?-1:1);const i=[],o=[];let l,c;for(let p=0;p<s-1;p++)l=t[p+1]-t[p],c=r[p+1]-r[p],i.push(l),o.push(c/l);const d=[o[0]];for(let p=0;p<i.length-1;p++){const m=o[p],y=o[p+1];if(m*y<=0)d.push(0);else{l=i[p];const b=i[p+1],v=l+b;d.push(3*v/((v+b)/m+(v+l)/y))}}d.push(o[o.length-1]);const u=[],f=[];let g;for(let p=0;p<d.length-1;p++){g=o[p];const m=d[p],y=1/i[p],b=m+d[p+1]-g-g;u.push((g-m-b)*y),f.push(b*y*y)}this.xs=t,this.ys=r,this.c1s=d,this.c2s=u,this.c3s=f}}const Zi=1;function mn(e){const t=e.nodeType===Zi?e:e.parentElement;if(!t)return null;const{top:r,left:s}=t.getBoundingClientRect();return{x:s,y:r}}function ct(e){return{x:e.clientX,y:e.clientY}}function Yi(e){var t;return e.nodeName==="IMG"&&(qi()||!(!((t=document.documentElement)===null||t===void 0)&&t.contains(e)))}function Xi(e,t,r,s){let a=e?t.width:r,i=e?t.height:s;return hn()&&e&&(i/=window.devicePixelRatio,a/=window.devicePixelRatio),{dragPreviewWidth:a,dragPreviewHeight:i}}function Qi(e,t,r,s,a){const i=Yi(t),l=mn(i?e:t),c={x:r.x-l.x,y:r.y-l.y},{offsetWidth:d,offsetHeight:u}=e,{anchorX:f,anchorY:g}=s,{dragPreviewWidth:p,dragPreviewHeight:m}=Xi(i,t,d,u),y=()=>{let w=new Or([0,.5,1],[c.y,c.y/u*m,c.y+m-u]).interpolate(g);return hn()&&i&&(w+=(window.devicePixelRatio-1)*m),w},b=()=>new Or([0,.5,1],[c.x,c.x/d*p,c.x+p-d]).interpolate(f),{offsetX:v,offsetY:C}=a,N=v===0||v,S=C===0||C;return{x:N?v:b(),y:S?C:y()}}class Ji{get window(){if(this.globalContext)return this.globalContext;if(typeof window<"u")return window}get document(){var t;return!((t=this.globalContext)===null||t===void 0)&&t.document?this.globalContext.document:this.window?this.window.document:void 0}get rootElement(){var t;return((t=this.optionsArgs)===null||t===void 0?void 0:t.rootElement)||this.window}constructor(t,r){this.ownerDocument=null,this.globalContext=t,this.optionsArgs=r}}function eo(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Ar(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{},s=Object.keys(r);typeof Object.getOwnPropertySymbols=="function"&&(s=s.concat(Object.getOwnPropertySymbols(r).filter(function(a){return Object.getOwnPropertyDescriptor(r,a).enumerable}))),s.forEach(function(a){eo(e,a,r[a])})}return e}class to{profile(){var t,r;return{sourcePreviewNodes:this.sourcePreviewNodes.size,sourcePreviewNodeOptions:this.sourcePreviewNodeOptions.size,sourceNodeOptions:this.sourceNodeOptions.size,sourceNodes:this.sourceNodes.size,dragStartSourceIds:((t=this.dragStartSourceIds)===null||t===void 0?void 0:t.length)||0,dropTargetIds:this.dropTargetIds.length,dragEnterTargetIds:this.dragEnterTargetIds.length,dragOverTargetIds:((r=this.dragOverTargetIds)===null||r===void 0?void 0:r.length)||0}}get window(){return this.options.window}get document(){return this.options.document}get rootElement(){return this.options.rootElement}setup(){const t=this.rootElement;if(t!==void 0){if(t.__isReactDndBackendSetUp)throw new Error("Cannot have two HTML5 backends at the same time.");t.__isReactDndBackendSetUp=!0,this.addEventListeners(t)}}teardown(){const t=this.rootElement;if(t!==void 0&&(t.__isReactDndBackendSetUp=!1,this.removeEventListeners(this.rootElement),this.clearCurrentDragSourceNode(),this.asyncEndDragFrameId)){var r;(r=this.window)===null||r===void 0||r.cancelAnimationFrame(this.asyncEndDragFrameId)}}connectDragPreview(t,r,s){return this.sourcePreviewNodeOptions.set(t,s),this.sourcePreviewNodes.set(t,r),()=>{this.sourcePreviewNodes.delete(t),this.sourcePreviewNodeOptions.delete(t)}}connectDragSource(t,r,s){this.sourceNodes.set(t,r),this.sourceNodeOptions.set(t,s);const a=o=>this.handleDragStart(o,t),i=o=>this.handleSelectStart(o);return r.setAttribute("draggable","true"),r.addEventListener("dragstart",a),r.addEventListener("selectstart",i),()=>{this.sourceNodes.delete(t),this.sourceNodeOptions.delete(t),r.removeEventListener("dragstart",a),r.removeEventListener("selectstart",i),r.setAttribute("draggable","false")}}connectDropTarget(t,r){const s=o=>this.handleDragEnter(o,t),a=o=>this.handleDragOver(o,t),i=o=>this.handleDrop(o,t);return r.addEventListener("dragenter",s),r.addEventListener("dragover",a),r.addEventListener("drop",i),()=>{r.removeEventListener("dragenter",s),r.removeEventListener("dragover",a),r.removeEventListener("drop",i)}}addEventListeners(t){t.addEventListener&&(t.addEventListener("dragstart",this.handleTopDragStart),t.addEventListener("dragstart",this.handleTopDragStartCapture,!0),t.addEventListener("dragend",this.handleTopDragEndCapture,!0),t.addEventListener("dragenter",this.handleTopDragEnter),t.addEventListener("dragenter",this.handleTopDragEnterCapture,!0),t.addEventListener("dragleave",this.handleTopDragLeaveCapture,!0),t.addEventListener("dragover",this.handleTopDragOver),t.addEventListener("dragover",this.handleTopDragOverCapture,!0),t.addEventListener("drop",this.handleTopDrop),t.addEventListener("drop",this.handleTopDropCapture,!0))}removeEventListeners(t){t.removeEventListener&&(t.removeEventListener("dragstart",this.handleTopDragStart),t.removeEventListener("dragstart",this.handleTopDragStartCapture,!0),t.removeEventListener("dragend",this.handleTopDragEndCapture,!0),t.removeEventListener("dragenter",this.handleTopDragEnter),t.removeEventListener("dragenter",this.handleTopDragEnterCapture,!0),t.removeEventListener("dragleave",this.handleTopDragLeaveCapture,!0),t.removeEventListener("dragover",this.handleTopDragOver),t.removeEventListener("dragover",this.handleTopDragOverCapture,!0),t.removeEventListener("drop",this.handleTopDrop),t.removeEventListener("drop",this.handleTopDropCapture,!0))}getCurrentSourceNodeOptions(){const t=this.monitor.getSourceId(),r=this.sourceNodeOptions.get(t);return Ar({dropEffect:this.altKeyPressed?"copy":"move"},r||{})}getCurrentDropEffect(){return this.isDraggingNativeItem()?"copy":this.getCurrentSourceNodeOptions().dropEffect}getCurrentSourcePreviewNodeOptions(){const t=this.monitor.getSourceId(),r=this.sourcePreviewNodeOptions.get(t);return Ar({anchorX:.5,anchorY:.5,captureDraggingState:!1},r||{})}isDraggingNativeItem(){const t=this.monitor.getItemType();return Object.keys(Er).some(r=>Er[r]===t)}beginDragNativeItem(t,r){this.clearCurrentDragSourceNode(),this.currentNativeSource=Wi(t,r),this.currentNativeHandle=this.registry.addSource(t,this.currentNativeSource),this.actions.beginDrag([this.currentNativeHandle])}setCurrentDragSourceNode(t){this.clearCurrentDragSourceNode(),this.currentDragSourceNode=t;const r=1e3;this.mouseMoveTimeoutTimer=setTimeout(()=>{var s;return(s=this.rootElement)===null||s===void 0?void 0:s.addEventListener("mousemove",this.endDragIfSourceWasRemovedFromDOM,!0)},r)}clearCurrentDragSourceNode(){if(this.currentDragSourceNode){if(this.currentDragSourceNode=null,this.rootElement){var t;(t=this.window)===null||t===void 0||t.clearTimeout(this.mouseMoveTimeoutTimer||void 0),this.rootElement.removeEventListener("mousemove",this.endDragIfSourceWasRemovedFromDOM,!0)}return this.mouseMoveTimeoutTimer=null,!0}return!1}handleDragStart(t,r){t.defaultPrevented||(this.dragStartSourceIds||(this.dragStartSourceIds=[]),this.dragStartSourceIds.unshift(r))}handleDragEnter(t,r){this.dragEnterTargetIds.unshift(r)}handleDragOver(t,r){this.dragOverTargetIds===null&&(this.dragOverTargetIds=[]),this.dragOverTargetIds.unshift(r)}handleDrop(t,r){this.dropTargetIds.unshift(r)}constructor(t,r,s){this.sourcePreviewNodes=new Map,this.sourcePreviewNodeOptions=new Map,this.sourceNodes=new Map,this.sourceNodeOptions=new Map,this.dragStartSourceIds=null,this.dropTargetIds=[],this.dragEnterTargetIds=[],this.currentNativeSource=null,this.currentNativeHandle=null,this.currentDragSourceNode=null,this.altKeyPressed=!1,this.mouseMoveTimeoutTimer=null,this.asyncEndDragFrameId=null,this.dragOverTargetIds=null,this.lastClientOffset=null,this.hoverRafId=null,this.getSourceClientOffset=a=>{const i=this.sourceNodes.get(a);return i&&mn(i)||null},this.endDragNativeItem=()=>{this.isDraggingNativeItem()&&(this.actions.endDrag(),this.currentNativeHandle&&this.registry.removeSource(this.currentNativeHandle),this.currentNativeHandle=null,this.currentNativeSource=null)},this.isNodeInDocument=a=>!!(a&&this.document&&this.document.body&&this.document.body.contains(a)),this.endDragIfSourceWasRemovedFromDOM=()=>{const a=this.currentDragSourceNode;a==null||this.isNodeInDocument(a)||(this.clearCurrentDragSourceNode()&&this.monitor.isDragging()&&this.actions.endDrag(),this.cancelHover())},this.scheduleHover=a=>{this.hoverRafId===null&&typeof requestAnimationFrame<"u"&&(this.hoverRafId=requestAnimationFrame(()=>{this.monitor.isDragging()&&this.actions.hover(a||[],{clientOffset:this.lastClientOffset}),this.hoverRafId=null}))},this.cancelHover=()=>{this.hoverRafId!==null&&typeof cancelAnimationFrame<"u"&&(cancelAnimationFrame(this.hoverRafId),this.hoverRafId=null)},this.handleTopDragStartCapture=()=>{this.clearCurrentDragSourceNode(),this.dragStartSourceIds=[]},this.handleTopDragStart=a=>{if(a.defaultPrevented)return;const{dragStartSourceIds:i}=this;this.dragStartSourceIds=null;const o=ct(a);this.monitor.isDragging()&&(this.actions.endDrag(),this.cancelHover()),this.actions.beginDrag(i||[],{publishSource:!1,getSourceClientOffset:this.getSourceClientOffset,clientOffset:o});const{dataTransfer:l}=a,c=zt(l);if(this.monitor.isDragging()){if(l&&typeof l.setDragImage=="function"){const u=this.monitor.getSourceId(),f=this.sourceNodes.get(u),g=this.sourcePreviewNodes.get(u)||f;if(g){const{anchorX:p,anchorY:m,offsetX:y,offsetY:b}=this.getCurrentSourcePreviewNodeOptions(),N=Qi(f,g,o,{anchorX:p,anchorY:m},{offsetX:y,offsetY:b});l.setDragImage(g,N.x,N.y)}}try{l?.setData("application/json",{})}catch{}this.setCurrentDragSourceNode(a.target);const{captureDraggingState:d}=this.getCurrentSourcePreviewNodeOptions();d?this.actions.publishDragSource():setTimeout(()=>this.actions.publishDragSource(),0)}else if(c)this.beginDragNativeItem(c);else{if(l&&!l.types&&(a.target&&!a.target.hasAttribute||!a.target.hasAttribute("draggable")))return;a.preventDefault()}},this.handleTopDragEndCapture=()=>{this.clearCurrentDragSourceNode()&&this.monitor.isDragging()&&this.actions.endDrag(),this.cancelHover()},this.handleTopDragEnterCapture=a=>{if(this.dragEnterTargetIds=[],this.isDraggingNativeItem()){var i;(i=this.currentNativeSource)===null||i===void 0||i.loadDataTransfer(a.dataTransfer)}if(!this.enterLeaveCounter.enter(a.target)||this.monitor.isDragging())return;const{dataTransfer:l}=a,c=zt(l);c&&this.beginDragNativeItem(c,l)},this.handleTopDragEnter=a=>{const{dragEnterTargetIds:i}=this;if(this.dragEnterTargetIds=[],!this.monitor.isDragging())return;this.altKeyPressed=a.altKey,i.length>0&&this.actions.hover(i,{clientOffset:ct(a)}),i.some(l=>this.monitor.canDropOnTarget(l))&&(a.preventDefault(),a.dataTransfer&&(a.dataTransfer.dropEffect=this.getCurrentDropEffect()))},this.handleTopDragOverCapture=a=>{if(this.dragOverTargetIds=[],this.isDraggingNativeItem()){var i;(i=this.currentNativeSource)===null||i===void 0||i.loadDataTransfer(a.dataTransfer)}},this.handleTopDragOver=a=>{const{dragOverTargetIds:i}=this;if(this.dragOverTargetIds=[],!this.monitor.isDragging()){a.preventDefault(),a.dataTransfer&&(a.dataTransfer.dropEffect="none");return}this.altKeyPressed=a.altKey,this.lastClientOffset=ct(a),this.scheduleHover(i),(i||[]).some(l=>this.monitor.canDropOnTarget(l))?(a.preventDefault(),a.dataTransfer&&(a.dataTransfer.dropEffect=this.getCurrentDropEffect())):this.isDraggingNativeItem()?a.preventDefault():(a.preventDefault(),a.dataTransfer&&(a.dataTransfer.dropEffect="none"))},this.handleTopDragLeaveCapture=a=>{this.isDraggingNativeItem()&&a.preventDefault(),this.enterLeaveCounter.leave(a.target)&&(this.isDraggingNativeItem()&&setTimeout(()=>this.endDragNativeItem(),0),this.cancelHover())},this.handleTopDropCapture=a=>{if(this.dropTargetIds=[],this.isDraggingNativeItem()){var i;a.preventDefault(),(i=this.currentNativeSource)===null||i===void 0||i.loadDataTransfer(a.dataTransfer)}else zt(a.dataTransfer)&&a.preventDefault();this.enterLeaveCounter.reset()},this.handleTopDrop=a=>{const{dropTargetIds:i}=this;this.dropTargetIds=[],this.actions.hover(i,{clientOffset:ct(a)}),this.actions.drop({dropEffect:this.getCurrentDropEffect()}),this.isDraggingNativeItem()?this.endDragNativeItem():this.monitor.isDragging()&&this.actions.endDrag(),this.cancelHover()},this.handleSelectStart=a=>{const i=a.target;typeof i.dragDrop=="function"&&(i.tagName==="INPUT"||i.tagName==="SELECT"||i.tagName==="TEXTAREA"||i.isContentEditable||(a.preventDefault(),i.dragDrop()))},this.options=new Ji(r,s),this.actions=t.getActions(),this.monitor=t.getMonitor(),this.registry=t.getRegistry(),this.enterLeaveCounter=new Ui(this.isNodeInDocument)}}const ro=function(t,r,s){return new to(t,r,s)},no=({onChange:e,emptyTextFirstLine:t,emptyTextSecondLine:r,emptyButtonLabel:s,acceptTypes:a,maxFilesCount:i,multiple:o,fileFormatError:l,fileCountError:c,fileSizeError:d,getIsFileFormatError:u,getIsFileSizeError:f})=>{const g=h.useRef(null),p=h.useRef(null),[m,y]=h.useState([]),[b,v]=h.useState(!1),[C,N]=h.useState(!1),S=h.useCallback($=>{const k=$.target.files;if(k&&k.length>0){const z=Array.from(k),q=u?.(z),X=f?.(z);q?v(!0):X?N(!0):e(z)}},[u,f,e]),D=h.useCallback($=>i&&$?.length>i,[i]),w=h.useMemo(()=>b||C||D(m),[b,C,D,m]),R=()=>{y([]),v(!1),N(!1)},_=h.useMemo(()=>b?n.jsx(x.DialErrorText,{text:l}):C?n.jsx(x.DialErrorText,{text:d}):D(m)?n.jsx(x.DialErrorText,{text:c}):null,[c,l,d,m,D,b,C]);h.useEffect(()=>{R()},[a]);const[{isOver:O,canDrop:A},j]=or(()=>({accept:[St],drop($){const k=$.files,z=u?.(k)??!1,q=f?.(k)??!1,X=D?.(k)??!1;if(v(z),N(q),z||q||X){y(k);return}e(k),R()},collect:$=>({isOver:$.isOver(),canDrop:$.canDrop()})}),[e,u,f,D]),P=$=>{($.key==="Enter"||$.key==="Space")&&($.preventDefault(),p.current?.click())},B=$=>{$?.preventDefault();const k=Array.from($.dataTransfer?.items??[]);v(!!u?.(k)),N(!!f?.(k)),y(k)},G=$=>{$.target===$.currentTarget&&R()},ee=se("border border-dashed rounded w-full cursor-pointer relative h-full hover:border-hover",!A&&!w&&"border-primary",A&&(O?"border-accent-primary":"border-hover"),w&&"border-error");return j(g),n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:ee,ref:g,onDragOver:B,onDragLeave:G,children:[n.jsxs("label",{htmlFor:"file",tabIndex:0,onKeyDown:P,className:"flex flex-col items-center cursor-pointer size-full text-secondary dial-tiny-text justify-center",children:[t&&n.jsx("p",{className:"mb-1",children:t}),r&&n.jsx("p",{className:"mb-0.5",children:r}),s&&n.jsx(x.DialPrimaryButton,{appearance:T.ButtonAppearance.Ghost,label:s,onClick:()=>p.current?.click()})]}),n.jsx("input",{multiple:o,id:"file",type:"file",ref:p,hidden:!0,accept:a,onChange:S})]}),n.jsx(n.Fragment,{children:_})]})},so=({iconBefore:e,className:t,...r})=>{const s=r.invalid,a=()=>n.jsx("div",{className:"mr-2",children:s?n.jsx(H.IconExclamationCircle,{...V.BASE_ICON_PROPS,className:"text-error"}):e});return n.jsx(x.DialInput,{...r,iconBefore:a(),containerClassName:se("h-[40px] p-0",s&&"h-[60px]"),className:se("rounded-r-none border-r-0",s&&"text-error",t)})},ao=({children:e,existingFiles:t,onDrop:r,getIsFileFormatError:s,getIsFileSizeError:a,maxFilesCount:i,fileFormatError:o,fileSizeError:l,fileCountError:c})=>{const d=h.useRef(null),[u,f]=h.useState(!1),[g,p]=h.useState(!1),[m,y]=h.useState(0),b=h.useCallback(()=>{f(!1),p(!1),y(0)},[]),v=h.useCallback(O=>!!(i&&t.length+O.length>i),[i,t.length]),C=u||g,[{isOver:N,canDrop:S},D]=or(()=>({accept:[St],drop(O){const A=O.files,j=[...t,...A],P=s?.(A)??!1,B=a?.(A)??!1,G=v?.(A)??!1;if(f(P),p(B),P||B||G){y(A.length);return}r(j),b()},collect:O=>({isOver:O.isOver(),canDrop:O.canDrop()})}),[t,r,s,a,v,b]),w=O=>{O.preventDefault();const A=Array.from(O.dataTransfer?.items??[]);f(!!s?.(A)),p(!1),y(A.length)},R=O=>{O.target===O.currentTarget&&b()};D(d);const _=v(Array.from({length:m}));return n.jsxs("div",{className:"h-full flex flex-col",children:[n.jsx("div",{ref:d,onDragOver:w,onDragLeave:R,className:se("flex-1 min-h-0 border border-solid rounded p-2 overflow-y-auto",!C&&!_&&(S&&N?"border-accent-primary":"border-primary"),(C||_)&&"border-error"),children:e}),u&&n.jsx(x.DialErrorText,{text:o}),g&&n.jsx(x.DialErrorText,{text:l}),!u&&!g&&_&&n.jsx(x.DialErrorText,{text:c})]})},xn=e=>{const{files:t,iconBeforeInput:r,dynamicIcon:s,onChange:a,isInvalid:i,errorText:o,removeButtonAriaLabel:l,getIsMultiFilesSizeError:c,multiFilesSizeError:d,getIsFileFormatError:u,getIsFileSizeError:f,maxFilesCount:g}=e,p=h.useCallback((b,v)=>{b.stopPropagation(),a(t?.filter(C=>C.name!==v)||[])},[a,t]),m=h.useCallback(b=>n.jsx(It,{"aria-label":l,onClick:v=>p(v,b)}),[l,p]),y=h.useMemo(()=>n.jsx("div",{className:"flex flex-col gap-y-1",children:t?.map((b,v)=>n.jsx(so,{id:b.name,value:b.name,iconAfter:m(b.name),iconBefore:r||s?.(b.name),invalid:i?.(b),error:i?.(b)?o:""},b.name+v))}),[t,r,s,i,o,m]);return n.jsx(La,{backend:ro,children:!t||t.length===0?n.jsx(no,{...e,onChange:a}):n.jsxs(n.Fragment,{children:[n.jsx(ao,{existingFiles:t,onDrop:a,getIsFileFormatError:u,getIsFileSizeError:f,maxFilesCount:g,fileFormatError:e.fileFormatError,fileSizeError:e.fileSizeError,fileCountError:e.fileCountError,children:y}),c?.(t)&&n.jsx(x.DialErrorText,{text:d})]})})},io=({onChange:e,fieldTitle:t,elementId:r,files:s,maxFilesCount:a,maxFileSize:i,maxMultiFilesSize:o,fileFormatError:l,fileCountError:c,fileSizeError:d,multiFilesSizeError:u,multiple:f=!0,acceptTypes:g,deleteAllButtonLabel:p,addButtonLabel:m,additionalActionButtons:y,...b})=>{const v=h.useRef(null),C=()=>v.current?.click(),N=()=>{e([])},S=h.useCallback(_=>_?.some(O=>!(g==="/"||g?.toLowerCase()?.includes(O?.type?.toLowerCase()))),[g]),D=h.useCallback(_=>{if(!i)return!1;const O=i*(1024*1024);return _?.some(A=>{const j=A.size;return!!j&&j>O})},[i]),w=h.useCallback(_=>{if(!o||!f)return!1;const O=o*1024*1024;return _.reduce((j,P)=>j+P.size,0)>O},[o,f]),R=h.useCallback(_=>{const O=_.target.files;if(O&&O.length>0){const A=Array.from(O),j=S(A),P=D(A);!j&&!P&&e([...s||[],...A])}},[S,D,e,s]);return n.jsxs("div",{className:"h-full flex flex-col",children:[n.jsxs("div",{className:"flex justify-between items-center pb-1 min-h-[42px]",children:[n.jsx(Ae.DialLabel,{label:`${t}: ${f?s?.length||0:""}`,htmlFor:r}),f&&!!s?.length&&n.jsxs("div",{className:"flex flex-row items-center gap-x-2",children:[n.jsx(x.DialNeutralButton,{label:p,iconBefore:n.jsx(H.IconTrashX,{...V.BASE_ICON_PROPS}),onClick:N}),(a?a>s?.length:!0)&&n.jsx(x.DialPrimaryButton,{appearance:T.ButtonAppearance.Ghost,iconBefore:n.jsx(H.IconPlus,{...V.BASE_ICON_PROPS}),label:m,onClick:C}),y]})]}),s&&s.length>0&&n.jsx("input",{id:"file",type:"file",multiple:f,ref:v,hidden:!0,accept:g,onChange:R}),n.jsx(xn,{files:s,onChange:e,acceptTypes:g,maxFilesCount:a,multiple:f,fileFormatError:l,fileCountError:c,fileSizeError:d,multiFilesSizeError:u,getIsFileFormatError:S,getIsFileSizeError:D,getIsMultiFilesSizeError:w,...b})]})},oo=({icon:e,ariaLabel:t,size:r=T.ElementSize.Standard,disabled:s=!1,className:a,buttonClassName:i,iconClassName:o,caretIcon:l=n.jsx(H.IconChevronDown,{size:V.DIAL_ICON_SIZE.SM}),showCaret:c=!0,placement:d="bottom-start",matchReferenceWidth:u=!1,open:f,onOpenChange:g,defaultOpen:p=!1,...m})=>{const y=r===T.ElementSize.Small,[b,v]=h.useState(p),C=f??b,N=y?"w-8 px-0":"w-10 px-0",S={[T.ElementSize.Small]:"size-5",[T.ElementSize.Standard]:"size-6",[T.ElementSize.Large]:"size-7"},D=w=>{v(w),g?.(w)};return n.jsx(F.DialDropdown,{...m,disabled:s,placement:d,matchReferenceWidth:u,className:a,open:C,onOpenChange:D,defaultOpen:p,children:n.jsxs("button",{type:"button","aria-label":t,disabled:s,className:I.mergeClasses("group flex items-center justify-center rounded border border-transparent bg-layer-4 text-primary","enabled:hover:bg-accent-primary-alpha enabled:active:bg-controls-accent-primary-alpha-active","focus-visible:border-focus focus-visible:outline-none disabled:cursor-not-allowed disabled:text-controls-secondary-disable disabled:opacity-75",y?"h-8 px-2":"h-10 px-2",c?void 0:N,i),children:[n.jsx(F.DialIcon,{icon:e,className:I.mergeClasses("flex items-center justify-center text-inherit",S[r],c&&"-mr-2",o)}),c&&n.jsxs("div",{className:"relative z-10 inline-grid size-5 shrink-0 place-items-center",children:[n.jsx("div",{className:"absolute inset-0 rounded-full bg-layer-2"}),n.jsx(F.DialIcon,{icon:l,className:I.mergeClasses("relative flex items-center justify-center text-secondary transition-transform group-hover:text-primary group-disabled:text-controls-secondary-disable",C&&"rotate-180")})]})]})})},lo="application/octet-stream";function co(e,t){if(!e||e.length===0)return[];const r=e.find(c=>c.parentPath===""&&c.nodeType==="FOLDER");if(!r)return[];const s=r.path||r.url||"",a=$t(s,!0),i=e.filter(c=>c!==r).map(c=>{const d=c.path||c.url||"",u=uo(c.nodeType),f=u===x.DialFileNodeType.FOLDER,g=$t(d,f);let p;return c.parentPath===null||c.parentPath===void 0?p=a:c.parentPath===""?p="":p=$t(c.parentPath,!0),{...c,originalPath:d,path:g,parentPath:p,nodeType:u}}),o=new Map;i.forEach(c=>{const d={...c,id:c.originalPath,name:c.name,path:c.path,parentPath:c.parentPath,nodeType:c.nodeType,resourceType:fo(c.resourceType),folderId:t,updatedAt:c.updatedAt?new Date(c.updatedAt).toISOString():new Date().toISOString(),items:c.nodeType===x.DialFileNodeType.FOLDER?[]:void 0};c.nodeType===x.DialFileNodeType.ITEM&&(d.extension=po(c.name),d.contentType=c.contentType||lo,d.contentLength=c.contentLength||0),o.set(c.path,d)});const l=[];return o.forEach(c=>{if(c.parentPath===a)l.push(c);else{const d=c.path.lastIndexOf(c.name||""),u=c.path.slice(0,d),f=o.get(u);f&&f.nodeType===x.DialFileNodeType.FOLDER?(f.items=f.items||[],f.items.push(c)):l.push(c)}}),l}function $t(e,t){try{let r=decodeURIComponent(e);return t?r.endsWith("/")||(r+="/"):r.endsWith("/")&&(r=r.slice(0,-1)),r}catch{return t&&!e.endsWith("/")?e+"/":!t&&e.endsWith("/")?e.slice(0,-1):e}}function uo(e){return e.toUpperCase()==="FOLDER"?x.DialFileNodeType.FOLDER:x.DialFileNodeType.ITEM}function fo(e){if(!e)return;const t=e.toUpperCase();return Object.values(x.DialFileResourceType).find(s=>s.toUpperCase()===t)}function po(e){const t=e.split(".");return t.length>1?t[t.length-1]:""}function go(e,t="Prompts",r="prompts/public/",s="root"){const a=co(e,s);return[{id:s,name:t,path:r,parentPath:"",nodeType:x.DialFileNodeType.FOLDER,folderId:s,items:a}]}var qe=(e=>(e.Sections="sections",e.Flat="flat",e.FlatSections="flat-sections",e))(qe||{}),at=(e=>(e.Select="select",e.Radio="radio",e))(at||{}),jt=(e=>(e.Row="row",e.Column="column",e))(jt||{}),J=(e=>(e.String="string",e.Number="number",e.Integer="integer",e.Boolean="boolean",e.Object="object",e.Array="array",e.Null="null",e))(J||{});const ho={noItemSchema:"No item schema defined.",noItemsYet:"No items yet. Add one below.",addItem:"Add Item",selectTypeToAdd:"Select type to add…",noConfigurableProperties:"No configurable properties.",noFieldsYet:"No fields yet. Add one below.",keyColumnHeader:"Key",valueColumnHeader:"Value",addField:"Add Field",keyInputPlaceholder:"Enter key",stringInputPlaceholder:"Enter a value",integerInputPlaceholder:"Enter a whole number",numberInputPlaceholder:"Enter a number",enumSelectPlaceholder:"Select an option",selectTypePlaceholder:"Select type",removeItemAriaLabel:"Remove item",removeFieldAriaLabel:"Remove field"},bn=h.createContext(null);function Se(){const e=h.useContext(bn);if(!e)throw new Error("useSchemaContext must be used inside DialSchemaRenderer");return e}function _r(e,t){const r={...e,...t};return(e.properties||t.properties)&&(r.properties={...e.properties,...t.properties}),(e.required||t.required)&&(r.required=Array.from(new Set([...e.required??[],...t.required??[]]))),r}function Z(e,t,r=0){if(r>10)return e;let s=e;if(s.$ref){const a=s.$ref.replace(/^#\//,"").split("/");let i=t;for(const u of a)i=i?.[u];if(!i||typeof i!="object")return e;const{$ref:o,...l}=s,c=i;s={...c.$ref?Z(c,t,r+1):c,...l}}if(s.allOf&&s.allOf.length>0){const{allOf:a,...i}=s;let o={};for(const l of a)o=_r(o,Z(l,t,r+1));s=_r(o,i)}return s}function vn(e){return e.map((t,r)=>({entry:t,index:r})).sort((t,r)=>{const s=t.entry[1]["dial:meta"]?.["dial:propertyOrder"]??1/0,a=r.entry[1]["dial:meta"]?.["dial:propertyOrder"]??1/0;return s!==a?s-a:t.index-r.index}).map(({entry:t})=>t)}function Tt(e){return e==null||e===""}function Ue(e){return e.type===J.Object||e.properties!=null&&e.oneOf==null&&e.anyOf==null&&e.type==null}function bt(e){return e.replace(/_/g," ").replace(/([a-z])([A-Z])/g,"$1 $2").replace(/\b\w/g,t=>t.toUpperCase())}function yn(e,t){return e.type===J.Null?"null":e.$ref?Z(e,t).title??e.$ref.split("/").pop()??"Option":e.title?e.title:e.type?Array.isArray(e.type)?e.type.join(" | "):e.type:e.discriminator?Object.keys(e.discriminator.mapping).join(" | "):e.const!=null?String(e.const):e.oneOf?"One of options":"Option"}function Ee(e,t,r=0){if(r>15)return;const s=Z(e,t);if("default"in s)return s.default;if(s.discriminator&&s.oneOf){const a=Object.keys(s.discriminator.mapping)[0];if(a){const i=Z({$ref:s.discriminator.mapping[a]},t);return{...Ee(i,t,r+1)??{},[s.discriminator.propertyName]:a}}}if(Ue(s)){if(s.properties){const a={};let i=!1;for(const[o,l]of Object.entries(s.properties)){const c=Ee(l,t,r+1);c!==void 0&&(a[o]=c,i=!0)}return i?a:void 0}if(s.additionalProperties!=null&&s.additionalProperties!==!1)return{}}}function we(e,t,r,s="",a=0){if(a>15)return[];const i=[],o=Z(t,r);if(o.anyOf){const d=o.anyOf.filter(u=>u.type!==J.Null);return e!=null&&d.length===1?we(e,d[0],r,s,a+1):i}if(o.oneOf&&o.discriminator){const d=o.discriminator.propertyName,u=e?.[d];if(u&&o.discriminator.mapping[u]){const f={$ref:o.discriminator.mapping[u]},g=Z(f,r);return we(e,g,r,s,a+1)}return i}if(o.type===J.Array||!o.type&&Array.isArray(e)){if(Array.isArray(e)&&o.items)for(let d=0;d<e.length;d++){const u=we(e[d],o.items,r,`${s}[${d}]`,a+1);i.push(...u)}return i}if(!Ue(o))return i;const l=o.required??[],c=e;for(const d of l){const u=o.properties?.[d];if(u&&Z(u,r).isHidden)continue;const f=s?`${s}.${d}`:d,g=c?.[d];if(Tt(g)){const p=u?.title??bt(d);i.push({path:f,message:`${p} is required`})}}if(c&&o.properties)for(const[d,u]of Object.entries(o.properties)){if(Z(u,r).isHidden)continue;const f=s?`${s}.${d}`:d,g=c[d];if(g!=null){const p=we(g,u,r,f,a+1);i.push(...p)}}if(c&&o.additionalProperties!=null&&o.additionalProperties!==!1&&typeof o.additionalProperties=="object"){const d=o.additionalProperties;for(const[u,f]of Object.entries(c)){const g=s?`${s}.${u}`:u,p=we(f,d,r,g,a+1);i.push(...p)}}return i}function lr(e,t,r){const s=Z(t,r);if(Array.isArray(e))return`${e.length} item${e.length!==1?"s":""}`;if(Ue(s)&&s.properties){const a=Object.entries(s.properties).filter(([,c])=>!Z(c,r).isHidden),i=a.length,o=e;return`${a.filter(([c])=>{const d=o?.[c];return d!=null&&d!==""}).length}/${i} fields`}return""}function mo(e,t,r){if(e==null){const s=t.findIndex(a=>a.type===J.Null);return s>=0?s:0}if(Array.isArray(e)){const s=t.findIndex(a=>Z(a,r).type===J.Array);return s>=0?s:0}if(typeof e=="boolean"){const s=t.findIndex(a=>Z(a,r).type===J.Boolean);return s>=0?s:0}if(typeof e=="number"){const s=t.findIndex(a=>{const i=Z(a,r);return i.type===J.Number||i.type===J.Integer});return s>=0?s:0}if(typeof e=="string"){const s=t.findIndex(a=>Z(a,r).type===J.String);return s>=0?s:0}if(typeof e=="object"){const s=e;for(let a=0;a<t.length;a++){const i=Z(t[a],r);if(i.discriminator&&i.discriminator.propertyName in s)return a}for(let a=0;a<t.length;a++){const i=Z(t[a],r);if(Ue(i)||i.oneOf)return a}return 0}return 0}function xo(e,t,r){if(t&&typeof e=="object"&&e!==null){const s=e[t];if(s)return`Item ${r+1}: ${s}`}if(typeof e=="object"&&e!==null){const s=e,a=s.name??s.title??s.id;if(a)return`Item ${r+1}: ${a}`}return`Item ${r+1}`}function Dn(e){switch(Array.isArray(e.type)?e.type[0]:e.type){case J.String:return"";case J.Boolean:return!1;case J.Array:return[];case J.Integer:case J.Number:return;default:return{}}}const it=({title:e,description:t,summary:r,errorCount:s=0,level:a=0,children:i,onRemove:o,defaultExpanded:l=!0,removeItemAriaLabel:c="Remove item"})=>{const[d,u]=h.useState(l),f=a===0,g="rounded border border-secondary",p=I.mergeClasses("flex items-center gap-2 cursor-pointer select-none transition-colors",f?"px-4 py-3 bg-layer-3 hover:bg-layer-4":"px-3 py-2 bg-layer-4 hover:bg-layer-3",d?"rounded-t":"rounded"),m=I.mergeClasses("border-t border-secondary",f?"p-4":"p-3");return n.jsxs("div",{className:g,children:[n.jsxs("div",{className:p,onClick:()=>u(y=>!y),role:"button","aria-expanded":d,children:[n.jsx("span",{className:"shrink-0 text-secondary",children:d?n.jsx(H.IconChevronDown,{size:16,stroke:2}):n.jsx(H.IconChevronRight,{size:16,stroke:2})}),n.jsx("span",{className:I.mergeClasses("flex-1 truncate",f?"dial-small-semi-text text-primary":"dial-small-text text-primary"),children:e}),t&&n.jsx(Ae.DialInfoButton,{caption:t}),r&&n.jsx("span",{className:"dial-tiny-text text-secondary whitespace-nowrap ml-2",children:r}),s>0?n.jsxs("span",{className:"flex items-center gap-1 dial-tiny-text text-error whitespace-nowrap",children:[n.jsx(F.DialIcon,{icon:n.jsx(H.IconAlertTriangle,{size:13,stroke:2})}),s," error",s>1?"s":""]}):n.jsx(F.DialIcon,{icon:n.jsx(H.IconCheck,{size:13,stroke:2}),className:"text-success shrink-0"}),o&&n.jsx(It,{size:T.ElementSize.Small,onClick:y=>{y.stopPropagation(),o()},"aria-label":c,className:"ml-1 shrink-0 p-0.5"})]}),d&&n.jsx("div",{className:m,children:i})]})},Cn=({schema:e,value:t,onChange:r,path:s,level:a=0,required:i,label:o})=>{const{rootSchema:l,defaultExpanded:c=!0,touchedPaths:d=new Set,skipUntouched:u=!1}=Se(),f=Z(e,l),g=Ue(f),p=f.type===J.Array;if(g||p){const b=lr(t,f,l),v=we(t,f,l,s.join(".")),C=s.join("."),N=C+".",S=!u||d.has(C)||[...d].some(D=>D.startsWith(N));return n.jsx(it,{title:o??f.title??s[s.length-1]??"Section",description:f.description,level:a,summary:b,errorCount:S?v.length:0,defaultExpanded:c,children:n.jsx(Oe,{schema:f,value:t,onChange:r,path:s,level:a+1,required:i})})}const y=(!u||d.has(s.join(".")))&&i&&Tt(t)?`${o??"Field"} is required`:void 0;return n.jsx(x.DialFormItem,{label:o,required:i,description:f.description,error:y,children:n.jsx(Oe,{schema:f,value:t,onChange:r,path:s,level:a,required:i,suppressInlineError:!0})})},gt=({schema:e,value:t,onChange:r,path:s,level:a})=>{const{rootSchema:i,texts:o}=Se(),l=Z(e,i),c=vn(Object.entries(l.properties??{}).filter(([,f])=>!Z(f,i).isHidden)),d=l.required??[],u=t??{};return c.length===0?n.jsx("p",{className:"dial-tiny-text text-secondary italic",children:o.noConfigurableProperties}):n.jsx("div",{className:"flex flex-col gap-4",children:c.map(([f,g])=>{const m=Z(g,i).title??g.title??bt(f),y=d.includes(f);return n.jsx(Cn,{schema:g,value:u[f],onChange:b=>r({...u,[f]:b}),path:[...s,f],level:a,required:y,label:m},f)})})},bo=({schema:e,value:t,onChange:r,path:s,level:a})=>{const{rootSchema:i,texts:o,readonly:l=!1,defaultExpanded:c=!0}=Se(),d=Array.isArray(t)?t:[],u=e.items,[f,g]=h.useState(void 0);if(!u)return n.jsx("p",{className:"dial-tiny-text text-secondary italic",children:o.noItemSchema});const p=h.useMemo(()=>Z(u,i),[u,i]),m=h.useMemo(()=>p.discriminator,[p]),y=h.useMemo(()=>m?.propertyName,[m]),b=h.useMemo(()=>m?Object.keys(m.mapping).map(S=>({value:S,label:S})):[],[m]),v=()=>{const S=f??b[0]?.value;let D;if(m&&S){const w=Z({$ref:m.mapping[S]},i);D={...Ee(w,i)??{},[m.propertyName]:S}}else D=Ee(p,i)??Dn(p);r([...d,D])},C=S=>{r(d.filter((D,w)=>w!==S))},N=(S,D)=>{r(d.map((w,R)=>R===S?D:w))};return n.jsxs("div",{className:"flex flex-col gap-3",children:[d.length===0&&n.jsx("p",{className:"dial-tiny-text text-secondary italic",children:o.noItemsYet}),d.map((S,D)=>{const w=xo(S,y,D),R=lr(S,p,i),_=we(S,p,i,`${s.join(".")}[${D}]`);return n.jsx(it,{title:w,level:a,summary:R,errorCount:_.length,onRemove:l?void 0:()=>C(D),defaultExpanded:c,removeItemAriaLabel:o.removeItemAriaLabel,children:n.jsx(Oe,{schema:u,value:S,onChange:O=>N(D,O),path:[...s,String(D)],level:a+1})},D)}),!l&&n.jsxs("div",{className:"flex items-center gap-2 pt-1",children:[b.length>0&&n.jsx("div",{className:"flex-1 max-w-[280px]",children:n.jsx(ke,{options:b,value:f??b[0]?.value,placeholder:o.selectTypeToAdd,onChange:S=>{const D=typeof S=="string"?S:S[0];g(D)}})}),n.jsx(x.DialGhostButton,{label:o.addItem,iconBefore:n.jsx(H.IconPlus,{size:16,stroke:2}),onClick:v})]})]})},vo=({schema:e,value:t,onChange:r,path:s,level:a})=>{const{rootSchema:i,texts:o,readonly:l=!1}=Se(),c=h.useId(),d=e.discriminator;if(d){const b=d.propertyName,v=d.mapping,C=Object.keys(v).map(w=>({value:w,label:w})),N=typeof t=="object"&&t!==null?t[b]:void 0,S=N?Z({$ref:v[N]},i):void 0,D=w=>{const R=Z({$ref:v[w]},i),_=Ee(R,i)??{};r({..._,[b]:w})};if(e.discriminatorDisplay===at.Radio){const w=e.discriminatorOrientation===jt.Row,R=N?(()=>{const _=Z({$ref:v[N]},i),{[b]:O,...A}=_.properties??{};return{..._,properties:A}})():void 0;return w?n.jsxs("div",{className:"flex flex-col gap-3",children:[n.jsx("div",{role:"radiogroup",className:"flex flex-row flex-wrap gap-4",children:Object.keys(v).map(_=>{const O=Z({$ref:v[_]},i);return n.jsx(F.DialRadioButton,{name:c,value:_,inputId:`${c}-${_}`,label:O.title??_,checked:N===_,disabled:l,onChange:()=>D(_)},_)})}),R&&n.jsx(gt,{schema:R,value:t,onChange:r,path:s,level:a})]}):n.jsx("div",{role:"radiogroup",className:"flex flex-col gap-2",children:Object.keys(v).map(_=>{const O=Z({$ref:v[_]},i),A=N===_,{[b]:j,...P}=O.properties??{},B={...O,properties:P};return n.jsxs("div",{className:"flex flex-col",children:[n.jsx(F.DialRadioButton,{name:c,value:_,inputId:`${c}-${_}`,label:O.title??_,checked:A,disabled:l,onChange:()=>D(_)}),A&&n.jsx("div",{className:"ml-6 mt-2",children:n.jsx(gt,{schema:B,value:t,onChange:r,path:s,level:a})})]},_)})})}return n.jsxs("div",{className:"flex flex-col gap-3",children:[n.jsx("div",{className:"flex-1 max-w-[280px]",children:n.jsx(ke,{options:C,value:N,placeholder:o.selectTypePlaceholder,disabled:l,onChange:w=>{const R=typeof w=="string"?w:w[0];R&&D(R)}})}),S&&n.jsx("div",{className:"pl-3",children:n.jsx(gt,{schema:S,value:t,onChange:r,path:s,level:a})})]})}const u=e.oneOf??[],g=(()=>{if(t==null)return 0;if(typeof t=="object"&&!Array.isArray(t)){for(let b=0;b<u.length;b++)if(Z(u[b],i).required?.every(C=>C in t))return b}return 0})(),p=b=>{const v=Z(u[b],i),C=Ee(v,i);r(C??null)},m=u[g];if(e.discriminatorDisplay===at.Radio)return n.jsx("div",{role:"radiogroup",className:"flex flex-col gap-2",children:u.map((b,v)=>{const C=Z(b,i),N=yn(b,i)??`Option ${v+1}`,S=g===v;return n.jsxs("div",{className:"flex flex-col",children:[n.jsx(F.DialRadioButton,{name:c,value:String(v),inputId:`${c}-${v}`,label:N,checked:S,disabled:l,onChange:()=>p(v)}),S&&C&&n.jsx("div",{className:"ml-6 mt-2",children:n.jsx(Oe,{schema:C,value:t,onChange:r,path:s,level:a})})]},v)})});const y=u.map((b,v)=>{const C=Z(b,i);return{value:String(v),label:C.title??`Option ${v+1}`}});return n.jsxs("div",{className:"flex flex-col gap-3",children:[n.jsx("div",{className:"flex-1 max-w-[280px]",children:n.jsx(ke,{options:y,value:String(g),disabled:l,onChange:b=>{const v=typeof b=="string"?b:b[0];p(Number(v))}})}),m&&n.jsx("div",{className:"pl-3 border-l-2 border-secondary",children:n.jsx(Oe,{schema:m,value:t,onChange:r,path:s,level:a})})]})},yo=({schema:e,value:t,onChange:r,path:s,level:a})=>{const{rootSchema:i,readonly:o=!1}=Se(),l=e.anyOf??[],c=l.map((m,y)=>({value:String(y),label:yn(m,i)})),d=mo(t,l,i),u=l[d],g=Z(u,i).type===J.Null,p=m=>{const y=Z(l[m],i);if(y.type===J.Null){r(null);return}const b=Ee(y,i);if(b!==void 0){r(b);return}switch(y.type){case J.Array:r([]);break;case J.String:r("");break;case J.Boolean:r(!1);break;case J.Integer:case J.Number:r(0);break;default:r({});break}};return n.jsxs("div",{className:"flex flex-col gap-3",children:[n.jsx("div",{className:"flex-1 max-w-[280px]",children:n.jsx(ke,{options:c,value:String(d),disabled:o,onChange:m=>{const y=typeof m=="string"?m:m[0];p(Number(y))}})}),!g&&u&&n.jsx("div",{className:"pl-3 border-l-2 border-secondary",children:n.jsx(Oe,{schema:u,value:t,onChange:r,path:s,level:a})})]})},Nn=({schema:e,value:t,onChange:r,invalid:s})=>{const a=h.useId(),{texts:i,readonly:o=!1,inputClassName:l,acceptableResourceTypes:c}=Se(),d=e.const!==void 0,u=Array.isArray(e.enum)&&e.enum.length>0;if(e["dial:resource"]===!0&&Array.isArray(e.acceptableResourceTypes)&&e.acceptableResourceTypes.length>0&&(e.type===J.String||e.type===void 0)){const g=(e.acceptableResourceTypes??[]).flatMap(p=>{const m=c?.[p];return Array.isArray(m)?m.map(y=>{const b=String(y);return{value:b,label:b}}):[]});return n.jsx(ke,{options:g,value:t!=null?String(t):void 0,invalid:s,disabled:o,onChange:p=>r(typeof p=="string"?p:p[0]),placeholder:i.enumSelectPlaceholder,className:l})}if(d)return n.jsx(x.DialInput,{value:String(e.const??""),disabled:!0,onChange:void 0,className:"opacity-60"});if(u&&e.enumDisplay===at.Radio){const g=e.enumOrientation===jt.Row;return n.jsx("div",{role:"radiogroup",className:g?"flex flex-row flex-wrap gap-x-4 gap-y-2":"flex flex-col gap-2",children:e.enum.map(p=>{const m=String(p);return n.jsx(F.DialRadioButton,{name:a,value:m,inputId:`${a}-${m}`,label:m,checked:t!=null?String(t)===m:!1,disabled:o,onChange:y=>r(y)},m)})})}if(u){const g=e.enum.map(p=>({value:String(p),label:String(p)}));return n.jsx(ke,{options:g,value:t!=null?String(t):void 0,invalid:s,disabled:o,onChange:p=>r(typeof p=="string"?p:p[0]),placeholder:i.enumSelectPlaceholder})}switch(e.type){case J.Boolean:return n.jsx(Ae.DialSwitch,{switchId:a,isOn:!!t,disabled:o,onChange:g=>r(g)});case J.Integer:return n.jsx(Zt,{integer:!0,value:t!=null?String(t):"",invalid:s,disabled:o,onChange:g=>r(g!==void 0?Number(g):void 0),placeholder:i.integerInputPlaceholder,containerClassName:l});case J.Number:return n.jsx(Zt,{value:t!=null?String(t):"",invalid:s,disabled:o,onChange:g=>r(g!==void 0?Number(g):void 0),placeholder:i.numberInputPlaceholder,containerClassName:l});default:return e.isProtected?n.jsx(cn,{value:t!=null?String(t):"",invalid:s,disabled:o,onChange:g=>r(g??void 0),placeholder:i.stringInputPlaceholder,containerClassName:l}):n.jsx(x.DialInput,{value:t!=null?String(t):"",invalid:s,disabled:o,onChange:g=>r(g??void 0),placeholder:i.stringInputPlaceholder,containerClassName:l})}},Rr=(e,t)=>({id:Math.random().toString(36).slice(2),key:e,value:t}),In=e=>!!(e.oneOf||e.anyOf||e.type===J.Array||Ue(e)),Do=({pairId:e,pairKey:t,pairValue:r,valueSchema:s,onKeyChange:a,onValueChange:i,onRemove:o,keyInputPlaceholder:l,removeFieldAriaLabel:c,path:d,level:u,readonly:f=!1,inputClassName:g})=>{const{rootSchema:p,texts:m,defaultExpanded:y=!0,touchedPaths:b=new Set,markTouched:v=()=>{},skipUntouched:C=!1}=Se(),[N,S]=h.useState(t),D=In(s),w=[...d,e,"key"].join("."),_=(!C||b.has(w))&&t==="",O=n.jsxs("div",{className:"flex gap-2 items-start",children:[n.jsxs("div",{className:D?"flex-1 min-w-0":"w-2/5 min-w-0",children:[n.jsx(x.DialInput,{value:N,disabled:f,invalid:_,onChange:B=>S(B??""),onBlur:()=>{v(w),N!==t&&a(N)},placeholder:l,containerClassName:g}),n.jsx(x.DialErrorText,{text:_?`${m.keyColumnHeader} is required`:void 0})]}),!D&&n.jsx("div",{className:"flex-1 min-w-0",children:n.jsx(Nn,{schema:s,value:r,onChange:i})}),!f&&n.jsx(It,{size:T.ElementSize.Small,onClick:o,"aria-label":c,className:"shrink-0 p-1"})]});if(!D)return O;const A=[...d,t],j=lr(r,s,p),P=we(r,s,p,A.join("."));return n.jsxs("div",{className:"flex flex-col gap-2",children:[O,n.jsx(it,{title:t,level:u,summary:j,errorCount:P.length+(_?1:0),defaultExpanded:y,children:n.jsx(Oe,{schema:s,value:r,onChange:i,path:A,level:u+1})})]})},Co=({schema:e,value:t,onChange:r,path:s,level:a})=>{const{rootSchema:i,texts:o,readonly:l=!1,inputClassName:c}=Se(),d=e.additionalProperties===!0||e.additionalProperties==null?{type:"string"}:typeof e.additionalProperties=="object"?Z(e.additionalProperties,i):{type:"string"},u=In(d),[f,g]=h.useState(()=>Object.entries(t??{}).map(([N,S])=>Rr(N,S))),p=N=>Object.fromEntries(N.filter(S=>S.key!=="").map(S=>[S.key,S.value])),m=(N,S)=>{const D=f.map((w,R)=>R===N?{...w,key:S}:w);g(D),r(p(D))},y=(N,S)=>{const D=f.map((w,R)=>R===N?{...w,value:S}:w);g(D),r(p(D))},b=()=>u?Ee(d,i)??Dn(d):"",v=()=>{g(N=>[...N,Rr("",b())])},C=N=>{const S=f.filter((D,w)=>w!==N);g(S),r(p(S))};return n.jsxs("div",{className:"flex flex-col gap-2",children:[f.length===0&&n.jsx("p",{className:"dial-tiny-text text-secondary italic",children:o.noFieldsYet}),f.length>0&&!u&&n.jsxs("div",{className:"flex gap-2 mb-1 pr-7",children:[n.jsx("span",{className:"w-2/5 dial-tiny-text text-secondary font-medium",children:o.keyColumnHeader}),n.jsx("span",{className:"flex-1 dial-tiny-text text-secondary font-medium",children:o.valueColumnHeader})]}),f.map((N,S)=>n.jsx(Do,{pairId:N.id,pairKey:N.key,pairValue:N.value,valueSchema:d,onKeyChange:D=>m(S,D),onValueChange:D=>y(S,D),onRemove:()=>C(S),keyInputPlaceholder:o.keyInputPlaceholder,removeFieldAriaLabel:o.removeFieldAriaLabel,path:s,level:a,readonly:l,inputClassName:c},N.id)),!l&&n.jsx("div",{className:"pt-1",children:n.jsx(x.DialGhostButton,{label:o.addField,iconBefore:n.jsx(H.IconPlus,{size:16,stroke:2}),onClick:v})})]})},Sn=({value:e,onChange:t,theme:r=ot.EditorThemes.dark,height:s=240})=>{const{readonly:a}=Se(),[i,o]=h.useState(null),[l,c]=h.useState(()=>JSON.stringify(e,null,2));h.useEffect(()=>{typeof window<"u"&&Promise.resolve().then(()=>require("./JsonEditor-BlaSMX26.cjs")).then(u=>{o(()=>u.DialJsonEditor)})},[]);const d=u=>{const f=u??"";c(f);try{t(JSON.parse(f))}catch{}};return n.jsx("div",{className:"border border-primary rounded",style:{height:`${s}px`},children:i&&n.jsx(i,{value:l,currentTheme:r,onChange:d,options:{readOnly:a}})})},Oe=({schema:e,value:t,onChange:r,path:s,level:a,required:i,suppressInlineError:o=!1})=>{const{rootSchema:l,renderField:c,markTouched:d=()=>{},touchedPaths:u=new Set,skipUntouched:f=!1,jsonEditorTheme:g}=Se(),p=Z(e,l),m=v=>{d(s.join(".")),r(v)},y=!f||u.has(s.join("."));let b;if(p.oneOf)b=n.jsx(vo,{schema:p,value:t,onChange:m,path:s,level:a});else if(p.anyOf&&p.type!==J.Object)b=n.jsx(yo,{schema:p,value:t,onChange:m,path:s,level:a});else if(Ue(p)){const v=p.additionalProperties!=null&&p.additionalProperties!==!1,C=!p.properties||Object.keys(p.properties).length===0;v&&C?b=n.jsx(Co,{schema:p,value:t,onChange:m,path:s,level:a}):C&&p.additionalProperties!==!1?b=n.jsx(Sn,{value:t,onChange:m,theme:g}):b=n.jsx(gt,{schema:p,value:t,onChange:m,path:s,level:a})}else if(p.type===J.Array)b=n.jsx(bo,{schema:p,value:t,onChange:m,path:s,level:a});else{const v=y&&i&&Tt(t),C=!o&&v?`${p.title??"Field"} is required`:void 0;b=n.jsxs(n.Fragment,{children:[n.jsx(Nn,{schema:p,value:t,onChange:m,invalid:v}),n.jsx(x.DialErrorText,{text:C})]})}return c?c(s,p,b):b},No=({schema:e,defaultValue:t,texts:r,className:s,readonly:a=!1,defaultExpanded:i=!0,inputClassName:o,variant:l=qe.Sections,onChange:c,onPropertyChange:d,onDefaultValues:u,renderField:f,skipUntouched:g=!1,jsonEditorTheme:p,acceptableResourceTypes:m})=>{const y=h.useMemo(()=>({...ho,...r}),[r]),b=h.useMemo(()=>t||(Ee(e,e)??{}),[]),[v,C]=h.useState(b),[N,S]=h.useState(new Set),D=h.useCallback(j=>{S(P=>P.has(j)?P:new Set([...P,j]))},[]);h.useEffect(()=>{u?.(b)},[]);const w=(j,P)=>{const B={...v,[j]:P};C(B),c?.(B),d?.(j,P)},R=new Set(Object.keys(e.properties??{})),_=Object.keys(v).filter(j=>!R.has(j)),O=vn(Object.entries(e.properties??{}).filter(([,j])=>!Z(j,e).isHidden)),A=e.required??[];return n.jsx(bn.Provider,{value:{rootSchema:e,texts:y,readonly:a,defaultExpanded:i,inputClassName:o,jsonEditorTheme:p,acceptableResourceTypes:m,renderField:f,touchedPaths:N,markTouched:D,skipUntouched:g},children:n.jsxs("div",{className:I.mergeClasses("flex flex-col gap-4",s),children:[O.map(([j,P])=>{const B=Z(P,e),G=B.title??P.title??bt(j),ee=A.includes(j),$=v[j];if(l===qe.Flat)return n.jsx(Cn,{schema:P,value:$,onChange:X=>w(j,X),path:[j],level:0,required:ee,label:G},j);if(l===qe.FlatSections)return n.jsxs("div",{className:"flex flex-col gap-3",children:[n.jsx("h2",{className:"dial-small-semi-text text-primary",children:G}),n.jsx(Oe,{schema:P,value:$,onChange:X=>w(j,X),path:[j],level:0,required:ee})]},j);const k=we($,B,e,j),z=j+".",q=!g||N.has(j)||[...N].some(X=>X.startsWith(z));return n.jsx(it,{title:G,description:B.description,level:0,defaultExpanded:i,errorCount:q?ee&&Tt($)?Math.max(k.length,1):k.length:0,children:n.jsx(Oe,{schema:P,value:$,onChange:X=>w(j,X),path:[j],level:1,required:ee})},j)}),_.map(j=>{const P=bt(j),B=n.jsx(Sn,{value:v[j],onChange:G=>w(j,G),theme:p});return l===qe.Sections?n.jsx(it,{title:P,level:0,defaultExpanded:i,children:B},j):n.jsxs("div",{className:"flex flex-col gap-3",children:[n.jsx("h2",{className:"dial-small-semi-text text-primary",children:P}),B]},j)})]})})},Io=e=>({info:n.jsx(H.IconInfoCircleFilled,{size:e.size}),error:n.jsx(H.IconAlertCircleFilled,{size:e.size}),warning:n.jsx(H.IconAlertTriangleFilled,{size:e.size}),success:n.jsx(H.IconCircleCheckFilled,{size:e.size}),loading:n.jsx(x.Spinner,{size:e.size}),general:n.jsx(H.IconCheck,{size:e.size,stroke:e.stroke})}),So={[x.NotificationVariant.Info]:"bg-info text-info",[x.NotificationVariant.Success]:"bg-success text-success",[x.NotificationVariant.Warning]:"bg-warning text-warning",[x.NotificationVariant.Error]:"bg-error text-error",[x.NotificationVariant.Loading]:"bg-layer-raised text-info",[x.NotificationVariant.General]:"bg-layer-sunken text-primary"},jo={[x.NotificationVariant.Info]:"status",[x.NotificationVariant.Success]:"status",[x.NotificationVariant.Warning]:"alert",[x.NotificationVariant.Error]:"alert",[x.NotificationVariant.Loading]:"status",[x.NotificationVariant.General]:"status"},To="items-center justify-between rounded-xl relative gap-3 p-3 border flex border-transparent",cr=({variant:e=x.NotificationVariant.Info,type:t=x.NotificationType.Toast,title:r,message:s,className:a,iconSize:i=24,iconStroke:o=2,closable:l=!1,onClose:c,children:d,textClassName:u,...f})=>{const g=h.useMemo(()=>Io({size:i,stroke:o})[e],[e,i,o]),p=u??(t===x.NotificationType.SectionMessage?"flex-row flex-wrap items-baseline gap-x-1":"flex-col");return n.jsxs("div",{role:jo[e],...f,className:I.mergeClasses(To,So[e],t===x.NotificationType.Toast&&"min-w-[200px] max-w-[600px] shadow-lg",t===x.NotificationType.SectionMessage&&e===x.NotificationVariant.Loading&&"border-secondary",a),children:[n.jsxs("div",{className:"flex items-start gap-3 flex-1 min-w-0",children:[n.jsx("span",{"aria-hidden":"true",className:"flex shrink-0",children:n.jsx(F.DialIcon,{icon:g})}),r?n.jsxs("div",{className:I.mergeClasses("flex min-w-0 text-primary break-words",p),children:[n.jsx("div",{className:"dial-small-paragraph-semi-text min-w-0 break-words",children:r}),n.jsx("div",{className:"dial-small-paragraph-text min-w-0 break-words",children:s})]}):n.jsx("div",{className:"dial-small-paragraph-text min-w-0 text-primary break-words",children:s})]}),d,l&&n.jsx("div",{className:"relative size-[40px]",children:n.jsx(L.CloseButton,{className:"absolute top-[-2px] right-0 size-auto hover:bg-transparent ",ariaLabel:"Close notification",onClose:m=>c?.(m)})})]})},kr={2:"line-clamp-2",3:"line-clamp-3",4:"line-clamp-4",5:"line-clamp-5",6:"line-clamp-6"},wo=e=>e===1?"!truncate !whitespace-nowrap":`${kr[e]??kr[2]} !whitespace-normal`,Eo=({text:e,query:t,markClassName:r,className:s,maxLines:a=2})=>{const i=wo(a);if(!t.trim())return n.jsx(L.EllipsisTooltip,{className:I.mergeClasses(i,s),text:e});const o=e.toLowerCase().indexOf(t.toLowerCase()),l=o===-1?e:n.jsxs(n.Fragment,{children:[e.slice(0,o),n.jsx("mark",{className:I.mergeClasses("text-accent bg-control-accent-alpha-hover",r),children:e.slice(o,o+t.length)}),e.slice(o+t.length)]});return n.jsx(L.EllipsisTooltip,{className:I.mergeClasses(i,s),text:l})},Oo=({className:e,children:t,...r})=>n.jsx("article",{...r,className:I.mergeClasses("relative flex flex-col gap-3 rounded-[20px] border-2 border-transparent p-5","bg-layer-raised shadow-md transition-[transform,box-shadow] duration-200 ease-out hover:-translate-y-[3px] hover:shadow-lg motion-reduce:transition-none motion-reduce:hover:translate-y-0",e),children:t}),Qe=(e,t)=>({type:s,...a})=>n.jsx(cr,{...a,variant:e,type:s||t}),Je=(e,t)=>({variant:s,...a})=>n.jsx(cr,{...a,variant:s||t,type:e}),Ao=Qe(x.NotificationVariant.Error,x.NotificationType.Toast),_o=Qe(x.NotificationVariant.Info,x.NotificationType.Toast),Ro=Qe(x.NotificationVariant.Success,x.NotificationType.Toast),ko=Qe(x.NotificationVariant.Warning,x.NotificationType.Toast),Po=Qe(x.NotificationVariant.Loading,x.NotificationType.Toast),Lo=Qe(x.NotificationVariant.General,x.NotificationType.Toast),Mo=Je(x.NotificationType.SectionMessage,x.NotificationVariant.Error),Fo=Je(x.NotificationType.SectionMessage,x.NotificationVariant.Info),Bo=Je(x.NotificationType.SectionMessage,x.NotificationVariant.Success),zo=Je(x.NotificationType.SectionMessage,x.NotificationVariant.Warning),$o=Je(x.NotificationType.SectionMessage,x.NotificationVariant.Loading),Ho=Je(x.NotificationType.SectionMessage,x.NotificationVariant.General);var be=(e=>(e.Date="date",e.DateTime="datetime",e.Time="time",e.Weekday="weekday",e))(be||{});const Vo="en-GB",Go={[be.Date]:"Select date",[be.DateTime]:"Select date and time",[be.Time]:"--:--",[be.Weekday]:"Select day"},jn="flex w-full items-center justify-between gap-2 rounded-xl border border-secondary bg-layer-raised px-4 py-3 dial-small-text text-primary outline-none transition-colors hover:border-accent-alpha focus-within:border-accent-focus",Tn="!cursor-not-allowed !border-transparent bg-layer-sunken text-control-disable-primary hover:!border-transparent",wn="!border-error",Uo="z-[53] flex w-[248px] flex-col gap-4 rounded-lg bg-layer-raised px-2 py-4 shadow-md",Ko="flex size-10 items-center justify-center rounded-full dial-small-text text-primary hover:bg-control-accent-alpha-hover hover:text-primary focus:outline-none focus-visible:outline focus-visible:outline-focus",Wo="bg-control-accent text-control-permanent",qo="text-accent dial-small-semi-text",Zo="text-control-disable-primary",En="text-secondary",Yo=n.jsx(H.IconCalendar,{size:V.DIAL_ICON_SIZE.MD,stroke:ae.DIAL_KIT_ICON_STROKE,"aria-hidden":"true",className:En}),Pr={prev:n.jsx(H.IconChevronLeft,{size:V.DIAL_ICON_SIZE.SM,stroke:ae.DIAL_KIT_ICON_STROKE,"aria-hidden":"true"}),next:n.jsx(H.IconChevronRight,{size:V.DIAL_ICON_SIZE.SM,stroke:ae.DIAL_KIT_ICON_STROKE,"aria-hidden":"true"})},Xo=(e,t)=>{const s=(new Date(e,t,1).getDay()+6)%7,a=new Date(e,t,1-s);return Array.from({length:42},(i,o)=>{const l=new Date(a);return l.setDate(a.getDate()+o),l})},Lr=(e,t)=>!!e&&!!t&&e.getFullYear()===t.getFullYear()&&e.getMonth()===t.getMonth()&&e.getDate()===t.getDate(),Mr=(e,t,r)=>{const s=new Date(e.getFullYear(),e.getMonth(),e.getDate());if(t){const a=new Date(t.getFullYear(),t.getMonth(),t.getDate());if(s<a)return!0}if(r){const a=new Date(r.getFullYear(),r.getMonth(),r.getDate());if(s>a)return!0}return!1},Qo=(e,t)=>e.toLocaleDateString(t,{month:"long",year:"numeric"}),Fr=(e,t)=>e.toLocaleDateString(t,{day:"numeric",month:"short",year:"numeric"}),Jo=(e,t)=>e.toLocaleDateString(t,{weekday:"long",day:"numeric",month:"long",year:"numeric"}),dt=e=>`${String(e.getHours()).padStart(2,"0")}:${String(e.getMinutes()).padStart(2,"0")}`,Br=(e,t)=>{const[r,s]=t.split(":").map(Number),a=new Date(e);return a.setHours(r||0,s||0,0,0),a},el=e=>/^([01]\d|2[0-3]):[0-5]\d$/.test(e),tl=e=>{const t=e.replace(/\D/g,"").slice(0,4);let r=t.slice(0,2);const s=t.slice(2,4);if(r.length===2&&(r=String(Math.min(Number(r),23)).padStart(2,"0")),s.length===0)return r;const a=String(Math.min(Number(s),59)).padStart(s.length,"0");return`${r}:${a}`},On=5,An=e=>e.charAt(0).toUpperCase()+e.slice(1),rl=e=>Array.from({length:7},(t,r)=>{const s=new Date(Date.UTC(1970,0,On+r));return An(s.toLocaleDateString(e,{weekday:"short",timeZone:"UTC"}))}),nl=e=>Array.from({length:7},(t,r)=>{const s=new Date(Date.UTC(1970,0,On+r));return{value:String(r+1),label:An(s.toLocaleDateString(e,{weekday:"long",timeZone:"UTC"}))}}),zr=({id:e,disabled:t,invalid:r,trigger:s,panelClassName:a,fieldClassName:i,panel:o,labelledBy:l,panelLabel:c})=>{const d=F.useThemeScope(),[u,f]=h.useState(!1),{refs:g,floatingStyles:p,context:m}=le.useFloating({open:u,onOpenChange:S=>f(t?!1:S),placement:"bottom-start",whileElementsMounted:le.autoUpdate,middleware:[le.offset(8),le.flip({padding:8}),le.shift({padding:8})]}),y=le.useClick(m,{enabled:!t}),b=le.useDismiss(m),v=le.useRole(m,{role:"dialog"}),{getReferenceProps:C,getFloatingProps:N}=le.useInteractions([y,b,v]);return n.jsxs(n.Fragment,{children:[n.jsx("div",{id:e,ref:g.setReference,role:"button","aria-haspopup":"dialog","aria-expanded":u,"aria-disabled":t,"aria-labelledby":l,tabIndex:t?-1:0,className:I.mergeClasses(jn,"focus-visible:outline focus-visible:outline-focus",r&&wn,t&&Tn,i),...C(),children:s}),u&&n.jsx(le.FloatingPortal,{children:n.jsx(le.FloatingFocusManager,{context:m,modal:!1,initialFocus:-1,returnFocus:!0,children:n.jsx("div",{ref:g.setFloating,style:p,"aria-label":c,className:I.mergeClasses(Uo,d,a),...N(),children:o(()=>f(!1))})})})]})},$r=({id:e,value:t,onChange:r,disabled:s,invalid:a,className:i,ariaLabel:o,placeholder:l="--:--"})=>{const[c,d]=h.useState(t);return h.useEffect(()=>{d(t)},[t]),n.jsx("input",{id:e,type:"text",inputMode:"numeric",autoComplete:"off","aria-label":o,placeholder:l,disabled:s,value:c,onChange:u=>{const f=tl(u.target.value);d(f),el(f)&&r(f)},className:I.mergeClasses(jn,a&&wn,s&&Tn,i)})},sl=({mode:e=be.Date,value:t,onChange:r,labelProps:s,placeholder:a,disabled:i=!1,invalid:o=!1,id:l,className:c,minDate:d,maxDate:u,locale:f=Vo,fieldClassName:g})=>{const p=a??Go[e],m=t instanceof Date?t:null,y=h.useId(),b=l??y,v=s?.id??`${b}-label`,C=!!s?.label,N=typeof s?.label=="string"?s.label:void 0,S=C?`${v} ${b}`:void 0,D=s?n.jsx(L.Label,{...s,id:v,htmlFor:b}):null,[w,R]=h.useState(()=>m??new Date),_=h.useMemo(()=>new Date,[]),O=h.useMemo(()=>rl(f),[f]),A=h.useMemo(()=>nl(f),[f]),j=h.useMemo(()=>Xo(w.getFullYear(),w.getMonth()),[w]),P=$=>{R(k=>new Date(k.getFullYear(),k.getMonth()+$,1))},B=($,k)=>{if(Mr($,d,u))return;const z=e===be.DateTime&&m?Br($,dt(m)):$;r?.(z),e===be.Date&&k()},G=$=>{r?.(Br(m??new Date,$))},ee=()=>m?e===be.DateTime?`${Fr(m,f)}, ${dt(m)}`:Fr(m,f):p;if(e===be.Time){const $=typeof t=="string"?t:m?dt(m):"";return n.jsxs("div",{className:I.mergeClasses("flex flex-col gap-y-3",c),children:[D,n.jsx($r,{id:b,value:$,onChange:k=>r?.(k),disabled:i,invalid:o,placeholder:p,className:g})]})}if(e===be.Weekday){const $=typeof t=="string"?t:void 0,k=A.find(z=>z.value===$);return n.jsxs("div",{className:I.mergeClasses("flex flex-col gap-y-3",c),children:[D,n.jsx(zr,{id:b,disabled:i,invalid:o,labelledBy:S,panelLabel:N??p,fieldClassName:g,trigger:n.jsxs(n.Fragment,{children:[n.jsx("span",{className:I.mergeClasses("truncate",!k&&"text-secondary"),children:k?.label??p}),n.jsx(H.IconChevronDown,{size:V.DIAL_ICON_SIZE.MD,stroke:ae.DIAL_KIT_ICON_STROKE,"aria-hidden":"true",className:En})]}),panel:z=>n.jsx("div",{role:"listbox","aria-label":N??p,className:"flex flex-col gap-0.5",children:A.map(q=>n.jsx("button",{type:"button",role:"option","aria-selected":q.value===$,className:I.mergeClasses("flex w-full items-center rounded-lg px-3 py-2 text-left dial-small-text text-primary hover:bg-control-accent-alpha-hover","focus-visible:outline focus-visible:outline-focus",q.value===$&&"bg-control-accent-alpha-hover"),onClick:()=>{r?.(q.value),z()},children:q.label},q.value))})})]})}return n.jsxs("div",{className:I.mergeClasses("flex flex-col gap-y-3",c),children:[D,n.jsx(zr,{id:b,disabled:i,invalid:o,labelledBy:S,panelLabel:N??p,fieldClassName:g,trigger:n.jsxs(n.Fragment,{children:[n.jsx("span",{className:I.mergeClasses("truncate",!m&&"text-secondary"),children:ee()}),Yo]}),panel:$=>n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsx(L.StaticIconButton,{"aria-label":"Previous month",icon:Pr.prev,size:T.ElementSize.Small,onClick:()=>P(-1)}),n.jsx("div",{className:"dial-small-semi-text text-primary","aria-live":"polite",children:Qo(w,f)}),n.jsx(L.StaticIconButton,{"aria-label":"Next month",icon:Pr.next,size:T.ElementSize.Small,onClick:()=>P(1)})]}),n.jsxs("div",{className:"grid grid-cols-7 gap-y-1 text-center",children:[O.map(k=>n.jsx("div",{"aria-hidden":"true",className:"dial-tiny-text py-1 text-secondary",children:k},k)),j.map(k=>{const z=k.getMonth()!==w.getMonth(),q=Lr(k,m),X=Lr(k,_),ie=Mr(k,d,u);return n.jsx("button",{type:"button",disabled:ie,"aria-label":Jo(k,f),"aria-pressed":q,"aria-current":X?"date":void 0,className:I.mergeClasses(Ko,z&&Zo,X&&!q&&qo,q&&Wo,ie&&"cursor-not-allowed opacity-40 hover:bg-transparent"),onClick:()=>B(k,$),children:k.getDate()},k.toISOString())})]}),e===be.DateTime&&n.jsxs("div",{className:"flex items-center justify-between gap-3 border-t border-secondary pt-3",children:[n.jsx("span",{className:"dial-small-text text-primary",children:"Time"}),n.jsx($r,{ariaLabel:"Time",value:m?dt(m):"",onChange:G,className:"w-[120px] px-3 py-1.5"})]})]})})]})},al=({segments:e,labelClassName:t="dial-small-text",leafClassName:r="dial-small-semi-text",className:s,ariaLabel:a="Folder path"})=>{const i=n.jsx(F.DialIcon,{icon:n.jsx(H.IconFolder,{size:V.DIAL_ICON_SIZE.SM,stroke:ae.DIAL_KIT_ICON_STROKE,"aria-hidden":"true"}),className:"text-secondary"}),o=e.map((l,c)=>({label:c===e.length-1?n.jsx("span",{className:r,children:l}):l,disabled:!0,...c===0?{iconBefore:i}:{}}));return n.jsx(x.DialBreadcrumb,{className:s,ariaLabel:a,separator:n.jsx(F.DialIcon,{icon:n.jsx(H.IconChevronRight,{size:14,stroke:ae.DIAL_KIT_ICON_STROKE,"aria-hidden":"true",className:"rtl:scale-x-[-1]"}),className:"text-secondary"}),pathItems:o,labelClassName:I.mergeClasses(t,"text-secondary","!cursor-default")})},et=({label:e,variant:t,appearance:r=T.ButtonAppearance.Solid,size:s=T.ElementSize.Standard,className:a,textClassName:i,iconAfter:o,iconBefore:l,type:c="button",tooltipProps:d,href:u,target:f,rel:g,disabled:p,...m})=>{const y=I.mergeClasses("dial-kit-base-button",t&&L.getButtonClassNames(t,r),s===T.ElementSize.Small?"dial-tiny-semi-text":"dial-small-paragraph-semi-text",s===T.ElementSize.Small?"h-[24px] gap-1":"h-[40px] gap-2",s===T.ElementSize.Small&&"dial-kit-base-button-small",r!==T.ButtonAppearance.Link&&(s===T.ElementSize.Small?"px-2":"px-4"),s!==T.ElementSize.Small&&r!==T.ButtonAppearance.Link&&"dial-kit-enhanced-target",a),b=e?void 0:d?.tooltip,v=T.resolveAccessibleName(typeof e=="string"?e:void 0,m["aria-label"],b),C=n.jsxs(n.Fragment,{children:[n.jsx(F.DialIcon,{icon:l}),e&&n.jsx("span",{className:i,children:e}),n.jsx(F.DialIcon,{icon:o})]}),N=m,S=u!==void 0?n.jsx("a",{...N,href:p?void 0:u,target:f,rel:g??(f==="_blank"?"noopener noreferrer":void 0),"aria-disabled":p||void 0,tabIndex:p?-1:N.tabIndex,onClick:p?void 0:N.onClick,className:y,"aria-label":v,children:C}):n.jsx("button",{...m,type:c,disabled:p,className:y,"aria-label":v,children:C});return d?n.jsx(L.Tooltip,{asChild:!0,...d,children:S}):S},dr=(e,t)=>({appearance:s,...a})=>n.jsx(et,{...a,variant:e,appearance:s||t}),ur=(e,t)=>({variant:s,...a})=>n.jsx(et,{...a,variant:s||t,appearance:e}),_n=dr(T.ButtonVariant.Primary,T.ButtonAppearance.Solid),fr=dr(T.ButtonVariant.Neutral,T.ButtonAppearance.Solid),il=dr(T.ButtonVariant.Danger,T.ButtonAppearance.Solid),ol=ur(T.ButtonAppearance.Link,T.ButtonVariant.Primary),ll=ur(T.ButtonAppearance.Ghost,T.ButtonVariant.Primary),cl=ur(T.ButtonAppearance.Outlined,T.ButtonVariant.Neutral),dl=({className:e,icon:t,tooltipProps:r,type:s="button",...a})=>{const i=I.mergeClasses("flex items-center justify-center rounded-full size-[40px]","dial-kit-enhanced-target","dial-kit-fab-button disabled:cursor-not-allowed focus-visible:outline focus-visible:outline-focus outline-offset-0",e),o=n.jsx("button",{...a,type:s,className:i,"aria-label":T.resolveAccessibleName(a["aria-label"],r?.tooltip),children:t||n.jsx(H.IconArrowNarrowDown,{size:24,stroke:1.5,"aria-hidden":"true"})});return r?n.jsx(T.DialTooltip,{...r,children:o}):o},ul=e=>n.jsx(H.IconChevronDown,{size:V.DIAL_ICON_SIZE.SM,stroke:ae.DIAL_KIT_ICON_STROKE,"aria-hidden":!0,className:I.mergeClasses("transition-transform",e&&"rotate-180")}),fl=({variant:e,appearance:t,items:r,...s})=>{const[a,i]=h.useState(!1),o=h.useMemo(()=>ul(a),[a]);return n.jsx("div",{children:n.jsx(L.Dropdown,{items:r,onOpenChange:l=>i(l),children:n.jsx(et,{...s,iconAfter:o,variant:e||T.ButtonVariant.Primary,appearance:t||T.ButtonAppearance.Solid,"aria-haspopup":"menu","aria-expanded":a})})})},Rn=({label:e,size:t,isOpen:r=!1,"aria-label":s,...a})=>{const i=t===T.ElementSize.Small?"h-[32px]":"h-[40px] dial-kit-enhanced-target";return n.jsxs("button",{type:"button","aria-haspopup":"menu","aria-expanded":r,"aria-label":s?`${s} ${e}`:void 0,className:I.mergeClasses("dial-small-paragraph-text px-3 focus-visible:outline focus-visible:outline-focus","flex items-center gap-1 rounded-full text-primary disabled:text-control-disable-primary","hover:bg-control-accent-alpha-hover focus-visible:outline-offset-2 active:bg-control-accent-alpha-active",i,a.className),...a,children:[e,n.jsx(H.IconChevronDown,{size:V.DIAL_ICON_SIZE.MD,stroke:ae.DIAL_KIT_ICON_STROKE,"aria-hidden":!0,className:I.mergeClasses("transition-transform",r&&"rotate-180")})]})},pl=({items:e,selectedKey:t,defaultSelectedKey:r,onSelect:s,size:a,disabled:i,placement:o="bottom-end",matchReferenceWidth:l=!1,listClassName:c,ariaLabel:d})=>{const[u,f]=h.useState(!1),[g,p]=h.useState(r??e[0]?.key),m=t!==void 0,y=m?t:g,b=h.useMemo(()=>{const C=e.find(N=>N.key===y);return C?.label?String(C.label):""},[e,y]),v=h.useCallback(({key:C})=>{const N=e.find(S=>S.key===C);N&&(m||p(C),s?.(N))},[e,m,s]);return n.jsx(L.Dropdown,{items:e,placement:o,matchReferenceWidth:l,listClassName:c,disabled:i,onOpenChange:f,onItemClick:v,children:n.jsx(Rn,{label:b,size:a,isOpen:u,disabled:i,"aria-label":d})})},Pe=({text:e,className:t,variant:r=x.CaptionType.Description,...s})=>e?n.jsx("span",{...s,role:"alert",className:I.mergeClasses("dial-tiny-text",r===x.CaptionType.Error?"text-error":"text-secondary",t),children:e}):null,Le=({...e})=>n.jsx(Pe,{...e,variant:x.CaptionType.Error}),gl="bg-control-neutral-active flex items-center justify-center enabled:text-secondary enabled:hover:text-control-accent-hover enabled:active:bg-control-accent-alpha-active enabled:hover:bg-control-accent-alpha-hover enabled:active:text-control-accent-active",hl={[T.ElementSize.Small]:"size-[24px]",[T.ElementSize.Standard]:"size-[40px]",[T.ElementSize.Large]:"size-[48px]"},ml=({icon:e,onClick:t,disabled:r,size:s=T.ElementSize.Standard,className:a})=>n.jsx("div",{className:I.mergeClasses("border-l border-tertiary",hl[s]),children:n.jsx(L.IconButton,{className:I.mergeClasses(gl,s===T.ElementSize.Small&&"p-1",a),icon:e,onClick:t,disabled:r,size:s})}),xl=["ArrowLeft","ArrowRight","ArrowUp","ArrowDown","Backspace","Delete","Tab","Enter","Escape","Home","End","Insert"],kn=(e,t,r,s)=>{if((t==="number"||r!==void 0||s!==void 0)&&!xl.includes(e.key)&&!(e.ctrlKey||e.metaKey)&&!(e.key==="-"&&(e.currentTarget.selectionStart??0)===0&&!e.currentTarget.value.includes("-"))&&!(e.key==="."&&t==="number"&&!e.currentTarget.value.includes("."))){if(!/^[0-9]$/.test(e.key)){e.preventDefault();return}if((r!==void 0||s!==void 0)&&e.currentTarget.selectionStart!==null){const i=e.currentTarget.value,o=e.currentTarget.selectionStart,l=e.currentTarget.selectionEnd??o,c=i.slice(0,o)+e.key+i.slice(l),d=parseFloat(c);if(!isNaN(d)){if(r!==void 0&&d<+r){e.preventDefault();return}if(s!==void 0&&d>+s){e.preventDefault();return}}}}},Pn={[T.ElementSize.Small]:{field:"dial-kit-input-small gap-x-1",paddingStart:"pl-2",paddingEnd:"pr-2",stackGap:"gap-1",postfixText:"dial-tiny-text"},[T.ElementSize.Standard]:{field:"gap-x-2 py-2",paddingStart:"pl-3",paddingEnd:"pr-3",stackGap:"gap-2",postfixText:"dial-small-text"},[T.ElementSize.Large]:{field:"gap-x-2 py-3",paddingStart:"pl-4",paddingEnd:"pr-4",stackGap:"gap-2",postfixText:"dial-body-text"}},Ge=({labelProps:e,error:t,caption:r,id:s,containerClassName:a,size:i=T.ElementSize.Standard,...o})=>n.jsxs("div",{className:I.mergeClasses("flex flex-col",Pn[i].stackGap,a),children:[e&&n.jsx(L.Label,{...e,htmlFor:s}),n.jsxs("div",{className:"flex flex-col gap-1",children:[n.jsx(Ln,{id:s,size:i,...o}),n.jsx(Le,{text:t}),!t&&n.jsx(Pe,{text:r})]})]}),Ln=({invalid:e,disabled:t,prefix:r,className:s,postfix:a,children:i,iconBefore:o,iconAfter:l,wrapperClassName:c,type:d,inputRef:u,value:f,tooltipText:g,min:p,onChange:m,max:y,inputButtonProps:b,wrapperRef:v,size:C=T.ElementSize.Standard,...N})=>{const S=Pn[C],D=h.useRef(null),w=le.useMergeRefs([u,D]),R=d==="number"||p!==void 0||y!==void 0;h.useEffect(()=>{const j=D.current;if(!j||!R||t)return;const P=B=>{B.preventDefault()};return j.addEventListener("wheel",P,{passive:!1}),()=>{j.removeEventListener("wheel",P)}},[t,R,d]);const _=j=>{kn(j,d,p,y)},O=j=>{const P=j.currentTarget.value;if(R&&P!==""){const B=parseFloat(P);if(isNaN(B)&&P!=="-"&&P!=="."||!isNaN(B)&&(p!==void 0&&B<+p||y!==void 0&&B>+y))return}m?.(P||void 0)},A=()=>n.jsxs("div",{ref:v,className:I.mergeClasses("dial-kit-input flex flex-row items-center justify-between",S.field,e&&"dial-kit-input-error",t&&"dial-kit-input-disable",!r&&S.paddingStart,!b&&S.paddingEnd,c),"aria-label":"input-container",children:[r&&n.jsx("div",{className:"border-r border-secondary",children:n.jsx(Ln,{wrapperClassName:"!rounded-r-none",className:"truncate",value:r,disabled:!0,size:C,id:`${r}_textBefore`})}),n.jsx(F.DialIcon,{icon:o}),i,n.jsx("input",{ref:w,type:d,autoComplete:d==="password"?"new-password":"off",value:f??"",className:I.mergeClasses("border-0 bg-transparent w-full truncate",t&&"cursor-not-allowed",s),onChange:O,onKeyDown:_,min:p,disabled:t,max:y,...N}),a&&n.jsxs("p",{className:I.mergeClasses("text-secondary",S.postfixText),children:[" ",a]}),n.jsx(F.DialIcon,{icon:l}),b&&n.jsx(ml,{size:C,...b,disabled:t})]});return t&&d!=="password"?n.jsx(L.Tooltip,{tooltip:g||f,children:A()}):A()};var Ye=(e=>(e.Outlined="outlined",e.Selectable="selectable",e))(Ye||{});const bl="inline-flex h-[32px] max-w-full items-center gap-1 rounded-full px-3",vl={[Ye.Outlined]:{default:"bg-layer-raised text-primary",selected:"bg-control-accent-alpha text-primary"},[Ye.Selectable]:{default:"text-secondary",selected:"bg-control-accent-alpha text-primary"}},yl="cursor-pointer outline-offset-0 focus-visible:outline focus-visible:outline-focus",Dl="hover:bg-control-accent-alpha-hover active:bg-control-accent-alpha-active",Ze=({label:e,icon:t,appearance:r=Ye.Outlined,selected:s=!1,disabled:a=!1,closable:i=!1,removeLabel:o,className:l,title:c,onClick:d,onRemove:u,onKeyDown:f,...g})=>{const p=r===Ye.Selectable,m=!!d&&!a,y=i&&!!u&&!a,b=p&&s,v=C=>{f?.(C),!(!m||C.defaultPrevented)&&(C.key==="Enter"||C.key===" ")&&(C.preventDefault(),C.currentTarget.click())};return n.jsxs("span",{...g,role:m?"button":g.role,tabIndex:m?0:g.tabIndex,"aria-disabled":a||void 0,"aria-pressed":p&&m?s:void 0,onClick:a?void 0:d,onKeyDown:v,className:I.mergeClasses(bl,b?"dial-tiny-semi-text":"dial-tiny-text",vl[r][s?"selected":"default"],a&&"cursor-not-allowed",m&&[yl,Dl],l),children:[t&&n.jsx("span",{className:"flex shrink-0 items-center","aria-hidden":"true",children:t}),n.jsx("span",{className:"truncate",title:c??e,children:e}),y&&n.jsx(L.GhostIconButton,{className:"size-[16px] shrink-0 dial-kit-minimum-target",size:T.ElementSize.Small,"aria-label":o??`Remove ${e}`,icon:n.jsx(H.IconX,{size:V.DIAL_ICON_SIZE.SM,stroke:ae.DIAL_KIT_ICON_STROKE,"aria-hidden":"true"}),onClick:C=>{C.stopPropagation(),u?.(C)}})]})},Mn=({options:e,selectedValues:t,handleRemoveTag:r})=>n.jsx(n.Fragment,{children:t.map(s=>{const a=e.find(i=>i.value===s);return n.jsx(Ze,{label:a?.label??s,closable:!!r,onRemove:i=>r?.(i,s),icon:a?.icon,className:"max-w-full border border-tertiary"},s)})}),Cl=I.mergeClasses("w-full flex flex-col"),Nl=L.overlayItemClassName,Il="!max-w-[var(--reference-width)]",Sl="max-h-[344px] overflow-y-auto",jl=L.overlayGap,Tl=L.overlaySubMenuClassName,wl=n.jsx(H.IconChevronRight,{size:V.DIAL_ICON_SIZE.SM,stroke:ae.DIAL_KIT_ICON_STROKE,"aria-hidden":"true"}),El="text-secondary transition-transform",Ol=8,Al=n.jsx(H.IconSearch,{size:V.DIAL_ICON_SIZE.MD,stroke:ae.DIAL_KIT_ICON_STROKE,"aria-hidden":"true"}),_l=n.jsx(H.IconX,{size:V.DIAL_ICON_SIZE.SM,stroke:ae.DIAL_KIT_ICON_STROKE,"aria-hidden":"true"}),Rl=n.jsx(H.IconClipboardX,{size:V.DIAL_ICON_SIZE.LG,stroke:.5,"aria-hidden":"true"}),kl=({opt:e,selectedValues:t,mark:r=L.MenuItemMark.Tint,onSelect:s})=>{const{isOpen:a,nodeId:i,refs:o,floatingStyles:l,context:c,getReferenceProps:d,getFloatingProps:u}=F.useSubMenuFloating(jl,"listbox",!!e.disabled),f=e.children?.some(p=>t.includes(p.value)),g=n.jsx(L.MenuItem,{ref:o.setReference,role:"option","aria-haspopup":"listbox","aria-expanded":a,"aria-selected":!!f,"aria-disabled":!!e.disabled,disabled:e.disabled,ellipsisLabel:!0,icon:e.icon,label:e.labelNode??e.label,trailing:wl,...d()});return n.jsxs(le.FloatingNode,{id:i,children:[e.interactiveTooltip?n.jsx(L.InteractiveTooltip,{asChild:!0,placement:e.interactiveTooltip.placement,content:e.interactiveTooltip.content,contentClassName:e.interactiveTooltip.contentClassName,children:g}):g,a&&n.jsx(F.SubMenuPanel,{refs:o,floatingStyles:l,context:c,getFloatingProps:u,role:"listbox",surfaceClassName:Tl,children:e.children.map(p=>{const m=n.jsx(L.MenuItem,{role:"option","aria-selected":t.includes(p.value),"aria-disabled":!!p.disabled,disabled:p.disabled,mark:r,selected:t.includes(p.value),ellipsisLabel:!0,icon:p.icon,label:p.labelNode??p.label,rightControl:p.rightControl,onClick:()=>!p.disabled&&s(p.value)});return n.jsx(h.Fragment,{children:p.interactiveTooltip?n.jsx(L.InteractiveTooltip,{asChild:!0,placement:p.interactiveTooltip.placement,content:p.interactiveTooltip.content,contentClassName:p.interactiveTooltip.contentClassName,children:m}):m},p.value)})})]})},Pl=({options:e,multiple:t=!1,id:r,value:s,defaultValue:a,size:i=T.ElementSize.Standard,prefix:o,customSelectedValue:l,placeholder:c="Select...",labelProps:d,error:u,caption:f,ariaLabel:g,searchable:p=!1,searchSize:m=T.ElementSize.Standard,searchPlaceholder:y,selectAll:b=!1,invalid:v,selectAllLabel:C="Select all",selectedOptionMark:N=L.MenuItemMark.Tint,emptyStateTitle:S="No options available",emptyStateDescription:D,emptyStateIcon:w,disabled:R=!1,className:_,fieldClassName:O,listClassName:A,closable:j=!1,header:P,footer:B,onClose:G,onChange:ee,dismissRef:$,onFooterClick:k,open:z,onOpenChange:q,onSearchQueryChange:X,customMultiSelectTagsRenderer:ie})=>{const ne=h.useId(),K=r||ne,re=`list-${K}`,de=i===T.ElementSize.Small,[ue,ce]=h.useState(!1),pe=z!==void 0,ge=pe?!!z:ue,fe=h.useCallback(M=>{pe||ce(M),q?.(M)},[pe,q]),[U,Y]=h.useState(""),Ne=h.useCallback(M=>{M!==U&&(Y(M||""),X?.(M||""))},[X,U]),Me=s!==void 0,[he,Fe]=h.useState(a),je=Me?s:he,te=h.useMemo(()=>t?Array.isArray(je)?je:[]:typeof je=="string"?[je]:[],[je,t]),_e=h.useMemo(()=>{const M=U.trim().toLowerCase();return M?e.filter(oe=>oe.label.toLowerCase().includes(M)):e},[e,U]);h.useEffect(()=>{ge||Ne("")},[ge,Ne]);const Ie=h.useCallback(M=>{Me||Fe(M),ee?.(M)},[Me,ee]),Be=h.useCallback(M=>{if(t){const oe=new Set(te);oe.has(M)?oe.delete(M):oe.add(M),Ie(Array.from(oe));return}Ie(M),fe(!1)},[t,Ie,fe,te]),tt=h.useCallback((M,oe)=>{if(M.stopPropagation(),!t){Ie("");return}const lt=te.filter(Un=>Un!==oe);Ie(lt)},[t,te,Ie]),ye=h.useMemo(()=>_e.filter(M=>!M.disabled),[_e]),ze=h.useMemo(()=>ye.filter(M=>te.includes(M.value)).length,[ye,te]),{allSelectedInFiltered:Re,someSelectedInFiltered:me}=h.useMemo(()=>{const M=ye.length>0&&ze===ye.length;return{allSelectedInFiltered:M,someSelectedInFiltered:ze>0&&!M}},[ye,ze]),wt=h.useCallback(()=>{if(!(!t||ye.length===0))if(Re){const M=new Set(ye.map(oe=>oe.value));Ie(te.filter(oe=>!M.has(oe)))}else{const M=new Set(te);ye.forEach(oe=>M.add(oe.value)),Ie(Array.from(M))}},[Re,t,ye,te,Ie]),Te=te.length>0,$e=!t&&Te?te[0]:void 0,E=h.useMemo(()=>$e?e.find(M=>M.value===$e)??e.flatMap(M=>M.children??[]).find(M=>M.value===$e):void 0,[e,$e]),Q=E?o?`${o} ${E.label}`:E.label:void 0,xe=h.useMemo(()=>t?Te?n.jsx("span",{className:"flex min-w-0 flex-1 flex-wrap items-center gap-1",children:ie?.(e,te,tt)??n.jsx(Mn,{options:e,selectedValues:te,handleRemoveTag:tt})}):null:!E||!E.labelNode&&!E.description?null:n.jsxs("span",{className:"flex min-w-0 flex-1 items-center gap-2",children:[n.jsx(L.EllipsisTooltip,{text:E.labelNode??Q}),E.description&&n.jsx("span",{className:"truncate text-secondary dial-tiny-text",children:E.description})]}),[ie,tt,Te,t,e,Q,te,E]),Et=t||xe?"":Q||(l&&s?l:""),$n=typeof d?.label=="string"?d.label:void 0,Hn=xe?[T.resolveAccessibleName(g,$n),t?te.map(M=>e.find(oe=>oe.value===M)?.label??M).join(", "):Q].filter(Boolean).join(", ")||void 0:T.resolveAccessibleName(g);h.useImperativeHandle($,()=>({dismiss:()=>{fe(!1)}}));const Vn=h.useCallback(M=>{R||(M.key==="ArrowDown"||M.key==="ArrowUp")&&(M.preventDefault(),ge||fe(!0))},[R,ge,fe]),Gn=()=>n.jsxs("div",{id:re,role:"listbox","aria-multiselectable":t||void 0,className:Cl,children:[P&&n.jsx(n.Fragment,{children:typeof P=="function"?P():P}),(p||j)&&(e.length>Ol||!!U)&&n.jsxs("div",{className:"flex items-center gap-2 px-2 pt-2",children:[p&&n.jsx(Ge,{id:`search-${K}`,size:m,placeholder:y,"aria-label":y||"Search options",onChange:M=>Ne(M),value:U,iconBefore:Al,containerClassName:"w-full"}),j&&n.jsx(L.GhostIconButton,{"aria-label":"Close select",className:"shrink-0",size:T.ElementSize.Small,icon:_l,onClick:M=>{G?.(M),fe(!1)}})]}),t&&b&&ye.length>0&&n.jsx("div",{className:I.mergeClasses(Nl,"mt-2"),children:n.jsx(L.Checkbox,{id:`${K}-selectAll`,labelProps:{label:C},isSelected:Re,isIndeterminate:me,onChange:wt})}),n.jsx("div",{role:"none",className:Sl,children:_e.length===0?n.jsx("div",{className:"px-2 py-3",children:n.jsx(F.DialNoDataContent,{icon:w??Rl,title:S,description:D})}):_e.map(M=>{const oe=te.includes(M.value);if(M.children?.length)return n.jsx(kl,{opt:M,selectedValues:te,mark:t?L.MenuItemMark.Checkbox:N,onSelect:Be},M.value);const lt=t?n.jsx(L.MenuItem,{id:`${K}-${M.value}`,role:"option","aria-selected":oe,"aria-disabled":!!M.disabled,disabled:M.disabled,mark:L.MenuItemMark.Checkbox,selected:oe,icon:M.icon,label:M.labelNode??M.label,description:M.description,rightControl:M.rightControl,onClick:()=>Be(M.value)}):n.jsx(L.MenuItem,{role:"option","aria-selected":oe,"aria-disabled":!!M.disabled,disabled:M.disabled,mark:N,selected:oe,ellipsisLabel:!0,icon:M.icon,label:M.labelNode??M.label,description:M.description,rightControl:M.rightControl,onClick:()=>!M.disabled&&Be(M.value)});return n.jsx(h.Fragment,{children:M.interactiveTooltip?n.jsx(L.InteractiveTooltip,{asChild:!0,placement:M.interactiveTooltip.placement,content:M.interactiveTooltip.content,contentClassName:M.interactiveTooltip.contentClassName,children:lt}):lt},M.value)})}),B&&n.jsx("div",{onClick:M=>{k?.(M),k&&fe(!1)},children:typeof B=="function"?B():B})]});return n.jsxs("div",{className:I.mergeClasses("flex w-full flex-col gap-2",_),children:[d&&n.jsx(L.Label,{...d,htmlFor:K}),n.jsxs("div",{className:"flex flex-col gap-1",children:[n.jsx(L.Dropdown,{open:ge,onOpenChange:fe,disabled:R,closable:j,onClose:G,placement:"bottom-start",allowedPlacements:["bottom-start","top-start"],listClassName:I.mergeClasses(Il,A),className:"w-full",renderOverlay:Gn,children:n.jsx(Ge,{id:K,size:i,disabled:R,invalid:v,value:Et,placeholder:xe?void 0:c,readOnly:!0,iconBefore:t?void 0:E?.icon,iconAfter:n.jsx(H.IconChevronDown,{size:de?V.DIAL_ICON_SIZE.SM:V.DIAL_ICON_SIZE.MD,stroke:ae.DIAL_KIT_ICON_STROKE,"aria-hidden":"true",className:I.mergeClasses(El,ge&&"rotate-180")}),role:"combobox","aria-haspopup":"listbox","aria-expanded":ge,"aria-controls":re,"aria-autocomplete":"none","aria-label":Hn,containerClassName:"w-full",wrapperClassName:I.mergeClasses(!R&&"cursor-pointer",t&&Te&&["!h-auto flex-wrap py-1.5",de?"min-h-[24px]":"min-h-[40px]"],O),className:I.mergeClasses("cursor-pointer",xe&&"w-0 min-w-0 flex-none p-0"),onKeyDown:Vn,children:xe})}),n.jsx(Le,{text:u}),!u&&n.jsx(Pe,{text:f})]})]})};var Fn=(e=>(e.None="none",e.Both="both",e.Horizontal="horizontal",e.Vertical="vertical",e))(Fn||{});const Hr={none:"resize-none",both:"resize",horizontal:"resize-x",vertical:"resize-y"},Ll=e=>typeof e=="boolean"?Hr[e?"both":"none"]:Hr[e],Ml=({className:e="",value:t,onChange:r,error:s,containerClassName:a,resize:i=!1,labelProps:o,caption:l,id:c,...d})=>{const u=I.mergeClasses("dial-kit-textarea dial-kit-input px-3 py-2",d.invalid&&"dial-kit-input-error",d.disabled&&"dial-kit-input-disable",Ll(i),e);return n.jsxs("div",{className:I.mergeClasses("flex flex-col gap-2",a),children:[o&&n.jsx(L.Label,{...o,htmlFor:c}),n.jsxs("div",{className:"flex flex-col gap-1",children:[n.jsx("textarea",{id:c,value:t||"",className:u,onChange:f=>r?.(f.currentTarget.value),...d}),n.jsx(Le,{text:s}),!s&&n.jsx(Pe,{text:l})]})]})},Fl=({showPasswordLabel:e="Show password",hidePasswordLabel:t="Hide password",disabled:r,size:s=T.ElementSize.Standard,...a})=>{const[i,o]=h.useState(!1),l=i&&!r;return n.jsx(Ge,{...a,size:s,disabled:r,type:l?"text":"password",iconAfter:n.jsx(L.GhostIconButton,{size:T.ElementSize.Small,disabled:r,"aria-label":l?t:e,"aria-pressed":l,icon:l?n.jsx(H.IconEyeOff,{size:V.DIAL_ICON_SIZE.SM,stroke:ae.DIAL_KIT_ICON_STROKE,"aria-hidden":"true"}):n.jsx(H.IconEye,{size:V.DIAL_ICON_SIZE.SM,stroke:ae.DIAL_KIT_ICON_STROKE,"aria-hidden":"true"}),onClick:()=>o(c=>!c)})})},Bl=/^0+\.(\d+)?$/,zl=/^0+/,$l=[".","-","+","e","E"],Vr=e=>!e||e==="-"?e:String(e).match(Bl)?String(e).replace(zl,"0"):Number(e),Hl=({integer:e,onChange:t,min:r,max:s,onKeyDown:a,onPaste:i,...o})=>{const l=d=>{if(e&&$l.includes(d.key)){d.preventDefault();return}kn(d,"number",r,s),a?.(d)},c=d=>{if(e){const u=d.clipboardData.getData("text"),f=u.replace(/\D/g,"");if(f!==u&&(d.preventDefault(),f)){const g=d.currentTarget,p=g.selectionStart??0,m=g.selectionEnd??0,y=g.value.slice(0,p)+f+g.value.slice(m);t?.(Vr(y))}}i?.(d)};return n.jsx(Ge,{...o,type:"number",min:r,max:s,onChange:d=>t?.(Vr(d)),onKeyDown:l,onPaste:c})},Vl="z-[52] flex items-center justify-center bg-backdrop md:p-4 gap-5 p-6",Gl="relative flex w-full max-h-full flex-col rounded-xl bg-layer-raised md:h-auto",Ul="flex flex-row items-center justify-between px-6 py-4",Kl="flex-1 min-w-0 mr-3 truncate dial-h1-text text-primary",Wl="border-b border-tertiary",ql="flex flex-row items-center gap-2 px-6 py-4",Zl="border-t border-tertiary",Ht="flex shrink-0 flex-row items-center gap-2",Yl={[x.PopupSize.Sm]:"max-w-full md:max-w-[400px]",[x.PopupSize.Md]:"max-w-full md:max-w-[800px]",[x.PopupSize.Lg]:"max-w-full md:max-w-[1200px]"},pr=({open:e=!1,header:t,ariaLabel:r,portalId:s,className:a,overlayClassName:i,titleClassName:o,headerClassName:l,bodyClassName:c,children:d,footer:u,footerClassName:f,onClose:g,onBack:p,backAriaLabel:m="Back",headerActions:y,headerDivider:b=!1,mainButtons:v,additionalButtons:C,additionalButtonsOnLeft:N=!1,footerDivider:S=!1,size:D=x.PopupSize.Md,hideClose:w=!1,closeAriaLabel:R="Close dialog",closeOnOutsideClick:_=!0,preventKeyboardOnOpen:O=!1})=>{const A=F.useThemeScope(),j=h.useRef(null),P=h.useId(),{refs:B,context:G}=le.useFloating({open:e,onOpenChange:K=>{K||g?.(null)}}),ee=le.useRole(G,{role:"dialog"}),$=le.useDismiss(G,{outsidePress:_}),{getFloatingProps:k}=le.useInteractions([ee,$]);if(!e)return null;const z=typeof t=="string"?`popup-heading-${P}`:void 0,q=K=>K?typeof K=="string"?n.jsx("h2",{id:z,className:I.mergeClasses(Kl,o),children:n.jsx(L.Tooltip,{tooltip:K,triggerClassName:"truncate",children:K})}):K:n.jsx("span",{}),X=w?null:n.jsx(L.CloseButton,{ariaLabel:R,onClose:K=>g?.(K)}),ie=(K,re=[])=>re.map(({variant:de=T.ButtonVariant.Neutral,...ue},ce)=>n.jsx(et,{variant:de,...ue},`${K}-${ce}`)),ne=()=>{if(u!==void 0)return u;if(!v?.length&&!C?.length)return null;const K=ie("additional",C);return n.jsxs("div",{className:I.mergeClasses(ql,S&&Zl,f),children:[N&&K.length>0&&n.jsx("div",{className:Ht,children:K}),n.jsxs("div",{className:I.mergeClasses(Ht,"ml-auto"),children:[!N&&K,ie("main",v)]})]})};return n.jsx(le.FloatingPortal,{id:s,children:n.jsx(le.FloatingOverlay,{className:I.mergeClasses(Vl,A,i),children:n.jsx(le.FloatingFocusManager,{context:G,initialFocus:O?j:B.floating,children:n.jsxs("div",{ref:B.setFloating,...k(),role:"dialog","aria-modal":"true","aria-labelledby":z,"aria-label":z?void 0:r,className:I.mergeClasses(Gl,Yl[D],a),children:[O&&n.jsx("div",{ref:j,tabIndex:-1,"aria-hidden":!0,className:"absolute size-px -m-px overflow-hidden opacity-0 pointer-events-none"}),n.jsxs("div",{className:I.mergeClasses(Ul,b&&Wl,l),children:[p&&n.jsx(L.GhostIconButton,{"aria-label":m,size:T.ElementSize.Small,className:"mr-2",onClick:p,icon:n.jsx(H.IconChevronLeft,{size:V.DIAL_ICON_SIZE.SM,stroke:ae.DIAL_KIT_ICON_STROKE,"aria-hidden":"true"})}),q(t),y?n.jsxs("div",{className:Ht,children:[y,X]}):X]}),n.jsx("div",{className:I.mergeClasses("grow overflow-auto",c),children:d}),ne()]})})})})},Xl="flex justify-end gap-2 px-6 py-4 border-t border-tertiary",Ql="text-secondary dial-small-paragraph-text px-6 pb-4",Jl="px-6 py-4 h-[120px]",ec="Cancel",tc="Ok",Vt={[x.ConfirmationPopupVariant.Info]:{confirm:{variant:T.ButtonVariant.Primary,appearance:T.ButtonAppearance.Solid}},[x.ConfirmationPopupVariant.Danger]:{container:"border-t-4 border-error",confirm:{variant:T.ButtonVariant.Danger,appearance:T.ButtonAppearance.Solid}}},rc=({header:e,description:t,descriptionClassName:r,open:s=!1,confirmLabel:a=tc,cancelLabel:i=ec,isLoading:o=!1,disableConfirmButton:l=!1,className:c,confirmClassName:d,onClose:u,onConfirm:f,onCancel:g,children:p,variant:m=x.ConfirmationPopupVariant.Info,size:y=x.PopupSize.Sm,footer:b,hideClose:v,...C})=>{const N=o?null:n.jsxs("div",{className:Xl,children:[n.jsx(fr,{label:i,onClick:()=>g?g():u?.()}),n.jsx(et,{variant:Vt[m].confirm.variant,appearance:Vt[m].confirm.appearance,className:d,label:a,disabled:l,onClick:f})]}),S=h.useCallback(()=>o?n.jsx("div",{className:Jl,children:n.jsx(x.Spinner,{size:40})}):p??(t?n.jsx("div",{className:I.mergeClasses(Ql,r),children:t}):null),[p,t,o,r]);return n.jsx(pr,{...C,open:s,header:e,className:I.mergeClasses(Vt[m].container,c),onClose:()=>u?.(),footer:b??N,size:y,hideClose:v??(!o&&b===void 0),children:S()})},nc=({title:e,description:t,children:r,expanded:s,defaultExpanded:a=!1,disabled:i,nonCollapsible:o,ariaLabel:l,onToggle:c,className:d,headerClassName:u,contentClassName:f})=>{const g=s!==void 0,[p,m]=h.useState(a),y=o?!0:g?s:p,b=h.useId(),v=`accordion-header-${b}`,C=`accordion-content-${b}`,N=()=>{if(i)return;const D=!y;g||m(D),c?.(D)},S=n.jsxs(n.Fragment,{children:[n.jsxs("span",{className:"flex min-w-0 flex-col",children:[n.jsx("span",{className:"truncate dial-body-text text-primary",children:e}),t?n.jsx("span",{className:"truncate dial-tiny-text text-secondary",children:t}):null]}),!o&&n.jsx(H.IconChevronRight,{size:V.DIAL_ICON_SIZE.SM,stroke:ae.DIAL_KIT_ICON_STROKE,"aria-hidden":"true",className:I.mergeClasses("shrink-0 text-secondary transition-transform motion-reduce:transition-none",y&&"rotate-90")})]});return n.jsxs("div",{className:I.mergeClasses("flex flex-col gap-3 py-3 overflow-hidden bg-transparent ",d),children:[o?n.jsx("div",{id:v,className:I.mergeClasses("flex w-full px-4 rounded-xl items-center justify-between dial-tiny-text",u),children:S}):n.jsx("button",{id:v,type:"button","aria-expanded":y,"aria-controls":y?C:void 0,"aria-label":T.resolveAccessibleName(l),disabled:i,onClick:N,className:I.mergeClasses("flex w-full px-4 rounded-xl items-center justify-between dial-tiny-text",i?"cursor-not-allowed opacity-75":"cursor-pointer hover:bg-control-accent-alpha-hover focus-visible:outline focus-visible:outline-focus",u),children:S}),y&&n.jsx("div",{id:C,role:"region","aria-labelledby":v,className:I.mergeClasses("px-4 dial-small-text text-primary",f),children:r})]})},sc=({id:e,labelProps:t,isOn:r=!1,disabled:s,onChange:a,caption:i,className:o,...l})=>{const c=h.useId(),d=e??c,u=i?`${d}-caption`:void 0,f=h.useCallback(g=>{a?.(g.target.checked)},[a]);return n.jsxs("div",{className:"flex flex-col gap-1",children:[n.jsxs("div",{className:I.mergeClasses("flex items-center gap-2",o),children:[n.jsx("input",{...l,type:"checkbox",role:"switch",id:d,checked:r,"aria-checked":r,disabled:s,onChange:f,"aria-label":T.resolveAccessibleName(typeof t?.label!="string"?l["aria-label"]:void 0),"aria-describedby":u,className:"peer sr-only"}),n.jsx("label",{htmlFor:d,className:I.mergeClasses("flex h-[18px] w-[36px] shrink-0 items-center rounded-full p-0.5 transition-colors duration-200","peer-focus-visible:outline peer-focus-visible:outline-offset-2 peer-focus-visible:outline-focus",r?"justify-end":"justify-start",s?"cursor-not-allowed bg-control-disable-primary":I.mergeClasses("cursor-pointer",r?"bg-control-accent hover:bg-control-accent-hover":"bg-control-neutral-default hover:bg-control-neutral-hover-strong")),children:n.jsx("span",{className:I.mergeClasses("size-3.5 shrink-0 rounded-full",s?"bg-control-disable-secondary":"bg-control-neutral")})}),t&&n.jsx(L.Label,{size:T.ElementSize.Standard,...t,htmlFor:d,className:I.mergeClasses("py-[1px]",s?"cursor-not-allowed text-control-disable-primary":"cursor-pointer text-primary",t.className)})]}),i&&n.jsx("span",{id:u,className:"dial-tiny-text text-secondary ml-[44px]",children:i})]})},ac="flex flex-col gap-2",ic="flex",oc="mt-2 ml-[26px]",lc={[x.RadioGroupOrientation.Column]:"flex-col gap-y-3",[x.RadioGroupOrientation.Row]:"flex-row flex-wrap gap-x-4 gap-y-3"},Bn=({items:e,value:t,onChange:r,name:s,id:a,orientation:i=x.RadioGroupOrientation.Column,labelProps:o,disabled:l,error:c,caption:d,ariaLabel:u,className:f,optionsClassName:g,radioClassName:p,contentClassName:m})=>{const y=h.useId(),b=a??y,v=`${b}-label`,C=c?`${b}-error`:void 0,N=!c&&d?`${b}-caption`:void 0,S=T.resolveAccessibleName(o?.label);return n.jsxs("div",{className:I.mergeClasses(ac,f),children:[o&&n.jsx(L.Label,{...o,id:v}),n.jsx("div",{role:"radiogroup","aria-labelledby":S?v:void 0,"aria-label":S?void 0:T.resolveAccessibleName(u),"aria-describedby":[C,N].filter(Boolean).join(" ")||void 0,"aria-disabled":l||void 0,className:I.mergeClasses(ic,lc[i],g),children:e.map(D=>{const w=D.value===t;return n.jsxs("div",{className:"flex min-w-0 flex-col",children:[n.jsx(L.Radio,{id:`${b}-${D.value}`,name:s??b,value:D.value,labelProps:D.label==null?void 0:{label:D.label},"aria-label":D["aria-label"],caption:D.caption,isSelected:w,disabled:l||D.disabled,onChange:r,className:p}),w&&D.content?n.jsx("div",{className:I.mergeClasses(oc,m),children:D.content}):null]},D.value)})}),n.jsx(Le,{id:C,text:c}),!c&&n.jsx(Pe,{id:N,text:d})]})},cc="dial-kit-input flex flex-row items-center justify-between gap-x-2 px-3 text-left",dc="min-w-0 flex-1 truncate text-primary",uc="min-w-0 flex-1 truncate text-secondary",fc="shrink-0 text-secondary",pc="px-6 pb-4",gc="flex justify-end gap-2 px-6 py-4 border-t border-tertiary",hc="Cancel",mc="Apply",xc=({items:e,value:t,customValue:r,header:s,onApply:a,id:i,labelProps:o,placeholder:l,selectedValue:c,onSelectionChange:d,onCancel:u,onClose:f,isValid:g=!0,applyButtonLabel:p=mc,cancelButtonLabel:m=hc,size:y=x.PopupSize.Md,portalId:b,disabled:v,invalid:C,error:N,caption:S,ariaLabel:D,className:w,fieldClassName:R})=>{const _=h.useId(),O=i??_,A=`${O}-label`,j=`${O}-value`,P=N?`${O}-error`:void 0,B=!N&&S?`${O}-caption`:void 0,[G,ee]=h.useState(!1),$=c!==void 0,[k,z]=h.useState(t),q=$?c:k,X=h.useCallback(()=>{v||($||z(t),ee(!0))},[v,$,t]),ie=h.useCallback(()=>{ee(!1),f?.()},[f]),ne=h.useCallback(()=>{u?.(),ie()},[u,ie]),K=h.useCallback(()=>{a(q),ie()},[a,q,ie]),re=h.useCallback(U=>{$||z(U),d?.(U)},[$,d]),de=T.resolveAccessibleName(o?.label),ue=de?void 0:T.resolveAccessibleName(D),ce=de?A:ue&&`${O}-name`,pe=T.resolveAccessibleName(s),ge=e.find(U=>U.value===t)?.label,fe=r??ge;return n.jsxs("div",{className:I.mergeClasses("flex w-full flex-col gap-2",w),children:[o&&n.jsx(L.Label,{...o,id:A,htmlFor:O}),n.jsxs("div",{className:"flex flex-col gap-1",children:[ue&&n.jsx("span",{id:ce,className:"sr-only",children:ue}),n.jsxs("button",{type:"button",id:O,disabled:v,"aria-haspopup":"dialog","aria-expanded":G,"aria-labelledby":ce?`${ce} ${j}`:void 0,"aria-describedby":[P,B].filter(Boolean).join(" ")||void 0,onClick:X,className:I.mergeClasses(cc,C&&"dial-kit-input-error",v&&"dial-kit-input-disable",R),children:[n.jsx("span",{id:j,className:fe==null?uc:dc,children:fe??l}),n.jsx(H.IconMaximize,{size:V.DIAL_ICON_SIZE.MD,stroke:ae.DIAL_KIT_ICON_STROKE,"aria-hidden":"true",className:fc})]}),n.jsx(Le,{id:P,text:N}),!N&&n.jsx(Pe,{id:B,text:S})]}),n.jsx(pr,{open:G,header:s,ariaLabel:pe?void 0:de,portalId:b,size:y,onClose:ne,footer:n.jsxs("div",{className:gc,children:[n.jsx(fr,{label:m,onClick:ne}),n.jsx(_n,{label:p,disabled:!g,onClick:K})]}),children:n.jsx("div",{className:pc,children:n.jsx(Bn,{id:`${O}-options`,items:e,value:q,onChange:re,orientation:x.RadioGroupOrientation.Column,ariaLabel:de??pe})})})]})},bc=({icon:e,selectedIcon:t,isSelected:r=!1,onToggle:s,onClick:a,tooltipProps:i,size:o=T.ElementSize.Small,className:l,...c})=>{const d=h.useCallback(f=>{a?.(f),s?.(!r)},[a,s,r]),u=n.jsx(L.IconButton,{...c,size:o,variant:T.ButtonVariant.Primary,appearance:T.ButtonAppearance.Ghost,icon:r?t??e:e,"aria-pressed":r,"aria-label":T.resolveAccessibleName(c["aria-label"],i?.tooltip),onClick:d,className:I.mergeClasses("!rounded","[&_svg]:size-4",r&&"!text-accent",l)});return i?n.jsx(L.Tooltip,{asChild:!0,...i,children:u}):u},vc=["ArrowRight","ArrowLeft","ArrowUp","ArrowDown","Home","End"],yc="inline-flex w-fit items-center gap-1 rounded-full border border-tertiary bg-layer-sunken p-[3px]",Dc="flex h-8 min-w-8 grow shrink-0 basis-auto items-center justify-center gap-2 whitespace-nowrap rounded-full px-4 dial-small-text transition-colors duration-200 outline-offset-0 focus-visible:outline focus-visible:outline-focus",Cc="bg-layer-raised text-accent shadow-xs",Nc="bg-transparent text-secondary",Ic="cursor-pointer hover:bg-control-accent-alpha-hover active:bg-control-accent-alpha-active",Sc="cursor-pointer hover:bg-control-accent-alpha-hover hover:text-accent active:bg-control-accent-alpha-active",jc="cursor-not-allowed bg-control-disable-primary text-control-disable-primary shadow-none",Tc="cursor-not-allowed bg-transparent text-control-disable-primary",wc=({items:e,value:t,onChange:r,disabled:s,className:a,segmentClassName:i,"aria-label":o})=>{const l=h.useRef({}),c=e.find(f=>f.value===t),d=c&&!c.disabled?c.value:e.find(f=>!f.disabled)?.value,u=h.useCallback(f=>{if(s||!vc.includes(f.key))return;const g=e.filter(v=>!v.disabled);if(g.length===0)return;const p=Math.max(g.findIndex(v=>v.value===t),0),m=g.length-1;let y=p;switch(f.key){case"ArrowRight":case"ArrowDown":y=p===m?0:p+1;break;case"ArrowLeft":case"ArrowUp":y=p===0?m:p-1;break;case"Home":y=0;break;case"End":y=m;break}f.preventDefault();const b=g[y];l.current[b.value]?.focus(),b.value!==t&&r(b.value)},[s,e,t,r]);return n.jsx("div",{role:"radiogroup","aria-label":o,"aria-disabled":s||void 0,onKeyDown:u,className:I.mergeClasses(yc,a),children:e.map(f=>{const g=f.value===t,p=s||f.disabled;return n.jsxs("button",{ref:m=>{l.current[f.value]=m},type:"button",role:"radio","aria-checked":g,"aria-label":T.resolveAccessibleName(f["aria-label"],typeof f.label=="string"?f.label:void 0),tabIndex:f.value===d?0:-1,disabled:p,onClick:()=>r(f.value),className:I.mergeClasses(Dc,g?Cc:Nc,p?g?jc:Tc:g?Ic:Sc,i),children:[f.icon,f.label]},f.value)})})},Ec=["ArrowRight","ArrowLeft","Home","End"],Oc=({tabs:e,activeTabId:t,onTabChange:r,ariaLabel:s,className:a,tabClassName:i})=>{const o=h.useRef({}),l=e.find(u=>u.id===t),c=l&&!l.disabled?l.id:e.find(u=>!u.disabled)?.id,d=h.useCallback(u=>{if(!Ec.includes(u.key)||e.length===0)return;const f=e.filter(b=>!b.disabled);if(f.length===0)return;const g=Math.max(f.findIndex(b=>b.id===t),0),p=f.length-1;let m=g;switch(u.key){case"ArrowRight":m=g===p?0:g+1;break;case"ArrowLeft":m=g===0?p:g-1;break;case"Home":m=0;break;case"End":m=p;break}u.preventDefault();const y=f[m];o.current[y.id]?.focus(),y.id!==t&&r(y.id)},[e,t,r]);return n.jsx("div",{role:"tablist","aria-label":s,onKeyDown:d,className:I.mergeClasses("flex justify-start gap-1",a),children:e.map(u=>{const f=t===u.id,g=!!u.disabled;return n.jsxs("button",{ref:p=>{o.current[u.id]=p},type:"button",role:"tab","aria-selected":f,disabled:g,tabIndex:u.id===c?0:-1,onClick:()=>r(u.id),className:I.mergeClasses("dial-small-paragraph-semi-text dial-kit-enhanced-target","border-b-2 border-transparent flex items-center gap-2 px-3 py-2 text-start","transition-colors motion-reduce:transition-none","focus-visible:outline focus-visible:outline-offset-2 focus-visible:outline-focus",g&&"cursor-not-allowed border-control-disable-primary text-control-disable-primary",!g&&(f?"dial-kit-tab-selected-underline text-primary":"border-transparent text-secondary"),i),children:[n.jsx("span",{children:u.label}),u.count!=null&&n.jsx("span",{className:I.mergeClasses("dial-tiny-semi-text rounded-full px-1.5 py-0.5",g&&"bg-layer-sunken text-control-disable-primary",!g&&(f?"bg-control-accent-alpha text-accent":"bg-layer-sunken text-secondary")),children:u.count})]},u.id)})})},Qt=(e,t)=>{const r=(t??"").split(",").map(i=>i.trim().toLowerCase()).filter(Boolean);if(r.length===0)return!0;const s=e.name.toLowerCase(),a=e.type.toLowerCase();return r.some(i=>{if(i.startsWith("."))return s.endsWith(i);if(i.endsWith("/*")){const o=i.slice(0,-1);return a.length>o.length&&a.startsWith(o)}return a===i})},Ac=({labelProps:e,label:t,description:r,onChange:s,onReject:a,accept:i,multiple:o=!1,disabled:l=!1,errorText:c,icon:d,id:u,ariaLabel:f,className:g})=>{const p=h.useId(),m=u??`file-dropzone-${p}`,y=c?`${m}-error`:void 0,[b,v]=h.useState(!1),C=h.useRef(0),N=h.useCallback(A=>{if(A.length===0)return;const j=o?A:A.slice(0,1),P=j.filter(G=>Qt(G,i)),B=j.filter(G=>!Qt(G,i));B.length>0&&a?.(B),P.length>0&&s(P)},[i,o,s,a]),S=h.useCallback(A=>{N(Array.from(A.target.files??[])),A.target.value=""},[N]),D=h.useCallback(()=>{C.current=0,v(!1)},[]),w=h.useCallback(A=>{l||(A.preventDefault(),C.current+=1,v(!0))},[l]),R=h.useCallback(A=>{l||(A.preventDefault(),A.dataTransfer.dropEffect="copy")},[l]),_=h.useCallback(()=>{l||(C.current-=1,C.current<=0&&D())},[l,D]),O=h.useCallback(A=>{A.preventDefault(),!l&&(D(),N(Array.from(A.dataTransfer?.files??[])))},[l,D,N]);return n.jsxs("div",{className:"flex flex-col gap-1",children:[e&&n.jsx(L.Label,{...e,htmlFor:m}),n.jsx("input",{id:m,type:"file",accept:i,multiple:o,disabled:l,onChange:S,"aria-label":T.resolveAccessibleName(typeof t!="string"?f:void 0),"aria-describedby":y,"aria-invalid":c?!0:void 0,className:"peer sr-only"}),n.jsxs("label",{htmlFor:m,onDragEnter:w,onDragOver:R,onDragLeave:_,onDrop:O,className:I.mergeClasses("flex flex-col items-center justify-center gap-3 rounded-xl border border-dashed px-6 py-10 text-center","transition-colors motion-reduce:transition-none","peer-focus-visible:outline peer-focus-visible:outline-offset-2 peer-focus-visible:outline-focus",l?"cursor-not-allowed border-secondary bg-layer-sunken":"cursor-pointer bg-layer-base",!l&&b&&"border-accent bg-control-accent-alpha",!l&&!b&&"border-secondary hover:border-accent",c&&!b&&"border-error hover:border-error",g),children:[d??n.jsx(H.IconUpload,{size:V.DIAL_ICON_SIZE.LG,stroke:ae.DIAL_KIT_ICON_STROKE,"aria-hidden":"true",className:l?"text-control-disable-primary":"text-secondary"}),n.jsxs("span",{className:"flex flex-col gap-1",children:[n.jsx("span",{className:I.mergeClasses("dial-small-text",l?"text-control-disable-primary":"text-primary"),children:t}),r&&n.jsx("span",{className:I.mergeClasses("dial-tiny-text",l?"text-control-disable-primary":"text-secondary"),children:r})]})]}),n.jsx(Le,{id:y,text:c})]})},_c=({availableWidth:e,tagWidths:t,overflowChipWidth:r,gap:s})=>{if(e<=0)return t.length;let a=0,i=0;for(const o of t){const l=o+s;if(a+l>e)break;a+=l,i++}if(i===t.length)return i;for(;i>0&&a+r>e;)i--,a-=t[i]+s;return i},Rc=4,kc=24,Gr=e=>parseFloat(e)||0,Pc=e=>{let t=e.length;for(;t>0&&e[t-1]===",";)t--;return e.slice(0,t)},Lc=()=>{},Mc=({id:e,value:t,defaultValue:r,size:s=T.ElementSize.Standard,labelProps:a,placeholder:i,caption:o,error:l,invalid:c,disabled:d=!1,readOnly:u=!1,collapseTagOverflow:f=!1,ariaLabel:g,tagListLabel:p="Tags",className:m,fieldClassName:y,tagClassName:b,onChange:v})=>{const C=h.useId(),N=e||C,S=s===T.ElementSize.Small,D=h.useRef(null),w=h.useRef([]),R=h.useRef(null),_=t!==void 0,[O,A]=h.useState(r??[]),j=_?t:O,P=j.length,[B,G]=h.useState(""),[ee,$]=h.useState(P),k=!u&&!d,z=h.useCallback(U=>{_||A(U),v?.(U)},[_,v]),q=h.useCallback(U=>Y=>{w.current[U]=Y},[]),X=h.useCallback(()=>{const U=D.current;if(!U||U.clientWidth===0){$(j.length);return}const{paddingLeft:Y,paddingRight:Ne}=getComputedStyle(U);$(_c({availableWidth:U.clientWidth-Gr(Y)-Gr(Ne)-(u?0:kc),tagWidths:j.map((Me,he)=>w.current[he]?.offsetWidth??0),overflowChipWidth:R.current?.offsetWidth??0,gap:Rc}))},[u,j]);h.useEffect(()=>{if(!f){$(P);return}const U=D.current;if(!U)return;const Y=new ResizeObserver(()=>X());return Y.observe(U),X(),()=>Y.disconnect()},[f,X,P]);const ie=I.mergeClasses(f?"shrink-0":"min-w-0",b),ne=U=>{const Y=Pc(U.trim()).trim();!Y||j.includes(Y)||z([...j,Y])},K=U=>{z(j.filter(Y=>Y!==U))},re=()=>{ne(B),G("")},de=U=>{if(k){if(U.key==="Enter"||U.key===","){U.preventDefault(),re();return}U.key==="Backspace"&&!B&&P>0&&(U.preventDefault(),z(j.slice(0,-1)))}},ue=()=>{k&&B.trim()&&re()},ce=f?j.slice(0,ee):j,pe=f?j.slice(ee):[],ge=pe.join(", "),fe=P>0&&n.jsxs("span",{role:"list","aria-label":p,className:I.mergeClasses("relative flex min-w-0 items-center gap-1",f?"flex-nowrap":"flex-wrap"),children:[ce.map(U=>n.jsx(Ze,{role:"listitem",label:U,className:ie,disabled:d,closable:k,onRemove:k?()=>K(U):void 0},U)),pe.length>0&&n.jsx(Ze,{role:"listitem",label:`+${pe.length}`,"aria-label":ge,title:ge,className:I.mergeClasses("shrink-0",b),disabled:d}),f&&n.jsxs("span",{"aria-hidden":"true",className:"pointer-events-none invisible absolute left-0 top-0 h-0 overflow-hidden whitespace-nowrap",children:[j.map((U,Y)=>n.jsx("span",{ref:q(Y),className:"inline-flex",children:n.jsx(Ze,{label:U,className:b,disabled:d,closable:k,onRemove:k?Lc:void 0})},U)),n.jsx("span",{ref:R,className:"inline-flex",children:n.jsx(Ze,{label:`+${P}`,className:b})})]})]});return n.jsx(Ge,{id:N,size:s,labelProps:a,caption:o,error:l,invalid:c,disabled:d,readOnly:u,value:B,placeholder:P>0?void 0:i,"aria-label":g,wrapperRef:D,onChange:U=>G(U??""),onKeyDown:de,onBlur:ue,containerClassName:I.mergeClasses("w-full",m),wrapperClassName:I.mergeClasses(P>0&&["!h-auto",S?"min-h-[24px] py-0.5":"min-h-[40px] py-1.5",f?"flex-nowrap overflow-hidden":"flex-wrap"],y),className:I.mergeClasses("w-auto flex-1",f?"min-w-[24px]":"min-w-[100px]",u&&"cursor-default"),children:fe})},Fc={[T.ElementSize.Small]:V.DIAL_ICON_SIZE.SM,[T.ElementSize.Standard]:V.DIAL_ICON_SIZE.MD,[T.ElementSize.Large]:V.DIAL_ICON_SIZE.MD},Bc=({size:e=T.ElementSize.Standard,placeholder:t="Search...",withoutBorder:r=!1,clearLabel:s="Clear search",disabled:a,value:i,onChange:o,wrapperClassName:l,inputRef:c,...d})=>{const u=h.useRef(null),f=le.useMergeRefs([c,u]),g=!!i&&!a,p=h.useCallback(()=>{o?.(void 0),u.current?.focus()},[o]);return n.jsx(Ge,{...d,size:e,value:i,disabled:a,onChange:o,placeholder:t,inputRef:f,wrapperClassName:I.mergeClasses(r&&"dial-kit-input-borderless",l),iconBefore:n.jsx(H.IconSearch,{size:Fc[e],stroke:ae.DIAL_KIT_ICON_STROKE,className:"text-secondary","aria-hidden":"true"}),iconAfter:g?n.jsx(L.GhostIconButton,{size:T.ElementSize.Small,"aria-label":s,icon:n.jsx(H.IconX,{size:V.DIAL_ICON_SIZE.SM,stroke:ae.DIAL_KIT_ICON_STROKE,"aria-hidden":"true"}),onClick:p}):void 0})},zc=16,$c=e=>(e.toString().split(".")[1]??"").length,Hc=({id:e,value:t,min:r=0,max:s=1,step:a=.1,disabled:i,labelProps:o,labels:l,formatValue:c,showValue:d=!1,caption:u,error:f,onChange:g,containerClassName:p,trackClassName:m,fillClassName:y,className:b,...v})=>{const C=h.useId(),N=e??C,S=u&&!f?`${N}-caption`:void 0,D=f?`${N}-error`:void 0,w=s-r,R=w>0?Math.min(100,Math.max(0,(t-r)/w*100)):0,_=`calc(${R}% + ${(.5-R/100)*zc}px)`,O=c?c(t):t.toFixed($c(a)),A=h.useCallback(j=>{g?.(Number(j.target.value))},[g]);return n.jsxs("div",{className:I.mergeClasses("flex flex-col gap-2",p),children:[(o||d)&&n.jsxs("div",{className:"flex items-center gap-2",children:[o&&n.jsx(L.Label,{...o,htmlFor:N}),d&&n.jsx("span",{"aria-hidden":"true",className:I.mergeClasses("dial-small-text ml-auto",i?"text-control-disable-primary":"text-primary"),children:O})]}),n.jsxs("div",{className:"flex flex-col gap-1",children:[n.jsxs("div",{className:"relative flex h-6 items-center",children:[n.jsx("div",{className:I.mergeClasses("pointer-events-none absolute inset-x-0 h-1 rounded-full",i?"bg-control-disable-primary":"bg-control-neutral-active",m)}),n.jsx("div",{className:I.mergeClasses("pointer-events-none absolute left-0 h-1 rounded-full",i?"bg-control-disable-secondary":"bg-control-accent",y),style:{width:_}}),n.jsx("input",{...v,type:"range",id:N,value:t,min:r,max:s,step:a,disabled:i,onChange:A,"aria-label":T.resolveAccessibleName(typeof o?.label!="string"?v["aria-label"]:void 0),"aria-valuetext":c?O:void 0,"aria-describedby":D??S,className:I.mergeClasses("dial-kit-slider absolute inset-0 h-full w-full",b)})]}),l&&n.jsx("div",{className:"dial-tiny-text flex text-secondary",children:l.length===3?n.jsxs(n.Fragment,{children:[n.jsx("span",{children:l[0]}),n.jsx("span",{className:"flex-1 text-center",children:l[1]}),n.jsx("span",{children:l[2]})]}):n.jsxs(n.Fragment,{children:[n.jsx("span",{children:l[0]}),n.jsx("span",{className:"ml-auto",children:l[1]})]})}),n.jsx(Le,{id:D,text:f}),!f&&n.jsx(Pe,{id:S,text:u})]})]})},Vc=48,Gc=({children:e,title:t,width:r=280,collapsedWidth:s=Vc,isOpened:a,defaultOpened:i=!0,onToggle:o,additionalButtons:l,ariaLabel:c="Sidebar",collapseLabel:d="Collapse sidebar",expandLabel:u="Expand sidebar",className:f,titleClassName:g,contentClassName:p,footerClassName:m})=>{const y=a!==void 0,[b,v]=h.useState(i),C=y?a:b,N=`collapsible-sidebar-content-${h.useId()}`,S=C?d:u,D=w=>{const R=!C;y||v(R),o?.(R,w)};return n.jsxs("aside",{"aria-label":c,style:{width:`${C?r:s}px`},className:I.mergeClasses("flex flex-col justify-between",f),children:[n.jsx("div",{id:N,hidden:!C,className:I.mergeClasses("min-h-0 flex-1 overflow-auto p-4",p),children:e}),n.jsx("div",{hidden:C,className:I.mergeClasses("rotate-180 px-3 py-4 [writing-mode:tb-rl] dial-small-text text-primary",g),children:t}),n.jsxs("div",{className:I.mergeClasses("flex h-12 shrink-0 flex-row items-center gap-2 border-t border-tertiary py-1",C?"justify-end px-2":"justify-center",m),children:[C&&l,n.jsx(L.IconButton,{variant:T.ButtonVariant.Primary,appearance:T.ButtonAppearance.Ghost,size:T.ElementSize.Standard,onClick:D,"aria-label":S,"aria-expanded":C,"aria-controls":N,tooltipProps:{tooltip:S},icon:C?n.jsx(H.IconChevronsLeft,{size:V.DIAL_ICON_SIZE.MD,stroke:ae.DIAL_KIT_ICON_STROKE,"aria-hidden":"true"}):n.jsx(H.IconChevronsRight,{size:V.DIAL_ICON_SIZE.MD,stroke:ae.DIAL_KIT_ICON_STROKE,"aria-hidden":"true"})})]})]})},Uc=({side:e,isResizing:t,width:r,minWidth:s,maxWidth:a,step:i,ariaLabel:o,onWidthChange:l,customHandler:c,handlerClassName:d})=>{const u=e===x.ResizableContainerSide.Left,f=u?H.IconChevronLeft:H.IconChevronRight,g=p=>{let m;switch(p.key){case"ArrowLeft":m=r+(u?i:-i);break;case"ArrowRight":m=r+(u?-i:i);break;case"Home":m=s;break;case"End":m=a;break;default:return}p.preventDefault(),l(m)};return n.jsx("div",{role:"separator","aria-orientation":"vertical","aria-label":o,"aria-valuenow":r,"aria-valuemin":s,"aria-valuemax":a,tabIndex:0,onKeyDown:g,className:I.mergeClasses("relative h-full w-0.5 cursor-col-resize bg-control-accent text-accent","opacity-0 transition-opacity motion-reduce:transition-none","group-hover:opacity-100 focus-visible:opacity-100","focus-visible:outline focus-visible:outline-offset-2 focus-visible:outline-focus",t&&"opacity-100",d),children:c??n.jsx(f,{size:V.DIAL_ICON_SIZE.MD,stroke:ae.DIAL_KIT_ICON_STROKE,"aria-hidden":"true",className:I.mergeClasses("pointer-events-none absolute top-1/2 -translate-y-1/2",u?"right-full":"left-full")})})},Kc=16,zn=({children:e,minWidth:t,maxWidth:r,width:s,defaultWidth:a,onResizeStop:i,onResize:o,side:l=x.ResizableContainerSide.Right,keyboardStep:c=Kc,ariaLabel:d="Resize panel",className:u,resizeHandlerClassName:f,resizeHandler:g})=>{const[p,m]=h.useState(!1),[y,b]=h.useState(a??t),v=s!==void 0,C=v?s:y,N=h.useRef(null),S=h.useCallback(()=>{m(!0)},[]),D=h.useCallback(()=>{m(!1);const _=N.current?.resizable?.getBoundingClientRect(),O=_?Math.round(_.width):t;v||b(O),i?.(O)},[i,v,t]),w=h.useCallback(_=>{const O=Math.min(r,Math.max(t,_));O!==C&&(v||(b(O),N.current?.updateSize({width:O,height:"100%"})),o?.(O),i?.(O))},[r,t,C,v,o,i]),R=h.useMemo(()=>{const _=l===x.ResizableContainerSide.Left,O=n.jsx(Uc,{side:l,isResizing:p,width:C,minWidth:t,maxWidth:r,step:c,ariaLabel:d,onWidthChange:w,customHandler:g,handlerClassName:f});return{size:v?{width:C,height:"100%"}:void 0,defaultSize:v?void 0:{width:C,height:"100%"},minWidth:t,maxWidth:r,enable:{left:_,right:!_},handleClasses:{right:"group",left:"group"},handleStyles:{right:{right:"-8px",zIndex:10},left:{left:0,zIndex:10}},handleComponent:{left:_?O:void 0,right:_?void 0:O},onResizeStart:S,onResize:(A,j,P)=>{o?.(Math.round(P.offsetWidth))},onResizeStop:D}},[l,v,C,t,r,c,d,w,g,f,p,S,D,o]);return n.jsx(x.Resizable,{ref:N,...R,children:n.jsx("div",{className:I.mergeClasses("group flex size-full flex-col bg-layer-raised transition-all motion-reduce:transition-none",u),children:e})})},Wc=({enabled:e=!0,children:t,...r})=>e?n.jsx(zn,{...r,children:t}):t;exports.ConfirmationPopupVariant=x.ConfirmationPopupVariant;exports.DialBreadcrumb=x.DialBreadcrumb;exports.DialBreadcrumbItem=x.DialBreadcrumbItem;exports.DialButton=x.DialButton;exports.DialButtonDropdown=x.DialButtonDropdown;exports.DialCaptionText=x.DialCaptionText;exports.DialCollapsibleSidebar=x.DialCollapsibleSidebar;exports.DialConditionalResizableContainer=x.DialConditionalResizableContainer;exports.DialConfirmationPopup=x.DialConfirmationPopup;exports.DialDangerButton=x.DialDangerButton;exports.DialDestinationFolderPopup=x.DialDestinationFolderPopup;exports.DialErrorText=x.DialErrorText;exports.DialFileIcon=x.DialFileIcon;exports.DialFileManager=x.DialFileManager;exports.DialFileManagerActions=x.DialFileManagerActions;exports.DialFileManagerTabs=x.DialFileManagerTabs;exports.DialFileName=x.DialFileName;exports.DialFileNodeType=x.DialFileNodeType;exports.DialFilePermission=x.DialFilePermission;exports.DialFileResourceType=x.DialFileResourceType;exports.DialFolderName=x.DialFolderName;exports.DialFoldersTree=x.DialFoldersTree;exports.DialFormItem=x.DialFormItem;exports.DialGhostButton=x.DialGhostButton;exports.DialInput=x.DialInput;exports.DialItemType=x.DialItemType;exports.DialLinkButton=x.DialLinkButton;exports.DialLoader=x.DialLoader;exports.DialNeutralButton=x.DialNeutralButton;exports.DialNotification=x.DialNotification;exports.DialPopup=x.DialPopup;exports.DialPrimaryButton=x.DialPrimaryButton;exports.DialRadioGroup=x.DialRadioGroup;exports.DialResizableContainer=x.DialResizableContainer;exports.DialSearch=x.DialSearch;exports.DialSharedEntityIndicator=x.DialSharedEntityIndicator;exports.DialTabs=x.DialTabs;exports.EDITABLE_CONTAINER_ATTRIBUTE=x.EDITABLE_CONTAINER_ATTRIBUTE;exports.FileManagerColumnKey=x.FileManagerColumnKey;exports.FileManagerProvider=x.FileManagerProvider;exports.FlexibleActionsDirection=x.FlexibleActionsDirection;exports.FormItemOrientation=x.FormItemOrientation;exports.NAME_COLUMN=x.NAME_COLUMN;exports.NOT_ALLOWED_SPACES=x.NOT_ALLOWED_SPACES;exports.NOT_ALLOWED_SPACES_REGEXP=x.NOT_ALLOWED_SPACES_REGEXP;exports.NOT_ALLOWED_SYMBOLS=x.NOT_ALLOWED_SYMBOLS;exports.NOT_ALLOWED_SYMBOLS_REGEXP=x.NOT_ALLOWED_SYMBOLS_REGEXP;exports.NotificationType=x.NotificationType;exports.NotificationVariant=x.NotificationVariant;exports.PopupSize=x.PopupSize;exports.RadioGroupOrientation=x.RadioGroupOrientation;exports.ResizableContainerSide=x.ResizableContainerSide;exports.SIZE_COLUMN=x.SIZE_COLUMN;exports.ScreenResolution=x.ScreenResolution;exports.Skeleton=x.Skeleton;exports.SkeletonAvatarShape=x.SkeletonAvatarShape;exports.SkeletonAvatarSize=x.SkeletonAvatarSize;exports.SkeletonVariant=x.SkeletonVariant;exports.Spinner=x.Spinner;exports.TabOrientation=x.TabOrientation;exports.TabView=x.TabView;exports.UPDATED_AT_COLUMN=x.UPDATED_AT_COLUMN;exports.editableContainerProps=x.editableContainerProps;exports.useDialFileManagerTabs=x.useDialFileManagerTabs;exports.useEditableItem=x.useEditableItem;exports.useFileManagerContext=x.useFileManagerContext;exports.DialLabel=Ae.DialLabel;exports.DialSwitch=Ae.DialSwitch;exports.DEFAULT_GRID_DATE_FORMAT_OPTIONS=F.DEFAULT_DATE_FORMAT_OPTIONS;exports.DEFAULT_GRID_DATE_LOCALE=F.DEFAULT_LOCALE;exports.DialCloseButton=F.DialCloseButton;exports.DialDangerIconButton=F.DialDangerIconButton;exports.DialDateCellRenderer=F.DialDateCellRenderer;exports.DialDropdown=F.DialDropdown;exports.DialEllipsisTooltip=F.DialEllipsisTooltip;exports.DialGhostIconButton=F.DialGhostIconButton;exports.DialGrid=F.DialGrid;exports.DialIcon=F.DialIcon;exports.DialNeutralIconButton=F.DialNeutralIconButton;exports.DialNoDataContent=F.DialNoDataContent;exports.DialPrimaryIconButton=F.DialPrimaryIconButton;exports.DialRadioButton=F.DialRadioButton;exports.DialSecondaryIconButton=F.DialSecondaryIconButton;exports.DialSuccessIconButton=F.DialSuccessIconButton;exports.DialTertiaryIconButton=F.DialTertiaryIconButton;exports.DropdownItemType=F.DropdownItemType;exports.DropdownTrigger=F.DropdownTrigger;exports.DropdownType=F.DropdownType;exports.GridSelectionMode=F.GridSelectionMode;exports.ThemeScope=F.ThemeScope;exports.baseColumnComparator=F.baseColumnComparator;exports.checkColDefsChanges=F.checkColDefsChanges;exports.convertGridDateToDate=F.convertToDate;exports.convertToDate=F.convertToDate;exports.useThemeScope=F.useThemeScope;exports.BASE_ICON_PROPS=V.BASE_ICON_PROPS;exports.BASE_ICON_SIZE=V.BASE_ICON_SIZE;exports.DIAL_ICON_SIZE=V.DIAL_ICON_SIZE;exports.mergeClasses=I.mergeClasses;exports.Checkbox=L.Checkbox;exports.CheckboxBox=L.CheckboxBox;exports.CloseButton=L.CloseButton;exports.DEFAULT_DATE_FORMAT_OPTIONS=L.DEFAULT_DATE_FORMAT_OPTIONS;exports.DEFAULT_DATE_LOCALE=L.DEFAULT_LOCALE;exports.DangerIconButton=L.DangerIconButton;exports.DateCellRenderer=L.DateCellRenderer;exports.Dropdown=L.Dropdown;exports.EllipsisTooltip=L.EllipsisTooltip;exports.GRID_ALIGN_RIGHT_CLASS=L.GRID_ALIGN_RIGHT_CLASS;exports.GRID_ROOT_CLASS=L.GRID_ROOT_CLASS;exports.GRID_ROW_HEIGHT=L.ROW_HEIGHT;exports.GRID_SELECTION_COLUMN_ID=L.GRID_SELECTION_COLUMN_ID;exports.GRID_THEME_PARAMS=L.GRID_THEME_PARAMS;exports.GhostIconButton=L.GhostIconButton;exports.Grid=L.Grid;exports.IconButton=L.IconButton;exports.InfoButton=L.InfoButton;exports.InteractiveTooltip=L.InteractiveTooltip;exports.Label=L.Label;exports.MenuItem=L.MenuItem;exports.MenuItemMark=L.MenuItemMark;exports.NeutralIconButton=L.NeutralIconButton;exports.NoDataContent=L.NoDataContent;exports.PrimaryIconButton=L.PrimaryIconButton;exports.Radio=L.Radio;exports.StaticIconButton=L.StaticIconButton;exports.Tooltip=L.Tooltip;exports.TooltipContainer=L.TooltipContainer;exports.TooltipContent=L.TooltipContent;exports.TooltipPlacement=L.TooltipPlacement;exports.TooltipTrigger=L.TooltipTrigger;exports.ButtonAppearance=T.ButtonAppearance;exports.ButtonVariant=T.ButtonVariant;exports.DialIconButton=T.DialIconButton;exports.DialTooltip=T.DialTooltip;exports.DialTooltipContainer=T.DialTooltipContainer;exports.DialTooltipContent=T.DialTooltipContent;exports.DialTooltipTrigger=T.DialTooltipTrigger;exports.ElementSize=T.ElementSize;exports.EditorThemes=ot.EditorThemes;exports.LazyDialJsonEditor=ot.LazyDialJsonEditor;exports.LazyDialMarkdownEditor=ot.LazyDialMarkdownEditor;exports.LazyMarkdownEditor=ot.LazyMarkdownEditor;exports.DIAL_KIT_ICON_STROKE=ae.DIAL_KIT_ICON_STROKE;exports.Accordion=nc;exports.AnalyticsCardVariant=st;exports.Button=et;exports.ButtonDropdown=fl;exports.Calendar=sl;exports.CalendarMode=be;exports.CaptionText=Pe;exports.CardShell=Oo;exports.CollapsibleSidebar=Gc;exports.ConditionalResizableContainer=Wc;exports.ConfirmationPopup=rc;exports.DEFAULT_ANALYTICS_BAR_COLOR_MAP=er;exports.DangerButton=il;exports.DialAccordion=Ur;exports.DialAnalyticsBar=ut;exports.DialAnalyticsBarGroup=Qn;exports.DialAnalyticsCard=Zn;exports.DialAnalyticsErrorTag=Jt;exports.DialAnalyticsHistogram=ns;exports.DialAutocompleteInputValue=on;exports.DialCheckbox=Gt;exports.DialDraggableItem=xi;exports.DialDropdownIcon=oo;exports.DialFormPopup=Oi;exports.DialInputPopup=ln;exports.DialLabelledText=hs;exports.DialLoadFileArea=xn;exports.DialLoadFileAreaField=io;exports.DialNumberInput=Zt;exports.DialPagination=cs;exports.DialPasswordInput=cn;exports.DialRadioGroupPopupField=ji;exports.DialRemoveButton=It;exports.DialSchemaRenderer=No;exports.DialSegmentedControl=Ii;exports.DialSelect=ke;exports.DialSelectField=Hi;exports.DialSlider=gs;exports.DialSteps=ps;exports.DialTag=He;exports.DialTagInput=an;exports.DialTextarea=bi;exports.ErrorMessageNotification=Mo;exports.ErrorText=Le;exports.ErrorToastNotification=Ao;exports.FabButton=dl;exports.FileDropzone=Ac;exports.FolderPath=al;exports.GeneralMessageNotification=Ho;exports.GeneralToastNotification=Lo;exports.GhostButton=ll;exports.Highlight=Eo;exports.InfoMessageNotification=Fo;exports.InfoToastNotification=_o;exports.InlineSelect=pl;exports.InlineSelectTrigger=Rn;exports.Input=Ge;exports.JsonSchemaType=J;exports.LinkButton=ol;exports.LoadingMessageNotification=$o;exports.LoadingToastNotification=Po;exports.MultiSelectTags=Mn;exports.NeutralButton=fr;exports.Notification=cr;exports.NumberInput=Hl;exports.OutlinedButton=cl;exports.PasswordInput=Fl;exports.Popup=pr;exports.PrimaryButton=_n;exports.ProgressBar=ss;exports.RadioGroup=Bn;exports.RadioGroupPopupField=xc;exports.ResizableContainer=zn;exports.SchemaDisplayMode=at;exports.SchemaOrientation=jt;exports.SchemaRendererVariant=qe;exports.Search=Bc;exports.SegmentedControl=wc;exports.Select=Pl;exports.SelectSize=ht;exports.SelectVariant=mt;exports.Slider=Hc;exports.StepStatus=ve;exports.SuccessMessageNotification=Bo;exports.SuccessToastNotification=Ro;exports.Switch=sc;exports.Tabs=Oc;exports.Tag=Ze;exports.TagAppearance=Ye;exports.TagInput=Mc;exports.Textarea=Ml;exports.TextareaResize=Fn;exports.ToggleIconButton=bc;exports.WarningMessageNotification=zo;exports.WarningToastNotification=ko;exports.matchesAccept=Qt;exports.wrapInRootFolder=go;