import{_ as __rest,a as __assign}from"./tslib.es6-bjGg6Bxl.js";import React__default,{useState,useEffect}from"react";import{I as Icon}from"./Icon.component-7-ap-6Ys.js";var toastStyles="\n    jn-bg-theme-background-lvl-1\n    jn-text-theme-high \n    jn-inline-flex\t\n    jn-items-start\n    jn-p-2\n    jn-mb-8\n    jn-rounded\n",toastStylesText="\n    jn-mx-4\n    jn-max-w-full\n",getMuiIcon=function(a){return"error"===a?"dangerous":a},Toast=function(a){var b=a.variant,c=void 0===b?"info":b,d=a.children,e=void 0===d?null:d,f=a.text,g=void 0===f?"":f,h=a.autoDismiss,i=void 0!==h&&h,j=a.autoDismissTimeout,k=void 0===j?1e4:j,l=a.onDismiss,m=a.className,n=void 0===m?"":m,o=__rest(a,["variant","children","text","autoDismiss","autoDismissTimeout","onDismiss","className"]),p=useState(!0),q=p[0],r=p[1],s=React__default.useRef(setTimeout(function(){return t()},k));React__default.useEffect(function(){return function(){return clearTimeout(s.current)}},[]),useEffect(function(){i&&(clearTimeout(s.current),s.current=setTimeout(function(){return t()},k))},[i,k]);var t=function(){r(!1),l&&l()};return React__default.createElement(React__default.Fragment,null,q&&(React__default.createElement("div",__assign({className:"juno-toast juno-toast-".concat(c," ").concat(toastStyles," ").concat(n)},o),React__default.createElement(Icon,{icon:getMuiIcon(c),color:"jn-text-theme-"+c,className:"jn-shrink-0"}),React__default.createElement("div",{className:"juno-toast-text ".concat(toastStylesText)},e?e:g),React__default.createElement(Icon,{icon:"close",onClick:t,className:"juno-message-close-button jn-opacity-50 hover:jn-opacity-100 jn-shrink-0"}))))};export{Toast as T};