"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var s=require("../../../../_virtual/jsx-runtime.js"),n=require("react"),b=require("../../Toast/index.js"),M=require("../../Toast/ToastCompact.js"),P=require("../constants.js"),D=require("../styles.js"),k=require("../../../../utils/index.js");function I(t){const{message:c,toastType:v,action:f,variant:o,autoHideDuration:i,onClose:E,icon:j,primaryAction:d,dismissAction:q,position:y}=t,a=n.useRef(i),[u,m]=n.useState(!0);n.useEffect(()=>(i&&(a.current=window.setTimeout(l,i)),()=>{a.current&&clearTimeout(a.current)}),[i]);const l=()=>{m(!1)},h=()=>{u||(E(),m(!0))},C=e=>()=>{e&&e.onClick(),l()},T=(e,r)=>({text:r?r.text:e,onClick:C(r)}),g=e=>T("OK",e),R=e=>T("Dismiss",e),x=k.getId(t["data-testid"]),A=k.getId(t["data-trackid"]);return s.jsxRuntimeExports.jsx(D.AnimatedToastMessage,{entering:u,position:y,onAnimationEnd:h,children:v===P.TOAST_TYPE_DEFAULT?s.jsxRuntimeExports.jsx(b.Toast,{message:c,action:f,variant:o,icon:j,primaryAction:g(d),dismissAction:R(q),"data-testid":x(),"data-trackid":A(),"aria-label":t["aria-label"],"aria-checked":t["aria-checked"]}):s.jsxRuntimeExports.jsx(M.ToastCompact,{message:c,variant:o,primaryAction:g(d),"data-testid":x(),"data-trackid":A(),"aria-label":t["aria-label"],"aria-checked":t["aria-checked"]})})}exports.MessageProviderToast=I;
