import{AT as Qq,BT as f,DT as c,FT as g,GT as m,IT as b,zT as S}from"./cli-0.5.4-j2hnw539.mjs";import{NU as y,PU as Nq,XU as O,YU as Uq}from"./cli-0.5.4-vv4jbgkc.mjs";import{KW as M,MW as z,QW as L,eX as R,lV as v,pX as Mq,qV as Hq}from"./cli-0.5.4-s7k1f0wc.mjs";import"./cli-0.5.4-0h0yz2k5.mjs";import"./cli-0.5.4-942dm5q1.mjs";import"./cli-0.5.4-rcmp5h4y.mjs";import{OY as U,PY as q,QY as J,RY as V}from"./cli-0.5.4-mn22gk7g.mjs";import{SY as Jq}from"./cli-0.5.4-5t3jj85n.mjs";import"./cli-0.5.4-prfn3sxd.mjs";import"./cli-0.5.4-jqt00ywx.mjs";import"./cli-0.5.4-9e7rkd8e.mjs";import"./cli-0.5.4-jp4wtw87.mjs";import"./cli-0.5.4-hambpq58.mjs";import"./cli-0.5.4-w8ttefr5.mjs";import"./cli-0.5.4-j7kkqxv6.mjs";import"./cli-0.5.4-qrwczx7j.mjs";import"./cli-0.5.4-v2z6p9td.mjs";import{B6 as h,B9 as E,Eaa as u,Haa as d,J6 as qq,R9 as Bq,_aa as Xq,r8 as k,t8 as zq}from"./cli-0.5.4-cbq01zg3.mjs";import"./cli-0.5.4-37v5fhf1.mjs";import"./cli-0.5.4-7grzwf6q.mjs";import"./cli-0.5.4-9qmek5dq.mjs";import"./cli-0.5.4-9c6r1fjg.mjs";import"./cli-0.5.4-2dw33ms6.mjs";import"./cli-0.5.4-x1fzfxmm.mjs";import"./cli-0.5.4-e822fzaq.mjs";import{Nea as _,Pea as F}from"./cli-0.5.4-09dvrzcr.mjs";import"./cli-0.5.4-end8wj9r.mjs";import"./cli-0.5.4-4x206j04.mjs";import"./cli-0.5.4-yd3rd9qt.mjs";import"./cli-0.5.4-sgcaw17t.mjs";import"./cli-0.5.4-jmc3bzbn.mjs";import"./cli-0.5.4-959vxhhb.mjs";import{Vma as e,Zma as C}from"./cli-0.5.4-aacw1src.mjs";function D({onDone:X}){let[P,Q]=N.useState(!0),[$,T]=N.useState([]),[j,W]=N.useState(!1),[G,x]=N.useState(null),[A,o]=N.useState(void 0),Y=S(()=>X("Guest passes dialog dismissed",{display:"system"})),l=N.useCallback(()=>{X("Guest passes dialog dismissed",{display:"system"})},[X]);if(y("confirm:no",l,{context:"Confirmation"}),R((H,B)=>{if(B.return&&G)v(G).then((K)=>{if(K)process.stdout.write(K);_("tengu_guest_passes_link_copied",{}),X("Referral link copied to clipboard!")})}),N.useEffect(()=>{async function H(){try{let B=await m();if(!B||!B.eligible){W(!1),Q(!1);return}if(W(!0),B.referral_code_details?.referral_link)x(B.referral_code_details.referral_link);o(B.referrer_reward);let K=B.referral_code_details?.campaign??"claude_code_guest_pass",I;try{I=await f(K)}catch(Z){h(Z),W(!1),Q(!1);return}let t=I.redemptions||[],a=I.limit||3,w=[];for(let Z=0;Z<a;Z++){let s=t[Z];w.push({passNumber:Z+1,isAvailable:!s})}T(w),Q(!1)}catch(B){h(B),W(!1),Q(!1)}}H()},[]),P)return q(O,{children:J(M,{flexDirection:"column",gap:1,children:[q(z,{dimColor:!0,children:"Loading guest pass information…"}),q(z,{dimColor:!0,italic:!0,children:Y.pending?J(U,{children:["Press ",Y.keyName," again to exit"]}):q(U,{children:"Esc to cancel"})})]})});if(!j)return q(O,{children:J(M,{flexDirection:"column",gap:1,children:[q(z,{children:"Guest passes are not currently available."}),q(z,{dimColor:!0,italic:!0,children:Y.pending?J(U,{children:["Press ",Y.keyName," again to exit"]}):q(U,{children:"Esc to cancel"})})]})});let n=k($,(H)=>H.isAvailable),r=[...$].sort((H,B)=>+B.isAvailable-+H.isAvailable),i=(H)=>{if(!H.isAvailable)return J(M,{flexDirection:"column",marginRight:1,children:[q(z,{dimColor:!0,children:"┌─────────╱"}),q(z,{dimColor:!0,children:` ) CC ${E} ┊╱`}),q(z,{dimColor:!0,children:"└───────╱"})]},H.passNumber);return J(M,{flexDirection:"column",marginRight:1,children:[q(z,{children:"┌──────────┐"}),J(z,{children:[" ) CC ",q(z,{color:"claude",children:E})," ┊ ( "]}),q(z,{children:"└──────────┘"})]},H.passNumber)};return q(O,{children:J(M,{flexDirection:"column",gap:1,children:[J(z,{color:"permission",children:["Guest passes · ",n," left"]}),q(M,{flexDirection:"row",marginLeft:2,children:r.slice(0,3).map((H)=>i(H))}),G&&q(M,{marginLeft:2,children:q(z,{children:G})}),q(M,{flexDirection:"column",marginLeft:2,children:J(z,{dimColor:!0,children:[A?`Share a free week of Claude Code with friends. If they love it and subscribe, you'll get ${c(A)} of extra usage to keep building. `:"Share a free week of Claude Code with friends. ",q(L,{url:A?"https://support.claude.com/en/articles/13456702-claude-code-guest-passes":"https://support.claude.com/en/articles/12875061-claude-code-guest-passes",children:"Terms apply."})]})}),q(M,{children:q(z,{dimColor:!0,italic:!0,children:Y.pending?J(U,{children:["Press ",Y.keyName," again to exit"]}):q(U,{children:"Enter to copy link · Esc to cancel"})})})]})})}var N;var p=C(()=>{Bq();Qq();Hq();Mq();Nq();F();b();zq();qq();Uq();V();N=e(Jq(),1)});async function kq(X){let Q=!d().hasVisitedPasses;if(Q){let $=g();u((T)=>({...T,hasVisitedPasses:!0,passesLastSeenRemaining:$??T.passesLastSeenRemaining}))}return _("tengu_guest_passes_visited",{is_first_visit:Q}),q(D,{onDone:X})}var Yq=C(()=>{p();F();b();Xq();V()});Yq();export{kq as call};
