import{j as e}from"./radix-ui-CVZWoPyd.js";import{r}from"./react-vendor-BmlOtb7g.js";import{a,B as s,d as t,L as n}from"./index-BCSgDlp8.js";import{f as i}from"./analytics-CgKQjs6u.js";import{A as o}from"./arrow-right-CcptuZBy.js";function c({productId:c,projectId:l="",children:m,className:d,variant:h="default",size:u="default",showArrow:p=!0,onCheckoutInitiated:f}){const[j,x]=r.useState(!1),{initiateCheckout:y}=a();return e.jsx(s,{className:t(d),variant:h,size:u,onClick:()=>{return e=this,r=null,a=function*(){x(!0);try{i({complete_guide:39.99,agency_pack:149.99,entrepreneur_pack:89.99}[c]||0,"USD",c),yield y(c,l),f&&f()}catch(e){console.error("Checkout error:",e),x(!1)}},new Promise((s,t)=>{var n=e=>{try{o(a.next(e))}catch(r){t(r)}},i=e=>{try{o(a.throw(e))}catch(r){t(r)}},o=e=>e.done?s(e.value):Promise.resolve(e.value).then(n,i);o((a=a.apply(e,r)).next())});var e,r,a},disabled:j,children:j?e.jsxs(e.Fragment,{children:[e.jsx(n,{className:"h-4 w-4 animate-spin mr-2"}),"Processing..."]}):e.jsx(e.Fragment,{children:"string"==typeof m?e.jsxs("span",{className:"flex items-center justify-center",children:[m,p&&e.jsx(o,{className:"ml-2 h-4 w-4"})]}):m})})}export{c as C};