PageSourceSearch

https://app.backstagebaton.com/app/assets/GrantReportPage-BX3zsyMG.js

js backstagebaton.com collected 2026-10-07 08:49:20 UTC 36,317 bytes, 1 lines download raw bytes

1import{v as S,j as e,r as i,h as Ne,c as ve,d as E,B as j,y as ae,t as ke,l as we}from"./index-_aijvlUq.js";import{P as Ce}from"./PageHeader-DCofr6qo.js";import{I as C}from"./Input-ysTyZFq5.js";import{a as ee}from"./Skeleton-B3Wj6cNd.js";import{h as Ae}from"./helpWanted-C0itiuLN.js";import{d as Se}from"./exportCsv-CZAUSrIW.js";import{E as Ee}from"./EmptyState-CPGKooqj.js";import{T as Re}from"./Tabs-CGDUdv1I.js";import"./Badge-DJIi163x.js";const R={generate(s,r){return S.get("/grant-report",{params:{startDate:s,endDate:r}})},discoverGrants(s){return S.get("/grant-report/discover",{timeout:15e4,signal:s})},getGrantProfile(){return S.get("/grant-report/profile")},updateGrantProfile(s){return S.put("/grant-report/profile",s)}};function T(){return new Promise(s=>{if(window.Chart){s(window.Chart);return}const r=document.createElement("script");r.src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/4.4.1/chart.umd.js",r.onload=()=>s(window.Chart),document.head.appendChild(r)})}function De({adult:s,youth:r}){const l=i.useRef(null),c=i.useRef(null);i.useEffect(()=>{if(l.current)return T().then(y=>{c.current&&c.current.destroy();const n=s+r;n!==0&&(c.current=new y(l.current,{type:"doughnut",data:{labels:["Adult","Youth"],datasets:[{data:[s,r],backgroundColor:["#1D9E75","#5DCAA5"],borderWidth:0,hoverOffset:6}]},options:{responsive:!0,maintainAspectRatio:!1,cutout:"70%",plugins:{legend:{display:!1},tooltip:{callbacks:{label:m=>{const x=Math.round(m.raw/n*100);return` ${m.label}: ${m.raw.toLocaleString()} (${x}%)`}}}}}}))}),()=>{c.current&&c.current.destroy()}},[s,r]);const u=s+r,o=u>0?Math.round(r/u*100):0,d=u>0?Math.round(s/u*100):0;return e.jsxs("div",{className:"bg-white rounded-xl border border-gray-200 p-5",children:[e.jsx("h3",{className:"text-sm font-semibold text-gray-500 uppercase tracking-wide mb-4",children:"Audience Breakdown"}),e.jsxs("div",{className:"flex items-center gap-6",children:[e.jsxs("div",{style:{position:"relative",width:140,height:140,flexShrink:0},children:[e.jsx("canvas",{ref:l}),e.jsxs("div",{style:{position:"absolute",inset:0,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",pointerEvents:"none"},children:[e.jsx("span",{style:{fontSize:22,fontWeight:600,color:"#111"},children:u.toLocaleString()}),e.jsx("span",{style:{fontSize:11,color:"#9ca3af"},children:"total"})]})]}),e.jsxs("div",{className:"flex flex-col gap-3 flex-1",children:[e.jsxs("div",{children:[e.jsxs("div",{className:"flex justify-between mb-1",children:[e.jsxs("span",{className:"text-sm text-gray-600 flex items-center gap-1.5",children:[e.jsx("span",{style:{width:10,height:10,borderRadius:2,background:"#1D9E75",display:"inline-block"}}),"Adult"]}),e.jsxs("span",{className:"text-sm font-medium text-gray-800",children:[d,"%"]})]}),e.jsx("div",{style:{height:6,background:"#f3f4f6",borderRadius:3,overflow:"hidden"},children:e.jsx("div",{style:{height:"100%",width:`${d}%`,background:"#1D9E75",borderRadius:3,transition:"width 0.8s ease"}})}),e.jsxs("span",{className:"text-xs text-gray-400 mt-0.5 block",children:[s.toLocaleString()," attendees"]})]}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex justify-between mb-1",children:[e.jsxs("span",{className:"text-sm text-gray-600 flex items-center gap-1.5",children:[e.jsx("span",{style:{width:10,height:10,borderRadius:2,background:"#5DCAA5",display:"inline-block"}}),"Youth"]}),e.jsxs("span",{className:"text-sm font-medium text-gray-800",children:[o,"%"]})]}),e.jsx("div",{style:{height:6,background:"#f3f4f6",borderRadius:3,overflow:"hidden"},children:e.jsx("div",{style:{height:"100%",width:`${o}%`,background:"#5DCAA5",borderRadius:3,transition:"width 0.8s ease"}})}),e.jsxs("span",{className:"text-xs text-gray-400 mt-0.5 block",children:[r.toLocaleString()," attendees"]})]})]})]})]})}function Te({data:s,total:r}){const l=i.useRef(null),c=i.useRef(null);i.useEffect(()=>{if(!(!l.current||!s.length))return T().then(o=>{c.current&&c.current.destroy();const d=s.map(m=>m.county),y=s.map(m=>m.percentage),n=y.map(m=>m>=51?"#1D9E75":"#378ADD");c.current=new o(l.current,{type:"bar",data:{labels:d,datasets:[{data:y,backgroundColor:n,borderRadius:4,barThickness:28}]},options:{indexAxis:"y",responsive:!0,maintainAspectRatio:!1,plugins:{legend:{dis
1play:!1},tooltip:{callbacks:{label:m=>` ${s[m.dataIndex].count} performances (${m.raw}%)`}}},scales:{x:{min:0,max:100,grid:{color:"#f3f4f6"},ticks:{callback:m=>`${m}%`,font:{size:11},color:"#9ca3af"}},y:{grid:{display:!1},ticks:{font:{size:12},color:"#374151"}}}},plugins:[{afterDraw(m){const{ctx:x,chartArea:N,scales:P}=m,k=P.x.getPixelForValue(51);x.save(),x.setLineDash([4,3]),x.strokeStyle="#ef4444",x.lineWidth=1.5,x.beginPath(),x.moveTo(k,N.top),x.lineTo(k,N.bottom),x.stroke(),x.setLineDash([]),x.fillStyle="#ef4444",x.font="10px system-ui",x.textAlign="center",x.fillText("51%",k,N.top-6),x.restore()}}]})}),()=>{c.current&&c.current.destroy()}},[s,r]);const u=Math.max(120,s.length*48+40);return e.jsxs("div",{className:"bg-white rounded-xl border border-gray-200 p-5",children:[e.jsxs("div",{className:"flex items-baseline justify-between mb-1",children:[e.jsx("h3",{className:"text-sm font-semibold text-gray-500 uppercase tracking-wide",children:"Performances by County"}),e.jsxs("span",{className:"text-xs text-gray-400 flex items-center gap-1",children:[e.jsx("span",{style:{display:"inline-block",width:14,height:2,borderTop:"1.5px dashed #ef4444"}}),"51% grant threshold"]})]}),e.jsx("p",{className:"text-xs text-gray-400 mb-4",children:s.some(o=>o.percentage>=51)?`✓ ${s.find(o=>o.percentage>=51).county} meets the 51% requirement`:"No county currently meets the 51% threshold"}),e.jsx("div",{style:{position:"relative",height:u},children:e.jsx("canvas",{ref:l})})]})}function Pe({data:s,total:r}){const l=i.useRef(null),c=i.useRef(null);i.useEffect(()=>{if(!(!l.current||!s.length))return T().then(o=>{c.current&&c.current.destroy(),c.current=new o(l.current,{type:"bar",data:{labels:s.map(d=>d.county),datasets:[{data:s.map(d=>d.count),backgroundColor:"#378ADD",borderRadius:4,barThickness:28}]},options:{indexAxis:"y",responsive:!0,maintainAspectRatio:!1,plugins:{legend:{display:!1},tooltip:{callbacks:{label:d=>{const y=r>0?Math.round(d.raw/r*100):0;return` ${d.raw.toLocaleString()} attendees (${y}%)`}}}},scales:{x:{grid:{color:"#f3f4f6"},ticks:{callback:d=>d>=1e3?`${(d/1e3).toFixed(0)}k`:d,font:{size:11},color:"#9ca3af"}},y:{grid:{display:!1},ticks:{font:{size:12},color:"#374151"}}}}})}),()=>{c.current&&c.current.destroy()}},[s,r]);const u=Math.max(120,s.length*48+40);return e.jsxs("div",{className:"bg-white rounded-xl border border-gray-200 p-5",children:[e.jsx("h3",{className:"text-sm font-semibold text-gray-500 uppercase tracking-wide mb-4",children:"Audience by County"}),e.jsx("div",{style:{position:"relative",height:u},children:e.jsx("canvas",{ref:l})})]})}function Le({performances:s}){const r=i.useRef(null),l=i.useRef(null);return i.useEffect(()=>{if(!(!r.current||!s.length))return T().then(c=>{l.current&&l.current.destroy();const u=Array.from({length:12},(o,d)=>({label:new Date(2e3,d).toLocaleString("default",{month:"short"}),count:0,audience:0}));for(const o of s){if(!o.date)continue;const d=new Date(o.date+"T12:00:00Z").getUTCMonth();u[d].count++,u[d].audience+=o.audienceTotal||0}l.current=new c(r.current,{type:"bar",data:{labels:u.map(o=>o.label),datasets:[{label:"Performances",data:u.map(o=>o.count),backgroundColor:"#1D9E75",borderRadius:4,yAxisID:"y",order:2},{label:"Audience",data:u.map(o=>o.audience),type:"line",borderColor:"#378ADD",borderWidth:2.5,backgroundColor:"rgba(55,138,221,0.08)",fill:!0,tension:.4,pointRadius:5,pointBackgroun
1dColor:"#378ADD",yAxisID:"y1",order:1}]},options:{responsive:!0,maintainAspectRatio:!1,interaction:{mode:"index",intersect:!1},plugins:{legend:{display:!1}},scales:{x:{grid:{display:!1},ticks:{font:{size:11},color:"#9ca3af"}},y:{position:"left",grid:{color:"#f3f4f6"},ticks:{stepSize:1,font:{size:11},color:"#1D9E75"},title:{display:!0,text:"Performances",color:"#1D9E75",font:{size:11}}},y1:{position:"right",grid:{drawOnChartArea:!1},ticks:{callback:o=>o>=1e3?`${(o/1e3).toFixed(0)}k`:o,font:{size:11},color:"#378ADD"},title:{display:!0,text:"Audience",color:"#378ADD",font:{size:11}}}}}})}),()=>{l.current&&l.current.destroy()}},[s]),s.length?e.jsxs("div",{className:"bg-white rounded-xl border border-gray-200 p-5",children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsx("h3",{className:"text-sm font-semibold text-gray-500 uppercase tracking-wide",children:"Activity Timeline"}),e.jsxs("div",{className:"flex gap-4 text-xs text-gray-400",children:[e.jsxs("span",{className:"flex items-center gap-1.5",children:[e.jsx("span",{style:{width:10,height:10,borderRadius:2,background:"#1D9E75",display:"inline-block"}}),"Performances"]}),e.jsxs("span",{className:"flex items-center gap-1.5",children:[e.jsx("span",{style:{width:10,height:2,background:"#378ADD",display:"inline-block"}}),"Audience"]})]})]}),e.jsx("div",{style:{position:"relative",height:200},children:e.jsx("canvas",{ref:r})})]}):null}function Be({summary:s,performances:r}){const l=s.totalAudience>0,c=s.performancesByCounty.length>0,u=s.audienceByCounty.length>0;return e.jsxs("div",{className:"space-y-4 mb-4",children:[r.length>0&&e.jsx(Le,{performances:r}),e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[l&&e.jsx(De,{adult:s.audienceAdult,youth:s.audienceYouth}),c&&e.jsx(Te,{data:s.performancesByCounty,total:s.totalPerformances})]}),u&&e.jsx(Pe,{data:s.audienceByCounty,total:s.totalAudience})]})}const te={high:"bg-green-100 text-green-700",medium:"bg-amber-100 text-amber-700",low:"bg-gray-100 text-gray-500"},se={local:"bg-blue-100 text-blue-700",state:"bg-purple-100 text-purple-700",national:"bg-indigo-100 text-indigo-700"},Ye={foundedYear:"",annualBudget:"",isScfdRecipient:!1,isAcbMember:!1,nonprofitEin:"",grantCapabilities:[],nonprofitStatus:"none",nonprofitAttestedAt:null,attestNonprofit:!1,viaFiscalSponsor:!1,fiscalSponsorName:"",fiscalSponsorEin:""};function re(s={}){const r=s.grantCapabilities?typeof s.grantCapabilities=="string"?JSON.parse(s.grantCapabilities):s.grantCapabilities:[];return{foundedYear:s.foundedYear||"",annualBudget:ae(s.annualBudget||""),isScfdRecipient:!!s.isScfdRecipient,isAcbMember:!!s.isAcbMember,nonprofitEin:s.nonprofitEin||"",grantCapabilities:Array.isArray(r)?r:[],nonprofitStatus:s.nonprofitStatus||"none",nonprofitAttestedAt:s.nonprofitAttestedAt||null,attestNonprofit:!1,viaFiscalSponsor:!!s.fiscalSponsorName,fiscalSponsorName:s.fiscalSponsorName||"",fiscalSponsorEin:s.fiscalSponsorEin||""}}function $e(s){return{foundedYear:s.foundedYear||null,annualBudget:s.annualBudget||null,isScfdRecipient:!!s.isScfdRecipient,isAcbMember:!!s.isAcbMember,nonprofitEin:s.nonprofitEin||null,grantCapabilities:s.grantCapabilities,fiscalSponsorName:s.viaFiscalSponsor&&s.fiscalSponsorName||null,fiscalSponsorEin:s.viaFiscalSponsor&&s.fiscalSponsorEin||null,...s.attestNonprofit?{attestNonprofit:!0}:{}}}function Fe({profile:s}){const r=s.isNonprofit?`Yes${s.nonprofitStatus==="verified"?" (verified)":""}`:s.appliesViaFiscalSponsor?`No — applies through fiscal sponsor ${s.fiscalSponsorName}
1`:"No (not confirmed, no fiscal sponsor on file)",l=s.foundedYear?`Founded ${s.foundedYear} (${s.yearsInOperation} years)`:"Not on file — add your founding year above",c=[["501(c)(3)",r],["Years in operation",l],["ACB member",s.isAcbMember?"Yes":"No"],["Active members",s.activeMembers],["Performances this year",s.performancesThisYear],["Audience this year",Number(s.audienceThisYear||0).toLocaleString()]];return e.jsxs("div",{className:"bg-gray-50 rounded-xl border border-gray-200 p-4 mb-4","data-testid":"searched-profile",children:[e.jsx("h4",{className:"text-xs font-semibold text-gray-500 uppercase tracking-wide mb-2",children:"What the search was told"}),e.jsx("dl",{className:"grid grid-cols-1 sm:grid-cols-2 gap-x-6 gap-y-1 text-xs",children:c.map(([u,o])=>e.jsxs("div",{className:"flex gap-2",children:[e.jsxs("dt",{className:"text-gray-400 shrink-0",children:[u,":"]}),e.jsx("dd",{className:"text-gray-700",children:o})]},u))}),s.capabilities?.length>0&&e.jsxs("p",{className:"text-xs text-gray-500 mt-2",children:["Capabilities: ",s.capabilities.join(" · ")]})]})}function Me({grant:s}){const r=s.applyPath,l=s.howElseToApply&&s.howElseToApply!=="Contact the funder"?s.howElseToApply:null;if(!r)return!s.applicationUrl||s.applicationUrl==="Contact funder"?l?e.jsx("p",{className:"text-xs text-gray-500 max-w-[14rem] shrink-0",children:l}):null:e.jsx("a",{href:s.applicationUrl,target:"_blank",rel:"noopener noreferrer",className:"shrink-0",children:e.jsx(j,{variant:"secondary",size:"sm",className:"!text-xs",children:"Apply"})});const c={apply:"Apply",funder_site:"Funder's site",search:"Find the application"};return e.jsxs("div",{className:"shrink-0 w-44 flex flex-col items-end gap-1",children:[e.jsx("a",{href:r.url,target:"_blank",rel:"noopener noreferrer",children:e.jsx(j,{variant:"secondary",size:"sm",className:"!text-xs",children:c[r.kind]})}),r.kind==="apply"&&r.verified&&e.jsx("span",{className:"text-[11px] text-green-700",children:"Link checked just now"}),r.note&&e.jsx("p",{className:"text-[11px] text-gray-500 text-right leading-snug",children:r.note}),l&&r.kind!=="apply"&&e.jsx("p",{className:"text-[11px] text-gray-500 text-right leading-snug",children:l})]})}function D({label:s,value:r}){return e.jsxs("div",{className:"bg-white rounded-xl border border-gray-200 p-4 text-center",children:[e.jsx("p",{className:"text-2xl font-bold text-gray-900",children:typeof r=="number"?r.toLocaleString():r}),e.jsx("p",{className:"text-xs text-gray-400 mt-1",children:s})]})}function qe(){const{currentOrg:s}=Ne(),{showSuccess:r,showError:l}=ve(),c=new Date().getFullYear(),[u,o]=i.useState(`${c}-01-01`),[d,y]=i.useState(`${c}-12-31`),[n,m]=i.useState(null),[x,N]=i.useState(!1),[P,k]=i.useState(null),[z,ne]=i.useState(0),[H,ie]=i.useState(0),[X,I]=i.useState(0),[L,le]=i.useState("report"),[B,oe]=i.useState(null),[A,ce]=i.useState("all"),[b,O]=i.useState(!1),[V,de]=i.useState(null),[ue,xe]=i.useState(!1),[p,g]=i.useState(Ye),[_,W]=i.useState(!1),[Y,q]=i.useState(!1),[w,$]=i.useState(""),[U,he]=i.useState(null);i.useEffect(()=>{R.getGrantProfile().then(t=>{g(re(t)),W(!0)}).catch(()=>W(!0))},[]);async function J({toast:t=!0}={}){q(!0);try{const a=await R.updateGrantProfile($e(p));return a&&typeof a=="object"&&"nonprofitStatus"in a&&g(re(a)),t&&r("Grant profile saved"),!0}catch{return l("Failed to save profile"),!1}finally{q(!1)}}async function me(){N(!0);try{const t=await R.generate(u,d);m(t),t?.volunteerHours?.hours>0&&I(t.volunteerHours.hours)}catch{l(ke("grant report"))}finally{N(!1)}}function pe(){if(!n)return;const t=n.summary,a=we(),f=s?.shortName||"band",v=[["Organization",n.org.name],["Report Period",`${u} to ${d}`],["Counted Through",n.period?.countedThrough||d],["Excluded — Cancelled",n.excluded?.cancelled??0],["Excluded — Not Yet Performed",n.excluded?.upcoming??0],["Total Performances",t.totalPerformances],["Total Audience",t.totalAudience],["Adult Attendees",t.audienceAdult],["Youth Attendees",t.audienceYouth],["Virtual Attendees",H],["Schools Served",z],["Volunteer Hours",X],["",""],["Audience by County",""],["County","Attendees"],...t.audienceByCounty.map(h=>[h.county,h.count]),["",""],["Performances by Venue County",""],["County","Performances","% of Total"],...t.performancesByCounty.map(h=>[h.county,h.count,`${h.percentage}%`])],G=["Date","Title","Venue","City","County","Ensemble","Audience Total","Adult","Youth","Performers"],ye=n.performances.map(h=>[h.date,h.title,h.venue||"",h.venueCity||"",h.venueCounty||"",h.ensemble||"",h.audienceTotal,h.audienceAdult,h.audienceYouth,h.performerCount]),be=["","","","","","","","","",""],je=[...v.map(h=>[...h,"","","","","","","",""]),["","","","","","","","","",""],["--- PERFORMANCE DETAIL ---","","","","","","","","",""],G,...ye];Se(`grant-report-${f}-${a}.csv`,be,je)}const F=i.useRef(null);async function ge(){if(_&&!await J({toast:!1}))return;const t=new AbortController;F.current=t,O(!0);try{const a=await R.discoverGrants(t.signal);oe(a.grants||[]),de(a.researchedAt),he(a.profile||null),xe(!!a.truncated)}catch(a){t.signal.aborted||a?.code==="ERR_CANCELED"||a?.name==="CanceledError"||l("Failed to discover grant opportunities")}finally{F.current=null,O(!1)}}function fe(){F.current?.abort()}const M=n?.period?.countedThrough,K=M&&M<d?`Counts performances through ${E(M)} — the rest of this range hasn't happened yet. `:"",Z=(()=>{const t=[];return n?.excluded?.cancelled&&t.push(`${n.excluded.cancelled} cancelled`),n?.excluded?.upcoming&&t.push(`${n.excluded.upcoming} not yet performed`),t.length?`Not counted in this range: ${t.join(" and ")}.`:""})(),Q=B?.filter(t=>A==="all"?!0:A==="high"?t.likelihood==="high":t.grantType===A)??[];return e.jsxs("div",{className:"px-4 md:px-0",children:[e.jsx(Ce,{title:"Grant Report",breadcrumbs:[{label:"Reports",to:"/reports"},{label:"Grant Report"}]}),e.jsx(Re,{className:"mb-4",ariaLabel:"Grant report sections",preserveFocus:!0,tabs:[{key:"report",label:"Grant report"},{key:"discover",label:"Grant opportunities"}],value:L,onChange:le}),L==="report"&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"bg-white rounded-xl border border-gray-200 p-5 mb-4",children:e.jsxs("div",{className:"flex flex-wrap items-end gap-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-medium text-gray-500 mb-1",children:"Start Date"}),e.jsx("input",{type:"date",value:u,onChange:t=>o(t.target.value),className:"rounded-md border border-gray-300 px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-brand-primary"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-medium text-gray-500 mb-1",children:"End Date"}),e.jsx("input",{type:"date",value:d,onChange:t=>y(t.target.value),className:"rounded-md border border-gray-300 px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-brand-primary"})]}),e.jsx(j,{onClick:me,disabled:x,isLoading:x,children:"Generate report"}),n&&e.jsx(j,{variant:"secondary",onClick:pe,children:"Export CSV"})]})}),x&&e.jsx("div",{className:"space-y-3",children:Array.from({length:3}).map((t,a)=>e.jsx(ee,{lines:2},a))}),n&&!x&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-3 mb-4",children:[e.jsx(D,{label:"Total Performances",value:n.summary.totalPerformances}),e.jsx(D,{label:"Total Audience",value:n.summary.totalAudience}),e.jsx(D,{label:"Adult Attendees",value:n.summary.audienceAdult}),e.jsx(D,{label:"Youth Attendees",value:n.summary.audienceYouth})]}),(Z||K)&&e.jsxs("p",{className:"text-xs text-gray-500 mb-4",children:[K,Z]}),e.jsx(Be,{summary:n.summary,performances:n.performances}),n.summary.audienceByCounty.length>0&&e.jsxs("div",{className:"bg-white rounded-xl border border-gray-200 p-5 mb-4",children:[e.jsx("h3",{className:"text-sm font-semibold text-gray-500 uppercase tracking-wide mb-3",children:"Audience by County"}),e.jsxs("table",{className:"w-full text-sm",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"text-left text-xs font-medium text-gray-400 uppercase tracking-wide border-b border-gray-100",children:[e.jsx("th",{className:"pb-2 pr-4",children:"County"}),e.jsx("th",{className:"pb-2 pr-4 text-right",children:"Attendees"}),e.jsx("th",{className:"pb-2 text-right",children:"% of Total"})]})}),e.jsxs("tbody",{className:"divide-y divide-gray-50",children:[n.summary.audienceByCounty.map(t=>e.jsxs("tr",{children:[e.jsx("td",{className:"py-2 pr-4 text-gray-700",children:t.county}),e.jsx("td",{className:"py-2 pr-4 text-right text-gray-700 font-medium",children:t.count.toLocaleStr
1ing()}),e.jsxs("td",{className:"py-2 text-right text-gray-500",children:[t.percentage,"%"]})]},t.county)),e.jsxs("tr",{className:"border-t border-gray-200 font-semibold",children:[e.jsx("td",{className:"py-2 pr-4 text-gray-900",children:"Total"}),e.jsx("td",{className:"py-2 pr-4 text-right text-gray-900",children:n.summary.totalAudience.toLocaleString()}),e.jsx("td",{className:"py-2 text-right text-gray-900",children:"100%"})]})]})]})]}),n.summary.performancesByCounty.length>0&&e.jsxs("div",{className:"bg-white rounded-xl border border-gray-200 p-5 mb-4",children:[e.jsxs("div",{className:"flex items-baseline justify-between mb-3",children:[e.jsx("h3",{className:"text-sm font-semibold text-gray-500 uppercase tracking-wide",children:"Performances by County"}),e.jsx("span",{className:"text-xs text-gray-400",children:"Some grants require 51% of performances in a single county"})]}),e.jsxs("table",{className:"w-full text-sm",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"text-left text-xs font-medium text-gray-400 uppercase tracking-wide border-b border-gray-100",children:[e.jsx("th",{className:"pb-2 pr-4",children:"County"}),e.jsx("th",{className:"pb-2 pr-4 text-right",children:"Performances"}),e.jsx("th",{className:"pb-2 pr-4 text-right",children:"% of Total"}),e.jsx("th",{className:"pb-2 text-right",children:"51% Threshold"})]})}),e.jsxs("tbody",{className:"divide-y divide-gray-50",children:[n.summary.performancesByCounty.map(t=>e.jsxs("tr",{children:[e.jsx("td",{className:"py-2 pr-4 text-gray-700",children:t.county}),e.jsx("td",{className:"py-2 pr-4 text-right text-gray-700 font-medium",children:t.count}),e.jsxs("td",{className:"py-2 pr-4 text-right text-gray-700",children:[t.percentage,"%"]}),e.jsx("td",{className:"py-2 text-right",children:t.percentage>=51?e.jsx("span",{className:"inline-flex items-center px-2 py-0.5 rounded text-xs font-medium bg-green-100 text-green-700",children:"✓ Meets 51%"}):e.jsx("span",{className:"inline-flex items-center px-2 py-0.5 rounded text-xs font-medium bg-gray-100 text-gray-500",children:"Below 51%"})})]},t.county)),e.jsxs("tr",{className:"border-t border-gray-200 font-semibold",children:[e.jsx("td",{className:"py-2 pr-4 text-gray-900",children:"Total"}),e.jsx("td",{className:"py-2 pr-4 text-right text-gray-900",children:n.summary.totalPerformances}),e.jsx("td",{className:"py-2 pr-4 text-right text-gray-900",children:"100%"}),e.jsx("td",{})]})]})]})]}),e.jsxs("div",{className:"bg-white rounded-xl border border-gray-200 p-5 mb-4",children:[e.jsx("h3",{className:"text-sm font-semibold text-gray-500 uppercase tracking-wide mb-3",children:"Figures You Track Elsewhere"}),e.jsx("p",{className:"text-xs text-gray-400 mb-3",children:"Backstage Baton doesn’t track these. Enter them before exporting — most arts funders ask for at least one."}),e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-medium text-gray-500 mb-1",children:"Schools Served"}),e.jsx("input",{type:"number",min:"0",value:z,onChange:t=>ne(Number(t.target.value)),className:"w-full rounded-md border border-gray-300 px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-brand-primary"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-medium text-gray-500 mb-1",children:"Virtual Attendees"}),e.jsx("input",{type:"number",min:"0",value:H,onChange:t=>ie(Number(t.target.value)),className:"w-full rounded-md border border-gray-300 px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-brand-primary"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-medium text-gray-500 mb-1",children:"Total Volunteer Hours"}),e.jsx("input",{type:"number",min:"0",value:X,onChange:t=>I(Number(t.target.value)),className:"w-full rounded-md border border-gray-300 px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-brand-primary"}),n?.volunteerHours?.hours>0&&e.jsxs("p",{className:"text-xs text-gray-500 mt-1","data-testid":"grant-volunteer-note",children:[Ae(n.volunteerHours.hours)," from ",n.volunteerHours.people," ",n.volunteerHours.people===1?"person":"people"," on Help wanted jobs in these dates. Paid jobs and playing time are left out. Change the number if your band counts other hours."]})]})]})]}),e.jsxs("div",{className:"bg-white rounded-xl border border-gray-200 overflow-hidden mb-4",children:[e.jsx("div",{className:"px-5 py-3 border-b border-gray-100",children:e.jsx("h3",{className:"text-sm font-semibold text-gray-500 uppercase tracking-wide",children:"Performances"})}),e.jsxs("table",{className:"w-full text-sm",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"text-left text-xs font-medium text-gray-400 uppercase tracking-wide border-b border-gray-100",children:[e.jsx("th",{className:"px-5 py-2",children:"Date"}),e.jsx("th",{className:"px-3 py-2",children:"Title"}),e.jsx("th",{className:"px-3 py-2",children:"Venue"}),e.jsx("th",{className:"px-3 py-2",children:"County"}),e.jsx("th",{className:"px-3 py-2 text-right",children:"Audience"}),e.jsx("th",{className:"px-3 py-2 text-right",children:"Adult"}),e.jsx("th",{className:"px-3 py-2 text-right",children:"Youth"}),e.jsx("th",{className:"px-3 py-2 text-right",children:"Performers"})]})}),e.jsx("tbody",{className:"divide-y divide-gray-50",children:n.performances.map(t=>e.jsxs("tr",{className:"hover:bg-gray-50 cursor-pointer",onClick:()=>k(P===t.id?null:t.id),children:[e.jsx("td",{className:"px-5 py-2.5 whitespace-nowrap text-gray-500",children:E(t.date)}),e.jsx("td",{className:"px-3 py-2.5 font-medium text-gray-900",children:t.title}),e.jsx("td",{className:"px-3 py-2.5 text-gray-500",children:t.venue||"—"}),e.jsx("td",{className:"px-3 py-2.5 text-gray-500",children:t.venueCounty||"—"}),e.jsx("td",{className:"px-3 py-2.5 text-right font-medium text-gray-900",children:t.audienceTotal.toLocaleStr
1ing()}),e.jsx("td",{className:"px-3 py-2.5 text-right text-gray-500",children:t.audienceAdult}),e.jsx("td",{className:"px-3 py-2.5 text-right text-gray-500",children:t.audienceYouth}),e.jsx("td",{className:"px-3 py-2.5 text-right text-gray-500",children:t.performerCount})]},t.id))})]})]})]})]}),L==="discover"&&e.jsxs("div",{children:[_&&e.jsxs("div",{className:"bg-white rounded-xl border border-gray-200 p-5 mb-4",children:[e.jsx("h3",{className:"text-sm font-semibold text-gray-500 uppercase tracking-wide mb-3",children:"Grant Profile"}),e.jsx("p",{className:"text-xs text-gray-400 mb-3",children:"This information is sent with every search to find grants you qualify for. Discover Grants saves it first, so what you see here is what the search is told."}),e.jsxs("div",{className:"mb-4",children:[p.nonprofitStatus==="verified"&&e.jsxs("p",{className:"text-sm text-green-700","data-testid":"nonprofit-status",children:[e.jsx("span",{className:"font-semibold",children:"501(c)(3) verified"})," by Backstage Baton."]}),p.nonprofitStatus==="attested"&&e.jsxs("p",{className:"text-sm text-green-700","data-testid":"nonprofit-status",children:[e.jsx("span",{className:"font-semibold",children:"501(c)(3) confirmed"}),p.nonprofitAttestedAt?` on ${E(p.nonprofitAttestedAt)}`:"",".",e.jsx("span",{className:"text-gray-400",children:" Not right? Contact support."})]}),p.nonprofitStatus==="none"&&e.jsxs("label",{className:"flex items-start gap-2 text-sm text-gray-700 cursor-pointer",children:[e.jsx("input",{type:"checkbox",checked:p.attestNonprofit,onChange:t=>g(a=>({...a,attestNonprofit:t.target.checked})),className:"mt-0.5 rounded border-gray-300 text-brand-primary focus:ring-brand-primary"}),e.jsxs("span",{children:[e.jsx("span",{className:"font-medium",children:"We're a 501(c)(3)"}),e.jsx("span",{className:"block text-xs text-gray-400",children:"I confirm our organization is recognized as tax-exempt under Section 501(c)(3). Leave this unchecked if you apply through a fiscal sponsor."})]})]})]}),e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-4",children:[e.jsx(C,{label:"EIN",value:p.nonprofitEin,onChange:t=>g(a=>({...a,nonprofitEin:t.target.value})),placeholder:"XX-XXXXXXX"}),e.jsx(C,{label:"Year Founded",type:"number",value:p.foundedYear,onChange:t=>g(a=>({...a,foundedYear:t.target.value?Number(t.target.value):""})),placeholder:"e.g. 1995"}),e.jsx(C,{label:"Annual Budget",value:p.annualBudget,onChange:t=>g(a=>({...a,annualBudget:ae(t.target.value)})),placeholder:"e.g. $25,000"})]}),e.jsx("p",{className:"text-xs text-gray-400 mt-2 mb-4",children:"Your EIN describes the organization to the search — it is never looked up. Without a founding year, the search can’t tell how long you’ve been around."}),e.jsxs("div",{className:"flex flex-col gap-2 mb-4",children:[e.jsxs("label",{className:"flex items-center gap-2 text-sm text-gray-700 cursor-pointer",children:[e.jsx("input",{type:"checkbox",checked:p.isAcbMember,onChange:t=>g(a=>({...a,isAcbMember:t.target.checked})),className:"rounded border-gray-300 text-brand-primary focus:ring-brand-primary"}),"Member of the Association of Concert Bands (ACB)"]}),e.jsxs("label",{className:"flex items-center gap-2 text-sm text-gray-700 cursor-pointer",children:[e.jsx("input",{type:"checkbox",checked:p.isScfdRecipient,onChange:t=>g(a=>({...a,isScfdRecipient:t.target.checked})),className:"rounded border-gray-300 text-brand-primary focus:ring-brand-primary"}),"Current SCFD recipient ",e.jsx("span",{className:"text-gray-400",children:"(metro Denver district only)"})]})]}),e.jsxs("div",{className:"mb-4",children:[e.jsxs("label",{className:"flex items-start gap-2 text-sm text-gray-700 cursor-pointer",children:[e.jsx("input",{type:"checkbox",checked:p.viaFiscalSponsor,onChange:t=>g(a=>({...a,viaFiscalSponsor:t.target.checked})),className:"mt-0.5 rounded border-gray-300 text-brand-primary focus:ring-brand-primary"}),e.jsxs("span",{children:[e.jsx("span",{className:"font-medium",children:"We apply for grants through a fiscal sponsor"}),e.jsx("span",{className:"block text-xs text-gray-400",children:"Many funders accept fiscally sponsored applicants; some require your own 501(c)(3). The search will tell you which is which."})]})]}),p.viaFiscalSponsor&&e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4 mt-3",children:[e.jsx(C,{label:"Fiscal sponsor name",value:p.fiscalSponsorName,onChange:t=>g(a=>({...a,fiscalSponsorName:t.target.value})),placeholder:"e.g. Cortez Cultural Center"}
1),e.jsx(C,{label:"Fiscal sponsor EIN",value:p.fiscalSponsorEin,onChange:t=>g(a=>({...a,fiscalSponsorEin:t.target.value})),placeholder:"XX-XXXXXXX"})]})]}),e.jsxs("div",{className:"mb-3",children:[e.jsx("label",{className:"block text-xs font-medium text-gray-500 mb-1",children:"Additional Capabilities"}),e.jsx("p",{className:"text-xs text-gray-400 mb-2",children:"BSB auto-detects audience tracking, attendance records, and performance data. Add anything else grant funders should know."}),e.jsx("div",{className:"flex flex-wrap gap-1.5 mb-2",children:p.grantCapabilities.map((t,a)=>e.jsxs("span",{className:"inline-flex items-center gap-1 text-xs bg-gray-100 text-gray-700 px-2 py-1 rounded",children:[t,e.jsx("button",{type:"button",onClick:()=>g(f=>({...f,grantCapabilities:f.grantCapabilities.filter((v,G)=>G!==a)})),className:"text-gray-400 hover:text-red-500",children:e.jsx("svg",{className:"h-3 w-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]},a))}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("input",{type:"text",value:w,onChange:t=>$(t.target.value),onKeyDown:t=>{t.key==="Enter"&&w.trim()&&(g(a=>({...a,grantCapabilities:[...a.grantCapabilities,w.trim()]})),$(""))},placeholder:"e.g. Maintains audited financials, Partners with local schools",className:"flex-1 rounded-md border border-gray-300 px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-brand-primary"}),e.jsx(j,{type:"button",variant:"secondary",size:"sm",onClick:()=>{w.trim()&&(g(t=>({...t,grantCapabilities:[...t.grantCapabilities,w.trim()]})),$(""))},children:"Add"})]})]}),e.jsx(j,{type:"button",variant:"secondary",size:"sm",onClick:()=>J(),disabled:Y,isLoading:Y,children:"Save profile"})]}),e.jsxs("div",{className:"bg-white rounded-xl border border-gray-200 p-5 mb-4",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-4",children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("h3",{className:"text-sm font-semibold text-gray-900",children:"Grant Discovery"}),e.jsx("p",{className:"text-xs text-gray-400 mt-0.5",children:"Research grant opportunities based on your organization profile, location, and audience data."})]}),b&&e.jsx(j,{type:"button",variant:"secondary",onClick:fe,children:"Cancel"}),e.jsx(j,{variant:"ai",onClick:ge,disabled:b||Y,isLoading:b,children:b?"Researching…":B?"Refresh Research":"Discover Grants"})]}),e.jsx("p",{className:"text-xs text-gray-400 mt-2",children:"Results are researched fresh each run and will differ between runs. Every link is checked for a live page before it is shown, and dead ones are replaced with the funder's site or a search — but a working link is not proof it is the right application page, so confirm deadlines and eligibility with the funder before you start."}),V&&e.jsxs("p",{className:"text-xs text-gray-400 mt-1",children:["Last researched: ",E(V)]})]}),ue&&!b&&e.jsx("div",{className:"bg-amber-50 border border-amber-200 rounded-lg text-sm text-amber-800 p-3 mb-4",children:"The research ran long and was cut short, so this is a partial list. Everything shown is complete — run it again for more."}),U&&!b&&e.jsx(Fe,{profile:U}),b&&e.jsxs("div",{className:"space-y-3",children:[e.jsx("p",{className:"text-sm text-gray-500",children:"Researching real funders and checking every link — this usually takes a minute or two. You can switch tabs while it runs, or press Cancel to stop the search."}),Array.from({length:4}).map((t,a)=>e.jsx(ee,{lines:3},a))]}),B&&!b&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"flex gap-2 mb-4 flex-wrap",children:[{key:"all",label:"All"},{key:"high",label:"High likelihood"},{key:"local",label:"Local"},{key:"state",label:"State"},{key:"national",label:"National"}].map(t=>e.jsx("button",{type:"button",onClick:()=>ce(t.key),className:`px-3 py-1.5 text-xs font-medium rounded-full transition-colors ${A===t.key?"bg-brand-primary text-white":"bg-gray-100 text-gray-600 hover:bg-gray-200"}`,children:t.label},t.key))}),Q.length===0?e.jsx(Ee,{size:"compact",title:"No grants match the current filter."}):e.jsx("div",{className:"space-y-3",children:Q.map((t,a)=>e.jsx("div",{className:"bg-white rounded-xl border border-gray-200 p-5",children:e.jsxs("div",{className:"flex items-start gap-4",children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2 flex-wrap mb-1",children:[e.jsx("h4",{className:"text-sm font-semibold text-gray-900",children:t.name}),e.jsx("span",{className:`inline-flex items-center px-1.5 py-0.5 rounded text-xs font-medium ${te[t.likelihood]||te.low}`,children:t.likelihood}),e.jsx("span",{className:`inline-flex items-center px-1.5 py-0.5 rounded text-xs font-medium ${se[t.grantType]||se.n
1ational}`,children:t.grantType})]}),e.jsx("p",{className:"text-xs text-gray-500",children:t.funder}),e.jsxs("div",{className:"flex items-center gap-4 mt-2 text-xs text-gray-400",children:[t.amountRange&&e.jsx("span",{className:"font-medium text-gray-700",children:t.amountRange}),t.deadline&&e.jsxs("span",{children:["Deadline: ",t.deadline]})]}),t.likelihoodReason&&e.jsx("p",{className:"text-xs text-gray-500 mt-2 italic",children:t.likelihoodReason}),e.jsxs("div",{className:"flex flex-wrap gap-1.5 mt-2",children:[t.requirementsMet?.map((f,v)=>e.jsxs("span",{className:"inline-flex items-center gap-0.5 text-xs text-green-700 bg-green-50 px-1.5 py-0.5 rounded",children:[e.jsx("svg",{className:"h-3 w-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2.5,children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 13l4 4L19 7"})}),f]},v)),t.requirementsMissing?.map((f,v)=>e.jsxs("span",{className:"inline-flex items-center gap-0.5 text-xs text-red-700 bg-red-50 px-1.5 py-0.5 rounded",children:[e.jsx("svg",{className:"h-3 w-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2.5,children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})}),f]},v))]})]}),e.jsx(Me,{grant:t})]})},a))})]})]})]})}export{qe as GrantReportPage};

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.