PageSourceSearch

https://myechoboard.com/assets/NativeAuthBootstrap-B9Wd4wdC.js

js myechoboard.com collected 2026-09-24 13:47:49 UTC 17,924 bytes, 2 lines download raw bytes

1const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/supabase-client-_h80EYw_.js","assets/vendor-supabase-BL1taoPA.js","assets/startup-platform-OWIpYyjW.js","assets/supabase-config-Bge368iX.js"])))=>i.map(i=>d[i]);
2import{_ as e}from"./runtime-preload-CFP917pd.js";import{r as t,j as n}from"./vendor-react-C9yDzYQD.js";import{A as a,C as i,B as o}from"./vendor-capacitor-8exTJy5k.js";import{h as r,r as s,a as l,b as u,c}from"./fullApp-Ij3xCJOB.js";import{a as d,b as h,l as m}from"./startup-core-CGeUO7uJ.js";import{r as p}from"./authEmailCode-DGb-Vfkf.js";import{e as f,s as v,b as w,a as g}from"./app-BhliLHoU.js";import{w as x,A as j,r as y,k as b,l as C,m as N,v as k,p as S}from"./useUserSettings-COPNty3J.js";import{A as L}from"./AnimatedLogo-BHNlQQ7J.js";const E=["main-module-evaluated","auth-ready","first-auth-shell-frame"],_="echo:native-launch-url",A="echo:native-auth-email-code-draft",M=(e,t)=>{if("undefined"==typeof window)return;const n=window.__ECHO_PUSH_BOOT_LOG__;"function"==typeof n&&n(e,t)};let P=null;const O=async()=>(P||(P=e(()=>import("./supabase-client-_h80EYw_.js"),__vite__mapDeps([0,1,2,3]))),(await P).supabase),R=()=>"undefined"==typeof window?"":window.location.search||"",T=(e,t)=>{var n,a,o;if(i.isNativePlatform()&&"ios"===i.getPlatform()&&"undefined"!=typeof window)try{null==(o=null==(a=null==(n=window.webkit)?void 0:n.messageHandlers)?void 0:a.echoNativeAuth)||o.postMessage({type:"session-state",authenticated:e,source:t})}catch{}},F=e=>{const t=Number(e);return Number.isInteger(t)&&t>=4&&t<=10?t:null},D=()=>{if("undefined"!=typeof window)try{window.localStorage.removeItem(A)}catch{}};async function B(e){if(e&&"object"==typeof e&&"context"in e){const t=e.context;if(t instanceof Response)try{const e=await t.clone().json();if("string"==typeof(null==e?void 0:e.error))return e.error;if("string"==typeof(null==e?void 0:e.message))return e.message}catch{try{const e=await t.clone().text();if(e)return e}catch{}}}return e instanceof Error?e.message:"Authentication failed."}function U({onOpen:e}){return n.jsxs("div",{className:"native-auth-legal",children:[n.jsx("button",{onClick:()=>e("/terms"),type:"button",children:"Terms of Service"}),n.jsx("button",{onClick:()=>e("/privacy"),type:"button",children:"Privacy Policy"}),n.jsx("button",{onClick:()=>e("/support"),type:"button",children:"Support"}),n.jsx("button",{onClick:()=>e("/ai"),type:"button",children:"AI Resources"}),n.jsx("span",{children:"© 2026 Echo"})]})}function $(){return n.jsxs("svg",{"aria-hidden":"true",className:"native-auth-inline-icon",viewBox:"0 0 24 24",children:[n.jsx("path",{d:"M4 6h16v12H4z",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2"}),n.jsx("path",{d:"m5 7 7 6 7-6",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2"})]})}function I(){return n.jsxs("svg",{"aria-hidden":"true",className:"native-auth-inline-icon",viewBox:"0 0 24 24",children:[n.jsx("path",{d:"M7 11V8a5 5 0 0 1 10 0v3",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2"}),n.jsx("rect",{x:"5",y:"11",width:"14",height:"10",rx:"2",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2"})]})}function W(){return n.jsxs("svg",{"aria-hidden":"true",className:"native-auth-inline-icon",viewBox:"0 0 24 24",children:[n.jsx("path",{d:"M12 12a4 4 0 1 0-4-4 4 4 0 0 0 4 4Z",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2"}),n.jsx("path",{d:"M5 20a7 7 0 0 1 14 0",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2"})]})}function z(){return n.jsx("svg",{"aria-hidden":"true",className:"native-auth-social-icon",viewBox:"0 0 24 24",children:n.jsx("path",{fill:"currentColor",d:"M16.365 21.438c-1.125.811-2.28 1.562-3.483 1.562-1.396 0-2.4-.766-3.882-.766-1.528 0-2.684.766-3.928.766-1.16 0-2.235-.615-3.351-1.353C-.198 18.916-.948 11.233 2.112 8.358c1.396-1.307 2.946-1.895 4.38-1.895 1.527 0 2.503.766 3.753.766 1.077 0 2.502-.857 4.11-1.023 1.705-.084 3.09.431 4.02 1.623-3.03 1.579-2.585 5.56 1.251 7.042-.716 1.803-1.637 3.528-3.263 6.567zM15.42 5.08A4.896 4.896 0 0 0 16.513 1.5c-1.488.084-3.16.947-4.144 2.15-1.026 1.157-1.47 2.656-1.352 4.144 1.6-.2 3.16-1.157 4.403-2.714z"})})}function H(){return n.jsxs("svg",{"aria-hidden":"true",className:"native-auth-social-icon",viewBox:"0 0 24 24",children:[n.jsx("path",{fill:"currentColor",d:"M22.56 12.25c0-.78-.07-1.53-.2-2.25H12v4.26h5.92c-.26 1.37-1.04 2.53-2.21 3.31v2.77h3.57c2.08-1.92 3.28-4.74 3.28-8.09z"}),n.jsx("path",{fill:"currentColor",d:"M12 23c2.97 0 5.46-.98 7.28-2.66l-3.57-2.77c-.98.66-2.23 1.06-3.71 1.06-2.86 0-5.29-1.93-6.16-4.53H2.18v2.84C3.99 20.53 7.7 23 12 23z"}),n.jsx("path",{fill:"currentColor",d:"M5.84 14.1c-.22-.66-.35-1.36-.35-2.1s.13-1.44.35-2.1V7.06H2.18C1.43 8.55 1 10.22 1 12s.43 3.45 1.18 4.94l3.66-2.84z"}),n.jsx("path",{fill:"currentColor",d:"M12 5.38c1.62 0 3.06.56 4.21 1.66l3.15-3.15C17.45 2.09 14.97 1 12 1 7.7 1 3.99 3.47 2.18 7.06l3.66 2.84c.87-2.6 3.3-4.52 6.16-4.52z"})]})}function V({isCheckingSession:e,search:a,onModeChange:r,onOpenLegalPage:s,onAuthenticated:l}){var d,h,m,f;const v=t.useRef(null);null===v.current&&(v.current=(()=>
2{if("undefined"==typeof window)return null;try{const e=window.localStorage.getItem(A);if(!e)return null;const t=JSON.parse(e),n="string"==typeof t.email?t.email.trim():"",a=Number(t.createdAt),i=F(t.codeLength);if(!n||!Number.isFinite(a)||Date.now()-a>9e5){try{window.localStorage.removeItem(A)}catch{}return null}return{email:n,codeLength:i,isLogin:!1!==t.isLogin,fullName:"string"==typeof t.fullName?t.fullName:"",createdAt:a}}catch{try{window.localStorage.removeItem(A)}catch{}return null}})());const[x,j]=t.useState(()=>{var e;return(null==(e=v.current)?void 0:e.isLogin)??"signup"!==new URLSearchParams(a).get("mode")}),[y,b]=t.useState((null==(d=v.current)?void 0:d.fullName)??""),[C,N]=t.useState((null==(h=v.current)?void 0:h.email)??""),[E,_]=t.useState(""),[M,P]=t.useState((null==(m=v.current)?void 0:m.codeLength)??null),[R,T]=t.useState(Boolean(v.current)),[V,q]=t.useState((null==(f=v.current)?void 0:f.email)??""),[G,Y]=t.useState(!1),[J,Z]=t.useState(null),K=t.useRef(!1),Q=t.useRef(!1),X=t.useRef(""),ee="android"!==i.getPlatform(),te=e||G,ne=i.isNativePlatform()&&"ios"===i.getPlatform()?"native-auth-shell native-auth-shell-ios":"native-auth-shell";t.useEffect(()=>{R||j("signup"!==new URLSearchParams(a).get("mode"))},[R,a]);const ae=te?"Please wait...":R?"Verify Code":x?"Email Me a Code":"Create Account",ie=t.useCallback(async e=>{if(!Q.current){Q.current=!0,Y(!0),Z(null);try{const t=await O(),n=await k({verify:()=>t.auth.verifyOtp({email:(V||C).trim().toLowerCase(),token:e.trim(),type:"email"}),getSession:()=>t.auth.getSession()});if(n.authenticated)return D(),await S(),void(await l());Z({tone:"error",text:"message"in n?n.message:"Echo could not finish sign-in. Please try again."})}catch(t){Z({tone:"error",text:t instanceof Error&&/loading|module|chunk/i.test(t.message)?"You're signed in. Tap Verify Code to finish opening Echo.":"Echo could not finish sign-in. Please try again."})}finally{Q.current=!1,Y(!1)}}},[C,l,V]);t.useEffect(()=>{const e=M??8;R&&E.length===e?te||X.current===E||(X.current=E,ie(E)):E.length<e&&(X.current="")},[E,M,te,R,ie]);const oe=async e=>{if("apple"!==e||ee){Y(!0),Z(null);try{const t=await O();g("echo_oauth_provider",e),g("echo_oauth_intent",x?"login":"signup");const n=i.isNativePlatform()?u(e):null,{data:a,error:r}=await t.auth.signInWithOAuth({provider:e,options:{redirectTo:n??`${window.location.origin}/`,skipBrowserRedirect:i.isNativePlatform()}});if(r)throw r;i.isNativePlatform()&&(null==a?void 0:a.url)&&await o.open({url:a.url,windowName:"_self"})}catch(t){i.isNativePlatform()&&c(),w("echo_oauth_intent"),w("echo_oauth_provider"),Z({tone:"error",text:t instanceof Error?t.message:"Could not start social sign-in."}),Y(!1)}}else Z({tone:"error",text:"Apple sign-in is only available on iOS and web."})};return e?n.jsxs("div",{className:ne,"aria-busy":"true",children:[n.jsx("div",{className:"native-auth-backdrop","aria-hidden":"true"}),n.jsx("main",{className:"native-auth-stage",children:n.jsx("section",{className:"native-auth-panel-wrap",children:n.jsx("div",{className:"native-auth-panel",role:"status","aria-live":"polite",children:n.jsxs("div",{className:"native-auth-panel-header",children:[n.jsx("div",{className:"native-auth-brand native-auth-brand-mobile",children:n.jsx("div",{className:"native-auth-brand-logo",children:n.jsx(L,{alt:"Echo logo",className:"object-contain"})})}),n.jsx("h1",{children:"Opening Echo"}),n.jsx("p",{children:"Restoring your secure session…"})]})})})})]}):n.jsxs("div",{className:ne,children:[null,n.jsx("div",{className:"native-auth-backdrop","aria-hidden":"true"}),n.jsxs("main",{className:"native-auth-stage",children:[n.jsxs("section",{className:"native-auth-hero","aria-hidden":"true",children:[n.jsx("div",{className:"native-auth-brand native-auth-brand-desktop",children:n.jsx("div",{className:"native-auth-brand-logo",children:n.jsx(L,{alt:"Echo logo",className:"object-contain"})})}),n.jsx("h1",{children:R?"Check your email.":x?"Come back to your space.":"Create your feed"}),n.jsx("p",{children:x?"Sign in and pick up exactly where you left off.":""})]}),n.jsx("section",{className:"native-auth-panel-wrap",children:n.jsxs("div",{className:"native-auth-panel",children:[n.jsxs("div",{className:"native-auth-panel-header",children:[n.jsx("div",{className:"native-auth-brand native-auth-brand-mobile",children:n.jsx("div",{className:"native-auth-brand-logo",children:n.jsx(L,{alt:"Echo logo",className:"object-contain"})})}
2),n.jsx("h1",{children:R?"Enter your code":x?"Welcome back":"Create your feed"}),R?n.jsx("p",{children:"We sent a one-time code to your email"}):x?n.jsx("p",{children:"Sign in to continue"}):null]}),J?n.jsx("p",{className:`native-auth-message native-auth-message-${J.tone}`,children:J.text}):null,n.jsxs("form",{className:"native-auth-form",onSubmit:async e=>{if(e.preventDefault(),R)return(M?new RegExp(`^\\d{${M}}$`):/^\d{4,10}$/).test(E.trim())?void ie(E):void Z({tone:"error",text:M?`Enter the ${M}-digit code from your email.`:"Enter the code from your email."});const t=function(e,t,n){const a=n.trim(),i=t.trim();return a&&a.includes("@")?e||i?null:"Add a name to continue.":"Enter a valid email address."}(x,y,C);if(t)Z({tone:"error",text:t});else if(!K.current){K.current=!0,Y(!0),Z(null);try{await O();const e=x?"login":"signup",t=await p({email:C.trim().toLowerCase(),fullName:y.trim(),intent:e}),n=C.trim().toLowerCase(),a=F(null==t?void 0:t.codeLength);q(n),P(a),(e=>{if("undefined"!=typeof window)try{window.localStorage.setItem(A,JSON.stringify({...e,createdAt:Date.now()}))}catch{}})({email:n,codeLength:a,isLogin:x,fullName:y.trim()}),T(!0),_(""),Z({tone:"success",text:`Check ${C.trim()} for your Echo sign-in code.`})}catch(n){Z({tone:"error",text:await B(n)})}finally{K.current=!1,Y(!1)}}},children:[x||R?null:n.jsxs("label",{className:"native-auth-field",children:[n.jsxs("span",{children:[n.jsx(W,{}),"Name"]}),n.jsx("input",{autoComplete:"name",inputMode:"text",onChange:e=>b(e.target.value),placeholder:"Your name",value:y})]}),R?null:n.jsxs("label",{className:"native-auth-field",children:[n.jsxs("span",{children:[n.jsx($,{}),"Email"]}),n.jsx("input",{autoCapitalize:"none",autoComplete:"email",autoCorrect:"off",inputMode:"email",onChange:e=>N(e.target.value),placeholder:"[email protected]",value:C})]}),R?n.jsxs("label",{className:"native-auth-field",children:[n.jsxs("span",{children:[n.jsx(I,{}),"Code"]}),n.jsx("input",{autoComplete:"one-time-code",inputMode:"numeric",maxLength:M??10,onChange:e=>{_(e.target.value.replace(/\D/g,"").slice(0,M??10)),"error"===(null==J?void 0:J.tone)&&Z(null)},placeholder:"12345678",value:E})]}):null,n.jsxs("button",{className:"native-auth-submit",disabled:te,type:"submit",children:[n.jsx("span",{children:ae}),n.jsx("span",{"aria-hidden":"true",children:te?"...":"→"})]}),R?n.jsx("button",{className:"native-auth-secondary",disabled:te,onClick:()=>{D(),T(!1),_(""),P(null),q(""),Z(null)},type:"button",children:"Use a different email"}):null,R?null:n.jsxs(n.Fragment,{children:[n.jsx("div",{className:"native-auth-divider",children:n.jsx("span",{children:"Or continue with"})}),n.jsxs("div",{className:"native-auth-socials",children:[ee?n.jsxs("button",{className:"native-auth-secondary",disabled:te,onClick:()=>{oe("apple")},type:"button",children:[n.jsx(z,{}),"Continue with Apple"]}):null,n.jsxs("button",{className:"native-auth-secondary",disabled:te,onClick:()=>{oe("google")},type:"button",children:[n.jsx(H,{}),"Continue with Google"]})]})]})]}),R?null:n.jsx("div",{className:"native-auth-switch",children:n.jsx("button",{onClick:()=>{Z(null),T(!1),_(""),P(null),q(""),j(e=>!e),r(x?"?mode=signup":"")},type:"button",children:x?n.jsxs(n.Fragment,{children:["Don't have an account? ",n.jsx("span",{children:"Sign up"})]}):n.jsxs(n.Fragment,{children:["Already have an account? ",n.jsx("span",{children:"Sign in"})]})})}),n.jsx(U,{onOpen:s})]})})]})]})}function q({onUpgradeToFullApp:e}){const[i,u]=t.useState(!0),[c,p]=t.useState(()=>R()),k=t.useRef(!1),S=t.useRef(!1);t.useLayoutEffect(()=>{const e=()=>{var e;window.scrollTo({top:0,left:0,behavior:"auto"}),document.documentElement.scrollTop=0,document.body.scrollTop=0,null==(e=document.querySelector(".native-auth-shell"))||e.scrollTo({top:0,left:0,behavior:"auto"})};e();const t=requestAnimationFrame(e);return()=>cancelAnimationFrame(t)},[]);const L=t.useCallback(async()=>{if(!k.current){k.current=!0;try{if("undefined"==typeof window||(window.__ECHO_FORCE_FULL_APP__=!0),"undefined"!=typeof window){const e=window.location.pathname;"/auth"!==e&&"/auth2"!==e||window.history.replaceState(null,"","/")}await e()}catch(t){throw k.current=!1,t}}},[e]);return t.useEffect(()=>{const e=()=>{const e=(window.location.pathname,"/auth");e!==window.location.pathname&&window.history.replaceState(null,"",`${e}${window.location.search||""}`),p(R())};return e(),window.addEventListener("popstate",e),()=>window.removeEventListener("popstate",e)},[]),t.useLayoutEffect(()=>{if(S.current)return;let e=!1;return requestAnimationFrame(()=>{e||S.current||(S.current=!0,d("first-auth-shell-frame",{route:"/auth",
2startupMode:"native-auth-fast-path"}),h("main-to-first-auth-shell-frame","main-module-evaluated","first-auth-shell-frame"),window.dispatchEvent(new Event("echo:first-frame")))}),()=>{e=!0}},[]),t.useEffect(()=>{let e=!1;const t=async()=>{e||await L()},n=async e=>{if(!e)return!1;if(!r(e))return!1;try{const t=await O(),{code:n}=l(e),{error:a}=await t.auth.exchangeCodeForSession(n);if(a)throw a;return w("echo_oauth_provider"),await o.close().catch(()=>{}),!0}catch(t){}return!1},i=async e=>{if(!e||r(e))return!1;const n=s(e);return!!n&&(g("echo:native-launch-route",n),window.history.replaceState(null,"",n),await t(),!0)};let c;return(async()=>{M("native-auth-bootstrap-init");const o=O().then(e=>e.auth.onAuthStateChange((e,n)=>{M("auth-state-change",(null==n?void 0:n.user)?"session":"none"),(null==n?void 0:n.user)&&T(!0,"bootstrap-auth-state"),(null==n?void 0:n.user)&&t().catch(e=>{})})),r=a.addListener("appUrlOpen",async e=>{await i(null==e?void 0:e.url)?M("native-auth-app-route-upgrade"):await n(null==e?void 0:e.url)&&(M("native-auth-deeplink-upgrade"),await t())}),s=a.addListener("appStateChange",async({isActive:n})=>{if(n&&!e)try{const e=await O(),{data:{session:n}}=await x(e.auth.getSession(),j);(null==n?void 0:n.user)&&(M("native-auth-resume-session","session-present"),await t())}catch(a){M("native-auth-resume-session-error",a instanceof Error?a.message:"unknown")}}),l=()=>{o.then(({data:{subscription:e}})=>e.unsubscribe()),r.then(e=>e.remove()),s.then(e=>e.remove())},c=a.getLaunchUrl().catch(()=>({url:void 0}));d("auth-init-start"),M("auth-init-start");const p=(async()=>{const t=await O(),n=Date.now()+2500;let a=0;for(;!e&&Date.now()<n;){a+=1;const e=Math.max(250,n-Date.now()),i=await y({getSession:()=>t.auth.getSession(),refreshSession:()=>t.auth.refreshSession(),hasPersistedSession:f,readTimeoutMs:Math.min(600,e),totalTimeoutMs:Math.min(1200,e)});if("authenticated"===i.status)return i.session;const o=await b(),r=await C(t,null,Math.max(250,n-Date.now()));if(null==r?void 0:r.user)return r;if("signed-out"===i.status)return o.authenticated&&(await N(),M("native-auth-session-hint-stale")),null;if(M("native-auth-session-pending","indeterminate"===i.status&&i.error instanceof Error?i.error.message:"native-session-pending"),a>=2||Date.now()>=n)break;await new Promise(e=>window.setTimeout(e,120))}return M("native-auth-session-degraded","initial-read-timeout"),null})();try{const e=v(_);if(e&&(w(_),await i(e)))return M("native-auth-injected-app-route-handled"),l;const{url:a}=await c;if(await i(a))return M("native-auth-launch-app-route-handled"),l;if(await n(a))return M("native-auth-launch-url-handled"),await t(),l}catch{}try{const n=await p;if(e)return;if(M("auth-getSession-resolved",(null==n?void 0:n.user)?"session-present":"no-session"),d("auth-ready",{hasSession:Boolean(null==n?void 0:n.user)}),h("main-to-auth-ready","main-module-evaluated","auth-ready"),m(E,{startupMode:"native-auth-fast-path"}),u(!1),null==n?void 0:n.user)return T(!0,"bootstrap-reconciled-session"),await t(),l;T(!1,"bootstrap-reconciled-session")}catch(g){e||M("auth-init-error",g instanceof Error?g.message:"unknown")}return await o,l})().then(t=>{"function"==typeof t&&(e?t():c=t)}),()=>{e=!0,null==c||c()}},[L]),n.jsx(V,{isCheckingSession:i,onAuthenticated:L,onModeChange:e=>{window.history.replaceState(null,"",`/auth${e}`),p(e)},onOpenLegalPage:async t=>{window.history.pushState(null,"",t),await e()},search:c})}function G(e,t){e.render(n.jsx(q,{onUpgradeToFullApp:t}))}export{q as default,G as mountNativeAuthBootstrap};

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.