PageSourceSearch

https://mychar.gg/_nuxt/Bm3gFq9O.js

js mychar.gg collected 2026-10-08 16:09:18 UTC 13,268 bytes, 3 lines download raw bytes

1const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./B82e1PcY.js","./CZO_kbxe.js","./entry.DzLCVlfi.css","./Cgz1c-3U.js","./wxz5ECD-.js","./DL1TxsSW.js","./BGGUAEei.js","./DHC8vXKX.js"])))=>i.map(i=>d[i]);
2import{a9 as te,I as ne,br as ie,y as ae,bs as re,Q as m,$ as T,an as I,x as P,bt as oe,aT as o,aK as s,V as M,aV as a,X as e,aU as l,bn as d,bl as p,bc as le,aD as E,aA as se,_ as de,bk as ce,h as ue,W as r,bj as me,Y as D,U as pe,bd as ge}from"./CZO_kbxe.js";import{_ as fe}from"./CuEweTsk.js";import{_ as ye}from"./Cgz1c-3U.js";import{_ as xe,p as be}from"./Cdy3Jwua.js";import{_ as ve}from"./FDNpO8d_.js";import{u as he}from"./aluA_p2L.js";import{u as _e}from"./DImPf1ZV.js";import{L as we}from"./CVIxsgJu.js";import"./DHC8vXKX.js";import"./DMHyAxDi.js";import"./C1R5UMyj.js";const ke={key:0,class:"flex flex-col sm:flex-row sm:items-center gap-3 px-4 py-3 rounded-xl border border-red-400/25 bg-red-500/10 mb-4"},Ce={class:"flex items-start gap-3 flex-1"},Pe={class:"flex items-center gap-2 shrink-0"},De={key:1,class:"flex flex-col sm:flex-row sm:items-center gap-3 px-4 py-3 rounded-xl border border-red-400/25 bg-red-500/10 mb-4"},Se={class:"flex items-start gap-3 flex-1"},Ae={class:"text-sm tint-red"},Te={class:"flex items-center gap-2 shrink-0"},Ee={key:2,class:"flex items-center gap-3 px-4 py-3 rounded-xl border border-red-400/25 bg-red-500/10 mb-4"},Le={key:3,class:"flex items-center gap-3 px-4 py-3 rounded-xl border border-warning-400/25 bg-warning-500/10 mb-4"},ze={class:"text-sm text-warning-200"},Me={key:4,class:"flex items-center gap-3 px-4 py-3 rounded-xl border border-primary-400/25 bg-primary-500/10 mb-4"},$e={class:"text-sm tint-primary"},Fe={key:5,class:"flex items-center gap-3 px-4 py-3 rounded-xl border border-warning-400/25 bg-warning-500/10 mb-4"},Ye={class:"text-sm text-warning-200"},Ue={class:"flex flex-col sm:flex-row sm:items-center gap-4"},Ne={class:"flex items-center gap-3"},Re={class:"flex items-center gap-2"},Be={class:"text-lg font-semibold text-highlighted"},Oe={class:"text-sm text-muted"},Ve={key:0,class:"sm:ml-auto"},Ie={key:0,class:"text-xs text-success-300 flex items-center gap-1.5"},je={key:1,class:"text-xs text-dimmed"},qe={class:"flex items-center gap-3 lg:ms-auto"},Ge={key:0,class:"flex items-center gap-1"},Ke={key:1,class:"text-xs text-muted"},We={class:"flex items-center gap-0.5 p-0.5 rounded-lg bg-elevated/50 border border-default"},He=["onClick"],Qe={class:"grid grid-cols-1 md:grid-cols-3 gap-6"},ct=te({__name:"billing",setup(Xe){ne({title:"Billing",description:"Manage your subscription and billing"});const t=he(),_=ie(),$=ae(),{trackGoal:F}=oe(),Y=re(),{currency:j,currencies:q,setCurrency:G}=_e(),K=ue(),U=m(()=>K.public.paymentMode||"onetime"),x=m(()=>U.value==="onetime"),S=T(null),A=T(!1),N=T(!1),b=T("monthly");I(async()=>{if(!t.isLifetime)try{await $fetch("/api/subscription/sync",{method:"POST"})}catch{}t.fetchSubscription()}),I(()=>{$.query.success==="true"?(_.add({title:"Subscription activated!",description:"Welcome to your new plan. Enjoy your upgraded features.",icon:"i-lucide-party-popper",color:"success"}),t.fetchSubscription(),P("/dashboard/settings/billing",{replace:!0})):$.query.canceled==="true"&&(F("checkout_cancelled",{type:"plan"}),_.add({title:"Checkout canceled",description:"No charges were made. You can try again anytime.",icon:"i-lucide-triangle-alert",color:"warning"}),P("/dashboard/settings/billing",{replace:!0}))});const W={free:{label:"Free",color:"neutral",icon:"i-lucide-user",description:"The essentials to get started."},pro:{label:"Pro",color:"fuchsia",icon:"i-lucide-zap",description:"Unlock full creative control and make your page stand out."},elite:{label:"Elite",color:"warning",icon:"i-lucide-crown",description:"Maximum everything. No limits."}},w=m(()=>W[t.plan]),R=m(()=>{const i=t.planStatus;return!i||t.plan==="free"?null:{active:"Active",trialing:"Trial",past_due:"Past Due",canceled:"Canceled",incomplete:"Incomplete"}[i]||i}),H=m(()=>{const i=t.planStatus;return i==="active"?"success":i==="trialing"?"primary":i==="past_due"?"warning":i==="canceled"?"error":"neutral"}),v=m(()=>{if(t.planStatus!=="trialing"||!t.currentPeriodEnd)return null;const i=new Date(t.currentPeriodEnd),n=new Date,u=Math.ceil((i.getTime()-n.getTime())/(1e3*60*60*24));return Math.max(0,u)}),k=m(()=>t.currentPeriodEnd?new Date(t.currentPeriodEnd).toLocaleDateString("en-US",{month:"long",day:"numeric",year:"numeric"}):null),g={free:0,pro:1,elite:2},Q=m(()=>be(x.value));function X(i){return i===t.plan?"Current Plan":x.value&&t.isLifetime&&g[i]<g[t.plan]?"Already Higher":g[i]<g[t.plan]?"Downgrade":x.value&&t.isLifetime&&t.plan==="pro"&&i==="elite"?"Upgrade to Elite":x.value?"Get Lifetime":i==="pro"&&!t.hasUsedTrial?"Start 7-Day Free Trial":"Upgrade"}const B=m(()=>t.planStatus==="trialing"&&t.cancelAtPeriodEnd),C=m(()=>{if(!t.cancelAtPeriodEnd||!t.currentPeriodEnd||t.downgradedAt)return null;const i=new Date(t.currentPeriodEnd),n=new Date;return Math.max(0,Math.ceil((i.getTime()-n.getTime())/(1e3*60*60*24)))}),f=m(()=>{if(!t.downgradedAt)return null;const i=new Date(t.downgradedAt),n=new Date(i.getTime()+10080*60*1e3),u=new Date;return Math.max(0,Math.ceil((n.getTime()-u.getTime())/(1e3*60*60*24)))});async function O(){if(t.userId)try{const i=await $fetch(`/api/character/${t.userId}/downgrade-preview`);f.value!==null?i.gracePeriodDays=f.value:C.value!==null&&(i.gracePeriodDays=C.value+7),t.downgradedAt&&(i.featureChanges=[]),Y.create(we).open({preview:i,mode:"info"})}catch{_.add({title:"Error",description:"Failed to load downgrade details.",icon:"i-lucide-x",color:"error"})}}async function L(i){const n=t.cancelAtPeriodEnd||t.downgradedAt;
2if(!(i===t.plan&&!n)&&!(t.isLifetime&&g[i]<g[t.plan])){if(g[i]<g[t.plan]&&i!==t.plan){await J(i);return}S.value=i;try{if(t.subscription?.isActive&&t.plan!=="free"&&!t.isLifetime){const c=await $fetch("/api/stripe/portal",{method:"POST"});c.url&&await P(c.url,{external:!0})}else{F("checkout_started",{type:"plan",plan:i,billing_cycle:x.value?"lifetime":b.value,context:"billing"});const c=await $fetch("/api/stripe/checkout",{method:"POST",body:x.value?{plan:i}:{plan:i,billingCycle:b.value}});c.url&&await P(c.url,{external:!0})}}catch(u){_.add({title:"Error",description:u.data?.message||"Failed to change plan. Please try again.",icon:"i-lucide-x",color:"error"})}finally{S.value=null}}}async function J(i="free"){N.value=!0;try{const n=await $fetch(`/api/character/${t.userId}/downgrade-preview?targetPlan=${i}`),u=se(()=>de(()=>import("./B82e1PcY.js"),__vite__mapDeps([0,1,2,3,4,5,6,7]),import.meta.url));if(!await Y.create(u).open({preview:n}).result)return;await z()}catch(n){_.add({title:"Error",description:n.data?.message||"Failed to load downgrade preview.",icon:"i-lucide-x",color:"error"}),S.value=null}finally{N.value=!1}}async function z(){A.value=!0;try{const i=await $fetch("/api/stripe/portal",{method:"POST"});i.url&&await P(i.url,{external:!0})}catch(i){_.add({title:"Error",description:i.data?.message||"Failed to open billing portal.",icon:"i-lucide-x",color:"error"})}finally{A.value=!1}}return(i,n)=>{const u=fe,c=me,h=ce,V=ye,Z=xe,ee=ve;return r(),o(p,null,[s(u,{title:"Billing",description:"Manage your subscription plan and view usage.",variant:"naked",orientation:"horizontal",class:"mb-4"}),e(f)!==null&&e(f)===0?(r(),o("div",ke,[a("div",Ce,[s(c,{name:"i-lucide-alert-triangle",class:"size-5 text-red-400 shrink-0 mt-0.5"}),n[4]||(n[4]=a("p",{class:"text-sm tint-red"}," Your grace period has ended. Over-limit files are being deleted. Re-subscribe to prevent further deletions. ",-1))]),a("div",Pe,[s(h,{label:"View Details",size:"xs",color:"neutral",variant:"outline",icon:"i-lucide-eye",onClick:O}),s(h,{label:"Re-subscribe",size:"xs",color:"error",variant:"solid",icon:"i-lucide-arrow-up-circle",onClick:n[0]||(n[0]=y=>L((e(t).plan!=="free"?e(t).plan:e(t).previousPlan)||"pro"))})])])):e(f)!==null&&e(f)>0?(r(),o("div",De,[a("div",Se,[s(c,{name:"i-lucide-alert-triangle",class:"size-5 text-red-400 shrink-0 mt-0.5"}),a("p",Ae,[n[5]||(n[5]=l(" Your subscription ended. You have ",-1)),a("strong",null,d(e(f))+" day"+d(e(f)===1?"":"s"),1),n[6]||(n[6]=l(" left before files exceeding Free plan limits are permanently deleted. ",-1))])]),a("div",Te,[s(h,{label:"View Details",size:"xs",color:"neutral",variant:"outline",icon:"i-lucide-eye",onClick:O}),s(h,{label:"Re-subscribe",size:"xs",color:"error",variant:"solid",icon:"i-lucide-arrow-up-circle",onClick:n[1]||(n[1]=y=>L((e(t).plan!=="free"?e(t).plan:e(t).previousPlan)||"pro"))})])])):e(t).planStatus==="past_due"?(r(),o("div",Ee,[s(c,{name:"i-lucide-alert-circle",class:"size-5 text-red-400 shrink-0"}),n[7]||(n[7]=a("p",{class:"text-sm tint-red"}," Your payment failed. Please update your payment method to keep your plan. ",-1)),s(h,{label:"Update Payment",size:"xs",color:"error",variant:"soft",loading:e(A),class:"ml-auto shrink-0",onClick:z},null,8,["loading"])])):e(v)!==null&&e(B)?(r(),o("div",Le,[s(c,{name:"i-lucide-clock",class:"size-5 text-warning-400 shrink-0"}),a("p",ze,[l(" Your trial has been cancelled. Your "+d(e(w).label)+" features will end ",1),e(v)>0?(r(),o(p,{key:0},[n[8]||(n[8]=l(" in ",-1)),a("strong",null,d(e(v))+" day"+d(e(v)===1?"":"s"),1),n[9]||(n[9]=l(". ",-1))],64)):(r(),o(p,{key:1},[l(" today. ")],64)),n[10]||(n[10]=l(" You won't be charged. ",-1))])])):e(v)!==null?(r(),o("div",Me,[s(c,{name:"i-lucide-clock",class:"size-5 text-primary-400 shrink-0"}),a("p",$e,[l(" Your "+d(e(w).label)+" trial ends in ",1),a("strong",null,d(e(v))+" day"+d(e(v)===1?"":"s"),1),n[11]||(n[11]=l(". ",-1))])])):e(t).cancelAtPeriodEnd&&e(C)!==null?(r(),o("div",Fe,[s(c,{name:"i-lucide-alert-triangle",class:"size-5 text-warning-400 shrink-0"}),a("p",Ye,[n[14]||(n[14]=l(" Your subscription is set to cancel on ",-1)),a("strong",null,d(e(k)),1),l(". You'll keep your "+d(e(w).label)+" features ",1),e(C)>0?(r(),o(p,{key:0},[n[12]||(n[12]=l(" for ",-1)),a("strong",null,d(e(C))+" more day"+d(e(C)===1?"":"s"),1),n[13]||(n[13]=l(". ",-1))],64)):(r(),o(p,{key:1},[l(" until the end of today. ")],64))])])):M("",!0),s(u,{variant:"subtle",class:"border border-default [&>div]:py-4!"},le({default:E(()=>[a("div",Ue,[a("div",Ne,[a("div",{class:D(["flex items-center justify-center size-10 rounded-xl",{"bg-elevated/50":e(t).plan==="free","bg-fuchsia-500/15 border border-fuchsia-400/25":e(t).plan==="pro","bg-warning-500/15 border border-warning-400/25":e(t).plan==="elite"}])},[s(c,{name:e(w).icon,class:D(["size-5",{"text-muted":e(t).plan==="free","text-fuchsia-400":e(t).plan==="pro","text-warning-400":e(t).plan==="elite"}])},null,8,["name","class"])],2),a("div",null,[a("div",Re,[a("h3",Be,d(e(w).label),1),e(R)?(r(),pe(V,{key:0,color:e(H),variant:"subtle",size:"sm"},{default:E(()=>[l(d(e(R)),1)]),_:1},8,["color"])):M("",!0)]),a("p",Oe,d(e(w).description),1)])]),e(t).plan!=="free"&&!e(t).isLifetime?(r(),o("div",Ve,[s(h,{label:"Manage Subscription",icon:"i-lucide-external-link",color:"neutral",variant:"outline",loading:e(A),onClick:z},null,8,["loading"])])):M("",!0)])]),_:2},[e(t).plan!=="free"&&(e(t).isLifetime||e(k))?{name:"footer",fn:E(()=>[e(t).isLifetime?(r(),o("p",Ie,[s(c,{name:"i-lucide-infinity",class:"size-3.5"}),n[15]||(n[15]=l(" Lifetime access · No expiration · No recurring charges ",-1))])):(r(),o("p",je,[e(B)?(r(),o(p,{key:0},[l(" Trial ends: "+d(e(k))+" · Cancelled, no charge ",1)],64)):e(t).planStatus==="trialing"?(r(),o(p,{key:1},[l(" Trial ends: "+d(e(k)),1)],64)):e(t).cancelAtPeriodEnd?(r(),o(p,{key:2},[l(" Features available until: "+d(e(k)),1)],64)):(r(),o(p,{key:3},[l(" Next billing date: "+d(e(k)),1)],64))]))]),key:"0"}:void 0]),1024),s(u,{title:"Plans",description:"Choose the plan that fits your needs.",variant:"naked",orientation:"horizontal",class:"mt-8 mb-4"},{default:E(()=>[a("div",qe,[e(x)?(r(),o("div",Ke," Pay once · Lifetime access ")):(r(),o("div",Ge,[a("button",{class:D(["px-3 py-1.5 rounded-lg text-sm font-medium transition-colors",e(b)==="monthly"?"bg-elevated text-highlighted":"text-muted hover:text-toned"]),onClick:n[2]||(n[2]=y=>b.value="monthly")}," Monthly ",2),a("button",{class:D(["px-3 py-1.5 rounded-lg text-sm font-medium transition-colors flex items-center gap-2",e(b)==="yearly"?"bg-elevated text-highlighted":"text-muted hover:text-toned"]),onClick:n[3]||(n[3]=y=>b.value="yearly")},[...n[16]||(n[16]=[l(" Yearly ",-1),a("span",{class:"text-xs text-green-400 font-semibold"},"Save up to 25%",-1)])],2)])),n[17]||(n[17]=a("div",{class:"w-px h-5 bg-elevated"},null,-1)),a("div",We,[(r(!0),o(p,null,ge(e(q),y=>(r(),o("button",{key:y,class:D(["px-2 py-1 rounded-md text-xs font-medium transition-all duration-200",e(j)===y?"bg-elevated text-highlighted":"text-dimmed hover:text-muted"]),onClick:Je=>e(G)(y)},d(y),11,He))),128))])])]),_:1}),s(Z,{plans:e(Q),"billing-cycle":e(b),"checkout-loading":e(S),"get-button-label":X,"payment-mode":e(U),onPlanAction:L},null,8,["plans","billing-cycle","checkout-loading","payment-mode"]),s(u,{title:"Add-ons",de
2scription:"Standalone extras billed monthly. They work with every plan, including Free.",variant:"naked",orientation:"horizontal",class:"mt-8 mb-4"}),a("div",Qe,[s(ee,{addon:"custom_domain"})])],64)}}});export{ct as default};
3//# sourceMappingURL=Bm3gFq9O.js.map

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.