import{r as e,j as t,_ as r,h as n,e as i}from"./react-B_SyE9nW.js";import{j as o,s,aZ as a,h as c,am as l,f as u,l as p,o as d,q as h,m as f,V as x,t as m,L as g,E as y,a0 as w,a_ as j}from"./index-BQSZGmOF.js";import{i as v,g as b,D as S,G as T,V as k}from"./HelpMenu-BEjgNOha.js";import{u as M,g as P,o as C,f as I,I as W,c as E,T as H}from"./index-B6oO2W5I.js";import{F as D}from"./FAQIco-BMC4lcwF.js";import{L,W as Y}from"./WarningIco-oG6Hq3R9.js";import{C as R}from"./ContactContext-Cix7Pghr.js";import{L as X}from"./Link-BpGM-1uN.js";import{_ as z}from"./history-CBi_mSPs.js";import{S as A}from"./Stack-B1rHPIE2.js";import{D as B}from"./Divider-BFAD5h2P.js";function F(r){const{children:n,defer:i=!1,fallback:s=null}=r,[a,c]=e.useState(!1);return o((()=>{i||c(!0)}),[i]),e.useEffect((()=>{i&&c(!0)}),[i]),t.jsx(e.Fragment,{children:a?n:s})}const O=["anchor","classes","className","width","style"],N=s("div",{shouldForwardProp:a})((({theme:e,ownerState:t})=>z({position:"fixed",top:0,left:0,bottom:0,zIndex:e.zIndex.drawer-1},"left"===t.anchor&&{right:"auto"},"right"===t.anchor&&{left:"auto",right:0},"top"===t.anchor&&{bottom:"auto",right:0},"bottom"===t.anchor&&{top:"auto",bottom:0,right:0}))),V=e.forwardRef((function(e,i){const{anchor:o,classes:s={},className:a,width:l,style:u}=e,p=r(e,O),d=e;return t.jsx(N,z({className:n("PrivateSwipeArea-root",s.root,s[`anchor${c(o)}`],a),ref:i,style:z({[v(o)?"width":"height"]:l},u),ownerState:d},p))})),_=["BackdropProps"],q=["anchor","disableBackdropTransition","disableDiscovery","disableSwipeToOpen","hideBackdrop","hysteresis","allowSwipeInChildren","minFlingVelocity","ModalProps","onClose","onOpen","open","PaperProps","SwipeAreaProps","swipeAreaWidth","transitionDuration","variant"];let $=null;function G(e,t,r){return"right"===e?r.body.offsetWidth-t[0].pageX:t[0].pageX}function U(e,t,r){return"bottom"===e?r.innerHeight-t[0].clientY:t[0].clientY}function K(e,t){return e?t.clientWidth:t.clientHeight}function Q(e,t,r,n){return Math.min(Math.max(r?t-e:n+t-e,0),n)}const Z="undefined"!=typeof navigator&&/iPad|iPhone|iPod/.test(navigator.userAgent),J=e.forwardRef((function(n,s){const a=l({name:"MuiSwipeableDrawer",props:n}),c=M(),d={enter:c.transitions.duration.enteringScreen,exit:c.transitions.duration.leavingScreen},{anchor:h="left",disableBackdropTransition:f=!1,disableDiscovery:x=!1,disableSwipeToOpen:m=Z,hideBackdrop:g,hysteresis:y=.52,allowSwipeInChildren:w=!1,minFlingVelocity:j=450,ModalProps:{BackdropProps:T}={},onClose:k,onOpen:W,open:E=!1,PaperProps:H={},SwipeAreaProps:D,swipeAreaWidth:L=20,transitionDuration:Y=d,variant:R="temporary"}=a,X=r(a.ModalProps,_),A=r(a,q),[B,O]=e.useState(!1),N=e.useRef({isSwiping:null}),J=e.useRef(),ee=e.useRef(),te=e.useRef(),re=u(H.ref,te),ne=e.useRef(!1),ie=e.useRef();o((()=>{ie.current=null}),[E]);const oe=e.useCallback(((e,t={})=>{const{mode:r=null,changeTransition:n=!0}=t,i=b(c,h),o=-1!==["right","bottom"].indexOf(i)?1:-1,s=v(h),a=s?`translate(${o*e}px, 0)`:`translate(0, ${o*e}px)`,l=te.current.style;l.webkitTransform=a,l.transform=a;let u="";if(r&&(u=c.transitions.create("all",P({easing:void 0,style:void 0,timeout:Y},{mode:r}))),n&&(l.webkitTransition=u,l.transition=u),!f&&!g){const t=ee.current.style;t.opacity=1-e/K(s,te.current),n&&(t.webkitTransition=u,t.transition=u)}}),[h,f,g,c,Y]),se=p((e=>{if(!ne.current)return;if($=null,ne.current=!1,i.flushSync((()=>{O(!1)})),!N.current.isSwiping)return void(N.current.isSwiping=null);N.current.isSwiping=null;const t=b(c,h),r=v(h);let n;n=r?G(t,e.changedTouches,C(e.currentTarget)):U(t,e.changedTouches,I(e.currentTarget));const o=r?N.current.startX:N.current.startY,s=K(r,te.current),a=Q(n,o,E,s),l=a/s;Math.abs(N.current.velocity)>j&&(ie.current=1e3*Math.abs((s-a)/N.current.velocity)),E?N.current.velocity>j||l>y?k():oe(0,{mode:"exit"}):N.current.velocity<-j||1-l>y?W():oe(K(r,te.current),{mode:"enter"})})),ae=(e=!1)=>{if(!B){!e&&x&&w||i.flushSync((()=>{O(!0)}));const t=v(h);!E&&te.current&&oe(K(t,te.current)+(x?15:-20),{changeTransition:!1}),N.current.velocity=0,N.current.lastTime=null,N.current.lastTranslate=null,N.current.paperHit=!1,ne.current=!0}},ce=p((e=>{if(!te.current||!ne.current)return;if(null!==$&&$!==N.current)return;ae(!0);const t=b(c,h),r=v(h),n=G(t,e.touches,C(e.currentTarget)),i=U(t,e.touches,I(e.currentTarget));if(E&&te.current.contains(e.target)&&null===$){const t=function({domTreeShapes:e,start:t,current:r,anchor:n}){const i={x:"scrollLeft",y:"scrollTop"},o={x:"scrollWidth",y:"scrollHeight"},s={x:"clientWidth",y:"clientHeight"};return e.some((e=>{let a=r>=t;"top"!==n&&"left"!==n||(a=!a);const c="left"===n||"right"===n?"x":"y",l=Math.round(e[i[c]]),u=l>0,p=l+e[s[c]]<e[o[c]];return!!(a&&p||!a&&u)}))}({domTreeShapes:function(e,t){const r=[];for(;e&&e!==t.parentElement;){const n=I(t).getComputedStyle(e);"absolute"===n.getPropertyValue("position")||"hidden"===n.getPropertyValue("overflow-x")||(e.clientWidth>0&&e.scrollWidth>e.clientWidth||e.clientHeight>0&&e.scrollHeight>e.clientHeight)&&r.push(e),e=e.parentElement}return r}(e.target,te.current),start:r?N.current.startX:N.current.startY,current:r?n:i,anchor:h});if(t)return void($=!0);$=N.current}if(null==N.current.isSwiping){const t=Math.abs(n-N.current.startX),o=Math.abs(i-N.current.startY),s=r?t>o&&t>3:o>t&&o>3;if(s&&e.cancelable&&e.preventDefault(),!0===s||(r?o>3:t>3)){if(N.current.isSwiping=s,!s)return void se(e);N.current.startX=n,N.current.startY=i,x||E||(r?N.current.startX-=20:N.current.startY-=20)}}if(!N.current.isSwiping)return;const o=K(r,te.current);let s=r?N.current.startX:N.current.startY;E&&!N.current.paperHit&&(s=Math.min(s,o));const a=Q(r?n:i,s,E,o);if(E)if(N.current.paperHit)0===a&&(N.current.startX=n,N.current.startY=i);else{if(!(r?n<o:i<o))return;N.current.paperHit=!0,N.current.startX=n,N.current.startY=i}null===N.current.lastTranslate&&(N.current.lastTranslate=a,N.current.lastTime=performance.now()+1);const l=(a-N.current.lastTranslate)/(performance.now()-N.current.lastTime)*1e3;N.current.velocity=.4*N.current.velocity+.6*l,N.current.lastTranslate=a,N.current.lastTime=performance.now(),e.cancelable&&e.preventDefault(),oe(a)})),le=p((e=>{if(e.defaultPrevented)return;if(e.defaultMuiPrevented)return;if(E&&(g||!ee.current.contains(e.target))&&!te.current.contains(e.target))return;const t=b(c,h),r=v(h),n=G(t,e.touches,C(e.currentTarget)),i=U(t,e.touches,I(e.currentTarget));if(!E){var o;if(m||!(e.target===J.current||null!=(o=te.current)&&o.contains(e.target)&&("function"==typeof w?w(e,J.current,te.current):w)))return;if(r){if(n>L)return}else if(i>L)return}e.defaultMuiPrevented=!0,$=null,N.current.startX=n,N.current.startY=i,ae()}));return e.useEffect((()=>{if("temporary"===R){const e=C(te.current);return e.addEventListener("touchstart",le),e.addEventListener("touchmove",ce,{passive:!E}),e.addEventListener("touchend",se),()=>{e.removeEventListener("touchstart",le),e.removeEventListener("touchmove",ce,{passive:!E}),e.removeEventListener("touchend",se)}}}),[R,E,le,ce,se]),e.useEffect((()=>()=>{$===N.current&&($=null)}),[]),e.useEffect((()=>{E||O(!1)}),[E]),t.jsxs(e.Fragment,{children:[t.jsx(S,z({open:!("temporary"!==R||!B)||E,variant:R,ModalProps:z({BackdropProps:z({},T,{ref:ee})},"temporary"===R&&{keepMounted:!0},X),hideBackdrop:g,PaperProps:z({},H,{style:z({pointerEvents:"temporary"!==R||E||w?"":"none"},H.style),ref:re}),anchor:h,transitionDuration:ie.current||Y,onClose:k,ref:s},A)),!m&&"temporary"===R&&t.jsx(F,{children:t.jsx(V,z({anchor:h,ref:J,width:L},D))})]})})),ee=d((function({target:e,href:r,Ico:n,intlId:i,onClick:o,component:s,margin:a,fontSize:c="small",title:l}){return t.jsx(X,{target:e,sx:{cursor:"pointer",margin:a},href:r,onClick:o,underline:"none",color:h.white,fontSize:c,fontWeight:500,component:s,children:t.jsxs(f,{sx:{display:"flex",ml:"16px",alignItems:"center"},children:[t.jsx(n,{}),t.jsx(x,{size:c,color:"gray",margin:"0 0 0 16px",weight:500,align:"center",children:m(i)+" "+(l?m(l):"")})]})})})),te=d((({open:r,setOpen:n,title:i})=>{const{onClickContactUs:o}=e.useContext(R),s=e=>{n(!1),o(e)};return t.jsx(J,{sx:{"& .MuiPaper-root":{borderRadius:"0 0 18px 0"}},anchor:"left",open:r,onClose:()=>n(!1),onOpen:()=>n(!0),children:t.jsxs(f,{sx:{"& .MuiTypography-root":{color:"gray"}},children:[t.jsxs(f,{sx:{backgroundColor:h.red,height:"100px",pb:2,width:g.isMobile?"272px":"329px",display:"flex",flexDirection:"column",alignItems:"end"},children:[t.jsx(W,{sx:{"& .MuiSvgIcon-root":{color:"white"}},"aria-label":"close",onClick:()=>n(!1),children:t.jsx(E,{})}),t.jsx(f,{sx:{display:"flex",justifyContent:"center",width:"100%"},children:t.jsx(H,{text:m("help"),sx:{color:"white !important"}})})]}),t.jsx(A,{width:"235px",gap:"30px",children:t.jsx(ee,{Ico:D,intlId:"faq",onClick:()=>y.push(String(w("route.faq"))),component:"span",margin:"32px 0 0 0",fontSize:"micro"})}),t.jsx(B,{sx:{my:"30px",mx:"15px",width:g.isMobile?"240px":"297px",borderWidth:"2px 0 thin"}}),t.jsxs(A,{width:"235px",gap:"30px",children:[t.jsxs(f,{onClick:()=>s("oMyOpinion"),sx:{display:"flex",ml:"16px",alignItems:"center","& .like-enjoty":{textWrap:"nowrap"}},children:[t.jsx(L,{}),t.jsx(x,{className:"like-enjoty",size:"micro",color:"gray",margin:"0 0 0 16px",weight:500,align:"center",children:m("likeEnjoty")})]}),t.jsxs(f,{onClick:()=>s("oNewFeat"),sx:{display:"flex",ml:"16px",alignItems:"center"},children:[t.jsx(T,{}),t.jsx(x,{size:"micro",color:"gray",margin:"0 0 0 16px",weight:500,align:"center",children:m("shareIdeas")})]})]}),t.jsx(B,{sx:{my:"30px",mx:"15px",width:g.isMobile?"240px":"297px",borderWidth:"2px 0 thin"}}),t.jsx(A,{width:"235px",children:t.jsxs(f,{onClick:()=>s("oReport"),sx:{display:"flex",ml:"16px",alignItems:"center"},children:[t.jsx(Y,{}),t.jsx(x,{size:"micro",color:"gray",margin:"0 0 0 16px",weight:500,align:"center",children:m("reportError")})]})}),t.jsx(B,{sx:{mt:"30px",mx:"15px",width:g.isMobile?"240px":"297px",borderWidth:"2px 0 thin"}}),t.jsx(f,{sx:{ml:"16px",mt:1,"& .MuiBox-root":{textAlign:"start"}},children:t.jsx(k,{})})]})})})),re=async()=>{if("serviceWorker"in navigator){console.log("checking update sw");const e=await navigator.serviceWorker.getRegistration("/");console.log("registration",e),(null==e?void 0:e.waiting)&&(e.waiting.postMessage({type:"SKIP_WAITING"}),console.log("Updating app..."),await j(2e3),window.location.reload())}},ne=()=>{const t=e.useMemo((()=>re),[]);e.useEffect((()=>{t()}),[])};export{te as H,ee as L,J as S,re as r,ne as u};