1import{j as s}from"./vendor-ui-BRVg3_iW.js";import{d as g,r as n,L as v}from"./vendor-react-fhnP-ZxB.js";import{y as j,_ as k,o as a}from"./index-BTZS4ZAF.js";import{P as S}from"./PageSEO-B4Gs_10e.js";import{R as N}from"./ResetPasswordForm-EqrGMSPm.js";import{S as R}from"./shield-alert-CiXMN9Tf.js";import"./vendor-three-BixXOMS4.js";import"./vendor-charts-CM-rxR9X.js";import"./vendor-radix-B2hiDlNL.js";import"./vendor-query-fmpM_ONB.js";import"./vendor-supabase-BDcQUG0T.js";import"./vendor-date-D8Ds2zcx.js";import"./label-BPIIQwcF.js";import"./circle-check-big-B4TBZX_F.js";import"./lock-DeRcLZvT.js";import"./vendor-forms-Dykgrlzy.js";function W(){const p=g(),[o,f]=n.useState("verifying"),[x,w]=n.useState(null);n.useEffect(()=>{let c=!1;const i=(t,r)=>{c||(w(r??null),f(t))};return(async()=>{const t=new URL(window.location.href),r=new URLSearchParams(t.hash.startsWith("#")?t.hash.slice(1):t.hash),l=t.searchParams.get("error_description")||r.get("error_description");if(l){i("invalid",l);return}const h=t.searchParams.get("token_hash")||r.get("token_hash"),d=t.searchParams.get("code"),m=r.get("access_token"),u=r.get("refresh_token");try{if(h){const{error:e}=await a.auth.verifyOtp({type:"recovery",token_hash:h});if(e)throw e}else if(m&&u){const{error:e}=await a.auth.setSession({access_token:m,refresh_token:u});if(e)throw e}else if(d){const{error:e}=await a.auth.exchangeCodeForSession(d);if(e)throw e}else{const{data:e}=await a.auth.getSession();if(!e.session){i("invalid","This password reset link is invalid or has expired.");return}}window.history.replaceState({},document.title,"/reset-password"),i("ready")}catch(e){i("invalid",(e==null?void 0:e.message)||"This password reset link is invalid or has expired.")}})(),()=>{c=!0}},[]);const y=async()=>{await a.auth.signOut(),p("/auth")};return s.jsxs("div",{className:"min-h-screen flex items-center justify-center px-4 py-12",children:[s.jsx(S,{title:"Reset your password | EcomBos",description:"Choose a new password for your EcomBos account.",noindex:!0}),s.jsxs("div",{className:"w-full max-w-md",children:[o==="verifying"&&s.jsxs("div",{className:"text-center py-16",children:[s.jsx(j,{className:"h-6 w-6 animate-spin mx-auto mb-4 text-primary"}),s.jsx("p",{className:"text-sm text-muted-foreground",children:"Verifying your reset linkâ¦"})]}),o==="invalid"&&s.jsxs("div",{className:"text-center py-12",children:[s.jsx("div",{className:"w-14 h-14 rounded-full bg-destructive/10 flex items-center justify-center mx-auto mb-4",children:s.jsx(R,{className:"h-7 w-7 text-destructive"})}),s.jsx("h1",{className:"text-xl font-semibold mb-2",children:"Reset link no longer valid"}),s.jsxs("p",{className:"text-sm text-muted-foreground mb-6",children:[x||"This password reset link is invalid or has expired."," Request a new one to continue."]}),s.jsx(k,{asChild:!0,className:"w-full h-11",children:s.jsx(v,{to:"/auth",children:"Request a new reset link"})})]}),o==="ready"&&s.jsx(N,{onSuccess:y})]})]})}export{W as default};
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.