import{bh as Z,bi as tt,r as y,ar as et,bj as nt,bk as it,as as ot,av as o,ak as rt,bl as st,aw as at,X as C,ax as lt,ay as pt,aA as T,bm as N}from"./index-CYy8zBsj.js";function dt(n){return Z("MuiCollapse",n)}tt("MuiCollapse",["root","horizontal","vertical","entered","hidden","wrapper","wrapperInner"]);const ct=["addEndListener","children","className","collapsedSize","component","easing","in","onEnter","onEntered","onEntering","onExit","onExited","onExiting","orientation","style","timeout","TransitionComponent"],ut=n=>{const{orientation:e,classes:r}=n,d={root:["root",`${e}`],entered:["entered"],hidden:["hidden"],wrapper:["wrapper",`${e}`],wrapperInner:["wrapperInner",`${e}`]};return pt(d,dt,r)},ht=T("div",{name:"MuiCollapse",slot:"Root",overridesResolver:(n,e)=>{const{ownerState:r}=n;return[e.root,e[r.orientation],r.state==="entered"&&e.entered,r.state==="exited"&&!r.in&&r.collapsedSize==="0px"&&e.hidden]}})(({theme:n,ownerState:e})=>o({height:0,overflow:"hidden",transition:n.transitions.create("height")},e.orientation==="horizontal"&&{height:"auto",width:0,transition:n.transitions.create("width")},e.state==="entered"&&o({height:"auto",overflow:"visible"},e.orientation==="horizontal"&&{width:"auto"}),e.state==="exited"&&!e.in&&e.collapsedSize==="0px"&&{visibility:"hidden"})),mt=T("div",{name:"MuiCollapse",slot:"Wrapper",overridesResolver:(n,e)=>e.wrapper})(({ownerState:n})=>o({display:"flex",width:"100%"},n.orientation==="horizontal"&&{width:"auto",height:"100%"})),gt=T("div",{name:"MuiCollapse",slot:"WrapperInner",overridesResolver:(n,e)=>e.wrapperInner})(({ownerState:n})=>o({width:"100%"},n.orientation==="horizontal"&&{width:"auto",height:"100%"})),xt=y.forwardRef(function(e,r){const d=et({props:e,name:"MuiCollapse"}),{addEndListener:S,children:P,className:A,collapsedSize:g="0px",component:U,easing:D,in:$,onEnter:b,onEntered:W,onEntering:j,onExit:I,onExited:_,onExiting:M,orientation:F="vertical",style:z,timeout:a=it.standard,TransitionComponent:k=nt}=d,X=ot(d,ct),x=o({},d,{orientation:F,collapsedSize:g}),c=ut(x),H=rt(),q=st(),l=y.useRef(null),v=y.useRef(),f=typeof g=="number"?`${g}px`:g,u=F==="horizontal",h=u?"width":"height",E=y.useRef(null),B=at(r,E),p=t=>i=>{if(t){const s=E.current;i===void 0?t(s):t(s,i)}},R=()=>l.current?l.current[u?"clientWidth":"clientHeight"]:0,G=p((t,i)=>{l.current&&u&&(l.current.style.position="absolute"),t.style[h]=f,b&&b(t,i)}),J=p((t,i)=>{const s=R();l.current&&u&&(l.current.style.position="");const{duration:m,easing:w}=N({style:z,timeout:a,easing:D},{mode:"enter"});if(a==="auto"){const L=H.transitions.getAutoHeightDuration(s);t.style.transitionDuration=`${L}ms`,v.current=L}else t.style.transitionDuration=typeof m=="string"?m:`${m}ms`;t.style[h]=`${s}px`,t.style.transitionTimingFunction=w,j&&j(t,i)}),K=p((t,i)=>{t.style[h]="auto",W&&W(t,i)}),O=p(t=>{t.style[h]=`${R()}px`,I&&I(t)}),Q=p(_),V=p(t=>{const i=R(),{duration:s,easing:m}=N({style:z,timeout:a,easing:D},{mode:"exit"});if(a==="auto"){const w=H.transitions.getAutoHeightDuration(i);t.style.transitionDuration=`${w}ms`,v.current=w}else t.style.transitionDuration=typeof s=="string"?s:`${s}ms`;t.style[h]=f,t.style.transitionTimingFunction=m,M&&M(t)}),Y=t=>{a==="auto"&&q.start(v.current||0,t),S&&S(E.current,t)};return C.jsx(k,o({in:$,onEnter:G,onEntered:K,onEntering:J,onExit:O,onExited:Q,onExiting:V,addEndListener:Y,nodeRef:E,timeout:a==="auto"?null:a},X,{children:(t,i)=>C.jsx(ht,o({as:U,className:lt(c.root,A,{entered:c.entered,exited:!$&&f==="0px"&&c.hidden}[t]),style:o({[u?"minWidth":"minHeight"]:f},z),ref:B},i,{ownerState:o({},x,{state:t}),children:C.jsx(mt,{ownerState:o({},x,{state:t}),className:c.wrapper,ref:l,children:C.jsx(gt,{ownerState:o({},x,{state:t}),className:c.wrapperInner,children:P})})}))}))});xt.muiSupportAuto=!0;export{xt as C};
