"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@babel/runtime/helpers/extends"),t=require("@babel/runtime/helpers/defineProperty"),r=require("@babel/runtime/helpers/objectWithoutProperties"),o=require("react"),n=require("clsx"),i=require("react-transition-group"),c=require("@prom-ui/core/Portal"),u=require("@prom-ui/core/useForwardRef");function a(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}function s(e){if(e&&"object"==typeof e&&"default"in e)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(r){if("default"!==r){var o=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,o.get?o:{enumerable:!0,get:function(){return e[r]}})}})),t.default=e,Object.freeze(t)}var l=a(e),f=a(t),p=a(r),d=s(o),b=a(n),y={root:"zviPe",content:"v4tgu","root_position_top-center":"TR90b","root_position_bottom-center":"YlR9W","root_position_top-left":"QBAq1","root_position_top-right":"DzSIt","root_position_bottom-left":"ZNKwU","root_position_bottom-right":"DvkY7",enterActive:"b-sYk",exitActive:"CXTc9",enter:"V8HbR",exit:"FAqxX"},O=["isOpen","onClose","onOpened","onClosed","children","className","style","position","zIndex","padding","autoCloseDelay","isRenderPortal"];function m(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,o)}return r}function v(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?m(Object(r),!0).forEach((function(t){f.default(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):m(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var j=d.forwardRef((function(e,t){var r=e.isOpen,o=e.onClose,n=e.onOpened,a=e.onClosed,s=e.children,f=e.className,m=e.style,j=e.position,g=void 0===j?"bottom-center":j,P=e.zIndex,_=void 0===P?5e3:P,h=e.padding,x=void 0===h?"12px 16px":h,E=e.autoCloseDelay,q=void 0===E?2e3:E,w=e.isRenderPortal,R=void 0===w||w,C=p.default(e,O),D=u.useForwardRef(t,null),k=d.useRef(!1),N=d.useRef(void 0),S=g?y["root_position_".concat(g)]:void 0,z=function(){clearTimeout(N.current)},A=function(){k.current=!1,z(),q>0&&(N.current=setTimeout((function(){k.current=!0,"function"==typeof o&&o()}),q))},T=function(){z()},I=function(){"function"==typeof n&&n(),A()};return d.useEffect((function(){return r&&I(),function(){T()}}),[]),d.createElement(i.CSSTransition,{nodeRef:D,in:r,timeout:125,classNames:y,unmountOnExit:!0,onEntered:I,onExit:T,onExited:function(){"function"==typeof a&&a({isAutoClose:k.current})}},d.createElement(c.Portal,{isActive:R},d.createElement("div",l.default({className:b.default(y.root,S),ref:D,style:{zIndex:_},role:"presentation","data-testid":"snackbar","data-qaid":"snackbar","data-pds-color-scheme":"light"},C),d.createElement("div",{className:b.default(y.content,f),style:v({padding:x},m),role:"alert",onMouseEnter:z,onMouseLeave:A},s))))}));j.displayName="SnackBar",exports.SnackBar=j,require("./style.production.css");
