1import{cK as A,fz as et,fA as Et,fB as Re,fC as tt,fD as xe,fE as Ot,fF as At,aG as we,fG as de,fH as Dt,fI as oe,dO as Y,a as n,j as u,fJ as W,dn as nt,a4 as Le,b8 as Mt,fK as rt,bm as C,fL as qt,fM as Ft,fN as st,fO as at,D as Bt,aI as Pe,fP as ve,fQ as $t,fR as Ut,fS as zt,fT as J,fU as Gt,eF as it,fV as Ht,dH as Vt,B as jt,dX as Kt,dV as $e,fW as Wt,fX as Qt,fY as Yt,fZ as Xt,ad as F,fv as ot,l as O,f_ as Zt,f$ as lt,g0 as Jt,d7 as ke,e$ as en,f0 as tn,g1 as nn,g2 as Ue,aV as ze,g3 as rn,O as le,da as N,eS as ye,b3 as sn,b4 as an,b6 as on,g4 as ut,g5 as Te,cE as ln,g6 as ct,g7 as un,g8 as cn,g9 as dn,ga as ue,cy as Ee,eW as mn,gb as fn,gc as hn,gd as gn,ge as pn,N as Ge,L as He,gf as Rn,gg as Sn,gh as bn,gi as _n,gj as Pn,eJ as vn,gk as yn,bc as T,gl as Se,gm as Nn,gn as Cn,aO as In,go as dt,gp as be,b0 as xn,bE as wn,x as mt,gq as Ln,ef as kn,bI as Tn,gr as En,eP as On,gs as An,d4 as Dn,bj as Q,by as Mn,db as qn,gt as Fn,gu as Bn,gv as $n,gw as Ve,gx as Un,gy as zn,gz as Gn,d6 as E,d8 as Hn,gA as Vn}from"./index-BFa3nKuT.js";import{a as d,S as jn,w as Kn}from"./datepicker-CN3oO0F6.js";import"./visx-o561FtCw.js";import{ap as Wn}from"./charts-BEfaN6Tb.js";import{c as Qn}from"./tanstack-82Oensom.js";import{N as Yn}from"./apollo-B9xYJgZj.js";import"./framerMotion-KnKeNhwd.js";import"./shiki-DSW_v8w1.js";import"./betterAuth-wecmey9t.js";import"./virtuoso-_8EeKo1c.js";import"./sentry-BM1d0HPc.js";import"./forms-BE_8TKCw.js";import"./amplitude-rTYtQKJT.js";import"./amplify-FijOe782.js";import"./qrcode-CMNUHY9J.js";import"./dnd-BjCurfON.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{};e.SENTRY_RELEASE={id:"01e610d75577dcaf5e5c9af84e79c9458f58a767"},e._sentryModuleMetadata=e._sentryModuleMetadata||{},e._sentryModuleMetadata[new e.Error().stack]=(function(r){for(var s=1;s<arguments.length;s++){var a=arguments[s];if(a!=null)for(var o in a)a.hasOwnProperty(o)&&(r[o]=a[o])}return r})({},e._sentryModuleMetadata[new e.Error().stack],{"_sentryBundlerPluginAppKey:currents-dashboard":!0});var t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="7b967e9b-689c-42b4-b17f-43e02e55d21e",e._sentryDebugIdIdentifier="sentry-dbid-7b967e9b-689c-42b4-b17f-43e02e55d21e")}catch{}})();function Xn(e){const t=d.useCallback(r=>{const s=window.matchMedia(e);return s.addEventListener("change",r),()=>s.removeEventListener("change",r)},[e]);return d.useSyncExternalStore(t,()=>window.matchMedia(e).matches,()=>!1)}const ft=30,_e=90,ht={last_run:Re.LastRun,first_run:Re.FirstRun,run_count:Re.RunCount},je="last_run",Zn=A.Desc,Oe=[20,50],X=20,Jn=[],er="No commit message",tr=8,gt=["start","end","lookback"],nr=[...gt,"tag","tags_logical_operator","author","environment"],pt=oe.failed.toLowerCase(),rr=15e3,Rt=6e4;function St(e,t){var a;const r=(a=e.title)==null?void 0:a.trim();if(r&&(!e.prNumber||r!==At(e.prNumber)))return{text:r,fallback:null};const s=xe(t);return s?{text:s,fallback:"commitMessage"}:{text:"No title",fallback:"none"}}function sr(e){const t=et(e.filter(Boolean)),r=Object.keys(t);return r.length<2?null:Wn(r,s=>t[s])??null}function ar(e,t){return!e||!t||e===t?null:e.split("/").pop()||e}function ir(e){if(e.length===0)return"No runs";const t=et(e,s=>de(s.status,s.completionState)),r=Dt.filter(s=>t[s]).map(s=>`${t[s]} ${oe[s].toLowerCase()}`);return`Last ${e.length} ${we("run",e.length)}: ${r.join(", ")}`}function bt(e){return e?e.slice(0,tr):null}function or(e){const t=new Set,r=new Set;for(const s of e){const{sha:a}=s.commit;a&&(r.has(a)?t.add(s.runId):r.add(a))}return t}function lr(e){return[bt(e.commit.sha),e.commit.authorName,e.failures>0?`${e.failures} ${pt}`:null].filter(Boolean).join(" · ")}function _t(e){return`${e} ${pt} ${we("test",e)}`}function ur(e){return xe(e.commit.message)||er}function cr(e){if(e.completionState!==tt.InProgress)return e.durationMs??void 0}function dr(e){return e.stats.total>e.recentRuns.length?e.stats.total:null}function mr({search:e,lookbackDays:t}){const r=new URLSearchParams(e),s=new URLSearchParams;for(const a of nr)for(const o of r.getAll(a))s.append(a,o);return t!==null&&!gt.some(a=>r.has(a))&&s.set("lookback",String(t)),s}function fr({tags:e,authors:t,branches:r,environments:s,tagsLogicalOperator:a}){return{tags:e.length>0?e:null,authors:t.length>0?t:null,branches:r.length>0?r:null,environments:s.length>0?s:null,tagsLogicalOperator:a??Et}}function hr(e){return e.some(t=>(t.latestRun.environments??[]).length>0)}function gr({lookbackDays:e,startDate:t,endDate:r}){return e??jn(r,t)+1}function pr({data:e,previousData:t,error:r}){const s=e??(r?void 0:t)??Jn;return{items:s,error:s.length===0?r??null:null}}function Rr(e){return e===null?"No pull requests in this date range":e===1?"No pull requests today":`No pull requests in the last ${e} days`}function Sr(e){return e.some(t=>t.latestRun.completionState===tt.InProgress)?rr:Rt}function br(e){return Oe.find(t=>t===e)??X}function _r({prSearch:e,statuses:t,order:r,dir:s,pageSize:a}){return{limit:a,order:ht[r],dir:s,statuses:t.length>0?t:null,prSearch:(e==null?void 0:e.trim())||null}}function Pr(e,t){const r=t===A.Desc;return e==="run_count"?r?"Most runs first":"Fewest runs first":r?"Newest first":"Oldest first"}const vr=/^[0-9a-f]{24}$/;function yr(e){try{const{s:t,v:r}=JSON.parse(atob(e.replace(/-/g,"+").replace(/_/g,"/")));return t!=="first_run"||typeof r!="string"||!vr.test(r)?null:new Date(parseInt(r.slice(0,8),16)*1e3)}catch{return null}}const Nr=new Map,Cr=new Set;function Ir(e){var h,f;const t=new Map,r=new Set(e.map(l=>
1l.pullRequest.id));for(const l of e){const c=(h=l.stackedOn)==null?void 0:h.id;if(!c||!r.has(c))continue;const g=t.get(c);g?g.push(l):t.set(c,[l])}if(t.size===0)return{rows:e,positionById:Nr,parentAboveIds:Cr};const s=[],a=new Set,o=new Map,i=new Set;function m(l,c){var _;const g=l.pullRequest.id;if(a.has(g))return;const b=(_=s[s.length-1])==null?void 0:_.pullRequest.id;a.add(g),s.push(l),c&&o.set(g,c),l.stackedOn&&l.stackedOn.id===b&&i.add(g);for(const p of t.get(g)??[])m(p,"stacked")}for(const l of e){const c=(f=l.stackedOn)==null?void 0:f.id;(!c||!r.has(c))&&m(l,t.has(l.pullRequest.id)?"base":null)}for(const l of e)m(l,null);return{rows:s,positionById:o,parentAboveIds:i}}function Ae(e){return!xe(e==null?void 0:e.message)&&!Ot(e)}function xr(e){return e.length===0?!1:e.filter(({latestRun:r})=>Ae(r.meta.commit)).length*2>=e.length}const Pt="https://docs.currents.dev/dashboard/runs/commit-information",Ne="No commit message or author reported by CI";function wr(e,t){return`pullRequests.missingCommitInfoDismissed.${e}.${t}`}const Lr=`Currents (https://currents.dev) receives our CI test results, but the runs arrive without a git commit message or author. Only the commit SHA is reported. 2 3Fix the CI configuration so the Currents reporter can read git data: 4 51. Find the CI jobs that run tests with a Currents reporter (@currents/playwright, @currents/cmd, cypress-cloud, @currents/jest, @currents/node-test-reporter or \`currents\` CLI commands). 62. Make git history available where the reporter runs: 7 - The checkout step must leave a .git directory with the tested commit. On GitHub Actions pull_request events, check out the PR head commit (\`ref: \${{ github.event.pull_request.head.sha }}\`), not the merge commit. 8 - When tests run in a Docker container, mount the repository including .git, or run the reporter where .git exists. 93. If git history cannot be made available, set these environment variables on the test step from CI variables instead: 10 - COMMIT_INFO_SHA 11 - COMMIT_INFO_BRANCH 12 - COMMIT_INFO_MESSAGE 13 - COMMIT_INFO_AUTHOR 14 - COMMIT_INFO_EMAIL 15 16Reference: ${Pt} 17 18Show me the changes before committing them.`,vt=d.createContext(null);function kr({orgId:e,projectId:t,listIsMissingCommitInfo:r}){const[s,a]=Y(wr(e,t),!1),[o,i]=d.useState(!1),m=d.useCallback(()=>i(!0),[]),h=d.useCallback(()=>{i(!1),a(!0)},[a]);return{visible:o||r&&!s,open:m,dismiss:h}}function Tr({open:e,children:t}){return n(vt.Provider,{value:e,children:t})}function Er(){return n(C,{trigger:u("span",{className:"flex shrink-0 items-center text-ui-v2-content-warning-idle",children:[n("span",{className:"sr-only",children:Ne}),n(rt,{"aria-hidden":!0})]}),children:Ne})}function Or(){const e=d.useContext(vt);return e?n(C,{trigger:n("button",{type:"button","aria-label":"Explain the missing commit message and author",className:"flex shrink-0 items-center text-ui-v2-content-warning-idle",onClick:t=>{t.stopPropagation(),e()},children:n(rt,{"aria-hidden":!0})}),children:Ne}):null}function Ar({onDismiss:e}){const t=d.useCallback(async()=>Lr,[]);return n(Mt,{type:"warning",fullWidth:!0,className:"mb-ui-v2-3",title:"Runs in this project have no commit message or author",description:"Your CI sends only the commit SHA to Currents. Make git data available to the reporter, or set the COMMIT_INFO_* variables.",actions:u(Le,{children:[u(W,{fetchPrompt:t,label:"Fix",children:[n(W.Trigger,{type:"accent",children:"Fix"}),n(W.Separator,{}),n(W.Menu,{type:"accent",children:n(W.ProviderItems,{})})]}),n(nt,{className:"ml-ui-v2-2",href:Pt,target:"_blank",rel:"noopener noreferrer",children:"Setup guide"})]}),onDismiss:e})}function Dr({stacked:e}){return e?u("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:Ft,"aria-hidden":!0,className:"size-3.5 shrink-0",children:[n("path",{d:"M21 16.05L12 21L3 16.05M21 12.45L12 17.4L3 12.45",strokeLinecap:"square"}),n("path",{d:"M12 10.5V3.5m0 0L8.5 7M12 3.5L15.5 7",strokeLinecap:"round",strokeLinejoin:"round"})]}):n(qt,{size:"default",className:"shrink-0","aria-hidden":!0})}const Ke="The base of the stack on this page";function Mr({position:e,item:t}){const{stackedOn:r,pullRequest:s}=t,a=r!=null&&r.prNumber?`#${r.prNumber}
18`:null,o=["Stacked on",[a,r==null?void 0:r.title].filter(Boolean).join(" ")||"another pull request"].join(" ");return n(C,{trigger:u("span",{"data-stack-mark":e,className:"flex shrink-0 items-center",children:[n("span",{className:"sr-only",children:e==="base"?Ke:o}),n(Dr,{stacked:e==="stacked"})]}),children:e==="base"?Ke:u("div",{className:"flex max-w-2xl flex-col gap-ui-v2-1",children:[n("span",{children:o}),s.destination&&n("span",{className:"text-ui-v2-content-secondary-idle",children:`Merges into ${s.destination}, the source branch of ${a??"that pull request"}`})]})})}function qr({runCount:e}){st(at.PULL_REQUEST_EXPANDED,{runCount:e})}function Fr({runCount:e}){const t=d.useRef(!1);d.useEffect(()=>{t.current||(t.current=!0,qr({runCount:e}))},[e])}function D({target:e,trigger:t}){st(at.PULL_REQUEST_LINK_OPENED,{target:e,trigger:t})}function De(e){return e.button!==0||e.metaKey||e.ctrlKey||e.shiftKey||e.altKey}function Me(){const[e,t]=Bt("previewRunId",Pe),r=d.useCallback(a=>t(a),[t]),s=d.useCallback(()=>t(void 0),[t]);return{runId:e??void 0,open:r,close:s}}function Br({runId:e,onClose:t}){const r=d.useRef(e);e&&(r.current=e);const s=d.useRef(0),a=d.useRef(!1);e&&!a.current&&(s.current+=1),a.current=!!e;const o=d.useRef(()=>!1);return n(ve,{open:!!e,onOpenChange:i=>{i||t()},children:n(ve.Content,{hideCloseButton:!0,className:$t,onEscapeKeyDown:i=>{o.current()&&i.preventDefault()},children:r.current&&n($r,{runId:r.current,onClose:t,closeTestRef:o},`${r.current}-${s.current}`)})})}function $r({runId:e,onClose:t,closeTestRef:r}){return n(Gt,{initialEntries:[J(e)],children:n(Ut,{adapter:zt,children:n(Ur,{onClose:t,closeTestRef:r})})})}function Ur({onClose:e,closeTestRef:t}){const r=it(),[s,a]=d.useState(null),o=d.useMemo(()=>({testDetailsContainer:s}),[s]),i=Ht(),m=!!i.testId&&!!i.instanceId;t.current=()=>m?(i.close(),!0):!1;const[h,f]=d.useState(!1);return d.useEffect(()=>{const l=requestAnimationFrame(()=>d.startTransition(()=>f(!0)));return()=>cancelAnimationFrame(l)},[]),u(Yt.Provider,{value:o,children:[u("div",{className:"flex items-center gap-ui-v2-2",children:[n(ve.Title,{className:"sr-only",children:"Run details"}),m&&n(zr,{onClick:i.close}),n(Gr,{appHistory:r}),n(jt,{type:"secondary","aria-label":"Close",icon:n(Vt,{}),onClick:e})]}),u("div",{className:"relative flex min-h-0 flex-1 flex-col",children:[n("div",{className:"isolate min-h-0 flex-1 overflow-y-auto",...m&&{inert:""},children:h?u(Kt,{children:[n($e,{path:"/run/:id",component:Wt}),n($e,{render:({location:l})=>n(Hr,{location:l,appHistory:r})})]}):n("div",{className:"flex items-center justify-center p-ui-v2-4 text-ui-v2-content-secondary-idle",children:n(Qt,{className:"animate-spin","aria-hidden":!0})})}),n("div",{ref:a})]})]})}function zr({onClick:e}){return n(F,{type:"secondary",leftIcon:n(Xt,{}),onClick:e,className:"animate-in fade-in-0 slide-in-from-left-2 duration-200 motion-reduce:animate-none",children:"Back to run"})}function Gr({appHistory:e}){const{pathname:t,search:r}=ot(),s=t+r;return u("a",{href:s,onClick:a=>{D({target:"run",trigger:"run_preview"}),!De(a)&&(a.preventDefault(),e.push(s))},className:O(tn({type:"secondary",size:"default"}),en,"ml-auto"),children:[n("span",{className:O(Zt({size:"default"}),"pl-ui-v2-0_5 pr-ui-v2-1"),children:"Open run"}),lt(n(ke,{}),Jt.default)]})}function Hr({location:e,appHistory:t}){return d.useLayoutEffect(()=>{t.push(e)},[t,e]),null}const Vr=10,P=Qn(),v={author:"Author",branch:"Branch",tags:"Tags",environment:"Environment",firstRun:"First run"},jr="(width < 40rem)",Kr=["pullRequest","latestRun","lastRun"];function Wr({mostCommonRepository:e,density:t,isPhoneWidth:r,stackPositionById:s,parentAboveIds:a}){const o=[P.display({id:"pullRequest",size:r?120:320,minSize:120,header:()=>"Pull request",meta:{alwaysVisible:!0,selectorLabel:"Pull request",align:"start"},cell:({row:i})=>n(Qr,{item:i.original,mostCommonRepository:e,density:t,isPhoneWidth:r,stackPosition:s==null?void 0:s.get(i.original.pullRequest.id),parentAbove:a==null?void 0:a.has(i.original.pullRequest.id)})}),P.display({id:"author",header:()=>v.author,meta:{selectorLabel:v.author,align:"start",width:{kind:"fixed",px:160}},cell:({row:i})=>n(nn,{commit:i.original.latestRun.meta.commit})}),P.display({id:"branch",header:()=>v.branch,meta:{selectorLabel:v.branch,align:"start",width:{kind:"flex",min:160,max:320}},cell:({row:i})=>{const{source:m,destination:h}=i.original.pullRequest;return m?n(Ie,{source:m,destination:h}):n(Ue,{})}}),P.display({id:"tags",header:()=>v.tags,meta:{selectorLabel:v.tags,align:"start",width:{kind:"flex",min:160,max:320}},cell:({row:i})=>n(ze,{tags:i.original.latestRun.tags,limit:3})}),P.display({id:"environment",header:()=>v.environment,meta:{selectorLabel:v.environment,align:"start",width:{kind:"flex",min:120,max:200}},cell:({row:i})=>n(ze,{tags:i.original.latestRun.environments,label:"environment",icon:n(rn,{size:"default"}),limit:2})}),P.display({id:"latestRun",header:()=>"Latest run",meta:{alwaysVisible:!0,selectorLabel:"Latest run",align:"start",width:{kind:"fixed",px:104}},cell:({row:i})=>n(Xr,{item:i.original})}),P.display({id:"recentRuns",header:()=>"Recent runs",meta:{alwaysVisible:!0,selectorLabel:"Recent runs",align:"start",width:{kind:"fixed",px:132}},cell:({row:i})=>n(Zr,{runs:i.original.recentRuns})}),P.display({id:"runs",header:()=>n(C,{trigger:n("span",{children:"Runs"}),children:"Runs in the selected range that match the filters"}),meta:{alwaysVisible:!0,selectorLabel:"Runs",width:{kind:"fixed",px:64}},cell:({row:i})=>n(N.NumberCell,{children:le(i.original.stats.total)})}),P.display({id:"firstRun",header:()=>v.firstRun,meta:{selectorLabel:v.firstRun,width:{kind:"fixed",px:136}},cell:({row:i})=>{const m=yr(i.original.cursor);return m?n(ye,{date:m,label:"First run"}):n(Ue,{})}}),P.display({id:"lastRun",header:()=>"Last run",meta:{alwaysVisible:!0,selectorLabel:"Last run",width:{kind:"fixed",px:r?72:136}},cell:({row:i})=>n(ye,{date:i.original.latestRun.createdAt,label:"Last run",short:r})}),P.display({id:"pullRequestLink",header:()=>n("span",{className:"sr-only",children:"Pull request link"}),meta:{alwaysVisible:!0,width:{kind:"fixed",px:40}},cell:({row:i})=>n(es,{link:i.original.pullRequest.link})})];return r?o.filter(i=>Kr.includes(i.id)):o}function Ce(e){return Kn(new Date(e),{addSuffix:!0})}function Ie({source:e,destination:t,wrap:r=!1,className:s}){return u("span",{className:O("flex min-w-0 items-center gap-ui-v2-1",r&&"flex-wrap",s),children:[n(ut,{className:"shrink-0"}),n("span",{className:O("min-w-0",r?"wrap-anywhere":"truncate"),children:e}),t&&u(Le,{children:[n(Te,{className:"shrink-0"}
18),n("span",{className:O(r?"min-w-0 wrap-anywhere":"max-w-1/2 shrink-0 truncate"),children:t})]})]})}function Qr({item:e,mostCommonRepository:t,density:r,isPhoneWidth:s,stackPosition:a,parentAbove:o}){var _;const{pullRequest:i,stackedOn:m,latestRun:h}=e,f=St(i,(_=h.meta.commit)==null?void 0:_.message),l=s?null:ar(i.repository,t),c=i.prNumber?`${l??""}#${i.prNumber}`:l,g=r==="comfortable"&&i.source,b=u("div",{className:"grid min-w-0 grid-flow-col grid-cols-[auto] auto-cols-[minmax(0,max-content)] items-center justify-start gap-ui-v2-2",children:[a&&n(Mr,{position:a,item:e}),c&&n("span",{className:"shrink-0 whitespace-nowrap tabular-nums text-ui-v2-content-secondary-idle",children:c}),u(sn,{children:[n(N.TextCell,{asChild:!0,children:n(an,{asChild:!0,children:n("span",{className:f.fallback?"text-ui-v2-content-secondary-idle":"text-inherit",children:f.text})})}),n(on,{children:u("div",{className:"flex max-w-2xl flex-col gap-ui-v2-1",children:[f.fallback!=="none"&&n("span",{className:"whitespace-pre-line",children:f.text}),f.fallback&&n("span",{className:"text-ui-v2-content-secondary-idle",children:f.fallback==="commitMessage"?"No title reported by CI. This is the latest commit message.":"No title or commit message reported by CI."}),i.source&&n(Ie,{source:i.source,destination:i.destination,wrap:!0,className:"text-ui-v2-content-secondary-idle"}),i.repository&&n("span",{className:"text-ui-v2-content-secondary-idle",children:i.repository})]})})]}),Ae(h.meta.commit)&&n(Or,{}),m&&!o&&n(Yr,{stackedOn:m,destination:i.destination})]});return g?u("div",{className:"flex min-w-0 flex-col",children:[b,n(Ie,{source:i.source,destination:s?null:i.destination,className:"text-ui-v2-13 text-ui-v2-content-secondary-idle"})]}):b}function Yr({stackedOn:e,destination:t}){const r=e.prNumber?`#${e.prNumber}`:null;return n(C,{trigger:n("span",{className:"inline-flex min-w-0 overflow-hidden",children:n(dn,{appearance:"subtle",tone:"neutral",children:r?`Stacked on ${r}`:"Stacked"})}),children:u("div",{className:"flex max-w-2xl flex-col gap-ui-v2-1",children:[e.title&&n("span",{children:[r,e.title].filter(Boolean).join(" ")}),t&&n("span",{className:"text-ui-v2-content-secondary-idle",children:`Merges into ${t}, the source branch of ${r??"that pull request"}`})]})})}function Xr({item:e}){var o;const{latestRun:t,recentRuns:r}=e,s=de(t.status,t.completionState),a=((o=r.find(i=>i.runId===t.runId))==null?void 0:o.failures)??0;return n(C,{trigger:n("span",{className:"inline-flex",children:n(ln,{status:s,fixedWidth:!1,animated:!0})}),children:[`Latest run · ${Ce(t.createdAt)}`,a>0?_t(a):null].filter(Boolean).join(" · ")})}function Zr({runs:e}){const t=Me(),r=[...e].reverse(),s=Math.max(Vr-r.length,0);return u("span",{role:"group","aria-label":ir(r),className:"flex items-center gap-ui-v2-1",children:[Array.from({length:s},(a,o)=>n("span",{"aria-hidden":!0,className:"size-2 shrink-0 rounded-full bg-ui-v2-ui-highlight-hover"},`empty-${o}`)),r.map(a=>n(Jr,{run:a,onOpenPreview:t.open},a.runId))]})}function Jr({run:e,onOpenPreview:t}){const r=de(e.status,e.completionState),s=lr(e);return n(C,{trigger:n(Ee,{to:J(e.runId),tabIndex:-1,"aria-label":`${oe[r]} run, ${Ce(e.createdAt)}`,onClick:a=>{D({target:"run",trigger:"recent_runs"}),!De(a)&&(a.preventDefault(),t(e.runId))},className:"group/dot flex h-4 items-center",children:n("span",{className:"flex transition-transform duration-100 ease-out group-hover/dot:scale-150 motion-reduce:transition-none",children:n(ue,{status:r,animated:!0})})}),children:u("div",{className:"flex flex-col gap-ui-v2-0_5",children:[u("span",{className:"flex items-center gap-ui-v2-1",children:[n(ue,{status:r}),`${oe[r]} · ${Ce(e.createdAt)}`]}),s&&n("span",{className:"text-ui-v2-content-secondary-idle",children:s})]})})}function es({link:e}){const t=ct(e);return t?n(N.RowReveal,{children:n(C,{trigger:n("a",{href:t,target:"_blank",rel:"noopener noreferrer",onClick:()=>D({target:"pull_request",trigger:"row_reveal"}),"aria-label":"Open pull request",className:cn({type:"secondary",size:"default"}),children:lt(n(ke,{}),un.default)}),children:"Open pull request"})}):null}const yt=d.createContext(null);function ts({href:e,className:t,children:r}){const s=d.useContext(yt);return n(Ee,{to:e,className:t,onClick:a=>{D({target:"run",trigger:"expanded_row"}
18),!(!s||De(a))&&(a.preventDefault(),s(e))},children:r})}const We="This commit ran again after this run";function ns({failures:e}){return u("span",{className:"flex shrink-0 items-center gap-ui-v2-1 whitespace-nowrap ty-text tabular-nums text-ui-v2-content-secondary-idle",children:[n(ue,{status:"failed",size:"sm"}),_t(e)]})}function rs({commit:e}){const t=bt(e.sha);return!e.authorName&&!t?null:u("span",{className:"flex shrink-0 items-center gap-ui-v2-2 whitespace-nowrap ty-text text-ui-v2-content-secondary-idle",children:[e.authorName&&n("span",{className:"max-w-40 truncate",children:e.authorName}),t&&u("span",{className:"flex items-center gap-ui-v2-1",children:[n(hn,{"aria-hidden":!0,className:"shrink-0"}),t]})]})}function ss(e,t){return{id:e.runId,status:de(e.status,e.completionState),primary:u("span",{className:O("flex min-w-0 items-center gap-ui-v2-2",t&&"opacity-60"),children:[n("span",{className:"min-w-0 truncate",children:ur(e)}),Ae(e.commit)&&n(Er,{}),t&&n(C,{trigger:u("span",{"data-superseded":"true",className:"flex shrink-0 items-center text-ui-v2-content-secondary-idle",children:[n("span",{className:"sr-only",children:We}),n(fn,{"aria-hidden":!0})]}),children:We})]}),meta:u("span",{className:O("flex min-w-0 items-center gap-ui-v2-2",t&&"opacity-60"),children:[n(rs,{commit:e.commit}),e.failures>0&&n(ns,{failures:e.failures})]}),durationMs:cr(e),time:n(ye,{date:e.createdAt,label:"Created at"}),href:J(e.runId)}}function as({item:e,allRunsPath:t}){Fr({runCount:e.stats.total});const r=Me(),s=dr(e),a=or(e.recentRuns);function o(i){const m=e.recentRuns.find(({runId:h})=>J(h)===i);m&&r.open(m.runId)}return u("div",{className:"flex flex-col gap-ui-v2-1",children:[n(yt.Provider,{value:o,children:n(mn,{items:e.recentRuns.map(i=>ss(i,a.has(i.runId))),selectedId:r.runId,revealOnMount:!0,linkComponent:ts})}),s!==null&&n("div",{className:"pl-ui-v2-5",children:n(nt,{asChild:!0,children:u(Ee,{to:t,onClick:()=>D({target:"all_runs",trigger:"expanded_row"}),children:[`View all ${le(s)} ${we("run",s)}`,n(Te,{"aria-hidden":!0})]})})})]})}const ce=["author","branch","tags","environment","firstRun"];function is(e,t){return`org_${e}_project_${t}_pull_requests_density_v1`}function os(e,t){return`org_${e}_project_${t}_pull_requests_columns_v1`}function ls(e,t){return`org_${e}_project_${t}_pull_requests_group_stacked_v1`}function us(e,t){return`org_${e}_project_${t}_pull_requests_page_size_v1`}function Nt(e,{columnChoices:t,hasEnvironment:r}){return t[e]??(e==="author"||e==="environment"&&r)}function cs({columnChoices:e,hasEnvironment:t,order:r}){return ce.filter(s=>Nt(s,{columnChoices:e,hasEnvironment:t})&&(s!=="firstRun"||r==="first_run"))}function ds(e){return Oe.find(t=>t===e)??null}function ms(e){return e==="comfortable"?"comfortable":"compact"}function fs(e){return gn(e,ce)}function hs({orgId:e,projectId:t}){const[r,s]=Y(is(e,t),null),[a,o]=Y(os(e,t),null),[i,m]=Y(ls(e,t),null),[h,f]=Y(us(e,t),null),l=d.useMemo(()=>fs(a),[a]);return{density:ms(r),setDensity:c=>s(c),columnChoices:l,setColumnChecked:(c,g)=>o({...l,[c]:g}),groupStacked:i!==!1,setGroupStacked:c=>m(c),storedPageSize:ds(h),setStoredPageSize:c=>f(c)}}const Z={index:1,startingAfter:null,endingBefore:null},Ct="f.",It="b.";function Qe(e,t){return e!=null&&e.startsWith(t)&&e.slice(t.length).trim()||null}function gs({cursor:e,page:t}){const r=Qe(e,Ct),s=Qe(e,It);return!r&&!s?Z:{index:typeof t=="number"&&Number.isSafeInteger(t)&&t>=2?t:2,startingAfter:r,endingBefore:s}}function xt(e){return e.startingAfter?{cursor:`${Ct}${e.startingAfter}`,page:e.index}:e.endingBefore?{cursor:`${It}${e.endingBefore}`,page:e.index}:{cursor:void 0,page:void 0}}function ps(e,t){const r=t[t.length-1];return r?{index:e.index+1,startingAfter:r.cursor,endingBefore:null}:e}function Rs(e,{items:t,hasMore:r}){const[s]=t,a=e.endingBefore!==null&&!r;return e.index<=2||!s||a?Z:{index:e.index-1,startingAfter:null,endingBefore:s.cursor}}function Ss(e,t){return{hasPrevious:e.index>1,hasNext:e.endingBefore!==null||t}}function bs(e,t){return(e.index-1)*t}function _s({page:e,error:t,items:r}){return e.index===1?!1:!!(t!=null&&t.graphQLErrors.some(a=>{var o;return((o=a.extensions)==null?void 0:o.code)==="CONDITION_FAILED"}))||(r==null?void 0:r.length)===0}function Ps({shown:e,newest:t}){var a,o;const r=(a=e==null?void 0:e[0])==null?void 0:a.cursor,s=(o=t==null?void 0:t[0])==null?void 0:o.cursor;return!!(r&&s&&r!==s)}const vs={pr_search:Pe,pr_status:Rn(Object.values(Sn)),order:He(Object.keys(ht)),dir:He([A.Asc,A.Desc]),size:Ge,cursor:Pe,page:Ge},Ye=xt(Z);function me({storedPageSize:e}={}){var f;const[t,r]=pn(vs),s=t.pr_status??[],a=t.dir??Zn;function o(l){r({...l,...Ye})}const i=d.useCallback(l=>r(xt(l),"replaceIn"),[r]),m=d.useCallback(l=>r({size:l},"replaceIn"),[r]),h=t.size==null?t.cursor?X:e??X:br(t.size);return{prSearch:t.pr_search??null,statuses:s,hasFilters:!!((f=t.pr_search)!=null&&f.trim())||s.length>0,order:t.order??je,dir:a,pageSize:h,hasPageSizeParam:t.size!=null,
18seedPageSize:m,page:gs(t),setPrSearch:l=>o({pr_search:l||void 0}),toggleStatus:l=>{const c=s.includes(l)?s.filter(g=>g!==l):[...s,l];o({pr_status:c.length>0?c:void 0})},clearFilters:()=>o({pr_search:void 0,pr_status:void 0}),setOrder:l=>o({order:l===je?void 0:l}),toggleDir:()=>o({dir:a===A.Desc?A.Asc:void 0}),setPageSize:l=>o({size:l===X?void 0:l}),setPage:i,resetToFirstPage:()=>r(Ye)}}function ys(e,{columnChoices:t,order:r}){if(e==="environment"&&t.environment===void 0)return"Shown when a row on the page has an environment";if(e==="firstRun"&&r!=="first_run")return"Shown when sorted by first run"}function Ns({displaySettings:{columnChoices:e,setColumnChecked:t},hasEnvironment:r}){const{order:s}=me();return n(bn,{options:ce.map(a=>({id:a,label:v[a],description:ys(a,{columnChoices:e,order:s})})),checkedIds:ce.filter(a=>Nt(a,{columnChoices:e,hasEnvironment:r})),onCheckedChange:t})}const Xe=[{value:"last_run",label:"Last run"},{value:"first_run",label:"First run"},{value:"run_count",label:"Number of runs"}],Cs=Oe.map(e=>({value:e,label:String(e)})),Ze=[{value:"compact",label:"Compact"},{value:"comfortable",label:"Comfortable",description:"Adds the source and destination branches under the title"}];function Je(e,t){var r;return((r=e.find(s=>s.value===t))==null?void 0:r.label)??""}function Is({displaySettings:e}){const{density:t,setDensity:r,groupStacked:s,setGroupStacked:a,storedPageSize:o,setStoredPageSize:i}=e,{order:m,dir:h,pageSize:f,setOrder:l,toggleDir:c,setPageSize:g}=me({storedPageSize:o}),b=p=>{g(p),i(p)},_=h===A.Desc?_n:Pn;return u(T,{children:[n(T.Trigger,{asChild:!0,children:n(F,{type:"primary",leftIcon:n(yn,{}),chevron:n(vn,{"aria-hidden":!0}),className:"shrink-0",children:"Display"})}),u(T.Content,{align:"end",className:"min-w-56",children:[n(T.Header,{children:"Ordering"}),n(Se,{label:"Sort by",currentLabel:Je(Xe,m),options:Xe,value:m,onSelect:l}),n(T.Item,{closeOnSelect:!1,iconStart:n(_,{...Nn,"aria-hidden":!0}),onSelect:c,children:Pr(m,h)}),n(T.Separator,{}),n(Se,{label:"Rows per page",currentLabel:String(f),options:Cs,value:f,onSelect:b}),n(Se,{label:"Density",currentLabel:Je(Ze,t),options:Ze,value:t,onSelect:r,contentClassName:"max-w-64"}),n(T.Separator,{}),n(Cn,{checked:s,textValue:"Group stacked pull requests",description:"Shows stacked pull requests under their parent",onCheckedChange:a,children:"Group stacked pull requests"})]})]})}function xs({orgId:e,projectId:t,storedPageSize:r}){var se,ae,V,k,j,ie;const[s,a,o]=In({defaultLookback:ft}),{filters:i,tagsLogicalOperator:m}=dt(),{prSearch:h,statuses:f,order:l,dir:c,pageSize:g,hasPageSizeParam:b,seedPageSize:_,page:p,setPage:I}=me({storedPageSize:r});d.useEffect(()=>{!b&&g!==X&&_(g)},[b,g,_]);const x=p.index===1,B={orgId:e,projectId:t,startDate:s.toISOString(),endDate:a.toISOString(),..._r({prSearch:h,statuses:f,order:l,dir:c,pageSize:g}),runsPerPr:0,startingAfter:null,endingBefore:null,...fr({tags:i.tag.values,authors:i.author.values,branches:i.branch.values,environments:i.environment.values,tagsLogicalOperator:m}),completionStates:null,prId:null,search:null},S=be({variables:{input:{...B,startingAfter:p.startingAfter,endingBefore:p.endingBefore}},fetchPolicy:"cache-and-network",notifyOnNetworkStatusChange:!0}),fe=be({variables:{input:B},fetchPolicy:"cache-first",skip:x}),ee=be({variables:{input:{...B,limit:1}},fetchPolicy:"network-only",pollInterval:Rt,skip:x}),w=_s({page:p,error:S.error,items:(se=S.data)==null?void 0:se.pullRequests.items});d.useEffect(()=>{w&&I(Z)},[w,I]);const{items:L,error:te}=pr({data:(ae=S.data)==null?void 0:ae.pullRequests.items,previousData:(V=S.previousData)==null?void 0:V.pullRequests.items,error:w?void 0:S.error}),$=bs(p,g),[M,he]=d.useState($);S.data&&M!==$&&he($);const q=!x&&Ps({shown:(k=fe.data)==null?void 0:k.pullRequests.items,newest:(j=ee.data)==null?void 0:j.pullRequests.items}),U=ee.stopPolling;d.useEffect(()=>{q&&U()},[q,U]);const z=Sr(L),{startPolling:G,stopPolling:ne}=S;d.useEffect(()=>{if(x)return G(z),ne},[x,z,G,ne]);function H(){S.refetch()}const re=((ie=S.data??S.previousData)==null?void 0:ie.pullRequests.hasMore)??!1;return{items:L,loading:w||S.loading&&S.networkStatus!==Yn.poll,error:te,retry:H,lookbackDays:o,startDate:s,endDate:a,page:p,firstRowIndex:M,...Ss(p,re),goToNextPage:()=>I(ps(p,L)),goToPreviousPage:()=>I(Rs(p,{items:L,hasMore:re})),goToFirstPage:()=>I(Z),firstPageChanged:q}}function ws({project:e}){return wn([{label:e.name??"Project",link:mt(e.projectId),type:"project"},{label:"Pull requests",link:Ln(e.projectId)}]),kn({currentProject:e}),u(En,{children:[n(Tn,{children:n("title",{children:`${e.name??"Project"} Pull requests`})}),n(Os,{orgId:e.orgId,projectId:e.projectId},e.projectId)]})}const Ys=xn(ws);
18function Ls(e){return e.pullRequest.id}const ks=10;function Ts({firstRowIndex:e,rowCount:t}){const r=e+1;return`${le(r)}â${le(r+t-1)}`}function Es({projectId:e,prId:t,search:r,lookbackDays:s}){const a=mr({search:r,lookbackDays:s});return a.set(Gn,t),`${mt(e)}?${a}`}function Os({orgId:e,projectId:t}){const r=it(),{search:s}=ot(),[,a]=On(),o=An(),i=me(),m=dt({resetToFirstPage:i.resetToFirstPage}),h=d.useRef(null),f=hs({orgId:e,projectId:t}),l=Me(),{items:c,loading:g,error:b,retry:_,lookbackDays:p,startDate:I,endDate:x,page:B,firstRowIndex:S,hasPrevious:fe,hasNext:ee,goToPreviousPage:w,goToNextPage:L,goToFirstPage:te,firstPageChanged:$}=xs({orgId:e,projectId:t,storedPageSize:f.storedPageSize}),M=kr({orgId:e,projectId:t,listIsMissingCommitInfo:xr(c)}),{rows:he,stackPositionById:q,parentAboveIds:U}=d.useMemo(()=>{if(!f.groupStacked)return{rows:c,stackPositionById:void 0,parentAboveIds:void 0};const R=Ir(c);return{rows:R.rows,stackPositionById:R.positionById,parentAboveIds:R.parentAboveIds}},[c,f.groupStacked]),z=d.useMemo(()=>sr(c.map(R=>R.pullRequest.repository)),[c]),G=Xn(jr),ne=d.useMemo(()=>Wr({mostCommonRepository:z,density:f.density,isPhoneWidth:G,stackPositionById:q,parentAboveIds:U}),[z,f.density,G,q,U]),H=hr(c),re=d.useMemo(()=>cs({columnChoices:f.columnChoices,hasEnvironment:H,order:i.order}),[f.columnChoices,H,i.order]),se=Dn({data:he,columns:ne,getRowId:Ls,columnVisibility:re}),ae=gr({lookbackDays:p,startDate:I,endDate:x})<_e,V=d.useRef(null);function k(R){return()=>{var y;R(),(y=V.current)==null||y.focus()}}const j={rangeLabel:c.length>0?Ts({firstRowIndex:S,rowCount:c.length}):void 0,hasPrevious:fe,hasNext:ee,disabled:g,onPrevious:w,onNext:L,onFirstPage:B.index>1?k(te):void 0};function ie(R,y){D({target:"latest_run",trigger:y}),r.push(J(R.latestRun.runId))}const wt=d.useCallback(R=>n(as,{item:R.original,allRunsPath:Es({projectId:t,prId:R.original.pullRequest.id,search:s,lookbackDays:p})}),[t,s,p]);function Lt(){return b?n(N.Empty,{title:"Couldn't load pull requests",caption:b.message,children:n(F,{type:"primary",onClick:_,children:"Try again"})}):i.hasFilters||m.activeCount>0?n(N.Empty,{title:"No pull requests match these filters",caption:"Status and search are checked on each pull request's latest run.",children:n(F,{type:"primary",onClick:()=>{i.clearFilters(),m.clearAll()},children:"Clear filters"})}):n(N.Empty,{title:Rr(p),caption:"Runs are listed here when CI reports a pull request.",children:ae&&n(F,{type:"primary",onClick:()=>{a(String(_e)),i.resetToFirstPage()},children:`Use last ${_e} days`})})}function kt(R){var Fe,Be;const{pullRequest:y,latestRun:qe}=R.original,Tt=St(y,(Fe=qe.meta.commit)==null?void 0:Fe.message),ge=ct(y.link),K=y.source,pe=(Be=qe.meta.commit)==null?void 0:Be.authorName;return u(Le,{children:[n(E.Header,{children:n("span",{className:"block max-w-64 truncate",children:[y.prNumber&&`#${y.prNumber}`,Tt.text].filter(Boolean).join(" ")})}),n(E.Item,{iconStart:n(Te,{"aria-hidden":!0}),onSelect:()=>ie(R.original,"context_menu"),children:"Open latest run"}),ge&&n(E.Item,{iconStart:n(ke,{"aria-hidden":!0}),onSelect:()=>{D({target:"pull_request",trigger:"context_menu"}),window.open(ge,"_blank","noopener,noreferrer")},children:`Open on ${new URL(ge).hostname}`}),K&&n(E.Item,{iconStart:n(Hn,{"aria-hidden":!0}),onSelect:()=>o(K,"branch name"),children:"Copy branch name"}),(pe||K)&&n(E.Separator,{}),pe&&n(E.Item,{iconStart:n(Vn,{"aria-hidden":!0}),onSelect:()=>m.filters.author.add(pe),children:"Filter by this author"}),K&&n(E.Item,{iconStart:n(ut,{"aria-hidden":!0}),onSelect:()=>m.filters.branch.add(K),children:"Filter by this branch"})]})}return u(Tr,{open:M.open,children:[u(Q,{level:1,children:[u(Q.Header,{className:"flex-wrap",children:[u(Q.Controls,{className:"min-w-56",children:[n(Mn,{defaultLookback:ft,onChange:i.resetToFirstPage}),n(qn,{className:"w-80 max-w-full","aria-label":"Search pull requests",placeholder:"Search by title, #number or branch",initialValue:i.prSearch,onChange:i.setPrSearch})]}),u(Q.Actions,{className:"ml-auto flex-initial flex-wrap justify-end",children:[n(Fn,{orgId:e,projectId:t,termFilters:m,triggerRef:h}),n(Ns,{displaySettings:f,hasEnvironment:H}),n(Is,{displaySettings:f})]})]}),u(Q.Body,{children:[M.visible&&n(Ar,{onDismiss:M.dismiss}
18),u(N,{instance:se,density:f.density,loading:g,enableResize:!0,renderExpandedRow:wt,renderRowContextMenu:kt,keyboardNav:{rowIndexStart:S,rowCount:Bn},emptyState:Lt(),children:[u(N.Toolbar,{children:[n($n,{"aria-label":"Latest run status",selected:i.statuses,onToggle:i.toggleStatus}),c.length>0&&n(N.Toolbar.End,{children:n(Ve,{ref:V,tabIndex:-1,...j})}),n(Un,{termFilters:m,focusFilterButton:()=>{var R;return(R=h.current)==null?void 0:R.focus()}})]}),$&&n("div",{className:"flex justify-center pb-ui-v2-3",children:n(F,{type:"primary",leftIcon:n(ue,{status:"running",animated:!0,size:"sm"}),onClick:k(te),children:"New runs · Back to newest"})})]}),c.length>ks&&n(N.Footer,{className:"justify-end",children:n(Ve,{...j,"aria-label":zn,onPrevious:k(w),onNext:k(L)})})]})]}),n(Br,{runId:l.runId,onClose:l.close})]})}export{Ys as PullRequestsView,Ys as default}; 19//# sourceMappingURL=pullRequestsView-D2FA3AYu.js.map
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.