ccdeck 3.50.0 → 3.51.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (96) hide show
  1. package/README.md +2 -0
  2. package/THIRD_PARTY_NOTICES.md +28 -0
  3. package/dist/web/assets/BrowserWatchModal-CDpunrq9.js +1 -0
  4. package/dist/web/assets/IntegrationModal-BctMcNU8.js +7 -0
  5. package/dist/web/assets/{RadioPanel-D3JLkVYu.js → RadioPanel-DQNFtYOx.js} +1 -1
  6. package/dist/web/assets/{TrafficRadar-Cuk5tXfL.js → TrafficRadar-DRt3Al7E.js} +1 -1
  7. package/dist/web/assets/UsageHistoryModal-DlgPufgs.js +1 -0
  8. package/dist/web/assets/{app-BRaZrImF.js → app-4x4wTE-L.js} +70 -70
  9. package/dist/web/assets/{app-DfGYllmZ.css → app-o4kL0FgZ.css} +1 -1
  10. package/dist/web/assets/{index-DSIUCKoe.js → index-CWUj8Kqh.js} +1 -1
  11. package/dist/web/index.html +3 -3
  12. package/node_modules/bare-addon-resolve/LICENSE +201 -0
  13. package/node_modules/bare-addon-resolve/README.md +226 -0
  14. package/node_modules/bare-addon-resolve/index.d.ts +100 -0
  15. package/node_modules/bare-addon-resolve/index.js +531 -0
  16. package/node_modules/bare-addon-resolve/lib/errors.d.ts +16 -0
  17. package/node_modules/bare-addon-resolve/lib/errors.js +21 -0
  18. package/node_modules/bare-addon-resolve/package.json +57 -0
  19. package/node_modules/bare-module-resolve/LICENSE +201 -0
  20. package/node_modules/bare-module-resolve/README.md +322 -0
  21. package/node_modules/bare-module-resolve/index.d.ts +171 -0
  22. package/node_modules/bare-module-resolve/index.js +899 -0
  23. package/node_modules/bare-module-resolve/lib/errors.d.ts +31 -0
  24. package/node_modules/bare-module-resolve/lib/errors.js +37 -0
  25. package/node_modules/bare-module-resolve/package.json +56 -0
  26. package/node_modules/bare-semver/LICENSE +201 -0
  27. package/node_modules/bare-semver/README.md +147 -0
  28. package/node_modules/bare-semver/index.d.ts +61 -0
  29. package/node_modules/bare-semver/index.js +13 -0
  30. package/node_modules/bare-semver/lib/comparator.js +37 -0
  31. package/node_modules/bare-semver/lib/constants.js +7 -0
  32. package/node_modules/bare-semver/lib/errors.js +22 -0
  33. package/node_modules/bare-semver/lib/range.js +256 -0
  34. package/node_modules/bare-semver/lib/version.js +240 -0
  35. package/node_modules/bare-semver/package.json +43 -0
  36. package/node_modules/fs-native-extensions/CMakeLists.txt +118 -0
  37. package/node_modules/fs-native-extensions/LICENSE +201 -0
  38. package/node_modules/fs-native-extensions/README.md +160 -0
  39. package/node_modules/fs-native-extensions/binding.c +1825 -0
  40. package/node_modules/fs-native-extensions/binding.js +3 -0
  41. package/node_modules/fs-native-extensions/include/fs-ext.h +193 -0
  42. package/node_modules/fs-native-extensions/index.js +356 -0
  43. package/node_modules/fs-native-extensions/package.json +72 -0
  44. package/node_modules/fs-native-extensions/prebuilds/android-arm/fs-native-extensions.bare +0 -0
  45. package/node_modules/fs-native-extensions/prebuilds/android-arm/fs-native-extensions.node +0 -0
  46. package/node_modules/fs-native-extensions/prebuilds/android-arm64/fs-native-extensions.bare +0 -0
  47. package/node_modules/fs-native-extensions/prebuilds/android-arm64/fs-native-extensions.node +0 -0
  48. package/node_modules/fs-native-extensions/prebuilds/android-ia32/fs-native-extensions.bare +0 -0
  49. package/node_modules/fs-native-extensions/prebuilds/android-ia32/fs-native-extensions.node +0 -0
  50. package/node_modules/fs-native-extensions/prebuilds/android-x64/fs-native-extensions.bare +0 -0
  51. package/node_modules/fs-native-extensions/prebuilds/android-x64/fs-native-extensions.node +0 -0
  52. package/node_modules/fs-native-extensions/prebuilds/darwin-arm64/fs-native-extensions.bare +0 -0
  53. package/node_modules/fs-native-extensions/prebuilds/darwin-arm64/fs-native-extensions.node +0 -0
  54. package/node_modules/fs-native-extensions/prebuilds/darwin-x64/fs-native-extensions.bare +0 -0
  55. package/node_modules/fs-native-extensions/prebuilds/darwin-x64/fs-native-extensions.node +0 -0
  56. package/node_modules/fs-native-extensions/prebuilds/ios-arm64/fs-native-extensions.bare +0 -0
  57. package/node_modules/fs-native-extensions/prebuilds/ios-arm64-simulator/fs-native-extensions.bare +0 -0
  58. package/node_modules/fs-native-extensions/prebuilds/ios-x64-simulator/fs-native-extensions.bare +0 -0
  59. package/node_modules/fs-native-extensions/prebuilds/linux-arm64/fs-native-extensions.bare +0 -0
  60. package/node_modules/fs-native-extensions/prebuilds/linux-arm64/fs-native-extensions.node +0 -0
  61. package/node_modules/fs-native-extensions/prebuilds/linux-x64/fs-native-extensions.bare +0 -0
  62. package/node_modules/fs-native-extensions/prebuilds/linux-x64/fs-native-extensions.node +0 -0
  63. package/node_modules/fs-native-extensions/prebuilds/win32-arm64/fs-native-extensions.bare +0 -0
  64. package/node_modules/fs-native-extensions/prebuilds/win32-arm64/fs-native-extensions.node +0 -0
  65. package/node_modules/fs-native-extensions/prebuilds/win32-x64/fs-native-extensions.bare +0 -0
  66. package/node_modules/fs-native-extensions/prebuilds/win32-x64/fs-native-extensions.node +0 -0
  67. package/node_modules/fs-native-extensions/src/apple.c +197 -0
  68. package/node_modules/fs-native-extensions/src/linux.c +146 -0
  69. package/node_modules/fs-native-extensions/src/platform.h +51 -0
  70. package/node_modules/fs-native-extensions/src/posix.c +33 -0
  71. package/node_modules/fs-native-extensions/src/shared.c +397 -0
  72. package/node_modules/fs-native-extensions/src/win32/nt.h +226 -0
  73. package/node_modules/fs-native-extensions/src/win32.c +531 -0
  74. package/node_modules/require-addon/LICENSE +201 -0
  75. package/node_modules/require-addon/README.md +19 -0
  76. package/node_modules/require-addon/lib/bare.js +1 -0
  77. package/node_modules/require-addon/lib/default.js +7 -0
  78. package/node_modules/require-addon/lib/node.js +79 -0
  79. package/node_modules/require-addon/package.json +64 -0
  80. package/node_modules/which-runtime/LICENSE +201 -0
  81. package/node_modules/which-runtime/README.md +29 -0
  82. package/node_modules/which-runtime/index.js +36 -0
  83. package/node_modules/which-runtime/package.json +32 -0
  84. package/package.json +8 -2
  85. package/release-notes.json +19 -0
  86. package/src/server/integrations/jira-comment.mjs +37 -0
  87. package/src/server/integrations/jira-move.mjs +37 -11
  88. package/src/server/integrations/jira-transition.mjs +43 -0
  89. package/src/server/integrations/jira-write-guard.mjs +218 -0
  90. package/src/server/integrations/jira.mjs +16 -0
  91. package/src/server/integrations/routes.mjs +70 -7
  92. package/src/server/static-cache.mjs +34 -16
  93. package/src/server/traffic-radar-wire.mjs +6 -0
  94. package/dist/web/assets/BrowserWatchModal-CSckhvRP.js +0 -1
  95. package/dist/web/assets/IntegrationModal-CT8_QnAx.js +0 -7
  96. package/dist/web/assets/UsageHistoryModal-DiEH73iz.js +0 -1
