Spaces:
Running
Running
Sync paperswithcode.co frontend
Browse filesThis view is limited to 50 files because it contains too many changes. See raw diff
- assets/{AiDeadlinesView-CFbiOd1N.js → AiDeadlinesView-BDTEWDbH.js} +1 -1
- assets/{AuthorDetailView-6NlwLdzU.js → AuthorDetailView-BpOd7xtA.js} +1 -1
- assets/{BenchmarkDetailView-bJVNSxf9.js → BenchmarkDetailView-CkFv_YvY.js} +1 -1
- assets/{BenchmarkTrendSparkline-Dd-Foicv.js → BenchmarkTrendSparkline-DE8DNEAu.js} +1 -1
- assets/ChatMessage-CsmlLd6Q.js +0 -6
- assets/ChatMessage-Dx3LmUoF.js +6 -0
- assets/ChatView-CARCFhWo.js +0 -16
- assets/ChatView-CGCx-5Sp.js +16 -0
- assets/{ConferenceDetailView-CNr7MfPk.js → ConferenceDetailView-mC_EreQQ.js} +1 -1
- assets/{ConferenceTaskView-DCj73Bx2.js → ConferenceTaskView-C_4nVYLr.js} +1 -1
- assets/{ConferencesIndexView-seISFC3B.js → ConferencesIndexView-CTwjZP3S.js} +1 -1
- assets/{CronDashboard-AlgyoBn4.js → CronDashboard-BaDdSoqj.js} +8 -13
- assets/{ExternalSourceEvalBadge-CJOl_gOx.js → ExternalSourceEvalBadge-DW02jL22.js} +1 -1
- assets/{FeedView-Ca0uEQAe.js → FeedView-CkdQ3x4I.js} +1 -1
- assets/{FrameworksIndexView-DcjDYQnp.js → FrameworksIndexView-D4BjBFn-.js} +1 -1
- assets/{LatexTitle-BJ-ygzw0.js → LatexTitle-DOmMcoZ0.js} +1 -1
- assets/{MarkdownText-P17RUY6h.js → MarkdownText-DX4YTOrq.js} +1 -1
- assets/{MethodDetailView-C6ii1PxY.js → MethodDetailView-Deq8NPkc.js} +1 -1
- assets/{MethodsIndexView-C3l_l70o.js → MethodsIndexView-BPuT8ecr.js} +1 -1
- assets/{NotFound-B35QRL9m.js → NotFound-D95eYzTU.js} +1 -1
- assets/{OrganizationContributionGraph-3M6kI8AL.js → OrganizationContributionGraph-BPUdCM_r.js} +1 -1
- assets/OrganizationDetailView-B5tjQFbJ.js +1 -0
- assets/OrganizationDetailView-BlNMZLd2.js +0 -1
- assets/{OrganizationPaperFeed-coYDRJZ1.js → OrganizationPaperFeed-GYXowmRS.js} +1 -1
- assets/OrganizationTaskView-B9FcEHlq.js +0 -1
- assets/OrganizationTaskView-BiKsEldJ.js +1 -0
- assets/{OrganizationsIndexView-Bilr12rL.js → OrganizationsIndexView-CGf6Vqrw.js} +1 -1
- assets/{PaperDetailView-C9FO72gI.js → PaperDetailView-Cy4lGhTm.js} +1 -1
- assets/{PaperPreviewLink-syrag20a.js → PaperPreviewLink-DajWspZH.js} +1 -1
- assets/{PapersListView-Dtn8th3L.js → PapersListView-DKJHwCAY.js} +1 -1
- assets/{PrivacyView-Bsa4nuAZ.js → PrivacyView-CdEPOZuX.js} +1 -1
- assets/{RateLimitsView-BmjETJTs.js → RateLimitsView-CszkMzYL.js} +1 -1
- assets/{SavedPapersView-Qsjk3Dca.js → SavedPapersView-D2PAZRE5.js} +1 -1
- assets/{SearchOverlay-CeaAljfc.js → SearchOverlay-BA-6aIAF.js} +1 -1
- assets/{SettingsView-yjmiOa9c.js → SettingsView-0k3WbHkQ.js} +1 -1
- assets/SharedChatView-B_ppc17g.js +1 -0
- assets/SharedChatView-D0V9M4AO.js +0 -1
- assets/{SignInToEditDialog-CGTjmLU3.js → SignInToEditDialog-BPVN69wP.js} +1 -1
- assets/{SubmissionsDashboard-DD4Zn2r9.js → SubmissionsDashboard-CPBjBX6M.js} +1 -1
- assets/{SubmitView-DWznPena.js → SubmitView-LhfSq6TM.js} +1 -1
- assets/{TagBrowseView-B-2s2DBb.js → TagBrowseView-k-uxlt-5.js} +1 -1
- assets/{TagsIndexView-CSkGydzs.js → TagsIndexView-Dh5Mjjhn.js} +1 -1
- assets/{TaxonomySuggestionTile-D2ZiloFX.js → TaxonomySuggestionTile-BOiZOkbr.js} +1 -1
- assets/{TrendsView-DowfYjDj.js → TrendsView-GQfEX1cx.js} +1 -1
- assets/{UserProfileView-B6KAnwOV.js → UserProfileView-DUbkPjS_.js} +1 -1
- assets/{alert-DdslWjc3.js → alert-DJmmSiqi.js} +1 -1
- assets/{button-BPd6y_n4.js → button-DH3x5IsG.js} +1 -1
- assets/{chatSessions-Bv5yO1zx.js → chatSessions-nz97TbnH.js} +1 -1
- assets/{chevron-down-DFsRFUN6.js → chevron-down-X5yQfbpI.js} +1 -1
- assets/{codexAddEvals-f67YW8cy.js → codexAddEvals-DL2-0pMU.js} +1 -1
assets/{AiDeadlinesView-CFbiOd1N.js → AiDeadlinesView-BDTEWDbH.js}
RENAMED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
-
import{r as x,j as t,c as A}from"./index-
|
| 2 |
`)},C=e=>e.toISOString().replace(/[-:]/g,"").replace(/\.\d{3}/,""),ee=(e,a)=>{const n=new Date(a.deadline_at),r=new Date(n.getTime()+60*60*1e3),o=`${e.short_name||e.name} ${a.label||a.type||"deadline"}`,i=e.venue||[e.city,e.country].filter(Boolean).join(", "),s=`https://calendar.google.com/calendar/render?action=TEMPLATE&text=${encodeURIComponent(o)}&dates=${C(n)}/${C(r)}&details=${encodeURIComponent(R(e,a))}&location=${encodeURIComponent(i)}`,m=z(s);m&&window.open(m,"_blank","noopener,noreferrer")},te=(e,a)=>{const n=new Date(a.deadline_at),r=new Date(n.getTime()+60*60*1e3),o=`${e.short_name||e.name} ${a.label||a.type||"deadline"}`,i=e.venue||[e.city,e.country].filter(Boolean).join(", "),s=["BEGIN:VCALENDAR","VERSION:2.0","BEGIN:VEVENT",e.url?`URL:${e.url}`:null,`DTSTART:${C(n)}`,`DTEND:${C(r)}`,`SUMMARY:${o}`,`DESCRIPTION:${R(e,a).replace(/\n/g,"\\n")}`,i?`LOCATION:${i}`:null,"END:VEVENT","END:VCALENDAR"].filter(Boolean).join(`
|
| 3 |
`),m=new Blob([s],{type:"text/calendar;charset=utf-8"}),c=document.createElement("a");c.href=URL.createObjectURL(m),c.download=`${(e.short_name||e.name).toLowerCase().replace(/\s+/g,"-")}-deadline.ics`,document.body.appendChild(c),c.click(),document.body.removeChild(c),URL.revokeObjectURL(c.href)},ne=({conf:e,open:a,onOpenChange:n})=>{const[r,o]=x.useState(()=>Date.now());x.useEffect(()=>{if(!a)return;o(Date.now());const d=setInterval(()=>o(Date.now()),1e3);return()=>clearInterval(d)},[a]);const i=x.useMemo(()=>e?M(e):[],[e]),s=x.useMemo(()=>e?T(e,r):null,[e,r]),m=e?I(e.start_date,e.end_date):null,c=e?e.venue||[e.city,e.country].filter(Boolean).join(", ")||e.location:null,u=s?new Date(s.deadline_at).getTime():null;return t.jsx(P,{open:a,onOpenChange:n,children:t.jsx(G,{className:"max-w-xl",style:{background:"var(--bg-elevated)",maxHeight:"85vh",overflowY:"auto"},children:e&&t.jsxs(t.Fragment,{children:[t.jsxs(Y,{children:[t.jsx(H,{asChild:!0,children:t.jsx("h2",{style:{fontFamily:"var(--serif)",fontSize:26,fontWeight:500,letterSpacing:"-0.01em",margin:0},children:e.short_name?`${e.short_name} ${e.year??""}`.trim():e.name})}),e.short_name&&e.name||e.description?t.jsx(K,{asChild:!0,children:t.jsx("span",{style:{fontFamily:"var(--serif)",fontSize:14,color:"var(--ink-soft)"},children:e.short_name?e.name:e.description})}):null]}),t.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:20,marginTop:4},children:[t.jsxs("div",{style:{display:"flex",flexWrap:"wrap",gap:24},children:[m&&t.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:4},children:[t.jsx("span",{style:$,children:"Dates"}),t.jsx("span",{style:{fontFamily:"var(--mono)",fontSize:13,color:"var(--ink-soft)"},children:m})]}),c&&t.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:4},children:[t.jsx("span",{style:$,children:"Venue"}),t.jsx("span",{style:{fontFamily:"var(--mono)",fontSize:13,color:"var(--ink-soft)"},children:c})]})]}),u!=null&&t.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:4,padding:"12px 14px",borderRadius:8,background:"var(--bg-subtle)",border:"1px solid var(--hairline)"},children:[t.jsx("span",{style:$,children:"Next deadline in"}),t.jsx("span",{style:{fontFamily:"var(--mono)",fontSize:22,fontWeight:600,color:_(u,r)},children:X(u,r)})]}),t.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:8},children:[t.jsx("span",{style:$,children:"Important deadlines"}),i.length===0?t.jsx("span",{style:{fontFamily:"var(--mono)",fontSize:13,color:"var(--ink-faint)"},children:"No deadlines listed"}):i.map((d,p)=>{const y=new Date(d.deadline_at).getTime(),l=s!=null&&d.deadline_at===s.deadline_at&&d.type===s.type,h=y<=r;return t.jsxs("div",{style:{display:"flex",alignItems:"baseline",justifyContent:"space-between",gap:12,padding:"8px 12px",borderRadius:6,background:l?"var(--accent-soft)":"transparent",border:l?"1px solid var(--hairline-strong)":"1px solid var(--hairline)",opacity:h&&!l?.55:1},children:[t.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:2},children:[t.jsxs("span",{style:{fontFamily:"var(--mono)",fontSize:13,color:"var(--ink)",fontWeight:l?600:400},children:[d.label||k(d.type||"deadline"),l&&t.jsx("span",{style:{...$,marginLeft:8},children:"Next"})]}),t.jsxs("span",{style:{fontFamily:"var(--mono)",fontSize:12,color:"var(--ink-faint)"},children:[F(d.deadline_at),d.timezone?` · ${d.timezone}`:""]})]}),t.jsx("span",{style:{fontFamily:"var(--mono)",fontSize:12,fontWeight:600,whiteSpace:"nowrap",color:_(h?null:y,r)},children:Z(y,r)})]},`${d.type??"deadline"}-${p}`)})]}),D(e).length>0&&t.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:6},children:D(e).map(d=>t.jsx("span",{className:"tag-chip",style:{background:"var(--bg-subtle)",color:"var(--ink-soft)"},children:k(d)},d))}),t.jsxs("div",{style:{display:"flex",flexWrap:"wrap",alignItems:"center",gap:16,paddingTop:12,borderTop:"1px solid var(--hairline)"},children:[e.url&&t.jsx("a",{href:z(e.url)??void 0,target:"_blank",rel:"noopener noreferrer",style:{fontFamily:"var(--mono)",fontSize:12,color:"var(--accent-text)"},children:"Visit website ↗"}),s&&t.jsxs("div",{style:{display:"flex",gap:12,marginLeft:"auto"},children:[t.jsx("button",{type:"button",className:"tag-chip",onClick:()=>ee(e,s),style:{background:"var(--bg-subtle)",color:"var(--ink-soft)"},children:"+ Google Calendar"}),t.jsx("button",{type:"button",className:"tag-chip",onClick:()=>te(e,s),style:{background:"var(--bg-subtle)",color:"var(--ink-soft)"},children:"+ Apple / .ics"})]})]})]})]})})})},E=({id:e,label:a,checked:n,onChange:r})=>t.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,fontFamily:"var(--mono)",fontSize:12,color:"var(--ink-soft)"},children:[t.jsx(U,{id:e,checked:n,onCheckedChange:r}),t.jsx("label",{htmlFor:e,style:{cursor:"pointer"},children:a})]}),ae=({conf:e,now:a,selectedDomains:n,onToggleDomain:r,onOpen:o})=>{const i=T(e,a),s=i??L(e),m=s?new Date(s.deadline_at).getTime():null,c=_(i?m:null,a),u=I(e.start_date,e.end_date),d=[e.city??null,e.country??null].filter(Boolean).join(", ");return t.jsxs("div",{role:"button",tabIndex:0,onClick:()=>o(e),onKeyDown:p=>{(p.key==="Enter"||p.key===" ")&&(p.preventDefault(),o(e))},style:{border:"1px solid var(--hairline)",borderRadius:8,padding:20,background:"var(--bg-elevated)",display:"flex",flexDirection:"column",gap:12,cursor:"pointer"},children:[t.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"baseline",gap:12},children:[t.jsx("h3",{style:{fontFamily:"var(--serif)",fontSize:20,fontWeight:500,letterSpacing:"-0.01em",margin:0},children:e.short_name?`${e.short_name} ${e.year??""}`.trim():e.name}),e.url&&t.jsx("a",{href:z(e.url)??void 0,target:"_blank",rel:"noopener noreferrer",onClick:p=>p.stopPropagation(),style:{fontFamily:"var(--mono)",fontSize:11,color:"var(--accent-text)",whiteSpace:"nowrap"},children:"website ↗"})]}),t.jsxs("div",{style:{display:"flex",alignItems:"baseline",justifyContent:"space-between",gap:12,paddingBottom:12,borderBottom:"1px solid var(--hairline)"},children:[t.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:2},children:[t.jsx("span",{style:{fontFamily:"var(--mono)",fontSize:11,color:"var(--ink-faint)"},children:(s==null?void 0:s.label)||(s==null?void 0:s.type)||"Deadline"}),t.jsx("span",{style:{fontFamily:"var(--mono)",fontSize:12,color:"var(--ink-soft)"},children:s?`${F(s.deadline_at)}${s.timezone?` · ${s.timezone}`:""}`:"TBD"})]}),t.jsx("span",{style:{fontFamily:"var(--mono)",fontSize:14,fontWeight:600,color:c,whiteSpace:"nowrap"},children:m!=null?J(m,a):"TBD"})]}),t.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:4,fontFamily:"var(--mono)",fontSize:11,color:"var(--ink-faint)"},children:[u&&t.jsx("span",{children:u}),d&&t.jsx("span",{children:d})]}),D(e).length>0&&t.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:6},children:D(e).map(p=>{const y=n.has(p);return t.jsx("button",{className:"tag-chip",onClick:l=>{l.stopPropagation(),r(p)},style:{background:y?"var(--ink)":"var(--bg-subtle)",color:y?"var(--bg)":"var(--ink-soft)"},children:k(p)},p)})})]})},pe=()=>{const[e,a]=x.useState(!0),[n,r]=x.useState(!1),[o,i]=x.useState(new Set),[s,m]=x.useState(null),c=x.useMemo(()=>Date.now(),[]),u=B({queryKey:["conference-deadlines"],queryFn:()=>A.getConferenceDeadlines(),staleTime:10*60*1e3}),d=l=>{i(h=>{const g=new Set(h);return g.has(l)?g.delete(l):g.add(l),g})},p=x.useMemo(()=>{var h;const l=new Map;return(h=u.data)==null||h.results.forEach(g=>{D(g).forEach(j=>l.set(j,(l.get(j)??0)+1))}),Array.from(l.entries()).sort((g,j)=>j[1]-g[1]).map(([g])=>g)},[u.data]),y=x.useMemo(()=>{var j;const h=(((j=u.data)==null?void 0:j.results)??[]).filter(f=>!(e&&f.tier!=="a"||o.size>0&&!D(f).some(v=>o.has(v))||!n&&!T(f,c))),g=f=>{const w=T(f,c);if(w)return{group:0,time:new Date(w.deadline_at).getTime()};const v=L(f);return{group:1,time:-(v?new Date(v.deadline_at).getTime():0)}};return[...h].sort((f,w)=>{const v=g(f),N=g(w);return v.group!==N.group?v.group-N.group:v.time-N.time})},[u.data,e,n,o,c]);return u.error?t.jsx("div",{className:"page",children:t.jsx(O,{variant:"destructive",children:t.jsx(V,{children:"Failed to load conference deadlines. Please try again."})})}):t.jsxs("div",{className:"page",children:[t.jsx("div",{className:"feed-header",children:t.jsxs("div",{children:[t.jsxs("h1",{className:"feed-title",children:["AI Conference ",t.jsx("em",{children:"Deadlines"})]}),t.jsx("div",{className:"feed-subtitle",children:"Upcoming submission deadlines for major AI conferences, counting down."})]})}),t.jsxs("div",{style:{display:"flex",flexWrap:"wrap",alignItems:"center",gap:20,padding:"16px 0",borderBottom:"1px solid var(--hairline)",marginBottom:24},children:[t.jsx(E,{id:"top-tier-only",label:"Top tier only",checked:e,onChange:a}),t.jsx(E,{id:"show-past",label:"Show past conferences",checked:n,onChange:r})]}),p.length>0&&t.jsxs("div",{style:{display:"flex",flexWrap:"wrap",gap:6,marginBottom:24},children:[p.map(l=>{const h=o.has(l);return t.jsx("button",{className:"tag-chip",onClick:()=>d(l),style:{background:h?"var(--ink)":"var(--bg-subtle)",color:h?"var(--bg)":"var(--ink-soft)"},children:k(l)},l)}),o.size>0&&t.jsx("button",{className:"tag-chip",onClick:()=>i(new Set),style:{background:"transparent",color:"var(--ink-faint)"},children:"Clear ✕"})]}),t.jsx("div",{className:"sort-bar",children:t.jsx("div",{className:"results-count",children:u.isLoading?"…":`${y.length} conferences`})}),u.isLoading?t.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(320px, 1fr))",gap:16},children:Array.from({length:6}).map((l,h)=>t.jsx(W,{className:"h-44"},h))}):y.length===0?t.jsxs("div",{className:"no-results",children:["No conferences match these filters",n?".":" — try enabling “Show past conferences”."]}):t.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(320px, 1fr))",gap:16},children:y.map(l=>t.jsx(ae,{conf:l,now:c,selectedDomains:o,onToggleDomain:d,onOpen:m},l.id))}),t.jsx(ne,{conf:s,open:s!==null,onOpenChange:l=>{l||m(null)}})]})};export{pe as default};
|
|
|
|
| 1 |
+
import{r as x,j as t,c as A}from"./index-Bthypk3Q.js";import{u as B}from"./useQuery-CEDDm0wh.js";import{S as U}from"./switch-B0Xhzkpy.js";import{S as W}from"./skeleton-BS-Px_iI.js";import{A as O,a as V}from"./alert-DJmmSiqi.js";import{s as z}from"./safeExternalHref-CkBrsh84.js";import{D as P,a as G,b as Y,c as H,d as K}from"./dialog-DDnKVGO8.js";import"./index-CqkTYlMR.js";const b=1e3*60*60*24,S={urgent:"#c0392b",soon:"#b9770e",normal:"#3f7d3f",passed:"var(--ink-faint)"},k=e=>e.split("-").map(a=>a.charAt(0).toUpperCase()+a.slice(1)).join(" "),q=new Set(["machine-learning","computer-vision","natural-language-processing","data-mining","robotics","computer-graphics","human-computer-interaction","web-search","signal-processing","representation-learning","reinforcement-learning","optimization-methods","large-language-models","information-retrieval","speech","mathematics"]),Q=e=>e.trim().toLowerCase().replace(/\s+/g,"-"),D=e=>Array.from(new Set((e.tags??[]).map(Q).filter(a=>q.has(a)))),F=e=>new Date(e).toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric"}),I=(e,a)=>{if(!e)return null;const n=new Date(`${e}T00:00:00`),r=a?new Date(`${a}T00:00:00`):null,o=s=>s.toLocaleDateString("en-US",{month:"long",day:"numeric"}),i=n.getFullYear();return r&&r.getTime()!==n.getTime()?n.getMonth()===r.getMonth()?`${o(n).replace(/\d+$/,"").trim()} ${n.getDate()}–${r.getDate()}, ${i}`:`${o(n)} – ${o(r)}, ${i}`:`${o(n)}, ${i}`},M=e=>[...e.deadlines??[]].sort((a,n)=>new Date(a.deadline_at).getTime()-new Date(n.deadline_at).getTime()),T=(e,a)=>M(e).find(n=>new Date(n.deadline_at).getTime()>a)??null,L=e=>{const a=M(e);return a.length?a[a.length-1]:null},J=(e,a)=>{const n=e-a;if(n<=0)return"Deadline passed";const r=Math.floor(n/b);if(r>=1){const s=Math.floor((n-r*b)/36e5);return`in ${r}d ${s}h`}const o=Math.floor(n/(1e3*60*60));return o>=1?`in ${o}h`:`in ${Math.max(1,Math.floor(n/(1e3*60)))}m`},X=(e,a)=>{const n=e-a;if(n<=0)return"Deadline passed";const r=Math.floor(n/b),o=Math.floor(n%b/(1e3*60*60)),i=Math.floor(n%(1e3*60*60)/(1e3*60)),s=Math.floor(n%(1e3*60)/1e3);return`${r}d ${o}h ${i}m ${s}s`},_=(e,a)=>{if(e==null)return S.passed;const n=(e-a)/b;return n<=0?S.passed:n<=7?S.urgent:n<=30?S.soon:S.normal},$={fontFamily:"var(--mono)",fontSize:10,letterSpacing:"0.12em",textTransform:"uppercase",color:"var(--ink-faint)"},Z=(e,a)=>{const n=Math.ceil((e-a)/b);return n<=0?"passed":`${n} ${n===1?"day":"days"}`},R=(e,a)=>{const n=I(e.start_date,e.end_date),r=e.venue||[e.city,e.country].filter(Boolean).join(", ");return[`${a.label||a.type||"Deadline"} for ${e.name}`,n?`Dates: ${n}`:null,r?`Location: ${r}`:null,e.url?`Website: ${e.url}`:null].filter(Boolean).join(`
|
| 2 |
`)},C=e=>e.toISOString().replace(/[-:]/g,"").replace(/\.\d{3}/,""),ee=(e,a)=>{const n=new Date(a.deadline_at),r=new Date(n.getTime()+60*60*1e3),o=`${e.short_name||e.name} ${a.label||a.type||"deadline"}`,i=e.venue||[e.city,e.country].filter(Boolean).join(", "),s=`https://calendar.google.com/calendar/render?action=TEMPLATE&text=${encodeURIComponent(o)}&dates=${C(n)}/${C(r)}&details=${encodeURIComponent(R(e,a))}&location=${encodeURIComponent(i)}`,m=z(s);m&&window.open(m,"_blank","noopener,noreferrer")},te=(e,a)=>{const n=new Date(a.deadline_at),r=new Date(n.getTime()+60*60*1e3),o=`${e.short_name||e.name} ${a.label||a.type||"deadline"}`,i=e.venue||[e.city,e.country].filter(Boolean).join(", "),s=["BEGIN:VCALENDAR","VERSION:2.0","BEGIN:VEVENT",e.url?`URL:${e.url}`:null,`DTSTART:${C(n)}`,`DTEND:${C(r)}`,`SUMMARY:${o}`,`DESCRIPTION:${R(e,a).replace(/\n/g,"\\n")}`,i?`LOCATION:${i}`:null,"END:VEVENT","END:VCALENDAR"].filter(Boolean).join(`
|
| 3 |
`),m=new Blob([s],{type:"text/calendar;charset=utf-8"}),c=document.createElement("a");c.href=URL.createObjectURL(m),c.download=`${(e.short_name||e.name).toLowerCase().replace(/\s+/g,"-")}-deadline.ics`,document.body.appendChild(c),c.click(),document.body.removeChild(c),URL.revokeObjectURL(c.href)},ne=({conf:e,open:a,onOpenChange:n})=>{const[r,o]=x.useState(()=>Date.now());x.useEffect(()=>{if(!a)return;o(Date.now());const d=setInterval(()=>o(Date.now()),1e3);return()=>clearInterval(d)},[a]);const i=x.useMemo(()=>e?M(e):[],[e]),s=x.useMemo(()=>e?T(e,r):null,[e,r]),m=e?I(e.start_date,e.end_date):null,c=e?e.venue||[e.city,e.country].filter(Boolean).join(", ")||e.location:null,u=s?new Date(s.deadline_at).getTime():null;return t.jsx(P,{open:a,onOpenChange:n,children:t.jsx(G,{className:"max-w-xl",style:{background:"var(--bg-elevated)",maxHeight:"85vh",overflowY:"auto"},children:e&&t.jsxs(t.Fragment,{children:[t.jsxs(Y,{children:[t.jsx(H,{asChild:!0,children:t.jsx("h2",{style:{fontFamily:"var(--serif)",fontSize:26,fontWeight:500,letterSpacing:"-0.01em",margin:0},children:e.short_name?`${e.short_name} ${e.year??""}`.trim():e.name})}),e.short_name&&e.name||e.description?t.jsx(K,{asChild:!0,children:t.jsx("span",{style:{fontFamily:"var(--serif)",fontSize:14,color:"var(--ink-soft)"},children:e.short_name?e.name:e.description})}):null]}),t.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:20,marginTop:4},children:[t.jsxs("div",{style:{display:"flex",flexWrap:"wrap",gap:24},children:[m&&t.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:4},children:[t.jsx("span",{style:$,children:"Dates"}),t.jsx("span",{style:{fontFamily:"var(--mono)",fontSize:13,color:"var(--ink-soft)"},children:m})]}),c&&t.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:4},children:[t.jsx("span",{style:$,children:"Venue"}),t.jsx("span",{style:{fontFamily:"var(--mono)",fontSize:13,color:"var(--ink-soft)"},children:c})]})]}),u!=null&&t.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:4,padding:"12px 14px",borderRadius:8,background:"var(--bg-subtle)",border:"1px solid var(--hairline)"},children:[t.jsx("span",{style:$,children:"Next deadline in"}),t.jsx("span",{style:{fontFamily:"var(--mono)",fontSize:22,fontWeight:600,color:_(u,r)},children:X(u,r)})]}),t.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:8},children:[t.jsx("span",{style:$,children:"Important deadlines"}),i.length===0?t.jsx("span",{style:{fontFamily:"var(--mono)",fontSize:13,color:"var(--ink-faint)"},children:"No deadlines listed"}):i.map((d,p)=>{const y=new Date(d.deadline_at).getTime(),l=s!=null&&d.deadline_at===s.deadline_at&&d.type===s.type,h=y<=r;return t.jsxs("div",{style:{display:"flex",alignItems:"baseline",justifyContent:"space-between",gap:12,padding:"8px 12px",borderRadius:6,background:l?"var(--accent-soft)":"transparent",border:l?"1px solid var(--hairline-strong)":"1px solid var(--hairline)",opacity:h&&!l?.55:1},children:[t.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:2},children:[t.jsxs("span",{style:{fontFamily:"var(--mono)",fontSize:13,color:"var(--ink)",fontWeight:l?600:400},children:[d.label||k(d.type||"deadline"),l&&t.jsx("span",{style:{...$,marginLeft:8},children:"Next"})]}),t.jsxs("span",{style:{fontFamily:"var(--mono)",fontSize:12,color:"var(--ink-faint)"},children:[F(d.deadline_at),d.timezone?` · ${d.timezone}`:""]})]}),t.jsx("span",{style:{fontFamily:"var(--mono)",fontSize:12,fontWeight:600,whiteSpace:"nowrap",color:_(h?null:y,r)},children:Z(y,r)})]},`${d.type??"deadline"}-${p}`)})]}),D(e).length>0&&t.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:6},children:D(e).map(d=>t.jsx("span",{className:"tag-chip",style:{background:"var(--bg-subtle)",color:"var(--ink-soft)"},children:k(d)},d))}),t.jsxs("div",{style:{display:"flex",flexWrap:"wrap",alignItems:"center",gap:16,paddingTop:12,borderTop:"1px solid var(--hairline)"},children:[e.url&&t.jsx("a",{href:z(e.url)??void 0,target:"_blank",rel:"noopener noreferrer",style:{fontFamily:"var(--mono)",fontSize:12,color:"var(--accent-text)"},children:"Visit website ↗"}),s&&t.jsxs("div",{style:{display:"flex",gap:12,marginLeft:"auto"},children:[t.jsx("button",{type:"button",className:"tag-chip",onClick:()=>ee(e,s),style:{background:"var(--bg-subtle)",color:"var(--ink-soft)"},children:"+ Google Calendar"}),t.jsx("button",{type:"button",className:"tag-chip",onClick:()=>te(e,s),style:{background:"var(--bg-subtle)",color:"var(--ink-soft)"},children:"+ Apple / .ics"})]})]})]})]})})})},E=({id:e,label:a,checked:n,onChange:r})=>t.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,fontFamily:"var(--mono)",fontSize:12,color:"var(--ink-soft)"},children:[t.jsx(U,{id:e,checked:n,onCheckedChange:r}),t.jsx("label",{htmlFor:e,style:{cursor:"pointer"},children:a})]}),ae=({conf:e,now:a,selectedDomains:n,onToggleDomain:r,onOpen:o})=>{const i=T(e,a),s=i??L(e),m=s?new Date(s.deadline_at).getTime():null,c=_(i?m:null,a),u=I(e.start_date,e.end_date),d=[e.city??null,e.country??null].filter(Boolean).join(", ");return t.jsxs("div",{role:"button",tabIndex:0,onClick:()=>o(e),onKeyDown:p=>{(p.key==="Enter"||p.key===" ")&&(p.preventDefault(),o(e))},style:{border:"1px solid var(--hairline)",borderRadius:8,padding:20,background:"var(--bg-elevated)",display:"flex",flexDirection:"column",gap:12,cursor:"pointer"},children:[t.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"baseline",gap:12},children:[t.jsx("h3",{style:{fontFamily:"var(--serif)",fontSize:20,fontWeight:500,letterSpacing:"-0.01em",margin:0},children:e.short_name?`${e.short_name} ${e.year??""}`.trim():e.name}),e.url&&t.jsx("a",{href:z(e.url)??void 0,target:"_blank",rel:"noopener noreferrer",onClick:p=>p.stopPropagation(),style:{fontFamily:"var(--mono)",fontSize:11,color:"var(--accent-text)",whiteSpace:"nowrap"},children:"website ↗"})]}),t.jsxs("div",{style:{display:"flex",alignItems:"baseline",justifyContent:"space-between",gap:12,paddingBottom:12,borderBottom:"1px solid var(--hairline)"},children:[t.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:2},children:[t.jsx("span",{style:{fontFamily:"var(--mono)",fontSize:11,color:"var(--ink-faint)"},children:(s==null?void 0:s.label)||(s==null?void 0:s.type)||"Deadline"}),t.jsx("span",{style:{fontFamily:"var(--mono)",fontSize:12,color:"var(--ink-soft)"},children:s?`${F(s.deadline_at)}${s.timezone?` · ${s.timezone}`:""}`:"TBD"})]}),t.jsx("span",{style:{fontFamily:"var(--mono)",fontSize:14,fontWeight:600,color:c,whiteSpace:"nowrap"},children:m!=null?J(m,a):"TBD"})]}),t.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:4,fontFamily:"var(--mono)",fontSize:11,color:"var(--ink-faint)"},children:[u&&t.jsx("span",{children:u}),d&&t.jsx("span",{children:d})]}),D(e).length>0&&t.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:6},children:D(e).map(p=>{const y=n.has(p);return t.jsx("button",{className:"tag-chip",onClick:l=>{l.stopPropagation(),r(p)},style:{background:y?"var(--ink)":"var(--bg-subtle)",color:y?"var(--bg)":"var(--ink-soft)"},children:k(p)},p)})})]})},pe=()=>{const[e,a]=x.useState(!0),[n,r]=x.useState(!1),[o,i]=x.useState(new Set),[s,m]=x.useState(null),c=x.useMemo(()=>Date.now(),[]),u=B({queryKey:["conference-deadlines"],queryFn:()=>A.getConferenceDeadlines(),staleTime:10*60*1e3}),d=l=>{i(h=>{const g=new Set(h);return g.has(l)?g.delete(l):g.add(l),g})},p=x.useMemo(()=>{var h;const l=new Map;return(h=u.data)==null||h.results.forEach(g=>{D(g).forEach(j=>l.set(j,(l.get(j)??0)+1))}),Array.from(l.entries()).sort((g,j)=>j[1]-g[1]).map(([g])=>g)},[u.data]),y=x.useMemo(()=>{var j;const h=(((j=u.data)==null?void 0:j.results)??[]).filter(f=>!(e&&f.tier!=="a"||o.size>0&&!D(f).some(v=>o.has(v))||!n&&!T(f,c))),g=f=>{const w=T(f,c);if(w)return{group:0,time:new Date(w.deadline_at).getTime()};const v=L(f);return{group:1,time:-(v?new Date(v.deadline_at).getTime():0)}};return[...h].sort((f,w)=>{const v=g(f),N=g(w);return v.group!==N.group?v.group-N.group:v.time-N.time})},[u.data,e,n,o,c]);return u.error?t.jsx("div",{className:"page",children:t.jsx(O,{variant:"destructive",children:t.jsx(V,{children:"Failed to load conference deadlines. Please try again."})})}):t.jsxs("div",{className:"page",children:[t.jsx("div",{className:"feed-header",children:t.jsxs("div",{children:[t.jsxs("h1",{className:"feed-title",children:["AI Conference ",t.jsx("em",{children:"Deadlines"})]}),t.jsx("div",{className:"feed-subtitle",children:"Upcoming submission deadlines for major AI conferences, counting down."})]})}),t.jsxs("div",{style:{display:"flex",flexWrap:"wrap",alignItems:"center",gap:20,padding:"16px 0",borderBottom:"1px solid var(--hairline)",marginBottom:24},children:[t.jsx(E,{id:"top-tier-only",label:"Top tier only",checked:e,onChange:a}),t.jsx(E,{id:"show-past",label:"Show past conferences",checked:n,onChange:r})]}),p.length>0&&t.jsxs("div",{style:{display:"flex",flexWrap:"wrap",gap:6,marginBottom:24},children:[p.map(l=>{const h=o.has(l);return t.jsx("button",{className:"tag-chip",onClick:()=>d(l),style:{background:h?"var(--ink)":"var(--bg-subtle)",color:h?"var(--bg)":"var(--ink-soft)"},children:k(l)},l)}),o.size>0&&t.jsx("button",{className:"tag-chip",onClick:()=>i(new Set),style:{background:"transparent",color:"var(--ink-faint)"},children:"Clear ✕"})]}),t.jsx("div",{className:"sort-bar",children:t.jsx("div",{className:"results-count",children:u.isLoading?"…":`${y.length} conferences`})}),u.isLoading?t.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(320px, 1fr))",gap:16},children:Array.from({length:6}).map((l,h)=>t.jsx(W,{className:"h-44"},h))}):y.length===0?t.jsxs("div",{className:"no-results",children:["No conferences match these filters",n?".":" — try enabling “Show past conferences”."]}):t.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(320px, 1fr))",gap:16},children:y.map(l=>t.jsx(ae,{conf:l,now:c,selectedDomains:o,onToggleDomain:d,onOpen:m},l.id))}),t.jsx(ne,{conf:s,open:s!==null,onOpenChange:l=>{l||m(null)}})]})};export{pe as default};
|
assets/{AuthorDetailView-6NlwLdzU.js → AuthorDetailView-BpOd7xtA.js}
RENAMED
|
@@ -1 +1 @@
|
|
| 1 |
-
import{f as m,j as e,L as g,c as h}from"./index-
|
|
|
|
| 1 |
+
import{f as m,j as e,L as g,c as h}from"./index-Bthypk3Q.js";import{u as d}from"./useQuery-CEDDm0wh.js";import{S as c}from"./skeleton-BS-Px_iI.js";import x from"./NotFound-D95eYzTU.js";const N=()=>{var l,n,i,o,u;const{authorId:a}=m(),r=d({queryKey:["author",a],queryFn:()=>h.getAuthor(a),enabled:!!a}),t=d({queryKey:["author-papers",a],queryFn:()=>h.getAuthorPapers(a,{page:1,page_size:20}),enabled:!!a});return((l=r.error)==null?void 0:l.status)===404?e.jsx(x,{}):e.jsxs("div",{className:"page",children:[e.jsx("p",{className:"sidebar-label",children:"Author"}),e.jsx("h1",{className:"feed-title",children:((n=r.data)==null?void 0:n.full_name)??e.jsx(c,{className:"h-10 w-64 inline-block"})}),((i=r.data)==null?void 0:i.hf_username)&&e.jsxs("a",{href:`https://huggingface.co/${r.data.hf_username}`,target:"_blank",rel:"noopener noreferrer",children:["@",r.data.hf_username," on Hugging Face"]}),e.jsxs("section",{style:{marginTop:40},"aria-labelledby":"author-papers-heading",children:[e.jsx("h2",{id:"author-papers-heading",children:"Research papers"}),t.isLoading&&e.jsx(c,{className:"h-24 w-full mt-4"}),((o=t.data)==null?void 0:o.results.length)===0&&e.jsx("p",{children:"No public papers are available."}),e.jsx("ol",{className:"paper-list",children:(u=t.data)==null?void 0:u.results.map(s=>{const p=s.source==="external"?String(s.id):s.arxiv_id;return e.jsx("li",{children:e.jsx(g,{to:`/paper/${p}`,children:s.title})},s.id)})})]})]})};export{N as default};
|
assets/{BenchmarkDetailView-bJVNSxf9.js → BenchmarkDetailView-CkFv_YvY.js}
RENAMED
|
@@ -1,2 +1,2 @@
|
|
| 1 |
-
import{u as vt,r as w,j as n,a3 as ne,h as jt,f as _t,a as kt,Z as St,L as me,c as ee}from"./index-NKCYgxaj.js";import{u as te}from"./useQuery--AC_S866.js";import{S as xe}from"./skeleton-z_EQ30hh.js";import{S as Je}from"./switch-xZgfHBoL.js";import{A as Ct,a as Et}from"./alert-DdslWjc3.js";import{L as ye}from"./LatexTitle-BJ-ygzw0.js";import{C as Nt,E as Rt}from"./ExternalSourceEvalBadge-CJOl_gOx.js";import{B as Tt}from"./BenchmarkTrendSparkline-Dd-Foicv.js";import{I as $t}from"./components-DOrpSyhx.js";import{s as Mt}from"./safeExternalHref-CkBrsh84.js";import"./index-D2GWcpHx.js";import"./katex.min-BSBacQyE.js";import"./hover-card-Z7w-9YtT.js";import"./transform-BdA-spBj.js";function Ft(e,t,r){const s=t?(e??[]).filter(c=>c.task_id===t):e??[],a=s.filter(c=>c.is_open===!1),i=a.reduce((c,l)=>c?(l.best_rank??Number.POSITIVE_INFINITY)<(c.best_rank??Number.POSITIVE_INFINITY)?l:c:l,null);return{visible:r?s.filter(c=>c.is_open!==!1):s,hiddenClosed:a,topHiddenClosed:i}}function Ze(e){const t=e.length===7?`${e}-01`:e,r=new Date(t).getTime();return Number.isFinite(r)?r:0}const Ce=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function Ee(e){const t=new Date(e);return{year:t.getFullYear(),month:t.getMonth()}}function Lt(e,t){if(e===t){const{year:u,month:p}=Ee(e);return[{timestamp:new Date(u,p,1).getTime(),key:`${u}-${p}`,label:`${Ce[p]} ${u}`}]}const r=Ee(e),s=Ee(t);if(r.year===s.year){const u=s.month-r.month+1;let p=1;const f=12;u>f&&(p=Math.ceil(u/f));const y=[];for(let x=r.month;x<=s.month;x+=p)y.push({timestamp:new Date(r.year,x,1).getTime(),key:`${r.year}-${x}`,label:u<=3?`${Ce[x]} ${r.year}`:Ce[x]});return y}const a=s.year-r.year+1;let i=1;const c=12;a>c&&(i=Math.ceil(a/c));const l=[];for(let u=r.year;u<=s.year;u+=i)l.push({timestamp:new Date(u,0,1).getTime(),key:String(u),label:String(u)});return l}const It=({points:e,metric:t})=>{const r=vt(),[s,a]=w.useState(null),i=880,c=320,l=60,u=30,p=40,f=50,y=e.map(o=>o.value),x=Math.min(...y),U=Math.max(...y)-x||1,ae=i-l-u,L=c-p-f,$=e.map(o=>Ze(o.date)),z=Math.min(...$),I=Math.max(...$),ie=I-z||1,Y=o=>z===I?l+ae/2:l+(o-z)/ie*ae,G=e.map((o,m)=>{const k=Y(Ze(o.date)),v=(o.value-x)/U,M=p+L*(1-v);return{x:k,y:M,data:o,idx:m}}),N=G.filter(o=>o.data.isSota);let O="";if(N.length>=2){O=`M${N[0].x},${N[0].y}`;for(let o=1;o<N.length;o++){const m=N[o-1],k=N[o],v=(m.x+k.x)/2;O+=` C${v},${m.y} ${v},${k.y} ${k.x},${k.y}`}}const H=5.4,fe=8,J=9,A=o=>{const m=o.data.modelName||o.data.paperTitle||"";if(!m)return null;const k=m.length>22?m.slice(0,21)+"…":m,v=k.length*H;let M=o.x-v/2,C=o.x+v/2,V="middle";return M<l?(M=l,C=l+v,V="start"):C>i-u&&(C=i-u,M=C-v,V="end"),{x:V==="start"?l:V==="end"?i-u:o.x,y:o.y-J,text:k,anchor:V,left:M,right:C}},ce=[],b=N.length>0?A(N[N.length-1]):null;let _e=-1/0;for(let o=0;o<N.length-1;o++){const m=A(N[o]);m&&(m.left<_e+fe||b&&m.right>b.left-fe||(_e=m.right,ce.push({x:m.x,y:m.y,text:m.text,anchor:m.anchor})))}b&&ce.push({x:b.x,y:b.y,text:b.text,anchor:b.anchor});const K=Lt(z,I),W=5,le=o=>a(m=>m===o?null:m),oe=o=>{o&&r(`/paper/${o}`)},pe=(o,m)=>{const v=`${o.data.modelName||o.data.paperTitle||"Unknown model"}: ${ne(o.data.value)} on ${o.data.dateLabel}`,M=!!o.data.paperRouteId;return n.jsxs("g",{children:[m,n.jsx("circle",{cx:o.x,cy:o.y,r:"10",fill:"transparent",style:{cursor:M?"pointer":"default",outline:"none"},tabIndex:0,role:M?"link":"img","aria-label":v,onMouseEnter:()=>a(o.idx),onMouseLeave:()=>le(o.idx),onFocus:()=>a(o.idx),onBlur:()=>le(o.idx),onClick:()=>oe(o.data.paperRouteId),onKeyDown:C=>{M&&(C.key==="Enter"||C.key===" ")&&(C.preventDefault(),oe(o.data.paperRouteId))},children:n.jsx("title",{children:v})})]},o.idx)};return n.jsxs("svg",{width:"100%",viewBox:`0 0 ${i} ${c}`,style:{display:"block"},children:[n.jsx("text",{x:l-38,y:p+L/2,fontSize:"11",fontFamily:"var(--mono)",fill:"var(--ink-faint)",textAnchor:"middle",transform:`rotate(-90 ${l-38} ${p+L/2})`,children:t}),Array.from({length:W}).map((o,m)=>{const k=m/(W-1),v=p+L*(1-k),M=x+U*k;return n.jsxs("g",{children:[n.jsx("line",{x1:l,y1:v,x2:i-u,y2:v,stroke:"var(--hairline)",strokeWidth:"1"}),n.jsx("text",{x:l-10,y:v+4,fontSize:"11",fontFamily:"var(--mono)",fill:"var(--ink-faint)",textAnchor:"end",children:ne(M)})]},m)}),K.map(o=>{const m=Y(o.timestamp);return n.jsx("text",{x:m,y:c-f+18,fontSize:"11",fontFamily:"var(--mono)",fill:"var(--ink-soft)",textAnchor:"middle",children:o.label},o.key)}),G.filter(o=>!o.data.isSota).map(o=>{const m=s===o.idx;return pe(o,n.jsx("circle",{cx:o.x,cy:o.y,r:m?3:2,fill:"var(--ink-faint)",opacity:m?1:.45,style:{transition:"r 0.12s ease, opacity 0.12s ease"}}))}),O&&n.jsx("path",{d:O,stroke:"var(--accent)",strokeWidth:"2",fill:"none",strokeLinejoin:"round",strokeLinecap:"round"}),N.map(o=>{const m=s===o.idx;return pe(o,n.jsx("circle",{cx:o.x,cy:o.y,r:m?4.5:3,fill:m?"var(--accent)":"var(--bg-elevated)",stroke:"var(--accent)",strokeWidth:"1.5",style:{transition:"r 0.12s ease, fill 0.12s ease"}}))}),ce.map((o,m)=>n.jsx("text",{x:o.x,y:o.y,fontSize:"9.5",fontFamily:"var(--mono)",fill:"var(--ink-soft)",textAnchor:o.anchor,pointerEvents:"none",style:{paintOrder:"stroke",stroke:"var(--bg-elevated)",strokeWidth:3,strokeLinejoin:"round"},children:o.text},`label-${m}`)),s!==null&&G[s]&&(()=>{const o=G[s],m=o.data.modelName||o.data.paperTitle||"Unknown model",v=`${m.length>40?m.slice(0,39)+"…":m}: ${ne(o.data.value)}`,C=Math.max(120,Math.min(340,v.length*6.6+24)),V=30;let B=o.x-C/2;B<l&&(B=l),B+C>i-u&&(B=i-u-C);const Q=o.y-V-14>=p?o.y-V-12:o.y+12;return n.jsxs("g",{pointerEvents:"none",children:[n.jsx("rect",{x:B,y:Q,width:C,height:V,rx:"6",ry:"6",fill:"var(--bg-elevated)",stroke:"var(--hairline-strong)",strokeWidth:"1",style:{filter:"drop-shadow(0 2px 6px rgba(0,0,0,0.08))"}}),n.jsx("text",{x:B+12,y:Q+19,fontSize:"12",fontFamily:"var(--sans)",fill:"var(--ink)",fontWeight:500,children:v})]})})()]})};function Pt(e,t){if(e.match(/^[a-z]+:\/\//i))return e;if(e.match(/^\/\//))return window.location.protocol+e;if(e.match(/^[a-z]+:/i))return e;const r=document.implementation.createHTMLDocument(),s=r.createElement("base"),a=r.createElement("a");return r.head.appendChild(s),r.body.appendChild(a),t&&(s.href=t),a.href=e,a.href}const At=(()=>{let e=0;const t=()=>`0000${(Math.random()*36**4<<0).toString(36)}`.slice(-4);return()=>(e+=1,`u${t()}${e}`)})();function q(e){const t=[];for(let r=0,s=e.length;r<s;r++)t.push(e[r]);return t}let re=null;function dt(e={}){return re||(e.includeStyleProperties?(re=e.includeStyleProperties,re):(re=q(window.getComputedStyle(document.documentElement)),re))}function we(e,t){const s=(e.ownerDocument.defaultView||window).getComputedStyle(e).getPropertyValue(t);return s?parseFloat(s.replace("px","")):0}function Dt(e){const t=we(e,"border-left-width"),r=we(e,"border-right-width");return e.clientWidth+t+r}function Bt(e){const t=we(e,"border-top-width"),r=we(e,"border-bottom-width");return e.clientHeight+t+r}function ut(e,t={}){const r=t.width||Dt(e),s=t.height||Bt(e);return{width:r,height:s}}function Ht(){let e,t;try{t=process}catch{}const r=t&&t.env?t.env.devicePixelRatio:null;return r&&(e=parseInt(r,10),Number.isNaN(e)&&(e=1)),e||window.devicePixelRatio||1}const D=16384;function Vt(e){(e.width>D||e.height>D)&&(e.width>D&&e.height>D?e.width>e.height?(e.height*=D/e.width,e.width=D):(e.width*=D/e.height,e.height=D):e.width>D?(e.height*=D/e.width,e.width=D):(e.width*=D/e.height,e.height=D))}function Ot(e,t={}){return e.toBlob?new Promise(r=>{e.toBlob(r,t.type?t.type:"image/png",t.quality?t.quality:1)}):new Promise(r=>{const s=window.atob(e.toDataURL(t.type?t.type:void 0,t.quality?t.quality:void 0).split(",")[1]),a=s.length,i=new Uint8Array(a);for(let c=0;c<a;c+=1)i[c]=s.charCodeAt(c);r(new Blob([i],{type:t.type?t.type:"image/png"}))})}function ve(e){return new Promise((t,r)=>{const s=new Image;s.onload=()=>{s.decode().then(()=>{requestAnimationFrame(()=>t(s))})},s.onerror=r,s.crossOrigin="anonymous",s.decoding="async",s.src=e})}async function Ut(e){return Promise.resolve().then(()=>new XMLSerializer().serializeToString(e)).then(encodeURIComponent).then(t=>`data:image/svg+xml;charset=utf-8,${t}`)}async function Wt(e,t,r){const s="http://www.w3.org/2000/svg",a=document.createElementNS(s,"svg"),i=document.createElementNS(s,"foreignObject");return a.setAttribute("width",`${t}`),a.setAttribute("height",`${r}`),a.setAttribute("viewBox",`0 0 ${t} ${r}`),i.setAttribute("width","100%"),i.setAttribute("height","100%"),i.setAttribute("x","0"),i.setAttribute("y","0"),i.setAttribute("externalResourcesRequired","true"),a.appendChild(i),i.appendChild(e),Ut(a)}const P=(e,t)=>{if(e instanceof t)return!0;const r=Object.getPrototypeOf(e);return r===null?!1:r.constructor.name===t.name||P(r,t)};function qt(e){const t=e.getPropertyValue("content");return`${e.cssText} content: '${t.replace(/'|"/g,"")}';`}function zt(e,t){return dt(t).map(r=>{const s=e.getPropertyValue(r),a=e.getPropertyPriority(r);return`${r}: ${s}${a?" !important":""};`}).join(" ")}function Gt(e,t,r,s){const a=`.${e}:${t}`,i=r.cssText?qt(r):zt(r,s);return document.createTextNode(`${a}{${i}}`)}function et(e,t,r,s){const a=window.getComputedStyle(e,r),i=a.getPropertyValue("content");if(i===""||i==="none")return;const c=At();try{t.className=`${t.className} ${c}`}catch{return}const l=document.createElement("style");l.appendChild(Gt(c,r,a,s)),t.appendChild(l)}function Kt(e,t,r){et(e,t,":before",r),et(e,t,":after",r)}const tt="application/font-woff",rt="image/jpeg",Qt={woff:tt,woff2:tt,ttf:"application/font-truetype",eot:"application/vnd.ms-fontobject",png:"image/png",jpg:rt,jpeg:rt,gif:"image/gif",tiff:"image/tiff",svg:"image/svg+xml",webp:"image/webp"};function Xt(e){const t=/\.([^./]*?)$/g.exec(e);return t?t[1]:""}function $e(e){const t=Xt(e).toLowerCase();return Qt[t]||""}function Yt(e){return e.split(/,/)[1]}function Re(e){return e.search(/^(data:)/)!==-1}function Jt(e,t){return`data:${t};base64,${e}`}async function mt(e,t,r){const s=await fetch(e,t);if(s.status===404)throw new Error(`Resource "${s.url}" not found`);const a=await s.blob();return new Promise((i,c)=>{const l=new FileReader;l.onerror=c,l.onloadend=()=>{try{i(r({res:s,result:l.result}))}catch(u){c(u)}},l.readAsDataURL(a)})}const Ne={};function Zt(e,t,r){let s=e.replace(/\?.*/,"");return r&&(s=e),/ttf|otf|eot|woff2?/i.test(s)&&(s=s.replace(/.*\//,"")),t?`[${t}]${s}`:s}async function Me(e,t,r){const s=Zt(e,t,r.includeQueryParams);if(Ne[s]!=null)return Ne[s];r.cacheBust&&(e+=(/\?/.test(e)?"&":"?")+new Date().getTime());let a;try{const i=await mt(e,r.fetchRequestInit,({res:c,result:l})=>(t||(t=c.headers.get("Content-Type")||""),Yt(l)));a=Jt(i,t)}catch(i){a=r.imagePlaceholder||"";let c=`Failed to fetch resource: ${e}`;i&&(c=typeof i=="string"?i:i.message),c&&console.warn(c)}return Ne[s]=a,a}async function er(e){const t=e.toDataURL();return t==="data:,"?e.cloneNode(!1):ve(t)}async function tr(e,t){if(e.currentSrc){const i=document.createElement("canvas"),c=i.getContext("2d");i.width=e.clientWidth,i.height=e.clientHeight,c==null||c.drawImage(e,0,0,i.width,i.height);const l=i.toDataURL();return ve(l)}const r=e.poster,s=$e(r),a=await Me(r,s,t);return ve(a)}async function rr(e,t){var r;try{if(!((r=e==null?void 0:e.contentDocument)===null||r===void 0)&&r.body)return await je(e.contentDocument.body,t,!0)}catch{}return e.cloneNode(!1)}async function sr(e,t){return P(e,HTMLCanvasElement)?er(e):P(e,HTMLVideoElement)?tr(e,t):P(e,HTMLIFrameElement)?rr(e,t):e.cloneNode(ht(e))}const nr=e=>e.tagName!=null&&e.tagName.toUpperCase()==="SLOT",ht=e=>e.tagName!=null&&e.tagName.toUpperCase()==="SVG";async function ar(e,t,r){var s,a;if(ht(t))return t;let i=[];return nr(e)&&e.assignedNodes?i=q(e.assignedNodes()):P(e,HTMLIFrameElement)&&(!((s=e.contentDocument)===null||s===void 0)&&s.body)?i=q(e.contentDocument.body.childNodes):i=q(((a=e.shadowRoot)!==null&&a!==void 0?a:e).childNodes),i.length===0||P(e,HTMLVideoElement)||await i.reduce((c,l)=>c.then(()=>je(l,r)).then(u=>{u&&t.appendChild(u)}),Promise.resolve()),t}function ir(e,t,r){const s=t.style;if(!s)return;const a=window.getComputedStyle(e);a.cssText?(s.cssText=a.cssText,s.transformOrigin=a.transformOrigin):dt(r).forEach(i=>{let c=a.getPropertyValue(i);i==="font-size"&&c.endsWith("px")&&(c=`${Math.floor(parseFloat(c.substring(0,c.length-2)))-.1}px`),P(e,HTMLIFrameElement)&&i==="display"&&c==="inline"&&(c="block"),i==="d"&&t.getAttribute("d")&&(c=`path(${t.getAttribute("d")})`),s.setProperty(i,c,a.getPropertyPriority(i))})}function cr(e,t){P(e,HTMLTextAreaElement)&&(t.innerHTML=e.value),P(e,HTMLInputElement)&&t.setAttribute("value",e.value)}function lr(e,t){if(P(e,HTMLSelectElement)){const r=t,s=Array.from(r.children).find(a=>e.value===a.getAttribute("value"));s&&s.setAttribute("selected","")}}function or(e,t,r){return P(t,Element)&&(ir(e,t,r),Kt(e,t,r),cr(e,t),lr(e,t)),t}async function dr(e,t){const r=e.querySelectorAll?e.querySelectorAll("use"):[];if(r.length===0)return e;const s={};for(let i=0;i<r.length;i++){const l=r[i].getAttribute("xlink:href");if(l){const u=e.querySelector(l),p=document.querySelector(l);!u&&p&&!s[l]&&(s[l]=await je(p,t,!0))}}const a=Object.values(s);if(a.length){const i="http://www.w3.org/1999/xhtml",c=document.createElementNS(i,"svg");c.setAttribute("xmlns",i),c.style.position="absolute",c.style.width="0",c.style.height="0",c.style.overflow="hidden",c.style.display="none";const l=document.createElementNS(i,"defs");c.appendChild(l);for(let u=0;u<a.length;u++)l.appendChild(a[u]);e.appendChild(c)}return e}async function je(e,t,r){return!r&&t.filter&&!t.filter(e)?null:Promise.resolve(e).then(s=>sr(s,t)).then(s=>ar(e,s,t)).then(s=>or(e,s,t)).then(s=>dr(s,t))}const ft=/url\((['"]?)([^'"]+?)\1\)/g,ur=/url\([^)]+\)\s*format\((["']?)([^"']+)\1\)/g,mr=/src:\s*(?:url\([^)]+\)\s*format\([^)]+\)[,;]\s*)+/g;function hr(e){const t=e.replace(/([.*+?^${}()|\[\]\/\\])/g,"\\$1");return new RegExp(`(url\\(['"]?)(${t})(['"]?\\))`,"g")}function fr(e){const t=[];return e.replace(ft,(r,s,a)=>(t.push(a),r)),t.filter(r=>!Re(r))}async function pr(e,t,r,s,a){try{const i=r?Pt(t,r):t,c=$e(t);let l;return a||(l=await Me(i,c,s)),e.replace(hr(t),`$1${l}$3`)}catch{}return e}function gr(e,{preferredFontFormat:t}){return t?e.replace(mr,r=>{for(;;){const[s,,a]=ur.exec(r)||[];if(!a)return"";if(a===t)return`src: ${s};`}}):e}function pt(e){return e.search(ft)!==-1}async function gt(e,t,r){if(!pt(e))return e;const s=gr(e,r);return fr(s).reduce((i,c)=>i.then(l=>pr(l,c,t,r)),Promise.resolve(s))}async function se(e,t,r){var s;const a=(s=t.style)===null||s===void 0?void 0:s.getPropertyValue(e);if(a){const i=await gt(a,null,r);return t.style.setProperty(e,i,t.style.getPropertyPriority(e)),!0}return!1}async function xr(e,t){await se("background",e,t)||await se("background-image",e,t),await se("mask",e,t)||await se("-webkit-mask",e,t)||await se("mask-image",e,t)||await se("-webkit-mask-image",e,t)}async function br(e,t){const r=P(e,HTMLImageElement);if(!(r&&!Re(e.src))&&!(P(e,SVGImageElement)&&!Re(e.href.baseVal)))return;const s=r?e.src:e.href.baseVal,a=await Me(s,$e(s),t);await new Promise((i,c)=>{e.onload=i,e.onerror=t.onImageErrorHandler?(...u)=>{try{i(t.onImageErrorHandler(...u))}catch(p){c(p)}}:c;const l=e;l.decode&&(l.decode=i),l.loading==="lazy"&&(l.loading="eager"),r?(e.srcset="",e.src=a):e.href.baseVal=a})}async function yr(e,t){const s=q(e.childNodes).map(a=>xt(a,t));await Promise.all(s).then(()=>e)}async function xt(e,t){P(e,Element)&&(await xr(e,t),await br(e,t),await yr(e,t))}function wr(e,t){const{style:r}=e;t.backgroundColor&&(r.backgroundColor=t.backgroundColor),t.width&&(r.width=`${t.width}px`),t.height&&(r.height=`${t.height}px`);const s=t.style;return s!=null&&Object.keys(s).forEach(a=>{r[a]=s[a]}),e}const st={};async function nt(e){let t=st[e];if(t!=null)return t;const s=await(await fetch(e)).text();return t={url:e,cssText:s},st[e]=t,t}async function at(e,t){let r=e.cssText;const s=/url\(["']?([^"')]+)["']?\)/g,i=(r.match(/url\([^)]+\)/g)||[]).map(async c=>{let l=c.replace(s,"$1");return l.startsWith("https://")||(l=new URL(l,e.url).href),mt(l,t.fetchRequestInit,({result:u})=>(r=r.replace(c,`url(${u})`),[c,u]))});return Promise.all(i).then(()=>r)}function it(e){if(e==null)return[];const t=[],r=/(\/\*[\s\S]*?\*\/)/gi;let s=e.replace(r,"");const a=new RegExp("((@.*?keyframes [\\s\\S]*?){([\\s\\S]*?}\\s*?)})","gi");for(;;){const u=a.exec(s);if(u===null)break;t.push(u[0])}s=s.replace(a,"");const i=/@import[\s\S]*?url\([^)]*\)[\s\S]*?;/gi,c="((\\s*?(?:\\/\\*[\\s\\S]*?\\*\\/)?\\s*?@media[\\s\\S]*?){([\\s\\S]*?)}\\s*?})|(([\\s\\S]*?){([\\s\\S]*?)})",l=new RegExp(c,"gi");for(;;){let u=i.exec(s);if(u===null){if(u=l.exec(s),u===null)break;i.lastIndex=l.lastIndex}else l.lastIndex=i.lastIndex;t.push(u[0])}return t}async function vr(e,t){const r=[],s=[];return e.forEach(a=>{if("cssRules"in a)try{q(a.cssRules||[]).forEach((i,c)=>{if(i.type===CSSRule.IMPORT_RULE){let l=c+1;const u=i.href,p=nt(u).then(f=>at(f,t)).then(f=>it(f).forEach(y=>{try{a.insertRule(y,y.startsWith("@import")?l+=1:a.cssRules.length)}catch(x){console.error("Error inserting rule from remote css",{rule:y,error:x})}})).catch(f=>{console.error("Error loading remote css",f.toString())});s.push(p)}})}catch(i){const c=e.find(l=>l.href==null)||document.styleSheets[0];a.href!=null&&s.push(nt(a.href).then(l=>at(l,t)).then(l=>it(l).forEach(u=>{c.insertRule(u,c.cssRules.length)})).catch(l=>{console.error("Error loading remote stylesheet",l)})),console.error("Error inlining remote css file",i)}}),Promise.all(s).then(()=>(e.forEach(a=>{if("cssRules"in a)try{q(a.cssRules||[]).forEach(i=>{r.push(i)})}catch(i){console.error(`Error while reading CSS rules from ${a.href}`,i)}}),r))}function jr(e){return e.filter(t=>t.type===CSSRule.FONT_FACE_RULE).filter(t=>pt(t.style.getPropertyValue("src")))}async function _r(e,t){if(e.ownerDocument==null)throw new Error("Provided element is not within a Document");const r=q(e.ownerDocument.styleSheets),s=await vr(r,t);return jr(s)}function bt(e){return e.trim().replace(/["']/g,"")}function kr(e){const t=new Set;function r(s){(s.style.fontFamily||getComputedStyle(s).fontFamily).split(",").forEach(i=>{t.add(bt(i))}),Array.from(s.children).forEach(i=>{i instanceof HTMLElement&&r(i)})}return r(e),t}async function Sr(e,t){const r=await _r(e,t),s=kr(e);return(await Promise.all(r.filter(i=>s.has(bt(i.style.fontFamily))).map(i=>{const c=i.parentStyleSheet?i.parentStyleSheet.href:null;return gt(i.cssText,c,t)}))).join(`
|
| 2 |
`)}async function Cr(e,t){const r=t.fontEmbedCSS!=null?t.fontEmbedCSS:t.skipFonts?null:await Sr(e,t);if(r){const s=document.createElement("style"),a=document.createTextNode(r);s.appendChild(a),e.firstChild?e.insertBefore(s,e.firstChild):e.appendChild(s)}}async function Er(e,t={}){const{width:r,height:s}=ut(e,t),a=await je(e,t,!0);return await Cr(a,t),await xt(a,t),wr(a,t),await Wt(a,r,s)}async function Nr(e,t={}){const{width:r,height:s}=ut(e,t),a=await Er(e,t),i=await ve(a),c=document.createElement("canvas"),l=c.getContext("2d"),u=t.pixelRatio||Ht(),p=t.canvasWidth||r,f=t.canvasHeight||s;return c.width=p*u,c.height=f*u,t.skipAutoScale||Vt(c),c.style.width=`${p}`,c.style.height=`${f}`,t.backgroundColor&&(l.fillStyle=t.backgroundColor,l.fillRect(0,0,c.width,c.height)),l.drawImage(i,0,0,c.width,c.height),c}async function Rr(e,t={}){const r=await Nr(e,t);return await Ot(r)}const Te="#ffffff";function Tr(){return typeof window>"u"?Te:window.getComputedStyle(document.documentElement).getPropertyValue("--bg-elevated").trim()||Te}function $r(e){if(typeof window>"u")return Te;const t=window.getComputedStyle(e).backgroundColor;return!t||t==="rgba(0, 0, 0, 0)"||t==="transparent"?Tr():t}async function Mr(e){var r,s;if(typeof window>"u"||!((s=(r=window.navigator)==null?void 0:r.clipboard)!=null&&s.write))throw new Error("Clipboard image copy is not supported in this browser.");if(typeof window.ClipboardItem>"u")throw new Error("Clipboard image copy is not supported in this browser.");const t=await Rr(e,{pixelRatio:2,cacheBust:!0,backgroundColor:$r(e)});if(!t)throw new Error("Failed to render screenshot.");await window.navigator.clipboard.write([new window.ClipboardItem({"image/png":t})])}const ct=({targetRef:e,label:t})=>{const{toast:r}=jt(),[s,a]=w.useState("idle"),i=w.useRef(null);w.useEffect(()=>()=>{i.current!==null&&window.clearTimeout(i.current)},[]);const c=w.useCallback(async()=>{const u=e.current;if(u){a("copying"),u.classList.add("is-capturing"),u.offsetHeight,await new Promise(p=>window.requestAnimationFrame(()=>p()));try{await Mr(u),a("copied"),r({title:"Screenshot copied",description:`Image of the ${t} copied to your clipboard.`}),i.current!==null&&window.clearTimeout(i.current),i.current=window.setTimeout(()=>a("idle"),1500)}catch(p){a("idle"),r({title:"Copy failed",description:p instanceof Error&&p.message?p.message:"Could not copy the screenshot to your clipboard.",variant:"destructive"})}finally{u.classList.remove("is-capturing")}}},[e,t,r]),l=s==="copied"?"Copied":s==="copying"?"Copying…":"Copy image";return n.jsxs("button",{type:"button",className:"bm-copy-btn",onClick:c,disabled:s==="copying","aria-label":`Copy ${t} screenshot to clipboard`,title:`Copy ${t} screenshot to clipboard`,children:[n.jsx($t,{name:"copy",size:11}),l]})};function he(e){if(e==null)return null;if(typeof e=="number")return Number.isFinite(e)?e:null;const t=e.includes("±")?e.split("±")[0].trim():e.trim(),r=parseFloat(t);return Number.isFinite(r)?r:null}function Fr(e){return[e.paper_id,e.task_id,e.dataset_id,e.model_name,e.harness??""].join("|")}function Lr(e){const t=new Map;for(const r of e){const s=Fr(r),a=t.get(s);if(!a){t.set(s,{...r,metrics:{...r.metrics||{}},sourceEvaluationIds:[r.id],ranksByMetric:r.best_metric&&r.best_rank!=null?{[r.best_metric]:r.best_rank}:{}});continue}a.metrics={...a.metrics,...r.metrics||{}},a.sourceEvaluationIds.push(r.id),r.best_metric&&r.best_rank!=null&&(a.ranksByMetric[r.best_metric]=r.best_rank)}return Array.from(t.values())}function lt(e,t){return t?e.id===t||e.sourceEvaluationIds.includes(t):!1}function ot(e,t){return e.ranksByMetric[t]??e.best_rank??9999}function Ir(e,t,r){if(e.length===0)return{points:[],sota:0,sotaModel:""};const s=e.map(f=>{var E;const y=he((E=f.metrics)==null?void 0:E[t]),x=f.paper_published_date||"";return{eval:f,value:y,date:x}}).filter(f=>f.value!==null&&!!f.date).sort((f,y)=>f.date.localeCompare(y.date)),a=[];let i=null;for(const f of s){const y=i==null?!0:r==="↓"?f.value<i:f.value>i;y&&(i=f.value),a.push({value:f.value,date:f.date,dateLabel:f.date.slice(0,7),modelName:f.eval.model_name||"",paperTitle:f.eval.paper_title||"",paperRouteId:f.eval.paper_arxiv_id||f.eval.paper_id||null,isSota:y})}const l=e.map(f=>{var y;return{eval:f,value:he((y=f.metrics)==null?void 0:y[t])}}).filter(f=>f.value!==null).sort((f,y)=>r==="↓"?f.value-y.value:y.value-f.value)[0],u=(l==null?void 0:l.value)??0,p=(l==null?void 0:l.eval.model_name)||(l==null?void 0:l.eval.paper_title)||"";return{points:a,sota:u,sotaModel:p}}const Pr=5;function Ar(e){if(!e)return null;const t=e.trim(),r=t.match(/^https?:\/\/(?:www\.)?arxiv\.org\/(?:abs|pdf)\/([^/?#]+)/i);if(r!=null&&r[1])return r[1].replace(/\.pdf$/i,"");const s=t.match(/^(?:https?:\/\/(?:www\.)?paperswithcode\.co)?\/paper\/([^/?#]+)/i);return(s==null?void 0:s[1])??null}function be(e,t){return e?n.jsx(ye,{title:e}):t||"—"}const Jr=()=>{var Le,Ie,Pe,Ae,De,Be,He,Ve,Oe,Ue,We,qe,ze;const{datasetSlug:e}=_t(),[t]=kt(),r=t.get("task")||void 0,s=t.get("eval")||void 0,{preferences:a,setHideClosedSourceEvals:i}=St(),[c,l]=w.useState(void 0),u=w.useRef(null),p=w.useRef(!1),f=w.useRef(null),y=w.useRef(null),x=te({queryKey:["dataset",e,"with-paper",r,a.hide_closed_source_evals?"open":"all"],queryFn:()=>ee.getDatasetBySlug(e,{include_paper:!0,task:r,is_open:a.hide_closed_source_evals?!0:void 0}),enabled:!!e,staleTime:10*60*1e3}),E=te({queryKey:["dataset-evals",(Le=x.data)==null?void 0:Le.id],queryFn:()=>ee.getEvaluationsByDataset(x.data.id),enabled:!!((Ie=x.data)!=null&&Ie.id),staleTime:5*60*1e3}),U=te({queryKey:["dataset-tasks",(Pe=x.data)==null?void 0:Pe.id],queryFn:()=>ee.getDatasetTasks(x.data.id),enabled:!!((Ae=x.data)!=null&&Ae.id),staleTime:10*60*1e3}),ae=te({queryKey:["metric-directions"],queryFn:()=>ee.getMetricDirections(),staleTime:60*60*1e3}),L=w.useMemo(()=>{var d;return!s||!((d=E.data)!=null&&d.length)?null:E.data.find(g=>g.id===s)||null},[s,E.data]),$=w.useMemo(()=>{const d=U.data||[];if(d.length===0)return null;if(L!=null&&L.task_id&&d.some(h=>h.id===L.task_id))return L.task_id;if(r){const h=d.find(S=>S.slug===r);if(h)return h.id}if(d.length===1)return d[0].id;const g=E.data||[];if(g.length>0){const h=new Map;for(const j of g)h.set(j.task_id,(h.get(j.task_id)||0)+1);let S=null,T=-1;for(const j of d){const ue=h.get(j.id)||0;ue>T&&(T=ue,S=j.id)}if(S)return S}return d[0].id},[U.data,E.data,r,L]),z=te({queryKey:["task-benchmark-trends",$,a.hide_closed_source_evals?!0:void 0],queryFn:()=>ee.getTrendingBenchmarks($,{limit:100,min_recent_papers:0,is_open:a.hide_closed_source_evals?!0:void 0}),enabled:!!$&&!!((De=x.data)!=null&&De.id),staleTime:10*60*1e3}),I=w.useMemo(()=>{var d;return(((d=z.data)==null?void 0:d.results)||[]).find(g=>{var h;return g.id===((h=x.data)==null?void 0:h.id)})||null},[z.data,(Be=x.data)==null?void 0:Be.id]),ie=te({queryKey:["leaderboard-metrics",(He=x.data)==null?void 0:He.id,$],queryFn:()=>ee.getLeaderboardMetrics(x.data.id,$),enabled:!!((Ve=x.data)!=null&&Ve.id)&&!!$,staleTime:10*60*1e3}),Y=w.useMemo(()=>Ft(E.data,$,a.hide_closed_source_evals),[E.data,$,a.hide_closed_source_evals]),G=Y.visible,N=Y.hiddenClosed,O=Y.topHiddenClosed,H=w.useMemo(()=>Lr(G),[G]),fe=w.useMemo(()=>{const d=new Set;return H.forEach(g=>{g.best_metric&&d.add(g.best_metric),Object.keys(g.metrics||{}).forEach(h=>d.add(h))}),Array.from(d)},[H]),J=w.useMemo(()=>(ie.data||[]).map(d=>d.metric_name),[ie.data]),A=J.length?J:fe,ce=w.useMemo(()=>{var S;if(H.length===0)return A[0]||"";const d=new Map;for(const T of H)for(const j of Object.keys(T.metrics||{}))J.length&&!A.includes(j)||d.set(j,(d.get(j)||0)+1);let g=null,h=0;for(const[T,j]of d)j>h&&(h=j,g=T);return g||A[0]||((S=H[0])==null?void 0:S.best_metric)||""},[H,A,J]),b=c||(L==null?void 0:L.best_metric)||ce,K=(((Ue=(Oe=ae.data)==null?void 0:Oe.directions)==null?void 0:Ue[b])||"higher_is_better")==="lower_is_better"?"↓":"↑",W=w.useMemo(()=>!b||!A.includes(b)?A:[b,...A.filter(d=>d!==b)],[A,b]),le=w.useMemo(()=>W.length===0?b?[b]:[]:W.slice(0,Pr),[W,b]),{points:oe,sota:pe,sotaModel:o}=w.useMemo(()=>Ir(H,b,K),[H,b,K]),m=(We=x.data)==null?void 0:We.leaderboard_summary,k=E.isSuccess&&U.isSuccess&&ae.isSuccess&&(!$||ie.isSuccess),v=k?b:m==null?void 0:m.metric,M=k?pe:m==null?void 0:m.value,C=k?o:m==null?void 0:m.model_name,V=!k&&!m;w.useEffect(()=>{if(p.current||!s||!E.data||E.data.length===0)return;const d=u.current;d&&(p.current=!0,d.scrollIntoView({behavior:"smooth",block:"start"}))},[s,E.data]);const B=w.useMemo(()=>{const d=U.data||[];return $?d.find(g=>g.id===$)||d[0]||null:d[0]||null},[U.data,$]);if(x.isLoading)return n.jsxs("div",{className:"page",children:[n.jsx(xe,{className:"h-12 w-1/2 mb-6"}),n.jsx(xe,{className:"h-64 w-full"})]});if(x.error||!x.data)return n.jsx("div",{className:"page",children:n.jsx(Ct,{variant:"destructive",children:n.jsx(Et,{children:"Benchmark not found."})})});const _=x.data,Q=H.slice().sort((d,g)=>{var T,j;const h=he((T=d.metrics)==null?void 0:T[b]),S=he((j=g.metrics)==null?void 0:j[b]);return h!==null&&S!==null?K==="↓"?h-S:S-h:h!==null?-1:S!==null?1:ot(d,b)-ot(g,b)}),Fe=!!_.supports_harness,R=s&&Q.find(d=>lt(d,s))||null,F=_.introducing_paper??void 0,de=(F==null?void 0:F.arxiv_id)||(F==null?void 0:F.id)||Ar(_.paper_url),X=(F==null?void 0:F.title)||_.introducing_paper_title||null,Z=((qe=F==null?void 0:F.published)==null?void 0:qe.slice(0,4))||_.introduced_year||null,yt=!!de||!!_.paper_url||!!X,wt=F!=null&&F.arxiv_id||(ze=_.paper_url)!=null&&ze.match(/^https?:\/\/(?:www\.)?arxiv\.org\//i)?`arXiv:${de}`:`Paper ${de}`;return n.jsx("div",{className:"page",children:n.jsxs("div",{className:"bm-page",children:[n.jsxs("div",{className:"breadcrumb",children:[n.jsx(me,{to:"/tasks",children:"Tasks"}),B&&n.jsxs(n.Fragment,{children:[n.jsx("span",{className:"sep",children:"/"}),n.jsx(me,{to:`/tasks/${B.slug||B.id}`,children:B.name})]}),n.jsx("span",{className:"sep",children:"/"}),n.jsx("span",{style:{color:"var(--accent-text)"},children:_.name})]}),n.jsxs("div",{className:"bm-title-row",children:[n.jsx("h1",{className:"bm-title",children:_.name}),I&&n.jsxs("div",{className:"bm-title-trend","aria-label":`${_.name} reporting trend`,children:[n.jsx(Tt,{history:I.history,benchmarkName:I.name}),n.jsxs("span",{className:"bm-title-trend-summary",children:[n.jsx("strong",{children:I.recent_paper_count})," ",I.recent_paper_count===1?"paper":"papers",I.rate_change==null?I.recent_paper_count>0&&n.jsx("span",{className:"benchmark-trend-change is-new",children:"new"}):n.jsxs("span",{className:`benchmark-trend-change ${I.rate_change>=1?"is-up":"is-down"}`,children:[I.rate_change>=1?"↑":"↓"," ",I.rate_change.toFixed(1),"×"]})]})]})]}),n.jsxs("div",{className:"bm-subtitle",children:[V?n.jsx(xe,{className:"h-5 w-64 bm-summary-skeleton","aria-label":"Loading benchmark summary"}):n.jsxs("span",{children:[v&&n.jsxs(n.Fragment,{children:[n.jsx("span",{className:"metric-tag",children:v}),n.jsx("span",{style:{color:"var(--hairline-strong)",margin:"0 8px"},children:"·"})]}),C?n.jsxs("span",{children:["Best: ",n.jsx("span",{className:"best-name",children:ne(M)})," by ",n.jsx("span",{className:"best-name",style:{fontStyle:"normal"},children:C})]}):n.jsxs("span",{children:[Q.length," evaluations"]})]}),_.hf_url&&n.jsxs("a",{className:"bm-action-btn",href:_.hf_url,target:"_blank",rel:"noopener noreferrer",children:[n.jsx("span",{"aria-hidden":"true",children:"🤗"})," View on Hugging Face"]})]}),_.description&&n.jsx("p",{className:"bm-description",children:_.description}),a.hide_closed_source_evals&&N.length>0&&n.jsxs("div",{className:"bm-hidden-closed-notice",children:[n.jsxs("span",{children:[N.length," closed-source ",N.length===1?"row is":"rows are"," hidden",O!=null&&O.model_name?n.jsxs(n.Fragment,{children:[", including ",n.jsx("strong",{children:O.model_name})]}):null,"."]}),n.jsx("button",{type:"button",className:"bm-hidden-closed-action",onClick:()=>{i(!1)},children:"Show closed-source"})]}),yt&&n.jsxs("div",{className:"method-source",style:{marginTop:0,marginBottom:18},children:[n.jsx("span",{className:"method-source-label",children:"Source"}),de?n.jsxs(me,{to:`/paper/${de}`,target:"_blank",rel:"noopener noreferrer",className:"method-source-link",children:[n.jsx("span",{className:"method-source-title",children:X?n.jsx(ye,{title:X}):wt}),Z&&n.jsx("span",{className:"method-source-meta",children:Z})]}):_.paper_url?n.jsxs("a",{href:Mt(_.paper_url)??void 0,target:"_blank",rel:"noopener noreferrer",className:"method-source-link",children:[n.jsx("span",{className:"method-source-title",children:X?n.jsx(ye,{title:X}):_.paper_url}),Z&&n.jsx("span",{className:"method-source-meta",children:Z})]}):n.jsxs("div",{className:"method-source-link is-static",children:[n.jsx("span",{className:"method-source-title",children:X?n.jsx(ye,{title:X}):null}),Z&&n.jsx("span",{className:"method-source-meta",children:Z})]})]}),oe.filter(d=>d.isSota).length>=2&&n.jsxs("div",{className:"bm-card",ref:f,children:[n.jsxs("div",{className:"bm-card-screenshot-header","aria-hidden":"true",children:[n.jsxs("div",{className:"bm-card-screenshot-title",children:[n.jsx("span",{className:"bm-card-screenshot-eyebrow",children:"Benchmark"}),n.jsx("span",{className:"bm-card-screenshot-name",children:_.name})]}),n.jsxs("div",{className:"bm-card-screenshot-brand",children:[n.jsxs("span",{className:"brand",children:[n.jsx("span",{className:"brand-mark"}),n.jsxs("span",{className:"brand-name",children:["Papers ",n.jsx("em",{children:"With Code"})]})]}),n.jsx("span",{className:"bm-card-screenshot-url",children:"paperswithcode.co"})]})]}),n.jsxs("div",{className:"bm-card-head",children:[n.jsx("div",{className:"bm-card-title",children:"SOTA progression"}),n.jsxs("div",{className:"bm-card-actions",children:[A.length>1&&n.jsxs("label",{className:"bm-view-select",children:[n.jsx("span",{className:"bm-view-select-label",children:"View"}),n.jsx("select",{value:b,onChange:d=>l(d.target.value),children:W.map(d=>n.jsx("option",{value:d,children:d},d))})]}),n.jsxs("label",{className:"bm-closed-toggle",title:"Show or hide evaluations of closed-source models",children:[n.jsx(Je,{className:"bm-closed-toggle-switch",checked:!a.hide_closed_source_evals,onCheckedChange:d=>{i(!d)},"aria-label":"Show closed-source models"}),n.jsx("span",{className:"bm-closed-toggle-label",children:"Closed-source"})]}),n.jsx(ct,{targetRef:f,label:"SOTA chart"})]})]}),n.jsx("div",{className:"bm-chart-wrap",children:n.jsx(It,{points:oe,metric:b})}),n.jsxs("div",{className:"bm-chart-foot",children:[n.jsx("span",{className:"legend-dot"}),"All models over time · highlighted dots track the running best · hover for the model · click to open the paper"]})]}),R&&(()=>{var T,j;const d=R.paper_arxiv_id||R.paper_id,g=R.paper_title||(R.paper_arxiv_id?`arXiv:${R.paper_arxiv_id}`:null),h=R.best_metric&&((T=R.metrics)==null?void 0:T[R.best_metric])!==void 0?R.best_metric:b,S=(j=R.metrics)==null?void 0:j[h];return n.jsxs("div",{className:"bm-highlight-banner",role:"status",children:[n.jsx("span",{className:"bm-highlight-dot","aria-hidden":"true"}),n.jsxs("div",{className:"bm-highlight-text",children:[n.jsx("span",{className:"bm-highlight-label",children:"Comparing result"}),n.jsxs("span",{className:"bm-highlight-paper",children:[R.model_name||g||"—",R.harness?` · ${R.harness}`:""]}),n.jsxs("span",{className:"bm-highlight-meta",children:[S!==void 0&&h?n.jsxs(n.Fragment,{children:[h,": ",ne(S),g?" · ":""]}):null,d?n.jsx(me,{to:`/paper/${d}`,children:be(R.paper_title,g)}):be(R.paper_title,g)]})]})]})})(),n.jsxs("div",{className:"bm-card",ref:y,children:[n.jsxs("div",{className:"bm-card-screenshot-header","aria-hidden":"true",children:[n.jsxs("div",{className:"bm-card-screenshot-title",children:[n.jsx("span",{className:"bm-card-screenshot-eyebrow",children:"Benchmark"}),n.jsx("span",{className:"bm-card-screenshot-name",children:_.name})]}),n.jsxs("div",{className:"bm-card-screenshot-brand",children:[n.jsxs("span",{className:"brand",children:[n.jsx("span",{className:"brand-mark"}),n.jsxs("span",{className:"brand-name",children:["Papers ",n.jsx("em",{children:"With Code"})]})]}),n.jsx("span",{className:"bm-card-screenshot-url",children:"paperswithcode.co"})]})]}),n.jsxs("div",{className:"bm-card-head",children:[n.jsx("div",{className:"bm-card-title",children:"Leaderboard"}),n.jsxs("div",{className:"bm-card-actions",children:[A.length>1&&n.jsxs("label",{className:"bm-view-select",children:[n.jsx("span",{className:"bm-view-select-label",children:"View"}),n.jsx("select",{value:b,onChange:d=>l(d.target.value),children:W.map(d=>n.jsx("option",{value:d,children:d},d))})]}),n.jsxs("label",{className:"bm-closed-toggle",title:"Show or hide evaluations of closed-source models",children:[n.jsx(Je,{className:"bm-closed-toggle-switch",checked:!a.hide_closed_source_evals,onCheckedChange:d=>{i(!d)},"aria-label":"Show closed-source models"}),n.jsx("span",{className:"bm-closed-toggle-label",children:"Closed-source"})]}),n.jsx(ct,{targetRef:y,label:"leaderboard"})]})]}),E.isLoading?n.jsx("div",{style:{padding:16},children:Array.from({length:5}).map((d,g)=>n.jsx(xe,{className:"h-10 w-full mb-2"},g))}):Q.length===0?n.jsx("div",{className:"no-results",children:"No evaluations submitted yet."}):n.jsx("div",{className:"bm-table-scroll",children:n.jsxs("table",{className:"bm-table",children:[n.jsx("thead",{children:n.jsxs("tr",{children:[n.jsx("th",{className:"col-rank",children:"Rank"}),n.jsx("th",{className:"col-model",children:"Model"}),Fe&&n.jsx("th",{className:"col-harness",children:"Harness"}),le.map(d=>{const g=d===b;return n.jsx("th",{className:`col-value ${g?"is-active":""}`,"aria-sort":g?K==="↓"?"ascending":"descending":"none",children:n.jsxs("button",{type:"button",className:"bm-metric-header",onClick:()=>l(d),"aria-pressed":g,title:`Sort by ${d}`,children:[d,g?` ${K}`:""]})},d)}),n.jsx("th",{className:"col-paper",children:"Paper"}),n.jsx("th",{className:"col-year",children:"Year"})]})}),n.jsx("tbody",{children:(()=>{let d=null,g=0;return Q.map((h,S)=>{var Ke,Qe;const T=he((Ke=h.metrics)==null?void 0:Ke[b]);let j=null;T!==null&&((d===null||T!==d)&&(g=S+1,d=T),j=g);const ue=h.paper_arxiv_id||h.paper_id,Ge=h.paper_title||(h.paper_arxiv_id?`arXiv:${h.paper_arxiv_id}`:null),ke=lt(h,s);return n.jsxs("tr",{ref:ke?u:void 0,className:ke?"is-highlighted":void 0,children:[n.jsx("td",{className:"col-rank",children:j??"—"}),n.jsxs("td",{className:"col-model",children:[ke&&n.jsx("span",{className:"bm-row-marker","aria-hidden":"true"}),h.hf_model_url?n.jsx("a",{href:h.hf_model_url,target:"_blank",rel:"noopener noreferrer",className:"bm-model-link",title:`Open ${h.model_name||"model"} on Hugging Face`,children:h.model_name||"—"}):h.model_name||"—",h.is_open===!1&&n.jsx(Nt,{}),(h.external??h.is_external)&&n.jsx(Rt,{sourceUrl:h.source_url||h.external_source_url||h.result_url})]}),Fe&&n.jsx("td",{className:"col-harness",children:h.harness||"—"}),le.map(Se=>{var Ye;const Xe=Se===b,ge=(Ye=h.metrics)==null?void 0:Ye[Se];return n.jsx("td",{className:`col-value${Xe?" is-active":""}${Xe&&j===1?" is-best":""}`,children:ge!=null&&ge!==""?ne(ge):"—"},Se)}),n.jsx("td",{className:"col-paper",children:ue?n.jsx(me,{to:`/paper/${ue}`,children:be(h.paper_title,Ge)}):be(h.paper_title,Ge)}),n.jsx("td",{className:"col-year",children:((Qe=h.paper_published_date)==null?void 0:Qe.slice(0,4))||"—"})]},h.id)})})()})]})})]})]})})};export{Jr as default};
|
|
|
|
| 1 |
+
import{u as vt,r as w,j as n,a3 as ne,h as jt,f as _t,a as kt,Z as St,L as me,c as ee}from"./index-Bthypk3Q.js";import{u as te}from"./useQuery-CEDDm0wh.js";import{S as xe}from"./skeleton-BS-Px_iI.js";import{S as Je}from"./switch-B0Xhzkpy.js";import{A as Ct,a as Et}from"./alert-DJmmSiqi.js";import{L as ye}from"./LatexTitle-DOmMcoZ0.js";import{C as Nt,E as Rt}from"./ExternalSourceEvalBadge-DW02jL22.js";import{B as Tt}from"./BenchmarkTrendSparkline-DE8DNEAu.js";import{I as $t}from"./components-DR4nXlac.js";import{s as Mt}from"./safeExternalHref-CkBrsh84.js";import"./index-CqkTYlMR.js";import"./katex.min-BSBacQyE.js";import"./hover-card-Dy9hZi_x.js";import"./transform-_T5o_x_w.js";function Ft(e,t,r){const s=t?(e??[]).filter(c=>c.task_id===t):e??[],a=s.filter(c=>c.is_open===!1),i=a.reduce((c,l)=>c?(l.best_rank??Number.POSITIVE_INFINITY)<(c.best_rank??Number.POSITIVE_INFINITY)?l:c:l,null);return{visible:r?s.filter(c=>c.is_open!==!1):s,hiddenClosed:a,topHiddenClosed:i}}function Ze(e){const t=e.length===7?`${e}-01`:e,r=new Date(t).getTime();return Number.isFinite(r)?r:0}const Ce=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function Ee(e){const t=new Date(e);return{year:t.getFullYear(),month:t.getMonth()}}function Lt(e,t){if(e===t){const{year:u,month:p}=Ee(e);return[{timestamp:new Date(u,p,1).getTime(),key:`${u}-${p}`,label:`${Ce[p]} ${u}`}]}const r=Ee(e),s=Ee(t);if(r.year===s.year){const u=s.month-r.month+1;let p=1;const f=12;u>f&&(p=Math.ceil(u/f));const y=[];for(let x=r.month;x<=s.month;x+=p)y.push({timestamp:new Date(r.year,x,1).getTime(),key:`${r.year}-${x}`,label:u<=3?`${Ce[x]} ${r.year}`:Ce[x]});return y}const a=s.year-r.year+1;let i=1;const c=12;a>c&&(i=Math.ceil(a/c));const l=[];for(let u=r.year;u<=s.year;u+=i)l.push({timestamp:new Date(u,0,1).getTime(),key:String(u),label:String(u)});return l}const It=({points:e,metric:t})=>{const r=vt(),[s,a]=w.useState(null),i=880,c=320,l=60,u=30,p=40,f=50,y=e.map(o=>o.value),x=Math.min(...y),U=Math.max(...y)-x||1,ae=i-l-u,L=c-p-f,$=e.map(o=>Ze(o.date)),z=Math.min(...$),I=Math.max(...$),ie=I-z||1,Y=o=>z===I?l+ae/2:l+(o-z)/ie*ae,G=e.map((o,m)=>{const k=Y(Ze(o.date)),v=(o.value-x)/U,M=p+L*(1-v);return{x:k,y:M,data:o,idx:m}}),N=G.filter(o=>o.data.isSota);let O="";if(N.length>=2){O=`M${N[0].x},${N[0].y}`;for(let o=1;o<N.length;o++){const m=N[o-1],k=N[o],v=(m.x+k.x)/2;O+=` C${v},${m.y} ${v},${k.y} ${k.x},${k.y}`}}const H=5.4,fe=8,J=9,A=o=>{const m=o.data.modelName||o.data.paperTitle||"";if(!m)return null;const k=m.length>22?m.slice(0,21)+"…":m,v=k.length*H;let M=o.x-v/2,C=o.x+v/2,V="middle";return M<l?(M=l,C=l+v,V="start"):C>i-u&&(C=i-u,M=C-v,V="end"),{x:V==="start"?l:V==="end"?i-u:o.x,y:o.y-J,text:k,anchor:V,left:M,right:C}},ce=[],b=N.length>0?A(N[N.length-1]):null;let _e=-1/0;for(let o=0;o<N.length-1;o++){const m=A(N[o]);m&&(m.left<_e+fe||b&&m.right>b.left-fe||(_e=m.right,ce.push({x:m.x,y:m.y,text:m.text,anchor:m.anchor})))}b&&ce.push({x:b.x,y:b.y,text:b.text,anchor:b.anchor});const K=Lt(z,I),W=5,le=o=>a(m=>m===o?null:m),oe=o=>{o&&r(`/paper/${o}`)},pe=(o,m)=>{const v=`${o.data.modelName||o.data.paperTitle||"Unknown model"}: ${ne(o.data.value)} on ${o.data.dateLabel}`,M=!!o.data.paperRouteId;return n.jsxs("g",{children:[m,n.jsx("circle",{cx:o.x,cy:o.y,r:"10",fill:"transparent",style:{cursor:M?"pointer":"default",outline:"none"},tabIndex:0,role:M?"link":"img","aria-label":v,onMouseEnter:()=>a(o.idx),onMouseLeave:()=>le(o.idx),onFocus:()=>a(o.idx),onBlur:()=>le(o.idx),onClick:()=>oe(o.data.paperRouteId),onKeyDown:C=>{M&&(C.key==="Enter"||C.key===" ")&&(C.preventDefault(),oe(o.data.paperRouteId))},children:n.jsx("title",{children:v})})]},o.idx)};return n.jsxs("svg",{width:"100%",viewBox:`0 0 ${i} ${c}`,style:{display:"block"},children:[n.jsx("text",{x:l-38,y:p+L/2,fontSize:"11",fontFamily:"var(--mono)",fill:"var(--ink-faint)",textAnchor:"middle",transform:`rotate(-90 ${l-38} ${p+L/2})`,children:t}),Array.from({length:W}).map((o,m)=>{const k=m/(W-1),v=p+L*(1-k),M=x+U*k;return n.jsxs("g",{children:[n.jsx("line",{x1:l,y1:v,x2:i-u,y2:v,stroke:"var(--hairline)",strokeWidth:"1"}),n.jsx("text",{x:l-10,y:v+4,fontSize:"11",fontFamily:"var(--mono)",fill:"var(--ink-faint)",textAnchor:"end",children:ne(M)})]},m)}),K.map(o=>{const m=Y(o.timestamp);return n.jsx("text",{x:m,y:c-f+18,fontSize:"11",fontFamily:"var(--mono)",fill:"var(--ink-soft)",textAnchor:"middle",children:o.label},o.key)}),G.filter(o=>!o.data.isSota).map(o=>{const m=s===o.idx;return pe(o,n.jsx("circle",{cx:o.x,cy:o.y,r:m?3:2,fill:"var(--ink-faint)",opacity:m?1:.45,style:{transition:"r 0.12s ease, opacity 0.12s ease"}}))}),O&&n.jsx("path",{d:O,stroke:"var(--accent)",strokeWidth:"2",fill:"none",strokeLinejoin:"round",strokeLinecap:"round"}),N.map(o=>{const m=s===o.idx;return pe(o,n.jsx("circle",{cx:o.x,cy:o.y,r:m?4.5:3,fill:m?"var(--accent)":"var(--bg-elevated)",stroke:"var(--accent)",strokeWidth:"1.5",style:{transition:"r 0.12s ease, fill 0.12s ease"}}))}),ce.map((o,m)=>n.jsx("text",{x:o.x,y:o.y,fontSize:"9.5",fontFamily:"var(--mono)",fill:"var(--ink-soft)",textAnchor:o.anchor,pointerEvents:"none",style:{paintOrder:"stroke",stroke:"var(--bg-elevated)",strokeWidth:3,strokeLinejoin:"round"},children:o.text},`label-${m}`)),s!==null&&G[s]&&(()=>{const o=G[s],m=o.data.modelName||o.data.paperTitle||"Unknown model",v=`${m.length>40?m.slice(0,39)+"…":m}: ${ne(o.data.value)}`,C=Math.max(120,Math.min(340,v.length*6.6+24)),V=30;let B=o.x-C/2;B<l&&(B=l),B+C>i-u&&(B=i-u-C);const Q=o.y-V-14>=p?o.y-V-12:o.y+12;return n.jsxs("g",{pointerEvents:"none",children:[n.jsx("rect",{x:B,y:Q,width:C,height:V,rx:"6",ry:"6",fill:"var(--bg-elevated)",stroke:"var(--hairline-strong)",strokeWidth:"1",style:{filter:"drop-shadow(0 2px 6px rgba(0,0,0,0.08))"}}),n.jsx("text",{x:B+12,y:Q+19,fontSize:"12",fontFamily:"var(--sans)",fill:"var(--ink)",fontWeight:500,children:v})]})})()]})};function Pt(e,t){if(e.match(/^[a-z]+:\/\//i))return e;if(e.match(/^\/\//))return window.location.protocol+e;if(e.match(/^[a-z]+:/i))return e;const r=document.implementation.createHTMLDocument(),s=r.createElement("base"),a=r.createElement("a");return r.head.appendChild(s),r.body.appendChild(a),t&&(s.href=t),a.href=e,a.href}const At=(()=>{let e=0;const t=()=>`0000${(Math.random()*36**4<<0).toString(36)}`.slice(-4);return()=>(e+=1,`u${t()}${e}`)})();function q(e){const t=[];for(let r=0,s=e.length;r<s;r++)t.push(e[r]);return t}let re=null;function dt(e={}){return re||(e.includeStyleProperties?(re=e.includeStyleProperties,re):(re=q(window.getComputedStyle(document.documentElement)),re))}function we(e,t){const s=(e.ownerDocument.defaultView||window).getComputedStyle(e).getPropertyValue(t);return s?parseFloat(s.replace("px","")):0}function Dt(e){const t=we(e,"border-left-width"),r=we(e,"border-right-width");return e.clientWidth+t+r}function Bt(e){const t=we(e,"border-top-width"),r=we(e,"border-bottom-width");return e.clientHeight+t+r}function ut(e,t={}){const r=t.width||Dt(e),s=t.height||Bt(e);return{width:r,height:s}}function Ht(){let e,t;try{t=process}catch{}const r=t&&t.env?t.env.devicePixelRatio:null;return r&&(e=parseInt(r,10),Number.isNaN(e)&&(e=1)),e||window.devicePixelRatio||1}const D=16384;function Vt(e){(e.width>D||e.height>D)&&(e.width>D&&e.height>D?e.width>e.height?(e.height*=D/e.width,e.width=D):(e.width*=D/e.height,e.height=D):e.width>D?(e.height*=D/e.width,e.width=D):(e.width*=D/e.height,e.height=D))}function Ot(e,t={}){return e.toBlob?new Promise(r=>{e.toBlob(r,t.type?t.type:"image/png",t.quality?t.quality:1)}):new Promise(r=>{const s=window.atob(e.toDataURL(t.type?t.type:void 0,t.quality?t.quality:void 0).split(",")[1]),a=s.length,i=new Uint8Array(a);for(let c=0;c<a;c+=1)i[c]=s.charCodeAt(c);r(new Blob([i],{type:t.type?t.type:"image/png"}))})}function ve(e){return new Promise((t,r)=>{const s=new Image;s.onload=()=>{s.decode().then(()=>{requestAnimationFrame(()=>t(s))})},s.onerror=r,s.crossOrigin="anonymous",s.decoding="async",s.src=e})}async function Ut(e){return Promise.resolve().then(()=>new XMLSerializer().serializeToString(e)).then(encodeURIComponent).then(t=>`data:image/svg+xml;charset=utf-8,${t}`)}async function Wt(e,t,r){const s="http://www.w3.org/2000/svg",a=document.createElementNS(s,"svg"),i=document.createElementNS(s,"foreignObject");return a.setAttribute("width",`${t}`),a.setAttribute("height",`${r}`),a.setAttribute("viewBox",`0 0 ${t} ${r}`),i.setAttribute("width","100%"),i.setAttribute("height","100%"),i.setAttribute("x","0"),i.setAttribute("y","0"),i.setAttribute("externalResourcesRequired","true"),a.appendChild(i),i.appendChild(e),Ut(a)}const P=(e,t)=>{if(e instanceof t)return!0;const r=Object.getPrototypeOf(e);return r===null?!1:r.constructor.name===t.name||P(r,t)};function qt(e){const t=e.getPropertyValue("content");return`${e.cssText} content: '${t.replace(/'|"/g,"")}';`}function zt(e,t){return dt(t).map(r=>{const s=e.getPropertyValue(r),a=e.getPropertyPriority(r);return`${r}: ${s}${a?" !important":""};`}).join(" ")}function Gt(e,t,r,s){const a=`.${e}:${t}`,i=r.cssText?qt(r):zt(r,s);return document.createTextNode(`${a}{${i}}`)}function et(e,t,r,s){const a=window.getComputedStyle(e,r),i=a.getPropertyValue("content");if(i===""||i==="none")return;const c=At();try{t.className=`${t.className} ${c}`}catch{return}const l=document.createElement("style");l.appendChild(Gt(c,r,a,s)),t.appendChild(l)}function Kt(e,t,r){et(e,t,":before",r),et(e,t,":after",r)}const tt="application/font-woff",rt="image/jpeg",Qt={woff:tt,woff2:tt,ttf:"application/font-truetype",eot:"application/vnd.ms-fontobject",png:"image/png",jpg:rt,jpeg:rt,gif:"image/gif",tiff:"image/tiff",svg:"image/svg+xml",webp:"image/webp"};function Xt(e){const t=/\.([^./]*?)$/g.exec(e);return t?t[1]:""}function $e(e){const t=Xt(e).toLowerCase();return Qt[t]||""}function Yt(e){return e.split(/,/)[1]}function Re(e){return e.search(/^(data:)/)!==-1}function Jt(e,t){return`data:${t};base64,${e}`}async function mt(e,t,r){const s=await fetch(e,t);if(s.status===404)throw new Error(`Resource "${s.url}" not found`);const a=await s.blob();return new Promise((i,c)=>{const l=new FileReader;l.onerror=c,l.onloadend=()=>{try{i(r({res:s,result:l.result}))}catch(u){c(u)}},l.readAsDataURL(a)})}const Ne={};function Zt(e,t,r){let s=e.replace(/\?.*/,"");return r&&(s=e),/ttf|otf|eot|woff2?/i.test(s)&&(s=s.replace(/.*\//,"")),t?`[${t}]${s}`:s}async function Me(e,t,r){const s=Zt(e,t,r.includeQueryParams);if(Ne[s]!=null)return Ne[s];r.cacheBust&&(e+=(/\?/.test(e)?"&":"?")+new Date().getTime());let a;try{const i=await mt(e,r.fetchRequestInit,({res:c,result:l})=>(t||(t=c.headers.get("Content-Type")||""),Yt(l)));a=Jt(i,t)}catch(i){a=r.imagePlaceholder||"";let c=`Failed to fetch resource: ${e}`;i&&(c=typeof i=="string"?i:i.message),c&&console.warn(c)}return Ne[s]=a,a}async function er(e){const t=e.toDataURL();return t==="data:,"?e.cloneNode(!1):ve(t)}async function tr(e,t){if(e.currentSrc){const i=document.createElement("canvas"),c=i.getContext("2d");i.width=e.clientWidth,i.height=e.clientHeight,c==null||c.drawImage(e,0,0,i.width,i.height);const l=i.toDataURL();return ve(l)}const r=e.poster,s=$e(r),a=await Me(r,s,t);return ve(a)}async function rr(e,t){var r;try{if(!((r=e==null?void 0:e.contentDocument)===null||r===void 0)&&r.body)return await je(e.contentDocument.body,t,!0)}catch{}return e.cloneNode(!1)}async function sr(e,t){return P(e,HTMLCanvasElement)?er(e):P(e,HTMLVideoElement)?tr(e,t):P(e,HTMLIFrameElement)?rr(e,t):e.cloneNode(ht(e))}const nr=e=>e.tagName!=null&&e.tagName.toUpperCase()==="SLOT",ht=e=>e.tagName!=null&&e.tagName.toUpperCase()==="SVG";async function ar(e,t,r){var s,a;if(ht(t))return t;let i=[];return nr(e)&&e.assignedNodes?i=q(e.assignedNodes()):P(e,HTMLIFrameElement)&&(!((s=e.contentDocument)===null||s===void 0)&&s.body)?i=q(e.contentDocument.body.childNodes):i=q(((a=e.shadowRoot)!==null&&a!==void 0?a:e).childNodes),i.length===0||P(e,HTMLVideoElement)||await i.reduce((c,l)=>c.then(()=>je(l,r)).then(u=>{u&&t.appendChild(u)}),Promise.resolve()),t}function ir(e,t,r){const s=t.style;if(!s)return;const a=window.getComputedStyle(e);a.cssText?(s.cssText=a.cssText,s.transformOrigin=a.transformOrigin):dt(r).forEach(i=>{let c=a.getPropertyValue(i);i==="font-size"&&c.endsWith("px")&&(c=`${Math.floor(parseFloat(c.substring(0,c.length-2)))-.1}px`),P(e,HTMLIFrameElement)&&i==="display"&&c==="inline"&&(c="block"),i==="d"&&t.getAttribute("d")&&(c=`path(${t.getAttribute("d")})`),s.setProperty(i,c,a.getPropertyPriority(i))})}function cr(e,t){P(e,HTMLTextAreaElement)&&(t.innerHTML=e.value),P(e,HTMLInputElement)&&t.setAttribute("value",e.value)}function lr(e,t){if(P(e,HTMLSelectElement)){const r=t,s=Array.from(r.children).find(a=>e.value===a.getAttribute("value"));s&&s.setAttribute("selected","")}}function or(e,t,r){return P(t,Element)&&(ir(e,t,r),Kt(e,t,r),cr(e,t),lr(e,t)),t}async function dr(e,t){const r=e.querySelectorAll?e.querySelectorAll("use"):[];if(r.length===0)return e;const s={};for(let i=0;i<r.length;i++){const l=r[i].getAttribute("xlink:href");if(l){const u=e.querySelector(l),p=document.querySelector(l);!u&&p&&!s[l]&&(s[l]=await je(p,t,!0))}}const a=Object.values(s);if(a.length){const i="http://www.w3.org/1999/xhtml",c=document.createElementNS(i,"svg");c.setAttribute("xmlns",i),c.style.position="absolute",c.style.width="0",c.style.height="0",c.style.overflow="hidden",c.style.display="none";const l=document.createElementNS(i,"defs");c.appendChild(l);for(let u=0;u<a.length;u++)l.appendChild(a[u]);e.appendChild(c)}return e}async function je(e,t,r){return!r&&t.filter&&!t.filter(e)?null:Promise.resolve(e).then(s=>sr(s,t)).then(s=>ar(e,s,t)).then(s=>or(e,s,t)).then(s=>dr(s,t))}const ft=/url\((['"]?)([^'"]+?)\1\)/g,ur=/url\([^)]+\)\s*format\((["']?)([^"']+)\1\)/g,mr=/src:\s*(?:url\([^)]+\)\s*format\([^)]+\)[,;]\s*)+/g;function hr(e){const t=e.replace(/([.*+?^${}()|\[\]\/\\])/g,"\\$1");return new RegExp(`(url\\(['"]?)(${t})(['"]?\\))`,"g")}function fr(e){const t=[];return e.replace(ft,(r,s,a)=>(t.push(a),r)),t.filter(r=>!Re(r))}async function pr(e,t,r,s,a){try{const i=r?Pt(t,r):t,c=$e(t);let l;return a||(l=await Me(i,c,s)),e.replace(hr(t),`$1${l}$3`)}catch{}return e}function gr(e,{preferredFontFormat:t}){return t?e.replace(mr,r=>{for(;;){const[s,,a]=ur.exec(r)||[];if(!a)return"";if(a===t)return`src: ${s};`}}):e}function pt(e){return e.search(ft)!==-1}async function gt(e,t,r){if(!pt(e))return e;const s=gr(e,r);return fr(s).reduce((i,c)=>i.then(l=>pr(l,c,t,r)),Promise.resolve(s))}async function se(e,t,r){var s;const a=(s=t.style)===null||s===void 0?void 0:s.getPropertyValue(e);if(a){const i=await gt(a,null,r);return t.style.setProperty(e,i,t.style.getPropertyPriority(e)),!0}return!1}async function xr(e,t){await se("background",e,t)||await se("background-image",e,t),await se("mask",e,t)||await se("-webkit-mask",e,t)||await se("mask-image",e,t)||await se("-webkit-mask-image",e,t)}async function br(e,t){const r=P(e,HTMLImageElement);if(!(r&&!Re(e.src))&&!(P(e,SVGImageElement)&&!Re(e.href.baseVal)))return;const s=r?e.src:e.href.baseVal,a=await Me(s,$e(s),t);await new Promise((i,c)=>{e.onload=i,e.onerror=t.onImageErrorHandler?(...u)=>{try{i(t.onImageErrorHandler(...u))}catch(p){c(p)}}:c;const l=e;l.decode&&(l.decode=i),l.loading==="lazy"&&(l.loading="eager"),r?(e.srcset="",e.src=a):e.href.baseVal=a})}async function yr(e,t){const s=q(e.childNodes).map(a=>xt(a,t));await Promise.all(s).then(()=>e)}async function xt(e,t){P(e,Element)&&(await xr(e,t),await br(e,t),await yr(e,t))}function wr(e,t){const{style:r}=e;t.backgroundColor&&(r.backgroundColor=t.backgroundColor),t.width&&(r.width=`${t.width}px`),t.height&&(r.height=`${t.height}px`);const s=t.style;return s!=null&&Object.keys(s).forEach(a=>{r[a]=s[a]}),e}const st={};async function nt(e){let t=st[e];if(t!=null)return t;const s=await(await fetch(e)).text();return t={url:e,cssText:s},st[e]=t,t}async function at(e,t){let r=e.cssText;const s=/url\(["']?([^"')]+)["']?\)/g,i=(r.match(/url\([^)]+\)/g)||[]).map(async c=>{let l=c.replace(s,"$1");return l.startsWith("https://")||(l=new URL(l,e.url).href),mt(l,t.fetchRequestInit,({result:u})=>(r=r.replace(c,`url(${u})`),[c,u]))});return Promise.all(i).then(()=>r)}function it(e){if(e==null)return[];const t=[],r=/(\/\*[\s\S]*?\*\/)/gi;let s=e.replace(r,"");const a=new RegExp("((@.*?keyframes [\\s\\S]*?){([\\s\\S]*?}\\s*?)})","gi");for(;;){const u=a.exec(s);if(u===null)break;t.push(u[0])}s=s.replace(a,"");const i=/@import[\s\S]*?url\([^)]*\)[\s\S]*?;/gi,c="((\\s*?(?:\\/\\*[\\s\\S]*?\\*\\/)?\\s*?@media[\\s\\S]*?){([\\s\\S]*?)}\\s*?})|(([\\s\\S]*?){([\\s\\S]*?)})",l=new RegExp(c,"gi");for(;;){let u=i.exec(s);if(u===null){if(u=l.exec(s),u===null)break;i.lastIndex=l.lastIndex}else l.lastIndex=i.lastIndex;t.push(u[0])}return t}async function vr(e,t){const r=[],s=[];return e.forEach(a=>{if("cssRules"in a)try{q(a.cssRules||[]).forEach((i,c)=>{if(i.type===CSSRule.IMPORT_RULE){let l=c+1;const u=i.href,p=nt(u).then(f=>at(f,t)).then(f=>it(f).forEach(y=>{try{a.insertRule(y,y.startsWith("@import")?l+=1:a.cssRules.length)}catch(x){console.error("Error inserting rule from remote css",{rule:y,error:x})}})).catch(f=>{console.error("Error loading remote css",f.toString())});s.push(p)}})}catch(i){const c=e.find(l=>l.href==null)||document.styleSheets[0];a.href!=null&&s.push(nt(a.href).then(l=>at(l,t)).then(l=>it(l).forEach(u=>{c.insertRule(u,c.cssRules.length)})).catch(l=>{console.error("Error loading remote stylesheet",l)})),console.error("Error inlining remote css file",i)}}),Promise.all(s).then(()=>(e.forEach(a=>{if("cssRules"in a)try{q(a.cssRules||[]).forEach(i=>{r.push(i)})}catch(i){console.error(`Error while reading CSS rules from ${a.href}`,i)}}),r))}function jr(e){return e.filter(t=>t.type===CSSRule.FONT_FACE_RULE).filter(t=>pt(t.style.getPropertyValue("src")))}async function _r(e,t){if(e.ownerDocument==null)throw new Error("Provided element is not within a Document");const r=q(e.ownerDocument.styleSheets),s=await vr(r,t);return jr(s)}function bt(e){return e.trim().replace(/["']/g,"")}function kr(e){const t=new Set;function r(s){(s.style.fontFamily||getComputedStyle(s).fontFamily).split(",").forEach(i=>{t.add(bt(i))}),Array.from(s.children).forEach(i=>{i instanceof HTMLElement&&r(i)})}return r(e),t}async function Sr(e,t){const r=await _r(e,t),s=kr(e);return(await Promise.all(r.filter(i=>s.has(bt(i.style.fontFamily))).map(i=>{const c=i.parentStyleSheet?i.parentStyleSheet.href:null;return gt(i.cssText,c,t)}))).join(`
|
| 2 |
`)}async function Cr(e,t){const r=t.fontEmbedCSS!=null?t.fontEmbedCSS:t.skipFonts?null:await Sr(e,t);if(r){const s=document.createElement("style"),a=document.createTextNode(r);s.appendChild(a),e.firstChild?e.insertBefore(s,e.firstChild):e.appendChild(s)}}async function Er(e,t={}){const{width:r,height:s}=ut(e,t),a=await je(e,t,!0);return await Cr(a,t),await xt(a,t),wr(a,t),await Wt(a,r,s)}async function Nr(e,t={}){const{width:r,height:s}=ut(e,t),a=await Er(e,t),i=await ve(a),c=document.createElement("canvas"),l=c.getContext("2d"),u=t.pixelRatio||Ht(),p=t.canvasWidth||r,f=t.canvasHeight||s;return c.width=p*u,c.height=f*u,t.skipAutoScale||Vt(c),c.style.width=`${p}`,c.style.height=`${f}`,t.backgroundColor&&(l.fillStyle=t.backgroundColor,l.fillRect(0,0,c.width,c.height)),l.drawImage(i,0,0,c.width,c.height),c}async function Rr(e,t={}){const r=await Nr(e,t);return await Ot(r)}const Te="#ffffff";function Tr(){return typeof window>"u"?Te:window.getComputedStyle(document.documentElement).getPropertyValue("--bg-elevated").trim()||Te}function $r(e){if(typeof window>"u")return Te;const t=window.getComputedStyle(e).backgroundColor;return!t||t==="rgba(0, 0, 0, 0)"||t==="transparent"?Tr():t}async function Mr(e){var r,s;if(typeof window>"u"||!((s=(r=window.navigator)==null?void 0:r.clipboard)!=null&&s.write))throw new Error("Clipboard image copy is not supported in this browser.");if(typeof window.ClipboardItem>"u")throw new Error("Clipboard image copy is not supported in this browser.");const t=await Rr(e,{pixelRatio:2,cacheBust:!0,backgroundColor:$r(e)});if(!t)throw new Error("Failed to render screenshot.");await window.navigator.clipboard.write([new window.ClipboardItem({"image/png":t})])}const ct=({targetRef:e,label:t})=>{const{toast:r}=jt(),[s,a]=w.useState("idle"),i=w.useRef(null);w.useEffect(()=>()=>{i.current!==null&&window.clearTimeout(i.current)},[]);const c=w.useCallback(async()=>{const u=e.current;if(u){a("copying"),u.classList.add("is-capturing"),u.offsetHeight,await new Promise(p=>window.requestAnimationFrame(()=>p()));try{await Mr(u),a("copied"),r({title:"Screenshot copied",description:`Image of the ${t} copied to your clipboard.`}),i.current!==null&&window.clearTimeout(i.current),i.current=window.setTimeout(()=>a("idle"),1500)}catch(p){a("idle"),r({title:"Copy failed",description:p instanceof Error&&p.message?p.message:"Could not copy the screenshot to your clipboard.",variant:"destructive"})}finally{u.classList.remove("is-capturing")}}},[e,t,r]),l=s==="copied"?"Copied":s==="copying"?"Copying…":"Copy image";return n.jsxs("button",{type:"button",className:"bm-copy-btn",onClick:c,disabled:s==="copying","aria-label":`Copy ${t} screenshot to clipboard`,title:`Copy ${t} screenshot to clipboard`,children:[n.jsx($t,{name:"copy",size:11}),l]})};function he(e){if(e==null)return null;if(typeof e=="number")return Number.isFinite(e)?e:null;const t=e.includes("±")?e.split("±")[0].trim():e.trim(),r=parseFloat(t);return Number.isFinite(r)?r:null}function Fr(e){return[e.paper_id,e.task_id,e.dataset_id,e.model_name,e.harness??""].join("|")}function Lr(e){const t=new Map;for(const r of e){const s=Fr(r),a=t.get(s);if(!a){t.set(s,{...r,metrics:{...r.metrics||{}},sourceEvaluationIds:[r.id],ranksByMetric:r.best_metric&&r.best_rank!=null?{[r.best_metric]:r.best_rank}:{}});continue}a.metrics={...a.metrics,...r.metrics||{}},a.sourceEvaluationIds.push(r.id),r.best_metric&&r.best_rank!=null&&(a.ranksByMetric[r.best_metric]=r.best_rank)}return Array.from(t.values())}function lt(e,t){return t?e.id===t||e.sourceEvaluationIds.includes(t):!1}function ot(e,t){return e.ranksByMetric[t]??e.best_rank??9999}function Ir(e,t,r){if(e.length===0)return{points:[],sota:0,sotaModel:""};const s=e.map(f=>{var E;const y=he((E=f.metrics)==null?void 0:E[t]),x=f.paper_published_date||"";return{eval:f,value:y,date:x}}).filter(f=>f.value!==null&&!!f.date).sort((f,y)=>f.date.localeCompare(y.date)),a=[];let i=null;for(const f of s){const y=i==null?!0:r==="↓"?f.value<i:f.value>i;y&&(i=f.value),a.push({value:f.value,date:f.date,dateLabel:f.date.slice(0,7),modelName:f.eval.model_name||"",paperTitle:f.eval.paper_title||"",paperRouteId:f.eval.paper_arxiv_id||f.eval.paper_id||null,isSota:y})}const l=e.map(f=>{var y;return{eval:f,value:he((y=f.metrics)==null?void 0:y[t])}}).filter(f=>f.value!==null).sort((f,y)=>r==="↓"?f.value-y.value:y.value-f.value)[0],u=(l==null?void 0:l.value)??0,p=(l==null?void 0:l.eval.model_name)||(l==null?void 0:l.eval.paper_title)||"";return{points:a,sota:u,sotaModel:p}}const Pr=5;function Ar(e){if(!e)return null;const t=e.trim(),r=t.match(/^https?:\/\/(?:www\.)?arxiv\.org\/(?:abs|pdf)\/([^/?#]+)/i);if(r!=null&&r[1])return r[1].replace(/\.pdf$/i,"");const s=t.match(/^(?:https?:\/\/(?:www\.)?paperswithcode\.co)?\/paper\/([^/?#]+)/i);return(s==null?void 0:s[1])??null}function be(e,t){return e?n.jsx(ye,{title:e}):t||"—"}const Jr=()=>{var Le,Ie,Pe,Ae,De,Be,He,Ve,Oe,Ue,We,qe,ze;const{datasetSlug:e}=_t(),[t]=kt(),r=t.get("task")||void 0,s=t.get("eval")||void 0,{preferences:a,setHideClosedSourceEvals:i}=St(),[c,l]=w.useState(void 0),u=w.useRef(null),p=w.useRef(!1),f=w.useRef(null),y=w.useRef(null),x=te({queryKey:["dataset",e,"with-paper",r,a.hide_closed_source_evals?"open":"all"],queryFn:()=>ee.getDatasetBySlug(e,{include_paper:!0,task:r,is_open:a.hide_closed_source_evals?!0:void 0}),enabled:!!e,staleTime:10*60*1e3}),E=te({queryKey:["dataset-evals",(Le=x.data)==null?void 0:Le.id],queryFn:()=>ee.getEvaluationsByDataset(x.data.id),enabled:!!((Ie=x.data)!=null&&Ie.id),staleTime:5*60*1e3}),U=te({queryKey:["dataset-tasks",(Pe=x.data)==null?void 0:Pe.id],queryFn:()=>ee.getDatasetTasks(x.data.id),enabled:!!((Ae=x.data)!=null&&Ae.id),staleTime:10*60*1e3}),ae=te({queryKey:["metric-directions"],queryFn:()=>ee.getMetricDirections(),staleTime:60*60*1e3}),L=w.useMemo(()=>{var d;return!s||!((d=E.data)!=null&&d.length)?null:E.data.find(g=>g.id===s)||null},[s,E.data]),$=w.useMemo(()=>{const d=U.data||[];if(d.length===0)return null;if(L!=null&&L.task_id&&d.some(h=>h.id===L.task_id))return L.task_id;if(r){const h=d.find(S=>S.slug===r);if(h)return h.id}if(d.length===1)return d[0].id;const g=E.data||[];if(g.length>0){const h=new Map;for(const j of g)h.set(j.task_id,(h.get(j.task_id)||0)+1);let S=null,T=-1;for(const j of d){const ue=h.get(j.id)||0;ue>T&&(T=ue,S=j.id)}if(S)return S}return d[0].id},[U.data,E.data,r,L]),z=te({queryKey:["task-benchmark-trends",$,a.hide_closed_source_evals?!0:void 0],queryFn:()=>ee.getTrendingBenchmarks($,{limit:100,min_recent_papers:0,is_open:a.hide_closed_source_evals?!0:void 0}),enabled:!!$&&!!((De=x.data)!=null&&De.id),staleTime:10*60*1e3}),I=w.useMemo(()=>{var d;return(((d=z.data)==null?void 0:d.results)||[]).find(g=>{var h;return g.id===((h=x.data)==null?void 0:h.id)})||null},[z.data,(Be=x.data)==null?void 0:Be.id]),ie=te({queryKey:["leaderboard-metrics",(He=x.data)==null?void 0:He.id,$],queryFn:()=>ee.getLeaderboardMetrics(x.data.id,$),enabled:!!((Ve=x.data)!=null&&Ve.id)&&!!$,staleTime:10*60*1e3}),Y=w.useMemo(()=>Ft(E.data,$,a.hide_closed_source_evals),[E.data,$,a.hide_closed_source_evals]),G=Y.visible,N=Y.hiddenClosed,O=Y.topHiddenClosed,H=w.useMemo(()=>Lr(G),[G]),fe=w.useMemo(()=>{const d=new Set;return H.forEach(g=>{g.best_metric&&d.add(g.best_metric),Object.keys(g.metrics||{}).forEach(h=>d.add(h))}),Array.from(d)},[H]),J=w.useMemo(()=>(ie.data||[]).map(d=>d.metric_name),[ie.data]),A=J.length?J:fe,ce=w.useMemo(()=>{var S;if(H.length===0)return A[0]||"";const d=new Map;for(const T of H)for(const j of Object.keys(T.metrics||{}))J.length&&!A.includes(j)||d.set(j,(d.get(j)||0)+1);let g=null,h=0;for(const[T,j]of d)j>h&&(h=j,g=T);return g||A[0]||((S=H[0])==null?void 0:S.best_metric)||""},[H,A,J]),b=c||(L==null?void 0:L.best_metric)||ce,K=(((Ue=(Oe=ae.data)==null?void 0:Oe.directions)==null?void 0:Ue[b])||"higher_is_better")==="lower_is_better"?"↓":"↑",W=w.useMemo(()=>!b||!A.includes(b)?A:[b,...A.filter(d=>d!==b)],[A,b]),le=w.useMemo(()=>W.length===0?b?[b]:[]:W.slice(0,Pr),[W,b]),{points:oe,sota:pe,sotaModel:o}=w.useMemo(()=>Ir(H,b,K),[H,b,K]),m=(We=x.data)==null?void 0:We.leaderboard_summary,k=E.isSuccess&&U.isSuccess&&ae.isSuccess&&(!$||ie.isSuccess),v=k?b:m==null?void 0:m.metric,M=k?pe:m==null?void 0:m.value,C=k?o:m==null?void 0:m.model_name,V=!k&&!m;w.useEffect(()=>{if(p.current||!s||!E.data||E.data.length===0)return;const d=u.current;d&&(p.current=!0,d.scrollIntoView({behavior:"smooth",block:"start"}))},[s,E.data]);const B=w.useMemo(()=>{const d=U.data||[];return $?d.find(g=>g.id===$)||d[0]||null:d[0]||null},[U.data,$]);if(x.isLoading)return n.jsxs("div",{className:"page",children:[n.jsx(xe,{className:"h-12 w-1/2 mb-6"}),n.jsx(xe,{className:"h-64 w-full"})]});if(x.error||!x.data)return n.jsx("div",{className:"page",children:n.jsx(Ct,{variant:"destructive",children:n.jsx(Et,{children:"Benchmark not found."})})});const _=x.data,Q=H.slice().sort((d,g)=>{var T,j;const h=he((T=d.metrics)==null?void 0:T[b]),S=he((j=g.metrics)==null?void 0:j[b]);return h!==null&&S!==null?K==="↓"?h-S:S-h:h!==null?-1:S!==null?1:ot(d,b)-ot(g,b)}),Fe=!!_.supports_harness,R=s&&Q.find(d=>lt(d,s))||null,F=_.introducing_paper??void 0,de=(F==null?void 0:F.arxiv_id)||(F==null?void 0:F.id)||Ar(_.paper_url),X=(F==null?void 0:F.title)||_.introducing_paper_title||null,Z=((qe=F==null?void 0:F.published)==null?void 0:qe.slice(0,4))||_.introduced_year||null,yt=!!de||!!_.paper_url||!!X,wt=F!=null&&F.arxiv_id||(ze=_.paper_url)!=null&&ze.match(/^https?:\/\/(?:www\.)?arxiv\.org\//i)?`arXiv:${de}`:`Paper ${de}`;return n.jsx("div",{className:"page",children:n.jsxs("div",{className:"bm-page",children:[n.jsxs("div",{className:"breadcrumb",children:[n.jsx(me,{to:"/tasks",children:"Tasks"}),B&&n.jsxs(n.Fragment,{children:[n.jsx("span",{className:"sep",children:"/"}),n.jsx(me,{to:`/tasks/${B.slug||B.id}`,children:B.name})]}),n.jsx("span",{className:"sep",children:"/"}),n.jsx("span",{style:{color:"var(--accent-text)"},children:_.name})]}),n.jsxs("div",{className:"bm-title-row",children:[n.jsx("h1",{className:"bm-title",children:_.name}),I&&n.jsxs("div",{className:"bm-title-trend","aria-label":`${_.name} reporting trend`,children:[n.jsx(Tt,{history:I.history,benchmarkName:I.name}),n.jsxs("span",{className:"bm-title-trend-summary",children:[n.jsx("strong",{children:I.recent_paper_count})," ",I.recent_paper_count===1?"paper":"papers",I.rate_change==null?I.recent_paper_count>0&&n.jsx("span",{className:"benchmark-trend-change is-new",children:"new"}):n.jsxs("span",{className:`benchmark-trend-change ${I.rate_change>=1?"is-up":"is-down"}`,children:[I.rate_change>=1?"↑":"↓"," ",I.rate_change.toFixed(1),"×"]})]})]})]}),n.jsxs("div",{className:"bm-subtitle",children:[V?n.jsx(xe,{className:"h-5 w-64 bm-summary-skeleton","aria-label":"Loading benchmark summary"}):n.jsxs("span",{children:[v&&n.jsxs(n.Fragment,{children:[n.jsx("span",{className:"metric-tag",children:v}),n.jsx("span",{style:{color:"var(--hairline-strong)",margin:"0 8px"},children:"·"})]}),C?n.jsxs("span",{children:["Best: ",n.jsx("span",{className:"best-name",children:ne(M)})," by ",n.jsx("span",{className:"best-name",style:{fontStyle:"normal"},children:C})]}):n.jsxs("span",{children:[Q.length," evaluations"]})]}),_.hf_url&&n.jsxs("a",{className:"bm-action-btn",href:_.hf_url,target:"_blank",rel:"noopener noreferrer",children:[n.jsx("span",{"aria-hidden":"true",children:"🤗"})," View on Hugging Face"]})]}),_.description&&n.jsx("p",{className:"bm-description",children:_.description}),a.hide_closed_source_evals&&N.length>0&&n.jsxs("div",{className:"bm-hidden-closed-notice",children:[n.jsxs("span",{children:[N.length," closed-source ",N.length===1?"row is":"rows are"," hidden",O!=null&&O.model_name?n.jsxs(n.Fragment,{children:[", including ",n.jsx("strong",{children:O.model_name})]}):null,"."]}),n.jsx("button",{type:"button",className:"bm-hidden-closed-action",onClick:()=>{i(!1)},children:"Show closed-source"})]}),yt&&n.jsxs("div",{className:"method-source",style:{marginTop:0,marginBottom:18},children:[n.jsx("span",{className:"method-source-label",children:"Source"}),de?n.jsxs(me,{to:`/paper/${de}`,target:"_blank",rel:"noopener noreferrer",className:"method-source-link",children:[n.jsx("span",{className:"method-source-title",children:X?n.jsx(ye,{title:X}):wt}),Z&&n.jsx("span",{className:"method-source-meta",children:Z})]}):_.paper_url?n.jsxs("a",{href:Mt(_.paper_url)??void 0,target:"_blank",rel:"noopener noreferrer",className:"method-source-link",children:[n.jsx("span",{className:"method-source-title",children:X?n.jsx(ye,{title:X}):_.paper_url}),Z&&n.jsx("span",{className:"method-source-meta",children:Z})]}):n.jsxs("div",{className:"method-source-link is-static",children:[n.jsx("span",{className:"method-source-title",children:X?n.jsx(ye,{title:X}):null}),Z&&n.jsx("span",{className:"method-source-meta",children:Z})]})]}),oe.filter(d=>d.isSota).length>=2&&n.jsxs("div",{className:"bm-card",ref:f,children:[n.jsxs("div",{className:"bm-card-screenshot-header","aria-hidden":"true",children:[n.jsxs("div",{className:"bm-card-screenshot-title",children:[n.jsx("span",{className:"bm-card-screenshot-eyebrow",children:"Benchmark"}),n.jsx("span",{className:"bm-card-screenshot-name",children:_.name})]}),n.jsxs("div",{className:"bm-card-screenshot-brand",children:[n.jsxs("span",{className:"brand",children:[n.jsx("span",{className:"brand-mark"}),n.jsxs("span",{className:"brand-name",children:["Papers ",n.jsx("em",{children:"With Code"})]})]}),n.jsx("span",{className:"bm-card-screenshot-url",children:"paperswithcode.co"})]})]}),n.jsxs("div",{className:"bm-card-head",children:[n.jsx("div",{className:"bm-card-title",children:"SOTA progression"}),n.jsxs("div",{className:"bm-card-actions",children:[A.length>1&&n.jsxs("label",{className:"bm-view-select",children:[n.jsx("span",{className:"bm-view-select-label",children:"View"}),n.jsx("select",{value:b,onChange:d=>l(d.target.value),children:W.map(d=>n.jsx("option",{value:d,children:d},d))})]}),n.jsxs("label",{className:"bm-closed-toggle",title:"Show or hide evaluations of closed-source models",children:[n.jsx(Je,{className:"bm-closed-toggle-switch",checked:!a.hide_closed_source_evals,onCheckedChange:d=>{i(!d)},"aria-label":"Show closed-source models"}),n.jsx("span",{className:"bm-closed-toggle-label",children:"Closed-source"})]}),n.jsx(ct,{targetRef:f,label:"SOTA chart"})]})]}),n.jsx("div",{className:"bm-chart-wrap",children:n.jsx(It,{points:oe,metric:b})}),n.jsxs("div",{className:"bm-chart-foot",children:[n.jsx("span",{className:"legend-dot"}),"All models over time · highlighted dots track the running best · hover for the model · click to open the paper"]})]}),R&&(()=>{var T,j;const d=R.paper_arxiv_id||R.paper_id,g=R.paper_title||(R.paper_arxiv_id?`arXiv:${R.paper_arxiv_id}`:null),h=R.best_metric&&((T=R.metrics)==null?void 0:T[R.best_metric])!==void 0?R.best_metric:b,S=(j=R.metrics)==null?void 0:j[h];return n.jsxs("div",{className:"bm-highlight-banner",role:"status",children:[n.jsx("span",{className:"bm-highlight-dot","aria-hidden":"true"}),n.jsxs("div",{className:"bm-highlight-text",children:[n.jsx("span",{className:"bm-highlight-label",children:"Comparing result"}),n.jsxs("span",{className:"bm-highlight-paper",children:[R.model_name||g||"—",R.harness?` · ${R.harness}`:""]}),n.jsxs("span",{className:"bm-highlight-meta",children:[S!==void 0&&h?n.jsxs(n.Fragment,{children:[h,": ",ne(S),g?" · ":""]}):null,d?n.jsx(me,{to:`/paper/${d}`,children:be(R.paper_title,g)}):be(R.paper_title,g)]})]})]})})(),n.jsxs("div",{className:"bm-card",ref:y,children:[n.jsxs("div",{className:"bm-card-screenshot-header","aria-hidden":"true",children:[n.jsxs("div",{className:"bm-card-screenshot-title",children:[n.jsx("span",{className:"bm-card-screenshot-eyebrow",children:"Benchmark"}),n.jsx("span",{className:"bm-card-screenshot-name",children:_.name})]}),n.jsxs("div",{className:"bm-card-screenshot-brand",children:[n.jsxs("span",{className:"brand",children:[n.jsx("span",{className:"brand-mark"}),n.jsxs("span",{className:"brand-name",children:["Papers ",n.jsx("em",{children:"With Code"})]})]}),n.jsx("span",{className:"bm-card-screenshot-url",children:"paperswithcode.co"})]})]}),n.jsxs("div",{className:"bm-card-head",children:[n.jsx("div",{className:"bm-card-title",children:"Leaderboard"}),n.jsxs("div",{className:"bm-card-actions",children:[A.length>1&&n.jsxs("label",{className:"bm-view-select",children:[n.jsx("span",{className:"bm-view-select-label",children:"View"}),n.jsx("select",{value:b,onChange:d=>l(d.target.value),children:W.map(d=>n.jsx("option",{value:d,children:d},d))})]}),n.jsxs("label",{className:"bm-closed-toggle",title:"Show or hide evaluations of closed-source models",children:[n.jsx(Je,{className:"bm-closed-toggle-switch",checked:!a.hide_closed_source_evals,onCheckedChange:d=>{i(!d)},"aria-label":"Show closed-source models"}),n.jsx("span",{className:"bm-closed-toggle-label",children:"Closed-source"})]}),n.jsx(ct,{targetRef:y,label:"leaderboard"})]})]}),E.isLoading?n.jsx("div",{style:{padding:16},children:Array.from({length:5}).map((d,g)=>n.jsx(xe,{className:"h-10 w-full mb-2"},g))}):Q.length===0?n.jsx("div",{className:"no-results",children:"No evaluations submitted yet."}):n.jsx("div",{className:"bm-table-scroll",children:n.jsxs("table",{className:"bm-table",children:[n.jsx("thead",{children:n.jsxs("tr",{children:[n.jsx("th",{className:"col-rank",children:"Rank"}),n.jsx("th",{className:"col-model",children:"Model"}),Fe&&n.jsx("th",{className:"col-harness",children:"Harness"}),le.map(d=>{const g=d===b;return n.jsx("th",{className:`col-value ${g?"is-active":""}`,"aria-sort":g?K==="↓"?"ascending":"descending":"none",children:n.jsxs("button",{type:"button",className:"bm-metric-header",onClick:()=>l(d),"aria-pressed":g,title:`Sort by ${d}`,children:[d,g?` ${K}`:""]})},d)}),n.jsx("th",{className:"col-paper",children:"Paper"}),n.jsx("th",{className:"col-year",children:"Year"})]})}),n.jsx("tbody",{children:(()=>{let d=null,g=0;return Q.map((h,S)=>{var Ke,Qe;const T=he((Ke=h.metrics)==null?void 0:Ke[b]);let j=null;T!==null&&((d===null||T!==d)&&(g=S+1,d=T),j=g);const ue=h.paper_arxiv_id||h.paper_id,Ge=h.paper_title||(h.paper_arxiv_id?`arXiv:${h.paper_arxiv_id}`:null),ke=lt(h,s);return n.jsxs("tr",{ref:ke?u:void 0,className:ke?"is-highlighted":void 0,children:[n.jsx("td",{className:"col-rank",children:j??"—"}),n.jsxs("td",{className:"col-model",children:[ke&&n.jsx("span",{className:"bm-row-marker","aria-hidden":"true"}),h.hf_model_url?n.jsx("a",{href:h.hf_model_url,target:"_blank",rel:"noopener noreferrer",className:"bm-model-link",title:`Open ${h.model_name||"model"} on Hugging Face`,children:h.model_name||"—"}):h.model_name||"—",h.is_open===!1&&n.jsx(Nt,{}),(h.external??h.is_external)&&n.jsx(Rt,{sourceUrl:h.source_url||h.external_source_url||h.result_url})]}),Fe&&n.jsx("td",{className:"col-harness",children:h.harness||"—"}),le.map(Se=>{var Ye;const Xe=Se===b,ge=(Ye=h.metrics)==null?void 0:Ye[Se];return n.jsx("td",{className:`col-value${Xe?" is-active":""}${Xe&&j===1?" is-best":""}`,children:ge!=null&&ge!==""?ne(ge):"—"},Se)}),n.jsx("td",{className:"col-paper",children:ue?n.jsx(me,{to:`/paper/${ue}`,children:be(h.paper_title,Ge)}):be(h.paper_title,Ge)}),n.jsx("td",{className:"col-year",children:((Qe=h.paper_published_date)==null?void 0:Qe.slice(0,4))||"—"})]},h.id)})})()})]})})]})]})})};export{Jr as default};
|
assets/{BenchmarkTrendSparkline-Dd-Foicv.js → BenchmarkTrendSparkline-DE8DNEAu.js}
RENAMED
|
@@ -1 +1 @@
|
|
| 1 |
-
import{r as C,j as t}from"./index-
|
|
|
|
| 1 |
+
import{r as C,j as t}from"./index-Bthypk3Q.js";const g=112,p=42,o=5,m=5,b=new Intl.DateTimeFormat("en",{month:"short",timeZone:"UTC"}),y=(e,d)=>{const r=new Date(`${e}T00:00:00Z`),n=new Date(`${d}T00:00:00Z`);return r.getUTCMonth()===n.getUTCMonth()?`${b.format(r)} ${r.getUTCDate()}–${n.getUTCDate()}`:`${b.format(r)} ${r.getUTCDate()}–${b.format(n)} ${n.getUTCDate()}`},I=({history:e,benchmarkName:d,interactive:r=!1})=>{const[n,x]=C.useState(null),h=e.map(s=>s.paper_count),M=Math.max(1,...h),f=g-o*2,T=p-m*2,v=h.length>1?f/(h.length-1):0,a=h.map((s,c)=>({x:o+v*c,y:m+T-s/M*T})),$=a.map(({x:s,y:c})=>`${s},${c}`).join(" "),_=a.length?`${o},${p-m} ${$} ${a[a.length-1].x},${p-m}`:"",D=h.reduce((s,c)=>s+c,0),u=49,N=14,i=n==null?null:a[n],j=i?Math.min(g-o-u,Math.max(o,i.x-u/2)):0,k=i?i.y>p/2?i.y-N-3:i.y+3:0;return t.jsxs("svg",{className:`benchmark-trend-sparkline${r?" is-interactive":""}`,viewBox:`0 0 ${g} ${p}`,role:r?"group":"img","aria-label":`${d}: ${D} reporting papers across the displayed trend history`,children:[t.jsxs("title",{children:[d,": ",D," reporting papers across the displayed trend history"]}),t.jsx("line",{className:"benchmark-trend-axis",x1:o,y1:p-m,x2:g-o,y2:p-m}),t.jsx("line",{className:"benchmark-trend-axis",x1:o,y1:m,x2:o,y2:p-m}),_&&t.jsx("polygon",{className:"benchmark-trend-area",points:_}),$&&t.jsx("polyline",{className:"benchmark-trend-line",points:$}),r?a.map(({x:s,y:c},l)=>t.jsxs("g",{className:"benchmark-trend-point",tabIndex:0,role:"img","aria-label":`${y(e[l].start_date,e[l].end_date)}: ${e[l].paper_count} ${e[l].paper_count===1?"paper":"papers"}`,onMouseEnter:()=>x(l),onMouseLeave:()=>x(null),onFocus:()=>x(l),onBlur:()=>x(null),children:[t.jsx("circle",{className:"benchmark-trend-point-hit",cx:s,cy:c,r:"5"}),t.jsx("circle",{className:"benchmark-trend-point-mark",cx:s,cy:c,r:"1.8"})]},`${e[l].start_date}-${e[l].end_date}`)):a.length>0&&t.jsx("circle",{className:"benchmark-trend-dot",cx:a[a.length-1].x,cy:a[a.length-1].y,r:"2.6"}),i&&n!=null&&t.jsxs("g",{className:"benchmark-trend-tooltip",pointerEvents:"none",children:[t.jsx("rect",{x:j,y:k,width:u,height:N,rx:"2"}),t.jsx("text",{x:j+3,y:k+5.4,children:y(e[n].start_date,e[n].end_date)}),t.jsxs("text",{className:"benchmark-trend-tooltip-value",x:j+3,y:k+11,children:[e[n].paper_count," ",e[n].paper_count===1?"paper":"papers"]})]})]})};export{I as B};
|
assets/ChatMessage-CsmlLd6Q.js
DELETED
|
@@ -1,6 +0,0 @@
|
|
| 1 |
-
import{d as C,r as v,j as t,R as f}from"./index-NKCYgxaj.js";import{M as E,m as b,A as P,y as F,z as N,B as S}from"./chatSessions-Bv5yO1zx.js";import"./katex.min-BSBacQyE.js";import{H as $,a as H,b as T}from"./hover-card-Z7w-9YtT.js";import{r as I,a as U,P as M}from"./PaperPreviewLink-syrag20a.js";import{M as L,r as O,d as A}from"./index-S59lkwkS.js";/**
|
| 2 |
-
* @license lucide-react v0.462.0 - ISC
|
| 3 |
-
*
|
| 4 |
-
* This source code is licensed under the ISC license.
|
| 5 |
-
* See the LICENSE file in the root directory of this source tree.
|
| 6 |
-
*/const q=C("Pencil",[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]]),pe=({onSend:e,busy:s,placeholder:a,autoFocus:n,draft:i,onDraftChange:c,onStop:r,models:h=[],selectedModel:l,onModelChange:d,disabled:m=!1,describedBy:x})=>{const[p,g]=v.useState(""),u=v.useRef(null);v.useEffect(()=>{const o=u.current;o&&(o.style.height="auto",o.style.height=`${Math.min(o.scrollHeight,200)}px`)},[p]),v.useEffect(()=>{var o;n&&((o=u.current)==null||o.focus())},[n]),v.useEffect(()=>{i!==void 0&&g(i)},[i]);const j=()=>{const o=p.trim();!o||s||m||(g(""),c==null||c(""),e(o))};return t.jsxs("div",{className:"chat-composer",children:[t.jsx("textarea",{ref:u,rows:1,value:p,placeholder:a||"Ask anything about research…",onChange:o=>{g(o.target.value),c==null||c(o.target.value)},onKeyDown:o=>{o.key==="Enter"&&!o.shiftKey&&(o.preventDefault(),j())},"aria-describedby":x}),t.jsxs("div",{className:"chat-composer-row",children:[t.jsxs("div",{className:"chat-composer-tools",children:[h.length>0&&l&&d&&t.jsx(E,{models:h,selectedModel:l,onModelChange:d,disabled:s}),t.jsx("span",{className:"chat-composer-hint",children:"Enter to send · Shift+Enter for newline"})]}),t.jsx("button",{type:"button",className:`chat-send${s||p.trim()?" chat-send-on":""}`,onClick:s?r:j,disabled:m||(s?!r:!p.trim()),"aria-label":s?"Stop generating":"Send message",children:s?r?t.jsx("span",{"aria-hidden":"true",children:"■"}):t.jsx(b,{light:!0}):t.jsx(P,{})})]})]})},_=new Map,z=e=>{if(!e)return Promise.resolve();const s=_.get(e);if(s)return s;const a=new Promise(n=>{const i=new Image;i.onload=()=>{n()},i.onerror=()=>{_.delete(e),n()},i.src=e});return _.set(e,a),a},V=new Set(["huggingface.co","www.huggingface.co"]),K=new Set(["api","blog","chat","collections","docs","enterprise","join","login","models","new","organizations","papers","posts","pricing","search","settings","spaces","tasks"]);function D(e){let s;try{s=new URL(e)}catch{return null}if(s.protocol!=="https:"||!V.has(s.hostname))return null;const a=s.pathname.split("/").filter(Boolean),n=a[0]==="datasets"?"dataset":"model",i=n==="dataset"?a.slice(1):a;if(i.length!==2||n==="model"&&K.has(i[0])||i.some(d=>!d||d==="."||d===".."))return null;const c=i.join("/"),r=i.map(encodeURIComponent).join("/"),h=n==="dataset"?`datasets/${r}`:r,l=n==="dataset"?"datasets":"models";return{type:n,repoId:c,url:`https://huggingface.co/${h}`,thumbnailUrl:`https://cdn-thumbnails.huggingface.co/social-thumbnails/${l}/${r}.png`}}const W=()=>typeof window.matchMedia=="function"&&window.matchMedia("(hover: none), (pointer: coarse)").matches,X=({repo:e})=>{const[s,a]=f.useState(!1);return t.jsxs("div",{className:"hf-preview-card",children:[s?t.jsx("div",{className:"hf-preview-fallback","aria-hidden":"true",children:"🤗"}):t.jsx("img",{className:"hf-preview-image","data-testid":"hf-preview-image",src:e.thumbnailUrl,alt:"",loading:"eager",decoding:"async",onError:()=>a(!0)}),t.jsxs("div",{className:"hf-preview-meta",children:[t.jsxs("span",{className:"hf-preview-kind",children:["Hugging Face ",e.type]}),t.jsx("strong",{children:e.repoId}),t.jsx("span",{children:"huggingface.co"})]})]})},Y=({repo:e,children:s})=>{const[a,n]=f.useState(!1),i=f.useRef(null),c=f.useCallback(()=>{z(e.thumbnailUrl)},[e.thumbnailUrl]);return f.useEffect(()=>{const r=i.current;if(!r||typeof IntersectionObserver>"u")return;const h=new IntersectionObserver(([l])=>{l.isIntersecting&&(c(),h.disconnect())},{rootMargin:"200px"});return h.observe(r),()=>h.disconnect()},[c]),t.jsxs($,{open:a,onOpenChange:r=>{(!r||!W())&&n(r)},openDelay:150,closeDelay:100,children:[t.jsx(H,{asChild:!0,children:t.jsx("a",{ref:i,className:"chat-paper-link chat-hf-link",href:e.url,target:"_blank",rel:"noopener noreferrer",onPointerEnter:c,onFocus:c,children:s})}),t.jsx(T,{className:"hf-preview-pop",side:"bottom",align:"start",collisionPadding:12,children:t.jsx(X,{repo:e})})]})};function G(e,s,a){if(s)return{routeId:e,title:s.title,arxivId:s.metadata.arxiv_id,source:s.metadata.source,sourceUrl:s.metadata.source_url,thumbnailUrl:s.metadata.thumbnail_url,authors:s.metadata.authors.map(n=>n.name),published:s.metadata.published,conference:s.metadata.conference,citationCount:s.metadata.citation_count,tasks:s.metadata.tasks};if(a)return{routeId:e,title:a.title,arxivId:a.arxiv_id??null,source:a.arxiv_id?"arxiv":"external",sourceUrl:a.source_url,thumbnailUrl:a.thumbnail_url??null,authors:a.authors??[],published:a.published??null,conference:a.conference??null,citationCount:a.citation_count??null,tasks:[]}}const k=({routeId:e,paper:s,citation:a,className:n="chat-paper-link",children:i})=>t.jsx(M,{routeId:e,initialData:G(e,s,a),className:n,target:"_blank",children:i});function J(e){const s=e.lastIndexOf("[");if(s===-1)return e;const a=e.slice(s);return/^\[[^\]]*(\]\(?[^)\s]*)?$/.test(a)?e.slice(0,s):e}const B=e=>e.startsWith("paper:")?e:A(e),w=({text:e,streaming:s,papers:a,citations:n})=>{const i=s?J(e):e;return t.jsx(L,{remarkPlugins:[O,U],rehypePlugins:[I],urlTransform:B,components:{a:({href:c,children:r})=>{if(c!=null&&c.startsWith("paper:")){const l=c.slice(6);return!a[l]&&!(n!=null&&n[l])?t.jsx("span",{className:"chat-invalid-citation",children:r}):t.jsx(k,{routeId:l,paper:a[l],citation:n==null?void 0:n[l],children:r})}const h=c?D(c):null;return h?t.jsx(Y,{repo:h,children:r}):t.jsx("span",{children:r})}},children:i})};function Q(e){if(!e.authors.length)return"";const s=e.authors.slice(0,3).map(a=>a.name).join(", ");return e.authors.length>3?`${s}, et al.`:s}function Z(e){var a;if(e.conference)return e.conference;const s=(a=e.published)==null?void 0:a.slice(0,4);if(e.arxiv_id)return s?`arXiv ${s}`:"arXiv";if(e.source_url)try{return new URL(e.source_url).hostname.replace(/^www\./,"")}catch{}return s??"external"}function ee(e,s=240){const a=e.content.trim();return a.length<=s?a:`${a.slice(0,s).trimEnd()}…`}const te="https://huggingface.co/pro",se="https://huggingface.co/docs/inference-providers/pricing",R=()=>t.jsx("span",{className:"chat-caret"}),ae=e=>{var a;if(!e.streaming)return!1;const s=(a=e.blocks)==null?void 0:a.at(-1);return s?s.kind==="reasoning"?!s.active:s.kind==="tool"?s.status!=="running":!1:!0},ne=e=>{var g,u;if(e.button!==0||e.detail!==2)return;e.preventDefault();const s=e.currentTarget,a=s.ownerDocument,n=(g=a.caretPositionFromPoint)==null?void 0:g.call(a,e.clientX,e.clientY),i=n?null:(u=a.caretRangeFromPoint)==null?void 0:u.call(a,e.clientX,e.clientY),c=(n==null?void 0:n.offsetNode)??(i==null?void 0:i.startContainer),r=(n==null?void 0:n.offset)??(i==null?void 0:i.startOffset);if(!(c instanceof Text)||r===void 0||!s.contains(c))return;const h=c.data,l=/[\p{L}\p{M}\p{N}_'-]/u;let d=Math.min(r,h.length),m=d;for(;d>0&&l.test(h[d-1]);)d-=1;for(;m<h.length&&l.test(h[m]);)m+=1;if(d===m)return;const x=a.getSelection();if(!x)return;const p=a.createRange();p.setStart(c,d),p.setEnd(c,m),x.removeAllRanges(),x.addRange(p)},re=({block:e,papers:s,citations:a,onToggle:n})=>e.active?t.jsxs("div",{className:"chat-reason-live",children:[t.jsxs("div",{className:"chat-reason-live-head",children:[t.jsx(b,{})," ",t.jsx("span",{children:"Thinking…"})]}),t.jsxs("div",{className:"chat-reason-live-body chat-answer chat-reason-markdown",children:[t.jsx(w,{text:e.text,streaming:!0,papers:s,citations:a}),t.jsx(R,{})]})]}):t.jsxs("div",{className:"chat-reason-done",children:[t.jsxs("button",{type:"button",className:"chat-reason-done-head",onClick:n,"aria-expanded":e.open,children:[t.jsx(F,{}),t.jsx("span",{children:"Thought for a few seconds"}),t.jsx(N,{open:e.open})]}),e.open&&t.jsx("div",{className:"chat-reason-done-body chat-answer chat-reason-markdown",children:t.jsx(w,{text:e.text,papers:s,citations:a})})]}),ie=({block:e,papers:s,onToggle:a})=>{var m,x,p,g;const n=e.status==="running",i=e.schema_version===2||!!e.content,c=e.status==="error"||e.status==="denied",r=typeof e.args.query=="string"?e.args.query:"",h=typeof e.args.command=="string"?e.args.command:typeof e.args.file_path=="string"?e.args.file_path:r,l=((m=e.content)==null?void 0:m.map(u=>u.text).join(""))??"",d=n?"running…":i?`${e.status} · ${e.took_ms??0} ms`:`${e.hits} results · ${e.took_ms} ms`;return t.jsxs("div",{className:`chat-tool${n?" chat-tool-running":""}${c?" chat-tool-failed":""}`,children:[t.jsxs("button",{type:"button",className:"chat-tool-head",onClick:a,disabled:n,"aria-expanded":n?void 0:e.open,children:[t.jsxs("span",{className:"chat-tool-head-left",children:[n?t.jsx(b,{}):t.jsx(S,{}),t.jsx("code",{className:"chat-tool-name",children:e.name}),t.jsx("span",{className:"chat-tool-query",children:i?h:`("${r}")`})]}),t.jsxs("span",{className:"chat-tool-head-right",children:[t.jsx("span",{className:"chat-tool-status",children:d}),!n&&t.jsx(N,{open:e.open})]})]}),!n&&e.open&&t.jsxs("div",{className:"chat-tool-body",children:[t.jsxs("div",{className:"chat-tool-args",children:[t.jsx("span",{className:"chat-tool-label",children:"arguments"}),t.jsx("pre",{children:JSON.stringify(e.args,null,2)})]}),i?t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"chat-tool-output-head",children:[t.jsx("span",{className:"chat-tool-label",children:"result"}),t.jsx("button",{type:"button",className:"chat-tool-copy",onClick:()=>void navigator.clipboard.writeText(l),children:"Copy"})]}),t.jsx("pre",{className:"chat-tool-output",children:t.jsx("code",{children:l})}),((x=e.metadata)==null?void 0:x.output_truncated)&&t.jsx("div",{className:"chat-tool-truncated",children:"Output was truncated."})]}):t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"chat-tool-label chat-tool-results-label",children:["returned ",((p=e.results)==null?void 0:p.length)??0," papers"]}),t.jsx("ol",{className:"chat-tool-results",children:(g=e.results)==null?void 0:g.map(u=>t.jsxs("li",{className:"chat-hit",children:[t.jsx("div",{className:"chat-hit-top",children:t.jsx(k,{routeId:u.route_id,paper:s[u.route_id],className:"chat-hit-title",children:u.title})}),t.jsx("div",{className:"chat-hit-meta",children:[Q(u.metadata),Z(u.metadata)].filter(Boolean).join(" · ")}),t.jsxs("div",{className:"chat-hit-snippet",children:[ee(u),u.content_truncated&&t.jsx("span",{className:"chat-hit-truncated",children:" (truncated)"})]})]},u.route_id))})]})]})]})},oe=({block:e,papers:s,citations:a,streaming:n})=>t.jsxs("div",{className:"chat-answer",children:[t.jsx(w,{text:e.text,streaming:n,papers:s,citations:a}),n&&!!e.text.trim()&&t.jsx(R,{})]}),ge=({id:e,text:s,editingAllowed:a=!1,editing:n=!1,editNotice:i,onEdit:c,onCancel:r,onResend:h})=>{const[l,d]=f.useState(s),[m,x]=f.useState(!1),p=f.useRef(null),g=f.useCallback(()=>{const o=p.current;if(!o)return;o.style.height="auto";const y=Math.max(120,window.innerHeight*.4);o.style.height=`${Math.min(o.scrollHeight,y)}px`,o.style.overflowY=o.scrollHeight>y?"auto":"hidden"},[]);f.useLayoutEffect(()=>{if(!n)return;d(s),x(!1);const o=p.current;o&&(o.focus(),o.setSelectionRange(s.length,s.length),g())},[n,g,s]),f.useLayoutEffect(g,[g,l]);const u=!!l.trim()&&l.length<=8e3,j=()=>{!u||m||(x(!0),h!=null&&h(l)||x(!1))};return n?t.jsx("div",{className:"chat-msg chat-msg-user chat-msg-user-editing","data-message-id":e,children:t.jsxs("div",{className:"chat-inline-editor",children:[t.jsx("textarea",{ref:p,className:"chat-inline-editor-textarea","aria-label":"Edit message",value:l,maxLength:8e3,onChange:o=>d(o.target.value),onKeyDown:o=>{o.key==="Escape"?(o.preventDefault(),r==null||r()):o.key==="Enter"&&!o.shiftKey&&!o.nativeEvent.isComposing&&(o.preventDefault(),j())}}),i&&t.jsx("div",{className:"chat-inline-editor-notice",children:i}),t.jsxs("div",{className:"chat-inline-editor-actions",children:[t.jsx("button",{type:"button",onClick:r,children:"Cancel"}),t.jsx("button",{type:"button",className:"chat-inline-editor-send",disabled:!u||m,onClick:j,children:"Send"})]})]})}):t.jsx("div",{className:"chat-msg chat-msg-user","data-message-id":e,children:t.jsxs("div",{className:"chat-user-message-wrap",children:[t.jsx("div",{className:"chat-bubble",children:t.jsx("span",{className:"chat-bubble-text",onMouseDown:ne,children:s})}),a&&t.jsx("div",{className:"chat-user-actions",children:t.jsx("button",{type:"button",className:"chat-user-edit","aria-label":"Edit message",title:"Edit",onClick:c,children:t.jsx(q,{"aria-hidden":"true"})})})]})})},xe=({msg:e,papers:s,onToggleBlock:a,onArchiveOldChats:n,onArchiveOldestChats:i,archivePending:c=null,hfBilling:r=null})=>{var h,l;return t.jsx("div",{className:"chat-msg chat-msg-assistant",children:t.jsxs("div",{className:"chat-msg-blocks",children:[(h=e.blocks)==null?void 0:h.map((d,m)=>{var u;const x=`${e.id}-${m}`,p="citations"in d&&d.citations!==void 0?d.citations:e.citations??[],g=Object.fromEntries(p.map(j=>[j.route_id,j]));return d.kind==="reasoning"?t.jsx(re,{block:d,papers:s,citations:g,onToggle:()=>a(e.id,m)},x):d.kind==="tool"?t.jsx(ie,{block:d,papers:s,onToggle:()=>a(e.id,m)},x):t.jsx(oe,{block:d,papers:s,citations:g,streaming:!!(e.streaming&&m===(((u=e.blocks)==null?void 0:u.length)??0)-1)},x)}),ae(e)&&t.jsx("div",{className:"chat-waiting",role:"status","aria-live":"polite",children:t.jsx("span",{className:"chat-thinking",children:(((l=e.blocks)==null?void 0:l.length)??0)===0?e.status??"Thinking…":"Thinking…"})}),e.error&&t.jsxs("div",{className:"chat-error",children:[t.jsx("span",{children:e.errorCode==="chat_disabled_interrupted"?"Chat was disabled while this response was running. The partial response is saved. Please try again later.":e.errorCode==="chat_session_quota_exceeded"?e.error:`The assistant hit an error: ${e.error}`}),["hf_inference_billing_required","hf_inference_credential_expired"].includes(e.errorCode??"")&&t.jsx("a",{href:"/settings",children:e.errorCode==="hf_inference_billing_required"?"Authorize HF in Settings":e.errorCode==="hf_inference_credential_expired"?"Reconnect Hugging Face":"Review billing settings"}),e.errorCode==="hf_inference_billing_exhausted"&&t.jsxs(t.Fragment,{children:[(r==null?void 0:r.account_type)==="Free"&&!r.bill_to?t.jsx("a",{href:te,target:"_blank",rel:"noreferrer",children:"Upgrade to Hugging Face PRO — $9/month for 20× more included credits"}):t.jsx("a",{href:(r==null?void 0:r.usage_url)??"/settings",target:r?"_blank":void 0,rel:r?"noreferrer":void 0,children:"Review Hugging Face usage and billing"}),t.jsx("a",{href:se,target:"_blank",rel:"noreferrer",children:"Inference Providers pricing and billing details"})]}),e.errorCode==="openrouter_monthly_budget_exhausted"&&t.jsxs(t.Fragment,{children:[t.jsx("a",{href:"/settings#openrouter-byok",children:"Use your own OpenRouter key"}),t.jsx("span",{children:"Or select a Hugging Face-backed model and explicitly retry."})]}),e.errorCode==="openrouter_unavailable"&&t.jsxs(t.Fragment,{children:[t.jsx("a",{href:"/settings#openrouter-byok",children:"Bring your own key in Settings"}),t.jsx("a",{href:"https://github.com/huggingface/paperswithcode-feedback",target:"_blank",rel:"noreferrer",children:"File an issue"})]}),e.errorCode==="openrouter_byok_billing_error"&&t.jsx("a",{href:"https://openrouter.ai/settings/credits",target:"_blank",rel:"noreferrer",children:"Review OpenRouter billing"}),["openrouter_byok_credential_invalid","openrouter_byok_rate_limit"].includes(e.errorCode??"")&&t.jsx("a",{href:"/settings#openrouter-byok",children:"Review OpenRouter settings"}),e.errorCode==="chat_session_quota_exceeded"&&(n||i)&&t.jsxs("span",{className:"chat-error-actions",children:[n&&t.jsx("button",{type:"button",disabled:c!==null,onClick:n,children:c==="old"?"Archiving…":"Archive chats older than 30 days"}),i&&t.jsx("button",{type:"button",disabled:c!==null,onClick:i,children:c==="oldest"?"Archiving…":"Archive oldest 50 chats"})]})]}),!e.streaming&&e.finishReason&&e.finishReason!=="success"&&t.jsx("div",{className:"chat-finish-note",children:["tool_limit","max_turns"].includes(e.finishReason)?"The assistant stopped at the execution limit.":`The assistant stopped early (${e.finishReason.replace(/_/g," ")}).`})]})})};export{xe as A,pe as C,ge as U};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
assets/ChatMessage-Dx3LmUoF.js
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import{d as Q,j as t,R as x,c as H,r as F}from"./index-Bthypk3Q.js";import{M as G,m as A,A as J,y as Z,z as O,B as ee}from"./chatSessions-nz97TbnH.js";import"./katex.min-BSBacQyE.js";import{H as te,a as se,b as re}from"./hover-card-Dy9hZi_x.js";import{r as ne,a as ae,P as z}from"./PaperPreviewLink-DajWspZH.js";import{M as ie,r as oe,d as ce}from"./index-SizWVsV-.js";import{u as le}from"./useQuery-CEDDm0wh.js";import{F as K}from"./file-text-SORg5JWW.js";/**
|
| 2 |
+
* @license lucide-react v0.462.0 - ISC
|
| 3 |
+
*
|
| 4 |
+
* This source code is licensed under the ISC license.
|
| 5 |
+
* See the LICENSE file in the root directory of this source tree.
|
| 6 |
+
*/const ue=Q("Pencil",[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]]),V=({open:e,query:s,results:n,activeIndex:r,loading:i,error:o,onSelect:a,id:l="chat-paper-picker",optionIdPrefix:u="chat-paper-option"})=>{if(!e)return null;const m=s.trim()?i?"Searching papers…":o?"Paper search is unavailable":n.length?`${n.length} paper${n.length===1?"":"s"} found`:"No papers found":"Type to search papers";return t.jsxs("div",{className:"chat-paper-picker",id:l,role:"listbox","aria-label":"Paper results",children:[t.jsx("div",{className:"chat-paper-picker-status",role:"status","aria-live":"polite",children:m}),n.map((h,f)=>{const w=h.arxiv_id||h.id,v=h.arxiv_id||(()=>{try{return h.source_url?new URL(h.source_url).hostname:"External resource"}catch{return"External resource"}})();return t.jsxs("button",{type:"button",id:`${u}-${f}`,role:"option","aria-selected":f===r,className:`chat-paper-option${f===r?" is-active":""}`,onMouseDown:c=>{c.preventDefault(),a(h)},children:[t.jsx("span",{className:"chat-paper-option-title",children:h.title}),t.jsx("span",{className:"chat-paper-option-meta",children:v})]},w)})]})},de=10,he=3;function q(e,s){const r=e.slice(0,s).lastIndexOf("@");if(r<0)return null;const i=r>0?e[r-1]:"";if(i&&/[\p{L}\p{M}\p{N}_@]/u.test(i))return null;const o=e.slice(r+1,s);return/[\n\r@]/.test(o)?null:{start:r,end:s,query:o}}function L(e,s,n){let r=0;for(;r<e.length&&r<s.length&&e[r]===s[r];)r+=1;let i=0;for(;i<e.length-r&&i<s.length-r&&e[e.length-1-i]===s[s.length-1-i];)i+=1;const o=e.length-i,a=s.length-e.length;return n.flatMap(l=>l.end<=r?[l]:l.start>=o?[{...l,start:l.start+a,end:l.end+a}]:[])}function B({draft:e,onChange:s,enabled:n,textareaRef:r}){var S;const i=`chat-paper-picker-${x.useId().replace(/:/g,"")}`,o=`${i}-option`,[a,l]=x.useState(null),[u,m]=x.useState(""),[h,f]=x.useState(0),[w,v]=x.useState(""),c=x.useRef(new Set);x.useEffect(()=>{const d=window.setTimeout(()=>m((a==null?void 0:a.query.trim())??""),150);return()=>window.clearTimeout(d)},[a==null?void 0:a.query]);const y=le({queryKey:["chat-paper-mention-search",u.toLowerCase()],queryFn:({signal:d})=>H.searchPapers(u,1,10,"hybrid",d),enabled:n&&!!a&&u.length>=1,staleTime:3e4,refetchOnWindowFocus:!1,retry:!1}),_=x.useMemo(()=>{var d;return((d=y.data)==null?void 0:d.results)??[]},[(S=y.data)==null?void 0:S.results]);x.useEffect(()=>f(0),[u]),x.useEffect(()=>{var d;(d=document.getElementById(`${o}-${h}`))==null||d.scrollIntoView({block:"nearest"})},[h,o]);const b=x.useCallback(d=>{var I;if(!n){l(null);return}const g=d??((I=r.current)==null?void 0:I.selectionStart)??e.text.length;if(e.paperMentions.some(M=>g>M.start&&g<=M.end)){l(null);return}l(q(e.text,g))},[e.paperMentions,e.text,n,r]),j=x.useCallback((d,g)=>{var T;const I=L(e.text,d,e.paperMentions);s({text:d,paperMentions:I});const k=g??((T=r.current)==null?void 0:T.selectionStart)??d.length;n&&!I.some(C=>k>C.start&&k<=C.end)?l(q(d,k)):l(null)},[e,n,s,r]),E=x.useCallback(d=>{if(!a)return!1;const g=d.arxiv_id||d.id,I=new Set(e.paperMentions.map(P=>P.route_id));if(e.paperMentions.length>=de)return v("A message can contain at most 10 paper mentions."),!1;if(!I.has(g)&&I.size>=he)return v("A message can attach at most 3 distinct papers."),!1;const M=`@${d.title}`,k=e.text.slice(0,a.start)+M+e.text.slice(a.end),T=L(e.text,k,e.paperMentions),C={key:crypto.randomUUID(),route_id:g,title:d.title,source:d.source==="external"?"external":"arxiv",start:a.start,end:a.start+M.length};return s({text:k,paperMentions:[...T,C].sort((P,$)=>P.start-$.start)}),l(null),v(""),window.requestAnimationFrame(()=>{var $,D;const P=C.end;($=r.current)==null||$.focus(),(D=r.current)==null||D.setSelectionRange(P,P)}),c.current.has(g)||(c.current.add(g),H.prewarmChatPaperContext(g).catch(()=>{})),!0},[a,e,s,r]),p=x.useCallback(d=>{const g=e.paperMentions.find(k=>k.key===d);if(!g)return;const I=e.text.slice(0,g.start)+e.text.slice(g.end),M=e.paperMentions.filter(k=>k.key!==d).map(k=>k.start>=g.end?{...k,start:k.start-(g.end-g.start),end:k.end-(g.end-g.start)}:k);s({text:I,paperMentions:M}),l(null)},[e,s]),N=x.useCallback(d=>!a||d.nativeEvent.isComposing?!1:d.key==="Tab"?(l(null),!1):d.key==="Escape"?(d.preventDefault(),l(null),!0):d.key==="ArrowDown"||d.key==="ArrowUp"?(d.preventDefault(),_.length&&f(g=>d.key==="ArrowDown"?(g+1)%_.length:(g-1+_.length)%_.length),!0):d.key==="Home"&&_.length?(d.preventDefault(),f(0),!0):d.key==="End"&&_.length?(d.preventDefault(),f(_.length-1),!0):d.key==="Enter"&&!d.shiftKey?(d.preventDefault(),_[h]?E(_[h]):y.isFetching||l(null),!0):!1,[a,h,_,y.isFetching,E]);return{open:!!a,query:(a==null?void 0:a.query)??"",results:_,activeIndex:h,loading:y.isFetching,error:y.isError,message:w,pickerId:i,optionIdPrefix:o,updateText:j,refresh:b,select:E,remove:p,keyDown:N,close:()=>l(null)}}const pe={text:"",paperMentions:[]},Ve=({onSend:e,busy:s,placeholder:n,autoFocus:r,draft:i,onDraftChange:o,onStop:a,models:l=[],selectedModel:u,onModelChange:m,disabled:h=!1,describedBy:f,paperMentionsEnabled:w=!1})=>{const[v,c]=F.useState(pe),y=i??v,_=F.useRef(null),j=B({draft:y,onChange:p=>{i||c(p),o==null||o(p)},enabled:w,textareaRef:_});F.useEffect(()=>{const p=_.current;p&&(p.style.height="auto",p.style.height=`${Math.min(p.scrollHeight,200)}px`)},[y.text]),F.useEffect(()=>{var p;r&&((p=_.current)==null||p.focus())},[r]);const E=()=>{const p=y.text.length-y.text.trimStart().length,N=y.text.trim();if(!N||s||h)return;const S=p+N.length,d={text:N,paperMentions:y.paperMentions.filter(g=>g.start>=p&&g.end<=S).map(g=>({...g,start:g.start-p,end:g.end-p}))};e(d)};return t.jsxs("div",{className:"chat-composer",children:[y.paperMentions.length>0&&t.jsx("div",{className:"chat-paper-chips","aria-label":"Attached papers",children:y.paperMentions.map(p=>t.jsxs("span",{className:`chat-paper-chip${p.unavailable?" is-unavailable":""}`,children:[t.jsx("span",{"aria-hidden":"true",children:"▤"}),p.title,t.jsx("button",{type:"button",onClick:()=>j.remove(p.key),"aria-label":`Remove ${p.title}`,children:"×"})]},p.key))}),t.jsxs("div",{className:"chat-composer-textarea-wrap",children:[t.jsx("textarea",{ref:_,rows:1,value:y.text,placeholder:n||"Ask anything about research…",onChange:p=>j.updateText(p.target.value,p.target.selectionStart),onSelect:p=>j.refresh(p.currentTarget.selectionStart),onClick:p=>j.refresh(p.currentTarget.selectionStart),onBlur:p=>{var N,S;(S=(N=p.relatedTarget)==null?void 0:N.closest)!=null&&S.call(N,".chat-paper-picker")||window.setTimeout(j.close,0)},onKeyDown:p=>{j.keyDown(p)||p.key==="Enter"&&!p.shiftKey&&!p.nativeEvent.isComposing&&(p.preventDefault(),E())},role:"combobox","aria-expanded":j.open,"aria-controls":j.open?j.pickerId:void 0,"aria-activedescendant":j.open&&j.results.length?`${j.optionIdPrefix}-${j.activeIndex}`:void 0,"aria-autocomplete":"list","aria-describedby":[f,j.message?"chat-paper-mention-message":null].filter(Boolean).join(" ")||void 0}),t.jsx(V,{open:j.open,query:j.query,results:j.results,activeIndex:j.activeIndex,loading:j.loading,error:j.error,onSelect:j.select,id:j.pickerId,optionIdPrefix:j.optionIdPrefix})]}),j.message&&t.jsx("div",{id:"chat-paper-mention-message",className:"chat-paper-mention-message",role:"alert",children:j.message}),t.jsxs("div",{className:"chat-composer-row",children:[t.jsxs("div",{className:"chat-composer-tools",children:[l.length>0&&u&&m&&t.jsx(G,{models:l,selectedModel:u,onModelChange:m,disabled:s}),t.jsx("span",{className:"chat-composer-hint",children:"Enter to send · Shift+Enter for newline"})]}),t.jsx("button",{type:"button",className:`chat-send${s||y.text.trim()?" chat-send-on":""}`,onClick:s?a:E,disabled:h||(s?!a:!y.text.trim()),"aria-label":s?"Stop generating":"Send message",children:s?a?t.jsx("span",{"aria-hidden":"true",children:"■"}):t.jsx(A,{light:!0}):t.jsx(J,{})})]})]})},R=new Map,me=e=>{if(!e)return Promise.resolve();const s=R.get(e);if(s)return s;const n=new Promise(r=>{const i=new Image;i.onload=()=>{r()},i.onerror=()=>{R.delete(e),r()},i.src=e});return R.set(e,n),n},ge=new Set(["huggingface.co","www.huggingface.co"]),xe=new Set(["api","blog","chat","collections","docs","enterprise","join","login","models","new","organizations","papers","posts","pricing","search","settings","spaces","tasks"]);function fe(e){let s;try{s=new URL(e)}catch{return null}if(s.protocol!=="https:"||!ge.has(s.hostname))return null;const n=s.pathname.split("/").filter(Boolean),r=n[0]==="datasets"?"dataset":"model",i=r==="dataset"?n.slice(1):n;if(i.length!==2||r==="model"&&xe.has(i[0])||i.some(m=>!m||m==="."||m===".."))return null;const o=i.join("/"),a=i.map(encodeURIComponent).join("/"),l=r==="dataset"?`datasets/${a}`:a,u=r==="dataset"?"datasets":"models";return{type:r,repoId:o,url:`https://huggingface.co/${l}`,thumbnailUrl:`https://cdn-thumbnails.huggingface.co/social-thumbnails/${u}/${a}.png`}}const je=()=>typeof window.matchMedia=="function"&&window.matchMedia("(hover: none), (pointer: coarse)").matches,ye=({repo:e})=>{const[s,n]=x.useState(!1);return t.jsxs("div",{className:"hf-preview-card",children:[s?t.jsx("div",{className:"hf-preview-fallback","aria-hidden":"true",children:"🤗"}):t.jsx("img",{className:"hf-preview-image","data-testid":"hf-preview-image",src:e.thumbnailUrl,alt:"",loading:"eager",decoding:"async",onError:()=>n(!0)}),t.jsxs("div",{className:"hf-preview-meta",children:[t.jsxs("span",{className:"hf-preview-kind",children:["Hugging Face ",e.type]}),t.jsx("strong",{children:e.repoId}),t.jsx("span",{children:"huggingface.co"})]})]})},ve=({repo:e,children:s})=>{const[n,r]=x.useState(!1),i=x.useRef(null),o=x.useCallback(()=>{me(e.thumbnailUrl)},[e.thumbnailUrl]);return x.useEffect(()=>{const a=i.current;if(!a||typeof IntersectionObserver>"u")return;const l=new IntersectionObserver(([u])=>{u.isIntersecting&&(o(),l.disconnect())},{rootMargin:"200px"});return l.observe(a),()=>l.disconnect()},[o]),t.jsxs(te,{open:n,onOpenChange:a=>{(!a||!je())&&r(a)},openDelay:150,closeDelay:100,children:[t.jsx(se,{asChild:!0,children:t.jsx("a",{ref:i,className:"chat-paper-link chat-hf-link",href:e.url,target:"_blank",rel:"noopener noreferrer",onPointerEnter:o,onFocus:o,children:s})}),t.jsx(re,{className:"hf-preview-pop",side:"bottom",align:"start",collisionPadding:12,children:t.jsx(ye,{repo:e})})]})};function be(e,s,n){if(s)return{routeId:e,title:s.title,arxivId:s.metadata.arxiv_id,source:s.metadata.source,sourceUrl:s.metadata.source_url,thumbnailUrl:s.metadata.thumbnail_url,authors:s.metadata.authors.map(r=>r.name),published:s.metadata.published,conference:s.metadata.conference,citationCount:s.metadata.citation_count,tasks:s.metadata.tasks};if(n)return{routeId:e,title:n.title,arxivId:n.arxiv_id??null,source:n.arxiv_id?"arxiv":"external",sourceUrl:n.source_url,thumbnailUrl:n.thumbnail_url??null,authors:n.authors??[],published:n.published??null,conference:n.conference??null,citationCount:n.citation_count??null,tasks:[]}}const W=({routeId:e,paper:s,citation:n,className:r="chat-paper-link",children:i})=>t.jsx(z,{routeId:e,initialData:be(e,s,n),className:r,target:"_blank",children:i});function we(e){const s=e.lastIndexOf("[");if(s===-1)return e;const n=e.slice(s);return/^\[[^\]]*(\]\(?[^)\s]*)?$/.test(n)?e.slice(0,s):e}const _e=e=>e.startsWith("paper:")?e:ce(e),U=({text:e,streaming:s,papers:n,citations:r})=>{const i=s?we(e):e;return t.jsx(ie,{remarkPlugins:[oe,ae],rehypePlugins:[ne],urlTransform:_e,components:{a:({href:o,children:a})=>{if(o!=null&&o.startsWith("paper:")){const u=o.slice(6);return!n[u]&&!(r!=null&&r[u])?t.jsx("span",{className:"chat-invalid-citation",children:a}):t.jsx(W,{routeId:u,paper:n[u],citation:r==null?void 0:r[u],children:a})}const l=o?fe(o):null;return l?t.jsx(ve,{repo:l,children:a}):t.jsx("span",{children:a})}},children:i})};function ke(e){if(!e.authors.length)return"";const s=e.authors.slice(0,3).map(n=>n.name).join(", ");return e.authors.length>3?`${s}, et al.`:s}function Ne(e){var n;if(e.conference)return e.conference;const s=(n=e.published)==null?void 0:n.slice(0,4);if(e.arxiv_id)return s?`arXiv ${s}`:"arXiv";if(e.source_url)try{return new URL(e.source_url).hostname.replace(/^www\./,"")}catch{}return s??"external"}function Ie(e,s=240){const n=e.content.trim();return n.length<=s?n:`${n.slice(0,s).trimEnd()}…`}const Me="https://huggingface.co/pro",Se="https://huggingface.co/docs/inference-providers/pricing",X=()=>t.jsx("span",{className:"chat-caret"}),Ee=e=>{var n;if(!e.streaming)return!1;const s=(n=e.blocks)==null?void 0:n.at(-1);return s?s.kind==="reasoning"?!s.active:s.kind==="tool"?s.status!=="running":!1:!0},Pe=e=>{var v,c;if(e.button!==0||e.detail!==2)return;e.preventDefault();const s=e.currentTarget,n=s.ownerDocument,r=(v=n.caretPositionFromPoint)==null?void 0:v.call(n,e.clientX,e.clientY),i=r?null:(c=n.caretRangeFromPoint)==null?void 0:c.call(n,e.clientX,e.clientY),o=(r==null?void 0:r.offsetNode)??(i==null?void 0:i.startContainer),a=(r==null?void 0:r.offset)??(i==null?void 0:i.startOffset);if(!(o instanceof Text)||a===void 0||!s.contains(o))return;const l=o.data,u=/[\p{L}\p{M}\p{N}_'-]/u;let m=Math.min(a,l.length),h=m;for(;m>0&&u.test(l[m-1]);)m-=1;for(;h<l.length&&u.test(l[h]);)h+=1;if(m===h)return;const f=n.getSelection();if(!f)return;const w=n.createRange();w.setStart(o,m),w.setEnd(o,h),f.removeAllRanges(),f.addRange(w)},Ce=({text:e,mentions:s})=>{const n=[];let r=0;for(const i of[...s].sort((o,a)=>o.start-a.start)){const o=e.slice(i.start,i.end);i.start<r||i.end>e.length||!o.startsWith("@")||(n.push(e.slice(r,i.start)),n.push(t.jsxs("span",{className:"chat-inline-paper-mention",children:[t.jsx(K,{size:13,"aria-hidden":"true"}),t.jsx(z,{routeId:i.route_id,className:"chat-inline-paper-link",children:o.slice(1)})]},i.key)),r=i.end)}return n.push(e.slice(r)),t.jsx(t.Fragment,{children:n})},Te=({block:e,papers:s,citations:n,onToggle:r})=>e.active?t.jsxs("div",{className:"chat-reason-live",children:[t.jsxs("div",{className:"chat-reason-live-head",children:[t.jsx(A,{})," ",t.jsx("span",{children:"Thinking…"})]}),t.jsxs("div",{className:"chat-reason-live-body chat-answer chat-reason-markdown",children:[t.jsx(U,{text:e.text,streaming:!0,papers:s,citations:n}),t.jsx(X,{})]})]}):t.jsxs("div",{className:"chat-reason-done",children:[t.jsxs("button",{type:"button",className:"chat-reason-done-head",onClick:r,"aria-expanded":e.open,children:[t.jsx(Z,{}),t.jsx("span",{children:"Thought for a few seconds"}),t.jsx(O,{open:e.open})]}),e.open&&t.jsx("div",{className:"chat-reason-done-body chat-answer chat-reason-markdown",children:t.jsx(U,{text:e.text,papers:s,citations:n})})]}),$e=({block:e,papers:s,onToggle:n})=>{var h,f,w,v;const r=e.status==="running",i=e.schema_version===2||!!e.content,o=e.status==="error"||e.status==="denied",a=typeof e.args.query=="string"?e.args.query:"",l=typeof e.args.command=="string"?e.args.command:typeof e.args.file_path=="string"?e.args.file_path:a,u=((h=e.content)==null?void 0:h.map(c=>c.text).join(""))??"",m=r?"running…":i?`${e.status} · ${e.took_ms??0} ms`:`${e.hits} results · ${e.took_ms} ms`;return t.jsxs("div",{className:`chat-tool${r?" chat-tool-running":""}${o?" chat-tool-failed":""}`,children:[t.jsxs("button",{type:"button",className:"chat-tool-head",onClick:n,disabled:r,"aria-expanded":r?void 0:e.open,children:[t.jsxs("span",{className:"chat-tool-head-left",children:[r?t.jsx(A,{}):t.jsx(ee,{}),t.jsx("code",{className:"chat-tool-name",children:e.name}),t.jsx("span",{className:"chat-tool-query",children:i?l:`("${a}")`})]}),t.jsxs("span",{className:"chat-tool-head-right",children:[t.jsx("span",{className:"chat-tool-status",children:m}),!r&&t.jsx(O,{open:e.open})]})]}),!r&&e.open&&t.jsxs("div",{className:"chat-tool-body",children:[t.jsxs("div",{className:"chat-tool-args",children:[t.jsx("span",{className:"chat-tool-label",children:"arguments"}),t.jsx("pre",{children:JSON.stringify(e.args,null,2)})]}),i?t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"chat-tool-output-head",children:[t.jsx("span",{className:"chat-tool-label",children:"result"}),t.jsx("button",{type:"button",className:"chat-tool-copy",onClick:()=>void navigator.clipboard.writeText(u),children:"Copy"})]}),t.jsx("pre",{className:"chat-tool-output",children:t.jsx("code",{children:u})}),((f=e.metadata)==null?void 0:f.output_truncated)&&t.jsx("div",{className:"chat-tool-truncated",children:"Output was truncated."})]}):t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"chat-tool-label chat-tool-results-label",children:["returned ",((w=e.results)==null?void 0:w.length)??0," papers"]}),t.jsx("ol",{className:"chat-tool-results",children:(v=e.results)==null?void 0:v.map(c=>t.jsxs("li",{className:"chat-hit",children:[t.jsx("div",{className:"chat-hit-top",children:t.jsx(W,{routeId:c.route_id,paper:s[c.route_id],className:"chat-hit-title",children:c.title})}),t.jsx("div",{className:"chat-hit-meta",children:[ke(c.metadata),Ne(c.metadata)].filter(Boolean).join(" · ")}),t.jsxs("div",{className:"chat-hit-snippet",children:[Ie(c),c.content_truncated&&t.jsx("span",{className:"chat-hit-truncated",children:" (truncated)"})]})]},c.route_id))})]})]})]})},Fe=({block:e,papers:s,citations:n,streaming:r})=>t.jsxs("div",{className:"chat-answer",children:[t.jsx(U,{text:e.text,streaming:r,papers:s,citations:n}),r&&!!e.text.trim()&&t.jsx(X,{})]}),Y=e=>{const s=x.useRef(null),n=x.useCallback(()=>{const r=s.current;if(!r)return;r.style.height="auto";const i=Math.max(120,window.innerHeight*.4);r.style.height=`${Math.min(r.scrollHeight,i)}px`,r.style.overflowY=r.scrollHeight>i?"auto":"hidden"},[]);return x.useLayoutEffect(()=>{var r,i;(r=s.current)==null||r.focus(),(i=s.current)==null||i.setSelectionRange(e.length,e.length),n()},[n,e.length]),{textareaRef:s,resize:n}},Re=({id:e,text:s,editNotice:n,onCancel:r,onResend:i,onResendDraft:o})=>{const[a,l]=x.useState(s),[u,m]=x.useState(!1),{textareaRef:h,resize:f}=Y(s);x.useLayoutEffect(f,[f,a]);const w=!!a.trim()&&a.length<=8e3,v=()=>{if(!w||u)return;m(!0),((o==null?void 0:o({text:a,paperMentions:[]}))??(i==null?void 0:i(a))??!1)||m(!1)};return t.jsx("div",{className:"chat-msg chat-msg-user chat-msg-user-editing","data-message-id":e,children:t.jsxs("div",{className:"chat-inline-editor",children:[t.jsx("textarea",{ref:h,className:"chat-inline-editor-textarea","aria-label":"Edit message",value:a,maxLength:8e3,onChange:c=>l(c.target.value),onKeyDown:c=>{c.key==="Escape"?(c.preventDefault(),r==null||r()):c.key==="Enter"&&!c.shiftKey&&!c.nativeEvent.isComposing&&(c.preventDefault(),v())}}),n&&t.jsx("div",{className:"chat-inline-editor-notice",children:n}),t.jsxs("div",{className:"chat-inline-editor-actions",children:[t.jsx("button",{type:"button",onClick:r,children:"Cancel"}),t.jsx("button",{type:"button",className:"chat-inline-editor-send",disabled:!w||u,onClick:v,children:"Send"})]})]})})},Ue=({id:e,text:s,paperMentions:n,enabled:r,editNotice:i,onCancel:o,onResend:a,onResendDraft:l})=>{const[u,m]=x.useState({text:s,paperMentions:n}),[h,f]=x.useState(!1),{textareaRef:w,resize:v}=Y(s),c=B({draft:u,onChange:m,enabled:r,textareaRef:w});x.useLayoutEffect(v,[v,u.text]);const y=!!u.text.trim()&&u.text.length<=8e3&&(r||u.paperMentions.length===0),_=()=>{if(!y||h)return;f(!0),((l==null?void 0:l(u))??(a==null?void 0:a(u.text))??!1)||f(!1)};return t.jsx("div",{className:"chat-msg chat-msg-user chat-msg-user-editing","data-message-id":e,children:t.jsxs("div",{className:"chat-inline-editor",children:[t.jsx("textarea",{ref:w,className:"chat-inline-editor-textarea","aria-label":"Edit message",value:u.text,maxLength:8e3,role:"combobox","aria-autocomplete":"list","aria-expanded":c.open,"aria-controls":c.open?c.pickerId:void 0,"aria-activedescendant":c.open&&c.results.length?`${c.optionIdPrefix}-${c.activeIndex}`:void 0,onChange:b=>c.updateText(b.target.value,b.target.selectionStart),onSelect:b=>c.refresh(b.currentTarget.selectionStart),onKeyDown:b=>{c.keyDown(b)||(b.key==="Escape"?(b.preventDefault(),o==null||o()):b.key==="Enter"&&!b.shiftKey&&!b.nativeEvent.isComposing&&(b.preventDefault(),_()))}}),t.jsx(V,{open:c.open,query:c.query,results:c.results,activeIndex:c.activeIndex,loading:c.loading,error:c.error,onSelect:c.select,id:c.pickerId,optionIdPrefix:c.optionIdPrefix}),u.paperMentions.length>0&&t.jsx("div",{className:"chat-paper-chips",children:u.paperMentions.map(b=>t.jsxs("span",{className:"chat-paper-chip",children:[t.jsx(K,{"aria-hidden":"true"}),b.title,t.jsx("button",{type:"button",onClick:()=>c.remove(b.key),"aria-label":`Remove ${b.title}`,children:"×"})]},b.key))}),!r&&u.paperMentions.length>0&&t.jsx("div",{className:"chat-inline-editor-notice",role:"status",children:"Paper mentions are currently disabled. Remove them before sending."}),i&&t.jsx("div",{className:"chat-inline-editor-notice",children:i}),t.jsxs("div",{className:"chat-inline-editor-actions",children:[t.jsx("button",{type:"button",onClick:o,children:"Cancel"}),t.jsx("button",{type:"button",className:"chat-inline-editor-send",disabled:!y||h,onClick:_,children:"Send"})]})]})})},Be=({id:e,text:s,paperMentions:n=[],paperMentionsEnabled:r=!1,editingAllowed:i=!1,editing:o=!1,editNotice:a,onEdit:l,onCancel:u,onResend:m,onResendDraft:h})=>o?!r&&n.length===0?t.jsx(Re,{id:e,text:s,editNotice:a,onCancel:u,onResend:m,onResendDraft:h}):t.jsx(Ue,{id:e,text:s,paperMentions:n,enabled:r,editNotice:a,onCancel:u,onResend:m,onResendDraft:h}):t.jsx("div",{className:"chat-msg chat-msg-user","data-message-id":e,children:t.jsxs("div",{className:"chat-user-message-wrap",children:[t.jsx("div",{className:"chat-bubble",children:t.jsx("span",{className:"chat-bubble-text",onMouseDown:Pe,children:t.jsx(Ce,{text:s,mentions:n})})}),i&&t.jsx("div",{className:"chat-user-actions",children:t.jsx("button",{type:"button",className:"chat-user-edit","aria-label":"Edit message",title:"Edit",onClick:l,children:t.jsx(ue,{"aria-hidden":"true"})})})]})}),We=({msg:e,papers:s,onToggleBlock:n,onArchiveOldChats:r,onArchiveOldestChats:i,archivePending:o=null,hfBilling:a=null})=>{var l,u;return t.jsx("div",{className:"chat-msg chat-msg-assistant",children:t.jsxs("div",{className:"chat-msg-blocks",children:[(l=e.blocks)==null?void 0:l.map((m,h)=>{var c;const f=`${e.id}-${h}`,w="citations"in m&&m.citations!==void 0?m.citations:e.citations??[],v=Object.fromEntries(w.map(y=>[y.route_id,y]));return m.kind==="reasoning"?t.jsx(Te,{block:m,papers:s,citations:v,onToggle:()=>n(e.id,h)},f):m.kind==="tool"?t.jsx($e,{block:m,papers:s,onToggle:()=>n(e.id,h)},f):t.jsx(Fe,{block:m,papers:s,citations:v,streaming:!!(e.streaming&&h===(((c=e.blocks)==null?void 0:c.length)??0)-1)},f)}),Ee(e)&&t.jsx("div",{className:"chat-waiting",role:"status","aria-live":"polite",children:t.jsx("span",{className:"chat-thinking",children:(((u=e.blocks)==null?void 0:u.length)??0)===0?e.status??"Thinking…":"Thinking…"})}),e.error&&t.jsxs("div",{className:"chat-error",children:[t.jsx("span",{children:e.errorCode==="chat_disabled_interrupted"?"Chat was disabled while this response was running. The partial response is saved. Please try again later.":e.errorCode==="chat_session_quota_exceeded"?e.error:`The assistant hit an error: ${e.error}`}),["hf_inference_billing_required","hf_inference_credential_expired"].includes(e.errorCode??"")&&t.jsx("a",{href:"/settings",children:e.errorCode==="hf_inference_billing_required"?"Authorize HF in Settings":e.errorCode==="hf_inference_credential_expired"?"Reconnect Hugging Face":"Review billing settings"}),e.errorCode==="hf_inference_billing_exhausted"&&t.jsxs(t.Fragment,{children:[(a==null?void 0:a.account_type)==="Free"&&!a.bill_to?t.jsx("a",{href:Me,target:"_blank",rel:"noreferrer",children:"Upgrade to Hugging Face PRO — $9/month for 20× more included credits"}):t.jsx("a",{href:(a==null?void 0:a.usage_url)??"/settings",target:a?"_blank":void 0,rel:a?"noreferrer":void 0,children:"Review Hugging Face usage and billing"}),t.jsx("a",{href:Se,target:"_blank",rel:"noreferrer",children:"Inference Providers pricing and billing details"})]}),e.errorCode==="openrouter_monthly_budget_exhausted"&&t.jsxs(t.Fragment,{children:[t.jsx("a",{href:"/settings#openrouter-byok",children:"Use your own OpenRouter key"}),t.jsx("span",{children:"Or select a Hugging Face-backed model and explicitly retry."})]}),e.errorCode==="openrouter_unavailable"&&t.jsxs(t.Fragment,{children:[t.jsx("a",{href:"/settings#openrouter-byok",children:"Bring your own key in Settings"}),t.jsx("a",{href:"https://github.com/huggingface/paperswithcode-feedback",target:"_blank",rel:"noreferrer",children:"File an issue"})]}),e.errorCode==="openrouter_byok_billing_error"&&t.jsx("a",{href:"https://openrouter.ai/settings/credits",target:"_blank",rel:"noreferrer",children:"Review OpenRouter billing"}),["openrouter_byok_credential_invalid","openrouter_byok_rate_limit"].includes(e.errorCode??"")&&t.jsx("a",{href:"/settings#openrouter-byok",children:"Review OpenRouter settings"}),e.errorCode==="chat_session_quota_exceeded"&&(r||i)&&t.jsxs("span",{className:"chat-error-actions",children:[r&&t.jsx("button",{type:"button",disabled:o!==null,onClick:r,children:o==="old"?"Archiving…":"Archive chats older than 30 days"}),i&&t.jsx("button",{type:"button",disabled:o!==null,onClick:i,children:o==="oldest"?"Archiving…":"Archive oldest 50 chats"})]})]}),!e.streaming&&e.finishReason&&e.finishReason!=="success"&&t.jsx("div",{className:"chat-finish-note",children:["tool_limit","max_turns"].includes(e.finishReason)?"The assistant stopped at the execution limit.":`The assistant stopped early (${e.finishReason.replace(/_/g," ")}).`})]})})};export{We as A,Ve as C,Be as U};
|
assets/ChatView-CARCFhWo.js
DELETED
|
@@ -1,16 +0,0 @@
|
|
| 1 |
-
import{d as It,e as Ee,r as o,j as t,f as Nt,u as Lt,a as At,g as Dt,h as Pt,k as Yt,l as Mt,b as Ft,X as Ut,c as qt}from"./index-NKCYgxaj.js";import{u as it}from"./useQuery--AC_S866.js";import{C as ot,U as ct,A as Bt}from"./ChatMessage-CsmlLd6Q.js";import{a as Ht,g as Ke,t as wt,r as Kt,S as Wt,P as Vt,D as Gt,l as $t,C as Fe,b as Ue,d as qe,e as Be,f as zt,h as Qt,i as Jt,j as lt,k as Xt,T as Zt,m as dt,u as ut,n as en,o as tn,p as nn,s as rn}from"./chatSessions-Bv5yO1zx.js";import{S as sn}from"./chatPrompts-CDY3UGU1.js";import{u as an,O as on,a as cn,b as ln,r as dn}from"./openrouter-DQ35bOlk.js";import"./katex.min-BSBacQyE.js";import"./hover-card-Z7w-9YtT.js";import"./PaperPreviewLink-syrag20a.js";import"./index-S59lkwkS.js";/**
|
| 2 |
-
* @license lucide-react v0.462.0 - ISC
|
| 3 |
-
*
|
| 4 |
-
* This source code is licensed under the ISC license.
|
| 5 |
-
* See the LICENSE file in the root directory of this source tree.
|
| 6 |
-
*/const un=It("Share2",[["circle",{cx:"18",cy:"5",r:"3",key:"gq8acd"}],["circle",{cx:"6",cy:"12",r:"3",key:"w7nqdw"}],["circle",{cx:"18",cy:"19",r:"3",key:"1xt0gg"}],["line",{x1:"8.59",x2:"15.42",y1:"13.51",y2:"17.49",key:"47mynk"}],["line",{x1:"15.41",x2:"8.59",y1:"6.51",y2:"10.49",key:"1n3mei"}]]),q=(c,h)=>new Promise(d=>{const S=setTimeout(f,c);function f(){h==null||h.removeEventListener("abort",f),clearTimeout(S),d()}h==null||h.addEventListener("abort",f)}),Z=c=>({arxiv_id:null,source:"arxiv",source_url:null,thumbnail_url:null,authors:[],published:null,conference:null,citation_count:null,tasks:[],methods:[],repositories:[],project_pages:[],...c}),ee={name:"Object Detection",slug:"object-detection"},re={name:"Real-Time Object Detection",slug:"real-time-object-detection"},hn={"2502.12524":{route_id:"2502.12524",title:"YOLOv12: Attention-Centric Real-Time Object Detectors",content:"Enhancing the network architecture of the YOLO framework has been crucial for a long time. This work introduces an attention-centric YOLO framework, namely YOLOv12, built around area attention and residual efficient layer aggregation networks (R-ELAN). YOLOv12-N reaches 40.6 mAP at 1.64 ms on a T4 GPU, closing the gap to attention-based detectors without the usual latency penalty and surpassing YOLOv10/YOLOv11 by +1.2–1.6 mAP at matched latency.",content_truncated:!1,metadata:Z({arxiv_id:"2502.12524",authors:[{name:"Y. Tian"},{name:"Q. Ye"},{name:"D. Doermann"}],published:"2025-02-18",citation_count:412,tasks:[ee,re],methods:[{name:"Area Attention",slug:"area-attention"}],repositories:[{url:"https://github.com/sunsmarterjie/yolov12",stars:18700}]})},"2407.17140":{route_id:"2407.17140",title:"RT-DETRv2: Improved Baseline with Bag-of-Freebies for Real-Time Detection",content:"RT-DETRv2 improves the real-time DETR baseline with selective multi-scale feature extraction, a discrete sampling operator to ease deployment, and training-only 'bag-of-freebies' that add no inference cost. RT-DETRv2-R18/R50/R101 reach 47.9 / 53.4 / 54.3 mAP on COCO at 217 / 108 / 74 FPS on T4 TensorRT FP16, remaining NMS-free end to end.",content_truncated:!1,metadata:Z({arxiv_id:"2407.17140",authors:[{name:"W. Lv"},{name:"Y. Zhao"},{name:"J. Chang"}],published:"2024-07-24",citation_count:268,tasks:[ee,re],methods:[{name:"DETR",slug:"detr"}],repositories:[{url:"https://github.com/lyuwenyu/RT-DETR",stars:9400}]})},"2410.13842":{route_id:"2410.13842",title:"D-FINE: Redefining Regression as Fine-grained Distribution Refinement",content:"D-FINE reformulates bounding-box regression in DETR-style detectors as iterative refinement of probability distributions (FDR) and adds a localization self-distillation scheme (GO-LSD). D-FINE-L reaches 54.0 mAP at ~9 ms and D-FINE-X 55.8 mAP on COCO while staying real-time on modern GPUs, dominating RT-DETRv2 and YOLOv10 on the accuracy–latency Pareto front.",content_truncated:!1,metadata:Z({arxiv_id:"2410.13842",authors:[{name:"Y. Peng"},{name:"H. Li"},{name:"P. Wu"}],published:"2024-10-17",conference:"ICLR 2025",citation_count:187,tasks:[ee,re],methods:[{name:"Knowledge Distillation",slug:"knowledge-distillation"}],repositories:[{url:"https://github.com/Peterande/D-FINE",stars:12100}]})},"2406.03459":{route_id:"2406.03459",title:"LW-DETR: A Transformer Replacement to YOLO for Real-Time Detection",content:"LW-DETR pairs a plain ViT encoder with a lightweight DETR decoder and shows the combination outperforms YOLOv8 and YOLO-NAS at comparable latency, arguing transformer detectors are viable even at the fast end of the accuracy–latency curve. Uses multi-level feature aggregation, window-attention interleaving, and IoU-aware classification.",content_truncated:!1,metadata:Z({arxiv_id:"2406.03459",authors:[{name:"Q. Chen"},{name:"X. Su"},{name:"X. Zhang"}],published:"2024-06-05",citation_count:94,tasks:[ee,re],methods:[{name:"Vision Transformer",slug:"vision-transformer"}],repositories:[{url:"https://github.com/Atten4Vis/LW-DETR",stars:5200}]})},"2304.08069":{route_id:"2304.08069",title:"DETRs Beat YOLOs on Real-time Object Detection",content:"RT-DETR is the first real-time end-to-end object detector, built on an efficient hybrid encoder that decouples intra-scale interaction and cross-scale fusion, plus IoU-aware query selection. RT-DETR-R50 achieves 53.1 mAP at 108 FPS on COCO, beating comparably sized YOLO detectors in both speed and accuracy while eliminating NMS entirely; its Figure 1 accuracy–latency plot became the reference for later real-time detectors.",content_truncated:!1,metadata:Z({arxiv_id:"2304.08069",authors:[{name:"Y. Zhao"},{name:"W. Lv"},{name:"S. Xu"}],published:"2023-04-17",conference:"CVPR 2024",citation_count:2310,tasks:[ee,re],methods:[{name:"DETR",slug:"detr"}],repositories:[{url:"https://github.com/lyuwenyu/RT-DETR",stars:9400}]})},"2405.14458":{route_id:"2405.14458",title:"YOLOv10: Real-Time End-to-End Object Detection",content:"YOLOv10 removes NMS from the YOLO pipeline via consistent dual assignments during training and applies a holistic efficiency–accuracy driven design across the architecture. YOLOv10-S is 1.8x faster than RT-DETR-R18 at similar COCO accuracy; the family spans 46.3–54.4 mAP with substantially lower end-to-end latency than prior YOLOs because post-processing disappears.",content_truncated:!1,metadata:Z({arxiv_id:"2405.14458",authors:[{name:"A. Wang"},{name:"H. Chen"},{name:"L. Liu"}],published:"2024-05-23",conference:"NeurIPS 2024",citation_count:1650,tasks:[ee,re],methods:[{name:"NMS-free Training",slug:"nms-free-training"}],repositories:[{url:"https://github.com/THU-MIG/yolov10",stars:44200}]})},"2401.17270":{route_id:"2401.17270",title:"YOLO-World: Real-Time Open-Vocabulary Object Detection",content:"YOLO-World extends the YOLO paradigm to open-vocabulary detection through vision-language modeling with a re-parameterizable vision-language path aggregation network (RepVL-PAN) and region-text contrastive pretraining. It detects categories never seen at training time while running at 35+ FPS, and its prompt-then-detect deployment re-parameterizes text embeddings for zero runtime text-encoder cost.",content_truncated:!1,metadata:Z({arxiv_id:"2401.17270",authors:[{name:"T. Cheng"},{name:"L. Song"},{name:"Y. Ge"}],published:"2024-01-30",conference:"CVPR 2024",citation_count:890,tasks:[{name:"Open-Vocabulary Object Detection",slug:"open-vocabulary-object-detection"},ee],methods:[{name:"Contrastive Learning",slug:"contrastive-learning"}],repositories:[{url:"https://github.com/AILab-CVC/YOLO-World",stars:16800}]})},158342:{route_id:"158342",title:"Ultralytics YOLO: real-time detection framework and model zoo",content:"Official Ultralytics framework release covering YOLO11 and YOLOv12 deployment: pretrained COCO checkpoints from nano to x-large, TensorRT/ONNX/CoreML export paths, and reproducible latency benchmarks on T4, Jetson Orin, and CPU targets. Widely used as the practical baseline for real-time detection deployments.",content_truncated:!1,metadata:Z({source:"external",source_url:"https://docs.ultralytics.com/models/",authors:[{name:"Ultralytics"}],published:"2025-01-02",tasks:[ee,re],repositories:[{url:"https://github.com/ultralytics/ultralytics",stars:46e3}],project_pages:[{url:"https://docs.ultralytics.com"}]})}},_t=c=>c.map(h=>hn[h]),ht=_t(["2502.12524","2407.17140","2410.13842","2406.03459","2304.08069","2405.14458","2401.17270","158342"]),ft=_t(["2410.13842","2502.12524","2407.17140","2405.14458","2304.08069"]),pt="The user wants the current state-of-the-art for real-time object detection. That's a moving target split across two lineages — the YOLO family (fast CNN one-stage detectors) and the DETR family (transformer, end-to-end, NMS-free). I should ground the answer in recent papers benchmarked on COCO with reported latency or FPS, not just accuracy. Let me start with a broad hybrid search, see which papers surface, then run a second, narrower query to pin down the head-to-head COCO mAP vs latency trade-offs before I write anything.",mt="Good — both lineages are well represented. YOLOv12, YOLOv10 and RT-DETRv2 / D-FINE keep coming up. To actually rank them I need the accuracy-vs-latency numbers side by side on the same COCO val2017 protocol, so let me narrow the query to the benchmark comparison specifically.",gt=`There isn't a single winner — real-time object detection in 2026 is a two-horse race between the [YOLO family](paper:2502.12524) (fast one-stage CNNs) and the end-to-end [DETR family](paper:2304.08069) (NMS-free transformers). Which one is “SOTA” depends entirely on where you sit on the accuracy-vs-latency curve.
|
| 7 |
-
|
| 8 |
-
**At the fast / edge end**, [YOLOv12](paper:2502.12524) is the current leader. Its area-attention design pushes attention into the YOLO backbone without the usual latency hit — YOLOv12-N reaches 40.6 mAP at ~1.6 ms on a T4, roughly +1.5 mAP over [YOLOv10](paper:2405.14458) at matched speed. [YOLOv10](paper:2405.14458) is still very relevant because it made the YOLO head NMS-free, cutting real end-to-end latency.
|
| 9 |
-
|
| 10 |
-
**At the high-accuracy end**, the transformer detectors win. [D-FINE](paper:2410.13842) currently holds the accuracy-latency Pareto front, reporting 55.8 mAP by reformulating box regression as fine-grained distribution refinement with self-distillation. It builds on [RT-DETRv2](paper:2407.17140), which hardened the [original RT-DETR](paper:2304.08069) recipe (the paper that first showed DETRs beating YOLOs in real time) with training-only “bag-of-freebies” that add no inference cost.
|
| 11 |
-
|
| 12 |
-
**My recommendation:** for edge or high-FPS deployment, start with [YOLOv12](paper:2502.12524) — the [Ultralytics framework](paper:158342) has ready-made checkpoints and export paths. If you have GPU headroom and want maximum accuracy while staying real-time, use [D-FINE](paper:2410.13842) or [RT-DETRv2](paper:2407.17140). And if you need open-vocabulary detection rather than fixed COCO classes, [YOLO-World](paper:2401.17270) is the one to look at.`,fn=["How do these compare on edge devices like Jetson?","Show me open-vocabulary detectors","What about small-object detection?"];async function*pn(c,h){const d=()=>(h==null?void 0:h.aborted)===!0,S=c.trim().slice(0,90)||"state-of-the-art real-time object detection";if(yield{type:"stream_start",request_id:"req_mock",session_id:null},await q(350,h),!d()){yield{type:"reasoning_start"};for(let f=0;f<pt.length;f+=6){if(await q(14,h),d())return;yield{type:"reasoning_delta",text:pt.slice(f,f+6)}}if(await q(400,h),!d()&&(yield{type:"reasoning_end"},await q(300,h),!d()&&(yield{type:"tool_call",id:"call_1",name:"search_papers",args:{query:S,top_k:8}},await q(1100,h),!d()&&(yield{type:"tool_result",id:"call_1",hits:ht.length,took_ms:214,results:ht},await q(350,h),!d())))){yield{type:"reasoning_start"};for(let f=0;f<mt.length;f+=6){if(await q(14,h),d())return;yield{type:"reasoning_delta",text:mt.slice(f,f+6)}}if(await q(350,h),!d()&&(yield{type:"reasoning_end"},await q(300,h),!d()&&(yield{type:"tool_call",id:"call_2",name:"search_papers",args:{query:"RT-DETR vs YOLOv12 COCO mAP latency FPS T4 TensorRT comparison",top_k:5}},await q(900,h),!d()&&(yield{type:"tool_result",id:"call_2",hits:ft.length,took_ms:176,results:ft},await q(400,h),!d())))){for(let f=0;f<gt.length;f+=4){if(await q(11,h),d())return;yield{type:"answer_delta",text:gt.slice(f,f+4)}}yield{type:"done",followups:fn,finish_reason:"success"}}}}}const fe=()=>{const h=String("0").trim().toLowerCase();return h==="1"||h==="true"||h==="yes"};class _e extends Error{constructor(h,d,S,f){super(h),this.code=d,this.status=S,this.retryAfterSeconds=f,this.name="ChatStreamError"}}function mn(c,h){if(fe())try{fetch(Ee(`/api/v1/chat/latency/${encodeURIComponent(c)}`),{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",keepalive:!0,body:JSON.stringify(h)}).catch(()=>{})}catch{}}function gn(c,h={}){return fe()?yn(c,h.signal):pn(c.message,h.signal)}async function*yn(c,h){const d=await fetch(Ee("/api/v1/chat/stream"),{method:"POST",headers:{"Content-Type":"application/json",Accept:"text/event-stream"},credentials:"include",body:JSON.stringify(c),signal:h});if(!d.ok||!d.body){const _=await d.json().catch(()=>null),R=_==null?void 0:_.detail,k=d.status===403&&!R,x=Number(d.headers.get("Retry-After")),L=Number.isFinite(x)&&x>=0?Math.min(300,Math.ceil(x)):void 0;throw new _e(k?"Chat on staging is limited to approved Hugging Face users. Sign in with an approved account and try again.":(R==null?void 0:R.message)||R||`Chat stream failed (${d.status})`,(R==null?void 0:R.code)||(k?"staging_access_required":void 0),d.status,L)}const S=d.body.getReader(),f=new TextDecoder;let T="";try{for(;;){const{done:_,value:R}=await S.read();if(_)break;T+=f.decode(R,{stream:!0});let k;for(;(k=T.indexOf(`
|
| 13 |
-
|
| 14 |
-
`))!==-1;){const x=T.slice(0,k);T=T.slice(k+2);const L=x.split(`
|
| 15 |
-
`).filter(C=>C.startsWith("data:")).map(C=>C.slice(5).trimStart()).join(`
|
| 16 |
-
`);!L||L==="[DONE]"||(yield JSON.parse(L))}}}finally{S.releaseLock()}}const Rt="Preparing research workspace…",bn=750;function we(c){if(c.status!==Rt)return c;const{status:h,...d}=c;return d}function He(c,h){for(let d=c.length-1;d>=0;d-=1)if(h(c[d]))return d;return-1}function vn(c){const[h,d]=o.useState([]),[S,f]=o.useState(!1),[T,_]=o.useState(""),R=o.useRef(!1),k=o.useRef(null),x=o.useRef(null),L=o.useRef("cleared"),C=o.useRef(null),A=o.useRef(null),[z,V]=o.useState(null),[Re,se]=o.useState(null),E=o.useRef([]),y=o.useRef(c),G=o.useRef(""),ae=o.useRef(""),je=o.useRef(0),j=o.useRef(0),H=o.useRef(c.sessionId),ie=o.useRef(c.sessionId);ie.current!==c.sessionId&&(ie.current=c.sessionId,H.current!==c.sessionId&&(j.current+=1,C.current=null)),y.current=c,E.current=h,o.useEffect(()=>()=>{var n;x.current!==null&&window.clearTimeout(x.current),(n=k.current)==null||n.abort(),A.current=null},[]),o.useEffect(()=>{R.current||(H.current=c.sessionId)},[c.sessionId]);const Ie=o.useMemo(()=>{const n={};for(const a of h)for(const i of a.blocks??[])if(i.kind==="tool")for(const l of i.results??[])n[l.route_id]=l;return n},[h]),D=()=>`m${++je.current}_${Date.now().toString(36)}`,I=n=>d(a=>{if(!a.length)return a;const i=a.slice();return i[i.length-1]=n(i[i.length-1]),i}),M=n=>I(a=>{const i=we(a);return{...i,blocks:[...i.blocks??[],n]}}),pe=(n,a)=>I(i=>{const l=we(i);return{...l,blocks:(l.blocks??[]).map((p,g,b)=>n(p,g,b)?a(p):p)}}),xe=n=>(a,i,l)=>a.kind===n&&He(l,p=>p.kind===n)===i,oe=n=>{if(k.current!==n||(x.current!==null&&(window.clearTimeout(x.current),x.current=null),L.current==="cleared"))return;const a=L.current==="shown";L.current="cleared",a&&I(we)},F=(n,a)=>{n.requestId&&mn(n.requestId,a)},ce=(n,a)=>{const i=C.current;!i||i.controller!==n||(i.requestId=a,i.streamStartReported||(i.streamStartReported=!0,F(i,{submission_to_stream_start_ms:Math.max(0,performance.now()-i.submittedAt)})),i.firstVisibleAt!==void 0&&!i.firstVisibleReported&&(i.firstVisibleReported=!0,F(i,{submission_to_first_visible_delta_ms:Math.max(0,i.firstVisibleAt-i.submittedAt)})))},N=(n,a)=>{const i=C.current;!i||i.controller!==n||i.terminalReported||(i.terminalReported=!0,F(i,{terminal_classification:a}))};o.useLayoutEffect(()=>{const n=C.current;if(!n||n.firstVisibleAt!==void 0)return;const a=h.at(-1);(a==null?void 0:a.role)!=="assistant"||!(a.blocks??[]).some(l=>l.kind==="tool"||l.kind==="reasoning"&&!!l.text.trim()||l.kind==="answer"&&!!l.text.trim())||(n.firstVisibleAt=performance.now(),n.requestId&&!n.firstVisibleReported&&(n.firstVisibleReported=!0,F(n,{submission_to_first_visible_delta_ms:Math.max(0,n.firstVisibleAt-n.submittedAt)})))},[h]);const K=n=>{switch(n.type){case"stream_start":n.session_id&&(H.current=n.session_id,y.current.onSessionId(n.session_id));break;case"sandbox_start":case"sandbox_ready":case"workspace_ready":break;case"session_title_start":ae.current="";break;case"session_title_delta":ae.current+=n.text,y.current.onTitle(ae.current.replace(/\s+/g," ").slice(0,80));break;case"session_title_done":ae.current=n.title,y.current.onTitle(n.title);break;case"reasoning_start":I(a=>{const i=we(a);return{...i,blocks:[...(i.blocks??[]).map(l=>l.kind==="reasoning"&&l.active?{...l,active:!1,open:!1}:l),{kind:"reasoning",text:"",active:!0,open:!0}]}});break;case"reasoning_delta":pe(xe("reasoning"),a=>a.kind==="reasoning"?{...a,text:a.text+n.text}:a);break;case"reasoning_end":I(a=>{const i=a.blocks??[],l=He(i,b=>b.kind==="reasoning"&&b.active);if(l<0)return a;const p=i[l];if(p.kind!=="reasoning")return a;const g=i[l-1];return(g==null?void 0:g.kind)==="reasoning"&&g.text===p.text?{...a,blocks:i.filter((b,v)=>v!==l)}:{...a,blocks:i.map((b,v)=>v===l?{...p,active:!1,open:!1}:b)}});break;case"tool_call":M({kind:"tool",id:n.id,name:n.name,args:n.args,status:"running",open:!1});break;case"tool_result":pe(a=>a.kind==="tool"&&a.id===n.id,a=>a.kind==="tool"?n.status?{...a,schema_version:2,status:n.status,took_ms:n.took_ms,content:n.content,metadata:n.metadata,open:n.status!=="success"}:{...a,status:"done",hits:n.hits,took_ms:n.took_ms,results:n.results}:a);break;case"answer_delta":I(a=>{const i=we(a),l=i.blocks??[],p=l.at(-1);return(p==null?void 0:p.kind)==="answer"&&!p.done?{...i,blocks:[...l.slice(0,-1),{...p,text:p.text+n.text}]}:{...i,blocks:[...l,{kind:"answer",text:n.text,done:!1}]}});break;case"done":I(a=>({...a,streaming:!1,followups:n.followups,finishReason:n.finish_reason,citations:n.citations,blocks:(a.blocks??[]).map(i=>i.kind==="answer"?{...i,done:!0}:i.kind==="reasoning"&&i.active?{...i,active:!1,open:!1}:i)}));break;case"error":I(a=>({...a,streaming:!1,error:n.message,errorCode:n.code,blocks:(a.blocks??[]).map(i=>i.kind==="reasoning"&&i.active?{...i,active:!1,open:!1}:i)}));break}},te=async(n,a)=>{const i=await Ke(n),l=wt(i);return j.current!==a?null:(d(l),E.current=l,l)},Q=(n,a,i,l,p)=>{const g=++j.current;R.current=!0;const b=new AbortController;return k.current=b,G.current=n,H.current=a.session_id,_(""),d(i),f(!0),C.current={controller:b,submittedAt:performance.now(),streamStartReported:!1,firstVisibleReported:!1,terminalReported:!1},x.current!==null&&window.clearTimeout(x.current),L.current="armed",x.current=window.setTimeout(()=>{x.current=null,!(L.current!=="armed"||k.current!==b||b.signal.aborted||j.current!==g)&&(L.current="shown",I(v=>{var Y;return v.role==="assistant"&&v.streaming&&(((Y=v.blocks)==null?void 0:Y.length)??0)===0&&!v.error?{...v,status:Rt}:v}))},bn),(async()=>{var $,ue,X;let v=!1,Y=!1,P=!1,J=!1,B=!1,U=!1;try{for await(const m of gn(a,{signal:b.signal})){m.type==="stream_start"&&(v=!0,Y=m.provider_execution!==!1,ce(b,m.request_id)),(m.type==="workspace_ready"||m.type==="reasoning_start"||m.type==="reasoning_delta"||m.type==="tool_call"||m.type==="answer_delta"||m.type==="done"||m.type==="error")&&oe(b),(m.type==="done"||m.type==="error")&&(J=!0,B=m.type==="error",N(b,m.type==="error"?"error":"complete"),m.type==="error"&&["openrouter_monthly_budget_exhausted","openrouter_unavailable","openrouter_byok_credential_invalid","openrouter_byok_billing_error","openrouter_byok_rate_limit"].includes(m.code??"")&&(P=!0,y.current.onInterrupted(n)));const u=j.current===g;!b.signal.aborted&&(u||m.type==="stream_start"||m.type==="session_title_start"||m.type==="session_title_delta"||m.type==="session_title_done")&&K(m)}}catch(m){if(B=!0,!b.signal.aborted){if(oe(b),m instanceof _e&&m.code==="chat_temporarily_disabled")U=!0,se({question:n}),j.current===g&&(d(l),E.current=l,_(""));else if(m instanceof _e&&m.code==="chat_capacity"){U=!0;const u=m.retryAfterSeconds??5,ne={question:n,request:a,optimistic:i,original:l,edit:p,retryAfterSeconds:u,retryAt:Date.now()+u*1e3};A.current=ne,V({question:n,retryAt:ne.retryAt,retryAfterSeconds:u}),j.current===g&&(d(l),E.current=l,_(""))}else N(b,"network_error"),m instanceof _e&&["openrouter_monthly_budget_exhausted","openrouter_unavailable","openrouter_byok_credential_invalid","openrouter_byok_billing_error","openrouter_byok_rate_limit"].includes(m.code??"")&&(P=!0,y.current.onInterrupted(n));!U&&j.current===g&&K({type:"error",message:m instanceof Error?m.message:"The assistant stream failed.",code:m instanceof _e?m.code:void 0})}}finally{if(k.current===b){if(oe(b),!J&&!b.signal.aborted&&N(b,"network_error"),R.current=!1,f(!1),U)y.current.onSettled(a.session_id);else if(!b.signal.aborted){(v&&Y||P)&&((ue=($=y.current).onProviderTerminal)==null||ue.call($));const m=H.current;if(p&&!v)j.current===g&&(d(p.snapshot),E.current=p.snapshot,_("Couldn’t resend this message. Your original conversation was restored."));else if(m){j.current===g&&p&&!p.first&&(B||!J)&&(d(p.snapshot),E.current=p.snapshot);try{const u=await te(m,g);u&&p&&!p.first&&u.some(ne=>ne.id===p.targetId)&&_("Couldn’t resend this message. Your original conversation was restored.")}catch{j.current===g&&I(u=>u.streaming?{...u,streaming:!1}:u)}}else j.current===g&&I(u=>u.streaming?{...u,streaming:!1}:u);y.current.onSettled(m)}((X=C.current)==null?void 0:X.controller)===b&&(C.current=null)}}})(),!0},ke=o.useCallback(n=>{const a=n.trim();if(!a||a.length>8e3||R.current||A.current)return!1;const i=E.current,l=[...i].reverse().find(P=>P.role==="user"),p=l!=null&&l.status&&l.status!=="complete"&&l.revision?{replace_message_id:l.id,prior_revision:l.revision}:null,g={id:D(),role:"user",text:a},b={id:D(),role:"assistant",streaming:!0,blocks:[]},v=p&&l?He(i,P=>P.id===l.id):-1,Y=v<0?[...i,g,b]:[...i.slice(0,v),g,b];return Q(a,{message:a,session_id:y.current.sessionId,client_message_id:crypto.randomUUID(),...!y.current.sessionId&&y.current.initialModel?{initial_model:y.current.initialModel}:{},...p??{}},Y,i)},[]),me=o.useCallback((n,a)=>{const i=a.trim();if(!i||i.length>8e3||R.current||A.current)return!1;const l=E.current.slice(),p=l.findIndex(B=>B.id===n&&B.role==="user");if(p<0)return!1;const g=l[p],b=l.findIndex(B=>B.role==="user"),v=p===b;if(!v&&(!y.current.sessionId||!g.revision))return!1;const Y={id:g.id,role:"user",text:i,revision:v?void 0:g.revision+1,status:"generating"},P={id:D(),role:"assistant",streaming:!0,blocks:[]},J=v?[Y,P]:[...l.slice(0,p),Y,P];return Q(i,{message:i,session_id:v?null:y.current.sessionId,client_message_id:crypto.randomUUID(),...v&&y.current.initialModel?{initial_model:y.current.initialModel}:{},...v?{}:{replace_message_id:g.id,prior_revision:g.revision}},J,l,{targetId:g.id,snapshot:l,first:v})},[]),Ne=o.useCallback(()=>{A.current=null,V(null)},[]),le=o.useCallback(()=>{const n=A.current;return!n||Date.now()<n.retryAt||R.current?!1:(A.current=null,V(null),Q(n.question,n.request,n.optimistic,n.original,n.edit))},[]),Le=o.useCallback(()=>{var l;if(!k.current)return;const n=k.current;oe(n),N(n,"stopped"),n.abort(),k.current=null,((l=C.current)==null?void 0:l.controller)===n&&(C.current=null),R.current=!1,f(!1),d(p=>{const g=p.at(-1);if((g==null?void 0:g.role)!=="assistant")return p;const b=(g.blocks??[]).flatMap(v=>v.kind==="tool"&&v.status==="running"?[]:v.kind==="reasoning"&&v.active?[]:v.kind==="answer"?[{...v,done:!0}]:[v]);return[...p.slice(0,-1),{...g,blocks:b,streaming:!1,finishReason:"stopped"}]}),y.current.onInterrupted(G.current);const a=H.current;a&&Ht(a).catch(()=>{});const i=++j.current;window.setTimeout(()=>{a&&j.current===i?te(a,i).catch(()=>{}).finally(()=>y.current.onSettled(a)):a||y.current.onSettled(null)},450)},[]),de=o.useCallback((n,a)=>d(i=>i.map(l=>{var p;return l.id!==n?l:{...l,blocks:(p=l.blocks)==null?void 0:p.map((g,b)=>b===a&&(g.kind==="reasoning"||g.kind==="tool")?{...g,open:!g.open}:g)}})),[]),Se=o.useCallback(()=>{var n;j.current+=1,x.current!==null&&(window.clearTimeout(x.current),x.current=null),L.current="cleared",(n=k.current)==null||n.abort(),k.current=null,C.current=null,A.current=null,V(null),R.current=!1,H.current=null,d([]),f(!1),_("")},[]),ge=o.useCallback(n=>{var a;j.current+=1,x.current!==null&&(window.clearTimeout(x.current),x.current=null),L.current="cleared",C.current=null,A.current=null,V(null),R.current||((a=k.current)==null||a.abort(),k.current=null),d(n),R.current||f(!1),_("")},[]);return{messages:h,busy:S,papers:Ie,sessionError:T,capacityRequest:z,disabledRequest:Re,send:ke,editAndResend:me,retryCapacity:le,cancelCapacity:Ne,dismissDisabled:()=>se(null),stop:Le,toggleBlock:de,reset:Se,load:ge}}const wn="https://huggingface.co/settings/inference-providers",yt="pwc.chat.billing-notice-dismissed.v1",bt=({provider:c})=>{const[h,d]=o.useState(()=>localStorage.getItem(yt)==="1");return!fe()||h||c!=="huggingface"?null:t.jsxs("div",{className:"chat-billing-notice",role:"note",children:[t.jsx("span",{children:"Hugging Face models use the inference permission granted when you start chatting. Included monthly credits are used first, then extra usage requires purchased credits. You can choose organization billing in Settings."}),t.jsxs("div",{className:"chat-billing-notice-actions",children:[t.jsx("a",{href:"/settings",children:"Review billing"}),t.jsx("a",{href:wn,target:"_blank",rel:"noreferrer",children:"Review usage"}),t.jsx("button",{type:"button",className:"chat-billing-notice-dismiss","aria-label":"Dismiss billing notice",title:"Dismiss",onClick:()=>{localStorage.setItem(yt,"1"),d(!0)},children:t.jsx(Ut,{size:15,"aria-hidden":"true"})})]})]})},vt=({enabled:c,fallbackEnabled:h,byokExpected:d})=>{const S=ln(c);if(!c||!S.data)return null;const f=S.data,T=dn(f.resets_at),_=f.unavailable_reason==="shared_credits_exhausted"||f.unavailable_reason==="workspace_limit_exhausted"||f.unavailable_reason==="provider_status_unavailable";return t.jsxs("div",{className:"chat-openrouter-usage",role:"status",children:[t.jsx("span",{children:_?t.jsxs(t.Fragment,{children:[t.jsx("strong",{children:"Shared OpenRouter credits unavailable"})," · ",f.remaining_percent,"% of your allowance remains"]}):t.jsxs(t.Fragment,{children:[t.jsxs("strong",{children:[f.remaining_percent,"% left"]})," this month · resets ",T.local]})}),(!f.available||d)&&t.jsx("span",{children:h?"Your OpenRouter account will be billed on this explicit send.":t.jsxs(t.Fragment,{children:[t.jsx("a",{href:"/settings#openrouter-byok",children:"Connect your own key in Settings"})," to continue."]})})]})},_n=({retryAt:c,onRetry:h,onCancel:d})=>{const[S,f]=o.useState(()=>Math.max(0,Math.ceil((c-Date.now())/1e3))),T=o.useRef(null);return o.useEffect(()=>{var x;const _=document.activeElement instanceof HTMLElement?document.activeElement:null;(x=T.current)==null||x.focus();const R=()=>f(Math.max(0,Math.ceil((c-Date.now())/1e3)));R();const k=window.setInterval(R,250);return()=>{window.clearInterval(k),_==null||_.focus()}},[c]),t.jsx("div",{className:"chat-capacity-dialog-backdrop",role:"presentation",children:t.jsxs("div",{className:"chat-capacity-dialog",role:"dialog","aria-modal":"true","aria-labelledby":"chat-capacity-dialog-title","aria-describedby":"chat-capacity-dialog-description",onKeyDown:_=>{_.key==="Escape"&&(_.preventDefault(),d())},children:[t.jsx("h2",{id:"chat-capacity-dialog-title",children:"All research slots are currently in use"}),t.jsx("p",{id:"chat-capacity-dialog-description",children:"Your message was not sent or billed. Try again in a few seconds."}),t.jsx("p",{className:"chat-capacity-countdown","aria-live":"polite",children:S>0?`Try again available in ${S} second${S===1?"":"s"}.`:"You can try again now."}),t.jsxs("div",{className:"chat-capacity-dialog-actions",children:[t.jsx("button",{type:"button",className:"chat-capacity-cancel",ref:T,onClick:d,children:"Cancel"}),t.jsx("button",{type:"button",className:"chat-capacity-retry",disabled:S>0,onClick:h,children:"Try again"})]})]})})},Rn=({onClose:c})=>{const h=o.useRef(null);return o.useEffect(()=>{var S;const d=document.activeElement instanceof HTMLElement?document.activeElement:null;return(S=h.current)==null||S.focus(),()=>d==null?void 0:d.focus()},[]),t.jsx("div",{className:"chat-capacity-dialog-backdrop",role:"presentation",children:t.jsxs("div",{className:"chat-capacity-dialog",role:"dialog","aria-modal":"true","aria-labelledby":"chat-disabled-title","aria-describedby":"chat-disabled-description",onKeyDown:d=>{d.key==="Escape"&&(d.preventDefault(),c())},children:[t.jsx("h2",{id:"chat-disabled-title",children:"Chat is temporarily disabled"}),t.jsx("p",{id:"chat-disabled-description",children:"We've temporarily paused new research runs. Your message wasn't sent, and your draft is still here. Please try again later."}),t.jsx("div",{className:"chat-capacity-dialog-actions",children:t.jsx("button",{ref:h,type:"button",className:"chat-capacity-cancel",onClick:c,children:"Keep editing"})})]})})},An=()=>{var Xe,Ze,et,tt,nt,rt,st,at;const{sessionId:c}=Nt(),h=Lt(),[d,S]=At(),{user:f,isLoading:T}=Dt(),{toast:_}=Pt(),R=Yt(),k=Ft(),x=it({queryKey:["chatAvailability"],queryFn:()=>qt.getChatAvailability(),refetchInterval:3e4,retry:!1,enabled:fe()}),L=it({queryKey:["inference-billing",f==null?void 0:f.hf_subject],queryFn:async()=>{const e=await fetch(Ee("/api/v1/me/inference-billing"),{credentials:"include",cache:"no-store"});if(!e.ok)throw new Error("Could not load Hugging Face billing status.");return e.json()},enabled:fe()&&!!f,retry:!1}),C=((Xe=x.data)==null?void 0:Xe.status)==="paused",[A,z]=o.useState([]),[V,Re]=o.useState(!1),[se,E]=o.useState(""),[y,G]=o.useState(()=>c?{id:c,status:"loading"}:null),[ae,je]=o.useState(0),j=o.useRef(Kt()),H=o.useRef(d.get("model")||((Ze=j.current)==null?void 0:Ze.model)),[ie,Ie]=o.useState(k?Wt:Vt),[D,I]=o.useState(H.current||Gt),M=((et=ie.find(e=>e.id===D))==null?void 0:et.provider)??"huggingface",pe=an(!!(f&&M==="openrouter")),xe=o.useRef(M);xe.current=M;const[oe,F]=o.useState(""),[ce,N]=o.useState(""),[K,te]=o.useState(()=>{var e,r;return((e=d.get("q"))==null?void 0:e.trim())||((r=j.current)==null?void 0:r.prompt)||""}),Q=o.useRef(!1),ke=o.useRef(!1),me=o.useRef(!1),[Ne,le]=o.useState(null),[Le,de]=o.useState(null),[Se,ge]=o.useState(""),[n,a]=o.useState(null),[i,l]=o.useState(()=>typeof window>"u"||window.innerWidth>900),[p,g]=o.useState(!1),[b,v]=o.useState(null),[Y,P]=o.useState(""),J=o.useRef(new Set),B=o.useRef(!1),U=o.useRef(c),$=o.useRef(null),ue=o.useRef(null),X=o.useRef(null);U.current=c;const m=o.useCallback(async()=>{if(!f)return;const e=!B.current;e&&Re(!0);try{const r=await $t();z(s=>{const w=$.current,O=w?s.find(ve=>ve.id===w):void 0;if(!O)return r;const W=r.find(ve=>ve.id===w);return[W?{...W,title:O.title,is_busy:!0}:O,...r.filter(ve=>ve.id!==w)]}),B.current=!0,E("")}catch(r){E(r instanceof Error?r.message:"Could not load chats")}finally{e&&Re(!1)}},[f]),u=vn({sessionId:c??null,initialModel:D,onSessionId:e=>{$.current=e;const r=e!==U.current,s=(U.current??null)===ue.current,w=new Date().toISOString();z(O=>O.some(W=>W.id===e)?O.map(W=>W.id===e?{...W,is_busy:!0}:W):[{id:e,title:"New chat",selected_model:D,created_at:w,updated_at:w,message_count:1,is_busy:!0},...O]),r&&s&&F("New chat"),s&&(X.current=e,G({id:e,status:"loaded"}),r&&h(`/chat/${e}`,{replace:!0}))},onTitle:e=>{const r=$.current??U.current;r&&!J.current.has(r)&&(r===U.current&&F(e),z(s=>s.map(w=>w.id===r?{...w,title:e}:w)))},onSettled:e=>{e&&z(r=>r.map(s=>s.id===e?{...s,is_busy:!1}:s)),$.current=null,ue.current=null,m()},onProviderTerminal:()=>{xe.current==="openrouter"&&(R.invalidateQueries({queryKey:on}),R.invalidateQueries({queryKey:cn}))},onInterrupted:e=>{N(e)}});u.load;const ne=u.send;o.useEffect(()=>{u.capacityRequest&&N(u.capacityRequest.question)},[u.capacityRequest]),o.useEffect(()=>{u.busy&&le(null)},[u.busy]);const Ae=o.useCallback(e=>{sessionStorage.setItem(Fe,e),sessionStorage.setItem(Ue,D),sessionStorage.setItem(qe,"1"),sessionStorage.setItem(Be,"1"),window.location.href=Mt("/chat",!0)},[D]),Ce=o.useCallback((e,r)=>{sessionStorage.setItem(Fe,e),sessionStorage.setItem(Ue,D),sessionStorage.removeItem(qe),sessionStorage.removeItem(Be),te(""),N(e),E(r)},[D]),ye=o.useCallback(async e=>{if(!f){Ae(e);return}if(M==="huggingface"&&!ke.current){if(me.current)return;me.current=!0;try{const s=await fetch(Ee("/api/v1/me/inference-billing"),{credentials:"include",cache:"no-store"});if(!s.ok)throw new Error("Could not check Hugging Face authorization.");if(!(await s.json()).connected){if(sessionStorage.getItem(Be)==="1"){Ce(e,"Hugging Face inference authorization was not completed. Your prompt is ready to retry.");return}Ae(e);return}ke.current=!0}catch(s){Ce(e,s instanceof Error?s.message:"Could not check Hugging Face authorization.");return}finally{me.current=!1}}const r=U.current??null;if(!ne(e)){Ce(e,"Your prompt was not sent. It is ready to retry.");return}ue.current=r,$.current=r,zt(),N("")},[Ae,Ce,M,ne,f]);o.useEffect(()=>{if(T||!f)return;const e=sessionStorage.getItem(Ue);e&&I(e),m(),Qt().then(w=>{if(Ie(w.items),!U.current){const O=H.current||e;I(O&&w.items.some(W=>W.id===O)?O:w.default_model)}});const r=sessionStorage.getItem(Fe),s=sessionStorage.getItem(qe)==="1";r&&(s?te(r):N(r))},[T,m,f]),o.useEffect(()=>{if(!c){X.current!==null&&(X.current=null,u.reset()),G(null);return}if(X.current===c||(G(r=>(r==null?void 0:r.id)===c&&r.status==="loading"?r:{id:c,status:"loading"}),T||!f))return;let e=!1;return E(""),Ke(c).then(r=>{e||(u.load(wt(r)),I(r.selected_model),F(r.title),X.current=c,G({id:c,status:"loaded"}))}).catch(r=>{if(e)return;const s=r instanceof Error?r.message:"Chat not found";u.reset(),E(s),G({id:c,status:"error",error:s})}),()=>{e=!0}},[T,c,f,u.busy,ae]),o.useEffect(()=>{var w;const e=(w=d.get("q"))==null?void 0:w.trim();if(!e)return;Q.current=!1;const r=d.get("model");r&&I(r),te(e);const s=new URLSearchParams(d);s.delete("q"),s.delete("model"),S(s,{replace:!0})},[d,S]),o.useEffect(()=>{if(T||u.busy||!K||Q.current||c&&(y==null?void 0:y.status)!=="loaded")return;const e=window.setTimeout(()=>{if(Q.current)return;Q.current=!0,ye(K).finally(()=>te(""))},0);return()=>window.clearTimeout(e)},[T,u.busy,K,c,y==null?void 0:y.status,ye]),o.useEffect(()=>{const e=()=>{!f||u.busy||m()};return window.addEventListener("focus",e),()=>window.removeEventListener("focus",e)},[u.busy,m,f]),o.useEffect(()=>{if(!n)return;const e=()=>a(null),r=s=>{s.key==="Escape"&&e()};return window.addEventListener("click",e),window.addEventListener("keydown",r),()=>{window.removeEventListener("click",e),window.removeEventListener("keydown",r)}},[n]);const We=()=>{$.current=null,u.reset(),N(""),F(""),h("/chat")},Ve=async e=>{const r=Se.trim();if(r)try{const s=await ut(e,{title:r});J.current.add(e),e===c&&F(s.title),z(w=>w.map(O=>O.id===e?s:O)),de(null)}catch(s){E(s instanceof Error?s.message:"Rename failed")}},xt=async e=>{const r=e===c&&u.busy;if(window.confirm(r?"Stop and delete this chat? This cannot be undone.":"Delete this chat? This cannot be undone.")){r&&u.stop();try{if(r){const s=Date.now()+3e3;for(;(await Ke(e)).is_busy;){if(Date.now()>=s)throw new Error("Generation is still stopping. The chat was not deleted.");await new Promise(O=>window.setTimeout(O,150))}}await en(e),e===c&&We(),await m()}catch(s){E(s instanceof Error?s.message:"Delete failed")}}},kt=async()=>{var e;if(b===null){v("old");try{const r=await rn();if(await m(),r.archived_count===0){_({title:"No chats were archived",description:"There are no inactive chats older than 30 days."});return}const s=((e=[...u.messages].reverse().find(w=>w.role==="user"))==null?void 0:e.text)??"";u.reset(),N(s),F(""),_({title:`${r.archived_count} ${r.archived_count===1?"chat":"chats"} archived`,description:"Your question is ready to send again."})}catch(r){_({variant:"destructive",title:"Could not archive old chats",description:r instanceof Error?r.message:"Try again."})}finally{v(null)}}},St=async()=>{var e;if(b===null){v("oldest");try{const r=await nn();await m();const s=((e=[...u.messages].reverse().find(w=>w.role==="user"))==null?void 0:e.text)??"";u.reset(),N(s),F(""),_({title:`${r.archived_count} ${r.archived_count===1?"chat":"chats"} archived`,description:"Your question is ready to send again."})}catch(r){_({variant:"destructive",title:"Could not archive chats",description:r instanceof Error?r.message:"Try again."})}finally{v(null)}}},Ge=async e=>{const r=D;if(I(e),!!c)try{const s=await ut(c,{selected_model:e});z(w=>w.map(O=>O.id===c?{...O,selected_model:s.selected_model}:O)),E("")}catch(s){I(r),E(s instanceof Error?s.message:"Model change failed")}},Ct=async()=>{var e;if(!(!c||u.busy||p)){g(!0);try{const r=await tn(c),s=new URL(r.public_path,window.location.origin).toString();try{if(!((e=navigator.clipboard)!=null&&e.writeText))throw new Error("Clipboard unavailable");await navigator.clipboard.writeText(s),_({className:"chat-share-toast",duration:5e3,title:"Public link copied to your clipboard",description:"Anyone with this link can see this conversation."})}catch{P(s)}}catch(r){const s=r instanceof Error?r.message:"Could not share this conversation";E(s),_({variant:"destructive",title:"Share failed",description:s})}finally{g(!1)}}},[Tt,Ot]=o.useState(60);o.useLayoutEffect(()=>{const e=document.querySelector(".app-header");if(!e)return;const r=()=>Ot(e.offsetHeight);r();const s=new ResizeObserver(r);return s.observe(e),()=>s.disconnect()},[]);const De=o.useRef(null),Te=o.useRef(null),be=o.useRef(null);o.useEffect(()=>{u.busy||(be.current=null)},[u.busy]);const Et=(e,r)=>{var s;Te.current=((s=De.current)==null?void 0:s.scrollTop)??null,u.toggleBlock(e,r)};o.useLayoutEffect(()=>{const e=De.current;if(e){if(Te.current!==null){e.scrollTop=Te.current,Te.current=null;return}if(be.current){const r=Array.from(e.querySelectorAll("[data-message-id]")).find(s=>s.dataset.messageId===be.current);if(r){const s=e.getBoundingClientRect(),w=r.getBoundingClientRect();e.scrollTop+=w.top-s.top-24;return}}e.scrollTop=e.scrollHeight}},[u.messages]);const he=A.find(e=>e.id===c),$e=u.messages.filter(e=>e.role==="user"),Pe=(tt=$e[0])==null?void 0:tt.id,jt=(nt=$e.at(-1))==null?void 0:nt.id,Oe=u.messages.length===0,ze=(rt=[...u.messages].reverse().find(e=>e.role==="assistant"&&e.errorCode))==null?void 0:rt.errorCode,Qe=ze==="openrouter_unavailable"||ze==="openrouter_monthly_budget_exhausted",Ye=(y==null?void 0:y.id)===c,Me=!!(c&&(T||f&&(!Ye||(y==null?void 0:y.status)==="loading"))),Je=Ye&&(y==null?void 0:y.status)==="error"?y.error:void 0;return t.jsxs("div",{className:"chat-page",style:{height:`calc(100dvh - ${Tt}px)`},children:[t.jsxs("aside",{className:`chat-sidebar${i?"":" chat-sidebar-closed"}`,children:[t.jsxs("div",{className:"chat-sidebar-top",children:[t.jsxs("button",{type:"button",className:"chat-new-chat",onClick:We,children:[t.jsx(Jt,{})," New chat"]}),t.jsx("button",{type:"button",className:"icon-btn",onClick:()=>l(!1),title:"Collapse sidebar",children:t.jsx(lt,{})})]}),t.jsxs("nav",{className:"chat-sessions","aria-label":"Chat history",children:[V&&t.jsx("div",{className:"chat-sessions-empty",children:"Loading chats…"}),!V&&se&&t.jsx("div",{className:"chat-sessions-empty",children:se}),!V&&!se&&A.length===0&&t.jsx("div",{className:"chat-sessions-empty",children:"Conversations you start will show up here."}),Xt(A).map(e=>t.jsxs("div",{className:"chat-session-group",children:[t.jsx("div",{className:"chat-session-group-label",children:e.label}),e.items.map(r=>t.jsxs("div",{className:`chat-session${r.id===c?" chat-session-active":""}`,role:"button",tabIndex:0,onClick:()=>h(`/chat/${r.id}`),onKeyDown:s=>{if(s.key==="Enter"&&h(`/chat/${r.id}`),s.key==="F2"&&(de(r.id),ge(r.title)),s.key==="ContextMenu"||s.shiftKey&&s.key==="F10"){s.preventDefault();const w=s.currentTarget.getBoundingClientRect();a({id:r.id,x:w.right-150,y:w.bottom})}},onContextMenu:s=>{s.preventDefault(),a({id:r.id,x:s.clientX,y:s.clientY})},children:[Le===r.id?t.jsx("input",{className:"chat-session-title-input",value:Se,autoFocus:!0,maxLength:80,onClick:s=>s.stopPropagation(),onChange:s=>ge(s.target.value),onBlur:()=>void Ve(r.id),onKeyDown:s=>{s.stopPropagation(),s.key==="Enter"&&Ve(r.id),s.key==="Escape"&&de(null)}}):t.jsx("span",{className:"chat-session-title",children:r.title}),t.jsx("button",{type:"button",className:"chat-session-menu","aria-label":"Chat actions","aria-haspopup":"menu",title:"Chat actions",onClick:s=>{s.stopPropagation();const w=s.currentTarget.getBoundingClientRect();a({id:r.id,x:w.right-150,y:w.bottom})},children:"⋯"}),t.jsx("button",{type:"button",className:"chat-session-delete","aria-label":"Delete conversation",onClick:s=>{s.stopPropagation(),xt(r.id)},children:t.jsx(Zt,{})})]},r.id))]},e.label))]}),n&&t.jsx("div",{className:"chat-session-context-menu",role:"menu",style:{left:n.x,top:n.y},onClick:e=>e.stopPropagation(),children:t.jsx("button",{type:"button",role:"menuitem",autoFocus:!0,onClick:()=>{const e=A.find(r=>r.id===n.id);e&&(de(e.id),ge(e.title)),a(null)},children:"Rename chat"})})]}),t.jsxs("section",{className:"chat-main",children:[t.jsxs("div",{className:"chat-topbar",children:[!i&&t.jsx("button",{type:"button",className:"icon-btn",onClick:()=>l(!0),title:"Open sidebar",children:t.jsx(lt,{})}),t.jsx("span",{className:"chat-topbar-title",children:Me?(he==null?void 0:he.title)||"":oe||(he==null?void 0:he.title)||(Oe?"":"New chat")}),k&&t.jsx("span",{className:"chat-staging-badge",children:"Staging"}),c&&Ye&&(y==null?void 0:y.status)==="loaded"&&!Oe&&t.jsxs("button",{type:"button",className:"chat-share-button",onClick:()=>void Ct(),disabled:u.busy||p||Me,"aria-label":"Share conversation",children:[p?t.jsx(dt,{}):t.jsx(un,{"aria-hidden":"true"}),t.jsx("span",{children:"Share"})]})]}),Me&&!K?t.jsxs("div",{className:"chat-session-loading",role:"status","aria-live":"polite",children:[t.jsx(dt,{}),t.jsx("span",{children:"Loading conversation…"})]}):Je?t.jsxs("div",{className:"chat-session-load-error",role:"alert",children:[t.jsx("p",{children:Je}),t.jsx("button",{type:"button",onClick:()=>{G({id:c,status:"loading"}),je(e=>e+1)},children:"Try again"})]}):Oe&&!K?t.jsx("div",{className:"chat-empty",children:t.jsxs("div",{className:"chat-empty-inner",children:[t.jsx("div",{className:"chat-empty-eyebrow",children:"AI research assistant · Staging preview"}),t.jsxs("h1",{className:"chat-empty-title",children:["Ask ",t.jsx("em",{children:"Papers With Code"})]}),t.jsx("p",{className:"chat-empty-sub",children:"Answers are grounded in a live hybrid search over papers, tasks, and benchmarks — with citations you can follow."}),k&&t.jsx("p",{className:"chat-staging-access-note",children:"This is a limited staging preview. Only approved Hugging Face users can start chats."}),t.jsx(bt,{provider:M}),t.jsx(vt,{enabled:M==="openrouter",fallbackEnabled:!!((st=pe.data)!=null&&st.fallback_enabled),byokExpected:Qe}),C&&t.jsx("div",{id:"chat-paused-description",className:"chat-paused-banner",role:"status",children:"Chat is temporarily disabled. You can keep browsing and editing your conversations. New research runs will return when chat is restored."}),t.jsx(ot,{onSend:ye,busy:u.busy,onStop:u.stop,autoFocus:!0,draft:ce,onDraftChange:N,models:ie,selectedModel:D,onModelChange:e=>void Ge(e),disabled:C,describedBy:C?"chat-paused-description":void 0}),t.jsx("div",{className:"chat-examples",children:sn.map(e=>t.jsx("button",{type:"button",className:"chat-example",disabled:C,onClick:()=>ye(e),children:e},e))})]})}):t.jsxs(t.Fragment,{children:[u.sessionError&&t.jsx("div",{className:"chat-session-error",role:"alert",children:u.sessionError}),t.jsx("div",{className:"chat-conversation",ref:De,children:t.jsxs("div",{className:"chat-conversation-inner",children:[Oe&&K&&t.jsx(ct,{id:"queued-launch-preview",text:K,isInitial:!0}),u.messages.map(e=>e.role==="user"?t.jsx(ct,{id:e.id,text:e.text??"",isInitial:e.id===Pe,editingAllowed:!u.busy&&!!e.revision,editing:Ne===e.id,editNotice:e.id===Pe?"Sending will start a new chat.":e.id===jt?"Sending will replace the response.":"Sending will replace the response and all messages after it.",onEdit:()=>le(e.id),onCancel:()=>le(null),onResend:r=>{e.id!==Pe&&(be.current=e.id);const s=u.editAndResend(e.id,r);return s?le(null):be.current=null,s}},e.id):t.jsx(Bt,{msg:e,papers:u.papers,onToggleBlock:Et,onArchiveOldChats:()=>void kt(),onArchiveOldestChats:()=>void St(),archivePending:b,hfBilling:L.data??null},e.id))]})}),t.jsx("div",{className:"chat-composer-wrap",children:t.jsxs("div",{className:"chat-composer-inner",children:[t.jsx(bt,{provider:M}),t.jsx(vt,{enabled:M==="openrouter",fallbackEnabled:!!((at=pe.data)!=null&&at.fallback_enabled),byokExpected:Qe}),C&&t.jsx("div",{id:"chat-paused-description",className:"chat-paused-banner",role:"status",children:"Chat is temporarily disabled. You can keep browsing and editing your conversations. New research runs will return when chat is restored."}),t.jsx(ot,{onSend:ye,busy:u.busy,onStop:u.stop,placeholder:ce?"Edit and send again…":"Ask a follow-up…",draft:ce,onDraftChange:N,models:ie,selectedModel:D,onModelChange:e=>void Ge(e),disabled:C,describedBy:C?"chat-paused-description":void 0}),t.jsx("div",{className:"chat-composer-foot",children:fe()?t.jsxs(t.Fragment,{children:[M==="openrouter"?t.jsxs("span",{className:"chat-provider-attribution",children:["Powered by ",t.jsx("a",{href:"https://openrouter.ai",target:"_blank",rel:"noreferrer",children:"OpenRouter"}),"."]}):t.jsxs("span",{className:"chat-provider-attribution",children:["Powered by 🤗 ",t.jsx("a",{href:"https://huggingface.co/docs/inference-providers/en/index",target:"_blank",rel:"noreferrer",children:"Inference Providers"}),"."]}),t.jsx("span",{children:"The AI assistant can make mistakes. Double-check responses."})]}):t.jsx(t.Fragment,{children:"Assistant preview — responses are simulated."})})]})})]})]}),Y&&t.jsx("div",{className:"chat-share-dialog-backdrop",role:"presentation",onMouseDown:()=>P(""),children:t.jsxs("div",{className:"chat-share-dialog",role:"dialog","aria-modal":"true","aria-labelledby":"chat-share-dialog-title",onMouseDown:e=>e.stopPropagation(),children:[t.jsx("h2",{id:"chat-share-dialog-title",children:"Public link created"}),t.jsx("p",{children:"Anyone with this link can see this conversation. It could not be copied automatically, so copy it manually:"}),t.jsx("input",{readOnly:!0,value:Y,"aria-label":"Public conversation link",autoFocus:!0,onFocus:e=>e.currentTarget.select()}),t.jsx("button",{type:"button",onClick:()=>P(""),children:"Close"})]})}),u.capacityRequest&&t.jsx(_n,{retryAt:u.capacityRequest.retryAt,onCancel:u.cancelCapacity,onRetry:()=>{u.retryCapacity()&&N("")}}),u.disabledRequest&&t.jsx(Rn,{onClose:()=>{var e;N(((e=u.disabledRequest)==null?void 0:e.question)??ce),u.dismissDisabled(),x.refetch()}})]})};export{_n as ChatCapacityDialog,Rn as ChatDisabledDialog,An as default};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
assets/ChatView-CGCx-5Sp.js
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import{d as At,e as De,r as o,j as t,f as Dt,u as Pt,a as Mt,g as Yt,h as Ft,k as qt,l as Ut,b as Bt,X as Ht,c as Kt}from"./index-Bthypk3Q.js";import{u as lt}from"./useQuery-CEDDm0wh.js";import{C as dt,U as ut,A as Wt}from"./ChatMessage-Dx3LmUoF.js";import{a as Vt,g as We,t as Rt,r as Gt,S as $t,P as zt,D as Qt,l as Jt,C as Ae,b as Ie,d as Ne,e as Le,f as Xt,h as Zt,i as en,j as ht,k as tn,T as nn,m as pt,u as ft,n as rn,o as sn,p as an,s as on}from"./chatSessions-nz97TbnH.js";import{S as cn}from"./chatPrompts-CDY3UGU1.js";import{u as ln,O as dn,a as un,b as hn,r as pn}from"./openrouter-WjyHzpt9.js";import"./katex.min-BSBacQyE.js";import"./hover-card-Dy9hZi_x.js";import"./PaperPreviewLink-DajWspZH.js";import"./index-SizWVsV-.js";import"./file-text-SORg5JWW.js";/**
|
| 2 |
+
* @license lucide-react v0.462.0 - ISC
|
| 3 |
+
*
|
| 4 |
+
* This source code is licensed under the ISC license.
|
| 5 |
+
* See the LICENSE file in the root directory of this source tree.
|
| 6 |
+
*/const fn=At("Share2",[["circle",{cx:"18",cy:"5",r:"3",key:"gq8acd"}],["circle",{cx:"6",cy:"12",r:"3",key:"w7nqdw"}],["circle",{cx:"18",cy:"19",r:"3",key:"1xt0gg"}],["line",{x1:"8.59",x2:"15.42",y1:"13.51",y2:"17.49",key:"47mynk"}],["line",{x1:"15.41",x2:"8.59",y1:"6.51",y2:"10.49",key:"1n3mei"}]]),H=(l,u)=>new Promise(d=>{const S=setTimeout(f,l);function f(){u==null||u.removeEventListener("abort",f),clearTimeout(S),d()}u==null||u.addEventListener("abort",f)}),re=l=>({arxiv_id:null,source:"arxiv",source_url:null,thumbnail_url:null,authors:[],published:null,conference:null,citation_count:null,tasks:[],methods:[],repositories:[],project_pages:[],...l}),se={name:"Object Detection",slug:"object-detection"},ie={name:"Real-Time Object Detection",slug:"real-time-object-detection"},mn={"2502.12524":{route_id:"2502.12524",title:"YOLOv12: Attention-Centric Real-Time Object Detectors",content:"Enhancing the network architecture of the YOLO framework has been crucial for a long time. This work introduces an attention-centric YOLO framework, namely YOLOv12, built around area attention and residual efficient layer aggregation networks (R-ELAN). YOLOv12-N reaches 40.6 mAP at 1.64 ms on a T4 GPU, closing the gap to attention-based detectors without the usual latency penalty and surpassing YOLOv10/YOLOv11 by +1.2–1.6 mAP at matched latency.",content_truncated:!1,metadata:re({arxiv_id:"2502.12524",authors:[{name:"Y. Tian"},{name:"Q. Ye"},{name:"D. Doermann"}],published:"2025-02-18",citation_count:412,tasks:[se,ie],methods:[{name:"Area Attention",slug:"area-attention"}],repositories:[{url:"https://github.com/sunsmarterjie/yolov12",stars:18700}]})},"2407.17140":{route_id:"2407.17140",title:"RT-DETRv2: Improved Baseline with Bag-of-Freebies for Real-Time Detection",content:"RT-DETRv2 improves the real-time DETR baseline with selective multi-scale feature extraction, a discrete sampling operator to ease deployment, and training-only 'bag-of-freebies' that add no inference cost. RT-DETRv2-R18/R50/R101 reach 47.9 / 53.4 / 54.3 mAP on COCO at 217 / 108 / 74 FPS on T4 TensorRT FP16, remaining NMS-free end to end.",content_truncated:!1,metadata:re({arxiv_id:"2407.17140",authors:[{name:"W. Lv"},{name:"Y. Zhao"},{name:"J. Chang"}],published:"2024-07-24",citation_count:268,tasks:[se,ie],methods:[{name:"DETR",slug:"detr"}],repositories:[{url:"https://github.com/lyuwenyu/RT-DETR",stars:9400}]})},"2410.13842":{route_id:"2410.13842",title:"D-FINE: Redefining Regression as Fine-grained Distribution Refinement",content:"D-FINE reformulates bounding-box regression in DETR-style detectors as iterative refinement of probability distributions (FDR) and adds a localization self-distillation scheme (GO-LSD). D-FINE-L reaches 54.0 mAP at ~9 ms and D-FINE-X 55.8 mAP on COCO while staying real-time on modern GPUs, dominating RT-DETRv2 and YOLOv10 on the accuracy–latency Pareto front.",content_truncated:!1,metadata:re({arxiv_id:"2410.13842",authors:[{name:"Y. Peng"},{name:"H. Li"},{name:"P. Wu"}],published:"2024-10-17",conference:"ICLR 2025",citation_count:187,tasks:[se,ie],methods:[{name:"Knowledge Distillation",slug:"knowledge-distillation"}],repositories:[{url:"https://github.com/Peterande/D-FINE",stars:12100}]})},"2406.03459":{route_id:"2406.03459",title:"LW-DETR: A Transformer Replacement to YOLO for Real-Time Detection",content:"LW-DETR pairs a plain ViT encoder with a lightweight DETR decoder and shows the combination outperforms YOLOv8 and YOLO-NAS at comparable latency, arguing transformer detectors are viable even at the fast end of the accuracy–latency curve. Uses multi-level feature aggregation, window-attention interleaving, and IoU-aware classification.",content_truncated:!1,metadata:re({arxiv_id:"2406.03459",authors:[{name:"Q. Chen"},{name:"X. Su"},{name:"X. Zhang"}],published:"2024-06-05",citation_count:94,tasks:[se,ie],methods:[{name:"Vision Transformer",slug:"vision-transformer"}],repositories:[{url:"https://github.com/Atten4Vis/LW-DETR",stars:5200}]})},"2304.08069":{route_id:"2304.08069",title:"DETRs Beat YOLOs on Real-time Object Detection",content:"RT-DETR is the first real-time end-to-end object detector, built on an efficient hybrid encoder that decouples intra-scale interaction and cross-scale fusion, plus IoU-aware query selection. RT-DETR-R50 achieves 53.1 mAP at 108 FPS on COCO, beating comparably sized YOLO detectors in both speed and accuracy while eliminating NMS entirely; its Figure 1 accuracy–latency plot became the reference for later real-time detectors.",content_truncated:!1,metadata:re({arxiv_id:"2304.08069",authors:[{name:"Y. Zhao"},{name:"W. Lv"},{name:"S. Xu"}],published:"2023-04-17",conference:"CVPR 2024",citation_count:2310,tasks:[se,ie],methods:[{name:"DETR",slug:"detr"}],repositories:[{url:"https://github.com/lyuwenyu/RT-DETR",stars:9400}]})},"2405.14458":{route_id:"2405.14458",title:"YOLOv10: Real-Time End-to-End Object Detection",content:"YOLOv10 removes NMS from the YOLO pipeline via consistent dual assignments during training and applies a holistic efficiency–accuracy driven design across the architecture. YOLOv10-S is 1.8x faster than RT-DETR-R18 at similar COCO accuracy; the family spans 46.3–54.4 mAP with substantially lower end-to-end latency than prior YOLOs because post-processing disappears.",content_truncated:!1,metadata:re({arxiv_id:"2405.14458",authors:[{name:"A. Wang"},{name:"H. Chen"},{name:"L. Liu"}],published:"2024-05-23",conference:"NeurIPS 2024",citation_count:1650,tasks:[se,ie],methods:[{name:"NMS-free Training",slug:"nms-free-training"}],repositories:[{url:"https://github.com/THU-MIG/yolov10",stars:44200}]})},"2401.17270":{route_id:"2401.17270",title:"YOLO-World: Real-Time Open-Vocabulary Object Detection",content:"YOLO-World extends the YOLO paradigm to open-vocabulary detection through vision-language modeling with a re-parameterizable vision-language path aggregation network (RepVL-PAN) and region-text contrastive pretraining. It detects categories never seen at training time while running at 35+ FPS, and its prompt-then-detect deployment re-parameterizes text embeddings for zero runtime text-encoder cost.",content_truncated:!1,metadata:re({arxiv_id:"2401.17270",authors:[{name:"T. Cheng"},{name:"L. Song"},{name:"Y. Ge"}],published:"2024-01-30",conference:"CVPR 2024",citation_count:890,tasks:[{name:"Open-Vocabulary Object Detection",slug:"open-vocabulary-object-detection"},se],methods:[{name:"Contrastive Learning",slug:"contrastive-learning"}],repositories:[{url:"https://github.com/AILab-CVC/YOLO-World",stars:16800}]})},158342:{route_id:"158342",title:"Ultralytics YOLO: real-time detection framework and model zoo",content:"Official Ultralytics framework release covering YOLO11 and YOLOv12 deployment: pretrained COCO checkpoints from nano to x-large, TensorRT/ONNX/CoreML export paths, and reproducible latency benchmarks on T4, Jetson Orin, and CPU targets. Widely used as the practical baseline for real-time detection deployments.",content_truncated:!1,metadata:re({source:"external",source_url:"https://docs.ultralytics.com/models/",authors:[{name:"Ultralytics"}],published:"2025-01-02",tasks:[se,ie],repositories:[{url:"https://github.com/ultralytics/ultralytics",stars:46e3}],project_pages:[{url:"https://docs.ultralytics.com"}]})}},St=l=>l.map(u=>mn[u]),mt=St(["2502.12524","2407.17140","2410.13842","2406.03459","2304.08069","2405.14458","2401.17270","158342"]),gt=St(["2410.13842","2502.12524","2407.17140","2405.14458","2304.08069"]),yt="The user wants the current state-of-the-art for real-time object detection. That's a moving target split across two lineages — the YOLO family (fast CNN one-stage detectors) and the DETR family (transformer, end-to-end, NMS-free). I should ground the answer in recent papers benchmarked on COCO with reported latency or FPS, not just accuracy. Let me start with a broad hybrid search, see which papers surface, then run a second, narrower query to pin down the head-to-head COCO mAP vs latency trade-offs before I write anything.",bt="Good — both lineages are well represented. YOLOv12, YOLOv10 and RT-DETRv2 / D-FINE keep coming up. To actually rank them I need the accuracy-vs-latency numbers side by side on the same COCO val2017 protocol, so let me narrow the query to the benchmark comparison specifically.",vt=`There isn't a single winner — real-time object detection in 2026 is a two-horse race between the [YOLO family](paper:2502.12524) (fast one-stage CNNs) and the end-to-end [DETR family](paper:2304.08069) (NMS-free transformers). Which one is “SOTA” depends entirely on where you sit on the accuracy-vs-latency curve.
|
| 7 |
+
|
| 8 |
+
**At the fast / edge end**, [YOLOv12](paper:2502.12524) is the current leader. Its area-attention design pushes attention into the YOLO backbone without the usual latency hit — YOLOv12-N reaches 40.6 mAP at ~1.6 ms on a T4, roughly +1.5 mAP over [YOLOv10](paper:2405.14458) at matched speed. [YOLOv10](paper:2405.14458) is still very relevant because it made the YOLO head NMS-free, cutting real end-to-end latency.
|
| 9 |
+
|
| 10 |
+
**At the high-accuracy end**, the transformer detectors win. [D-FINE](paper:2410.13842) currently holds the accuracy-latency Pareto front, reporting 55.8 mAP by reformulating box regression as fine-grained distribution refinement with self-distillation. It builds on [RT-DETRv2](paper:2407.17140), which hardened the [original RT-DETR](paper:2304.08069) recipe (the paper that first showed DETRs beating YOLOs in real time) with training-only “bag-of-freebies” that add no inference cost.
|
| 11 |
+
|
| 12 |
+
**My recommendation:** for edge or high-FPS deployment, start with [YOLOv12](paper:2502.12524) — the [Ultralytics framework](paper:158342) has ready-made checkpoints and export paths. If you have GPU headroom and want maximum accuracy while staying real-time, use [D-FINE](paper:2410.13842) or [RT-DETRv2](paper:2407.17140). And if you need open-vocabulary detection rather than fixed COCO classes, [YOLO-World](paper:2401.17270) is the one to look at.`,gn=["How do these compare on edge devices like Jetson?","Show me open-vocabulary detectors","What about small-object detection?"];async function*yn(l,u){const d=()=>(u==null?void 0:u.aborted)===!0,S=l.trim().slice(0,90)||"state-of-the-art real-time object detection";if(yield{type:"stream_start",request_id:"req_mock",session_id:null},await H(350,u),!d()){yield{type:"reasoning_start"};for(let f=0;f<yt.length;f+=6){if(await H(14,u),d())return;yield{type:"reasoning_delta",text:yt.slice(f,f+6)}}if(await H(400,u),!d()&&(yield{type:"reasoning_end"},await H(300,u),!d()&&(yield{type:"tool_call",id:"call_1",name:"search_papers",args:{query:S,top_k:8}},await H(1100,u),!d()&&(yield{type:"tool_result",id:"call_1",hits:mt.length,took_ms:214,results:mt},await H(350,u),!d())))){yield{type:"reasoning_start"};for(let f=0;f<bt.length;f+=6){if(await H(14,u),d())return;yield{type:"reasoning_delta",text:bt.slice(f,f+6)}}if(await H(350,u),!d()&&(yield{type:"reasoning_end"},await H(300,u),!d()&&(yield{type:"tool_call",id:"call_2",name:"search_papers",args:{query:"RT-DETR vs YOLOv12 COCO mAP latency FPS T4 TensorRT comparison",top_k:5}},await H(900,u),!d()&&(yield{type:"tool_result",id:"call_2",hits:gt.length,took_ms:176,results:gt},await H(400,u),!d())))){for(let f=0;f<vt.length;f+=4){if(await H(11,u),d())return;yield{type:"answer_delta",text:vt.slice(f,f+4)}}yield{type:"done",followups:gn,finish_reason:"success"}}}}}const ge=()=>{const u=String("0").trim().toLowerCase();return u==="1"||u==="true"||u==="yes"};class me extends Error{constructor(u,d,S,f){super(u),this.code=d,this.status=S,this.retryAfterSeconds=f,this.name="ChatStreamError"}}function bn(l,u){if(ge())try{fetch(De(`/api/v1/chat/latency/${encodeURIComponent(l)}`),{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",keepalive:!0,body:JSON.stringify(u)}).catch(()=>{})}catch{}}function vn(l,u={}){return ge()?_n(l,u.signal):yn(l.message,u.signal)}async function*_n(l,u){const d=await fetch(De("/api/v1/chat/stream"),{method:"POST",headers:{"Content-Type":"application/json",Accept:"text/event-stream"},credentials:"include",body:JSON.stringify(l),signal:u});if(!d.ok||!d.body){const v=await d.json().catch(()=>null),w=v==null?void 0:v.detail,x=d.status===403&&!w,_=Number(d.headers.get("Retry-After")),D=Number.isFinite(_)&&_>=0?Math.min(300,Math.ceil(_)):void 0;throw new me(x?"Chat on staging is limited to approved Hugging Face users. Sign in with an approved account and try again.":(w==null?void 0:w.message)||w||`Chat stream failed (${d.status})`,(w==null?void 0:w.code)||(x?"staging_access_required":void 0),d.status,D)}const S=d.body.getReader(),f=new TextDecoder;let O="";try{for(;;){const{done:v,value:w}=await S.read();if(v)break;O+=f.decode(w,{stream:!0});let x;for(;(x=O.indexOf(`
|
| 13 |
+
|
| 14 |
+
`))!==-1;){const _=O.slice(0,x);O=O.slice(x+2);const D=_.split(`
|
| 15 |
+
`).filter(C=>C.startsWith("data:")).map(C=>C.slice(5).trimStart()).join(`
|
| 16 |
+
`);!D||D==="[DONE]"||(yield JSON.parse(D))}}}finally{S.releaseLock()}}const kt="Preparing research workspace…",wn=750;function Re(l){if(l.status!==kt)return l;const{status:u,...d}=l;return d}function Ke(l,u){for(let d=l.length-1;d>=0;d-=1)if(u(l[d]))return d;return-1}function xn(l){const[u,d]=o.useState([]),[S,f]=o.useState(!1),[O,v]=o.useState(""),w=o.useRef(!1),x=o.useRef(null),_=o.useRef(null),D=o.useRef("cleared"),C=o.useRef(null),Y=o.useRef(null),[Z,J]=o.useState(null),[Se,oe]=o.useState(null),E=o.useRef([]),g=o.useRef(l),X=o.useRef({text:"",paperMentions:[]}),ce=o.useRef(""),Pe=o.useRef(0),T=o.useRef(0),V=o.useRef(l.sessionId),le=o.useRef(l.sessionId);le.current!==l.sessionId&&(le.current=l.sessionId,V.current!==l.sessionId&&(T.current+=1,C.current=null)),g.current=l,E.current=u,o.useEffect(()=>()=>{var n;_.current!==null&&window.clearTimeout(_.current),(n=x.current)==null||n.abort(),Y.current=null},[]),o.useEffect(()=>{w.current||(V.current=l.sessionId)},[l.sessionId]);const Me=o.useMemo(()=>{const n={};for(const i of u)for(const c of i.blocks??[])if(c.kind==="tool")for(const h of c.results??[])n[h.route_id]=h;return n},[u]),F=()=>`m${++Pe.current}_${Date.now().toString(36)}`,L=n=>d(i=>{if(!i.length)return i;const c=i.slice();return c[c.length-1]=n(c[c.length-1]),c}),U=n=>L(i=>{const c=Re(i);return{...c,blocks:[...c.blocks??[],n]}}),ye=(n,i)=>L(c=>{const h=Re(c);return{...h,blocks:(h.blocks??[]).map((p,y,m)=>n(p,y,m)?i(p):p)}}),ke=n=>(i,c,h)=>i.kind===n&&Ke(h,p=>p.kind===n)===c,de=n=>{if(x.current!==n||(_.current!==null&&(window.clearTimeout(_.current),_.current=null),D.current==="cleared"))return;const i=D.current==="shown";D.current="cleared",i&&L(Re)},B=(n,i)=>{n.requestId&&bn(n.requestId,i)},ue=(n,i)=>{const c=C.current;!c||c.controller!==n||(c.requestId=i,c.streamStartReported||(c.streamStartReported=!0,B(c,{submission_to_stream_start_ms:Math.max(0,performance.now()-c.submittedAt)})),c.firstVisibleAt!==void 0&&!c.firstVisibleReported&&(c.firstVisibleReported=!0,B(c,{submission_to_first_visible_delta_ms:Math.max(0,c.firstVisibleAt-c.submittedAt)})))},A=(n,i)=>{const c=C.current;!c||c.controller!==n||c.terminalReported||(c.terminalReported=!0,B(c,{terminal_classification:i}))};o.useLayoutEffect(()=>{const n=C.current;if(!n||n.firstVisibleAt!==void 0)return;const i=u.at(-1);(i==null?void 0:i.role)!=="assistant"||!(i.blocks??[]).some(h=>h.kind==="tool"||h.kind==="reasoning"&&!!h.text.trim()||h.kind==="answer"&&!!h.text.trim())||(n.firstVisibleAt=performance.now(),n.requestId&&!n.firstVisibleReported&&(n.firstVisibleReported=!0,B(n,{submission_to_first_visible_delta_ms:Math.max(0,n.firstVisibleAt-n.submittedAt)})))},[u]);const K=n=>{switch(n.type){case"stream_start":n.session_id&&(V.current=n.session_id,g.current.onSessionId(n.session_id));break;case"sandbox_start":case"sandbox_ready":case"workspace_ready":break;case"session_title_start":ce.current="";break;case"session_title_delta":ce.current+=n.text,g.current.onTitle(ce.current.replace(/\s+/g," ").slice(0,80));break;case"session_title_done":ce.current=n.title,g.current.onTitle(n.title);break;case"reasoning_start":L(i=>{const c=Re(i);return{...c,blocks:[...(c.blocks??[]).map(h=>h.kind==="reasoning"&&h.active?{...h,active:!1,open:!1}:h),{kind:"reasoning",text:"",active:!0,open:!0}]}});break;case"reasoning_delta":ye(ke("reasoning"),i=>i.kind==="reasoning"?{...i,text:i.text+n.text}:i);break;case"reasoning_end":L(i=>{const c=i.blocks??[],h=Ke(c,m=>m.kind==="reasoning"&&m.active);if(h<0)return i;const p=c[h];if(p.kind!=="reasoning")return i;const y=c[h-1];return(y==null?void 0:y.kind)==="reasoning"&&y.text===p.text?{...i,blocks:c.filter((m,R)=>R!==h)}:{...i,blocks:c.map((m,R)=>R===h?{...p,active:!1,open:!1}:m)}});break;case"tool_call":U({kind:"tool",id:n.id,name:n.name,args:n.args,status:"running",open:!1});break;case"tool_result":ye(i=>i.kind==="tool"&&i.id===n.id,i=>i.kind==="tool"?n.status?{...i,schema_version:2,status:n.status,took_ms:n.took_ms,content:n.content,metadata:n.metadata,open:n.status!=="success"}:{...i,status:"done",hits:n.hits,took_ms:n.took_ms,results:n.results}:i);break;case"answer_delta":L(i=>{const c=Re(i),h=c.blocks??[],p=h.at(-1);return(p==null?void 0:p.kind)==="answer"&&!p.done?{...c,blocks:[...h.slice(0,-1),{...p,text:p.text+n.text}]}:{...c,blocks:[...h,{kind:"answer",text:n.text,done:!1}]}});break;case"done":L(i=>({...i,streaming:!1,followups:n.followups,finishReason:n.finish_reason,citations:n.citations,blocks:(i.blocks??[]).map(c=>c.kind==="answer"?{...c,done:!0}:c.kind==="reasoning"&&c.active?{...c,active:!1,open:!1}:c)}));break;case"error":L(i=>({...i,streaming:!1,error:n.message,errorCode:n.code,blocks:(i.blocks??[]).map(c=>c.kind==="reasoning"&&c.active?{...c,active:!1,open:!1}:c)}));break}},ae=async(n,i)=>{const c=await We(n),h=Rt(c);return T.current!==i?null:(d(h),E.current=h,h)},ee=(n,i,c,h,p)=>{const y=++T.current;w.current=!0;const m=new AbortController;x.current=m;const R=n.text;return X.current=n,V.current=i.session_id,v(""),d(c),f(!0),C.current={controller:m,submittedAt:performance.now(),streamStartReported:!1,firstVisibleReported:!1,terminalReported:!1},_.current!==null&&window.clearTimeout(_.current),D.current="armed",_.current=window.setTimeout(()=>{_.current=null,!(D.current!=="armed"||x.current!==m||m.signal.aborted||T.current!==y)&&(D.current="shown",L(k=>{var q;return k.role==="assistant"&&k.streaming&&(((q=k.blocks)==null?void 0:q.length)??0)===0&&!k.error?{...k,status:kt}:k}))},wn),(async()=>{var te,$,W;let k=!1,q=!1,M=!1,G=!1,j=!1,P=!1;try{for await(const a of vn(i,{signal:m.signal})){a.type==="stream_start"&&(k=!0,q=a.provider_execution!==!1,ue(m,a.request_id)),(a.type==="workspace_ready"||a.type==="reasoning_start"||a.type==="reasoning_delta"||a.type==="tool_call"||a.type==="answer_delta"||a.type==="done"||a.type==="error")&&de(m),(a.type==="done"||a.type==="error")&&(G=!0,j=a.type==="error",A(m,a.type==="error"?"error":"complete"),a.type==="error"&&["openrouter_monthly_budget_exhausted","openrouter_unavailable","openrouter_byok_credential_invalid","openrouter_byok_billing_error","openrouter_byok_rate_limit"].includes(a.code??"")&&(M=!0,g.current.onInterrupted(n)));const N=T.current===y;!m.signal.aborted&&(N||a.type==="stream_start"||a.type==="session_title_start"||a.type==="session_title_delta"||a.type==="session_title_done")&&K(a)}}catch(a){if(j=!0,!m.signal.aborted){if(de(m),a instanceof me&&a.code==="chat_temporarily_disabled")P=!0,oe({question:R,draft:n}),T.current===y&&(d(h),E.current=h,v(""));else if(a instanceof me&&a.code==="chat_capacity"){P=!0;const N=a.retryAfterSeconds??5,ne={question:R,draft:n,request:i,optimistic:c,original:h,edit:p,retryAfterSeconds:N,retryAt:Date.now()+N*1e3};Y.current=ne,J({question:R,draft:n,retryAt:ne.retryAt,retryAfterSeconds:N}),T.current===y&&(d(h),E.current=h,v(""))}else A(m,"network_error"),a instanceof me&&["paper_context_unavailable","paper_mention_unavailable","paper_mentions_disabled","chat_storage_quota_exceeded"].includes(a.code??"")&&(P=!0,g.current.onInterrupted(n),T.current===y&&(d(h),E.current=h,v(a.message))),a instanceof me&&["openrouter_monthly_budget_exhausted","openrouter_unavailable","openrouter_byok_credential_invalid","openrouter_byok_billing_error","openrouter_byok_rate_limit"].includes(a.code??"")&&(M=!0,g.current.onInterrupted(n));!P&&T.current===y&&K({type:"error",message:a instanceof Error?a.message:"The assistant stream failed.",code:a instanceof me?a.code:void 0})}}finally{if(x.current===m){if(de(m),!G&&!m.signal.aborted&&A(m,"network_error"),w.current=!1,f(!1),P)g.current.onSettled(i.session_id);else if(!m.signal.aborted){(k&&q||M)&&(($=(te=g.current).onProviderTerminal)==null||$.call(te));const a=V.current;if(p&&!k)T.current===y&&(d(p.snapshot),E.current=p.snapshot,v("Couldn’t resend this message. Your original conversation was restored."));else if(a){T.current===y&&p&&!p.first&&(j||!G)&&(d(p.snapshot),E.current=p.snapshot);try{const N=await ae(a,y);N&&p&&!p.first&&N.some(ne=>ne.id===p.targetId)&&v("Couldn’t resend this message. Your original conversation was restored.")}catch{T.current===y&&L(N=>N.streaming?{...N,streaming:!1}:N)}}else T.current===y&&L(N=>N.streaming?{...N,streaming:!1}:N);g.current.onSettled(a)}((W=C.current)==null?void 0:W.controller)===m&&(C.current=null)}}})(),!0},Ce=o.useCallback(n=>{const i=typeof n=="string"?{text:n.trim(),paperMentions:[]}:n,c=i.text;if(!c||c.length>8e3||w.current||Y.current)return!1;const h=E.current,p=[...h].reverse().find(M=>M.role==="user"),y=p!=null&&p.status&&p.status!=="complete"&&p.revision?{replace_message_id:p.id,prior_revision:p.revision}:null,m={id:F(),role:"user",text:c,paperMentions:i.paperMentions},R={id:F(),role:"assistant",streaming:!0,blocks:[]},k=y&&p?Ke(h,M=>M.id===p.id):-1,q=k<0?[...h,m,R]:[...h.slice(0,k),m,R];return ee(i,{message:c,paper_mentions:i.paperMentions.map(({route_id:M,title:G,start:j,end:P})=>({route_id:M,title:G,start:j,end:P})),session_id:g.current.sessionId,client_message_id:crypto.randomUUID(),...!g.current.sessionId&&g.current.initialModel?{initial_model:g.current.initialModel}:{},...y??{}},q,h)},[]),be=o.useCallback((n,i)=>{const c=typeof i=="string"?{text:i.trim(),paperMentions:[]}:i,h=c.text;if(!h||h.length>8e3||w.current||Y.current)return!1;const p=E.current.slice(),y=p.findIndex(j=>j.id===n&&j.role==="user");if(y<0)return!1;const m=p[y],R=p.findIndex(j=>j.role==="user"),k=y===R;if(!k&&(!g.current.sessionId||!m.revision))return!1;const q={id:m.id,role:"user",text:h,paperMentions:c.paperMentions,revision:k?void 0:m.revision+1,status:"generating"},M={id:F(),role:"assistant",streaming:!0,blocks:[]},G=k?[q,M]:[...p.slice(0,y),q,M];return ee(c,{message:h,paper_mentions:c.paperMentions.map(({route_id:j,title:P,start:te,end:$})=>({route_id:j,title:P,start:te,end:$})),session_id:k?null:g.current.sessionId,client_message_id:crypto.randomUUID(),...k&&g.current.initialModel?{initial_model:g.current.initialModel}:{},...k?{}:{replace_message_id:m.id,prior_revision:m.revision}},G,p,{targetId:m.id,snapshot:p,first:k})},[]),Ye=o.useCallback(()=>{Y.current=null,J(null)},[]),he=o.useCallback(()=>{const n=Y.current;return!n||Date.now()<n.retryAt||w.current?!1:(Y.current=null,J(null),ee(n.draft,n.request,n.optimistic,n.original,n.edit))},[]),Fe=o.useCallback(()=>{var h;if(!x.current)return;const n=x.current;de(n),A(n,"stopped"),n.abort(),x.current=null,((h=C.current)==null?void 0:h.controller)===n&&(C.current=null),w.current=!1,f(!1),d(p=>{const y=p.at(-1);if((y==null?void 0:y.role)!=="assistant")return p;const m=(y.blocks??[]).flatMap(R=>R.kind==="tool"&&R.status==="running"?[]:R.kind==="reasoning"&&R.active?[]:R.kind==="answer"?[{...R,done:!0}]:[R]);return[...p.slice(0,-1),{...y,blocks:m,streaming:!1,finishReason:"stopped"}]}),g.current.onInterrupted(X.current);const i=V.current;i&&Vt(i).catch(()=>{});const c=++T.current;window.setTimeout(()=>{i&&T.current===c?ae(i,c).catch(()=>{}).finally(()=>g.current.onSettled(i)):i||g.current.onSettled(null)},450)},[]),pe=o.useCallback((n,i)=>d(c=>c.map(h=>{var p;return h.id!==n?h:{...h,blocks:(p=h.blocks)==null?void 0:p.map((y,m)=>m===i&&(y.kind==="reasoning"||y.kind==="tool")?{...y,open:!y.open}:y)}})),[]),Oe=o.useCallback(()=>{var n;T.current+=1,_.current!==null&&(window.clearTimeout(_.current),_.current=null),D.current="cleared",(n=x.current)==null||n.abort(),x.current=null,C.current=null,Y.current=null,J(null),w.current=!1,V.current=null,d([]),f(!1),v("")},[]),ve=o.useCallback(n=>{var i;T.current+=1,_.current!==null&&(window.clearTimeout(_.current),_.current=null),D.current="cleared",C.current=null,Y.current=null,J(null),w.current||((i=x.current)==null||i.abort(),x.current=null),d(n),w.current||f(!1),v("")},[]);return{messages:u,busy:S,papers:Me,sessionError:O,capacityRequest:Z,disabledRequest:Se,send:Ce,editAndResend:be,retryCapacity:he,cancelCapacity:Ye,dismissDisabled:()=>oe(null),stop:Fe,toggleBlock:pe,reset:Oe,load:ve}}const Rn="https://huggingface.co/settings/inference-providers",_t="pwc.chat.billing-notice-dismissed.v1",Q=(l="")=>({text:l,paperMentions:[]}),Sn=()=>{const l=sessionStorage.getItem(Ae);if(!l)return null;try{const u=JSON.parse(l);if(typeof u.text=="string"&&Array.isArray(u.paperMentions))return u}catch{}return Q(l)},wt=({provider:l})=>{const[u,d]=o.useState(()=>localStorage.getItem(_t)==="1");return!ge()||u||l!=="huggingface"?null:t.jsxs("div",{className:"chat-billing-notice",role:"note",children:[t.jsx("span",{children:"Hugging Face models use the inference permission granted when you start chatting. Included monthly credits are used first, then extra usage requires purchased credits. You can choose organization billing in Settings."}),t.jsxs("div",{className:"chat-billing-notice-actions",children:[t.jsx("a",{href:"/settings",children:"Review billing"}),t.jsx("a",{href:Rn,target:"_blank",rel:"noreferrer",children:"Review usage"}),t.jsx("button",{type:"button",className:"chat-billing-notice-dismiss","aria-label":"Dismiss billing notice",title:"Dismiss",onClick:()=>{localStorage.setItem(_t,"1"),d(!0)},children:t.jsx(Ht,{size:15,"aria-hidden":"true"})})]})]})},xt=({enabled:l,fallbackEnabled:u,byokExpected:d})=>{const S=hn(l);if(!l||!S.data)return null;const f=S.data,O=pn(f.resets_at),v=f.unavailable_reason==="shared_credits_exhausted"||f.unavailable_reason==="workspace_limit_exhausted"||f.unavailable_reason==="provider_status_unavailable";return t.jsxs("div",{className:"chat-openrouter-usage",role:"status",children:[t.jsx("span",{children:v?t.jsxs(t.Fragment,{children:[t.jsx("strong",{children:"Shared OpenRouter credits unavailable"})," · ",f.remaining_percent,"% of your allowance remains"]}):t.jsxs(t.Fragment,{children:[t.jsxs("strong",{children:[f.remaining_percent,"% left"]})," this month · resets ",O.local]})}),(!f.available||d)&&t.jsx("span",{children:u?"Your OpenRouter account will be billed on this explicit send.":t.jsxs(t.Fragment,{children:[t.jsx("a",{href:"/settings#openrouter-byok",children:"Connect your own key in Settings"})," to continue."]})})]})},kn=({retryAt:l,onRetry:u,onCancel:d})=>{const[S,f]=o.useState(()=>Math.max(0,Math.ceil((l-Date.now())/1e3))),O=o.useRef(null);return o.useEffect(()=>{var _;const v=document.activeElement instanceof HTMLElement?document.activeElement:null;(_=O.current)==null||_.focus();const w=()=>f(Math.max(0,Math.ceil((l-Date.now())/1e3)));w();const x=window.setInterval(w,250);return()=>{window.clearInterval(x),v==null||v.focus()}},[l]),t.jsx("div",{className:"chat-capacity-dialog-backdrop",role:"presentation",children:t.jsxs("div",{className:"chat-capacity-dialog",role:"dialog","aria-modal":"true","aria-labelledby":"chat-capacity-dialog-title","aria-describedby":"chat-capacity-dialog-description",onKeyDown:v=>{v.key==="Escape"&&(v.preventDefault(),d())},children:[t.jsx("h2",{id:"chat-capacity-dialog-title",children:"All research slots are currently in use"}),t.jsx("p",{id:"chat-capacity-dialog-description",children:"Your message was not sent or billed. Try again in a few seconds."}),t.jsx("p",{className:"chat-capacity-countdown","aria-live":"polite",children:S>0?`Try again available in ${S} second${S===1?"":"s"}.`:"You can try again now."}),t.jsxs("div",{className:"chat-capacity-dialog-actions",children:[t.jsx("button",{type:"button",className:"chat-capacity-cancel",ref:O,onClick:d,children:"Cancel"}),t.jsx("button",{type:"button",className:"chat-capacity-retry",disabled:S>0,onClick:u,children:"Try again"})]})]})})},Cn=({onClose:l})=>{const u=o.useRef(null);return o.useEffect(()=>{var S;const d=document.activeElement instanceof HTMLElement?document.activeElement:null;return(S=u.current)==null||S.focus(),()=>d==null?void 0:d.focus()},[]),t.jsx("div",{className:"chat-capacity-dialog-backdrop",role:"presentation",children:t.jsxs("div",{className:"chat-capacity-dialog",role:"dialog","aria-modal":"true","aria-labelledby":"chat-disabled-title","aria-describedby":"chat-disabled-description",onKeyDown:d=>{d.key==="Escape"&&(d.preventDefault(),l())},children:[t.jsx("h2",{id:"chat-disabled-title",children:"Chat is temporarily disabled"}),t.jsx("p",{id:"chat-disabled-description",children:"We've temporarily paused new research runs. Your message wasn't sent, and your draft is still here. Please try again later."}),t.jsx("div",{className:"chat-capacity-dialog-actions",children:t.jsx("button",{ref:u,type:"button",className:"chat-capacity-cancel",onClick:l,children:"Keep editing"})})]})})},Fn=()=>{var Ze,et,tt,nt,rt,st,at,it,ot,ct;const{sessionId:l}=Dt(),u=Pt(),[d,S]=Mt(),{user:f,isLoading:O}=Yt(),{toast:v}=Ft(),w=qt(),x=Bt(),_=lt({queryKey:["chatAvailability"],queryFn:()=>Kt.getChatAvailability(),refetchInterval:3e4,retry:!1,enabled:ge()}),D=lt({queryKey:["inference-billing",f==null?void 0:f.hf_subject],queryFn:async()=>{const e=await fetch(De("/api/v1/me/inference-billing"),{credentials:"include",cache:"no-store"});if(!e.ok)throw new Error("Could not load Hugging Face billing status.");return e.json()},enabled:ge()&&!!f,retry:!1}),C=((Ze=_.data)==null?void 0:Ze.status)==="paused",[Y,Z]=o.useState([]),[J,Se]=o.useState(!1),[oe,E]=o.useState(""),[g,X]=o.useState(()=>l?{id:l,status:"loading"}:null),[ce,Pe]=o.useState(0),T=o.useRef(Gt()),V=o.useRef(d.get("model")||((et=T.current)==null?void 0:et.model)),[le,Me]=o.useState(x?$t:zt),[F,L]=o.useState(V.current||Qt),U=((tt=le.find(e=>e.id===F))==null?void 0:tt.provider)??"huggingface",ye=ln(!!(f&&U==="openrouter")),ke=o.useRef(U);ke.current=U;const[de,B]=o.useState(""),[ue,A]=o.useState(()=>Q()),[K,ae]=o.useState(()=>{var e,r;return Q(((e=d.get("q"))==null?void 0:e.trim())||((r=T.current)==null?void 0:r.prompt)||"")}),ee=o.useRef(!1),Ce=o.useRef(!1),be=o.useRef(!1),[Ye,he]=o.useState(null),[Fe,pe]=o.useState(null),[Oe,ve]=o.useState(""),[n,i]=o.useState(null),[c,h]=o.useState(()=>typeof window>"u"||window.innerWidth>900),[p,y]=o.useState(!1),[m,R]=o.useState(null),[k,q]=o.useState(""),M=o.useRef(new Set),G=o.useRef(!1),j=o.useRef(l),P=o.useRef(null),te=o.useRef(null),$=o.useRef(null);j.current=l;const W=o.useCallback(async()=>{if(!f)return;const e=!G.current;e&&Se(!0);try{const r=await Jt();Z(s=>{const b=P.current,I=b?s.find(xe=>xe.id===b):void 0;if(!I)return r;const z=r.find(xe=>xe.id===b);return[z?{...z,title:I.title,is_busy:!0}:I,...r.filter(xe=>xe.id!==b)]}),G.current=!0,E("")}catch(r){E(r instanceof Error?r.message:"Could not load chats")}finally{e&&Se(!1)}},[f]),a=xn({sessionId:l??null,initialModel:F,onSessionId:e=>{P.current=e;const r=e!==j.current,s=(j.current??null)===te.current,b=new Date().toISOString();Z(I=>I.some(z=>z.id===e)?I.map(z=>z.id===e?{...z,is_busy:!0}:z):[{id:e,title:"New chat",selected_model:F,created_at:b,updated_at:b,message_count:1,is_busy:!0},...I]),r&&s&&B("New chat"),s&&($.current=e,X({id:e,status:"loaded"}),r&&u(`/chat/${e}`,{replace:!0}))},onTitle:e=>{const r=P.current??j.current;r&&!M.current.has(r)&&(r===j.current&&B(e),Z(s=>s.map(b=>b.id===r?{...b,title:e}:b)))},onSettled:e=>{e&&Z(r=>r.map(s=>s.id===e?{...s,is_busy:!1}:s)),P.current=null,te.current=null,W()},onProviderTerminal:()=>{ke.current==="openrouter"&&(w.invalidateQueries({queryKey:dn}),w.invalidateQueries({queryKey:un}))},onInterrupted:e=>{A(e)}});a.load;const N=a.send;o.useEffect(()=>{a.capacityRequest&&A(a.capacityRequest.draft)},[a.capacityRequest]),o.useEffect(()=>{a.busy&&he(null)},[a.busy]);const ne=o.useCallback(e=>{sessionStorage.setItem(Ae,JSON.stringify(e)),sessionStorage.setItem(Ie,F),sessionStorage.setItem(Ne,"1"),sessionStorage.setItem(Le,"1"),window.location.href=Ut("/chat",!0)},[F]),Ee=o.useCallback((e,r)=>{sessionStorage.setItem(Ae,JSON.stringify(e)),sessionStorage.setItem(Ie,F),sessionStorage.removeItem(Ne),sessionStorage.removeItem(Le),ae(Q()),A(e),E(r)},[F]),_e=o.useCallback(async e=>{if(!f){ne(e);return}if(U==="huggingface"&&!Ce.current){if(be.current)return;be.current=!0;try{const s=await fetch(De("/api/v1/me/inference-billing"),{credentials:"include",cache:"no-store"});if(!s.ok)throw new Error("Could not check Hugging Face authorization.");if(!(await s.json()).connected){if(sessionStorage.getItem(Le)==="1"){Ee(e,"Hugging Face inference authorization was not completed. Your prompt is ready to retry.");return}ne(e);return}Ce.current=!0}catch(s){Ee(e,s instanceof Error?s.message:"Could not check Hugging Face authorization.");return}finally{be.current=!1}}const r=j.current??null;if(sessionStorage.removeItem(Ne),!N(e)){Ee(e,"Your prompt was not sent. It is ready to retry.");return}te.current=r,P.current=r,sessionStorage.removeItem(Ae),sessionStorage.removeItem(Ie),sessionStorage.removeItem(Le),Xt(),A(Q())},[ne,Ee,U,N,f]);o.useEffect(()=>{if(O||!f)return;const e=sessionStorage.getItem(Ie);e&&L(e),W(),Zt().then(b=>{if(Me(b.items),!j.current){const I=V.current||e;L(I&&b.items.some(z=>z.id===I)?I:b.default_model)}});const r=Sn(),s=sessionStorage.getItem(Ne)==="1";r&&(s?ae(r):A(r))},[O,W,f]),o.useEffect(()=>{if(!l){$.current!==null&&($.current=null,a.reset()),X(null);return}if($.current===l||(X(r=>(r==null?void 0:r.id)===l&&r.status==="loading"?r:{id:l,status:"loading"}),O||!f))return;let e=!1;return E(""),We(l).then(r=>{e||(a.load(Rt(r)),L(r.selected_model),B(r.title),$.current=l,X({id:l,status:"loaded"}))}).catch(r=>{if(e)return;const s=r instanceof Error?r.message:"Chat not found";a.reset(),E(s),X({id:l,status:"error",error:s})}),()=>{e=!0}},[O,l,f,a.busy,ce]),o.useEffect(()=>{var b;const e=(b=d.get("q"))==null?void 0:b.trim();if(!e)return;ee.current=!1;const r=d.get("model");r&&L(r),ae(Q(e));const s=new URLSearchParams(d);s.delete("q"),s.delete("model"),S(s,{replace:!0})},[d,S]),o.useEffect(()=>{if(O||a.busy||!K.text||ee.current||l&&(g==null?void 0:g.status)!=="loaded")return;const e=window.setTimeout(()=>{if(ee.current)return;ee.current=!0,_e(K).finally(()=>ae(Q()))},0);return()=>window.clearTimeout(e)},[O,a.busy,K,l,g==null?void 0:g.status,_e]),o.useEffect(()=>{const e=()=>{!f||a.busy||W()};return window.addEventListener("focus",e),()=>window.removeEventListener("focus",e)},[a.busy,W,f]),o.useEffect(()=>{if(!n)return;const e=()=>i(null),r=s=>{s.key==="Escape"&&e()};return window.addEventListener("click",e),window.addEventListener("keydown",r),()=>{window.removeEventListener("click",e),window.removeEventListener("keydown",r)}},[n]);const Ve=()=>{P.current=null,a.reset(),A(Q()),B(""),u("/chat")},Ge=async e=>{const r=Oe.trim();if(r)try{const s=await ft(e,{title:r});M.current.add(e),e===l&&B(s.title),Z(b=>b.map(I=>I.id===e?s:I)),pe(null)}catch(s){E(s instanceof Error?s.message:"Rename failed")}},Ct=async e=>{const r=e===l&&a.busy;if(window.confirm(r?"Stop and delete this chat? This cannot be undone.":"Delete this chat? This cannot be undone.")){r&&a.stop();try{if(r){const s=Date.now()+3e3;for(;(await We(e)).is_busy;){if(Date.now()>=s)throw new Error("Generation is still stopping. The chat was not deleted.");await new Promise(I=>window.setTimeout(I,150))}}await rn(e),e===l&&Ve(),await W()}catch(s){E(s instanceof Error?s.message:"Delete failed")}}},Ot=async()=>{if(m===null){R("old");try{const e=await on();if(await W(),e.archived_count===0){v({title:"No chats were archived",description:"There are no inactive chats older than 30 days."});return}const r=[...a.messages].reverse().find(s=>s.role==="user");a.reset(),A({text:(r==null?void 0:r.text)??"",paperMentions:(r==null?void 0:r.paperMentions)??[]}),B(""),v({title:`${e.archived_count} ${e.archived_count===1?"chat":"chats"} archived`,description:"Your question is ready to send again."})}catch(e){v({variant:"destructive",title:"Could not archive old chats",description:e instanceof Error?e.message:"Try again."})}finally{R(null)}}},Et=async()=>{if(m===null){R("oldest");try{const e=await an();await W();const r=[...a.messages].reverse().find(s=>s.role==="user");a.reset(),A({text:(r==null?void 0:r.text)??"",paperMentions:(r==null?void 0:r.paperMentions)??[]}),B(""),v({title:`${e.archived_count} ${e.archived_count===1?"chat":"chats"} archived`,description:"Your question is ready to send again."})}catch(e){v({variant:"destructive",title:"Could not archive chats",description:e instanceof Error?e.message:"Try again."})}finally{R(null)}}},$e=async e=>{const r=F;if(L(e),!!l)try{const s=await ft(l,{selected_model:e});Z(b=>b.map(I=>I.id===l?{...I,selected_model:s.selected_model}:I)),E("")}catch(s){L(r),E(s instanceof Error?s.message:"Model change failed")}},Tt=async()=>{var e;if(!(!l||a.busy||p)){y(!0);try{const r=await sn(l),s=new URL(r.public_path,window.location.origin).toString();try{if(!((e=navigator.clipboard)!=null&&e.writeText))throw new Error("Clipboard unavailable");await navigator.clipboard.writeText(s),v({className:"chat-share-toast",duration:5e3,title:"Public link copied to your clipboard",description:"Anyone with this link can see this conversation."})}catch{q(s)}}catch(r){const s=r instanceof Error?r.message:"Could not share this conversation";E(s),v({variant:"destructive",title:"Share failed",description:s})}finally{y(!1)}}},[jt,It]=o.useState(60);o.useLayoutEffect(()=>{const e=document.querySelector(".app-header");if(!e)return;const r=()=>It(e.offsetHeight);r();const s=new ResizeObserver(r);return s.observe(e),()=>s.disconnect()},[]);const qe=o.useRef(null),Te=o.useRef(null),we=o.useRef(null);o.useEffect(()=>{a.busy||(we.current=null)},[a.busy]);const Nt=(e,r)=>{var s;Te.current=((s=qe.current)==null?void 0:s.scrollTop)??null,a.toggleBlock(e,r)};o.useLayoutEffect(()=>{const e=qe.current;if(e){if(Te.current!==null){e.scrollTop=Te.current,Te.current=null;return}if(we.current){const r=Array.from(e.querySelectorAll("[data-message-id]")).find(s=>s.dataset.messageId===we.current);if(r){const s=e.getBoundingClientRect(),b=r.getBoundingClientRect();e.scrollTop+=b.top-s.top-24;return}}e.scrollTop=e.scrollHeight}},[a.messages]);const fe=Y.find(e=>e.id===l),ze=a.messages.filter(e=>e.role==="user"),Ue=(nt=ze[0])==null?void 0:nt.id,Lt=(rt=ze.at(-1))==null?void 0:rt.id,je=a.messages.length===0,Qe=(st=[...a.messages].reverse().find(e=>e.role==="assistant"&&e.errorCode))==null?void 0:st.errorCode,Je=Qe==="openrouter_unavailable"||Qe==="openrouter_monthly_budget_exhausted",Be=(g==null?void 0:g.id)===l,He=!!(l&&(O||f&&(!Be||(g==null?void 0:g.status)==="loading"))),Xe=Be&&(g==null?void 0:g.status)==="error"?g.error:void 0;return t.jsxs("div",{className:"chat-page",style:{height:`calc(100dvh - ${jt}px)`},children:[t.jsxs("aside",{className:`chat-sidebar${c?"":" chat-sidebar-closed"}`,children:[t.jsxs("div",{className:"chat-sidebar-top",children:[t.jsxs("button",{type:"button",className:"chat-new-chat",onClick:Ve,children:[t.jsx(en,{})," New chat"]}),t.jsx("button",{type:"button",className:"icon-btn",onClick:()=>h(!1),title:"Collapse sidebar",children:t.jsx(ht,{})})]}),t.jsxs("nav",{className:"chat-sessions","aria-label":"Chat history",children:[J&&t.jsx("div",{className:"chat-sessions-empty",children:"Loading chats…"}),!J&&oe&&t.jsx("div",{className:"chat-sessions-empty",children:oe}),!J&&!oe&&Y.length===0&&t.jsx("div",{className:"chat-sessions-empty",children:"Conversations you start will show up here."}),tn(Y).map(e=>t.jsxs("div",{className:"chat-session-group",children:[t.jsx("div",{className:"chat-session-group-label",children:e.label}),e.items.map(r=>t.jsxs("div",{className:`chat-session${r.id===l?" chat-session-active":""}`,role:"button",tabIndex:0,onClick:()=>u(`/chat/${r.id}`),onKeyDown:s=>{if(s.key==="Enter"&&u(`/chat/${r.id}`),s.key==="F2"&&(pe(r.id),ve(r.title)),s.key==="ContextMenu"||s.shiftKey&&s.key==="F10"){s.preventDefault();const b=s.currentTarget.getBoundingClientRect();i({id:r.id,x:b.right-150,y:b.bottom})}},onContextMenu:s=>{s.preventDefault(),i({id:r.id,x:s.clientX,y:s.clientY})},children:[Fe===r.id?t.jsx("input",{className:"chat-session-title-input",value:Oe,autoFocus:!0,maxLength:80,onClick:s=>s.stopPropagation(),onChange:s=>ve(s.target.value),onBlur:()=>void Ge(r.id),onKeyDown:s=>{s.stopPropagation(),s.key==="Enter"&&Ge(r.id),s.key==="Escape"&&pe(null)}}):t.jsx("span",{className:"chat-session-title",children:r.title}),t.jsx("button",{type:"button",className:"chat-session-menu","aria-label":"Chat actions","aria-haspopup":"menu",title:"Chat actions",onClick:s=>{s.stopPropagation();const b=s.currentTarget.getBoundingClientRect();i({id:r.id,x:b.right-150,y:b.bottom})},children:"⋯"}),t.jsx("button",{type:"button",className:"chat-session-delete","aria-label":"Delete conversation",onClick:s=>{s.stopPropagation(),Ct(r.id)},children:t.jsx(nn,{})})]},r.id))]},e.label))]}),n&&t.jsx("div",{className:"chat-session-context-menu",role:"menu",style:{left:n.x,top:n.y},onClick:e=>e.stopPropagation(),children:t.jsx("button",{type:"button",role:"menuitem",autoFocus:!0,onClick:()=>{const e=Y.find(r=>r.id===n.id);e&&(pe(e.id),ve(e.title)),i(null)},children:"Rename chat"})})]}),t.jsxs("section",{className:"chat-main",children:[t.jsxs("div",{className:"chat-topbar",children:[!c&&t.jsx("button",{type:"button",className:"icon-btn",onClick:()=>h(!0),title:"Open sidebar",children:t.jsx(ht,{})}),t.jsx("span",{className:"chat-topbar-title",children:He?(fe==null?void 0:fe.title)||"":de||(fe==null?void 0:fe.title)||(je?"":"New chat")}),x&&t.jsx("span",{className:"chat-staging-badge",children:"Staging"}),l&&Be&&(g==null?void 0:g.status)==="loaded"&&!je&&t.jsxs("button",{type:"button",className:"chat-share-button",onClick:()=>void Tt(),disabled:a.busy||p||He,"aria-label":"Share conversation",children:[p?t.jsx(pt,{}):t.jsx(fn,{"aria-hidden":"true"}),t.jsx("span",{children:"Share"})]})]}),He&&!K.text?t.jsxs("div",{className:"chat-session-loading",role:"status","aria-live":"polite",children:[t.jsx(pt,{}),t.jsx("span",{children:"Loading conversation…"})]}):Xe?t.jsxs("div",{className:"chat-session-load-error",role:"alert",children:[t.jsx("p",{children:Xe}),t.jsx("button",{type:"button",onClick:()=>{X({id:l,status:"loading"}),Pe(e=>e+1)},children:"Try again"})]}):je&&!K.text?t.jsx("div",{className:"chat-empty",children:t.jsxs("div",{className:"chat-empty-inner",children:[t.jsx("div",{className:"chat-empty-eyebrow",children:"AI research assistant · Staging preview"}),t.jsxs("h1",{className:"chat-empty-title",children:["Ask ",t.jsx("em",{children:"Papers With Code"})]}),t.jsx("p",{className:"chat-empty-sub",children:"Answers are grounded in a live hybrid search over papers, tasks, and benchmarks — with citations you can follow."}),x&&t.jsx("p",{className:"chat-staging-access-note",children:"This is a limited staging preview. Only approved Hugging Face users can start chats."}),t.jsx(wt,{provider:U}),t.jsx(xt,{enabled:U==="openrouter",fallbackEnabled:!!((at=ye.data)!=null&&at.fallback_enabled),byokExpected:Je}),C&&t.jsx("div",{id:"chat-paused-description",className:"chat-paused-banner",role:"status",children:"Chat is temporarily disabled. You can keep browsing and editing your conversations. New research runs will return when chat is restored."}),t.jsx(dt,{onSend:_e,busy:a.busy,onStop:a.stop,autoFocus:!0,draft:ue,onDraftChange:A,models:le,selectedModel:F,onModelChange:e=>void $e(e),disabled:C,describedBy:C?"chat-paused-description":void 0,paperMentionsEnabled:!!((it=_.data)!=null&&it.paper_mentions_enabled)}),t.jsx("div",{className:"chat-examples",children:cn.map(e=>t.jsx("button",{type:"button",className:"chat-example",disabled:C,onClick:()=>_e(Q(e)),children:e},e))})]})}):t.jsxs(t.Fragment,{children:[a.sessionError&&t.jsx("div",{className:"chat-session-error",role:"alert",children:a.sessionError}),t.jsx("div",{className:"chat-conversation",ref:qe,children:t.jsxs("div",{className:"chat-conversation-inner",children:[je&&K.text&&t.jsx(ut,{id:"queued-launch-preview",text:K.text,paperMentions:K.paperMentions,isInitial:!0}),a.messages.map(e=>{var r;return e.role==="user"?t.jsx(ut,{id:e.id,text:e.text??"",paperMentions:e.paperMentions??[],paperMentionsEnabled:!!((r=_.data)!=null&&r.paper_mentions_enabled),isInitial:e.id===Ue,editingAllowed:!a.busy&&!!e.revision,editing:Ye===e.id,editNotice:e.id===Ue?"Sending will start a new chat.":e.id===Lt?"Sending will replace the response.":"Sending will replace the response and all messages after it.",onEdit:()=>he(e.id),onCancel:()=>he(null),onResendDraft:s=>{e.id!==Ue&&(we.current=e.id);const b=a.editAndResend(e.id,s);return b?he(null):we.current=null,b}},e.id):t.jsx(Wt,{msg:e,papers:a.papers,onToggleBlock:Nt,onArchiveOldChats:()=>void Ot(),onArchiveOldestChats:()=>void Et(),archivePending:m,hfBilling:D.data??null},e.id)})]})}),t.jsx("div",{className:"chat-composer-wrap",children:t.jsxs("div",{className:"chat-composer-inner",children:[t.jsx(wt,{provider:U}),t.jsx(xt,{enabled:U==="openrouter",fallbackEnabled:!!((ot=ye.data)!=null&&ot.fallback_enabled),byokExpected:Je}),C&&t.jsx("div",{id:"chat-paused-description",className:"chat-paused-banner",role:"status",children:"Chat is temporarily disabled. You can keep browsing and editing your conversations. New research runs will return when chat is restored."}),t.jsx(dt,{onSend:_e,busy:a.busy,onStop:a.stop,placeholder:ue.text?"Edit and send again…":"Ask a follow-up…",draft:ue,onDraftChange:A,models:le,selectedModel:F,onModelChange:e=>void $e(e),disabled:C,describedBy:C?"chat-paused-description":void 0,paperMentionsEnabled:!!((ct=_.data)!=null&&ct.paper_mentions_enabled)}),t.jsx("div",{className:"chat-composer-foot",children:ge()?t.jsxs(t.Fragment,{children:[U==="openrouter"?t.jsxs("span",{className:"chat-provider-attribution",children:["Powered by ",t.jsx("a",{href:"https://openrouter.ai",target:"_blank",rel:"noreferrer",children:"OpenRouter"}),"."]}):t.jsxs("span",{className:"chat-provider-attribution",children:["Powered by 🤗 ",t.jsx("a",{href:"https://huggingface.co/docs/inference-providers/en/index",target:"_blank",rel:"noreferrer",children:"Inference Providers"}),"."]}),t.jsx("span",{children:"The AI assistant can make mistakes. Double-check responses."})]}):t.jsx(t.Fragment,{children:"Assistant preview — responses are simulated."})})]})})]})]}),k&&t.jsx("div",{className:"chat-share-dialog-backdrop",role:"presentation",onMouseDown:()=>q(""),children:t.jsxs("div",{className:"chat-share-dialog",role:"dialog","aria-modal":"true","aria-labelledby":"chat-share-dialog-title",onMouseDown:e=>e.stopPropagation(),children:[t.jsx("h2",{id:"chat-share-dialog-title",children:"Public link created"}),t.jsx("p",{children:"Anyone with this link can see this conversation. It could not be copied automatically, so copy it manually:"}),t.jsx("input",{readOnly:!0,value:k,"aria-label":"Public conversation link",autoFocus:!0,onFocus:e=>e.currentTarget.select()}),t.jsx("button",{type:"button",onClick:()=>q(""),children:"Close"})]})}),a.capacityRequest&&t.jsx(kn,{retryAt:a.capacityRequest.retryAt,onCancel:a.cancelCapacity,onRetry:()=>{a.retryCapacity()&&A(Q())}}),a.disabledRequest&&t.jsx(Cn,{onClose:()=>{var e;A(((e=a.disabledRequest)==null?void 0:e.draft)??ue),a.dismissDisabled(),_.refetch()}})]})};export{kn as ChatCapacityDialog,Cn as ChatDisabledDialog,Fn as default};
|
assets/{ConferenceDetailView-CNr7MfPk.js → ConferenceDetailView-mC_EreQQ.js}
RENAMED
|
@@ -1 +1 @@
|
|
| 1 |
-
import{f as L,r as D,j as e,L as p,c as C}from"./index-
|
|
|
|
| 1 |
+
import{f as L,r as D,j as e,L as p,c as C}from"./index-Bthypk3Q.js";import{u as T}from"./useQuery-CEDDm0wh.js";import{M as F}from"./MarkdownText-DX4YTOrq.js";import{c as B,h as A,d as E}from"./transform-_T5o_x_w.js";import{S as f}from"./skeleton-BS-Px_iI.js";import{A as P,a as z}from"./alert-DJmmSiqi.js";import{s as M}from"./safeExternalHref-CkBrsh84.js";import"./katex.min-BSBacQyE.js";import"./PaperPreviewLink-DajWspZH.js";import"./index-SizWVsV-.js";import"./hover-card-Dy9hZi_x.js";const R=a=>(a==null?void 0:a.trim().toLowerCase().replace(/[\s_]+/g,"-"))??"",O=(a,t)=>{if(!a)return null;const i=new Date(`${a}T00:00:00`),s=t?new Date(`${t}T00:00:00`):null,c=g=>g.toLocaleDateString("en-US",{month:"long",day:"numeric"}),m=i.getFullYear();return s&&s.getTime()!==i.getTime()?i.getMonth()===s.getMonth()?`${c(i).replace(/\d+$/,"").trim()} ${i.getDate()}–${s.getDate()}, ${m}`:`${c(i)} – ${c(s)}, ${m}`:`${c(i)}, ${m}`},X=()=>{var k,S,b,_,$,w;const{confSlug:a}=L(),t=T({queryKey:["conference-areas-with-tasks",a],queryFn:()=>C.getConferenceAreasWithTasks(a),enabled:!!a,staleTime:10*60*1e3}),i=D.useMemo(()=>{if(!t.data)return[];const r={general:0,vision:1,video:2,language:3,audio:4,other:5},n=o=>r[R(o)]??999;return[...t.data.results].sort((o,l)=>{const d=n(o.name),x=n(l.name);return d!==x?d-x:o.name.localeCompare(l.name)})},[t.data]),s=(k=t.data)==null?void 0:k.conference,c=((S=t.data)==null?void 0:S.total_paper_count)??0,m=((b=t.data)==null?void 0:b.oral_paper_count)??0,g=((_=t.data)==null?void 0:_.spotlight_paper_count)??0,u=(($=t.data)==null?void 0:$.outstanding_paper_count)??0,j=((w=t.data)==null?void 0:w.best_paper_finalist_paper_count)??0,v=i.reduce((r,n)=>r+n.tasks.length,0);if(t.error)return e.jsx("div",{className:"page",children:e.jsx(P,{variant:"destructive",children:e.jsx(z,{children:"Failed to load conference. Please try again."})})});const y=s?O(s.start_date,s.end_date):null,N=s?[s.venue,s.location].filter(Boolean).join(", "):null,h=s==null?void 0:s.name;return e.jsxs("div",{className:"page",children:[e.jsxs("div",{className:s!=null&&s.image_url?"task-hero-grid":void 0,children:[e.jsxs("div",{children:[e.jsx("div",{style:{fontFamily:"var(--mono)",fontSize:11,color:"var(--accent-text)",letterSpacing:"0.1em",marginBottom:8},children:"CONFERENCE"}),e.jsx("h1",{className:"feed-title",children:h??e.jsx(f,{className:"h-10 w-64 inline-block"})}),e.jsxs("div",{className:"feed-subtitle",style:{display:"flex",flexDirection:"column",gap:4},children:[y&&e.jsx("span",{children:y}),N&&e.jsx("span",{children:N}),(s==null?void 0:s.url)&&e.jsx("a",{href:M(s.url)??void 0,target:"_blank",rel:"noopener noreferrer",style:{color:"var(--accent-text)"},children:s.url.replace(/^https?:\/\//,"")}),(s==null?void 0:s.hf_url)&&e.jsxs("a",{className:"bm-action-btn",href:s.hf_url,target:"_blank",rel:"noopener noreferrer",style:{alignSelf:"flex-start",marginTop:4},children:[e.jsx("span",{"aria-hidden":"true",children:"🤗"})," View on Hugging Face"]})]}),(s==null?void 0:s.description)&&e.jsx(F,{className:"method-description",text:s.description})]}),(s==null?void 0:s.image_url)&&e.jsxs("figure",{className:"task-figure-card",children:[e.jsx("div",{className:"task-figure-img-wrap",children:e.jsx("img",{className:"task-figure-img",src:s.image_url,alt:h?`${h} visual`:"Conference visual",onError:r=>{var n,o;(o=(n=r.currentTarget.parentElement)==null?void 0:n.parentElement)==null||o.style.setProperty("display","none")}})}),e.jsxs("figcaption",{children:["Figure · ",h??"Conference",s.image_credit&&e.jsxs(e.Fragment,{children:[e.jsx("br",{}),e.jsx(F,{className:"task-image-credit",text:s.image_credit})]})]})]})]}),!t.isLoading&&c>0&&e.jsxs("section",{style:{marginTop:48,marginBottom:48},children:[e.jsxs("div",{style:{display:"flex",alignItems:"baseline",justifyContent:"space-between",gap:24,paddingBottom:12,borderBottom:"1px solid var(--hairline-strong)"},children:[e.jsxs("div",{children:[e.jsx("h2",{style:{fontFamily:"var(--serif)",fontSize:26,fontWeight:500,letterSpacing:"-0.02em",marginBottom:4},children:"Browse papers"}),e.jsx("div",{style:{fontFamily:"var(--serif)",fontStyle:"italic",fontSize:13,color:"var(--ink-soft)"},children:"All accepted papers, plus oral, spotlight, outstanding, and best paper finalists."})]}),e.jsxs("div",{style:{fontFamily:"var(--mono)",fontSize:11,color:"var(--ink-faint)",whiteSpace:"nowrap"},children:[c.toLocaleString()," papers"]})]}),e.jsxs("div",{className:"tag-grid",children:[e.jsxs(p,{to:`/conferences/${a}/all`,className:"tag-cell",children:[e.jsxs("div",{className:"name",children:[e.jsx("span",{className:"dot",style:{background:"var(--accent)"}}),"All papers"]}),e.jsx("div",{className:"meta",children:e.jsxs("span",{children:[c.toLocaleString()," papers"]})})]}),m>0&&e.jsxs(p,{to:`/conferences/${a}/oral`,className:"tag-cell",children:[e.jsxs("div",{className:"name",children:[e.jsx("span",{className:"dot",style:{background:"#fdbb02"}}),"Oral papers"]}),e.jsx("div",{className:"meta",children:e.jsxs("span",{children:[m.toLocaleString()," papers"]})})]}),g>0&&e.jsxs(p,{to:`/conferences/${a}/spotlight`,className:"tag-cell",children:[e.jsxs("div",{className:"name",children:[e.jsx("span",{className:"dot",style:{background:"#fdbb02"}}),"Spotlight papers"]}),e.jsx("div",{className:"meta",children:e.jsxs("span",{children:[g.toLocaleString()," papers"]})})]}),u>0&&e.jsxs(p,{to:`/conferences/${a}/outstanding`,className:"tag-cell",children:[e.jsxs("div",{className:"name",children:[e.jsx("span",{className:"dot",style:{background:"#c45c26"}}),"Outstanding papers"]}),e.jsx("div",{className:"meta",children:e.jsxs("span",{children:[u.toLocaleString()," papers"]})})]}),j>0&&e.jsxs(p,{to:`/conferences/${a}/best-paper-finalists`,className:"tag-cell",children:[e.jsxs("div",{className:"name",children:[e.jsx("span",{className:"dot",style:{background:"#c9a227"}}),"Best paper finalists"]}),e.jsx("div",{className:"meta",children:e.jsxs("span",{children:[j.toLocaleString()," papers"]})})]})]})]}),t.isLoading?e.jsx("div",{style:{display:"flex",flexDirection:"column",gap:32},children:Array.from({length:4}).map((r,n)=>e.jsxs("div",{children:[e.jsx(f,{className:"h-8 w-1/3 mb-4"}),e.jsx("div",{className:"tag-grid",children:Array.from({length:6}).map((o,l)=>e.jsx(f,{className:"h-24"},l))})]},n))}):i.map(r=>{const n=r.tasks;if(n.length===0)return null;const o=n.reduce((l,d)=>l+(d.paper_count||0),0);return e.jsxs("section",{style:{marginBottom:48},children:[e.jsxs("div",{style:{display:"flex",alignItems:"baseline",justifyContent:"space-between",gap:24,paddingBottom:12,borderBottom:"1px solid var(--hairline-strong)"},children:[e.jsxs("div",{children:[e.jsx("h2",{style:{fontFamily:"var(--serif)",fontSize:26,fontWeight:500,letterSpacing:"-0.02em",marginBottom:4},children:r.name}),r.description&&e.jsx("div",{style:{fontFamily:"var(--serif)",fontStyle:"italic",fontSize:13,color:"var(--ink-soft)"},children:r.description})]}),e.jsxs("div",{style:{fontFamily:"var(--mono)",fontSize:11,color:"var(--ink-faint)",whiteSpace:"nowrap"},children:[n.length," ",n.length===1?"task":"tasks"," · ",o.toLocaleString()," papers"]})]}),e.jsx("div",{className:"tag-grid",children:n.map(l=>{const d=l.slug||"",x=B(A(d));return e.jsxs(p,{to:`/conferences/${a}/${d}`,className:"tag-cell",children:[e.jsxs("div",{className:"name",children:[e.jsx("span",{className:"dot",style:{background:x.dot}}),E(l.name,d)]}),e.jsx("div",{className:"meta",children:e.jsxs("span",{children:[(l.paper_count??0).toLocaleString()," papers"]})})]},l.id)})})]},r.id)}),v>0&&e.jsxs("div",{style:{fontFamily:"var(--mono)",fontSize:11,color:"var(--ink-faint)",marginTop:24},children:[v," tasks across ",i.filter(r=>r.tasks.length>0).length," areas."]})]})};export{X as default};
|
assets/{ConferenceTaskView-DCj73Bx2.js → ConferenceTaskView-C_4nVYLr.js}
RENAMED
|
@@ -1 +1 @@
|
|
| 1 |
-
import{f as $,a as D,r as f,j as e,L as b,R as W,c as M}from"./index-
|
|
|
|
| 1 |
+
import{f as $,a as D,r as f,j as e,L as b,R as W,c as M}from"./index-Bthypk3Q.js";import{u as z}from"./useQuery-CEDDm0wh.js";import{P as G}from"./components-DR4nXlac.js";import{u as J,P as X}from"./useIntersectionObserver-BrrNIU67.js";import{M as h}from"./MarkdownText-DX4YTOrq.js";import{t as Y,d as Z}from"./transform-_T5o_x_w.js";import{c as ee}from"./usePapers-BGjLgFkG.js";import{S as se}from"./skeleton-BS-Px_iI.js";import{A as ae,a as te}from"./alert-DJmmSiqi.js";import"./LatexTitle-DOmMcoZ0.js";import"./katex.min-BSBacQyE.js";import"./safeExternalHref-CkBrsh84.js";import"./PaperPreviewLink-DajWspZH.js";import"./index-SizWVsV-.js";import"./hover-card-Dy9hZi_x.js";import"./useInfiniteQuery-KqL5cNCq.js";const re=[["trending","trending"],["date_published","newest"],["citation_count","most cited"]],ne=a=>a==="trending"||a==="date_published"||a==="citation_count"?a:"trending",ve=()=>{var F,A,L,O,T,B;const{confSlug:a,taskSlug:n}=$(),[c,j]=D(),y=ne(c.get("order_by")),S=c.get("has_code")==="true",w=c.get("has_hf_artifacts")==="true",I=t=>{const s=new URLSearchParams(c);s.set("order_by",t),j(s)},q=t=>{const s=new URLSearchParams(c);t?s.set("has_code","true"):s.delete("has_code"),j(s)},Q=t=>{const s=new URLSearchParams(c);t?s.set("has_hf_artifacts","true"):s.delete("has_hf_artifacts"),j(s)},k=n==="all",P=n==="oral",N=n==="spotlight",l=n==="outstanding",d=n==="best-paper-finalists",u=l||d,p=k||P||N||l||d,K=p?void 0:n,U=P?"oral":N?"spotlight":l?"outstanding":d?"best_paper_finalist":void 0,m=z({queryKey:["conference",a],queryFn:()=>M.getConference(a),enabled:!!a,staleTime:10*60*1e3}),x=z({queryKey:["task",n],queryFn:()=>M.getTask(n),enabled:!!n&&!p,staleTime:10*60*1e3}),i=ee({conferenceSlug:a||"",taskSlug:K,presentation:U,page_size:12,order_by:y,order_dir:"desc",include_resources:!0,has_code:S,has_hf_artifacts:w,enabled:!!a}),{targetRef:V,isIntersecting:C}=J({rootMargin:"200px"});f.useEffect(()=>{C&&i.hasNextPage&&!i.isFetchingNextPage&&i.fetchNextPage()},[C,i.hasNextPage,i.isFetchingNextPage]),f.useEffect(()=>{window.scrollTo(0,0)},[a,n]);const _=f.useMemo(()=>{var s;return(((s=i.data)==null?void 0:s.pages)??[]).flatMap(o=>o.results)},[i.data]),v=f.useMemo(()=>_.map(Y),[_]),g=k?"All papers":P?"Oral papers":N?"Spotlight papers":l?"Outstanding papers":d?"Best paper finalists":Z(((F=x.data)==null?void 0:F.name)||n||"",((A=x.data)==null?void 0:A.slug)||n),R=((O=(L=i.data)==null?void 0:L.pages[0])==null?void 0:O.count)??((T=m.data)==null?void 0:T.paper_count)??0,r=x.data;return m.error||x.error||i.error?e.jsx("div",{className:"page",children:e.jsx(ae,{variant:"destructive",children:e.jsx(te,{children:"Failed to load conference papers. Please try again."})})}):e.jsxs("div",{className:"page",children:[e.jsxs("nav",{className:"breadcrumb","aria-label":"Breadcrumb",children:[e.jsx(b,{to:"/",children:"Home"}),e.jsx("span",{children:" / "}),e.jsx(b,{to:"/conferences",children:"Conferences"}),e.jsx("span",{children:" / "}),e.jsx(b,{to:`/conferences/${a}`,children:((B=m.data)==null?void 0:B.name)??a}),e.jsx("span",{children:" / "}),e.jsx("span",{children:g})]}),e.jsxs("div",{className:!p&&(r!=null&&r.image_url)?"task-hero-grid":void 0,style:{marginTop:16,marginBottom:28},children:[e.jsxs("div",{children:[e.jsx("div",{style:{fontFamily:"var(--mono)",fontSize:11,color:"var(--accent-text)",letterSpacing:"0.1em",marginBottom:8},children:p?"BROWSE PAPERS":"TASK"}),e.jsx("h1",{className:"domain-mega-title",children:g}),l&&a==="iclr-2026"&&e.jsx(h,{className:"task-explainer",text:"ICLR 2026 recognized two Outstanding Papers and one Honorable Mention. [Read the announcement](https://blog.iclr.cc/2026/04/23/announcing-the-iclr-2026-outstanding-papers/)."}),l&&a==="icml-2026"&&e.jsx(h,{className:"task-explainer",text:"ICML 2026 recognized two Outstanding Papers and five Honorable Mentions. [Read the announcement](https://blog.icml.cc/2026/07/05/announcing-the-icml-2026-awards/)."}),d&&a==="cvpr-2026"&&e.jsx(h,{className:"task-explainer",text:"CVPR 2026 recognized fifteen Best Paper Award finalists, including the winners. [Read the announcement](https://x.com/CVPR/status/2062912519522717978)."}),!p&&(r==null?void 0:r.description)&&e.jsx(h,{className:"task-explainer",text:r.description}),m.data&&e.jsxs("div",{className:"task-quickstats",style:{marginTop:12},children:[e.jsxs("span",{children:[e.jsx("span",{className:"num",children:R.toLocaleString()}),"PAPERS"]}),e.jsx("span",{children:m.data.name})]})]}),!p&&(r==null?void 0:r.image_url)&&e.jsxs("figure",{className:"task-figure-card",children:[e.jsx("div",{className:"task-figure-img-wrap",children:e.jsx("img",{className:"task-figure-img",src:r.image_url,alt:`${g} schematic`,onError:t=>{var s,o;(o=(s=t.currentTarget.parentElement)==null?void 0:s.parentElement)==null||o.style.setProperty("display","none")}})}),e.jsxs("figcaption",{children:["Figure · ",g,r.image_credit&&e.jsxs(e.Fragment,{children:[e.jsx("br",{}),e.jsx(h,{className:"task-image-credit",text:r.image_credit})]})]})]})]}),e.jsxs("div",{className:"task-section-head",children:[e.jsx("div",{className:"task-section-eyebrow",children:u?"Award papers":"Conference papers · sort below"}),e.jsxs("div",{className:"task-section-title",children:["Papers ",e.jsxs("span",{className:"meta",children:["[",R.toLocaleString(),"]"]})]})]}),e.jsxs("div",{className:"sort-bar",children:[e.jsxs("div",{className:"paper-feed-toolbar-controls",children:[!u&&e.jsx("div",{className:"sort-options",children:re.map(([t,s])=>e.jsx("button",{className:`sort-btn ${y===t?"active":""}`,onClick:()=>I(t),children:s},t))}),e.jsx(X,{hasCode:S,hasHfArtifacts:w,onHasCodeChange:q,onHasHfArtifactsChange:Q,showDivider:!u})]}),!u&&e.jsxs("div",{className:"results-count",children:[v.length," loaded in ",e.jsx("span",{children:g})]})]}),i.isLoading?e.jsx("div",{className:"paper-list",children:Array.from({length:4}).map((t,s)=>e.jsx(se,{className:"h-40 w-full"},s))}):v.length===0?e.jsx("div",{className:"no-results",children:"No papers found for this selection."}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"paper-list",children:v.map((t,s)=>{var E;const o=(E=_[s])==null?void 0:E.conference_award,H=o==="outstanding"?"Outstanding Paper":o==="honorable_mention"?"Honorable Mention":o==="best_paper_finalist"&&!d?"Best Paper Finalist":null;return e.jsxs(W.Fragment,{children:[H&&e.jsx("div",{style:{fontFamily:"var(--mono)",fontSize:11,color:"var(--accent-text)",letterSpacing:"0.08em",marginBottom:8},children:H}),e.jsx(G,{paper:t,rank:s+1})]},t.id)})}),e.jsx("div",{ref:V,style:{height:1}}),i.isFetchingNextPage&&e.jsx("div",{style:{padding:"20px 0",textAlign:"center",color:"var(--ink-faint)"},children:"Loading more…"})]})]})};export{ve as default};
|
assets/{ConferencesIndexView-seISFC3B.js → ConferencesIndexView-CTwjZP3S.js}
RENAMED
|
@@ -1 +1 @@
|
|
| 1 |
-
import{r as u,j as e,L as d,c as p}from"./index-
|
|
|
|
| 1 |
+
import{r as u,j as e,L as d,c as p}from"./index-Bthypk3Q.js";import{u as h}from"./useQuery-CEDDm0wh.js";import{S as m}from"./skeleton-BS-Px_iI.js";import{A as f,a as g}from"./alert-DJmmSiqi.js";import{T as x}from"./TaxonomySuggestionTile-BOiZOkbr.js";import"./SignInToEditDialog-BPVN69wP.js";import"./button-DH3x5IsG.js";import"./textarea-CMKu47Xo.js";import"./dialog-DDnKVGO8.js";import"./useMutation-dfvOlXzD.js";import"./loader-circle-BFDpPsTy.js";const j=(r,a)=>{if(!r)return null;const t=new Date(`${r}T00:00:00`),s=a?new Date(`${a}T00:00:00`):null,n=o=>o.toLocaleDateString("en-US",{month:"long",day:"numeric"}),i=t.getFullYear();return s&&s.getTime()!==t.getTime()?t.getMonth()===s.getMonth()?`${n(t).replace(/\d+$/,"").trim()} ${t.getDate()}–${s.getDate()}, ${i}`:`${n(t)} – ${n(s)}, ${i}`:`${n(t)}, ${i}`},v=r=>{var t;if(r.year!=null)return r.year;if(r.start_date)return Number(r.start_date.slice(0,4));const a=(t=r.slug.match(/-(\d{4})$/))==null?void 0:t[1];return a?Number(a):0},y=(r,a)=>{if(r.start_date&&a.start_date){const t=r.start_date.localeCompare(a.start_date);if(t!==0)return t}else{if(r.start_date)return-1;if(a.start_date)return 1}return r.name.localeCompare(a.name)},N={display:"flex",alignItems:"baseline",justifyContent:"space-between",gap:24,paddingBottom:12,borderBottom:"1px solid var(--hairline-strong)"},F=()=>{const r=h({queryKey:["conferences"],queryFn:()=>p.getConferences(),staleTime:6e5}),a=u.useMemo(()=>{var s;if(!((s=r.data)!=null&&s.results))return null;const t={};return r.data.results.forEach(n=>{const i=v(n);(t[i]||(t[i]=[])).push(n)}),Object.values(t).forEach(n=>n.sort(y)),Object.keys(t).map(Number).sort((n,i)=>i-n).map(n=>({year:n,conferences:t[n]}))},[r.data]);return r.error?e.jsx("div",{className:"page",children:e.jsx(f,{variant:"destructive",children:e.jsx(g,{children:"Failed to load conferences. Please try again."})})}):e.jsxs("div",{className:"page",children:[e.jsx("div",{className:"feed-header",children:e.jsxs("div",{children:[e.jsxs("h1",{className:"feed-title",children:["All ",e.jsx("em",{children:"Conferences"})]}),e.jsx("div",{className:"feed-subtitle",children:"Browse accepted papers from major AI conferences, grouped by research area and task."}),e.jsxs("div",{className:"conference-deadlines-link",children:["Find deadlines for upcoming conferences"," ",e.jsx(d,{to:"/ai-deadlines",className:"underline underline-offset-2 hover:text-foreground",children:"here"}),". Conference information is based on"," ",e.jsx("a",{href:"https://huggingface.co/ai-conferences",target:"_blank",rel:"noreferrer",className:"underline underline-offset-2 hover:text-foreground",children:"Hugging Face AI Conferences"}),"."]})]})}),r.isLoading?e.jsx("div",{style:{display:"flex",flexDirection:"column",gap:32},children:Array.from({length:2}).map((t,s)=>e.jsxs("div",{children:[e.jsx(m,{className:"h-8 w-24 mb-4"}),e.jsx("div",{className:"tag-grid",children:Array.from({length:3}).map((n,i)=>e.jsx(m,{className:"h-32"},i))})]},s))}):a==null?void 0:a.map(({year:t,conferences:s})=>{const n=s.reduce((o,l)=>o+(l.paper_count??0),0),i=t>0?String(t):"Unknown year";return e.jsxs("section",{style:{marginBottom:48},children:[e.jsxs("div",{style:N,children:[e.jsx("div",{children:e.jsx("h2",{style:{fontFamily:"var(--serif)",fontSize:26,fontWeight:500,letterSpacing:"-0.02em",marginBottom:4},children:i})}),e.jsxs("div",{style:{fontFamily:"var(--mono)",fontSize:11,color:"var(--ink-faint)",whiteSpace:"nowrap"},children:[s.length," ",s.length===1?"conference":"conferences"," ·"," ",n.toLocaleString()," papers"]})]}),e.jsxs("div",{className:"tag-grid",children:[s.map(o=>{const l=j(o.start_date,o.end_date),c=[o.venue,o.location].filter(Boolean).join(", ");return e.jsxs(d,{to:`/conferences/${o.slug}`,className:"tag-cell",children:[e.jsx("div",{className:"name",children:o.name}),e.jsxs("div",{className:"meta",style:{display:"flex",flexDirection:"column",gap:4},children:[l&&e.jsx("span",{children:l}),c&&e.jsx("span",{children:c}),e.jsxs("span",{children:[(o.paper_count??0).toLocaleString()," papers"]})]})]},o.id)}),e.jsx(x,{kind:"conference"})]})]},t)})]})};export{F as default};
|
assets/{CronDashboard-AlgyoBn4.js → CronDashboard-BaDdSoqj.js}
RENAMED
|
@@ -1,19 +1,19 @@
|
|
| 1 |
-
import{d as y,r as x,j as e,v,O as Le,o as
|
| 2 |
* @license lucide-react v0.462.0 - ISC
|
| 3 |
*
|
| 4 |
* This source code is licensed under the ISC license.
|
| 5 |
* See the LICENSE file in the root directory of this source tree.
|
| 6 |
-
*/const
|
| 7 |
* @license lucide-react v0.462.0 - ISC
|
| 8 |
*
|
| 9 |
* This source code is licensed under the ISC license.
|
| 10 |
* See the LICENSE file in the root directory of this source tree.
|
| 11 |
-
*/const
|
| 12 |
* @license lucide-react v0.462.0 - ISC
|
| 13 |
*
|
| 14 |
* This source code is licensed under the ISC license.
|
| 15 |
* See the LICENSE file in the root directory of this source tree.
|
| 16 |
-
*/const
|
| 17 |
* @license lucide-react v0.462.0 - ISC
|
| 18 |
*
|
| 19 |
* This source code is licensed under the ISC license.
|
|
@@ -28,12 +28,12 @@ import{d as y,r as x,j as e,v,O as Le,o as Me,n as O,a5 as Pe,Q as Fe,S as Ae,q
|
|
| 28 |
*
|
| 29 |
* This source code is licensed under the ISC license.
|
| 30 |
* See the LICENSE file in the root directory of this source tree.
|
| 31 |
-
*/const
|
| 32 |
* @license lucide-react v0.462.0 - ISC
|
| 33 |
*
|
| 34 |
* This source code is licensed under the ISC license.
|
| 35 |
* See the LICENSE file in the root directory of this source tree.
|
| 36 |
-
*/const
|
| 37 |
* @license lucide-react v0.462.0 - ISC
|
| 38 |
*
|
| 39 |
* This source code is licensed under the ISC license.
|
|
@@ -43,19 +43,14 @@ import{d as y,r as x,j as e,v,O as Le,o as Me,n as O,a5 as Pe,Q as Fe,S as Ae,q
|
|
| 43 |
*
|
| 44 |
* This source code is licensed under the ISC license.
|
| 45 |
* See the LICENSE file in the root directory of this source tree.
|
| 46 |
-
*/const Y=y("FileText",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]]);/**
|
| 47 |
-
* @license lucide-react v0.462.0 - ISC
|
| 48 |
-
*
|
| 49 |
-
* This source code is licensed under the ISC license.
|
| 50 |
-
* See the LICENSE file in the root directory of this source tree.
|
| 51 |
*/const Xe=y("Images",[["path",{d:"M18 22H4a2 2 0 0 1-2-2V6",key:"pblm9e"}],["path",{d:"m22 13-1.296-1.296a2.41 2.41 0 0 0-3.408 0L11 18",key:"nf6bnh"}],["circle",{cx:"12",cy:"8",r:"2",key:"1822b1"}],["rect",{width:"16",height:"16",x:"6",y:"2",rx:"2",key:"12espp"}]]);/**
|
| 52 |
* @license lucide-react v0.462.0 - ISC
|
| 53 |
*
|
| 54 |
* This source code is licensed under the ISC license.
|
| 55 |
* See the LICENSE file in the root directory of this source tree.
|
| 56 |
-
*/const
|
| 57 |
* @license lucide-react v0.462.0 - ISC
|
| 58 |
*
|
| 59 |
* This source code is licensed under the ISC license.
|
| 60 |
* See the LICENSE file in the root directory of this source tree.
|
| 61 |
-
*/const Ye=y("TriangleAlert",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]]),p=x.forwardRef(({className:s,...a},r)=>e.jsx("div",{ref:r,className:v("rounded-lg border bg-card text-card-foreground shadow-sm",s),...a}));p.displayName="Card";const j=x.forwardRef(({className:s,...a},r)=>e.jsx("div",{ref:r,className:v("flex flex-col space-y-1.5 p-6",s),...a}));j.displayName="CardHeader";const f=x.forwardRef(({className:s,...a},r)=>e.jsx("h3",{ref:r,className:v("text-2xl font-semibold leading-none tracking-tight",s),...a}));f.displayName="CardTitle";const T=x.forwardRef(({className:s,...a},r)=>e.jsx("p",{ref:r,className:v("text-sm text-muted-foreground",s),...a}));T.displayName="CardDescription";const g=x.forwardRef(({className:s,...a},r)=>e.jsx("div",{ref:r,className:v("p-6 pt-0",s),...a}));g.displayName="CardContent";const es=x.forwardRef(({className:s,...a},r)=>e.jsx("div",{ref:r,className:v("flex items-center p-6 pt-0",s),...a}));es.displayName="CardFooter";var U="Tabs",[ss]=De(U,[ae]),ne=ae(),[as,K]=ss(U),ie=x.forwardRef((s,a)=>{const{__scopeTabs:r,value:t,onValueChange:o,defaultValue:d,orientation:m="horizontal",dir:c,activationMode:n="automatic",...u}=s,l=Le(c),[h,w]=Me({prop:t,onChange:o,defaultProp:d??"",caller:U});return e.jsx(as,{scope:r,baseId:Pe(),value:h,onValueChange:w,orientation:m,dir:l,activationMode:n,children:e.jsx(O.div,{dir:l,"data-orientation":m,...u,ref:a})})});ie.displayName=U;var ce="TabsList",le=x.forwardRef((s,a)=>{const{__scopeTabs:r,loop:t=!0,...o}=s,d=K(ce,r),m=ne(r);return e.jsx(Fe,{asChild:!0,...m,orientation:d.orientation,dir:d.dir,loop:t,children:e.jsx(O.div,{role:"tablist","aria-orientation":d.orientation,...o,ref:a})})});le.displayName=ce;var oe="TabsTrigger",de=x.forwardRef((s,a)=>{const{__scopeTabs:r,value:t,disabled:o=!1,...d}=s,m=K(oe,r),c=ne(r),n=he(m.baseId,t),u=ue(m.baseId,t),l=t===m.value;return e.jsx(Ae,{asChild:!0,...c,focusable:!o,active:l,children:e.jsx(O.button,{type:"button",role:"tab","aria-selected":l,"aria-controls":u,"data-state":l?"active":"inactive","data-disabled":o?"":void 0,disabled:o,id:n,...d,ref:a,onMouseDown:z(s.onMouseDown,h=>{!o&&h.button===0&&h.ctrlKey===!1?m.onValueChange(t):h.preventDefault()}),onKeyDown:z(s.onKeyDown,h=>{[" ","Enter"].includes(h.key)&&m.onValueChange(t)}),onFocus:z(s.onFocus,()=>{const h=m.activationMode!=="manual";!l&&!o&&h&&m.onValueChange(t)})})})});de.displayName=oe;var me="TabsContent",xe=x.forwardRef((s,a)=>{const{__scopeTabs:r,value:t,forceMount:o,children:d,...m}=s,c=K(me,r),n=he(c.baseId,t),u=ue(c.baseId,t),l=t===c.value,h=x.useRef(l);return x.useEffect(()=>{const w=requestAnimationFrame(()=>h.current=!1);return()=>cancelAnimationFrame(w)},[]),e.jsx(Ee,{present:o||l,children:({present:w})=>e.jsx(O.div,{"data-state":l?"active":"inactive","data-orientation":c.orientation,role:"tabpanel","aria-labelledby":n,hidden:!w,id:u,tabIndex:0,...m,ref:a,style:{...s.style,animationDuration:h.current?"0s":void 0},children:w&&d})})});xe.displayName=me;function he(s,a){return`${s}-trigger-${a}`}function ue(s,a){return`${s}-content-${a}`}var rs=ie,pe=le,ge=de,je=xe;const ts=rs,fe=x.forwardRef(({className:s,...a},r)=>e.jsx(pe,{ref:r,className:v("inline-flex h-10 items-center justify-center rounded-md bg-muted p-1 text-muted-foreground",s),...a}));fe.displayName=pe.displayName;const F=x.forwardRef(({className:s,...a},r)=>e.jsx(ge,{ref:r,className:v("inline-flex items-center justify-center whitespace-nowrap rounded-sm px-3 py-1.5 text-sm font-medium ring-offset-background transition-all data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow-sm focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",s),...a}));F.displayName=ge.displayName;const A=x.forwardRef(({className:s,...a},r)=>e.jsx(je,{ref:r,className:v("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",s),...a}));A.displayName=je.displayName;function N(s){if(!s)return"Never";const a=new Date(s);if(Number.isNaN(a.getTime()))return s;const r=Date.now()-a.getTime(),t=Math.floor(r/6e4),o=Math.floor(r/36e5),d=Math.floor(r/864e5);return t<1?"Just now":t<60?`${t}m ago`:o<24?`${o}h ago`:d<7?`${d}d ago`:a.toLocaleString("en-US",{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}function ve(s){return s==null?"N/A":s<60?`${s.toFixed(1)}s`:s<3600?`${(s/60).toFixed(1)}m`:`${(s/3600).toFixed(1)}h`}function Ne(s){return s.available?s.status==="completed"?s.conclusion??"completed":s.status??"unknown":"Unavailable"}function be(s){return s.replace(/_/g," ").replace(/\b\w/g,a=>a.toUpperCase())}const ns={healthy:W,degraded:Ye,broken:J,running:R,stuck:J,unknown:Ke};function is({status:s,isRunning:a}){const r=a?"running":s,t=ns[r];return e.jsx(t,{className:`cron-status-icon cron-status--${r}${r==="running"?" animate-spin":""}`})}function ee({icon:s,title:a,metrics:r}){return e.jsxs("div",{children:[e.jsxs("div",{className:"cron-section-heading",children:[e.jsx(s,{className:"h-4 w-4"}),e.jsx("h4",{children:a})]}),e.jsx("div",{className:"grid grid-cols-2 gap-3",children:Object.entries(r).map(([t,o])=>e.jsxs("div",{className:"cron-metric-card",children:[e.jsx("div",{className:"cron-label",children:be(t)}),e.jsx("div",{className:"text-lg font-semibold",children:typeof o=="number"?o.toLocaleString():o})]},t))})]})}function cs({workflow:s}){return e.jsxs("div",{children:[e.jsxs("div",{className:"cron-section-heading",children:[e.jsx(H,{className:"h-4 w-4"}),e.jsx("h4",{children:"GitHub Actions"})]}),e.jsxs("div",{className:"cron-metric-card space-y-2 text-sm",children:[[["Workflow",s.workflow_file],["Run",s.run_id??"N/A"],["Status",Ne(s)],...s.updated_at?[["Updated",N(s.updated_at)]]:[]].map(([a,r])=>e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsx("span",{className:"cron-label",children:a}),e.jsx("span",{className:a==="Workflow"?"font-mono text-xs":void 0,children:r})]},a)),s.failed_jobs&&s.failed_jobs.length>0&&e.jsxs("div",{children:[e.jsx("div",{className:"cron-label mb-1",children:"Failed jobs"}),e.jsx("div",{className:"flex gap-2 flex-wrap",children:s.failed_jobs.map(a=>e.jsx(_,{variant:"outline",className:"cron-status--broken",children:a},a))})]}),s.job_conclusions&&Object.keys(s.job_conclusions).length>0&&e.jsxs("div",{children:[e.jsx("div",{className:"cron-label mb-1",children:"Job conclusions"}),e.jsx("div",{className:"flex gap-2 flex-wrap",children:Object.entries(s.job_conclusions).map(([a,r])=>e.jsxs(_,{variant:"outline",children:[a,": ",r??"running"]},a))})]}),(s.error||s.view_error)&&e.jsx("div",{className:"cron-message cron-message--error",children:s.error??s.view_error})]})]})}function ls(s){return s==="COMPLETED"?"cron-status--healthy":s==="ERROR"||s==="CANCELED"?"cron-status--broken":s==="RUNNING"?"cron-status--running":"cron-status--unknown"}function os({job:s}){const a=s.progress,r=a!=null&&a.total_papers?Math.min(100,a.processed_papers/a.total_papers*100):0;return e.jsxs("div",{className:"cron-metric-card space-y-3",children:[e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsxs("div",{className:"font-semibold",children:[s.mode??"unknown"," · shard ",s.shard_id??"N/A"]}),e.jsx("div",{className:"font-mono text-xs cron-muted truncate",children:s.id})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(_,{variant:"outline",className:ls(s.stage),children:s.stage.toLowerCase()}),s.url&&e.jsx("a",{href:s.url,target:"_blank",rel:"noreferrer","aria-label":`Open Hugging Face Job ${s.id}`,className:"cron-info-text",children:e.jsx(re,{className:"h-4 w-4"})})]})]}),a?e.jsxs(e.Fragment,{children:[e.jsxs("div",{children:[e.jsxs("div",{className:"flex justify-between gap-3 text-xs cron-muted mb-1",children:[e.jsxs("span",{children:[a.processed_papers.toLocaleString()," / ",a.total_papers.toLocaleString()," papers"]}),e.jsxs("span",{children:[r.toFixed(0),"%"]})]}),e.jsx("div",{className:"cron-progress-track",children:e.jsx("div",{className:"cron-progress-value",style:{width:`${r}%`}})})]}),e.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-2 text-sm",children:[e.jsxs("span",{children:[e.jsx("strong",{children:a.succeeded_papers.toLocaleString()})," succeeded"]}),e.jsxs("span",{children:[e.jsx("strong",{children:a.failed_papers.toLocaleString()})," failed"]}),e.jsxs("span",{children:[e.jsx("strong",{children:a.already_existed_papers.toLocaleString()})," skipped"]}),e.jsxs("span",{children:[e.jsx("strong",{children:a.extracted_images.toLocaleString()})," images"]})]}),a.updated_at&&e.jsxs("div",{className:"text-xs cron-muted",children:["Progress updated ",N(a.updated_at)]}),(a.fatal_error||a.error_samples.length>0)&&e.jsxs("div",{className:"cron-message cron-message--error space-y-1",children:[a.fatal_error&&e.jsx("div",{children:a.fatal_error}),a.error_samples.map(t=>e.jsxs("div",{children:[e.jsx("span",{className:"font-mono",children:t.arxiv_id}),": ",t.error]},`${t.arxiv_id}:${t.error}`))]})]}):e.jsx("div",{className:"text-sm cron-muted",children:"Waiting for the shard progress checkpoint."}),e.jsxs("div",{className:"flex flex-wrap gap-x-4 gap-y-1 text-xs cron-muted",children:[s.hardware&&e.jsx("span",{children:s.hardware}),s.created_at&&e.jsxs("span",{children:["Created ",N(s.created_at)]}),s.duration_seconds!=null&&e.jsxs("span",{children:["Duration ",ve(s.duration_seconds)]})]}),s.stage_message&&e.jsx("div",{className:"cron-message cron-message--warning",children:s.stage_message})]})}function ds({monitor:s,loading:a,error:r}){return e.jsxs("div",{className:"md:col-span-2",children:[e.jsxs("div",{className:"cron-section-heading",children:[e.jsx(Xe,{className:"h-4 w-4"}),e.jsx("h4",{children:"Hugging Face OCR shards"})]}),a&&e.jsxs("div",{className:"cron-metric-card flex items-center gap-2 text-sm cron-muted",children:[e.jsx(R,{className:"h-4 w-4 animate-spin"})," Loading remote Jobs…"]}),r&&e.jsx("div",{className:"cron-message cron-message--error",children:"Could not load Hugging Face Jobs."}),s&&!s.available&&e.jsx("div",{className:"cron-message cron-message--warning",children:s.error??"Hugging Face monitoring is unavailable."}),(s==null?void 0:s.available)&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-3 mb-3",children:Object.entries(s.summary).map(([t,o])=>e.jsxs("div",{className:"cron-metric-card",children:[e.jsx("div",{className:"cron-label",children:be(t)}),e.jsx("div",{className:"text-lg font-semibold",children:o.toLocaleString()})]},t))}),s.jobs.length===0?e.jsx("div",{className:"cron-metric-card text-sm cron-muted",children:"No OCR shards have been launched yet."}):e.jsx("div",{className:"grid grid-cols-1 xl:grid-cols-2 gap-3",children:s.jobs.map(t=>e.jsx(os,{job:t},t.id))})]})]})}function ms({job:s,expanded:a,onToggle:r,paperMarkdownJobs:t,paperMarkdownJobsLoading:o=!1,paperMarkdownJobsError:d=null}){const m=!!(s.work_metrics&&Object.keys(s.work_metrics).length),c=!!(s.db_metrics&&Object.keys(s.db_metrics).length),n=s.job_name==="paper_markdown_backfill",u=m||c||!!s.workflow_status||n;return e.jsxs("div",{className:"cron-job-card",children:[e.jsx("button",{type:"button",className:"cron-job-summary",onClick:r,"aria-expanded":a,children:e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsxs("div",{className:"flex items-start gap-3 flex-1 min-w-0",children:[e.jsx(is,{status:s.status,isRunning:s.is_running}),e.jsxs("div",{className:"flex-1 min-w-0 text-left",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1 flex-wrap",children:[e.jsx("h3",{className:"font-semibold",children:s.display_name}),s.critical&&e.jsx(_,{variant:"outline",className:"text-[10px] uppercase tracking-wide",children:"Critical"}),s.lock_stale&&e.jsx(_,{variant:"outline",className:"cron-status--broken",children:"Stale lock"}),u&&(a?e.jsx(We,{className:"h-4 w-4 cron-muted"}):e.jsx(Oe,{className:"h-4 w-4 cron-muted"}))]}),e.jsx("p",{className:"text-sm cron-muted mb-2",children:s.status_reason}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 xl:grid-cols-4 gap-2 text-sm cron-muted",children:[e.jsxs("span",{className:"cron-fact",children:[e.jsx(te,{}),"Log: ",N(s.last_run)]}),e.jsxs("span",{className:"cron-fact",children:[e.jsx(G,{}),"DB: ",N(s.last_db_write)]}),s.recent_write_count!=null&&e.jsxs("span",{className:"cron-fact",children:[e.jsx(Ze,{}),"Recent writes: ",s.recent_write_count.toLocaleString()]}),s.duration!=null&&e.jsxs("span",{className:"cron-fact",children:[e.jsx(H,{}),"Duration: ",ve(s.duration)]}),s.schedule&&e.jsxs("span",{className:"cron-fact md:col-span-2",children:[e.jsx(Be,{}),e.jsx("span",{className:"font-mono text-xs",children:s.schedule})]}),s.log_status&&e.jsxs("span",{className:"cron-fact",children:[e.jsx(Y,{}),"Log status: ",s.log_status]}),s.workflow_status&&e.jsxs("span",{className:"cron-fact",children:[e.jsx(H,{}),"Actions: ",Ne(s.workflow_status)]})]}),s.work_summary&&e.jsx("div",{className:"cron-message",children:s.work_summary}),s.error&&e.jsxs("div",{className:"cron-message cron-message--error",children:[e.jsx("strong",{children:"Error: "}),s.error]}),s.diagnostics&&e.jsx("div",{className:"cron-message cron-message--warning",children:s.diagnostics})]})]}),e.jsx(_,{variant:"outline",className:`cron-status--${s.status}`,children:s.status})]})}),a&&u&&e.jsx("div",{className:"cron-job-details",children:e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[s.work_metrics&&m&&e.jsx(ee,{icon:Y,title:"Log Metrics",metrics:s.work_metrics}),s.db_metrics&&c&&e.jsx(ee,{icon:G,title:"Database Metrics",metrics:s.db_metrics}),s.workflow_status&&e.jsx(cs,{workflow:s.workflow_status}),n&&e.jsx(ds,{monitor:t,loading:o,error:d})]})})]})}const ye=x.forwardRef(({className:s,...a},r)=>e.jsx("div",{className:"relative w-full overflow-auto",children:e.jsx("table",{ref:r,className:v("w-full caption-bottom text-sm",s),...a})}));ye.displayName="Table";const _e=x.forwardRef(({className:s,...a},r)=>e.jsx("thead",{ref:r,className:v("[&_tr]:border-b",s),...a}));_e.displayName="TableHeader";const we=x.forwardRef(({className:s,...a},r)=>e.jsx("tbody",{ref:r,className:v("[&_tr:last-child]:border-0",s),...a}));we.displayName="TableBody";const xs=x.forwardRef(({className:s,...a},r)=>e.jsx("tfoot",{ref:r,className:v("border-t bg-muted/50 font-medium [&>tr]:last:border-b-0",s),...a}));xs.displayName="TableFooter";const B=x.forwardRef(({className:s,...a},r)=>e.jsx("tr",{ref:r,className:v("border-b transition-colors data-[state=selected]:bg-muted hover:bg-muted/50",s),...a}));B.displayName="TableRow";const $=x.forwardRef(({className:s,...a},r)=>e.jsx("th",{ref:r,className:v("h-12 px-4 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0",s),...a}));$.displayName="TableHead";const L=x.forwardRef(({className:s,...a},r)=>e.jsx("td",{ref:r,className:v("p-4 align-middle [&:has([role=checkbox])]:pr-0",s),...a}));L.displayName="TableCell";const hs=x.forwardRef(({className:s,...a},r)=>e.jsx("caption",{ref:r,className:v("mt-4 text-sm text-muted-foreground",s),...a}));hs.displayName="TableCaption";const us={queued:"cron-status--unknown",dispatching:"cron-status--running",running:"cron-status--running",completed:"cron-status--healthy",failed:"cron-status--broken",canceled:"cron-status--unknown"},ps={"add-evals":"Add evals","enrich-paper":"Enrich paper"},gs={queued:Ge,dispatching:R,running:Qe,completed:W,failed:J,canceled:Ve};function js({status:s}){const a=gs[s];return e.jsxs(_,{variant:"outline",className:us[s],children:[e.jsx(a,{className:`mr-1 h-3.5 w-3.5 ${s==="dispatching"?"animate-spin":""}`}),s]})}function fs(s){return s.error?s.error:s.report?s.report:s.status==="completed"&&s.applied_at?"Changes applied to the paper.":s.status==="completed"?"Completed without a recorded mutation.":null}function vs({autoRefresh:s,refreshToken:a}){const{data:r,isLoading:t,isFetching:o,error:d}=I({queryKey:["codexPaperJobs",a],queryFn:()=>He(100),refetchInterval:s?1e4:!1,retry:!1}),m=d&&typeof d=="object"&&"status"in d?d.status:void 0;return e.jsxs(p,{className:"mb-8",children:[e.jsx(j,{children:e.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[e.jsxs("div",{children:[e.jsx(f,{className:"text-xl",children:"Codex paper jobs"}),e.jsx(T,{children:"Durable queue and execution history for admin-triggered Hugging Face Jobs"})]}),o&&!t&&e.jsxs("span",{className:"flex items-center gap-2 text-xs cron-muted",children:[e.jsx(R,{className:"h-3.5 w-3.5 animate-spin"})," Syncing with Hugging Face"]})]})}),e.jsxs(g,{children:[t&&e.jsxs("div",{className:"flex items-center justify-center py-10 cron-muted",children:[e.jsx(R,{className:"mr-2 h-5 w-5 animate-spin"})," Loading paper jobs…"]}),d&&m!==404&&e.jsx("div",{className:"cron-message cron-message--error mb-4",children:d instanceof Error?d.message:"Could not load Codex paper jobs."}),m===404&&e.jsx("p",{className:"py-4 text-sm cron-muted",children:"Codex paper jobs are not enabled in this environment."}),r&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"mb-5 grid grid-cols-2 gap-3 sm:grid-cols-4 lg:grid-cols-7",children:[["queued","dispatching","running","completed","failed","canceled"].map(c=>e.jsxs("div",{className:"cron-metric-card",children:[e.jsx("div",{className:"cron-label capitalize",children:c}),e.jsx("div",{className:"mt-1 text-xl font-semibold",children:r.summary[c]})]},c)),e.jsxs("div",{className:"cron-metric-card",children:[e.jsx("div",{className:"cron-label",children:"Total"}),e.jsx("div",{className:"mt-1 text-xl font-semibold",children:r.summary.total})]})]}),r.jobs.length===0?e.jsx("p",{className:"py-8 text-center text-sm cron-muted",children:"No paper curation jobs have been submitted yet."}):e.jsxs(ye,{children:[e.jsx(_e,{children:e.jsxs(B,{children:[e.jsx($,{children:"Status"}),e.jsx($,{children:"Paper"}),e.jsx($,{children:"Action"}),e.jsx($,{children:"Requested"}),e.jsx($,{children:"Execution"})]})}),e.jsx(we,{children:r.jobs.map(c=>{const n=fs(c);return e.jsxs(B,{children:[e.jsx(L,{className:"align-top",children:e.jsx(js,{status:c.status})}),e.jsxs(L,{className:"min-w-[260px] align-top",children:[e.jsx(qe,{to:`/paper/${encodeURIComponent(c.paper_route)}`,className:"font-medium hover:underline",children:c.paper_title}),e.jsxs("div",{className:"mt-1 text-xs cron-muted",children:["Paper #",c.paper_id]})]}),e.jsxs(L,{className:"whitespace-nowrap align-top",children:[ps[c.kind],c.applied_at&&e.jsxs("div",{className:"mt-1 flex items-center gap-1 text-xs cron-status--healthy",children:[e.jsx(W,{className:"h-3.5 w-3.5"})," Applied"]})]}),e.jsxs(L,{className:"whitespace-nowrap align-top",children:[e.jsx("div",{children:N(c.created_at)}),e.jsxs("div",{className:"mt-1 text-xs cron-muted",children:["@",c.requested_by]})]}),e.jsxs(L,{className:"max-w-[360px] align-top",children:[c.hf_job_url?e.jsxs("a",{href:c.hf_job_url,target:"_blank",rel:"noreferrer",className:"inline-flex items-center gap-1 hover:underline",children:["Hugging Face Job ",e.jsx(re,{className:"h-3.5 w-3.5"})]}):e.jsx("span",{className:"cron-muted",children:"Waiting to dispatch"}),n&&e.jsx("p",{className:`mt-2 line-clamp-3 text-xs ${c.error?"text-red-700":"cron-muted"}`,title:n,children:n})]})]},c.id)})})]}),e.jsxs("p",{className:"mt-4 text-xs cron-muted",children:["Showing the 100 most recent jobs · Queue totals include full history · Updated ",N(r.timestamp)]})]})]})]})}const Ns=()=>{var d,m,c;const s=Ie(),a=ze({queryKey:["catalog-audit"],queryFn:({pageParam:n})=>M.getCatalogAudit(n),initialPageParam:void 0,getNextPageParam:n=>n.next_cursor??void 0}),r=((d=a.data)==null?void 0:d.pages.flatMap(n=>n.events))??[],t=Z({mutationFn:()=>M.acknowledgeCatalogAudit(),onSuccess:()=>s.invalidateQueries({queryKey:["catalog-audit"]})}),o=Z({mutationFn:n=>M.rollbackCatalogEvent(n),onSuccess:()=>s.invalidateQueries({queryKey:["catalog-audit"]})});return e.jsx("div",{className:"space-y-4",children:e.jsxs(p,{children:[e.jsxs(j,{className:"flex-row items-center justify-between",children:[e.jsx(f,{children:"Catalog mutation audit"}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsxs("span",{className:"text-sm font-medium",children:[((c=(m=a.data)==null?void 0:m.pages[0])==null?void 0:c.unread_contributor_count)??0," unread contributor changes"]}),e.jsx(P,{variant:"outline",size:"sm",onClick:()=>t.mutate(),disabled:t.isPending,children:"Mark read"})]})]}),e.jsxs(g,{className:"space-y-3",children:[a.isLoading&&e.jsx("p",{children:"Loading audit history…"}),a.error&&e.jsx("p",{className:"text-destructive",children:"Audit history unavailable."}),r.map(n=>e.jsxs("article",{className:`rounded-md border p-3 ${n.operation==="delete"||n.rollback_eligible===!1?"border-red-500 bg-red-50/50":""}`,children:[e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[e.jsxs("strong",{children:[n.operation," ",n.entity_type," ",n.entity_id]}),e.jsxs("span",{className:"text-xs text-muted-foreground",children:["@",n.actor_username??n.actor_role," ·"," ",new Date(n.created_at).toLocaleString()]})]}),e.jsxs("details",{className:"mt-2 text-xs",children:[e.jsx("summary",{children:"Inspect snapshots"}),e.jsx("pre",{className:"mt-2 max-h-80 overflow-auto rounded bg-muted p-3",children:JSON.stringify({before:n.before,after:n.after},null,2)})]}),!n.rollback_of_event_id&&e.jsx(P,{className:"mt-3",variant:"outline",size:"sm",onClick:()=>o.mutate(n.id),disabled:o.isPending||n.rollback_eligible===!1,children:n.rollback_eligible===!1?"Rollback conflict":"Roll back if unchanged"})]},n.id)),a.hasNextPage&&e.jsx(P,{variant:"outline",onClick:()=>a.fetchNextPage(),disabled:a.isFetchingNextPage,children:a.isFetchingNextPage?"Loading…":"Load older events"})]})]})})},se={hourly:"cron-status--running",daily:"cron-status--healthy",weekly:"cron-status--degraded"},b=s=>`$${(s/1e6).toFixed(2)}`,bs=({data:s,loading:a,error:r})=>{const[t,o]=x.useState("staging-current"),d={"staging-current":"Starter staging · $75 warning / $100 trip / no Environment cap","staging-production-era":"Staging with production · $15 / $20 / $25",production:"Production · $175 / $200 / $225"};if(a)return e.jsxs("div",{className:"flex items-center py-12",children:[e.jsx(R,{className:"h-6 w-6 animate-spin mr-3"}),"Loading chat compute…"]});if(r||!s)return e.jsx(p,{className:"cron-status--broken",children:e.jsx(g,{className:"pt-6",children:"Chat compute accounting is unavailable."})});const m=Math.min(100,s.effective_microusd/s.application_cap_microusd*100),c=s.circuit_state==="tripped"?"Chat disabled":s.circuit_state==="warning"?"Operator warning":"Enabled",n=s.reconciliation_state==="fresh"?"Fresh":s.reconciliation_state==="stale"?"Stale":"Unavailable";return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"grid md:grid-cols-4 gap-4",children:[e.jsxs(p,{className:s.circuit_state==="tripped"?"cron-status--broken":s.circuit_state==="warning"?"cron-status--degraded":"",children:[e.jsx(j,{children:e.jsx(f,{className:"text-sm",children:"Circuit"})}),e.jsxs(g,{children:[e.jsx("div",{className:"text-2xl font-bold",children:c}),e.jsx("p",{className:"text-xs cron-muted",children:s.trip_reason??"Policy armed"})]})]}),e.jsxs(p,{children:[e.jsx(j,{children:e.jsx(f,{className:"text-sm",children:"Month to date"})}),e.jsxs(g,{children:[e.jsx("div",{className:"text-2xl font-bold",children:b(s.effective_microusd)}),e.jsx("div",{role:"progressbar","aria-label":"Application cap used","aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":Math.round(m),className:"h-2 rounded bg-muted mt-3",children:e.jsx("div",{className:"h-2 rounded bg-primary",style:{width:`${m}%`}})})]})]}),e.jsxs(p,{children:[e.jsx(j,{children:e.jsx(f,{className:"text-sm",children:"Application headroom"})}),e.jsxs(g,{children:[e.jsx("div",{className:"text-2xl font-bold",children:b(s.remaining_microusd)}),e.jsxs("p",{className:"text-xs cron-muted",children:["Cap ",b(s.application_cap_microusd)]})]})]}),e.jsxs(p,{children:[e.jsx(j,{children:e.jsx(f,{className:"text-sm",children:"Live compute"})}),e.jsxs(g,{children:[e.jsx("div",{className:"text-2xl font-bold",children:s.live_count}),e.jsxs("p",{className:"text-xs cron-muted",children:[s.termination_uncertain_count," termination uncertain"]})]})]})]}),e.jsxs(p,{children:[e.jsxs(j,{children:[e.jsx(f,{children:"Accounting and policy"}),e.jsxs(T,{children:[s.environment," · cycle ",s.billing_cycle]})]}),e.jsxs(g,{className:"grid md:grid-cols-3 gap-4 text-sm",children:[e.jsxs("div",{children:[e.jsx("strong",{children:"Environment record"}),e.jsx("br",{}),s.environment," · ",s.provider_mode==="starter_workspace"?"Starter Workspace":"Team isolated"]}),e.jsxs("label",{children:[e.jsx("strong",{children:"Policy profile"}),e.jsxs("select",{"aria-label":"Chat compute policy profile",value:t,onChange:u=>o(u.target.value),className:"block mt-1",children:[e.jsx("option",{value:"staging-current",children:"Staging now"}),e.jsx("option",{value:"staging-production-era",children:"Staging with production"}),e.jsx("option",{value:"production",children:"Production"})]}),e.jsxs("span",{className:"text-xs cron-muted",children:[d[t]," · Workspace $250"]})]}),e.jsxs("div",{children:[e.jsx("strong",{children:"Conservative estimate"}),e.jsx("br",{}),b(s.estimated_microusd)]}),e.jsxs("div",{children:[e.jsx("strong",{children:"Provider-reported floor"}),e.jsx("br",{}),b(s.provider_floor_microusd)," · ",e.jsx(_,{children:n})]}),e.jsxs("div",{children:[e.jsx("strong",{children:"Provider backstops"}),e.jsx("br",{}),s.environment_cap_microusd===null?"Starter: no Environment cap":`Environment ${b(s.environment_cap_microusd)}`," · Workspace ",b(s.workspace_cap_microusd)]}),e.jsxs("div",{children:[e.jsx("strong",{children:"Active thresholds"}),e.jsx("br",{}),"Warning ",b(s.warning_microusd)," · trip ",b(s.application_cap_microusd)]}),e.jsxs("div",{children:[e.jsx("strong",{children:"Policy allocation"}),e.jsx("br",{}),"Starter staging $75/$100 with no Environment cap · future Team staging $15/$20/$25 · production $175/$200/$225 · workspace $250"]}),e.jsxs("div",{children:[e.jsx("strong",{children:"Cycle end"}),e.jsx("br",{}),N(s.cycle_end_at)]}),e.jsxs("div",{children:[e.jsx("strong",{children:"Last metered"}),e.jsx("br",{}),s.last_metered_at?N(s.last_metered_at):"Unavailable"]}),e.jsxs("div",{children:[e.jsx("strong",{children:"Provider reconciliation"}),e.jsx("br",{}),s.last_reconciled_at?N(s.last_reconciled_at):"Unavailable",s.last_reconciliation_attempt_at?` · attempted ${N(s.last_reconciliation_attempt_at)}`:"",s.next_reconciliation_at?` · next ${N(s.next_reconciliation_at)}`:""]}),e.jsxs("div",{children:[e.jsx("strong",{children:"Burn projection"}),e.jsx("br",{}),s.burn_rate_microusd_per_hour===null?"Not enough data":`${b(s.burn_rate_microusd_per_hour)}/hour${s.projected_cap_hit_at?` · cap ${N(s.projected_cap_hit_at)}`:""}`]}),e.jsxs("div",{children:[e.jsx("strong",{children:"Prior cycle"}),e.jsx("br",{}),s.prior_cycle?`${s.prior_cycle.billing_cycle} · ${b(s.prior_cycle.effective_microusd)}`:"Not enough data"]})]})]}),e.jsxs(p,{children:[e.jsx(j,{children:e.jsx(f,{children:"Live lifecycle"})}),e.jsx(g,{className:"text-sm",children:Object.entries(s.live_states).map(([u,l])=>e.jsxs("span",{className:"mr-4",children:[u,": ",l]},u))})]}),e.jsxs(p,{children:[e.jsx(j,{children:e.jsx(f,{children:"Daily spend"})}),e.jsx(g,{children:s.daily_spend.length?e.jsx("ul",{className:"space-y-1 text-sm",children:s.daily_spend.map(u=>e.jsxs("li",{children:[u.date,": blank ",b(u.blank_pool_microusd)," · assigned ",b(u.assigned_microusd)]},u.date))}):e.jsx("p",{className:"cron-muted",children:"No compute recorded in this cycle."})})]}),e.jsxs(p,{children:[e.jsxs(j,{children:[e.jsx(f,{children:"Recent circuit events"}),e.jsx(T,{children:"Runbook: docs/chat-sandbox-spend-runbook.md"})]}),e.jsx(g,{children:s.events.length?e.jsx("ul",{className:"space-y-2 text-sm",children:s.events.map(u=>e.jsxs("li",{children:[e.jsx(_,{children:u.severity})," ",u.type," · ",N(u.created_at)]},u.id))}):e.jsx("p",{className:"cron-muted",children:"No events in this cycle."})})]})]})},Fs=()=>{const[s,a]=x.useState(!0),[r,t]=x.useState(0),[o,d]=x.useState(""),[m,c]=x.useState(""),[n,u]=x.useState(new Set),{user:l}=Je(),{data:h,isLoading:w,isFetching:Q,error:C,refetch:ke}=I({queryKey:["cronStatus",l==null?void 0:l.username],queryFn:()=>M.getCronStatus(),enabled:!!(l!=null&&l.is_admin),refetchInterval:s?3e4:!1,retry:!1}),E=I({queryKey:["paperMarkdownJobs",l==null?void 0:l.username],queryFn:()=>M.getPaperMarkdownJobs(),enabled:!!(l!=null&&l.is_admin),refetchInterval:s?3e4:!1,retry:!1}),D=I({queryKey:["chatSandboxSpend",l==null?void 0:l.username,m],queryFn:()=>M.getChatSandboxSpend(m||void 0),enabled:!!(l!=null&&l.is_admin),refetchInterval:s?3e4:!1,retry:!1}),Ce=(C&&typeof C=="object"&&"status"in C?C.status:void 0)===401?"Unauthorized. Sign in with an allowlisted Hugging Face admin account.":C instanceof Error?C.message:void 0,Se=i=>{u(k=>{const S=new Set(k);return S.has(i)?S.delete(i):S.add(i),S})},Te=(h==null?void 0:h.jobs.filter(i=>i.critical))??[],q=((h==null?void 0:h.jobs.filter(i=>!i.critical))??[]).reduce((i,k)=>(i[k.category]||(i[k.category]=[]),i[k.category].push(k),i),{}),Re=Object.keys(q).sort((i,k)=>{const S=["hourly","daily","weekly"];return S.indexOf(i)-S.indexOf(k)}),V=i=>e.jsx(ms,{job:i,expanded:n.has(i.job_name),onToggle:()=>Se(i.job_name),paperMarkdownJobs:i.job_name==="paper_markdown_backfill"?E.data:void 0,paperMarkdownJobsLoading:i.job_name==="paper_markdown_backfill"?E.isLoading:!1,paperMarkdownJobsError:i.job_name==="paper_markdown_backfill"?E.error:null},i.job_name),$e=()=>{t(i=>i+1),ke(),E.refetch(),D.refetch()};return e.jsx("div",{className:"cron-dashboard","data-shadcn":!0,children:e.jsxs("div",{className:"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-8",children:[e.jsx("div",{className:"mb-8",children:e.jsxs("div",{className:"flex items-center justify-between gap-4 flex-wrap",children:[e.jsxs("div",{children:[e.jsxs("h1",{className:"text-3xl font-bold flex items-center gap-3",children:[e.jsx(H,{className:"h-8 w-8 cron-info-text"}),"Admin Dashboard"]}),e.jsx("p",{className:"mt-2 cron-muted",children:"Paper curation queue and operational health for scheduled jobs"})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsxs(P,{variant:"outline",size:"sm",onClick:()=>a(!s),className:s?"cron-status--running":"",children:[e.jsx(X,{className:`h-4 w-4 mr-2 ${s?"animate-spin":""}`}),"Auto-refresh ",s?"ON":"OFF"]}),e.jsxs(P,{variant:"outline",size:"sm",onClick:$e,disabled:Q,children:[e.jsx(X,{className:`h-4 w-4 mr-2 ${Q?"animate-spin":""}`}),"Refresh"]})]})]})}),e.jsx(p,{className:"mb-6",children:e.jsx(g,{className:"pt-6",children:e.jsxs("p",{className:"text-sm cron-muted",children:["Signed in as ",e.jsxs("span",{className:"font-semibold",children:["@",l==null?void 0:l.username]}),". Health checks prefer database freshness over log completion so silent no-work failures surface as degraded or broken."]})})}),e.jsxs(ts,{defaultValue:"critical-jobs",children:[e.jsxs(fe,{className:"grid w-full grid-cols-4 sm:w-auto",children:[e.jsx(F,{value:"critical-jobs",children:"Critical Jobs"}),e.jsx(F,{value:"codex-paper-jobs",children:"Codex Paper Jobs"}),e.jsx(F,{value:"catalog-audit",children:"Catalog Audit"}),e.jsx(F,{value:"chat-compute",children:"Chat Compute"})]}),e.jsxs(A,{value:"critical-jobs",className:"mt-6",children:[w&&e.jsxs("div",{className:"flex items-center justify-center py-12",children:[e.jsx(R,{className:"h-8 w-8 animate-spin cron-info-text"}),e.jsx("span",{className:"ml-3 cron-muted",children:"Loading CRON jobs status..."})]}),C&&e.jsx(p,{className:"cron-status--broken",children:e.jsx(g,{className:"pt-6",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(J,{className:"h-5 w-5"}),e.jsx("p",{children:Ce??"Failed to load CRON jobs status. Please try again."})]})})}),h&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"grid grid-cols-2 md:grid-cols-3 lg:grid-cols-6 gap-4 mb-6",children:["healthy","degraded","broken","running","stuck","unknown"].map(i=>e.jsxs(p,{children:[e.jsx(j,{className:"pb-2",children:e.jsx(f,{className:"text-sm font-medium cron-muted capitalize",children:i})}),e.jsx(g,{children:e.jsx("div",{className:"text-2xl font-bold",children:h.summary[i]})})]},i))}),h.summary.critical_issues.length>0&&e.jsxs(p,{className:"mb-6 cron-status--broken",children:[e.jsx(j,{children:e.jsxs(f,{className:"flex items-center gap-2",children:[e.jsx(Ue,{className:"h-5 w-5"}),"Critical job issues"]})}),e.jsx(g,{children:e.jsx("ul",{className:"list-disc pl-5 space-y-1 text-sm",children:h.summary.critical_issues.map(i=>e.jsx("li",{children:i},i))})})]}),e.jsxs(p,{className:"mb-8",children:[e.jsx(j,{children:e.jsx(f,{className:"text-base",children:"What to check next"})}),e.jsxs(g,{children:[e.jsx("p",{className:"text-sm cron-muted",children:h.summary.what_to_check_next}),e.jsxs("p",{className:"mt-2 text-xs cron-muted flex items-center gap-2",children:[e.jsx(te,{className:"h-4 w-4"}),"Last updated: ",N(h.timestamp)," · Health score:"," ",h.summary.health_score.toFixed(0),"%"]})]})]}),e.jsxs(p,{className:"mb-8",children:[e.jsxs(j,{children:[e.jsx(f,{className:"text-xl",children:"Critical jobs"}),e.jsx(T,{children:"Writers whose stale output breaks the live site"})]}),e.jsx(g,{className:"space-y-4",children:Te.map(V)})]}),e.jsx("div",{className:"space-y-6",children:Re.map(i=>e.jsxs(p,{children:[e.jsx(j,{children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs(f,{className:"text-xl capitalize flex items-center gap-2",children:[e.jsx(_,{className:se[i]??se.hourly,children:i}),e.jsx("span",{children:"Supporting jobs"})]}),e.jsxs(T,{children:[q[i].length," job",q[i].length!==1?"s":""]})]})}),e.jsx(g,{className:"space-y-4",children:q[i].map(V)})]},i))})]})]}),e.jsx(A,{value:"codex-paper-jobs",className:"mt-6",children:e.jsx(vs,{autoRefresh:s,refreshToken:r})}),e.jsx(A,{value:"catalog-audit",className:"mt-6",children:e.jsx(Ns,{})}),e.jsxs(A,{value:"chat-compute",className:"mt-6",children:[e.jsxs(p,{className:"mb-6",children:[e.jsxs(j,{children:[e.jsx(f,{children:"Environment record"}),e.jsx(T,{children:"Leave blank for live staging, or enter the isolated environment printed by the spend qualification command."})]}),e.jsxs(g,{className:"flex gap-2",children:[e.jsx("input",{"aria-label":"Chat compute environment record",value:o,onChange:i=>d(i.target.value),placeholder:"staging-q-example",className:"flex-1 rounded border px-3 py-2"}),e.jsx(P,{onClick:()=>c(o.trim()),children:"Load"})]})]}),e.jsx(bs,{data:D.data,loading:D.isLoading,error:D.error})]})]})]})})};export{bs as ChatComputePanel,Fs as default};
|
|
|
|
| 1 |
+
import{d as y,r as x,j as e,v,O as Le,o as Pe,n as H,a5 as Fe,Q as Me,S as Ae,q as B,P as Ee,t as De,T as ae,L as Ie,k as Je,c as P,g as qe}from"./index-Bthypk3Q.js";import{u as J}from"./useQuery-CEDDm0wh.js";import{B as _,D as V,f as Oe}from"./codexAddEvals-DL2-0pMU.js";import{B as F}from"./button-DH3x5IsG.js";import{C as He}from"./chevron-down-X5yQfbpI.js";import{F as X}from"./file-text-SORg5JWW.js";import{C as q,a as z,R as Y,S as Ue}from"./shield-alert-CXSHgfgj.js";import{L as R}from"./loader-circle-BFDpPsTy.js";import{E as re}from"./external-link-CSzPhnVI.js";import{u as Z}from"./useMutation-dfvOlXzD.js";import{u as Be}from"./useInfiniteQuery-KqL5cNCq.js";/**
|
| 2 |
* @license lucide-react v0.462.0 - ISC
|
| 3 |
*
|
| 4 |
* This source code is licensed under the ISC license.
|
| 5 |
* See the LICENSE file in the root directory of this source tree.
|
| 6 |
+
*/const O=y("Activity",[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]]);/**
|
| 7 |
* @license lucide-react v0.462.0 - ISC
|
| 8 |
*
|
| 9 |
* This source code is licensed under the ISC license.
|
| 10 |
* See the LICENSE file in the root directory of this source tree.
|
| 11 |
+
*/const We=y("Calendar",[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}]]);/**
|
| 12 |
* @license lucide-react v0.462.0 - ISC
|
| 13 |
*
|
| 14 |
* This source code is licensed under the ISC license.
|
| 15 |
* See the LICENSE file in the root directory of this source tree.
|
| 16 |
+
*/const ze=y("ChevronUp",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]);/**
|
| 17 |
* @license lucide-react v0.462.0 - ISC
|
| 18 |
*
|
| 19 |
* This source code is licensed under the ISC license.
|
|
|
|
| 28 |
*
|
| 29 |
* This source code is licensed under the ISC license.
|
| 30 |
* See the LICENSE file in the root directory of this source tree.
|
| 31 |
+
*/const Ge=y("CircleSlash2",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M22 2 2 22",key:"y4kqgn"}]]);/**
|
| 32 |
* @license lucide-react v0.462.0 - ISC
|
| 33 |
*
|
| 34 |
* This source code is licensed under the ISC license.
|
| 35 |
* See the LICENSE file in the root directory of this source tree.
|
| 36 |
+
*/const Ve=y("Clock3",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16.5 12",key:"1aq6pp"}]]);/**
|
| 37 |
* @license lucide-react v0.462.0 - ISC
|
| 38 |
*
|
| 39 |
* This source code is licensed under the ISC license.
|
|
|
|
| 43 |
*
|
| 44 |
* This source code is licensed under the ISC license.
|
| 45 |
* See the LICENSE file in the root directory of this source tree.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 46 |
*/const Xe=y("Images",[["path",{d:"M18 22H4a2 2 0 0 1-2-2V6",key:"pblm9e"}],["path",{d:"m22 13-1.296-1.296a2.41 2.41 0 0 0-3.408 0L11 18",key:"nf6bnh"}],["circle",{cx:"12",cy:"8",r:"2",key:"1822b1"}],["rect",{width:"16",height:"16",x:"6",y:"2",rx:"2",key:"12espp"}]]);/**
|
| 47 |
* @license lucide-react v0.462.0 - ISC
|
| 48 |
*
|
| 49 |
* This source code is licensed under the ISC license.
|
| 50 |
* See the LICENSE file in the root directory of this source tree.
|
| 51 |
+
*/const Ye=y("TrendingUp",[["polyline",{points:"22 7 13.5 15.5 8.5 10.5 2 17",key:"126l90"}],["polyline",{points:"16 7 22 7 22 13",key:"kwv8wd"}]]);/**
|
| 52 |
* @license lucide-react v0.462.0 - ISC
|
| 53 |
*
|
| 54 |
* This source code is licensed under the ISC license.
|
| 55 |
* See the LICENSE file in the root directory of this source tree.
|
| 56 |
+
*/const Ze=y("TriangleAlert",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]]),p=x.forwardRef(({className:s,...a},r)=>e.jsx("div",{ref:r,className:v("rounded-lg border bg-card text-card-foreground shadow-sm",s),...a}));p.displayName="Card";const j=x.forwardRef(({className:s,...a},r)=>e.jsx("div",{ref:r,className:v("flex flex-col space-y-1.5 p-6",s),...a}));j.displayName="CardHeader";const f=x.forwardRef(({className:s,...a},r)=>e.jsx("h3",{ref:r,className:v("text-2xl font-semibold leading-none tracking-tight",s),...a}));f.displayName="CardTitle";const T=x.forwardRef(({className:s,...a},r)=>e.jsx("p",{ref:r,className:v("text-sm text-muted-foreground",s),...a}));T.displayName="CardDescription";const g=x.forwardRef(({className:s,...a},r)=>e.jsx("div",{ref:r,className:v("p-6 pt-0",s),...a}));g.displayName="CardContent";const es=x.forwardRef(({className:s,...a},r)=>e.jsx("div",{ref:r,className:v("flex items-center p-6 pt-0",s),...a}));es.displayName="CardFooter";var U="Tabs",[ss]=De(U,[ae]),ne=ae(),[as,K]=ss(U),ie=x.forwardRef((s,a)=>{const{__scopeTabs:r,value:t,onValueChange:o,defaultValue:d,orientation:m="horizontal",dir:c,activationMode:n="automatic",...h}=s,l=Le(c),[u,w]=Pe({prop:t,onChange:o,defaultProp:d??"",caller:U});return e.jsx(as,{scope:r,baseId:Fe(),value:u,onValueChange:w,orientation:m,dir:l,activationMode:n,children:e.jsx(H.div,{dir:l,"data-orientation":m,...h,ref:a})})});ie.displayName=U;var ce="TabsList",le=x.forwardRef((s,a)=>{const{__scopeTabs:r,loop:t=!0,...o}=s,d=K(ce,r),m=ne(r);return e.jsx(Me,{asChild:!0,...m,orientation:d.orientation,dir:d.dir,loop:t,children:e.jsx(H.div,{role:"tablist","aria-orientation":d.orientation,...o,ref:a})})});le.displayName=ce;var oe="TabsTrigger",de=x.forwardRef((s,a)=>{const{__scopeTabs:r,value:t,disabled:o=!1,...d}=s,m=K(oe,r),c=ne(r),n=ue(m.baseId,t),h=he(m.baseId,t),l=t===m.value;return e.jsx(Ae,{asChild:!0,...c,focusable:!o,active:l,children:e.jsx(H.button,{type:"button",role:"tab","aria-selected":l,"aria-controls":h,"data-state":l?"active":"inactive","data-disabled":o?"":void 0,disabled:o,id:n,...d,ref:a,onMouseDown:B(s.onMouseDown,u=>{!o&&u.button===0&&u.ctrlKey===!1?m.onValueChange(t):u.preventDefault()}),onKeyDown:B(s.onKeyDown,u=>{[" ","Enter"].includes(u.key)&&m.onValueChange(t)}),onFocus:B(s.onFocus,()=>{const u=m.activationMode!=="manual";!l&&!o&&u&&m.onValueChange(t)})})})});de.displayName=oe;var me="TabsContent",xe=x.forwardRef((s,a)=>{const{__scopeTabs:r,value:t,forceMount:o,children:d,...m}=s,c=K(me,r),n=ue(c.baseId,t),h=he(c.baseId,t),l=t===c.value,u=x.useRef(l);return x.useEffect(()=>{const w=requestAnimationFrame(()=>u.current=!1);return()=>cancelAnimationFrame(w)},[]),e.jsx(Ee,{present:o||l,children:({present:w})=>e.jsx(H.div,{"data-state":l?"active":"inactive","data-orientation":c.orientation,role:"tabpanel","aria-labelledby":n,hidden:!w,id:h,tabIndex:0,...m,ref:a,style:{...s.style,animationDuration:u.current?"0s":void 0},children:w&&d})})});xe.displayName=me;function ue(s,a){return`${s}-trigger-${a}`}function he(s,a){return`${s}-content-${a}`}var rs=ie,pe=le,ge=de,je=xe;const ts=rs,fe=x.forwardRef(({className:s,...a},r)=>e.jsx(pe,{ref:r,className:v("inline-flex h-10 items-center justify-center rounded-md bg-muted p-1 text-muted-foreground",s),...a}));fe.displayName=pe.displayName;const M=x.forwardRef(({className:s,...a},r)=>e.jsx(ge,{ref:r,className:v("inline-flex items-center justify-center whitespace-nowrap rounded-sm px-3 py-1.5 text-sm font-medium ring-offset-background transition-all data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow-sm focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",s),...a}));M.displayName=ge.displayName;const A=x.forwardRef(({className:s,...a},r)=>e.jsx(je,{ref:r,className:v("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",s),...a}));A.displayName=je.displayName;function N(s){if(!s)return"Never";const a=new Date(s);if(Number.isNaN(a.getTime()))return s;const r=Date.now()-a.getTime(),t=Math.floor(r/6e4),o=Math.floor(r/36e5),d=Math.floor(r/864e5);return t<1?"Just now":t<60?`${t}m ago`:o<24?`${o}h ago`:d<7?`${d}d ago`:a.toLocaleString("en-US",{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}function ve(s){return s==null?"N/A":s<60?`${s.toFixed(1)}s`:s<3600?`${(s/60).toFixed(1)}m`:`${(s/3600).toFixed(1)}h`}function Ne(s){return s.available?s.status==="completed"?s.conclusion??"completed":s.status??"unknown":"Unavailable"}function be(s){return s.replace(/_/g," ").replace(/\b\w/g,a=>a.toUpperCase())}const ns={healthy:z,degraded:Ze,broken:q,running:R,stuck:q,unknown:Ke};function is({status:s,isRunning:a}){const r=a?"running":s,t=ns[r];return e.jsx(t,{className:`cron-status-icon cron-status--${r}${r==="running"?" animate-spin":""}`})}function ee({icon:s,title:a,metrics:r}){return e.jsxs("div",{children:[e.jsxs("div",{className:"cron-section-heading",children:[e.jsx(s,{className:"h-4 w-4"}),e.jsx("h4",{children:a})]}),e.jsx("div",{className:"grid grid-cols-2 gap-3",children:Object.entries(r).map(([t,o])=>e.jsxs("div",{className:"cron-metric-card",children:[e.jsx("div",{className:"cron-label",children:be(t)}),e.jsx("div",{className:"text-lg font-semibold",children:typeof o=="number"?o.toLocaleString():o})]},t))})]})}function cs({workflow:s}){return e.jsxs("div",{children:[e.jsxs("div",{className:"cron-section-heading",children:[e.jsx(O,{className:"h-4 w-4"}),e.jsx("h4",{children:"GitHub Actions"})]}),e.jsxs("div",{className:"cron-metric-card space-y-2 text-sm",children:[[["Workflow",s.workflow_file],["Run",s.run_id??"N/A"],["Status",Ne(s)],...s.updated_at?[["Updated",N(s.updated_at)]]:[]].map(([a,r])=>e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsx("span",{className:"cron-label",children:a}),e.jsx("span",{className:a==="Workflow"?"font-mono text-xs":void 0,children:r})]},a)),s.failed_jobs&&s.failed_jobs.length>0&&e.jsxs("div",{children:[e.jsx("div",{className:"cron-label mb-1",children:"Failed jobs"}),e.jsx("div",{className:"flex gap-2 flex-wrap",children:s.failed_jobs.map(a=>e.jsx(_,{variant:"outline",className:"cron-status--broken",children:a},a))})]}),s.job_conclusions&&Object.keys(s.job_conclusions).length>0&&e.jsxs("div",{children:[e.jsx("div",{className:"cron-label mb-1",children:"Job conclusions"}),e.jsx("div",{className:"flex gap-2 flex-wrap",children:Object.entries(s.job_conclusions).map(([a,r])=>e.jsxs(_,{variant:"outline",children:[a,": ",r??"running"]},a))})]}),(s.error||s.view_error)&&e.jsx("div",{className:"cron-message cron-message--error",children:s.error??s.view_error})]})]})}function ls(s){return s==="COMPLETED"?"cron-status--healthy":s==="ERROR"||s==="CANCELED"?"cron-status--broken":s==="RUNNING"?"cron-status--running":"cron-status--unknown"}function os({job:s}){const a=s.progress,r=a!=null&&a.total_papers?Math.min(100,a.processed_papers/a.total_papers*100):0;return e.jsxs("div",{className:"cron-metric-card space-y-3",children:[e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsxs("div",{className:"font-semibold",children:[s.mode??"unknown"," · shard ",s.shard_id??"N/A"]}),e.jsx("div",{className:"font-mono text-xs cron-muted truncate",children:s.id})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(_,{variant:"outline",className:ls(s.stage),children:s.stage.toLowerCase()}),s.url&&e.jsx("a",{href:s.url,target:"_blank",rel:"noreferrer","aria-label":`Open Hugging Face Job ${s.id}`,className:"cron-info-text",children:e.jsx(re,{className:"h-4 w-4"})})]})]}),a?e.jsxs(e.Fragment,{children:[e.jsxs("div",{children:[e.jsxs("div",{className:"flex justify-between gap-3 text-xs cron-muted mb-1",children:[e.jsxs("span",{children:[a.processed_papers.toLocaleString()," / ",a.total_papers.toLocaleString()," papers"]}),e.jsxs("span",{children:[r.toFixed(0),"%"]})]}),e.jsx("div",{className:"cron-progress-track",children:e.jsx("div",{className:"cron-progress-value",style:{width:`${r}%`}})})]}),e.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-2 text-sm",children:[e.jsxs("span",{children:[e.jsx("strong",{children:a.succeeded_papers.toLocaleString()})," succeeded"]}),e.jsxs("span",{children:[e.jsx("strong",{children:a.failed_papers.toLocaleString()})," failed"]}),e.jsxs("span",{children:[e.jsx("strong",{children:a.already_existed_papers.toLocaleString()})," skipped"]}),e.jsxs("span",{children:[e.jsx("strong",{children:a.extracted_images.toLocaleString()})," images"]})]}),a.updated_at&&e.jsxs("div",{className:"text-xs cron-muted",children:["Progress updated ",N(a.updated_at)]}),(a.fatal_error||a.error_samples.length>0)&&e.jsxs("div",{className:"cron-message cron-message--error space-y-1",children:[a.fatal_error&&e.jsx("div",{children:a.fatal_error}),a.error_samples.map(t=>e.jsxs("div",{children:[e.jsx("span",{className:"font-mono",children:t.arxiv_id}),": ",t.error]},`${t.arxiv_id}:${t.error}`))]})]}):e.jsx("div",{className:"text-sm cron-muted",children:"Waiting for the shard progress checkpoint."}),e.jsxs("div",{className:"flex flex-wrap gap-x-4 gap-y-1 text-xs cron-muted",children:[s.hardware&&e.jsx("span",{children:s.hardware}),s.created_at&&e.jsxs("span",{children:["Created ",N(s.created_at)]}),s.duration_seconds!=null&&e.jsxs("span",{children:["Duration ",ve(s.duration_seconds)]})]}),s.stage_message&&e.jsx("div",{className:"cron-message cron-message--warning",children:s.stage_message})]})}function ds({monitor:s,loading:a,error:r}){return e.jsxs("div",{className:"md:col-span-2",children:[e.jsxs("div",{className:"cron-section-heading",children:[e.jsx(Xe,{className:"h-4 w-4"}),e.jsx("h4",{children:"Hugging Face OCR shards"})]}),a&&e.jsxs("div",{className:"cron-metric-card flex items-center gap-2 text-sm cron-muted",children:[e.jsx(R,{className:"h-4 w-4 animate-spin"})," Loading remote Jobs…"]}),r&&e.jsx("div",{className:"cron-message cron-message--error",children:"Could not load Hugging Face Jobs."}),s&&!s.available&&e.jsx("div",{className:"cron-message cron-message--warning",children:s.error??"Hugging Face monitoring is unavailable."}),(s==null?void 0:s.available)&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-3 mb-3",children:Object.entries(s.summary).map(([t,o])=>e.jsxs("div",{className:"cron-metric-card",children:[e.jsx("div",{className:"cron-label",children:be(t)}),e.jsx("div",{className:"text-lg font-semibold",children:o.toLocaleString()})]},t))}),s.jobs.length===0?e.jsx("div",{className:"cron-metric-card text-sm cron-muted",children:"No OCR shards have been launched yet."}):e.jsx("div",{className:"grid grid-cols-1 xl:grid-cols-2 gap-3",children:s.jobs.map(t=>e.jsx(os,{job:t},t.id))})]})]})}function ms({job:s,expanded:a,onToggle:r,paperMarkdownJobs:t,paperMarkdownJobsLoading:o=!1,paperMarkdownJobsError:d=null}){const m=!!(s.work_metrics&&Object.keys(s.work_metrics).length),c=!!(s.db_metrics&&Object.keys(s.db_metrics).length),n=s.job_name==="paper_markdown_backfill",h=m||c||!!s.workflow_status||n;return e.jsxs("div",{className:"cron-job-card",children:[e.jsx("button",{type:"button",className:"cron-job-summary",onClick:r,"aria-expanded":a,children:e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsxs("div",{className:"flex items-start gap-3 flex-1 min-w-0",children:[e.jsx(is,{status:s.status,isRunning:s.is_running}),e.jsxs("div",{className:"flex-1 min-w-0 text-left",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1 flex-wrap",children:[e.jsx("h3",{className:"font-semibold",children:s.display_name}),s.critical&&e.jsx(_,{variant:"outline",className:"text-[10px] uppercase tracking-wide",children:"Critical"}),s.lock_stale&&e.jsx(_,{variant:"outline",className:"cron-status--broken",children:"Stale lock"}),h&&(a?e.jsx(ze,{className:"h-4 w-4 cron-muted"}):e.jsx(He,{className:"h-4 w-4 cron-muted"}))]}),e.jsx("p",{className:"text-sm cron-muted mb-2",children:s.status_reason}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 xl:grid-cols-4 gap-2 text-sm cron-muted",children:[e.jsxs("span",{className:"cron-fact",children:[e.jsx(te,{}),"Log: ",N(s.last_run)]}),e.jsxs("span",{className:"cron-fact",children:[e.jsx(V,{}),"DB: ",N(s.last_db_write)]}),s.recent_write_count!=null&&e.jsxs("span",{className:"cron-fact",children:[e.jsx(Ye,{}),"Recent writes: ",s.recent_write_count.toLocaleString()]}),s.duration!=null&&e.jsxs("span",{className:"cron-fact",children:[e.jsx(O,{}),"Duration: ",ve(s.duration)]}),s.schedule&&e.jsxs("span",{className:"cron-fact md:col-span-2",children:[e.jsx(We,{}),e.jsx("span",{className:"font-mono text-xs",children:s.schedule})]}),s.log_status&&e.jsxs("span",{className:"cron-fact",children:[e.jsx(X,{}),"Log status: ",s.log_status]}),s.workflow_status&&e.jsxs("span",{className:"cron-fact",children:[e.jsx(O,{}),"Actions: ",Ne(s.workflow_status)]})]}),s.work_summary&&e.jsx("div",{className:"cron-message",children:s.work_summary}),s.error&&e.jsxs("div",{className:"cron-message cron-message--error",children:[e.jsx("strong",{children:"Error: "}),s.error]}),s.diagnostics&&e.jsx("div",{className:"cron-message cron-message--warning",children:s.diagnostics})]})]}),e.jsx(_,{variant:"outline",className:`cron-status--${s.status}`,children:s.status})]})}),a&&h&&e.jsx("div",{className:"cron-job-details",children:e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[s.work_metrics&&m&&e.jsx(ee,{icon:X,title:"Log Metrics",metrics:s.work_metrics}),s.db_metrics&&c&&e.jsx(ee,{icon:V,title:"Database Metrics",metrics:s.db_metrics}),s.workflow_status&&e.jsx(cs,{workflow:s.workflow_status}),n&&e.jsx(ds,{monitor:t,loading:o,error:d})]})})]})}const ye=x.forwardRef(({className:s,...a},r)=>e.jsx("div",{className:"relative w-full overflow-auto",children:e.jsx("table",{ref:r,className:v("w-full caption-bottom text-sm",s),...a})}));ye.displayName="Table";const _e=x.forwardRef(({className:s,...a},r)=>e.jsx("thead",{ref:r,className:v("[&_tr]:border-b",s),...a}));_e.displayName="TableHeader";const we=x.forwardRef(({className:s,...a},r)=>e.jsx("tbody",{ref:r,className:v("[&_tr:last-child]:border-0",s),...a}));we.displayName="TableBody";const xs=x.forwardRef(({className:s,...a},r)=>e.jsx("tfoot",{ref:r,className:v("border-t bg-muted/50 font-medium [&>tr]:last:border-b-0",s),...a}));xs.displayName="TableFooter";const W=x.forwardRef(({className:s,...a},r)=>e.jsx("tr",{ref:r,className:v("border-b transition-colors data-[state=selected]:bg-muted hover:bg-muted/50",s),...a}));W.displayName="TableRow";const $=x.forwardRef(({className:s,...a},r)=>e.jsx("th",{ref:r,className:v("h-12 px-4 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0",s),...a}));$.displayName="TableHead";const L=x.forwardRef(({className:s,...a},r)=>e.jsx("td",{ref:r,className:v("p-4 align-middle [&:has([role=checkbox])]:pr-0",s),...a}));L.displayName="TableCell";const us=x.forwardRef(({className:s,...a},r)=>e.jsx("caption",{ref:r,className:v("mt-4 text-sm text-muted-foreground",s),...a}));us.displayName="TableCaption";const hs={queued:"cron-status--unknown",dispatching:"cron-status--running",running:"cron-status--running",completed:"cron-status--healthy",failed:"cron-status--broken",canceled:"cron-status--unknown"},ps={"add-evals":"Add evals","enrich-paper":"Enrich paper"},gs={queued:Ve,dispatching:R,running:Qe,completed:z,failed:q,canceled:Ge};function js({status:s}){const a=gs[s];return e.jsxs(_,{variant:"outline",className:hs[s],children:[e.jsx(a,{className:`mr-1 h-3.5 w-3.5 ${s==="dispatching"?"animate-spin":""}`}),s]})}function fs(s){return s.error?s.error:s.report?s.report:s.status==="completed"&&s.applied_at?"Changes applied to the paper.":s.status==="completed"?"Completed without a recorded mutation.":null}function vs({autoRefresh:s,refreshToken:a}){const{data:r,isLoading:t,isFetching:o,error:d}=J({queryKey:["codexPaperJobs",a],queryFn:()=>Oe(100),refetchInterval:s?1e4:!1,retry:!1}),m=d&&typeof d=="object"&&"status"in d?d.status:void 0;return e.jsxs(p,{className:"mb-8",children:[e.jsx(j,{children:e.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[e.jsxs("div",{children:[e.jsx(f,{className:"text-xl",children:"Codex paper jobs"}),e.jsx(T,{children:"Durable queue and execution history for admin-triggered Hugging Face Jobs"})]}),o&&!t&&e.jsxs("span",{className:"flex items-center gap-2 text-xs cron-muted",children:[e.jsx(R,{className:"h-3.5 w-3.5 animate-spin"})," Syncing with Hugging Face"]})]})}),e.jsxs(g,{children:[t&&e.jsxs("div",{className:"flex items-center justify-center py-10 cron-muted",children:[e.jsx(R,{className:"mr-2 h-5 w-5 animate-spin"})," Loading paper jobs…"]}),d&&m!==404&&e.jsx("div",{className:"cron-message cron-message--error mb-4",children:d instanceof Error?d.message:"Could not load Codex paper jobs."}),m===404&&e.jsx("p",{className:"py-4 text-sm cron-muted",children:"Codex paper jobs are not enabled in this environment."}),r&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"mb-5 grid grid-cols-2 gap-3 sm:grid-cols-4 lg:grid-cols-7",children:[["queued","dispatching","running","completed","failed","canceled"].map(c=>e.jsxs("div",{className:"cron-metric-card",children:[e.jsx("div",{className:"cron-label capitalize",children:c}),e.jsx("div",{className:"mt-1 text-xl font-semibold",children:r.summary[c]})]},c)),e.jsxs("div",{className:"cron-metric-card",children:[e.jsx("div",{className:"cron-label",children:"Total"}),e.jsx("div",{className:"mt-1 text-xl font-semibold",children:r.summary.total})]})]}),r.jobs.length===0?e.jsx("p",{className:"py-8 text-center text-sm cron-muted",children:"No paper curation jobs have been submitted yet."}):e.jsxs(ye,{children:[e.jsx(_e,{children:e.jsxs(W,{children:[e.jsx($,{children:"Status"}),e.jsx($,{children:"Paper"}),e.jsx($,{children:"Action"}),e.jsx($,{children:"Requested"}),e.jsx($,{children:"Execution"})]})}),e.jsx(we,{children:r.jobs.map(c=>{const n=fs(c);return e.jsxs(W,{children:[e.jsx(L,{className:"align-top",children:e.jsx(js,{status:c.status})}),e.jsxs(L,{className:"min-w-[260px] align-top",children:[e.jsx(Ie,{to:`/paper/${encodeURIComponent(c.paper_route)}`,className:"font-medium hover:underline",children:c.paper_title}),e.jsxs("div",{className:"mt-1 text-xs cron-muted",children:["Paper #",c.paper_id]})]}),e.jsxs(L,{className:"whitespace-nowrap align-top",children:[ps[c.kind],c.applied_at&&e.jsxs("div",{className:"mt-1 flex items-center gap-1 text-xs cron-status--healthy",children:[e.jsx(z,{className:"h-3.5 w-3.5"})," Applied"]})]}),e.jsxs(L,{className:"whitespace-nowrap align-top",children:[e.jsx("div",{children:N(c.created_at)}),e.jsxs("div",{className:"mt-1 text-xs cron-muted",children:["@",c.requested_by]})]}),e.jsxs(L,{className:"max-w-[360px] align-top",children:[c.hf_job_url?e.jsxs("a",{href:c.hf_job_url,target:"_blank",rel:"noreferrer",className:"inline-flex items-center gap-1 hover:underline",children:["Hugging Face Job ",e.jsx(re,{className:"h-3.5 w-3.5"})]}):e.jsx("span",{className:"cron-muted",children:"Waiting to dispatch"}),n&&e.jsx("p",{className:`mt-2 line-clamp-3 text-xs ${c.error?"text-red-700":"cron-muted"}`,title:n,children:n})]})]},c.id)})})]}),e.jsxs("p",{className:"mt-4 text-xs cron-muted",children:["Showing the 100 most recent jobs · Queue totals include full history · Updated ",N(r.timestamp)]})]})]})]})}const Ns=()=>{var d,m,c;const s=Je(),a=Be({queryKey:["catalog-audit"],queryFn:({pageParam:n})=>P.getCatalogAudit(n),initialPageParam:void 0,getNextPageParam:n=>n.next_cursor??void 0}),r=((d=a.data)==null?void 0:d.pages.flatMap(n=>n.events))??[],t=Z({mutationFn:()=>P.acknowledgeCatalogAudit(),onSuccess:()=>s.invalidateQueries({queryKey:["catalog-audit"]})}),o=Z({mutationFn:n=>P.rollbackCatalogEvent(n),onSuccess:()=>s.invalidateQueries({queryKey:["catalog-audit"]})});return e.jsx("div",{className:"space-y-4",children:e.jsxs(p,{children:[e.jsxs(j,{className:"flex-row items-center justify-between",children:[e.jsx(f,{children:"Catalog mutation audit"}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsxs("span",{className:"text-sm font-medium",children:[((c=(m=a.data)==null?void 0:m.pages[0])==null?void 0:c.unread_contributor_count)??0," unread contributor changes"]}),e.jsx(F,{variant:"outline",size:"sm",onClick:()=>t.mutate(),disabled:t.isPending,children:"Mark read"})]})]}),e.jsxs(g,{className:"space-y-3",children:[a.isLoading&&e.jsx("p",{children:"Loading audit history…"}),a.error&&e.jsx("p",{className:"text-destructive",children:"Audit history unavailable."}),r.map(n=>e.jsxs("article",{className:`rounded-md border p-3 ${n.operation==="delete"||n.rollback_eligible===!1?"border-red-500 bg-red-50/50":""}`,children:[e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[e.jsxs("strong",{children:[n.operation," ",n.entity_type," ",n.entity_id]}),e.jsxs("span",{className:"text-xs text-muted-foreground",children:["@",n.actor_username??n.actor_role," ·"," ",new Date(n.created_at).toLocaleString()]})]}),e.jsxs("details",{className:"mt-2 text-xs",children:[e.jsx("summary",{children:"Inspect snapshots"}),e.jsx("pre",{className:"mt-2 max-h-80 overflow-auto rounded bg-muted p-3",children:JSON.stringify({before:n.before,after:n.after},null,2)})]}),!n.rollback_of_event_id&&e.jsx(F,{className:"mt-3",variant:"outline",size:"sm",onClick:()=>o.mutate(n.id),disabled:o.isPending||n.rollback_eligible===!1,children:n.rollback_eligible===!1?"Rollback conflict":"Roll back if unchanged"})]},n.id)),a.hasNextPage&&e.jsx(F,{variant:"outline",onClick:()=>a.fetchNextPage(),disabled:a.isFetchingNextPage,children:a.isFetchingNextPage?"Loading…":"Load older events"})]})]})})},se={hourly:"cron-status--running",daily:"cron-status--healthy",weekly:"cron-status--degraded"},b=s=>`$${(s/1e6).toFixed(2)}`,bs=({data:s,loading:a,error:r})=>{const[t,o]=x.useState("staging-current"),d={"staging-current":"Starter staging · $75 warning / $100 trip / no Environment cap","staging-production-era":"Staging with production · $15 / $20 / $25",production:"Production · $175 / $200 / $225"};if(a)return e.jsxs("div",{className:"flex items-center py-12",children:[e.jsx(R,{className:"h-6 w-6 animate-spin mr-3"}),"Loading chat compute…"]});if(r||!s)return e.jsx(p,{className:"cron-status--broken",children:e.jsx(g,{className:"pt-6",children:"Chat compute accounting is unavailable."})});const m=Math.min(100,s.effective_microusd/s.application_cap_microusd*100),c=s.circuit_state==="tripped"?"Chat disabled":s.circuit_state==="warning"?"Operator warning":"Enabled",n=s.reconciliation_state==="fresh"?"Fresh":s.reconciliation_state==="stale"?"Stale":"Unavailable";return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"grid md:grid-cols-4 gap-4",children:[e.jsxs(p,{className:s.circuit_state==="tripped"?"cron-status--broken":s.circuit_state==="warning"?"cron-status--degraded":"",children:[e.jsx(j,{children:e.jsx(f,{className:"text-sm",children:"Circuit"})}),e.jsxs(g,{children:[e.jsx("div",{className:"text-2xl font-bold",children:c}),e.jsx("p",{className:"text-xs cron-muted",children:s.trip_reason??"Policy armed"})]})]}),e.jsxs(p,{children:[e.jsx(j,{children:e.jsx(f,{className:"text-sm",children:"Month to date"})}),e.jsxs(g,{children:[e.jsx("div",{className:"text-2xl font-bold",children:b(s.effective_microusd)}),e.jsx("div",{role:"progressbar","aria-label":"Application cap used","aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":Math.round(m),className:"h-2 rounded bg-muted mt-3",children:e.jsx("div",{className:"h-2 rounded bg-primary",style:{width:`${m}%`}})})]})]}),e.jsxs(p,{children:[e.jsx(j,{children:e.jsx(f,{className:"text-sm",children:"Application headroom"})}),e.jsxs(g,{children:[e.jsx("div",{className:"text-2xl font-bold",children:b(s.remaining_microusd)}),e.jsxs("p",{className:"text-xs cron-muted",children:["Cap ",b(s.application_cap_microusd)]})]})]}),e.jsxs(p,{children:[e.jsx(j,{children:e.jsx(f,{className:"text-sm",children:"Live compute"})}),e.jsxs(g,{children:[e.jsx("div",{className:"text-2xl font-bold",children:s.live_count}),e.jsxs("p",{className:"text-xs cron-muted",children:[s.termination_uncertain_count," termination uncertain"]})]})]})]}),e.jsxs(p,{children:[e.jsxs(j,{children:[e.jsx(f,{children:"Accounting and policy"}),e.jsxs(T,{children:[s.environment," · cycle ",s.billing_cycle]})]}),e.jsxs(g,{className:"grid md:grid-cols-3 gap-4 text-sm",children:[e.jsxs("div",{children:[e.jsx("strong",{children:"Environment record"}),e.jsx("br",{}),s.environment," · ",s.provider_mode==="starter_workspace"?"Starter Workspace":"Team isolated"]}),e.jsxs("label",{children:[e.jsx("strong",{children:"Policy profile"}),e.jsxs("select",{"aria-label":"Chat compute policy profile",value:t,onChange:h=>o(h.target.value),className:"block mt-1",children:[e.jsx("option",{value:"staging-current",children:"Staging now"}),e.jsx("option",{value:"staging-production-era",children:"Staging with production"}),e.jsx("option",{value:"production",children:"Production"})]}),e.jsxs("span",{className:"text-xs cron-muted",children:[d[t]," · Workspace $250"]})]}),e.jsxs("div",{children:[e.jsx("strong",{children:"Conservative estimate"}),e.jsx("br",{}),b(s.estimated_microusd)]}),e.jsxs("div",{children:[e.jsx("strong",{children:"Provider-reported floor"}),e.jsx("br",{}),b(s.provider_floor_microusd)," · ",e.jsx(_,{children:n})]}),e.jsxs("div",{children:[e.jsx("strong",{children:"Provider backstops"}),e.jsx("br",{}),s.environment_cap_microusd===null?"Starter: no Environment cap":`Environment ${b(s.environment_cap_microusd)}`," · Workspace ",b(s.workspace_cap_microusd)]}),e.jsxs("div",{children:[e.jsx("strong",{children:"Active thresholds"}),e.jsx("br",{}),"Warning ",b(s.warning_microusd)," · trip ",b(s.application_cap_microusd)]}),e.jsxs("div",{children:[e.jsx("strong",{children:"Policy allocation"}),e.jsx("br",{}),"Starter staging $75/$100 with no Environment cap · future Team staging $15/$20/$25 · production $175/$200/$225 · workspace $250"]}),e.jsxs("div",{children:[e.jsx("strong",{children:"Cycle end"}),e.jsx("br",{}),N(s.cycle_end_at)]}),e.jsxs("div",{children:[e.jsx("strong",{children:"Last metered"}),e.jsx("br",{}),s.last_metered_at?N(s.last_metered_at):"Unavailable"]}),e.jsxs("div",{children:[e.jsx("strong",{children:"Provider reconciliation"}),e.jsx("br",{}),s.last_reconciled_at?N(s.last_reconciled_at):"Unavailable",s.last_reconciliation_attempt_at?` · attempted ${N(s.last_reconciliation_attempt_at)}`:"",s.next_reconciliation_at?` · next ${N(s.next_reconciliation_at)}`:""]}),e.jsxs("div",{children:[e.jsx("strong",{children:"Burn projection"}),e.jsx("br",{}),s.burn_rate_microusd_per_hour===null?"Not enough data":`${b(s.burn_rate_microusd_per_hour)}/hour${s.projected_cap_hit_at?` · cap ${N(s.projected_cap_hit_at)}`:""}`]}),e.jsxs("div",{children:[e.jsx("strong",{children:"Prior cycle"}),e.jsx("br",{}),s.prior_cycle?`${s.prior_cycle.billing_cycle} · ${b(s.prior_cycle.effective_microusd)}`:"Not enough data"]})]})]}),e.jsxs(p,{children:[e.jsx(j,{children:e.jsx(f,{children:"Live lifecycle"})}),e.jsx(g,{className:"text-sm",children:Object.entries(s.live_states).map(([h,l])=>e.jsxs("span",{className:"mr-4",children:[h,": ",l]},h))})]}),e.jsxs(p,{children:[e.jsx(j,{children:e.jsx(f,{children:"Daily spend"})}),e.jsx(g,{children:s.daily_spend.length?e.jsx("ul",{className:"space-y-1 text-sm",children:s.daily_spend.map(h=>e.jsxs("li",{children:[h.date,": blank ",b(h.blank_pool_microusd)," · assigned ",b(h.assigned_microusd)]},h.date))}):e.jsx("p",{className:"cron-muted",children:"No compute recorded in this cycle."})})]}),e.jsxs(p,{children:[e.jsxs(j,{children:[e.jsx(f,{children:"Recent circuit events"}),e.jsx(T,{children:"Runbook: docs/chat-sandbox-spend-runbook.md"})]}),e.jsx(g,{children:s.events.length?e.jsx("ul",{className:"space-y-2 text-sm",children:s.events.map(h=>e.jsxs("li",{children:[e.jsx(_,{children:h.severity})," ",h.type," · ",N(h.created_at)]},h.id))}):e.jsx("p",{className:"cron-muted",children:"No events in this cycle."})})]})]})},As=()=>{const[s,a]=x.useState(!0),[r,t]=x.useState(0),[o,d]=x.useState(""),[m,c]=x.useState(""),[n,h]=x.useState(new Set),{user:l}=qe(),{data:u,isLoading:w,isFetching:Q,error:C,refetch:ke}=J({queryKey:["cronStatus",l==null?void 0:l.username],queryFn:()=>P.getCronStatus(),enabled:!!(l!=null&&l.is_admin),refetchInterval:s?3e4:!1,retry:!1}),E=J({queryKey:["paperMarkdownJobs",l==null?void 0:l.username],queryFn:()=>P.getPaperMarkdownJobs(),enabled:!!(l!=null&&l.is_admin),refetchInterval:s?3e4:!1,retry:!1}),D=J({queryKey:["chatSandboxSpend",l==null?void 0:l.username,m],queryFn:()=>P.getChatSandboxSpend(m||void 0),enabled:!!(l!=null&&l.is_admin),refetchInterval:s?3e4:!1,retry:!1}),Ce=(C&&typeof C=="object"&&"status"in C?C.status:void 0)===401?"Unauthorized. Sign in with an allowlisted Hugging Face admin account.":C instanceof Error?C.message:void 0,Se=i=>{h(k=>{const S=new Set(k);return S.has(i)?S.delete(i):S.add(i),S})},Te=(u==null?void 0:u.jobs.filter(i=>i.critical))??[],I=((u==null?void 0:u.jobs.filter(i=>!i.critical))??[]).reduce((i,k)=>(i[k.category]||(i[k.category]=[]),i[k.category].push(k),i),{}),Re=Object.keys(I).sort((i,k)=>{const S=["hourly","daily","weekly"];return S.indexOf(i)-S.indexOf(k)}),G=i=>e.jsx(ms,{job:i,expanded:n.has(i.job_name),onToggle:()=>Se(i.job_name),paperMarkdownJobs:i.job_name==="paper_markdown_backfill"?E.data:void 0,paperMarkdownJobsLoading:i.job_name==="paper_markdown_backfill"?E.isLoading:!1,paperMarkdownJobsError:i.job_name==="paper_markdown_backfill"?E.error:null},i.job_name),$e=()=>{t(i=>i+1),ke(),E.refetch(),D.refetch()};return e.jsx("div",{className:"cron-dashboard","data-shadcn":!0,children:e.jsxs("div",{className:"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-8",children:[e.jsx("div",{className:"mb-8",children:e.jsxs("div",{className:"flex items-center justify-between gap-4 flex-wrap",children:[e.jsxs("div",{children:[e.jsxs("h1",{className:"text-3xl font-bold flex items-center gap-3",children:[e.jsx(O,{className:"h-8 w-8 cron-info-text"}),"Admin Dashboard"]}),e.jsx("p",{className:"mt-2 cron-muted",children:"Paper curation queue and operational health for scheduled jobs"})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsxs(F,{variant:"outline",size:"sm",onClick:()=>a(!s),className:s?"cron-status--running":"",children:[e.jsx(Y,{className:`h-4 w-4 mr-2 ${s?"animate-spin":""}`}),"Auto-refresh ",s?"ON":"OFF"]}),e.jsxs(F,{variant:"outline",size:"sm",onClick:$e,disabled:Q,children:[e.jsx(Y,{className:`h-4 w-4 mr-2 ${Q?"animate-spin":""}`}),"Refresh"]})]})]})}),e.jsx(p,{className:"mb-6",children:e.jsx(g,{className:"pt-6",children:e.jsxs("p",{className:"text-sm cron-muted",children:["Signed in as ",e.jsxs("span",{className:"font-semibold",children:["@",l==null?void 0:l.username]}),". Health checks prefer database freshness over log completion so silent no-work failures surface as degraded or broken."]})})}),e.jsxs(ts,{defaultValue:"critical-jobs",children:[e.jsxs(fe,{className:"grid w-full grid-cols-4 sm:w-auto",children:[e.jsx(M,{value:"critical-jobs",children:"Critical Jobs"}),e.jsx(M,{value:"codex-paper-jobs",children:"Codex Paper Jobs"}),e.jsx(M,{value:"catalog-audit",children:"Catalog Audit"}),e.jsx(M,{value:"chat-compute",children:"Chat Compute"})]}),e.jsxs(A,{value:"critical-jobs",className:"mt-6",children:[w&&e.jsxs("div",{className:"flex items-center justify-center py-12",children:[e.jsx(R,{className:"h-8 w-8 animate-spin cron-info-text"}),e.jsx("span",{className:"ml-3 cron-muted",children:"Loading CRON jobs status..."})]}),C&&e.jsx(p,{className:"cron-status--broken",children:e.jsx(g,{className:"pt-6",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(q,{className:"h-5 w-5"}),e.jsx("p",{children:Ce??"Failed to load CRON jobs status. Please try again."})]})})}),u&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"grid grid-cols-2 md:grid-cols-3 lg:grid-cols-6 gap-4 mb-6",children:["healthy","degraded","broken","running","stuck","unknown"].map(i=>e.jsxs(p,{children:[e.jsx(j,{className:"pb-2",children:e.jsx(f,{className:"text-sm font-medium cron-muted capitalize",children:i})}),e.jsx(g,{children:e.jsx("div",{className:"text-2xl font-bold",children:u.summary[i]})})]},i))}),u.summary.critical_issues.length>0&&e.jsxs(p,{className:"mb-6 cron-status--broken",children:[e.jsx(j,{children:e.jsxs(f,{className:"flex items-center gap-2",children:[e.jsx(Ue,{className:"h-5 w-5"}),"Critical job issues"]})}),e.jsx(g,{children:e.jsx("ul",{className:"list-disc pl-5 space-y-1 text-sm",children:u.summary.critical_issues.map(i=>e.jsx("li",{children:i},i))})})]}),e.jsxs(p,{className:"mb-8",children:[e.jsx(j,{children:e.jsx(f,{className:"text-base",children:"What to check next"})}),e.jsxs(g,{children:[e.jsx("p",{className:"text-sm cron-muted",children:u.summary.what_to_check_next}),e.jsxs("p",{className:"mt-2 text-xs cron-muted flex items-center gap-2",children:[e.jsx(te,{className:"h-4 w-4"}),"Last updated: ",N(u.timestamp)," · Health score:"," ",u.summary.health_score.toFixed(0),"%"]})]})]}),e.jsxs(p,{className:"mb-8",children:[e.jsxs(j,{children:[e.jsx(f,{className:"text-xl",children:"Critical jobs"}),e.jsx(T,{children:"Writers whose stale output breaks the live site"})]}),e.jsx(g,{className:"space-y-4",children:Te.map(G)})]}),e.jsx("div",{className:"space-y-6",children:Re.map(i=>e.jsxs(p,{children:[e.jsx(j,{children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs(f,{className:"text-xl capitalize flex items-center gap-2",children:[e.jsx(_,{className:se[i]??se.hourly,children:i}),e.jsx("span",{children:"Supporting jobs"})]}),e.jsxs(T,{children:[I[i].length," job",I[i].length!==1?"s":""]})]})}),e.jsx(g,{className:"space-y-4",children:I[i].map(G)})]},i))})]})]}),e.jsx(A,{value:"codex-paper-jobs",className:"mt-6",children:e.jsx(vs,{autoRefresh:s,refreshToken:r})}),e.jsx(A,{value:"catalog-audit",className:"mt-6",children:e.jsx(Ns,{})}),e.jsxs(A,{value:"chat-compute",className:"mt-6",children:[e.jsxs(p,{className:"mb-6",children:[e.jsxs(j,{children:[e.jsx(f,{children:"Environment record"}),e.jsx(T,{children:"Leave blank for live staging, or enter the isolated environment printed by the spend qualification command."})]}),e.jsxs(g,{className:"flex gap-2",children:[e.jsx("input",{"aria-label":"Chat compute environment record",value:o,onChange:i=>d(i.target.value),placeholder:"staging-q-example",className:"flex-1 rounded border px-3 py-2"}),e.jsx(F,{onClick:()=>c(o.trim()),children:"Load"})]})]}),e.jsx(bs,{data:D.data,loading:D.isLoading,error:D.error})]})]})]})})};export{bs as ChatComputePanel,As as default};
|
assets/{ExternalSourceEvalBadge-CJOl_gOx.js → ExternalSourceEvalBadge-DW02jL22.js}
RENAMED
|
@@ -1 +1 @@
|
|
| 1 |
-
import{j as e,L as n}from"./index-
|
|
|
|
| 1 |
+
import{j as e,L as n}from"./index-Bthypk3Q.js";import{H as o,a as l,b as i}from"./hover-card-Dy9hZi_x.js";import{s as c}from"./safeExternalHref-CkBrsh84.js";const h=()=>e.jsxs(o,{openDelay:120,closeDelay:120,children:[e.jsx(l,{asChild:!0,children:e.jsx("button",{type:"button",className:"bm-closed-source-tag","aria-label":"Closed-source model",children:"closed"})}),e.jsxs(i,{side:"top",align:"start",className:"w-auto max-w-[260px] p-3 text-sm leading-snug",children:["This is an evaluation of a closed-source model. You can disable viewing these in your"," ",e.jsx(n,{to:"/settings",className:"closed-eval-tooltip-link",children:"settings"}),"."]})]});function d(a){if(!a)return"Evaluation sourced outside this paper";const r=a.toLowerCase();if(r.includes("open-asr-leaderboard"))return"Open ASR Leaderboard";if(r.includes("arcprize.org"))return"ARC Prize Leaderboard";if(r.includes("frontierswe.com"))return"FrontierSWE";if(r.includes("deepswe.datacurve.ai"))return"DeepSWE";try{const s=new URL(a,"https://paperswithcode.co");return s.pathname.startsWith("/paper/")?"Source paper":s.hostname.replace(/^www\./,"")}catch{return a}}const m=({sourceUrl:a})=>{const r=c(a),s=typeof a=="string"&&a.startsWith("/paper/")?a:null,t=d(a);return e.jsxs(o,{openDelay:120,closeDelay:120,children:[e.jsx(l,{asChild:!0,children:e.jsx("button",{type:"button",className:"bm-external-source-tag","aria-label":`Externally sourced evaluation: ${t}`,children:"External"})}),e.jsxs(i,{side:"top",align:"start",className:"w-auto max-w-[280px] p-3 text-sm leading-snug",children:["This score was sourced outside this paper.",s?e.jsxs(e.Fragment,{children:[" ",e.jsx(n,{to:s,target:"_blank",rel:"noopener noreferrer",className:"external-eval-tooltip-link",children:t}),"."]}):r?e.jsxs(e.Fragment,{children:[" ",e.jsx("a",{href:r,target:"_blank",rel:"noopener noreferrer",className:"external-eval-tooltip-link",children:t}),"."]}):e.jsxs(e.Fragment,{children:[" ",t,"."]})]})]})};export{h as C,m as E};
|
assets/{FeedView-Ca0uEQAe.js → FeedView-CkdQ3x4I.js}
RENAMED
|
@@ -1 +1 @@
|
|
| 1 |
-
import{u as R,r as d,j as e,a as H,L as N,i as F,b as I,c as S}from"./index-
|
|
|
|
| 1 |
+
import{u as R,r as d,j as e,a as H,L as N,i as F,b as I,c as S}from"./index-Bthypk3Q.js";import{P as q}from"./components-DR4nXlac.js";import{u as U,P as $}from"./useIntersectionObserver-BrrNIU67.js";import{D as K,M as B,S as G,P as W,A as z,q as Q,c as V}from"./chatSessions-nz97TbnH.js";import{S as _}from"./chatPrompts-CDY3UGU1.js";import{t as X,d as L}from"./transform-_T5o_x_w.js";import{u as Y}from"./usePapers-BGjLgFkG.js";import{P as J}from"./usePeriodFilter-D8fQ9GJd.js";import{S as j}from"./skeleton-BS-Px_iI.js";import{A as Z,a as ee}from"./alert-DJmmSiqi.js";import{u as E}from"./useQuery-CEDDm0wh.js";import"./LatexTitle-DOmMcoZ0.js";import"./katex.min-BSBacQyE.js";import"./safeExternalHref-CkBrsh84.js";import"./useInfiniteQuery-KqL5cNCq.js";const se=[["trending","trending"],["date_published","newest"],["citation_count","most cited"]],te={Today:"today","This Week":"week","This Month":"month","All Time":"all_time"},ae={today:"Today",week:"This Week",month:"This Month",all_time:"All Time"},C=45,ie=1800,re=25,ne=350,oe=a=>{const[m,r]=d.useState(_[0].slice(0,1));return d.useEffect(()=>{var g,f;if(!a)return;if((f=(g=window.matchMedia)==null?void 0:g.call(window,"(prefers-reduced-motion: reduce)"))!=null&&f.matches){r(_[0]);return}let h=0,n=1,u=!1,o;r(_[0].slice(0,n));const l=()=>{const p=_[h];if(!u){if(n+=1,r(p.slice(0,n)),n===p.length){u=!0,o=window.setTimeout(l,ie);return}o=window.setTimeout(l,C);return}if(n-=1,r(p.slice(0,n)),n===0){u=!1,h=(h+1)%_.length,o=window.setTimeout(l,ne);return}o=window.setTimeout(l,re)};return o=window.setTimeout(l,C),()=>window.clearTimeout(o)},[a]),m},ce=a=>a==="trending"||a==="date_published"||a==="citation_count"?a:"trending",le=a=>a==="today"||a==="week"||a==="month"||a==="all_time"?a:"all_time",de=()=>{const a=R(),m=I()?G:W,[r,h]=d.useState(""),[n,u]=d.useState(K),[o,l]=d.useState(!1),g=oe(!r),f=d.useRef(null);d.useEffect(()=>{const i=f.current;i&&(i.style.height="auto",i.style.height=`${Math.min(i.scrollHeight,160)}px`)},[r]);const p=async(i=r)=>{const x=i.trim();if(!(!x||o)){l(!0),Q(x,n);try{const c=await V(n);a(`/chat/${c.id}`)}catch{a("/chat")}}};return e.jsxs("div",{className:"ask-home",children:[e.jsx("textarea",{ref:f,rows:1,value:r,placeholder:g,"aria-label":"Ask the assistant",disabled:o,onChange:i=>h(i.target.value),onKeyDown:i=>{i.key==="Enter"&&!i.shiftKey&&(i.preventDefault(),p())}}),e.jsxs("div",{className:"ask-home-foot",children:[e.jsxs("div",{className:"ask-home-provider-tools",children:[e.jsx(B,{models:m,selectedModel:n,onModelChange:u}),e.jsxs("span",{className:"ask-home-hint",children:["Via 🤗"," ",e.jsx("a",{href:"https://huggingface.co/docs/inference-providers/en/index",target:"_blank",rel:"noreferrer",children:"Inference Providers"})]})]}),e.jsx("button",{type:"button",className:`chat-send${r.trim()?" chat-send-on":""}`,onClick:()=>p(),disabled:!r.trim()||o,"aria-label":"Ask the assistant",children:e.jsx(z,{})})]})]})},ve=()=>{var b,w,P,v,A;const[a,m]=H(),r=ce(a.get("order_by")),h=le(a.get("time")),n=a.get("has_code")==="true",u=a.get("has_hf_artifacts")==="true",o=ae[h],l=s=>{const t=new URLSearchParams(a);t.set("order_by",s),m(t)},g=s=>{const t=new URLSearchParams(a);t.set("time",te[s]),m(t)},f=s=>{const t=new URLSearchParams(a);s?t.set("has_code","true"):t.delete("has_code"),m(t)},p=s=>{const t=new URLSearchParams(a);s?t.set("has_hf_artifacts","true"):t.delete("has_hf_artifacts"),m(t)},i=E({queryKey:["top-tasks-sidebar"],queryFn:()=>S.getTopTasks({limit:8}),staleTime:10*60*1e3}),x=E({queryKey:["trending-tasks-sidebar"],queryFn:()=>S.getTrendingTasks({limit:8,level:0}),staleTime:10*60*1e3}),c=Y({page_size:30,order_by:r,order_dir:"desc",time:h,include_resources:!0,has_code:n,has_hf_artifacts:u}),T=d.useMemo(()=>{var t;return(((t=c.data)==null?void 0:t.pages.flatMap(O=>O.results))||[]).map(X)},[c.data]),{targetRef:k,isIntersecting:y}=U({rootMargin:"400px"});d.useEffect(()=>{y&&c.hasNextPage&&!c.isFetchingNextPage&&c.fetchNextPage()},[y,c.hasNextPage,c.isFetchingNextPage]);const D=c.isLoading,M=c.error;return e.jsxs("div",{className:"page",children:[e.jsx("div",{className:"feed-header",children:e.jsxs("div",{children:[e.jsxs("h1",{className:"feed-title",children:["Trending ",e.jsx("em",{children:"Research"})]}),e.jsx("div",{className:"feed-subtitle",children:"Curated daily from arXiv and Hugging Face"})]})}),e.jsxs("div",{className:"layout-with-sidebar",children:[e.jsxs("aside",{className:"sidebar",children:[e.jsxs("div",{className:"sidebar-section",children:[e.jsx("div",{className:"sidebar-label",children:"Top Domains"}),i.isLoading&&e.jsx("div",{style:{display:"flex",flexDirection:"column",gap:8},children:Array.from({length:6}).map((s,t)=>e.jsx(j,{className:"h-5 w-full"},t))}),(b=i.data)==null?void 0:b.map(s=>e.jsxs(N,{to:`/tasks/${s.slug}`,className:"sidebar-link",children:[L(s.name,s.slug),s.paper_count!=null&&e.jsx("span",{className:"count",children:s.paper_count})]},s.id)),e.jsx(N,{to:"/tasks",className:"sidebar-link",style:{marginTop:8,fontStyle:"italic"},children:"all domains →"})]}),e.jsxs("div",{className:"sidebar-section",children:[e.jsx("div",{className:"sidebar-label",children:"Trending Domains"}),x.isLoading&&e.jsx("div",{style:{display:"flex",flexDirection:"column",gap:8},children:Array.from({length:6}).map((s,t)=>e.jsx(j,{className:"h-5 w-full"},t))}),((P=(w=x.data)==null?void 0:w.results)==null?void 0:P.length)===0&&!x.isLoading&&e.jsx("div",{style:{fontSize:12,color:"var(--ink-faint)"},children:"No domains gaining momentum right now."}),(A=(v=x.data)==null?void 0:v.results)==null?void 0:A.map(s=>e.jsxs(N,{to:`/tasks/${s.slug}`,className:"sidebar-link",children:[L(s.name,s.slug),e.jsxs("span",{className:"count",children:[s.share_lift.toFixed(1),"x"]})]},s.id))]})]}),e.jsxs("div",{children:[F()&&e.jsx(de,{}),e.jsxs("div",{className:"sort-bar home-feed-sort-bar",children:[e.jsxs("div",{className:"paper-feed-toolbar-controls",children:[e.jsx("div",{className:"sort-options",children:se.map(([s,t])=>e.jsx("button",{className:`sort-btn ${r===s?"active":""}`,onClick:()=>l(s),children:t},s))}),e.jsx($,{hasCode:n,hasHfArtifacts:u,onHasCodeChange:f,onHasHfArtifactsChange:p})]}),e.jsx("div",{className:"sort-options sort-options-time",children:J.map(s=>e.jsx("button",{className:`sort-btn sort-btn-time ${o===s?"active":""}`,onClick:()=>g(s),children:s},s))})]}),M&&e.jsx(Z,{variant:"destructive",className:"mb-4",children:e.jsx(ee,{children:"Failed to load papers. Please try again."})}),D?e.jsx("div",{className:"paper-list",children:Array.from({length:6}).map((s,t)=>e.jsxs("div",{className:"paper-card",children:[e.jsx("div",{className:"paper-thumb-wrap",children:e.jsx(j,{className:"paper-thumb-skeleton"})}),e.jsxs("div",{className:"paper-body",style:{flex:1,gap:12},children:[e.jsx(j,{className:"h-6 w-3/4"}),e.jsx(j,{className:"h-4 w-1/2"}),e.jsx(j,{className:"h-12 w-full"})]})]},t))}):T.length===0?e.jsx("div",{className:"no-results",children:"No papers in this window."}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"paper-list",children:T.map((s,t)=>e.jsx(q,{paper:s,rank:t+1},s.id))}),e.jsx("div",{ref:k,style:{height:1}}),c.isFetchingNextPage&&e.jsx("div",{style:{padding:"20px 0",textAlign:"center",color:"var(--ink-faint)"},children:"Loading more…"})]})]})]})]})};export{de as AskAssistant,ve as default};
|
assets/{FrameworksIndexView-DcjDYQnp.js → FrameworksIndexView-D4BjBFn-.js}
RENAMED
|
@@ -1 +1 @@
|
|
| 1 |
-
import{u as d,j as e,L as o,R as m,c as p}from"./index-
|
|
|
|
| 1 |
+
import{u as d,j as e,L as o,R as m,c as p}from"./index-Bthypk3Q.js";import{u as h}from"./useQuery-CEDDm0wh.js";import{I as u}from"./components-DR4nXlac.js";import{c as g,h as f}from"./transform-_T5o_x_w.js";import"./LatexTitle-DOmMcoZ0.js";import"./katex.min-BSBacQyE.js";import"./safeExternalHref-CkBrsh84.js";const x={gpu:"GPU",cpu:"CPU",apple:"Apple silicon"},j={display:"flex",alignItems:"baseline",justifyContent:"space-between",gap:24,paddingBottom:12,borderBottom:"1px solid var(--hairline-strong)"},k={fontFamily:"var(--serif)",fontSize:26,fontWeight:500,letterSpacing:"-0.02em",marginBottom:4},_={fontFamily:"var(--serif)",fontStyle:"italic",fontSize:13,color:"var(--ink-soft)"},v={fontFamily:"var(--mono)",fontSize:13,fontWeight:600,letterSpacing:"0.04em",textTransform:"uppercase",color:"var(--ink)",marginBottom:6},b=({platform:r})=>{const n=g(f(r));return e.jsx("span",{className:"framework-platform-chip",style:{background:n.bg,color:n.text},children:x[r]})},w=({framework:r})=>{const n=d(),l=`/papers?framework=${encodeURIComponent(r.slug)}`;return e.jsxs("article",{id:`framework-${r.slug}`,className:"framework-card framework-card-clickable",role:"link",tabIndex:0,"aria-label":`View papers implemented by ${r.name}`,onClick:a=>{a.target.closest("a, button")||n(l)},onKeyDown:a=>{a.target===a.currentTarget&&(a.key==="Enter"||a.key===" ")&&(a.preventDefault(),n(l))},children:[e.jsxs("div",{className:"framework-card-head",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"framework-card-name",children:r.name}),r.organization_name&&e.jsx("div",{className:"framework-card-org",children:r.organization_name})]}),r.platforms&&r.platforms.length>0&&e.jsx("div",{className:"framework-platform-row",children:r.platforms.map(a=>e.jsx(b,{platform:a},a))})]}),e.jsx("p",{className:"framework-card-desc",children:r.description}),r.when_to_use&&e.jsxs("div",{className:"framework-card-when",children:[e.jsx("span",{className:"framework-card-when-label",children:"When to use"}),r.when_to_use]}),(r.github_url||r.docs_url||r.introducing_paper_arxiv_id)&&e.jsxs("div",{className:"framework-card-links",children:[r.introducing_paper_arxiv_id&&e.jsx(o,{to:`/paper/${r.introducing_paper_arxiv_id}`,className:"framework-link",children:"Introducing paper"}),r.github_url&&r.paper_count>0&&e.jsxs(o,{to:l,className:"framework-link",children:["Implements ",r.paper_count," ",r.paper_count===1?"paper":"papers"]}),r.github_url&&r.paper_count===0&&e.jsx("span",{className:"framework-link framework-link-disabled","aria-disabled":"true",children:"Implements 0 papers"}),r.github_url&&e.jsxs("a",{href:r.github_url,target:"_blank",rel:"noopener noreferrer",className:"framework-link",children:[e.jsx(u,{name:"github",size:13}),"GitHub"]}),r.docs_url&&r.docs_url!==r.github_url&&e.jsx("a",{href:r.docs_url,target:"_blank",rel:"noopener noreferrer",className:"framework-link",children:"Docs"})]})]})},B=()=>{var a;const r=h({queryKey:["framework-catalog"],queryFn:()=>p.getFrameworkCatalog()}),n=((a=r.data)==null?void 0:a.domains)??[],l=n.reduce((i,s)=>i+s.categories.reduce((t,c)=>t+c.frameworks.length,0),0);return m.useEffect(()=>{var s;const i=window.location.hash.slice(1);i&&((s=document.getElementById(i))==null||s.scrollIntoView())},[r.data]),e.jsxs("div",{className:"page",children:[e.jsx("div",{className:"feed-header",children:e.jsxs("div",{children:[e.jsxs("h1",{className:"feed-title",children:["AI ",e.jsx("em",{children:"Frameworks"})]}),e.jsx("div",{className:"feed-subtitle",children:"Curated libraries and tools to run, serve, and train models — pick the right stack for your hardware and workload."})]})}),r.isLoading&&e.jsx("div",{className:"empty",children:"Loading frameworks…"}),r.isError&&e.jsx("div",{className:"empty",children:"Could not load frameworks."}),n.map(i=>e.jsxs("section",{style:{marginBottom:56},children:[e.jsxs("div",{style:j,children:[e.jsxs("div",{children:[e.jsx("h2",{style:k,children:i.name}),e.jsx("div",{style:_,children:i.description})]}),e.jsxs("div",{style:{fontFamily:"var(--mono)",fontSize:11,color:"var(--ink-faint)",whiteSpace:"nowrap"},children:[i.categories.length," ",i.categories.length===1?"category":"categories"," ·"," ",i.categories.reduce((s,t)=>s+t.frameworks.length,0)," frameworks"]})]}),i.categories.map(s=>e.jsxs("div",{className:"framework-category",children:[e.jsxs("div",{className:"framework-category-head",children:[e.jsxs("div",{children:[e.jsx("h3",{style:v,children:s.name}),s.description&&e.jsx("p",{className:"framework-category-blurb",children:s.description}),s.guide_url&&e.jsxs("a",{href:s.guide_url,target:"_blank",rel:"noopener noreferrer",className:"framework-guide-link",children:[s.guide_label??"Read guide"," →"]})]}),e.jsxs("div",{className:"framework-category-meta",children:[s.frameworks.length," ",s.frameworks.length===1?"framework":"frameworks"]})]}),e.jsx("div",{className:"framework-grid",children:s.frameworks.map(t=>e.jsx(w,{framework:t},t.slug))})]},s.slug))]},i.slug)),e.jsxs("div",{style:{fontFamily:"var(--mono)",fontSize:11,color:"var(--ink-faint)",marginTop:8},children:[l," frameworks across ",n.length," ",n.length===1?"domain":"domains",". More areas coming soon."]})]})};export{w as FrameworkCard,B as default};
|
assets/{LatexTitle-BJ-ygzw0.js → LatexTitle-DOmMcoZ0.js}
RENAMED
|
@@ -1 +1 @@
|
|
| 1 |
-
import{j as o,r as g}from"./index-
|
|
|
|
| 1 |
+
import{j as o,r as g}from"./index-Bthypk3Q.js";import{k as T}from"./katex.min-BSBacQyE.js";const j=new Set([",",";",":","!"," ","quad","qquad","enspace","thinspace"]),C={a:"á",e:"é",i:"í",o:"ó",u:"ú",y:"ý",A:"Á",E:"É",I:"Í",O:"Ó",U:"Ú",Y:"Ý"},M={a:"à",e:"è",i:"ì",o:"ò",u:"ù",A:"À",E:"È",I:"Ì",O:"Ò",U:"Ù"},_={a:"â",e:"ê",i:"î",o:"ô",u:"û",A:"Â",E:"Ê",I:"Î",O:"Ô",U:"Û"},b={a:"ä",e:"ë",i:"ï",o:"ö",u:"ü",y:"ÿ",A:"Ä",E:"Ë",I:"Ï",O:"Ö",U:"Ü",Y:"Ÿ"},O={"'":C,"`":M,"^":_,'"':b,"~":{n:"ñ",N:"Ñ"}},E={ss:"ß",ae:"æ",AE:"Æ",oe:"œ",OE:"Œ",o:"ø",O:"Ø",l:"ł",L:"Ł"};function S(e,s){var n;return((n=O[e])==null?void 0:n[s])??null}function N(e){const s=[];let n=0,i="";const l=()=>{i&&(s.push({type:"text",content:i}),i="")};for(;n<e.length;){if(e[n]==="$"&&e[n+1]==="$"){l();const t=e.indexOf("$$",n+2);if(t===-1){i+=e.slice(n);break}s.push({type:"display",content:e.slice(n+2,t)}),n=t+2;continue}if(e[n]==="$"){l();const t=e.indexOf("$",n+1);if(t===-1){i+=e.slice(n);break}s.push({type:"inline",content:e.slice(n+1,t)}),n=t+1;continue}i+=e[n],n+=1}return l(),s}function d(e,s){if(e[s]!=="{")return null;let n=0;for(let i=s;i<e.length;i+=1)if(e[i]==="{")n+=1;else if(e[i]==="}"&&(n-=1,n===0))return{content:e.slice(s+1,i),end:i+1};return null}function $(e,s){let n=s+1;if(n>=e.length)return{name:"",end:n};if(!/[a-zA-Z]/.test(e[n]))return{name:e[n],end:n+1};const i=n;for(;n<e.length&&/[a-zA-Z]/.test(e[n]);)n+=1;return{name:e.slice(i,n),end:n}}function w(e,s){const n=e[s];if(n!=="^"&&n!=="_"||s+1>=e.length)return null;if(e[s+1]==="{"){const i=d(e,s+1);return i?{end:i.end}:null}return/[A-Za-z0-9+\-=.]/.test(e[s+1])?{end:s+2}:null}function y(e,s){let n=s;if(e[n]==="\\"){const{name:t,end:a}=$(e,n);if(!t)return null;if(n=a,e[n]==="{"){const f=d(e,n);f&&(n=f.end)}}else if(/[A-Za-z0-9]/.test(e[n])){let t=n+1;for(;t<e.length&&/[A-Za-z0-9]/.test(e[t]);)t+=1;if(e[t]!=="^"&&e[t]!=="_")return null;n=t}else return null;const i=s;let l=0;for(;n<e.length;){const t=w(e,n);if(!t)break;l+=1,n=t.end}return l===0?null:{latex:e.slice(i,n),end:n}}function p(e,s){const n=[];let i=0,l=0;const t=()=>`${s}-${l++}`,a=(f,u)=>f==="strong"?o.jsx("strong",{children:u},t()):o.jsx("em",{children:u},t());for(;i<e.length;){if(e[i]==="\\"){const{name:c,end:L}=$(e,i);if(i=L,E[c]){n.push(E[c]);continue}if(c.length===1&&i<e.length&&/[A-Za-z]/.test(e[i])){const r=S(c,e[i]);if(r){n.push(r),i+=1;continue}}if(c==="c"){const r=d(e,i);if((r==null?void 0:r.content.length)===1){const h={c:"ç",C:"Ç"}[r.content];if(h){n.push(h),i=r.end;continue}}}if(c==="textbf"||c==="mathbf"){const r=d(e,i);if(r){i=r.end,n.push(a("strong",p(r.content,t())));continue}}if(c==="emph"||c==="textit"||c==="textsl"||c==="texttt"){const r=d(e,i);if(r){i=r.end,n.push(a("em",p(r.content,t())));continue}}if(c==="color"||c==="textcolor"){const r=d(e,i);if(r){i=r.end;const h=d(e,i);h&&(i=h.end,n.push(...p(h.content,t())));continue}}if(j.has(c)){n.push(" ");continue}if(c==="~"){n.push(" ");continue}const m=d(e,i);if(m){i=m.end,n.push(...p(m.content,t()));continue}n.push(`\\${c}`);continue}if(e[i]==="~"){n.push(" "),i+=1;continue}const f=y(e,i);if(f){n.push(o.jsx(A,{latex:f.latex,display:!1},t())),i=f.end;continue}let u=i;for(;u<e.length&&e[u]!=="\\"&&e[u]!=="~"&&!y(e,u);)u+=1;u>i&&n.push(e.slice(i,u)),i=u}return n}function A({latex:e,display:s}){const n=g.useMemo(()=>{try{return T.renderToString(e.trim(),{displayMode:s,throwOnError:!1})}catch{return null}},[e,s]);return n?o.jsx("span",{className:s?"katex-display":void 0,dangerouslySetInnerHTML:{__html:n}}):o.jsx(o.Fragment,{children:s?`$$${e}$$`:`$${e}$`})}function k(e){const s=N(e),n=[];return s.forEach((i,l)=>{const t=`latex-${l}`;if(i.type==="text"){const a=p(i.content,t);a.length===1?n.push(a[0]):a.length>1&&n.push(o.jsx(g.Fragment,{children:a},t));return}if(i.type==="display"){n.push(o.jsx(A,{latex:i.content,display:!0},t));return}n.push(o.jsx(A,{latex:i.content,display:!1},t))}),n.length===1?n[0]:o.jsx(o.Fragment,{children:n})}const U=({text:e,className:s=""})=>{const n=g.useMemo(()=>k(e),[e]);return o.jsx("span",{className:s,children:n})},X=({title:e,className:s=""})=>o.jsx(U,{text:e,className:s});export{X as L,U as a};
|
assets/{MarkdownText-P17RUY6h.js → MarkdownText-DX4YTOrq.js}
RENAMED
|
@@ -1 +1 @@
|
|
| 1 |
-
import{Y as l,j as s,L as u}from"./index-
|
|
|
|
| 1 |
+
import{Y as l,j as s,L as u}from"./index-Bthypk3Q.js";import"./katex.min-BSBacQyE.js";import{r as p,a as m,P as h}from"./PaperPreviewLink-DajWspZH.js";import{M as d,r as w}from"./index-SizWVsV-.js";const x=new Set(["paperswithcode.co","www.paperswithcode.co","localhost","127.0.0.1","167.235.148.241"]),P=["/methods","/paper","/papers","/tasks","/benchmark","/conferences"];function f(n,o=window.location.origin){if(!n)return null;let t;if(n.startsWith("/"))t=n;else try{const r=new URL(n,o);if(!x.has(r.hostname))return null;t=`${r.pathname}${r.search}${r.hash}`}catch{return null}const e=t.split(/[?#]/,1)[0];return P.some(r=>e===r||e.startsWith(`${r}/`))?t:null}function k(n){const t=n.split(/[?#]/,1)[0].match(/^\/papers?\/([^/]+)$/);if(!t||t[1].includes("%"))return null;const e=t[1],r=/^\d{4}[.-]\d{4,5}(?:v\d+)?$/.test(e),a=/^[1-9]\d*$/.test(e);return!r&&!a?null:l(e)}const E=({text:n,className:o=""})=>s.jsx("div",{className:o,children:s.jsx(d,{remarkPlugins:[w,m],rehypePlugins:[p],components:{a:({href:t,children:e,node:r,...a})=>{const i=f(t);if(i){const c=k(i);return c?s.jsx(h,{routeId:c,to:i,...a,children:e}):s.jsx(u,{to:i,...a,children:e})}return s.jsx("a",{href:t,target:"_blank",rel:"noopener noreferrer",...a,children:e})}},children:n})});export{E as M};
|
assets/{MethodDetailView-C6ii1PxY.js → MethodDetailView-Deq8NPkc.js}
RENAMED
|
@@ -1 +1 @@
|
|
| 1 |
-
import{j as e,r as L,f as Q,a as U,L as H,c as y,ao as G}from"./index-NKCYgxaj.js";import{u as M}from"./useQuery--AC_S866.js";import{u as W}from"./useInfiniteQuery-CE_Ny-la.js";import{M as Z,P as V}from"./components-DOrpSyhx.js";import{u as X,P as Y}from"./useIntersectionObserver-DF6Xuwk6.js";import{M as R}from"./MarkdownText-P17RUY6h.js";import{s as J}from"./slug-BpH-Nkvz.js";import{t as ee}from"./transform-BdA-spBj.js";import{S as A}from"./skeleton-z_EQ30hh.js";import{A as te,a as se}from"./alert-DdslWjc3.js";import{s as ae}from"./safeExternalHref-CkBrsh84.js";import"./LatexTitle-BJ-ygzw0.js";import"./katex.min-BSBacQyE.js";import"./PaperPreviewLink-syrag20a.js";import"./index-S59lkwkS.js";import"./hover-card-Z7w-9YtT.js";const s={pink:"#F8D7D9",pinkS:"#D9B0B3",yellow:"#FBEFC2",yellowS:"#C9B97D",orange:"#F8D7B3",orangeS:"#C99466",blue:"#CDE2EE",blueS:"#7FA4BA",purple:"#D4D2EA",purpleS:"#8E8AC0",green:"#CCE2C5",greenS:"#7DA475",ink:"#1A1814",faint:"#8E8678"},j=({x:t,y:a,w:o,h:l,fill:f,stroke:u,label:x,fontSize:d=10,multiline:_})=>e.jsxs("g",{children:[e.jsx("rect",{x:t,y:a,width:o,height:l,rx:"3",ry:"3",fill:f,stroke:u,strokeWidth:"1"}),_?e.jsxs(e.Fragment,{children:[e.jsx("text",{x:t+o/2,y:a+l/2-2,fontSize:d,fontFamily:"var(--sans)",fill:s.ink,textAnchor:"middle",dominantBaseline:"middle",children:_[0]}),e.jsx("text",{x:t+o/2,y:a+l/2+d-1,fontSize:d,fontFamily:"var(--sans)",fill:s.ink,textAnchor:"middle",dominantBaseline:"middle",children:_[1]})]}):e.jsx("text",{x:t+o/2,y:a+l/2,fontSize:d,fontFamily:"var(--sans)",fill:s.ink,textAnchor:"middle",dominantBaseline:"middle",children:x})]}),re=()=>e.jsxs("svg",{viewBox:"0 0 360 420",width:"100%",height:"100%",style:{display:"block"},children:[e.jsx("text",{x:"180",y:"20",fontSize:"11",fontFamily:"var(--serif)",fontStyle:"italic",fill:s.faint,textAnchor:"middle",children:"Scaled Dot-Product Attention"}),e.jsx(j,{x:140,y:40,w:80,h:26,fill:s.yellow,stroke:s.yellowS,label:"MatMul",fontSize:11}),e.jsx("path",{d:"M180 66 L180 80",stroke:s.ink}),e.jsx(j,{x:140,y:80,w:80,h:26,fill:s.green,stroke:s.greenS,label:"SoftMax",fontSize:11}),e.jsx("path",{d:"M180 106 L180 120",stroke:s.ink}),e.jsx(j,{x:140,y:120,w:80,h:26,fill:s.purple,stroke:s.purpleS,label:"Mask (opt.)",fontSize:11}),e.jsx("path",{d:"M180 146 L180 160",stroke:s.ink}),e.jsx(j,{x:140,y:160,w:80,h:26,fill:s.blue,stroke:s.blueS,label:"Scale ÷√dₖ",fontSize:11}),e.jsx("path",{d:"M180 186 L180 200",stroke:s.ink}),e.jsx(j,{x:140,y:200,w:80,h:26,fill:s.yellow,stroke:s.yellowS,label:"MatMul",fontSize:11}),e.jsx("path",{d:"M156 226 L120 270",stroke:s.ink}),e.jsx("path",{d:"M180 226 L180 270",stroke:s.ink}),e.jsx("path",{d:"M204 226 L240 270",stroke:s.ink}),e.jsx(j,{x:100,y:270,w:40,h:24,fill:s.pink,stroke:s.pinkS,label:"Q",fontSize:13}),e.jsx(j,{x:160,y:270,w:40,h:24,fill:s.pink,stroke:s.pinkS,label:"K",fontSize:13}),e.jsx(j,{x:220,y:270,w:40,h:24,fill:s.pink,stroke:s.pinkS,label:"V",fontSize:13}),e.jsxs("text",{x:"180",y:"330",fontSize:"14",fontFamily:"var(--serif)",fontStyle:"italic",fill:s.ink,textAnchor:"middle",children:["softmax(QK",e.jsx("tspan",{fontSize:"9",baselineShift:"super",children:"⊤"})," / √d) V"]})]}),ne=[["my-skill/",""],["├── SKILL.md","# Required: metadata + instructions"],["├── scripts/","# Optional: executable code"],["├── references/","# Optional: documentation"],["├── assets/","# Optional: templates, resources"],["└── ...","# Any additional files or directories"]],ie=()=>e.jsxs("svg",{viewBox:"0 0 360 420",width:"100%",height:"100%",style:{display:"block"},children:[e.jsx("text",{x:"180",y:"20",fontSize:"11",fontFamily:"var(--serif)",fontStyle:"italic",fill:s.faint,textAnchor:"middle",children:"Skill package layout"}),e.jsx("rect",{x:"28",y:"48",width:"304",height:"318",rx:"8",fill:"#FFFDF8",stroke:s.faint,strokeWidth:"1"}),ne.map(([t,a],o)=>{const l=92+o*44;return e.jsxs("g",{children:[e.jsx("text",{x:"44",y:l,fontSize:"11",fontFamily:"var(--mono)",fill:s.ink,dominantBaseline:"middle",children:t}),a?e.jsx("text",{x:"138",y:l,fontSize:"8.5",fontFamily:"var(--mono)",fill:s.faint,dominantBaseline:"middle",children:a}):null]},t)})]}),le={attention:re,"agent-skills":ie},oe=({method:t})=>e.jsxs("svg",{viewBox:"0 0 360 420",width:"100%",height:"100%",children:[e.jsx("text",{x:"180",y:"20",fontSize:"11",fontFamily:"var(--serif)",fontStyle:"italic",fill:s.faint,textAnchor:"middle",children:t.name||"method"}),e.jsx(j,{x:80,y:70,w:200,h:50,fill:s.blue,stroke:s.blueS,label:"Input",fontSize:12}),e.jsx("path",{d:"M180 120 L180 150",stroke:s.ink}),e.jsx(j,{x:80,y:150,w:200,h:70,fill:s.orange,stroke:s.orangeS,label:t.name||"transform",fontSize:13}),e.jsx("path",{d:"M180 220 L180 250",stroke:s.ink}),e.jsx(j,{x:80,y:250,w:200,h:50,fill:s.purple,stroke:s.purpleS,label:"Output",fontSize:12})]}),de=({method:t})=>{const a=(t.slug||"").toLowerCase(),o=le[a];if(o)return e.jsx("div",{className:"method-figure-svg method-figure-svg--schematic",children:e.jsx(o,{})});if(t.image_url){const l=a==="transformer"||a==="gpt-4"||a==="gpt-4o"||a==="multi-head-attention"?" method-figure-svg--compact":a==="rpn"?" method-figure-svg--scaled-80":"";return e.jsx("div",{className:`method-figure-svg method-figure-svg--image${l}`,children:e.jsx("img",{className:"method-figure-img",src:t.image_url,alt:`${t.name} figure`})})}return e.jsx("div",{className:"method-figure-svg method-figure-svg--schematic",children:e.jsx(oe,{method:t})})},D=720,E=138,g={top:8,right:10,bottom:25,left:36},q=56,ce=new Intl.DateTimeFormat("en",{month:"short",year:"2-digit",timeZone:"UTC"}),me=new Intl.DateTimeFormat("en",{year:"numeric",timeZone:"UTC"}),T=t=>ce.format(new Date(`${t}T00:00:00Z`)),he=(t,a)=>{if(t===0)return new Set;const o=t>48?12:t>36?6:t>18?3:2,l=Math.max(1,Math.ceil(q/a)),f=Math.max(o,l),u=t-1,x=new Set([0,u]);for(let d=f;d<u;d+=f)(u-d)*a>=q&&x.add(d);return x},O=t=>{if(t.coverage_status===void 0||["complete","not_applicable"].includes(t.coverage_status))return null;const a=t.processed_paper_count!==void 0&&t.eligible_paper_count!==void 0?`; ${t.processed_paper_count.toLocaleString()} of ${t.eligible_paper_count.toLocaleString()} eligible papers processed`:"";return`Historical tagging ${t.coverage_status==="failed"?"needs retry":"in progress"}${a}`},pe=({history:t,methodName:a})=>{const[o,l]=L.useState(null),f=Math.max(1,...t.map(r=>r.paper_count)),u=D-g.left-g.right,x=E-g.top-g.bottom,d=t.length?u/t.length:u,_=Math.max(2,d*.68),c=he(t.length,d),P=Array.from(new Set([0,Math.ceil(f/2),f])),m=o==null?null:t[o],v=m?O(m):null;return e.jsxs("div",{className:"method-usage-chart-wrap",children:[e.jsxs("svg",{className:"method-usage-chart",viewBox:`0 0 ${D} ${E}`,role:"group","aria-label":`${a}: papers mentioning this method by publication month`,children:[e.jsxs("title",{children:[a,": papers mentioning this method by publication month"]}),P.map(r=>{const p=g.top+x-r/f*x;return e.jsxs("g",{children:[e.jsx("line",{className:"method-usage-gridline",x1:g.left,x2:D-g.right,y1:p,y2:p}),e.jsx("text",{className:"method-usage-y-label",x:g.left-8,y:p+3,textAnchor:"end",children:r})]},r)}),t.map((r,p)=>{const S=r.paper_count/f*x,b=r.paper_count>0?Math.max(1,S):0,w=g.left+d*p+(d-_)/2,n=g.top+x-b,N=o===p,F=p===t.length-1,k=O(r);return e.jsxs("g",{className:`method-usage-bar${N?" is-active":""}${F?" is-current":""}`,tabIndex:0,role:"img","aria-label":`${T(r.start_date)}: ${r.paper_count} ${r.paper_count===1?"paper":"papers"}${k?`. ${k}`:""}`,onMouseEnter:()=>l(p),onMouseLeave:()=>l(null),onFocus:()=>l(p),onBlur:()=>l(null),children:[e.jsx("rect",{className:"method-usage-bar-hit",x:g.left+d*p,y:g.top,width:d,height:x}),e.jsx("rect",{className:"method-usage-bar-mark",x:w,y:n,width:_,height:b,rx:"1.5"})]},r.start_date)}),t.map((r,p)=>c.has(p)?e.jsx("text",{className:"method-usage-x-label",x:g.left+d*(p+.5),y:E-11,textAnchor:"middle",children:t.length>48?me.format(new Date(`${r.start_date}T00:00:00Z`)):T(r.start_date)},r.start_date):null)]}),m&&e.jsxs("div",{className:"method-usage-tooltip",role:"status",children:[e.jsx("strong",{children:T(m.start_date)}),e.jsxs("span",{children:[m.paper_count," ",m.paper_count===1?"paper":"papers",o===t.length-1?" · month to date":""]}),e.jsxs("span",{children:[(m.catalog_share??0).toFixed(2),"% of"," ",(m.catalog_paper_count??0).toLocaleString()," catalog papers"]}),v&&e.jsx("span",{children:v})]})]})},xe=[["trending","trending"],["new","newest"],["cited","most cited"]],K={"on-policy-distillation":["fine-tuning","post-training","rlvr","rlhf","direct-preference-optimization-dpo"],mcp:["agent-skills"],"agent-skills":["mcp"]},Pe=()=>{var F,k,B,I,z,$;const{methodSlug:t}=Q(),[a,o]=U(),[l,f]=L.useState("trending"),u=a.get("has_code")==="true",x=a.get("has_hf_artifacts")==="true",d=i=>{const h=new URLSearchParams(a);i?h.set("has_code","true"):h.delete("has_code"),o(h)},_=i=>{const h=new URLSearchParams(a);i?h.set("has_hf_artifacts","true"):h.delete("has_hf_artifacts"),o(h)},c=M({queryKey:["method",t],queryFn:()=>y.getMethod(t),enabled:!!t,staleTime:10*60*1e3}),P=M({queryKey:["areas-all"],queryFn:()=>y.getAreas({page_size:50,ordering:"name"}),enabled:!!((F=c.data)!=null&&F.area_id),staleTime:10*60*1e3}),m=M({queryKey:["method-trend",t],queryFn:()=>y.getMethodTrend(t),enabled:!!t&&!!c.data,staleTime:10*60*1e3}),v=l==="trending"?"trending":l==="cited"?"citation_count":"date_published",r=W({queryKey:["method-papers-infinite",t,v,u,x],queryFn:({pageParam:i=1})=>y.getMethodPapers(t,{page:i,page_size:20,order_by:v,order_dir:"desc",include_resources:!0,has_code:u,has_hf_artifacts:x}),getNextPageParam:i=>i.next_page,initialPageParam:1,enabled:!!t,staleTime:5*60*1e3,placeholderData:G}),p=M({queryKey:["related-methods",(k=c.data)==null?void 0:k.slug,(B=c.data)==null?void 0:B.area_id,(I=c.data)==null?void 0:I.id],queryFn:async()=>{const i=K[c.data.slug];return i?Promise.all(i.map(C=>y.getMethod(C))):(await y.getMethods({area_id:c.data.area_id,exclude_id:c.data.id,ordering:"-paper_count",page_size:8})).results},enabled:!!c.data&&(!!K[c.data.slug]||!!c.data.area_id),staleTime:10*60*1e3}),S=L.useMemo(()=>{var h;return(((h=r.data)==null?void 0:h.pages.flatMap(C=>C.results))||[]).map(ee)},[r.data]),{targetRef:b,isIntersecting:w}=X({rootMargin:"200px"});if(L.useEffect(()=>{w&&r.hasNextPage&&!r.isFetchingNextPage&&r.fetchNextPage()},[w,r.hasNextPage,r.isFetchingNextPage]),c.isLoading)return e.jsxs("div",{className:"page",children:[e.jsx(A,{className:"h-12 w-1/2 mb-4"}),e.jsx(A,{className:"h-64 w-full"})]});if(c.error||!c.data)return e.jsx("div",{className:"page",children:e.jsx(te,{variant:"destructive",children:e.jsx(se,{children:"Method not found."})})});const n=c.data,N=(z=P.data)==null?void 0:z.results.find(i=>i.id===n.area_id);return e.jsxs("div",{className:"page",children:[e.jsxs("div",{className:"breadcrumb",children:[e.jsx(H,{to:"/methods",children:"Methods"}),N&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"sep",children:"/"}),e.jsx(H,{to:`/methods#area-${J(N.name)}`,children:N.name})]}),e.jsx("span",{className:"sep",children:"/"}),e.jsx("span",{style:{color:"var(--ink)"},children:n.name})]}),e.jsxs("div",{className:`tag-hero method-hero-grid${n.slug==="grokking"||n.slug==="latent-reasoning"?" method-hero-grid--wide-figure":""}`,children:[e.jsxs("div",{children:[e.jsx("div",{className:"tag-hero-eyebrow",children:"METHOD"}),e.jsx("h1",{className:"tag-hero-title method-hero-title",children:n.name}),n.full_name&&n.full_name!==n.name&&e.jsx("div",{style:{fontFamily:"var(--serif)",fontSize:16,fontStyle:"italic",color:"var(--ink-soft)",marginTop:8},children:n.full_name}),n.description&&e.jsx(R,{className:"method-description",text:n.description}),n.source_url&&n.source_title&&e.jsxs("div",{className:"method-source",children:[e.jsx("span",{className:"method-source-label",children:"Source"}),e.jsxs("a",{className:"method-source-link",href:ae(n.source_url)??void 0,target:"_blank",rel:"noopener noreferrer",children:[e.jsx("span",{className:"method-source-title",children:n.source_title}),n.introduced_year&&e.jsx("span",{className:"method-source-meta",children:n.introduced_year})]})]}),e.jsxs("div",{className:"tag-hero-meta",children:[e.jsxs("div",{className:"stat",children:[e.jsx("span",{className:"label",children:"Papers mentioning"}),e.jsx("span",{className:"value",children:(n.paper_count??0).toLocaleString()})]}),m.data&&e.jsxs("div",{className:"stat",children:[e.jsx("span",{className:"label",children:"Recent mentions"}),e.jsx("span",{className:"value",children:m.data.comparison_complete?e.jsxs(e.Fragment,{children:[m.data.trend_score.toFixed(1),e.jsx("small",{children:"/mo"})]}):"Pending"})]}),n.introduced_year!=null&&e.jsxs("div",{className:"stat",children:[e.jsx("span",{className:"label",children:"Introduced"}),e.jsx("span",{className:"value",children:n.introduced_year})]})]}),m.isLoading?e.jsx(A,{className:"h-36 w-full method-trend-skeleton"}):m.data?e.jsxs("section",{className:"method-trend-panel method-trend-panel--compact",children:[e.jsxs("div",{className:"method-trend-header",children:[e.jsx("div",{children:e.jsx("div",{className:"method-trend-eyebrow",children:"Usage trend"})}),e.jsxs("div",{className:"method-trend-summary",children:[e.jsx("strong",{children:m.data.recent_paper_count}),e.jsxs("span",{children:["papers / ",m.data.recent_days,"d"]})]})]}),e.jsx(pe,{history:m.data.history,methodName:n.name})]}):null]}),e.jsxs("figure",{className:"method-figure-card",children:[e.jsx(de,{method:n}),n.image_credit&&e.jsx("figcaption",{children:e.jsx(R,{className:"method-image-credit",text:n.image_credit})})]})]}),((($=p.data)==null?void 0:$.length)??0)>0&&e.jsxs("div",{className:"filter-row",children:[e.jsx("span",{className:"label",children:"Related methods"}),p.data.map(i=>e.jsx(Z,{method:{slug:i.slug,name:i.name}},i.id))]}),e.jsxs("div",{className:"sort-bar",children:[e.jsxs("div",{className:"paper-feed-toolbar-controls",children:[e.jsx("div",{className:"sort-options",children:xe.map(([i,h])=>e.jsx("button",{className:`sort-btn ${l===i?"active":""}`,onClick:()=>f(i),children:h},i))}),e.jsx(Y,{hasCode:u,hasHfArtifacts:x,onHasCodeChange:d,onHasHfArtifactsChange:_})]}),e.jsxs("div",{className:"results-count",children:[S.length," papers mentioning ",n.name]})]}),r.isLoading?e.jsx("div",{className:"paper-list",children:Array.from({length:4}).map((i,h)=>e.jsx(A,{className:"h-40 w-full"},h))}):S.length===0?e.jsx("div",{className:"no-results",children:"No papers tagged with this method yet."}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"paper-list",children:S.map((i,h)=>e.jsx(V,{paper:i,rank:h+1},i.id))}),e.jsx("div",{ref:b,style:{height:1}}),r.isFetchingNextPage&&e.jsx("div",{style:{padding:"20px 0",textAlign:"center",color:"var(--ink-faint)"},children:"Loading more…"})]})]})};export{Pe as default};
|
|
|
|
| 1 |
+
import{j as e,r as L,f as Q,a as U,L as H,c as y,ao as G}from"./index-Bthypk3Q.js";import{u as M}from"./useQuery-CEDDm0wh.js";import{u as W}from"./useInfiniteQuery-KqL5cNCq.js";import{M as Z,P as V}from"./components-DR4nXlac.js";import{u as X,P as Y}from"./useIntersectionObserver-BrrNIU67.js";import{M as R}from"./MarkdownText-DX4YTOrq.js";import{s as J}from"./slug-BpH-Nkvz.js";import{t as ee}from"./transform-_T5o_x_w.js";import{S as A}from"./skeleton-BS-Px_iI.js";import{A as te,a as se}from"./alert-DJmmSiqi.js";import{s as ae}from"./safeExternalHref-CkBrsh84.js";import"./LatexTitle-DOmMcoZ0.js";import"./katex.min-BSBacQyE.js";import"./PaperPreviewLink-DajWspZH.js";import"./index-SizWVsV-.js";import"./hover-card-Dy9hZi_x.js";const s={pink:"#F8D7D9",pinkS:"#D9B0B3",yellow:"#FBEFC2",yellowS:"#C9B97D",orange:"#F8D7B3",orangeS:"#C99466",blue:"#CDE2EE",blueS:"#7FA4BA",purple:"#D4D2EA",purpleS:"#8E8AC0",green:"#CCE2C5",greenS:"#7DA475",ink:"#1A1814",faint:"#8E8678"},j=({x:t,y:a,w:o,h:l,fill:f,stroke:u,label:x,fontSize:d=10,multiline:_})=>e.jsxs("g",{children:[e.jsx("rect",{x:t,y:a,width:o,height:l,rx:"3",ry:"3",fill:f,stroke:u,strokeWidth:"1"}),_?e.jsxs(e.Fragment,{children:[e.jsx("text",{x:t+o/2,y:a+l/2-2,fontSize:d,fontFamily:"var(--sans)",fill:s.ink,textAnchor:"middle",dominantBaseline:"middle",children:_[0]}),e.jsx("text",{x:t+o/2,y:a+l/2+d-1,fontSize:d,fontFamily:"var(--sans)",fill:s.ink,textAnchor:"middle",dominantBaseline:"middle",children:_[1]})]}):e.jsx("text",{x:t+o/2,y:a+l/2,fontSize:d,fontFamily:"var(--sans)",fill:s.ink,textAnchor:"middle",dominantBaseline:"middle",children:x})]}),re=()=>e.jsxs("svg",{viewBox:"0 0 360 420",width:"100%",height:"100%",style:{display:"block"},children:[e.jsx("text",{x:"180",y:"20",fontSize:"11",fontFamily:"var(--serif)",fontStyle:"italic",fill:s.faint,textAnchor:"middle",children:"Scaled Dot-Product Attention"}),e.jsx(j,{x:140,y:40,w:80,h:26,fill:s.yellow,stroke:s.yellowS,label:"MatMul",fontSize:11}),e.jsx("path",{d:"M180 66 L180 80",stroke:s.ink}),e.jsx(j,{x:140,y:80,w:80,h:26,fill:s.green,stroke:s.greenS,label:"SoftMax",fontSize:11}),e.jsx("path",{d:"M180 106 L180 120",stroke:s.ink}),e.jsx(j,{x:140,y:120,w:80,h:26,fill:s.purple,stroke:s.purpleS,label:"Mask (opt.)",fontSize:11}),e.jsx("path",{d:"M180 146 L180 160",stroke:s.ink}),e.jsx(j,{x:140,y:160,w:80,h:26,fill:s.blue,stroke:s.blueS,label:"Scale ÷√dₖ",fontSize:11}),e.jsx("path",{d:"M180 186 L180 200",stroke:s.ink}),e.jsx(j,{x:140,y:200,w:80,h:26,fill:s.yellow,stroke:s.yellowS,label:"MatMul",fontSize:11}),e.jsx("path",{d:"M156 226 L120 270",stroke:s.ink}),e.jsx("path",{d:"M180 226 L180 270",stroke:s.ink}),e.jsx("path",{d:"M204 226 L240 270",stroke:s.ink}),e.jsx(j,{x:100,y:270,w:40,h:24,fill:s.pink,stroke:s.pinkS,label:"Q",fontSize:13}),e.jsx(j,{x:160,y:270,w:40,h:24,fill:s.pink,stroke:s.pinkS,label:"K",fontSize:13}),e.jsx(j,{x:220,y:270,w:40,h:24,fill:s.pink,stroke:s.pinkS,label:"V",fontSize:13}),e.jsxs("text",{x:"180",y:"330",fontSize:"14",fontFamily:"var(--serif)",fontStyle:"italic",fill:s.ink,textAnchor:"middle",children:["softmax(QK",e.jsx("tspan",{fontSize:"9",baselineShift:"super",children:"⊤"})," / √d) V"]})]}),ne=[["my-skill/",""],["├── SKILL.md","# Required: metadata + instructions"],["├── scripts/","# Optional: executable code"],["├── references/","# Optional: documentation"],["├── assets/","# Optional: templates, resources"],["└── ...","# Any additional files or directories"]],ie=()=>e.jsxs("svg",{viewBox:"0 0 360 420",width:"100%",height:"100%",style:{display:"block"},children:[e.jsx("text",{x:"180",y:"20",fontSize:"11",fontFamily:"var(--serif)",fontStyle:"italic",fill:s.faint,textAnchor:"middle",children:"Skill package layout"}),e.jsx("rect",{x:"28",y:"48",width:"304",height:"318",rx:"8",fill:"#FFFDF8",stroke:s.faint,strokeWidth:"1"}),ne.map(([t,a],o)=>{const l=92+o*44;return e.jsxs("g",{children:[e.jsx("text",{x:"44",y:l,fontSize:"11",fontFamily:"var(--mono)",fill:s.ink,dominantBaseline:"middle",children:t}),a?e.jsx("text",{x:"138",y:l,fontSize:"8.5",fontFamily:"var(--mono)",fill:s.faint,dominantBaseline:"middle",children:a}):null]},t)})]}),le={attention:re,"agent-skills":ie},oe=({method:t})=>e.jsxs("svg",{viewBox:"0 0 360 420",width:"100%",height:"100%",children:[e.jsx("text",{x:"180",y:"20",fontSize:"11",fontFamily:"var(--serif)",fontStyle:"italic",fill:s.faint,textAnchor:"middle",children:t.name||"method"}),e.jsx(j,{x:80,y:70,w:200,h:50,fill:s.blue,stroke:s.blueS,label:"Input",fontSize:12}),e.jsx("path",{d:"M180 120 L180 150",stroke:s.ink}),e.jsx(j,{x:80,y:150,w:200,h:70,fill:s.orange,stroke:s.orangeS,label:t.name||"transform",fontSize:13}),e.jsx("path",{d:"M180 220 L180 250",stroke:s.ink}),e.jsx(j,{x:80,y:250,w:200,h:50,fill:s.purple,stroke:s.purpleS,label:"Output",fontSize:12})]}),de=({method:t})=>{const a=(t.slug||"").toLowerCase(),o=le[a];if(o)return e.jsx("div",{className:"method-figure-svg method-figure-svg--schematic",children:e.jsx(o,{})});if(t.image_url){const l=a==="transformer"||a==="gpt-4"||a==="gpt-4o"||a==="multi-head-attention"?" method-figure-svg--compact":a==="rpn"?" method-figure-svg--scaled-80":"";return e.jsx("div",{className:`method-figure-svg method-figure-svg--image${l}`,children:e.jsx("img",{className:"method-figure-img",src:t.image_url,alt:`${t.name} figure`})})}return e.jsx("div",{className:"method-figure-svg method-figure-svg--schematic",children:e.jsx(oe,{method:t})})},D=720,E=138,g={top:8,right:10,bottom:25,left:36},q=56,ce=new Intl.DateTimeFormat("en",{month:"short",year:"2-digit",timeZone:"UTC"}),me=new Intl.DateTimeFormat("en",{year:"numeric",timeZone:"UTC"}),T=t=>ce.format(new Date(`${t}T00:00:00Z`)),he=(t,a)=>{if(t===0)return new Set;const o=t>48?12:t>36?6:t>18?3:2,l=Math.max(1,Math.ceil(q/a)),f=Math.max(o,l),u=t-1,x=new Set([0,u]);for(let d=f;d<u;d+=f)(u-d)*a>=q&&x.add(d);return x},O=t=>{if(t.coverage_status===void 0||["complete","not_applicable"].includes(t.coverage_status))return null;const a=t.processed_paper_count!==void 0&&t.eligible_paper_count!==void 0?`; ${t.processed_paper_count.toLocaleString()} of ${t.eligible_paper_count.toLocaleString()} eligible papers processed`:"";return`Historical tagging ${t.coverage_status==="failed"?"needs retry":"in progress"}${a}`},pe=({history:t,methodName:a})=>{const[o,l]=L.useState(null),f=Math.max(1,...t.map(r=>r.paper_count)),u=D-g.left-g.right,x=E-g.top-g.bottom,d=t.length?u/t.length:u,_=Math.max(2,d*.68),c=he(t.length,d),P=Array.from(new Set([0,Math.ceil(f/2),f])),m=o==null?null:t[o],v=m?O(m):null;return e.jsxs("div",{className:"method-usage-chart-wrap",children:[e.jsxs("svg",{className:"method-usage-chart",viewBox:`0 0 ${D} ${E}`,role:"group","aria-label":`${a}: papers mentioning this method by publication month`,children:[e.jsxs("title",{children:[a,": papers mentioning this method by publication month"]}),P.map(r=>{const p=g.top+x-r/f*x;return e.jsxs("g",{children:[e.jsx("line",{className:"method-usage-gridline",x1:g.left,x2:D-g.right,y1:p,y2:p}),e.jsx("text",{className:"method-usage-y-label",x:g.left-8,y:p+3,textAnchor:"end",children:r})]},r)}),t.map((r,p)=>{const S=r.paper_count/f*x,b=r.paper_count>0?Math.max(1,S):0,w=g.left+d*p+(d-_)/2,n=g.top+x-b,N=o===p,F=p===t.length-1,k=O(r);return e.jsxs("g",{className:`method-usage-bar${N?" is-active":""}${F?" is-current":""}`,tabIndex:0,role:"img","aria-label":`${T(r.start_date)}: ${r.paper_count} ${r.paper_count===1?"paper":"papers"}${k?`. ${k}`:""}`,onMouseEnter:()=>l(p),onMouseLeave:()=>l(null),onFocus:()=>l(p),onBlur:()=>l(null),children:[e.jsx("rect",{className:"method-usage-bar-hit",x:g.left+d*p,y:g.top,width:d,height:x}),e.jsx("rect",{className:"method-usage-bar-mark",x:w,y:n,width:_,height:b,rx:"1.5"})]},r.start_date)}),t.map((r,p)=>c.has(p)?e.jsx("text",{className:"method-usage-x-label",x:g.left+d*(p+.5),y:E-11,textAnchor:"middle",children:t.length>48?me.format(new Date(`${r.start_date}T00:00:00Z`)):T(r.start_date)},r.start_date):null)]}),m&&e.jsxs("div",{className:"method-usage-tooltip",role:"status",children:[e.jsx("strong",{children:T(m.start_date)}),e.jsxs("span",{children:[m.paper_count," ",m.paper_count===1?"paper":"papers",o===t.length-1?" · month to date":""]}),e.jsxs("span",{children:[(m.catalog_share??0).toFixed(2),"% of"," ",(m.catalog_paper_count??0).toLocaleString()," catalog papers"]}),v&&e.jsx("span",{children:v})]})]})},xe=[["trending","trending"],["new","newest"],["cited","most cited"]],K={"on-policy-distillation":["fine-tuning","post-training","rlvr","rlhf","direct-preference-optimization-dpo"],mcp:["agent-skills"],"agent-skills":["mcp"]},Pe=()=>{var F,k,B,I,z,$;const{methodSlug:t}=Q(),[a,o]=U(),[l,f]=L.useState("trending"),u=a.get("has_code")==="true",x=a.get("has_hf_artifacts")==="true",d=i=>{const h=new URLSearchParams(a);i?h.set("has_code","true"):h.delete("has_code"),o(h)},_=i=>{const h=new URLSearchParams(a);i?h.set("has_hf_artifacts","true"):h.delete("has_hf_artifacts"),o(h)},c=M({queryKey:["method",t],queryFn:()=>y.getMethod(t),enabled:!!t,staleTime:10*60*1e3}),P=M({queryKey:["areas-all"],queryFn:()=>y.getAreas({page_size:50,ordering:"name"}),enabled:!!((F=c.data)!=null&&F.area_id),staleTime:10*60*1e3}),m=M({queryKey:["method-trend",t],queryFn:()=>y.getMethodTrend(t),enabled:!!t&&!!c.data,staleTime:10*60*1e3}),v=l==="trending"?"trending":l==="cited"?"citation_count":"date_published",r=W({queryKey:["method-papers-infinite",t,v,u,x],queryFn:({pageParam:i=1})=>y.getMethodPapers(t,{page:i,page_size:20,order_by:v,order_dir:"desc",include_resources:!0,has_code:u,has_hf_artifacts:x}),getNextPageParam:i=>i.next_page,initialPageParam:1,enabled:!!t,staleTime:5*60*1e3,placeholderData:G}),p=M({queryKey:["related-methods",(k=c.data)==null?void 0:k.slug,(B=c.data)==null?void 0:B.area_id,(I=c.data)==null?void 0:I.id],queryFn:async()=>{const i=K[c.data.slug];return i?Promise.all(i.map(C=>y.getMethod(C))):(await y.getMethods({area_id:c.data.area_id,exclude_id:c.data.id,ordering:"-paper_count",page_size:8})).results},enabled:!!c.data&&(!!K[c.data.slug]||!!c.data.area_id),staleTime:10*60*1e3}),S=L.useMemo(()=>{var h;return(((h=r.data)==null?void 0:h.pages.flatMap(C=>C.results))||[]).map(ee)},[r.data]),{targetRef:b,isIntersecting:w}=X({rootMargin:"200px"});if(L.useEffect(()=>{w&&r.hasNextPage&&!r.isFetchingNextPage&&r.fetchNextPage()},[w,r.hasNextPage,r.isFetchingNextPage]),c.isLoading)return e.jsxs("div",{className:"page",children:[e.jsx(A,{className:"h-12 w-1/2 mb-4"}),e.jsx(A,{className:"h-64 w-full"})]});if(c.error||!c.data)return e.jsx("div",{className:"page",children:e.jsx(te,{variant:"destructive",children:e.jsx(se,{children:"Method not found."})})});const n=c.data,N=(z=P.data)==null?void 0:z.results.find(i=>i.id===n.area_id);return e.jsxs("div",{className:"page",children:[e.jsxs("div",{className:"breadcrumb",children:[e.jsx(H,{to:"/methods",children:"Methods"}),N&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"sep",children:"/"}),e.jsx(H,{to:`/methods#area-${J(N.name)}`,children:N.name})]}),e.jsx("span",{className:"sep",children:"/"}),e.jsx("span",{style:{color:"var(--ink)"},children:n.name})]}),e.jsxs("div",{className:`tag-hero method-hero-grid${n.slug==="grokking"||n.slug==="latent-reasoning"?" method-hero-grid--wide-figure":""}`,children:[e.jsxs("div",{children:[e.jsx("div",{className:"tag-hero-eyebrow",children:"METHOD"}),e.jsx("h1",{className:"tag-hero-title method-hero-title",children:n.name}),n.full_name&&n.full_name!==n.name&&e.jsx("div",{style:{fontFamily:"var(--serif)",fontSize:16,fontStyle:"italic",color:"var(--ink-soft)",marginTop:8},children:n.full_name}),n.description&&e.jsx(R,{className:"method-description",text:n.description}),n.source_url&&n.source_title&&e.jsxs("div",{className:"method-source",children:[e.jsx("span",{className:"method-source-label",children:"Source"}),e.jsxs("a",{className:"method-source-link",href:ae(n.source_url)??void 0,target:"_blank",rel:"noopener noreferrer",children:[e.jsx("span",{className:"method-source-title",children:n.source_title}),n.introduced_year&&e.jsx("span",{className:"method-source-meta",children:n.introduced_year})]})]}),e.jsxs("div",{className:"tag-hero-meta",children:[e.jsxs("div",{className:"stat",children:[e.jsx("span",{className:"label",children:"Papers mentioning"}),e.jsx("span",{className:"value",children:(n.paper_count??0).toLocaleString()})]}),m.data&&e.jsxs("div",{className:"stat",children:[e.jsx("span",{className:"label",children:"Recent mentions"}),e.jsx("span",{className:"value",children:m.data.comparison_complete?e.jsxs(e.Fragment,{children:[m.data.trend_score.toFixed(1),e.jsx("small",{children:"/mo"})]}):"Pending"})]}),n.introduced_year!=null&&e.jsxs("div",{className:"stat",children:[e.jsx("span",{className:"label",children:"Introduced"}),e.jsx("span",{className:"value",children:n.introduced_year})]})]}),m.isLoading?e.jsx(A,{className:"h-36 w-full method-trend-skeleton"}):m.data?e.jsxs("section",{className:"method-trend-panel method-trend-panel--compact",children:[e.jsxs("div",{className:"method-trend-header",children:[e.jsx("div",{children:e.jsx("div",{className:"method-trend-eyebrow",children:"Usage trend"})}),e.jsxs("div",{className:"method-trend-summary",children:[e.jsx("strong",{children:m.data.recent_paper_count}),e.jsxs("span",{children:["papers / ",m.data.recent_days,"d"]})]})]}),e.jsx(pe,{history:m.data.history,methodName:n.name})]}):null]}),e.jsxs("figure",{className:"method-figure-card",children:[e.jsx(de,{method:n}),n.image_credit&&e.jsx("figcaption",{children:e.jsx(R,{className:"method-image-credit",text:n.image_credit})})]})]}),((($=p.data)==null?void 0:$.length)??0)>0&&e.jsxs("div",{className:"filter-row",children:[e.jsx("span",{className:"label",children:"Related methods"}),p.data.map(i=>e.jsx(Z,{method:{slug:i.slug,name:i.name}},i.id))]}),e.jsxs("div",{className:"sort-bar",children:[e.jsxs("div",{className:"paper-feed-toolbar-controls",children:[e.jsx("div",{className:"sort-options",children:xe.map(([i,h])=>e.jsx("button",{className:`sort-btn ${l===i?"active":""}`,onClick:()=>f(i),children:h},i))}),e.jsx(Y,{hasCode:u,hasHfArtifacts:x,onHasCodeChange:d,onHasHfArtifactsChange:_})]}),e.jsxs("div",{className:"results-count",children:[S.length," papers mentioning ",n.name]})]}),r.isLoading?e.jsx("div",{className:"paper-list",children:Array.from({length:4}).map((i,h)=>e.jsx(A,{className:"h-40 w-full"},h))}):S.length===0?e.jsx("div",{className:"no-results",children:"No papers tagged with this method yet."}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"paper-list",children:S.map((i,h)=>e.jsx(V,{paper:i,rank:h+1},i.id))}),e.jsx("div",{ref:b,style:{height:1}}),r.isFetchingNextPage&&e.jsx("div",{style:{padding:"20px 0",textAlign:"center",color:"var(--ink-faint)"},children:"Loading more…"})]})]})};export{Pe as default};
|
assets/{MethodsIndexView-C3l_l70o.js → MethodsIndexView-BPuT8ecr.js}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
| 1 |
-
import{d as g,r as d,j as e,L as j,c as m}from"./index-
|
| 2 |
* @license lucide-react v0.462.0 - ISC
|
| 3 |
*
|
| 4 |
* This source code is licensed under the ISC license.
|
|
|
|
| 1 |
+
import{d as g,r as d,j as e,L as j,c as m}from"./index-Bthypk3Q.js";import{u as h}from"./useQuery-CEDDm0wh.js";import{s as f}from"./slug-BpH-Nkvz.js";import{S as p}from"./skeleton-BS-Px_iI.js";import{A as y,a as v}from"./alert-DJmmSiqi.js";import{T as _}from"./TaxonomySuggestionTile-BOiZOkbr.js";import"./SignInToEditDialog-BPVN69wP.js";import"./button-DH3x5IsG.js";import"./textarea-CMKu47Xo.js";import"./dialog-DDnKVGO8.js";import"./useMutation-dfvOlXzD.js";import"./loader-circle-BFDpPsTy.js";/**
|
| 2 |
* @license lucide-react v0.462.0 - ISC
|
| 3 |
*
|
| 4 |
* This source code is licensed under the ISC license.
|
assets/{NotFound-B35QRL9m.js → NotFound-D95eYzTU.js}
RENAMED
|
@@ -1 +1 @@
|
|
| 1 |
-
import{aP as o,r as a,j as t,L as s}from"./index-
|
|
|
|
| 1 |
+
import{aP as o,r as a,j as t,L as s}from"./index-Bthypk3Q.js";const r=()=>{const e=o();return a.useEffect(()=>{console.error("404 Error: User attempted to access non-existent route:",e.pathname)},[e.pathname]),t.jsxs("div",{className:"page",style:{textAlign:"center",paddingTop:96},children:[t.jsx("h1",{className:"detail-title",style:{fontSize:96,marginBottom:8},children:"404"}),t.jsx("p",{style:{fontFamily:"var(--serif)",fontStyle:"italic",color:"var(--ink-soft)",marginBottom:24},children:"That route isn't on the map."}),t.jsx(s,{to:"/",className:"action-btn",children:"Return home"})]})};export{r as default};
|
assets/{OrganizationContributionGraph-3M6kI8AL.js → OrganizationContributionGraph-BPUdCM_r.js}
RENAMED
|
@@ -1 +1 @@
|
|
| 1 |
-
import{r as b,j as o,c as z}from"./index-
|
|
|
|
| 1 |
+
import{r as b,j as o,c as z}from"./index-Bthypk3Q.js";import{u as T}from"./useQuery-CEDDm0wh.js";import{S as w}from"./skeleton-BS-Px_iI.js";const x=24*60*60*1e3,f=12,y=3,v=new Map([[1,"Mon"],[3,"Wed"],[5,"Fri"]]),$=n=>new Date(`${n}T00:00:00Z`),N=n=>n.toISOString().slice(0,10),_=(n,r)=>{if(n===0)return 0;const i=r.findIndex(s=>n<=s);return i===-1?4:i+1},D=n=>{const r=$(n.start_date),i=$(n.end_date),s=new Date(r.getTime()-r.getUTCDay()*x),h=new Date(i.getTime()+(6-i.getUTCDay())*x),p=new Map(n.results.map(e=>[e.date,e.paper_count])),u=n.results.map(e=>e.paper_count).sort((e,g)=>e-g),c=[.25,.5,.75].map(e=>u[Math.min(u.length-1,Math.floor(u.length*e))]??1),l=[];for(let e=s.getTime();e<=h.getTime();e+=x){const g=new Date(e),d=N(g),m=e>=r.getTime()&&e<=i.getTime(),C=m?p.get(d)??0:0;l.push({key:d,date:g,count:C,inRange:m,level:_(C,c)})}const t=l.length/7,a=[];let j=-1;for(let e=0;e<t;e+=1){const d=l.slice(e*7,e*7+7).find(m=>m.inRange&&(e===0||m.date.getUTCDate()<=7));d&&d.date.getUTCMonth()!==j&&(j=d.date.getUTCMonth(),a.length>0&&e-a[a.length-1].column<3&&a.pop(),a.push({label:d.date.toLocaleString("en",{month:"short",timeZone:"UTC"}),column:e}))}return{days:l,months:a,weekCount:t}},L=({data:n,organizationName:r,title:i="Paper contributions",noun:s="paper"})=>{const h=b.useRef(null),{days:p,months:u,weekCount:c}=b.useMemo(()=>D(n),[n]),l=c*f+(c-1)*y;return b.useEffect(()=>{const t=h.current;t&&(t.scrollLeft=t.scrollWidth)},[c]),o.jsxs("section",{className:"organization-contributions","aria-labelledby":"organization-contributions-title",children:[o.jsxs("div",{className:"organization-contributions-header",children:[o.jsx("h2",{id:"organization-contributions-title",className:"organization-contributions-title",children:i}),o.jsxs("p",{className:"organization-contributions-summary",children:[n.total_count.toLocaleString()," ",n.total_count===1?s:`${s}s`," recorded in the last year"]})]}),o.jsx("div",{className:"organization-contributions-scroll",ref:h,children:o.jsxs("div",{className:"organization-contributions-plot",style:{width:l+34},role:"img","aria-label":`${r} recorded ${n.total_count} ${n.total_count===1?s:`${s}s`} in the last year`,children:[o.jsx("div",{className:"organization-contributions-weekdays","aria-hidden":"true",children:Array.from({length:7}).map((t,a)=>o.jsx("span",{children:v.get(a)??""},a))}),o.jsxs("div",{children:[o.jsx("div",{className:"organization-contributions-months",style:{width:l,gridTemplateColumns:`repeat(${c}, ${f}px)`},"aria-hidden":"true",children:u.map(t=>o.jsx("span",{style:{gridColumnStart:t.column+1},children:t.label},`${t.label}-${t.column}`))}),o.jsx("div",{className:"organization-contributions-grid",style:{width:l,gridTemplateColumns:`repeat(${c}, ${f}px)`},"aria-hidden":"true",children:p.map(t=>o.jsx("span",{className:`organization-contribution-cell ${t.inRange?`level-${t.level}`:"is-outside"}`,title:t.inRange?`${t.count} ${t.count===1?s:`${s}s`} on ${t.date.toLocaleDateString("en",{dateStyle:"long",timeZone:"UTC"})}`:void 0},t.key))})]})]})}),o.jsxs("div",{className:"organization-contributions-legend","aria-hidden":"true",children:[o.jsx("span",{children:"Fewer"}),[0,1,2,3,4].map(t=>o.jsx("span",{className:`organization-contribution-cell level-${t}`},t)),o.jsx("span",{children:"More"})]})]})},k=({organizationSlug:n,organizationName:r})=>{const i=T({queryKey:["organization-contributions",n],queryFn:()=>z.getOrganizationContributions(n),staleTime:6e5});return i.isLoading?o.jsx(w,{className:"organization-contributions-skeleton"}):i.data?o.jsx(L,{data:i.data,organizationName:r}):null};export{L as C,k as O};
|
assets/OrganizationDetailView-B5tjQFbJ.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
import{f as t,j as r}from"./index-Bthypk3Q.js";import{O as i}from"./OrganizationPaperFeed-GYXowmRS.js";import m from"./NotFound-D95eYzTU.js";import"./useQuery-CEDDm0wh.js";import"./components-DR4nXlac.js";import"./LatexTitle-DOmMcoZ0.js";import"./katex.min-BSBacQyE.js";import"./transform-_T5o_x_w.js";import"./safeExternalHref-CkBrsh84.js";import"./MarkdownText-DX4YTOrq.js";import"./PaperPreviewLink-DajWspZH.js";import"./index-SizWVsV-.js";import"./hover-card-Dy9hZi_x.js";import"./OrganizationContributionGraph-BPUdCM_r.js";import"./skeleton-BS-Px_iI.js";import"./useIntersectionObserver-BrrNIU67.js";import"./alert-DJmmSiqi.js";import"./searchable-select-CkWEEgZw.js";import"./button-DH3x5IsG.js";import"./dialog-DDnKVGO8.js";import"./loader-circle-BFDpPsTy.js";import"./usePapers-BGjLgFkG.js";import"./useInfiniteQuery-KqL5cNCq.js";const V=()=>{const{orgSlug:o}=t();return o?r.jsx(i,{organizationSlug:o}):r.jsx(m,{})};export{V as default};
|
assets/OrganizationDetailView-BlNMZLd2.js
DELETED
|
@@ -1 +0,0 @@
|
|
| 1 |
-
import{f as t,j as r}from"./index-NKCYgxaj.js";import{O as i}from"./OrganizationPaperFeed-coYDRJZ1.js";import m from"./NotFound-B35QRL9m.js";import"./useQuery--AC_S866.js";import"./components-DOrpSyhx.js";import"./LatexTitle-BJ-ygzw0.js";import"./katex.min-BSBacQyE.js";import"./transform-BdA-spBj.js";import"./safeExternalHref-CkBrsh84.js";import"./MarkdownText-P17RUY6h.js";import"./PaperPreviewLink-syrag20a.js";import"./index-S59lkwkS.js";import"./hover-card-Z7w-9YtT.js";import"./OrganizationContributionGraph-3M6kI8AL.js";import"./skeleton-z_EQ30hh.js";import"./useIntersectionObserver-DF6Xuwk6.js";import"./alert-DdslWjc3.js";import"./searchable-select-Cuh3g3oe.js";import"./button-BPd6y_n4.js";import"./dialog-Cidv0TmN.js";import"./loader-circle-BY9WFC3q.js";import"./usePapers-DxvWW-Kl.js";import"./useInfiniteQuery-CE_Ny-la.js";const V=()=>{const{orgSlug:o}=t();return o?r.jsx(i,{organizationSlug:o}):r.jsx(m,{})};export{V as default};
|
|
|
|
|
|
assets/{OrganizationPaperFeed-coYDRJZ1.js → OrganizationPaperFeed-GYXowmRS.js}
RENAMED
|
@@ -1 +1 @@
|
|
| 1 |
-
import{u as E,a as Q,r as d,j as e,L as w,c as C}from"./index-
|
|
|
|
| 1 |
+
import{u as E,a as Q,r as d,j as e,L as w,c as C}from"./index-Bthypk3Q.js";import{u as A}from"./useQuery-CEDDm0wh.js";import{P as U}from"./components-DR4nXlac.js";import{M as B}from"./MarkdownText-DX4YTOrq.js";import{O as G}from"./OrganizationContributionGraph-BPUdCM_r.js";import{u as K,P as W}from"./useIntersectionObserver-BrrNIU67.js";import{A as D,a as Z}from"./alert-DJmmSiqi.js";import{a as z}from"./searchable-select-CkWEEgZw.js";import{S as $}from"./skeleton-BS-Px_iI.js";import{d as J}from"./usePapers-BGjLgFkG.js";import{d as T,t as V}from"./transform-_T5o_x_w.js";import X from"./NotFound-D95eYzTU.js";const Y=[["trending","trending"],["date_published","newest"],["citation_count","most cited"]],ee=n=>n==="date_published"||n==="citation_count"?n:"trending",me=({organizationSlug:n,taskSlug:p})=>{var N,y,v,P,L,F,k,O;const I=E(),[l,h]=Q(),[M,m]=d.useState(!1),u=ee(l.get("order_by")),g=l.get("has_code")==="true",f=l.get("has_hf_artifacts")==="true",_=A({queryKey:["organization",n],queryFn:()=>C.getOrganization(n),staleTime:10*60*1e3}),c=A({queryKey:["organization-areas-with-tasks",n],queryFn:()=>C.getOrganizationAreasWithTasks(n),staleTime:10*60*1e3}),i=J({organizationSlug:n,taskSlug:p,page_size:12,order_by:u,order_dir:"desc",include_resources:!0,has_code:g,has_hf_artifacts:f,enabled:!!n}),{targetRef:H,isIntersecting:x}=K({rootMargin:"200px"});d.useEffect(()=>{x&&i.hasNextPage&&!i.isFetchingNextPage&&i.fetchNextPage()},[x,i.hasNextPage,i.isFetchingNextPage]),d.useEffect(()=>{m(!1)},[n,p]);const j=d.useMemo(()=>{var a;return(((a=c.data)==null?void 0:a.results)??[]).flatMap(r=>r.tasks.filter(t=>!!t.slug).map(t=>({...t,slug:t.slug,label:T(t.name,t.slug)})))},[c.data]),o=j.find(a=>a.slug===p),b=d.useMemo(()=>{var a;return(((a=i.data)==null?void 0:a.pages)??[]).flatMap(r=>r.results.map(V))},[i.data]),s=_.data??((N=c.data)==null?void 0:N.organization),R=((v=(y=i.data)==null?void 0:y.pages[0])==null?void 0:v.count)??0;if(((P=_.error)==null?void 0:P.status)===404||((L=c.error)==null?void 0:L.status)===404||((F=i.error)==null?void 0:F.status)===404)return e.jsx(X,{});if(c.error||i.error)return e.jsx("div",{className:"page",children:e.jsx(D,{variant:"destructive",children:e.jsx(Z,{children:"Failed to load organization papers. Please try again."})})});const q=a=>{const r=a.trim().toLocaleLowerCase();return j.filter(t=>`${t.label} ${t.slug}`.toLocaleLowerCase().includes(r)).map(t=>({value:t.slug,label:t.label,description:`${t.paper_count.toLocaleString()} ${t.paper_count===1?"paper":"papers"}`}))},S=a=>{const r=a==="__all__"?`/orgs/${n}`:`/orgs/${n}/${a}`,t=l.toString();I({pathname:r,search:t?`?${t}`:""})};return e.jsxs("div",{className:"page",children:[e.jsxs("nav",{className:"breadcrumb","aria-label":"Breadcrumb",children:[e.jsx(w,{to:"/",children:"Home"}),e.jsx("span",{children:" / "}),e.jsx(w,{to:"/organizations",children:"Organizations"}),e.jsx("span",{children:" / "}),e.jsx("span",{children:(s==null?void 0:s.name)??n}),o&&e.jsxs(e.Fragment,{children:[e.jsx("span",{children:" / "}),e.jsx("span",{children:T(o.name,o.slug)})]})]}),e.jsxs("header",{className:"organization-hero",children:[e.jsxs("div",{className:"organization-hero-profile",children:[e.jsx("div",{className:"organizations-eyebrow",children:"ORGANIZATION"}),e.jsxs("h1",{className:"feed-title organization-hero-title",children:[s!=null&&s.logo_url&&!M?e.jsx("img",{src:s.logo_url,alt:"",width:58,height:58,onError:()=>m(!0)}):s?e.jsx("span",{className:"organization-logo organization-logo--fallback","aria-hidden":"true",children:s.name.slice(0,1).toUpperCase()}):null,(s==null?void 0:s.name)??e.jsx($,{className:"h-12 w-64"})]}),s&&e.jsxs("div",{className:"feed-subtitle",children:[((k=s.paper_count)==null?void 0:k.toLocaleString())??0," papers",(s.organization_trending_score??0)>0&&s.trending_rank&&e.jsxs(e.Fragment,{children:[" · #",s.trending_rank," trending this month"]})]}),(s==null?void 0:s.description)&&e.jsx(B,{className:"method-description",text:s.description}),s&&e.jsxs("div",{className:"organization-hero-links",children:[s.website_url&&e.jsx("a",{href:s.website_url,target:"_blank",rel:"noreferrer",children:"Website ↗"}),s.hf_url&&e.jsx("a",{href:s.hf_url,target:"_blank",rel:"noreferrer",children:"Hugging Face ↗"}),s.github_url&&e.jsx("a",{href:s.github_url,target:"_blank",rel:"noreferrer",children:"GitHub ↗"})]})]}),s&&e.jsx(G,{organizationSlug:n,organizationName:s.name})]}),e.jsxs("div",{className:"sort-bar",style:{alignItems:"center",gap:16},children:[e.jsx("div",{style:{minWidth:260},children:e.jsx(z,{value:p??"__all__",onChange:S,placeholder:"All tasks",searchPlaceholder:"Search organization tasks...",emptyMessage:"No matching tasks.",ariaLabel:"Filter papers by task",selectedOption:o?{value:o.slug,label:o.label,description:`${o.paper_count.toLocaleString()} ${o.paper_count===1?"paper":"papers"}`}:{value:"__all__",label:"All tasks",description:`${((O=s==null?void 0:s.paper_count)==null?void 0:O.toLocaleString())??0} papers`},queryKey:["organization-task-options",n],queryFn:async a=>{var r;return[{value:"__all__",label:"All tasks",description:`${((r=s==null?void 0:s.paper_count)==null?void 0:r.toLocaleString())??0} papers`},...q(a)]},enabled:!c.isLoading,className:"h-[38px]"})}),e.jsxs("div",{className:"paper-feed-toolbar-controls",children:[e.jsx("div",{className:"sort-options",children:Y.map(([a,r])=>e.jsx("button",{type:"button",className:`sort-btn ${u===a?"active":""}`,onClick:()=>{const t=new URLSearchParams(l);a==="trending"?t.delete("order_by"):t.set("order_by",a),h(t)},children:r},a))}),e.jsx(W,{hasCode:g,hasHfArtifacts:f,onHasCodeChange:a=>{const r=new URLSearchParams(l);a?r.set("has_code","true"):r.delete("has_code"),h(r)},onHasHfArtifactsChange:a=>{const r=new URLSearchParams(l);a?r.set("has_hf_artifacts","true"):r.delete("has_hf_artifacts"),h(r)}})]}),e.jsxs("div",{className:"results-count",children:[R.toLocaleString()," papers"]})]}),i.isLoading?e.jsx("div",{className:"paper-list",children:Array.from({length:4}).map((a,r)=>e.jsx($,{className:"h-40 w-full"},r))}):b.length===0?e.jsx("div",{className:"no-results",children:(s==null?void 0:s.paper_count)===0?"No papers indexed yet":"No papers found for this selection."}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"paper-list",children:b.map((a,r)=>e.jsx(U,{paper:a,rank:r+1,showInstitution:!1},a.id))}),e.jsx("div",{ref:H,style:{height:1}}),i.isFetchingNextPage&&e.jsx("div",{style:{padding:"20px 0",textAlign:"center"},children:"Loading more…"})]})]})};export{me as O};
|
assets/OrganizationTaskView-B9FcEHlq.js
DELETED
|
@@ -1 +0,0 @@
|
|
| 1 |
-
import{f as i,j as t}from"./index-NKCYgxaj.js";import{O as m}from"./OrganizationPaperFeed-coYDRJZ1.js";import p from"./NotFound-B35QRL9m.js";import"./useQuery--AC_S866.js";import"./components-DOrpSyhx.js";import"./LatexTitle-BJ-ygzw0.js";import"./katex.min-BSBacQyE.js";import"./transform-BdA-spBj.js";import"./safeExternalHref-CkBrsh84.js";import"./MarkdownText-P17RUY6h.js";import"./PaperPreviewLink-syrag20a.js";import"./index-S59lkwkS.js";import"./hover-card-Z7w-9YtT.js";import"./OrganizationContributionGraph-3M6kI8AL.js";import"./skeleton-z_EQ30hh.js";import"./useIntersectionObserver-DF6Xuwk6.js";import"./alert-DdslWjc3.js";import"./searchable-select-Cuh3g3oe.js";import"./button-BPd6y_n4.js";import"./dialog-Cidv0TmN.js";import"./loader-circle-BY9WFC3q.js";import"./usePapers-DxvWW-Kl.js";import"./useInfiniteQuery-CE_Ny-la.js";const V=()=>{const{orgSlug:o,taskSlug:r}=i();return o&&r?t.jsx(m,{organizationSlug:o,taskSlug:r}):t.jsx(p,{})};export{V as default};
|
|
|
|
|
|
assets/OrganizationTaskView-BiKsEldJ.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
import{f as i,j as t}from"./index-Bthypk3Q.js";import{O as m}from"./OrganizationPaperFeed-GYXowmRS.js";import p from"./NotFound-D95eYzTU.js";import"./useQuery-CEDDm0wh.js";import"./components-DR4nXlac.js";import"./LatexTitle-DOmMcoZ0.js";import"./katex.min-BSBacQyE.js";import"./transform-_T5o_x_w.js";import"./safeExternalHref-CkBrsh84.js";import"./MarkdownText-DX4YTOrq.js";import"./PaperPreviewLink-DajWspZH.js";import"./index-SizWVsV-.js";import"./hover-card-Dy9hZi_x.js";import"./OrganizationContributionGraph-BPUdCM_r.js";import"./skeleton-BS-Px_iI.js";import"./useIntersectionObserver-BrrNIU67.js";import"./alert-DJmmSiqi.js";import"./searchable-select-CkWEEgZw.js";import"./button-DH3x5IsG.js";import"./dialog-DDnKVGO8.js";import"./loader-circle-BFDpPsTy.js";import"./usePapers-BGjLgFkG.js";import"./useInfiniteQuery-KqL5cNCq.js";const V=()=>{const{orgSlug:o,taskSlug:r}=i();return o&&r?t.jsx(m,{organizationSlug:o,taskSlug:r}):t.jsx(p,{})};export{V as default};
|
assets/{OrganizationsIndexView-Bilr12rL.js → OrganizationsIndexView-CGf6Vqrw.js}
RENAMED
|
@@ -1 +1 @@
|
|
| 1 |
-
import{a as u,r as g,j as e,L as x,c as j}from"./index-
|
|
|
|
| 1 |
+
import{a as u,r as g,j as e,L as x,c as j}from"./index-Bthypk3Q.js";import{u as y}from"./useQuery-CEDDm0wh.js";import{A as f,a as _}from"./alert-DJmmSiqi.js";import{S as N}from"./skeleton-BS-Px_iI.js";const v=n=>n==="papers"||n==="name"?n:"trending",S=({organization:n})=>{const[d,t]=g.useState(!1);return!n.logo_url||d?e.jsx("span",{className:"organization-logo organization-logo--fallback","aria-hidden":"true",children:n.name.slice(0,1).toUpperCase()}):e.jsx("span",{className:"organization-logo",children:e.jsx("img",{src:n.logo_url,alt:"",width:48,height:48,onError:()=>t(!0)})})},z=()=>{var h;const[n,d]=u(),t=v(n.get("sort")),c=n.get("q")??"",l=y({queryKey:["organizations","featured"],queryFn:()=>j.getOrganizations(!0),staleTime:10*60*1e3}),p=s=>{const a=new URLSearchParams(n),i=s.sort??t,r=s.query??c;i==="trending"?a.delete("sort"):a.set("sort",i),r.trim()?a.set("q",r):a.delete("q"),d(a)},m=g.useMemo(()=>{var i;const s=c.trim().toLocaleLowerCase(),a=(((i=l.data)==null?void 0:i.results)??[]).filter(r=>[r.name,r.slug,r.hf_slug??""].join(" ").toLocaleLowerCase().includes(s));return t==="papers"?[...a].sort((r,o)=>(o.paper_count??0)-(r.paper_count??0)||r.name.localeCompare(o.name)||r.slug.localeCompare(o.slug)):t==="name"?[...a].sort((r,o)=>r.name.localeCompare(o.name)||r.slug.localeCompare(o.slug)):a},[l.data,c,t]);return e.jsxs("div",{className:"page organizations-page",children:[e.jsx("div",{className:"feed-header",children:e.jsxs("div",{children:[e.jsxs("h1",{className:"feed-title",children:["AI ",e.jsx("em",{children:"Organizations"})]}),e.jsx("div",{className:"feed-subtitle",children:"Explore papers from 21 leading AI organizations, ranked by sustained community momentum over the past 30 days."})]})}),e.jsxs("section",{"aria-labelledby":"organizations-heading",children:[e.jsxs("div",{className:"organizations-section-heading",children:[e.jsxs("h2",{id:"organizations-heading",children:[((h=l.data)==null?void 0:h.count)??21," organizations"]}),e.jsx("span",{children:t==="trending"?"Ranked by 30-day momentum":t==="papers"?"Sorted by linked papers":"Sorted A–Z"})]}),e.jsxs("div",{className:"organizations-controls",children:[e.jsxs("label",{children:[e.jsx("span",{className:"sr-only",children:"Search organizations"}),e.jsx("input",{type:"search",value:c,onChange:s=>p({query:s.target.value}),placeholder:"Search organizations"})]}),e.jsx("div",{className:"organizations-sort","aria-label":"Sort organizations",children:[["trending","Trending"],["papers","Most papers"],["name","A–Z"]].map(([s,a])=>e.jsx("button",{type:"button",className:t===s?"active":"","aria-pressed":t===s,onClick:()=>p({sort:s}),children:a},s))})]}),l.isLoading?e.jsx("div",{className:"organizations-grid","aria-busy":"true",children:Array.from({length:6}).map((s,a)=>e.jsx(N,{className:"organization-card-skeleton"},a))}):l.error?e.jsx(f,{variant:"destructive",children:e.jsxs(_,{children:["Failed to load organizations."," ",e.jsx("button",{type:"button",onClick:()=>l.refetch(),children:"Try again"})]})}):m.length===0?e.jsxs("div",{className:"organizations-empty",children:["No organizations match “",c,"”."]}):e.jsx("div",{className:"organizations-grid",children:m.map(s=>{var r;const a=s.paper_count??0,i=s.first_paper_year&&s.latest_paper_year?s.first_paper_year===s.latest_paper_year?String(s.first_paper_year):`${s.first_paper_year}–${s.latest_paper_year}`:null;return e.jsxs(x,{to:`/orgs/${s.slug}`,className:"organization-card","aria-label":a?`Browse ${a.toLocaleString()} ${s.name} papers`:`Browse ${s.name} papers`,children:[e.jsxs("div",{className:"organization-card-header",children:[e.jsx(S,{organization:s}),e.jsxs("div",{children:[e.jsx("h3",{children:s.name}),e.jsxs("span",{children:["@",s.hf_slug??s.slug]})]})]}),e.jsxs("div",{className:"organization-card-metrics",children:[e.jsx("strong",{children:a.toLocaleString()}),e.jsx("span",{children:a===1?"paper":"papers"}),t==="trending"&&s.trending_rank&&e.jsxs("span",{className:"organization-rank",children:["#",s.trending_rank]})]}),e.jsxs("div",{className:"organization-highlight",children:[e.jsx("span",{children:"Trending paper"}),e.jsx("strong",{children:((r=s.top_trending_paper)==null?void 0:r.title)??"No papers indexed yet"})]}),e.jsxs("div",{className:"organization-card-footer",children:[i?`Publishing ${i}`:"Research archive ready",e.jsx("span",{"aria-hidden":"true",children:"↗"})]})]},s.id)})})]})]})};export{z as default};
|
assets/{PaperDetailView-C9FO72gI.js → PaperDetailView-Cy4lGhTm.js}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
| 1 |
-
import{d as Nt,m as la,r as m,j as e,P as ps,n as _e,o as fs,p as Ue,q as Te,s as gs,t as Ct,C as je,v as Je,k as he,h as pe,X as xs,w as ve,x as ca,y as bs,z as da,B as ua,D as ma,E as ha,F as pa,G as ts,H as fa,I as ga,J as xa,K as ba,M as ja,g as Ye,R as We,A as jt,c as re,N as js,e as vs,O as va,Q as ya,S as _a,T as ys,U as ka,V as wa,W as Na,f as Ca,Y as Ea,u as Sa,Z as Ia,L as xe,_ as Pa,$ as $a,a0 as Aa,a1 as Ra,a2 as Fa,a3 as La,a4 as Ta}from"./index-
|
| 2 |
* @license lucide-react v0.462.0 - ISC
|
| 3 |
*
|
| 4 |
* This source code is licensed under the ISC license.
|
|
|
|
| 1 |
+
import{d as Nt,m as la,r as m,j as e,P as ps,n as _e,o as fs,p as Ue,q as Te,s as gs,t as Ct,C as je,v as Je,k as he,h as pe,X as xs,w as ve,x as ca,y as bs,z as da,B as ua,D as ma,E as ha,F as pa,G as ts,H as fa,I as ga,J as xa,K as ba,M as ja,g as Ye,R as We,A as jt,c as re,N as js,e as vs,O as va,Q as ya,S as _a,T as ys,U as ka,V as wa,W as Na,f as Ca,Y as Ea,u as Sa,Z as Ia,L as xe,_ as Pa,$ as $a,a0 as Aa,a1 as Ra,a2 as Fa,a3 as La,a4 as Ta}from"./index-Bthypk3Q.js";import{u as ne}from"./useQuery-CEDDm0wh.js";import{I as W,S as Ua,a as Ba,T as Da,M as Ha}from"./components-DR4nXlac.js";import{C as Ma,E as qa}from"./ExternalSourceEvalBadge-DW02jL22.js";import{L as ze,a as za}from"./LatexTitle-DOmMcoZ0.js";import{s as Ka}from"./transform-_T5o_x_w.js";import{f as Oa,D as Ga}from"./latexPlainText-DI8YEXVe.js";import{a as Qa}from"./usePapers-BGjLgFkG.js";import{S as Re}from"./skeleton-BS-Px_iI.js";import{A as Va,a as Ja}from"./alert-DJmmSiqi.js";import{B as M}from"./button-DH3x5IsG.js";import{u as _s}from"./index-CqkTYlMR.js";import{I as Z}from"./textarea-CMKu47Xo.js";import{D as oe,a as le,b as ce,c as de,d as ue,e as me}from"./dialog-DDnKVGO8.js";import{u as fe}from"./useMutation-dfvOlXzD.js";import{S as Et,P as Ze,L as ae,a as Wa}from"./SignInToEditDialog-BPVN69wP.js";import{S as Xe,a as ss}from"./searchable-select-CkWEEgZw.js";import{L as ie}from"./loader-circle-BFDpPsTy.js";import{B as ks,D as Xa,c as Ya,g as Za,s as er,a as tr,b as sr,d as ar,i as rr,e as nr}from"./codexAddEvals-DL2-0pMU.js";import{G as as}from"./github-B57w8ODD.js";import{S as rs,s as ir}from"./savedPapersAuth-X-FbZVWw.js";import{M as or,r as lr}from"./index-SizWVsV-.js";import{s as Ne}from"./safeExternalHref-CkBrsh84.js";import"./hover-card-Dy9hZi_x.js";import"./katex.min-BSBacQyE.js";import"./useInfiniteQuery-KqL5cNCq.js";/**
|
| 2 |
* @license lucide-react v0.462.0 - ISC
|
| 3 |
*
|
| 4 |
* This source code is licensed under the ISC license.
|
assets/{PaperPreviewLink-syrag20a.js → PaperPreviewLink-DajWspZH.js}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
| 1 |
-
import{o as F,l as ne,f as v,m as b,a as re,p as I,b as $,n as L,h as ie,s as ae,c as oe,v as se,S as le}from"./index-
|
| 2 |
`,inConstruct:"mathFlowMeta"},{character:"$",after:t?void 0:"\\$",inConstruct:"phrasing"},{character:"$",inConstruct:"mathFlowMeta"},{atBreak:!0,character:"$",after:"\\$"}],handlers:{math:n,inlineMath:r}};function n(o,s,l,a){const u=o.value||"",p=l.createTracker(a),m="$".repeat(Math.max(ne(u,"$")+1,2)),g=l.enter("mathFlow");let x=p.move(m);if(o.meta){const d=l.enter("mathFlowMeta");x+=p.move(l.safe(o.meta,{after:`
|
| 3 |
`,before:x,encode:["$"],...p.current()})),d()}return x+=p.move(`
|
| 4 |
`),u&&(x+=p.move(u+`
|
|
|
|
| 1 |
+
import{o as F,l as ne,f as v,m as b,a as re,p as I,b as $,n as L,h as ie,s as ae,c as oe,v as se,S as le}from"./index-SizWVsV-.js";import{k as z}from"./katex.min-BSBacQyE.js";import{j as f,R as T,a2 as ce,Y as ue,L as he,ap as pe}from"./index-Bthypk3Q.js";import{u as me}from"./useQuery-CEDDm0wh.js";import{H as fe,a as de,b as ge}from"./hover-card-Dy9hZi_x.js";function xe(){return{enter:{mathFlow:e,mathFlowFenceMeta:t,mathText:o},exit:{mathFlow:i,mathFlowFence:r,mathFlowFenceMeta:n,mathFlowValue:l,mathText:s,mathTextData:l}};function e(a){const u={type:"element",tagName:"code",properties:{className:["language-math","math-display"]},children:[]};this.enter({type:"math",meta:null,value:"",data:{hName:"pre",hChildren:[u]}},a)}function t(){this.buffer()}function n(){const a=this.resume(),u=this.stack[this.stack.length-1];F(u.type==="math"),u.meta=a}function r(){this.data.mathFlowInside||(this.buffer(),this.data.mathFlowInside=!0)}function i(a){const u=this.resume().replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),p=this.stack[this.stack.length-1];F(p.type==="math"),this.exit(a),p.value=u;const m=p.data.hChildren[0];F(m.type==="element"),F(m.tagName==="code"),m.children.push({type:"text",value:u}),this.data.mathFlowInside=void 0}function o(a){this.enter({type:"inlineMath",value:"",data:{hName:"code",hProperties:{className:["language-math","math-inline"]},hChildren:[]}},a),this.buffer()}function s(a){const u=this.resume(),p=this.stack[this.stack.length-1];F(p.type==="inlineMath"),this.exit(a),p.value=u,p.data.hChildren.push({type:"text",value:u})}function l(a){this.config.enter.data.call(this,a),this.config.exit.data.call(this,a)}}function ye(e){let t=(e||{}).singleDollarTextMath;return t==null&&(t=!0),r.peek=i,{unsafe:[{character:"\r",inConstruct:"mathFlowMeta"},{character:`
|
| 2 |
`,inConstruct:"mathFlowMeta"},{character:"$",after:t?void 0:"\\$",inConstruct:"phrasing"},{character:"$",inConstruct:"mathFlowMeta"},{atBreak:!0,character:"$",after:"\\$"}],handlers:{math:n,inlineMath:r}};function n(o,s,l,a){const u=o.value||"",p=l.createTracker(a),m="$".repeat(Math.max(ne(u,"$")+1,2)),g=l.enter("mathFlow");let x=p.move(m);if(o.meta){const d=l.enter("mathFlowMeta");x+=p.move(l.safe(o.meta,{after:`
|
| 3 |
`,before:x,encode:["$"],...p.current()})),d()}return x+=p.move(`
|
| 4 |
`),u&&(x+=p.move(u+`
|
assets/{PapersListView-Dtn8th3L.js → PapersListView-DKJHwCAY.js}
RENAMED
|
@@ -1 +1 @@
|
|
| 1 |
-
import{a as q,r as m,A as z,j as e,L as x,c as G}from"./index-
|
|
|
|
| 1 |
+
import{a as q,r as m,A as z,j as e,L as x,c as G}from"./index-Bthypk3Q.js";import{I as E,T as Q,P as U}from"./components-DR4nXlac.js";import{t as W,d as K}from"./transform-_T5o_x_w.js";import{u as V}from"./usePapers-BGjLgFkG.js";import{u as J}from"./useDebounce-yl1_aMxA.js";import{P as X}from"./usePeriodFilter-D8fQ9GJd.js";import{u as Y,P as Z}from"./useIntersectionObserver-BrrNIU67.js";import{S as p}from"./skeleton-BS-Px_iI.js";import{A as ee,a as se}from"./alert-DJmmSiqi.js";import{u as ae}from"./useQuery-CEDDm0wh.js";import"./LatexTitle-DOmMcoZ0.js";import"./katex.min-BSBacQyE.js";import"./safeExternalHref-CkBrsh84.js";import"./useInfiniteQuery-KqL5cNCq.js";const re=[["trending","trending"],["new","newest"],["cited","most cited"]],te=r=>new Intl.NumberFormat("en",{notation:r>=1e3?"compact":"standard",maximumFractionDigits:1}).format(r),ve=()=>{var T,C,A,I,L,R,H;const[r,_]=q(),h=r.get("framework")||void 0,g=r.get("repository")||void 0,n=!!(h||g),u=r.get("search")||"",[b,k]=m.useState(u),l=J(b,300);m.useEffect(()=>k(u),[u]),m.useEffect(()=>{if(l===u)return;const s=new URLSearchParams(r);l?s.set("search",l):s.delete("search"),_(s,{replace:!0})},[l]);const j=r.get("order_by"),N=j==="citation_count"?"cited":j==="trending"||!j&&n?"trending":"new",o=r.get("time"),$=o==="today"?"Today":o==="week"?"This Week":o==="month"?"This Month":"All Time",y=r.get("has_hf_artifacts")==="true",w=!n&&r.get("has_code")==="true",f=(s,i)=>{const d=new URLSearchParams(r);i?d.set(s,i):d.delete(s),_(d)},B=s=>{f("time",s==="Today"?"today":s==="This Week"?"week":s==="This Month"?"month":void 0)},D=s=>{f("order_by",s==="cited"?"citation_count":s==="new"?"date_published":"trending")},t=V({page_size:20,order_by:N==="trending"?"trending":N==="cited"?"citation_count":"date_published",order_dir:"desc",search:l||void 0,time:o==="today"||o==="week"||o==="month"?o:"all_time",include_resources:!0,published_after:r.get("published_after")||void 0,published_before:r.get("published_before")||void 0,conference:r.get("conference")||void 0,latest_only:r.get("latest_only")!=="false",has_code:w,has_hf_artifacts:y,framework:h,repository:g}),P=ae({queryKey:["top-tasks-sidebar"],queryFn:()=>G.getTopTasks({limit:8}),enabled:!n,staleTime:10*60*1e3}),v=m.useMemo(()=>{var i;return(((i=t.data)==null?void 0:i.pages.flatMap(d=>d.results))||[]).map(W)},[t.data]),{targetRef:O,isIntersecting:F}=Y({rootMargin:"200px"});m.useEffect(()=>{F&&t.hasNextPage&&!t.isFetchingNextPage&&t.fetchNextPage()},[F,t.hasNextPage,t.isFetchingNextPage]);const c=((A=(C=(T=t.data)==null?void 0:T.pages)==null?void 0:C[0])==null?void 0:A.count)??0,a=(R=(L=(I=t.data)==null?void 0:I.pages)==null?void 0:L[0])==null?void 0:R.scope,S=h&&t.error instanceof z&&t.error.status===404,M=(a==null?void 0:a.kind)==="framework"?a.framework_name:a==null?void 0:a.repository;return e.jsxs("div",{className:"page",children:[(a==null?void 0:a.kind)==="framework"&&e.jsxs("nav",{className:"breadcrumb","aria-label":"Breadcrumb",children:[e.jsx(x,{to:"/",children:"Papers"}),e.jsx("span",{className:"sep",children:"/"}),e.jsx(x,{to:"/frameworks",children:"Frameworks"}),e.jsx("span",{className:"sep",children:"/"}),e.jsx("span",{style:{color:"var(--ink)"},children:a.framework_name})]}),e.jsxs("div",{className:"feed-header",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"feed-title",children:n?e.jsxs(e.Fragment,{children:["Papers implemented by ",e.jsx("em",{children:M||h||g})]}):e.jsxs(e.Fragment,{children:["All ",e.jsx("em",{children:"Papers"})]})}),e.jsx("div",{className:"feed-subtitle",children:n?(a==null?void 0:a.kind)==="framework"?c>0&&`${c.toLocaleString()} papers.`:a!=null&&a.repository?e.jsxs(e.Fragment,{children:["GitHub repository ",e.jsx("strong",{children:a.repository}),". ",c>0&&`${c.toLocaleString()} papers.`]}):"Repository-scoped paper feed.":e.jsxs(e.Fragment,{children:["Search the full corpus. ",c>0&&`${c.toLocaleString()} papers indexed.`]})}),n&&a&&e.jsxs("div",{className:"paper-feed-scope-links",children:[e.jsxs("div",{className:"paper-feed-primary-links",children:[a.github_url&&e.jsxs("a",{href:a.github_url,target:"_blank",rel:"noopener noreferrer",className:a.kind==="framework"?"task-framework-link":"framework-link",children:[e.jsx(E,{name:"github",size:13}),a.kind==="framework"?e.jsxs(e.Fragment,{children:[e.jsx("span",{children:a.repository||"GitHub"}),a.num_stars!=null&&e.jsxs("span",{className:"task-framework-link-stars",children:["★ ",te(a.num_stars)]})]}):"GitHub"]}),a.kind==="framework"&&a.introducing_paper_arxiv_id&&e.jsx(x,{to:`/paper/${a.introducing_paper_arxiv_id}`,className:"framework-link",children:"Introducing paper"})]}),a.kind==="framework"&&a.recommended_tasks&&a.recommended_tasks.length>0&&e.jsx("div",{className:"paper-feed-task-tags",children:a.recommended_tasks.map(s=>s.slug?e.jsx(Q,{slug:s.slug,label:s.name},s.id):null)})]})]}),e.jsx("div",{className:"period-switch",children:X.map(s=>e.jsx("button",{className:`period-btn ${$===s?"active":""}`,onClick:()=>B(s),children:s},s))})]}),e.jsx("div",{className:"papers-search-row",children:e.jsxs("div",{className:"papers-search-input-wrap",children:[e.jsx(E,{name:"search",size:14}),e.jsx("input",{className:"papers-search-input",placeholder:"Search title or abstract…",value:b,onChange:s=>k(s.target.value)})]})}),e.jsxs("div",{className:n?"papers-feed-layout-scoped":"layout-with-sidebar",children:[!n&&e.jsx("aside",{className:"sidebar",children:e.jsxs("div",{className:"sidebar-section",children:[e.jsx("div",{className:"sidebar-label",children:"Top Domains"}),P.isLoading&&e.jsx("div",{style:{display:"flex",flexDirection:"column",gap:8},children:Array.from({length:6}).map((s,i)=>e.jsx(p,{className:"h-5 w-full"},i))}),(H=P.data)==null?void 0:H.map(s=>e.jsxs(x,{to:`/tasks/${s.slug}`,className:"sidebar-link",children:[K(s.name,s.slug),s.paper_count!=null&&e.jsx("span",{className:"count",children:s.paper_count})]},s.id))]})}),e.jsxs("div",{children:[e.jsxs("div",{className:"sort-bar",children:[e.jsxs("div",{className:"paper-feed-toolbar-controls",children:[e.jsx("div",{className:"sort-options",children:re.map(([s,i])=>e.jsx("button",{className:`sort-btn ${N===s?"active":""}`,onClick:()=>D(s),children:i},s))}),e.jsx(Z,{hasCode:w,hasHfArtifacts:y,onHasCodeChange:s=>f("has_code",s?"true":void 0),onHasHfArtifactsChange:s=>f("has_hf_artifacts",s?"true":void 0),showHasCode:!n})]}),e.jsxs("div",{className:"results-count",children:[v.length," loaded"]})]}),S?e.jsx("div",{className:"no-results",children:"Framework not found."}):t.error&&e.jsx(ee,{variant:"destructive",className:"mb-4",children:e.jsx(se,{children:"Failed to load papers. Please try again."})}),!S&&(t.isLoading?e.jsx("div",{className:"paper-list",children:Array.from({length:6}).map((s,i)=>e.jsxs("div",{className:"paper-card",children:[e.jsx(p,{className:"h-[220px] w-[160px]"}),e.jsxs("div",{className:"paper-body",style:{flex:1,gap:12},children:[e.jsx(p,{className:"h-6 w-3/4"}),e.jsx(p,{className:"h-4 w-1/2"}),e.jsx(p,{className:"h-12 w-full"})]})]},i))}):v.length===0?e.jsx("div",{className:"no-results",children:"No matching papers."}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"paper-list",children:v.map((s,i)=>e.jsx(U,{paper:s,rank:i+1},s.id))}),e.jsx("div",{ref:O,style:{height:1}}),t.isFetchingNextPage&&e.jsx("div",{style:{padding:"20px 0",textAlign:"center",color:"var(--ink-faint)"},children:"Loading more…"})]}))]})]})]})};export{ve as default};
|
assets/{PrivacyView-Bsa4nuAZ.js → PrivacyView-CdEPOZuX.js}
RENAMED
|
@@ -1 +1 @@
|
|
| 1 |
-
import{R as s,j as e}from"./index-
|
|
|
|
| 1 |
+
import{R as s,j as e}from"./index-Bthypk3Q.js";import{f as i,D as r}from"./latexPlainText-DI8YEXVe.js";const n=()=>(s.useEffect(()=>(document.title=i("Privacy Policy"),()=>{document.title=r}),[]),e.jsxs("article",{className:"page legal-page",children:[e.jsxs("header",{className:"legal-header",children:[e.jsx("p",{className:"legal-kicker",children:"Legal"}),e.jsx("h1",{children:"Privacy Policy"}),e.jsx("p",{className:"legal-effective-date",children:"Effective August 4, 2026"})]}),e.jsx("p",{children:"This Privacy Policy explains how Hugging Face, Inc. (“Hugging Face,” “we,” or “us”) collects, uses, and shares information when you use Papers With Code, including its website, research assistant, APIs, and related services (the “Service”)."}),e.jsxs("section",{children:[e.jsx("h2",{children:"1. Information we collect"}),e.jsx("h3",{children:"Information you provide"}),e.jsxs("ul",{children:[e.jsxs("li",{children:[e.jsx("strong",{children:"Account information."})," If you sign in with Hugging Face, we receive account identifiers and profile details needed to authenticate you, such as your user ID, username, and avatar."]}),e.jsxs("li",{children:[e.jsx("strong",{children:"Contributions and preferences."})," We collect information you submit or save, such as paper submissions and edits, bookmarks, display preferences, feedback, and communications with us. Material you submit to a public research page may be publicly visible."]}),e.jsxs("li",{children:[e.jsx("strong",{children:"Research assistant content."})," We collect your questions, conversation history, generated answers, citations, tool calls and results, and feedback about answers. Chats are private to your account unless you choose to create a share link; anyone with that link may be able to view the shared chat."]}),e.jsxs("li",{children:[e.jsx("strong",{children:"Provider and billing information."})," If you enable a model provider, we process the authorization or API credentials needed to make requests on your behalf. Hugging Face or another provider processes its own billing information under its terms. Papers With Code does not collect your payment-card details."]})]}),e.jsx("h3",{children:"Information collected automatically"}),e.jsx("p",{children:"We collect technical and usage information such as IP address, browser and device type, operating system, pages or features used, dates and times, referring pages, request identifiers, cookies, logs, and diagnostic data. For research-assistant requests, this may include the selected model, token and cost details, latency, errors, and other operational metadata."}),e.jsx("h3",{children:"Research assistant tracing"}),e.jsxs("p",{children:["To evaluate, debug, secure, and improve the research assistant, we use Langfuse to record traces. A trace may contain the complete text of your question and the assistant's answer, as well as tool inputs, tool outputs, retrieved research material, model details, usage data, and related operational metadata.",e.jsx("strong",{children:" This trace content is not redacted before it is sent to Langfuse."})]}),e.jsx("p",{children:"Papers With Code is designed for questions about research literature. Do not put passwords, API keys, confidential information, health or financial data, or other sensitive personal information in research-assistant prompts."})]}),e.jsxs("section",{children:[e.jsx("h2",{children:"2. How we use information"}),e.jsx("p",{children:"We use information to:"}),e.jsxs("ul",{children:[e.jsx("li",{children:"provide, personalize, maintain, and operate the Service;"}),e.jsx("li",{children:"authenticate users and keep accounts and the Service secure;"}),e.jsx("li",{children:"run research-assistant requests and preserve conversation history;"}),e.jsx("li",{children:"measure performance, troubleshoot failures, and improve quality;"}),e.jsx("li",{children:"review contributions, prevent abuse, and enforce applicable terms;"}),e.jsx("li",{children:"communicate with you and respond to requests; and"}),e.jsx("li",{children:"comply with law and protect users, Hugging Face, and the public."})]})]}),e.jsxs("section",{children:[e.jsx("h2",{children:"3. How we share information"}),e.jsx("p",{children:"We may share information in these circumstances:"}),e.jsxs("ul",{children:[e.jsxs("li",{children:[e.jsx("strong",{children:"Service providers."})," Vendors process information for hosting, authentication, analytics, observability, security, and support. These include Hugging Face services, Langfuse for research-assistant tracing, Plausible for website analytics, and infrastructure providers."]}),e.jsxs("li",{children:[e.jsx("strong",{children:"Model providers."})," Research-assistant content is sent to the model provider you use, such as Hugging Face Inference Providers or OpenRouter, so it can generate a response. That provider's privacy terms also apply to its processing."]}),e.jsxs("li",{children:[e.jsx("strong",{children:"Public and shared content."})," Contributions intended for public pages are public. A chat is disclosed through the Service when you create and distribute a share link."]}),e.jsxs("li",{children:[e.jsx("strong",{children:"Legal, safety, and corporate events."})," We may disclose information when reasonably necessary to comply with law, protect rights and safety, investigate abuse, or complete a merger, acquisition, financing, or transfer of assets."]})]}),e.jsx("p",{children:"We do not sell your personal information."})]}),e.jsxs("section",{children:[e.jsx("h2",{children:"4. Cookies and analytics"}),e.jsx("p",{children:"We use cookies and similar storage when needed for sign-in, security, preferences, and operation of the Service. We also use Plausible to understand aggregate website usage. You can control cookies through your browser, but disabling necessary cookies may prevent account features from working."})]}),e.jsxs("section",{children:[e.jsx("h2",{children:"5. Legal bases"}),e.jsx("p",{children:"Where applicable law requires a legal basis, we process information as needed to perform our agreement with you, with your consent, to comply with legal obligations, and for legitimate interests such as operating, securing, and improving the Service. You may withdraw consent where consent is the basis for processing, without affecting earlier processing."})]}),e.jsxs("section",{children:[e.jsx("h2",{children:"6. Retention and deletion"}),e.jsx("p",{children:"Private chats are retained until you delete them, subject to limits of 100 active chats and 100 MB of chat data per user. Archiving hides a chat and frees active-chat quota but does not delete it. You may deliberately share an unlisted snapshot; deleting its private chat removes the durable transcript, workspace reference, and share link after deletion is verified. No dedicated private-chat export format is currently offered."}),e.jsx("p",{children:"We keep information for as long as reasonably needed for the purposes described here, including providing the Service, maintaining security and audit records, resolving disputes, and meeting legal obligations. Retention periods vary by data type and service provider. You can delete individual chats in the Service. Deletion may not immediately remove information from backups, security logs, or third-party systems where limited retention is required."})]}),e.jsxs("section",{children:[e.jsx("h2",{children:"7. Security and international transfers"}),e.jsx("p",{children:"We use reasonable administrative, technical, and organizational safeguards, but no internet service can guarantee absolute security. We and our service providers may process information in the United States and other countries, which may have different data-protection laws from your country. Where required, we use appropriate safeguards for international transfers."})]}),e.jsxs("section",{children:[e.jsx("h2",{children:"8. Your privacy rights"}),e.jsx("p",{children:"Depending on where you live, you may have rights to access, correct, delete, or receive a copy of your personal information; object to or restrict processing; withdraw consent; or appeal a decision about a request. You may also have the right to complain to a data-protection authority. We may need to verify your identity before fulfilling a request."})]}),e.jsxs("section",{children:[e.jsx("h2",{children:"9. Children"}),e.jsx("p",{children:"The Service is not directed to children under 13, and we do not knowingly collect personal information from children under 13. If you believe a child has provided personal information, please contact us."})]}),e.jsxs("section",{children:[e.jsx("h2",{children:"10. Changes to this policy"}),e.jsx("p",{children:"We may update this policy as the Service changes. We will post the revised policy here and update its effective date. If a change is material, we will provide additional notice when appropriate."})]}),e.jsxs("section",{children:[e.jsx("h2",{children:"11. Contact us"}),e.jsxs("p",{children:["For questions or privacy requests, contact"," ",e.jsx("a",{href:"mailto:privacy@huggingface.co",children:"privacy@huggingface.co"}),". Please do not include passwords, API keys, or other sensitive credentials in your message."]})]})]}));export{n as default};
|
assets/{RateLimitsView-BmjETJTs.js → RateLimitsView-CszkMzYL.js}
RENAMED
|
@@ -1 +1 @@
|
|
| 1 |
-
import{j as e,e as s}from"./index-
|
|
|
|
| 1 |
+
import{j as e,e as s}from"./index-Bthypk3Q.js";import{u as r}from"./useQuery-CEDDm0wh.js";const c=()=>{const i=r({queryKey:["submission-rate-limit-policy"],queryFn:async()=>{const t=await fetch(s("/api/v1/rate-limits"));if(!t.ok)throw new Error("Policy unavailable");return t.json()}}).data;return e.jsxs("div",{className:"page",style:{maxWidth:760},children:[e.jsx("h1",{children:"Submission and rate-limit policy"}),i?e.jsxs(e.Fragment,{children:[e.jsxs("p",{children:["Each account may have up to ",i.active_pending," active submissions."]}),e.jsxs("p",{children:["New submissions are limited to ",i.subject_per_hour," per account and ",i.ip_per_hour," per source network in a rolling hour."]})]}):e.jsx("p",{children:"Loading current limits…"}),e.jsx("p",{children:"Duplicate, no-op, and idempotently replayed requests do not consume creation quota."}),e.jsx("p",{children:"Rate-limited responses use HTTP 429 with Retry-After, RateLimit, and RateLimit-Policy headers."}),e.jsx("p",{children:"Good-faith contributors who are blocked should contact the Papers with Code maintainers with their Hugging Face username."})]})};export{c as default};
|
assets/{SavedPapersView-Qsjk3Dca.js → SavedPapersView-D2PAZRE5.js}
RENAMED
|
@@ -1 +1 @@
|
|
| 1 |
-
import{g as h,A as g,j as e,aa as v,L as x,c as j}from"./index-
|
|
|
|
| 1 |
+
import{g as h,A as g,j as e,aa as v,L as x,c as j}from"./index-Bthypk3Q.js";import{u as N}from"./useQuery-CEDDm0wh.js";import{T as b,P as f}from"./components-DR4nXlac.js";import{S as r}from"./skeleton-BS-Px_iI.js";import{A as k,a as y}from"./alert-DJmmSiqi.js";import{t as w}from"./transform-_T5o_x_w.js";import{s as A}from"./savedPapersAuth-X-FbZVWw.js";import"./LatexTitle-DOmMcoZ0.js";import"./katex.min-BSBacQyE.js";import"./safeExternalHref-CkBrsh84.js";const T=()=>{var d,o;const{user:t,isLoading:u}=h(),a=N({queryKey:["my-bookmarks"],queryFn:()=>j.getMyBookmarks(),enabled:!!t,staleTime:30*1e3,refetchOnWindowFocus:!1}),n=a.error instanceof g&&a.error.code==="saved_papers_bucket_authorization_required",m=!!a.data&&!a.data.bucket_connected,c=()=>{window.location.assign(A())};return u?e.jsxs("div",{className:"page",children:[e.jsx(r,{className:"h-10 w-1/3 mb-4"}),e.jsx(r,{className:"h-6 w-1/2 mb-8"})]}):t?e.jsxs("div",{className:"page",children:[e.jsx("div",{className:"feed-header",children:e.jsxs("div",{children:[e.jsxs("h1",{className:"feed-title",children:["Saved ",e.jsx("em",{children:"Papers"})]}),e.jsxs("div",{className:"feed-subtitle",children:[(d=a.data)!=null&&d.count?`${a.data.count.toLocaleString()} saved · grouped by domain`:"Your bookmarked papers, grouped by domain.",(o=a.data)!=null&&o.bucket_connected?e.jsxs(e.Fragment,{children:[" · ",e.jsx("a",{href:`https://huggingface.co/buckets/${t.username}/pwc-saved-papers`,target:"_blank",rel:"noopener noreferrer",children:"Open your Hugging Face Bucket"})]}):null]})]})}),n?e.jsxs("div",{className:"saved-bucket-migration",children:[e.jsx("p",{children:"Your saved papers are still safe in Papers With Code. Approve Bucket access to copy them into a private Hugging Face Bucket that belongs to you."}),e.jsx("button",{type:"button",className:"hf-signin-btn",onClick:c,children:"Approve and migrate saved papers"})]}):a.error?e.jsx(k,{variant:"destructive",className:"mb-4",children:e.jsx(y,{children:"Failed to load your saved papers. Please try again."})}):null,m?e.jsxs("div",{className:"saved-bucket-migration",children:[e.jsxs("p",{children:[a.data.count?`Your ${a.data.count.toLocaleString()} saved ${a.data.count===1?"paper is":"papers are"} still available below. `:"When you save your first paper, ","Approve Bucket access to copy saved papers into a private Hugging Face Bucket that belongs to you. The existing data is kept until the copy is verified."]}),e.jsx("button",{type:"button",className:"hf-signin-btn",onClick:c,children:a.data.count?"Approve and migrate saved papers":"Use a Hugging Face Bucket"})]}):null,n||a.error?null:a.isLoading?e.jsx("div",{className:"paper-list",children:Array.from({length:4}).map((i,s)=>e.jsxs("div",{className:"paper-card",children:[e.jsx(r,{className:"h-[220px] w-[160px]"}),e.jsxs("div",{className:"paper-body",style:{flex:1,gap:12},children:[e.jsx(r,{className:"h-6 w-3/4"}),e.jsx(r,{className:"h-4 w-1/2"}),e.jsx(r,{className:"h-12 w-full"})]})]},s))}):!a.data||a.data.count===0?e.jsxs("div",{className:"no-results",children:["No saved papers yet."," ",e.jsx(x,{to:"/papers",className:"sidebar-link",style:{display:"inline"},children:"Browse papers →"})]}):a.data.areas.map(i=>e.jsxs("section",{className:"saved-area-section",children:[e.jsx("h2",{className:"saved-area-heading",children:i.name}),i.tasks.map(s=>{const l=s.papers.length;return e.jsxs("div",{className:"saved-task-block",children:[e.jsxs("div",{className:"saved-task-row",children:[s.slug?e.jsx(b,{slug:s.slug,label:s.name}):e.jsx("span",{className:"tag-chip",style:{background:"var(--surface)"},children:s.name}),e.jsxs("span",{className:"saved-task-count",children:[l," ",l===1?"paper":"papers"]})]}),e.jsx("div",{className:"paper-list",children:s.papers.map(p=>e.jsx(f,{paper:w(p),rank:1},p.id))})]},`task-${i.id??"other"}-${s.id??"untagged"}`)})]},`area-${i.id??"other"}`))]}):e.jsxs("div",{className:"page",children:[e.jsx("div",{className:"feed-header",children:e.jsxs("div",{children:[e.jsxs("h1",{className:"feed-title",children:["Saved ",e.jsx("em",{children:"Papers"})]}),e.jsx("div",{className:"feed-subtitle",children:"Sign in with Hugging Face to save papers and revisit them later."})]})}),e.jsx("div",{className:"saved-signin-panel",children:e.jsx(v,{returnTo:"/saved"})})]})};export{T as default};
|
assets/{SearchOverlay-CeaAljfc.js → SearchOverlay-BA-6aIAF.js}
RENAMED
|
@@ -1 +1 @@
|
|
| 1 |
-
import{r as C,u as L,R as T,i as $,j as s,c as m}from"./index-
|
|
|
|
| 1 |
+
import{r as C,u as L,R as T,i as $,j as s,c as m}from"./index-Bthypk3Q.js";import{u as p}from"./useQuery-CEDDm0wh.js";import{L as A}from"./LatexTitle-DOmMcoZ0.js";import{u as D}from"./useDebounce-yl1_aMxA.js";import{c as z,h as M,d as B}from"./transform-_T5o_x_w.js";import"./katex.min-BSBacQyE.js";const I=10,H=({open:n,onClose:l})=>{var f,_,F,q,E,P;const v=C.useRef(null),w=L(),[c,R]=T.useState(""),[h,g]=T.useState(1),a=D(c,200),x=$();C.useEffect(()=>{var r;if(!n)return;(r=v.current)==null||r.focus();const e=K=>{K.key==="Escape"&&l()};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[n,l]);const t=p({queryKey:["search-papers",a,h],queryFn:()=>m.searchPapers(a,h,I),enabled:n&&a.length>=2,staleTime:6e4}),k=p({queryKey:["search-tasks",a],queryFn:()=>m.getTasks({q:a,page_size:6}),enabled:n&&a.length>=2,staleTime:6e4}),y=p({queryKey:["search-methods",a],queryFn:()=>m.getMethods({q:a,page_size:6}),enabled:n&&a.length>=2,staleTime:6e4}),N=p({queryKey:["search-benchmarks",a],queryFn:()=>m.getDatasets({q:a,page_size:6}),enabled:n&&a.length>=2,staleTime:6e4});if(!n)return null;const o=((f=k.data)==null?void 0:f.results)||[],d=((_=y.data)==null?void 0:_.results)||[],u=((F=N.data)==null?void 0:F.results)||[],j=((q=t.data)==null?void 0:q.results)||[],Q=t.isFetching||k.isFetching||y.isFetching||N.isFetching,S=o.length||j.length||d.length||u.length,i=e=>{l(),w(e)},b=()=>{const e=c.trim();e&&i(`/chat?q=${encodeURIComponent(e)}`)};return s.jsx("div",{className:"search-overlay",onClick:l,children:s.jsxs("div",{className:"search-modal",onClick:e=>e.stopPropagation(),children:[s.jsx("input",{ref:v,className:"search-modal-input",placeholder:"Search papers, tasks, methods, or benchmarks…",value:c,onChange:e=>{R(e.target.value),g(1)},onKeyDown:e=>{x&&e.key==="Enter"&&(e.preventDefault(),b())}}),s.jsxs("div",{className:"search-results",children:[x&&c.trim()&&s.jsxs("button",{type:"button",className:"search-ask-row",onClick:b,children:[s.jsx("span",{className:"search-ask-chip",children:"assistant"}),s.jsxs("span",{className:"search-ask-text",children:["Ask: “",c.trim(),"”"]}),s.jsx("kbd",{children:"↵"})]}),!a&&s.jsxs("div",{className:"search-empty",children:["Try “diffusion”, “object detection”, or an arXiv id.",x&&s.jsx("span",{className:"search-empty-sub",children:"Press Enter to ask the assistant"})]}),a&&!Q&&!S&&s.jsxs("div",{className:"search-empty",children:['No matches for "',c,'"']}),o.length>0&&s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"search-section-label",children:["Tasks · ",o.length]}),o.map(e=>{const r=z(M(e.slug||""));return s.jsxs("div",{className:"search-result-tag",onClick:()=>i(`/tasks/${e.slug}`),children:[s.jsx("span",{className:"dot",style:{width:6,height:6,borderRadius:"50%",background:r.dot}}),s.jsx("span",{className:"name",children:B(e.name,e.slug)}),e.paper_count!=null&&s.jsxs("span",{className:"count",children:[e.paper_count," papers"]})]},e.id)})]}),d.length>0&&s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"search-section-label",children:["Methods · ",d.length]}),d.map(e=>s.jsxs("div",{className:"search-result-tag",onClick:()=>i(`/methods/${e.slug||e.id}`),children:[s.jsx("span",{style:{fontFamily:"var(--mono)",fontWeight:600},children:e.name}),e.paper_count!=null&&s.jsxs("span",{className:"count",children:[e.paper_count," papers"]})]},e.id))]}),u.length>0&&s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"search-section-label",children:["Benchmarks · ",u.length]}),u.map(e=>s.jsxs("div",{className:"search-result-tag",onClick:()=>i(`/benchmark/${e.slug||e.id}`),children:[s.jsx("span",{className:"name",children:e.name}),e.paper_count!=null&&e.paper_count>0&&s.jsxs("span",{className:"count",children:[e.paper_count," entries"]})]},e.id))]}),j.length>0&&s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"search-section-label",children:["Papers · page ",h]}),j.map(e=>{var r;return s.jsxs("div",{className:"search-result",onClick:()=>i(`/paper/${e.arxiv_id||e.id}`),children:[s.jsx("div",{className:"search-result-title",children:s.jsx(A,{title:e.title})}),s.jsxs("div",{className:"search-result-meta",children:[s.jsx("span",{children:e.arxiv_id?`arXiv:${e.arxiv_id}`:"External resource"}),((r=e.authors)==null?void 0:r[0])&&s.jsxs(s.Fragment,{children:[s.jsx("span",{children:"·"}),s.jsxs("span",{children:[e.authors[0],e.authors.length>1?" et al.":""]})]}),e.citation_count!=null&&s.jsxs(s.Fragment,{children:[s.jsx("span",{children:"·"}),s.jsxs("span",{children:["↑ ",e.citation_count.toLocaleString()]})]})]})]},e.id)}),(((E=t.data)==null?void 0:E.previous_page)||((P=t.data)==null?void 0:P.next_page))&&s.jsxs("div",{className:"search-paper-pagination",children:[s.jsx("button",{type:"button",disabled:!t.data.previous_page||t.isFetching,onClick:()=>{var e;return g(((e=t.data)==null?void 0:e.previous_page)||1)},children:"Previous"}),s.jsxs("span",{children:["Page ",h]}),s.jsx("button",{type:"button",disabled:!t.data.next_page||t.isFetching,onClick:()=>{var e;(e=t.data)!=null&&e.next_page&&g(t.data.next_page)},children:"Next"})]})]})]})]})})};export{H as default};
|
assets/{SettingsView-yjmiOa9c.js → SettingsView-0k3WbHkQ.js}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
| 1 |
-
import{d as w,g as W,Z as L,as as K,i as V,R as d,k as Z,j as e,aa as u,e as M,b as G,c as N,A as q}from"./index-
|
| 2 |
* @license lucide-react v0.462.0 - ISC
|
| 3 |
*
|
| 4 |
* This source code is licensed under the ISC license.
|
|
|
|
| 1 |
+
import{d as w,g as W,Z as L,as as K,i as V,R as d,k as Z,j as e,aa as u,e as M,b as G,c as N,A as q}from"./index-Bthypk3Q.js";import{u as J}from"./useQuery-CEDDm0wh.js";import{u as x}from"./useMutation-dfvOlXzD.js";import{S as A}from"./switch-B0Xhzkpy.js";import{f as X,D as ee}from"./latexPlainText-DI8YEXVe.js";import{b as se,u as ne,r as te,a as k}from"./openrouter-WjyHzpt9.js";import{E as H}from"./external-link-CSzPhnVI.js";import"./index-CqkTYlMR.js";/**
|
| 2 |
* @license lucide-react v0.462.0 - ISC
|
| 3 |
*
|
| 4 |
* This source code is licensed under the ISC license.
|
assets/SharedChatView-B_ppc17g.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
import{f as g,u as x,r as u,j as e,b as f}from"./index-Bthypk3Q.js";import{u as v}from"./useQuery-CEDDm0wh.js";import{C as j,U as S,A as y}from"./ChatMessage-Dx3LmUoF.js";import{v as p,m as b,w as N,q,x as C}from"./chatSessions-nz97TbnH.js";import"./katex.min-BSBacQyE.js";import"./hover-card-Dy9hZi_x.js";import"./PaperPreviewLink-DajWspZH.js";import"./index-SizWVsV-.js";import"./file-text-SORg5JWW.js";const k=({detail:d})=>{const[i,h]=u.useState(()=>N(d)),n=u.useMemo(()=>{const t={};for(const a of i)for(const s of a.blocks??[])if(s.kind==="tool")for(const r of s.results??[])t[r.route_id]=r;return t},[i]),l=(t,a)=>{h(s=>s.map(r=>{var o;return r.id!==t?r:{...r,blocks:(o=r.blocks)==null?void 0:o.map((c,m)=>m===a&&(c.kind==="reasoning"||c.kind==="tool")?{...c,open:!c.open}:c)}}))};return e.jsx("div",{className:"shared-chat-transcript",children:i.map(t=>t.role==="user"?e.jsx(S,{id:t.id,text:t.text??"",paperMentions:t.paperMentions??[]},t.id):e.jsx(y,{msg:t,papers:n,onToggleBlock:l},t.id))})},B=()=>{const{shareId:d=""}=g(),i=x(),h=f(),n=v({queryKey:["shared-chat",d],queryFn:()=>C(d),retry:(a,s)=>!(s instanceof p&&s.status===404)&&a<1});u.useEffect(()=>{const a=document.title,s=document.head.querySelector('meta[name="robots"]'),r=s==null?void 0:s.content,o=s??document.createElement("meta");return o.name="robots",o.content="noindex,nofollow",s||document.head.appendChild(o),document.title="Shared conversation",()=>{document.title=a,s?s.content=r??"":o.remove()}},[]);const l=a=>{q(a,void 0,{autoSend:!1}),i("/chat")},t=n.error instanceof p&&n.error.status===404;return n.isLoading?e.jsxs("div",{className:"shared-chat-state",role:"status",children:[e.jsx(b,{})," Loading shared conversation…"]}):t?e.jsxs("div",{className:"shared-chat-state shared-chat-not-found",children:[e.jsx("h1",{children:"Shared conversation not found"}),e.jsx("p",{children:"This link is invalid or is no longer available."})]}):n.isError||!n.data?e.jsxs("div",{className:"shared-chat-state",role:"alert",children:[e.jsx("h1",{children:"Couldn’t load this conversation"}),e.jsx("p",{children:"Please check your connection and try again."}),e.jsx("button",{type:"button",onClick:()=>void n.refetch(),children:"Try again"})]}):e.jsxs("div",{className:"shared-chat-page",children:[e.jsxs("div",{className:"shared-chat-heading",children:[e.jsx("h1",{children:"Shared conversation"}),h&&e.jsx("span",{className:"chat-staging-badge",children:"Staging"})]}),e.jsxs("div",{className:"shared-chat-content",children:[e.jsx(k,{detail:n.data},n.data.updated_at),e.jsxs("section",{className:"shared-chat-fresh","aria-labelledby":"shared-chat-fresh-title",children:[e.jsx("h2",{id:"shared-chat-fresh-title",children:"Start a new conversation"}),e.jsx("p",{children:"Your new question starts with an empty context."}),h&&e.jsxs("div",{className:"shared-chat-access-note",role:"note",children:[e.jsx("strong",{children:"Limited staging preview."})," Starting a chat is available only to approved Hugging Face users. Hugging Face models also require the Inference Providers permission granted during sign-in; choose personal or organization billing in"," ",e.jsx("a",{href:"/settings",children:"Settings"}),"."]}),e.jsx(j,{onSend:a=>l(a.text),placeholder:"Ask a new research question…"})]})]})]})};export{B as default};
|
assets/SharedChatView-D0V9M4AO.js
DELETED
|
@@ -1 +0,0 @@
|
|
| 1 |
-
import{f as g,u as f,r as u,j as e,b as x}from"./index-NKCYgxaj.js";import{u as v}from"./useQuery--AC_S866.js";import{C as j,U as S,A as y}from"./ChatMessage-CsmlLd6Q.js";import{v as m,m as b,w as N,q,x as C}from"./chatSessions-Bv5yO1zx.js";import"./katex.min-BSBacQyE.js";import"./hover-card-Z7w-9YtT.js";import"./PaperPreviewLink-syrag20a.js";import"./index-S59lkwkS.js";const k=({detail:d})=>{const[i,h]=u.useState(()=>N(d)),a=u.useMemo(()=>{const t={};for(const n of i)for(const s of n.blocks??[])if(s.kind==="tool")for(const r of s.results??[])t[r.route_id]=r;return t},[i]),l=(t,n)=>{h(s=>s.map(r=>{var o;return r.id!==t?r:{...r,blocks:(o=r.blocks)==null?void 0:o.map((c,p)=>p===n&&(c.kind==="reasoning"||c.kind==="tool")?{...c,open:!c.open}:c)}}))};return e.jsx("div",{className:"shared-chat-transcript",children:i.map(t=>t.role==="user"?e.jsx(S,{id:t.id,text:t.text??""},t.id):e.jsx(y,{msg:t,papers:a,onToggleBlock:l},t.id))})},U=()=>{const{shareId:d=""}=g(),i=f(),h=x(),a=v({queryKey:["shared-chat",d],queryFn:()=>C(d),retry:(n,s)=>!(s instanceof m&&s.status===404)&&n<1});u.useEffect(()=>{const n=document.title,s=document.head.querySelector('meta[name="robots"]'),r=s==null?void 0:s.content,o=s??document.createElement("meta");return o.name="robots",o.content="noindex,nofollow",s||document.head.appendChild(o),document.title="Shared conversation",()=>{document.title=n,s?s.content=r??"":o.remove()}},[]);const l=n=>{q(n,void 0,{autoSend:!1}),i("/chat")},t=a.error instanceof m&&a.error.status===404;return a.isLoading?e.jsxs("div",{className:"shared-chat-state",role:"status",children:[e.jsx(b,{})," Loading shared conversation…"]}):t?e.jsxs("div",{className:"shared-chat-state shared-chat-not-found",children:[e.jsx("h1",{children:"Shared conversation not found"}),e.jsx("p",{children:"This link is invalid or is no longer available."})]}):a.isError||!a.data?e.jsxs("div",{className:"shared-chat-state",role:"alert",children:[e.jsx("h1",{children:"Couldn’t load this conversation"}),e.jsx("p",{children:"Please check your connection and try again."}),e.jsx("button",{type:"button",onClick:()=>void a.refetch(),children:"Try again"})]}):e.jsxs("div",{className:"shared-chat-page",children:[e.jsxs("div",{className:"shared-chat-heading",children:[e.jsx("h1",{children:"Shared conversation"}),h&&e.jsx("span",{className:"chat-staging-badge",children:"Staging"})]}),e.jsxs("div",{className:"shared-chat-content",children:[e.jsx(k,{detail:a.data},a.data.updated_at),e.jsxs("section",{className:"shared-chat-fresh","aria-labelledby":"shared-chat-fresh-title",children:[e.jsx("h2",{id:"shared-chat-fresh-title",children:"Start a new conversation"}),e.jsx("p",{children:"Your new question starts with an empty context."}),h&&e.jsxs("div",{className:"shared-chat-access-note",role:"note",children:[e.jsx("strong",{children:"Limited staging preview."})," Starting a chat is available only to approved Hugging Face users. Hugging Face models also require the Inference Providers permission granted during sign-in; choose personal or organization billing in"," ",e.jsx("a",{href:"/settings",children:"Settings"}),"."]}),e.jsx(j,{onSend:l,placeholder:"Ask a new research question…"})]})]})]})};export{U as default};
|
|
|
|
|
|
assets/{SignInToEditDialog-CGTjmLU3.js → SignInToEditDialog-BPVN69wP.js}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
| 1 |
-
import{d as ne,r as a,j as e,a8 as pe,v as xe,a9 as fe,h as ve,w as je,X as be,C as ye,aa as Ne}from"./index-
|
| 2 |
* @license lucide-react v0.462.0 - ISC
|
| 3 |
*
|
| 4 |
* This source code is licensed under the ISC license.
|
|
|
|
| 1 |
+
import{d as ne,r as a,j as e,a8 as pe,v as xe,a9 as fe,h as ve,w as je,X as be,C as ye,aa as Ne}from"./index-Bthypk3Q.js";import{B as M}from"./button-DH3x5IsG.js";import{I as c,T as we}from"./textarea-CMKu47Xo.js";import{D as ie,a as oe,b as le,c as ce,d as de,e as Ie}from"./dialog-DDnKVGO8.js";import{u as Se}from"./useMutation-dfvOlXzD.js";import{L as De}from"./loader-circle-BFDpPsTy.js";/**
|
| 2 |
* @license lucide-react v0.462.0 - ISC
|
| 3 |
*
|
| 4 |
* This source code is licensed under the ISC license.
|
assets/{SubmissionsDashboard-DD4Zn2r9.js → SubmissionsDashboard-CPBjBX6M.js}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
| 1 |
-
var pe=s=>{throw TypeError(s)};var P=(s,t,i)=>t.has(s)||pe("Cannot "+i);var f=(s,t,i)=>(P(s,t,"read from private field"),i?i.call(s):t.get(s)),C=(s,t,i)=>t.has(s)?pe("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(s):t.set(s,i),v=(s,t,i,n)=>(P(s,t,"write to private field"),n?n.call(s,i):t.set(s,i),i),R=(s,t,i)=>(P(s,t,"access private method"),i);import{ax as Oe,ay as se,az as Me,aA as Fe,k as Se,r as $,aB as Qe,d as qe,j as e,aC as we,aD as Ie,R as _,v as q,aE as De,a2 as Ue,g as Le,h as Ee,ap as $e,aF as Te,aG as Be,aH as He,aI as ze,aJ as Je,aK as te}from"./index-
|
| 2 |
* @license lucide-react v0.462.0 - ISC
|
| 3 |
*
|
| 4 |
* This source code is licensed under the ISC license.
|
|
|
|
| 1 |
+
var pe=s=>{throw TypeError(s)};var P=(s,t,i)=>t.has(s)||pe("Cannot "+i);var f=(s,t,i)=>(P(s,t,"read from private field"),i?i.call(s):t.get(s)),C=(s,t,i)=>t.has(s)?pe("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(s):t.set(s,i),v=(s,t,i,n)=>(P(s,t,"write to private field"),n?n.call(s,i):t.set(s,i),i),R=(s,t,i)=>(P(s,t,"access private method"),i);import{ax as Oe,ay as se,az as Me,aA as Fe,k as Se,r as $,aB as Qe,d as qe,j as e,aC as we,aD as Ie,R as _,v as q,aE as De,a2 as Ue,g as Le,h as Ee,ap as $e,aF as Te,aG as Be,aH as He,aI as ze,aJ as Je,aK as te}from"./index-Bthypk3Q.js";import{Q as Ce,b as Ke,c as We,e as Ge,d as Ve,f as Ye,s as ge,g as Xe,h as Ze,u as je}from"./useQuery-CEDDm0wh.js";import{u as xe}from"./useMutation-dfvOlXzD.js";import{s as B}from"./safeExternalHref-CkBrsh84.js";import{R as Pe,S as es,C as ss,a as ts}from"./shield-alert-CXSHgfgj.js";import{L as H}from"./loader-circle-BFDpPsTy.js";function be(s,t){const i=new Set(t);return s.filter(n=>!i.has(n))}function is(s,t,i){const n=s.slice(0);return n[t]=i,n}var U,k,L,D,S,Q,z,J,K,W,b,ie,ne,Re,re,ae,ce,ke,ns=(ke=class extends Oe{constructor(t,i,n){super();C(this,b);C(this,U);C(this,k);C(this,L);C(this,D);C(this,S);C(this,Q);C(this,z);C(this,J);C(this,K);C(this,W,[]);v(this,U,t),v(this,D,n),v(this,L,[]),v(this,S,[]),v(this,k,[]),this.setQueries(i)}onSubscribe(){this.listeners.size===1&&f(this,S).forEach(t=>{t.subscribe(i=>{R(this,b,ae).call(this,t,i)})})}onUnsubscribe(){this.listeners.size||this.destroy()}destroy(){this.listeners=new Set,f(this,S).forEach(t=>{t.destroy()})}setQueries(t,i){v(this,L,t),v(this,D,i),se.batch(()=>{const n=f(this,S),r=R(this,b,re).call(this,f(this,L));r.forEach(a=>a.observer.setOptions(a.defaultedQueryOptions));const c=r.map(a=>a.observer),o=c.map(a=>a.getCurrentResult()),m=n.length!==c.length,h=c.some((a,l)=>a!==n[l]),p=m||h,x=p?!0:o.some((a,l)=>{const u=f(this,k)[l];return!u||!Me(a,u)});!p&&!x||(p&&(v(this,W,r),v(this,S,c)),v(this,k,o),this.hasListeners()&&(p&&(be(n,c).forEach(a=>{a.destroy()}),be(c,n).forEach(a=>{a.subscribe(l=>{R(this,b,ae).call(this,a,l)})})),R(this,b,ce).call(this)))})}getCurrentResult(){return f(this,k)}getQueries(){return f(this,S).map(t=>t.getCurrentQuery())}getObservers(){return f(this,S)}getOptimisticResult(t,i){const n=R(this,b,re).call(this,t),r=n.map(o=>o.observer.getOptimisticResult(o.defaultedQueryOptions)),c=n.map(o=>o.defaultedQueryOptions.queryHash);return[r,o=>R(this,b,ne).call(this,o??r,i,c),()=>R(this,b,ie).call(this,r,n)]}},U=new WeakMap,k=new WeakMap,L=new WeakMap,D=new WeakMap,S=new WeakMap,Q=new WeakMap,z=new WeakMap,J=new WeakMap,K=new WeakMap,W=new WeakMap,b=new WeakSet,ie=function(t,i){return i.map((n,r)=>{const c=t[r];return n.defaultedQueryOptions.notifyOnChangeProps?c:n.observer.trackResult(c,o=>{i.forEach(m=>{m.observer.trackProp(o)})})})},ne=function(t,i,n){if(i){const r=f(this,K),c=n!==void 0&&r!==void 0&&(r.length!==n.length||n.some((o,m)=>o!==r[m]));return(!f(this,Q)||f(this,k)!==f(this,J)||c||i!==f(this,z))&&(v(this,z,i),v(this,J,f(this,k)),n!==void 0&&v(this,K,n),v(this,Q,Fe(f(this,Q),i(t)))),f(this,Q)}return t},Re=function(){var t;return((t=f(this,D))==null?void 0:t.combine)!==void 0&&f(this,S).some((i,n)=>{var r;return i.options.suspense&&((r=f(this,k)[n])==null?void 0:r.data)===void 0})},re=function(t){const i=new Map;f(this,S).forEach(r=>{const c=r.options.queryHash;if(!c)return;const o=i.get(c);o?o.push(r):i.set(c,[r])});const n=[];return t.forEach(r=>{var h;const c=f(this,U).defaultQueryOptions(r),m=((h=i.get(c.queryHash))==null?void 0:h.shift())??new Ce(f(this,U),c);n.push({defaultedQueryOptions:c,observer:m})}),n},ae=function(t,i){const n=f(this,S).indexOf(t);n!==-1&&(v(this,k,is(f(this,k),n,i)),R(this,b,ce).call(this))},ce=function(){var t;if(this.hasListeners()){const i=R(this,b,ie).call(this,f(this,k),f(this,W)),n=R(this,b,Re).call(this),r=f(this,Q),c=n?r:R(this,b,ne).call(this,i,(t=f(this,D))==null?void 0:t.combine);(n||r!==c)&&se.batch(()=>{this.listeners.forEach(o=>{o(f(this,k))})})}},ke);function X({queries:s,...t},i){const n=Se(),r=Ke(),c=We(),o=$.useMemo(()=>s.map(d=>{const w=n.defaultQueryOptions(d);return w._optimisticResults=r?"isRestoring":"optimistic",w}),[s,n,r]);o.forEach(d=>{Ge(d);const w=n.getQueryCache().get(d.queryHash);Ve(d,c,w)}),Ye(c);const[m]=$.useState(()=>new ns(n,o,t)),[h,p,x]=m.getOptimisticResult(o,t.combine),a=!r&&t.subscribed!==!1;$.useSyncExternalStore($.useCallback(d=>a?m.subscribe(se.batchCalls(d)):Qe,[m,a]),()=>m.getCurrentResult(),()=>m.getCurrentResult()),$.useEffect(()=>{m.setQueries(o,t)},[o,t,m]);const u=h.some((d,w)=>ge(o[w],d))?h.flatMap((d,w)=>{const E=o[w];if(E&&ge(E,d)){const I=new Ce(n,E);return Xe(E,I,c)}return[]}):[];if(u.length>0)throw Promise.all(u);const g=h.find((d,w)=>{const E=o[w];return E&&Ze({result:d,errorResetBoundary:c,throwOnError:E.throwOnError,query:n.getQueryCache().get(E.queryHash),suspense:E.suspense})});if(g!=null&&g.error)throw g.error;return p(x())}/**
|
| 2 |
* @license lucide-react v0.462.0 - ISC
|
| 3 |
*
|
| 4 |
* This source code is licensed under the ISC license.
|
assets/{SubmitView-DWznPena.js → SubmitView-LhfSq6TM.js}
RENAMED
|
@@ -1 +1 @@
|
|
| 1 |
-
import{u as k,k as D,h as C,g as E,R as d,j as e,V as L,at as z}from"./index-
|
|
|
|
| 1 |
+
import{u as k,k as D,h as C,g as E,R as d,j as e,V as L,at as z}from"./index-Bthypk3Q.js";import{u as F}from"./useMutation-dfvOlXzD.js";import{A as X,a as q}from"./alert-DJmmSiqi.js";import{B as _}from"./button-DH3x5IsG.js";import{I as g,T as N}from"./textarea-CMKu47Xo.js";const v="pwc:paper-submit-draft",U=/^\d{4}\.\d{4,5}(v\d+)?$/i,$=/^[a-z-]+(\.[A-Z]{2})?\/\d{7}$/,O=/^https?:\/\/(?:www\.)?arxiv\.org\//i;function R(n){const i=n.trim();return i?U.test(i)||$.test(i)||O.test(i)?"arxiv":/^https?:\/\//i.test(i)?"external":"arxiv":"empty"}function V(n,i){const a=n.trim();if(R(a)==="arxiv")return/^https?:\/\//i.test(a)?{source_url:a}:{arxiv_id:a};const o={source_url:a},l=i.title.trim();l&&(o.title=l);const p=i.abstract.trim();p&&(o.abstract=p);const u=i.authors.split(/[,\n]/).map(h=>h.trim()).filter(Boolean);return u.length>0&&(o.authors=u),i.datePublished&&(o.date_published=i.datePublished),o}function B(n){var a;const i=n;if(!i)return"Submission failed";if(i.response)try{const s=JSON.parse(i.response);if(typeof s.detail=="string")return s.detail;if((a=s.detail)!=null&&a.message)return`${s.detail.message} See ${s.detail.help||"/rate-limits"} for help.`}catch{return i.response}return i.message||"Submission failed"}const W=()=>{const n=k(),i=D(),{toast:a}=C(),{user:s,isLoading:o}=E(),[l,p]=d.useState(""),[u,h]=d.useState(""),[f,S]=d.useState(""),[x,j]=d.useState(""),[b,w]=d.useState(""),[I,y]=d.useState(null);d.useEffect(()=>{const t=sessionStorage.getItem(v);if(t){sessionStorage.removeItem(v);try{const r=JSON.parse(t);p(r.input??""),h(r.title??""),S(r.abstract??""),j(r.authors??""),w(r.datePublished??"")}catch{}}},[]);const m=R(l),A=m==="external",c=F({mutationFn:t=>z(t),onSuccess:t=>{if(t.pending_review){a({title:"Submission queued for review",description:"No source page was fetched and no catalog row was changed."}),c.reset();return}i.invalidateQueries({queryKey:["papers"],refetchType:"none"}),i.invalidateQueries({queryKey:["papers-infinite"],refetchType:"none"}),i.invalidateQueries({queryKey:["trending-papers"],refetchType:"none"});const r=t.refreshed&&t.created&&t.latest_version;a({title:r?`Paper updated to ${t.latest_version}`:t.created?"Paper submitted":"Paper already indexed",description:r?"Opening the updated paper page…":t.created?"Opening the paper page…":"Opening the existing paper page…"}),t.route_identifier&&n(`/paper/${t.route_identifier}`)},onError:t=>{y(B(t))}}),P=t=>{if(t.preventDefault(),y(null),m==="empty"){y("Enter an arXiv ID or a paper URL to submit.");return}if(!s){sessionStorage.setItem(v,JSON.stringify({input:l,title:u,abstract:f,authors:x,datePublished:b}));const T=L("/api/v1/auth/hf/login");window.location.assign(`${T}?return_to=${encodeURIComponent(window.location.href)}`);return}const r=V(l,{title:u,abstract:f,authors:x,datePublished:b});c.mutate(r)};return e.jsxs("div",{className:"page",style:{maxWidth:720},children:[e.jsx("h1",{className:"detail-title",children:"Submit a paper"}),e.jsxs("p",{style:{fontFamily:"var(--serif)",color:"var(--ink-soft)",marginTop:12,lineHeight:1.55},children:["Index an arXiv paper or propose a non-arXiv paper (blog post, technical report, model release page). External papers enter the submission queue and appear only after review."," ",e.jsx("a",{href:"/rate-limits",children:"Read the submission and rate-limit policy."})]}),e.jsxs("form",{onSubmit:P,style:{marginTop:28,display:"grid",gap:20},children:[e.jsxs("div",{style:{display:"grid",gap:8},children:[e.jsx("label",{htmlFor:"submit-input",style:{fontWeight:600,fontSize:14},children:"arXiv ID or paper URL"}),e.jsx(g,{id:"submit-input",value:l,onChange:t=>p(t.target.value),placeholder:"2501.12345 · https://arxiv.org/abs/2501.12345 · https://blog.example.com/release",autoFocus:!0,required:!0}),e.jsx("div",{style:{fontSize:12,color:"var(--ink-soft)",minHeight:18},children:m==="arxiv"?"Detected: arXiv paper — metadata will be fetched automatically.":m==="external"?"Detected: external URL — we'll extract metadata and you can override below.":"Paste an arXiv ID like 2501.12345 or any paper/blog URL."})]}),A&&e.jsxs("fieldset",{style:{border:"1px solid var(--rule)",borderRadius:8,padding:"16px 20px 20px",display:"grid",gap:16},children:[e.jsx("legend",{style:{padding:"0 8px",fontSize:12,color:"var(--ink-soft)",textTransform:"uppercase",letterSpacing:.5},children:"External paper details (optional)"}),e.jsxs("div",{style:{display:"grid",gap:8},children:[e.jsx("label",{htmlFor:"submit-title",style:{fontSize:13},children:"Title"}),e.jsx(g,{id:"submit-title",value:u,onChange:t=>h(t.target.value),placeholder:"Leave blank to extract automatically"})]}),e.jsxs("div",{style:{display:"grid",gap:8},children:[e.jsx("label",{htmlFor:"submit-abstract",style:{fontSize:13},children:"Abstract or summary"}),e.jsx(N,{id:"submit-abstract",value:f,onChange:t=>S(t.target.value),rows:4,placeholder:"Leave blank to extract automatically"})]}),e.jsxs("div",{style:{display:"grid",gap:8},children:[e.jsx("label",{htmlFor:"submit-authors",style:{fontSize:13},children:"Authors (comma-separated)"}),e.jsx(g,{id:"submit-authors",value:x,onChange:t=>j(t.target.value),placeholder:"Jane Smith, John Doe"})]}),e.jsxs("div",{style:{display:"grid",gap:8},children:[e.jsx("label",{htmlFor:"submit-date",style:{fontSize:13},children:"Publication date"}),e.jsx(g,{id:"submit-date",type:"date",value:b,onChange:t=>w(t.target.value),style:{maxWidth:220}}),e.jsx("div",{style:{fontSize:12,color:"var(--ink-soft)"},children:"Required only if we cannot infer a date from the page."})]})]}),I&&e.jsx(X,{variant:"destructive",children:e.jsx(q,{children:I})}),e.jsxs("div",{style:{display:"flex",gap:12,alignItems:"center"},children:[e.jsx(_,{type:"submit",disabled:c.isPending||o,children:o?"Checking sign-in…":c.isPending?"Submitting…":s?"Submit paper":"Sign in to submit"}),e.jsx(_,{type:"button",variant:"outline",onClick:()=>n(-1),disabled:c.isPending,children:"Cancel"})]})]})]})};export{W as default};
|
assets/{TagBrowseView-B-2s2DBb.js → TagBrowseView-k-uxlt-5.js}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
| 1 |
-
import{d as fe,r as h,o as Y,j as e,n as F,a5 as be,q as je,P as Je,t as _e,p as ve,a6 as Xe,R as _,a7 as es,O as ss,v as J,L as A,f as as,u as ts,a as ns,Z as rs,a2 as os,c as xe}from"./index-
|
| 2 |
* @license lucide-react v0.462.0 - ISC
|
| 3 |
*
|
| 4 |
* This source code is licensed under the ISC license.
|
|
|
|
| 1 |
+
import{d as fe,r as h,o as Y,j as e,n as F,a5 as be,q as je,P as Je,t as _e,p as ve,a6 as Xe,R as _,a7 as es,O as ss,v as J,L as A,f as as,u as ts,a as ns,Z as rs,a2 as os,c as xe}from"./index-Bthypk3Q.js";import{u as ge}from"./useQuery-CEDDm0wh.js";import{P as cs,M as is}from"./components-DR4nXlac.js";import{B as ls}from"./BenchmarkTrendSparkline-DE8DNEAu.js";import{u as ds,P as ms}from"./useIntersectionObserver-BrrNIU67.js";import{M as Q}from"./MarkdownText-DX4YTOrq.js";import{t as ps,d as V}from"./transform-_T5o_x_w.js";import{b as hs}from"./usePapers-BGjLgFkG.js";import{S as U}from"./skeleton-BS-Px_iI.js";import{A as us,a as xs}from"./alert-DJmmSiqi.js";import{C as gs}from"./chevron-down-X5yQfbpI.js";import{G as fs}from"./github-B57w8ODD.js";import"./LatexTitle-DOmMcoZ0.js";import"./katex.min-BSBacQyE.js";import"./safeExternalHref-CkBrsh84.js";import"./PaperPreviewLink-DajWspZH.js";import"./index-SizWVsV-.js";import"./hover-card-Dy9hZi_x.js";import"./useInfiniteQuery-KqL5cNCq.js";/**
|
| 2 |
* @license lucide-react v0.462.0 - ISC
|
| 3 |
*
|
| 4 |
* This source code is licensed under the ISC license.
|
assets/{TagsIndexView-CSkGydzs.js → TagsIndexView-Dh5Mjjhn.js}
RENAMED
|
@@ -1 +1 @@
|
|
| 1 |
-
import{r as d,j as s,L as p,c as h}from"./index-
|
|
|
|
| 1 |
+
import{r as d,j as s,L as p,c as h}from"./index-Bthypk3Q.js";import{u as g}from"./useQuery-CEDDm0wh.js";import{c as x,h as f,d as u}from"./transform-_T5o_x_w.js";import{S as m}from"./skeleton-BS-Px_iI.js";import{A as j,a as y}from"./alert-DJmmSiqi.js";import{T as k}from"./TaxonomySuggestionTile-BOiZOkbr.js";import"./SignInToEditDialog-BPVN69wP.js";import"./button-DH3x5IsG.js";import"./textarea-CMKu47Xo.js";import"./dialog-DDnKVGO8.js";import"./useMutation-dfvOlXzD.js";import"./loader-circle-BFDpPsTy.js";const v=r=>(r==null?void 0:r.trim().toLowerCase().replace(/[\s_]+/g,"-"))??"",D=()=>{const r=g({queryKey:["areas-with-tasks"],queryFn:()=>h.getAreasWithTasks(),staleTime:6e5}),o=d.useMemo(()=>{if(!r.data)return[];const e={general:0,vision:1,video:2,language:3,audio:4,other:5},t=n=>e[v(n)]??999;return[...r.data.results].sort((n,a)=>{const i=t(n.name),l=t(a.name);return i!==l?i-l:n.name.localeCompare(a.name)})},[r.data]),c=d.useMemo(()=>o.reduce((e,t)=>e+t.tasks.length,0),[o]);return r.error?s.jsx("div",{className:"page",children:s.jsx(j,{variant:"destructive",children:s.jsx(y,{children:"Failed to load taxonomy. Please try again."})})}):s.jsxs("div",{className:"page",children:[s.jsx("div",{className:"feed-header",children:s.jsxs("div",{children:[s.jsxs("h1",{className:"feed-title",children:["All ",s.jsx("em",{children:"Domains"})]}),s.jsx("div",{className:"feed-subtitle",children:"Browse research by area. Click any task to see trending work."})]})}),r.isLoading?s.jsx("div",{style:{display:"flex",flexDirection:"column",gap:32},children:Array.from({length:4}).map((e,t)=>s.jsxs("div",{children:[s.jsx(m,{className:"h-8 w-1/3 mb-4"}),s.jsx("div",{className:"tag-grid",children:Array.from({length:6}).map((n,a)=>s.jsx(m,{className:"h-24"},a))})]},t))}):o.map(e=>{const t=e.tasks;if(t.length===0)return null;const n=t.reduce((a,i)=>a+(i.paper_count||0),0);return s.jsxs("section",{style:{marginBottom:48},children:[s.jsxs("div",{style:{display:"flex",alignItems:"baseline",justifyContent:"space-between",gap:24,paddingBottom:12,borderBottom:"1px solid var(--hairline-strong)"},children:[s.jsxs("div",{children:[s.jsx("h2",{style:{fontFamily:"var(--serif)",fontSize:26,fontWeight:500,letterSpacing:"-0.02em",marginBottom:4},children:e.name}),e.description&&s.jsx("div",{style:{fontFamily:"var(--serif)",fontStyle:"italic",fontSize:13,color:"var(--ink-soft)"},children:e.description})]}),s.jsxs("div",{style:{fontFamily:"var(--mono)",fontSize:11,color:"var(--ink-faint)",whiteSpace:"nowrap"},children:[t.length," ",t.length===1?"task":"tasks"," · ",n.toLocaleString()," papers"]})]}),s.jsxs("div",{className:"tag-grid",children:[t.map(a=>{const i=a.slug||"",l=x(f(i));return s.jsxs(p,{to:`/tasks/${i}`,className:"tag-cell",children:[s.jsxs("div",{className:"name",children:[s.jsx("span",{className:"dot",style:{background:l.dot}}),u(a.name,i)]}),s.jsx("div",{className:"meta",children:s.jsxs("span",{children:[(a.paper_count??0).toLocaleString()," papers"]})})]},a.id)}),s.jsx(k,{kind:"task"})]})]},e.id)}),c>0&&s.jsxs("div",{style:{fontFamily:"var(--mono)",fontSize:11,color:"var(--ink-faint)",marginTop:24},children:[c," tasks across ",o.filter(e=>e.tasks.length>0).length," areas."]})]})};export{D as default};
|
assets/{TaxonomySuggestionTile-D2ZiloFX.js → TaxonomySuggestionTile-BOiZOkbr.js}
RENAMED
|
@@ -1 +1 @@
|
|
| 1 |
-
import{g as u,r as o,j as e}from"./index-
|
|
|
|
| 1 |
+
import{g as u,r as o,j as e}from"./index-Bthypk3Q.js";import{P as c,S as m,a as p}from"./SignInToEditDialog-BPVN69wP.js";function h({kind:s}){const{user:a}=u(),[i,n]=o.useState(!1),[l,t]=o.useState(!1),g=`Suggest a new ${s}...`,r=()=>{a?n(!0):t(!0)};return e.jsxs(e.Fragment,{children:[e.jsxs("button",{type:"button",className:"tag-cell taxonomy-suggestion-cell",onClick:r,children:[e.jsxs("div",{className:"name",children:[e.jsx(c,{className:"taxonomy-suggestion-icon","aria-hidden":"true"}),g]}),e.jsx("div",{className:"meta",children:e.jsx("span",{children:"Propose an addition"})})]}),e.jsx(m,{open:i,onOpenChange:n,kind:s}),e.jsx(p,{open:l,onOpenChange:t,sectionLabel:`${s}s`,returnTo:typeof window<"u"?window.location.pathname:`/${s}s`,taxonomySuggestion:!0})]})}export{h as T};
|
assets/{TrendsView-DowfYjDj.js → TrendsView-GQfEX1cx.js}
RENAMED
|
@@ -1 +1 @@
|
|
| 1 |
-
import{c as X,R as G,j as e}from"./index-
|
|
|
|
| 1 |
+
import{c as X,R as G,j as e}from"./index-Bthypk3Q.js";import{u as J}from"./useQuery-CEDDm0wh.js";import{A as q,a as E}from"./alert-DJmmSiqi.js";import{S as P}from"./skeleton-BS-Px_iI.js";const m=t=>{const i=/^(\d{4})-(0[1-9]|1[0-2])$/.exec(t);if(!i)return t;const[,r,l]=i;return`${["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"][Number(l)-1]} '${r.slice(2)}`},Q=()=>X.getResearchTrends(),f=980,j=400,x=62,R=26,g=30,V=58,u=f-x-R,F=j-g-V,v=g+F,Y=t=>{if(t.length<3)return t.map((r,l)=>`${l?"L":"M"}${r[0]} ${r[1]}`).join(" ");let i=`M${t[0][0]} ${t[0][1]}`;for(let r=0;r<t.length-1;r+=1){const l=t[r-1]??t[r],c=t[r],o=t[r+1],a=t[r+2]??o,y=c[0]+(o[0]-l[0])/6,s=c[1]+(o[1]-l[1])/6,b=o[0]-(a[0]-c[0])/6,d=o[1]-(a[1]-c[1])/6;i+=` C ${y} ${s} ${b} ${d} ${o[0]} ${o[1]}`}return i},W={fontFamily:"var(--mono)",fontSize:12,fill:"var(--ink-faint)"},z={fontFamily:"var(--mono)",fontSize:11,fontWeight:600,letterSpacing:"0.14em",fill:"var(--ink-faint)",textTransform:"uppercase"},C=({id:t,data:i,color:r,yTicks:l,yLabel:c,xLabel:o})=>{const[a,y]=G.useState(null),s=i.length,b=l[l.length-1],d=n=>x+u*(s===1?0:n/(s-1)),p=n=>g+F*(1-n/b);if(s===0)return null;const B=i.map((n,h)=>[d(h),p(n.percent)]),A=Y(B),_=`${A} L ${d(s-1)} ${v} L ${x} ${v} Z`,w=s<=12?1:Math.ceil(s/8),O=n=>{const h=n.currentTarget.getBoundingClientRect(),S=(n.clientX-h.left)/h.width*f,k=s>1?u/(s-1):u,I=Math.max(0,Math.min(s-1,Math.round((S-x)/k)));y(I)},H=`trend-gradient-${t}`;return e.jsxs("figure",{className:"trend-chart",children:[e.jsxs("div",{className:"trend-chart-visual",children:[e.jsxs("svg",{viewBox:`0 0 ${f} ${j}`,width:"100%",role:"img","aria-label":`${c} by ${o.toLowerCase()}, from ${m(i[0].month)} (${i[0].percent}%) to ${m(i[s-1].month)} (${i[s-1].percent}%)`,style:{display:"block",overflow:"visible",cursor:"crosshair"},onPointerMove:O,onPointerLeave:()=>y(null),children:[e.jsx("defs",{children:e.jsxs("linearGradient",{id:H,x1:"0",y1:"0",x2:"0",y2:"1",children:[e.jsx("stop",{offset:"0%",style:{stopColor:r,stopOpacity:.26}}),e.jsx("stop",{offset:"100%",style:{stopColor:r,stopOpacity:.02}})]})}),l.map(n=>e.jsxs("g",{children:[e.jsx("line",{x1:x,x2:f-R,y1:p(n),y2:p(n),stroke:"var(--hairline)",strokeWidth:1}),e.jsxs("text",{x:x-14,y:p(n)+4,textAnchor:"end",style:W,children:[n,"%"]})]},n)),e.jsx("path",{d:_,fill:`url(#${H})`}),e.jsx("path",{d:A,fill:"none",stroke:r,strokeWidth:2,strokeLinejoin:"round",strokeLinecap:"round"}),i.map((n,h)=>{const S=h===s-1,k=h%w===0&&s-1-h>=w/2;return!S&&!k?null:e.jsx("text",{x:d(h),y:v+24,textAnchor:"middle",style:W,children:m(n.month)},n.month)}),e.jsx("text",{x:x+u/2,y:j-4,textAnchor:"middle",style:z,children:o}),e.jsx("text",{transform:`translate(16 ${g+F/2}) rotate(-90)`,textAnchor:"middle",style:z,children:c}),a!=null&&e.jsxs(e.Fragment,{children:[e.jsx("line",{x1:d(a),x2:d(a),y1:g,y2:v,stroke:r,strokeWidth:1,strokeDasharray:"3 4",opacity:.5}),e.jsx("circle",{cx:d(a),cy:p(i[a].percent),r:5,fill:"var(--bg)",stroke:r,strokeWidth:2})]})]}),a!=null&&e.jsxs("div",{style:{position:"absolute",left:`${d(a)/f*100}%`,top:`${p(i[a].percent)/j*100}%`,transform:"translate(-50%, calc(-100% - 14px))",background:"var(--bg-elevated)",border:"1px solid var(--hairline)",borderRadius:6,boxShadow:"0 8px 26px rgba(0,0,0,.13)",padding:"7px 12px",pointerEvents:"none",whiteSpace:"nowrap",zIndex:3},children:[e.jsx("div",{style:{fontFamily:"var(--serif)",fontStyle:"italic",color:"var(--ink-faint)",fontSize:13,marginBottom:2},children:m(i[a].month)}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:7,fontFamily:"var(--mono)",fontWeight:600,fontSize:15,color:"var(--ink)"},children:[e.jsx("span",{style:{width:8,height:8,borderRadius:2,background:r,display:"inline-block"}}),i[a].percent,"%"]})]})]}),e.jsxs("details",{className:"trend-chart-table",children:[e.jsx("summary",{style:{fontFamily:"var(--mono)",fontSize:11,letterSpacing:"0.04em",color:"var(--ink-faint)",cursor:"pointer"},children:"View data table"}),e.jsxs("table",{style:{marginTop:8,borderCollapse:"collapse",fontFamily:"var(--mono)",fontSize:12,color:"var(--ink-soft)"},children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{style:{textAlign:"left",padding:"3px 18px 3px 0"},children:o}),e.jsx("th",{style:{textAlign:"right",padding:"3px 0"},children:c})]})}),e.jsx("tbody",{children:i.map(n=>e.jsxs("tr",{children:[e.jsx("td",{style:{padding:"2px 18px 2px 0"},children:m(n.month)}),e.jsxs("td",{style:{textAlign:"right",padding:"2px 0"},children:[n.percent,"%"]})]},n.month))})]})]})]})},$={maxWidth:960,padding:"48px 0 8px",borderTop:"1px solid var(--hairline)",marginTop:48},T={fontFamily:"var(--serif)",fontSize:34,fontWeight:500,letterSpacing:"-0.02em",margin:"0 0 10px",color:"var(--ink)"},L={fontFamily:"var(--serif)",fontSize:18,lineHeight:1.55,color:"var(--ink-soft)",maxWidth:620,margin:"0 0 8px"},M={fontFamily:"var(--mono)",fontSize:12,fontWeight:600,letterSpacing:"0.14em",textTransform:"uppercase",color:"var(--ink-faint)",marginBottom:8},N={fontFamily:"var(--serif)",fontSize:17,lineHeight:1.6,color:"var(--ink-soft)",margin:0},D={height:320,marginTop:26},te=()=>{const t=J({queryKey:["research-trends"],queryFn:Q,staleTime:36e5});return e.jsxs("div",{className:"page",children:[e.jsx("div",{className:"feed-header",children:e.jsxs("div",{children:[e.jsxs("h1",{className:"feed-title",children:["Research ",e.jsx("em",{children:"Trends"})]}),e.jsx("div",{className:"feed-subtitle",children:"How open science is changing across machine learning — tracked over time from arXiv and the Hugging Face Hub."})]})}),t.error&&e.jsx(q,{variant:"destructive",children:e.jsx(E,{children:"Failed to load research trends. Please try again."})}),e.jsxs("section",{style:$,children:[e.jsx("h2",{style:T,children:"Code Availability"}),e.jsx("p",{style:L,children:"The percentage of published papers that have at least one official code implementation on GitHub."}),e.jsx("div",{style:{marginTop:26},children:t.data?e.jsx(C,{id:"code",data:t.data.code_availability,color:"var(--trend-code)",yTicks:[0,20,40,60,80],yLabel:"Code Availability",xLabel:"Paper Publication Date"}):!t.error&&e.jsx(P,{style:D})})]}),e.jsxs("section",{style:$,children:[e.jsx("h2",{style:T,children:"Papers with Hugging Face artifacts"}),e.jsx("p",{style:L,children:"The percentage of published papers linked to at least one Hugging Face artifact — a model, dataset or Space — making the work directly runnable and reusable."}),e.jsx("div",{style:{marginTop:26},children:t.data?e.jsx(C,{id:"hf",data:t.data.hf_artifacts,color:"var(--trend-hf)",yTicks:[0,10,20,30,40,50],yLabel:"HF Artifact Coverage",xLabel:"Paper Publication Date"}):!t.error&&e.jsx(P,{style:D})})]}),e.jsxs("section",{style:{...$,paddingBottom:72},children:[e.jsx("h2",{style:{...T,fontSize:27},children:"How the data is collected"}),e.jsxs("div",{style:{display:"grid",gap:24,maxWidth:680},children:[e.jsxs("div",{children:[e.jsx("div",{style:M,children:"Code Availability"}),e.jsx("p",{style:N,children:"For every open-access machine learning paper, we check whether an official code implementation is linked on GitHub. The date axis is the paper's publication date."})]}),e.jsxs("div",{children:[e.jsx("div",{style:M,children:"Hugging Face artifacts"}),e.jsx("p",{style:N,children:"We resolve links between papers and the Hugging Face Hub, counting a paper as covered when it references at least one model, dataset or Space. The date axis is the paper's publication date."})]}),e.jsx("p",{style:{fontFamily:"var(--mono)",fontSize:12,lineHeight:1.6,color:"var(--ink-faint)",margin:"8px 0 0",letterSpacing:"0.02em"},children:"Figures use complete publication months. Historical Hugging Face coverage reflects artifacts currently linked in the catalog."})]})]})]})};export{te as default};
|
assets/{UserProfileView-B6KAnwOV.js → UserProfileView-DUbkPjS_.js}
RENAMED
|
@@ -1 +1 @@
|
|
| 1 |
-
import{f as s,j as e,aO as i,e as o}from"./index-
|
|
|
|
| 1 |
+
import{f as s,j as e,aO as i,e as o}from"./index-Bthypk3Q.js";import{u as d}from"./useQuery-CEDDm0wh.js";import{C as l}from"./OrganizationContributionGraph-BPUdCM_r.js";import"./skeleton-BS-Px_iI.js";async function c(t){const a=await fetch(o(`/api/v1/profiles/${encodeURIComponent(t)}`),{credentials:"include"});if(!a.ok)throw new Error("Profile not found");const r=await a.json();if(a.redirected){const n=decodeURIComponent(new URL(a.url).pathname.split("/").pop()||r.username);return{...r,username:n,redirected_from_alias:!0}}return r}const x=()=>{const{username:t=""}=s(),a=d({queryKey:["user-profile",t.toLowerCase()],queryFn:()=>c(t)});return a.isLoading?e.jsx("div",{className:"page",children:"Loading profile…"}):a.data?a.data.redirected_from_alias?e.jsx(i,{to:`/${a.data.username}`,replace:!0}):e.jsxs("div",{className:"page",style:{maxWidth:960},children:[e.jsxs("h1",{children:["@",a.data.username]}),e.jsx("p",{children:"Canonical Papers with Code contributions"}),e.jsx(l,{data:a.data.calendar,organizationName:`@${a.data.username}`,title:"Canonical contributions",noun:"contribution"}),a.data.is_owner&&e.jsxs("section",{className:"mt-10",children:[e.jsx("h2",{children:"Your submissions"}),e.jsxs("p",{className:"text-sm text-muted-foreground",children:["Limits and duplicate behavior are documented on ",e.jsx("a",{href:"/rate-limits",children:"the policy page"}),"."]}),e.jsx("div",{className:"mt-4 space-y-3",children:a.data.submissions.map(r=>e.jsxs("article",{className:"rounded-md border p-4",children:[e.jsx("strong",{children:r.edit_type})," · ",r.status,e.jsxs("details",{className:"mt-2 text-xs",children:[e.jsx("summary",{children:"Original and applied payload"}),e.jsx("pre",{children:JSON.stringify({proposed:r.proposed_payload,applied:r.applied_payload},null,2)})]}),r.review_reason&&e.jsx("p",{children:r.review_reason})]},r.id))})]})]}):e.jsx("div",{className:"page",children:e.jsx("h1",{children:"Profile not found"})})};export{x as default};
|
assets/{alert-DdslWjc3.js → alert-DJmmSiqi.js}
RENAMED
|
@@ -1 +1 @@
|
|
| 1 |
-
import{r as a,j as s,v as l,a9 as i}from"./index-
|
|
|
|
| 1 |
+
import{r as a,j as s,v as l,a9 as i}from"./index-Bthypk3Q.js";const o=i("relative w-full rounded-lg border p-4 [&>svg~*]:pl-7 [&>svg+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4 [&>svg]:text-foreground",{variants:{variant:{default:"bg-background text-foreground",destructive:"border-destructive/50 text-destructive dark:border-destructive [&>svg]:text-destructive"}},defaultVariants:{variant:"default"}}),n=a.forwardRef(({className:e,variant:t,...r},d)=>s.jsx("div",{ref:d,role:"alert",className:l(o({variant:t}),e),...r}));n.displayName="Alert";const v=a.forwardRef(({className:e,...t},r)=>s.jsx("h5",{ref:r,className:l("mb-1 font-medium leading-none tracking-tight",e),...t}));v.displayName="AlertTitle";const c=a.forwardRef(({className:e,...t},r)=>s.jsx("div",{ref:r,className:l("text-sm [&_p]:leading-relaxed",e),...t}));c.displayName="AlertDescription";export{n as A,c as a};
|
assets/{button-BPd6y_n4.js → button-DH3x5IsG.js}
RENAMED
|
@@ -1 +1 @@
|
|
| 1 |
-
import{r as a,j as d,aw as u,v as c,a9 as f}from"./index-
|
|
|
|
| 1 |
+
import{r as a,j as d,aw as u,v as c,a9 as f}from"./index-Bthypk3Q.js";const g=f("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground hover:bg-destructive/90",outline:"border border-input bg-background hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-10 px-4 py-2",sm:"h-9 rounded-md px-3",lg:"h-11 rounded-md px-8",icon:"h-10 w-10"}},defaultVariants:{variant:"default",size:"default"}}),v=a.forwardRef(({className:e,variant:t,size:r,asChild:n=!1,...o},s)=>{const i=n?u:"button";return d.jsx(i,{className:c(g({variant:t,size:r,className:e})),ref:s,...o})});v.displayName="Button";export{v as B};
|
assets/{chatSessions-Bv5yO1zx.js → chatSessions-nz97TbnH.js}
RENAMED
|
@@ -1 +1 @@
|
|
| 1 |
-
import{j as
|
|
|
|
| 1 |
+
import{j as s,e as _}from"./index-Bthypk3Q.js";const k=({light:t})=>s.jsx("span",{className:`chat-spinner${t?" chat-spinner-light":""}`}),O=({open:t})=>s.jsx("svg",{className:`chat-chev${t?" chat-chev-open":""}`,width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:s.jsx("path",{d:"m6 9 6 6 6-6"})}),R=()=>s.jsxs("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[s.jsx("circle",{cx:"12",cy:"12",r:"9"}),s.jsx("path",{d:"m9 12 2 2 4-4"})]}),I=({size:t=14})=>s.jsxs("svg",{width:t,height:t,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[s.jsx("circle",{cx:"11",cy:"11",r:"7"}),s.jsx("path",{d:"m21 21-4.3-4.3"})]}),A=()=>s.jsx("svg",{width:"17",height:"17",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.2",children:s.jsx("path",{d:"M12 19V5M5 12l7-7 7 7"})}),P=()=>s.jsx("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:s.jsx("path",{d:"M12 5v14M5 12h14"})}),M=()=>s.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",children:[s.jsx("rect",{x:"3",y:"4",width:"18",height:"16",rx:"2"}),s.jsx("path",{d:"M9 4v16"})]}),D=()=>s.jsx("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:s.jsx("path",{d:"M3 6h18M8 6V4a1 1 0 0 1 1-1h6a1 1 0 0 1 1 1v2M6 6l1 14a2 2 0 0 0 2 2h6a2 2 0 0 0 2-2l1-14"})}),x=[{provider:"huggingface",label:"Inference Providers"},{provider:"openrouter",label:"OpenRouter"}],E=({models:t,selectedModel:r,onModelChange:e,disabled:n})=>{var v,g;const o=((v=t.find(a=>a.id===r))==null?void 0:v.label)??`${r} (unavailable)`,i=Math.min(Math.max(o.length+5,12),32),c=t.filter(a=>!a.provider);return t.length===1&&((g=t[0])==null?void 0:g.id)===r?s.jsx("span",{className:"chat-model-label","aria-label":"Research model",children:o}):s.jsxs("select",{className:"chat-model-select",style:{width:`${i}ch`},value:r,disabled:n,onChange:a=>e(a.target.value),"aria-label":"Research model",children:[!t.some(a=>a.id===r)&&s.jsx("option",{value:r,disabled:!0,children:o}),c.map(a=>s.jsx("option",{value:a.id,children:a.label},a.id)),x.map(({provider:a,label:y})=>{const m=t.filter(l=>l.provider===a);return m.length===0?null:s.jsx("optgroup",{label:y,children:m.map(l=>s.jsx("option",{value:l.id,children:l.label},l.id))},a)})]})},f="pwc:chat-oauth-draft",h="pwc:chat-oauth-model",d="pwc:chat-oauth-auto-send",w="pwc:chat-oauth-attempted";function L(t,r,e={}){const n=t.trim();n&&(sessionStorage.setItem(f,n),e.autoSend===!1?sessionStorage.removeItem(d):sessionStorage.setItem(d,"1"),r?sessionStorage.setItem(h,r):sessionStorage.removeItem(h))}function $(){var r;if(typeof window>"u"||sessionStorage.getItem(d)!=="1")return null;const t=(r=sessionStorage.getItem(f))==null?void 0:r.trim();return t?{prompt:t,model:sessionStorage.getItem(h)}:null}function q(){sessionStorage.removeItem(f),sessionStorage.removeItem(h),sessionStorage.removeItem(d),sessionStorage.removeItem(w)}const S="deepseek-ai/DeepSeek-V4-Flash-0731",b=[{id:S,label:"DeepSeek V4 Flash",provider:"huggingface"}],H=[...b,{id:"openai/gpt-5.6-luna",label:"GPT-5.6 Luna (medium)",provider:"openrouter"},{id:"openai/gpt-5.6-terra",label:"GPT-5.6 Terra (medium)",provider:"openrouter"}];async function u(t,r){const e=await fetch(_(t),{credentials:"include",headers:{"Content-Type":"application/json",...r==null?void 0:r.headers},...r});if(!e.ok){const n=await e.json().catch(()=>null),o=n==null?void 0:n.detail;throw new Error((o==null?void 0:o.message)||o||`Chat request failed (${e.status})`)}return e.status===204?void 0:e.json()}class T extends Error{constructor(r,e){super(r),this.status=e}}async function C(t){const r=await fetch(_(t),{headers:{Accept:"application/json"}});if(!r.ok){const e=await r.json().catch(()=>null),n=e==null?void 0:e.detail;throw new T((n==null?void 0:n.message)||n||`Shared conversation request failed (${r.status})`,r.status)}return r.json()}async function Y(){const t=[];let r=null;do{const e=new URLSearchParams({limit:"50"});r&&e.set("cursor",r);const n=await u(`/api/v1/chat/sessions?${e.toString()}`);t.push(...n.items),r=n.next_cursor}while(r&&t.length<100);return t}function B(t){return u("/api/v1/chat/sessions",{method:"POST",body:JSON.stringify({selected_model:t||null})})}function U(t){return u(`/api/v1/chat/sessions/${t}`)}function N(t,r){return u(`/api/v1/chat/sessions/${t}`,{method:"PATCH",body:JSON.stringify(r)})}function F(t){return u(`/api/v1/chat/sessions/${t}`,{method:"DELETE"})}function W(){return u("/api/v1/chat/sessions/archive-old",{method:"POST"})}function K(){return u("/api/v1/chat/sessions/archive-oldest",{method:"POST"})}function G(t){return u(`/api/v1/chat/sessions/${t}/cancel`,{method:"POST"})}function V(t){return u(`/api/v1/chat/sessions/${t}/share`,{method:"POST"})}function J(t){return C(`/api/v1/chat/shares/${encodeURIComponent(t)}`)}async function Q(){return u("/api/v1/chat/models")}function p(t,r){const e=t.map(n=>n.kind==="reasoning"?{...n,active:!1,open:!1}:n.kind==="tool"?{...n,status:n.status==="running"?"error":n.status,open:r&&(n.status==="error"||n.status==="denied"||n.status==="running")}:{...n,done:!0});return e.filter((n,o)=>{const i=e[o-1];return!(n.kind==="reasoning"&&(i==null?void 0:i.kind)==="reasoning"&&n.text===i.text)})}function z(t){const r=e=>e==="hf_inference_billing_exhausted"?"Hugging Face could not bill this request. Your included credits may be exhausted; enable or review pay-as-you-go billing in Settings.":e==="hf_inference_credential_expired"?"Your Hugging Face authorization expired. Reconnect in Settings.":e==="provider_rate_limit"?"The selected model is temporarily rate-limited. Try again shortly.":e==="provider_timeout"?"The model provider timed out. Try again shortly.":e==="openrouter_monthly_budget_exhausted"?"You have used this month's Papers With Code OpenRouter allowance. Review the reset time or enable your own key in Settings.":e==="openrouter_unavailable"?"OpenRouter is currently unavailable. However, you can still bring your own key in Settings.":e==="openrouter_byok_credential_invalid"?"Your OpenRouter API key is no longer valid. Reconnect it in Settings, then try again.":e==="openrouter_byok_billing_error"?"Your OpenRouter key is connected, but OpenRouter rejected billing for the account behind it. A key spending limit is not an account credit balance. Add credits or enable pay-as-you-go in OpenRouter, then try again.":e==="openrouter_byok_rate_limit"?"Your OpenRouter API key is temporarily rate-limited.":["provider_error","provider_unavailable"].includes(e??"")?"The model provider failed before completing the response. You can edit and retry your question.":e==="persistence_error"?"The response could not be saved. You can edit and retry your question.":e==="transcript_mirror_error"?"The conversation could not be saved. Please try again in a new chat.":"The response did not complete. You can edit and retry your question.";return t.messages.flatMap(e=>{if(e.role==="assistant")return[{id:e.id,role:"assistant",blocks:p(e.display_blocks,!0),followups:e.followups,citations:e.citations,finishReason:e.finish_reason??void 0,streaming:!1}];const n={id:e.id,role:"user",text:e.content,paperMentions:(e.paper_mentions??[]).map(i=>({...i,key:i.occurrence_id})),revision:e.revision,status:e.status,error:e.status==="complete"?void 0:e.error_code||e.status};if(!["error","interrupted"].includes(e.status))return[n];const o=e.status==="interrupted";return[n,{id:`${e.id}-${o?"interrupted":"error"}`,role:"assistant",blocks:p(e.display_blocks,!0),streaming:!1,finishReason:o?"stopped":void 0,error:o?void 0:r(e.error_code),errorCode:o?void 0:e.error_code??void 0}]})}function X(t){return t.messages.map(r=>r.role==="user"?{id:r.id,role:"user",text:r.content,paperMentions:(r.paper_mentions??[]).map(e=>({...e,key:e.occurrence_id}))}:{id:r.id,role:"assistant",blocks:p(r.display_blocks,!1),citations:r.citations,finishReason:r.finish_reason??void 0,error:r.error??void 0,streaming:!1})}function Z(t){const r=Date.now(),e=new Date().setHours(0,0,0,0),n=[{label:"Today",items:[]},{label:"Previous 7 Days",items:[]},{label:"Previous 30 Days",items:[]},{label:"Older",items:[]}];for(const o of[...t].sort((i,c)=>Date.parse(c.updated_at)-Date.parse(i.updated_at))){const i=Date.parse(o.updated_at),c=r-i;i>=e?n[0].items.push(o):c<7*864e5?n[1].items.push(o):c<30*864e5?n[2].items.push(o):n[3].items.push(o)}return n.filter(o=>o.items.length>0)}export{A,I as B,f as C,S as D,E as M,b as P,H as S,D as T,G as a,h as b,B as c,d,w as e,q as f,U as g,Q as h,P as i,M as j,Z as k,Y as l,k as m,F as n,V as o,K as p,L as q,$ as r,W as s,z as t,N as u,T as v,X as w,J as x,R as y,O as z};
|
assets/{chevron-down-DFsRFUN6.js → chevron-down-X5yQfbpI.js}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
| 1 |
-
import{d as o}from"./index-
|
| 2 |
* @license lucide-react v0.462.0 - ISC
|
| 3 |
*
|
| 4 |
* This source code is licensed under the ISC license.
|
|
|
|
| 1 |
+
import{d as o}from"./index-Bthypk3Q.js";/**
|
| 2 |
* @license lucide-react v0.462.0 - ISC
|
| 3 |
*
|
| 4 |
* This source code is licensed under the ISC license.
|
assets/{codexAddEvals-f67YW8cy.js → codexAddEvals-DL2-0pMU.js}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
| 1 |
-
import{d as o,j as i,v as c,a9 as d,e as n}from"./index-
|
| 2 |
* @license lucide-react v0.462.0 - ISC
|
| 3 |
*
|
| 4 |
* This source code is licensed under the ISC license.
|
|
|
|
| 1 |
+
import{d as o,j as i,v as c,a9 as d,e as n}from"./index-Bthypk3Q.js";/**
|
| 2 |
* @license lucide-react v0.462.0 - ISC
|
| 3 |
*
|
| 4 |
* This source code is licensed under the ISC license.
|