1!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},t=(new e.Error).stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="14842944-837c-4cb3-8f3d-28ad34acfe39",e._sentryDebugIdIdentifier="sentry-dbid-14842944-837c-4cb3-8f3d-28ad34acfe39")}catch(e){}}();"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[383,732],{63858:function(e,t,r){r.d(t,{p:function(){return i}}),r(57437);var a=r(2265);let n=a.createContext(void 0);function i(){let e=a.useContext(n);return e?{toast:e.addToast,toasts:e.toasts}:{toast:e=>{console.log("Toast:",e)},toasts:[]}}},70383:function(e,t,r){r.d(t,{H:function(){return h},a:function(){return f}});var a=r(57437),n=r(2265),i=r(50732),o=r(72301),s=r(63858),c=r(77359),u=r(62904),l=r(57963);let d=(0,n.createContext)(void 0),f=()=>{let e=(0,n.useContext)(d);if(!e)throw Error("useAuth must be used within an AuthProvider");return e},h=e=>{let{children:t}=e,[r,f]=(0,n.useState)(null),[h,g]=(0,n.useState)(!0),[w,y]=(0,n.useState)(!1),[m,b]=(0,n.useState)(!1),p=(0,o.useRouter)(),{toast:k}=(0,s.p)(),v=(0,c.NL)(),E=(0,n.useRef)(),I=(0,n.useRef)(),T=(0,n.useRef)(!0),S=(0,n.useCallback)(async e=>{if(I.current===e.uid){l.k.debug("User already synced, skipping backend call"),y(!0);return}E.current&&clearTimeout(E.current),y(!1),E.current=setTimeout(async()=>{if(T.current)try{let t=await e.getIdToken(),r=await fetch("".concat(u.API_BASE_URL,"/auth/sync/"),{method:"POST",headers:{"Content-Type":"application/json",Authorization:"Bearer ".concat(t)},body:JSON.stringify({firebase_uid:e.uid,email:e.email,display_name:e.displayName,photo_url:e.photoURL,email_verified:e.emailVerified})});if(!T.current)return;r.ok?(I.current=e.uid,y(!0),l.k.debug("User synced with backend")):(console.error("[Auth] Failed to sync user with backend:",r.status),y(!1))}catch(e){console.error("[Auth] Error syncing user:",e),T.current&&y(!1)}},500)},[]);(0,n.useEffect)(()=>{let e=null;return T.current=!0,(async()=>{localStorage.getItem("auth_token")&&l.k.debug("Found cached token, waiting for Firebase auth state...");try{e=await (0,i.f)(async e=>{if(T.current){if(f(e),e){let t=await e.getIdToken();localStorage.setItem("auth_token",t),b(e.emailVerified),S(e)}else localStorage.removeItem("auth_token"),I.current=void 0,y(!1),b(!1);g(!1)}}),T.current||(e(),e=null)}catch(e){console.error("[Auth] Error initializing auth:",e),g(!1)}})(),()=>{T.current=!1,e&&e(),E.current&&clearTimeout(E.current)}},[S]);let _=(0,n.useCallback)(async(e,t,r)=>{try{let{user:r,token:a}=await (0,i.signUpWithEmail)(e,t);localStorage.setItem("auth_token",a);try{await (0,i.sendVerificationEmail)(),k({title:"Welcome! Please verify your email",description:"We sent a verification link to your email address."})}catch(e){console.error("[Auth] Failed to send verification email:",e),k({title:"Welcome to GeoTravel.ai!",description:"Your account has been created successfully."})}p.push("/workspaces")}catch(e){throw k({title:"Sign up failed",description:e.message,variant:"destructive"}),e}},[k,p]),P=(0,n.useCallback)(async()=>{try{await (0,i.sendVerificationEmail)(),k({title:"Verification email sent",description:"Please check your inbox and click the verification link."})}catch(e){throw k({title:"Failed to send email",description:e.message,variant:"destructive"}),e}},[k]),A=(0,n.useCallback)(async()=>{try{let e=await (0,i.Gi)();return b(e),e}catch(e){return console.error("[Auth] Error refreshing verification status:",e),!1}},[]),C=(0,n.useCallback)(async(e,t)=>{try{let{user:r,token:a}=await (0,i.signInWithEmail)(e,t);localStorage.setItem("auth_token",a),k({title:"Welcome back!",description:"You have been signed in successfully."}),p.push("/workspaces")}catch(e){throw k({title:"Sign in failed",description:e.message,variant:"destructive"}),e}},[k,p]),U=(0,n.useCallback)(async()=>{try{let{user:e,token:t}=await (0,i.signInWithGoogle)();localStorage.setItem("auth_token",t),k({title:"Welcome!",description:"You have been signed in with Google."}),p.push("/workspaces")}catch(e){throw k({title:"Google sign in failed",description:e.message,variant:"destructive"}),e}},[k,p]),W=(0,n.useCallback)(async()=>{try{await (0,i.signOutUser)(),localStorage.removeItem("auth_token"),I.current=void 0,y(!1),v.clear(),k({title:"Signed out",description:"You have been signed out successfully."}),p.push("/")}catch(e){throw k({title:"Sign out failed",description:e.message,variant:"destructive"}),e}},[k,p,v]),G=(0,n.useCallback)(async()=>(0,i.getIdToken)(),[]),x=(0,n.useMemo)(()=>({user:r,loading:h,userSynced:w,emailVerified:m,signUp:_,signIn:C,signInWithGoogle:U,signOut:W,getToken:G,resendVerificationEmail
1:P,refreshEmailVerification:A}),[r,h,w,m,_,C,U,W,G,P,A]);return(0,a.jsx)(d.Provider,{value:x,"data-sentry-element":"unknown","data-sentry-component":"AuthProvider","data-sentry-source-file":"AuthContext.tsx",children:t})}},50732:function(e,t,r){r.d(t,{Gi:function(){return h},c0:function(){return d},f:function(){return g},getIdToken:function(){return b},sendVerificationEmail:function(){return f},signInWithEmail:function(){return c},signInWithGoogle:function(){return u},signOutUser:function(){return l},signUpWithEmail:function(){return s}});let a=null,n=null;async function i(){if(a)return a;let{initializeApp:e}=await Promise.all([r.e(9703),r.e(8755)]).then(r.bind(r,88755)),{getAuth:t}=await Promise.all([r.e(5117),r.e(9703),r.e(4309)]).then(r.bind(r,74309));return a=t(e({apiKey:"AIzaSyCCjT1YEuLwsLQNvT5piJVYjur-6OTE9po",authDomain:"geotravel-24be6.firebaseapp.com",projectId:"geotravel-24be6",storageBucket:"geotravel-24be6.firebasestorage.app",messagingSenderId:"907154886581",appId:"1:907154886581:web:adc4bf9124099d88d713fc",measurementId:"G-NR6GB42698"}))}async function o(){if(n)return n;let{GoogleAuthProvider:e}=await Promise.all([r.e(5117),r.e(9703),r.e(4309)]).then(r.bind(r,74309));return n=new e}let s=async(e,t)=>{try{let a=await i(),{createUserWithEmailAndPassword:n}=await Promise.all([r.e(5117),r.e(9703),r.e(4309)]).then(r.bind(r,74309)),o=await n(a,e,t),s=await o.user.getIdToken();return{user:o.user,token:s}}catch(e){throw Error(e instanceof Error?e.message:"An error occurred during sign up")}},c=async(e,t)=>{try{let a=await i(),{signInWithEmailAndPassword:n}=await Promise.all([r.e(5117),r.e(9703),r.e(4309)]).then(r.bind(r,74309)),o=await n(a,e,t),s=await o.user.getIdToken();return{user:o.user,token:s}}catch(e){throw Error(e instanceof Error?e.message:"An error occurred during sign in")}},u=async()=>{try{let e=await i(),t=await o(),{signInWithPopup:a}=await Promise.all([r.e(5117),r.e(9703),r.e(4309)]).then(r.bind(r,74309)),n=await a(e,t),s=await n.user.getIdToken();return{user:n.user,token:s}}catch(e){throw Error(e instanceof Error?e.message:"An error occurred during Google sign in")}},l=async()=>{try{let e=await i(),{signOut:t}=await Promise.all([r.e(5117),r.e(9703),r.e(4309)]).then(r.bind(r,74309));await t(e)}catch(e){throw Error(e instanceof Error?e.message:"An error occurred during sign out")}},d=async e=>{try{let t=await i(),{sendPasswordResetEmail:a}=await Promise.all([r.e(5117),r.e(9703),r.e(4309)]).then(r.bind(r,74309));await a(t,e)}catch(e){throw Error(e instanceof Error?e.message:"An error occurred during password reset")}},f=async()=>{try{let e=(await i()).currentUser;if(!e)throw Error("No user is currently signed in");let t=await e.getIdToken(),a=window.location.hostname,n=a.includes("findable")?"findable":a.includes("geojersey")?"geojersey":a.includes("geotravel")?"geotravel":"geomaestros",o=window.location.origin,{API_BASE_URL:s}=await r.e(2904).then(r.bind(r,62904)),c=await fetch("".concat(s,"/auth/send-verification-email/"),{method:"POST",headers:{"Content-Type":"application/json",Authorization:"Bearer ".concat(t)},body:JSON.stringify({brand:n,continue_url:o})});if(!c.ok){let e=await c.text();throw Error("Verification email failed: ".concat(c.status," ").concat(e))}}catch(e){throw Error(e instanceof Error?e.message:"An error occurred sending verification email")}},h=async()=>{let e=(await i()).currentUser;return!!e&&(await e.reload(),e.emailVerified)},g=async e=>{let t=await i(),{onIdTokenChanged:a}=await Promise.all([r.e(5117),r.e(9703),r.e(4309)]).then(r.bind(r,74309));return a(t,e)},w=null;async function y(e){e.currentUser||(w||(w=m(e).finally(()=>{w=null})),await w)}async function m(e){let t,a;let n=(async()=>{let a=e.authStateReady;if("function"==typeof a){await a.call(e);return}let{onAuthStateChanged:n}=await Promise.all([r.e(5117),r.e(9703),r.e(4309)]).then(r.bind(r,74309));await new Promise(r=>{let a={off:void 0,detached:!1,fired:!1},i=()=>{!a.detached&&a.off&&(a.detached=!0,a.off())},o=()=>{a.fired=!0,i(),r()};t=i,a.off=n(e,o,o),a.fired&&i()})})();n.catch(()=>{});try{await Promise.race([n,new Promise(e=>{a=setTimeout(e,5e3)})])}catch(e){}finally{a&&clearTimeout(a),null==t||t()}}let b=async function(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=await i();await y(t);let r=t.currentUser;return r?await r.getIdToken(e):null}}}]);
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.