1import{$i as e,Bg as t,Ch as n,Eh as r,Ji as i,Ki as a,Qi as o,Sh as s,Th as c,Vg as l,Wg as u,Xi as d,Yi as f,Zi as p,_a as ee,aa as m,ca as h,da as te,ea as g,fa as _,ga as v,ha as y,ia as b,jg as x,la as S,ma as ne,na as C,oa as w,pa as T,qi as E,ra as D,sa as O,ta as k,ua as re,va as A,wh as j,xh as M,ya as N}from"./messages-Dc8S4Ohf.js";import{a as P}from"./api-client-BctnvmJI.js";import{t as F}from"./useMutation-BnXFXhmd.js";import{t as I}from"./button-BSu6hs10.js";import{t as L}from"./createLucideIcon-B7xtha4h.js";import{t as R}from"./check-DiUhfyqi.js";import{t as ie}from"./credit-card-CJmSf4Dp.js";import{r as ae}from"./header-CJArjPX3.js";import{t as z}from"./layers-rZn0ZJeR.js";import{t as B}from"./sparkles-Bkeb2ga3.js";import{t as V}from"./zap-DJ_40JiC.js";import{I as H,N as U,S as W,U as G,_ as K,h as q,v as oe,w as se,x as ce,y as le}from"./index-CZCKEMfA.js";import{t as ue}from"./badge-DnqeDUEu.js";var J=L(`calendar-off`,[[`path`,{d:`M4.2 4.2A2 2 0 0 0 3 6v14a2 2 0 0 0 2 2h14a2 2 0 0 0 1.82-1.18`,key:`16swn3`}],[`path`,{d:`M21 15.5V6a2 2 0 0 0-2-2H9.5`,key:`yhw86o`}],[`path`,{d:`M16 2v4`,key:`4m81vk`}],[`path`,{d:`M3 10h7`,key:`1wap6i`}],[`path`,{d:`M21 10h-5.5`,key:`quycpq`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]),de=L(`headphones`,[[`path`,{d:`M3 14h3a2 2 0 0 1 2 2v3a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-7a9 9 0 0 1 18 0v7a2 2 0 0 1-2 2h-1a2 2 0 0 1-2-2v-3a2 2 0 0 1 2-2h3`,key:`1xhozi`}]]),fe=L(`infinity`,[[`path`,{d:`M6 16c5 0 7-8 12-8a4 4 0 0 1 0 8c-5 0-7-8-12-8a4 4 0 1 0 0 8`,key:`18ogeb`}]]),Y=L(`monitor-play`,[[`path`,{d:`M10 7.75a.75.75 0 0 1 1.142-.638l3.664 2.249a.75.75 0 0 1 0 1.278l-3.664 2.25a.75.75 0 0 1-1.142-.64z`,key:`1pctta`}],[`path`,{d:`M12 17v4`,key:`1riwvh`}],[`path`,{d:`M8 21h8`,key:`1ev6f3`}],[`rect`,{x:`2`,y:`3`,width:`20`,height:`14`,rx:`2`,key:`x3v2xh`}]]),X=u(l(),1),Z=t(),pe={stripe:`Stripe`,creem:`Creem`,paypal:`PayPal`,alipay:`Alipay`,wechat:`WeChat Pay`,waffo:`Waffo Pancake`};function me({open:e,onOpenChange:t,providers:r,loadingProvider:i,onSelect:a,planName:o,price:c}){return(0,Z.jsx)(K,{open:e,onOpenChange:t,children:(0,Z.jsxs)(oe,{className:`sm:max-w-md`,children:[(0,Z.jsxs)(ce,{children:[(0,Z.jsx)(W,{children:j()}),(0,Z.jsx)(le,{children:o?c?s({plan:o,price:c}):M({plan:o}):n()})]}),(0,Z.jsx)(`div`,{className:`mt-2 space-y-2`,children:r.map(e=>(0,Z.jsxs)(I,{variant:`outline`,className:`h-12 w-full justify-start gap-3`,disabled:!!i,onClick:()=>a(e),children:[i===e?(0,Z.jsx)(se,{className:`size-4 animate-spin`}):(0,Z.jsx)(ie,{className:`size-4`}),(0,Z.jsx)(`span`,{children:pe[e]})]},e))})]})})}function he({groups:e,onCheckout:t}){let[n,i]=(0,X.useState)(e[0]?.key||``),[a,o]=(0,X.useState)(null),s=e.find(e=>e.key===n)||e[0],l=F({mutationFn:e=>P(`/api/payment/checkout`,{product_id:e.productId,product_name:e.productName||e.name,plan_name:e.plan?.name||e.name,price:e.priceInCents,currency:e.currency||`usd`,type:e.plan?`subscription`:`one-time`,description:e.name,plan:e.plan,credits:e.credits,credits_valid_days:e.creditsValidDays,payment_provider:e.paymentProvider||`stripe`}),onSuccess:e=>{e?.checkout_url&&(window.location.href=e.checkout_url)},onSettled:()=>{o(null)}});function u(e){if(t){t(e);return}!e.productId||!e.priceInCents||(o(e.id),l.mutate(e))}return(0,Z.jsxs)(`div`,{className:`space-y-10`,children:[e.length>1&&(0,Z.jsx)(`div`,{className:`flex justify-center`,children:(0,Z.jsx)(`div`,{className:`border-border bg-muted/40 inline-flex items-center rounded-full border p-1`,children:e.map(e=>(0,Z.jsx)(`button`,{onClick:()=>i(e.key),className:x(`rounded-full px-5 py-1.5 text-sm font-medium transition-colors`,n===e.key?`bg-background text-foreground shadow-sm`:`text-muted-foreground hover:text-foreground`),children:e.label},e.key))})}),(0,Z.jsx)(`div`,{className:x(`mx-auto grid gap-6`,s?.plans.length===2?`max-w-3xl sm:grid-cols-2`:s?.plans.length===3?`max-w-5xl sm:grid-cols-2 lg:grid-cols-3`:`max-w-6xl sm:grid-cols-2 lg:grid-cols-4`),children:s?.plans.map(e=>(0,Z.jsxs)(`div`,{className:x(`border-border relative flex flex-col rounded-2xl border p-8 transition-all`,e.featured?`bg-card ring-foreground
1/10 shadow-md ring-1`:`bg-background hover:border-foreground/30`),children:[e.badge&&(0,Z.jsx)(ue,{variant:`secondary`,className:`absolute top-4 right-4`,children:e.badge}),e.name&&(0,Z.jsx)(`p`,{className:`text-foreground mb-2 text-sm font-medium`,children:e.name}),(0,Z.jsxs)(`div`,{className:`mb-2 flex items-baseline gap-1`,children:[(0,Z.jsx)(`span`,{className:`font-serif text-5xl tracking-tight`,children:e.price}),e.interval&&(0,Z.jsxs)(`span`,{className:`text-muted-foreground text-sm`,children:[`/`,e.interval]})]}),e.originalPrice&&(0,Z.jsx)(`span`,{className:`text-muted-foreground mb-1 text-sm line-through`,children:e.originalPrice}),e.description&&(0,Z.jsx)(`p`,{className:`text-muted-foreground mb-8 text-sm`,children:e.description}),(0,Z.jsx)(I,{variant:e.featured?`default`:`outline`,className:`h-10 w-full rounded-full text-sm font-medium`,onClick:()=>u(e),disabled:a===e.id,children:a===e.id?c():e.buttonText||r()}),(0,Z.jsx)(`ul`,{className:`mt-8 space-y-3`,children:e.features.map((e,t)=>{let n=typeof e!=`string`,r=n&&e.icon||R,i=n?e.label:e;return(0,Z.jsxs)(`li`,{className:`flex items-center gap-2.5 text-sm`,children:[(0,Z.jsx)(r,{className:`text-muted-foreground size-4 shrink-0`}),(0,Z.jsx)(`span`,{className:`text-foreground/90`,children:i})]},t)})})]},e.id))})]})}var ge=[`stripe`,`creem`,`paypal`,`alipay`,`wechat`,`waffo`];function Q(e){return e.toLocaleString(`en-US`)}function $(t,n,r=`monthly`){let s=r===`yearly`?C({count:Q(n)}):r===`pack`?k({count:Q(n)}):t===`basic`?D():t===`pro`?o():i();if(t===`basic`){let t=[{icon:B,label:s},{icon:z,label:e()},{icon:ae,label:g()}];return r!==`pack`&&t.push({icon:J,label:a()}),t}if(t===`pro`){let t=[{icon:B,label:s},{icon:z,label:e()},{icon:V,label:p()},{icon:Y,label:d()}];return r!==`pack`&&t.push({icon:J,label:a()}),t}let c=[{icon:R,label:f()},{icon:fe,label:s},{icon:z,label:e()},{icon:de,label:E()}];return r!==`pack`&&c.push({icon:J,label:a()}),c}function _e({title:e,pageTitle:t=!1}={}){let n=H(),{data:r}=G(),{data:i}=U(),a=i??{},[o,s]=(0,X.useState)(!1),[c,l]=(0,X.useState)(null),[u,d]=(0,X.useState)(null),f=(0,X.useMemo)(()=>ge.filter(e=>a[`${e}_enabled`]===`true`),[a]),p=$(`basic`,950,`monthly`),g=$(`pro`,2600,`monthly`),x=$(`max`,5e3,`monthly`),C=[{key:`monthly`,label:ee(),plans:[{id:`basic-monthly`,name:S(),description:h(),price:`$20`,interval:`mo`,features:p,productId:`basic_monthly`,priceInCents:2e3,currency:`usd`,credits:950,plan:{name:`Basic`,interval:`month`,intervalCount:1}},{id:`pro-monthly`,name:O(),description:w(),price:`$50`,interval:`mo`,featured:!0,badge:te(),features:g,productId:`pro_monthly`,priceInCents:5e3,currency:`usd`,credits:2600,plan:{name:`Pro`,interval:`month`,intervalCount:1}},{id:`max-monthly`,name:m(),description:b(),price:`$90`,interval:`mo`,features:x,productId:`max_monthly`,priceInCents:9e3,currency:`usd`,credits:5e3,plan:{name:`Max`,interval:`month`,intervalCount:1}}]},{key:`yearly`,label:v(),plans:[{id:`basic-yearly`,name:S(),description:h(),price:`$192`,originalPrice:`$240`,interval:`yr`,badge:y(),features:$(`basic`,11400,`yearly`),productId:`basic_yearly`,priceInCents:19200,currency:`usd`,credits:11400,plan:{name:`Basic`,interval:`year`,intervalCount:1}},{id:`pro-yearly`,name:O(),description:w(),price:`$480`,originalPrice:`$600`,interval:`yr`,featured:!0,badge:y(),features:$(`pro`,31200,`yearly`),productId:`pro_yearly`,priceInCents:48e3,currency:`usd`,credits:31200,plan:{name:`Pro`,interval:`year`,intervalCount:1}},{id:`max-yearly`,name:m(),description:b(),price:`$864`,originalPrice:`$1,080`,interval:`yr`,badge:y(),features:$(`max`,6e4,`yearly`),productId:`max_yearly`,priceInCents:86400,currency:`usd`,credits:6e4,plan:{name:`Max`,interval:`year`,intervalCount:1}}]},{key:`credit_packs`,label:ne(),plans:[{id:`basic-credit-pack`,name:S(),description:T(),price:`$20`,features:$(`basic`,900,`pack`),productId:`basic_credit_pack`,priceInCents:2e3,currency:`usd`,credits:900,buttonText:_()},{id:`pro-credit-pack`,name:O(),description:T(),price:`$50`,features:$(`pro`,2500,`pack`),featured:!0,badge:re(),productId:`pro_credit_pack`,priceInCents:5e3,currency:`usd`,credits:2500,buttonText:_()},{id:`max-credit-pack`,name:m(),description:T(),price:`$90`,features:$(`max`,4800,`pack`),productId:`max_credit_pack`,priceInCents:9e3,currency:`usd`,credits:4800,buttonText:_()}]}],E=F({mutationFn:({plan:e,provider:t})=>P(`/api/payment/checkout`,{product_id:e.productId,product_name:e.productName||e.name,plan_name:e.plan?.name||e.name,price:e.priceInCents,currency:e.currency||`usd`,type:e.plan?`subscription`:`one-time`,description:e.name,plan:e.plan,credits:e.credits,credits_valid_days:e.creditsValidDays,payment_provider:t}),onSuccess:e=>{if(!e?.checkout_url){q.error(`Checkout failed`),d(null);return}window.location.href=e.checkout_url},onError:e=>{q.error(e?.message||`Checkout failed`),d(null)}});function D(e,t){d(t),E.mutate({plan:e,provider:t})}async function k(e){if(!r?.user){let e=encodeURIComponent(typeof window<`u`?window.location.pathname:`/pricing`);n.push(`/sign-in?redirect=${e}`);return}let t=a.select_payment_enabled===`true`,i=a.default_payment_provider||f[0]||`stripe`;if(t&&f.length>1){l(e),s(!0);return}await D(e,i)}function j(e){c&&D(c,e)}return(0,Z.jsxs)(`section`,{id:`pricing`,className:`border-border border-t px-4 py-24 sm:py-32`,children:[(0,Z.jsxs)(`div`,{className:`mx-auto max-w-5xl`,children:[(0,Z.jsxs)(`div`,{className:`mb-20 text-center`,children:[t?(0,Z.jsx)(`h1`,{className:`font-serif text-4xl font-normal tracking-tight sm:text-5xl`,children:e??N()}):(0,Z.jsx)(`h2`,{className:`font-serif text-4xl font-normal tracking-tight sm:text-5xl`,children:e??N()}),(0,Z.jsx)(`p`,{className:`text-muted-foreground mt-5`,children:A()})]}),(0,Z.jsx)(he,{groups:C,onCheckout:k})]}),(0,Z.jsx)(me,{open:o,onOpenChange:e=>{s(e),e||(l(null),d(null))},providers:f.length?f:[`stripe`],loadingProvider:u,onSelect:j,planName:c?.name,price:c?.price})]})}
1export{Y as n,_e as 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.