1import{I as a}from"./5c_tYSQe.js";import{a as e,_ as s}from"./4prz3O4y.js";import{u as i,C as n}from"./D00EDRii.js";import{f as l,p as t}from"./TYGE57l9.js";import{d as r,r as c,j as o,o as d,C as u,D as p,E as v,v as h,H as m,u as k,K as g,L as f,F as w,J as y,R as b,U as _,M as x}from"./DGa90K1v.js";import"./BYTFuITp.js";import"./gunKTr2l.js";import"./fHa0IVTC.js";const j={class:"flex flex-col gap-5"},C={class:"credits-card"},L={class:"hero-numbers"},A={class:"hero-balance"},P={class:"hero-balance-value"},R={class:"hero-tier"},B={class:"hero-breakdown"},D={class:"usage-ring-wrap","aria-hidden":"true"},M={class:"usage-ring",viewBox:"0 0 36 36"},T=["stroke-dasharray"],I={class:"usage-ring-center"},O={class:"usage-ring-pct"},S={key:0,class:"credits-meta"},$={key:0,class:"credits-reset"},F={key:0},G={key:1},V={key:2},q={key:0,class:"inline-error"},E={class:"pack-grid"},H=["disabled","onClick"],J={key:0,class:"pack-badge"},K={class:"pack-icon"},U={class:"pack-name"},W={class:"pack-queries"},Y={class:"pack-price"},z={key:0},N={key:1},Q=s(r({__name:"CreditsTab",setup(s){const{credits:r,creditResetDate:Q,tierLabel:X,totalAllocation:Z,usedThisPeriod:aa,usagePercent:ea,warningLevel:sa,fetchCredits:ia}=i(),na=c(null),la=c(""),ta=c([]),ra=o(()=>ta.value.length?ta.value:n.map(a=>({id:a.id,name:a.name,credits:a.credits,price_usd_cents:Math.round(100*a.price),popular:!!a.badge})));function ca(a){return a.toLocaleString("en-GB")}function oa(a){return"pro_500"===a.id||a.popular?"Most Popular":"power_1500"===a.id?"Best Value":null}const da={plus_200:"mdi:package-variant",pro_500:"mdi:star-four-points",power_1500:"mdi:trending-up"};return d(async()=>{const a=e("token");a&&await ia(a);try{const e=await l(a||void 0);Array.isArray(e)&&e.length&&(ta.value=e)}catch{}}),(s,i)=>{const n=_("RouterLink");return x(),u("div",j,[i[7]||(i[7]=p("p",{class:"text-xs text-white/45 leading-relaxed"}," Oracle AI credits for CLAW Stealth. Top up on demand or subscribe for a monthly allowance. ",-1)),p("div",C,[p("div",{class:m(["credits-hero",["warn-"+k(sa)]])},[p("div",L,[p("div",A,[p("span",P,g(ca(k(r))),1),i[0]||(i[0]=p("span",{class:"hero-balance-unit"},"credits left",-1))]),p("div",R,[i[1]||(i[1]=p("span",{class:"hero-tier-dot"},null,-1)),p("span",null,g(k(X)),1)]),p("div",B,[p("span",null,g(ca(k(aa)))+" used",1),i[2]||(i[2]=p("span",{class:"hero-breakdown-sep"},"·",-1)),p("span",null,g(ca(k(Z)))+" this month",1)])]),p("div",D,[(x(),u("svg",M,[i[3]||(i[3]=p("circle",{class:"usage-ring-bg",cx:"18",cy:"18",r:"15.9155",fill:"none","stroke-width":"3"},null,-1)),p("circle",{class:"usage-ring-fill",cx:"18",cy:"18",r:"15.9155",fill:"none","stroke-width":"3","stroke-dasharray":`${k(ea)} ${100-k(ea)}`,"stroke-dashoffset":"25"},null,8,T)])),p("div",I,[p("span",O,[f(g(k(ea)),1),i[4]||(i[4]=p("span",{class:"usage-ring-pct-unit"},"%",-1))])])])],2),k(Q)||"ok"!==k(sa)?(x(),u("div",S,[k(Q)?(x(),u("div",$,[h(k(a),{icon:"mdi:clock-outline",width:"12"}),p("span",null," Resets "+g(new Date(k(Q)).toLocaleDateString("en-GB",{day:"numeric",month:"long"})),1)])):v("",!0),"ok"!==k(sa)?(x(),u("div",{key:1,class:m(["credits-warn-inline","warn-"+k(sa)])},[h(k(a),{icon:"mdi:alert-outline",width:"14"}),"half"===k(sa)?(x(),u("span",F,"You've used half your monthly allowance.")):"low"===k(sa)?(x(),u("span",G," Running low â "+g(Math.max(0,100-k(ea)))+"% remaining. ",1)):(x(),u("span",V,"Almost out. Top up below."))],2)):v("",!0)])):v("",!0)]),la.value?(x(),u("p",q,g(la.value),1)):v("",!0),p("div",null,[i[5]||(i[5]=p("p",{class:"packs-heading"},"On-demand top-up",-1)),p("div",E,[(x(!0),u(w,null,y(ra.value,s=>{return x(),u("button",{key:s.id,class:m(["pack-card",{"pack-popular":!!oa(s)}]),disabled:na.value===s.id,onClick:a=>async function(a){var s;const i=e("token");if(i&&!na.value){na.value=a,la.value="";try{const e=await t(i,a),n=(null==e?void 0:e.checkout_url)??(null==(s=null==e?void 0:e.data)?void 0:s.checkout_url);n?window.location.href=n:la.value=(null==e?void 0:e.message)??"Could not start checkout. Please try again."}catch{la.value="Could not reach the server. Please try again."}finally{na.value=null}}}(s.id)},[oa(s)?(x(),u("div",J,g(oa(s)),1)):v("",!0),p("div",K,[h(k(a),{icon:(n=s.id,da[n]??"mdi:package-variant"),width:"20",class:"text-[#22d3ee]"},null,8,["icon"])]),p("div",U,g(s.name),1),p("div",W,g(s.credits)+" credits",1),p("div",Y,[na.value===s.id?(x(),u("span",z,"Openingâ¦")):(x(),u("span",N,"$"+g((i=s,(i.price_usd_cents/100).toFixed(2))),1))])],10,H);var i,n}),128))])]),h(n,{to:"/account/subscriptions",class:"inline-flex items-center gap-2 text-xs font-semibold text-[#22d3ee] hover:underline w-fit"},{default:b(()=>[h(k(a),{icon:"mdi:credit-card-outline",width:"14"}),i[6]||(i[6]=f(" View subscription plans ",-1))]),_:1,__:[6]})])}}}),[["__scopeId","data-v-c0b888c0"]]);export{Q 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.