1import{a as f,j as e,aN as k,aG as b,aH as S,aK as C,aO as w,Q as A,a0 as L,aP as z,z as F,E as q,q as E}from"./chunk-D76d6Nhf.js";import{u as P,p as D,q as T,c as u,o as R}from"../assets/index-BFVgIuJz.js";import{a as B,b as G,p as I}from"./chunk-D8TULwSH.js";import{B as H}from"./chunk-BL8lIIho.js";import{F as M}from"./chunk-BbMktldQ.js";import{u as O}from"./chunk-C5ZDwG3s.js";import{D as U,a as K,b as Q,c as V}from"./chunk-3Rc0u7-t.js";import{f as W,b as Y,h as v,e as J,g as X,a as Z,j as ee,s as ae,d as le}from"./chunk-nOu6ZD-3.js";import{c as se,r as re}from"./chunk-DQw5763t.js";import{p as te}from"./chunk-CEv2of7a.js";import"./chunk-B1OypRos.js";import"./chunk-DeRmtv56.js";import"./chunk-BKyy4R_S.js";import"./chunk-Twnw11IT.js";import"./chunk-DbvEWrmn.js";function _(a){switch(le(a)){case"closed":return"bg-gray-100 text-ink-muted";case"urgent":return"bg-red-50 text-red-700";case"soon":return"bg-amber-50 text-amber-700";default:return"bg-emerald-50 text-emerald-700"}}function ie({id:a,onBack:r,backLabel:o="Scholarships",browseMoreHref:t="/scholarships",notFoundMessage:m}){const[d,i]=f.useState(null),{data:c,isPending:j,isError:l}=O({queryKey:["scholarship","detail",a],queryFn:async()=>(await R(`/api/v1/scholarships/${encodeURIComponent(a)}`,!1))?.scholarship??null,enabled:!!a,staleTime:300*1e3,retry:1}),s=c??null,p=j,y=!p&&!s;return P(s?{title:G({name:s.name,sponsor:s.sponsor_organization||""}),description:B({name:s.name,sponsor:s.sponsor_organization||""}),image:s.cover_image||s.logo_url||null,canonicalPath:T(s),jsonLd:D(s)}:y?{title:te(),noindex:!0}:null),p?e.jsxs("div",{className:"mx-auto max-w-5xl px-4 sm:px-6 py-12",children:[e.jsx("div",{className:"h-64 w-full animate-pulse rounded-2xl bg-gray-100"}),e.jsx("div",{className:"mt-6 h-7 w-2/3 animate-pulse rounded bg-gray-100"}),e.jsx("div",{className:"mt-3 h-4 w-1/3 animate-pulse rounded bg-gray-100"})]}):y||!s?e.jsxs("div",{className:"mx-auto max-w-2xl px-6 py-24 text-center",children:[e.jsx("h1",{className:"text-2xl font-semibold text-ink",children:"Scholarship not found"}),e.jsx("p",{className:"mt-2 text-sm text-ink-muted",children:m||(l?"We had trouble loading this scholarship.":"This scholarship may have been removed or the link is incorrect.")}),e.jsxs("button",{type:"button",onClick:r,className:"mt-6 inline-flex items-center gap-2 rounded-lg border border-hairline bg-white px-4 py-2 text-sm font-semibold text-ink hover:bg-gray-50",children:[e.jsx(k,{className:"h-4 w-4"}),"Back to ",o.toLowerCase()]})]}):e.jsxs(e.Fragment,{children:[e.jsx(ne,{scholarship:s,onBack:r,backLabel:o}),e.jsx(ce,{scholarship:s,onOpenImage:(g,$)=>i({url:g,label:$}),browseMoreHref:t}),e.jsx(U,{open:d!==null,onOpenChange:g=>!g&&i(null),children:e.jsxs(K,{className:"max-w-4xl p-0 border-0 shadow-none",style:{backgroundColor:"transparent"},children:[e.jsx(Q,{className:"sr-only",children:e.jsx(V,{children:d?.label||"Image preview"})}),d&&e.jsxs("div",{className:"flex flex-col items-center gap-3",children:[e.jsx("img",{src:d.url,alt:d.label,className:"max-h-[78vh] max-w-full object-contain rounded-lg shadow-2xl bg-white"}),e.jsxs("a",{href:d.url,target:"_blank",rel:"noreferrer",className:"inline-flex items-center gap-1.5 text-xs text-white/90 hover:text-white bg-black/50 hover:bg-black/70 px-3 py-1.5 rounded-full backdrop-blur-sm",children:[e.jsx(b,{className:"h-3 w-3"}),"Open original"]})]})]})})]})}function ne({scholarship:a,onBack:r,backLabel:o}){const t=a.cover_image||Array.isArray(a.media_gallery)&&a.media_gallery[0]||null,m=se(a.host_country_code||re(a.host_country)||null);return e.jsxs("div",{className:"relative",children:[e.jsxs("div",{className:u("relative h-56 sm:h-72 md:h-80 lg:h-96 w-full overflow-hidden",!t&&"bg-gradient-to-br from-indigo-500 via-indigo-600 to-purple-700"),children:[t&&e.jsxs(e.Fragment,{children:[e.jsx("img",{src:t,alt:`${a.name} cover`,className:"absolute inset-0 h-full w-full object-cover",loading:"eager"}),e.jsx("div",{className:"absolute inset-0 bg-gradient-to-t from-black/70 via-black/30 to-black/10"})]}),e.jsxs("button",{type:"button",onClick:r,className:"absolute left-4 inline-flex items-center gap-1.5 rounded-full bg-white/90 px-3 py-1.5 text-xs font-semibold text-ink shadow-sm backdrop-blur hover:bg-white",style:{to
1p:"calc(var(--header-height, 1rem) + 0.75rem)"},children:[e.jsx(k,{className:"h-3.5 w-3.5"}),o]})]}),e.jsx("div",{className:"relative mx-auto -mt-16 sm:-mt-20 max-w-5xl px-4 sm:px-6",children:e.jsx("div",{className:"rounded-2xl border border-hairline bg-white shadow-lg p-4 sm:p-6",children:e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-end gap-4",children:[e.jsx(oe,{scholarship:a}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("p",{className:"text-xs font-semibold uppercase tracking-wider text-brand",children:a.sponsor_organization}),e.jsx("h1",{className:"font-display text-2xl sm:text-3xl font-semibold text-ink leading-tight break-words mt-1",children:a.name}),(a.host_university||a.host_country)&&e.jsxs("p",{className:"mt-1 inline-flex items-center gap-1.5 text-sm text-ink-muted",children:[m&&e.jsx("span",{"aria-hidden":!0,className:"text-base",children:m}),e.jsx(S,{className:"h-3.5 w-3.5 text-ink-muted"}),e.jsx("span",{children:[a.host_university,a.host_country].filter(Boolean).join(", ")})]})]}),e.jsx("div",{className:"flex items-center gap-2 shrink-0 flex-wrap",children:a.application_url?e.jsxs("a",{href:a.application_url,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center justify-center gap-1.5 rounded-lg bg-brand px-3.5 py-2 text-sm font-semibold text-white shadow-sm hover:bg-brand-deep",children:["Apply now",e.jsx(b,{className:"h-3.5 w-3.5"})]}):e.jsx("button",{type:"button",disabled:!0,className:"inline-flex items-center justify-center gap-1.5 rounded-lg bg-brand/50 px-3.5 py-2 text-sm font-semibold text-white shadow-sm cursor-not-allowed",children:"Apply now"})})]})})})]})}function oe({scholarship:a}){const[r,o]=f.useState(!1);if(a.logo_url&&!r)return e.jsx("div",{className:"h-20 w-20 sm:h-24 sm:w-24 shrink-0 rounded-xl border border-hairline bg-white shadow-sm overflow-hidden flex items-center justify-center p-2",children:e.jsx("img",{src:a.logo_url,alt:`${a.sponsor_organization} logo`,className:"max-h-full max-w-full object-contain",onError:()=>o(!0)})});const t=ae(a);return e.jsx("div",{className:"h-20 w-20 sm:h-24 sm:w-24 shrink-0 rounded-xl shadow-sm flex items-center justify-center text-white font-bold text-2xl",style:{background:"linear-gradient(135deg, #410895 0%, #7c3aed 100%)"},"aria-label":`${a.sponsor_organization} placeholder logo`,children:t.length<=3?t:e.jsx(L,{className:"h-8 w-8"})})}function ce({scholarship:a,onOpenImage:r,browseMoreHref:o}){const t=W(a.scholarship_type),m=Y(a.application_deadline),d=_(a.application_deadline),i=a.media_gallery??[],c=a.youtube_video_id??null,j=f.useMemo(()=>[{label:"Sponsor type",value:x(a.sponsor_type)},{label:"Funding",value:t},{label:"Award value",value:v(a)},{label:"Awards / year",value:a.number_of_awards_per_year===null||a.number_of_awards_per_year===void 0?"â":String(a.number_of_awards_per_year)},{label:"Duration",value:a.duration_years?`${a.duration_years} years`:"â"},{label:"Application method",value:x(a.application_method)}],[a,t]);return e.jsxs("div",{className:"mx-auto max-w-5xl px-4 sm:px-6 py-10 sm:py-12",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2 mb-6",children:[e.jsxs("span",{className:"inline-flex items-center gap-1 rounded-full bg-emerald-50 px-2.5 py-1 text-[11px] font-medium text-emerald-700",children:[e.jsx(C,{className:"h-3 w-3"}),t]}),e.jsxs("span",{className:u("inline-flex items-center gap-1 rounded-full px-2.5 py-1 text-[11px] font-medium",d),children:[e.jsx(w,{className:"h-3 w-3"}),"Deadline: ",m]}),a.study_level.slice(0,4).map(l=>e.jsx("span",{className:"inline-flex items-center rounded-full bg-gray-100 px-2.5 py-1 text-[11px] font-medium text-ink-muted",children:x(l)},l))]}),e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-[minmax(0,1fr)_320px] gap-8",children:[e.jsxs("div",{className:"min-w-0 space-y-8",children:[e.jsxs(h,{title:"Overview",subtitle:`Awarded by ${a.sponsor_organization}`,children:[e.jsx("p",{className:"text-sm text-ink-muted leading-relaxed",children:J(a)||X(a)||`Awarded by ${a.sponsor_organization}.`}),e.jsx("div",{className:"mt-4 grid grid-cols-1 sm:grid-cols-2 gap-3",children:j.map(l=>e.jsx(n,{label:l.label,value:l.value},l.label))})]}),e.jsx(h,{title:"Eligibility",children:e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3",children:[e.jsx(n,{label:"Citizenship",value:x(a.citizenship_eligibility)}),e.jsx(n,{label:"Eligible countries",value:(a.eligible_countries??[]).length===0?"â":a.eligible_countries.slice(0,6).join(", ")+(a.eligible_countries.length>6?" â¦":"")}),e.jsx(n,{label:"Gender",value:x(a.gender_eligibility)}),e.jsx(n,{label:"Age",value:a.age_eligibility||"â"}),e.jsx(n,{label:"Financial need",value:a.financial_need_required?"Required":"No"}),e.jsx(n,{label:"Academic merit",value:a.academic_merit_required?"Required":"No"}),e.jsx(n,{label:"Levels",value:Z(a.study_level)||"â"}),e.jsx(n,{label:"Fields",value:a.field_restrictions?a.fields_of_study.slice(0,6).map(ee).join(", ")||"Restricted":"Any field"})]})}),e.jsx(h,{title:"What's covered",children:e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3",children:[e.jsx(n,{label:"Scope",value:(a.coverage_scope??[]).length===0?"â":a.coverage_scope.map(l=>x(l.replace(/_/g," "))).join(" · ")}),e.jsx(n,{label:"Award value",value:v(a)}),e.jsx(n,{label:"Local value",value:a.value_local&&a.value_currency?`${a.value_local.toLocaleStr
1ing()} ${a.value_currency}`:"â"}),e.jsx(n,{label:"Renewable",value:a.renewable_conditions||"â"}),e.jsx(n,{label:"Service obligation",value:a.service_obligation||"None"}),e.jsx(n,{label:"Requires admission first",value:a.requires_admission_first?"Yes":"No"})]})}),(c||i.length>0)&&e.jsx(h,{title:c&&i.length>0?`Media (${i.length} photo${i.length===1?"":"s"})`:c?"Video":`Gallery (${i.length})`,children:e.jsxs("div",{className:u("grid gap-3",c&&i.length>0?"grid-cols-1 lg:grid-cols-5 lg:items-stretch":"grid-cols-1"),children:[c&&e.jsx("div",{className:u(i.length>0?"lg:col-span-3":"","min-w-0"),children:e.jsx("div",{className:"aspect-video w-full rounded-xl overflow-hidden bg-black shadow-sm",children:e.jsx("iframe",{src:`https://www.youtube.com/embed/${c}`,title:`${a.name} on YouTube`,allow:"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture",allowFullScreen:!0,className:"w-full h-full border-0"})})}),i.length>0&&e.jsx("div",{className:u(c?"lg:col-span-2":"","min-w-0"),children:c?e.jsx("div",{className:"grid grid-cols-2 gap-2 lg:h-full lg:grid-rows-2",children:i.slice(0,4).map((l,s)=>{const p=s===3&&i.length>4;return e.jsxs("button",{type:"button",onClick:()=>r(l,`${a.name} â photo ${s+1}`),className:"relative aspect-[4/3] lg:aspect-auto lg:h-full rounded-lg overflow-hidden bg-gray-100 group cursor-zoom-in border border-transparent hover:border-brand focus:outline-none focus:border-brand",title:`Photo ${s+1} â click to enlarge`,children:[e.jsx(N,{url:l,alt:`${a.name} photo ${s+1}`}),p&&e.jsxs("span",{className:"absolute inset-0 flex items-center justify-center bg-black/55 text-white text-sm font-semibold backdrop-blur-[1px]",children:["+",i.length-3," more"]})]},l)})}):e.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 gap-3",children:i.map((l,s)=>e.jsx("button",{type:"button",onClick:()=>r(l,`${a.name} â photo ${s+1}`),className:"relative aspect-[4/3] rounded-lg overflow-hidden bg-gray-100 group cursor-zoom-in border border-transparent hover:border-brand focus:outline-none focus:border-brand",title:`Photo ${s+1} â click to enlarge`,children:e.jsx(N,{url:l,alt:`${a.name} photo ${s+1}`})},l))})})]})}),(a.source_urls??[]).length>0&&e.jsx(h,{title:"Sources",children:e.jsx("ul",{className:"space-y-1 text-sm",children:a.source_urls.map(l=>e.jsx("li",{children:e.jsxs("a",{href:l,target:"_blank",rel:"noopener noreferrer",className:"text-brand hover:underline inline-flex items-center gap-1 break-all",children:[l," ",e.jsx(b,{className:"h-3 w-3 shrink-0"})]})},l))})})]}),e.jsxs("aside",{className:"lg:sticky lg:top-24 lg:self-start space-y-4",children:[e.jsxs("div",{className:"rounded-2xl border border-hairline bg-white shadow-sm p-5",children:[e.jsx("div",{className:"text-xs font-semibold uppercase tracking-wider text-ink-muted",children:"Apply"}),e.jsx("div",{className:"mt-1 text-lg font-semibold text-ink",children:v(a)}),e.jsxs("div",{className:u("mt-2 inline-flex items-center gap-1 rounded-full px-2.5 py-1 text-[11px] font-medium",_(a.application_deadline)),children:[e.jsx(w,{className:"h-3 w-3"}),m]}),a.application_url?e.jsxs("a",{href:a.application_url,target:"_blank",rel:"noopener noreferrer",className:"mt-4 inline-flex w-full items-center justify-center gap-1.5 rounded-lg bg-brand px-4 py-2.5 text-sm font-semibold text-white shadow-sm hover:bg-brand-deep",children:["Apply on sponsor's site",e.jsx(b,{className:"h-3.5 w-3.5"})]}):e.jsx("button",{type:"button",disabled:!0,className:"mt-4 inline-flex w-full items-center justify-center gap-1.5 rounded-lg bg-gray-200 px-4 py-2.5 text-sm font-semibold text-ink-muted cursor-not-allowed",children:"Application URL not set"}),a.contact_email&&e.jsxs("a",{href:`mailto:${a.contact_email}`,className:"mt-2 inline-flex w-full items-center justify-center gap-1.5 rounded-lg border border-hairline px-4 py-2 text-xs font-medium text-ink-muted hover:bg-gray-50",children:["Contact: ",a.contact_email]})]}),e.jsxs(A,{to:o,className:"block rounded-2xl border border-dashed border-hairline bg-white p-4 text-sm text-ink-muted hover:bg-gray-50",children:[e.jsx("span",{className:"font-semibold",children:"Browse more scholarships â"}),e.jsx("p",{className:"mt-1 text-xs text-ink-muted",children:"Take the 2-minute quiz to see which ones fit you."})]})]})]})]})}function N({url:a,alt:r}){const[o,t]=f.useState(!1);return o?e.jsx("div",{className:"absolute inset-0 flex items-center justify-center text-ink-muted bg-gray-50",children:e.jsx(z,{className:"h-5 w-5"})}):e.jsx("img",{src:a,alt:r,loading:"lazy",onError:()=>t(!0),className:"absolute inset-0 w-full h-full object-cover transition-transform group-hover:scale-[1.04]"})}function h({title:a,subtitle:r,children:o}){return e.jsxs("section",{children:[e.jsx("h2",{className:"font-display text-xl font-semibold text-ink tracking-tight",children:a}),r&&e.jsx("p",{className:"mt-0.5 text-xs text-ink-muted",children:r}),e.jsx("div",{className:"mt-3",children:o})]})}function n({label:a,value:r}){return e.jsxs("div",{className:"rounded-xl border border-hairline bg-gray-50/60 px-3.5 py-2.5",children:[e.jsx("div",{className:"text-[10px] font-semibold uppercase tracking-wider text-ink-muted",children:a}),e.jsx("div",{className:"mt-0.5 text-sm font-medium text-ink break-words",children:r||"â"})]})}function x(a){return a?a.toString().replace(/_/g," ").replace(/\b\w/g,r=>r.toUpperCase()):"â"}const ke=()=>{const{id:a=""}=F(),r=q(),t=E().state?.returnTo||"/scholarships";return e.jsxs("div",{className:"min-h-screen bg-paper",children:[e.jsx(H,{}),e.jsx(ie,{id:a,onBack:()=>r(t),backLabel:I(),browseMoreHref:"/scholarships"}),e.jsx(M,{})]})};export{ke as default};
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.