PageSourceSearch

https://docs.oceanir.ai/_next/static/chunks/1436.8d84b4460bf99ed1.js

js oceanir.ai collected 2026-09-24 14:10:39 UTC 30,516 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1436],{1436:(e,t,s)=>{s.r(t),s.d(t,{CreditBalance:()=>k,CreditBalanceCompact:()=>C,CreditPurchaseModal:()=>A,CreditUsageChart:()=>T,FeatureCosts:()=>E,QuickActions:()=>U,TransactionHistory:()=>P});var i=s(95155),a=s(12115),n=s(82301),r=s(80642),c=s(61792),l=s(92571),o=s(9005),d=s(9751),x=s(36338),m=s(93954),h=s(6073),p=s(49804),u=s(2125),f=s(76721),b=s(25097),j=s(91337),g=s(98500),N=s.n(g),y=s(73321),v=s(52873),w=s(39422),z=s(55061);function k({className:e,showStats:t=!1,onPurchaseClick:s,refreshToken:c,variant:o="default"}){let[d,x]=(0,a.useState)(0),[m,h]=(0,a.useState)(null),[p,u]=(0,a.useState)(!0),[f,b]=(0,a.useState)(""),[g,N]=(0,a.useState)(!1),[y,v]=(0,a.useState)(null),[w,C]=(0,a.useState)(null);(0,a.useEffect)(()=>{S()},[c]);let S=async()=>{try{let e=await fetch("/api/credits");if(e.ok){let t=await e.json();x(t.balance??0),h(t.stats)}}catch(e){console.error("Failed to fetch credits:",e)}finally{u(!1)}},A=async()=>{if(f.trim()){N(!0),v(null),C(null);try{let e=await (0,z.V)("/api/credits/redeem",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({code:f.trim()})}),t=await e.json();e.ok?(x(t.newBalance??d+t.credits),C(`+${t.credits} credits added`),b(""),S()):401===e.status?v("Sign in to redeem"):v(t.error||"Invalid code")}catch(e){v("Failed to redeem")}finally{N(!1)}}};return p?(0,i.jsx)("div",{className:(0,j.cn)("flex items-center justify-center py-8",e),children:(0,i.jsx)(l.A,{className:"h-4 w-4 animate-spin text-zinc-700"})}):"minimal"===o?(0,i.jsxs)("div",{className:(0,j.cn)("",e),children:[(0,i.jsxs)("div",{className:"flex items-baseline gap-2",children:[(0,i.jsx)(n.m.span,{initial:{opacity:0,scale:.95},animate:{opacity:1,scale:1},className:"text-4xl font-light text-white tabular-nums",children:d},d),(0,i.jsx)("span",{className:"text-sm text-zinc-500",children:"credits"})]}),m&&(0,i.jsxs)("p",{className:"text-xs text-zinc-600 mt-1",children:[m.totalUsed," used \xb7 ",m.totalPurchased," total"]})]}):(0,i.jsxs)("div",{className:(0,j.cn)("flex flex-col items-center",e),children:[(0,i.jsxs)(n.m.div,{initial:{opacity:0,scale:.9},animate:{opacity:1,scale:1},className:"flex items-baseline gap-4 mb-8",children:[(0,i.jsx)("span",{className:"text-[120px] sm:text-[160px] font-extralight text-white leading-none tracking-tighter",children:d}),(0,i.jsx)("span",{className:"text-lg text-zinc-600 font-light pb-4",children:"credits"})]},d),(0,i.jsx)("div",{className:"flex items-center gap-4 mb-6",children:s&&(0,i.jsx)(n.m.button,{onClick:s,whileHover:{scale:1.02},whileTap:{scale:.98},className:"px-8 py-3 text-sm font-medium bg-white text-black hover:bg-zinc-100 transition-colors",children:"Buy Credits"})}),(0,i.jsxs)("div",{className:"flex items-center gap-2 max-w-md w-full",children:[(0,i.jsx)("input",{type:"text",value:f,onChange:e=>b(e.target.value.toUpperCase()),placeholder:"PROMO CODE",className:"flex-1 px-4 py-2.5 text-xs font-mono bg-transparent border border-zinc-800 text-white placeholder-zinc-700 focus:border-zinc-600 focus:outline-none tracking-wider text-center"}),(0,i.jsx)("button",{onClick:A,disabled:g||!f.trim(),className:"px-4 py-2.5 text-xs font-medium bg-zinc-900 text-zinc-500 hover:text-white border border-zinc-800 transition-[color,background-color,border-color,opacity,box-shadow,transform,filter] disabled:opacity-40 disabled:cursor-not-allowed",children:g?(0,i.jsx)(l.A,{className:"h-3 w-3 animate-spin"}):"Apply"})]}),(0,i.jsx)(r.N,{mode:"wait",children:(y||w)&&(0,i.jsx)(n.m.p,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0},className:(0,j.cn)("text-[10px] mt-3",w?"text-white":"text-zinc-600"),children:y||w})})]})}function C({onClick:e}){let[t,s]=(0,a.useState)(null);return(0,a.useEffect)(()=>{fetch("/api/credits").then(e=>e.ok?e.json():null).then(e=>s(e?.balance??0)).catch(()=>s(0))},[]),(0,i.jsxs)("button",{onClick:e,className:"flex items-center gap-2 px-3 py-1.5 text-xs font-mono text-zinc-400 hover:text-white transition-colors",children:[(0,i.jsx)("span",{children:t??" - "}),(0,i.jsx)("span",{className:"text-zinc-700",children:"cr"})]})}let S=["10","25","50","100"].map(e=>({key:e,credits:v.C[e].credits,display:v.C[e].priceFormatted,perCredit:v.C[e].perCredit}));function A({open:e,onClose:t}){let s=(0,y.useRouter)(),[c,x]=(0,a.useState)("50"),[m,h]=(0,a.useState)(""),[p,u]=(0,a.useState)(!1),[f,b]=(0,a.useState)(null),[g,k]=(0,a.useState)(null),[C,P]=(0,a.useState)(!1),[T,U]=(0,a.useState)(!1),[E,O]=(0,a.useState)(!1),[F,M]=(0,a.useState)(""),[D,$]=(0,a.useState)(!1),[_,H]=(0,a.useState)(null),[L,B]=(0,a.useState)(null);(0,a.useEffect)(()=>{e&&(O(!0),U(!1))},[e]);let R=()=>{U(!0),setTimeout(()=>{O(!1),t()},200)};if((0,a.useEffect)(()=>{e&&(P(!0),w.yK.getSession().then(e=>{k(!!e?.data?.user?.id)}).catch(()=>{k(!1)}).finally(()=>{P(!1)}))},[e]),!E)return null;if(C||null===g)return(0,i.jsxs)("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-6",children:[(0,i.jsx)(n.m.div,{initial:{opacity:0}
1,animate:{opacity:1},className:"absolute inset-0 bg-black/80 backdrop-blur-md",onClick:t}),(0,i.jsx)(n.m.div,{initial:{opacity:0,scale:.9,y:10},animate:{opacity:1,scale:1,y:0},transition:{type:"spring",damping:25,stiffness:300},className:"relative z-10 w-full max-w-md rounded-3xl bg-gradient-to-b from-zinc-900/95 to-black/95 backdrop-blur-xl border border-white/[0.08] shadow-2xl shadow-black/50 p-10 flex items-center justify-center",children:(0,i.jsxs)("div",{className:"relative",children:[(0,i.jsx)("div",{className:"absolute inset-0 rounded-full bg-white/5 blur-xl scale-150"}),(0,i.jsx)(l.A,{className:"relative h-8 w-8 animate-spin text-zinc-500"})]})})]});if(!1===g)return(0,i.jsxs)("div",{className:"fixed inset-0 z-50 flex items-center justify-center",children:[(0,i.jsx)(n.m.div,{initial:{opacity:0},animate:{opacity:+!T},transition:{duration:.2},className:"absolute inset-0 bg-black",onClick:R}),(0,i.jsxs)(n.m.div,{initial:{opacity:0,y:20,scale:.98},animate:{opacity:+!T,y:T?-10:0,scale:T?.96:1},transition:{duration:.2,ease:"easeOut"},className:"relative z-10 w-full max-w-md mx-6",children:[(0,i.jsx)(n.m.button,{onClick:R,initial:{opacity:0}
1,animate:{opacity:+!T},transition:{delay:.3*!T,duration:.15},className:"absolute -top-12 right-0 text-[10px] font-mono uppercase tracking-[0.2em] text-zinc-700 hover:text-zinc-400 transition-colors",children:"esc"}),(0,i.jsxs)("div",{className:"text-center",children:[(0,i.jsxs)(n.m.div,{initial:{opacity:0,y:10},animate:{opacity:+!T,y:T?-5:0},transition:{delay:.1*!T,duration:.2},className:"mb-6",children:[(0,i.jsx)("h2",{className:"text-[32px] sm:text-[40px] font-light text-white leading-tight tracking-tight mb-3",children:"Sign in to continue"}),(0,i.jsx)("p",{className:"text-sm text-zinc-600",children:"Credits are linked to your account"})]}),(0,i.jsxs)(n.m.div,{initial:{opacity:0,y:10},animate:{opacity:+!T,y:5*!!T},transition:{delay:.15*!T,duration:.2},className:"flex flex-col items-center gap-4 mt-10",children:[(0,i.jsxs)(n.m.button,{onClick:()=>{s.push("/auth?callbackUrl=/settings?purchase=true"),R()},whileHover:{scale:1.02},whileTap:{scale:.98},className:"group relative bg-white text-black px-10 py-3.5 rounded-lg text-sm font-medium tracking-wide overflow-hidden transition-[color,background-color,border-color,opacity,box-shadow,transform,filter] duration-300 hover:shadow-[0_0_30px_rgba(255,255,255,0.15)]",children:[(0,i.jsx)("span",{className:"relative z-10",children:"Sign In"}),(0,i.jsx)("div",{className:"absolute inset-0 bg-gradient-to-r from-transparent via-white/20 to-transparent -translate-x-full group-hover:translate-x-full transition-transform duration-700"})]}),(0,i.jsx)("button",{onClick:R,className:"text-xs text-zinc-700 hover:text-zinc-500 transition-colors py-2",children:"Cancel"})]}),(0,i.jsx)(n.m.p,{initial:{opacity:0}
1,animate:{opacity:+!T},transition:{delay:.2*!T,duration:.15},className:"text-[10px] text-zinc-800 mt-16",children:"Secure checkout via Stripe"})]})]})]});let G=m?Math.floor(100*parseFloat(m)/v.kE):0,I=async()=>{if(F.trim()){$(!0),H(null),B(null);try{let e=await (0,z.V)("/api/credits/redeem",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({code:F.trim()})}),t=await e.json();e.ok?(B(`+${t.credits} credits added`),M("")):H(401===e.status?"Sign in to redeem":t.error||"Invalid code")}catch{H("Failed to redeem")}finally{$(!1)}}},J=async()=>{u(!0),b(null);try{let e={successUrl:`${window.location.origin}/settings?success=true`,cancelUrl:`${window.location.origin}/settings?cancelled=true`,callbackUrl:"/settings?purchase=true",from:"settings-credits"};if("custom"===c){let t=parseFloat(m);if(!t||t<1)throw Error("Minimum $1.00");e.customAmount=t}else e.credits=c;let t=await fetch("/api/stripe/checkout",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)}),s=await t.json();if(401===t.status&&s?.loginUrl){window.location.href=s.loginUrl;return}if(s.checkoutUrl)window.location.href=s.checkoutUrl;else throw Error(s.error||"Failed")}catch(e){b(e instanceof Error?e.message:"Failed"),u(!1)}},W=S.find(e=>e.key===c);return(0,i.jsxs)("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-3 sm:p-4",children:[(0,i.jsx)(n.m.div,{initial:{opacity:0}
1,animate:{opacity:+!T},transition:{duration:.2},className:"absolute inset-0 bg-black/70 backdrop-blur-[2px]",onClick:R}),(0,i.jsxs)(n.m.div,{initial:{opacity:0,y:18,scale:.98},animate:{opacity:+!T,y:18*!!T,scale:T?.97:1},transition:{duration:.2,ease:"easeOut"},className:"relative z-10 w-full max-w-[420px] max-h-[86dvh] bg-black/95 border border-white/[0.08] rounded-xl overflow-hidden shadow-2xl shadow-black/60",children:[(0,i.jsxs)("div",{className:"flex items-center justify-between px-5 pt-5 pb-2",children:[(0,i.jsx)("h2",{className:"text-lg font-light text-white tracking-tight",children:"Get Credits"}),(0,i.jsx)("button",{"aria-label":"Close",onClick:R,className:"p-1.5 -mr-1.5 text-zinc-600 hover:text-white transition-colors rounded-full hover:bg-zinc-900/50",children:(0,i.jsx)(o.A,{className:"h-4 w-4"})})]}),(0,i.jsxs)("div",{className:"max-h-[calc(86dvh-60px)] overflow-y-auto px-5 pb-5 pt-2 overscroll-contain",children:[(0,i.jsxs)("div",{className:"space-y-2",children:[S.map(e=>{let t=c===e.key;return(0,i.jsxs)(n.m.button,{onClick:()=>x(e.key),whileHover:{scale:1.01},whileTap:{scale:.99},className:(0,j.cn)("w-full flex items-center justify-between px-4 py-3 rounded-lg transition-[color,background-color,border-color,opacity,box-shadow,transform,filter] duration-200",t?"bg-white text-black":"bg-zinc-900/60 hover:bg-zinc-900 text-white"),children:[(0,i.jsxs)("div",{className:"flex items-center gap-3",children:[(0,i.jsx)("div",{className:(0,j.cn)("h-2 w-2 rounded-full transition-[color,background-color,border-color,opacity,box-shadow,transform,filter] duration-200",t?"bg-black scale-100":"bg-zinc-700 scale-75")}),(0,i.jsxs)("span",{className:"text-sm font-normal",children:[e.credits," credits"]}),(0,i.jsxs)("span",{className:(0,j.cn)("hidden sm:inline text-[11px]",t?"text-black/50":"text-zinc-600"),children:[e.perCredit,"/cr"]})]}),(0,i.jsx)("span",{className:(0,j.cn)("text-sm tabular-nums",t?"font-medium":"font-light text-zinc-400"),children:e.display})]},e.key)}),(0,i.jsxs)(n.m.button,{onClick:()=>x("custom"),whileHover:{scale:1.01},whileTap:{scale:.99},className:(0,j.cn)("w-full flex items-center justify-between px-4 py-3 rounded-lg transition-[color,background-color,border-color,opacity,box-shadow,transform,filter] duration-200","custom"===c?"bg-white text-black":"bg-zinc-900/60 hover:bg-zinc-900 text-white"),children:[(0,i.jsxs)("div",{className:"flex items-center gap-3",children:[(0,i.jsx)("div",{className:(0,j.cn)("h-2 w-2 rounded-full transition-[color,background-color,border-color,opacity,box-shadow,transform,filter] duration-200","custom"===c?"bg-black scale-100":"bg-zinc-700 scale-75")}),(0,i.jsx)("span",{className:"text-sm font-normal",children:"Custom amount"})]}),(0,i.jsxs)("span",{className:(0,j.cn)("text-xs","custom"===c?"text-black/50":"text-zinc-600"),children:["$",(v.kE/100).toFixed(2),"/credit"]})]}),(0,i.jsx)(r.N,{children:"custom"===c&&(0,i.jsxs)(n.m.div,{initial:{opacity:0}
1,animate:{opacity:1},exit:{opacity:0},className:"overflow-hidden",children:[(0,i.jsxs)("div",{className:"pt-2 flex items-center gap-2.5",children:[(0,i.jsx)("span",{className:"text-base text-zinc-500",children:"$"}),(0,i.jsx)("input",{type:"number",min:"1",step:"0.01",placeholder:"0.00",value:m,onChange:e=>h(e.target.value),className:"flex-1 bg-zinc-900/60 rounded-lg px-4 py-3 text-sm tabular-nums text-white placeholder:text-zinc-700 focus:outline-none focus:ring-1 focus:ring-zinc-700"})]}),m&&parseFloat(m)>=1&&(0,i.jsxs)("p",{className:"text-xs text-zinc-500 mt-2 text-right pr-1",children:["≈ ",G," credits"]})]})})]}),(0,i.jsxs)("div",{className:"mt-5 pt-4 border-t border-zinc-900/70",children:[(0,i.jsxs)("div",{className:"flex items-end justify-between mb-4",children:[(0,i.jsxs)("div",{children:[(0,i.jsx)("p",{className:"text-xs text-zinc-500 mb-1",children:"Total"}),(0,i.jsx)("p",{className:"text-2xl font-light text-white tracking-tight",children:"custom"===c?m&&parseFloat(m)>=1?`$${parseFloat(m).toFixed(2)}`:"$0":W?.display})]}),(0,i.jsxs)("div",{className:"text-right",children:[(0,i.jsx)("p",{className:"text-xs text-zinc-500 mb-1",children:"Credits"}),(0,i.jsx)("p",{className:"text-xl font-light text-zinc-400 tabular-nums",children:"custom"===c?G||0:W?.credits})]})]}),f&&(0,i.jsx)("p",{className:"text-xs text-red-400/80 mb-4",children:f}),(0,i.jsx)(n.m.button,{onClick:J,disabled:p||"custom"===c&&(!m||1>parseFloat(m)),whileHover:{scale:1.01},whileTap:{scale:.98},className:(0,j.cn)("w-full py-3.5 rounded-lg text-sm font-medium transition-[color,background-color,border-color,opacity,box-shadow,transform,filter] duration-200",p||"custom"===c&&(!m||1>parseFloat(m))?"bg-zinc-900 text-zinc-600 cursor-not-allowed":"bg-white text-black hover:bg-zinc-100"),children:p?(0,i.jsxs)("span",{className:"flex items-center justify-center gap-2",children:[(0,i.jsx)(l.A,{className:"h-4 w-4 animate-spin"}),"Processing"]}):"Continue to Payment"})]}),(0,i.jsxs)("div",{className:"mt-3",children:[(0,i.jsxs)("div",{className:"flex items-center gap-2",children:[(0,i.jsx)("input",{type:"text",value:F,onChange:e=>{M(e.target.value.toUpperCase()),H(null),B(null)},onKeyDown:e=>"Enter"===e.key&&I(),placeholder:"PROMO CODE",className:"flex-1 min-w-0 px-3 py-2.5 text-[11px] font-mono bg-zinc-900/60 border border-zinc-800 text-white placeholder-zinc-700 focus:border-zinc-600 focus:outline-none tracking-widest rounded-lg"}),(0,i.jsx)("button",{onClick:I,disabled:D||!F.trim(),className:"px-3 py-2.5 text-[11px] font-mono bg-zinc-900/60 text-zinc-500 hover:text-white border border-zinc-800 rounded-lg transition-[color,background-color,border-color,opacity,box-shadow,transform,filter] disabled:opacity-40 disabled:cursor-not-allowed whitespace-nowrap",children:D?(0,i.jsx)(l.A,{className:"h-3 w-3 animate-spin"}):"Apply"})]}),(0,i.jsx)(r.N,{mode:"wait",children:(_||L)&&(0,i.jsx)(n.m.p,{initial:{opacity:0,y:-4},animate:{opacity:1,y:0},exit:{opacity:0},className:(0,j.cn)("text-[10px] mt-2 pl-1",L?"text-zinc-400":"text-red-400/80"),children:_||L})})]}),(0,i.jsxs)("div",{className:"mt-2 grid grid-cols-2 gap-2",children:[(0,i.jsxs)(N(),{href:"/pricing",onClick:R,className:"flex items-center justify-between px-3 py-2.5 bg-zinc-900/40 hover:bg-zinc-900/70 rounded-lg transition-[color,background-color,border-color,opacity,box-shadow,transform,filter] duration-200 group",children:[(0,i.jsxs)("div",{className:"flex flex-col gap-0.5",children:[(0,i.jsx)("p",{className:"text-[11px] font-mono uppercase tracking-[0.12em] text-zinc-500 group-hover:text-white transition-colors",children:"Pro"}),(0,i.jsx)("p",{className:"text-[10px] text-zinc-700 group-hover:text-zinc-400 transition-colors",children:"More analysis"})]}),(0,i.jsx)(d.A,{className:"w-3.5 h-3.5 text-zinc-700 group-hover:text-white transition-colors flex-shrink-0"})]}),(0,i.jsxs)(N(),{href:"/unit",onClick:R,className:"flex items-center justify-between px-3 py-2.5 bg-zinc-900/40 hover:bg-zinc-900/70 rounded-lg transition-[color,background-color,border-color,opacity,box-shadow,transform,filter] duration-200 group",children:[(0,i.jsxs)("div",{className:"flex flex-col gap-0.5",children:[(0,i.jsx)("p",{className:"text-[11px] font-mono uppercase tracking-[0.12em] text-zinc-500 group-hover:text-white transition-colors",children:"Unit"}),(0,i.jsx)("p",{className:"text-[10px] text-zinc-700 group-hover:text-zinc-400 transition-colors",children:"Shared credits"})]}),(0,i.jsx)(d.A,{className:"w-3.5 h-3.5 text-zinc-700 group-hover:text-white transition-colors flex-shrink-0"})]})]}),(0,i.jsx)("p",{className:"mt-3 text-[10px] text-zinc-600 text-center",children:"Secure checkout via Stripe \xb7 Credits never expire"})]})]})]})}function P({limit:e=10,refreshToken:t,variant:s="default"}){let r,[c,l]=(0,a.useState)([]),[o,d]=(0,a.useState)(!0),[p,u]=(0,a.useState)("all"),[f,b]=(0,a.useState)(1),g=(0,a.useRef)(null);if((0,a.useEffect)(()=>{fetch("/api/credits").then(e=>e.ok?e.json():{recentTransactions:[]}).then(e=>l(e.recentTransactions||[])).finally(()=>d(!1))},[t]),o)return(0,i.jsx)("div",{className:"flex items-center justify-center py-16",children:(0,i.jsxs)("div",{className:"flex items-center gap-3",children:[(0,i.jsx)("div",{className:"h-1.5 w-1.5 rounded-full bg-zinc-600 animate-pulse"}),(0,i.jsx)("span",{className:"text-[10px] text-zinc-600 uppercase tracking-[0.3em]",children:"Loading"})]})});if(0===c.length)return(0,i.jsx)("div",{className:"relative py-16",children:(0,i.jsxs)("div",{className:"flex flex-col items-center",children:[(0,i.jsxs)("div",{className:"relative mb-6",children:[(0,i.jsx)("div",{className:"absolute inset-0 bg-zinc-800/20 blur-xl rounded-full"}),(0,i.jsx)("div",{className:"relative h-16 w-16 rounded-full border border-zinc-800 flex items-center justify-center",children:(0,i.jsx)(x.A,{className:"h-6 w-6 text-zinc-700"})})]}),(0,i.jsx)("p",{className:"text-sm text-zinc-500 mb-1",children:"No activity yet"}),(0,i.jsx)("p",{className:"text-[10px] text-zinc-700",children:"Transactions will appear here"})]})});let N=c.filter(e=>e.amount>0),y=c.filter(e=>e.amount<0),v=N.reduce((e,t)=>
1e+t.amount,0),w=Math.abs(y.reduce((e,t)=>e+t.amount,0)),z="all"===p?c:"earned"===p?N:y,k=Math.ceil(z.length/10),C=(f-1)*10,S=(r={},z.slice(C,C+10).forEach(e=>{let t=new Date(e.createdAt).toLocaleDateString("en-US",{month:"short",day:"numeric"});r[t]||(r[t]=[]),r[t].push(e)}),r);return"compact"===s?(0,i.jsxs)("div",{className:"space-y-1",children:[c.slice(0,e).map((e,t)=>{let s=e.amount>0,a=new Date(e.createdAt).toLocaleDateString("en-US",{month:"short",day:"numeric"});return(0,i.jsxs)("div",{className:"flex items-center justify-between py-2 px-1 text-sm",children:[(0,i.jsxs)("div",{className:"flex items-center gap-3 min-w-0 flex-1",children:[(0,i.jsx)("div",{className:(0,j.cn)("flex-shrink-0 h-1.5 w-1.5 rounded-full",s?"bg-zinc-500":"bg-zinc-600")}),(0,i.jsx)("span",{className:"text-zinc-400 truncate",children:e.description})]}),(0,i.jsxs)("div",{className:"flex items-center gap-3 flex-shrink-0",children:[(0,i.jsx)("span",{className:"text-xs text-zinc-600",children:a}),(0,i.jsxs)("span",{className:(0,j.cn)("font-mono text-sm tabular-nums","text-zinc-500"),children:[s?"+":"",e.amount]})]})]},e.id)}),0===c.length&&(0,i.jsx)("p",{className:"text-sm text-zinc-600 py-4 text-center",children:"No transactions yet"})]}):(0,i.jsxs)("div",{ref:g,className:"relative",children:[(0,i.jsxs)("div",{className:"flex items-center gap-1 p-1.5 bg-zinc-950 border-b border-zinc-900",children:[(0,i.jsxs)("button",{onClick:()=>{u("all"),b(1)},className:(0,j.cn)("flex-1 px-3 py-2 text-[11px] font-medium transition-[color,background-color,border-color,opacity,box-shadow,transform,filter] rounded-sm","all"===p?"bg-zinc-800 text-white":"text-zinc-500 hover:text-zinc-300"),children:["All",(0,i.jsx)("span",{className:"ml-1.5 text-[10px] font-mono opacity-60",children:c.length})]}),(0,i.jsx)("button",{onClick:()=>{u("earned"),b(1)},className:(0,j.cn)("flex-1 px-3 py-2 text-[11px] font-medium transition-[color,background-color,border-color,opacity,box-shadow,transform,filter] rounded-sm","earned"===p?"bg-zinc-950/50 text-zinc-400 border border-zinc-900/50":"text-zinc-500 hover:text-zinc-300"),children:(0,i.jsxs)("span",{className:"flex items-center justify-center gap-1.5",children:[(0,i.jsx)(m.A,{className:"h-3 w-3"}),"Earned",(0,i.jsxs)("span",{className:"text-[10px] font-mono opacity-60",children:["+",v]})]})}),(0,i.jsx)("button",{onClick:()=>{u("spent"),b(1)},className:(0,j.cn)("flex-1 px-3 py-2 text-[11px] font-medium transition-[color,background-color,border-color,opacity,box-shadow,transform,filter] rounded-sm","spent"===p?"bg-zinc-800 text-zinc-300":"text-zinc-500 hover:text-zinc-300"),children:(0,i.jsxs)("span",{className:"flex items-center justify-center gap-1.5",children:[(0,i.jsx)(h.A,{className:"h-3 w-3"}),"Used",(0,i.jsxs)("span",{className:"text-[10px] font-mono opacity-60",children:["-",w]})]})})]}),(0,i.jsxs)("div",{className:"max-h-[500px] overflow-y-auto",children:[Object.entries(S).map(([e,t],s)=>(0,i.jsxs)("div",{children:[(0,i.jsx)("div",{className:"sticky top-0 z-10 px-4 py-2 bg-zinc-950/95 backdrop-blur-sm border-b border-zinc-900/50",children:(0,i.jsx)("span",{className:"text-[10px] font-mono text-zinc-600 uppercase tracking-wider",children:e})}),t.map((e,a)=>{let r=e.amount>0;return(0,i.jsxs)(n.m.div,{initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:(s*t.length+a)*.02,duration:.2},className:(0,j.cn)("group flex items-center justify-between px-4 py-3 transition-colors duration-150","hover:bg-zinc-900/30",!r&&"opacity-60 hover:opacity-100"),children:[(0,i.jsxs)("div",{className:"flex items-center gap-3 min-w-0 flex-1",children:[(0,i.jsx)("div",{className:(0,j.cn)("flex-shrink-0 h-1.5 w-1.5 rounded-full",r?"bg-zinc-500":"bg-zinc-600")}),(0,i.jsx)("p",{className:(0,j.cn)("text-sm truncate transition-colors",r?"text-zinc-300 group-hover:text-white":"text-zinc-500 group-hover:text-zinc-400"),children:e.description})]}),(0,i.jsx)("div",{className:"flex-shrink-0 pl-4",children:(0,i.jsxs)("span",{className:(0,j.cn)("text-sm font-mono tabular-nums",r?"text-zinc-500":"text-zinc-600"),children:[r?"+":"",e.amount]})})]},e.id)})]},e)),k>1&&(0,i.jsxs)("div",{className:"flex items-center justify-between px-4 py-3 border-t border-zinc-900/50",children:[(0,i.jsx)("button",{onClick:()=>b(e=>Math.max(1,e-1)),disabled:1===f,className:"text-[11px] text-zinc-500 hover:text-white disabled:opacity-30 disabled:hover:text-zinc-500 transition-colors",children:"← Previous"}),(0,i.jsxs)("span",{className:"text-[10px] font-mono text-zinc-600",children:["Page ",f," of ",k]}),(0,i.jsx)("button",{onClick:()=>b(e=>Math.min(k,e+1)),disabled:f===k,className:"text-[11px] text-zinc-500 hover:text-white disabled:opacity-30 disabled:hover:text-zinc-500 transition-colors",children:"Next →"})]})]}),0===z.length&&(0,i.jsx)("div",{className:"py-12 text-center",children:(0,i.jsx)("p",{className:"text-sm text-zinc-600",children:"earned"===p?"No credits earned yet":"No credits used yet"})})]})}function T({className:e}){let[t,s]=(0,a.useState)(null),[r,l]=(0,a.useState)(!0),o=(0,a.useRef)(null),d=(0,c.W)(o,{once:!0});if((0,a.useEffect)(()=>{fetch("/api/credits").then(e=>e.ok?e.json():null).then(e=>{e&&s({balance:e.balance??0,totalPurchased:e.stats?.totalPurchased??e.balance??0,totalUsed:e.stats?.totalUsed??0})}).finally(()=>l(!1))},[]),r)return(0,i.jsx)("div",{className:(0,j.cn)("flex items-center justify-center py-12",e),children:(0,i.jsx)("div",{className:"h-1.5 w-1.5 rounded-full bg-zinc-700 animate-pulse"})});let x=t?t.totalPurchased:0,m=t?t.totalUsed:0,h=t?t.balance:0,u=x>0?Math.min(m/x*100,100):0,f=60*Math.PI,b=f-u/100*f;return(0,i.jsxs)("div",{ref:o,className:(0,j.cn)("space-y-6",e),children:[(0,i.jsxs)("div",{className:"flex flex-col items-center py-4",children:[(0,i.jsxs)("div",{className:"relative",children:[(0,i.jsxs)("svg",{width:"140",height:"80",className:"overflow-visible",children:[(0,i.jsx)("path",{d:"M 10 70 A 60 60 0 0 1 130 70",fill:"none",stroke:"currentColor",strokeWidth:6,className:"text-zinc-900",strokeLinecap:"round"}),(0,i.jsx)(n.m.path,{d:"M 10 70 A 60 60 0 0 1 130 70",fill:"none",stroke:"url
1(#usageGradient)",strokeWidth:6,strokeLinecap:"round",initial:{strokeDasharray:f,strokeDashoffset:f},animate:d?{strokeDashoffset:b}:{},transition:{duration:1.5,ease:"easeOut",delay:.2},style:{strokeDasharray:f}}),(0,i.jsx)("defs",{children:(0,i.jsxs)("linearGradient",{id:"usageGradient",x1:"0%",y1:"0%",x2:"100%",y2:"0%",children:[(0,i.jsx)("stop",{offset:"0%",stopColor:"#ffffff",stopOpacity:"0.9"}),(0,i.jsx)("stop",{offset:"100%",stopColor:"#a1a1aa",stopOpacity:"0.5"})]})})]}),(0,i.jsx)("div",{className:"absolute inset-0 flex flex-col items-center justify-end pb-1",children:(0,i.jsxs)(n.m.span,{initial:{opacity:0,scale:.8},animate:d?{opacity:1,scale:1}:{},transition:{delay:.5},className:"text-3xl font-extralight text-white tabular-nums",children:[Math.round(u),"%"]})})]}),(0,i.jsxs)("div",{className:"flex items-center justify-center gap-8 mt-4",children:[(0,i.jsxs)("div",{className:"flex items-center gap-2",children:[(0,i.jsx)("div",{className:"h-2 w-2 rounded-full bg-white/80"}),(0,i.jsxs)("span",{className:"text-[10px] text-zinc-500",children:[(0,i.jsx)("span",{className:"font-mono text-zinc-400",children:m})," used"]})]}),(0,i.jsxs)("div",{className:"flex items-center gap-2",children:[(0,i.jsx)("div",{className:"h-2 w-2 rounded-full bg-zinc-700"}),(0,i.jsxs)("span",{className:"text-[10px] text-zinc-500",children:[(0,i.jsx)("span",{className:"font-mono text-zinc-400",children:h})," left"]})]})]})]}),(0,i.jsx)("div",{className:"h-px bg-gradient-to-r from-transparent via-zinc-800 to-transparent"}),(0,i.jsxs)("div",{className:"relative overflow-hidden rounded-xl border border-zinc-800/50 bg-zinc-950/50",children:[(0,i.jsx)("div",{className:"absolute top-0 right-0 h-16 w-16 bg-gradient-to-bl from-zinc-800/20 to-transparent"}),(0,i.jsxs)("div",{className:"relative p-4",children:[(0,i.jsxs)("div",{className:"flex items-center gap-3 mb-4",children:[(0,i.jsx)("div",{className:"h-8 w-8 rounded-lg bg-zinc-900 border border-zinc-800 flex items-center justify-center",children:(0,i.jsx)(p.A,{className:"h-3.5 w-3.5 text-zinc-500"})}),(0,i.jsxs)("div",{children:[(0,i.jsx)("p",{className:"text-sm text-white font-medium",children:"Analysis Cost"}),(0,i.jsx)("p",{className:"text-[10px] text-zinc-600",children:"Per geo-estimation request"})]}),(0,i.jsxs)("div",{className:"ml-auto",children:[(0,i.jsx)("span",{className:"text-2xl font-extralight text-white",children:"2"}),(0,i.jsx)("span",{className:"text-[10px] text-zinc-600 ml-1",children:"cr"})]})]}),(0,i.jsxs)("div",{className:"grid grid-cols-2 gap-3",children:[(0,i.jsxs)("div",{className:"p-3 rounded bg-zinc-900/50 border border-zinc-800/50",children:[(0,i.jsx)("p",{className:"text-[9px] text-zinc-600 uppercase tracking-wider mb-1",children:"Daily Free"}),(0,i.jsx)("p",{className:"text-lg font-light text-zinc-300",children:v.gZ}),(0,i.jsxs)("p",{className:"text-[9px] text-zinc-700 mt-0.5",children:["≈"," ",Math.floor(v.gZ/v.w9.location_analysis)," ","locations"]})]}),(0,i.jsxs)("div",{className:"p-3 rounded bg-zinc-900/50 border border-zinc-800/50",children:[(0,i.jsx)("p",{className:"text-[9px] text-zinc-600 uppercase tracking-wider mb-1",children:"Per Location"}),(0,i.jsx)("p",{className:"text-lg font-light text-zinc-300",children:v.w9.location_analysis}),(0,i.jsx)("p",{className:"text-[9px] text-zinc-700 mt-0.5",children:"credits"})]})]})]})]})]})}function U({onPurchaseClick:e}){return(0,i.jsxs)("div",{className:"space-y-2",children:[(0,i.jsxs)(n.m.button,{onClick:e,whileHover:{scale:1.01},whileTap:{scale:.99},className:"group w-full relative overflow-hidden",children:[(0,i.jsx)("div",{className:"absolute inset-0 bg-gradient-to-r from-white to-zinc-100 opacity-0 group-hover:opacity-100 transition-opacity duration-300"}),(0,i.jsxs)("div",{className:"relative flex items-center justify-between p-4 bg-white text-black transition-colors",children:[(0,i.jsxs)("div",{className:"flex items-center gap-3",children:[(0,i.jsx)("div",{className:"h-8 w-8 rounded bg-black/5 flex items-center justify-center",children:(0,i.jsx)(u.A,{className:"h-4 w-4"})}),(0,i.jsx)("span",{className:"text-sm font-medium",children:"Buy Credits"})]}),(0,i.jsx)(f.A,{className:"h-4 w-4 transition-transform group-hover:translate-x-1"})]})]}),(0,i.jsxs)(N(),{href:"/pricing",className:"group flex items-center justify-between p-4 border border-zinc-800 hover:border-zinc-700 bg-zinc-950/50 hover:bg-zinc-900/50 transition-[color,background-color,border-color,opacity,box-shadow,transform,filter]",children:[(0,i.jsxs)("div",{className:"flex items-center gap-3",children:[(0,i.jsx)("div",{className:"h-8 w-8 rounded border border-zinc-800 flex items-center justify-center group-hover:border-zinc-700 transition-colors",children:(0,i.jsx)(x.A,{className:"h-3.5 w-3.5 text-zinc-600 group-hover:text-zinc-400 transition-colors"})}),(0,i.jsx)("span",{className:"text-sm text-zinc-400 group-hover:text-white transition-colors",children:"Pricing Details"})]}),(0,i.jsx)(f.A,{className:"h-4 w-4 text-zinc-700 group-hover:text-zinc-400 group-hover:translate-x-1 transition-[color,background-color,border-color,opacity,box-shadow,transform,filter]"})]}),(0,i.jsxs)(N(),{href:"/pricing#team-note",className:"group flex items-center justify-between p-4 border border-zinc-800 hover:border-zinc-700 bg-zinc-950/50 hover:bg-zinc-900/50 transition-[color,background-color,border-color,opacity,box-shadow,transform,filter]",children:[(0,i.jsxs)("div",{className:"flex items-center gap-3",children:[(0,i.jsx)("div",{className:"h-8 w-8 rounded border border-zinc-800 flex items-center justify-center group-hover:border-zinc-700 transition-colors",children:(0,i.jsx)(b.A,{className:"h-3.5 w-3.5 text-zinc-600 group-hover:text-zinc-400 transition-colors"})}),(0,i.jsx)("span",{className:"text-sm text-zinc-400 group-hover:text-white transition-colors",children:"Team Note"})]}),(0,i.jsx)(f.A,{className:"h-4 w-4 text-zinc-700 group-hover:text-zinc-400 group-hover:translate-x-1 transition-[color,background-color,border-color,opacity,box-shadow,transform,filter]"})]})]})}function E(){return(0,i.jsx)(T,{})}}}]);

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.