paperswithcode / assets /ExternalSourceEvalBadge-BlE3UtwF.js
nielsr's picture
nielsr HF Staff
Sync paperswithcode.co frontend
7b9cf70 verified
Raw
History Blame Contribute Delete
6.45 kB
import{r as a,d as W,j as r,R as B,B as $,b as z,f as d,D as N,P as j,E as K,i as G,e as U,J,K as V,M as Y,k as q,L as Q}from"./index-BzfLml0t.js";var S,P="HoverCard",[H]=G(P,[N]),E=N(),[X,R]=H(P),D=e=>{const{__scopeHoverCard:t,children:n,open:i,defaultOpen:s,onOpenChange:c,openDelay:f=700,closeDelay:v=300}=e,l=E(t),h=a.useRef(0),u=a.useRef(0),m=a.useRef(!1),p=a.useRef(!1),[C,o]=W({prop:i,defaultProp:s??!1,onChange:c,caller:P}),x=a.useCallback(()=>{clearTimeout(u.current),h.current=window.setTimeout(()=>o(!0),f)},[f,o]),g=a.useCallback(()=>{clearTimeout(h.current),!m.current&&!p.current&&(u.current=window.setTimeout(()=>o(!1),v))},[v,o]),I=a.useCallback(()=>o(!1),[o]);return a.useEffect(()=>()=>{clearTimeout(h.current),clearTimeout(u.current)},[]),r.jsx(X,{scope:t,open:C,onOpenChange:o,onOpen:x,onClose:g,onDismiss:I,hasSelectionRef:m,isPointerDownOnContentRef:p,children:r.jsx(B,{...l,children:n})})};D.displayName=P;var O="HoverCardTrigger",_=a.forwardRef((e,t)=>{const{__scopeHoverCard:n,...i}=e,s=R(O,n),c=E(n);return r.jsx($,{asChild:!0,...c,children:r.jsx(z.a,{"data-state":s.open?"open":"closed",...i,ref:t,onPointerEnter:d(e.onPointerEnter,w(s.onOpen)),onPointerLeave:d(e.onPointerLeave,w(s.onClose)),onFocus:d(e.onFocus,s.onOpen),onBlur:d(e.onBlur,s.onClose),onTouchStart:d(e.onTouchStart,f=>f.preventDefault())})})});_.displayName=O;var y="HoverCardPortal",[Z,ee]=H(y,{forceMount:void 0}),L=e=>{const{__scopeHoverCard:t,forceMount:n,children:i,container:s}=e,c=R(y,t);return r.jsx(Z,{scope:t,forceMount:n,children:r.jsx(j,{present:n||c.open,children:r.jsx(K,{asChild:!0,container:s,children:i})})})};L.displayName=y;var b="HoverCardContent",A=a.forwardRef((e,t)=>{const n=ee(b,e.__scopeHoverCard),{forceMount:i=n.forceMount,...s}=e,c=R(b,e.__scopeHoverCard);return r.jsx(j,{present:i||c.open,children:r.jsx(te,{"data-state":c.open?"open":"closed",...s,onPointerEnter:d(e.onPointerEnter,w(c.onOpen)),onPointerLeave:d(e.onPointerLeave,w(c.onClose)),ref:t})})});A.displayName=b;var te=a.forwardRef((e,t)=>{const{__scopeHoverCard:n,onEscapeKeyDown:i,onPointerDownOutside:s,onFocusOutside:c,onInteractOutside:f,...v}=e,l=R(b,n),h=E(n),u=a.useRef(null),m=U(t,u),[p,C]=a.useState(!1);return a.useEffect(()=>{if(p){const o=document.body;return S=o.style.userSelect||o.style.webkitUserSelect,o.style.userSelect="none",o.style.webkitUserSelect="none",()=>{o.style.userSelect=S,o.style.webkitUserSelect=S}}},[p]),a.useEffect(()=>{if(u.current){const o=()=>{C(!1),l.isPointerDownOnContentRef.current=!1,setTimeout(()=>{var g;((g=document.getSelection())==null?void 0:g.toString())!==""&&(l.hasSelectionRef.current=!0)})};return document.addEventListener("pointerup",o),()=>{document.removeEventListener("pointerup",o),l.hasSelectionRef.current=!1,l.isPointerDownOnContentRef.current=!1}}},[l.isPointerDownOnContentRef,l.hasSelectionRef]),a.useEffect(()=>{u.current&&ne(u.current).forEach(x=>x.setAttribute("tabindex","-1"))}),r.jsx(J,{asChild:!0,disableOutsidePointerEvents:!1,onInteractOutside:f,onEscapeKeyDown:i,onPointerDownOutside:s,onFocusOutside:d(c,o=>{o.preventDefault()}),onDismiss:l.onDismiss,children:r.jsx(V,{...h,...v,onPointerDown:d(v.onPointerDown,o=>{o.currentTarget.contains(o.target)&&C(!0),l.hasSelectionRef.current=!1,l.isPointerDownOnContentRef.current=!0}),ref:m,style:{...v.style,userSelect:p?"text":void 0,WebkitUserSelect:p?"text":void 0,"--radix-hover-card-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-hover-card-content-available-width":"var(--radix-popper-available-width)","--radix-hover-card-content-available-height":"var(--radix-popper-available-height)","--radix-hover-card-trigger-width":"var(--radix-popper-anchor-width)","--radix-hover-card-trigger-height":"var(--radix-popper-anchor-height)"}})})}),re="HoverCardArrow",oe=a.forwardRef((e,t)=>{const{__scopeHoverCard:n,...i}=e,s=E(n);return r.jsx(Y,{...s,...i,ref:t})});oe.displayName=re;function w(e){return t=>t.pointerType==="touch"?void 0:e()}function ne(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:i=>i.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP});for(;n.nextNode();)t.push(n.currentNode);return t}var ae=D,se=_,ie=L,k=A;const F=ae,M=se,T=a.forwardRef(({className:e,align:t="center",sideOffset:n=4,...i},s)=>r.jsx(ie,{children:r.jsx(k,{ref:s,align:t,sideOffset:n,className:q("z-50 w-64 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...i})}));T.displayName=k.displayName;const de=()=>r.jsxs(F,{openDelay:120,closeDelay:120,children:[r.jsx(M,{asChild:!0,children:r.jsx("button",{type:"button",className:"bm-closed-source-tag","aria-label":"Closed-source model",children:"closed"})}),r.jsxs(T,{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"," ",r.jsx(Q,{to:"/settings",className:"closed-eval-tooltip-link",children:"settings"}),"."]})]});function ce(e){if(!e)return"Evaluation sourced outside this paper";const t=e.toLowerCase();if(t.includes("open-asr-leaderboard"))return"Open ASR Leaderboard";if(t.includes("arcprize.org"))return"ARC Prize Leaderboard";if(t.includes("frontierswe.com"))return"FrontierSWE";if(t.includes("deepswe.datacurve.ai"))return"DeepSWE";try{const n=new URL(e,"https://paperswithcode.co");return n.pathname.startsWith("/paper/")?"Source paper":n.hostname.replace(/^www\./,"")}catch{return e}}const ue=({sourceUrl:e})=>{const t=ce(e);return r.jsxs(F,{openDelay:120,closeDelay:120,children:[r.jsx(M,{asChild:!0,children:r.jsx("button",{type:"button",className:"bm-external-source-tag","aria-label":`Externally sourced evaluation: ${t}`,children:"External"})}),r.jsxs(T,{side:"top",align:"start",className:"w-auto max-w-[280px] p-3 text-sm leading-snug",children:["This score was sourced outside this paper.",e?r.jsxs(r.Fragment,{children:[" ",r.jsx("a",{href:e,target:"_blank",rel:"noopener noreferrer",className:"external-eval-tooltip-link",children:t}),"."]}):r.jsxs(r.Fragment,{children:[" ",t,"."]})]})]})};export{de as C,ue as E};