ccdeck 3.45.0 → 3.46.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (31) hide show
  1. package/README.md +7 -4
  2. package/bin/cli/startup.js +4 -3
  3. package/dist/web/assets/BrowserWatchModal-CoX9FIUE.js +1 -0
  4. package/dist/web/assets/IntegrationModal-B1ypkK-E.js +5 -0
  5. package/dist/web/assets/RadioPanel-biw_BbZq.js +1 -0
  6. package/dist/web/assets/TrafficRadar-nhtFoYVv.js +8 -0
  7. package/dist/web/assets/{UsageHistoryModal-DAhplVju.js → UsageHistoryModal-Bd-JRAa4.js} +1 -1
  8. package/dist/web/assets/app-BlRY6EME.css +1 -0
  9. package/dist/web/assets/app-DhGvSH7o.js +319 -0
  10. package/dist/web/assets/{index-r8Ymr47Q.js → index-DmENqVdt.js} +1 -1
  11. package/dist/web/index.html +3 -3
  12. package/package.json +1 -1
  13. package/release-notes.json +30 -0
  14. package/src/server/claude-accounts.mjs +35 -19
  15. package/src/server/claude-login.mjs +111 -0
  16. package/src/server/cswap-admin.mjs +12 -3
  17. package/src/server/installer.mjs +24 -7
  18. package/src/server/login-service.mjs +2 -2
  19. package/src/server/skill-hook.mjs +28 -22
  20. package/src/server/system-metrics.mjs +4 -0
  21. package/src/server/tool-audit-routes.mjs +4 -0
  22. package/src/server/traffic-radar-config.mjs +33 -0
  23. package/src/server/traffic-radar-platform.mjs +84 -17
  24. package/src/server/traffic-radar-service.mjs +6 -3
  25. package/src/server/traffic-radar.mjs +32 -9
  26. package/dist/web/assets/BrowserWatchModal-Cbzf3TWa.js +0 -1
  27. package/dist/web/assets/IntegrationModal-BnnBr0a3.js +0 -5
  28. package/dist/web/assets/RadioPanel-BIqrMLQN.js +0 -1
  29. package/dist/web/assets/TrafficRadar-D1gZCIwX.js +0 -8
  30. package/dist/web/assets/app-BW3NYUYB.js +0 -318
  31. package/dist/web/assets/app-C5RY_wZ4.css +0 -1
