import{u as g,a as m,b as E,i as c,j as n,c as h,l as O,p as x}from"./index-BB3C6ia3.js";import{h as P,u as _,b as i}from"./vendor-q1sfVHxQ.js";import{i as A}from"./migrationPasswordReset-SkSDaziu.js";var s={NO_ACCESS:"NO_ACCESS",ONLY_MEMBER:"ONLY_MEMBER",ONLY_ADULT:"ONLY_ADULT"};const T=O.isMobile?"mobile":"pc",N=["/adult-certification","/no-access","/member-only","/sign-up/form","/sign-up","/sign-up-confirm","/sign-in","/find-id","/find-password","/change-password","/callback","/not-found","/callback/auth-callback","/service-check","/expired-mall","/privacy-policy"],L={[s.ONLY_ADULT]:{next:"/adult-certification",shouldGoToOwnPage:()=>h()},[s.NO_ACCESS]:{next:"/no-access",shouldGoToOwnPage:()=>!1},[s.ONLY_MEMBER]:{next:"/member-only",shouldGoToOwnPage:()=>c()}},M=({children:r})=>{const o=P(),e=_(),[l,p]=i.useState(!0),{mall:u}=g(),{signOut:d}=m(),t=L[u.introRedirection[T]];return i.useEffect(()=>{const a=N.includes(e.pathname)||E();if(!a&&c()&&A()){d().catch(()=>{}).finally(()=>{o("/sign-in",{replace:!0})});return}const f=!a;t&&!t?.shouldGoToOwnPage()&&f&&o(t.next,{replace:!0,state:{from:`${e.pathname}${e.search}`,isIntroPage:!0}}),p(!1)},[e,t]),l?n.jsx(n.Fragment,{}):r};M.propTypes={children:x.node};export{M as default};