PageSourceSearch

https://members.salesamurai.io/build/assets/WE0_Yna8.js

js salesamurai.io collected 2026-09-27 20:56:08 UTC 89,482 bytes, 1 lines download raw bytes

1import{d as L,r as P,w as ce,c as a,E as oe,f as e,k as h,q as C,j as T,_ as f,ak as he,v as _,ai as Ye,F as H,p as me,e as o,Q as z,z as Y,t as O,D as J,aj as te,y as E,b9 as Le,ah as fe,aI as ye,b0 as le,o as be,aE as Ie,G as ke,ba as Oe,b as We,J as He,b3 as qe,b1 as Ke,b2 as Xe,b8 as Ge,a4 as Ae,bb as ge,ag as Je}from"./edfHDTum.js";import{_ as Pe,a as Ze,b as Se,c as Qe,d as et}from"./ChHTO6i0.js";import{B as pe}from"./B_ipyhYZ.js";import{b as ae,u as Z}from"./BfPKaf7i.js";import{a as R,l as Be}from"./DCi-oGBp.js";import{u as tt}from"./D6I7epYB.js";import{u as st}from"./XSMwtvJJ.js";import{u as ot}from"./BqRlifpo.js";import{_ as ve}from"./CHRB8wXb.js";import{_ as _e}from"./CiDPN6DE.js";import{u as lt,_ as at}from"./D_Ks8d5D.js";import{_ as ie,u as ee}from"./XsR6ZTSk.js";import{B as ne}from"./SYllU1se.js";import{d as re,s as Me}from"./DwoMavKs.js";import{_ as nt}from"./DlAUqK2U.js";import{I as rt}from"./jca_Kk7O.js";import{I as De,a as je}from"./Xoi1hU5U.js";import{u as it}from"./C-UEDonU.js";import"./BYecEvQY.js";import"./CvuVP51M.js";import"./gMVYLUlo.js";const dt={class:"border-2 border-transparent bg-tropical-blue-200/30 dark:bg-fiord-550/29 text-woodsmoke-900 dark:text-white mt-1 px-5 rounded-lg pb-8"},ut={class:"mt-5 w-full px-4 text-gray-900 dark:text-white"},ct={class:"mb-3"},pt={class:"mt-2 relative"},mt={key:0,class:"text-sm text-punch-600 dark:text-tamarillo-550 text-left"},bt={class:"mb-3"},ft={class:"mt-2 relative"},yt={key:0,class:"text-sm text-eucalyptus-500 text-left"},vt={class:"mb-3"},xt={class:"mt-2 relative"},ht={key:0,class:"text-sm text-punch-600 dark:text-tamarillo-550 text-left"},gt={class:"flex justify-start md:justify-end pt-4 pb-1"},_t=["disabled"],kt={key:1},wt={key:2},Ct=L({__name:"ProfileChangePassword",emits:["close"],setup(v,{emit:c}){const{notify:s}=ae(),m=c,u=P({current_password:"",password:"",password_confirmation:""}),{isStrongPassword:M}=st(()=>u.value.password),{passwordConfirmation:l}=ot(u),d=P({}),w=P(!1),n=async()=>{var S;w.value=!0;try{await R.put("/api/user/change-password",{current_password:u.value.current_password,password:u.value.password,password_confirmation:u.value.password_confirmation}),m("close"),s("The password has been changed successfully!","success")}catch(b){const y=b;((S=y.response)==null?void 0:S.status)===422&&(d.value=y.response.data.errors,s("Your password can't be changed.","error"))}finally{w.value=!1}};return ce(()=>u.value,S=>{for(const b in d.value)S[b]&&S[b].toString().trim()!==""&&delete d.value[b]},{deep:!0}),(S,b)=>(o(),a("form",{onSubmit:oe(n,["prevent"])},[e("div",dt,[e("div",ut,[e("div",ct,[b[3]||(b[3]=e("div",{class:"flex items-center justify-between"},[e("label",{for:"old_password",class:"block text-base font-semibold"},"Old password")],-1)),e("div",pt,[C(_e,{modelValue:u.value.current_password,"onUpdate:modelValue":b[0]||(b[0]=y=>u.value.current_password=y),id:"old_password",classes:["block h-[50px] w-full rounded-lg bg-white dark:bg-big-stone-950a px-4 pr-16 text-lynch-500 dark:text-gray-chateau-400 placeholder:text-base placeholder:text-lynch-500 dark:placeholder:text-gray-chateau-400 border focus:outline-none autofill:shadow-[inset_0_0_0px_1000px_var(--color-white)]! dark:autofill:shadow-[inset_0_0_0px_1000px_var(--color-big-stone-950a)]! autofill:[-webkit-text-fill-color:var(--color-gray-chateau-500)] dark:autofill:[-webkit-text-fill-color:var(--color-link-water-200)]",d.value.current_password?"border-red-500":"border-tropical-blue-200 dark:border-lynch-500 focus:border-blue-ribbon-500 dark:focus:border-dodger-blue-430"]},null,8,["modelValue","classes"]),d.value.current_password?(o(),T(f(he),{key:0,class:"absolute right-9 top-1/2 -translate-y-1/2 w-5 h-5 text-punch-600 dark:text-tamarillo-550 pointer-events-none"})):h("",!0)]),d.value.current_password?(o(),a("p",mt,_(d.value.current_password[0]),1)):h("",!0)]),e("div",bt,[b[4]||(b[4]=e("div",{class:"flex items-center justify-between"},[e("label",{for:"new_password",class:"block text-base font-semibold"},"New password")],-1)),e("div",ft,[C(_e,{modelValue:u.value.password,"onUpdate:modelValue":b[1]||(b[1]=y=>u.value.password=y),id:"password",classes:["block h-[50px] w-full rounded-lg bg-white dark:bg-big-stone-950a px-4 pr-16 text-lynch-500 dark:text-gray-chateau-400 placeholder:text-base placeholder:text-lynch-500 dark:placeholder:text-gray-chateau-400 border focus:outline-none autofill:shadow-[inset_0_0_0px_1000px_var(--color-white)]! dark:autofill:shadow-[inset_0_0_0px_1000px_var(--color-big-stone-950a)]! autofill:[-webkit-text-fill-color:var(--color-gray-chateau-500)] dark:autofill:[-webkit-text-fill-color:var(--color-link-water-200)]",d.value.password?"border-red-500":f(M)?"border-eucalyptus-500 focus:border-eucalyptus-500":"border-tropical-blue-200 dark:border-lynch-500 focus:border-blue-ribbon-500 dark:focus:border-dodger-blue-430"]},null,8,["modelValue","classes"]),d.value.password?(o(),T(f(he),{key:0,class:"absolute right-9 top-1/2 -translate-y-1/2 w-5 h-5 text-punch-600 dark:text-tamarillo-550 pointer-events-none"})):h("",!0),f(M)?(o(),T(f(Ye),{key:1,class:"absolute right-9 top-1/2 -translate-y-1/2 w-5 h-5 text-eucalyptus-500 pointer-events-none"})):h("",!0)]),(o(!0),a(H,null,me(d.value.password,(y,$)=>(o(),a("p",{key:$,class:"text-sm text-punch-600 dark:text-tamarillo-550 text-left"},_(y),1))),128)),f(M)?(o(),a("p",yt," Password is strong ")):h("",!0)]),e("div",vt,[b[5]||(b[5]=e("div",{class:"flex items-center justify-between"},[e("label",{for:"password_confirmation",class:"block text-base font-semibold"},"Confirm password")],-1)),e("div",xt,[C(_e,{modelValue:u.value.password_confirmation,"onUpdate:modelValue":b[2]||(b[2]=y=>u.value.password_confirmation=y),id:"password_confirmation",classes:["block h-[50px] w-full rounded-lg bg-white dark:bg-big-stone-950a px-4 pr-16 text-lynch-500 dark:text-gray-chateau-400 placeholder:text-base placeholder:text-lynch-500 dark:placeholder:text-gray-chateau-400 border focus:outline-none autofill:shadow-[inset_0_0_0px_1000px_var(--color-white)]! dark:autofill:shadow-[inset_0_0_0px_1000px_var(--color-big-stone-950a)]! autofill:[-webkit-text-fill-color:var(--color-gray-chateau-500)] dark:autofill:[-webkit-text-fill-color:var(--color-link-water-200)]",f(l)?"border-red-500":"border-tropical-blue-200 dark:border-lynch-500 focus:border-blue-ribbon-500 dark:focus:border-dodger-blue-430"]},null,8,["modelValue","classes"]),f(l)?(o(),T(f(he),{key:0,class:"absolute right-9 top-1/2 -translate-y-1/2 w-5 h-5 text-punch-600 dark:text-tamarillo-550 pointer-events-none"})):h("",!0)]),f(l)?(o(),a("p",ht," The password field confirmation does not match. ")):h("",!0)])])]),e("div",gt,[e("button",{type:"submit",disabled:w.value||!u.value.current_password||!u.value.password||!u.value.password_confirmation||!!f(l),class:"relative flex items-center cursor-pointer justify-center rounded-lg bg-blue-ribbon-500 dark:bg-dodger-blue-430 hover:opacity-90 w-[230px] h-[42px] text-sm font-semibold text-white shadow-sm disabled:opacity-60 disabled:cursor-not-allowed"},[w.value?(o(),T(ve,{key:0,class:"h-5 w-5 text-white absolute left-4"})):h("",!0),w.value?(o(),a("span",wt,"Updating Password…")):(o(),a("span",kt,"Update Password"))],8,_t)])],32))}}),$t={class:"grid grid-cols-1 md:grid-cols-2 gap-6 items-start text-mirage-950 dar
1k:text-link-water-200"},Pt={class:"flex items-center justify-between"},St={class:"bg-tropical-blue-200/30 dark:bg-fiord-550/29 text-woodsmoke-900 dark:text-white pt-6 px-5 rounded-lg pb-8 mb-3"},Mt={class:"grid grid-cols-1 gap-4"},Dt={class:"mb-2"},jt={class:"mt-2 relative"},It={key:0,class:"absolute right-3 top-1/2 -translate-y-1/2 w-5 h-5 text-red-500 pointer-events-none",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},At={key:0,class:"text-sm text-red-500 text-left"},Bt={class:"mb-2"},Et={class:"mt-2 relative"},Tt={key:0,class:"absolute right-3 top-1/2 -translate-y-1/2 w-5 h-5 text-red-500 pointer-events-none",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},Ut={key:0,class:"text-sm text-red-500 text-left"},Vt={class:"mb-2"},zt={class:"mt-2"},Ft={key:0,class:"text-sm text-red-500 text-left"},Rt={class:"mb-2"},Nt={class:"mt-2 relative"},Yt={key:0,class:"absolute right-3 top-1/2 -translate-y-1/2 w-5 h-5 text-red-500 pointer-events-none",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},Lt={key:0,class:"text-sm text-red-500 text-left"},Ot={class:"mb-2"},Wt={class:"mt-2 relative"},Ht={key:0,class:"absolute right-3 top-1/2 -translate-y-1/2 w-5 h-5 text-red-500 pointer-events-none",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},qt={key:0,class:"text-sm text-red-500 text-left"},Kt={class:"mb-2"},Xt={class:"mt-2 relative"},Gt={key:0,class:"absolute right-3 top-1/2 -translate-y-1/2 w-5 h-5 text-red-500 pointer-events-none",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},Jt={key:0,class:"text-sm text-red-500 text-left"},Zt={class:"mb-2"},Qt={class:"mt-2 relative"},es={key:0,class:"absolute right-3 top-1/2 -translate-y-1/2 w-5 h-5 text-red-500 pointer-events-none",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},ts={key:0,class:"text-sm text-red-500 text-left"},ss={class:"mb-2"},os={class:"mt-2 relative"},ls={key:0,class:"absolute right-3 top-1/2 -translate-y-1/2 w-5 h-5 text-red-500 pointer-events-none",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},as={key:0,class:"text-sm text-red-500 text-left"},ns={class:"mb-2"},rs={class:"mt-2 relative"},is={key:0,class:"absolute right-3 top-1/2 -translate-y-1/2 w-5 h-5 text-red-500 pointer-events-none",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},ds={key:0,class:"text-sm text-red-500 text-left"},us={key:1,class:"bg-lightning-yellow-400/12 pr-3 text-grade-d p-2 rounded-lg flex items-center justify-between mb-5.5 mt-3"},cs=["disabled"],ps={key:0,class:"animate-spin h-4 w-4 text-white mr-2",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24"},ms={key:1},bs={key:2},fs={class:"text-sm text-lynch-500 dark:text-gray-chateau-400"},ys={class:"mt-6 flex flex-col-reverse sm:flex-row sm:justify-end gap-3"},vs=L({__name:"ProfileSettings",setup(v){const{notify:c}=ae(),s=Z(),m=lt(),u=s.currentUser,l=P((r=>({name:(r==null?void 0:r.name)||"",country:(r==null?void 0:r.country)||"",company_name:(r==null?void 0:r.company_name)||"",state:(r==null?void 0:r.state)||"",email:(r==null?void 0:r.email)||"",city:(r==null?void 0:r.city)||"",tax_id:(r==null?void 0:r.tax_id)||"",postal_code:(r==null?void 0:r.postal_code)||"",address:(r==null?void 0:r.address)||""}))(u)),{emailError:d,validateEmail:w}=tt(l),n=P({}),S=P(!1),b=P(!1),y=r=>{var t;return String(((t=s.currentUser)==null?void 0:t[r])??"").trim()},$=r=>String(l.value[r]??"").trim(),V=z(()=>{var r;return y("tax_id")!==""&&m.isEu(y("country"))&&(((r=s.currentUser)==null?void 0:r.tax_id_status)??null)!=="verified"}),j=()=>$("tax_id")!==y("tax_id")&&m.isEu($("country")),A=()=>$("country")!==y("country")&&(m.isEu($("country"))||m.isEu(y("country"))),W=z(()=>A()&&j()?"When you change the company's country and VAT ID, your VAT tax may change too. Are you sure about these changes?":A()?"When you change the company's country, your VAT tax may change too. Are you sure about this change?":"When you change the company's VAT ID, your VAT tax may change too. Are you sure about this change?"),X=async()=>{if(j()||A()){b.value=!0;return}await D()},B=async()=>{b.value=!1,await D()},D=async()=>{var r;S.value=!0;try{const t=await R.put("/api/user/profile",l.value);c("The personal details have been updated successfully!","success"),s.setUser(t.data)}catch(t){const k=t;((r=k.response)==null?void 0:r.status)===422&&(n.value=k.response.data.errors,c("Error updating personal details.","error"))}finally{S.value=!1}},g=Le(r=>{if(r==="company_name"||r==="tax_id"){const t=String(l.value.company_name||"").trim(),k=String(l.value.tax_id||"").trim();
1(t!==""&&k!==""||t===""&&k==="")&&(delete n.value.company_name,delete n.value.tax_id)}else String(l.value[r]||"").trim()!==""&&delete n.value[r]},50);return(r,t)=>(o(),a("div",$t,[e("form",{class:"space-y-1",onSubmit:oe(X,["prevent"])},[e("div",Pt,[C(pe,null,{default:Y(()=>[...t[20]||(t[20]=[O("Billing Information",-1)])]),_:1})]),e("div",St,[e("div",Mt,[e("div",Dt,[t[22]||(t[22]=e("div",{class:"flex items-center justify-between"},[e("label",{for:"name",class:"block text-base font-semibold"},"Name")],-1)),e("div",jt,[J(e("input",{"onUpdate:modelValue":t[0]||(t[0]=k=>l.value.name=k),id:"name",type:"text",onInput:t[1]||(t[1]=()=>f(g)("name")),class:E(["block h-[50px] w-full rounded-lg bg-white dark:bg-big-stone-950a px-4 text-base text-lynch-500 dark:text-gray-chateau-400 placeholder:text-lynch-500 dark:placeholder:text-gray-chateau-400 border focus:outline-none autofill:shadow-[inset_0_0_0px_1000px_var(--color-white)]! dark:autofill:shadow-[inset_0_0_0px_1000px_var(--color-big-stone-950a)]! autofill:[-webkit-text-fill-color:var(--color-gray-chateau-500)] dark:autofill:[-webkit-text-fill-color:var(--color-link-water-200)]",n.value.name?"border-red-500 pr-10":"border-tropical-blue-200 dark:border-lynch-500 focus:border-blue-ribbon-500 dark:focus:border-dodger-blue-430"])},null,34),[[te,l.value.name]]),n.value.name?(o(),a("svg",It,[...t[21]||(t[21]=[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M12 9v2m0 4h.01M12 5a7 7 0 1 1 0 14a7 7 0 0 1 0-14z"},null,-1)])])):h("",!0)]),n.value.name?(o(),a("p",At,_(n.value.name[0]),1)):h("",!0)]),e("div",Bt,[t[24]||(t[24]=e("div",{class:"flex items-center justify-between"},[e("label",{for:"email",class:"block text-base font-semibold"},"Email")],-1)),e("div",Et,[J(e("input",{"onUpdate:modelValue":t[2]||(t[2]=k=>l.value.email=k),id:"email",type:"text",onInput:t[3]||(t[3]=(...k)=>f(w)&&f(w)(...k)),onBlur:t[4]||(t[4]=(...k)=>f(w)&&f(w)(...k)),class:E(["block h-[50px] w-full rounded-lg bg-white dark:bg-big-stone-950a px-4 text-base text-lynch-500 dark:text-gray-chateau-400 placeholder:text-lynch-500 dark:placeholder:text-gray-chateau-400 border focus:outline-none autofill:shadow-[inset_0_0_0px_1000px_var(--color-white)]! dark:autofill:shadow-[inset_0_0_0px_1000px_var(--color-big-stone-950a)]! autofill:[-webkit-text-fill-color:var(--color-gray-chateau-500)] dark:autofill:[-webkit-text-fill-color:var(--color-link-water-200)]",f(d)||n.value.email?"border-red-500 pr-10":"border-tropical-blue-200 dark:border-lynch-500 focus:border-blue-ribbon-500 dark:focus:border-dodger-blue-430"])},null,34),[[te,l.value.email]]),f(d)||n.value.email?(o(),a("svg",Tt,[...t[23]||(t[23]=[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M12 9v2m0 4h.01M12 5a7 7 0 1 1 0 14a7 7 0 0 1 0-14z"},null,-1)])])):h("",!0)]),f(d)||n.value.email?(o(),a("p",Ut,_(n.value.email?n.value.email[0]:"Invalid email address."),1)):h("",!0)]),e("div",Vt,[t[25]||(t[25]=e("div",{class:"flex items-center justify-between"},[e("label",{for:"country",class:"block text-base font-semibold"},"Country")],-1)),e("div",zt,[C(at,{modelValue:l.value.country,"onUpdate:modelValue":[t[5]||(t[5]=k=>l.value.country=k),t[6]||(t[6]=()=>f(g)("country"))],id:"country",hasError:!!n.value.country},null,8,["modelValue","hasError"])]),n.value.country?(o(),a("p",Ft,_(n.value.country[0]),1)):h("",!0)]),e("div",Rt,[t[27]||(t[27]=e("div",{class:"flex items-center justify-between"},[e("label",{for:"address",class:"block text-base font-semibold"},"Address")],-1)),e("div",Nt,[J(e("input",{"onUpdate:modelValue":t[7]||(t[7]=k=>l.value.address=k),id:"address",type:"text",class:E(["block h-[50px] w-full rounded-lg bg-white dark:bg-big-stone-950a px-4 text-base text-lynch-500 dark:text-gray-chateau-400 placeholder:text-lynch-500 dark:placeholder:text-gray-chateau-400 border focus:outline-none autofill:shadow-[inset_0_0_0px_1000px_var(--color-white)]! dark:autofill:shadow-[inset_0_0_0px_1000px_var(--color-big-stone-950a)]! autofill:[-webkit-text-fill-color:var(--color-gray-chateau-500)] dark:autofill:[-webkit-text-fill-color:var(--color-link-water-200)]",n.value.address?"border-red-500 pr-10":"border-tropical-blue-200 dark:border-lynch-500 focus:border-blue-ribbon-500 dark:focus:border-dodger-blue-430"])},null,2),[[te,l.value.address]]),n.value.address?(o(),a("svg",Yt,[...t[26]||(t[26]=[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M12 9v2m0 4h.01M12 5a7 7 0 1 1 0 14a7 7 0 0 1 0-14z"},null,-1)])])):h("",!0)]),n.value.address?(o(),a("p",Lt,_(n.value.address[0]),1)):h("",!0)]),e("div",Ot,[t[29]||(t[29]=e("div",{class:"flex items-center justify-between"},[e("label",{for:"city",class:"block text-base font-semibold"},"City")],-1)),e("div",Wt,[J(e("input",{"onUpdate:modelValue":t[8]||(t[8]=k=>l.value.city=k),id:"city",type:"text",onInput:t[9]||(t[9]=()=>f(g)("city")),class:E(["block h-[50px] w-full rounded-lg bg-white dark:bg-big-stone-950a px-4 text-base text-lynch-500 dark:text-gray-chateau-400 placeholder:text-lynch-500 dark:placeholder:text-gray-chateau-400 border focus:outline-none autofill:shadow-[inset_0_0_0px_1000px_var(--color-white)]! dark:autofill:shadow-[inset_0_0_0px_1000px_var(--color-big-stone-950a)]! autofill:[-webkit-text-fill-color:var(--color-gray-chateau-500)] dark:autofill:[-webkit-text-fill-color:var(--color-link-water-200)]",n.value.city?"border-red-500 pr-10":"border-tropical-blue-200 dark:border-lynch-500 focus:border-blue-ribbon-500 dark:focus:border-dodger-blue-430"])},null,34),[[te,l.value.city]]),n.value.city?(o(),a("svg",Ht,[...t[28]||(t[28]=[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M12 9v2m0 4h.01M12 5a7 7 0 1 1 0 14a7 7 0 0 1 0-14z"},null,-1)])])):h("",!0)]),n.value.city?(o(),a("p",qt,_(n.value.city[0]),1)):h("",!0)]),e("div",Kt,[t[31]||(t[31]=e("div",{class:"flex items-center justify-between"},[e("label",{for:"state",class:"block text-base font-semibold"},"State")],-1)),e("div",Xt,[J(e("input",{"onUpdate:modelValue":t[10]||(t[10]=k=>l.value.state=k),id:"state",type:"text",onInput:t[11]||(t[11]=()=>f(g)("state")),class:E(["block h-[50px] w-full rounded-lg bg-white dark:bg-big-stone-950a px-4 text-base text-lynch-500 dark:text-gray-chateau-400 placeholder:text-lynch-500 dark:placeholder:text-gray-chateau-400 border focus:outline-none autofill:shadow-[inset_0_0_0px_1000px_var(--color-white)]! dark:autofill:shadow-[inset_0_0_0px_1000px_var(--color-big-stone-950a)]! autofill:[-webkit-text-fill-color:var(--color-gray-chateau-500)] dark:autofill:[-webkit-text-fill-color:var(--color-link-water-200)]",n.value.state?"border-red-500 pr-10":"border-tropical-blue-200 dark:border-lynch-500 focus:border-blue-ribbon-500 dark:focus:border-dodger-blue-430"])},null,34),[[te,l.value.state]]),n.value.state?(o(),a("svg",Gt,[...t[30]||(t[30]=[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M12 9v2m0 4h.01M12 5a7 7 0 1 1 0 14a7 7 0 0 1 0-14z"},null,-1)])])):h("",!0)]),n.value.state?(o(),a("p",Jt,_(n.value.state[0]),1)):h("",!0)]),e("div",Zt,[t[33]||(t[33]=e("div",{class:"flex items-center justify-between"},[e("label",{for:"postal_code",class:"block text-base font-semibold"},"Postal Code")],-1)),e("div",Qt,[J(e("input",{"onUpdate:modelValue":t[12]||(t[12]=k=>l.value.postal_code=k),id:"postal_code",type:"text",onInput:t[13]||(t[13]=()=>f(g)("postal_code")),class:E(["block h-[50px] w-full rounded-lg bg-white dark:bg-big-stone-950a px-4 text-base text-lynch-500 dark:text-gray-chateau-400 placeholder:text-lynch-500 dark:placeholder:text-gray-chateau-400 border focus:outline-none autofill:shadow-[inset_0_0_0px_1000px_var(--color-white)]! dark:autofill:shadow-[inset_0_0_0px_1000px_var(--color-big-stone-950a)]! autofill:[-webkit-text-fill-color:var(--color-gray-chateau-500)] dark:autofill:[-webkit-text-fill-color:var(--color-link-water-200)]",n.value.postal_code?"border-red-500 pr-10":"border-tropical-blue-200 dark:border-lynch-500 focus:border-blue-ribbon-500 dark:focus:border-dodger-blue-430"])},null,34),[[te,l.value.postal_code]]),n.value.postal_code?(o(),a("svg",es,[...t[32]||(t[32]=[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M12 9v2m0 4h.01M12 5a7 7 0 1 1 0 14a7 7 0 0 1 0-14z"},null,-1)])])):h("",!0)]),n.value.postal_code?(o(),a("p",ts,_(n.value.postal_code[0]),1)):h("",!0)]),e("div",ss,[t[35]||(t[35]=e("div",{class:"flex items-center justify-between"},[e("label",{for:"company_name",class:"block text-base font-semibold"},"Company")],-1)),e("div",os,[J(e("input",{"onUpdate:modelValue":t[14]||(t[14]=k=>l.value.company_name=k),id:"company_name",type:"text",onInput:t[15]||(t[15]=()=>f(g)("company_name")),class:E(["block h-[50px] w-full rounded-lg bg-white dark:bg-big-stone-950a px-4 text-base text-lynch-500 dark:text-gray-chateau-400 placeholder:text-lynch-500 dark:placeholder:text-gray-chateau-400 border focus:outline-none autofill:shadow-[inset_0_0_0px_1000px_var(--color-white)]! dark:autofill:shadow-[inset_0_0_0px_1000px_var(--color-big-stone-950a)]! autofill:[-webkit-text-fill-color:var(--color-gray-chateau-500)] dark:autofill:[-webkit-text-fill-color:var(--color-link-water-200)]",n.value.company_name?"border-red-500 pr-10":"border-tropical-blue-200 dark:border-lynch-500 focus:border-blue-ribbon-500 dark:focus:border-dodger-blue-430"])},null,34),[[te,l.value.company_name]]),n.value.company_name?(o(),a("svg",ls,[...t[34]||(t[34]=[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M12 9v2m0 4h.01M12 5a7 7 0 1 1 0 14a7 7 0 0 1 0-14z"},null,-1)])])):h("",!0)]),n.value.company_name?(o(),a("p",as,_(n.value.company_name[0]),1)):h("",!0)]),e("div",ns,[t[38]||(t[38]=e("div",{class:"flex items-center justify-between"},[e("label",{for:"tax_id",class:"block text-base font-semibold"},"Tax ID")],-1)),e("div",rs,[J(e("input",{"onUpdate:modelValue":t[16]||(t[16]=k=>l.value.tax_id=k),id:"tax_id",type:"text",onInput:t[17]||(t[17]=()=>f(g)("tax_id")),class:E(["block h-[50px] w-full rounded-lg bg-white dark:bg-big-stone-950a px-4 text-base text-lynch-500 dark:text-gray-chateau-400 placeholder:text-lynch-500 dark:placeholder:text-gray-chateau-400 border focus:outline-none autofill:shadow-[inset_0_0_0px_1000px_var(--color-white)]! dark:autofill:shadow-[inset_0_0_0px_1000px_var(--color-big-stone-950a)]! autofill:[-webkit-text-fill-color:var(--color-gray-chateau-500)] dark:autofill:[-webkit-text-fill-color:var(--color-link-water-200)]",n.value.tax_id?"border-red-500 pr-10":"border-tropical-blue-200 dark:border-lynch-500 focus:border-blue-ribbon-500 dark:focus:border-dodger-blue-430"])},null,34),[[te,l.value.tax_id]]),n.value.tax_id?(o(),a("svg",is,[...t[36]||(t[36]=[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M12 9v2m0 4h.01M12 5a7 7 0 1 1 0 14a7 7 0 0 1 0-14z"},null,-1)])])):h("",!0)]),n.value.tax_id?(o(),a("p",ds,_(n.value.tax_id[0]),1)):h("",!0),V.value?(o(),a("div",us,[...t[37]||(t[37]=[fe('<div class="flex items-center space-x-3 pl-1"><div class="w-8.5 h-8.5 bg-grade-d rounded-md flex items-center justify-center"><svg class="icon w-5 h-5 text-white" viewBox="0 0 1024 1024" fill="currentColor" width="1em" height="1em" xmlns="http://www.w3.org/2000/svg"><path d="M464 720a48 48 0 1 0 96 0 48 48 0 1 0-96 0zm16-304v184c0 4.4 3.6 8 8 8h48c4.4 0 8-3.6 8-8V416c0-4.4-3.6-8-8-8h-48c-4.4 0-8 3.6-8 8zm475.7 440-416-720c-6.2-10.7-16.9-16-27.7-16s-21.6 5.3-27.7 16l-416 720C56 877.4 71.4 904 96 904h832c24.6 0 40-26.6 27.7-48zm-783.5-27.9L512 239.9l339.8 588.2z"></path></svg></div><span class="font-medium"> Your Tax ID is not verified yet. Check it, and if need update as well. </span></div>',1)])])):h("",!0)])])]),e("button",{type:"submit",disabled:S.value,class:"relative cursor-pointer flex items-center justify-center rounded-lg bg-blue-ribbon-500 dark:bg-dodger-blue-430 hover:opacity-90 w-[230px] h-[42px] text-sm font-semibold text-white shadow-sm disabled:opacity-60"},[S.value?(o(),a("svg",ps,[...t[39]||(t[39]=[e("circle",{class:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor","stroke-width":"4"},null,-1),e("path",{class:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8v4a4 4 0 00-4 4H4z"},null,-1)])])):h("",!0),S.value?(o(),a("span",bs,"Updating Details…")):(o(),a("span",ms,"Upd
1ate Details"))],8,cs)],32),C(ie,{"is-open":b.value,"title-icon":f(ye),"background-icon-title":"w-12 h-12 bg-punch-600/10 rounded-lg flex items-center justify-center flex-shrink-3","class-title-icon":"text-punch-600 h-6 w-6 font-black",title:"This may change your VAT tax","border-color-under-title":"bg-punch-600",onClose:t[19]||(t[19]=k=>b.value=!1)},{contentModal:Y(()=>[e("p",fs,_(W.value),1),e("div",ys,[e("button",{type:"button",onClick:t[18]||(t[18]=k=>b.value=!1),class:"inline-flex justify-center items-center h-[42px] px-5 text-sm font-semibold rounded-lg border border-tropical-blue-200 dark:border-lynch-500 cursor-pointer hover:opacity-80"}," Cancel "),e("button",{type:"button",onClick:B,class:"inline-flex justify-center items-center h-[42px] px-5 text-sm font-semibold rounded-lg text-white bg-blue-ribbon-500 dark:bg-dodger-blue-430 cursor-pointer hover:opacity-90"}," Continue anyway ")])]),_:1},8,["is-open","title-icon"]),e("div",null,[C(pe,null,{default:Y(()=>[...t[40]||(t[40]=[O("Change Password",-1)])]),_:1}),C(Ct)])]))}});function Ee(){return{convertToCents:c=>{if(typeof c!="number"||c<0)throw new RangeError("Cannot convert null or negative number to cents.");return Math.round(c*100)}}}const xs={class:"text-base font-semibold mb-2"},hs={class:"flex items-center my-4"},gs={class:"mb-4"},_s={class:"mb-4"},ks={key:0,class:"mt-2 text-sm text-punch-600 dark:text-cinnabar-600 flex items-center"},ws={class:"flex justify-center gap-3 mt-6"},Cs=["disabled"],$s=["disabled"],Ps=L({__name:"NewPaymentMethod",emits:["payment-method-added","close"],setup(v,{emit:c}){const s=Z(),{notify:m}=ae(),{convertToCents:u}=Ee(),M=c,l=P(!1),d=P(""),w=P(!1),n=P(""),S=P(!1),b=le(null),y=le(null),$=le(null),V=le(null),j=P(!1),A=P(!1),W=async()=>{try{b.value=await Be("pk_live_51TeHXNAbMsbYcEXov1gHwWxKz4vX1Gy4HPd6tegxq8lKjYCM1Mhu7CEVhqjuaI2eRXJCfW8gOxCIAndSnWDzaf6r00cI7mX6Tw")}catch{m("Failed to load payment processor.","error")}},X=()=>{var p;if(!b.value||A.value)return;const x=s.subscription?u(s.subscription.next_bill_amount):re[1].price;V.value=b.value.elements({mode:"subscription",currency:"usd",amount:x,setupFutureUsage:"off_session",appearance:{variables:{borderRadius:"8px"}}}),$.value=V.value.create("expressCheckout",{buttonType:{applePay:"plain",googlePay:"plain"},buttonTheme:{applePay:"black",googlePay:"black"},layout:{maxColumns:1,overflow:"never"}}),(p=$.value)==null||p.mount("#express-checkout-element-payment"),$.value.on("ready",i=>{j.value=i.availablePaymentMethods?Object.keys(i.availablePaymentMethods).length>0:!1}),$.value.on("confirm",async()=>{l.value=!0;try{const I=(await R.get("/api/payment/setup-intent")).data.intent.client_secret,{error:F,setupIntent:U}=await b.value.confirmSetup({elements:V.value,clientSecret:I,confirmParams:{return_url:window.location.href},redirect:"if_required"});F?(m(F.message||"Payment failed","error"),g(F.message||"Payment failed"),l.value=!1):U&&U.payment_method&&await k(U.payment_method)}catch(i){m("Payment processing failed","error"),g("Payment processing failed"),l.value=!1,console.error(i)}}),A.value=!0},B=()=>{const x=document.documentElement.classList.contains("dark"),p=w.value?"#dc2626":x?"#9aa0a9":"#64748b";return{base:{color:p,fontFamily:'"Urbanist", ui-sans-serif, system-ui, sans-serif',fontSize:"15px",fontWeight:"300","::placeholder":{color:p,fontWeight:"300"}},invalid:{color:"#E83D3D"}}},D=()=>{if(!b.value){m("Can't initialize the payment processor.","error");return}const x=b.value.elements({locale:"en"}),p={hidePostalCode:!0,style:B(),classes:{base:"w-full"}};y.value=x.create("card",p),y.value.mount("#card-element-payment"),y.value.on("change",i=>{(w.value||n.value)&&r(),i.error&&g(i.error.message)}),y.value.on("focus",()=>{S.value=!0,(w.value||n.value)&&r()}),y.value.on("blur",()=>{S.value=!1})},g=x=>{w.value=!0,n.value=x,t()},r=()=>{w.value=!1,n.value="",t()},t=()=>{y.value&&y.value.update({style:B()})},k=async x=>{var p,i,I;try{(await R.post("/api/subscription/payment-method",{payment_method_id:x})).data.success===!0&&(m("Successfully added your payment method","success"),d.value="",(p=y.value)==null||p.clear(),r(),M("close"),M("payment-method-added")),l.value=!1}catch(F){const U=((I=(i=F==null?void 0:F.response)==null?void 0:i.data)==null?void 0:I.message)||"Failed to add payment method";g(U),l.value=!1}},G=async()=>
1{if(!b.value||!y.value){g("Payment processor not available.");return}l.value=!0;try{const p=(await R.get("/api/payment/setup-intent")).data.intent.client_secret,i=await b.value.confirmCardSetup(p,{payment_method:{card:y.value,billing_details:{name:d.value}}});i.error?(g(i.error.message||"Payment failed"),l.value=!1):i.setupIntent&&i.setupIntent.payment_method?await k(i.setupIntent.payment_method):(g("Problem connecting with Stripe."),l.value=!1)}catch{g("Payment processing failed"),l.value=!1}};let N=!0;return be(async()=>{await W(),N&&b.value&&(X(),D())}),Ie(()=>{var x,p;N=!1,(x=y.value)==null||x.unmount(),y.value=null,(p=$.value)==null||p.unmount(),$.value=null}),(x,p)=>(o(),a(H,null,[e("div",{class:E(j.value?"mb-4":"")},[J(e("label",xs," Payment options ",512),[[ke,j.value]]),p[3]||(p[3]=e("div",{id:"express-checkout-element-payment",class:"mt-2 min-h-[88px]"},null,-1)),J(e("div",hs,[...p[2]||(p[2]=[e("div",{class:"flex-grow border-t border-alabaster-300"},null,-1),e("span",{class:"px-4 text-sm text-gray-500"},"or",-1),e("div",{class:"flex-grow border-t border-alabaster-300"},null,-1)])],512),[[ke,j.value]])],2),e("form",{onSubmit:oe(G,["prevent"]),class:"text-woodsmoke-900 dark:text-white"},[e("div",gs,[p[4]||(p[4]=e("label",{for:"card-holder-name",class:"text-base font-semibold mb-2"}," Card holder name ",-1)),J(e("input",{id:"card-holder-name",placeholder:"Enter card holder name","onUpdate:modelValue":p[0]||(p[0]=i=>d.value=i),type:"text",required:"",class:"w-full px-4 mt-2 py-3 placeholder:text-base text-lynch-500 dark:text-gray-chateau-400 placeholder:text-lynch-500 dark:placeholder:text-gray-chateau-400 border border-tropical-blue-200 bg-white dark:bg-big-stone-950a dark:border-lynch-500 rounded-lg focus:outline-none focus:border-blue-ribbon-500 dark:focus:border-dodger-blue-430 autofill:shadow-[inset_0_0_0px_1000px_var(--color-white)]! dark:autofill:shadow-[inset_0_0_0px_1000px_var(--color-big-stone-950a)]! autofill:[-webkit-text-fill-color:var(--color-gray-chateau-500)] dark:autofill:[-webkit-text-fill-color:var(--color-link-water-200)]"},null,512),[[te,d.value]])]),e("div",_s,[p[5]||(p[5]=e("label",{for:"card-element-payment",class:"text-base font-semibold mb-2"},"Card number",-1)),e("div",{id:"card-element-payment",class:E(["mt-2 w-full border rounded-lg bg-white dark:bg-big-stone-950a px-4 h-[50px] pt-[13px]",w.value?"border-punch-500 dark:border-cinnabar-500 bg-red-50":S.value?"border-blue-ribbon-500 dark:border-dodger-blue-430":"border-tropical-blue-200 dark:border-lynch-500"])},null,2),n.value?(o(),a("div",ks,[C(f(Oe),{class:"w-4 h-4 mr-1"}),O(" "+_(n.value),1)])):h("",!0)]),e("div",ws,[e("button",{type:"button",disabled:l.value,onClick:p[1]||(p[1]=i=>l.value?null:x.$emit("close")),class:"cursor-pointer inline-flex flex-1 items-center justify-center rounded-lg bg-white px-3 py-3 text-sm font-semibold text-lynch-500 shadow-xs ring-1 ring-lynch-500 hover:bg-gray-50 disabled:opacity-50 disabled:cursor-not-allowed"}," Cancel ",8,Cs),e("button",{disabled:l.value,onClick:G,type:"submit",class:"relative cursor-pointer inline-flex flex-1 items-center justify-center rounded-lg bg-blue-ribbon-500 dark:bg-dodger-blue-430 hover:opacity-90 px-3 py-3 text-sm font-semibold text-white focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-blue-ribbon-500 dark:focus-visible:outline-dodger-blue-430 disabled:opacity-60 disabled:cursor-not-allowed"},[l.value?(o(),T(ne,{key:0})):h("",!0),O(" "+_(l.value?"Loading...":"Add Card"),1)],8,$s)])],32)],64))}}),Ss={width:"355",height:"180",viewBox:"0 0 355 180",fill:"none",xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink"},Ms="/images/default-card-bg.png",Te=L({__name:"DefaultCard",setup(v){return(c,s)=>(o(),a("svg",Ss,[s[1]||(s[1]=fe('<rect width="355" height="180" rx="15" fill="#38A2FF"></rect><g opacity="0.3"><mask id="mask0_40007217_8198" style="mask-type:alpha;" maskUnits="userSpaceOnUse" x="0" y="0" width="355" height="180"><path d="M0 15C0 6.71572 6.71573 0 15 0H340C348.284 0 355 6.71573 355 15V165C355 173.284 348.284 180 340 180H15C6.71572 180 0 173.284 0 165V15Z" fill="white"></path></mask><g mask="url(#mask0_40007217_8198)"><g opacity="0.66" style="mix-blend-mode:color-burn;"><rect x="-1" y="-9.75879" width="356" height="198.434" fill="url(#pattern0_40007217_8198)"></rect></g></g></g><rect x="298" y="20" width="37" height="24" rx="5" fill="url(#paint0_linear_40007217_8198)" stroke="#A07400" stroke-width="0.5"></rect><rect x="324.068" y="20" width="24" height="15.1364" rx="7.56818" transform="rotate(90 324.068 20)" stroke="#A07400" stroke-width="0.5"></rect><line x1="324.318" y1="27.25" x2="334.75" y2="27.25" stroke="#A07400" stroke-width="0.5" stroke-linecap="round"></line>
1<line x1="334.75" y1="36.75" x2="324.318" y2="36.75" stroke="#A07400" stroke-width="0.5" stroke-linecap="round"></line><line x1="298.25" y1="27.25" x2="308.682" y2="27.25" stroke="#A07400" stroke-width="0.5" stroke-linecap="round"></line><line x1="308.682" y1="36.75" x2="298.25" y2="36.75" stroke="#A07400" stroke-width="0.5" stroke-linecap="round"></line>',8)),e("defs",null,[s[0]||(s[0]=fe('<pattern id="pattern0_40007217_8198" patternContentUnits="objectBoundingBox" width="1" height="1"><use xlink:href="#image0_40007217_8198" transform="matrix(0.000563598 0 0 0.00101112 -0.0410538 0)"></use></pattern><linearGradient id="paint0_linear_40007217_8198" x1="298" y1="20" x2="333.193" y2="46.4087" gradientUnits="userSpaceOnUse"><stop stop-color="#DAAA00"></stop><stop offset="0.510417" stop-color="#FFF9CF"></stop><stop offset="1" stop-color="#F0CA00"></stop></linearGradient>',2)),e("image",{id:"image0_40007217_8198",width:"1920",height:"989",preserveAspectRatio:"none","xlink:href":Ms})])]))}}),Ds={},js={width:"355",height:"180",viewBox:"0 0 355 180",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function Is(v,c){return o(),a("svg",js,[...c[0]||(c[0]=[fe('<rect width="355" height="180" rx="15" fill="#484BFE"></rect><g opacity="0.3"><mask id="mask0_40007217_8216" style="mask-type:alpha;" maskUnits="userSpaceOnUse" x="0" y="0" width="355" height="180"><path d="M0 15C0 6.71572 6.71573 0 15 0H340C348.284 0 355 6.71573 355 15V165C355 173.284 348.284 180 340 180H15C6.71572 180 0 173.284 0 165V15Z" fill="#080307"></path></mask><g mask="url(#mask0_40007217_8216)"><g opacity="0.66" style="mix-blend-mode:color-burn;"><rect x="-1" y="-9.75879" width="356" height="198.434" fill="#080307"></rect></g></g></g><rect x="298" y="20" width="37" height="24" rx="5" fill="url(#paint0_linear_40007217_8216)" stroke="#A07400" stroke-width="0.5"></rect><rect x="324.068" y="20" width="24" height="15.1364" rx="7.56818" transform="rotate(90 324.068 20)" stroke="#A07400" stroke-width="0.5"></rect><line x1="324.318" y1="27.25" x2="334.75" y2="27.25" stroke="#A07400" stroke-width="0.5" stroke-linecap="round"></line><line x1="334.75" y1="36.75" x2="324.318" y2="36.75" stroke="#A07400" stroke-width="0.5" stroke-linecap="round"></line><line x1="298.25" y1="27.25" x2="308.682" y2="27.25" stroke="#A07400" stroke-width="0.5" stroke-linecap="round"></line><line x1="308.682" y1="36.75" x2="298.25" y2="36.75" stroke="#A07400" stroke-width="0.5" stroke-linecap="round"></line><defs><linearGradient id="paint0_linear_40007217_8216" x1="298" y1="20" x2="333.193" y2="46.4087" gradientUnits="userSpaceOnUse"><stop stop-color="#DAAA00"></stop><stop offset="0.510417" stop-color="#FFF9CF"></stop><stop offset="1" stop-color="#F0CA00"></stop></linearGradient></defs>',9)])])}const Ue=nt(Ds,[["render",Is]]),Ve="/build/assets/Bn9tHLRV.svg",ze="/build/assets/49mo3XKL.svg",As={class:"flex justify-center"},Bs={class:"relative w-full max-w-[320px] aspect-520/313"},Es={class:"absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 font-bold leading-tight text-white text-xl"},Ts={class:"absolute bottom-[8%] right-[5%]"},Us=["src"],Vs=["src"],zs={key:2,class:"uppercase leading-tight text-white text-xl"},Fe=L({__name:"SelectedCard",props:{paymentMethod:{}},setup(v){return(c,s)=>(o(),a("div",null,[e("div",As,[e("div",Bs,[v.paymentMethod.default?(o(),T(Te,{key:0,class:"absolute inset-0 w-full h-full"})):(o(),T(Ue,{key:1,class:"absolute inset-0 w-full h-full"})),e("p",Es," **** **** **** "+_(v.paymentMethod.card.last4),1),e("div",Ts,[v.paymentMethod.card.brand==="mastercard"?(o(),a("img",{key:0,src:f(Ve),alt:"Mastercard",class:"h-7"},null,8,Us)):v.paymentMethod.card.brand==="visa"?(o(),a("img",{key:1,src:f(ze),alt:"Visa",class:"h-7"},null,8,Vs)):(o(),a("span",zs,_(v.paymentMethod.card.brand),1))])])])]))}}),Fs={class:"space-y-4"},Rs={key:0,class:"relative bg-gray-50 dark:bg-pickled-bluewood-800 p-4 rounded-lg"},Ns={key:0,class:"absolute top-2 right-2 inline-flex items-center px-1.5 py-0.5 rounded-lg text-xs font-semibold bg-blue-ribbon-500/8 dark:bg-dodger-blue-430/20 text-blue-ribbon-500 dark:text-dodger-blue-430"},Ys={class:"flex justify-center space-x-3 pt-4"},Ls=["disabled"],Os=["disabled"],Ws=L({__name:"DeletePaymentMethodConfirmation",props:{paymentMethod:{},isDeleting:{type:Boolean}},emits:["cancel","confirm"],setup(v){return(c,s)=>(o(),a("div",Fs,[s[2]||(s[2]=e("p",{class:"text-base text-mirage-950 dar
1k:text-white"}," Are you sure you want to remove this payment method? ",-1)),v.paymentMethod?(o(),a("div",Rs,[v.paymentMethod.default?(o(),a("span",Ns," Default ")):h("",!0),C(Fe,{"payment-method":v.paymentMethod},null,8,["payment-method"])])):h("",!0),s[3]||(s[3]=e("p",{class:"text-sm text-gray-600 dark:text-white"},"This action cannot be undone.",-1)),e("div",Ys,[e("button",{type:"button",onClick:s[0]||(s[0]=m=>c.$emit("cancel")),disabled:v.isDeleting,class:"cursor-pointer inline-flex flex-1 items-center justify-center rounded-lg bg-white px-3 py-3 text-sm font-semibold text-lynch-500 shadow-xs ring-1 ring-lynch-500 hover:bg-gray-50 disabled:opacity-50 disabled:cursor-not-allowed"}," Cancel ",8,Ls),e("button",{type:"button",onClick:s[1]||(s[1]=m=>c.$emit("confirm")),disabled:v.isDeleting,class:"relative cursor-pointer inline-flex flex-1 items-center justify-center rounded-lg bg-punch-600 hover:opacity-90 px-3 py-3 text-sm font-semibold text-white focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-punch-600 disabled:opacity-60 disabled:cursor-not-allowed"},[v.isDeleting?(o(),T(ne,{key:0})):h("",!0),O(" "+_(v.isDeleting?"Removing...":"Remove"),1)],8,Os)])]))}}),Hs={key:0,class:"space-y-4 text-dodger-blue-400b dark:text-white"},qs={key:0},Ks={key:1,class:"text-base"},Xs={class:"relative bg-tropical-blue-200/25 dark:bg-pickled-bluewood-800 text-blue-ribbon-500 dark:text-dodger-blue-430 p-4 rounded-lg py-10"},Gs={key:0,class:"absolute top-2 right-2 inline-flex items-center px-1.5 py-0.5 rounded-lg text-xs font-semibold bg-blue-ribbon-500/8 dark:bg-dodger-blue-430/20 text-blue-ribbon-500 dark:text-dodger-blue-430"},Js={class:"flex justify-center space-x-3 pt-4"},Zs=["disabled"],Qs=["disabled"],eo={key:1,class:"text-center text-gray-500"},to=L({__name:"SetDefaultPaymentMethodConfirmation",props:{paymentMethod:{},isSetDefault:{type:Boolean}},emits:["cancel","confirm"],setup(v){return(c,s)=>v.paymentMethod?(o(),a("div",Hs,[v.paymentMethod.default?(o(),a("p",qs,"This card is currently set as your default payment method.")):(o(),a("p",Ks,"Are you sure you want to set as default this payment method?")),e("div",Xs,[v.paymentMethod.default?(o(),a("span",Gs," Default ")):h("",!0),C(Fe,{"payment-method":v.paymentMethod},null,8,["payment-method"])]),e("div",Js,[e("button",{type:"button",onClick:s[0]||(s[0]=m=>c.$emit("cancel")),disabled:v.isSetDefault,class:"cursor-pointer inline-flex flex-1 items-center justify-center rounded-lg bg-white px-3 py-3 text-sm font-semibold text-lynch-500 shadow-xs ring-1 ring-lynch-500 hover:bg-gray-50 disabled:opacity-50 disabled:cursor-not-allowed"}," Cancel ",8,Zs),e("button",{type:"button",onClick:s[1]||(s[1]=m=>v.paymentMethod.default?null:c.$emit("confirm")),disabled:v.isSetDefault||v.paymentMethod.default,class:"relative cursor-pointer inline-flex flex-1 items-center justify-center rounded-lg bg-blue-ribbon-500 dark:bg-dodger-blue-430 hover:opacity-90 px-3 py-3 text-sm font-semibold text-white focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-blue-ribbon-500 dark:focus-visible:outline-dodger-blue-430 disabled:opacity-60 disabled:cursor-not-allowed"},[v.isSetDefault?(o(),T(ne,{key:0})):h("",!0),O(" "+_(v.isSetDefault?"Loading...":"Confirm"),1)],8,Qs)])])):(o(),a("div",eo,"No payment method selected."))}}),so={class:"flex items-center justify-between mb-2"},oo={class:"text-left"},lo={class:"text-right"},ao={class:"bg-tropical-blue-200/30 dark:bg-fiord-550/29 p-2 max-lg:p-0 rounded-lg text-base font-normal text-mirage-950 dark:text-white"},no={key:0,class:"flex justify-center items-center py-8"},ro=["onClick"],io={key:0,class:"absolute top-2 right-2"},uo={class:"flex justify-center mx-4 my-4 mt-2"},co={class:"absolute bottom-[8%] right-[5%]"},po=["src"],mo=["src"],bo={class:"flex justify-center"}
1,fo=["onClick"],yo={key:2,class:"flex flex-col gap-4 rounded-b-lg py-8"},vo=L({__name:"PaymentMethods",setup(v){const{notify:c}=ae(),s=Z(),m=ee(),u=ee(),M=ee(),l=P(!1),d=P(!1),w=P(!1),n=P(null),S=P(null),b=z(()=>s.paymentMethods||[]),y=()=>{m.openDialog()},$=async()=>{await X()},V=B=>{n.value=B,u.openDialog()},j=async()=>{if(n.value){d.value=!0;try{await R.delete(`/api/subscription/payment-method/${n.value.id}`),await $(),c("Payment method removed successfully","success"),u.closeDialog(),n.value=null}catch{c("Failed to remove payment method","error")}finally{d.value=!1}}},A=B=>{S.value=B,M.openDialog()},W=async()=>{if(S.value){w.value=!0;try{await R.patch("/api/subscription/payment-method/",{payment_method_id:S.value.id}),await $(),c("Payment method successfully set as default.","success"),M.closeDialog(),S.value=null}catch{c("Failed to set default payment method.","error")}finally{w.value=!1}}},X=async()=>{l.value=!0;try{await s.getPaymentMethods()}catch{c("Failed to fetch payment methods.","error")}finally{l.value=!1}};return be(async()=>{await X()}),(B,D)=>(o(),a(H,null,[e("div",so,[e("div",oo,[C(pe,null,{default:Y(()=>[...D[1]||(D[1]=[O("Payment Details",-1)])]),_:1})]),e("div",lo,[e("button",{type:"button",onClick:oe(y,["prevent"]),class:"cursor-pointer flex items-center justify-center rounded-lg bg-blue-ribbon-500 dark:bg-dodger-blue-430 hover:opacity-90 w-[166px] h-[42px] max-[430px]:w-40 max-[430px]:mx-3 text-sm font-semibold text-white shadow-sm disabled:opacity-60"}," New Payment Method ")])]),e("div",ao,[l.value?(o(),a("div",no,[C(ve,{classColor:"w-15 h-15 text-blue-ribbon-500 dark:text-dodger-blue-430"})])):b.value&&b.value.length>0?(o(),a("div",{key:1,class:E(["grid max-xl:grid-cols-1 gap-4 pr-2 py-2 ml-3",b.value.length===1?"grid-cols-1":"grid-cols-2"])},[(o(!0),a(H,null,me(b.value,g=>(o(),a("div",{key:g.id,class:E(["relative bg-tropical-blue-200/25 group rounded-lg px-2 py-7 min-w-[200px] dark:bg-pickled-bluewood-800",[b.value.length>1?"cursor-pointer":""]]),onClick:oe(r=>b.value.length>1?A(g):null,["prevent"])},[g.default?(o(),a("div",io,[...D[2]||(D[2]=[e("span",{class:"inline-flex items-center px-1.5 py-0.5 rounded-md text-xs font-semibold bg-blue-ribbon-500/8 dark:bg-dodger-blue-430/20 text-blue-ribbon-500 dark:text-dodger-blue-430"}," Default ",-1)])])):h("",!0),e("div",uo,[e("div",{class:E(["relative w-full aspect-520/313",b.value.length===1?"max-w-[320px]":"max-w-[220px]"])},[g.default?(o(),T(Te,{key:0,class:"absolute inset-0 w-full h-full"})):(o(),T(Ue,{key:1,class:"absolute inset-0 w-full h-full"})),e("p",{class:E(["absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 font-bold leading-tight text-white",b.value.length===1?"text-xl":"text-lg"])}," **** **** **** "+_(g.card.last4),3),e("div",co,[g.card.brand==="mastercard"?(o(),a("img",{key:0,src:f(Ve),alt:"Mastercard",class:E(b.value.length===1?"h-7":"h-8")},null,10,po)):g.card.brand==="visa"?(o(),a("img",{key:1,src:f(ze),alt:"Visa",class:E(b.value.length===1?"h-7":"h-6")},null,10,mo)):(o(),a("span",{key:2,class:E(["uppercase leading-tight text-white",b.value.length===1?"text-xl":"text-lg"])},_(g.card.brand),3))])],2)]),e("div",bo,[e("button",{type:"button",onClick:oe(r=>V(g),["stop","prevent"]),class:"text-punch-600 hover:text-punch-700 text-base font-semibold cursor-pointer focus:outline-none focus:underline"}," Remove ",8,fo)])],10,ro))),128))],2)):(o(),a("div",yo,[...D[3]||(D[3]=[e("div",{class:"flex items-center justify-center py-7.5 px-6"}," No payment methods are available. ",-1)])]))]),C(ie,{"is-open":f(m).isOpen.value,title:"New Payment Method",onClose:f(m).closeDialog},{contentModal:Y(()=>[C(Ps,{onPaymentMethodAdded:$,onClose:D[0]||(D[0]=g=>f(m).closeDialog())})]),_:1},8,["is-open","onClose"]),C(ie,{"is-open":f(u).isOpen.value,"title-icon":f(ye),"background-icon-title":"w-12 h-12 bg-punch-600/10 rounded-lg flex items-center justify-center flex-shrink-3","class-title-icon":"text-punch-600 h-6 w-6 font-black",title:"Remove Card","border-color-under-title":"bg-punch-600",onClose:f(u).closeDialog},{contentModal:Y(()=>[C(Ws,{"payment-method":n.value,"is-deleting":d.value,onCancel:f(u).closeDialog,onConfirm:j},null,8,["payment-method","is-deleting","onCancel"])]),_:1},8,["is-open","title-icon","onClose"]),C(ie,{"is-open":f(M).isOpen.value,title:"Default Payment Method",onClose:f(M
1).closeDialog},{contentModal:Y(()=>[C(to,{"payment-method":S.value,"is-set-default":w.value,onCancel:f(M).closeDialog,onConfirm:W},null,8,["payment-method","is-set-default","onCancel"])]),_:1},8,["is-open","onClose"])],64))}}),xo={class:"flex justify-center gap-3 mt-6"},ho=["disabled"],go=["disabled"],_o=L({__name:"CancelSubscription",props:{isBusy:{type:Boolean}},emits:["confirm","close"],setup(v){return(c,s)=>(o(),a(H,null,[s[2]||(s[2]=e("div",{class:"flex items-center justify-center text-center text-pickled-bluewood-800 dark:text-white"}," Are you sure you want to cancel subscription? ",-1)),e("div",xo,[e("button",{type:"button",disabled:v.isBusy,onClick:s[0]||(s[0]=m=>v.isBusy?null:c.$emit("close")),class:"cursor-pointer inline-flex flex-1 items-center justify-center rounded-lg bg-white px-3 py-3 text-sm font-semibold text-lynch-500 shadow-xs ring-1 ring-lynch-500 hover:bg-gray-50 disabled:opacity-50 disabled:cursor-not-allowed"}," Cancel ",8,ho),e("button",{disabled:v.isBusy,onClick:s[1]||(s[1]=m=>c.$emit("confirm")),type:"button",class:"relative cursor-pointer inline-flex flex-1 items-center justify-center rounded-lg bg-blue-ribbon-500 dark:bg-dodger-blue-430 hover:opacity-90 px-3 py-3 text-sm font-semibold text-white focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-blue-ribbon-500 dark:focus-visible:outline-dodger-blue-430 disabled:opacity-60 disabled:cursor-not-allowed"},[v.isBusy?(o(),T(ne,{key:0})):h("",!0),O(" "+_(v.isBusy?"Confirming...":"Confirm"),1)],8,go)])],64))}}),ko={class:"flex justify-center gap-3 mt-6"},wo=["disabled"],Co=["disabled"],$o=L({__name:"ResumeSubscription",props:{isBusy:{type:Boolean}},emits:["confirm","close"],setup(v){return(c,s)=>(o(),a(H,null,[s[2]||(s[2]=e("div",{class:"flex items-center justify-center text-center text-woodsmoke-900 dark:text-white"}," Are you sure you want to resume the subscription? ",-1)),e("div",ko,[e("button",{type:"button",disabled:v.isBusy,onClick:s[0]||(s[0]=m=>v.isBusy?null:c.$emit("close")),class:"cursor-pointer inline-flex flex-1 items-center justify-center rounded-lg bg-white px-3 py-3 text-sm font-semibold text-lynch-500 shadow-xs ring-1 ring-lynch-500 hover:bg-gray-50 disabled:opacity-50 disabled:cursor-not-allowed"}," Cancel ",8,wo),e("button",{disabled:v.isBusy,onClick:s[1]||(s[1]=m=>c.$emit("confirm")),type:"button",class:"relative cursor-pointer inline-flex flex-1 items-center justify-center rounded-lg bg-blue-ribbon-500 dark:bg-dodger-blue-430 hover:opacity-90 px-3 py-3 text-sm font-semibold text-white focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-blue-ribbon-500 dark:focus-visible:outline-dodger-blue-430 disabled:opacity-60 disabled:cursor-not-allowed"},[v.isBusy?(o(),T(ne,{key:0})):h("",!0),O(" "+_(v.isBusy?"Confirming...":"Confirm"),1)],8,Co)])],64))}}),Po="testers-campaign",So={key:0},Mo=["id","disabled","value"],Do={class:"ml-2 text-base"},jo={class:"font-semibold"},Io={class:"font-light"},Ao={key:0,class:"rounded-lg bg-blue-ribbon-500/8 dark:bg-white text-blue-ribbon-500 dark:text-dodger-blue-430 px-2 py-1 text-xs font-semibold"},Bo={class:"mb-6"},Eo={key:0,class:"py-3"},To={class:"relative mt-2"},Uo=["disabled"],Vo={key:1,class:"flex items-start py-2 text-punch-500 dark:text-cinnabar-500"},zo={key:1,class:"flex items-center justify-center text-center"},Fo={class:"flex justify-center space-x-3 pt-4"},Ro=["disabled"],No=["disabled"],Re=L({__name:"SelectPlan",props:{isBusy:{type:Boolean},errorMessageApi:{}},emits:["confirm","close","selectedPlan","appliedDiscountCode"],setup(v,{emit:c}){const s=c,m=Z(),u=z(()=>{var x;return(((x=m.paymentMethods)==null?void 0:x.length)??0)>0}),M=z(()=>{var x;return m.campaign===Po&&((x=m.subscription)==null?void 0:x.stripe_status)==="canceled"}),l=x=>M.value?x.filter(p=>p.plan_id==="monthly"):x,d=P(M.value),w=P(!1),n=P(l(re)),S=x=>JSON.parse(JSON.stringify(x)),b=We({message:null,errorType:null}),y=P([]),$=x=>y.value.length>0&&!y.value.includes(x),V=P(null),j=x=>{V.value=x,s("appliedDiscountCode",x)},A=P(M.value?n.value[0].plan_id:n.value[1].plan_id),W=P(null),X=z(()=>{switch(b.errorType){case"error":return"text-cinnabar-500";case"success":return"text-shamrock-400";case"warning":return"text-cinnabar-400";default:return"text-mariner-950"}}),B=(x,p="error")=>{b.message=x,b.errorType=p},D=z(()=>n.value.find(x=>x.plan_id===A.value)),g=(x,p)=>{const i=p.filter(I=>I.discount_applied).map(I=>I.plan_id);if(y.value=i,i.length===0){B(`The discount code "${x}
1" is not valid for these plans.`,"error"),j(null);return}if(i.includes(A.value)||(A.value=i[0]),i.length<n.value.length){const I=n.value.filter(F=>i.includes(F.plan_id)).map(F=>F.name).join(" and ");B(`The discount code "${x}" applies to the ${I} plan only.`,"success")}else B(`The discount code "${x}" has been applied successfully!`,"success");j(x)},r=()=>{V.value!==null&&(n.value=l(S(re)),y.value=[],b.message=null,b.errorType=null,j(null))};ce(W,x=>{((x==null?void 0:x.trim())||"")!==V.value&&r()}),ce(d,x=>{x||r()});const t=async()=>{var p;w.value=!0;const x=((p=W.value)==null?void 0:p.trim())||"";if(x.length>0){const i=n.value.map(I=>I.plan_id);try{const I=await R.post("/api/payment",{plans:i,discount:x});if(I.data.success===!0){const F=S(re);n.value=l(F).map(U=>{const q=I.data.plans.find(se=>se.plan_id===U.plan_id);if(q){if(U.plan_id==="yearly"){const se=q.price/100;U.label_description=Me.sprintf(U.label_description_format,se/12)}else U.label_description=Me.sprintf(U.label_description_format,q.price/100);U.price=q.price}return U}),g(x,I.data.plans)}else B("You already have a discount waiting for you.","warning"),j(null)}catch{n.value=l(S(re)),y.value=[],B(`The discount code "${x}" does not exist!`,"error"),j(null)}}else x.length===0&&(B("No discount code provided!","warning"),j(null));w.value=!1},k=async()=>{var p;const x=((p=W.value)==null?void 0:p.trim())||"";if(d.value&&x.length>0&&x!==V.value){const i=A.value;if(await t(),V.value!==x||A.value!==i)return}D.value&&u.value&&(s("selectedPlan",D.value),s("confirm"))},G=z(()=>D.value),N=x=>{x.preventDefault();const p=G.value;A.value!==p.plan_id&&(A.value=p.plan_id);const i=document.getElementById(p.plan_id);i&&i.focus(),setTimeout(()=>{k()},100)};return(x,p)=>(o(),a("form",{onSubmit:oe(k,["prevent"]),onKeydown:He(N,["enter"])},[u.value?(o(),a("div",So,[p[6]||(p[6]=e("div",{class:"text-lg py-3 pb-2"},"Select subscription type",-1)),(o(!0),a(H,null,me(n.value,i=>(o(),a("div",{key:i.plan_id,class:E(["mb-3 px-2 py-3 bg-white dark:bg-bright-gray-900 rounded-lg border ",A.value===i.plan_id?"border-blue-ribbon-500 dark:border-dodger-blue-430":"border-tropical-blue-200 dark:border-transparent"])},[e("label",{class:E(["flex items-center",$(i.plan_id)?"cursor-not-allowed opacity-60":"cursor-pointer"])},[J(e("input",{type:"radio",id:i.plan_id,name:"plan_id",disabled:$(i.plan_id),class:"appearance-none shrink-0 w-5 h-5 rounded-full border border-tropical-blue-200 dark:border-tropical-blue-200 checked:border-blue-ribbon-500 checked:bg-[radial-gradient(circle_closest-side_at_center,var(--color-blue-ribbon-500)_60%,white_60%)] dark:checked:border-dodger-blue-430 dark:checked:bg-[radial-gradient(circle_closest-side_at_center,var(--color-dodger-blue-430)_60%,var(--color-big-stone-950)_60%)] cursor-pointer disabled:cursor-not-allowed","onUpdate:modelValue":p[0]||(p[0]=I=>A.value=I),value:i.plan_id},null,8,Mo),[[Ge,A.value]]),e("span",Do,[e("span",jo,_(i.label),1),e("span",Io,[O(_(i.label_description)+" ",1),i.plan_id==="yearly"&&i.discountPercentage?(o(),a("span",Ao,"Save "+_(i.discountPercentage)+"%",1)):h("",!0)])])],2)],2))),128)),e("div",Bo,[C(f(qe),{as:"div",class:"flex items-center"},{default:Y(()=>[C(f(Ke),{modelValue:d.value,"onUpdate:modelValue":p[1]||(p[1]=i=>d.value=i),class:E([d.value?"bg-blue-ribbon-500 dark:bg-dodger-blue-430":"bg-iron-300 dark:bg-pickled-bluewood-800","relative inline-flex h-6 w-11 shrink-0 cursor-pointer rounded-full border-2 border-transparent transition-colors duration-200 ease-in-out"])},{default:Y(()=>[e("span",{"aria-hidden":"true",class:E([d.value?"translate-x-5":"translate-x-0","pointer-events-none inline-block size-5 transform rounded-full bg-white shadow-sm ring-0 transition duration-200 ease-in-out"])},null,2)]),_:1},8,["modelValue","class"]),C(f(Xe),{as:"span",class:"ml-3 text-sm"},{default:Y(()=>[...p[4]||(p[4]=[e("span",{class:"text-sm font-normal"},"I have Discount code",-1)])]),_:1})]),_:1}),d.value?(o(),a("div",Eo,[p[5]||(p[5]=e("label",{for:"discount",class:"text-base font-semibold mb-2"}," Discount code ",-1)),e("div",To,[J(e("input",{"onUpdate:modelValue":p[2]||(p[2]=i=>W.value=i),class:"w-full pl-4 pr-20 py-3 placeholder:text-base text-lynch-500 dark:text-gray-chateau-400 placeholder:text-lynch-500 dark:placeholder:text-gray-chateau-400 border border-tropical-blue-200 bg-white dark:bg-big-stone-950a dark:border-lynch-500 rounded-lg focus:outline-none focus:border-blue-ribbon-500 dark:focus:border-dodger-blue-430 autofill:shadow-[inset_0_0_0px_1000px_var(--color-white)]! dark:autofill:shadow-[inset_0_0_0px_1000px_var(--color-big-stone-950a)]! autofill:[-webkit-text-fill-color:var(--color-gray-chateau-500)] dark:autofill:[-webkit-text-fill-color:var(--color-link-water-200)]",id:"discount",autocomplete:"off",placeholder:"Enter Discount code"},null,512),[[te,W.value]]),e("button",{type:"button",disabled:v.isBusy,onClick:t,class:"absolute right-4 top-1/2 -translate-y-1/2 text-sm font-semibold text-blue-ribbon-500 dark:text-dodger-blue-430 cursor-pointer disabled:opacity-60 hover:opacity-75 transition-opacity"},_(v.isBusy?"Loading...":"Apply"),9,Uo)]),b.message?(o(),a("div",{key:0,class:E(["flex items-start py-2",X.value])},_(b.message),3)):h("",!0)])):h("",!0),v.errorMessageApi?(o(),a("div",Vo,_(v.errorMessageApi),1)):h("",!0)])])):(o(),a("div",zo," You don't have any payment methods available. Please add a payment method first. ")),e("div",Fo,[e("button",{type:"button",onClick:p[3]||(p[3]=i=>
1x.$emit("close")),disabled:v.isBusy,class:"cursor-pointer inline-flex flex-1 items-center justify-center rounded-lg bg-white px-3 py-3 text-sm font-semibold text-lynch-500 shadow-xs ring-1 ring-lynch-500 hover:bg-gray-50 disabled:opacity-50 disabled:cursor-not-allowed"}," Cancel ",8,Ro),e("button",{type:"button",onClick:k,disabled:!u.value||!D.value||v.isBusy,class:"relative cursor-pointer inline-flex flex-1 items-center justify-center rounded-lg bg-blue-ribbon-500 dark:bg-dodger-blue-430 hover:opacity-90 px-3 py-3 text-sm font-semibold text-white focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-blue-ribbon-500 dark:focus-visible:outline-dodger-blue-430 disabled:opacity-60 disabled:cursor-not-allowed"},[v.isBusy?(o(),a(H,{key:0},[C(ne),p[7]||(p[7]=O("Continue...",-1))],64)):(o(),a(H,{key:1},[O("Continue")],64))],8,No)])],32))}}),Yo={class:"flex items-center mb-4"},Lo={class:"mb-4"},Oo={class:"mb-4"},Wo={key:0,class:"mt-2 text-sm text-punch-600 dark:text-tamarillo-800 flex items-center"},Ho={class:"flex justify-center gap-3 mt-6"},qo=["disabled"],Ko=L({__name:"ConfirmPayment",emits:["reload-subscription","close","confirm"],setup(v,{emit:c}){const s=Z(),m=z(()=>s.subscription),{notify:u}=ae(),{convertToCents:M}=Ee(),l=c,d=P(!1),w=P(""),n=le(null),S=le(null),b=le(null),y=le(null),$=P(!1),V=P(!1),j=P(!1),A=P(""),W=P(),X=P(""),B=async()=>{try{n.value=await Be("pk_live_51TeHXNAbMsbYcEXov1gHwWxKz4vX1Gy4HPd6tegxq8lKjYCM1Mhu7CEVhqjuaI2eRXJCfW8gOxCIAndSnWDzaf6r00cI7mX6Tw")}catch{u("Failed to load payment processor.","error"),r("Failed to load payment processor.")}},D=async()=>{var i,I,F,U;if(!n.value||V.value)return;if(!(m!=null&&m.value)||((i=m.value)==null?void 0:i.next_bill_amount)===0||((I=m.value)==null?void 0:I.next_bill_amount)===null){u("We can't process payment.","error"),r("We can't process payment.");return}const p=M((F=m==null?void 0:m.value)==null?void 0:F.next_bill_amount);S.value=n.value.elements({mode:"subscription",currency:"usd",amount:p,appearance:{variables:{borderRadius:"8px"}}}),y.value=S.value.create("expressCheckout",{buttonType:{applePay:"plain",googlePay:"plain"},buttonTheme:{applePay:"black",googlePay:"black"},layout:{maxColumns:1,overflow:"never"}}),(U=y.value)==null||U.mount("#express-checkout-element-payment"),y.value.on("ready",q=>{$.value=q.availablePaymentMethods?Object.keys(q.availablePaymentMethods).length>0:!1}),y.value.on("confirm",async()=>{var ue;d.value=!0;const q=await R.get("/api/payment/intent"),se=q.data.intent.client_secret;try{if(se){const{error:K,paymentIntent:Q}=await n.value.confirmPayment({elements:S.value,clientSecret:se,redirect:"if_required",confirmParams:{return_url:window.location.href}});if(W.value=Q,K){console.error("Stripe error:",K),u(K.message||"Payment failed","error"),r(K.message||"Payment failed"),d.value=!1;return}if(Q){const xe=typeof Q.payment_method=="string"?Q.payment_method:(ue=Q.payment_method)==null?void 0:ue.id;if(!xe){r("No payment method found in payment intent."),u("No payment method found in payment intent.","error"),d.value=!1;return}X.value=xe}else r("Payment intent missing after confirmation."),u("Payment intent missing after confirmation.","error"),d.value=!1}else q.data.status==="succeeded"?(u("Payment successful","success"),l("reload-subscription"),l("close")):(r("Payment could not be confirmed."),u("Payment could not be confirmed.","error")),d.value=!1}catch(K){console.error("Full error in confirmPaymentMethod:",K),u("Payment processing failed","error"),r("Payment processing failed"),d.value=!1}}),V.value=!0},g=()=>({base:{color:j.value?"#dc2626":"#9ca3af",fontFamily:'"Instrument Sans", ui-sans-serif, system-ui, sans-serif',fontSize:"16px",fontWeight:"350",backgroundColor:j.value?"#fef2f2":"transparent","::placeholder":{color:j.value?"#dc2626":"#9ca3af",fontWeight:"400"}},invalid:{color:"#dc2626",backgroundColor:"#fef2f2"}}),r=p=>{j.value=!0,A.value=p,k()},t=()=>{j.value=!1,A.value="",k()},k=()=>{b.value&&b.value.update({style:g()})},G=()=>{if(!n.value)return;const p=n.value.elements({locale:"en"}),i={hidePostalCode:!0,style:g(),classes:{base:"w-full h-12 pl-[10px] focus:outline-none"}};b.value=p.create("card",i),b.value.mount("#card-element-payment"),b.value.on("change",I=>{(j.value||A.value)&&t(),I.error&&r(I.error.message)}),b.value.on("focus",()=>{(j.value||A.value)&&t()})},N=async()=>{var p,i,I,F,U,q,se,ue;if(d.value=!0,!n.value||!b.value){d.value=!1,u("Payment processor not available.","error"),r("Payment processor not available.");return}try{const{error:K,paymentMethod:Q}=await n.value.createPaymentMethod({type:"card",card:b.value,billing_details:{name:w.value}});if(K||!Q){d.value=!1,u((K==null?void 0:K.message)||"Payment failed","error"),r((K==null?void 0:K.message)||"Payment failed");return}s.isLoading=!0;const we=(await R.get("/api/payment/intent")).data.intent.client_secret;
1if(!we){s.isLoading=!1,d.value=!1,u("Payment could not be confirmed.","error"),r("Payment could not be confirmed.");return}const de=await n.value.confirmCardPayment(we,{payment_method:Q.id,setup_future_usage:"off_session"});if(de.error){s.isLoading=!1,d.value=!1,u(de.error.message||"Payment failed","error"),r(de.error.message||"Payment failed");return}const Ce=typeof((p=de.paymentIntent)==null?void 0:p.payment_method)=="string"?de.paymentIntent.payment_method:((I=(i=de.paymentIntent)==null?void 0:i.payment_method)==null?void 0:I.id)??Q.id;if(!Ce){s.isLoading=!1,d.value=!1,u("Problem connecting with Stripe.","error"),r("Problem connecting with Stripe.");return}const $e=await R.post("/api/adjust",{payment_method_id:Ce});s.isLoading=!1,d.value=!1,$e.data.success===!0?(w.value="",(F=b.value)==null||F.clear(),u("You have successfully confirmed payment.","success"),s.setSubscriptionResponse($e.data),l("close"),await Promise.all([s.getPaymentMethods(),s.getInvoices()])):u("You already have an active subscription.","warning")}catch(K){s.isLoading=!1,d.value=!1;const Q=K;u(((q=(U=Q.response)==null?void 0:U.data)==null?void 0:q.message)||"Payment processing failed","error"),r(((ue=(se=Q.response)==null?void 0:se.data)==null?void 0:ue.message)||"Payment processing failed")}};let x=!0;return be(async()=>{await B(),x&&n.value&&(D(),G())}),Ie(()=>{var p,i;x=!1,(p=b.value)==null||p.unmount(),b.value=null,(i=y.value)==null||i.unmount(),y.value=null}),ce(W,async()=>{var p,i,I,F;try{const U=await R.post("/api/adjust",{payment_method_id:X.value});U.data.success===!0?(u("You have successfully confirmed payment.","success"),s.setSubscriptionResponse(U.data),l("close"),await Promise.all([s.getPaymentMethods(),s.getInvoices()])):u("You already have an active subscription.","warning")}catch(U){const q=U;u(((i=(p=q.response)==null?void 0:p.data)==null?void 0:i.message)||"Payment processing failed","error"),r(((F=(I=q.response)==null?void 0:I.data)==null?void 0:F.message)||"Payment processing failed")}finally{d.value=!1}}),(p,i)=>(o(),a(H,null,[e("div",{class:E($.value?"mb-4":"")},[...i[2]||(i[2]=[e("div",{id:"express-checkout-element-payment",class:"min-h-[88px]"},null,-1)])],2),J(e("div",Yo,[...i[3]||(i[3]=[e("div",{class:"flex-grow border-t border-alabaster-300"},null,-1),e("span",{class:"px-4"},"or",-1),e("div",{class:"flex-grow border-t border-alabaster-300"},null,-1)])],512),[[ke,$.value]]),e("div",Lo,[i[4]||(i[4]=e("label",{for:"card-holder-name",class:"text-base font-semibold mb-2"}," Card holder name ",-1)),J(e("input",{id:"card-holder-name",placeholder:"Enter card holder name","onUpdate:modelValue":i[0]||(i[0]=I=>w.value=I),type:"text",required:"",class:"w-full px-4 mt-2 py-3 placeholder:text-base text-gray-chateau-500 placeholder:text-gray-chateau-500 border border-gray-300 rounded-lg focus:outline-none focus:mariner-500 focus:border-mariner-500 dark:border-pickled-bluewood-800a dark:bg-big-stone-950a autofill:shadow-[inset_0_0_0px_1000px_theme(colors.white)]! dark:autofill:shadow-[inset_0_0_0px_1000px_theme(colors.big-stone.950a)]! dark:text-link-water-200 dark:autofill:[-webkit-text-fill-color:theme(colors.white)] dark:autofill:[-webkit-text-fill-color:theme(colors.link-water.200)] dark:outline-pickled-bluewood-700 dark:focus:outline-pickled-bluewood-900"},null,512),[[te,w.value]])]),e("div",Oo,[i[5]||(i[5]=e("label",{for:"card-element-payment",class:"text-base font-semibold mb-2"},"Card number",-1)),e("div",{id:"card-element-payment",class:E(["mt-2 pt-3 w-full rounded-md h-12 py-3 px-2.5 border border-gray-300 dark:border-pickled-bluewood-800a",j.value?"border-2 border-punch-600 bg-red-50 dark:border-tamarillo-800 dark:bg-tamarillo-50":"border border-gray-300"])},null,2)]),A.value?(o(),a("div",Wo,[i[6]||(i[6]=e("svg",{class:"w-4 h-4 mr-1",fill:"currentColor",viewBox:"0 0 20 20"},[e("path",{"fill-rule":"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7 4a1 1 0 11-2 0 1 1 0 012 0zm-1-9a1 1 0 00-1 1v4a1 1 0 102 0V6a1 1 0 00-1-1z","clip-rule":"evenodd"})],-1)),O(" "+_(A.value),1)])):h("",!0),e("div",Ho,[e("button",{onClick:i[1]||(i[1]=I=>p.$emit("close")),type:"button",class:"cursor-pointer inline-flex flex-1 items-center justify-center rounded-lg bg-white px-3 py-3 text-sm font-semibold text-lynch-500 shadow-xs ring-1 ring-lynch-500 hover:bg-gray-50 disabled:opacity-50 disabled:cursor-not-allowed"}," Cancel "),e("button",{disabled:d.value,onClick:N,type:"button",class:"relative cursor-pointer inline-flex flex-1 items-center justify-center rounded-lg bg-blue-ribbon-500 dark:bg-dodger-blue-430 hover:opacity-90 px-3 py-3 text-sm font-semibold text-white focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-blue-ribbon-500 dark:focus-visible:outline-dodger-blue-430 disabled:opacity-60 disabled:cursor-not-allowed"},[d.value?(o(),T(ne,{key:0})):h("",!0),O(" "+_(d.value?"Loading...":"Confirm"),1)],8,qo)])],64))}}),Xo={class:"flex items-center justify-center text-center text-woodsmoke-900 dark:text-white"},Go={key:0},Jo={key:1},Zo={class:"flex justify-center gap-3 mt-6"},Qo=["disabled"],el=["disabled"],tl=L({__name:"SkipTrial",props:{isBusy:{type:Boolean}},emits:["confirm","close"],setup(v){const c=Z(),s=z(()=>{var m;return(((m=c.paymentMethods)==null?void 0:m.length)??0)>0}
1);return(m,u)=>(o(),a(H,null,[e("div",Xo,[s.value?(o(),a("span",Go," Are you sure you want to skip your trial? If you confirm, you will be charged immediately for the selected plan. ")):(o(),a("span",Jo," You don't have any payment methods available. Please add a payment method first. "))]),e("div",Zo,[e("button",{type:"button",disabled:v.isBusy,onClick:u[0]||(u[0]=M=>v.isBusy?null:m.$emit("close")),class:"cursor-pointer inline-flex flex-1 items-center justify-center rounded-lg bg-white px-3 py-3 text-sm font-semibold text-lynch-500 shadow-xs ring-1 ring-lynch-500 hover:bg-gray-50 disabled:opacity-50 disabled:cursor-not-allowed"}," Cancel ",8,Qo),e("button",{disabled:v.isBusy||!s.value,onClick:u[1]||(u[1]=M=>s.value?m.$emit("confirm"):null),type:"button",class:"relative cursor-pointer inline-flex flex-1 items-center justify-center rounded-lg bg-blue-ribbon-500 dark:bg-dodger-blue-430 hover:opacity-90 px-3 py-3 text-sm font-semibold text-white focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-blue-ribbon-500 dark:focus-visible:outline-dodger-blue-430 disabled:opacity-60 disabled:cursor-not-allowed"},[v.isBusy?(o(),T(ne,{key:0})):h("",!0),O(" "+_(v.isBusy?"Confirming...":"Confirm"),1)],8,el)])],64))}}),sl={class:"flex justify-center gap-3 mt-6"},Ne=L({__name:"CountryRequiredModal",props:{isOpen:{type:Boolean}},emits:["close"],setup(v,{emit:c}){const s=c,m=Ae(),u=async()=>{s("close"),await m.push({name:"account-profile"})};return(M,l)=>(o(),T(ie,{"is-open":v.isOpen,title:"Missing required billing information","title-icon":f(ye),"class-title-icon":"text-punch-600 h-6 w-6 font-black","background-icon-title":"w-12 h-12 bg-punch-600/30 rounded-lg flex items-center justify-center flex-shrink-3","border-color-under-title":"bg-punch-600",onClose:l[1]||(l[1]=d=>s("close"))},{contentModal:Y(()=>[l[2]||(l[2]=e("div",{class:"flex items-center justify-center text-center text-woodsmoke-900 dark:text-white"}," Before continue you must update your country. ",-1)),e("div",sl,[e("button",{type:"button",onClick:l[0]||(l[0]=d=>s("close")),class:"cursor-pointer inline-flex flex-1 items-center justify-center rounded-lg bg-white px-3 py-3 text-sm font-semibold text-lynch-500 shadow-xs ring-1 ring-lynch-500 hover:bg-gray-50"}," Cancel "),e("button",{type:"button",onClick:u,class:"relative cursor-pointer inline-flex flex-1 items-center justify-center rounded-lg bg-blue-ribbon-500 dark:bg-dodger-blue-430 hover:opacity-90 px-3 py-3 text-sm font-semibold text-white focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-blue-ribbon-500 dark:focus-visible:outline-dodger-blue-430"}," Profile ")])]),_:1},8,["is-open","title-icon"]))}}),ol={class:"flex justify-start space-x-2 pl-4 pt-5 pb-2.75"},ll=["onClick"],al=L({__name:"SubscriptionButtons",setup(v){const c=Z(),s=z(()=>c.subscription),m=P(!1),u=P(null),M=P(null),l=P(null),{notify:d}=ae(),w=ee(),n=g=>{M.value=g},S=async()=>{await c.fetchUser(),await y(),await b()},b=async()=>{await c.getInvoices()},y=async()=>{m.value=!0;try{await c.getPaymentMethods()}catch{d("Failed to fetch payment methods.","error")}finally{m.value=!1}},$=g=>{u.value=g},V=async()=>{var r,t,k,G;if(!((r=c.user)==null?void 0:r.country)){B.new.modalInstance.closeDialog(),w.openDialog();return}m.value=!0;try{const N=await R.post("/api/subscribe",{plan_id:(t=u.value)==null?void 0:t.plan_id,discount:M.value});c.setSubscriptionResponse(N.data),await c.getInvoices(),B.new.modalInstance.closeDialog(),d("You've subscribed successfully.","success"),l.value=null}catch(N){R.isAxiosError(N)&&N.response?d((G=(k=N.response)==null?void 0:k.data)==null?void 0:G.message,"error"):d("Something went wrong. Please try again later.","error"),await c.fetchUser()}finally{m.value=!1}},j=async()=>{var g,r,t,k,G;m.value=!0;try{l.value="";const N=await R.patch("/api/subscription/swap",{plan_id:(g=u.value)==null?void 0:g.plan_id,discount_code:M.value});c.setSubscriptionResponse(N.data),await c.getInvoices(),B.update.modalInstance.closeDialog(),d("The subscription is updated successfully.","success"),l.value=null}catch(N){R.isAxiosError(N)&&N.response?(l.value=(t=(r=N.response)==null?void 0:r.data)==null?void 0:t.message,d((G=(k=N.response)==null?void 0:k.data)==null?void 0:G.message,"error")):(l.value="Something went wrong. Please try again later.",d("Something went wrong. Please try again later.","error")),await c.fetchUser()}finally{m.value=!1}},A=async()=>{m.value=!0;try{const g=await R.put("/api/subscription/cancel");c.setSubscriptionResponse(g.data),B.cancel.modalInstance.closeDialog(),d("The subscription is cancelled successfully.","success")}catch{d("Failed to cancel subscription.","error")}finally{m.value=!1}},W=async()=>{var g;m.value=!0;try{const r=await R.put("/api/subscription/skip-trial");c.setSubscriptionResponse(r.data),B.skipTrial.modalInstance.closeDialog(),d("Your trial has been skipped. You have been charged for the selected plan.","success")}catch(r){B.skipTrial.modalInstance.closeDialog(),R.isAxiosError(r)&&r.response?d((g=r.response.data)==null?void 0:g.message,"error"):d("Failed to skip trial.","error")}finally{m.value=!1}},X=async()=>{m.value=!0;try{B.resume.modalInstance.openDialog();const g=await R.put("/api/subscription/resume");c.setSubscriptionResponse(g.data),B.resume.modalInstance.closeDialog(),d("Successfully resume subscription.","success")}catch{d("Failed to resume subscription.","error")}finally{m.value=!1}},B={complete:{key:"incomplete",text:"Confirm Payment",action:S,condition:()=>!!(s.value&&s.value.is_incomplete),modalInstance:ee()},new:{key:"new",text:"New Subscription",action:V,condition:()=>s.value===null||!!(s.value&&(s.value.can_renew||s.value.stripe_status==="canceled")),modalInstance:ee()},update:{key:"update",text:"Change Plan",action:j,condition:()=>!!(s.value&&s.value.can_edit&&s.value.name!=="lifetime"&&!s.value.is_incomplete&&s.value.stripe_status!=="c
1anceled"),modalInstance:ee()},cancel:{key:"cancel",text:"Cancel Subscription",action:A,condition:()=>!!(s.value&&s.value.can_cancel&&s.value.name!=="lifetime"&&s.value.stripe_status!=="canceled"),modalInstance:ee()},resume:{key:"resume",text:"Resume Subscription",action:X,condition:()=>!!(s.value&&s.value.can_resume&&s.value.name!=="lifetime"),modalInstance:ee()},skipTrial:{key:"skipTrial",text:"Skip Trial",action:W,condition:()=>!!(s.value&&s.value.stripe_status==="trialing"),modalInstance:ee()}},D=z(()=>Object.values(B).filter(g=>g.condition()));return(g,r)=>(o(),a("div",ol,[(o(!0),a(H,null,me(D.value,t=>(o(),a("button",{key:t.key,type:"button",onClick:oe(k=>t.modalInstance.openDialog(),["prevent"]),class:E(["cursor-pointer flex items-center justify-center rounded-lg  w-[166px] h-[42px] text-sm font-semibold shadow-sm focus-visible:outline-2 focus-visible:outline-offset-2  disabled:opacity-60",t.key==="cancel"?"border border-punch-600 hover:bg-monza-50 text-punch-600 focus-visible:outline-punch-600 dark:border-transparent dark:bg-punch-600 dark:text-white dark:hover:bg-punch-600/90":"bg-blue-ribbon-500 dark:bg-dodger-blue-430 hover:opacity-90 text-white"])},[O(_(t.text)+" ",1),t.condition()?(o(),T(ie,{key:0,"is-open":t.modalInstance.isOpen.value,title:t.text,onClose:t.modalInstance.closeDialog,"title-icon":f(ye),"class-title-icon":(t.key==="update"||t.key==="new")&&!f(c).paymentMethods?"text-punch-600 h-6 w-6 font-black":"","background-icon-title":(t.key==="update"||t.key==="new")&&!f(c).paymentMethods?"w-12 h-12 bg-punch-600 rounded-lg flex items-center justify-center flex-shrink-3":"","border-color-under-title":(t.key==="update"||t.key==="new")&&!f(c).paymentMethods?"bg-punch-600":"bg-blue-ribbon-500 dark:bg-dodger-blue-430"},{contentModal:Y(()=>[t.condition()&&t.key==="cancel"&&t.modalInstance.isOpen.value?(o(),T(_o,{key:0,"is-busy":m.value,onClose:t.modalInstance.closeDialog,onConfirm:t.action},null,8,["is-busy","onClose","onConfirm"])):h("",!0),t.condition()&&t.key==="resume"&&t.modalInstance.isOpen.value?(o(),T($o,{key:1,"is-busy":m.value,onClose:t.modalInstance.closeDialog,onConfirm:t.action},null,8,["is-busy","onClose","onConfirm"])):h("",!0),t.condition()&&(t.key==="update"||t.key==="new")&&t.modalInstance.isOpen.value?(o(),T(Re,{key:2,"is-busy":m.value,errorMessageApi:l.value,onClose:t.modalInstance.closeDialog,onConfirm:t.action,onSelectedPlan:$,onAppliedDiscountCode:n},null,8,["is-busy","errorMessageApi","onClose","onConfirm"])):h("",!0),t.condition()&&t.key==="incomplete"&&t.modalInstance.isOpen.value?(o(),T(Ko,{key:3,onConfirm:t.action,onReloadSubscription:S,onClose:t.modalInstance.closeDialog},null,8,["onConfirm","onClose"])):h("",!0),t.condition()&&t.key==="skipTrial"&&t.modalInstance.isOpen.value?(o(),T(tl,{key:4,"is-busy":m.value,onClose:t.modalInstance.closeDialog,onConfirm:t.action},null,8,["is-busy","onClose","onConfirm"])):h("",!0)]),_:2},1032,["is-open","title","onClose","title-icon","class-title-icon","background-icon-title","border-color-under-title"])):h("",!0)],10,ll))),128)),C(Ne,{"is-open":f(w).isOpen.value,onClose:f(w).closeDialog},null,8,["is-open","onClose"])]))}}),nl={key:0,class:"grid grid-cols-1 mt-3 max-lg:px-0 *:hover:bg-tropical-blue-200/10 dark:*:hover:bg-lynch-500/10"},rl={class:"flex flex-col md:flex-row md:items-center md:justify-between px-7 py-3"},il={class:"font-bold capitalize text-woodsmoke-900 dark:text-zumthor-100"},dl={class:"flex flex-col md:flex-row md:items-center md:justify-between px-7 py-3"},ul={class:"font-bold"},cl={key:0,class:"flex flex-col md:flex-row md:items-center md:justify-between px-7 py-3"},pl={class:"font-bold text-woodsmoke-900 dark:text-zumthor-100"},ml={key:1,class:"flex flex-col md:flex-row md:items-center md:justify-between px-7 py-3"},bl={class:"font-bold text-woodsmoke-900 dark:text-zumthor-100"},fl={key:2,class:"flex flex-col md:flex-row md:items-center md:justify-between px-7 py-3"},yl={class:"font-semibold"},vl={key:3,class:"flex flex-col md:flex-row md:items-center md:justify-between px-7 py-3"},xl={class:"font-semibold text-woodsmoke-900 dark:text-zumthor-100"},hl={key:1},gl=L({__name:"SubscriptionStatus",setup(v){const c=Z(),s=z(()=>c.subscription),m=z(()=>{var M;return((M=s.value)==null?void 0:M.name)??""}),u=M=>{switch(M){case"canceled":case"incomplete":case"incomplete_expired":case"unpaid":return"text-punch-600 bg-punch-600/20 dark:punch-600/25";case"past_due":case"pending":return"text-lightning-yellow-550 bg-lightning-yellow-400/20 dark:bg-lightning-yellow-400/30";case"trialing":case"active":default:return"text-eucalyptus-500 bg-eucalyptus-500/12 dark:bg-eucalyptus-500/23"}};return(M,l)=>s.value?(o(),a("div",nl,[e("div",rl,[l[0]||(l[0]=e("span",{class:"mb-2 md:mb-0"},"Subscription type",-1)),e("span",il,_(m.value),1)]),e("div",dl,[l[1]||(l[1]=e("span",{class:"mb-2 md:mb-0"},"Status",-1)),e("span",ul,[s.value.stripe_status?(o(),a("span",{key:0,class:E(["inline-flex capitalize items-center rounded-lg  px-2 py-1 text-sm font-bold",u(s.value.stripe_status)])},_(s.value.stripe_status.replace("_"," ")),3)):h("",!0)])]),s.value.name!="lifetime"?(o(),a(H,{key:0},[s.value.on_trial?(o(),a("div",cl,[l[2]||(l[2]=e("span",{class:"mb-2 md:mb-0"},"Trials Ends At",-1)),e("span",pl,_(f(ge)(s.value.trial_ends_at,"MMMM D, YYYY",{locales:"en-US"}
1)),1)])):h("",!0),!s.value.on_grace_period&&s.value.next_billing_date&&!s.value.can_renew?(o(),a("div",ml,[l[3]||(l[3]=e("span",{class:"mb-2 md:mb-0"},"Next Billing Date",-1)),e("span",bl,_(f(ge)(s.value.next_billing_date,"MMMM D, YYYY",{locales:"en-US"})),1)])):h("",!0),s.value.on_grace_period?(o(),a("div",fl,[l[4]||(l[4]=e("span",{class:"mb-2 md:mb-0"},"Active Until",-1)),e("span",yl,_(s.value.ends_at?f(ge)(s.value.ends_at,"MMMM D, YYYY",{locales:"en-US"}):"N/A"),1)])):h("",!0),!s.value.can_renew&&!s.value.on_grace_period?(o(),a("div",vl,[l[5]||(l[5]=e("span",{class:"mb-2 md:mb-0"},"Billing Amount",-1)),e("span",xl,"$"+_(s.value.next_bill_amount.toLocaleString("en-US")),1)])):h("",!0)],64)):h("",!0)])):(o(),a("div",hl,[...l[6]||(l[6]=[e("p",{class:"text-center pt-5"},"No subscription details available.",-1)])]))}}),_l={key:0,class:"mt-20 relative"},kl={class:"relative w-full h-[200px] min-h-[275px] max-h-[300px] 2xl:max-h-[300px] overflow-hidden rounded-lg bg-blue-ribbon-500 dark:bg-dodger-blue-430"},wl={class:"absolute top-0 left-0 right-0 flex items-start z-10"},Cl={class:"ml-5 text-white mt-18"},$l={class:"text-xl max-lg:text-lg font-bold mb-2"},Pl={class:"absolute bottom-0 right-0 mr-18 max-sm:mr-6 z-10 -rotate-[7deg] translate-y-1/3 bg-white rounded-t-2xl px-6 pt-3 pb-18 min-w-[120px]"},Sl={class:"flex flex-col items-center rotate-[7deg]"},Ml={class:"text-base text-woodsmoke-900/91 line-through"},Dl={class:"text-2xl text-blue-ribbon-500 dark:text-dodger-blue-430 md:text-2xl font-bold"},jl=L({__name:"SubscriptionBanner",setup(v){const c=Z(),s=z(()=>c.subscription),m=z(()=>!!(s.value&&s.value.can_edit&&!s.value.is_incomplete&&s.value.stripe_status!=="canceled")),u=z(()=>!!(s.value&&(s.value.can_renew||s.value.stripe_status==="canceled"))),M=z(()=>{var D;return c.hasActiveSubscription&&((D=s.value)==null?void 0:D.name)==="monthly"&&(m.value||u.value)}),l=ee(),d=ee(),{notify:w}=ae(),n=P(null),S=P(!1),b=P(null),y=P(null),$=re.find(D=>D.plan_id==="yearly"),V=re.find(D=>D.plan_id==="monthly"),j=$&&($==null?void 0:$.price)/100,A=V&&$&&Math.round(V.price/100*12),W=D=>{b.value=D},X=D=>{y.value=D},B=async()=>{var r,t,k,G,N,x,p;const D=u.value,g=(r=c.user)==null?void 0:r.country;if(D&&!g){l.closeDialog(),d.openDialog();return}S.value=!0;try{n.value="";const i=D?await R.post("/api/subscribe",{plan_id:(t=b.value)==null?void 0:t.plan_id,discount:y.value}):await R.patch("/api/subscription/swap",{plan_id:(k=b.value)==null?void 0:k.plan_id,discount_code:y.value});c.setSubscriptionResponse(i.data),await c.getInvoices(),l.closeDialog(),w(D?"You've subscribed successfully.":"The subscription is updated successfully.","success"),n.value=null}catch(i){R.isAxiosError(i)&&i.response?(n.value=(N=(G=i.response)==null?void 0:G.data)==null?void 0:N.message,w((p=(x=i.response)==null?void 0:x.data)==null?void 0:p.message,"error")):(n.value="Something went wrong. Please try again later.",w("Something went wrong. Please try again later.","error")),await c.fetchUser()}finally{S.value=!1}};return(D,g)=>{var r;return M.value?(o(),a("div",_l,[C(rt,{class:"absolute left-8 -top-[69px] z-10"}),e("div",kl,[e("div",wl,[e("div",Cl,[e("h2",$l," Switch to Yearly Subscription & Save "+_((r=f($))==null?void 0:r.discountPercentage)+"% ",1),g[2]||(g[2]=e("p",{class:"text-base max-lg:text-sm text-white/60"}," Upgrade to a yearly plan and enjoy discount — get the same great features for less. ",-1)),e("button",{type:"button",onClick:g[0]||(g[0]=oe(t=>f(l).openDialog(),["prevent"])),class:"cursor-pointer flex items-center justify-center mt-5 rounded-lg bg-white hover:bg-white/90 w-[166px] h-[42px] text-sm font-semibold text-blue-ribbon-500 dark:text-dodger-blue-430 focus-visible:outline-2 disabled:opacity-60"},[g[1]||(g[1]=O(" Upgrade Now ",-1)),C(ie,{"is-open":f(l).isOpen.value,title:u.value?"New Subscription":"Change Plan",onClose:f(l).closeDialog},{contentModal:Y(()=>[f(l).isOpen.value?(o(),T(Re,{key:0,"is-busy":S.value,errorMessageApi:n.value,onClose:f(l).closeDialog,onConfirm:B,onSelectedPlan:W,onAppliedDiscountCode:X},null,8,["is-busy","errorMessageApi","onClose"])):h("",!0)]),_:1},8,["is-open","title","onClose"])])])]),e("div",Pl,[e("div",Sl,[e("span",Ml,_(f(A)&&f(A).toLocaleStr
1ing("en-US",{style:"currency",currency:"USD"})),1),e("span",Dl,_(f(j)&&f(j).toLocaleString("en-US",{style:"currency",currency:"USD"})),1)])])]),C(Ne,{"is-open":f(d).isOpen.value,onClose:f(d).closeDialog},null,8,["is-open","onClose"])])):h("",!0)}}}),Il={class:"grid grid-cols-1 max-lg:px-0 *:hover:bg-tropical-blue-200/10 dark:*:hover:bg-lynch-500/10"},Al={class:"flex flex-col md:flex-row md:items-center md:justify-between px-7 py-3"},Bl={class:"font-bold text-woodsmoke-900 dark:text-zumthor-100"},El={class:"flex flex-col md:flex-row md:items-center md:justify-between px-7 py-3"},Tl={key:0,class:"font-bold text-woodsmoke-900 dark:text-zumthor-100"},Ul={key:1,class:"font-bold text-woodsmoke-900 dark:text-zumthor-100"},Vl={class:"flex flex-col md:flex-row md:items-center md:justify-between px-7 py-3"},zl={key:0,class:"font-bold text-woodsmoke-900 dark:text-zumthor-100"},Fl={key:1,class:"font-bold text-woodsmoke-900 dark:text-zumthor-100"},Rl={class:"flex flex-col md:flex-row md:items-center md:justify-between px-7 py-3"},Nl={class:"font-bold text-woodsmoke-900 dark:text-zumthor-100"},Yl={class:"flex flex-col md:flex-row md:items-center md:justify-between px-7 py-3"},Ll={class:"font-bold text-woodsmoke-900 dark:text-zumthor-100"},Ol={key:0,class:"flex flex-col md:flex-row md:items-center md:justify-between px-7 py-3"},Wl={class:"font-bold text-woodsmoke-900 dark:text-zumthor-100"},Hl=20,ql=10,Kl=L({__name:"ExtensionFreemiumStatus",setup(v){const c=Z();be(()=>{c.user||c.fetchUser()});const s=z(()=>c.extension),m=z(()=>c.subscription),u=z(()=>c.hasFreeAccess||m.value!==null&&["active"].includes(m.value.stripe_status));return(M,l)=>{var d,w,n,S,b;return o(),a("div",Il,[e("div",Al,[l[0]||(l[0]=e("span",{class:"mb-2 md:mb-0"},"Etsy Extension",-1)),e("span",Bl,_(u.value?"Unlimited access to all features":"Freemium"),1)]),e("div",El,[l[1]||(l[1]=e("span",{class:"mb-2 md:mb-0"},"Keyword Search Credits Usage",-1)),u.value?(o(),a("span",Tl,_(((d=s.value)==null?void 0:d.keyword_search_credits_used)??0)+" / Unlimited",1)):(o(),a("span",Ul,_(((w=s.value)==null?void 0:w.keyword_search_credits_used)??0)+" / "+_(Hl)+" monthly",1))]),e("div",Vl,[l[2]||(l[2]=e("span",{class:"mb-2 md:mb-0"},"Listing Analysis Credits Usage",-1)),u.value?(o(),a("span",zl,_(((n=s.value)==null?void 0:n.listing_analysis_credits_used)??0)+" / Unlimited",1)):(o(),a("span",Fl,_(((S=s.value)==null?void 0:S.listing_analysis_credits_used)??0)+" / "+_(ql)+" monthly",1))]),e("div",Rl,[l[3]||(l[3]=e("span",{class:"mb-2 md:mb-0"},"Listings favorites",-1)),e("span",Nl,_(u.value?"Unlimited":"up to 10"),1)]),e("div",Yl,[l[4]||(l[4]=e("span",{class:"mb-2 md:mb-0"},"Keywords favorites",-1)),e("span",Ll,_(u.value?"Unlimited":"up to 10"),1)]),u.value?h("",!0):(o(),a("div",Ol,[l[5]||(l[5]=e("span",{class:"mb-2 md:mb-0"},"Credits Renew on",-1)),e("span",Wl,_((b=s.value)==null?void 0:b.credits_renew_on),1)]))])}}}),Xl={class:"bg-tropical-blue-200/30 dark:bg-fiord-550/29 rounded-lg text-base font-normal text-woodsmoke-900 dark:text-polo-blue-500a"},Gl={key:0,class:"flex items-center justify-center py-8"},Jl=L({__name:"SubscriptionDetails",setup(v){const c=Z(),s=z(()=>c.isLoading);return(m,u)=>(o(),a(H,null,[C(pe,{class:"mb-2"},{default:Y(()=>[...u[0]||(u[0]=[O("Subscription Status",-1)])]),_:1}),e("div",Xl,[s.value?(o(),a("div",Gl,[C(ve,{classColor:"w-15 h-15 text-blue-ribbon-500 dark:text-dodger-blue-430 mr-2"})])):(o(),a(H,{key:1},[C(gl),C(Kl),C(al)],64))]),s.value?h("",!0):(o(),T(jl,{key:0}))],64))}}),Zl={class:"bg-tropical-blue-200/30 dark:bg-fiord-550/29 rounded-lg text-woodsmoke-900 dark:text-white"},Ql={key:0,class:"flex justify-center items-center py-8"},ea={key:1},ta={class:"grid grid-cols-4 text-base bg-tropical-blue-200/30 dark:bg-polo-blue-500b rounded-t-lg mt-5"},sa={class:"font-medium pt-2 pl-3.5"},oa={class:"flex flex-col items-center"},la={class:"font-medium pt-2 pl-0"},aa={class:"flex flex-col items-center"},na={key:0,class:"flex flex-col rounded-b-lg overflow-hidden"},ra={class:"flex items-center"},ia={class:"font-medium"},da={class:"flex items-center"},ua={class:"font-medium"},ca={class:"flex items-center justify-end"}
1,pa=["href"],ma={key:2,class:"flex flex-col gap-4 rounded-b-lg py-8"},ba=L({__name:"InvoiceList",setup(v){const{notify:c}=ae(),s=Z(),m=z(()=>s.invoices||[]),u=P(!1),{currentSortColumn:M,currentSortOrder:l,toggleSort:d,getSortIconClass:w}=it(),n=z(()=>{if(!M.value)return m.value;const b=M.value;return[...m.value].sort((y,$)=>{if(b==="rawAmount")return l.value==="asc"?y.rawAmount-$.rawAmount:$.rawAmount-y.rawAmount;const V=new Date(y[b]).getTime(),j=new Date($[b]).getTime();return l.value==="asc"?V-j:j-V})}),S=async()=>{u.value=!0;try{await s.getInvoices()}catch{c("Failed to fetch invoices.","error")}finally{u.value=!1}};return be(async()=>{await S()}),(b,y)=>(o(),a(H,null,[C(pe,{class:"my-2"},{default:Y(()=>[...y[2]||(y[2]=[O("Invoices",-1)])]),_:1}),e("div",Zl,[u.value?(o(),a("div",Ql,[C(ve,{classColor:"w-15 h-15 text-blue-ribbon-500 dark:text-dodger-blue-430"})])):m.value.length>0?(o(),a("div",ea,[e("div",ta,[e("div",sa,[e("button",{class:"flex items-center justify-between gap-2 p-2 cursor-pointer",onClick:y[0]||(y[0]=$=>f(d)("paidAt"))},[y[3]||(y[3]=e("span",null,"Paid date",-1)),e("div",oa,[C(De,{class:E(["h-2 w-2",f(w)("paidAt","asc")])},null,8,["class"]),C(je,{class:E(["h-2 w-2",f(w)("paidAt","desc")])},null,8,["class"])])])]),e("div",la,[e("button",{class:"flex items-center justify-between gap-2 p-2 cursor-pointer",onClick:y[1]||(y[1]=$=>f(d)("rawAmount"))},[y[4]||(y[4]=e("span",null,"Paid Amount",-1)),e("div",aa,[C(De,{class:E(["h-2 w-2",f(w)("rawAmount","asc")])},null,8,["class"]),C(je,{class:E(["h-2 w-2",f(w)("rawAmount","desc")])},null,8,["class"])])])]),y[5]||(y[5]=e("div",{class:"font-medium text-sm pt-2 pl-4 text-right pr-6"},null,-1))]),n.value.length>0?(o(),a("div",na,[(o(!0),a(H,null,me(n.value,$=>(o(),a("div",{key:$.id,class:"grid grid-cols-4 text-sm items-center text-woodsmoke-900 dark:text-zumthor-100 py-3 px-6 hover:bg-tropical-blue-200/30 dark:hover:bg-polo-blue-500b last:hover:rounded-b-lg"},[e("div",ra,[e("span",ia,_($.paidAt),1)]),e("div",da,[e("span",ua,_($.amount),1)]),e("div",ca,[e("a",{href:`/subscription/invoice/${$.id}`,class:"text-blue-ribbon-500 hover:text-blue-ribbon-500/70 dark:text-dodger-blue-430 dark:hover:text-dodger-blue-430/70 text-base font-semibold transition-colors duration-200",target:"_blank"}," Download ",8,pa)])]))),128))])):h("",!0)])):(o(),a("div",ma,[...y[6]||(y[6]=[e("div",{class:"flex items-center justify-center py-7.5 px-6"},"No invoices are available.",-1)])]))])],64))}}),fa={class:"bg-white dark:bg-mirage-950"},ya={class:"mx-auto"},va={class:"grid grid-cols-1 lg:grid-cols-2 gap-6 mb-8"},xa={class:"w-full"},ha={class:"w-full"},ga=L({__name:"SubscriptionView",setup(v){return(c,s)=>(o(),a("div",fa,[e("div",ya,[e("div",va,[e("div",xa,[C(Jl)]),e("div",ha,[C(vo),C(ba)])])])]))}}),Ya=L({__name:"AccountView",setup(v){const c=Je(),s=Ae(),m=Z(),u=P(c.name==="account-subscription"&&!m.hasFreeAccess?"subscription":"profile");ce(()=>c.name,l=>{u.value=l==="account-subscription"&&!m.hasFreeAccess?"subscription":"profile"});const M=l=>{l==="profile"?s.push({name:"account-profile"}):l==="subscription"&&s.push({name:"account-subscription"})};return(l,d)=>(o(),T(et,{value:u.value},{default:Y(()=>[C(Ze,null,{default:Y(()=>[C(Pe,{"pt:root:class":"text-pickled-bluewood-800 dark:text-polo-blue-500a",value:"profile",onClick:d[0]||(d[0]=w=>M("profile"))},{default:Y(()=>[...d[2]||(d[2]=[O(" Profile ",-1)])]),_:1}),f(m).hasFreeAccess?h("",!0):(o(),T(Pe,{key:0,"pt:root:class":"text-pickled-bluewood-800 dark:text-polo-blue-500a",value:"subscription",onClick:d[1]||(d[1]=w=>M("subscription"))},{default:Y(()=>[...d[3]||(d[3]=[O(" Subscription ",-1)])]),_:1}))]),_:1}),C(Qe,null,{default:Y(()=>[C(Se,{value:"profile"},{default:Y(()=>[C(vs)]),_:1}),f(m).hasFreeAccess?h("",!0):(o(),T(Se,{key:0,value:"subscription"},{default:Y(()=>[C(ga)]),_:1}))]),_:1})]),_:1},8,["value"]))}});export{Ya 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.