PageSourceSearch

https://www.bathroombuddy.io/_next/static/chunks/app/reset-password/page-8d8300436cf9755b.js

js bathroombuddy.io collected 2026-10-02 01:59:04 UTC 16,757 bytes, 1 lines download raw bytes

1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[4700],{1062:(e,t,r)=>{"use strict";r.d(t,{p:()=>n});var a=r(4955);r(7579);var s=r(6397);function n(e){let{className:t,type:r,...n}=e;return(0,a.jsx)("input",{type:r,"data-slot":"input",className:(0,s.cn)("file:text-foreground placeholder:text-muted-foreground selection:bg-primary selection:text-primary-foreground dark:bg-input/30 border-input flex h-9 w-full min-w-0 rounded-md border bg-transparent px-3 py-1 text-base shadow-xs transition-[color,box-shadow] outline-none file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm","focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]","aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",t),...n})}},2606:(e,t,r)=>{"use strict";r.d(t,{$:()=>c});var a=r(4955);r(7579);var s=r(7460),n=r(3727),o=r(6397);let i=(0,n.F)("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",{variants:{variant:{default:"bg-primary text-primary-foreground shadow-xs hover:bg-primary/90",destructive:"bg-destructive text-white shadow-xs hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",outline:"border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50",secondary:"bg-secondary text-secondary-foreground shadow-xs hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2 has-[>svg]:px-3",sm:"h-8 rounded-md gap-1.5 px-3 has-[>svg]:px-2.5",lg:"h-10 rounded-md px-6 has-[>svg]:px-4",icon:"size-9"}},defaultVariants:{variant:"default",size:"default"}});function c(e){let{className:t,variant:r,size:n,asChild:c=!1,...l}=e,d=c?s.DX:"button";return(0,a.jsx)(d,{"data-slot":"button",className:(0,o.cn)(i({variant:r,size:n,className:t})),...l})}},2660:(e,t,r)=>{"use strict";r.d(t,{BT:()=>c,Wu:()=>l,ZB:()=>i,Zp:()=>n,aR:()=>o,wL:()=>d});var a=r(4955);r(7579);var s=r(6397);function n(e){let{className:t,...r}=e;return(0,a.jsx)("div",{"data-slot":"card",className:(0,s.cn)("bg-card text-card-foreground flex flex-col gap-6 rounded-xl border py-6 shadow-sm",t),...r})}function o(e){let{className:t,...r}=e;return(0,a.jsx)("div",{"data-slot":"card-header",className:(0,s.cn)("@container/card-header grid auto-rows-min grid-rows-[auto_auto] items-start gap-1.5 px-6 has-data-[slot=card-action]:grid-cols-[1fr_auto] [.border-b]:pb-6",t),...r})}function i(e){let{className:t,...r}=e;return(0,a.jsx)("div",{"data-slot":"card-title",className:(0,s.cn)("leading-none font-semibold",t),...r})}function c(e){let{className:t,...r}=e;return(0,a.jsx)("div",{"data-slot":"card-description",className:(0,s.cn)("text-muted-foreground text-sm",t),...r})}function l(e){let{className:t,...r}=e;return(0,a.jsx)("div",{"data-slot":"card-content",className:(0,s.cn)("px-6",t),...r})}function d(e){let{className:t,...r}=e;return(0,a.jsx)("div",{"data-slot":"card-footer",className:(0,s.cn)("flex items-center px-6 [.border-t]:pt-6",t),...r})}},3060:(e,t,r)=>{"use strict";var a=r(7252);r.o(a,"useParams")&&r.d(t,{useParams:function(){return a.useParams}}),r.o(a,"usePathname")&&r.d(t,{usePathname:function(){return a.usePathname}}),r.o(a,"useRouter")&&r.d(t,{useRouter:function(){return a.useRouter}}),r.o(a,"useSearchParams")&&r.d(t,{useSearchParams:function(){return a.useSearchParams}})},4399:(e,t,r)=>{"use strict";r.d(t,{A:()=>c});var a=r(7880),s=r(9524),n=r(9186);let o=()=>"".concat(window.location.origin,"/auth/confirm"),i={signup:async e=>{var t;let r=await fetch("/api/auth/signup",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({email:e.email,password:e.password,first_name:e.first_name,last_name:e.last_name,redirect_to:null!=(t=e.redirect_to)?t:o(),turnstile_token:e.turnstile_token})});if(!r.ok)throw Error((await r.json()).message||"Signup failed");let n=await r.json(),c=n.access_token||n.token||"",l={...n,token:c};return c&&(i.saveToken(c,l.expires_at),a.A.set(s.d5.AUTH_COOKIE,c,{expires:s.nQ.COOKIE_EXPIRES_DAYS,path:"/"}),l.refresh_token&&localStorage.setItem(s.d5.REFRESH_TOKEN,l.refresh_token)),l},login:async(e,t,r)=>{try{n.vF.apiRequest("POST","/api/auth/signin",{email:e});let o=await fetch("/api/auth/signin",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({email:e,password:t,turnstile_token:r||void 0})});if(!o.ok){let e=await o.json();
1throw n.vF.apiResponse("POST","/api/auth/signin",o.status,e),Error(e.message||"Login failed")}let c=await o.json(),l=c.access_token||c.token;if(!l)throw Error("Login response did not include an access token");let d={...c,token:l};return n.vF.apiResponse("POST","/api/auth/signin",o.status),i.saveToken(l,d.expires_at),a.A.set(s.d5.AUTH_COOKIE,l,{expires:s.nQ.COOKIE_EXPIRES_DAYS,path:"/"}),d.refresh_token&&localStorage.setItem(s.d5.REFRESH_TOKEN,d.refresh_token),d}catch(e){throw n.vF.apiError("POST","/api/auth/signin",e),e}},resetPassword:async(e,t)=>{let r=await fetch("/api/auth/password-reset",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({email:e,turnstile_token:t||void 0})});if(!r.ok){let e=await r.json();throw Error(e.message||e.error||"Password reset request failed")}return await r.json()},sendMagicLink:async(e,t)=>{let r=await fetch("/api/auth/magic-link",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({email:e,redirect_to:o(),turnstile_token:t||void 0})}),a=await r.json().catch(()=>({}));if(!r.ok)throw Error(a.message||a.details||"Magic link request failed");return a},signInWithProvider:async e=>{let t=await fetch("/api/auth/provider",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:e,redirect_to:o()})}),r=await t.json().catch(()=>({}));if(!t.ok||!r.url)throw Error(r.message||r.details||"Provider sign-in failed");window.location.assign(r.url)},saveSession:async(e,t,r)=>{i.saveToken(e,"number"==typeof r?new Date(1e3*r).toISOString():r||void 0),a.A.set(s.d5.AUTH_COOKIE,e,{expires:s.nQ.COOKIE_EXPIRES_DAYS,path:"/"}),t&&localStorage.setItem(s.d5.REFRESH_TOKEN,t)},getRefreshToken:async()=>localStorage.getItem(s.d5.REFRESH_TOKEN),saveRefreshToken:async e=>{localStorage.setItem(s.d5.REFRESH_TOKEN,e)},refreshToken:async()=>{let e=await i.getRefreshToken();if(!e)throw Error("No refresh token available");try{let t=await fetch("/api/auth/refresh",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({refresh_token:e})});if(!t.ok)throw Error("Failed to refresh token");let r=await t.json();return i.saveToken(r.access_token,r.expires_at),i.saveRefreshToken(r.refresh_token),r.access_token}catch(e){throw n.vF.error("Failed to refresh token:",e),await i.logout(),Error("Authentication expired. Please log in again.")}},saveToken:async(e,t)=>{if(localStorage.setItem(s.d5.TOKEN,e),t)localStorage.setItem(s.d5.TOKEN_EXPIRY,t);else{let e=new Date;e.setHours(e.getHours()+s.nQ.DEFAULT_TOKEN_HOURS),localStorage.setItem(s.d5.TOKEN_EXPIRY,e.toISOString())}},logout:async()=>{let e=localStorage.getItem(s.d5.TOKEN);if(e)try{await fetch("".concat(s.i3.PUBLIC_BASE_URL,"/api/auth/logout"),{method:"POST",headers:{Authorization:"Bearer ".concat(e)}})}catch(e){n.vF.warn("Failed to record backend logout event",e)}localStorage.removeItem(s.d5.TOKEN),localStorage.removeItem(s.d5.TOKEN_EXPIRY),localStorage.removeItem(s.d5.REFRESH_TOKEN),a.A.remove(s.d5.AUTH_COOKIE,{path:"/"})},isTokenValid:async()=>{let e=localStorage.getItem(s.d5.TOKEN),t=localStorage.getItem(s.d5.TOKEN_EXPIRY);return!!e&&!!t&&new Date(t)>new Date}},c=i},6175:(e,t,r)=>{"use strict";r.r(t),r.d(t,{default:()=>u});var a=r(4955),s=r(7579),n=r(3060),o=r(1062),i=r(2606),c=r(2660),l=r(4399),d=r(6397);function u(){let[e,t]=(0,s.useState)(""),[r,u]=(0,s.useState)(!1),[h,p]=(0,s.use
1State)(null),[m,f]=(0,s.useState)(!1),g=(0,s.useRef)(new d.v(6e4)),v=(0,n.useRouter)(),E=async r=>{if(r.preventDefault(),p(null),!e||!(0,d.D)(e))return void p("Please enter a valid email address");if(!g.current.canMakeRequest()){let e=Math.ceil(g.current.getTimeUntilNextRequest()/1e3);p("Please wait ".concat(e," seconds before requesting another reset"));return}u(!0);try{await l.A.resetPassword(e),g.current.recordRequest(),f(!0),t("")}catch(e){p(e instanceof Error?e.message:"Password reset request failed")}finally{u(!1)}},x=()=>{v.push("/login")};return m?(0,a.jsx)("div",{className:"flex min-h-screen items-center justify-center",children:(0,a.jsxs)(c.Zp,{className:"w-full max-w-md border-[#73E2FE] bg-[#0A1623]",children:[(0,a.jsxs)(c.aR,{children:[(0,a.jsx)(c.ZB,{className:"text-[#73E2FE] text-center",children:"Check Your Email"}),(0,a.jsx)(c.BT,{className:"text-gray-300 text-center",children:"We've sent a password reset link to your email address. Please check your inbox and follow the instructions to reset your password."})]}),(0,a.jsx)(c.Wu,{children:(0,a.jsxs)("div",{className:"text-center",children:[(0,a.jsx)("div",{className:"mb-4 text-[#73E2FE]",children:(0,a.jsx)("svg",{className:"mx-auto h-16 w-16",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:(0,a.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M3 8l7.89 4.26a2 2 0 002.22 0L21 8M5 19h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v10a2 2 0 002 2z"})})}),(0,a.jsx)("p",{className:"text-gray-300 mb-6",children:"If you don't see the email, check your spam folder. The reset link will expire in 24 hours."})]})}),(0,a.jsx)(c.wL,{className:"flex justify-center",children:(0,a.jsx)(i.$,{onClick:x,className:"bg-[#73E2FE] text-[#0A1623] hover:bg-[#5BC8E8] focus-visible:ring-[#73E2FE]",children:"Back to Login"})})]})}):(0,a.jsx)("div",{className:"flex min-h-screen items-center justify-center",children:(0,a.jsxs)(c.Zp,{className:"w-full max-w-md border-[#73E2FE] bg-[#0A1623]",children:[(0,a.jsxs)(c.aR,{children:[(0,a.jsx)(c.ZB,{className:"text-[#73E2FE] text-center",children:"Reset Password"}),(0,a.jsx)(c.BT,{className:"text-gray-300 text-center",children:"Enter your email address and we'll send you a link to reset your password."})]}),(0,a.jsx)(c.Wu,{children:(0,a.jsxs)("form",{onSubmit:E,className:"space-y-4",children:[h&&(0,a.jsx)("div",{className:"text-red-500 text-sm text-center bg-red-900/20 p-2 rounded",children:h}),(0,a.jsxs)("div",{className:"space-y-2",children:[(0,a.jsx)("label",{htmlFor:"reset-email",className:"text-sm font-medium text-[#73E2FE]",children:"Email Address"}),(0,a.jsx)(o.p,{id:"reset-email",type:"email",value:e,onChange:e=>t(e.target.value),required:!0,placeholder:"Enter your email address",className:"border-[#73E2FE] bg-[#0A1623] text-white placeholder-gray-400 focus-visible:ring-[#73E2FE]",disabled:r})]}),(0,a.jsx)(i.$,{type:"submit",className:"w-full bg-[#73E2FE] text-[#0A1623] hover:bg-[#5BC8E8] focus-visible:ring-[#73E2FE]",disabled:r,children:r?(0,a.jsxs)("span",{className:"flex items-center justify-center",children:[(0,a.jsxs)("svg",{className:"animate-spin -ml-1 mr-2 h-4 w-4 text-[#0A1623]",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[(0,a.jsx)("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),(0,a.jsx)("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),"Sending Reset Link..."]}):"Send Reset Link"})]})}),(0,a.jsx)(c.wL,{className:"flex justify-center",children:(0,a.jsxs)("p",{className:"text-sm text-gray-300",children:["Remember your password?"," ",(0,a.jsx)(i.$,{variant:"link",className:"text-[#73E2FE] hover:text-[#5BC8E8] p-0 h-auto",onClick:x,disabled:r,children:"Back to Login"})]})})]})})}},6397:(e,t,r)=>{"use strict";r.d(t,{D:()=>o,cn:()=>n,v:()=>i});var a=r(5719),s=r(6731);function n(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];return(0,s.QP)((0,a.$)(t))}function o(e){return/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(e)}
1class i{canMakeRequest(){return Date.now()-this.lastRequestTime>=this.minInterval}recordRequest(){this.lastRequestTime=Date.now()}getTimeUntilNextRequest(){let e=Date.now()-this.lastRequestTime;return Math.max(0,this.minInterval-e)}constructor(e=6e4){this.lastRequestTime=0,this.minInterval=e}}},7880:(e,t,r)=>{"use strict";function a(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var a in r)e[a]=r[a]}return e}r.d(t,{A:()=>s});var s=function e(t,r){function s(e,s,n){if("undefined"!=typeof document){"number"==typeof(n=a({},r,n)).expires&&(n.expires=new Date(Date.now()+864e5*n.expires)),n.expires&&(n.expires=n.expires.toUTCString()),e=encodeURIComponent(e).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape);var o="";for(var i in n)n[i]&&(o+="; "+i,!0!==n[i]&&(o+="="+n[i].split(";")[0]));return document.cookie=e+"="+t.write(s,e)+o}}return Object.create({set:s,get:function(e){if("undefined"!=typeof document&&(!arguments.length||e)){for(var r=document.cookie?document.cookie.split("; "):[],a={},s=0;s<r.length;s++){var n=r[s].split("="),o=n.slice(1).join("=");try{var i=decodeURIComponent(n[0]);if(a[i]=t.read(o,i),e===i)break}catch(e){}}return e?a[e]:a}},remove:function(e,t){s(e,"",a({},t,{expires:-1}))},withAttributes:function(t){return e(this.converter,a({},this.attributes,t))},withConverter:function(t){return e(a({},this.converter,t),this.attributes)}},{attributes:{value:Object.freeze(r)},converter:{value:Object.freeze(t)}})}({read:function(e){return'"'===e[0]&&(e=e.slice(1,-1)),e.replace(/(%[\dA-F]{2})+/gi,decodeURIComponent)},write:function(e){return encodeURIComponent(e).replace(/%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[BCD])/g,decodeURIComponent)}},{path:"/"})},9148:(e,t,r)=>{Promise.resolve().then(r.bind(r,6175))},9186:(e,t,r)=>{"use strict";r.d(t,{vF:()=>s});class a{shouldLog(e){return!!this.isDevelopment||"error"===e||"warn"===e}debug(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];this.shouldLog("debug")}info(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];this.shouldLog("info")}warn(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];this.shouldLog("warn")}error(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];this.shouldLog("error")}apiRequest(e,t,r){this.debug("API ".concat(e.toUpperCase()," ").concat(t),r?{data:r}:"")}apiResponse(e,t,r,a){r>=400?this.error("API ".concat(e.toUpperCase()," ").concat(t," failed with status ").concat(r),a):this.debug("API ".concat(e.toUpperCase()," ").concat(t," success (").concat(r,")"),a)}apiError(e,t,r){this.error("API ".concat(e.toUpperCase()," ").concat(t," error:"),r)}constructor(){this.isDevelopment=!1}}let s=new a,{debug:n,info:o,warn:i,error:c}=s},9524:(e,t,r)=>{"use strict";r.d(t,{bR:()=>n,cl:()=>c,d5:()=>o,i3:()=>s,nQ:()=>i});var a=r(2688);let s={BASE_URL:a.env.BASE_API_URL||"https://api.bathroombuddy.io",PUBLIC_BASE_URL:"https://api.bathroombuddy.io",APP_KEY:a.env.APP_KEY||"CXsHbehRZI"},n={PUBLIC_API_KEY:"pk.eyJ1Ijoicm9ja2hlbGxqdW1wZXIiLCJhIjoiY21iMTkzMDExMDV2ajJsb2t5cjFkZGl5biJ9.1O16uWHpKQL35cd9kYyouQ",GEOCODING_URL:a.env.MAPBOX_GEOCODING_URL||"https://api.mapbox.com/geocoding/v5/mapbox.places",MAP_STYLE:"mapbox://styles/mapbox/streets-v12"},o={TOKEN:a.env.TOKEN_STORAGE_KEY||"bathroom_buddy_token",TOKEN_EXPIRY:a.env.TOKEN_EXPIRY_KEY||"bathroom_buddy_token_expiry",REFRESH_TOKEN:a.env.REFRESH_TOKEN_KEY||"bathroom_buddy_refresh_token",AUTH_COOKIE:a.env.AUTH_COOKIE_NAME||"auth_token"},i={COOKIE_EXPIRES_DAYS:parseInt(a.env.COOKIE_EXPIRES_DAYS||"7",10),DEFAULT_TOKEN_HOURS:parseInt(a.env.DEFAULT_TOKEN_HOURS||"24",10),AUTH_CONFIRMATION_DELAY_MS:parseInt(a.env.AUTH_CONFIRMATION_DELAY_MS||"1500",10),AUTH_RETRY_DELAY_MS:parseInt(a.env.AUTH_RETRY_DELAY_MS||"1000",10),AUTH_DEEPLINK_DELAY_MS:parseInt(a.env.AUTH_DEEPLINK_DELAY_MS||"2000",10),SEARCH_DEBOUNCE_MS:parseInt(a.env.SEARCH_DEBOUNCE_MS||"300",10)},c={DEFAULT_RADIUS_METERS:parseInt(a.env.DEFAULT_SEARCH_RADIUS_METERS||"5000",10)};a.env.PRIMARY_COLOR,a.env.BACKGROUND_COLOR,a.env.BORDER_COLOR,n.PUBLIC_API_KEY}},e=>{e.O(0,[3726,7444,5513,7358],()=>e(e.s=9148)),_N_E=e.O()}]);

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.