@@ -0,0 +1,5 @@
1
+ import{r as is,a as cs,w as ds,b as d,p as gn,m as jn,j as t,u as us,c as hs,q as ms,I as _t,R as fs,s as Ze,d as et,e as xn,f as bn,g as _e,h as Lt,U as yn,E as Le,i as ps,k as Nn,A as Et,t as kn,T as gs,l as js,n as xs,o as bs,v as ys,x as Ns,y as ks,z as ws,B as vs,C as $s,D as Ss,F as Cs}from"./app-DhGvSH7o.js";const re={min:320,standard:440,max:1600},wn=.42,vn=`clamp(${re.min}px, ${wn*100}%, ${re.standard}px)`,As=420,Rs=8,Ls="(max-width: 899px)",Nt=e=>`agent-dag.integrations.${e}.detail-width`;function Pe(e,n){const s=Math.max(re.min,Math.min(re.max,n-As-Rs));return Math.round(Math.min(s,Math.max(re.min,Number.isFinite(e)?e:re.standard)))}function Ht(e){return Pe(Math.min(re.standard,Math.max(re.min,e*wn)),e)}function Es(e){const n=is(Nt(e));if(n==null)return null;const s=Number(n);return Number.isFinite(s)&&s>=re.min&&s<=re.max?Math.round(s):null}function Ms(e,n){n==null?cs(Nt(e)):ds(Nt(e),String(Math.round(n)))}function Ds({width:e,workspace:n,controls:s,onCommit:r}){const a=d.useRef(null),l=d.useRef(null),c=()=>{var x;return((x=n.current)==null?void 0:x.clientWidth)??window.innerWidth},i=e==null?Ht(c()):Pe(e,c()),u=x=>{var p,g;(p=n.current)==null||p.style.setProperty("--ig-detail-w",`${x}px`),(g=a.current)==null||g.setAttribute("aria-valuenow",String(x))},o=x=>{var p,g;x==null?((p=n.current)==null||p.style.setProperty("--ig-detail-w",vn),(g=a.current)==null||g.setAttribute("aria-valuenow",String(Ht(c())))):u(x),r(x)},b=x=>{var p;x.button===0&&(x.preventDefault(),x.currentTarget.setPointerCapture(x.pointerId),l.current={x:x.clientX,width:i,room:c(),last:i},(p=n.current)==null||p.setAttribute("data-resizing",""))},h=x=>{const p=l.current;p&&(p.last=Pe(p.width+p.x-x.clientX,p.room),u(p.last))},m=()=>{var p;const x=l.current;x&&(l.current=null,(p=n.current)==null||p.removeAttribute("data-resizing"),o(x.last))},f=x=>{const p=x.shiftKey?64:16;if(x.key==="Enter"){x.preventDefault(),o(null);return}const g=x.key==="ArrowLeft"?i+p:x.key==="ArrowRight"?i-p:x.key==="Home"?re.min:x.key==="End"?re.max:null;g!==null&&(x.preventDefault(),o(Pe(g,c())))};return t.jsx("div",{ref:a,className:"ig-splitter",role:"separator","aria-orientation":"vertical","aria-label":"Detail width","aria-controls":s,"aria-valuemin":re.min,"aria-valuemax":Pe(re.max,c()),"aria-valuenow":i,tabIndex:0,title:"Drag to resize · double-click for the automatic width",onPointerDown:b,onPointerMove:h,onPointerUp:m,onPointerCancel:m,onLostPointerCapture:m,onDoubleClick:()=>o(null),onKeyDown:f})}function $n(){return us(Ls)}function Mt({list:e,detail:n,onBack:s,backLabel:r,storageKey:a,detailKey:l}){const c=$n(),i=`${d.useId()}-detail`,u=d.useRef(null),o=d.useRef(null),b=d.useRef(null),h=d.useRef(null),[m,f]=d.useState(()=>Es(a)),x=L=>{f(L),Ms(a,L)},p=n!=null,g=d.useRef(null);p&&(g.current=n);const[j,$]=d.useState(p),[y,A]=d.useState(null);j!==p&&($(p),A(!p&&c&&!gn()?g.current:null));const _=p?n:y,N=!p&&y!=null;d.useEffect(()=>{if(!N)return;const L=window.setTimeout(()=>A(null),200);return()=>window.clearTimeout(L)},[N]),d.useLayoutEffect(()=>{b.current&&(b.current.inert=N)},[N]),d.useLayoutEffect(()=>{const L=b.current;!L||!p||(L.dataset.flip=L.dataset.flip==="a"?"b":"a")},[p,l]);const D=d.useRef(null);d.useLayoutEffect(()=>{var M,S,v;if(!p)return;const L=document.activeElement;L instanceof HTMLElement&&((M=o.current)!=null&&M.contains(L))&&(D.current=L),c&&(!L||L===document.body||(S=o.current)!=null&&S.contains(L))&&((v=h.current)==null||v.focus({preventScroll:!0}))},[p,c,l]),d.useEffect(()=>{if(p)return;const L=D.current;if(!L)return;const M=requestAnimationFrame(()=>{var v;const S=document.activeElement;(!S||S===document.body)&&L.isConnected&&(((v=L.checkVisibility)==null?void 0:v.call(L))??!0)&&L.focus({preventScroll:!0})});return()=>cancelAnimationFrame(M)},[p]);const I=d.useRef(s);return I.current=s,d.useEffect(()=>{if(p)return jn.push(()=>I.current(),0,"popover")},[p]),t.jsxs("div",{ref:u,className:"ig-split","data-detail":p||void 0,"data-drill-in":c||void 0,style:{"--ig-detail-w":m==null?vn:`${m}px`},children:[t.jsx("div",{ref:o,className:"ig-list",hidden:c&&p||void 0,children:e}),p&&!c&&t.jsx(Ds,{width:m,workspace:u,controls:i,onCommit:x}),_!=null&&t.jsxs("section",{ref:b,className:"ig-detail",id:i,"aria-label":"Details","data-leaving":N||void 0,onAnimationEnd:L=>{N&&L.target===L.currentTarget&&A(null)},children:[c&&t.jsxs("button",{ref:h,type:"button",className:"ig-back","data-ig-back":!0,onClick:s,children:[t.jsx("svg",{width:"13",height:"13",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:t.jsx("path",{d:"M8.6 3 4.6 7l4 4"})}),r]}),_]})]})}const De=(e,n,s={},r)=>hs(e,`${n}${ms(s)}`,{signal:r}),Sn=(e,n,s,r)=>De(e,"boards",{startAt:n||void 0,name:s},r),Ts=(e,n,s)=>De(e,`board/${encodeURIComponent(n)}`,{},s),Fs=(e,n,s,r)=>De(e,`board/${encodeURIComponent(n)}/closed-sprints`,{startAt:s||void 0},r),Wt=(e,n,s,r)=>De(e,`board/${encodeURIComponent(n)}/issues`,{source:s.source,sprint:s.sprint,column:s.column,cursor:s.cursor||void 0,backlog:s.backlog,mine:s.mine,quick:s.quick.join(",")||void 0},r),Is=(e,n,s)=>De(e,`issue/${encodeURIComponent(n)}/subtasks`,{},s),Os=(e,n,s)=>De(e,`issue/${encodeURIComponent(n)}`,{},s);function Ps(e,n,s){var i;let r;try{r=new URL(s)}catch{return null}const a=typeof((i=e.meta)==null?void 0:i.apiBase)=="string"?e.meta.apiBase:"";let l="";try{l=new URL(e.baseUrl).origin}catch{}if(a&&r.origin===l&&/^\/(rest|images)\//.test(r.pathname))try{r=new URL(`${a}${r.pathname}${r.search}`)}catch{return null}if(/\.svg$/i.test(r.pathname))return null;const c=r.protocol==="http:"&&/^(localhost|127\.0\.0\.1|\[::1\])$/.test(r.hostname)&&e.allowedOrigins.includes(r.origin);return r.protocol!=="https:"&&!c?null:n(r.href)}const ft=e=>`sprint:${e.id}`;function qt(e,n=[]){const s=[];if(e.hasSprints){for(const r of e.sprints.active)s.push({id:ft(r),kind:"active",title:r.name,sprint:r,defaultOpen:!0,paged:!1});for(const r of e.sprints.future)s.push({id:ft(r),kind:"future",title:r.name,sprint:r,defaultOpen:!1,paged:!1});e.hasBacklog&&s.push({id:"backlog",kind:"backlog",title:"Backlog",defaultOpen:!1,paged:!0});for(const r of n)s.push({id:ft(r),kind:"closed",title:r.name,sprint:r,defaultOpen:!1,paged:!1});return s}return s.push({id:"column:todo",kind:"column",column:"todo",title:"To Do",defaultOpen:!0,paged:!1}),s.push({id:"column:progress",kind:"column",column:"progress",title:"In Progress",defaultOpen:!0,paged:!1}),s.push({id:"column:done",kind:"column",column:"done",title:"Done in the last 14 days",defaultOpen:!1,paged:!1}),e.hasBacklog&&s.push({id:"backlog",kind:"backlog",title:"Backlog",defaultOpen:!1,paged:!0}),s}function pt(e,n){return Object.hasOwn(n,e.id)?n[e.id]:e.defaultOpen}const Be=e=>e.kind==="issue"?e.issue.key:e.parent.key;function Bs(e,n=new Set){const s=new Map;for(const l of e)!n.has(l.key)&&!s.has(l.key)&&s.set(l.key,l);const r=[],a=new Map;for(const l of s.values()){const c=l.type.subtask&&l.parent?l.parent.key:null;if(c&&c!==l.key){let u=a.get(c);if(!u){const o=s.get(c);o&&!n.has(c)?u={kind:"issue",issue:o,matched:[]}:(u={kind:"context",parent:l.parent,matched:[]},r.push(u)),a.set(c,u)}u.matched.push(l);continue}let i=a.get(l.key);i||(i={kind:"issue",issue:l,matched:[]},a.set(l.key,i)),r.push(i)}for(const l of s.keys())n.add(l);return r}const Xe=e=>e.status.category==="done";function Dt(e){const n=e.trim().toLowerCase();return/highest|blocker|critical|urgent/.test(n)?"highest":/high|major/.test(n)?"high":/medium|normal|moderate/.test(n)?"medium":/lowest|trivial/.test(n)?"lowest":/low|minor/.test(n)?"low":null}function Us(e){return!Xe(e)&&(e.flagged||e.priority!=null&&Dt(e.priority.name)==="highest")}function Cn(e,n){return(!n.hideDone||!Xe(e))&&(!n.attention||Us(e))}const _s=/^only my issues$/i;function Hs(e){return e.filter(n=>!_s.test(n.name.trim()))}function Ws(e,n){return n?e.key.toLowerCase().includes(n)||e.summary.toLowerCase().includes(n):!0}function qs(e,n,s){const r=n.search.trim().toLowerCase();if(!r&&!n.hideDone&&!n.attention)return e.slice();const a=c=>Cn(c,n)&&Ws(c,r),l=[];for(const c of e){const i=c.matched.filter(a),u=(s==null?void 0:s(Be(c)))??[],o=i.length>0||u.some(a);c.kind==="issue"?(a(c.issue)||o)&&l.push({...c,matched:i}):o&&l.push({...c,matched:i})}return l}function Ks(e){return e.flatMap(n=>n.kind==="issue"?[n.issue]:n.matched)}function Gs(e,n){const s=Ks(e),r={new:0,indeterminate:0,done:0},a=new Map;let l=0,c=0,i=null,u=0,o=0;for(const h of s){const m=n==="count"?1:n==="points"?h.points??0:h.estimate??0;if(r[h.status.category]+=m,h.assignee){const f=a.get(h.assignee.id);f?f.n++:a.set(h.assignee.id,{person:h.assignee,n:1})}h.mine&&(l++,h.assignee&&(i=h.assignee.id),Xe(h)&&c++),Xe(h)||(h.flagged&&u++,h.priority&&Dt(h.priority.name)==="highest"&&o++)}const b=[...a.values()].sort((h,m)=>m.n-h.n||h.person.name.localeCompare(m.person.name)).map(h=>h.person);return{count:s.length,totals:r,assignees:b,mine:l,mineDone:c,youId:i,flagged:u,highest:o}}function Ae(e,n={hoursPerDay:8,daysPerWeek:5}){if(e==null||!Number.isFinite(e))return"";let s=Math.round(e/60);if(s<=0)return"0m";const r=60,a=Math.round(n.hoursPerDay*r),l=Math.round(a*n.daysPerWeek),c=[];for(const[i,u]of[[l,"w"],[a,"d"],[r,"h"],[1,"m"]]){if(i<=0)continue;const o=Math.floor(s/i);o>0&&(c.push(`${o}${u}`),s-=o*i)}return c.join(" ")}function Kt(e,n,s){return n==="time"?Ae(e,s)||"0m":n==="points"?`${Number.isInteger(e)?e:e.toFixed(1)}`:String(e)}function Gt(e){if(!e)return"";const n=new Date(e);return Number.isNaN(n.getTime())?"":n.toLocaleDateString(void 0,{day:"numeric",month:"short"})}function zs(e,n){const s=Ae(e.estimate,n),r=Ae(e.timeSpent,n),a=e.remaining!=null&&(e.remaining!==e.estimate||r)?Ae(e.remaining,n):"";return[s&&`${s} estimated`,a&&`${a} left`,r&&`${r} logged`].filter(Boolean).join(" · ")}function Fe(e,n=!1){if(!e)return"";const s=new Date(String(e).replace(/([+-]\d{2})(\d{2})$/,"$1:$2"));return Number.isNaN(s.getTime())?String(e):n?s.toLocaleString(void 0,{day:"numeric",month:"short",year:"numeric",hour:"2-digit",minute:"2-digit"}):s.toLocaleDateString(void 0,{day:"numeric",month:"short",year:"numeric"})}function Vs(e){return e==null?"":e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(e<10*1024?1:0)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}const Js=5*6e4,Xs=2*6e4,Qs=24,zt={shown:!1,sprints:[],total:0,isLast:!1,loading:!1,error:null},Ys={status:"idle",issues:[],next:"",total:null,capped:!1,error:null,more:!1},xe=new Map,Zs=(e,n,s)=>`${e}|${n}|${s.mine?"mine":"all"}|${s.quick.join(",")}`;function er(e,n){for(xe.delete(e),xe.set(e,n);xe.size>Qs;)xe.delete(xe.keys().next().value)}function Vt(e,n){for(const[s,r]of[...xe.entries()].reverse())if(s.startsWith(`${e}|${n}|`)&&r.overview)return{overview:r.overview,groups:{},subtasks:{},closed:{...zt,shown:r.closed.shown,sprints:r.closed.sprints,total:r.closed.total,isLast:r.closed.isLast},loadedAt:0};return{overview:null,groups:{},subtasks:{},closed:zt,loadedAt:0}}function ge(e){return e instanceof _t?e:new _t("upstream",e instanceof Error&&e.message?e.message:"Jira could not be read.")}const kt=e=>e instanceof DOMException&&e.name==="AbortError",tr=new Set(["auth","expired","rate-limit","tls","unreachable","incompatible","network","unavailable"]);function Jt(e,n,s,r=""){const a={mine:n.mine,quick:n.quick};return e.kind==="backlog"?{...a,source:"backlog",cursor:r}:e.kind==="column"?{...a,source:"kanban",column:e.column,backlog:s.hasBacklog}:{...a,source:"sprint",sprint:e.sprint.id}}async function nr(e,n,s){let r=0;const a=Array.from({length:Math.min(n,e.length)},async()=>{for(;r<e.length;)await s(e[r++])});await Promise.all(a)}function sr(e,n,s,r){const a=s?Zs(n,s,r):"",[l,c]=d.useState(()=>a&&xe.get(a)||Vt(n,s??"")),i=d.useRef(l),[u,o]=d.useState(!1),[b,h]=d.useState(null),m=d.useRef(0),f=d.useRef(null),x=d.useRef(a),p=d.useRef(r);p.current=r;const g=d.useCallback((v,O)=>{if(v!==x.current)return;const F=O(i.current);i.current=F,v&&er(v,F),c(F)},[]),j=d.useCallback((v,O,F)=>{g(v,T=>({...T,groups:{...T.groups,[O]:F(T.groups[O]??Ys)}}))},[g]),$=d.useCallback(async(v,O,F,T)=>{if(s){j(v,O.id,U=>({...U,status:"loading",error:null}));try{const U=await Wt(e,s,Jt(O,p.current,F),T);j(v,O.id,()=>({status:"ready",issues:U.issues,next:U.next,total:U.total,capped:U.capped,error:null,more:!1}))}catch(U){if(kt(U)||T.aborted)return;const B=ge(U);if(j(v,O.id,X=>({...X,status:"error",error:B,more:!1})),tr.has(B.kind))throw B}}},[s,e,j]),y=d.useCallback(()=>{var U;if(!s)return;const v=x.current,O=++m.current;(U=f.current)==null||U.abort();const F=new AbortController;f.current=F;const{signal:T}=F;o(!0),h(null),(async()=>{try{const B=await Ts(e,s,T);if(O!==m.current)return;g(v,E=>({...E,overview:B,subtasks:{}}));const X=i.current.closed,se=qt(B,X.shown?X.sprints:[]),le=se.filter(E=>E.kind==="active"||E.kind==="column"&&E.column!=="done"),ne=se.filter(E=>!le.includes(E)&&(E.kind!=="closed"||i.current.groups[E.id]));await Promise.all(le.map(E=>$(v,E,B,T))),await nr(ne,3,E=>T.aborted?Promise.resolve():$(v,E,B,T)),O===m.current&&g(v,E=>({...E,loadedAt:Date.now()}))}catch(B){if(kt(B)||T.aborted||O!==m.current)return;F.abort(),h(ge(B))}finally{O===m.current&&o(!1)}})()},[s,e,$,g]);d.useEffect(()=>{var F;x.current=a;const v=a?xe.get(a):void 0,O=v??Vt(n,s??"");if(i.current=O,c(O),h(null),!s){(F=f.current)==null||F.abort(),o(!1);return}(!v||Date.now()-v.loadedAt>Js)&&y()},[a]),d.useEffect(()=>()=>{var v;(v=f.current)==null||v.abort()},[]);const A=d.useCallback((v,O=!1)=>{const F=i.current.overview,T=i.current.groups[v.id];if(!F||T&&T.status!=="idle"&&!(O&&T.status==="error"))return;const U=f.current&&!f.current.signal.aborted?f.current.signal:new AbortController().signal,B=x.current;$(B,v,F,U).catch(X=>h(ge(X)))},[$]),_=d.useCallback(v=>{const O=i.current.overview,F=i.current.groups[v.id];if(!s||!O||!F||!F.next||F.more)return;const T=x.current;j(T,v.id,U=>({...U,more:!0,error:null})),(async()=>{try{const U=await Wt(e,s,Jt(v,p.current,O,F.next));j(T,v.id,B=>{const X=new Set(B.issues.map(se=>se.key));return{...B,issues:[...B.issues,...U.issues.filter(se=>!X.has(se.key))],next:U.next,total:U.total??B.total,more:!1}})}catch(U){const B=ge(U);j(T,v.id,X=>({...X,more:!1,error:B}))}})()},[s,e,j]),N=d.useCallback(v=>{if(!s)return;const O=x.current;g(O,F=>({...F,closed:{...F.closed,shown:!0,loading:!0,error:null}})),(async()=>{try{const F=await Fs(e,s,v);g(O,T=>{const U=new Set(T.closed.sprints.map(X=>X.id)),B=v===0?F.sprints:[...T.closed.sprints,...F.sprints.filter(X=>!U.has(X.id))];return{...T,closed:{shown:!0,sprints:B,total:F.total,isLast:F.isLast,loading:!1,error:null}}})}catch(F){const T=ge(F);g(O,U=>({...U,closed:{...U.closed,loading:!1,error:T}}))}})()},[s,e,g]),D=d.useCallback(v=>{const O=x.current;if(!v){g(O,T=>({...T,closed:{...T.closed,shown:!1}}));return}const F=i.current.closed;F.sprints.length||F.loading?g(O,T=>({...T,closed:{...T.closed,shown:!0}})):N(0)},[N,g]),I=d.useCallback(()=>{const v=i.current.closed;v.loading||v.isLast||N(v.sprints.length)},[N]),L=d.useCallback(v=>{const O=i.current.subtasks[v];if(O&&O.status!=="error")return;const F=x.current,T=U=>g(F,B=>({...B,subtasks:{...B.subtasks,[v]:U}}));T({status:"loading",issues:(O==null?void 0:O.issues)??[],error:null}),Is(e,v).then(U=>T({status:"ready",issues:U.issues,error:null})).catch(U=>T({status:"error",issues:[],error:ge(U)}))},[e,g]),M=l.closed,S=l.overview?qt(l.overview,M.shown?M.sprints:[]):[];return{snap:l,groups:S,loading:u,error:b,refresh:y,ensureGroup:A,loadMore:_,showClosed:D,moreClosed:I,loadSubtasks:L}}const $e=new Map;function rr(e,n,s){const r=s?`${n}|${s}`:"",[a,l]=d.useState(()=>{var x;return r?((x=$e.get(r))==null?void 0:x.data)??null:null}),[c,i]=d.useState(!1),[u,o]=d.useState(null),[b,h]=d.useState(0),m=d.useRef(!1);d.useEffect(()=>{if(!s){l(null),o(null);return}const x=$e.get(r);if(l((x==null?void 0:x.data)??null),o(null),x&&!m.current&&Date.now()-x.at<Xs){i(!1);return}m.current=!1;const p=new AbortController;return i(!0),Os(e,s,p.signal).then(g=>{$e.set(r,{at:Date.now(),data:g}),$e.size>60&&$e.delete($e.keys().next().value),l(g)}).catch(g=>{!kt(g)&&!p.signal.aborted&&o(ge(g))}).finally(()=>{p.signal.aborted||i(!1)}),()=>p.abort()},[r,e,s,b]);const f=d.useCallback(()=>{m.current=!0,h(x=>x+1)},[]);return{data:a,loading:c,error:u,reload:f}}function ar(){return t.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round","aria-hidden":!0,children:[t.jsx("circle",{cx:"6.1",cy:"6.1",r:"4.1"}),t.jsx("path",{d:"m9.2 9.2 3.3 3.3"})]})}function An(){return t.jsxs("svg",{className:"ig-mark",width:"13",height:"13",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[t.jsx("path",{d:"M7 1.9 12.9 12H1.1Z"}),t.jsx("path",{d:"M7 5.6v2.9"}),t.jsx("path",{d:"M7 10.3v.05"})]})}function lr(){return t.jsxs("svg",{className:"ig-mark",width:"13",height:"13",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[t.jsx("circle",{cx:"7",cy:"7",r:"5.6"}),t.jsx("path",{d:"M7 4.1v3.4"}),t.jsx("path",{d:"M7 9.8v.05"})]})}function or(){return t.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[t.jsx("rect",{x:"4.6",y:"4.6",width:"7.4",height:"7.4",rx:"1.2"}),t.jsx("path",{d:"M9.4 4.6V2.8a.8.8 0 0 0-.8-.8H2.8a.8.8 0 0 0-.8.8v5.8a.8.8 0 0 0 .8.8h1.8"})]})}function Tt(){return t.jsx("svg",{width:"13",height:"13",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:t.jsx("path",{d:"m2.6 7.4 2.9 2.9 5.9-6.4"})})}function Rn(){return t.jsx("svg",{width:"13",height:"13",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round","aria-hidden":!0,children:t.jsx("path",{d:"M3.5 3.5l7 7M10.5 3.5l-7 7"})})}function ir({loadedAt:e,loading:n,stale:s},r=Date.now()){const a=e!=null?xn(r-e):null,l=(c,i,u="",o=null)=>({tone:c,word:i,join:u,ago:o,text:`${i}${u}${o??""}`});return n?e!=null?l("updating","Updating…"):l("reading","Reading…"):e==null?l("none",""):s?l("stale","Not updated"," · last answer ",a):l("updated","Updated"," ",a)}function cr(e,n){return e==="reading"||e==="updating"?"Updating…":n?e==="stale"?"Not updated":e==="updated"?"Updated":"":""}function Ln({loadedAt:e,loading:n,stale:s=!1,onRefresh:r,label:a,disabled:l=!1,now:c}){const[,i]=d.useState(0),u=d.useRef(n);u.current=n;const[o,b]=d.useState(!1);d.useEffect(()=>{if(e==null)return;const f=window.setInterval(()=>i(x=>x+1),3e4);return()=>window.clearInterval(f)},[e]),d.useEffect(()=>{n&&b(!0)},[n]);const h=ir({loadedAt:e,loading:n,stale:s},c??Date.now()),m=e!=null?new Date(e):null;return t.jsxs("div",{className:"ig-freshness","data-tone":h.tone,children:[h.tone!=="none"&&t.jsxs("span",{className:"ig-fresh",children:[h.tone==="stale"&&t.jsx(An,{}),t.jsx("span",{className:"ig-fresh-word",children:h.word}),h.join,m&&h.ago&&t.jsx("time",{dateTime:m.toISOString(),title:m.toLocaleString(),children:h.ago})]}),t.jsx("span",{className:"vis-hidden",role:"status",children:cr(h.tone,o)}),t.jsx("button",{type:"button",className:"glyph-btn ig-refresh","aria-label":a,title:"Refresh",...et(n,l),"data-loading":n||void 0,onClick:()=>{Ze(u.current)&&r()},children:t.jsx(fs,{})})]})}function Ft({value:e,onChange:n,label:s,placeholder:r,inputRef:a,onKeyDown:l}){const c=d.useRef(null),i=a??c,[u,o]=d.useState(!1),b=u&&e!=="",h=d.useRef(n);return h.current=n,d.useEffect(()=>{if(b)return jn.push(()=>h.current(""),0,"popover")},[b]),t.jsxs("div",{className:"ig-search","data-filled":e!==""||void 0,children:[t.jsx(ar,{}),t.jsx("input",{ref:i,type:"search",className:"ig-search-input","aria-label":s,placeholder:r,value:e,onChange:m=>n(m.target.value),onKeyDown:l,onFocus:()=>o(!0),onBlur:()=>o(!1)}),e!==""&&t.jsx("button",{type:"button",className:"glyph-btn ig-search-clear","aria-label":"Clear the search",title:"Clear",onClick:()=>{var m;n(""),(m=i.current)==null||m.focus()},children:t.jsx(Rn,{})})]})}function tt({label:e,rows:n=6,variant:s="rows"}){return t.jsxs("div",{className:"ig-skeleton","data-variant":s,role:"status",children:[t.jsx("span",{className:"vis-hidden",children:e}),Array.from({length:n},(r,a)=>t.jsx("i",{"aria-hidden":!0},a))]})}function dr(e){switch(e){case"auth":case"expired":return"reconnect";case"permission":case"incompatible":return"settings";case"not-found":return"none";default:return"retry"}}function ur(e){return e==="reconnect"?"Reconnect":e==="settings"?"Open connection settings":"Try again"}function En(e,n=Date.now()){return e<60?`in ${Math.max(1,Math.ceil(e))}s`:`after ${new Date(n+e*1e3).toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit"})}`}function hr(e,n,s=n,r=Date.now()){var l;const a=((l=e.message)==null?void 0:l.trim())||"";switch(e.kind){case"auth":return{title:`${n} did not accept the saved token`,body:"It may have been revoked or replaced. Reconnect with a new one."};case"expired":return{title:`The saved ${n} token has expired`,body:"Make a new token and reconnect with it."};case"permission":return{title:"The token cannot read this",body:"Check the token's scopes in the connection's settings."};case"unreachable":return{title:`${s} did not answer`,body:"Check the network or VPN, and whether the site is up."};case"tls":return{title:`${s}'s certificate is not trusted here`,body:"The deck checks every certificate and cannot skip one: add the issuing authority to this machine's trust store, then try again."};case"rate-limit":return{title:`${n} asked the deck to slow down`,body:e.retryAfter==null?"Try again in a minute.":e.retryAfter<60?"It will answer again in a moment.":`It will answer again ${En(e.retryAfter,r)}.`};case"incompatible":return{title:`This is not a ${n} the deck can read`,body:a||"Check the address in the connection's settings."};case"not-found":return{title:"Not there any more",body:"It was deleted or moved, or this token cannot see it."};case"network":return{title:"The deck could not be reached",body:"Check that the deck is still running, then try again."};case"unavailable":return{title:`${n} is unavailable on this deck`,body:"The deck cannot read it right now. Try again in a moment."};case"invalid":return{title:"The deck could not ask for that",body:a};default:return{title:`${n} answered with an error`,body:a}}}function mr(e,n){var r;if(e.kind==="auth"||e.kind==="expired")return null;const s=(r=e.detail)==null?void 0:r.trim();return!s||n.includes(s)?null:s}function fr(e,n,s=Date.now()){return e.kind!=="rate-limit"||e.retryAfter==null?0:Math.max(0,Math.ceil(e.retryAfter-(s-n)/1e3))}function He({error:e,provider:n,host:s,stale:r=!1,onRetry:a,onReconnect:l,title:c,body:i,children:u,now:o}){const[b,h]=d.useState(()=>o??Date.now()),[m,f]=d.useState(()=>o??Date.now());d.useEffect(()=>{const I=Date.now();h(I),f(I)},[e]);const x=o??m,p=fr(e,b,x);d.useEffect(()=>{if(p<=0)return;const I=window.setTimeout(()=>f(Date.now()),1e3);return()=>window.clearTimeout(I)},[p,m]);const g=hr(e,n,s,x),j=c??g.title,$=i??g.body,y=mr(e,$),A=dr(e.kind),_=A==="retry"?a:A==="none"?void 0:l,N=A==="none"?"":ur(A),D=A==="reconnect";return t.jsxs("div",{className:"ig-failure","data-kind":e.kind,"data-stale":r||void 0,children:[t.jsxs("div",{className:"ig-failure-text",role:r?"status":"alert",children:[t.jsxs("p",{className:"ig-failure-title",children:[r?t.jsx(An,{}):t.jsx(lr,{}),t.jsx("strong",{children:j})]}),$&&t.jsx("p",{className:"ig-failure-body",children:$}),y&&!r&&t.jsxs("p",{className:"ig-failure-said",children:[n," said: ",y]})]}),(_||u)&&t.jsxs("div",{className:"ig-failure-actions",children:[_&&t.jsx("button",{type:"button",className:D?"btn primary":"btn","aria-disabled":p>0||void 0,onClick:()=>{p<=0&&_()},children:p>0?`${N} ${En(p,x)}`:N}),u]})]})}const gt=new Set;function Mn({src:e,label:n,fallback:s,className:r="jr-icon"}){const[a,l]=d.useState(()=>!e||gt.has(e));return d.useEffect(()=>l(!e||gt.has(e)),[e]),!e||a?s?t.jsx(t.Fragment,{children:s}):t.jsx("span",{className:r,title:n,"aria-hidden":!0}):t.jsx("img",{className:r,src:e,alt:"",title:n,width:16,height:16,loading:"lazy",decoding:"async",referrerPolicy:"no-referrer",draggable:!1,onError:()=>{gt.add(e),l(!0)}})}function pr(e,n=!1){const s=e.trim().toLowerCase();return n||/^sub-?\s?task/.test(s)?"subtask":/bug|defect|incident/.test(s)?"bug":/story|feature|improvement|requirement/.test(s)?"story":/epic/.test(s)?"epic":/task|chore|spike|support|request/.test(s)?"task":"other"}const gr={bug:t.jsx("circle",{className:"jr-glyph-mark",cx:"8",cy:"8",r:"2.6"}),story:t.jsx("path",{className:"jr-glyph-mark",d:"M5.5 4h5v8L8 10.2 5.5 12z"}),task:t.jsx("path",{className:"jr-glyph-mark jr-glyph-stroke",d:"m4.8 8.2 2.2 2.2 4.2-4.6",fill:"none",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round"}),subtask:t.jsx("path",{className:"jr-glyph-mark",d:"M4.5 4.5h4.2v4.2H4.5zM7.3 7.3h4.2v4.2H7.3z",fillRule:"evenodd"}),epic:t.jsx("path",{className:"jr-glyph-mark",d:"M9 3 5 9h2.6L7 13l4-6H8.4z"}),other:t.jsx("circle",{className:"jr-glyph-mark",cx:"8",cy:"8",r:"1.8"})};function jr({type:e,subtask:n}){const s=e.epic?"epic":pr(e.name,n??e.subtask);return t.jsxs("svg",{className:"jr-icon jr-type-glyph","data-shape":s,width:"16",height:"16",viewBox:"0 0 16 16",role:"img","aria-label":e.name,children:[t.jsx("title",{children:e.name}),t.jsx("rect",{className:"jr-glyph-tile",x:"1",y:"1",width:"14",height:"14",rx:"3"}),gr[s]]})}const xr={highest:"m4 8.5 4-4 4 4M4 12l4-4 4 4",high:"m4 10 4-4 4 4",medium:"M4 6h8M4 10h8",low:"m4 6 4 4 4-4",lowest:"m4 4 4 4 4-4M4 7.5l4 4 4-4"};function br({priority:e}){const n=Dt(e.name);return n?t.jsxs("svg",{className:"jr-icon jr-priority-glyph","data-level":n,width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",role:"img","aria-label":`Priority: ${e.name}`,children:[t.jsx("title",{children:`Priority: ${e.name}`}),t.jsx("path",{d:xr[n]})]}):t.jsx("span",{className:"jr-icon",title:`Priority: ${e.name}`,"aria-hidden":!0})}const nt=({type:e,subtask:n})=>t.jsx(Mn,{src:e.icon,label:e.name,fallback:t.jsx(jr,{type:e,subtask:n})}),It=({priority:e})=>e?t.jsx(Mn,{src:e.icon,label:`Priority: ${e.name}`,fallback:t.jsx(br,{priority:e})}):t.jsx("span",{className:"jr-icon","aria-hidden":!0});function Dn({epic:e}){return t.jsx("span",{className:"jr-epic ig-chip","data-color":e.color??void 0,title:`Epic ${e.key}: ${e.name}`,children:e.name})}function st({status:e}){return t.jsx("span",{className:"jr-status ig-chip","data-cat":e.category,title:e.name,children:e.name})}function yr({issue:e,estimation:n,time:s}){if(n==="points")return e.points==null?null:t.jsx("span",{className:"jr-estimate ig-chip",title:"Story points",children:Number.isInteger(e.points)?e.points:e.points.toFixed(1)});const r=Ae(e.estimate,s),a=e.remaining!=null&&e.remaining!==e.estimate?Ae(e.remaining,s):"";return!r&&!a?null:t.jsxs("span",{className:"jr-estimate ig-chip",title:`${r?`Original estimate ${r}`:"No original estimate"}${a?` · ${a} remaining`:""}`,children:[r||"–",a&&t.jsxs("span",{className:"jr-remaining",children:[" · ",a," left"]})]})}function Tn(){return t.jsxs("svg",{className:"jr-flag",width:"12",height:"12",viewBox:"0 0 14 14",fill:"currentColor",stroke:"currentColor",strokeWidth:"1.2",strokeLinejoin:"round","aria-hidden":!0,children:[t.jsx("path",{d:"M3.5 12.5V1.8",fill:"none",strokeLinecap:"round"}),t.jsx("path",{d:"M3.5 2.2h7l-1.6 2.9 1.6 2.9h-7z"})]})}function wt({open:e}){return t.jsx("svg",{className:"jr-chevron","data-open":e||void 0,width:"12",height:"12",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:t.jsx("path",{d:"m5.2 3 4 4-4 4"})})}const Xt={new:"To do",indeterminate:"In progress",done:"Done"},Nr=["new","indeterminate","done"],Qt=e=>e<=30;function kr({def:e,totals:n,estimation:s,time:r}){if(s==="count")return null;const a=s==="points"?"story points":"estimated";if(e.kind==="column"){const c=n.new+n.indeterminate+n.done;if(c<=0)return null;const i=Kt(c,s,r);return t.jsx("span",{className:"jr-totals",children:t.jsxs("span",{className:"jr-total",title:`Total: ${i} ${a}`,children:["Total ",i]})})}const l=Nr.filter(c=>n[c]>0);return l.length===0?null:t.jsx("span",{className:"jr-totals",children:l.map(c=>{const i=Kt(n[c],s,r);return t.jsxs("span",{className:"jr-total","data-cat":c,title:`${Xt[c]}: ${i} ${a}`,children:[Xt[c]," ",i]},c)})})}function wr({stats:e,mine:n}){const s=[];return e.mine>0&&s.push(n?{key:"mine",text:`${e.mineDone} of ${e.mine} done`,title:`${e.mineDone} of your ${e.mine} done`}:{key:"mine",text:`${e.mine} yours`,title:`${e.mineDone} of ${e.mine} yours done`}),e.flagged>0&&s.push({key:"flagged",text:`${e.flagged} flagged`,title:"Flagged and not done"}),e.highest>0&&s.push({key:"highest",text:`${e.highest} highest`,title:"Highest priority (or Blocker, Critical) and not done"}),s.length===0?null:t.jsx("span",{className:"jr-tally",children:s.map((r,a)=>t.jsxs(d.Fragment,{children:[a>0&&t.jsx("span",{"aria-hidden":!0,children:" · "}),t.jsx("span",{title:r.title,children:r.text})]},r.key))})}function Yt(e,n=""){const s=e.assignee?`${e.assignee.name}${e.mine?", assigned to you":""}`:"unassigned";return`${e.key}: ${e.summary}. ${e.type.name}, ${e.status.name}, ${s}${e.flagged?", flagged":""}${n}`}function Zt({issue:e,estimation:n,time:s}){const r=e.status.category==="done";return t.jsxs(t.Fragment,{children:[t.jsx(nt,{type:e.type}),t.jsx(It,{priority:e.priority}),t.jsx("span",{className:"jr-key","data-done":r||void 0,children:e.key}),t.jsx("span",{className:"jr-summary",children:e.summary}),t.jsxs("span",{className:"jr-facts",children:[t.jsxs("span",{className:"jr-meta",children:[e.flagged&&t.jsx("span",{className:"jr-flagged",title:"Flagged",children:t.jsx(Tn,{})}),e.fixVersions.slice(0,2).map(a=>t.jsx("span",{className:"jr-version",children:a},a)),e.fixVersions.length>2&&t.jsxs("span",{className:"jr-version",title:e.fixVersions.slice(2).join(", "),children:["+",e.fixVersions.length-2]}),e.epic&&t.jsx(Dn,{epic:e.epic})]}),t.jsx(yr,{issue:e,estimation:n,time:s}),t.jsx("span",{className:"jr-status-cell",children:t.jsx(st,{status:e.status})})]}),t.jsx("span",{className:"jr-assignee",title:e.assignee?`${e.assignee.name}${e.mine?" (you)":""}`:"Unassigned",children:e.assignee?t.jsx(Lt,{src:e.assignee.avatar,name:e.assignee.name,size:20,you:e.mine}):t.jsx(yn,{size:20})})]})}function vr(e){let n=4;const s=r=>{r.length>n&&(n=r.length)};for(const r of Object.values(e.groups))for(const a of r.issues)s(a.status.name),a.parent&&s(a.parent.status.name);for(const r of Object.values(e.subtasks))for(const a of r.issues)s(a.status.name);return Math.min(16,n)}function $r(e){const{conn:n,overview:s,groups:r,snap:a,expanded:l,onToggleGroup:c,filter:i,mine:u,filtered:o,selected:b,onOpen:h,onRetryGroup:m,onMore:f,onShowClosed:x,onMoreClosed:p,loadSubtasks:g,onReconnect:j}=e,$=d.useRef(null),[y,A]=d.useState({}),[_,N]=d.useState(()=>new Set),[D,I]=d.useState(null),L=s.estimation.kind,M=s.timeTracking,S=d.useMemo(()=>{const k=new Set;return r.map(C=>{const q=a.groups[C.id],w=Bs((q==null?void 0:q.issues)??[],k),P=qs(w,i,W=>{var V;return(V=a.subtasks[W])==null?void 0:V.issues});return{def:C,data:q,rows:P,stats:Gs(P,L)}})},[r,a.groups,a.subtasks,i,L]),v=k=>y[Be(k)]??k.kind==="context";d.useEffect(()=>{for(const{def:k,rows:C}of S)if(pt(k,l))for(const q of C){if(!v(q))continue;const w=Be(q);if(!a.subtasks[w]){if(q.kind==="issue"){const P=q.issue.subtaskKeys;if(!o&&P.length>0&&P.every(W=>q.matched.some(V=>V.key===W))||P.length===0)continue}g(w)}}},[S,y,l]);const O=(k,C)=>A(q=>({...q,[k]:C})),F=()=>{var k;return Array.from(((k=$.current)==null?void 0:k.querySelectorAll("[data-nav]"))??[])},T=k=>{var C;k&&(k.focus(),(C=k.scrollIntoView)==null||C.call(k,{block:"nearest"}))},U=k=>{var W,V;const C=k.target;if(!C.dataset.nav||k.altKey||k.ctrlKey||k.metaKey)return;const q=F(),w=q.indexOf(C),P=C.getAttribute("data-expanded");switch(k.key){case"ArrowDown":k.preventDefault(),T(q[Math.min(q.length-1,w+1)]);return;case"ArrowUp":k.preventDefault(),T(q[Math.max(0,w-1)]);return;case"Home":k.preventDefault(),T(q[0]);return;case"End":k.preventDefault(),T(q[q.length-1]);return;case"ArrowRight":P==="false"?(k.preventDefault(),(W=document.getElementById(C.dataset.toggle??""))==null||W.click()):P==="true"&&(k.preventDefault(),T(q[w+1]));return;case"ArrowLeft":P==="true"?(k.preventDefault(),(V=document.getElementById(C.dataset.toggle??""))==null||V.click()):C.dataset.parent&&(k.preventDefault(),T(q.find(K=>K.dataset.nav===C.dataset.parent)));return}},B=d.useMemo(()=>{for(const{def:k,rows:C}of S)if(pt(k,l)&&C.length>0)return`${k.id}/${Be(C[0])}`;return S.length?`g:${S[0].def.id}`:null},[S,l]);d.useEffect(()=>{var k;D&&!((k=$.current)!=null&&k.querySelector(`[data-nav="${CSS.escape(D)}"]`))&&I(null)});const X=k=>k===(D??B)?0:-1,se=(k,C,q,w)=>{const P=Be(k),W=`${C.id}/${P}`,V=v(k),K=a.subtasks[P],Z=k.kind==="issue"?k.issue.subtaskKeys.length:0,ae=Z>0||k.matched.length>0||k.kind==="context",pe=`jr-toggle-${C.id.replace(/[^a-z0-9]/gi,"-")}-${P}`,ue=(K==null?void 0:K.status)==="ready"?K.issues.filter(Q=>Cn(Q,i)):k.matched,R=((K==null?void 0:K.status)==="ready"?K.issues:k.matched).filter(Q=>Q.mine).length,H=k.kind==="issue"?Yt(k.issue,ae?`, ${Z||k.matched.length} sub-tasks${R?`, ${R} yours`:""}`:""):`${k.parent.key}: ${k.parent.summary}. ${u?"Not assigned to you":"Parent not in this list"}; shown for ${k.matched.length} sub-task${k.matched.length===1?"":"s"}`,Y=k.kind==="issue"?k.issue:null;return t.jsxs("li",{className:"jr-item","data-context":k.kind==="context"||void 0,children:[t.jsxs("div",{className:"jr-row ig-row","data-selected":b===P||void 0,"data-done":(Y==null?void 0:Y.status.category)==="done"||void 0,"data-mine":(Y==null?void 0:Y.mine)||void 0,children:[ae?t.jsx("button",{type:"button",id:pe,className:"jr-toggle",tabIndex:-1,"aria-expanded":V,"aria-label":`${V?"Hide":"Show"} sub-tasks of ${P}`,onClick:()=>O(P,!V),children:t.jsx(wt,{open:V})}):t.jsx("span",{className:"jr-toggle-space","aria-hidden":!0}),t.jsx("button",{type:"button",className:"jr-row-main","data-nav":W,"data-key":P,"data-parent":w,"data-toggle":ae?pe:void 0,"data-expanded":ae?String(V):void 0,tabIndex:X(W),"aria-current":b===P||void 0,"aria-label":H,onFocus:()=>I(W),onClick:()=>h(P),children:Y?t.jsx(Zt,{issue:Y,estimation:L,time:M}):k.kind==="context"&&t.jsxs(t.Fragment,{children:[t.jsx(nt,{type:k.parent.type}),t.jsx(It,{priority:k.parent.priority}),t.jsx("span",{className:"jr-key","data-done":k.parent.status.category==="done"||void 0,children:k.parent.key}),t.jsx("span",{className:"jr-summary",children:k.parent.summary}),t.jsxs("span",{className:"jr-facts",children:[t.jsx("span",{className:"jr-meta",children:t.jsx("span",{className:"jr-context-tag",children:u?"not assigned to you":"parent not in this list"})}),t.jsx("span",{className:"jr-status-cell",children:t.jsx(st,{status:k.parent.status})})]})]})})]}),ae&&V&&t.jsxs("ul",{className:"jr-subrows",role:"list","aria-label":`Sub-tasks of ${P}`,"data-fade":y[P]&&Qt(ue.length)||void 0,children:[(K==null?void 0:K.status)==="loading"&&ue.length===0&&t.jsx("li",{className:"jr-subnote",role:"status",children:"Reading sub-tasks…"}),(K==null?void 0:K.status)==="error"&&t.jsxs("li",{className:"jr-subnote",role:"alert",children:["Sub-tasks could not be read. ",t.jsx("button",{type:"button",className:"jr-link-btn",onClick:()=>g(P),children:"Try again"})]}),ue.map(Q=>{const mt=`${C.id}/${Q.key}/${W}`;return t.jsx("li",{className:"jr-item",children:t.jsxs("div",{className:"jr-row jr-subrow ig-row","data-selected":b===Q.key||void 0,"data-done":Q.status.category==="done"||void 0,"data-mine":Q.mine||void 0,children:[t.jsx("span",{className:"jr-toggle-space","aria-hidden":!0}),t.jsx("button",{type:"button",className:"jr-row-main","data-nav":mt,"data-key":Q.key,"data-parent":W,tabIndex:X(mt),"aria-current":b===Q.key||void 0,"aria-label":Yt(Q),onFocus:()=>I(mt),onClick:()=>h(Q.key),children:t.jsx(Zt,{issue:Q,estimation:L,time:M})})]})},Q.key)}),(K==null?void 0:K.status)==="ready"&&ue.length===0&&t.jsx("li",{className:"jr-subnote",children:i.attention?"No sub-task needs attention.":i.hideDone?"Every sub-task is done.":"No sub-tasks."})]})]},P)},le=s.hasSprints,ne=le&&s.sprints.active.length===0,E=a.closed,Ne=S.findIndex(k=>k.def.kind==="closed"),ce=d.useMemo(()=>vr(a),[a]);return t.jsxs("div",{className:"jr-board",ref:$,onKeyDown:U,style:{"--jr-status-ch":ce},children:[ne&&t.jsx("p",{className:"jr-board-note",children:"No sprint is active on this board. The future sprints and the backlog are below."}),S.map(({def:k,data:C,rows:q,stats:w},P)=>{const W=pt(k,l),V=`jr-group-${k.id.replace(/[^a-z0-9]/gi,"-")}`,K=`g:${k.id}`,Z=k.sprint,ae=Z&&(Z.startDate||Z.endDate)?`${Gt(Z.startDate)||"?"} – ${Gt(Z.completeDate??Z.endDate)||"?"}`:"",pe=(C==null?void 0:C.status)==="ready"||((C==null?void 0:C.issues.length)??0)>0,ue=(C==null?void 0:C.total)!=null&&k.paged&&C.total>w.count&&!i.search&&!i.hideDone&&!i.attention,R=k.kind==="closed"&&(!C||C.status==="idle"),H=pe?ue?`${w.count} of ${C.total}`:`${w.count}`:(C==null?void 0:C.status)==="error"?"":"…",Y=w.assignees;return t.jsxs(d.Fragment,{children:[P===Ne&&t.jsx("h3",{className:"jr-closed-title",children:"Closed sprints"}),t.jsxs("section",{className:"jr-group","data-kind":k.kind,"aria-labelledby":`${V}-title`,children:[t.jsxs("div",{className:"jr-group-head",children:[t.jsx("h3",{className:"jr-group-title",id:`${V}-title`,children:t.jsxs("button",{type:"button",id:`${V}-toggle`,className:"jr-group-toggle","data-nav":K,"data-toggle":`${V}-toggle`,"data-expanded":String(W),"aria-expanded":W,"aria-controls":V,tabIndex:X(K),onFocus:()=>I(K),onClick:()=>{W||N(Q=>new Set(Q).add(k.id)),c(k,!W)},children:[t.jsx(wt,{open:W}),t.jsx("span",{className:"jr-group-name",children:k.title}),k.kind==="active"&&t.jsx("span",{className:"jr-badge",children:"Active"}),ae&&t.jsx("span",{className:"jr-group-dates",children:ae}),R?t.jsxs("span",{className:"jr-group-count",title:"Counted when you open it",children:[t.jsx("span",{"aria-hidden":!0,children:"—"}),t.jsx("span",{className:"vis-hidden",children:"issues counted when opened"})]}):t.jsxs("span",{className:"jr-group-count",children:[H," ",pe?w.count===1&&!ue?"issue":"issues":t.jsx("span",{className:"vis-hidden",children:"issues, not read yet"})]})]})}),pe&&t.jsxs("div",{className:"jr-group-facts",children:[t.jsx(wr,{stats:w,mine:u}),t.jsx(bn,{label:"Assigned to",people:Y.map(Q=>({key:Q.id,name:Q.name,src:Q.avatar,you:Q.id===w.youId}))}),t.jsx(kr,{def:k,totals:w.totals,estimation:L,time:M})]})]}),(Z==null?void 0:Z.goal)&&W&&t.jsx("p",{className:"jr-goal",children:Z.goal}),W&&t.jsxs("div",{id:V,className:"jr-group-body","data-fade":_.has(k.id)&&Qt(q.length)||void 0,children:[(C==null?void 0:C.status)==="error"&&C.error&&t.jsx(He,{error:C.error,provider:"Jira",host:_e(n),stale:C.issues.length>0,onRetry:()=>m(k),onReconnect:j}),(!C||C.status==="idle"||C.status==="loading"&&C.issues.length===0)&&t.jsx(tt,{label:`Reading ${k.title}`,rows:3}),pe&&q.length===0&&t.jsx("p",{className:"jr-empty-group",children:((C==null?void 0:C.issues.length)??0)>0?"Nothing here matches the filters.":u?"None of your issues are here.":o?"Nothing here matches the filters.":"No issues."}),q.length>0&&t.jsx("ul",{className:"jr-rows",children:q.map(Q=>se(Q,k))}),(C==null?void 0:C.capped)&&t.jsx("p",{className:"jr-board-note",children:"The first 600 issues are shown. Open the sprint in Jira for the rest."}),k.paged&&(C==null?void 0:C.next)&&t.jsx("button",{type:"button",className:"btn jr-more","aria-busy":C.more||void 0,onClick:()=>f(k),children:C.more?"Reading…":C.total!=null?`Show more (${C.issues.length} of ${C.total})`:"Show more"})]})]})]},k.id)}),le&&t.jsxs("div",{className:"jr-closed-foot",children:[E.error&&t.jsxs("p",{className:"jr-subnote",role:"alert",children:["Closed sprints could not be read: ",E.error.message]}),E.shown?t.jsxs(t.Fragment,{children:[E.sprints.length===0&&!E.loading&&t.jsx("p",{className:"jr-subnote",children:"No closed sprints on this board."}),!E.isLast&&E.sprints.length>0&&t.jsx("button",{type:"button",className:"btn","aria-busy":E.loading||void 0,onClick:p,children:E.loading?"Reading…":`Show older sprints (${E.sprints.length} of ${E.total})`}),t.jsx("button",{type:"button",className:"btn",onClick:()=>x(!1),children:"Hide closed sprints"})]}):t.jsx("button",{type:"button",className:"btn","aria-busy":E.loading||void 0,onClick:()=>x(!0),children:E.loading?"Reading closed sprints…":"Show closed sprints"})]})]})}const Sr=1,Cr=3,Ar=48,Rr=2e4,Lr=new Set(["SCRIPT","STYLE","IFRAME","FRAME","FRAMESET","OBJECT","EMBED","APPLET","PARAM","NOSCRIPT","TEMPLATE","SVG","MATH","FORM","INPUT","BUTTON","SELECT","OPTION","TEXTAREA","LABEL","FIELDSET","LINK","META","TITLE","HEAD","BASE","AUDIO","VIDEO","SOURCE","TRACK","PICTURE","CANVAS","MAP","AREA","DIALOG","SLOT"]),Er={P:"p",BR:"br",HR:"hr",DIV:"div",SPAN:"span",STRONG:"strong",B:"strong",EM:"em",I:"em",U:"u",S:"s",STRIKE:"s",DEL:"del",INS:"ins",SUB:"sub",SUP:"sup",SMALL:"small",MARK:"mark",ABBR:"abbr",CITE:"cite",Q:"q",FONT:"span",CODE:"code",TT:"code",KBD:"kbd",SAMP:"samp",PRE:"pre",BLOCKQUOTE:"blockquote",UL:"ul",OL:"ol",LI:"li",DL:"dl",DT:"dt",DD:"dd",H1:"h4",H2:"h5",H3:"h6",H4:"h6",H5:"h6",H6:"h6",TABLE:"table",CAPTION:"caption",THEAD:"thead",TBODY:"tbody",TFOOT:"tfoot",TR:"tr",TH:"th",TD:"td",A:"a",IMG:"img"},Mr=new Set(["br","hr","img"]),Dr={panel:"jr-html-panel",panelHeader:"jr-html-panel-head",panelContent:"jr-html-panel-body",code:"jr-html-code",codeContent:"jr-html-code-body",preformatted:"jr-html-pre",preformattedContent:"jr-html-pre-body",emoticon:"jr-emoticon","user-hover":"jr-mention",error:"jr-html-error"};function Tr(e){var r;const s=(((r=e.getAttribute)==null?void 0:r.call(e,"class"))??"").split(/\s+/).map(a=>Dr[a]).filter(Boolean);return s.length?[...new Set(s)].join(" "):void 0}function en(e,n){const s=String(e??"").trim();if(!s)return null;let r;try{r=new URL(s,`${n.replace(/\/+$/,"")}/`)}catch{return null}return r.protocol!=="http:"&&r.protocol!=="https:"||r.username||r.password?null:r.href}function tn(e){const n=Number.parseInt(String(e??""),10);return Number.isFinite(n)&&n>1&&n<=100?n:void 0}function Fn({href:e,alt:n,emoticon:s}){return s?t.jsx(t.Fragment,{children:n}):t.jsx("a",{className:"jr-image-link",href:e,target:"_blank",rel:"noreferrer noopener",children:n||"Image"})}function Fr({src:e,href:n,alt:s,emoticon:r}){const[a,l]=d.useState(!1);return a?t.jsx(Fn,{href:n,alt:s,emoticon:r}):t.jsx("img",{className:r?"jr-emoticon":"jr-image",src:e,alt:s,loading:"lazy",decoding:"async",referrerPolicy:"no-referrer",draggable:!1,onError:()=>l(!0)})}function Ir(e){return typeof DOMParser>"u"?null:new DOMParser().parseFromString(e,"text/html").body}function Or(e,n,s=Ir){if(!e||!e.trim())return null;const r=s(e);if(!r)return e.replace(/<[^>]*>/g," ").replace(/\s+/g," ").trim();let a=Rr,l=3;const c=(u,o,b)=>{var j,$,y,A,_,N;if(--a<0)return null;if(u.nodeType===Cr)return u.nodeValue??"";if(u.nodeType!==Sr)return null;const h=String(u.nodeName).toUpperCase();if(Lr.has(h))return null;const m=()=>{if(b>=Ar)return[];const D=[],I=u.childNodes;for(let L=0;L<I.length;L++){const M=c(I[L],`${o}.${L}`,b+1);M!==null&&M!==""&&D.push(M)}return D};let f=Er[h];const x=/^H([1-6])$/.exec(h);if(x){const D=Math.min(Number(x[1])+3,6,l+1);l=D,f=`h${D}`}if(!f){const D=m();return D.length?d.createElement(d.Fragment,{key:o},...D):null}const p=Tr(u);if(f==="img"){const D=en((j=u.getAttribute)==null?void 0:j.call(u,"src"),n.baseUrl);if(!D)return null;const I=((($=u.getAttribute)==null?void 0:$.call(u,"alt"))??((y=u.getAttribute)==null?void 0:y.call(u,"title"))??"").slice(0,200),L=n.image(D),M=p==="jr-emoticon";return L?t.jsx(Fr,{src:L,href:D,alt:I,emoticon:M},o):t.jsx(Fn,{href:D,alt:I,emoticon:M},o)}if(f==="a"){const D=en((A=u.getAttribute)==null?void 0:A.call(u,"href"),n.baseUrl),I=m();return D?d.createElement("a",{key:o,href:D,target:"_blank",rel:"noreferrer noopener",className:p},...I.length?I:[D]):I.length?d.createElement(d.Fragment,{key:o},...I):null}const g={key:o};if(p&&(g.className=p),f==="td"||f==="th"){const D=tn((_=u.getAttribute)==null?void 0:_.call(u,"colspan")),I=tn((N=u.getAttribute)==null?void 0:N.call(u,"rowspan"));D&&(g.colSpan=D),I&&(g.rowSpan=I)}return f==="table"?t.jsx("div",{className:"jr-table-wrap",tabIndex:0,role:"region","aria-label":"Table",children:d.createElement("table",{className:p},...m())},o):(f==="pre"&&Object.assign(g,{tabIndex:0,role:"region","aria-label":"Code"}),Mr.has(f)?d.createElement(f,g):d.createElement(f,g,...m()))},i=[];for(let u=0;u<r.childNodes.length;u++){const o=c(r.childNodes[u],String(u),0);o!==null&&o!==""&&i.push(o)}return i.length?i:null}function nn({html:e,ctx:n,className:s="jr-html",empty:r}){const a=d.useMemo(()=>Or(e,n),[e,n]);return a?t.jsx("div",{className:s,children:a}):r?t.jsx(t.Fragment,{children:r}):null}function Pr(e){const n=/^(.*?)([#!]\d+)$/.exec(e);return n?{path:n[1],num:n[2]}:/^[A-Z][A-Z0-9_]*-\d+$/.test(e)?{path:"",num:e}:{path:e,num:""}}function In({value:e,label:n}){const[s,r]=d.useState(!1);return d.useEffect(()=>{if(!s)return;const a=window.setTimeout(()=>r(!1),1500);return()=>window.clearTimeout(a)},[s]),t.jsxs(t.Fragment,{children:[t.jsx("button",{type:"button",className:"glyph-btn ig-copy","data-done":s||void 0,"aria-label":`Copy ${n}`,title:s?"Copied":`Copy ${n}`,onClick:a=>{a.stopPropagation(),ps(e).then(l=>r(!!l))},children:s?t.jsx(Tt,{}):t.jsx(or,{})}),t.jsx("span",{className:"vis-hidden",role:"status",children:s?`${n[0].toUpperCase()}${n.slice(1)} copied`:""})]})}function Ke({reference:e,copyValue:n,copyLabel:s,href:r,openLabel:a,narrow:l,onClose:c}){const{path:i,num:u}=Pr(e);return t.jsxs("div",{className:"ig-detail-bar",children:[t.jsxs("span",{className:"ig-ref",children:[t.jsxs("code",{className:"ig-ref-text",title:e,children:[i&&t.jsx("span",{className:"ig-ref-path",children:i}),u&&t.jsx("span",{className:"ig-ref-num",children:u})]}),t.jsx(In,{value:n??e,label:s})]}),t.jsxs("span",{className:"ig-detail-bar-end",children:[r&&t.jsxs("a",{className:"ig-open",href:r,target:"_blank",rel:"noreferrer noopener",children:[a,t.jsx(Le,{})]}),!l&&t.jsx("button",{type:"button",className:"glyph-btn ig-detail-close","aria-label":"Close details",title:"Close",onClick:c,children:t.jsx(Rn,{})})]})]})}function he({label:e,children:n}){return n==null||n===""||Array.isArray(n)&&n.length===0?null:t.jsxs("div",{className:"jr-field",children:[t.jsx("dt",{children:e}),t.jsx("dd",{children:n})]})}function jt({person:e,fallback:n,you:s=!1}){return e?t.jsx(Nn,{src:e.avatar,name:e.name,size:18,you:s}):t.jsx("span",{className:"jr-dim",children:n})}function Br({issues:e,onOpen:n}){return t.jsx("ul",{className:"jr-detail-subtasks",children:e.map(s=>t.jsx("li",{children:t.jsxs("button",{type:"button",className:"jr-detail-sub","data-mine":s.mine||void 0,"data-done":s.status.category==="done"||void 0,onClick:()=>n(s.key),"aria-label":`${s.key}: ${s.summary}. ${s.status.name}${s.assignee?`, ${s.assignee.name}${s.mine?", assigned to you":""}`:", unassigned"}`,children:[t.jsx(nt,{type:s.type}),t.jsx("span",{className:"jr-key",children:s.key}),t.jsx("span",{className:"jr-summary",children:s.summary}),t.jsx(st,{status:s.status}),s.assignee?t.jsx(Lt,{src:s.assignee.avatar,name:s.assignee.name,size:18,you:s.mine}):t.jsx(yn,{size:18})]})},s.key))})}function Ur({conn:e,api:n,assetUrl:s,trail:r,estimation:a,time:l,onOpen:c,onTrail:i,onReconnect:u,narrow:o,onClose:b}){var _;const h=r[r.length-1]??null,{data:m,loading:f,error:x,reload:p}=rr(n,e.id,h),g=d.useMemo(()=>({baseUrl:e.baseUrl,image:N=>Ps(e,s,N)}),[e,s]),j=m&&m.issue.key===h?m.issue:null,$=j==null?void 0:j.key;d.useEffect(()=>{var D;if(!o||!$)return;const N=document.activeElement;(N===document.body||N instanceof HTMLElement&&N.matches("[data-ig-back]"))&&((D=document.getElementById("jira-detail-title"))==null||D.focus())},[o,$]);const y=[];j!=null&&j.project.name&&y.push({label:j.project.name,title:j.project.key});const A=(_=j==null?void 0:j.parent)==null?void 0:_.key;return A&&!r.slice(0,-1).includes(A)&&y.push({label:A,title:j.parent.summary,go:()=>c(A,"replace")}),r.slice(0,-1).forEach((N,D)=>y.push({label:N,title:`Back to ${N}`,go:()=>i(D)})),h?t.jsxs("article",{className:"jr-detail","aria-busy":f||void 0,"aria-labelledby":"jira-detail-title",children:[t.jsx(Ke,{reference:h,copyLabel:"key",href:(j==null?void 0:j.url)??null,openLabel:"Open in Jira",narrow:o,onClose:b}),t.jsxs("ol",{className:"jr-crumbs",role:"list","aria-label":"Where this issue is",children:[y.map((N,D)=>t.jsx("li",{children:N.go?t.jsx("button",{type:"button",className:"jr-crumb",title:N.title,onClick:N.go,children:N.label}):t.jsx("span",{className:"jr-crumb-text",title:N.title,children:N.label})},`${N.label}-${D}`)),t.jsx("li",{"aria-current":"page",children:t.jsx("span",{className:"jr-crumb-text jr-crumb-here",children:h})})]}),x&&t.jsx(He,{error:x,provider:"Jira",host:_e(e),stale:!!j,onRetry:p,onReconnect:u}),!j&&f&&t.jsx(tt,{label:`Reading ${h}`,rows:4,variant:"lines"}),j&&t.jsxs(t.Fragment,{children:[t.jsxs("header",{className:"jr-detail-head",children:[t.jsx("h2",{id:"jira-detail-title",tabIndex:-1,className:"jr-detail-title",children:j.summary}),t.jsxs("p",{className:"jr-detail-state",children:[t.jsxs("span",{className:"jr-with-icon",children:[t.jsx(nt,{type:j.type}),j.type.name]}),t.jsx(st,{status:j.status}),j.resolution&&t.jsx("span",{className:"jr-dim",children:j.resolution}),j.priority&&t.jsxs("span",{className:"jr-with-icon",children:[t.jsx(It,{priority:j.priority}),j.priority.name]}),j.flagged&&t.jsxs("span",{className:"jr-flagged",children:[t.jsx(Tn,{})," Flagged"]})]})]}),t.jsxs("dl",{className:"jr-fields",children:[t.jsx(he,{label:"Assignee",children:t.jsx(jt,{person:j.assignee,fallback:"Unassigned",you:j.mine})}),t.jsx(he,{label:"Reporter",children:j.reporter?t.jsx(jt,{person:j.reporter,fallback:""}):null}),t.jsx(he,{label:"Sprint",children:j.sprint?t.jsxs(t.Fragment,{children:[j.sprint.name,j.sprint.state?t.jsxs("span",{className:"jr-dim",children:[" · ",j.sprint.state]}):null]}):null}),t.jsx(he,{label:"Epic",children:j.epic?t.jsx(Dn,{epic:j.epic}):null}),t.jsx(he,{label:"Fix versions",children:j.fixVersions.length?t.jsx("span",{className:"jr-chips",children:j.fixVersions.map(N=>t.jsx("span",{className:"jr-version",children:N},N))}):null}),t.jsx(he,{label:"Labels",children:j.labels.length?t.jsx("span",{className:"jr-chips",children:j.labels.map(N=>t.jsx("span",{className:"jr-label",children:N},N))}):null}),t.jsx(he,{label:"Components",children:j.components.join(", ")}),t.jsx(he,{label:"Due",children:Fe(j.dueDate)}),a==="points"&&t.jsx(he,{label:"Estimate",children:j.points!=null?`${j.points} ${j.points===1?"point":"points"}`:null}),t.jsx(he,{label:"Time",children:zs(j,l)})]}),t.jsx("p",{className:"jr-detail-dates",children:[j.created&&`Created ${Fe(j.created,!0)}`,j.updated&&`Updated ${Fe(j.updated,!0)}`].filter(Boolean).join(" · ")}),t.jsxs("section",{className:"jr-detail-section","aria-labelledby":"jira-detail-desc",children:[t.jsx("h3",{id:"jira-detail-desc",children:"Description"}),t.jsx(nn,{html:j.descriptionHtml,ctx:g,empty:t.jsx("p",{className:"jr-dim",children:"No description."})})]}),m.subtasks.length>0&&t.jsxs("section",{className:"jr-detail-section","aria-labelledby":"jira-detail-subs",children:[t.jsxs("h3",{id:"jira-detail-subs",children:["Sub-tasks ",t.jsx("span",{className:"jr-count",children:m.subtasks.length})]}),t.jsx(Br,{issues:m.subtasks,onOpen:N=>c(N,"push")})]}),m.attachments.length>0&&t.jsxs("section",{className:"jr-detail-section","aria-labelledby":"jira-detail-files",children:[t.jsxs("h3",{id:"jira-detail-files",children:["Attachments ",t.jsx("span",{className:"jr-count",children:m.attachments.length})]}),t.jsx("ul",{className:"jr-files",children:m.attachments.map(N=>t.jsxs("li",{children:[N.url?t.jsxs("a",{href:N.url,target:"_blank",rel:"noreferrer noopener",title:"Opens in Jira",children:[N.filename,t.jsx(Le,{})]}):t.jsx("span",{children:N.filename}),t.jsx("span",{className:"jr-dim",children:[Vs(N.size),Fe(N.created)].filter(Boolean).join(" · ")})]},N.id))})]}),t.jsxs("section",{className:"jr-detail-section","aria-labelledby":"jira-detail-comments",children:[t.jsxs("h3",{id:"jira-detail-comments",children:["Comments ",t.jsx("span",{className:"jr-count",children:m.comments.total>m.comments.items.length?`${m.comments.items.length} of ${m.comments.total}`:m.comments.total})]}),m.comments.items.length===0&&t.jsx("p",{className:"jr-dim",children:"No comments."}),t.jsx("ol",{className:"jr-comments",children:m.comments.items.map(N=>t.jsxs("li",{className:"jr-comment",children:[t.jsxs("div",{className:"jr-comment-head",children:[t.jsx(jt,{person:N.author,fallback:"Someone"}),t.jsx("time",{className:"jr-dim",dateTime:N.created,children:Fe(N.created,!0)}),N.updated&&N.updated!==N.created&&t.jsx("span",{className:"jr-dim",children:"edited"})]}),t.jsx(nn,{html:N.html,ctx:g,empty:t.jsx("p",{className:"jr-dim",children:"(empty)"})})]},N.id))}),m.comments.total>m.comments.items.length&&t.jsx("p",{className:"jr-dim",children:t.jsxs("a",{className:"jr-more-link",href:j.url,target:"_blank",rel:"noreferrer noopener",children:["The older comments are in Jira ",t.jsx(Le,{})]})})]})]})]}):null}const _r=e=>typeof e=="string"&&e.length>0&&e.length<=40,xt=e=>typeof e=="boolean",Hr=e=>!!e&&typeof e=="object"&&!Array.isArray(e)&&Object.values(e).every(n=>typeof n=="boolean"),Wr=e=>!!e&&typeof e=="object"&&typeof e.board=="string"&&Array.isArray(e.ids)&&e.ids.every(n=>typeof n=="string");function qr({api:e,current:n,layerId:s,onPick:r,onClose:a}){const[l,c]=d.useState(""),[i,u]=d.useState({boards:[],isLast:!1,total:null,loading:!0,error:null}),o=d.useRef(null),b=d.useRef(null),h=d.useRef(0),m=d.useCallback((p,g)=>{const j=++h.current;u($=>({...$,loading:!0,error:null,...g===0?{boards:[]}:{}})),Sn(e,g,p).then($=>{j===h.current&&u(y=>({boards:g===0?$.boards:[...y.boards,...$.boards.filter(A=>!y.boards.some(_=>_.id===A.id))],isLast:$.isLast,total:$.total,loading:!1,error:null}))}).catch($=>{j===h.current&&u(y=>({...y,loading:!1,error:ge($)}))})},[e]);d.useEffect(()=>{const p=window.setTimeout(()=>m(l.trim(),0),l?250:0);return()=>window.clearTimeout(p)},[l,m]);const f=()=>{var p;return Array.from(((p=b.current)==null?void 0:p.querySelectorAll("button[data-board]"))??[])},x=p=>{var y;if(p.key!=="ArrowDown"&&p.key!=="ArrowUp")return;const g=f();if(!g.length)return;p.preventDefault();const j=g.indexOf(document.activeElement),$=p.key==="ArrowDown"?j<0?0:Math.min(g.length-1,j+1):j<=0?-1:j-1;$<0?(y=o.current)==null||y.focus():g[$].focus()};return t.jsx(Et,{anchorId:s,portalRootId:s,id:"jira-board-picker",className:"jr-board-pop",role:"dialog",labelledBy:"jira-board-picker-title",focusRef:o,onClose:a,children:t.jsxs("div",{className:"jr-board-pop-inner",onKeyDown:x,children:[t.jsx("p",{className:"jr-board-pop-title",id:"jira-board-picker-title",children:"Boards"}),t.jsx(Ft,{value:l,onChange:c,label:"Find a board by name",placeholder:"Find a board by name",inputRef:o}),t.jsx("ul",{className:"jr-board-list",role:"list",ref:b,"aria-label":"Boards","aria-busy":i.loading||void 0,children:i.boards.map(p=>t.jsx("li",{children:t.jsxs("button",{type:"button","data-board":p.id,className:"jr-board-item","aria-current":String(p.id)===n||void 0,onClick:()=>r(p),children:[t.jsx("span",{className:"jr-board-item-name",children:p.name}),t.jsx("span",{className:"jr-board-item-meta",children:[p.type,p.projectName||p.projectKey].filter(Boolean).join(" · ")})]})},p.id))}),i.loading&&t.jsx("p",{className:"jr-board-pop-note",role:"status",children:"Reading boards…"}),!i.loading&&i.error&&t.jsx("p",{className:"jr-board-pop-note",role:"alert",children:i.error.message}),!i.loading&&!i.error&&i.boards.length===0&&t.jsx("p",{className:"jr-board-pop-note",children:l?"No board by that name.":"No boards this account can see."}),!i.loading&&!i.isLast&&i.boards.length>0&&t.jsxs("button",{type:"button",className:"btn jr-board-more",onClick:()=>m(l.trim(),i.boards.length),children:["Show more boards",i.total!=null?` (${i.boards.length} of ${i.total})`:""]})]})})}function Kr({connection:e,api:n,assetUrl:s,prefs:r,narrow:a,onReconnect:l}){var ue;const[c,i]=d.useState(()=>r.read("board",_r)??null),[u,o]=d.useState(()=>r.read("boardName",R=>typeof R=="string")??""),[b,h]=d.useState(()=>r.read("mine",xt)??!0),[m,f]=d.useState(()=>r.read("hideDone",xt)??!1),[x,p]=d.useState(()=>r.read("attention",xt)??!1),[g,j]=d.useState(()=>{const R=r.read("quick",Wr);return R&&R.board===c?R.ids:[]}),[$,y]=d.useState(()=>r.read("expanded",Hr)??{}),[A,_]=d.useState(""),[N,D]=d.useState(!1),[I,L]=d.useState([]),[M,S]=d.useState(null),[v,O]=d.useState(!1);d.useEffect(()=>{r.write("mine",b)},[r,b]),d.useEffect(()=>{r.write("hideDone",m)},[r,m]),d.useEffect(()=>{r.write("attention",x)},[r,x]),d.useEffect(()=>{c&&r.write("quick",{board:c,ids:g})},[r,c,g]),d.useEffect(()=>{r.write("expanded",$)},[r,$]);const F=d.useCallback(R=>{const H=String(R.id);i(H),o(R.name),r.write("board",H),r.write("boardName",R.name),j([]),L([])},[r]),T=d.useCallback(()=>{S(null),O(!1),Sn(n,0,"").then(R=>{R.boards[0]?F(R.boards[0]):O(!0)}).catch(R=>S(ge(R)))},[n,F]);d.useEffect(()=>{c||T()},[c,T]);const U=d.useMemo(()=>({mine:b,quick:g}),[b,g]),B=sr(n,e.id,c,U),{snap:X,groups:se,loading:le,error:ne}=B,E=X.overview&&String(X.overview.board.id)===c?X.overview:null;d.useEffect(()=>{E&&E.board.name&&E.board.name!==u&&(o(E.board.name),r.write("boardName",E.board.name))},[E,u,r]);const{ensureGroup:Ne}=B;d.useEffect(()=>{for(const R of se)R.kind==="closed"&&$[R.id]&&Ne(R)},[se,$,Ne]);const ce=(R,H)=>y(Y=>({...Y,[R.id]:H})),k=b||m||x||g.length>0||A.trim()!=="",C=()=>{h(!1),f(!1),p(!1),j([]),_("")},q=d.useMemo(()=>({search:A,hideDone:m,attention:x}),[A,m,x]),w=d.useMemo(()=>Hs((E==null?void 0:E.quickFilters)??[]),[E]);d.useEffect(()=>{if(!E)return;const R=new Set(w.map(H=>H.id));j(H=>H.every(Y=>R.has(Y))?H:H.filter(Y=>R.has(Y)))},[E,w]);const P=I.length>0,W=R=>{L([R]),a&&requestAnimationFrame(()=>{var H;return(H=document.getElementById("jira-detail-title")??document.querySelector(".ig-detail [data-ig-back]"))==null?void 0:H.focus()})},V=d.useCallback(()=>{const R=I[0];L([]),requestAnimationFrame(()=>{const H=R?document.querySelector(`.jr-row-main[data-key="${CSS.escape(R)}"]`):null;H==null||H.focus()})},[I]),K=_e(e),Z=E?null:ne??M,ae=v?t.jsxs("div",{className:"jr-state",children:[t.jsx("h3",{children:"No boards here"}),t.jsxs("p",{children:["This account cannot see any board on ",K,". A board appears here once you are given access to one in Jira."]}),t.jsx("p",{children:t.jsxs("a",{className:"ig-open",href:`${e.baseUrl}/secure/ManageRapidViews.jspa`,target:"_blank",rel:"noreferrer noopener",children:["Open boards in Jira",t.jsx(Le,{})]})})]}):Z?t.jsxs("div",{className:"jr-state",children:[t.jsx(He,{error:Z,provider:"Jira",host:K,onRetry:c?B.refresh:T,onReconnect:l}),Z.kind==="not-found"&&c&&t.jsx("p",{children:t.jsx("button",{type:"button",className:"btn",onClick:()=>D(!0),children:"Choose another board"})})]}):E?t.jsxs(t.Fragment,{children:[ne&&t.jsx(He,{error:ne,provider:"Jira",host:K,stale:!0,onRetry:B.refresh,onReconnect:l}),t.jsx($r,{conn:e,overview:E,groups:se,snap:X,expanded:$,onToggleGroup:ce,filter:q,mine:b,filtered:k,selected:I[I.length-1]??null,onOpen:W,onRetryGroup:R=>B.ensureGroup(R,!0),onMore:B.loadMore,onShowClosed:B.showClosed,onMoreClosed:B.moreClosed,loadSubtasks:B.loadSubtasks,onReconnect:l})]}):t.jsx(tt,{label:"Reading the board",rows:6}),pe=P&&E?t.jsx(Ur,{conn:e,api:n,assetUrl:s,trail:I,estimation:E.estimation.kind,time:E.timeTracking,onOpen:(R,H)=>L(Y=>H==="push"?[...Y.filter(Q=>Q!==R),R]:[R]),onTrail:R=>L(H=>H.slice(0,R+1)),onReconnect:l,narrow:a,onClose:V}):null;return t.jsxs("div",{className:"jr-panel","data-deployment":((ue=e.meta)==null?void 0:ue.deployment)==="cloud"?"cloud":"server",children:[t.jsxs("div",{className:"jr-toolbar",hidden:a&&P,children:[t.jsxs("div",{className:"jr-toolbar-row",children:[t.jsxs("span",{id:"jira-board-layer",className:"jr-board-layer",children:[t.jsxs("button",{type:"button",id:"jira-board-button",className:"btn jr-board-btn","aria-haspopup":"dialog","aria-expanded":N,"aria-controls":N?"jira-board-picker":void 0,onClick:()=>D(R=>!R),children:[t.jsx("span",{className:"jr-board-btn-label",children:"Board"}),t.jsx("span",{className:"jr-board-btn-name",children:(E==null?void 0:E.board.name)||u||(c?`Board ${c}`:"Choose a board")}),t.jsx(wt,{open:N})]}),(E==null?void 0:E.board.projectName)&&t.jsx("span",{className:"jr-board-project",children:E.board.projectName})]}),t.jsx(Ln,{loadedAt:X.loadedAt||null,loading:le,stale:!!ne,onRefresh:()=>{c?B.refresh():T()},label:"Refresh the board",disabled:!c})]}),t.jsxs("div",{className:"jr-filters",role:"group","aria-label":"Filters",children:[t.jsx(Ft,{value:A,onChange:_,label:"Search issues by key or summary",placeholder:"Search key or summary"}),t.jsxs("div",{className:"jr-filter-chips",children:[t.jsx("button",{type:"button",className:"btn jr-chip","aria-pressed":b,onClick:()=>h(R=>!R),children:"Only my issues"}),t.jsx("button",{type:"button",className:"btn jr-chip","aria-pressed":m,onClick:()=>f(R=>!R),children:"Hide done"}),t.jsx("button",{type:"button",className:"btn jr-chip","aria-pressed":x,title:"Flagged, or Highest, Blocker or Critical priority, and not done",onClick:()=>p(R=>!R),children:"Needs attention"}),w.map(R=>t.jsx("button",{type:"button",className:"btn jr-chip","aria-pressed":g.includes(R.id),title:R.description||void 0,onClick:()=>j(H=>H.includes(R.id)?H.filter(Y=>Y!==R.id):[...H,R.id]),children:R.name},R.id)),k&&t.jsx("button",{type:"button",className:"jr-link-btn jr-clear",onClick:C,children:"Clear filters"})]})]})]}),t.jsx(Mt,{storageKey:"jira",list:t.jsx("div",{className:"jr-list-scroll",children:ae}),detail:pe,onBack:V,backLabel:"Back to the board",detailKey:I[I.length-1]}),N&&t.jsx(qr,{api:n,current:c,layerId:"jira-board-layer",onPick:R=>{var H;F(R),D(!1),(H=document.getElementById("jira-board-button"))==null||H.focus()},onClose:()=>{var H,Y;const R=(H=document.getElementById("jira-board-picker"))==null?void 0:H.contains(document.activeElement);D(!1),R&&((Y=document.getElementById("jira-board-button"))==null||Y.focus())}})]})}const z={github:{name:"GitHub",change:"Pull request",changes:"Pull requests",changeSigil:"#",pipeline:"Workflow run",pipelines:"Actions",repo:"Repository"},gitlab:{name:"GitLab",change:"Merge request",changes:"Merge requests",changeSigil:"!",pipeline:"Pipeline",pipelines:"Pipelines",repo:"Project"}},Gr=12e4;function Qe(e,n={}){const s=new URLSearchParams;for(const[a,l]of Object.entries(n))l!=null&&l!==""&&s.set(a,String(l));const r=s.toString();return`${e}${r?`?${r}`:""}`}class Ue extends Error{constructor(n){super(n.message),this.info=n,this.name="ForgeReadError"}}async function Ot(e,n,s){let r;try{r=await e(n,{signal:s,headers:{accept:"application/json"}})}catch(c){throw(c==null?void 0:c.name)==="AbortError"?c:new Ue({kind:"unreachable",message:"the deck did not answer"})}let a=null;try{a=await r.json()}catch{}if(r.ok&&(a!=null&&a.ok))return a.data;const l=a==null?void 0:a.error;throw l&&typeof l=="object"&&typeof l.kind=="string"?new Ue(l):new Ue({kind:"upstream",message:typeof l=="string"?l:`the deck answered ${r.status}`,status:r.status})}const Ce=new Map,zr=200;function Ve(e){return Ce.get(e)??{data:null,loadedAt:null,error:null}}function vt(e,n){for(Ce.delete(e),Ce.set(e,n);Ce.size>zr;)Ce.delete(Ce.keys().next().value)}function Vr(e,n,s=!1){return s||e.loadedAt==null||n-e.loadedAt>=Gr}function Jr(e){return e.data!=null&&e.error!=null}const sn={success:{mark:"passed",word:"passed",tone:"ok"},failed:{mark:"failed",word:"failed",tone:"bad"},running:{mark:"running",word:"running",tone:"busy"},pending:{mark:"pending",word:"pending",tone:"busy"},canceled:{mark:"canceled",word:"canceled",tone:"idle"},skipped:{mark:"skipped",word:"skipped",tone:"idle"},manual:{mark:"manual",word:"manual",tone:"idle"},none:{mark:"none",word:"no pipeline",tone:"idle"}};function ie(e){return sn[e??"none"]??sn.none}function Ge(e){return e.state==="merged"?{mark:"merged",word:"Merged",tone:"ok"}:e.state==="closed"?{mark:"closed",word:"Closed",tone:"idle"}:e.draft?{mark:"draft",word:"Draft",tone:"idle"}:e.approved?{mark:"approved",word:"Approved",tone:"ok"}:{mark:"open",word:"Open",tone:"busy"}}function On(e){switch(e){case"approved":return{mark:"approved",word:"approved",tone:"ok"};case"changes_requested":return{mark:"changes-requested",word:"changes requested",tone:"bad"};case"commented":return{mark:"commented",word:"commented",tone:"idle"};default:return{mark:"review-pending",word:"review pending",tone:"idle"}}}function Xr(e,n){const s=n==null?void 0:n.login.trim().toLowerCase();return!!s&&!!e&&e.login.trim().toLowerCase()===s}function Ye(e){return e==null?"–":e>=1e3?"999+":String(e)}function ze(e){if(e==null||!Number.isFinite(e)||e<0)return null;const n=Math.round(e);return n<60?`${n}s`:n<3600?`${Math.floor(n/60)}m ${String(n%60).padStart(2,"0")}s`:`${Math.floor(n/3600)}h ${String(Math.floor(n%3600/60)).padStart(2,"0")}m`}function Qr(e){const n=[],s=[];for(const r of e)(r.stale&&!r.isDefault?s:n).push(r);return{active:n,stale:s}}function Yr(e){const n=[],s=[];for(const r of e)(r.approvedByMe?s:n).push(r);return{waiting:n,approved:s}}function rt(e,n){const s=n.trim().toLowerCase();if(!s)return!0;const r=[e.key,e.title,e.name,e.number!=null?String(e.number):null].filter(a=>typeof a=="string").join(`
2
+ `).toLowerCase();return s.replace(/^[#!]/,"").split(/\s+/).every(a=>r.includes(a))}function rn(e){const n=e.trim();return/^https?:\/\/\S+\/(?:-\/)?(?:merge_requests|issues|pull)\/\d+/.test(n)||/^[\w.-]+(?:\/[\w.-]+)+[#!]\d+$/.test(n)}const Ie={tab:"branches",filter:"all",state:"open",sort:"created",issueState:"open"},Zr=["branches","changes","pipelines","issues"],Pn="view",ea=e=>!!e&&typeof e=="object"&&!Array.isArray(e);function an(e){return ta(e.read(Pn,ea)??{})}function ln(e,n){e.write(Pn,n)}function ta(e){const n=(s,r,a)=>r.includes(s)?s:a;return{repo:typeof e.repo=="string"&&e.repo.length<=255?e.repo:null,tab:n(e.tab,Zr,Ie.tab),filter:n(e.filter,["all","mine","review"],Ie.filter),state:n(e.state,["open","merged","closed"],Ie.state),sort:n(e.sort,["created","updated"],Ie.sort),issueState:n(e.issueState,["open","closed"],Ie.issueState),open:Array.isArray(e.open)?e.open.filter(s=>typeof s=="string").slice(0,20):[]}}function na(e,n,s){return e?s||!n?"page":"stay":"opener"}function sa(e,n,s){if(s<=0)return null;switch(e){case"ArrowDown":return Math.min(s-1,n+1);case"ArrowUp":return Math.max(0,n-1);case"Home":return 0;case"End":return s-1;default:return null}}function ra(e,n,s){return e<=0?-1:n>=0&&n<e?n:s>=0&&s<e?s:0}function aa(e,n,s=8){return n.left<e.left?n.left-e.left-s:n.right>e.right?n.right-e.right+s:0}function la(e,n){return n==="branches"?!1:n==="issues"?e==="gitlab":!0}function Bn(e){return e instanceof Ue?e.info:{kind:"upstream",message:"the read failed"}}function fe(e,n,s,r={},a=0){const l=s?Qe(s,r):null,c=l?`${n}
3
+ ${l}`:null,[i,u]=d.useState(()=>Se(c?Ve(c):null,!1)),[o,b]=d.useState(0),h=d.useRef(a);d.useEffect(()=>{if(!c||!l){u(Se(null,!1));return}const f=Ve(c),x=o>0||a!==h.current;if(h.current=a,!Vr(f,Date.now(),x)){u(Se(f,!1));return}u(Se(f,!0));const p=new AbortController;return Ot(e,l,p.signal).then(g=>{const j={data:g,loadedAt:Date.now(),error:null};vt(c,j),p.signal.aborted||u(Se(j,!1))},g=>{if(p.signal.aborted||(g==null?void 0:g.name)==="AbortError")return;const j={...Ve(c),error:Bn(g)};vt(c,j),u(Se(j,!1))}),()=>p.abort()},[e,c,l,a,o]);const m=d.useCallback(()=>b(f=>f+1),[]);return{...i,reload:m}}function Se(e,n){return{data:(e==null?void 0:e.data)??null,error:(e==null?void 0:e.error)??null,loading:n,loadedAt:(e==null?void 0:e.loadedAt)??null,stale:e?Jr(e):!1}}function be(e,n,s,r={},a=0){var y;const l=fe(e,n,s,r,a),c=s?Qe(s,r):null,i=c?`${n}
4
+ ${c}
5
+ more`:null,[u,o]=d.useState(()=>({key:i,...on(i)})),[b,h]=d.useState(!1),[m,f]=d.useState(null),x=d.useRef(!1),p=l.loadedAt;d.useEffect(()=>{f(null);const A=on(i);o(A.base!=null&&A.base===p?{key:i,...A}:{key:i,items:[],next:void 0,base:p})},[i,p]);const g=u.next!==void 0?u.next:((y=l.data)==null?void 0:y.next)??null,j=d.useCallback(()=>{!s||!g||!i||!Ze(x.current)||(x.current=!0,h(!0),f(null),Ot(e,Qe(s,{...r,cursor:g})).then(A=>{o(_=>{const N={key:i,items:[..._.items,...A.items],next:A.next,base:_.base??p};return vt(i,{data:N,loadedAt:Date.now(),error:null}),N})},A=>f(Bn(A))).finally(()=>{x.current=!1,h(!1)}))},[e,s,g,i,r,p]),$=l.data?{items:[...l.data.items,...u.key===i?u.items:[]],next:g,total:l.data.total}:null;return{...l,data:$,loadingMore:b,moreError:m,loadMore:j,reload:l.reload}}function on(e){const n=e?Ve(e).data:null;return n?{items:n.items,next:n.next,base:n.base}:{items:[],next:void 0,base:null}}const Un=d.createContext(null);function oa({value:e,children:n}){return t.jsx(Un.Provider,{value:e,children:n})}function G(){const e=d.useContext(Un);if(!e)throw new Error("useForge outside a forge panel");return e}function ia(e){switch(e.type){case"change":case"issue":return`${e.type}:${e.repo}:${e.number}`;case"branch":return`branch:${e.repo}:${e.name}`;case"pipeline":return`pipeline:${e.repo}:${e.id}`}}function at(e,n){if(!e||e.type!==n.type||e.repo!==n.repo)return!1;switch(n.type){case"change":case"issue":return e.number===n.number;case"branch":return e.name===n.name;case"pipeline":return e.id===n.id}}const me=t.jsx("circle",{cx:"7",cy:"7",r:"5.6"});function ca(e){switch(e){case"passed":case"done":return t.jsxs(t.Fragment,{children:[me,t.jsx("path",{d:"m4.6 7.2 1.7 1.7 3.2-3.5"})]});case"failed":return t.jsxs(t.Fragment,{children:[me,t.jsx("path",{d:"M5 5l4 4M9 5 5 9"})]});case"running":return t.jsxs(t.Fragment,{children:[me,t.jsx("path",{d:"M7 3.6a3.4 3.4 0 0 1 0 6.8z",fill:"currentColor",stroke:"none"})]});case"pending":return t.jsxs(t.Fragment,{children:[me,t.jsx("path",{d:"M7 4.2V7l1.9 1.2"})]});case"canceled":case"closed":return t.jsxs(t.Fragment,{children:[me,t.jsx("path",{d:"m3.1 10.9 7.8-7.8"})]});case"skipped":return t.jsxs(t.Fragment,{children:[me,t.jsx("path",{d:"m4.7 5 2 2-2 2M7.5 5l2 2-2 2"})]});case"manual":return t.jsxs(t.Fragment,{children:[me,t.jsx("path",{d:"M5.8 4.7v4.6L9.4 7z"})]});case"none":return t.jsxs(t.Fragment,{children:[me,t.jsx("path",{d:"M4.7 7h4.6"})]});case"warning":return t.jsxs(t.Fragment,{children:[t.jsx("path",{d:"M7 1.9 12.9 12H1.1Z"}),t.jsx("path",{d:"M7 5.6v2.9M7 10.3v.05"})]});case"open":return t.jsxs(t.Fragment,{children:[me,t.jsx("circle",{cx:"7",cy:"7",r:"2",fill:"currentColor",stroke:"none"})]});case"draft":return t.jsx("circle",{cx:"7",cy:"7",r:"5.6",strokeDasharray:"2.4 2"});case"merged":return t.jsx("path",{d:"M4.4 2.4v2.8c0 2.3 2.6 2.7 2.6 4.8v1.6M9.6 2.4v2.8c0 2.3-2.6 2.7-2.6 4.8"});case"approved":case"resolved":return t.jsx("path",{d:"m2.6 7.4 2.9 2.9 5.9-6.4"});case"changes-requested":return t.jsx("path",{d:"M7 2.4v5.2M4.4 5h5.2M4.4 11h5.2"});case"commented":return t.jsx("path",{d:"M2.2 2.8h9.6v6.6H6.4l-2.5 2.2V9.4H2.2z"});case"review-pending":return t.jsxs(t.Fragment,{children:[t.jsx("path",{d:"M1.4 7S3.4 3.4 7 3.4 12.6 7 12.6 7 10.6 10.6 7 10.6 1.4 7 1.4 7z"}),t.jsx("circle",{cx:"7",cy:"7",r:"1.7"})]});case"info":return t.jsxs(t.Fragment,{children:[me,t.jsx("path",{d:"M7 6.5v3.4M7 4.4v.05"})]});case"linked":return t.jsx("path",{d:"M2.4 5h9L9.2 2.8M11.6 9h-9l2.2 2.2"})}}function lt({name:e,size:n=12,weight:s=1.3}){return t.jsx("svg",{className:"fg-glyph","data-glyph":e,width:n,height:n,viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:s,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:ca(e)})}function _n(){return t.jsx("svg",{className:"fgl-chevron",width:"10",height:"10",viewBox:"0 0 10 10",fill:"none",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:t.jsx("path",{d:"M2.5 4l2.5 2.5L7.5 4"})})}function te({mark:e,quiet:n=!1,className:s}){return t.jsxs("span",{className:s?`fg-mark ${s}`:"fg-mark","data-tone":e.tone,title:e.word,children:[t.jsx(lt,{name:e.mark}),t.jsx("span",{className:n?"fg-sr":"fg-mark-word",children:e.word})]})}function we({mark:e}){return t.jsxs("span",{className:"fg-badge","data-tone":e.tone,children:[t.jsx(lt,{name:e.mark})," ",e.word]})}function ke({id:e,title:n,count:s,defaultOpen:r,children:a,aside:l}){const{isOpen:c,toggle:i}=G(),u=c(e)?!r:r;return t.jsxs("section",{className:"fg-group","data-open":u||void 0,children:[t.jsxs("h3",{className:"fg-group-head",children:[t.jsxs("button",{type:"button",className:"fg-fold","data-nav":"","aria-expanded":u,onClick:()=>i(e),children:[t.jsx("span",{className:"fg-fold-chevron","aria-hidden":"true"}),n,s!=null&&t.jsx("span",{className:"fg-count",children:s.toLocaleString()})]}),l]}),u&&a]})}function J({error:e,onRetry:n,compact:s=!1}){const{kind:r,connection:a,onReconnect:l}=G(),c=e.kind==="permission"&&e.message?`${e.message.replace(/\.\s*$/,"")}. Check the token's scopes in the connection's settings.`:void 0;return t.jsx(He,{error:e,provider:z[r].name,host:da(a.baseUrl),stale:s,onRetry:n,onReconnect:l,body:c})}function da(e){try{return new URL(e).host||void 0}catch{return}}function ye({pages:e,label:n="Load more"}){var s;return e.moreError?t.jsx(J,{error:e.moreError,onRetry:e.loadMore,compact:!0}):(s=e.data)!=null&&s.next?t.jsx("button",{type:"button",className:"btn fg-more",onClick:e.loadMore,...et(e.loadingMore),children:e.loadingMore?"Loading…":n}):null}function de({rows:e=6,label:n}){return t.jsx(tt,{label:n,rows:e})}function Pt(){const{asset:e,connection:n}=G();return s=>({src:s.avatarUrl?e(s.avatarUrl):null,name:s.name||s.login,you:Xr(s,n.account)})}function Te({user:e,size:n=20,nameless:s=!1}){const r=Pt();return e?t.jsx(Nn,{...r(e),size:n,nameless:s}):null}function Hn({user:e,size:n=20}){const s=Pt();return t.jsx(Lt,{...s(e),size:n})}function ee({at:e}){const[,n]=d.useState(0);return d.useEffect(()=>{const s=window.setInterval(()=>n(r=>r+1),3e4);return()=>window.clearInterval(s)},[]),e==null?null:t.jsx("time",{dateTime:new Date(e).toISOString(),title:new Date(e).toLocaleString(),children:xn(Date.now()-e)})}function ve({value:e,label:n,children:s}){return t.jsxs("span",{className:"fg-copyable",children:[s??t.jsx("code",{children:e}),t.jsx(In,{value:e,label:n})]})}function Ee({href:e,children:n}){const{kind:s}=G();return e?t.jsxs("a",{className:"ig-open",href:e,target:"_blank",rel:"noreferrer noopener",children:[n??`Open in ${z[s].name}`,t.jsx(Le,{})]}):null}function ua(e){const n=d.useRef(null);d.useEffect(()=>{const s=e.current;if(!s)return;const r=()=>Array.from(s.querySelectorAll("[data-nav]")).filter(h=>h.getClientRects().length>0),a=h=>{const m=h.closest("li");return!m||!s.contains(m)?[]:Array.from(m.querySelectorAll("button, a[href], input, select, textarea")).filter(f=>f!==h&&!f.hasAttribute("data-nav")&&f.closest("li")===m)};let l;const c=(h,m)=>{for(const f of[h,...a(h)])m?f.removeAttribute("tabindex"):f.tabIndex!==-1&&(f.tabIndex=-1)},i=()=>{const h=r();l=h[ra(h.length,n.current?h.indexOf(n.current):-1,h.findIndex(m=>m.getAttribute("aria-current")==="true"))];for(const m of h)c(m,m===l)},u=h=>{var f;const m=h.target;!((f=m.hasAttribute)!=null&&f.call(m,"data-nav"))||m===l||(n.current=m,l!=null&&l.isConnected&&c(l,!1),c(m,!0),l=m)},o=h=>{var $,y,A;const m=h.target;if(!(($=m.hasAttribute)!=null&&$.call(m,"data-nav"))||h.altKey||h.ctrlKey||h.metaKey||h.shiftKey)return;const f=r(),x=f.indexOf(m);if(x<0)return;const p=m.getAttribute("aria-expanded"),g=sa(h.key,x,f.length);let j;if(g!=null)j=f[g];else if(h.key==="ArrowRight"&&p==="true")j=f[x+1];else if(h.key==="ArrowLeft"&&p==null)j=(y=m.closest(".fg-group"))==null?void 0:y.querySelector(".fg-group-head [data-nav]");else if(h.key==="ArrowRight"&&p==="false"||h.key==="ArrowLeft"&&p==="true"){h.preventDefault(),m.click();return}else return;h.preventDefault(),j&&j!==m&&(j.focus(),(A=j.scrollIntoView)==null||A.call(j,{block:"nearest"}))},b=new MutationObserver(i);return b.observe(s,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["aria-current","aria-expanded","hidden"]}),s.addEventListener("focusin",u),s.addEventListener("keydown",o),i(),()=>{b.disconnect(),s.removeEventListener("focusin",u),s.removeEventListener("keydown",o)}},[e])}function ha(e,n){d.useLayoutEffect(()=>{const s=e.current,r=s==null?void 0:s.querySelector('[aria-selected="true"]');!s||!r||s.scrollWidth<=s.clientWidth||(s.scrollLeft+=aa(s.getBoundingClientRect(),r.getBoundingClientRect()))},[e,n])}function Bt(e){const n=z[e].repo.toLowerCase();return n.endsWith("y")?`${n.slice(0,-1)}ies`:`${n}s`}function Wn(e){return`All ${Bt(e)}`}function qn(e){const n=e.lastIndexOf("/");return n<0?{group:"",name:e}:{group:e.slice(0,n+1),name:e.slice(n+1)}}function Kn(e,n,s){return s?n.key:`${e}${n.number}`}const ma=/^\s*(?:\[(?:draft|wip)\]|\((?:draft|wip)\)|(?:draft|wip)\s*:)\s*/i;function fa(e,n){return n&&e.replace(ma,"")||e}function pa(e){return e.state==="merged"&&e.mergedAt!=null?{verb:"merged",at:e.mergedAt}:e.state==="closed"&&e.closedAt!=null?{verb:"closed",at:e.closedAt}:{verb:"updated",at:e.updatedAt}}function ga(e){return e.state!=="closed"?null:e.stateReason==="not_planned"?{mark:"closed",word:"Not planned",tone:"idle"}:e.stateReason==="duplicate"?{mark:"closed",word:"Duplicate",tone:"idle"}:null}function ja(e){const n=e.findIndex(s=>s.isDefault);return n<=0?e:[e[n],...e.slice(0,n),...e.slice(n+1)]}function xa(e){return e==null||!Number.isFinite(e)||e<0?null:e.toLocaleString("en-US")}function ba(e){return typeof e=="string"&&/^#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/i.test(e)?e:null}function ya(e,n,s){if(e==null||n==null)return null;const r=s?`“${s}”`:"the default branch",a=l=>l>=1e3?"999+":String(l);return`${a(e)} ${e===1?"commit":"commits"} behind, ${a(n)} ahead of ${r}`}function Na(e,n){const s=n.name.split("/").map(encodeURIComponent).join("/"),r=e==="gitlab"?"/-/tree/":"/tree/";for(const a of new Set([s,n.name])){const l=`${r}${a}`;if(!n.webUrl.endsWith(l))continue;const c=n.webUrl.slice(0,-l.length);if(!/^https?:\/\/[^/]+\/\S+$/.test(c))break;return e==="gitlab"?`${c}/-/merge_requests/new?merge_request%5Bsource_branch%5D=${encodeURIComponent(n.name)}`:`${c}/compare/${s}?expand=1`}return n.webUrl}function ka(e,n){if(!n)return{workflow:null,title:null};if(e!=="github")return{workflow:null,title:n};const s=n.indexOf(" · ");return s>0&&s<n.length-3?{workflow:n.slice(0,s),title:n.slice(s+3)}:{workflow:null,title:n}}const wa={push:"push",merge_request_event:"merge request",pull_request:"pull request",pull_request_target:"pull request",merge_group:"merge queue",schedule:"schedule",workflow_dispatch:"manual",web:"manual",api:"API",trigger:"trigger",pipeline:"multi-project",parent_pipeline:"child pipeline",release:"release",external:"external",chat:"chat",ondemand_dast_scan:"DAST scan",security_orchestration_policy:"security policy"};function va(e){return e?wa[e]??e.replace(/_/g," "):null}function ot(e,n,s){return e.data==null?e.error?"failed":"loading":n===0?"empty":s===0?"no-match":"rows"}function Me(e,n){return`No ${e} match “${n.trim()}”.`}function it(e,n){return n!=null&&n>e?`Load more · ${e.toLocaleString("en-US")} of ${n.toLocaleString("en-US")}`:"Load more"}function $a(e,n){const s=z[e].changes.toLowerCase(),r=n.acrossRepos?"":` in this ${z[e].repo.toLowerCase()}`;return n.filter==="mine"?`You have no ${n.state} ${s}${r}.`:n.filter==="review"?n.state==="open"?`Nothing is waiting for your review${r}.`:`No ${n.state} ${s} asked for your review${r}.`:`No ${n.state} ${s}${r}.`}function Sa(e,n){const s=`${z[e].pipeline.toLowerCase()}s`;return n?`No ${s} in your most recently active ${Bt(e)}.`:`No ${s} in this ${z[e].repo.toLowerCase()} yet.`}function Ca(e,n,s){const r=z[e].repo.toLowerCase();if(e==="github")return`This ${r} has no ${n} issues.`;const a=s?"":` in this ${r}`;return n==="open"?`No open issues are assigned to you${a}.`:`No closed issues were assigned to you${a}.`}function ct(e,n){const{loadedAt:s,loading:r,stale:a}=n;d.useEffect(()=>{e({loadedAt:s,loading:r,stale:a})},[e,s,r,a])}function Aa({value:e,allowAll:n,onChange:s}){const{kind:r}=G(),a=d.useId(),[l,c]=d.useState(!1),i=d.useRef(null),u=z[r].repo,o=e??(n?Wn(r):`Choose a ${u.toLowerCase()}`),b=e?qn(e):null,h=d.useCallback(()=>{var m;c(!1),(m=i.current)==null||m.focus({preventScroll:!0})},[]);return t.jsxs("span",{className:"fgl-repo",id:`${a}-layer`,children:[t.jsxs("button",{ref:i,id:`${a}-trigger`,type:"button",className:"btn fgl-repo-trigger","aria-label":`${u}: ${o}`,"aria-haspopup":"dialog","aria-expanded":l,title:e??void 0,onClick:()=>c(m=>!m),onKeyDown:m=>{(m.key==="ArrowDown"||m.key==="ArrowUp")&&(m.preventDefault(),c(!0))},children:[t.jsx(Ea,{}),b?t.jsxs("span",{className:"fgl-repo-path",children:[t.jsx("span",{className:"fgl-repo-group",children:b.group}),t.jsx("span",{className:"fgl-repo-name",children:b.name})]}):t.jsx("span",{className:"fgl-repo-all",children:o}),t.jsx(_n,{})]}),l&&t.jsx(Et,{anchorId:`${a}-layer`,portalRootId:`${a}-layer`,id:`${a}-popup`,className:"fgl-repo-pop",role:"dialog",labelledBy:`${a}-trigger`,onClose:h,children:t.jsx(Ra,{value:e,allowAll:n,onPick:m=>{s(m),h()},onEscape:h})})]})}function Ra({value:e,allowAll:n,onPick:s,onEscape:r}){var M;const{kind:a,api:l,scope:c,refresh:i}=G(),u=d.useId(),[o,b]=d.useState(""),[h,m]=d.useState(""),f=d.useRef(null),x=d.useRef(null),p=Bt(a);d.useEffect(()=>{const S=window.setTimeout(()=>m(o.trim()),250);return()=>window.clearTimeout(S)},[o]);const g=be(l,c,"repos",{search:h||void 0},i),j=(M=g.data)==null?void 0:M.items,$=d.useMemo(()=>{const S=[];n&&!h&&S.push({value:null,repo:null}),e&&!h&&j&&!j.some(v=>v.path===e)&&S.push({value:e,repo:null});for(const v of j??[])S.push({value:v.path,repo:v});return S},[n,h,e,j]),[y,A]=d.useState(0),_=j!=null;d.useEffect(()=>{A(Math.max(0,$.findIndex(S=>S.value===e)))},[h,_]);const N=Math.min(y,$.length-1);d.useEffect(()=>{var S;(S=f.current)==null||S.focus({preventScroll:!0})},[]),d.useEffect(()=>{var S,v;(v=(S=x.current)==null?void 0:S.querySelector('[data-active="true"]'))==null||v.scrollIntoView({block:"nearest"})},[N,$.length]);const D=S=>{const v=$.length;S.key==="ArrowDown"||S.key==="ArrowUp"?(S.preventDefault(),v&&A((Math.max(0,N)+(S.key==="ArrowDown"?1:-1)+v)%v)):S.key==="Home"||S.key==="End"?(S.preventDefault(),A(S.key==="Home"?0:Math.max(0,v-1))):S.key==="Enter"&&N>=0&&$[N]&&(S.preventDefault(),s($[N].value))},I=o.trim()!==h,L=j==null?g.error?"failed":"loading":$.length?"rows":"empty";return t.jsxs("div",{className:"fgl-repo-body",onKeyDown:S=>{S.key==="Escape"&&(S.preventDefault(),S.stopPropagation(),r())},children:[t.jsxs("label",{className:"fgl-repo-search",children:[t.jsxs("span",{className:"fg-sr",children:["Search ",p]}),t.jsx(Ma,{}),t.jsx("input",{ref:f,className:"ap-manage-input",role:"combobox",placeholder:`Search ${p}…`,autoComplete:"off",spellCheck:!1,value:o,"aria-expanded":$.length>0,"aria-autocomplete":"list","aria-controls":`${u}-options`,"aria-activedescendant":L==="rows"&&N>=0?`${u}-option-${N}`:void 0,"aria-busy":I||g.loading,onChange:S=>b(S.target.value),onKeyDown:D})]}),t.jsxs("div",{ref:x,className:"fgl-repo-scroll",children:[g.error&&j&&t.jsx(J,{error:g.error,onRetry:g.reload,compact:!0}),L==="loading"&&t.jsx(de,{rows:4,label:`Loading ${p}`}),L==="failed"&&g.error&&t.jsx(J,{error:g.error,onRetry:g.reload}),L==="empty"&&t.jsx("p",{className:"fgl-repo-none",role:"status",children:h?`No ${p} match “${h}”.`:`This token can see no ${p}.`}),t.jsx("div",{id:`${u}-options`,className:"fgl-repo-options",role:"listbox","aria-label":z[a].repo,hidden:L!=="rows",children:L==="rows"&&$.map((S,v)=>t.jsx(La,{id:`${u}-option-${v}`,option:S,selected:S.value===e,active:v===N,onHover:()=>{v!==N&&A(v)},onPick:()=>s(S.value)},S.value??"(all)"))}),g.data&&t.jsx(ye,{pages:g,label:`More ${p}`})]})]})}function La({id:e,option:n,selected:s,active:r,onHover:a,onPick:l}){var u,o;const{kind:c}=G(),i=n.value?qn(n.value):null;return t.jsxs("button",{id:e,type:"button",role:"option",tabIndex:-1,className:"fgl-repo-option","aria-selected":s,"data-active":r,onPointerMove:a,onClick:l,children:[t.jsx("span",{className:"fgl-repo-option-text",children:i?t.jsxs(t.Fragment,{children:[t.jsx("span",{className:"fgl-repo-option-name",children:i.name}),i.group&&t.jsx("span",{className:"fgl-repo-option-group",children:i.group.slice(0,-1)})]}):t.jsx("span",{className:"fgl-repo-option-name",children:Wn(c)})}),((u=n.repo)==null?void 0:u.archived)&&t.jsx("span",{className:"fg-badge",children:"archived"}),((o=n.repo)==null?void 0:o.lastActivityAt)!=null&&t.jsx("span",{className:"fgl-repo-option-when",children:t.jsx(ee,{at:n.repo.lastActivityAt})}),t.jsx("span",{className:"fgl-repo-check","aria-hidden":"true",children:s&&t.jsx(Tt,{})})]})}function Ea(){return t.jsxs("svg",{className:"fgl-glyph",width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[t.jsx("path",{d:"M3.5 2.5h8a1 1 0 0 1 1 1v8.5h-8.5a1 1 0 0 0-1 1z"}),t.jsx("path",{d:"M3.5 13a1 1 0 0 0 1 1h8v-2"}),t.jsx("path",{d:"M6 5.5h4"})]})}function Ma(){return t.jsxs("svg",{className:"fgl-glyph",width:"13",height:"13",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round","aria-hidden":"true",children:[t.jsx("circle",{cx:"7",cy:"7",r:"4.5"}),t.jsx("path",{d:"M10.5 10.5L14 14"})]})}function Da({view:e,query:n}){var p;const{kind:s,api:r,scope:a,refresh:l,reportFreshness:c}=G(),i=e.repo??"",u=be(r,a,i?"branches":null,{repo:i},l);ct(c,u);const o=d.useMemo(()=>{var g;return((g=u.data)==null?void 0:g.items)??[]},[u.data]),b=d.useMemo(()=>o.filter(g=>rt({name:g.name},n)),[o,n]),h=d.useMemo(()=>Qr(ja(b)),[b]),m=((p=o.find(g=>g.isDefault))==null?void 0:p.name)??null,f=ot(u,o.length,b.length),x=g=>t.jsx("ul",{className:"fg-rows",children:g.map(j=>t.jsx(Ta,{kind:s,repo:i,branch:j,defaultBranch:m},j.name))});return t.jsxs("div",{className:"fgl",children:[u.error&&u.data&&t.jsx(J,{error:u.error,onRetry:u.reload,compact:!0}),f==="loading"&&t.jsx(de,{label:"Loading branches"}),f==="failed"&&u.error&&t.jsx(J,{error:u.error,onRetry:u.reload}),f==="empty"&&t.jsxs("p",{className:"fg-empty",children:["This ",z[s].repo.toLowerCase()," has no branches."]}),f==="no-match"&&t.jsx("p",{className:"fg-empty",children:Me("branches",n)}),f==="rows"&&t.jsxs(t.Fragment,{children:[t.jsx(ke,{id:"branches-active",title:"Active branches",count:h.active.length,defaultOpen:!0,children:h.active.length?x(h.active):t.jsx("p",{className:"fgl-group-empty",children:n.trim()?Me("active branches",n):"Every branch loaded so far is stale."})}),h.stale.length>0&&t.jsx(ke,{id:"branches-stale",title:"Stale branches",count:h.stale.length,defaultOpen:!1,aside:t.jsx("span",{className:"fgl-group-note",children:"No commits in 90 days"}),children:x(h.stale)})]}),u.data&&t.jsx(ye,{pages:u,label:it(o.length,u.data.total)})]})}function Ta({kind:e,repo:n,branch:s,defaultBranch:r}){const{selected:a,select:l}=G(),c=z[e],i=s.change?{type:"change",repo:n,number:s.change.number}:{type:"branch",repo:n,name:s.name},u=at(a,i),o=s.isDefault?null:ya(s.behind,s.ahead,r),b=s.change?`${c.changeSigil}${s.change.number}`:null,h=s.change?Ge(s.change):null;return t.jsxs("li",{className:"fgl-branch ig-row","data-selected":u||void 0,children:[t.jsx("button",{type:"button",className:"fgl-hit","data-nav":"","aria-current":u||void 0,"aria-label":s.change?`${s.name}, ${c.change.toLowerCase()} ${b}`:s.name,onClick:()=>l(i)}),t.jsxs("span",{className:"fgl-branch-name",children:[t.jsx(ve,{value:s.name,label:"branch name",children:t.jsx("code",{className:"fgl-branch-code",children:s.name})}),s.isDefault&&t.jsx("span",{className:"fg-badge",children:"default"}),s.protected&&t.jsx("span",{className:"fg-badge",children:"protected"})]}),t.jsxs("span",{className:"fg-meta fgl-commit",children:[t.jsx("code",{children:s.commit.shortSha}),t.jsx("span",{className:"fgl-dot","aria-hidden":"true",children:"·"}),t.jsx("span",{className:"fgl-commit-title",children:s.commit.title}),s.commit.committedAt!=null&&t.jsxs(t.Fragment,{children:[t.jsx("span",{className:"fgl-dot","aria-hidden":"true",children:"·"}),t.jsx(ee,{at:s.commit.committedAt})]})]}),t.jsxs("span",{className:"fgl-stats","data-empty":!o&&!s.ci||void 0,children:[t.jsx("span",{className:"fgl-diverge","data-empty":!o||void 0,title:o??void 0,children:o&&t.jsxs(t.Fragment,{children:[t.jsx("span",{className:"fgl-behind","aria-hidden":"true",children:Ye(s.behind)}),t.jsx("span",{className:"fgl-diverge-rule","aria-hidden":"true"}),t.jsx("span",{"aria-hidden":"true",children:Ye(s.ahead)}),t.jsx("span",{className:"fg-sr",children:o})]})}),t.jsx("span",{className:"fgl-ci",children:s.ci&&t.jsx(te,{mark:ie(s.ci.state)})})]}),t.jsx("span",{className:"fgl-branch-change",children:h&&b?t.jsxs("span",{className:"fg-badge","data-tone":h.tone,title:`${c.change} ${b}: ${h.word}`,children:[t.jsx(lt,{name:h.mark})," ",t.jsx("code",{children:b})," ",h.word]}):!s.isDefault&&t.jsxs("a",{className:"ig-open fgl-create",href:Na(e,s),target:"_blank",rel:"noreferrer noopener",children:["Create ",c.change.toLowerCase(),t.jsx(Le,{})]})})]})}function Gn(e,n,s){return`${n}${z[e].changeSigil}${s}`}function zn(e){const n=/^refs\/(?:merge-requests|pull)\/(\d{1,12})\/(?:head|merge|train)$/.exec(e??"");return n?Number(n[1]):null}function Vn(e,n){const s=zn(n);return s!=null?`${z[e].changeSigil}${s}`:n.replace(/^refs\/(?:heads|tags)\//,"")}function Fa(e){const n=/\/(?:-\/pipelines|actions\/runs)\/(\d{1,15})(?:[/?#]|$)/.exec(e??"");return n?n[1]:null}function Ia(e,n,s,r){const a=n.replace(/\/+$/,""),l=s.split("/").map(encodeURIComponent).join("/");return e==="github"?`${a}/${l}/compare/${r.split("/").map(encodeURIComponent).join("/")}?expand=1`:`${a}/${l}/-/merge_requests/new?${new URLSearchParams({"merge_request[source_branch]":r})}`}function Oa(e,n){const s=e==="github";return[{id:"overview",label:s?"Conversation":"Overview",count:n.discussions},{id:"commits",label:"Commits",count:n.commits},{id:"pipelines",label:Jn(e),count:n.pipelines},{id:"changes",label:s?"Files changed":"Changes",count:n.files}]}function Jn(e){return e==="github"?"Checks":z[e].pipelines}function Pa(e){return e==null||!Number.isFinite(e)||e<=0?null:`${e.toLocaleString("en-US")} ${e===1?"commit":"commits"}`}function Ba(e){return Ge({state:e.state,draft:e.draft,approved:!1})}const $t=/^\s*(?:\[draft\]|\(draft\)|draft:|\[wip\]|wip:)\s*/i;function Ua(e){return e.replace($t,"")||e}function _a(e){const n=e[0];if(!n||n.t!=="text"||!$t.test(n.text))return e;const s=n.text.replace($t,"");return s?[{t:"text",text:s},...e.slice(1)]:e.slice(1)}function Ha(e){return{id:`comment:${e.id}`,resolvable:!1,resolved:!1,path:null,line:null,outdated:!1,comments:[e],webUrl:e.webUrl}}const cn=e=>{var n;return((n=e.comments[0])==null?void 0:n.createdAt)??Number.MAX_SAFE_INTEGER};function Wa(e){const n=[],s=[],r=[];for(const a of e.threads)a.comments.length&&(a.resolvable?(a.resolved?s:n).push(a):r.push(a));for(const a of e.generalComments)r.push(Ha(a));return r.sort((a,l)=>cn(a)-cn(l)),{unresolved:n,resolved:s,general:r}}function Xn(e){const n=e.lastIndexOf("/");return n<0?{dir:"",name:e}:{dir:e.slice(0,n+1),name:e.slice(n+1)}}function qa(e){return e.path?e.line!=null?`${e.path}:${e.line}`:e.path:null}function Ka(e){return e.name||e.login}function Ga(e){return e.length<=1?e[0]??"":`${e.slice(0,-1).join(", ")} and ${e[e.length-1]}`}function za(e){return e.approvedBy.length?{mark:{mark:"approved",word:"approved",tone:"ok"},text:`Approved by ${Ga(e.approvedBy.map(Ka))}`}:e.approvalsLeft!=null&&e.approvalsLeft>0?{mark:{mark:"pending",word:"approval required",tone:"idle"},text:`Requires ${e.approvalsLeft} more approval${e.approvalsLeft===1?"":"s"}`}:null}function Va(e){switch(e){case"added":return"new";case"deleted":return"deleted";case"renamed":return"renamed";default:return null}}function Qn(e){const n=e.lastIndexOf("::");return n>0&&n<e.length-2?{scope:e.slice(0,n),value:e.slice(n+2)}:{scope:null,value:e}}function Ja(e){return e&&/^#(?:[0-9a-f]{3}|[0-9a-f]{6})$/i.test(e)?e:null}function Xa(e,n){return e==="open"?{mark:"open",word:"Open",tone:"busy"}:n==="not_planned"?{mark:"closed",word:"Closed · not planned",tone:"idle"}:n==="duplicate"?{mark:"closed",word:"Closed · duplicate",tone:"idle"}:{mark:"done",word:"Closed",tone:"idle"}}function Qa(e){return e?{push:"push",merge_request_event:"merge request",pull_request:"pull request",pull_request_target:"pull request",schedule:"schedule",workflow_dispatch:"manual run",web:"run from the web",api:"API",trigger:"trigger",pipeline:"parent pipeline",parent_pipeline:"parent pipeline",dynamic:"dynamic"}[e]??e.replace(/_/g," "):null}function Ya(e){if(!e.length)return"none";const n=e.map(s=>s.state==="failed"&&s.allowFailure?"success":s.state);return n.includes("failed")?"failed":n.includes("running")?"running":n.includes("pending")?"pending":n.every(s=>s==="skipped")?"skipped":n.every(s=>s==="manual"||s==="skipped")?"manual":n.includes("canceled")?"canceled":"success"}function Za(e){const n=[],s=new Map;for(const r of e){const a=r.stage||null;s.has(a)||(s.set(a,[]),n.push(a)),s.get(a).push(r)}return n.map(r=>{const a=s.get(r);return{name:r,jobs:a,state:Ya(a)}})}const el=8;function tl(e,n){return e.state==="failed"||n<=el}function nl(e){return e.state==="failed"&&!e.allowFailure}function sl(e){return e.state==="failed"&&e.allowFailure?{mark:"warning",word:"failed",tone:"warn"}:ie(e.state)}function rl(e){return e.state==="success"&&e.jobs.some(n=>n.state==="failed"&&n.allowFailure)?{mark:"warning",word:"passed with warnings",tone:"warn"}:ie(e.state)}function al(e){switch(e){case"failure":return{mark:"failed",word:"failure",tone:"bad"};case"warning":return{mark:"warning",word:"warning",tone:"warn"};default:return{mark:"info",word:"notice",tone:"idle"}}}const St=[80,200,500];function ll(e){return e==null?St[0]:St.find(n=>n>e)??null}function ol(e){return/^\s*(?:::error\b|error\b|fatal\b|ERROR:|FAILED\b|✕|×)/i.test(e)||/\bJob failed\b/.test(e)?"err":/^\s*(?:::warning\b|warning\b|warn\b)/i.test(e)?"warn":null}const il=[{state:"open",label:"Open"},{state:"merged",label:"Merged"},{state:"closed",label:"Closed"}],Je=[{filter:"all",label:"All"},{filter:"mine",label:"Mine"},{filter:"review",label:"Review requests"}],cl=Ge({state:"open",draft:!0,approved:!1}),dl=Ge({state:"open",draft:!1,approved:!0});function ul({view:e,setView:n,query:s}){const{kind:r,api:a,scope:l,refresh:c,reportFreshness:i}=G(),u=z[r],o=e.repo??void 0,b=e.repo==null,h=be(a,l,"changes",{repo:o,filter:e.filter,state:e.state,sort:e.sort},c),m=fe(a,l,"change-counts",{repo:o,filter:e.filter},c);ct(i,h);const f=d.useMemo(()=>{var y;return((y=h.data)==null?void 0:y.items)??[]},[h.data]),x=d.useMemo(()=>f.filter(y=>rt({key:y.key,title:y.title,name:y.sourceBranch,number:y.number},s)),[f,s]),p=ot(h,f.length,x.length),g=e.filter==="review"&&e.state==="open"?Yr(x):null,j=u.changes.toLowerCase(),$=y=>t.jsx("ul",{className:"fg-rows",children:y.map(A=>t.jsx(fl,{kind:r,change:A,acrossRepos:b},A.key))});return t.jsxs("div",{className:"fgl",children:[t.jsxs("div",{className:"fgl-controls",children:[t.jsx("div",{className:"uh-range fgl-seg",role:"group","aria-label":`${u.changes} by state`,children:il.map(({state:y,label:A})=>{var N;const _=xa((N=m.data)==null?void 0:N[y]);return t.jsxs("button",{type:"button",className:"uh-range-btn","aria-pressed":e.state===y,onClick:()=>n({state:y}),children:[A,_&&t.jsx("span",{className:"fgl-seg-count",children:_})]},y)})}),t.jsx("div",{className:"uh-range fgl-seg fgl-scope-seg",role:"group","aria-label":`Which ${j}`,children:Je.map(({filter:y,label:A})=>t.jsx("button",{type:"button",className:"uh-range-btn","aria-pressed":e.filter===y,onClick:()=>n({filter:y}),children:A},y))}),t.jsx(hl,{filter:e.filter,noun:j,onChange:y=>n({filter:y})}),t.jsx(ml,{sort:e.sort,onChange:y=>n({sort:y})})]}),h.error&&h.data&&t.jsx(J,{error:h.error,onRetry:h.reload,compact:!0}),p==="loading"&&t.jsx(de,{label:`Loading ${j}`}),p==="failed"&&h.error&&t.jsx(J,{error:h.error,onRetry:h.reload}),p==="empty"&&t.jsx("p",{className:"fg-empty",children:$a(r,{state:e.state,filter:e.filter,acrossRepos:b})}),p==="no-match"&&t.jsx("p",{className:"fg-empty",children:Me(j,s)}),p==="rows"&&(g?t.jsxs(t.Fragment,{children:[t.jsx(ke,{id:"reviews-waiting",title:"Waiting for my review",count:g.waiting.length,defaultOpen:!0,children:g.waiting.length?$(g.waiting):t.jsx("p",{className:"fgl-group-empty",children:s.trim()?Me(`${j} waiting for you`,s):"Nothing loaded is waiting for you; you approved every one."})}),g.approved.length>0&&t.jsx(ke,{id:"reviews-approved",title:"Approved by me",count:g.approved.length,defaultOpen:!1,children:$(g.approved)})]}):t.jsx("div",{className:"fgl-flat",children:$(x)})),h.data&&t.jsx(ye,{pages:h,label:it(f.length,h.data.total)})]})}function hl({filter:e,noun:n,onChange:s}){const r=d.useId(),[a,l]=d.useState(null),c=Je.find(o=>o.filter===e)??Je[0],i=`${r}-trigger`,u=o=>{var b;s(o),l(null),(b=document.getElementById(i))==null||b.focus({preventScroll:!0})};return t.jsxs("span",{className:"fgl-scope",id:`${r}-layer`,children:[t.jsxs("button",{id:i,type:"button",className:"btn fgl-scope-trigger","aria-label":`Which ${n}: ${c.label}`,"aria-haspopup":"menu","aria-expanded":a!=null,"aria-controls":a?`${r}-menu`:void 0,onClick:()=>l(o=>o?null:"first"),onKeyDown:o=>{o.key!=="ArrowDown"&&o.key!=="ArrowUp"||(o.preventDefault(),l(o.key==="ArrowUp"?"last":"first"))},children:[c.label,t.jsx(_n,{})]}),a&&t.jsx(Et,{anchorId:i,portalRootId:`${r}-layer`,id:`${r}-menu`,className:"ap-pop fgl-scope-pop",role:"menu",labelledBy:i,start:a,onClose:()=>l(null),children:Je.map(o=>t.jsxs("button",{type:"button",role:"menuitem",className:"ap-menu-item fgl-scope-item","aria-current":o.filter===e||void 0,onClick:()=>u(o.filter),children:[t.jsx("span",{className:"fgl-scope-check","aria-hidden":"true",children:o.filter===e&&t.jsx(Tt,{})}),o.label]},o.filter))})]})}function ml({sort:e,onChange:n}){const s=e==="created"?"updated":"created";return t.jsxs("button",{type:"button",className:"btn fgl-sort",title:`Newest ${e} first. Sort by ${s} instead.`,"aria-label":`Sorted by ${e==="created"?"date created":"last updated"}, newest first. Sort by ${s==="created"?"date created":"last updated"} instead.`,onClick:()=>n(s),children:[t.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round","aria-hidden":"true",children:t.jsx("path",{d:"M2 3h8M3.5 6h5M5 9h2"})}),t.jsx("span",{className:"fgl-sort-word",children:e==="created"?"Created":"Updated"})]})}function fl({kind:e,change:n,acrossRepos:s}){const{selected:r,select:a}=G(),l={type:"change",repo:n.repo,number:n.number},c=at(r,l),i=pa(n),u=n.author?n.author.name||n.author.login:null;return t.jsx("li",{children:t.jsxs("button",{type:"button",className:"fg-row fgl-row ig-row","data-nav":"","data-selected":c||void 0,"aria-current":c||void 0,onClick:()=>a(l),children:[t.jsxs("span",{className:"fg-row-title fgl-title",children:[n.draft&&t.jsx(we,{mark:cl}),t.jsx("span",{className:"fgl-title-text",children:fa(n.title,n.draft)}),t.jsx(Zn,{labels:n.labels})]}),t.jsxs("span",{className:"fgl-side",children:[n.ci&&t.jsx(te,{mark:ie(n.ci.state)}),n.state==="open"&&n.approved&&t.jsx(we,{mark:dl}),t.jsx(pl,{reviewers:n.reviewers}),t.jsx(Yn,{count:n.comments})]}),t.jsxs("span",{className:"fg-meta fgl-meta",children:[t.jsx("code",{children:Kn(z[e].changeSigil,n,s)}),n.createdAt!=null&&t.jsxs(t.Fragment,{children:[" · created ",t.jsx(ee,{at:n.createdAt})]}),u&&t.jsxs(t.Fragment,{children:[" by ",u]})]}),t.jsx("span",{className:"fgl-when",children:i.at!=null&&t.jsxs(t.Fragment,{children:[t.jsxs("span",{className:"fgl-when-verb",children:[i.verb," "]}),t.jsx(ee,{at:i.at})]})})]})})}function pl({reviewers:e}){return e.length?t.jsxs("span",{className:"fgl-people",children:[t.jsx("span",{className:"fg-sr",children:e.length===1?"Reviewer: ":"Reviewers: "}),e.slice(0,3).map((n,s)=>{const r=On(n.state);return t.jsxs("span",{className:"fgl-reviewer","data-tone":r.tone,title:`${n.name||n.login}: ${r.word}`,children:[s>0&&t.jsx("span",{className:"fg-sr",children:"; "}),t.jsx(Hn,{user:n}),t.jsx("span",{className:"fg-sr",children:n.name||n.login}),n.state!=="pending"&&t.jsx("span",{className:"fgl-reviewer-mark","aria-hidden":"true",children:t.jsx(lt,{name:r.mark,size:9,weight:1.8})}),t.jsxs("span",{className:"fg-sr",children:[", ",r.word]})]},n.login)}),t.jsx(jl,{count:e.length-3})]}):null}function gl({users:e,label:n}){const s=Pt();return e.length?t.jsx(bn,{label:n,people:e.map(r=>({key:r.login,...s(r)}))}):null}function jl({count:e}){return e<=0?null:t.jsxs(t.Fragment,{children:[t.jsxs("span",{className:"fgl-people-more","aria-hidden":"true",children:["+",e]}),t.jsxs("span",{className:"fg-sr",children:[" and ",e," more"]})]})}function Yn({count:e}){return e?t.jsxs("span",{className:"fgl-comments",title:`${e} ${e===1?"comment":"comments"}`,children:[t.jsx("svg",{width:"13",height:"13",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinejoin:"round","aria-hidden":"true",children:t.jsx("path",{d:"M2.5 3.5h11v7.5h-6l-3 2.5v-2.5h-2z"})}),e.toLocaleString("en-US"),t.jsxs("span",{className:"fg-sr",children:[" ",e===1?"comment":"comments"]})]}):null}function Zn({labels:e}){return e.length?t.jsxs("span",{className:"fgl-labels",children:[e.slice(0,4).map(n=>{const s=ba(n.color),{scope:r,value:a}=Qn(n.name);return t.jsxs("span",{className:"fgl-label",title:n.name,children:[s&&t.jsx("i",{className:"fgl-label-dot",style:{background:s},"aria-hidden":"true"}),r&&t.jsxs("span",{className:"fgl-label-scope",children:[r,t.jsx("span",{className:"fg-sr",children:"::"})]}),t.jsx("span",{className:"fgl-label-name",children:a})]},n.name)}),e.length>4&&t.jsxs("span",{className:"fgl-label",title:e.slice(4).map(n=>n.name).join(", "),children:["+",e.length-4]})]}):null}function xl({view:e,query:n}){const{kind:s,api:r,scope:a,refresh:l,reportFreshness:c}=G(),i=e.repo==null,u=be(r,a,"pipelines",{repo:e.repo??void 0},l);ct(c,u);const o=d.useMemo(()=>{var f;return((f=u.data)==null?void 0:f.items)??[]},[u.data]),b=d.useMemo(()=>o.filter(f=>rt({title:f.title??"",name:f.ref,key:`${f.repo} ${f.shortSha}`},n)),[o,n]),h=ot(u,o.length,b.length),m=`${z[s].pipeline.toLowerCase()}s`;return t.jsxs("div",{className:"fgl",children:[u.error&&u.data&&t.jsx(J,{error:u.error,onRetry:u.reload,compact:!0}),h==="loading"&&t.jsx(de,{label:`Loading ${m}`}),h==="failed"&&u.error&&t.jsx(J,{error:u.error,onRetry:u.reload}),h==="empty"&&t.jsx("p",{className:"fg-empty",children:Sa(s,i)}),h==="no-match"&&t.jsx("p",{className:"fg-empty",children:Me(m,n)}),h==="rows"&&t.jsx("div",{className:"fgl-flat",children:t.jsx("ul",{className:"fg-rows",children:b.map(f=>t.jsx(bl,{kind:s,pipeline:f,acrossRepos:i},`${f.repo}/${f.id}`))})}),u.data&&t.jsx(ye,{pages:u,label:it(o.length,u.data.total)})]})}function bl({kind:e,pipeline:n,acrossRepos:s}){const{selected:r,select:a}=G(),l={type:"pipeline",repo:n.repo,id:n.id},c=at(r,l),{workflow:i,title:u}=ka(e,n.title),o=ze(n.durationSec),b=va(n.source),h=n.state==="running"&&n.startedAt!=null&&n.finishedAt==null,m=n.finishedAt??n.createdAt,f=n.triggeredBy?n.triggeredBy.name||n.triggeredBy.login:null;return t.jsx("li",{children:t.jsxs("button",{type:"button",className:"fg-row fgl-row fgl-pipeline ig-row","data-nav":"","data-selected":c||void 0,"aria-current":c||void 0,onClick:()=>a(l),children:[t.jsx("span",{className:"fgl-status",children:t.jsx(te,{mark:ie(n.state)})}),t.jsx("span",{className:"fgl-duration",children:o?t.jsxs(t.Fragment,{children:[t.jsx("span",{className:"fg-sr",children:"ran for "}),o]}):h&&t.jsxs(t.Fragment,{children:[t.jsx("span",{className:"fgl-when-verb",children:"started "}),t.jsx(ee,{at:n.startedAt})]})}),t.jsx("span",{className:"fg-row-title fgl-title",children:t.jsx("span",{className:"fgl-title-text",children:u??`${z[e].pipeline} ${n.id}`})}),t.jsxs("span",{className:"fg-meta fgl-meta",children:[s&&t.jsxs(t.Fragment,{children:[t.jsx("span",{className:"fgl-repo-ref",children:n.repo})," · "]}),t.jsx(yl,{}),t.jsx("code",{children:n.ref}),n.shortSha&&t.jsxs(t.Fragment,{children:[" · ",t.jsx("code",{children:n.shortSha})]}),i&&t.jsxs(t.Fragment,{children:[" · ",i]}),b&&t.jsxs(t.Fragment,{children:[" · ",b]})]}),t.jsx("span",{className:"fgl-side",children:n.triggeredBy&&t.jsxs("span",{title:f??void 0,children:[t.jsx(Hn,{user:n.triggeredBy}),t.jsx("span",{className:"fg-sr",children:f})]})}),t.jsx("span",{className:"fgl-when",children:m!=null&&t.jsxs(t.Fragment,{children:[t.jsxs("span",{className:"fgl-when-verb",children:[n.finishedAt!=null?"finished":"created"," "]}),t.jsx(ee,{at:m})]})})]})})}function yl(){return t.jsxs("svg",{className:"fgl-ref-glyph",width:"12",height:"12",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round","aria-hidden":"true",children:[t.jsx("circle",{cx:"4.5",cy:"3.5",r:"1.5"}),t.jsx("circle",{cx:"4.5",cy:"12.5",r:"1.5"}),t.jsx("circle",{cx:"11.5",cy:"5.5",r:"1.5"}),t.jsx("path",{d:"M4.5 5v6M11.5 7c0 3-7 2-7 4"})]})}const Nl=[{state:"open",label:"Open"},{state:"closed",label:"Closed"}];function kl({view:e,setView:n,query:s}){var p;const{kind:r,api:a,scope:l,refresh:c,reportFreshness:i,connection:u}=G(),o=e.repo==null,b=be(a,l,"issues",{repo:e.repo??void 0,state:e.issueState},c);ct(i,b);const h=d.useMemo(()=>{var g;return((g=b.data)==null?void 0:g.items)??[]},[b.data]),m=d.useMemo(()=>h.filter(g=>rt({key:g.key,title:g.title,number:g.number},s)),[h,s]),f=ot(b,h.length,m.length),x=r==="gitlab"?((p=u.account)==null?void 0:p.login)??null:null;return t.jsxs("div",{className:"fgl",children:[t.jsxs("div",{className:"fgl-controls",children:[t.jsx("div",{className:"uh-range fgl-seg",role:"group","aria-label":"Issues by state",children:Nl.map(({state:g,label:j})=>t.jsx("button",{type:"button",className:"uh-range-btn","aria-pressed":e.issueState===g,onClick:()=>n({issueState:g}),children:j},g))}),r==="gitlab"&&t.jsx("span",{className:"fgl-controls-note",children:"Assigned to you"})]}),b.error&&b.data&&t.jsx(J,{error:b.error,onRetry:b.reload,compact:!0}),f==="loading"&&t.jsx(de,{label:"Loading issues"}),f==="failed"&&b.error&&t.jsx(J,{error:b.error,onRetry:b.reload}),f==="empty"&&t.jsx("p",{className:"fg-empty",children:Ca(r,e.issueState,o)}),f==="no-match"&&t.jsx("p",{className:"fg-empty",children:Me("issues",s)}),f==="rows"&&t.jsx("div",{className:"fgl-flat",children:t.jsx("ul",{className:"fg-rows",children:m.map(g=>t.jsx(wl,{issue:g,acrossRepos:o,me:x},g.key))})}),b.data&&t.jsx(ye,{pages:b,label:it(h.length,b.data.total)})]})}function wl({issue:e,acrossRepos:n,me:s}){const{selected:r,select:a}=G(),l={type:"issue",repo:e.repo,number:e.number},c=at(r,l),i=e.author?e.author.name||e.author.login:null,u=s?e.assignees.filter(h=>h.login!==s):e.assignees,o=ga(e),b=e.state==="closed"&&e.closedAt!=null?e.closedAt:e.updatedAt;return t.jsx("li",{children:t.jsxs("button",{type:"button",className:"fg-row fgl-row ig-row","data-nav":"","data-selected":c||void 0,"aria-current":c||void 0,onClick:()=>a(l),children:[t.jsxs("span",{className:"fg-row-title fgl-title",children:[o&&t.jsx(we,{mark:o}),t.jsx("span",{className:"fgl-title-text",children:e.title}),t.jsx(Zn,{labels:e.labels})]}),t.jsxs("span",{className:"fgl-side",children:[e.children&&e.children.total>0&&t.jsxs("span",{className:"fgl-children",title:`${e.children.completed} of ${e.children.total} child items done`,children:[t.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[t.jsx("rect",{x:"2.5",y:"2.5",width:"11",height:"11",rx:"2"}),t.jsx("path",{d:"M5.5 8.2l1.8 1.8 3.4-4"})]}),e.children.completed,"/",e.children.total,t.jsx("span",{className:"fg-sr",children:" child items done"})]}),t.jsx(gl,{users:u,label:"Assigned to"}),t.jsx(Yn,{count:e.comments})]}),t.jsxs("span",{className:"fg-meta fgl-meta",children:[t.jsx("code",{children:Kn("#",e,n)}),e.createdAt!=null&&t.jsxs(t.Fragment,{children:[" · opened ",t.jsx(ee,{at:e.createdAt})]}),i&&t.jsxs(t.Fragment,{children:[" by ",i]}),e.milestone&&t.jsxs(t.Fragment,{children:[" · ",e.milestone.title]})]}),t.jsx("span",{className:"fgl-when",children:b!=null&&t.jsxs(t.Fragment,{children:[t.jsxs("span",{className:"fgl-when-verb",children:[e.state==="closed"&&e.closedAt!=null?"closed":"updated"," "]}),t.jsx(ee,{at:b})]})})]})})}function dn(e){const n={};for(const[s,r]of Object.entries(e))s==="colspan"?n.colSpan=Number(r):s==="rowspan"?n.rowSpan=Number(r):s==="start"?n.start=Number(r):s==="open"?n.open=!0:s==="align"?n.style={textAlign:r.toLowerCase()}:n[s]=r;return n}function vl({node:e}){const[n,s]=d.useState(!1),r=e.alt.trim()||"image";return!e.src||n?t.jsxs("a",{className:"fh-image-link",href:e.href,target:"_blank",rel:"noreferrer noopener",children:[r," ↗"]}):t.jsx("a",{className:"fh-image",href:e.href,target:"_blank",rel:"noreferrer noopener",children:t.jsx("img",{src:e.src,alt:e.alt,width:e.width??void 0,height:e.height??void 0,loading:"lazy",referrerPolicy:"no-referrer",onError:()=>s(!0)})})}function Re(e){return e.map((n,s)=>{switch(n.t){case"text":return n.text;case"link":return t.jsx("a",{href:n.href,title:n.title??void 0,target:"_blank",rel:"noreferrer noopener",children:Re(n.kids)},s);case"img":return t.jsx(vl,{node:n},s);case"check":return t.jsx("span",{className:"fh-check",role:"img","aria-label":n.checked?"done":"to do","data-checked":n.checked||void 0,children:t.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[t.jsx("rect",{x:"1.6",y:"1.6",width:"10.8",height:"10.8",rx:"2.4"}),n.checked&&t.jsx("path",{d:"m4.3 7.2 1.9 1.9 3.6-4"})]})},s);case"el":{const r=n.tag;return n.tag==="hr"||n.tag==="br"?t.jsx(r,{},s):n.tag==="pre"?t.jsx("pre",{tabIndex:0,...dn(n.attrs),children:Re(n.kids)},s):t.jsx(r,{...dn(n.attrs),children:Re(n.kids)},s)}}})}function Ut({nodes:e,className:n}){return t.jsx("div",{className:n?`forge-html ${n}`:"forge-html",children:Re(e)})}const $l=1,Sl=3,Cl={p:[],div:[],h1:[],h2:[],h3:[],h4:[],h5:[],h6:[],ul:[],ol:["start"],li:[],blockquote:[],pre:[],hr:[],br:[],table:[],caption:[],thead:[],tbody:[],tfoot:[],tr:[],th:["align","colspan","rowspan"],td:["align","colspan","rowspan"],details:["open"],summary:[],dl:[],dt:[],dd:[]},Al={code:[],em:[],strong:[],b:[],i:[],u:[],s:[],del:[],ins:[],mark:[],sup:[],sub:[],kbd:[],small:[],abbr:["title"],q:[],cite:[]},Rl=new Set(["script","style","template","noscript","iframe","frame","frameset","object","embed","applet","svg","math","form","button","textarea","select","option","canvas","link","meta","base","head","title","portal","track","source"]),Ll=new Set(["http:","https:","mailto:"]),un=new Set(["http:","https:"]),es=2048,El=48;function bt(e,n,s){const r=(e??"").trim();if(!r||r.length>es)return null;let a;try{a=new URL(r,new URL(n).origin+"/")}catch{return null}return s.has(a.protocol)?a.toString():null}function oe(e,n){var r;const s=(r=e.getAttribute)==null?void 0:r.call(e,n);return typeof s=="string"?s:null}function hn(e){const n=Number(e);return Number.isInteger(n)&&n>0&&n<1e4?n:null}function Ml(e,n){const s={left:n.maxNodes??5e3,cut:!1},r=Ct(e,n,s,0);return s.cut&&r.push({t:"text",text:" …"}),r}function Ct(e,n,s,r){const a=[],l=e.childNodes;for(let c=0;c<l.length;c++){if(s.left<=0){s.cut=!0;break}a.push(...Dl(l[c],n,s,r))}return a}function Dl(e,n,s,r){var u,o,b,h;if(s.left--,e.nodeType===Sl)return e.nodeValue?[{t:"text",text:e.nodeValue}]:[];if(e.nodeType!==$l)return[];const a=e.nodeName.toLowerCase();if(Rl.has(a))return[];if(r>=El)return Ct(e,n,s,r);const l=()=>Ct(e,n,s,r+1);if(a==="a"){const m=bt(oe(e,"href"),n.baseUrl,Ll);return!m||(u=oe(e,"href"))!=null&&u.trim().startsWith("#")?l():[{t:"link",href:m,title:((o=oe(e,"title"))==null?void 0:o.slice(0,300))??null,kids:l()}]}if(a==="img"){const m=bt(oe(e,"data-src")??oe(e,"src"),n.baseUrl,un);if(!m)return[];const f=(oe(e,"alt")??"").slice(0,300);return n.inline?[{t:"text",text:f}]:[{t:"img",src:n.asset(m),href:m,alt:f,width:hn(oe(e,"width")),height:hn(oe(e,"height"))}]}if(a==="video"||a==="audio"){const m=bt(oe(e,"data-src")??oe(e,"src"),n.baseUrl,un);return m&&!n.inline?[{t:"link",href:m,title:null,kids:[{t:"text",text:`${a} ↗`}]}]:[]}if(a==="input")return((b=oe(e,"type"))==null?void 0:b.toLowerCase())==="checkbox"&&!n.inline?[{t:"check",checked:((h=e.getAttribute)==null?void 0:h.call(e,"checked"))!=null}]:[];const c=Al[a]??(n.inline?void 0:Cl[a]);if(!c)return l();const i={};for(const m of c){const f=oe(e,m);f!=null&&f.length<=es&&(i[m]=f)}i.start!=null&&!/^\d{1,6}$/.test(i.start)&&delete i.start;for(const m of["colspan","rowspan"])i[m]!=null&&!/^\d{1,3}$/.test(i[m])&&delete i[m];return i.align!=null&&!/^(?:left|right|center)$/i.test(i.align)&&delete i.align,[{t:"el",tag:a,attrs:i,kids:l()}]}function Tl(e,n){if(!e)return[];const s=new DOMParser().parseFromString(e,"text/html");return Ml(s.body,n)}function ts({dir:e}){if(!e)return null;const n=e.split("/").slice(0,-1);return t.jsx("span",{className:"fd-path-dir",children:n.map((s,r)=>t.jsxs("span",{children:[s,"/",t.jsx("wbr",{})]},r))})}function dt({label:e,children:n}){const s=d.useRef(null);return d.useLayoutEffect(()=>{var a;const r=(a=s.current)==null?void 0:a.closest(".ig-detail");r&&(r.scrollTop=0)},[]),t.jsx("article",{ref:s,className:"fd","aria-label":e,tabIndex:-1,children:n})}function ut(){const{kind:e,narrow:n,select:s}=G();return{openLabel:`Open in ${z[e].name}`,narrow:n,onClose:()=>s(null)}}function ht({data:e,loading:n,error:s,onRetry:r,what:a}){return e?null:(s==null?void 0:s.kind)==="not-found"?t.jsxs("p",{className:"fg-empty",children:["This ",a," no longer exists, or this token cannot see it."]}):s?t.jsx(J,{error:s,onRetry:r}):n?t.jsx(de,{rows:5,label:`Loading the ${a}`}):null}function We(e,n=!1){const{connection:s,asset:r}=G();return d.useMemo(()=>e?Tl(e,{baseUrl:s.baseUrl,asset:r,inline:n}):[],[e,n,s.baseUrl,r])}function je({label:e,children:n}){return t.jsxs("div",{className:"fd-fact",children:[t.jsx("dt",{children:e}),t.jsx("dd",{children:n})]})}function ns({label:e,children:n}){return t.jsx("aside",{className:"fd-side","aria-label":e,children:t.jsx("dl",{className:"fd-facts",children:n})})}function At({users:e,extra:n}){return e.length?t.jsx("ul",{className:"fd-people",children:e.map(s=>t.jsxs("li",{children:[t.jsx(Te,{user:s,size:20}),n==null?void 0:n(s)]},s.login))}):t.jsx("span",{className:"fd-none",children:"None"})}function Fl({users:e,max:n=12}){if(!e.length)return t.jsx("span",{className:"fd-none",children:"None"});const s=e.slice(0,n);return t.jsxs("ul",{className:"fd-faces",children:[s.map(r=>t.jsx("li",{children:t.jsx(Te,{user:r,size:22,nameless:!0})},r.login)),e.length>n&&t.jsxs("li",{className:"fd-faces-more",children:["+",e.length-n]})]})}function Il({label:e}){const n=Ja(e.color),{scope:s,value:r}=Qn(e.name);return t.jsxs("span",{className:"fd-label",title:e.name,children:[t.jsx("span",{className:"fd-swatch",style:n?{backgroundColor:n}:void 0,"aria-hidden":"true"}),s&&t.jsx("span",{className:"fd-label-scope",children:s}),t.jsx("span",{className:"fd-label-value",children:r})]})}function ss({labels:e}){return e.length?t.jsx("span",{className:"fd-labels",children:e.map(n=>t.jsx(Il,{label:n},n.name))}):t.jsx("span",{className:"fd-none",children:"None"})}function Rt({commit:e}){return t.jsxs("li",{className:"fd-item",children:[e.webUrl?t.jsxs("a",{className:"fd-item-title fd-out",href:e.webUrl,target:"_blank",rel:"noreferrer noopener",children:[e.title,t.jsx("span",{className:"fd-out-mark","aria-hidden":"true",children:" ↗"})]}):t.jsx("span",{className:"fd-item-title",children:e.title}),t.jsxs("span",{className:"fd-item-meta",children:[t.jsx(ve,{value:e.sha,label:"commit sha",children:t.jsx("code",{children:e.shortSha})}),e.authorName&&t.jsx("span",{children:e.authorName}),e.authoredAt!=null&&t.jsx(ee,{at:e.authoredAt})]})]})}function qe({children:e,count:n,aside:s}){return t.jsxs("h3",{className:"fd-heading",children:[t.jsx("span",{children:e}),n!=null&&t.jsx("span",{className:"fg-count",children:n.toLocaleString()}),s]})}function Ol({title:e,count:n,startsOpen:s,aside:r,children:a}){const[l,c]=d.useState(s);return t.jsxs("section",{className:"fg-group fd-fold","data-open":l||void 0,children:[t.jsxs("h3",{className:"fg-group-head fd-fold-head",children:[t.jsxs("button",{type:"button",className:"fg-fold","aria-expanded":l,onClick:()=>c(i=>!i),children:[t.jsx("span",{className:"fg-fold-chevron","aria-hidden":"true"}),e,n!=null&&t.jsx("span",{className:"fg-count",children:n.toLocaleString()})]}),r]}),l&&a]})}function mn(e){return`Open this comment in ${z[e].name}`}function rs({comment:e}){const{kind:n}=G(),s=We(e.bodyHtml);return t.jsxs("li",{className:"fd-comment",children:[t.jsxs("div",{className:"fd-comment-head",children:[e.author?t.jsx(Te,{user:e.author,size:20}):t.jsx("span",{className:"fd-none",children:"Someone"}),e.createdAt!=null&&t.jsx("span",{className:"fd-comment-time",children:t.jsx(ee,{at:e.createdAt})}),e.webUrl&&t.jsx("a",{className:"fd-comment-link",href:e.webUrl,target:"_blank",rel:"noreferrer noopener","aria-label":mn(n),title:mn(n),children:t.jsx("span",{"aria-hidden":"true",children:"↗"})})]}),s.length?t.jsx(Ut,{className:"fd-comment-body",nodes:s}):t.jsx("p",{className:"fd-comment-body fd-none",children:"No text."})]})}function Pl({thread:e}){const n=e.path?Xn(e.path):null;return t.jsxs("li",{className:"fd-thread",children:[n&&t.jsxs("div",{className:"fd-thread-head",children:[t.jsxs("code",{className:"fd-path",title:qa(e)??void 0,children:[t.jsx(ts,{dir:n.dir}),t.jsxs("span",{className:"fd-path-name",children:[n.name,e.line!=null&&t.jsxs("span",{className:"fd-path-line",children:[":",e.line]})]})]}),e.outdated&&t.jsx("span",{className:"fg-badge fd-outdated",children:"outdated"})]}),t.jsx("ol",{className:"fd-comments",children:e.comments.map(s=>t.jsx(rs,{comment:s},s.id))})]})}function yt({threads:e}){return t.jsx("ol",{className:"fd-threads",children:e.map(n=>t.jsx(Pl,{thread:n},n.id))})}function Bl({selection:e}){const{kind:n,api:s,scope:r,refresh:a}=G(),l=ut(),c=z[n],i={repo:e.repo,number:e.number},u=fe(s,r,"change",i,a),o=u.data,b=!!o&&(o.ci!=null||o.counts.pipelines>0),h=fe(s,r,b?"change/pipelines":null,i,a),[m,f]=d.useState("overview"),x=(o==null?void 0:o.key)??Gn(n,e.repo,e.number),p=d.useId(),g=y=>`${p}-tab-${y}`,j=y=>`${p}-panel-${y}`,$=o?Oa(n,o.counts):[];return t.jsxs(dt,{label:`${c.change} ${x}`,children:[t.jsx(Ke,{...l,reference:x,copyLabel:"reference",href:(o==null?void 0:o.webUrl)??null}),t.jsx(ht,{data:o,loading:u.loading,error:u.error,onRetry:u.reload,what:c.change.toLowerCase()}),o&&t.jsxs(t.Fragment,{children:[u.error&&t.jsx(J,{error:u.error,onRetry:u.reload,compact:!0}),t.jsx(Ul,{change:o,pipelines:h.data}),t.jsxs("div",{className:"fd-layout",children:[t.jsx(_l,{change:o}),t.jsxs("div",{className:"fd-main",children:[t.jsx("div",{className:"uh-range fd-sections",role:"tablist","aria-label":`${c.change} sections`,onKeyDown:y=>{var _;const A=kn(y,$.findIndex(N=>N.id===m),$.length);A.kind!=="pass"&&(y.preventDefault(),y.stopPropagation(),f($[A.index].id),(_=y.currentTarget.querySelectorAll("[role=tab]")[A.index])==null||_.focus())},children:$.map(y=>t.jsxs("button",{id:g(y.id),type:"button",role:"tab",className:"uh-range-btn","aria-selected":m===y.id,"aria-controls":j(y.id),tabIndex:m===y.id?0:-1,onClick:()=>f(y.id),children:[t.jsx("span",{className:"fd-section-label",children:y.label}),t.jsx("span",{className:"fd-section-count",children:y.count.toLocaleString()})]},y.id))}),$.map(y=>t.jsx("div",{className:"fd-section",id:j(y.id),role:"tabpanel","aria-labelledby":g(y.id),hidden:m!==y.id,children:m!==y.id?null:y.id==="overview"?t.jsx(Hl,{change:o}):y.id==="commits"?t.jsx(Wl,{selection:e}):y.id==="pipelines"?t.jsx(ql,{repo:e.repo,read:h}):t.jsx(Kl,{selection:e})},y.id))]})]})]})]})}function Ul({change:e,pipelines:n}){var f,x,p;const{kind:s,select:r}=G(),a=z[s],l=e.state==="open"&&e.draft,c=We(e.titleHtml,!0),i=c.length?Re(l?_a(c):c):l?Ua(e.title):e.title,u=(n==null?void 0:n[0])??null,o=Fa((f=e.ci)==null?void 0:f.webUrl)??(u==null?void 0:u.id)??null,b=((x=e.ci)==null?void 0:x.state)??(u==null?void 0:u.state)??null,h=za(e),m=Pa(e.counts.commits);return t.jsxs("header",{className:"fd-head",children:[t.jsx("h2",{className:"fd-title",children:i}),t.jsxs("p",{className:"fd-byline",children:[t.jsx(we,{mark:Ba(e)}),e.author&&t.jsx(Te,{user:e.author,size:18}),s==="github"?t.jsxs(t.Fragment,{children:[e.state==="merged"?t.jsx("span",{children:m?`· ${m} merged into`:"· merged into"}):t.jsx("span",{children:m?`wants to merge ${m} into`:"wants to merge into"}),t.jsx("code",{className:"fd-branch",children:e.targetBranch}),t.jsx("span",{children:"from"}),t.jsx(ve,{value:e.sourceBranch,label:"source branch",children:t.jsx("code",{className:"fd-branch",children:e.sourceBranch})})]}):t.jsxs(t.Fragment,{children:[t.jsx("span",{children:"requested to merge"}),t.jsx(ve,{value:e.sourceBranch,label:"source branch",children:t.jsx("code",{className:"fd-branch",children:e.sourceBranch})}),t.jsx("span",{children:"into"}),t.jsx("code",{className:"fd-branch",children:e.targetBranch})]}),e.createdAt!=null&&t.jsxs("span",{className:"fd-when",children:["· created ",t.jsx(ee,{at:e.createdAt})]}),e.state==="merged"&&e.mergedAt!=null&&t.jsxs("span",{className:"fd-when",children:["· merged ",t.jsx(ee,{at:e.mergedAt})]}),e.state==="closed"&&e.closedAt!=null&&t.jsxs("span",{className:"fd-when",children:["· closed ",t.jsx(ee,{at:e.closedAt})]})]}),(b||h)&&t.jsxs("ul",{className:"fd-status",children:[b&&t.jsx("li",{children:o?t.jsxs("button",{type:"button",className:"fd-jump",onClick:()=>r({type:"pipeline",repo:e.repo,id:o}),children:[t.jsx(te,{mark:ie(b)}),t.jsxs("span",{children:[a.pipeline," ",t.jsxs("code",{children:["#",o]})]}),t.jsx("span",{className:"fd-jump-arrow","aria-hidden":"true",children:"›"})]}):t.jsxs("span",{className:"fd-status-line",children:[t.jsx(te,{mark:ie(b)}),t.jsx(Ee,{href:((p=e.ci)==null?void 0:p.webUrl)??null,children:"Checks"})]})}),h&&t.jsxs("li",{className:"fd-status-line",children:[t.jsx(te,{mark:h.mark,quiet:!0}),t.jsx("span",{children:h.text})]})]})]})}function _l({change:e}){return t.jsxs(ns,{label:"About this change",children:[t.jsx(je,{label:e.assignees.length>1?"Assignees":"Assignee",children:t.jsx(At,{users:e.assignees})}),t.jsx(je,{label:e.reviewers.length>1?"Reviewers":"Reviewer",children:t.jsx(At,{users:e.reviewers,extra:n=>t.jsx(te,{className:"fd-review",mark:On(n.state)})})}),e.labels.length>0&&t.jsx(je,{label:"Labels",children:t.jsx(ss,{labels:e.labels})}),e.milestone&&t.jsx(je,{label:"Milestone",children:e.milestone.webUrl?t.jsx("a",{className:"fd-plain-link",href:e.milestone.webUrl,target:"_blank",rel:"noreferrer noopener",children:e.milestone.title}):e.milestone.title}),e.participants.length>0&&t.jsx(je,{label:`Participants · ${e.participants.length}`,children:t.jsx(Fl,{users:e.participants})})]})}function Hl({change:e}){const n=We(e.descriptionHtml),{unresolved:s,resolved:r,general:a}=Wa(e),l=!s.length&&!r.length&&!a.length;return t.jsxs(t.Fragment,{children:[n.length?t.jsx(Ut,{className:"fd-description",nodes:n}):t.jsx("p",{className:"fd-none fd-description",children:"No description."}),t.jsxs("div",{className:"fd-discussions",children:[l&&t.jsx("p",{className:"fg-empty",children:"No discussions yet."}),s.length>0&&t.jsx(ke,{id:"change:unresolved",title:"Unresolved threads",count:s.length,defaultOpen:!0,children:t.jsx(yt,{threads:s})}),!s.length&&r.length>0&&t.jsx("p",{className:"fd-status-line fd-all-resolved",children:t.jsx(te,{mark:{mark:"resolved",word:"All threads resolved",tone:"ok"}})}),r.length>0&&t.jsx(ke,{id:"change:resolved",title:"Resolved threads",count:r.length,defaultOpen:!1,children:t.jsx(yt,{threads:r})}),a.length>0&&t.jsx(ke,{id:"change:general",title:"General comments",count:a.length,defaultOpen:!1,children:t.jsx(yt,{threads:a})})]})]})}function Wl({selection:e}){const{api:n,scope:s,refresh:r}=G(),a=be(n,s,"change/commits",{repo:e.repo,number:e.number},r);return a.data?t.jsxs(t.Fragment,{children:[a.error&&t.jsx(J,{error:a.error,onRetry:a.reload,compact:!0}),a.data.items.length?t.jsx("ul",{className:"fd-items",children:a.data.items.map(l=>t.jsx(Rt,{commit:l},l.sha))}):t.jsx("p",{className:"fg-empty",children:"No commits."}),t.jsx(ye,{pages:a,label:"Load more commits"})]}):a.error?t.jsx(J,{error:a.error,onRetry:a.reload}):t.jsx(de,{rows:4,label:"Loading commits"})}function ql({repo:e,read:n}){const{kind:s,select:r,selected:a}=G(),l=z[s],c=Jn(s).toLowerCase();return n.data?n.data.length?t.jsxs(t.Fragment,{children:[n.error&&t.jsx(J,{error:n.error,onRetry:n.reload,compact:!0}),t.jsx("ul",{className:"fg-rows fd-rows",children:n.data.map(i=>{const u=(a==null?void 0:a.type)==="pipeline"&&a.id===i.id,o=ze(i.durationSec);return t.jsx("li",{children:t.jsxs("button",{type:"button",className:"fg-row fd-pipe-row","aria-current":u||void 0,"data-selected":u||void 0,onClick:()=>r({type:"pipeline",repo:e,id:i.id}),children:[t.jsx(te,{mark:ie(i.state)}),t.jsx("span",{className:"fd-pipe-id",children:t.jsxs("code",{children:["#",i.id]})}),t.jsxs("span",{className:"fd-pipe-meta",children:[t.jsx("code",{className:"fd-branch",title:i.ref,children:Vn(s,i.ref)}),t.jsx("code",{children:i.shortSha}),i.title&&t.jsx("span",{className:"fd-pipe-title",children:i.title})]}),t.jsxs("span",{className:"fd-pipe-when",children:[o&&t.jsx("span",{children:o}),i.createdAt!=null&&t.jsx(ee,{at:i.createdAt})]})]})},i.id)})})]}):t.jsxs("p",{className:"fg-empty",children:["No ",c," ran for this ",l.change.toLowerCase(),"."]}):n.error?t.jsx(J,{error:n.error,onRetry:n.reload}):n.loading?t.jsx(de,{rows:3,label:`Loading ${c}`}):t.jsxs("p",{className:"fg-empty",children:["No ",c," ran for this ",l.change.toLowerCase(),"."]})}function Kl({selection:e}){const{api:n,scope:s,refresh:r}=G(),a=be(n,s,"change/files",{repo:e.repo,number:e.number},r);return a.data?t.jsxs(t.Fragment,{children:[a.error&&t.jsx(J,{error:a.error,onRetry:a.reload,compact:!0}),a.data.items.length?t.jsx("ul",{className:"fd-files",children:a.data.items.map(l=>t.jsx(Gl,{file:l},`${l.oldPath??""}>${l.path}`))}):t.jsx("p",{className:"fg-empty",children:"No changed files."}),t.jsx(ye,{pages:a,label:"Load more files"})]}):a.error?t.jsx(J,{error:a.error,onRetry:a.reload}):t.jsx(de,{rows:5,label:"Loading changed files"})}function Gl({file:e}){const n=Va(e.status),{dir:s,name:r}=Xn(e.path),a=t.jsxs(t.Fragment,{children:[t.jsxs("span",{className:"fd-file-path",children:[e.oldPath&&e.oldPath!==e.path&&t.jsxs("span",{className:"fd-file-old",children:[t.jsx("code",{children:e.oldPath})," ",t.jsx("span",{"aria-hidden":"true",children:"→"}),t.jsx("span",{className:"fd-sr",children:" renamed to"})," "]}),t.jsxs("code",{children:[t.jsx(ts,{dir:s}),t.jsx("span",{className:"fd-path-name",children:r})]})]}),t.jsxs("span",{className:"fd-file-end",children:[n&&t.jsx("span",{className:"fd-file-status","data-status":e.status,children:n}),t.jsxs("span",{className:"fd-diffstat",title:`${e.additions} added, ${e.deletions} removed`,children:[t.jsxs("span",{className:"fd-add","data-zero":e.additions===0||void 0,children:["+",e.additions.toLocaleString()]}),t.jsxs("span",{className:"fd-del","data-zero":e.deletions===0||void 0,children:["−",e.deletions.toLocaleString()]})]}),e.webUrl&&t.jsx("span",{className:"fd-out-mark","aria-hidden":"true",children:"↗"})]})]});return t.jsx("li",{children:e.webUrl?t.jsx("a",{className:"fd-file",href:e.webUrl,target:"_blank",rel:"noreferrer noopener",children:a}):t.jsx("span",{className:"fd-file",children:a})})}const fn=10;function zl({selection:e}){const{kind:n,api:s,scope:r,refresh:a}=G(),l=ut(),c=fe(s,r,"branch",{repo:e.repo,name:e.name},a),i=c.data;return t.jsxs(dt,{label:`Branch ${e.name}`,children:[t.jsx(Ke,{...l,reference:e.repo,copyLabel:z[n].repo.toLowerCase(),href:(i==null?void 0:i.branch.webUrl)??null}),t.jsx(ht,{data:i,loading:c.loading,error:c.error,onRetry:c.reload,what:"branch"}),i&&t.jsxs(t.Fragment,{children:[c.error&&t.jsx(J,{error:c.error,onRetry:c.reload,compact:!0}),t.jsx(Vl,{repo:e.repo,detail:i})]})]})}function Vl({repo:e,detail:n}){var j,$;const{kind:s,api:r,scope:a,refresh:l,connection:c,select:i}=G(),u=z[s],o=n.branch,h=(($=(j=fe(r,a,o.isDefault?null:"repos",{},l).data)==null?void 0:j.items.find(y=>y.path===e))==null?void 0:$.defaultBranch)??null,[m,f]=d.useState(!1),x=n.pipeline,p=x?ze(x.durationSec):null,g=m?n.commitsAhead:n.commitsAhead.slice(0,fn);return t.jsxs(t.Fragment,{children:[t.jsxs("header",{className:"fd-head",children:[t.jsx("h2",{className:"fd-title fd-title-mono",children:t.jsx(ve,{value:o.name,label:"branch name",children:t.jsx("code",{children:o.name})})}),(o.isDefault||o.protected||o.stale)&&t.jsxs("p",{className:"fd-byline",children:[o.isDefault&&t.jsx("span",{className:"fg-badge",children:"default"}),o.protected&&t.jsx("span",{className:"fg-badge",children:"protected"}),o.stale&&t.jsx("span",{className:"fg-badge",children:"stale"})]})]}),t.jsxs("dl",{className:"fd-facts fd-facts-page",children:[t.jsxs("div",{className:"fd-fact",children:[t.jsx("dt",{children:"Latest commit"}),t.jsx("dd",{children:t.jsx("ul",{className:"fd-items fd-items-bare",children:t.jsx(Rt,{commit:{...o.commit,authoredAt:o.commit.committedAt}})})})]}),!o.isDefault&&t.jsxs("div",{className:"fd-fact",children:[t.jsxs("dt",{children:["Compared with ",h??"the default branch"]}),t.jsxs("dd",{className:"fd-diverge",children:[t.jsxs("span",{children:[t.jsx("strong",{children:Ye(o.behind)})," behind"]}),t.jsx("span",{"aria-hidden":"true",children:"·"}),t.jsxs("span",{children:[t.jsx("strong",{children:Ye(o.ahead)})," ahead"]})]})]}),t.jsxs("div",{className:"fd-fact",children:[t.jsx("dt",{children:u.pipeline}),t.jsx("dd",{children:x?t.jsxs("button",{type:"button",className:"fd-jump",onClick:()=>i({type:"pipeline",repo:e,id:x.id}),children:[t.jsx(te,{mark:ie(x.state)}),t.jsx("span",{children:t.jsxs("code",{children:["#",x.id]})}),p&&t.jsx("span",{className:"fd-jump-meta",children:p}),x.createdAt!=null&&t.jsx("span",{className:"fd-jump-meta",children:t.jsx(ee,{at:x.createdAt})}),t.jsx("span",{className:"fd-jump-arrow","aria-hidden":"true",children:"›"})]}):o.ci?t.jsxs("span",{className:"fd-status-line",children:[t.jsx(te,{mark:ie(o.ci.state)}),t.jsx(Ee,{href:o.ci.webUrl})]}):t.jsx(te,{mark:ie("none")})})]}),!o.isDefault&&t.jsxs("div",{className:"fd-fact",children:[t.jsx("dt",{children:u.change}),t.jsx("dd",{children:o.change?t.jsxs("button",{type:"button",className:"fd-jump",onClick:()=>i({type:"change",repo:e,number:o.change.number}),children:[t.jsx(we,{mark:Ge(o.change)}),t.jsx("span",{children:t.jsxs("code",{children:[u.changeSigil,o.change.number]})}),t.jsx("span",{className:"fd-jump-arrow","aria-hidden":"true",children:"›"})]}):t.jsxs(Ee,{href:Ia(s,c.baseUrl,e,o.name),children:["Create ",u.change.toLowerCase()]})})]})]}),!o.isDefault&&t.jsxs("section",{className:"fd-block",children:[t.jsxs(qe,{count:o.ahead??n.commitsAhead.length,children:["Commits not in ",h??"the default branch"]}),n.commitsAhead.length?t.jsxs(t.Fragment,{children:[t.jsx("ul",{className:"fd-items",children:g.map(y=>t.jsx(Rt,{commit:y},y.sha))}),!m&&n.commitsAhead.length>fn&&t.jsxs("button",{type:"button",className:"btn fg-more",onClick:()=>f(!0),children:["Show all ",n.commitsAhead.length.toLocaleString()]})]}):t.jsx("p",{className:"fg-empty",children:o.ahead===0?`Every commit here is already in ${h??"the default branch"}.`:"The forge listed none."})]})]})}function Jl({repo:e,jobs:n}){const s=Za(n);return n.length?s.length===1&&s[0].name==null?t.jsx(pn,{repo:e,jobs:n}):t.jsx("div",{className:"fd-stages",children:s.map(r=>t.jsx(Ol,{title:r.name??"Other jobs",count:r.jobs.length,startsOpen:tl(r,n.length),aside:t.jsx(te,{mark:rl(r)}),children:t.jsx(pn,{repo:e,jobs:r.jobs})},r.name??""))}):t.jsx("p",{className:"fg-empty",children:"This pipeline has no jobs."})}function pn({repo:e,jobs:n}){return t.jsx("ul",{className:"fd-jobs",children:n.map(s=>t.jsx(Xl,{repo:e,job:s},s.id))})}function Xl({repo:e,job:n}){const[s,r]=d.useState(()=>nl(n)),a=ze(n.durationSec),l=`fd-job-${n.id}`;return t.jsxs("li",{className:"fd-job","data-open":s||void 0,children:[t.jsxs("button",{type:"button",className:"fg-row fd-job-row","aria-expanded":s,"aria-controls":l,onClick:()=>r(c=>!c),children:[t.jsx("span",{className:"fg-fold-chevron","aria-hidden":"true"}),t.jsx(te,{mark:sl(n)}),t.jsx("span",{className:"fd-job-name",children:n.name}),n.allowFailure&&n.state==="failed"&&t.jsx("span",{className:"fd-job-note",children:"allowed to fail"}),a&&t.jsx("span",{className:"fd-job-time",children:a})]}),s&&t.jsxs("div",{className:"fd-job-body",id:l,children:[n.failureReason&&t.jsx("p",{className:"fd-job-reason",children:n.failureReason}),n.annotations.length>0&&t.jsx("ul",{className:"fd-annotations",children:n.annotations.map((c,i)=>t.jsxs("li",{children:[t.jsx(te,{mark:al(c.level)}),c.path&&t.jsx("code",{className:"fd-ann-place",children:c.line!=null?`${c.path}:${c.line}`:c.path}),c.title&&t.jsx("strong",{className:"fd-ann-title",children:c.title}),t.jsx("span",{className:"fd-ann-message",children:c.message})]},i))}),n.logAvailable?t.jsx(Ql,{repo:e,job:n}):t.jsx("p",{className:"fd-log-bar",children:t.jsx(Ee,{href:n.webUrl,children:"Open the job"})})]})]})}function Ql({repo:e,job:n}){const{api:s,scope:r,refresh:a}=G(),[l,c]=d.useState(null),i=fe(s,r,l?"job-log":null,{repo:e,id:n.id,lines:l},a),u=d.useRef(null);i.data&&(u.current=i.data);const o=i.data??(l?u.current:null),b=d.useRef(null),h=d.useRef(0);d.useLayoutEffect(()=>{const g=b.current;g&&(g.scrollTop=g.scrollHeight-g.clientHeight-h.current),h.current=0},[o]);const m=d.useRef(!1);d.useEffect(()=>{m.current=i.loading},[i.loading,o,i.error]);const f=ll(l),x=()=>{if(!Ze(m.current))return;m.current=!0;const g=b.current;h.current=g?g.scrollHeight-g.clientHeight-g.scrollTop:0,c(f)},p=(o==null?void 0:o.webUrl)??n.webUrl;return l?t.jsxs("div",{className:"fd-log-wrap",children:[t.jsxs("p",{className:"fd-log-bar",children:[t.jsx("span",{className:"fd-log-count",children:o?o.truncated?`Last ${o.lines.length.toLocaleString()} lines`:`All ${o.lines.length.toLocaleString()} lines`:"Log"}),(o==null?void 0:o.truncated)&&f&&t.jsx("button",{type:"button",className:"btn",onClick:x,...et(i.loading),children:i.loading?"Loading…":"Show more lines"}),t.jsx(Ee,{href:p,children:"Full log"})]}),i.error&&(o?t.jsx(J,{error:i.error,onRetry:i.reload,compact:!0}):t.jsx(J,{error:i.error,onRetry:i.reload})),!o&&!i.error&&t.jsx(de,{rows:3,label:"Loading the log"}),o&&(o.lines.length?t.jsx("pre",{ref:b,className:"fd-log",tabIndex:0,role:"region","aria-label":`${n.name} log`,children:o.lines.map((g,j)=>{const $=ol(g);return t.jsx("span",{className:"fd-log-line","data-tone":$??void 0,children:g||" "},j)})}):t.jsx("p",{className:"fd-none",children:"The log is empty."}))]}):t.jsxs("p",{className:"fd-log-bar",children:[t.jsx("button",{type:"button",className:"btn",onClick:()=>c(St[0]),children:"Show log"}),t.jsx(Ee,{href:p,children:"Full log"})]})}function Yl({selection:e}){const{kind:n,api:s,scope:r,refresh:a}=G(),l=ut(),c=z[n],i=fe(s,r,"pipeline",{repo:e.repo,id:e.id},a),u=i.data;return t.jsxs(dt,{label:`${c.pipeline} #${e.id}`,children:[t.jsx(Ke,{...l,reference:`${e.repo} #${e.id}`,copyValue:e.id,copyLabel:`${c.pipeline.toLowerCase()} id`,href:(u==null?void 0:u.webUrl)??null}),t.jsx(ht,{data:u,loading:i.loading,error:i.error,onRetry:i.reload,what:c.pipeline.toLowerCase()}),u&&t.jsxs(t.Fragment,{children:[i.error&&t.jsx(J,{error:i.error,onRetry:i.reload,compact:!0}),t.jsx(Zl,{pipeline:u}),t.jsxs("section",{className:"fd-block",children:[t.jsx(qe,{count:u.jobs.length,children:"Jobs"}),t.jsx(Jl,{repo:u.repo,jobs:u.jobs})]})]})]})}function Zl({pipeline:e}){const{kind:n,select:s}=G(),r=z[n],a=zn(e.ref),l=ze(e.durationSec),c=Qa(e.source);return t.jsxs("header",{className:"fd-head",children:[t.jsx("h2",{className:"fd-title",children:e.title||`${r.pipeline} #${e.id}`}),t.jsxs("p",{className:"fd-byline",children:[t.jsx(we,{mark:ie(e.state)}),e.triggeredBy&&t.jsxs(t.Fragment,{children:[t.jsx("span",{children:"Started by"}),t.jsx(Te,{user:e.triggeredBy,size:18})]}),c&&t.jsxs("span",{className:"fd-when",children:["· ",c]}),e.createdAt!=null&&t.jsxs("span",{className:"fd-when",children:["· created ",t.jsx(ee,{at:e.createdAt})]}),l?t.jsxs("span",{className:"fd-when",children:["· took ",l]}):e.state==="running"&&e.startedAt!=null&&t.jsxs("span",{className:"fd-when",children:["· started ",t.jsx(ee,{at:e.startedAt})]})]}),t.jsxs("ul",{className:"fd-status",children:[t.jsxs("li",{className:"fd-status-line",children:[t.jsx("span",{className:"fd-status-key",children:"Ran on"}),t.jsx(ve,{value:e.ref,label:"ref",children:t.jsx("code",{className:"fd-branch",title:e.ref,children:Vn(n,e.ref)})}),t.jsx(ve,{value:e.sha,label:"commit sha",children:t.jsx("code",{children:e.shortSha})})]}),a!=null&&t.jsx("li",{children:t.jsxs("button",{type:"button",className:"fd-jump",onClick:()=>s({type:"change",repo:e.repo,number:a}),children:[t.jsx(te,{mark:{mark:"linked",word:r.change,tone:"idle"},quiet:!0}),t.jsxs("span",{children:[r.change," ",t.jsx("code",{children:Gn(n,"",a)})]}),t.jsx("span",{className:"fd-jump-arrow","aria-hidden":"true",children:"›"})]})})]})]})}function eo({selection:e}){const{api:n,scope:s,refresh:r}=G(),a=ut(),l=fe(n,s,"issue",{repo:e.repo,number:e.number},r),c=l.data,i=(c==null?void 0:c.key)??`${e.repo}#${e.number}`;return t.jsxs(dt,{label:`Issue ${i}`,children:[t.jsx(Ke,{...a,reference:i,copyLabel:"reference",href:(c==null?void 0:c.webUrl)??null}),t.jsx(ht,{data:c,loading:l.loading,error:l.error,onRetry:l.reload,what:"issue"}),c&&t.jsxs(t.Fragment,{children:[l.error&&t.jsx(J,{error:l.error,onRetry:l.reload,compact:!0}),t.jsx(to,{selection:e,issue:c})]})]})}function to({selection:e,issue:n}){const{select:s}=G(),r=We(n.titleHtml,!0),a=We(n.descriptionHtml);return t.jsxs(t.Fragment,{children:[t.jsxs("header",{className:"fd-head",children:[t.jsx("h2",{className:"fd-title",children:r.length?Re(r):n.title}),t.jsxs("p",{className:"fd-byline",children:[t.jsx(we,{mark:Xa(n.state,n.stateReason)}),t.jsxs("span",{children:[t.jsxs("code",{children:["#",n.number]})," opened"]}),n.createdAt!=null&&t.jsx(ee,{at:n.createdAt}),n.author&&t.jsxs(t.Fragment,{children:[t.jsx("span",{children:"by"}),t.jsx(Te,{user:n.author,size:18})]}),n.state==="closed"&&n.closedAt!=null&&t.jsxs("span",{className:"fd-when",children:["· closed ",t.jsx(ee,{at:n.closedAt})]})]})]}),t.jsxs("div",{className:"fd-layout",children:[t.jsxs(ns,{label:"About this issue",children:[t.jsx(je,{label:n.assignees.length>1?"Assignees":"Assignee",children:t.jsx(At,{users:n.assignees})}),n.labels.length>0&&t.jsx(je,{label:"Labels",children:t.jsx(ss,{labels:n.labels})}),n.milestone&&t.jsx(je,{label:"Milestone",children:n.milestone.webUrl?t.jsx("a",{className:"fd-plain-link",href:n.milestone.webUrl,target:"_blank",rel:"noreferrer noopener",children:n.milestone.title}):n.milestone.title}),n.parent&&t.jsx(je,{label:"Parent",children:t.jsx(so,{item:n.parent,onOpen:()=>s({type:"issue",repo:n.parent.repo,number:n.parent.number})})})]}),t.jsxs("div",{className:"fd-main",children:[a.length?t.jsx(Ut,{className:"fd-description",nodes:a}):t.jsx("p",{className:"fd-none fd-description",children:"No description."}),n.childItems.length>0&&t.jsxs("section",{className:"fd-block",children:[t.jsx(qe,{count:n.childItems.length,aside:n.children&&t.jsxs("span",{className:"fd-progress",children:[n.children.completed," of ",n.children.total," done"]}),children:"Child items"}),t.jsx("ul",{className:"fg-rows fd-rows",children:n.childItems.map(l=>t.jsx("li",{children:t.jsx(no,{item:l,onOpen:()=>s({type:"issue",repo:l.repo,number:l.number})})},l.key))})]}),t.jsx(ro,{selection:e,count:n.comments})]})]})]})}function as(e){return e==="open"?{mark:"open",word:"open",tone:"busy"}:{mark:"done",word:"closed",tone:"ok"}}function no({item:e,onOpen:n}){const{selected:s}=G(),r=(s==null?void 0:s.type)==="issue"&&s.repo===e.repo&&s.number===e.number;return t.jsxs("button",{type:"button",className:"fg-row fd-child-row ig-row",onClick:n,"aria-current":r||void 0,"data-selected":r||void 0,children:[t.jsx(te,{mark:as(e.state)}),t.jsx("span",{className:"fd-child-title",children:e.title}),t.jsxs("span",{className:"fd-child-meta",children:[e.type&&t.jsx("span",{children:e.type}),t.jsxs("code",{children:["#",e.number]})]})]})}function so({item:e,onOpen:n}){return t.jsxs("button",{type:"button",className:"fd-jump",onClick:n,children:[t.jsx(te,{mark:as(e.state),quiet:!0}),t.jsx("span",{className:"fd-jump-title",children:e.title}),t.jsx("span",{className:"fd-jump-arrow","aria-hidden":"true",children:"›"})]})}function ro({selection:e,count:n}){const[s,r]=d.useState(!1);return n?t.jsxs("section",{className:"fd-block",children:[t.jsx(qe,{count:n,children:"Comments"}),s?t.jsx(ao,{selection:e}):t.jsxs("button",{type:"button",className:"btn fd-show-comments",onClick:()=>r(!0),children:["Show ",n.toLocaleString()," comment",n===1?"":"s"]})]}):t.jsxs("section",{className:"fd-block",children:[t.jsx(qe,{count:0,children:"Comments"}),t.jsx("p",{className:"fd-none",children:"No comments."})]})}function ao({selection:e}){const{api:n,scope:s,refresh:r}=G(),a=be(n,s,"issue/comments",{repo:e.repo,number:e.number},r);return a.data?t.jsxs(t.Fragment,{children:[a.error&&t.jsx(J,{error:a.error,onRetry:a.reload,compact:!0}),a.data.items.length?t.jsx("ol",{className:"fd-threads fd-issue-comments",children:a.data.items.map(l=>t.jsx("li",{className:"fd-thread",children:t.jsx("ol",{className:"fd-comments",children:t.jsx(rs,{comment:l})})},l.id))}):t.jsx("p",{className:"fd-none",children:"No comments."}),t.jsx(ye,{pages:a,label:"Load more comments"})]}):a.error?t.jsx(J,{error:a.error,onRetry:a.reload}):t.jsx(de,{rows:3,label:"Loading comments"})}const Oe=["branches","changes","pipelines","issues"];function ls(e,n){switch(n){case"branches":return"Branches";case"changes":return z[e].changes;case"pipelines":return z[e].pipelines;case"issues":return"Issues"}}function lo(e,n){const s=ls(e,n);return`Back to ${s==="Actions"?s:s.toLowerCase()}`}function os({kind:e,connection:n,api:s,assetUrl:r,prefs:a,narrow:l,onReconnect:c,Split:i}){const u=`${e}:${n.id}`,[o,b]=d.useState(()=>an(a)),[h,m]=d.useState(0),[f,x]=d.useState(null),[p,g]=d.useState(""),[j,$]=d.useState({loadedAt:null,loading:!1,stale:!1}),[y,A]=d.useState(!1),_=d.useRef(!1),[N,D]=d.useState(null),I=d.useRef(null),L=d.useRef(null),M=d.useRef(null);ua(M);const S=d.useRef(null),v=d.useId(),O=w=>`${v}-tab-${w}`,F=w=>`${v}-panel-${w}`;d.useEffect(()=>{b(an(a)),x(null),g("")},[u,a]);const T=d.useCallback(w=>{b(P=>{const W={...P,...w};return ln(a,W),W})},[a]),U=d.useCallback(w=>{b(P=>{const W=P.open.includes(w)?P.open.filter(K=>K!==w):[...P.open,w].slice(-20),V={...P,open:W};return ln(a,V),V})},[a]),B=d.useCallback(w=>{const P=document.activeElement,W=P instanceof HTMLElement&&P.closest(".ig-list")!=null;w&&W&&(S.current=P),x(w);const V=na(w!=null,W,l);requestAnimationFrame(()=>{var K,Z,ae;V==="opener"&&((K=S.current)!=null&&K.isConnected)?S.current.focus():V==="page"&&((ae=(Z=I.current)==null?void 0:Z.querySelector(".ig-detail .fd"))==null||ae.focus())})},[l]),X=d.useMemo(()=>({kind:e,connection:n,scope:u,api:s,asset:w=>r(w),refresh:h,selected:f,select:B,isOpen:w=>o.open.includes(w),toggle:U,reportFreshness:$,onReconnect:c,narrow:l}),[e,n,u,s,r,h,f,B,o.open,U,c,l]),se=la(e,o.tab),le=!se&&!o.repo,ne=fe(s,u,le?"repos":null,{},h);d.useEffect(()=>{var P;const w=(P=ne.data)==null?void 0:P.items[0];le&&w&&T({repo:w.path})},[le,ne.data,T]);const E=async()=>{if(Ze(_.current)){_.current=!0,A(!0),D(null);try{const w=await Ot(s,Qe("resolve",{q:p.trim()}));w?B(w.type==="change"?{type:"change",repo:w.repo,number:w.number}:{type:"issue",repo:w.repo,number:w.number}):D("Nothing to open at that address.")}catch(w){D(w instanceof Ue?w.info.message:"Could not open it.")}finally{_.current=!1,A(!1)}}},Ne=w=>{T({tab:w}),g("")};ha(L,o.tab);const ce=z[e],k={view:o,setView:T,query:p},C=t.jsxs("div",{ref:M,className:"fg-list",children:[t.jsxs("div",{className:"fg-toolbar",children:[t.jsx(Aa,{value:o.repo,allowAll:se,onChange:w=>T({repo:w})}),t.jsx(Ln,{loadedAt:j.loadedAt,loading:j.loading,stale:j.stale,onRefresh:()=>m(w=>w+1),label:`Refresh ${ce.name}`})]}),t.jsx("div",{ref:L,className:"uh-range fg-tabs",role:"tablist","aria-label":`${ce.name} views`,onKeyDown:w=>{var W;const P=kn(w,Oe.indexOf(o.tab),Oe.length);P.kind!=="pass"&&(w.preventDefault(),w.stopPropagation(),Ne(Oe[P.index]),(W=w.currentTarget.querySelectorAll("[role=tab]")[P.index])==null||W.focus())},children:Oe.map(w=>t.jsx("button",{id:O(w),type:"button",role:"tab",className:"uh-range-btn","aria-selected":o.tab===w,"aria-controls":F(w),tabIndex:o.tab===w?0:-1,onClick:()=>Ne(w),children:ls(e,w)},w))}),t.jsxs("div",{className:"fg-searchbar",children:[t.jsx(Ft,{value:p,onChange:w=>{g(w),D(null)},label:o.tab==="branches"?"Filter by branch name":`Search by title or number, or paste a ${ce.name} link`,placeholder:o.tab==="branches"?"Filter by branch name":l?`Search, or paste a ${ce.name} link`:`Search by title or number, or paste a ${ce.name} link`,onKeyDown:w=>{w.key==="Enter"&&rn(p)&&E()}}),rn(p)&&t.jsx("button",{type:"button",className:"btn fg-resolve",onClick:()=>void E(),...et(y),children:y?"Opening…":"Open"})]}),N&&t.jsx("p",{className:"fg-note",role:"status",children:N}),Oe.map(w=>t.jsx("div",{className:"fg-tab-body",id:F(w),role:"tabpanel","aria-labelledby":O(w),hidden:o.tab!==w,children:o.tab!==w?null:le?ne.error?t.jsx(J,{error:ne.error,onRetry:ne.reload}):ne.data&&!ne.data.items.length?t.jsxs("p",{className:"fg-empty",children:["This token can see no ",ce.repo.toLowerCase()," yet."]}):t.jsxs("p",{className:"fg-note",children:["Finding your most recent ",ce.repo.toLowerCase(),"…"]}):w==="branches"?t.jsx(Da,{...k}):w==="changes"?t.jsx(ul,{...k}):w==="pipelines"?t.jsx(xl,{...k}):t.jsx(kl,{...k})},w))]}),q=f?f.type==="change"?t.jsx(Bl,{selection:f},`${f.repo}!${f.number}`):f.type==="branch"?t.jsx(zl,{selection:f},`${f.repo}@${f.name}`):f.type==="pipeline"?t.jsx(Yl,{selection:f},`${f.repo}/p/${f.id}`):t.jsx(eo,{selection:f},`${f.repo}#${f.number}`):null;return t.jsx(oa,{value:X,children:t.jsx("div",{ref:I,className:"fg-panel","data-kind":e,children:t.jsx(i,{list:C,detail:q,onBack:()=>B(null),backLabel:lo(e,o.tab),storageKey:e,detailKey:f?ia(f):void 0})})})}function oo(e){return t.jsx(os,{kind:"github",...e,Split:Mt})}function io(e){return t.jsx(os,{kind:"gitlab",...e,Split:Mt})}const co={jira:Kr,github:oo,gitlab:io};function ho({kind:e,connections:n,onClose:s,onReconnect:r}){const a=Ss(e),l=co[e],c=d.useId(),i=$n(),[u]=d.useState(()=>document.activeElement instanceof HTMLElement?document.activeElement:null),[o,b]=d.useState(!1),h=d.useRef(!1),m=d.useRef(s);m.current=s;const f=d.useCallback(()=>{h.current||(h.current=!0,m.current())},[]),x=d.useCallback(()=>{var S,v;if(o||h.current)return;const M=Array.from(document.querySelectorAll(`[data-rail-item="integration-${e}"], [data-rail-item="more"]`)).find(O=>{var F;return((F=O.checkVisibility)==null?void 0:F.call(O))??!0});(v=u&&u!==document.body&&u.isConnected&&(((S=u.checkVisibility)==null?void 0:S.call(u))??!0)?u:M)==null||v.focus({preventScroll:!0}),gn()?f():b(!0)},[o,u,e,f]);d.useEffect(()=>{if(!o)return;const M=window.setTimeout(f,200);return()=>window.clearTimeout(M)},[o,f]);const p=d.useRef(null),g=d.useMemo(()=>({get current(){const M=p.current;return M?Array.from(M.querySelectorAll(gs)).find(S=>js({disabled:S.disabled,tabIndex:S.tabIndex,rendered:S.checkVisibility?S.checkVisibility():S.getClientRects().length>0}))??null:null}}),[]),j=xs(x,{focusRef:g}),$=bs(x);d.useLayoutEffect(()=>{j.current&&(j.current.inert=o)},[o,j]),ys(e);const[y,A]=d.useState(()=>{var S;const M=Ns(e);return n.some(v=>v.id===M)?M:((S=n[0])==null?void 0:S.id)??""});d.useEffect(()=>{if(n.length===0){s();return}n.some(M=>M.id===y)||A(n[0].id)},[n,y,s]);const _=M=>{A(M),Cs(e,M)},N=n.find(M=>M.id===y)??null,D=(N==null?void 0:N.id)??"",I=d.useMemo(()=>D?{api:vs({kind:e,id:D}),assetUrl:ws({kind:e,id:D}),prefs:ks(e,D)}:null,[e,D]);if(!a||!l||!N||!I)return null;const{Glyph:L}=a;return $s.createPortal(t.jsx("div",{className:"modal-backdrop",role:"presentation",...$,children:t.jsxs("div",{ref:j,id:`integration-${e}-modal`,className:"modal ig-modal",role:"dialog","aria-modal":"true","aria-labelledby":"integration-modal-title","data-kind":e,"data-closing":o||void 0,onClick:M=>M.stopPropagation(),onAnimationEnd:M=>{o&&M.target===M.currentTarget&&f()},children:[t.jsxs("div",{className:"ig-head",children:[t.jsxs("h2",{className:"ig-title",id:"integration-modal-title",children:[t.jsx("span",{className:"ig-title-glyph","aria-hidden":!0,children:t.jsx(L,{})}),a.label]}),n.length>1?t.jsxs("label",{className:"ig-conn-select",children:[t.jsx("span",{className:"vis-hidden",children:"Connection"}),t.jsx("select",{id:c,className:"sm-select",value:N.id,onChange:M=>_(M.target.value),children:n.map(M=>t.jsxs("option",{value:M.id,children:[M.name,M.name!==_e(M)?` · ${_e(M)}`:""]},M.id))})]}):t.jsx("span",{className:"ig-conn-name",title:N.baseUrl,children:N.name}),t.jsx("button",{type:"button",className:"glyph-btn ig-close",onClick:x,"aria-label":`Close ${a.label}`,title:"Close (Esc)",children:"×"})]}),t.jsx("div",{ref:p,className:"ig-body",children:t.jsx(l,{connection:N,connections:n,api:I.api,assetUrl:I.assetUrl,prefs:I.prefs,narrow:i,onReconnect:()=>{x(),r(N.id)}},N.id)})]})}),document.body)}export{ho as default};