"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const A=require("../tslib.es6-C4EgNkz1.js"),o=require("react"),g=require("classnames"),d=require("../dialog-previous-button-aXPjyhOT.js");require("../icon-button-AJ6dtyvc.js");require("../icon-I30uh1Ov.js");const y=30,t="drawer-dialog",$=p=>{var{expanded:l=!1,noHandle:T,onClose:c=()=>{},onCollapsed:w=()=>{},onExpanded:b=()=>{},a11yMaximizeText:C,a11yMinimizeText:D,children:_}=p,u=A.__rest(p,["expanded","noHandle","onClose","onCollapsed","onExpanded","a11yMaximizeText","a11yMinimizeText","children"]);let a=[];const[i,E]=o.useState(l);o.useEffect(()=>{E(l)},[l]);const s=e=>{E(e),e?b():w()},H=e=>{a=Array.from(e.changedTouches).map(({identifier:r,pageY:n})=>({identifier:r,pageY:n}))},h=e=>{Array.from(e.changedTouches).forEach(({identifier:r})=>{const n=a.findIndex(f=>f.identifier===r);n>-1&&a.splice(n,1)})},S=e=>{a.length&&Array.from(e.changedTouches).forEach(({identifier:r,pageY:n})=>{const f=a.findIndex(v=>v.identifier===r),x=n-a[f].pageY;x>y?(i?s(!1):c(),h(e)):x<-y&&(s(!0),h(e))})},M=T?null:o.createElement("button",{"aria-label":i?D:C,className:`${t}__handle`,onClick:()=>s(!i),onScroll:()=>s(!0),onTouchStart:H,onTouchMove:S,onTouchEnd:h,type:"button"}),m=o.Children.toArray(_),q=m.find(({type:e})=>e===d.EbayDialogHeader),k=m.filter(({type:e})=>e!==d.EbayDialogHeader);return o.createElement(d.DialogBaseWithState,Object.assign({},u,{classPrefix:t,onCloseBtnClick:c,className:g(u.className,`${t}--mask-fade-slow`),windowClass:g(u.windowClass,`${t}__window`,`${t}__window--slide`,{[`${t}__window--expanded`]:i}),onBackgroundClick:c,top:M}),q||o.createElement(d.EbayDialogHeader,null),k)};exports.EbayDrawerDialogDeprecated=$;
