github-issue-tower-defence-management 2.113.2 → 2.113.3
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-BDHzLUaX.js → index-BViZvDF2.js}
RENAMED
|
@@ -88,4 +88,4 @@ Please report this to https://github.com/markedjs/marked.`,e){let e=`<p>An error
|
|
|
88
88
|
`).find(e=>e.trim()!==``)??``,Wu=e=>`${e.author}:${e.createdAt}:${e.body}`,Gu=({comment:e,buildImageProxyUrl:t,renderReferenceLink:n,repoContext:r})=>{let i=(0,y.useRef)(null);return(0,y.useEffect)(()=>{let e=i.current;if(!e)return;let t=e=>e.stopPropagation();return e.addEventListener(`click`,t),()=>e.removeEventListener(`click`,t)},[]),(0,x.jsx)(`div`,{ref:i,className:`console-comment-body-expanded`,children:(0,x.jsx)(Cu,{body:e.body,buildImageProxyUrl:t,renderReferenceLink:n,repoContext:r})})},Ku=({comments:e,isLoading:t,error:n,now:r,workflowImprovementIssueUrl:i=null,buildImageProxyUrl:a,renderReferenceLink:o,repoContext:s,persistenceKey:c=null})=>{let[l,u]=(0,y.useState)(!1),[d,f]=(0,y.useState)(()=>c==null?new Set:Sn(c)),p=e.length>0?Wu(e[e.length-1]):null;(0,y.useEffect)(()=>{p!==null&&f(e=>new Set([...e,p]))},[p]),(0,y.useEffect)(()=>{c!=null&&Cn(c,d)},[c,d]);let m=e=>{f(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})};if(n!==null)return(0,x.jsx)(`p`,{className:`console-comment-notloaded`,children:`Not loaded.`});if(t)return(0,x.jsx)(`p`,{className:`console-comment-loading`,children:`Loading comments...`});if(e.length===0)return(0,x.jsx)(`p`,{className:`console-comment-empty`,children:`No comments.`});let h=!l&&e.length>1;return(0,x.jsxs)(`div`,{className:`console-comment-list`,children:[h&&(0,x.jsxs)(`button`,{type:`button`,className:`console-comment-show-all`,onClick:()=>{u(!0),f(t=>new Set([...t,...e.map(Wu)]))},children:[`Show all `,e.length]}),e.map(e=>{let t=Wu(e),n=d.has(t);return(0,x.jsxs)(`article`,{className:`console-comment${n?` is-expanded`:h?` console-comment--expandable`:``}`,children:[(0,x.jsxs)(`button`,{type:`button`,className:`console-comment-toggle`,onClick:()=>m(t),"aria-expanded":n,children:[(0,x.jsx)(`span`,{className:`console-comment-author`,children:e.author}),(0,x.jsx)(`span`,{className:`console-comment-time`,children:ie(e.createdAt,r)}),!n&&(0,x.jsx)(`span`,{className:`console-comment-body-preview`,children:Uu(e.body)})]}),i!==null&&e.url!==null&&(0,x.jsx)(`a`,{href:wi(i,e.url),target:`_blank`,rel:`noreferrer`,className:`console-comment-report-link`,"aria-label":`Create workflow incident report for this comment`,children:`⚡`}),n&&(0,x.jsx)(Gu,{comment:e,buildImageProxyUrl:a,renderReferenceLink:o,repoContext:s})]},t)})]})},qu=e=>e.slice(0,7),Ju=e=>e.split(`
|
|
89
89
|
`)[0],Yu=({commits:e,isLoading:t,error:n,now:r})=>n===null?t?(0,x.jsx)(`p`,{className:`console-commits-loading`,children:`Loading commits...`}):e.length===0?(0,x.jsx)(`p`,{className:`console-commits-empty`,children:`No commits.`}):(0,x.jsx)(`ul`,{className:`console-commits`,children:e.map(e=>(0,x.jsxs)(`li`,{className:`console-commit`,children:[(0,x.jsx)(`span`,{className:`console-commit-message`,children:Ju(e.message)}),(0,x.jsx)(`span`,{className:`console-commit-sha`,children:qu(e.sha)}),(0,x.jsx)(`span`,{className:`console-commit-author`,children:e.author}),(0,x.jsx)(`span`,{className:`console-commit-time`,children:ie(e.authoredAt,r)})]},e.sha))}):(0,x.jsx)(`p`,{className:`console-commits-notloaded`,children:`Not loaded.`}),Xu=({url:e,label:t=`Copy URL`})=>(0,x.jsx)(nu,{value:e,idleText:`Copy URL`,idleAriaLabel:t,copiedAriaLabel:`URL copied to clipboard`,className:`console-copy-url-button`}),Zu=e=>{let t=new Map;for(let n of e){let e=t.get(n.message);if(e===void 0){t.set(n.message,[n.section]);continue}e.push(n.section)}return Array.from(t,([e,t])=>({message:e,sections:t}))},Qu=e=>e.length<=1?e.join(``):`${e.slice(0,-1).join(`, `)} and ${e[e.length-1]}`,$u=({failures:e})=>e.length===0?null:(0,x.jsx)(`div`,{role:`alert`,className:`console-detail-fetch-error`,children:Zu(e).map(e=>(0,x.jsxs)(`p`,{className:`console-detail-fetch-error-line`,children:[`Failed to load `,Qu(e.sections),`:`,` `,e.message]},e.message))}),ed={MERGEABLE:{color:`GREEN`,label:`No conflict`,title:`This pull request has no merge conflicts`,modifier:`console-detail-mergeable-chip-ok`},CONFLICTING:{color:`RED`,label:`Conflict`,title:`This pull request has merge conflicts`,modifier:`console-detail-mergeable-chip-conflict`},UNKNOWN:{color:`GRAY`,label:`Checking merge status`,title:`GitHub has not finished computing the merge status yet`,modifier:`console-detail-mergeable-chip-unknown`}},td=({mergeableStatus:e})=>{let t=ed[e],n=M(t.color);return(0,x.jsx)(`span`,{className:`console-detail-status-chip console-detail-mergeable-chip ${t.modifier}`,style:{color:n.fg,borderColor:n.border,backgroundColor:n.bg},title:t.title,children:t.label})},nd=e=>{let t=M(e);return{color:t.fg,borderColor:t.border,backgroundColor:t.bg}},rd=({isPassedAllCiJob:e,isCiStateSuccess:t,isBranchOutOfDate:n,missingRequiredCheckNames:r})=>{let i=e&&t,a=i?`GREEN`:`RED`,o=i?`CI passing`:`CI failing`,s=!i&&r.length>0?`missing: ${r.join(`, `)}`:null;return(0,x.jsxs)(`span`,{className:`console-detail-pr-status`,children:[(0,x.jsxs)(`span`,{className:`console-detail-status-chip console-detail-ci-chip`,style:nd(a),title:s??o,children:[o,s!==null&&(0,x.jsxs)(`span`,{className:`console-detail-ci-missing`,children:[` `,`(`,s,`)`]})]}),n&&(0,x.jsx)(`span`,{className:`console-detail-status-chip console-detail-outofdate-chip`,style:nd(`YELLOW`),title:`This branch is out of date with the base branch`,children:`Out of date`})]})},id=({pullRequest:e,body:t,bodyIsLoading:n,files:r,filesAreLoading:i,filesError:a,commits:o,commitsAreLoading:s,commitsError:c,now:l,buildImageProxyUrl:u,renderReferenceLink:d,onAddInlineComment:f})=>{let p=e.summary,m=xi(e.url),h=m===null?void 0:{owner:m.owner,repo:m.repo},g=i||a!==null?null:r.length,_=s||c!==null?null:o.length;return(0,x.jsxs)(x.Fragment,{children:[(0,x.jsxs)(`div`,{className:`console-pr-header`,children:[(0,x.jsx)(`a`,{href:e.url,className:`console-pr-section-title`,target:`_blank`,rel:`noopener noreferrer`,children:p?.title??e.url}),e.isDraft&&(0,x.jsx)(`span`,{className:`console-pr-section-state`,children:`draft`}),(0,x.jsx)(td,{mergeableStatus:e.mergeableStatus}),(0,x.jsx)(rd,{isPassedAllCiJob:e.isPassedAllCiJob,isCiStateSuccess:e.isCiStateSuccess,isBranchOutOfDate:e.isBranchOutOfDate,missingRequiredCheckNames:e.missingRequiredCheckNames}),(0,x.jsx)(`a`,{href:e.url,className:`console-panel-open-link`,target:`_blank`,rel:`noopener noreferrer`,children:`open`}),(0,x.jsx)(Xu,{url:e.url,label:`Copy PR URL`}),(0,x.jsxs)(`div`,{className:`console-pr-statbar`,children:[m!==null&&(0,x.jsxs)(`span`,{className:`console-pr-repo`,children:[m.owner,`/`,m.repo]}),e.branchName!==null&&(0,x.jsx)(`span`,{className:`console-pr-branch`,children:e.branchName}),p!==null&&(0,x.jsxs)(x.Fragment,{children:[(0,x.jsxs)(`span`,{className:`console-pr-add`,children:[`+`,p.additions]}),(0,x.jsxs)(`span`,{className:`console-pr-del`,children:[`-`,p.deletions]}),(0,x.jsxs)(`span`,{className:`console-pr-files-count`,children:[p.changedFiles,` files`]})]})]})]}),(0,x.jsx)(wu,{title:`Description`,children:n?(0,x.jsx)(`p`,{className:`console-pr-body-loading`,children:`Loading description...`}):(0,x.jsx)(Cu,{body:p?.body??t,buildImageProxyUrl:u,renderReferenceLink:d,repoContext:h})}),(0,x.jsx)(wu,{title:`Changed files`,count:g,children:(0,x.jsx)(Hu,{files:r,isLoading:i,error:a,buildImageProxyUrl:u,onAddInlineComment:f})}),(0,x.jsx)(wu,{title:`Commits`,count:_,defaultCollapsed:!0,children:(0,x.jsx)(Yu,{commits:o,isLoading:s,error:c,now:l})})]})},ad=({item:e,storyName:t,storyColorEnum:n,overlayStatus:r,statusOptions:i,state:a,body:o,bodyIsLoading:s,bodyError:c,comments:l,commentsAreLoading:u,commentsError:d,files:f,filesAreLoading:p,filesError:m,commits:h,commitsAreLoading:g,commitsError:_,stateError:v,pullRequestStatus:y,pullRequestStatusError:b,relatedPullRequests:S,relatedPullRequestsError:C,now:w,commentComposer:T,operationBar:ee,buildImageProxyUrl:te,renderReferenceLink:E,onAddInlineComment:ne,workflowImprovementIssueUrl:re=null})=>{let D=a?.state??`open`,ae=a?.merged??!1,oe=!e.isPr&&D===`closed`?`Closed`:null,k=Si(e.nameWithOwner)??void 0,A=M(n),se=r===null?e.status===null?null:{name:e.status,color:i.find(t=>t.name===e.status)?.color??`GRAY`}:r,j=se===null?null:M(se.color),ce=p||m!==null?null:f.length,N=u||d!==null?null:l.length,P=g||_!==null?null:h.length,le=!u&&d===null&&l.length>0,F=e=>{let t=xi(e);return t===null?e:`PR #${t.number}`},ue=[{section:`item state`,message:v},{section:`pull request status`,message:e.isPr?b:null},{section:`description`,message:c},{section:`comments`,message:d},{section:`changed files`,message:e.isPr?m:null},{section:`commits`,message:e.isPr?_:null},{section:`related pull requests`,message:e.isPr?null:C},...S.flatMap(e=>[{section:`changed files of ${F(e.pullRequest.url)}`,message:e.filesError},{section:`commits of ${F(e.pullRequest.url)}`,message:e.commitsError}])].flatMap(e=>e.message===null?[]:[{section:e.section,message:e.message}]),I=e.isPr&&y?.found?[{url:e.url,mergeableStatus:y.mergeableStatus}]:[];return(0,x.jsxs)(`article`,{className:`console-detail`,children:[(0,x.jsxs)(`div`,{className:`console-detail-header`,children:[(0,x.jsxs)(`h2`,{className:`console-detail-title`,children:[(0,x.jsx)(Se,{isPr:e.isPr,state:D,merged:ae,isDraft:!1,stateReason:``}),(0,x.jsx)(`span`,{className:`console-detail-title-text`,children:e.title}),(0,x.jsx)(`span`,{className:`console-detail-number`,children:e.isPr?`PR #${e.number}`:`#${e.number}`})]}),(0,x.jsxs)(`div`,{className:`console-detail-topline`,children:[se!==null&&j!==null&&(0,x.jsx)(`span`,{className:`console-detail-status-chip`,style:{color:j.fg,borderColor:j.border,backgroundColor:j.bg},children:se.name}),e.agent!==null&&e.agent!==``&&(0,x.jsx)(`span`,{className:`console-detail-agent-chip`,children:e.agent}),t!==null&&(0,x.jsxs)(`span`,{className:`console-storytag`,children:[(0,x.jsx)(`span`,{className:`console-story-dot`,style:{backgroundColor:A.dot}}),t]}),e.isPr&&y?.found&&(0,x.jsx)(rd,{isPassedAllCiJob:y.isPassedAllCiJob,isCiStateSuccess:y.isCiStateSuccess,isBranchOutOfDate:y.isBranchOutOfDate,missingRequiredCheckNames:y.missingRequiredCheckNames}),!e.isPr&&S.map(e=>(0,x.jsxs)(`span`,{className:`console-related-pr-group`,children:[S.length>1&&(0,x.jsx)(`span`,{className:`console-related-pr-label`,children:F(e.pullRequest.url)}),(0,x.jsx)(rd,{isPassedAllCiJob:e.pullRequest.isPassedAllCiJob,isCiStateSuccess:e.pullRequest.isCiStateSuccess,isBranchOutOfDate:e.pullRequest.isBranchOutOfDate,missingRequiredCheckNames:e.pullRequest.missingRequiredCheckNames}),(0,x.jsx)(td,{mergeableStatus:e.pullRequest.mergeableStatus})]},e.pullRequest.url)),I.map(e=>(0,x.jsx)(td,{mergeableStatus:e.mergeableStatus},e.url)),oe!==null&&(0,x.jsx)(`span`,{className:`console-detail-closed-label`,children:oe})]}),(0,x.jsx)($u,{failures:ue}),(0,x.jsxs)(`div`,{className:`console-detail-subbar`,children:[(0,x.jsxs)(`a`,{href:e.url,className:`console-detail-link`,target:`_blank`,rel:`noopener noreferrer`,children:[`#`,e.number]}),(0,x.jsx)(`span`,{className:`console-detail-repo`,children:e.repo}),(0,x.jsxs)(`span`,{className:`console-detail-createdat`,title:O(e.createdAt),children:[`opened `,ie(e.createdAt,w)]}),(0,x.jsx)(Xu,{url:e.url}),re!==null&&(0,x.jsx)(`a`,{href:wi(re,e.url),target:`_blank`,rel:`noreferrer`,className:`console-detail-report-link`,"aria-label":`Create workflow incident report for this task`,children:`⚡`}),e.labels.map(e=>(0,x.jsx)(`span`,{className:`console-label-chip`,children:e},e))]})]}),(0,x.jsxs)(`div`,{className:`console-detail-body`,children:[(0,x.jsx)(wu,{title:`Description`,defaultCollapsed:le,headerAction:(0,x.jsx)(`a`,{href:e.url,className:`console-panel-open-link`,target:`_blank`,rel:`noopener noreferrer`,children:`open`}),children:c===null?s?(0,x.jsx)(`p`,{className:`console-detail-body-loading`,children:`Loading description...`}):(0,x.jsx)(Cu,{body:o,buildImageProxyUrl:te,renderReferenceLink:E,repoContext:k}):(0,x.jsx)(`p`,{className:`console-detail-body-notloaded`,children:`Not loaded.`})},le?`desc-collapsed`:`desc-open`),e.isPr&&(0,x.jsx)(wu,{title:`Changed files`,count:ce,children:(0,x.jsx)(Hu,{files:f,isLoading:p,error:m,onAddInlineComment:ne})}),(0,x.jsx)(wu,{title:`Comments`,count:N,children:(0,x.jsx)(Ku,{comments:l,isLoading:u,error:d,now:w,workflowImprovementIssueUrl:re,buildImageProxyUrl:te,renderReferenceLink:E,repoContext:k,persistenceKey:e.url})}),e.isPr&&(0,x.jsx)(wu,{title:`Commits`,count:P,defaultCollapsed:!0,children:(0,x.jsx)(Yu,{commits:h,isLoading:g,error:_,now:w})}),!e.isPr&&S.map(e=>(0,x.jsx)(id,{pullRequest:e.pullRequest,body:e.pullRequest.summary?.body??``,bodyIsLoading:!1,files:e.files,filesAreLoading:e.filesAreLoading,filesError:e.filesError,commits:e.commits,commitsAreLoading:e.commitsAreLoading,commitsError:e.commitsError,now:w,buildImageProxyUrl:te,renderReferenceLink:E,onAddInlineComment:ne},e.pullRequest.url))]}),(0,x.jsxs)(`div`,{className:`console-detail-dock`,children:[(0,x.jsx)(`div`,{className:`console-detail-dock-composer`,children:T}),(0,x.jsx)(`div`,{className:`console-actionbar`,children:ee})]})]})},od=({className:e,ariaLabel:t,placeholder:n,currentOption:r,options:i,onSelect:a})=>{let o=(0,y.useRef)({ready:!1,currentOptionId:r?.id??null});return(0,y.useLayoutEffect)(()=>{o.current.ready=!0,o.current.currentOptionId=r?.id??null}),(0,x.jsxs)(`select`,{className:e,defaultValue:r?.id??``,onChange:e=>{if(!o.current.ready||e.target.value===(o.current.currentOptionId??``))return;let t=i.find(t=>t.id===e.target.value);t!==void 0&&a(t)},"aria-label":t,children:[(0,x.jsx)(`option`,{value:``,children:n}),i.map(e=>(0,x.jsx)(`option`,{value:e.id,children:e.name},e.id))]})},sd=({agentOptions:e,currentAgentName:t,onSetAgent:n})=>{if(e.length===0)return null;let r=t===null?null:e.find(e=>e.name===t)??null;return(0,x.jsx)(`div`,{className:`console-op-group`,children:(0,x.jsx)(od,{className:`console-agent-select`,ariaLabel:`Set agent`,placeholder:`— agent —`,currentOption:r,options:e,onSelect:n},r?.id??`none`)})},cd=({onClose:e})=>(0,x.jsxs)(`div`,{className:`console-op-group`,children:[(0,x.jsx)(`button`,{type:`button`,className:`console-op-button`,onClick:()=>e(`close_not_planned`),children:`Close as not planned`}),(0,x.jsx)(`button`,{type:`button`,className:`console-op-button`,onClick:()=>e(`close`),children:`Close`})]}),ld=({onDeleteAllComments:e,onDeleteStory:t,storyNameForDeletion:n})=>{let[r,i]=(0,y.useState)(!1),[a,o]=(0,y.useState)(!1),[s,c]=(0,y.useState)(!1),[l,u]=(0,y.useState)(null),d=()=>{e(),i(!1)},f=()=>{o(!0),u(null)},p=async()=>{if(t){c(!0),u(null);try{await t()}catch(e){u(e instanceof Error?e.message:String(e)),c(!1)}}};return(0,x.jsxs)(`div`,{className:`console-op-group`,children:[(0,x.jsx)(`button`,{type:`button`,className:`console-op-button console-op-button-danger`,onClick:()=>i(e=>!e),children:`⚠`}),r&&(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(`button`,{type:`button`,className:`console-op-button console-op-button-danger`,onClick:d,children:`Delete All Comments`}),t!=null&&(0,x.jsx)(`button`,{type:`button`,className:`console-op-button console-op-button-danger`,onClick:f,disabled:a,children:`Delete Story`})]}),a&&(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 "`,n,`" from the GitHub custom field? Open tasks assigned to this story will be closed.`]}),l!==null&&(0,x.jsx)(`p`,{role:`alert`,className:`console-list-error`,children:l}),(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:()=>void p(),disabled:s,children:s?`Deleting…`:`Delete`}),(0,x.jsx)(`button`,{type:`button`,className:`console-op-button`,onClick:()=>{o(!1),u(null)},disabled:s,children:`Cancel`})]})]})]})},ud=({isManualTriage:e,onSetNextActionDate:t})=>(0,x.jsxs)(`div`,{className:`console-op-group`,children:[(0,x.jsx)(`button`,{type:`button`,className:`console-op-button console-op-button-snooze`,onClick:()=>t(`snooze_1hour`),children:`+1 hour`}),(0,x.jsx)(`button`,{type:`button`,className:`console-op-button console-op-button-snooze`,onClick:()=>t(`snooze_3hours`),children:`+3 hours`}),(0,x.jsx)(`button`,{type:`button`,className:`console-op-button console-op-button-snooze`,onClick:()=>t(`snooze_6hours`),children:`+6 hours`}),(0,x.jsx)(`button`,{type:`button`,className:`console-op-button console-op-button-snooze`,onClick:()=>t(`snooze_1day`),children:`+1 day`}),(0,x.jsx)(`button`,{type:`button`,className:`console-op-button console-op-button-snooze`,onClick:()=>t(`snooze_2days`),children:`+2 days`}),(0,x.jsx)(`button`,{type:`button`,className:`console-op-button console-op-button-snooze`,onClick:()=>t(`snooze_3days`),children:`+3 days`}),(0,x.jsx)(`button`,{type:`button`,className:`console-op-button console-op-button-snooze`,onClick:()=>t(`snooze_5days`),children:`+5 days`}),(0,x.jsx)(`button`,{type:`button`,className:`console-op-button console-op-button-snooze`,onClick:()=>t(`snooze_1week`),children:e?`+1 week and skip`:`+1 week`}),(0,x.jsx)(`button`,{type:`button`,className:`console-op-button console-op-button-snooze`,onClick:()=>t(`snooze_1month`),children:`+1 month`})]}),dd=[{action:`unnecessary`,label:`Unnecessary`,variant:`unneeded`},{action:`totally_wrong`,label:`Totally wrong`,variant:`wrong`},{action:`request_changes`,label:`Reject`,variant:`reject`},{action:`approve_and_merge`,label:`Approve & Merge`,variant:`approve`}],fd=`Reject needs an inline comment on the diff.`,pd=({onReview:e,rejectEnabled:t})=>(0,x.jsxs)(`div`,{className:`console-op-group console-op-group-review`,children:[!t&&(0,x.jsx)(`p`,{className:`console-op-requirement`,children:fd}),dd.map(n=>{let r=n.action===`request_changes`&&!t;return(0,x.jsx)(`button`,{type:`button`,className:`console-op-button console-op-button-${n.variant}`,disabled:r,onClick:()=>e(n.action),children:n.label},n.action)})]}),md=({onSetDependedIssueUrl:e})=>{let[t,n]=(0,y.useState)(!1),[r,i]=(0,y.useState)(``),[a,o]=(0,y.useState)(!1),[s,c]=(0,y.useState)(null);return(0,x.jsxs)(`div`,{className:`console-op-group console-op-group-rare-actions`,children:[(0,x.jsx)(`button`,{type:`button`,className:`console-op-button`,onClick:()=>{n(e=>!e),c(null)},title:`Rare actions`,children:`⋯`}),t&&e!==null&&(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(`input`,{type:`url`,className:`console-settings-modal-input`,placeholder:`Depended issue URL`,value:r,onChange:e=>i(e.target.value),disabled:a}),(0,x.jsx)(`button`,{type:`button`,className:`console-op-button`,onClick:async()=>{if(e!==null&&r.trim()!==``){o(!0),c(null);try{await e(r.trim()),i(``),n(!1)}catch(e){c(e instanceof Error?e.message:`Failed to set depended issue URL`)}finally{o(!1)}}},disabled:a||r.trim()===``,children:a?`...`:`Set Depended Issue`})]}),s!==null&&(0,x.jsx)(`p`,{className:`console-settings-modal-error`,children:s})]})},hd=(e,t)=>{let n=t.toLowerCase();return e.find(e=>e.name.toLowerCase()===n)??null},gd=({statusOptions:e,onSetStatus:t,onSetInTmuxByHuman:n})=>{let r=_e.map(t=>({name:t,option:hd(e,t)})).filter(e=>e.option!==null);return r.length===0?null:(0,x.jsx)(`div`,{className:`console-op-group`,children:r.map(({name:e,option:r})=>{let i=M(r.color),a=e===he;return(0,x.jsx)(`button`,{type:`button`,className:`console-op-button`,style:{color:i.fg,borderColor:i.border,backgroundColor:i.bg},onClick:()=>a?n(r):t(r),children:r.name},r.id)})})},_d=({storyOptions:e,currentStoryName:t,onSetStory:n})=>{if(e.length===0)return null;let r=t===null?null:e.find(e=>e.name===t)??null;return(0,x.jsx)(`div`,{className:`console-op-group`,children:(0,x.jsx)(od,{className:`console-story-select`,ariaLabel:`Set story`,placeholder:`— story —`,currentOption:r,options:e,onSelect:n},r?.id??`none`)})},vd=({tab:e,hasPullRequest:t,rejectEnabled:n,statusOptions:r,storyOptions:i,currentStoryName:a,agentOptions:o,currentAgentName:s,handlers:c,storyNameForDeletion:l})=>{let[u,d]=(0,y.useState)(!1);return(0,x.jsxs)(`div`,{className:`console-operation-bar`,children:[t&&(0,x.jsx)(pd,{onReview:c.onReview,rejectEnabled:n}),(0,x.jsx)(ud,{isManualTriage:ve(e),onSetNextActionDate:c.onSetNextActionDate}),(0,x.jsx)(gd,{statusOptions:r,onSetStatus:c.onSetStatus,onSetInTmuxByHuman:c.onSetInTmuxByHuman}),u&&(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(_d,{storyOptions:i,currentStoryName:a,onSetStory:c.onSetStory}),(0,x.jsx)(sd,{agentOptions:o,currentAgentName:s,onSetAgent:c.onSetAgent})]}),(0,x.jsxs)(`div`,{className:`console-op-group-bottom-row`,children:[(0,x.jsxs)(`div`,{className:`console-op-group-left-pair`,children:[(i.length>0||o.length>0)&&(0,x.jsx)(`div`,{className:`console-op-group`,children:(0,x.jsx)(`button`,{type:`button`,className:`console-op-button`,onClick:()=>d(e=>!e),title:`Change agent or story`,children:`⚙`})}),(0,x.jsx)(md,{onSetDependedIssueUrl:c.onSetDependedIssueUrl}),(0,x.jsx)(ld,{onDeleteAllComments:c.onDeleteAllComments,onDeleteStory:c.onDeleteStory,storyNameForDeletion:l})]}),(0,x.jsx)(cd,{onClose:c.onClose})]})]})},$=(e,t,n,r)=>{let i=t===null?void 0:e.peek(t),[a,o]=(0,y.useState)(i??r),[s,c]=(0,y.useState)(t!==null&&i===void 0),[l,u]=(0,y.useState)(null);return(0,y.useEffect)(()=>{if(t===null||n===null)return;let r=e.peek(t);if(r!==void 0){o(r),c(!1),u(null);return}let i=!1;return c(!0),u(null),e.load(t,n).then(e=>{i||(o(e),c(!1))}).catch(e=>{i||(u(e instanceof Error?e.message:String(e)),c(!1))}),()=>{i=!0}},[e,t,n]),{data:a,isLoading:s,error:l}},yd=[],bd=[],xd=[],Sd=[],Cd={state:`open`,merged:!1,isPullRequest:!1,title:``},wd={found:!1,isConflicted:!1,mergeableStatus:`UNKNOWN`,isPassedAllCiJob:!1,isCiStateSuccess:!1,isBranchOutOfDate:!1,missingRequiredCheckNames:[]},Td=(e,t,n)=>{let r=t===null?null:`${t.repo}#${t.number}`,i=t===null?null:t.url,a=t?.isPr??!1,o=$(e.body,r,i,``),s=$(e.state,r,i,Cd),c=$(e.comments,r,i,yd),l=$(e.files,a?r:null,a?i:null,bd),u=$(e.commits,a?r:null,a?i:null,xd),d=$(e.prStatus,a?r:null,a?i:null,wd),f=!a&&((t?.relatedOpenPullRequestUrls.length??0)>0||n===`prs`),p=$(e.relatedPrs,f?r:null,f?i:null,Sd),[m,h]=(0,y.useState)([]);return(0,y.useEffect)(()=>{if(a||p.data.length===0){h([]);return}let t=!1,n=p.data.map(e=>({pullRequest:e,files:bd,filesAreLoading:!0,filesError:null,commits:xd,commitsAreLoading:!0,commitsError:null}));h(n);let r=(e,n)=>{t||h(t=>t.map(t=>t.pullRequest.url===e?{...t,...n}:t))};for(let t of p.data){let n=t.url;e.files.load(n,t.url).then(e=>r(t.url,{files:e,filesAreLoading:!1})).catch(e=>r(t.url,{filesAreLoading:!1,filesError:e instanceof Error?e.message:String(e)})),e.commits.load(n,t.url).then(e=>r(t.url,{commits:e,commitsAreLoading:!1})).catch(e=>r(t.url,{commitsAreLoading:!1,commitsError:e instanceof Error?e.message:String(e)}))}return()=>{t=!0}},[e,a,p.data]),{state:s.data,body:o.data,bodyIsLoading:o.isLoading,bodyError:o.error,comments:c.data,commentsAreLoading:c.isLoading,commentsError:c.error,files:l.data,filesAreLoading:l.isLoading,filesError:l.error,commits:u.data,commitsAreLoading:u.isLoading,commitsError:u.error,stateError:s.error,pullRequestStatus:a?d.data:null,pullRequestStatusError:a?d.error:null,relatedPullRequests:m,relatedPullRequestsError:a?null:p.error}},Ed=e=>JSON.stringify([e.author,e.createdAt,e.body]),Dd=(e,t)=>{let n=new Set(e.map(Ed));return[...e,...t.filter(e=>!n.has(Ed(e)))]},Od=({href:e,fallbackText:t,state:n})=>{if(n===null||n.title.trim()===``)return(0,x.jsx)(`a`,{className:`console-markdown-reference console-markdown-reference-plain`,href:e,target:`_blank`,rel:`noopener noreferrer`,children:t});let r=xi(e);return(0,x.jsxs)(`a`,{className:`console-markdown-reference`,href:e,target:`_blank`,rel:`noopener noreferrer`,children:[(0,x.jsx)(Se,{...Ci(n)}),(0,x.jsx)(`span`,{className:`console-markdown-reference-title`,children:n.title}),r!==null&&(0,x.jsxs)(`span`,{className:`console-markdown-reference-number`,children:[`#`,r.number]})]})},kd=(e,t)=>{let[n,r]=(0,y.useState)(()=>e.peek(t)??null);return(0,y.useEffect)(()=>{let n=e.peek(t);if(n!==void 0){r(n);return}let i=!1;return r(null),e.load(t,t).then(e=>{i||r(e)}).catch(()=>{i||r(null)}),()=>{i=!0}},[e,t]),n},Ad=({cache:e,href:t,fallbackText:n})=>{let r=kd(e,t);return(0,x.jsx)(Od,{href:t,fallbackText:n,state:r})},jd=e=>({itemUrl:e.url,projectItemId:e.projectItemId,itemNumber:e.number,repo:e.repo,isPr:e.isPr}),Md=(e,t,n,r,i)=>({...jd(t),apiPath:lr,requestBody:fr(e,t,n,r,i)}),Nd=(e,t,n,r)=>({...jd(t),apiPath:ur,requestBody:pr(e,t,n,r)}),Pd=(e,t)=>({...jd(t),apiPath:dr,requestBody:mr(e,t)}),Fd=({tab:e,item:t,caches:n,operations:r,pjcode:i,statusOptions:a,storyOptions:o,agentOptions:s,storyColors:c,storyName:l,overlayStatus:u,now:d,initialCommentDraft:f,onCommentDraftChange:p,onQueueAction:m,onDeleteStory:h,storyNameForDeletion:g,workflowImprovementIssueUrl:_})=>{let v=Td(n,t,e),b=(0,y.useCallback)(e=>Di(e,t.url),[t.url]),S=(0,y.useCallback)((e,t)=>(0,x.jsx)(Ad,{cache:n.state,href:e,fallbackText:t}),[n.state]),C=t.isPr||t.relatedOpenPullRequestUrls.length>0||v.relatedPullRequests.length>0,[w,T]=(0,y.useState)([]),ee=(0,y.useCallback)(async(e,t,n,r)=>{T(i=>[...i,{path:e,line:t,side:n,body:r}])},[]),[te,E]=(0,y.useState)([]),ne=(0,y.useCallback)(async e=>{let n=await r.addComment(t,e);return E(e=>[...e,n]),n},[t,r]),re={onReview:e=>{let n=t.isPr?t.url:v.relatedPullRequests[0]?.pullRequest.url??t.relatedOpenPullRequestUrls[0]??t.url,a=e===`request_changes`?w:[];m({kind:{type:`review`,action:e},item:t,commit:()=>r.reviewPullRequest(t,n,e,a),offline:i==null?void 0:Md(i,t,n,e,a)})},onSetNextActionDate:e=>{m({kind:{type:`next_action_date`,action:e},item:t,commit:()=>r.setNextActionDate(t,e),offline:i==null?void 0:Nd(i,t,e)})},onSetStory:e=>{m({kind:{type:`set_story`,optionName:e.name},item:t,commit:()=>r.setStory(t,e),offline:i==null?void 0:Nd(i,t,`set_story`,{storyOptionId:e.id})})},onSetAgent:e=>{m({kind:{type:`set_agent`,optionName:e.name},item:t,commit:()=>r.setAgent(t,e),offline:i==null?void 0:Nd(i,t,`set_agent`,{agentOptionId:e.id})})},onSetStatus:e=>{m({kind:{type:`set_status`,optionName:e.name},item:t,commit:()=>r.setStatus(t,e),offline:i==null?void 0:Nd(i,t,`set_status`,{statusName:e.name})})},onSetInTmuxByHuman:e=>{m({kind:{type:`set_in_tmux_by_human`,optionName:e.name},item:t,commit:()=>r.setInTmuxByHuman(t,e),offline:i==null?void 0:Pd(i,t)})},onClose:e=>{m({kind:{type:`close`,action:e},item:t,commit:()=>r.closeIssue(t,e),offline:i==null?void 0:Nd(i,t,e)})},onOkAndAwaitingWorkspace:e=>{m({kind:{type:`ok_and_awaiting_workspace`},item:t,commit:()=>r.okAndMoveToAwaitingWorkspace(t,e),onAdvance:()=>r.patchItemOverlay(t,!0,{name:e.name,color:e.color}),revertAdvance:()=>r.patchItemOverlay(t,!1)})},onDeleteAllComments:()=>{m({kind:{type:`delete_all_comments`},item:t,commit:()=>r.deleteAllComments(t)})},onDeleteStory:h??null,onSetDependedIssueUrl:i==null?null:async e=>{await r.setDependedIssueUrl(t,e)}},ie=a.find(e=>e.name===`Awaiting Workspace`)??null,D=ie===null?void 0:async e=>(p?.(``),re.onSetStatus(ie),ne(e)),O=l??(t.story.trim()===``?null:t.story),ae=O===null?null:F(c,O);return(0,x.jsx)(ad,{item:t,storyName:O,storyColorEnum:ae,overlayStatus:u,statusOptions:a,state:v.state,stateError:v.stateError,body:v.body,bodyIsLoading:v.bodyIsLoading,bodyError:v.bodyError,comments:Dd(v.comments,te),commentsAreLoading:v.commentsAreLoading,commentsError:v.commentsError,files:v.files,filesAreLoading:v.filesAreLoading,filesError:v.filesError,commits:v.commits,commitsAreLoading:v.commitsAreLoading,commitsError:v.commitsError,pullRequestStatus:v.pullRequestStatus,pullRequestStatusError:v.pullRequestStatusError,relatedPullRequests:v.relatedPullRequests,relatedPullRequestsError:v.relatedPullRequestsError,now:d,buildImageProxyUrl:b,renderReferenceLink:S,onAddInlineComment:ee,workflowImprovementIssueUrl:_,commentComposer:(0,x.jsx)(yi,{initiallyOpen:!0,initialDraft:f,onSubmit:ne,onDraftChange:p,onOkAndAwaitingWorkspace:ie===null?void 0:()=>re.onOkAndAwaitingWorkspace(ie),onSubmitAndMoveToAwaitingWorkspace:D,onUploadFile:e=>r.uploadAttachment(t,e)}),operationBar:(0,x.jsx)(vd,{tab:e,item:t,hasPullRequest:C,rejectEnabled:w.length>0,statusOptions:a,storyOptions:o,currentStoryName:O,agentOptions:s,currentAgentName:t.agent,handlers:re,storyNameForDeletion:g})})},Id=()=>{let e={};for(let t of ae)e[t.name]=0;return e},Ld=`console`,Rd=()=>{let e=Cr(),t=qn(),n=vt(),r=n.status===`on`?n.snapshot:null,{snapshots:i,isLoading:a,error:o,refreshSingleTab:s}=ni(e,r),{timerMode:c,projectMinutes:l,isOpen:u,draftTimerMode:d,draftProjectMinutes:f,openSettings:p,closeSettings:m,saveSettings:h,toggleDraftTimerMode:g,changeDraftMinutes:_}=li(),{pjcodes:v,projectUrls:b,workflowImprovementIssueUrl:C,fleetTaskCreateUrl:w,isLoading:ee}=wr(),{isTimerExpired:te}=Or(e),E=xr(e??Ld),ne=Dr(v),re=(0,y.useMemo)(()=>{let e=Id();for(let t of ae){let n=i[t.name];n!==null&&(t.name===`stories`?e[t.name]=n.stories.filter(e=>e.color!==`GRAY`).length:e[t.name]=ir(n.items,or(E.overlay,n.generatedAt),t.name))}return e},[i,E.overlay]),ie=er(e,re),{activeTab:D,selectedItemKey:O,openItem:oe,closeItem:k}=ie,se=ri(ie.selectTab),ce=Tr((0,y.useCallback)(e=>ui(`/projects/${e}`),[])),M=(0,y.useRef)(new Map),N=(0,y.useCallback)(e=>{O!==null&&(e?M.current.set(O,e):M.current.delete(O))},[O]),le=zn(r),F=_r(e,D,E,le,(0,y.useCallback)(()=>s(`queued`),[s])),I=Fn(),[L,fe]=(0,y.useState)(()=>Date.now());(0,y.useEffect)(()=>{let e=setInterval(()=>{fe(Date.now())},1e3);return()=>{clearInterval(e)}},[]);let[pe,me]=(0,y.useState)(!1),[he,ge]=(0,y.useState)(``),[_e,ve]=(0,y.useState)(()=>navigator.onLine);(0,y.useEffect)(()=>{let e=()=>ve(!0),t=()=>ve(!1);return window.addEventListener(`online`,e),window.addEventListener(`offline`,t),()=>{window.removeEventListener(`online`,e),window.removeEventListener(`offline`,t)}},[]);let[ye,be]=(0,y.useState)(new Map),[xe,Se]=(0,y.useState)(new Map),[Ce,we]=(0,y.useState)(new Set);(0,y.useEffect)(()=>{if(!(!_e||I.offlineActions.length===0))for(let e of I.offlineActions)ye.has(e.id)||Ce.has(e.id)||(be(t=>new Map(t).set(e.id,null)),le.client.fetchIssueState(e.itemUrl).then(t=>{be(n=>new Map(n).set(e.id,t)),e.isPr&&(Se(t=>new Map(t).set(e.id,null)),le.client.fetchPullRequestStatus(e.itemUrl).then(t=>{Se(n=>new Map(n).set(e.id,t))}).catch(e=>{console.warn(`Failed to fetch PR status for offline action:`,e)}))}).catch(t=>{console.warn(`Failed to fetch current state for offline action:`,t),we(t=>new Set(t).add(e.id))}))},[_e,I.offlineActions,le.client,ye,Ce]);let[De,Oe]=(0,y.useState)(!1),Ae=(0,y.useCallback)(async e=>{Oe(!0);try{await I.confirmOfflineAction(e)}finally{Oe(!1)}},[I]),je=(0,y.useMemo)(()=>I.offlineActions.map(e=>{let t=ye.get(e.id)??null,n=xe.get(e.id)??null,r=Ce.has(e.id);return{id:e.id,message:e.message,color:e.color,itemNumber:e.itemNumber,isPr:e.isPr,currentTitle:r?null:t?.title??null,currentState:r||t===null?null:t.merged?`closed`:t.state,currentPrStatus:n,fetchError:r}}),[I.offlineActions,ye,xe,Ce]),Me=i[D],Ne=(0,y.useMemo)(()=>Me===null?[]:ar(Me.items,or(E.overlay,Me.generatedAt),D),[Me,E.overlay,D]),[Pe,Fe]=(0,y.useState)(null),Ie=(0,y.useMemo)(()=>{if(D!==`prs`)return{};let e={};for(let t of Ne)t.agent!==null&&t.agent!==``&&(e[t.agent]=(e[t.agent]??0)+1);return e},[Ne,D]);(0,y.useEffect)(()=>{D===`prs`&&Pe!==null&&(Ie[Pe]??0)===0&&Fe(null)},[Ie,Pe,D]);let Le=(0,y.useMemo)(()=>D!==`prs`||Pe===null?Ne:Ne.filter(e=>e.agent===Pe),[Ne,D,Pe]),Be=(0,y.useMemo)(()=>Le.map(e=>nr(e)),[Le]),Ve=Me?.storyOrder??[],He=(0,y.useMemo)(()=>de(Le,E.overlay,Ve,Me?.generatedAt??null),[Le,E.overlay,Ve,Me]),Ue=Me?.storyColors??{},qe=Me?.statusOptions??[],Je=Me?.agentOptions??[],Ye=Me?.storyOptions??[],Xe=Me?.generatedAt??null,Ze=Me?.fromCache??!1,[Qe,$e]=(0,y.useState)(null),et=(0,y.useMemo)(()=>O===null||Me===null?null:Me.items.find(e=>e.projectItemId===O)??null,[O,Me]);Gn(le,et,Ne),(0,y.useEffect)(()=>{O!==null&&window.scrollTo({top:0})},[O]),(0,y.useEffect)(()=>{if(e===null&&c&&v.length>0){let e=ci(v,null,l);e!==null&&di(`/projects/${e}`)}},[e,c,v,l]);let tt=re[D],nt=(0,y.useRef)({tab:D,count:tt});(0,y.useEffect)(()=>{let e=nt.current;if(nt.current={tab:D,count:tt},e.tab===D&&e.count>0&&tt===0){let e=Jn(D,re);e!==null&&(se(e),k())}},[D,tt,re,se,k]);let rt=et===null?null:sr(E.overlay,et,i[D]?.generatedAt??null),it=et===null?null:ue(et,E.overlay,i[D]?.generatedAt??null),at=(0,y.useCallback)(e=>{let t=fi(Be,e);t===null?k():oe(t)},[Be,oe,k]),ot=(0,y.useCallback)(t=>{if(n.status===`on`){I.showError(`Airplane mode`,`This action requires a network connection. Turn off airplane mode and try again.`);return}let r=nr(t.item);I.enqueue({message:bn(t.kind,t.item,D),color:vn(t.kind),commit:t.commit,offline:t.offline,revertAdvance:t.revertAdvance,advance:()=>{if(t.onAdvance?.(),!t.skipAdvance&&yn(t.kind,D)){if(c&&te(l[e??``]??0)){let t=ci(v,e,l);t!==null&&ui(`/projects/${t}`)}else at(r)}}})},[I,D,at,n.status,c,te,l,e,v]),st=zr((0,y.useCallback)(e=>{if(O===null||e===null)return;let t=e===`next`?pi(Be,O):mi(Be,O);t!==null&&oe(t)},[O,Be,oe])),[ct,lt]=(0,y.useState)(()=>localStorage.getItem(`console-story-show-gray`)===`true`),ut=(0,y.useCallback)(()=>{lt(e=>{let t=!e;return localStorage.setItem(`console-story-show-gray`,String(t)),t})},[]),dt=i.stories,ft=dt?.stories??[],pt=Qe!==null&&Qe.generatedAt===dt?.generatedAt?Qe.stories:ft,mt=dt?.defaultNameWithOwner??null,ht=(0,y.useMemo)(()=>et===null||!et.labels.includes(`story`)?null:pt.find(e=>e.storyName===et.story)??null,[et,pt]),gt=(0,y.useCallback)(async(t,n)=>{if(e===null)throw Error(`No project specified in the URL path.`);if(mt===null)throw Error(`No repository configured for this project.`);await Jt({pjcode:e,title:n,storyName:t,nameWithOwner:mt})},[e,mt]),_t=(0,y.useCallback)(({storyOptionId:t,agentOptionId:n,title:r,referenceUrl:i,files:a})=>{if(e===null||mt===null)return Promise.resolve();let o=e,s=mt,c=pt.find(e=>e.storyOptionId===t)?.storyName??``;return I.enqueue({message:`Task created — "${r}"`,color:`blue`,commit:async()=>{let e=await Jt({pjcode:o,title:r,storyName:c,nameWithOwner:s,agentOptionId:n??null,referenceUrl:i??null});if(a.length>0){let t=await Promise.all(a.map(async t=>{let n=zt(new Uint8Array(await t.arrayBuffer()));return Bt({pjcode:o,url:e,fileName:t.name,contentBase64:n})})),n=await Lt({pjcode:o,url:e,body:t.join(`
|
|
90
90
|
|
|
91
|
-
`)});if(!n.posted)throw Error(n.error)}},advance:()=>{}}),ge(``),Promise.resolve()},[e,mt,pt,I]),R=(0,y.useCallback)(async e=>{if(C===null)throw Error(`Workflow improvement repository is not configured.`);let t=/github\.com\/([A-Za-z0-9._-]+\/[A-Za-z0-9._-]+)\/issues\//.exec(C);if(t===null)throw Error(`Could not parse repository from workflowImprovementIssueUrl.`);let n=t[1];return Xt({nameWithOwner:n,title:e})},[C]),z=(0,y.useCallback)(async(t,n)=>{if(e===null)throw Error(`No project specified in the URL path.`);await Qt({pjcode:e,storyOptionId:t,direction:n});let r=pt.findIndex(e=>e.storyOptionId===t);if(r!==-1){let e=r+(n===`up`?-1:1);if(e>=0&&e<pt.length){let t=[...pt],n=t[r];t[r]=t[e],t[e]=n,$e({generatedAt:dt?.generatedAt,stories:t})}}},[e,pt,dt?.generatedAt]),yt=(0,y.useCallback)(async t=>{if(e===null)throw Error(`No project specified in the URL path.`);await Ht({pjcode:e,storyName:t})},[e]),[bt,xt]=(0,y.useState)({}),[St,Ct]=(0,y.useState)(null),[wt,Tt]=(0,y.useState)({}),Et=(0,y.useCallback)((t,n)=>{let r=pt.find(e=>e.storyOptionId===t)?.color;if(Ct(t),xt(e=>({...e,[t]:n})),Tt(e=>{let n={...e};return delete n[t],n}),e===null||mt===null){xt(e=>r===void 0?e:{...e,[t]:r}),Tt(e=>({...e,[t]:`No project or repository configured.`})),Ct(e=>e===t?null:e);return}qt({pjcode:e,storyOptionId:t,newColor:n,nameWithOwner:mt}).catch(e=>{xt(e=>r===void 0?e:{...e,[t]:r}),Tt(n=>({...n,[t]:e instanceof Error?e.message:String(e)}))}).finally(()=>{Ct(e=>e===t?null:e)})},[e,mt,pt]),Dt=(0,y.useCallback)(async t=>{if(e===null)throw Error(`No project specified in the URL path.`);await nn({pjcode:e,storyOptionId:t}),$e({generatedAt:dt?.generatedAt,stories:pt.filter(e=>e.storyOptionId!==t)})},[e,pt,dt?.generatedAt]),Ot=(0,y.useCallback)(async(t,n)=>{if(e===null)throw Error(`No project specified in the URL path.`);await an({pjcode:e,storyOptionId:t,newName:n});let r=pt.map(e=>e.storyOptionId===t?{...e,storyName:n}:e);$e({generatedAt:dt?.generatedAt,stories:r})},[e,pt,dt?.generatedAt]),kt=(0,y.useCallback)(async(t,n)=>{if(e===null)throw Error(`No project specified in the URL path.`);await sn({pjcode:e,storyOptionId:t,description:n});let r=pt.map(e=>e.storyOptionId===t?{...e,description:n}:e);$e({generatedAt:dt?.generatedAt,stories:r})},[e,pt,dt?.generatedAt]),At=Fr(Ne,le.comments,D===`prs`),jt=(0,y.useCallback)((e,t)=>{ot({kind:{type:`ok_and_awaiting_workspace`},item:e,commit:()=>F.okAndMoveToAwaitingWorkspace(e,t),skipAdvance:!0,onAdvance:()=>{E.patchOverlay(nr(e),{done:!0,status:{name:t.name,color:t.color}},D)},revertAdvance:()=>{E.patchOverlay(nr(e),{done:!1},D)}})},[ot,F,E,D]);return(0,x.jsxs)(`main`,{className:`console-app`,children:[I.pending!==null&&(0,x.jsx)(Ge,{message:I.pending.message,color:I.pending.color,remainingSeconds:I.pending.remainingSeconds,progress:I.pending.progress,onUndo:I.undo}),I.error!==null&&(0,x.jsx)(Ke,{title:I.error.message,message:`Operation failed: ${I.error.reason}`,onDismiss:I.dismissError}),(0,x.jsx)(We,{actions:je,isOnline:_e,isConfirming:De,onConfirm:Ae,onDiscard:I.discardOfflineAction}),ne.isOpen&&(0,x.jsx)(S,{pjcodes:v,inputValues:ne.inputValues,onChangeInput:ne.changeInput,isLoading:ne.isLoading,isSaving:ne.isSaving,error:ne.error,onSave:ne.save,onClose:ne.close}),(0,x.jsx)(A,{activeTab:D,counts:re,pjcode:e,pjcodes:v,generatedAt:Xe,fromCache:Ze,tabHref:ie.tabHref,onSelectTab:se,onSelectProject:ce,settingsButton:(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(j,{isOpen:u,isTimerActive:c,timerMode:d,projectMinutes:f,pjcodes:v,isLoadingPjcodes:ee,onOpen:p,onToggleTimerMode:g,onChangeMinutes:_,onSave:h,onClose:m}),(0,x.jsx)(`button`,{type:`button`,className:`console-tab-settings-button`,"aria-label":`Open max settings`,onClick:ne.open,children:`⚙`}),e!==null&&(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(`button`,{type:`button`,className:`console-task-create-button`,disabled:mt===null||pt.length===0,onClick:()=>me(!0),"aria-label":`Create new task`,title:`Create new task`,children:`+`}),pe&&(0,x.jsx)(P,{storyEntries:pt,agentOptions:Je,onSubmit:_t,onClose:()=>me(!1),initialTitle:he,onTitleChange:ge})]})
|
|
91
|
+
`)});if(!n.posted)throw Error(n.error)}},advance:()=>{}}),ge(``),Promise.resolve()},[e,mt,pt,I]),R=(0,y.useCallback)(async e=>{if(C===null)throw Error(`Workflow improvement repository is not configured.`);let t=/github\.com\/([A-Za-z0-9._-]+\/[A-Za-z0-9._-]+)\/issues\//.exec(C);if(t===null)throw Error(`Could not parse repository from workflowImprovementIssueUrl.`);let n=t[1];return Xt({nameWithOwner:n,title:e})},[C]),z=(0,y.useCallback)(async(t,n)=>{if(e===null)throw Error(`No project specified in the URL path.`);await Qt({pjcode:e,storyOptionId:t,direction:n});let r=pt.findIndex(e=>e.storyOptionId===t);if(r!==-1){let e=r+(n===`up`?-1:1);if(e>=0&&e<pt.length){let t=[...pt],n=t[r];t[r]=t[e],t[e]=n,$e({generatedAt:dt?.generatedAt,stories:t})}}},[e,pt,dt?.generatedAt]),yt=(0,y.useCallback)(async t=>{if(e===null)throw Error(`No project specified in the URL path.`);await Ht({pjcode:e,storyName:t})},[e]),[bt,xt]=(0,y.useState)({}),[St,Ct]=(0,y.useState)(null),[wt,Tt]=(0,y.useState)({}),Et=(0,y.useCallback)((t,n)=>{let r=pt.find(e=>e.storyOptionId===t)?.color;if(Ct(t),xt(e=>({...e,[t]:n})),Tt(e=>{let n={...e};return delete n[t],n}),e===null||mt===null){xt(e=>r===void 0?e:{...e,[t]:r}),Tt(e=>({...e,[t]:`No project or repository configured.`})),Ct(e=>e===t?null:e);return}qt({pjcode:e,storyOptionId:t,newColor:n,nameWithOwner:mt}).catch(e=>{xt(e=>r===void 0?e:{...e,[t]:r}),Tt(n=>({...n,[t]:e instanceof Error?e.message:String(e)}))}).finally(()=>{Ct(e=>e===t?null:e)})},[e,mt,pt]),Dt=(0,y.useCallback)(async t=>{if(e===null)throw Error(`No project specified in the URL path.`);await nn({pjcode:e,storyOptionId:t}),$e({generatedAt:dt?.generatedAt,stories:pt.filter(e=>e.storyOptionId!==t)})},[e,pt,dt?.generatedAt]),Ot=(0,y.useCallback)(async(t,n)=>{if(e===null)throw Error(`No project specified in the URL path.`);await an({pjcode:e,storyOptionId:t,newName:n});let r=pt.map(e=>e.storyOptionId===t?{...e,storyName:n}:e);$e({generatedAt:dt?.generatedAt,stories:r})},[e,pt,dt?.generatedAt]),kt=(0,y.useCallback)(async(t,n)=>{if(e===null)throw Error(`No project specified in the URL path.`);await sn({pjcode:e,storyOptionId:t,description:n});let r=pt.map(e=>e.storyOptionId===t?{...e,description:n}:e);$e({generatedAt:dt?.generatedAt,stories:r})},[e,pt,dt?.generatedAt]),At=Fr(Ne,le.comments,D===`prs`),jt=(0,y.useCallback)((e,t)=>{ot({kind:{type:`ok_and_awaiting_workspace`},item:e,commit:()=>F.okAndMoveToAwaitingWorkspace(e,t),skipAdvance:!0,onAdvance:()=>{E.patchOverlay(nr(e),{done:!0,status:{name:t.name,color:t.color}},D)},revertAdvance:()=>{E.patchOverlay(nr(e),{done:!1},D)}})},[ot,F,E,D]);return(0,x.jsxs)(`main`,{className:`console-app`,children:[I.pending!==null&&(0,x.jsx)(Ge,{message:I.pending.message,color:I.pending.color,remainingSeconds:I.pending.remainingSeconds,progress:I.pending.progress,onUndo:I.undo}),I.error!==null&&(0,x.jsx)(Ke,{title:I.error.message,message:`Operation failed: ${I.error.reason}`,onDismiss:I.dismissError}),(0,x.jsx)(We,{actions:je,isOnline:_e,isConfirming:De,onConfirm:Ae,onDiscard:I.discardOfflineAction}),ne.isOpen&&(0,x.jsx)(S,{pjcodes:v,inputValues:ne.inputValues,onChangeInput:ne.changeInput,isLoading:ne.isLoading,isSaving:ne.isSaving,error:ne.error,onSave:ne.save,onClose:ne.close}),(0,x.jsx)(A,{activeTab:D,counts:re,pjcode:e,pjcodes:v,generatedAt:Xe,fromCache:Ze,tabHref:ie.tabHref,onSelectTab:se,onSelectProject:ce,settingsButton:(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(j,{isOpen:u,isTimerActive:c,timerMode:d,projectMinutes:f,pjcodes:v,isLoadingPjcodes:ee,onOpen:p,onToggleTimerMode:g,onChangeMinutes:_,onSave:h,onClose:m}),(0,x.jsx)(`button`,{type:`button`,className:`console-tab-settings-button`,"aria-label":`Open max settings`,onClick:ne.open,children:`⚙`}),C!==null&&(0,x.jsx)(ze,{onCreateWorkflowTask:R}),e!==null&&(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(`button`,{type:`button`,className:`console-task-create-button`,disabled:mt===null||pt.length===0,onClick:()=>me(!0),"aria-label":`Create new task`,title:`Create new task`,children:`+`}),pe&&(0,x.jsx)(P,{storyEntries:pt,agentOptions:Je,onSubmit:_t,onClose:()=>me(!1),initialTitle:he,onTitleChange:ge})]})]}),airplaneModeEnabled:t.airplaneMode,airplaneModeStatus:n.status,airplaneModeProgress:n.progress,airplaneModeCapturedAt:r?.capturedAt??null,airplaneModeFailures:n.failures,onAirplaneModeStartSync:n.startSync,onAirplaneModeTurnOff:n.turnOff,projectUrl:e===null?null:b?.[e]??null,workflowImprovementIssueUrl:C,fleetTaskCreateUrl:w,now:L}),(0,x.jsx)(T,{timerEndsAt:Me?.timerEndsAt??null,timerTotalSeconds:Me?.timerTotalSeconds??null,now:L}),D===`stories`?(0,x.jsx)(`div`,{className:`console-list-screen`,children:(0,x.jsx)(Re,{stories:pt,isLoading:a,error:o,showGray:ct,onCreateIssue:gt,onAddStory:yt,onSelectColor:Et,onToggleGray:ut,onReorderStory:z,onDeleteStory:Dt,onRenameStory:Ot,onUpdateDescription:kt,optimisticColors:bt,colorChangeInFlight:St,colorErrors:wt})}):et===null?D===`queued`?(0,x.jsx)(`div`,{className:`console-list-screen`,children:(0,x.jsx)(ke,{rows:He,storyColors:Ue,statusOptions:qe,agentOptions:Je,activeItemId:null,isLoading:a,error:o,onSelectItem:e=>ie.openItem(e.projectItemId)})}):D===`prs`?(0,x.jsxs)(`div`,{className:`console-list-screen`,children:[(0,x.jsx)(Ee,{agentOptions:Je,agentCounts:Ie,selectedAgent:Pe,onAgentChange:Fe}),(0,x.jsx)(Te,{rows:He,storyColors:Ue,statusOptions:qe,activeItemId:null,now:L,isLoading:a,error:o,onSelectItem:e=>ie.openItem(e.projectItemId),executiveSummaries:At,onOkAndAwaitingWorkspace:jt})]}):(0,x.jsx)(`div`,{className:`console-list-screen`,children:(0,x.jsx)(Te,{rows:He,storyColors:Ue,statusOptions:qe,activeItemId:null,now:L,isLoading:a,error:o,onSelectItem:e=>ie.openItem(e.projectItemId)})}):(0,x.jsx)(`div`,{className:`console-detail-screen`,ref:st,children:(0,x.jsx)(Fd,{tab:D,item:et,caches:le,operations:F,pjcode:e,statusOptions:qe,storyOptions:Ye,agentOptions:Je,storyColors:Ue,storyName:it,overlayStatus:rt,now:L,initialCommentDraft:M.current.get(et.projectItemId)??``,onCommentDraftChange:N,onQueueAction:ot,onDeleteStory:ht===null?null:async()=>{await Dt(ht.storyOptionId),k()},storyNameForDeletion:ht?.storyName??null,workflowImprovementIssueUrl:C},et.projectItemId)})]})};`serviceWorker`in navigator&&navigator.serviceWorker.register(`/sw.js`).catch(e=>{console.warn(`Service worker registration failed:`,e)});var zd=document.getElementById(`root`);if(zd===null)throw Error(`Root container #root not found`);(0,b.createRoot)(zd).render((0,x.jsx)(y.StrictMode,{children:(0,x.jsx)(Rd,{})}));
|
|
@@ -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-BViZvDF2.js"></script>
|
|
8
8
|
<link rel="stylesheet" crossorigin href="/assets/index-DPmatwpI.css">
|
|
9
9
|
</head>
|
|
10
10
|
<body>
|