import{H as t,_ as n,_t as e,d as i,f as o,m as s,p as r,yt as a}from"./render-cqdoDfd9.js";function u(t){return t&&t.ownerDocument||document}function l(t,n){"function"==typeof t?t(n):t&&(t.current=n)}var p=a(e());function c(t){const{controlled:n,default:e,name:i,state:o="value"}=t,{current:s}=p.useRef(void 0!==n),[r,a]=p.useState(e);return[s?n:r,p.useCallback(t=>{s||a(t)},[])]}var f=c,d=!1,h=a(o()),E="unmounted",x="exited",m="entering",v="entered",S="exiting",b=function(t){function n(n,e){var i,o=t.call(this,n,e)||this,s=e&&!e.isMounting?n.enter:n.appear;return o.appearStatus=null,n.in?s?(i=x,o.appearStatus=m):i=v:i=n.unmountOnExit||n.mountOnEnter?E:x,o.state={status:i},o.nextCallback=null,o}r(n,t),n.getDerivedStateFromProps=function(t,n){return t.in&&"unmounted"===n.status?{status:x}:null};var e=n.prototype;return e.componentDidMount=function(){this.updateStatus(!0,this.appearStatus)},e.componentDidUpdate=function(t){var n=null;if(t!==this.props){var e=this.state.status;this.props.in?"entering"!==e&&"entered"!==e&&(n=m):"entering"!==e&&"entered"!==e||(n=S)}this.updateStatus(!1,n)},e.componentWillUnmount=function(){this.cancelNextCallback()},e.getTimeouts=function(){var t,n,e=this.props.timeout,i=t=n=e;return null!=e&&"number"!=typeof e&&(i=e.exit,t=e.enter,n=void 0!==e.appear?e.appear:t),{exit:i,enter:t,appear:n}},e.updateStatus=function(t,n){if(void 0===t&&(t=!1),null!==n)if(this.cancelNextCallback(),"entering"===n){if(this.props.unmountOnExit||this.props.mountOnEnter){var e=this.props.nodeRef?this.props.nodeRef.current:h.default.findDOMNode(this);e&&function(t){t.scrollTop}(e)}this.performEnter(t)}else this.performExit();else this.props.unmountOnExit&&"exited"===this.state.status&&this.setState({status:E})},e.performEnter=function(t){var n=this,e=this.props.enter,i=this.context?this.context.isMounting:t,o=this.props.nodeRef?[i]:[h.default.findDOMNode(this),i],s=o[0],r=o[1],a=this.getTimeouts(),u=i?a.appear:a.enter;!t&&!e||d?this.safeSetState({status:v},function(){n.props.onEntered(s)}):(this.props.onEnter(s,r),this.safeSetState({status:m},function(){n.props.onEntering(s,r),n.onTransitionEnd(u,function(){n.safeSetState({status:v},function(){n.props.onEntered(s,r)})})}))},e.performExit=function(){var t=this,n=this.props.exit,e=this.getTimeouts(),i=this.props.nodeRef?void 0:h.default.findDOMNode(this);n&&!d?(this.props.onExit(i),this.safeSetState({status:S},function(){t.props.onExiting(i),t.onTransitionEnd(e.exit,function(){t.safeSetState({status:x},function(){t.props.onExited(i)})})})):this.safeSetState({status:x},function(){t.props.onExited(i)})},e.cancelNextCallback=function(){null!==this.nextCallback&&(this.nextCallback.cancel(),this.nextCallback=null)},e.safeSetState=function(t,n){n=this.setNextCallback(n),this.setState(t,n)},e.setNextCallback=function(t){var n=this,e=!0;return this.nextCallback=function(i){e&&(e=!1,n.nextCallback=null,t(i))},this.nextCallback.cancel=function(){e=!1},this.nextCallback},e.onTransitionEnd=function(t,n){this.setNextCallback(n);var e=this.props.nodeRef?this.props.nodeRef.current:h.default.findDOMNode(this),i=null==t&&!this.props.addEndListener;if(e&&!i){if(this.props.addEndListener){var o=this.props.nodeRef?[this.nextCallback]:[e,this.nextCallback],s=o[0],r=o[1];this.props.addEndListener(s,r)}null!=t&&setTimeout(this.nextCallback,t)}else setTimeout(this.nextCallback,0)},e.render=function(){var t=this.state.status;if("unmounted"===t)return null;var n=this.props,e=n.children;n.in,n.mountOnEnter,n.unmountOnExit,n.appear,n.enter,n.exit,n.timeout,n.addEndListener,n.onEnter,n.onEntering,n.onEntered,n.onExit,n.onExiting,n.onExited,n.nodeRef;var o=s(n,["children","in","mountOnEnter","unmountOnExit","appear","enter","exit","timeout","addEndListener","onEnter","onEntering","onEntered","onExit","onExiting","onExited","nodeRef"]);return p.createElement(i.Provider,{value:null},"function"==typeof e?e(t,o):p.cloneElement(p.Children.only(e),o))},n}(p.Component);function g(){}function C(t){return parseInt("19.2.4",10)>=19?t?.props?.ref||null:t?.ref||null}b.contextType=i,b.propTypes={},b.defaultProps={in:!1,mountOnEnter:!1,unmountOnExit:!1,appear:!1,enter:!0,exit:!0,onEnter:g,onEntering:g,onEntered:g,onExit:g,onExiting:g,onExited:g},b.UNMOUNTED=E,b.EXITED=x,b.ENTERING=m,b.ENTERED=v,b.EXITING=S;var k=p.forwardRef(function(e,i){const{children:o,container:s,disablePortal:r=!1}=e,[a,u]=p.useState(null),c=n(p.isValidElement(o)?C(o):null,i);if(t(()=>{r||u(function(t){return"function"==typeof t?t():t}(s)||document.body)},[s,r]),t(()=>{if(a&&!r)return l(i,a),()=>{l(i,null)}},[i,a,r]),r){if(p.isValidElement(o)){const t={ref:c};return p.cloneElement(o,t)}return o}return a?h.createPortal(o,a):a}),T=t=>t.scrollTop;function N(t,n){const{timeout:e,easing:i,style:o={}}=t;return{duration:o.transitionDuration??("number"==typeof e?e:e[n.mode]||0),easing:o.transitionTimingFunction??("object"==typeof i?i[n.mode]:i),delay:o.transitionDelay}}export{b as a,u as c,C as i,T as n,f as o,k as r,c as s,N as t};