1import{a as S,j as e,r as T}from"./index-BiiSbPHD.js";import{u as A}from"./useSetMetricsUserId-D-g6dBbj.js";import{A as C}from"./AppFrame-BLJnFFSS.js";import{P as y}from"./Panel-DRcsEp7i.js";import{R as F}from"./routes-CdNxc_lW.js";import{B as I}from"./Button-D9EeOgqz.js";import{u as _}from"./components-CMVHAhce.js";import{S as $}from"./Stack-SpmezGyV.js";import{b as u,G as c,a as t}from"./Shell.module-Duqunl39.js";import{B,S as w}from"./SimpleGrid-DKx5o66t.js";import{P as R}from"./Progress-C-r6336O.js";import{T as L}from"./ThemeIcon-Do8MZ6md.js";import"./analytics-Dw6opIwb.js";import"./app-context-B96pImnM.js";import"./Loader-qUqbgiev.js";import"./UnstyledButton-DRd6gyCa.js";import"./px-CiO0pVtX.js";import"./use-resolved-styles-api-BjnCvCVS.js";import"./get-contrast-color-CW0lnaeH.js";/** 2 * @license lucide-react v0.525.0 - ISC 3 * 4 * This source code is licensed under the ISC license. 5 * See the LICENSE file in the root directory of this source tree. 6 */const U=[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}]],G=u("calendar",U);/** 7 * @license lucide-react v0.525.0 - ISC 8 * 9 * This source code is licensed under the ISC license. 10 * See the LICENSE file in the root directory of this source tree. 11 */const V=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}]],E=u("shield",V);/** 12 * @license lucide-react v0.525.0 - ISC 13 * 14 * This source code is licensed under the ISC license. 15 * See the LICENSE file in the root directory of this source tree. 16 */const q=[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]],Y=u("zap",q),Z=({plan:s,paymentFlowEnabled:a})=>{const i=S();return a?e.jsx(I,{radius:"xl",onClick:()=>i(F.Plans),children:s==="free"?"Upgrade to Pro":"Change plan"}):null},ue=()=>[{title:"NovaVoice | Account"},{name:"description",content:"Manage your NovaVoice subscription, usage and account settings"}];function o(s){return new Intl.NumberFormat(void 0,{maximumFractionDigits:0}).format(s)}function g(s){const a=typeof s=="string"?new Date(s):s;return new Intl.DateTimeFormat(void 0,{year:"numeric",month:"short",day:"2-digit"}).format(a)}function j(s,a){return Math.max(0,Math.ceil((a.getTime()-s.getTime())/(1e3*60*60*24)))}function l({label:s,value:a,suffix:i,icon:n}){return e.jsxs(y,{children:[e.jsxs(c,{gap:"xs",wrap:"nowrap",mb:"sm",children:[e.jsx(L,{size:"md",radius:"md",variant:"light",children:n}),e.jsx(t,{size:"sm",c:"dimmed",fw:500,children:s})]}),e.jsxs(c,{gap:6,align:"baseline",children:[e.jsx(t,{fz:24,fw:700,lh:1,children:a}),i&&e.jsx(t,{size:"xs",c:"dimmed",children:i})]})]})}function v({walletOverview:s,user:a,paymentFlowEnabled:i}){const n=T.useMemo(()=>{if(!s)return null;const{plan:b,period:p,usage:m}=s,r=b.allowance??0,z=new Date(p.start),x=new Date(p.end),P=new Date,f=Math.max(0,m.spent||0),h=r>0?Math.min(100,f/r*100):0,M=typeof m.balance=="number"?Math.max(0,m.balance):null,D=r>0?100-h:0,k=j(P,x),N=j(z,x);return{used:f,usedPct:h,remaining:M,remainingPct:D,daysLeft:k,totalDays:N,allowance:r}},[s]),d=s&&s.plan.code!=="free";return e.jsx(C,{active:"account",email:a.email,showPlans:i,title:"Subscription",description:"Your plan, usage and renewal.",actions:s&&e.jsx(Z,{paymentFlowEnabled:i,plan:s.plan.code}),children:s?e.jsxs($,{gap:"md",children:[e.jsxs(y,{padding:"20px",children:[e.jsxs(c,{justify:"space-between",align:"flex-start",mb:"md",children:[e.jsxs("div",{children:[e.jsx(B,{variant:d?"filled":"light",color:d?"stTropaz":"gray",radius:"sm",mb:"sm",children:d?"Pro":"Current plan"}),e.jsx(t,{fz:20,fw:500,lh:1.2,children:s.plan.name}),e.jsx(t,{size:"sm",c:"dimmed",mt:4,children:s.plan.cycle==="fixed_14d"?"14-day cycle":"Monthly cycle"})]}),e.jsx(t,{size:"xs",c:"dimmed",ta:"right",children:s.subscription.effectiveAt?`Active until ${g(s.subscription.effectiveAt)}
16`:`Renews ${g(s.period.end)}`})]}),n&&n.allowance>0&&e.jsxs(e.Fragment,{children:[e.jsxs(c,{justify:"space-between",mb:6,children:[e.jsx(t,{size:"xs",c:"dimmed",children:"Tokens used"}),e.jsxs(t,{size:"xs",fw:600,children:[n.usedPct.toFixed(0),"%"]})]}),e.jsx(R,{value:n.usedPct,radius:"xl",size:"sm",color:n.usedPct>=90?"red":"jaffa"}),e.jsxs(t,{size:"xs",c:"dimmed",mt:6,children:[o(n.used)," of"," ",o(n.allowance)," tokens"]})]})]}),n&&e.jsxs(w,{cols:{base:1,xs:3},spacing:"md",children:[e.jsx(l,{label:"Tokens used",value:o(n.used),suffix:n.allowance>0?`of ${o(n.allowance)}`:void 0,icon:e.jsx(Y,{size:14})}),n.remaining!==null&&n.allowance>0&&e.jsx(l,{label:"Remaining",value:o(n.remaining),suffix:`${n.remainingPct.toFixed(0)}% left`,icon:e.jsx(E,{size:14})}),e.jsx(l,{label:"Days left",value:String(n.daysLeft),suffix:`of ${n.totalDays}`,icon:e.jsx(G,{size:14})})]})]}):e.jsx(t,{c:"dimmed",children:"No subscription data available."})})}function pe(){const{walletOverview:s,user:a,paymentFlowEnabled:i}=_(),n=(a==null?void 0:a.userId)??null;return A(n),e.jsx(v,{walletOverview:s,user:a,paymentFlowEnabled:i})}export{pe as default,ue as meta};
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.