1 2!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="b85b6b5f-6986-5b37-9892-02637589e7a3")}catch(e){}}(); 3import{j as e}from"./vendor-radix-D60p-_ms.js";import{r as o}from"./vendor-react-DRd396Ms.js";import{h as D,t as k,L as A,W as K,a1 as Q,E as B}from"./index-vRxdZvmj.js";import{b as U,u as W,c as V}from"./vendor-query-CQDkrmBu.js";import{u as z}from"./user-facing-error-DLM6u6dy.js";import{u as H}from"./seo-DTdWGe1o.js";import{b as J,G as d,a as L,g as X,c as Z,d as ee,f as te}from"./clone-grants-BpsMnepF.js";import{A as re}from"./arrow-left-B4mhrtMh.js";import"./vendor-classnames-B2rm_Apj.js";import"./vendor-motion-DZC2ImUw.js";import"./vendor-i18n-D-E_aly0.js";import"./product-state-DnysQ2lu.js";import"./utils-puaEeEiv.js";import"./vendor-forms-FRbkMq_T.js";import"./clone-plans-rp8CHNyr.js";const E={name:"grant-name",url:"grant-url",oneLine:"grant-one-line",referralCode:"grant-referral"};function m({field:r,message:i}){return e.jsx("p",{id:`${E[r]}-error`,"aria-live":"polite",className:i?"mt-1.5 text-xs text-rose-300":"sr-only","data-testid":`clone-grant-error-${r}`,children:i??""})}function ae(r){return r==="creator"||r==="developer"}function P({application:r,message:i}){const l=r.status==="auto_approved"||r.status==="reviewed",a=l?"border-emerald-500/40 bg-emerald-500/10":r.status==="declined"?"border-rose-500/30 bg-rose-500/10":"border-amber-500/30 bg-amber-500/10",u=l?`${d[r.program].title}: approved`:r.status==="declined"?`${d[r.program].title}: not this time`:`${d[r.program].title}: received`;return e.jsxs("div",{className:`rounded-[8px] border p-5 ${a}`,role:"status","data-testid":"clone-grant-status","data-status":r.status,children:[e.jsx("h2",{className:"text-lg font-semibold",children:u}),e.jsx("p",{className:"mt-2 text-sm text-white/80",children:i}),l&&e.jsxs("p",{className:"mt-2 text-sm text-white/80",children:[te(r.credits)," credits are on your account. Your referral code is"," ",e.jsx("code",{className:"px-1.5 py-0.5 rounded bg-white/10 text-white",children:r.referralCode}),"."]}),r.status==="declined"&&r.declineReason&&e.jsxs("p",{className:"mt-2 text-sm text-white/80",children:["The reason: ",r.declineReason]}),e.jsx(A,{href:"/clone/dashboard",className:"mt-4 inline-flex items-center justify-center h-11 px-5 rounded-[6px] bg-emerald-500 text-surface-0 hover:bg-emerald-400 text-sm font-semibold",children:"Open your dashboard"})]})}function ye(){var N;const[r]=D(),i=U(),l=o.useMemo(()=>{const t=typeof window<"u"?window.location.search:"",n=new URLSearchParams(t).get("program");return ae(n)?n:"creator"},[r]),[a,u]=o.useState(l),[f,F]=o.useState(""),[b,_]=o.useState(""),[x,R]=o.useState(""),[h,T]=o.useState(""),[y,I]=o.useState(!1),[v,O]=o.useState(!1),[s,j]=o.useState({}),[p,q]=o.useState(null);o.useEffect(()=>{H({title:"Apply for an AI Anyone grant",description:L.lede,noindex:!0}),k("grants_apply_viewed",{program:l})},[l]);const G=W({queryKey:["/api/grants/me"]}),c=V({mutationFn:async t=>await(await B("POST","/api/grants/apply",t)).json(),onSuccess:t=>{q(t),k("grants_apply_submitted",{program:a,outcome:t.outcome}),i.invalidateQueries({queryKey:["/api/grants/me"]}),i.invalidateQueries({queryKey:["/api/clone/usage"]}),i.invalidateQueries({predicate:n=>typeof n.queryKey[0]=="string"&&n.queryKey[0].startsWith("/api/announcements?")})}}),$=d[a],w=((N=G.data)==null?void 0:N.application)??null;function M(t){t.preventDefault(),j({});const n=X.safeParse({program:a,name:f,url:b,oneLine:x,referralCode:h.trim()?h.trim():void 0,agreesToFloor:a==="developer"?y:void 0,startupCriteria:a==="developer"?v:void 0});if(!n.success){const C=Z(n.error.issues,a);j(C);const S=ee.find(Y=>C[Y]),g=S?document.getElementById(E[S]):null;g&&(g.focus({preventScroll:!0}),g.scrollIntoView({block:"center"}));return}c.mutate(n.data)}return e.jsxs("div",{className:"strip-pad-top min-h-screen bg-surface-0 text-white",children:[e.jsx("header",{className:"sticky z-10 border-b border-hairline bg-surface-0/80 backdrop-blur",style:{to
3p:"var(--ann-strip-h, 0px)"},children:e.jsxs("div",{className:"mx-auto max-w-2xl px-4 h-14 flex items-center gap-3",children:[e.jsx(A,{href:"/grants",className:"inline-flex items-center justify-center h-11 w-11 -ml-2 rounded-[6px] text-white/60 hover:text-white hover:bg-white/5","aria-label":"Back to grants",children:e.jsx(re,{className:"h-5 w-5","aria-hidden":"true"})}),e.jsx("h1",{className:"text-base font-semibold",children:"Apply for a grant"})]})}),e.jsx("main",{className:"mx-auto max-w-2xl px-4 py-6 pb-16",children:p?e.jsx(P,{application:p.application,message:p.message}):w?e.jsx(P,{application:w,message:"You already applied. Here is the decision on file."}):e.jsxs("form",{onSubmit:M,className:"space-y-6",noValidate:!0,"data-testid":"clone-grant-apply",children:[e.jsxs("fieldset",{children:[e.jsx("legend",{className:"text-sm font-medium text-white/80",children:"Program"}),e.jsx("div",{className:"mt-2 grid grid-cols-1 sm:grid-cols-2 gap-2",children:J.map(t=>e.jsxs("label",{className:`cursor-pointer rounded-[8px] border p-4 ${a===t?"border-emerald-500/60 bg-emerald-500/10":"border-hairline bg-surface-1 hover:bg-white/5"}`,children:[e.jsx("input",{type:"radio",name:"program",value:t,checked:a===t,onChange:()=>u(t),className:"sr-only"}),e.jsx("span",{className:"block text-sm font-semibold",children:d[t].title}),e.jsx("span",{className:"mt-1 block text-xs text-white/60",children:d[t].gives[0]})]},t))}),e.jsx("p",{className:"mt-2 text-xs text-white/50",children:$.lede})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"grant-name",className:"block text-sm font-medium text-white/80",children:"Your name"}),e.jsx("input",{id:"grant-name","data-testid":"clone-grant-name",value:f,onChange:t=>F(t.target.value),autoComplete:"name",maxLength:120,required:!0,"aria-invalid":s.name?!0:void 0,"aria-describedby":s.name?"grant-name-error":void 0,className:"mt-1.5 w-full h-11 rounded-[6px] bg-surface-1 border border-hairline px-3 text-sm text-white placeholder:text-white/40 focus:outline-none focus:border-emerald-500/60"}),e.jsx(m,{field:"name",message:s.name})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"grant-url",className:"block text-sm font-medium text-white/80",children:a==="creator"?"Where people already find you (a public profile, channel or site)":"Your app or public repo"}),e.jsx("input",{id:"grant-url","data-testid":"clone-grant-url",type:"url",value:b,onChange:t=>_(t.target.value),placeholder:"https://",inputMode:"url",maxLength:2048,required:!0,"aria-invalid":s.url?!0:void 0,"aria-describedby":s.url?"grant-url-error":void 0,className:"mt-1.5 w-full h-11 rounded-[6px] bg-surface-1 border border-hairline px-3 text-sm text-white placeholder:text-white/40 focus:outline-none focus:border-emerald-500/60"}),e.jsx(m,{field:"url",message:s.url})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"grant-one-line",className:"block text-sm font-medium text-white/80",children:a==="creator"?"One line on what your clone is for":"One line on what it does and for whom"}),e.jsx("textarea",{id:"grant-one-line","data-testid":"clone-grant-line",value:x,onChange:t=>R(t.target.value),rows:2,maxLength:280,required:!0,"aria-invalid":s.oneLine?!0:void 0,"aria-describedby":s.oneLine?"grant-one-line-error":void 0,className:"mt-1.5 w-full rounded-[6px] bg-surface-1 border border-hairline px-3 py-2.5 text-sm text-white placeholder:text-white/40 focus:outline-none focus:border-emerald-500/60"}),e.jsx(m,{field:"oneLine",message:s.oneLine}),e.jsxs("p",{className:"mt-1 text-xs text-white/40",children:[x.length,"/280"]})]}),e.jsxs("div",{children:[e.jsxs("label",{htmlFor:"grant-referral",className:"block text-sm font-medium text-white/80",children:["Referral code ",e.jsx("span",{className:"text-white/40 font-normal",children:"(optional)"})]}),e.jsx("input",{id:"grant-referral",value:h,onChange:t=>T(t.target.value),placeholder:"ref_",autoComplete:"off",maxLength:40,"aria-invalid":s.referralCode?!0:void 0,"aria-describedby":s.referralCode?"grant-referral-error":void 0,className:"mt-1.5 w-full h-11 rounded-[6px] bg-surface-1 border border-hairline px-3 text-sm text-white placeholder:text-white/40 focus:outline-none focus:border-emerald-500/60"}),e.jsx(m,{field:"referralCode",message:s.referralCode})]}),a==="developer"&&e.jsxs("div",{className:"space-y-3",children:[e.jsxs("label",{className:"flex gap-3 items-start text-sm text-white/85 cursor-pointer",children:[e.jsx("input",{type:"checkbox",checked:y,onChange:t=>I(t.target.checked),className:"mt-1 h-4 w-4"}),e.jsx("span",{children:"I agree to the floor and the never-returned list: every clone reply carries the disclosure and nothing in my app lowers it."})]}),e.jsxs("label",{className:"flex gap-3 items-start text-sm text-white/85 cursor-pointer",children:[e.jsx("input",{type:"checkbox",checked:v,onChange:t=>O(t.target.checked),className:"mt-1 h-4 w-4"}),e.jsx("span",{children:"My company is under 2 years old or has raised under $5M."})]})]}),a==="creator"&&e.jsx("p",{className:"text-xs text-white/50",children:"We check the rest ourselves: that your clone is live and that you completed the ownership attestation when you built it."}),c.isError&&e.jsx("p",{className:"rounded-[6px] border border-rose-500/30 bg-rose-500/10 p-3 text-sm text-rose-200",role:"alert",children:z(c.error,"Could not submit. Try again in a minute.")}),e.jsxs("button",{type:"submit","data-testid":"clone-grant-submit",disabled:c.isPending,className:"inline-flex items-center justify-center gap-2 h-11 px-5 rounded-[6px] bg-emerald-500 text-surface-0 hover:bg-emerald-400 disabled:opacity-60 text-sm font-semibold",children:[c.isPending&&e.jsx(K,{className:"h-4 w-4 animate-spin","aria-hidden":"true"}),"Apply"]}),e.jsx("p",{className:"text-xs text-white/50",children:L.promise24h})]})}),e.jsx(Q,{variant:"compact"})]})}
3export{ye as default}; 4 5//# debugId=b85b6b5f-6986-5b37-9892-02637589e7a3
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.