import{aL as e,aM as a,aN as t,aO as s}from"./index-D35RxkWr.js";import{r,j as o}from"./vendor-react-AXa6hZO5.js";import{u as i}from"./c365fd3fe-Dmpsm876.js";import{n,k as l,I as d}from"./c6eedc03a-C8LSdtro.js";import{D as c}from"./vendor-luxon-Y8l99kBI.js";import{u,M as m}from"./vendor-intl-BdADXLLt.js";import{o as f,s as g}from"./vendor-zod-1gcJXWab.js";function h(){const{data:o,mutate:n}=i(),l=o?.promotionId,{data:d}=e();return r.useEffect(()=>{d?.referral_code&&(d.campaign===a.EVERGREEN_CLAUDE_DISCOUNT||t(d.campaign))&&l!==d.campaign&&n({promotionId:d.campaign,referralCode:d.referral_code})},[l,d,n]),s()}const p=f({coral:g()});function x(){const[e,a]=r.useState(null),t=u(),s=n("silver_metal_compass"),o=l("crystal_bridge_falcon",null,p.nullable());return r.useEffect(()=>{if(!s||!o?.coral)return;const e=()=>{const e=c.fromISO(o.coral),s=c.now(),r=e.diff(s);if(r.milliseconds<=0)return a(null),!1;const i=Math.floor(r.milliseconds/1e3),n=Math.floor(i/3600),l=Math.floor(i%3600/60),d=i%60,u=[];n>0&&u.push(t.formatMessage({defaultMessage:"{value, plural, one {#h} other {#h}}",id:"toZ1QpleRE",description:"Hours in countdown timer"},{value:n})),(l>0||n>0)&&u.push(t.formatMessage({defaultMessage:"{value, plural, one {#m} other {#m}}",id:"31se92/223",description:"Minutes in countdown timer"},{value:l})),u.push(t.formatMessage({defaultMessage:"{value, plural, one {#s} other {#s}}",id:"DVUSGKMNCv",description:"Seconds in countdown timer"},{value:d}));const m=u.join(" ");return a(m),!0};e();const r=setInterval(()=>{e()||clearInterval(r)},1e3);return()=>clearInterval(r)},[s,o?.coral,t]),{displayText:e}}const M={clay:"#dd8164",sky:"#77a3cf",olive:"#839569",fig:"#c8728f",coral:"#efd9d9",cactus:"#cbdcd5",heather:"#d7d6e1"},v=["coral","cactus","heather"];function b(e){return v.includes(e)}const j=[{tier:"pro",name:"Pro",descriptionId:"gift.plan.pro.description",descriptionDefault:"For the curious"},{tier:"max_5x",name:"Max 5x",descriptionId:"gift.plan.max5x.description",descriptionDefault:"For the enthusiast"},{tier:"max_20x",name:"Max 20x",descriptionId:"gift.plan.max20x.description",descriptionDefault:"For the power user"}],w=[{months:1,labelId:"gift.duration.1month",labelDefault:"1 month"},{months:3,labelId:"gift.duration.3months",labelDefault:"3 months"},{months:6,labelId:"gift.duration.6months",labelDefault:"6 months"},{months:12,labelId:"gift.duration.1year",labelDefault:"1 year"}];function N(e,a){return 1===a?e.formatMessage({defaultMessage:"1 month",id:"p1dNdsvErg"}):12===a?e.formatMessage({defaultMessage:"1 year",id:"rwIPgHMeIl"}):e.formatMessage({defaultMessage:"{count} months",id:"TVtPcia8AQ"},{count:a})}function y(e,a){return 1===a?e.formatMessage({defaultMessage:"A month",id:"YtUcA+BM6Q"}):12===a?e.formatMessage({defaultMessage:"A year",id:"rZ1RTSogBQ"}):e.formatMessage({defaultMessage:"{count} months",id:"TVtPcia8AQ"},{count:a})}function I({tier:e,duration:a,cardColor:t,toName:s,giftMessage:i,showDetails:n=!1,variant:l="purchase",hideText:c=!1}){const f=u(),g=e?j.find(a=>a.tier===e)?.name??"":"",h=b(t),p=r.useMemo(()=>{if(!e||!a)return"";const t=N(f,a);return f.formatMessage({defaultMessage:"{duration} of Claude {tier}",id:"54MZG42xgX"},{duration:t,tier:g})},[e,a,g,f]);return o.jsxs("div",{className:"relative w-72",children:[o.jsxs("div",{className:"relative aspect-[3/2] rounded-2xl overflow-hidden shadow-lg ring-1 ring-inset ring-always-white/30",style:{backgroundColor:M[t]??M.clay},children:["redeem"!==l&&o.jsx("div",{className:"absolute inset-0 scale-110 translate-x-2",children:o.jsx(d,{src:"/images/gift/hatch-intersect.svg",alt:"",fill:!0,className:"object-cover "+(h?"opacity-25":"opacity-[0.08]")})}),o.jsxs("div",{className:"absolute inset-0 flex flex-col items-center justify-center",children:[o.jsx(d,{src:"redeem"===l?"/images/gift/gift-receiving.gif":"/images/gift/gift-giving.gif",alt:"",width:"redeem"===l?180:120,height:"redeem"===l?135:90,className:"object-contain",unoptimized:!0}),!c&&o.jsx("div",{className:"text-center mt-1.5 "+(h?"text-always-black/80":"text-always-white"),children:e&&a?o.jsx("div",{className:"font-small-bold",children:p}):o.jsx("div",{className:"text-[10px] "+(h?"text-always-black/60":"text-always-white/60"),children:o.jsx(m,{defaultMessage:"Select a plan and duration",id:"9P55UNw+MA"})})})]})]}),n&&(s||i)&&o.jsxs("div",{className:"mt-4 rounded-xl bg-bg-100/50 border-[0.5px] border-border-300 p-4",children:[s&&o.jsx("div",{className:"font-small-bold text-text-100 mb-1",children:o.jsx(m,{defaultMessage:"To: {name}",id:"maMyHsXUNu",values:{name:s}})}),i&&o.jsx("p",{className:"font-small text-text-200",children:i})]})]})}export{M as C,w as D,I as G,j as P,h as a,y as b,N as g,b as i,x as u};
