import{_ as g}from"./objectWithoutPropertiesLoose-Cv5OCJ0e.js";import{a as x,R as v}from"./index-nY9tUGNj.js";function b(u,s){return b=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,i){return r.__proto__=i,r},b(u,s)}function k(u,s){u.prototype=Object.create(s.prototype),u.prototype.constructor=u,b(u,s)}const N={disabled:!1},O=x.createContext(null);var D=function(s){return s.scrollTop},m="unmounted",l="exited",f="entering",h="entered",T="exiting",p=function(u){k(s,u);function s(i,e){var t;t=u.call(this,i,e)||this;var n=e,o=n&&!n.isMounting?i.enter:i.appear,a;return t.appearStatus=null,i.in?o?(a=l,t.appearStatus=f):a=h:i.unmountOnExit||i.mountOnEnter?a=m:a=l,t.state={status:a},t.nextCallback=null,t}s.getDerivedStateFromProps=function(e,t){var n=e.in;return n&&t.status===m?{status:l}:null};var r=s.prototype;return r.componentDidMount=function(){this.updateStatus(!0,this.appearStatus)},r.componentDidUpdate=function(e){var t=null;if(e!==this.props){var n=this.state.status;this.props.in?n!==f&&n!==h&&(t=f):(n===f||n===h)&&(t=T)}this.updateStatus(!1,t)},r.componentWillUnmount=function(){this.cancelNextCallback()},r.getTimeouts=function(){var e=this.props.timeout,t,n,o;return t=n=o=e,e!=null&&typeof e!="number"&&(t=e.exit,n=e.enter,o=e.appear!==void 0?e.appear:n),{exit:t,enter:n,appear:o}},r.updateStatus=function(e,t){if(e===void 0&&(e=!1),t!==null)if(this.cancelNextCallback(),t===f){if(this.props.unmountOnExit||this.props.mountOnEnter){var n=this.props.nodeRef?this.props.nodeRef.current:v.findDOMNode(this);n&&D(n)}this.performEnter(e)}else this.performExit();else this.props.unmountOnExit&&this.state.status===l&&this.setState({status:m})},r.performEnter=function(e){var t=this,n=this.props.enter,o=this.context?this.context.isMounting:e,a=this.props.nodeRef?[o]:[v.findDOMNode(this),o],c=a[0],E=a[1],S=this.getTimeouts(),C=o?S.appear:S.enter;if(!e&&!n||N.disabled){this.safeSetState({status:h},function(){t.props.onEntered(c)});return}this.props.onEnter(c,E),this.safeSetState({status:f},function(){t.props.onEntering(c,E),t.onTransitionEnd(C,function(){t.safeSetState({status:h},function(){t.props.onEntered(c,E)})})})},r.performExit=function(){var e=this,t=this.props.exit,n=this.getTimeouts(),o=this.props.nodeRef?void 0:v.findDOMNode(this);if(!t||N.disabled){this.safeSetState({status:l},function(){e.props.onExited(o)});return}this.props.onExit(o),this.safeSetState({status:T},function(){e.props.onExiting(o),e.onTransitionEnd(n.exit,function(){e.safeSetState({status:l},function(){e.props.onExited(o)})})})},r.cancelNextCallback=function(){this.nextCallback!==null&&(this.nextCallback.cancel(),this.nextCallback=null)},r.safeSetState=function(e,t){t=this.setNextCallback(t),this.setState(e,t)},r.setNextCallback=function(e){var t=this,n=!0;return this.nextCallback=function(o){n&&(n=!1,t.nextCallback=null,e(o))},this.nextCallback.cancel=function(){n=!1},this.nextCallback},r.onTransitionEnd=function(e,t){this.setNextCallback(t);var n=this.props.nodeRef?this.props.nodeRef.current:v.findDOMNode(this),o=e==null&&!this.props.addEndListener;if(!n||o){setTimeout(this.nextCallback,0);return}if(this.props.addEndListener){var a=this.props.nodeRef?[this.nextCallback]:[n,this.nextCallback],c=a[0],E=a[1];this.props.addEndListener(c,E)}e!=null&&setTimeout(this.nextCallback,e)},r.render=function(){var e=this.state.status;if(e===m)return null;var t=this.props,n=t.children;t.in,t.mountOnEnter,t.unmountOnExit,t.appear,t.enter,t.exit,t.timeout,t.addEndListener,t.onEnter,t.onEntering,t.onEntered,t.onExit,t.onExiting,t.onExited,t.nodeRef;var o=g(t,["children","in","mountOnEnter","unmountOnExit","appear","enter","exit","timeout","addEndListener","onEnter","onEntering","onEntered","onExit","onExiting","onExited","nodeRef"]);return x.createElement(O.Provider,{value:null},typeof n=="function"?n(e,o):x.cloneElement(x.Children.only(n),o))},s}(x.Component);p.contextType=O;p.propTypes={};function d(){}p.defaultProps={in:!1,mountOnEnter:!1,unmountOnExit:!1,appear:!1,enter:!0,exit:!0,onEnter:d,onEntering:d,onEntered:d,onExit:d,onExiting:d,onExited:d};p.UNMOUNTED=m;p.EXITED=l;p.ENTERING=f;p.ENTERED=h;p.EXITING=T;export{h as E,p as T,k as _,f as a,T as b,l as c,O as d};
