PageSourceSearch

https://app.grantwizard.ai/_next/static/chunks/pages/onboarding/profile-wizard-bef9593657d7ec88.js

js grantwizard.ai collected 2026-10-05 13:40:09 UTC 75,028 bytes, 1 lines download raw bytes

1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[7740],{44231:function(e,a,t){(window.__NEXT_P=window.__NEXT_P||[]).push(["/onboarding/profile-wizard",function(){return t(9344)}])},60691:function(e,a,t){"use strict";t.d(a,{Z:function(){return s}});var l=t(85893),r=t(67294);let n={narrative:["Analyzing grant requirements...","Reviewing your organization profile...","Researching statistics...","Drafting response...","Checking consistency with locked parameters...","Finalizing..."],budget:["Parsing budget requirements...","Calculating personnel allocations...","Generating program implementation costs...","Adding operational line items...","Validating totals and distribution rules...","Finalizing budget..."],projectIdea:["Extracting funder priorities...","Matching against your organization...","Scoring eligibility criteria...","Generating recommendations..."],grantSearch:["Scanning global grant databases...","Searching government funding portals...","Checking foundation and corporate funders...","Searching sector-specific funding sources...","Verifying application deadlines and status...","Confirming grant URLs and application links...","Evaluating eligibility against your profile...","Checking disqualifying criteria for each match...","Analyzing thematic alignment with your mission...","Scoring competitive fit for each opportunity...","Ranking matches by fit score and deadline urgency...","Cross-referencing with your previously applied grants...","Filtering out closed and expired opportunities...","Verifying funding amounts and award ranges...","Compiling your personalized grant shortlist...","Finalizing results and formatting recommendations..."],default:["Processing...","Working on it...","Almost there..."]},i=["Running final validation checks...","Reviewing results for accuracy...","Preparing your results...","Finishing up...","Wrapping up final details..."];function s(e){let{title:a,subtitle:t,progress:s,percentage:o,operationType:u="narrative",startTime:d=null,showStatusImmediately:c=!1}=e,[m,g]=(0,r.useState)(0),[f,p]=(0,r.useState)(0),[y,h]=(0,r.useState)(!1),[b,v]=(0,r.useState)(0),x=(0,r.useRef)(0),w=(0,r.useRef)(!1),j=(0,r.useRef)(null),N=(0,r.useRef)(null),k=(0,r.useRef)(null),C=n[u]||n.default;(0,r.useEffect)(()=>(k.current=setTimeout(()=>{h(!0)},2e3),()=>{k.current&&clearTimeout(k.current)}),[]),(0,r.useEffect)(()=>{null!=o&&(o>=100?(w.current=!0,x.current=100):o>0&&(x.current=Math.min(o,90)))}
1,[o]),(0,r.useEffect)(()=>{if(y)return j.current=setInterval(()=>{g(e=>{let a;if(w.current)return e>=99.5?100:e+(100-e)*.25;let t=x.current;return t>e+.5?e+.1*(t-e):e>=99?99:(a=e<15?1.5:e<40?.8:e<65?.4:e<80?.15:Math.max((99-e)*.004,.02),Math.min(e+a,99))})},200),()=>{j.current&&clearInterval(j.current)}},[y]),(0,r.useEffect)(()=>{if(y&&(c||d))return N.current=setInterval(()=>{c?p(e=>e<C.length-1?e+1:(v(e=>e<i.length-1?e+1:e),e)):Date.now()-d>6e4&&p(e=>e<C.length-1?e+1:(v(e=>Math.min(e+1,i.length-1)),e))},c?12e3:1e4),()=>{N.current&&clearInterval(N.current)}},[y,d,C.length,c]);let S=d?Date.now()-d:0,F=s;return(!s&&(c||S>6e4)&&(F=f>=C.length-1&&b>0?i[b]:C[f]),y)?(0,l.jsx)("div",{className:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50",children:(0,l.jsxs)("div",{className:"bg-white rounded-2xl p-12 max-w-md text-center shadow-2xl",children:[(0,l.jsx)("div",{className:"flex justify-center mb-6",children:(0,l.jsxs)("div",{className:"relative w-20 h-20",children:[(0,l.jsxs)("svg",{className:"w-20 h-20 transform -rotate-90",viewBox:"0 0 36 36",children:[(0,l.jsx)("circle",{cx:"18",cy:"18",r:"16",fill:"none",stroke:"#E5E7EB",strokeWidth:"2"}),(0,l.jsx)("circle",{cx:"18",cy:"18",r:"16",fill:"none",stroke:"#333333",strokeWidth:"2",strokeDasharray:"".concat(m," 100"),strokeLinecap:"round",className:"transition-all duration-300 ease-out"})]}),(0,l.jsx)("div",{className:"absolute inset-0 flex items-center justify-center",children:(0,l.jsxs)("span",{className:"text-sm font-semibold text-gray-700",style:{fontFamily:"Instrument Sans"},children:[m>=100?"100":m.toFixed(1),"%"]})})]})}),(0,l.jsx)("h2",{className:"text-2xl mb-3",style:{fontFamily:"Instrument Serif",fontWeight:400,color:"#333333"},children:a}),(0,l.jsx)("p",{className:"text-sm text-gray-600",style:{fontFamily:"Instrument Sans"},children:t}),F&&(0,l.jsx)("div",{className:"mt-4 px-4 py-2 bg-amber-50 rounded-lg border border-amber-200",children:(0,l.jsx)("p",{className:"text-sm text-amber-800 font-medium",style:{fontFamily:"Instrument Sans"},children:F})})]})}):null}},91549:function(e,a,t){"use strict";t.d(a,{Z:function(){return n}});var l=t(85893),r=t(67294);function n(e){let{message:a,type:t="success",onClose:n,duration:i=3e3}=e;return(0,r.useEffect)(()=>{let e=setTimeout(()=>{n()},i);return()=>clearTimeout(e)},[i,n]),(0,l.jsx)("div",{className:"fixed top-4 right-4 z-50 animate-slide-in",children:(0,l.jsxs)("div",{className:"rounded-lg px-4 py-3 shadow-lg flex items-center gap-3 min-w-[300px]",style:{backgroundColor:"success"===t?"#333333":"error"===t?"#DC2626":"#F59E0B",color:"#FFFFFF"},children:["success"===t&&(0,l.jsx)("svg",{className:"w-5 h-5 flex-shrink-0",fill:"currentColor",viewBox:"0 0 20 20",children:(0,l.jsx)("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z",clipRule:"evenodd"})}),"error"===t&&(0,l.jsx)("svg",{className:"w-5 h-5 flex-shrink-0",fill:"currentColor",viewBox:"0 0 20 20",children:(0,l.jsx)("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zM8.707 7.293a1 1 0 00-1.414 1.414L8.586 10l-1.293 1.293a1 1 0 101.414 1.414L10 11.414l1.293 1.293a1 1 0 001.414-1.414L11.414 10l1.293-1.293a1 1 0 00-1.414-1.414L10 8.586 8.707 7.293z",clipRule:"evenodd"})}),"warning"===t&&(0,l.jsx)("svg",{className:"w-5 h-5 flex-shrink-0",fill:"currentColor",viewBox:"0 0 20 20",children:(0,l.jsx)("path",{fillRule:"evenodd",d:"M8.257 3.099c.765-1.36 2.722-1.36 3.486 0l5.58 9.92c.75 1.334-.213 2.98-1.742 2.98H4.42c-1.53 0-2.493-1.646-1.743-2.98l5.58-9.92zM11 13a1 1 0 11-2 0 1 1 0 012 0zm-1-8a1 1 0 00-1 1v3a1 1 0 002 0V6a1 1 0 00-1-1z",clipRule:"evenodd"})}),(0,l.jsx)("span",{className:"text-sm font-medium",children:a}),(0,l.jsx)("button",{onClick:n,className:"ml-auto text-white hover:text-gray-200 transition-colors",children:(0,l.jsx)("svg",{className:"w-4 h-4",fill:"currentColor",viewBox:"0 0 20 20",children:(0,l.jsx)("path",{fillRule:"evenodd",d:"M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z",clipRule:"evenodd"})})})]})})}},10751:function(e,a,t){"use strict";t.d(a,{h:function(){return r},j:function(){return l}});let l=[{label:"Nigeria",value:"Nigeria"},{label:"United Kingdom",value:"United Kingdom",keywords:"uk britain great britain england scotland wales"},{label:"Kenya",value:"Kenya"},{label:"Ghana",value:"Ghana"},{label:"Uganda",value:"Uganda"},{label:"Canada",value:"Canada"}],r=[{label:"Afghanistan",value:"Afghanistan"},{label:"Albania",value:"Albania"},{label:"Algeria",value:"Algeria"},{label:"Andorra",value:"Andorra"},{label:"Angola",value:"Angola"},{label:"Antigua and Barbuda",value:"Antigua and Barbuda"},{label:"Argentina",value:"Argentina"},{label:"Armenia",value:"Armenia"},{label:"Australia",value:"Australia"},{label:"Austria",value:"Austria"},{label:"Azerbaijan",value:"Azerbaijan"},{label:"Bahamas",value:"Bahamas"},{label:"Bahrain",value:"Bahrain"},{label:"Bangladesh",value:"Bangladesh"},{label:"Barbados",value:"Barbados"},{label:"Belarus",value:"Belarus"},{label:"Belgium",value:"Belgium"},{label:"Belize",value:"Belize"},{label:"Benin",value:"Benin"},{label:"Bhutan",value:"Bhutan"},{label:"Bolivia",value:"Bolivia"},{label:"Bosnia and Herzegovina",value:"Bosnia and Herzegovina"},{label:"Botswana",value:"Botswana"},{label:"Brazil",value:"Brazil"},{label:"Brunei",value:"Brunei"},{label:"Bulgaria",value:"Bulgaria"},{label:"Burkina Faso",value:"Burkina Faso"},{label:"Burundi",value:"Burundi"},{label:"Cabo Verde",value:"Cabo Verde",keywords:"cape verde"},{label:"Cambodia",value:"Cambodia"},{label:"Cameroon",value:"Cameroon"},{label:"Canada",value:"Canada"},{label:"Central African Republic",value:"Central African Republic",keywords:"car"},{label:"Chad",value:"Chad"},{label:"Chile",value:"Chile"},{label:"China",value:"China"},{label:"Colombia",value:"Colombia"},{label:"Comoros",value:"Comoros"},{label:"Congo (Brazzaville)",value:"Congo (Brazzaville)",keywords:"republic of the congo congo-brazzaville"},{label:"Congo (DRC)",value:"Congo (DRC)",keywords:"democratic republic of the congo drc dr congo zaire congo-kinshasa"},{label:"Costa Rica",value:"Costa Rica"},{label:"C\xf4te d'Ivoire",value:"C\xf4te d'Ivoire",keywords:"ivory coast cote divoire"},{label:"Croatia",value:"Croatia"},{label:"Cuba",value:"Cuba"},{label:"Cyprus",value:"Cyprus"},{label:"Czech Republic",value:"Czech Republic",keywords:"czechia czech"},{label:"Denmark",value:"Denmark"},{label:"Djibouti",value:"Djibouti"},{label:"Dominica",value:"Dominica"},{label:"Dominican Republic",value:"Dominican Republic"},{label:"Ecuador",value:"Ecuador"},{label:"Egypt",value:"Egypt"},{label:"El Salvador",value:"El Salvador"},{label:"Equatorial Guinea",value:"Equatorial Guinea"},{label:"Eritrea",value:"Eritrea"},{label:"Estonia",value:"Estonia"},{label:"Eswatini",value:"Eswatini",keywords:"swaziland"},{label:"Ethiopia",value:"Ethiopia"},{label:"Fiji",value:"Fiji"},{label:"Finland",value:"Finland"},{label:"France",value:"France"},{label:"Gabon",value:"Gabon"},{label:"Gambia",value:"Gambia"},{label:"Georgia",value:"Georgia"},{label:"Germany",value:"Germany"},{label:"Ghana",value:"Ghana"},{label:"Greece",value:"Greece"},{label:"Grenada",value:"Grenada"},{label:"Guatemala",value:"Guatemala"},{label:"Guinea",value:"Guinea"},{label:"Guinea-Bissau",value:"Guinea-Bissau"},{label:"Guyana",value:"Guyana"},{label:"Haiti",value:"Haiti"},{label:"Honduras",value:"Honduras"},{label:"Hungary",value:"Hungary"},{label:"Iceland",value:"Iceland"},{label:"India",value:"India"},{label:"Indonesia",value:"Indonesia"},{label:"Iran",value:"Iran"},{label:"Iraq",value:"Iraq"},{label:"Ireland",value:"Ireland"},{label:"Israel",value:"Israel"},{label:"Italy",value:"Italy"},{label:"Jamaica",value:"Jamaica"},{label:"Japan",value:"Japan"},{label:"Jordan",value:"Jordan"},{label:"Kazakhstan",value:"Kazakhstan"},{label:"Kenya",value:"Kenya"},{label:"Kiribati",value:"Kiribati"},{label:"Kosovo",value:"Kosovo"},{label:"Kuwait",value:"Kuwait"},{label:"Kyrgyzstan",value:"Kyrgyzstan"},{label:"Laos",value:"Laos"},{label:"Latvia",value:"Latvia"},{label:"Lebanon",value:"Lebanon"},{label:"Lesotho",value:"Lesotho"},{label:"Liberia",value:"Liberia"},{label:"Libya",value:"Libya"},{label:"Liechtenstein",value:"Liechtenstein"},{label:"Lithuania",value:"Lithuania"},{label:"Luxembourg",value:"Luxembourg"}
1,{label:"Madagascar",value:"Madagascar"},{label:"Malawi",value:"Malawi"},{label:"Malaysia",value:"Malaysia"},{label:"Maldives",value:"Maldives"},{label:"Mali",value:"Mali"},{label:"Malta",value:"Malta"},{label:"Marshall Islands",value:"Marshall Islands"},{label:"Mauritania",value:"Mauritania"},{label:"Mauritius",value:"Mauritius"},{label:"Mexico",value:"Mexico"},{label:"Micronesia",value:"Micronesia"},{label:"Moldova",value:"Moldova"},{label:"Monaco",value:"Monaco"},{label:"Mongolia",value:"Mongolia"},{label:"Montenegro",value:"Montenegro"},{label:"Morocco",value:"Morocco"},{label:"Mozambique",value:"Mozambique"},{label:"Myanmar",value:"Myanmar",keywords:"burma"},{label:"Namibia",value:"Namibia"},{label:"Nauru",value:"Nauru"},{label:"Nepal",value:"Nepal"},{label:"Netherlands",value:"Netherlands",keywords:"holland"},{label:"New Zealand",value:"New Zealand"},{label:"Nicaragua",value:"Nicaragua"},{label:"Niger",value:"Niger"},{label:"Nigeria",value:"Nigeria"},{label:"North Korea",value:"North Korea",keywords:"dprk"},{label:"North Macedonia",value:"North Macedonia",keywords:"macedonia"},{label:"Norway",value:"Norway"},{label:"Oman",value:"Oman"},{label:"Pakistan",value:"Pakistan"},{label:"Palau",value:"Palau"},{label:"Palestine",value:"Palestine"},{label:"Panama",value:"Panama"},{label:"Papua New Guinea",value:"Papua New Guinea"},{label:"Paraguay",value:"Paraguay"},{label:"Peru",value:"Peru"},{label:"Philippines",value:"Philippines"},{label:"Poland",value:"Poland"},{label:"Portugal",value:"Portugal"},{label:"Qatar",value:"Qatar"},{label:"Romania",value:"Romania"},{label:"Russia",value:"Russia",keywords:"russian federation"},{label:"Rwanda",value:"Rwanda"},{label:"Saint Kitts and Nevis",value:"Saint Kitts and Nevis"},{label:"Saint Lucia",value:"Saint Lucia"},{label:"Saint Vincent and the Grenadines",value:"Saint Vincent and the Grenadines"},{label:"Samoa",value:"Samoa"},{label:"San Marino",value:"San Marino"},{label:"S\xe3o Tom\xe9 and Pr\xedncipe",value:"S\xe3o Tom\xe9 and Pr\xedncipe",keywords:"sao tome and principe"},{label:"Saudi Arabia",value:"Saudi Arabia"},{label:"Senegal",value:"Senegal"},{label:"Serbia",value:"Serbia"},{label:"Seychelles",value:"Seychelles"},{label:"Sierra Leone",value:"Sierra Leone"},{label:"Singapore",value:"Singapore"},{label:"Slovakia",value:"Slovakia"},{label:"Slovenia",value:"Slovenia"},{label:"Solomon Islands",value:"Solomon Islands"},{label:"Somalia",value:"Somalia"},{label:"South Africa",value:"South Africa"},{label:"South Korea",value:"South Korea",keywords:"korea republic of korea"},{label:"South Sudan",value:"South Sudan"},{label:"Spain",value:"Spain"},{label:"Sri Lanka",value:"Sri Lanka"},{label:"Sudan",value:"Sudan"},{label:"Suriname",value:"Suriname"},{label:"Sweden",value:"Sweden"},{label:"Switzerland",value:"Switzerland"},{label:"Syria",value:"Syria"},{label:"Taiwan",value:"Taiwan"},{label:"Tajikistan",value:"Tajikistan"},{label:"Tanzania",value:"Tanzania"},{label:"Thailand",value:"Thailand"},{label:"Timor-Leste",value:"Timor-Leste",keywords:"east timor"},{label:"Togo",value:"Togo"},{label:"Tonga",value:"Tonga"},{label:"Trinidad and Tobago",value:"Trinidad and Tobago"},{label:"Tunisia",value:"Tunisia"},{label:"Turkey",value:"Turkey",keywords:"turkiye"},{label:"Turkmenistan",value:"Turkmenistan"},{label:"Tuvalu",value:"Tuvalu"},{label:"Uganda",value:"Uganda"},{label:"Ukraine",value:"Ukraine"},{label:"United Arab Emirates",value:"United Arab Emirates",keywords:"uae emirates dubai abu dhabi"},{label:"United Kingdom",value:"United Kingdom",keywords:"uk britain great britain england scotland wales"},{label:"United States",value:"United States",keywords:"usa us america united states of america"},{label:"Uruguay",value:"Uruguay"},{label:"Uzbekistan",value:"Uzbekistan"},{label:"Vanuatu",value:"Vanuatu"},{label:"Vatican City",value:"Vatican City",keywords:"holy see"},{label:"Venezuela",value:"Venezuela"},{label:"Vietnam",value:"Vietnam"},{label:"Yemen",value:"Yemen"},{label:"Zambia",value:"Zambia"},{label:"Zimbabwe",value:"Zimbabwe"}]},9344:function(e,a,t){"use strict";t.r(a),t.d(a,{default:function(){return v}});
1var l=t(85893),r=t(73938),n=t(67294),i=t(11163),s=t(87066),o=t(39883),u=t(28259);function d(e){let{currentAct:a,questionIndex:t,totalInAct:r,act1Complete:n,act2Complete:i,onBack:s,onExit:o}=e,u=r>0?(t+1)/r*100:0;return(0,l.jsx)("div",{className:"bg-white border-b border-gray-100 sticky top-0 z-50",children:(0,l.jsxs)("div",{className:"max-w-3xl mx-auto px-4 py-3",children:[(0,l.jsxs)("div",{className:"flex items-center justify-between mb-2.5",children:[(0,l.jsx)("div",{className:"flex items-center gap-3",children:s&&(0,l.jsxs)("button",{onClick:s,className:"flex items-center gap-1.5 text-gray-400 hover:text-gray-700 transition-colors",children:[(0,l.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,l.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 19l-7-7 7-7"})}),(0,l.jsx)("span",{className:"hidden sm:inline text-sm",children:"Back"})]})}),(0,l.jsxs)("div",{className:"flex items-center gap-4",children:[(0,l.jsxs)("span",{className:"text-xs text-gray-400",style:{fontFamily:"var(--font-instrument-sans)"},children:["Question ",t+1," of ",r]}),o&&(0,l.jsx)("button",{onClick:o,className:"text-xs text-gray-400 hover:text-gray-600 transition-colors px-2 py-1 rounded hover:bg-gray-50",style:{fontFamily:"var(--font-instrument-sans)"},children:"Save & Exit"})]})]}),a>1?(0,l.jsxs)("div",{children:[(0,l.jsxs)("div",{className:"flex gap-1.5 mb-1.5 text-[10px] text-gray-400",style:{fontFamily:"var(--font-instrument-sans)"},children:[(0,l.jsx)("span",{className:"flex-1 text-center",children:"Profile"}),(0,l.jsx)("span",{className:"flex-1 text-center",children:"Eligibility"}),(0,l.jsx)("span",{className:"flex-1 text-center",children:"Evidence"})]}),(0,l.jsxs)("div",{className:"flex gap-1.5",children:[(0,l.jsx)("div",{className:"flex-1 h-1 rounded-full overflow-hidden bg-gray-100",children:(0,l.jsx)("div",{className:"h-full rounded-full transition-all duration-500 ease-out",style:{width:"100%",backgroundColor:"#22c55e"}})}),(0,l.jsx)("div",{className:"flex-1 h-1 rounded-full overflow-hidden bg-gray-100",children:(0,l.jsx)("div",{className:"h-full rounded-full transition-all duration-500 ease-out",style:{width:i?"100%":2===a?"".concat(u,"%"):"0%",backgroundColor:i?"#22c55e":"#000000"}})}),(0,l.jsx)("div",{className:"flex-1 h-1 rounded-full overflow-hidden bg-gray-100",children:(0,l.jsx)("div",{className:"h-full rounded-full transition-all duration-500 ease-out",style:{width:3===a?"".concat(u,"%"):"0%",backgroundColor:"#000000"}})})]})]}):(0,l.jsx)("div",{className:"h-1 bg-gray-100 rounded-full overflow-hidden",children:(0,l.jsx)("div",{className:"h-full bg-black rounded-full transition-all duration-500 ease-out",style:{width:"".concat(u,"%")}})})]})})}var c=t(28161),m=t(86751);function g(e){var a;let{question:t,value:i,onAnswer:o,onSkip:u,saving:d,questionIndex:g,totalInAct:f,extraValues:p}=e,[y,h]=(0,n.useState)(i||""),[b,v]=(0,n.useState)(""),x="name"===t.type&&[y,b].some(e=>String(e).normalize("NFKC").includes("@")),[w,j]=(0,n.useState)([]),[N,k]=(0,n.useState)(!1),[C,S]=(0,n.useState)({fullName:"",roleType:"",roleTitle:"",shortBio:""}),[F,z]=(0,n.useState)(null),[A,D]=(0,n.useState)(""),[T,M]=(0,n.useState)(""),[B,L]=(0,n.useState)(!1),[E,q]=(0,n.useState)(""),[R,_]=(0,n.use
1State)(!1),[I,P]=(0,n.useState)(!0),[G,W]=(0,n.useState)(""),[K,U]=(0,n.useState)(!1),[Y,O]=(0,n.useState)([]),H=(0,n.useRef)(null),V=(0,n.useRef)(null),Z=(0,n.useRef)(null);(0,n.useEffect)(()=>{if("currency"===t.type&&i){let e=String(i).replace(/[^0-9]/g,"");h(e?Number(e).toLocaleString("en-US"):"")}else if("name"===t.type)h(i||""),v((null==p?void 0:p.lastName)||"");else if("multi-searchable-select"===t.type){let e=i?[i]:[],a=Array.isArray(null==p?void 0:p.additionalCountries)?p.additionalCountries:[],t=new Set,l=[];[...e,...a].forEach(e=>{if(!e)return;let a=String(e).toLowerCase();t.has(a)||(t.add(a),l.push(e))}),O(l),h(i||"")}else h(i||"");P(!0),W(""),U(!1),q(""),z(null),D(""),M(""),L(!1),_(!1),k(!1),S({fullName:"",roleType:"",roleTitle:"",shortBio:""}),H.current&&H.current.focus(),"searchable-select"===t.type&&V.current&&V.current.focus(),"team"===t.type&&$()},[i,t,p]),(0,n.useEffect)(()=>{if(!K)return;let e=e=>{Z.current&&!Z.current.contains(e.target)&&U(!1)};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[K]),(0,n.useEffect)(()=>{"textarea"===t.type&&y.length>50&&P(!1)},[y,t.type]);let $=async()=>{try{let e=localStorage.getItem("token"),a=(await s.Z.get("/api/organization/team",{headers:{Authorization:"Bearer ".concat(e)}})).data||[];return j(a),a}catch(e){console.error("Error loading team members:",e)}},J=e=>{"Enter"!==e.key||e.shiftKey||(e.preventDefault(),X())},X=()=>{if(!("operatingStartDate"===t.field&&(0,m.operatingDateError)(y))){if("team"===t.type)w.length>0&&o(t.field,"completed");else if("document"===t.type)(y||u)&&o(t.field,y||"skipped");else if("tel"===t.type)(0,c.phoneError)(y,!0)||o(t.field,y);else if("age"===t.type)y.trim()&&!(0,r.founderAgeError)(y)&&o(t.field,y);else if("name"===t.type)y.trim()&&b.trim()&&!x&&o(t.field,y.trim(),{lastName:b.trim()});else if("currency"===t.type){let e=y.replace(/,/g,"");e&&o(t.field,e)}else y.trim()&&o(t.field,y)}},Q=async()=>{if(C.fullName&&C.roleType){_(!0);try{let e=localStorage.getItem("token"),a={full_name:C.fullName,role_type:C.roleType,role_title:C.roleTitle||"",short_bio:C.shortBio||""};await s.Z.post("/api/organization/team",a,{headers:{Authorization:"Bearer ".concat(e)}});let l=await $();S({fullName:"",roleType:"",roleTitle:"",shortBio:""}),k(!1);let r=Array.isArray(l)?l.length:w.length+1;1===r&&setTimeout(()=>{o(t.field,"completed")},500)}catch(e){console.error("Error adding team member:",e),q("Failed to add team member. Please try again.")}finally{_(!1)}}},ee=async()=>{if(F&&A&&T){L(!0),q("");try{let e=localStorage.getItem("token"),a=new FormData;a.append("file",F),a.append("name",A),a.append("type",T),await s.Z.post("/api/organization/documents",a,{headers:{Authorization:"Bearer ".concat(e),"Content-Type":"multipart/form-data"}}),h("completed"),L(!1),setTimeout(()=>{o(t.field,"completed")},500)}catch(t){var e,a;console.error("Error uploading document:",t),q((null===(a=t.response)||void 0===a?void 0:null===(e=a.data)||void 0===e?void 0:e.error)||"Failed to upload document. Please try again."),L(!1)}}};return(0,l.jsxs)("div",{className:"animate-slide-up",children:[(0,l.jsx)("h2",{className:"text-[22px] sm:text-[28px] text-gray-900 mb-2 leading-snug",style:{fontFamily:"var(--font-instrument-serif)"},children:t.question}),t.subtitle&&(0,l.jsx)("p",{className:"text-sm sm:text-[15px] mb-6 transition-opacity duration-700",style:{fontFamily:"var(--font-instrument-sans)",color:"#6b7280",opacity:I?1:0},children:t.subtitle}),(0,l.jsxs)("div",{className:"space-y-4",children:["text"===t.type&&(0,l.jsx)("input",{ref:H,type:"text",value:y,onChange:e=>h(e.target.value),onKeyDown:J,placeholder:t.placeholder,inputMode:t.inputMode,className:"w-full px-4 py-4 text-lg border-2 border-gray-200 rounded-lg focus:outline-none focus:ring-2 focus:ring-gray-900 focus:border-transparent transition-all",style:{fontFamily:"var(--font-instrument-sans)"}}),"name"===t.type&&(0,l.jsxs)("div",{className:"flex flex-col sm:flex-row gap-3",children:[(0,l.jsxs)("div",{className:"flex-1",children:[(0,l.jsx)("label",{className:"block text-xs font-medium text-gray-400 mb-1.5 uppercase tracking-wide",style:{fontFamily:"var(--font-instrument-sans)"},children:"First name"}),(0,l.jsx)("input",{ref:H,type:"text",value:y,onChange:e=>h(e.target.value),onKeyDown:J,placeholder:"e.g. Amara",className:"w-full px-4 py-4 text-lg border-2 border-gray-200 rounded-lg focus:outline-none focus:ring-2 focus:ring-gray-900 focus:border-transparent transition-all",style:{fontFamily:"var(--font-instrument-sans)"}})]}),(0,l.jsxs)("div",{className:"flex-1",children:[(0,l.jsx)("label",{className:"block text-xs font-medium text-gray-400 mb-1.5 uppercase tracking-wide",style:{fontFamily:"var(--font-instrument-sans)"},children:"Last name"}),(0,l.jsx)("input",{type:"text",value:b,onChange:e=>v(e.target.value),onKeyDown:J,placeholder:"e.g. Okafor",className:"w-full px-4 py-4 text-lg border-2 border-gray-200 rounded-lg focus:outline-none focus:ring-2 focus:ring-gray-900 focus:border-transparent transition-all",style:{fontFamily:"var(--font-instrument-sans)"}})]})]}),x&&(0,l.jsx)("p",{role:"alert",className:"mt-2 text-sm text-red-600",children:"Please enter your name, not an email address."}),"tel"===t.type&&(0,l.jsxs)("div",{children:[(0,l.jsx)("input",{ref:H,type:"tel",inputMode:"tel",value:y,onChange:e=>{h(e.target.value.replace(/[^0-9+\-\s()]/g,""))},onKeyDown:J,placeholder:t.placeholder,className:"w-full px-4 py-4 text-lg border-2 rounded-lg focus:outline-none focus:ring-2 focus:ring-gray-900 focus:border-transparent transition-all ".concat(y&&(0,c.phoneError)(y,!0)?"border-red-300":"border-gray-200"),style:{fontFamily:"var(--font-instrument-sans)"}}),y&&(0,c.phoneError)(y,!0)&&(0,l.jsx)("p",{className:"mt-2 text-sm text-red-400",style:{fontFamily:"var(--font-instrument-sans)"},children:"Please enter a valid phone number with country code"})]}),"url"===t.type&&(0,l.jsx)("input",{ref:H,type:"url",value:y,onChange:e=>h(e.target.value),onKeyDown:J,placeholder:t.placeholder,className:"w-full px-4 py-4 text-lg border-2 border-gray-200 rounded-lg focus:outline-none focus:ring-2 focus:ring-gray-900 focus:border-transparent transition-all",style:{fontFamily:"var(--font-instrument-sans)"}}),"textarea"===t.type&&(0,l.jsxs)("div",{children:[(0,l.jsx)("textarea",{ref:H,value:y,onChange:e=>h(e.target.value),placeholder:t.placeholder,rows:5,className:"w-full px-4 py-4 text-lg border-2 border-gray-200 rounded-lg focus:outline-none focus:ring-2 focus:ring-gray-900 focus:border-transparent transition-all resize-none",style:{fontFamily:"var(--font-instrument-sans)"}}),y.length>0&&(0,l.jsxs)("div",{className:"text-right mt-1 text-xs text-gray-300",style:{fontFamily:"var(--font-instrument-sans)"},children:[y.length," characters"]})]}),"select"===t.type&&(0,l.jsxs)("select",{ref:H,value:y,onChange:e=>{h(e.target.value),e.target.value&&setTimeout(()=>{o(t.field,e.target.value)},300)},className:"w-full px-4 py-4 text-lg border-2 border-gray-200 rounded-lg focus:outline-none focus:ring-2 focus:ring-gray-900 focus:border-transparent transition-all appearance-none cursor-pointer",style:{fontFamily:"var(--font-instrument-sans)"},children:[(0,l.jsx)("option",{value:"",children:"Select an option..."}),null===(a=t.options)||void 0===a?void 0:a.map(e=>{let a="object"==typeof e?e.value:e,t="object"==typeof e?e.label:e;return(0,l.jsx)("option",{value:a,children:t},a)})]}),"searchable-select"===t.type&&(0,l.jsx)("div",{ref:Z,className:"relative",children:y&&!K?(0,l.jsxs)("button",{type:"button",onClick:()=>{U(!0),W(""),setTimeout(()=>{var e;return null===(e=V.current)||void 0===e?void 0:e.focus()},50)},className:"w-full px-4 py-4 text-lg text-left border-2 border-green-300 bg-green-50 rounded-lg flex items-center justify-between transition-all",style:{fontFamily:"var(--font-instrument-sans)"},children:[(0,l.jsxs)("span",{className:"flex items-center gap-2",children:[(0,l.jsx)("svg",{className:"w-5 h-5 text-green-600",fill:"currentColor",viewBox:"0 0 20 20",children:(0,l.jsx)("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z",clipRule:"evenodd"})}),y]}),(0,l.jsx)("span",{className:"text-sm text-gray-400",children:"Change"})]}):(0,l.jsxs)("div",{children:[(0,l.jsxs)("div",{className:"relative",children:[(0,l.jsx)("svg",{className:"absolute left-4 top-1/2 -translate-y-1/2 w-5 h-5 text-gray-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,l.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"})}),(0,l.jsx)("input",{ref:V,type:"text",value:G,onChange:e=>{W(e.target.value),U(!0)},onFocus:()=>U(!0),onKeyDown:e=>{if("Enter"===e.key){var a;e.preventDefault();let l=G.toLowerCase(),r=(t.options||[]).filter(e=>e.label.toLowerCase().includes(l)),n=l?r[0]:(null===(a=t.popularOptions)||void 0===a?void 0:a[0])||r[0];n&&n.value&&(h(n.value),U(!1),W(""),setTimeout(()=>
1o(t.field,n.value),300))}},placeholder:"Type to search...",className:"w-full pl-12 pr-4 py-4 text-lg border-2 border-gray-200 rounded-lg focus:outline-none focus:ring-2 focus:ring-gray-900 focus:border-transparent transition-all",style:{fontFamily:"var(--font-instrument-sans)"}})]}),K&&(0,l.jsxs)("div",{className:"absolute z-50 w-full bg-white border border-gray-200 rounded-lg shadow-lg max-h-64 overflow-y-auto",style:{...Z.current&&Z.current.getBoundingClientRect().bottom>window.innerHeight-280?{bottom:"100%",marginBottom:"4px"}:{top:"100%",marginTop:"4px"}},children:[!G&&t.popularOptions&&(0,l.jsxs)("div",{children:[(0,l.jsx)("div",{className:"px-4 py-2 text-xs font-medium text-gray-400 uppercase tracking-wider",style:{fontFamily:"var(--font-instrument-sans)"},children:"Popular"}),t.popularOptions.map(e=>(0,l.jsx)("button",{type:"button",onClick:()=>{h(e.value),U(!1),W(""),setTimeout(()=>o(t.field,e.value),300)},className:"w-full px-4 py-3 text-left text-base hover:bg-gray-50 transition-colors flex items-center gap-2",style:{fontFamily:"var(--font-instrument-sans)"},children:e.label},"popular-".concat(e.value))),(0,l.jsx)("div",{className:"border-t border-gray-100 my-1"}),(0,l.jsx)("div",{className:"px-4 py-2 text-xs font-medium text-gray-400 uppercase tracking-wider",style:{fontFamily:"var(--font-instrument-sans)"},children:"All Countries"})]}),(()=>{let e=G.toLowerCase(),a=(t.options||[]).filter(a=>a.label.toLowerCase().includes(e));return 0===a.length?(0,l.jsx)("div",{className:"px-4 py-6 text-center text-gray-400 text-sm",style:{fontFamily:"var(--font-instrument-sans)"},children:"No countries found"}):a.map(e=>(0,l.jsx)("button",{type:"button",onClick:()=>{h(e.value),U(!1),W(""),setTimeout(()=>o(t.field,e.value),300)},className:"w-full px-4 py-3 text-left text-base hover:bg-gray-50 transition-colors ".concat(y===e.value?"bg-gray-50 font-medium":""),style:{fontFamily:"var(--font-instrument-sans)"},children:e.label},e.value))})()]})]})}),"multi-searchable-select"===t.type&&(()=>{let e=e=>{!(!e||Y.some(a=>a.toLowerCase()===e.toLowerCase()))&&(Y.length>=10||(O([...Y,e]),W(""),U(!1)))},a=e=>{O(Y.filter((a,t)=>t!==e))},r=0===Y.length,n=(t.popularOptions||[]).filter(e=>!Y.some(a=>a.toLowerCase()===e.value.toLowerCase())),i=(t.options||[]).filter(e=>{let a=G.toLowerCase(),t=!a||e.label.toLowerCase().includes(a)||(e.keywords||"").includes(a),l=!Y.some(a=>a.toLowerCase()===e.value.toLowerCase());return t&&l});return(0,l.jsxs)("div",{className:"space-y-3",children:[Y.length>0&&(0,l.jsx)("div",{className:"flex flex-wrap gap-2",children:Y.map((e,t)=>(0,l.jsxs)("span",{className:"inline-flex items-center gap-2 px-3 py-2 rounded-full text-sm border border-green-300 bg-green-50 text-gray-800",style:{fontFamily:"var(--font-instrument-sans)"},children:[0===t&&Y.length>1&&(0,l.jsx)("span",{className:"text-[10px] uppercase tracking-wider text-green-700 font-medium",children:"Primary"}),e,(0,l.jsx)("button",{type:"button",onClick:()=>a(t),className:"text-gray-400 hover:text-gray-700 transition-colors","aria-label":"Remove ".concat(e),children:(0,l.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,l.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]},"chip-".concat(e,"-").concat(t)))}),Y.length<10&&(0,l.jsxs)("div",{ref:Z,className:"relative",children:[(0,l.jsxs)("div",{className:"relative",children:[(0,l.jsx)("svg",{className:"absolute left-4 top-1/2 -translate-y-1/2 w-5 h-5 text-gray-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,l.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"})}),(0,l.jsx)("input",{ref:V,type:"text",value:G,onChange:e=>{W(e.target.value),U(!0)},onFocus:()=>U(!0),onKeyDown:a=>{if("Enter"===a.key){a.preventDefault();let t=i[0]||n[0];t&&t.value&&e(t.value)}},placeholder:0===Y.length?"Type to add the country you're registered in...":"Add another country...",className:"w-full pl-12 pr-4 py-4 text-lg border-2 border-gray-200 rounded-lg focus:outline-none focus:ring-2 focus:ring-gray-900 focus:border-transparent transition-all",style:{fontFamily:"var(--font-instrument-sans)"}})]}),K&&(0,l.jsxs)("div",{className:"absolute z-50 w-full bg-white border border-gray-200 rounded-lg shadow-lg max-h-64 overflow-y-auto",style:{...Z.current&&Z.current.getBoundingClientRect().bottom>window.innerHeight-280?{bottom:"100%",marginBottom:"4px"}:{top:"100%",marginTop:"4px"}},children:[!G&&n.length>0&&(0,l.jsxs)("div",{children:[(0,l.jsx)("div",{className:"px-4 py-2 text-xs font-medium text-gray-400 uppercase tracking-wider",style:{fontFamily:"var(--font-instrument-sans)"},children:"Popular"}),n.map(a=>(0,l.jsx)("button",{type:"button",onMouseDown:t=>{t.preventDefault(),e(a.value)},className:"w-full px-4 py-3 text-left text-base hover:bg-gray-50 transition-colors",style:{fontFamily:"var(--font-instrument-sans)"},children:a.label},"popular-".concat(a.value))),(0,l.jsx)("div",{className:"border-t border-gray-100 my-1"}),(0,l.jsx)("div",{className:"px-4 py-2 text-xs font-medium text-gray-400 uppercase tracking-wider",style:{fontFamily:"var(--font-instrument-sans)"},children:"All Countries"})]}),0===i.length?(0,l.jsx)("div",{className:"px-4 py-6 text-center text-gray-400 text-sm",style:{fontFamily:"var(--font-instrument-sans)"},children:"No countries found"}):i.map(a=>(0,l.jsx)("button",{type:"button",onMouseDown:t=>{t.preventDefault(),e(a.value)},className:"w-full px-4 py-3 text-left text-base hover:bg-gray-50 transition-colors",style:{fontFamily:"var(--font-instrument-sans)"},children:a.label},a.value))]})]}),Y.length>=10&&(0,l.jsxs)("div",{className:"text-xs text-gray-400",style:{fontFamily:"var(--font-instrument-sans)"},children:["Maximum of ",10," countries reached."]}),(0,l.jsx)("div",{className:"mt-6",children:(0,l.jsx)("button",{onClick:()=>
1{if(0===Y.length)return;let e=Y[0]||"",a=Y.slice(1);o(t.field,e,{additionalCountries:a})},disabled:r||d,className:"w-full sm:w-auto px-8 py-3.5 bg-black text-white text-base font-medium rounded-lg hover:bg-gray-800 disabled:opacity-40 disabled:cursor-not-allowed transition-all",style:{fontFamily:"var(--font-instrument-sans)"},children:d?"Saving...":"Continue"})})]})})(),"date"===t.type&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)("input",{ref:H,type:"date",value:y,onChange:e=>h(e.target.value),onKeyDown:J,max:new Date().toISOString().split("T")[0],min:"operatingStartDate"===t.field?m.OPERATING_DATE_MIN:void 0,"aria-invalid":"operatingStartDate"===t.field&&!!(0,m.operatingDateError)(y),className:"w-full px-4 py-4 text-lg border-2 border-gray-200 rounded-lg focus:outline-none focus:ring-2 focus:ring-gray-900 focus:border-transparent transition-all",style:{fontFamily:"var(--font-instrument-sans)"}}),"operatingStartDate"===t.field&&(0,m.operatingDateError)(y)&&(0,l.jsx)("p",{role:"alert",className:"mt-2 text-sm text-red-700",children:(0,m.operatingDateError)(y)})]}),"number"===t.type&&(0,l.jsx)("input",{ref:H,type:"text",inputMode:"numeric",value:y,onChange:e=>{h(e.target.value.replace(/[^0-9]/g,""))},onKeyDown:J,placeholder:t.placeholder,className:"w-full px-4 py-4 text-lg border-2 border-gray-200 rounded-lg focus:outline-none focus:ring-2 focus:ring-gray-900 focus:border-transparent transition-all",style:{fontFamily:"var(--font-instrument-sans)"}}),"age"===t.type&&(0,l.jsxs)("div",{children:[(0,l.jsx)("input",{ref:H,type:"text",inputMode:"numeric",maxLength:2,value:y,onChange:e=>{h(e.target.value.replace(/[^0-9]/g,""))},onKeyDown:J,placeholder:t.placeholder,className:"w-full px-4 py-4 text-lg border-2 rounded-lg focus:outline-none focus:ring-2 focus:ring-gray-900 focus:border-transparent transition-all ".concat(y&&y.length>=2&&(15>parseInt(y)||parseInt(y)>70)?"border-red-300":"border-gray-200"),style:{fontFamily:"var(--font-instrument-sans)",letterSpacing:"0.05em"}}),y&&(15>parseInt(y)||parseInt(y)>70)&&y.length>=2&&(0,l.jsx)("p",{className:"mt-2 text-sm text-red-400 transition-opacity",style:{fontFamily:"var(--font-instrument-sans)"},children:"Please enter an age between 15 and 70"})]}),"currency"===t.type&&(0,l.jsx)("input",{ref:H,type:"text",inputMode:"numeric",value:y,onChange:e=>{let a=e.target,t=a.selectionStart,l=a.value,r=l.replace(/[^0-9]/g,""),n=r?Number(r).toLocaleString("en-US"):"";h(n);let i=(l.slice(0,t).match(/,/g)||[]).length,s=t-i,o=0;if(s>0){let e=0;for(let a=0;a<n.length;a++)if(","!==n[a]&&e++,e>=s){o=a+1;break}e<s&&(o=n.length)}requestAnimationFrame(()=>{try{a.setSelectionRange(o,o)}catch(e){}})},onKeyDown:J,placeholder:t.placeholder,className:"w-full px-4 py-4 text-lg border-2 border-gray-200 rounded-lg focus:outline-none focus:ring-2 focus:ring-gray-900 focus:border-transparent transition-all",style:{fontFamily:"var(--font-instrument-sans)"}}),"team"===t.type&&(0,l.jsxs)("div",{className:"space-y-4",children:[w.length>0&&(0,l.jsxs)("div",{className:"space-y-2 mb-4",children:[(0,l.jsx)("div",{className:"text-sm font-medium text-gray-500 mb-2",style:{fontFamily:"var(--font-instrument-sans)"},children:"Team Members Added:"}),w.map(e=>(0,l.jsxs)("div",{className:"flex items-center justify-between p-3 bg-green-50 border border-green-200 rounded-lg",children:[(0,l.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,l.jsx)("div",{className:"font-medium text-gray-900",children:e.full_name}),(0,l.jsxs)("div",{className:"text-sm text-gray-600",children:[{founder:"Founder",co_founder:"Co-Founder",leadership:"Leadership",specialist:"Specialist"}[e.role_type]||e.role_type,e.role_title?" - ".concat(e.role_title):""]}),e.short_bio&&(0,l.jsx)("div",{className:"text-sm text-gray-500 mt-1 line-clamp-1",children:e.short_bio})]}),(0,l.jsx)("svg",{className:"w-5 h-5 text-green-600 flex-shrink-0",fill:"currentColor",viewBox:"0 0 20 20",children:(0,l.jsx)("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z",clipRule:"evenodd"})})]},e.id))]}),!N&&(0,l.jsx)("button",{onClick:()=>k(!0),className:"w-full px-4 py-4 border-2 border-dashed border-gray-200 rounded-lg text-gray-500 hover:border-gray-400 hover:text-gray-700 transition-all",style:{fontFamily:"var(--font-instrument-sans)"},children:"+ Add Team Member"}),N&&(0,l.jsxs)("div",{className:"space-y-3 p-4 border-2 border-gray-200 rounded-lg bg-gray-50",children:[(0,l.jsx)("input",{type:"text",placeholder:"Full Name",value:C.fullName,onChange:e=>S({...C,fullName:e.target.value}),className:"w-full px-3 py-2 border border-gray-200 rounded-md focus:outline-none focus:ring-2 focus:ring-gray-900"}
1),(0,l.jsxs)("select",{value:C.roleType,onChange:e=>S({...C,roleType:e.target.value}),className:"w-full px-3 py-2 border border-gray-200 rounded-md focus:outline-none focus:ring-2 focus:ring-gray-900",children:[(0,l.jsx)("option",{value:"",children:"Select Role Type"}),(0,l.jsx)("option",{value:"founder",children:"Founder"}),(0,l.jsx)("option",{value:"co_founder",children:"Co-Founder"}),(0,l.jsx)("option",{value:"leadership",children:"Leadership"}),(0,l.jsx)("option",{value:"specialist",children:"Specialist"})]}),(0,l.jsx)("input",{type:"text",placeholder:"Title / Position (e.g., CEO, Program Manager)",value:C.roleTitle,onChange:e=>S({...C,roleTitle:e.target.value}),className:"w-full px-3 py-2 border border-gray-200 rounded-md focus:outline-none focus:ring-2 focus:ring-gray-900"}),(0,l.jsx)("textarea",{placeholder:"Short bio (e.g., 10 years of experience in grant management...)",value:C.shortBio,onChange:e=>S({...C,shortBio:e.target.value}),rows:3,className:"w-full px-3 py-2 border border-gray-200 rounded-md focus:outline-none focus:ring-2 focus:ring-gray-900 resize-none"}),(0,l.jsxs)("div",{className:"flex gap-2",children:[(0,l.jsx)("button",{onClick:Q,disabled:!C.fullName||!C.roleType||R,className:"flex-1 px-4 py-2 bg-black text-white rounded-md hover:bg-gray-800 disabled:opacity-40 disabled:cursor-not-allowed transition-all",children:R?"Adding...":"Add Member"}),(0,l.jsx)("button",{onClick:()=>k(!1),className:"px-4 py-2 bg-gray-200 text-gray-700 rounded-md hover:bg-gray-300 transition-all",children:"Cancel"})]})]}),E&&(0,l.jsx)("div",{className:"p-3 bg-red-50 border border-red-200 rounded-lg text-sm text-red-700",children:E}),w.length>0&&(0,l.jsx)("button",{onClick:X,className:"w-full px-6 py-3.5 bg-black text-white text-base font-medium rounded-lg hover:bg-gray-800 transition-all mt-4",style:{fontFamily:"var(--font-instrument-sans)"},children:"Continue"})]}),"document"===t.type&&(0,l.jsxs)("div",{className:"space-y-4",children:[F?(0,l.jsxs)("div",{className:"space-y-4 p-5 border-2 border-gray-200 rounded-lg bg-gray-50",children:[(0,l.jsxs)("div",{className:"flex items-center gap-3 mb-4",children:[(0,l.jsx)("svg",{className:"w-7 h-7 text-gray-600",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,l.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"})}),(0,l.jsxs)("div",{className:"flex-1",children:[(0,l.jsx)("div",{className:"font-medium text-gray-900",children:F.name}),(0,l.jsxs)("div",{className:"text-sm text-gray-500",children:[(F.size/1024/1024).toFixed(2)," MB"]})]}),(0,l.jsx)("button",{onClick:()=>{z(null),D(""),M(""),q("")},className:"text-gray-400 hover:text-red-500",children:(0,l.jsx)("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,l.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),(0,l.jsxs)("div",{children:[(0,l.jsx)("label",{className:"block text-sm font-medium text-gray-600 mb-1.5",children:"Document Name"}),(0,l.jsx)("input",{type:"text",value:A,onChange:e=>D(e.target.value),placeholder:"e.g., Annual Report 2024",className:"w-full px-3 py-2 border border-gray-200 rounded-md focus:outline-none focus:ring-2 focus:ring-gray-900"})]}),(0,l.jsxs)("div",{children:[(0,l.jsx)("label",{className:"block text-sm font-medium text-gray-600 mb-1.5",children:"Document Type"}),(0,l.jsxs)("select",{value:T,onChange:e=>M(e.target.value),className:"w-full px-3 py-2 border border-gray-200 rounded-md focus:outline-none focus:ring-2 focus:ring-gray-900",children:[(0,l.jsx)("option",{value:"",children:"Select document type..."}),(0,l.jsx)("option",{value:"Company Registration Certificate",children:"Company Registration Certificate"}),(0,l.jsx)("option",{value:"Company Profile",children:"Company Profile"}),(0,l.jsx)("option",{value:"Pitch deck",children:"Pitch deck"}),(0,l.jsx)("option",{value:"Financial Statements",children:"Financial Statements"}),(0,l.jsx)("option",{value:"Impact/Annual Report",children:"Impact/Annual Report"}),(0,l.jsx)("option",{value:"Past Grant Proposals",children:"Past Grant Proposals"}),(0,l.jsx)("option",{value:"Team CVs/Bios",children:"Team CVs/Bios"}),(0,l.jsx)("option",{value:"Strategic/Business Plan",children:"Strategic/Business Plan"}),(0,l.jsx)("option",{value:"Letters of Support & MOUs",children:"Letters of Support & MOUs"}),(0,l.jsx)("option",{value:"Concept Note",children:"Concept Note"}),(0,l.jsx)("option",{value:"Other",children:"Other"})]})]}),E&&(0,l.jsx)("div",{className:"p-3 bg-red-50 border border-red-200 rounded-lg text-sm text-red-700",children:E}),(0,l.jsx)("button",{onClick:ee,disabled:!A||!T||B,className:"w-full px-6 py-3 bg-black text-white font-medium rounded-lg hover:bg-gray-800 disabled:opacity-40 disabled:cursor-not-allowed transition-all",children:B?"Uploading...":"Upload Document"})]}):(0,l.jsxs)("label",{className:"block",children:[(0,l.jsxs)("div",{className:"w-full px-8 py-10 border-2 border-dashed border-gray-200 rounded-lg text-center hover:border-gray-400 transition-all cursor-pointer",children:[(0,l.jsx)("svg",{className:"w-10 h-10 mx-auto text-gray-300 mb-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,l.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M7 16a4 4 0 01-.88-7.903A5 5 0 1115.9 6L16 6a5 5 0 011 9.9M15 13l-3-3m0 0l-3 3m3-3v12"})}),(0,l.jsx)("div",{className:"text-base text-gray-500 mb-1",children:"Click to upload or drag and drop"}),(0,l.jsx)("div",{className:"text-sm text-gray-400",children:"PDF or DOCX (max 50MB)"})]}),(0,l.jsx)("input",{type:"file",onChange:e=>{let a=e.target.files[0];if(a){if(q(""),a.size>52428800){q("File size must be less than 50MB"),e.target.value="";return}if(!a.name.match(/\.(pdf|docx)$/i)){q("Only PDF or DOCX files are allowed. If you have a .doc file, save it as .docx in Word first."),e.target.value="";return}z(a),D(a.name.replace(/\.[^/.]+$/,""))}},accept:".pdf,.docx",className:"hidden"})]}),E&&!F&&(0,l.jsx)("div",{className:"p-3 bg-red-50 border border-red-200 rounded-lg text-sm text-red-700",children:E})]}),"select"!==t.type&&"searchable-select"!==t.type&&"multi-searchable-select"!==t.type&&"team"!==t.type&&"document"!==t.type&&(0,l.jsx)("div",{className:"mt-6",children:(0,l.jsx)("button",{onClick:X,disabled:!y.trim()||d||"operatingStartDate"===t.field&&!!(0,m.operatingDateError)(y)||"name"===t.type&&(!b.trim()||x)||"age"===t.type&&!!(0,r.founderAgeError)(y)||"tel"===t.type&&!!(0,c.phoneError)(y,!0),className:"w-full sm:w-auto px-8 py-3.5 bg-black text-white text-base font-medium rounded-lg hover:bg-gray-800 disabled:opacity-40 disabled:cursor-not-allowed transition-all",style:{fontFamily:"var(--font-instrument-sans)"},children:d?"Saving...":"Continue"})}),u&&"team"!==t.type&&(0,l.jsx)("button",{onClick:u,className:"mt-3 text-sm text-gray-400 hover:text-gray-500 transition-colors",style:{fontFamily:"var(--font-instrument-sans)"},children:"Skip for now →"})]}),("text"===t.type||"name"===t.type||"tel"===t.type||"url"===t.type||"number"===t.type||"age"===t.type||"currency"===t.type)&&(0,l.jsxs)("div",{className:"mt-6 text-center text-xs text-gray-300",style:{fontFamily:"var(--font-instrument-sans)"},children:["Press ",(0,l.jsx)("kbd",{className:"px-1.5 py-0.5 bg-gray-50 border border-gray-200 rounded text-gray-400",children:"Enter"})," to continue"]})]})}function f(e){let{title:a,body:t,completedLabel:r,onContinue:i}
1=e,[s,o]=(0,n.useState)(!1);return(0,n.useEffect)(()=>{let e=setTimeout(()=>o(!0),50);return()=>clearTimeout(e)},[]),(0,l.jsx)("div",{className:"min-h-screen flex items-center justify-center px-4",style:{background:"linear-gradient(180deg, #ffffff 0%, #fafaf8 100%)"},children:(0,l.jsxs)("div",{className:"max-w-md w-full text-center transition-all duration-500 ease-out",style:{opacity:s?1:0,transform:s?"translateY(0)":"translateY(12px)"},children:[r&&(0,l.jsxs)("div",{className:"flex items-center justify-center gap-2 mb-8",children:[(0,l.jsx)("svg",{className:"w-5 h-5 text-green-500",fill:"currentColor",viewBox:"0 0 20 20",children:(0,l.jsx)("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z",clipRule:"evenodd"})}),(0,l.jsx)("span",{className:"text-green-600 font-medium text-sm",style:{fontFamily:"var(--font-instrument-sans)"},children:r})]}),(0,l.jsx)("h1",{className:"text-[26px] sm:text-[32px] text-gray-900 mb-6 leading-snug",style:{fontFamily:"var(--font-instrument-serif)"},children:a}),t&&(0,l.jsx)("p",{className:"text-base text-gray-500 mb-10 leading-relaxed max-w-sm mx-auto",style:{fontFamily:"var(--font-instrument-sans)"},children:t}),(0,l.jsx)("button",{onClick:i,className:"px-8 py-3 bg-black text-white rounded-lg font-medium hover:bg-gray-800 transition-colors",style:{fontFamily:"var(--font-instrument-sans)"},children:"Continue"})]})})}var p=t(60691),y=t(91549),h=t(15687),b=t(10751);function v(){return(0,l.jsx)(u.i1,{children:(0,l.jsx)(q,{})})}let x=[{id:0,act:1,field:"firstName",question:"What is your name?",subtitle:"You'll appear as the contact person on grant submissions",type:"name",required:!0},{id:1,act:1,field:"organizationName",question:"What is your organization's name?",subtitle:"This appears on every proposal we write for you",type:"text",required:!0},{id:2,act:1,field:"missionAndWhatWeDo",question:"What does your organization do?",subtitle:"This becomes the backbone of every grant narrative",type:"textarea",required:!0,placeholder:"Tell us about your mission and activities..."},{id:3,act:1,field:"sector",question:"What sector does your organization work in?",subtitle:"Funders filter by sector — this is how we find your matches",type:"select",required:!0,options:[{label:"Healthcare",value:"healthcare"},{label:"Education",value:"education"},{label:"Technology",value:"technology"},{label:"Agriculture",value:"agriculture"},{label:"Financial Services",value:"financial_services"},{label:"Environment & Climate",value:"environment"},{label:"Community Development",value:"community_development"},{label:"Arts & Culture",value:"arts_culture"},{label:"Human Services",value:"human_services"},{label:"Economic Development",value:"economic_development"},{label:"Other",value:"other"}]},{id:4,act:1,field:"country",question:"Which countries is your organization registered in?",subtitle:"List every country where you have a legal entity. We'll find grants you can apply for in each.",type:"multi-searchable-select",required:!0,popularOptions:b.j,options:b.h},{id:5,act:1,field:"city",question:"Which city is your headquarters in?",subtitle:"Some grants target specific cities or states",type:"text",required:!0},{id:6,act:1,field:"organizationType",question:"What type of organization are you?",subtitle:"Grant eligibility often depends on this",type:"select",required:!0,options:[{label:"Non-Profit Organisation",value:"nonprofit"},{label:"For Profit Business",value:"forprofit"},{label:"Government Agency",value:"government"},{label:"Academic / Research Institution",value:"academic"}]},{id:7,act:1,field:"phone",question:"What is your WhatsApp number?",subtitle:"Include your country code (e.g., +234 for Nigeria, +1 for US). For account recovery and support only — never shared.",type:"tel",required:!0,placeholder:"e.g., +234 801 234 5678"},{id:8,act:2,field:"companySize",question:"How many full-time employees does your organization have?",subtitle:"Some grants have team size requirements",type:"number",required:!0,placeholder:"e.g., 25"},{id:9,act:2,field:"annualRevenue",question:"What is your organization's annual revenue or budget?",subtitle:"Enter amount in US Dollars (USD). Funders set minimum and maximum funding thresholds.",type:"currency",required:!0,placeholder:"e.g., 100,000"},{id:10,act:2,field:"governmentRegistered",question:"Is your organization registered with the government?",subt
1itle:"Most institutional funders require formal registration",type:"select",required:!0,options:[{label:"Yes",value:"yes"},{label:"No",value:"no"}]},{id:11,act:2,field:"operatingStartDate",question:"When did your organization start operating?",subtitle:"Many grants require 2+ years of operation",type:"date",required:!0},{id:12,act:2,field:"youngestCofounderAge",question:"How old is the youngest co-founder?",subtitle:"Youth-focused grants have age caps (usually 35). You can update this anytime.",type:"age",required:!0,placeholder:"Age"},{id:13,act:2,field:"femaleLed",question:"Is your organization female-led or do you have a female co-founder?",subtitle:"Unlocks women-focused and gender-lens funding opportunities",type:"select",required:!0,options:[{label:"Yes",value:"yes"},{label:"No",value:"no"}]},{id:14,act:2,field:"minGrantAmount",question:"What is the minimum grant amount worth applying for?",subtitle:"We won't show you grants below this amount",type:"select",required:!0,options:[{label:"$1,000",value:"1000"},{label:"$5,000",value:"5000"},{label:"$20,000",value:"20000"},{label:"$50,000",value:"50000"},{label:"$100,000",value:"100000"}]}
1,{id:15,act:2,field:"technicalSupportOnly",question:"Are you open to programs that offer support instead of cash?",subtitle:"Some programs offer training, mentorship, or equipment",type:"select",required:!0,options:[{label:"Yes",value:"yes"},{label:"No",value:"no"}]},{id:16,act:2,field:"matchingFunds",question:"Can your organization provide matching funds if required?",subtitle:"Some grants require you to co-invest — we'll filter accordingly",type:"select",required:!0,options:[{label:"Yes",value:"yes"},{label:"No",value:"no"}]},{id:17,act:3,field:"trackRecordAndImpact",question:"Describe your organization's key achievements and impact",subtitle:"This is the #1 thing reviewers look for after your mission",type:"textarea",required:!0,placeholder:"e.g., Trained 500 women farmers, increasing crop yields by 40% across 3 regions. Deployed clean water systems serving 12,000 people in rural communities..."},{id:18,act:3,field:"keyPartnerships",question:"List your key partners and collaborators",subtitle:"Strong partnerships signal credibility to funders",type:"textarea",required:!0,placeholder:"List your key partners and collaborations..."},{id:19,act:3,field:"additionalContext",question:"Share any case studies, testimonials, or awards",subtitle:"Real examples make proposals dramatically more compelling",type:"textarea",required:!1,skippable:!0,placeholder:"Share c
1ase studies, success stories, or testimonials that showcase your impact..."},{id:20,act:3,field:"fundingHistory",question:"List any grants or funding your organization has received",subtitle:"Prior funding is the strongest credibility signal in grant writing",type:"textarea",required:!1,skippable:!0,placeholder:"e.g., Received $50,000 grant from the Ford Foundation in 2024 for community health programs..."},{id:21,act:3,field:"website",question:"What is your organization's website?",subtitle:"Some funders check this during due diligence",type:"url",required:!1,skippable:!0,placeholder:"https://example.org"},{id:22,act:3,field:"relevantLinks",question:"Any other relevant links? (social media, press, reports)",subtitle:"Supporting evidence for your track record",type:"textarea",required:!1,skippable:!0,placeholder:"e.g., https://twitter.com/yourorg\nhttps://awards.example.com/your-award"},{id:23,act:3,field:"teamMember",question:"Add your leadership team members",subtitle:"Funders evaluate the team behind the mission",type:"team",required:!0},{id:24,act:3,field:"document",question:"Upload supporting documents",subtitle:"Registration certificates, annual reports, pitch decks",type:"document",required:!1,skippable:!0}],w={ng:"Nigeria",ke:"Kenya",gh:"Ghana",za:"South Africa",us:"United States",uk:"United Kingdom",ca:"Canada",other:"Other"};function j(e){return e.country&&w[e.country]&&(e.country=w[e.country]),e}let N=x.filter(e=>1===e.act).map(e=>e.id),k=x.filter(e=>2===e.act).map(e=>e.id),C=x.filter(e=>3===e.act).map(e=>e.id),S=x.filter(e=>1===e.act).map(e=>e.field),F=x.filter(e=>2===e.act).map(e=>e.field),z=x.filter(e=>3===e.act).map(e=>e.field),A="choice",D="act2-intro",T="act3-intro",M="find-complete",B="write-complete",L="heard";function E(e,a){return(1===e?S:2===e?F:z).every(e=>{let t=x.find(a=>a.field===e);if(t&&t.skippable)return!0;if("teamMember"===e)return"completed"===a[e];let l=a[e];return(0,r.hasUsableAnswer)(e,l)})}function q(){let{user:e}=(0,u.aC)(),a=(0,i.useRouter)(),[t,c]=(0,n.useState)(0),[m,b]=(0,n.useState)({}),v=(0,n.useRef)({}),[w,S]=(0,n.useState)(!0),[F,z]=(0,n.useState)(!1),q=(0,n.useRef)(null),[R,P]=(0,n.useState)(null),[G,W]=(0,n.useState)(10),[K,U]=(0,n.useState)(null),Y=m.lastName||"",O=(0,n.useMemo)(()=>({lastName:Y}),[Y]),H=m.additionalCountries,V=(0,n.useMemo)(()=>({additionalCountries:Array.isArray(H)?H:[]}),[H]),Z=(0,n.useRef)(!1);(0,n.useEffect)(()=>{a.isReady&&!Z.current&&(Z.current=!0,ea())},[a.isReady]);let $=(0,n.useRef)(!1),J=(0,n.useRef)(!1),X=(0,n.useRef)(!1),Q=(0,n.useRef)(null);(0,n.useEffect)(()=>{w||t!==A||$.current||($.current=!0,ed())},[t,w]);let ee=(0,n.useRef)({1:!1,2:!1,3:!1,full:!1});(0,n.useEffect)(()=>{if(w)return;let e=ee.current;if(!e[1]&&(t===L||t===A)){e[1]=!0;try{(0,h.j)("onboarding_act_completed",{act:1})}catch(e){}}if(!e[2]&&(t===M||t===T)){e[2]=!0;try{(0,h.j)("onboarding_act_completed",{act:2})}catch(e){}}if(!e[3]&&t===B){e[3]=!0;try{(0,h.j)("onboarding_act_completed",{act:3})}catch(e){}}if(!e.full&&(t===M||t===B)){e.full=!0;try{(0,h.j)("onboarding_completed",{path:t===M?"find":"write"})}catch(e){}}},[t,w]),(0,n.useEffect)(()=>()=>{Q.current&&cancelAnimationFrame(Q.current),q.current&&clearTimeout(q.current)},[]);let ea=async()=>{var t,l;try{let e=localStorage.getItem("token"),l=await s.Z.get("/api/onboarding/resume",{headers:{Authorization:"Bearer ".concat(e)}}),r=j(l.data.answers||{});b(r),v.current=r,W(l.data.completion||10);let n=null===(t=a.query)||void 0===t?void 0:t.path;("find"===n||"write"===n)&&U(n);let i=et(r,n);if(null===i)return;c(i),S(!1)}catch(t){console.error("Error loading resume data:",t);try{let t=localStorage.getItem("token"),r=await s.Z.get("/api/organization",{headers:{Authorization:"Bearer ".concat(t)}});if(r.data){let t=r.data,n={},i={organizationName:"name",missionAndWhatWeDo:"mission_and_what_we_do",organizationType:"organization_type",companySize:"company_size",annualRevenue:"annual_revenue",governmentRegistered:"government_registered",operatingStartDate:"operating_start_date",youngestCofounderAge:"youngest_cofounder_age",femaleLed:"female_led",minGrantAmount:"min_grant_amount",technicalSupp
1ortOnly:"technical_support_only",matchingFunds:"matching_funds",trackRecordAndImpact:"track_record_and_impact",keyPartnerships:"key_partnerships",additionalContext:"additional_context",relevantLinks:"relevant_links",fundingHistory:"funding_history"};x.map(e=>e.field).filter(e=>"teamMember"!==e&&"document"!==e).forEach(e=>{let a=t[e]||t[i[e]||e];a&&(n[e]=a)}),(null==e?void 0:e.first_name)&&(n.firstName=e.first_name),(null==e?void 0:e.last_name)&&(n.lastName=e.last_name),Array.isArray(t.additionalCountries)&&(n.additionalCountries=t.additionalCountries),j(n),b(n),v.current=n;let s=null===(l=a.query)||void 0===l?void 0:l.path;("find"===s||"write"===s)&&U(s);let o=et(n,s);if(null===o)return;c(o)}}catch(e){console.error("Fallback org load also failed:",e)}S(!1)}},et=(e,t)=>{let l=E(1,e),r=E(2,e),n=E(3,e),i=t||K;if(!l){let a=el(N,e);return null!==a?a:N[0]}return l&&!r?i?D:A:l&&r&&!n?"find"===i?M:"write"===i?T:A:l&&r&&n?(a.push("/dashboard"),null):N[0]},el=(e,a)=>{for(let t of e){let e=x.find(e=>e.id===t);if(!e||e.skippable||"team"===e.type&&"completed"===a[e.field]||"document"===e.type)continue;let l=a[e.field];if(!(0,r.hasUsableAnswer)(e.field,l))return t}return null},er=async(e,a,l)=>{z(!0);try{let n=localStorage.getItem("token"),i=(0,r.answerPatch)(e,a,l),o={...v.current,...i},u=await s.Z.post("/api/onboarding/save-progress",{current_step:"number"==typeof t?t:1,answers:i},{headers:{Authorization:"Bearer ".concat(n)}});return b(o),v.current=o,W(u.data.completion),P({message:"Saved",type:"success"}),setTimeout(()=>P(null),1e3),z(!1),!0}catch(e){var n,i;return console.error("Error saving progress:",e),P({message:(null===(i=e.response)||void 0===i?void 0:null===(n=i.data)||void 0===n?void 0:n.error)||"Failed to save. Please try again.",type:"error"}),z(!1),!1}},en=(0,n.useRef)(!1),ei=async(e,a,t)=>{en.current||(en.current=!0,await er(e,a,t)?q.current=setTimeout(()=>{try{es()}finally{en.current=!1}},500):en.current=!1)},es=()=>{let e=v.current;c(a=>{if("number"!=typeof a)return a;let t=x.find(e=>e.id===a);if(!t)return a+1;let l=t.act,n=1===l?N:2===l?k:C,i=n[n.length-1];if(a>=i){if(1===l)return e.howYouHeardAboutUs?A:L;if(2===l)return"find"===K?M:"write"===K?T:M;if(3===l)return B}let s=a+1;for(;s<=i;){let a=x.find(e=>e.id===s);if(!a||"team"===a.type||"document"===a.type||!(0,r.hasUsableAnswer)(a.field,e[a.field]))break;s++}if(s>i){if(1===l)return e.howYouHeardAboutUs?A:L;if(2===l)return"find"===K?M:"write"===K?T:M;if(3===l)return B}return s})},eo=e=>{U(e),a.replace("/onboarding/profile-wizard?path=".concat(e),void 0,{shallow:!0});let t=E(2,v.current);"find"===e?t?c(M):c(D):"write"===e&&(t?E(3,v.current)?c(B):c(T):c(D))},eu=e=>{let a=el(2===e?k:C,v.current);null!==a?c(a):2===e?c("write"===K?T:M):c(B)},ed=()=>{"undefined"!=typeof navigator&&navigator.vibrate&&navigator.vibrate(200);let e=Date.now()+2500,a=()=>{(0,o.Z)({particleCount:3,angle:60,spread:55,origin:{x:0},colors:["#22c55e","#34D399","#6EE7B7","#FBBF24","#60A5FA"]}),(0,o.Z)({particleCount:3,angle:120,spread:55,origin:{x:1},colors:["#22c55e","#34D399","#6EE7B7","#FBBF24","#60A5FA"]}),Date.now()<e&&(Q.current=requestAnimationFrame(a))};a()};if(w)return(0,l.jsx)(p.Z,{title:"Loading your profile",subtitle:"Getting your information..."});if(t===L)return(0,l.jsx)(_,{onPick:e=>{er("howYouHeardAboutUs",e),c(A)},onSkip:()=>c(A)});if(t===A)return(0,l.jsx)("div",{className:"min-h-screen flex items-center justify-center px-4 py-8",style:{background:"linear-gradient(180deg, #ffffff 0%, #fafaf8 100%)"},children:(0,l.jsxs)("div",{className:"max-w-2xl w-full",children:[(0,l.jsxs)("div",{className:"text-center mb-8",children:[(0,l.jsxs)("div",{className:"flex items-center justify-center gap-2 mb-3",children:[(0,l.jsx)("svg",{className:"w-6 h-6 text-green-500",fill:"currentColor",viewBox:"0 0 20 20",children:(0,l.jsx)("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z",clipRule:"evenodd"})}),(0,l.jsxs)("span",{className:"text-2xl sm:text-3xl text-gray-900",style:{fontFamily:"var(--font-instrument-serif)"},children:[m.organizationName||"Your organization"," is ready"]})]}),(0,l.jsx)("div",{className:"inline-block bg-gray-50 border border-gray-200 rounded-xl px-6 py-3 mb-8",children:(0,l.jsx)("span",{className:"text-sm text-gray-600",style:{fontFamily:"var(--font-instrument-sans)"},children:(()=>{var e,a,t,l,r,n,i,s,o;let u=null===(t=x.find(e=>"sector"===e.field))||void 0===t?void 0:null===(a=t.options)||void 0===a?void 0:null===(e=a.find(e=>e.value===m.sector))||void 0===e?void 0:e.label,d=(null===(n=x.find(e=>"country"===e.field))||void 0===n?void 0:null===(r=n.options)||void 0===r?void 0:null===(l=r.find(e=>e.value===m.country))||void 0===l?void 0:l.label)||m.country,c=null===(o=x.find(e=>"organizationType"===e.field))||void 0===o?void 0:null===(s=o.options)||void 0===s?void 0:null===(i=s.find(e=>e.value===m.organizationType))||void 0===i?void 0:i.label;
1return[u,[m.city,d].filter(Boolean).join(", "),c].filter(Boolean).join(" \xb7 ")})()})}),(0,l.jsx)("p",{className:"text-gray-500 text-base",style:{fontFamily:"var(--font-instrument-sans)"},children:"What would you like to do first?"})]}),(0,l.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4 sm:gap-6 mb-8",children:[(0,l.jsxs)("button",{onClick:()=>eo("find"),className:"bg-white rounded-2xl border border-gray-200 p-6 sm:p-10 flex flex-col items-center text-center hover:border-gray-300 hover:shadow-md focus:border-gray-300 focus:shadow-md focus:outline-none transition-all duration-200 group",style:{transform:"translateY(0)"},onMouseEnter:e=>e.currentTarget.style.transform="translateY(-2px)",onMouseLeave:e=>e.currentTarget.style.transform="translateY(0)",onFocus:e=>e.currentTarget.style.transform="translateY(-2px)",onBlur:e=>e.currentTarget.style.transform="translateY(0)",children:[(0,l.jsx)("div",{className:"mb-4 sm:mb-6",children:(0,l.jsx)("img",{src:"/assets/gre-illustration.png?v=3",alt:"Find Grants",className:"h-[64px] sm:h-[100px] w-auto"})}),(0,l.jsx)("h2",{className:"text-gray-900 mb-2 text-lg sm:text-2xl",style:{fontFamily:"var(--font-instrument-sans)",fontWeight:500},children:"Find Grants For Me"}),(0,l.jsx)("p",{className:"text-gray-500 text-xs sm:text-sm",style:{fontFamily:"var(--font-instrument-sans)"},children:"Discover grants you qualify for in minutes"})]}),(0,l.jsxs)("button",{onClick:()=>eo("write"),className:"bg-white rounded-2xl border border-gray-200 p-6 sm:p-10 flex flex-col items-center text-center hover:border-gray-300 hover:shadow-md focus:border-gray-300 focus:shadow-md focus:outline-none transition-all duration-200 group",style:{transform:"translateY(0)"},onMouseEnter:e=>e.currentTarget.style.transform="translateY(-2px)",onMouseLeave:e=>e.currentTarget.style.transform="translateY(0)",onFocus:e=>e.currentTarget.style.transform="translateY(-2px)",onBlur:e=>e.currentTarget.style.transform="translateY(0)",children:[(0,l.jsx)("div",{className:"mb-4 sm:mb-6",children:(0,l.jsx)("img",{src:"/assets/wizard-illustration.png?v=2",alt:"Write Grants",className:"h-[64px] sm:h-[100px] w-auto"})}),(0,l.jsx)("h2",{className:"text-gray-900 mb-2 text-lg sm:text-2xl",style:{fontFamily:"var(--font-instrument-sans)",fontWeight:500},children:"Write Grants For Me"}),(0,l.jsx)("p",{className:"text-gray-500 text-xs sm:text-sm",style:{fontFamily:"var(--font-instrument-sans)"},children:"AI writes your first draft in minutes"})]})]}),(0,l.jsxs)("div",{className:"text-center",children:[(0,l.jsx)("button",{onClick:()=>a.push("/dashboard"),className:"text-sm text-gray-400 hover:text-gray-600 hover:underline transition-colors",style:{fontFamily:"var(--font-instrument-sans)"},children:"I'll do this later →"}),(0,l.jsx)("p",{className:"text-xs text-gray-300 mt-1",style:{fontFamily:"var(--font-instrument-sans)"},children:"You can always continue from your dashboard"})]})]})});if(t===D){let e=k.filter(e=>{let a=x.find(a=>a.id===e);if(!a)return!1;let t=v.current[a.field];return!t||!String(t).trim()}).length,a="write"===K?"".concat(9===e?"These 9 questions":1===e?"Just 1 more question":"Just ".concat(e," more questions")," about your organization help our AI write proposals that match your eligibility profile."):"Before we search, let's make sure we only show you grants you actually qualify for.".concat(e<9?" Just ".concat(e," question").concat(1===e?"":"s"," left."):"");return(0,l.jsx)(f,{title:a,onContinue:()=>eu(2)})}if(t===T)return(0,l.jsx)(f,{completedLabel:"Eligibility — complete",title:"Now let's give our AI the evidence it needs to write proposals that win.",body:"Funders want proof. Let's give it to them.",onContinue:()=>eu(3)});if(t===M)return(0,l.jsx)(I,{emoji:"\uD83C\uDF89",title:"You're ready to find grants!",body:"We now have everything we need to match you with the right funders.",primaryCTA:{label:"Find My Grants",onClick:()=>a.push("/grants")},secondaryCTA:{label:"Want to write grants too? Just a few more questions →",onClick:()=>{U("write"),a.replace("/onboarding/profile-wizard?path=write",void 0,{shallow:!0}),c(T)}},onMount:()=>{J.current||(J.current=!0,ed())}});if(t===B)return(0,l.jsx)(I,{emoji:"\uD83C\uDF89\uD83C\uDF89\uD83C\uDF89",title:"You're ready to write winning grants!",body:"You've given our AI more context than most users — your proposals will reflect it.",primaryCTA:{label:"Write My First Grant",onClick:()=>a.push("/dashboard")},secondaryCTA:{label:"Find Grants First",onClick:()=>a.push("/grants")},onMount:()=>{X.current||(X.current=!0,ed())}});let ec=x.find(e=>e.id===t);if(!ec)return a.push("/dashboard"),null;let em=ec.act,eg=x.filter(e=>
1e.act===em),ef=eg.findIndex(e=>e.id===t);return(0,l.jsxs)("div",{className:"min-h-screen",style:{background:"linear-gradient(180deg, #ffffff 0%, #fafaf8 100%)"},children:[(0,l.jsx)(d,{currentAct:em,questionIndex:ef,totalInAct:eg.length,act1Complete:E(1,m),act2Complete:E(2,m),onBack:t>N[0]?()=>{if("number"!=typeof t||t<=0)return;let e=x.find(e=>e.id===t);if(e){if(t<=(1===e.act?N:2===e.act?k:C)[0]){2===e.act?c(A):3===e.act&&c(T);return}c(t-1)}}:null,onExit:()=>{a.push("/dashboard")}}),(0,l.jsx)("div",{className:"max-w-2xl mx-auto px-4 py-8 sm:py-16",children:(0,l.jsx)(g,{question:ec,value:m[ec.field],onAnswer:ei,onSkip:ec.skippable?()=>{es()}:null,saving:F,questionIndex:ef,totalInAct:eg.length,extraValues:"name"===ec.type?O:"multi-searchable-select"===ec.type?V:void 0},ec.id)}),R&&(0,l.jsx)(y.Z,{message:R.message,type:R.type,onClose:()=>P(null)})]})}let R=[{label:"Search",icon:"\uD83D\uDD0D"},{label:"Social media",icon:"\uD83D\uDCAC",children:[{label:"LinkedIn",icon:"\uD83D\uDCBC"},{label:"Instagram",icon:"\uD83D\uDCF8"},{label:"Facebook",icon:"\uD83D\uDCD8"},{label:"X",icon:"\uD835\uDD4F"},{label:"TikTok",icon:"\uD83C\uDFB5"}]},{label:"Friend or colleague",icon:"\uD83D\uDC65"},{label:"A funder or grant officer",icon:"\uD83C\uDFDB️"},{label:"An event or webinar",icon:"\uD83C\uDFA4"},{label:"Something else",icon:"✨",custom:!0}];function _(e){let{onPick:a,onSkip:t}=e,[r,i]=(0,n.useState)(!1),[s,o]=(0,n.useState)(null),[u,d]=(0,n.useState)(!1),[c,m]=(0,n.use
1State)("");(0,n.useEffect)(()=>{let e=setTimeout(()=>i(!0),50);return()=>clearTimeout(e)},[]);let g=e=>a(String(e||"").trim().slice(0,120)||"Something else");return(0,l.jsx)("div",{className:"min-h-screen flex items-center justify-center px-4",style:{background:"linear-gradient(180deg, #ffffff 0%, #fafaf8 100%)"},children:(0,l.jsxs)("div",{className:"max-w-md w-full text-center transition-all duration-500 ease-out",style:{opacity:r?1:0,transform:r?"translateY(0)":"translateY(12px)"},children:[(0,l.jsx)("h1",{className:"text-2xl sm:text-[28px] text-gray-900 mb-2 leading-snug",style:{fontFamily:"var(--font-instrument-serif)"},children:"Quick one — how’d you find us?"}),(0,l.jsx)("p",{className:"text-sm text-gray-400 mb-8",style:{fontFamily:"var(--font-instrument-sans)"},children:"No wrong answer. It just helps us reach more teams like yours."}),(0,l.jsx)("div",{className:"text-left",children:u?(0,l.jsxs)("form",{onSubmit:e=>{e.preventDefault(),g(c)},children:[(0,l.jsx)("input",{autoFocus:!0,type:"text",value:c,onChange:e=>m(e.target.value),maxLength:120,placeholder:"e.g. a colleague, a conference, a podcast…",className:"w-full px-4 py-3 border border-gray-300 rounded-xl text-sm focus:outline-none focus:border-gray-900 focus:ring-1 focus:ring-gray-900",style:{fontFamily:"var(--font-instrument-sans)"}}),(0,l.jsxs)("div",{className:"flex items-center justify-between mt-3",children:[(0,l.jsx)("button",{type:"button",onClick:()=>{d(!1),m("")},className:"text-sm text-gray-400 hover:text-gray-600 transition-colors",style:{fontFamily:"var(--font-instrument-sans)"},children:"← Back"}),(0,l.jsx)("button",{type:"submit",className:"px-5 py-2 bg-black text-white rounded-lg text-sm font-medium hover:bg-gray-800 transition-colors",style:{fontFamily:"var(--font-instrument-sans)"},children:"Done"})]})]}):s?(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)("p",{className:"text-sm text-gray-400 mb-3 text-center",style:{fontFamily:"var(--font-instrument-sans)"},children:"Which one?"}),(0,l.jsx)("div",{className:"grid grid-cols-2 gap-2",children:s.children.map((e,a)=>{let t=a===s.children.length-1&&s.children.length%2==1;return(0,l.jsxs)("button",{type:"button",onClick:()=>g(e.label),className:"flex items-center gap-2 px-3 py-2.5 border border-gray-200 rounded-xl text-sm text-gray-700 hover:border-gray-900 hover:bg-gray-50 transition-colors text-left ".concat(t?"col-span-2 justify-center":""),style:{fontFamily:"var(--font-instrument-sans)"},children:[(0,l.jsx)("span",{"aria-hidden":"true",children:e.icon}),(0,l.jsx)("span",{className:"truncate",children:e.label})]},e.label)})}),(0,l.jsx)("div",{className:"mt-3 text-center",children:(0,l.jsx)("button",{type:"button",onClick:()=>o(null),className:"text-sm text-gray-400 hover:text-gray-600 transition-colors",style:{fontFamily:"var(--font-instrument-sans)"},children:"← Back"})})]}):(0,l.jsx)("div",{className:"grid grid-cols-2 gap-2",children:R.map((e,a)=>{let t=a===R.length-1&&R.length%2==1,r=e.custom?()=>d(!0):e.children?()=>o(e):()=>g(e.label);return(0,l.jsxs)("button",{type:"button",onClick:r,className:"flex items-center gap-2 px-3 py-2.5 border border-gray-200 rounded-xl text-sm text-gray-700 hover:border-gray-900 hover:bg-gray-50 transition-colors text-left ".concat(t?"col-span-2 justify-center":""),style:{fontFamily:"var(--font-instrument-sans)"},children:[(0,l.jsx)("span",{"aria-hidden":"true",children:e.icon}),(0,l.jsx)("span",{className:"truncate",children:e.label}),e.children&&(0,l.jsx)("span",{className:"ml-auto text-gray-300","aria-hidden":"true",children:"›"})]},e.label)})})}),!u&&(0,l.jsx)("div",{className:"mt-6",children:(0,l.jsx)("button",{type:"button",onClick:t,className:"text-sm text-gray-400 hover:text-gray-600 transition-colors",style:{fontFamily:"var(--font-instrument-sans)"},children:"Skip →"})})]})})}function I(e){let{emoji:a,title:t,body:r,primaryCTA:i,secondaryCTA:s,onMount:o}=e,[u,d]=(0,n.useState)(!1);return(0,n.useEffect)(()=>{let e=setTimeout(()=>d(!0),50);return o&&o(),()=>clearTimeout(e)},[]),(0,l.jsx)("div",{className:"min-h-screen flex items-center justify-center px-4",style:{background:"linear-gradient(180deg, #ffffff 0%, #fafaf8 100%)"},children:(0,l.jsxs)("div",{className:"max-w-md w-full text-center transition-all duration-500 ease-out",style:{opacity:u?1:0,transform:u?"translateY(0)":"translateY(12px)"},children:[(0,l.jsx)("div",{className:"text-5xl sm:text-6xl mb-6",role:"img","aria-label":"Celebration",children:a}),(0,l.jsx)("h1",{className:"text-2xl sm:text-[32px] text-gray-900 mb-4 leading-snug",style:{fontFamily:"var(--font-instrument-serif)"},children:t}),(0,l.jsx)("p",{className:"text-base text-gray-500 mb-10 leading-relaxed",style:{fontFamily:"var(--font-instrument-sans)"},children:r}),(0,l.jsx)("button",{onClick:i.onClick,className:"w-full sm:w-auto px-8 py-3 bg-black text-white rounded-lg font-medium hover:bg-gray-800 transition-colors mb-4",style:{fontFamily:"var(--font-instrument-sans)"},children:i.label}),s&&(0,l.jsx)("div",{children:(0,l.jsxs)("button",{onClick:s.onClick,className:"text-sm text-gray-400 hover:text-gray-600 transition-colors mt-2",style:{fontFamily:"var(--font-instrument-sans)"},children:[s.label," →"]})})]})})}},73938:function(e,a,t){"use strict";let{phoneError:l}=t(28161),{operatingDateError:r}=t(86751);function n(e){return null==e||""===e?null:!["string","number"].includes(typeof e)||!/^[0-9]{1,3}$/.test(String(e))||15>Number(e)||Number(e)>70?"Please enter a whole age between 15 and 70.":null}e.exports={hasUsableAnswer:function(e,a){return!("youngestCofounderAge"===e&&n(a))&&("phone"===e?!l(a,!0):!("operatingStartDate"===e&&r(a))&&null!=a&&""!==String(a).trim())},answerPatch:function(e,a,t){let l=["companySize","annualRevenue","youngestCofounderAge"].includes(e)?String(a).replace(/[^0-9]/g,""):a;return{[e]:l,...t}},founderAgeError:n}},86751:function(e){"use strict";let a="1900-01-01",t="Enter a valid date between 1900 and today, using a four-digit year.";e.exports={operatingDateError:function(e){let l=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Date().toISOString().slice(0,10);if(null==e||""===e)return null;if("string"!=typeof e||!/^\d{4}-\d{2}-\d{2}$/.test(e))return t;let r=new Date("".concat(e,"T00:00:00Z"));return!Number.isFinite(r.getTime())||r.toISOString().slice(0,10)!==e||e<a||e>l?t:null},OPERATING_DATE_MIN:a,OPERATING_DATE_MESSAGE:t}},28161:function(e){"use strict";e.exports={phoneError:function(e){let a=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if("string"==typeof e&&e.length>50)return"Please shorten the phone number to 50 characters or fewer.";if(null==e||"string"==typeof e&&!e.trim())return a?"Please enter your phone number.":null;if("string"!=typeof e||!/^\+?[0-9 ()\-]+$/.test(e.trim()))return"Enter a phone number using digits and an optional leading +.";let t=e.replace(/\D/g,"");
1return t.startsWith("00")&&(t=t.slice(2)),t.length<7||t.length>15||1===new Set(t).size?"Please enter a valid phone number, including your country code.":null}}}},function(e){e.O(0,[9883,2888,9774,179],function(){return e(e.s=44231)}),_N_E=e.O()}]);

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.