1var g=(y,j,c)=>new Promise((b,l)=>{var x=o=>{try{p(c.next(o))}catch(m){l(m)}},d=o=>{try{p(c.throw(o))}catch(m){l(m)}},p=o=>o.done?b(o.value):Promise.resolve(o.value).then(x,d);p((c=c.apply(y,j)).next())});import{j as e}from"./vendor-framer-D8dO-b0k.js";import{r as n}from"./vendor-react-pZQaDvDc.js";import{a as D,d as M}from"./vendor-firebase-p_iMPr39.js";import{m as R,o as W,p as q,e as f,d as I,r as T,t as Y}from"./firebase-BsqF83MS.js";import{n as A}from"./validation-B2J-GquG.js";import{I as F}from"./ImageUpload-DIBiUwpj.js";import{S as V}from"./SEO-B5im8YTh.js";/* empty css */import"./index-CkemRdey.js";import"./camera-CBuo_tDQ.js";import"./check-Cva5hYTZ.js";function _(){const[y,j]=n.useState(""),[c,b]=n.useState(""),[l,x]=n.useState(null),[d,p]=n.useState(null),[o,m]=n.useState(null),[v,S]=n.useState(null),[a,h]=n.useState(!1),[w,i]=n.useState(""),[U,C]=n.useState(!1);n.useEffect(()=>()=>R(),[]);function P(r){return g(this,null,function*(){r.preventDefault();const s=A(y);if(!s){i("Enter your 10-digit US phone number, with or without +1.");return}h(!0),i("");try{yield W("photo-update-recaptcha"),x(yield q(`+1${s}`))}catch(t){i("We couldnât send a code. Check your number and try again.")}finally{h(!1)}})}function E(r){return g(this,null,function*(){var s;if(r.preventDefault(),!!l){h(!0),i("");try{const{user:t}=yield l.confirm(c.trim());if(!t.phoneNumber||t.isAnonymous||((s=f.currentUser)==null?void 0:s.uid)!==t.uid)throw new Error("Please verify your phone number again.");if(!(yield D(M(I,"users",t.uid))).exists())throw new Error("No Mesh profile was found for this number. Use the number you signed up with, or contact support.");p(t)}catch(t){i(t instanceof Error&&t.message.startsWith("No Mesh profile")?t.message:"That code couldnât be verified. Check it and try again, or request a new code.")}finally{h(!1)}}})}function N(r){return g(this,null,function*(){var s,t;if(r.preventDefault(),!(!o||!d||a)){h(!0),i("");try{const u=d.uid;if(((s=f.currentUser)==null?void 0:s.uid)!==u||!f.currentUser.phoneNumber||f.currentUser.isAnonymous)throw new Error("Your sign-in changed. Refresh this page and verify your phone number again.");const k=yield T(o,u);if(((t=f.currentUser)==null?void 0:t.uid)!==u)throw new Error("Your sign-in changed. Refresh this page and verify your phone number again.");yield Y(u,k),C(!0)}catch(u){i(u instanceof Error?u.message:"Couldnât save your photo. Please try again.")}finally{h(!1)}}})}return e.jsxs("main",{className:"mesh-public-page mesh-contact-page",children:[e.jsx(V,{title:"Update your Mesh profile photo",noindex:!0,url:"https://www.mesh-local.com/update-photo"}),e.jsxs("section",{className:"mesh-public-hero",children:[e.jsx("p",{className:"mesh-public-eyebrow",children:"Your Mesh profile"}),e.jsx("h1",{children:"Update your photo."}),e.jsx("p",{children:"Use the phone number you signed up with. Weâll text you a code to confirm itâs you."})]}),e.jsxs("section",{className:"mesh-contact-form",style:{maxWidth:620,margin:"0 auto 64px",padding:24},children:[U?e.jsxs("div",{role:"status",children:[e.jsx("h2",{children:"Photo submitted."}),e.jsx("p",{children:"Weâll review your new photo before using it for your profile. A clear, recent photo of just you works best."}),e.jsx("a",{href:"/",children:"Back to Mesh"})]}):d?e.jsxs("form",{onSubmit:N,children:[e.jsx("h2",{children:"Choose a clear photo of you."}),e.jsx("p",{children:"Show your face clearly. Please skip group shots, screenshots, cartoons, and photos of objects."}),e.jsx(F,{variant:"avatar",initialPreview:v,onImageSelected:(r,s)=>{m(r),S(s)}}),e.jsx("button",{className:"mesh-public-button",type:"submit",disabled:!o||a,children:a?"Savingâ¦":"Save new photo"})]}):l?e.jsxs("form",{onSubmit:E,children:[e.jsx("label",{htmlFor:"photo-code",children:"Code from your text"}),e.jsx("input",{id:"photo-code",autoComplete:"one-time-code",inputMode:"numeric",pattern:"[0-9]{6}",maxLength:6,value:c,onChange:r=>b(r.target.value.replace(/\D/g,"")),required:!0}),e.jsx("button",{className:"mesh-public-button",disabled:a,type:"submit",children:a?"Checkingâ¦":"Verify code"}),e.jsx("button",{type:"button",disabled:a,onClick:()=>{x(null),b(""),i("")},children:"Use another number or request a new code"})]}):e.jsxs("form",{onSubmit:P,children:[e.jsx("label",{htmlFor:"photo-phone",children:"Your phone number"}),e.jsx("input",{id:"photo-phone",type:"tel",autoComplete:"tel",value:y,onChange:r=>j(r.target.value),placeholder:"(608) 555-0123",required:!0}),e.jsx("button",{className:"mesh-public-button",disabled:a,type:"submit",children:a?"Sendingâ¦":"Text me a code"})]}),w&&e.jsx("p",{role:"alert",children:w}),e.jsx("div",{id:"photo-update-recaptcha"}),e.jsxs("p",{style:{marginTop:24},children:["Need a hand? ",e.jsx("a",{href:"sms:+16082852027",children:"Text (608) 285-2027"}),"."]})]})]})}export{_ as UpdateProfilePhoto};
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.