@@ -0,0 +1,7 @@
1
+ import{r as sa,a as ra,w as aa,b as i,p as Qs,m as Ys,j as t,u as oa,f as Yn,I as Ve,c as Zn,q as ia,d as ms,R as la,s as $e,e as Le,g as Zs,i as ca,A as pn,H as da,h as Ct,E as Rt,k as ua,t as ha,l as er,T as fa,n as ma,o as pa,v as ga,x as ja,y as xa,z as ba,B as ya,C as ka,D as wa,F as va,G as Na}from"./app-4x4wTE-L.js";const _e={min:320,max:1600},Gt=.5;function tr(e){return Number.isFinite(e)&&e>0&&e<1?e:Gt}function nr(e=Gt){return`clamp(${_e.min}px, ${tr(e)*100}%, ${_e.max}px)`}const $a=420,Sa=8,Ca="(max-width: 899px)",On=e=>`agent-dag.integrations.${e}.detail-width`;function Ut(e,n){const s=Math.max(_e.min,Math.min(_e.max,n-$a-Sa));return Math.round(Math.min(s,Math.max(_e.min,Number.isFinite(e)?e:n*Gt)))}function ps(e,n=Gt){return Ut(e*tr(n),e)}function Ra(e){const n=sa(On(e));if(n==null)return null;const s=Number(n);return Number.isFinite(s)&&s>=_e.min&&s<=_e.max?Math.round(s):null}function Aa(e,n){n==null?ra(On(e)):aa(On(e),String(Math.round(n)))}function Ea({width:e,workspace:n,controls:s,onCommit:r,automaticDetailShare:a}){const o=i.useRef(null),u=i.useRef(null),l=()=>{var p;return((p=n.current)==null?void 0:p.clientWidth)??window.innerWidth},d=e==null?ps(l(),a):Ut(e,l()),c=p=>{var g,y;(g=n.current)==null||g.style.setProperty("--ig-detail-w",`${p}px`),(y=o.current)==null||y.setAttribute("aria-valuenow",String(p))},m=p=>{var g,y;p==null?((g=n.current)==null||g.style.setProperty("--ig-detail-w",nr(a)),(y=o.current)==null||y.setAttribute("aria-valuenow",String(ps(l(),a)))):c(p),r(p)},f=p=>{var g;p.button===0&&(p.preventDefault(),p.currentTarget.setPointerCapture(p.pointerId),u.current={x:p.clientX,width:d,room:l(),last:d},(g=n.current)==null||g.setAttribute("data-resizing",""))},h=p=>{const g=u.current;g&&(g.last=Ut(g.width+g.x-p.clientX,g.room),c(g.last))},x=()=>{var g;const p=u.current;p&&(u.current=null,(g=n.current)==null||g.removeAttribute("data-resizing"),m(p.last))},j=p=>{const g=p.shiftKey?64:16;if(p.key==="Enter"){p.preventDefault(),m(null);return}const y=p.key==="ArrowLeft"?d+g:p.key==="ArrowRight"?d-g:p.key==="Home"?_e.min:p.key==="End"?_e.max:null;y!==null&&(p.preventDefault(),m(Ut(y,l())))};return t.jsx("div",{ref:o,className:"ig-splitter",role:"separator","aria-orientation":"vertical","aria-label":"Detail width","aria-controls":s,"aria-valuemin":_e.min,"aria-valuemax":Ut(_e.max,l()),"aria-valuenow":d,tabIndex:0,title:"Drag to resize · double-click for the automatic width",onPointerDown:f,onPointerMove:h,onPointerUp:x,onPointerCancel:x,onLostPointerCapture:x,onDoubleClick:()=>m(null),onKeyDown:j})}function sr(){return oa(Ca)}function es({list:e,detail:n,onBack:s,backLabel:r,storageKey:a,detailKey:o,automaticDetailShare:u=Gt}){const l=sr(),d=`${i.useId()}-detail`,c=i.useRef(null),m=i.useRef(null),f=i.useRef(null),h=i.useRef(null),[x,j]=i.useState(()=>Ra(a)),p=C=>{j(C),Aa(a,C)},g=n!=null,y=i.useRef(null);g&&(y.current=n);const[v,b]=i.useState(g),[R,S]=i.useState(null);v!==g&&(b(g),S(!g&&l&&!Qs()?y.current:null));const k=g?n:R,A=!g&&R!=null;i.useEffect(()=>{if(!A)return;const C=window.setTimeout(()=>S(null),200);return()=>window.clearTimeout(C)},[A]),i.useLayoutEffect(()=>{f.current&&(f.current.inert=A)},[A]),i.useLayoutEffect(()=>{const C=f.current;!C||!g||(C.dataset.flip=C.dataset.flip==="a"?"b":"a")},[g,o]);const O=i.useRef(null);i.useLayoutEffect(()=>{var L,te,de,T;if(!g)return;const C=document.activeElement;C instanceof HTMLElement&&((L=m.current)!=null&&L.contains(C))&&(O.current=C);const N=C instanceof HTMLElement&&!(((te=C.checkVisibility)==null?void 0:te.call(C))??!0);l&&(!C||C===document.body||N||(de=m.current)!=null&&de.contains(C))&&((T=h.current)==null||T.focus({preventScroll:!0}))},[g,l,o]),i.useEffect(()=>{if(g)return;const C=O.current;if(!C)return;const N=requestAnimationFrame(()=>{var te;const L=document.activeElement;(!L||L===document.body)&&C.isConnected&&(((te=C.checkVisibility)==null?void 0:te.call(C))??!0)&&C.focus({preventScroll:!0})});return()=>cancelAnimationFrame(N)},[g]);const z=i.useRef(s);return z.current=s,i.useEffect(()=>{if(g)return Ys.push(()=>z.current(),0,"popover")},[g]),t.jsxs("div",{ref:c,className:"ig-split","data-detail":g||void 0,"data-drill-in":l||void 0,style:{"--ig-detail-w":x==null?nr(u):`${x}px`},children:[t.jsx("div",{ref:m,className:"ig-list",hidden:l&&g||void 0,children:e}),g&&!l&&t.jsx(Ea,{width:x,workspace:c,controls:d,onCommit:p,automaticDetailShare:u}),k!=null&&t.jsxs("section",{ref:f,className:"ig-detail",id:d,"aria-label":"Details","data-leaving":A||void 0,onAnimationEnd:C=>{A&&C.target===C.currentTarget&&S(null)},children:[l&&t.jsxs("button",{ref:h,type:"button",className:"ig-back","data-ig-back":!0,onClick:s,children:[t.jsx("svg",{width:"13",height:"13",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:t.jsx("path",{d:"M8.6 3 4.6 7l4 4"})}),r]}),k]})]})}const un=e=>e.issueKeys??[e.issueKey];function La(e,n,s,r,a){if(!n.includes(s))return new Set(e);if(a==="replace")return new Set([s]);if(a==="toggle"){const d=new Set(e);return d.has(s)?d.delete(s):d.add(s),d}const o=r?n.indexOf(r):-1,u=n.indexOf(s),l=o<0?[s]:n.slice(Math.min(o,u),Math.max(o,u)+1);return new Set([...a==="add-range"?e:[],...l])}function gs(e,n,s,r){return n.has(e)||!r&&n.size===0&&s===e}function At(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 on(e,n){return st({issue:e,group:n})===null}function st({issue:e,group:n}){return e.type.subtask?"is a subtask":e.type.epic?"is an epic":n.kind==="closed"?"is in a closed sprint":At(n)?null:"is not in an active/future sprint or the backlog"}function ln(e){const n=e.filter(s=>st(s));return n.length?`${n.slice(0,2).map(s=>`${s.issue.key} ${st(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 js(e,n,s){const r=At(n),a=e.map(o=>o.issue.key);return!e.length||e.length>50||new Set(a).size!==a.length||!r||e.some(o=>!on(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}:{atEnd:!0}}}async function Ma(e,n,s){var o;const r=new AbortController,a=window.setTimeout(()=>r.abort(),45e3);try{const u=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=u.body)==null?void 0:o.getReader(),d=()=>{l==null||l.cancel().catch(()=>{})};r.signal.addEventListener("abort",d,{once:!0});let c="";try{const x=new TextDecoder;let j=0;for(;l&&!r.signal.aborted;){const p=await l.read();if(p.done)break;if(j+=p.value.byteLength,j>16384)throw new Error("Result too large");c+=x.decode(p.value,{stream:!0})}if(c+=x.decode(),r.signal.aborted)throw new Error("Deadline exceeded")}finally{r.signal.removeEventListener("abort",d),await(l==null?void 0:l.cancel().catch(()=>{}))}if(!u.ok)throw await Yn(new Response(c,{status:u.status}));if(u.status===204)return{};const m=JSON.parse(c),f=un(s),h=m&&typeof m=="object"&&(s.issueKeys?"issueKeys"in m&&Array.isArray(m.issueKeys)&&m.issueKeys.length===f.length&&m.issueKeys.every((x,j)=>x===f[j]):"issueKey"in m&&m.issueKey===s.issueKey);if(!m||typeof m!="object"||Array.isArray(m)||!("ok"in m)||m.ok!==!0||!h||"notice"in m&&(typeof m.notice!="string"||m.notice.length>1e3))throw new Error("Unconfirmed result");return{..."notice"in m?{notice:m.notice}:{},..."operationId"in m&&typeof m.operationId=="string"?{operationId:m.operationId}:{}}}catch(u){throw u instanceof Ve?u:new Ve("network","The move could not be confirmed. Refresh the board before trying again.")}finally{window.clearTimeout(a)}}const It=(e,n,s={},r)=>Zn(e,`${n}${ia(s)}`,{signal:r}),rr=(e,n,s,r)=>It(e,"boards",{startAt:n||void 0,name:s},r),Ta=(e,n,s)=>It(e,`board/${encodeURIComponent(n)}`,{},s),xs=(e,n,s,r)=>It(e,`board/${encodeURIComponent(n)}/closed-sprints`,{startAt:s||void 0},r),bs=(e,n,s,r)=>It(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),Ia=(e,n,s)=>It(e,`issue/${encodeURIComponent(n)}/subtasks`,{},s),Da=(e,n,s)=>It(e,`issue/${encodeURIComponent(n)}`,{},s);function Fa(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 u=r.protocol==="http:"&&/^(localhost|127\.0\.0\.1|\[::1\])$/.test(r.hostname)&&e.allowedOrigins.includes(r.origin);return r.protocol!=="https:"&&!u?null:n(r.href)}const Rn=e=>`sprint:${e.id}`;function ys(e,n=[]){const s=[];if(e.hasSprints){for(const r of e.sprints.active)s.push({id:Rn(r),kind:"active",title:r.name,sprint:r,defaultOpen:!0,paged:!1});for(const r of e.sprints.future)s.push({id:Rn(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:Rn(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 _t(e,n){return Object.hasOwn(n,e.id)?n[e.id]:e.defaultOpen}const ct=e=>e.kind==="issue"?e.issue.key:e.parent.key;function Oa(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 u=o.type.subtask&&o.parent?o.parent.key:null;if(u&&u!==o.key){let d=a.get(u);if(!d){const c=s.get(u);c&&!n.has(u)?d={kind:"issue",issue:c,matched:[]}:(d={kind:"context",parent:o.parent,matched:[]},r.push(d)),a.set(u,d)}d.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 hn=e=>e.status.category==="done";function ts(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 Ba(e){return!hn(e)&&(e.flagged||e.priority!=null&&ts(e.priority.name)==="highest")}function Pa(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 Ua({handedOff:e,narrow:n,focusLost:s,focusOnBack:r}){return s?e||n:n&&r}function ar(e,n){return(!n.hideDone||!hn(e))&&(!n.attention||Ba(e))}const _a=/^only my issues$/i;function Ka(e){return e.filter(n=>!_a.test(n.name.trim()))}function Ha(e,n){return n?e.key.toLowerCase().includes(n)||e.summary.toLowerCase().includes(n):!0}function Wa(e,n,s){const r=n.search.trim().toLowerCase();if(!r&&!n.hideDone&&!n.attention)return e.slice();const a=u=>ar(u,n)&&Ha(u,r),o=[];for(const u of e){const l=u.matched.filter(a),d=(s==null?void 0:s(ct(u)))??[],c=l.length>0||d.some(a);u.kind==="issue"?(a(u.issue)||c)&&o.push({...u,matched:l}):c&&o.push({...u,matched:l})}return o}function or(e,n,s,r){const a=new Set;return e.map(o=>{const u=n[o.id];return{def:o,data:u,rows:Wa(Oa((u==null?void 0:u.issues)??[],a),r,s)}})}function Bn(e,n){return n[ct(e)]??e.kind==="context"}function Pn(e,n,s){return(n==null?void 0:n.status)==="ready"?n.issues.filter(r=>ar(r,s)):e.matched}function ir(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 qa(e,n,s,r,a,o){const u=new Set;let l=!0,d=null;for(const{def:c,data:m,rows:f}of e)if(_t(c,n)){if(!m||m.status!=="ready"&&m.status!=="error"&&m.issues.length===0){l=!1;continue}d==null&&l&&f.length>0&&(d=ct(f[0]));for(const h of f){const x=ct(h);if(u.add(x),!Bn(h,s))continue;const j=r[x];for(const p of Pn(h,j,a))u.add(p.key);(j?j.status==="loading":ir(h,o))&&(l=!1)}}return{complete:l,keys:u,first:d}}function Ja(e){return e.flatMap(n=>n.kind==="issue"?[n.issue]:n.matched)}function za(e,n){const s=Ja(e),r={new:0,indeterminate:0,done:0},a=new Map;let o=0,u=0,l=null,d=0,c=0;for(const f of s){const h=n==="count"?1:n==="points"?f.points??0:f.estimate??0;if(r[f.status.category]+=h,f.assignee){const x=a.get(f.assignee.id);x?x.n++:a.set(f.assignee.id,{person:f.assignee,n:1})}f.mine&&(o++,f.assignee&&(l=f.assignee.id),hn(f)&&u++),hn(f)||(f.flagged&&d++,f.priority&&ts(f.priority.name)==="highest"&&c++)}const m=[...a.values()].sort((f,h)=>h.n-f.n||f.person.name.localeCompare(h.person.name)).map(f=>f.person);return{count:s.length,totals:r,assignees:m,mine:o,mineDone:u,youId:l,flagged:d,highest:c}}function $t(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),u=[];for(const[l,d]of[[o,"w"],[a,"d"],[r,"h"],[1,"m"]]){if(l<=0)continue;const c=Math.floor(s/l);c>0&&(u.push(`${c}${d}`),s-=c*l)}return u.join(" ")}function ks(e,n,s){return n==="time"?$t(e,s)||"0m":n==="points"?`${Number.isInteger(e)?e:e.toFixed(1)}`:String(e)}function ws(e){if(!e)return"";const n=new Date(e);return Number.isNaN(n.getTime())?"":n.toLocaleDateString(void 0,{day:"numeric",month:"short"})}function Ga(e,n){const s=$t(e.estimate,n),r=$t(e.timeSpent,n),a=e.remaining!=null&&(e.remaining!==e.estimate||r)?$t(e.remaining,n):"";return[s&&`${s} estimated`,a&&`${a} left`,r&&`${r} logged`].filter(Boolean).join(" · ")}function Ot(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 Va(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 Xa=120,pt=new Map,Un=new Map,Qa=()=>({selection:null,closed:!1,listTop:0,detailTop:0,rows:{},section:null});function lr(e,...n){return[e,...n.map(s=>s??"*")].join("|")}function qt(e){return pt.get(e)??null}function gt(e,n){const s={...pt.get(e)??Qa(),...n};for(pt.delete(e),pt.set(e,s);pt.size>Xa;)pt.delete(pt.keys().next().value)}function _n(e){return Un.get(e)??""}function cr(e,n){n?Un.set(e,n):Un.delete(e)}function Ya(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 vs(e,n){const s=qt(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 Za(e,n,s){if(e.settled||!n)return e;const r=Ya(qt(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"?(gt(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 eo(e,n,s){const r=n==null||e.selection==null||!s(e.selection,n);return gt(e.key,{selection:n,closed:n==null,...r?{section:null,detailTop:0}:{}}),{key:e.key,selection:n,auto:!1,settled:!0,plan:null}}const cn=typeof window>"u"?i.useEffect:i.useLayoutEffect,to=3e3,Ns=["wheel","pointerdown","touchstart","keydown"];function no(e,n,s){let r=!1,a=0,o=0,u=null;const l=()=>{if(!r){r=!0,cancelAnimationFrame(a),u==null||u.disconnect();for(const c of Ns)e.removeEventListener(c,l);s()}},d=()=>{if(r)return;if(!e.isConnected){l();return}if(e.clientHeight===0){!u&&typeof ResizeObserver<"u"&&(u=new ResizeObserver(()=>{e.clientHeight!==0&&(u==null||u.disconnect(),u=null,d())}),u.observe(e));return}o||(o=performance.now()+to);const c=Math.max(0,e.scrollHeight-e.clientHeight);if(e.scrollTop=Math.min(n,c),c>=n||performance.now()>=o){l();return}a=requestAnimationFrame(d)};for(const c of Ns)e.addEventListener(c,l,{passive:!0});return d(),l}const An=".ig-detail";function dr({listKey:e,drawn:n,same:s,sideBySide:r,root:a,listScroller:o}){const[u,l]=i.useState(()=>vs(e,!0));let d=u;u.key!==e&&(d=vs(e,!1),l(d));const c=i.useRef(d);c.current=d;const m=i.useRef(s);m.current=s;const f=i.useRef(!1),h=i.useRef(!1),x=d.plan;cn(()=>{const y=a.current;if(!x||!y)return;const v=[],b=(R,S,k)=>{const A=k==null?null:y.querySelector(S);!A||k==null||(R.current=!0,v.push(no(A,k,()=>{R.current=!1})))};return b(f,o,x.list),b(h,An,x.detail),()=>{for(const R of v)R()}},[x,a,o]),cn(()=>{const y=Za(d,n,r);y!==d&&l(y)},[d,n,r]),i.useEffect(()=>{const y=a.current;if(!y)return;const v=b=>{const R=b.target;R instanceof HTMLElement&&(R.matches(An)?h.current||gt(c.current.key,{detailTop:R.scrollTop}):R.matches(o)&&(f.current||gt(c.current.key,{listTop:R.scrollTop})))};return y.addEventListener("scroll",v,{capture:!0,passive:!0}),()=>y.removeEventListener("scroll",v,{capture:!0})},[a,o]);const{selection:j,auto:p}=d;cn(()=>{var v;if(p||!j||h.current)return;const y=(v=a.current)==null?void 0:v.querySelector(An);gt(c.current.key,{detailTop:(y==null?void 0:y.scrollTop)??0})},[j,p,a]);const g=i.useCallback(y=>l(eo(c.current,y,m.current)),[]);return{selection:j,auto:p,choose:g}}const so=5*6e4,ro=2*6e4,ao=24,$s={shown:!1,sprints:[],total:0,isLast:!1,loading:!1,error:null},oo={status:"idle",issues:[],next:"",total:null,capped:!1,error:null,more:!1},Ge=new Map,Kn=new Set,Hn=new Set;function Ss(e,n=!1){for(const[s,r]of Ge)s.startsWith(`${e}|`)&&Ge.set(s,{...r,loadedAt:0});for(const s of lt.keys())s.startsWith(`${e}|`)&&lt.delete(s);for(const s of Kn)s(e);return n?Promise.all([...Hn].map(s=>s(e))).then(()=>{}):Promise.resolve()}const io=(e,n,s)=>`${e}|${n}|${s.mine?"mine":"all"}|${s.quick.join(",")}`;function Cs(e,n){for(Ge.delete(e),Ge.set(e,n);Ge.size>ao;)Ge.delete(Ge.keys().next().value)}function Rs(e,n){for(const[s,r]of[...Ge.entries()].reverse())if(s.startsWith(`${e}|${n}|`)&&r.overview)return{overview:r.overview,groups:{},subtasks:{},closed:{...$s,shown:r.closed.shown,loading:r.closed.loading,sprints:r.closed.sprints,total:r.closed.total,isLast:r.closed.isLast},loadedAt:0};return{overview:null,groups:{},subtasks:{},closed:$s,loadedAt:0}}function En(e){if(!e.closed.loading&&!Object.values(e.groups).some(r=>r.status==="loading"||r.more)&&!Object.values(e.subtasks).some(r=>r.status==="loading"))return e;const n=Object.fromEntries(Object.entries(e.groups).map(([r,a])=>[r,{...a,status:a.status==="loading"?"idle":a.status,more:!1}])),s=Object.fromEntries(Object.entries(e.subtasks).filter(([,r])=>r.status!=="loading"));return{...e,groups:n,subtasks:s,closed:{...e.closed,loading:!1},loadedAt:0}}function ze(e){return e instanceof Ve?e:new Ve("upstream",e instanceof Error&&e.message?e.message:"Jira could not be read.")}const Wn=e=>e instanceof DOMException&&e.name==="AbortError",lo=new Set(["auth","expired","rate-limit","tls","unreachable","incompatible","network","unavailable"]);function As(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 co(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 uo(e,n,s,r){const a=s?io(n,s,r):"",[o,u]=i.useState(()=>a&&Ge.get(a)||Rs(n,s??"")),l=i.useRef(o),[d,c]=i.useState(!1),[m,f]=i.useState(null),h=i.useRef(0),x=i.useRef(0),j=i.useRef(null),p=i.useRef(!0),g=i.useRef(a),y=i.useRef(r);y.current=r,i.useEffect(()=>(p.current=!0,()=>{var T;p.current=!1,(T=j.current)==null||T.abort()}),[]);const v=i.useCallback(()=>((!j.current||j.current.signal.aborted)&&(j.current=new AbortController),j.current.signal),[]),b=i.useCallback((T,F)=>{if(!p.current||T!==g.current)return;const q=F(l.current);l.current=q,T&&Cs(T,q),u(q)},[]),R=i.useCallback((T,F,q)=>{b(T,_=>({..._,groups:{..._.groups,[F]:q(_.groups[F]??oo)}}))},[b]),S=i.useCallback(async(T,F,q,_)=>{if(s){R(T,F.id,P=>({...P,status:"loading",error:null}));try{const P=await bs(e,s,As(F,y.current,q),_);if(_.aborted)return;R(T,F.id,()=>({status:"ready",issues:P.issues,next:P.next,total:P.total,capped:P.capped,error:null,more:!1}))}catch(P){if(Wn(P)||_.aborted)return;const B=ze(P);if(R(T,F.id,D=>({...D,status:"error",error:B,more:!1})),lo.has(B.kind))throw B}}},[s,e,R]),k=i.useCallback(async()=>{var B;if(!p.current||!s||g.current!==a)return;const T=g.current,F=++h.current;(B=j.current)==null||B.abort();const q=new AbortController;j.current=q;const{signal:_}=q,P=l.current.closed.loading?l.current.closed.sprints.length:null;b(T,D=>{const G=En(D);return{...G,closed:P===null?G.closed:{...G.closed,loading:!0},loadedAt:0}}),c(!0),f(null),await(async()=>{try{const D=await Ta(e,s,_);if(_.aborted||!p.current||F!==h.current)return;x.current++,b(T,V=>({...V,overview:D,subtasks:{}}));const G=l.current.closed,ae=ys(D,G.shown?G.sprints:[]),K=ae.filter(V=>V.kind==="active"||V.kind==="column"&&V.column!=="done"),Se=ae.filter(V=>!K.includes(V)&&(V.kind!=="closed"||l.current.groups[V.id]));if(await Promise.all(K.map(V=>S(T,V,D,_))),await co(Se,3,V=>_.aborted?Promise.resolve():S(T,V,D,_)),P!==null&&!_.aborted&&F===h.current){b(T,V=>({...V,closed:{...V.closed,loading:!0,error:null}}));try{const V=await xs(e,s,P,_);!_.aborted&&F===h.current&&b(T,je=>{const H=new Set(je.closed.sprints.map(xe=>xe.id)),Fe=P===0?V.sprints:[...je.closed.sprints,...V.sprints.filter(xe=>!H.has(xe.id))];return{...je,closed:{...je.closed,sprints:Fe,total:V.total,isLast:V.isLast,loading:!1,error:null}}})}catch(V){!_.aborted&&F===h.current&&b(T,je=>({...je,closed:{...je.closed,loading:!1,error:ze(V)}}))}}F===h.current&&b(T,V=>({...V,loadedAt:[...K,...Se].some(je=>{var H;return((H=V.groups[je.id])==null?void 0:H.status)==="error"})||P!==null&&V.closed.error?0:Date.now()}))}catch(D){if(Wn(D)||_.aborted||F!==h.current)return;q.abort();const G=ze(D);b(T,ae=>{const K=En(ae);return ae.closed.loading?{...K,closed:{...K.closed,error:G}}:K}),f(G)}finally{F===h.current&&c(!1)}})()},[s,e,a,S,b]);i.useEffect(()=>{const T=F=>F===n?k():void 0;return Hn.add(T),()=>{Hn.delete(T)}},[n,k]),i.useEffect(()=>{var B,D;(B=j.current)==null||B.abort(),h.current++,g.current=a;const T=a?Ge.get(a):void 0,F=T?En(T):void 0,q=F??Rs(n,s??""),P=!!(T??q).closed.loading?{...q,closed:{...q.closed,loading:!0}}:q;if(a&&F&&P!==T&&Cs(a,P),l.current=P,u(P),c(!1),f(null),!s){(D=j.current)==null||D.abort(),c(!1);return}(!F||Date.now()-F.loadedAt>so)&&k()},[a]);const A=i.useCallback((T,F=!1)=>{const q=l.current.overview,_=l.current.groups[T.id];if(!q||_&&_.status!=="idle"&&!(F&&_.status==="error"))return;const P=v(),B=g.current;S(B,T,q,P).catch(D=>f(ze(D)))},[S,v]),O=i.useCallback(T=>{const F=l.current.overview,q=l.current.groups[T.id];if(!s||!F||!q||!q.next||q.more)return;const _=g.current,P=h.current,B=v();R(_,T.id,D=>({...D,more:!0,error:null})),(async()=>{try{const D=await bs(e,s,As(T,y.current,F,q.next),B);if(B!=null&&B.aborted||P!==h.current||!p.current)return;R(_,T.id,G=>{const ae=new Set(G.issues.map(K=>K.key));return{...G,issues:[...G.issues,...D.issues.filter(K=>!ae.has(K.key))],next:D.next,total:D.total??G.total,capped:D.capped,more:!1}})}catch(D){if(B!=null&&B.aborted||P!==h.current||!p.current)return;const G=ze(D);R(_,T.id,ae=>({...ae,more:!1,error:G}))}})()},[s,e,R,v]),z=i.useCallback(T=>{if(!s)return;const F=g.current,q=h.current,_=v();b(F,P=>({...P,closed:{...P.closed,shown:!0,loading:!0,error:null}})),(async()=>{try{const P=await xs(e,s,T,_);if(_!=null&&_.aborted||q!==h.current||!p.current)return;b(F,B=>{const D=new Set(B.closed.sprints.map(ae=>ae.id)),G=T===0?P.sprints:[...B.closed.sprints,...P.sprints.filter(ae=>!D.has(ae.id))];return{...B,closed:{...B.closed,sprints:G,total:P.total,isLast:P.isLast,loading:!1,error:null}}})}catch(P){if(_!=null&&_.aborted||q!==h.current||!p.current)return;const B=ze(P);b(F,D=>({...D,closed:{...D.closed,loading:!1,error:B}}))}})()},[s,e,b,v]),C=i.useCallback(T=>{const F=g.current;if(!T){b(F,_=>({..._,closed:{..._.closed,shown:!1}}));return}const q=l.current.closed;q.sprints.length||q.loading?b(F,_=>({..._,closed:{..._.closed,shown:!0}})):z(0)},[z,b]),N=i.useCallback(()=>{const T=l.current.closed;T.loading||T.isLast||z(T.sprints.length)},[z]),L=i.useCallback(T=>{const F=l.current.subtasks[T];if(F&&F.status!=="error")return;const q=g.current,_=h.current,P=x.current,B=v(),D=G=>b(q,ae=>({...ae,subtasks:{...ae.subtasks,[T]:G}}));D({status:"loading",issues:(F==null?void 0:F.issues)??[],error:null}),Ia(e,T,B).then(G=>{!(B!=null&&B.aborted)&&_===h.current&&P===x.current&&p.current&&D({status:"ready",issues:G.issues,error:null})}).catch(G=>{!(B!=null&&B.aborted)&&_===h.current&&P===x.current&&p.current&&D({status:"error",issues:[],error:ze(G)})})},[e,b,v]),te=o.closed,de=o.overview?ys(o.overview,te.shown?te.sprints:[]):[];return{snap:o,groups:de,loading:d,error:m,refresh:k,ensureGroup:A,loadMore:O,showClosed:C,moreClosed:N,loadSubtasks:L}}const lt=new Map;function ho(e,n,s){const r=s?`${n}|${s}`:"",[a,o]=i.useState(()=>{var p;return r?((p=lt.get(r))==null?void 0:p.data)??null:null}),[u,l]=i.useState(!1),[d,c]=i.useState(null),[m,f]=i.useState(0),h=i.useRef(!1),x=i.useRef(r);i.useEffect(()=>{const p=g=>{g===n&&s&&(h.current=!0,f(y=>y+1))};return Kn.add(p),()=>{Kn.delete(p)}},[n,s]),i.useEffect(()=>{const p=x.current===r;if(x.current=r,!s){o(null),c(null);return}const g=lt.get(r);if(o(v=>(g==null?void 0:g.data)??(p?v:null)),c(null),g&&!h.current&&Date.now()-g.at<ro){l(!1);return}h.current=!1;const y=new AbortController;return l(!0),Da(e,s,y.signal).then(v=>{y.signal.aborted||(lt.set(r,{at:Date.now(),data:v}),lt.size>60&&lt.delete(lt.keys().next().value),o(v))}).catch(v=>{!Wn(v)&&!y.signal.aborted&&c(ze(v))}).finally(()=>{y.signal.aborted||l(!1)}),()=>y.abort()},[r,e,s,m]);const j=i.useCallback(()=>{h.current=!0,f(p=>p+1)},[]);return{data:a,loading:u,error:d,reload:j}}const Ee=new Map,Ht=new Map,et=new Map,Ue={busy:!1,uncertain:!1,error:"",draft:""};let fo=0;const tt=new Set;function ur(e){const n=Ee.get(e);!Ht.has(e)&&!tt.has(e)&&n&&!n.busy&&!n.uncertain&&!n.draft&&!n.operation&&(Ee.delete(e),et.delete(e))}function ns(e){return!(e instanceof Ve)||e.operation?!1:["invalid","permission","expired","auth","not-found","rate-limit"].includes(e.kind)?!0:e.status!=null&&e.status>=400&&e.status<500&&e.status!==408&&e.status!==409}function Ne(e,n){const s=Ee.get(e)??Ue;Object.entries(n).some(([o,u])=>o!=="draft"&&!(o==="busy"&&u===!1&&tt.has(e))&&(o==="operation"?JSON.stringify(s.operation)!==JSON.stringify(u):s[o]!==u))&&et.set(e,++fo);const a={...s,...n};Ee.set(e,a);for(const o of Ht.get(e)??[])o(a);ur(e)}function ss(e,n,s,r){const a=JSON.stringify([e,n,s]),[o,u]=i.useState(()=>({key:a,state:Ee.get(a)??(r?{...Ue,loading:!0}:Ue)})),l=c=>c.connectionId===e&&c.kind===(s==="transition"?"status":s)&&(s==="move"||c.issueKey===n);return i.useEffect(()=>{var g;let c=!0,m=!1;const f=new AbortController,h=async()=>{var v;if(!r||!c||m||tt.has(a))return;m=!0;const y=et.get(a)??0;try{const b=await Zn((k,A)=>r(k,{...A,cache:"no-store"}),"write-guard",{signal:f.signal,timeoutMs:3e4});if(!Array.isArray(b.operations))throw new Error;const R=b.operations.map(ms).find(k=>k&&l(k));if(!c||tt.has(a)||(et.get(a)??0)!==y)return;const S=Ee.get(a)??Ue;if(S.busy)return;Ne(a,{loading:!1,operation:R,uncertain:!!R||S.uncertain,...R&&s==="move"&&!S.draft?{draft:`${(v=R.issueKeys)==null?void 0:v.join(", ")} · Board ${R.boardId}`}:{},...R?{error:R.state==="pending"?"Jira is still processing this write. Wait before checking again.":"Check Jira before trying again."}:{}})}catch{c&&!tt.has(a)&&(et.get(a)??0)===y&&Ne(a,{loading:!1,uncertain:!0,error:"Could not check Jira write safety. Try again before writing."})}finally{m=!1}},x=y=>u({key:a,state:y});let j=Ht.get(a);j||Ht.set(a,j=new Set),j.add(x),r&&!((g=Ee.get(a))!=null&&g.busy)&&!tt.has(a)&&Ne(a,{loading:!0}),x(Ee.get(a)??Ue),r&&h();const p=r?setInterval(()=>{h()},3e3):void 0;return()=>{c=!1,f.abort(),p&&clearInterval(p),j.delete(x),j.size||Ht.delete(a),ur(a)}},[a,r]),{state:o.key===a?o.state:Ee.get(a)??(r?{...Ue,loading:!0}:Ue),begin(c=""){const m=Ee.get(a)??(r?{...Ue,loading:!0}:Ue);return m.busy||m.uncertain||m.loading?!1:(Ne(a,{busy:!0,uncertain:!1,error:"",draft:c}),!0)},update:c=>Ne(a,c),checkpoint:()=>et.get(a)??0,finishMove(c,m,f,h){const x=Ee.get(a)??Ue;h!==void 0&&(et.get(a)??0)!==h?Ne(a,{busy:!1}):f&&x.operation&&x.operation.operationId!==f?Ne(a,{busy:!1,uncertain:!0}):Ne(a,{busy:!1,uncertain:c,draft:m})},async acknowledge(c){var g,y,v;if(!r)return Ne(a,{uncertain:!1,error:"",...s==="move"?{draft:""}:{}}),!0;const m=Ee.get(a)??Ue,f=c??((g=m.operation)==null?void 0:g.operationId);if(((y=m.operation)==null?void 0:y.state)==="pending"||tt.has(a))return!1;tt.add(a),Ne(a,{loading:!0});const h=et.get(a)??0,x=()=>(et.get(a)??0)===h,j=new AbortController,p=setTimeout(()=>j.abort(),3e4);try{if(f){const k=await r("write-guard/acknowledge",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({operationId:f}),signal:j.signal});if(!k.ok&&k.status!==409)throw new Error}const b=await r("write-guard",{cache:"no-store",signal:j.signal});if(!b.ok)throw new Error;const R=await b.json();if(!Array.isArray(R.operations))throw new Error;const S=R.operations.map(ms).find(k=>k&&l(k));return x()?S?(Ne(a,{operation:S,uncertain:!0,error:"Check Jira before trying again.",...s==="move"&&S.operationId!==f?{draft:`${(v=S.issueKeys)==null?void 0:v.join(", ")} · Board ${S.boardId}`}:{}}),!1):x()?(Ne(a,{uncertain:!1,error:"",operation:void 0,...s==="move"?{draft:""}:{}}),!0):!1:!1}catch{return x()&&Ne(a,{uncertain:!0,error:"Could not clear the Jira write guard. Check Jira and try again."}),!1}finally{clearTimeout(p),tt.delete(a),Ee.has(a)&&Ne(a,{loading:!1})}}}}function mo(){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 hr(){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 po(){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 go(){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 rs(){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 fr(){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 jo({loadedAt:e,loading:n,stale:s},r=Date.now()){const a=e!=null?Zs(r-e):null,o=(u,l,d="",c=null)=>({tone:u,word:l,join:d,ago:c,text:`${l}${d}${c??""}`});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 xo(e,n){return e==="reading"||e==="updating"?"Updating…":n?e==="stale"?"Not updated":e==="updated"?"Updated":"":""}function mr({loadedAt:e,loading:n,stale:s=!1,onRefresh:r,label:a,disabled:o=!1,now:u}){const[,l]=i.useState(0),d=i.useRef(n);d.current=n;const[c,m]=i.useState(!1);i.useEffect(()=>{if(e==null)return;const x=window.setInterval(()=>l(j=>j+1),3e4);return()=>window.clearInterval(x)},[e]),i.useEffect(()=>{n&&m(!0)},[n]);const f=jo({loadedAt:e,loading:n,stale:s},u??Date.now()),h=e!=null?new Date(e):null;return t.jsxs("div",{className:"ig-freshness","data-tone":f.tone,children:[f.tone!=="none"&&t.jsxs("span",{className:"ig-fresh",children:[f.tone==="stale"&&t.jsx(hr,{}),t.jsx("span",{className:"ig-fresh-word",children:f.word}),f.join,h&&f.ago&&t.jsx("time",{dateTime:h.toISOString(),title:h.toLocaleString(),children:f.ago})]}),t.jsx("span",{className:"vis-hidden",role:"status",children:xo(f.tone,c)}),t.jsx("button",{type:"button",className:"glyph-btn ig-refresh","aria-label":a,title:"Refresh",...Le(n,o),"data-loading":n||void 0,onClick:()=>{$e(d.current)&&r()},children:t.jsx(la,{})})]})}function as({value:e,onChange:n,label:s,placeholder:r,inputRef:a,onKeyDown:o}){const u=i.useRef(null),l=a??u,[d,c]=i.useState(!1),m=d&&e!=="",f=i.useRef(n);return f.current=n,i.useEffect(()=>{if(m)return Ys.push(()=>f.current(""),0,"popover")},[m]),t.jsxs("div",{className:"ig-search","data-filled":e!==""||void 0,children:[t.jsx(mo,{}),t.jsx("input",{ref:l,type:"search",className:"ig-search-input","aria-label":s,placeholder:r,value:e,onChange:h=>n(h.target.value),onKeyDown:o,onFocus:()=>c(!0),onBlur:()=>c(!1)}),e!==""&&t.jsx("button",{type:"button",className:"glyph-btn ig-search-clear","aria-label":"Clear the search",title:"Clear",onClick:()=>{var h;n(""),(h=l.current)==null||h.focus()},children:t.jsx(fr,{})})]})}function gn({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 an=new Set;function Ln(e,n,s){for(const r of[e,n])if(r&&!s.has(r))return r;return null}function pr(e){return{width:e,height:e,"--ig-avatar-size":`${e}px`}}function Vt({src:e,direct:n,name:s,size:r=20,you:a=!1,className:o=""}){const[u,l]=i.useState(()=>Ln(e,n,an));i.useEffect(()=>l(Ln(e,n,an)),[e,n]);const d=pr(r),c=a||void 0;return u?t.jsx("img",{className:`ig-avatar ${o}`.trim(),style:d,src:u,alt:"","aria-hidden":!0,referrerPolicy:"no-referrer",loading:"lazy",decoding:"async",draggable:!1,"data-you":c,onError:()=>{an.add(u),l(Ln(e,n,an))}}):t.jsx("span",{className:`ig-avatar ig-avatar-initials ${o}`.trim(),"data-large":r>=28||void 0,"data-you":c,style:d,"aria-hidden":!0,children:ca(s)})}function gr({size:e=20}){return t.jsx("span",{className:"ig-avatar ig-avatar-none",style:pr(e),"aria-hidden":!0})}function jr({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(Vt,{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 bo(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 xr({people:e,max:n=3,size:s=20,label:r}){if(!e.length)return null;const a=e.map(d=>d.name),o=e.length>n?e.slice(0,n):e,u=e.length-o.length,l=bo(a);return t.jsxs("span",{className:"ig-stack",role:"img","aria-label":r?`${r} ${l}`:l,title:a.join(", "),children:[o.map(d=>t.jsx(Vt,{src:d.src,direct:d.direct,name:d.name,size:s,you:d.you},d.key)),u>0&&t.jsxs("span",{className:"ig-stack-more","aria-hidden":!0,children:["+",u]})]})}function yo(e){switch(e){case"auth":case"expired":return"reconnect";case"permission":case"incompatible":return"settings";case"not-found":return"none";default:return"retry"}}function ko(e){return e==="reconnect"?"Reconnect":e==="settings"?"Open connection settings":"Try again"}function br(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 wo(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 ${br(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 vo(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 No(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 Et({error:e,provider:n,host:s,stale:r=!1,onRetry:a,onReconnect:o,title:u,body:l,children:d,now:c}){const[m,f]=i.useState(()=>c??Date.now()),[h,x]=i.useState(()=>c??Date.now());i.useEffect(()=>{const O=Date.now();f(O),x(O)},[e]);const j=c??h,p=No(e,m,j);i.useEffect(()=>{if(p<=0)return;const O=window.setTimeout(()=>x(Date.now()),1e3);return()=>window.clearTimeout(O)},[p,h]);const g=wo(e,n,s,j),y=u??g.title,v=l??g.body,b=vo(e,v),R=yo(e.kind),S=R==="retry"?a:R==="none"?void 0:o,k=R==="none"?"":ko(R),A=R==="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(hr,{}):t.jsx(po,{}),t.jsx("strong",{children:y})]}),v&&t.jsx("p",{className:"ig-failure-body",children:v}),b&&!r&&t.jsxs("p",{className:"ig-failure-said",children:[n," said: ",b]})]}),(S||d)&&t.jsxs("div",{className:"ig-failure-actions",children:[S&&t.jsx("button",{type:"button",className:A?"btn primary":"btn","aria-disabled":p>0||void 0,onClick:()=>{p<=0&&S()},children:p>0?`${k} ${br(p,j)}`:k}),d]})]})}const Mn=new Set;function yr({src:e,label:n,fallback:s,className:r="jr-icon"}){const[a,o]=i.useState(()=>!e||Mn.has(e));return i.useEffect(()=>o(!e||Mn.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:()=>{Mn.add(e),o(!0)}})}function $o(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 So={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 Co({type:e,subtask:n}){const s=e.epic?"epic":$o(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"}),So[s]]})}const Ro={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 Ao({priority:e}){const n=ts(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:Ro[n]})]}):t.jsx("span",{className:"jr-icon",title:`Priority: ${e.name}`,"aria-hidden":!0})}const jn=({type:e,subtask:n})=>t.jsx(yr,{src:e.icon,label:e.name,fallback:t.jsx(Co,{type:e,subtask:n})}),os=({priority:e})=>e?t.jsx(yr,{src:e.icon,label:`Priority: ${e.name}`,fallback:t.jsx(Ao,{priority:e})}):t.jsx("span",{className:"jr-icon","aria-hidden":!0});function kr({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 xn({status:e}){return t.jsx("span",{className:"jr-status ig-chip","data-cat":e.category,title:e.name,children:e.name})}function Eo({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=$t(e.estimate,s),a=e.remaining!=null&&e.remaining!==e.estimate?$t(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 wr(){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 qn({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 Lo({items:e,groups:n,anchorId:s,portalId:r,boundaryId:a,busy:o,uncertain:u=!1,outcome:l="",onChecked:d,onMove:c,onClose:m,error:f,initialView:h="move"}){const x=i.useId(),j=i.useRef(o);j.current=o;const p=i.useRef(!1),g=i.useRef(null),[y,v]=i.useState(h),[b,R]=i.useState(e[0].group.id),S=y==="menu",k=n.filter(L=>At(L)),A=k.find(L=>L.id===b),O=A?(()=>{const L=At(A);if(!L||!e.length||e.length>50||e.some(de=>st(de)))return null;const te=e.map(de=>de.issue.key);return new Set(te).size!==te.length?null:{...te.length===1?{issueKey:te[0]}:{issueKeys:te},target:L,atEnd:!0}})():null,z=e.length===1?st(e[0]):null,C=z?`${e[0].issue.key} ${z}. This issue cannot be moved.`:ln(e),N=async()=>{if(!(!O||!A||u||!$e(j.current||p.current))){p.current=!0;try{await c(O,A)}finally{p.current=!1}}};return t.jsx(pn,{anchorId:s,portalRootId:r,boundaryId:a??r,id:`${x}-popover`,className:S?"jr-actions-pop":"jr-move-pop",role:S?"menu":"dialog",labelledBy:S?s:`${x}-title`,onClose:m,children:S?t.jsxs(t.Fragment,{children:[t.jsx("button",{type:"button",className:"jr-action-item",role:"menuitem","aria-disabled":!!C||o,"aria-describedby":C?`${x}-problem`:void 0,onClick:()=>{!C&&$e(j.current||p.current)&&v("move")},children:e.length===1?"Move…":`Move ${e.length} issues…`}),C&&t.jsx("p",{id:`${x}-problem`,className:"jr-action-hint",children:C})]}):t.jsxs("form",{onSubmit:L=>{L.preventDefault(),N()},children:[t.jsxs("h3",{id:`${x}-title`,children:["Move ",e.length===1?e[0].issue.key:`${e.length} issues`]}),t.jsx("label",{htmlFor:`${x}-destination`,children:"Destination"}),t.jsx("select",{id:`${x}-destination`,value:b,...Le(o),autoFocus:!0,onChange:L=>{$e(j.current||p.current)&&R(L.target.value)},children:k.map(L=>t.jsx("option",{value:L.id,children:L.title},L.id))}),t.jsx("p",{className:"jr-move-help",children:"Saved at the end of the destination in Jira. Status stays the same."}),f&&t.jsx("p",{className:"jr-move-error",role:"alert",children:f}),u&&l&&t.jsx("p",{className:"jr-move-help",children:l}),t.jsxs("div",{className:"jr-move-actions",children:[t.jsx("button",{ref:g,type:"button",className:"btn",onClick:m,children:"Cancel"}),u&&t.jsx("button",{type:"button",className:"btn",onClick:L=>{var te;document.activeElement===L.currentTarget&&((te=g.current)==null||te.focus()),d==null||d()},children:"I checked the issues"}),t.jsx("button",{type:"submit",className:"btn primary",...Le(o,!O),"aria-disabled":u||void 0,children:o?"Moving…":e.length===1?"Move issue":`Move ${e.length} issues`})]})]})})}function Es({item:e,portalRootId:n,children:s}){const r=e.fixVersions??[],a=o=>{var u;return(u=o.closest(".jr-board"))!=null&&u.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(da,{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 Ls={new:"To do",indeterminate:"In progress",done:"Done"},Mo=["new","indeterminate","done"],Ms=e=>e<=30;function To({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 u=n.new+n.indeterminate+n.done;if(u<=0)return null;const l=ks(u,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=Mo.filter(u=>n[u]>0);return o.length===0?null:t.jsx("span",{className:"jr-totals",children:o.map(u=>{const l=ks(n[u],s,r);return t.jsxs("span",{className:"jr-total","data-cat":u,title:`${Ls[u]}: ${l} ${a}`,children:[Ls[u]," ",l]},u)})})}function Io({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 Ts(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 Is({issue:e,estimation:n,time:s}){const r=e.status.category==="done";return t.jsxs(t.Fragment,{children:[t.jsx(jn,{type:e.type}),t.jsx(os,{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(wr,{})}),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(kr,{epic:e.epic})]}),t.jsx(Eo,{issue:e,estimation:n,time:s}),t.jsx("span",{className:"jr-status-cell",children:t.jsx(xn,{status:e.status})})]}),t.jsx("span",{className:"jr-assignee",title:e.assignee?`${e.assignee.name}${e.mine?" (you)":""}`:"Unassigned",children:e.assignee?t.jsx(Vt,{src:e.assignee.avatar,name:e.assignee.name,size:20,you:e.mine}):t.jsx(gr,{size:20})})]})}function Do(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 Fo(e){var hs;const{conn:n,overview:s,groups:r,snap:a,expanded:o,onToggleGroup:u,filter:l,mine:d,filtered:c,selected:m,onOpen:f,rowsOpen:h,onToggleRow:x,onRetryGroup:j,onMore:p,onShowClosed:g,onMoreClosed:y,loadSubtasks:v,onReconnect:b,onMove:R,moveBusy:S=!1,readBusy:k=S,moveUncertain:A=!1,moveOutcome:O="",onMoveChecked:z}=e,C=i.useRef(null),N=i.useId(),L=i.useRef(null),te=i.useRef(!1),[de,T]=i.useState([]),[F,q]=i.useState(()=>new Set),[_,P]=i.useState(!1),B=i.useRef(null),D=i.useRef(0),[G,ae]=i.useState(null),[K,Se]=i.useState(null),V=i.useRef(0),[je,H]=i.useState(""),[Fe,xe]=i.useState(""),we=i.useRef(!1),rt=i.useRef(!1);rt.current=S;const be=i.useRef(!1);be.current=k;const Oe=i.useRef(!1);Oe.current=a.closed.loading;const ce=((hs=s.moves)==null?void 0:hs.enabled)===!0&&!!R,Be=(w,$,J,X=!1,U="move")=>{if(!$e(rt.current||we.current))return;const Z=F.has(w.key)?Te:[{issue:w,group:$}];if(U==="move"&&(Z.length>50||Z.some(Q=>!on(Q.issue,Q.group)))){H(ln(Z));return}V.current++,H(""),Se({issue:w,items:Z,anchorId:J,keyboard:X,initialView:U})},M=()=>{const w=K;we.current&&w&&!document.getElementById(w.anchorId)||V.current++,Se(null),w!=null&&w.keyboard&&requestAnimationFrame(()=>{var J,X;document.activeElement===document.getElementById(w.anchorId)&&((X=Array.from(((J=C.current)==null?void 0:J.querySelectorAll(".jr-row-main[data-key]"))??[]).find(U=>U.dataset.key===w.issue.key))==null||X.focus())})},re=()=>{L.current=null,T([]),ae(null)},ye=async(w,$)=>{if(!R||S||we.current)return!1;const J=V.current,X=D.current,U=un(w),Z=U.length===1?U[0]:`${U.length} issues`,Q=document.activeElement,oe=Q==null?void 0:Q.closest(".jr-move-pop");we.current=!0,H(""),xe(`Moving ${Z}…`);try{const pe=await R(w);xe(pe.notice||`${Z} moved to ${$.title}.`),X===D.current&&q(new Set(U));const Ce=J===V.current&&(document.activeElement===Q||!!(oe!=null&&oe.contains(document.activeElement))||document.activeElement===document.body&&(!(Q!=null&&Q.isConnected)||(oe==null?void 0:oe.isConnected)));return J===V.current&&Se(null),u($,!0),Ce&&requestAnimationFrame(()=>{var Ae,We;(We=Array.from(((Ae=C.current)==null?void 0:Ae.querySelectorAll(".jr-row-main[data-key]"))??[]).find(Ze=>{var Y;return Ze.dataset.key===U[0]&&((Y=Ze.dataset.nav)==null?void 0:Y.startsWith(`${$.id}/`))})??document.getElementById(`jr-group-${$.id.replace(/[^a-z0-9]/gi,"-")}-toggle`))==null||We.focus()}),!0}catch(pe){return xe(""),H(pe instanceof Error?pe.message:"The move could not be confirmed. Refresh before trying again."),J===V.current&&document.activeElement===document.body&&!(Q!=null&&Q.isConnected)&&requestAnimationFrame(()=>{var Re,Ae;if(document.activeElement!==document.body)return;(Ae=Array.from(((Re=C.current)==null?void 0:Re.querySelectorAll(".jr-row-main[data-key]"))??[]).find(We=>{var Ze;return We.dataset.key===U[0]&&((Ze=We.dataset.nav)==null?void 0:Ze.startsWith(`${$.id}/`))})??document.getElementById(`jr-group-${$.id.replace(/[^a-z0-9]/gi,"-")}-toggle`))==null||Ae.focus()}),!1}finally{we.current=!1}},He=(w,$)=>{!L.current||!ce||S||!At($)||(w.preventDefault(),w.dataTransfer.dropEffect="move",ae({group:$.id}))},at=(w,$)=>{const J=L.current;if(!J||!ce||S)return;w.preventDefault();const X=js(J.items,$);re(),X&&ye(X,$)},[ot,Qe]=i.useState(()=>new Set),[ht,Me]=i.useState(()=>new Set),[yt,kt]=i.useState(null),it=s.estimation.kind,ft=s.timeTracking,ve=i.useMemo(()=>or(r,a.groups,w=>{var $;return($=a.subtasks[w])==null?void 0:$.issues},l).map(w=>({...w,stats:za(w.rows,it)})),[r,a.groups,a.subtasks,l,it]),Zt=w=>Bn(w,h),wt=i.useMemo(()=>{const w=[],$=new Set,J=(X,U)=>{$.has(X.key)||($.add(X.key),w.push({issue:X,group:U}))};for(const{def:X,rows:U}of ve)if(_t(X,o)){for(const Z of U)if(Z.kind==="issue"&&J(Z.issue,X),Bn(Z,h))for(const Q of Pn(Z,a.subtasks[ct(Z)],l))J(Q,X)}return w},[ve,o,h,a.subtasks,l]),en=wt.map(w=>w.issue.key),Te=wt.filter(w=>F.has(w.issue.key)),E=Te.filter(w=>st(w)),W=ln(Te);i.useEffect(()=>{const w=new Set(wt.map($=>$.issue.key));q($=>[...$].every(J=>w.has(J))?$:new Set([...$].filter(J=>w.has(J)))),B.current&&!w.has(B.current)&&(B.current=null)},[wt]);const ne=(w,$,J=!1)=>{const X=$.ctrlKey||$.metaKey,U=X||$.shiftKey||J,Z=B.current;D.current++,q(Q=>La(Q,en,w,Z,$.shiftKey?X?"add-range":"range":X||J?"toggle":"replace")),$.shiftKey||(B.current=w),P(U),U||f(w)};i.useEffect(()=>{for(const{def:w,rows:$}of ve)if(_t(w,o))for(const J of $){if(!Zt(J))continue;const X=ct(J);a.subtasks[X]||!ir(J,c)||v(X)}},[ve,h,o]);const Pe=(w,$)=>{$&&Me(J=>new Set(J).add(w)),x(w,$)},tn=()=>{var w;return Array.from(((w=C.current)==null?void 0:w.querySelectorAll("[data-nav]"))??[])},Ye=w=>{var $;w&&(w.focus(),($=w.scrollIntoView)==null||$.call(w,{block:"nearest"}))},le=w=>{var Z,Q;const $=w.target;if($.dataset.key&&w.key===" "&&!w.altKey){w.preventDefault(),w.repeat||ne($.dataset.key,w,!0);return}if(!$.dataset.nav||w.altKey||w.ctrlKey||w.metaKey)return;const J=tn(),X=J.indexOf($),U=$.getAttribute("data-expanded");switch(w.key){case"ArrowDown":w.preventDefault(),Ye(J[Math.min(J.length-1,X+1)]);return;case"ArrowUp":w.preventDefault(),Ye(J[Math.max(0,X-1)]);return;case"Home":w.preventDefault(),Ye(J[0]);return;case"End":w.preventDefault(),Ye(J[J.length-1]);return;case"ArrowRight":U==="false"?(w.preventDefault(),(Z=document.getElementById($.dataset.toggle??""))==null||Z.click()):U==="true"&&(w.preventDefault(),Ye(J[X+1]));return;case"ArrowLeft":U==="true"?(w.preventDefault(),(Q=document.getElementById($.dataset.toggle??""))==null||Q.click()):$.dataset.parent&&(w.preventDefault(),Ye(J.find(oe=>oe.dataset.nav===$.dataset.parent)));return}},Ft=i.useMemo(()=>{for(const{def:w,rows:$}of ve)if(_t(w,o)&&$.length>0)return`${w.id}/${ct($[0])}`;return ve.length?`g:${ve[0].def.id}`:null},[ve,o]);i.useEffect(()=>{var w;yt&&!((w=C.current)!=null&&w.querySelector(`[data-nav="${CSS.escape(yt)}"]`))&&kt(null)});const nn=w=>w===(yt??Ft)?0:-1,Yr=(w,$,J,X)=>{const U=ct(w),Z=`${$.id}/${U}`,Q=Zt(w),oe=a.subtasks[U],pe=w.kind==="issue"?w.issue.subtaskKeys.length:0,Ce=pe>0||w.matched.length>0||w.kind==="context",Re=`jr-toggle-${$.id.replace(/[^a-z0-9]/gi,"-")}-${U}`,Ae=Pn(w,oe,l),We=((oe==null?void 0:oe.status)==="ready"?oe.issues:w.matched).filter(I=>I.mine).length,Ze=w.kind==="issue"?Ts(w.issue,Ce?`, ${pe||w.matched.length} sub-tasks${We?`, ${We} yours`:""}`:""):`${w.parent.key}: ${w.parent.summary}. ${d?"Not assigned to you":"Parent not in this list"}; shown for ${w.matched.length} sub-task${w.matched.length===1?"":"s"}`,Y=w.kind==="issue"?w.issue:null,he=ce&&Y&&on(Y,$)&&J===0,vt=`${N}-move-${$.id}-${U}`,sn=`${vt}-row`,rn=ce&&Y&&J===0;return t.jsxs("li",{className:"jr-item","data-context":w.kind==="context"||void 0,children:[t.jsxs("div",{className:"jr-row ig-row","data-selected":gs(U,F,m,_)||void 0,"data-picked":F.has(U)||void 0,"data-done":(Y==null?void 0:Y.status.category)==="done"||void 0,"data-current":m===U||void 0,"data-move-blocked":!!(Y&&F.has(U)&&st({issue:Y,group:$}))||void 0,"data-mine":(Y==null?void 0:Y.mine)||void 0,"data-dragging":de.includes(U)||void 0,"data-drop":(G==null?void 0:G.group)===$.id&&G.key===U?G.side:void 0,draggable:!!(he&&!S),onPointerDown:I=>{te.current=!!I.target.closest(".jr-toggle, .jr-move-button")},onDragStart:I=>{if(!he||S||!Y||te.current){I.preventDefault();return}const ke=F.has(U)?Te:[{issue:Y,group:$}];if(ke.length>50||ke.some(fe=>!on(fe.issue,fe.group))){I.preventDefault(),H(ln(ke));return}F.has(U)||(D.current++,B.current=U,q(new Set([U])),P(!1)),L.current={items:ke},I.dataTransfer.effectAllowed="move",I.dataTransfer.setData("text/plain",ke.map(fe=>fe.issue.key).join(`
2
+ `)),T(ke.map(fe=>fe.issue.key)),Se(null)},onDragEnd:re,onDragOver:I=>{if(!L.current||!ce||S||!Y||Y.type.subtask||!At($))return;if(I.stopPropagation(),L.current.items.some(fe=>fe.issue.key===U)){ae(null);return}I.preventDefault(),I.dataTransfer.dropEffect="move";const ke=I.currentTarget.getBoundingClientRect();ae({group:$.id,key:U,side:I.clientY<ke.top+ke.height/2?"before":"after"})},onDrop:I=>{const ke=L.current;if(!ke||!ce||S||!Y||Y.type.subtask)return;I.preventDefault(),I.stopPropagation();const fe=I.currentTarget.getBoundingClientRect(),na=I.clientY<fe.top+fe.height/2?"before":"after",fs=js(ke.items,$,{key:U,side:na});re(),fs&&ye(fs,$)},children:[Ce?t.jsx("button",{type:"button",id:Re,className:"jr-toggle",tabIndex:-1,"aria-expanded":Q,"aria-label":`${Q?"Hide":"Show"} sub-tasks of ${U}`,onClick:()=>Pe(U,!Q),children:t.jsx(qn,{open:Q})}):t.jsx("span",{className:"jr-toggle-space","aria-hidden":!0}),t.jsx(Es,{item:w.kind==="issue"?w.issue:w.parent,portalRootId:N,children:t.jsx("button",{type:"button",id:sn,className:"jr-row-main","aria-haspopup":rn?"menu":void 0,"data-nav":Z,"data-key":U,"data-parent":X,"data-toggle":Ce?Re:void 0,"data-has-meta":Y?!!(Y.flagged||Y.fixVersions.length||Y.epic)||void 0:!0,"data-expanded":Ce?String(Q):void 0,"aria-expanded":Ce?Q:void 0,"aria-controls":Ce&&Q?`${Re}-children`:void 0,"aria-describedby":`${N}-instructions`,tabIndex:nn(Z),"aria-current":m===U||void 0,onKeyDown:I=>{if(rn&&!S&&(I.key==="ContextMenu"||I.shiftKey&&I.key==="F10")){I.preventDefault(),I.stopPropagation(),Be(Y,$,sn,!1,"menu");return}he&&!S&&I.altKey&&!I.ctrlKey&&!I.metaKey&&(I.code==="KeyM"||I.key.toLowerCase()==="m")&&Y&&(I.preventDefault(),I.stopPropagation(),Be(Y,$,sn,!0))},"aria-label":`${Ze}${F.has(U)?". Selected":""}`,onFocus:()=>kt(Z),onClick:I=>{Y?(I.preventDefault(),ne(U,I)):!I.ctrlKey&&!I.metaKey&&!I.shiftKey&&(q(new Set),P(!1),f(U))},onContextMenu:I=>{Y&&I.ctrlKey?(I.preventDefault(),I.currentTarget.focus(),ne(U,I)):rn&&!S&&(I.preventDefault(),I.currentTarget.focus(),Be(Y,$,sn,!1,"menu"))},children:Y?t.jsx(Is,{issue:Y,estimation:it,time:ft}):w.kind==="context"&&t.jsxs(t.Fragment,{children:[t.jsx(jn,{type:w.parent.type}),t.jsx(os,{priority:w.parent.priority}),t.jsx("span",{className:"jr-key","data-done":w.parent.status.category==="done"||void 0,children:w.parent.key}),t.jsx("span",{className:"jr-summary",children:w.parent.summary}),t.jsxs("span",{className:"jr-facts",children:[t.jsx("span",{className:"jr-meta",children:t.jsx("span",{className:"jr-context-tag",children:d?"not assigned to you":"parent not in this list"})}),t.jsx("span",{className:"jr-status-cell",children:t.jsx(xn,{status:w.parent.status})})]})]})})}),rn&&t.jsx("button",{id:vt,type:"button",className:"jr-move-button",...Le(S),"aria-label":`Actions for ${U}`,title:`Actions for ${U}`,"aria-haspopup":"menu","aria-expanded":(K==null?void 0:K.anchorId)===vt,tabIndex:nn(Z),onKeyDown:I=>{(I.key==="ArrowDown"||I.key==="ArrowUp")&&(I.preventDefault(),I.stopPropagation(),Be(Y,$,vt,!1,"menu"))},onClick:()=>{$e(rt.current||we.current)&&((K==null?void 0:K.anchorId)===vt?M():Be(Y,$,vt,!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"})]})})]}),Ce&&Q&&t.jsxs("ul",{id:`${Re}-children`,className:"jr-subrows",role:"list","aria-label":`Sub-tasks of ${U}`,"data-fade":ht.has(U)&&Ms(Ae.length)||void 0,children:[(oe==null?void 0:oe.status)==="loading"&&Ae.length===0&&t.jsx("li",{className:"jr-subnote",role:"status",children:"Reading sub-tasks…"}),(oe==null?void 0:oe.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:()=>v(U),children:"Try again"})]}),Ae.map(I=>{const ke=`${$.id}/${I.key}/${Z}`;return t.jsx("li",{className:"jr-item",children:t.jsxs("div",{className:"jr-row jr-subrow ig-row","data-selected":gs(I.key,F,m,_)||void 0,"data-picked":F.has(I.key)||void 0,"data-done":I.status.category==="done"||void 0,"data-current":m===I.key||void 0,"data-move-blocked":!!(F.has(I.key)&&st({issue:I,group:$}))||void 0,"data-mine":I.mine||void 0,children:[t.jsx("span",{className:"jr-toggle-space","aria-hidden":!0}),t.jsx(Es,{item:I,portalRootId:N,children:t.jsx("button",{type:"button",className:"jr-row-main","data-nav":ke,"data-key":I.key,"data-parent":Z,tabIndex:nn(ke),"data-has-meta":!!(I.flagged||I.fixVersions.length||I.epic)||void 0,"aria-current":m===I.key||void 0,"aria-label":`${Ts(I)}${F.has(I.key)?". Selected":""}`,"aria-describedby":`${N}-instructions`,onFocus:()=>kt(ke),onClick:fe=>{fe.preventDefault(),ne(I.key,fe)},onContextMenu:fe=>{fe.ctrlKey&&(fe.preventDefault(),fe.currentTarget.focus(),ne(I.key,fe))},children:t.jsx(Is,{issue:I,estimation:it,time:ft})})})]})},I.key)}),(oe==null?void 0:oe.status)==="ready"&&Ae.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."})]})]},U)},us=s.hasSprints,Zr=us&&s.sprints.active.length===0,ue=a.closed,ea=ve.findIndex(w=>w.def.kind==="closed"),ta=i.useMemo(()=>Do(a),[a]);return t.jsxs("div",{className:"jr-board",id:N,ref:C,onKeyDown:le,style:{"--jr-status-ch":ta},children:[t.jsxs("p",{className:"vis-hidden",id:`${N}-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.",ce?" Drag selected issues to reorder or change sprint. Right-click or Shift+F10 opens actions. Alt+M opens Move.":""]}),_&&Te.length>0&&t.jsxs("div",{className:"jr-selection",role:"group","aria-label":"Selected issues",children:[t.jsxs("span",{role:"status",children:[Te.length," selected"]}),ce&&t.jsx("button",{type:"button",className:"btn",id:`${N}-move-selected`,...Le(S,!!W),"aria-haspopup":"dialog","aria-expanded":(K==null?void 0:K.anchorId)===`${N}-move-selected`,onClick:()=>{W||Be(Te[0].issue,Te[0].group,`${N}-move-selected`)},children:"Move selected"}),t.jsx("button",{type:"button",className:"btn","aria-label":"Clear selection",onClick:()=>{D.current++,q(new Set),P(!0),B.current=null},children:"Clear"}),W&&ce&&t.jsx("span",{className:"jr-selection-note",id:`${N}-blocked`,children:W}),E.length>0&&ce&&t.jsxs("button",{type:"button",className:"btn",onClick:()=>{D.current++,q(new Set(Te.filter(w=>!st(w)).map(w=>w.issue.key))),H("")},children:["Remove blocked (",E.length,")"]})]}),t.jsx("p",{className:"jr-move-status",role:"status","aria-live":"polite",children:Fe}),je&&!K&&t.jsx("p",{className:"jr-move-error",role:"alert",children:je}),Zr&&t.jsx("p",{className:"jr-board-note",children:"No sprint is active on this board. The future sprints and the backlog are below."}),ve.map(({def:w,data:$,rows:J,stats:X},U)=>{const Z=_t(w,o),Q=`jr-group-${w.id.replace(/[^a-z0-9]/gi,"-")}`,oe=`g:${w.id}`,pe=w.sprint,Ce=pe&&(pe.startDate||pe.endDate)?`${ws(pe.startDate)||"?"} – ${ws(pe.completeDate??pe.endDate)||"?"}`:"",Re=($==null?void 0:$.status)==="ready"||(($==null?void 0:$.issues.length)??0)>0,Ae=($==null?void 0:$.total)!=null&&w.paged&&$.total>X.count&&!l.search&&!l.hideDone&&!l.attention,We=w.kind==="closed"&&(!$||$.status==="idle"),Ze=Re?Ae?`${X.count} of ${$.total}`:`${X.count}`:($==null?void 0:$.status)==="error"?"":"…",Y=X.assignees;return t.jsxs(i.Fragment,{children:[U===ea&&t.jsx("h3",{className:"jr-closed-title",children:"Closed sprints"}),t.jsxs("section",{className:"jr-group","data-kind":w.kind,"aria-labelledby":`${Q}-title`,"data-drop-group":(G==null?void 0:G.group)===w.id&&!G.key||void 0,onDragOver:he=>He(he,w),onDrop:he=>at(he,w),children:[t.jsxs("div",{className:"jr-group-head",children:[t.jsx("h3",{className:"jr-group-title",id:`${Q}-title`,children:t.jsxs("button",{type:"button",id:`${Q}-toggle`,className:"jr-group-toggle","data-nav":oe,"data-toggle":`${Q}-toggle`,"data-expanded":String(Z),"aria-expanded":Z,"aria-controls":Q,tabIndex:nn(oe),onFocus:()=>kt(oe),onClick:()=>{Z||Qe(he=>new Set(he).add(w.id)),u(w,!Z)},children:[t.jsx(qn,{open:Z}),t.jsxs("span",{className:"jr-group-identity",children:[t.jsx("span",{className:"jr-group-name",children:w.title}),w.kind==="active"&&t.jsx("span",{className:"jr-badge",children:"Active"}),Ce&&t.jsx("span",{className:"jr-group-dates",children:Ce}),We?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:[Ze," ",Re?X.count===1&&!Ae?"issue":"issues":t.jsx("span",{className:"vis-hidden",children:"issues, not read yet"})]})]})]})}),Re&&t.jsxs("div",{className:"jr-group-facts",children:[t.jsx(Io,{stats:X,mine:d}),t.jsx(xr,{label:"Assigned to",people:Y.map(he=>({key:he.id,name:he.name,src:he.avatar,you:he.id===X.youId}))}),t.jsx(To,{def:w,totals:X.totals,estimation:it,time:ft})]})]}),(pe==null?void 0:pe.goal)&&Z&&t.jsx("p",{className:"jr-goal",children:pe.goal}),Z&&t.jsxs("div",{id:Q,className:"jr-group-body","data-empty":($==null?void 0:$.status)==="ready"&&J.length===0&&!$.error&&!$.next&&!$.capped||void 0,"data-fade":ot.has(w.id)&&Ms(J.length)||void 0,children:[($==null?void 0:$.error)&&t.jsx(Et,{error:$.error,provider:"Jira",host:Ct(n),stale:$.issues.length>0,title:$.status==="ready"?"More issues could not be read":void 0,onRetry:()=>{var he;(he=document.getElementById(`${Q}-toggle`))==null||he.focus(),$.status==="ready"&&$.next?p(w):j(w)},onReconnect:b}),(!$||$.status==="idle"||$.status==="loading"&&$.issues.length===0)&&t.jsx(gn,{label:`Reading ${w.title}`,rows:3}),Re&&J.length===0&&t.jsx("p",{className:"jr-empty-group",children:(($==null?void 0:$.issues.length)??0)>0?"Nothing here matches the filters.":d?"None of your issues are here.":c?"Nothing here matches the filters.":"No issues."}),J.length>0&&t.jsx("ul",{className:"jr-rows",children:J.map(he=>Yr(he,w,0))}),($==null?void 0:$.capped)&&t.jsx("p",{className:"jr-board-note",children:"The first 600 issues are shown. Open the sprint in Jira for the rest."}),w.paged&&($==null?void 0:$.next)&&t.jsx("button",{type:"button",className:"btn jr-more",...Le(k||!!$.more),onClick:()=>{$e(be.current||!!$.more)&&p(w)},children:$.more?"Reading…":$.total!=null?`Show more (${$.issues.length} of ${$.total})`:"Show more"})]})]})]},w.id)}),K&&t.jsx(Lo,{items:K.items,groups:r,snap:a,initialView:K.initialView,anchorId:K.anchorId,portalId:N,boundaryId:e.scrollBoundaryId,busy:S&&!A,uncertain:A,outcome:O,onChecked:z,error:je,onMove:ye,onClose:M},K.anchorId),us&&t.jsxs("div",{className:"jr-closed-foot",children:[t.jsx("button",{id:`${N}-closed-toggle`,type:"button",className:"btn","aria-expanded":ue.shown,"aria-busy":ue.loading||void 0,onClick:()=>g(!ue.shown),children:ue.shown?"Hide closed sprints":"Show closed sprints"}),ue.shown&&t.jsxs(t.Fragment,{children:[ue.loading&&t.jsx("p",{className:"jr-subnote",role:"status",children:"Reading closed sprints…"}),ue.error&&t.jsx(Et,{error:ue.error,provider:"Jira",host:Ct(n),title:"Closed sprints could not be read",stale:ue.sprints.length>0,onRetry:()=>{var w;(w=document.getElementById(`${N}-closed-toggle`))==null||w.focus(),ue.sprints.length?y():g(!0)},onReconnect:b}),!ue.error&&!ue.loading&&ue.sprints.length===0&&t.jsx("p",{className:"jr-subnote",children:"No closed sprints on this board."}),!ue.error&&!ue.isLast&&ue.sprints.length>0&&t.jsx("button",{type:"button",className:"btn",...Le(ue.loading),onClick:()=>{$e(Oe.current)&&y()},children:ue.loading?"Reading…":`Show older sprints (${ue.sprints.length} of ${ue.total})`})]})]})]})}function Oo({api:e,connectionId:n,issueKey:s,onChanged:r}){const a=ss(n,s,"transition",e),{busy:o,uncertain:u,loading:l,operation:d}=a.state,c=i.useRef(o);c.current=o;const m=i.useRef(null),f=i.useRef(null),h=i.useRef(null),[x,j]=i.useState(!1),[p,g]=i.useState(null),[y,v]=i.useState(""),[b,R]=i.useState("");i.useEffect(()=>{j(!1),g(null),v(""),R("")},[s]),i.useEffect(()=>{u&&j(!0)},[u]),i.useEffect(()=>{if(!x)return;const k=new AbortController;return g(null),R(""),Zn(e,`issue/${encodeURIComponent(s)}/transitions`,{signal:k.signal}).then(A=>{k.signal.aborted||g(A.transitions)}).catch(()=>{k.signal.aborted||R("Could not load Jira transitions. Try again.")}),()=>k.abort()},[e,s,x]);const S=async()=>{var z,C;if(!$e(c.current)||!y||!a.begin())return;c.current=!0,R("");let k=!1;const A=new AbortController,O=window.setTimeout(()=>A.abort(),3e4);try{k=!0;const N=await e(`issue/${encodeURIComponent(s)}/transitions`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({transitionId:y}),signal:A.signal});if(!N.ok)throw await Yn(N);const L=await N.json();if(!(L!=null&&L.ok)||L.issueKey!==s)throw new Error("Jira did not confirm the change. Refresh before trying again.");if(typeof document<"u"&&document.activeElement===f.current&&((z=m.current)==null||z.focus()),a.update({busy:!1,uncertain:!1,error:""}),L.operationId&&!await a.acknowledge(L.operationId))return;j(!1),v("")}catch(N){const L=ns(N);!L&&typeof document<"u"&&document.activeElement===f.current&&((C=m.current)==null||C.focus()),a.update({busy:!1,operation:N instanceof Ve?N.operation:void 0,uncertain:!L,error:L&&N instanceof Error?N.message:"Could not confirm the change. Check the status before trying again."})}finally{window.clearTimeout(O),c.current=!1,k&&r()}};return t.jsxs("span",{className:"jr-transition",children:[t.jsx("button",{ref:m,type:"button",className:"btn","aria-expanded":x,onClick:()=>{$e(c.current)&&j(k=>!k)},...Le(o),children:"Change status"}),x&&t.jsxs("span",{className:"jr-transition-controls",children:[p&&p.length===0&&t.jsx("span",{className:"jr-dim",children:"No transitions available."}),p&&p.length>0&&t.jsxs(t.Fragment,{children:[t.jsx("label",{className:"vis-hidden",htmlFor:"jira-transition-choice",children:"Available transitions"}),t.jsxs("select",{id:"jira-transition-choice",value:y,"aria-disabled":o||void 0,onChange:k=>{c.current||v(k.target.value)},children:[t.jsx("option",{value:"",children:"Choose transition"}),p.map(k=>t.jsxs("option",{value:k.id,disabled:k.requiresScreen,children:[k.name,k.to&&k.to!==k.name?` → ${k.to}`:"",k.requiresScreen?" (open in Jira)":""]},k.id))]}),t.jsx("button",{ref:f,type:"button",className:"btn",onClick:S,...Le(o||!!l,!y||u),children:o?"Changing…":"Apply"})]}),u&&t.jsx("button",{ref:h,type:"button",className:"btn","aria-disabled":(d==null?void 0:d.state)==="pending"||void 0,onClick:()=>{var k;typeof document<"u"&&document.activeElement===h.current&&((k=m.current)==null||k.focus()),a.acknowledge(),R("")},children:"I checked the status"}),!p&&!b&&t.jsx("span",{className:"jr-dim",children:"Loading transitions…"}),b&&t.jsx("span",{role:"alert",children:b}),a.state.error&&t.jsx("span",{role:"alert",children:a.state.error})]})]})}function Bo({api:e,connectionId:n,issueKey:s,onChanged:r}){const a=ss(n,s,"comment",e),{busy:o,uncertain:u,error:l,loading:d,operation:c}=a.state,m=i.useRef(o);m.current=o;const f=i.useRef(null),h=i.useRef(null),x=i.useRef(null),j=a.state.draft,[p,g]=i.useState(!1),y=async()=>{var R,S;if(!$e(m.current)||!j.trim()||j.length>1e4||!a.begin(j))return;m.current=!0,g(!1);const v=new AbortController,b=window.setTimeout(()=>v.abort(),3e4);try{const k=await e(`issue/${encodeURIComponent(s)}/comment`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({text:j}),signal:v.signal});if(!k.ok)throw await Yn(k);const A=await k.json();if(!(A!=null&&A.ok)||A.issueKey!==s)throw new Error("Unconfirmed comment");typeof document<"u"&&document.activeElement===f.current&&((R=h.current)==null||R.focus()),g(!0),a.update({busy:!1,draft:"",error:"",uncertain:!1}),A.operationId&&await a.acknowledge(A.operationId),r()}catch(k){const A=ns(k),O=k instanceof Ve?k.operation:void 0;!A&&typeof document<"u"&&document.activeElement===f.current&&((S=h.current)==null||S.focus()),a.update({busy:!1,operation:O,uncertain:!A,error:A&&k instanceof Error?k.message:"Could not confirm whether Jira saved the comment. Check the comments before sending again."}),r()}finally{window.clearTimeout(b),m.current=!1}};return t.jsxs("div",{className:"jr-comment-compose",children:[t.jsx("label",{htmlFor:"jira-comment-text",children:"Add a comment"}),t.jsx("textarea",{ref:h,id:"jira-comment-text",value:j,maxLength:1e4,rows:3,readOnly:o,onChange:v=>{m.current||(a.update({draft:v.target.value,...!u&&l?{error:""}:{}}),g(!1))},placeholder:"Write a comment…"}),t.jsxs("div",{className:"jr-comment-actions",children:[t.jsx("button",{ref:f,type:"button",className:"btn",...Le(o||!!d,!j.trim()||u),onClick:y,children:o?"Sending…":"Add comment"}),u&&t.jsx("button",{ref:x,type:"button",className:"btn","aria-disabled":(c==null?void 0:c.state)==="pending"||void 0,onClick:()=>{var v;typeof document<"u"&&document.activeElement===x.current&&((v=h.current)==null||v.focus()),a.acknowledge()},children:"I checked the comments"}),p&&t.jsx("span",{role:"status",children:"Comment added."})]}),l&&t.jsx("p",{role:"alert",children:l})]})}const Po=1,Uo=3,_o=48,Ko=2e4,Ho=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"]),Wo={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"},qo=new Set(["br","hr","img"]),Jo={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 zo(e){var r;const s=(((r=e.getAttribute)==null?void 0:r.call(e,"class"))??"").split(/\s+/).map(a=>Jo[a]).filter(Boolean);return s.length?[...new Set(s)].join(" "):void 0}function Ds(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 Fs(e){const n=Number.parseInt(String(e??""),10);return Number.isFinite(n)&&n>1&&n<=100?n:void 0}function vr({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 Go({src:e,href:n,alt:s,emoticon:r}){const[a,o]=i.useState(!1);return a?t.jsx(vr,{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 Vo(e){return typeof DOMParser>"u"?null:new DOMParser().parseFromString(e,"text/html").body}function Xo(e,n,s=Vo){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 u=(d,c,m)=>{var y,v,b,R,S,k;if(--a<0)return null;if(d.nodeType===Uo)return d.nodeValue??"";if(d.nodeType!==Po)return null;const f=String(d.nodeName).toUpperCase();if(Ho.has(f))return null;const h=()=>{if(m>=_o)return[];const A=[],O=d.childNodes;for(let z=0;z<O.length;z++){const C=u(O[z],`${c}.${z}`,m+1);C!==null&&C!==""&&A.push(C)}return A};let x=Wo[f];const j=/^H([1-6])$/.exec(f);if(j){const A=Math.min(Number(j[1])+3,6,o+1);o=A,x=`h${A}`}if(!x){const A=h();return A.length?i.createElement(i.Fragment,{key:c},...A):null}const p=zo(d);if(x==="img"){const A=Ds((y=d.getAttribute)==null?void 0:y.call(d,"src"),n.baseUrl);if(!A)return null;const O=(((v=d.getAttribute)==null?void 0:v.call(d,"alt"))??((b=d.getAttribute)==null?void 0:b.call(d,"title"))??"").slice(0,200),z=n.image(A),C=p==="jr-emoticon";return z?t.jsx(Go,{src:z,href:A,alt:O,emoticon:C},c):t.jsx(vr,{href:A,alt:O,emoticon:C},c)}if(x==="a"){const A=Ds((R=d.getAttribute)==null?void 0:R.call(d,"href"),n.baseUrl),O=h();return A?i.createElement("a",{key:c,href:A,target:"_blank",rel:"noreferrer noopener",className:p},...O.length?O:[A]):O.length?i.createElement(i.Fragment,{key:c},...O):null}const g={key:c};if(p&&(g.className=p),x==="td"||x==="th"){const A=Fs((S=d.getAttribute)==null?void 0:S.call(d,"colspan")),O=Fs((k=d.getAttribute)==null?void 0:k.call(d,"rowspan"));A&&(g.colSpan=A),O&&(g.rowSpan=O)}return x==="table"?t.jsx("div",{className:"jr-table-wrap",tabIndex:0,role:"region","aria-label":"Table",children:i.createElement("table",{className:p},...h())},c):(x==="pre"&&Object.assign(g,{tabIndex:0,role:"region","aria-label":"Code"}),qo.has(x)?i.createElement(x,g):i.createElement(x,g,...h()))},l=[];for(let d=0;d<r.childNodes.length;d++){const c=u(r.childNodes[d],String(d),0);c!==null&&c!==""&&l.push(c)}return l.length?l:null}function Os({html:e,ctx:n,className:s="jr-html",empty:r}){const a=i.useMemo(()=>Xo(e,n),[e,n]);return a?t.jsx("div",{className:s,children:a}):r?t.jsx(t.Fragment,{children:r}):null}function Qo(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(),ua(e).then(o=>r(!!o))},children:s?t.jsx(rs,{}):t.jsx(go,{})}),t.jsx("span",{className:"vis-hidden",role:"status",children:s?`${n[0].toUpperCase()}${n.slice(1)} copied`:""})]})}function Xt({reference:e,context:n,copyValue:s,copyLabel:r,href:a,openLabel:o,narrow:u,onClose:l}){const{path:d,num:c}=Qo(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:[d&&t.jsx("span",{className:"ig-ref-path",children:d}),c&&t.jsx("span",{className:"ig-ref-num",children:c})]}),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(Rt,{})]}),!u&&t.jsx("button",{type:"button",className:"glyph-btn ig-detail-close","aria-label":"Close details",title:"Close",onClick:l,children:t.jsx(fr,{})})]})]})}function qe({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 Tn({person:e,fallback:n,you:s=!1}){return e?t.jsx(jr,{src:e.avatar,name:e.name,size:18,you:s}):t.jsx("span",{className:"jr-dim",children:n})}function Yo({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(jn,{type:s.type}),t.jsx("span",{className:"jr-key",children:s.key}),t.jsx("span",{className:"jr-summary",children:s.summary}),t.jsx(xn,{status:s.status}),s.assignee?t.jsx(Vt,{src:s.assignee.avatar,name:s.assignee.name,size:18,you:s.mine}):t.jsx(gr,{size:18})]})},s.key))})}function Zo({conn:e,api:n,assetUrl:s,trail:r,estimation:a,time:o,onOpen:u,onTrail:l,onReconnect:d,narrow:c,auto:m=!1,onClose:f,onStatusChanged:h}){var C;const x=r[r.length-1]??null,{data:j,loading:p,error:g,reload:y}=ho(n,e.id,x),v=i.useMemo(()=>({baseUrl:e.baseUrl,image:N=>Fa(e,s,N)}),[e,s]),b=j&&j.issue.key===x?j.issue:null,R=b?Pa(b):null,S=i.useRef(!1),k=N=>{S.current=!0,N()},A=b==null?void 0:b.key;i.useEffect(()=>{var T;if(!A)return;const N=S.current;if(S.current=!1,m)return;const L=document.activeElement,te=L==null||L===document.body,de=L instanceof HTMLElement&&L.matches("[data-ig-back]");Ua({handedOff:N,narrow:c,focusLost:te,focusOnBack:de})&&((T=document.getElementById("jira-detail-title"))==null||T.focus())},[c,A,m]);const O=[],z=(C=b==null?void 0:b.parent)==null?void 0:C.key;return z&&!r.slice(0,-1).includes(z)&&O.push({label:z,title:b.parent.summary,go:()=>k(()=>u(z,"replace"))}),r.slice(0,-1).forEach((N,L)=>O.push({label:N,title:`Back to ${N}`,go:()=>k(()=>l(L))})),x?t.jsxs("article",{className:"jr-detail","aria-busy":p||void 0,"aria-labelledby":"jira-detail-title",children:[t.jsx(Xt,{reference:x,context:b==null?void 0:b.project.name,copyLabel:"key",href:(b==null?void 0:b.url)??null,openLabel:"Open in Jira",narrow:c,onClose:f}),O.length>0&&t.jsx("ol",{className:"jr-crumbs",role:"list","aria-label":"Related issues",children:O.map((N,L)=>t.jsx("li",{children:N.go?t.jsx("button",{type:"button",className:"jr-crumb",title:N.title,onClick:N.go,children:N.label}):t.jsx("span",{className:"jr-crumb-text",title:N.title,children:N.label})},`${N.label}-${L}`))}),g&&t.jsx(Et,{error:g,provider:"Jira",host:Ct(e),stale:!!b,onRetry:y,onReconnect:d}),!b&&p&&t.jsx(gn,{label:`Reading ${x}`,rows:4,variant:"lines"}),b&&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:b.summary}),t.jsxs("p",{className:"jr-detail-state",children:[t.jsxs("span",{className:"jr-with-icon",children:[t.jsx(jn,{type:b.type}),b.type.name]}),t.jsx(xn,{status:b.status}),h&&t.jsx(Oo,{api:n,connectionId:e.id,issueKey:b.key,onChanged:h},b.key),R&&t.jsx("span",{className:"jr-dim",children:R}),b.priority&&t.jsxs("span",{className:"jr-with-icon",children:[t.jsx(os,{priority:b.priority}),b.priority.name]}),b.flagged&&t.jsxs("span",{className:"jr-flagged",children:[t.jsx(wr,{})," Flagged"]})]})]}),t.jsxs("dl",{className:"jr-fields",children:[t.jsx(qe,{label:"Assignee",children:t.jsx(Tn,{person:b.assignee,fallback:"Unassigned",you:b.mine})}),t.jsx(qe,{label:"Reporter",children:b.reporter?t.jsx(Tn,{person:b.reporter,fallback:""}):null}),t.jsx(qe,{label:"Sprint",children:b.sprint?t.jsxs(t.Fragment,{children:[b.sprint.name,b.sprint.state?t.jsxs("span",{className:"jr-dim",children:[" · ",b.sprint.state]}):null]}):null}),t.jsx(qe,{label:"Epic",children:b.epic?t.jsx(kr,{epic:b.epic}):null}),t.jsx(qe,{label:"Fix versions",children:b.fixVersions.length?t.jsx("span",{className:"jr-chips",children:b.fixVersions.map(N=>t.jsx("span",{className:"jr-version",children:N},N))}):null}),t.jsx(qe,{label:"Labels",children:b.labels.length?t.jsx("span",{className:"jr-chips",children:b.labels.map(N=>t.jsx("span",{className:"jr-label",children:N},N))}):null}),t.jsx(qe,{label:"Components",children:b.components.join(", ")}),t.jsx(qe,{label:"Due",children:Ot(b.dueDate)}),a==="points"&&t.jsx(qe,{label:"Estimate",children:b.points!=null?`${b.points} ${b.points===1?"point":"points"}`:null}),t.jsx(qe,{label:"Time",children:Ga(b,o)})]}),t.jsx("p",{className:"jr-detail-dates",children:[b.created&&`Created ${Ot(b.created,!0)}`,b.updated&&`Updated ${Ot(b.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(Os,{html:b.descriptionHtml,ctx:v,empty:t.jsx("p",{className:"jr-dim",children:"No description."})})]}),j.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:j.subtasks.length})]}),t.jsx(Yo,{issues:j.subtasks,onOpen:N=>k(()=>u(N,"push"))})]}),j.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:j.attachments.length})]}),t.jsx("ul",{className:"jr-files",children:j.attachments.map(N=>t.jsxs("li",{children:[N.url?t.jsxs("a",{href:N.url,target:"_blank",rel:"noreferrer noopener",title:"Opens in Jira",children:[N.filename,t.jsx(Rt,{})]}):t.jsx("span",{children:N.filename}),t.jsx("span",{className:"jr-dim",children:[Va(N.size),Ot(N.created)].filter(Boolean).join(" · ")})]},N.id))})]}),t.jsxs("section",{className:"jr-detail-section","aria-labelledby":"jira-detail-comments",children:[t.jsxs("h3",{id:"jira-detail-comments",children:["Comments ",t.jsx("span",{className:"jr-count",children:j.comments.total>j.comments.items.length?`${j.comments.items.length} of ${j.comments.total}`:j.comments.total})]}),j.comments.items.length===0&&t.jsx("p",{className:"jr-dim",children:"No comments."}),t.jsx("ol",{className:"jr-comments",children:j.comments.items.map(N=>t.jsxs("li",{className:"jr-comment",children:[t.jsxs("div",{className:"jr-comment-head",children:[t.jsx(Tn,{person:N.author,fallback:"Someone"}),t.jsx("time",{className:"jr-dim",dateTime:N.created,children:Ot(N.created,!0)}),N.updated&&N.updated!==N.created&&t.jsx("span",{className:"jr-dim",children:"edited"})]}),t.jsx(Os,{html:N.html,ctx:v,empty:t.jsx("p",{className:"jr-dim",children:"(empty)"})})]},N.id))}),h&&t.jsx(Bo,{api:n,connectionId:e.id,issueKey:b.key,onChanged:h},b.key),j.comments.total>j.comments.items.length&&t.jsx("p",{className:"jr-dim",children:t.jsxs("a",{className:"jr-more-link",href:b.url,target:"_blank",rel:"noreferrer noopener",children:["The older comments are in Jira ",t.jsx(Rt,{})]})})]})]})]}):null}const ei=e=>typeof e=="string"&&e.length>0&&e.length<=40,In=e=>typeof e=="boolean",ti=e=>!!e&&typeof e=="object"&&!Array.isArray(e)&&Object.values(e).every(n=>typeof n=="boolean"),ni=e=>!!e&&typeof e=="object"&&typeof e.board=="string"&&Array.isArray(e.ids)&&e.ids.every(n=>typeof n=="string");function si({api:e,current:n,layerId:s,onPick:r,onClose:a}){const[o,u]=i.useState(""),[l,d]=i.useState({boards:[],isLast:!1,total:null,loading:!0,error:null}),c=i.useRef(null),m=i.useRef(null),f=i.useRef(0),h=i.useCallback((p,g)=>{const y=++f.current;d(v=>({...v,loading:!0,error:null,...g===0?{boards:[]}:{}})),rr(e,g,p).then(v=>{y===f.current&&d(b=>({boards:g===0?v.boards:[...b.boards,...v.boards.filter(R=>!b.boards.some(S=>S.id===R.id))],isLast:v.isLast,total:v.total,loading:!1,error:null}))}).catch(v=>{y===f.current&&d(b=>({...b,loading:!1,error:ze(v)}))})},[e]);i.useEffect(()=>{const p=window.setTimeout(()=>h(o.trim(),0),o?250:0);return()=>window.clearTimeout(p)},[o,h]);const x=()=>{var p;return Array.from(((p=m.current)==null?void 0:p.querySelectorAll("button[data-board]"))??[])},j=p=>{var b;if(p.key!=="ArrowDown"&&p.key!=="ArrowUp")return;const g=x();if(!g.length)return;p.preventDefault();const y=g.indexOf(document.activeElement),v=p.key==="ArrowDown"?y<0?0:Math.min(g.length-1,y+1):y<=0?-1:y-1;v<0?(b=c.current)==null||b.focus():g[v].focus()};return t.jsx(pn,{anchorId:s,align:"start",portalRootId:s,id:"jira-board-picker",className:"jr-board-pop",role:"dialog",labelledBy:"jira-board-picker-title",focusRef:c,onClose:a,children:t.jsxs("div",{className:"jr-board-pop-inner",onKeyDown:j,children:[t.jsx("p",{className:"jr-board-pop-title",id:"jira-board-picker-title",children:"Boards"}),t.jsx(as,{value:o,onChange:u,label:"Find a board by name",placeholder:"Find a board by name",inputRef:c}),t.jsx("ul",{className:"jr-board-list",role:"list",ref:m,"aria-label":"Boards","aria-busy":l.loading||void 0,children:l.boards.map(p=>t.jsx("li",{children:t.jsxs("button",{type:"button","data-board":p.id,className:"jr-board-item","aria-current":String(p.id)===n||void 0,onClick:()=>r(p),children:[t.jsx("span",{className:"jr-board-item-name",children:p.name}),t.jsx("span",{className:"jr-board-item-meta",children:[p.type,p.projectName||p.projectKey].filter(Boolean).join(" · ")})]})},p.id))}),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:()=>h(o.trim(),l.boards.length),children:["Show more boards",l.total!=null?` (${l.boards.length} of ${l.total})`:""]})]})})}const ri=(e,n)=>e[e.length-1]===n[n.length-1];function ai({connection:e,api:n,assetUrl:s,prefs:r,narrow:a,onReconnect:o}){var en,Te;const u=i.useId(),l=`jira:${e.id}`,[d,c]=i.useState(()=>r.read("board",ei)??null),[m,f]=i.useState(()=>r.read("boardName",E=>typeof E=="string")??""),[h,x]=i.useState(()=>r.read("mine",In)??!0),[j,p]=i.useState(()=>r.read("hideDone",In)??!1),[g,y]=i.useState(()=>r.read("attention",In)??!1),[v,b]=i.useState(()=>{const E=r.read("quick",ni);return E&&E.board===d?E.ids:[]}),[R,S]=i.useState(()=>r.read("expanded",ti)??{}),[k,A]=i.useState(()=>_n(l)),O=E=>{A(E),cr(l,E)},z=i.useRef(null),[C,N]=i.useState(!1),[L,te]=i.useState(null),[de,T]=i.useState(!1);i.useEffect(()=>{r.write("mine",h)},[r,h]),i.useEffect(()=>{r.write("hideDone",j)},[r,j]),i.useEffect(()=>{r.write("attention",g)},[r,g]),i.useEffect(()=>{d&&r.write("quick",{board:d,ids:v})},[r,d,v]),i.useEffect(()=>{r.write("expanded",R)},[r,R]);const F=i.useCallback(E=>{const W=String(E.id);c(W),f(E.name),r.write("board",W),r.write("boardName",E.name),b([])},[r]),q=i.useCallback(()=>{te(null),T(!1),rr(n,0,"").then(E=>{E.boards[0]?F(E.boards[0]):T(!0)}).catch(E=>te(ze(E)))},[n,F]);i.useEffect(()=>{d||q()},[d,q]);const _=i.useMemo(()=>({mine:h,quick:v}),[h,v]),P=uo(n,e.id,d,_),{snap:B,groups:D,loading:G,error:ae}=P,K=ss(e.id,"","move",n),Se=K.state.busy,V=Object.values(B.groups).some(E=>E.more||E.status==="loading"),je=async E=>{var Ye;const W=`${un(E).join(", ")} · ${m||`Board ${d}`}`;if(!d||G||V||!K.begin(W))throw new Error("Wait for the board to finish updating.");let ne=!1,Pe="",tn;try{const le=await Ma(n,d,E);return tn=le.operationId,le.operationId&&!await K.acknowledge(le.operationId)&&(ne=!0),le}catch(le){throw ne=!ns(le)||le.refreshRequired===!0,le instanceof Ve&&le.operation&&K.update({operation:le.operation}),le instanceof Ve&&((Ye=le.outcomes)!=null&&Ye.length)?Pe=le.outcomes.map(Ft=>`${Ft.issueKey}: membership ${Ft.membership}, rank ${Ft.rank}`).join("; "):le instanceof Ve&&le.moveOutcome&&(Pe=`${un(E)[0]}: membership ${le.moveOutcome.membership}, rank ${le.moveOutcome.rank}`),le}finally{const le=K.checkpoint();try{await Ss(e.id,!0)}finally{K.finishMove(ne,ne?`${W}${Pe?` — ${Pe}`:""}`:"",tn,le)}}},H=B.overview&&String(B.overview.board.id)===d?B.overview:null;i.useEffect(()=>{H&&H.board.name&&H.board.name!==m&&(f(H.board.name),r.write("boardName",H.board.name))},[H,m,r]);const{ensureGroup:Fe}=P;i.useEffect(()=>{for(const E of D)E.kind==="closed"&&R[E.id]&&Fe(E)},[D,R,Fe]);const xe=(E,W)=>S(ne=>({...ne,[E.id]:W})),we=h||j||g||v.length>0||k.trim()!=="",rt=()=>{var E;x(!1),p(!1),y(!1),b([]),O(""),(E=z.current)==null||E.focus()},be=i.useMemo(()=>({search:k,hideDone:j,attention:g}),[k,j,g]),Oe=i.useMemo(()=>Ka((H==null?void 0:H.quickFilters)??[]),[H]);i.useEffect(()=>{if(!H)return;const E=new Set(Oe.map(W=>W.id));b(W=>W.every(ne=>E.has(ne))?W:W.filter(ne=>E.has(ne)))},[H,Oe]);const ce=lr(l,d),[Be,M]=i.useState(()=>{var E;return{key:ce,open:((E=qt(ce))==null?void 0:E.rows)??{}}});let re=Be.open;Be.key!==ce&&(re=((en=qt(ce))==null?void 0:en.rows)??{},M({key:ce,open:re}));const ye=(E,W)=>{const ne={...re,[E]:W};M({key:ce,open:ne}),gt(ce,{rows:ne})},He=i.useMemo(()=>H?or(D,B.groups,E=>{var W;return(W=B.subtasks[E])==null?void 0:W.issues},be):[],[H,D,B.groups,B.subtasks,be]),at=i.useMemo(()=>{if(!H)return null;const{complete:E,keys:W,first:ne}=qa(He,R,re,B.subtasks,be,we);return{complete:E,has:Pe=>W.has(Pe[0]),first:ne==null?null:[ne]}},[H,He,R,re,B.subtasks,be,we]),ot=i.useRef(null),Qe=dr({listKey:ce,drawn:at,same:ri,sideBySide:!a,root:ot,listScroller:".jr-list-scroll"}),{choose:ht}=Qe,Me=i.useMemo(()=>Qe.selection??[],[Qe.selection]),yt=Me.length>0,kt=E=>{ht([E]),a&&requestAnimationFrame(()=>{var W;return(W=document.getElementById("jira-detail-title")??document.querySelector(".ig-detail [data-ig-back]"))==null?void 0:W.focus()})},it=i.useCallback(()=>{const E=Me[0];ht(null),requestAnimationFrame(()=>{const W=E?document.querySelector(`.jr-row-main[data-key="${CSS.escape(E)}"]`):null;W==null||W.focus()})},[Me,ht]),ft=Ct(e),ve=H?null:ae??L,Zt=(()=>{var E;return de?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 ",ft,". 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(Rt,{})]})})]}):ve?t.jsxs("div",{className:"jr-state",children:[t.jsx(Et,{error:ve,provider:"Jira",host:ft,onRetry:d?P.refresh:q,onReconnect:o}),ve.kind==="not-found"&&d&&t.jsx("p",{children:t.jsx("button",{type:"button",className:"btn",onClick:()=>N(!0),children:"Choose another board"})})]}):H?t.jsxs(t.Fragment,{children:[ae&&t.jsx(Et,{error:ae,provider:"Jira",host:ft,stale:!0,onRetry:P.refresh,onReconnect:o}),K.state.uncertain&&t.jsxs("div",{className:"jr-board-note",role:"alert",children:[K.state.draft&&t.jsxs(t.Fragment,{children:["The move of ",K.state.draft," needs verification. Check these issues in Jira before trying again. "," "]}),K.state.error&&t.jsxs("span",{children:[K.state.error," "," "]}),t.jsx("button",{type:"button",className:"btn","aria-disabled":((E=K.state.operation)==null?void 0:E.state)==="pending"||void 0,onClick:W=>{var ne,Pe;document.activeElement===W.currentTarget&&((Pe=(ne=ot.current)==null?void 0:ne.querySelector(".jr-row-main, .jr-group-toggle"))==null||Pe.focus()),K.acknowledge()},children:"I checked the issues"})]}),t.jsx(Fo,{conn:e,overview:H,groups:D,snap:B,expanded:R,onToggleGroup:xe,filter:be,mine:h,filtered:we,selected:Me[Me.length-1]??null,onOpen:kt,rowsOpen:re,onToggleRow:ye,onRetryGroup:W=>P.ensureGroup(W,!0),onMore:P.loadMore,onShowClosed:P.showClosed,onMoreClosed:P.moreClosed,loadSubtasks:P.loadSubtasks,onReconnect:o,onMove:je,moveBusy:Se||K.state.uncertain||!!K.state.loading||G||V,readBusy:Se||G||V,moveUncertain:K.state.uncertain,moveOutcome:K.state.draft,onMoveChecked:()=>{K.acknowledge()},scrollBoundaryId:u},d)]}):t.jsx(gn,{label:"Reading the board",rows:6})})(),wt=yt&&H?t.jsx(Zo,{conn:e,api:n,assetUrl:s,trail:Me,estimation:H.estimation.kind,time:H.timeTracking,onOpen:(E,W)=>ht(W==="push"?[...Me.filter(ne=>ne!==E),E]:[E]),onTrail:E=>ht(Me.slice(0,E+1)),onReconnect:o,narrow:a,auto:Qe.auto,onClose:it,onStatusChanged:()=>{Ss(e.id,!0)}}):null;return t.jsxs("div",{ref:ot,className:"jr-panel","data-deployment":((Te=e.meta)==null?void 0:Te.deployment)==="cloud"?"cloud":"server",children:[t.jsxs("div",{className:"jr-toolbar",hidden:a&&yt,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: ${(H==null?void 0:H.board.name)||m||(d?`Board ${d}`:"Choose a board")}`,title:[...new Set([(H==null?void 0:H.board.name)||m,H==null?void 0:H.board.projectName].filter(Boolean))].join(" · "),"aria-haspopup":"dialog","aria-expanded":C,"aria-controls":C?"jira-board-picker":void 0,onClick:()=>N(E=>!E),children:[t.jsx("span",{className:"jr-board-btn-label",children:"Board"}),t.jsx("span",{className:"jr-board-btn-name",children:(H==null?void 0:H.board.name)||m||(d?`Board ${d}`:"Choose a board")}),t.jsx(qn,{open:C})]})}),t.jsxs("div",{className:"jr-filters",role:"group","aria-label":"Filters",children:[t.jsx(as,{inputRef:z,value:k,onChange:O,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":h,onClick:()=>x(E=>!E),children:"Only my issues"}),t.jsx("button",{type:"button",className:"btn jr-chip","aria-pressed":j,onClick:()=>p(E=>!E),children:"Hide done"}),t.jsx("button",{type:"button",className:"btn jr-chip","aria-pressed":g,title:"Flagged, or Highest, Blocker or Critical priority, and not done",onClick:()=>y(E=>!E),children:"Needs attention"}),Oe.map(E=>t.jsx("button",{type:"button",className:"btn jr-chip","aria-pressed":v.includes(E.id),title:E.description||void 0,onClick:()=>b(W=>W.includes(E.id)?W.filter(ne=>ne!==E.id):[...W,E.id]),children:E.name},E.id))]}),we&&t.jsx("button",{type:"button",className:"jr-link-btn jr-clear",onClick:rt,children:"Clear filters"})]}),t.jsx(mr,{loadedAt:B.loadedAt||null,loading:G,stale:!!ae,onRefresh:()=>{d?P.refresh():q()},label:"Refresh the board",disabled:!d})]}),t.jsx(es,{storageKey:"jira",automaticDetailShare:.4,list:t.jsx("div",{className:"jr-list-scroll",id:u,children:Zt}),detail:wt,onBack:it,backLabel:"Back to the board",detailKey:Me[Me.length-1]}),C&&t.jsx(si,{api:n,current:d,layerId:"jira-board-layer",onPick:E=>{var W;F(E),N(!1),(W=document.getElementById("jira-board-button"))==null||W.focus()},onClose:()=>{var W,ne;const E=(W=document.getElementById("jira-board-picker"))==null?void 0:W.contains(document.activeElement);N(!1),E&&((ne=document.getElementById("jira-board-button"))==null||ne.focus())}})]})}const se={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"}},oi=12e4;function fn(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 Wt extends Error{constructor(n){super(n.message),this.info=n,this.name="ForgeReadError"}}async function is(e,n,s){let r;try{r=await e(n,{signal:s,headers:{accept:"application/json"}})}catch(u){throw(u==null?void 0:u.name)==="AbortError"?u:new Wt({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 Wt(o):new Wt({kind:"upstream",message:typeof o=="string"?o:`the deck answered ${r.status}`,status:r.status})}const Nt=new Map,ii=200;function Kt(e){return Nt.get(e)??{data:null,loadedAt:null,error:null}}function Jn(e,n){for(Nt.delete(e),Nt.set(e,n);Nt.size>ii;)Nt.delete(Nt.keys().next().value)}function Bs(e,n,s=!1){return s||e.loadedAt==null||n-e.loadedAt>=oi}function li(e){return e.data!=null&&e.error!=null}const Ps={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 De(e){return Ps[e??"none"]??Ps.none}function Qt(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 $r(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 ci(e,n){const s=n==null?void 0:n.login.trim().toLowerCase();return!!s&&!!e&&e.login.trim().toLowerCase()===s}function mn(e){return e==null?"–":e>=1e3?"999+":String(e)}function Yt(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 di(e){const n=[],s=[];for(const r of e)(r.stale&&!r.isDefault?s:n).push(r);return{active:n,stale:s}}function ui(e){const n=[],s=[];for(const r of e)(r.approvedByMe?s:n).push(r);return{waiting:n,approved:s}}function bn(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
+ `).toLowerCase();return s.replace(/^[#!]/,"").split(/\s+/).every(a=>r.includes(a))}function Us(e){const n=e.trim();return/^https?:\/\/\S+\/(?:-\/)?(?:merge_requests|issues|pull)\/\d+/.test(n)||/^[\w.-]+(?:\/[\w.-]+)+[#!]\d+$/.test(n)}const Bt={tab:"branches",filter:"all",state:"open",sort:"created",issueState:"open"},hi=["branches","changes","pipelines","issues"],Sr="view",fi=e=>!!e&&typeof e=="object"&&!Array.isArray(e);function _s(e){return mi(e.read(Sr,fi)??{})}function Ks(e,n){e.write(Sr,n)}function mi(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,hi,Bt.tab),filter:n(e.filter,["all","mine","review"],Bt.filter),state:n(e.state,["open","merged","closed"],Bt.state),sort:n(e.sort,["created","updated"],Bt.sort),issueState:n(e.issueState,["open","closed"],Bt.issueState),open:Array.isArray(e.open)?e.open.filter(s=>typeof s=="string").slice(0,20):[]}}function pi(e,n,s){return e?s||!n?"page":"stay":"opener"}function gi(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 ji(e,n,s){return e<=0?-1:n>=0&&n<e?n:s>=0&&s<e?s:0}function xi(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 bi(e,n){return n==="branches"?!1:n==="issues"?e==="gitlab":!0}function Cr(e){return e instanceof Wt?e.info:{kind:"upstream",message:"the read failed"}}function Xe(e,n,s,r={},a=0){const o=s?fn(s,r):null,u=o?`${n}
4
+ ${o}`:null,[l,d]=i.useState(()=>({key:u,read:mt(u?Kt(u):null,!1)})),[c,m]=i.useState(0),f=i.useRef(a);i.useEffect(()=>{if(!u||!o){d({key:u,read:mt(null,!1)});return}const p=Kt(u),g=c>0||a!==f.current;if(f.current=a,!Bs(p,Date.now(),g)){d({key:u,read:mt(p,!1)});return}d({key:u,read:mt(p,!0)});const y=new AbortController;return is(e,o,y.signal).then(v=>{if(y.signal.aborted)return;const b={data:v,loadedAt:Date.now(),error:null};Jn(u,b),y.signal.aborted||d({key:u,read:mt(b,!1)})},v=>{if(y.signal.aborted||(v==null?void 0:v.name)==="AbortError")return;const b={...Kt(u),error:Cr(v)};Jn(u,b),d({key:u,read:mt(b,!1)})}),()=>y.abort()},[e,u,o,a,c]);const h=i.useCallback(()=>m(p=>p+1),[]),x=l.key===u||!u?null:Kt(u);return{...l.key===u?l.read:mt(x,x!=null&&Bs(x,Date.now())),reload:h}}function mt(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?li(e):!1}}function dt(e,n,s,r={},a=0){var R;const o=Xe(e,n,s,r,a),u=s?fn(s,r):null,l=u?`${n}
5
+ ${u}
6
+ more`:null,[d,c]=i.useState(()=>({key:l,...Hs(l)})),[m,f]=i.useState(!1),[h,x]=i.useState(null),j=i.useRef(!1),p=i.useRef(null),g=o.loadedAt;i.useEffect(()=>{x(null);const S=Hs(l);c(S.base!=null&&S.base===g?{key:l,...S}:{key:l,items:[],next:void 0,base:g})},[l,g]),i.useEffect(()=>(j.current=!1,f(!1),()=>{var S;(S=p.current)==null||S.abort(),p.current=null,j.current=!1}),[e,l,g]);const y=d.next!==void 0?d.next:((R=o.data)==null?void 0:R.next)??null,v=i.useCallback(()=>{if(!s||!y||!l||!$e(j.current))return;j.current=!0;const S=new AbortController;p.current=S,f(!0),x(null),is(e,fn(s,{...r,cursor:y}),S.signal).then(k=>{S.signal.aborted||p.current!==S||c(A=>{const O={key:l,items:[...A.items,...k.items],next:k.next,base:A.base??g};return Jn(l,{data:O,loadedAt:Date.now(),error:null}),O})},k=>{!S.signal.aborted&&p.current===S&&x(Cr(k))}).finally(()=>{p.current===S&&(p.current=null,j.current=!1,f(!1))})},[e,s,y,l,r,g]),b=o.data?{items:[...o.data.items,...d.key===l?d.items:[]],next:y,total:o.data.total}:null;return{...o,data:b,loadingMore:m,moreError:h,loadMore:v,reload:o.reload}}function Hs(e){const n=e?Kt(e).data:null;return n?{items:n.items,next:n.next,base:n.base}:{items:[],next:void 0,base:null}}const Rr=i.createContext(null);function yi({value:e,children:n}){return t.jsx(Rr.Provider,{value:e,children:n})}function ee(){const e=i.useContext(Rr);if(!e)throw new Error("useForge outside a forge panel");return e}function yn(e,n){const{listKey:s,reportRows:r}=ee(),a=i.useRef(e);a.current=e;const o=e.map(Ar).join(`
7
+ `);cn(()=>{r({key:s,complete:n,items:a.current})},[r,s,n,o])}function Ar(e){switch(e.type){case"change":case"issue":return`${e.type}:${e.repo}:${e.number}`;case"branch":return`branch:${e.repo}:${e.name}`;case"pipeline":return`pipeline:${e.repo}:${e.id}`}}function Lt(e,n){if(!e||e.type!==n.type||e.repo!==n.repo)return!1;switch(n.type){case"change":case"issue":return e.number===n.number;case"branch":return e.name===n.name;case"pipeline":return e.id===n.id}}const Je=t.jsx("circle",{cx:"7",cy:"7",r:"5.6"});function ki(e){switch(e){case"passed":case"done":return t.jsxs(t.Fragment,{children:[Je,t.jsx("path",{d:"m4.6 7.2 1.7 1.7 3.2-3.5"})]});case"failed":return t.jsxs(t.Fragment,{children:[Je,t.jsx("path",{d:"M5 5l4 4M9 5 5 9"})]});case"running":return t.jsxs(t.Fragment,{children:[Je,t.jsx("path",{d:"M7 3.6a3.4 3.4 0 0 1 0 6.8z",fill:"currentColor",stroke:"none"})]});case"pending":return t.jsxs(t.Fragment,{children:[Je,t.jsx("path",{d:"M7 4.2V7l1.9 1.2"})]});case"canceled":case"closed":return t.jsxs(t.Fragment,{children:[Je,t.jsx("path",{d:"m3.1 10.9 7.8-7.8"})]});case"skipped":return t.jsxs(t.Fragment,{children:[Je,t.jsx("path",{d:"m4.7 5 2 2-2 2M7.5 5l2 2-2 2"})]});case"manual":return t.jsxs(t.Fragment,{children:[Je,t.jsx("path",{d:"M5.8 4.7v4.6L9.4 7z"})]});case"none":return t.jsxs(t.Fragment,{children:[Je,t.jsx("path",{d:"M4.7 7h4.6"})]});case"warning":return t.jsxs(t.Fragment,{children:[t.jsx("path",{d:"M7 1.9 12.9 12H1.1Z"}),t.jsx("path",{d:"M7 5.6v2.9M7 10.3v.05"})]});case"open":return t.jsxs(t.Fragment,{children:[Je,t.jsx("circle",{cx:"7",cy:"7",r:"2",fill:"currentColor",stroke:"none"})]});case"draft":return t.jsx("circle",{cx:"7",cy:"7",r:"5.6",strokeDasharray:"2.4 2"});case"merged":return t.jsx("path",{d:"M4.4 2.4v2.8c0 2.3 2.6 2.7 2.6 4.8v1.6M9.6 2.4v2.8c0 2.3-2.6 2.7-2.6 4.8"});case"approved":case"resolved":return t.jsx("path",{d:"m2.6 7.4 2.9 2.9 5.9-6.4"});case"changes-requested":return t.jsx("path",{d:"M7 2.4v5.2M4.4 5h5.2M4.4 11h5.2"});case"commented":return t.jsx("path",{d:"M2.2 2.8h9.6v6.6H6.4l-2.5 2.2V9.4H2.2z"});case"review-pending":return t.jsxs(t.Fragment,{children:[t.jsx("path",{d:"M1.4 7S3.4 3.4 7 3.4 12.6 7 12.6 7 10.6 10.6 7 10.6 1.4 7 1.4 7z"}),t.jsx("circle",{cx:"7",cy:"7",r:"1.7"})]});case"info":return t.jsxs(t.Fragment,{children:[Je,t.jsx("path",{d:"M7 6.5v3.4M7 4.4v.05"})]});case"linked":return t.jsx("path",{d:"M2.4 5h9L9.2 2.8M11.6 9h-9l2.2 2.2"})}}function kn({name:e,size:n=12,weight:s=1.3}){return t.jsx("svg",{className:"fg-glyph","data-glyph":e,width:n,height:n,viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:s,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:ki(e)})}function Er(){return t.jsx("svg",{className:"fgl-chevron",width:"10",height:"10",viewBox:"0 0 10 10",fill:"none",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:t.jsx("path",{d:"M2.5 4l2.5 2.5L7.5 4"})})}function ge({mark:e,quiet:n=!1,className:s}){return t.jsxs("span",{className:s?`fg-mark ${s}`:"fg-mark","data-tone":e.tone,title:e.word,children:[t.jsx(kn,{name:e.mark}),t.jsx("span",{className:n?"fg-sr":"fg-mark-word",children:e.word})]})}function xt({mark:e}){return t.jsxs("span",{className:"fg-badge","data-tone":e.tone,children:[t.jsx(kn,{name:e.mark})," ",e.word]})}function jt({id:e,title:n,count:s,defaultOpen:r,children:a,aside:o}){const{isOpen:u,toggle:l}=ee(),d=u(e)?!r:r;return t.jsxs("section",{className:"fg-group","data-open":d||void 0,children:[t.jsxs("h3",{className:"fg-group-head",children:[t.jsxs("button",{type:"button",className:"fg-fold","data-nav":"","aria-expanded":d,onClick:()=>l(e),children:[t.jsx("span",{className:"fg-fold-chevron","aria-hidden":"true"}),n,s!=null&&t.jsx("span",{className:"fg-count",children:s.toLocaleString()})]}),o]}),d&&a]})}function ie({error:e,onRetry:n,compact:s=!1}){const{kind:r,connection:a,onReconnect:o}=ee(),u=e.kind==="permission"&&e.message?`${e.message.replace(/\.\s*$/,"")}. Check the token's scopes in the connection's settings.`:void 0;return t.jsx(Et,{error:e,provider:se[r].name,host:wi(a.baseUrl),stale:s,onRetry:n,onReconnect:o,body:u})}function wi(e){try{return new URL(e).host||void 0}catch{return}}function ut({pages:e,label:n="Load more"}){var s;return e.moreError?t.jsx(ie,{error:e.moreError,onRetry:e.loadMore,compact:!0}):(s=e.data)!=null&&s.next?t.jsx("button",{type:"button",className:"btn fg-more",onClick:e.loadMore,...Le(e.loadingMore),children:e.loadingMore?"Loading…":n}):null}function Ke({rows:e=6,label:n}){return t.jsx(gn,{label:n,rows:e})}function ls(){const{asset:e,connection:n}=ee();return s=>({src:s.avatarUrl?e(s.avatarUrl):null,direct:ha(n,s.avatarUrl),name:s.name||s.login,you:ci(s,n.account)})}function Dt({user:e,size:n=20,nameless:s=!1}){const r=ls();return e?t.jsx(jr,{...r(e),size:n,nameless:s}):null}function Lr({user:e,size:n=20}){const s=ls();return t.jsx(Vt,{...s(e),size:n})}function me({at:e}){const[,n]=i.useState(0);return i.useEffect(()=>{const s=window.setInterval(()=>n(r=>r+1),3e4);return()=>window.clearInterval(s)},[]),e==null?null:t.jsx("time",{dateTime:new Date(e).toISOString(),title:new Date(e).toLocaleString(),children:Zs(Date.now()-e)})}function bt({value:e,label:n,children:s}){return t.jsxs("span",{className:"fg-copyable",children:[s??t.jsx("code",{children:e}),t.jsx(Nr,{value:e,label:n})]})}function Mt({href:e,children:n}){const{kind:s}=ee();return e?t.jsxs("a",{className:"ig-open",href:e,target:"_blank",rel:"noreferrer noopener",children:[n??`Open in ${se[s].name}`,t.jsx(Rt,{})]}):null}function vi(e){const n=i.useRef(null);i.useEffect(()=>{const s=e.current;if(!s)return;const r=()=>Array.from(s.querySelectorAll("[data-nav]")).filter(f=>f.getClientRects().length>0),a=f=>{const h=f.closest("li");return!h||!s.contains(h)?[]:Array.from(h.querySelectorAll("button, a[href], input, select, textarea")).filter(x=>x!==f&&!x.hasAttribute("data-nav")&&x.closest("li")===h)};let o;const u=(f,h)=>{for(const x of[f,...a(f)])h?x.removeAttribute("tabindex"):x.tabIndex!==-1&&(x.tabIndex=-1)},l=()=>{const f=r();o=f[ji(f.length,n.current?f.indexOf(n.current):-1,f.findIndex(h=>h.getAttribute("aria-current")==="true"))];for(const h of f)u(h,h===o)},d=f=>{var x;const h=f.target;!((x=h.hasAttribute)!=null&&x.call(h,"data-nav"))||h===o||(n.current=h,o!=null&&o.isConnected&&u(o,!1),u(h,!0),o=h)},c=f=>{var v,b,R;const h=f.target;if(!((v=h.hasAttribute)!=null&&v.call(h,"data-nav"))||f.altKey||f.ctrlKey||f.metaKey||f.shiftKey)return;const x=r(),j=x.indexOf(h);if(j<0)return;const p=h.getAttribute("aria-expanded"),g=gi(f.key,j,x.length);let y;if(g!=null)y=x[g];else if(f.key==="ArrowRight"&&p==="true")y=x[j+1];else if(f.key==="ArrowLeft"&&p==null)y=(b=h.closest(".fg-group"))==null?void 0:b.querySelector(".fg-group-head [data-nav]");else if(f.key==="ArrowRight"&&p==="false"||f.key==="ArrowLeft"&&p==="true"){f.preventDefault(),h.click();return}else return;f.preventDefault(),y&&y!==h&&(y.focus(),(R=y.scrollIntoView)==null||R.call(y,{block:"nearest"}))},m=new MutationObserver(l);return m.observe(s,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["aria-current","aria-expanded","hidden"]}),s.addEventListener("focusin",d),s.addEventListener("keydown",c),l(),()=>{m.disconnect(),s.removeEventListener("focusin",d),s.removeEventListener("keydown",c)}},[e])}function Ni(e,n){i.useLayoutEffect(()=>{const s=e.current,r=s==null?void 0:s.querySelector('[aria-selected="true"]');!s||!r||s.scrollWidth<=s.clientWidth||(s.scrollLeft+=xi(s.getBoundingClientRect(),r.getBoundingClientRect()))},[e,n])}function cs(e){const n=se[e].repo.toLowerCase();return n.endsWith("y")?`${n.slice(0,-1)}ies`:`${n}s`}function Mr(e){return`All ${cs(e)}`}function Tr(e){const n=e.lastIndexOf("/");return n<0?{group:"",name:e}:{group:e.slice(0,n+1),name:e.slice(n+1)}}function Ir(e,n,s){return s?n.key:`${e}${n.number}`}const $i=/^\s*(?:\[(?:draft|wip)\]|\((?:draft|wip)\)|(?:draft|wip)\s*:)\s*/i;function Si(e,n){return n&&e.replace($i,"")||e}function Ci(e){return e.state==="merged"&&e.mergedAt!=null?{verb:"merged",at:e.mergedAt}:e.state==="closed"&&e.closedAt!=null?{verb:"closed",at:e.closedAt}:{verb:"updated",at:e.updatedAt}}function Ri(e){return e.state!=="closed"?null:e.stateReason==="not_planned"?{mark:"closed",word:"Not planned",tone:"idle"}:e.stateReason==="duplicate"?{mark:"closed",word:"Duplicate",tone:"idle"}:null}function Ai(e){const n=e.findIndex(s=>s.isDefault);return n<=0?e:[e[n],...e.slice(0,n),...e.slice(n+1)]}function Ei(e){return e==null||!Number.isFinite(e)||e<0?null:e.toLocaleString("en-US")}function Li(e){return typeof e=="string"&&/^#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/i.test(e)?e:null}function Mi(e,n,s){if(e==null||n==null)return null;const r=s?`“${s}”`:"the default branch",a=o=>o>=1e3?"999+":String(o);return`${a(e)} ${e===1?"commit":"commits"} behind, ${a(n)} ahead of ${r}`}function Ti(e,n){const s=n.name.split("/").map(encodeURIComponent).join("/"),r=e==="gitlab"?"/-/tree/":"/tree/";for(const a of new Set([s,n.name])){const o=`${r}${a}`;if(!n.webUrl.endsWith(o))continue;const u=n.webUrl.slice(0,-o.length);if(!/^https?:\/\/[^/]+\/\S+$/.test(u))break;return e==="gitlab"?`${u}/-/merge_requests/new?merge_request%5Bsource_branch%5D=${encodeURIComponent(n.name)}`:`${u}/compare/${s}?expand=1`}return n.webUrl}function Ii(e,n){if(!n)return{workflow:null,title:null};if(e!=="github")return{workflow:null,title:n};const s=n.indexOf(" · ");return s>0&&s<n.length-3?{workflow:n.slice(0,s),title:n.slice(s+3)}:{workflow:null,title:n}}const Di={push:"push",merge_request_event:"merge request",pull_request:"pull request",pull_request_target:"pull request",merge_group:"merge queue",schedule:"schedule",workflow_dispatch:"manual",web:"manual",api:"API",trigger:"trigger",pipeline:"multi-project",parent_pipeline:"child pipeline",release:"release",external:"external",chat:"chat",ondemand_dast_scan:"DAST scan",security_orchestration_policy:"security policy"};function Fi(e){return e?Di[e]??e.replace(/_/g," "):null}function wn(e,n,s){return e.data==null?e.error?"failed":"loading":n===0?"empty":s===0?"no-match":"rows"}function Tt(e,n){return`No ${e} match “${n.trim()}”.`}function vn(e,n){return n!=null&&n>e?`Load more · ${e.toLocaleString("en-US")} of ${n.toLocaleString("en-US")}`:"Load more"}function Oi(e,n){const s=se[e].changes.toLowerCase(),r=n.acrossRepos?"":` in this ${se[e].repo.toLowerCase()}`;return n.filter==="mine"?`You have no ${n.state} ${s}${r}.`:n.filter==="review"?n.state==="open"?`Nothing is waiting for your review${r}.`:`No ${n.state} ${s} asked for your review${r}.`:`No ${n.state} ${s}${r}.`}function Bi(e,n){const s=`${se[e].pipeline.toLowerCase()}s`;return n?`No ${s} in your most recently active ${cs(e)}.`:`No ${s} in this ${se[e].repo.toLowerCase()} yet.`}function Pi(e,n,s){const r=se[e].repo.toLowerCase();if(e==="github")return`This ${r} has no ${n} issues.`;const a=s?"":` in this ${r}`;return n==="open"?`No open issues are assigned to you${a}.`:`No closed issues were assigned to you${a}.`}function Nn(e,n){const{loadedAt:s,loading:r,stale:a}=n;i.useEffect(()=>{e({loadedAt:s,loading:r,stale:a})},[e,s,r,a])}function Ui({value:e,allowAll:n,onChange:s}){const{kind:r}=ee(),a=i.useId(),[o,u]=i.useState(!1),l=i.useRef(null),d=se[r].repo,c=e??(n?Mr(r):`Choose a ${d.toLowerCase()}`),m=e?Tr(e):null,f=i.useCallback(()=>{var h;u(!1),(h=l.current)==null||h.focus({preventScroll:!0})},[]);return t.jsxs("span",{className:"fgl-repo",id:`${a}-layer`,children:[t.jsxs("button",{ref:l,id:`${a}-trigger`,type:"button",className:"btn fgl-repo-trigger","aria-label":`${d}: ${c}`,"aria-haspopup":"dialog","aria-expanded":o,title:e??void 0,onClick:()=>u(h=>!h),onKeyDown:h=>{(h.key==="ArrowDown"||h.key==="ArrowUp")&&(h.preventDefault(),u(!0))},children:[t.jsx(Hi,{}),m?t.jsxs("span",{className:"fgl-repo-path",children:[t.jsx("span",{className:"fgl-repo-group",children:m.group}),t.jsx("span",{className:"fgl-repo-name",children:m.name})]}):t.jsx("span",{className:"fgl-repo-all",children:c}),t.jsx(Er,{})]}),o&&t.jsx(pn,{anchorId:`${a}-layer`,portalRootId:`${a}-layer`,id:`${a}-popup`,className:"fgl-repo-pop",role:"dialog",labelledBy:`${a}-trigger`,onClose:f,children:t.jsx(_i,{value:e,allowAll:n,onPick:h=>{s(h),f()},onEscape:f})})]})}function _i({value:e,allowAll:n,onPick:s,onEscape:r}){var C;const{kind:a,api:o,scope:u,refresh:l}=ee(),d=i.useId(),[c,m]=i.useState(""),[f,h]=i.useState(""),x=i.useRef(null),j=i.useRef(null),p=cs(a);i.useEffect(()=>{const N=window.setTimeout(()=>h(c.trim()),250);return()=>window.clearTimeout(N)},[c]);const g=dt(o,u,"repos",{search:f||void 0},l),y=(C=g.data)==null?void 0:C.items,v=i.useMemo(()=>{const N=[];n&&!f&&N.push({value:null,repo:null}),e&&!f&&y&&!y.some(L=>L.path===e)&&N.push({value:e,repo:null});for(const L of y??[])N.push({value:L.path,repo:L});return N},[n,f,e,y]),[b,R]=i.useState(0),S=y!=null;i.useEffect(()=>{R(Math.max(0,v.findIndex(N=>N.value===e)))},[f,S]);const k=Math.min(b,v.length-1);i.useEffect(()=>{var N;(N=x.current)==null||N.focus({preventScroll:!0})},[]),i.useEffect(()=>{var N,L;(L=(N=j.current)==null?void 0:N.querySelector('[data-active="true"]'))==null||L.scrollIntoView({block:"nearest"})},[k,v.length]);const A=N=>{const L=v.length;N.key==="ArrowDown"||N.key==="ArrowUp"?(N.preventDefault(),L&&R((Math.max(0,k)+(N.key==="ArrowDown"?1:-1)+L)%L)):N.key==="Home"||N.key==="End"?(N.preventDefault(),R(N.key==="Home"?0:Math.max(0,L-1))):N.key==="Enter"&&k>=0&&v[k]&&(N.preventDefault(),s(v[k].value))},O=c.trim()!==f,z=y==null?g.error?"failed":"loading":v.length?"rows":"empty";return t.jsxs("div",{className:"fgl-repo-body",onKeyDown:N=>{N.key==="Escape"&&(N.preventDefault(),N.stopPropagation(),r())},children:[t.jsxs("label",{className:"fgl-repo-search",children:[t.jsxs("span",{className:"fg-sr",children:["Search ",p]}),t.jsx(Wi,{}),t.jsx("input",{ref:x,className:"ap-manage-input",role:"combobox",placeholder:`Search ${p}…`,autoComplete:"off",spellCheck:!1,value:c,"aria-expanded":v.length>0,"aria-autocomplete":"list","aria-controls":`${d}-options`,"aria-activedescendant":z==="rows"&&k>=0?`${d}-option-${k}`:void 0,"aria-busy":O||g.loading,onChange:N=>m(N.target.value),onKeyDown:A})]}),t.jsxs("div",{ref:j,className:"fgl-repo-scroll",children:[g.error&&y&&t.jsx(ie,{error:g.error,onRetry:g.reload,compact:!0}),z==="loading"&&t.jsx(Ke,{rows:4,label:`Loading ${p}`}),z==="failed"&&g.error&&t.jsx(ie,{error:g.error,onRetry:g.reload}),z==="empty"&&t.jsx("p",{className:"fgl-repo-none",role:"status",children:f?`No ${p} match “${f}”.`:`This token can see no ${p}.`}),t.jsx("div",{id:`${d}-options`,className:"fgl-repo-options",role:"listbox","aria-label":se[a].repo,hidden:z!=="rows",children:z==="rows"&&v.map((N,L)=>t.jsx(Ki,{id:`${d}-option-${L}`,option:N,selected:N.value===e,active:L===k,onHover:()=>{L!==k&&R(L)},onPick:()=>s(N.value)},N.value??"(all)"))}),g.data&&t.jsx(ut,{pages:g,label:`More ${p}`})]})]})}function Ki({id:e,option:n,selected:s,active:r,onHover:a,onPick:o}){var d,c;const{kind:u}=ee(),l=n.value?Tr(n.value):null;return t.jsxs("button",{id:e,type:"button",role:"option",tabIndex:-1,className:"fgl-repo-option","aria-selected":s,"data-active":r,onPointerMove:a,onClick:o,children:[t.jsx("span",{className:"fgl-repo-option-text",children:l?t.jsxs(t.Fragment,{children:[t.jsx("span",{className:"fgl-repo-option-name",children:l.name}),l.group&&t.jsx("span",{className:"fgl-repo-option-group",children:l.group.slice(0,-1)})]}):t.jsx("span",{className:"fgl-repo-option-name",children:Mr(u)})}),((d=n.repo)==null?void 0:d.archived)&&t.jsx("span",{className:"fg-badge",children:"archived"}),((c=n.repo)==null?void 0:c.lastActivityAt)!=null&&t.jsx("span",{className:"fgl-repo-option-when",children:t.jsx(me,{at:n.repo.lastActivityAt})}),t.jsx("span",{className:"fgl-repo-check","aria-hidden":"true",children:s&&t.jsx(rs,{})})]})}function Hi(){return t.jsxs("svg",{className:"fgl-glyph",width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[t.jsx("path",{d:"M3.5 2.5h8a1 1 0 0 1 1 1v8.5h-8.5a1 1 0 0 0-1 1z"}),t.jsx("path",{d:"M3.5 13a1 1 0 0 0 1 1h8v-2"}),t.jsx("path",{d:"M6 5.5h4"})]})}function Wi(){return t.jsxs("svg",{className:"fgl-glyph",width:"13",height:"13",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round","aria-hidden":"true",children:[t.jsx("circle",{cx:"7",cy:"7",r:"4.5"}),t.jsx("path",{d:"M10.5 10.5L14 14"})]})}function Dr(e,n){return n.change?{type:"change",repo:e,number:n.change.number}:{type:"branch",repo:e,name:n.name}}function qi({view:e,query:n}){var y;const{kind:s,api:r,scope:a,refresh:o,reportFreshness:u,isOpen:l}=ee(),d=e.repo??"",c=dt(r,a,d?"branches":null,{repo:d},o);Nn(u,c);const m=i.useMemo(()=>{var v;return((v=c.data)==null?void 0:v.items)??[]},[c.data]),f=i.useMemo(()=>m.filter(v=>bn({name:v.name},n)),[m,n]),h=i.useMemo(()=>di(Ai(f)),[f]),x=((y=m.find(v=>v.isDefault))==null?void 0:y.name)??null,j=wn(c,m.length,f.length),p=i.useMemo(()=>{if(j!=="rows")return[];const v=(b,R)=>l(b)?!R:R;return[...v("branches-active",!0)?h.active:[],...v("branches-stale",!1)?h.stale:[]].map(b=>Dr(d,b))},[j,h,l,d]);yn(p,j!=="loading");const g=v=>t.jsx("ul",{className:"fg-rows",children:v.map(b=>t.jsx(Ji,{kind:s,repo:d,branch:b,defaultBranch:x},b.name))});return t.jsxs("div",{className:"fgl",children:[c.error&&c.data&&t.jsx(ie,{error:c.error,onRetry:c.reload,compact:!0}),j==="loading"&&t.jsx(Ke,{label:"Loading branches"}),j==="failed"&&c.error&&t.jsx(ie,{error:c.error,onRetry:c.reload}),j==="empty"&&t.jsxs("p",{className:"fg-empty",children:["This ",se[s].repo.toLowerCase()," has no branches."]}),j==="no-match"&&t.jsx("p",{className:"fg-empty",children:Tt("branches",n)}),j==="rows"&&t.jsxs(t.Fragment,{children:[t.jsx(jt,{id:"branches-active",title:"Active branches",count:h.active.length,defaultOpen:!0,children:h.active.length?g(h.active):t.jsx("p",{className:"fgl-group-empty",children:n.trim()?Tt("active branches",n):"Every branch loaded so far is stale."})}),h.stale.length>0&&t.jsx(jt,{id:"branches-stale",title:"Stale branches",count:h.stale.length,defaultOpen:!1,aside:t.jsx("span",{className:"fgl-group-note",children:"No commits in 90 days"}),children:g(h.stale)})]}),c.data&&t.jsx(ut,{pages:c,label:vn(m.length,c.data.total)})]})}function Ji({kind:e,repo:n,branch:s,defaultBranch:r}){const{selected:a,select:o}=ee(),u=se[e],l=Dr(n,s),d=Lt(a,l),c=s.isDefault?null:Mi(s.behind,s.ahead,r),m=s.change?`${u.changeSigil}${s.change.number}`:null,f=s.change?Qt(s.change):null;return t.jsxs("li",{className:"fgl-branch ig-row","data-selected":d||void 0,children:[t.jsx("button",{type:"button",className:"fgl-hit","data-nav":"","aria-current":d||void 0,"aria-label":s.change?`${s.name}, ${u.change.toLowerCase()} ${m}`:s.name,onClick:()=>o(l)}),t.jsxs("span",{className:"fgl-branch-name",children:[t.jsx(bt,{value:s.name,label:"branch name",children:t.jsx("code",{className:"fgl-branch-code",children:s.name})}),s.isDefault&&t.jsx("span",{className:"fg-badge",children:"default"}),s.protected&&t.jsx("span",{className:"fg-badge",children:"protected"})]}),t.jsxs("span",{className:"fg-meta fgl-commit",children:[t.jsx("code",{children:s.commit.shortSha}),t.jsx("span",{className:"fgl-dot","aria-hidden":"true",children:"·"}),t.jsx("span",{className:"fgl-commit-title",children:s.commit.title}),s.commit.committedAt!=null&&t.jsxs(t.Fragment,{children:[t.jsx("span",{className:"fgl-dot","aria-hidden":"true",children:"·"}),t.jsx(me,{at:s.commit.committedAt})]})]}),t.jsxs("span",{className:"fgl-stats","data-empty":!c&&!s.ci||void 0,children:[t.jsx("span",{className:"fgl-diverge","data-empty":!c||void 0,title:c??void 0,children:c&&t.jsxs(t.Fragment,{children:[t.jsx("span",{className:"fgl-behind","aria-hidden":"true",children:mn(s.behind)}),t.jsx("span",{className:"fgl-diverge-rule","aria-hidden":"true"}),t.jsx("span",{"aria-hidden":"true",children:mn(s.ahead)}),t.jsx("span",{className:"fg-sr",children:c})]})}),t.jsx("span",{className:"fgl-ci",children:s.ci&&t.jsx(ge,{mark:De(s.ci.state)})})]}),t.jsx("span",{className:"fgl-branch-change",children:f&&m?t.jsxs("span",{className:"fg-badge","data-tone":f.tone,title:`${u.change} ${m}: ${f.word}`,children:[t.jsx(kn,{name:f.mark})," ",t.jsx("code",{children:m})," ",f.word]}):!s.isDefault&&t.jsxs("a",{className:"ig-open fgl-create",href:Ti(e,s),target:"_blank",rel:"noreferrer noopener",children:["Create ",u.change.toLowerCase(),t.jsx(Rt,{})]})})]})}function Fr(e,n,s){return`${n}${se[e].changeSigil}${s}`}function Or(e){const n=/^refs\/(?:merge-requests|pull)\/(\d{1,12})\/(?:head|merge|train)$/.exec(e??"");return n?Number(n[1]):null}function Br(e,n){const s=Or(n);return s!=null?`${se[e].changeSigil}${s}`:n.replace(/^refs\/(?:heads|tags)\//,"")}function zi(e){const n=/\/(?:-\/pipelines|actions\/runs)\/(\d{1,15})(?:[/?#]|$)/.exec(e??"");return n?n[1]:null}function Gi(e,n,s,r){const a=n.replace(/\/+$/,""),o=s.split("/").map(encodeURIComponent).join("/");return e==="github"?`${a}/${o}/compare/${r.split("/").map(encodeURIComponent).join("/")}?expand=1`:`${a}/${o}/-/merge_requests/new?${new URLSearchParams({"merge_request[source_branch]":r})}`}function Vi(e,n){const s=e==="github";return[{id:"overview",label:s?"Conversation":"Overview",count:n.discussions},{id:"commits",label:"Commits",count:n.commits},{id:"pipelines",label:Pr(e),count:n.pipelines},{id:"changes",label:s?"Files changed":"Changes",count:n.files}]}function Pr(e){return e==="github"?"Checks":se[e].pipelines}function Xi(e){return e==null||!Number.isFinite(e)||e<=0?null:`${e.toLocaleString("en-US")} ${e===1?"commit":"commits"}`}function Qi(e){return Qt({state:e.state,draft:e.draft,approved:!1})}const zn=/^\s*(?:\[draft\]|\(draft\)|draft:|\[wip\]|wip:)\s*/i;function Yi(e){return e.replace(zn,"")||e}function Zi(e){const n=e[0];if(!n||n.t!=="text"||!zn.test(n.text))return e;const s=n.text.replace(zn,"");return s?[{t:"text",text:s},...e.slice(1)]:e.slice(1)}function el(e){return{id:`comment:${e.id}`,resolvable:!1,resolved:!1,path:null,line:null,outdated:!1,comments:[e],webUrl:e.webUrl}}const Ws=e=>{var n;return((n=e.comments[0])==null?void 0:n.createdAt)??Number.MAX_SAFE_INTEGER};function tl(e){const n=[],s=[],r=[];for(const a of e.threads)a.comments.length&&(a.resolvable?(a.resolved?s:n).push(a):r.push(a));for(const a of e.generalComments)r.push(el(a));return r.sort((a,o)=>Ws(a)-Ws(o)),{unresolved:n,resolved:s,general:r}}function Ur(e){const n=e.lastIndexOf("/");return n<0?{dir:"",name:e}:{dir:e.slice(0,n+1),name:e.slice(n+1)}}function nl(e){return e.path?e.line!=null?`${e.path}:${e.line}`:e.path:null}function sl(e){return e.name||e.login}function rl(e){return e.length<=1?e[0]??"":`${e.slice(0,-1).join(", ")} and ${e[e.length-1]}`}function al(e){return e.approvedBy.length?{mark:{mark:"approved",word:"approved",tone:"ok"},text:`Approved by ${rl(e.approvedBy.map(sl))}`}:e.approvalsLeft!=null&&e.approvalsLeft>0?{mark:{mark:"pending",word:"approval required",tone:"idle"},text:`Requires ${e.approvalsLeft} more approval${e.approvalsLeft===1?"":"s"}`}:null}function ol(e){switch(e){case"added":return"new";case"deleted":return"deleted";case"renamed":return"renamed";default:return null}}function _r(e){const n=e.lastIndexOf("::");return n>0&&n<e.length-2?{scope:e.slice(0,n),value:e.slice(n+2)}:{scope:null,value:e}}function il(e){return e&&/^#(?:[0-9a-f]{3}|[0-9a-f]{6})$/i.test(e)?e:null}function ll(e,n){return e==="open"?{mark:"open",word:"Open",tone:"busy"}:n==="not_planned"?{mark:"closed",word:"Closed · not planned",tone:"idle"}:n==="duplicate"?{mark:"closed",word:"Closed · duplicate",tone:"idle"}:{mark:"done",word:"Closed",tone:"idle"}}function cl(e){return e?{push:"push",merge_request_event:"merge request",pull_request:"pull request",pull_request_target:"pull request",schedule:"schedule",workflow_dispatch:"manual run",web:"run from the web",api:"API",trigger:"trigger",pipeline:"parent pipeline",parent_pipeline:"parent pipeline",dynamic:"dynamic"}[e]??e.replace(/_/g," "):null}function dl(e){if(!e.length)return"none";const n=e.map(s=>s.state==="failed"&&s.allowFailure?"success":s.state);return n.includes("failed")?"failed":n.includes("running")?"running":n.includes("pending")?"pending":n.every(s=>s==="skipped")?"skipped":n.every(s=>s==="manual"||s==="skipped")?"manual":n.includes("canceled")?"canceled":"success"}function ul(e){const n=[],s=new Map;for(const r of e){const a=r.stage||null;s.has(a)||(s.set(a,[]),n.push(a)),s.get(a).push(r)}return n.map(r=>{const a=s.get(r);return{name:r,jobs:a,state:dl(a)}})}const hl=8;function fl(e,n){return e.state==="failed"||n<=hl}function ml(e){return e.state==="failed"&&!e.allowFailure}function pl(e){return e.state==="failed"&&e.allowFailure?{mark:"warning",word:"failed",tone:"warn"}:De(e.state)}function gl(e){return e.state==="success"&&e.jobs.some(n=>n.state==="failed"&&n.allowFailure)?{mark:"warning",word:"passed with warnings",tone:"warn"}:De(e.state)}function jl(e){switch(e){case"failure":return{mark:"failed",word:"failure",tone:"bad"};case"warning":return{mark:"warning",word:"warning",tone:"warn"};default:return{mark:"info",word:"notice",tone:"idle"}}}const Gn=[80,200,500];function xl(e){return e==null?Gn[0]:Gn.find(n=>n>e)??null}function bl(e){return/^\s*(?:::error\b|error\b|fatal\b|ERROR:|FAILED\b|✕|×)/i.test(e)||/\bJob failed\b/.test(e)?"err":/^\s*(?:::warning\b|warning\b|warn\b)/i.test(e)?"warn":null}const yl=[{state:"open",label:"Open"},{state:"merged",label:"Merged"},{state:"closed",label:"Closed"}],dn=[{filter:"all",label:"All"},{filter:"mine",label:"Mine"},{filter:"review",label:"Review requests"}],kl=Qt({state:"open",draft:!0,approved:!1}),wl=Qt({state:"open",draft:!1,approved:!0});function vl({view:e,setView:n,query:s}){const{kind:r,api:a,scope:o,refresh:u,reportFreshness:l,isOpen:d}=ee(),c=se[r],m=e.repo??void 0,f=e.repo==null,h=dt(a,o,"changes",{repo:m,filter:e.filter,state:e.state,sort:e.sort},u),x=Xe(a,o,"change-counts",{repo:m,filter:e.filter},u);Nn(l,h);const j=i.useMemo(()=>{var S;return((S=h.data)==null?void 0:S.items)??[]},[h.data]),p=i.useMemo(()=>j.filter(S=>bn({key:S.key,title:S.title,name:S.sourceBranch,number:S.number},s)),[j,s]),g=wn(h,j.length,p.length),y=e.filter==="review"&&e.state==="open"?ui(p):null,v=c.changes.toLowerCase(),b=i.useMemo(()=>{if(g!=="rows")return[];const S=(A,O)=>d(A)?!O:O;return(y?[...S("reviews-waiting",!0)?y.waiting:[],...S("reviews-approved",!1)?y.approved:[]]:p).map(A=>({type:"change",repo:A.repo,number:A.number}))},[g,y,p,d]);yn(b,g!=="loading");const R=S=>t.jsx("ul",{className:"fg-rows",children:S.map(k=>t.jsx(Sl,{kind:r,change:k,acrossRepos:f},k.key))});return t.jsxs("div",{className:"fgl",children:[t.jsxs("div",{className:"fgl-controls",children:[t.jsx("div",{className:"uh-range fgl-seg",role:"group","aria-label":`${c.changes} by state`,children:yl.map(({state:S,label:k})=>{var O;const A=Ei((O=x.data)==null?void 0:O[S]);return t.jsxs("button",{type:"button",className:"uh-range-btn","aria-pressed":e.state===S,onClick:()=>n({state:S}),children:[k,A&&t.jsx("span",{className:"fgl-seg-count",children:A})]},S)})}),t.jsx("div",{className:"uh-range fgl-seg fgl-scope-seg",role:"group","aria-label":`Which ${v}`,children:dn.map(({filter:S,label:k})=>t.jsx("button",{type:"button",className:"uh-range-btn","aria-pressed":e.filter===S,onClick:()=>n({filter:S}),children:k},S))}),t.jsx(Nl,{filter:e.filter,noun:v,onChange:S=>n({filter:S})}),t.jsx($l,{sort:e.sort,onChange:S=>n({sort:S})})]}),h.error&&h.data&&t.jsx(ie,{error:h.error,onRetry:h.reload,compact:!0}),g==="loading"&&t.jsx(Ke,{label:`Loading ${v}`}),g==="failed"&&h.error&&t.jsx(ie,{error:h.error,onRetry:h.reload}),g==="empty"&&t.jsx("p",{className:"fg-empty",children:Oi(r,{state:e.state,filter:e.filter,acrossRepos:f})}),g==="no-match"&&t.jsx("p",{className:"fg-empty",children:Tt(v,s)}),g==="rows"&&(y?t.jsxs(t.Fragment,{children:[t.jsx(jt,{id:"reviews-waiting",title:"Waiting for my review",count:y.waiting.length,defaultOpen:!0,children:y.waiting.length?R(y.waiting):t.jsx("p",{className:"fgl-group-empty",children:s.trim()?Tt(`${v} waiting for you`,s):"Nothing loaded is waiting for you; you approved every one."})}),y.approved.length>0&&t.jsx(jt,{id:"reviews-approved",title:"Approved by me",count:y.approved.length,defaultOpen:!1,children:R(y.approved)})]}):t.jsx("div",{className:"fgl-flat",children:R(p)})),h.data&&t.jsx(ut,{pages:h,label:vn(j.length,h.data.total)})]})}function Nl({filter:e,noun:n,onChange:s}){const r=i.useId(),[a,o]=i.useState(null),u=dn.find(c=>c.filter===e)??dn[0],l=`${r}-trigger`,d=c=>{var m;s(c),o(null),(m=document.getElementById(l))==null||m.focus({preventScroll:!0})};return t.jsxs("span",{className:"fgl-scope",id:`${r}-layer`,children:[t.jsxs("button",{id:l,type:"button",className:"btn fgl-scope-trigger","aria-label":`Which ${n}: ${u.label}`,"aria-haspopup":"menu","aria-expanded":a!=null,"aria-controls":a?`${r}-menu`:void 0,onClick:()=>o(c=>c?null:"first"),onKeyDown:c=>{c.key!=="ArrowDown"&&c.key!=="ArrowUp"||(c.preventDefault(),o(c.key==="ArrowUp"?"last":"first"))},children:[u.label,t.jsx(Er,{})]}),a&&t.jsx(pn,{anchorId:l,portalRootId:`${r}-layer`,id:`${r}-menu`,className:"ap-pop fgl-scope-pop",role:"menu",labelledBy:l,start:a,onClose:()=>o(null),children:dn.map(c=>t.jsxs("button",{type:"button",role:"menuitem",className:"ap-menu-item fgl-scope-item","aria-current":c.filter===e||void 0,onClick:()=>d(c.filter),children:[t.jsx("span",{className:"fgl-scope-check","aria-hidden":"true",children:c.filter===e&&t.jsx(rs,{})}),c.label]},c.filter))})]})}function $l({sort:e,onChange:n}){const s=e==="created"?"updated":"created";return t.jsxs("button",{type:"button",className:"btn fgl-sort",title:`Newest ${e} first. Sort by ${s} instead.`,"aria-label":`Sorted by ${e==="created"?"date created":"last updated"}, newest first. Sort by ${s==="created"?"date created":"last updated"} instead.`,onClick:()=>n(s),children:[t.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round","aria-hidden":"true",children:t.jsx("path",{d:"M2 3h8M3.5 6h5M5 9h2"})}),t.jsx("span",{className:"fgl-sort-word",children:e==="created"?"Created":"Updated"})]})}function Sl({kind:e,change:n,acrossRepos:s}){const{selected:r,select:a}=ee(),o={type:"change",repo:n.repo,number:n.number},u=Lt(r,o),l=Ci(n),d=n.author?n.author.name||n.author.login:null;return t.jsx("li",{children:t.jsxs("button",{type:"button",className:"fg-row fgl-row ig-row","data-nav":"","data-selected":u||void 0,"aria-current":u||void 0,onClick:()=>a(o),children:[t.jsxs("span",{className:"fg-row-title fgl-title",children:[n.draft&&t.jsx(xt,{mark:kl}),t.jsx("span",{className:"fgl-title-text",children:Si(n.title,n.draft)}),t.jsx(Hr,{labels:n.labels})]}),t.jsxs("span",{className:"fgl-side",children:[n.ci&&t.jsx(ge,{mark:De(n.ci.state)}),n.state==="open"&&n.approved&&t.jsx(xt,{mark:wl}),t.jsx(Cl,{reviewers:n.reviewers}),t.jsx(Kr,{count:n.comments})]}),t.jsxs("span",{className:"fg-meta fgl-meta",children:[t.jsx("code",{children:Ir(se[e].changeSigil,n,s)}),n.createdAt!=null&&t.jsxs(t.Fragment,{children:[" · created ",t.jsx(me,{at:n.createdAt})]}),d&&t.jsxs(t.Fragment,{children:[" by ",d]})]}),t.jsx("span",{className:"fgl-when",children:l.at!=null&&t.jsxs(t.Fragment,{children:[t.jsxs("span",{className:"fgl-when-verb",children:[l.verb," "]}),t.jsx(me,{at:l.at})]})})]})})}function Cl({reviewers:e}){return e.length?t.jsxs("span",{className:"fgl-people",children:[t.jsx("span",{className:"fg-sr",children:e.length===1?"Reviewer: ":"Reviewers: "}),e.slice(0,3).map((n,s)=>{const r=$r(n.state);return t.jsxs("span",{className:"fgl-reviewer","data-tone":r.tone,title:`${n.name||n.login}: ${r.word}`,children:[s>0&&t.jsx("span",{className:"fg-sr",children:"; "}),t.jsx(Lr,{user:n}),t.jsx("span",{className:"fg-sr",children:n.name||n.login}),n.state!=="pending"&&t.jsx("span",{className:"fgl-reviewer-mark","aria-hidden":"true",children:t.jsx(kn,{name:r.mark,size:9,weight:1.8})}),t.jsxs("span",{className:"fg-sr",children:[", ",r.word]})]},n.login)}),t.jsx(Al,{count:e.length-3})]}):null}function Rl({users:e,label:n}){const s=ls();return e.length?t.jsx(xr,{label:n,people:e.map(r=>({key:r.login,...s(r)}))}):null}function Al({count:e}){return e<=0?null:t.jsxs(t.Fragment,{children:[t.jsxs("span",{className:"fgl-people-more","aria-hidden":"true",children:["+",e]}),t.jsxs("span",{className:"fg-sr",children:[" and ",e," more"]})]})}function Kr({count:e}){return e?t.jsxs("span",{className:"fgl-comments",title:`${e} ${e===1?"comment":"comments"}`,children:[t.jsx("svg",{width:"13",height:"13",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinejoin:"round","aria-hidden":"true",children:t.jsx("path",{d:"M2.5 3.5h11v7.5h-6l-3 2.5v-2.5h-2z"})}),e.toLocaleString("en-US"),t.jsxs("span",{className:"fg-sr",children:[" ",e===1?"comment":"comments"]})]}):null}function Hr({labels:e}){return e.length?t.jsxs("span",{className:"fgl-labels",children:[e.slice(0,4).map(n=>{const s=Li(n.color),{scope:r,value:a}=_r(n.name);return t.jsxs("span",{className:"fgl-label",title:n.name,children:[s&&t.jsx("i",{className:"fgl-label-dot",style:{background:s},"aria-hidden":"true"}),r&&t.jsxs("span",{className:"fgl-label-scope",children:[r,t.jsx("span",{className:"fg-sr",children:"::"})]}),t.jsx("span",{className:"fgl-label-name",children:a})]},n.name)}),e.length>4&&t.jsxs("span",{className:"fgl-label",title:e.slice(4).map(n=>n.name).join(", "),children:["+",e.length-4]})]}):null}function El({view:e,query:n}){const{kind:s,api:r,scope:a,refresh:o,reportFreshness:u}=ee(),l=e.repo==null,d=dt(r,a,"pipelines",{repo:e.repo??void 0},o);Nn(u,d);const c=i.useMemo(()=>{var j;return((j=d.data)==null?void 0:j.items)??[]},[d.data]),m=i.useMemo(()=>c.filter(j=>bn({title:j.title??"",name:j.ref,key:`${j.repo} ${j.shortSha}`},n)),[c,n]),f=wn(d,c.length,m.length),h=`${se[s].pipeline.toLowerCase()}s`,x=i.useMemo(()=>f==="rows"?m.map(j=>({type:"pipeline",repo:j.repo,id:j.id})):[],[f,m]);return yn(x,f!=="loading"),t.jsxs("div",{className:"fgl",children:[d.error&&d.data&&t.jsx(ie,{error:d.error,onRetry:d.reload,compact:!0}),f==="loading"&&t.jsx(Ke,{label:`Loading ${h}`}),f==="failed"&&d.error&&t.jsx(ie,{error:d.error,onRetry:d.reload}),f==="empty"&&t.jsx("p",{className:"fg-empty",children:Bi(s,l)}),f==="no-match"&&t.jsx("p",{className:"fg-empty",children:Tt(h,n)}),f==="rows"&&t.jsx("div",{className:"fgl-flat",children:t.jsx("ul",{className:"fg-rows",children:m.map(j=>t.jsx(Ll,{kind:s,pipeline:j,acrossRepos:l},`${j.repo}/${j.id}`))})}),d.data&&t.jsx(ut,{pages:d,label:vn(c.length,d.data.total)})]})}function Ll({kind:e,pipeline:n,acrossRepos:s}){const{selected:r,select:a}=ee(),o={type:"pipeline",repo:n.repo,id:n.id},u=Lt(r,o),{workflow:l,title:d}=Ii(e,n.title),c=Yt(n.durationSec),m=Fi(n.source),f=n.state==="running"&&n.startedAt!=null&&n.finishedAt==null,h=n.finishedAt??n.createdAt,x=n.triggeredBy?n.triggeredBy.name||n.triggeredBy.login:null;return t.jsx("li",{children:t.jsxs("button",{type:"button",className:"fg-row fgl-row fgl-pipeline ig-row","data-nav":"","data-selected":u||void 0,"aria-current":u||void 0,onClick:()=>a(o),children:[t.jsx("span",{className:"fgl-status",children:t.jsx(ge,{mark:De(n.state)})}),t.jsx("span",{className:"fgl-duration",children:c?t.jsxs(t.Fragment,{children:[t.jsx("span",{className:"fg-sr",children:"ran for "}),c]}):f&&t.jsxs(t.Fragment,{children:[t.jsx("span",{className:"fgl-when-verb",children:"started "}),t.jsx(me,{at:n.startedAt})]})}),t.jsx("span",{className:"fg-row-title fgl-title",children:t.jsx("span",{className:"fgl-title-text",children:d??`${se[e].pipeline} ${n.id}`})}),t.jsxs("span",{className:"fg-meta fgl-meta",children:[s&&t.jsxs(t.Fragment,{children:[t.jsx("span",{className:"fgl-repo-ref",children:n.repo})," · "]}),t.jsx(Ml,{}),t.jsx("code",{children:n.ref}),n.shortSha&&t.jsxs(t.Fragment,{children:[" · ",t.jsx("code",{children:n.shortSha})]}),l&&t.jsxs(t.Fragment,{children:[" · ",l]}),m&&t.jsxs(t.Fragment,{children:[" · ",m]})]}),t.jsx("span",{className:"fgl-side",children:n.triggeredBy&&t.jsxs("span",{title:x??void 0,children:[t.jsx(Lr,{user:n.triggeredBy}),t.jsx("span",{className:"fg-sr",children:x})]})}),t.jsx("span",{className:"fgl-when",children:h!=null&&t.jsxs(t.Fragment,{children:[t.jsxs("span",{className:"fgl-when-verb",children:[n.finishedAt!=null?"finished":"created"," "]}),t.jsx(me,{at:h})]})})]})})}function Ml(){return t.jsxs("svg",{className:"fgl-ref-glyph",width:"12",height:"12",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round","aria-hidden":"true",children:[t.jsx("circle",{cx:"4.5",cy:"3.5",r:"1.5"}),t.jsx("circle",{cx:"4.5",cy:"12.5",r:"1.5"}),t.jsx("circle",{cx:"11.5",cy:"5.5",r:"1.5"}),t.jsx("path",{d:"M4.5 5v6M11.5 7c0 3-7 2-7 4"})]})}const Tl=[{state:"open",label:"Open"},{state:"closed",label:"Closed"}];function Il({view:e,setView:n,query:s}){var g;const{kind:r,api:a,scope:o,refresh:u,reportFreshness:l,connection:d}=ee(),c=e.repo==null,m=dt(a,o,"issues",{repo:e.repo??void 0,state:e.issueState},u);Nn(l,m);const f=i.useMemo(()=>{var y;return((y=m.data)==null?void 0:y.items)??[]},[m.data]),h=i.useMemo(()=>f.filter(y=>bn({key:y.key,title:y.title,number:y.number},s)),[f,s]),x=wn(m,f.length,h.length),j=i.useMemo(()=>x==="rows"?h.map(y=>({type:"issue",repo:y.repo,number:y.number})):[],[x,h]);yn(j,x!=="loading");const p=r==="gitlab"?((g=d.account)==null?void 0:g.login)??null:null;return t.jsxs("div",{className:"fgl",children:[t.jsxs("div",{className:"fgl-controls",children:[t.jsx("div",{className:"uh-range fgl-seg",role:"group","aria-label":"Issues by state",children:Tl.map(({state:y,label:v})=>t.jsx("button",{type:"button",className:"uh-range-btn","aria-pressed":e.issueState===y,onClick:()=>n({issueState:y}),children:v},y))}),r==="gitlab"&&t.jsx("span",{className:"fgl-controls-note",children:"Assigned to you"})]}),m.error&&m.data&&t.jsx(ie,{error:m.error,onRetry:m.reload,compact:!0}),x==="loading"&&t.jsx(Ke,{label:"Loading issues"}),x==="failed"&&m.error&&t.jsx(ie,{error:m.error,onRetry:m.reload}),x==="empty"&&t.jsx("p",{className:"fg-empty",children:Pi(r,e.issueState,c)}),x==="no-match"&&t.jsx("p",{className:"fg-empty",children:Tt("issues",s)}),x==="rows"&&t.jsx("div",{className:"fgl-flat",children:t.jsx("ul",{className:"fg-rows",children:h.map(y=>t.jsx(Dl,{issue:y,acrossRepos:c,me:p},y.key))})}),m.data&&t.jsx(ut,{pages:m,label:vn(f.length,m.data.total)})]})}function Dl({issue:e,acrossRepos:n,me:s}){const{selected:r,select:a}=ee(),o={type:"issue",repo:e.repo,number:e.number},u=Lt(r,o),l=e.author?e.author.name||e.author.login:null,d=s?e.assignees.filter(f=>f.login!==s):e.assignees,c=Ri(e),m=e.state==="closed"&&e.closedAt!=null?e.closedAt:e.updatedAt;return t.jsx("li",{children:t.jsxs("button",{type:"button",className:"fg-row fgl-row ig-row","data-nav":"","data-selected":u||void 0,"aria-current":u||void 0,onClick:()=>a(o),children:[t.jsxs("span",{className:"fg-row-title fgl-title",children:[c&&t.jsx(xt,{mark:c}),t.jsx("span",{className:"fgl-title-text",children:e.title}),t.jsx(Hr,{labels:e.labels})]}),t.jsxs("span",{className:"fgl-side",children:[e.children&&e.children.total>0&&t.jsxs("span",{className:"fgl-children",title:`${e.children.completed} of ${e.children.total} child items done`,children:[t.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[t.jsx("rect",{x:"2.5",y:"2.5",width:"11",height:"11",rx:"2"}),t.jsx("path",{d:"M5.5 8.2l1.8 1.8 3.4-4"})]}),e.children.completed,"/",e.children.total,t.jsx("span",{className:"fg-sr",children:" child items done"})]}),t.jsx(Rl,{users:d,label:"Assigned to"}),t.jsx(Kr,{count:e.comments})]}),t.jsxs("span",{className:"fg-meta fgl-meta",children:[t.jsx("code",{children:Ir("#",e,n)}),e.createdAt!=null&&t.jsxs(t.Fragment,{children:[" · opened ",t.jsx(me,{at:e.createdAt})]}),l&&t.jsxs(t.Fragment,{children:[" by ",l]}),e.milestone&&t.jsxs(t.Fragment,{children:[" · ",e.milestone.title]})]}),t.jsx("span",{className:"fgl-when",children:m!=null&&t.jsxs(t.Fragment,{children:[t.jsxs("span",{className:"fgl-when-verb",children:[e.state==="closed"&&e.closedAt!=null?"closed":"updated"," "]}),t.jsx(me,{at:m})]})})]})})}function qs(e){const n={};for(const[s,r]of Object.entries(e))s==="colspan"?n.colSpan=Number(r):s==="rowspan"?n.rowSpan=Number(r):s==="start"?n.start=Number(r):s==="open"?n.open=!0:s==="align"?n.style={textAlign:r.toLowerCase()}:n[s]=r;return n}function Fl({node:e}){const[n,s]=i.useState(!1),r=e.alt.trim()||"image";return!e.src||n?t.jsxs("a",{className:"fh-image-link",href:e.href,target:"_blank",rel:"noreferrer noopener",children:[r," ↗"]}):t.jsx("a",{className:"fh-image",href:e.href,target:"_blank",rel:"noreferrer noopener",children:t.jsx("img",{src:e.src,alt:e.alt,width:e.width??void 0,height:e.height??void 0,loading:"lazy",referrerPolicy:"no-referrer",onError:()=>s(!0)})})}function St(e){return e.map((n,s)=>{switch(n.t){case"text":return n.text;case"link":return t.jsx("a",{href:n.href,title:n.title??void 0,target:"_blank",rel:"noreferrer noopener",children:St(n.kids)},s);case"img":return t.jsx(Fl,{node:n},s);case"check":return t.jsx("span",{className:"fh-check",role:"img","aria-label":n.checked?"done":"to do","data-checked":n.checked||void 0,children:t.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[t.jsx("rect",{x:"1.6",y:"1.6",width:"10.8",height:"10.8",rx:"2.4"}),n.checked&&t.jsx("path",{d:"m4.3 7.2 1.9 1.9 3.6-4"})]})},s);case"el":{const r=n.tag;return n.tag==="hr"||n.tag==="br"?t.jsx(r,{},s):n.tag==="pre"?t.jsx("pre",{tabIndex:0,...qs(n.attrs),children:St(n.kids)},s):t.jsx(r,{...qs(n.attrs),children:St(n.kids)},s)}}})}function ds({nodes:e,className:n}){return t.jsx("div",{className:n?`forge-html ${n}`:"forge-html",children:St(e)})}const Ol=1,Bl=3,Pl={p:[],div:[],h1:[],h2:[],h3:[],h4:[],h5:[],h6:[],ul:[],ol:["start"],li:[],blockquote:[],pre:[],hr:[],br:[],table:[],caption:[],thead:[],tbody:[],tfoot:[],tr:[],th:["align","colspan","rowspan"],td:["align","colspan","rowspan"],details:["open"],summary:[],dl:[],dt:[],dd:[]},Ul={code:[],em:[],strong:[],b:[],i:[],u:[],s:[],del:[],ins:[],mark:[],sup:[],sub:[],kbd:[],small:[],abbr:["title"],q:[],cite:[]},_l=new Set(["script","style","template","noscript","iframe","frame","frameset","object","embed","applet","svg","math","form","button","textarea","select","option","canvas","link","meta","base","head","title","portal","track","source"]),Kl=new Set(["http:","https:","mailto:"]),Js=new Set(["http:","https:"]),Wr=2048,Hl=48;function Dn(e,n,s){const r=(e??"").trim();if(!r||r.length>Wr)return null;let a;try{a=new URL(r,new URL(n).origin+"/")}catch{return null}return s.has(a.protocol)?a.toString():null}function Ie(e,n){var r;const s=(r=e.getAttribute)==null?void 0:r.call(e,n);return typeof s=="string"?s:null}function zs(e){const n=Number(e);return Number.isInteger(n)&&n>0&&n<1e4?n:null}function Wl(e,n){const s={left:n.maxNodes??5e3,cut:!1},r=Vn(e,n,s,0);return s.cut&&r.push({t:"text",text:" …"}),r}function Vn(e,n,s,r){const a=[],o=e.childNodes;for(let u=0;u<o.length;u++){if(s.left<=0){s.cut=!0;break}a.push(...ql(o[u],n,s,r))}return a}function ql(e,n,s,r){var d,c,m,f;if(s.left--,e.nodeType===Bl)return e.nodeValue?[{t:"text",text:e.nodeValue}]:[];if(e.nodeType!==Ol)return[];const a=e.nodeName.toLowerCase();if(_l.has(a))return[];if(r>=Hl)return Vn(e,n,s,r);const o=()=>Vn(e,n,s,r+1);if(a==="a"){const h=Dn(Ie(e,"href"),n.baseUrl,Kl);return!h||(d=Ie(e,"href"))!=null&&d.trim().startsWith("#")?o():[{t:"link",href:h,title:((c=Ie(e,"title"))==null?void 0:c.slice(0,300))??null,kids:o()}]}if(a==="img"){const h=Dn(Ie(e,"data-src")??Ie(e,"src"),n.baseUrl,Js);if(!h)return[];const x=(Ie(e,"alt")??"").slice(0,300);return n.inline?[{t:"text",text:x}]:[{t:"img",src:n.asset(h),href:h,alt:x,width:zs(Ie(e,"width")),height:zs(Ie(e,"height"))}]}if(a==="video"||a==="audio"){const h=Dn(Ie(e,"data-src")??Ie(e,"src"),n.baseUrl,Js);return h&&!n.inline?[{t:"link",href:h,title:null,kids:[{t:"text",text:`${a} ↗`}]}]:[]}if(a==="input")return((m=Ie(e,"type"))==null?void 0:m.toLowerCase())==="checkbox"&&!n.inline?[{t:"check",checked:((f=e.getAttribute)==null?void 0:f.call(e,"checked"))!=null}]:[];const u=Ul[a]??(n.inline?void 0:Pl[a]);if(!u)return o();const l={};for(const h of u){const x=Ie(e,h);x!=null&&x.length<=Wr&&(l[h]=x)}l.start!=null&&!/^\d{1,6}$/.test(l.start)&&delete l.start;for(const h of["colspan","rowspan"])l[h]!=null&&!/^\d{1,3}$/.test(l[h])&&delete l[h];return l.align!=null&&!/^(?:left|right|center)$/i.test(l.align)&&delete l.align,[{t:"el",tag:a,attrs:l,kids:o()}]}function Jl(e,n){if(!e)return[];const s=new DOMParser().parseFromString(e,"text/html");return Wl(s.body,n)}function qr({dir:e}){if(!e)return null;const n=e.split("/").slice(0,-1);return t.jsx("span",{className:"fd-path-dir",children:n.map((s,r)=>t.jsxs("span",{children:[s,"/",t.jsx("wbr",{})]},r))})}function $n({label:e,children:n}){const s=i.useRef(null);return i.useLayoutEffect(()=>{var a;const r=(a=s.current)==null?void 0:a.closest(".ig-detail");r&&(r.scrollTop=0)},[]),t.jsx("article",{ref:s,className:"fd","aria-label":e,tabIndex:-1,children:n})}function Sn(){const{kind:e,narrow:n,select:s}=ee();return{openLabel:`Open in ${se[e].name}`,narrow:n,onClose:()=>s(null)}}function Cn({data:e,loading:n,error:s,onRetry:r,what:a}){return e?null:(s==null?void 0:s.kind)==="not-found"?t.jsxs("p",{className:"fg-empty",children:["This ",a," no longer exists, or this token cannot see it."]}):s?t.jsx(ie,{error:s,onRetry:r}):n?t.jsx(Ke,{rows:5,label:`Loading the ${a}`}):null}function Jt(e,n=!1){const{connection:s,asset:r}=ee();return i.useMemo(()=>e?Jl(e,{baseUrl:s.baseUrl,asset:r,inline:n}):[],[e,n,s.baseUrl,r])}function nt({label:e,children:n}){return t.jsxs("div",{className:"fd-fact",children:[t.jsx("dt",{children:e}),t.jsx("dd",{children:n})]})}function Jr({label:e,children:n}){return t.jsx("aside",{className:"fd-side","aria-label":e,children:t.jsx("dl",{className:"fd-facts",children:n})})}function Xn({users:e,extra:n}){return e.length?t.jsx("ul",{className:"fd-people",children:e.map(s=>t.jsxs("li",{children:[t.jsx(Dt,{user:s,size:20}),n==null?void 0:n(s)]},s.login))}):t.jsx("span",{className:"fd-none",children:"None"})}function zl({users:e,max:n=12}){if(!e.length)return t.jsx("span",{className:"fd-none",children:"None"});const s=e.slice(0,n);return t.jsxs("ul",{className:"fd-faces",children:[s.map(r=>t.jsx("li",{children:t.jsx(Dt,{user:r,size:22,nameless:!0})},r.login)),e.length>n&&t.jsxs("li",{className:"fd-faces-more",children:["+",e.length-n]})]})}function Gl({label:e}){const n=il(e.color),{scope:s,value:r}=_r(e.name);return t.jsxs("span",{className:"fd-label",title:e.name,children:[t.jsx("span",{className:"fd-swatch",style:n?{backgroundColor:n}:void 0,"aria-hidden":"true"}),s&&t.jsx("span",{className:"fd-label-scope",children:s}),t.jsx("span",{className:"fd-label-value",children:r})]})}function zr({labels:e}){return e.length?t.jsx("span",{className:"fd-labels",children:e.map(n=>t.jsx(Gl,{label:n},n.name))}):t.jsx("span",{className:"fd-none",children:"None"})}function Qn({commit:e}){return t.jsxs("li",{className:"fd-item",children:[e.webUrl?t.jsxs("a",{className:"fd-item-title fd-out",href:e.webUrl,target:"_blank",rel:"noreferrer noopener",children:[e.title,t.jsx("span",{className:"fd-out-mark","aria-hidden":"true",children:" ↗"})]}):t.jsx("span",{className:"fd-item-title",children:e.title}),t.jsxs("span",{className:"fd-item-meta",children:[t.jsx(bt,{value:e.sha,label:"commit sha",children:t.jsx("code",{children:e.shortSha})}),e.authorName&&t.jsx("span",{children:e.authorName}),e.authoredAt!=null&&t.jsx(me,{at:e.authoredAt})]})]})}function zt({children:e,count:n,aside:s}){return t.jsxs("h3",{className:"fd-heading",children:[t.jsx("span",{children:e}),n!=null&&t.jsx("span",{className:"fg-count",children:n.toLocaleString()}),s]})}function Vl({title:e,count:n,startsOpen:s,aside:r,children:a}){const[o,u]=i.useState(s);return t.jsxs("section",{className:"fg-group fd-fold","data-open":o||void 0,children:[t.jsxs("h3",{className:"fg-group-head fd-fold-head",children:[t.jsxs("button",{type:"button",className:"fg-fold","aria-expanded":o,onClick:()=>u(l=>!l),children:[t.jsx("span",{className:"fg-fold-chevron","aria-hidden":"true"}),e,n!=null&&t.jsx("span",{className:"fg-count",children:n.toLocaleString()})]}),r]}),o&&a]})}function Gs(e){return`Open this comment in ${se[e].name}`}function Gr({comment:e}){const{kind:n}=ee(),s=Jt(e.bodyHtml);return t.jsxs("li",{className:"fd-comment",children:[t.jsxs("div",{className:"fd-comment-head",children:[e.author?t.jsx(Dt,{user:e.author,size:20}):t.jsx("span",{className:"fd-none",children:"Someone"}),e.createdAt!=null&&t.jsx("span",{className:"fd-comment-time",children:t.jsx(me,{at:e.createdAt})}),e.webUrl&&t.jsx("a",{className:"fd-comment-link",href:e.webUrl,target:"_blank",rel:"noreferrer noopener","aria-label":Gs(n),title:Gs(n),children:t.jsx("span",{"aria-hidden":"true",children:"↗"})})]}),s.length?t.jsx(ds,{className:"fd-comment-body",nodes:s}):t.jsx("p",{className:"fd-comment-body fd-none",children:"No text."})]})}function Xl({thread:e}){const n=e.path?Ur(e.path):null;return t.jsxs("li",{className:"fd-thread",children:[n&&t.jsxs("div",{className:"fd-thread-head",children:[t.jsxs("code",{className:"fd-path",title:nl(e)??void 0,children:[t.jsx(qr,{dir:n.dir}),t.jsxs("span",{className:"fd-path-name",children:[n.name,e.line!=null&&t.jsxs("span",{className:"fd-path-line",children:[":",e.line]})]})]}),e.outdated&&t.jsx("span",{className:"fg-badge fd-outdated",children:"outdated"})]}),t.jsx("ol",{className:"fd-comments",children:e.comments.map(s=>t.jsx(Gr,{comment:s},s.id))})]})}function Fn({threads:e}){return t.jsx("ol",{className:"fd-threads",children:e.map(n=>t.jsx(Xl,{thread:n},n.id))})}const Ql=["overview","commits","pipelines","changes"],Yl=e=>e!=null&&Ql.includes(e);function Zl({selection:e}){const{kind:n,api:s,scope:r,refresh:a,recallSection:o,keepSection:u}=ee(),l=Sn(),d=se[n],c={repo:e.repo,number:e.number},m=Xe(s,r,"change",c,a),f=m.data,h=!!f&&(f.ci!=null||f.counts.pipelines>0),x=Xe(s,r,h?"change/pipelines":null,c,a),[j,p]=i.useState(()=>{const k=o();return Yl(k)?k:"overview"}),g=k=>{p(k),u(k)},y=(f==null?void 0:f.key)??Fr(n,e.repo,e.number),v=i.useId(),b=k=>`${v}-tab-${k}`,R=k=>`${v}-panel-${k}`,S=f?Vi(n,f.counts):[];return t.jsxs($n,{label:`${d.change} ${y}`,children:[t.jsx(Xt,{...l,reference:y,copyLabel:"reference",href:(f==null?void 0:f.webUrl)??null}),t.jsx(Cn,{data:f,loading:m.loading,error:m.error,onRetry:m.reload,what:d.change.toLowerCase()}),f&&t.jsxs(t.Fragment,{children:[m.error&&t.jsx(ie,{error:m.error,onRetry:m.reload,compact:!0}),t.jsx(ec,{change:f,pipelines:x.data}),t.jsxs("div",{className:"fd-layout",children:[t.jsx(tc,{change:f}),t.jsxs("div",{className:"fd-main",children:[t.jsx("div",{className:"uh-range fd-sections",role:"tablist","aria-label":`${d.change} sections`,onKeyDown:k=>{var O;const A=er(k,S.findIndex(z=>z.id===j),S.length);A.kind!=="pass"&&(k.preventDefault(),k.stopPropagation(),g(S[A.index].id),(O=k.currentTarget.querySelectorAll("[role=tab]")[A.index])==null||O.focus())},children:S.map(k=>t.jsxs("button",{id:b(k.id),type:"button",role:"tab",className:"uh-range-btn","aria-selected":j===k.id,"aria-controls":R(k.id),tabIndex:j===k.id?0:-1,onClick:()=>g(k.id),children:[t.jsx("span",{className:"fd-section-label",children:k.label}),t.jsx("span",{className:"fd-section-count",children:k.count.toLocaleString()})]},k.id))}),S.map(k=>t.jsx("div",{className:"fd-section",id:R(k.id),role:"tabpanel","aria-labelledby":b(k.id),hidden:j!==k.id,children:j!==k.id?null:k.id==="overview"?t.jsx(nc,{change:f}):k.id==="commits"?t.jsx(sc,{selection:e}):k.id==="pipelines"?t.jsx(rc,{repo:e.repo,read:x}):t.jsx(ac,{selection:e})},k.id))]})]})]})]})}function ec({change:e,pipelines:n}){var x,j,p;const{kind:s,select:r}=ee(),a=se[s],o=e.state==="open"&&e.draft,u=Jt(e.titleHtml,!0),l=u.length?St(o?Zi(u):u):o?Yi(e.title):e.title,d=(n==null?void 0:n[0])??null,c=zi((x=e.ci)==null?void 0:x.webUrl)??(d==null?void 0:d.id)??null,m=((j=e.ci)==null?void 0:j.state)??(d==null?void 0:d.state)??null,f=al(e),h=Xi(e.counts.commits);return t.jsxs("header",{className:"fd-head",children:[t.jsx("h2",{className:"fd-title",children:l}),t.jsxs("p",{className:"fd-byline",children:[t.jsx(xt,{mark:Qi(e)}),e.author&&t.jsx(Dt,{user:e.author,size:18}),s==="github"?t.jsxs(t.Fragment,{children:[e.state==="merged"?t.jsx("span",{children:h?`· ${h} merged into`:"· merged into"}):t.jsx("span",{children:h?`wants to merge ${h} into`:"wants to merge into"}),t.jsx("code",{className:"fd-branch",children:e.targetBranch}),t.jsx("span",{children:"from"}),t.jsx(bt,{value:e.sourceBranch,label:"source branch",children:t.jsx("code",{className:"fd-branch",children:e.sourceBranch})})]}):t.jsxs(t.Fragment,{children:[t.jsx("span",{children:"requested to merge"}),t.jsx(bt,{value:e.sourceBranch,label:"source branch",children:t.jsx("code",{className:"fd-branch",children:e.sourceBranch})}),t.jsx("span",{children:"into"}),t.jsx("code",{className:"fd-branch",children:e.targetBranch})]}),e.createdAt!=null&&t.jsxs("span",{className:"fd-when",children:["· created ",t.jsx(me,{at:e.createdAt})]}),e.state==="merged"&&e.mergedAt!=null&&t.jsxs("span",{className:"fd-when",children:["· merged ",t.jsx(me,{at:e.mergedAt})]}),e.state==="closed"&&e.closedAt!=null&&t.jsxs("span",{className:"fd-when",children:["· closed ",t.jsx(me,{at:e.closedAt})]})]}),(m||f)&&t.jsxs("ul",{className:"fd-status",children:[m&&t.jsx("li",{children:c?t.jsxs("button",{type:"button",className:"fd-jump",onClick:()=>r({type:"pipeline",repo:e.repo,id:c}),children:[t.jsx(ge,{mark:De(m)}),t.jsxs("span",{children:[a.pipeline," ",t.jsxs("code",{children:["#",c]})]}),t.jsx("span",{className:"fd-jump-arrow","aria-hidden":"true",children:"›"})]}):t.jsxs("span",{className:"fd-status-line",children:[t.jsx(ge,{mark:De(m)}),t.jsx(Mt,{href:((p=e.ci)==null?void 0:p.webUrl)??null,children:"Checks"})]})}),f&&t.jsxs("li",{className:"fd-status-line",children:[t.jsx(ge,{mark:f.mark,quiet:!0}),t.jsx("span",{children:f.text})]})]})]})}function tc({change:e}){return t.jsxs(Jr,{label:"About this change",children:[t.jsx(nt,{label:e.assignees.length>1?"Assignees":"Assignee",children:t.jsx(Xn,{users:e.assignees})}),t.jsx(nt,{label:e.reviewers.length>1?"Reviewers":"Reviewer",children:t.jsx(Xn,{users:e.reviewers,extra:n=>t.jsx(ge,{className:"fd-review",mark:$r(n.state)})})}),e.labels.length>0&&t.jsx(nt,{label:"Labels",children:t.jsx(zr,{labels:e.labels})}),e.milestone&&t.jsx(nt,{label:"Milestone",children:e.milestone.webUrl?t.jsx("a",{className:"fd-plain-link",href:e.milestone.webUrl,target:"_blank",rel:"noreferrer noopener",children:e.milestone.title}):e.milestone.title}),e.participants.length>0&&t.jsx(nt,{label:`Participants · ${e.participants.length}`,children:t.jsx(zl,{users:e.participants})})]})}function nc({change:e}){const n=Jt(e.descriptionHtml),{unresolved:s,resolved:r,general:a}=tl(e),o=!s.length&&!r.length&&!a.length;return t.jsxs(t.Fragment,{children:[n.length?t.jsx(ds,{className:"fd-description",nodes:n}):t.jsx("p",{className:"fd-none fd-description",children:"No description."}),t.jsxs("div",{className:"fd-discussions",children:[o&&t.jsx("p",{className:"fg-empty",children:"No discussions yet."}),s.length>0&&t.jsx(jt,{id:"change:unresolved",title:"Unresolved threads",count:s.length,defaultOpen:!0,children:t.jsx(Fn,{threads:s})}),!s.length&&r.length>0&&t.jsx("p",{className:"fd-status-line fd-all-resolved",children:t.jsx(ge,{mark:{mark:"resolved",word:"All threads resolved",tone:"ok"}})}),r.length>0&&t.jsx(jt,{id:"change:resolved",title:"Resolved threads",count:r.length,defaultOpen:!1,children:t.jsx(Fn,{threads:r})}),a.length>0&&t.jsx(jt,{id:"change:general",title:"General comments",count:a.length,defaultOpen:!1,children:t.jsx(Fn,{threads:a})})]})]})}function sc({selection:e}){const{api:n,scope:s,refresh:r}=ee(),a=dt(n,s,"change/commits",{repo:e.repo,number:e.number},r);return a.data?t.jsxs(t.Fragment,{children:[a.error&&t.jsx(ie,{error:a.error,onRetry:a.reload,compact:!0}),a.data.items.length?t.jsx("ul",{className:"fd-items",children:a.data.items.map(o=>t.jsx(Qn,{commit:o},o.sha))}):t.jsx("p",{className:"fg-empty",children:"No commits."}),t.jsx(ut,{pages:a,label:"Load more commits"})]}):a.error?t.jsx(ie,{error:a.error,onRetry:a.reload}):t.jsx(Ke,{rows:4,label:"Loading commits"})}function rc({repo:e,read:n}){const{kind:s,select:r,selected:a}=ee(),o=se[s],u=Pr(s).toLowerCase();return n.data?n.data.length?t.jsxs(t.Fragment,{children:[n.error&&t.jsx(ie,{error:n.error,onRetry:n.reload,compact:!0}),t.jsx("ul",{className:"fg-rows fd-rows",children:n.data.map(l=>{const d=(a==null?void 0:a.type)==="pipeline"&&a.id===l.id,c=Yt(l.durationSec);return t.jsx("li",{children:t.jsxs("button",{type:"button",className:"fg-row fd-pipe-row","aria-current":d||void 0,"data-selected":d||void 0,onClick:()=>r({type:"pipeline",repo:e,id:l.id}),children:[t.jsx(ge,{mark:De(l.state)}),t.jsx("span",{className:"fd-pipe-id",children:t.jsxs("code",{children:["#",l.id]})}),t.jsxs("span",{className:"fd-pipe-meta",children:[t.jsx("code",{className:"fd-branch",title:l.ref,children:Br(s,l.ref)}),t.jsx("code",{children:l.shortSha}),l.title&&t.jsx("span",{className:"fd-pipe-title",children:l.title})]}),t.jsxs("span",{className:"fd-pipe-when",children:[c&&t.jsx("span",{children:c}),l.createdAt!=null&&t.jsx(me,{at:l.createdAt})]})]})},l.id)})})]}):t.jsxs("p",{className:"fg-empty",children:["No ",u," ran for this ",o.change.toLowerCase(),"."]}):n.error?t.jsx(ie,{error:n.error,onRetry:n.reload}):n.loading?t.jsx(Ke,{rows:3,label:`Loading ${u}`}):t.jsxs("p",{className:"fg-empty",children:["No ",u," ran for this ",o.change.toLowerCase(),"."]})}function ac({selection:e}){const{api:n,scope:s,refresh:r}=ee(),a=dt(n,s,"change/files",{repo:e.repo,number:e.number},r);return a.data?t.jsxs(t.Fragment,{children:[a.error&&t.jsx(ie,{error:a.error,onRetry:a.reload,compact:!0}),a.data.items.length?t.jsx("ul",{className:"fd-files",children:a.data.items.map(o=>t.jsx(oc,{file:o},`${o.oldPath??""}>${o.path}`))}):t.jsx("p",{className:"fg-empty",children:"No changed files."}),t.jsx(ut,{pages:a,label:"Load more files"})]}):a.error?t.jsx(ie,{error:a.error,onRetry:a.reload}):t.jsx(Ke,{rows:5,label:"Loading changed files"})}function oc({file:e}){const n=ol(e.status),{dir:s,name:r}=Ur(e.path),a=t.jsxs(t.Fragment,{children:[t.jsxs("span",{className:"fd-file-path",children:[e.oldPath&&e.oldPath!==e.path&&t.jsxs("span",{className:"fd-file-old",children:[t.jsx("code",{children:e.oldPath})," ",t.jsx("span",{"aria-hidden":"true",children:"→"}),t.jsx("span",{className:"fd-sr",children:" renamed to"})," "]}),t.jsxs("code",{children:[t.jsx(qr,{dir:s}),t.jsx("span",{className:"fd-path-name",children:r})]})]}),t.jsxs("span",{className:"fd-file-end",children:[n&&t.jsx("span",{className:"fd-file-status","data-status":e.status,children:n}),t.jsxs("span",{className:"fd-diffstat",title:`${e.additions} added, ${e.deletions} removed`,children:[t.jsxs("span",{className:"fd-add","data-zero":e.additions===0||void 0,children:["+",e.additions.toLocaleString()]}),t.jsxs("span",{className:"fd-del","data-zero":e.deletions===0||void 0,children:["−",e.deletions.toLocaleString()]})]}),e.webUrl&&t.jsx("span",{className:"fd-out-mark","aria-hidden":"true",children:"↗"})]})]});return t.jsx("li",{children:e.webUrl?t.jsx("a",{className:"fd-file",href:e.webUrl,target:"_blank",rel:"noreferrer noopener",children:a}):t.jsx("span",{className:"fd-file",children:a})})}const Vs=10;function ic({selection:e}){const{kind:n,api:s,scope:r,refresh:a}=ee(),o=Sn(),u=Xe(s,r,"branch",{repo:e.repo,name:e.name},a),l=u.data;return t.jsxs($n,{label:`Branch ${e.name}`,children:[t.jsx(Xt,{...o,reference:e.repo,copyLabel:se[n].repo.toLowerCase(),href:(l==null?void 0:l.branch.webUrl)??null}),t.jsx(Cn,{data:l,loading:u.loading,error:u.error,onRetry:u.reload,what:"branch"}),l&&t.jsxs(t.Fragment,{children:[u.error&&t.jsx(ie,{error:u.error,onRetry:u.reload,compact:!0}),t.jsx(lc,{repo:e.repo,detail:l})]})]})}function lc({repo:e,detail:n}){var y,v;const{kind:s,api:r,scope:a,refresh:o,connection:u,select:l}=ee(),d=se[s],c=n.branch,f=((v=(y=Xe(r,a,c.isDefault?null:"repos",{},o).data)==null?void 0:y.items.find(b=>b.path===e))==null?void 0:v.defaultBranch)??null,[h,x]=i.useState(!1),j=n.pipeline,p=j?Yt(j.durationSec):null,g=h?n.commitsAhead:n.commitsAhead.slice(0,Vs);return t.jsxs(t.Fragment,{children:[t.jsxs("header",{className:"fd-head",children:[t.jsx("h2",{className:"fd-title fd-title-mono",children:t.jsx(bt,{value:c.name,label:"branch name",children:t.jsx("code",{children:c.name})})}),(c.isDefault||c.protected||c.stale)&&t.jsxs("p",{className:"fd-byline",children:[c.isDefault&&t.jsx("span",{className:"fg-badge",children:"default"}),c.protected&&t.jsx("span",{className:"fg-badge",children:"protected"}),c.stale&&t.jsx("span",{className:"fg-badge",children:"stale"})]})]}),t.jsxs("dl",{className:"fd-facts fd-facts-page",children:[t.jsxs("div",{className:"fd-fact",children:[t.jsx("dt",{children:"Latest commit"}),t.jsx("dd",{children:t.jsx("ul",{className:"fd-items fd-items-bare",children:t.jsx(Qn,{commit:{...c.commit,authoredAt:c.commit.committedAt}})})})]}),!c.isDefault&&t.jsxs("div",{className:"fd-fact",children:[t.jsxs("dt",{children:["Compared with ",f??"the default branch"]}),t.jsxs("dd",{className:"fd-diverge",children:[t.jsxs("span",{children:[t.jsx("strong",{children:mn(c.behind)})," behind"]}),t.jsx("span",{"aria-hidden":"true",children:"·"}),t.jsxs("span",{children:[t.jsx("strong",{children:mn(c.ahead)})," ahead"]})]})]}),t.jsxs("div",{className:"fd-fact",children:[t.jsx("dt",{children:d.pipeline}),t.jsx("dd",{children:j?t.jsxs("button",{type:"button",className:"fd-jump",onClick:()=>l({type:"pipeline",repo:e,id:j.id}),children:[t.jsx(ge,{mark:De(j.state)}),t.jsx("span",{children:t.jsxs("code",{children:["#",j.id]})}),p&&t.jsx("span",{className:"fd-jump-meta",children:p}),j.createdAt!=null&&t.jsx("span",{className:"fd-jump-meta",children:t.jsx(me,{at:j.createdAt})}),t.jsx("span",{className:"fd-jump-arrow","aria-hidden":"true",children:"›"})]}):c.ci?t.jsxs("span",{className:"fd-status-line",children:[t.jsx(ge,{mark:De(c.ci.state)}),t.jsx(Mt,{href:c.ci.webUrl})]}):t.jsx(ge,{mark:De("none")})})]}),!c.isDefault&&t.jsxs("div",{className:"fd-fact",children:[t.jsx("dt",{children:d.change}),t.jsx("dd",{children:c.change?t.jsxs("button",{type:"button",className:"fd-jump",onClick:()=>l({type:"change",repo:e,number:c.change.number}),children:[t.jsx(xt,{mark:Qt(c.change)}),t.jsx("span",{children:t.jsxs("code",{children:[d.changeSigil,c.change.number]})}),t.jsx("span",{className:"fd-jump-arrow","aria-hidden":"true",children:"›"})]}):t.jsxs(Mt,{href:Gi(s,u.baseUrl,e,c.name),children:["Create ",d.change.toLowerCase()]})})]})]}),!c.isDefault&&t.jsxs("section",{className:"fd-block",children:[t.jsxs(zt,{count:c.ahead??n.commitsAhead.length,children:["Commits not in ",f??"the default branch"]}),n.commitsAhead.length?t.jsxs(t.Fragment,{children:[t.jsx("ul",{className:"fd-items",children:g.map(b=>t.jsx(Qn,{commit:b},b.sha))}),!h&&n.commitsAhead.length>Vs&&t.jsxs("button",{type:"button",className:"btn fg-more",onClick:()=>x(!0),children:["Show all ",n.commitsAhead.length.toLocaleString()]})]}):t.jsx("p",{className:"fg-empty",children:c.ahead===0?`Every commit here is already in ${f??"the default branch"}.`:"The forge listed none."})]})]})}function cc({repo:e,jobs:n}){const s=ul(n);return n.length?s.length===1&&s[0].name==null?t.jsx(Xs,{repo:e,jobs:n}):t.jsx("div",{className:"fd-stages",children:s.map(r=>t.jsx(Vl,{title:r.name??"Other jobs",count:r.jobs.length,startsOpen:fl(r,n.length),aside:t.jsx(ge,{mark:gl(r)}),children:t.jsx(Xs,{repo:e,jobs:r.jobs})},r.name??""))}):t.jsx("p",{className:"fg-empty",children:"This pipeline has no jobs."})}function Xs({repo:e,jobs:n}){return t.jsx("ul",{className:"fd-jobs",children:n.map(s=>t.jsx(dc,{repo:e,job:s},s.id))})}function dc({repo:e,job:n}){const[s,r]=i.useState(()=>ml(n)),a=Yt(n.durationSec),o=`fd-job-${n.id}`;return t.jsxs("li",{className:"fd-job","data-open":s||void 0,children:[t.jsxs("button",{type:"button",className:"fg-row fd-job-row","aria-expanded":s,"aria-controls":o,onClick:()=>r(u=>!u),children:[t.jsx("span",{className:"fg-fold-chevron","aria-hidden":"true"}),t.jsx(ge,{mark:pl(n)}),t.jsx("span",{className:"fd-job-name",children:n.name}),n.allowFailure&&n.state==="failed"&&t.jsx("span",{className:"fd-job-note",children:"allowed to fail"}),a&&t.jsx("span",{className:"fd-job-time",children:a})]}),s&&t.jsxs("div",{className:"fd-job-body",id:o,children:[n.failureReason&&t.jsx("p",{className:"fd-job-reason",children:n.failureReason}),n.annotations.length>0&&t.jsx("ul",{className:"fd-annotations",children:n.annotations.map((u,l)=>t.jsxs("li",{children:[t.jsx(ge,{mark:jl(u.level)}),u.path&&t.jsx("code",{className:"fd-ann-place",children:u.line!=null?`${u.path}:${u.line}`:u.path}),u.title&&t.jsx("strong",{className:"fd-ann-title",children:u.title}),t.jsx("span",{className:"fd-ann-message",children:u.message})]},l))}),n.logAvailable?t.jsx(uc,{repo:e,job:n}):t.jsx("p",{className:"fd-log-bar",children:t.jsx(Mt,{href:n.webUrl,children:"Open the job"})})]})]})}function uc({repo:e,job:n}){const{api:s,scope:r,refresh:a}=ee(),[o,u]=i.useState(null),l=Xe(s,r,o?"job-log":null,{repo:e,id:n.id,lines:o},a),d=i.useRef(null);l.data&&(d.current=l.data);const c=l.data??(o?d.current:null),m=i.useRef(null),f=i.useRef(0);i.useLayoutEffect(()=>{const g=m.current;g&&(g.scrollTop=g.scrollHeight-g.clientHeight-f.current),f.current=0},[c]);const h=i.useRef(!1);i.useEffect(()=>{h.current=l.loading},[l.loading,c,l.error]);const x=xl(o),j=()=>{if(!$e(h.current))return;h.current=!0;const g=m.current;f.current=g?g.scrollHeight-g.clientHeight-g.scrollTop:0,u(x)},p=(c==null?void 0:c.webUrl)??n.webUrl;return o?t.jsxs("div",{className:"fd-log-wrap",children:[t.jsxs("p",{className:"fd-log-bar",children:[t.jsx("span",{className:"fd-log-count",children:c?c.truncated?`Last ${c.lines.length.toLocaleString()} lines`:`All ${c.lines.length.toLocaleString()} lines`:"Log"}),(c==null?void 0:c.truncated)&&x&&t.jsx("button",{type:"button",className:"btn",onClick:j,...Le(l.loading),children:l.loading?"Loading…":"Show more lines"}),t.jsx(Mt,{href:p,children:"Full log"})]}),l.error&&(c?t.jsx(ie,{error:l.error,onRetry:l.reload,compact:!0}):t.jsx(ie,{error:l.error,onRetry:l.reload})),!c&&!l.error&&t.jsx(Ke,{rows:3,label:"Loading the log"}),c&&(c.lines.length?t.jsx("pre",{ref:m,className:"fd-log",tabIndex:0,role:"region","aria-label":`${n.name} log`,children:c.lines.map((g,y)=>{const v=bl(g);return t.jsx("span",{className:"fd-log-line","data-tone":v??void 0,children:g||" "},y)})}):t.jsx("p",{className:"fd-none",children:"The log is empty."}))]}):t.jsxs("p",{className:"fd-log-bar",children:[t.jsx("button",{type:"button",className:"btn",onClick:()=>u(Gn[0]),children:"Show log"}),t.jsx(Mt,{href:p,children:"Full log"})]})}function hc({selection:e}){const{kind:n,api:s,scope:r,refresh:a}=ee(),o=Sn(),u=se[n],l=Xe(s,r,"pipeline",{repo:e.repo,id:e.id},a),d=l.data;return t.jsxs($n,{label:`${u.pipeline} #${e.id}`,children:[t.jsx(Xt,{...o,reference:`${e.repo} #${e.id}`,copyValue:e.id,copyLabel:`${u.pipeline.toLowerCase()} id`,href:(d==null?void 0:d.webUrl)??null}),t.jsx(Cn,{data:d,loading:l.loading,error:l.error,onRetry:l.reload,what:u.pipeline.toLowerCase()}),d&&t.jsxs(t.Fragment,{children:[l.error&&t.jsx(ie,{error:l.error,onRetry:l.reload,compact:!0}),t.jsx(fc,{pipeline:d}),t.jsxs("section",{className:"fd-block",children:[t.jsx(zt,{count:d.jobs.length,children:"Jobs"}),t.jsx(cc,{repo:d.repo,jobs:d.jobs})]})]})]})}function fc({pipeline:e}){const{kind:n,select:s}=ee(),r=se[n],a=Or(e.ref),o=Yt(e.durationSec),u=cl(e.source);return t.jsxs("header",{className:"fd-head",children:[t.jsx("h2",{className:"fd-title",children:e.title||`${r.pipeline} #${e.id}`}),t.jsxs("p",{className:"fd-byline",children:[t.jsx(xt,{mark:De(e.state)}),e.triggeredBy&&t.jsxs(t.Fragment,{children:[t.jsx("span",{children:"Started by"}),t.jsx(Dt,{user:e.triggeredBy,size:18})]}),u&&t.jsxs("span",{className:"fd-when",children:["· ",u]}),e.createdAt!=null&&t.jsxs("span",{className:"fd-when",children:["· created ",t.jsx(me,{at:e.createdAt})]}),o?t.jsxs("span",{className:"fd-when",children:["· took ",o]}):e.state==="running"&&e.startedAt!=null&&t.jsxs("span",{className:"fd-when",children:["· started ",t.jsx(me,{at:e.startedAt})]})]}),t.jsxs("ul",{className:"fd-status",children:[t.jsxs("li",{className:"fd-status-line",children:[t.jsx("span",{className:"fd-status-key",children:"Ran on"}),t.jsx(bt,{value:e.ref,label:"ref",children:t.jsx("code",{className:"fd-branch",title:e.ref,children:Br(n,e.ref)})}),t.jsx(bt,{value:e.sha,label:"commit sha",children:t.jsx("code",{children:e.shortSha})})]}),a!=null&&t.jsx("li",{children:t.jsxs("button",{type:"button",className:"fd-jump",onClick:()=>s({type:"change",repo:e.repo,number:a}),children:[t.jsx(ge,{mark:{mark:"linked",word:r.change,tone:"idle"},quiet:!0}),t.jsxs("span",{children:[r.change," ",t.jsx("code",{children:Fr(n,"",a)})]}),t.jsx("span",{className:"fd-jump-arrow","aria-hidden":"true",children:"›"})]})})]})]})}function mc({selection:e}){const{api:n,scope:s,refresh:r}=ee(),a=Sn(),o=Xe(n,s,"issue",{repo:e.repo,number:e.number},r),u=o.data,l=(u==null?void 0:u.key)??`${e.repo}#${e.number}`;return t.jsxs($n,{label:`Issue ${l}`,children:[t.jsx(Xt,{...a,reference:l,copyLabel:"reference",href:(u==null?void 0:u.webUrl)??null}),t.jsx(Cn,{data:u,loading:o.loading,error:o.error,onRetry:o.reload,what:"issue"}),u&&t.jsxs(t.Fragment,{children:[o.error&&t.jsx(ie,{error:o.error,onRetry:o.reload,compact:!0}),t.jsx(pc,{selection:e,issue:u})]})]})}function pc({selection:e,issue:n}){const{select:s}=ee(),r=Jt(n.titleHtml,!0),a=Jt(n.descriptionHtml);return t.jsxs(t.Fragment,{children:[t.jsxs("header",{className:"fd-head",children:[t.jsx("h2",{className:"fd-title",children:r.length?St(r):n.title}),t.jsxs("p",{className:"fd-byline",children:[t.jsx(xt,{mark:ll(n.state,n.stateReason)}),t.jsxs("span",{children:[t.jsxs("code",{children:["#",n.number]})," opened"]}),n.createdAt!=null&&t.jsx(me,{at:n.createdAt}),n.author&&t.jsxs(t.Fragment,{children:[t.jsx("span",{children:"by"}),t.jsx(Dt,{user:n.author,size:18})]}),n.state==="closed"&&n.closedAt!=null&&t.jsxs("span",{className:"fd-when",children:["· closed ",t.jsx(me,{at:n.closedAt})]})]})]}),t.jsxs("div",{className:"fd-layout",children:[t.jsxs(Jr,{label:"About this issue",children:[t.jsx(nt,{label:n.assignees.length>1?"Assignees":"Assignee",children:t.jsx(Xn,{users:n.assignees})}),n.labels.length>0&&t.jsx(nt,{label:"Labels",children:t.jsx(zr,{labels:n.labels})}),n.milestone&&t.jsx(nt,{label:"Milestone",children:n.milestone.webUrl?t.jsx("a",{className:"fd-plain-link",href:n.milestone.webUrl,target:"_blank",rel:"noreferrer noopener",children:n.milestone.title}):n.milestone.title}),n.parent&&t.jsx(nt,{label:"Parent",children:t.jsx(jc,{item:n.parent,onOpen:()=>s({type:"issue",repo:n.parent.repo,number:n.parent.number})})})]}),t.jsxs("div",{className:"fd-main",children:[a.length?t.jsx(ds,{className:"fd-description",nodes:a}):t.jsx("p",{className:"fd-none fd-description",children:"No description."}),n.childItems.length>0&&t.jsxs("section",{className:"fd-block",children:[t.jsx(zt,{count:n.childItems.length,aside:n.children&&t.jsxs("span",{className:"fd-progress",children:[n.children.completed," of ",n.children.total," done"]}),children:"Child items"}),t.jsx("ul",{className:"fg-rows fd-rows",children:n.childItems.map(o=>t.jsx("li",{children:t.jsx(gc,{item:o,onOpen:()=>s({type:"issue",repo:o.repo,number:o.number})})},o.key))})]}),t.jsx(xc,{selection:e,count:n.comments})]})]})]})}function Vr(e){return e==="open"?{mark:"open",word:"open",tone:"busy"}:{mark:"done",word:"closed",tone:"ok"}}function gc({item:e,onOpen:n}){const{selected:s}=ee(),r=(s==null?void 0:s.type)==="issue"&&s.repo===e.repo&&s.number===e.number;return t.jsxs("button",{type:"button",className:"fg-row fd-child-row ig-row",onClick:n,"aria-current":r||void 0,"data-selected":r||void 0,children:[t.jsx(ge,{mark:Vr(e.state)}),t.jsx("span",{className:"fd-child-title",children:e.title}),t.jsxs("span",{className:"fd-child-meta",children:[e.type&&t.jsx("span",{children:e.type}),t.jsxs("code",{children:["#",e.number]})]})]})}function jc({item:e,onOpen:n}){return t.jsxs("button",{type:"button",className:"fd-jump",onClick:n,children:[t.jsx(ge,{mark:Vr(e.state),quiet:!0}),t.jsx("span",{className:"fd-jump-title",children:e.title}),t.jsx("span",{className:"fd-jump-arrow","aria-hidden":"true",children:"›"})]})}function xc({selection:e,count:n}){const[s,r]=i.useState(!1);return n?t.jsxs("section",{className:"fd-block",children:[t.jsx(zt,{count:n,children:"Comments"}),s?t.jsx(bc,{selection:e}):t.jsxs("button",{type:"button",className:"btn fd-show-comments",onClick:()=>r(!0),children:["Show ",n.toLocaleString()," comment",n===1?"":"s"]})]}):t.jsxs("section",{className:"fd-block",children:[t.jsx(zt,{count:0,children:"Comments"}),t.jsx("p",{className:"fd-none",children:"No comments."})]})}function bc({selection:e}){const{api:n,scope:s,refresh:r}=ee(),a=dt(n,s,"issue/comments",{repo:e.repo,number:e.number},r);return a.data?t.jsxs(t.Fragment,{children:[a.error&&t.jsx(ie,{error:a.error,onRetry:a.reload,compact:!0}),a.data.items.length?t.jsx("ol",{className:"fd-threads fd-issue-comments",children:a.data.items.map(o=>t.jsx("li",{className:"fd-thread",children:t.jsx("ol",{className:"fd-comments",children:t.jsx(Gr,{comment:o})})},o.id))}):t.jsx("p",{className:"fd-none",children:"No comments."}),t.jsx(ut,{pages:a,label:"Load more comments"})]}):a.error?t.jsx(ie,{error:a.error,onRetry:a.reload}):t.jsx(Ke,{rows:3,label:"Loading comments"})}const Pt=["branches","changes","pipelines","issues"];function Xr(e,n){switch(n){case"branches":return"Branches";case"changes":return se[e].changes;case"pipelines":return se[e].pipelines;case"issues":return"Issues"}}function yc(e,n){const s=Xr(e,n);return`Back to ${s==="Actions"?s:s.toLowerCase()}`}const kc=".fg-tab-body:not([hidden])";function Qr({kind:e,connection:n,api:s,assetUrl:r,prefs:a,narrow:o,onReconnect:u,Split:l}){const d=`${e}:${n.id}`,[c,m]=i.useState(()=>_s(a)),[f,h]=i.useState(0),[x,j]=i.useState(()=>_n(d)),p=i.useCallback(M=>{j(M),cr(d,M)},[d]),[g,y]=i.useState({loadedAt:null,loading:!1,stale:!1}),[v,b]=i.useState(!1),R=i.useRef(!1),[S,k]=i.useState(null),A=i.useRef(null),O=i.useRef(null),z=i.useRef(null);vi(z);const C=i.useRef(null),N=i.useId(),L=M=>`${N}-tab-${M}`,te=M=>`${N}-panel-${M}`,de=i.useRef(d);i.useEffect(()=>{de.current!==d&&(de.current=d,m(_s(a)),j(_n(d)))},[d,a]);const T=lr(d,c.repo,c.tab),[F,q]=i.useState(null),_=i.useMemo(()=>F&&F.key===T?{complete:F.complete,has:M=>F.items.some(re=>Lt(re,M)),first:F.items[0]??null}:null,[F,T]),P=dr({listKey:T,drawn:_,same:Lt,sideBySide:!o,root:A,listScroller:kc}),{choose:B}=P,D=P.selection,G=i.useCallback(M=>{m(re=>{const ye={...re,...M};return Ks(a,ye),ye})},[a]),ae=i.useCallback(M=>{m(re=>{const ye=re.open.includes(M)?re.open.filter(at=>at!==M):[...re.open,M].slice(-20),He={...re,open:ye};return Ks(a,He),He})},[a]),K=i.useCallback(M=>{const re=document.activeElement,ye=re instanceof HTMLElement&&re.closest(".ig-list")!=null;M&&ye&&(C.current=re),B(M);const He=pi(M!=null,ye,o);requestAnimationFrame(()=>{var at,ot,Qe;He==="opener"&&((at=C.current)!=null&&at.isConnected)?C.current.focus():He==="page"&&((Qe=(ot=A.current)==null?void 0:ot.querySelector(".ig-detail .fd"))==null||Qe.focus())})},[o,B]),Se=i.useCallback(()=>{var M;return((M=qt(T))==null?void 0:M.section)??null},[T]),V=i.useCallback(M=>gt(T,{section:M}),[T]),je=i.useMemo(()=>({kind:e,connection:n,scope:d,api:s,asset:M=>r(M),refresh:f,selected:D,select:K,isOpen:M=>c.open.includes(M),toggle:ae,reportFreshness:y,onReconnect:u,narrow:o,listKey:T,reportRows:q,recallSection:Se,keepSection:V}),[e,n,d,s,r,f,D,K,c.open,ae,u,o,T,Se,V]),H=bi(e,c.tab),Fe=!H&&!c.repo,xe=Xe(s,d,Fe?"repos":null,{},f);i.useEffect(()=>{var re;const M=(re=xe.data)==null?void 0:re.items[0];Fe&&M&&G({repo:M.path})},[Fe,xe.data,G]);const we=async()=>{if($e(R.current)){R.current=!0,b(!0),k(null);try{const M=await is(s,fn("resolve",{q:x.trim()}));M?K(M.type==="change"?{type:"change",repo:M.repo,number:M.number}:{type:"issue",repo:M.repo,number:M.number}):k("Nothing to open at that address.")}catch(M){k(M instanceof Wt?M.info.message:"Could not open it.")}finally{R.current=!1,b(!1)}}},rt=M=>{G({tab:M}),p("")};Ni(O,c.tab);const be=se[e],Oe={view:c,setView:G,query:x},ce=t.jsxs("div",{ref:z,className:"fg-list",children:[t.jsxs("div",{className:"fg-toolbar",children:[t.jsx(Ui,{value:c.repo,allowAll:H,onChange:M=>G({repo:M})}),t.jsx(mr,{loadedAt:g.loadedAt,loading:g.loading,stale:g.stale,onRefresh:()=>h(M=>M+1),label:`Refresh ${be.name}`})]}),t.jsx("div",{ref:O,className:"uh-range fg-tabs",role:"tablist","aria-label":`${be.name} views`,onKeyDown:M=>{var ye;const re=er(M,Pt.indexOf(c.tab),Pt.length);re.kind!=="pass"&&(M.preventDefault(),M.stopPropagation(),rt(Pt[re.index]),(ye=M.currentTarget.querySelectorAll("[role=tab]")[re.index])==null||ye.focus())},children:Pt.map(M=>t.jsx("button",{id:L(M),type:"button",role:"tab",className:"uh-range-btn","aria-selected":c.tab===M,"aria-controls":te(M),tabIndex:c.tab===M?0:-1,onClick:()=>rt(M),children:Xr(e,M)},M))}),t.jsxs("div",{className:"fg-searchbar",children:[t.jsx(as,{value:x,onChange:M=>{p(M),k(null)},label:c.tab==="branches"?"Filter by branch name":`Search by title or number, or paste a ${be.name} link`,placeholder:c.tab==="branches"?"Filter by branch name":o?`Search, or paste a ${be.name} link`:`Search by title or number, or paste a ${be.name} link`,onKeyDown:M=>{M.key==="Enter"&&Us(x)&&we()}}),Us(x)&&t.jsx("button",{type:"button",className:"btn fg-resolve",onClick:()=>void we(),...Le(v),children:v?"Opening…":"Open"})]}),S&&t.jsx("p",{className:"fg-note",role:"status",children:S}),Pt.map(M=>t.jsx("div",{className:"fg-tab-body",id:te(M),role:"tabpanel","aria-labelledby":L(M),hidden:c.tab!==M,children:c.tab!==M?null:Fe?xe.error?t.jsx(ie,{error:xe.error,onRetry:xe.reload}):xe.data&&!xe.data.items.length?t.jsxs("p",{className:"fg-empty",children:["This token can see no ",be.repo.toLowerCase()," yet."]}):t.jsxs("p",{className:"fg-note",children:["Finding your most recent ",be.repo.toLowerCase(),"…"]}):M==="branches"?t.jsx(qi,{...Oe}):M==="changes"?t.jsx(vl,{...Oe}):M==="pipelines"?t.jsx(El,{...Oe}):t.jsx(Il,{...Oe})},M))]}),Be=D?D.type==="change"?t.jsx(Zl,{selection:D},`${D.repo}!${D.number}`):D.type==="branch"?t.jsx(ic,{selection:D},`${D.repo}@${D.name}`):D.type==="pipeline"?t.jsx(hc,{selection:D},`${D.repo}/p/${D.id}`):t.jsx(mc,{selection:D},`${D.repo}#${D.number}`):null;return t.jsx(yi,{value:je,children:t.jsx("div",{ref:A,className:"fg-panel","data-kind":e,children:t.jsx(l,{list:ce,detail:Be,onBack:()=>K(null),backLabel:yc(e,c.tab),storageKey:e,detailKey:D?Ar(D):void 0})})})}function wc(e){return t.jsx(Qr,{kind:"github",...e,Split:es})}function vc(e){return t.jsx(Qr,{kind:"gitlab",...e,Split:es})}const Nc={jira:ai,github:wc,gitlab:vc};function Sc({kind:e,connections:n,onClose:s,onReconnect:r}){const a=va(e),o=Nc[e],u=i.useId(),l=sr(),[d]=i.useState(()=>document.activeElement instanceof HTMLElement?document.activeElement:null),[c,m]=i.useState(!1),f=i.useRef(!1),h=i.useRef(s);h.current=s;const x=i.useCallback(()=>{f.current||(f.current=!0,h.current())},[]),j=i.useCallback(()=>{var N,L;if(c||f.current)return;const C=Array.from(document.querySelectorAll(`[data-rail-item="integration-${e}"], [data-rail-item="more"]`)).find(te=>{var de;return((de=te.checkVisibility)==null?void 0:de.call(te))??!0});(L=d&&d!==document.body&&d.isConnected&&(((N=d.checkVisibility)==null?void 0:N.call(d))??!0)?d:C)==null||L.focus({preventScroll:!0}),Qs()?x():m(!0)},[c,d,e,x]);i.useEffect(()=>{if(!c)return;const C=window.setTimeout(x,200);return()=>window.clearTimeout(C)},[c,x]);const p=i.useRef(null),g=i.useMemo(()=>({get current(){const C=p.current;return C?Array.from(C.querySelectorAll(fa)).find(N=>ma({disabled:N.disabled,tabIndex:N.tabIndex,rendered:N.checkVisibility?N.checkVisibility():N.getClientRects().length>0}))??null:null}}),[]),y=pa(j,{focusRef:g}),v=ga(j);i.useLayoutEffect(()=>{y.current&&(y.current.inert=c)},[c,y]),ja(e);const[b,R]=i.useState(()=>{var N;const C=xa(e);return n.some(L=>L.id===C)?C:((N=n[0])==null?void 0:N.id)??""});i.useEffect(()=>{if(n.length===0){s();return}n.some(C=>C.id===b)||R(n[0].id)},[n,b,s]);const S=C=>{R(C),Na(e,C)},k=n.find(C=>C.id===b)??null,A=(k==null?void 0:k.id)??"",O=i.useMemo(()=>A?{api:ka({kind:e,id:A}),assetUrl:ya({kind:e,id:A}),prefs:ba(e,A)}:null,[e,A]);if(!a||!o||!k||!O)return null;const{Glyph:z}=a;return wa.createPortal(t.jsx("div",{className:"modal-backdrop",role:"presentation",...v,children:t.jsxs("div",{ref:y,id:`integration-${e}-modal`,className:"modal ig-modal",role:"dialog","aria-modal":"true","aria-labelledby":"integration-modal-title","data-kind":e,"data-closing":c||void 0,onClick:C=>C.stopPropagation(),onAnimationEnd:C=>{c&&C.target===C.currentTarget&&x()},children:[t.jsxs("div",{className:"ig-head",children:[t.jsxs("h2",{className:"ig-title",id:"integration-modal-title",children:[t.jsx("span",{className:"ig-title-glyph","aria-hidden":!0,children:t.jsx(z,{})}),a.label]}),n.length>1?t.jsxs("label",{className:"ig-conn-select",children:[t.jsx("span",{className:"vis-hidden",children:"Connection"}),t.jsx("select",{id:u,className:"sm-select",value:k.id,onChange:C=>S(C.target.value),children:n.map(C=>t.jsxs("option",{value:C.id,children:[C.name,C.name!==Ct(C)?` · ${Ct(C)}`:""]},C.id))})]}):t.jsx("span",{className:"ig-conn-name",title:k.baseUrl,children:k.name}),t.jsx("button",{type:"button",className:"glyph-btn ig-close",onClick:j,"aria-label":`Close ${a.label}`,title:"Close (Esc)",children:"×"})]}),t.jsx("div",{ref:p,className:"ig-body",children:t.jsx(o,{connection:k,connections:n,api:O.api,assetUrl:O.assetUrl,prefs:O.prefs,narrow:l,onReconnect:()=>{j(),r(k.id)}},k.id)})]})}),document.body)}export{Sc as default};