import{r as e,j as t,_ as r,h as n,e as i}from"./react-B_SyE9nW.js";import{s as o,ah as s,f as a,af as c,o as l,j as u,B as p,N as d,n as h,G as f,y as x,V as m,aS as g}from"./index-Flm6m8Wj.js";import{i as y,g as w,D as j,G as v,V as b}from"./HelpMenu-BEoO04r9.js";import{j as S,c as T,g as k,l as M,b as P,o as C,m as I,I as W,f as E,T as H}from"./index-C6Ujt1Uk.js";import{F as D}from"./FAQIco-CFhJMNDH.js";import{L as Y,W as L}from"./WarningIco-hfrnhue5.js";import{C as R}from"./ContactContext-CY5nd8oL.js";import{L as X}from"./Link-CWS9S-dL.js";import{_ as B}from"./history-CBi_mSPs.js";import{S as z}from"./Stack-CZ7Wid7r.js";import{D as A}from"./Divider-CSB2hYD2.js";function F(r){const{children:n,defer:i=!1,fallback:o=null}=r,[s,a]=e.useState(!1);return S((()=>{i||a(!0)}),[i]),e.useEffect((()=>{i&&a(!0)}),[i]),t.jsx(e.Fragment,{children:s?n:o})}const O=["anchor","classes","className","width","style"],N=o("div",{shouldForwardProp:s})((({theme:e,ownerState:t})=>B({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:c,width:l,style:u}=e,p=r(e,O),d=e;return t.jsx(N,B({className:n("PrivateSwipeArea-root",s.root,s[`anchor${a(o)}`],c),ref:i,style:B({[y(o)?"width":"height"]:l},u),ownerState:d},p))})),G=["BackdropProps"],$=["anchor","disableBackdropTransition","disableDiscovery","disableSwipeToOpen","hideBackdrop","hysteresis","allowSwipeInChildren","minFlingVelocity","ModalProps","onClose","onOpen","open","PaperProps","SwipeAreaProps","swipeAreaWidth","transitionDuration","variant"];let _=null;function q(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 J="undefined"!=typeof navigator&&/iPad|iPhone|iPod/.test(navigator.userAgent),Z=e.forwardRef((function(n,o){const s=c({name:"MuiSwipeableDrawer",props:n}),a=T(),l={enter:a.transitions.duration.enteringScreen,exit:a.transitions.duration.leavingScreen},{anchor:u="left",disableBackdropTransition:p=!1,disableDiscovery:d=!1,disableSwipeToOpen:h=J,hideBackdrop:f,hysteresis:x=.52,allowSwipeInChildren:m=!1,minFlingVelocity:g=450,ModalProps:{BackdropProps:v}={},onClose:b,onOpen:W,open:E=!1,PaperProps:H={},SwipeAreaProps:D,swipeAreaWidth:Y=20,transitionDuration:L=l,variant:R="temporary"}=s,X=r(s.ModalProps,G),z=r(s,$),[A,O]=e.useState(!1),N=e.useRef({isSwiping:null}),Z=e.useRef(),ee=e.useRef(),te=e.useRef(),re=k(H.ref,te),ne=e.useRef(!1),ie=e.useRef();S((()=>{ie.current=null}),[E]);const oe=e.useCallback(((e,t={})=>{const{mode:r=null,changeTransition:n=!0}=t,i=w(a,u),o=-1!==["right","bottom"].indexOf(i)?1:-1,s=y(u),c=s?`translate(${o*e}px, 0)`:`translate(0, ${o*e}px)`,l=te.current.style;l.webkitTransform=c,l.transform=c;let d="";if(r&&(d=a.transitions.create("all",M({easing:void 0,style:void 0,timeout:L},{mode:r}))),n&&(l.webkitTransition=d,l.transition=d),!p&&!f){const t=ee.current.style;t.opacity=1-e/K(s,te.current),n&&(t.webkitTransition=d,t.transition=d)}}),[u,p,f,a,L]),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=w(a,u),r=y(u);let n;n=r?q(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),c=Q(n,o,E,s),l=c/s;Math.abs(N.current.velocity)>g&&(ie.current=1e3*Math.abs((s-c)/N.current.velocity)),E?N.current.velocity>g||l>x?b():oe(0,{mode:"exit"}):N.current.velocity<-g||1-l>x?W():oe(K(r,te.current),{mode:"enter"})})),ae=(e=!1)=>{if(!A){!e&&d&&m||i.flushSync((()=>{O(!0)}));const t=y(u);!E&&te.current&&oe(K(t,te.current)+(d?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=w(a,u),r=y(u),n=q(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:u});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,d||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 c=Q(r?n:i,s,E,o);if(E)if(N.current.paperHit)0===c&&(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=c,N.current.lastTime=performance.now()+1);const l=(c-N.current.lastTranslate)/(performance.now()-N.current.lastTime)*1e3;N.current.velocity=.4*N.current.velocity+.6*l,N.current.lastTranslate=c,N.current.lastTime=performance.now(),e.cancelable&&e.preventDefault(),oe(c)})),le=P((e=>{if(e.defaultPrevented)return;if(e.defaultMuiPrevented)return;if(E&&(f||!ee.current.contains(e.target))&&!te.current.contains(e.target))return;const t=w(a,u),r=y(u),n=q(t,e.touches,C(e.currentTarget)),i=U(t,e.touches,I(e.currentTarget));if(!E){var o;if(h||!(e.target===Z.current||null!=(o=te.current)&&o.contains(e.target)&&("function"==typeof m?m(e,Z.current,te.current):m)))return;if(r){if(n>Y)return}else if(i>Y)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(j,B({open:!("temporary"!==R||!A)||E,variant:R,ModalProps:B({BackdropProps:B({},v,{ref:ee})},"temporary"===R&&{keepMounted:!0},X),hideBackdrop:f,PaperProps:B({},H,{style:B({pointerEvents:"temporary"!==R||E||m?"":"none"},H.style),ref:re}),anchor:u,transitionDuration:ie.current||L,onClose:b,ref:o},z)),!h&&"temporary"===R&&t.jsx(F,{children:t.jsx(V,B({anchor:u,ref:Z,width:Y},D))})]})})),ee=l((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:u.white,fontSize:c,fontWeight:500,component:s,children:t.jsxs(p,{sx:{display:"flex",ml:"16px",alignItems:"center"},children:[t.jsx(n,{}),t.jsx(d,{size:c,color:"gray",margin:"0 0 0 16px",weight:500,align:"center",children:h(i)+" "+(l?h(l):"")})]})})})),te=l((({open:r,setOpen:n,title:i})=>{const{onClickContactUs:o}=e.useContext(R),s=e=>{n(!1),o(e)};return t.jsx(Z,{sx:{"& .MuiPaper-root":{borderRadius:"0 0 18px 0"}},anchor:"left",open:r,onClose:()=>n(!1),onOpen:()=>n(!0),children:t.jsxs(p,{sx:{"& .MuiTypography-root":{color:"gray"}},children:[t.jsxs(p,{sx:{backgroundColor:u.red,height:"100px",pb:2,width:f.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(p,{sx:{display:"flex",justifyContent:"center",width:"100%"},children:t.jsx(H,{text:h("help"),sx:{color:"white !important"}})})]}),t.jsx(z,{width:"235px",gap:"30px",children:t.jsx(ee,{Ico:D,intlId:"faq",onClick:()=>x.push(String(m("route.faq"))),component:"span",margin:"32px 0 0 0",fontSize:"micro"})}),t.jsx(A,{sx:{my:"30px",mx:"15px",width:f.isMobile?"240px":"297px",borderWidth:"2px 0 thin"}}),t.jsxs(z,{width:"235px",gap:"30px",children:[t.jsxs(p,{onClick:()=>s("oMyOpinion"),sx:{display:"flex",ml:"16px",alignItems:"center","& .like-enjoty":{textWrap:"nowrap"}},children:[t.jsx(Y,{}),t.jsx(d,{className:"like-enjoty",size:"micro",color:"gray",margin:"0 0 0 16px",weight:500,align:"center",children:h("likeEnjoty")})]}),t.jsxs(p,{onClick:()=>s("oNewFeat"),sx:{display:"flex",ml:"16px",alignItems:"center"},children:[t.jsx(v,{}),t.jsx(d,{size:"micro",color:"gray",margin:"0 0 0 16px",weight:500,align:"center",children:h("shareIdeas")})]})]}),t.jsx(A,{sx:{my:"30px",mx:"15px",width:f.isMobile?"240px":"297px",borderWidth:"2px 0 thin"}}),t.jsx(z,{width:"235px",children:t.jsxs(p,{onClick:()=>s("oReport"),sx:{display:"flex",ml:"16px",alignItems:"center"},children:[t.jsx(L,{}),t.jsx(d,{size:"micro",color:"gray",margin:"0 0 0 16px",weight:500,align:"center",children:h("reportError")})]})}),t.jsx(A,{sx:{mt:"30px",mx:"15px",width:f.isMobile?"240px":"297px",borderWidth:"2px 0 thin"}}),t.jsx(p,{sx:{ml:"16px",mt:1,"& .MuiBox-root":{textAlign:"start"}},children:t.jsx(b,{})})]})})})),re=async()=>{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 g(2e3),window.location.reload())},ne=()=>{const t=e.useMemo((()=>re),[]);e.useEffect((()=>{t()}),[])};export{te as H,ee as L,Z as S,re as r,ne as u};