ccdeck 3.48.1 → 3.49.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.
@@ -1,4 +1,4 @@
1
- import{r as Dr,a as Ir,w as Fr,b as i,p as As,m as Ls,j as t,u as Br,f as Or,I as Yt,c as Pr,q as Ur,R as _r,s as we,d as Ce,e as Es,i as Kr,A as nn,H as Hr,g as jt,E as xt,h as Wr,t as qr,k as Ms,T as Gr,l as Vr,n as zr,o as Jr,v as Xr,x as Qr,y as Yr,z as Zr,B as ea,C as ta,D as na,F as sa}from"./app-BFaxhiED.js";const Re={min:320,max:1600},Bt=.5;function Ts(e){return Number.isFinite(e)&&e>0&&e<1?e:Bt}function Ds(e=Bt){return`clamp(${Re.min}px, ${Ts(e)*100}%, ${Re.max}px)`}const ra=420,aa=8,oa="(max-width: 899px)",Sn=e=>`agent-dag.integrations.${e}.detail-width`;function At(e,n){const s=Math.max(Re.min,Math.min(Re.max,n-ra-aa));return Math.round(Math.min(s,Math.max(Re.min,Number.isFinite(e)?e:n*Bt)))}function Yn(e,n=Bt){return At(e*Ts(n),e)}function la(e){const n=Dr(Sn(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 ia(e,n){n==null?Ir(Sn(e)):Fr(Sn(e),String(Math.round(n)))}function ca({width:e,workspace:n,controls:s,onCommit:r,automaticDetailShare:a}){const o=i.useRef(null),d=i.useRef(null),l=()=>{var x;return((x=n.current)==null?void 0:x.clientWidth)??window.innerWidth},c=e==null?Yn(l(),a):At(e,l()),u=x=>{var m,k;(m=n.current)==null||m.style.setProperty("--ig-detail-w",`${x}px`),(k=o.current)==null||k.setAttribute("aria-valuenow",String(x))},j=x=>{var m,k;x==null?((m=n.current)==null||m.style.setProperty("--ig-detail-w",Ds(a)),(k=o.current)==null||k.setAttribute("aria-valuenow",String(Yn(l(),a)))):u(x),r(x)},h=x=>{var m;x.button===0&&(x.preventDefault(),x.currentTarget.setPointerCapture(x.pointerId),d.current={x:x.clientX,width:c,room:l(),last:c},(m=n.current)==null||m.setAttribute("data-resizing",""))},f=x=>{const m=d.current;m&&(m.last=At(m.width+m.x-x.clientX,m.room),u(m.last))},g=()=>{var m;const x=d.current;x&&(d.current=null,(m=n.current)==null||m.removeAttribute("data-resizing"),j(x.last))},y=x=>{const m=x.shiftKey?64:16;if(x.key==="Enter"){x.preventDefault(),j(null);return}const k=x.key==="ArrowLeft"?c+m:x.key==="ArrowRight"?c-m:x.key==="Home"?Re.min:x.key==="End"?Re.max:null;k!==null&&(x.preventDefault(),j(At(k,l())))};return t.jsx("div",{ref:o,className:"ig-splitter",role:"separator","aria-orientation":"vertical","aria-label":"Detail width","aria-controls":s,"aria-valuemin":Re.min,"aria-valuemax":At(Re.max,l()),"aria-valuenow":c,tabIndex:0,title:"Drag to resize · double-click for the automatic width",onPointerDown:h,onPointerMove:f,onPointerUp:g,onPointerCancel:g,onLostPointerCapture:g,onDoubleClick:()=>j(null),onKeyDown:y})}function Is(){return Br(oa)}function _n({list:e,detail:n,onBack:s,backLabel:r,storageKey:a,detailKey:o,automaticDetailShare:d=Bt}){const l=Is(),c=`${i.useId()}-detail`,u=i.useRef(null),j=i.useRef(null),h=i.useRef(null),f=i.useRef(null),[g,y]=i.useState(()=>la(a)),x=w=>{y(w),ia(a,w)},m=n!=null,k=i.useRef(null);m&&(k.current=n);const[p,T]=i.useState(m),[L,R]=i.useState(null);p!==m&&(T(m),R(!m&&l&&!As()?k.current:null));const v=m?n:L,S=!m&&L!=null;i.useEffect(()=>{if(!S)return;const w=window.setTimeout(()=>R(null),200);return()=>window.clearTimeout(w)},[S]),i.useLayoutEffect(()=>{h.current&&(h.current.inert=S)},[S]),i.useLayoutEffect(()=>{const w=h.current;!w||!m||(w.dataset.flip=w.dataset.flip==="a"?"b":"a")},[m,o]);const F=i.useRef(null);i.useLayoutEffect(()=>{var $,I,B,C;if(!m)return;const w=document.activeElement;w instanceof HTMLElement&&(($=j.current)!=null&&$.contains(w))&&(F.current=w);const E=w instanceof HTMLElement&&!(((I=w.checkVisibility)==null?void 0:I.call(w))??!0);l&&(!w||w===document.body||E||(B=j.current)!=null&&B.contains(w))&&((C=f.current)==null||C.focus({preventScroll:!0}))},[m,l,o]),i.useEffect(()=>{if(m)return;const w=F.current;if(!w)return;const E=requestAnimationFrame(()=>{var I;const $=document.activeElement;(!$||$===document.body)&&w.isConnected&&(((I=w.checkVisibility)==null?void 0:I.call(w))??!0)&&w.focus({preventScroll:!0})});return()=>cancelAnimationFrame(E)},[m]);const K=i.useRef(s);return K.current=s,i.useEffect(()=>{if(m)return Ls.push(()=>K.current(),0,"popover")},[m]),t.jsxs("div",{ref:u,className:"ig-split","data-detail":m||void 0,"data-drill-in":l||void 0,style:{"--ig-detail-w":g==null?Ds(d):`${g}px`},children:[t.jsx("div",{ref:j,className:"ig-list",hidden:l&&m||void 0,children:e}),m&&!l&&t.jsx(ca,{width:g,workspace:u,controls:c,onCommit:x,automaticDetailShare:d}),v!=null&&t.jsxs("section",{ref:h,className:"ig-detail",id:c,"aria-label":"Details","data-leaving":S||void 0,onAnimationEnd:w=>{S&&w.target===w.currentTarget&&R(null)},children:[l&&t.jsxs("button",{ref:f,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]}),v]})]})}const Fs=e=>e.issueKeys??[e.issueKey];function da(e,n,s,r,a){if(!n.includes(s))return new Set(e);if(a==="replace")return new Set([s]);if(a==="toggle"){const c=new Set(e);return c.has(s)?c.delete(s):c.add(s),c}const o=r?n.indexOf(r):-1,d=n.indexOf(s),l=o<0?[s]:n.slice(Math.min(o,d),Math.max(o,d)+1);return new Set([...a==="add-range"?e:[],...l])}function Tt(e){return e.kind==="backlog"?{kind:"backlog"}:(e.kind==="active"||e.kind==="future")&&e.sprint&&(e.sprint.state==="active"||e.sprint.state==="future")?{kind:"sprint",sprintId:e.sprint.id}:null}function zt(e,n){return Qe({issue:e,group:n})===null}function Qe({issue:e,group:n}){return e.type.subtask?"is a subtask":e.type.epic?"is an epic":e.status.category==="done"?`is ${e.status.name}`:n.kind==="closed"?"is in a closed sprint":Tt(n)?null:"is not in an active/future sprint or the backlog"}function Jt(e){const n=e.filter(s=>Qe(s));return n.length?`${n.slice(0,2).map(s=>`${s.issue.key} ${Qe(s)}`).join("; ")}${n.length>2?`; ${n.length-2} more blocked`:""}. Remove blocked issues to move the rest.`:e.length>50?"Move up to 50 issues at a time.":""}function Cn(e,n,s){const r=Tt(n),a=e.map(o=>o.issue.key);return!e.length||e.length>50||new Set(a).size!==a.length||!r||e.some(o=>!zt(o.issue,o.group))||s&&a.includes(s.key)||e.every(o=>o.group.id===n.id)&&!s?null:{...a.length===1?{issueKey:a[0]}:{issueKeys:a},target:r,...s?s.side==="before"?{beforeIssue:s.key}:{afterIssue:s.key}:{}}}async function ua(e,n,s){var o;const r=new AbortController,a=window.setTimeout(()=>r.abort(),45e3);try{const d=await e(`board/${encodeURIComponent(n)}/move`,{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify(s),signal:r.signal}),l=(o=d.body)==null?void 0:o.getReader(),c=()=>{l==null||l.cancel().catch(()=>{})};r.signal.addEventListener("abort",c,{once:!0});let u="";try{const g=new TextDecoder;let y=0;for(;l&&!r.signal.aborted;){const x=await l.read();if(x.done)break;if(y+=x.value.byteLength,y>16384)throw new Error("Result too large");u+=g.decode(x.value,{stream:!0})}if(u+=g.decode(),r.signal.aborted)throw new Error("Deadline exceeded")}finally{r.signal.removeEventListener("abort",c),await(l==null?void 0:l.cancel().catch(()=>{}))}if(!d.ok)throw await Or(new Response(u,{status:d.status}));if(d.status===204)return{};const j=JSON.parse(u),h=Fs(s),f=j&&typeof j=="object"&&(s.issueKeys?"issueKeys"in j&&Array.isArray(j.issueKeys)&&j.issueKeys.length===h.length&&j.issueKeys.every((g,y)=>g===h[y]):"issueKey"in j&&j.issueKey===s.issueKey);if(!j||typeof j!="object"||Array.isArray(j)||!("ok"in j)||j.ok!==!0||!f||"notice"in j&&(typeof j.notice!="string"||j.notice.length>1e3))throw new Error("Unconfirmed result");return"notice"in j?{notice:j.notice}:{}}catch(d){throw d instanceof Yt?d:new Yt("network","The move could not be confirmed. Refresh the board before trying again.")}finally{window.clearTimeout(a)}}const Nt=(e,n,s={},r)=>Pr(e,`${n}${Ur(s)}`,{signal:r}),Bs=(e,n,s,r)=>Nt(e,"boards",{startAt:n||void 0,name:s},r),ha=(e,n,s)=>Nt(e,`board/${encodeURIComponent(n)}`,{},s),fa=(e,n,s,r)=>Nt(e,`board/${encodeURIComponent(n)}/closed-sprints`,{startAt:s||void 0},r),Zn=(e,n,s,r)=>Nt(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),ma=(e,n,s)=>Nt(e,`issue/${encodeURIComponent(n)}/subtasks`,{},s),pa=(e,n,s)=>Nt(e,`issue/${encodeURIComponent(n)}`,{},s);function ga(e,n,s){var l;let r;try{r=new URL(s)}catch{return null}const a=typeof((l=e.meta)==null?void 0:l.apiBase)=="string"?e.meta.apiBase:"";let o="";try{o=new URL(e.baseUrl).origin}catch{}if(a&&r.origin===o&&/^\/(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 d=r.protocol==="http:"&&/^(localhost|127\.0\.0\.1|\[::1\])$/.test(r.hostname)&&e.allowedOrigins.includes(r.origin);return r.protocol!=="https:"&&!d?null:n(r.href)}const xn=e=>`sprint:${e.id}`;function es(e,n=[]){const s=[];if(e.hasSprints){for(const r of e.sprints.active)s.push({id:xn(r),kind:"active",title:r.name,sprint:r,defaultOpen:!0,paged:!1});for(const r of e.sprints.future)s.push({id:xn(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:xn(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 Lt(e,n){return Object.hasOwn(n,e.id)?n[e.id]:e.defaultOpen}const Ye=e=>e.kind==="issue"?e.issue.key:e.parent.key;function ja(e,n=new Set){const s=new Map;for(const o of e)!n.has(o.key)&&!s.has(o.key)&&s.set(o.key,o);const r=[],a=new Map;for(const o of s.values()){const d=o.type.subtask&&o.parent?o.parent.key:null;if(d&&d!==o.key){let c=a.get(d);if(!c){const u=s.get(d);u&&!n.has(d)?c={kind:"issue",issue:u,matched:[]}:(c={kind:"context",parent:o.parent,matched:[]},r.push(c)),a.set(d,c)}c.matched.push(o);continue}let l=a.get(o.key);l||(l={kind:"issue",issue:o,matched:[]},a.set(o.key,l)),r.push(l)}for(const o of s.keys())n.add(o);return r}const Zt=e=>e.status.category==="done";function Kn(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 xa(e){return!Zt(e)&&(e.flagged||e.priority!=null&&Kn(e.priority.name)==="highest")}function ba(e){var s;const n=((s=e.resolution)==null?void 0:s.trim())??"";return n&&n.toLowerCase()!==e.status.name.trim().toLowerCase()?n:null}function ya({handedOff:e,narrow:n,focusLost:s,focusOnBack:r}){return s?e||n:n&&r}function Os(e,n){return(!n.hideDone||!Zt(e))&&(!n.attention||xa(e))}const ka=/^only my issues$/i;function wa(e){return e.filter(n=>!ka.test(n.name.trim()))}function Na(e,n){return n?e.key.toLowerCase().includes(n)||e.summary.toLowerCase().includes(n):!0}function va(e,n,s){const r=n.search.trim().toLowerCase();if(!r&&!n.hideDone&&!n.attention)return e.slice();const a=d=>Os(d,n)&&Na(d,r),o=[];for(const d of e){const l=d.matched.filter(a),c=(s==null?void 0:s(Ye(d)))??[],u=l.length>0||c.some(a);d.kind==="issue"?(a(d.issue)||u)&&o.push({...d,matched:l}):u&&o.push({...d,matched:l})}return o}function Ps(e,n,s,r){const a=new Set;return e.map(o=>{const d=n[o.id];return{def:o,data:d,rows:va(ja((d==null?void 0:d.issues)??[],a),r,s)}})}function Rn(e,n){return n[Ye(e)]??e.kind==="context"}function An(e,n,s){return(n==null?void 0:n.status)==="ready"?n.issues.filter(r=>Os(r,s)):e.matched}function Us(e,n){if(e.kind==="context")return!0;const s=e.issue.subtaskKeys;return s.length===0?!1:n||!s.every(r=>e.matched.some(a=>a.key===r))}function $a(e,n,s,r,a,o){const d=new Set;let l=!0,c=null;for(const{def:u,data:j,rows:h}of e)if(Lt(u,n)){if(!j||j.status!=="ready"&&j.status!=="error"&&j.issues.length===0){l=!1;continue}c==null&&l&&h.length>0&&(c=Ye(h[0]));for(const f of h){const g=Ye(f);if(d.add(g),!Rn(f,s))continue;const y=r[g];for(const x of An(f,y,a))d.add(x.key);(y?y.status==="loading":Us(f,o))&&(l=!1)}}return{complete:l,keys:d,first:c}}function Sa(e){return e.flatMap(n=>n.kind==="issue"?[n.issue]:n.matched)}function Ca(e,n){const s=Sa(e),r={new:0,indeterminate:0,done:0},a=new Map;let o=0,d=0,l=null,c=0,u=0;for(const h of s){const f=n==="count"?1:n==="points"?h.points??0:h.estimate??0;if(r[h.status.category]+=f,h.assignee){const g=a.get(h.assignee.id);g?g.n++:a.set(h.assignee.id,{person:h.assignee,n:1})}h.mine&&(o++,h.assignee&&(l=h.assignee.id),Zt(h)&&d++),Zt(h)||(h.flagged&&c++,h.priority&&Kn(h.priority.name)==="highest"&&u++)}const j=[...a.values()].sort((h,f)=>f.n-h.n||h.person.name.localeCompare(f.person.name)).map(h=>h.person);return{count:s.length,totals:r,assignees:j,mine:o,mineDone:d,youId:l,flagged:c,highest:u}}function pt(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),o=Math.round(a*n.daysPerWeek),d=[];for(const[l,c]of[[o,"w"],[a,"d"],[r,"h"],[1,"m"]]){if(l<=0)continue;const u=Math.floor(s/l);u>0&&(d.push(`${u}${c}`),s-=u*l)}return d.join(" ")}function ts(e,n,s){return n==="time"?pt(e,s)||"0m":n==="points"?`${Number.isInteger(e)?e:e.toFixed(1)}`:String(e)}function ns(e){if(!e)return"";const n=new Date(e);return Number.isNaN(n.getTime())?"":n.toLocaleDateString(void 0,{day:"numeric",month:"short"})}function Ra(e,n){const s=pt(e.estimate,n),r=pt(e.timeSpent,n),a=e.remaining!=null&&(e.remaining!==e.estimate||r)?pt(e.remaining,n):"";return[s&&`${s} estimated`,a&&`${a} left`,r&&`${r} logged`].filter(Boolean).join(" · ")}function St(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 Aa(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 La=120,at=new Map,Ln=new Map,Ea=()=>({selection:null,closed:!1,listTop:0,detailTop:0,rows:{},section:null});function _s(e,...n){return[e,...n.map(s=>s??"*")].join("|")}function Dt(e){return at.get(e)??null}function ot(e,n){const s={...at.get(e)??Ea(),...n};for(at.delete(e),at.set(e,s);at.size>La;)at.delete(at.keys().next().value)}function En(e){return Ln.get(e)??""}function Ks(e,n){n?Ln.set(e,n):Ln.delete(e)}function Ma(e,n,s){if(e!=null&&e.closed)return{kind:"none",listTop:e.listTop};if((e==null?void 0:e.selection)!=null){if(n.has(e.selection))return{kind:"restore",selection:e.selection,listTop:e.listTop,detailTop:e.detailTop};if(!n.complete)return{kind:"wait"}}return s?n.first!=null?{kind:"first",selection:n.first}:{kind:"wait"}:{kind:"none",listTop:(e==null?void 0:e.selection)!=null?0:(e==null?void 0:e.listTop)??0}}function ss(e,n){const s=Dt(e);return s!=null&&s.closed?{key:e,selection:null,auto:!1,settled:!0,plan:{list:s.listTop,detail:null}}:{key:e,selection:null,auto:!1,settled:!1,plan:n?null:{list:0,detail:null}}}function Ta(e,n,s){if(e.settled||!n)return e;const r=Ma(Dt(e.key),n,s);return r.kind==="wait"?e:r.kind==="none"?{key:e.key,selection:null,auto:!1,settled:!0,plan:{list:r.listTop,detail:null}}:r.kind==="first"?(ot(e.key,{selection:r.selection,closed:!1,section:null,listTop:0,detailTop:0}),{key:e.key,selection:r.selection,auto:!0,settled:!0,plan:{list:0,detail:0}}):{key:e.key,selection:r.selection,auto:!0,settled:!0,plan:{list:r.listTop,detail:r.detailTop}}}function Da(e,n,s){const r=n==null||e.selection==null||!s(e.selection,n);return ot(e.key,{selection:n,closed:n==null,...r?{section:null,detailTop:0}:{}}),{key:e.key,selection:n,auto:!1,settled:!0,plan:null}}const Xt=typeof window>"u"?i.useEffect:i.useLayoutEffect,Ia=3e3,rs=["wheel","pointerdown","touchstart","keydown"];function Fa(e,n,s){let r=!1,a=0,o=0,d=null;const l=()=>{if(!r){r=!0,cancelAnimationFrame(a),d==null||d.disconnect();for(const u of rs)e.removeEventListener(u,l);s()}},c=()=>{if(r)return;if(!e.isConnected){l();return}if(e.clientHeight===0){!d&&typeof ResizeObserver<"u"&&(d=new ResizeObserver(()=>{e.clientHeight!==0&&(d==null||d.disconnect(),d=null,c())}),d.observe(e));return}o||(o=performance.now()+Ia);const u=Math.max(0,e.scrollHeight-e.clientHeight);if(e.scrollTop=Math.min(n,u),u>=n||performance.now()>=o){l();return}a=requestAnimationFrame(c)};for(const u of rs)e.addEventListener(u,l,{passive:!0});return c(),l}const bn=".ig-detail";function Hs({listKey:e,drawn:n,same:s,sideBySide:r,root:a,listScroller:o}){const[d,l]=i.useState(()=>ss(e,!0));let c=d;d.key!==e&&(c=ss(e,!1),l(c));const u=i.useRef(c);u.current=c;const j=i.useRef(s);j.current=s;const h=i.useRef(!1),f=i.useRef(!1),g=c.plan;Xt(()=>{const k=a.current;if(!g||!k)return;const p=[],T=(L,R,v)=>{const S=v==null?null:k.querySelector(R);!S||v==null||(L.current=!0,p.push(Fa(S,v,()=>{L.current=!1})))};return T(h,o,g.list),T(f,bn,g.detail),()=>{for(const L of p)L()}},[g,a,o]),Xt(()=>{const k=Ta(c,n,r);k!==c&&l(k)},[c,n,r]),i.useEffect(()=>{const k=a.current;if(!k)return;const p=T=>{const L=T.target;L instanceof HTMLElement&&(L.matches(bn)?f.current||ot(u.current.key,{detailTop:L.scrollTop}):L.matches(o)&&(h.current||ot(u.current.key,{listTop:L.scrollTop})))};return k.addEventListener("scroll",p,{capture:!0,passive:!0}),()=>k.removeEventListener("scroll",p,{capture:!0})},[a,o]);const{selection:y,auto:x}=c;Xt(()=>{var p;if(x||!y||f.current)return;const k=(p=a.current)==null?void 0:p.querySelector(bn);ot(u.current.key,{detailTop:(k==null?void 0:k.scrollTop)??0})},[y,x,a]);const m=i.useCallback(k=>l(Da(u.current,k,j.current)),[]);return{selection:y,auto:x,choose:m}}const Ba=5*6e4,Oa=2*6e4,Pa=24,as={shown:!1,sprints:[],total:0,isLast:!1,loading:!1,error:null},Ua={status:"idle",issues:[],next:"",total:null,capped:!1,error:null,more:!1},Pe=new Map,Mn=new Set;function _a(e){for(const[n,s]of Pe)n.startsWith(`${e}|`)&&Pe.set(n,{...s,loadedAt:0});for(const n of Xe.keys())n.startsWith(`${e}|`)&&Xe.delete(n);for(const n of Mn)n(e)}const Ka=(e,n,s)=>`${e}|${n}|${s.mine?"mine":"all"}|${s.quick.join(",")}`;function Ha(e,n){for(Pe.delete(e),Pe.set(e,n);Pe.size>Pa;)Pe.delete(Pe.keys().next().value)}function os(e,n){for(const[s,r]of[...Pe.entries()].reverse())if(s.startsWith(`${e}|${n}|`)&&r.overview)return{overview:r.overview,groups:{},subtasks:{},closed:{...as,shown:r.closed.shown,sprints:r.closed.sprints,total:r.closed.total,isLast:r.closed.isLast},loadedAt:0};return{overview:null,groups:{},subtasks:{},closed:as,loadedAt:0}}function Ge(e){return e instanceof Yt?e:new Yt("upstream",e instanceof Error&&e.message?e.message:"Jira could not be read.")}const Tn=e=>e instanceof DOMException&&e.name==="AbortError",Wa=new Set(["auth","expired","rate-limit","tls","unreachable","incompatible","network","unavailable"]);function ls(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 qa(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 Ga(e,n,s,r){const a=s?Ka(n,s,r):"",[o,d]=i.useState(()=>a&&Pe.get(a)||os(n,s??"")),l=i.useRef(o),[c,u]=i.useState(!1),[j,h]=i.useState(null),f=i.useRef(0),g=i.useRef(null),y=i.useRef(a),x=i.useRef(r);x.current=r;const m=i.useCallback(($,I)=>{if($!==y.current)return;const B=I(l.current);l.current=B,$&&Ha($,B),d(B)},[]),k=i.useCallback(($,I,B)=>{m($,C=>({...C,groups:{...C.groups,[I]:B(C.groups[I]??Ua)}}))},[m]),p=i.useCallback(async($,I,B,C)=>{if(s){k($,I.id,U=>({...U,status:"loading",error:null}));try{const U=await Zn(e,s,ls(I,x.current,B),C);k($,I.id,()=>({status:"ready",issues:U.issues,next:U.next,total:U.total,capped:U.capped,error:null,more:!1}))}catch(U){if(Tn(U)||C.aborted)return;const W=Ge(U);if(k($,I.id,ee=>({...ee,status:"error",error:W,more:!1})),Wa.has(W.kind))throw W}}},[s,e,k]),T=i.useCallback(async()=>{var U;if(!s)return;const $=y.current,I=++f.current;(U=g.current)==null||U.abort();const B=new AbortController;g.current=B;const{signal:C}=B;u(!0),h(null),await(async()=>{try{const W=await ha(e,s,C);if(I!==f.current)return;m($,Y=>({...Y,overview:W,subtasks:{}}));const ee=l.current.closed,se=es(W,ee.shown?ee.sprints:[]),V=se.filter(Y=>Y.kind==="active"||Y.kind==="column"&&Y.column!=="done"),J=se.filter(Y=>!V.includes(Y)&&(Y.kind!=="closed"||l.current.groups[Y.id]));await Promise.all(V.map(Y=>p($,Y,W,C))),await qa(J,3,Y=>C.aborted?Promise.resolve():p($,Y,W,C)),I===f.current&&m($,Y=>({...Y,loadedAt:Date.now()}))}catch(W){if(Tn(W)||C.aborted||I!==f.current)return;B.abort(),h(Ge(W))}finally{I===f.current&&u(!1)}})()},[s,e,p,m]);i.useEffect(()=>{var B;y.current=a;const $=a?Pe.get(a):void 0,I=$??os(n,s??"");if(l.current=I,d(I),h(null),!s){(B=g.current)==null||B.abort(),u(!1);return}(!$||Date.now()-$.loadedAt>Ba)&&T()},[a]),i.useEffect(()=>()=>{var $;($=g.current)==null||$.abort()},[]);const L=i.useCallback(($,I=!1)=>{const B=l.current.overview,C=l.current.groups[$.id];if(!B||C&&C.status!=="idle"&&!(I&&C.status==="error"))return;const U=g.current&&!g.current.signal.aborted?g.current.signal:new AbortController().signal,W=y.current;p(W,$,B,U).catch(ee=>h(Ge(ee)))},[p]),R=i.useCallback($=>{const I=l.current.overview,B=l.current.groups[$.id];if(!s||!I||!B||!B.next||B.more)return;const C=y.current;k(C,$.id,U=>({...U,more:!0,error:null})),(async()=>{try{const U=await Zn(e,s,ls($,x.current,I,B.next));k(C,$.id,W=>{const ee=new Set(W.issues.map(se=>se.key));return{...W,issues:[...W.issues,...U.issues.filter(se=>!ee.has(se.key))],next:U.next,total:U.total??W.total,capped:U.capped,more:!1}})}catch(U){const W=Ge(U);k(C,$.id,ee=>({...ee,more:!1,error:W}))}})()},[s,e,k]),v=i.useCallback($=>{if(!s)return;const I=y.current;m(I,B=>({...B,closed:{...B.closed,shown:!0,loading:!0,error:null}})),(async()=>{try{const B=await fa(e,s,$);m(I,C=>{const U=new Set(C.closed.sprints.map(ee=>ee.id)),W=$===0?B.sprints:[...C.closed.sprints,...B.sprints.filter(ee=>!U.has(ee.id))];return{...C,closed:{...C.closed,sprints:W,total:B.total,isLast:B.isLast,loading:!1,error:null}}})}catch(B){const C=Ge(B);m(I,U=>({...U,closed:{...U.closed,loading:!1,error:C}}))}})()},[s,e,m]),S=i.useCallback($=>{const I=y.current;if(!$){m(I,C=>({...C,closed:{...C.closed,shown:!1}}));return}const B=l.current.closed;B.sprints.length||B.loading?m(I,C=>({...C,closed:{...C.closed,shown:!0}})):v(0)},[v,m]),F=i.useCallback(()=>{const $=l.current.closed;$.loading||$.isLast||v($.sprints.length)},[v]),K=i.useCallback($=>{const I=l.current.subtasks[$];if(I&&I.status!=="error")return;const B=y.current,C=U=>m(B,W=>({...W,subtasks:{...W.subtasks,[$]:U}}));C({status:"loading",issues:(I==null?void 0:I.issues)??[],error:null}),ma(e,$).then(U=>C({status:"ready",issues:U.issues,error:null})).catch(U=>C({status:"error",issues:[],error:Ge(U)}))},[e,m]),w=o.closed,E=o.overview?es(o.overview,w.shown?w.sprints:[]):[];return{snap:o,groups:E,loading:c,error:j,refresh:T,ensureGroup:L,loadMore:R,showClosed:S,moreClosed:F,loadSubtasks:K}}const Xe=new Map;function Va(e,n,s){const r=s?`${n}|${s}`:"",[a,o]=i.useState(()=>{var y;return r?((y=Xe.get(r))==null?void 0:y.data)??null:null}),[d,l]=i.useState(!1),[c,u]=i.useState(null),[j,h]=i.useState(0),f=i.useRef(!1);i.useEffect(()=>{const y=x=>{x===n&&s&&(f.current=!0,h(m=>m+1))};return Mn.add(y),()=>{Mn.delete(y)}},[n,s]),i.useEffect(()=>{if(!s){o(null),u(null);return}const y=Xe.get(r);if(o((y==null?void 0:y.data)??null),u(null),y&&!f.current&&Date.now()-y.at<Oa){l(!1);return}f.current=!1;const x=new AbortController;return l(!0),pa(e,s,x.signal).then(m=>{Xe.set(r,{at:Date.now(),data:m}),Xe.size>60&&Xe.delete(Xe.keys().next().value),o(m)}).catch(m=>{!Tn(m)&&!x.signal.aborted&&u(Ge(m))}).finally(()=>{x.signal.aborted||l(!1)}),()=>x.abort()},[r,e,s,j]);const g=i.useCallback(()=>{f.current=!0,h(y=>y+1)},[]);return{data:a,loading:d,error:c,reload:g}}function za(){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 Ws(){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 Ja(){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 Xa(){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 Hn(){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 qs(){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 Qa({loadedAt:e,loading:n,stale:s},r=Date.now()){const a=e!=null?Es(r-e):null,o=(d,l,c="",u=null)=>({tone:d,word:l,join:c,ago:u,text:`${l}${c}${u??""}`});return n?e!=null?o("updating","Updating…"):o("reading","Reading…"):e==null?o("none",""):s?o("stale","Not updated"," · last answer ",a):o("updated","Updated"," ",a)}function Ya(e,n){return e==="reading"||e==="updating"?"Updating…":n?e==="stale"?"Not updated":e==="updated"?"Updated":"":""}function Gs({loadedAt:e,loading:n,stale:s=!1,onRefresh:r,label:a,disabled:o=!1,now:d}){const[,l]=i.useState(0),c=i.useRef(n);c.current=n;const[u,j]=i.useState(!1);i.useEffect(()=>{if(e==null)return;const g=window.setInterval(()=>l(y=>y+1),3e4);return()=>window.clearInterval(g)},[e]),i.useEffect(()=>{n&&j(!0)},[n]);const h=Qa({loadedAt:e,loading:n,stale:s},d??Date.now()),f=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(Ws,{}),t.jsx("span",{className:"ig-fresh-word",children:h.word}),h.join,f&&h.ago&&t.jsx("time",{dateTime:f.toISOString(),title:f.toLocaleString(),children:h.ago})]}),t.jsx("span",{className:"vis-hidden",role:"status",children:Ya(h.tone,u)}),t.jsx("button",{type:"button",className:"glyph-btn ig-refresh","aria-label":a,title:"Refresh",...Ce(n,o),"data-loading":n||void 0,onClick:()=>{we(c.current)&&r()},children:t.jsx(_r,{})})]})}function Wn({value:e,onChange:n,label:s,placeholder:r,inputRef:a,onKeyDown:o}){const d=i.useRef(null),l=a??d,[c,u]=i.useState(!1),j=c&&e!=="",h=i.useRef(n);return h.current=n,i.useEffect(()=>{if(j)return Ls.push(()=>h.current(""),0,"popover")},[j]),t.jsxs("div",{className:"ig-search","data-filled":e!==""||void 0,children:[t.jsx(za,{}),t.jsx("input",{ref:l,type:"search",className:"ig-search-input","aria-label":s,placeholder:r,value:e,onChange:f=>n(f.target.value),onKeyDown:o,onFocus:()=>u(!0),onBlur:()=>u(!1)}),e!==""&&t.jsx("button",{type:"button",className:"glyph-btn ig-search-clear","aria-label":"Clear the search",title:"Clear",onClick:()=>{var f;n(""),(f=l.current)==null||f.focus()},children:t.jsx(qs,{})})]})}function sn({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))]})}const Vt=new Set;function yn(e,n,s){for(const r of[e,n])if(r&&!s.has(r))return r;return null}function Vs(e){return{width:e,height:e,"--ig-avatar-size":`${e}px`}}function Ot({src:e,direct:n,name:s,size:r=20,you:a=!1,className:o=""}){const[d,l]=i.useState(()=>yn(e,n,Vt));i.useEffect(()=>l(yn(e,n,Vt)),[e,n]);const c=Vs(r),u=a||void 0;return d?t.jsx("img",{className:`ig-avatar ${o}`.trim(),style:c,src:d,alt:"","aria-hidden":!0,referrerPolicy:"no-referrer",loading:"lazy",decoding:"async",draggable:!1,"data-you":u,onError:()=>{Vt.add(d),l(yn(e,n,Vt))}}):t.jsx("span",{className:`ig-avatar ig-avatar-initials ${o}`.trim(),"data-large":r>=28||void 0,"data-you":u,style:c,"aria-hidden":!0,children:Kr(s)})}function zs({size:e=20}){return t.jsx("span",{className:"ig-avatar ig-avatar-none",style:Vs(e),"aria-hidden":!0})}function Js({src:e,direct:n,name:s,size:r=20,you:a=!1,nameless:o=!1}){return t.jsxs("span",{className:"ig-person",title:o?s:void 0,children:[t.jsx(Ot,{src:e,direct:n,name:s,size:r,you:a}),o?t.jsx("span",{className:"vis-hidden",children:s}):t.jsx("span",{className:"ig-person-name",children:s})]})}function Za(e){return e.length<=1?e[0]??"":e.length===2?`${e[0]} and ${e[1]}`:`${e.slice(0,-1).join(", ")} and ${e[e.length-1]}`}function Xs({people:e,max:n=3,size:s=20,label:r}){if(!e.length)return null;const a=e.map(c=>c.name),o=e.length>n?e.slice(0,n):e,d=e.length-o.length,l=Za(a);return t.jsxs("span",{className:"ig-stack",role:"img","aria-label":r?`${r} ${l}`:l,title:a.join(", "),children:[o.map(c=>t.jsx(Ot,{src:c.src,direct:c.direct,name:c.name,size:s,you:c.you},c.key)),d>0&&t.jsxs("span",{className:"ig-stack-more","aria-hidden":!0,children:["+",d]})]})}function eo(e){switch(e){case"auth":case"expired":return"reconnect";case"permission":case"incompatible":return"settings";case"not-found":return"none";default:return"retry"}}function to(e){return e==="reconnect"?"Reconnect":e==="settings"?"Open connection settings":"Try again"}function Qs(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 no(e,n,s=n,r=Date.now()){var o;const a=((o=e.message)==null?void 0:o.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 ${Qs(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 so(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 ro(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 bt({error:e,provider:n,host:s,stale:r=!1,onRetry:a,onReconnect:o,title:d,body:l,children:c,now:u}){const[j,h]=i.useState(()=>u??Date.now()),[f,g]=i.useState(()=>u??Date.now());i.useEffect(()=>{const F=Date.now();h(F),g(F)},[e]);const y=u??f,x=ro(e,j,y);i.useEffect(()=>{if(x<=0)return;const F=window.setTimeout(()=>g(Date.now()),1e3);return()=>window.clearTimeout(F)},[x,f]);const m=no(e,n,s,y),k=d??m.title,p=l??m.body,T=so(e,p),L=eo(e.kind),R=L==="retry"?a:L==="none"?void 0:o,v=L==="none"?"":to(L),S=L==="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(Ws,{}):t.jsx(Ja,{}),t.jsx("strong",{children:k})]}),p&&t.jsx("p",{className:"ig-failure-body",children:p}),T&&!r&&t.jsxs("p",{className:"ig-failure-said",children:[n," said: ",T]})]}),(R||c)&&t.jsxs("div",{className:"ig-failure-actions",children:[R&&t.jsx("button",{type:"button",className:S?"btn primary":"btn","aria-disabled":x>0||void 0,onClick:()=>{x<=0&&R()},children:x>0?`${v} ${Qs(x,y)}`:v}),c]})]})}const kn=new Set;function Ys({src:e,label:n,fallback:s,className:r="jr-icon"}){const[a,o]=i.useState(()=>!e||kn.has(e));return i.useEffect(()=>o(!e||kn.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:()=>{kn.add(e),o(!0)}})}function ao(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 oo={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 lo({type:e,subtask:n}){const s=e.epic?"epic":ao(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"}),oo[s]]})}const io={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 co({priority:e}){const n=Kn(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:io[n]})]}):t.jsx("span",{className:"jr-icon",title:`Priority: ${e.name}`,"aria-hidden":!0})}const rn=({type:e,subtask:n})=>t.jsx(Ys,{src:e.icon,label:e.name,fallback:t.jsx(lo,{type:e,subtask:n})}),qn=({priority:e})=>e?t.jsx(Ys,{src:e.icon,label:`Priority: ${e.name}`,fallback:t.jsx(co,{priority:e})}):t.jsx("span",{className:"jr-icon","aria-hidden":!0});function Zs({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 an({status:e}){return t.jsx("span",{className:"jr-status ig-chip","data-cat":e.category,title:e.name,children:e.name})}function uo({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=pt(e.estimate,s),a=e.remaining!=null&&e.remaining!==e.estimate?pt(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 er(){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 Dn({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"})})}function ho({items:e,groups:n,snap:s,anchorId:r,portalId:a,boundaryId:o,busy:d,onMove:l,onClose:c,error:u,initialView:j="move"}){const h=i.useId(),f=i.useRef(d);f.current=d;const g=i.useRef(!1),[y,x]=i.useState(j),[m,k]=i.useState(e[0].group.id),[p,T]=i.useState(""),L=y==="menu",R=n.filter(C=>Tt(C)),v=R.find(C=>C.id===m),S=v?s.groups[v.id]:void 0,F=new Set(e.map(C=>C.issue.key)),K=((S==null?void 0:S.issues)??[]).filter(C=>!F.has(C.key)&&!C.type.subtask&&!C.type.epic),w=p?{key:p.slice(p.indexOf(":")+1),side:p.startsWith("before:")?"before":"after"}:void 0,E=v?Cn(e,v,w):null,$=e.length===1?Qe(e[0]):null,I=$?`${e[0].issue.key} ${$}. This issue cannot be moved.`:Jt(e),B=async()=>{if(!(!E||!v||!we(f.current||g.current))){g.current=!0;try{await l(E,v)}finally{g.current=!1}}};return t.jsx(nn,{anchorId:r,portalRootId:a,boundaryId:o??a,id:`${h}-popover`,className:L?"jr-actions-pop":"jr-move-pop",role:L?"menu":"dialog",labelledBy:L?r:`${h}-title`,onClose:c,children:L?t.jsxs(t.Fragment,{children:[t.jsx("button",{type:"button",className:"jr-action-item",role:"menuitem","aria-disabled":!!I||d,"aria-describedby":I?`${h}-problem`:void 0,onClick:()=>{!I&&we(f.current||g.current)&&x("move")},children:e.length===1?"Move…":`Move ${e.length} issues…`}),I&&t.jsx("p",{id:`${h}-problem`,className:"jr-action-hint",children:I})]}):t.jsxs("form",{onSubmit:C=>{C.preventDefault(),B()},children:[t.jsxs("h3",{id:`${h}-title`,children:["Move ",e.length===1?e[0].issue.key:`${e.length} issues`]}),t.jsx("label",{htmlFor:`${h}-destination`,children:"Destination"}),t.jsx("select",{id:`${h}-destination`,value:m,...Ce(d),autoFocus:!0,onChange:C=>{we(f.current||g.current)&&(k(C.target.value),T(""))},children:R.map(C=>t.jsx("option",{value:C.id,children:C.title},C.id))}),t.jsx("label",{htmlFor:`${h}-position`,children:"Position"}),t.jsxs("select",{id:`${h}-position`,value:p,...Ce(d),onChange:C=>{we(f.current||g.current)&&T(C.target.value)},children:[t.jsx("option",{value:"",children:e.every(C=>C.group.id===m)?"Choose a position":"Keep current rank"}),K.map(C=>t.jsxs("option",{value:`before:${C.key}`,children:["Before ",C.key," — ",C.summary]},C.key)),K.length>0&&t.jsxs("option",{value:`after:${K[K.length-1].key}`,children:["After ",K[K.length-1].key]})]}),t.jsxs("p",{className:"jr-move-help",children:["Saved in Jira. Status stays the same. ",S!=null&&S.next||S!=null&&S.capped||!S||S.status!=="ready"?"Positions are limited to issues already loaded.":""]}),u&&t.jsx("p",{className:"jr-move-error",role:"alert",children:u}),t.jsxs("div",{className:"jr-move-actions",children:[t.jsx("button",{type:"button",className:"btn",onClick:c,children:"Cancel"}),t.jsx("button",{type:"submit",className:"btn primary",...Ce(d,!E),children:d?"Moving…":e.length===1?"Move issue":`Move ${e.length} issues`})]})]})})}function is({item:e,portalRootId:n,children:s}){const r=e.fixVersions??[],a=o=>{var d;return(d=o.closest(".jr-board"))!=null&&d.querySelector("[data-dragging]")?!1:r.length>1?!0:Array.from(o.querySelectorAll(".jr-key, .jr-summary, .jr-version, .jr-epic")).some(l=>l.getClientRects().length===0||l.scrollWidth>l.clientWidth+1||l.classList.contains("jr-summary")&&l.scrollHeight>l.clientHeight+2)};return t.jsx(Hr,{className:"jr-row-preview",portalRootId:n,placement:"reading",focusDelay:250,shouldShow:a,detail:t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"jr-preview-key",children:e.key}),t.jsx("div",{className:"jr-preview-summary",children:e.summary}),(r.length>0||e.epic)&&t.jsxs("dl",{children:[r.length>0&&t.jsxs(t.Fragment,{children:[t.jsx("dt",{children:r.length===1?"Version":"Versions"}),t.jsx("dd",{children:r.join(", ")})]}),e.epic&&t.jsxs(t.Fragment,{children:[t.jsx("dt",{children:"Epic"}),t.jsxs("dd",{children:[e.epic.key,": ",e.epic.name]})]})]})]}),children:s})}const cs={new:"To do",indeterminate:"In progress",done:"Done"},fo=["new","indeterminate","done"],ds=e=>e<=30;function mo({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 d=n.new+n.indeterminate+n.done;if(d<=0)return null;const l=ts(d,s,r);return t.jsx("span",{className:"jr-totals",children:t.jsxs("span",{className:"jr-total",title:`Total: ${l} ${a}`,children:["Total ",l]})})}const o=fo.filter(d=>n[d]>0);return o.length===0?null:t.jsx("span",{className:"jr-totals",children:o.map(d=>{const l=ts(n[d],s,r);return t.jsxs("span",{className:"jr-total","data-cat":d,title:`${cs[d]}: ${l} ${a}`,children:[cs[d]," ",l]},d)})})}function po({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(i.Fragment,{children:[a>0&&t.jsx("span",{"aria-hidden":!0,children:" · "}),t.jsx("span",{title:r.title,children:r.text})]},r.key))})}function us(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.priority?`, priority ${e.priority.name}`:""}${e.flagged?", flagged":""}${n}`}function hs({issue:e,estimation:n,time:s}){const r=e.status.category==="done";return t.jsxs(t.Fragment,{children:[t.jsx(rn,{type:e.type}),t.jsx(qn,{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(er,{})}),e.fixVersions.length>0&&t.jsx("span",{className:"jr-version",title:e.fixVersions.join(", "),children:e.fixVersions.length===1?e.fixVersions[0]:`${e.fixVersions.length} versions`}),e.epic&&t.jsx(Zs,{epic:e.epic})]}),t.jsx(uo,{issue:e,estimation:n,time:s}),t.jsx("span",{className:"jr-status-cell",children:t.jsx(an,{status:e.status})})]}),t.jsx("span",{className:"jr-assignee",title:e.assignee?`${e.assignee.name}${e.mine?" (you)":""}`:"Unassigned",children:e.assignee?t.jsx(Ot,{src:e.assignee.avatar,name:e.assignee.name,size:20,you:e.mine}):t.jsx(zs,{size:20})})]})}function go(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 jo(e){var Xn;const{conn:n,overview:s,groups:r,snap:a,expanded:o,onToggleGroup:d,filter:l,mine:c,filtered:u,selected:j,onOpen:h,rowsOpen:f,onToggleRow:g,onRetryGroup:y,onMore:x,onShowClosed:m,onMoreClosed:k,loadSubtasks:p,onReconnect:T,onMove:L,moveBusy:R=!1}=e,v=i.useRef(null),S=i.useId(),F=i.useRef(null),K=i.useRef(!1),[w,E]=i.useState([]),[$,I]=i.useState(()=>new Set),[B,C]=i.useState(!1),U=i.useRef(null),W=i.useRef(0),[ee,se]=i.useState(null),[V,J]=i.useState(null),Y=i.useRef(0),[ve,me]=i.useState(""),[dt,_e]=i.useState(""),$e=i.useRef(!1),Le=i.useRef(!1);Le.current=R;const Ke=i.useRef(!1);Ke.current=a.closed.loading;const P=((Xn=s.moves)==null?void 0:Xn.enabled)===!0&&!!L,be=(b,N,_,q=!1,O="move")=>{if(!we(Le.current||$e.current))return;const X=$.has(b.key)?Se:[{issue:b,group:N}];if(O==="move"&&(X.length>50||X.some(z=>!zt(z.issue,z.group)))){me(Jt(X));return}Y.current++,me(""),J({issue:b,items:X,anchorId:_,keyboard:q,initialView:O})},tt=()=>{const b=V;$e.current&&b&&!document.getElementById(b.anchorId)||Y.current++,J(null),b!=null&&b.keyboard&&requestAnimationFrame(()=>{var _,q;document.activeElement===document.getElementById(b.anchorId)&&((q=Array.from(((_=v.current)==null?void 0:_.querySelectorAll(".jr-row-main[data-key]"))??[]).find(O=>O.dataset.key===b.issue.key))==null||q.focus())})},he=()=>{F.current=null,E([]),se(null)},Ee=async(b,N)=>{if(!L||R||$e.current)return!1;const _=Y.current,q=W.current,O=Fs(b),X=O.length===1?O[0]:`${O.length} issues`,z=document.activeElement,te=z==null?void 0:z.closest(".jr-move-pop");$e.current=!0,me(""),_e(`Moving ${X}…`);try{const de=await L(b);_e(de.notice||`${X} moved to ${N.title}.`),q===W.current&&I(new Set(O));const ye=_===Y.current&&(document.activeElement===z||!!(te!=null&&te.contains(document.activeElement))||document.activeElement===document.body&&(!(z!=null&&z.isConnected)||(te==null?void 0:te.isConnected)));return _===Y.current&&J(null),d(N,!0),ye&&requestAnimationFrame(()=>{var Fe,st;(st=Array.from(((Fe=v.current)==null?void 0:Fe.querySelectorAll(".jr-row-main[data-key]"))??[]).find(ht=>{var G;return ht.dataset.key===O[0]&&((G=ht.dataset.nav)==null?void 0:G.startsWith(`${N.id}/`))})??document.getElementById(`jr-group-${N.id.replace(/[^a-z0-9]/gi,"-")}-toggle`))==null||st.focus()}),!0}catch(de){return _e(""),me(de instanceof Error?de.message:"The move could not be confirmed. Refresh before trying again."),!1}finally{$e.current=!1}},He=(b,N)=>{!F.current||!P||R||!Tt(N)||(b.preventDefault(),b.dataTransfer.dropEffect="move",se({group:N.id}))},nt=(b,N)=>{const _=F.current;if(!_||!P||R)return;b.preventDefault();const q=Cn(_.items,N);he(),q&&Ee(q,N)},[A,re]=i.useState(()=>new Set),[pe,xe]=i.useState(()=>new Set),[Me,Te]=i.useState(null),De=s.estimation.kind,ut=s.timeTracking,ge=i.useMemo(()=>Ps(r,a.groups,b=>{var N;return(N=a.subtasks[b])==null?void 0:N.issues},l).map(b=>({...b,stats:Ca(b.rows,De)})),[r,a.groups,a.subtasks,l,De]),ze=b=>Rn(b,f),je=i.useMemo(()=>{const b=[],N=new Set,_=(q,O)=>{N.has(q.key)||(N.add(q.key),b.push({issue:q,group:O}))};for(const{def:q,rows:O}of ge)if(Lt(q,o)){for(const X of O)if(X.kind==="issue"&&_(X.issue,q),Rn(X,f))for(const z of An(X,a.subtasks[Ye(X)],l))_(z,q)}return b},[ge,o,f,a.subtasks,l]),Kt=je.map(b=>b.issue.key),Se=je.filter(b=>$.has(b.issue.key)),$t=Se.filter(b=>Qe(b)),Je=Jt(Se);i.useEffect(()=>{const b=new Set(je.map(N=>N.issue.key));I(N=>[...N].every(_=>b.has(_))?N:new Set([...N].filter(_=>b.has(_)))),U.current&&!b.has(U.current)&&(U.current=null)},[je]);const We=(b,N,_=!1)=>{const q=N.ctrlKey||N.metaKey,O=q||N.shiftKey||_,X=U.current;W.current++,I(z=>da(z,Kt,b,X,N.shiftKey?q?"add-range":"range":q||_?"toggle":"replace")),N.shiftKey||(U.current=b),C(O),O||h(b)};i.useEffect(()=>{for(const{def:b,rows:N}of ge)if(Lt(b,o))for(const _ of N){if(!ze(_))continue;const q=Ye(_);a.subtasks[q]||!Us(_,u)||p(q)}},[ge,f,o]);const gn=(b,N)=>{N&&xe(_=>new Set(_).add(b)),g(b,N)},jn=()=>{var b;return Array.from(((b=v.current)==null?void 0:b.querySelectorAll("[data-nav]"))??[])},qe=b=>{var N;b&&(b.focus(),(N=b.scrollIntoView)==null||N.call(b,{block:"nearest"}))},Ht=b=>{var X,z;const N=b.target;if(N.dataset.key&&b.key===" "&&!b.altKey){b.preventDefault(),b.repeat||We(N.dataset.key,b,!0);return}if(!N.dataset.nav||b.altKey||b.ctrlKey||b.metaKey)return;const _=jn(),q=_.indexOf(N),O=N.getAttribute("data-expanded");switch(b.key){case"ArrowDown":b.preventDefault(),qe(_[Math.min(_.length-1,q+1)]);return;case"ArrowUp":b.preventDefault(),qe(_[Math.max(0,q-1)]);return;case"Home":b.preventDefault(),qe(_[0]);return;case"End":b.preventDefault(),qe(_[_.length-1]);return;case"ArrowRight":O==="false"?(b.preventDefault(),(X=document.getElementById(N.dataset.toggle??""))==null||X.click()):O==="true"&&(b.preventDefault(),qe(_[q+1]));return;case"ArrowLeft":O==="true"?(b.preventDefault(),(z=document.getElementById(N.dataset.toggle??""))==null||z.click()):N.dataset.parent&&(b.preventDefault(),qe(_.find(te=>te.dataset.nav===N.dataset.parent)));return}},M=i.useMemo(()=>{for(const{def:b,rows:N}of ge)if(Lt(b,o)&&N.length>0)return`${b.id}/${Ye(N[0])}`;return ge.length?`g:${ge[0].def.id}`:null},[ge,o]);i.useEffect(()=>{var b;Me&&!((b=v.current)!=null&&b.querySelector(`[data-nav="${CSS.escape(Me)}"]`))&&Te(null)});const H=b=>b===(Me??M)?0:-1,ae=(b,N,_,q)=>{const O=Ye(b),X=`${N.id}/${O}`,z=ze(b),te=a.subtasks[O],de=b.kind==="issue"?b.issue.subtaskKeys.length:0,ye=de>0||b.matched.length>0||b.kind==="context",Ie=`jr-toggle-${N.id.replace(/[^a-z0-9]/gi,"-")}-${O}`,Fe=An(b,te,l),st=((te==null?void 0:te.status)==="ready"?te.issues:b.matched).filter(D=>D.mine).length,ht=b.kind==="issue"?us(b.issue,ye?`, ${de||b.matched.length} sub-tasks${st?`, ${st} yours`:""}`:""):`${b.parent.key}: ${b.parent.summary}. ${c?"Not assigned to you":"Parent not in this list"}; shown for ${b.matched.length} sub-task${b.matched.length===1?"":"s"}`,G=b.kind==="issue"?b.issue:null,le=P&&G&&zt(G,N)&&_===0,ft=`${S}-move-${N.id}-${O}`,qt=`${ft}-row`,Gt=P&&G&&_===0;return t.jsxs("li",{className:"jr-item","data-context":b.kind==="context"||void 0,children:[t.jsxs("div",{className:"jr-row ig-row","data-selected":$.has(O)||j===O||void 0,"data-picked":$.has(O)||void 0,"data-done":(G==null?void 0:G.status.category)==="done"||void 0,"data-current":j===O||void 0,"data-move-blocked":!!(G&&$.has(O)&&Qe({issue:G,group:N}))||void 0,"data-mine":(G==null?void 0:G.mine)||void 0,"data-dragging":w.includes(O)||void 0,"data-drop":(ee==null?void 0:ee.group)===N.id&&ee.key===O?ee.side:void 0,draggable:!!(le&&!R),onPointerDown:D=>{K.current=!!D.target.closest(".jr-toggle, .jr-move-button")},onDragStart:D=>{if(!le||R||!G||K.current){D.preventDefault();return}const fe=$.has(O)?Se:[{issue:G,group:N}];if(fe.length>50||fe.some(ie=>!zt(ie.issue,ie.group))){D.preventDefault(),me(Jt(fe));return}$.has(O)||(W.current++,I(new Set([O])),C(!1)),F.current={items:fe},D.dataTransfer.effectAllowed="move",D.dataTransfer.setData("text/plain",fe.map(ie=>ie.issue.key).join(`
1
+ import{r as Dr,a as Ir,w as Fr,b as i,p as As,m as Ls,j as t,u as Br,f as Or,I as Yt,c as Pr,q as Ur,R as _r,s as we,d as Ce,e as Es,i as Kr,A as nn,H as Hr,g as jt,E as xt,h as Wr,t as qr,k as Ms,T as Gr,l as Vr,n as zr,o as Jr,v as Xr,x as Qr,y as Yr,z as Zr,B as ea,C as ta,D as na,F as sa}from"./app-EEG3dpaG.js";const Re={min:320,max:1600},Bt=.5;function Ts(e){return Number.isFinite(e)&&e>0&&e<1?e:Bt}function Ds(e=Bt){return`clamp(${Re.min}px, ${Ts(e)*100}%, ${Re.max}px)`}const ra=420,aa=8,oa="(max-width: 899px)",Sn=e=>`agent-dag.integrations.${e}.detail-width`;function At(e,n){const s=Math.max(Re.min,Math.min(Re.max,n-ra-aa));return Math.round(Math.min(s,Math.max(Re.min,Number.isFinite(e)?e:n*Bt)))}function Yn(e,n=Bt){return At(e*Ts(n),e)}function la(e){const n=Dr(Sn(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 ia(e,n){n==null?Ir(Sn(e)):Fr(Sn(e),String(Math.round(n)))}function ca({width:e,workspace:n,controls:s,onCommit:r,automaticDetailShare:a}){const o=i.useRef(null),d=i.useRef(null),l=()=>{var x;return((x=n.current)==null?void 0:x.clientWidth)??window.innerWidth},c=e==null?Yn(l(),a):At(e,l()),u=x=>{var m,k;(m=n.current)==null||m.style.setProperty("--ig-detail-w",`${x}px`),(k=o.current)==null||k.setAttribute("aria-valuenow",String(x))},j=x=>{var m,k;x==null?((m=n.current)==null||m.style.setProperty("--ig-detail-w",Ds(a)),(k=o.current)==null||k.setAttribute("aria-valuenow",String(Yn(l(),a)))):u(x),r(x)},h=x=>{var m;x.button===0&&(x.preventDefault(),x.currentTarget.setPointerCapture(x.pointerId),d.current={x:x.clientX,width:c,room:l(),last:c},(m=n.current)==null||m.setAttribute("data-resizing",""))},f=x=>{const m=d.current;m&&(m.last=At(m.width+m.x-x.clientX,m.room),u(m.last))},g=()=>{var m;const x=d.current;x&&(d.current=null,(m=n.current)==null||m.removeAttribute("data-resizing"),j(x.last))},y=x=>{const m=x.shiftKey?64:16;if(x.key==="Enter"){x.preventDefault(),j(null);return}const k=x.key==="ArrowLeft"?c+m:x.key==="ArrowRight"?c-m:x.key==="Home"?Re.min:x.key==="End"?Re.max:null;k!==null&&(x.preventDefault(),j(At(k,l())))};return t.jsx("div",{ref:o,className:"ig-splitter",role:"separator","aria-orientation":"vertical","aria-label":"Detail width","aria-controls":s,"aria-valuemin":Re.min,"aria-valuemax":At(Re.max,l()),"aria-valuenow":c,tabIndex:0,title:"Drag to resize · double-click for the automatic width",onPointerDown:h,onPointerMove:f,onPointerUp:g,onPointerCancel:g,onLostPointerCapture:g,onDoubleClick:()=>j(null),onKeyDown:y})}function Is(){return Br(oa)}function _n({list:e,detail:n,onBack:s,backLabel:r,storageKey:a,detailKey:o,automaticDetailShare:d=Bt}){const l=Is(),c=`${i.useId()}-detail`,u=i.useRef(null),j=i.useRef(null),h=i.useRef(null),f=i.useRef(null),[g,y]=i.useState(()=>la(a)),x=w=>{y(w),ia(a,w)},m=n!=null,k=i.useRef(null);m&&(k.current=n);const[p,T]=i.useState(m),[L,R]=i.useState(null);p!==m&&(T(m),R(!m&&l&&!As()?k.current:null));const v=m?n:L,S=!m&&L!=null;i.useEffect(()=>{if(!S)return;const w=window.setTimeout(()=>R(null),200);return()=>window.clearTimeout(w)},[S]),i.useLayoutEffect(()=>{h.current&&(h.current.inert=S)},[S]),i.useLayoutEffect(()=>{const w=h.current;!w||!m||(w.dataset.flip=w.dataset.flip==="a"?"b":"a")},[m,o]);const F=i.useRef(null);i.useLayoutEffect(()=>{var $,I,B,C;if(!m)return;const w=document.activeElement;w instanceof HTMLElement&&(($=j.current)!=null&&$.contains(w))&&(F.current=w);const E=w instanceof HTMLElement&&!(((I=w.checkVisibility)==null?void 0:I.call(w))??!0);l&&(!w||w===document.body||E||(B=j.current)!=null&&B.contains(w))&&((C=f.current)==null||C.focus({preventScroll:!0}))},[m,l,o]),i.useEffect(()=>{if(m)return;const w=F.current;if(!w)return;const E=requestAnimationFrame(()=>{var I;const $=document.activeElement;(!$||$===document.body)&&w.isConnected&&(((I=w.checkVisibility)==null?void 0:I.call(w))??!0)&&w.focus({preventScroll:!0})});return()=>cancelAnimationFrame(E)},[m]);const K=i.useRef(s);return K.current=s,i.useEffect(()=>{if(m)return Ls.push(()=>K.current(),0,"popover")},[m]),t.jsxs("div",{ref:u,className:"ig-split","data-detail":m||void 0,"data-drill-in":l||void 0,style:{"--ig-detail-w":g==null?Ds(d):`${g}px`},children:[t.jsx("div",{ref:j,className:"ig-list",hidden:l&&m||void 0,children:e}),m&&!l&&t.jsx(ca,{width:g,workspace:u,controls:c,onCommit:x,automaticDetailShare:d}),v!=null&&t.jsxs("section",{ref:h,className:"ig-detail",id:c,"aria-label":"Details","data-leaving":S||void 0,onAnimationEnd:w=>{S&&w.target===w.currentTarget&&R(null)},children:[l&&t.jsxs("button",{ref:f,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]}),v]})]})}const Fs=e=>e.issueKeys??[e.issueKey];function da(e,n,s,r,a){if(!n.includes(s))return new Set(e);if(a==="replace")return new Set([s]);if(a==="toggle"){const c=new Set(e);return c.has(s)?c.delete(s):c.add(s),c}const o=r?n.indexOf(r):-1,d=n.indexOf(s),l=o<0?[s]:n.slice(Math.min(o,d),Math.max(o,d)+1);return new Set([...a==="add-range"?e:[],...l])}function Tt(e){return e.kind==="backlog"?{kind:"backlog"}:(e.kind==="active"||e.kind==="future")&&e.sprint&&(e.sprint.state==="active"||e.sprint.state==="future")?{kind:"sprint",sprintId:e.sprint.id}:null}function zt(e,n){return Qe({issue:e,group:n})===null}function Qe({issue:e,group:n}){return e.type.subtask?"is a subtask":e.type.epic?"is an epic":e.status.category==="done"?`is ${e.status.name}`:n.kind==="closed"?"is in a closed sprint":Tt(n)?null:"is not in an active/future sprint or the backlog"}function Jt(e){const n=e.filter(s=>Qe(s));return n.length?`${n.slice(0,2).map(s=>`${s.issue.key} ${Qe(s)}`).join("; ")}${n.length>2?`; ${n.length-2} more blocked`:""}. Remove blocked issues to move the rest.`:e.length>50?"Move up to 50 issues at a time.":""}function Cn(e,n,s){const r=Tt(n),a=e.map(o=>o.issue.key);return!e.length||e.length>50||new Set(a).size!==a.length||!r||e.some(o=>!zt(o.issue,o.group))||s&&a.includes(s.key)||e.every(o=>o.group.id===n.id)&&!s?null:{...a.length===1?{issueKey:a[0]}:{issueKeys:a},target:r,...s?s.side==="before"?{beforeIssue:s.key}:{afterIssue:s.key}:{}}}async function ua(e,n,s){var o;const r=new AbortController,a=window.setTimeout(()=>r.abort(),45e3);try{const d=await e(`board/${encodeURIComponent(n)}/move`,{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify(s),signal:r.signal}),l=(o=d.body)==null?void 0:o.getReader(),c=()=>{l==null||l.cancel().catch(()=>{})};r.signal.addEventListener("abort",c,{once:!0});let u="";try{const g=new TextDecoder;let y=0;for(;l&&!r.signal.aborted;){const x=await l.read();if(x.done)break;if(y+=x.value.byteLength,y>16384)throw new Error("Result too large");u+=g.decode(x.value,{stream:!0})}if(u+=g.decode(),r.signal.aborted)throw new Error("Deadline exceeded")}finally{r.signal.removeEventListener("abort",c),await(l==null?void 0:l.cancel().catch(()=>{}))}if(!d.ok)throw await Or(new Response(u,{status:d.status}));if(d.status===204)return{};const j=JSON.parse(u),h=Fs(s),f=j&&typeof j=="object"&&(s.issueKeys?"issueKeys"in j&&Array.isArray(j.issueKeys)&&j.issueKeys.length===h.length&&j.issueKeys.every((g,y)=>g===h[y]):"issueKey"in j&&j.issueKey===s.issueKey);if(!j||typeof j!="object"||Array.isArray(j)||!("ok"in j)||j.ok!==!0||!f||"notice"in j&&(typeof j.notice!="string"||j.notice.length>1e3))throw new Error("Unconfirmed result");return"notice"in j?{notice:j.notice}:{}}catch(d){throw d instanceof Yt?d:new Yt("network","The move could not be confirmed. Refresh the board before trying again.")}finally{window.clearTimeout(a)}}const Nt=(e,n,s={},r)=>Pr(e,`${n}${Ur(s)}`,{signal:r}),Bs=(e,n,s,r)=>Nt(e,"boards",{startAt:n||void 0,name:s},r),ha=(e,n,s)=>Nt(e,`board/${encodeURIComponent(n)}`,{},s),fa=(e,n,s,r)=>Nt(e,`board/${encodeURIComponent(n)}/closed-sprints`,{startAt:s||void 0},r),Zn=(e,n,s,r)=>Nt(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),ma=(e,n,s)=>Nt(e,`issue/${encodeURIComponent(n)}/subtasks`,{},s),pa=(e,n,s)=>Nt(e,`issue/${encodeURIComponent(n)}`,{},s);function ga(e,n,s){var l;let r;try{r=new URL(s)}catch{return null}const a=typeof((l=e.meta)==null?void 0:l.apiBase)=="string"?e.meta.apiBase:"";let o="";try{o=new URL(e.baseUrl).origin}catch{}if(a&&r.origin===o&&/^\/(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 d=r.protocol==="http:"&&/^(localhost|127\.0\.0\.1|\[::1\])$/.test(r.hostname)&&e.allowedOrigins.includes(r.origin);return r.protocol!=="https:"&&!d?null:n(r.href)}const xn=e=>`sprint:${e.id}`;function es(e,n=[]){const s=[];if(e.hasSprints){for(const r of e.sprints.active)s.push({id:xn(r),kind:"active",title:r.name,sprint:r,defaultOpen:!0,paged:!1});for(const r of e.sprints.future)s.push({id:xn(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:xn(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 Lt(e,n){return Object.hasOwn(n,e.id)?n[e.id]:e.defaultOpen}const Ye=e=>e.kind==="issue"?e.issue.key:e.parent.key;function ja(e,n=new Set){const s=new Map;for(const o of e)!n.has(o.key)&&!s.has(o.key)&&s.set(o.key,o);const r=[],a=new Map;for(const o of s.values()){const d=o.type.subtask&&o.parent?o.parent.key:null;if(d&&d!==o.key){let c=a.get(d);if(!c){const u=s.get(d);u&&!n.has(d)?c={kind:"issue",issue:u,matched:[]}:(c={kind:"context",parent:o.parent,matched:[]},r.push(c)),a.set(d,c)}c.matched.push(o);continue}let l=a.get(o.key);l||(l={kind:"issue",issue:o,matched:[]},a.set(o.key,l)),r.push(l)}for(const o of s.keys())n.add(o);return r}const Zt=e=>e.status.category==="done";function Kn(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 xa(e){return!Zt(e)&&(e.flagged||e.priority!=null&&Kn(e.priority.name)==="highest")}function ba(e){var s;const n=((s=e.resolution)==null?void 0:s.trim())??"";return n&&n.toLowerCase()!==e.status.name.trim().toLowerCase()?n:null}function ya({handedOff:e,narrow:n,focusLost:s,focusOnBack:r}){return s?e||n:n&&r}function Os(e,n){return(!n.hideDone||!Zt(e))&&(!n.attention||xa(e))}const ka=/^only my issues$/i;function wa(e){return e.filter(n=>!ka.test(n.name.trim()))}function Na(e,n){return n?e.key.toLowerCase().includes(n)||e.summary.toLowerCase().includes(n):!0}function va(e,n,s){const r=n.search.trim().toLowerCase();if(!r&&!n.hideDone&&!n.attention)return e.slice();const a=d=>Os(d,n)&&Na(d,r),o=[];for(const d of e){const l=d.matched.filter(a),c=(s==null?void 0:s(Ye(d)))??[],u=l.length>0||c.some(a);d.kind==="issue"?(a(d.issue)||u)&&o.push({...d,matched:l}):u&&o.push({...d,matched:l})}return o}function Ps(e,n,s,r){const a=new Set;return e.map(o=>{const d=n[o.id];return{def:o,data:d,rows:va(ja((d==null?void 0:d.issues)??[],a),r,s)}})}function Rn(e,n){return n[Ye(e)]??e.kind==="context"}function An(e,n,s){return(n==null?void 0:n.status)==="ready"?n.issues.filter(r=>Os(r,s)):e.matched}function Us(e,n){if(e.kind==="context")return!0;const s=e.issue.subtaskKeys;return s.length===0?!1:n||!s.every(r=>e.matched.some(a=>a.key===r))}function $a(e,n,s,r,a,o){const d=new Set;let l=!0,c=null;for(const{def:u,data:j,rows:h}of e)if(Lt(u,n)){if(!j||j.status!=="ready"&&j.status!=="error"&&j.issues.length===0){l=!1;continue}c==null&&l&&h.length>0&&(c=Ye(h[0]));for(const f of h){const g=Ye(f);if(d.add(g),!Rn(f,s))continue;const y=r[g];for(const x of An(f,y,a))d.add(x.key);(y?y.status==="loading":Us(f,o))&&(l=!1)}}return{complete:l,keys:d,first:c}}function Sa(e){return e.flatMap(n=>n.kind==="issue"?[n.issue]:n.matched)}function Ca(e,n){const s=Sa(e),r={new:0,indeterminate:0,done:0},a=new Map;let o=0,d=0,l=null,c=0,u=0;for(const h of s){const f=n==="count"?1:n==="points"?h.points??0:h.estimate??0;if(r[h.status.category]+=f,h.assignee){const g=a.get(h.assignee.id);g?g.n++:a.set(h.assignee.id,{person:h.assignee,n:1})}h.mine&&(o++,h.assignee&&(l=h.assignee.id),Zt(h)&&d++),Zt(h)||(h.flagged&&c++,h.priority&&Kn(h.priority.name)==="highest"&&u++)}const j=[...a.values()].sort((h,f)=>f.n-h.n||h.person.name.localeCompare(f.person.name)).map(h=>h.person);return{count:s.length,totals:r,assignees:j,mine:o,mineDone:d,youId:l,flagged:c,highest:u}}function pt(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),o=Math.round(a*n.daysPerWeek),d=[];for(const[l,c]of[[o,"w"],[a,"d"],[r,"h"],[1,"m"]]){if(l<=0)continue;const u=Math.floor(s/l);u>0&&(d.push(`${u}${c}`),s-=u*l)}return d.join(" ")}function ts(e,n,s){return n==="time"?pt(e,s)||"0m":n==="points"?`${Number.isInteger(e)?e:e.toFixed(1)}`:String(e)}function ns(e){if(!e)return"";const n=new Date(e);return Number.isNaN(n.getTime())?"":n.toLocaleDateString(void 0,{day:"numeric",month:"short"})}function Ra(e,n){const s=pt(e.estimate,n),r=pt(e.timeSpent,n),a=e.remaining!=null&&(e.remaining!==e.estimate||r)?pt(e.remaining,n):"";return[s&&`${s} estimated`,a&&`${a} left`,r&&`${r} logged`].filter(Boolean).join(" · ")}function St(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 Aa(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 La=120,at=new Map,Ln=new Map,Ea=()=>({selection:null,closed:!1,listTop:0,detailTop:0,rows:{},section:null});function _s(e,...n){return[e,...n.map(s=>s??"*")].join("|")}function Dt(e){return at.get(e)??null}function ot(e,n){const s={...at.get(e)??Ea(),...n};for(at.delete(e),at.set(e,s);at.size>La;)at.delete(at.keys().next().value)}function En(e){return Ln.get(e)??""}function Ks(e,n){n?Ln.set(e,n):Ln.delete(e)}function Ma(e,n,s){if(e!=null&&e.closed)return{kind:"none",listTop:e.listTop};if((e==null?void 0:e.selection)!=null){if(n.has(e.selection))return{kind:"restore",selection:e.selection,listTop:e.listTop,detailTop:e.detailTop};if(!n.complete)return{kind:"wait"}}return s?n.first!=null?{kind:"first",selection:n.first}:{kind:"wait"}:{kind:"none",listTop:(e==null?void 0:e.selection)!=null?0:(e==null?void 0:e.listTop)??0}}function ss(e,n){const s=Dt(e);return s!=null&&s.closed?{key:e,selection:null,auto:!1,settled:!0,plan:{list:s.listTop,detail:null}}:{key:e,selection:null,auto:!1,settled:!1,plan:n?null:{list:0,detail:null}}}function Ta(e,n,s){if(e.settled||!n)return e;const r=Ma(Dt(e.key),n,s);return r.kind==="wait"?e:r.kind==="none"?{key:e.key,selection:null,auto:!1,settled:!0,plan:{list:r.listTop,detail:null}}:r.kind==="first"?(ot(e.key,{selection:r.selection,closed:!1,section:null,listTop:0,detailTop:0}),{key:e.key,selection:r.selection,auto:!0,settled:!0,plan:{list:0,detail:0}}):{key:e.key,selection:r.selection,auto:!0,settled:!0,plan:{list:r.listTop,detail:r.detailTop}}}function Da(e,n,s){const r=n==null||e.selection==null||!s(e.selection,n);return ot(e.key,{selection:n,closed:n==null,...r?{section:null,detailTop:0}:{}}),{key:e.key,selection:n,auto:!1,settled:!0,plan:null}}const Xt=typeof window>"u"?i.useEffect:i.useLayoutEffect,Ia=3e3,rs=["wheel","pointerdown","touchstart","keydown"];function Fa(e,n,s){let r=!1,a=0,o=0,d=null;const l=()=>{if(!r){r=!0,cancelAnimationFrame(a),d==null||d.disconnect();for(const u of rs)e.removeEventListener(u,l);s()}},c=()=>{if(r)return;if(!e.isConnected){l();return}if(e.clientHeight===0){!d&&typeof ResizeObserver<"u"&&(d=new ResizeObserver(()=>{e.clientHeight!==0&&(d==null||d.disconnect(),d=null,c())}),d.observe(e));return}o||(o=performance.now()+Ia);const u=Math.max(0,e.scrollHeight-e.clientHeight);if(e.scrollTop=Math.min(n,u),u>=n||performance.now()>=o){l();return}a=requestAnimationFrame(c)};for(const u of rs)e.addEventListener(u,l,{passive:!0});return c(),l}const bn=".ig-detail";function Hs({listKey:e,drawn:n,same:s,sideBySide:r,root:a,listScroller:o}){const[d,l]=i.useState(()=>ss(e,!0));let c=d;d.key!==e&&(c=ss(e,!1),l(c));const u=i.useRef(c);u.current=c;const j=i.useRef(s);j.current=s;const h=i.useRef(!1),f=i.useRef(!1),g=c.plan;Xt(()=>{const k=a.current;if(!g||!k)return;const p=[],T=(L,R,v)=>{const S=v==null?null:k.querySelector(R);!S||v==null||(L.current=!0,p.push(Fa(S,v,()=>{L.current=!1})))};return T(h,o,g.list),T(f,bn,g.detail),()=>{for(const L of p)L()}},[g,a,o]),Xt(()=>{const k=Ta(c,n,r);k!==c&&l(k)},[c,n,r]),i.useEffect(()=>{const k=a.current;if(!k)return;const p=T=>{const L=T.target;L instanceof HTMLElement&&(L.matches(bn)?f.current||ot(u.current.key,{detailTop:L.scrollTop}):L.matches(o)&&(h.current||ot(u.current.key,{listTop:L.scrollTop})))};return k.addEventListener("scroll",p,{capture:!0,passive:!0}),()=>k.removeEventListener("scroll",p,{capture:!0})},[a,o]);const{selection:y,auto:x}=c;Xt(()=>{var p;if(x||!y||f.current)return;const k=(p=a.current)==null?void 0:p.querySelector(bn);ot(u.current.key,{detailTop:(k==null?void 0:k.scrollTop)??0})},[y,x,a]);const m=i.useCallback(k=>l(Da(u.current,k,j.current)),[]);return{selection:y,auto:x,choose:m}}const Ba=5*6e4,Oa=2*6e4,Pa=24,as={shown:!1,sprints:[],total:0,isLast:!1,loading:!1,error:null},Ua={status:"idle",issues:[],next:"",total:null,capped:!1,error:null,more:!1},Pe=new Map,Mn=new Set;function _a(e){for(const[n,s]of Pe)n.startsWith(`${e}|`)&&Pe.set(n,{...s,loadedAt:0});for(const n of Xe.keys())n.startsWith(`${e}|`)&&Xe.delete(n);for(const n of Mn)n(e)}const Ka=(e,n,s)=>`${e}|${n}|${s.mine?"mine":"all"}|${s.quick.join(",")}`;function Ha(e,n){for(Pe.delete(e),Pe.set(e,n);Pe.size>Pa;)Pe.delete(Pe.keys().next().value)}function os(e,n){for(const[s,r]of[...Pe.entries()].reverse())if(s.startsWith(`${e}|${n}|`)&&r.overview)return{overview:r.overview,groups:{},subtasks:{},closed:{...as,shown:r.closed.shown,sprints:r.closed.sprints,total:r.closed.total,isLast:r.closed.isLast},loadedAt:0};return{overview:null,groups:{},subtasks:{},closed:as,loadedAt:0}}function Ge(e){return e instanceof Yt?e:new Yt("upstream",e instanceof Error&&e.message?e.message:"Jira could not be read.")}const Tn=e=>e instanceof DOMException&&e.name==="AbortError",Wa=new Set(["auth","expired","rate-limit","tls","unreachable","incompatible","network","unavailable"]);function ls(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 qa(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 Ga(e,n,s,r){const a=s?Ka(n,s,r):"",[o,d]=i.useState(()=>a&&Pe.get(a)||os(n,s??"")),l=i.useRef(o),[c,u]=i.useState(!1),[j,h]=i.useState(null),f=i.useRef(0),g=i.useRef(null),y=i.useRef(a),x=i.useRef(r);x.current=r;const m=i.useCallback(($,I)=>{if($!==y.current)return;const B=I(l.current);l.current=B,$&&Ha($,B),d(B)},[]),k=i.useCallback(($,I,B)=>{m($,C=>({...C,groups:{...C.groups,[I]:B(C.groups[I]??Ua)}}))},[m]),p=i.useCallback(async($,I,B,C)=>{if(s){k($,I.id,U=>({...U,status:"loading",error:null}));try{const U=await Zn(e,s,ls(I,x.current,B),C);k($,I.id,()=>({status:"ready",issues:U.issues,next:U.next,total:U.total,capped:U.capped,error:null,more:!1}))}catch(U){if(Tn(U)||C.aborted)return;const W=Ge(U);if(k($,I.id,ee=>({...ee,status:"error",error:W,more:!1})),Wa.has(W.kind))throw W}}},[s,e,k]),T=i.useCallback(async()=>{var U;if(!s)return;const $=y.current,I=++f.current;(U=g.current)==null||U.abort();const B=new AbortController;g.current=B;const{signal:C}=B;u(!0),h(null),await(async()=>{try{const W=await ha(e,s,C);if(I!==f.current)return;m($,Y=>({...Y,overview:W,subtasks:{}}));const ee=l.current.closed,se=es(W,ee.shown?ee.sprints:[]),V=se.filter(Y=>Y.kind==="active"||Y.kind==="column"&&Y.column!=="done"),J=se.filter(Y=>!V.includes(Y)&&(Y.kind!=="closed"||l.current.groups[Y.id]));await Promise.all(V.map(Y=>p($,Y,W,C))),await qa(J,3,Y=>C.aborted?Promise.resolve():p($,Y,W,C)),I===f.current&&m($,Y=>({...Y,loadedAt:Date.now()}))}catch(W){if(Tn(W)||C.aborted||I!==f.current)return;B.abort(),h(Ge(W))}finally{I===f.current&&u(!1)}})()},[s,e,p,m]);i.useEffect(()=>{var B;y.current=a;const $=a?Pe.get(a):void 0,I=$??os(n,s??"");if(l.current=I,d(I),h(null),!s){(B=g.current)==null||B.abort(),u(!1);return}(!$||Date.now()-$.loadedAt>Ba)&&T()},[a]),i.useEffect(()=>()=>{var $;($=g.current)==null||$.abort()},[]);const L=i.useCallback(($,I=!1)=>{const B=l.current.overview,C=l.current.groups[$.id];if(!B||C&&C.status!=="idle"&&!(I&&C.status==="error"))return;const U=g.current&&!g.current.signal.aborted?g.current.signal:new AbortController().signal,W=y.current;p(W,$,B,U).catch(ee=>h(Ge(ee)))},[p]),R=i.useCallback($=>{const I=l.current.overview,B=l.current.groups[$.id];if(!s||!I||!B||!B.next||B.more)return;const C=y.current;k(C,$.id,U=>({...U,more:!0,error:null})),(async()=>{try{const U=await Zn(e,s,ls($,x.current,I,B.next));k(C,$.id,W=>{const ee=new Set(W.issues.map(se=>se.key));return{...W,issues:[...W.issues,...U.issues.filter(se=>!ee.has(se.key))],next:U.next,total:U.total??W.total,capped:U.capped,more:!1}})}catch(U){const W=Ge(U);k(C,$.id,ee=>({...ee,more:!1,error:W}))}})()},[s,e,k]),v=i.useCallback($=>{if(!s)return;const I=y.current;m(I,B=>({...B,closed:{...B.closed,shown:!0,loading:!0,error:null}})),(async()=>{try{const B=await fa(e,s,$);m(I,C=>{const U=new Set(C.closed.sprints.map(ee=>ee.id)),W=$===0?B.sprints:[...C.closed.sprints,...B.sprints.filter(ee=>!U.has(ee.id))];return{...C,closed:{...C.closed,sprints:W,total:B.total,isLast:B.isLast,loading:!1,error:null}}})}catch(B){const C=Ge(B);m(I,U=>({...U,closed:{...U.closed,loading:!1,error:C}}))}})()},[s,e,m]),S=i.useCallback($=>{const I=y.current;if(!$){m(I,C=>({...C,closed:{...C.closed,shown:!1}}));return}const B=l.current.closed;B.sprints.length||B.loading?m(I,C=>({...C,closed:{...C.closed,shown:!0}})):v(0)},[v,m]),F=i.useCallback(()=>{const $=l.current.closed;$.loading||$.isLast||v($.sprints.length)},[v]),K=i.useCallback($=>{const I=l.current.subtasks[$];if(I&&I.status!=="error")return;const B=y.current,C=U=>m(B,W=>({...W,subtasks:{...W.subtasks,[$]:U}}));C({status:"loading",issues:(I==null?void 0:I.issues)??[],error:null}),ma(e,$).then(U=>C({status:"ready",issues:U.issues,error:null})).catch(U=>C({status:"error",issues:[],error:Ge(U)}))},[e,m]),w=o.closed,E=o.overview?es(o.overview,w.shown?w.sprints:[]):[];return{snap:o,groups:E,loading:c,error:j,refresh:T,ensureGroup:L,loadMore:R,showClosed:S,moreClosed:F,loadSubtasks:K}}const Xe=new Map;function Va(e,n,s){const r=s?`${n}|${s}`:"",[a,o]=i.useState(()=>{var y;return r?((y=Xe.get(r))==null?void 0:y.data)??null:null}),[d,l]=i.useState(!1),[c,u]=i.useState(null),[j,h]=i.useState(0),f=i.useRef(!1);i.useEffect(()=>{const y=x=>{x===n&&s&&(f.current=!0,h(m=>m+1))};return Mn.add(y),()=>{Mn.delete(y)}},[n,s]),i.useEffect(()=>{if(!s){o(null),u(null);return}const y=Xe.get(r);if(o((y==null?void 0:y.data)??null),u(null),y&&!f.current&&Date.now()-y.at<Oa){l(!1);return}f.current=!1;const x=new AbortController;return l(!0),pa(e,s,x.signal).then(m=>{Xe.set(r,{at:Date.now(),data:m}),Xe.size>60&&Xe.delete(Xe.keys().next().value),o(m)}).catch(m=>{!Tn(m)&&!x.signal.aborted&&u(Ge(m))}).finally(()=>{x.signal.aborted||l(!1)}),()=>x.abort()},[r,e,s,j]);const g=i.useCallback(()=>{f.current=!0,h(y=>y+1)},[]);return{data:a,loading:d,error:c,reload:g}}function za(){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 Ws(){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 Ja(){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 Xa(){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 Hn(){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 qs(){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 Qa({loadedAt:e,loading:n,stale:s},r=Date.now()){const a=e!=null?Es(r-e):null,o=(d,l,c="",u=null)=>({tone:d,word:l,join:c,ago:u,text:`${l}${c}${u??""}`});return n?e!=null?o("updating","Updating…"):o("reading","Reading…"):e==null?o("none",""):s?o("stale","Not updated"," · last answer ",a):o("updated","Updated"," ",a)}function Ya(e,n){return e==="reading"||e==="updating"?"Updating…":n?e==="stale"?"Not updated":e==="updated"?"Updated":"":""}function Gs({loadedAt:e,loading:n,stale:s=!1,onRefresh:r,label:a,disabled:o=!1,now:d}){const[,l]=i.useState(0),c=i.useRef(n);c.current=n;const[u,j]=i.useState(!1);i.useEffect(()=>{if(e==null)return;const g=window.setInterval(()=>l(y=>y+1),3e4);return()=>window.clearInterval(g)},[e]),i.useEffect(()=>{n&&j(!0)},[n]);const h=Qa({loadedAt:e,loading:n,stale:s},d??Date.now()),f=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(Ws,{}),t.jsx("span",{className:"ig-fresh-word",children:h.word}),h.join,f&&h.ago&&t.jsx("time",{dateTime:f.toISOString(),title:f.toLocaleString(),children:h.ago})]}),t.jsx("span",{className:"vis-hidden",role:"status",children:Ya(h.tone,u)}),t.jsx("button",{type:"button",className:"glyph-btn ig-refresh","aria-label":a,title:"Refresh",...Ce(n,o),"data-loading":n||void 0,onClick:()=>{we(c.current)&&r()},children:t.jsx(_r,{})})]})}function Wn({value:e,onChange:n,label:s,placeholder:r,inputRef:a,onKeyDown:o}){const d=i.useRef(null),l=a??d,[c,u]=i.useState(!1),j=c&&e!=="",h=i.useRef(n);return h.current=n,i.useEffect(()=>{if(j)return Ls.push(()=>h.current(""),0,"popover")},[j]),t.jsxs("div",{className:"ig-search","data-filled":e!==""||void 0,children:[t.jsx(za,{}),t.jsx("input",{ref:l,type:"search",className:"ig-search-input","aria-label":s,placeholder:r,value:e,onChange:f=>n(f.target.value),onKeyDown:o,onFocus:()=>u(!0),onBlur:()=>u(!1)}),e!==""&&t.jsx("button",{type:"button",className:"glyph-btn ig-search-clear","aria-label":"Clear the search",title:"Clear",onClick:()=>{var f;n(""),(f=l.current)==null||f.focus()},children:t.jsx(qs,{})})]})}function sn({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))]})}const Vt=new Set;function yn(e,n,s){for(const r of[e,n])if(r&&!s.has(r))return r;return null}function Vs(e){return{width:e,height:e,"--ig-avatar-size":`${e}px`}}function Ot({src:e,direct:n,name:s,size:r=20,you:a=!1,className:o=""}){const[d,l]=i.useState(()=>yn(e,n,Vt));i.useEffect(()=>l(yn(e,n,Vt)),[e,n]);const c=Vs(r),u=a||void 0;return d?t.jsx("img",{className:`ig-avatar ${o}`.trim(),style:c,src:d,alt:"","aria-hidden":!0,referrerPolicy:"no-referrer",loading:"lazy",decoding:"async",draggable:!1,"data-you":u,onError:()=>{Vt.add(d),l(yn(e,n,Vt))}}):t.jsx("span",{className:`ig-avatar ig-avatar-initials ${o}`.trim(),"data-large":r>=28||void 0,"data-you":u,style:c,"aria-hidden":!0,children:Kr(s)})}function zs({size:e=20}){return t.jsx("span",{className:"ig-avatar ig-avatar-none",style:Vs(e),"aria-hidden":!0})}function Js({src:e,direct:n,name:s,size:r=20,you:a=!1,nameless:o=!1}){return t.jsxs("span",{className:"ig-person",title:o?s:void 0,children:[t.jsx(Ot,{src:e,direct:n,name:s,size:r,you:a}),o?t.jsx("span",{className:"vis-hidden",children:s}):t.jsx("span",{className:"ig-person-name",children:s})]})}function Za(e){return e.length<=1?e[0]??"":e.length===2?`${e[0]} and ${e[1]}`:`${e.slice(0,-1).join(", ")} and ${e[e.length-1]}`}function Xs({people:e,max:n=3,size:s=20,label:r}){if(!e.length)return null;const a=e.map(c=>c.name),o=e.length>n?e.slice(0,n):e,d=e.length-o.length,l=Za(a);return t.jsxs("span",{className:"ig-stack",role:"img","aria-label":r?`${r} ${l}`:l,title:a.join(", "),children:[o.map(c=>t.jsx(Ot,{src:c.src,direct:c.direct,name:c.name,size:s,you:c.you},c.key)),d>0&&t.jsxs("span",{className:"ig-stack-more","aria-hidden":!0,children:["+",d]})]})}function eo(e){switch(e){case"auth":case"expired":return"reconnect";case"permission":case"incompatible":return"settings";case"not-found":return"none";default:return"retry"}}function to(e){return e==="reconnect"?"Reconnect":e==="settings"?"Open connection settings":"Try again"}function Qs(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 no(e,n,s=n,r=Date.now()){var o;const a=((o=e.message)==null?void 0:o.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 ${Qs(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 so(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 ro(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 bt({error:e,provider:n,host:s,stale:r=!1,onRetry:a,onReconnect:o,title:d,body:l,children:c,now:u}){const[j,h]=i.useState(()=>u??Date.now()),[f,g]=i.useState(()=>u??Date.now());i.useEffect(()=>{const F=Date.now();h(F),g(F)},[e]);const y=u??f,x=ro(e,j,y);i.useEffect(()=>{if(x<=0)return;const F=window.setTimeout(()=>g(Date.now()),1e3);return()=>window.clearTimeout(F)},[x,f]);const m=no(e,n,s,y),k=d??m.title,p=l??m.body,T=so(e,p),L=eo(e.kind),R=L==="retry"?a:L==="none"?void 0:o,v=L==="none"?"":to(L),S=L==="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(Ws,{}):t.jsx(Ja,{}),t.jsx("strong",{children:k})]}),p&&t.jsx("p",{className:"ig-failure-body",children:p}),T&&!r&&t.jsxs("p",{className:"ig-failure-said",children:[n," said: ",T]})]}),(R||c)&&t.jsxs("div",{className:"ig-failure-actions",children:[R&&t.jsx("button",{type:"button",className:S?"btn primary":"btn","aria-disabled":x>0||void 0,onClick:()=>{x<=0&&R()},children:x>0?`${v} ${Qs(x,y)}`:v}),c]})]})}const kn=new Set;function Ys({src:e,label:n,fallback:s,className:r="jr-icon"}){const[a,o]=i.useState(()=>!e||kn.has(e));return i.useEffect(()=>o(!e||kn.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:()=>{kn.add(e),o(!0)}})}function ao(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 oo={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 lo({type:e,subtask:n}){const s=e.epic?"epic":ao(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"}),oo[s]]})}const io={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 co({priority:e}){const n=Kn(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:io[n]})]}):t.jsx("span",{className:"jr-icon",title:`Priority: ${e.name}`,"aria-hidden":!0})}const rn=({type:e,subtask:n})=>t.jsx(Ys,{src:e.icon,label:e.name,fallback:t.jsx(lo,{type:e,subtask:n})}),qn=({priority:e})=>e?t.jsx(Ys,{src:e.icon,label:`Priority: ${e.name}`,fallback:t.jsx(co,{priority:e})}):t.jsx("span",{className:"jr-icon","aria-hidden":!0});function Zs({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 an({status:e}){return t.jsx("span",{className:"jr-status ig-chip","data-cat":e.category,title:e.name,children:e.name})}function uo({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=pt(e.estimate,s),a=e.remaining!=null&&e.remaining!==e.estimate?pt(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 er(){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 Dn({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"})})}function ho({items:e,groups:n,snap:s,anchorId:r,portalId:a,boundaryId:o,busy:d,onMove:l,onClose:c,error:u,initialView:j="move"}){const h=i.useId(),f=i.useRef(d);f.current=d;const g=i.useRef(!1),[y,x]=i.useState(j),[m,k]=i.useState(e[0].group.id),[p,T]=i.useState(""),L=y==="menu",R=n.filter(C=>Tt(C)),v=R.find(C=>C.id===m),S=v?s.groups[v.id]:void 0,F=new Set(e.map(C=>C.issue.key)),K=((S==null?void 0:S.issues)??[]).filter(C=>!F.has(C.key)&&!C.type.subtask&&!C.type.epic),w=p?{key:p.slice(p.indexOf(":")+1),side:p.startsWith("before:")?"before":"after"}:void 0,E=v?Cn(e,v,w):null,$=e.length===1?Qe(e[0]):null,I=$?`${e[0].issue.key} ${$}. This issue cannot be moved.`:Jt(e),B=async()=>{if(!(!E||!v||!we(f.current||g.current))){g.current=!0;try{await l(E,v)}finally{g.current=!1}}};return t.jsx(nn,{anchorId:r,portalRootId:a,boundaryId:o??a,id:`${h}-popover`,className:L?"jr-actions-pop":"jr-move-pop",role:L?"menu":"dialog",labelledBy:L?r:`${h}-title`,onClose:c,children:L?t.jsxs(t.Fragment,{children:[t.jsx("button",{type:"button",className:"jr-action-item",role:"menuitem","aria-disabled":!!I||d,"aria-describedby":I?`${h}-problem`:void 0,onClick:()=>{!I&&we(f.current||g.current)&&x("move")},children:e.length===1?"Move…":`Move ${e.length} issues…`}),I&&t.jsx("p",{id:`${h}-problem`,className:"jr-action-hint",children:I})]}):t.jsxs("form",{onSubmit:C=>{C.preventDefault(),B()},children:[t.jsxs("h3",{id:`${h}-title`,children:["Move ",e.length===1?e[0].issue.key:`${e.length} issues`]}),t.jsx("label",{htmlFor:`${h}-destination`,children:"Destination"}),t.jsx("select",{id:`${h}-destination`,value:m,...Ce(d),autoFocus:!0,onChange:C=>{we(f.current||g.current)&&(k(C.target.value),T(""))},children:R.map(C=>t.jsx("option",{value:C.id,children:C.title},C.id))}),t.jsx("label",{htmlFor:`${h}-position`,children:"Position"}),t.jsxs("select",{id:`${h}-position`,value:p,...Ce(d),onChange:C=>{we(f.current||g.current)&&T(C.target.value)},children:[t.jsx("option",{value:"",children:e.every(C=>C.group.id===m)?"Choose a position":"Keep current rank"}),K.map(C=>t.jsxs("option",{value:`before:${C.key}`,children:["Before ",C.key," — ",C.summary]},C.key)),K.length>0&&t.jsxs("option",{value:`after:${K[K.length-1].key}`,children:["After ",K[K.length-1].key]})]}),t.jsxs("p",{className:"jr-move-help",children:["Saved in Jira. Status stays the same. ",S!=null&&S.next||S!=null&&S.capped||!S||S.status!=="ready"?"Positions are limited to issues already loaded.":""]}),u&&t.jsx("p",{className:"jr-move-error",role:"alert",children:u}),t.jsxs("div",{className:"jr-move-actions",children:[t.jsx("button",{type:"button",className:"btn",onClick:c,children:"Cancel"}),t.jsx("button",{type:"submit",className:"btn primary",...Ce(d,!E),children:d?"Moving…":e.length===1?"Move issue":`Move ${e.length} issues`})]})]})})}function is({item:e,portalRootId:n,children:s}){const r=e.fixVersions??[],a=o=>{var d;return(d=o.closest(".jr-board"))!=null&&d.querySelector("[data-dragging]")?!1:r.length>1?!0:Array.from(o.querySelectorAll(".jr-key, .jr-summary, .jr-version, .jr-epic")).some(l=>l.getClientRects().length===0||l.scrollWidth>l.clientWidth+1||l.classList.contains("jr-summary")&&l.scrollHeight>l.clientHeight+2)};return t.jsx(Hr,{className:"jr-row-preview",portalRootId:n,placement:"reading",focusDelay:250,shouldShow:a,detail:t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"jr-preview-key",children:e.key}),t.jsx("div",{className:"jr-preview-summary",children:e.summary}),(r.length>0||e.epic)&&t.jsxs("dl",{children:[r.length>0&&t.jsxs(t.Fragment,{children:[t.jsx("dt",{children:r.length===1?"Version":"Versions"}),t.jsx("dd",{children:r.join(", ")})]}),e.epic&&t.jsxs(t.Fragment,{children:[t.jsx("dt",{children:"Epic"}),t.jsxs("dd",{children:[e.epic.key,": ",e.epic.name]})]})]})]}),children:s})}const cs={new:"To do",indeterminate:"In progress",done:"Done"},fo=["new","indeterminate","done"],ds=e=>e<=30;function mo({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 d=n.new+n.indeterminate+n.done;if(d<=0)return null;const l=ts(d,s,r);return t.jsx("span",{className:"jr-totals",children:t.jsxs("span",{className:"jr-total",title:`Total: ${l} ${a}`,children:["Total ",l]})})}const o=fo.filter(d=>n[d]>0);return o.length===0?null:t.jsx("span",{className:"jr-totals",children:o.map(d=>{const l=ts(n[d],s,r);return t.jsxs("span",{className:"jr-total","data-cat":d,title:`${cs[d]}: ${l} ${a}`,children:[cs[d]," ",l]},d)})})}function po({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(i.Fragment,{children:[a>0&&t.jsx("span",{"aria-hidden":!0,children:" · "}),t.jsx("span",{title:r.title,children:r.text})]},r.key))})}function us(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.priority?`, priority ${e.priority.name}`:""}${e.flagged?", flagged":""}${n}`}function hs({issue:e,estimation:n,time:s}){const r=e.status.category==="done";return t.jsxs(t.Fragment,{children:[t.jsx(rn,{type:e.type}),t.jsx(qn,{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(er,{})}),e.fixVersions.length>0&&t.jsx("span",{className:"jr-version",title:e.fixVersions.join(", "),children:e.fixVersions.length===1?e.fixVersions[0]:`${e.fixVersions.length} versions`}),e.epic&&t.jsx(Zs,{epic:e.epic})]}),t.jsx(uo,{issue:e,estimation:n,time:s}),t.jsx("span",{className:"jr-status-cell",children:t.jsx(an,{status:e.status})})]}),t.jsx("span",{className:"jr-assignee",title:e.assignee?`${e.assignee.name}${e.mine?" (you)":""}`:"Unassigned",children:e.assignee?t.jsx(Ot,{src:e.assignee.avatar,name:e.assignee.name,size:20,you:e.mine}):t.jsx(zs,{size:20})})]})}function go(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 jo(e){var Xn;const{conn:n,overview:s,groups:r,snap:a,expanded:o,onToggleGroup:d,filter:l,mine:c,filtered:u,selected:j,onOpen:h,rowsOpen:f,onToggleRow:g,onRetryGroup:y,onMore:x,onShowClosed:m,onMoreClosed:k,loadSubtasks:p,onReconnect:T,onMove:L,moveBusy:R=!1}=e,v=i.useRef(null),S=i.useId(),F=i.useRef(null),K=i.useRef(!1),[w,E]=i.useState([]),[$,I]=i.useState(()=>new Set),[B,C]=i.useState(!1),U=i.useRef(null),W=i.useRef(0),[ee,se]=i.useState(null),[V,J]=i.useState(null),Y=i.useRef(0),[ve,me]=i.useState(""),[dt,_e]=i.useState(""),$e=i.useRef(!1),Le=i.useRef(!1);Le.current=R;const Ke=i.useRef(!1);Ke.current=a.closed.loading;const P=((Xn=s.moves)==null?void 0:Xn.enabled)===!0&&!!L,be=(b,N,_,q=!1,O="move")=>{if(!we(Le.current||$e.current))return;const X=$.has(b.key)?Se:[{issue:b,group:N}];if(O==="move"&&(X.length>50||X.some(z=>!zt(z.issue,z.group)))){me(Jt(X));return}Y.current++,me(""),J({issue:b,items:X,anchorId:_,keyboard:q,initialView:O})},tt=()=>{const b=V;$e.current&&b&&!document.getElementById(b.anchorId)||Y.current++,J(null),b!=null&&b.keyboard&&requestAnimationFrame(()=>{var _,q;document.activeElement===document.getElementById(b.anchorId)&&((q=Array.from(((_=v.current)==null?void 0:_.querySelectorAll(".jr-row-main[data-key]"))??[]).find(O=>O.dataset.key===b.issue.key))==null||q.focus())})},he=()=>{F.current=null,E([]),se(null)},Ee=async(b,N)=>{if(!L||R||$e.current)return!1;const _=Y.current,q=W.current,O=Fs(b),X=O.length===1?O[0]:`${O.length} issues`,z=document.activeElement,te=z==null?void 0:z.closest(".jr-move-pop");$e.current=!0,me(""),_e(`Moving ${X}…`);try{const de=await L(b);_e(de.notice||`${X} moved to ${N.title}.`),q===W.current&&I(new Set(O));const ye=_===Y.current&&(document.activeElement===z||!!(te!=null&&te.contains(document.activeElement))||document.activeElement===document.body&&(!(z!=null&&z.isConnected)||(te==null?void 0:te.isConnected)));return _===Y.current&&J(null),d(N,!0),ye&&requestAnimationFrame(()=>{var Fe,st;(st=Array.from(((Fe=v.current)==null?void 0:Fe.querySelectorAll(".jr-row-main[data-key]"))??[]).find(ht=>{var G;return ht.dataset.key===O[0]&&((G=ht.dataset.nav)==null?void 0:G.startsWith(`${N.id}/`))})??document.getElementById(`jr-group-${N.id.replace(/[^a-z0-9]/gi,"-")}-toggle`))==null||st.focus()}),!0}catch(de){return _e(""),me(de instanceof Error?de.message:"The move could not be confirmed. Refresh before trying again."),!1}finally{$e.current=!1}},He=(b,N)=>{!F.current||!P||R||!Tt(N)||(b.preventDefault(),b.dataTransfer.dropEffect="move",se({group:N.id}))},nt=(b,N)=>{const _=F.current;if(!_||!P||R)return;b.preventDefault();const q=Cn(_.items,N);he(),q&&Ee(q,N)},[A,re]=i.useState(()=>new Set),[pe,xe]=i.useState(()=>new Set),[Me,Te]=i.useState(null),De=s.estimation.kind,ut=s.timeTracking,ge=i.useMemo(()=>Ps(r,a.groups,b=>{var N;return(N=a.subtasks[b])==null?void 0:N.issues},l).map(b=>({...b,stats:Ca(b.rows,De)})),[r,a.groups,a.subtasks,l,De]),ze=b=>Rn(b,f),je=i.useMemo(()=>{const b=[],N=new Set,_=(q,O)=>{N.has(q.key)||(N.add(q.key),b.push({issue:q,group:O}))};for(const{def:q,rows:O}of ge)if(Lt(q,o)){for(const X of O)if(X.kind==="issue"&&_(X.issue,q),Rn(X,f))for(const z of An(X,a.subtasks[Ye(X)],l))_(z,q)}return b},[ge,o,f,a.subtasks,l]),Kt=je.map(b=>b.issue.key),Se=je.filter(b=>$.has(b.issue.key)),$t=Se.filter(b=>Qe(b)),Je=Jt(Se);i.useEffect(()=>{const b=new Set(je.map(N=>N.issue.key));I(N=>[...N].every(_=>b.has(_))?N:new Set([...N].filter(_=>b.has(_)))),U.current&&!b.has(U.current)&&(U.current=null)},[je]);const We=(b,N,_=!1)=>{const q=N.ctrlKey||N.metaKey,O=q||N.shiftKey||_,X=U.current;W.current++,I(z=>da(z,Kt,b,X,N.shiftKey?q?"add-range":"range":q||_?"toggle":"replace")),N.shiftKey||(U.current=b),C(O),O||h(b)};i.useEffect(()=>{for(const{def:b,rows:N}of ge)if(Lt(b,o))for(const _ of N){if(!ze(_))continue;const q=Ye(_);a.subtasks[q]||!Us(_,u)||p(q)}},[ge,f,o]);const gn=(b,N)=>{N&&xe(_=>new Set(_).add(b)),g(b,N)},jn=()=>{var b;return Array.from(((b=v.current)==null?void 0:b.querySelectorAll("[data-nav]"))??[])},qe=b=>{var N;b&&(b.focus(),(N=b.scrollIntoView)==null||N.call(b,{block:"nearest"}))},Ht=b=>{var X,z;const N=b.target;if(N.dataset.key&&b.key===" "&&!b.altKey){b.preventDefault(),b.repeat||We(N.dataset.key,b,!0);return}if(!N.dataset.nav||b.altKey||b.ctrlKey||b.metaKey)return;const _=jn(),q=_.indexOf(N),O=N.getAttribute("data-expanded");switch(b.key){case"ArrowDown":b.preventDefault(),qe(_[Math.min(_.length-1,q+1)]);return;case"ArrowUp":b.preventDefault(),qe(_[Math.max(0,q-1)]);return;case"Home":b.preventDefault(),qe(_[0]);return;case"End":b.preventDefault(),qe(_[_.length-1]);return;case"ArrowRight":O==="false"?(b.preventDefault(),(X=document.getElementById(N.dataset.toggle??""))==null||X.click()):O==="true"&&(b.preventDefault(),qe(_[q+1]));return;case"ArrowLeft":O==="true"?(b.preventDefault(),(z=document.getElementById(N.dataset.toggle??""))==null||z.click()):N.dataset.parent&&(b.preventDefault(),qe(_.find(te=>te.dataset.nav===N.dataset.parent)));return}},M=i.useMemo(()=>{for(const{def:b,rows:N}of ge)if(Lt(b,o)&&N.length>0)return`${b.id}/${Ye(N[0])}`;return ge.length?`g:${ge[0].def.id}`:null},[ge,o]);i.useEffect(()=>{var b;Me&&!((b=v.current)!=null&&b.querySelector(`[data-nav="${CSS.escape(Me)}"]`))&&Te(null)});const H=b=>b===(Me??M)?0:-1,ae=(b,N,_,q)=>{const O=Ye(b),X=`${N.id}/${O}`,z=ze(b),te=a.subtasks[O],de=b.kind==="issue"?b.issue.subtaskKeys.length:0,ye=de>0||b.matched.length>0||b.kind==="context",Ie=`jr-toggle-${N.id.replace(/[^a-z0-9]/gi,"-")}-${O}`,Fe=An(b,te,l),st=((te==null?void 0:te.status)==="ready"?te.issues:b.matched).filter(D=>D.mine).length,ht=b.kind==="issue"?us(b.issue,ye?`, ${de||b.matched.length} sub-tasks${st?`, ${st} yours`:""}`:""):`${b.parent.key}: ${b.parent.summary}. ${c?"Not assigned to you":"Parent not in this list"}; shown for ${b.matched.length} sub-task${b.matched.length===1?"":"s"}`,G=b.kind==="issue"?b.issue:null,le=P&&G&&zt(G,N)&&_===0,ft=`${S}-move-${N.id}-${O}`,qt=`${ft}-row`,Gt=P&&G&&_===0;return t.jsxs("li",{className:"jr-item","data-context":b.kind==="context"||void 0,children:[t.jsxs("div",{className:"jr-row ig-row","data-selected":$.has(O)||j===O||void 0,"data-picked":$.has(O)||void 0,"data-done":(G==null?void 0:G.status.category)==="done"||void 0,"data-current":j===O||void 0,"data-move-blocked":!!(G&&$.has(O)&&Qe({issue:G,group:N}))||void 0,"data-mine":(G==null?void 0:G.mine)||void 0,"data-dragging":w.includes(O)||void 0,"data-drop":(ee==null?void 0:ee.group)===N.id&&ee.key===O?ee.side:void 0,draggable:!!(le&&!R),onPointerDown:D=>{K.current=!!D.target.closest(".jr-toggle, .jr-move-button")},onDragStart:D=>{if(!le||R||!G||K.current){D.preventDefault();return}const fe=$.has(O)?Se:[{issue:G,group:N}];if(fe.length>50||fe.some(ie=>!zt(ie.issue,ie.group))){D.preventDefault(),me(Jt(fe));return}$.has(O)||(W.current++,I(new Set([O])),C(!1)),F.current={items:fe},D.dataTransfer.effectAllowed="move",D.dataTransfer.setData("text/plain",fe.map(ie=>ie.issue.key).join(`
2
2
  `)),E(fe.map(ie=>ie.issue.key)),J(null)},onDragEnd:he,onDragOver:D=>{if(!F.current||!P||R||!G||G.type.subtask||!Tt(N))return;if(D.stopPropagation(),F.current.items.some(ie=>ie.issue.key===O)){se(null);return}D.preventDefault(),D.dataTransfer.dropEffect="move";const fe=D.currentTarget.getBoundingClientRect();se({group:N.id,key:O,side:D.clientY<fe.top+fe.height/2?"before":"after"})},onDrop:D=>{const fe=F.current;if(!fe||!P||R||!G||G.type.subtask)return;D.preventDefault(),D.stopPropagation();const ie=D.currentTarget.getBoundingClientRect(),Tr=D.clientY<ie.top+ie.height/2?"before":"after",Qn=Cn(fe.items,N,{key:O,side:Tr});he(),Qn&&Ee(Qn,N)},children:[ye?t.jsx("button",{type:"button",id:Ie,className:"jr-toggle",tabIndex:-1,"aria-expanded":z,"aria-label":`${z?"Hide":"Show"} sub-tasks of ${O}`,onClick:()=>gn(O,!z),children:t.jsx(Dn,{open:z})}):t.jsx("span",{className:"jr-toggle-space","aria-hidden":!0}),t.jsx(is,{item:b.kind==="issue"?b.issue:b.parent,portalRootId:S,children:t.jsx("button",{type:"button",id:qt,className:"jr-row-main","aria-haspopup":Gt?"menu":void 0,"data-nav":X,"data-key":O,"data-parent":q,"data-toggle":ye?Ie:void 0,"data-has-meta":G?!!(G.flagged||G.fixVersions.length||G.epic)||void 0:!0,"data-expanded":ye?String(z):void 0,"aria-expanded":ye?z:void 0,"aria-controls":ye&&z?`${Ie}-children`:void 0,"aria-describedby":`${S}-instructions`,tabIndex:H(X),"aria-current":j===O||void 0,onKeyDown:D=>{if(Gt&&!R&&(D.key==="ContextMenu"||D.shiftKey&&D.key==="F10")){D.preventDefault(),D.stopPropagation(),be(G,N,qt,!1,"menu");return}le&&!R&&D.altKey&&!D.ctrlKey&&!D.metaKey&&(D.code==="KeyM"||D.key.toLowerCase()==="m")&&G&&(D.preventDefault(),D.stopPropagation(),be(G,N,qt,!0))},"aria-label":`${ht}${$.has(O)?". Selected":""}`,onFocus:()=>Te(X),onClick:D=>{G?(D.preventDefault(),We(O,D)):!D.ctrlKey&&!D.metaKey&&!D.shiftKey&&(I(new Set),C(!1),h(O))},onContextMenu:D=>{G&&D.ctrlKey?(D.preventDefault(),D.currentTarget.focus(),We(O,D)):Gt&&!R&&(D.preventDefault(),D.currentTarget.focus(),be(G,N,qt,!1,"menu"))},children:G?t.jsx(hs,{issue:G,estimation:De,time:ut}):b.kind==="context"&&t.jsxs(t.Fragment,{children:[t.jsx(rn,{type:b.parent.type}),t.jsx(qn,{priority:b.parent.priority}),t.jsx("span",{className:"jr-key","data-done":b.parent.status.category==="done"||void 0,children:b.parent.key}),t.jsx("span",{className:"jr-summary",children:b.parent.summary}),t.jsxs("span",{className:"jr-facts",children:[t.jsx("span",{className:"jr-meta",children:t.jsx("span",{className:"jr-context-tag",children:c?"not assigned to you":"parent not in this list"})}),t.jsx("span",{className:"jr-status-cell",children:t.jsx(an,{status:b.parent.status})})]})]})})}),Gt&&t.jsx("button",{id:ft,type:"button",className:"jr-move-button",...Ce(R),"aria-label":`Actions for ${O}`,title:`Actions for ${O}`,"aria-haspopup":"menu","aria-expanded":(V==null?void 0:V.anchorId)===ft,tabIndex:H(X),onKeyDown:D=>{(D.key==="ArrowDown"||D.key==="ArrowUp")&&(D.preventDefault(),D.stopPropagation(),be(G,N,ft,!1,"menu"))},onClick:()=>{we(Le.current||$e.current)&&((V==null?void 0:V.anchorId)===ft?tt():be(G,N,ft,!1,"menu"))},children:t.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"currentColor","aria-hidden":"true",children:[t.jsx("circle",{cx:"3",cy:"8",r:"1.2"}),t.jsx("circle",{cx:"8",cy:"8",r:"1.2"}),t.jsx("circle",{cx:"13",cy:"8",r:"1.2"})]})})]}),ye&&z&&t.jsxs("ul",{id:`${Ie}-children`,className:"jr-subrows",role:"list","aria-label":`Sub-tasks of ${O}`,"data-fade":pe.has(O)&&ds(Fe.length)||void 0,children:[(te==null?void 0:te.status)==="loading"&&Fe.length===0&&t.jsx("li",{className:"jr-subnote",role:"status",children:"Reading sub-tasks…"}),(te==null?void 0:te.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:()=>p(O),children:"Try again"})]}),Fe.map(D=>{const fe=`${N.id}/${D.key}/${X}`;return t.jsx("li",{className:"jr-item",children:t.jsxs("div",{className:"jr-row jr-subrow ig-row","data-selected":$.has(D.key)||j===D.key||void 0,"data-picked":$.has(D.key)||void 0,"data-done":D.status.category==="done"||void 0,"data-current":j===D.key||void 0,"data-move-blocked":!!($.has(D.key)&&Qe({issue:D,group:N}))||void 0,"data-mine":D.mine||void 0,children:[t.jsx("span",{className:"jr-toggle-space","aria-hidden":!0}),t.jsx(is,{item:D,portalRootId:S,children:t.jsx("button",{type:"button",className:"jr-row-main","data-nav":fe,"data-key":D.key,"data-parent":X,tabIndex:H(fe),"data-has-meta":!!(D.flagged||D.fixVersions.length||D.epic)||void 0,"aria-current":j===D.key||void 0,"aria-label":`${us(D)}${$.has(D.key)?". Selected":""}`,"aria-describedby":`${S}-instructions`,onFocus:()=>Te(fe),onClick:ie=>{ie.preventDefault(),We(D.key,ie)},onContextMenu:ie=>{ie.ctrlKey&&(ie.preventDefault(),ie.currentTarget.focus(),We(D.key,ie))},children:t.jsx(hs,{issue:D,estimation:De,time:ut})})})]})},D.key)}),(te==null?void 0:te.status)==="ready"&&Fe.length===0&&t.jsx("li",{className:"jr-subnote",children:l.attention?"No sub-task needs attention.":l.hideDone?"Every sub-task is done.":"No sub-tasks."})]})]},O)},Wt=s.hasSprints,Lr=Wt&&s.sprints.active.length===0,oe=a.closed,Er=ge.findIndex(b=>b.def.kind==="closed"),Mr=i.useMemo(()=>go(a),[a]);return t.jsxs("div",{className:"jr-board",id:S,ref:v,onKeyDown:Ht,style:{"--jr-status-ch":Mr},children:[t.jsxs("p",{className:"vis-hidden",id:`${S}-instructions`,children:["Use Up and Down to navigate, Right to expand and Left to collapse. Enter opens the issue. Ctrl or Command click toggles selection; Shift click selects a range. Space toggles the focused issue.",P?" Drag selected issues to reorder or change sprint. Right-click or Shift+F10 opens actions. Alt+M opens Move.":""]}),B&&Se.length>0&&t.jsxs("div",{className:"jr-selection",role:"group","aria-label":"Selected issues",children:[t.jsxs("span",{role:"status",children:[Se.length," selected"]}),P&&t.jsx("button",{type:"button",className:"btn",id:`${S}-move-selected`,...Ce(R,!!Je),"aria-haspopup":"dialog","aria-expanded":(V==null?void 0:V.anchorId)===`${S}-move-selected`,onClick:()=>{Je||be(Se[0].issue,Se[0].group,`${S}-move-selected`)},children:"Move selected"}),t.jsx("button",{type:"button",className:"btn","aria-label":"Clear selection",onClick:()=>{W.current++,I(new Set),C(!0),U.current=null},children:"Clear"}),Je&&P&&t.jsx("span",{className:"jr-selection-note",id:`${S}-blocked`,children:Je}),$t.length>0&&P&&t.jsxs("button",{type:"button",className:"btn",onClick:()=>{W.current++,I(new Set(Se.filter(b=>!Qe(b)).map(b=>b.issue.key))),me("")},children:["Remove blocked (",$t.length,")"]})]}),t.jsx("p",{className:"jr-move-status",role:"status","aria-live":"polite",children:dt}),ve&&!V&&t.jsx("p",{className:"jr-move-error",role:"alert",children:ve}),Lr&&t.jsx("p",{className:"jr-board-note",children:"No sprint is active on this board. The future sprints and the backlog are below."}),ge.map(({def:b,data:N,rows:_,stats:q},O)=>{const X=Lt(b,o),z=`jr-group-${b.id.replace(/[^a-z0-9]/gi,"-")}`,te=`g:${b.id}`,de=b.sprint,ye=de&&(de.startDate||de.endDate)?`${ns(de.startDate)||"?"} – ${ns(de.completeDate??de.endDate)||"?"}`:"",Ie=(N==null?void 0:N.status)==="ready"||((N==null?void 0:N.issues.length)??0)>0,Fe=(N==null?void 0:N.total)!=null&&b.paged&&N.total>q.count&&!l.search&&!l.hideDone&&!l.attention,st=b.kind==="closed"&&(!N||N.status==="idle"),ht=Ie?Fe?`${q.count} of ${N.total}`:`${q.count}`:(N==null?void 0:N.status)==="error"?"":"…",G=q.assignees;return t.jsxs(i.Fragment,{children:[O===Er&&t.jsx("h3",{className:"jr-closed-title",children:"Closed sprints"}),t.jsxs("section",{className:"jr-group","data-kind":b.kind,"aria-labelledby":`${z}-title`,"data-drop-group":(ee==null?void 0:ee.group)===b.id&&!ee.key||void 0,onDragOver:le=>He(le,b),onDrop:le=>nt(le,b),children:[t.jsxs("div",{className:"jr-group-head",children:[t.jsx("h3",{className:"jr-group-title",id:`${z}-title`,children:t.jsxs("button",{type:"button",id:`${z}-toggle`,className:"jr-group-toggle","data-nav":te,"data-toggle":`${z}-toggle`,"data-expanded":String(X),"aria-expanded":X,"aria-controls":z,tabIndex:H(te),onFocus:()=>Te(te),onClick:()=>{X||re(le=>new Set(le).add(b.id)),d(b,!X)},children:[t.jsx(Dn,{open:X}),t.jsxs("span",{className:"jr-group-identity",children:[t.jsx("span",{className:"jr-group-name",children:b.title}),b.kind==="active"&&t.jsx("span",{className:"jr-badge",children:"Active"}),ye&&t.jsx("span",{className:"jr-group-dates",children:ye}),st?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:[ht," ",Ie?q.count===1&&!Fe?"issue":"issues":t.jsx("span",{className:"vis-hidden",children:"issues, not read yet"})]})]})]})}),Ie&&t.jsxs("div",{className:"jr-group-facts",children:[t.jsx(po,{stats:q,mine:c}),t.jsx(Xs,{label:"Assigned to",people:G.map(le=>({key:le.id,name:le.name,src:le.avatar,you:le.id===q.youId}))}),t.jsx(mo,{def:b,totals:q.totals,estimation:De,time:ut})]})]}),(de==null?void 0:de.goal)&&X&&t.jsx("p",{className:"jr-goal",children:de.goal}),X&&t.jsxs("div",{id:z,className:"jr-group-body","data-empty":(N==null?void 0:N.status)==="ready"&&_.length===0&&!N.error&&!N.next&&!N.capped||void 0,"data-fade":A.has(b.id)&&ds(_.length)||void 0,children:[(N==null?void 0:N.error)&&t.jsx(bt,{error:N.error,provider:"Jira",host:jt(n),stale:N.issues.length>0,title:N.status==="ready"?"More issues could not be read":void 0,onRetry:()=>{var le;(le=document.getElementById(`${z}-toggle`))==null||le.focus(),N.status==="ready"&&N.next?x(b):y(b)},onReconnect:T}),(!N||N.status==="idle"||N.status==="loading"&&N.issues.length===0)&&t.jsx(sn,{label:`Reading ${b.title}`,rows:3}),Ie&&_.length===0&&t.jsx("p",{className:"jr-empty-group",children:((N==null?void 0:N.issues.length)??0)>0?"Nothing here matches the filters.":c?"None of your issues are here.":u?"Nothing here matches the filters.":"No issues."}),_.length>0&&t.jsx("ul",{className:"jr-rows",children:_.map(le=>ae(le,b,0))}),(N==null?void 0:N.capped)&&t.jsx("p",{className:"jr-board-note",children:"The first 600 issues are shown. Open the sprint in Jira for the rest."}),b.paged&&(N==null?void 0:N.next)&&t.jsx("button",{type:"button",className:"btn jr-more",...Ce(R||!!N.more),onClick:()=>{we(Le.current||!!N.more)&&x(b)},children:N.more?"Reading…":N.total!=null?`Show more (${N.issues.length} of ${N.total})`:"Show more"})]})]})]},b.id)}),V&&t.jsx(ho,{items:V.items,groups:r,snap:a,initialView:V.initialView,anchorId:V.anchorId,portalId:S,boundaryId:e.scrollBoundaryId,busy:R,error:ve,onMove:Ee,onClose:tt},V.anchorId),Wt&&t.jsxs("div",{className:"jr-closed-foot",children:[t.jsx("button",{id:`${S}-closed-toggle`,type:"button",className:"btn","aria-expanded":oe.shown,"aria-busy":oe.loading||void 0,onClick:()=>m(!oe.shown),children:oe.shown?"Hide closed sprints":"Show closed sprints"}),oe.shown&&t.jsxs(t.Fragment,{children:[oe.loading&&t.jsx("p",{className:"jr-subnote",role:"status",children:"Reading closed sprints…"}),oe.error&&t.jsx(bt,{error:oe.error,provider:"Jira",host:jt(n),title:"Closed sprints could not be read",stale:oe.sprints.length>0,onRetry:()=>{var b;(b=document.getElementById(`${S}-closed-toggle`))==null||b.focus(),oe.sprints.length?k():m(!0)},onReconnect:T}),!oe.error&&!oe.loading&&oe.sprints.length===0&&t.jsx("p",{className:"jr-subnote",children:"No closed sprints on this board."}),!oe.error&&!oe.isLast&&oe.sprints.length>0&&t.jsx("button",{type:"button",className:"btn",...Ce(oe.loading),onClick:()=>{we(Ke.current)&&k()},children:oe.loading?"Reading…":`Show older sprints (${oe.sprints.length} of ${oe.total})`})]})]})]})}const xo=1,bo=3,yo=48,ko=2e4,wo=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"]),No={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"},vo=new Set(["br","hr","img"]),$o={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 So(e){var r;const s=(((r=e.getAttribute)==null?void 0:r.call(e,"class"))??"").split(/\s+/).map(a=>$o[a]).filter(Boolean);return s.length?[...new Set(s)].join(" "):void 0}function fs(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 ms(e){const n=Number.parseInt(String(e??""),10);return Number.isFinite(n)&&n>1&&n<=100?n:void 0}function tr({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 Co({src:e,href:n,alt:s,emoticon:r}){const[a,o]=i.useState(!1);return a?t.jsx(tr,{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:()=>o(!0)})}function Ro(e){return typeof DOMParser>"u"?null:new DOMParser().parseFromString(e,"text/html").body}function Ao(e,n,s=Ro){if(!e||!e.trim())return null;const r=s(e);if(!r)return e.replace(/<[^>]*>/g," ").replace(/\s+/g," ").trim();let a=ko,o=3;const d=(c,u,j)=>{var k,p,T,L,R,v;if(--a<0)return null;if(c.nodeType===bo)return c.nodeValue??"";if(c.nodeType!==xo)return null;const h=String(c.nodeName).toUpperCase();if(wo.has(h))return null;const f=()=>{if(j>=yo)return[];const S=[],F=c.childNodes;for(let K=0;K<F.length;K++){const w=d(F[K],`${u}.${K}`,j+1);w!==null&&w!==""&&S.push(w)}return S};let g=No[h];const y=/^H([1-6])$/.exec(h);if(y){const S=Math.min(Number(y[1])+3,6,o+1);o=S,g=`h${S}`}if(!g){const S=f();return S.length?i.createElement(i.Fragment,{key:u},...S):null}const x=So(c);if(g==="img"){const S=fs((k=c.getAttribute)==null?void 0:k.call(c,"src"),n.baseUrl);if(!S)return null;const F=(((p=c.getAttribute)==null?void 0:p.call(c,"alt"))??((T=c.getAttribute)==null?void 0:T.call(c,"title"))??"").slice(0,200),K=n.image(S),w=x==="jr-emoticon";return K?t.jsx(Co,{src:K,href:S,alt:F,emoticon:w},u):t.jsx(tr,{href:S,alt:F,emoticon:w},u)}if(g==="a"){const S=fs((L=c.getAttribute)==null?void 0:L.call(c,"href"),n.baseUrl),F=f();return S?i.createElement("a",{key:u,href:S,target:"_blank",rel:"noreferrer noopener",className:x},...F.length?F:[S]):F.length?i.createElement(i.Fragment,{key:u},...F):null}const m={key:u};if(x&&(m.className=x),g==="td"||g==="th"){const S=ms((R=c.getAttribute)==null?void 0:R.call(c,"colspan")),F=ms((v=c.getAttribute)==null?void 0:v.call(c,"rowspan"));S&&(m.colSpan=S),F&&(m.rowSpan=F)}return g==="table"?t.jsx("div",{className:"jr-table-wrap",tabIndex:0,role:"region","aria-label":"Table",children:i.createElement("table",{className:x},...f())},u):(g==="pre"&&Object.assign(m,{tabIndex:0,role:"region","aria-label":"Code"}),vo.has(g)?i.createElement(g,m):i.createElement(g,m,...f()))},l=[];for(let c=0;c<r.childNodes.length;c++){const u=d(r.childNodes[c],String(c),0);u!==null&&u!==""&&l.push(u)}return l.length?l:null}function ps({html:e,ctx:n,className:s="jr-html",empty:r}){const a=i.useMemo(()=>Ao(e,n),[e,n]);return a?t.jsx("div",{className:s,children:a}):r?t.jsx(t.Fragment,{children:r}):null}function Lo(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 nr({value:e,label:n}){const[s,r]=i.useState(!1);return i.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(),Wr(e).then(o=>r(!!o))},children:s?t.jsx(Hn,{}):t.jsx(Xa,{})}),t.jsx("span",{className:"vis-hidden",role:"status",children:s?`${n[0].toUpperCase()}${n.slice(1)} copied`:""})]})}function Pt({reference:e,context:n,copyValue:s,copyLabel:r,href:a,openLabel:o,narrow:d,onClose:l}){const{path:c,num:u}=Lo(e);return t.jsxs("div",{className:"ig-detail-bar",children:[t.jsxs("span",{className:"ig-ref",children:[n&&t.jsxs(t.Fragment,{children:[t.jsx("span",{className:"ig-ref-context",title:n,children:n}),t.jsx("span",{className:"ig-ref-separator","aria-hidden":!0,children:"/"})]}),t.jsxs("code",{className:"ig-ref-text",title:e,children:[c&&t.jsx("span",{className:"ig-ref-path",children:c}),u&&t.jsx("span",{className:"ig-ref-num",children:u})]}),t.jsx(nr,{value:s??e,label:r})]}),t.jsxs("span",{className:"ig-detail-bar-end",children:[a&&t.jsxs("a",{className:"ig-open",href:a,target:"_blank",rel:"noreferrer noopener",children:[o,t.jsx(xt,{})]}),!d&&t.jsx("button",{type:"button",className:"glyph-btn ig-detail-close","aria-label":"Close details",title:"Close",onClick:l,children:t.jsx(qs,{})})]})]})}function Be({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 wn({person:e,fallback:n,you:s=!1}){return e?t.jsx(Js,{src:e.avatar,name:e.name,size:18,you:s}):t.jsx("span",{className:"jr-dim",children:n})}function Eo({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(rn,{type:s.type}),t.jsx("span",{className:"jr-key",children:s.key}),t.jsx("span",{className:"jr-summary",children:s.summary}),t.jsx(an,{status:s.status}),s.assignee?t.jsx(Ot,{src:s.assignee.avatar,name:s.assignee.name,size:18,you:s.mine}):t.jsx(zs,{size:18})]})},s.key))})}function Mo({conn:e,api:n,assetUrl:s,trail:r,estimation:a,time:o,onOpen:d,onTrail:l,onReconnect:c,narrow:u,auto:j=!1,onClose:h}){var K;const f=r[r.length-1]??null,{data:g,loading:y,error:x,reload:m}=Va(n,e.id,f),k=i.useMemo(()=>({baseUrl:e.baseUrl,image:w=>ga(e,s,w)}),[e,s]),p=g&&g.issue.key===f?g.issue:null,T=p?ba(p):null,L=i.useRef(!1),R=w=>{L.current=!0,w()},v=p==null?void 0:p.key;i.useEffect(()=>{var B;if(!v)return;const w=L.current;if(L.current=!1,j)return;const E=document.activeElement,$=E==null||E===document.body,I=E instanceof HTMLElement&&E.matches("[data-ig-back]");ya({handedOff:w,narrow:u,focusLost:$,focusOnBack:I})&&((B=document.getElementById("jira-detail-title"))==null||B.focus())},[u,v,j]);const S=[],F=(K=p==null?void 0:p.parent)==null?void 0:K.key;return F&&!r.slice(0,-1).includes(F)&&S.push({label:F,title:p.parent.summary,go:()=>R(()=>d(F,"replace"))}),r.slice(0,-1).forEach((w,E)=>S.push({label:w,title:`Back to ${w}`,go:()=>R(()=>l(E))})),f?t.jsxs("article",{className:"jr-detail","aria-busy":y||void 0,"aria-labelledby":"jira-detail-title",children:[t.jsx(Pt,{reference:f,context:p==null?void 0:p.project.name,copyLabel:"key",href:(p==null?void 0:p.url)??null,openLabel:"Open in Jira",narrow:u,onClose:h}),S.length>0&&t.jsx("ol",{className:"jr-crumbs",role:"list","aria-label":"Related issues",children:S.map((w,E)=>t.jsx("li",{children:w.go?t.jsx("button",{type:"button",className:"jr-crumb",title:w.title,onClick:w.go,children:w.label}):t.jsx("span",{className:"jr-crumb-text",title:w.title,children:w.label})},`${w.label}-${E}`))}),x&&t.jsx(bt,{error:x,provider:"Jira",host:jt(e),stale:!!p,onRetry:m,onReconnect:c}),!p&&y&&t.jsx(sn,{label:`Reading ${f}`,rows:4,variant:"lines"}),p&&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:p.summary}),t.jsxs("p",{className:"jr-detail-state",children:[t.jsxs("span",{className:"jr-with-icon",children:[t.jsx(rn,{type:p.type}),p.type.name]}),t.jsx(an,{status:p.status}),T&&t.jsx("span",{className:"jr-dim",children:T}),p.priority&&t.jsxs("span",{className:"jr-with-icon",children:[t.jsx(qn,{priority:p.priority}),p.priority.name]}),p.flagged&&t.jsxs("span",{className:"jr-flagged",children:[t.jsx(er,{})," Flagged"]})]})]}),t.jsxs("dl",{className:"jr-fields",children:[t.jsx(Be,{label:"Assignee",children:t.jsx(wn,{person:p.assignee,fallback:"Unassigned",you:p.mine})}),t.jsx(Be,{label:"Reporter",children:p.reporter?t.jsx(wn,{person:p.reporter,fallback:""}):null}),t.jsx(Be,{label:"Sprint",children:p.sprint?t.jsxs(t.Fragment,{children:[p.sprint.name,p.sprint.state?t.jsxs("span",{className:"jr-dim",children:[" · ",p.sprint.state]}):null]}):null}),t.jsx(Be,{label:"Epic",children:p.epic?t.jsx(Zs,{epic:p.epic}):null}),t.jsx(Be,{label:"Fix versions",children:p.fixVersions.length?t.jsx("span",{className:"jr-chips",children:p.fixVersions.map(w=>t.jsx("span",{className:"jr-version",children:w},w))}):null}),t.jsx(Be,{label:"Labels",children:p.labels.length?t.jsx("span",{className:"jr-chips",children:p.labels.map(w=>t.jsx("span",{className:"jr-label",children:w},w))}):null}),t.jsx(Be,{label:"Components",children:p.components.join(", ")}),t.jsx(Be,{label:"Due",children:St(p.dueDate)}),a==="points"&&t.jsx(Be,{label:"Estimate",children:p.points!=null?`${p.points} ${p.points===1?"point":"points"}`:null}),t.jsx(Be,{label:"Time",children:Ra(p,o)})]}),t.jsx("p",{className:"jr-detail-dates",children:[p.created&&`Created ${St(p.created,!0)}`,p.updated&&`Updated ${St(p.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(ps,{html:p.descriptionHtml,ctx:k,empty:t.jsx("p",{className:"jr-dim",children:"No description."})})]}),g.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:g.subtasks.length})]}),t.jsx(Eo,{issues:g.subtasks,onOpen:w=>R(()=>d(w,"push"))})]}),g.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:g.attachments.length})]}),t.jsx("ul",{className:"jr-files",children:g.attachments.map(w=>t.jsxs("li",{children:[w.url?t.jsxs("a",{href:w.url,target:"_blank",rel:"noreferrer noopener",title:"Opens in Jira",children:[w.filename,t.jsx(xt,{})]}):t.jsx("span",{children:w.filename}),t.jsx("span",{className:"jr-dim",children:[Aa(w.size),St(w.created)].filter(Boolean).join(" · ")})]},w.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:g.comments.total>g.comments.items.length?`${g.comments.items.length} of ${g.comments.total}`:g.comments.total})]}),g.comments.items.length===0&&t.jsx("p",{className:"jr-dim",children:"No comments."}),t.jsx("ol",{className:"jr-comments",children:g.comments.items.map(w=>t.jsxs("li",{className:"jr-comment",children:[t.jsxs("div",{className:"jr-comment-head",children:[t.jsx(wn,{person:w.author,fallback:"Someone"}),t.jsx("time",{className:"jr-dim",dateTime:w.created,children:St(w.created,!0)}),w.updated&&w.updated!==w.created&&t.jsx("span",{className:"jr-dim",children:"edited"})]}),t.jsx(ps,{html:w.html,ctx:k,empty:t.jsx("p",{className:"jr-dim",children:"(empty)"})})]},w.id))}),g.comments.total>g.comments.items.length&&t.jsx("p",{className:"jr-dim",children:t.jsxs("a",{className:"jr-more-link",href:p.url,target:"_blank",rel:"noreferrer noopener",children:["The older comments are in Jira ",t.jsx(xt,{})]})})]})]})]}):null}const To=e=>typeof e=="string"&&e.length>0&&e.length<=40,Nn=e=>typeof e=="boolean",Do=e=>!!e&&typeof e=="object"&&!Array.isArray(e)&&Object.values(e).every(n=>typeof n=="boolean"),Io=e=>!!e&&typeof e=="object"&&typeof e.board=="string"&&Array.isArray(e.ids)&&e.ids.every(n=>typeof n=="string");function Fo({api:e,current:n,layerId:s,onPick:r,onClose:a}){const[o,d]=i.useState(""),[l,c]=i.useState({boards:[],isLast:!1,total:null,loading:!0,error:null}),u=i.useRef(null),j=i.useRef(null),h=i.useRef(0),f=i.useCallback((x,m)=>{const k=++h.current;c(p=>({...p,loading:!0,error:null,...m===0?{boards:[]}:{}})),Bs(e,m,x).then(p=>{k===h.current&&c(T=>({boards:m===0?p.boards:[...T.boards,...p.boards.filter(L=>!T.boards.some(R=>R.id===L.id))],isLast:p.isLast,total:p.total,loading:!1,error:null}))}).catch(p=>{k===h.current&&c(T=>({...T,loading:!1,error:Ge(p)}))})},[e]);i.useEffect(()=>{const x=window.setTimeout(()=>f(o.trim(),0),o?250:0);return()=>window.clearTimeout(x)},[o,f]);const g=()=>{var x;return Array.from(((x=j.current)==null?void 0:x.querySelectorAll("button[data-board]"))??[])},y=x=>{var T;if(x.key!=="ArrowDown"&&x.key!=="ArrowUp")return;const m=g();if(!m.length)return;x.preventDefault();const k=m.indexOf(document.activeElement),p=x.key==="ArrowDown"?k<0?0:Math.min(m.length-1,k+1):k<=0?-1:k-1;p<0?(T=u.current)==null||T.focus():m[p].focus()};return t.jsx(nn,{anchorId:s,align:"start",portalRootId:s,id:"jira-board-picker",className:"jr-board-pop",role:"dialog",labelledBy:"jira-board-picker-title",focusRef:u,onClose:a,children:t.jsxs("div",{className:"jr-board-pop-inner",onKeyDown:y,children:[t.jsx("p",{className:"jr-board-pop-title",id:"jira-board-picker-title",children:"Boards"}),t.jsx(Wn,{value:o,onChange:d,label:"Find a board by name",placeholder:"Find a board by name",inputRef:u}),t.jsx("ul",{className:"jr-board-list",role:"list",ref:j,"aria-label":"Boards","aria-busy":l.loading||void 0,children:l.boards.map(x=>t.jsx("li",{children:t.jsxs("button",{type:"button","data-board":x.id,className:"jr-board-item","aria-current":String(x.id)===n||void 0,onClick:()=>r(x),children:[t.jsx("span",{className:"jr-board-item-name",children:x.name}),t.jsx("span",{className:"jr-board-item-meta",children:[x.type,x.projectName||x.projectKey].filter(Boolean).join(" · ")})]})},x.id))}),l.loading&&t.jsx("p",{className:"jr-board-pop-note",role:"status",children:"Reading boards…"}),!l.loading&&l.error&&t.jsx("p",{className:"jr-board-pop-note",role:"alert",children:l.error.message}),!l.loading&&!l.error&&l.boards.length===0&&t.jsx("p",{className:"jr-board-pop-note",children:o?"No board by that name.":"No boards this account can see."}),!l.loading&&!l.isLast&&l.boards.length>0&&t.jsxs("button",{type:"button",className:"btn jr-board-more",onClick:()=>f(o.trim(),l.boards.length),children:["Show more boards",l.total!=null?` (${l.boards.length} of ${l.total})`:""]})]})})}const Bo=(e,n)=>e[e.length-1]===n[n.length-1];function Oo({connection:e,api:n,assetUrl:s,prefs:r,narrow:a,onReconnect:o}){var qe,Ht;const d=i.useId(),l=`jira:${e.id}`,[c,u]=i.useState(()=>r.read("board",To)??null),[j,h]=i.useState(()=>r.read("boardName",M=>typeof M=="string")??""),[f,g]=i.useState(()=>r.read("mine",Nn)??!0),[y,x]=i.useState(()=>r.read("hideDone",Nn)??!1),[m,k]=i.useState(()=>r.read("attention",Nn)??!1),[p,T]=i.useState(()=>{const M=r.read("quick",Io);return M&&M.board===c?M.ids:[]}),[L,R]=i.useState(()=>r.read("expanded",Do)??{}),[v,S]=i.useState(()=>En(l)),F=M=>{S(M),Ks(l,M)},K=i.useRef(null),[w,E]=i.useState(!1),[$,I]=i.useState(null),[B,C]=i.useState(!1);i.useEffect(()=>{r.write("mine",f)},[r,f]),i.useEffect(()=>{r.write("hideDone",y)},[r,y]),i.useEffect(()=>{r.write("attention",m)},[r,m]),i.useEffect(()=>{c&&r.write("quick",{board:c,ids:p})},[r,c,p]),i.useEffect(()=>{r.write("expanded",L)},[r,L]);const U=i.useCallback(M=>{const H=String(M.id);u(H),h(M.name),r.write("board",H),r.write("boardName",M.name),T([])},[r]),W=i.useCallback(()=>{I(null),C(!1),Bs(n,0,"").then(M=>{M.boards[0]?U(M.boards[0]):C(!0)}).catch(M=>I(Ge(M)))},[n,U]);i.useEffect(()=>{c||W()},[c,W]);const ee=i.useMemo(()=>({mine:f,quick:p}),[f,p]),se=Ga(n,e.id,c,ee),{snap:V,groups:J,loading:Y,error:ve}=se,me=i.useRef(!1),[dt,_e]=i.useState(!1),$e=Object.values(V.groups).some(M=>M.more||M.status==="loading"),Le=i.useRef(c);Le.current=c;const Ke=async M=>{if(!c||me.current||Y||$e)throw new Error("Wait for the board to finish updating.");me.current=!0,_e(!0);try{return await ua(n,c,M)}finally{me.current=!1,_e(!1),_a(e.id),Le.current===c&&await se.refresh()}},P=V.overview&&String(V.overview.board.id)===c?V.overview:null;i.useEffect(()=>{P&&P.board.name&&P.board.name!==j&&(h(P.board.name),r.write("boardName",P.board.name))},[P,j,r]);const{ensureGroup:be}=se;i.useEffect(()=>{for(const M of J)M.kind==="closed"&&L[M.id]&&be(M)},[J,L,be]);const tt=(M,H)=>R(ae=>({...ae,[M.id]:H})),he=f||y||m||p.length>0||v.trim()!=="",Ee=()=>{var M;g(!1),x(!1),k(!1),T([]),F(""),(M=K.current)==null||M.focus()},He=i.useMemo(()=>({search:v,hideDone:y,attention:m}),[v,y,m]),nt=i.useMemo(()=>wa((P==null?void 0:P.quickFilters)??[]),[P]);i.useEffect(()=>{if(!P)return;const M=new Set(nt.map(H=>H.id));T(H=>H.every(ae=>M.has(ae))?H:H.filter(ae=>M.has(ae)))},[P,nt]);const A=_s(l,c),[re,pe]=i.useState(()=>{var M;return{key:A,open:((M=Dt(A))==null?void 0:M.rows)??{}}});let xe=re.open;re.key!==A&&(xe=((qe=Dt(A))==null?void 0:qe.rows)??{},pe({key:A,open:xe}));const Me=(M,H)=>{const ae={...xe,[M]:H};pe({key:A,open:ae}),ot(A,{rows:ae})},Te=i.useMemo(()=>P?Ps(J,V.groups,M=>{var H;return(H=V.subtasks[M])==null?void 0:H.issues},He):[],[P,J,V.groups,V.subtasks,He]),De=i.useMemo(()=>{if(!P)return null;const{complete:M,keys:H,first:ae}=$a(Te,L,xe,V.subtasks,He,he);return{complete:M,has:Wt=>H.has(Wt[0]),first:ae==null?null:[ae]}},[P,Te,L,xe,V.subtasks,He,he]),ut=i.useRef(null),ge=Hs({listKey:A,drawn:De,same:Bo,sideBySide:!a,root:ut,listScroller:".jr-list-scroll"}),{choose:ze}=ge,je=i.useMemo(()=>ge.selection??[],[ge.selection]),Kt=je.length>0,Se=M=>{ze([M]),a&&requestAnimationFrame(()=>{var H;return(H=document.getElementById("jira-detail-title")??document.querySelector(".ig-detail [data-ig-back]"))==null?void 0:H.focus()})},$t=i.useCallback(()=>{const M=je[0];ze(null),requestAnimationFrame(()=>{const H=M?document.querySelector(`.jr-row-main[data-key="${CSS.escape(M)}"]`):null;H==null||H.focus()})},[je,ze]),Je=jt(e),We=P?null:ve??$,gn=B?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 ",Je,". 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(xt,{})]})})]}):We?t.jsxs("div",{className:"jr-state",children:[t.jsx(bt,{error:We,provider:"Jira",host:Je,onRetry:c?se.refresh:W,onReconnect:o}),We.kind==="not-found"&&c&&t.jsx("p",{children:t.jsx("button",{type:"button",className:"btn",onClick:()=>E(!0),children:"Choose another board"})})]}):P?t.jsxs(t.Fragment,{children:[ve&&t.jsx(bt,{error:ve,provider:"Jira",host:Je,stale:!0,onRetry:se.refresh,onReconnect:o}),t.jsx(jo,{conn:e,overview:P,groups:J,snap:V,expanded:L,onToggleGroup:tt,filter:He,mine:f,filtered:he,selected:je[je.length-1]??null,onOpen:Se,rowsOpen:xe,onToggleRow:Me,onRetryGroup:M=>se.ensureGroup(M,!0),onMore:se.loadMore,onShowClosed:se.showClosed,onMoreClosed:se.moreClosed,loadSubtasks:se.loadSubtasks,onReconnect:o,onMove:Ke,moveBusy:dt||Y||$e,scrollBoundaryId:d},c)]}):t.jsx(sn,{label:"Reading the board",rows:6}),jn=Kt&&P?t.jsx(Mo,{conn:e,api:n,assetUrl:s,trail:je,estimation:P.estimation.kind,time:P.timeTracking,onOpen:(M,H)=>ze(H==="push"?[...je.filter(ae=>ae!==M),M]:[M]),onTrail:M=>ze(je.slice(0,M+1)),onReconnect:o,narrow:a,auto:ge.auto,onClose:$t}):null;return t.jsxs("div",{ref:ut,className:"jr-panel","data-deployment":((Ht=e.meta)==null?void 0:Ht.deployment)==="cloud"?"cloud":"server",children:[t.jsxs("div",{className:"jr-toolbar",hidden:a&&Kt,children:[t.jsx("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-label":`Board: ${(P==null?void 0:P.board.name)||j||(c?`Board ${c}`:"Choose a board")}`,title:[...new Set([(P==null?void 0:P.board.name)||j,P==null?void 0:P.board.projectName].filter(Boolean))].join(" · "),"aria-haspopup":"dialog","aria-expanded":w,"aria-controls":w?"jira-board-picker":void 0,onClick:()=>E(M=>!M),children:[t.jsx("span",{className:"jr-board-btn-label",children:"Board"}),t.jsx("span",{className:"jr-board-btn-name",children:(P==null?void 0:P.board.name)||j||(c?`Board ${c}`:"Choose a board")}),t.jsx(Dn,{open:w})]})}),t.jsxs("div",{className:"jr-filters",role:"group","aria-label":"Filters",children:[t.jsx(Wn,{inputRef:K,value:v,onChange:F,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":f,onClick:()=>g(M=>!M),children:"Only my issues"}),t.jsx("button",{type:"button",className:"btn jr-chip","aria-pressed":y,onClick:()=>x(M=>!M),children:"Hide done"}),t.jsx("button",{type:"button",className:"btn jr-chip","aria-pressed":m,title:"Flagged, or Highest, Blocker or Critical priority, and not done",onClick:()=>k(M=>!M),children:"Needs attention"}),nt.map(M=>t.jsx("button",{type:"button",className:"btn jr-chip","aria-pressed":p.includes(M.id),title:M.description||void 0,onClick:()=>T(H=>H.includes(M.id)?H.filter(ae=>ae!==M.id):[...H,M.id]),children:M.name},M.id))]}),he&&t.jsx("button",{type:"button",className:"jr-link-btn jr-clear",onClick:Ee,children:"Clear filters"})]}),t.jsx(Gs,{loadedAt:V.loadedAt||null,loading:Y,stale:!!ve,onRefresh:()=>{c?se.refresh():W()},label:"Refresh the board",disabled:!c})]}),t.jsx(_n,{storageKey:"jira",automaticDetailShare:.4,list:t.jsx("div",{className:"jr-list-scroll",id:d,children:gn}),detail:jn,onBack:$t,backLabel:"Back to the board",detailKey:je[je.length-1]}),w&&t.jsx(Fo,{api:n,current:c,layerId:"jira-board-layer",onPick:M=>{var H;U(M),E(!1),(H=document.getElementById("jira-board-button"))==null||H.focus()},onClose:()=>{var H,ae;const M=(H=document.getElementById("jira-board-picker"))==null?void 0:H.contains(document.activeElement);E(!1),M&&((ae=document.getElementById("jira-board-button"))==null||ae.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"}},Po=12e4;function en(e,n={}){const s=new URLSearchParams;for(const[a,o]of Object.entries(n))o!=null&&o!==""&&s.set(a,String(o));const r=s.toString();return`${e}${r?`?${r}`:""}`}class Mt extends Error{constructor(n){super(n.message),this.info=n,this.name="ForgeReadError"}}async function Gn(e,n,s){let r;try{r=await e(n,{signal:s,headers:{accept:"application/json"}})}catch(d){throw(d==null?void 0:d.name)==="AbortError"?d:new Mt({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 o=a==null?void 0:a.error;throw o&&typeof o=="object"&&typeof o.kind=="string"?new Mt(o):new Mt({kind:"upstream",message:typeof o=="string"?o:`the deck answered ${r.status}`,status:r.status})}const mt=new Map,Uo=200;function Et(e){return mt.get(e)??{data:null,loadedAt:null,error:null}}function In(e,n){for(mt.delete(e),mt.set(e,n);mt.size>Uo;)mt.delete(mt.keys().next().value)}function gs(e,n,s=!1){return s||e.loadedAt==null||n-e.loadedAt>=Po}function _o(e){return e.data!=null&&e.error!=null}const js={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 Ne(e){return js[e??"none"]??js.none}function Ut(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 sr(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 Ko(e,n){const s=n==null?void 0:n.login.trim().toLowerCase();return!!s&&!!e&&e.login.trim().toLowerCase()===s}function tn(e){return e==null?"–":e>=1e3?"999+":String(e)}function _t(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 Ho(e){const n=[],s=[];for(const r of e)(r.stale&&!r.isDefault?s:n).push(r);return{active:n,stale:s}}function Wo(e){const n=[],s=[];for(const r of e)(r.approvedByMe?s:n).push(r);return{waiting:n,approved:s}}function on(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(`
3
3
  `).toLowerCase();return s.replace(/^[#!]/,"").split(/\s+/).every(a=>r.includes(a))}function xs(e){const n=e.trim();return/^https?:\/\/\S+\/(?:-\/)?(?:merge_requests|issues|pull)\/\d+/.test(n)||/^[\w.-]+(?:\/[\w.-]+)+[#!]\d+$/.test(n)}const Ct={tab:"branches",filter:"all",state:"open",sort:"created",issueState:"open"},qo=["branches","changes","pipelines","issues"],rr="view",Go=e=>!!e&&typeof e=="object"&&!Array.isArray(e);function bs(e){return Vo(e.read(rr,Go)??{})}function ys(e,n){e.write(rr,n)}function Vo(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,qo,Ct.tab),filter:n(e.filter,["all","mine","review"],Ct.filter),state:n(e.state,["open","merged","closed"],Ct.state),sort:n(e.sort,["created","updated"],Ct.sort),issueState:n(e.issueState,["open","closed"],Ct.issueState),open:Array.isArray(e.open)?e.open.filter(s=>typeof s=="string").slice(0,20):[]}}function zo(e,n,s){return e?s||!n?"page":"stay":"opener"}function Jo(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 Xo(e,n,s){return e<=0?-1:n>=0&&n<e?n:s>=0&&s<e?s:0}function Qo(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 Yo(e,n){return n==="branches"?!1:n==="issues"?e==="gitlab":!0}function ar(e){return e instanceof Mt?e.info:{kind:"upstream",message:"the read failed"}}function Ue(e,n,s,r={},a=0){const o=s?en(s,r):null,d=o?`${n}
4
4
  ${o}`:null,[l,c]=i.useState(()=>({key:d,read:rt(d?Et(d):null,!1)})),[u,j]=i.useState(0),h=i.useRef(a);i.useEffect(()=>{if(!d||!o){c({key:d,read:rt(null,!1)});return}const x=Et(d),m=u>0||a!==h.current;if(h.current=a,!gs(x,Date.now(),m)){c({key:d,read:rt(x,!1)});return}c({key:d,read:rt(x,!0)});const k=new AbortController;return Gn(e,o,k.signal).then(p=>{const T={data:p,loadedAt:Date.now(),error:null};In(d,T),k.signal.aborted||c({key:d,read:rt(T,!1)})},p=>{if(k.signal.aborted||(p==null?void 0:p.name)==="AbortError")return;const T={...Et(d),error:ar(p)};In(d,T),c({key:d,read:rt(T,!1)})}),()=>k.abort()},[e,d,o,a,u]);const f=i.useCallback(()=>j(x=>x+1),[]),g=l.key===d||!d?null:Et(d);return{...l.key===d?l.read:rt(g,g!=null&&gs(g,Date.now())),reload:f}}function rt(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?_o(e):!1}}function Ze(e,n,s,r={},a=0){var T;const o=Ue(e,n,s,r,a),d=s?en(s,r):null,l=d?`${n}