github-issue-tower-defence-management 2.100.0 → 2.100.2
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.
- package/bin/adapter/entry-points/console/ui-dist/assets/{index-Bm1ORv63.js → index-D3_aonuG.js} +1 -1
- package/bin/adapter/entry-points/console/ui-dist/index.html +1 -1
- package/bin/domain/usecases/RevertNotReadyReviewQueueIssueUseCase.js +10 -0
- package/bin/domain/usecases/RevertNotReadyReviewQueueIssueUseCase.js.map +1 -1
- package/package.json +1 -1
- package/types/domain/usecases/RevertNotReadyReviewQueueIssueUseCase.d.ts +1 -1
- package/types/domain/usecases/RevertNotReadyReviewQueueIssueUseCase.d.ts.map +1 -1
package/bin/adapter/entry-points/console/ui-dist/assets/{index-Bm1ORv63.js → index-D3_aonuG.js}
RENAMED
|
@@ -10,7 +10,7 @@ Error generating stack: `+e.message+`
|
|
|
10
10
|
|
|
11
11
|
`),_e=`In Tmux by human`,ve=`Awaiting Workspace`,ye=[`In Tmux by human`,`Todo by human`,ve],be=e=>e===`todo-by-human`||e===`todo-by-agent`,xe=({statusOptions:e,onOkAndAwaitingWorkspace:t})=>{let n=e.find(e=>e.name.toLowerCase()===ve.toLowerCase());if(n===void 0)return null;let r=j(n.color);return(0,x.jsx)(`div`,{className:`console-op-group`,children:(0,x.jsx)(`button`,{type:`button`,className:`console-op-button`,style:{color:r.fg,borderColor:r.border,backgroundColor:r.bg},onClick:()=>t(n),children:`ok & Awaiting Workspace`})})},Se={issueOpen:{color:`#3fb950`,paths:[`M8 9.5a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3Z`,`M8 0a8 8 0 1 1 0 16A8 8 0 0 1 8 0ZM1.5 8a6.5 6.5 0 1 0 13 0 6.5 6.5 0 0 0-13 0Z`]},issueClosed:{color:`#a371f7`,paths:[`M11.28 6.78a.75.75 0 0 0-1.06-1.06L7.25 8.69 5.78 7.22a.75.75 0 0 0-1.06 1.06l2 2a.75.75 0 0 0 1.06 0l3.5-3.5Z`,`M16 8A8 8 0 1 1 0 8a8 8 0 0 1 16 0Zm-1.5 0a6.5 6.5 0 1 0-13 0 6.5 6.5 0 0 0 13 0Z`]},issueClosedNotPlanned:{color:`#848d97`,paths:[`M8 0a8 8 0 1 1 0 16A8 8 0 0 1 8 0ZM1.5 8a6.5 6.5 0 1 0 13 0 6.5 6.5 0 0 0-13 0Zm9.78-2.22-5.5 5.5a.749.749 0 0 1-1.275-.326.749.749 0 0 1 .215-.734l5.5-5.5a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042Z`]},prOpen:{color:`#3fb950`,paths:[`M1.5 3.25a2.25 2.25 0 1 1 3 2.122v5.256a2.251 2.251 0 1 1-1.5 0V5.372A2.25 2.25 0 0 1 1.5 3.25Zm5.677-.177L9.573.677A.25.25 0 0 1 10 .854V2.5h1A2.5 2.5 0 0 1 13.5 5v5.628a2.251 2.251 0 1 1-1.5 0V5a1 1 0 0 0-1-1h-1v1.646a.25.25 0 0 1-.427.177L7.177 3.427a.25.25 0 0 1 0-.354ZM3.75 2.5a.75.75 0 1 0 0 1.5.75.75 0 0 0 0-1.5Zm0 9.5a.75.75 0 1 0 0 1.5.75.75 0 0 0 0-1.5Zm8.25.75a.75.75 0 1 0 1.5 0 .75.75 0 0 0-1.5 0Z`]},prMerged:{color:`#a371f7`,paths:[`M5.45 5.154A4.25 4.25 0 0 0 9.25 7.5h1.378a2.251 2.251 0 1 1 0 1.5H9.25A5.734 5.734 0 0 1 5 7.123v3.505a2.25 2.25 0 1 1-1.5 0V5.372a2.25 2.25 0 1 1 1.95-.218ZM4.25 13.5a.75.75 0 1 0 0-1.5.75.75 0 0 0 0 1.5Zm8.5-4.5a.75.75 0 1 0 0-1.5.75.75 0 0 0 0 1.5ZM5 3.25a.75.75 0 1 0 0 .005V3.25Z`]},prClosed:{color:`#f85149`,paths:[`M3.25 1A2.25 2.25 0 0 1 4 5.372v5.256a2.251 2.251 0 1 1-1.5 0V5.372A2.251 2.251 0 0 1 3.25 1Zm9.5 5.5a.75.75 0 0 1 .75.75v3.378a2.251 2.251 0 1 1-1.5 0V7.25a.75.75 0 0 1 .75-.75Zm-2.03-5.273a.75.75 0 0 1 1.06 0l.97.97.97-.97a.748.748 0 0 1 1.265.332.75.75 0 0 1-.205.729l-.97.97.97.97a.751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018l-.97-.97-.97.97a.749.749 0 0 1-1.275-.326.749.749 0 0 1 .215-.734l.97-.97-.97-.97a.75.75 0 0 1 0-1.06ZM2.5 3.25a.75.75 0 1 0 1.5 0 .75.75 0 0 0-1.5 0ZM3.25 12a.75.75 0 1 0 0 1.5.75.75 0 0 0 0-1.5Zm9.5 0a.75.75 0 1 0 0 1.5.75.75 0 0 0 0-1.5Z`]},prDraft:{color:`#8b949e`,paths:[`M3.25 1A2.25 2.25 0 0 1 4 5.372v5.256a2.251 2.251 0 1 1-1.5 0V5.372A2.251 2.251 0 0 1 3.25 1Zm9.5 14a2.25 2.25 0 1 1 0-4.5 2.25 2.25 0 0 1 0 4.5ZM2.5 3.25a.75.75 0 1 0 1.5 0 .75.75 0 0 0-1.5 0ZM3.25 12a.75.75 0 1 0 0 1.5.75.75 0 0 0 0-1.5Zm9.5 0a.75.75 0 1 0 0 1.5.75.75 0 0 0 0-1.5ZM14 7.5a1.25 1.25 0 1 1-2.5 0 1.25 1.25 0 0 1 2.5 0Zm0-4.25a1.25 1.25 0 1 1-2.5 0 1.25 1.25 0 0 1 2.5 0Z`]}},Ce=({isPr:e,state:t,merged:n,isDraft:r,stateReason:i})=>e?r?`prDraft`:n?`prMerged`:t===`closed`?`prClosed`:`prOpen`:t===`closed`?i===`not_planned`?`issueClosedNotPlanned`:`issueClosed`:`issueOpen`,we=({size:e=12,...t})=>{let n=Ce(t),r=Se[n];return(0,x.jsx)(`svg`,{className:`console-item-icon`,viewBox:`0 0 16 16`,width:e,height:e,fill:r.color,role:`img`,"aria-label":n,children:r.paths.map(e=>(0,x.jsx)(`path`,{d:e},e))})},Te=({item:e,isActive:t,now:n,statusOptions:r=[],onSelect:i})=>(0,x.jsx)(`button`,{type:`button`,className:`console-item-row`,"aria-current":t?`true`:void 0,"data-active":t?`true`:void 0,onClick:()=>i(e),children:(0,x.jsxs)(`span`,{className:`console-item-meta`,children:[(0,x.jsxs)(`span`,{className:`console-item-title`,children:[(0,x.jsx)(we,{isPr:e.isPr,state:`open`,merged:!1,isDraft:!1,stateReason:``}),e.title]}),(0,x.jsxs)(`span`,{className:`console-item-sub`,children:[(0,x.jsxs)(`span`,{className:`console-item-pill`,children:[`#`,e.number]}),e.repo!==``&&(0,x.jsx)(`span`,{className:`console-item-pill`,children:e.repo}),(0,x.jsx)(`span`,{className:`console-item-pill`,children:e.isPr?`PR`:`Issue`}),e.createdAt!==``&&(0,x.jsxs)(`span`,{className:`console-item-opened`,children:[` · opened `,(0,x.jsx)(`span`,{className:`console-item-createdat`,title:O(e.createdAt),children:ie(e.createdAt,n)})]}),e.status!==null&&e.status!==``&&(0,x.jsx)(`span`,{className:`console-item-status-badge`,style:ce(r.find(t=>t.name===e.status)?.color??null),children:e.status})]}),(e.nextActionDate!==null||e.nextActionHour!==null||e.dependedIssueUrls.length>0)&&(0,x.jsxs)(`span`,{className:`console-item-fields`,children:[e.nextActionDate!==null&&(0,x.jsxs)(`span`,{className:`console-item-field`,children:[(0,x.jsx)(`span`,{className:`console-item-field-label`,children:`Next Action Date`}),e.nextActionDate.slice(0,10)]}),e.nextActionHour!==null&&(0,x.jsxs)(`span`,{className:`console-item-field`,children:[(0,x.jsx)(`span`,{className:`console-item-field-label`,children:`Next Action Hour`}),e.nextActionHour]}),e.dependedIssueUrls.length>0&&(0,x.jsxs)(`span`,{className:`console-item-field`,children:[(0,x.jsx)(`span`,{className:`console-item-field-label`,children:`Depended Issue URL`}),e.dependedIssueUrls.join(`, `)]})]}),e.agent!==null&&e.agent!==``&&(0,x.jsx)(`span`,{className:`console-item-status-agent`,children:(0,x.jsxs)(`span`,{className:`console-item-field`,children:[(0,x.jsx)(`span`,{className:`console-item-field-label`,children:`Agent`}),e.agent]})})]})}),Ee=({story:e,count:t,colorEnum:n})=>{let r=j(n);return(0,x.jsxs)(`div`,{className:`console-group-header`,children:[(0,x.jsxs)(`span`,{className:`console-storytag`,children:[(0,x.jsx)(`span`,{className:`console-story-dot`,style:{backgroundColor:r.dot}}),e]}),(0,x.jsx)(`span`,{className:`console-group-count`,children:t})]})},De=({rows:e,storyColors:t,statusOptions:n=[],activeItemId:r,now:i,isLoading:a,error:o,onSelectItem:s,executiveSummaries:c,onOkAndAwaitingWorkspace:l})=>o===null?a?(0,x.jsx)(`p`,{className:`console-list-message`,children:`Loading list...`}):e.length===0?(0,x.jsx)(`p`,{className:`console-list-empty`,children:`No items`}):(0,x.jsx)(`ul`,{className:`console-list`,children:e.map(e=>{if(e.kind===`group-header`)return(0,x.jsx)(`li`,{className:`console-list-group`,children:(0,x.jsx)(Ee,{story:e.story,count:e.count,colorEnum:ue(t,e.story)})},`group:${e.story}`);let a=c?.[e.item.projectItemId]??null;return(0,x.jsxs)(`li`,{className:`console-list-row`,children:[(0,x.jsx)(Te,{item:e.item,isActive:e.item.itemId===r,now:i,statusOptions:n,onSelect:s}),a!==null&&a!==``&&(0,x.jsx)(`span`,{className:`console-item-executive-summary`,children:a}),l!==void 0&&(0,x.jsx)(xe,{statusOptions:n,onOkAndAwaitingWorkspace:t=>l(e.item,t)})]},e.item.itemId)})}):(0,x.jsxs)(`p`,{role:`alert`,className:`console-list-message console-list-error`,children:[`Failed to load list: `,o]}),Oe=({agentOptions:e,agentCounts:t,selectedAgent:n,onAgentChange:r})=>{let i=e.filter(e=>(t[e.name]??0)>0);return i.length===0?null:(0,x.jsx)(`div`,{className:`console-prs-agent-filter`,children:(0,x.jsxs)(`select`,{value:n??``,onChange:e=>r(e.target.value===``?null:e.target.value),"aria-label":`Filter by agent`,children:[(0,x.jsx)(`option`,{value:``,children:`All agents`}),i.map(e=>(0,x.jsxs)(`option`,{value:e.name,children:[e.name,` (`,t[e.name],`)`]},e.id))]})})},ke=e=>({...ce(e),fontSize:`12px`,whiteSpace:`nowrap`,flexShrink:0}),Ae=({item:e,isActive:t,statusOptions:n,agentOptions:r,onSelect:i})=>{let a=n.find(t=>t.name===e.status),o=r.find(t=>t.name===e.agent);return(0,x.jsxs)(`button`,{type:`button`,className:`console-item-row console-queued-item-row`,"aria-current":t?`true`:void 0,"data-active":t?`true`:void 0,onClick:()=>i(e),children:[(0,x.jsx)(we,{isPr:e.isPr,state:`open`,merged:!1,isDraft:!1,stateReason:``}),(0,x.jsx)(`span`,{className:`console-queued-item-title`,children:e.title}),(0,x.jsxs)(`span`,{className:`console-queued-item-badges`,children:[e.status!==null&&e.status!==``&&(0,x.jsx)(`span`,{className:`console-queued-item-badge`,style:ke(a?.color??null),children:e.status}),e.agent!==null&&e.agent!==``&&(0,x.jsx)(`span`,{className:`console-queued-item-badge`,style:ke(o?.color??null),children:e.agent})]}),(0,x.jsx)(`span`,{className:`console-queued-item-actions`})]})},je=({rows:e,storyColors:t,statusOptions:n,agentOptions:r,activeItemId:i,isLoading:a,error:o,onSelectItem:s})=>o===null?a?(0,x.jsx)(`p`,{className:`console-list-message`,children:`Loading list...`}):e.length===0?(0,x.jsx)(`p`,{className:`console-list-empty`,children:`No items`}):(0,x.jsx)(`ul`,{className:`console-list`,children:e.map(e=>e.kind===`group-header`?(0,x.jsx)(`li`,{className:`console-list-group`,children:(0,x.jsx)(Ee,{story:e.story,count:e.count,colorEnum:ue(t,e.story)})},`group:${e.story}`):(0,x.jsx)(`li`,{className:`console-list-row`,children:(0,x.jsx)(Ae,{item:e.item,isActive:e.item.itemId===i,statusOptions:n,agentOptions:r,onSelect:s})},e.item.itemId))}):(0,x.jsxs)(`p`,{role:`alert`,className:`console-list-message console-list-error`,children:[`Failed to load list: `,o]}),Me=Object.keys(se),Ne=({placeholder:e,emptyValueError:t,onSubmit:n,onCancel:r,initialValue:i=``,submitLabel:a=`Create`,selectAllOnFocus:o=!1,multiline:s=!1})=>{let[c,l]=(0,y.useState)(i),[u,d]=(0,y.useState)(!1),[f,p]=(0,y.useState)(null),m=(0,y.useRef)(null),h=(0,y.useRef)(null),g=(0,y.useRef)(o);(0,y.useEffect)(()=>{s?(h.current?.focus(),g.current&&h.current?.select()):(m.current?.focus(),g.current&&m.current?.select())},[s]);let _=async()=>{let e=c.trim();if(e.length===0&&t!==``){p(t);return}d(!0),p(null);try{await n(e)}catch(e){p(e instanceof Error?e.message:String(e))}finally{d(!1)}};return(0,x.jsxs)(`form`,{className:`console-inline-input-form`,onSubmit:e=>{e.preventDefault(),_()},children:[s?(0,x.jsx)(`textarea`,{ref:h,className:`console-inline-input-form-textarea`,placeholder:e,value:c,onChange:e=>l(e.target.value),disabled:u,rows:3}):(0,x.jsx)(`input`,{ref:m,type:`text`,className:`console-inline-input-form-input`,placeholder:e,value:c,onChange:e=>l(e.target.value),disabled:u}),(0,x.jsx)(`button`,{type:`submit`,className:`console-op-button`,disabled:u,children:u?`${a.replace(/e$/,``)}ing…`:a}),(0,x.jsx)(`button`,{type:`button`,className:`console-op-button`,onClick:r,disabled:u,children:`Cancel`}),f!==null&&(0,x.jsx)(`p`,{role:`alert`,className:`console-list-error`,children:f})]})},Pe=({storyName:e,onSubmit:t,onCancel:n})=>(0,x.jsx)(Ne,{placeholder:`Issue title`,emptyValueError:`Title is required`,onSubmit:n=>t(e,n),onCancel:n}),Fe=({currentName:e,onSubmit:t,onCancel:n})=>(0,x.jsx)(Ne,{placeholder:`Story name`,emptyValueError:`Story name is required`,initialValue:e,submitLabel:`Rename`,selectAllOnFocus:!0,onSubmit:t,onCancel:n}),Ie=({currentDescription:e,onSubmit:t,onCancel:n})=>(0,x.jsx)(Ne,{placeholder:`Story description`,emptyValueError:``,initialValue:e,submitLabel:`Save`,selectAllOnFocus:!0,multiline:!0,onSubmit:t,onCancel:n}),Le=({onSelectColor:e,disabled:t})=>(0,x.jsx)(`div`,{className:`console-story-color-palette`,children:Me.map(n=>{let r=se[n];return(0,x.jsx)(`button`,{type:`button`,className:`console-story-color-swatch`,"aria-label":n===`GRAY`?`${n} (disable)`:n,style:{backgroundColor:r.dot},onClick:()=>e(n),disabled:t,children:n===`GRAY`&&(0,x.jsx)(`span`,{className:`console-story-color-swatch-label`,children:`disable`})},n)})}),Re=({storyName:e,isDeleting:t,deleteError:n,onConfirm:r,onCancel:i})=>(0,x.jsxs)(`div`,{className:`console-story-delete-confirm`,role:`dialog`,"aria-modal":`true`,"aria-label":`Confirm story deletion`,children:[(0,x.jsxs)(`p`,{className:`console-story-delete-confirm-message`,children:[`Delete story option "`,e,`" from the GitHub custom field? Tasks assigned to this story will not be deleted.`]}),n!==null&&(0,x.jsx)(`p`,{role:`alert`,className:`console-list-error`,children:n}),(0,x.jsxs)(`div`,{className:`console-story-delete-confirm-actions`,children:[(0,x.jsx)(`button`,{type:`button`,className:`console-op-button console-op-button-danger`,onClick:r,disabled:t,children:t?`Deleting…`:`Delete`}),(0,x.jsx)(`button`,{type:`button`,className:`console-op-button`,onClick:i,disabled:t,children:`Cancel`})]})]}),ze=({items:e})=>(0,x.jsx)(`ul`,{className:`console-story-task-list`,children:e.map(e=>(0,x.jsxs)(`li`,{className:`console-story-task-row`,children:[(0,x.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,className:`console-story-task-title`,children:e.title}),(0,x.jsx)(`span`,{className:`console-story-task-status`,children:e.status??`—`}),(0,x.jsx)(`span`,{className:`console-story-task-agent`,children:e.agent??`—`}),(0,x.jsx)(`span`,{className:`console-story-task-depended-urls`,children:e.dependedIssueUrls.length>0?e.dependedIssueUrls.join(`, `):`—`}),(0,x.jsx)(`span`,{className:`console-story-task-next-action-date`,children:e.nextActionDate===null?`—`:e.nextActionDate.slice(0,10)}),(0,x.jsx)(`span`,{className:`console-story-task-next-action-hour`,children:e.nextActionHour===null?`—`:String(e.nextActionHour)})]},e.url))}),Be=({stories:e,isLoading:t,error:n,showGray:r,onCreateIssue:i,onAddStory:a,onSelectColor:o,onToggleGray:s,onReorderStory:c,onDeleteStory:l,onRenameStory:u,onUpdateDescription:d,optimisticColors:f,colorChangeInFlight:p,colorErrors:m})=>{let[h,g]=(0,y.useState)(null),[_,v]=(0,y.useState)(null),[b,ee]=(0,y.useState)(!1),[S,C]=(0,y.useState)(null),[w,te]=(0,y.useState)({}),[ne,T]=(0,y.useState)(null),[re,E]=(0,y.useState)({}),[ie,D]=(0,y.useState)(null),[O,ae]=(0,y.useState)(null),oe=e=>w[e]??{inProgress:!1,error:null},k=async(e,t)=>{te(t=>({...t,[e]:{inProgress:!0,error:null}}));try{await c(e,t),te(t=>({...t,[e]:{inProgress:!1,error:null}}))}catch(t){te(n=>({...n,[e]:{inProgress:!1,error:t instanceof Error?t.message:String(t)}}))}};if(n!==null)return(0,x.jsxs)(`p`,{role:`alert`,className:`console-list-message console-list-error`,children:[`Failed to load stories: `,n]});if(t)return(0,x.jsx)(`p`,{className:`console-list-message`,children:`Loading stories...`});let A=e=>{g(h===e?null:e)},se=async(e,t)=>{await i(e,t),g(null)},ce=e=>{C(S===e?null:e)},M=(e,t)=>{C(null),o(e,t)},N=e=>{T(e)},P=async e=>{E(t=>({...t,[e]:{isDeleting:!0,error:null}}));try{await l(e),T(null),E(t=>({...t,[e]:{isDeleting:!1,error:null}}))}catch(t){E(n=>({...n,[e]:{isDeleting:!1,error:t instanceof Error?t.message:String(t)}}))}},le=()=>{T(null),E({})},F=e=>{D(ie===e?null:e)},ue=async(e,t)=>{await u(e,t),D(null)},de=e=>{ae(O===e?null:e)},fe=async(e,t)=>{await d(e,t),ae(null)},I=r?e:e.filter(e=>e.color!==`GRAY`),pe=e.some(e=>e.color===`GRAY`);return(0,x.jsxs)(`div`,{className:`console-story-list-container`,children:[I.length===0?(0,x.jsx)(`p`,{className:`console-list-empty`,children:`No active stories`}):(0,x.jsx)(`ul`,{className:`console-story-list`,children:I.map((e,t)=>{let n=j(f[e.storyOptionId]??e.color),r=h===e.storyOptionId,i=S===e.storyOptionId,a=p===e.storyOptionId,o=m[e.storyOptionId]??null,{inProgress:s,error:c}=oe(e.storyOptionId),l=t===0,u=t===I.length-1,d=ne===e.storyOptionId,y=re[e.storyOptionId]??{isDeleting:!1,error:null},b=ie===e.storyOptionId,ee=O===e.storyOptionId,C=_===e.storyOptionId,w=e.description??``;return(0,x.jsxs)(`li`,{className:`console-story-list-row`,children:[(0,x.jsxs)(`div`,{className:`console-story-list-row-main`,children:[e.storyViewUrl?(0,x.jsxs)(`a`,{href:e.storyViewUrl,target:`_blank`,rel:`noopener noreferrer`,className:`console-storytag`,style:{color:n.fg,borderColor:n.border},children:[(0,x.jsx)(`span`,{className:`console-story-dot`,style:{backgroundColor:n.dot}}),e.storyName]}):(0,x.jsxs)(`span`,{className:`console-storytag`,style:{color:n.fg,borderColor:n.border},children:[(0,x.jsx)(`span`,{className:`console-story-dot`,style:{backgroundColor:n.dot}}),e.storyName]}),(0,x.jsx)(`span`,{className:`console-story-count`,children:e.openItemCount}),(0,x.jsx)(`button`,{type:`button`,className:`console-op-button`,onClick:()=>A(e.storyOptionId),children:`Add task`}),(0,x.jsx)(`button`,{type:`button`,className:`console-op-button`,onClick:()=>ce(e.storyOptionId),disabled:a,children:`Change color`}),(0,x.jsx)(`button`,{type:`button`,className:`console-op-button`,"aria-label":`Move up`,disabled:l||s,onClick:()=>void k(e.storyOptionId,`up`),children:`↑`}),(0,x.jsx)(`button`,{type:`button`,className:`console-op-button`,"aria-label":`Move down`,disabled:u||s,onClick:()=>void k(e.storyOptionId,`down`),children:`↓`}),(0,x.jsx)(`button`,{type:`button`,className:`console-op-button console-op-button-danger`,"aria-label":`Delete story`,onClick:()=>N(e.storyOptionId),children:`Delete`}),(0,x.jsx)(`button`,{type:`button`,className:`console-op-button`,"aria-label":`Rename story`,onClick:()=>F(e.storyOptionId),children:`Rename`}),(0,x.jsx)(`button`,{type:`button`,className:`console-op-button`,"aria-label":`Edit description`,onClick:()=>de(e.storyOptionId),children:`Edit description`}),(0,x.jsx)(`button`,{type:`button`,className:`console-op-button`,onClick:()=>v(C?null:e.storyOptionId),children:C?`Hide tasks`:`Show tasks`})]}),w!==``&&(0,x.jsx)(`p`,{className:`console-story-description`,children:w}),C&&(0,x.jsx)(ze,{items:e.items}),c!==null&&(0,x.jsx)(`p`,{role:`alert`,className:`console-list-error`,children:c}),i&&(0,x.jsx)(Le,{onSelectColor:t=>M(e.storyOptionId,t),disabled:a}),o!==null&&(0,x.jsx)(`p`,{role:`alert`,className:`console-list-error`,children:o}),r&&(0,x.jsx)(Pe,{storyName:e.storyName,onSubmit:se,onCancel:()=>g(null)}),d&&(0,x.jsx)(Re,{storyName:e.storyName,isDeleting:y.isDeleting,deleteError:y.error,onConfirm:()=>void P(e.storyOptionId),onCancel:le}),b&&(0,x.jsx)(Fe,{currentName:e.storyName,onSubmit:t=>ue(e.storyOptionId,t),onCancel:()=>D(null)}),ee&&(0,x.jsx)(Ie,{currentDescription:w,onSubmit:t=>fe(e.storyOptionId,t),onCancel:()=>ae(null)})]},e.storyOptionId)})}),pe&&(0,x.jsx)(`button`,{type:`button`,className:`console-op-button`,onClick:s,children:r?`Hide archived`:`Show archived`}),(0,x.jsxs)(`div`,{className:`console-add-story-section`,children:[(0,x.jsx)(`button`,{type:`button`,className:`console-op-button`,onClick:()=>ee(!b),children:`Add story`}),b&&(0,x.jsx)(Ne,{placeholder:`Story name`,emptyValueError:`Story name is required`,onSubmit:async e=>{await a(e),ee(!1)},onCancel:()=>ee(!1)})]})]})},Ve=e=>`${e.isPr?`PR`:`Issue`} #${e.itemNumber}`,He=e=>e===null?`loading…`:e,Ue=e=>{let t=[];return t.push(`CI: ${e.isCiStateSuccess?`pass`:`fail`}`),t.push(`Merge: ${e.mergeableStatus.toLowerCase()}`),e.isBranchOutOfDate&&t.push(`branch out of date`),t.join(` · `)},We=e=>e.fetchError?`${Ve(e)} — failed to load current state`:e.currentTitle===null?`${Ve(e)} — loading current state…`:`${Ve(e)} — ${e.currentTitle} (${He(e.currentState)})`,Ge=({actions:e,isOnline:t,isConfirming:n,onConfirm:r,onDiscard:i})=>e.length===0?null:(0,x.jsxs)(`section`,{className:`console-offline-panel`,"aria-label":`Offline actions queue`,children:[(0,x.jsxs)(`div`,{className:`console-offline-panel-header`,children:[e.length,` action`,e.length===1?``:`s`,` held`,t?` — confirm each before sending`:` — awaiting connectivity`]}),e.map(e=>(0,x.jsxs)(`div`,{className:`console-offline-panel-item console-offline-panel-item-${e.color}`,children:[(0,x.jsx)(`div`,{className:`console-offline-panel-item-message`,children:e.message}),(0,x.jsx)(`div`,{className:`console-offline-panel-item-target`,children:We(e)}),e.fetchError&&(0,x.jsx)(`div`,{className:`console-offline-panel-item-fetch-error`,children:`Failed to load current state — sending will act on the last known state`}),t&&e.isPr&&e.currentPrStatus!==null&&!e.fetchError&&(0,x.jsx)(`div`,{className:`console-offline-panel-item-pr-status`,children:Ue(e.currentPrStatus)}),(0,x.jsxs)(`div`,{className:`console-offline-panel-item-controls`,children:[t&&(0,x.jsx)(`button`,{type:`button`,className:`console-offline-panel-confirm`,disabled:n||e.currentTitle===null&&!e.fetchError,onClick:()=>r(e.id),children:`Send`}),(0,x.jsx)(`button`,{type:`button`,className:`console-offline-panel-discard`,onClick:()=>i(e.id),children:`Discard`})]})]},e.id))]}),Ke=({message:e,color:t,remainingSeconds:n,progress:r,onUndo:i})=>(0,x.jsxs)(`div`,{className:`console-undo-toast console-undo-toast-${t}`,role:`status`,"aria-live":`polite`,children:[(0,x.jsx)(`span`,{className:`console-undo-toast-message`,children:e}),(0,x.jsx)(`button`,{type:`button`,className:`console-undo-toast-undo`,onClick:i,children:`Undo`}),(0,x.jsxs)(`span`,{className:`console-undo-toast-countdown`,"aria-hidden":`true`,children:[n,`s`]}),(0,x.jsx)(`span`,{className:`console-undo-toast-bar`,"aria-hidden":`true`,style:{width:`${Math.max(0,Math.min(100,r*100))}%`}})]}),qe=({title:e,message:t,onDismiss:n})=>(0,x.jsxs)(`div`,{className:`console-undo-toast-error console-error-toast`,role:`alert`,"aria-live":`assertive`,children:[e!==void 0&&(0,x.jsx)(`span`,{className:`console-error-toast-title`,children:e}),(0,x.jsx)(`span`,{className:`console-error-toast-message`,children:t}),(0,x.jsx)(`button`,{type:`button`,className:`console-error-toast-dismiss`,onClick:n,children:`Dismiss`})]}),Je=`tdpm-airplane-v1`,Ye=`/airplane-snapshot-data`,Xe=`tdpm_airplane_mode_on`,Ze=()=>typeof localStorage>`u`?!1:localStorage.getItem(Xe)===`1`,Qe=e=>{typeof localStorage>`u`||(e?localStorage.setItem(Xe,`1`):localStorage.removeItem(Xe))},$e=async e=>{if(typeof caches>`u`)throw Error(`Cache API unavailable`);try{await(await caches.open(Je)).put(Ye,new Response(JSON.stringify(e),{headers:{"Content-Type":`application/json`}}))}catch(e){throw e instanceof Error&&e.name===`QuotaExceededError`?Error(`Not enough browser storage to save the offline snapshot. Free up storage and retry.`):e}},et=async()=>{if(typeof caches>`u`)return null;let e=await(await caches.open(Je)).match(Ye);return e===void 0?null:e.json()},tt=async()=>{typeof caches>`u`||await caches.delete(Je)},nt=e=>typeof e==`object`&&!!e&&!Array.isArray(e),rt=e=>typeof e==`string`?e:``,it=e=>typeof e==`number`?e:0,at=e=>e===!0,L=e=>Array.isArray(e)?e.filter(e=>typeof e==`string`):[],ot=e=>e===`MERGEABLE`?`MERGEABLE`:e===`CONFLICTING`?`CONFLICTING`:`UNKNOWN`,R=e=>nt(e)?{number:it(e.number),title:rt(e.title),url:rt(e.url),repo:rt(e.repo),nameWithOwner:rt(e.nameWithOwner),projectItemId:rt(e.projectItemId),itemId:rt(e.itemId),isPr:at(e.isPr),story:rt(e.story),status:typeof e.status==`string`?e.status:null,nextActionDate:typeof e.nextActionDate==`string`?e.nextActionDate:null,nextActionHour:typeof e.nextActionHour==`number`?e.nextActionHour:null,dependedIssueUrls:L(e.dependedIssueUrls),labels:L(e.labels),createdAt:rt(e.createdAt),relatedOpenPullRequestUrls:L(e.relatedOpenPullRequestUrls),agent:typeof e.agent==`string`?e.agent:null}:null,st=e=>{if(!nt(e))return{items:[],generatedAt:``,statusOptions:[],agentOptions:[],storyOptions:[],storyColors:{},stories:[],defaultNameWithOwner:null,fromCache:!1,storyOrder:[],timerEndsAt:null,timerTotalSeconds:null};let t=Array.isArray(e.items)?e.items.map(R).filter(e=>e!==null):[],n=Array.isArray(e.statusOptions)?e.statusOptions.filter(nt):[],r=Array.isArray(e.agentOptions)?e.agentOptions.filter(nt):[],i=Array.isArray(e.storyOptions)?e.storyOptions.filter(nt):[],a=Array.isArray(e.stories)?e.stories.filter(nt):[],o=Array.isArray(e.storyOrder)?e.storyOrder.filter(e=>typeof e==`string`):[];return{items:t,generatedAt:typeof e.generatedAt==`string`?e.generatedAt:``,statusOptions:n,agentOptions:r,storyOptions:i,storyColors:nt(e.storyColors)?e.storyColors:{},stories:a,defaultNameWithOwner:typeof e.defaultNameWithOwner==`string`?e.defaultNameWithOwner:null,fromCache:!1,storyOrder:o,timerEndsAt:null,timerTotalSeconds:null}},ct=e=>nt(e)?{author:rt(e.author),body:rt(e.body),createdAt:rt(e.createdAt),url:typeof e.url==`string`?e.url:null}:null,lt=e=>nt(e)?{path:rt(e.path),additions:it(e.additions),deletions:it(e.deletions),status:rt(e.status),patch:typeof e.patch==`string`?e.patch:null,rawUrl:typeof e.rawUrl==`string`?e.rawUrl:null}:null,ut=e=>nt(e)?{sha:rt(e.sha),message:rt(e.message),author:rt(e.author),authoredAt:rt(e.authoredAt)}:null,dt=e=>nt(e)?{found:at(e.found),isConflicted:at(e.isConflicted),mergeableStatus:ot(e.mergeableStatus),isPassedAllCiJob:at(e.isPassedAllCiJob),isCiStateSuccess:at(e.isCiStateSuccess),isBranchOutOfDate:at(e.isBranchOutOfDate),missingRequiredCheckNames:L(e.missingRequiredCheckNames)}:{found:!1,isConflicted:!1,mergeableStatus:`UNKNOWN`,isPassedAllCiJob:!1,isCiStateSuccess:!1,isBranchOutOfDate:!1,missingRequiredCheckNames:[]},ft=e=>{if(!nt(e))return null;let t=nt(e.summary)?{title:rt(e.summary.title),body:rt(e.summary.body),additions:it(e.summary.additions),deletions:it(e.summary.deletions),changedFiles:it(e.summary.changedFiles)}:null;return{url:rt(e.url),branchName:typeof e.branchName==`string`?e.branchName:null,createdAt:rt(e.createdAt),isDraft:at(e.isDraft),isConflicted:at(e.isConflicted),mergeableStatus:ot(e.mergeableStatus),isPassedAllCiJob:at(e.isPassedAllCiJob),isCiStateSuccess:at(e.isCiStateSuccess),isResolvedAllReviewComments:at(e.isResolvedAllReviewComments),isBranchOutOfDate:at(e.isBranchOutOfDate),missingRequiredCheckNames:L(e.missingRequiredCheckNames),summary:t}},pt=e=>{if(!nt(e))return{body:``,comments:[],state:{state:`open`,merged:!1,isPullRequest:!1,title:``},files:null,commits:null,prStatus:null,relatedPrs:null};let t=nt(e.state)?e.state:{},n={state:rt(t.state)||`open`,merged:at(t.merged),isPullRequest:at(t.isPullRequest),title:rt(t.title)},r=e.files===null?null:Array.isArray(e.files)?e.files.map(lt).filter(e=>e!==null):null,i=e.commits===null?null:Array.isArray(e.commits)?e.commits.map(ut).filter(e=>e!==null):null,a=e.prStatus===null?null:dt(e.prStatus),o=e.relatedPrs===null?null:Array.isArray(e.relatedPrs)?e.relatedPrs.map(ft).filter(e=>e!==null):null;return{body:rt(e.body),comments:Array.isArray(e.comments)?e.comments.map(ct).filter(e=>e!==null):[],state:n,files:r,commits:i,prStatus:a,relatedPrs:o}},mt=e=>{if(!nt(e))return null;let t=typeof e.capturedAt==`string`?e.capturedAt:``,n=L(e.failures),r={};if(nt(e.tabs))for(let[t,n]of Object.entries(e.tabs)){if(!nt(n))continue;let e={};for(let[t,r]of Object.entries(n))e[t]=st(r);r[t]=e}let i={};if(nt(e.items))for(let[t,n]of Object.entries(e.items))i[t]=pt(n);return{capturedAt:t,tabs:r,items:i,failures:n}},ht=`/api/airplanesync`,gt=e=>{try{let t=JSON.parse(e);return typeof t==`object`&&t&&!Array.isArray(t)&&`type`in t&&typeof t.type==`string`?t:null}catch{return null}},_t=()=>{let[e,t]=(0,y.useState)(`off`),[n,r]=(0,y.useState)(null),[i,a]=(0,y.useState)(null),[o,s]=(0,y.useState)([]),c=(0,y.useRef)(null);return(0,y.useEffect)(()=>{if(!Ze())return;let e=!1;return et().then(n=>{e||n===null||(a(n),t(`on`))}).catch(()=>{Qe(!1)}),()=>{e=!0}},[]),{status:e,progress:n,snapshot:i,failures:o,startSync:(0,y.useCallback)(()=>{c.current!==null&&c.current.abort();let e=new AbortController;c.current=e,t(`syncing`),r({fetched:0,total:0}),s([]),fetch(ht,{signal:e.signal}).then(async e=>{if(!e.ok||e.body===null){t(`error`),s([`HTTP ${e.status}`]);return}let n=e.body.pipeThrough(new TextDecoderStream).getReader(),i=``;for(;;){let{done:e,value:o}=await n.read();if(e)break;i+=o;let c=i.split(`
|
|
12
12
|
|
|
13
|
-
`);i=c.pop()??``;for(let e of c){if(!e.startsWith(`data: `))continue;let n=gt(e.slice(6));if(n!==null){if(n.type===`progress`)r({fetched:typeof n.fetched==`number`?n.fetched:0,total:typeof n.total==`number`?n.total:0});else if(n.type===`done`){let e=mt(n.snapshot);if(e===null){t(`error`),s([`Failed to parse snapshot`]);return}if(e.failures.length>0){s(e.failures),t(`error`);return}await $e(e),Qe(!0),a(e),t(`on`),s([])}}}}}).catch(e=>{e instanceof Error&&e.name===`AbortError`||(t(`error`),s([e instanceof Error?e.message:String(e)]))})},[]),turnOff:(0,y.useCallback)(()=>{c.current!==null&&(c.current.abort(),c.current=null),t(`off`),a(null),r(null),s([]),Qe(!1),tt().catch(()=>{})},[])}},z=e=>typeof e==`object`&&!!e&&!Array.isArray(e),B=e=>typeof e==`string`?e:``,vt=e=>typeof e==`number`?e:0,yt=e=>e===!0,bt=`console-api-v1`,xt=async(e,t)=>{let n=`${e}?url=${encodeURIComponent(t)}`;try{let e=await fetch(n);if(!e.ok){let t=`HTTP ${e.status}`;try{let n=await e.json();z(n)&&typeof n.error==`string`&&n.error.length>0&&(t=n.error)}catch(e){console.warn(`Failed to parse error body from non-ok response:`,e)}throw Error(t)}let t=await e.json();try{`caches`in globalThis&&globalThis.caches.open(bt).then(e=>e.put(n,new Response(JSON.stringify(t),{headers:{"Content-Type":`application/json`}}))).catch(e=>{console.warn(`Failed to persist API response to cache:`,e)})}catch(e){console.warn(`Failed to access cache storage:`,e)}return t}catch(e){try{if(`caches`in globalThis){let e=await(await globalThis.caches.open(bt)).match(n);if(e!==void 0)return e.json()}}catch{}throw e}},St=e=>!z(e)||!Array.isArray(e.comments)?[]:e.comments.filter(z).map(e=>({author:B(e.author),body:B(e.body),createdAt:B(e.createdAt),url:typeof e.url==`string`?e.url:null})),Ct=e=>!z(e)||!Array.isArray(e.files)?[]:e.files.filter(z).map(e=>({path:B(e.path)||B(e.filename),additions:vt(e.additions),deletions:vt(e.deletions),status:B(e.status),patch:typeof e.patch==`string`?e.patch:null,rawUrl:typeof e.rawUrl==`string`?e.rawUrl:null})),wt=e=>!z(e)||!Array.isArray(e.commits)?[]:e.commits.filter(z).map(e=>({sha:B(e.sha),message:B(e.message),author:B(e.author),authoredAt:B(e.authoredAt)})),Tt=e=>z(e)?{title:B(e.title),body:B(e.body),additions:vt(e.additions),deletions:vt(e.deletions),changedFiles:vt(e.changedFiles)}:null,Et=e=>Array.isArray(e)?e.filter(e=>typeof e==`string`):[],Dt=e=>e===`MERGEABLE`?`MERGEABLE`:e===`CONFLICTING`?`CONFLICTING`:`UNKNOWN`,Ot=e=>!z(e)||!Array.isArray(e.relatedPullRequests)?[]:e.relatedPullRequests.filter(z).map(e=>({url:B(e.url),branchName:typeof e.branchName==`string`?e.branchName:null,createdAt:B(e.createdAt),isDraft:yt(e.isDraft),isConflicted:yt(e.isConflicted),mergeableStatus:Dt(e.mergeableStatus),isPassedAllCiJob:yt(e.isPassedAllCiJob),isCiStateSuccess:yt(e.isCiStateSuccess),isResolvedAllReviewComments:yt(e.isResolvedAllReviewComments),isBranchOutOfDate:yt(e.isBranchOutOfDate),missingRequiredCheckNames:Et(e.missingRequiredCheckNames),summary:Tt(e.summary)})),kt=e=>{if(!z(e)||!z(e.status))return{found:!1,isConflicted:!1,mergeableStatus:`UNKNOWN`,isPassedAllCiJob:!1,isCiStateSuccess:!1,isBranchOutOfDate:!1,missingRequiredCheckNames:[]};let t=e.status;return{found:!0,isConflicted:yt(t.isConflicted),mergeableStatus:Dt(t.mergeableStatus),isPassedAllCiJob:yt(t.isPassedAllCiJob),isCiStateSuccess:yt(t.isCiStateSuccess),isBranchOutOfDate:yt(t.isBranchOutOfDate),missingRequiredCheckNames:Et(t.missingRequiredCheckNames)}},At=e=>z(e)?{state:B(e.state)||`open`,merged:yt(e.merged),isPullRequest:yt(e.isPullRequest),title:B(e.title)}:{state:`open`,merged:!1,isPullRequest:!1,title:``},jt=()=>({fetchItemBody:async e=>{let t=await xt(`/api/itembody`,e);return z(t)?B(t.body):``},fetchComments:async e=>St(await xt(`/api/comments`,e)),fetchPrFiles:async e=>Ct(await xt(`/api/prfiles`,e)),fetchPrCommits:async e=>wt(await xt(`/api/prcommits`,e)),fetchRelatedPrs:async e=>Ot(await xt(`/api/relatedprs`,e)),fetchIssueState:async e=>At(await xt(`/api/issuetitle`,e)),fetchPullRequestStatus:async e=>kt(await xt(`/api/pullrequeststatus`,e))}),Mt=async e=>{let t=await e.text().catch(()=>``);if(t.length===0)return`HTTP ${e.status}`;try{let e=JSON.parse(t);if(z(e)&&typeof e.error==`string`)return e.error}catch{return t}return t},Nt=async(e,t)=>{let n=await fetch(e,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(t)});if(!n.ok)throw Error(await Mt(n))},Pt=`/api/comment`,Ft=e=>({author:B(e.author),body:B(e.body),createdAt:B(e.createdAt),url:typeof e.url==`string`?e.url:null}),It=async e=>{let t=await fetch(Pt,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)});if(!t.ok)return{posted:!1,error:await Mt(t),rateLimitResetAt:null};let n=await t.json();return z(n)?n.ok===!1?{posted:!1,error:typeof n.error==`string`?n.error:`upstream error`,rateLimitResetAt:typeof n.rateLimitResetAt==`string`?n.rateLimitResetAt:null}:z(n.comment)?{posted:!0,comment:Ft(n.comment)}:{posted:!1,error:`comment was not returned`,rateLimitResetAt:null}:{posted:!1,error:`unexpected response shape`,rateLimitResetAt:null}},Lt=`/api/upload`,Rt=e=>{let t=``;for(let n of e)t+=String.fromCharCode(n);return btoa(t)},zt=async e=>{let t=await fetch(Lt,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)});if(!t.ok)throw Error(await Mt(t));let n=await t.json();if(!z(n)||typeof n.markdown!=`string`)throw Error(`markdown was not returned`);return n.markdown},Bt=`/api/addstory`,Vt=async e=>{let t=await fetch(Bt,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)});if(!t.ok)throw Error(await Mt(t))},Ht=`/api/reviewcomment`,Ut=async e=>{let t=await fetch(Ht,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)});if(!t.ok)throw Error(await Mt(t))},Wt=`/api/createissue`,Gt=`/api/storycolor`,Kt=async e=>{let t=await fetch(Gt,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)});if(!t.ok)throw Error(await Mt(t))},qt=async e=>{let t=await fetch(Wt,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)});if(!t.ok)throw Error(await Mt(t));let n=await t.json();if(!(e=>typeof e==`object`&&!!e&&!Array.isArray(e))(n)||typeof n.issueUrl!=`string`)throw Error(`issueUrl was not returned`);return n.issueUrl},Jt=`/api/reorderstory`,Yt=async e=>{let t=await fetch(Jt,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)});if(!t.ok)throw Error(await Mt(t))},Xt=`/api/deleteallcomments`,Zt=async e=>{let t=await fetch(Xt,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)});if(!t.ok)throw Error(await Mt(t))},Qt=`/api/deletestory`,$t=async e=>{let t=await fetch(Qt,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)});if(!t.ok)throw Error(await Mt(t))},en=`/api/renamestory`,tn=async e=>{let t=await fetch(en,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)});if(!t.ok)throw Error(await Mt(t))},nn=`/api/storydescription`,rn=async e=>{let t=await fetch(nn,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)});if(!t.ok)throw Error(await Mt(t))},an=async()=>{let e=await fetch(`/api/projects`);if(!e.ok)throw Error(`HTTP ${e.status}`);let t=await e.json();if(typeof t!=`object`||!t||Array.isArray(t))return{pjcodes:[],projectUrls:null,workflowImprovementIssueUrl:null,fleetTaskCreateUrl:null};let n=t;return{pjcodes:Array.isArray(n.pjcodes)?n.pjcodes.filter(e=>typeof e==`string`):[],projectUrls:n.projectUrls!==null&&typeof n.projectUrls==`object`&&!Array.isArray(n.projectUrls)?Object.fromEntries(Object.entries(n.projectUrls).filter(e=>typeof e[1]==`string`)):null,workflowImprovementIssueUrl:typeof n.workflowImprovementIssueUrl==`string`?n.workflowImprovementIssueUrl:null,fleetTaskCreateUrl:typeof n.fleetTaskCreateUrl==`string`?n.fleetTaskCreateUrl:null}},on=`/api/projectreadmeconfig`,sn=async e=>{let t=`${on}?pjcode=${encodeURIComponent(e)}`,n=await fetch(t);if(!n.ok)throw Error(await Mt(n));let r=await n.json();return{maximumPreparingIssuesCount:z(r)&&typeof r.maximumPreparingIssuesCount==`number`?r.maximumPreparingIssuesCount:null}},cn=`/api/setdependedissueurl`,ln=async e=>{let t=await fetch(cn,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)});if(!t.ok)throw Error(await Mt(t))},un=`/api/projectsettings`,dn=async e=>{let t=await fetch(un,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)});if(!t.ok)throw Error(await Mt(t))},fn=5e3,pn=e=>`${e.isPr?`PR #`:`#`}${e.number}`,mn=(e,t)=>{switch(e.type){case`review`:return e.action===`approve_and_merge`?`Approved & Merged`:e.action===`request_changes`?`Rejected`:e.action===`totally_wrong`?`Marked totally wrong`:`Marked unnecessary`;case`next_action_date`:return e.action===`snooze_1hour`?`Next Action Hour +1 hour`:e.action===`snooze_3hours`?`Next Action Hour +3 hours`:e.action===`snooze_6hours`?`Next Action Hour +6 hours`:e.action===`snooze_1day`?`Next Action Date +1 day`:e.action===`snooze_2days`?`Next Action Date +2 days`:e.action===`snooze_3days`?`Next Action Date +3 days`:e.action===`snooze_5days`?`Next Action Date +5 days`:e.action===`snooze_1month`?`Next Action Date +1 month`:be(t)?`Next Action Date +1 week and skip`:`Next Action Date +1 week`;case`set_story`:return`Story → ${e.optionName}`;case`set_agent`:return`Agent → ${e.optionName}`;case`set_status`:return`Status → ${e.optionName}`;case`set_in_tmux_by_human`:return`Added to In Tmux by human`;case`ok_and_awaiting_workspace`:return`ok → Awaiting Workspace`;case`close`:return e.action===`close`?`Closed`:`Closed as not planned`;case`delete_all_comments`:return`Deleted all comments`}},hn=e=>{switch(e.type){case`review`:return e.action===`approve_and_merge`?`green`:e.action===`request_changes`?`amber`:e.action===`totally_wrong`?`red`:`gray`;case`next_action_date`:return`amber`;case`set_story`:case`set_agent`:case`set_status`:case`set_in_tmux_by_human`:case`ok_and_awaiting_workspace`:return`blue`;case`close`:return`red`;case`delete_all_comments`:return`red`}},gn=(e,t)=>e.type===`next_action_date`?be(t):e.type!==`delete_all_comments`,_n=(e,t,n)=>`${mn(e,n)} — ${pn(t)}`,vn=`console-offline-action-queue`,yn=e=>{if(typeof e!=`object`||!e)return!1;let t=e;return typeof t.id==`string`&&typeof t.message==`string`&&typeof t.color==`string`&&typeof t.enqueuedAt==`number`&&typeof t.itemUrl==`string`&&typeof t.projectItemId==`string`&&typeof t.itemNumber==`number`&&typeof t.repo==`string`&&typeof t.isPr==`boolean`&&typeof t.apiPath==`string`&&typeof t.requestBody==`object`&&t.requestBody!==null},bn=()=>{try{let e=localStorage.getItem(vn);if(e===null)return[];let t=JSON.parse(e);return Array.isArray(t)?t.filter(yn):[]}catch{return[]}},xn=e=>{localStorage.setItem(vn,JSON.stringify(e))},Sn=()=>typeof crypto<`u`&&typeof crypto.randomUUID==`function`?crypto.randomUUID():`${Date.now().toString(36)}-${Math.random().toString(36).slice(2)}-${Math.random().toString(36).slice(2)}`,Cn=e=>e instanceof TypeError,wn=e=>e instanceof Error&&e.message.length>0?e.message:String(e),Tn=100,En=e=>Math.max(0,Math.ceil((fn-e)/1e3)),Dn=e=>Math.max(0,1-e/fn),On=()=>{let[e,t]=(0,y.useState)(null),[n,r]=(0,y.useState)(null),[i,a]=(0,y.useState)(bn),o=(0,y.useRef)(i);o.current=i;let s=(0,y.useRef)(null),c=(0,y.useRef)(0),l=(0,y.useRef)(null),u=(0,y.useRef)(!1),d=(0,y.useCallback)(()=>{l.current!==null&&(clearInterval(l.current),l.current=null)},[]),f=(0,y.useCallback)(e=>{if(e.offline===void 0)return;let t={id:Sn(),message:e.message,color:e.color,enqueuedAt:Date.now(),...e.offline};a(e=>{let n=[...e,t];return xn(n),n})},[]),p=(0,y.useCallback)(e=>{e.commit().catch(t=>{Cn(t)&&e.offline!==void 0?f(e):r({message:e.message,reason:wn(t)})})},[f]),m=(0,y.useCallback)(()=>{let e=s.current;d(),s.current=null,t(null),e!==null&&!u.current&&(u.current=!0,p(e))},[d,p]),h=(0,y.useCallback)(()=>{let e=s.current;d(),s.current=null,u.current=!0,t(null),e?.revertAdvance?.()},[d]),g=(0,y.useCallback)(()=>{r(null)},[]),_=(0,y.useCallback)((e,t)=>{r({message:e,reason:t})},[]),v=(0,y.useCallback)(e=>{a(t=>{let n=t.filter(t=>t.id!==e);return xn(n),n})},[]),b=(0,y.useCallback)(async e=>{let t=o.current.find(t=>t.id===e);if(t!==void 0)try{await Nt(t.apiPath,t.requestBody),v(e)}catch(n){Cn(n)?r({message:t.message,reason:`Still offline — action is still held in the queue`}):(r({message:t.message,reason:wn(n)}),v(e))}},[v]),x=(0,y.useCallback)(e=>{if(s.current!==null&&!u.current){let e=s.current;d(),u.current=!0,p(e)}u.current=!1,s.current=e,c.current=Date.now(),t({message:e.message,color:e.color,remainingSeconds:En(0),progress:Dn(0)}),e.advance(),l.current=setInterval(()=>{let n=Date.now()-c.current;if(n>=5e3){m();return}t({message:e.message,color:e.color,remainingSeconds:En(n),progress:Dn(n)})},Tn)},[d,m,p]);return(0,y.useEffect)(()=>d,[d]),{pending:e,error:n,offlineActions:i,enqueue:x,showError:_,undo:h,dismissError:g,confirmOfflineAction:b,discardOfflineAction:v}},kn=e=>{window.history.pushState({},``,e),window.dispatchEvent(new PopStateEvent(`popstate`))},An=e=>{window.history.replaceState({},``,e),window.dispatchEvent(new PopStateEvent(`popstate`))},jn=`tdpm-timer-settings`,Mn=()=>({timerMode:!1,projectMinutes:{}}),Nn=()=>{if(typeof localStorage>`u`)return Mn();let e=localStorage.getItem(jn);if(e===null)return Mn();try{let t=JSON.parse(e);if(typeof t!=`object`||!t||Array.isArray(t))return Mn();let n=t,r=typeof n.timerMode==`boolean`&&n.timerMode,i=n.projectMinutes;return{timerMode:r,projectMinutes:typeof i==`object`&&i&&!Array.isArray(i)?Object.fromEntries(Object.entries(i).filter(([,e])=>typeof e==`number`).map(([e,t])=>[e,t])):{}}}catch{return Mn()}},Pn=e=>{typeof localStorage<`u`&&localStorage.setItem(jn,JSON.stringify(e))},Fn=(e,t,n)=>{if(e.length===0)return null;let r=t===null?-1:e.indexOf(t),i=r===-1?0:(r+1)%e.length,a=r===-1?e.length:e.length-1;for(let t=0;t<a;t++){let r=e[(i+t)%e.length];if((n[r]??0)>0)return r}return null},In=(e,t,n,r,i)=>{let a=(0,y.useRef)(t),o=(0,y.useRef)(n);(0,y.useEffect)(()=>{let s=a.current,c=o.current;if(a.current=t,o.current=n,e&&c===n&&s>0&&t===0){let e=Fn(r,n,i);e!==null&&kn(`/projects/${e}`)}},[e,t,n,r,i])},Ln=class{fetcher;cache=new Map;inFlight=new Map;prefetchInFlight=new Set;constructor(e){this.fetcher=e}peek=e=>this.cache.get(e);has=e=>this.cache.has(e);load=(e,t)=>{let n=this.cache.get(e);if(n!==void 0)return Promise.resolve(n);let r=this.inFlight.get(e);if(r!==void 0)return r;let i=this.fetcher(t).then(t=>(this.cache.set(e,t),t)).finally(()=>{this.inFlight.delete(e)});return this.inFlight.set(e,i),i};prefetch=(e,t)=>{this.cache.has(e)||this.inFlight.has(e)||this.prefetchInFlight.has(e)||(this.prefetchInFlight.add(e),this.fetcher(t).then(t=>{this.cache.set(e,t)}).catch(()=>{}).finally(()=>{this.prefetchInFlight.delete(e)}))};seed(e,t){this.cache.set(e,t)}invalidate=e=>{this.cache.delete(e)}},Rn=e=>{try{let t=new URL(e).pathname.split(`/`).filter(Boolean);if(t.length>=4)return`${t[0]}/${t[1]}#${t[3]}`}catch{}return e},zn=(e,t)=>{for(let[n,r]of Object.entries(t.items)){let t=Rn(n);e.body.seed(t,r.body),e.comments.seed(t,r.comments),e.state.seed(t,r.state),r.files!==null&&e.files.seed(t,r.files),r.commits!==null&&e.commits.seed(t,r.commits),r.prStatus!==null&&e.prStatus.seed(t,r.prStatus),r.relatedPrs!==null&&e.relatedPrs.seed(t,r.relatedPrs)}},Bn=(e=null)=>(0,y.useMemo)(()=>{let t=jt(),n={client:t,body:new Ln(t.fetchItemBody),comments:new Ln(t.fetchComments),files:new Ln(t.fetchPrFiles),commits:new Ln(t.fetchPrCommits),relatedPrs:new Ln(t.fetchRelatedPrs),state:new Ln(t.fetchIssueState),prStatus:new Ln(t.fetchPullRequestStatus)};return e!==null&&zn(n,e),n},[e]),Vn=0,Hn=500,Un=2e3,Wn=e=>{let t=window;if(typeof t.requestIdleCallback==`function`&&typeof t.cancelIdleCallback==`function`){let n=t.requestIdleCallback(e,{timeout:Un});return{cancel:()=>t.cancelIdleCallback?.(n)}}let n=window.setTimeout(e,0);return{cancel:()=>window.clearTimeout(n)}},Gn=(e,t)=>{let n=`${t.repo}#${t.number}`;e.body.prefetch(n,t.url),e.state.prefetch(n,t.url),e.comments.prefetch(n,t.url),t.isPr?(e.files.prefetch(n,t.url),e.commits.prefetch(n,t.url),e.prStatus.prefetch(n,t.url)):e.relatedPrs.prefetch(n,t.url)},Kn=(e,t,n)=>{(0,y.useEffect)(()=>{if(t===null)return;let r=n.findIndex(e=>e.projectItemId===t.projectItemId);if(r===-1)return;let i=n.slice(r+1,r+1+Vn);if(i.length===0)return;let a=null,o=window.setTimeout(()=>{a=Wn(()=>{for(let t of i)Gn(e,t)})},Hn);return()=>{window.clearTimeout(o),a?.cancel()}},[e,t,n])},qn=`/api/features`,Jn=()=>{let[e,t]=(0,y.useState)({airplaneMode:!1});return(0,y.useEffect)(()=>{fetch(qn).then(async e=>{if(!e.ok)return;let n=await e.json();typeof n==`object`&&n&&!Array.isArray(n)&&`airplaneMode`in n&&typeof n.airplaneMode==`boolean`&&t({airplaneMode:n.airplaneMode})}).catch(e=>{console.warn(`Failed to fetch /api/features`,e)})},[]),e},Yn=(e,t)=>{let n=ae.findIndex(t=>t.name===e);if(n===-1)return null;for(let e=n+1;e<ae.length;e+=1){let n=ae[e].name;if((t[n]??0)>0)return n}return null},Xn=e=>{for(let t of ae)if((e[t.name]??0)>0)return t.name;return ae[0].name},Zn=new Set(ae.map(e=>e.name)),Qn=e=>{let t=e.split(`/`).filter(e=>e.length>0);if(t.length<3||t[0]!==`projects`)return null;let n=t[2];return Zn.has(n)?n:null},$n=e=>{if(!e.startsWith(`#item/`))return null;let t=e.slice(6);return t.length===0?null:decodeURIComponent(t)},er=`#settings`,tr=(e,t)=>{let n=(0,y.useCallback)(()=>{let e=Xn(t);return typeof window>`u`?{activeTab:e,selectedItemKey:null}:{activeTab:Qn(window.location.pathname)??e,selectedItemKey:$n(window.location.hash)}},[t]),[r,i]=(0,y.useState)(n);(0,y.useEffect)(()=>{if(typeof window>`u`)return;let e=()=>{i(n())};return window.addEventListener(`popstate`,e),window.addEventListener(`hashchange`,e),()=>{window.removeEventListener(`popstate`,e),window.removeEventListener(`hashchange`,e)}},[n]),(0,y.useEffect)(()=>{if(typeof window>`u`||Qn(window.location.pathname)!==null)return;let e=Xn(t);i(t=>t.activeTab===e?t:{...t,activeTab:e})},[t]);let a=(0,y.useCallback)(t=>e===null?`#${t}`:`/projects/${e}/${t}`,[e]),o=(0,y.useCallback)(e=>{if(typeof window>`u`){i({activeTab:e,selectedItemKey:null});return}window.history.pushState({},``,a(e)),i({activeTab:e,selectedItemKey:null})},[a]),s=(0,y.useCallback)(e=>{typeof window<`u`&&(window.location.hash=`#item/${encodeURIComponent(e)}`),i(t=>({...t,selectedItemKey:e}))},[]),c=(0,y.useCallback)(()=>{if(typeof window<`u`&&window.location.hash!==``){let e=`${window.location.pathname}${window.location.search}`;window.history.pushState({},``,e)}i(e=>({...e,selectedItemKey:null}))},[]);return{activeTab:r.activeTab,selectedItemKey:r.selectedItemKey,tabHref:a,selectTab:o,openItem:s,closeItem:c}},nr=e=>`pv_overlay_${e}`,rr=e=>e.projectItemId===``?e.itemId:e.projectItemId,ir=(e,t)=>e!==void 0&&e.done===!0&&e.mode===t,ar=(e,t,n)=>e.filter(e=>!ir(t[rr(e)],n)).length,or=(e,t,n)=>e.filter(e=>!ir(t[rr(e)],n)),sr=(e,t)=>{let n=Date.parse(t);if(Number.isNaN(n))return{};let r={};for(let[t,i]of Object.entries(e))i.ts>=n&&(r[t]=i);return r},cr=(e,t,n)=>{if(n===null)return null;let r=Date.parse(n);if(Number.isNaN(r))return null;let i=e[rr(t)];return i===void 0||i.ts<r?null:i.status??null},lr=(e,t,n,r,i)=>{let a={...e[t]??{},...n,ts:i,mode:r};return{...e,[t]:a}},ur=`/api/review`,dr=`/api/triage`,fr=`/api/intmux`,pr=(e,t,n,r,i)=>{if(r===`approve_and_merge`)return{pjcode:e,action:`approve_and_merge`,prUrl:n,projectItemId:t.projectItemId};if(r===`request_changes`){let r=i[0];return{pjcode:e,action:`request_changes`,prUrl:n,projectItemId:t.projectItemId,commentBody:ge(i),...r===void 0?{}:{changedFilePath:r.path,line:r.line,side:r.side}}}return r===`totally_wrong`?{pjcode:e,action:`close`,prUrl:n,issueUrl:t.url,projectItemId:t.projectItemId,commentBody:pe}:{pjcode:e,action:`unnecessary`,prUrl:n,projectItemId:t.projectItemId,issueUrl:t.url,commentBody:me,issueCommentBody:he(n)}},mr=(e,t,n,r)=>({pjcode:e,action:n,issueUrl:t.url,projectItemId:t.projectItemId,...r??{}}),hr=(e,t)=>({pjcode:e,action:`set_intmux`,issueUrl:t.url,projectItemId:t.projectItemId}),gr=()=>Error(`No project specified in the URL path.`),_r=`ok`,vr=(e,t,n,r,i)=>{let{patchOverlay:a}=n,o=(0,y.useCallback)(e=>{if(r===void 0)return;let t=`${e.repo}#${e.number}`;r.body.invalidate(t),r.comments.invalidate(t)},[r]),s=(0,y.useCallback)(e=>{a(rr(e),{done:!0},t)},[a,t]),c=(0,y.useCallback)(async(t,n,r,i=[])=>{if(e===null)throw gr();await Nt(ur,pr(e,t,n,r,i)),s(t),o(t)},[e,s,o]),l=(0,y.useCallback)(async(t,n)=>{if(e===null)throw gr();let r={pjcode:e,action:n,issueUrl:t.url,projectItemId:t.projectItemId};s(t),await Nt(dr,r),o(t)},[e,s,o]),u=(0,y.useCallback)(async(n,r)=>{if(e===null)throw gr();let i={pjcode:e,action:`set_agent`,issueUrl:n.url,projectItemId:n.projectItemId,agentOptionId:r.id};a(rr(n),{done:!0},t),await Nt(dr,i),o(n)},[e,o,a,t]);return{reviewPullRequest:c,setNextActionDate:l,setStory:(0,y.useCallback)(async(n,r)=>{if(e===null)throw gr();let i={pjcode:e,action:`set_story`,issueUrl:n.url,projectItemId:n.projectItemId,storyOptionId:r.id};a(rr(n),{done:!0,story:{name:r.name,color:r.color}},t),await Nt(dr,i),o(n)},[e,o,a,t]),setAgent:u,setStatus:(0,y.useCallback)(async(n,r)=>{if(e===null)throw gr();let i={pjcode:e,action:`set_status`,issueUrl:n.url,projectItemId:n.projectItemId,statusName:r.name};a(rr(n),{done:!0,status:{name:r.name,color:r.color}},t),await Nt(dr,i),o(n)},[e,o,a,t]),setInTmuxByHuman:(0,y.useCallback)(async(n,r)=>{if(e===null)throw gr();let i={pjcode:e,action:`set_intmux`,issueUrl:n.url,projectItemId:n.projectItemId};a(rr(n),{done:!0,status:{name:r.name,color:r.color}},t),await Nt(fr,i),o(n)},[e,o,a,t]),closeIssue:(0,y.useCallback)(async(t,n)=>{if(e===null)throw gr();let r={pjcode:e,action:n,issueUrl:t.url,projectItemId:t.projectItemId};s(t),await Nt(dr,r),o(t)},[e,s,o]),okAndMoveToAwaitingWorkspace:(0,y.useCallback)(async(n,r)=>{if(e===null)throw gr();a(rr(n),{done:!0,status:{name:r.name,color:r.color}},t);let s=await It({pjcode:e,url:n.url,body:_r});if(await Nt(dr,{pjcode:e,action:`set_status`,issueUrl:n.url,projectItemId:n.projectItemId,statusName:r.name}),o(n),await i?.(),!s.posted){let e=s.rateLimitResetAt===null?``:` Rate limit resets at ${s.rateLimitResetAt}.`;throw Error(`Comment not posted — ${s.error}.${e} Status was changed. Re-post: ${_r}`)}},[e,o,a,t,i]),addComment:(0,y.useCallback)(async(t,n)=>{if(e===null)throw gr();let r=await It({pjcode:e,url:t.url,body:n});if(!r.posted){let e=r.rateLimitResetAt===null?``:` Rate limit resets at ${r.rateLimitResetAt}.`;throw Error(`${r.error}.${e}`)}return o(t),r.comment},[e,o]),uploadAttachment:(0,y.useCallback)(async(t,n)=>{if(e===null)throw Error(`no project in the URL path`);let r=Rt(new Uint8Array(await n.arrayBuffer()));return zt({pjcode:e,url:t.url,fileName:n.name,contentBase64:r})},[e]),addInlineReviewComment:(0,y.useCallback)(async(t,n,r,i,a)=>{if(e===null)throw gr();await Ut({pjcode:e,url:t,path:n,line:r,side:i,body:a})},[e]),deleteAllComments:(0,y.useCallback)(async e=>{await Zt({issueUrl:e.url}),o(e)},[o]),setDependedIssueUrl:(0,y.useCallback)(async(t,n)=>{if(e===null)throw gr();await ln({pjcode:e,issueUrl:t.url,dependedIssueUrl:n})},[e])}},yr=e=>typeof e==`object`&&!!e&&typeof e.ts==`number`,br=e=>{if(typeof localStorage>`u`)return{};let t=localStorage.getItem(nr(e));if(t===null)return{};let n=JSON.parse(t);if(typeof n!=`object`||!n)return{};let r={};for(let[e,t]of Object.entries(n))yr(t)&&(r[e]=t);return r},xr=(e,t)=>{typeof localStorage<`u`&&localStorage.setItem(nr(e),JSON.stringify(t))},Sr=e=>{let[t,n]=(0,y.useState)(()=>br(e));return{overlay:t,patchOverlay:(0,y.useCallback)((t,r,i)=>{n(n=>{let a=lr(n,t,r,i,Date.now());return xr(e,a),a})},[e])}},Cr=e=>{let t=e.split(`/`).filter(e=>e.length>0);if(t.length<2||t[0]!==`projects`)return null;let n=t[1];return n.length===0?null:n},wr=()=>{let[e,t]=(0,y.useState)(()=>Cr(typeof window>`u`?``:window.location.pathname));return(0,y.useEffect)(()=>{let e=()=>{t(Cr(window.location.pathname))};return window.addEventListener(`popstate`,e),()=>{window.removeEventListener(`popstate`,e)}},[]),e},Tr=()=>{let[e,t]=(0,y.useState)([]),[n,r]=(0,y.useState)(null),[i,a]=(0,y.useState)(null),[o,s]=(0,y.useState)(null),[c,l]=(0,y.useState)(!0),[u,d]=(0,y.useState)(null);return(0,y.useEffect)(()=>{let e=!1;return l(!0),d(null),an().then(n=>{e||(t(n.pjcodes),r(n.projectUrls),a(n.workflowImprovementIssueUrl),s(n.fleetTaskCreateUrl),l(!1))}).catch(t=>{e||(d(t instanceof Error?t:Error(String(t))),l(!1))}),()=>{e=!0}},[]),{pjcodes:e,projectUrls:n,workflowImprovementIssueUrl:i,fleetTaskCreateUrl:o,isLoading:c,error:u}},Er=()=>typeof window<`u`&&window.location.hash===`#settings`,Dr=e=>{let[t,n]=(0,y.useState)(Er),[r,i]=(0,y.useState)(!1),[a,o]=(0,y.useState)(!1),[s,c]=(0,y.useState)(null),[l,u]=(0,y.useState)(``),d=(0,y.useRef)(``);(0,y.useEffect)(()=>{if(!t||e===null)return;let n=!1;return u(``),i(!0),c(null),sn(e).then(e=>{n||u(e.maximumPreparingIssuesCount===null?``:String(e.maximumPreparingIssuesCount))}).catch(e=>{n||c(e instanceof Error?e.message:`Failed to load settings`)}).finally(()=>{n||i(!1)}),()=>{n=!0}},[t,e]),(0,y.useEffect)(()=>{if(typeof window>`u`)return;let e=()=>{let e=window.location.hash===er;e||c(null),n(e)};return window.addEventListener(`popstate`,e),window.addEventListener(`hashchange`,e),()=>{window.removeEventListener(`popstate`,e),window.removeEventListener(`hashchange`,e)}},[]);let f=(0,y.useCallback)(()=>{e!==null&&(typeof window<`u`&&(d.current=window.location.hash,window.history.pushState({},``,er)),n(!0))},[e]),p=(0,y.useCallback)(()=>{if(typeof window<`u`){let e=d.current,t=`${window.location.pathname}${window.location.search}${e}`;window.history.replaceState({},``,t)}n(!1),c(null)},[]),m=(0,y.useCallback)(e=>{u(e)},[]),h=(0,y.useCallback)(async t=>{if(e!==null){o(!0),c(null);try{if(await dn({pjcode:e,maximumPreparingIssuesCount:t}),typeof window<`u`){let e=d.current,t=`${window.location.pathname}${window.location.search}${e}`;window.history.replaceState({},``,t)}n(!1)}catch(e){c(e instanceof Error?e.message:`Failed to save settings`)}finally{o(!1)}}},[e]);return(0,y.useEffect)(()=>{if(!t)return;let e=e=>{e.key===`Escape`&&p()};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[t,p]),{isOpen:t,isLoading:r,isSaving:a,error:s,inputValue:l,open:f,close:p,changeInput:m,save:h}},Or=e=>{let t=(0,y.useRef)(e),n=(0,y.useRef)(Date.now());return t.current!==e&&(t.current=e,n.current=Date.now()),{isTimerExpired:(0,y.useCallback)(e=>e<=0?!1:Date.now()-n.current>=e*60*1e3,[])}},kr=/##\s+(?:エグゼクティブサマリ(?:\s*\/\s*Executive\s+Summary)?|Executive\s+Summary)\s*\n/i,Ar=/^From:\s+:robot:/m,jr=/^##\s/m,Mr=e=>{let t=kr.exec(e);if(t===null)return null;let n=e.slice(t.index+t[0].length),r=Ar.exec(n),i=jr.exec(n),a=n.length;r!==null&&(a=Math.min(a,r.index)),i!==null&&(a=Math.min(a,i.index));let o=n.slice(0,a).trim();return o.length>0?o:null},Nr=e=>{if(e.length===0)return null;let t=e[e.length-1],n=Mr(t.body);if(n!==null)return n;let r=t.body.trim();return r.length>0?r:null},Pr=e=>`${e.repo}#${e.number}`,Fr=(e,t,n)=>{let[r,i]=(0,y.useState)({});return(0,y.useEffect)(()=>{if(!n)return;let r=!1;for(let n of e){let e=Pr(n),a=t.peek(e);if(a!==void 0){let e=Nr(a);r||i(t=>t[n.projectItemId]===e?t:{...t,[n.projectItemId]:e});continue}t.load(e,n.url).then(e=>{if(r)return;let t=Nr(e);i(e=>e[n.projectItemId]===t?e:{...e,[n.projectItemId]:t})}).catch(()=>{r||i(e=>e[n.projectItemId]===null?e:{...e,[n.projectItemId]:null})})}return()=>{r=!0}},[e,t,n]),r},Ir=(e,t)=>{let n=Math.abs(e);return n<60||n<=Math.abs(t)*1.5?null:e<0?`next`:`previous`},Lr=(e,t)=>{let n=Math.abs(e),r=Math.abs(t);return r>n*1.5&&r>20},Rr=e=>{let t=e instanceof Element?e:null;for(;t!==null&&t!==document.body;){let e=window.getComputedStyle(t).overflowX;if((e===`auto`||e===`scroll`)&&t.scrollWidth>t.clientWidth&&t.scrollLeft>0)return!0;t=t.parentElement}return!1},zr=e=>{let t=(0,y.useRef)(e);t.current=e;let n=(0,y.useRef)(null),r=(0,y.useCallback)(e=>{let n=0,r=0,i=!1,a=e=>{if(e.touches.length!==1){i=!1;return}if(Rr(e.target)){i=!1;return}let t=e.touches[0];n=t.clientX,r=t.clientY,i=!0},o=e=>{if(!i)return;let t=e.touches[0];Lr(t.clientX-n,t.clientY-r)&&(i=!1)},s=e=>{if(!i||(i=!1,e.changedTouches.length!==1))return;let a=e.changedTouches[0],o=Ir(a.clientX-n,a.clientY-r);o!==null&&t.current(o)};return e.addEventListener(`touchstart`,a,{passive:!0}),e.addEventListener(`touchmove`,o,{passive:!0}),e.addEventListener(`touchend`,s,{passive:!0}),()=>{e.removeEventListener(`touchstart`,a),e.removeEventListener(`touchmove`,o),e.removeEventListener(`touchend`,s)}},[]),i=(0,y.useCallback)(e=>{n.current!==null&&(n.current(),n.current=null),e!==null&&(n.current=r(e))},[r]);return(0,y.useEffect)(()=>()=>{n.current!==null&&(n.current(),n.current=null)},[]),i},Br=e=>typeof e==`object`&&!!e&&!Array.isArray(e),Vr=e=>Array.isArray(e)?e.filter(e=>typeof e==`string`):[],Hr=e=>Array.isArray(e)?e.filter(Br).map(e=>({...e,relatedOpenPullRequestUrls:Vr(e.relatedOpenPullRequestUrls)})):[],Ur=e=>!Br(e)||!Array.isArray(e.items)?[]:Hr(e.items),Wr=e=>Array.isArray(e)?e.filter(Br):[],Gr=e=>Array.isArray(e)?e.filter(Br).map(e=>({...e,items:Hr(e.items)})):[],Kr=e=>({items:Ur(e),generatedAt:Br(e)&&typeof e.generatedAt==`string`?e.generatedAt:``,statusOptions:Br(e)?Wr(e.statusOptions):[],agentOptions:Br(e)?Wr(e.agentOptions):[],storyOptions:Br(e)?Wr(e.storyOptions):[],storyColors:Br(e)&&Br(e.storyColors)?e.storyColors:{},stories:Br(e)?Gr(e.stories):[],defaultNameWithOwner:Br(e)&&typeof e.defaultNameWithOwner==`string`?e.defaultNameWithOwner:null,storyOrder:Br(e)?Vr(e.storyOrder):[],timerEndsAt:Br(e)&&typeof e.timerEndsAt==`string`?e.timerEndsAt:null,timerTotalSeconds:Br(e)&&typeof e.timerTotalSeconds==`number`&&e.timerTotalSeconds>0?e.timerTotalSeconds:null}),qr=()=>{let e={};for(let t of ae)e[t.name]=null;return e},Jr=(e,t)=>`/projects/${e}/${t}/list.json`,Yr=6e4,Xr=`console-list-v1`,Zr=(e,t)=>{try{if(!(`caches`in globalThis))return;globalThis.caches.open(Xr).then(n=>n.put(e,new Response(JSON.stringify(t),{headers:{"Content-Type":`application/json`}}))).catch(e=>{console.warn(`Failed to persist tab snapshot to cache:`,e)})}catch(e){console.warn(`Failed to access cache storage:`,e)}},Qr=async e=>{if(!(`caches`in globalThis))return null;try{let t=await(await globalThis.caches.open(Xr)).match(e);return t===void 0?null:{...Kr(await t.json()),fromCache:!0}}catch{return null}},$r=async(e,t)=>{let n=Jr(e,t);try{let e=await fetch(n);if(!e.ok)throw Error(`HTTP ${e.status}`);let t=await e.json();return Zr(n,t),{snapshot:{...Kr(t),fromCache:!1},error:null}}catch(e){let t=await Qr(n);return t===null?{snapshot:null,error:e instanceof Error?e:Error(String(e))}:{snapshot:t,error:null}}},ei=async e=>{let t=await Promise.all(ae.map(async t=>{let{snapshot:n,error:r}=await $r(e,t.name);return{tabName:t.name,snapshot:n,error:r}})),n=qr(),r=null;for(let{tabName:e,snapshot:i,error:a}of t)n[e]=i,a!==null&&r===null&&(r=a);return{snapshots:n,firstError:Object.values(n).every(e=>e===null)?r:null}},ti=(e,t=null)=>{let[n,r]=(0,y.useState)(qr),[i,a]=(0,y.useState)(!0),[o,s]=(0,y.useState)(null);return(0,y.useEffect)(()=>{if(t!==null&&e!==null){let n=t.tabs[e];if(n!==void 0){let e=qr();for(let t of ae){let r=n[t.name];r!==void 0&&(e[t.name]={...r})}r(e),a(!1),s(null);return}}let n=!1;if(a(!0),s(null),r(qr()),e===null)return r(qr()),a(!1),s(`No project specified in the URL path.`),()=>{n=!0};let i=()=>{ei(e).then(({snapshots:e,firstError:t})=>{n||(r(e),s(t===null?null:t.message),a(!1))}).catch(e=>{n||(s(e instanceof Error?e.message:String(e)),a(!1))})};i();let o=setInterval(i,Yr);return()=>{n=!0,clearInterval(o)}},[e,t]),{snapshots:n,isLoading:i,error:o,refreshSingleTab:(0,y.useCallback)(async t=>{if(e===null)return;let{snapshot:n}=await $r(e,t);n!==null&&r(e=>({...e,[t]:n}))},[e])}},ni=`console-comment-expanded:`,ri=e=>{try{let t=localStorage.getItem(ni+e);if(t===null)return new Set;let n=JSON.parse(t);return Array.isArray(n)?new Set(n.filter(e=>typeof e==`string`)):new Set}catch(e){return console.error(`Failed to load comment expanded state from storage:`,e),new Set}},ii=(e,t)=>{try{localStorage.setItem(ni+e,JSON.stringify([...t]))}catch(e){console.error(`Failed to save comment expanded state to storage:`,e)}},ai=()=>{let e=[];for(let t=0;t<localStorage.length;t++){let n=localStorage.key(t);n?.startsWith(ni)&&e.push(n)}for(let t of e)localStorage.removeItem(t)},oi=e=>(0,y.useCallback)(t=>{ai(),e(t)},[e]),si=()=>{let[e,t]=(0,y.useState)(Nn),[n,r]=(0,y.useState)(!1),[i,a]=(0,y.useState)(e),o=(0,y.useCallback)(()=>{t(e=>(a(e),e)),r(!0)},[]),s=(0,y.useCallback)(()=>{r(!1)},[]),c=(0,y.useCallback)(()=>{a(e=>(Pn(e),t(e),e)),r(!1)},[]),l=(0,y.useCallback)(e=>{a(t=>({...t,timerMode:e}))},[]),u=(0,y.useCallback)((e,t)=>{a(n=>({...n,projectMinutes:{...n.projectMinutes,[e]:t}}))},[]);return{timerMode:e.timerMode,projectMinutes:e.projectMinutes,isOpen:n,draftTimerMode:i.timerMode,draftProjectMinutes:i.projectMinutes,openSettings:o,closeSettings:s,saveSettings:c,toggleDraftTimerMode:l,changeDraftMinutes:u}},ci=(e,t)=>{let n=e.indexOf(t);if(n<0)return e.length>0?e[0]:null;let r=n+1;return r<e.length?e[r]:null},li=(e,t)=>{let n=e.indexOf(t);return n<0||n>=e.length-1?null:e[n+1]},ui=(e,t)=>{let n=e.indexOf(t);return n<=0?null:e[n-1]},di=(e,t)=>e.length===0?`${t}\n`:e.endsWith(`
|
|
13
|
+
`);i=c.pop()??``;for(let e of c){if(!e.startsWith(`data: `))continue;let n=gt(e.slice(6));if(n!==null){if(n.type===`progress`)r({fetched:typeof n.fetched==`number`?n.fetched:0,total:typeof n.total==`number`?n.total:0});else if(n.type===`done`){let e=mt(n.snapshot);if(e===null){t(`error`),s([`Failed to parse snapshot`]);return}if(e.failures.length>0){s(e.failures),t(`error`);return}await $e(e),Qe(!0),a(e),t(`on`),s([])}}}}}).catch(e=>{e instanceof Error&&e.name===`AbortError`||(t(`error`),s([e instanceof Error?e.message:String(e)]))})},[]),turnOff:(0,y.useCallback)(()=>{c.current!==null&&(c.current.abort(),c.current=null),t(`off`),a(null),r(null),s([]),Qe(!1),tt().catch(()=>{})},[])}},z=e=>typeof e==`object`&&!!e&&!Array.isArray(e),B=e=>typeof e==`string`?e:``,vt=e=>typeof e==`number`?e:0,yt=e=>e===!0,bt=`console-api-v1`,xt=async(e,t)=>{let n=`${e}?url=${encodeURIComponent(t)}`;try{let e=await fetch(n);if(!e.ok){let t=`HTTP ${e.status}`;try{let n=await e.json();z(n)&&typeof n.error==`string`&&n.error.length>0&&(t=n.error)}catch(e){console.warn(`Failed to parse error body from non-ok response:`,e)}throw Error(t)}let t=await e.json();try{`caches`in globalThis&&globalThis.caches.open(bt).then(e=>e.put(n,new Response(JSON.stringify(t),{headers:{"Content-Type":`application/json`}}))).catch(e=>{console.warn(`Failed to persist API response to cache:`,e)})}catch(e){console.warn(`Failed to access cache storage:`,e)}return t}catch(e){try{if(`caches`in globalThis){let e=await(await globalThis.caches.open(bt)).match(n);if(e!==void 0)return e.json()}}catch{}throw e}},St=e=>!z(e)||!Array.isArray(e.comments)?[]:e.comments.filter(z).map(e=>({author:B(e.author),body:B(e.body),createdAt:B(e.createdAt),url:typeof e.url==`string`?e.url:null})),Ct=e=>!z(e)||!Array.isArray(e.files)?[]:e.files.filter(z).map(e=>({path:B(e.path)||B(e.filename),additions:vt(e.additions),deletions:vt(e.deletions),status:B(e.status),patch:typeof e.patch==`string`?e.patch:null,rawUrl:typeof e.rawUrl==`string`?e.rawUrl:null})),wt=e=>!z(e)||!Array.isArray(e.commits)?[]:e.commits.filter(z).map(e=>({sha:B(e.sha),message:B(e.message),author:B(e.author),authoredAt:B(e.authoredAt)})),Tt=e=>z(e)?{title:B(e.title),body:B(e.body),additions:vt(e.additions),deletions:vt(e.deletions),changedFiles:vt(e.changedFiles)}:null,Et=e=>Array.isArray(e)?e.filter(e=>typeof e==`string`):[],Dt=e=>e===`MERGEABLE`?`MERGEABLE`:e===`CONFLICTING`?`CONFLICTING`:`UNKNOWN`,Ot=e=>!z(e)||!Array.isArray(e.relatedPullRequests)?[]:e.relatedPullRequests.filter(z).map(e=>({url:B(e.url),branchName:typeof e.branchName==`string`?e.branchName:null,createdAt:B(e.createdAt),isDraft:yt(e.isDraft),isConflicted:yt(e.isConflicted),mergeableStatus:Dt(e.mergeableStatus),isPassedAllCiJob:yt(e.isPassedAllCiJob),isCiStateSuccess:yt(e.isCiStateSuccess),isResolvedAllReviewComments:yt(e.isResolvedAllReviewComments),isBranchOutOfDate:yt(e.isBranchOutOfDate),missingRequiredCheckNames:Et(e.missingRequiredCheckNames),summary:Tt(e.summary)})),kt=e=>{if(!z(e)||!z(e.status))return{found:!1,isConflicted:!1,mergeableStatus:`UNKNOWN`,isPassedAllCiJob:!1,isCiStateSuccess:!1,isBranchOutOfDate:!1,missingRequiredCheckNames:[]};let t=e.status;return{found:!0,isConflicted:yt(t.isConflicted),mergeableStatus:Dt(t.mergeableStatus),isPassedAllCiJob:yt(t.isPassedAllCiJob),isCiStateSuccess:yt(t.isCiStateSuccess),isBranchOutOfDate:yt(t.isBranchOutOfDate),missingRequiredCheckNames:Et(t.missingRequiredCheckNames)}},At=e=>z(e)?{state:B(e.state)||`open`,merged:yt(e.merged),isPullRequest:yt(e.isPullRequest),title:B(e.title)}:{state:`open`,merged:!1,isPullRequest:!1,title:``},jt=()=>({fetchItemBody:async e=>{let t=await xt(`/api/itembody`,e);return z(t)?B(t.body):``},fetchComments:async e=>St(await xt(`/api/comments`,e)),fetchPrFiles:async e=>Ct(await xt(`/api/prfiles`,e)),fetchPrCommits:async e=>wt(await xt(`/api/prcommits`,e)),fetchRelatedPrs:async e=>Ot(await xt(`/api/relatedprs`,e)),fetchIssueState:async e=>At(await xt(`/api/issuetitle`,e)),fetchPullRequestStatus:async e=>kt(await xt(`/api/pullrequeststatus`,e))}),Mt=async e=>{let t=await e.text().catch(()=>``);if(t.length===0)return`HTTP ${e.status}`;try{let e=JSON.parse(t);if(z(e)&&typeof e.error==`string`)return e.error}catch{return t}return t},Nt=async(e,t)=>{let n=await fetch(e,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(t)});if(!n.ok)throw Error(await Mt(n))},Pt=`/api/comment`,Ft=e=>({author:B(e.author),body:B(e.body),createdAt:B(e.createdAt),url:typeof e.url==`string`?e.url:null}),It=async e=>{let t=await fetch(Pt,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)});if(!t.ok)return{posted:!1,error:await Mt(t),rateLimitResetAt:null};let n=await t.json();return z(n)?n.ok===!1?{posted:!1,error:typeof n.error==`string`?n.error:`upstream error`,rateLimitResetAt:typeof n.rateLimitResetAt==`string`?n.rateLimitResetAt:null}:z(n.comment)?{posted:!0,comment:Ft(n.comment)}:{posted:!1,error:`comment was not returned`,rateLimitResetAt:null}:{posted:!1,error:`unexpected response shape`,rateLimitResetAt:null}},Lt=`/api/upload`,Rt=e=>{let t=``;for(let n of e)t+=String.fromCharCode(n);return btoa(t)},zt=async e=>{let t=await fetch(Lt,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)});if(!t.ok)throw Error(await Mt(t));let n=await t.json();if(!z(n)||typeof n.markdown!=`string`)throw Error(`markdown was not returned`);return n.markdown},Bt=`/api/addstory`,Vt=async e=>{let t=await fetch(Bt,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)});if(!t.ok)throw Error(await Mt(t))},Ht=`/api/reviewcomment`,Ut=async e=>{let t=await fetch(Ht,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)});if(!t.ok)throw Error(await Mt(t))},Wt=`/api/createissue`,Gt=`/api/storycolor`,Kt=async e=>{let t=await fetch(Gt,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)});if(!t.ok)throw Error(await Mt(t))},qt=async e=>{let t=await fetch(Wt,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)});if(!t.ok)throw Error(await Mt(t));let n=await t.json();if(!(e=>typeof e==`object`&&!!e&&!Array.isArray(e))(n)||typeof n.issueUrl!=`string`)throw Error(`issueUrl was not returned`);return n.issueUrl},Jt=`/api/reorderstory`,Yt=async e=>{let t=await fetch(Jt,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)});if(!t.ok)throw Error(await Mt(t))},Xt=`/api/deleteallcomments`,Zt=async e=>{let t=await fetch(Xt,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)});if(!t.ok)throw Error(await Mt(t))},Qt=`/api/deletestory`,$t=async e=>{let t=await fetch(Qt,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)});if(!t.ok)throw Error(await Mt(t))},en=`/api/renamestory`,tn=async e=>{let t=await fetch(en,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)});if(!t.ok)throw Error(await Mt(t))},nn=`/api/storydescription`,rn=async e=>{let t=await fetch(nn,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)});if(!t.ok)throw Error(await Mt(t))},an=async()=>{let e=await fetch(`/api/projects`);if(!e.ok)throw Error(`HTTP ${e.status}`);let t=await e.json();if(typeof t!=`object`||!t||Array.isArray(t))return{pjcodes:[],projectUrls:null,workflowImprovementIssueUrl:null,fleetTaskCreateUrl:null};let n=t;return{pjcodes:Array.isArray(n.pjcodes)?n.pjcodes.filter(e=>typeof e==`string`):[],projectUrls:n.projectUrls!==null&&typeof n.projectUrls==`object`&&!Array.isArray(n.projectUrls)?Object.fromEntries(Object.entries(n.projectUrls).filter(e=>typeof e[1]==`string`)):null,workflowImprovementIssueUrl:typeof n.workflowImprovementIssueUrl==`string`?n.workflowImprovementIssueUrl:null,fleetTaskCreateUrl:typeof n.fleetTaskCreateUrl==`string`?n.fleetTaskCreateUrl:null}},on=`/api/projectreadmeconfig`,sn=async e=>{let t=`${on}?pjcode=${encodeURIComponent(e)}`,n=await fetch(t);if(!n.ok)throw Error(await Mt(n));let r=await n.json();return{maximumPreparingIssuesCount:z(r)&&typeof r.maximumPreparingIssuesCount==`number`?r.maximumPreparingIssuesCount:null}},cn=`/api/setdependedissueurl`,ln=async e=>{let t=await fetch(cn,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)});if(!t.ok)throw Error(await Mt(t))},un=`/api/projectsettings`,dn=async e=>{let t=await fetch(un,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)});if(!t.ok)throw Error(await Mt(t))},fn=5e3,pn=e=>`${e.isPr?`PR #`:`#`}${e.number}`,mn=(e,t)=>{switch(e.type){case`review`:return e.action===`approve_and_merge`?`Approved & Merged`:e.action===`request_changes`?`Rejected`:e.action===`totally_wrong`?`Marked totally wrong`:`Marked unnecessary`;case`next_action_date`:return e.action===`snooze_1hour`?`Next Action Hour +1 hour`:e.action===`snooze_3hours`?`Next Action Hour +3 hours`:e.action===`snooze_6hours`?`Next Action Hour +6 hours`:e.action===`snooze_1day`?`Next Action Date +1 day`:e.action===`snooze_2days`?`Next Action Date +2 days`:e.action===`snooze_3days`?`Next Action Date +3 days`:e.action===`snooze_5days`?`Next Action Date +5 days`:e.action===`snooze_1month`?`Next Action Date +1 month`:be(t)?`Next Action Date +1 week and skip`:`Next Action Date +1 week`;case`set_story`:return`Story → ${e.optionName}`;case`set_agent`:return`Agent → ${e.optionName}`;case`set_status`:return`Status → ${e.optionName}`;case`set_in_tmux_by_human`:return`Added to In Tmux by human`;case`ok_and_awaiting_workspace`:return`ok → Awaiting Workspace`;case`close`:return e.action===`close`?`Closed`:`Closed as not planned`;case`delete_all_comments`:return`Deleted all comments`}},hn=e=>{switch(e.type){case`review`:return e.action===`approve_and_merge`?`green`:e.action===`request_changes`?`amber`:e.action===`totally_wrong`?`red`:`gray`;case`next_action_date`:return`amber`;case`set_story`:case`set_agent`:case`set_status`:case`set_in_tmux_by_human`:case`ok_and_awaiting_workspace`:return`blue`;case`close`:return`red`;case`delete_all_comments`:return`red`}},gn=(e,t)=>e.type===`next_action_date`?be(t):e.type!==`delete_all_comments`,_n=(e,t,n)=>`${mn(e,n)} — ${pn(t)}`,vn=`console-offline-action-queue`,yn=e=>{if(typeof e!=`object`||!e)return!1;let t=e;return typeof t.id==`string`&&typeof t.message==`string`&&typeof t.color==`string`&&typeof t.enqueuedAt==`number`&&typeof t.itemUrl==`string`&&typeof t.projectItemId==`string`&&typeof t.itemNumber==`number`&&typeof t.repo==`string`&&typeof t.isPr==`boolean`&&typeof t.apiPath==`string`&&typeof t.requestBody==`object`&&t.requestBody!==null},bn=()=>{try{let e=localStorage.getItem(vn);if(e===null)return[];let t=JSON.parse(e);return Array.isArray(t)?t.filter(yn):[]}catch{return[]}},xn=e=>{localStorage.setItem(vn,JSON.stringify(e))},Sn=()=>typeof crypto<`u`&&typeof crypto.randomUUID==`function`?crypto.randomUUID():`${Date.now().toString(36)}-${Math.random().toString(36).slice(2)}-${Math.random().toString(36).slice(2)}`,Cn=e=>e instanceof TypeError,wn=e=>e instanceof Error&&e.message.length>0?e.message:String(e),Tn=100,En=e=>Math.max(0,Math.ceil((fn-e)/1e3)),Dn=e=>Math.max(0,1-e/fn),On=()=>{let[e,t]=(0,y.useState)(null),[n,r]=(0,y.useState)(null),[i,a]=(0,y.useState)(bn),o=(0,y.useRef)(i);o.current=i;let s=(0,y.useRef)(null),c=(0,y.useRef)(0),l=(0,y.useRef)(null),u=(0,y.useRef)(!1),d=(0,y.useCallback)(()=>{l.current!==null&&(clearInterval(l.current),l.current=null)},[]),f=(0,y.useCallback)(e=>{if(e.offline===void 0)return;let t={id:Sn(),message:e.message,color:e.color,enqueuedAt:Date.now(),...e.offline};a(e=>{let n=[...e,t];return xn(n),n})},[]),p=(0,y.useCallback)(e=>{e.commit().catch(t=>{Cn(t)&&e.offline!==void 0?f(e):r({message:e.message,reason:wn(t)})})},[f]),m=(0,y.useCallback)(()=>{let e=s.current;d(),s.current=null,t(null),e!==null&&!u.current&&(u.current=!0,p(e))},[d,p]),h=(0,y.useCallback)(()=>{let e=s.current;d(),s.current=null,u.current=!0,t(null),e?.revertAdvance?.()},[d]),g=(0,y.useCallback)(()=>{r(null)},[]),_=(0,y.useCallback)((e,t)=>{r({message:e,reason:t})},[]),v=(0,y.useCallback)(e=>{a(t=>{let n=t.filter(t=>t.id!==e);return xn(n),n})},[]),b=(0,y.useCallback)(async e=>{let t=o.current.find(t=>t.id===e);if(t!==void 0)try{await Nt(t.apiPath,t.requestBody),v(e)}catch(n){Cn(n)?r({message:t.message,reason:`Still offline — action is still held in the queue`}):(r({message:t.message,reason:wn(n)}),v(e))}},[v]),x=(0,y.useCallback)(e=>{if(s.current!==null&&!u.current){let e=s.current;d(),u.current=!0,p(e)}u.current=!1,s.current=e,c.current=Date.now(),t({message:e.message,color:e.color,remainingSeconds:En(0),progress:Dn(0)}),e.advance(),l.current=setInterval(()=>{let n=Date.now()-c.current;if(n>=5e3){m();return}t({message:e.message,color:e.color,remainingSeconds:En(n),progress:Dn(n)})},Tn)},[d,m,p]);return(0,y.useEffect)(()=>d,[d]),{pending:e,error:n,offlineActions:i,enqueue:x,showError:_,undo:h,dismissError:g,confirmOfflineAction:b,discardOfflineAction:v}},kn=e=>{window.history.pushState({},``,e),window.dispatchEvent(new PopStateEvent(`popstate`))},An=e=>{window.history.replaceState({},``,e),window.dispatchEvent(new PopStateEvent(`popstate`))},jn=`tdpm-timer-settings`,Mn=()=>({timerMode:!1,projectMinutes:{}}),Nn=()=>{if(typeof localStorage>`u`)return Mn();let e=localStorage.getItem(jn);if(e===null)return Mn();try{let t=JSON.parse(e);if(typeof t!=`object`||!t||Array.isArray(t))return Mn();let n=t,r=typeof n.timerMode==`boolean`&&n.timerMode,i=n.projectMinutes;return{timerMode:r,projectMinutes:typeof i==`object`&&i&&!Array.isArray(i)?Object.fromEntries(Object.entries(i).filter(([,e])=>typeof e==`number`).map(([e,t])=>[e,t])):{}}}catch{return Mn()}},Pn=e=>{typeof localStorage<`u`&&localStorage.setItem(jn,JSON.stringify(e))},Fn=(e,t,n)=>{if(e.length===0)return null;let r=t===null?-1:e.indexOf(t),i=r===-1?0:(r+1)%e.length,a=r===-1?e.length:e.length-1;for(let t=0;t<a;t++){let r=e[(i+t)%e.length];if((n[r]??0)>0)return r}return null},In=(e,t,n,r,i)=>{let a=(0,y.useRef)(t),o=(0,y.useRef)(n);(0,y.useEffect)(()=>{let s=a.current,c=o.current;if(a.current=t,o.current=n,e){if(c!==n){a.current=0;return}if(s>0&&t===0){let e=Fn(r,n,i);e!==null&&kn(`/projects/${e}`)}}},[e,t,n,r,i])},Ln=class{fetcher;cache=new Map;inFlight=new Map;prefetchInFlight=new Set;constructor(e){this.fetcher=e}peek=e=>this.cache.get(e);has=e=>this.cache.has(e);load=(e,t)=>{let n=this.cache.get(e);if(n!==void 0)return Promise.resolve(n);let r=this.inFlight.get(e);if(r!==void 0)return r;let i=this.fetcher(t).then(t=>(this.cache.set(e,t),t)).finally(()=>{this.inFlight.delete(e)});return this.inFlight.set(e,i),i};prefetch=(e,t)=>{this.cache.has(e)||this.inFlight.has(e)||this.prefetchInFlight.has(e)||(this.prefetchInFlight.add(e),this.fetcher(t).then(t=>{this.cache.set(e,t)}).catch(()=>{}).finally(()=>{this.prefetchInFlight.delete(e)}))};seed(e,t){this.cache.set(e,t)}invalidate=e=>{this.cache.delete(e)}},Rn=e=>{try{let t=new URL(e).pathname.split(`/`).filter(Boolean);if(t.length>=4)return`${t[0]}/${t[1]}#${t[3]}`}catch{}return e},zn=(e,t)=>{for(let[n,r]of Object.entries(t.items)){let t=Rn(n);e.body.seed(t,r.body),e.comments.seed(t,r.comments),e.state.seed(t,r.state),r.files!==null&&e.files.seed(t,r.files),r.commits!==null&&e.commits.seed(t,r.commits),r.prStatus!==null&&e.prStatus.seed(t,r.prStatus),r.relatedPrs!==null&&e.relatedPrs.seed(t,r.relatedPrs)}},Bn=(e=null)=>(0,y.useMemo)(()=>{let t=jt(),n={client:t,body:new Ln(t.fetchItemBody),comments:new Ln(t.fetchComments),files:new Ln(t.fetchPrFiles),commits:new Ln(t.fetchPrCommits),relatedPrs:new Ln(t.fetchRelatedPrs),state:new Ln(t.fetchIssueState),prStatus:new Ln(t.fetchPullRequestStatus)};return e!==null&&zn(n,e),n},[e]),Vn=0,Hn=500,Un=2e3,Wn=e=>{let t=window;if(typeof t.requestIdleCallback==`function`&&typeof t.cancelIdleCallback==`function`){let n=t.requestIdleCallback(e,{timeout:Un});return{cancel:()=>t.cancelIdleCallback?.(n)}}let n=window.setTimeout(e,0);return{cancel:()=>window.clearTimeout(n)}},Gn=(e,t)=>{let n=`${t.repo}#${t.number}`;e.body.prefetch(n,t.url),e.state.prefetch(n,t.url),e.comments.prefetch(n,t.url),t.isPr?(e.files.prefetch(n,t.url),e.commits.prefetch(n,t.url),e.prStatus.prefetch(n,t.url)):e.relatedPrs.prefetch(n,t.url)},Kn=(e,t,n)=>{(0,y.useEffect)(()=>{if(t===null)return;let r=n.findIndex(e=>e.projectItemId===t.projectItemId);if(r===-1)return;let i=n.slice(r+1,r+1+Vn);if(i.length===0)return;let a=null,o=window.setTimeout(()=>{a=Wn(()=>{for(let t of i)Gn(e,t)})},Hn);return()=>{window.clearTimeout(o),a?.cancel()}},[e,t,n])},qn=`/api/features`,Jn=()=>{let[e,t]=(0,y.useState)({airplaneMode:!1});return(0,y.useEffect)(()=>{fetch(qn).then(async e=>{if(!e.ok)return;let n=await e.json();typeof n==`object`&&n&&!Array.isArray(n)&&`airplaneMode`in n&&typeof n.airplaneMode==`boolean`&&t({airplaneMode:n.airplaneMode})}).catch(e=>{console.warn(`Failed to fetch /api/features`,e)})},[]),e},Yn=(e,t)=>{let n=ae.findIndex(t=>t.name===e);if(n===-1)return null;for(let e=n+1;e<ae.length;e+=1){let n=ae[e].name;if((t[n]??0)>0)return n}return null},Xn=e=>{for(let t of ae)if((e[t.name]??0)>0)return t.name;return ae[0].name},Zn=new Set(ae.map(e=>e.name)),Qn=e=>{let t=e.split(`/`).filter(e=>e.length>0);if(t.length<3||t[0]!==`projects`)return null;let n=t[2];return Zn.has(n)?n:null},$n=e=>{if(!e.startsWith(`#item/`))return null;let t=e.slice(6);return t.length===0?null:decodeURIComponent(t)},er=`#settings`,tr=(e,t)=>{let n=(0,y.useCallback)(()=>{let e=Xn(t);return typeof window>`u`?{activeTab:e,selectedItemKey:null}:{activeTab:Qn(window.location.pathname)??e,selectedItemKey:$n(window.location.hash)}},[t]),[r,i]=(0,y.useState)(n);(0,y.useEffect)(()=>{if(typeof window>`u`)return;let e=()=>{i(n())};return window.addEventListener(`popstate`,e),window.addEventListener(`hashchange`,e),()=>{window.removeEventListener(`popstate`,e),window.removeEventListener(`hashchange`,e)}},[n]),(0,y.useEffect)(()=>{if(typeof window>`u`||Qn(window.location.pathname)!==null)return;let e=Xn(t);i(t=>t.activeTab===e?t:{...t,activeTab:e})},[t]);let a=(0,y.useCallback)(t=>e===null?`#${t}`:`/projects/${e}/${t}`,[e]),o=(0,y.useCallback)(e=>{if(typeof window>`u`){i({activeTab:e,selectedItemKey:null});return}window.history.pushState({},``,a(e)),i({activeTab:e,selectedItemKey:null})},[a]),s=(0,y.useCallback)(e=>{typeof window<`u`&&(window.location.hash=`#item/${encodeURIComponent(e)}`),i(t=>({...t,selectedItemKey:e}))},[]),c=(0,y.useCallback)(()=>{if(typeof window<`u`&&window.location.hash!==``){let e=`${window.location.pathname}${window.location.search}`;window.history.pushState({},``,e)}i(e=>({...e,selectedItemKey:null}))},[]);return{activeTab:r.activeTab,selectedItemKey:r.selectedItemKey,tabHref:a,selectTab:o,openItem:s,closeItem:c}},nr=e=>`pv_overlay_${e}`,rr=e=>e.projectItemId===``?e.itemId:e.projectItemId,ir=(e,t)=>e!==void 0&&e.done===!0&&e.mode===t,ar=(e,t,n)=>e.filter(e=>!ir(t[rr(e)],n)).length,or=(e,t,n)=>e.filter(e=>!ir(t[rr(e)],n)),sr=(e,t)=>{let n=Date.parse(t);if(Number.isNaN(n))return{};let r={};for(let[t,i]of Object.entries(e))i.ts>=n&&(r[t]=i);return r},cr=(e,t,n)=>{if(n===null)return null;let r=Date.parse(n);if(Number.isNaN(r))return null;let i=e[rr(t)];return i===void 0||i.ts<r?null:i.status??null},lr=(e,t,n,r,i)=>{let a={...e[t]??{},...n,ts:i,mode:r};return{...e,[t]:a}},ur=`/api/review`,dr=`/api/triage`,fr=`/api/intmux`,pr=(e,t,n,r,i)=>{if(r===`approve_and_merge`)return{pjcode:e,action:`approve_and_merge`,prUrl:n,projectItemId:t.projectItemId};if(r===`request_changes`){let r=i[0];return{pjcode:e,action:`request_changes`,prUrl:n,projectItemId:t.projectItemId,commentBody:ge(i),...r===void 0?{}:{changedFilePath:r.path,line:r.line,side:r.side}}}return r===`totally_wrong`?{pjcode:e,action:`close`,prUrl:n,issueUrl:t.url,projectItemId:t.projectItemId,commentBody:pe}:{pjcode:e,action:`unnecessary`,prUrl:n,projectItemId:t.projectItemId,issueUrl:t.url,commentBody:me,issueCommentBody:he(n)}},mr=(e,t,n,r)=>({pjcode:e,action:n,issueUrl:t.url,projectItemId:t.projectItemId,...r??{}}),hr=(e,t)=>({pjcode:e,action:`set_intmux`,issueUrl:t.url,projectItemId:t.projectItemId}),gr=()=>Error(`No project specified in the URL path.`),_r=`ok`,vr=(e,t,n,r,i)=>{let{patchOverlay:a}=n,o=(0,y.useCallback)(e=>{if(r===void 0)return;let t=`${e.repo}#${e.number}`;r.body.invalidate(t),r.comments.invalidate(t)},[r]),s=(0,y.useCallback)(e=>{a(rr(e),{done:!0},t)},[a,t]),c=(0,y.useCallback)(async(t,n,r,i=[])=>{if(e===null)throw gr();await Nt(ur,pr(e,t,n,r,i)),s(t),o(t)},[e,s,o]),l=(0,y.useCallback)(async(t,n)=>{if(e===null)throw gr();let r={pjcode:e,action:n,issueUrl:t.url,projectItemId:t.projectItemId};s(t),await Nt(dr,r),o(t)},[e,s,o]),u=(0,y.useCallback)(async(n,r)=>{if(e===null)throw gr();let i={pjcode:e,action:`set_agent`,issueUrl:n.url,projectItemId:n.projectItemId,agentOptionId:r.id};a(rr(n),{done:!0},t),await Nt(dr,i),o(n)},[e,o,a,t]);return{reviewPullRequest:c,setNextActionDate:l,setStory:(0,y.useCallback)(async(n,r)=>{if(e===null)throw gr();let i={pjcode:e,action:`set_story`,issueUrl:n.url,projectItemId:n.projectItemId,storyOptionId:r.id};a(rr(n),{done:!0,story:{name:r.name,color:r.color}},t),await Nt(dr,i),o(n)},[e,o,a,t]),setAgent:u,setStatus:(0,y.useCallback)(async(n,r)=>{if(e===null)throw gr();let i={pjcode:e,action:`set_status`,issueUrl:n.url,projectItemId:n.projectItemId,statusName:r.name};a(rr(n),{done:!0,status:{name:r.name,color:r.color}},t),await Nt(dr,i),o(n)},[e,o,a,t]),setInTmuxByHuman:(0,y.useCallback)(async(n,r)=>{if(e===null)throw gr();let i={pjcode:e,action:`set_intmux`,issueUrl:n.url,projectItemId:n.projectItemId};a(rr(n),{done:!0,status:{name:r.name,color:r.color}},t),await Nt(fr,i),o(n)},[e,o,a,t]),closeIssue:(0,y.useCallback)(async(t,n)=>{if(e===null)throw gr();let r={pjcode:e,action:n,issueUrl:t.url,projectItemId:t.projectItemId};s(t),await Nt(dr,r),o(t)},[e,s,o]),okAndMoveToAwaitingWorkspace:(0,y.useCallback)(async(n,r)=>{if(e===null)throw gr();a(rr(n),{done:!0,status:{name:r.name,color:r.color}},t);let s=await It({pjcode:e,url:n.url,body:_r});if(await Nt(dr,{pjcode:e,action:`set_status`,issueUrl:n.url,projectItemId:n.projectItemId,statusName:r.name}),o(n),await i?.(),!s.posted){let e=s.rateLimitResetAt===null?``:` Rate limit resets at ${s.rateLimitResetAt}.`;throw Error(`Comment not posted — ${s.error}.${e} Status was changed. Re-post: ${_r}`)}},[e,o,a,t,i]),addComment:(0,y.useCallback)(async(t,n)=>{if(e===null)throw gr();let r=await It({pjcode:e,url:t.url,body:n});if(!r.posted){let e=r.rateLimitResetAt===null?``:` Rate limit resets at ${r.rateLimitResetAt}.`;throw Error(`${r.error}.${e}`)}return o(t),r.comment},[e,o]),uploadAttachment:(0,y.useCallback)(async(t,n)=>{if(e===null)throw Error(`no project in the URL path`);let r=Rt(new Uint8Array(await n.arrayBuffer()));return zt({pjcode:e,url:t.url,fileName:n.name,contentBase64:r})},[e]),addInlineReviewComment:(0,y.useCallback)(async(t,n,r,i,a)=>{if(e===null)throw gr();await Ut({pjcode:e,url:t,path:n,line:r,side:i,body:a})},[e]),deleteAllComments:(0,y.useCallback)(async e=>{await Zt({issueUrl:e.url}),o(e)},[o]),setDependedIssueUrl:(0,y.useCallback)(async(t,n)=>{if(e===null)throw gr();await ln({pjcode:e,issueUrl:t.url,dependedIssueUrl:n})},[e])}},yr=e=>typeof e==`object`&&!!e&&typeof e.ts==`number`,br=e=>{if(typeof localStorage>`u`)return{};let t=localStorage.getItem(nr(e));if(t===null)return{};let n=JSON.parse(t);if(typeof n!=`object`||!n)return{};let r={};for(let[e,t]of Object.entries(n))yr(t)&&(r[e]=t);return r},xr=(e,t)=>{typeof localStorage<`u`&&localStorage.setItem(nr(e),JSON.stringify(t))},Sr=e=>{let[t,n]=(0,y.useState)(()=>br(e));return{overlay:t,patchOverlay:(0,y.useCallback)((t,r,i)=>{n(n=>{let a=lr(n,t,r,i,Date.now());return xr(e,a),a})},[e])}},Cr=e=>{let t=e.split(`/`).filter(e=>e.length>0);if(t.length<2||t[0]!==`projects`)return null;let n=t[1];return n.length===0?null:n},wr=()=>{let[e,t]=(0,y.useState)(()=>Cr(typeof window>`u`?``:window.location.pathname));return(0,y.useEffect)(()=>{let e=()=>{t(Cr(window.location.pathname))};return window.addEventListener(`popstate`,e),()=>{window.removeEventListener(`popstate`,e)}},[]),e},Tr=()=>{let[e,t]=(0,y.useState)([]),[n,r]=(0,y.useState)(null),[i,a]=(0,y.useState)(null),[o,s]=(0,y.useState)(null),[c,l]=(0,y.useState)(!0),[u,d]=(0,y.useState)(null);return(0,y.useEffect)(()=>{let e=!1;return l(!0),d(null),an().then(n=>{e||(t(n.pjcodes),r(n.projectUrls),a(n.workflowImprovementIssueUrl),s(n.fleetTaskCreateUrl),l(!1))}).catch(t=>{e||(d(t instanceof Error?t:Error(String(t))),l(!1))}),()=>{e=!0}},[]),{pjcodes:e,projectUrls:n,workflowImprovementIssueUrl:i,fleetTaskCreateUrl:o,isLoading:c,error:u}},Er=()=>typeof window<`u`&&window.location.hash===`#settings`,Dr=e=>{let[t,n]=(0,y.useState)(Er),[r,i]=(0,y.useState)(!1),[a,o]=(0,y.useState)(!1),[s,c]=(0,y.useState)(null),[l,u]=(0,y.useState)(``),d=(0,y.useRef)(``);(0,y.useEffect)(()=>{if(!t||e===null)return;let n=!1;return u(``),i(!0),c(null),sn(e).then(e=>{n||u(e.maximumPreparingIssuesCount===null?``:String(e.maximumPreparingIssuesCount))}).catch(e=>{n||c(e instanceof Error?e.message:`Failed to load settings`)}).finally(()=>{n||i(!1)}),()=>{n=!0}},[t,e]),(0,y.useEffect)(()=>{if(typeof window>`u`)return;let e=()=>{let e=window.location.hash===er;e||c(null),n(e)};return window.addEventListener(`popstate`,e),window.addEventListener(`hashchange`,e),()=>{window.removeEventListener(`popstate`,e),window.removeEventListener(`hashchange`,e)}},[]);let f=(0,y.useCallback)(()=>{e!==null&&(typeof window<`u`&&(d.current=window.location.hash,window.history.pushState({},``,er)),n(!0))},[e]),p=(0,y.useCallback)(()=>{if(typeof window<`u`){let e=d.current,t=`${window.location.pathname}${window.location.search}${e}`;window.history.replaceState({},``,t)}n(!1),c(null)},[]),m=(0,y.useCallback)(e=>{u(e)},[]),h=(0,y.useCallback)(async t=>{if(e!==null){o(!0),c(null);try{if(await dn({pjcode:e,maximumPreparingIssuesCount:t}),typeof window<`u`){let e=d.current,t=`${window.location.pathname}${window.location.search}${e}`;window.history.replaceState({},``,t)}n(!1)}catch(e){c(e instanceof Error?e.message:`Failed to save settings`)}finally{o(!1)}}},[e]);return(0,y.useEffect)(()=>{if(!t)return;let e=e=>{e.key===`Escape`&&p()};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[t,p]),{isOpen:t,isLoading:r,isSaving:a,error:s,inputValue:l,open:f,close:p,changeInput:m,save:h}},Or=e=>{let t=(0,y.useRef)(e),n=(0,y.useRef)(Date.now());return t.current!==e&&(t.current=e,n.current=Date.now()),{isTimerExpired:(0,y.useCallback)(e=>e<=0?!1:Date.now()-n.current>=e*60*1e3,[])}},kr=/##\s+(?:エグゼクティブサマリ(?:\s*\/\s*Executive\s+Summary)?|Executive\s+Summary)\s*\n/i,Ar=/^From:\s+:robot:/m,jr=/^##\s/m,Mr=e=>{let t=kr.exec(e);if(t===null)return null;let n=e.slice(t.index+t[0].length),r=Ar.exec(n),i=jr.exec(n),a=n.length;r!==null&&(a=Math.min(a,r.index)),i!==null&&(a=Math.min(a,i.index));let o=n.slice(0,a).trim();return o.length>0?o:null},Nr=e=>{if(e.length===0)return null;let t=e[e.length-1],n=Mr(t.body);if(n!==null)return n;let r=t.body.trim();return r.length>0?r:null},Pr=e=>`${e.repo}#${e.number}`,Fr=(e,t,n)=>{let[r,i]=(0,y.useState)({});return(0,y.useEffect)(()=>{if(!n)return;let r=!1;for(let n of e){let e=Pr(n),a=t.peek(e);if(a!==void 0){let e=Nr(a);r||i(t=>t[n.projectItemId]===e?t:{...t,[n.projectItemId]:e});continue}t.load(e,n.url).then(e=>{if(r)return;let t=Nr(e);i(e=>e[n.projectItemId]===t?e:{...e,[n.projectItemId]:t})}).catch(()=>{r||i(e=>e[n.projectItemId]===null?e:{...e,[n.projectItemId]:null})})}return()=>{r=!0}},[e,t,n]),r},Ir=(e,t)=>{let n=Math.abs(e);return n<60||n<=Math.abs(t)*1.5?null:e<0?`next`:`previous`},Lr=(e,t)=>{let n=Math.abs(e),r=Math.abs(t);return r>n*1.5&&r>20},Rr=e=>{let t=e instanceof Element?e:null;for(;t!==null&&t!==document.body;){let e=window.getComputedStyle(t).overflowX;if((e===`auto`||e===`scroll`)&&t.scrollWidth>t.clientWidth&&t.scrollLeft>0)return!0;t=t.parentElement}return!1},zr=e=>{let t=(0,y.useRef)(e);t.current=e;let n=(0,y.useRef)(null),r=(0,y.useCallback)(e=>{let n=0,r=0,i=!1,a=e=>{if(e.touches.length!==1){i=!1;return}if(Rr(e.target)){i=!1;return}let t=e.touches[0];n=t.clientX,r=t.clientY,i=!0},o=e=>{if(!i)return;let t=e.touches[0];Lr(t.clientX-n,t.clientY-r)&&(i=!1)},s=e=>{if(!i||(i=!1,e.changedTouches.length!==1))return;let a=e.changedTouches[0],o=Ir(a.clientX-n,a.clientY-r);o!==null&&t.current(o)};return e.addEventListener(`touchstart`,a,{passive:!0}),e.addEventListener(`touchmove`,o,{passive:!0}),e.addEventListener(`touchend`,s,{passive:!0}),()=>{e.removeEventListener(`touchstart`,a),e.removeEventListener(`touchmove`,o),e.removeEventListener(`touchend`,s)}},[]),i=(0,y.useCallback)(e=>{n.current!==null&&(n.current(),n.current=null),e!==null&&(n.current=r(e))},[r]);return(0,y.useEffect)(()=>()=>{n.current!==null&&(n.current(),n.current=null)},[]),i},Br=e=>typeof e==`object`&&!!e&&!Array.isArray(e),Vr=e=>Array.isArray(e)?e.filter(e=>typeof e==`string`):[],Hr=e=>Array.isArray(e)?e.filter(Br).map(e=>({...e,relatedOpenPullRequestUrls:Vr(e.relatedOpenPullRequestUrls)})):[],Ur=e=>!Br(e)||!Array.isArray(e.items)?[]:Hr(e.items),Wr=e=>Array.isArray(e)?e.filter(Br):[],Gr=e=>Array.isArray(e)?e.filter(Br).map(e=>({...e,items:Hr(e.items)})):[],Kr=e=>({items:Ur(e),generatedAt:Br(e)&&typeof e.generatedAt==`string`?e.generatedAt:``,statusOptions:Br(e)?Wr(e.statusOptions):[],agentOptions:Br(e)?Wr(e.agentOptions):[],storyOptions:Br(e)?Wr(e.storyOptions):[],storyColors:Br(e)&&Br(e.storyColors)?e.storyColors:{},stories:Br(e)?Gr(e.stories):[],defaultNameWithOwner:Br(e)&&typeof e.defaultNameWithOwner==`string`?e.defaultNameWithOwner:null,storyOrder:Br(e)?Vr(e.storyOrder):[],timerEndsAt:Br(e)&&typeof e.timerEndsAt==`string`?e.timerEndsAt:null,timerTotalSeconds:Br(e)&&typeof e.timerTotalSeconds==`number`&&e.timerTotalSeconds>0?e.timerTotalSeconds:null}),qr=()=>{let e={};for(let t of ae)e[t.name]=null;return e},Jr=(e,t)=>`/projects/${e}/${t}/list.json`,Yr=6e4,Xr=`console-list-v1`,Zr=(e,t)=>{try{if(!(`caches`in globalThis))return;globalThis.caches.open(Xr).then(n=>n.put(e,new Response(JSON.stringify(t),{headers:{"Content-Type":`application/json`}}))).catch(e=>{console.warn(`Failed to persist tab snapshot to cache:`,e)})}catch(e){console.warn(`Failed to access cache storage:`,e)}},Qr=async e=>{if(!(`caches`in globalThis))return null;try{let t=await(await globalThis.caches.open(Xr)).match(e);return t===void 0?null:{...Kr(await t.json()),fromCache:!0}}catch{return null}},$r=async(e,t)=>{let n=Jr(e,t);try{let e=await fetch(n);if(!e.ok)throw Error(`HTTP ${e.status}`);let t=await e.json();return Zr(n,t),{snapshot:{...Kr(t),fromCache:!1},error:null}}catch(e){let t=await Qr(n);return t===null?{snapshot:null,error:e instanceof Error?e:Error(String(e))}:{snapshot:t,error:null}}},ei=async e=>{let t=await Promise.all(ae.map(async t=>{let{snapshot:n,error:r}=await $r(e,t.name);return{tabName:t.name,snapshot:n,error:r}})),n=qr(),r=null;for(let{tabName:e,snapshot:i,error:a}of t)n[e]=i,a!==null&&r===null&&(r=a);return{snapshots:n,firstError:Object.values(n).every(e=>e===null)?r:null}},ti=(e,t=null)=>{let[n,r]=(0,y.useState)(qr),[i,a]=(0,y.useState)(!0),[o,s]=(0,y.useState)(null);return(0,y.useEffect)(()=>{if(t!==null&&e!==null){let n=t.tabs[e];if(n!==void 0){let e=qr();for(let t of ae){let r=n[t.name];r!==void 0&&(e[t.name]={...r})}r(e),a(!1),s(null);return}}let n=!1;if(a(!0),s(null),r(qr()),e===null)return r(qr()),a(!1),s(`No project specified in the URL path.`),()=>{n=!0};let i=()=>{ei(e).then(({snapshots:e,firstError:t})=>{n||(r(e),s(t===null?null:t.message),a(!1))}).catch(e=>{n||(s(e instanceof Error?e.message:String(e)),a(!1))})};i();let o=setInterval(i,Yr);return()=>{n=!0,clearInterval(o)}},[e,t]),{snapshots:n,isLoading:i,error:o,refreshSingleTab:(0,y.useCallback)(async t=>{if(e===null)return;let{snapshot:n}=await $r(e,t);n!==null&&r(e=>({...e,[t]:n}))},[e])}},ni=`console-comment-expanded:`,ri=e=>{try{let t=localStorage.getItem(ni+e);if(t===null)return new Set;let n=JSON.parse(t);return Array.isArray(n)?new Set(n.filter(e=>typeof e==`string`)):new Set}catch(e){return console.error(`Failed to load comment expanded state from storage:`,e),new Set}},ii=(e,t)=>{try{localStorage.setItem(ni+e,JSON.stringify([...t]))}catch(e){console.error(`Failed to save comment expanded state to storage:`,e)}},ai=()=>{let e=[];for(let t=0;t<localStorage.length;t++){let n=localStorage.key(t);n?.startsWith(ni)&&e.push(n)}for(let t of e)localStorage.removeItem(t)},oi=e=>(0,y.useCallback)(t=>{ai(),e(t)},[e]),si=()=>{let[e,t]=(0,y.useState)(Nn),[n,r]=(0,y.useState)(!1),[i,a]=(0,y.useState)(e),o=(0,y.useCallback)(()=>{t(e=>(a(e),e)),r(!0)},[]),s=(0,y.useCallback)(()=>{r(!1)},[]),c=(0,y.useCallback)(()=>{a(e=>(Pn(e),t(e),e)),r(!1)},[]),l=(0,y.useCallback)(e=>{a(t=>({...t,timerMode:e}))},[]),u=(0,y.useCallback)((e,t)=>{a(n=>({...n,projectMinutes:{...n.projectMinutes,[e]:t}}))},[]);return{timerMode:e.timerMode,projectMinutes:e.projectMinutes,isOpen:n,draftTimerMode:i.timerMode,draftProjectMinutes:i.projectMinutes,openSettings:o,closeSettings:s,saveSettings:c,toggleDraftTimerMode:l,changeDraftMinutes:u}},ci=(e,t)=>{let n=e.indexOf(t);if(n<0)return e.length>0?e[0]:null;let r=n+1;return r<e.length?e[r]:null},li=(e,t)=>{let n=e.indexOf(t);return n<0||n>=e.length-1?null:e[n+1]},ui=(e,t)=>{let n=e.indexOf(t);return n<=0?null:e[n-1]},di=(e,t)=>e.length===0?`${t}\n`:e.endsWith(`
|
|
14
14
|
`)?`${e}${t}\n`:`${e}\n${t}\n`,fi=(e,t)=>{let n=`![uploading ${t}]()`;return`${e.length===0?``:e.replace(/\n*$/,`
|
|
15
15
|
`)}\n\n\n${n}\n`},pi=(e,t,n)=>{let r=`![uploading ${t}]()`,i=e.indexOf(r);return i===-1?di(e,n):e.slice(0,i)+n+e.slice(i+r.length)},mi=(e,t)=>{let n=`![uploading ${t}]()`,r=e.indexOf(n);if(r===-1)return e;let i=r,a=0;for(;a<3&&i>0&&e[i-1]===`
|
|
16
16
|
`;)i--,a++;let o=+(e[r+n.length]===`
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
<meta charset="UTF-8" />
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
6
6
|
<title>TDPM Console</title>
|
|
7
|
-
<script type="module" crossorigin src="/assets/index-
|
|
7
|
+
<script type="module" crossorigin src="/assets/index-D3_aonuG.js"></script>
|
|
8
8
|
<link rel="stylesheet" crossorigin href="/assets/index-Bf2COuph.css">
|
|
9
9
|
</head>
|
|
10
10
|
<body>
|
|
@@ -6,6 +6,8 @@ const ChangeTargetPullRequestApprover_1 = require("./ChangeTargetPullRequestAppr
|
|
|
6
6
|
const resolveLabelsNotRequiringPullRequest_1 = require("./resolveLabelsNotRequiringPullRequest");
|
|
7
7
|
const isAuthorAuthorizedForAutoStatusCheck_1 = require("./isAuthorAuthorizedForAutoStatusCheck");
|
|
8
8
|
const issueReactivationTriggerIsPending_1 = require("./issueReactivationTriggerIsPending");
|
|
9
|
+
const findLastAgentReport_1 = require("./findLastAgentReport");
|
|
10
|
+
const extractWaitingForOwner_1 = require("./extractWaitingForOwner");
|
|
9
11
|
const WorkflowStatus_1 = require("../entities/WorkflowStatus");
|
|
10
12
|
// GitHub rejects field mutations against archived project items with
|
|
11
13
|
// "The item is archived and cannot be updated". Such a failure is specific to
|
|
@@ -63,6 +65,14 @@ class RevertNotReadyReviewQueueIssueUseCase {
|
|
|
63
65
|
continue;
|
|
64
66
|
}
|
|
65
67
|
try {
|
|
68
|
+
if (this.issueRejectionEvaluator.requiresPullRequestEvaluation(issue, labelsNotRequiringPullRequest, params.developerAgentNames)) {
|
|
69
|
+
const issueComments = await this.issueCommentRepository.getCommentsFromIssue(issue);
|
|
70
|
+
const lastAgentReport = (0, findLastAgentReport_1.findLastAgentReport)(issueComments, (author) => (0, isAuthorAuthorizedForAutoStatusCheck_1.isAuthorAuthorizedForAutoStatusCheck)(author, allowedIssueAuthors));
|
|
71
|
+
if (lastAgentReport &&
|
|
72
|
+
(0, extractWaitingForOwner_1.extractWaitingForOwner)(lastAgentReport.content)) {
|
|
73
|
+
continue;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
66
76
|
const { rejections, approvedPrUrl } = await this.issueRejectionEvaluator.evaluate(issue, labelsNotRequiringPullRequest, {
|
|
67
77
|
relatedOpenPrUrls: this.resolveRelatedOpenPrUrls(issue, relatedOpenPrUrlsByIssueUrl, batchedRelatedOpenPrUrlsByIssueUrl),
|
|
68
78
|
resolvedOpenPrByUrl,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RevertNotReadyReviewQueueIssueUseCase.js","sourceRoot":"","sources":["../../../src/domain/usecases/RevertNotReadyReviewQueueIssueUseCase.ts"],"names":[],"mappings":";;;AAOA,uEAAoE;AACpE,uFAAoF;AACpF,iGAA8F;AAC9F,iGAA8F;AAC9F,2FAAwF;AACxF,+DAGoC;AAEpC,qEAAqE;AACrE,8EAA8E;AAC9E,0EAA0E;AAC1E,6EAA6E;AAC7E,kDAAkD;AAClD,MAAM,0BAA0B,GAAG,CAAC,KAAc,EAAW,EAAE;IAC7D,MAAM,OAAO,GAAG,KAAK,Y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AM,EAAE,CAAC;gBAC3B,IAAI,CAAC,KAAK,CAAC,IAAI,IAAI,KAAK,CAAC,QAAQ,EAAE,CAAC;oBAClC,SAAS;gBACX,CAAC;gBACD,KAAK,MAAM,kBAAkB,IAAI,KAAK,CAAC,yBAAyB,EAAE,CAAC;oBACjE,MAAM,QAAQ,GAAG,oBAAoB,CAAC,GAAG,CAAC,kBAAkB,CAAC,CAAC;oBAC9D,IAAI,QAAQ,EAAE,CAAC;wBACb,QAAQ,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;oBAC1B,CAAC;yBAAM,CAAC;wBACN,oBAAoB,CAAC,GAAG,CAAC,kBAAkB,EAAE,IAAI,GAAG,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;oBACrE,CAAC;gBACH,CAAC;YACH,CAAC;YACD,MAAM,MAAM,GAAG,IAAI,GAAG,EAAoB,CAAC;YAC3C,KAAK,MAAM,CAAC,QAAQ,EAAE,MAAM,CAAC,IAAI,oBAAoB,EAAE,CAAC;gBACtD,MAAM,CAAC,GAAG,CAAC,QAAQ,EAAE,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC;YAC3C,CAAC;YACD,OAAO,MAAM,CAAC;QAChB,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"RevertNotReadyReviewQueueIssueUseCase.js","sourceRoot":"","sources":["../../../src/domain/usecases/RevertNotReadyReviewQueueIssueUseCase.ts"],"names":[],"mappings":";;;AAOA,uEAAoE;AACpE,uFAAoF;AACpF,iGAA8F;AAC9F,iGAA8F;AAC9F,2FAAwF;AACxF,+DAA4D;AAC5D,qEAAkE;AAClE,+DAGoC;AAEpC,qEAAqE;AACrE,8EAA8E;AAC9E,0EAA0E;AAC1E,6EAA6E;AAC7E,kDAAkD;AAClD,MAAM,0BAA0B,GAAG,CAAC,KAAc,EAAW,EAAE;IAC7D,MAAM,OAAO,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,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,CAAC,CAAC;QA5PA,IAAI,CAAC,uBAAuB,GAAG,IAAI,iDAAuB,CAAC,eAAe,CAAC,CAAC;QAC5E,IAAI,CAAC,+BAA+B,GAAG,IAAI,iEAA+B,CACxE,eAAe,CAChB,CAAC;IACJ,CAAC;CAyPF;AAxRD,sFAwRC"}
|
package/package.json
CHANGED
|
@@ -7,7 +7,7 @@ export declare class RevertNotReadyReviewQueueIssueUseCase {
|
|
|
7
7
|
private readonly issueCommentRepository;
|
|
8
8
|
private readonly issueRejectionEvaluator;
|
|
9
9
|
private readonly changeTargetPullRequestApprover;
|
|
10
|
-
constructor(projectRepository: Pick<ProjectRepository, 'findProjectIdByUrl' | 'getProject'>, issueRepository: Pick<IssueRepository, 'getAllIssues' | 'updateStatus' | 'updateStory' | 'findRelatedOpenPRs' | 'findRelatedOpenPrUrls' | 'getOpenPullRequest' | 'getOpenPullRequests' | 'getPullRequestChangedFilePaths' | 'approvePullRequest' | 'requestChangesWithInlineComment'>, issueCommentRepository: Pick<IssueCommentRepository, 'createComment'>);
|
|
10
|
+
constructor(projectRepository: Pick<ProjectRepository, 'findProjectIdByUrl' | 'getProject'>, issueRepository: Pick<IssueRepository, 'getAllIssues' | 'updateStatus' | 'updateStory' | 'findRelatedOpenPRs' | 'findRelatedOpenPrUrls' | 'getOpenPullRequest' | 'getOpenPullRequests' | 'getPullRequestChangedFilePaths' | 'approvePullRequest' | 'requestChangesWithInlineComment'>, issueCommentRepository: Pick<IssueCommentRepository, 'createComment' | 'getCommentsFromIssue'>);
|
|
11
11
|
run: (params: {
|
|
12
12
|
projectUrl: string;
|
|
13
13
|
manager: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RevertNotReadyReviewQueueIssueUseCase.d.ts","sourceRoot":"","sources":["../../../src/domain/usecases/RevertNotReadyReviewQueueIssueUseCase.ts"],"names":[],"mappings":"AACA,OAAO,EACL,eAAe,EAEhB,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EAAE,iBAAiB,EAAE,MAAM,wCAAwC,CAAC;AAC3E,OAAO,EAAE,sBAAsB,EAAE,MAAM,6CAA6C,CAAC;
|
|
1
|
+
{"version":3,"file":"RevertNotReadyReviewQueueIssueUseCase.d.ts","sourceRoot":"","sources":["../../../src/domain/usecases/RevertNotReadyReviewQueueIssueUseCase.ts"],"names":[],"mappings":"AACA,OAAO,EACL,eAAe,EAEhB,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EAAE,iBAAiB,EAAE,MAAM,wCAAwC,CAAC;AAC3E,OAAO,EAAE,sBAAsB,EAAE,MAAM,6CAA6C,CAAC;AA0BrF,qBAAa,qCAAqC;IAK9C,OAAO,CAAC,QAAQ,CAAC,iBAAiB;IAIlC,OAAO,CAAC,QAAQ,CAAC,eAAe;IAahC,OAAO,CAAC,QAAQ,CAAC,sBAAsB;IArBzC,OAAO,CAAC,QAAQ,CAAC,uBAAuB,CAA0B;IAClE,OAAO,CAAC,QAAQ,CAAC,+BAA+B,CAAkC;gBAG/D,iBAAiB,EAAE,IAAI,CACtC,iBAAiB,EACjB,oBAAoB,GAAG,YAAY,CACpC,EACgB,eAAe,EAAE,IAAI,CACpC,eAAe,EACb,cAAc,GACd,cAAc,GACd,aAAa,GACb,oBAAoB,GACpB,uBAAuB,GACvB,oBAAoB,GACpB,qBAAqB,GACrB,gCAAgC,GAChC,oBAAoB,GACpB,iCAAiC,CACpC,EACgB,sBAAsB,EAAE,IAAI,CAC3C,sBAAsB,EACtB,eAAe,GAAG,sBAAsB,CACzC;IAQH,GAAG,GAAU,QAAQ;QACnB,UAAU,EAAE,MAAM,CAAC;QACnB,OAAO,EAAE,MAAM,CAAC;QAChB,oBAAoB,CAAC,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC;QACvC,6BAA6B,CAAC,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC;QAChD,uBAAuB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,IAAI,CAAC;QACxD,mBAAmB,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