import{ag as g,j as e,r as l,T as a,A as b,cv as x,o as u,p as j,aO as p,t as h,v as N}from"./main-D6SjkSWq.js";import{A as y,B as v}from"./billing-plan-panel-DOh_cx8-.js";import{u as f}from"./useSuspenseQuery-Xmh5uCOE.js";import{B,a as d}from"./breadcrumb-Pvuej4Ko.js";import{S as r}from"./skeleton-3NNrk_-o.js";import{F as C}from"./formatted-price-BMjupemv.js";import{B as k,f as P}from"./billing-cycle-radio-CQc8jgXb.js";import"./section-helper-C-cn6F19.js";import"./useEffectEvent-Bb2YhEEQ.js";import"./ChevronRight-BN6UJOeQ.js";import"./MoreHoriz-Bms6kOtf.js";import"./radio-group-DdYhv5WL.js";function D(){const s=g();return e.jsxs(l.Fragment,{children:[e.jsxs(B,{children:[e.jsx(d,{isLink:!0,onSelected:()=>s("/billing"),children:e.jsx(a,{message:"Billing"})}),e.jsx(d,{children:e.jsx(a,{message:"Plans"})})]}),e.jsx(y,{className:"mb-24"}),e.jsx("h1",{className:"my-32 text-3xl font-bold md:my-64",children:e.jsx(a,{message:"Change your plan"})}),e.jsx(v,{title:e.jsx(a,{message:"Available plans"}),children:e.jsx(b,{initial:!1,mode:"wait",children:e.jsx(S,{})})})]})}function S(){var c,o;const s=f(x.products.index()),[t,n]=l.useState("monthly");return s.isLoading?e.jsx(L,{},"plan-skeleton"):e.jsxs(l.Fragment,{children:[e.jsx(k,{products:(c=s.data)==null?void 0:c.products,selectedCycle:t,onChange:n,className:"mb-20",size:"md"}),(o=s.data)==null?void 0:o.products.map(i=>{const m=P(t,i.prices);return!m||i.hidden?null:l.createElement(u.div,{...j,key:i.id,className:"justify-between gap-40 border-b py-32 md:flex"},e.jsxs("div",{className:"mb-40 md:mb-0",children:[e.jsx("div",{className:"text-xl font-bold",children:i.name}),e.jsx(C,{price:m,className:"text-lg"}),e.jsx("div",{className:"mt-12 text-base",children:i.description}),e.jsx(A,{plan:i})]}),e.jsx(F,{product:i,price:m}))})]},"plan-list")}function A({plan:s}){return s.feature_list.length?e.jsxs("div",{className:"mt-32",children:[e.jsx("div",{className:"mb-10 text-sm font-semibold",children:e.jsx(a,{message:"What's included"})}),s.feature_list.map(t=>e.jsxs("div",{className:"flex items-center gap-10 text-sm",children:[e.jsx(p,{className:"text-positive",size:"sm"}),e.jsx(a,{message:t})]},t))]}):null}function F({product:s,price:t}){const n=f(x.user());return n.data.subscription.product_id===s.id&&n.data.subscription.price_id===t.id?e.jsxs("div",{className:"flex w-[168px] items-center justify-center gap-10 text-muted",children:[e.jsx(p,{size:"md"}),e.jsx(a,{message:"Current plan"})]}):e.jsx(h,{variant:"flat",color:"primary",className:"w-[168px]",size:"md",elementType:N,to:`/billing/change-plan/${s.id}/${t.id}/confirm`,children:e.jsx(a,{message:"Continue"})})}function L(){return e.jsxs(u.div,{...j,className:"border-b py-32 text-2xl",children:[e.jsx(r,{className:"mb-8"}),e.jsx(r,{className:"mb-14"}),e.jsx(r,{className:"mb-24"}),e.jsx(r,{className:"mb-12"})]},"plan-skeleton")}export{D as Component};
