github-issue-tower-defence-management 2.133.5 → 2.133.7
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/README.md +2 -2
- package/bin/adapter/entry-points/cli/fleetConfig.js +1 -1
- package/bin/adapter/entry-points/cli/fleetConfig.js.map +1 -1
- package/bin/adapter/entry-points/console/ui-dist/assets/{index-vaBnpYtF.js → index-C_uSQ5ZH.js} +2 -2
- package/bin/adapter/entry-points/console/ui-dist/index.html +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -78,7 +78,7 @@ Options for serveWeb (and its deprecated alias serveConsole):
|
|
|
78
78
|
--dashboardDir <path> Directory containing the static dashboard HTML fragment tdpm.txt served at /tdpm.txt when compose mode is not active (default: the jsonpub directory)
|
|
79
79
|
--dashboardDataDir <path> Directory containing the dashboard data files (projects/<projectName>.json, machine-status.json, token-status.json); when set and every required file is present the server composes the /tdpm.txt fragment from them, otherwise it falls back to serving the static tdpm.txt from --dashboardDir (unset when not configured)
|
|
80
80
|
--dashboardProjectNames <names> Comma-separated project names, in display order, for the dashboard project grid; the display label of each project is its first 2 characters, which must be unique across the listed names
|
|
81
|
-
--fleetConfigFilePath <path> Path to the fleet-wide YAML config file; falls back to the TDPM_FLEET_CONFIG environment variable. When the file contains a top-level `workflowImprovementIssueUrl` string, the console tab bar displays a link that opens that URL in a new browser tab. When the file contains a `workflowIssueReporter` section with `owner` and `repo` fields, the console tab bar displays a + link for creating fleet-level tasks; the link opens `https://github.com/{owner}/{repo}/issues/new?assignees
|
|
81
|
+
--fleetConfigFilePath <path> Path to the fleet-wide YAML config file; falls back to the TDPM_FLEET_CONFIG environment variable. When the file contains a top-level `workflowImprovementIssueUrl` string, the console tab bar displays a link that opens that URL in a new browser tab. When the file contains a `workflowIssueReporter` section with `owner` and `repo` fields, the console tab bar displays a + link for creating fleet-level tasks; the link opens `https://github.com/{owner}/{repo}/issues/new?assignees={owner}` in a new browser tab, pre-assigning the owner, and, when `projectUrl` is set to a GitHub org (`https://github.com/orgs/{org}/projects/{n}`) or user (`https://github.com/users/{user}/projects/{n}`) project URL, also appends `?projects={owner}/{n}` so the new issue is automatically added to that project.
|
|
82
82
|
|
|
83
83
|
Options for selectOauthToken:
|
|
84
84
|
--tokenListJsonPath <path> Path to the JSON array of { name, token, selectionWeight? } records; selectionWeight is an optional positive number (default 1) that biases how often a token is chosen among eligible candidates (falls back to the CLAUDE_CODE_OAUTH_TOKEN_LIST_JSON_PATH environment variable)
|
|
@@ -181,7 +181,7 @@ The `notifyFinishedIssuePreparation` and `revertOrphanedPreparation` commands su
|
|
|
181
181
|
|
|
182
182
|
- `owner` (string, required): GitHub owner (organisation or user) of the repository where the workflow issue is created.
|
|
183
183
|
- `repo` (string, required): repository name under that owner.
|
|
184
|
-
- `projectUrl` (string, optional): URL of a GitHub ProjectV2 to which the newly created issue is added. When the project contains a story option whose name includes "workflow blocker" (case-insensitive), the issue's Story field is set to that option automatically. When this URL matches a GitHub org (`https://github.com/orgs/{org}/projects/{n}`) or user (`https://github.com/users/{user}/projects/{n}`) project URL, the fleet task creation console link also appends `?projects={org}/{n}` or `?projects={user}/{n}` (in addition to `assignees
|
|
184
|
+
- `projectUrl` (string, optional): URL of a GitHub ProjectV2 to which the newly created issue is added. When the project contains a story option whose name includes "workflow blocker" (case-insensitive), the issue's Story field is set to that option automatically. When this URL matches a GitHub org (`https://github.com/orgs/{org}/projects/{n}`) or user (`https://github.com/users/{user}/projects/{n}`) project URL, the fleet task creation console link also appends `?projects={org}/{n}` or `?projects={user}/{n}` (in addition to `assignees={owner}`) so that any new issue created from that link is automatically added to the project.
|
|
185
185
|
|
|
186
186
|
Example:
|
|
187
187
|
|
|
@@ -237,7 +237,7 @@ const loadFleetTaskCreateUrl = (fleetConfigFilePath) => {
|
|
|
237
237
|
queryParts.push(`projects=${projectParam}`);
|
|
238
238
|
}
|
|
239
239
|
}
|
|
240
|
-
queryParts.push(`assignees
|
|
240
|
+
queryParts.push(`assignees=${settings.owner}`);
|
|
241
241
|
return `${base}?${queryParts.join('&')}`;
|
|
242
242
|
};
|
|
243
243
|
exports.loadFleetTaskCreateUrl = loadFleetTaskCreateUrl;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fleetConfig.js","sourceRoot":"","sources":["../../../../src/adapter/entry-points/cli/fleetConfig.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,uCAAyB;AACzB,gDAAwB;AACxB,oHAGqE;AACrE,8FAA2F;AAI9E,QAAA,2CAA2C,GAAG,mBAAmB,CAAC;AAElE,QAAA,8CAA8C,GACzD,gCAAgC,CAAC;AACtB,QAAA,8BAA8B,GAAG,mBAAmB,CAAC;AACrD,QAAA,6BAA6B,GAAG,kBAAkB,CAAC;AACnD,QAAA,kCAAkC,GAAG,6BAA6B,CAAC;AACnE,QAAA,mCAAmC,GAAG,uBAAuB,CAAC;AAC9D,QAAA,+BAA+B,GAAG,2BAA2B,CAAC;AAE9D,QAAA,4CAA4C,GAAG,EAAE,CAAC;AAElD,QAAA,8BAA8B,GAAG,EAAE,CAAC;AACpC,QAAA,gCAAgC,GAAG,GAAG,CAAC;AAQvC,QAAA,mCAAmC,GAA8B;IAC5E,qBAAqB,EAAE,iDAAuB;IAC9C,oBAAoB,EAAE,sCAA8B;IACpD,qBAAqB,EAAE,wCAAgC;CACxD,CAAC;AAMW,QAAA,wCAAwC,GACnD;IACE,2BAA2B,EAAE,oDAA4C;CAC1E,CAAC;AAEG,MAAM,0BAA0B,GAAG,CACxC,QAAuB,EACR,EAAE;IACjB,IAAI,QAAQ,KAAK,IAAI,IAAI,QAAQ,KAAK,EAAE,EAAE,CAAC;QACzC,OAAO,QAAQ,CAAC;IAClB,CAAC;IACD,MAAM,eAAe,GACnB,OAAO,CAAC,GAAG,CAAC,mDAA2C,CAAC,CAAC;IAC3D,IAAI,eAAe,KAAK,SAAS,IAAI,eAAe,KAAK,EAAE,EAA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AC;QACpE,IAAI,YAAY,KAAK,IAAI,EAAE,CAAC;YAC1B,UAAU,CAAC,IAAI,CAAC,YAAY,YAAY,EAAE,CAAC,CAAC;QAC9C,CAAC;IACH,CAAC;IACD,UAAU,CAAC,IAAI,CAAC,aAAa,QAAQ,CAAC,KAAK,EAAE,CAAC,CAAC;IAC/C,OAAO,GAAG,IAAI,IAAI,UAAU,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC;AAC3C,CAAC,CAAC;AAjBW,QAAA,sBAAsB,0BAiBjC;AAEW,QAAA,8BAA8B,GAAG,0BAA0B,CAAC;AAElE,MAAM,4BAA4B,GAAG,CAC1C,mBAAkC,EACnB,EAAE;IACjB,IAAI,mBAAmB,KAAK,IAAI,EAAE,CAAC;QACjC,OAAO,IAAI,CAAC;IACd,CAAC;IACD,MAAM,GAAG,GAAG,wBAAwB,CAAC,mBAAmB,CAAC,CAAC;IAC1D,IAAI,GAAG,KAAK,IAAI,EAAE,CAAC;QACjB,OAAO,IAAI,CAAC;IACd,CAAC;IACD,MAAM,KAAK,GAAG,GAAG,CAAC,sCAA8B,CAAC,CAAC;IAClD,IAAI,KAAK,KAAK,SAAS,IAAI,KAAK,KAAK,IAAI,EAAE,CAAC;QAC1C,OAAO,IAAI,CAAC;IACd,CAAC;IACD,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QAC9B,MAAM,IAAI,KAAK,CACb,GAAG,sCAA8B,OAAO,mBAAmB,oBAAoB,CAChF,CAAC;IACJ,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC,CAAC;AApBW,QAAA,4BAA4B,gCAoBvC"}
|
package/bin/adapter/entry-points/console/ui-dist/assets/{index-vaBnpYtF.js → index-C_uSQ5ZH.js}
RENAMED
|
@@ -10,7 +10,7 @@ Error generating stack: `+e.message+`
|
|
|
10
10
|
|
|
11
11
|
`),ye=`In Tmux by human`,be=`Awaiting Workspace`,xe=[`In Tmux by human`,`Todo by human`,be],Se=e=>e===`todo-by-human`||e===`todo-by-agent`,Ce=({statusOptions:e,onOkAndAwaitingWorkspace:t})=>{let n=e.find(e=>e.name.toLowerCase()===be.toLowerCase());if(n===void 0)return null;let r=F(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`})})},we={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`]}},Te=({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`,Ee=({size:e=12,...t})=>{let n=Te(t),r=we[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))})},De=({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)(Ee,{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:ne(e.createdAt),children:k(e.createdAt,n)})]}),e.status!==null&&e.status!==``&&(0,x.jsx)(`span`,{className:`console-item-status-badge`,style:de(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]})})]})}),Oe=({story:e,count:t,colorEnum:n})=>{let r=F(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})]})},ke=({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)(Oe,{story:e.story,count:e.count,colorEnum:I(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)(De,{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)(Ce,{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]}),Ae=({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))]})})},je=e=>({...de(e),fontSize:`12px`,whiteSpace:`nowrap`,flexShrink:0}),Me=({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)(Ee,{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:je(a?.color??null),children:e.status}),e.agent!==null&&e.agent!==``&&(0,x.jsx)(`span`,{className:`console-queued-item-badge`,style:je(o?.color??null),children:e.agent})]}),(0,x.jsx)(`span`,{className:`console-queued-item-actions`})]})},Ne=({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)(Oe,{story:e.story,count:e.count,colorEnum:I(t,e.story)})},`group:${e.story}`):(0,x.jsx)(`li`,{className:`console-list-row`,children:(0,x.jsx)(Me,{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]}),Pe=Object.keys(P),Fe=({storyName:e,storyOptionId:t,onSelectColor:n,onClose:r,disabled:i})=>{(0,y.useEffect)(()=>{let e=e=>{e.key===`Escape`&&r()};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[r]);let a=e=>{n(t,e),r()};return(0,x.jsxs)(`div`,{className:`console-modal-dialog`,role:`dialog`,"aria-modal":`true`,"aria-label":`Change color for ${e}`,children:[(0,x.jsx)(`button`,{type:`button`,className:`console-modal-backdrop`,"aria-label":`Close dialog`,onClick:r}),(0,x.jsxs)(`div`,{className:`console-modal-inner`,children:[(0,x.jsxs)(`h2`,{className:`console-modal-title`,children:[`Change color for `,e]}),(0,x.jsx)(`div`,{className:`console-story-color-palette`,children:Pe.map(e=>{let t=P[e];return(0,x.jsx)(`button`,{type:`button`,className:`console-story-color-swatch`,"aria-label":e===`GRAY`?`${e} (disable)`:e,style:{backgroundColor:t.dot},onClick:()=>a(e),disabled:i,children:e===`GRAY`&&(0,x.jsx)(`span`,{className:`console-story-color-swatch-label`,children:`disable`})},e)})}),(0,x.jsx)(`div`,{className:`console-modal-actions`,children:(0,x.jsx)(`button`,{type:`button`,className:`console-op-button`,onClick:r,children:`Cancel`})})]})]})},Ie=({onSubmit:e,onClose:t})=>{let[n,r]=(0,y.useState)(``),[i,a]=(0,y.useState)(!1),[o,s]=(0,y.useState)(null),c=(0,y.useRef)(null);(0,y.useEffect)(()=>{c.current?.focus()},[]),(0,y.useEffect)(()=>{let e=e=>{e.key===`Escape`&&t()};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[t]);let l=async()=>{let r=n.trim();if(r.length===0){s(`Story name is required`);return}a(!0),s(null);try{await e(r),t()}catch(e){s(e instanceof Error?e.message:String(e))}finally{a(!1)}};return(0,x.jsxs)(`div`,{className:`console-modal-dialog`,role:`dialog`,"aria-modal":`true`,"aria-label":`Add story`,children:[(0,x.jsx)(`button`,{type:`button`,className:`console-modal-backdrop`,"aria-label":`Close dialog`,onClick:t}),(0,x.jsxs)(`div`,{className:`console-modal-inner`,children:[(0,x.jsx)(`h2`,{className:`console-modal-title`,children:`Add story`}),(0,x.jsxs)(`form`,{onSubmit:e=>{e.preventDefault(),l()},children:[(0,x.jsx)(`input`,{ref:c,type:`text`,className:`console-modal-input`,placeholder:`Story name`,value:n,onChange:e=>r(e.target.value),disabled:i}),o!==null&&(0,x.jsx)(`p`,{role:`alert`,className:`console-list-error`,children:o}),(0,x.jsxs)(`div`,{className:`console-modal-actions`,children:[(0,x.jsx)(`button`,{type:`submit`,className:`console-op-button`,disabled:i,children:i?`Creating…`:`Create`}),(0,x.jsx)(`button`,{type:`button`,className:`console-op-button`,onClick:t,disabled:i,children:`Cancel`})]})]})]})]})},Le=({storyName:e,isDeleting:t,deleteError:n,onConfirm:r,onCancel:i})=>((0,y.useEffect)(()=>{let e=e=>{e.key===`Escape`&&i()};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[i]),(0,x.jsxs)(`div`,{className:`console-modal-dialog`,role:`dialog`,"aria-modal":`true`,"aria-label":`Confirm story deletion`,children:[(0,x.jsx)(`button`,{type:`button`,className:`console-modal-backdrop`,"aria-label":`Close dialog`,onClick:i}),(0,x.jsxs)(`div`,{className:`console-modal-inner`,children:[(0,x.jsx)(`h2`,{className:`console-modal-title`,children:`Delete story`}),(0,x.jsxs)(`p`,{className:`console-story-delete-confirm-message`,children:[`Delete story option "`,e,`" from the GitHub custom field?`]}),n!==null&&(0,x.jsx)(`p`,{role:`alert`,className:`console-list-error`,children:n}),(0,x.jsxs)(`div`,{className:`console-modal-actions`,children:[(0,x.jsx)(`button`,{type:`button`,className:`console-op-button console-op-button-danger`,onClick:()=>r(!0),disabled:t,children:t?`Deleting…`:`Delete with child tasks`}),(0,x.jsx)(`button`,{type:`button`,className:`console-op-button console-op-button-danger`,onClick:()=>r(!1),disabled:t,children:t?`Deleting…`:`Keep child tasks`}),(0,x.jsx)(`button`,{type:`button`,className:`console-op-button`,onClick:i,disabled:t,children:`Cancel`})]})]})]})),Re=({currentDescription:e,onSubmit:t,onClose:n})=>{let[r,i]=(0,y.useState)(e),[a,o]=(0,y.useState)(!1),[s,c]=(0,y.useState)(null),l=(0,y.useRef)(null);(0,y.useEffect)(()=>{l.current?.focus(),l.current?.select()},[]),(0,y.useEffect)(()=>{let e=e=>{e.key===`Escape`&&n()};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[n]);let u=async()=>{o(!0),c(null);try{await t(r.trim()),n()}catch(e){c(e instanceof Error?e.message:String(e))}finally{o(!1)}};return(0,x.jsxs)(`div`,{className:`console-modal-dialog`,role:`dialog`,"aria-modal":`true`,"aria-label":`Edit story description`,children:[(0,x.jsx)(`button`,{type:`button`,className:`console-modal-backdrop`,"aria-label":`Close dialog`,onClick:n}),(0,x.jsxs)(`div`,{className:`console-modal-inner`,children:[(0,x.jsx)(`h2`,{className:`console-modal-title`,children:`Edit story description`}),(0,x.jsxs)(`form`,{onSubmit:e=>{e.preventDefault(),u()},children:[(0,x.jsx)(`textarea`,{ref:l,className:`console-modal-input`,placeholder:`Story description`,value:r,onChange:e=>i(e.target.value),disabled:a,rows:4}),s!==null&&(0,x.jsx)(`p`,{role:`alert`,className:`console-list-error`,children:s}),(0,x.jsxs)(`div`,{className:`console-modal-actions`,children:[(0,x.jsx)(`button`,{type:`submit`,className:`console-op-button`,disabled:a,children:a?`Saving…`:`Save`}),(0,x.jsx)(`button`,{type:`button`,className:`console-op-button`,onClick:n,disabled:a,children:`Cancel`})]})]})]})]})},ze=({currentName:e,onSubmit:t,onClose:n})=>{let[r,i]=(0,y.useState)(e),[a,o]=(0,y.useState)(!1),[s,c]=(0,y.useState)(null),l=(0,y.useRef)(null);(0,y.useEffect)(()=>{l.current?.focus(),l.current?.select()},[]),(0,y.useEffect)(()=>{let e=e=>{e.key===`Escape`&&n()};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[n]);let u=async()=>{let e=r.trim();if(e.length===0){c(`Story name is required`);return}o(!0),c(null);try{await t(e),n()}catch(e){c(e instanceof Error?e.message:String(e))}finally{o(!1)}};return(0,x.jsxs)(`div`,{className:`console-modal-dialog`,role:`dialog`,"aria-modal":`true`,"aria-label":`Rename story`,children:[(0,x.jsx)(`button`,{type:`button`,className:`console-modal-backdrop`,"aria-label":`Close dialog`,onClick:n}),(0,x.jsxs)(`div`,{className:`console-modal-inner`,children:[(0,x.jsx)(`h2`,{className:`console-modal-title`,children:`Rename story`}),(0,x.jsxs)(`form`,{onSubmit:e=>{e.preventDefault(),u()},children:[(0,x.jsx)(`input`,{ref:l,type:`text`,className:`console-modal-input`,placeholder:`Story name`,value:r,onChange:e=>i(e.target.value),disabled:a}),s!==null&&(0,x.jsx)(`p`,{role:`alert`,className:`console-list-error`,children:s}),(0,x.jsxs)(`div`,{className:`console-modal-actions`,children:[(0,x.jsx)(`button`,{type:`submit`,className:`console-op-button`,disabled:a,children:a?`Renaming…`:`Rename`}),(0,x.jsx)(`button`,{type:`button`,className:`console-op-button`,onClick:n,disabled:a,children:`Cancel`})]})]})]})]})},Be=({storyName:e,onSubmit:t,onClose:n})=>{let[r,i]=(0,y.useState)(``),[a,o]=(0,y.useState)(!1),[s,c]=(0,y.useState)(null),l=(0,y.useRef)(null);(0,y.useEffect)(()=>{l.current?.focus()},[]),(0,y.useEffect)(()=>{let e=e=>{e.key===`Escape`&&n()};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[n]);let u=async()=>{let i=r.trim();if(i.length===0){c(`Title is required`);return}o(!0),c(null);try{await t(e,i),n()}catch(e){c(e instanceof Error?e.message:String(e))}finally{o(!1)}};return(0,x.jsxs)(`div`,{className:`console-modal-dialog`,role:`dialog`,"aria-modal":`true`,"aria-label":`Add task to ${e}`,children:[(0,x.jsx)(`button`,{type:`button`,className:`console-modal-backdrop`,"aria-label":`Close dialog`,onClick:n}),(0,x.jsxs)(`div`,{className:`console-modal-inner`,children:[(0,x.jsxs)(`h2`,{className:`console-modal-title`,children:[`Add task to `,e]}),(0,x.jsxs)(`form`,{onSubmit:e=>{e.preventDefault(),u()},children:[(0,x.jsx)(`input`,{ref:l,type:`text`,className:`console-modal-input`,placeholder:`Issue title`,value:r,onChange:e=>i(e.target.value),disabled:a}),s!==null&&(0,x.jsx)(`p`,{role:`alert`,className:`console-list-error`,children:s}),(0,x.jsxs)(`div`,{className:`console-modal-actions`,children:[(0,x.jsx)(`button`,{type:`submit`,className:`console-op-button`,disabled:a,children:a?`Creating…`:`Create`}),(0,x.jsx)(`button`,{type:`button`,className:`console-op-button`,onClick:n,disabled:a,children:`Cancel`})]})]})]})]})},Ve=({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))}),He=({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)(!1),[b,S]=(0,y.useState)(null),[C,w]=(0,y.useState)(null),[T,ee]=(0,y.useState)(null),[E,D]=(0,y.useState)({}),[O,te]=(0,y.useState)(null),[k,A]=(0,y.useState)(null),[ne,j]=(0,y.useState)({}),re=e=>ne[e]??{inProgress:!1,error:null},M=async(e,t)=>{j(t=>({...t,[e]:{inProgress:!0,error:null}}));try{await c(e,t),j(t=>({...t,[e]:{inProgress:!1,error:null}}))}catch(t){j(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 ie=async(e,t)=>{D(t=>({...t,[e]:{isDeleting:!0,error:null}}));try{await l(e,t),ee(null),D(t=>({...t,[e]:{isDeleting:!1,error:null}}))}catch(t){D(n=>({...n,[e]:{isDeleting:!1,error:t instanceof Error?t.message:String(t)}}))}},ae=r?e:e.filter(e=>e.color!==`GRAY`),oe=e.some(e=>e.color===`GRAY`),N=h===null?null:e.find(e=>e.storyOptionId===h)??null,se=b===null?null:e.find(e=>e.storyOptionId===b)??null,ce=T===null?null:e.find(e=>e.storyOptionId===T)??null,le=T===null?{isDeleting:!1,error:null}:E[T]??{isDeleting:!1,error:null},ue=O===null?null:e.find(e=>e.storyOptionId===O)??null,P=k===null?null:e.find(e=>e.storyOptionId===k)??null;return(0,x.jsxs)(`div`,{className:`console-story-list-container`,children:[ae.length===0?(0,x.jsx)(`p`,{className:`console-list-empty`,children:`No active stories`}):(0,x.jsx)(`ul`,{className:`console-story-list`,children:ae.map((e,t)=>{let n=F(f[e.storyOptionId]??e.color),r=p===e.storyOptionId,i=m[e.storyOptionId]??null,{inProgress:a,error:o}=re(e.storyOptionId),s=t===0,c=t===ae.length-1,l=C===e.storyOptionId,u=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:()=>g(h===e.storyOptionId?null:e.storyOptionId),children:`Add task`}),(0,x.jsx)(`button`,{type:`button`,className:`console-op-button`,onClick:()=>S(b===e.storyOptionId?null:e.storyOptionId),disabled:r,children:`Change color`}),(0,x.jsx)(`button`,{type:`button`,className:`console-op-button`,"aria-label":`Move up`,disabled:s||a,onClick:()=>void M(e.storyOptionId,`up`),children:`↑`}),(0,x.jsx)(`button`,{type:`button`,className:`console-op-button`,"aria-label":`Move down`,disabled:c||a,onClick:()=>void M(e.storyOptionId,`down`),children:`↓`}),(0,x.jsx)(`button`,{type:`button`,className:`console-op-button console-op-button-danger`,"aria-label":`Delete story`,onClick:()=>ee(e.storyOptionId),children:`Delete`}),(0,x.jsx)(`button`,{type:`button`,className:`console-op-button`,"aria-label":`Rename story`,onClick:()=>te(O===e.storyOptionId?null:e.storyOptionId),children:`Rename`}),(0,x.jsx)(`button`,{type:`button`,className:`console-op-button`,"aria-label":`Edit description`,onClick:()=>A(k===e.storyOptionId?null:e.storyOptionId),children:`Edit description`}),(0,x.jsx)(`button`,{type:`button`,className:`console-op-button`,onClick:()=>w(l?null:e.storyOptionId),children:l?`Hide tasks`:`Show tasks`})]}),u!==``&&(0,x.jsx)(`p`,{className:`console-story-description`,children:u}),l&&(0,x.jsx)(Ve,{items:e.items}),o!==null&&(0,x.jsx)(`p`,{role:`alert`,className:`console-list-error`,children:o}),i!==null&&(0,x.jsx)(`p`,{role:`alert`,className:`console-list-error`,children:i})]},e.storyOptionId)})}),oe&&(0,x.jsx)(`button`,{type:`button`,className:`console-op-button`,onClick:s,children:r?`Hide archived`:`Show archived`}),(0,x.jsx)(`div`,{className:`console-add-story-section`,children:(0,x.jsx)(`button`,{type:`button`,className:`console-op-button`,onClick:()=>v(!_),children:`Add story`})}),N!==null&&(0,x.jsx)(Be,{storyName:N.storyName,onSubmit:(e,t)=>i(e,t),onClose:()=>g(null)}),_&&(0,x.jsx)(Ie,{onSubmit:e=>a(e),onClose:()=>v(!1)}),se!==null&&(0,x.jsx)(Fe,{storyName:se.storyName,storyOptionId:se.storyOptionId,onSelectColor:(e,t)=>{S(null),o(e,t)},onClose:()=>S(null),disabled:p===se.storyOptionId}),ce!==null&&(0,x.jsx)(Le,{storyName:ce.storyName,isDeleting:le.isDeleting,deleteError:le.error,onConfirm:e=>void ie(ce.storyOptionId,e),onCancel:()=>{ee(null),D({})}}),ue!==null&&(0,x.jsx)(ze,{currentName:ue.storyName,onSubmit:e=>u(ue.storyOptionId,e),onClose:()=>te(null)}),P!==null&&(0,x.jsx)(Re,{currentDescription:P.description??``,onSubmit:e=>d(P.storyOptionId,e),onClose:()=>A(null)})]})},Ue=e=>`${e.isPr?`PR`:`Issue`} #${e.itemNumber}`,We=e=>e===null?`loading…`:e,Ge=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(` · `)},Ke=e=>e.fetchError?`${Ue(e)} — failed to load current state`:e.currentTitle===null?`${Ue(e)} — loading current state…`:`${Ue(e)} — ${e.currentTitle} (${We(e.currentState)})`,qe=({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:Ke(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:Ge(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))]}),Je=({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))}%`}})]}),Ye=({title:e,message:t,onDismiss:n,onRetry:r})=>(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.jsxs)(`div`,{className:`console-error-toast-actions`,children:[r!==void 0&&(0,x.jsx)(`button`,{type:`button`,className:`console-error-toast-retry`,onClick:r,children:`Retry`}),(0,x.jsx)(`button`,{type:`button`,className:`console-error-toast-dismiss`,onClick:n,children:`Dismiss`})]})]}),Xe=(e,t)=>Object.keys(t.items).length===0&&t.failures.length>0?{status:`error`,failures:t.failures}:{status:`on`,snapshot:{capturedAt:t.capturedAt,tabs:e===null?t.tabs:{...e.tabs,...t.tabs},items:e===null?t.items:{...e.items,...t.items},failures:t.failures}},Ze=`tdpm-airplane-v1`,Qe=`/airplane-snapshot-data`,$e=`tdpm_airplane_mode_on`,et=()=>typeof localStorage>`u`?!1:localStorage.getItem($e)===`1`,tt=e=>{typeof localStorage>`u`||(e?localStorage.setItem($e,`1`):localStorage.removeItem($e))},nt=async e=>{if(typeof caches>`u`)throw Error(`Cache API unavailable`);try{await(await caches.open(Ze)).put(Qe,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}},rt=async()=>{if(typeof caches>`u`)return null;let e=await(await caches.open(Ze)).match(Qe);return e===void 0?null:e.json()},it=async()=>{typeof caches>`u`||await caches.delete(Ze)},z=e=>typeof e==`object`&&!!e&&!Array.isArray(e),B=e=>typeof e==`string`?e:``,at=e=>typeof e==`number`?e:0,ot=e=>e===!0,st=e=>Array.isArray(e)?e.filter(e=>typeof e==`string`):[],ct=e=>e===`MERGEABLE`?`MERGEABLE`:e===`CONFLICTING`?`CONFLICTING`:`UNKNOWN`,lt=e=>z(e)?{number:at(e.number),title:B(e.title),url:B(e.url),repo:B(e.repo),nameWithOwner:B(e.nameWithOwner),projectItemId:B(e.projectItemId),itemId:B(e.itemId),isPr:ot(e.isPr),story:B(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:st(e.dependedIssueUrls),labels:st(e.labels),createdAt:B(e.createdAt),relatedOpenPullRequestUrls:st(e.relatedOpenPullRequestUrls),agent:typeof e.agent==`string`?e.agent:null}:null,ut=e=>{if(!z(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(lt).filter(e=>e!==null):[],n=Array.isArray(e.statusOptions)?e.statusOptions.filter(z):[],r=Array.isArray(e.agentOptions)?e.agentOptions.filter(z):[],i=Array.isArray(e.storyOptions)?e.storyOptions.filter(z):[],a=Array.isArray(e.stories)?e.stories.filter(z):[],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:z(e.storyColors)?e.storyColors:{},stories:a,defaultNameWithOwner:typeof e.defaultNameWithOwner==`string`?e.defaultNameWithOwner:null,fromCache:!1,storyOrder:o,timerEndsAt:null,timerTotalSeconds:null}},dt=e=>z(e)?{author:B(e.author),body:B(e.body),createdAt:B(e.createdAt)}:null,ft=e=>z(e)?{path:B(e.path),additions:at(e.additions),deletions:at(e.deletions),status:B(e.status),patch:typeof e.patch==`string`?e.patch:null,rawUrl:typeof e.rawUrl==`string`?e.rawUrl:null}:null,pt=e=>z(e)?{sha:B(e.sha),message:B(e.message),author:B(e.author),authoredAt:B(e.authoredAt)}:null,mt=e=>z(e)?{found:ot(e.found),isConflicted:ot(e.isConflicted),mergeableStatus:ct(e.mergeableStatus),isPassedAllCiJob:ot(e.isPassedAllCiJob),isCiStateSuccess:ot(e.isCiStateSuccess),isBranchOutOfDate:ot(e.isBranchOutOfDate),missingRequiredCheckNames:st(e.missingRequiredCheckNames)}:{found:!1,isConflicted:!1,mergeableStatus:`UNKNOWN`,isPassedAllCiJob:!1,isCiStateSuccess:!1,isBranchOutOfDate:!1,missingRequiredCheckNames:[]},ht=e=>{if(!z(e))return null;let t=z(e.summary)?{title:B(e.summary.title),body:B(e.summary.body),additions:at(e.summary.additions),deletions:at(e.summary.deletions),changedFiles:at(e.summary.changedFiles)}:null;return{url:B(e.url),branchName:typeof e.branchName==`string`?e.branchName:null,createdAt:B(e.createdAt),isDraft:ot(e.isDraft),isConflicted:ot(e.isConflicted),mergeableStatus:ct(e.mergeableStatus),isPassedAllCiJob:ot(e.isPassedAllCiJob),isCiStateSuccess:ot(e.isCiStateSuccess),isResolvedAllReviewComments:ot(e.isResolvedAllReviewComments),isBranchOutOfDate:ot(e.isBranchOutOfDate),missingRequiredCheckNames:st(e.missingRequiredCheckNames),summary:t}},gt=e=>{if(!z(e))return{body:``,comments:[],state:{state:`open`,merged:!1,isPullRequest:!1,title:``},files:null,commits:null,prStatus:null,relatedPrs:null};let t=z(e.state)?e.state:{},n={state:B(t.state)||`open`,merged:ot(t.merged),isPullRequest:ot(t.isPullRequest),title:B(t.title)},r=e.files===null?null:Array.isArray(e.files)?e.files.map(ft).filter(e=>e!==null):null,i=e.commits===null?null:Array.isArray(e.commits)?e.commits.map(pt).filter(e=>e!==null):null,a=e.prStatus===null?null:mt(e.prStatus),o=e.relatedPrs===null?null:Array.isArray(e.relatedPrs)?e.relatedPrs.map(ht).filter(e=>e!==null):null;return{body:B(e.body),comments:Array.isArray(e.comments)?e.comments.map(dt).filter(e=>e!==null):[],state:n,files:r,commits:i,prStatus:a,relatedPrs:o}},_t=e=>{if(!z(e))return null;let t=typeof e.capturedAt==`string`?e.capturedAt:``,n=st(e.failures),r={};if(z(e.tabs))for(let[t,n]of Object.entries(e.tabs)){if(!z(n))continue;let e={};for(let[t,r]of Object.entries(n))e[t]=ut(r);r[t]=e}let i={};if(z(e.items))for(let[t,n]of Object.entries(e.items))i[t]=gt(n);return{capturedAt:t,tabs:r,items:i,failures:n}},vt=`/api/airplanesync`,yt=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}},bt=()=>{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);(0,y.useEffect)(()=>{if(!et())return;let e=!1;return rt().then(n=>{e||n===null||(a(n),t(`on`))}).catch(()=>{tt(!1)}),()=>{e=!0}},[]);let l=(0,y.useCallback)(async(e,n)=>{let i=e.getReader(),o=new TextDecoder,c=``;for(;;){let{done:e,value:l}=await i.read();if(e)break;c+=o.decode(l,{stream:!0});let u=c.split(`
|
|
12
12
|
|
|
13
|
-
`);c=u.pop()??``;for(let e of u){if(!e.startsWith(`data: `))continue;let i=yt(e.slice(6));if(i!==null){if(i.type===`progress`)r({fetched:typeof i.fetched==`number`?i.fetched:0,total:typeof i.total==`number`?i.total:0});else if(i.type===`done`){let e=_t(i.snapshot);if(e===null){t(`error`),s([`Failed to parse snapshot`]);return}let r=Xe(n,e);if(r.status===`error`){s(r.failures),t(`error`);return}let o=_t(r.snapshot);if(o===null){t(`error`),s([`Failed to merge snapshot`]);return}await nt(o),tt(!0),a(o),t(`on`),s(o.failures)}}}}},[]),u=(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(vt,{signal:e.signal}).then(async e=>{if(!e.ok||e.body===null){t(`error`),s([`HTTP ${e.status}`]);return}await l(e.body,null)}).catch(e=>{e instanceof Error&&e.name===`AbortError`||(t(`error`),s([e instanceof Error?e.message:String(e)]))})},[l]),d=(0,y.useCallback)(()=>{c.current!==null&&(c.current.abort(),c.current=null),t(`off`),a(null),r(null),s([]),tt(!1),it().catch(()=>{})},[]),f=(0,y.useCallback)((e,n)=>{if(n.length===0)return;c.current!==null&&c.current.abort();let i=new AbortController;c.current=i,t(`syncing`),r({fetched:0,total:n.length}),s([]),fetch(vt,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({targetUrls:n}),signal:i.signal}).then(async n=>{if(!n.ok||n.body===null){t(`error`),s([`HTTP ${n.status}`]);return}await l(n.body,e)}).catch(e=>{e instanceof Error&&e.name===`AbortError`||(t(`error`),s([e instanceof Error?e.message:String(e)]))})},[l]);return{status:e,progress:n,snapshot:i,failures:o,startSync:u,turnOff:d,retryFailed:()=>f(i,o)}},V=e=>typeof e==`object`&&!!e&&!Array.isArray(e),xt=e=>typeof e==`string`?e:``,St=e=>typeof e==`number`?e:0,Ct=e=>e===!0,wt=`console-api-v1`,Tt=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();V(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(wt).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(wt)).match(n);if(e!==void 0)return e.json()}}catch{}throw e}},Et=e=>!V(e)||!Array.isArray(e.comments)?[]:e.comments.filter(V).map(e=>({author:xt(e.author),body:xt(e.body),createdAt:xt(e.createdAt)})),Dt=e=>!V(e)||!Array.isArray(e.files)?[]:e.files.filter(V).map(e=>({path:xt(e.path)||xt(e.filename),additions:St(e.additions),deletions:St(e.deletions),status:xt(e.status),patch:typeof e.patch==`string`?e.patch:null,rawUrl:typeof e.rawUrl==`string`?e.rawUrl:null})),Ot=e=>!V(e)||!Array.isArray(e.commits)?[]:e.commits.filter(V).map(e=>({sha:xt(e.sha),message:xt(e.message),author:xt(e.author),authoredAt:xt(e.authoredAt)})),kt=e=>V(e)?{title:xt(e.title),body:xt(e.body),additions:St(e.additions),deletions:St(e.deletions),changedFiles:St(e.changedFiles)}:null,At=e=>Array.isArray(e)?e.filter(e=>typeof e==`string`):[],jt=e=>e===`MERGEABLE`?`MERGEABLE`:e===`CONFLICTING`?`CONFLICTING`:`UNKNOWN`,Mt=e=>!V(e)||!Array.isArray(e.relatedPullRequests)?[]:e.relatedPullRequests.filter(V).map(e=>({url:xt(e.url),branchName:typeof e.branchName==`string`?e.branchName:null,createdAt:xt(e.createdAt),isDraft:Ct(e.isDraft),isConflicted:Ct(e.isConflicted),mergeableStatus:jt(e.mergeableStatus),isPassedAllCiJob:Ct(e.isPassedAllCiJob),isCiStateSuccess:Ct(e.isCiStateSuccess),isResolvedAllReviewComments:Ct(e.isResolvedAllReviewComments),isBranchOutOfDate:Ct(e.isBranchOutOfDate),missingRequiredCheckNames:At(e.missingRequiredCheckNames),summary:kt(e.summary)})),Nt=e=>{if(!V(e)||!V(e.status))return{found:!1,isConflicted:!1,mergeableStatus:`UNKNOWN`,isPassedAllCiJob:!1,isCiStateSuccess:!1,isBranchOutOfDate:!1,missingRequiredCheckNames:[]};let t=e.status;return{found:!0,isConflicted:Ct(t.isConflicted),mergeableStatus:jt(t.mergeableStatus),isPassedAllCiJob:Ct(t.isPassedAllCiJob),isCiStateSuccess:Ct(t.isCiStateSuccess),isBranchOutOfDate:Ct(t.isBranchOutOfDate),missingRequiredCheckNames:At(t.missingRequiredCheckNames)}},Pt=e=>V(e)?{state:xt(e.state)||`open`,merged:Ct(e.merged),isPullRequest:Ct(e.isPullRequest),title:xt(e.title)}:{state:`open`,merged:!1,isPullRequest:!1,title:``},Ft=()=>({fetchItemBody:async e=>{let t=await Tt(`/api/itembody`,e);return V(t)?xt(t.body):``},fetchComments:async e=>Et(await Tt(`/api/comments`,e)),fetchPrFiles:async e=>Dt(await Tt(`/api/prfiles`,e)),fetchPrCommits:async e=>Ot(await Tt(`/api/prcommits`,e)),fetchRelatedPrs:async e=>Mt(await Tt(`/api/relatedprs`,e)),fetchIssueState:async e=>Pt(await Tt(`/api/issuetitle`,e)),fetchPullRequestStatus:async e=>Nt(await Tt(`/api/pullrequeststatus`,e))}),It=async e=>{let t=await e.text().catch(()=>``);if(t.length===0)return`HTTP ${e.status}`;try{let e=JSON.parse(t);if(V(e)&&typeof e.error==`string`)return e.error}catch{return t}return t},Lt=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 It(n))},Rt=`/api/comment`,zt=e=>({author:xt(e.author),body:xt(e.body),createdAt:xt(e.createdAt)}),Bt=async e=>{let t=await fetch(Rt,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)});if(!t.ok)return{posted:!1,error:await It(t),rateLimitResetAt:null};let n=await t.json();return V(n)?n.ok===!1?{posted:!1,error:typeof n.error==`string`?n.error:`upstream error`,rateLimitResetAt:typeof n.rateLimitResetAt==`string`?n.rateLimitResetAt:null}:V(n.comment)?{posted:!0,comment:zt(n.comment)}:{posted:!1,error:`comment was not returned`,rateLimitResetAt:null}:{posted:!1,error:`unexpected response shape`,rateLimitResetAt:null}},Vt=`/api/upload`,Ht=e=>{let t=``;for(let n of e)t+=String.fromCharCode(n);return btoa(t)},H=async e=>{let t=await fetch(Vt,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)});if(!t.ok)throw Error(await It(t));let n=await t.json();if(!V(n)||typeof n.markdown!=`string`)throw Error(`markdown was not returned`);return n.markdown},Ut=`/api/addstory`,Wt=async e=>{let t=await fetch(Ut,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)});if(!t.ok)throw Error(await It(t))},Gt=`/api/reviewcomment`,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 It(t))},qt=`/api/createissue`,Jt=`/api/storycolor`,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 It(t))},Xt=async e=>{let t=await fetch(qt,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)});if(!t.ok)throw Error(await It(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},Zt=`/api/createworkflowissue`,Qt=async e=>{let t=await fetch(Zt,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)});if(!t.ok)throw Error(await It(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},$t=`/api/reorderstory`,en=async e=>{let t=await fetch($t,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)});if(!t.ok)throw Error(await It(t))},tn=`/api/deleteallcomments`,nn=async e=>{let t=await fetch(tn,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)});if(!t.ok)throw Error(await It(t))},rn=`/api/deletestory`,an=async e=>{let t=await fetch(rn,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)});if(!t.ok)throw Error(await It(t))},on=`/api/renamestory`,sn=async e=>{let t=await fetch(on,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)});if(!t.ok)throw Error(await It(t))},cn=`/api/storydescription`,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 It(t))},un=e=>typeof e!=`object`||!e||Array.isArray(e)?null:Object.fromEntries(Object.entries(e).filter(e=>typeof e[1]==`string`)),dn=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,fleetTaskCreateUrl:null,nameWithOwnerByPjcode:null};let n=t;return{pjcodes:Array.isArray(n.pjcodes)?n.pjcodes.filter(e=>typeof e==`string`):[],projectUrls:un(n.projectUrls),fleetTaskCreateUrl:typeof n.fleetTaskCreateUrl==`string`?n.fleetTaskCreateUrl:null,nameWithOwnerByPjcode:un(n.nameWithOwnerByPjcode)}},fn=`/api/projectreadmeconfig`,pn=async e=>{let t=`${fn}?pjcode=${encodeURIComponent(e)}`,n=await fetch(t);if(!n.ok)throw Error(await It(n));let r=await n.json();return{maximumPreparingIssuesCount:V(r)&&typeof r.maximumPreparingIssuesCount==`number`?r.maximumPreparingIssuesCount:null}},mn=`/api/renameissue`,hn=async e=>{let t=await fetch(mn,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)});if(!t.ok)throw Error(await It(t))},gn=`/api/setdependedissueurl`,_n=async e=>{let t=await fetch(gn,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)});if(!t.ok)throw Error(await It(t))},vn=`/api/projectsettings`,yn=async e=>{let t=await fetch(vn,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)});if(!t.ok)throw Error(await It(t))},bn=5e3,xn=e=>`${e.isPr?`PR #`:`#`}${e.number}`,Sn=(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 +1h`:e.action===`snooze_3hours`?`Next Action Hour +3h`:e.action===`snooze_6hours`?`Next Action Hour +6h`:e.action===`snooze_1day`?`Next Action Date +1d`:e.action===`snooze_2days`?`Next Action Date +2d`:e.action===`snooze_3days`?`Next Action Date +3d`:e.action===`snooze_5days`?`Next Action Date +5d`:e.action===`snooze_1month`?`Next Action Date +1mo`:Se(t)?`Next Action Date +1w skip`:`Next Action Date +1w`;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`}},Cn=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`}},wn=(e,t)=>e.type===`next_action_date`?Se(t):e.type!==`delete_all_comments`,Tn=(e,t,n)=>`${Sn(e,n)} — ${xn(t)}`,En=`console-comment-expanded:`,Dn=e=>{try{let t=localStorage.getItem(En+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}},On=(e,t)=>{try{localStorage.setItem(En+e,JSON.stringify([...t]))}catch(e){console.error(`Failed to save comment expanded state to storage:`,e)}},kn=()=>{let e=[];for(let t=0;t<localStorage.length;t++){let n=localStorage.key(t);n?.startsWith(En)&&e.push(n)}for(let t of e)localStorage.removeItem(t)},An=`console-offline-action-queue`,jn=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},Mn=()=>{try{let e=localStorage.getItem(An);if(e===null)return[];let t=JSON.parse(e);return Array.isArray(t)?t.filter(jn):[]}catch{return[]}},Nn=e=>{localStorage.setItem(An,JSON.stringify(e))},Pn=()=>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)}`,Fn=e=>e instanceof TypeError,In=e=>e instanceof Error&&e.message.length>0?e.message:String(e),Ln=100,Rn=e=>Math.max(0,Math.ceil((bn-e)/1e3)),zn=e=>Math.max(0,1-e/bn),Bn=()=>{let[e,t]=(0,y.useState)(null),[n,r]=(0,y.useState)(null),[i,a]=(0,y.useState)(Mn),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.useRef)(()=>{}),f=(0,y.useCallback)(()=>{l.current!==null&&(clearInterval(l.current),l.current=null)},[]),p=(0,y.useCallback)(e=>{if(e.offline===void 0)return;let t={id:Pn(),message:e.message,color:e.color,enqueuedAt:Date.now(),...e.offline};a(e=>{let n=[...e,t];return Nn(n),n})},[]),m=(0,y.useCallback)(e=>{e.commit().catch(t=>{Fn(t)&&e.offline!==void 0?p(e):r({message:e.message,reason:In(t),retry:()=>d.current(e)})})},[p]);d.current=m;let h=(0,y.useCallback)(()=>{let e=s.current;f(),s.current=null,t(null),e!==null&&!u.current&&(u.current=!0,kn(),m(e))},[f,m]),g=(0,y.useCallback)(()=>{let e=s.current;f(),s.current=null,u.current=!0,t(null),e?.revertAdvance?.(),e?.revertOptimistic?.()},[f]),_=(0,y.useCallback)(()=>{r(null)},[]),v=(0,y.useCallback)((e,t)=>{r({message:e,reason:t})},[]),b=(0,y.useCallback)(e=>{a(t=>{let n=t.filter(t=>t.id!==e);return Nn(n),n})},[]),x=(0,y.useCallback)(async e=>{let t=o.current.find(t=>t.id===e);if(t!==void 0)try{await Lt(t.apiPath,t.requestBody),b(e)}catch(n){Fn(n)?r({message:t.message,reason:`Still offline — action is still held in the queue`}):(r({message:t.message,reason:In(n)}),b(e))}},[b]),S=(0,y.useCallback)(e=>{if(s.current!==null&&!u.current){let e=s.current;f(),u.current=!0,kn(),m(e)}u.current=!1,s.current=e,c.current=Date.now(),t({message:e.message,color:e.color,remainingSeconds:Rn(0),progress:zn(0)}),e.advance(),e.optimistic?.(),l.current=setInterval(()=>{let n=Date.now()-c.current;if(n>=5e3){h();return}t({message:e.message,color:e.color,remainingSeconds:Rn(n),progress:zn(n)})},Ln)},[f,h,m]);return(0,y.useEffect)(()=>h,[h]),{pending:e,error:n,offlineActions:i,enqueue:S,showError:v,undo:g,dismissError:_,confirmOfflineAction:x,discardOfflineAction:b}},Vn=e=>typeof e==`object`&&!!e&&!Array.isArray(e),Hn=e=>Array.isArray(e)?e.filter(e=>typeof e==`string`):[],Un=e=>Array.isArray(e)?e.filter(Vn).map(e=>({...e,relatedOpenPullRequestUrls:Hn(e.relatedOpenPullRequestUrls)})):[],Wn=e=>!Vn(e)||!Array.isArray(e.items)?[]:Un(e.items),Gn=e=>Array.isArray(e)?e.filter(Vn):[],Kn=e=>Array.isArray(e)?e.filter(Vn).map(e=>({...e,items:Un(e.items)})):[],qn=e=>({items:Wn(e),generatedAt:Vn(e)&&typeof e.generatedAt==`string`?e.generatedAt:``,statusOptions:Vn(e)?Gn(e.statusOptions):[],agentOptions:Vn(e)?Gn(e.agentOptions):[],storyOptions:Vn(e)?Gn(e.storyOptions):[],storyColors:Vn(e)&&Vn(e.storyColors)?e.storyColors:{},stories:Vn(e)?Kn(e.stories):[],defaultNameWithOwner:Vn(e)&&typeof e.defaultNameWithOwner==`string`?e.defaultNameWithOwner:null,storyOrder:Vn(e)?Hn(e.storyOrder):[],timerEndsAt:Vn(e)&&typeof e.timerEndsAt==`string`?e.timerEndsAt:null,timerTotalSeconds:Vn(e)&&typeof e.timerTotalSeconds==`number`&&e.timerTotalSeconds>0?e.timerTotalSeconds:null}),Jn=()=>{let e={};for(let t of j)e[t.name]=null;return e},Yn=(e,t)=>`/projects/${e}/${t}/list.json`,Xn=6e4,Zn=`console-list-v1`,Qn=(e,t)=>{try{if(!(`caches`in globalThis))return;globalThis.caches.open(Zn).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)}},$n=async e=>{if(!(`caches`in globalThis))return null;try{let t=await(await globalThis.caches.open(Zn)).match(e);return t===void 0?null:{...qn(await t.json()),fromCache:!0}}catch{return null}},er=async e=>{let t=await Promise.all(j.map(async t=>({tabName:t.name,snapshot:await $n(Yn(e,t.name))}))),n=Jn();for(let{tabName:e,snapshot:r}of t)n[e]=r;return n},tr=async(e,t)=>{let n=Yn(e,t);try{let e=await fetch(n);if(!e.ok)throw Error(`HTTP ${e.status}`);let t=await e.json();return Qn(n,t),{snapshot:{...qn(t),fromCache:!1},error:null}}catch(e){let t=await $n(n);return t===null?{snapshot:null,error:e instanceof Error?e:Error(String(e))}:{snapshot:t,error:null}}},nr=async e=>{await Promise.all(j.map(async t=>{let n=Yn(e,t.name);try{let e=await fetch(n);if(!e.ok)return;Qn(n,await e.json())}catch{}}))},rr=async e=>{let t=await Promise.all(j.map(async t=>{let{snapshot:n,error:r}=await tr(e,t.name);return{tabName:t.name,snapshot:n,error:r}})),n=Jn(),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}},ir=(e,t=null)=>{let n=(0,y.useRef)(new Map),[r,i]=(0,y.useState)(Jn),[a,o]=(0,y.useState)(!0),[s,c]=(0,y.useState)(null),[l,u]=(0,y.useState)(e);if(l!==e){u(e);let t=e===null?null:n.current.get(e)??null;i(t??Jn()),t!==null&&o(!1)}return(0,y.useEffect)(()=>{if(t!==null&&e!==null){let n=t.tabs[e];if(n!==void 0){let e=Jn();for(let t of j){let r=n[t.name];r!==void 0&&(e[t.name]={...r})}i(e),o(!1),c(null);return}}let r=!1,a=!1;if(c(null),e===null)return i(Jn()),o(!1),c(`No project specified in the URL path.`),()=>{r=!0};let s=n.current.has(e);er(e).then(t=>{if(r)return;let c=Object.values(t).some(e=>e!==null);c&&!a?(n.current.set(e,t),i(t),o(!1)):!c&&!a&&!s&&(o(!0),i(Jn()))});let l=()=>{rr(e).then(({snapshots:t,firstError:s})=>{r||(a=!0,n.current.set(e,t),i(t),c(s===null?null:s.message),o(!1))}).catch(e=>{r||(a=!0,c(e instanceof Error?e.message:String(e)),o(!1))})};l();let u=setInterval(l,Xn);return()=>{r=!0,clearInterval(u)}},[e,t]),{snapshots:r,isLoading:a,error:s,refreshSingleTab:(0,y.useCallback)(async t=>{if(e===null)return;let{snapshot:r}=await tr(e,t);r!==null&&i(i=>{let a={...i,[t]:r};return n.current.set(e,a),a})},[e])}},ar=(e,t,n)=>{(0,y.useEffect)(()=>{if(!n)return;let r=t.filter(t=>t!==e);if(r.length===0)return;let i=()=>{for(let e of r)nr(e).catch(()=>{})};i();let a=setInterval(i,Xn);return()=>{clearInterval(a)}},[n,e,t])},or=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)}},sr=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},cr=(e,t)=>{for(let[n,r]of Object.entries(t.items)){let t=sr(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)}},lr=(e=null)=>(0,y.useMemo)(()=>{let t=Ft(),n={client:t,body:new or(t.fetchItemBody),comments:new or(t.fetchComments),files:new or(t.fetchPrFiles),commits:new or(t.fetchPrCommits),relatedPrs:new or(t.fetchRelatedPrs),state:new or(t.fetchIssueState),prStatus:new or(t.fetchPullRequestStatus)};return e!==null&&cr(n,e),n},[e]),ur=0,dr=500,fr=2e3,pr=e=>{let t=window;if(typeof t.requestIdleCallback==`function`&&typeof t.cancelIdleCallback==`function`){let n=t.requestIdleCallback(e,{timeout:fr});return{cancel:()=>t.cancelIdleCallback?.(n)}}let n=window.setTimeout(e,0);return{cancel:()=>window.clearTimeout(n)}},mr=(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)},hr=(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+ur);if(i.length===0)return;let a=null,o=window.setTimeout(()=>{a=pr(()=>{for(let t of i)mr(e,t)})},dr);return()=>{window.clearTimeout(o),a?.cancel()}},[e,t,n])},gr=`/api/features`,_r=()=>{let[e,t]=(0,y.useState)({airplaneMode:!1});return(0,y.useEffect)(()=>{fetch(gr).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},vr=(e,t)=>{let n=j.findIndex(t=>t.name===e);if(n===-1)return null;for(let e=n+1;e<j.length;e+=1){let n=j[e];if(n.isNavigable!==!1&&(t[n.name]??0)>0)return n.name}return null},yr=e=>{let t=j.filter(e=>e.isNavigable!==!1);for(let n of t)if((e[n.name]??0)>0)return n.name;return t[0].name},br=new Set(j.map(e=>e.name)),xr=e=>{let t=e.split(`/`).filter(e=>e.length>0);if(t.length<3||t[0]!==`projects`)return null;let n=t[2];return br.has(n)?n:null},Sr=e=>{if(!e.startsWith(`#item/`))return null;let t=e.slice(6);return t.length===0?null:decodeURIComponent(t)},Cr=`#settings`,wr=(e,t,n=new Set,r)=>{let i=(0,y.useCallback)(()=>{let e=yr(t);return typeof window>`u`?{activeTab:e,selectedItemKey:null}:{activeTab:xr(window.location.pathname)??e,selectedItemKey:Sr(window.location.hash)}},[t]),[a,o]=(0,y.useState)(i),s=(0,y.useRef)(null);s.current=e,(0,y.useEffect)(()=>{if(typeof window>`u`)return;let e=()=>{o(i())};return window.addEventListener(`popstate`,e),window.addEventListener(`hashchange`,e),()=>{window.removeEventListener(`popstate`,e),window.removeEventListener(`hashchange`,e)}},[i]),(0,y.useEffect)(()=>{if(typeof window>`u`)return;let e=xr(window.location.pathname),i=Object.values(t).some(e=>e>0),a=r??t;if(e!==null){if(t[e]>0||a[e]>0){o(t=>t.activeTab===e?t:{...t,activeTab:e});return}if(!n.has(e))return}let c=yr(t);i&&s.current!==null&&window.history.replaceState({},``,`/projects/${s.current}/${c}${window.location.search}`),o(e=>e.activeTab===c?e:{...e,activeTab:c})},[t,n,r]);let c=(0,y.useCallback)(t=>e===null?`#${t}`:`/projects/${e}/${t}`,[e]),l=(0,y.useCallback)(e=>{if(typeof window>`u`){o({activeTab:e,selectedItemKey:null});return}window.history.pushState({},``,c(e)),o({activeTab:e,selectedItemKey:null})},[c]),u=(0,y.useCallback)(e=>{typeof window<`u`&&(window.location.hash=`#item/${encodeURIComponent(e)}`),o(t=>({...t,selectedItemKey:e}))},[]),d=(0,y.useCallback)(()=>{if(typeof window<`u`&&window.location.hash!==``){let e=`${window.location.pathname}${window.location.search}`;window.history.pushState({},``,e)}o(e=>({...e,selectedItemKey:null}))},[]);return{activeTab:a.activeTab,selectedItemKey:a.selectedItemKey,tabHref:c,selectTab:l,openItem:u,closeItem:d}},Tr=e=>`pv_overlay_${e}`,Er=e=>e.projectItemId===``?e.itemId:e.projectItemId,Dr=(e,t)=>e!==void 0&&e.done===!0&&e.mode===t,Or=(e,t,n)=>e.filter(e=>!Dr(t[Er(e)],n)).length,kr=(e,t,n)=>e.filter(e=>!Dr(t[Er(e)],n)),Ar=(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},jr=(e,t,n)=>{if(n===null)return null;let r=Date.parse(n);if(Number.isNaN(r))return null;let i=e[Er(t)];return i===void 0||i.ts<r?null:i.status??null},Mr=(e,t,n,r,i)=>{let a={...e[t]??{},...n,ts:i,mode:r};return{...e,[t]:a}},Nr=(e,t)=>{let n={...e};return delete n[t],n},Pr=`/api/review`,Fr=`/api/triage`,Ir=`/api/intmux`,Lr=(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:ve(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:he}:{pjcode:e,action:`unnecessary`,prUrl:n,projectItemId:t.projectItemId,issueUrl:t.url,commentBody:ge,issueCommentBody:_e(n)}},Rr=(e,t,n,r)=>({pjcode:e,action:n,issueUrl:t.url,projectItemId:t.projectItemId,...r??{}}),zr=(e,t)=>({pjcode:e,action:`set_intmux`,issueUrl:t.url,projectItemId:t.projectItemId}),Br=()=>Error(`No project specified in the URL path.`),Vr=`ok`,Hr=(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)(async(t,n,r,i=[])=>{if(e===null)throw Br();await Lt(Pr,Lr(e,t,n,r,i)),o(t)},[e,o]),c=(0,y.useCallback)(async(t,n)=>{if(e===null)throw Br();await Lt(Fr,{pjcode:e,action:n,issueUrl:t.url,projectItemId:t.projectItemId}),o(t)},[e,o]),l=(0,y.useCallback)(async(t,n)=>{if(e===null)throw Br();await Lt(Fr,{pjcode:e,action:`set_agent`,issueUrl:t.url,projectItemId:t.projectItemId,agentOptionId:n.id}),o(t)},[e,o]),u=(0,y.useCallback)(async(t,n)=>{if(e===null)throw Br();await Lt(Fr,{pjcode:e,action:`set_story`,issueUrl:t.url,projectItemId:t.projectItemId,storyOptionId:n.id}),o(t)},[e,o]),d=(0,y.useCallback)(async(t,n)=>{if(e===null)throw Br();await Lt(Fr,{pjcode:e,action:`set_status`,issueUrl:t.url,projectItemId:t.projectItemId,statusName:n.name}),o(t)},[e,o]),f=(0,y.useCallback)(async(t,n)=>{if(e===null)throw Br();await Lt(Ir,{pjcode:e,action:`set_intmux`,issueUrl:t.url,projectItemId:t.projectItemId}),o(t)},[e,o]),p=(0,y.useCallback)(async(t,n)=>{if(e===null)throw Br();await Lt(Fr,{pjcode:e,action:n,issueUrl:t.url,projectItemId:t.projectItemId}),o(t)},[e,o]),m=(0,y.useCallback)(async(t,n)=>{if(e===null)throw Br();let r=await Bt({pjcode:e,url:t.url,body:Vr});if(await Lt(Fr,{pjcode:e,action:`set_status`,issueUrl:t.url,projectItemId:t.projectItemId,statusName:n.name}),o(t),await i?.(),!r.posted){let e=r.rateLimitResetAt===null?``:` Rate limit resets at ${r.rateLimitResetAt}.`;throw Error(`Comment not posted — ${r.error}.${e} Status was changed. Re-post: ${Vr}`)}},[e,o,i]),h=(0,y.useCallback)(async(t,n)=>{if(e===null)throw Br();let r=await Bt({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]),g=(0,y.useCallback)(async(t,n)=>{if(e===null)throw Error(`no project in the URL path`);let r=Ht(new Uint8Array(await n.arrayBuffer()));return H({pjcode:e,url:t.url,fileName:n.name,contentBase64:r})},[e]),_=(0,y.useCallback)((e,n,r)=>{a(Er(e),{done:n,...r===void 0?{}:{status:r}},t)},[a,t]);return{reviewPullRequest:s,setNextActionDate:c,setStory:u,setAgent:l,setStatus:d,setInTmuxByHuman:f,closeIssue:p,okAndMoveToAwaitingWorkspace:m,addComment:h,uploadAttachment:g,addInlineReviewComment:(0,y.useCallback)(async(t,n,r,i,a)=>{if(e===null)throw Br();await Kt({pjcode:e,url:t,path:n,line:r,side:i,body:a})},[e]),issueRename:(0,y.useCallback)(async(e,t)=>{await hn({issueUrl:e.url,newTitle:t})},[]),deleteAllComments:(0,y.useCallback)(async e=>{await nn({issueUrl:e.url}),o(e)},[o]),setDependedIssueUrl:(0,y.useCallback)(async(t,n)=>{if(e===null)throw Br();await _n({pjcode:e,issueUrl:t.url,dependedIssueUrl:n})},[e]),patchItemOverlay:_}},Ur=e=>typeof e==`object`&&!!e&&typeof e.ts==`number`,Wr=e=>{if(typeof localStorage>`u`)return{};let t=localStorage.getItem(Tr(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))Ur(t)&&(r[e]=t);return r},Gr=(e,t)=>{typeof localStorage<`u`&&localStorage.setItem(Tr(e),JSON.stringify(t))},Kr=e=>{let[t,n]=(0,y.useState)(()=>Wr(e));return{overlay:t,patchOverlay:(0,y.useCallback)((t,r,i)=>{n(n=>{let a=Mr(n,t,r,i,Date.now());return Gr(e,a),a})},[e]),revertOverlayEntry:(0,y.useCallback)(t=>{n(n=>{let r=Nr(n,t);return Gr(e,r),r})},[e])}},qr=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},Jr=()=>{let[e,t]=(0,y.useState)(()=>qr(typeof window>`u`?``:window.location.pathname));return(0,y.useEffect)(()=>{let e=()=>{t(qr(window.location.pathname))};return window.addEventListener(`popstate`,e),()=>{window.removeEventListener(`popstate`,e)}},[]),e},Yr=()=>{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),dn().then(n=>{e||(t(n.pjcodes),r(n.projectUrls),a(n.fleetTaskCreateUrl),s(n.nameWithOwnerByPjcode),l(!1))}).catch(t=>{e||(d(t instanceof Error?t:Error(String(t))),l(!1))}),()=>{e=!0}},[]),{pjcodes:e,projectUrls:n,fleetTaskCreateUrl:i,nameWithOwnerByPjcode:o,isLoading:c,error:u}},Xr=e=>(0,y.useCallback)(t=>{kn(),e(t)},[e]),Zr=()=>typeof window<`u`&&window.location.hash===`#settings`,Qr=e=>{let[t,n]=(0,y.useState)(Zr),[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)(``),f=(0,y.useRef)(e);f.current=e,(0,y.useEffect)(()=>{if(!t)return;let e=!1;return u({}),i(!0),c(null),Promise.all(f.current.map(e=>pn(e).then(t=>({pjcode:e,value:t.maximumPreparingIssuesCount===null?``:String(t.maximumPreparingIssuesCount)})))).then(t=>{if(!e){let e={};for(let{pjcode:n,value:r}of t)e[n]=r;u(e)}}).catch(t=>{e||c(t instanceof Error?t.message:`Failed to load settings`)}).finally(()=>{e||i(!1)}),()=>{e=!0}},[t]),(0,y.useEffect)(()=>{if(typeof window>`u`)return;let e=()=>{let e=window.location.hash===Cr;e||c(null),n(e)};return window.addEventListener(`popstate`,e),window.addEventListener(`hashchange`,e),()=>{window.removeEventListener(`popstate`,e),window.removeEventListener(`hashchange`,e)}},[]);let p=(0,y.useCallback)(()=>{typeof window<`u`&&(d.current=window.location.hash,window.history.pushState({},``,Cr)),n(!0)},[]),m=(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)},[]),h=(0,y.useCallback)((e,t)=>{u(n=>({...n,[e]:t}))},[]),g=(0,y.useCallback)(async()=>{o(!0),c(null);try{if(await Promise.all(Object.entries(l).filter(([,e])=>{let t=parseInt(e,10);return!Number.isNaN(t)&&t>=0}).map(([e,t])=>yn({pjcode:e,maximumPreparingIssuesCount:parseInt(t,10)}))),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)}},[l]);return(0,y.useEffect)(()=>{if(!t)return;let e=e=>{e.key===`Escape`&&m()};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[t,m]),{isOpen:t,isLoading:r,isSaving:a,error:s,inputValues:l,open:p,close:m,changeInput:h,save:g}},$r=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,[])}},ei=/##\s+(?:エグゼクティブサマリ(?:\s*\/\s*Executive\s+Summary)?|Executive\s+Summary)\s*\n/i,ti=/^From:\s+:robot:/m,ni=/^##\s/m,ri=e=>{let t=ei.exec(e);if(t===null)return null;let n=e.slice(t.index+t[0].length),r=ti.exec(n),i=ni.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},ii=e=>{if(e.length===0)return null;let t=e[e.length-1],n=ri(t.body);if(n!==null)return n;let r=t.body.trim();return r.length>0?r:null},ai=e=>`${e.repo}#${e.number}`,oi=(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=ai(n),a=t.peek(e);if(a!==void 0){let e=ii(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=ii(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},si=(e,t)=>{let n=Math.abs(e);return n<60||n<=Math.abs(t)*1.5?null:e<0?`next`:`previous`},ci=(e,t)=>{let n=Math.abs(e),r=Math.abs(t);return r>n*1.5&&r>20},li=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},ui=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(li(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];ci(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=si(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},di=e=>(0,y.useCallback)(t=>{kn(),e(t)},[e]),fi=(e,t,n,r,i)=>{let a=(0,y.useRef)(void 0),o=(0,y.useRef)(!1);(0,y.useEffect)(()=>{if(!e){a.current=t,o.current=!1;return}a.current!==t&&(a.current=t,o.current=t!==null),o.current&&r===null&&n.length!==0&&(o.current=!1,i(n[0].projectItemId))},[e,t,n,r,i])},pi=e=>{window.history.pushState({},``,e),window.dispatchEvent(new PopStateEvent(`popstate`))},mi=e=>{window.history.replaceState({},``,e),window.dispatchEvent(new PopStateEvent(`popstate`))},hi=(e,t,n,r,i,a,o,s,c,l)=>{let u=(0,y.useRef)(0),d=(0,y.useRef)(null);(0,y.useEffect)(()=>{if(!e||r===null){u.current=0,d.current=null;return}if(!o||!s||c||l||d.current===r)return;if(t>0||n>0){d.current=r,u.current=0;return}if(i.length===0)return;let f=i.filter(e=>(a[e]??15)>0);if(u.current>=f.length-1){d.current=r,u.current=0;return}d.current=r,u.current+=1;let p=ce(i,r,a);p===null?u.current=0:pi(`/projects/${p}/todo-by-human`)},[e,t,n,r,i,a,o,s,c,l])},gi=()=>{let[e,t]=(0,y.useState)(N),[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=>(se(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}},_i=(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},vi=(e,t)=>{let n=e.indexOf(t);return n<0||n>=e.length-1?null:e[n+1]},yi=(e,t)=>{let n=e.indexOf(t);return n<=0?null:e[n-1]},bi=(e,t)=>e.length===0?`${t}\n`:e.endsWith(`
|
|
13
|
+
`);c=u.pop()??``;for(let e of u){if(!e.startsWith(`data: `))continue;let i=yt(e.slice(6));if(i!==null){if(i.type===`progress`)r({fetched:typeof i.fetched==`number`?i.fetched:0,total:typeof i.total==`number`?i.total:0});else if(i.type===`done`){let e=_t(i.snapshot);if(e===null){t(`error`),s([`Failed to parse snapshot`]);return}let r=Xe(n,e);if(r.status===`error`){s(r.failures),t(`error`);return}let o=_t(r.snapshot);if(o===null){t(`error`),s([`Failed to merge snapshot`]);return}await nt(o),tt(!0),a(o),t(`on`),s(o.failures)}}}}},[]),u=(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(vt,{signal:e.signal}).then(async e=>{if(!e.ok||e.body===null){t(`error`),s([`HTTP ${e.status}`]);return}await l(e.body,null)}).catch(e=>{e instanceof Error&&e.name===`AbortError`||(t(`error`),s([e instanceof Error?e.message:String(e)]))})},[l]),d=(0,y.useCallback)(()=>{c.current!==null&&(c.current.abort(),c.current=null),t(`off`),a(null),r(null),s([]),tt(!1),it().catch(()=>{})},[]),f=(0,y.useCallback)((e,n)=>{if(n.length===0)return;c.current!==null&&c.current.abort();let i=new AbortController;c.current=i,t(`syncing`),r({fetched:0,total:n.length}),s([]),fetch(vt,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({targetUrls:n}),signal:i.signal}).then(async n=>{if(!n.ok||n.body===null){t(`error`),s([`HTTP ${n.status}`]);return}await l(n.body,e)}).catch(e=>{e instanceof Error&&e.name===`AbortError`||(t(`error`),s([e instanceof Error?e.message:String(e)]))})},[l]);return{status:e,progress:n,snapshot:i,failures:o,startSync:u,turnOff:d,retryFailed:()=>f(i,o)}},V=e=>typeof e==`object`&&!!e&&!Array.isArray(e),xt=e=>typeof e==`string`?e:``,St=e=>typeof e==`number`?e:0,Ct=e=>e===!0,wt=`console-api-v1`,Tt=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();V(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(wt).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(wt)).match(n);if(e!==void 0)return e.json()}}catch{}throw e}},Et=e=>!V(e)||!Array.isArray(e.comments)?[]:e.comments.filter(V).map(e=>({author:xt(e.author),body:xt(e.body),createdAt:xt(e.createdAt)})),Dt=e=>!V(e)||!Array.isArray(e.files)?[]:e.files.filter(V).map(e=>({path:xt(e.path)||xt(e.filename),additions:St(e.additions),deletions:St(e.deletions),status:xt(e.status),patch:typeof e.patch==`string`?e.patch:null,rawUrl:typeof e.rawUrl==`string`?e.rawUrl:null})),Ot=e=>!V(e)||!Array.isArray(e.commits)?[]:e.commits.filter(V).map(e=>({sha:xt(e.sha),message:xt(e.message),author:xt(e.author),authoredAt:xt(e.authoredAt)})),kt=e=>V(e)?{title:xt(e.title),body:xt(e.body),additions:St(e.additions),deletions:St(e.deletions),changedFiles:St(e.changedFiles)}:null,At=e=>Array.isArray(e)?e.filter(e=>typeof e==`string`):[],jt=e=>e===`MERGEABLE`?`MERGEABLE`:e===`CONFLICTING`?`CONFLICTING`:`UNKNOWN`,Mt=e=>!V(e)||!Array.isArray(e.relatedPullRequests)?[]:e.relatedPullRequests.filter(V).map(e=>({url:xt(e.url),branchName:typeof e.branchName==`string`?e.branchName:null,createdAt:xt(e.createdAt),isDraft:Ct(e.isDraft),isConflicted:Ct(e.isConflicted),mergeableStatus:jt(e.mergeableStatus),isPassedAllCiJob:Ct(e.isPassedAllCiJob),isCiStateSuccess:Ct(e.isCiStateSuccess),isResolvedAllReviewComments:Ct(e.isResolvedAllReviewComments),isBranchOutOfDate:Ct(e.isBranchOutOfDate),missingRequiredCheckNames:At(e.missingRequiredCheckNames),summary:kt(e.summary)})),Nt=e=>{if(!V(e)||!V(e.status))return{found:!1,isConflicted:!1,mergeableStatus:`UNKNOWN`,isPassedAllCiJob:!1,isCiStateSuccess:!1,isBranchOutOfDate:!1,missingRequiredCheckNames:[]};let t=e.status;return{found:!0,isConflicted:Ct(t.isConflicted),mergeableStatus:jt(t.mergeableStatus),isPassedAllCiJob:Ct(t.isPassedAllCiJob),isCiStateSuccess:Ct(t.isCiStateSuccess),isBranchOutOfDate:Ct(t.isBranchOutOfDate),missingRequiredCheckNames:At(t.missingRequiredCheckNames)}},Pt=e=>V(e)?{state:xt(e.state)||`open`,merged:Ct(e.merged),isPullRequest:Ct(e.isPullRequest),title:xt(e.title)}:{state:`open`,merged:!1,isPullRequest:!1,title:``},Ft=()=>({fetchItemBody:async e=>{let t=await Tt(`/api/itembody`,e);return V(t)?xt(t.body):``},fetchComments:async e=>Et(await Tt(`/api/comments`,e)),fetchPrFiles:async e=>Dt(await Tt(`/api/prfiles`,e)),fetchPrCommits:async e=>Ot(await Tt(`/api/prcommits`,e)),fetchRelatedPrs:async e=>Mt(await Tt(`/api/relatedprs`,e)),fetchIssueState:async e=>Pt(await Tt(`/api/issuetitle`,e)),fetchPullRequestStatus:async e=>Nt(await Tt(`/api/pullrequeststatus`,e))}),It=async e=>{let t=await e.text().catch(()=>``);if(t.length===0)return`HTTP ${e.status}`;try{let e=JSON.parse(t);if(V(e)&&typeof e.error==`string`)return e.error}catch{return t}return t},Lt=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 It(n))},Rt=`/api/comment`,zt=e=>({author:xt(e.author),body:xt(e.body),createdAt:xt(e.createdAt)}),Bt=async e=>{let t=await fetch(Rt,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)});if(!t.ok)return{posted:!1,error:await It(t),rateLimitResetAt:null};let n=await t.json();return V(n)?n.ok===!1?{posted:!1,error:typeof n.error==`string`?n.error:`upstream error`,rateLimitResetAt:typeof n.rateLimitResetAt==`string`?n.rateLimitResetAt:null}:V(n.comment)?{posted:!0,comment:zt(n.comment)}:{posted:!1,error:`comment was not returned`,rateLimitResetAt:null}:{posted:!1,error:`unexpected response shape`,rateLimitResetAt:null}},Vt=`/api/upload`,Ht=e=>{let t=``;for(let n of e)t+=String.fromCharCode(n);return btoa(t)},H=async e=>{let t=await fetch(Vt,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)});if(!t.ok)throw Error(await It(t));let n=await t.json();if(!V(n)||typeof n.markdown!=`string`)throw Error(`markdown was not returned`);return n.markdown},Ut=`/api/addstory`,Wt=async e=>{let t=await fetch(Ut,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)});if(!t.ok)throw Error(await It(t))},Gt=`/api/reviewcomment`,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 It(t))},qt=`/api/createissue`,Jt=`/api/storycolor`,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 It(t))},Xt=async e=>{let t=await fetch(qt,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)});if(!t.ok)throw Error(await It(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},Zt=`/api/createworkflowissue`,Qt=async e=>{let t=await fetch(Zt,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)});if(!t.ok)throw Error(await It(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},$t=`/api/reorderstory`,en=async e=>{let t=await fetch($t,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)});if(!t.ok)throw Error(await It(t))},tn=`/api/deleteallcomments`,nn=async e=>{let t=await fetch(tn,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)});if(!t.ok)throw Error(await It(t))},rn=`/api/deletestory`,an=async e=>{let t=await fetch(rn,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)});if(!t.ok)throw Error(await It(t))},on=`/api/renamestory`,sn=async e=>{let t=await fetch(on,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)});if(!t.ok)throw Error(await It(t))},cn=`/api/storydescription`,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 It(t))},un=e=>typeof e!=`object`||!e||Array.isArray(e)?null:Object.fromEntries(Object.entries(e).filter(e=>typeof e[1]==`string`)),dn=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,fleetTaskCreateUrl:null,nameWithOwnerByPjcode:null};let n=t;return{pjcodes:Array.isArray(n.pjcodes)?n.pjcodes.filter(e=>typeof e==`string`):[],projectUrls:un(n.projectUrls),fleetTaskCreateUrl:typeof n.fleetTaskCreateUrl==`string`?n.fleetTaskCreateUrl:null,nameWithOwnerByPjcode:un(n.nameWithOwnerByPjcode)}},fn=`/api/projectreadmeconfig`,pn=async e=>{let t=`${fn}?pjcode=${encodeURIComponent(e)}`,n=await fetch(t);if(!n.ok)throw Error(await It(n));let r=await n.json();return{maximumPreparingIssuesCount:V(r)&&typeof r.maximumPreparingIssuesCount==`number`?r.maximumPreparingIssuesCount:null}},mn=`/api/renameissue`,hn=async e=>{let t=await fetch(mn,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)});if(!t.ok)throw Error(await It(t))},gn=`/api/setdependedissueurl`,_n=async e=>{let t=await fetch(gn,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)});if(!t.ok)throw Error(await It(t))},vn=`/api/projectsettings`,yn=async e=>{let t=await fetch(vn,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)});if(!t.ok)throw Error(await It(t))},bn=5e3,xn=e=>`${e.isPr?`PR #`:`#`}${e.number}`,Sn=(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 +1h`:e.action===`snooze_3hours`?`Next Action Hour +3h`:e.action===`snooze_6hours`?`Next Action Hour +6h`:e.action===`snooze_1day`?`Next Action Date +1d`:e.action===`snooze_2days`?`Next Action Date +2d`:e.action===`snooze_3days`?`Next Action Date +3d`:e.action===`snooze_5days`?`Next Action Date +5d`:e.action===`snooze_1month`?`Next Action Date +1mo`:Se(t)?`Next Action Date +1w skip`:`Next Action Date +1w`;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`}},Cn=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`}},wn=(e,t)=>e.type===`next_action_date`?Se(t):e.type!==`delete_all_comments`,Tn=(e,t,n)=>`${Sn(e,n)} — ${xn(t)}`,En=`console-comment-expanded:`,Dn=e=>{try{let t=localStorage.getItem(En+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}},On=(e,t)=>{try{localStorage.setItem(En+e,JSON.stringify([...t]))}catch(e){console.error(`Failed to save comment expanded state to storage:`,e)}},kn=()=>{let e=[];for(let t=0;t<localStorage.length;t++){let n=localStorage.key(t);n?.startsWith(En)&&e.push(n)}for(let t of e)localStorage.removeItem(t)},An=`console-offline-action-queue`,jn=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},Mn=()=>{try{let e=localStorage.getItem(An);if(e===null)return[];let t=JSON.parse(e);return Array.isArray(t)?t.filter(jn):[]}catch{return[]}},Nn=e=>{localStorage.setItem(An,JSON.stringify(e))},Pn=()=>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)}`,Fn=e=>e instanceof TypeError,In=e=>e instanceof Error&&e.message.length>0?e.message:String(e),Ln=100,Rn=e=>Math.max(0,Math.ceil((bn-e)/1e3)),zn=e=>Math.max(0,1-e/bn),Bn=()=>{let[e,t]=(0,y.useState)(null),[n,r]=(0,y.useState)(null),[i,a]=(0,y.useState)(Mn),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.useRef)(()=>{}),f=(0,y.useCallback)(()=>{l.current!==null&&(clearInterval(l.current),l.current=null)},[]),p=(0,y.useCallback)(e=>{if(e.offline===void 0)return;let t={id:Pn(),message:e.message,color:e.color,enqueuedAt:Date.now(),...e.offline};a(e=>{let n=[...e,t];return Nn(n),n})},[]),m=(0,y.useCallback)(e=>{e.commit().catch(t=>{Fn(t)&&e.offline!==void 0?p(e):r({message:e.message,reason:In(t),retry:()=>d.current(e)})})},[p]);d.current=m;let h=(0,y.useCallback)(()=>{let e=s.current;f(),s.current=null,t(null),e!==null&&!u.current&&(u.current=!0,kn(),m(e))},[f,m]),g=(0,y.useCallback)(()=>{let e=s.current;f(),s.current=null,u.current=!0,t(null),e?.revertAdvance?.(),e?.revertOptimistic?.()},[f]),_=(0,y.useCallback)(()=>{r(null)},[]),v=(0,y.useCallback)((e,t)=>{r({message:e,reason:t})},[]),b=(0,y.useCallback)(e=>{a(t=>{let n=t.filter(t=>t.id!==e);return Nn(n),n})},[]),x=(0,y.useCallback)(async e=>{let t=o.current.find(t=>t.id===e);if(t!==void 0)try{await Lt(t.apiPath,t.requestBody),b(e)}catch(n){Fn(n)?r({message:t.message,reason:`Still offline — action is still held in the queue`}):(r({message:t.message,reason:In(n)}),b(e))}},[b]),S=(0,y.useCallback)(e=>{if(s.current!==null&&!u.current){let e=s.current;f(),u.current=!0,kn(),m(e)}u.current=!1,s.current=e,c.current=Date.now(),t({message:e.message,color:e.color,remainingSeconds:Rn(0),progress:zn(0)}),e.advance(),e.optimistic?.(),l.current=setInterval(()=>{let n=Date.now()-c.current;if(n>=5e3){h();return}t({message:e.message,color:e.color,remainingSeconds:Rn(n),progress:zn(n)})},Ln)},[f,h,m]);return(0,y.useEffect)(()=>h,[h]),{pending:e,error:n,offlineActions:i,enqueue:S,showError:v,undo:g,dismissError:_,confirmOfflineAction:x,discardOfflineAction:b}},Vn=e=>typeof e==`object`&&!!e&&!Array.isArray(e),Hn=e=>Array.isArray(e)?e.filter(e=>typeof e==`string`):[],Un=e=>Array.isArray(e)?e.filter(Vn).map(e=>({...e,relatedOpenPullRequestUrls:Hn(e.relatedOpenPullRequestUrls)})):[],Wn=e=>!Vn(e)||!Array.isArray(e.items)?[]:Un(e.items),Gn=e=>Array.isArray(e)?e.filter(Vn):[],Kn=e=>Array.isArray(e)?e.filter(Vn).map(e=>({...e,items:Un(e.items)})):[],qn=e=>({items:Wn(e),generatedAt:Vn(e)&&typeof e.generatedAt==`string`?e.generatedAt:``,statusOptions:Vn(e)?Gn(e.statusOptions):[],agentOptions:Vn(e)?Gn(e.agentOptions):[],storyOptions:Vn(e)?Gn(e.storyOptions):[],storyColors:Vn(e)&&Vn(e.storyColors)?e.storyColors:{},stories:Vn(e)?Kn(e.stories):[],defaultNameWithOwner:Vn(e)&&typeof e.defaultNameWithOwner==`string`?e.defaultNameWithOwner:null,storyOrder:Vn(e)?Hn(e.storyOrder):[],timerEndsAt:Vn(e)&&typeof e.timerEndsAt==`string`?e.timerEndsAt:null,timerTotalSeconds:Vn(e)&&typeof e.timerTotalSeconds==`number`&&e.timerTotalSeconds>0?e.timerTotalSeconds:null}),Jn=()=>{let e={};for(let t of j)e[t.name]=null;return e},Yn=(e,t)=>`/projects/${e}/${t}/list.json`,Xn=6e4,Zn=`console-list-v1`,Qn=(e,t)=>{try{if(!(`caches`in globalThis))return;globalThis.caches.open(Zn).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)}},$n=async e=>{if(!(`caches`in globalThis))return null;try{let t=await(await globalThis.caches.open(Zn)).match(e);return t===void 0?null:{...qn(await t.json()),fromCache:!0}}catch{return null}},er=async e=>{let t=await Promise.all(j.map(async t=>({tabName:t.name,snapshot:await $n(Yn(e,t.name))}))),n=Jn();for(let{tabName:e,snapshot:r}of t)n[e]=r;return n},tr=async(e,t)=>{let n=Yn(e,t);try{let e=await fetch(n);if(!e.ok)throw Error(`HTTP ${e.status}`);let t=await e.json();return Qn(n,t),{snapshot:{...qn(t),fromCache:!1},error:null}}catch(e){let t=await $n(n);return t===null?{snapshot:null,error:e instanceof Error?e:Error(String(e))}:{snapshot:t,error:null}}},nr=async e=>{await Promise.all(j.map(async t=>{let n=Yn(e,t.name);try{let e=await fetch(n);if(!e.ok)return;Qn(n,await e.json())}catch{}}))},rr=async e=>{let t=await Promise.all(j.map(async t=>{let{snapshot:n,error:r}=await tr(e,t.name);return{tabName:t.name,snapshot:n,error:r}})),n=Jn(),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}},ir=(e,t=null)=>{let n=(0,y.useRef)(new Map),[r,i]=(0,y.useState)(Jn),[a,o]=(0,y.useState)(!0),[s,c]=(0,y.useState)(null),[l,u]=(0,y.useState)(e);if(l!==e){u(e);let t=e===null?null:n.current.get(e)??null;i(t??Jn()),t!==null&&o(!1)}return(0,y.useEffect)(()=>{if(t!==null&&e!==null){let n=t.tabs[e];if(n!==void 0){let e=Jn();for(let t of j){let r=n[t.name];r!==void 0&&(e[t.name]={...r})}i(e),o(!1),c(null);return}}let r=!1,a=!1;if(c(null),e===null)return i(Jn()),o(!1),c(`No project specified in the URL path.`),()=>{r=!0};let s=n.current.has(e);er(e).then(t=>{if(r)return;let c=Object.values(t).some(e=>e!==null);c&&!a?(n.current.set(e,t),i(t),o(!1)):!c&&!a&&!s&&(o(!0),i(Jn()))});let l=()=>{rr(e).then(({snapshots:t,firstError:s})=>{r||(a=!0,n.current.set(e,t),i(t),c(s===null?null:s.message),o(!1))}).catch(e=>{r||(a=!0,c(e instanceof Error?e.message:String(e)),o(!1))})};l();let u=setInterval(l,Xn);return()=>{r=!0,clearInterval(u)}},[e,t]),{snapshots:r,isLoading:a,error:s,refreshSingleTab:(0,y.useCallback)(async t=>{if(e===null)return;let{snapshot:r}=await tr(e,t);r!==null&&i(i=>{let a={...i,[t]:r};return n.current.set(e,a),a})},[e])}},ar=(e,t,n)=>{(0,y.useEffect)(()=>{if(!n)return;let r=t.filter(t=>t!==e);if(r.length===0)return;let i=()=>{for(let e of r)nr(e).catch(()=>{})};i();let a=setInterval(i,Xn);return()=>{clearInterval(a)}},[n,e,t])},or=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)}},sr=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},cr=(e,t)=>{for(let[n,r]of Object.entries(t.items)){let t=sr(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)}},lr=(e=null)=>(0,y.useMemo)(()=>{let t=Ft(),n={client:t,body:new or(t.fetchItemBody),comments:new or(t.fetchComments),files:new or(t.fetchPrFiles),commits:new or(t.fetchPrCommits),relatedPrs:new or(t.fetchRelatedPrs),state:new or(t.fetchIssueState),prStatus:new or(t.fetchPullRequestStatus)};return e!==null&&cr(n,e),n},[e]),ur=0,dr=500,fr=2e3,pr=e=>{let t=window;if(typeof t.requestIdleCallback==`function`&&typeof t.cancelIdleCallback==`function`){let n=t.requestIdleCallback(e,{timeout:fr});return{cancel:()=>t.cancelIdleCallback?.(n)}}let n=window.setTimeout(e,0);return{cancel:()=>window.clearTimeout(n)}},mr=(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)},hr=(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+ur);if(i.length===0)return;let a=null,o=window.setTimeout(()=>{a=pr(()=>{for(let t of i)mr(e,t)})},dr);return()=>{window.clearTimeout(o),a?.cancel()}},[e,t,n])},gr=`/api/features`,_r=()=>{let[e,t]=(0,y.useState)({airplaneMode:!1});return(0,y.useEffect)(()=>{fetch(gr).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},vr=(e,t)=>{let n=j.findIndex(t=>t.name===e);if(n===-1)return null;for(let e=n+1;e<j.length;e+=1){let n=j[e];if(n.isNavigable!==!1&&(t[n.name]??0)>0)return n.name}return null},yr=e=>{let t=j.filter(e=>e.isNavigable!==!1);for(let n of t)if((e[n.name]??0)>0)return n.name;return t[0].name},br=new Set(j.map(e=>e.name)),xr=e=>{let t=e.split(`/`).filter(e=>e.length>0);if(t.length<3||t[0]!==`projects`)return null;let n=t[2];return br.has(n)?n:null},Sr=e=>{if(!e.startsWith(`#item/`))return null;let t=e.slice(6);return t.length===0?null:decodeURIComponent(t)},Cr=`#settings`,wr=(e,t,n=new Set,r)=>{let i=(0,y.useCallback)(()=>{let e=yr(t);return typeof window>`u`?{activeTab:e,selectedItemKey:null}:{activeTab:xr(window.location.pathname)??e,selectedItemKey:Sr(window.location.hash)}},[t]),[a,o]=(0,y.useState)(i),s=(0,y.useRef)(null);s.current=e,(0,y.useEffect)(()=>{if(typeof window>`u`)return;let e=()=>{o(i())};return window.addEventListener(`popstate`,e),window.addEventListener(`hashchange`,e),()=>{window.removeEventListener(`popstate`,e),window.removeEventListener(`hashchange`,e)}},[i]),(0,y.useEffect)(()=>{if(typeof window>`u`)return;let e=xr(window.location.pathname),i=Object.values(t).some(e=>e>0),a=r??t;if(e!==null){if(t[e]>0||a[e]>0){o(t=>t.activeTab===e?t:{...t,activeTab:e});return}if(!n.has(e))return}let c=yr(t);i&&s.current!==null&&window.history.replaceState({},``,`/projects/${s.current}/${c}${window.location.search}`),o(e=>e.activeTab===c?e:{...e,activeTab:c})},[t,n,r]);let c=(0,y.useCallback)(t=>e===null?`#${t}`:`/projects/${e}/${t}`,[e]),l=(0,y.useCallback)(e=>{if(typeof window>`u`){o({activeTab:e,selectedItemKey:null});return}window.history.pushState({},``,c(e)),o({activeTab:e,selectedItemKey:null})},[c]),u=(0,y.useCallback)(e=>{typeof window<`u`&&(window.location.hash=`#item/${encodeURIComponent(e)}`),o(t=>({...t,selectedItemKey:e}))},[]),d=(0,y.useCallback)(()=>{if(typeof window<`u`&&window.location.hash!==``){let e=`${window.location.pathname}${window.location.search}`;window.history.pushState({},``,e)}o(e=>({...e,selectedItemKey:null}))},[]);return{activeTab:a.activeTab,selectedItemKey:a.selectedItemKey,tabHref:c,selectTab:l,openItem:u,closeItem:d}},Tr=`/api/review`,Er=`/api/triage`,Dr=`/api/intmux`,Or=(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:ve(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:he}:{pjcode:e,action:`unnecessary`,prUrl:n,projectItemId:t.projectItemId,issueUrl:t.url,commentBody:ge,issueCommentBody:_e(n)}},kr=(e,t,n,r)=>({pjcode:e,action:n,issueUrl:t.url,projectItemId:t.projectItemId,...r??{}}),Ar=(e,t)=>({pjcode:e,action:`set_intmux`,issueUrl:t.url,projectItemId:t.projectItemId}),jr=()=>Error(`No project specified in the URL path.`),Mr=`ok`,Nr=(e,t,n)=>{let r=(0,y.useCallback)(e=>{if(t===void 0)return;let n=`${e.repo}#${e.number}`;t.body.invalidate(n),t.comments.invalidate(n)},[t]),i=(0,y.useCallback)(async(t,n,i,a=[])=>{if(e===null)throw jr();await Lt(Tr,Or(e,t,n,i,a)),r(t)},[e,r]),a=(0,y.useCallback)(async(t,n)=>{if(e===null)throw jr();await Lt(Er,{pjcode:e,action:n,issueUrl:t.url,projectItemId:t.projectItemId}),r(t)},[e,r]),o=(0,y.useCallback)(async(t,n)=>{if(e===null)throw jr();await Lt(Er,{pjcode:e,action:`set_agent`,issueUrl:t.url,projectItemId:t.projectItemId,agentOptionId:n.id}),r(t)},[e,r]);return{reviewPullRequest:i,setNextActionDate:a,setStory:(0,y.useCallback)(async(t,n)=>{if(e===null)throw jr();await Lt(Er,{pjcode:e,action:`set_story`,issueUrl:t.url,projectItemId:t.projectItemId,storyOptionId:n.id}),r(t)},[e,r]),setAgent:o,setStatus:(0,y.useCallback)(async(t,n)=>{if(e===null)throw jr();await Lt(Er,{pjcode:e,action:`set_status`,issueUrl:t.url,projectItemId:t.projectItemId,statusName:n.name}),r(t)},[e,r]),setInTmuxByHuman:(0,y.useCallback)(async(t,n)=>{if(e===null)throw jr();await Lt(Dr,{pjcode:e,action:`set_intmux`,issueUrl:t.url,projectItemId:t.projectItemId}),r(t)},[e,r]),closeIssue:(0,y.useCallback)(async(t,n)=>{if(e===null)throw jr();await Lt(Er,{pjcode:e,action:n,issueUrl:t.url,projectItemId:t.projectItemId}),r(t)},[e,r]),okAndMoveToAwaitingWorkspace:(0,y.useCallback)(async(t,i)=>{if(e===null)throw jr();let a=await Bt({pjcode:e,url:t.url,body:Mr});if(await Lt(Er,{pjcode:e,action:`set_status`,issueUrl:t.url,projectItemId:t.projectItemId,statusName:i.name}),r(t),await n?.(),!a.posted){let e=a.rateLimitResetAt===null?``:` Rate limit resets at ${a.rateLimitResetAt}.`;throw Error(`Comment not posted — ${a.error}.${e} Status was changed. Re-post: ${Mr}`)}},[e,r,n]),addComment:(0,y.useCallback)(async(t,n)=>{if(e===null)throw jr();let i=await Bt({pjcode:e,url:t.url,body:n});if(!i.posted){let e=i.rateLimitResetAt===null?``:` Rate limit resets at ${i.rateLimitResetAt}.`;throw Error(`${i.error}.${e}`)}return r(t),i.comment},[e,r]),uploadAttachment:(0,y.useCallback)(async(t,n)=>{if(e===null)throw Error(`no project in the URL path`);let r=Ht(new Uint8Array(await n.arrayBuffer()));return H({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 jr();await Kt({pjcode:e,url:t,path:n,line:r,side:i,body:a})},[e]),issueRename:(0,y.useCallback)(async(e,t)=>{await hn({issueUrl:e.url,newTitle:t})},[]),deleteAllComments:(0,y.useCallback)(async e=>{await nn({issueUrl:e.url}),r(e)},[r]),setDependedIssueUrl:(0,y.useCallback)(async(t,n)=>{if(e===null)throw jr();await _n({pjcode:e,issueUrl:t.url,dependedIssueUrl:n})},[e])}},Pr=e=>`pv_overlay_${e}`,Fr=e=>e.projectItemId===``?e.itemId:e.projectItemId,Ir=(e,t)=>e!==void 0&&e.done===!0&&e.mode===t,Lr=(e,t,n)=>e.filter(e=>!Ir(t[Fr(e)],n)).length,Rr=(e,t,n)=>e.filter(e=>!Ir(t[Fr(e)],n)),zr=(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},Br=(e,t,n)=>{if(n===null)return null;let r=Date.parse(n);if(Number.isNaN(r))return null;let i=e[Fr(t)];return i===void 0||i.ts<r?null:i.status??null},Vr=(e,t,n,r,i)=>{let a={...e[t]??{},...n,ts:i,mode:r};return{...e,[t]:a}},Hr=(e,t)=>{let n={...e};return delete n[t],n},Ur=e=>typeof e==`object`&&!!e&&typeof e.ts==`number`,Wr=e=>{if(typeof localStorage>`u`)return{};let t=localStorage.getItem(Pr(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))Ur(t)&&(r[e]=t);return r},Gr=(e,t)=>{typeof localStorage<`u`&&localStorage.setItem(Pr(e),JSON.stringify(t))},Kr=e=>{let[t,n]=(0,y.useState)(()=>Wr(e));return{overlay:t,patchOverlay:(0,y.useCallback)((t,r,i)=>{n(n=>{let a=Vr(n,t,r,i,Date.now());return Gr(e,a),a})},[e]),revertOverlayEntry:(0,y.useCallback)(t=>{n(n=>{let r=Hr(n,t);return Gr(e,r),r})},[e])}},qr=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},Jr=()=>{let[e,t]=(0,y.useState)(()=>qr(typeof window>`u`?``:window.location.pathname));return(0,y.useEffect)(()=>{let e=()=>{t(qr(window.location.pathname))};return window.addEventListener(`popstate`,e),()=>{window.removeEventListener(`popstate`,e)}},[]),e},Yr=()=>{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),dn().then(n=>{e||(t(n.pjcodes),r(n.projectUrls),a(n.fleetTaskCreateUrl),s(n.nameWithOwnerByPjcode),l(!1))}).catch(t=>{e||(d(t instanceof Error?t:Error(String(t))),l(!1))}),()=>{e=!0}},[]),{pjcodes:e,projectUrls:n,fleetTaskCreateUrl:i,nameWithOwnerByPjcode:o,isLoading:c,error:u}},Xr=e=>(0,y.useCallback)(t=>{kn(),e(t)},[e]),Zr=()=>typeof window<`u`&&window.location.hash===`#settings`,Qr=e=>{let[t,n]=(0,y.useState)(Zr),[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)(``),f=(0,y.useRef)(e);f.current=e,(0,y.useEffect)(()=>{if(!t)return;let e=!1;return u({}),i(!0),c(null),Promise.all(f.current.map(e=>pn(e).then(t=>({pjcode:e,value:t.maximumPreparingIssuesCount===null?``:String(t.maximumPreparingIssuesCount)})))).then(t=>{if(!e){let e={};for(let{pjcode:n,value:r}of t)e[n]=r;u(e)}}).catch(t=>{e||c(t instanceof Error?t.message:`Failed to load settings`)}).finally(()=>{e||i(!1)}),()=>{e=!0}},[t]),(0,y.useEffect)(()=>{if(typeof window>`u`)return;let e=()=>{let e=window.location.hash===Cr;e||c(null),n(e)};return window.addEventListener(`popstate`,e),window.addEventListener(`hashchange`,e),()=>{window.removeEventListener(`popstate`,e),window.removeEventListener(`hashchange`,e)}},[]);let p=(0,y.useCallback)(()=>{typeof window<`u`&&(d.current=window.location.hash,window.history.pushState({},``,Cr)),n(!0)},[]),m=(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)},[]),h=(0,y.useCallback)((e,t)=>{u(n=>({...n,[e]:t}))},[]),g=(0,y.useCallback)(async()=>{o(!0),c(null);try{if(await Promise.all(Object.entries(l).filter(([,e])=>{let t=parseInt(e,10);return!Number.isNaN(t)&&t>=0}).map(([e,t])=>yn({pjcode:e,maximumPreparingIssuesCount:parseInt(t,10)}))),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)}},[l]);return(0,y.useEffect)(()=>{if(!t)return;let e=e=>{e.key===`Escape`&&m()};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[t,m]),{isOpen:t,isLoading:r,isSaving:a,error:s,inputValues:l,open:p,close:m,changeInput:h,save:g}},$r=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,[])}},ei=/##\s+(?:エグゼクティブサマリ(?:\s*\/\s*Executive\s+Summary)?|Executive\s+Summary)\s*\n/i,ti=/^From:\s+:robot:/m,ni=/^##\s/m,ri=e=>{let t=ei.exec(e);if(t===null)return null;let n=e.slice(t.index+t[0].length),r=ti.exec(n),i=ni.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},ii=e=>{if(e.length===0)return null;let t=e[e.length-1],n=ri(t.body);if(n!==null)return n;let r=t.body.trim();return r.length>0?r:null},ai=e=>`${e.repo}#${e.number}`,oi=(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=ai(n),a=t.peek(e);if(a!==void 0){let e=ii(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=ii(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},si=(e,t)=>{let n=Math.abs(e);return n<60||n<=Math.abs(t)*1.5?null:e<0?`next`:`previous`},ci=(e,t)=>{let n=Math.abs(e),r=Math.abs(t);return r>n*1.5&&r>20},li=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},ui=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(li(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];ci(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=si(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},di=e=>(0,y.useCallback)(t=>{kn(),e(t)},[e]),fi=(e,t,n,r,i)=>{let a=(0,y.useRef)(void 0),o=(0,y.useRef)(!1);(0,y.useEffect)(()=>{if(!e){a.current=t,o.current=!1;return}a.current!==t&&(a.current=t,o.current=t!==null),o.current&&r===null&&n.length!==0&&(o.current=!1,i(n[0].projectItemId))},[e,t,n,r,i])},pi=e=>{window.history.pushState({},``,e),window.dispatchEvent(new PopStateEvent(`popstate`))},mi=e=>{window.history.replaceState({},``,e),window.dispatchEvent(new PopStateEvent(`popstate`))},hi=(e,t,n,r,i,a,o,s,c,l)=>{let u=(0,y.useRef)(0),d=(0,y.useRef)(null);(0,y.useEffect)(()=>{if(!e||r===null){u.current=0,d.current=null;return}if(!o||!s||c||l||d.current===r)return;if(t>0||n>0){u.current=0;return}if(i.length===0)return;let f=i.filter(e=>(a[e]??15)>0);if(u.current>=f.length-1){d.current=r,u.current=0;return}d.current=r,u.current+=1;let p=ce(i,r,a);p===null?u.current=0:pi(`/projects/${p}/todo-by-human`)},[e,t,n,r,i,a,o,s,c,l])},gi=()=>{let[e,t]=(0,y.useState)(N),[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=>(se(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}},_i=(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},vi=(e,t)=>{let n=e.indexOf(t);return n<0||n>=e.length-1?null:e[n+1]},yi=(e,t)=>{let n=e.indexOf(t);return n<=0?null:e[n-1]},bi=(e,t)=>e.length===0?`${t}\n`:e.endsWith(`
|
|
14
14
|
`)?`${e}${t}\n`:`${e}\n${t}\n`,xi=(e,t)=>{let n=`![uploading ${t}]()`;return`${e.length===0?``:e.replace(/\n*$/,`
|
|
15
15
|
`)}\n\n\n${n}\n`},Si=(e,t,n)=>{let r=`![uploading ${t}]()`,i=e.indexOf(r);return i===-1?bi(e,n):e.slice(0,i)+n+e.slice(i+r.length)},Ci=(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]===`
|
|
@@ -88,6 +88,6 @@ Please report this to https://github.com/markedjs/marked.`,e){let e=`<p>An error
|
|
|
88
88
|
`).map(e=>`> ${e}`).join(`
|
|
89
89
|
`),Qu=e=>e.split(`
|
|
90
90
|
`).find(e=>e.trim()!==``)??``,$u=e=>`${e.author}:${e.createdAt}:${e.body}`,ed=({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)(Mu,{body:e.body,buildImageProxyUrl:t,renderReferenceLink:n,repoContext:r})})},td=({comments:e,isLoading:t,error:n,now:r,buildImageProxyUrl:i,renderReferenceLink:a,repoContext:o,persistenceKey:s=null,issueTitle:c,onCreateWorkflowIssue:l})=>{let[u,d]=(0,y.useState)(!1),[f,p]=(0,y.useState)(null),[m,h]=(0,y.useState)(()=>s==null?new Set:Dn(s)),g=e.length>0?$u(e[e.length-1]):null;(0,y.useEffect)(()=>{g!==null&&h(e=>new Set([...e,g]))},[g]),(0,y.useEffect)(()=>{s!=null&&On(s,m)},[s,m]);let _=e=>{h(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 v=!u&&e.length>1;return(0,x.jsxs)(`div`,{className:`console-comment-list`,children:[v&&(0,x.jsxs)(`button`,{type:`button`,className:`console-comment-show-all`,onClick:()=>{d(!0),h(t=>new Set([...t,...e.map($u)]))},children:[`Show all `,e.length]}),e.map(e=>{let t=$u(e),n=m.has(t);return(0,x.jsxs)(`article`,{className:`console-comment${n?` is-expanded`:v?` console-comment--expandable`:``}`,children:[(0,x.jsxs)(`button`,{type:`button`,className:`console-comment-toggle`,onClick:()=>_(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:k(e.createdAt,r)}),!n&&(0,x.jsx)(`span`,{className:`console-comment-body-preview`,children:Qu(e.body)})]}),l!==void 0&&(0,x.jsx)(`button`,{type:`button`,className:`console-comment-create-workflow-issue`,onClick:t=>{t.stopPropagation(),p(e)},title:`Create workflow improvement issue from this comment`,children:`+`}),n&&(0,x.jsx)(ed,{comment:e,buildImageProxyUrl:i,renderReferenceLink:a,repoContext:o})]},t)}),f!==null&&l!==void 0&&(0,x.jsx)(Q,{defaultTitle:c??``,defaultBody:Zu(f.body),onSubmit:l,onClose:()=>p(null)})]})},nd=e=>e.slice(0,7),rd=e=>e.split(`
|
|
91
|
-
`)[0],id=({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:rd(e.message)}),(0,x.jsx)(`span`,{className:`console-commit-sha`,children:nd(e.sha)}),(0,x.jsx)(`span`,{className:`console-commit-author`,children:e.author}),(0,x.jsx)(`span`,{className:`console-commit-time`,children:k(e.authoredAt,r)})]},e.sha))}):(0,x.jsx)(`p`,{className:`console-commits-notloaded`,children:`Not loaded.`}),ad=({url:e,label:t=`Copy URL`})=>(0,x.jsx)(du,{value:e,idleText:`Copy URL`,idleAriaLabel:t,copiedAriaLabel:`URL copied to clipboard`,className:`console-copy-url-button`}),od=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}))},sd=e=>e.length<=1?e.join(``):`${e.slice(0,-1).join(`, `)} and ${e[e.length-1]}`,cd=({failures:e})=>e.length===0?null:(0,x.jsx)(`div`,{role:`alert`,className:`console-detail-fetch-error`,children:od(e).map(e=>(0,x.jsxs)(`p`,{className:`console-detail-fetch-error-line`,children:[`Failed to load `,sd(e.sections),`:`,` `,e.message]},e.message))}),ld=({title:e,onTitleRename:t})=>{let[n,r]=(0,y.useState)(e),[i,a]=(0,y.useState)(!1),[o,s]=(0,y.useState)(e),[c,l]=(0,y.useState)(!1),[u,d]=(0,y.useState)(null),f=(0,y.useRef)(e);(0,y.useEffect)(()=>{let t=e!==f.current;f.current=e,!i&&t&&r(e)},[e,i]);let p=()=>{s(n),d(null),a(!0)},m=()=>{a(!1),d(null)},h=async()=>{let e=o.trim();if(e===``||e===n){a(!1);return}l(!0),d(null);try{await t(e),r(e),a(!1)}catch(e){d(e instanceof Error?e.message:`Failed to rename`)}finally{l(!1)}};return i?(0,x.jsxs)(`span`,{className:`console-detail-title-text console-detail-title-text--editing`,children:[(0,x.jsx)(`input`,{type:`text`,value:o,onChange:e=>s(e.target.value),onKeyDown:e=>{e.key===`Enter`?h():e.key===`Escape`&&m()},disabled:c,className:`console-detail-title-input`,"aria-label":`Edit title`}),(0,x.jsx)(`button`,{type:`button`,onClick:()=>void h(),disabled:c,className:`console-detail-title-save`,children:`Save`}),(0,x.jsx)(`button`,{type:`button`,onClick:m,disabled:c,className:`console-detail-title-cancel`,children:`Cancel`}),u!==null&&(0,x.jsx)(`span`,{className:`console-detail-title-error`,role:`alert`,children:u})]}):(0,x.jsxs)(`span`,{className:`console-detail-title-text`,children:[n,(0,x.jsx)(`button`,{type:`button`,onClick:p,className:`console-detail-title-edit`,"aria-label":`Edit title`,children:`Edit`})]})},ud={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`}},dd=({mergeableStatus:e})=>{let t=ud[e],n=F(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})},fd=e=>{let t=F(e);return{color:t.fg,borderColor:t.border,backgroundColor:t.bg}},pd=({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:fd(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:fd(`YELLOW`),title:`This branch is out of date with the base branch`,children:`Out of date`})]})},md=({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=Ei(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)(dd,{mergeableStatus:e.mergeableStatus}),(0,x.jsx)(pd,{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)(ad,{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)(Nu,{title:`Description`,children:n?(0,x.jsx)(`p`,{className:`console-pr-body-loading`,children:`Loading description...`}):(0,x.jsx)(Mu,{body:p?.body??t,buildImageProxyUrl:u,renderReferenceLink:d,repoContext:h})}),(0,x.jsx)(Nu,{title:`Changed files`,count:g,children:(0,x.jsx)(Z,{files:r,isLoading:i,error:a,buildImageProxyUrl:u,onAddInlineComment:f})}),(0,x.jsx)(Nu,{title:`Commits`,count:_,defaultCollapsed:!0,children:(0,x.jsx)(id,{commits:o,isLoading:s,error:c,now:l})})]})},hd=({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:E,renderReferenceLink:D,onAddInlineComment:O,onTitleRename:te,onCreateWorkflowIssue:A})=>{let j=a?.state??`open`,re=a?.merged??!1,M=!e.isPr&&j===`closed`?`Closed`:null,ie=Di(e.nameWithOwner)??void 0,ae=F(n),oe=r===null?e.status===null?null:{name:e.status,color:i.find(t=>t.name===e.status)?.color??`GRAY`}:r,N=oe===null?null:F(oe.color),se=p||m!==null?null:f.length,ce=u||d!==null?null:l.length,le=g||_!==null?null:h.length,ue=!u&&d===null&&l.length>0,P=e=>{let t=Ei(e);return t===null?e:`PR #${t.number}`},de=[{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 ${P(e.pullRequest.url)}`,message:e.filesError},{section:`commits of ${P(e.pullRequest.url)}`,message:e.commitsError}])].flatMap(e=>e.message===null?[]:[{section:e.section,message:e.message}]),fe=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)(Ee,{isPr:e.isPr,state:j,merged:re,isDraft:!1,stateReason:``}),te==null?(0,x.jsx)(`span`,{className:`console-detail-title-text`,children:e.title}):(0,x.jsx)(ld,{title:e.title,onTitleRename:te}),(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:[oe!==null&&N!==null&&(0,x.jsx)(`span`,{className:`console-detail-status-chip`,style:{color:N.fg,borderColor:N.border,backgroundColor:N.bg},children:oe.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:ae.dot}}),t]}),e.isPr&&y?.found&&(0,x.jsx)(pd,{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:P(e.pullRequest.url)}),(0,x.jsx)(pd,{isPassedAllCiJob:e.pullRequest.isPassedAllCiJob,isCiStateSuccess:e.pullRequest.isCiStateSuccess,isBranchOutOfDate:e.pullRequest.isBranchOutOfDate,missingRequiredCheckNames:e.pullRequest.missingRequiredCheckNames}),(0,x.jsx)(dd,{mergeableStatus:e.pullRequest.mergeableStatus})]},e.pullRequest.url)),fe.map(e=>(0,x.jsx)(dd,{mergeableStatus:e.mergeableStatus},e.url)),M!==null&&(0,x.jsx)(`span`,{className:`console-detail-closed-label`,children:M})]}),(0,x.jsx)(cd,{failures:de}),(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:ne(e.createdAt),children:[`opened `,k(e.createdAt,w)]}),(0,x.jsx)(ad,{url:e.url}),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)(Nu,{title:`Description`,defaultCollapsed:ue,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)(Mu,{body:o,buildImageProxyUrl:E,renderReferenceLink:D,repoContext:ie}):(0,x.jsx)(`p`,{className:`console-detail-body-notloaded`,children:`Not loaded.`})},ue?`desc-collapsed`:`desc-open`),e.isPr&&(0,x.jsx)(Nu,{title:`Changed files`,count:se,children:(0,x.jsx)(Z,{files:f,isLoading:p,error:m,onAddInlineComment:O})}),(0,x.jsx)(Nu,{title:`Comments`,count:ce,children:(0,x.jsx)(td,{comments:l,isLoading:u,error:d,now:w,buildImageProxyUrl:E,renderReferenceLink:D,repoContext:ie,persistenceKey:e.url,issueTitle:e.title,onCreateWorkflowIssue:A})}),e.isPr&&(0,x.jsx)(Nu,{title:`Commits`,count:le,defaultCollapsed:!0,children:(0,x.jsx)(id,{commits:h,isLoading:g,error:_,now:w})}),!e.isPr&&S.map(e=>(0,x.jsx)(md,{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:E,renderReferenceLink:D,onAddInlineComment:O},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})]})]})},gd=({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))]})},_d=({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)(gd,{className:`console-agent-select`,ariaLabel:`Set agent`,placeholder:`— agent —`,currentOption:r,options:e,onSelect:n},r?.id??`none`)})},vd=({onClose:e,onCommentAndClose:t,isDraftEmpty:n})=>{let[r,i]=(0,y.useState)(!1),[a,o]=(0,y.useState)(null),s=async()=>{if(!(t===void 0||r)){i(!0),o(null);try{await t()}catch(e){o(e instanceof Error?e.message:`failed to post`)}finally{i(!1)}}};return(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`}),t!==void 0&&(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(`button`,{type:`button`,className:`console-op-button`,disabled:r||n===!0,onClick:()=>{s()},children:`Comment & Close`}),a!==null&&(0,x.jsx)(`span`,{role:`alert`,className:`console-op-comment-close-error`,children:a})]})]})},yd=({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 e=>{if(t){c(!0),u(null);try{await t(e)}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?`]}),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(!0),disabled:s,children:s?`Deleting…`:`Delete with child tasks`}),(0,x.jsx)(`button`,{type:`button`,className:`console-op-button console-op-button-danger`,onClick:()=>void p(!1),disabled:s,children:s?`Deleting…`:`Keep child tasks`}),(0,x.jsx)(`button`,{type:`button`,className:`console-op-button`,onClick:()=>{o(!1),u(null)},disabled:s,children:`Cancel`})]})]})]})},bd=({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:`+1h`}),(0,x.jsx)(`button`,{type:`button`,className:`console-op-button console-op-button-snooze`,onClick:()=>t(`snooze_3hours`),children:`+3h`}),(0,x.jsx)(`button`,{type:`button`,className:`console-op-button console-op-button-snooze`,onClick:()=>t(`snooze_6hours`),children:`+6h`}),(0,x.jsx)(`button`,{type:`button`,className:`console-op-button console-op-button-snooze`,onClick:()=>t(`snooze_1day`),children:`+1d`}),(0,x.jsx)(`button`,{type:`button`,className:`console-op-button console-op-button-snooze`,onClick:()=>t(`snooze_2days`),children:`+2d`}),(0,x.jsx)(`button`,{type:`button`,className:`console-op-button console-op-button-snooze`,onClick:()=>t(`snooze_3days`),children:`+3d`}),(0,x.jsx)(`button`,{type:`button`,className:`console-op-button console-op-button-snooze`,onClick:()=>t(`snooze_5days`),children:`+5d`}),(0,x.jsx)(`button`,{type:`button`,className:`console-op-button console-op-button-snooze`,onClick:()=>t(`snooze_1week`),children:e?`+1w skip`:`+1w`}),(0,x.jsx)(`button`,{type:`button`,className:`console-op-button console-op-button-snooze`,onClick:()=>t(`snooze_1month`),children:`+1mo`})]}),xd=[{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`}],Sd=`Reject needs an inline comment on the diff.`,Cd=({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:Sd}),xd.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)})]}),wd=({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})]})},Td=(e,t)=>{let n=t.toLowerCase();return e.find(e=>e.name.toLowerCase()===n)??null},Ed=({statusOptions:e,onSetStatus:t,onSetInTmuxByHuman:n})=>{let r=xe.map(t=>({name:t,option:Td(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=F(r.color),a=e===ye;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)})})},Dd=({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)(gd,{className:`console-story-select`,ariaLabel:`Set story`,placeholder:`— story —`,currentOption:r,options:e,onSelect:n},r?.id??`none`)})},Od=({tab:e,hasPullRequest:t,rejectEnabled:n,statusOptions:r,storyOptions:i,currentStoryName:a,agentOptions:o,currentAgentName:s,handlers:c,storyNameForDeletion:l,onCommentAndClose:u,isDraftEmpty:d})=>{let[f,p]=(0,y.useState)(!1);return(0,x.jsxs)(`div`,{className:`console-operation-bar`,children:[t&&(0,x.jsx)(Cd,{onReview:c.onReview,rejectEnabled:n}),(0,x.jsx)(bd,{isManualTriage:Se(e),onSetNextActionDate:c.onSetNextActionDate}),(0,x.jsx)(Ed,{statusOptions:r,onSetStatus:c.onSetStatus,onSetInTmuxByHuman:c.onSetInTmuxByHuman}),f&&(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(Dd,{storyOptions:i,currentStoryName:a,onSetStory:c.onSetStory}),(0,x.jsx)(_d,{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:()=>p(e=>!e),title:`Change agent or story`,children:`⚙`})}),(0,x.jsx)(wd,{onSetDependedIssueUrl:c.onSetDependedIssueUrl}),(0,x.jsx)(yd,{onDeleteAllComments:c.onDeleteAllComments,onDeleteStory:c.onDeleteStory,storyNameForDeletion:l})]}),(0,x.jsx)(vd,{onClose:c.onClose,onCommentAndClose:u,isDraftEmpty:d})]})]})},kd=(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}},Ad=[],jd=[],Md=[],Nd=[],Pd={state:`open`,merged:!1,isPullRequest:!1,title:``},Fd={found:!1,isConflicted:!1,mergeableStatus:`UNKNOWN`,isPassedAllCiJob:!1,isCiStateSuccess:!1,isBranchOutOfDate:!1,missingRequiredCheckNames:[]},Id=(e,t,n)=>{let r=t===null?null:`${t.repo}#${t.number}`,i=t===null?null:t.url,a=t?.isPr??!1,o=kd(e.body,r,i,``),s=kd(e.state,r,i,Pd),c=kd(e.comments,r,i,Ad),l=kd(e.files,a?r:null,a?i:null,jd),u=kd(e.commits,a?r:null,a?i:null,Md),d=kd(e.prStatus,a?r:null,a?i:null,Fd),f=!a&&((t?.relatedOpenPullRequestUrls.length??0)>0||n===`prs`),p=kd(e.relatedPrs,f?r:null,f?i:null,Nd),[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:jd,filesAreLoading:!0,filesError:null,commits:Md,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}},Ld=e=>JSON.stringify([e.author,e.createdAt,e.body]),Rd=(e,t)=>{let n=new Set(e.map(Ld));return[...e,...t.filter(e=>!n.has(Ld(e)))]},zd=({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=Ei(e);return(0,x.jsxs)(`a`,{className:`console-markdown-reference`,href:e,target:`_blank`,rel:`noopener noreferrer`,children:[(0,x.jsx)(Ee,{...Oi(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]})]})},Bd=(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},Vd=({cache:e,href:t,fallbackText:n})=>{let r=Bd(e,t);return(0,x.jsx)(zd,{href:t,fallbackText:n,state:r})},Hd=e=>({itemUrl:e.url,projectItemId:e.projectItemId,itemNumber:e.number,repo:e.repo,isPr:e.isPr}),Ud=(e,t,n,r,i)=>({...Hd(t),apiPath:Pr,requestBody:Lr(e,t,n,r,i)}),Wd=(e,t,n,r)=>({...Hd(t),apiPath:Fr,requestBody:Rr(e,t,n,r)}),Gd=(e,t)=>({...Hd(t),apiPath:Ir,requestBody:zr(e,t)}),Kd=({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,onCreateWorkflowIssue:_})=>{let v=Id(n,t,e),b=(0,y.useCallback)(e=>ji(e,t.url),[t.url]),S=(0,y.useCallback)((e,t)=>(0,x.jsx)(Vd,{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}])},[]),[E,D]=(0,y.useState)([]),O=(0,y.useCallback)(async e=>{let n=await r.addComment(t,e);return D(e=>[...e,n]),n},[t,r]),te={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:Ud(i,t,n,e,a),overlayPatch:{done:!0}})},onSetNextActionDate:e=>{m({kind:{type:`next_action_date`,action:e},item:t,commit:()=>r.setNextActionDate(t,e),offline:i==null?void 0:Wd(i,t,e),overlayPatch:{done:!0}})},onSetStory:e=>{m({kind:{type:`set_story`,optionName:e.name},item:t,commit:()=>r.setStory(t,e),offline:i==null?void 0:Wd(i,t,`set_story`,{storyOptionId:e.id}),overlayPatch:{done:!0,story:{name:e.name,color:e.color}}})},onSetAgent:e=>{m({kind:{type:`set_agent`,optionName:e.name},item:t,commit:()=>r.setAgent(t,e),offline:i==null?void 0:Wd(i,t,`set_agent`,{agentOptionId:e.id}),overlayPatch:{done:!0}})},onSetStatus:e=>{m({kind:{type:`set_status`,optionName:e.name},item:t,commit:()=>r.setStatus(t,e),offline:i==null?void 0:Wd(i,t,`set_status`,{statusName:e.name}),overlayPatch:{done:!0,status:{name:e.name,color:e.color}}})},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:Gd(i,t),overlayPatch:{done:!0,status:{name:e.name,color:e.color}}})},onClose:e=>{m({kind:{type:`close`,action:e},item:t,commit:()=>r.closeIssue(t,e),offline:i==null?void 0:Wd(i,t,e),overlayPatch:{done:!0}})},onOkAndAwaitingWorkspace:e=>{m({kind:{type:`ok_and_awaiting_workspace`},item:t,commit:()=>r.okAndMoveToAwaitingWorkspace(t,e),overlayPatch:{done:!0,status:{name:e.name,color:e.color}}})},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)}},k=(0,y.useCallback)(async e=>{await r.issueRename(t,e)},[t,r]),A=a.find(e=>e.name===`Awaiting Workspace`)??null,ne=A===null?void 0:async e=>(p?.(``),te.onSetStatus(A),O(e)),j=(0,y.useRef)(``),[re,M]=(0,y.useState)((f??``).trim().length===0),ie=(0,y.useCallback)(e=>{j.current=e,M(e.trim().length===0),p?.(e)},[p]),ae=async e=>{await O(e),te.onClose(`close`)},oe=async()=>{let e=j.current.trim();e.length!==0&&await ae(e)},N=l??(t.story.trim()===``?null:t.story),se=N===null?null:I(c,N);return(0,x.jsx)(hd,{item:t,storyName:N,storyColorEnum:se,overlayStatus:u,statusOptions:a,state:v.state,stateError:v.stateError,body:v.body,bodyIsLoading:v.bodyIsLoading,bodyError:v.bodyError,comments:Rd(v.comments,E),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,onTitleRename:k,onCreateWorkflowIssue:_,commentComposer:(0,x.jsx)(wi,{initiallyOpen:!0,initialDraft:f,onSubmit:O,onDraftChange:ie,onOkAndAwaitingWorkspace:A===null?void 0:()=>te.onOkAndAwaitingWorkspace(A),onSubmitAndMoveToAwaitingWorkspace:ne,onUploadFile:e=>r.uploadAttachment(t,e)}),operationBar:(0,x.jsx)(Od,{tab:e,item:t,hasPullRequest:C,rejectEnabled:w.length>0,statusOptions:a,storyOptions:o,currentStoryName:N,agentOptions:s,currentAgentName:t.agent,handlers:te,storyNameForDeletion:g,onCommentAndClose:oe,isDraftEmpty:re})})},qd=()=>{let e={};for(let t of j)e[t.name]=0;return e},Jd=`console`,Yd=()=>{let e=Jr(),t=_r(),n=bt(),r=n.status===`on`?n.snapshot:null,{snapshots:i,isLoading:a,error:o,refreshSingleTab:s}=ir(e,r),{timerMode:c,projectMinutes:l,isOpen:u,draftTimerMode:d,draftProjectMinutes:f,openSettings:p,closeSettings:m,saveSettings:h,toggleDraftTimerMode:g,changeDraftMinutes:_}=gi(),{pjcodes:v,projectUrls:b,fleetTaskCreateUrl:C,nameWithOwnerByPjcode:w,isLoading:ee}=Yr(),{isTimerExpired:E}=$r(e),D=Kr(e??Jd),O=Qr(v),te=(0,y.useMemo)(()=>{let e=qd();for(let t of j){let n=i[t.name];n!==null&&(t.name===`stories`?e[t.name]=n.stories.filter(e=>e.color!==`GRAY`).length:e[t.name]=Or(n.items,Ar(D.overlay,n.generatedAt),t.name))}return e},[i,D.overlay]);ar(e,v,c&&r===null);let k=wr(e,te,(0,y.useMemo)(()=>{let e=new Set;for(let t of j)i[t.name]!==null&&e.add(t.name);return e},[i]),(0,y.useMemo)(()=>{let e=qd();for(let t of j){let n=i[t.name];n!==null&&(e[t.name]=t.name===`stories`?n.stories.filter(e=>e.color!==`GRAY`).length:n.items.length)}return e},[i])),{activeTab:A,selectedItemKey:ne,openItem:re,closeItem:M}=k,ae=di(k.selectTab),oe=Xr((0,y.useCallback)(e=>pi(`/projects/${e}`),[])),N=(0,y.useRef)(new Map),se=(0,y.useCallback)(e=>{ne!==null&&(e?N.current.set(ne,e):N.current.delete(ne))},[ne]),le=lr(r),P=Hr(e,A,D,le,(0,y.useCallback)(()=>s(`queued`),[s])),F=Bn(),[de,pe]=(0,y.useState)(()=>Date.now());(0,y.useEffect)(()=>{let e=setInterval(()=>{pe(Date.now())},1e3);return()=>{clearInterval(e)}},[]);let[I,R]=(0,y.useState)(!1),[he,ge]=(0,y.useState)({title:``,body:null,storyName:null,agentOptionId:null}),[_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&&F.offlineActions.length!==0)for(let e of F.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,F.offlineActions,le.client,ye,Ce]);let[Te,Ee]=(0,y.useState)(!1),De=(0,y.useCallback)(async e=>{Ee(!0);try{await F.confirmOfflineAction(e)}finally{Ee(!1)}},[F]),Oe=(0,y.useMemo)(()=>F.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}}),[F.offlineActions,ye,xe,Ce]),je=i[A],Me=(0,y.useMemo)(()=>je===null?[]:kr(je.items,Ar(D.overlay,je.generatedAt),A),[je,D.overlay,A]),[Pe,Fe]=(0,y.useState)(null),Ie=(0,y.useMemo)(()=>{if(A!==`prs`)return{};let e={};for(let t of Me)t.agent!==null&&t.agent!==``&&(e[t.agent]=(e[t.agent]??0)+1);return e},[Me,A]);(0,y.useEffect)(()=>{A===`prs`&&Pe!==null&&(Ie[Pe]??0)===0&&Fe(null)},[Ie,Pe,A]);let Le=(0,y.useMemo)(()=>A!==`prs`||Pe===null?Me:Me.filter(e=>e.agent===Pe),[Me,A,Pe]),Re=(0,y.useMemo)(()=>Le.map(e=>Er(e)),[Le]),ze=je?.storyOrder??[],Be=(0,y.useMemo)(()=>me(Le,D.overlay,ze,je?.generatedAt??null),[Le,D.overlay,ze,je]),Ve=je?.storyColors??{},Ue=je?.statusOptions??[],We=je?.agentOptions??[],Ge=je?.storyOptions??[],Ke=je?.generatedAt??null,Xe=je?.fromCache??!1,[Ze,Qe]=(0,y.useState)(null),$e=(0,y.useMemo)(()=>ne===null||je===null?null:je.items.find(e=>e.projectItemId===ne)??null,[ne,je]);hr(le,$e,Me),(0,y.useEffect)(()=>{ne!==null&&window.scrollTo({top:0})},[ne]),(0,y.useEffect)(()=>{if(e===null&&c&&v.length>0){let e=ce(v,null,l);e!==null&&mi(`/projects/${e}/todo-by-human`)}},[e,c,v,l]),hi(c,te.prs,te[`todo-by-human`],e,v,l,i.prs!==null,i[`todo-by-human`]!==null,i.prs?.fromCache??!1,i[`todo-by-human`]?.fromCache??!1),fi(c,e,Le,ne,k.openItem);let et=te[A],tt=(0,y.useRef)({tab:A,count:et});(0,y.useEffect)(()=>{let e=tt.current;if(tt.current={tab:A,count:et},e.tab===A&&e.count>0&&et===0){let e=vr(A,te);e!==null&&(ae(e),M())}},[A,et,te,ae,M]);let nt=$e===null?null:jr(D.overlay,$e,i[A]?.generatedAt??null),rt=$e===null?null:L($e,D.overlay,i[A]?.generatedAt??null),it=(0,y.useCallback)(e=>{let t=_i(Re,e);t===null?M():re(t)},[Re,re,M]),z=(0,y.useCallback)(t=>{if(n.status===`on`){F.showError(`Airplane mode`,`This action requires a network connection. Turn off airplane mode and try again.`);return}let r=Er(t.item),i=t.overlayPatch;F.enqueue({message:Tn(t.kind,t.item,A),color:Cn(t.kind),commit:t.commit,offline:t.offline,revertAdvance:t.revertAdvance,optimistic:i===void 0?void 0:()=>D.patchOverlay(r,i,A),revertOptimistic:i===void 0?void 0:()=>D.revertOverlayEntry(r),advance:()=>{if(t.onAdvance?.(),!t.skipAdvance&&wn(t.kind,A)){if(c&&E(l[e??``]??15)){let t=ce(v,e,l);t!==null&&pi(`/projects/${t}/todo-by-human`)}else it(r)}}})},[F,A,it,n.status,D,c,E,l,e,v]),B=ui((0,y.useCallback)(e=>{if(ne===null||e===null)return;let t=e===`next`?vi(Re,ne):yi(Re,ne);t!==null&&re(t)},[ne,Re,re])),[at,ot]=(0,y.useState)(()=>localStorage.getItem(`console-story-show-gray`)===`true`),st=(0,y.useCallback)(()=>{ot(e=>{let t=!e;return localStorage.setItem(`console-story-show-gray`,String(t)),t})},[]),ct=i.stories,lt=ct?.stories??[],ut=Ze!==null&&Ze.generatedAt===ct?.generatedAt?Ze.stories:lt,dt=ct?.defaultNameWithOwner??null,ft=dt===null?null:`https://github.com/${dt}/issues/new`,pt=(0,y.useMemo)(()=>$e===null||!$e.labels.includes(`story`)?null:ut.find(e=>e.storyName===$e.story)??null,[$e,ut]),mt=(0,y.useCallback)((e,t)=>{if(C===null||$e===null)return Promise.resolve();let n=C.replace(`https://github.com/`,``).replace(/\/issues\/new.*$/,``),r=$e.title;return F.enqueue({message:`Task created — "${e}"`,color:`blue`,commit:async()=>{await Qt({nameWithOwner:n,title:e,sourceIssueTitle:r,quotedCommentBody:t})},advance:()=>{}}),Promise.resolve()},[C,$e,F]),ht=(0,y.useCallback)(async(t,n)=>{if(e===null)throw Error(`No project specified in the URL path.`);if(dt===null)throw Error(`No repository configured for this project.`);await Xt({pjcode:e,title:n,storyName:t,nameWithOwner:dt})},[e,dt]),gt=(0,y.useCallback)(({storyName:t,agentOptionId:n,title:r,body:i,files:a})=>{if(e===null||dt===null)return Promise.resolve();let o=e,s=dt;return F.enqueue({message:`Task created — "${r}"`,color:`blue`,commit:async()=>{let e=await Xt({pjcode:o,title:r,storyName:t??``,nameWithOwner:s,agentOptionId:n??null,body:i??null});if(a.length>0){let t=await Promise.all(a.map(async t=>{let n=Ht(new Uint8Array(await t.arrayBuffer()));return H({pjcode:o,url:e,fileName:t.name,contentBase64:n})})),n=await Bt({pjcode:o,url:e,body:t.join(`
|
|
91
|
+
`)[0],id=({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:rd(e.message)}),(0,x.jsx)(`span`,{className:`console-commit-sha`,children:nd(e.sha)}),(0,x.jsx)(`span`,{className:`console-commit-author`,children:e.author}),(0,x.jsx)(`span`,{className:`console-commit-time`,children:k(e.authoredAt,r)})]},e.sha))}):(0,x.jsx)(`p`,{className:`console-commits-notloaded`,children:`Not loaded.`}),ad=({url:e,label:t=`Copy URL`})=>(0,x.jsx)(du,{value:e,idleText:`Copy URL`,idleAriaLabel:t,copiedAriaLabel:`URL copied to clipboard`,className:`console-copy-url-button`}),od=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}))},sd=e=>e.length<=1?e.join(``):`${e.slice(0,-1).join(`, `)} and ${e[e.length-1]}`,cd=({failures:e})=>e.length===0?null:(0,x.jsx)(`div`,{role:`alert`,className:`console-detail-fetch-error`,children:od(e).map(e=>(0,x.jsxs)(`p`,{className:`console-detail-fetch-error-line`,children:[`Failed to load `,sd(e.sections),`:`,` `,e.message]},e.message))}),ld=({title:e,onTitleRename:t})=>{let[n,r]=(0,y.useState)(e),[i,a]=(0,y.useState)(!1),[o,s]=(0,y.useState)(e),[c,l]=(0,y.useState)(!1),[u,d]=(0,y.useState)(null),f=(0,y.useRef)(e);(0,y.useEffect)(()=>{let t=e!==f.current;f.current=e,!i&&t&&r(e)},[e,i]);let p=()=>{s(n),d(null),a(!0)},m=()=>{a(!1),d(null)},h=async()=>{let e=o.trim();if(e===``||e===n){a(!1);return}l(!0),d(null);try{await t(e),r(e),a(!1)}catch(e){d(e instanceof Error?e.message:`Failed to rename`)}finally{l(!1)}};return i?(0,x.jsxs)(`span`,{className:`console-detail-title-text console-detail-title-text--editing`,children:[(0,x.jsx)(`input`,{type:`text`,value:o,onChange:e=>s(e.target.value),onKeyDown:e=>{e.key===`Enter`?h():e.key===`Escape`&&m()},disabled:c,className:`console-detail-title-input`,"aria-label":`Edit title`}),(0,x.jsx)(`button`,{type:`button`,onClick:()=>void h(),disabled:c,className:`console-detail-title-save`,children:`Save`}),(0,x.jsx)(`button`,{type:`button`,onClick:m,disabled:c,className:`console-detail-title-cancel`,children:`Cancel`}),u!==null&&(0,x.jsx)(`span`,{className:`console-detail-title-error`,role:`alert`,children:u})]}):(0,x.jsxs)(`span`,{className:`console-detail-title-text`,children:[n,(0,x.jsx)(`button`,{type:`button`,onClick:p,className:`console-detail-title-edit`,"aria-label":`Edit title`,children:`Edit`})]})},ud={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`}},dd=({mergeableStatus:e})=>{let t=ud[e],n=F(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})},fd=e=>{let t=F(e);return{color:t.fg,borderColor:t.border,backgroundColor:t.bg}},pd=({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:fd(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:fd(`YELLOW`),title:`This branch is out of date with the base branch`,children:`Out of date`})]})},md=({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=Ei(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)(dd,{mergeableStatus:e.mergeableStatus}),(0,x.jsx)(pd,{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)(ad,{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)(Nu,{title:`Description`,children:n?(0,x.jsx)(`p`,{className:`console-pr-body-loading`,children:`Loading description...`}):(0,x.jsx)(Mu,{body:p?.body??t,buildImageProxyUrl:u,renderReferenceLink:d,repoContext:h})}),(0,x.jsx)(Nu,{title:`Changed files`,count:g,children:(0,x.jsx)(Z,{files:r,isLoading:i,error:a,buildImageProxyUrl:u,onAddInlineComment:f})}),(0,x.jsx)(Nu,{title:`Commits`,count:_,defaultCollapsed:!0,children:(0,x.jsx)(id,{commits:o,isLoading:s,error:c,now:l})})]})},hd=({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:E,renderReferenceLink:D,onAddInlineComment:O,onTitleRename:te,onCreateWorkflowIssue:A})=>{let j=a?.state??`open`,re=a?.merged??!1,M=!e.isPr&&j===`closed`?`Closed`:null,ie=Di(e.nameWithOwner)??void 0,ae=F(n),oe=r===null?e.status===null?null:{name:e.status,color:i.find(t=>t.name===e.status)?.color??`GRAY`}:r,N=oe===null?null:F(oe.color),se=p||m!==null?null:f.length,ce=u||d!==null?null:l.length,le=g||_!==null?null:h.length,ue=!u&&d===null&&l.length>0,P=e=>{let t=Ei(e);return t===null?e:`PR #${t.number}`},de=[{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 ${P(e.pullRequest.url)}`,message:e.filesError},{section:`commits of ${P(e.pullRequest.url)}`,message:e.commitsError}])].flatMap(e=>e.message===null?[]:[{section:e.section,message:e.message}]),fe=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)(Ee,{isPr:e.isPr,state:j,merged:re,isDraft:!1,stateReason:``}),te==null?(0,x.jsx)(`span`,{className:`console-detail-title-text`,children:e.title}):(0,x.jsx)(ld,{title:e.title,onTitleRename:te}),(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:[oe!==null&&N!==null&&(0,x.jsx)(`span`,{className:`console-detail-status-chip`,style:{color:N.fg,borderColor:N.border,backgroundColor:N.bg},children:oe.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:ae.dot}}),t]}),e.isPr&&y?.found&&(0,x.jsx)(pd,{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:P(e.pullRequest.url)}),(0,x.jsx)(pd,{isPassedAllCiJob:e.pullRequest.isPassedAllCiJob,isCiStateSuccess:e.pullRequest.isCiStateSuccess,isBranchOutOfDate:e.pullRequest.isBranchOutOfDate,missingRequiredCheckNames:e.pullRequest.missingRequiredCheckNames}),(0,x.jsx)(dd,{mergeableStatus:e.pullRequest.mergeableStatus})]},e.pullRequest.url)),fe.map(e=>(0,x.jsx)(dd,{mergeableStatus:e.mergeableStatus},e.url)),M!==null&&(0,x.jsx)(`span`,{className:`console-detail-closed-label`,children:M})]}),(0,x.jsx)(cd,{failures:de}),(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:ne(e.createdAt),children:[`opened `,k(e.createdAt,w)]}),(0,x.jsx)(ad,{url:e.url}),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)(Nu,{title:`Description`,defaultCollapsed:ue,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)(Mu,{body:o,buildImageProxyUrl:E,renderReferenceLink:D,repoContext:ie}):(0,x.jsx)(`p`,{className:`console-detail-body-notloaded`,children:`Not loaded.`})},ue?`desc-collapsed`:`desc-open`),e.isPr&&(0,x.jsx)(Nu,{title:`Changed files`,count:se,children:(0,x.jsx)(Z,{files:f,isLoading:p,error:m,onAddInlineComment:O})}),(0,x.jsx)(Nu,{title:`Comments`,count:ce,children:(0,x.jsx)(td,{comments:l,isLoading:u,error:d,now:w,buildImageProxyUrl:E,renderReferenceLink:D,repoContext:ie,persistenceKey:e.url,issueTitle:e.title,onCreateWorkflowIssue:A})}),e.isPr&&(0,x.jsx)(Nu,{title:`Commits`,count:le,defaultCollapsed:!0,children:(0,x.jsx)(id,{commits:h,isLoading:g,error:_,now:w})}),!e.isPr&&S.map(e=>(0,x.jsx)(md,{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:E,renderReferenceLink:D,onAddInlineComment:O},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})]})]})},gd=({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))]})},_d=({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)(gd,{className:`console-agent-select`,ariaLabel:`Set agent`,placeholder:`— agent —`,currentOption:r,options:e,onSelect:n},r?.id??`none`)})},vd=({onClose:e,onCommentAndClose:t,isDraftEmpty:n})=>{let[r,i]=(0,y.useState)(!1),[a,o]=(0,y.useState)(null),s=async()=>{if(!(t===void 0||r)){i(!0),o(null);try{await t()}catch(e){o(e instanceof Error?e.message:`failed to post`)}finally{i(!1)}}};return(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`}),t!==void 0&&(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(`button`,{type:`button`,className:`console-op-button`,disabled:r||n===!0,onClick:()=>{s()},children:`Comment & Close`}),a!==null&&(0,x.jsx)(`span`,{role:`alert`,className:`console-op-comment-close-error`,children:a})]})]})},yd=({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 e=>{if(t){c(!0),u(null);try{await t(e)}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?`]}),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(!0),disabled:s,children:s?`Deleting…`:`Delete with child tasks`}),(0,x.jsx)(`button`,{type:`button`,className:`console-op-button console-op-button-danger`,onClick:()=>void p(!1),disabled:s,children:s?`Deleting…`:`Keep child tasks`}),(0,x.jsx)(`button`,{type:`button`,className:`console-op-button`,onClick:()=>{o(!1),u(null)},disabled:s,children:`Cancel`})]})]})]})},bd=({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:`+1h`}),(0,x.jsx)(`button`,{type:`button`,className:`console-op-button console-op-button-snooze`,onClick:()=>t(`snooze_3hours`),children:`+3h`}),(0,x.jsx)(`button`,{type:`button`,className:`console-op-button console-op-button-snooze`,onClick:()=>t(`snooze_6hours`),children:`+6h`}),(0,x.jsx)(`button`,{type:`button`,className:`console-op-button console-op-button-snooze`,onClick:()=>t(`snooze_1day`),children:`+1d`}),(0,x.jsx)(`button`,{type:`button`,className:`console-op-button console-op-button-snooze`,onClick:()=>t(`snooze_2days`),children:`+2d`}),(0,x.jsx)(`button`,{type:`button`,className:`console-op-button console-op-button-snooze`,onClick:()=>t(`snooze_3days`),children:`+3d`}),(0,x.jsx)(`button`,{type:`button`,className:`console-op-button console-op-button-snooze`,onClick:()=>t(`snooze_5days`),children:`+5d`}),(0,x.jsx)(`button`,{type:`button`,className:`console-op-button console-op-button-snooze`,onClick:()=>t(`snooze_1week`),children:e?`+1w skip`:`+1w`}),(0,x.jsx)(`button`,{type:`button`,className:`console-op-button console-op-button-snooze`,onClick:()=>t(`snooze_1month`),children:`+1mo`})]}),xd=[{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`}],Sd=`Reject needs an inline comment on the diff.`,Cd=({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:Sd}),xd.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)})]}),wd=({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})]})},Td=(e,t)=>{let n=t.toLowerCase();return e.find(e=>e.name.toLowerCase()===n)??null},Ed=({statusOptions:e,onSetStatus:t,onSetInTmuxByHuman:n})=>{let r=xe.map(t=>({name:t,option:Td(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=F(r.color),a=e===ye;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)})})},Dd=({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)(gd,{className:`console-story-select`,ariaLabel:`Set story`,placeholder:`— story —`,currentOption:r,options:e,onSelect:n},r?.id??`none`)})},Od=({tab:e,hasPullRequest:t,rejectEnabled:n,statusOptions:r,storyOptions:i,currentStoryName:a,agentOptions:o,currentAgentName:s,handlers:c,storyNameForDeletion:l,onCommentAndClose:u,isDraftEmpty:d})=>{let[f,p]=(0,y.useState)(!1);return(0,x.jsxs)(`div`,{className:`console-operation-bar`,children:[t&&(0,x.jsx)(Cd,{onReview:c.onReview,rejectEnabled:n}),(0,x.jsx)(bd,{isManualTriage:Se(e),onSetNextActionDate:c.onSetNextActionDate}),(0,x.jsx)(Ed,{statusOptions:r,onSetStatus:c.onSetStatus,onSetInTmuxByHuman:c.onSetInTmuxByHuman}),f&&(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(Dd,{storyOptions:i,currentStoryName:a,onSetStory:c.onSetStory}),(0,x.jsx)(_d,{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:()=>p(e=>!e),title:`Change agent or story`,children:`⚙`})}),(0,x.jsx)(wd,{onSetDependedIssueUrl:c.onSetDependedIssueUrl}),(0,x.jsx)(yd,{onDeleteAllComments:c.onDeleteAllComments,onDeleteStory:c.onDeleteStory,storyNameForDeletion:l})]}),(0,x.jsx)(vd,{onClose:c.onClose,onCommentAndClose:u,isDraftEmpty:d})]})]})},kd=(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}},Ad=[],jd=[],Md=[],Nd=[],Pd={state:`open`,merged:!1,isPullRequest:!1,title:``},Fd={found:!1,isConflicted:!1,mergeableStatus:`UNKNOWN`,isPassedAllCiJob:!1,isCiStateSuccess:!1,isBranchOutOfDate:!1,missingRequiredCheckNames:[]},Id=(e,t,n)=>{let r=t===null?null:`${t.repo}#${t.number}`,i=t===null?null:t.url,a=t?.isPr??!1,o=kd(e.body,r,i,``),s=kd(e.state,r,i,Pd),c=kd(e.comments,r,i,Ad),l=kd(e.files,a?r:null,a?i:null,jd),u=kd(e.commits,a?r:null,a?i:null,Md),d=kd(e.prStatus,a?r:null,a?i:null,Fd),f=!a&&((t?.relatedOpenPullRequestUrls.length??0)>0||n===`prs`),p=kd(e.relatedPrs,f?r:null,f?i:null,Nd),[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:jd,filesAreLoading:!0,filesError:null,commits:Md,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}},Ld=e=>JSON.stringify([e.author,e.createdAt,e.body]),Rd=(e,t)=>{let n=new Set(e.map(Ld));return[...e,...t.filter(e=>!n.has(Ld(e)))]},zd=({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=Ei(e);return(0,x.jsxs)(`a`,{className:`console-markdown-reference`,href:e,target:`_blank`,rel:`noopener noreferrer`,children:[(0,x.jsx)(Ee,{...Oi(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]})]})},Bd=(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},Vd=({cache:e,href:t,fallbackText:n})=>{let r=Bd(e,t);return(0,x.jsx)(zd,{href:t,fallbackText:n,state:r})},Hd=e=>({itemUrl:e.url,projectItemId:e.projectItemId,itemNumber:e.number,repo:e.repo,isPr:e.isPr}),Ud=(e,t,n,r,i)=>({...Hd(t),apiPath:Tr,requestBody:Or(e,t,n,r,i)}),Wd=(e,t,n,r)=>({...Hd(t),apiPath:Er,requestBody:kr(e,t,n,r)}),Gd=(e,t)=>({...Hd(t),apiPath:Dr,requestBody:Ar(e,t)}),Kd=({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,onCreateWorkflowIssue:_})=>{let v=Id(n,t,e),b=(0,y.useCallback)(e=>ji(e,t.url),[t.url]),S=(0,y.useCallback)((e,t)=>(0,x.jsx)(Vd,{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}])},[]),[E,D]=(0,y.useState)([]),O=(0,y.useCallback)(async e=>{let n=await r.addComment(t,e);return D(e=>[...e,n]),n},[t,r]),te={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:Ud(i,t,n,e,a),overlayPatch:{done:!0}})},onSetNextActionDate:e=>{m({kind:{type:`next_action_date`,action:e},item:t,commit:()=>r.setNextActionDate(t,e),offline:i==null?void 0:Wd(i,t,e),overlayPatch:{done:!0}})},onSetStory:e=>{m({kind:{type:`set_story`,optionName:e.name},item:t,commit:()=>r.setStory(t,e),offline:i==null?void 0:Wd(i,t,`set_story`,{storyOptionId:e.id}),overlayPatch:{done:!0,story:{name:e.name,color:e.color}}})},onSetAgent:e=>{m({kind:{type:`set_agent`,optionName:e.name},item:t,commit:()=>r.setAgent(t,e),offline:i==null?void 0:Wd(i,t,`set_agent`,{agentOptionId:e.id}),overlayPatch:{done:!0}})},onSetStatus:e=>{m({kind:{type:`set_status`,optionName:e.name},item:t,commit:()=>r.setStatus(t,e),offline:i==null?void 0:Wd(i,t,`set_status`,{statusName:e.name}),overlayPatch:{done:!0,status:{name:e.name,color:e.color}}})},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:Gd(i,t),overlayPatch:{done:!0,status:{name:e.name,color:e.color}}})},onClose:e=>{m({kind:{type:`close`,action:e},item:t,commit:()=>r.closeIssue(t,e),offline:i==null?void 0:Wd(i,t,e),overlayPatch:{done:!0}})},onOkAndAwaitingWorkspace:e=>{m({kind:{type:`ok_and_awaiting_workspace`},item:t,commit:()=>r.okAndMoveToAwaitingWorkspace(t,e),overlayPatch:{done:!0,status:{name:e.name,color:e.color}}})},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)}},k=(0,y.useCallback)(async e=>{await r.issueRename(t,e)},[t,r]),A=a.find(e=>e.name===`Awaiting Workspace`)??null,ne=A===null?void 0:async e=>(p?.(``),te.onSetStatus(A),O(e)),j=(0,y.useRef)(``),[re,M]=(0,y.useState)((f??``).trim().length===0),ie=(0,y.useCallback)(e=>{j.current=e,M(e.trim().length===0),p?.(e)},[p]),ae=async e=>{await O(e),te.onClose(`close`)},oe=async()=>{let e=j.current.trim();e.length!==0&&await ae(e)},N=l??(t.story.trim()===``?null:t.story),se=N===null?null:I(c,N);return(0,x.jsx)(hd,{item:t,storyName:N,storyColorEnum:se,overlayStatus:u,statusOptions:a,state:v.state,stateError:v.stateError,body:v.body,bodyIsLoading:v.bodyIsLoading,bodyError:v.bodyError,comments:Rd(v.comments,E),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,onTitleRename:k,onCreateWorkflowIssue:_,commentComposer:(0,x.jsx)(wi,{initiallyOpen:!0,initialDraft:f,onSubmit:O,onDraftChange:ie,onOkAndAwaitingWorkspace:A===null?void 0:()=>te.onOkAndAwaitingWorkspace(A),onSubmitAndMoveToAwaitingWorkspace:ne,onUploadFile:e=>r.uploadAttachment(t,e)}),operationBar:(0,x.jsx)(Od,{tab:e,item:t,hasPullRequest:C,rejectEnabled:w.length>0,statusOptions:a,storyOptions:o,currentStoryName:N,agentOptions:s,currentAgentName:t.agent,handlers:te,storyNameForDeletion:g,onCommentAndClose:oe,isDraftEmpty:re})})},qd=()=>{let e={};for(let t of j)e[t.name]=0;return e},Jd=`console`,Yd=()=>{let e=Jr(),t=_r(),n=bt(),r=n.status===`on`?n.snapshot:null,{snapshots:i,isLoading:a,error:o,refreshSingleTab:s}=ir(e,r),{timerMode:c,projectMinutes:l,isOpen:u,draftTimerMode:d,draftProjectMinutes:f,openSettings:p,closeSettings:m,saveSettings:h,toggleDraftTimerMode:g,changeDraftMinutes:_}=gi(),{pjcodes:v,projectUrls:b,fleetTaskCreateUrl:C,nameWithOwnerByPjcode:w,isLoading:ee}=Yr(),{isTimerExpired:E}=$r(e),D=Kr(e??Jd),O=Qr(v),te=(0,y.useMemo)(()=>{let e=qd();for(let t of j){let n=i[t.name];n!==null&&(t.name===`stories`?e[t.name]=n.stories.filter(e=>e.color!==`GRAY`).length:e[t.name]=Lr(n.items,zr(D.overlay,n.generatedAt),t.name))}return e},[i,D.overlay]);ar(e,v,c&&r===null);let k=wr(e,te,(0,y.useMemo)(()=>{let e=new Set;for(let t of j)i[t.name]!==null&&e.add(t.name);return e},[i]),(0,y.useMemo)(()=>{let e=qd();for(let t of j){let n=i[t.name];n!==null&&(e[t.name]=t.name===`stories`?n.stories.filter(e=>e.color!==`GRAY`).length:n.items.length)}return e},[i])),{activeTab:A,selectedItemKey:ne,openItem:re,closeItem:M}=k,ae=di(k.selectTab),oe=Xr((0,y.useCallback)(e=>pi(`/projects/${e}`),[])),N=(0,y.useRef)(new Map),se=(0,y.useCallback)(e=>{ne!==null&&(e?N.current.set(ne,e):N.current.delete(ne))},[ne]),le=lr(r),P=Nr(e,le,(0,y.useCallback)(()=>s(`queued`),[s])),F=Bn(),[de,pe]=(0,y.useState)(()=>Date.now());(0,y.useEffect)(()=>{let e=setInterval(()=>{pe(Date.now())},1e3);return()=>{clearInterval(e)}},[]);let[I,R]=(0,y.useState)(!1),[he,ge]=(0,y.useState)({title:``,body:null,storyName:null,agentOptionId:null}),[_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&&F.offlineActions.length!==0)for(let e of F.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,F.offlineActions,le.client,ye,Ce]);let[Te,Ee]=(0,y.useState)(!1),De=(0,y.useCallback)(async e=>{Ee(!0);try{await F.confirmOfflineAction(e)}finally{Ee(!1)}},[F]),Oe=(0,y.useMemo)(()=>F.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}}),[F.offlineActions,ye,xe,Ce]),je=i[A],Me=(0,y.useMemo)(()=>je===null?[]:Rr(je.items,zr(D.overlay,je.generatedAt),A),[je,D.overlay,A]),[Pe,Fe]=(0,y.useState)(null),Ie=(0,y.useMemo)(()=>{if(A!==`prs`)return{};let e={};for(let t of Me)t.agent!==null&&t.agent!==``&&(e[t.agent]=(e[t.agent]??0)+1);return e},[Me,A]);(0,y.useEffect)(()=>{A===`prs`&&Pe!==null&&(Ie[Pe]??0)===0&&Fe(null)},[Ie,Pe,A]);let Le=(0,y.useMemo)(()=>A!==`prs`||Pe===null?Me:Me.filter(e=>e.agent===Pe),[Me,A,Pe]),Re=(0,y.useMemo)(()=>Le.map(e=>Fr(e)),[Le]),ze=je?.storyOrder??[],Be=(0,y.useMemo)(()=>me(Le,D.overlay,ze,je?.generatedAt??null),[Le,D.overlay,ze,je]),Ve=je?.storyColors??{},Ue=je?.statusOptions??[],We=je?.agentOptions??[],Ge=je?.storyOptions??[],Ke=je?.generatedAt??null,Xe=je?.fromCache??!1,[Ze,Qe]=(0,y.useState)(null),$e=(0,y.useMemo)(()=>ne===null||je===null?null:je.items.find(e=>e.projectItemId===ne)??null,[ne,je]);hr(le,$e,Me),(0,y.useEffect)(()=>{ne!==null&&window.scrollTo({top:0})},[ne]),(0,y.useEffect)(()=>{if(e===null&&c&&v.length>0){let e=ce(v,null,l);e!==null&&mi(`/projects/${e}/todo-by-human`)}},[e,c,v,l]),hi(c,te.prs,te[`todo-by-human`],e,v,l,i.prs!==null,i[`todo-by-human`]!==null,i.prs?.fromCache??!1,i[`todo-by-human`]?.fromCache??!1),fi(c,e,Le,ne,k.openItem);let et=te[A],tt=(0,y.useRef)({tab:A,count:et});(0,y.useEffect)(()=>{let e=tt.current;if(tt.current={tab:A,count:et},e.tab===A&&e.count>0&&et===0){let e=vr(A,te);e!==null&&(ae(e),M())}},[A,et,te,ae,M]);let nt=$e===null?null:Br(D.overlay,$e,i[A]?.generatedAt??null),rt=$e===null?null:L($e,D.overlay,i[A]?.generatedAt??null),it=(0,y.useCallback)(e=>{let t=_i(Re,e);t===null?M():re(t)},[Re,re,M]),z=(0,y.useCallback)(t=>{if(n.status===`on`){F.showError(`Airplane mode`,`This action requires a network connection. Turn off airplane mode and try again.`);return}let r=Fr(t.item),i=t.overlayPatch;F.enqueue({message:Tn(t.kind,t.item,A),color:Cn(t.kind),commit:t.commit,offline:t.offline,revertAdvance:t.revertAdvance,optimistic:i===void 0?void 0:()=>D.patchOverlay(r,i,A),revertOptimistic:i===void 0?void 0:()=>D.revertOverlayEntry(r),advance:()=>{if(t.onAdvance?.(),!t.skipAdvance&&wn(t.kind,A)){if(c&&E(l[e??``]??15)){let t=ce(v,e,l);t!==null&&pi(`/projects/${t}/todo-by-human`)}else it(r)}}})},[F,A,it,n.status,D,c,E,l,e,v]),B=ui((0,y.useCallback)(e=>{if(ne===null||e===null)return;let t=e===`next`?vi(Re,ne):yi(Re,ne);t!==null&&re(t)},[ne,Re,re])),[at,ot]=(0,y.useState)(()=>localStorage.getItem(`console-story-show-gray`)===`true`),st=(0,y.useCallback)(()=>{ot(e=>{let t=!e;return localStorage.setItem(`console-story-show-gray`,String(t)),t})},[]),ct=i.stories,lt=ct?.stories??[],ut=Ze!==null&&Ze.generatedAt===ct?.generatedAt?Ze.stories:lt,dt=ct?.defaultNameWithOwner??null,ft=dt===null?null:`https://github.com/${dt}/issues/new`,pt=(0,y.useMemo)(()=>$e===null||!$e.labels.includes(`story`)?null:ut.find(e=>e.storyName===$e.story)??null,[$e,ut]),mt=(0,y.useCallback)((e,t)=>{if(C===null||$e===null)return Promise.resolve();let n=C.replace(`https://github.com/`,``).replace(/\/issues\/new.*$/,``),r=$e.title;return F.enqueue({message:`Task created — "${e}"`,color:`blue`,commit:async()=>{await Qt({nameWithOwner:n,title:e,sourceIssueTitle:r,quotedCommentBody:t})},advance:()=>{}}),Promise.resolve()},[C,$e,F]),ht=(0,y.useCallback)(async(t,n)=>{if(e===null)throw Error(`No project specified in the URL path.`);if(dt===null)throw Error(`No repository configured for this project.`);await Xt({pjcode:e,title:n,storyName:t,nameWithOwner:dt})},[e,dt]),gt=(0,y.useCallback)(({storyName:t,agentOptionId:n,title:r,body:i,files:a})=>{if(e===null||dt===null)return Promise.resolve();let o=e,s=dt;return F.enqueue({message:`Task created — "${r}"`,color:`blue`,commit:async()=>{let e=await Xt({pjcode:o,title:r,storyName:t??``,nameWithOwner:s,agentOptionId:n??null,body:i??null});if(a.length>0){let t=await Promise.all(a.map(async t=>{let n=Ht(new Uint8Array(await t.arrayBuffer()));return H({pjcode:o,url:e,fileName:t.name,contentBase64:n})})),n=await Bt({pjcode:o,url:e,body:t.join(`
|
|
92
92
|
|
|
93
93
|
`)});if(!n.posted)throw Error(n.error)}},advance:()=>{}}),ge({title:``,body:null,storyName:null,agentOptionId:null}),Promise.resolve()},[e,dt,F]),_t=(0,y.useCallback)(async(t,n)=>{if(e===null)throw Error(`No project specified in the URL path.`);await en({pjcode:e,storyOptionId:t,direction:n});let r=ut.findIndex(e=>e.storyOptionId===t);if(r!==-1){let e=r+(n===`up`?-1:1);if(e>=0&&e<ut.length){let t=[...ut],n=t[r];t[r]=t[e],t[e]=n,Qe({generatedAt:ct?.generatedAt,stories:t})}}},[e,ut,ct?.generatedAt]),vt=(0,y.useCallback)(async t=>{if(e===null)throw Error(`No project specified in the URL path.`);await Wt({pjcode:e,storyName:t})},[e]),[yt,V]=(0,y.useState)({}),[xt,St]=(0,y.useState)(null),[Ct,wt]=(0,y.useState)({}),Tt=(0,y.useCallback)((t,n)=>{let r=ut.find(e=>e.storyOptionId===t)?.color;if(St(t),V(e=>({...e,[t]:n})),wt(e=>{let n={...e};return delete n[t],n}),e===null||dt===null){V(e=>r===void 0?e:{...e,[t]:r}),wt(e=>({...e,[t]:`No project or repository configured.`})),St(e=>e===t?null:e);return}Yt({pjcode:e,storyOptionId:t,newColor:n,nameWithOwner:dt}).catch(e=>{V(e=>r===void 0?e:{...e,[t]:r}),wt(n=>({...n,[t]:e instanceof Error?e.message:String(e)}))}).finally(()=>{St(e=>e===t?null:e)})},[e,dt,ut]),Et=(0,y.useCallback)(async(t,n)=>{if(e===null)throw Error(`No project specified in the URL path.`);await an({pjcode:e,storyOptionId:t,deleteChildTasks:n}),Qe({generatedAt:ct?.generatedAt,stories:ut.filter(e=>e.storyOptionId!==t)})},[e,ut,ct?.generatedAt]),Dt=(0,y.useCallback)(async(t,n)=>{if(e===null)throw Error(`No project specified in the URL path.`);await sn({pjcode:e,storyOptionId:t,newName:n});let r=ut.map(e=>e.storyOptionId===t?{...e,storyName:n}:e);Qe({generatedAt:ct?.generatedAt,stories:r})},[e,ut,ct?.generatedAt]),Ot=(0,y.useCallback)(async(t,n)=>{if(e===null)throw Error(`No project specified in the URL path.`);await ln({pjcode:e,storyOptionId:t,description:n});let r=ut.map(e=>e.storyOptionId===t?{...e,description:n}:e);Qe({generatedAt:ct?.generatedAt,stories:r})},[e,ut,ct?.generatedAt]),kt=oi(Me,le.comments,A===`prs`),At=(0,y.useCallback)((e,t)=>{z({kind:{type:`ok_and_awaiting_workspace`},item:e,commit:()=>P.okAndMoveToAwaitingWorkspace(e,t),skipAdvance:!0,overlayPatch:{done:!0,status:{name:t.name,color:t.color}}})},[z,P]);return(0,x.jsxs)(`main`,{className:`console-app`,children:[F.pending!==null&&(0,x.jsx)(Je,{message:F.pending.message,color:F.pending.color,remainingSeconds:F.pending.remainingSeconds,progress:F.pending.progress,onUndo:F.undo}),F.error!==null&&(0,x.jsx)(Ye,{title:F.error.message,message:`Operation failed: ${F.error.reason}`,onDismiss:F.dismissError,onRetry:F.error.retry===void 0?void 0:()=>{F.dismissError(),F.error?.retry?.()}}),(0,x.jsx)(qe,{actions:Oe,isOnline:_e,isConfirming:Te,onConfirm:De,onDiscard:F.discardOfflineAction}),O.isOpen&&(0,x.jsx)(S,{pjcodes:v,inputValues:O.inputValues,onChangeInput:O.changeInput,isLoading:O.isLoading,isSaving:O.isSaving,error:O.error,nameWithOwnerByPjcode:w,onSave:O.save,onClose:O.close}),(0,x.jsx)(ie,{activeTab:A,counts:te,pjcode:e,pjcodes:v,generatedAt:Ke,fromCache:Xe,tabHref:k.tabHref,onSelectTab:ae,onSelectProject:oe,settingsButton:(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(ue,{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:O.open,children:`⚙`}),e!==null&&(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(`button`,{type:`button`,className:`console-task-create-button`,disabled:dt===null||ut.length===0,onClick:()=>R(!0),"aria-label":`Create new task`,title:`Create new task`,children:(0,x.jsxs)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`14`,height:`14`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:[(0,x.jsx)(`path`,{d:`M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7`}),(0,x.jsx)(`path`,{d:`M18.375 2.625a2.121 2.121 0 0 1 3 3L7 18l-4 1 1-4Z`})]})}),I&&(0,x.jsx)(fe,{storyEntries:ut,agentOptions:We,onSubmit:gt,onClose:()=>R(!1),initialDraft:he,onDraftChange:ge,fleetTaskCreateUrl:C,newIssueUrl:ft})]})]}),airplaneModeEnabled:t.airplaneMode,airplaneModeStatus:n.status,airplaneModeProgress:n.progress,airplaneModeCapturedAt:r?.capturedAt??null,airplaneModeFailures:n.failures,onAirplaneModeStartSync:n.startSync,onAirplaneModeTurnOff:n.turnOff,onAirplaneModeRetryFailed:n.retryFailed,projectUrl:e===null?null:b?.[e]??null,fleetTaskCreateUrl:C,now:de}),(0,x.jsx)(T,{timerEndsAt:je?.timerEndsAt??null,timerTotalSeconds:je?.timerTotalSeconds??null,now:de}),A===`stories`?(0,x.jsx)(`div`,{className:`console-list-screen`,children:(0,x.jsx)(He,{stories:ut,isLoading:a,error:o,showGray:at,onCreateIssue:ht,onAddStory:vt,onSelectColor:Tt,onToggleGray:st,onReorderStory:_t,onDeleteStory:Et,onRenameStory:Dt,onUpdateDescription:Ot,optimisticColors:yt,colorChangeInFlight:xt,colorErrors:Ct})}):$e===null?A===`queued`?(0,x.jsx)(`div`,{className:`console-list-screen`,children:(0,x.jsx)(Ne,{rows:Be,storyColors:Ve,statusOptions:Ue,agentOptions:We,activeItemId:null,isLoading:a,error:o,onSelectItem:e=>k.openItem(e.projectItemId)})}):A===`prs`?(0,x.jsxs)(`div`,{className:`console-list-screen`,children:[(0,x.jsx)(Ae,{agentOptions:We,agentCounts:Ie,selectedAgent:Pe,onAgentChange:Fe}),(0,x.jsx)(ke,{rows:Be,storyColors:Ve,statusOptions:Ue,activeItemId:null,now:de,isLoading:a,error:o,onSelectItem:e=>k.openItem(e.projectItemId),executiveSummaries:kt,onOkAndAwaitingWorkspace:At})]}):(0,x.jsx)(`div`,{className:`console-list-screen`,children:(0,x.jsx)(ke,{rows:Be,storyColors:Ve,statusOptions:Ue,activeItemId:null,now:de,isLoading:a,error:o,onSelectItem:e=>k.openItem(e.projectItemId)})}):(0,x.jsx)(`div`,{className:`console-detail-screen`,ref:B,children:(0,x.jsx)(Kd,{tab:A,item:$e,caches:le,operations:P,pjcode:e,statusOptions:Ue,storyOptions:Ge,agentOptions:We,storyColors:Ve,storyName:rt,overlayStatus:nt,now:de,initialCommentDraft:N.current.get($e.projectItemId)??``,onCommentDraftChange:se,onQueueAction:z,onDeleteStory:pt===null?null:async e=>{await Et(pt.storyOptionId,e),M()},storyNameForDeletion:pt?.storyName??null,onCreateWorkflowIssue:C===null?void 0:mt},$e.projectItemId)})]})};`serviceWorker`in navigator&&navigator.serviceWorker.register(`/sw.js`).catch(e=>{console.warn(`Service worker registration failed:`,e)});var Xd=document.getElementById(`root`);if(Xd===null)throw Error(`Root container #root not found`);(0,b.createRoot)(Xd).render((0,x.jsx)(y.StrictMode,{children:(0,x.jsx)(Yd,{})}));
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
6
6
|
<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
|
|
7
7
|
<title>TDPM Console</title>
|
|
8
|
-
<script type="module" crossorigin src="/assets/index-
|
|
8
|
+
<script type="module" crossorigin src="/assets/index-C_uSQ5ZH.js"></script>
|
|
9
9
|
<link rel="stylesheet" crossorigin href="/assets/index--cwS4I8L.css">
|
|
10
10
|
</head>
|
|
11
11
|
<body>
|