1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3801],{11204:(e,t,r)=>{var n=r(81652);r.o(n,"usePathname")&&r.d(t,{usePathname:function(){return n.usePathname}}),r.o(n,"useRouter")&&r.d(t,{useRouter:function(){return n.useRouter}}),r.o(n,"useSearchParams")&&r.d(t,{useSearchParams:function(){return n.useSearchParams}})},15024:(e,t,r)=>{r.d(t,{pD:()=>f,NP:()=>v});var n=r(81454),a=r(39442),o=r(91679),i=r(42314),u=r(89749);let l=e=>{var t,r,n,a;return!!e&&!!((null==e?void 0:null===(t=e.response)||void 0===t?void 0:t.status)===401||(null==e?void 0:e.status)===401||(null===(r=e.message)||void 0===r?void 0:r.includes("401"))||(null===(n=e.message)||void 0===n?void 0:n.includes("Unauthorized"))||(null===(a=e.message)||void 0===a?void 0:a.includes("unauthorized")))},c=async()=>{try{await fetch("/api/auth/logout",{method:"POST",headers:{"Content-Type":"application/json"}})}catch(e){console.error("Failed to logout via API:",e)}(0,u.xl)(),window.location.href="/login"},s=async(e,t)=>{l(e)&&!(0,i.v)()&&await c()},d=()=>{let e=(0,o.useQueryClient)();return{handleAuthError:(0,n.useCallback)(async t=>{await s(t,e)},[e])}},f=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{query:t={},enabledCondition:r=!0,handleAuthErrors:o=!0}=e,{handleAuthError:u}=d(),{data:l,isLoading:c,error:s,refetch:f}=(0,a.bW)({query:{staleTime:0,gcTime:3e4,retry:1,refetchOnWindowFocus:!1,refetchOnMount:!1,enabled:r,...t}}),v=(null==l?void 0:l.data)||null;return(0,n.useEffect)(()=>{s&&o&&r&&!(0,i.v)()&&u(s)},[s,o,r,u]),{profileData:v,isLoading:!!r&&c,error:r?s:null,refetch:f,data:l}},v=e=>f({enabledCondition:e,query:{enabled:e}})},22335:(e,t,r)=>{r.d(t,{e:()=>n});let n={ME_PROFILE:["/me/profile"],ME_PROFILE_WITH_PARAM:e=>["/me/profile",e]}},25221:(e,t,r)=>{r.d(t,{OJ:()=>c,Z2:()=>s});var n=r(98878),a=r(81454),o=r(57362),i=r(86712),u=r(15024);let l=(0,a.createContext)(void 0);function c(e){let{children:t,initialAuthState:r=!1}=e,[c,s]=(0,a.useState)(r),[d,f]=(0,a.useState)(!0),{profileData:v,error:h,isLoading:m}=(0,u.NP)(c),[y,g]=(0,a.useState)(),[w,p]=(0,a.useState)(),[S,b]=(0,a.useState)(void 0),E=async()=>{try{f(!0);let e=await (0,o.U)();s(e.isAuthenticated),g(e.providerType),p(e.uid)}catch(e){console.error("Failed to refresh auth status:",e),s(!1),g(void 0),p(void 0)}finally{f(!1)}};(0,a.useEffect)(()=>{E()},[]),(0,a.useEffect)(()=>{try{let e=window.localStorage.getItem("auth:mailConfirmedAt");null!==e&&b("null"===e?null:e)}catch(e){}let e=e=>{"auth:mailConfirmedAt"===e.key&&b("null"===e.newValue?null:e.newValue||void 0)};return window.addEventListener("storage",e),()=>{window.removeEventListener("storage",e)}},[]);let C=!!c&&(0,i.oG)(v),P=(null==v?void 0:v.email)||"";!P&&c&&"email"===y&&h&&w&&(P=w);let _=(null==v?void 0:v.name)||"",R=(null==v?void 0:v.phone_number)||"",A={isAuthenticated:c,isEmailVerified:c,hasCompleteProfile:C,profileData:v,displayEmail:P,displayName:_,phoneNumber:R,isLoading:d,isProfileLoading:m,providerType:y,setAuthState:e=>{s(e),e||f(!1)},refreshAuth:E,mailConfirmedAt:S,setMailConfirmedAt:e=>{b(e);try{void 0===e?window.localStorage.removeItem("auth:mailConfirmedAt"):window.localStorage.setItem("auth:mailConfirmedAt",null===e?"null":String(e))}catch(e){}}};return(0,n.jsx)(l.Provider,{value:A,children:t})}function s(){let e=(0,a.useContext)(l);if(void 0===e)throw Error("useAuthContext must be used within AuthProvider");return e}},27574:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),!function(e,t){for(var r in t)Object.defineProperty(e,r,{enumerable:!0,get:t[r]})}(t,{callServer:function(){return n.callServer},createServerReference:function(){return o},findSourceMapURL:function(){return a.findSourceMapURL}});let n=r(72257),a=r(22745),o=r(88978).createServerReference},42314:(e,t,r)=>{r.d(t,{f:()=>o,v:()=>i});var n=r(81454);let a=!1,o=()=>{let e=(0,n.useRef)(!1),t=(0,n.useCallback)(()=>{a=!0,e.current=!0},[]),r=(0,n.useCallback)(()=>{e.current&&(a=!1,e.current=!1)},[]);return(0,n.useEffect)(()=>()=>{e.current&&(a=!1,e.current=!1)},[]),{suppressAuthErrors:t,restoreAuthErrors:r}},i=()=>a},51457:(e,t,r)=>{r.d(t,{EC:()=>i,JO:()=>o,nL:()=>u});let n=/^\/(?!\/)/,a="auth:postLoginRedirect",o=e=>{if(!e)return;let t=e.trim();if(n.test(t))return t},i=e=>
1{let t=o(e);try{if(!t){window.sessionStorage.removeItem(a);return}window.sessionStorage.setItem(a,t)}catch(e){}},u=()=>{try{let e=window.sessionStorage.getItem(a);if(!e)return;return window.sessionStorage.removeItem(a),o(e)}catch(e){return}}},57362:(e,t,r)=>{r.d(t,{U:()=>a});var n=r(27574);let a=(0,n.createServerReference)("0014741a713cafd6534e955b38715d0c22ffcd89b0",n.callServer,void 0,n.findSourceMapURL,"getAuthStatusFromCookies")},63801:(e,t,r)=>{r.d(t,{o:()=>f});var n=r(11204),a=r(39442),o=r(67284),i=r(1019),u=r(51457),l=r(86712),c=r(89749),s=r(98187);let d=()=>{let{setAuthState:e}=(0,s.A)();return{handleLoginSuccess:async t=>{try{(0,c.vJ)(t),e(!0),console.log("[Login] Authentication state updated successfully (API-centric)")}catch(r){console.error("[Login] Failed to update authentication state:",r),e(!0);try{(0,c.vJ)(t)}catch(e){console.error("[Login] Cache setting also failed:",e)}}}}},f=()=>{let{handleLoginSuccess:e}=d(),t=(0,n.useRouter)(),{showSnackBar:r}=(0,o.ix)(),{refetch:c}=(0,a.bW)({query:{enabled:!1,staleTime:0,gcTime:3e4}}),s=e=>({email:e||"",user_id:0,id:0,name:void 0,phone_number:void 0,prefecture:void 0,gender:void 0,birth_date:void 0,created_at:new Date().toISOString(),updated_at:new Date().toISOString()}),f=(e,t)=>{let r=new URLSearchParams({provider:e});return t&&r.set("redirect",t),"".concat(i.b.REGISTER,"?").concat(r.toString())},v=async(n,a,o)=>{let i=s(a);await e(i),r("ãã°ã¤ã³ãã¾ãã","success"),t.replace(f(n,o))};return{completeAuthentication:async(n,a,o)=>{var d,h;let m=null!==(d=(0,u.JO)(o))&&void 0!==d?d:(0,u.nL)();try{let o=await c(),u=null===(h=o.data)||void 0===h?void 0:h.data,d=(0,l.oG)(u);if(u&&d)await e(u),r("ãã°ã¤ã³ãã¾ãã","success"),t.replace(null!=m?m:i.b.TOP);else{let o;o=u||s(a),await e(o),r("ãããã£ã¼ã«ãå
¥åãã¦ãã ãã","success"),t.replace(f(n,m))}}catch(e){console.log("".concat(n.toUpperCase()," AUTH ERROR: "),e),await v(n,a,m)}}}}},86712:(e,t,r)=>{r.d(t,{pJ:()=>i,oG:()=>o});let n={male:"male",female:"female"},a={name:e=>!!e&&"string"==typeof e&&e.trim().length>0,phone_number:e=>!!e&&"string"==typeof e&&e.trim().length>0,prefecture:e=>!!e&&"object"==typeof e&&!!e.id&&"number"==typeof e.id,gender:e=>!!e&&"string"==typeof e&&Object.values(n).includes(e),birth_date:e=>!!e&&"string"==typeof e&&e.trim().length>0};function o(e){return!!e&&Object.entries(a).every(t=>{let[r,n]=t;return n(e[r])})}function i(e){return e?Object.entries(a).filter(t=>{let[r,n]=t;return!n(e[r])}).map(e=>{let[t]=e;return t}):Object.keys(a)}},89749:(e,t,r)=>{r.d(t,{jy:()=>i,vJ:()=>l,xL:()=>u,xl:()=>o});var n=r(22335);function a(){return window.APP_QUERY_CLIENT_INSTANCE}function o(){let e=a();e?e.clear():console.warn("[QueryCache] QueryClientãè¦ã¤ããã¾ãã")}function i(e){window.APP_QUERY_CLIENT_INSTANCE=e}function u(){let e=a();e&&(e.invalidateQueries({queryKey:n.e.ME_PROFILE,exact:!0,refetchType:"active"}),["me","profile","user"].forEach(t=>{e.invalidateQueries({queryKey:[t]})}),console.log("[QueryCache] èªè¨¼é¢é£ãã£ãã·ã¥ãã¯ãªã¢ãã¾ãã"))}function l(e){let t=a();t?t.setQueryData(n.e.ME_PROFILE,{data:e}):console.warn("[QueryCache] QueryClientãè¦ã¤ããã¾ãã - ãããã£ã¼ã«ãã¼ã¿è¨å®ã«å¤±æ")}},98187:(e,t,r)=>{r.d(t,{A:()=>a});var n=r(25221);let a=()=>(0,n.Z2)()}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.