"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const C=require("../tslib.es6-C4EgNkz1.js"),y=require("classnames"),e=require("react"),h=require("../dialog-previous-button-aXPjyhOT.js");require("../icon-button-AJ6dtyvc.js");require("../icon-I30uh1Ov.js");const k=require("../utils-C9NL3q0j.js"),E=n=>{var{className:l,children:c}=n,r=C.__rest(n,["className","children"]);return e.createElement("button",Object.assign({className:y(l,"fake-link")},r),c)},R=6e3,B=n=>{var{className:l,onOpen:c=()=>{},onClose:r=()=>{},layout:D,open:i,children:f,onAction:u}=n,S=C.__rest(n,["className","onOpen","onClose","layout","open","children","onAction"]);const o=e.useRef(new Set),g=e.useRef(null),[q,v]=e.useState(i),t=k.findComponent(f,E),T=k.excludeComponent(f,E),s=()=>{clearTimeout(g.current)},d=()=>{v(!1),r()},m=()=>{o.current.size===0&&(s(),g.current=setTimeout(()=>{d()},R))},_=()=>{v(!0),c(),m()},N=()=>{s(),o.current.add("focus")},O=()=>{o.current.delete("focus"),m()},A=()=>{s(),o.current.add("mouseEnter")},M=()=>{o.current.delete("mouseEnter"),m()},w=p=>{var a,b;s(),u?.(p),(b=(a=t?.props)===null||a===void 0?void 0:a.onClick)===null||b===void 0||b.call(a,p),d()};return e.useEffect(()=>()=>{s()},[]),e.useEffect(()=>{i?_():d()},[i]),e.createElement(h.DialogBaseWithState,Object.assign({},S,{open:q,isModal:!1,baseEl:"aside",classPrefix:"snackbar-dialog",transitionElement:"root",a11yCloseText:"",buttonPosition:"hidden",className:y(l,"snackbar-dialog--transition"),windowClass:D==="column"&&"snackbar-dialog__window--column",onFocus:N,onBlur:O,onMouseEnter:A,onMouseLeave:M}),T,t?e.createElement(h.EbayDialogActions,null,e.cloneElement(t,{onClick:w})):null)};exports.EbaySnackbarDialog=B;exports.EbaySnackbarDialogAction=E;
