1import{k as H,xt as I,xu as S,xv as E,a as T,xw as L,r as z,m as e,Pa as R,Pb as A,Gy as m,GD as x,Pc as M,Gz as g,GA as b,Pd as G,Pe as U,p as q,a5 as f,Pf as F,Pg as W,Ph as y,Pi as K,a3 as u,Pj as $,O as Q,R as _,Pk as Z,LP as J,Pl as V,OH as p,Pm as X,Pn as Y,Po as ee,Pp as se,Pq as ae,Pr as ie,Ps as re,MR as le,Pt as ne,Pu as te,Pv as de,Pw as ce,O$ as oe,P0 as me,Og as xe,Oh as ue,Oi as he,Oc as ge,Oj as be,Ok as _e,Ol as pe,Om as je,On as fe,Oo as ye,Op as Ne,Oq as ve,Or as Pe,Os as Ce,Of as we,Od as Oe,Oe as ke,Px as Be,Py as De}from"./main-BVeaUmEJ.js";import{D as He}from"./credit-packs-section-BgAl92--.js";import{h as Ie,a as N,f as c,e as Se,i as Ee}from"./billing-model-uylJWD-X.js";import{a as Te}from"./customer-portal-button-B1kmK7Nc.js";import{B as d}from"./badge-jVzWArNv.js";import{E as v,a as P,b as C,c as w,d as O}from"./empty-CAPKPhtk.js";import{S as t}from"./skeleton-ChuuxPGC.js";import{T as Le,a as ze,b as j,c as l,d as Re,e as n}from"./table-D0Xxh5zF.js";import"./app.schema-B-SAvJF5.js";import{D as Ae}from"./dashboard-CH0acUo_.js";import{I as h}from"./IconReceipt-CkGpGqDC.js";import{D as Me}from"./dashboard-layout-CHxiVnU7.js";const Ge=[["path",{d:"M17 8v-3a1 1 0 0 0 -1 -1h-10a2 2 0 0 0 0 4h12a1 1 0 0 1 1 1v3m0 4v3a1 1 0 0 1 -1 1h-12a2 2 0 0 1 -2 -2v-12",key:"svg-0"}
1],["path",{d:"M20 12v4h-4a2 2 0 0 1 0 -4h4",key:"svg-1"}]],Ue=H("outline","wallet","Wallet",Ge),qe=I({method:"GET"}).middleware([S]).handler(E("db51a6c02f3d4af31761ad2a7591edce2c9ec537bae6f29191b7f6204ad13e98")),Fe={detail:(s,r,a)=>["dashboard","billing",s??"anonymous",r,a]};function We(s=0,r=Ae){const{data:a}=T.useSession(),i=a?.user?.id;return L({queryKey:Fe.detail(i,s,r),queryFn:()=>qe({data:{paymentHistoryPageIndex:s,paymentHistoryPageSize:r}}),enabled:!!i,refetchOnWindowFocus:!0})}function Ke(){return e.jsxs("div",{className:"flex flex-col gap-4 lg:gap-6",children:[e.jsxs("div",{className:"grid grid-cols-1 gap-4 @5xl/main:grid-cols-2",children:[e.jsx(t,{className:"h-72 w-full rounded-xl"}),e.jsx(t,{className:"h-72 w-full rounded-xl"})]}),e.jsxs("div",{className:"grid grid-cols-1 gap-4 @3xl/main:grid-cols-3",children:[e.jsx(t,{className:"h-64 w-full rounded-xl"}),e.jsx(t,{className:"h-64 w-full rounded-xl"}),e.jsx(t,{className:"h-64 w-full rounded-xl"})]}),e.jsx(t,{className:"h-80 w-full rounded-xl"})]})}function $e({description:s,title:r}){return e.jsx(m,{className:"shadow-sm",children:e.jsx(x,{children:e.jsx(v,{className:"min-h-64 border border-dashed",children:e.jsxs(P,{children:[e.jsx(C,{variant:"icon",children:e.jsx(h,{className:"size-4"})}),e.jsx(w,{children:r}),s?e.jsx(O,{children:s}):null]})})})})}function Qe(s){return s==="subscription"?Oe():ke()}function Ze(s){return s==="year"?Pe():Ce()}function k(s){return s==="active"?xe():s==="trialing"?ue():s==="completed"?he():s==="processing"?ge():s==="canceled"?be():s==="failed"?_e():s==="incomplete"?pe():s==="incomplete_expired"?je():s==="past_due"?fe():s==="paused"?ye():s==="refunded"?Ne():s==="unpaid"?ve():s}function B(s){return s==="active"||s==="trialing"||s==="completed"?"bg-accent-emerald-bg text-accent-emerald":s==="processing"||s==="incomplete"?"bg-accent-sky-bg text-accent-sky":s==="canceled"||s==="refunded"?"bg-accent-orange-bg text-accent-orange":"bg-destructive/10 text-destructive"}function o(s){return Se(s)??we()}function Je({subscription:s}){const r=Ie(s)??M();return e.jsxs(m,{className:"min-h-72 shadow-sm",children:[e.jsx(g,{children:e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx(b,{children:G()}),e.jsx("p",{className:"mt-2 text-sm text-muted-foreground",children:U()})]}),e.jsx("div",{className:"flex size-11 shrink-0 items-center justify-center rounded-lg bg-primary/10 text-primary",children:e.jsx(q,{className:"size-5"})})]})}),e.jsxs(x,{className:"flex flex-1 flex-col gap-5",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-4xl font-semibold tracking-tight",children:r}),s?e.jsxs("div",{className:"mt-3 flex flex-wrap items-center gap-2",children:[e.jsx(d,{className:f(B(s.status)),variant:"outline",children:k(s.status)}),e.jsx(d,{variant:"secondary",children:Ze(s.interval)}),s.cancelAtPeriodEnd?e.jsx(d,{className:"bg-accent-orange-bg text-accent-orange",children:F()}):null]}):e.jsx("p",{className:"mt-3 text-sm text-muted-foreground",children:W()})]}),s?e.jsxs("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-2",children:[e.jsxs("div",{className:"rounded-lg border bg-background p-4",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:y()}),e.jsx("p",{className:"mt-2 text-2xl font-semibold tabular-nums",children:N(s.amount,s.currency)})]}),e.jsxs("div",{className:"rounded-lg border bg-background p-4",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:K()}),e.jsx("p",{className:"mt-2 text-2xl font-semibold tabular-nums",children:o(s.currentPeriodEnd)})]})]}):null,e.jsxs("div",{className:"mt-auto flex flex-wrap gap-2",children:[e.jsx(u,{render:e.jsx(Q,{to:_.Pricing}),children:$()}),s?.customerId?e.jsx(Te,{returnUrl:J(_.DashboardBilling),variant:"outline",children:Z()}):null]})]})]})}function Ve({data:s}){const r=s.usage.periodCreditsUsed,a=s.usage.periodCreditsLimit,i=Ee(r,a);return e.jsxs(m,{className:"min-h-72 shadow-sm",children:[e.jsx(g,{children:e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx(b,{children:V()}),e.jsx("p",{className:"mt-2 text-sm text-muted-foreground",children:p()})]}),e.jsx("div",{className:"flex size-11 shrink-0 items-center justify-center rounded-lg bg-accent-violet-bg text-accent-violet",children:e.jsx(Ue,{className:"size-5"})})]})}),e.jsxs(x,{className:"flex flex-1 flex-col gap-5",children:[e.jsxs("div",{children:[e.jsxs("div",{className:"text-4xl font-semibold tracking-tight tabular-nums",children:[r===null?"0":c(r),e.jsxs("span",{className:"text-xl text-muted-foreground",children:[" ","/ ",a===null?"0":c(a)]})]}),e.jsx("p",{className:"mt-3 text-sm text-muted-foreground",children:s.subscription?X({end:o(s.subscription.currentPeriodEnd),start:o(s.subscription.currentPeriodStart)}):Y()})]}),e.jsxs("div",{className:"flex flex-wrap gap-3",children:[e.jsx("div",{className:"text-sm font-medium",children:ee()}),e.jsxs("div",{className:"ml-auto text-sm text-muted-foreground tabular-nums",children:[i,"%"]}),e.jsx("div",{className:"relative flex h-1 w-full items-center overflow-x-hidden rounded-full bg-muted",children:e.jsx("div",{className:"h-full bg-primary transition-all",style:{width:`${i}%`}})})]}),e.jsxs("div",{className:"mt-auto rounded-lg border bg-background p-4",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:p()}),e.jsx("p",{className:"mt-2 text-2xl font-semibold text-accent-violet tabular-nums",children:a===null?"0":c(a)})]})]})]})}function Xe({data:s,onPageChange:r}){const a=Math.max(1,Math.ceil(s.paymentHistoryTotal/s.paymentHistoryPageSize));return e.jsxs(m,{className:"shadow-sm",children:[e.jsxs(g,{className:"flex flex-row items-center gap-3",children:[e.jsx(h,{className:"size-5 text-muted-foreground"}),e.jsx(b,{children:se()})]}),e.jsxs(x,{children:[s.paymentHistory.length>0?e.jsxs(Le,{children:[e.jsx(ze,{children:e.jsxs(j,{children:[e.jsx(l,{children:ae()}),e.jsx(l,{children:ie()}),e.jsx(l,{children:re()}),e.jsx(l,{children:le()}),e.jsx(l,{children:y()}),e.jsx(l,{children:ne()}),e.jsx(l,{children:te()})]})}),e.jsx(Re,{children:s.paymentHistory.map(i=>e.jsxs(j,{children:[e.jsx(n,{children:o(i.createdAt)}),e.jsx(n,{children:e.jsx(d,{variant:"secondary",children:Qe(i.type)})}),e.jsx(n,{children:i.planName}),e.jsx(n,{className:"tabular-nums",children:c(i.creditsAmount)}),e.jsx(n,{className:"font-medium tabular-nums",children:N(i.amount,i.currency)}),e.jsx(n,{children:e.jsx(d,{className:f(B(i.status)),variant:"outline",children:k(i.status)})}),e.jsx(n,{className:"max-w-64 truncate text-muted-foreground",children:i.priceId})]},i.id))})]}):e.jsx(v,{className:"min-h-40 border border-dashed",children:e.jsxs(P,{children:[e.jsx(C,{variant:"icon",children:e.jsx(h,{className:"size-4"})}),e.jsx(w,{children:de()}),e.jsx(O,{children:ce()})]})}),e.jsxs("div",{className:"mt-4 flex items-center justify-between gap-3",children:[e.jsxs("span",{className:"text-xs text-muted-foreground",children:[s.paymentHistoryPageIndex+1," / ",a]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(u,{type:"button",variant:"outline",size:"sm",disabled:s.paymentHistoryPageIndex===0,onClick:()=>r(s.paymentHistoryPageIndex-1),children:oe()}),e.jsx(u,{type:"button",variant:"outline",size:"sm",disabled:s.paymentHistoryPageIndex+1>=a,onClick:()=>r(s.paymentHistoryPageIndex+1),children:me()})]})]})]})]})}function Ye(){const[s,r]=z.useState(0),{data:a,error:i,isLoading:D}=We(s);return D?e.jsx(Ke,{}):i||!a?e.jsx($e,{title:A(),description:R()}):e.jsxs("div",{className:"flex flex-col gap-4 lg:gap-6",children:[e.jsxs("div",{className:"grid grid-cols-1 gap-4 @5xl/main:grid-cols-2",children:[e.jsx(Je,{subscription:a.subscription}),e.jsx(Ve,{data:a})]}),e.jsx(He,{creditPacks:a.creditPacks}),e.jsx(Xe,{data:a,onPageChange:r})]})}function xs(){return e.jsx(Me,{title:De(),description:Be(),children:e.jsx(Ye,{})})}
1export{xs 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.