1import{v as U,r as l,a as k,w as L,x as z,y as M,j as e,c as O}from"./index-UJ3-pDKQ.js";import{L as F,c as R}from"./messages-BNKnStg-.js";import{u as V,a as G,c as u,d as H,e as Q,f as W,i as Y,B as d}from"./subscriptionDisplay-B9KkNRvM.js";import{C as q,a as K,d as X,e as Z,b as _}from"./icon-B1X-QAti.js";import{u as $}from"./near-payment-By-3FV-O.js";import{m as p}from"./date-cell-B47B3Ia9.js";import"./index-DobX8ev2.js";const m=({children:n,description:a,title:t})=>e.jsxs(q,{className:"mb-6 overflow-hidden rounded-xl",children:[e.jsxs(K,{className:"px-[22px] pb-0 pt-[18px]",children:[e.jsx(X,{className:"text-base font-semibold",children:t}),e.jsx(Z,{className:"text-sm",children:a})]}),e.jsx(_,{className:"px-[22px] pb-[22px] pt-[18px]",children:n})]}),r=({children:n,className:a,label:t})=>e.jsxs("div",{className:O("flex items-center justify-between gap-4 border-b py-3 text-sm first:pt-0 last:border-b-0 last:pb-0",a),children:[e.jsx("span",{className:"text-muted-foreground",children:t}),e.jsx("span",{className:"flex items-center justify-end gap-2.5 text-right font-medium",children:n})]}),ee=()=>{const[n,a]=U(),{data:t,isSuccess:b}=a;l.useEffect(()=>{n()},[n]);const c=k(),x=L(),h=V(),{user:g}=G(),[f,{isSuccess:o}]=$(),[j]=z(),y=async()=>{await f(),await j()},v=()=>e.jsx(r,{label:"Manage subscription",children:e.jsx(d,{onClick:y,variant:"outline",size:"sm",children:"Unsubscribe"})}),N=()=>e.jsx(r,{label:"Manage subscription",children:e.jsx(d,{onClick:()=>x({to:"/plans/subscribe"}),size:"sm",className:"bg-[hsl(var(--accent-blue))] text-white hover:bg-[hsl(var(--accent-blue)/.88)]",children:"Upgrade plan"})}),S=s=>s.currentPeriodEnd>Date.now()/1e3&&s.paymentType==="Stripe"&&s.subscriptionType!=="trial"&&s.subscriptionStatus==="active"?e.jsx(v,{}):s.subscriptionStatus!=="active"||s.currentPeriodEnd<Date.now()/1e3||s.subscriptionType==="trial"?e.jsx(N,{}):"",w=s=>{switch(s.subscriptionType){case"trial":return"Your trial ends on";case"basic":return s.paymentType==="Stripe"?"Next subscription renewal":"Subscription valid until";default:return""}},C=s=>{const i=s.currentPeriodEnd&&s.subscriptionType!=="none";return i&&!Y(s)?e.jsxs("div",{className:"text-destructive",children:["Expired on"," ",p(new Date(Number(s.currentPeriodEnd)*1e3))]}):i?p(new Date(Number(s.currentPeriodEnd)*1e3)):R.noSubscription};return l.useEffect(()=>{const s=localStorage.getItem("jwt");if(s&&o){const{email:i,token:E,analyticsProfileId:P,currentPeriodEnd:T,verifiedEmail:D,trial:A,mailchain:J}=JSON.parse(s);c(M({email:i,token:E,analyticsProfileId:P,level:0,currentPeriodEnd:T,verifiedEmail:D,trial:A,mailchain:J}));const B=JSON.parse(s),I=JSON.stringify({...B,level:0});localStorage.setItem("jwt",I),n()}},[o,c,n]),e.jsx(e.Fragment,{children:t&&b?e.jsxs(e.Fragment,{children:[e.jsxs(m,{title:"Plan & billing",description:"Your subscription and renewal details.",children:[e.jsx(r,{label:"Current plan",children:e.jsx(u,{variant:W(t),className:Q(t),children:H(t)})}),g.level!==1&&e.jsx(r,{label:w(t),className:t.subscriptionType==="none"?"hidden":"",children:C(t)}),t.paymentType&&e.jsx(r,{label:"Payment method",children:t.paymentType}),S(t)]}),e.jsx(m,{title:"Sign-in & identity",description:"How you access your Pikespeak account.",children:e.jsxs(r,{label:h||!t.email.includes("@")?"NEAR account":"Email",children:[e.jsx("span",{className:"truncate",children:t.email}),e.jsx(u,{className:"rounded-full border-[hsl(var(--accent-mint)/.35)] bg-[hsl(var(--accent-mint)/.15)] px-2.5 py-0.5 text-[hsl(var(--accent-mint))] hover:bg-[hsl(var(--accent-mint)/.2)]",children:"Verified"})]})}),e.jsx("div",{className:"mt-2 text-center text-sm text-muted-foreground",children:"If you have any questions, please reach out to us on Telegram"})]}):e.jsx(F,{})})},oe=ee;export{oe as component};
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.