@epam/ai-dial-ui-kit 0.15.0-dev.31 → 0.15.0-dev.36

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 C=require("./use-file-manager-tabs-C0h1Sq5T.cjs"),ke=require("./Switch-DE6MrcqJ.cjs"),n=require("react/jsx-runtime"),h=require("react"),F=require("@tabler/icons-react"),oe=require("classnames"),T=require("./DateCellRenderer-BFEh4rXZ.cjs"),z=require("./icon-CrGVkVpG.cjs"),I=require("./merge-classes-BEJXjzkx.cjs"),R=require("./DateCellRenderer-J1V3xwF7.cjs"),E=require("./IconButton-DHOFapLo.cjs"),ps=require("react-dom"),ft=require("./lazy-BEsZqouS.cjs"),de=require("@floating-ui/react"),ne=require("./icon-DhjrDQ8I.cjs");function gs(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 Sr=gs(h),Ke=({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(T.DialIcon,{icon:r}),n.jsx(T.DialEllipsisTooltip,{text:e}),a&&o&&n.jsx(C.DialButton,{className:"p-0",iconAfter:n.jsx(F.IconX,{size:z.DIAL_ICON_SIZE.SM}),onClick:c=>o(c)})]},e)},ir=({label:e="Error",className:t})=>n.jsx(Ke,{label:e,className:I.mergeClasses("dial-tiny-semi-text cursor-default rounded-[120px] border-transparent bg-error text-error",t)});var lt=(e=>(e.Default="default",e.Compact="compact",e))(lt||{});const hs={[lt.Default]:{container:"bg-layer-3",title:"dial-small-text text-secondary",value:"dial-display2-text text-primary",showDescription:!0},[lt.Compact]:{container:"bg-layer-2",title:"dial-tiny-text text-secondary",value:"dial-body-semi-text text-primary",showDescription:!1}},ms=({title:e,value:t,description:r,variant:s=lt.Default,error:a,isLoading:i,className:o,delta:l,deltaPositive:c,deltaUnit:d,compareValues:f})=>{const p=hs[s],g=c!==void 0?c:(l??0)>=0,u=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",p.container,o),children:[l!==void 0?n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("span",{className:p.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:u})]}):n.jsx("span",{className:p.title,children:e}),a?n.jsx(ir,{className:"self-start"}):i?n.jsx(C.DialLoader,{fullWidth:!1,className:"self-start"}):f?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(T.DialEllipsisTooltip,{text:f[0].title,className:"dial-tiny-text text-secondary"}),n.jsx("span",{className:p.value,children:f[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(T.DialEllipsisTooltip,{text:f[1].title,className:"dial-tiny-text text-secondary"}),n.jsx("span",{className:p.value,children:f[1].value})]})]}):n.jsx("span",{className:p.value,children:t}),!a&&!i&&p.showDescription&&r!=null&&r!==!1&&n.jsx("span",{className:"dial-tiny-text text-secondary",children:r})]})},or=[{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"}],xs=(e,t)=>t<=0?0:Math.min(Math.max(e/t,0),1),bs=(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},xt=({value:e,maxValue:t=1,error:r,isLoading:s,title:a,valueLabel:i,colorMap:o=or,className:l,titleClassName:c,valueClassName:d,inline:f,ariaLabel:p})=>{const g=e==null,u=!!(r||s||!g),m=xs(g?0:e,t),v=bs(m,o),x=i??(g?"—":e),b=p??(typeof a=="string"?a:void 0),y=r||s,N=r?n.jsx(ir,{}):s?n.jsx(C.DialLoader,{fullWidth:!1}):n.jsx("span",{className:I.mergeClasses("shrink-0 tabular-nums text-end",f?"dial-small-text min-w-[5ch] text-primary":"dial-small-semi-text text-primary",d),children:x}),w=u?n.jsx("div",{role:"progressbar","aria-valuenow":r||s||typeof e!="number"?void 0:e,"aria-valuemin":0,"aria-valuemax":t,"aria-label":b,className:I.mergeClasses("w-full overflow-hidden rounded-sm",f?"h-1":"h-2",r?"bg-error":"bg-layer-1"),children:!y&&n.jsx("div",{className:"h-full rounded-sm transition-[width] duration-300",style:{width:`${m*100}%`,backgroundColor:v}})}):null,D=n.jsx("span",{className:I.mergeClasses("dial-small-text text-primary",c),children:a});return f?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:w}),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]}),w]})},on=({title:e,description:t,children:r,expanded:s,defaultExpanded:a=!1,disabled:i,nonCollapsible:o,onToggle:l,className:c,headerClassName:d,contentClassName:f})=>{const p=s!==void 0,[g,u]=h.useState(a),m=o?!0:p?s:g,v=h.useId(),x=()=>{if(i)return;const b=!m;p||u(b),l?.(b)};return n.jsxs("div",{className:I.mergeClasses("rounded border border-secondary",c),children:[n.jsxs("button",{type:"button","aria-expanded":m,"aria-controls":v,disabled:i||o,onClick:x,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(T.DialIcon,{className:oe("text-secondary transition-transform",m&&"rotate-90"),icon:n.jsx(F.IconChevronRight,{size:z.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:v,role:"region",className:I.mergeClasses("px-4 pb-4",f),children:r})]})},Cs=({title:e,titleTooltip:t,description:r,data:s,compareData:a,compareLabels:i,maxValue:o,colorMap:l,defaultExpanded:c=!0,nonCollapsible:d,isLoading:f,onBarClick:p,inline:g,barTitleClassName:u,barValueClassName:m,barClassName:v,barDescriptions:x,className:b})=>{const y=Object.entries(s),N=g?I.mergeClasses("text-secondary",u):u,w=i?"dial-tiny-text text-secondary":void 0,D=t?n.jsx(E.DialTooltip,{tooltip:t,children:e}):e,S=a?[...new Set([...Object.keys(s),...Object.keys(a)])]:[],_="cursor-pointer rounded-sm text-left focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent-primary",O="group flex flex-col gap-1.5",A=I.mergeClasses("flex flex-col gap-1.5 pl-2",p&&"group-hover:bg-accent-primary-alpha group-focus-visible:bg-accent-primary-alpha",v);return n.jsx(on,{title:D,description:r,defaultExpanded:c,nonCollapsible:d,className:b,children:n.jsx("div",{className:I.mergeClasses("flex flex-col",a?"gap-4":g?"gap-2":"gap-3"),children:f?n.jsx(C.DialLoader,{fullWidth:!1,className:"self-center"}):a?S.map(k=>{const j=k in s?s[k]:null,M=k in a?a[k]:null,U=typeof j=="number"&&typeof M=="number"?parseFloat((M-j).toFixed(3)):null,J=U!=null&&U!==0,G=J&&U>0,B=J?G?`+${U}`:String(U):null,H=x?.[k],q=n.jsx("span",{className:"dial-small-text text-secondary",children:k}),K=n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"flex items-center gap-2",children:[H?n.jsx(E.DialTooltip,{tooltip:H,children:q}):q,B!=null&&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:B})]}),n.jsxs("div",{className:A,children:[n.jsx(xt,{title:i?.[0],value:j,maxValue:o,colorMap:l,inline:g,titleClassName:w,ariaLabel:k}),n.jsx(xt,{title:i?.[1],value:M,maxValue:o,colorMap:l,inline:g,titleClassName:w,ariaLabel:`${k} compare`})]})]});return p?n.jsx("button",{type:"button",onClick:()=>p(k,j),className:I.mergeClasses(O,_),children:K},k):n.jsx("div",{className:O,children:K},k)}):y.map(([k,j])=>{const M=n.jsx(xt,{title:k,value:j,maxValue:o,colorMap:l,inline:g,titleClassName:N,valueClassName:m,className:v}),$=p?n.jsx("button",{type:"button",onClick:()=>p(k,j),className:_,children:M}):M,U=x?.[k];return U?n.jsx(E.DialTooltip,{tooltip:U,triggerClassName:"flex flex-col",children:$},k):n.jsx(h.Fragment,{children:$},k)})})})},vs="#FF4E50",ys=(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},Nr=(e,t)=>{const r=t.map(()=>0);let s=0;e.forEach(c=>{if(c<=0){s+=1;return}const d=ys(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:vs,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]},ln=e=>e<=0?2:e%2===0?e:e+1,Ds=e=>{const t=ln(e);return[t,t/2,0]},Pt=e=>`${Math.round(e*100)/100}`,cn=(e,t)=>e===t?Pt(e):`${Pt(e)}-${Pt(t)}`,Ft=128,Is=(e,t)=>{const r=cn(e,t);return e===t?`scored ${r}`:`scored between ${r}`},jr=(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:Is(a.from,a.to)})]}),Ss=({title:e,values:t,colorMap:r=or,valueTitle:s="values",showCount:a,isLoading:i,className:o,compareValues:l,valueSetLabel:c,compareValueSetLabel:d})=>{const f=Nr(t,r),p=l?Nr(l,r):void 0,g=t.length,u=l?.length??0,m=Math.max(g,u),v=ln(m),x=Ds(m),b=D=>D.map(S=>({...S,ratio:v>0?S.count/v:0})),y=b(f),N=p?b(p):void 0,w=(D,S,_,O)=>{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 A=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(E.DialTooltip,{placement:"bottom",tooltip:S,triggerClassName:"flex h-full flex-1 items-end",children:n.jsx("div",{role:"img","aria-label":_,className:"flex min-h-2 w-full items-center justify-center rounded-sm border border-transparent",style:{height:`${D.ratio*100}%`,...A},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:Ft},children:n.jsx(C.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:Ft},children:x.map((D,S)=>n.jsx("span",{className:"dial-tiny-text absolute right-0 whitespace-nowrap text-secondary",style:{top:`${S/(x.length-1)*100}%`,transform:"translateY(-50%)"},children:D},D))}),n.jsxs("div",{className:"relative min-w-0",children:[x.map((D,S)=>n.jsx("div",{"data-histogram-grid":!0,className:"pointer-events-none absolute inset-x-0 border-t border-primary",style:{top:`${S/(x.length-1)*100}%`}},D)),n.jsx("div",{className:"relative flex items-end gap-1",style:{height:Ft},children:N?y.map((D,S)=>{const _=N[S],O=`${D.count} out of ${g} ${s}`,A=`${_.count} out of ${u} ${s}`;return n.jsxs("div",{className:"flex h-full flex-1 items-end",children:[w(D,jr(c,D.count,g,s,D),O,!0),w(_,jr(d,_.count,u,s,_),A,!1)]},S)}):y.map((D,S)=>{const _=`${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}%`}})},S):n.jsx(E.DialTooltip,{placement:"bottom",tooltip:_,triggerClassName:"flex h-full flex-1 items-end",children:n.jsx("div",{role:"img","aria-label":_,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})})},S)})})]}),n.jsx("div",{}),n.jsx("div",{"data-histogram-x-axis":!0,className:"flex gap-1",children:y.map((D,S)=>n.jsx("span",{className:"dial-caption-text flex-1 text-center text-secondary",children:cn(D.from,D.to)},S))})]})]})},dn=({value:e,max:t=100,size:r=E.ElementSize.Standard,labelProps:s,valueLabel:a,id:i,className:o,"aria-label":l,...c})=>{const d=h.useId(),f=i??d,p=!!s?.label,g=p?s?.id??`${f}-label`:void 0,u=t>0?t:0,m=Number.isFinite(e)?e:0,v=Math.min(Math.max(m,0),u),x=u>0?v/u*100:0,b=n.jsx("div",{...c,id:f,role:"progressbar","aria-valuenow":v,"aria-valuemin":0,"aria-valuemax":u,"aria-labelledby":g,"aria-label":E.resolveAccessibleName(l,p?void 0:"Progress"),className:I.mergeClasses("w-full overflow-hidden rounded-full bg-control-disable-primary",r===E.ElementSize.Small?"h-1":"h-2",o,!p&&!a&&T.DIAL_KIT_CLASS.progressBar),children:n.jsx("div",{style:{width:`${x}%`},className:"h-full rounded-full bg-control-accent transition-[width] duration-300 motion-reduce:transition-none"})});return!p&&!a?b:n.jsxs("div",{className:I.mergeClasses("flex w-full flex-col gap-1",T.DIAL_KIT_CLASS.progressBar),children:[n.jsxs("div",{className:"flex items-baseline gap-2",children:[s&&n.jsx(R.Label,{...s,id:g}),a&&n.jsx("span",{className:"dial-tiny-text text-secondary ml-auto shrink-0",children:a})]}),b]})},Ns=7,js=2,Ts=e=>e<=0?[]:Array.from({length:e},(t,r)=>r+1);var bt=(e=>(e.Active="active",e.Adjacent="adjacent",e.Far="far",e))(bt||{});const ws=(e,t,r)=>e===t?"active":r<Ns||Math.abs(e-t)<=js?"adjacent":"far",Es=({page:e,totalPages:t,onPageChange:r,className:s})=>{const a=Ts(t);return n.jsxs("nav",{"aria-label":"Pagination",className:I.mergeClasses("flex items-center gap-2",s),children:[n.jsx(E.DialIconButton,{icon:n.jsx(F.IconCaretLeftFilled,{size:z.DIAL_ICON_SIZE.SM,className:"text-secondary"}),size:E.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=ws(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===bt.Active&&"h-[8px] w-[32px]",o===bt.Adjacent&&"size-[8px]",o===bt.Far&&"size-[4px]")},i)})}),n.jsx(E.DialIconButton,{icon:n.jsx(F.IconCaretRightFilled,{size:z.DIAL_ICON_SIZE.SM,className:"text-secondary"}),size:E.ElementSize.Small,className:"!p-0 items-center flex justify-center",disabled:e>=t,onClick:()=>r(e+1),"aria-label":"Next page"})]})},Xt=({label:e,id:t,checked:r,indeterminate:s,disabled:a,ariaLabel:i,onChange:o,className:l,...c})=>{const d=h.useCallback(u=>{o?.(u.target.checked,t)},[o,t]),f=oe("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),p=oe("border rounded",a?"bg-layer-4 border-icon-secondary":""),g=()=>s?n.jsx(F.IconMinus,{className:p,...z.BASE_ICON_PROPS}):r?n.jsx(F.IconCheck,{className:p,...z.BASE_ICON_PROPS}):null;return n.jsxs("label",{...c,className:f,htmlFor:t,"aria-description":c["aria-description"]||T.ariaDescription,children:[g(),e&&(typeof e=="string"?n.jsx(T.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 Ce=(e=>(e.VALID="valid",e.ERROR="error",e))(Ce||{});const Os=(e,t)=>{if(t===e.id)switch(e.status){case Ce.VALID:return"border-accent-secondary text-primary";case Ce.ERROR:return"border-red-900 text-primary";default:return"border-accent-primary text-primary"}switch(e.status){case Ce.VALID:return"border-primary text-primary";case Ce.ERROR:return"border-red-900 text-error";default:return"border-primary text-secondary"}},As=(e,t)=>{if(t===e.id)switch(e.status){case Ce.VALID:return"bg-accent-secondary";case Ce.ERROR:return"bg-red-400";default:return"bg-accent-primary"}switch(e.status){case Ce.VALID:return"bg-accent-secondary";case Ce.ERROR:return"bg-red-400";default:return"bg-layer-4"}},_s=({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===Ce.ERROR?n.jsx(F.IconExclamationCircle,{stroke:2,size:z.DIAL_ICON_SIZE.SM}):r!==e.id&&e.status===Ce.VALID?n.jsx(F.IconCheck,{stroke:2,size:z.DIAL_ICON_SIZE.SM}):t+1;return n.jsxs("button",{className:oe(a,Os(e,r)),onClick:()=>s(e.id),children:[n.jsx("span",{className:oe(i,As(e,r)),children:o()}),n.jsx("span",{children:e.name})]})},Ls=({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===Ce.VALID)||o<i)&&r(a)};return n.jsx("div",{id:"steps",className:"flex gap-x-3",children:e.map((a,i)=>n.jsx(_s,{currentStep:t,onChangeStep:s,step:a,index:i},a.id))})},Bt=e=>(e.toString().split(".")[1]??"").length,ks=({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:f,fillClassName:p,thumbClassName:g,labelsClassName:u,"aria-label":m,"aria-labelledby":v,...x})=>{const b=h.useRef(null),y=Math.max(0,Math.min(100,(e-t)/(r-t)*100)),N=Bt(s),w=l?l(e):e.toFixed(N),D=h.useCallback(A=>{const k=b.current;if(!k)return e;const j=k.getBoundingClientRect(),M=(A-j.left)/j.width,$=t+M*(r-t),U=Bt(s),J=parseFloat((Math.round(($-t)/s)*s+t).toFixed(U));return Math.min(r,Math.max(t,J))},[t,r,s,e]),S=h.useCallback(A=>{a||(A.currentTarget.setPointerCapture(A.pointerId),c?.(D(A.clientX)))},[a,D,c]),_=h.useCallback(A=>{a||A.buttons===0||c?.(D(A.clientX))},[a,D,c]),O=h.useCallback(A=>{if(a)return;const k=Bt(s),j=U=>parseFloat((Math.round((U-t)/s)*s+t).toFixed(k)),M=U=>Math.min(r,Math.max(t,U));let $=e;switch(A.key){case"ArrowRight":case"ArrowUp":$=M(j(e+s));break;case"ArrowLeft":case"ArrowDown":$=M(j(e-s));break;case"Home":$=t;break;case"End":$=r;break;default:return}A.preventDefault(),$!==e&&c?.($)},[a,e,s,t,r,c]);return n.jsxs("div",{className:I.mergeClasses("flex flex-col",a&&"pointer-events-none opacity-50",d),...x,children:[i&&n.jsx(ke.DialLabel,{...i,htmlFor:x.id}),n.jsxs("div",{ref:b,className:"relative flex h-[38px] cursor-pointer items-center",onPointerDown:S,onPointerMove:_,children:[n.jsx("div",{className:I.mergeClasses("pointer-events-none absolute inset-x-0 h-3 rounded-[10px] bg-layer-1",f)}),n.jsx("div",{className:I.mergeClasses("pointer-events-none absolute left-0 h-3 rounded-[10px] bg-controls-accent-primary",p),style:{width:`${y}%`}}),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":v,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:`${y}%`},onKeyDown:O,children:w})]}),o&&n.jsx("div",{className:I.mergeClasses("dial-tiny-text flex text-secondary",u),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]})]})})]})},Rs=({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(E.DialTooltip,{triggerClassName:"text-primary flex-1 min-w-0",tooltip:r||t,children:t}),a||null]})]}),un=h.createContext({dragDropManager:void 0});function ye(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 Tr=(function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"})(),wr=function(){return Math.random().toString(36).substring(7).split("").join(".")},Er={INIT:"@@redux/INIT"+wr(),REPLACE:"@@redux/REPLACE"+wr()};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 Ps(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(zs(e))return"date";if(Bs(e))return"error";var r=Fs(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 Fs(e){return typeof e.constructor=="function"?e.constructor.name:null}function Bs(e){return e instanceof Error||typeof e.message=="string"&&e.constructor&&typeof e.constructor.stackTraceLimit=="number"}function zs(e){return e instanceof Date?!0:typeof e.toDateString=="function"&&typeof e.getDate=="function"&&typeof e.setDate=="function"}function Qe(e){var t=typeof e;return process.env.NODE_ENV!=="production"&&(t=Ps(e)),t}function fn(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"?ye(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"?ye(1):"Expected the enhancer to be a function. Instead, received: '"+Qe(r)+"'");return r(fn)(e,t)}if(typeof e!="function")throw new Error(process.env.NODE_ENV==="production"?ye(2):"Expected the root reducer to be a function. Instead, received: '"+Qe(e)+"'");var a=e,i=t,o=[],l=o,c=!1;function d(){l===o&&(l=o.slice())}function f(){if(c)throw new Error(process.env.NODE_ENV==="production"?ye(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 p(v){if(typeof v!="function")throw new Error(process.env.NODE_ENV==="production"?ye(4):"Expected the listener to be a function. Instead, received: '"+Qe(v)+"'");if(c)throw new Error(process.env.NODE_ENV==="production"?ye(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 x=!0;return d(),l.push(v),function(){if(x){if(c)throw new Error(process.env.NODE_ENV==="production"?ye(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.");x=!1,d();var y=l.indexOf(v);l.splice(y,1),o=null}}}function g(v){if(!Ms(v))throw new Error(process.env.NODE_ENV==="production"?ye(7):"Actions must be plain objects. Instead, the actual type was: '"+Qe(v)+"'. 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 v.type>"u")throw new Error(process.env.NODE_ENV==="production"?ye(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"?ye(9):"Reducers may not dispatch actions.");try{c=!0,i=a(i,v)}finally{c=!1}for(var x=o=l,b=0;b<x.length;b++){var y=x[b];y()}return v}function u(v){if(typeof v!="function")throw new Error(process.env.NODE_ENV==="production"?ye(10):"Expected the nextReducer to be a function. Instead, received: '"+Qe(v));a=v,g({type:Er.REPLACE})}function m(){var v,x=p;return v={subscribe:function(y){if(typeof y!="object"||y===null)throw new Error(process.env.NODE_ENV==="production"?ye(11):"Expected the observer to be an object. Instead, received: '"+Qe(y)+"'");function N(){y.next&&y.next(f())}N();var w=x(N);return{unsubscribe:w}}},v[Tr]=function(){return this},v}return g({type:Er.INIT}),s={dispatch:g,subscribe:p,getState:f,replaceReducer:u},s[Tr]=m,s}function Y(e,t,...r){if($s()&&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 $s(){return typeof process<"u"&&process.env.NODE_ENV==="production"}function Hs(e,t,r){return t.split(".").reduce((s,a)=>s&&s[a]?s[a]:r||null,e)}function Vs(e,t){return e.filter(r=>r!==t)}function pn(e){return typeof e=="object"}function Ks(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 Gs(e,t){return e.filter(r=>t.indexOf(r)>-1)}const lr="dnd-core/INIT_COORDS",jt="dnd-core/BEGIN_DRAG",cr="dnd-core/PUBLISH_DRAG_SOURCE",Tt="dnd-core/HOVER",wt="dnd-core/DROP",Et="dnd-core/END_DRAG";function Or(e,t){return{type:lr,payload:{sourceClientOffset:t||null,clientOffset:e||null}}}const Us={type:lr,payload:{clientOffset:null,sourceClientOffset:null}};function Zs(e){return function(r=[],s={publishSource:!0}){const{publishSource:a=!0,clientOffset:i,getSourceClientOffset:o}=s,l=e.getMonitor(),c=e.getRegistry();e.dispatch(Or(i)),Ws(r,l,c);const d=Xs(r,l);if(d==null){e.dispatch(Us);return}let f=null;if(i){if(!o)throw new Error("getSourceClientOffset must be defined");qs(o),f=o(d)}e.dispatch(Or(i,f));const g=c.getSource(d).beginDrag(l,d);if(g==null)return;Ys(g),c.pinSource(d);const u=c.getSourceType(d);return{type:jt,payload:{itemType:u,item:g,sourceId:d,clientOffset:i||null,sourceClientOffset:f||null,isSourcePublic:!!a}}}}function Ws(e,t,r){Y(!t.isDragging(),"Cannot call beginDrag while dragging."),e.forEach(function(s){Y(r.getSource(s),"Expected sourceIds to be registered.")})}function qs(e){Y(typeof e=="function","When clientOffset is provided, getSourceClientOffset must be a function.")}function Ys(e){Y(pn(e),"Item must be an object.")}function Xs(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 Qs(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Js(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){Qs(e,a,r[a])})}return e}function ea(e){return function(r={}){const s=e.getMonitor(),a=e.getRegistry();ta(s),sa(s).forEach((o,l)=>{const c=ra(o,l,a,s),d={type:wt,payload:{dropResult:Js({},r,c)}};e.dispatch(d)})}}function ta(e){Y(e.isDragging(),"Cannot call drop while not dragging."),Y(!e.didDrop(),"Cannot call drop twice during one drag operation.")}function ra(e,t,r,s){const a=r.getTarget(e);let i=a?a.drop(s,e):void 0;return na(i),typeof i>"u"&&(i=t===0?{}:s.getDropResult()),i}function na(e){Y(typeof e>"u"||pn(e),"Drop result must either be an object or undefined.")}function sa(e){const t=e.getTargetIds().filter(e.canDropOnTarget,e);return t.reverse(),t}function aa(e){return function(){const r=e.getMonitor(),s=e.getRegistry();ia(r);const a=r.getSourceId();return a!=null&&(s.getSource(a,!0).endDrag(r,a),s.unpinSource()),{type:Et}}}function ia(e){Y(e.isDragging(),"Cannot call endDrag while not dragging.")}function Qt(e,t){return t===null?e===null:Array.isArray(e)?e.some(r=>r===t):e===t}function oa(e){return function(r,{clientOffset:s}={}){la(r);const a=r.slice(0),i=e.getMonitor(),o=e.getRegistry(),l=i.getItemType();return da(a,o,l),ca(a,i,o),ua(a,i,o),{type:Tt,payload:{targetIds:a,clientOffset:s||null}}}}function la(e){Y(Array.isArray(e),"Expected targetIds to be an array.")}function ca(e,t,r){Y(t.isDragging(),"Cannot call hover while not dragging."),Y(!t.didDrop(),"Cannot call hover after drop.");for(let s=0;s<e.length;s++){const a=e[s];Y(e.lastIndexOf(a)===s,"Expected targetIds to be unique in the passed array.");const i=r.getTarget(a);Y(i,"Expected targetIds to be registered.")}}function da(e,t,r){for(let s=e.length-1;s>=0;s--){const a=e[s],i=t.getTargetType(a);Qt(i,r)||e.splice(s,1)}}function ua(e,t,r){e.forEach(function(s){r.getTarget(s).hover(t,s)})}function fa(e){return function(){if(e.getMonitor().isDragging())return{type:cr}}}function pa(e){return{beginDrag:Zs(e),publishDragSource:fa(e),hover:oa(e),drop:ea(e),endDrag:aa(e)}}class ga{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=pa(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 ha(e,t){return{x:e.x+t.x,y:e.y+t.y}}function gn(e,t){return{x:e.x-t.x,y:e.y-t.y}}function ma(e){const{clientOffset:t,initialClientOffset:r,initialSourceClientOffset:s}=e;return!t||!r||!s?null:gn(ha(t,s),r)}function xa(e){const{clientOffset:t,initialClientOffset:r}=e;return!t||!r?null:gn(t,r)}const it=[],dr=[];it.__IS_NONE__=!0;dr.__IS_ALL__=!0;function ba(e,t){return e===it?!1:e===dr||typeof t>"u"?!0:Gs(t,e).length>0}class Ca{subscribeToStateChange(t,r={}){const{handlerIds:s}=r;Y(typeof t=="function","listener must be a function."),Y(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&&!ba(o.dirtyHandlerIds,s)||t()}finally{a=l}};return this.store.subscribe(i)}subscribeToOffsetChange(t){Y(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 Y(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(Y(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 Qt(s,a)&&r.canDrop(this,t)}isDragging(){return!!this.getItemType()}isDraggingSource(t){if(!t)return!1;const r=this.registry.getSource(t,!0);if(Y(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&&!Qt(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 ma(this.store.getState().dragOffset)}getDifferenceFromInitialOffset(){return xa(this.store.getState().dragOffset)}constructor(t,r){this.store=t,this.registry=r}}const Ar=typeof global<"u"?global:self,hn=Ar.MutationObserver||Ar.WebKitMutationObserver;function mn(e){return function(){const r=setTimeout(a,0),s=setInterval(a,50);function a(){clearTimeout(r),clearInterval(s),e()}}}function va(e){let t=1;const r=new hn(e),s=document.createTextNode("");return r.observe(s,{characterData:!0}),function(){t=-t,s.data=t}}const ya=typeof hn=="function"?va:mn;class Da{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=ya(this.flush),this.requestErrorThrow=mn(()=>{if(this.pendingErrors.length)throw this.pendingErrors.shift()})}}class Ia{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 Ia(this.onError,a=>r[r.length]=a);return s.task=t,s}constructor(t){this.onError=t,this.freeTasks=[]}}const xn=new Da,Na=new Sa(xn.registerPendingError);function ja(e){xn.enqueueTask(Na.create(e))}const ur="dnd-core/ADD_SOURCE",fr="dnd-core/ADD_TARGET",pr="dnd-core/REMOVE_SOURCE",Ot="dnd-core/REMOVE_TARGET";function Ta(e){return{type:ur,payload:{sourceId:e}}}function wa(e){return{type:fr,payload:{targetId:e}}}function Ea(e){return{type:pr,payload:{sourceId:e}}}function Oa(e){return{type:Ot,payload:{targetId:e}}}function Aa(e){Y(typeof e.canDrag=="function","Expected canDrag to be a function."),Y(typeof e.beginDrag=="function","Expected beginDrag to be a function."),Y(typeof e.endDrag=="function","Expected endDrag to be a function.")}function _a(e){Y(typeof e.canDrop=="function","Expected canDrop to be a function."),Y(typeof e.hover=="function","Expected hover to be a function."),Y(typeof e.drop=="function","Expected beginDrag to be a function.")}function Jt(e,t){if(t&&Array.isArray(e)){e.forEach(r=>Jt(r,!1));return}Y(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 Ie;(function(e){e.SOURCE="SOURCE",e.TARGET="TARGET"})(Ie||(Ie={}));let La=0;function ka(){return La++}function Ra(e){const t=ka().toString();switch(e){case Ie.SOURCE:return`S${t}`;case Ie.TARGET:return`T${t}`;default:throw new Error(`Unknown Handler Role: ${e}`)}}function _r(e){switch(e[0]){case"S":return Ie.SOURCE;case"T":return Ie.TARGET;default:throw new Error(`Cannot parse handler ID: ${e}`)}}function Lr(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){Jt(t),Aa(r);const s=this.addHandler(Ie.SOURCE,t,r);return this.store.dispatch(Ta(s)),s}addTarget(t,r){Jt(t,!0),_a(r);const s=this.addHandler(Ie.TARGET,t,r);return this.store.dispatch(wa(s)),s}containsHandler(t){return Lr(this.dragSources,t)||Lr(this.dropTargets,t)}getSource(t,r=!1){return Y(this.isSourceId(t),"Expected a valid source ID."),r&&t===this.pinnedSourceId?this.pinnedSource:this.dragSources.get(t)}getTarget(t){return Y(this.isTargetId(t),"Expected a valid target ID."),this.dropTargets.get(t)}getSourceType(t){return Y(this.isSourceId(t),"Expected a valid source ID."),this.types.get(t)}getTargetType(t){return Y(this.isTargetId(t),"Expected a valid target ID."),this.types.get(t)}isSourceId(t){return _r(t)===Ie.SOURCE}isTargetId(t){return _r(t)===Ie.TARGET}removeSource(t){Y(this.getSource(t),"Expected an existing source."),this.store.dispatch(Ea(t)),ja(()=>{this.dragSources.delete(t),this.types.delete(t)})}removeTarget(t){Y(this.getTarget(t),"Expected an existing target."),this.store.dispatch(Oa(t)),this.dropTargets.delete(t),this.types.delete(t)}pinSource(t){const r=this.getSource(t);Y(r,"Expected an existing source."),this.pinnedSourceId=t,this.pinnedSource=r}unpinSource(){Y(this.pinnedSource,"No source is pinned at the time."),this.pinnedSourceId=null,this.pinnedSource=null}addHandler(t,r,s){const a=Ra(t);return this.types.set(a,r),t===Ie.SOURCE?this.dragSources.set(a,s):t===Ie.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 Pa=(e,t)=>e===t;function Fa(e,t){return!e&&!t?!0:!e||!t?!1:e.x===t.x&&e.y===t.y}function Ba(e,t,r=Pa){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 za(e=it,t){switch(t.type){case Tt:break;case ur:case fr:case Ot:case pr:return it;case jt:case cr:case Et:case wt:default:return dr}const{targetIds:r=[],prevTargetIds:s=[]}=t.payload,a=Ks(r,s);if(!(a.length>0||!Ba(r,s)))return it;const o=s[s.length-1],l=r[r.length-1];return o!==l&&(o&&a.push(o),l&&a.push(l)),a}function $a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Ha(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){$a(e,a,r[a])})}return e}const kr={initialSourceClientOffset:null,initialClientOffset:null,clientOffset:null};function Va(e=kr,t){const{payload:r}=t;switch(t.type){case lr:case jt:return{initialSourceClientOffset:r.sourceClientOffset,initialClientOffset:r.clientOffset,clientOffset:r.clientOffset};case Tt:return Fa(e.clientOffset,r.clientOffset)?e:Ha({},e,{clientOffset:r.clientOffset});case Et:case wt:return kr;default:return e}}function Ka(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Je(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){Ka(e,a,r[a])})}return e}const Ga={itemType:null,item:null,sourceId:null,targetIds:[],dropResult:null,didDrop:!1,isSourcePublic:null};function Ua(e=Ga,t){const{payload:r}=t;switch(t.type){case jt:return Je({},e,{itemType:r.itemType,item:r.item,sourceId:r.sourceId,isSourcePublic:r.isSourcePublic,dropResult:null,didDrop:!1});case cr:return Je({},e,{isSourcePublic:!0});case Tt:return Je({},e,{targetIds:r.targetIds});case Ot:return e.targetIds.indexOf(r.targetId)===-1?e:Je({},e,{targetIds:Vs(e.targetIds,r.targetId)});case wt:return Je({},e,{dropResult:r.dropResult,didDrop:!0,targetIds:[]});case Et:return Je({},e,{itemType:null,item:null,sourceId:null,dropResult:null,didDrop:!1,isSourcePublic:null,targetIds:[]});default:return e}}function Za(e=0,t){switch(t.type){case ur:case fr:return e+1;case pr:case Ot:return e-1;default:return e}}function Wa(e=0){return e+1}function qa(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Ya(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){qa(e,a,r[a])})}return e}function Xa(e={},t){return{dirtyHandlerIds:za(e.dirtyHandlerIds,{type:t.type,payload:Ya({},t.payload,{prevTargetIds:Hs(e,"dragOperation.targetIds",[])})}),dragOffset:Va(e.dragOffset,t),refCount:Za(e.refCount,t),dragOperation:Ua(e.dragOperation,t),stateId:Wa(e.stateId)}}function Qa(e,t=void 0,r={},s=!1){const a=Ja(s),i=new Ca(a,new Ma(a)),o=new ga(a,i),l=e(o,t,r);return o.receiveBackend(l),o}function Ja(e){const t=typeof window<"u"&&window.__REDUX_DEVTOOLS_EXTENSION__;return fn(Xa,e&&t&&t({name:"dnd-core",instanceId:"dnd-core"}))}function ei(e,t){if(e==null)return{};var r=ti(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 ti(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 Rr=0;const Ct=Symbol.for("__REACT_DND_CONTEXT_INSTANCE__");var ri=h.memo(function(t){var{children:r}=t,s=ei(t,["children"]);const[a,i]=ni(s);return h.useEffect(()=>{if(i){const o=bn();return++Rr,()=>{--Rr===0&&(o[Ct]=null)}}},[]),n.jsx(un.Provider,{value:a,children:r})});function ni(e){if("manager"in e)return[{dragDropManager:e.manager},!1];const t=si(e.backend,e.context,e.options,e.debugMode),r=!e.context;return[t,r]}function si(e,t=bn(),r,s){const a=t;return a[Ct]||(a[Ct]={dragDropManager:Qa(e,t,r,s)}),a[Ct]}function bn(){return typeof global<"u"?global:window}var zt,Mr;function ai(){return Mr||(Mr=1,zt=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}),zt}var ii=ai();const oi=C.getDefaultExportFromCjs(ii),Ue=typeof window<"u"?h.useLayoutEffect:h.useEffect;function li(e,t,r){const[s,a]=h.useState(()=>t(e)),i=h.useCallback(()=>{const o=t(e);oi(s,o)||(a(o),r&&r())},[s,e,r]);return Ue(i),[s,i]}function ci(e,t,r){const[s,a]=li(e,t,r);return Ue(function(){const o=e.getHandlerId();if(o!=null)return e.subscribeToStateChange(a,{handlerIds:[o]})},[e,a]),s}function Cn(e,t,r){return ci(t,e||(()=>({})),()=>r.reconnect())}function vn(e,t){const r=[...t||[]];return t==null&&typeof e!="function"&&r.push(e),h.useMemo(()=>typeof e=="function"?e():e,r)}function di(e){return h.useMemo(()=>e.hooks.dragSource(),[e])}function ui(e){return h.useMemo(()=>e.hooks.dragPreview(),[e])}let $t=!1,Ht=!1;class fi{receiveHandlerId(t){this.sourceId=t}getHandlerId(){return this.sourceId}canDrag(){Y(!$t,"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 $t=!0,this.internalMonitor.canDragSource(this.sourceId)}finally{$t=!1}}isDragging(){if(!this.sourceId)return!1;Y(!Ht,"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 Ht=!0,this.internalMonitor.isDraggingSource(this.sourceId)}finally{Ht=!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 Vt=!1;class pi{receiveHandlerId(t){this.targetId=t}getHandlerId(){return this.targetId}subscribeToStateChange(t,r){return this.internalMonitor.subscribeToStateChange(t,r)}canDrop(){if(!this.targetId)return!1;Y(!Vt,"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 Vt=!0,this.internalMonitor.canDropOnTarget(this.targetId)}finally{Vt=!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 gi(e,t,r){const s=r.getRegistry(),a=s.addTarget(e,t);return[a,()=>s.removeTarget(a)]}function hi(e,t,r){const s=r.getRegistry(),a=s.addSource(e,t);return[a,()=>s.removeSource(a)]}function er(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 f=e[d],p=t[d];if(a=void 0,a===!1||a===void 0&&f!==p)return!1}return!0}function tr(e){return e!==null&&typeof e=="object"&&Object.prototype.hasOwnProperty.call(e,"current")}function mi(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 xi(e){return(t=null,r=null)=>{if(!h.isValidElement(t)){const i=t;return e(i,r),i}const s=t;return mi(s),bi(s,r?i=>e(i,r):e)}}function yn(e){const t={};return Object.keys(e).forEach(r=>{const s=e[r];if(r.endsWith("Ref"))t[r]=e[r];else{const a=xi(s);t[r]=()=>a}}),t}function Pr(e,t){typeof e=="function"?e(t):e.current=t}function bi(e,t){const r=e.ref;return Y(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=>{Pr(r,s),Pr(t,s)}}):h.cloneElement(e,{ref:t})}class Ci{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!er(this.lastConnectedDragSourceOptions,this.dragSourceOptions)}didDragPreviewOptionsChange(){return!er(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=yn({dragSource:(r,s)=>{this.clearDragSource(),this.dragSourceOptions=s||null,tr(r)?this.dragSourceRef=r:this.dragSourceNode=r,this.reconnectDragSource()},dragPreview:(r,s)=>{this.clearDragPreview(),this.dragPreviewOptions=s||null,tr(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 vi{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!er(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=yn({dropTarget:(r,s)=>{this.clearDropTarget(),this.dropTargetOptions=s,tr(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 rt(){const{dragDropManager:e}=h.useContext(un);return Y(e!=null,"Expected drag drop context"),e}function yi(e,t){const r=rt(),s=h.useMemo(()=>new Ci(r.getBackend()),[r]);return Ue(()=>(s.dragSourceOptions=e||null,s.reconnect(),()=>s.disconnectDragSource()),[s,e]),Ue(()=>(s.dragPreviewOptions=t||null,s.reconnect(),()=>s.disconnectDragPreview()),[s,t]),s}function Di(){const e=rt();return h.useMemo(()=>new fi(e),[e])}class Ii{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 Ii(e,t,r),[t,r]);return h.useEffect(()=>{s.spec=e},[e]),s}function Ni(e){return h.useMemo(()=>{const t=e.type;return Y(t!=null,"spec.type must be defined"),t},[e])}function ji(e,t,r){const s=rt(),a=Si(e,t,r),i=Ni(e);Ue(function(){if(i!=null){const[l,c]=hi(i,a,s);return t.receiveHandlerId(l),r.receiveHandlerId(l),c}},[s,t,r,a,i])}function Ti(e,t){const r=vn(e,t);Y(!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=Di(),a=yi(r.options,r.previewOptions);return ji(r,s,a),[Cn(r.collect,s,a),di(a),ui(a)]}function wi(e){return h.useMemo(()=>e.hooks.dropTarget(),[e])}function Ei(e){const t=rt(),r=h.useMemo(()=>new vi(t.getBackend()),[t]);return Ue(()=>(r.dropTargetOptions=e||null,r.reconnect(),()=>r.disconnectDropTarget()),[e]),r}function Oi(){const e=rt();return h.useMemo(()=>new pi(e),[e])}function Ai(e){const{accept:t}=e;return h.useMemo(()=>(Y(e.accept!=null,"accept must be defined"),Array.isArray(t)?t:[t]),[t])}class _i{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 Li(e,t){const r=h.useMemo(()=>new _i(e,t),[t]);return h.useEffect(()=>{r.spec=e},[e]),r}function ki(e,t,r){const s=rt(),a=Li(e,t),i=Ai(e);Ue(function(){const[l,c]=gi(i,a,s);return t.receiveHandlerId(l),r.receiveHandlerId(l),c},[s,t,a,r,i.map(o=>o.toString()).join("|")])}function gr(e,t){const r=vn(e,t),s=Oi(),a=Ei(r.options);return ki(r,s,a),[Cn(r.collect,s,a),wi(a)]}const Fr="column",Ri="flex items-center",Mi="mr-3 cursor-move text-secondary",Pi=({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},f,p]=Ti(()=>({type:Fr,item:{id:e,originalIndex:c},collect:u=>{const m=u.getItem();return{isDragging:u.isDragging()&&m?.id===e}},end:(u,m)=>{if(!u)return;!m.didDrop()&&typeof a=="function"&&u.originalIndex>-1&&a(u.id,u.originalIndex)}}),[e,c,a]),[,g]=gr(()=>({accept:Fr,hover:u=>{if(!(!u||u.id===e)&&typeof s=="function"&&typeof a=="function"){const m=s(e);a(u.id,m)}}}),[s,a,e]);return p(g(l)),f(o),n.jsxs("div",{ref:l,className:I.mergeClasses(Ri,r),style:{opacity:d?0:1},"aria-roledescription":"Draggable item",children:[n.jsx("div",{ref:o,className:Mi,"aria-label":i,children:n.jsx(F.IconGripVertical,{...z.BASE_ICON_PROPS})}),t]})},At=({iconClassName:e,label:t,...r})=>t?n.jsx(C.DialDangerButton,{...r,label:t,appearance:E.ButtonAppearance.Ghost,iconBefore:n.jsx(F.IconTrashX,{...z.BASE_ICON_PROPS,className:e||""})}):n.jsx(T.DialDangerIconButton,{...r,appearance:E.ButtonAppearance.Ghost,icon:n.jsx(F.IconTrashX,{...z.BASE_ICON_PROPS,className:e||""})}),Fi=({className:e="",value:t,onChange:r,error:s,containerClassName:a,resize:i=!1,labelProps:o,caption:l,id:c,...d})=>{const f=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(ke.DialLabel,{...o,htmlFor:c}),n.jsx("textarea",{id:c,value:t||"",className:f,onChange:p=>r?.(p.currentTarget.value),...d}),n.jsx(C.DialErrorText,{text:s}),!s&&n.jsx(C.DialCaptionText,{text:l})]})},Bi="inline-flex items-center rounded bg-layer-3",zi="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",$i="relative z-10 bg-controls-accent-primary-alpha-active text-primary",Hi="text-secondary hover:text-primary",Vi="text-controls-disable-accent cursor-not-allowed hover:text-controls-disable-accent",Ki=({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 f=null;switch(l.key){case"ArrowRight":case"ArrowDown":f=(d+1)%c.length;break;case"ArrowLeft":case"ArrowUp":f=(d-1+c.length)%c.length;break;case"Home":f=0;break;case"End":f=c.length-1;break;default:return}l.preventDefault();const p=c[f];p&&p.value!==t&&r(p.value)},[s,e,t,r]);return n.jsx("div",{role:"tablist","aria-label":i,className:I.mergeClasses(Bi,a),children:e.map((l,c)=>{const d=l.value===t,f=c===0,p=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(zi,!p&&"-mr-px",f&&"rounded-l",p&&"rounded-r",d?$i:Hi,g&&Vi),children:[l.icon,l.label]},l.value)})})},Kt=8,Gi=24,Dn=({initialTags:e=[],label:t,required:r,elementId:s,placeholder:a,captionDescription:i,errorText:o,invalid:l,disabled:c,collapseTagOverflow:d=!1,readOnly:f=!1,containerClassName:p,tagClassName:g,onChange:u})=>{const m=h.useRef(null),v=h.useRef([]),x=h.useRef(null),[b,y]=h.useState(e),[N,w]=h.useState(""),[D,S]=h.useState(!1),[_,O]=h.useState(e.length),A=h.useCallback(B=>H=>{v.current[B]=H},[]),k=h.useCallback(()=>{if(!d)return;const B=m.current;if(!B)return;const H=B.offsetWidth;if(H===0)return;const q=x.current?.offsetWidth??0,se=H-(f?0:Gi)-Kt;let X=0,Z=0;for(let ae=0;ae<b.length;ae++){const te=v.current[ae];if(!te)continue;const le=te.offsetWidth+Kt;if(X+le>se)break;X+=le,Z++}if(Z<b.length&&Z>0)for(;X+q>se&&Z>0;){Z--;const ae=v.current[Z]?.offsetWidth??0;X-=ae+Kt}O(Z)},[d,f,b.length]),j=B=>{const H=B.trim().replace(/,$/,"");if(H&&!b.includes(H)){const q=[H,...b];y(q),u?.(q)}},M=B=>{(B.key===","||B.key==="Enter")&&(B.preventDefault(),j(N),w(""))},$=()=>{N.trim()&&(j(N),w(""))},U=B=>{const H=b.filter((q,K)=>K!==B);y(H),u?.(H)},J=()=>o?n.jsx(C.DialErrorText,{text:o}):i?n.jsx(C.DialCaptionText,{text:i}):null;h.useEffect(()=>{if(d)return;const B=new ResizeObserver(()=>{if(m.current){const H=m.current.scrollHeight>m.current.clientHeight+10;S(H)}});return m.current&&B.observe(m.current),()=>B.disconnect()},[b,d]),h.useEffect(()=>{if(!d){O(b.length);return}O(b.length);const B=new ResizeObserver(()=>{k()}),H=m.current;return H&&B.observe(H),k(),()=>B.disconnect()},[d,k,b]),h.useEffect(()=>{y(e)},[JSON.stringify(e)]);const G=n.jsxs("div",{ref:m,className:oe("flex gap-2 items-center relative",d?"flex-nowrap overflow-hidden w-full min-w-0":oe("flex-wrap",D?"flex-col-reverse":"flex-row"),p),children:[(d?b.slice(0,_):b).map((B,H)=>n.jsx(Ke,{label:B,className:g,closable:!c&&!f,onRemove:!c&&!f?()=>U(H):void 0},B+H)),d&&_<b.length&&n.jsx(E.DialTooltip,{tooltip:b.slice(_).join(", "),triggerClassName:"inline-flex shrink-0 cursor-pointer",children:n.jsx(Ke,{label:`+${b.length-_}`})}),!f&&n.jsx("input",{id:s,type:"text",value:N,onChange:B=>w(B.target.value),onKeyDown:M,onBlur:$,className:oe("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:[b.map((B,H)=>n.jsx("div",{ref:A(H),className:"inline-flex shrink-0",children:n.jsx(Ke,{label:B,className:g,closable:!c&&!f,onRemove:!c&&!f?()=>U(H):void 0})},`measure-${B}-${H}`)),n.jsx("div",{ref:x,className:"inline-flex shrink-0",children:n.jsx(Ke,{label:`+${b.length}`})})]})]});return f?G:n.jsxs("div",{className:"flex flex-col gap-2 w-full",children:[n.jsx(ke.DialLabel,{label:t,required:r,htmlFor:s}),n.jsx("div",{className:oe("dial-input min-h-[38px] p-[6px]",l&&"dial-input-error",c&&"dial-input-disable"),children:G}),J()]})},In=({selectedItems:e,placeholder:t,collapseTagOverflow:r=!1,listClassName:s,listElementClassName:a})=>e?.length?n.jsx(Dn,{readOnly:!0,initialTags:e,collapseTagOverflow:r,containerClassName:s,tagClassName:a}):t?n.jsx("span",{className:"text-secondary",children:t}):null,Gt=e=>Sr.createElement("svg",{width:18,height:18,viewBox:"0 0 18 18",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},Sr.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"})),Sn=({children:e,open:t,disabled:r=!1,selectedValue:s,valueClassName:a,inputClassName:i,onOpen:o,elementId:l,errorText:c,invalid:d,emptyValueText:f,placeholder:p,editable:g=!1,onValueChange:u,collapseTagOverflow:m=!1,iconBefore:v})=>{const x=Array.isArray(s)&&s.length>0,b=typeof s=="string"&&!!s.trim(),y=x||b?s:p?void 0:f,N=r?void 0:o,w=h.useCallback(O=>{u?.(O.target.value)},[u]),D=()=>n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:oe("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:[v&&n.jsx(T.DialIcon,{icon:v}),n.jsx("input",{type:"text",className:oe("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:p||f,onChange:w,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(T.DialIcon,{icon:n.jsx(Gt,{role:"img",width:z.BASE_ICON_SIZE,height:z.BASE_ICON_SIZE})})})]}),n.jsx(C.DialErrorText,{text:c})]}),S=()=>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:oe("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:[v&&n.jsx(T.DialIcon,{icon:v}),n.jsx(E.DialTooltip,{tooltip:y==null?void 0:String(y),children:y||!p?n.jsx("span",{className:a,children:y}):n.jsx("span",{className:"text-secondary",children:p})})]}),!r&&n.jsx("div",{className:"shrink-0",children:n.jsx(T.DialIcon,{icon:n.jsx(Gt,{role:"img",width:z.BASE_ICON_SIZE,height:z.BASE_ICON_SIZE})})})]})}),n.jsx(C.DialErrorText,{text:c})]}),_=()=>n.jsx("div",{className:"w-full",onClick:N,children:n.jsxs("div",{className:oe("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:[v&&n.jsx(T.DialIcon,{icon:v}),n.jsx(In,{placeholder:p,selectedItems:y,collapseTagOverflow:m})]}),!r&&n.jsx("div",{className:"ml-1",children:n.jsx(T.DialIcon,{icon:n.jsx(Gt,{role:"img",width:z.BASE_ICON_SIZE,height:z.BASE_ICON_SIZE})})})]})});return n.jsxs(n.Fragment,{children:[x?_():g?D():S(),t&&ps.createPortal(e,document.body)]})},Ui=({label:e,htmlFor:t,disabled:r,selectedValue:s,radioButtons:a,customInputValue:i,valueClassName:o,inputClassName:l,emptyValueText:c,placeholder:d,onClose:f,header:p,portalId:g,onApply:u,onCancel:m,cancelButtonTitle:v="Cancel",applyButtonTitle:x="Apply",isValid:b,selectedRadioValue:y,onChangeRadioField:N,id:w,size:D=C.PopupSize.Md})=>{const[S,_]=h.useState(!1),O=h.useCallback(()=>{r||_(!0)},[r]),A=h.useCallback(()=>{_(!1),f?.()},[f]),k=h.useCallback(()=>{m?.(),A()},[m,A]),j=h.useCallback(()=>{u(),A()},[u,A]);return n.jsxs("div",{className:"flex flex-col gap-1",children:[n.jsx(ke.DialLabel,{label:e,htmlFor:t}),n.jsx(Sn,{disabled:r,open:S,selectedValue:i??a.find(M=>M.id===s)?.name,valueClassName:o,inputClassName:oe(l,"py-2","px-3"),emptyValueText:c,placeholder:d,onOpen:O,children:n.jsx(C.DialPopup,{open:S,onClose:k,header:p,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(C.DialNeutralButton,{label:v,onClick:k}),n.jsx(C.DialPrimaryButton,{label:x,onClick:j,disabled:!b})]}),children:n.jsx("div",{className:"px-6 py-4",children:n.jsx(C.DialRadioGroup,{radioButtons:a,labelClassName:"dial-small-text",activeRadioButton:y,onChange:N,elementId:w,orientation:C.RadioGroupOrientation.Column})})})})]})},Zi="Create",Wi="Cancel",qi="flex items-center justify-end gap-2 px-6 py-3",Yi=({header:e,open:t=!1,submitLabel:r=Zi,cancelLabel:s=Wi,isLoading:a=!1,disableSubmitButton:i=!1,className:o,submitClassName:l,onClose:c,onSubmit:d,onCancel:f,children:p,dividers:g=!0,size:u=C.PopupSize.Md,footer:m})=>{const v=a?null:n.jsxs("div",{className:qi,children:[n.jsx(C.DialNeutralButton,{label:s,onClick:()=>f?f():c?.()}),n.jsx(C.DialPrimaryButton,{className:l,label:r,disabled:i,onClick:()=>d()})]}),x=h.useCallback(()=>a?n.jsx("div",{className:"px-6 py-4 h-[120px]",children:n.jsx(C.DialLoader,{size:50})}):p??null,[p,a]);return n.jsx(C.DialPopup,{open:t,header:e,className:o,dividers:g,onClose:()=>c?.(),footer:m??v,size:u,children:x()})},Xi=/^0+\.(\d+)?$/,Qi=/^0+/,rr=({integer:e,onChange:t,min:r,max:s,onKeyDown:a,onPaste:i,...o})=>{const l=f=>!f||f==="-"?f:String(f)?.match(Xi)?String(f)?.replace(Qi,"0"):Number(f),c=f=>{if([".","-","+","e","E"].includes(f.key)){f.preventDefault();return}C.handleKeyDown(f,"number",r,s)},d=f=>{const p=f.clipboardData.getData("text"),g=p.replace(/\D/g,"");if(g!==p&&(f.preventDefault(),g)){const u=f.currentTarget,m=u.selectionStart??0,v=u.selectionEnd??0,x=u.value.slice(0,m)+g+u.value.slice(v);t?.(l(x))}};return n.jsx(C.DialInput,{type:"number",min:r,max:s,onChange:f=>t?.(l(f)),onKeyDown:e?c:a,onPaste:e?d:i,...o})},Ji=({onClick:e})=>n.jsx(F.IconEyeOff,{...z.BASE_ICON_PROPS,className:"text-primary",onClick:e,role:"button","aria-label":"hide"}),eo=({onClick:e})=>n.jsx(F.IconEye,{...z.BASE_ICON_PROPS,className:"text-primary",onClick:e,role:"button","aria-label":"show"}),Nn=({...e})=>{const[t,r]=h.useState(!1),s=h.useCallback(a=>{r(a)},[]);return n.jsx(C.DialInput,{type:t?"text":"password",...e,iconAfter:e.disabled?null:t?n.jsx(Ji,{onClick:()=>s(!1)}):n.jsx(eo,{onClick:()=>s(!0)})})},jn=({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(Ke,{label:a,onRemove:o=>r?.(o,s),icon:i?n.jsx(T.DialIcon,{icon:i}):null,className:"max-w-full"},s)})});var yt=(e=>(e.Sm="sm",e.Md="md",e))(yt||{}),Dt=(e=>(e.Primary="Primary",e.Secondary="Secondary",e))(Dt||{});const to="dial-input flex w-full items-center justify-between gap-2 dial-small-text cursor-pointer",ro="w-full rounded flex flex-col",ot="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",no="bg-accent-primary-alpha",nr="bg-accent-primary-alpha border-l border-accent-primary border-1",It="opacity-75",so=352,ao=4,io=n.jsx(F.IconChevronDown,{size:z.DIAL_ICON_SIZE.SM}),oo=({opt:e,selectedValues:t,onSelect:r})=>{const{isOpen:s,refs:a,floatingStyles:i,context:o,getReferenceProps:l,getFloatingProps:c}=T.useSubMenuFloating(ao,"listbox",!!e.disabled),d=e.children?.some(f=>t.includes(f.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:oe(ot,d&&nr,e.disabled&&It),...l(),children:[n.jsxs("div",{className:"flex items-center gap-2 w-full min-w-0",children:[e.icon&&n.jsx(T.DialIcon,{icon:e.icon}),n.jsx(T.DialEllipsisTooltip,{text:e.labelNode??e.label})]}),n.jsx(F.IconChevronRight,{size:14,className:"shrink-0"})]}),s&&n.jsx(T.SubMenuPanel,{refs:a,floatingStyles:i,context:o,getFloatingProps:c,role:"listbox",className:"w-max py-1",children:e.children.map(f=>{const p=t.includes(f.value);return n.jsx("button",{type:"button",role:"option","aria-selected":p,"aria-disabled":!!f.disabled,disabled:f.disabled,className:oe(ot,p&&nr,f.disabled&&It),onClick:()=>!f.disabled&&r(f.value),children:n.jsxs("div",{className:"flex items-center gap-2 w-full",children:[f.icon&&n.jsx(T.DialIcon,{icon:f.icon}),n.jsx(T.DialEllipsisTooltip,{text:f.labelNode??f.label})]})},f.value)})})]})},Te=({options:e,multiple:t=!1,elementId:r,value:s,defaultValue:a,variant:i=Dt.Primary,size:o=yt.Md,prefix:l,customSelectedValue:c,placeholder:d="Select...",searchable:f=!1,searchSize:p=E.ElementSize.Standard,searchPlaceholder:g,selectAll:u=!1,invalid:m,selectAllLabel:v="Select all",emptyStateTitle:x="No options available",emptyStateDescription:b,emptyStateIcon:y,disabled:N=!1,className:w,listClassName:D,closable:S=!1,header:_,footer:O,onClose:A,onChange:k,inlineSearch:j=!1,dismissRef:M,onFooterClick:$,open:U,onOpenChange:J,onInlineQueryChange:G,customMultiSelectTagsRenderer:B})=>{const H=h.useId(),[q,K]=h.useState(!1),se=U!==void 0,X=se?!!U:q,Z=h.useCallback(L=>{se||K(L),J?.(L)},[se,J]),[ae,te]=h.useState(j&&c||""),le=h.useRef(null),ue=h.useCallback(L=>{L!==ae&&(te(L||""),G?.(L||""))},[G,ae]),pe=s!==void 0,[ge,fe]=h.useState(a),W=pe?s:ge,ee=h.useMemo(()=>t?Array.isArray(W)?W:[]:typeof W=="string"?[W]:[],[W,t]),Se=h.useMemo(()=>{const L=ae.trim().toLowerCase();return L?e.filter(re=>re.label.toLowerCase().includes(L)):e},[e,ae]);h.useEffect(()=>{!X&&!j&&ue("")},[j,X,ue]);const Be=h.useRef(c);h.useEffect(()=>{j&&c!==Be.current&&(X||(Be.current=c,ue(c||"")))},[c,j,X,ue]);const he=h.useCallback(L=>{pe||fe(L),k?.(L)},[pe,k]),ze=h.useCallback(L=>{if(t){const re=new Set(ee);re.has(L)?re.delete(L):re.add(L),he(Array.from(re));return}if(he(L),j){const re=e.find(xe=>xe.value===L)??e.flatMap(xe=>xe.children??[]).find(xe=>xe.value===L);re&&ue(re.label)}Z(!1)},[t,he,j,Z,ee,e,ue]),Ee=h.useCallback((L,re)=>{if(L.stopPropagation(),!t){he("");return}const xe=ee.filter(Mt=>Mt!==re);he(xe)},[t,ee,he]),ie=h.useMemo(()=>Se.filter(L=>!L.disabled),[Se]),Re=h.useMemo(()=>ie.filter(L=>ee.includes(L.value)).length,[ie,ee]),Ne=h.useCallback(L=>{j&&!t&&!L&&ze(ae),Z(L)},[ze,j,t,ae,Z]),{allSelectedInFiltered:$e,someSelectedInFiltered:at}=h.useMemo(()=>{const L=ie.length>0&&Re===ie.length;return{allSelectedInFiltered:L,someSelectedInFiltered:Re>0&&!L}},[ie,Re]),ve=h.useCallback(()=>{if(!(!t||ie.length===0))if($e){const L=new Set(ie.map(re=>re.value));he(ee.filter(re=>!L.has(re)))}else{const L=new Set(ee);ie.forEach(re=>L.add(re.value)),he(Array.from(L))}},[$e,t,ie,ee,he]),He=ee.length>0;h.useEffect(()=>{X&&j&&!t&&!N&&requestAnimationFrame(()=>{const L=le.current;if(!L)return;L.focus();const re=L.value?.length??0;L.setSelectionRange?.(re,re)})},[X,j,t,N]);const Me=!t&&He?ee[0]:void 0,me=h.useMemo(()=>Me?e.find(L=>L.value===Me)??e.flatMap(L=>L.children??[]).find(L=>L.value===Me):void 0,[e,Me]),Rt=h.useCallback(()=>t?He?B?.(e,ee,Ee)||n.jsx(jn,{options:e,selectedValues:ee,handleRemoveTag:Ee}):n.jsx("span",{className:"text-secondary truncate",children:d}):me?n.jsxs(n.Fragment,{children:[me.icon&&n.jsx(T.DialIcon,{icon:me.icon}),n.jsx(T.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}),[He,t,c,l,s,d,me,e,ee,Ee,B]);h.useImperativeHandle(M,()=>({dismiss:()=>{Z(!1)}}));const Oe=h.useCallback(()=>{ue(ee.length===1?me?.label??ae:"")},[ae,ee.length,ue,me?.label]),Ve=h.useCallback(()=>{N||(Z(!X),j&&!t&&(Oe(),le.current?.focus()))},[N,j,X,t,Oe,Z]);return n.jsx(T.DialDropdown,{open:X,onOpenChange:Ne,disabled:N,closable:S,onClose:A,placement:"bottom-start",allowedPlacements:["bottom-start","top-start"],maxDropdownHeight:f?null:so,listClassName:D,renderOverlay:()=>n.jsxs("div",{id:`list-${r||H}`,role:"listbox","aria-multiselectable":t||void 0,className:ro,children:[_&&n.jsx(n.Fragment,{children:typeof _=="function"?_():_}),(f||S)&&e.length>8&&n.jsxs("div",{className:"flex items-center gap-2 px-2 pt-2",children:[f&&n.jsx(C.DialSearch,{size:p,placeholder:g,onChange:ue,value:ae,id:`search-${r||H}`,containerClassName:I.mergeClasses(C.SIZE_CONFIG[p].containerClassName,"w-full")}),S&&n.jsx(C.DialButton,{"aria-label":"Close select",className:"shrink-0",iconBefore:n.jsx(F.IconX,{size:z.DIAL_ICON_SIZE.SM}),onClick:L=>{A?.(L),Z(!1)}})]}),t&&u&&ie.length>0&&n.jsx("div",{className:oe(ot,"mt-2"),children:n.jsx(Xt,{id:`${r||H}-selectAll`,label:v,checked:$e,indeterminate:at,onChange:ve,ariaLabel:v})}),n.jsx("div",{className:oe("overflow-y-auto max-h-[352px]",j&&Se.length===0?"":"py-1"),children:Se.length===0?!j&&n.jsx("div",{className:"px-2 py-3",children:n.jsx(T.DialNoDataContent,{icon:y??n.jsx(F.IconClipboardX,{size:z.DIAL_ICON_SIZE.LG,stroke:.5}),title:x,description:b})}):Se.map(L=>{const re=ee.includes(L.value);return t?n.jsxs("div",{role:"option","aria-selected":re,"aria-disabled":!!L.disabled,className:oe(ot,re&&no,L.disabled&&It,"w-full"),children:[n.jsx(Xt,{id:`${r||H}-${L.value}`,label:n.jsxs("span",{className:"flex w-full flex-1 pl-2 min-w-0 items-center gap-2 text-primary",children:[L.icon&&n.jsx(T.DialIcon,{icon:L.icon}),n.jsx("span",{className:"truncate",children:L.labelNode??L.label})]}),checked:re,disabled:L.disabled,onChange:()=>!L.disabled&&ze(L.value),ariaLabel:L.label}),L.description&&n.jsx("div",{className:"text-secondary dial-small-text",children:L.description})]},L.value):L.children?.length?n.jsx(oo,{opt:L,selectedValues:ee,onSelect:ze},L.value):n.jsx("button",{role:"option",type:"button","aria-selected":re,"aria-disabled":!!L.disabled,disabled:L.disabled,className:oe(ot,re&&nr,L.disabled&&It),onClick:()=>!L.disabled&&ze(L.value),children:n.jsxs("div",{className:"flex items-center gap-2 w-full",children:[L.icon&&n.jsx(T.DialIcon,{icon:L.icon}),n.jsx(T.DialEllipsisTooltip,{text:L.labelNode??L.label}),L.description&&n.jsx("div",{className:"text-secondary dial-small-text",children:L.description})]})},L.value)})}),O&&n.jsx("div",{onClick:L=>{$?.(L),$&&Z(!1)},children:typeof O=="function"?O():O})]}),children:n.jsxs("div",{role:"button",tabIndex:0,"aria-roledescription":"button to open select list","aria-haspopup":"listbox","aria-expanded":X,"aria-controls":`list-${r||H}`,className:I.mergeClasses(to,N&&"opacity-75 !cursor-not-allowed !border-primary",o===yt.Sm?"min-h-[25px] px-1.5 py-1":"min-h-[38px] px-3 py-2",m&&"dial-input-error",i===Dt.Secondary?"!bg-layer-4 !h-auto":"",w),onMouseDown:L=>{N||j&&!t&&(Oe(),L.preventDefault())},onClick:()=>{Ve()},onKeyDown:L=>{(L.key===" "||L.code==="Space")&&(L.preventDefault(),Ve())},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||H}`,type:"text",placeholder:g??d,value:ae||"",onChange:L=>ue(L.currentTarget.value.trimStart()),onFocus:()=>!N&&Z(!0),onMouseDown:L=>{Oe(),L.stopPropagation()},onClick:L=>{L.stopPropagation()},onKeyDown:L=>{L.stopPropagation()},className:"bg-transparent outline-none w-full dial-small-text",ref:le,disabled:N,"aria-disabled":N,autoComplete:"off"})}):n.jsx("div",{className:"flex w-full min-w-0 items-center gap-2 text-primary",children:Rt()}),!j&&n.jsx(T.DialIcon,{icon:io,className:oe("text-primary",X&&"rotate-180")})]})})},lo=({label:e,required:t,captionDescription:r,containerClassName:s,selectClassName:a,error:i,id:o,caption:l,readonly:c,value:d,defaultEmptyText:f,...p})=>{const g=h.useCallback(()=>{if(!d||Array.isArray(d)&&d.length===0)return f??"None";if(Array.isArray(d))return n.jsx(jn,{options:p.options,selectedValues:d});{const u=p.options?.find(m=>m.value===d);return n.jsx("span",{"aria-readonly":!0,className:"text-primary",children:u?.label||d})}},[d,p.options,f]);return n.jsx(C.DialFormItem,{id:o,label:e,required:t,description:l,error:i,captionDescription:r,className:s,readonly:c,value:g(),defaultEmptyText:f,children:n.jsx(Te,{className:a,value:d,elementId:o,invalid:!!i,...p})})};function Tn(e){let t=null;return()=>(t==null&&(t=e()),t)}function co(e,t){return e.filter(r=>r!==t)}function uo(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 fo{enter(t){const r=this.entered.length,s=a=>this.isNodeInDocument(a)&&(!a.contains||a.contains(t));return this.entered=uo(this.entered.filter(s),[t]),r===0&&this.entered.length>0}leave(t){const r=this.entered.length;return this.entered=co(this.entered.filter(this.isNodeInDocument),t),r>0&&this.entered.length===0}reset(){this.entered=[]}constructor(t){this.entered=[],this.isNodeInDocument=t}}class po{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 _t="__NATIVE_FILE__",wn="__NATIVE_URL__",En="__NATIVE_TEXT__",On="__NATIVE_HTML__",Br=Object.freeze(Object.defineProperty({__proto__:null,FILE:_t,HTML:On,TEXT:En,URL:wn},Symbol.toStringTag,{value:"Module"}));function Ut(e,t,r){const s=t.reduce((a,i)=>a||e.getData(i),"");return s??r}const sr={[_t]:{exposeProperties:{files:e=>Array.prototype.slice.call(e.files),items:e=>e.items,dataTransfer:e=>e},matchesTypes:["Files"]},[On]:{exposeProperties:{html:(e,t)=>Ut(e,t,""),dataTransfer:e=>e},matchesTypes:["Html","text/html"]},[wn]:{exposeProperties:{urls:(e,t)=>Ut(e,t,"").split(`
2
- `),dataTransfer:e=>e},matchesTypes:["Url","text/uri-list"]},[En]:{exposeProperties:{text:(e,t)=>Ut(e,t,""),dataTransfer:e=>e},matchesTypes:["Text","text/plain"]}};function go(e,t){const r=sr[e];if(!r)throw new Error(`native type ${e} has no configuration`);const s=new po(r);return s.loadDataTransfer(t),s}function Zt(e){if(!e)return null;const t=Array.prototype.slice.call(e.types||[]);return Object.keys(sr).filter(r=>{const s=sr[r];return s?.matchesTypes?s.matchesTypes.some(a=>t.indexOf(a)>-1):!1})[0]||null}const ho=Tn(()=>/firefox/i.test(navigator.userAgent)),An=Tn(()=>!!window.safari);class zr{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,f;for(;c<=d;){f=Math.floor(.5*(c+d));const u=r[f];if(u<t)c=f+1;else if(u>t)d=f-1;else return s[f]}l=Math.max(0,d);const p=t-r[l],g=p*p;return s[l]+a[l]*p+i[l]*g+o[l]*p*g}constructor(t,r){const{length:s}=t,a=[];for(let u=0;u<s;u++)a.push(u);a.sort((u,m)=>t[u]<t[m]?-1:1);const i=[],o=[];let l,c;for(let u=0;u<s-1;u++)l=t[u+1]-t[u],c=r[u+1]-r[u],i.push(l),o.push(c/l);const d=[o[0]];for(let u=0;u<i.length-1;u++){const m=o[u],v=o[u+1];if(m*v<=0)d.push(0);else{l=i[u];const x=i[u+1],b=l+x;d.push(3*b/((b+x)/m+(b+l)/v))}}d.push(o[o.length-1]);const f=[],p=[];let g;for(let u=0;u<d.length-1;u++){g=o[u];const m=d[u],v=1/i[u],x=m+d[u+1]-g-g;f.push((g-m-x)*v),p.push(x*v*v)}this.xs=t,this.ys=r,this.c1s=d,this.c2s=f,this.c3s=p}}const mo=1;function _n(e){const t=e.nodeType===mo?e:e.parentElement;if(!t)return null;const{top:r,left:s}=t.getBoundingClientRect();return{x:s,y:r}}function gt(e){return{x:e.clientX,y:e.clientY}}function xo(e){var t;return e.nodeName==="IMG"&&(ho()||!(!((t=document.documentElement)===null||t===void 0)&&t.contains(e)))}function bo(e,t,r,s){let a=e?t.width:r,i=e?t.height:s;return An()&&e&&(i/=window.devicePixelRatio,a/=window.devicePixelRatio),{dragPreviewWidth:a,dragPreviewHeight:i}}function Co(e,t,r,s,a){const i=xo(t),l=_n(i?e:t),c={x:r.x-l.x,y:r.y-l.y},{offsetWidth:d,offsetHeight:f}=e,{anchorX:p,anchorY:g}=s,{dragPreviewWidth:u,dragPreviewHeight:m}=bo(i,t,d,f),v=()=>{let S=new zr([0,.5,1],[c.y,c.y/f*m,c.y+m-f]).interpolate(g);return An()&&i&&(S+=(window.devicePixelRatio-1)*m),S},x=()=>new zr([0,.5,1],[c.x,c.x/d*u,c.x+u-d]).interpolate(p),{offsetX:b,offsetY:y}=a,N=b===0||b,w=y===0||y;return{x:N?b:x(),y:w?y:v()}}class vo{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 yo(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function $r(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){yo(e,a,r[a])})}return e}class Do{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 $r({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 $r({anchorX:.5,anchorY:.5,captureDraggingState:!1},r||{})}isDraggingNativeItem(){const t=this.monitor.getItemType();return Object.keys(Br).some(r=>Br[r]===t)}beginDragNativeItem(t,r){this.clearCurrentDragSourceNode(),this.currentNativeSource=go(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&&_n(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=gt(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 f=this.monitor.getSourceId(),p=this.sourceNodes.get(f),g=this.sourcePreviewNodes.get(f)||p;if(g){const{anchorX:u,anchorY:m,offsetX:v,offsetY:x}=this.getCurrentSourcePreviewNodeOptions(),N=Co(p,g,o,{anchorX:u,anchorY:m},{offsetX:v,offsetY:x});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:gt(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=gt(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:gt(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 vo(r,s),this.actions=t.getActions(),this.monitor=t.getMonitor(),this.registry=t.getRegistry(),this.enterLeaveCounter=new fo(this.isNodeInDocument)}}const Io=function(t,r,s){return new Do(t,r,s)},So=({onChange:e,emptyTextFirstLine:t,emptyTextSecondLine:r,emptyButtonLabel:s,acceptTypes:a,maxFilesCount:i,multiple:o,fileFormatError:l,fileCountError:c,fileSizeError:d,getIsFileFormatError:f,getIsFileSizeError:p})=>{const g=h.useRef(null),u=h.useRef(null),[m,v]=h.useState([]),[x,b]=h.useState(!1),[y,N]=h.useState(!1),w=h.useCallback(G=>{const B=G.target.files;if(B&&B.length>0){const H=Array.from(B),q=f?.(H),K=p?.(H);q?b(!0):K?N(!0):e(H)}},[f,p,e]),D=h.useCallback(G=>i&&G?.length>i,[i]),S=h.useMemo(()=>x||y||D(m),[x,y,D,m]),_=()=>{v([]),b(!1),N(!1)},O=h.useMemo(()=>x?n.jsx(C.DialErrorText,{text:l}):y?n.jsx(C.DialErrorText,{text:d}):D(m)?n.jsx(C.DialErrorText,{text:c}):null,[c,l,d,m,D,x,y]);h.useEffect(()=>{_()},[a]);const[{isOver:A,canDrop:k},j]=gr(()=>({accept:[_t],drop(G){const B=G.files,H=f?.(B)??!1,q=p?.(B)??!1,K=D?.(B)??!1;if(b(H),N(q),H||q||K){v(B);return}e(B),_()},collect:G=>({isOver:G.isOver(),canDrop:G.canDrop()})}),[e,f,p,D]),M=G=>{(G.key==="Enter"||G.key==="Space")&&(G.preventDefault(),u.current?.click())},$=G=>{G?.preventDefault();const B=Array.from(G.dataTransfer?.items??[]);b(!!f?.(B)),N(!!p?.(B)),v(B)},U=G=>{G.target===G.currentTarget&&_()},J=oe("border border-dashed rounded w-full cursor-pointer relative h-full hover:border-hover",!k&&!S&&"border-primary",k&&(A?"border-accent-primary":"border-hover"),S&&"border-error");return j(g),n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:J,ref:g,onDragOver:$,onDragLeave:U,children:[n.jsxs("label",{htmlFor:"file",tabIndex:0,onKeyDown:M,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(C.DialPrimaryButton,{appearance:E.ButtonAppearance.Ghost,label:s,onClick:()=>u.current?.click()})]}),n.jsx("input",{multiple:o,id:"file",type:"file",ref:u,hidden:!0,accept:a,onChange:w})]}),n.jsx(n.Fragment,{children:O})]})},No=({iconBefore:e,className:t,...r})=>{const s=r.invalid,a=()=>n.jsx("div",{className:"mr-2",children:s?n.jsx(F.IconExclamationCircle,{...z.BASE_ICON_PROPS,className:"text-error"}):e});return n.jsx(C.DialInput,{...r,iconBefore:a(),containerClassName:oe("h-[40px] p-0",s&&"h-[60px]"),className:oe("rounded-r-none border-r-0",s&&"text-error",t)})},jo=({children:e,existingFiles:t,onDrop:r,getIsFileFormatError:s,getIsFileSizeError:a,maxFilesCount:i,fileFormatError:o,fileSizeError:l,fileCountError:c})=>{const d=h.useRef(null),[f,p]=h.useState(!1),[g,u]=h.useState(!1),[m,v]=h.useState(0),x=h.useCallback(()=>{p(!1),u(!1),v(0)},[]),b=h.useCallback(A=>!!(i&&t.length+A.length>i),[i,t.length]),y=f||g,[{isOver:N,canDrop:w},D]=gr(()=>({accept:[_t],drop(A){const k=A.files,j=[...t,...k],M=s?.(k)??!1,$=a?.(k)??!1,U=b?.(k)??!1;if(p(M),u($),M||$||U){v(k.length);return}r(j),x()},collect:A=>({isOver:A.isOver(),canDrop:A.canDrop()})}),[t,r,s,a,b,x]),S=A=>{A.preventDefault();const k=Array.from(A.dataTransfer?.items??[]);p(!!s?.(k)),u(!1),v(k.length)},_=A=>{A.target===A.currentTarget&&x()};D(d);const O=b(Array.from({length:m}));return n.jsxs("div",{className:"h-full flex flex-col",children:[n.jsx("div",{ref:d,onDragOver:S,onDragLeave:_,className:oe("flex-1 min-h-0 border border-solid rounded p-2 overflow-y-auto",!y&&!O&&(w&&N?"border-accent-primary":"border-primary"),(y||O)&&"border-error"),children:e}),f&&n.jsx(C.DialErrorText,{text:o}),g&&n.jsx(C.DialErrorText,{text:l}),!f&&!g&&O&&n.jsx(C.DialErrorText,{text:c})]})},Ln=e=>{const{files:t,iconBeforeInput:r,dynamicIcon:s,onChange:a,isInvalid:i,errorText:o,removeButtonAriaLabel:l,getIsMultiFilesSizeError:c,multiFilesSizeError:d,getIsFileFormatError:f,getIsFileSizeError:p,maxFilesCount:g}=e,u=h.useCallback((x,b)=>{x.stopPropagation(),a(t?.filter(y=>y.name!==b)||[])},[a,t]),m=h.useCallback(x=>n.jsx(At,{"aria-label":l,onClick:b=>u(b,x)}),[l,u]),v=h.useMemo(()=>n.jsx("div",{className:"flex flex-col gap-y-1",children:t?.map((x,b)=>n.jsx(No,{id:x.name,value:x.name,iconAfter:m(x.name),iconBefore:r||s?.(x.name),invalid:i?.(x),error:i?.(x)?o:""},x.name+b))}),[t,r,s,i,o,m]);return n.jsx(ri,{backend:Io,children:!t||t.length===0?n.jsx(So,{...e,onChange:a}):n.jsxs(n.Fragment,{children:[n.jsx(jo,{existingFiles:t,onDrop:a,getIsFileFormatError:f,getIsFileSizeError:p,maxFilesCount:g,fileFormatError:e.fileFormatError,fileSizeError:e.fileSizeError,fileCountError:e.fileCountError,children:v}),c?.(t)&&n.jsx(C.DialErrorText,{text:d})]})})},To=({onChange:e,fieldTitle:t,elementId:r,files:s,maxFilesCount:a,maxFileSize:i,maxMultiFilesSize:o,fileFormatError:l,fileCountError:c,fileSizeError:d,multiFilesSizeError:f,multiple:p=!0,acceptTypes:g,deleteAllButtonLabel:u,addButtonLabel:m,additionalActionButtons:v,...x})=>{const b=h.useRef(null),y=()=>b.current?.click(),N=()=>{e([])},w=h.useCallback(O=>O?.some(A=>!(g==="/"||g?.toLowerCase()?.includes(A?.type?.toLowerCase()))),[g]),D=h.useCallback(O=>{if(!i)return!1;const A=i*(1024*1024);return O?.some(k=>{const j=k.size;return!!j&&j>A})},[i]),S=h.useCallback(O=>{if(!o||!p)return!1;const A=o*1024*1024;return O.reduce((j,M)=>j+M.size,0)>A},[o,p]),_=h.useCallback(O=>{const A=O.target.files;if(A&&A.length>0){const k=Array.from(A),j=w(k),M=D(k);!j&&!M&&e([...s||[],...k])}},[w,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(ke.DialLabel,{label:`${t}: ${p?s?.length||0:""}`,htmlFor:r}),p&&!!s?.length&&n.jsxs("div",{className:"flex flex-row items-center gap-x-2",children:[n.jsx(C.DialNeutralButton,{label:u,iconBefore:n.jsx(F.IconTrashX,{...z.BASE_ICON_PROPS}),onClick:N}),(a?a>s?.length:!0)&&n.jsx(C.DialPrimaryButton,{appearance:E.ButtonAppearance.Ghost,iconBefore:n.jsx(F.IconPlus,{...z.BASE_ICON_PROPS}),label:m,onClick:y}),v]})]}),s&&s.length>0&&n.jsx("input",{id:"file",type:"file",multiple:p,ref:b,hidden:!0,accept:g,onChange:_}),n.jsx(Ln,{files:s,onChange:e,acceptTypes:g,maxFilesCount:a,multiple:p,fileFormatError:l,fileCountError:c,fileSizeError:d,multiFilesSizeError:f,getIsFileFormatError:w,getIsFileSizeError:D,getIsMultiFilesSizeError:S,...x})]})},wo=({icon:e,ariaLabel:t,size:r=E.ElementSize.Standard,disabled:s=!1,className:a,buttonClassName:i,iconClassName:o,caretIcon:l=n.jsx(F.IconChevronDown,{size:z.DIAL_ICON_SIZE.SM}),showCaret:c=!0,placement:d="bottom-start",matchReferenceWidth:f=!1,open:p,onOpenChange:g,defaultOpen:u=!1,...m})=>{const v=r===E.ElementSize.Small,[x,b]=h.useState(u),y=p??x,N=v?"w-8 px-0":"w-10 px-0",w={[E.ElementSize.Small]:"size-5",[E.ElementSize.Standard]:"size-6",[E.ElementSize.Large]:"size-7"},D=S=>{b(S),g?.(S)};return n.jsx(T.DialDropdown,{...m,disabled:s,placement:d,matchReferenceWidth:f,className:a,open:y,onOpenChange:D,defaultOpen:u,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",v?"h-8 px-2":"h-10 px-2",c?void 0:N,i),children:[n.jsx(T.DialIcon,{icon:e,className:I.mergeClasses("flex items-center justify-center text-inherit",w[r],c&&"-mr-2",o,T.DIAL_KIT_CLASS.dropdownIcon)}),c&&n.jsxs("div",{className:I.mergeClasses("relative z-10 inline-grid size-5 shrink-0 place-items-center",T.DIAL_KIT_CLASS.dropdownIconCaret),children:[n.jsx("div",{className:"absolute inset-0 rounded-full bg-layer-2"}),n.jsx(T.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",y&&"rotate-180")})]})]})})},Eo="application/octet-stream";function Oo(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=Wt(s,!0),i=e.filter(c=>c!==r).map(c=>{const d=c.path||c.url||"",f=Ao(c.nodeType),p=f===C.DialFileNodeType.FOLDER,g=Wt(d,p);let u;return c.parentPath===null||c.parentPath===void 0?u=a:c.parentPath===""?u="":u=Wt(c.parentPath,!0),{...c,originalPath:d,path:g,parentPath:u,nodeType:f}}),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:_o(c.resourceType),folderId:t,updatedAt:c.updatedAt?new Date(c.updatedAt).toISOString():new Date().toISOString(),items:c.nodeType===C.DialFileNodeType.FOLDER?[]:void 0};c.nodeType===C.DialFileNodeType.ITEM&&(d.extension=Lo(c.name),d.contentType=c.contentType||Eo,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||""),f=c.path.slice(0,d),p=o.get(f);p&&p.nodeType===C.DialFileNodeType.FOLDER?(p.items=p.items||[],p.items.push(c)):l.push(c)}}),l}function Wt(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 Ao(e){return e.toUpperCase()==="FOLDER"?C.DialFileNodeType.FOLDER:C.DialFileNodeType.ITEM}function _o(e){if(!e)return;const t=e.toUpperCase();return Object.values(C.DialFileResourceType).find(s=>s.toUpperCase()===t)}function Lo(e){const t=e.split(".");return t.length>1?t[t.length-1]:""}function ko(e,t="Prompts",r="prompts/public/",s="root"){const a=Oo(e,s);return[{id:s,name:t,path:r,parentPath:"",nodeType:C.DialFileNodeType.FOLDER,folderId:s,items:a}]}const kn=({locale:e,timeZone:t,date:r=new Date}={})=>{const s=t??Intl.DateTimeFormat().resolvedOptions().timeZone;try{const a=new Intl.DateTimeFormat(e,{timeZone:s,timeZoneName:"longOffset"}).formatToParts(r).find(i=>i.type==="timeZoneName")?.value;return a?`(${a}) ${s}`:s}catch{return s}};var tt=(e=>(e.Sections="sections",e.Flat="flat",e.FlatSections="flat-sections",e))(tt||{}),ct=(e=>(e.Select="select",e.Radio="radio",e))(ct||{}),Lt=(e=>(e.Row="row",e.Column="column",e))(Lt||{}),V=(e=>(e.String="string",e.Number="number",e.Integer="integer",e.Boolean="boolean",e.Object="object",e.Array="array",e.Null="null",e))(V||{});const Ro={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",typeColumnHeader:"Type",entryTypeString:"String",entryTypeNumber:"Number",entryTypeBoolean:"Boolean",entryTypeNull:"Null",entryTypeObject:"Object",entryTypeArray:"Array",entryTypeChangeWarning:"Changing type will reset the current value.",booleanTrueOption:"True",booleanFalseOption:"False",invalidJsonError:"Invalid JSON"},Rn=h.createContext(null);function we(){const e=h.useContext(Rn);if(!e)throw new Error("useSchemaContext must be used inside DialSchemaRenderer");return e}function Hr(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 Q(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 f of a)i=i?.[f];if(!i||typeof i!="object")return e;const{$ref:o,...l}=s,c=i;s={...c.$ref?Q(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=Hr(o,Q(l,t,r+1));s=Hr(o,i)}return s}function Mn(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 kt(e){return e==null||e===""}function Ye(e){return e.type===V.Object||e.properties!=null&&e.oneOf==null&&e.anyOf==null&&e.type==null}function St(e){return e.replace(/_/g," ").replace(/([a-z])([A-Z])/g,"$1 $2").replace(/\b\w/g,t=>t.toUpperCase())}const hr=e=>`"${e}" is required`;function Pn(e,t){return e.type===V.Null?"null":e.$ref?Q(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 _e(e,t,r=0){if(r>15)return;const s=Q(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=Q({$ref:s.discriminator.mapping[a]},t);return{..._e(i,t,r+1)??{},[s.discriminator.propertyName]:a}}}if(Ye(s)){if(s.properties){const a={};let i=!1;for(const[o,l]of Object.entries(s.properties)){const c=_e(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 Ae(e,t,r,s="",a=0){if(a>15)return[];const i=[],o=Q(t,r);if(o.anyOf){const d=o.anyOf.filter(f=>f.type!==V.Null);return e!=null&&d.length===1?Ae(e,d[0],r,s,a+1):i}if(o.oneOf&&o.discriminator){const d=o.discriminator.propertyName,f=e?.[d];if(f&&o.discriminator.mapping[f]){const p={$ref:o.discriminator.mapping[f]},g=Q(p,r);return Ae(e,g,r,s,a+1)}return i}if(o.type===V.Array||!o.type&&Array.isArray(e)){if(Array.isArray(e)&&o.items)for(let d=0;d<e.length;d++){const f=Ae(e[d],o.items,r,`${s}[${d}]`,a+1);i.push(...f)}return i}if(!Ye(o))return i;const l=o.required??[],c=e;for(const d of l){const f=o.properties?.[d];if(f&&Q(f,r).isHidden)continue;const p=s?`${s}.${d}`:d,g=c?.[d];if(kt(g)){const u=f?.title??St(d);i.push({path:p,message:hr(u)})}}if(c&&o.properties)for(const[d,f]of Object.entries(o.properties)){if(Q(f,r).isHidden)continue;const p=s?`${s}.${d}`:d,g=c[d];if(g!=null){const u=Ae(g,f,r,p,a+1);i.push(...u)}}if(c&&o.additionalProperties!=null&&o.additionalProperties!==!1&&typeof o.additionalProperties=="object"){const d=o.additionalProperties;for(const[f,p]of Object.entries(c)){const g=s?`${s}.${f}`:f,u=Ae(p,d,r,g,a+1);i.push(...u)}}return i}function mr(e,t,r){const s=Q(t,r);if(Array.isArray(e))return`${e.length} item${e.length!==1?"s":""}`;if(Ye(s)&&s.properties){const a=Object.entries(s.properties).filter(([,c])=>!Q(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===V.Null);return s>=0?s:0}if(Array.isArray(e)){const s=t.findIndex(a=>Q(a,r).type===V.Array);return s>=0?s:0}if(typeof e=="boolean"){const s=t.findIndex(a=>Q(a,r).type===V.Boolean);return s>=0?s:0}if(typeof e=="number"){const s=t.findIndex(a=>{const i=Q(a,r);return i.type===V.Number||i.type===V.Integer});return s>=0?s:0}if(typeof e=="string"){const s=t.findIndex(a=>Q(a,r).type===V.String);return s>=0?s:0}if(typeof e=="object"){const s=e;for(let a=0;a<t.length;a++){const i=Q(t[a],r);if(i.discriminator&&i.discriminator.propertyName in s)return a}for(let a=0;a<t.length;a++){const i=Q(t[a],r);if(Ye(i)||i.oneOf)return a}return 0}return 0}function Po(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 Fn(e){switch(Array.isArray(e.type)?e.type[0]:e.type){case V.String:return"";case V.Boolean:return!1;case V.Array:return[];case V.Integer:case V.Number:return;default:return{}}}const Fo=[V.String,V.Number,V.Boolean,V.Null,V.Object,V.Array];function Bo(e){return Array.isArray(e)?V.Array:typeof e=="object"&&e!==null?V.Object:typeof e=="boolean"?V.Boolean:typeof e=="number"?V.Number:e===null?V.Null:V.String}const zo={[V.String]:"",[V.Number]:0,[V.Boolean]:!1,[V.Null]:null,[V.Object]:{},[V.Array]:[]};function $o(e){return zo[e]}const dt=({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,f]=h.useState(l),p=a===0,g="rounded border border-secondary",u=I.mergeClasses("flex items-center gap-2 cursor-pointer select-none transition-colors",p?"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",p?"p-4":"p-3");return n.jsxs("div",{className:g,children:[n.jsxs("div",{className:u,onClick:()=>f(v=>!v),role:"button","aria-expanded":d,children:[n.jsx("span",{className:"shrink-0 text-secondary",children:d?n.jsx(F.IconChevronDown,{size:16,stroke:2}):n.jsx(F.IconChevronRight,{size:16,stroke:2})}),n.jsx("span",{className:I.mergeClasses("flex-1 truncate",p?"dial-small-semi-text text-primary":"dial-small-text text-primary"),children:e}),t&&n.jsx(ke.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(T.DialIcon,{icon:n.jsx(F.IconAlertTriangle,{size:13,stroke:2})}),s," error",s>1?"s":""]}):n.jsx(T.DialIcon,{icon:n.jsx(F.IconCheck,{size:13,stroke:2}),className:"text-success shrink-0"}),o&&n.jsx(At,{size:E.ElementSize.Small,onClick:v=>{v.stopPropagation(),o()},"aria-label":c,className:"ml-1 shrink-0 p-0.5"})]}),d&&n.jsx("div",{className:m,children:i})]})},Bn=({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:f=!1}=we(),p=Q(e,l),g=Ye(p),u=p.type===V.Array;if(g||u){const x=mr(t,p,l),b=Ae(t,p,l,s.join(".")),y=s.join("."),N=y+".",w=!f||d.has(y)||[...d].some(D=>D.startsWith(N));return n.jsx(dt,{title:o??p.title??s[s.length-1]??"Section",description:p.description,level:a,summary:x,errorCount:w?b.length:0,defaultExpanded:c,children:n.jsx(Le,{schema:p,value:t,onChange:r,path:s,level:a+1,required:i})})}const v=(!f||d.has(s.join(".")))&&i&&kt(t)?hr(o??"Field"):void 0;return n.jsx(C.DialFormItem,{label:o,required:i,description:p.description,error:v,children:n.jsx(Le,{schema:p,value:t,onChange:r,path:s,level:a,required:i,suppressInlineError:!0})})},vt=({schema:e,value:t,onChange:r,path:s,level:a})=>{const{rootSchema:i,texts:o}=we(),l=Q(e,i),c=Mn(Object.entries(l.properties??{}).filter(([,p])=>!Q(p,i).isHidden)),d=l.required??[],f=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(([p,g])=>{const m=Q(g,i).title??g.title??St(p),v=d.includes(p);return n.jsx(Bn,{schema:g,value:f[p],onChange:x=>r({...f,[p]:x}),path:[...s,p],level:a,required:v,label:m},p)})})},Ho=({schema:e,value:t,onChange:r,path:s,level:a})=>{const{rootSchema:i,texts:o,readonly:l=!1,defaultExpanded:c=!0}=we(),d=Array.isArray(t)?t:[],f=e.items,[p,g]=h.useState(void 0);if(!f)return n.jsx("p",{className:"dial-tiny-text text-secondary italic",children:o.noItemSchema});const u=h.useMemo(()=>Q(f,i),[f,i]),m=h.useMemo(()=>u.discriminator,[u]),v=h.useMemo(()=>m?.propertyName,[m]),x=h.useMemo(()=>m?Object.keys(m.mapping).map(w=>({value:w,label:w})):[],[m]),b=()=>{const w=p??x[0]?.value;let D;if(m&&w){const S=Q({$ref:m.mapping[w]},i);D={..._e(S,i)??{},[m.propertyName]:w}}else D=_e(u,i)??Fn(u);r([...d,D])},y=w=>{r(d.filter((D,S)=>S!==w))},N=(w,D)=>{r(d.map((S,_)=>_===w?D:S))};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((w,D)=>{const S=Po(w,v,D),_=mr(w,u,i),O=Ae(w,u,i,`${s.join(".")}[${D}]`);return n.jsx(dt,{title:S,level:a,summary:_,errorCount:O.length,onRemove:l?void 0:()=>y(D),defaultExpanded:c,removeItemAriaLabel:o.removeItemAriaLabel,children:n.jsx(Le,{schema:f,value:w,onChange:A=>N(D,A),path:[...s,String(D)],level:a+1})},D)}),!l&&n.jsxs("div",{className:"flex items-center gap-2 pt-1",children:[x.length>0&&n.jsx("div",{className:"flex-1 max-w-[280px]",children:n.jsx(Te,{options:x,value:p??x[0]?.value,placeholder:o.selectTypeToAdd,onChange:w=>{const D=typeof w=="string"?w:w[0];g(D)}})}),n.jsx(C.DialGhostButton,{label:o.addItem,iconBefore:n.jsx(F.IconPlus,{size:16,stroke:2}),onClick:b})]})]})},Vo=({schema:e,value:t,onChange:r,path:s,level:a})=>{const{rootSchema:i,texts:o,readonly:l=!1}=we(),c=h.useId(),d=e.discriminator;if(d){const x=d.propertyName,b=d.mapping,y=Object.keys(b).map(S=>({value:S,label:S})),N=typeof t=="object"&&t!==null?t[x]:void 0,w=N?Q({$ref:b[N]},i):void 0,D=S=>{const _=Q({$ref:b[S]},i),O=_e(_,i)??{};r({...O,[x]:S})};if(e.discriminatorDisplay===ct.Radio){const S=e.discriminatorOrientation===Lt.Row,_=N?(()=>{const O=Q({$ref:b[N]},i),{[x]:A,...k}=O.properties??{};return{...O,properties:k}})():void 0;return S?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(b).map(O=>{const A=Q({$ref:b[O]},i);return n.jsx(T.DialRadioButton,{name:c,value:O,inputId:`${c}-${O}`,label:A.title??O,checked:N===O,disabled:l,onChange:()=>D(O)},O)})}),_&&n.jsx(vt,{schema:_,value:t,onChange:r,path:s,level:a})]}):n.jsx("div",{role:"radiogroup",className:"flex flex-col gap-2",children:Object.keys(b).map(O=>{const A=Q({$ref:b[O]},i),k=N===O,{[x]:j,...M}=A.properties??{},$={...A,properties:M};return n.jsxs("div",{className:"flex flex-col",children:[n.jsx(T.DialRadioButton,{name:c,value:O,inputId:`${c}-${O}`,label:A.title??O,checked:k,disabled:l,onChange:()=>D(O)}),k&&n.jsx("div",{className:"ml-6 mt-2",children:n.jsx(vt,{schema:$,value:t,onChange:r,path:s,level:a})})]},O)})})}return n.jsxs("div",{className:"flex flex-col gap-3",children:[n.jsx("div",{className:"flex-1 max-w-[280px]",children:n.jsx(Te,{options:y,value:N,placeholder:o.selectTypePlaceholder,disabled:l,onChange:S=>{const _=typeof S=="string"?S:S[0];_&&D(_)}})}),w&&n.jsx("div",{className:"pl-3",children:n.jsx(vt,{schema:w,value:t,onChange:r,path:s,level:a})})]})}const f=e.oneOf??[],g=(()=>{if(t==null)return 0;if(typeof t=="object"&&!Array.isArray(t)){for(let x=0;x<f.length;x++)if(Q(f[x],i).required?.every(y=>y in t))return x}return 0})(),u=x=>{const b=Q(f[x],i),y=_e(b,i);r(y??null)},m=f[g];if(e.discriminatorDisplay===ct.Radio)return n.jsx("div",{role:"radiogroup",className:"flex flex-col gap-2",children:f.map((x,b)=>{const y=Q(x,i),N=Pn(x,i)??`Option ${b+1}`,w=g===b;return n.jsxs("div",{className:"flex flex-col",children:[n.jsx(T.DialRadioButton,{name:c,value:String(b),inputId:`${c}-${b}`,label:N,checked:w,disabled:l,onChange:()=>u(b)}),w&&y&&n.jsx("div",{className:"ml-6 mt-2",children:n.jsx(Le,{schema:y,value:t,onChange:r,path:s,level:a})})]},b)})});const v=f.map((x,b)=>{const y=Q(x,i);return{value:String(b),label:y.title??`Option ${b+1}`}});return n.jsxs("div",{className:"flex flex-col gap-3",children:[n.jsx("div",{className:"flex-1 max-w-[280px]",children:n.jsx(Te,{options:v,value:String(g),disabled:l,onChange:x=>{const b=typeof x=="string"?x:x[0];u(Number(b))}})}),m&&n.jsx("div",{className:"pl-3 border-l-2 border-secondary",children:n.jsx(Le,{schema:m,value:t,onChange:r,path:s,level:a})})]})},Ko=({schema:e,value:t,onChange:r,path:s,level:a})=>{const{rootSchema:i,readonly:o=!1}=we(),l=e.anyOf??[],c=l.map((m,v)=>({value:String(v),label:Pn(m,i)})),d=Mo(t,l,i),f=l[d],g=Q(f,i).type===V.Null,u=m=>{const v=Q(l[m],i);if(v.type===V.Null){r(null);return}const x=_e(v,i);if(x!==void 0){r(x);return}switch(v.type){case V.Array:r([]);break;case V.String:r("");break;case V.Boolean:r(!1);break;case V.Integer:case V.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(Te,{options:c,value:String(d),disabled:o,onChange:m=>{const v=typeof m=="string"?m:m[0];u(Number(v))}})}),!g&&f&&n.jsx("div",{className:"pl-3 border-l-2 border-secondary",children:n.jsx(Le,{schema:f,value:t,onChange:r,path:s,level:a})})]})},zn=({schema:e,value:t,onChange:r,invalid:s})=>{const a=h.useId(),{texts:i,readonly:o=!1,inputClassName:l,acceptableResourceTypes:c}=we(),d=e.const!==void 0,f=Array.isArray(e.enum)&&e.enum.length>0;if(e["dial:resource"]===!0&&Array.isArray(e.acceptableResourceTypes)&&e.acceptableResourceTypes.length>0&&(e.type===V.String||e.type===void 0)){const g=(e.acceptableResourceTypes??[]).flatMap(u=>{const m=c?.[u];return Array.isArray(m)?m.map(v=>{const x=String(v);return{value:x,label:x}}):[]});return n.jsx(Te,{options:g,value:t!=null?String(t):void 0,invalid:s,disabled:o,onChange:u=>r(typeof u=="string"?u:u[0]),placeholder:i.enumSelectPlaceholder,className:l})}if(d)return n.jsx(C.DialInput,{value:String(e.const??""),disabled:!0,onChange:void 0,className:"opacity-60"});if(f&&e.enumDisplay===ct.Radio){const g=e.enumOrientation===Lt.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(u=>{const m=String(u);return n.jsx(T.DialRadioButton,{name:a,value:m,inputId:`${a}-${m}`,label:m,checked:t!=null?String(t)===m:!1,disabled:o,onChange:v=>r(v)},m)})})}if(f){const g=e.enum.map(u=>({value:String(u),label:String(u)}));return n.jsx(Te,{options:g,value:t!=null?String(t):void 0,invalid:s,disabled:o,onChange:u=>r(typeof u=="string"?u:u[0]),placeholder:i.enumSelectPlaceholder})}switch(e.type){case V.Boolean:return n.jsx(ke.DialSwitch,{switchId:a,isOn:!!t,disabled:o,onChange:g=>r(g)});case V.Integer:return n.jsx(rr,{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 V.Number:return n.jsx(rr,{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(Nn,{value:t!=null?String(t):"",invalid:s,disabled:o,onChange:g=>r(g??void 0),placeholder:i.stringInputPlaceholder,containerClassName:l}):n.jsx(C.DialInput,{value:t!=null?String(t):"",invalid:s,disabled:o,onChange:g=>r(g??void 0),placeholder:i.stringInputPlaceholder,containerClassName:l})}},xr=({value:e,onChange:t,theme:r=ft.EditorThemes.dark,height:s=240})=>{const{readonly:a,texts:i}=we(),[o,l]=h.useState(null),[c,d]=h.useState(()=>JSON.stringify(e,null,2));h.useEffect(()=>{typeof window<"u"&&Promise.resolve().then(()=>require("./JsonEditor-BDe6elKO.cjs")).then(g=>{l(()=>g.DialJsonEditor)})},[]);let f=!1;try{JSON.parse(c)}catch{f=!0}const p=g=>{const u=g??"";d(u);try{t(JSON.parse(u))}catch{}};return n.jsxs("div",{children:[n.jsx("div",{className:"border border-primary rounded",style:{height:`${s}px`},children:o&&n.jsx(o,{value:c,currentTheme:r,onChange:p,options:{readOnly:a}})}),n.jsx(C.DialErrorText,{text:f?i.invalidJsonError:void 0})]})},Vr=(e,t)=>({id:Math.random().toString(36).slice(2),key:e,value:t}),$n=e=>!!(e.oneOf||e.anyOf||e.type===V.Array||Ye(e)),Go={[V.String]:"entryTypeString",[V.Number]:"entryTypeNumber",[V.Boolean]:"entryTypeBoolean",[V.Null]:"entryTypeNull",[V.Object]:"entryTypeObject",[V.Array]:"entryTypeArray"},Uo=({pairId:e,pairKey:t,pairValue:r,valueSchema:s,isUnschematizedValue:a,jsonEditorTheme:i,onKeyChange:o,onValueChange:l,onRemove:c,keyInputPlaceholder:d,removeFieldAriaLabel:f,path:p,level:g,readonly:u=!1,inputClassName:m})=>{const{rootSchema:v,texts:x,defaultExpanded:b=!0,touchedPaths:y=new Set,markTouched:N=()=>{},skipUntouched:w=!1}=we(),[D,S]=h.useState(t),_=$n(s),[O,A]=h.useState(()=>Bo(r)),k=a&&(O===V.Object||O===V.Array),j=a&&O===V.Null,M=_||k,$=[...p,e,"key"].join("."),J=(!w||y.has($))&&t==="",G=h.useCallback(te=>{l($o(te)),A(te)},[l]),B=h.useMemo(()=>Fo.map(te=>({value:te,label:x[Go[te]]})),[x]),H=h.useMemo(()=>[{value:"true",label:x.booleanTrueOption},{value:"false",label:x.booleanFalseOption}],[x]),q=`${e}-key-error`,K=a&&O===V.Boolean,se=n.jsxs("div",{className:"flex gap-2 items-start",children:[n.jsxs("div",{className:M?"flex-1 min-w-0":"w-2/5 min-w-0",children:[n.jsx(C.DialInput,{value:D,disabled:u,invalid:J,"aria-describedby":J?q:void 0,onChange:te=>S(te??""),onBlur:()=>{N($),D!==t&&o(D)},placeholder:d,containerClassName:m}),n.jsx(C.DialErrorText,{id:q,text:J?`${x.keyColumnHeader} is required`:void 0})]}),!_&&!k&&n.jsx("div",{className:"flex-1 min-w-0",children:j?n.jsx(C.DialInput,{value:"null",disabled:!0,onChange:void 0,className:"opacity-60"}):K?n.jsx(Te,{options:H,value:r?"true":"false",disabled:u,onChange:te=>{const le=typeof te=="string"?te:te[0];le&&l(le==="true")}}):n.jsx(zn,{schema:a?{type:O}:s,value:r,onChange:l})}),a&&n.jsx("div",{className:"w-28 shrink-0",children:n.jsx(E.DialTooltip,{tooltip:x.entryTypeChangeWarning,triggerClassName:"block",children:n.jsx(Te,{options:B,value:O,disabled:u,onChange:te=>{const le=typeof te=="string"?te:te[0];le&&G(le)}})})}),!u&&n.jsx(At,{size:E.ElementSize.Small,onClick:c,"aria-label":f,className:"shrink-0 p-1"})]});if(!M)return se;if(k)return n.jsxs("div",{className:"flex flex-col gap-2",children:[se,n.jsx(xr,{value:r,onChange:l,theme:i},O)]});const X=[...p,t],Z=mr(r,s,v),ae=Ae(r,s,v,X.join("."));return n.jsxs("div",{className:"flex flex-col gap-2",children:[se,n.jsx(dt,{title:t,level:g,summary:Z,errorCount:ae.length+(J?1:0),defaultExpanded:b,children:n.jsx(Le,{schema:s,value:r,onChange:l,path:X,level:g+1})})]})},Zo=({schema:e,value:t,onChange:r,path:s,level:a})=>{const{rootSchema:i,texts:o,readonly:l=!1,inputClassName:c,jsonEditorTheme:d}=we(),f=e.additionalProperties===!0||e.additionalProperties==null,p=f?{type:"string"}:typeof e.additionalProperties=="object"?Q(e.additionalProperties,i):{type:"string"},g=$n(p),[u,m]=h.useState(()=>Object.entries(t??{}).map(([D,S])=>Vr(D,S))),v=D=>Object.fromEntries(D.filter(S=>S.key!=="").map(S=>[S.key,S.value])),x=(D,S)=>{const _=u.map((O,A)=>A===D?{...O,key:S}:O);m(_),r(v(_))},b=(D,S)=>{const _=u.map((O,A)=>A===D?{...O,value:S}:O);m(_),r(v(_))},y=()=>g?_e(p,i)??Fn(p):"",N=()=>{m(D=>[...D,Vr("",y())])},w=D=>{const S=u.filter((_,O)=>O!==D);m(S),r(v(S))};return n.jsxs("div",{className:"flex flex-col gap-2",children:[u.length===0&&n.jsx("p",{className:"dial-tiny-text text-secondary italic",children:o.noFieldsYet}),u.length>0&&!g&&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&&n.jsx("span",{className:"w-28 shrink-0 dial-tiny-text text-secondary font-medium",children:o.typeColumnHeader})]}),u.map((D,S)=>n.jsx(Uo,{pairId:D.id,pairKey:D.key,pairValue:D.value,valueSchema:p,isUnschematizedValue:f,jsonEditorTheme:d,onKeyChange:_=>x(S,_),onValueChange:_=>b(S,_),onRemove:()=>w(S),keyInputPlaceholder:o.keyInputPlaceholder,removeFieldAriaLabel:o.removeFieldAriaLabel,path:s,level:a,readonly:l,inputClassName:c},D.id)),!l&&n.jsx("div",{className:"pt-1",children:n.jsx(C.DialGhostButton,{label:o.addField,iconBefore:n.jsx(F.IconPlus,{size:16,stroke:2}),onClick:N})})]})},Le=({schema:e,value:t,onChange:r,path:s,level:a,required:i,suppressInlineError:o=!1})=>{const{rootSchema:l,renderField:c,markTouched:d=()=>{},touchedPaths:f=new Set,skipUntouched:p=!1,jsonEditorTheme:g}=we(),u=Q(e,l),m=b=>{d(s.join(".")),r(b)},v=!p||f.has(s.join("."));let x;if(u.oneOf)x=n.jsx(Vo,{schema:u,value:t,onChange:m,path:s,level:a});else if(u.anyOf&&u.type!==V.Object)x=n.jsx(Ko,{schema:u,value:t,onChange:m,path:s,level:a});else if(Ye(u)){const b=u.additionalProperties!=null&&u.additionalProperties!==!1,y=!u.properties||Object.keys(u.properties).length===0;b&&y?x=n.jsx(Zo,{schema:u,value:t,onChange:m,path:s,level:a}):y&&u.additionalProperties!==!1?x=n.jsx(xr,{value:t,onChange:m,theme:g}):x=n.jsx(vt,{schema:u,value:t,onChange:m,path:s,level:a})}else if(u.type===V.Array)x=n.jsx(Ho,{schema:u,value:t,onChange:m,path:s,level:a});else{const b=v&&i&&kt(t),y=!o&&b?hr(u.title??"Field"):void 0;x=n.jsxs(n.Fragment,{children:[n.jsx(zn,{schema:u,value:t,onChange:m,invalid:b}),n.jsx(C.DialErrorText,{text:y})]})}return c?c(s,u,x):x},Wo=({schema:e,defaultValue:t,texts:r,className:s,readonly:a=!1,defaultExpanded:i=!0,inputClassName:o,variant:l=tt.Sections,onChange:c,onPropertyChange:d,onDefaultValues:f,renderField:p,skipUntouched:g=!1,jsonEditorTheme:u,acceptableResourceTypes:m})=>{const v=h.useMemo(()=>({...Ro,...r}),[r]),x=h.useMemo(()=>t||(_e(e,e)??{}),[]),[b,y]=h.useState(x),[N,w]=h.useState(new Set),D=h.useCallback(j=>{w(M=>M.has(j)?M:new Set([...M,j]))},[]);h.useEffect(()=>{f?.(x)},[]);const S=(j,M)=>{const $={...b,[j]:M};y($),c?.($),d?.(j,M)},_=new Set(Object.keys(e.properties??{})),O=Object.keys(b).filter(j=>!_.has(j)),A=Mn(Object.entries(e.properties??{}).filter(([,j])=>!Q(j,e).isHidden)),k=e.required??[];return n.jsx(Rn.Provider,{value:{rootSchema:e,texts:v,readonly:a,defaultExpanded:i,inputClassName:o,jsonEditorTheme:u,acceptableResourceTypes:m,renderField:p,touchedPaths:N,markTouched:D,skipUntouched:g},children:n.jsxs("div",{className:I.mergeClasses("flex flex-col gap-4",s),children:[A.map(([j,M])=>{const $=Q(M,e),U=$.title??M.title??St(j),J=k.includes(j),G=b[j];if(l===tt.Flat)return n.jsx(Bn,{schema:M,value:G,onChange:K=>S(j,K),path:[j],level:0,required:J,label:U},j);if(l===tt.FlatSections)return n.jsxs("div",{className:"flex flex-col gap-3",children:[n.jsx("h2",{className:"dial-small-semi-text text-primary",children:U}),n.jsx(Le,{schema:M,value:G,onChange:K=>S(j,K),path:[j],level:0,required:J})]},j);const B=Ae(G,$,e,j),H=j+".",q=!g||N.has(j)||[...N].some(K=>K.startsWith(H));return n.jsx(dt,{title:U,description:$.description,level:0,defaultExpanded:i,errorCount:q?J&&kt(G)?Math.max(B.length,1):B.length:0,children:n.jsx(Le,{schema:M,value:G,onChange:K=>S(j,K),path:[j],level:1,required:J})},j)}),O.map(j=>{const M=St(j),$=n.jsx(xr,{value:b[j],onChange:U=>S(j,U),theme:u});return l===tt.Sections?n.jsx(dt,{title:M,level:0,defaultExpanded:i,children:$},j):n.jsxs("div",{className:"flex flex-col gap-3",children:[n.jsx("h2",{className:"dial-small-semi-text text-primary",children:M}),$]},j)})]})})},qo=e=>({info:n.jsx(F.IconInfoCircleFilled,{size:e.size}),error:n.jsx(F.IconAlertCircleFilled,{size:e.size}),warning:n.jsx(F.IconAlertTriangleFilled,{size:e.size}),success:n.jsx(F.IconCircleCheckFilled,{size:e.size}),loading:n.jsx(C.Spinner,{size:e.size}),general:n.jsx(F.IconCheck,{size:e.size,stroke:e.stroke})}),Yo={[C.NotificationVariant.Info]:"bg-info text-info",[C.NotificationVariant.Success]:"bg-success text-success",[C.NotificationVariant.Warning]:"bg-warning text-warning",[C.NotificationVariant.Error]:"bg-error text-error",[C.NotificationVariant.Loading]:"bg-layer-raised text-info",[C.NotificationVariant.General]:"bg-layer-sunken text-primary"},Xo={[C.NotificationVariant.Info]:"status",[C.NotificationVariant.Success]:"status",[C.NotificationVariant.Warning]:"alert",[C.NotificationVariant.Error]:"alert",[C.NotificationVariant.Loading]:"status",[C.NotificationVariant.General]:"status"},Qo="items-center justify-between rounded-xl relative gap-3 p-3 border flex border-transparent",br=({variant:e=C.NotificationVariant.Info,type:t=C.NotificationType.Toast,title:r,message:s,action:a,className:i,iconSize:o=24,iconStroke:l=2,closable:c=!1,onClose:d,children:f,textClassName:p,...g})=>{const u=h.useMemo(()=>qo({size:o,stroke:l})[e],[e,o,l]),m=p??(t===C.NotificationType.SectionMessage?"flex-row flex-wrap items-baseline gap-x-1":"flex-col");return n.jsxs("div",{role:Xo[e],...g,className:I.mergeClasses(Qo,Yo[e],t===C.NotificationType.Toast&&"min-w-[200px] max-w-[600px] shadow-lg",t===C.NotificationType.SectionMessage&&e===C.NotificationVariant.Loading&&"border-secondary",i,T.DIAL_KIT_CLASS.notification),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(T.DialIcon,{icon:u})}),r?n.jsxs("div",{className:I.mergeClasses("flex min-w-0 text-primary break-words",m),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})]}),a!=null&&n.jsx("div",{className:"flex shrink-0 items-center",children:a}),f,c&&n.jsx(R.CloseButton,{className:"shrink-0 self-start",ariaLabel:"Close notification",onClose:v=>d?.(v)})]})},Kr={2:"line-clamp-2",3:"line-clamp-3",4:"line-clamp-4",5:"line-clamp-5",6:"line-clamp-6"},Jo=e=>e===1?"!truncate !whitespace-nowrap":`${Kr[e]??Kr[2]} !whitespace-normal`,el=({text:e,query:t,markClassName:r,className:s,maxLines:a=2})=>{const i=I.mergeClasses(Jo(a),s,T.DIAL_KIT_CLASS.highlight);if(!t.trim())return n.jsx(R.EllipsisTooltip,{className:i,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(R.EllipsisTooltip,{className:i,text:l})},tl=({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,T.DIAL_KIT_CLASS.cardShell),children:t}),nt=(e,t)=>({type:s,...a})=>n.jsx(br,{...a,variant:e,type:s||t}),st=(e,t)=>({variant:s,...a})=>n.jsx(br,{...a,variant:s||t,type:e}),rl=nt(C.NotificationVariant.Error,C.NotificationType.Toast),nl=nt(C.NotificationVariant.Info,C.NotificationType.Toast),sl=nt(C.NotificationVariant.Success,C.NotificationType.Toast),al=nt(C.NotificationVariant.Warning,C.NotificationType.Toast),il=nt(C.NotificationVariant.Loading,C.NotificationType.Toast),ol=nt(C.NotificationVariant.General,C.NotificationType.Toast),ll=st(C.NotificationType.SectionMessage,C.NotificationVariant.Error),cl=st(C.NotificationType.SectionMessage,C.NotificationVariant.Info),dl=st(C.NotificationType.SectionMessage,C.NotificationVariant.Success),ul=st(C.NotificationType.SectionMessage,C.NotificationVariant.Warning),fl=st(C.NotificationType.SectionMessage,C.NotificationVariant.Loading),pl=st(C.NotificationType.SectionMessage,C.NotificationVariant.General);var be=(e=>(e.Date="date",e.DateTime="datetime",e.Time="time",e.Weekday="weekday",e))(be||{});const gl="en-GB",hl={[be.Date]:"Select date",[be.DateTime]:"Select date and time",[be.Time]:"--:--",[be.Weekday]:"Select day"},Hn="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",Vn="!cursor-not-allowed !border-transparent bg-layer-sunken text-control-disable-primary hover:!border-transparent",Kn="!border-error",ml="z-floating flex w-[248px] flex-col gap-4 rounded-lg bg-layer-raised px-2 py-4 shadow-md",xl="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",bl="bg-control-accent text-control-permanent",Cl="text-accent dial-small-semi-text",vl="text-control-disable-primary",Gn="text-secondary",yl=n.jsx(F.IconCalendar,{size:z.DIAL_ICON_SIZE.MD,stroke:ne.DIAL_KIT_ICON_STROKE,"aria-hidden":"true",className:Gn}),Gr={prev:n.jsx(F.IconChevronLeft,{size:z.DIAL_ICON_SIZE.SM,stroke:ne.DIAL_KIT_ICON_STROKE,"aria-hidden":"true"}),next:n.jsx(F.IconChevronRight,{size:z.DIAL_ICON_SIZE.SM,stroke:ne.DIAL_KIT_ICON_STROKE,"aria-hidden":"true"})},Dl=(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})},Ur=(e,t)=>!!e&&!!t&&e.getFullYear()===t.getFullYear()&&e.getMonth()===t.getMonth()&&e.getDate()===t.getDate(),Zr=(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},Il=(e,t)=>e.toLocaleDateString(t,{month:"long",year:"numeric"}),Wr=(e,t)=>e.toLocaleDateString(t,{day:"numeric",month:"short",year:"numeric"}),Sl=(e,t)=>e.toLocaleDateString(t,{weekday:"long",day:"numeric",month:"long",year:"numeric"}),ht=e=>`${String(e.getHours()).padStart(2,"0")}:${String(e.getMinutes()).padStart(2,"0")}`,qr=(e,t)=>{const[r,s]=t.split(":").map(Number),a=new Date(e);return a.setHours(r||0,s||0,0,0),a},Nl=e=>/^([01]\d|2[0-3]):[0-5]\d$/.test(e),jl=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}`},Un=5,Zn=e=>e.charAt(0).toUpperCase()+e.slice(1),Tl=e=>Array.from({length:7},(t,r)=>{const s=new Date(Date.UTC(1970,0,Un+r));return Zn(s.toLocaleDateString(e,{weekday:"short",timeZone:"UTC"}))}),wl=e=>Array.from({length:7},(t,r)=>{const s=new Date(Date.UTC(1970,0,Un+r));return{value:String(r+1),label:Zn(s.toLocaleDateString(e,{weekday:"long",timeZone:"UTC"}))}}),Yr=({id:e,disabled:t,invalid:r,trigger:s,panelClassName:a,fieldClassName:i,panel:o,labelledBy:l,panelLabel:c})=>{const d=T.useThemeScope(),[f,p]=h.useState(!1),{refs:g,floatingStyles:u,context:m}=de.useFloating({open:f,onOpenChange:w=>p(t?!1:w),placement:"bottom-start",whileElementsMounted:de.autoUpdate,middleware:[de.offset(8),de.flip({padding:8}),de.shift({padding:8})]}),v=de.useClick(m,{enabled:!t}),x=de.useDismiss(m),b=de.useRole(m,{role:"dialog"}),{getReferenceProps:y,getFloatingProps:N}=de.useInteractions([v,x,b]);return n.jsxs(n.Fragment,{children:[n.jsx("div",{id:e,ref:g.setReference,role:"button","aria-haspopup":"dialog","aria-expanded":f,"aria-disabled":t,"aria-labelledby":l,tabIndex:t?-1:0,className:I.mergeClasses(Hn,"focus-visible:outline focus-visible:outline-focus",r&&Kn,t&&Vn,i),...y(),children:s}),f&&n.jsx(de.FloatingPortal,{children:n.jsx(de.FloatingFocusManager,{context:m,modal:!1,initialFocus:-1,returnFocus:!0,children:n.jsx("div",{ref:g.setFloating,style:u,"aria-label":c,className:I.mergeClasses(ml,d,a),...N(),children:o(()=>p(!1))})})})]})},Xr=({id:e,value:t,onChange:r,onBlur:s,disabled:a,invalid:i,className:o,ariaLabel:l,placeholder:c="--:--",timezoneLabel:d})=>{const[f,p]=h.useState(t);h.useEffect(()=>{p(t)},[t]);const g=n.jsx("input",{id:e,type:"text",inputMode:"numeric",autoComplete:"off","aria-label":l,placeholder:c,disabled:a,value:f,onChange:u=>{const m=jl(u.target.value);p(m),Nl(m)&&r(m)},onBlur:s,className:I.mergeClasses(Hn,i&&Kn,a&&Vn,o)});return d?n.jsxs("div",{className:"relative w-full",children:[g,n.jsx("span",{className:"dial-small-paragraph-text pointer-events-none absolute end-4 top-1/2 -translate-y-1/2 truncate text-secondary",children:d})]}):g},El=({mode:e=be.Date,value:t,onChange:r,onBlur:s,labelProps:a,placeholder:i,disabled:o=!1,invalid:l=!1,id:c,className:d,minDate:f,maxDate:p,locale:g=gl,fieldClassName:u,showTimezone:m=!1})=>{const v=i??hl[e],x=t instanceof Date?t:null,b=h.useId(),y=c??b,N=a?.id??`${y}-label`,w=!!a?.label,D=typeof a?.label=="string"?a.label:void 0,S=w?`${N} ${y}`:void 0,_=a?n.jsx(R.Label,{...a,id:N,htmlFor:y}):null,[O,A]=h.useState(()=>x??new Date),k=h.useMemo(()=>new Date,[]),j=h.useMemo(()=>m?kn({locale:g}):null,[m,g]),M=h.useMemo(()=>Tl(g),[g]),$=h.useMemo(()=>wl(g),[g]),U=h.useMemo(()=>Dl(O.getFullYear(),O.getMonth()),[O]),J=q=>{A(K=>new Date(K.getFullYear(),K.getMonth()+q,1))},G=(q,K)=>{if(Zr(q,f,p))return;const se=e===be.DateTime&&x?qr(q,ht(x)):q;r?.(se),e===be.Date&&K()},B=q=>{r?.(qr(x??new Date,q))},H=()=>x?e===be.DateTime?`${Wr(x,g)}, ${ht(x)}`:Wr(x,g):v;if(e===be.Time){const q=typeof t=="string"?t:x?ht(x):"";return n.jsxs("div",{className:I.mergeClasses("flex flex-col gap-y-3",d,T.DIAL_KIT_CLASS.calendar),children:[_,n.jsx(Xr,{id:y,value:q,onChange:K=>r?.(K),onBlur:s,disabled:o,invalid:l,placeholder:v,className:u,timezoneLabel:j})]})}if(e===be.Weekday){const q=typeof t=="string"?t:void 0,K=$.find(se=>se.value===q);return n.jsxs("div",{className:I.mergeClasses("flex flex-col gap-y-3",d,T.DIAL_KIT_CLASS.calendar),children:[_,n.jsx(Yr,{id:y,disabled:o,invalid:l,labelledBy:S,panelLabel:D??v,fieldClassName:u,trigger:n.jsxs(n.Fragment,{children:[n.jsx("span",{className:I.mergeClasses("truncate",!K&&"text-secondary"),children:K?.label??v}),n.jsx(F.IconChevronDown,{size:z.DIAL_ICON_SIZE.MD,stroke:ne.DIAL_KIT_ICON_STROKE,"aria-hidden":"true",className:Gn})]}),panel:se=>n.jsx("div",{role:"listbox","aria-label":D??v,className:"flex flex-col gap-0.5",children:$.map(X=>n.jsx("button",{type:"button",role:"option","aria-selected":X.value===q,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",X.value===q&&"bg-control-accent-alpha-hover"),onClick:()=>{r?.(X.value),se()},children:X.label},X.value))})})]})}return n.jsxs("div",{className:I.mergeClasses("flex flex-col gap-y-3",d,T.DIAL_KIT_CLASS.calendar),children:[_,n.jsx(Yr,{id:y,disabled:o,invalid:l,labelledBy:S,panelLabel:D??v,fieldClassName:u,trigger:n.jsxs(n.Fragment,{children:[n.jsx("span",{className:I.mergeClasses("truncate",!x&&"text-secondary"),children:H()}),yl]}),panel:q=>n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsx(R.StaticIconButton,{"aria-label":"Previous month",icon:Gr.prev,size:E.ElementSize.Small,onClick:()=>J(-1)}),n.jsx("div",{className:"dial-small-semi-text text-primary","aria-live":"polite",children:Il(O,g)}),n.jsx(R.StaticIconButton,{"aria-label":"Next month",icon:Gr.next,size:E.ElementSize.Small,onClick:()=>J(1)})]}),n.jsxs("div",{className:"grid grid-cols-7 gap-y-1 text-center",children:[M.map(K=>n.jsx("div",{"aria-hidden":"true",className:"dial-tiny-text py-1 text-secondary",children:K},K)),U.map(K=>{const se=K.getMonth()!==O.getMonth(),X=Ur(K,x),Z=Ur(K,k),ae=Zr(K,f,p);return n.jsx("button",{type:"button",disabled:ae,"aria-label":Sl(K,g),"aria-pressed":X,"aria-current":Z?"date":void 0,className:I.mergeClasses(xl,se&&vl,Z&&!X&&Cl,X&&bl,ae&&"cursor-not-allowed opacity-40 hover:bg-transparent"),onClick:()=>G(K,q),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(Xr,{ariaLabel:"Time",value:x?ht(x):"",onChange:B,onBlur:s,className:"w-[120px] px-3 py-1.5"})]})]})})]})},Ol=({segments:e,labelClassName:t="dial-small-text",leafClassName:r="dial-small-semi-text",className:s,ariaLabel:a="Folder path"})=>{const i=n.jsx(T.DialIcon,{icon:n.jsx(F.IconFolder,{size:z.DIAL_ICON_SIZE.SM,stroke:ne.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(C.DialBreadcrumb,{className:I.mergeClasses(s,T.DIAL_KIT_CLASS.folderPath),ariaLabel:a,separator:n.jsx(T.DialIcon,{icon:n.jsx(F.IconChevronRight,{size:14,stroke:ne.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")})};var Ze=(e=>(e.Small="small",e.Heading="heading",e))(Ze||{});const Al="w-full overflow-hidden",_l="flex min-w-0 flex-nowrap items-center gap-2 whitespace-nowrap",Qr="flex min-w-0 items-center gap-2",Jr={[Ze.Small]:"dial-small-text",[Ze.Heading]:"dial-h2-text"},Ll={[Ze.Small]:"dial-small-semi-text",[Ze.Heading]:"dial-h2-text"},kl={first:"shrink-0",middle:"min-w-0 max-w-[30%] shrink",last:"min-w-0 max-w-[51%] shrink"},Rl="flex min-w-0 flex-1 items-center gap-1 rounded-sm transition-colors",Ml="text-secondary hover:text-accent focus-visible:outline focus-visible:outline-offset-2 focus-visible:outline-focus",Pl="cursor-default text-primary",Fl="cursor-default text-secondary",en="inline-flex flex-none items-center leading-none text-secondary",Bl="dial-kit-minimum-target flex shrink-0 items-center rounded-sm text-secondary transition-colors hover:text-accent focus-visible:outline focus-visible:outline-offset-2 focus-visible:outline-focus",zl=3,$l=4,Hl=n.jsx(F.IconChevronRight,{size:z.DIAL_ICON_SIZE.SM,stroke:ne.DIAL_KIT_ICON_STROKE,"aria-hidden":"true",className:"rtl:scale-x-[-1]"}),Vl=({items:e,maxVisibleItems:t=$l,size:r=Ze.Small,separator:s=Hl,ariaLabel:a="Breadcrumb",overflowAriaLabel:i="Show hidden path segments",className:o,itemClassName:l})=>{const c=Math.max(t,zl),d=h.useMemo(()=>e.length>c?e.slice(1,-(c-2)):[],[e,c]),f=h.useMemo(()=>d.map((m,v)=>({key:String(v),label:m.label,icon:m.icon})),[d]),p=h.useCallback(({key:m,domEvent:v})=>{const x=d[Number(m)];x&&(x.onClick?.(v),!x.onClick&&x.href&&!v.defaultPrevented&&(window.location.href=x.href))},[d]);if(e.length===0)return null;const g=e.slice(d.length+1),u=(m,{index:v,isFirst:x,isCurrent:b})=>{const y=!b&&(!!m.href||!!m.onClick),N=I.mergeClasses(Rl,y?Ml:b?I.mergeClasses(Pl,Ll[r]):Fl,l,T.DIAL_KIT_CLASS.breadcrumbsItem),w=n.jsxs(n.Fragment,{children:[m.icon,n.jsx(R.EllipsisTooltip,{text:m.label})]});return n.jsxs("li",{className:I.mergeClasses(Qr,Jr[r],kl[b?"last":x?"first":"middle"]),children:[y?m.href?n.jsx("a",{href:m.href,onClick:m.onClick,className:N,children:w}):n.jsx("button",{type:"button",onClick:m.onClick,className:N,children:w}):n.jsx("span",{className:N,"aria-current":b?"page":void 0,children:w}),!b&&n.jsx("span",{className:en,"aria-hidden":"true",children:s})]},`segment-${v}`)};return n.jsx("nav",{"aria-label":a,className:I.mergeClasses(Al,o,T.DIAL_KIT_CLASS.breadcrumbs),children:n.jsxs("ol",{className:_l,children:[u(e[0],{index:0,isFirst:!0,isCurrent:e.length===1}),d.length>0&&n.jsxs("li",{className:I.mergeClasses(Qr,Jr[r],"shrink-0"),children:[n.jsx(R.Dropdown,{items:f,onItemClick:p,placement:"bottom-start",matchReferenceWidth:!1,children:n.jsx("button",{type:"button","aria-label":i,className:Bl,children:n.jsx(F.IconDots,{size:z.DIAL_ICON_SIZE.SM,stroke:ne.DIAL_KIT_ICON_STROKE,"aria-hidden":"true"})})}),n.jsx("span",{className:en,"aria-hidden":"true",children:s})]}),g.map((m,v)=>u(m,{index:e.length-g.length+v,isFirst:!1,isCurrent:v===g.length-1}))]})})},Xe=({label:e,variant:t,appearance:r=E.ButtonAppearance.Solid,size:s=E.ElementSize.Standard,className:a,textClassName:i,iconAfter:o,iconBefore:l,type:c="button",tooltipProps:d,href:f,target:p,rel:g,disabled:u,...m})=>{const v=I.mergeClasses("dial-kit-base-button",t&&R.getButtonClassNames(t,r),s===E.ElementSize.Small?"dial-tiny-semi-text":"dial-small-paragraph-semi-text",s===E.ElementSize.Small?"h-[24px] gap-1":"h-[40px] gap-2",s===E.ElementSize.Small&&"dial-kit-base-button-small",r!==E.ButtonAppearance.Link&&(s===E.ElementSize.Small?"px-2":"px-4"),s!==E.ElementSize.Small&&r!==E.ButtonAppearance.Link&&"dial-kit-enhanced-target",a),x=e?void 0:d?.tooltip,b=E.resolveAccessibleName(typeof e=="string"?e:void 0,m["aria-label"],x),y=n.jsxs(n.Fragment,{children:[n.jsx(T.DialIcon,{icon:l}),e&&n.jsx("span",{className:i,children:e}),n.jsx(T.DialIcon,{icon:o})]}),N=m,w=f!==void 0?n.jsx("a",{...N,href:u?void 0:f,target:p,rel:g??(p==="_blank"?"noopener noreferrer":void 0),"aria-disabled":u||void 0,tabIndex:u?-1:N.tabIndex,onClick:u?void 0:N.onClick,className:v,"aria-label":b,children:y}):n.jsx("button",{...m,...R.getDisabledButtonProps(u,d,m.onClick),type:c,className:v,"aria-label":b,children:y});return d?n.jsx(R.Tooltip,{asChild:!0,...d,children:w}):w},Cr=(e,t)=>({appearance:s,...a})=>n.jsx(Xe,{...a,variant:e,appearance:s||t}),vr=(e,t)=>({variant:s,...a})=>n.jsx(Xe,{...a,variant:s||t,appearance:e}),Wn=Cr(E.ButtonVariant.Primary,E.ButtonAppearance.Solid),yr=Cr(E.ButtonVariant.Neutral,E.ButtonAppearance.Solid),Kl=Cr(E.ButtonVariant.Danger,E.ButtonAppearance.Solid),et={x1:"-5.06",y1:"2.26",x2:"30.62",y2:"22.63",from:"var(--stroke-gradient-1, #5976E9)",to:"var(--stroke-gradient-2, #885DF2)"},Gl=({appearance:e=E.ButtonAppearance.Outlined,iconBefore:t,iconAfter:r,style:s,...a})=>{const i=`dial-kit-starter-gradient-${h.useId().replace(/[^\w-]/g,"")}`,o=n.jsx("svg",{className:"pointer-events-none absolute size-0 overflow-hidden","aria-hidden":"true",focusable:"false",children:n.jsx("defs",{children:n.jsxs("linearGradient",{id:i,x1:et.x1,y1:et.y1,x2:et.x2,y2:et.y2,gradientUnits:"userSpaceOnUse",children:[n.jsx("stop",{stopColor:et.from}),n.jsx("stop",{offset:"1",stopColor:et.to})]})})}),l=c=>n.jsxs(n.Fragment,{children:[o,c]});return n.jsx(Xe,{...a,variant:E.ButtonVariant.Starter,appearance:e,iconBefore:t?l(t):void 0,iconAfter:r&&!t?l(r):r,style:{"--dial-kit-starter-icon-stroke":`url(#${i})`,...s}})},Ul=vr(E.ButtonAppearance.Link,E.ButtonVariant.Primary),Zl=vr(E.ButtonAppearance.Ghost,E.ButtonVariant.Primary),Wl=vr(E.ButtonAppearance.Outlined,E.ButtonVariant.Neutral),ql=({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":E.resolveAccessibleName(a["aria-label"],r?.tooltip),children:t||n.jsx(F.IconArrowNarrowDown,{size:24,stroke:1.5,"aria-hidden":"true"})});return r?n.jsx(E.DialTooltip,{...r,children:o}):o},Yl=e=>n.jsx(F.IconChevronDown,{size:z.DIAL_ICON_SIZE.SM,stroke:ne.DIAL_KIT_ICON_STROKE,"aria-hidden":!0,className:I.mergeClasses("transition-transform",e&&"rotate-180")}),Xl=({variant:e,appearance:t,items:r,dropdownProps:s,...a})=>{const[i,o]=h.useState(!1),l=h.useMemo(()=>Yl(i),[i]);return n.jsx("div",{className:T.DIAL_KIT_CLASS.buttonDropdown,children:n.jsx(R.Dropdown,{...s,items:r,onOpenChange:c=>o(c),children:n.jsx(Xe,{...a,iconAfter:l,variant:e||E.ButtonVariant.Primary,appearance:t||E.ButtonAppearance.Solid,"aria-haspopup":"menu","aria-expanded":i})})})},qn=({label:e,size:t,isOpen:r=!1,labelClassName:s,className:a,"aria-label":i,...o})=>{const l=t===E.ElementSize.Small?"h-[32px]":"h-[40px] dial-kit-enhanced-target";return n.jsxs("button",{type:"button",...o,"aria-haspopup":"menu","aria-expanded":r,"aria-label":i?`${i} ${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",l,a,T.DIAL_KIT_CLASS.inlineSelect),children:[n.jsx("span",{className:s,children:e}),n.jsx(F.IconChevronDown,{size:z.DIAL_ICON_SIZE.MD,stroke:ne.DIAL_KIT_ICON_STROKE,"aria-hidden":!0,className:I.mergeClasses("transition-transform",r&&"rotate-180")})]})},Ql=({items:e,selectedKey:t,defaultSelectedKey:r,onSelect:s,size:a,disabled:i,placement:o="bottom-end",matchReferenceWidth:l=!1,listClassName:c,listStyle:d,ariaLabel:f,triggerClassName:p,triggerLabelClassName:g,open:u,onOpenChange:m})=>{const[v,x]=h.useState(!1),b=u!==void 0,y=b?u:v,N=h.useCallback(k=>{b||x(k),m?.(k)},[b,m]),[w,D]=h.useState(r??e[0]?.key),S=t!==void 0,_=S?t:w,O=h.useMemo(()=>{const k=e.find(j=>j.key===_);return k?.label?String(k.label):""},[e,_]),A=h.useCallback(({key:k})=>{const j=e.find(M=>M.key===k);j&&(S||D(k),s?.(j))},[e,S,s]);return n.jsx(R.Dropdown,{items:e,placement:o,matchReferenceWidth:l,listClassName:c,listStyle:d,disabled:i,open:b?u:void 0,onOpenChange:N,onItemClick:A,children:n.jsx(qn,{label:O,size:a,isOpen:y,disabled:i,"aria-label":f,className:p,labelClassName:g})})},Pe=({text:e,className:t,variant:r=C.CaptionType.Description,...s})=>e?n.jsx("span",{...s,role:"alert",className:I.mergeClasses("dial-tiny-text",r===C.CaptionType.Error?"text-error":"text-secondary",t,T.DIAL_KIT_CLASS.captionText,r===C.CaptionType.Error&&T.DIAL_KIT_CLASS.errorText),children:e}):null,Fe=({...e})=>n.jsx(Pe,{...e,variant:C.CaptionType.Error}),Jl="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",ec={[E.ElementSize.Small]:"size-[24px]",[E.ElementSize.Standard]:"size-[40px]",[E.ElementSize.Large]:"size-[48px]"},tc=({icon:e,onClick:t,disabled:r,size:s=E.ElementSize.Standard,className:a})=>n.jsx("div",{className:I.mergeClasses("border-l border-tertiary",ec[s]),children:n.jsx(R.IconButton,{className:I.mergeClasses(Jl,s===E.ElementSize.Small&&"p-1",a),icon:e,onClick:t,disabled:r,size:s})}),rc=["ArrowLeft","ArrowRight","ArrowUp","ArrowDown","Backspace","Delete","Tab","Enter","Escape","Home","End","Insert"],Yn=(e,t,r,s)=>{if((t==="number"||r!==void 0||s!==void 0)&&!rc.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}}}}},Xn={[E.ElementSize.Small]:{field:"dial-kit-input-small gap-x-1",paddingStart:"pl-2",paddingEnd:"pr-2",stackGap:"gap-1",postfixText:"dial-tiny-text"},[E.ElementSize.Standard]:{field:"gap-x-2 py-2",paddingStart:"pl-3",paddingEnd:"pr-3",stackGap:"gap-2",postfixText:"dial-small-text"},[E.ElementSize.Large]:{field:"gap-x-2 py-3",paddingStart:"pl-4",paddingEnd:"pr-4",stackGap:"gap-2",postfixText:"dial-body-text"}},We=({labelProps:e,error:t,caption:r,id:s,containerClassName:a,size:i=E.ElementSize.Standard,...o})=>n.jsxs("div",{className:I.mergeClasses("flex flex-col",Xn[i].stackGap,a),children:[e&&n.jsx(R.Label,{...e,htmlFor:s}),n.jsxs("div",{className:"flex flex-col gap-1",children:[n.jsx(Qn,{id:s,size:i,...o}),n.jsx(Fe,{text:t}),!t&&n.jsx(Pe,{text:r})]})]}),Qn=({invalid:e,disabled:t,prefix:r,className:s,postfix:a,children:i,iconBefore:o,iconAfter:l,wrapperClassName:c,type:d,inputRef:f,value:p,tooltipText:g,min:u,onChange:m,max:v,inputButtonProps:x,wrapperRef:b,size:y=E.ElementSize.Standard,...N})=>{const w=Xn[y],D=h.useRef(null),S=de.useMergeRefs([f,D]),_=d==="number"||u!==void 0||v!==void 0;h.useEffect(()=>{const j=D.current;if(!j||!_||t)return;const M=$=>{$.preventDefault()};return j.addEventListener("wheel",M,{passive:!1}),()=>{j.removeEventListener("wheel",M)}},[t,_,d]);const O=j=>{Yn(j,d,u,v)},A=j=>{const M=j.currentTarget.value;if(_&&M!==""){const $=parseFloat(M);if(isNaN($)&&M!=="-"&&M!=="."||!isNaN($)&&(u!==void 0&&$<+u||v!==void 0&&$>+v))return}m?.(M||void 0)},k=()=>n.jsxs("div",{ref:b,className:I.mergeClasses("dial-kit-input flex flex-row items-center justify-between",w.field,e&&"dial-kit-input-error",t&&"dial-kit-input-disable",!r&&w.paddingStart,!x&&w.paddingEnd,c),"aria-label":"input-container",children:[r&&n.jsx("div",{className:"border-r border-secondary",children:n.jsx(Qn,{wrapperClassName:"!rounded-r-none",className:"truncate",value:r,disabled:!0,size:y,id:`${r}_textBefore`})}),n.jsx(T.DialIcon,{icon:o}),i,n.jsx("input",{ref:S,type:d,autoComplete:d==="password"?"new-password":"off",value:p??"",className:I.mergeClasses("border-0 bg-transparent w-full truncate",t&&"cursor-not-allowed",s),onChange:A,onKeyDown:O,min:u,disabled:t,max:v,...N}),a&&n.jsxs("p",{className:I.mergeClasses("text-secondary",w.postfixText),children:[" ",a]}),n.jsx(T.DialIcon,{icon:l}),x&&n.jsx(tc,{size:y,...x,disabled:t})]});return t&&d!=="password"?n.jsx(R.Tooltip,{tooltip:g||p,children:k()}):k()};var qe=(e=>(e.Outlined="outlined",e.Selectable="selectable",e))(qe||{});const nc="inline-flex h-[32px] max-w-full items-center gap-1 rounded-full px-3",sc={[qe.Outlined]:{default:"bg-layer-raised text-primary",selected:"bg-control-accent-alpha text-primary"},[qe.Selectable]:{default:"text-secondary",selected:"bg-control-accent-alpha text-primary"}},ac="cursor-pointer outline-offset-0 focus-visible:outline focus-visible:outline-focus",ic="hover:bg-control-accent-alpha-hover active:bg-control-accent-alpha-active",Ge=({label:e,icon:t,appearance:r=qe.Outlined,selected:s=!1,disabled:a=!1,closable:i=!1,removeLabel:o,className:l,title:c,onClick:d,onRemove:f,onKeyDown:p,...g})=>{const u=r===qe.Selectable,m=!!d&&!a,v=i&&!!f&&!a,x=u&&s,b=y=>{p?.(y),!(!m||y.defaultPrevented)&&(y.key==="Enter"||y.key===" ")&&(y.preventDefault(),y.currentTarget.click())};return n.jsxs("span",{...g,role:m?"button":g.role,tabIndex:m?0:g.tabIndex,"aria-disabled":a||void 0,"aria-pressed":u&&m?s:void 0,onClick:a?void 0:d,onKeyDown:b,className:I.mergeClasses(nc,x?"dial-tiny-semi-text":"dial-tiny-text",sc[r][s?"selected":"default"],a&&"cursor-not-allowed",m&&[ac,ic],l,T.DIAL_KIT_CLASS.tag),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}),v&&n.jsx(R.GhostIconButton,{className:"size-[16px] shrink-0 dial-kit-minimum-target",size:E.ElementSize.Small,"aria-label":o??`Remove ${e}`,icon:n.jsx(F.IconX,{size:z.DIAL_ICON_SIZE.SM,stroke:ne.DIAL_KIT_ICON_STROKE,"aria-hidden":"true"}),onClick:y=>{y.stopPropagation(),f?.(y)}})]})},Jn=({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(Ge,{label:a?.label??s,closable:!!r,onRemove:i=>r?.(i,s),icon:a?.icon,className:"max-w-full border border-tertiary"},s)})}),oc=I.mergeClasses("w-full flex flex-col"),lc=R.overlayItemClassName,cc="!max-w-[var(--reference-width)]",dc=I.mergeClasses("max-h-[344px] overflow-y-auto py-1",R.overlayListClassName),uc=R.overlayGap,fc=R.overlaySubMenuListClassName,pc=n.jsx(F.IconChevronRight,{size:z.DIAL_ICON_SIZE.SM,stroke:ne.DIAL_KIT_ICON_STROKE,"aria-hidden":"true"}),gc="text-secondary transition-transform",hc=8,mc=n.jsx(F.IconSearch,{size:z.DIAL_ICON_SIZE.MD,stroke:ne.DIAL_KIT_ICON_STROKE,"aria-hidden":"true"}),xc=n.jsx(F.IconX,{size:z.DIAL_ICON_SIZE.SM,stroke:ne.DIAL_KIT_ICON_STROKE,"aria-hidden":"true"}),bc=n.jsx(R.SvgNoData,{width:z.DIAL_ICON_SIZE.LG,height:z.DIAL_ICON_SIZE.LG,"aria-hidden":"true"}),Cc=({opt:e,selectedValues:t,mark:r=R.MenuItemMark.Tint,onSelect:s})=>{const{isOpen:a,nodeId:i,refs:o,floatingStyles:l,context:c,getReferenceProps:d,getFloatingProps:f}=T.useSubMenuFloating(uc,"listbox",!!e.disabled),p=e.children?.some(u=>t.includes(u.value)),g=n.jsx(R.MenuItem,{ref:o.setReference,role:"option","aria-haspopup":"listbox","aria-expanded":a,"aria-selected":!!p,"aria-disabled":!!e.disabled,disabled:e.disabled,ellipsisLabel:!0,icon:e.icon,label:e.labelNode??e.label,trailing:pc,...d()});return n.jsxs(de.FloatingNode,{id:i,children:[e.interactiveTooltip?n.jsx(R.InteractiveTooltip,{asChild:!0,placement:e.interactiveTooltip.placement,content:e.interactiveTooltip.content,contentClassName:e.interactiveTooltip.contentClassName,children:g}):g,a&&n.jsx(T.SubMenuPanel,{refs:o,floatingStyles:l,context:c,getFloatingProps:f,role:"listbox",surfaceClassName:fc,children:e.children.map(u=>{const m=n.jsx(R.MenuItem,{role:"option","aria-selected":t.includes(u.value),"aria-disabled":!!u.disabled,disabled:u.disabled,mark:r,selected:t.includes(u.value),ellipsisLabel:!0,icon:u.icon,label:u.labelNode??u.label,rightControl:u.rightControl,onClick:()=>!u.disabled&&s(u.value)});return n.jsx(h.Fragment,{children:u.interactiveTooltip?n.jsx(R.InteractiveTooltip,{asChild:!0,placement:u.interactiveTooltip.placement,content:u.interactiveTooltip.content,contentClassName:u.interactiveTooltip.contentClassName,children:m}):m},u.value)})})]})},vc=({options:e,multiple:t=!1,id:r,value:s,defaultValue:a,size:i=E.ElementSize.Standard,prefix:o,customSelectedValue:l,placeholder:c="Select...",labelProps:d,error:f,caption:p,ariaLabel:g,searchable:u=!1,searchSize:m=E.ElementSize.Standard,searchPlaceholder:v,selectAll:x=!1,invalid:b,selectAllLabel:y="Select all",selectedOptionMark:N=R.MenuItemMark.Tint,emptyStateTitle:w="No options available",emptyStateDescription:D,emptyStateIcon:S,disabled:_=!1,className:O,fieldClassName:A,listClassName:k,closable:j=!1,header:M,footer:$,onClose:U,onChange:J,dismissRef:G,onFooterClick:B,open:H,onOpenChange:q,onSearchQueryChange:K,customMultiSelectTagsRenderer:se})=>{const X=h.useId(),Z=r||X,ae=`list-${Z}`,te=i===E.ElementSize.Small,[le,ue]=h.useState(!1),pe=H!==void 0,ge=pe?!!H:le,fe=h.useCallback(P=>{pe||ue(P),q?.(P)},[pe,q]),[W,ee]=h.useState(""),Se=h.useCallback(P=>{P!==W&&(ee(P||""),K?.(P||""))},[K,W]),Be=s!==void 0,[he,ze]=h.useState(a),Ee=Be?s:he,ie=h.useMemo(()=>t?Array.isArray(Ee)?Ee:[]:typeof Ee=="string"?[Ee]:[],[Ee,t]),Re=h.useMemo(()=>{const P=W.trim().toLowerCase();return P?e.filter(ce=>ce.label.toLowerCase().includes(P)):e},[e,W]);h.useEffect(()=>{ge||Se("")},[ge,Se]);const Ne=h.useCallback(P=>{Be||ze(P),J?.(P)},[Be,J]),$e=h.useCallback(P=>{if(t){const ce=new Set(ie);ce.has(P)?ce.delete(P):ce.add(P),Ne(Array.from(ce));return}Ne(P),fe(!1)},[t,Ne,fe,ie]),at=h.useCallback((P,ce)=>{if(P.stopPropagation(),!t){Ne("");return}const pt=ie.filter(fs=>fs!==ce);Ne(pt)},[t,ie,Ne]),ve=h.useMemo(()=>Re.filter(P=>!P.disabled),[Re]),He=h.useMemo(()=>ve.filter(P=>ie.includes(P.value)).length,[ve,ie]),{allSelectedInFiltered:Me,someSelectedInFiltered:me}=h.useMemo(()=>{const P=ve.length>0&&He===ve.length;return{allSelectedInFiltered:P,someSelectedInFiltered:He>0&&!P}},[ve,He]),Rt=h.useCallback(()=>{if(!(!t||ve.length===0))if(Me){const P=new Set(ve.map(ce=>ce.value));Ne(ie.filter(ce=>!P.has(ce)))}else{const P=new Set(ie);ve.forEach(ce=>P.add(ce.value)),Ne(Array.from(P))}},[Me,t,ve,ie,Ne]),Oe=ie.length>0,Ve=!t&&Oe?ie[0]:void 0,L=h.useMemo(()=>Ve?e.find(P=>P.value===Ve)??e.flatMap(P=>P.children??[]).find(P=>P.value===Ve):void 0,[e,Ve]),re=L?o?`${o} ${L.label}`:L.label:void 0,xe=h.useMemo(()=>t?Oe?n.jsx("span",{className:"flex min-w-0 flex-1 flex-wrap items-center gap-1",children:se?.(e,ie,at)??n.jsx(Jn,{options:e,selectedValues:ie,handleRemoveTag:at})}):null:!L||!L.labelNode&&!L.description?null:n.jsxs("span",{className:"flex min-w-0 flex-1 items-center gap-2",children:[n.jsx(R.EllipsisTooltip,{text:L.labelNode??re}),L.description&&n.jsx("span",{className:"truncate text-secondary dial-tiny-text",children:L.description})]}),[se,at,Oe,t,e,re,ie,L]),Mt=t||xe?"":re||(l&&s?l:""),ls=typeof d?.label=="string"?d.label:void 0,cs=xe?[E.resolveAccessibleName(g,ls),t?ie.map(P=>e.find(ce=>ce.value===P)?.label??P).join(", "):re].filter(Boolean).join(", ")||void 0:E.resolveAccessibleName(g);h.useImperativeHandle(G,()=>({dismiss:()=>{fe(!1)}}));const ds=h.useCallback(P=>{_||(P.key==="ArrowDown"||P.key==="ArrowUp")&&(P.preventDefault(),ge||fe(!0))},[_,ge,fe]),us=()=>n.jsxs("div",{id:ae,role:"listbox","aria-multiselectable":t||void 0,className:oc,children:[M&&n.jsx(n.Fragment,{children:typeof M=="function"?M():M}),(u||j)&&(e.length>hc||!!W)&&n.jsxs("div",{className:"flex items-center gap-2 px-2 pt-2",children:[u&&n.jsx(We,{id:`search-${Z}`,size:m,placeholder:v,"aria-label":v||"Search options",onChange:P=>Se(P),value:W,iconBefore:mc,containerClassName:"w-full"}),j&&n.jsx(R.GhostIconButton,{"aria-label":"Close select",className:"shrink-0",size:E.ElementSize.Small,icon:xc,onClick:P=>{U?.(P),fe(!1)}})]}),t&&x&&ve.length>0&&n.jsx("div",{className:I.mergeClasses(lc,"mt-2"),children:n.jsx(R.Checkbox,{id:`${Z}-selectAll`,labelProps:{label:y},isSelected:Me,isIndeterminate:me,onChange:Rt})}),n.jsx("div",{role:"none",className:dc,children:Re.length===0?n.jsx("div",{className:"px-2 py-3",children:n.jsx(T.DialNoDataContent,{icon:S??bc,title:w,description:D})}):Re.map(P=>{const ce=ie.includes(P.value);if(P.children?.length)return n.jsx(Cc,{opt:P,selectedValues:ie,mark:t?R.MenuItemMark.Checkbox:N,onSelect:$e},P.value);const pt=t?n.jsx(R.MenuItem,{id:`${Z}-${P.value}`,role:"option","aria-selected":ce,"aria-disabled":!!P.disabled,disabled:P.disabled,mark:R.MenuItemMark.Checkbox,selected:ce,icon:P.icon,label:P.labelNode??P.label,description:P.description,rightControl:P.rightControl,onClick:()=>$e(P.value)}):n.jsx(R.MenuItem,{role:"option","aria-selected":ce,"aria-disabled":!!P.disabled,disabled:P.disabled,mark:N,selected:ce,ellipsisLabel:!0,icon:P.icon,label:P.labelNode??P.label,description:P.description,rightControl:P.rightControl,onClick:()=>!P.disabled&&$e(P.value)});return n.jsx(h.Fragment,{children:P.interactiveTooltip?n.jsx(R.InteractiveTooltip,{asChild:!0,placement:P.interactiveTooltip.placement,content:P.interactiveTooltip.content,contentClassName:P.interactiveTooltip.contentClassName,children:pt}):pt},P.value)})}),$&&n.jsx("div",{onClick:P=>{B?.(P),B&&fe(!1)},children:typeof $=="function"?$():$})]});return n.jsxs("div",{className:I.mergeClasses("flex w-full flex-col gap-2",O,T.DIAL_KIT_CLASS.select),children:[d&&n.jsx(R.Label,{...d,htmlFor:Z}),n.jsxs("div",{className:"flex flex-col gap-1",children:[n.jsx(R.Dropdown,{open:ge,onOpenChange:fe,disabled:_,closable:j,onClose:U,placement:"bottom-start",allowedPlacements:["bottom-start","top-start"],listClassName:I.mergeClasses(cc,k),className:"w-full",renderOverlay:us,children:n.jsx(We,{id:Z,size:i,disabled:_,invalid:b,value:Mt,placeholder:xe?void 0:c,readOnly:!0,iconBefore:t?void 0:L?.icon,iconAfter:n.jsx(F.IconChevronDown,{size:te?z.DIAL_ICON_SIZE.SM:z.DIAL_ICON_SIZE.MD,stroke:ne.DIAL_KIT_ICON_STROKE,"aria-hidden":"true",className:I.mergeClasses(gc,ge&&"rotate-180")}),role:"combobox","aria-haspopup":"listbox","aria-expanded":ge,"aria-controls":ae,"aria-autocomplete":"none","aria-label":cs,containerClassName:"w-full",wrapperClassName:I.mergeClasses(!_&&"cursor-pointer",t&&Oe&&["!h-auto flex-wrap py-1.5",te?"min-h-[24px]":"min-h-[40px]"],A),className:I.mergeClasses("cursor-pointer",xe&&"w-0 min-w-0 flex-none p-0"),onKeyDown:ds,children:xe})}),n.jsx(Fe,{text:f}),!f&&n.jsx(Pe,{text:p})]})]})};var es=(e=>(e.None="none",e.Both="both",e.Horizontal="horizontal",e.Vertical="vertical",e))(es||{});const tn={none:"resize-none",both:"resize",horizontal:"resize-x",vertical:"resize-y"},yc=e=>typeof e=="boolean"?tn[e?"both":"none"]:tn[e],Dc=({className:e="",value:t,onChange:r,error:s,containerClassName:a,resize:i=!1,labelProps:o,caption:l,id:c,...d})=>{const f=I.mergeClasses("dial-kit-textarea dial-kit-input px-3 py-2",d.invalid&&"dial-kit-input-error",d.disabled&&"dial-kit-input-disable",yc(i),e);return n.jsxs("div",{className:I.mergeClasses("flex flex-col gap-2",a),children:[o&&n.jsx(R.Label,{...o,htmlFor:c}),n.jsxs("div",{className:"flex flex-col gap-1",children:[n.jsx("textarea",{id:c,value:t||"",className:f,onChange:p=>r?.(p.currentTarget.value),...d}),n.jsx(Fe,{text:s}),!s&&n.jsx(Pe,{text:l})]})]})},Ic=({showPasswordLabel:e="Show password",hidePasswordLabel:t="Hide password",disabled:r,size:s=E.ElementSize.Standard,...a})=>{const[i,o]=h.useState(!1),l=i&&!r;return h.useEffect(()=>{r&&o(!1)},[r]),n.jsx(We,{...a,wrapperClassName:I.mergeClasses(a.wrapperClassName,T.DIAL_KIT_CLASS.passwordInput),size:s,disabled:r,type:l?"text":"password",iconAfter:r?void 0:n.jsx(R.GhostIconButton,{size:E.ElementSize.Small,"aria-label":l?t:e,"aria-pressed":l,icon:l?n.jsx(F.IconEyeOff,{size:z.DIAL_ICON_SIZE.SM,stroke:ne.DIAL_KIT_ICON_STROKE,"aria-hidden":"true"}):n.jsx(F.IconEye,{size:z.DIAL_ICON_SIZE.SM,stroke:ne.DIAL_KIT_ICON_STROKE,"aria-hidden":"true"}),onClick:()=>o(c=>!c)})})},Sc=/^0+\.(\d+)?$/,Nc=/^0+/,jc=[".","-","+","e","E"],rn=e=>!e||e==="-"?e:String(e).match(Sc)?String(e).replace(Nc,"0"):Number(e),Tc=({integer:e,onChange:t,min:r,max:s,onKeyDown:a,onPaste:i,...o})=>{const l=d=>{if(e&&jc.includes(d.key)){d.preventDefault();return}Yn(d,"number",r,s),a?.(d)},c=d=>{if(e){const f=d.clipboardData.getData("text"),p=f.replace(/\D/g,"");if(p!==f&&(d.preventDefault(),p)){const g=d.currentTarget,u=g.selectionStart??0,m=g.selectionEnd??0,v=g.value.slice(0,u)+p+g.value.slice(m);t?.(rn(v))}}i?.(d)};return n.jsx(We,{...o,wrapperClassName:I.mergeClasses(o.wrapperClassName,T.DIAL_KIT_CLASS.numberInput),type:"number",min:r,max:s,onChange:d=>t?.(rn(d)),onKeyDown:l,onPaste:c})},wc="z-popup flex items-center justify-center bg-backdrop md:p-4 gap-5 p-6",Ec="relative flex w-full max-h-full flex-col rounded-xl bg-layer-raised md:h-auto",Oc="flex flex-row items-center justify-between px-6 py-4",Ac="flex-1 min-w-0 mr-3 truncate dial-h1-text text-primary",_c="border-b border-tertiary",Lc="flex flex-row items-center gap-2 px-6 py-4",kc="border-t border-tertiary",qt="flex shrink-0 flex-row items-center gap-2",Rc={[C.PopupSize.Sm]:"max-w-full md:max-w-[400px]",[C.PopupSize.Md]:"max-w-full md:max-w-[800px]",[C.PopupSize.Lg]:"max-w-full md:max-w-[1200px]"},Dr=({open:e=!1,header:t,ariaLabel:r,portalId:s,className:a,overlayClassName:i,titleClassName:o,headerClassName:l,bodyClassName:c,children:d,footer:f,footerClassName:p,onClose:g,onBack:u,backAriaLabel:m="Back",headerActions:v,headerDivider:x=!1,mainButtons:b,additionalButtons:y,additionalButtonsOnLeft:N=!1,footerDivider:w=!1,size:D=C.PopupSize.Md,hideClose:S=!1,closeAriaLabel:_="Close dialog",closeOnOutsideClick:O=!0,preventKeyboardOnOpen:A=!1})=>{const k=T.useThemeScope(),j=h.useRef(null),M=h.useId(),{refs:$,context:U}=de.useFloating({open:e,onOpenChange:Z=>{Z||g?.(null)}}),J=de.useRole(U,{role:"dialog"}),G=de.useDismiss(U,{outsidePress:O}),{getFloatingProps:B}=de.useInteractions([J,G]);if(!e)return null;const H=typeof t=="string"?`popup-heading-${M}`:void 0,q=Z=>Z?typeof Z=="string"?n.jsx("h2",{id:H,className:I.mergeClasses(Ac,o),children:n.jsx(R.Tooltip,{tooltip:Z,triggerClassName:"truncate",children:Z})}):Z:n.jsx("span",{}),K=S?null:n.jsx(R.CloseButton,{ariaLabel:_,onClose:Z=>g?.(Z)}),se=(Z,ae=[])=>ae.map(({variant:te=E.ButtonVariant.Neutral,...le},ue)=>n.jsx(Xe,{variant:te,...le},`${Z}-${ue}`)),X=()=>{if(f!==void 0)return f;if(!b?.length&&!y?.length)return null;const Z=se("additional",y);return n.jsxs("div",{className:I.mergeClasses(Lc,w&&kc,p),children:[N&&Z.length>0&&n.jsx("div",{className:qt,children:Z}),n.jsxs("div",{className:I.mergeClasses(qt,"ml-auto"),children:[!N&&Z,se("main",b)]})]})};return n.jsx(de.FloatingPortal,{id:s,children:n.jsx(de.FloatingOverlay,{className:I.mergeClasses(wc,k,i),children:n.jsx(de.FloatingFocusManager,{context:U,initialFocus:A?j:$.floating,children:n.jsxs("div",{ref:$.setFloating,...B(),role:"dialog","aria-modal":"true","aria-labelledby":H,"aria-label":H?void 0:r,className:I.mergeClasses(Ec,Rc[D],a,T.DIAL_KIT_CLASS.popup),children:[A&&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(Oc,x&&_c,l),children:[u&&n.jsx(R.GhostIconButton,{"aria-label":m,size:E.ElementSize.Small,className:"mr-2",onClick:u,icon:n.jsx(F.IconChevronLeft,{size:z.DIAL_ICON_SIZE.SM,stroke:ne.DIAL_KIT_ICON_STROKE,"aria-hidden":"true"})}),q(t),v?n.jsxs("div",{className:qt,children:[v,K]}):K]}),n.jsx("div",{className:I.mergeClasses("grow overflow-auto",c),children:d}),X()]})})})})},Mc="flex justify-end gap-2 px-6 py-4 border-t border-tertiary",Pc="text-secondary dial-small-paragraph-text px-6 pb-4",Fc="px-6 py-4 h-[120px]",Bc="Cancel",zc="Ok",Yt={[C.ConfirmationPopupVariant.Info]:{confirm:{variant:E.ButtonVariant.Primary,appearance:E.ButtonAppearance.Solid}},[C.ConfirmationPopupVariant.Danger]:{container:"border-t-4 border-error",confirm:{variant:E.ButtonVariant.Danger,appearance:E.ButtonAppearance.Solid}}},ts=({header:e,description:t,descriptionClassName:r,open:s=!1,confirmLabel:a=zc,cancelLabel:i=Bc,isLoading:o=!1,disableConfirmButton:l=!1,className:c,confirmClassName:d,onClose:f,onConfirm:p,onCancel:g,children:u,variant:m=C.ConfirmationPopupVariant.Info,size:v=C.PopupSize.Sm,footer:x,hideClose:b,...y})=>{const N=o?null:n.jsxs("div",{className:Mc,children:[n.jsx(yr,{label:i,onClick:()=>g?g():f?.()}),n.jsx(Xe,{variant:Yt[m].confirm.variant,appearance:Yt[m].confirm.appearance,className:d,label:a,disabled:l,onClick:p})]}),w=h.useCallback(()=>o?n.jsx("div",{className:Fc,children:n.jsx(C.Spinner,{size:40})}):u??(t?n.jsx("div",{className:I.mergeClasses(Pc,r),children:t}):null),[u,t,o,r]);return n.jsx(Dr,{...y,open:s,header:e,className:I.mergeClasses(Yt[m].container,c,T.DIAL_KIT_CLASS.confirmationPopup),onClose:()=>f?.(),footer:x??N,size:v,hideClose:b??(!o&&x===void 0),children:w()})};var Nt=(e=>(e.Start="start",e.End="end",e))(Nt||{});const $c=({title:e,description:t,children:r,expanded:s,defaultExpanded:a=!1,disabled:i,nonCollapsible:o,ariaLabel:l,onToggle:c,caretPosition:d=Nt.End,className:f,headerClassName:p,contentClassName:g})=>{const u=s!==void 0,[m,v]=h.useState(a),x=o?!0:u?s:m,b=h.useId(),y=`accordion-header-${b}`,N=`accordion-content-${b}`,w=()=>{if(i)return;const A=!x;u||v(A),c?.(A)},D=d===Nt.Start,S=o?null:n.jsx(F.IconChevronRight,{size:z.DIAL_ICON_SIZE.SM,stroke:ne.DIAL_KIT_ICON_STROKE,"aria-hidden":"true",className:I.mergeClasses("shrink-0 text-secondary transition-transform motion-reduce:transition-none",x?"rotate-90":"rtl:rotate-180")}),_=n.jsxs(n.Fragment,{children:[D&&S,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]}),!D&&S]}),O=D?"justify-start gap-2":"justify-between";return n.jsxs("div",{className:I.mergeClasses("flex flex-col py-3 overflow-hidden bg-transparent",f,T.DIAL_KIT_CLASS.accordion),children:[o?n.jsx("div",{id:y,className:I.mergeClasses("flex w-full px-4 rounded-xl items-center dial-tiny-text",O,p),children:_}):n.jsx("button",{id:y,type:"button","aria-expanded":x,"aria-controls":N,"aria-label":E.resolveAccessibleName(l),disabled:i,onClick:w,className:I.mergeClasses("flex w-full px-4 rounded-xl items-center dial-tiny-text",O,i?"cursor-not-allowed opacity-75":"cursor-pointer hover:bg-control-accent-alpha-hover focus-visible:outline focus-visible:outline-focus",p),children:_}),n.jsx("div",{inert:!x,className:I.mergeClasses("grid transition-[grid-template-rows] duration-200 ease-out motion-reduce:transition-none",x?"grid-rows-[1fr]":"grid-rows-[0fr]"),children:n.jsx("div",{className:"min-h-0 overflow-hidden",children:n.jsx("div",{className:"pt-3",children:n.jsx("div",{id:N,role:"region","aria-labelledby":y,className:I.mergeClasses("px-4 dial-small-text text-primary",g),children:r})})})})]})},Hc=({id:e,labelProps:t,isOn:r=!1,disabled:s,onChange:a,caption:i,className:o,...l})=>{const c=h.useId(),d=e??c,f=i?`${d}-caption`:void 0,p=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,T.DIAL_KIT_CLASS.switch),children:[n.jsx("input",{...l,type:"checkbox",role:"switch",id:d,checked:r,"aria-checked":r,disabled:s,onChange:p,"aria-label":E.resolveAccessibleName(typeof t?.label!="string"?l["aria-label"]:void 0),"aria-describedby":f,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(R.Label,{size:E.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:f,className:"dial-tiny-text text-secondary ml-[44px]",children:i})]})},Vc="flex flex-col gap-2",Kc="flex",Gc="mt-2 ml-[26px]",Uc={[C.RadioGroupOrientation.Column]:"flex-col gap-y-3",[C.RadioGroupOrientation.Row]:"flex-row flex-wrap gap-x-4 gap-y-3"},rs=({items:e,value:t,onChange:r,name:s,id:a,orientation:i=C.RadioGroupOrientation.Column,labelProps:o,disabled:l,error:c,caption:d,ariaLabel:f,className:p,optionsClassName:g,radioClassName:u,contentClassName:m})=>{const v=h.useId(),x=a??v,b=`${x}-label`,y=c?`${x}-error`:void 0,N=!c&&d?`${x}-caption`:void 0,w=E.resolveAccessibleName(o?.label);return n.jsxs("div",{className:I.mergeClasses(Vc,p,T.DIAL_KIT_CLASS.radioGroup),children:[o&&n.jsx(R.Label,{...o,id:b}),n.jsx("div",{role:"radiogroup","aria-labelledby":w?b:void 0,"aria-label":w?void 0:E.resolveAccessibleName(f),"aria-describedby":[y,N].filter(Boolean).join(" ")||void 0,"aria-disabled":l||void 0,className:I.mergeClasses(Kc,Uc[i],g),children:e.map(D=>{const S=D.value===t;return n.jsxs("div",{className:"flex min-w-0 flex-col",children:[n.jsx(R.Radio,{id:`${x}-${D.value}`,name:s??x,value:D.value,labelProps:D.label==null?void 0:{label:D.label},"aria-label":D["aria-label"],caption:D.caption,isSelected:S,disabled:l||D.disabled,onChange:r,className:u}),S&&D.content?n.jsx("div",{className:I.mergeClasses(Gc,m),children:D.content}):null]},D.value)})}),n.jsx(Fe,{id:y,text:c}),!c&&n.jsx(Pe,{id:N,text:d})]})},Zc="dial-kit-input flex flex-row items-center justify-between gap-x-2 px-3 text-left",Wc="min-w-0 flex-1 truncate text-primary",qc="min-w-0 flex-1 truncate text-secondary",Yc="shrink-0 text-secondary",Xc="px-6 pb-4",Qc="flex justify-end gap-2 px-6 py-4 border-t border-tertiary",Jc="Cancel",ed="Apply",td=({items:e,value:t,customValue:r,header:s,onApply:a,id:i,labelProps:o,placeholder:l,selectedValue:c,onSelectionChange:d,onCancel:f,onClose:p,isValid:g=!0,applyButtonLabel:u=ed,cancelButtonLabel:m=Jc,size:v=C.PopupSize.Md,portalId:x,disabled:b,invalid:y,error:N,caption:w,ariaLabel:D,className:S,fieldClassName:_})=>{const O=h.useId(),A=i??O,k=`${A}-label`,j=`${A}-value`,M=N?`${A}-error`:void 0,$=!N&&w?`${A}-caption`:void 0,[U,J]=h.useState(!1),G=c!==void 0,[B,H]=h.useState(t),q=G?c:B,K=h.useCallback(()=>{b||(G||H(t),J(!0))},[b,G,t]),se=h.useCallback(()=>{J(!1),p?.()},[p]),X=h.useCallback(()=>{f?.(),se()},[f,se]),Z=h.useCallback(()=>{a(q),se()},[a,q,se]),ae=h.useCallback(W=>{G||H(W),d?.(W)},[G,d]),te=E.resolveAccessibleName(o?.label),le=te?void 0:E.resolveAccessibleName(D),ue=te?k:le&&`${A}-name`,pe=E.resolveAccessibleName(s),ge=e.find(W=>W.value===t)?.label,fe=r??ge;return n.jsxs("div",{className:I.mergeClasses("flex w-full flex-col gap-2",S,T.DIAL_KIT_CLASS.radioGroupPopupField),children:[o&&n.jsx(R.Label,{...o,id:k,htmlFor:A}),n.jsxs("div",{className:"flex flex-col gap-1",children:[le&&n.jsx("span",{id:ue,className:"sr-only",children:le}),n.jsxs("button",{type:"button",id:A,disabled:b,"aria-haspopup":"dialog","aria-expanded":U,"aria-labelledby":ue?`${ue} ${j}`:void 0,"aria-describedby":[M,$].filter(Boolean).join(" ")||void 0,onClick:K,className:I.mergeClasses(Zc,y&&"dial-kit-input-error",b&&"dial-kit-input-disable",_),children:[n.jsx("span",{id:j,className:fe==null?qc:Wc,children:fe??l}),n.jsx(F.IconMaximize,{size:z.DIAL_ICON_SIZE.MD,stroke:ne.DIAL_KIT_ICON_STROKE,"aria-hidden":"true",className:Yc})]}),n.jsx(Fe,{id:M,text:N}),!N&&n.jsx(Pe,{id:$,text:w})]}),n.jsx(Dr,{open:U,header:s,ariaLabel:pe?void 0:te,portalId:x,size:v,onClose:X,footer:n.jsxs("div",{className:Qc,children:[n.jsx(yr,{label:m,onClick:X}),n.jsx(Wn,{label:u,disabled:!g,onClick:Z})]}),children:n.jsx("div",{className:Xc,children:n.jsx(rs,{id:`${A}-options`,items:e,value:q,onChange:ae,orientation:C.RadioGroupOrientation.Column,ariaLabel:te??pe})})})]})},rd=({icon:e,selectedIcon:t,isSelected:r=!1,onToggle:s,onClick:a,tooltipProps:i,size:o=E.ElementSize.Small,className:l,...c})=>{const d=h.useCallback(p=>{a?.(p),s?.(!r)},[a,s,r]),f=n.jsx(R.IconButton,{...c,size:o,variant:E.ButtonVariant.Primary,appearance:E.ButtonAppearance.Ghost,icon:r?t??e:e,"aria-pressed":r,"aria-label":E.resolveAccessibleName(c["aria-label"],i?.tooltip),onClick:d,className:I.mergeClasses("!rounded","[&_svg]:size-4",r&&"!text-accent",l,T.DIAL_KIT_CLASS.toggleIconButton)});return i?n.jsx(R.Tooltip,{asChild:!0,...i,children:f}):f},nd=["ArrowRight","ArrowLeft","ArrowUp","ArrowDown","Home","End"],sd="inline-flex w-fit items-center gap-1 rounded-full border border-tertiary bg-layer-sunken p-[3px]",ad="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",id="bg-layer-raised text-accent shadow-xs",od="bg-transparent text-secondary",ld="cursor-pointer hover:bg-control-accent-alpha-hover active:bg-control-accent-alpha-active",cd="cursor-pointer hover:bg-control-accent-alpha-hover hover:text-accent active:bg-control-accent-alpha-active",dd="cursor-not-allowed bg-control-disable-primary text-control-disable-primary shadow-none",ud="cursor-not-allowed bg-transparent text-control-disable-primary",fd=({items:e,value:t,onChange:r,disabled:s,className:a,segmentClassName:i,"aria-label":o})=>{const l=h.useRef({}),c=e.find(p=>p.value===t),d=c&&!c.disabled?c.value:e.find(p=>!p.disabled)?.value,f=h.useCallback(p=>{if(s||!nd.includes(p.key))return;const g=e.filter(b=>!b.disabled);if(g.length===0)return;const u=Math.max(g.findIndex(b=>b.value===t),0),m=g.length-1;let v=u;switch(p.key){case"ArrowRight":case"ArrowDown":v=u===m?0:u+1;break;case"ArrowLeft":case"ArrowUp":v=u===0?m:u-1;break;case"Home":v=0;break;case"End":v=m;break}p.preventDefault();const x=g[v];l.current[x.value]?.focus(),x.value!==t&&r(x.value)},[s,e,t,r]);return n.jsx("div",{role:"radiogroup","aria-label":o,"aria-disabled":s||void 0,onKeyDown:f,className:I.mergeClasses(sd,a,T.DIAL_KIT_CLASS.segmentedControl),children:e.map(p=>{const g=p.value===t,u=s||p.disabled;return n.jsxs("button",{ref:m=>{l.current[p.value]=m},type:"button",role:"radio","aria-checked":g,"aria-label":E.resolveAccessibleName(p["aria-label"],typeof p.label=="string"?p.label:void 0),tabIndex:p.value===d?0:-1,disabled:u,onClick:()=>r(p.value),className:I.mergeClasses(ad,g?id:od,u?g?dd:ud:g?ld:cd,i,T.DIAL_KIT_CLASS.segmentedControlItem),children:[p.icon,p.label]},p.value)})})},pd={[C.TabOrientation.Horizontal]:{next:"ArrowRight",previous:"ArrowLeft"},[C.TabOrientation.Vertical]:{next:"ArrowDown",previous:"ArrowUp"}},gd=({tabs:e,activeTabId:t,onTabChange:r,orientation:s=C.TabOrientation.Horizontal,sectionLabel:a,ariaLabel:i,className:o,tabListClassName:l,tabClassName:c,sectionLabelClassName:d})=>{const f=h.useRef({}),p=h.useId(),g=s===C.TabOrientation.Vertical,u=e.find(b=>b.id===t),m=u&&!u.disabled?u.id:e.find(b=>!b.disabled)?.id,v=h.useCallback(b=>{const{next:y,previous:N}=pd[s];if(![y,N,"Home","End"].includes(b.key)||e.length===0)return;const w=e.filter(A=>!A.disabled);if(w.length===0)return;const D=Math.max(w.findIndex(A=>A.id===t),0),S=w.length-1;let _=D;b.key===y?_=D===S?0:D+1:b.key===N?_=D===0?S:D-1:b.key==="Home"?_=0:_=S,b.preventDefault();const O=w[_];f.current[O.id]?.focus(),O.id!==t&&r(O.id)},[e,t,r,s]),x=n.jsx("div",{role:"tablist","aria-orientation":g?"vertical":void 0,"aria-label":i,"aria-labelledby":!i&&a?p:void 0,onKeyDown:v,className:I.mergeClasses(g?"flex flex-col gap-1 px-2":"flex justify-start gap-1",!a&&o,l,T.DIAL_KIT_CLASS.tabList,!a&&T.DIAL_KIT_CLASS.tabs),children:e.map(b=>{const y=t===b.id,N=!!b.disabled;return n.jsxs("button",{ref:w=>{f.current[b.id]=w},type:"button",role:"tab","aria-selected":y,disabled:N,tabIndex:b.id===m?0:-1,onClick:()=>r(b.id),className:I.mergeClasses("dial-kit-enhanced-target flex items-center gap-2 text-start","transition-colors motion-reduce:transition-none","focus-visible:outline focus-visible:outline-focus",g?["h-11 w-full rounded-lg px-3 desktop:h-10","focus-visible:-outline-offset-1",y?"dial-small-semi-text":"dial-small-text text-secondary"]:["dial-small-paragraph-semi-text border-b-2 border-transparent px-3 py-2","focus-visible:outline-offset-2"],N&&(g?"cursor-not-allowed text-control-disable-primary":"cursor-not-allowed border-control-disable-primary text-control-disable-primary"),!N&&(g?y?"bg-control-accent-alpha text-accent hover:bg-control-accent-alpha-hover":"hover:bg-control-accent-alpha-hover":y?"dial-kit-tab-selected-underline text-primary":"border-transparent text-secondary"),c,T.DIAL_KIT_CLASS.tab,y&&T.DIAL_KIT_CLASS.tabSelected),children:[b.icon&&n.jsx("span",{"aria-hidden":"true",className:"flex shrink-0",children:b.icon}),n.jsx("span",{className:I.mergeClasses(g&&!y&&!N&&"text-primary"),children:b.label}),b.count!=null&&n.jsx("span",{className:I.mergeClasses("dial-tiny-semi-text rounded-full px-1.5 py-0.5",g&&"ms-auto",N&&"bg-layer-sunken text-control-disable-primary",!N&&(y?"bg-control-accent-alpha text-accent":"bg-layer-sunken text-secondary")),children:b.count})]},b.id)})});return a?n.jsxs("div",{className:I.mergeClasses("flex flex-col gap-3",o,T.DIAL_KIT_CLASS.tabs),children:[n.jsx("div",{className:I.mergeClasses("flex h-16 shrink-0 items-center",g?"px-4":"px-3"),children:n.jsx("span",{id:p,className:I.mergeClasses("dial-h1-text text-primary",d,T.DIAL_KIT_CLASS.tabsSectionLabel),children:a})}),x]}):x},hd="flex flex-nowrap items-center gap-1",md="min-w-max flex-1 justify-center",xd=({items:e,value:t,onChange:r,stretch:s=!1,className:a,chipClassName:i,"aria-label":o,"aria-labelledby":l})=>n.jsx("div",{role:"group","aria-label":o,"aria-labelledby":l,className:I.mergeClasses(hd,a,T.DIAL_KIT_CLASS.filterChips),children:e.map(c=>n.jsx(Ge,{label:c.label,icon:c.icon,appearance:qe.Selectable,selected:c.value===t,onClick:()=>r(c.value),className:I.mergeClasses(s&&md,i)},c.value))}),ar=(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})},bd=({labelProps:e,label:t,description:r,onChange:s,onReject:a,accept:i,multiple:o=!1,disabled:l=!1,errorText:c,icon:d,id:f,ariaLabel:p,className:g})=>{const u=h.useId(),m=f??`file-dropzone-${u}`,v=c?`${m}-error`:void 0,[x,b]=h.useState(!1),y=h.useRef(0),N=h.useCallback(k=>{if(k.length===0)return;const j=o?k:k.slice(0,1),M=j.filter(U=>ar(U,i)),$=j.filter(U=>!ar(U,i));$.length>0&&a?.($),M.length>0&&s(M)},[i,o,s,a]),w=h.useCallback(k=>{N(Array.from(k.target.files??[])),k.target.value=""},[N]),D=h.useCallback(()=>{y.current=0,b(!1)},[]),S=h.useCallback(k=>{l||(k.preventDefault(),y.current+=1,b(!0))},[l]),_=h.useCallback(k=>{l||(k.preventDefault(),k.dataTransfer.dropEffect="copy")},[l]),O=h.useCallback(()=>{l||(y.current-=1,y.current<=0&&D())},[l,D]),A=h.useCallback(k=>{k.preventDefault(),!l&&(D(),N(Array.from(k.dataTransfer?.files??[])))},[l,D,N]);return n.jsxs("div",{className:"flex flex-col gap-1",children:[e&&n.jsx(R.Label,{...e,htmlFor:m}),n.jsx("input",{id:m,type:"file",accept:i,multiple:o,disabled:l,onChange:w,"aria-label":E.resolveAccessibleName(typeof t!="string"?p:void 0),"aria-describedby":v,"aria-invalid":c?!0:void 0,className:"peer sr-only"}),n.jsxs("label",{htmlFor:m,onDragEnter:S,onDragOver:_,onDragLeave:O,onDrop:A,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&&x&&"border-accent bg-control-accent-alpha",!l&&!x&&"border-secondary hover:border-accent",c&&!x&&"border-error hover:border-error",g,T.DIAL_KIT_CLASS.fileDropzone),children:[d??n.jsx(F.IconUpload,{size:z.DIAL_ICON_SIZE.LG,stroke:ne.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(Fe,{id:v,text:c})]})},ns=({label:e="Shared",tooltip:t,size:r=12,className:s})=>n.jsx(R.Tooltip,{tooltip:t||"Shared",asChild:!0,children:n.jsx("span",{role:"img","aria-label":e,className:I.mergeClasses("flex shrink-0 rounded-sm bg-layer-raised text-accent",s,T.DIAL_KIT_CLASS.sharedEntityIndicator),children:n.jsx(F.IconArrowUpRight,{size:r,stroke:ne.DIAL_KIT_ICON_STROKE,"aria-hidden":"true"})})});var De=(e=>(e.Images="images",e.Video="video",e.Audio="audio",e.Code="code",e.Text="text",e.Pdf="pdf",e.Spreadsheet="spreadsheet",e.Presentation="presentation",e.Archive="archive",e.Dial="dial",e.Other="other",e))(De||{});const Cd={images:["apng","avif","bmp","gif","heic","heif","ico","jpeg","jpg","png","svg","tif","tiff","webp"],video:["avi","flv","m4v","mkv","mov","mp4","mpeg","mpg","ogv","webm","wmv"],audio:["aac","aiff","flac","m4a","mid","midi","mp3","oga","ogg","opus","wav","wma"],code:["bash","c","cjs","cpp","cs","css","go","h","hpp","htm","html","ini","ipynb","java","js","json","jsx","kt","less","lua","mjs","php","ps1","py","r","rb","rs","sass","scala","scss","sh","sql","svelte","swift","toml","ts","tsx","vue","xml","yaml","yml","zsh"],text:["doc","docx","log","markdown","md","odt","rtf","text","txt"],pdf:["pdf"],spreadsheet:["csv","numbers","ods","tsv","xls","xlsm","xlsx"],presentation:["key","odp","pps","ppsx","ppt","pptx"],archive:["7z","bz2","gz","rar","tar","tgz","xz","zip"],dial:["dial"]},vd=new Map(Object.entries(Cd).flatMap(([e,t])=>t.map(r=>[r,e]))),yd=e=>vd.get(e)??"other",nn="var(--text-control-permanent, #FCFCFC)",mt={x1:"20.4167",y1:"-3.33333",x2:"2.5",y2:"20",from:"var(--bg-visual-blue, #D6EDF9)",to:"var(--stroke-gradient-1, #5976E9)"},Dd="#1B212D",Id={[De.Images]:{path:"M11.0002 8.66667H11.0036M7.00024 11.3333L8.66691 9.66667C8.97624 9.369 9.35758 9.369 9.66691 9.66667L11.3336 11.3333M10.6669 10.6667L11.0002 10.3333C11.3096 10.0357 11.6909 10.0357 12.0002 10.3333L13.0002 11.3333M7.00024 8C7.00024 7.73478 7.1056 7.48043 7.29314 7.29289C7.48067 7.10536 7.73503 7 8.00024 7H12.0002C12.2655 7 12.5198 7.10536 12.7074 7.29289C12.8949 7.48043 13.0002 7.73478 13.0002 8V12C13.0002 12.2652 12.8949 12.5196 12.7074 12.7071C12.5198 12.8946 12.2655 13 12.0002 13H8.00024C7.73503 13 7.48067 12.8946 7.29314 12.7071C7.1056 12.5196 7.00024 12.2652 7.00024 12V8Z",sheet:mt},[De.Code]:{path:"M8.33358 8.66665L7.00024 9.99998L8.33358 11.3333M11.6669 8.66665L13.0002 9.99998L11.6669 11.3333M10.6669 7.33331L9.33358 12.6666",sheet:{x1:"16.6667",y1:"0",x2:"2.08333",y2:"20.4167",from:"var(--bg-control-inverted, #57647A)",to:Dd}},[De.Text]:{path:"M7.3335 8H12.6668M7.3335 10H12.6668M7.3335 12H11.3335",sheet:{x1:"25.8333",y1:"-11.6667",x2:"2.5",y2:"20",from:"var(--bg-visual-violet-1, #DDE3F9)",to:"var(--bg-gradient-1, #1D4ED8)"}},[De.Spreadsheet]:{path:"M7.33325 10.1667H12.6666M9.99992 7.5V12.8333M7.33325 8.16667C7.33325 7.98986 7.40349 7.82029 7.52851 7.69526C7.65354 7.57024 7.82311 7.5 7.99992 7.5H11.9999C12.1767 7.5 12.3463 7.57024 12.4713 7.69526C12.5963 7.82029 12.6666 7.98986 12.6666 8.16667V12.1667C12.6666 12.3435 12.5963 12.513 12.4713 12.6381C12.3463 12.7631 12.1767 12.8333 11.9999 12.8333H7.99992C7.82311 12.8333 7.65354 12.7631 7.52851 12.6381C7.40349 12.513 7.33325 12.3435 7.33325 12.1667V8.16667Z",sheet:{x1:"20.4167",y1:"-3.75",x2:"2.91667",y2:"20.4167",from:"var(--bg-visual-green-1, #CDE8E5)",to:"var(--text-visual-green-1, #059669)"}},[De.Pdf]:{fillPath:"M12.5373 10.3151C12.0382 10.3151 11.4137 10.4021 11.2094 10.4328C10.3637 9.54967 10.1231 9.04771 10.069 8.91388C10.1423 8.72544 10.3975 8.0096 10.4338 7.09022C10.4517 6.62991 10.3544 6.28596 10.1447 6.06792C9.93533 5.85024 9.68191 5.83331 9.60924 5.83331C9.35443 5.83331 8.92697 5.96216 8.92697 6.82503C8.92697 7.5737 9.27603 8.36813 9.37252 8.57339C8.86416 10.0536 8.31837 11.0669 8.20248 11.2753C6.15974 12.0444 6 12.788 6 12.9988C6 13.3775 6.26973 13.6036 6.72152 13.6036C7.8192 13.6036 8.8209 11.7607 8.98653 11.4407C9.76614 11.1301 10.8096 10.9377 11.0749 10.8918C11.8357 11.6166 12.7157 11.81 13.0811 11.81C13.3561 11.81 14 11.81 14 11.148C14 10.5332 13.2121 10.3151 12.5373 10.3151ZM12.4844 10.7497C13.0773 10.7497 13.234 10.9458 13.234 11.0494C13.234 11.1145 13.2093 11.3268 12.8915 11.3268C12.6065 11.3268 12.1145 11.1621 11.6303 10.8047C11.8322 10.7782 12.131 10.7497 12.4844 10.7497ZM9.57812 6.25458C9.63218 6.25458 9.66777 6.27195 9.69711 6.31264C9.86764 6.54926 9.73014 7.32242 9.56279 7.92745C9.40124 7.40867 9.28 6.61264 9.45058 6.33259C9.48392 6.27793 9.52204 6.25458 9.57812 6.25458ZM9.29017 10.8856C9.50483 10.452 9.74542 9.81997 9.87646 9.46253C10.1387 9.90147 10.4914 10.309 10.6954 10.53C10.0603 10.6639 9.57969 10.7976 9.29017 10.8856ZM6.4264 13.0566C6.41226 13.0399 6.41017 13.0045 6.42083 12.9621C6.44317 12.8731 6.61396 12.4322 7.84924 11.8796C7.67236 12.1582 7.39585 12.5563 7.09208 12.8537C6.87825 13.0538 6.71174 13.1553 6.59719 13.1553C6.55621 13.1553 6.49974 13.1442 6.4264 13.0566Z",sheet:{x1:"26.25",y1:"-11.6667",x2:"2.5",y2:"20",from:"var(--bg-visual-red, #FCE7F3)",to:"var(--bg-control-error-active, #CC4545)"}},[De.Audio]:{path:"M9 11.5C9 11.7652 8.89464 12.0195 8.70711 12.2071C8.51957 12.3946 8.26522 12.5 8 12.5C7.73478 12.5 7.48043 12.3946 7.29289 12.2071C7.10536 12.0195 7 11.7652 7 11.5C7 11.2347 7.10536 10.9804 7.29289 10.7929C7.48043 10.6053 7.73478 10.5 8 10.5C8.26522 10.5 8.51957 10.6053 8.70711 10.7929C8.89464 10.9804 9 11.2347 9 11.5ZM9 11.5V7.16663H12.3333V11.5M12.3333 11.5C12.3333 11.7652 12.228 12.0195 12.0404 12.2071C11.8529 12.3946 11.5985 12.5 11.3333 12.5C11.0681 12.5 10.8138 12.3946 10.6262 12.2071C10.4387 12.0195 10.3333 11.7652 10.3333 11.5C10.3333 11.2347 10.4387 10.9804 10.6262 10.7929C10.8138 10.6053 11.0681 10.5 11.3333 10.5C11.5985 10.5 11.8529 10.6053 12.0404 10.7929C12.228 10.9804 12.3333 11.2347 12.3333 11.5ZM9 8.49996H12.3333",sheet:mt},[De.Video]:{path:"M9.99996 13.1667C11.8409 13.1667 13.3333 11.6743 13.3333 9.83333C13.3333 7.99238 11.8409 6.5 9.99996 6.5C8.15901 6.5 6.66663 7.99238 6.66663 9.83333C6.66663 11.6743 8.15901 13.1667 9.99996 13.1667ZM9.33337 8.5L11.3334 9.83333L9.33337 11.1667V8.5Z",sheet:mt},[De.Presentation]:{path:"M7 7.33331H13M7.33333 7.33331V10.6666C7.33333 10.8435 7.40357 11.013 7.5286 11.1381C7.65362 11.2631 7.82319 11.3333 8 11.3333H12C12.1768 11.3333 12.3464 11.2631 12.4714 11.1381C12.5964 11.013 12.6667 10.8435 12.6667 10.6666V7.33331M10 11.3333V12.6666M9 12.6666H11M8.66667 9.99998L9.66667 8.99998L10.3333 9.66665L11.3333 8.66665",sheet:{x1:"24.5",y1:"-9.5",x2:"2.5",y2:"20",from:"var(--bg-visual-brown, #FDE8D8)",to:"var(--text-visual-brown-2, #B45309)"}},[De.Archive]:{path:"M10.0001 6.66669H9.58341M10.8334 7.451H10.4167M10.0001 8.23531H9.58341M10.8334 9.01963H10.4167M10.0001 9.80394H9.58341M10.8334 10.5883H10.4167M10.0001 11.3726C10.2211 11.3726 10.4331 11.4552 10.5893 11.6023C10.7456 11.7494 10.8334 11.9489 10.8334 12.1569V12.9412C10.8334 13.0452 10.7895 13.1449 10.7114 13.2185C10.6332 13.292 10.5273 13.3334 10.4167 13.3334H9.58341C9.47291 13.3334 9.36693 13.292 9.28879 13.2185C9.21065 13.1449 9.16675 13.0452 9.16675 12.9412V12.1569C9.16675 11.9489 9.25455 11.7494 9.41083 11.6023C9.56711 11.4552 9.77907 11.3726 10.0001 11.3726Z",sheet:{x1:"24.5",y1:"-9.5",x2:"2.5",y2:"20",from:"var(--bg-visual-green-1, #CDE8E5)",to:"var(--text-visual-green-3, #065F46)"}},[De.Dial]:{path:"M8.26392 7.44049C8.80816 7.44049 9.28449 7.50578 9.69653 7.63092L9.69849 7.6319C10.1079 7.75343 10.4556 7.938 10.7463 8.1817L10.7483 8.18365C11.0312 8.41601 11.2537 8.72491 11.4104 9.12115V9.12213C11.5666 9.51456 11.6496 9.98403 11.6497 10.5381C11.6497 11.5957 11.3539 12.3492 10.8108 12.8565C10.2602 13.3708 9.47204 13.6504 8.39868 13.6505H6.71313V7.44049H8.26392Z",fillPath:"M12.7167 12.1008L12.9558 12.3564L12.9558 12.3564L12.7167 12.1008ZM11.4504 6.20825L11.3486 6.54311L11.3507 6.54375L11.4504 6.20825ZM12.637 6.833L12.4119 7.10109L12.4147 7.10334L12.637 6.833ZM13.4108 7.9263L13.0853 8.05488L13.0856 8.05566L13.4108 7.9263ZM11.1666 12.8853L11.0909 12.5436V12.5436L11.1666 12.8853ZM10.4391 12.6553C10.2487 12.689 10.1217 12.8706 10.1553 13.0609C10.189 13.2513 10.3706 13.3783 10.5609 13.3447L10.5 13L10.4391 12.6553ZM13.6781 9.49291H13.3281C13.3281 10.5655 13.0283 11.33 12.4776 11.8451L12.7167 12.1008L12.9558 12.3564C13.687 11.6724 14.0281 10.6984 14.0281 9.49291H13.6781ZM7.9751 6.12805H8.3251C8.3251 6.24476 8.23053 6.35 8.1009 6.35V6V5.65C7.83231 5.65 7.6251 5.86989 7.6251 6.12805H7.9751ZM8.1009 6V6.35H9.89799V6V5.65H8.1009V6ZM9.89799 6V6.35C10.449 6.35 10.9312 6.41618 11.3486 6.54311L11.4504 6.20825L11.5522 5.87339C11.0566 5.72265 10.5039 5.65 9.89799 5.65V6ZM11.4504 6.20825L11.3507 6.54375C11.7654 6.66701 12.1173 6.85376 12.4119 7.10107L12.637 6.833L12.862 6.56492C12.4875 6.2506 12.0484 6.02084 11.5501 5.87275L11.4504 6.20825ZM12.637 6.833L12.4147 7.10334C12.7016 7.33926 12.9264 7.65273 13.0853 8.05488L13.4108 7.9263L13.7363 7.79772C13.5387 7.29746 13.2477 6.88206 12.8593 6.56265L12.637 6.833ZM13.4108 7.9263L13.0856 8.05566C13.2441 8.45409 13.3281 8.93071 13.3281 9.49291H13.6781H14.0281C14.0281 8.86239 13.934 8.29465 13.736 7.79694L13.4108 7.9263ZM7.9751 7.21882H8.3251V6.12805H7.9751H7.6251V7.21882H7.9751ZM12.7167 12.1008L12.4776 11.8451C12.117 12.1824 11.6591 12.4177 11.0909 12.5436L11.1666 12.8853L11.2423 13.227C11.9168 13.0776 12.4923 12.7898 12.9558 12.3564L12.7167 12.1008ZM11.1666 12.8853L11.0909 12.5436C11.091 12.5435 11.0826 12.5452 11.0606 12.5493C11.041 12.5528 11.0155 12.5573 10.9857 12.5625C10.926 12.5729 10.8511 12.5857 10.7756 12.5984C10.6269 12.6236 10.472 12.6495 10.4391 12.6553L10.5 13L10.5609 13.3447C10.6064 13.3366 11.1725 13.2425 11.2423 13.227L11.1666 12.8853Z",sheet:"var(--bg-gradient-2, #885DF2)"},[De.Other]:{path:"M6.80005 8H13.2M6.80005 10.2222H13.2M6.80005 12.4444H13.2",sheet:mt}},Sd=({size:e,kind:t})=>{const r=`dial-kit-file-gradient-${h.useId().replace(/[^\w-]/g,"")}`,{path:s,fillPath:a,sheet:i}=Id[t],o=typeof i=="string";return n.jsxs("svg",{width:e,height:e,viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:[n.jsx("path",{d:"M17.4999 3.97859V16C17.4999 18.2091 15.709 20 13.4999 20H6.5C4.29086 20 2.5 18.2091 2.5 16V4C2.5 1.79086 4.29086 0 6.5 0H13.1683H13.5213C15.7186 0 17.4999 1.78128 17.4999 3.97859Z",fill:o?i:`url(#${r})`}),s&&n.jsx("path",{d:s,stroke:nn,strokeWidth:"0.7",strokeLinecap:"round",strokeLinejoin:"round"}),a&&n.jsx("path",{d:a,fill:nn}),!o&&n.jsx("defs",{children:n.jsxs("linearGradient",{id:r,x1:i.x1,y1:i.y1,x2:i.x2,y2:i.y2,gradientUnits:"userSpaceOnUse",children:[n.jsx("stop",{stopColor:i.from}),n.jsx("stop",{offset:"1",stopColor:i.to})]})})]})},Nd=({size:e})=>{const t=`dial-kit-folder-gradient-${h.useId().replace(/[^\w-]/g,"")}`;return n.jsxs("svg",{width:e,height:e,viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:[n.jsx("path",{d:"M6.38992 3.75H4.66663C3.00977 3.75 1.66663 5.09315 1.66663 6.75V7.91667H7.16339L10.8333 5.79247L7.85075 4.1297C7.40412 3.8807 6.90127 3.75 6.38992 3.75Z",fill:"var(--stroke-gradient-1, #5976E9)"}),n.jsx("path",{d:"M14.3333 5.41669C16.5424 5.41669 18.3333 7.20755 18.3333 9.41669V12.25C18.3333 14.4592 16.5424 16.25 14.3333 16.25H5.66663C3.45749 16.25 1.66663 14.4592 1.66663 12.25V7.6708C1.66663 7.11851 2.11434 6.6708 2.66663 6.6708H6.89447C7.43998 6.6708 7.97973 6.55922 8.48053 6.34291L9.86582 5.74458C10.3666 5.52827 10.9064 5.41669 11.4519 5.41669H14.3333Z",fill:`url(#${t})`}),n.jsx("defs",{children:n.jsxs("linearGradient",{id:t,x1:"17.0833",y1:"5.83335",x2:"9.38489",y2:"19.6653",gradientUnits:"userSpaceOnUse",children:[n.jsx("stop",{stopColor:"var(--stroke-secondary, #D1DBEA)"}),n.jsx("stop",{offset:"0.91",stopColor:"var(--stroke-gradient-1, #5976E9)"})]})})]})},jd=(e,t)=>(t??(e.includes(".")?e.split(".").pop():"")??"").trim().replace(/^\./,"").toLowerCase(),Td=(e,t)=>e===C.DialItemType.Folder?"Folder":t?`${t.toUpperCase()} file`:"File",wd=(e,t,r)=>e===C.DialItemType.Folder?n.jsx(Nd,{size:r}):n.jsx(Sd,{size:r,kind:yd(t)}),Ir=({type:e,name:t,fileExtension:r,shared:s=!1,loading:a=!1,size:i=z.DIAL_ICON_SIZE.MD,className:o,decorative:l=!1,label:c,loadingLabel:d="Loading",sharedIndicatorClassName:f,sharedIndicatorTooltip:p})=>{if(e!==C.DialItemType.File&&e!==C.DialItemType.Folder)return null;const g=e===C.DialItemType.File?jd(t,r):"",u=Td(e,g),m=c??(s?`${u}, shared`:u),v=l?{"aria-hidden":!0}:a?{}:{role:"img","aria-label":m};return n.jsxs("span",{className:I.mergeClasses("relative inline-flex shrink-0 items-center justify-center text-secondary",o,T.DIAL_KIT_CLASS.fileIcon),...v,children:[a?n.jsx(C.Spinner,{size:i,ariaLabel:d}):wd(e,g,i),s&&n.jsx(ns,{tooltip:p,className:I.mergeClasses("absolute -bottom-0.5 -left-0.5",f)})]})},ss=({name:e,type:t=C.DialItemType.File,fileExtension:r,shared:s=!1,loading:a=!1,loadingLabel:i,iconSize:o,details:l,isInvalidName:c=!1,className:d,nameClassName:f,sharedIndicatorClassName:p,sharedIndicatorTooltip:g,sharedLabel:u="Shared",hideTooltip:m=!1,tooltipContent:v})=>n.jsxs("div",{className:I.mergeClasses("flex w-full min-w-0 items-center gap-2",d,T.DIAL_KIT_CLASS.fileName),children:[n.jsx(Ir,{name:e,type:t,fileExtension:r,shared:s,loading:a,loadingLabel:i,size:o,sharedIndicatorClassName:p,sharedIndicatorTooltip:g,decorative:!a}),n.jsxs("div",{className:I.mergeClasses("flex min-w-0 flex-1",{"flex-col gap-1":!!l}),children:[n.jsx(R.EllipsisTooltip,{className:I.mergeClasses("dial-small-paragraph-text",c?"text-secondary":"text-primary",f),text:e,hideTooltip:m,customTooltipContent:v}),s&&n.jsx("span",{className:"sr-only",children:u}),l]})]}),Ed=({className:e,...t})=>n.jsx(ss,{...t,type:C.DialItemType.Folder,className:I.mergeClasses(e,T.DIAL_KIT_CLASS.folderName)}),Od=({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},Ad=4,_d=24,sn=e=>parseFloat(e)||0,Ld=e=>{let t=e.length;for(;t>0&&e[t-1]===",";)t--;return e.slice(0,t)},kd=()=>{},Rd=({id:e,value:t,defaultValue:r,size:s=E.ElementSize.Standard,labelProps:a,placeholder:i,caption:o,error:l,invalid:c,disabled:d=!1,readOnly:f=!1,collapseTagOverflow:p=!1,ariaLabel:g,tagListLabel:u="Tags",className:m,fieldClassName:v,tagClassName:x,onChange:b})=>{const y=h.useId(),N=e||y,w=s===E.ElementSize.Small,D=h.useRef(null),S=h.useRef([]),_=h.useRef(null),O=t!==void 0,[A,k]=h.useState(r??[]),j=O?t:A,M=j.length,[$,U]=h.useState(""),[J,G]=h.useState(M),B=!f&&!d,H=h.useCallback(W=>{O||k(W),b?.(W)},[O,b]),q=h.useCallback(W=>ee=>{S.current[W]=ee},[]),K=h.useCallback(()=>{const W=D.current;if(!W||W.clientWidth===0){G(j.length);return}const{paddingLeft:ee,paddingRight:Se}=getComputedStyle(W);G(Od({availableWidth:W.clientWidth-sn(ee)-sn(Se)-(f?0:_d),tagWidths:j.map((Be,he)=>S.current[he]?.offsetWidth??0),overflowChipWidth:_.current?.offsetWidth??0,gap:Ad}))},[f,j]);h.useEffect(()=>{if(!p){G(M);return}const W=D.current;if(!W)return;const ee=new ResizeObserver(()=>K());return ee.observe(W),K(),()=>ee.disconnect()},[p,K,M]);const se=I.mergeClasses(p?"shrink-0":"min-w-0",x),X=W=>{const ee=Ld(W.trim()).trim();!ee||j.includes(ee)||H([...j,ee])},Z=W=>{H(j.filter(ee=>ee!==W))},ae=()=>{X($),U("")},te=W=>{if(B){if(W.key==="Enter"||W.key===","){W.preventDefault(),ae();return}W.key==="Backspace"&&!$&&M>0&&(W.preventDefault(),H(j.slice(0,-1)))}},le=()=>{B&&$.trim()&&ae()},ue=p?j.slice(0,J):j,pe=p?j.slice(J):[],ge=pe.join(", "),fe=M>0&&n.jsxs("span",{role:"list","aria-label":u,className:I.mergeClasses("relative flex min-w-0 items-center gap-1",p?"flex-nowrap":"flex-wrap"),children:[ue.map(W=>n.jsx(Ge,{role:"listitem",label:W,className:se,disabled:d,closable:B,onRemove:B?()=>Z(W):void 0},W)),pe.length>0&&n.jsx(Ge,{role:"listitem",label:`+${pe.length}`,"aria-label":ge,title:ge,className:I.mergeClasses("shrink-0",x),disabled:d}),p&&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((W,ee)=>n.jsx("span",{ref:q(ee),className:"inline-flex",children:n.jsx(Ge,{label:W,className:x,disabled:d,closable:B,onRemove:B?kd:void 0})},W)),n.jsx("span",{ref:_,className:"inline-flex",children:n.jsx(Ge,{label:`+${M}`,className:x})})]})]});return n.jsx(We,{id:N,size:s,labelProps:a,caption:o,error:l,invalid:c,disabled:d,readOnly:f,value:$,placeholder:M>0?void 0:i,"aria-label":g,wrapperRef:D,onChange:W=>U(W??""),onKeyDown:te,onBlur:le,containerClassName:I.mergeClasses("w-full",m),wrapperClassName:I.mergeClasses(M>0&&["!h-auto",w?"min-h-[24px] py-0.5":"min-h-[40px] py-[3px]",p?"flex-nowrap overflow-hidden":"flex-wrap"],v,T.DIAL_KIT_CLASS.tagInput),className:I.mergeClasses("w-auto flex-1",p?"min-w-[24px]":"min-w-[100px]",f&&"cursor-default"),children:fe})},Md={[E.ElementSize.Small]:z.DIAL_ICON_SIZE.SM,[E.ElementSize.Standard]:z.DIAL_ICON_SIZE.MD,[E.ElementSize.Large]:z.DIAL_ICON_SIZE.MD},Pd=({size:e=E.ElementSize.Standard,placeholder:t="Search...",withoutBorder:r=!1,clearLabel:s="Clear search",disabled:a,value:i,onChange:o,wrapperClassName:l,inputRef:c,...d})=>{const f=h.useRef(null),p=de.useMergeRefs([c,f]),g=!!i&&!a,u=h.useCallback(()=>{o?.(void 0),f.current?.focus()},[o]);return n.jsx(We,{...d,size:e,value:i,disabled:a,onChange:o,placeholder:t,inputRef:p,wrapperClassName:I.mergeClasses(r&&"dial-kit-input-borderless",l,T.DIAL_KIT_CLASS.search),iconBefore:n.jsx(F.IconSearch,{size:Md[e],stroke:ne.DIAL_KIT_ICON_STROKE,className:"text-secondary","aria-hidden":"true"}),iconAfter:g?n.jsx(R.GhostIconButton,{size:E.ElementSize.Small,"aria-label":s,icon:n.jsx(F.IconX,{size:z.DIAL_ICON_SIZE.SM,stroke:ne.DIAL_KIT_ICON_STROKE,"aria-hidden":"true"}),onClick:u}):void 0})},Fd=16,Bd=e=>(e.toString().split(".")[1]??"").length,zd=({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:f,error:p,onChange:g,containerClassName:u,trackClassName:m,fillClassName:v,className:x,...b})=>{const y=h.useId(),N=e??y,w=f&&!p?`${N}-caption`:void 0,D=p?`${N}-error`:void 0,S=s-r,_=S>0?Math.min(100,Math.max(0,(t-r)/S*100)):0,O=`calc(${_}% + ${(.5-_/100)*Fd}px)`,A=c?c(t):t.toFixed(Bd(a)),k=h.useCallback(j=>{g?.(Number(j.target.value))},[g]);return n.jsxs("div",{className:I.mergeClasses("flex flex-col gap-2",u),children:[(o||d)&&n.jsxs("div",{className:"flex items-center gap-2",children:[o&&n.jsx(R.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:A})]}),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",v),style:{width:O}}),n.jsx("input",{...b,type:"range",id:N,value:t,min:r,max:s,step:a,disabled:i,onChange:k,"aria-label":E.resolveAccessibleName(typeof o?.label!="string"?b["aria-label"]:void 0),"aria-valuetext":c?A:void 0,"aria-describedby":D??w,className:I.mergeClasses("dial-kit-slider absolute inset-0 h-full w-full",x)})]}),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(Fe,{id:D,text:p}),!p&&n.jsx(Pe,{id:w,text:f})]})]})},$d=48,Hd=({children:e,title:t,width:r=280,collapsedWidth:s=$d,isOpened:a,defaultOpened:i=!0,onToggle:o,additionalButtons:l,ariaLabel:c="Sidebar",collapseLabel:d="Collapse sidebar",expandLabel:f="Expand sidebar",className:p,titleClassName:g,contentClassName:u,footerClassName:m})=>{const v=a!==void 0,[x,b]=h.useState(i),y=v?a:x,N=`collapsible-sidebar-content-${h.useId()}`,w=y?d:f,D=S=>{const _=!y;v||b(_),o?.(_,S)};return n.jsxs("aside",{"aria-label":c,style:{width:`${y?r:s}px`},className:I.mergeClasses("flex flex-col justify-between",p,T.DIAL_KIT_CLASS.collapsibleSidebar),children:[n.jsx("div",{id:N,hidden:!y,className:I.mergeClasses("min-h-0 flex-1 overflow-auto p-4",u),children:e}),n.jsx("div",{hidden:y,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",y?"justify-end px-2":"justify-center",m),children:[y&&l,n.jsx(R.IconButton,{variant:E.ButtonVariant.Primary,appearance:E.ButtonAppearance.Ghost,size:E.ElementSize.Standard,onClick:D,"aria-label":w,"aria-expanded":y,"aria-controls":N,tooltipProps:{tooltip:w},icon:y?n.jsx(F.IconChevronsLeft,{size:z.DIAL_ICON_SIZE.MD,stroke:ne.DIAL_KIT_ICON_STROKE,"aria-hidden":"true"}):n.jsx(F.IconChevronsRight,{size:z.DIAL_ICON_SIZE.MD,stroke:ne.DIAL_KIT_ICON_STROKE,"aria-hidden":"true"})})]})]})},Vd=({side:e,isResizing:t,width:r,minWidth:s,maxWidth:a,step:i,ariaLabel:o,onWidthChange:l,customHandler:c,handlerClassName:d})=>{const f=e===C.ResizableContainerSide.Left,p=f?F.IconChevronLeft:F.IconChevronRight,g=u=>{let m;switch(u.key){case"ArrowLeft":m=r+(f?i:-i);break;case"ArrowRight":m=r+(f?-i:i);break;case"Home":m=s;break;case"End":m=a;break;default:return}u.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(p,{size:z.DIAL_ICON_SIZE.MD,stroke:ne.DIAL_KIT_ICON_STROKE,"aria-hidden":"true",className:I.mergeClasses("pointer-events-none absolute top-1/2 -translate-y-1/2",f?"right-full":"left-full")})})},Kd=16,as=({children:e,minWidth:t,maxWidth:r,width:s,defaultWidth:a,onResizeStop:i,onResize:o,side:l=C.ResizableContainerSide.Right,keyboardStep:c=Kd,ariaLabel:d="Resize panel",className:f,resizeHandlerClassName:p,resizeHandler:g})=>{const[u,m]=h.useState(!1),[v,x]=h.useState(a??t),b=s!==void 0,y=b?s:v,N=h.useRef(null),w=h.useCallback(()=>{m(!0)},[]),D=h.useCallback(()=>{m(!1);const O=N.current?.resizable?.getBoundingClientRect(),A=O?Math.round(O.width):t;b||x(A),i?.(A)},[i,b,t]),S=h.useCallback(O=>{const A=Math.min(r,Math.max(t,O));A!==y&&(b||(x(A),N.current?.updateSize({width:A,height:"100%"})),o?.(A),i?.(A))},[r,t,y,b,o,i]),_=h.useMemo(()=>{const O=l===C.ResizableContainerSide.Left,A=n.jsx(Vd,{side:l,isResizing:u,width:y,minWidth:t,maxWidth:r,step:c,ariaLabel:d,onWidthChange:S,customHandler:g,handlerClassName:p});return{size:b?{width:y,height:"100%"}:void 0,defaultSize:b?void 0:{width:y,height:"100%"},minWidth:t,maxWidth:r,enable:{left:O,right:!O},handleClasses:{right:"group",left:"group"},handleStyles:{right:{right:"-8px",zIndex:10},left:{left:0,zIndex:10}},handleComponent:{left:O?A:void 0,right:O?void 0:A},onResizeStart:w,onResize:(k,j,M)=>{o?.(Math.round(M.offsetWidth))},onResizeStop:D}},[l,b,y,t,r,c,d,S,g,p,u,w,D,o]);return n.jsx(C.Resizable,{ref:N,..._,children:n.jsx("div",{className:I.mergeClasses("group flex size-full flex-col bg-layer-raised transition-all motion-reduce:transition-none",f,T.DIAL_KIT_CLASS.resizableContainer),children:e})})},Gd=({enabled:e=!0,children:t,...r})=>e?n.jsx(as,{...r,children:t}):t;var je=(e=>(e.InProgress="inProgress",e.Success="success",e.Warning="warning",e.Failed="failed",e.Canceled="canceled",e))(je||{});const is=8e3,ut="flex size-7 shrink-0 items-center justify-center",os={cancelItemAriaLabel:e=>`Cancel "${e}"`,itemProgressAriaLabel:e=>`"${e}" in progress`,successLabel:"Completed",canceledLabel:"Canceled",failedMessage:"Failed",warningMessage:"Completed with warnings",queueProgressAriaLabel:"Progress",queueProgressValueText:(e,t)=>`${e} of ${t}`,collapseAriaLabel:"Collapse",expandAriaLabel:"Expand",closeAriaLabel:"Close",closeConfirmHeader:"Close?",closeConfirmDescriptionInProgress:"Some items are still in progress.",closeConfirmDescriptionFailed:"Some items have failed.",closeConfirmDescriptionMixed:"Some items are still in progress, and some have failed.",closeConfirmLabel:"Close",closeCancelLabel:"Cancel"},Ud=({title:e,failedCount:t,isCollapsed:r,itemsId:s,labels:a,onToggleCollapse:i,onClose:o})=>{const l=r?F.IconChevronUp:F.IconChevronDown;return n.jsxs("div",{className:"mx-4 flex items-center justify-between border-b border-tertiary py-3",children:[n.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[n.jsx("span",{className:"dial-small-paragraph-semi-text truncate text-primary",children:e}),t>0&&n.jsx("span",{className:"dial-small-paragraph-semi-text inline-flex h-4 min-w-4 shrink-0 items-center justify-center rounded-full bg-control-error px-1 text-control-permanent",children:t})]}),n.jsxs("div",{className:"flex shrink-0 items-center gap-1",children:[n.jsx(R.GhostIconButton,{"aria-label":r?a.expandAriaLabel:a.collapseAriaLabel,"aria-expanded":!r,"aria-controls":s,size:E.ElementSize.Small,icon:n.jsx(l,{size:z.DIAL_ICON_SIZE.SM,stroke:ne.DIAL_KIT_ICON_STROKE,className:"text-secondary","aria-hidden":!0}),onClick:i,className:ut}),n.jsx(R.GhostIconButton,{"aria-label":a.closeAriaLabel,size:E.ElementSize.Small,icon:n.jsx(F.IconX,{size:z.DIAL_ICON_SIZE.SM,stroke:ne.DIAL_KIT_ICON_STROKE,className:"text-secondary","aria-hidden":!0}),onClick:o,className:ut})]})]})},an=({message:e,isError:t})=>{const r=t?F.IconAlertCircleFilled:F.IconAlertTriangleFilled;return n.jsx(R.Tooltip,{tooltip:e,asChild:!0,children:n.jsx("span",{className:ut,role:"img","aria-label":e,tabIndex:0,children:n.jsx(r,{size:z.DIAL_ICON_SIZE.SM,className:t?"text-error":"text-warning-icon","aria-hidden":!0})})})},Zd=({item:e,labels:t,onCancel:r})=>{const s=e.status===je.Canceled;return n.jsxs("div",{className:"group flex items-center gap-2 px-4 py-2",children:[n.jsx(Ir,{type:C.DialItemType.File,name:e.name,size:z.DIAL_ICON_SIZE.MD,className:I.mergeClasses(s&&"opacity-50"),decorative:!0}),n.jsx(R.EllipsisTooltip,{text:e.name,className:I.mergeClasses("dial-small-text",s?"text-secondary":"text-primary")}),e.status===je.InProgress&&n.jsxs("div",{className:I.mergeClasses(ut,"grid"),children:[n.jsx(C.Spinner,{size:z.DIAL_ICON_SIZE.SM,ariaLabel:t.itemProgressAriaLabel(e.name),className:I.mergeClasses("pointer-events-none col-start-1 row-start-1 transition-opacity",r&&"group-focus-within:opacity-0 group-hover:opacity-0")}),r&&n.jsx(R.GhostIconButton,{"aria-label":t.cancelItemAriaLabel(e.name),size:E.ElementSize.Small,icon:n.jsx(F.IconX,{size:z.DIAL_ICON_SIZE.SM,stroke:ne.DIAL_KIT_ICON_STROKE,className:"text-secondary","aria-hidden":!0}),onClick:()=>r(e.id),className:"col-start-1 row-start-1 opacity-0 transition-opacity group-focus-within:opacity-100 group-hover:opacity-100"})]}),e.status===je.Success&&n.jsx("span",{className:ut,role:"img","aria-label":t.successLabel,children:n.jsx(F.IconCheck,{size:z.DIAL_ICON_SIZE.SM,stroke:ne.DIAL_KIT_ICON_STROKE,className:"text-accent","aria-hidden":!0})}),e.status===je.Warning&&n.jsx(an,{message:e.message||t.warningMessage,isError:!1}),e.status===je.Failed&&n.jsx(an,{message:e.message||t.failedMessage,isError:!0}),s&&n.jsx("span",{className:"dial-small-text shrink-0 text-secondary",children:t.canceledLabel})]})},Wd=e=>Math.round(e.reduce((t,r)=>t+(r.percent??(r.status===je.InProgress?0:100)),0)/e.length),qd=(e,t,r)=>e&&t?r.closeConfirmDescriptionMixed:t?r.closeConfirmDescriptionFailed:r.closeConfirmDescriptionInProgress,Yd=({title:e,items:t,onClose:r,onCancelItem:s,labels:a,autoCloseDelay:i=is,className:o,bodyClassName:l})=>{const[c,d]=h.useState(!1),[f,p]=h.useState(!1),g=h.useId(),u={...os,...a},m=t.filter(S=>S.status===je.InProgress).length,v=m>0,x=t.filter(S=>S.status===je.Failed).length,b=x>0,y=t.length>0&&t.every(S=>S.status===je.Success),N=h.useCallback(()=>{v||b?p(!0):r()},[v,b,r]),w=h.useCallback(()=>{p(!1),r()},[r]),D=h.useCallback(()=>{d(S=>!S)},[]);return h.useEffect(()=>{if(!y||i<=0)return;const S=setTimeout(r,i);return()=>clearTimeout(S)},[y,i,r]),t.length===0?null:n.jsxs("div",{role:"status","aria-live":"polite",className:I.mergeClasses("w-[370px] max-w-[calc(100vw-2rem)] rounded-xl bg-layer-raised shadow-md",o,T.DIAL_KIT_CLASS.transferQueue),children:[n.jsx(Ud,{title:e,failedCount:x,isCollapsed:c,itemsId:g,labels:u,onToggleCollapse:D,onClose:N}),c&&v&&n.jsx(dn,{value:Wd(t),size:E.ElementSize.Small,"aria-label":u.queueProgressAriaLabel,"aria-valuetext":u.queueProgressValueText(t.length-m,t.length)}),!c&&n.jsx("div",{id:g,className:I.mergeClasses("flex max-h-[40vh] flex-col overflow-y-auto py-1",l),children:t.map(S=>n.jsx(Zd,{item:S,labels:u,onCancel:s},S.id))}),n.jsx(ts,{open:f,header:u.closeConfirmHeader,description:qd(v,b,u),confirmLabel:u.closeConfirmLabel,cancelLabel:u.closeCancelLabel,variant:C.ConfirmationPopupVariant.Danger,onConfirm:w,onClose:()=>p(!1)})]})};exports.ConfirmationPopupVariant=C.ConfirmationPopupVariant;exports.DialBreadcrumb=C.DialBreadcrumb;exports.DialBreadcrumbItem=C.DialBreadcrumbItem;exports.DialButton=C.DialButton;exports.DialButtonDropdown=C.DialButtonDropdown;exports.DialCaptionText=C.DialCaptionText;exports.DialCollapsibleSidebar=C.DialCollapsibleSidebar;exports.DialConditionalResizableContainer=C.DialConditionalResizableContainer;exports.DialConfirmationPopup=C.DialConfirmationPopup;exports.DialDangerButton=C.DialDangerButton;exports.DialDestinationFolderPopup=C.DialDestinationFolderPopup;exports.DialErrorText=C.DialErrorText;exports.DialFileIcon=C.DialFileIcon;exports.DialFileManager=C.DialFileManager;exports.DialFileManagerActions=C.DialFileManagerActions;exports.DialFileManagerTabs=C.DialFileManagerTabs;exports.DialFileName=C.DialFileName;exports.DialFileNodeType=C.DialFileNodeType;exports.DialFilePermission=C.DialFilePermission;exports.DialFileResourceType=C.DialFileResourceType;exports.DialFolderName=C.DialFolderName;exports.DialFoldersTree=C.DialFoldersTree;exports.DialFormItem=C.DialFormItem;exports.DialGhostButton=C.DialGhostButton;exports.DialInput=C.DialInput;exports.DialItemType=C.DialItemType;exports.DialLinkButton=C.DialLinkButton;exports.DialLoader=C.DialLoader;exports.DialNeutralButton=C.DialNeutralButton;exports.DialNotification=C.DialNotification;exports.DialPopup=C.DialPopup;exports.DialPrimaryButton=C.DialPrimaryButton;exports.DialRadioGroup=C.DialRadioGroup;exports.DialResizableContainer=C.DialResizableContainer;exports.DialSearch=C.DialSearch;exports.DialSharedEntityIndicator=C.DialSharedEntityIndicator;exports.DialTabs=C.DialTabs;exports.EDITABLE_CONTAINER_ATTRIBUTE=C.EDITABLE_CONTAINER_ATTRIBUTE;exports.FileManagerColumnKey=C.FileManagerColumnKey;exports.FileManagerProvider=C.FileManagerProvider;exports.FlexibleActionsDirection=C.FlexibleActionsDirection;exports.FormItemOrientation=C.FormItemOrientation;exports.NAME_COLUMN=C.NAME_COLUMN;exports.NOT_ALLOWED_SPACES=C.NOT_ALLOWED_SPACES;exports.NOT_ALLOWED_SPACES_REGEXP=C.NOT_ALLOWED_SPACES_REGEXP;exports.NOT_ALLOWED_SYMBOLS=C.NOT_ALLOWED_SYMBOLS;exports.NOT_ALLOWED_SYMBOLS_REGEXP=C.NOT_ALLOWED_SYMBOLS_REGEXP;exports.NotificationType=C.NotificationType;exports.NotificationVariant=C.NotificationVariant;exports.PopupSize=C.PopupSize;exports.RadioGroupOrientation=C.RadioGroupOrientation;exports.ResizableContainerSide=C.ResizableContainerSide;exports.SIZE_COLUMN=C.SIZE_COLUMN;exports.ScreenResolution=C.ScreenResolution;exports.Skeleton=C.Skeleton;exports.SkeletonAvatarShape=C.SkeletonAvatarShape;exports.SkeletonAvatarSize=C.SkeletonAvatarSize;exports.SkeletonVariant=C.SkeletonVariant;exports.Spinner=C.Spinner;exports.TabOrientation=C.TabOrientation;exports.TabView=C.TabView;exports.UPDATED_AT_COLUMN=C.UPDATED_AT_COLUMN;exports.editableContainerProps=C.editableContainerProps;exports.useDialFileManagerTabs=C.useDialFileManagerTabs;exports.useEditableItem=C.useEditableItem;exports.useFileManagerContext=C.useFileManagerContext;exports.DialLabel=ke.DialLabel;exports.DialSwitch=ke.DialSwitch;exports.DEFAULT_GRID_DATE_FORMAT_OPTIONS=T.DEFAULT_DATE_FORMAT_OPTIONS;exports.DEFAULT_GRID_DATE_LOCALE=T.DEFAULT_LOCALE;exports.DIAL_KIT_CLASS=T.DIAL_KIT_CLASS;exports.DialCloseButton=T.DialCloseButton;exports.DialDangerIconButton=T.DialDangerIconButton;exports.DialDateCellRenderer=T.DialDateCellRenderer;exports.DialDropdown=T.DialDropdown;exports.DialEllipsisTooltip=T.DialEllipsisTooltip;exports.DialGhostIconButton=T.DialGhostIconButton;exports.DialGrid=T.DialGrid;exports.DialIcon=T.DialIcon;exports.DialNeutralIconButton=T.DialNeutralIconButton;exports.DialNoDataContent=T.DialNoDataContent;exports.DialPrimaryIconButton=T.DialPrimaryIconButton;exports.DialRadioButton=T.DialRadioButton;exports.DialSecondaryIconButton=T.DialSecondaryIconButton;exports.DialSuccessIconButton=T.DialSuccessIconButton;exports.DialTertiaryIconButton=T.DialTertiaryIconButton;exports.DropdownItemType=T.DropdownItemType;exports.DropdownTrigger=T.DropdownTrigger;exports.DropdownType=T.DropdownType;exports.GridSelectionMode=T.GridSelectionMode;exports.ThemeScope=T.ThemeScope;exports.baseColumnComparator=T.baseColumnComparator;exports.checkColDefsChanges=T.checkColDefsChanges;exports.convertGridDateToDate=T.convertToDate;exports.convertToDate=T.convertToDate;exports.useThemeScope=T.useThemeScope;exports.BASE_ICON_PROPS=z.BASE_ICON_PROPS;exports.BASE_ICON_SIZE=z.BASE_ICON_SIZE;exports.DIAL_ICON_SIZE=z.DIAL_ICON_SIZE;exports.mergeClasses=I.mergeClasses;exports.Checkbox=R.Checkbox;exports.CheckboxBox=R.CheckboxBox;exports.CloseButton=R.CloseButton;exports.DEFAULT_DATE_FORMAT_OPTIONS=R.DEFAULT_DATE_FORMAT_OPTIONS;exports.DEFAULT_DATE_LOCALE=R.DEFAULT_LOCALE;exports.DangerIconButton=R.DangerIconButton;exports.DateCellRenderer=R.DateCellRenderer;exports.Dropdown=R.Dropdown;exports.EllipsisTooltip=R.EllipsisTooltip;exports.GRID_ALIGN_RIGHT_CLASS=R.GRID_ALIGN_RIGHT_CLASS;exports.GRID_ROOT_CLASS=R.GRID_ROOT_CLASS;exports.GRID_ROW_HEIGHT=R.ROW_HEIGHT;exports.GRID_SELECTION_COLUMN_ID=R.GRID_SELECTION_COLUMN_ID;exports.GRID_THEME_PARAMS=R.GRID_THEME_PARAMS;exports.GhostIconButton=R.GhostIconButton;exports.Grid=R.Grid;exports.IconButton=R.IconButton;exports.InfoButton=R.InfoButton;exports.InteractiveTooltip=R.InteractiveTooltip;exports.Label=R.Label;exports.MenuItem=R.MenuItem;exports.MenuItemMark=R.MenuItemMark;exports.NeutralIconButton=R.NeutralIconButton;exports.NoDataContent=R.NoDataContent;exports.PrimaryIconButton=R.PrimaryIconButton;exports.Radio=R.Radio;exports.StaticIconButton=R.StaticIconButton;exports.Tooltip=R.Tooltip;exports.TooltipContainer=R.TooltipContainer;exports.TooltipContent=R.TooltipContent;exports.TooltipPlacement=R.TooltipPlacement;exports.TooltipTrigger=R.TooltipTrigger;exports.ButtonAppearance=E.ButtonAppearance;exports.ButtonVariant=E.ButtonVariant;exports.DialIconButton=E.DialIconButton;exports.DialTooltip=E.DialTooltip;exports.DialTooltipContainer=E.DialTooltipContainer;exports.DialTooltipContent=E.DialTooltipContent;exports.DialTooltipTrigger=E.DialTooltipTrigger;exports.ElementSize=E.ElementSize;exports.EditorThemes=ft.EditorThemes;exports.LazyDialJsonEditor=ft.LazyDialJsonEditor;exports.LazyDialMarkdownEditor=ft.LazyDialMarkdownEditor;exports.LazyMarkdownEditor=ft.LazyMarkdownEditor;exports.DIAL_KIT_ICON_STROKE=ne.DIAL_KIT_ICON_STROKE;exports.Accordion=$c;exports.AccordionCaretPosition=Nt;exports.AnalyticsCardVariant=lt;exports.Breadcrumbs=Vl;exports.BreadcrumbsSize=Ze;exports.Button=Xe;exports.ButtonDropdown=Xl;exports.Calendar=El;exports.CalendarMode=be;exports.CaptionText=Pe;exports.CardShell=tl;exports.CollapsibleSidebar=Hd;exports.ConditionalResizableContainer=Gd;exports.ConfirmationPopup=ts;exports.DEFAULT_ANALYTICS_BAR_COLOR_MAP=or;exports.DEFAULT_TRANSFER_QUEUE_LABELS=os;exports.DangerButton=Kl;exports.DialAccordion=on;exports.DialAnalyticsBar=xt;exports.DialAnalyticsBarGroup=Cs;exports.DialAnalyticsCard=ms;exports.DialAnalyticsErrorTag=ir;exports.DialAnalyticsHistogram=Ss;exports.DialAutocompleteInputValue=In;exports.DialCheckbox=Xt;exports.DialDraggableItem=Pi;exports.DialDropdownIcon=wo;exports.DialFormPopup=Yi;exports.DialInputPopup=Sn;exports.DialLabelledText=Rs;exports.DialLoadFileArea=Ln;exports.DialLoadFileAreaField=To;exports.DialNumberInput=rr;exports.DialPagination=Es;exports.DialPasswordInput=Nn;exports.DialRadioGroupPopupField=Ui;exports.DialRemoveButton=At;exports.DialSchemaRenderer=Wo;exports.DialSegmentedControl=Ki;exports.DialSelect=Te;exports.DialSelectField=lo;exports.DialSlider=ks;exports.DialSteps=Ls;exports.DialTag=Ke;exports.DialTagInput=Dn;exports.DialTextarea=Fi;exports.ErrorMessageNotification=ll;exports.ErrorText=Fe;exports.ErrorToastNotification=rl;exports.FabButton=ql;exports.FileDropzone=bd;exports.FileIcon=Ir;exports.FileName=ss;exports.FilterChips=xd;exports.FolderName=Ed;exports.FolderPath=Ol;exports.GeneralMessageNotification=pl;exports.GeneralToastNotification=ol;exports.GhostButton=Zl;exports.Highlight=el;exports.InfoMessageNotification=cl;exports.InfoToastNotification=nl;exports.InlineSelect=Ql;exports.InlineSelectTrigger=qn;exports.Input=We;exports.JsonSchemaType=V;exports.LinkButton=Ul;exports.LoadingMessageNotification=fl;exports.LoadingToastNotification=il;exports.MultiSelectTags=Jn;exports.NeutralButton=yr;exports.Notification=br;exports.NumberInput=Tc;exports.OutlinedButton=Wl;exports.PasswordInput=Ic;exports.Popup=Dr;exports.PrimaryButton=Wn;exports.ProgressBar=dn;exports.RadioGroup=rs;exports.RadioGroupPopupField=td;exports.ResizableContainer=as;exports.SchemaDisplayMode=ct;exports.SchemaOrientation=Lt;exports.SchemaRendererVariant=tt;exports.Search=Pd;exports.SegmentedControl=fd;exports.Select=vc;exports.SelectSize=yt;exports.SelectVariant=Dt;exports.SharedEntityIndicator=ns;exports.Slider=zd;exports.StarterButton=Gl;exports.StepStatus=Ce;exports.SuccessMessageNotification=dl;exports.SuccessToastNotification=sl;exports.Switch=Hc;exports.TRANSFER_QUEUE_AUTO_CLOSE_DELAY_MS=is;exports.Tabs=gd;exports.Tag=Ge;exports.TagAppearance=qe;exports.TagInput=Rd;exports.Textarea=Dc;exports.TextareaResize=es;exports.ToggleIconButton=rd;exports.TransferQueue=Yd;exports.TransferQueueItemStatus=je;exports.WarningMessageNotification=ul;exports.WarningToastNotification=al;exports.getTimezoneLabel=kn;exports.matchesAccept=ar;exports.wrapInRootFolder=ko;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const C=require("./use-file-manager-tabs-BJP7po3N.cjs"),Re=require("./Switch-DE6MrcqJ.cjs"),n=require("react/jsx-runtime"),h=require("react"),F=require("@tabler/icons-react"),le=require("classnames"),j=require("./DateCellRenderer-DB9p0E9c.cjs"),B=require("./icon-CrGVkVpG.cjs"),y=require("./merge-classes-BEJXjzkx.cjs"),R=require("./DateCellRenderer-DABG5c2F.cjs"),E=require("./IconButton-DHOFapLo.cjs"),Cs=require("react-dom"),ht=require("./lazy-BEsZqouS.cjs"),te=require("@floating-ui/react"),re=require("./icon-DhjrDQ8I.cjs");function vs(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 Tr=vs(h),Ue=({label:e,className:t,icon:r,selected:s,closable:a,onClick:i,onRemove:o})=>{const l=y.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(j.DialIcon,{icon:r}),n.jsx(j.DialEllipsisTooltip,{text:e}),a&&o&&n.jsx(C.DialButton,{className:"p-0",iconAfter:n.jsx(F.IconX,{size:B.DIAL_ICON_SIZE.SM}),onClick:c=>o(c)})]},e)},cr=({label:e="Error",className:t})=>n.jsx(Ue,{label:e,className:y.mergeClasses("dial-tiny-semi-text cursor-default rounded-[120px] border-transparent bg-error text-error",t)});var dt=(e=>(e.Default="default",e.Compact="compact",e))(dt||{});const ys={[dt.Default]:{container:"bg-layer-3",title:"dial-small-text text-secondary",value:"dial-display2-text text-primary",showDescription:!0},[dt.Compact]:{container:"bg-layer-2",title:"dial-tiny-text text-secondary",value:"dial-body-semi-text text-primary",showDescription:!1}},Is=({title:e,value:t,description:r,variant:s=dt.Default,error:a,isLoading:i,className:o,delta:l,deltaPositive:c,deltaUnit:d,compareValues:f})=>{const p=ys[s],g=c!==void 0?c:(l??0)>=0,u=l===void 0?null:`${l>=0?`+${l}`:String(l)}${d??""}`;return n.jsxs("div",{className:y.mergeClasses("flex flex-col rounded-lg border border-secondary p-4",a||i?"gap-2":"gap-1",p.container,o),children:[l!==void 0?n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("span",{className:p.title,children:e}),n.jsx("span",{className:y.mergeClasses("dial-tiny-semi-text rounded-[120px] border border-transparent px-2",g?"bg-success text-success":"bg-error text-error"),children:u})]}):n.jsx("span",{className:p.title,children:e}),a?n.jsx(cr,{className:"self-start"}):i?n.jsx(C.DialLoader,{fullWidth:!1,className:"self-start"}):f?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(j.DialEllipsisTooltip,{text:f[0].title,className:"dial-tiny-text text-secondary"}),n.jsx("span",{className:p.value,children:f[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(j.DialEllipsisTooltip,{text:f[1].title,className:"dial-tiny-text text-secondary"}),n.jsx("span",{className:p.value,children:f[1].value})]})]}):n.jsx("span",{className:p.value,children:t}),!a&&!i&&p.showDescription&&r!=null&&r!==!1&&n.jsx("span",{className:"dial-tiny-text text-secondary",children:r})]})},dr=[{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"}],Ds=(e,t)=>t<=0?0:Math.min(Math.max(e/t,0),1),Ss=(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},vt=({value:e,maxValue:t=1,error:r,isLoading:s,title:a,valueLabel:i,colorMap:o=dr,className:l,titleClassName:c,valueClassName:d,inline:f,ariaLabel:p})=>{const g=e==null,u=!!(r||s||!g),m=Ds(g?0:e,t),v=Ss(m,o),x=i??(g?"—":e),b=p??(typeof a=="string"?a:void 0),I=r||s,N=r?n.jsx(cr,{}):s?n.jsx(C.DialLoader,{fullWidth:!1}):n.jsx("span",{className:y.mergeClasses("shrink-0 tabular-nums text-end",f?"dial-small-text min-w-[5ch] text-primary":"dial-small-semi-text text-primary",d),children:x}),w=u?n.jsx("div",{role:"progressbar","aria-valuenow":r||s||typeof e!="number"?void 0:e,"aria-valuemin":0,"aria-valuemax":t,"aria-label":b,className:y.mergeClasses("w-full overflow-hidden rounded-sm",f?"h-1":"h-2",r?"bg-error":"bg-layer-1"),children:!I&&n.jsx("div",{className:"h-full rounded-sm transition-[width] duration-300",style:{width:`${m*100}%`,backgroundColor:v}})}):null,D=n.jsx("span",{className:y.mergeClasses("dial-small-text text-primary",c),children:a});return f?n.jsxs("div",{className:y.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:w}),N]})]}):n.jsxs("div",{className:y.mergeClasses("flex flex-col gap-1",l),children:[n.jsxs("div",{className:"flex flex-row items-center justify-between gap-2",children:[D,N]}),w]})},fn=({title:e,description:t,children:r,expanded:s,defaultExpanded:a=!1,disabled:i,nonCollapsible:o,onToggle:l,className:c,headerClassName:d,contentClassName:f})=>{const p=s!==void 0,[g,u]=h.useState(a),m=o?!0:p?s:g,v=h.useId(),x=()=>{if(i)return;const b=!m;p||u(b),l?.(b)};return n.jsxs("div",{className:y.mergeClasses("rounded border border-secondary",c),children:[n.jsxs("button",{type:"button","aria-expanded":m,"aria-controls":v,disabled:i||o,onClick:x,className:y.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(j.DialIcon,{className:le("text-secondary transition-transform",m&&"rotate-90"),icon:n.jsx(F.IconChevronRight,{size:B.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:v,role:"region",className:y.mergeClasses("px-4 pb-4",f),children:r})]})},Ns=({title:e,titleTooltip:t,description:r,data:s,compareData:a,compareLabels:i,maxValue:o,colorMap:l,defaultExpanded:c=!0,nonCollapsible:d,isLoading:f,onBarClick:p,inline:g,barTitleClassName:u,barValueClassName:m,barClassName:v,barDescriptions:x,className:b})=>{const I=Object.entries(s),N=g?y.mergeClasses("text-secondary",u):u,w=i?"dial-tiny-text text-secondary":void 0,D=t?n.jsx(E.DialTooltip,{tooltip:t,children:e}):e,S=a?[...new Set([...Object.keys(s),...Object.keys(a)])]:[],_="cursor-pointer rounded-sm text-left focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent-primary",O="group flex flex-col gap-1.5",A=y.mergeClasses("flex flex-col gap-1.5 pl-2",p&&"group-hover:bg-accent-primary-alpha group-focus-visible:bg-accent-primary-alpha",v);return n.jsx(fn,{title:D,description:r,defaultExpanded:c,nonCollapsible:d,className:b,children:n.jsx("div",{className:y.mergeClasses("flex flex-col",a?"gap-4":g?"gap-2":"gap-3"),children:f?n.jsx(C.DialLoader,{fullWidth:!1,className:"self-center"}):a?S.map(k=>{const T=k in s?s[k]:null,M=k in a?a[k]:null,G=typeof T=="number"&&typeof M=="number"?parseFloat((M-T).toFixed(3)):null,J=G!=null&&G!==0,U=J&&G>0,$=J?U?`+${G}`:String(G):null,H=x?.[k],q=n.jsx("span",{className:"dial-small-text text-secondary",children:k}),K=n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"flex items-center gap-2",children:[H?n.jsx(E.DialTooltip,{tooltip:H,children:q}):q,$!=null&&n.jsx("span",{className:y.mergeClasses("dial-tiny-semi-text rounded-[120px] border border-transparent px-2",U?"bg-success text-success":"bg-error text-error"),children:$})]}),n.jsxs("div",{className:A,children:[n.jsx(vt,{title:i?.[0],value:T,maxValue:o,colorMap:l,inline:g,titleClassName:w,ariaLabel:k}),n.jsx(vt,{title:i?.[1],value:M,maxValue:o,colorMap:l,inline:g,titleClassName:w,ariaLabel:`${k} compare`})]})]});return p?n.jsx("button",{type:"button",onClick:()=>p(k,T),className:y.mergeClasses(O,_),children:K},k):n.jsx("div",{className:O,children:K},k)}):I.map(([k,T])=>{const M=n.jsx(vt,{title:k,value:T,maxValue:o,colorMap:l,inline:g,titleClassName:N,valueClassName:m,className:v}),z=p?n.jsx("button",{type:"button",onClick:()=>p(k,T),className:_,children:M}):M,G=x?.[k];return G?n.jsx(E.DialTooltip,{tooltip:G,triggerClassName:"flex flex-col",children:z},k):n.jsx(h.Fragment,{children:z},k)})})})},js="#FF4E50",Ts=(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},wr=(e,t)=>{const r=t.map(()=>0);let s=0;e.forEach(c=>{if(c<=0){s+=1;return}const d=Ts(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:js,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]},pn=e=>e<=0?2:e%2===0?e:e+1,ws=e=>{const t=pn(e);return[t,t/2,0]},zt=e=>`${Math.round(e*100)/100}`,gn=(e,t)=>e===t?zt(e):`${zt(e)}-${zt(t)}`,$t=128,Es=(e,t)=>{const r=gn(e,t);return e===t?`scored ${r}`:`scored between ${r}`},Er=(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:Es(a.from,a.to)})]}),Os=({title:e,values:t,colorMap:r=dr,valueTitle:s="values",showCount:a,isLoading:i,className:o,compareValues:l,valueSetLabel:c,compareValueSetLabel:d})=>{const f=wr(t,r),p=l?wr(l,r):void 0,g=t.length,u=l?.length??0,m=Math.max(g,u),v=pn(m),x=ws(m),b=D=>D.map(S=>({...S,ratio:v>0?S.count/v:0})),I=b(f),N=p?b(p):void 0,w=(D,S,_,O)=>{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 A=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(E.DialTooltip,{placement:"bottom",tooltip:S,triggerClassName:"flex h-full flex-1 items-end",children:n.jsx("div",{role:"img","aria-label":_,className:"flex min-h-2 w-full items-center justify-center rounded-sm border border-transparent",style:{height:`${D.ratio*100}%`,...A},children:a&&n.jsx("span",{className:"dial-tiny-semi-text text-primary",children:D.count})})})};return n.jsxs("div",{className:y.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:$t},children:n.jsx(C.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:$t},children:x.map((D,S)=>n.jsx("span",{className:"dial-tiny-text absolute right-0 whitespace-nowrap text-secondary",style:{top:`${S/(x.length-1)*100}%`,transform:"translateY(-50%)"},children:D},D))}),n.jsxs("div",{className:"relative min-w-0",children:[x.map((D,S)=>n.jsx("div",{"data-histogram-grid":!0,className:"pointer-events-none absolute inset-x-0 border-t border-primary",style:{top:`${S/(x.length-1)*100}%`}},D)),n.jsx("div",{className:"relative flex items-end gap-1",style:{height:$t},children:N?I.map((D,S)=>{const _=N[S],O=`${D.count} out of ${g} ${s}`,A=`${_.count} out of ${u} ${s}`;return n.jsxs("div",{className:"flex h-full flex-1 items-end",children:[w(D,Er(c,D.count,g,s,D),O,!0),w(_,Er(d,_.count,u,s,_),A,!1)]},S)}):I.map((D,S)=>{const _=`${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}%`}})},S):n.jsx(E.DialTooltip,{placement:"bottom",tooltip:_,triggerClassName:"flex h-full flex-1 items-end",children:n.jsx("div",{role:"img","aria-label":_,className:y.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})})},S)})})]}),n.jsx("div",{}),n.jsx("div",{"data-histogram-x-axis":!0,className:"flex gap-1",children:I.map((D,S)=>n.jsx("span",{className:"dial-caption-text flex-1 text-center text-secondary",children:gn(D.from,D.to)},S))})]})]})},hn=({value:e,max:t=100,size:r=E.ElementSize.Standard,labelProps:s,valueLabel:a,id:i,className:o,"aria-label":l,...c})=>{const d=h.useId(),f=i??d,p=!!s?.label,g=p?s?.id??`${f}-label`:void 0,u=t>0?t:0,m=Number.isFinite(e)?e:0,v=Math.min(Math.max(m,0),u),x=u>0?v/u*100:0,b=n.jsx("div",{...c,id:f,role:"progressbar","aria-valuenow":v,"aria-valuemin":0,"aria-valuemax":u,"aria-labelledby":g,"aria-label":E.resolveAccessibleName(l,p?void 0:"Progress"),className:y.mergeClasses("w-full overflow-hidden rounded-full bg-control-disable-primary",r===E.ElementSize.Small?"h-1":"h-2",o,!p&&!a&&j.DIAL_KIT_CLASS.progressBar),children:n.jsx("div",{style:{width:`${x}%`},className:"h-full rounded-full bg-control-accent transition-[width] duration-300 motion-reduce:transition-none"})});return!p&&!a?b:n.jsxs("div",{className:y.mergeClasses("flex w-full flex-col gap-1",j.DIAL_KIT_CLASS.progressBar),children:[n.jsxs("div",{className:"flex items-baseline gap-2",children:[s&&n.jsx(R.Label,{...s,id:g}),a&&n.jsx("span",{className:"dial-tiny-text text-secondary ml-auto shrink-0",children:a})]}),b]})},As=7,_s=2,Ls=e=>e<=0?[]:Array.from({length:e},(t,r)=>r+1);var yt=(e=>(e.Active="active",e.Adjacent="adjacent",e.Far="far",e))(yt||{});const ks=(e,t,r)=>e===t?"active":r<As||Math.abs(e-t)<=_s?"adjacent":"far",Rs=({page:e,totalPages:t,onPageChange:r,className:s})=>{const a=Ls(t);return n.jsxs("nav",{"aria-label":"Pagination",className:y.mergeClasses("flex items-center gap-2",s),children:[n.jsx(E.DialIconButton,{icon:n.jsx(F.IconCaretLeftFilled,{size:B.DIAL_ICON_SIZE.SM,className:"text-secondary"}),size:E.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=ks(i,e,t);return n.jsx("button",{type:"button",onClick:()=>r(i),"aria-label":`Page ${i}`,"aria-current":i===e?"page":void 0,className:y.mergeClasses("dial-pagination-dot rounded-full focus-visible:outline outline-offset-0 transition-all duration-300 ease-in-out",o===yt.Active&&"h-[8px] w-[32px]",o===yt.Adjacent&&"size-[8px]",o===yt.Far&&"size-[4px]")},i)})}),n.jsx(E.DialIconButton,{icon:n.jsx(F.IconCaretRightFilled,{size:B.DIAL_ICON_SIZE.SM,className:"text-secondary"}),size:E.ElementSize.Small,className:"!p-0 items-center flex justify-center",disabled:e>=t,onClick:()=>r(e+1),"aria-label":"Next page"})]})},er=({label:e,id:t,checked:r,indeterminate:s,disabled:a,ariaLabel:i,onChange:o,className:l,...c})=>{const d=h.useCallback(u=>{o?.(u.target.checked,t)},[o,t]),f=le("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),p=le("border rounded",a?"bg-layer-4 border-icon-secondary":""),g=()=>s?n.jsx(F.IconMinus,{className:p,...B.BASE_ICON_PROPS}):r?n.jsx(F.IconCheck,{className:p,...B.BASE_ICON_PROPS}):null;return n.jsxs("label",{...c,className:f,htmlFor:t,"aria-description":c["aria-description"]||j.ariaDescription,children:[g(),e&&(typeof e=="string"?n.jsx(j.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 Ce=(e=>(e.VALID="valid",e.ERROR="error",e))(Ce||{});const Ms=(e,t)=>{if(t===e.id)switch(e.status){case Ce.VALID:return"border-accent-secondary text-primary";case Ce.ERROR:return"border-red-900 text-primary";default:return"border-accent-primary text-primary"}switch(e.status){case Ce.VALID:return"border-primary text-primary";case Ce.ERROR:return"border-red-900 text-error";default:return"border-primary text-secondary"}},Ps=(e,t)=>{if(t===e.id)switch(e.status){case Ce.VALID:return"bg-accent-secondary";case Ce.ERROR:return"bg-red-400";default:return"bg-accent-primary"}switch(e.status){case Ce.VALID:return"bg-accent-secondary";case Ce.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===Ce.ERROR?n.jsx(F.IconExclamationCircle,{stroke:2,size:B.DIAL_ICON_SIZE.SM}):r!==e.id&&e.status===Ce.VALID?n.jsx(F.IconCheck,{stroke:2,size:B.DIAL_ICON_SIZE.SM}):t+1;return n.jsxs("button",{className:le(a,Ms(e,r)),onClick:()=>s(e.id),children:[n.jsx("span",{className:le(i,Ps(e,r)),children:o()}),n.jsx("span",{children:e.name})]})},Bs=({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===Ce.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))})},Ht=e=>(e.toString().split(".")[1]??"").length,zs=({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:f,fillClassName:p,thumbClassName:g,labelsClassName:u,"aria-label":m,"aria-labelledby":v,...x})=>{const b=h.useRef(null),I=Math.max(0,Math.min(100,(e-t)/(r-t)*100)),N=Ht(s),w=l?l(e):e.toFixed(N),D=h.useCallback(A=>{const k=b.current;if(!k)return e;const T=k.getBoundingClientRect(),M=(A-T.left)/T.width,z=t+M*(r-t),G=Ht(s),J=parseFloat((Math.round((z-t)/s)*s+t).toFixed(G));return Math.min(r,Math.max(t,J))},[t,r,s,e]),S=h.useCallback(A=>{a||(A.currentTarget.setPointerCapture(A.pointerId),c?.(D(A.clientX)))},[a,D,c]),_=h.useCallback(A=>{a||A.buttons===0||c?.(D(A.clientX))},[a,D,c]),O=h.useCallback(A=>{if(a)return;const k=Ht(s),T=G=>parseFloat((Math.round((G-t)/s)*s+t).toFixed(k)),M=G=>Math.min(r,Math.max(t,G));let z=e;switch(A.key){case"ArrowRight":case"ArrowUp":z=M(T(e+s));break;case"ArrowLeft":case"ArrowDown":z=M(T(e-s));break;case"Home":z=t;break;case"End":z=r;break;default:return}A.preventDefault(),z!==e&&c?.(z)},[a,e,s,t,r,c]);return n.jsxs("div",{className:y.mergeClasses("flex flex-col",a&&"pointer-events-none opacity-50",d),...x,children:[i&&n.jsx(Re.DialLabel,{...i,htmlFor:x.id}),n.jsxs("div",{ref:b,className:"relative flex h-[38px] cursor-pointer items-center",onPointerDown:S,onPointerMove:_,children:[n.jsx("div",{className:y.mergeClasses("pointer-events-none absolute inset-x-0 h-3 rounded-[10px] bg-layer-1",f)}),n.jsx("div",{className:y.mergeClasses("pointer-events-none absolute left-0 h-3 rounded-[10px] bg-controls-accent-primary",p),style:{width:`${I}%`}}),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":v,className:y.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:`${I}%`},onKeyDown:O,children:w})]}),o&&n.jsx("div",{className:y.mergeClasses("dial-tiny-text flex text-secondary",u),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]})]})})]})},$s=({label:e,text:t,tooltip:r,children:s,postfix:a,className:i})=>n.jsxs("div",{className:y.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(E.DialTooltip,{triggerClassName:"text-primary flex-1 min-w-0",tooltip:r||t,children:t}),a||null]})]}),mn=h.createContext({dragDropManager:void 0});function ye(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 Or=(function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"})(),Ar=function(){return Math.random().toString(36).substring(7).split("").join(".")},_r={INIT:"@@redux/INIT"+Ar(),REPLACE:"@@redux/REPLACE"+Ar()};function Hs(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 Vs(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(Us(e))return"date";if(Gs(e))return"error";var r=Ks(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 Ks(e){return typeof e.constructor=="function"?e.constructor.name:null}function Gs(e){return e instanceof Error||typeof e.message=="string"&&e.constructor&&typeof e.constructor.stackTraceLimit=="number"}function Us(e){return e instanceof Date?!0:typeof e.toDateString=="function"&&typeof e.getDate=="function"&&typeof e.setDate=="function"}function et(e){var t=typeof e;return process.env.NODE_ENV!=="production"&&(t=Vs(e)),t}function xn(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"?ye(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"?ye(1):"Expected the enhancer to be a function. Instead, received: '"+et(r)+"'");return r(xn)(e,t)}if(typeof e!="function")throw new Error(process.env.NODE_ENV==="production"?ye(2):"Expected the root reducer to be a function. Instead, received: '"+et(e)+"'");var a=e,i=t,o=[],l=o,c=!1;function d(){l===o&&(l=o.slice())}function f(){if(c)throw new Error(process.env.NODE_ENV==="production"?ye(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 p(v){if(typeof v!="function")throw new Error(process.env.NODE_ENV==="production"?ye(4):"Expected the listener to be a function. Instead, received: '"+et(v)+"'");if(c)throw new Error(process.env.NODE_ENV==="production"?ye(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 x=!0;return d(),l.push(v),function(){if(x){if(c)throw new Error(process.env.NODE_ENV==="production"?ye(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.");x=!1,d();var I=l.indexOf(v);l.splice(I,1),o=null}}}function g(v){if(!Hs(v))throw new Error(process.env.NODE_ENV==="production"?ye(7):"Actions must be plain objects. Instead, the actual type was: '"+et(v)+"'. 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 v.type>"u")throw new Error(process.env.NODE_ENV==="production"?ye(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"?ye(9):"Reducers may not dispatch actions.");try{c=!0,i=a(i,v)}finally{c=!1}for(var x=o=l,b=0;b<x.length;b++){var I=x[b];I()}return v}function u(v){if(typeof v!="function")throw new Error(process.env.NODE_ENV==="production"?ye(10):"Expected the nextReducer to be a function. Instead, received: '"+et(v));a=v,g({type:_r.REPLACE})}function m(){var v,x=p;return v={subscribe:function(I){if(typeof I!="object"||I===null)throw new Error(process.env.NODE_ENV==="production"?ye(11):"Expected the observer to be an object. Instead, received: '"+et(I)+"'");function N(){I.next&&I.next(f())}N();var w=x(N);return{unsubscribe:w}}},v[Or]=function(){return this},v}return g({type:_r.INIT}),s={dispatch:g,subscribe:p,getState:f,replaceReducer:u},s[Or]=m,s}function Y(e,t,...r){if(Zs()&&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 Zs(){return typeof process<"u"&&process.env.NODE_ENV==="production"}function Ws(e,t,r){return t.split(".").reduce((s,a)=>s&&s[a]?s[a]:r||null,e)}function qs(e,t){return e.filter(r=>r!==t)}function bn(e){return typeof e=="object"}function Ys(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 Xs(e,t){return e.filter(r=>t.indexOf(r)>-1)}const ur="dnd-core/INIT_COORDS",Et="dnd-core/BEGIN_DRAG",fr="dnd-core/PUBLISH_DRAG_SOURCE",Ot="dnd-core/HOVER",At="dnd-core/DROP",_t="dnd-core/END_DRAG";function Lr(e,t){return{type:ur,payload:{sourceClientOffset:t||null,clientOffset:e||null}}}const Qs={type:ur,payload:{clientOffset:null,sourceClientOffset:null}};function Js(e){return function(r=[],s={publishSource:!0}){const{publishSource:a=!0,clientOffset:i,getSourceClientOffset:o}=s,l=e.getMonitor(),c=e.getRegistry();e.dispatch(Lr(i)),ea(r,l,c);const d=na(r,l);if(d==null){e.dispatch(Qs);return}let f=null;if(i){if(!o)throw new Error("getSourceClientOffset must be defined");ta(o),f=o(d)}e.dispatch(Lr(i,f));const g=c.getSource(d).beginDrag(l,d);if(g==null)return;ra(g),c.pinSource(d);const u=c.getSourceType(d);return{type:Et,payload:{itemType:u,item:g,sourceId:d,clientOffset:i||null,sourceClientOffset:f||null,isSourcePublic:!!a}}}}function ea(e,t,r){Y(!t.isDragging(),"Cannot call beginDrag while dragging."),e.forEach(function(s){Y(r.getSource(s),"Expected sourceIds to be registered.")})}function ta(e){Y(typeof e=="function","When clientOffset is provided, getSourceClientOffset must be a function.")}function ra(e){Y(bn(e),"Item must be an object.")}function na(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 sa(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function aa(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){sa(e,a,r[a])})}return e}function ia(e){return function(r={}){const s=e.getMonitor(),a=e.getRegistry();oa(s),da(s).forEach((o,l)=>{const c=la(o,l,a,s),d={type:At,payload:{dropResult:aa({},r,c)}};e.dispatch(d)})}}function oa(e){Y(e.isDragging(),"Cannot call drop while not dragging."),Y(!e.didDrop(),"Cannot call drop twice during one drag operation.")}function la(e,t,r,s){const a=r.getTarget(e);let i=a?a.drop(s,e):void 0;return ca(i),typeof i>"u"&&(i=t===0?{}:s.getDropResult()),i}function ca(e){Y(typeof e>"u"||bn(e),"Drop result must either be an object or undefined.")}function da(e){const t=e.getTargetIds().filter(e.canDropOnTarget,e);return t.reverse(),t}function ua(e){return function(){const r=e.getMonitor(),s=e.getRegistry();fa(r);const a=r.getSourceId();return a!=null&&(s.getSource(a,!0).endDrag(r,a),s.unpinSource()),{type:_t}}}function fa(e){Y(e.isDragging(),"Cannot call endDrag while not dragging.")}function tr(e,t){return t===null?e===null:Array.isArray(e)?e.some(r=>r===t):e===t}function pa(e){return function(r,{clientOffset:s}={}){ga(r);const a=r.slice(0),i=e.getMonitor(),o=e.getRegistry(),l=i.getItemType();return ma(a,o,l),ha(a,i,o),xa(a,i,o),{type:Ot,payload:{targetIds:a,clientOffset:s||null}}}}function ga(e){Y(Array.isArray(e),"Expected targetIds to be an array.")}function ha(e,t,r){Y(t.isDragging(),"Cannot call hover while not dragging."),Y(!t.didDrop(),"Cannot call hover after drop.");for(let s=0;s<e.length;s++){const a=e[s];Y(e.lastIndexOf(a)===s,"Expected targetIds to be unique in the passed array.");const i=r.getTarget(a);Y(i,"Expected targetIds to be registered.")}}function ma(e,t,r){for(let s=e.length-1;s>=0;s--){const a=e[s],i=t.getTargetType(a);tr(i,r)||e.splice(s,1)}}function xa(e,t,r){e.forEach(function(s){r.getTarget(s).hover(t,s)})}function ba(e){return function(){if(e.getMonitor().isDragging())return{type:fr}}}function Ca(e){return{beginDrag:Js(e),publishDragSource:ba(e),hover:pa(e),drop:ia(e),endDrag:ua(e)}}class va{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=Ca(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 ya(e,t){return{x:e.x+t.x,y:e.y+t.y}}function Cn(e,t){return{x:e.x-t.x,y:e.y-t.y}}function Ia(e){const{clientOffset:t,initialClientOffset:r,initialSourceClientOffset:s}=e;return!t||!r||!s?null:Cn(ya(t,s),r)}function Da(e){const{clientOffset:t,initialClientOffset:r}=e;return!t||!r?null:Cn(t,r)}const lt=[],pr=[];lt.__IS_NONE__=!0;pr.__IS_ALL__=!0;function Sa(e,t){return e===lt?!1:e===pr||typeof t>"u"?!0:Xs(t,e).length>0}class Na{subscribeToStateChange(t,r={}){const{handlerIds:s}=r;Y(typeof t=="function","listener must be a function."),Y(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&&!Sa(o.dirtyHandlerIds,s)||t()}finally{a=l}};return this.store.subscribe(i)}subscribeToOffsetChange(t){Y(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 Y(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(Y(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 tr(s,a)&&r.canDrop(this,t)}isDragging(){return!!this.getItemType()}isDraggingSource(t){if(!t)return!1;const r=this.registry.getSource(t,!0);if(Y(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&&!tr(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 Ia(this.store.getState().dragOffset)}getDifferenceFromInitialOffset(){return Da(this.store.getState().dragOffset)}constructor(t,r){this.store=t,this.registry=r}}const kr=typeof global<"u"?global:self,vn=kr.MutationObserver||kr.WebKitMutationObserver;function yn(e){return function(){const r=setTimeout(a,0),s=setInterval(a,50);function a(){clearTimeout(r),clearInterval(s),e()}}}function ja(e){let t=1;const r=new vn(e),s=document.createTextNode("");return r.observe(s,{characterData:!0}),function(){t=-t,s.data=t}}const Ta=typeof vn=="function"?ja:yn;class wa{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=yn(()=>{if(this.pendingErrors.length)throw this.pendingErrors.shift()})}}class Ea{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 Oa{create(t){const r=this.freeTasks,s=r.length?r.pop():new Ea(this.onError,a=>r[r.length]=a);return s.task=t,s}constructor(t){this.onError=t,this.freeTasks=[]}}const In=new wa,Aa=new Oa(In.registerPendingError);function _a(e){In.enqueueTask(Aa.create(e))}const gr="dnd-core/ADD_SOURCE",hr="dnd-core/ADD_TARGET",mr="dnd-core/REMOVE_SOURCE",Lt="dnd-core/REMOVE_TARGET";function La(e){return{type:gr,payload:{sourceId:e}}}function ka(e){return{type:hr,payload:{targetId:e}}}function Ra(e){return{type:mr,payload:{sourceId:e}}}function Ma(e){return{type:Lt,payload:{targetId:e}}}function Pa(e){Y(typeof e.canDrag=="function","Expected canDrag to be a function."),Y(typeof e.beginDrag=="function","Expected beginDrag to be a function."),Y(typeof e.endDrag=="function","Expected endDrag to be a function.")}function Fa(e){Y(typeof e.canDrop=="function","Expected canDrop to be a function."),Y(typeof e.hover=="function","Expected hover to be a function."),Y(typeof e.drop=="function","Expected beginDrag to be a function.")}function rr(e,t){if(t&&Array.isArray(e)){e.forEach(r=>rr(r,!1));return}Y(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 De;(function(e){e.SOURCE="SOURCE",e.TARGET="TARGET"})(De||(De={}));let Ba=0;function za(){return Ba++}function $a(e){const t=za().toString();switch(e){case De.SOURCE:return`S${t}`;case De.TARGET:return`T${t}`;default:throw new Error(`Unknown Handler Role: ${e}`)}}function Rr(e){switch(e[0]){case"S":return De.SOURCE;case"T":return De.TARGET;default:throw new Error(`Cannot parse handler ID: ${e}`)}}function Mr(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 Ha{addSource(t,r){rr(t),Pa(r);const s=this.addHandler(De.SOURCE,t,r);return this.store.dispatch(La(s)),s}addTarget(t,r){rr(t,!0),Fa(r);const s=this.addHandler(De.TARGET,t,r);return this.store.dispatch(ka(s)),s}containsHandler(t){return Mr(this.dragSources,t)||Mr(this.dropTargets,t)}getSource(t,r=!1){return Y(this.isSourceId(t),"Expected a valid source ID."),r&&t===this.pinnedSourceId?this.pinnedSource:this.dragSources.get(t)}getTarget(t){return Y(this.isTargetId(t),"Expected a valid target ID."),this.dropTargets.get(t)}getSourceType(t){return Y(this.isSourceId(t),"Expected a valid source ID."),this.types.get(t)}getTargetType(t){return Y(this.isTargetId(t),"Expected a valid target ID."),this.types.get(t)}isSourceId(t){return Rr(t)===De.SOURCE}isTargetId(t){return Rr(t)===De.TARGET}removeSource(t){Y(this.getSource(t),"Expected an existing source."),this.store.dispatch(Ra(t)),_a(()=>{this.dragSources.delete(t),this.types.delete(t)})}removeTarget(t){Y(this.getTarget(t),"Expected an existing target."),this.store.dispatch(Ma(t)),this.dropTargets.delete(t),this.types.delete(t)}pinSource(t){const r=this.getSource(t);Y(r,"Expected an existing source."),this.pinnedSourceId=t,this.pinnedSource=r}unpinSource(){Y(this.pinnedSource,"No source is pinned at the time."),this.pinnedSourceId=null,this.pinnedSource=null}addHandler(t,r,s){const a=$a(t);return this.types.set(a,r),t===De.SOURCE?this.dragSources.set(a,s):t===De.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 Va=(e,t)=>e===t;function Ka(e,t){return!e&&!t?!0:!e||!t?!1:e.x===t.x&&e.y===t.y}function Ga(e,t,r=Va){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 Ua(e=lt,t){switch(t.type){case Ot:break;case gr:case hr:case Lt:case mr:return lt;case Et:case fr:case _t:case At:default:return pr}const{targetIds:r=[],prevTargetIds:s=[]}=t.payload,a=Ys(r,s);if(!(a.length>0||!Ga(r,s)))return lt;const o=s[s.length-1],l=r[r.length-1];return o!==l&&(o&&a.push(o),l&&a.push(l)),a}function Za(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Wa(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){Za(e,a,r[a])})}return e}const Pr={initialSourceClientOffset:null,initialClientOffset:null,clientOffset:null};function qa(e=Pr,t){const{payload:r}=t;switch(t.type){case ur:case Et:return{initialSourceClientOffset:r.sourceClientOffset,initialClientOffset:r.clientOffset,clientOffset:r.clientOffset};case Ot:return Ka(e.clientOffset,r.clientOffset)?e:Wa({},e,{clientOffset:r.clientOffset});case _t:case At:return Pr;default:return e}}function Ya(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function tt(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){Ya(e,a,r[a])})}return e}const Xa={itemType:null,item:null,sourceId:null,targetIds:[],dropResult:null,didDrop:!1,isSourcePublic:null};function Qa(e=Xa,t){const{payload:r}=t;switch(t.type){case Et:return tt({},e,{itemType:r.itemType,item:r.item,sourceId:r.sourceId,isSourcePublic:r.isSourcePublic,dropResult:null,didDrop:!1});case fr:return tt({},e,{isSourcePublic:!0});case Ot:return tt({},e,{targetIds:r.targetIds});case Lt:return e.targetIds.indexOf(r.targetId)===-1?e:tt({},e,{targetIds:qs(e.targetIds,r.targetId)});case At:return tt({},e,{dropResult:r.dropResult,didDrop:!0,targetIds:[]});case _t:return tt({},e,{itemType:null,item:null,sourceId:null,dropResult:null,didDrop:!1,isSourcePublic:null,targetIds:[]});default:return e}}function Ja(e=0,t){switch(t.type){case gr:case hr:return e+1;case mr:case Lt:return e-1;default:return e}}function ei(e=0){return e+1}function ti(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function ri(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){ti(e,a,r[a])})}return e}function ni(e={},t){return{dirtyHandlerIds:Ua(e.dirtyHandlerIds,{type:t.type,payload:ri({},t.payload,{prevTargetIds:Ws(e,"dragOperation.targetIds",[])})}),dragOffset:qa(e.dragOffset,t),refCount:Ja(e.refCount,t),dragOperation:Qa(e.dragOperation,t),stateId:ei(e.stateId)}}function si(e,t=void 0,r={},s=!1){const a=ai(s),i=new Na(a,new Ha(a)),o=new va(a,i),l=e(o,t,r);return o.receiveBackend(l),o}function ai(e){const t=typeof window<"u"&&window.__REDUX_DEVTOOLS_EXTENSION__;return xn(ni,e&&t&&t({name:"dnd-core",instanceId:"dnd-core"}))}function ii(e,t){if(e==null)return{};var r=oi(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 oi(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 Fr=0;const It=Symbol.for("__REACT_DND_CONTEXT_INSTANCE__");var li=h.memo(function(t){var{children:r}=t,s=ii(t,["children"]);const[a,i]=ci(s);return h.useEffect(()=>{if(i){const o=Dn();return++Fr,()=>{--Fr===0&&(o[It]=null)}}},[]),n.jsx(mn.Provider,{value:a,children:r})});function ci(e){if("manager"in e)return[{dragDropManager:e.manager},!1];const t=di(e.backend,e.context,e.options,e.debugMode),r=!e.context;return[t,r]}function di(e,t=Dn(),r,s){const a=t;return a[It]||(a[It]={dragDropManager:si(e,t,r,s)}),a[It]}function Dn(){return typeof global<"u"?global:window}var Vt,Br;function ui(){return Br||(Br=1,Vt=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}),Vt}var fi=ui();const pi=C.getDefaultExportFromCjs(fi),We=typeof window<"u"?h.useLayoutEffect:h.useEffect;function gi(e,t,r){const[s,a]=h.useState(()=>t(e)),i=h.useCallback(()=>{const o=t(e);pi(s,o)||(a(o),r&&r())},[s,e,r]);return We(i),[s,i]}function hi(e,t,r){const[s,a]=gi(e,t,r);return We(function(){const o=e.getHandlerId();if(o!=null)return e.subscribeToStateChange(a,{handlerIds:[o]})},[e,a]),s}function Sn(e,t,r){return hi(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 mi(e){return h.useMemo(()=>e.hooks.dragSource(),[e])}function xi(e){return h.useMemo(()=>e.hooks.dragPreview(),[e])}let Kt=!1,Gt=!1;class bi{receiveHandlerId(t){this.sourceId=t}getHandlerId(){return this.sourceId}canDrag(){Y(!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;Y(!Gt,"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 Gt=!0,this.internalMonitor.isDraggingSource(this.sourceId)}finally{Gt=!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 Ut=!1;class Ci{receiveHandlerId(t){this.targetId=t}getHandlerId(){return this.targetId}subscribeToStateChange(t,r){return this.internalMonitor.subscribeToStateChange(t,r)}canDrop(){if(!this.targetId)return!1;Y(!Ut,"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 Ut=!0,this.internalMonitor.canDropOnTarget(this.targetId)}finally{Ut=!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 vi(e,t,r){const s=r.getRegistry(),a=s.addTarget(e,t);return[a,()=>s.removeTarget(a)]}function yi(e,t,r){const s=r.getRegistry(),a=s.addSource(e,t);return[a,()=>s.removeSource(a)]}function nr(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 f=e[d],p=t[d];if(a=void 0,a===!1||a===void 0&&f!==p)return!1}return!0}function sr(e){return e!==null&&typeof e=="object"&&Object.prototype.hasOwnProperty.call(e,"current")}function Ii(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 Di(e){return(t=null,r=null)=>{if(!h.isValidElement(t)){const i=t;return e(i,r),i}const s=t;return Ii(s),Si(s,r?i=>e(i,r):e)}}function jn(e){const t={};return Object.keys(e).forEach(r=>{const s=e[r];if(r.endsWith("Ref"))t[r]=e[r];else{const a=Di(s);t[r]=()=>a}}),t}function zr(e,t){typeof e=="function"?e(t):e.current=t}function Si(e,t){const r=e.ref;return Y(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=>{zr(r,s),zr(t,s)}}):h.cloneElement(e,{ref:t})}class Ni{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!nr(this.lastConnectedDragSourceOptions,this.dragSourceOptions)}didDragPreviewOptionsChange(){return!nr(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=jn({dragSource:(r,s)=>{this.clearDragSource(),this.dragSourceOptions=s||null,sr(r)?this.dragSourceRef=r:this.dragSourceNode=r,this.reconnectDragSource()},dragPreview:(r,s)=>{this.clearDragPreview(),this.dragPreviewOptions=s||null,sr(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 ji{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!nr(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=jn({dropTarget:(r,s)=>{this.clearDropTarget(),this.dropTargetOptions=s,sr(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 st(){const{dragDropManager:e}=h.useContext(mn);return Y(e!=null,"Expected drag drop context"),e}function Ti(e,t){const r=st(),s=h.useMemo(()=>new Ni(r.getBackend()),[r]);return We(()=>(s.dragSourceOptions=e||null,s.reconnect(),()=>s.disconnectDragSource()),[s,e]),We(()=>(s.dragPreviewOptions=t||null,s.reconnect(),()=>s.disconnectDragPreview()),[s,t]),s}function wi(){const e=st();return h.useMemo(()=>new bi(e),[e])}class Ei{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 Oi(e,t,r){const s=h.useMemo(()=>new Ei(e,t,r),[t,r]);return h.useEffect(()=>{s.spec=e},[e]),s}function Ai(e){return h.useMemo(()=>{const t=e.type;return Y(t!=null,"spec.type must be defined"),t},[e])}function _i(e,t,r){const s=st(),a=Oi(e,t,r),i=Ai(e);We(function(){if(i!=null){const[l,c]=yi(i,a,s);return t.receiveHandlerId(l),r.receiveHandlerId(l),c}},[s,t,r,a,i])}function Li(e,t){const r=Nn(e,t);Y(!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=wi(),a=Ti(r.options,r.previewOptions);return _i(r,s,a),[Sn(r.collect,s,a),mi(a),xi(a)]}function ki(e){return h.useMemo(()=>e.hooks.dropTarget(),[e])}function Ri(e){const t=st(),r=h.useMemo(()=>new ji(t.getBackend()),[t]);return We(()=>(r.dropTargetOptions=e||null,r.reconnect(),()=>r.disconnectDropTarget()),[e]),r}function Mi(){const e=st();return h.useMemo(()=>new Ci(e),[e])}function Pi(e){const{accept:t}=e;return h.useMemo(()=>(Y(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 Bi(e,t){const r=h.useMemo(()=>new Fi(e,t),[t]);return h.useEffect(()=>{r.spec=e},[e]),r}function zi(e,t,r){const s=st(),a=Bi(e,t),i=Pi(e);We(function(){const[l,c]=vi(i,a,s);return t.receiveHandlerId(l),r.receiveHandlerId(l),c},[s,t,a,r,i.map(o=>o.toString()).join("|")])}function xr(e,t){const r=Nn(e,t),s=Mi(),a=Ri(r.options);return zi(r,s,a),[Sn(r.collect,s,a),ki(a)]}const $r="column",$i="flex items-center",Hi="mr-3 cursor-move text-secondary",Vi=({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},f,p]=Li(()=>({type:$r,item:{id:e,originalIndex:c},collect:u=>{const m=u.getItem();return{isDragging:u.isDragging()&&m?.id===e}},end:(u,m)=>{if(!u)return;!m.didDrop()&&typeof a=="function"&&u.originalIndex>-1&&a(u.id,u.originalIndex)}}),[e,c,a]),[,g]=xr(()=>({accept:$r,hover:u=>{if(!(!u||u.id===e)&&typeof s=="function"&&typeof a=="function"){const m=s(e);a(u.id,m)}}}),[s,a,e]);return p(g(l)),f(o),n.jsxs("div",{ref:l,className:y.mergeClasses($i,r),style:{opacity:d?0:1},"aria-roledescription":"Draggable item",children:[n.jsx("div",{ref:o,className:Hi,"aria-label":i,children:n.jsx(F.IconGripVertical,{...B.BASE_ICON_PROPS})}),t]})},kt=({iconClassName:e,label:t,...r})=>t?n.jsx(C.DialDangerButton,{...r,label:t,appearance:E.ButtonAppearance.Ghost,iconBefore:n.jsx(F.IconTrashX,{...B.BASE_ICON_PROPS,className:e||""})}):n.jsx(j.DialDangerIconButton,{...r,appearance:E.ButtonAppearance.Ghost,icon:n.jsx(F.IconTrashX,{...B.BASE_ICON_PROPS,className:e||""})}),Ki=({className:e="",value:t,onChange:r,error:s,containerClassName:a,resize:i=!1,labelProps:o,caption:l,id:c,...d})=>{const f=y.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:y.mergeClasses("flex flex-col gap-y-1",a),children:[o&&n.jsx(Re.DialLabel,{...o,htmlFor:c}),n.jsx("textarea",{id:c,value:t||"",className:f,onChange:p=>r?.(p.currentTarget.value),...d}),n.jsx(C.DialErrorText,{text:s}),!s&&n.jsx(C.DialCaptionText,{text:l})]})},Gi="inline-flex items-center rounded bg-layer-3",Ui="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",Zi="relative z-10 bg-controls-accent-primary-alpha-active text-primary",Wi="text-secondary hover:text-primary",qi="text-controls-disable-accent cursor-not-allowed hover:text-controls-disable-accent",Yi=({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 f=null;switch(l.key){case"ArrowRight":case"ArrowDown":f=(d+1)%c.length;break;case"ArrowLeft":case"ArrowUp":f=(d-1+c.length)%c.length;break;case"Home":f=0;break;case"End":f=c.length-1;break;default:return}l.preventDefault();const p=c[f];p&&p.value!==t&&r(p.value)},[s,e,t,r]);return n.jsx("div",{role:"tablist","aria-label":i,className:y.mergeClasses(Gi,a),children:e.map((l,c)=>{const d=l.value===t,f=c===0,p=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:y.mergeClasses(Ui,!p&&"-mr-px",f&&"rounded-l",p&&"rounded-r",d?Zi:Wi,g&&qi),children:[l.icon,l.label]},l.value)})})},Zt=8,Xi=24,Tn=({initialTags:e=[],label:t,required:r,elementId:s,placeholder:a,captionDescription:i,errorText:o,invalid:l,disabled:c,collapseTagOverflow:d=!1,readOnly:f=!1,containerClassName:p,tagClassName:g,onChange:u})=>{const m=h.useRef(null),v=h.useRef([]),x=h.useRef(null),[b,I]=h.useState(e),[N,w]=h.useState(""),[D,S]=h.useState(!1),[_,O]=h.useState(e.length),A=h.useCallback($=>H=>{v.current[$]=H},[]),k=h.useCallback(()=>{if(!d)return;const $=m.current;if(!$)return;const H=$.offsetWidth;if(H===0)return;const q=x.current?.offsetWidth??0,ae=H-(f?0:Xi)-Zt;let X=0,Z=0;for(let ie=0;ie<b.length;ie++){const ne=v.current[ie];if(!ne)continue;const ce=ne.offsetWidth+Zt;if(X+ce>ae)break;X+=ce,Z++}if(Z<b.length&&Z>0)for(;X+q>ae&&Z>0;){Z--;const ie=v.current[Z]?.offsetWidth??0;X-=ie+Zt}O(Z)},[d,f,b.length]),T=$=>{const H=$.trim().replace(/,$/,"");if(H&&!b.includes(H)){const q=[H,...b];I(q),u?.(q)}},M=$=>{($.key===","||$.key==="Enter")&&($.preventDefault(),T(N),w(""))},z=()=>{N.trim()&&(T(N),w(""))},G=$=>{const H=b.filter((q,K)=>K!==$);I(H),u?.(H)},J=()=>o?n.jsx(C.DialErrorText,{text:o}):i?n.jsx(C.DialCaptionText,{text:i}):null;h.useEffect(()=>{if(d)return;const $=new ResizeObserver(()=>{if(m.current){const H=m.current.scrollHeight>m.current.clientHeight+10;S(H)}});return m.current&&$.observe(m.current),()=>$.disconnect()},[b,d]),h.useEffect(()=>{if(!d){O(b.length);return}O(b.length);const $=new ResizeObserver(()=>{k()}),H=m.current;return H&&$.observe(H),k(),()=>$.disconnect()},[d,k,b]),h.useEffect(()=>{I(e)},[JSON.stringify(e)]);const U=n.jsxs("div",{ref:m,className:le("flex gap-2 items-center relative",d?"flex-nowrap overflow-hidden w-full min-w-0":le("flex-wrap",D?"flex-col-reverse":"flex-row"),p),children:[(d?b.slice(0,_):b).map(($,H)=>n.jsx(Ue,{label:$,className:g,closable:!c&&!f,onRemove:!c&&!f?()=>G(H):void 0},$+H)),d&&_<b.length&&n.jsx(E.DialTooltip,{tooltip:b.slice(_).join(", "),triggerClassName:"inline-flex shrink-0 cursor-pointer",children:n.jsx(Ue,{label:`+${b.length-_}`})}),!f&&n.jsx("input",{id:s,type:"text",value:N,onChange:$=>w($.target.value),onKeyDown:M,onBlur:z,className:le("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:[b.map(($,H)=>n.jsx("div",{ref:A(H),className:"inline-flex shrink-0",children:n.jsx(Ue,{label:$,className:g,closable:!c&&!f,onRemove:!c&&!f?()=>G(H):void 0})},`measure-${$}-${H}`)),n.jsx("div",{ref:x,className:"inline-flex shrink-0",children:n.jsx(Ue,{label:`+${b.length}`})})]})]});return f?U:n.jsxs("div",{className:"flex flex-col gap-2 w-full",children:[n.jsx(Re.DialLabel,{label:t,required:r,htmlFor:s}),n.jsx("div",{className:le("dial-input min-h-[38px] p-[6px]",l&&"dial-input-error",c&&"dial-input-disable"),children:U}),J()]})},wn=({selectedItems:e,placeholder:t,collapseTagOverflow:r=!1,listClassName:s,listElementClassName:a})=>e?.length?n.jsx(Tn,{readOnly:!0,initialTags:e,collapseTagOverflow:r,containerClassName:s,tagClassName:a}):t?n.jsx("span",{className:"text-secondary",children:t}):null,Wt=e=>Tr.createElement("svg",{width:18,height:18,viewBox:"0 0 18 18",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},Tr.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"})),En=({children:e,open:t,disabled:r=!1,selectedValue:s,valueClassName:a,inputClassName:i,onOpen:o,elementId:l,errorText:c,invalid:d,emptyValueText:f,placeholder:p,editable:g=!1,onValueChange:u,collapseTagOverflow:m=!1,iconBefore:v})=>{const x=Array.isArray(s)&&s.length>0,b=typeof s=="string"&&!!s.trim(),I=x||b?s:p?void 0:f,N=r?void 0:o,w=h.useCallback(O=>{u?.(O.target.value)},[u]),D=()=>n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:le("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:[v&&n.jsx(j.DialIcon,{icon:v}),n.jsx("input",{type:"text",className:le("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:p||f,onChange:w,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(j.DialIcon,{icon:n.jsx(Wt,{role:"img",width:B.BASE_ICON_SIZE,height:B.BASE_ICON_SIZE})})})]}),n.jsx(C.DialErrorText,{text:c})]}),S=()=>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:le("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:[v&&n.jsx(j.DialIcon,{icon:v}),n.jsx(E.DialTooltip,{tooltip:I==null?void 0:String(I),children:I||!p?n.jsx("span",{className:a,children:I}):n.jsx("span",{className:"text-secondary",children:p})})]}),!r&&n.jsx("div",{className:"shrink-0",children:n.jsx(j.DialIcon,{icon:n.jsx(Wt,{role:"img",width:B.BASE_ICON_SIZE,height:B.BASE_ICON_SIZE})})})]})}),n.jsx(C.DialErrorText,{text:c})]}),_=()=>n.jsx("div",{className:"w-full",onClick:N,children:n.jsxs("div",{className:le("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:[v&&n.jsx(j.DialIcon,{icon:v}),n.jsx(wn,{placeholder:p,selectedItems:I,collapseTagOverflow:m})]}),!r&&n.jsx("div",{className:"ml-1",children:n.jsx(j.DialIcon,{icon:n.jsx(Wt,{role:"img",width:B.BASE_ICON_SIZE,height:B.BASE_ICON_SIZE})})})]})});return n.jsxs(n.Fragment,{children:[x?_():g?D():S(),t&&Cs.createPortal(e,document.body)]})},Qi=({label:e,htmlFor:t,disabled:r,selectedValue:s,radioButtons:a,customInputValue:i,valueClassName:o,inputClassName:l,emptyValueText:c,placeholder:d,onClose:f,header:p,portalId:g,onApply:u,onCancel:m,cancelButtonTitle:v="Cancel",applyButtonTitle:x="Apply",isValid:b,selectedRadioValue:I,onChangeRadioField:N,id:w,size:D=C.PopupSize.Md})=>{const[S,_]=h.useState(!1),O=h.useCallback(()=>{r||_(!0)},[r]),A=h.useCallback(()=>{_(!1),f?.()},[f]),k=h.useCallback(()=>{m?.(),A()},[m,A]),T=h.useCallback(()=>{u(),A()},[u,A]);return n.jsxs("div",{className:"flex flex-col gap-1",children:[n.jsx(Re.DialLabel,{label:e,htmlFor:t}),n.jsx(En,{disabled:r,open:S,selectedValue:i??a.find(M=>M.id===s)?.name,valueClassName:o,inputClassName:le(l,"py-2","px-3"),emptyValueText:c,placeholder:d,onOpen:O,children:n.jsx(C.DialPopup,{open:S,onClose:k,header:p,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(C.DialNeutralButton,{label:v,onClick:k}),n.jsx(C.DialPrimaryButton,{label:x,onClick:T,disabled:!b})]}),children:n.jsx("div",{className:"px-6 py-4",children:n.jsx(C.DialRadioGroup,{radioButtons:a,labelClassName:"dial-small-text",activeRadioButton:I,onChange:N,elementId:w,orientation:C.RadioGroupOrientation.Column})})})})]})},Ji="Create",eo="Cancel",to="flex items-center justify-end gap-2 px-6 py-3",ro=({header:e,open:t=!1,submitLabel:r=Ji,cancelLabel:s=eo,isLoading:a=!1,disableSubmitButton:i=!1,className:o,submitClassName:l,onClose:c,onSubmit:d,onCancel:f,children:p,dividers:g=!0,size:u=C.PopupSize.Md,footer:m})=>{const v=a?null:n.jsxs("div",{className:to,children:[n.jsx(C.DialNeutralButton,{label:s,onClick:()=>f?f():c?.()}),n.jsx(C.DialPrimaryButton,{className:l,label:r,disabled:i,onClick:()=>d()})]}),x=h.useCallback(()=>a?n.jsx("div",{className:"px-6 py-4 h-[120px]",children:n.jsx(C.DialLoader,{size:50})}):p??null,[p,a]);return n.jsx(C.DialPopup,{open:t,header:e,className:o,dividers:g,onClose:()=>c?.(),footer:m??v,size:u,children:x()})},no=/^0+\.(\d+)?$/,so=/^0+/,ar=({integer:e,onChange:t,min:r,max:s,onKeyDown:a,onPaste:i,...o})=>{const l=f=>!f||f==="-"?f:String(f)?.match(no)?String(f)?.replace(so,"0"):Number(f),c=f=>{if([".","-","+","e","E"].includes(f.key)){f.preventDefault();return}C.handleKeyDown(f,"number",r,s)},d=f=>{const p=f.clipboardData.getData("text"),g=p.replace(/\D/g,"");if(g!==p&&(f.preventDefault(),g)){const u=f.currentTarget,m=u.selectionStart??0,v=u.selectionEnd??0,x=u.value.slice(0,m)+g+u.value.slice(v);t?.(l(x))}};return n.jsx(C.DialInput,{type:"number",min:r,max:s,onChange:f=>t?.(l(f)),onKeyDown:e?c:a,onPaste:e?d:i,...o})},ao=({onClick:e})=>n.jsx(F.IconEyeOff,{...B.BASE_ICON_PROPS,className:"text-primary",onClick:e,role:"button","aria-label":"hide"}),io=({onClick:e})=>n.jsx(F.IconEye,{...B.BASE_ICON_PROPS,className:"text-primary",onClick:e,role:"button","aria-label":"show"}),On=({...e})=>{const[t,r]=h.useState(!1),s=h.useCallback(a=>{r(a)},[]);return n.jsx(C.DialInput,{type:t?"text":"password",...e,iconAfter:e.disabled?null:t?n.jsx(ao,{onClick:()=>s(!1)}):n.jsx(io,{onClick:()=>s(!0)})})},An=({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(Ue,{label:a,onRemove:o=>r?.(o,s),icon:i?n.jsx(j.DialIcon,{icon:i}):null,className:"max-w-full"},s)})});var St=(e=>(e.Sm="sm",e.Md="md",e))(St||{}),Nt=(e=>(e.Primary="Primary",e.Secondary="Secondary",e))(Nt||{});const oo="dial-input flex w-full items-center justify-between gap-2 dial-small-text cursor-pointer",lo="w-full rounded flex flex-col",ct="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",co="bg-accent-primary-alpha",ir="bg-accent-primary-alpha border-l border-accent-primary border-1",jt="opacity-75",uo=352,fo=4,po=n.jsx(F.IconChevronDown,{size:B.DIAL_ICON_SIZE.SM}),go=({opt:e,selectedValues:t,onSelect:r})=>{const{isOpen:s,refs:a,floatingStyles:i,context:o,getReferenceProps:l,getFloatingProps:c}=j.useSubMenuFloating(fo,"listbox",!!e.disabled),d=e.children?.some(f=>t.includes(f.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:le(ct,d&&ir,e.disabled&&jt),...l(),children:[n.jsxs("div",{className:"flex items-center gap-2 w-full min-w-0",children:[e.icon&&n.jsx(j.DialIcon,{icon:e.icon}),n.jsx(j.DialEllipsisTooltip,{text:e.labelNode??e.label})]}),n.jsx(F.IconChevronRight,{size:14,className:"shrink-0"})]}),s&&n.jsx(j.SubMenuPanel,{refs:a,floatingStyles:i,context:o,getFloatingProps:c,role:"listbox",className:"w-max py-1",children:e.children.map(f=>{const p=t.includes(f.value);return n.jsx("button",{type:"button",role:"option","aria-selected":p,"aria-disabled":!!f.disabled,disabled:f.disabled,className:le(ct,p&&ir,f.disabled&&jt),onClick:()=>!f.disabled&&r(f.value),children:n.jsxs("div",{className:"flex items-center gap-2 w-full",children:[f.icon&&n.jsx(j.DialIcon,{icon:f.icon}),n.jsx(j.DialEllipsisTooltip,{text:f.labelNode??f.label})]})},f.value)})})]})},Te=({options:e,multiple:t=!1,elementId:r,value:s,defaultValue:a,variant:i=Nt.Primary,size:o=St.Md,prefix:l,customSelectedValue:c,placeholder:d="Select...",searchable:f=!1,searchSize:p=E.ElementSize.Standard,searchPlaceholder:g,selectAll:u=!1,invalid:m,selectAllLabel:v="Select all",emptyStateTitle:x="No options available",emptyStateDescription:b,emptyStateIcon:I,disabled:N=!1,className:w,listClassName:D,closable:S=!1,header:_,footer:O,onClose:A,onChange:k,inlineSearch:T=!1,dismissRef:M,onFooterClick:z,open:G,onOpenChange:J,onInlineQueryChange:U,customMultiSelectTagsRenderer:$})=>{const H=h.useId(),[q,K]=h.useState(!1),ae=G!==void 0,X=ae?!!G:q,Z=h.useCallback(L=>{ae||K(L),J?.(L)},[ae,J]),[ie,ne]=h.useState(T&&c||""),ce=h.useRef(null),ue=h.useCallback(L=>{L!==ie&&(ne(L||""),U?.(L||""))},[U,ie]),pe=s!==void 0,[ge,fe]=h.useState(a),W=pe?s:ge,ee=h.useMemo(()=>t?Array.isArray(W)?W:[]:typeof W=="string"?[W]:[],[W,t]),Se=h.useMemo(()=>{const L=ie.trim().toLowerCase();return L?e.filter(se=>se.label.toLowerCase().includes(L)):e},[e,ie]);h.useEffect(()=>{!X&&!T&&ue("")},[T,X,ue]);const $e=h.useRef(c);h.useEffect(()=>{T&&c!==$e.current&&(X||($e.current=c,ue(c||"")))},[c,T,X,ue]);const he=h.useCallback(L=>{pe||fe(L),k?.(L)},[pe,k]),He=h.useCallback(L=>{if(t){const se=new Set(ee);se.has(L)?se.delete(L):se.add(L),he(Array.from(se));return}if(he(L),T){const se=e.find(xe=>xe.value===L)??e.flatMap(xe=>xe.children??[]).find(xe=>xe.value===L);se&&ue(se.label)}Z(!1)},[t,he,T,Z,ee,e,ue]),Ee=h.useCallback((L,se)=>{if(L.stopPropagation(),!t){he("");return}const xe=ee.filter(Bt=>Bt!==se);he(xe)},[t,ee,he]),oe=h.useMemo(()=>Se.filter(L=>!L.disabled),[Se]),Me=h.useMemo(()=>oe.filter(L=>ee.includes(L.value)).length,[oe,ee]),Ne=h.useCallback(L=>{T&&!t&&!L&&He(ie),Z(L)},[He,T,t,ie,Z]),{allSelectedInFiltered:Ve,someSelectedInFiltered:ot}=h.useMemo(()=>{const L=oe.length>0&&Me===oe.length;return{allSelectedInFiltered:L,someSelectedInFiltered:Me>0&&!L}},[oe,Me]),ve=h.useCallback(()=>{if(!(!t||oe.length===0))if(Ve){const L=new Set(oe.map(se=>se.value));he(ee.filter(se=>!L.has(se)))}else{const L=new Set(ee);oe.forEach(se=>L.add(se.value)),he(Array.from(L))}},[Ve,t,oe,ee,he]),Ke=ee.length>0;h.useEffect(()=>{X&&T&&!t&&!N&&requestAnimationFrame(()=>{const L=ce.current;if(!L)return;L.focus();const se=L.value?.length??0;L.setSelectionRange?.(se,se)})},[X,T,t,N]);const Pe=!t&&Ke?ee[0]:void 0,me=h.useMemo(()=>Pe?e.find(L=>L.value===Pe)??e.flatMap(L=>L.children??[]).find(L=>L.value===Pe):void 0,[e,Pe]),Ft=h.useCallback(()=>t?Ke?$?.(e,ee,Ee)||n.jsx(An,{options:e,selectedValues:ee,handleRemoveTag:Ee}):n.jsx("span",{className:"text-secondary truncate",children:d}):me?n.jsxs(n.Fragment,{children:[me.icon&&n.jsx(j.DialIcon,{icon:me.icon}),n.jsx(j.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}),[Ke,t,c,l,s,d,me,e,ee,Ee,$]);h.useImperativeHandle(M,()=>({dismiss:()=>{Z(!1)}}));const Oe=h.useCallback(()=>{ue(ee.length===1?me?.label??ie:"")},[ie,ee.length,ue,me?.label]),Ge=h.useCallback(()=>{N||(Z(!X),T&&!t&&(Oe(),ce.current?.focus()))},[N,T,X,t,Oe,Z]);return n.jsx(j.DialDropdown,{open:X,onOpenChange:Ne,disabled:N,closable:S,onClose:A,placement:"bottom-start",allowedPlacements:["bottom-start","top-start"],maxDropdownHeight:f?null:uo,listClassName:D,renderOverlay:()=>n.jsxs("div",{id:`list-${r||H}`,role:"listbox","aria-multiselectable":t||void 0,className:lo,children:[_&&n.jsx(n.Fragment,{children:typeof _=="function"?_():_}),(f||S)&&e.length>8&&n.jsxs("div",{className:"flex items-center gap-2 px-2 pt-2",children:[f&&n.jsx(C.DialSearch,{size:p,placeholder:g,onChange:ue,value:ie,id:`search-${r||H}`,containerClassName:y.mergeClasses(C.SIZE_CONFIG[p].containerClassName,"w-full")}),S&&n.jsx(C.DialButton,{"aria-label":"Close select",className:"shrink-0",iconBefore:n.jsx(F.IconX,{size:B.DIAL_ICON_SIZE.SM}),onClick:L=>{A?.(L),Z(!1)}})]}),t&&u&&oe.length>0&&n.jsx("div",{className:le(ct,"mt-2"),children:n.jsx(er,{id:`${r||H}-selectAll`,label:v,checked:Ve,indeterminate:ot,onChange:ve,ariaLabel:v})}),n.jsx("div",{className:le("overflow-y-auto max-h-[352px]",T&&Se.length===0?"":"py-1"),children:Se.length===0?!T&&n.jsx("div",{className:"px-2 py-3",children:n.jsx(j.DialNoDataContent,{icon:I??n.jsx(F.IconClipboardX,{size:B.DIAL_ICON_SIZE.LG,stroke:.5}),title:x,description:b})}):Se.map(L=>{const se=ee.includes(L.value);return t?n.jsxs("div",{role:"option","aria-selected":se,"aria-disabled":!!L.disabled,className:le(ct,se&&co,L.disabled&&jt,"w-full"),children:[n.jsx(er,{id:`${r||H}-${L.value}`,label:n.jsxs("span",{className:"flex w-full flex-1 pl-2 min-w-0 items-center gap-2 text-primary",children:[L.icon&&n.jsx(j.DialIcon,{icon:L.icon}),n.jsx("span",{className:"truncate",children:L.labelNode??L.label})]}),checked:se,disabled:L.disabled,onChange:()=>!L.disabled&&He(L.value),ariaLabel:L.label}),L.description&&n.jsx("div",{className:"text-secondary dial-small-text",children:L.description})]},L.value):L.children?.length?n.jsx(go,{opt:L,selectedValues:ee,onSelect:He},L.value):n.jsx("button",{role:"option",type:"button","aria-selected":se,"aria-disabled":!!L.disabled,disabled:L.disabled,className:le(ct,se&&ir,L.disabled&&jt),onClick:()=>!L.disabled&&He(L.value),children:n.jsxs("div",{className:"flex items-center gap-2 w-full",children:[L.icon&&n.jsx(j.DialIcon,{icon:L.icon}),n.jsx(j.DialEllipsisTooltip,{text:L.labelNode??L.label}),L.description&&n.jsx("div",{className:"text-secondary dial-small-text",children:L.description})]})},L.value)})}),O&&n.jsx("div",{onClick:L=>{z?.(L),z&&Z(!1)},children:typeof O=="function"?O():O})]}),children:n.jsxs("div",{role:"button",tabIndex:0,"aria-roledescription":"button to open select list","aria-haspopup":"listbox","aria-expanded":X,"aria-controls":`list-${r||H}`,className:y.mergeClasses(oo,N&&"opacity-75 !cursor-not-allowed !border-primary",o===St.Sm?"min-h-[25px] px-1.5 py-1":"min-h-[38px] px-3 py-2",m&&"dial-input-error",i===Nt.Secondary?"!bg-layer-4 !h-auto":"",w),onMouseDown:L=>{N||T&&!t&&(Oe(),L.preventDefault())},onClick:()=>{Ge()},onKeyDown:L=>{(L.key===" "||L.code==="Space")&&(L.preventDefault(),Ge())},children:[T&&!t?n.jsx("div",{className:"flex min-w-0 items-center gap-2 text-primary flex-1",children:n.jsx("input",{id:`inline-${r||H}`,type:"text",placeholder:g??d,value:ie||"",onChange:L=>ue(L.currentTarget.value.trimStart()),onFocus:()=>!N&&Z(!0),onMouseDown:L=>{Oe(),L.stopPropagation()},onClick:L=>{L.stopPropagation()},onKeyDown:L=>{L.stopPropagation()},className:"bg-transparent outline-none w-full dial-small-text",ref:ce,disabled:N,"aria-disabled":N,autoComplete:"off"})}):n.jsx("div",{className:"flex w-full min-w-0 items-center gap-2 text-primary",children:Ft()}),!T&&n.jsx(j.DialIcon,{icon:po,className:le("text-primary",X&&"rotate-180")})]})})},ho=({label:e,required:t,captionDescription:r,containerClassName:s,selectClassName:a,error:i,id:o,caption:l,readonly:c,value:d,defaultEmptyText:f,...p})=>{const g=h.useCallback(()=>{if(!d||Array.isArray(d)&&d.length===0)return f??"None";if(Array.isArray(d))return n.jsx(An,{options:p.options,selectedValues:d});{const u=p.options?.find(m=>m.value===d);return n.jsx("span",{"aria-readonly":!0,className:"text-primary",children:u?.label||d})}},[d,p.options,f]);return n.jsx(C.DialFormItem,{id:o,label:e,required:t,description:l,error:i,captionDescription:r,className:s,readonly:c,value:g(),defaultEmptyText:f,children:n.jsx(Te,{className:a,value:d,elementId:o,invalid:!!i,...p})})};function _n(e){let t=null;return()=>(t==null&&(t=e()),t)}function mo(e,t){return e.filter(r=>r!==t)}function xo(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 bo{enter(t){const r=this.entered.length,s=a=>this.isNodeInDocument(a)&&(!a.contains||a.contains(t));return this.entered=xo(this.entered.filter(s),[t]),r===0&&this.entered.length>0}leave(t){const r=this.entered.length;return this.entered=mo(this.entered.filter(this.isNodeInDocument),t),r>0&&this.entered.length===0}reset(){this.entered=[]}constructor(t){this.entered=[],this.isNodeInDocument=t}}class Co{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 Rt="__NATIVE_FILE__",Ln="__NATIVE_URL__",kn="__NATIVE_TEXT__",Rn="__NATIVE_HTML__",Hr=Object.freeze(Object.defineProperty({__proto__:null,FILE:Rt,HTML:Rn,TEXT:kn,URL:Ln},Symbol.toStringTag,{value:"Module"}));function qt(e,t,r){const s=t.reduce((a,i)=>a||e.getData(i),"");return s??r}const or={[Rt]:{exposeProperties:{files:e=>Array.prototype.slice.call(e.files),items:e=>e.items,dataTransfer:e=>e},matchesTypes:["Files"]},[Rn]:{exposeProperties:{html:(e,t)=>qt(e,t,""),dataTransfer:e=>e},matchesTypes:["Html","text/html"]},[Ln]:{exposeProperties:{urls:(e,t)=>qt(e,t,"").split(`
2
+ `),dataTransfer:e=>e},matchesTypes:["Url","text/uri-list"]},[kn]:{exposeProperties:{text:(e,t)=>qt(e,t,""),dataTransfer:e=>e},matchesTypes:["Text","text/plain"]}};function vo(e,t){const r=or[e];if(!r)throw new Error(`native type ${e} has no configuration`);const s=new Co(r);return s.loadDataTransfer(t),s}function Yt(e){if(!e)return null;const t=Array.prototype.slice.call(e.types||[]);return Object.keys(or).filter(r=>{const s=or[r];return s?.matchesTypes?s.matchesTypes.some(a=>t.indexOf(a)>-1):!1})[0]||null}const yo=_n(()=>/firefox/i.test(navigator.userAgent)),Mn=_n(()=>!!window.safari);class Vr{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,f;for(;c<=d;){f=Math.floor(.5*(c+d));const u=r[f];if(u<t)c=f+1;else if(u>t)d=f-1;else return s[f]}l=Math.max(0,d);const p=t-r[l],g=p*p;return s[l]+a[l]*p+i[l]*g+o[l]*p*g}constructor(t,r){const{length:s}=t,a=[];for(let u=0;u<s;u++)a.push(u);a.sort((u,m)=>t[u]<t[m]?-1:1);const i=[],o=[];let l,c;for(let u=0;u<s-1;u++)l=t[u+1]-t[u],c=r[u+1]-r[u],i.push(l),o.push(c/l);const d=[o[0]];for(let u=0;u<i.length-1;u++){const m=o[u],v=o[u+1];if(m*v<=0)d.push(0);else{l=i[u];const x=i[u+1],b=l+x;d.push(3*b/((b+x)/m+(b+l)/v))}}d.push(o[o.length-1]);const f=[],p=[];let g;for(let u=0;u<d.length-1;u++){g=o[u];const m=d[u],v=1/i[u],x=m+d[u+1]-g-g;f.push((g-m-x)*v),p.push(x*v*v)}this.xs=t,this.ys=r,this.c1s=d,this.c2s=f,this.c3s=p}}const Io=1;function Pn(e){const t=e.nodeType===Io?e:e.parentElement;if(!t)return null;const{top:r,left:s}=t.getBoundingClientRect();return{x:s,y:r}}function xt(e){return{x:e.clientX,y:e.clientY}}function Do(e){var t;return e.nodeName==="IMG"&&(yo()||!(!((t=document.documentElement)===null||t===void 0)&&t.contains(e)))}function So(e,t,r,s){let a=e?t.width:r,i=e?t.height:s;return Mn()&&e&&(i/=window.devicePixelRatio,a/=window.devicePixelRatio),{dragPreviewWidth:a,dragPreviewHeight:i}}function No(e,t,r,s,a){const i=Do(t),l=Pn(i?e:t),c={x:r.x-l.x,y:r.y-l.y},{offsetWidth:d,offsetHeight:f}=e,{anchorX:p,anchorY:g}=s,{dragPreviewWidth:u,dragPreviewHeight:m}=So(i,t,d,f),v=()=>{let S=new Vr([0,.5,1],[c.y,c.y/f*m,c.y+m-f]).interpolate(g);return Mn()&&i&&(S+=(window.devicePixelRatio-1)*m),S},x=()=>new Vr([0,.5,1],[c.x,c.x/d*u,c.x+u-d]).interpolate(p),{offsetX:b,offsetY:I}=a,N=b===0||b,w=I===0||I;return{x:N?b:x(),y:w?I:v()}}class jo{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 To(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Kr(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){To(e,a,r[a])})}return e}class wo{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 Kr({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 Kr({anchorX:.5,anchorY:.5,captureDraggingState:!1},r||{})}isDraggingNativeItem(){const t=this.monitor.getItemType();return Object.keys(Hr).some(r=>Hr[r]===t)}beginDragNativeItem(t,r){this.clearCurrentDragSourceNode(),this.currentNativeSource=vo(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&&Pn(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=xt(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=Yt(l);if(this.monitor.isDragging()){if(l&&typeof l.setDragImage=="function"){const f=this.monitor.getSourceId(),p=this.sourceNodes.get(f),g=this.sourcePreviewNodes.get(f)||p;if(g){const{anchorX:u,anchorY:m,offsetX:v,offsetY:x}=this.getCurrentSourcePreviewNodeOptions(),N=No(p,g,o,{anchorX:u,anchorY:m},{offsetX:v,offsetY:x});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=Yt(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:xt(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=xt(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 Yt(a.dataTransfer)&&a.preventDefault();this.enterLeaveCounter.reset()},this.handleTopDrop=a=>{const{dropTargetIds:i}=this;this.dropTargetIds=[],this.actions.hover(i,{clientOffset:xt(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 jo(r,s),this.actions=t.getActions(),this.monitor=t.getMonitor(),this.registry=t.getRegistry(),this.enterLeaveCounter=new bo(this.isNodeInDocument)}}const Eo=function(t,r,s){return new wo(t,r,s)},Oo=({onChange:e,emptyTextFirstLine:t,emptyTextSecondLine:r,emptyButtonLabel:s,acceptTypes:a,maxFilesCount:i,multiple:o,fileFormatError:l,fileCountError:c,fileSizeError:d,getIsFileFormatError:f,getIsFileSizeError:p})=>{const g=h.useRef(null),u=h.useRef(null),[m,v]=h.useState([]),[x,b]=h.useState(!1),[I,N]=h.useState(!1),w=h.useCallback(U=>{const $=U.target.files;if($&&$.length>0){const H=Array.from($),q=f?.(H),K=p?.(H);q?b(!0):K?N(!0):e(H)}},[f,p,e]),D=h.useCallback(U=>i&&U?.length>i,[i]),S=h.useMemo(()=>x||I||D(m),[x,I,D,m]),_=()=>{v([]),b(!1),N(!1)},O=h.useMemo(()=>x?n.jsx(C.DialErrorText,{text:l}):I?n.jsx(C.DialErrorText,{text:d}):D(m)?n.jsx(C.DialErrorText,{text:c}):null,[c,l,d,m,D,x,I]);h.useEffect(()=>{_()},[a]);const[{isOver:A,canDrop:k},T]=xr(()=>({accept:[Rt],drop(U){const $=U.files,H=f?.($)??!1,q=p?.($)??!1,K=D?.($)??!1;if(b(H),N(q),H||q||K){v($);return}e($),_()},collect:U=>({isOver:U.isOver(),canDrop:U.canDrop()})}),[e,f,p,D]),M=U=>{(U.key==="Enter"||U.key==="Space")&&(U.preventDefault(),u.current?.click())},z=U=>{U?.preventDefault();const $=Array.from(U.dataTransfer?.items??[]);b(!!f?.($)),N(!!p?.($)),v($)},G=U=>{U.target===U.currentTarget&&_()},J=le("border border-dashed rounded w-full cursor-pointer relative h-full hover:border-hover",!k&&!S&&"border-primary",k&&(A?"border-accent-primary":"border-hover"),S&&"border-error");return T(g),n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:J,ref:g,onDragOver:z,onDragLeave:G,children:[n.jsxs("label",{htmlFor:"file",tabIndex:0,onKeyDown:M,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(C.DialPrimaryButton,{appearance:E.ButtonAppearance.Ghost,label:s,onClick:()=>u.current?.click()})]}),n.jsx("input",{multiple:o,id:"file",type:"file",ref:u,hidden:!0,accept:a,onChange:w})]}),n.jsx(n.Fragment,{children:O})]})},Ao=({iconBefore:e,className:t,...r})=>{const s=r.invalid,a=()=>n.jsx("div",{className:"mr-2",children:s?n.jsx(F.IconExclamationCircle,{...B.BASE_ICON_PROPS,className:"text-error"}):e});return n.jsx(C.DialInput,{...r,iconBefore:a(),containerClassName:le("h-[40px] p-0",s&&"h-[60px]"),className:le("rounded-r-none border-r-0",s&&"text-error",t)})},_o=({children:e,existingFiles:t,onDrop:r,getIsFileFormatError:s,getIsFileSizeError:a,maxFilesCount:i,fileFormatError:o,fileSizeError:l,fileCountError:c})=>{const d=h.useRef(null),[f,p]=h.useState(!1),[g,u]=h.useState(!1),[m,v]=h.useState(0),x=h.useCallback(()=>{p(!1),u(!1),v(0)},[]),b=h.useCallback(A=>!!(i&&t.length+A.length>i),[i,t.length]),I=f||g,[{isOver:N,canDrop:w},D]=xr(()=>({accept:[Rt],drop(A){const k=A.files,T=[...t,...k],M=s?.(k)??!1,z=a?.(k)??!1,G=b?.(k)??!1;if(p(M),u(z),M||z||G){v(k.length);return}r(T),x()},collect:A=>({isOver:A.isOver(),canDrop:A.canDrop()})}),[t,r,s,a,b,x]),S=A=>{A.preventDefault();const k=Array.from(A.dataTransfer?.items??[]);p(!!s?.(k)),u(!1),v(k.length)},_=A=>{A.target===A.currentTarget&&x()};D(d);const O=b(Array.from({length:m}));return n.jsxs("div",{className:"h-full flex flex-col",children:[n.jsx("div",{ref:d,onDragOver:S,onDragLeave:_,className:le("flex-1 min-h-0 border border-solid rounded p-2 overflow-y-auto",!I&&!O&&(w&&N?"border-accent-primary":"border-primary"),(I||O)&&"border-error"),children:e}),f&&n.jsx(C.DialErrorText,{text:o}),g&&n.jsx(C.DialErrorText,{text:l}),!f&&!g&&O&&n.jsx(C.DialErrorText,{text:c})]})},Fn=e=>{const{files:t,iconBeforeInput:r,dynamicIcon:s,onChange:a,isInvalid:i,errorText:o,removeButtonAriaLabel:l,getIsMultiFilesSizeError:c,multiFilesSizeError:d,getIsFileFormatError:f,getIsFileSizeError:p,maxFilesCount:g}=e,u=h.useCallback((x,b)=>{x.stopPropagation(),a(t?.filter(I=>I.name!==b)||[])},[a,t]),m=h.useCallback(x=>n.jsx(kt,{"aria-label":l,onClick:b=>u(b,x)}),[l,u]),v=h.useMemo(()=>n.jsx("div",{className:"flex flex-col gap-y-1",children:t?.map((x,b)=>n.jsx(Ao,{id:x.name,value:x.name,iconAfter:m(x.name),iconBefore:r||s?.(x.name),invalid:i?.(x),error:i?.(x)?o:""},x.name+b))}),[t,r,s,i,o,m]);return n.jsx(li,{backend:Eo,children:!t||t.length===0?n.jsx(Oo,{...e,onChange:a}):n.jsxs(n.Fragment,{children:[n.jsx(_o,{existingFiles:t,onDrop:a,getIsFileFormatError:f,getIsFileSizeError:p,maxFilesCount:g,fileFormatError:e.fileFormatError,fileSizeError:e.fileSizeError,fileCountError:e.fileCountError,children:v}),c?.(t)&&n.jsx(C.DialErrorText,{text:d})]})})},Lo=({onChange:e,fieldTitle:t,elementId:r,files:s,maxFilesCount:a,maxFileSize:i,maxMultiFilesSize:o,fileFormatError:l,fileCountError:c,fileSizeError:d,multiFilesSizeError:f,multiple:p=!0,acceptTypes:g,deleteAllButtonLabel:u,addButtonLabel:m,additionalActionButtons:v,...x})=>{const b=h.useRef(null),I=()=>b.current?.click(),N=()=>{e([])},w=h.useCallback(O=>O?.some(A=>!(g==="/"||g?.toLowerCase()?.includes(A?.type?.toLowerCase()))),[g]),D=h.useCallback(O=>{if(!i)return!1;const A=i*(1024*1024);return O?.some(k=>{const T=k.size;return!!T&&T>A})},[i]),S=h.useCallback(O=>{if(!o||!p)return!1;const A=o*1024*1024;return O.reduce((T,M)=>T+M.size,0)>A},[o,p]),_=h.useCallback(O=>{const A=O.target.files;if(A&&A.length>0){const k=Array.from(A),T=w(k),M=D(k);!T&&!M&&e([...s||[],...k])}},[w,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(Re.DialLabel,{label:`${t}: ${p?s?.length||0:""}`,htmlFor:r}),p&&!!s?.length&&n.jsxs("div",{className:"flex flex-row items-center gap-x-2",children:[n.jsx(C.DialNeutralButton,{label:u,iconBefore:n.jsx(F.IconTrashX,{...B.BASE_ICON_PROPS}),onClick:N}),(a?a>s?.length:!0)&&n.jsx(C.DialPrimaryButton,{appearance:E.ButtonAppearance.Ghost,iconBefore:n.jsx(F.IconPlus,{...B.BASE_ICON_PROPS}),label:m,onClick:I}),v]})]}),s&&s.length>0&&n.jsx("input",{id:"file",type:"file",multiple:p,ref:b,hidden:!0,accept:g,onChange:_}),n.jsx(Fn,{files:s,onChange:e,acceptTypes:g,maxFilesCount:a,multiple:p,fileFormatError:l,fileCountError:c,fileSizeError:d,multiFilesSizeError:f,getIsFileFormatError:w,getIsFileSizeError:D,getIsMultiFilesSizeError:S,...x})]})},ko=({icon:e,ariaLabel:t,size:r=E.ElementSize.Standard,disabled:s=!1,className:a,buttonClassName:i,iconClassName:o,caretIcon:l=n.jsx(F.IconChevronDown,{size:B.DIAL_ICON_SIZE.SM}),showCaret:c=!0,placement:d="bottom-start",matchReferenceWidth:f=!1,open:p,onOpenChange:g,defaultOpen:u=!1,...m})=>{const v=r===E.ElementSize.Small,[x,b]=h.useState(u),I=p??x,N=v?"w-8 px-0":"w-10 px-0",w={[E.ElementSize.Small]:"size-5",[E.ElementSize.Standard]:"size-6",[E.ElementSize.Large]:"size-7"},D=S=>{b(S),g?.(S)};return n.jsx(j.DialDropdown,{...m,disabled:s,placement:d,matchReferenceWidth:f,className:a,open:I,onOpenChange:D,defaultOpen:u,children:n.jsxs("button",{type:"button","aria-label":t,disabled:s,className:y.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",v?"h-8 px-2":"h-10 px-2",c?void 0:N,i),children:[n.jsx(j.DialIcon,{icon:e,className:y.mergeClasses("flex items-center justify-center text-inherit",w[r],c&&"-mr-2",o,j.DIAL_KIT_CLASS.dropdownIcon)}),c&&n.jsxs("div",{className:y.mergeClasses("relative z-10 inline-grid size-5 shrink-0 place-items-center",j.DIAL_KIT_CLASS.dropdownIconCaret),children:[n.jsx("div",{className:"absolute inset-0 rounded-full bg-layer-2"}),n.jsx(j.DialIcon,{icon:l,className:y.mergeClasses("relative flex items-center justify-center text-secondary transition-transform group-hover:text-primary group-disabled:text-controls-secondary-disable",I&&"rotate-180")})]})]})})},Ro="application/octet-stream";function Mo(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=Xt(s,!0),i=e.filter(c=>c!==r).map(c=>{const d=c.path||c.url||"",f=Po(c.nodeType),p=f===C.DialFileNodeType.FOLDER,g=Xt(d,p);let u;return c.parentPath===null||c.parentPath===void 0?u=a:c.parentPath===""?u="":u=Xt(c.parentPath,!0),{...c,originalPath:d,path:g,parentPath:u,nodeType:f}}),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===C.DialFileNodeType.FOLDER?[]:void 0};c.nodeType===C.DialFileNodeType.ITEM&&(d.extension=Bo(c.name),d.contentType=c.contentType||Ro,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||""),f=c.path.slice(0,d),p=o.get(f);p&&p.nodeType===C.DialFileNodeType.FOLDER?(p.items=p.items||[],p.items.push(c)):l.push(c)}}),l}function Xt(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 Po(e){return e.toUpperCase()==="FOLDER"?C.DialFileNodeType.FOLDER:C.DialFileNodeType.ITEM}function Fo(e){if(!e)return;const t=e.toUpperCase();return Object.values(C.DialFileResourceType).find(s=>s.toUpperCase()===t)}function Bo(e){const t=e.split(".");return t.length>1?t[t.length-1]:""}function zo(e,t="Prompts",r="prompts/public/",s="root"){const a=Mo(e,s);return[{id:s,name:t,path:r,parentPath:"",nodeType:C.DialFileNodeType.FOLDER,folderId:s,items:a}]}const Bn=({locale:e,timeZone:t,date:r=new Date}={})=>{const s=t??Intl.DateTimeFormat().resolvedOptions().timeZone;try{const a=new Intl.DateTimeFormat(e,{timeZone:s,timeZoneName:"longOffset"}).formatToParts(r).find(i=>i.type==="timeZoneName")?.value;return a?`(${a}) ${s}`:s}catch{return s}};var nt=(e=>(e.Sections="sections",e.Flat="flat",e.FlatSections="flat-sections",e))(nt||{}),ut=(e=>(e.Select="select",e.Radio="radio",e))(ut||{}),Mt=(e=>(e.Row="row",e.Column="column",e))(Mt||{}),V=(e=>(e.String="string",e.Number="number",e.Integer="integer",e.Boolean="boolean",e.Object="object",e.Array="array",e.Null="null",e))(V||{});const $o={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",typeColumnHeader:"Type",entryTypeString:"String",entryTypeNumber:"Number",entryTypeBoolean:"Boolean",entryTypeNull:"Null",entryTypeObject:"Object",entryTypeArray:"Array",entryTypeChangeWarning:"Changing type will reset the current value.",booleanTrueOption:"True",booleanFalseOption:"False",invalidJsonError:"Invalid JSON"},zn=h.createContext(null);function we(){const e=h.useContext(zn);if(!e)throw new Error("useSchemaContext must be used inside DialSchemaRenderer");return e}function Gr(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 Q(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 f of a)i=i?.[f];if(!i||typeof i!="object")return e;const{$ref:o,...l}=s,c=i;s={...c.$ref?Q(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=Gr(o,Q(l,t,r+1));s=Gr(o,i)}return s}function $n(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 Pt(e){return e==null||e===""}function Qe(e){return e.type===V.Object||e.properties!=null&&e.oneOf==null&&e.anyOf==null&&e.type==null}function Tt(e){return e.replace(/_/g," ").replace(/([a-z])([A-Z])/g,"$1 $2").replace(/\b\w/g,t=>t.toUpperCase())}const br=e=>`"${e}" is required`;function Hn(e,t){return e.type===V.Null?"null":e.$ref?Q(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 Le(e,t,r=0){if(r>15)return;const s=Q(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=Q({$ref:s.discriminator.mapping[a]},t);return{...Le(i,t,r+1)??{},[s.discriminator.propertyName]:a}}}if(Qe(s)){if(s.properties){const a={};let i=!1;for(const[o,l]of Object.entries(s.properties)){const c=Le(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 _e(e,t,r,s="",a=0){if(a>15)return[];const i=[],o=Q(t,r);if(o.anyOf){const d=o.anyOf.filter(f=>f.type!==V.Null);return e!=null&&d.length===1?_e(e,d[0],r,s,a+1):i}if(o.oneOf&&o.discriminator){const d=o.discriminator.propertyName,f=e?.[d];if(f&&o.discriminator.mapping[f]){const p={$ref:o.discriminator.mapping[f]},g=Q(p,r);return _e(e,g,r,s,a+1)}return i}if(o.type===V.Array||!o.type&&Array.isArray(e)){if(Array.isArray(e)&&o.items)for(let d=0;d<e.length;d++){const f=_e(e[d],o.items,r,`${s}[${d}]`,a+1);i.push(...f)}return i}if(!Qe(o))return i;const l=o.required??[],c=e;for(const d of l){const f=o.properties?.[d];if(f&&Q(f,r).isHidden)continue;const p=s?`${s}.${d}`:d,g=c?.[d];if(Pt(g)){const u=f?.title??Tt(d);i.push({path:p,message:br(u)})}}if(c&&o.properties)for(const[d,f]of Object.entries(o.properties)){if(Q(f,r).isHidden)continue;const p=s?`${s}.${d}`:d,g=c[d];if(g!=null){const u=_e(g,f,r,p,a+1);i.push(...u)}}if(c&&o.additionalProperties!=null&&o.additionalProperties!==!1&&typeof o.additionalProperties=="object"){const d=o.additionalProperties;for(const[f,p]of Object.entries(c)){const g=s?`${s}.${f}`:f,u=_e(p,d,r,g,a+1);i.push(...u)}}return i}function Cr(e,t,r){const s=Q(t,r);if(Array.isArray(e))return`${e.length} item${e.length!==1?"s":""}`;if(Qe(s)&&s.properties){const a=Object.entries(s.properties).filter(([,c])=>!Q(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 Ho(e,t,r){if(e==null){const s=t.findIndex(a=>a.type===V.Null);return s>=0?s:0}if(Array.isArray(e)){const s=t.findIndex(a=>Q(a,r).type===V.Array);return s>=0?s:0}if(typeof e=="boolean"){const s=t.findIndex(a=>Q(a,r).type===V.Boolean);return s>=0?s:0}if(typeof e=="number"){const s=t.findIndex(a=>{const i=Q(a,r);return i.type===V.Number||i.type===V.Integer});return s>=0?s:0}if(typeof e=="string"){const s=t.findIndex(a=>Q(a,r).type===V.String);return s>=0?s:0}if(typeof e=="object"){const s=e;for(let a=0;a<t.length;a++){const i=Q(t[a],r);if(i.discriminator&&i.discriminator.propertyName in s)return a}for(let a=0;a<t.length;a++){const i=Q(t[a],r);if(Qe(i)||i.oneOf)return a}return 0}return 0}function Vo(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 Vn(e){switch(Array.isArray(e.type)?e.type[0]:e.type){case V.String:return"";case V.Boolean:return!1;case V.Array:return[];case V.Integer:case V.Number:return;default:return{}}}const Ko=[V.String,V.Number,V.Boolean,V.Null,V.Object,V.Array];function Go(e){return Array.isArray(e)?V.Array:typeof e=="object"&&e!==null?V.Object:typeof e=="boolean"?V.Boolean:typeof e=="number"?V.Number:e===null?V.Null:V.String}const Uo={[V.String]:"",[V.Number]:0,[V.Boolean]:!1,[V.Null]:null,[V.Object]:{},[V.Array]:[]};function Zo(e){return Uo[e]}const ft=({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,f]=h.useState(l),p=a===0,g="rounded border border-secondary",u=y.mergeClasses("flex items-center gap-2 cursor-pointer select-none transition-colors",p?"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=y.mergeClasses("border-t border-secondary",p?"p-4":"p-3");return n.jsxs("div",{className:g,children:[n.jsxs("div",{className:u,onClick:()=>f(v=>!v),role:"button","aria-expanded":d,children:[n.jsx("span",{className:"shrink-0 text-secondary",children:d?n.jsx(F.IconChevronDown,{size:16,stroke:2}):n.jsx(F.IconChevronRight,{size:16,stroke:2})}),n.jsx("span",{className:y.mergeClasses("flex-1 truncate",p?"dial-small-semi-text text-primary":"dial-small-text text-primary"),children:e}),t&&n.jsx(Re.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(j.DialIcon,{icon:n.jsx(F.IconAlertTriangle,{size:13,stroke:2})}),s," error",s>1?"s":""]}):n.jsx(j.DialIcon,{icon:n.jsx(F.IconCheck,{size:13,stroke:2}),className:"text-success shrink-0"}),o&&n.jsx(kt,{size:E.ElementSize.Small,onClick:v=>{v.stopPropagation(),o()},"aria-label":c,className:"ml-1 shrink-0 p-0.5"})]}),d&&n.jsx("div",{className:m,children:i})]})},Kn=({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:f=!1}=we(),p=Q(e,l),g=Qe(p),u=p.type===V.Array;if(g||u){const x=Cr(t,p,l),b=_e(t,p,l,s.join(".")),I=s.join("."),N=I+".",w=!f||d.has(I)||[...d].some(D=>D.startsWith(N));return n.jsx(ft,{title:o??p.title??s[s.length-1]??"Section",description:p.description,level:a,summary:x,errorCount:w?b.length:0,defaultExpanded:c,children:n.jsx(ke,{schema:p,value:t,onChange:r,path:s,level:a+1,required:i})})}const v=(!f||d.has(s.join(".")))&&i&&Pt(t)?br(o??"Field"):void 0;return n.jsx(C.DialFormItem,{label:o,required:i,description:p.description,error:v,children:n.jsx(ke,{schema:p,value:t,onChange:r,path:s,level:a,required:i,suppressInlineError:!0})})},Dt=({schema:e,value:t,onChange:r,path:s,level:a})=>{const{rootSchema:i,texts:o}=we(),l=Q(e,i),c=$n(Object.entries(l.properties??{}).filter(([,p])=>!Q(p,i).isHidden)),d=l.required??[],f=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(([p,g])=>{const m=Q(g,i).title??g.title??Tt(p),v=d.includes(p);return n.jsx(Kn,{schema:g,value:f[p],onChange:x=>r({...f,[p]:x}),path:[...s,p],level:a,required:v,label:m},p)})})},Wo=({schema:e,value:t,onChange:r,path:s,level:a})=>{const{rootSchema:i,texts:o,readonly:l=!1,defaultExpanded:c=!0}=we(),d=Array.isArray(t)?t:[],f=e.items,[p,g]=h.useState(void 0);if(!f)return n.jsx("p",{className:"dial-tiny-text text-secondary italic",children:o.noItemSchema});const u=h.useMemo(()=>Q(f,i),[f,i]),m=h.useMemo(()=>u.discriminator,[u]),v=h.useMemo(()=>m?.propertyName,[m]),x=h.useMemo(()=>m?Object.keys(m.mapping).map(w=>({value:w,label:w})):[],[m]),b=()=>{const w=p??x[0]?.value;let D;if(m&&w){const S=Q({$ref:m.mapping[w]},i);D={...Le(S,i)??{},[m.propertyName]:w}}else D=Le(u,i)??Vn(u);r([...d,D])},I=w=>{r(d.filter((D,S)=>S!==w))},N=(w,D)=>{r(d.map((S,_)=>_===w?D:S))};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((w,D)=>{const S=Vo(w,v,D),_=Cr(w,u,i),O=_e(w,u,i,`${s.join(".")}[${D}]`);return n.jsx(ft,{title:S,level:a,summary:_,errorCount:O.length,onRemove:l?void 0:()=>I(D),defaultExpanded:c,removeItemAriaLabel:o.removeItemAriaLabel,children:n.jsx(ke,{schema:f,value:w,onChange:A=>N(D,A),path:[...s,String(D)],level:a+1})},D)}),!l&&n.jsxs("div",{className:"flex items-center gap-2 pt-1",children:[x.length>0&&n.jsx("div",{className:"flex-1 max-w-[280px]",children:n.jsx(Te,{options:x,value:p??x[0]?.value,placeholder:o.selectTypeToAdd,onChange:w=>{const D=typeof w=="string"?w:w[0];g(D)}})}),n.jsx(C.DialGhostButton,{label:o.addItem,iconBefore:n.jsx(F.IconPlus,{size:16,stroke:2}),onClick:b})]})]})},qo=({schema:e,value:t,onChange:r,path:s,level:a})=>{const{rootSchema:i,texts:o,readonly:l=!1}=we(),c=h.useId(),d=e.discriminator;if(d){const x=d.propertyName,b=d.mapping,I=Object.keys(b).map(S=>({value:S,label:S})),N=typeof t=="object"&&t!==null?t[x]:void 0,w=N?Q({$ref:b[N]},i):void 0,D=S=>{const _=Q({$ref:b[S]},i),O=Le(_,i)??{};r({...O,[x]:S})};if(e.discriminatorDisplay===ut.Radio){const S=e.discriminatorOrientation===Mt.Row,_=N?(()=>{const O=Q({$ref:b[N]},i),{[x]:A,...k}=O.properties??{};return{...O,properties:k}})():void 0;return S?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(b).map(O=>{const A=Q({$ref:b[O]},i);return n.jsx(j.DialRadioButton,{name:c,value:O,inputId:`${c}-${O}`,label:A.title??O,checked:N===O,disabled:l,onChange:()=>D(O)},O)})}),_&&n.jsx(Dt,{schema:_,value:t,onChange:r,path:s,level:a})]}):n.jsx("div",{role:"radiogroup",className:"flex flex-col gap-2",children:Object.keys(b).map(O=>{const A=Q({$ref:b[O]},i),k=N===O,{[x]:T,...M}=A.properties??{},z={...A,properties:M};return n.jsxs("div",{className:"flex flex-col",children:[n.jsx(j.DialRadioButton,{name:c,value:O,inputId:`${c}-${O}`,label:A.title??O,checked:k,disabled:l,onChange:()=>D(O)}),k&&n.jsx("div",{className:"ml-6 mt-2",children:n.jsx(Dt,{schema:z,value:t,onChange:r,path:s,level:a})})]},O)})})}return n.jsxs("div",{className:"flex flex-col gap-3",children:[n.jsx("div",{className:"flex-1 max-w-[280px]",children:n.jsx(Te,{options:I,value:N,placeholder:o.selectTypePlaceholder,disabled:l,onChange:S=>{const _=typeof S=="string"?S:S[0];_&&D(_)}})}),w&&n.jsx("div",{className:"pl-3",children:n.jsx(Dt,{schema:w,value:t,onChange:r,path:s,level:a})})]})}const f=e.oneOf??[],g=(()=>{if(t==null)return 0;if(typeof t=="object"&&!Array.isArray(t)){for(let x=0;x<f.length;x++)if(Q(f[x],i).required?.every(I=>I in t))return x}return 0})(),u=x=>{const b=Q(f[x],i),I=Le(b,i);r(I??null)},m=f[g];if(e.discriminatorDisplay===ut.Radio)return n.jsx("div",{role:"radiogroup",className:"flex flex-col gap-2",children:f.map((x,b)=>{const I=Q(x,i),N=Hn(x,i)??`Option ${b+1}`,w=g===b;return n.jsxs("div",{className:"flex flex-col",children:[n.jsx(j.DialRadioButton,{name:c,value:String(b),inputId:`${c}-${b}`,label:N,checked:w,disabled:l,onChange:()=>u(b)}),w&&I&&n.jsx("div",{className:"ml-6 mt-2",children:n.jsx(ke,{schema:I,value:t,onChange:r,path:s,level:a})})]},b)})});const v=f.map((x,b)=>{const I=Q(x,i);return{value:String(b),label:I.title??`Option ${b+1}`}});return n.jsxs("div",{className:"flex flex-col gap-3",children:[n.jsx("div",{className:"flex-1 max-w-[280px]",children:n.jsx(Te,{options:v,value:String(g),disabled:l,onChange:x=>{const b=typeof x=="string"?x:x[0];u(Number(b))}})}),m&&n.jsx("div",{className:"pl-3 border-l-2 border-secondary",children:n.jsx(ke,{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}=we(),l=e.anyOf??[],c=l.map((m,v)=>({value:String(v),label:Hn(m,i)})),d=Ho(t,l,i),f=l[d],g=Q(f,i).type===V.Null,u=m=>{const v=Q(l[m],i);if(v.type===V.Null){r(null);return}const x=Le(v,i);if(x!==void 0){r(x);return}switch(v.type){case V.Array:r([]);break;case V.String:r("");break;case V.Boolean:r(!1);break;case V.Integer:case V.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(Te,{options:c,value:String(d),disabled:o,onChange:m=>{const v=typeof m=="string"?m:m[0];u(Number(v))}})}),!g&&f&&n.jsx("div",{className:"pl-3 border-l-2 border-secondary",children:n.jsx(ke,{schema:f,value:t,onChange:r,path:s,level:a})})]})},Gn=({schema:e,value:t,onChange:r,invalid:s})=>{const a=h.useId(),{texts:i,readonly:o=!1,inputClassName:l,acceptableResourceTypes:c}=we(),d=e.const!==void 0,f=Array.isArray(e.enum)&&e.enum.length>0;if(e["dial:resource"]===!0&&Array.isArray(e.acceptableResourceTypes)&&e.acceptableResourceTypes.length>0&&(e.type===V.String||e.type===void 0)){const g=(e.acceptableResourceTypes??[]).flatMap(u=>{const m=c?.[u];return Array.isArray(m)?m.map(v=>{const x=String(v);return{value:x,label:x}}):[]});return n.jsx(Te,{options:g,value:t!=null?String(t):void 0,invalid:s,disabled:o,onChange:u=>r(typeof u=="string"?u:u[0]),placeholder:i.enumSelectPlaceholder,className:l})}if(d)return n.jsx(C.DialInput,{value:String(e.const??""),disabled:!0,onChange:void 0,className:"opacity-60"});if(f&&e.enumDisplay===ut.Radio){const g=e.enumOrientation===Mt.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(u=>{const m=String(u);return n.jsx(j.DialRadioButton,{name:a,value:m,inputId:`${a}-${m}`,label:m,checked:t!=null?String(t)===m:!1,disabled:o,onChange:v=>r(v)},m)})})}if(f){const g=e.enum.map(u=>({value:String(u),label:String(u)}));return n.jsx(Te,{options:g,value:t!=null?String(t):void 0,invalid:s,disabled:o,onChange:u=>r(typeof u=="string"?u:u[0]),placeholder:i.enumSelectPlaceholder})}switch(e.type){case V.Boolean:return n.jsx(Re.DialSwitch,{switchId:a,isOn:!!t,disabled:o,onChange:g=>r(g)});case V.Integer:return n.jsx(ar,{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 V.Number:return n.jsx(ar,{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(On,{value:t!=null?String(t):"",invalid:s,disabled:o,onChange:g=>r(g??void 0),placeholder:i.stringInputPlaceholder,containerClassName:l}):n.jsx(C.DialInput,{value:t!=null?String(t):"",invalid:s,disabled:o,onChange:g=>r(g??void 0),placeholder:i.stringInputPlaceholder,containerClassName:l})}},vr=({value:e,onChange:t,theme:r=ht.EditorThemes.dark,height:s=240})=>{const{readonly:a,texts:i}=we(),[o,l]=h.useState(null),[c,d]=h.useState(()=>JSON.stringify(e,null,2));h.useEffect(()=>{typeof window<"u"&&Promise.resolve().then(()=>require("./JsonEditor-BDe6elKO.cjs")).then(g=>{l(()=>g.DialJsonEditor)})},[]);let f=!1;try{JSON.parse(c)}catch{f=!0}const p=g=>{const u=g??"";d(u);try{t(JSON.parse(u))}catch{}};return n.jsxs("div",{children:[n.jsx("div",{className:"border border-primary rounded",style:{height:`${s}px`},children:o&&n.jsx(o,{value:c,currentTheme:r,onChange:p,options:{readOnly:a}})}),n.jsx(C.DialErrorText,{text:f?i.invalidJsonError:void 0})]})},Ur=(e,t)=>({id:Math.random().toString(36).slice(2),key:e,value:t}),Un=e=>!!(e.oneOf||e.anyOf||e.type===V.Array||Qe(e)),Xo={[V.String]:"entryTypeString",[V.Number]:"entryTypeNumber",[V.Boolean]:"entryTypeBoolean",[V.Null]:"entryTypeNull",[V.Object]:"entryTypeObject",[V.Array]:"entryTypeArray"},Qo=({pairId:e,pairKey:t,pairValue:r,valueSchema:s,isUnschematizedValue:a,jsonEditorTheme:i,onKeyChange:o,onValueChange:l,onRemove:c,keyInputPlaceholder:d,removeFieldAriaLabel:f,path:p,level:g,readonly:u=!1,inputClassName:m})=>{const{rootSchema:v,texts:x,defaultExpanded:b=!0,touchedPaths:I=new Set,markTouched:N=()=>{},skipUntouched:w=!1}=we(),[D,S]=h.useState(t),_=Un(s),[O,A]=h.useState(()=>Go(r)),k=a&&(O===V.Object||O===V.Array),T=a&&O===V.Null,M=_||k,z=[...p,e,"key"].join("."),J=(!w||I.has(z))&&t==="",U=h.useCallback(ne=>{l(Zo(ne)),A(ne)},[l]),$=h.useMemo(()=>Ko.map(ne=>({value:ne,label:x[Xo[ne]]})),[x]),H=h.useMemo(()=>[{value:"true",label:x.booleanTrueOption},{value:"false",label:x.booleanFalseOption}],[x]),q=`${e}-key-error`,K=a&&O===V.Boolean,ae=n.jsxs("div",{className:"flex gap-2 items-start",children:[n.jsxs("div",{className:M?"flex-1 min-w-0":"w-2/5 min-w-0",children:[n.jsx(C.DialInput,{value:D,disabled:u,invalid:J,"aria-describedby":J?q:void 0,onChange:ne=>S(ne??""),onBlur:()=>{N(z),D!==t&&o(D)},placeholder:d,containerClassName:m}),n.jsx(C.DialErrorText,{id:q,text:J?`${x.keyColumnHeader} is required`:void 0})]}),!_&&!k&&n.jsx("div",{className:"flex-1 min-w-0",children:T?n.jsx(C.DialInput,{value:"null",disabled:!0,onChange:void 0,className:"opacity-60"}):K?n.jsx(Te,{options:H,value:r?"true":"false",disabled:u,onChange:ne=>{const ce=typeof ne=="string"?ne:ne[0];ce&&l(ce==="true")}}):n.jsx(Gn,{schema:a?{type:O}:s,value:r,onChange:l})}),a&&n.jsx("div",{className:"w-28 shrink-0",children:n.jsx(E.DialTooltip,{tooltip:x.entryTypeChangeWarning,triggerClassName:"block",children:n.jsx(Te,{options:$,value:O,disabled:u,onChange:ne=>{const ce=typeof ne=="string"?ne:ne[0];ce&&U(ce)}})})}),!u&&n.jsx(kt,{size:E.ElementSize.Small,onClick:c,"aria-label":f,className:"shrink-0 p-1"})]});if(!M)return ae;if(k)return n.jsxs("div",{className:"flex flex-col gap-2",children:[ae,n.jsx(vr,{value:r,onChange:l,theme:i},O)]});const X=[...p,t],Z=Cr(r,s,v),ie=_e(r,s,v,X.join("."));return n.jsxs("div",{className:"flex flex-col gap-2",children:[ae,n.jsx(ft,{title:t,level:g,summary:Z,errorCount:ie.length+(J?1:0),defaultExpanded:b,children:n.jsx(ke,{schema:s,value:r,onChange:l,path:X,level:g+1})})]})},Jo=({schema:e,value:t,onChange:r,path:s,level:a})=>{const{rootSchema:i,texts:o,readonly:l=!1,inputClassName:c,jsonEditorTheme:d}=we(),f=e.additionalProperties===!0||e.additionalProperties==null,p=f?{type:"string"}:typeof e.additionalProperties=="object"?Q(e.additionalProperties,i):{type:"string"},g=Un(p),[u,m]=h.useState(()=>Object.entries(t??{}).map(([D,S])=>Ur(D,S))),v=D=>Object.fromEntries(D.filter(S=>S.key!=="").map(S=>[S.key,S.value])),x=(D,S)=>{const _=u.map((O,A)=>A===D?{...O,key:S}:O);m(_),r(v(_))},b=(D,S)=>{const _=u.map((O,A)=>A===D?{...O,value:S}:O);m(_),r(v(_))},I=()=>g?Le(p,i)??Vn(p):"",N=()=>{m(D=>[...D,Ur("",I())])},w=D=>{const S=u.filter((_,O)=>O!==D);m(S),r(v(S))};return n.jsxs("div",{className:"flex flex-col gap-2",children:[u.length===0&&n.jsx("p",{className:"dial-tiny-text text-secondary italic",children:o.noFieldsYet}),u.length>0&&!g&&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&&n.jsx("span",{className:"w-28 shrink-0 dial-tiny-text text-secondary font-medium",children:o.typeColumnHeader})]}),u.map((D,S)=>n.jsx(Qo,{pairId:D.id,pairKey:D.key,pairValue:D.value,valueSchema:p,isUnschematizedValue:f,jsonEditorTheme:d,onKeyChange:_=>x(S,_),onValueChange:_=>b(S,_),onRemove:()=>w(S),keyInputPlaceholder:o.keyInputPlaceholder,removeFieldAriaLabel:o.removeFieldAriaLabel,path:s,level:a,readonly:l,inputClassName:c},D.id)),!l&&n.jsx("div",{className:"pt-1",children:n.jsx(C.DialGhostButton,{label:o.addField,iconBefore:n.jsx(F.IconPlus,{size:16,stroke:2}),onClick:N})})]})},ke=({schema:e,value:t,onChange:r,path:s,level:a,required:i,suppressInlineError:o=!1})=>{const{rootSchema:l,renderField:c,markTouched:d=()=>{},touchedPaths:f=new Set,skipUntouched:p=!1,jsonEditorTheme:g}=we(),u=Q(e,l),m=b=>{d(s.join(".")),r(b)},v=!p||f.has(s.join("."));let x;if(u.oneOf)x=n.jsx(qo,{schema:u,value:t,onChange:m,path:s,level:a});else if(u.anyOf&&u.type!==V.Object)x=n.jsx(Yo,{schema:u,value:t,onChange:m,path:s,level:a});else if(Qe(u)){const b=u.additionalProperties!=null&&u.additionalProperties!==!1,I=!u.properties||Object.keys(u.properties).length===0;b&&I?x=n.jsx(Jo,{schema:u,value:t,onChange:m,path:s,level:a}):I&&u.additionalProperties!==!1?x=n.jsx(vr,{value:t,onChange:m,theme:g}):x=n.jsx(Dt,{schema:u,value:t,onChange:m,path:s,level:a})}else if(u.type===V.Array)x=n.jsx(Wo,{schema:u,value:t,onChange:m,path:s,level:a});else{const b=v&&i&&Pt(t),I=!o&&b?br(u.title??"Field"):void 0;x=n.jsxs(n.Fragment,{children:[n.jsx(Gn,{schema:u,value:t,onChange:m,invalid:b}),n.jsx(C.DialErrorText,{text:I})]})}return c?c(s,u,x):x},el=({schema:e,defaultValue:t,texts:r,className:s,readonly:a=!1,defaultExpanded:i=!0,inputClassName:o,variant:l=nt.Sections,onChange:c,onPropertyChange:d,onDefaultValues:f,renderField:p,skipUntouched:g=!1,jsonEditorTheme:u,acceptableResourceTypes:m})=>{const v=h.useMemo(()=>({...$o,...r}),[r]),x=h.useMemo(()=>t||(Le(e,e)??{}),[]),[b,I]=h.useState(x),[N,w]=h.useState(new Set),D=h.useCallback(T=>{w(M=>M.has(T)?M:new Set([...M,T]))},[]);h.useEffect(()=>{f?.(x)},[]);const S=(T,M)=>{const z={...b,[T]:M};I(z),c?.(z),d?.(T,M)},_=new Set(Object.keys(e.properties??{})),O=Object.keys(b).filter(T=>!_.has(T)),A=$n(Object.entries(e.properties??{}).filter(([,T])=>!Q(T,e).isHidden)),k=e.required??[];return n.jsx(zn.Provider,{value:{rootSchema:e,texts:v,readonly:a,defaultExpanded:i,inputClassName:o,jsonEditorTheme:u,acceptableResourceTypes:m,renderField:p,touchedPaths:N,markTouched:D,skipUntouched:g},children:n.jsxs("div",{className:y.mergeClasses("flex flex-col gap-4",s),children:[A.map(([T,M])=>{const z=Q(M,e),G=z.title??M.title??Tt(T),J=k.includes(T),U=b[T];if(l===nt.Flat)return n.jsx(Kn,{schema:M,value:U,onChange:K=>S(T,K),path:[T],level:0,required:J,label:G},T);if(l===nt.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(ke,{schema:M,value:U,onChange:K=>S(T,K),path:[T],level:0,required:J})]},T);const $=_e(U,z,e,T),H=T+".",q=!g||N.has(T)||[...N].some(K=>K.startsWith(H));return n.jsx(ft,{title:G,description:z.description,level:0,defaultExpanded:i,errorCount:q?J&&Pt(U)?Math.max($.length,1):$.length:0,children:n.jsx(ke,{schema:M,value:U,onChange:K=>S(T,K),path:[T],level:1,required:J})},T)}),O.map(T=>{const M=Tt(T),z=n.jsx(vr,{value:b[T],onChange:G=>S(T,G),theme:u});return l===nt.Sections?n.jsx(ft,{title:M,level:0,defaultExpanded:i,children:z},T):n.jsxs("div",{className:"flex flex-col gap-3",children:[n.jsx("h2",{className:"dial-small-semi-text text-primary",children:M}),z]},T)})]})})},tl=e=>({info:n.jsx(F.IconInfoCircleFilled,{size:e.size}),error:n.jsx(F.IconAlertCircleFilled,{size:e.size}),warning:n.jsx(F.IconAlertTriangleFilled,{size:e.size}),success:n.jsx(F.IconCircleCheckFilled,{size:e.size}),loading:n.jsx(C.Spinner,{size:e.size}),general:n.jsx(F.IconCheck,{size:e.size,stroke:e.stroke})}),rl={[C.NotificationVariant.Info]:"bg-info text-info",[C.NotificationVariant.Success]:"bg-success text-success",[C.NotificationVariant.Warning]:"bg-warning text-warning",[C.NotificationVariant.Error]:"bg-error text-error",[C.NotificationVariant.Loading]:"bg-layer-raised text-info",[C.NotificationVariant.General]:"bg-layer-sunken text-primary"},nl={[C.NotificationVariant.Info]:"status",[C.NotificationVariant.Success]:"status",[C.NotificationVariant.Warning]:"alert",[C.NotificationVariant.Error]:"alert",[C.NotificationVariant.Loading]:"status",[C.NotificationVariant.General]:"status"},sl="items-center justify-between rounded-xl relative gap-3 p-3 border flex border-transparent",yr=({variant:e=C.NotificationVariant.Info,type:t=C.NotificationType.Toast,title:r,message:s,action:a,className:i,iconSize:o=24,iconStroke:l=2,closable:c=!1,onClose:d,children:f,textClassName:p,...g})=>{const u=h.useMemo(()=>tl({size:o,stroke:l})[e],[e,o,l]),m=p??(t===C.NotificationType.SectionMessage?"flex-row flex-wrap items-baseline gap-x-1":"flex-col");return n.jsxs("div",{role:nl[e],...g,className:y.mergeClasses(sl,rl[e],t===C.NotificationType.Toast&&"min-w-[200px] max-w-[600px] shadow-lg",t===C.NotificationType.SectionMessage&&e===C.NotificationVariant.Loading&&"border-secondary",i,j.DIAL_KIT_CLASS.notification),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(j.DialIcon,{icon:u})}),r?n.jsxs("div",{className:y.mergeClasses("flex min-w-0 text-primary break-words",m),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})]}),a!=null&&n.jsx("div",{className:"flex shrink-0 items-center",children:a}),f,c&&n.jsx(R.CloseButton,{className:"shrink-0 self-start",ariaLabel:"Close notification",onClose:v=>d?.(v)})]})},Zr={2:"line-clamp-2",3:"line-clamp-3",4:"line-clamp-4",5:"line-clamp-5",6:"line-clamp-6"},al=e=>e===1?"!truncate !whitespace-nowrap":`${Zr[e]??Zr[2]} !whitespace-normal`,il=({text:e,query:t,markClassName:r,className:s,maxLines:a=2})=>{const i=y.mergeClasses(al(a),s,j.DIAL_KIT_CLASS.highlight);if(!t.trim())return n.jsx(R.EllipsisTooltip,{className:i,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:y.mergeClasses("text-accent bg-control-accent-alpha-hover",r),children:e.slice(o,o+t.length)}),e.slice(o+t.length)]});return n.jsx(R.EllipsisTooltip,{className:i,text:l})},ol=({className:e,children:t,...r})=>n.jsx("article",{...r,className:y.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,j.DIAL_KIT_CLASS.cardShell),children:t}),at=(e,t)=>({type:s,...a})=>n.jsx(yr,{...a,variant:e,type:s||t}),it=(e,t)=>({variant:s,...a})=>n.jsx(yr,{...a,variant:s||t,type:e}),ll=at(C.NotificationVariant.Error,C.NotificationType.Toast),cl=at(C.NotificationVariant.Info,C.NotificationType.Toast),dl=at(C.NotificationVariant.Success,C.NotificationType.Toast),ul=at(C.NotificationVariant.Warning,C.NotificationType.Toast),fl=at(C.NotificationVariant.Loading,C.NotificationType.Toast),pl=at(C.NotificationVariant.General,C.NotificationType.Toast),gl=it(C.NotificationType.SectionMessage,C.NotificationVariant.Error),hl=it(C.NotificationType.SectionMessage,C.NotificationVariant.Info),ml=it(C.NotificationType.SectionMessage,C.NotificationVariant.Success),xl=it(C.NotificationType.SectionMessage,C.NotificationVariant.Warning),bl=it(C.NotificationType.SectionMessage,C.NotificationVariant.Loading),Cl=it(C.NotificationType.SectionMessage,C.NotificationVariant.General);var be=(e=>(e.Date="date",e.DateTime="datetime",e.Time="time",e.Weekday="weekday",e))(be||{});const vl="en-GB",yl={[be.Date]:"Select date",[be.DateTime]:"Select date and time",[be.Time]:"--:--",[be.Weekday]:"Select day"},Zn="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",Wn="!cursor-not-allowed !border-transparent bg-layer-sunken text-control-disable-primary hover:!border-transparent",qn="!border-error",Il="z-floating flex w-[248px] flex-col gap-4 rounded-lg bg-layer-raised px-2 py-4 shadow-md",Dl="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",Sl="bg-control-accent text-control-permanent",Nl="text-accent dial-small-semi-text",jl="text-control-disable-primary",Yn="text-secondary",Tl=n.jsx(F.IconCalendar,{size:B.DIAL_ICON_SIZE.MD,stroke:re.DIAL_KIT_ICON_STROKE,"aria-hidden":"true",className:Yn}),Wr={prev:n.jsx(F.IconChevronLeft,{size:B.DIAL_ICON_SIZE.SM,stroke:re.DIAL_KIT_ICON_STROKE,"aria-hidden":"true"}),next:n.jsx(F.IconChevronRight,{size:B.DIAL_ICON_SIZE.SM,stroke:re.DIAL_KIT_ICON_STROKE,"aria-hidden":"true"})},wl=(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})},qr=(e,t)=>!!e&&!!t&&e.getFullYear()===t.getFullYear()&&e.getMonth()===t.getMonth()&&e.getDate()===t.getDate(),Yr=(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},El=(e,t)=>e.toLocaleDateString(t,{month:"long",year:"numeric"}),Xr=(e,t)=>e.toLocaleDateString(t,{day:"numeric",month:"short",year:"numeric"}),Ol=(e,t)=>e.toLocaleDateString(t,{weekday:"long",day:"numeric",month:"long",year:"numeric"}),bt=e=>`${String(e.getHours()).padStart(2,"0")}:${String(e.getMinutes()).padStart(2,"0")}`,Qr=(e,t)=>{const[r,s]=t.split(":").map(Number),a=new Date(e);return a.setHours(r||0,s||0,0,0),a},Al=e=>/^([01]\d|2[0-3]):[0-5]\d$/.test(e),_l=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}`},Xn=5,Qn=e=>e.charAt(0).toUpperCase()+e.slice(1),Ll=e=>Array.from({length:7},(t,r)=>{const s=new Date(Date.UTC(1970,0,Xn+r));return Qn(s.toLocaleDateString(e,{weekday:"short",timeZone:"UTC"}))}),kl=e=>Array.from({length:7},(t,r)=>{const s=new Date(Date.UTC(1970,0,Xn+r));return{value:String(r+1),label:Qn(s.toLocaleDateString(e,{weekday:"long",timeZone:"UTC"}))}}),Jr=({id:e,disabled:t,invalid:r,trigger:s,panelClassName:a,fieldClassName:i,panel:o,labelledBy:l,panelLabel:c})=>{const d=j.useThemeScope(),[f,p]=h.useState(!1),{refs:g,floatingStyles:u,context:m}=te.useFloating({open:f,onOpenChange:w=>p(t?!1:w),placement:"bottom-start",whileElementsMounted:te.autoUpdate,middleware:[te.offset(8),te.flip({padding:8}),te.shift({padding:8})]}),v=te.useClick(m,{enabled:!t}),x=te.useDismiss(m),b=te.useRole(m,{role:"dialog"}),{getReferenceProps:I,getFloatingProps:N}=te.useInteractions([v,x,b]);return n.jsxs(n.Fragment,{children:[n.jsx("div",{id:e,ref:g.setReference,role:"button","aria-haspopup":"dialog","aria-expanded":f,"aria-disabled":t,"aria-labelledby":l,tabIndex:t?-1:0,className:y.mergeClasses(Zn,"focus-visible:outline focus-visible:outline-focus",r&&qn,t&&Wn,i),...I(),children:s}),f&&n.jsx(te.FloatingPortal,{children:n.jsx(te.FloatingFocusManager,{context:m,modal:!1,initialFocus:-1,returnFocus:!0,children:n.jsx("div",{ref:g.setFloating,style:u,"aria-label":c,className:y.mergeClasses(Il,d,a),...N(),children:o(()=>p(!1))})})})]})},en=({id:e,value:t,onChange:r,onBlur:s,disabled:a,invalid:i,className:o,ariaLabel:l,placeholder:c="--:--",timezoneLabel:d})=>{const[f,p]=h.useState(t);h.useEffect(()=>{p(t)},[t]);const g=n.jsx("input",{id:e,type:"text",inputMode:"numeric",autoComplete:"off","aria-label":l,placeholder:c,disabled:a,value:f,onChange:u=>{const m=_l(u.target.value);p(m),Al(m)&&r(m)},onBlur:s,className:y.mergeClasses(Zn,i&&qn,a&&Wn,o)});return d?n.jsxs("div",{className:"relative w-full",children:[g,n.jsx("span",{className:"dial-small-paragraph-text pointer-events-none absolute end-4 top-1/2 -translate-y-1/2 truncate text-secondary",children:d})]}):g},Rl=({mode:e=be.Date,value:t,onChange:r,onBlur:s,labelProps:a,placeholder:i,disabled:o=!1,invalid:l=!1,id:c,className:d,minDate:f,maxDate:p,locale:g=vl,fieldClassName:u,showTimezone:m=!1})=>{const v=i??yl[e],x=t instanceof Date?t:null,b=h.useId(),I=c??b,N=a?.id??`${I}-label`,w=!!a?.label,D=typeof a?.label=="string"?a.label:void 0,S=w?`${N} ${I}`:void 0,_=a?n.jsx(R.Label,{...a,id:N,htmlFor:I}):null,[O,A]=h.useState(()=>x??new Date),k=h.useMemo(()=>new Date,[]),T=h.useMemo(()=>m?Bn({locale:g}):null,[m,g]),M=h.useMemo(()=>Ll(g),[g]),z=h.useMemo(()=>kl(g),[g]),G=h.useMemo(()=>wl(O.getFullYear(),O.getMonth()),[O]),J=q=>{A(K=>new Date(K.getFullYear(),K.getMonth()+q,1))},U=(q,K)=>{if(Yr(q,f,p))return;const ae=e===be.DateTime&&x?Qr(q,bt(x)):q;r?.(ae),e===be.Date&&K()},$=q=>{r?.(Qr(x??new Date,q))},H=()=>x?e===be.DateTime?`${Xr(x,g)}, ${bt(x)}`:Xr(x,g):v;if(e===be.Time){const q=typeof t=="string"?t:x?bt(x):"";return n.jsxs("div",{className:y.mergeClasses("flex flex-col gap-y-3",d,j.DIAL_KIT_CLASS.calendar),children:[_,n.jsx(en,{id:I,value:q,onChange:K=>r?.(K),onBlur:s,disabled:o,invalid:l,placeholder:v,className:u,timezoneLabel:T})]})}if(e===be.Weekday){const q=typeof t=="string"?t:void 0,K=z.find(ae=>ae.value===q);return n.jsxs("div",{className:y.mergeClasses("flex flex-col gap-y-3",d,j.DIAL_KIT_CLASS.calendar),children:[_,n.jsx(Jr,{id:I,disabled:o,invalid:l,labelledBy:S,panelLabel:D??v,fieldClassName:u,trigger:n.jsxs(n.Fragment,{children:[n.jsx("span",{className:y.mergeClasses("truncate",!K&&"text-secondary"),children:K?.label??v}),n.jsx(F.IconChevronDown,{size:B.DIAL_ICON_SIZE.MD,stroke:re.DIAL_KIT_ICON_STROKE,"aria-hidden":"true",className:Yn})]}),panel:ae=>n.jsx("div",{role:"listbox","aria-label":D??v,className:"flex flex-col gap-0.5",children:z.map(X=>n.jsx("button",{type:"button",role:"option","aria-selected":X.value===q,className:y.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",X.value===q&&"bg-control-accent-alpha-hover"),onClick:()=>{r?.(X.value),ae()},children:X.label},X.value))})})]})}return n.jsxs("div",{className:y.mergeClasses("flex flex-col gap-y-3",d,j.DIAL_KIT_CLASS.calendar),children:[_,n.jsx(Jr,{id:I,disabled:o,invalid:l,labelledBy:S,panelLabel:D??v,fieldClassName:u,trigger:n.jsxs(n.Fragment,{children:[n.jsx("span",{className:y.mergeClasses("truncate",!x&&"text-secondary"),children:H()}),Tl]}),panel:q=>n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsx(R.StaticIconButton,{"aria-label":"Previous month",icon:Wr.prev,size:E.ElementSize.Small,onClick:()=>J(-1)}),n.jsx("div",{className:"dial-small-semi-text text-primary","aria-live":"polite",children:El(O,g)}),n.jsx(R.StaticIconButton,{"aria-label":"Next month",icon:Wr.next,size:E.ElementSize.Small,onClick:()=>J(1)})]}),n.jsxs("div",{className:"grid grid-cols-7 gap-y-1 text-center",children:[M.map(K=>n.jsx("div",{"aria-hidden":"true",className:"dial-tiny-text py-1 text-secondary",children:K},K)),G.map(K=>{const ae=K.getMonth()!==O.getMonth(),X=qr(K,x),Z=qr(K,k),ie=Yr(K,f,p);return n.jsx("button",{type:"button",disabled:ie,"aria-label":Ol(K,g),"aria-pressed":X,"aria-current":Z?"date":void 0,className:y.mergeClasses(Dl,ae&&jl,Z&&!X&&Nl,X&&Sl,ie&&"cursor-not-allowed opacity-40 hover:bg-transparent"),onClick:()=>U(K,q),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(en,{ariaLabel:"Time",value:x?bt(x):"",onChange:$,onBlur:s,className:"w-[120px] px-3 py-1.5"})]})]})})]})},Ml=({segments:e,labelClassName:t="dial-small-text",leafClassName:r="dial-small-semi-text",className:s,ariaLabel:a="Folder path"})=>{const i=n.jsx(j.DialIcon,{icon:n.jsx(F.IconFolder,{size:B.DIAL_ICON_SIZE.SM,stroke:re.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(C.DialBreadcrumb,{className:y.mergeClasses(s,j.DIAL_KIT_CLASS.folderPath),ariaLabel:a,separator:n.jsx(j.DialIcon,{icon:n.jsx(F.IconChevronRight,{size:14,stroke:re.DIAL_KIT_ICON_STROKE,"aria-hidden":"true",className:"rtl:scale-x-[-1]"}),className:"text-secondary"}),pathItems:o,labelClassName:y.mergeClasses(t,"text-secondary","!cursor-default")})};var qe=(e=>(e.Small="small",e.Heading="heading",e))(qe||{});const Pl="w-full overflow-hidden",Fl="flex min-w-0 flex-nowrap items-center gap-2 whitespace-nowrap",tn="flex min-w-0 items-center gap-2",rn={[qe.Small]:"dial-small-text",[qe.Heading]:"dial-h2-text"},Bl={[qe.Small]:"dial-small-semi-text",[qe.Heading]:"dial-h2-text"},zl={first:"shrink-0",middle:"min-w-0 max-w-[30%] shrink",last:"min-w-0 max-w-[51%] shrink"},$l="flex min-w-0 flex-1 items-center gap-1 rounded-sm transition-colors",Hl="text-secondary hover:text-accent focus-visible:outline focus-visible:outline-offset-2 focus-visible:outline-focus",Vl="cursor-default text-primary",Kl="cursor-default text-secondary",nn="inline-flex flex-none items-center leading-none text-secondary",Gl="dial-kit-minimum-target flex shrink-0 items-center rounded-sm text-secondary transition-colors hover:text-accent focus-visible:outline focus-visible:outline-offset-2 focus-visible:outline-focus",Ul=3,Zl=4,Wl=n.jsx(F.IconChevronRight,{size:B.DIAL_ICON_SIZE.SM,stroke:re.DIAL_KIT_ICON_STROKE,"aria-hidden":"true",className:"rtl:scale-x-[-1]"}),ql=({items:e,maxVisibleItems:t=Zl,size:r=qe.Small,separator:s=Wl,ariaLabel:a="Breadcrumb",overflowAriaLabel:i="Show hidden path segments",className:o,itemClassName:l})=>{const c=Math.max(t,Ul),d=h.useMemo(()=>e.length>c?e.slice(1,-(c-2)):[],[e,c]),f=h.useMemo(()=>d.map((m,v)=>({key:String(v),label:m.label,icon:m.icon})),[d]),p=h.useCallback(({key:m,domEvent:v})=>{const x=d[Number(m)];x&&(x.onClick?.(v),!x.onClick&&x.href&&!v.defaultPrevented&&(window.location.href=x.href))},[d]);if(e.length===0)return null;const g=e.slice(d.length+1),u=(m,{index:v,isFirst:x,isCurrent:b})=>{const I=!b&&(!!m.href||!!m.onClick),N=y.mergeClasses($l,I?Hl:b?y.mergeClasses(Vl,Bl[r]):Kl,l,j.DIAL_KIT_CLASS.breadcrumbsItem),w=n.jsxs(n.Fragment,{children:[m.icon,n.jsx(R.EllipsisTooltip,{text:m.label})]});return n.jsxs("li",{className:y.mergeClasses(tn,rn[r],zl[b?"last":x?"first":"middle"]),children:[I?m.href?n.jsx("a",{href:m.href,onClick:m.onClick,className:N,children:w}):n.jsx("button",{type:"button",onClick:m.onClick,className:N,children:w}):n.jsx("span",{className:N,"aria-current":b?"page":void 0,children:w}),!b&&n.jsx("span",{className:nn,"aria-hidden":"true",children:s})]},`segment-${v}`)};return n.jsx("nav",{"aria-label":a,className:y.mergeClasses(Pl,o,j.DIAL_KIT_CLASS.breadcrumbs),children:n.jsxs("ol",{className:Fl,children:[u(e[0],{index:0,isFirst:!0,isCurrent:e.length===1}),d.length>0&&n.jsxs("li",{className:y.mergeClasses(tn,rn[r],"shrink-0"),children:[n.jsx(R.Dropdown,{items:f,onItemClick:p,placement:"bottom-start",matchReferenceWidth:!1,children:n.jsx("button",{type:"button","aria-label":i,className:Gl,children:n.jsx(F.IconDots,{size:B.DIAL_ICON_SIZE.SM,stroke:re.DIAL_KIT_ICON_STROKE,"aria-hidden":"true"})})}),n.jsx("span",{className:nn,"aria-hidden":"true",children:s})]}),g.map((m,v)=>u(m,{index:e.length-g.length+v,isFirst:!1,isCurrent:v===g.length-1}))]})})},Je=({label:e,variant:t,appearance:r=E.ButtonAppearance.Solid,size:s=E.ElementSize.Standard,className:a,textClassName:i,iconAfter:o,iconBefore:l,type:c="button",tooltipProps:d,href:f,target:p,rel:g,disabled:u,...m})=>{const v=y.mergeClasses("dial-kit-base-button",t&&R.getButtonClassNames(t,r),s===E.ElementSize.Small?"dial-tiny-semi-text":"dial-small-paragraph-semi-text",s===E.ElementSize.Small?"h-[24px] gap-1":"h-[40px] gap-2",s===E.ElementSize.Small&&"dial-kit-base-button-small",r!==E.ButtonAppearance.Link&&(s===E.ElementSize.Small?"px-2":"px-4"),s!==E.ElementSize.Small&&r!==E.ButtonAppearance.Link&&"dial-kit-enhanced-target",a),x=e?void 0:d?.tooltip,b=E.resolveAccessibleName(typeof e=="string"?e:void 0,m["aria-label"],x),I=n.jsxs(n.Fragment,{children:[n.jsx(j.DialIcon,{icon:l}),e&&n.jsx("span",{className:i,children:e}),n.jsx(j.DialIcon,{icon:o})]}),N=m,w=f!==void 0?n.jsx("a",{...N,href:u?void 0:f,target:p,rel:g??(p==="_blank"?"noopener noreferrer":void 0),"aria-disabled":u||void 0,tabIndex:u?-1:N.tabIndex,onClick:u?void 0:N.onClick,className:v,"aria-label":b,children:I}):n.jsx("button",{...m,...R.getDisabledButtonProps(u,d,m.onClick),type:c,className:v,"aria-label":b,children:I});return d?n.jsx(R.Tooltip,{asChild:!0,...d,children:w}):w},Ir=(e,t)=>({appearance:s,...a})=>n.jsx(Je,{...a,variant:e,appearance:s||t}),Dr=(e,t)=>({variant:s,...a})=>n.jsx(Je,{...a,variant:s||t,appearance:e}),Jn=Ir(E.ButtonVariant.Primary,E.ButtonAppearance.Solid),Sr=Ir(E.ButtonVariant.Neutral,E.ButtonAppearance.Solid),Yl=Ir(E.ButtonVariant.Danger,E.ButtonAppearance.Solid),rt={x1:"-5.06",y1:"2.26",x2:"30.62",y2:"22.63",from:"var(--stroke-gradient-1, #5976E9)",to:"var(--stroke-gradient-2, #885DF2)"},Xl=({appearance:e=E.ButtonAppearance.Outlined,iconBefore:t,iconAfter:r,style:s,...a})=>{const i=`dial-kit-starter-gradient-${h.useId().replace(/[^\w-]/g,"")}`,o=n.jsx("svg",{className:"pointer-events-none absolute size-0 overflow-hidden","aria-hidden":"true",focusable:"false",children:n.jsx("defs",{children:n.jsxs("linearGradient",{id:i,x1:rt.x1,y1:rt.y1,x2:rt.x2,y2:rt.y2,gradientUnits:"userSpaceOnUse",children:[n.jsx("stop",{stopColor:rt.from}),n.jsx("stop",{offset:"1",stopColor:rt.to})]})})}),l=c=>n.jsxs(n.Fragment,{children:[o,c]});return n.jsx(Je,{...a,variant:E.ButtonVariant.Starter,appearance:e,iconBefore:t?l(t):void 0,iconAfter:r&&!t?l(r):r,style:{"--dial-kit-starter-icon-stroke":`url(#${i})`,...s}})},Ql=Dr(E.ButtonAppearance.Link,E.ButtonVariant.Primary),Jl=Dr(E.ButtonAppearance.Ghost,E.ButtonVariant.Primary),ec=Dr(E.ButtonAppearance.Outlined,E.ButtonVariant.Neutral),tc=({className:e,icon:t,tooltipProps:r,type:s="button",...a})=>{const i=y.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":E.resolveAccessibleName(a["aria-label"],r?.tooltip),children:t||n.jsx(F.IconArrowNarrowDown,{size:24,stroke:1.5,"aria-hidden":"true"})});return r?n.jsx(E.DialTooltip,{...r,children:o}):o},rc=e=>n.jsx(F.IconChevronDown,{size:B.DIAL_ICON_SIZE.SM,stroke:re.DIAL_KIT_ICON_STROKE,"aria-hidden":!0,className:y.mergeClasses("transition-transform",e&&"rotate-180")}),nc=({variant:e,appearance:t,items:r,dropdownProps:s,...a})=>{const[i,o]=h.useState(!1),l=h.useMemo(()=>rc(i),[i]);return n.jsx("div",{className:j.DIAL_KIT_CLASS.buttonDropdown,children:n.jsx(R.Dropdown,{...s,items:r,onOpenChange:c=>o(c),children:n.jsx(Je,{...a,iconAfter:l,variant:e||E.ButtonVariant.Primary,appearance:t||E.ButtonAppearance.Solid,"aria-haspopup":"menu","aria-expanded":i})})})},es=({label:e,size:t,isOpen:r=!1,labelClassName:s,className:a,"aria-label":i,...o})=>{const l=t===E.ElementSize.Small?"h-[32px]":"h-[40px] dial-kit-enhanced-target";return n.jsxs("button",{type:"button",...o,"aria-haspopup":"menu","aria-expanded":r,"aria-label":i?`${i} ${e}`:void 0,className:y.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",l,a,j.DIAL_KIT_CLASS.inlineSelect),children:[n.jsx("span",{className:s,children:e}),n.jsx(F.IconChevronDown,{size:B.DIAL_ICON_SIZE.MD,stroke:re.DIAL_KIT_ICON_STROKE,"aria-hidden":!0,className:y.mergeClasses("transition-transform",r&&"rotate-180")})]})},sc=({items:e,selectedKey:t,defaultSelectedKey:r,onSelect:s,size:a,disabled:i,placement:o="bottom-end",matchReferenceWidth:l=!1,listClassName:c,listStyle:d,ariaLabel:f,triggerClassName:p,triggerLabelClassName:g,open:u,onOpenChange:m})=>{const[v,x]=h.useState(!1),b=u!==void 0,I=b?u:v,N=h.useCallback(k=>{b||x(k),m?.(k)},[b,m]),[w,D]=h.useState(r??e[0]?.key),S=t!==void 0,_=S?t:w,O=h.useMemo(()=>{const k=e.find(T=>T.key===_);return k?.label?String(k.label):""},[e,_]),A=h.useCallback(({key:k})=>{const T=e.find(M=>M.key===k);T&&(S||D(k),s?.(T))},[e,S,s]);return n.jsx(R.Dropdown,{items:e,placement:o,matchReferenceWidth:l,listClassName:c,listStyle:d,disabled:i,open:b?u:void 0,onOpenChange:N,onItemClick:A,children:n.jsx(es,{label:O,size:a,isOpen:I,disabled:i,"aria-label":f,className:p,labelClassName:g})})},Be=({text:e,className:t,variant:r=C.CaptionType.Description,...s})=>e?n.jsx("span",{...s,role:"alert",className:y.mergeClasses("dial-tiny-text",r===C.CaptionType.Error?"text-error":"text-secondary",t,j.DIAL_KIT_CLASS.captionText,r===C.CaptionType.Error&&j.DIAL_KIT_CLASS.errorText),children:e}):null,ze=({...e})=>n.jsx(Be,{...e,variant:C.CaptionType.Error}),ac="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",ic={[E.ElementSize.Small]:"size-[24px]",[E.ElementSize.Standard]:"size-[40px]",[E.ElementSize.Large]:"size-[48px]"},oc=({icon:e,onClick:t,disabled:r,size:s=E.ElementSize.Standard,className:a})=>n.jsx("div",{className:y.mergeClasses("border-l border-tertiary",ic[s]),children:n.jsx(R.IconButton,{className:y.mergeClasses(ac,s===E.ElementSize.Small&&"p-1",a),icon:e,onClick:t,disabled:r,size:s})}),lc=["ArrowLeft","ArrowRight","ArrowUp","ArrowDown","Backspace","Delete","Tab","Enter","Escape","Home","End","Insert"],ts=(e,t,r,s)=>{if((t==="number"||r!==void 0||s!==void 0)&&!lc.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}}}}},rs={[E.ElementSize.Small]:{field:"dial-kit-input-small gap-x-1",paddingStart:"pl-2",paddingEnd:"pr-2",stackGap:"gap-1",postfixText:"dial-tiny-text"},[E.ElementSize.Standard]:{field:"gap-x-2 py-2",paddingStart:"pl-3",paddingEnd:"pr-3",stackGap:"gap-2",postfixText:"dial-small-text"},[E.ElementSize.Large]:{field:"gap-x-2 py-3",paddingStart:"pl-4",paddingEnd:"pr-4",stackGap:"gap-2",postfixText:"dial-body-text"}},Ye=({labelProps:e,error:t,caption:r,id:s,containerClassName:a,size:i=E.ElementSize.Standard,...o})=>n.jsxs("div",{className:y.mergeClasses("flex flex-col",rs[i].stackGap,a),children:[e&&n.jsx(R.Label,{...e,htmlFor:s}),n.jsxs("div",{className:"flex flex-col gap-1",children:[n.jsx(ns,{id:s,size:i,...o}),n.jsx(ze,{text:t}),!t&&n.jsx(Be,{text:r})]})]}),ns=({invalid:e,disabled:t,prefix:r,className:s,postfix:a,children:i,iconBefore:o,iconAfter:l,wrapperClassName:c,type:d,inputRef:f,value:p,tooltipText:g,min:u,onChange:m,max:v,inputButtonProps:x,wrapperRef:b,size:I=E.ElementSize.Standard,...N})=>{const w=rs[I],D=h.useRef(null),S=te.useMergeRefs([f,D]),_=d==="number"||u!==void 0||v!==void 0;h.useEffect(()=>{const T=D.current;if(!T||!_||t)return;const M=z=>{z.preventDefault()};return T.addEventListener("wheel",M,{passive:!1}),()=>{T.removeEventListener("wheel",M)}},[t,_,d]);const O=T=>{ts(T,d,u,v)},A=T=>{const M=T.currentTarget.value;if(_&&M!==""){const z=parseFloat(M);if(isNaN(z)&&M!=="-"&&M!=="."||!isNaN(z)&&(u!==void 0&&z<+u||v!==void 0&&z>+v))return}m?.(M||void 0)},k=()=>n.jsxs("div",{ref:b,className:y.mergeClasses("dial-kit-input flex flex-row items-center justify-between",w.field,e&&"dial-kit-input-error",t&&"dial-kit-input-disable",!r&&w.paddingStart,!x&&w.paddingEnd,c),"aria-label":"input-container",children:[r&&n.jsx("div",{className:"border-r border-secondary",children:n.jsx(ns,{wrapperClassName:"!rounded-r-none",className:"truncate",value:r,disabled:!0,size:I,id:`${r}_textBefore`})}),n.jsx(j.DialIcon,{icon:o}),i,n.jsx("input",{ref:S,type:d,autoComplete:d==="password"?"new-password":"off",value:p??"",className:y.mergeClasses("border-0 bg-transparent w-full truncate",t&&"cursor-not-allowed",s),onChange:A,onKeyDown:O,min:u,disabled:t,max:v,...N}),a&&n.jsxs("p",{className:y.mergeClasses("text-secondary",w.postfixText),children:[" ",a]}),n.jsx(j.DialIcon,{icon:l}),x&&n.jsx(oc,{size:I,...x,disabled:t})]});return t&&d!=="password"?n.jsx(R.Tooltip,{tooltip:g||p,children:k()}):k()};var Xe=(e=>(e.Outlined="outlined",e.Selectable="selectable",e))(Xe||{});const cc="inline-flex h-[32px] max-w-full items-center gap-1 rounded-full px-3",dc={[Xe.Outlined]:{default:"bg-layer-raised text-primary",selected:"bg-control-accent-alpha text-primary"},[Xe.Selectable]:{default:"text-secondary",selected:"bg-control-accent-alpha text-primary"}},uc="cursor-pointer outline-offset-0 focus-visible:outline focus-visible:outline-focus",fc="hover:bg-control-accent-alpha-hover active:bg-control-accent-alpha-active",Ze=({label:e,icon:t,appearance:r=Xe.Outlined,selected:s=!1,disabled:a=!1,closable:i=!1,removeLabel:o,className:l,title:c,onClick:d,onRemove:f,onKeyDown:p,...g})=>{const u=r===Xe.Selectable,m=!!d&&!a,v=i&&!!f&&!a,x=u&&s,b=I=>{p?.(I),!(!m||I.defaultPrevented)&&(I.key==="Enter"||I.key===" ")&&(I.preventDefault(),I.currentTarget.click())};return n.jsxs("span",{...g,role:m?"button":g.role,tabIndex:m?0:g.tabIndex,"aria-disabled":a||void 0,"aria-pressed":u&&m?s:void 0,onClick:a?void 0:d,onKeyDown:b,className:y.mergeClasses(cc,x?"dial-tiny-semi-text":"dial-tiny-text",dc[r][s?"selected":"default"],a&&"cursor-not-allowed",m&&[uc,fc],l,j.DIAL_KIT_CLASS.tag),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}),v&&n.jsx(R.GhostIconButton,{className:"size-[16px] shrink-0 dial-kit-minimum-target",size:E.ElementSize.Small,"aria-label":o??`Remove ${e}`,icon:n.jsx(F.IconX,{size:B.DIAL_ICON_SIZE.SM,stroke:re.DIAL_KIT_ICON_STROKE,"aria-hidden":"true"}),onClick:I=>{I.stopPropagation(),f?.(I)}})]})},ss=({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)})}),pc=y.mergeClasses("w-full flex flex-col"),gc=R.overlayItemClassName,hc="!max-w-[var(--reference-width)]",mc=y.mergeClasses("max-h-[344px] overflow-y-auto py-1",R.overlayListClassName),xc=R.overlayGap,bc=R.overlaySubMenuListClassName,Cc=n.jsx(F.IconChevronRight,{size:B.DIAL_ICON_SIZE.SM,stroke:re.DIAL_KIT_ICON_STROKE,"aria-hidden":"true"}),vc="text-secondary transition-transform",yc=8,Ic=n.jsx(F.IconSearch,{size:B.DIAL_ICON_SIZE.MD,stroke:re.DIAL_KIT_ICON_STROKE,"aria-hidden":"true"}),Dc=n.jsx(F.IconX,{size:B.DIAL_ICON_SIZE.SM,stroke:re.DIAL_KIT_ICON_STROKE,"aria-hidden":"true"}),Sc=n.jsx(R.SvgNoData,{width:B.DIAL_ICON_SIZE.LG,height:B.DIAL_ICON_SIZE.LG,"aria-hidden":"true"}),Nc=({opt:e,selectedValues:t,mark:r=R.MenuItemMark.Tint,onSelect:s})=>{const{isOpen:a,nodeId:i,refs:o,floatingStyles:l,context:c,getReferenceProps:d,getFloatingProps:f}=j.useSubMenuFloating(xc,"listbox",!!e.disabled),p=e.children?.some(u=>t.includes(u.value)),g=n.jsx(R.MenuItem,{ref:o.setReference,role:"option","aria-haspopup":"listbox","aria-expanded":a,"aria-selected":!!p,"aria-disabled":!!e.disabled,disabled:e.disabled,ellipsisLabel:!0,icon:e.icon,label:e.labelNode??e.label,trailing:Cc,...d()});return n.jsxs(te.FloatingNode,{id:i,children:[e.interactiveTooltip?n.jsx(R.InteractiveTooltip,{asChild:!0,placement:e.interactiveTooltip.placement,content:e.interactiveTooltip.content,contentClassName:e.interactiveTooltip.contentClassName,children:g}):g,a&&n.jsx(j.SubMenuPanel,{refs:o,floatingStyles:l,context:c,getFloatingProps:f,role:"listbox",surfaceClassName:bc,children:e.children.map(u=>{const m=n.jsx(R.MenuItem,{role:"option","aria-selected":t.includes(u.value),"aria-disabled":!!u.disabled,disabled:u.disabled,mark:r,selected:t.includes(u.value),ellipsisLabel:!0,icon:u.icon,label:u.labelNode??u.label,rightControl:u.rightControl,onClick:()=>!u.disabled&&s(u.value)});return n.jsx(h.Fragment,{children:u.interactiveTooltip?n.jsx(R.InteractiveTooltip,{asChild:!0,placement:u.interactiveTooltip.placement,content:u.interactiveTooltip.content,contentClassName:u.interactiveTooltip.contentClassName,children:m}):m},u.value)})})]})},jc=({options:e,multiple:t=!1,id:r,value:s,defaultValue:a,size:i=E.ElementSize.Standard,prefix:o,customSelectedValue:l,placeholder:c="Select...",labelProps:d,error:f,caption:p,ariaLabel:g,searchable:u=!1,searchSize:m=E.ElementSize.Standard,searchPlaceholder:v,selectAll:x=!1,invalid:b,selectAllLabel:I="Select all",selectedOptionMark:N=R.MenuItemMark.Tint,emptyStateTitle:w="No options available",emptyStateDescription:D,emptyStateIcon:S,disabled:_=!1,className:O,fieldClassName:A,listClassName:k,closable:T=!1,header:M,footer:z,onClose:G,onChange:J,dismissRef:U,onFooterClick:$,open:H,onOpenChange:q,onSearchQueryChange:K,customMultiSelectTagsRenderer:ae})=>{const X=h.useId(),Z=r||X,ie=`list-${Z}`,ne=i===E.ElementSize.Small,[ce,ue]=h.useState(!1),pe=H!==void 0,ge=pe?!!H:ce,fe=h.useCallback(P=>{pe||ue(P),q?.(P)},[pe,q]),[W,ee]=h.useState(""),Se=h.useCallback(P=>{P!==W&&(ee(P||""),K?.(P||""))},[K,W]),$e=s!==void 0,[he,He]=h.useState(a),Ee=$e?s:he,oe=h.useMemo(()=>t?Array.isArray(Ee)?Ee:[]:typeof Ee=="string"?[Ee]:[],[Ee,t]),Me=h.useMemo(()=>{const P=W.trim().toLowerCase();return P?e.filter(de=>de.label.toLowerCase().includes(P)):e},[e,W]);h.useEffect(()=>{ge||Se("")},[ge,Se]);const Ne=h.useCallback(P=>{$e||He(P),J?.(P)},[$e,J]),Ve=h.useCallback(P=>{if(t){const de=new Set(oe);de.has(P)?de.delete(P):de.add(P),Ne(Array.from(de));return}Ne(P),fe(!1)},[t,Ne,fe,oe]),ot=h.useCallback((P,de)=>{if(P.stopPropagation(),!t){Ne("");return}const mt=oe.filter(bs=>bs!==de);Ne(mt)},[t,oe,Ne]),ve=h.useMemo(()=>Me.filter(P=>!P.disabled),[Me]),Ke=h.useMemo(()=>ve.filter(P=>oe.includes(P.value)).length,[ve,oe]),{allSelectedInFiltered:Pe,someSelectedInFiltered:me}=h.useMemo(()=>{const P=ve.length>0&&Ke===ve.length;return{allSelectedInFiltered:P,someSelectedInFiltered:Ke>0&&!P}},[ve,Ke]),Ft=h.useCallback(()=>{if(!(!t||ve.length===0))if(Pe){const P=new Set(ve.map(de=>de.value));Ne(oe.filter(de=>!P.has(de)))}else{const P=new Set(oe);ve.forEach(de=>P.add(de.value)),Ne(Array.from(P))}},[Pe,t,ve,oe,Ne]),Oe=oe.length>0,Ge=!t&&Oe?oe[0]:void 0,L=h.useMemo(()=>Ge?e.find(P=>P.value===Ge)??e.flatMap(P=>P.children??[]).find(P=>P.value===Ge):void 0,[e,Ge]),se=L?o?`${o} ${L.label}`:L.label:void 0,xe=h.useMemo(()=>t?Oe?n.jsx("span",{className:"flex min-w-0 flex-1 flex-wrap items-center gap-1",children:ae?.(e,oe,ot)??n.jsx(ss,{options:e,selectedValues:oe,handleRemoveTag:ot})}):null:!L||!L.labelNode&&!L.description?null:n.jsxs("span",{className:"flex min-w-0 flex-1 items-center gap-2",children:[n.jsx(R.EllipsisTooltip,{text:L.labelNode??se}),L.description&&n.jsx("span",{className:"truncate text-secondary dial-tiny-text",children:L.description})]}),[ae,ot,Oe,t,e,se,oe,L]),Bt=t||xe?"":se||(l&&s?l:""),gs=typeof d?.label=="string"?d.label:void 0,hs=xe?[E.resolveAccessibleName(g,gs),t?oe.map(P=>e.find(de=>de.value===P)?.label??P).join(", "):se].filter(Boolean).join(", ")||void 0:E.resolveAccessibleName(g);h.useImperativeHandle(U,()=>({dismiss:()=>{fe(!1)}}));const ms=h.useCallback(P=>{_||(P.key==="ArrowDown"||P.key==="ArrowUp")&&(P.preventDefault(),ge||fe(!0))},[_,ge,fe]),xs=()=>n.jsxs("div",{id:ie,role:"listbox","aria-multiselectable":t||void 0,className:pc,children:[M&&n.jsx(n.Fragment,{children:typeof M=="function"?M():M}),(u||T)&&(e.length>yc||!!W)&&n.jsxs("div",{className:"flex items-center gap-2 px-2 pt-2",children:[u&&n.jsx(Ye,{id:`search-${Z}`,size:m,placeholder:v,"aria-label":v||"Search options",onChange:P=>Se(P),value:W,iconBefore:Ic,containerClassName:"w-full"}),T&&n.jsx(R.GhostIconButton,{"aria-label":"Close select",className:"shrink-0",size:E.ElementSize.Small,icon:Dc,onClick:P=>{G?.(P),fe(!1)}})]}),t&&x&&ve.length>0&&n.jsx("div",{className:y.mergeClasses(gc,"mt-2"),children:n.jsx(R.Checkbox,{id:`${Z}-selectAll`,labelProps:{label:I},isSelected:Pe,isIndeterminate:me,onChange:Ft})}),n.jsx("div",{role:"none",className:mc,children:Me.length===0?n.jsx("div",{className:"px-2 py-3",children:n.jsx(j.DialNoDataContent,{icon:S??Sc,title:w,description:D})}):Me.map(P=>{const de=oe.includes(P.value);if(P.children?.length)return n.jsx(Nc,{opt:P,selectedValues:oe,mark:t?R.MenuItemMark.Checkbox:N,onSelect:Ve},P.value);const mt=t?n.jsx(R.MenuItem,{id:`${Z}-${P.value}`,role:"option","aria-selected":de,"aria-disabled":!!P.disabled,disabled:P.disabled,mark:R.MenuItemMark.Checkbox,selected:de,icon:P.icon,label:P.labelNode??P.label,description:P.description,rightControl:P.rightControl,onClick:()=>Ve(P.value)}):n.jsx(R.MenuItem,{role:"option","aria-selected":de,"aria-disabled":!!P.disabled,disabled:P.disabled,mark:N,selected:de,ellipsisLabel:!0,icon:P.icon,label:P.labelNode??P.label,description:P.description,rightControl:P.rightControl,onClick:()=>!P.disabled&&Ve(P.value)});return n.jsx(h.Fragment,{children:P.interactiveTooltip?n.jsx(R.InteractiveTooltip,{asChild:!0,placement:P.interactiveTooltip.placement,content:P.interactiveTooltip.content,contentClassName:P.interactiveTooltip.contentClassName,children:mt}):mt},P.value)})}),z&&n.jsx("div",{onClick:P=>{$?.(P),$&&fe(!1)},children:typeof z=="function"?z():z})]});return n.jsxs("div",{className:y.mergeClasses("flex w-full flex-col gap-2",O,j.DIAL_KIT_CLASS.select),children:[d&&n.jsx(R.Label,{...d,htmlFor:Z}),n.jsxs("div",{className:"flex flex-col gap-1",children:[n.jsx(R.Dropdown,{open:ge,onOpenChange:fe,disabled:_,closable:T,onClose:G,placement:"bottom-start",allowedPlacements:["bottom-start","top-start"],listClassName:y.mergeClasses(hc,k),className:"w-full",renderOverlay:xs,children:n.jsx(Ye,{id:Z,size:i,disabled:_,invalid:b,value:Bt,placeholder:xe?void 0:c,readOnly:!0,iconBefore:t?void 0:L?.icon,iconAfter:n.jsx(F.IconChevronDown,{size:ne?B.DIAL_ICON_SIZE.SM:B.DIAL_ICON_SIZE.MD,stroke:re.DIAL_KIT_ICON_STROKE,"aria-hidden":"true",className:y.mergeClasses(vc,ge&&"rotate-180")}),role:"combobox","aria-haspopup":"listbox","aria-expanded":ge,"aria-controls":ie,"aria-autocomplete":"none","aria-label":hs,containerClassName:"w-full",wrapperClassName:y.mergeClasses(!_&&"cursor-pointer",t&&Oe&&["!h-auto flex-wrap py-1.5",ne?"min-h-[24px]":"min-h-[40px]"],A),className:y.mergeClasses("cursor-pointer",xe&&"w-0 min-w-0 flex-none p-0"),onKeyDown:ms,children:xe})}),n.jsx(ze,{text:f}),!f&&n.jsx(Be,{text:p})]})]})};var as=(e=>(e.None="none",e.Both="both",e.Horizontal="horizontal",e.Vertical="vertical",e))(as||{});const sn={none:"resize-none",both:"resize",horizontal:"resize-x",vertical:"resize-y"},Tc=e=>typeof e=="boolean"?sn[e?"both":"none"]:sn[e],wc=({className:e="",value:t,onChange:r,error:s,containerClassName:a,resize:i=!1,labelProps:o,caption:l,id:c,...d})=>{const f=y.mergeClasses("dial-kit-textarea dial-kit-input px-3 py-2",d.invalid&&"dial-kit-input-error",d.disabled&&"dial-kit-input-disable",Tc(i),e);return n.jsxs("div",{className:y.mergeClasses("flex flex-col gap-2",a),children:[o&&n.jsx(R.Label,{...o,htmlFor:c}),n.jsxs("div",{className:"flex flex-col gap-1",children:[n.jsx("textarea",{id:c,value:t||"",className:f,onChange:p=>r?.(p.currentTarget.value),...d}),n.jsx(ze,{text:s}),!s&&n.jsx(Be,{text:l})]})]})},Ec=({showPasswordLabel:e="Show password",hidePasswordLabel:t="Hide password",disabled:r,size:s=E.ElementSize.Standard,...a})=>{const[i,o]=h.useState(!1),l=i&&!r;return h.useEffect(()=>{r&&o(!1)},[r]),n.jsx(Ye,{...a,wrapperClassName:y.mergeClasses(a.wrapperClassName,j.DIAL_KIT_CLASS.passwordInput),size:s,disabled:r,type:l?"text":"password",iconAfter:r?void 0:n.jsx(R.GhostIconButton,{size:E.ElementSize.Small,"aria-label":l?t:e,"aria-pressed":l,icon:l?n.jsx(F.IconEyeOff,{size:B.DIAL_ICON_SIZE.SM,stroke:re.DIAL_KIT_ICON_STROKE,"aria-hidden":"true"}):n.jsx(F.IconEye,{size:B.DIAL_ICON_SIZE.SM,stroke:re.DIAL_KIT_ICON_STROKE,"aria-hidden":"true"}),onClick:()=>o(c=>!c)})})},Oc=/^0+\.(\d+)?$/,Ac=/^0+/,_c=[".","-","+","e","E"],an=e=>!e||e==="-"?e:String(e).match(Oc)?String(e).replace(Ac,"0"):Number(e),Lc=({integer:e,onChange:t,min:r,max:s,onKeyDown:a,onPaste:i,...o})=>{const l=d=>{if(e&&_c.includes(d.key)){d.preventDefault();return}ts(d,"number",r,s),a?.(d)},c=d=>{if(e){const f=d.clipboardData.getData("text"),p=f.replace(/\D/g,"");if(p!==f&&(d.preventDefault(),p)){const g=d.currentTarget,u=g.selectionStart??0,m=g.selectionEnd??0,v=g.value.slice(0,u)+p+g.value.slice(m);t?.(an(v))}}i?.(d)};return n.jsx(Ye,{...o,wrapperClassName:y.mergeClasses(o.wrapperClassName,j.DIAL_KIT_CLASS.numberInput),type:"number",min:r,max:s,onChange:d=>t?.(an(d)),onKeyDown:l,onPaste:c})},kc="z-popup flex items-center justify-center bg-backdrop md:p-4 gap-5 p-6",Rc="relative flex w-full max-h-full flex-col rounded-xl bg-layer-raised md:h-auto",Mc="flex flex-row items-center justify-between px-6 py-4",Pc="flex-1 min-w-0 mr-3 truncate dial-h1-text text-primary",Fc="border-b border-tertiary",Bc="flex flex-row items-center gap-2 px-6 py-4",zc="border-t border-tertiary",Qt="flex shrink-0 flex-row items-center gap-2",$c={[C.PopupSize.Sm]:"max-w-full md:max-w-[400px]",[C.PopupSize.Md]:"max-w-full md:max-w-[800px]",[C.PopupSize.Lg]:"max-w-full md:max-w-[1200px]"},Nr=({open:e=!1,header:t,ariaLabel:r,portalId:s,className:a,overlayClassName:i,titleClassName:o,headerClassName:l,bodyClassName:c,children:d,footer:f,footerClassName:p,onClose:g,onBack:u,backAriaLabel:m="Back",headerActions:v,headerDivider:x=!1,mainButtons:b,additionalButtons:I,additionalButtonsOnLeft:N=!1,footerDivider:w=!1,size:D=C.PopupSize.Md,hideClose:S=!1,closeAriaLabel:_="Close dialog",closeOnOutsideClick:O=!0,preventKeyboardOnOpen:A=!1})=>{const k=j.useThemeScope(),T=h.useRef(null),M=h.useId(),{refs:z,context:G}=te.useFloating({open:e,onOpenChange:Z=>{Z||g?.(null)}}),J=te.useRole(G,{role:"dialog"}),U=te.useDismiss(G,{outsidePress:O}),{getFloatingProps:$}=te.useInteractions([J,U]);if(!e)return null;const H=typeof t=="string"?`popup-heading-${M}`:void 0,q=Z=>Z?typeof Z=="string"?n.jsx("h2",{id:H,className:y.mergeClasses(Pc,o),children:n.jsx(R.Tooltip,{tooltip:Z,triggerClassName:"truncate",children:Z})}):Z:n.jsx("span",{}),K=S?null:n.jsx(R.CloseButton,{ariaLabel:_,onClose:Z=>g?.(Z)}),ae=(Z,ie=[])=>ie.map(({variant:ne=E.ButtonVariant.Neutral,...ce},ue)=>n.jsx(Je,{variant:ne,...ce},`${Z}-${ue}`)),X=()=>{if(f!==void 0)return f;if(!b?.length&&!I?.length)return null;const Z=ae("additional",I);return n.jsxs("div",{className:y.mergeClasses(Bc,w&&zc,p),children:[N&&Z.length>0&&n.jsx("div",{className:Qt,children:Z}),n.jsxs("div",{className:y.mergeClasses(Qt,"ml-auto"),children:[!N&&Z,ae("main",b)]})]})};return n.jsx(te.FloatingPortal,{id:s,children:n.jsx(te.FloatingOverlay,{className:y.mergeClasses(kc,k,i),children:n.jsx(te.FloatingFocusManager,{context:G,initialFocus:A?T:z.floating,children:n.jsxs("div",{ref:z.setFloating,...$(),role:"dialog","aria-modal":"true","aria-labelledby":H,"aria-label":H?void 0:r,className:y.mergeClasses(Rc,$c[D],a,j.DIAL_KIT_CLASS.popup),children:[A&&n.jsx("div",{ref:T,tabIndex:-1,"aria-hidden":!0,className:"absolute size-px -m-px overflow-hidden opacity-0 pointer-events-none"}),n.jsxs("div",{className:y.mergeClasses(Mc,x&&Fc,l),children:[u&&n.jsx(R.GhostIconButton,{"aria-label":m,size:E.ElementSize.Small,className:"mr-2",onClick:u,icon:n.jsx(F.IconChevronLeft,{size:B.DIAL_ICON_SIZE.SM,stroke:re.DIAL_KIT_ICON_STROKE,"aria-hidden":"true"})}),q(t),v?n.jsxs("div",{className:Qt,children:[v,K]}):K]}),n.jsx("div",{className:y.mergeClasses("grow overflow-auto",c),children:d}),X()]})})})})},Hc="flex justify-end gap-2 px-6 py-4 border-t border-tertiary",Vc="text-secondary dial-small-paragraph-text px-6 pb-4",Kc="px-6 py-4 h-[120px]",Gc="Cancel",Uc="Ok",Jt={[C.ConfirmationPopupVariant.Info]:{confirm:{variant:E.ButtonVariant.Primary,appearance:E.ButtonAppearance.Solid}},[C.ConfirmationPopupVariant.Danger]:{container:"border-t-4 border-error",confirm:{variant:E.ButtonVariant.Danger,appearance:E.ButtonAppearance.Solid}}},is=({header:e,description:t,descriptionClassName:r,open:s=!1,confirmLabel:a=Uc,cancelLabel:i=Gc,isLoading:o=!1,disableConfirmButton:l=!1,className:c,confirmClassName:d,onClose:f,onConfirm:p,onCancel:g,children:u,variant:m=C.ConfirmationPopupVariant.Info,size:v=C.PopupSize.Sm,footer:x,hideClose:b,...I})=>{const N=o?null:n.jsxs("div",{className:Hc,children:[n.jsx(Sr,{label:i,onClick:()=>g?g():f?.()}),n.jsx(Je,{variant:Jt[m].confirm.variant,appearance:Jt[m].confirm.appearance,className:d,label:a,disabled:l,onClick:p})]}),w=h.useCallback(()=>o?n.jsx("div",{className:Kc,children:n.jsx(C.Spinner,{size:40})}):u??(t?n.jsx("div",{className:y.mergeClasses(Vc,r),children:t}):null),[u,t,o,r]);return n.jsx(Nr,{...I,open:s,header:e,className:y.mergeClasses(Jt[m].container,c,j.DIAL_KIT_CLASS.confirmationPopup),onClose:()=>f?.(),footer:x??N,size:v,hideClose:b??(!o&&x===void 0),children:w()})};var wt=(e=>(e.Start="start",e.End="end",e))(wt||{});const Zc=({title:e,description:t,children:r,expanded:s,defaultExpanded:a=!1,disabled:i,nonCollapsible:o,ariaLabel:l,onToggle:c,caretPosition:d=wt.End,className:f,headerClassName:p,contentClassName:g})=>{const u=s!==void 0,[m,v]=h.useState(a),x=o?!0:u?s:m,b=h.useId(),I=`accordion-header-${b}`,N=`accordion-content-${b}`,w=()=>{if(i)return;const A=!x;u||v(A),c?.(A)},D=d===wt.Start,S=o?null:n.jsx(F.IconChevronRight,{size:B.DIAL_ICON_SIZE.SM,stroke:re.DIAL_KIT_ICON_STROKE,"aria-hidden":"true",className:y.mergeClasses("shrink-0 text-secondary transition-transform motion-reduce:transition-none",x?"rotate-90":"rtl:rotate-180")}),_=n.jsxs(n.Fragment,{children:[D&&S,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]}),!D&&S]}),O=D?"justify-start gap-2":"justify-between";return n.jsxs("div",{className:y.mergeClasses("flex flex-col py-3 overflow-hidden bg-transparent",f,j.DIAL_KIT_CLASS.accordion),children:[o?n.jsx("div",{id:I,className:y.mergeClasses("flex w-full px-4 rounded-xl items-center dial-tiny-text",O,p),children:_}):n.jsx("button",{id:I,type:"button","aria-expanded":x,"aria-controls":N,"aria-label":E.resolveAccessibleName(l),disabled:i,onClick:w,className:y.mergeClasses("flex w-full px-4 rounded-xl items-center dial-tiny-text",O,i?"cursor-not-allowed opacity-75":"cursor-pointer hover:bg-control-accent-alpha-hover focus-visible:outline focus-visible:outline-focus",p),children:_}),n.jsx("div",{inert:!x,className:y.mergeClasses("grid transition-[grid-template-rows] duration-200 ease-out motion-reduce:transition-none",x?"grid-rows-[1fr]":"grid-rows-[0fr]"),children:n.jsx("div",{className:"min-h-0 overflow-hidden",children:n.jsx("div",{className:"pt-3",children:n.jsx("div",{id:N,role:"region","aria-labelledby":I,className:y.mergeClasses("px-4 dial-small-text text-primary",g),children:r})})})})]})},Wc=({id:e,labelProps:t,isOn:r=!1,disabled:s,onChange:a,caption:i,className:o,...l})=>{const c=h.useId(),d=e??c,f=i?`${d}-caption`:void 0,p=h.useCallback(g=>{a?.(g.target.checked)},[a]);return n.jsxs("div",{className:"flex flex-col gap-1",children:[n.jsxs("div",{className:y.mergeClasses("flex items-center gap-2",o,j.DIAL_KIT_CLASS.switch),children:[n.jsx("input",{...l,type:"checkbox",role:"switch",id:d,checked:r,"aria-checked":r,disabled:s,onChange:p,"aria-label":E.resolveAccessibleName(typeof t?.label!="string"?l["aria-label"]:void 0),"aria-describedby":f,className:"peer sr-only"}),n.jsx("label",{htmlFor:d,className:y.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":y.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:y.mergeClasses("size-3.5 shrink-0 rounded-full",s?"bg-control-disable-secondary":"bg-control-neutral")})}),t&&n.jsx(R.Label,{size:E.ElementSize.Standard,...t,htmlFor:d,className:y.mergeClasses("py-[1px]",s?"cursor-not-allowed text-control-disable-primary":"cursor-pointer text-primary",t.className)})]}),i&&n.jsx("span",{id:f,className:"dial-tiny-text text-secondary ml-[44px]",children:i})]})},qc="flex flex-col gap-2",Yc="flex",Xc="mt-2 ml-[26px]",Qc={[C.RadioGroupOrientation.Column]:"flex-col gap-y-3",[C.RadioGroupOrientation.Row]:"flex-row flex-wrap gap-x-4 gap-y-3"},os=({items:e,value:t,onChange:r,name:s,id:a,orientation:i=C.RadioGroupOrientation.Column,labelProps:o,disabled:l,error:c,caption:d,ariaLabel:f,className:p,optionsClassName:g,radioClassName:u,contentClassName:m})=>{const v=h.useId(),x=a??v,b=`${x}-label`,I=c?`${x}-error`:void 0,N=!c&&d?`${x}-caption`:void 0,w=E.resolveAccessibleName(o?.label);return n.jsxs("div",{className:y.mergeClasses(qc,p,j.DIAL_KIT_CLASS.radioGroup),children:[o&&n.jsx(R.Label,{...o,id:b}),n.jsx("div",{role:"radiogroup","aria-labelledby":w?b:void 0,"aria-label":w?void 0:E.resolveAccessibleName(f),"aria-describedby":[I,N].filter(Boolean).join(" ")||void 0,"aria-disabled":l||void 0,className:y.mergeClasses(Yc,Qc[i],g),children:e.map(D=>{const S=D.value===t;return n.jsxs("div",{className:"flex min-w-0 flex-col",children:[n.jsx(R.Radio,{id:`${x}-${D.value}`,name:s??x,value:D.value,labelProps:D.label==null?void 0:{label:D.label},"aria-label":D["aria-label"],caption:D.caption,isSelected:S,disabled:l||D.disabled,onChange:r,className:u}),S&&D.content?n.jsx("div",{className:y.mergeClasses(Xc,m),children:D.content}):null]},D.value)})}),n.jsx(ze,{id:I,text:c}),!c&&n.jsx(Be,{id:N,text:d})]})},Jc="dial-kit-input flex flex-row items-center justify-between gap-x-2 px-3 text-left",ed="min-w-0 flex-1 truncate text-primary",td="min-w-0 flex-1 truncate text-secondary",rd="shrink-0 text-secondary",nd="px-6 pb-4",sd="flex justify-end gap-2 px-6 py-4 border-t border-tertiary",ad="Cancel",id="Apply",od=({items:e,value:t,customValue:r,header:s,onApply:a,id:i,labelProps:o,placeholder:l,selectedValue:c,onSelectionChange:d,onCancel:f,onClose:p,isValid:g=!0,applyButtonLabel:u=id,cancelButtonLabel:m=ad,size:v=C.PopupSize.Md,portalId:x,disabled:b,invalid:I,error:N,caption:w,ariaLabel:D,className:S,fieldClassName:_})=>{const O=h.useId(),A=i??O,k=`${A}-label`,T=`${A}-value`,M=N?`${A}-error`:void 0,z=!N&&w?`${A}-caption`:void 0,[G,J]=h.useState(!1),U=c!==void 0,[$,H]=h.useState(t),q=U?c:$,K=h.useCallback(()=>{b||(U||H(t),J(!0))},[b,U,t]),ae=h.useCallback(()=>{J(!1),p?.()},[p]),X=h.useCallback(()=>{f?.(),ae()},[f,ae]),Z=h.useCallback(()=>{a(q),ae()},[a,q,ae]),ie=h.useCallback(W=>{U||H(W),d?.(W)},[U,d]),ne=E.resolveAccessibleName(o?.label),ce=ne?void 0:E.resolveAccessibleName(D),ue=ne?k:ce&&`${A}-name`,pe=E.resolveAccessibleName(s),ge=e.find(W=>W.value===t)?.label,fe=r??ge;return n.jsxs("div",{className:y.mergeClasses("flex w-full flex-col gap-2",S,j.DIAL_KIT_CLASS.radioGroupPopupField),children:[o&&n.jsx(R.Label,{...o,id:k,htmlFor:A}),n.jsxs("div",{className:"flex flex-col gap-1",children:[ce&&n.jsx("span",{id:ue,className:"sr-only",children:ce}),n.jsxs("button",{type:"button",id:A,disabled:b,"aria-haspopup":"dialog","aria-expanded":G,"aria-labelledby":ue?`${ue} ${T}`:void 0,"aria-describedby":[M,z].filter(Boolean).join(" ")||void 0,onClick:K,className:y.mergeClasses(Jc,I&&"dial-kit-input-error",b&&"dial-kit-input-disable",_),children:[n.jsx("span",{id:T,className:fe==null?td:ed,children:fe??l}),n.jsx(F.IconMaximize,{size:B.DIAL_ICON_SIZE.MD,stroke:re.DIAL_KIT_ICON_STROKE,"aria-hidden":"true",className:rd})]}),n.jsx(ze,{id:M,text:N}),!N&&n.jsx(Be,{id:z,text:w})]}),n.jsx(Nr,{open:G,header:s,ariaLabel:pe?void 0:ne,portalId:x,size:v,onClose:X,footer:n.jsxs("div",{className:sd,children:[n.jsx(Sr,{label:m,onClick:X}),n.jsx(Jn,{label:u,disabled:!g,onClick:Z})]}),children:n.jsx("div",{className:nd,children:n.jsx(os,{id:`${A}-options`,items:e,value:q,onChange:ie,orientation:C.RadioGroupOrientation.Column,ariaLabel:ne??pe})})})]})},ld=({icon:e,selectedIcon:t,isSelected:r=!1,onToggle:s,onClick:a,tooltipProps:i,size:o=E.ElementSize.Small,className:l,...c})=>{const d=h.useCallback(p=>{a?.(p),s?.(!r)},[a,s,r]),f=n.jsx(R.IconButton,{...c,size:o,variant:E.ButtonVariant.Primary,appearance:E.ButtonAppearance.Ghost,icon:r?t??e:e,"aria-pressed":r,"aria-label":E.resolveAccessibleName(c["aria-label"],i?.tooltip),onClick:d,className:y.mergeClasses("!rounded","[&_svg]:size-4",r&&"!text-accent",l,j.DIAL_KIT_CLASS.toggleIconButton)});return i?n.jsx(R.Tooltip,{asChild:!0,...i,children:f}):f},cd=["ArrowRight","ArrowLeft","ArrowUp","ArrowDown","Home","End"],dd="inline-flex w-fit items-center gap-1 rounded-full border border-tertiary bg-layer-sunken p-[3px]",ud="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",fd="bg-layer-raised text-accent shadow-xs",pd="bg-transparent text-secondary",gd="cursor-pointer hover:bg-control-accent-alpha-hover active:bg-control-accent-alpha-active",hd="cursor-pointer hover:bg-control-accent-alpha-hover hover:text-accent active:bg-control-accent-alpha-active",md="cursor-not-allowed bg-control-disable-primary text-control-disable-primary shadow-none",xd="cursor-not-allowed bg-transparent text-control-disable-primary",bd=({items:e,value:t,onChange:r,disabled:s,className:a,segmentClassName:i,"aria-label":o})=>{const l=h.useRef({}),c=e.find(p=>p.value===t),d=c&&!c.disabled?c.value:e.find(p=>!p.disabled)?.value,f=h.useCallback(p=>{if(s||!cd.includes(p.key))return;const g=e.filter(b=>!b.disabled);if(g.length===0)return;const u=Math.max(g.findIndex(b=>b.value===t),0),m=g.length-1;let v=u;switch(p.key){case"ArrowRight":case"ArrowDown":v=u===m?0:u+1;break;case"ArrowLeft":case"ArrowUp":v=u===0?m:u-1;break;case"Home":v=0;break;case"End":v=m;break}p.preventDefault();const x=g[v];l.current[x.value]?.focus(),x.value!==t&&r(x.value)},[s,e,t,r]);return n.jsx("div",{role:"radiogroup","aria-label":o,"aria-disabled":s||void 0,onKeyDown:f,className:y.mergeClasses(dd,a,j.DIAL_KIT_CLASS.segmentedControl),children:e.map(p=>{const g=p.value===t,u=s||p.disabled;return n.jsxs("button",{ref:m=>{l.current[p.value]=m},type:"button",role:"radio","aria-checked":g,"aria-label":E.resolveAccessibleName(p["aria-label"],typeof p.label=="string"?p.label:void 0),tabIndex:p.value===d?0:-1,disabled:u,onClick:()=>r(p.value),className:y.mergeClasses(ud,g?fd:pd,u?g?md:xd:g?gd:hd,i,j.DIAL_KIT_CLASS.segmentedControlItem),children:[p.icon,p.label]},p.value)})})},Cd={[C.TabOrientation.Horizontal]:{next:"ArrowRight",previous:"ArrowLeft"},[C.TabOrientation.Vertical]:{next:"ArrowDown",previous:"ArrowUp"}},vd=({tabs:e,activeTabId:t,onTabChange:r,orientation:s=C.TabOrientation.Horizontal,sectionLabel:a,ariaLabel:i,className:o,tabListClassName:l,tabClassName:c,sectionLabelClassName:d})=>{const f=h.useRef({}),p=h.useId(),g=s===C.TabOrientation.Vertical,u=e.find(b=>b.id===t),m=u&&!u.disabled?u.id:e.find(b=>!b.disabled)?.id,v=h.useCallback(b=>{const{next:I,previous:N}=Cd[s];if(![I,N,"Home","End"].includes(b.key)||e.length===0)return;const w=e.filter(A=>!A.disabled);if(w.length===0)return;const D=Math.max(w.findIndex(A=>A.id===t),0),S=w.length-1;let _=D;b.key===I?_=D===S?0:D+1:b.key===N?_=D===0?S:D-1:b.key==="Home"?_=0:_=S,b.preventDefault();const O=w[_];f.current[O.id]?.focus(),O.id!==t&&r(O.id)},[e,t,r,s]),x=n.jsx("div",{role:"tablist","aria-orientation":g?"vertical":void 0,"aria-label":i,"aria-labelledby":!i&&a?p:void 0,onKeyDown:v,className:y.mergeClasses(g?"flex flex-col gap-1 px-2":"flex justify-start gap-1",!a&&o,l,j.DIAL_KIT_CLASS.tabList,!a&&j.DIAL_KIT_CLASS.tabs),children:e.map(b=>{const I=t===b.id,N=!!b.disabled;return n.jsxs("button",{ref:w=>{f.current[b.id]=w},type:"button",role:"tab","aria-selected":I,disabled:N,tabIndex:b.id===m?0:-1,onClick:()=>r(b.id),className:y.mergeClasses("dial-kit-enhanced-target flex items-center gap-2 text-start","transition-colors motion-reduce:transition-none","focus-visible:outline focus-visible:outline-focus",g?["h-11 w-full rounded-lg px-3 desktop:h-10","focus-visible:-outline-offset-1",I?"dial-small-semi-text":"dial-small-text text-secondary"]:["dial-small-paragraph-semi-text border-b-2 border-transparent px-3 py-2","focus-visible:outline-offset-2"],N&&(g?"cursor-not-allowed text-control-disable-primary":"cursor-not-allowed border-control-disable-primary text-control-disable-primary"),!N&&(g?I?"bg-control-accent-alpha text-accent hover:bg-control-accent-alpha-hover":"hover:bg-control-accent-alpha-hover":I?"dial-kit-tab-selected-underline text-primary":"border-transparent text-secondary"),c,j.DIAL_KIT_CLASS.tab,I&&j.DIAL_KIT_CLASS.tabSelected),children:[b.icon&&n.jsx("span",{"aria-hidden":"true",className:"flex shrink-0",children:b.icon}),n.jsx("span",{className:y.mergeClasses(g&&!I&&!N&&"text-primary"),children:b.label}),b.count!=null&&n.jsx("span",{className:y.mergeClasses("dial-tiny-semi-text rounded-full px-1.5 py-0.5",g&&"ms-auto",N&&"bg-layer-sunken text-control-disable-primary",!N&&(I?"bg-control-accent-alpha text-accent":"bg-layer-sunken text-secondary")),children:b.count})]},b.id)})});return a?n.jsxs("div",{className:y.mergeClasses("flex flex-col gap-3",o,j.DIAL_KIT_CLASS.tabs),children:[n.jsx("div",{className:y.mergeClasses("flex h-16 shrink-0 items-center",g?"px-4":"px-3"),children:n.jsx("span",{id:p,className:y.mergeClasses("dial-h1-text text-primary",d,j.DIAL_KIT_CLASS.tabsSectionLabel),children:a})}),x]}):x},yd="flex flex-nowrap items-center gap-1",Id="min-w-max flex-1 justify-center",Dd=({items:e,value:t,onChange:r,stretch:s=!1,className:a,chipClassName:i,"aria-label":o,"aria-labelledby":l})=>n.jsx("div",{role:"group","aria-label":o,"aria-labelledby":l,className:y.mergeClasses(yd,a,j.DIAL_KIT_CLASS.filterChips),children:e.map(c=>n.jsx(Ze,{label:c.label,icon:c.icon,appearance:Xe.Selectable,selected:c.value===t,onClick:()=>r(c.value),className:y.mergeClasses(s&&Id,i)},c.value))}),lr=(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})},Sd=({labelProps:e,label:t,description:r,onChange:s,onReject:a,accept:i,multiple:o=!1,disabled:l=!1,errorText:c,icon:d,id:f,ariaLabel:p,className:g})=>{const u=h.useId(),m=f??`file-dropzone-${u}`,v=c?`${m}-error`:void 0,[x,b]=h.useState(!1),I=h.useRef(0),N=h.useCallback(k=>{if(k.length===0)return;const T=o?k:k.slice(0,1),M=T.filter(G=>lr(G,i)),z=T.filter(G=>!lr(G,i));z.length>0&&a?.(z),M.length>0&&s(M)},[i,o,s,a]),w=h.useCallback(k=>{N(Array.from(k.target.files??[])),k.target.value=""},[N]),D=h.useCallback(()=>{I.current=0,b(!1)},[]),S=h.useCallback(k=>{l||(k.preventDefault(),I.current+=1,b(!0))},[l]),_=h.useCallback(k=>{l||(k.preventDefault(),k.dataTransfer.dropEffect="copy")},[l]),O=h.useCallback(()=>{l||(I.current-=1,I.current<=0&&D())},[l,D]),A=h.useCallback(k=>{k.preventDefault(),!l&&(D(),N(Array.from(k.dataTransfer?.files??[])))},[l,D,N]);return n.jsxs("div",{className:"flex flex-col gap-1",children:[e&&n.jsx(R.Label,{...e,htmlFor:m}),n.jsx("input",{id:m,type:"file",accept:i,multiple:o,disabled:l,onChange:w,"aria-label":E.resolveAccessibleName(typeof t!="string"?p:void 0),"aria-describedby":v,"aria-invalid":c?!0:void 0,className:"peer sr-only"}),n.jsxs("label",{htmlFor:m,onDragEnter:S,onDragOver:_,onDragLeave:O,onDrop:A,className:y.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&&x&&"border-accent bg-control-accent-alpha",!l&&!x&&"border-secondary hover:border-accent",c&&!x&&"border-error hover:border-error",g,j.DIAL_KIT_CLASS.fileDropzone),children:[d??n.jsx(F.IconUpload,{size:B.DIAL_ICON_SIZE.LG,stroke:re.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:y.mergeClasses("dial-small-text",l?"text-control-disable-primary":"text-primary"),children:t}),r&&n.jsx("span",{className:y.mergeClasses("dial-tiny-text",l?"text-control-disable-primary":"text-secondary"),children:r})]})]}),n.jsx(ze,{id:v,text:c})]})},ls=({label:e="Shared",tooltip:t,size:r=12,className:s})=>n.jsx(R.Tooltip,{tooltip:t||"Shared",asChild:!0,children:n.jsx("span",{role:"img","aria-label":e,className:y.mergeClasses("flex shrink-0 rounded-sm bg-layer-raised text-accent",s,j.DIAL_KIT_CLASS.sharedEntityIndicator),children:n.jsx(F.IconArrowUpRight,{size:r,stroke:re.DIAL_KIT_ICON_STROKE,"aria-hidden":"true"})})});var Ie=(e=>(e.Images="images",e.Video="video",e.Audio="audio",e.Code="code",e.Text="text",e.Pdf="pdf",e.Spreadsheet="spreadsheet",e.Presentation="presentation",e.Archive="archive",e.Dial="dial",e.Other="other",e))(Ie||{});const Nd={images:["apng","avif","bmp","gif","heic","heif","ico","jpeg","jpg","png","svg","tif","tiff","webp"],video:["avi","flv","m4v","mkv","mov","mp4","mpeg","mpg","ogv","webm","wmv"],audio:["aac","aiff","flac","m4a","mid","midi","mp3","oga","ogg","opus","wav","wma"],code:["bash","c","cjs","cpp","cs","css","go","h","hpp","htm","html","ini","ipynb","java","js","json","jsx","kt","less","lua","mjs","php","ps1","py","r","rb","rs","sass","scala","scss","sh","sql","svelte","swift","toml","ts","tsx","vue","xml","yaml","yml","zsh"],text:["doc","docx","log","markdown","md","odt","rtf","text","txt"],pdf:["pdf"],spreadsheet:["csv","numbers","ods","tsv","xls","xlsm","xlsx"],presentation:["key","odp","pps","ppsx","ppt","pptx"],archive:["7z","bz2","gz","rar","tar","tgz","xz","zip"],dial:["dial"]},jd=new Map(Object.entries(Nd).flatMap(([e,t])=>t.map(r=>[r,e]))),Td=e=>jd.get(e)??"other",on="var(--text-control-permanent, #FCFCFC)",Ct={x1:"20.4167",y1:"-3.33333",x2:"2.5",y2:"20",from:"var(--bg-visual-blue, #D6EDF9)",to:"var(--stroke-gradient-1, #5976E9)"},wd="#1B212D",Ed={[Ie.Images]:{path:"M11.0002 8.66667H11.0036M7.00024 11.3333L8.66691 9.66667C8.97624 9.369 9.35758 9.369 9.66691 9.66667L11.3336 11.3333M10.6669 10.6667L11.0002 10.3333C11.3096 10.0357 11.6909 10.0357 12.0002 10.3333L13.0002 11.3333M7.00024 8C7.00024 7.73478 7.1056 7.48043 7.29314 7.29289C7.48067 7.10536 7.73503 7 8.00024 7H12.0002C12.2655 7 12.5198 7.10536 12.7074 7.29289C12.8949 7.48043 13.0002 7.73478 13.0002 8V12C13.0002 12.2652 12.8949 12.5196 12.7074 12.7071C12.5198 12.8946 12.2655 13 12.0002 13H8.00024C7.73503 13 7.48067 12.8946 7.29314 12.7071C7.1056 12.5196 7.00024 12.2652 7.00024 12V8Z",sheet:Ct},[Ie.Code]:{path:"M8.33358 8.66665L7.00024 9.99998L8.33358 11.3333M11.6669 8.66665L13.0002 9.99998L11.6669 11.3333M10.6669 7.33331L9.33358 12.6666",sheet:{x1:"16.6667",y1:"0",x2:"2.08333",y2:"20.4167",from:"var(--bg-control-inverted, #57647A)",to:wd}},[Ie.Text]:{path:"M7.3335 8H12.6668M7.3335 10H12.6668M7.3335 12H11.3335",sheet:{x1:"25.8333",y1:"-11.6667",x2:"2.5",y2:"20",from:"var(--bg-visual-violet-1, #DDE3F9)",to:"var(--bg-gradient-1, #1D4ED8)"}},[Ie.Spreadsheet]:{path:"M7.33325 10.1667H12.6666M9.99992 7.5V12.8333M7.33325 8.16667C7.33325 7.98986 7.40349 7.82029 7.52851 7.69526C7.65354 7.57024 7.82311 7.5 7.99992 7.5H11.9999C12.1767 7.5 12.3463 7.57024 12.4713 7.69526C12.5963 7.82029 12.6666 7.98986 12.6666 8.16667V12.1667C12.6666 12.3435 12.5963 12.513 12.4713 12.6381C12.3463 12.7631 12.1767 12.8333 11.9999 12.8333H7.99992C7.82311 12.8333 7.65354 12.7631 7.52851 12.6381C7.40349 12.513 7.33325 12.3435 7.33325 12.1667V8.16667Z",sheet:{x1:"20.4167",y1:"-3.75",x2:"2.91667",y2:"20.4167",from:"var(--bg-visual-green-1, #CDE8E5)",to:"var(--text-visual-green-1, #059669)"}},[Ie.Pdf]:{fillPath:"M12.5373 10.3151C12.0382 10.3151 11.4137 10.4021 11.2094 10.4328C10.3637 9.54967 10.1231 9.04771 10.069 8.91388C10.1423 8.72544 10.3975 8.0096 10.4338 7.09022C10.4517 6.62991 10.3544 6.28596 10.1447 6.06792C9.93533 5.85024 9.68191 5.83331 9.60924 5.83331C9.35443 5.83331 8.92697 5.96216 8.92697 6.82503C8.92697 7.5737 9.27603 8.36813 9.37252 8.57339C8.86416 10.0536 8.31837 11.0669 8.20248 11.2753C6.15974 12.0444 6 12.788 6 12.9988C6 13.3775 6.26973 13.6036 6.72152 13.6036C7.8192 13.6036 8.8209 11.7607 8.98653 11.4407C9.76614 11.1301 10.8096 10.9377 11.0749 10.8918C11.8357 11.6166 12.7157 11.81 13.0811 11.81C13.3561 11.81 14 11.81 14 11.148C14 10.5332 13.2121 10.3151 12.5373 10.3151ZM12.4844 10.7497C13.0773 10.7497 13.234 10.9458 13.234 11.0494C13.234 11.1145 13.2093 11.3268 12.8915 11.3268C12.6065 11.3268 12.1145 11.1621 11.6303 10.8047C11.8322 10.7782 12.131 10.7497 12.4844 10.7497ZM9.57812 6.25458C9.63218 6.25458 9.66777 6.27195 9.69711 6.31264C9.86764 6.54926 9.73014 7.32242 9.56279 7.92745C9.40124 7.40867 9.28 6.61264 9.45058 6.33259C9.48392 6.27793 9.52204 6.25458 9.57812 6.25458ZM9.29017 10.8856C9.50483 10.452 9.74542 9.81997 9.87646 9.46253C10.1387 9.90147 10.4914 10.309 10.6954 10.53C10.0603 10.6639 9.57969 10.7976 9.29017 10.8856ZM6.4264 13.0566C6.41226 13.0399 6.41017 13.0045 6.42083 12.9621C6.44317 12.8731 6.61396 12.4322 7.84924 11.8796C7.67236 12.1582 7.39585 12.5563 7.09208 12.8537C6.87825 13.0538 6.71174 13.1553 6.59719 13.1553C6.55621 13.1553 6.49974 13.1442 6.4264 13.0566Z",sheet:{x1:"26.25",y1:"-11.6667",x2:"2.5",y2:"20",from:"var(--bg-visual-red, #FCE7F3)",to:"var(--bg-control-error-active, #CC4545)"}},[Ie.Audio]:{path:"M9 11.5C9 11.7652 8.89464 12.0195 8.70711 12.2071C8.51957 12.3946 8.26522 12.5 8 12.5C7.73478 12.5 7.48043 12.3946 7.29289 12.2071C7.10536 12.0195 7 11.7652 7 11.5C7 11.2347 7.10536 10.9804 7.29289 10.7929C7.48043 10.6053 7.73478 10.5 8 10.5C8.26522 10.5 8.51957 10.6053 8.70711 10.7929C8.89464 10.9804 9 11.2347 9 11.5ZM9 11.5V7.16663H12.3333V11.5M12.3333 11.5C12.3333 11.7652 12.228 12.0195 12.0404 12.2071C11.8529 12.3946 11.5985 12.5 11.3333 12.5C11.0681 12.5 10.8138 12.3946 10.6262 12.2071C10.4387 12.0195 10.3333 11.7652 10.3333 11.5C10.3333 11.2347 10.4387 10.9804 10.6262 10.7929C10.8138 10.6053 11.0681 10.5 11.3333 10.5C11.5985 10.5 11.8529 10.6053 12.0404 10.7929C12.228 10.9804 12.3333 11.2347 12.3333 11.5ZM9 8.49996H12.3333",sheet:Ct},[Ie.Video]:{path:"M9.99996 13.1667C11.8409 13.1667 13.3333 11.6743 13.3333 9.83333C13.3333 7.99238 11.8409 6.5 9.99996 6.5C8.15901 6.5 6.66663 7.99238 6.66663 9.83333C6.66663 11.6743 8.15901 13.1667 9.99996 13.1667ZM9.33337 8.5L11.3334 9.83333L9.33337 11.1667V8.5Z",sheet:Ct},[Ie.Presentation]:{path:"M7 7.33331H13M7.33333 7.33331V10.6666C7.33333 10.8435 7.40357 11.013 7.5286 11.1381C7.65362 11.2631 7.82319 11.3333 8 11.3333H12C12.1768 11.3333 12.3464 11.2631 12.4714 11.1381C12.5964 11.013 12.6667 10.8435 12.6667 10.6666V7.33331M10 11.3333V12.6666M9 12.6666H11M8.66667 9.99998L9.66667 8.99998L10.3333 9.66665L11.3333 8.66665",sheet:{x1:"24.5",y1:"-9.5",x2:"2.5",y2:"20",from:"var(--bg-visual-brown, #FDE8D8)",to:"var(--text-visual-brown-2, #B45309)"}},[Ie.Archive]:{path:"M10.0001 6.66669H9.58341M10.8334 7.451H10.4167M10.0001 8.23531H9.58341M10.8334 9.01963H10.4167M10.0001 9.80394H9.58341M10.8334 10.5883H10.4167M10.0001 11.3726C10.2211 11.3726 10.4331 11.4552 10.5893 11.6023C10.7456 11.7494 10.8334 11.9489 10.8334 12.1569V12.9412C10.8334 13.0452 10.7895 13.1449 10.7114 13.2185C10.6332 13.292 10.5273 13.3334 10.4167 13.3334H9.58341C9.47291 13.3334 9.36693 13.292 9.28879 13.2185C9.21065 13.1449 9.16675 13.0452 9.16675 12.9412V12.1569C9.16675 11.9489 9.25455 11.7494 9.41083 11.6023C9.56711 11.4552 9.77907 11.3726 10.0001 11.3726Z",sheet:{x1:"24.5",y1:"-9.5",x2:"2.5",y2:"20",from:"var(--bg-visual-green-1, #CDE8E5)",to:"var(--text-visual-green-3, #065F46)"}},[Ie.Dial]:{path:"M8.26392 7.44049C8.80816 7.44049 9.28449 7.50578 9.69653 7.63092L9.69849 7.6319C10.1079 7.75343 10.4556 7.938 10.7463 8.1817L10.7483 8.18365C11.0312 8.41601 11.2537 8.72491 11.4104 9.12115V9.12213C11.5666 9.51456 11.6496 9.98403 11.6497 10.5381C11.6497 11.5957 11.3539 12.3492 10.8108 12.8565C10.2602 13.3708 9.47204 13.6504 8.39868 13.6505H6.71313V7.44049H8.26392Z",fillPath:"M12.7167 12.1008L12.9558 12.3564L12.9558 12.3564L12.7167 12.1008ZM11.4504 6.20825L11.3486 6.54311L11.3507 6.54375L11.4504 6.20825ZM12.637 6.833L12.4119 7.10109L12.4147 7.10334L12.637 6.833ZM13.4108 7.9263L13.0853 8.05488L13.0856 8.05566L13.4108 7.9263ZM11.1666 12.8853L11.0909 12.5436V12.5436L11.1666 12.8853ZM10.4391 12.6553C10.2487 12.689 10.1217 12.8706 10.1553 13.0609C10.189 13.2513 10.3706 13.3783 10.5609 13.3447L10.5 13L10.4391 12.6553ZM13.6781 9.49291H13.3281C13.3281 10.5655 13.0283 11.33 12.4776 11.8451L12.7167 12.1008L12.9558 12.3564C13.687 11.6724 14.0281 10.6984 14.0281 9.49291H13.6781ZM7.9751 6.12805H8.3251C8.3251 6.24476 8.23053 6.35 8.1009 6.35V6V5.65C7.83231 5.65 7.6251 5.86989 7.6251 6.12805H7.9751ZM8.1009 6V6.35H9.89799V6V5.65H8.1009V6ZM9.89799 6V6.35C10.449 6.35 10.9312 6.41618 11.3486 6.54311L11.4504 6.20825L11.5522 5.87339C11.0566 5.72265 10.5039 5.65 9.89799 5.65V6ZM11.4504 6.20825L11.3507 6.54375C11.7654 6.66701 12.1173 6.85376 12.4119 7.10107L12.637 6.833L12.862 6.56492C12.4875 6.2506 12.0484 6.02084 11.5501 5.87275L11.4504 6.20825ZM12.637 6.833L12.4147 7.10334C12.7016 7.33926 12.9264 7.65273 13.0853 8.05488L13.4108 7.9263L13.7363 7.79772C13.5387 7.29746 13.2477 6.88206 12.8593 6.56265L12.637 6.833ZM13.4108 7.9263L13.0856 8.05566C13.2441 8.45409 13.3281 8.93071 13.3281 9.49291H13.6781H14.0281C14.0281 8.86239 13.934 8.29465 13.736 7.79694L13.4108 7.9263ZM7.9751 7.21882H8.3251V6.12805H7.9751H7.6251V7.21882H7.9751ZM12.7167 12.1008L12.4776 11.8451C12.117 12.1824 11.6591 12.4177 11.0909 12.5436L11.1666 12.8853L11.2423 13.227C11.9168 13.0776 12.4923 12.7898 12.9558 12.3564L12.7167 12.1008ZM11.1666 12.8853L11.0909 12.5436C11.091 12.5435 11.0826 12.5452 11.0606 12.5493C11.041 12.5528 11.0155 12.5573 10.9857 12.5625C10.926 12.5729 10.8511 12.5857 10.7756 12.5984C10.6269 12.6236 10.472 12.6495 10.4391 12.6553L10.5 13L10.5609 13.3447C10.6064 13.3366 11.1725 13.2425 11.2423 13.227L11.1666 12.8853Z",sheet:"var(--bg-gradient-2, #885DF2)"},[Ie.Other]:{path:"M6.80005 8H13.2M6.80005 10.2222H13.2M6.80005 12.4444H13.2",sheet:Ct}},Od=({size:e,kind:t})=>{const r=`dial-kit-file-gradient-${h.useId().replace(/[^\w-]/g,"")}`,{path:s,fillPath:a,sheet:i}=Ed[t],o=typeof i=="string";return n.jsxs("svg",{width:e,height:e,viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:[n.jsx("path",{d:"M17.4999 3.97859V16C17.4999 18.2091 15.709 20 13.4999 20H6.5C4.29086 20 2.5 18.2091 2.5 16V4C2.5 1.79086 4.29086 0 6.5 0H13.1683H13.5213C15.7186 0 17.4999 1.78128 17.4999 3.97859Z",fill:o?i:`url(#${r})`}),s&&n.jsx("path",{d:s,stroke:on,strokeWidth:"0.7",strokeLinecap:"round",strokeLinejoin:"round"}),a&&n.jsx("path",{d:a,fill:on}),!o&&n.jsx("defs",{children:n.jsxs("linearGradient",{id:r,x1:i.x1,y1:i.y1,x2:i.x2,y2:i.y2,gradientUnits:"userSpaceOnUse",children:[n.jsx("stop",{stopColor:i.from}),n.jsx("stop",{offset:"1",stopColor:i.to})]})})]})},Ad=({size:e})=>{const t=`dial-kit-folder-gradient-${h.useId().replace(/[^\w-]/g,"")}`;return n.jsxs("svg",{width:e,height:e,viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:[n.jsx("path",{d:"M6.38992 3.75H4.66663C3.00977 3.75 1.66663 5.09315 1.66663 6.75V7.91667H7.16339L10.8333 5.79247L7.85075 4.1297C7.40412 3.8807 6.90127 3.75 6.38992 3.75Z",fill:"var(--stroke-gradient-1, #5976E9)"}),n.jsx("path",{d:"M14.3333 5.41669C16.5424 5.41669 18.3333 7.20755 18.3333 9.41669V12.25C18.3333 14.4592 16.5424 16.25 14.3333 16.25H5.66663C3.45749 16.25 1.66663 14.4592 1.66663 12.25V7.6708C1.66663 7.11851 2.11434 6.6708 2.66663 6.6708H6.89447C7.43998 6.6708 7.97973 6.55922 8.48053 6.34291L9.86582 5.74458C10.3666 5.52827 10.9064 5.41669 11.4519 5.41669H14.3333Z",fill:`url(#${t})`}),n.jsx("defs",{children:n.jsxs("linearGradient",{id:t,x1:"17.0833",y1:"5.83335",x2:"9.38489",y2:"19.6653",gradientUnits:"userSpaceOnUse",children:[n.jsx("stop",{stopColor:"var(--stroke-secondary, #D1DBEA)"}),n.jsx("stop",{offset:"0.91",stopColor:"var(--stroke-gradient-1, #5976E9)"})]})})]})},_d=(e,t)=>(t??(e.includes(".")?e.split(".").pop():"")??"").trim().replace(/^\./,"").toLowerCase(),Ld=(e,t)=>e===C.DialItemType.Folder?"Folder":t?`${t.toUpperCase()} file`:"File",kd=(e,t,r)=>e===C.DialItemType.Folder?n.jsx(Ad,{size:r}):n.jsx(Od,{size:r,kind:Td(t)}),jr=({type:e,name:t,fileExtension:r,shared:s=!1,loading:a=!1,size:i=B.DIAL_ICON_SIZE.MD,className:o,decorative:l=!1,label:c,loadingLabel:d="Loading",sharedIndicatorClassName:f,sharedIndicatorTooltip:p})=>{if(e!==C.DialItemType.File&&e!==C.DialItemType.Folder)return null;const g=e===C.DialItemType.File?_d(t,r):"",u=Ld(e,g),m=c??(s?`${u}, shared`:u),v=l?{"aria-hidden":!0}:a?{}:{role:"img","aria-label":m};return n.jsxs("span",{className:y.mergeClasses("relative inline-flex shrink-0 items-center justify-center text-secondary",o,j.DIAL_KIT_CLASS.fileIcon),...v,children:[a?n.jsx(C.Spinner,{size:i,ariaLabel:d}):kd(e,g,i),s&&n.jsx(ls,{tooltip:p,className:y.mergeClasses("absolute -bottom-0.5 -left-0.5",f)})]})},cs=({name:e,type:t=C.DialItemType.File,fileExtension:r,shared:s=!1,loading:a=!1,loadingLabel:i,iconSize:o,details:l,isInvalidName:c=!1,className:d,nameClassName:f,sharedIndicatorClassName:p,sharedIndicatorTooltip:g,sharedLabel:u="Shared",hideTooltip:m=!1,tooltipContent:v})=>n.jsxs("div",{className:y.mergeClasses("flex w-full min-w-0 items-center gap-2",d,j.DIAL_KIT_CLASS.fileName),children:[n.jsx(jr,{name:e,type:t,fileExtension:r,shared:s,loading:a,loadingLabel:i,size:o,sharedIndicatorClassName:p,sharedIndicatorTooltip:g,decorative:!a}),n.jsxs("div",{className:y.mergeClasses("flex min-w-0 flex-1",{"flex-col gap-1":!!l}),children:[n.jsx(R.EllipsisTooltip,{className:y.mergeClasses("dial-small-paragraph-text",c?"text-secondary":"text-primary",f),text:e,hideTooltip:m,customTooltipContent:v}),s&&n.jsx("span",{className:"sr-only",children:u}),l]})]}),Rd=({className:e,...t})=>n.jsx(cs,{...t,type:C.DialItemType.Folder,className:y.mergeClasses(e,j.DIAL_KIT_CLASS.folderName)}),Md=({open:e,onClose:t,title:r,ariaLabel:s,onBack:a,backAriaLabel:i="Back",closeAriaLabel:o="Close",closeOnOutsideClick:l=!0,children:c,className:d,overlayClassName:f,headerClassName:p,style:g,overlayStyle:u,bodyClassName:m,titleClassName:v,portalId:x})=>{const b=j.useThemeScope(),I=`bottom-sheet-title-${h.useId()}`,{refs:N,context:w}=te.useFloating({open:e,onOpenChange:O=>{O||t()}}),D=te.useRole(w,{role:"dialog"}),S=te.useDismiss(w,{outsidePress:l}),{getFloatingProps:_}=te.useInteractions([D,S]);return e?n.jsx(te.FloatingPortal,{id:x,children:n.jsx(te.FloatingOverlay,{lockScroll:!0,style:u,className:y.mergeClasses("z-popup flex items-end bg-backdrop",b,f),children:n.jsx(te.FloatingFocusManager,{context:w,initialFocus:N.floating,children:n.jsxs("div",{ref:N.setFloating,..._(),role:"dialog","aria-modal":"true","aria-labelledby":r?I:void 0,"aria-label":r?void 0:s,style:g,className:y.mergeClasses("flex max-h-[85dvh] w-full flex-col rounded-t-lg bg-layer-raised outline-none","animate-slideUp motion-reduce:animate-none",d,j.DIAL_KIT_CLASS.bottomSheet),children:[r&&n.jsxs("div",{className:y.mergeClasses("relative flex h-[60px] shrink-0 items-center justify-center border-b border-tertiary px-14",p),children:[a&&n.jsx(R.GhostIconButton,{"aria-label":i,className:"absolute start-4",onClick:a,icon:n.jsx(F.IconArrowLeft,{size:B.DIAL_ICON_SIZE.LG,stroke:re.DIAL_KIT_ICON_STROKE,className:"rtl:-scale-x-100","aria-hidden":"true"})}),n.jsx("h2",{id:I,className:y.mergeClasses("min-w-0 truncate text-primary",v??"dial-body-semi-text"),children:r}),n.jsx(R.CloseButton,{ariaLabel:o,onClose:t,size:E.ElementSize.Standard,className:"absolute end-4"})]}),n.jsx("div",{className:y.mergeClasses("min-h-0 overflow-y-auto",m),children:c})]})})})}):null};var Fe=(e=>(e.Outlined="outlined",e.Filled="filled",e))(Fe||{}),Ae=(e=>(e.Blue="blue",e.Green="green",e.Violet="violet",e.Indigo="indigo",e.Brown="brown",e.Red="red",e))(Ae||{});const Pd={[Ae.Blue]:"bg-blue text-blue",[Ae.Green]:"bg-green-2 text-green-1",[Ae.Violet]:"bg-violet-2 text-violet-1",[Ae.Indigo]:"bg-violet-1 text-violet-2",[Ae.Brown]:"bg-brown text-brown-2",[Ae.Red]:"bg-red text-red"},Fd={[Fe.Outlined]:"rounded-md border border-tertiary bg-layer-sunken text-secondary",[Fe.Filled]:"rounded-full"},Bd={[Fe.Outlined]:"dial-tiny-text",[Fe.Filled]:"dial-caption-lead-semi-text"},zd=({label:e,variant:t=Fe.Outlined,color:r=Ae.Blue,icon:s,textClassName:a,className:i,...o})=>n.jsxs("span",{...o,className:y.mergeClasses("inline-flex h-6 w-fit shrink-0 items-center gap-1 whitespace-nowrap px-2",Fd[t],t===Fe.Filled&&Pd[r],i,j.DIAL_KIT_CLASS.badge),children:[s&&n.jsx("span",{className:"flex shrink-0 items-center","aria-hidden":"true",children:s}),n.jsx("span",{className:a??Bd[t],children:e})]});var pt=(e=>(e.Circle="circle",e.Square="square",e))(pt||{});const ln=[{background:"bg-green-1",foreground:"text-green-2"},{background:"bg-violet-2",foreground:"text-violet-1"},{background:"bg-brown",foreground:"text-brown-2"},{background:"bg-red",foreground:"text-red"},{background:"bg-green-2",foreground:"text-green-3"},{background:"bg-blue",foreground:"text-accent"},{background:"bg-violet-1",foreground:"text-violet-2"}],$d=e=>{let t=0;for(let r=0;r<e.length;r++)t+=e.charCodeAt(r);return ln[t%ln.length]},cn=e=>e.match(new RegExp("\\p{L}","u"))?.[0]??"",ds=e=>{const t=e.trim().split(/\s+/).filter(Boolean);return t.length===0?"?":t.length>=2?(cn(t[0])+cn(t[1])).toUpperCase()||"?":t[0].replace(/[^\p{L}]/gu,"").slice(0,2).toUpperCase()||"?"},Hd={[pt.Circle]:"rounded-full",[pt.Square]:"rounded-md"},Vd=({name:e,initials:t,src:r,alt:s="",size:a=32,shape:i=pt.Circle,className:o,textClassName:l,onImageError:c})=>{const[d,f]=h.useState(),p=!!r&&d!==r,g=s!=="",u=x=>y.mergeClasses("inline-flex shrink-0 select-none items-center justify-center overflow-hidden",Hd[i],x,o,j.DIAL_KIT_CLASS.avatar);if(p)return n.jsx("img",{src:r,alt:s,width:a,height:a,className:y.mergeClasses(u(),"object-cover"),onError:x=>{f(r),c?.(x)}});const{background:m,foreground:v}=$d(e);return n.jsx("span",{role:g?"img":void 0,"aria-label":g?s:void 0,"aria-hidden":g?void 0:!0,className:u(y.mergeClasses(m,v)),style:{width:a,height:a,fontSize:l?void 0:Math.round(a*.4)},children:n.jsx("span",{className:y.mergeClasses("leading-none",l??"font-semibold"),children:t??ds(e)})})},Kd=({open:e,onClose:t,header:r,ariaLabel:s,headerActions:a,onBack:i,backAriaLabel:o="Back",backDisabled:l=!1,closeAriaLabel:c="Close",closeDisabled:d=!1,hideClose:f=!1,closeOnOutsideClick:p=!0,children:g,className:u,overlayClassName:m,headerClassName:v,style:x,overlayStyle:b,bodyClassName:I,titleClassName:N,portalId:w})=>{const D=j.useThemeScope(),S=`side-drawer-title-${h.useId()}`,_=typeof r=="string",{refs:O,context:A}=te.useFloating({open:e,onOpenChange:G=>{G||t()}}),k=te.useRole(A,{role:"dialog"}),T=te.useDismiss(A,{outsidePress:p}),{getFloatingProps:M}=te.useInteractions([k,T]),z=r!=null||i!=null||!f;return n.jsx(te.FloatingPortal,{id:w,children:n.jsx(te.FloatingOverlay,{lockScroll:e,style:b,className:y.mergeClasses("z-popup bg-backdrop transition-opacity duration-300 motion-reduce:transition-none",e?"opacity-100":"pointer-events-none opacity-0",D,m),children:n.jsx(te.FloatingFocusManager,{context:A,disabled:!e,initialFocus:O.floating,children:n.jsxs("div",{ref:O.setFloating,...M(),role:"dialog","aria-modal":"true","aria-labelledby":_?S:void 0,"aria-label":_?void 0:s,inert:!e,style:x,className:y.mergeClasses("fixed inset-y-0 end-0 flex w-full flex-col overflow-hidden bg-layer-raised outline-none","desktop:w-[540px] desktop:rounded-s-xl desktop:border-s desktop:border-secondary","transition-transform duration-300 motion-reduce:transition-none",e?"translate-x-0":"translate-x-full rtl:-translate-x-full",u,j.DIAL_KIT_CLASS.sideDrawer),children:[z&&n.jsxs("div",{className:y.mergeClasses("flex shrink-0 items-center gap-2 border-b border-tertiary px-6 py-3",v),children:[i&&n.jsx(R.GhostIconButton,{"aria-label":o,disabled:l,onClick:i,icon:n.jsx(F.IconChevronLeft,{size:B.DIAL_ICON_SIZE.MD,stroke:re.DIAL_KIT_ICON_STROKE,className:"rtl:-scale-x-100","aria-hidden":"true"})}),_?n.jsx("h2",{id:S,className:y.mergeClasses("min-w-0 flex-1 truncate text-primary",N??"dial-h2-text"),children:r}):n.jsx("div",{className:"min-w-0 flex-1",children:r}),a,!f&&n.jsx(R.CloseButton,{ariaLabel:c,onClose:t,disabled:d,size:E.ElementSize.Standard})]}),n.jsx("div",{className:y.mergeClasses("min-h-0 flex-1 overflow-y-auto",I),children:g})]})})})})},Gd=({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},Ud=4,Zd=24,dn=e=>parseFloat(e)||0,Wd=e=>{let t=e.length;for(;t>0&&e[t-1]===",";)t--;return e.slice(0,t)},qd=()=>{},Yd=({id:e,value:t,defaultValue:r,size:s=E.ElementSize.Standard,labelProps:a,placeholder:i,caption:o,error:l,invalid:c,disabled:d=!1,readOnly:f=!1,collapseTagOverflow:p=!1,ariaLabel:g,tagListLabel:u="Tags",className:m,fieldClassName:v,tagClassName:x,onChange:b})=>{const I=h.useId(),N=e||I,w=s===E.ElementSize.Small,D=h.useRef(null),S=h.useRef([]),_=h.useRef(null),O=t!==void 0,[A,k]=h.useState(r??[]),T=O?t:A,M=T.length,[z,G]=h.useState(""),[J,U]=h.useState(M),$=!f&&!d,H=h.useCallback(W=>{O||k(W),b?.(W)},[O,b]),q=h.useCallback(W=>ee=>{S.current[W]=ee},[]),K=h.useCallback(()=>{const W=D.current;if(!W||W.clientWidth===0){U(T.length);return}const{paddingLeft:ee,paddingRight:Se}=getComputedStyle(W);U(Gd({availableWidth:W.clientWidth-dn(ee)-dn(Se)-(f?0:Zd),tagWidths:T.map(($e,he)=>S.current[he]?.offsetWidth??0),overflowChipWidth:_.current?.offsetWidth??0,gap:Ud}))},[f,T]);h.useEffect(()=>{if(!p){U(M);return}const W=D.current;if(!W)return;const ee=new ResizeObserver(()=>K());return ee.observe(W),K(),()=>ee.disconnect()},[p,K,M]);const ae=y.mergeClasses(p?"shrink-0":"min-w-0",x),X=W=>{const ee=Wd(W.trim()).trim();!ee||T.includes(ee)||H([...T,ee])},Z=W=>{H(T.filter(ee=>ee!==W))},ie=()=>{X(z),G("")},ne=W=>{if($){if(W.key==="Enter"||W.key===","){W.preventDefault(),ie();return}W.key==="Backspace"&&!z&&M>0&&(W.preventDefault(),H(T.slice(0,-1)))}},ce=()=>{$&&z.trim()&&ie()},ue=p?T.slice(0,J):T,pe=p?T.slice(J):[],ge=pe.join(", "),fe=M>0&&n.jsxs("span",{role:"list","aria-label":u,className:y.mergeClasses("relative flex min-w-0 items-center gap-1",p?"flex-nowrap":"flex-wrap"),children:[ue.map(W=>n.jsx(Ze,{role:"listitem",label:W,className:ae,disabled:d,closable:$,onRemove:$?()=>Z(W):void 0},W)),pe.length>0&&n.jsx(Ze,{role:"listitem",label:`+${pe.length}`,"aria-label":ge,title:ge,className:y.mergeClasses("shrink-0",x),disabled:d}),p&&n.jsxs("span",{"aria-hidden":"true",className:"pointer-events-none invisible absolute left-0 top-0 h-0 overflow-hidden whitespace-nowrap",children:[T.map((W,ee)=>n.jsx("span",{ref:q(ee),className:"inline-flex",children:n.jsx(Ze,{label:W,className:x,disabled:d,closable:$,onRemove:$?qd:void 0})},W)),n.jsx("span",{ref:_,className:"inline-flex",children:n.jsx(Ze,{label:`+${M}`,className:x})})]})]});return n.jsx(Ye,{id:N,size:s,labelProps:a,caption:o,error:l,invalid:c,disabled:d,readOnly:f,value:z,placeholder:M>0?void 0:i,"aria-label":g,wrapperRef:D,onChange:W=>G(W??""),onKeyDown:ne,onBlur:ce,containerClassName:y.mergeClasses("w-full",m),wrapperClassName:y.mergeClasses(M>0&&["!h-auto",w?"min-h-[24px] py-0.5":"min-h-[40px] py-[3px]",p?"flex-nowrap overflow-hidden":"flex-wrap"],v,j.DIAL_KIT_CLASS.tagInput),className:y.mergeClasses("w-auto flex-1",p?"min-w-[24px]":"min-w-[100px]",f&&"cursor-default"),children:fe})},Xd={[E.ElementSize.Small]:B.DIAL_ICON_SIZE.SM,[E.ElementSize.Standard]:B.DIAL_ICON_SIZE.MD,[E.ElementSize.Large]:B.DIAL_ICON_SIZE.MD},Qd=({size:e=E.ElementSize.Standard,placeholder:t="Search...",withoutBorder:r=!1,clearLabel:s="Clear search",disabled:a,value:i,onChange:o,wrapperClassName:l,inputRef:c,...d})=>{const f=h.useRef(null),p=te.useMergeRefs([c,f]),g=!!i&&!a,u=h.useCallback(()=>{o?.(void 0),f.current?.focus()},[o]);return n.jsx(Ye,{...d,size:e,value:i,disabled:a,onChange:o,placeholder:t,inputRef:p,wrapperClassName:y.mergeClasses(r&&"dial-kit-input-borderless",l,j.DIAL_KIT_CLASS.search),iconBefore:n.jsx(F.IconSearch,{size:Xd[e],stroke:re.DIAL_KIT_ICON_STROKE,className:"text-secondary","aria-hidden":"true"}),iconAfter:g?n.jsx(R.GhostIconButton,{size:E.ElementSize.Small,"aria-label":s,icon:n.jsx(F.IconX,{size:B.DIAL_ICON_SIZE.SM,stroke:re.DIAL_KIT_ICON_STROKE,"aria-hidden":"true"}),onClick:u}):void 0})},Jd=16,eu=e=>(e.toString().split(".")[1]??"").length,tu=({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:f,error:p,onChange:g,containerClassName:u,trackClassName:m,fillClassName:v,className:x,...b})=>{const I=h.useId(),N=e??I,w=f&&!p?`${N}-caption`:void 0,D=p?`${N}-error`:void 0,S=s-r,_=S>0?Math.min(100,Math.max(0,(t-r)/S*100)):0,O=`calc(${_}% + ${(.5-_/100)*Jd}px)`,A=c?c(t):t.toFixed(eu(a)),k=h.useCallback(T=>{g?.(Number(T.target.value))},[g]);return n.jsxs("div",{className:y.mergeClasses("flex flex-col gap-2",u),children:[(o||d)&&n.jsxs("div",{className:"flex items-center gap-2",children:[o&&n.jsx(R.Label,{...o,htmlFor:N}),d&&n.jsx("span",{"aria-hidden":"true",className:y.mergeClasses("dial-small-text ml-auto",i?"text-control-disable-primary":"text-primary"),children:A})]}),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:y.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:y.mergeClasses("pointer-events-none absolute left-0 h-1 rounded-full",i?"bg-control-disable-secondary":"bg-control-accent",v),style:{width:O}}),n.jsx("input",{...b,type:"range",id:N,value:t,min:r,max:s,step:a,disabled:i,onChange:k,"aria-label":E.resolveAccessibleName(typeof o?.label!="string"?b["aria-label"]:void 0),"aria-valuetext":c?A:void 0,"aria-describedby":D??w,className:y.mergeClasses("dial-kit-slider absolute inset-0 h-full w-full",x)})]}),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(ze,{id:D,text:p}),!p&&n.jsx(Be,{id:w,text:f})]})]})},ru=48,nu=({children:e,title:t,width:r=280,collapsedWidth:s=ru,isOpened:a,defaultOpened:i=!0,onToggle:o,additionalButtons:l,ariaLabel:c="Sidebar",collapseLabel:d="Collapse sidebar",expandLabel:f="Expand sidebar",className:p,titleClassName:g,contentClassName:u,footerClassName:m})=>{const v=a!==void 0,[x,b]=h.useState(i),I=v?a:x,N=`collapsible-sidebar-content-${h.useId()}`,w=I?d:f,D=S=>{const _=!I;v||b(_),o?.(_,S)};return n.jsxs("aside",{"aria-label":c,style:{width:`${I?r:s}px`},className:y.mergeClasses("flex flex-col justify-between",p,j.DIAL_KIT_CLASS.collapsibleSidebar),children:[n.jsx("div",{id:N,hidden:!I,className:y.mergeClasses("min-h-0 flex-1 overflow-auto p-4",u),children:e}),n.jsx("div",{hidden:I,className:y.mergeClasses("rotate-180 px-3 py-4 [writing-mode:tb-rl] dial-small-text text-primary",g),children:t}),n.jsxs("div",{className:y.mergeClasses("flex h-12 shrink-0 flex-row items-center gap-2 border-t border-tertiary py-1",I?"justify-end px-2":"justify-center",m),children:[I&&l,n.jsx(R.IconButton,{variant:E.ButtonVariant.Primary,appearance:E.ButtonAppearance.Ghost,size:E.ElementSize.Standard,onClick:D,"aria-label":w,"aria-expanded":I,"aria-controls":N,tooltipProps:{tooltip:w},icon:I?n.jsx(F.IconChevronsLeft,{size:B.DIAL_ICON_SIZE.MD,stroke:re.DIAL_KIT_ICON_STROKE,"aria-hidden":"true"}):n.jsx(F.IconChevronsRight,{size:B.DIAL_ICON_SIZE.MD,stroke:re.DIAL_KIT_ICON_STROKE,"aria-hidden":"true"})})]})]})},su=({side:e,isResizing:t,width:r,minWidth:s,maxWidth:a,step:i,ariaLabel:o,onWidthChange:l,customHandler:c,handlerClassName:d})=>{const f=e===C.ResizableContainerSide.Left,p=f?F.IconChevronLeft:F.IconChevronRight,g=u=>{let m;switch(u.key){case"ArrowLeft":m=r+(f?i:-i);break;case"ArrowRight":m=r+(f?-i:i);break;case"Home":m=s;break;case"End":m=a;break;default:return}u.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:y.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(p,{size:B.DIAL_ICON_SIZE.MD,stroke:re.DIAL_KIT_ICON_STROKE,"aria-hidden":"true",className:y.mergeClasses("pointer-events-none absolute top-1/2 -translate-y-1/2",f?"right-full":"left-full")})})},au=16,us=({children:e,minWidth:t,maxWidth:r,width:s,defaultWidth:a,onResizeStop:i,onResize:o,side:l=C.ResizableContainerSide.Right,keyboardStep:c=au,ariaLabel:d="Resize panel",className:f,resizeHandlerClassName:p,resizeHandler:g})=>{const[u,m]=h.useState(!1),[v,x]=h.useState(a??t),b=s!==void 0,I=b?s:v,N=h.useRef(null),w=h.useCallback(()=>{m(!0)},[]),D=h.useCallback(()=>{m(!1);const O=N.current?.resizable?.getBoundingClientRect(),A=O?Math.round(O.width):t;b||x(A),i?.(A)},[i,b,t]),S=h.useCallback(O=>{const A=Math.min(r,Math.max(t,O));A!==I&&(b||(x(A),N.current?.updateSize({width:A,height:"100%"})),o?.(A),i?.(A))},[r,t,I,b,o,i]),_=h.useMemo(()=>{const O=l===C.ResizableContainerSide.Left,A=n.jsx(su,{side:l,isResizing:u,width:I,minWidth:t,maxWidth:r,step:c,ariaLabel:d,onWidthChange:S,customHandler:g,handlerClassName:p});return{size:b?{width:I,height:"100%"}:void 0,defaultSize:b?void 0:{width:I,height:"100%"},minWidth:t,maxWidth:r,enable:{left:O,right:!O},handleClasses:{right:"group",left:"group"},handleStyles:{right:{right:"-8px",zIndex:10},left:{left:0,zIndex:10}},handleComponent:{left:O?A:void 0,right:O?void 0:A},onResizeStart:w,onResize:(k,T,M)=>{o?.(Math.round(M.offsetWidth))},onResizeStop:D}},[l,b,I,t,r,c,d,S,g,p,u,w,D,o]);return n.jsx(C.Resizable,{ref:N,..._,children:n.jsx("div",{className:y.mergeClasses("group flex size-full flex-col bg-layer-raised transition-all motion-reduce:transition-none",f,j.DIAL_KIT_CLASS.resizableContainer),children:e})})},iu=({enabled:e=!0,children:t,...r})=>e?n.jsx(us,{...r,children:t}):t;var je=(e=>(e.InProgress="inProgress",e.Success="success",e.Warning="warning",e.Failed="failed",e.Canceled="canceled",e))(je||{});const fs=8e3,gt="flex size-7 shrink-0 items-center justify-center",ps={cancelItemAriaLabel:e=>`Cancel "${e}"`,itemProgressAriaLabel:e=>`"${e}" in progress`,successLabel:"Completed",canceledLabel:"Canceled",failedMessage:"Failed",warningMessage:"Completed with warnings",queueProgressAriaLabel:"Progress",queueProgressValueText:(e,t)=>`${e} of ${t}`,collapseAriaLabel:"Collapse",expandAriaLabel:"Expand",closeAriaLabel:"Close",closeConfirmHeader:"Close?",closeConfirmDescriptionInProgress:"Some items are still in progress.",closeConfirmDescriptionFailed:"Some items have failed.",closeConfirmDescriptionMixed:"Some items are still in progress, and some have failed.",closeConfirmLabel:"Close",closeCancelLabel:"Cancel"},ou=({title:e,failedCount:t,isCollapsed:r,itemsId:s,labels:a,onToggleCollapse:i,onClose:o})=>{const l=r?F.IconChevronUp:F.IconChevronDown;return n.jsxs("div",{className:"mx-4 flex items-center justify-between border-b border-tertiary py-3",children:[n.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[n.jsx("span",{className:"dial-small-paragraph-semi-text truncate text-primary",children:e}),t>0&&n.jsx("span",{className:"dial-small-paragraph-semi-text inline-flex h-4 min-w-4 shrink-0 items-center justify-center rounded-full bg-control-error px-1 text-control-permanent",children:t})]}),n.jsxs("div",{className:"flex shrink-0 items-center gap-1",children:[n.jsx(R.GhostIconButton,{"aria-label":r?a.expandAriaLabel:a.collapseAriaLabel,"aria-expanded":!r,"aria-controls":s,size:E.ElementSize.Small,icon:n.jsx(l,{size:B.DIAL_ICON_SIZE.SM,stroke:re.DIAL_KIT_ICON_STROKE,className:"text-secondary","aria-hidden":!0}),onClick:i,className:gt}),n.jsx(R.GhostIconButton,{"aria-label":a.closeAriaLabel,size:E.ElementSize.Small,icon:n.jsx(F.IconX,{size:B.DIAL_ICON_SIZE.SM,stroke:re.DIAL_KIT_ICON_STROKE,className:"text-secondary","aria-hidden":!0}),onClick:o,className:gt})]})]})},un=({message:e,isError:t})=>{const r=t?F.IconAlertCircleFilled:F.IconAlertTriangleFilled;return n.jsx(R.Tooltip,{tooltip:e,asChild:!0,children:n.jsx("span",{className:gt,role:"img","aria-label":e,tabIndex:0,children:n.jsx(r,{size:B.DIAL_ICON_SIZE.SM,className:t?"text-error":"text-warning-icon","aria-hidden":!0})})})},lu=({item:e,labels:t,onCancel:r})=>{const s=e.status===je.Canceled;return n.jsxs("div",{className:"group flex items-center gap-2 px-4 py-2",children:[n.jsx(jr,{type:C.DialItemType.File,name:e.name,size:B.DIAL_ICON_SIZE.MD,className:y.mergeClasses(s&&"opacity-50"),decorative:!0}),n.jsx(R.EllipsisTooltip,{text:e.name,className:y.mergeClasses("dial-small-text",s?"text-secondary":"text-primary")}),e.status===je.InProgress&&n.jsxs("div",{className:y.mergeClasses(gt,"grid"),children:[n.jsx(C.Spinner,{size:B.DIAL_ICON_SIZE.SM,ariaLabel:t.itemProgressAriaLabel(e.name),className:y.mergeClasses("pointer-events-none col-start-1 row-start-1 transition-opacity",r&&"group-focus-within:opacity-0 group-hover:opacity-0")}),r&&n.jsx(R.GhostIconButton,{"aria-label":t.cancelItemAriaLabel(e.name),size:E.ElementSize.Small,icon:n.jsx(F.IconX,{size:B.DIAL_ICON_SIZE.SM,stroke:re.DIAL_KIT_ICON_STROKE,className:"text-secondary","aria-hidden":!0}),onClick:()=>r(e.id),className:"col-start-1 row-start-1 opacity-0 transition-opacity group-focus-within:opacity-100 group-hover:opacity-100"})]}),e.status===je.Success&&n.jsx("span",{className:gt,role:"img","aria-label":t.successLabel,children:n.jsx(F.IconCheck,{size:B.DIAL_ICON_SIZE.SM,stroke:re.DIAL_KIT_ICON_STROKE,className:"text-accent","aria-hidden":!0})}),e.status===je.Warning&&n.jsx(un,{message:e.message||t.warningMessage,isError:!1}),e.status===je.Failed&&n.jsx(un,{message:e.message||t.failedMessage,isError:!0}),s&&n.jsx("span",{className:"dial-small-text shrink-0 text-secondary",children:t.canceledLabel})]})},cu=e=>Math.round(e.reduce((t,r)=>t+(r.percent??(r.status===je.InProgress?0:100)),0)/e.length),du=(e,t,r)=>e&&t?r.closeConfirmDescriptionMixed:t?r.closeConfirmDescriptionFailed:r.closeConfirmDescriptionInProgress,uu=({title:e,items:t,onClose:r,onCancelItem:s,labels:a,autoCloseDelay:i=fs,className:o,bodyClassName:l})=>{const[c,d]=h.useState(!1),[f,p]=h.useState(!1),g=h.useId(),u={...ps,...a},m=t.filter(S=>S.status===je.InProgress).length,v=m>0,x=t.filter(S=>S.status===je.Failed).length,b=x>0,I=t.length>0&&t.every(S=>S.status===je.Success),N=h.useCallback(()=>{v||b?p(!0):r()},[v,b,r]),w=h.useCallback(()=>{p(!1),r()},[r]),D=h.useCallback(()=>{d(S=>!S)},[]);return h.useEffect(()=>{if(!I||i<=0)return;const S=setTimeout(r,i);return()=>clearTimeout(S)},[I,i,r]),t.length===0?null:n.jsxs("div",{role:"status","aria-live":"polite",className:y.mergeClasses("w-[370px] max-w-[calc(100vw-2rem)] rounded-xl bg-layer-raised shadow-md",o,j.DIAL_KIT_CLASS.transferQueue),children:[n.jsx(ou,{title:e,failedCount:x,isCollapsed:c,itemsId:g,labels:u,onToggleCollapse:D,onClose:N}),c&&v&&n.jsx(hn,{value:cu(t),size:E.ElementSize.Small,"aria-label":u.queueProgressAriaLabel,"aria-valuetext":u.queueProgressValueText(t.length-m,t.length)}),!c&&n.jsx("div",{id:g,className:y.mergeClasses("flex max-h-[40vh] flex-col overflow-y-auto py-1",l),children:t.map(S=>n.jsx(lu,{item:S,labels:u,onCancel:s},S.id))}),n.jsx(is,{open:f,header:u.closeConfirmHeader,description:du(v,b,u),confirmLabel:u.closeConfirmLabel,cancelLabel:u.closeCancelLabel,variant:C.ConfirmationPopupVariant.Danger,onConfirm:w,onClose:()=>p(!1)})]})};exports.ConfirmationPopupVariant=C.ConfirmationPopupVariant;exports.DialBreadcrumb=C.DialBreadcrumb;exports.DialBreadcrumbItem=C.DialBreadcrumbItem;exports.DialButton=C.DialButton;exports.DialButtonDropdown=C.DialButtonDropdown;exports.DialCaptionText=C.DialCaptionText;exports.DialCollapsibleSidebar=C.DialCollapsibleSidebar;exports.DialConditionalResizableContainer=C.DialConditionalResizableContainer;exports.DialConfirmationPopup=C.DialConfirmationPopup;exports.DialDangerButton=C.DialDangerButton;exports.DialDestinationFolderPopup=C.DialDestinationFolderPopup;exports.DialErrorText=C.DialErrorText;exports.DialFileIcon=C.DialFileIcon;exports.DialFileManager=C.DialFileManager;exports.DialFileManagerActions=C.DialFileManagerActions;exports.DialFileManagerTabs=C.DialFileManagerTabs;exports.DialFileName=C.DialFileName;exports.DialFileNodeType=C.DialFileNodeType;exports.DialFilePermission=C.DialFilePermission;exports.DialFileResourceType=C.DialFileResourceType;exports.DialFolderName=C.DialFolderName;exports.DialFoldersTree=C.DialFoldersTree;exports.DialFormItem=C.DialFormItem;exports.DialGhostButton=C.DialGhostButton;exports.DialInput=C.DialInput;exports.DialItemType=C.DialItemType;exports.DialLinkButton=C.DialLinkButton;exports.DialLoader=C.DialLoader;exports.DialNeutralButton=C.DialNeutralButton;exports.DialNotification=C.DialNotification;exports.DialPopup=C.DialPopup;exports.DialPrimaryButton=C.DialPrimaryButton;exports.DialRadioGroup=C.DialRadioGroup;exports.DialResizableContainer=C.DialResizableContainer;exports.DialSearch=C.DialSearch;exports.DialSharedEntityIndicator=C.DialSharedEntityIndicator;exports.DialTabs=C.DialTabs;exports.EDITABLE_CONTAINER_ATTRIBUTE=C.EDITABLE_CONTAINER_ATTRIBUTE;exports.FileManagerColumnKey=C.FileManagerColumnKey;exports.FileManagerProvider=C.FileManagerProvider;exports.FlexibleActionsDirection=C.FlexibleActionsDirection;exports.FormItemOrientation=C.FormItemOrientation;exports.NAME_COLUMN=C.NAME_COLUMN;exports.NOT_ALLOWED_SPACES=C.NOT_ALLOWED_SPACES;exports.NOT_ALLOWED_SPACES_REGEXP=C.NOT_ALLOWED_SPACES_REGEXP;exports.NOT_ALLOWED_SYMBOLS=C.NOT_ALLOWED_SYMBOLS;exports.NOT_ALLOWED_SYMBOLS_REGEXP=C.NOT_ALLOWED_SYMBOLS_REGEXP;exports.NotificationType=C.NotificationType;exports.NotificationVariant=C.NotificationVariant;exports.PopupSize=C.PopupSize;exports.RadioGroupOrientation=C.RadioGroupOrientation;exports.ResizableContainerSide=C.ResizableContainerSide;exports.SIZE_COLUMN=C.SIZE_COLUMN;exports.ScreenResolution=C.ScreenResolution;exports.Skeleton=C.Skeleton;exports.SkeletonAvatarShape=C.SkeletonAvatarShape;exports.SkeletonAvatarSize=C.SkeletonAvatarSize;exports.SkeletonVariant=C.SkeletonVariant;exports.Spinner=C.Spinner;exports.TabOrientation=C.TabOrientation;exports.TabView=C.TabView;exports.UPDATED_AT_COLUMN=C.UPDATED_AT_COLUMN;exports.editableContainerProps=C.editableContainerProps;exports.useDialFileManagerTabs=C.useDialFileManagerTabs;exports.useEditableItem=C.useEditableItem;exports.useFileManagerContext=C.useFileManagerContext;exports.DialLabel=Re.DialLabel;exports.DialSwitch=Re.DialSwitch;exports.DEFAULT_GRID_DATE_FORMAT_OPTIONS=j.DEFAULT_DATE_FORMAT_OPTIONS;exports.DEFAULT_GRID_DATE_LOCALE=j.DEFAULT_LOCALE;exports.DIAL_KIT_CLASS=j.DIAL_KIT_CLASS;exports.DialCloseButton=j.DialCloseButton;exports.DialDangerIconButton=j.DialDangerIconButton;exports.DialDateCellRenderer=j.DialDateCellRenderer;exports.DialDropdown=j.DialDropdown;exports.DialEllipsisTooltip=j.DialEllipsisTooltip;exports.DialGhostIconButton=j.DialGhostIconButton;exports.DialGrid=j.DialGrid;exports.DialIcon=j.DialIcon;exports.DialNeutralIconButton=j.DialNeutralIconButton;exports.DialNoDataContent=j.DialNoDataContent;exports.DialPrimaryIconButton=j.DialPrimaryIconButton;exports.DialRadioButton=j.DialRadioButton;exports.DialSecondaryIconButton=j.DialSecondaryIconButton;exports.DialSuccessIconButton=j.DialSuccessIconButton;exports.DialTertiaryIconButton=j.DialTertiaryIconButton;exports.DropdownItemType=j.DropdownItemType;exports.DropdownTrigger=j.DropdownTrigger;exports.DropdownType=j.DropdownType;exports.GridSelectionMode=j.GridSelectionMode;exports.ThemeScope=j.ThemeScope;exports.baseColumnComparator=j.baseColumnComparator;exports.checkColDefsChanges=j.checkColDefsChanges;exports.convertGridDateToDate=j.convertToDate;exports.convertToDate=j.convertToDate;exports.useThemeScope=j.useThemeScope;exports.BASE_ICON_PROPS=B.BASE_ICON_PROPS;exports.BASE_ICON_SIZE=B.BASE_ICON_SIZE;exports.DIAL_ICON_SIZE=B.DIAL_ICON_SIZE;exports.mergeClasses=y.mergeClasses;exports.Checkbox=R.Checkbox;exports.CheckboxBox=R.CheckboxBox;exports.CloseButton=R.CloseButton;exports.DEFAULT_DATE_FORMAT_OPTIONS=R.DEFAULT_DATE_FORMAT_OPTIONS;exports.DEFAULT_DATE_LOCALE=R.DEFAULT_LOCALE;exports.DangerIconButton=R.DangerIconButton;exports.DateCellRenderer=R.DateCellRenderer;exports.Dropdown=R.Dropdown;exports.EllipsisTooltip=R.EllipsisTooltip;exports.GRID_ALIGN_RIGHT_CLASS=R.GRID_ALIGN_RIGHT_CLASS;exports.GRID_ROOT_CLASS=R.GRID_ROOT_CLASS;exports.GRID_ROW_HEIGHT=R.ROW_HEIGHT;exports.GRID_SELECTION_COLUMN_ID=R.GRID_SELECTION_COLUMN_ID;exports.GRID_THEME_PARAMS=R.GRID_THEME_PARAMS;exports.GhostIconButton=R.GhostIconButton;exports.Grid=R.Grid;exports.IconButton=R.IconButton;exports.InfoButton=R.InfoButton;exports.InteractiveTooltip=R.InteractiveTooltip;exports.Label=R.Label;exports.MenuItem=R.MenuItem;exports.MenuItemMark=R.MenuItemMark;exports.NeutralIconButton=R.NeutralIconButton;exports.NoDataContent=R.NoDataContent;exports.PrimaryIconButton=R.PrimaryIconButton;exports.Radio=R.Radio;exports.StaticIconButton=R.StaticIconButton;exports.Tooltip=R.Tooltip;exports.TooltipContainer=R.TooltipContainer;exports.TooltipContent=R.TooltipContent;exports.TooltipPlacement=R.TooltipPlacement;exports.TooltipTrigger=R.TooltipTrigger;exports.ButtonAppearance=E.ButtonAppearance;exports.ButtonVariant=E.ButtonVariant;exports.DialIconButton=E.DialIconButton;exports.DialTooltip=E.DialTooltip;exports.DialTooltipContainer=E.DialTooltipContainer;exports.DialTooltipContent=E.DialTooltipContent;exports.DialTooltipTrigger=E.DialTooltipTrigger;exports.ElementSize=E.ElementSize;exports.EditorThemes=ht.EditorThemes;exports.LazyDialJsonEditor=ht.LazyDialJsonEditor;exports.LazyDialMarkdownEditor=ht.LazyDialMarkdownEditor;exports.LazyMarkdownEditor=ht.LazyMarkdownEditor;exports.DIAL_KIT_ICON_STROKE=re.DIAL_KIT_ICON_STROKE;exports.Accordion=Zc;exports.AccordionCaretPosition=wt;exports.AnalyticsCardVariant=dt;exports.Avatar=Vd;exports.AvatarShape=pt;exports.Badge=zd;exports.BadgeColor=Ae;exports.BadgeVariant=Fe;exports.BottomSheet=Md;exports.Breadcrumbs=ql;exports.BreadcrumbsSize=qe;exports.Button=Je;exports.ButtonDropdown=nc;exports.Calendar=Rl;exports.CalendarMode=be;exports.CaptionText=Be;exports.CardShell=ol;exports.CollapsibleSidebar=nu;exports.ConditionalResizableContainer=iu;exports.ConfirmationPopup=is;exports.DEFAULT_ANALYTICS_BAR_COLOR_MAP=dr;exports.DEFAULT_TRANSFER_QUEUE_LABELS=ps;exports.DangerButton=Yl;exports.DialAccordion=fn;exports.DialAnalyticsBar=vt;exports.DialAnalyticsBarGroup=Ns;exports.DialAnalyticsCard=Is;exports.DialAnalyticsErrorTag=cr;exports.DialAnalyticsHistogram=Os;exports.DialAutocompleteInputValue=wn;exports.DialCheckbox=er;exports.DialDraggableItem=Vi;exports.DialDropdownIcon=ko;exports.DialFormPopup=ro;exports.DialInputPopup=En;exports.DialLabelledText=$s;exports.DialLoadFileArea=Fn;exports.DialLoadFileAreaField=Lo;exports.DialNumberInput=ar;exports.DialPagination=Rs;exports.DialPasswordInput=On;exports.DialRadioGroupPopupField=Qi;exports.DialRemoveButton=kt;exports.DialSchemaRenderer=el;exports.DialSegmentedControl=Yi;exports.DialSelect=Te;exports.DialSelectField=ho;exports.DialSlider=zs;exports.DialSteps=Bs;exports.DialTag=Ue;exports.DialTagInput=Tn;exports.DialTextarea=Ki;exports.ErrorMessageNotification=gl;exports.ErrorText=ze;exports.ErrorToastNotification=ll;exports.FabButton=tc;exports.FileDropzone=Sd;exports.FileIcon=jr;exports.FileName=cs;exports.FilterChips=Dd;exports.FolderName=Rd;exports.FolderPath=Ml;exports.GeneralMessageNotification=Cl;exports.GeneralToastNotification=pl;exports.GhostButton=Jl;exports.Highlight=il;exports.InfoMessageNotification=hl;exports.InfoToastNotification=cl;exports.InlineSelect=sc;exports.InlineSelectTrigger=es;exports.Input=Ye;exports.JsonSchemaType=V;exports.LinkButton=Ql;exports.LoadingMessageNotification=bl;exports.LoadingToastNotification=fl;exports.MultiSelectTags=ss;exports.NeutralButton=Sr;exports.Notification=yr;exports.NumberInput=Lc;exports.OutlinedButton=ec;exports.PasswordInput=Ec;exports.Popup=Nr;exports.PrimaryButton=Jn;exports.ProgressBar=hn;exports.RadioGroup=os;exports.RadioGroupPopupField=od;exports.ResizableContainer=us;exports.SchemaDisplayMode=ut;exports.SchemaOrientation=Mt;exports.SchemaRendererVariant=nt;exports.Search=Qd;exports.SegmentedControl=bd;exports.Select=jc;exports.SelectSize=St;exports.SelectVariant=Nt;exports.SharedEntityIndicator=ls;exports.SideDrawer=Kd;exports.Slider=tu;exports.StarterButton=Xl;exports.StepStatus=Ce;exports.SuccessMessageNotification=ml;exports.SuccessToastNotification=dl;exports.Switch=Wc;exports.TRANSFER_QUEUE_AUTO_CLOSE_DELAY_MS=fs;exports.Tabs=vd;exports.Tag=Ze;exports.TagAppearance=Xe;exports.TagInput=Yd;exports.Textarea=wc;exports.TextareaResize=as;exports.ToggleIconButton=ld;exports.TransferQueue=uu;exports.TransferQueueItemStatus=je;exports.WarningMessageNotification=xl;exports.WarningToastNotification=ul;exports.extractInitials=ds;exports.getTimezoneLabel=Bn;exports.matchesAccept=lr;exports.wrapInRootFolder=zo;