1import{i as v,t as O}from"./react-C6JdJxIB.js";import{a as j}from"./index.esm-DxXUb9DD.js";import{t as A}from"./jsx-runtime-CGXBp6bb.js";import{t as b}from"./trans-PZ_OsZUf.js";import{t as W}from"./sweetalert2.all-4i4SswH2.js";import{t as q}from"./useCountryStateCity-Cmwz7sNz.js";import{t as M}from"./style-BVqg1Q_2.js";import{t as J}from"./react-select.esm-CkOhSNaK.js";var k=v(O(),1),h=v(W(),1),S=v(M(),1),e=A(),V=S.default?.default??S.default;function P({label:o,value:x,onChange:p,options:d,error:u,placeholder:t}){const r=d.find(n=>n.value===x)??null;return(0,e.jsxs)("div",{children:[(0,e.jsxs)("label",{className:"form-label",children:[(0,e.jsx)("i",{className:"ti ti-world me-1"}),o]}),(0,e.jsx)(J,{className:"mt-2",classNamePrefix:"select2",value:r,onChange:p,options:d,placeholder:t??"Select",isSearchable:!0,isClearable:!1,styles:{control:(n,m)=>({...n,minHeight:42,borderRadius:"0.375rem",borderColor:u?"#dc2626":m.isFocused?"#3b82f6":"#e5e7eb",boxShadow:m.isFocused?"0 0 0 3px rgba(59, 130, 246, 0.1)":"none","&:hover":{borderColor:u?"#dc2626":"#cbd5e1"}}),menu:n=>({...n,borderRadius:"0.375rem",overflow:"hidden",zIndex:40}),option:(n,m)=>({...n,backgroundColor:m.isSelected?"#1f2937":m.isFocused?"#f3f4f6":"white",color:m.isSelected?"white":"#1f2937"}),valueContainer:n=>({...n,padding:"0 12px"}),input:n=>({...n,margin:0,padding:0}),placeholder:n=>({...n,color:"#9ca3af"})}}),u&&(0,e.jsx)("div",{className:"invalid-feedback d-block",children:u})]})}function se({user:o,requiresEmailVerification:x,emailVerified:p}){const[d,u]=(0,k.useState)(o.image_url||null),{data:t,setData:r,put:n,post:m,transform:N,processing:y,errors:i}=j({name:o.name||"",email:o.email||"",image:null,phone:o.phone||"",phone_country_code:o.phone_country_code||"",phone_dial_code:o.phone_dial_code||"",business_name:o.business_name||"",country_code:o.country_code||"",country_name:o.country_name||"",state_code:o.state_code||"",state_name:o.state_name||""}),{countries:f,states:_}=q(t.country_code),L=t.phone_country_code?t.phone_country_code.toLowerCase():(t.country_code||"eg").toLowerCase();(0,k.useEffect)(()=>()=>{d?.startsWith("blob:")&&URL.revokeObjectURL(d)},[d]);const{post:B,processing:C}=j(),{delete:F,processing:w}=j({password:""}),U=s=>{const a=s?.value??"",l=f.find(g=>g.value===a),c=l?.phoneCode?`+${l.phoneCode}`:"";r({...t,country_code:a,country_name:l?.label??"",state_code:"",state_name:"",phone_country_code:a.toLowerCase(),phone_dial_code:c,phone:c})},D=s=>{const a=s?.value??"",l=_.find(c=>c.value===a);r({...t,state_code:a,state_name:l?.label??""})},I=(s,a)=>{const l=s?`+${s}`:"",c=a?.countryCode?.toUpperCase()??"",g=a?.dialCode?`+${a.dialCode}`:"",T=c?f.find(z=>z.value===c):null;r({...t,phone:l,phone_country_code:a?.countryCode??"",phone_dial_code:g,country_code:c||t.country_code,country_name:T?.label??t.country_name})},R=s=>{s.preventDefault();const a=l=>{const c=Object.values(l||{})?.[0];c&&h.default.fire({icon:"error",title:"Update failed",text:c})};if(t.image){N(l=>({...l,_method:"put"})),m("/settings/profile",{forceFormData:!0,onError:a,onFinish:()=>{N(l=>l)}});return}n("/settings/profile",{onError:a})},E=s=>{const a=s.target.files?.[0];if(!a)return;if(!["image/jpeg","image/jpg","image/png","image/webp"].includes(a.type)){h.default.fire({icon:"error",title:"Invalid image",text:"Allowed image formats: JPG, JPEG, PNG, WEBP."}),s.target.value="";return}if(a.size>4*1024*1024){h.default.fire({icon:"error",title:"Image too large",text:"Image size must be less than 4 MB."}),s.target.value="";return}const l=URL.createObjectURL(a);u(l),r("image",a)},$=async()=>{B(route("email.send-verification"),{onSuccess:()=>{h.default.fire({title:"Success!",text:"Verification email sent. Please check your inbox.",icon:"success"})}})},G=async s=>{if(s.preventDefault(),!(await h.default.fire({icon:"warning",title:"Delete account?",text:"This action cannot be undone.",showCancelButton:!0,confirmButtonText:b("yes_delete")||"Delete",cancelButtonText:b("cancel")||"Cancel"})).isConfirmed)return;const a=await h.default.fire({title:"Confirm your password",input:"password",inputLabel:"Enter password to continue",inputPlaceholder:"Password",inputAttributes:{autocapitalize:"off",autocorrect:"off"},showCancelButton:!0,confirmButtonText:b("confirm")||"Confirm",cancelButtonText:b("cancel")||"Cancel"});a.isConfirmed&&a.value&&F("/settings/profile",{data:{password:a.value}})};return(0,e.jsxs)("div",{className:"row",children:[(0,e.jsxs)("div",{className:"col-12",children:[(0,e.jsxs)("div",{className:"card mb-4",children:[(0,e.jsx)("div",{className:"card-header",children:(0,e.jsxs)("h6",{className:"mb-0",children:[(0,e.jsx)("i",{className:"ti ti-user me-2"}),"Profile Information"]})}),(0,e.jsx)("div",{className:"card-body",children:(0,e.jsxs)("form",{onSubmit:R,children:[(0,e.jsxs)("div",{className:"mb-4",children:[(0,e.jsx)("label",{className:"form-label d-block",children:"Profile Image"}),(0,e.jsxs)("div",{className:"d-flex align-items-center gap-3 flex-wrap",children:[(0,e.jsx)("div",{className:"rounded-circle overflow-hidden border flex-shrink-0",style:{width:"72px",height:"72px"},children:d?(0,e.jsx)("img",{src:d,alt:o.name||"User",style:{width:"100%",height:"100%",objectFit:"cover",objectPosition:"center"}}):(0,e.jsx)("div",{className:"w-100 h-100 d-flex align-items-center justify-content-center text-white",style:{background:"linear-gradient(135deg, #667eea 0%, #764ba2 100%)",fontWeight:"700",fontSize:"22px"},children:(t.name||"U").charAt(0).toUpperCase()})}),(0,e.jsxs)("div",{className:"flex-grow-1",style:{minWidth:"260px"},children:[(0,e.jsx)("input",{type:"file",accept:".jpg,.jpeg,.png,.webp,image/jpeg,image/png,image/webp",onChange:E,className:`form-control ${i.image?"is-invalid":""}`}),(0,e.jsx)("small",{className:"text-muted d-block mt-1",children:"JPG, PNG, WEBP up to 4 MB"}),i.image&&(0,e.jsx)("div",{className:"invalid-feedback d-block",children:i.image})]})]})]}),(0,e.jsxs)("div",{className:"mb-3",children:[(0,e.jsx)("label",{className:"form-label",children:"Full Name"}),(0,e.jsx)("input",{type:"text",className:`form-control ${i.name?"is-invalid":""}`,value:t.name,onChange:s=>r("name",s.target.value),required:!0}),i.name&&(0,e.jsx)("div",{className:"invalid-feedback d-block",children:i.name})]}),(0,e.jsxs)("div",{className:"mb-3",children:[(0,e.jsx)("label",{className:"form-label",children:"Email Address"}),(0,e.jsxs)("div",{className:"d-flex gap-2",children:[(0,e.jsx)("input",{type:"email",className:`form-control ${i.email?"is-invalid":""}`,value:t.email,onChange:s=>r("email",s.target.value),required:!0}),x&&!p&&(0,e.jsxs)("button",{type:"button",onClick:$,disabled:C,className:"btn btn-outline-primary btn-sm",title:"Send verification email",children:[(0,e.jsx)("i",{className:"ti ti-send me-1"}
1),C?"Sending...":"Verify"]})]}),i.email&&(0,e.jsx)("div",{className:"invalid-feedback d-block",children:i.email}),x&&!p&&(0,e.jsxs)("small",{className:"d-block text-warning mt-2",children:[(0,e.jsx)("i",{className:"ti ti-alert-circle me-1"}),"Please verify your email address"]}),x&&p&&(0,e.jsxs)("small",{className:"d-block text-success mt-2",children:[(0,e.jsx)("i",{className:"ti ti-check me-1"}),"Email verified"]})]}),(0,e.jsxs)("div",{className:"mb-3",children:[(0,e.jsx)("label",{className:"form-label",children:"Business Name"}),(0,e.jsx)("input",{type:"text",className:`form-control ${i.business_name?"is-invalid":""}`,value:t.business_name,onChange:s=>r("business_name",s.target.value)}),i.business_name&&(0,e.jsx)("div",{className:"invalid-feedback d-block",children:i.business_name})]}),(0,e.jsxs)("div",{className:"mb-3",children:[(0,e.jsxs)("label",{className:"form-label",children:[(0,e.jsx)("i",{className:"ti ti-phone me-1"}),"Phone Number"]}),(0,e.jsx)(V,{country:L,value:(t.phone??"").replace(/^\+/,""),onChange:I,enableSearch:!0,containerClass:"mt-2",dropdownClass:"shadow",containerStyle:{width:"100%"},inputStyle:{width:"100%",height:"42px",borderRadius:"0.375rem",border:i.phone?"1px solid #dc3545":"1px solid #dee2e6",paddingLeft:"52px",fontSize:"0.875rem"},buttonStyle:{borderTopLeftRadius:"0.375rem",borderBottomLeftRadius:"0.375rem",border:i.phone?"1px solid #dc3545":"1px solid #dee2e6",backgroundColor:"#fff"},inputProps:{name:"phone",autoComplete:"tel"}}),i.phone&&(0,e.jsx)("div",{className:"invalid-feedback d-block",children:i.phone})]}),(0,e.jsxs)("div",{className:"row",children:[(0,e.jsx)("div",{className:"col-12",children:(0,e.jsx)("div",{className:"mb-3",children:(0,e.jsx)(P,{label:"Country",value:t.country_code,onChange:U,options:f,error:i.country_code,placeholder:"Select country"})})}),(0,e.jsx)("div",{className:"col-12",children:(0,e.jsx)("div",{className:"mb-3",children:(0,e.jsx)(P,{label:"Province / State / City",value:t.state_code,onChange:D,options:_,error:i.state_code,placeholder:"Select province / state"})})})]}),(0,e.jsx)("div",{className:"d-flex gap-2",children:(0,e.jsxs)("button",{type:"submit",disabled:y,className:"btn btn-primary btn-sm",children:[(0,e.jsx)("i",{className:"ti ti-check me-1"}),y?"Saving...":"Save Changes"]})})]})})]}),(0,e.jsxs)("div",{className:"card mb-4",children:[(0,e.jsx)("div",{className:"card-header",children:(0,e.jsxs)("h6",{className:"mb-0",children:[(0,e.jsx)("i",{className:"ti ti-link me-2"}),"Social Connections"]})}),(0,e.jsxs)("div",{className:"card-body",children:[(0,e.jsx)("p",{className:"text-muted mb-4",children:"Connect your social accounts to your profile."}),(0,e.jsxs)("div",{className:"row g-3",children:[(0,e.jsx)("div",{className:"col-sm-6",children:(0,e.jsxs)("div",{className:"border rounded p-3 d-flex align-items-center justify-content-between",children:[(0,e.jsxs)("div",{className:"d-flex align-items-center gap-3",children:[(0,e.jsx)("div",{className:"bg-light p-3 rounded",children:(0,e.jsx)("i",{className:"ti ti-brand-google fs-5"})}),(0,e.jsxs)("div",{children:[(0,e.jsx)("h6",{className:"mb-1",children:"Google"}),(0,e.jsx)("small",{className:"text-muted",children:"Login with Google"})]})]}),(0,e.jsxs)("a",{href:route("socialite.redirect",{provider:"google"}),className:"btn btn-outline-primary btn-sm",children:[(0,e.jsx)("i",{className:"ti ti-link me-1"}),"Connect"]})]})}),(0,e.jsx)("div",{className:"col-sm-6",children:(0,e.jsxs)("div",{className:"border rounded p-3 d-flex align-items-center justify-content-between",children:[(0,e.jsxs)("div",{className:"d-flex align-items-center gap-3",children:[(0,e.jsx)("div",{className:"bg-light p-3 rounded",children:(0,e.jsx)("i",{className:"ti ti-brand-facebook fs-5"})}),(0,e.jsxs)("div",{children:[(0,e.jsx)("h6",{className:"mb-1",children:"Facebook"}),(0,e.jsx)("small",{className:"text-muted",children:"Login with Facebook"})]})]}),(0,e.jsxs)("a",{href:route("socialite.redirect",{provider:"facebook"}),className:"btn btn-outline-primary btn-sm",children:[(0,e.jsx)("i",{className:"ti ti-link me-1"}),"Connect"]})]})})]})]})]})]}),(0,e.jsx)("div",{className:"col-12",children:(0,e.jsxs)("div",{className:"card border-danger",children:[(0,e.jsx)("div",{className:"card-header bg-danger-light",children:(0,e.jsxs)("h6",{className:"mb-0 text-danger",children:[(0,e.jsx)("i",{className:"ti ti-trash me-2"}),"Danger Zone"]})}),(0,e.jsxs)("div",{className:"card-body",children:[(0,e.jsx)("p",{className:"text-xs text-muted mb-3",children:"Once you delete your account, there is no going back. Please be certain."}),(0,e.jsxs)("button",{type:"button",onClick:G,disabled:w,className:"btn btn-outline-danger btn-sm w-100",children:[(0,e.jsx)("i",{className:"ti ti-trash me-1"}),w?"Deleting...":"Delete Account"]})]})]})})]})}export{se 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.