"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var s=require('./../../ext-esm/tslib/tslib.es6.js'),e=require("react/jsx-runtime"),o=require("react"),i=require("classnames"),n=require("lodash"),c=require("@material-ui/core"),t=require("../IconButton/index.js"),r=require("../../constants/notifications.js"),a=require("./Toast.styles.js"),l=require("../../icons/iconParkIcons.js");function u(s){return s&&"object"==typeof s&&"default"in s?s:{default:s}}require("../../icons/customIcons/icons/AddMessage.js"),require("../../icons/customIcons/icons/Attention.js"),require("../../icons/customIcons/icons/Collapse.js"),require("../../icons/customIcons/icons/Dashboard.js"),require("../../icons/customIcons/icons/Expand.js"),require("../../icons/customIcons/icons/FolderClosed.js"),require("../../icons/customIcons/icons/FolderClosedFilled.js"),require("../../icons/customIcons/icons/FolderOpened.js"),require("../../icons/customIcons/icons/GreaterOrEqual.js"),require("../../icons/customIcons/icons/LessOrEqual.js"),require("../../icons/customIcons/icons/Search.js"),require("../../icons/customIcons/icons/Wellhub.js"),require("../../icons/customIcons/icons/MultiRuler.js"),require("../../icons/customIcons/icons/Checkbox.js"),require("../../icons/customIcons/icons/CheckboxChecked.js"),require("../../icons/customIcons/icons/CheckboxIndeterminate.js"),require("../../icons/customIcons/icons/Radio.js"),require("../../icons/customIcons/icons/RadioChecked.js"),require("../../icons/customIcons/icons/SimulFrac.js"),require("../../icons/customIcons/icons/ZipperFrac.js"),require("../../icons/customIcons/icons/CautionFilled.js"),require("../../icons/customIcons/icons/MoreApp.js");var d,I=u(i),m=((d={})[r.NOTIFICATION_VARIANTS.success]=l.CheckOneIcon,d[r.NOTIFICATION_VARIANTS.warning]=l.CautionIcon,d[r.NOTIFICATION_VARIANTS.error]=l.AttentionIcon,d[r.NOTIFICATION_VARIANTS.info]=l.InfoIcon,d[r.NOTIFICATION_VARIANTS.neutral]=l.PuzzleIcon,d);exports.Toast=function(i){var u,d=i.onDismissClick,j=i.toast,p=s.__rest(i,["onDismissClick","toast"]),f=j.alertLevel,q=j.autoHideDuration,C=void 0===q?3e3:q,N=j.content,T=j.hideIcon,h=j.icon,A=j.id,x=j.onClick,v=void 0===x?n.noop:x,O=j.onClose,b=void 0===O?n.noop:O,_=j.timestamp,g=j.title,k=j.tooltipProps,F=j.variant,S=void 0===F?"info":F;o.useEffect((function(){if(C!==1/0){var s=setTimeout((function(){return d(A)}),C);return function(){return clearTimeout(s)}}}),[]);var y=a.useStyles(),R=m[S];return e.jsx(c.Grow,{appear:!0,in:!0,children:e.jsx(c.SnackbarContent,s.__assign({classes:{root:I.default(y.main,!f&&y[S],f&&y.alertNotification,f&&y["alertLevels-".concat(f)]),action:y.actionContainer,message:y.messageContainer},"aria-describedby":"client-snackbar","data-testid":"notificationPopup_".concat(r.NOTIFICATION_VARIANTS[S]),message:e.jsx(c.Tooltip,s.__assign({},k,{title:N,classes:{tooltip:y.tooltip},placement:"bottom",children:e.jsxs("div",{id:"client-snackbar",className:y.messageWrapper,onClick:v,children:[!T&&e.jsx("div",{className:y.iconWrapper,children:h?o.cloneElement(h,{className:y.icon,nativeColor:"#fff"}):e.jsx(R,{fill:S===r.NOTIFICATION_VARIANTS.warning?"#000":"#fff",size:16,className:y.icon})}),e.jsxs("div",{className:y.message,children:[e.jsxs("div",{className:y.messageTop,children:[g&&e.jsx(c.Typography,{"data-testid":"title",variant:"subtitle2",className:I.default(y.title,(u={},u[y.alertTitle]=f,u)),children:g}),_&&e.jsx(c.Typography,{className:I.default(y.timestamp,!f&&y[S]),children:_})]}),e.jsx("div",{className:I.default(y.messageContent,!f&&y[S]),children:e.jsx(c.Typography,{"data-testid":"content",className:I.default(f?y.alertContent:y.content),children:N})})]})]})})),action:[e.jsx(t,{"data-testid":"closeButton","aria-label":"Close",color:"inherit",onClick:function(){b(),d(A)},size:"small",tooltipProps:{title:"Close",classes:{tooltip:y.tooltip}},className:y.closeIconButton,children:e.jsx(l.CloseSmallIcon,{size:24,fill:f?"#000":"#fff"})},"close")]},p))})};
