import t from"../../../../@reach/alert/dist/reach-alert.esm.js";import*as e from"react";import{getToastStyle as o}from"./toast.utils.js";import{useIsPresent as i}from"../../../../framer-motion/dist/es/components/AnimatePresence/use-presence.js";import{useTimeout as s}from"../../../hooks/dist/esm/use-timeout.js";import{motion as a}from"../../../../framer-motion/dist/es/render/dom/motion.js";import{useUpdateEffect as r}from"../../../hooks/dist/esm/use-update-effect.js";import{isFunction as m,__DEV__ as n}from"../../../utils/dist/esm/assertion.js";var l={initial:t=>{var{position:e}=t,o=["top","bottom"].includes(e)?"y":"x",i=["top-right","bottom-right"].includes(e)?1:-1;return"bottom"===e&&(i=1),{opacity:0,[o]:24*i}},animate:{opacity:1,y:0,x:0,scale:1,transition:{duration:.4,ease:[.4,0,.2,1]}},exit:{opacity:0,scale:.85,transition:{duration:.2,ease:[.4,0,1,1]}}},u=n=>{var{id:u,message:p,onCloseComplete:c,onRequestRemove:d,requestClose:f=!1,position:h="bottom",duration:v=5e3}=n,[y,j]=e.useState(v),x=i();r((()=>{x||null==c||c()}),[x]),r((()=>{j(v)}),[v]);var E=()=>{x&&d()};e.useEffect((()=>{x&&f&&d()}),[x,f,d]),s(E,y);var b=e.useMemo((()=>o(h)),[h]);return e.createElement(a.li,{layout:!0,className:"chakra-toast",variants:l,initial:"initial",animate:"animate",exit:"exit",onHoverStart:()=>j(null),onHoverEnd:()=>j(v),custom:{position:h},style:b},e.createElement(t,{className:"chakra-toast__inner",style:{pointerEvents:"auto",maxWidth:560,minWidth:300,margin:"0.5rem"}},m(p)?p({id:u,onClose:E}):p))};n&&(u.displayName="Toast");export{u as Toast};
//# sourceMappingURL=toast.js.map
