1(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,943624,e=>{"use strict";let t="pending_artifact_acquisition";e.s(["getPendingArtifactAcquisition",0,function(){try{let e=sessionStorage.getItem(t);if(!e)return null;return JSON.parse(e)}catch{return null}},"storePendingArtifactAcquisition",0,function(e,i){let r={artifact_id:e,entry_source:i,captured_at:Date.now()};try{sessionStorage.setItem(t,JSON.stringify(r))}catch{}}])},574705,e=>{"use strict";var t=e.i(479578),i=e.i(779926),r=e.i(932341),n=e.i(659619),s=e.i(370432),a=e.i(273895),o=e.i(943624);let l=(0,t.createModuleLogger)("useSignIn");function c(e){return"object"==typeof e&&null!==e&&"code"in e&&"auth/popup-closed-by-user"===e.code}e.s(["useSignIn",0,function({eventPrefix:e,extraProps:t,onSuccess:u}){let{login:d,appleSignIn:g}=(0,r.useAuth)(),x=(0,i.useLoginState)(),{startLogin:f,resetLogin:p}=x,m=async()=>{(0,n.track)(`${e}_button_clicked`,{provider:"google",...t}),f("google");try{let i=await d(),r=(0,o.getPendingArtifactAcquisition)();(0,n.track)(`${e}_success`,{provider:"google",is_new_user:i,...t,...r&&{artifact_id:r.artifact_id,entry_source:r.entry_source}});let l=(0,s.getReferralParams)();(0,a.trackAppsFlyerEvent)(i?"af_complete_registration":"af_login",void 0,{af_registration_method:"google",is_new_user:i,...l.referrerId&&{af_sub1:l.referrerId},...l.mediaSource&&{pid:l.mediaSource},...l.campaign&&{c:l.campaign}}),u?.(i)}catch(e){(0,n.track)("SignInFailed",{provider:"google",error:String(e),...t}),c(e)||l.error({error:e},"Google sign-in failed"),p()}},h=async()=>{(0,n.track)(`${e}_button_clicked`,{provider:"apple",...t}),f("apple");try{let i=await g(),r=(0,o.getPendingArtifactAcquisition)();(0,n.track)(`${e}_success`,{provider:"apple",is_new_user:i,...t,...r&&{artifact_id:r.artifact_id,entry_source:r.entry_source}});let l=(0,s.getReferralParams)();(0,a.trackAppsFlyerEvent)(i?"af_complete_registration":"af_login",void 0,{af_registration_method:"apple",is_new_user:i,...l.referrerId&&{af_sub1:l.referrerId},...l.mediaSource&&{pid:l.mediaSource},...l.campaign&&{c:l.campaign}}),u?.(i)}catch(e){(0,n.track)("SignInFailed",{provider:"apple",error:String(e),...t}),c(e)||l.error({error:e},"Apple sign-in failed"),p()}};return{...x,handleGoogleSignIn:m,handleAppleSignIn:h}}])},415770,e=>{"use strict";var t=e.i(843476),i=e.i(69431),r=e.i(479578),n=e.i(768877),s=e.i(632781),a=e.i(657688),o=e.i(618566),l=e.i(271645),c=e.i(340974);function u({className:e}){return(0,t.jsx)("header",{className:(0,c.cn)("w-full flex items-center justify-end px-5 py-4",e),children:(0,t.jsx)(a.default,{src:"/images/twinmind-logo.svg",alt:"TwinMind",width:58,height:32,priority:!0})})}e.i(809149);var d=e.i(937420);e.i(421351);var g=e.i(167815),x=e.i(932341);e.i(348096);var f=e.i(685950),p=e.i(659619);async function m(e){return v(e,null)}async function h(e){return v(e,{device:"mobile"})}async function v(e,t){let i=await b("/api/auth/custom-token","POST",t,e);if(i.error)throw Error(i.error);if(!i.data)throw Error("No data received from custom token API");if(!i.data.customToken)throw Error("Custom token missing from API response");return i.data.customToken}async function b(e,t,i,r){try{let n,s=new Headers;s.set("Content-Type","application/json"),r&&s.set("Authorization",`Bearer ${r}`);let a=await fetch(e,{body:i?JSON.stringify(i):void 0,headers:s,method:t});try{n=await a.json()}catch(e){throw Error("Unexpected issue. Please try again.")}if(!a.ok){let e=n.error||`HTTP ${a.status}: ${a.statusText}`;throw Error(e)}return{data:n}}catch(e){return{error:e instanceof Error?e.message:String(e)}}}e.i(163876);var w=e.i(922031);e.i(518801);var y=e.i(845777),j=e.i(853375),_=e.i(423736),k=e.i(321052),N=e.i(42976),S=e.i(574705);let E=(0,r.createModuleLogger)("login");function I({variant:e,secret:i,error:r,isLoggingIn:a,loginProvider:o,onChange:l,onClearError:c,onSubmit:u}){return(0,t.jsxs)("form",{onSubmit:u,className:"flex flex-col items-stretch gap-2 w-full",children:[(0,t.jsx)("label",{htmlFor:`test-user-secret-${e}`,className:"sr-only",children:"Test user secret"}),(0,t.jsxs)("div",{className:"relative w-full",children:[(0,t.jsx)("input",{id:`test-user-secret-${e}`,type:"password",value:i,onChange:e=>{l(e.target.value),r&&c()},placeholder:"Test user secret",autoComplete:"off",disabled:a,"data-testid":"test-user-secret-input",className:`w-full ${"desktop"===e?"h-12":"h-11"} pl-4 pr-12 rounded-xl bg-white/[0.06] border border-white/15 text-white placeholder:text-white/40 text-[15px] font-medium tracking-[-0.18px] outline-none focus:border-white/40 focus:bg-white/[0.08] transition-colors duration-200 disabled:opacity-50 disabled:cursor-not-allowed`}),(0,t.jsx)(g.Button,{type:"submit",variant:"ghost",size:"icon",disabled:a||!i,"aria-label":"Sign in as test user","data-testid":"test-user-button",className:`absolute right-1.5 top-1/2 -translate-y-1/2 roun
1ded-lg text-white/80 hover:bg-white/10 hover:text-white disabled:opacity-30 disabled:hover:bg-transparent ${"desktop"===e?"[&_svg]:size-4":"[&_svg]:size-[14px]"}`,children:"test"===o?(0,t.jsx)(s.Loader2,{className:"animate-spin"}):(0,t.jsx)(n.ArrowRight,{})})]}),r&&(0,t.jsx)("p",{role:"alert",className:"text-xs font-medium text-red-300/90 leading-snug text-center",children:r})]})}e.s(["LoginClient",0,function(){let{loginWithTestUser:e,user:r,loading:n}=(0,x.useAuth)(),{isAuthenticated:c}=(0,x.useAuth)(),v=(0,o.useRouter)(),b=(0,o.useSearchParams)(),P=(0,f.isTestUserEnabled)(),[T,A]=(0,l.useState)(""),[C,L]=(0,l.useState)(null),F=(0,l.useRef)(null);(0,l.useEffect)(()=>{let e=sessionStorage.getItem("authRedirectPath");e&&(F.current=e,sessionStorage.removeItem("authRedirectPath"))},[]);let B=(0,l.useRef)(null),R=(0,l.useRef)(null),[$,z]=(0,l.useState)(null),{handleGoogleSignIn:M,handleAppleSignIn:O,isLoggingIn:q,loginProvider:D,startLogin:U,resetLogin:G}=(0,S.useSignIn)({eventPrefix:"webapp_login"}),J=b.get("via_extension"),W=b.get("via_desktop");(0,l.useEffect)(()=>{null!==J&&E.debug({viaExtension:J},"[Extension Login] Login page opened via extension")},[J]),(0,l.useEffect)(()=>{null===J&&(0,p.track)("SignupPageViewed")},[J]);let H=(0,l.useCallback)(async()=>{if(!r)return!1;let e=(0,w.isExtensionAvailable)();if(E.debug({extensionAvailable:e},"[Extension Sync] Extension available"),!e)return E.debug("[Extension Sync] Extension not installed or not available"),!1;try{let e=await r.getIdToken(!0),t=await m(e);return await (0,w.notifyExtensionLogin)({customToken:t,viaExtension:null!==J})}catch(e){return(0,i.isProduction)()||E.error({error:e},"[Extension Sync] Failed"),!1}},[r,J]);(0,l.useEffect)(()=>{(async()=>{if(!c){B.current=null,R.current=null;return}if(r){if(null!==W){if(R.current===r.uid)return;R.current=r.uid;try{let e=await r.getIdToken(!0),t=await h(e),i=`twinmind://auth/callback?token=${encodeURIComponent(t)}`;E.debug("[Webapp] Desktop login complete, redirecting to twinmind://"),z(i),window.location.href=i}catch(e){R.current=null,E.error({error:e},"[Desktop] Failed to create handoff code for deep link redirect")}return}if(B.current===r.uid)return;B.current=r.uid;let e=await H();if(null!==J)return e?E.debug("[Webapp] Extension login complete, waiting for extension to close tab"):(E.debug("[Webapp] Extension not available, redirecting to home"),v.push("/"));if(F.current){let e=F.current;F.current=null,v.push(e)}else v.push("/")}})()},[c,r,W,J,v,H]);let K=async t=>{if(t.preventDefault(),!q&&T){L(null),U("test");try{await e({secret:T}),A("")}catch(e){E.error({error:e},"Test user sign-in failed"),L(e instanceof Error?e.message:"Test user sign-in failed"),G()}}};return $?(0,t.jsxs)("div",{className:"relative h-screen flex flex-col items-center justify-center text-center px-6",style:{background:"linear-gradient(180deg, #D2ECF1 1.23%, #FFFAEF 100%)"},children:[(0,t.jsx)(a.default,{src:"/images/TwinMind Logo 2000px black.svg",alt:"TwinMind",width:160,height:32,priority:!0,className:"absolute top-6 right-8 h-8 w-auto"}),(0,t.jsx)("h1",{className:"text-[32px] font-medium leading-tight text-gray-900",children:"Click Below to Finish Login"}),(0,t.jsx)("p",{className:"mt-3 text-[18px] text-gray-700",children:"Press the button below to successfully log back into TwinMind."}),(0,t.jsx)(g.Button,{type:"button",onClick:()=>{window.location.href=$},className:"mt-8 z-10 h-14 rounded-full border border-[#0B4F75] bg-[#0B4F75] hover:bg-[#0B4F75] px-8 text-lg font-medium leading-[1.4] text-white shadow-[0.5px_0.5px_32px_0px_rgba(11,79,117,0.12)] transition-opacity hover:opacity-90 active:opacity-80",children:"Return to App"})]}):n||c?(0,t.jsx)("div",{className:"bg-[#060E1C] h-screen flex items-center justify-center",children:(0,t.jsx)(s.Loader2,{className:"size-8 animate-spin text-white"})}):(0,t.jsxs)("div",{className:"h-dvh flex flex-col relative overflow-hidden",children:[(0,t.jsx)("div",{className:"absolute inset-0 pointer-events-none",children:(0,t.jsx)(a.default,{src:"/images/gmail-onboarding/starry-bg.png",alt:"",fill:!0,className:"object-cover -scale-x-100",priority:!0})}),(0,t.jsx)("div",{className:"absolute inset-0 pointer-events-none bg-[#060E1C]/[0.78]"}),(0,t.jsx)(d.default,{}),(0,t.jsxs)("div",{className:"relative z-10 flex flex-col h-full gap-8 lg:gap-0",children:[(0,t.jsx)(u,{className:"shrink-0"}),(0,t.jsx)("div",{className:"hidden lg:block flex-1 min-h-0 overflow-y-auto",children:(0,t.jsxs)("div",{className:"flex flex-col items-center justify-center min-h-full gap-16 sm:gap-24 md:gap-32 lg:gap-24 py-8",children:[(0,t.jsx)("div",{className:"flex flex-col items-center justify-center text-center",children:(0,t.jsx)(k.LoginTitle,{className:"text-[40px] w-[805p
1x]"})}),(0,t.jsxs)("div",{className:"flex flex-col items-center gap-8 w-full max-w-[366px]",children:[(0,t.jsx)(_.LoginSubtitle,{className:"text-[20px] font-medium"}),(0,t.jsxs)("div",{className:"flex flex-col items-center gap-8 w-[366px]",children:[(0,t.jsx)(j.GoogleSignInButton,{onClick:M,isLoggingIn:q,loginProvider:D}),(0,t.jsx)(y.AppleSignInButton,{onClick:O,isLoggingIn:q,loginProvider:D}),P&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("p",{className:"text-base font-medium text-white/80 leading-none w-full text-center",children:"or"}),(0,t.jsx)(I,{variant:"desktop",secret:T,error:C,isLoggingIn:q,loginProvider:D,onChange:A,onClearError:()=>L(null),onSubmit:K})]})]})]}),(0,t.jsx)(N.TrustBadges,{compact:!0})]})}),(0,t.jsx)("div",{className:"lg:hidden flex-1 min-h-0 overflow-y-auto",children:(0,t.jsxs)("div",{className:"flex flex-col items-center min-h-full text-center pb-[45px]",children:[(0,t.jsx)(k.LoginTitle,{className:"text-[24px]"}),(0,t.jsx)("div",{"aria-hidden":!0,className:"flex-1 min-h-8 max-h-24"}),(0,t.jsx)(N.TrustBadges,{}),(0,t.jsx)("div",{"aria-hidden":!0,className:"flex-1 min-h-8 max-h-24"}),(0,t.jsxs)("div",{className:"flex flex-col items-center gap-8 w-full max-w-[366px]",children:[(0,t.jsx)(_.LoginSubtitle,{className:"text-[16px] font-normal"}),(0,t.jsx)(j.GoogleSignInButton,{onClick:M,isLoggingIn:q,loginProvider:D,iconSize:18}),(0,t.jsx)(y.AppleSignInButton,{onClick:O,isLoggingIn:q,loginProvider:D}),P&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("p",{className:"text-sm font-medium text-white/80 leading-none w-full text-center",children:"or"}),(0,t.jsx)(I,{variant:"mobile",secret:T,error:C,isLoggingIn:q,loginProvider:D,onChange:A,onClearError:()=>L(null),onSubmit:K})]})]})]})})]})]})}],415770)}]);
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.