@open-mercato/cezar 0.15.0 → 0.15.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (212) hide show
  1. package/dist/automations/github-poller.d.ts +8 -1
  2. package/dist/automations/github-poller.js +78 -13
  3. package/dist/automations/github-poller.js.map +1 -1
  4. package/dist/automations/pr-head.js +15 -1
  5. package/dist/automations/pr-head.js.map +1 -1
  6. package/dist/automations/prompts.js +2 -2
  7. package/dist/automations/types.d.ts +10 -0
  8. package/dist/automations/types.js +12 -1
  9. package/dist/automations/types.js.map +1 -1
  10. package/dist/config.d.ts +1 -0
  11. package/dist/config.js +6 -0
  12. package/dist/config.js.map +1 -1
  13. package/dist/contract/automations.d.ts +31 -1
  14. package/dist/contract/index.d.ts +1 -0
  15. package/dist/contract/index.js +161 -17
  16. package/dist/contract/projects.d.ts +46 -0
  17. package/dist/contract/runs.d.ts +15 -0
  18. package/dist/contract/skills.d.ts +1 -0
  19. package/dist/contract/telemetry.d.ts +124 -0
  20. package/dist/contract/workspace.d.ts +3 -0
  21. package/dist/core/cursor-agent-runner.d.ts +11 -0
  22. package/dist/core/cursor-agent-runner.js +48 -4
  23. package/dist/core/cursor-agent-runner.js.map +1 -1
  24. package/dist/core/disclaim-spawn.d.ts +10 -0
  25. package/dist/core/disclaim-spawn.js +105 -8
  26. package/dist/core/disclaim-spawn.js.map +1 -1
  27. package/dist/git-diff-base.js +26 -19
  28. package/dist/git-diff-base.js.map +1 -1
  29. package/dist/git-remotes.d.ts +43 -0
  30. package/dist/git-remotes.js +127 -0
  31. package/dist/git-remotes.js.map +1 -0
  32. package/dist/git-worktree.d.ts +43 -19
  33. package/dist/git-worktree.js +138 -54
  34. package/dist/git-worktree.js.map +1 -1
  35. package/dist/index.js +46 -6
  36. package/dist/index.js.map +1 -1
  37. package/dist/runs/auto-name.d.ts +17 -0
  38. package/dist/runs/auto-name.js +47 -2
  39. package/dist/runs/auto-name.js.map +1 -1
  40. package/dist/runs/event-history.d.ts +10 -2
  41. package/dist/runs/event-history.js +290 -120
  42. package/dist/runs/event-history.js.map +1 -1
  43. package/dist/runs/retention.js +1 -1
  44. package/dist/runs/retention.js.map +1 -1
  45. package/dist/runs/store.d.ts +16 -3
  46. package/dist/runs/store.js +89 -10
  47. package/dist/runs/store.js.map +1 -1
  48. package/dist/server/checkout.d.ts +4 -0
  49. package/dist/server/checkout.js +9 -5
  50. package/dist/server/checkout.js.map +1 -1
  51. package/dist/server/create-project.d.ts +77 -0
  52. package/dist/server/create-project.js +342 -0
  53. package/dist/server/create-project.js.map +1 -0
  54. package/dist/server/forge/github.d.ts +2 -0
  55. package/dist/server/forge/github.js +32 -10
  56. package/dist/server/forge/github.js.map +1 -1
  57. package/dist/server/forge/index.d.ts +1 -12
  58. package/dist/server/forge/index.js +7 -29
  59. package/dist/server/forge/index.js.map +1 -1
  60. package/dist/server/forge/types.d.ts +2 -0
  61. package/dist/server/git-changes.d.ts +15 -0
  62. package/dist/server/git-changes.js +51 -1
  63. package/dist/server/git-changes.js.map +1 -1
  64. package/dist/server/git.d.ts +3 -2
  65. package/dist/server/git.js +4 -3
  66. package/dist/server/git.js.map +1 -1
  67. package/dist/server/project-context.js +1 -1
  68. package/dist/server/project-context.js.map +1 -1
  69. package/dist/server/server.d.ts +609 -302
  70. package/dist/server/server.js +191 -12
  71. package/dist/server/server.js.map +1 -1
  72. package/dist/server/star-count.d.ts +27 -11
  73. package/dist/server/star-count.js +57 -28
  74. package/dist/server/star-count.js.map +1 -1
  75. package/dist/telemetry-cli.d.ts +10 -0
  76. package/dist/telemetry-cli.js +54 -0
  77. package/dist/telemetry-cli.js.map +1 -0
  78. package/dist/telemetry-service.json +1 -0
  79. package/dist/telemetry.d.ts +79 -0
  80. package/dist/telemetry.js +453 -0
  81. package/dist/telemetry.js.map +1 -0
  82. package/dist/workflows/run.d.ts +28 -0
  83. package/dist/workflows/run.js +111 -16
  84. package/dist/workflows/run.js.map +1 -1
  85. package/dist/workspace/config.d.ts +10 -0
  86. package/dist/workspace/config.js +16 -0
  87. package/dist/workspace/config.js.map +1 -1
  88. package/dist/workspace/projects-cli.js +3 -0
  89. package/dist/workspace/projects-cli.js.map +1 -1
  90. package/package.json +3 -3
  91. package/scripts/mock-claude.mjs +32 -17
  92. package/scripts/stamp-telemetry-service.mjs +20 -0
  93. package/web/dist/assets/agent-task-pickers-mJzYn0UB.js +1 -0
  94. package/web/dist/assets/{alert-dialog-CF_-dmQ1.js → alert-dialog-Dd1WPOaz.js} +1 -1
  95. package/web/dist/assets/arrow-left-fsST4JqT.js +1 -0
  96. package/web/dist/assets/{automation-format-D1nqk0ID.js → automation-format-BTIFWfjt.js} +1 -1
  97. package/web/dist/assets/automations-route-DJjhwqug.js +1 -0
  98. package/web/dist/assets/button-BNnH7COh.js +100 -0
  99. package/web/dist/assets/{centered-state-T0J7VmBb.js → centered-state-sEYB3bgq.js} +1 -1
  100. package/web/dist/assets/check-DA37PQLT.js +1 -0
  101. package/web/dist/assets/chevron-left-zbXV2Qbu.js +1 -0
  102. package/web/dist/assets/chevron-right-Beu1pd6H.js +1 -0
  103. package/web/dist/assets/{collapsible-RD4hkew7.js → collapsible-MuXfYnM8.js} +1 -1
  104. package/web/dist/assets/commit-list-Bps23fvP.js +1 -0
  105. package/web/dist/assets/compare-variants-CQskdfDW.js +1 -0
  106. package/web/dist/assets/composer-DKWLJeo9.js +18 -0
  107. package/web/dist/assets/dashboard-BCNe_6p7.js +44 -0
  108. package/web/dist/assets/diff-CrLUECGW.js +3 -0
  109. package/web/dist/assets/{diff-stat-CFoeFye2.js → diff-stat-SpfygteL.js} +1 -1
  110. package/web/dist/assets/diff-view-DP4Gw3QJ.js +13 -0
  111. package/web/dist/assets/{download-BFQEsJRY.js → download-CBwSbmy_.js} +1 -1
  112. package/web/dist/assets/dropdown-menu-CxPGHgWX.js +1 -0
  113. package/web/dist/assets/ellipsis-BmusVE8U.js +1 -0
  114. package/web/dist/assets/{file-Df5WtpM_.js → file-DkvcUwxT.js} +1 -1
  115. package/web/dist/assets/file-preview-DxFusXAO.js +2 -0
  116. package/web/dist/assets/file-text-DBeC0yKb.js +1 -0
  117. package/web/dist/assets/file-tree-BTJZXRkM.js +1 -0
  118. package/web/dist/assets/{git-commit-horizontal-DawNm4qg.js → git-commit-horizontal-BM9_nEW7.js} +1 -1
  119. package/web/dist/assets/git-toolbar-DXyPCDkQ.js +1 -0
  120. package/web/dist/assets/github-G5fU4gJd.js +1 -0
  121. package/web/dist/assets/index-BN3w52uE.js +21 -0
  122. package/web/dist/assets/index-CAvSSpvF.css +2 -0
  123. package/web/dist/assets/{markdown-Bmfy_1Ll.js → markdown-BpZ4p95p.js} +1 -1
  124. package/web/dist/assets/{markdown-B_O1ys3h.js → markdown-C5F95Rt-.js} +1 -1
  125. package/web/dist/assets/{message-square-BOO9s3qX.js → message-square-BFQln9c4.js} +1 -1
  126. package/web/dist/assets/{pill-bO5OcHuK.js → pill-BcIQGDbn.js} +1 -1
  127. package/web/dist/assets/project-router-CWMOKp_H.js +3 -0
  128. package/web/dist/assets/reference-chip-B7lU_Pyh.js +1 -0
  129. package/web/dist/assets/reference-overflow-ClRRXWez.js +1 -0
  130. package/web/dist/assets/{refresh-cw-BaFyjVUz.js → refresh-cw-BBEYC6z2.js} +1 -1
  131. package/web/dist/assets/repo-git-CgxxZ7cO.js +1 -0
  132. package/web/dist/assets/{run-diff-GZbNs8fA.js → run-diff-BTB7nBeD.js} +1 -1
  133. package/web/dist/assets/run-header-BPNBEaOy.js +1 -0
  134. package/web/dist/assets/{image-preview-4SVDrBvn.js → scroll-within-DRt7mAnQ.js} +1 -1
  135. package/web/dist/assets/{search-x-bpAfQtVY.js → search-x-6BavY3mg.js} +1 -1
  136. package/web/dist/assets/sheet-D9PeyyRZ.js +1 -0
  137. package/web/dist/assets/skills-SIMzpL0l.js +1 -0
  138. package/web/dist/assets/square-DsFAQaY9.js +1 -0
  139. package/web/dist/assets/tab-link-DEUSZU49.js +1 -0
  140. package/web/dist/assets/{tag-DLwUkUsN.js → tag-DvCVnA6I.js} +1 -1
  141. package/web/dist/assets/task-changes-D-aajoMU.js +1 -0
  142. package/web/dist/assets/task-commits-BYD1GVkS.js +1 -0
  143. package/web/dist/assets/task-composer-7bdNNMP_.js +12 -0
  144. package/web/dist/assets/task-files-BfIOz-eN.js +1 -0
  145. package/web/dist/assets/task-graph-B5-5_IPh.js +1 -0
  146. package/web/dist/assets/task-notes-CfkTBgo8.js +1 -0
  147. package/web/dist/assets/task-thread-eEkjTDxr.js +10 -0
  148. package/web/dist/assets/{terminal-CwrL1hAi.js → terminal-xRHwWarr.js} +1 -1
  149. package/web/dist/assets/textarea-rKUFh5lI.js +1 -0
  150. package/web/dist/assets/thread-loading-DLlbK51g.js +1 -0
  151. package/web/dist/assets/{token-metrics-C149OWmd.js → token-metrics-BcPjL36-.js} +1 -1
  152. package/web/dist/assets/tooltip-BVqBAGNb.js +1 -0
  153. package/web/dist/assets/tracker-2DfMzsIE.js +4 -0
  154. package/web/dist/assets/triangle-alert-CP3Xp0FU.js +1 -0
  155. package/web/dist/assets/upload-bwO_2kok.js +1 -0
  156. package/web/dist/assets/use-automations-PceYR6ss.js +5 -0
  157. package/web/dist/assets/use-now-BAKdIYLG.js +1 -0
  158. package/web/dist/assets/use-submit-shortcut-BA4NVpJl.js +1 -0
  159. package/web/dist/assets/workflow-graph-HopaWPea.js +13 -0
  160. package/web/dist/assets/x-HaVPcg_B.js +1 -0
  161. package/web/dist/index.html +28 -31
  162. package/web/dist/assets/agent-task-pickers-C3ydGatB.js +0 -1
  163. package/web/dist/assets/arrow-left-BxBdc5DC.js +0 -1
  164. package/web/dist/assets/automations-route-BsflncpV.js +0 -1
  165. package/web/dist/assets/button-CjSjKnkd.js +0 -100
  166. package/web/dist/assets/check-DAAMuI4o.js +0 -1
  167. package/web/dist/assets/chevron-left-CvcqxpQZ.js +0 -1
  168. package/web/dist/assets/chevron-right-DKiL3NWw.js +0 -1
  169. package/web/dist/assets/commit-list-BJac2uO6.js +0 -1
  170. package/web/dist/assets/compare-variants-CfqICvRy.js +0 -1
  171. package/web/dist/assets/composer-DZx3cwQW.js +0 -18
  172. package/web/dist/assets/dashboard-CpCDiZdE.js +0 -44
  173. package/web/dist/assets/diff-LG2cl0PE.js +0 -3
  174. package/web/dist/assets/diff-controls-QgdH-r3F.js +0 -1
  175. package/web/dist/assets/diff-view-BVwSaBb2.js +0 -13
  176. package/web/dist/assets/dropdown-menu-DkEK7m00.js +0 -1
  177. package/web/dist/assets/editable-title-CJSWyCcL.js +0 -1
  178. package/web/dist/assets/ellipsis-vertical-CB0adfr7.js +0 -1
  179. package/web/dist/assets/external-link-DPKRidDg.js +0 -1
  180. package/web/dist/assets/eye-CEHQ0c-s.js +0 -1
  181. package/web/dist/assets/file-preview-kYsqZiLU.js +0 -2
  182. package/web/dist/assets/file-text-m0tZu8sU.js +0 -1
  183. package/web/dist/assets/git-merge-B7oVXcKc.js +0 -1
  184. package/web/dist/assets/git-toolbar-B0K4Q5Zv.js +0 -1
  185. package/web/dist/assets/github-C4WaHPni.js +0 -1
  186. package/web/dist/assets/index-CiQrbvAq.js +0 -21
  187. package/web/dist/assets/index-WWaEax-B.css +0 -2
  188. package/web/dist/assets/pencil-CCR9uUZ1.js +0 -1
  189. package/web/dist/assets/reference-chip-Bx_mG9QG.js +0 -1
  190. package/web/dist/assets/repo-git-Mn3_jrGP.js +0 -1
  191. package/web/dist/assets/run-header-i1D5Lvfs.js +0 -1
  192. package/web/dist/assets/sheet-DCdZVHFk.js +0 -1
  193. package/web/dist/assets/skills-Dea5ynJK.js +0 -1
  194. package/web/dist/assets/tab-link-BVItTl_Y.js +0 -1
  195. package/web/dist/assets/task-changes-xNbBM7FO.js +0 -1
  196. package/web/dist/assets/task-commits-BYozE_X3.js +0 -1
  197. package/web/dist/assets/task-composer-Brx0sa7_.js +0 -12
  198. package/web/dist/assets/task-files-MAPO-efK.js +0 -1
  199. package/web/dist/assets/task-graph-BSLCUr1E.js +0 -1
  200. package/web/dist/assets/task-thread-CRVmwchQ.js +0 -9
  201. package/web/dist/assets/textarea-Bb0_Hz53.js +0 -1
  202. package/web/dist/assets/thread-loading-Bo6IOu3Y.js +0 -1
  203. package/web/dist/assets/toaster-Hj_czp_o.js +0 -3
  204. package/web/dist/assets/tooltip--PYfu68E.js +0 -1
  205. package/web/dist/assets/tracker-DM5WtYD0.js +0 -4
  206. package/web/dist/assets/trash-2-EdjdGvEo.js +0 -1
  207. package/web/dist/assets/triangle-alert-DpH3QFz6.js +0 -1
  208. package/web/dist/assets/use-automations-XKvBTPM-.js +0 -5
  209. package/web/dist/assets/use-now-CrM50BFB.js +0 -1
  210. package/web/dist/assets/use-submit-shortcut-BJ10ZshV.js +0 -1
  211. package/web/dist/assets/workflow-graph-Y2Pr7ubb.js +0 -13
  212. package/web/dist/assets/x-BkwTUDpG.js +0 -1
@@ -1 +0,0 @@
1
- import{F as e}from"./button-CjSjKnkd.js";var t=e(`ellipsis-vertical`,[[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}],[`circle`,{cx:`12`,cy:`5`,r:`1`,key:`gxeob9`}],[`circle`,{cx:`12`,cy:`19`,r:`1`,key:`lyex9k`}]]);export{t};
@@ -1 +0,0 @@
1
- import{F as e}from"./button-CjSjKnkd.js";var t=e(`external-link`,[[`path`,{d:`M15 3h6v6`,key:`1q9fwt`}],[`path`,{d:`M10 14 21 3`,key:`gplh6r`}],[`path`,{d:`M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6`,key:`a6xqqp`}]]);export{t};
@@ -1 +0,0 @@
1
- import{F as e}from"./button-CjSjKnkd.js";var t=e(`eye`,[[`path`,{d:`M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0`,key:`1nclc0`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]);export{t};
@@ -1,2 +0,0 @@
1
- import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{Ct as r,Rn as i,ai as a,mt as o,ni as s}from"./toaster-Hj_czp_o.js";import{F as c,r as l}from"./button-CjSjKnkd.js";import{t as u}from"./triangle-alert-DpH3QFz6.js";import{t as d}from"./centered-state-T0J7VmBb.js";import{a as f,i as p,r as m,t as h}from"./markdown-Bmfy_1Ll.js";var g=c(`file-exclamation-point`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M12 9v4`,key:`juzpu7`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]),_=c(`file-question-mark`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}],[`path`,{d:`M9.1 9a3 3 0 0 1 5.82 1c0 2-3 3-3 3`,key:`mhlwft`}]]),v=c(`file-x`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`m14.5 12.5-5 5`,key:`b62r18`}],[`path`,{d:`m9.5 12.5 5 5`,key:`1rk7el`}]]),y=c(`folder-tree`,[[`path`,{d:`M20 10a1 1 0 0 0 1-1V6a1 1 0 0 0-1-1h-2.5a1 1 0 0 1-.8-.4l-.9-1.2A1 1 0 0 0 15 3h-2a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z`,key:`hod4my`}],[`path`,{d:`M20 21a1 1 0 0 0 1-1v-3a1 1 0 0 0-1-1h-2.9a1 1 0 0 1-.88-.55l-.42-.85a1 1 0 0 0-.92-.6H13a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z`,key:`w4yl2u`}],[`path`,{d:`M3 5a2 2 0 0 0 2 2h3`,key:`f2jnh7`}],[`path`,{d:`M3 3v13a2 2 0 0 0 2 2h3`,key:`k8epm1`}]]),b=c(`image`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,ry:`2`,key:`1m3agn`}],[`circle`,{cx:`9`,cy:`9`,r:`2`,key:`af1f0g`}],[`path`,{d:`m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21`,key:`1xmnt7`}]]),x=c(`mouse-pointer-click`,[[`path`,{d:`M14 4.1 12 6`,key:`ita8i4`}],[`path`,{d:`m5.1 8-2.9-.8`,key:`1go3kf`}],[`path`,{d:`m6 12-1.9 2`,key:`mnht97`}],[`path`,{d:`M7.2 2.2 8 5.1`,key:`1cfko1`}],[`path`,{d:`M9.037 9.69a.498.498 0 0 1 .653-.653l11 4.5a.5.5 0 0 1-.074.949l-4.349 1.041a1 1 0 0 0-.74.739l-1.04 4.35a.5.5 0 0 1-.95.074z`,key:`s0h3yz`}]]),S=e(t(),1),C=new Set([`png`,`jpg`,`jpeg`,`gif`,`webp`,`svg`,`bmp`,`ico`,`avif`]);function w(e){let t=e.slice(e.lastIndexOf(`/`)+1),n=t.lastIndexOf(`.`);return n<=0?!1:C.has(t.slice(n+1).toLowerCase())}function T(e){return e.tooLarge?`too-large`:w(e.path)?`image`:e.binary?`binary`:`text`}function E(e){return e>=1024**2?`${(e/1024**2).toFixed(1)} MB`:e>=1024?`${(e/1024).toFixed(1)} kB`:`${e} B`}var D=n();function O(e,t){let n=r(e.kind===`run`?e.runId:void 0,e.kind===`run`?t:void 0),i=o(e.kind===`repo`?t:void 0);return e.kind===`run`?n:i}function k(e,t){return e.kind===`run`?a(e.runId,t):s(t)}function A({source:e,path:t,className:n}){let r=O(e,t??void 0);if(t===null)return(0,D.jsx)(P,{className:n,children:(0,D.jsx)(d,{icon:(0,D.jsx)(x,{}),tone:`neutral`,heading:`h2`,title:`Select a file`,subtitle:`Pick a file from the tree to preview it here.`})});if(r.isPending)return(0,D.jsx)(P,{className:n,children:(0,D.jsxs)(`p`,{"data-slot":`file-preview-loading`,className:`px-4 py-6 text-center text-xs text-soft-foreground`,children:[`Loading `,t,`…`]})});if(r.isError){let e=r.error instanceof i&&r.error.status===409;return(0,D.jsx)(P,{className:n,children:(0,D.jsx)(d,{icon:e?(0,D.jsx)(v,{}):(0,D.jsx)(u,{}),tone:e?`neutral`:`danger`,heading:`h2`,title:e?`Cannot preview this file`:`Could not load this file`,subtitle:r.error.message})})}return r.data.type===`file`?(0,D.jsx)(N,{source:e,entry:r.data,className:n}):null}function j(e){return/\.(md|markdown|mdx)$/i.test(e)}var M=`rendered`;function N({source:e,entry:t,className:n}){let r=T(t),i=r===`text`&&j(t.path),[a,o]=(0,S.useState)(M),s=e=>{M=e,o(e)};return(0,D.jsxs)(P,{className:n,children:[(0,D.jsxs)(`header`,{"data-slot":`file-preview-head`,className:`sticky top-0 z-10 flex items-center gap-2 border-b border-border bg-[color-mix(in_oklab,var(--muted)_40%,var(--card))] px-4 py-2 text-xs shadow-[0_-1px_0_color-mix(in_oklab,var(--muted)_40%,var(--card))]`,children:[(0,D.jsx)(`span`,{className:`min-w-0 truncate font-mono font-medium`,children:t.path}),i?(0,D.jsx)(`div`,{"data-slot":`markdown-view-toggle`,className:`ml-auto flex shrink-0 overflow-hidden rounded-sm border border-border`,children:[`rendered`,`source`].map(e=>(0,D.jsx)(`button`,{type:`button`,"data-mode":e,"aria-pressed":a===e,onClick:()=>s(e),className:l(`px-2 py-0.5 capitalize`,a===e?`bg-muted font-medium text-foreground`:`text-soft-foreground hover:bg-muted`),children:e},e))}):null,(0,D.jsx)(`span`,{className:l(`shrink-0 tabular-nums text-soft-foreground`,i?`pl-2`:`ml-auto`),children:E(t.size)})]}),r===`image`?(0,D.jsx)(`div`,{className:`flex justify-center p-4`,children:(0,D.jsx)(`img`,{"data-slot":`file-preview-image`,src:k(e,t.path),alt:t.path,className:`max-h-[70vh] max-w-full rounded-sm`})}):r===`too-large`?(0,D.jsx)(d,{icon:(0,D.jsx)(g,{}),tone:`neutral`,heading:`h2`,title:`Too large to preview`,subtitle:`${E(t.size)} — past the preview cap. Open it in your editor instead.`}):r===`binary`?(0,D.jsx)(d,{icon:(0,D.jsx)(_,{}),tone:`neutral`,heading:`h2`,title:`Binary file`,subtitle:`${E(t.size)} of binary data — no text preview.`}):i&&a===`rendered`?(0,D.jsx)(`div`,{"data-slot":`file-preview-markdown`,className:`px-4 py-3`,children:(0,D.jsx)(h,{children:t.content??``})}):(0,D.jsx)(L,{path:t.path,text:t.content??``})]})}function P({className:e,children:t}){return(0,D.jsx)(`section`,{"data-slot":`file-preview`,className:l(`overflow-clip rounded-lg border border-border bg-card`,e),children:t})}var F=1500;function I(e,t){let n=(0,S.useMemo)(()=>t.split(`
2
- `).map(e=>[{content:e}]),[t]),r=(0,S.useMemo)(()=>f(e),[e]),i=n.length>F,[a,o]=(0,S.useState)(null);return(0,S.useEffect)(()=>{if(r===null||i)return;let n=!1;return m(t,r).then(r=>{n||o({key:`${e}\0${t}`,tokens:r.tokens})}),()=>{n=!0}},[e,t,r,i]),r===null||i?n:a?.key===`${e}\0${t}`?a.tokens:p(t,r)?.tokens??n}function L({path:e,text:t}){let n=I(e,t);return(0,D.jsx)(`div`,{"data-slot":`file-preview-code`,"data-lang":f(e)??`plaintext`,className:`overflow-x-auto py-2 font-mono text-xs leading-[1.7]`,children:n.map((e,t)=>(0,D.jsxs)(`div`,{className:`flex px-4`,children:[(0,D.jsx)(`span`,{className:`w-10 shrink-0 select-none pr-3 text-right tabular-nums text-soft-foreground`,children:t+1}),(0,D.jsx)(`span`,{className:`min-w-0 flex-1 whitespace-pre pr-4`,children:e.map((e,t)=>(0,D.jsx)(`span`,{style:e.color===void 0?void 0:{color:e.color},children:e.content},t))})]},t))})}export{y as a,b as i,E as n,w as r,A as t};
@@ -1 +0,0 @@
1
- import{F as e}from"./button-CjSjKnkd.js";var t=e(`copy`,[[`rect`,{width:`14`,height:`14`,x:`8`,y:`8`,rx:`2`,ry:`2`,key:`17jyea`}],[`path`,{d:`M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2`,key:`zix9uf`}]]),n=e(`file-text`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M10 9H8`,key:`b1mrlr`}],[`path`,{d:`M16 13H8`,key:`t4e002`}],[`path`,{d:`M16 17H8`,key:`z1uh3a`}]]);export{t as n,n as t};
@@ -1 +0,0 @@
1
- import{F as e}from"./button-CjSjKnkd.js";var t=e(`circle-check`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]),n=e(`git-merge`,[[`circle`,{cx:`18`,cy:`18`,r:`3`,key:`1xkwt0`}],[`circle`,{cx:`6`,cy:`6`,r:`3`,key:`1lh9wr`}],[`path`,{d:`M6 21V9a9 9 0 0 0 9 9`,key:`7kw0sc`}]]);export{t as n,n as t};
@@ -1 +0,0 @@
1
- import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{i as r,r as i,t as a}from"./button-CjSjKnkd.js";import{t as o}from"./chevron-right-DKiL3NWw.js";import{c as s,h as c,m as l,n as u,r as d,t as f}from"./dropdown-menu-DkEK7m00.js";import{t as p}from"./ellipsis-vertical-CB0adfr7.js";import{t as m}from"./external-link-DPKRidDg.js";import{t as h}from"./file-Df5WtpM_.js";import{t as g}from"./git-commit-horizontal-DawNm4qg.js";import{n as _}from"./triangle-alert-DpH3QFz6.js";import{n as v,t as y}from"./diff-controls-QgdH-r3F.js";import{t as b}from"./diff-stat-CFoeFye2.js";import{N as x}from"./index-CiQrbvAq.js";import{n as S}from"./markdown-B_O1ys3h.js";var C=e(t(),1),w=n();function T({root:e,selected:t,onSelect:n,commentCounts:r=E}){return(0,w.jsx)(D.Provider,{value:r,children:(0,w.jsx)(`nav`,{"data-slot":`changes-tree`,"aria-label":`Changed files`,className:`min-w-0 text-[13px]`,children:(0,w.jsxs)(`ul`,{className:`flex flex-col gap-px`,children:[e.dirs.map(e=>(0,w.jsx)(A,{dir:e,depth:0,selected:t,onSelect:n},e.path)),e.files.map(e=>(0,w.jsx)(M,{file:e,depth:0,selected:t,onSelect:n},e.path))]})})})}var E=new Map,D=(0,C.createContext)(E);function O(e,t){let n=0;for(let r of e.files)n+=t.get(r.path)??0;for(let r of e.dirs)n+=O(r,t);return n}function k({adds:e,dels:t}){return(0,w.jsxs)(`span`,{className:`shrink-0 font-mono text-[11px] font-medium tabular-nums`,children:[e>0?(0,w.jsxs)(`span`,{className:`text-success`,children:[`+`,e]}):null,e>0&&t>0?` `:null,t>0?(0,w.jsxs)(`span`,{className:`text-danger`,children:[`−`,t]}):null]})}function A({dir:e,depth:t,selected:n,onSelect:r}){let[a,s]=(0,C.useState)(!0),l=(0,C.useContext)(D),u=a?0:O(e,l);return(0,w.jsxs)(`li`,{children:[(0,w.jsxs)(`button`,{type:`button`,"data-slot":`tree-dir`,"data-path":e.path,"data-state":a?`open`:`closed`,"aria-expanded":a,onClick:()=>s(e=>!e),className:`flex w-full min-w-0 items-center gap-1.5 rounded-sm px-1.5 py-1 text-left text-muted-foreground hover:bg-muted hover:text-foreground`,style:{paddingLeft:`${6+t*14}px`},children:[(0,w.jsx)(o,{"aria-hidden":`true`,className:i(`size-3.5 shrink-0 transition-transform`,a&&`rotate-90`)}),(0,w.jsx)(c,{"aria-hidden":`true`,className:`size-3.5 shrink-0`}),(0,w.jsx)(`span`,{className:`min-w-0 truncate font-medium`,children:e.name}),(0,w.jsxs)(`span`,{className:`ml-auto flex shrink-0 items-center gap-2 pl-2`,children:[(0,w.jsx)(S,{count:u}),(0,w.jsx)(k,{adds:e.adds,dels:e.dels})]})]}),a?(0,w.jsxs)(`ul`,{className:`flex flex-col gap-px`,children:[e.dirs.map(e=>(0,w.jsx)(A,{dir:e,depth:t+1,selected:n,onSelect:r},e.path)),e.files.map(e=>(0,w.jsx)(M,{file:e,depth:t+1,selected:n,onSelect:r},e.path))]}):null]})}var j={added:`text-success`,deleted:`text-danger`};function M({file:e,depth:t,selected:n,onSelect:r}){let a=n===e.path,o=(0,C.useContext)(D).get(e.path)??0;return(0,w.jsx)(`li`,{children:(0,w.jsxs)(`button`,{type:`button`,"data-slot":`tree-file`,"data-path":e.path,"aria-current":a?`true`:void 0,onClick:()=>r(e.path),className:i(`flex w-full min-w-0 items-center gap-1.5 rounded-sm px-1.5 py-1 text-left hover:bg-muted`,a?`bg-muted font-medium text-foreground`:`text-muted-foreground hover:text-foreground`),style:{paddingLeft:`${24+t*14}px`},children:[(0,w.jsx)(h,{"aria-hidden":`true`,className:i(`size-3.5 shrink-0`,j[e.status])}),(0,w.jsx)(`span`,{className:`min-w-0 truncate`,children:e.name}),(0,w.jsxs)(`span`,{className:`ml-auto flex shrink-0 items-center gap-2 pl-2`,children:[(0,w.jsx)(S,{count:o}),(0,w.jsx)(k,{adds:e.adds,dels:e.dels})]})]})})}var N=(e,t)=>e.name.localeCompare(t.name);function P(e){let t=e;for(;t.files.length===0&&t.dirs.length===1;){let e=t.dirs[0];t={...e,name:`${t.name}/${e.name}`}}return{...t,dirs:t.dirs.map(P)}}function F(e,t){let n=(e,t)=>({kind:`dir`,name:e,path:t,dirs:[],files:[]}),r=n(``,``),i=new Map([[``,r]]),a=e=>{let t=i.get(e);if(t)return t;let r=e.lastIndexOf(`/`),o=a(r===-1?``:e.slice(0,r)),s=n(r===-1?e:e.slice(r+1),e);return o.dirs.push(s),i.set(e,s),s};for(let n of e){let e=n.lastIndexOf(`/`);a(e===-1?``:n.slice(0,e)).files.push(t(n,e===-1?n:n.slice(e+1)))}let o=e=>{e.dirs.forEach(o),e.dirs.sort(N),e.files.sort(N)};return o(r),{...r,dirs:r.dirs.map(P)}}function I(e){let t=new Map(e.map(e=>[e.path,e])),n=F(e.map(e=>e.path),(e,n)=>{let r=t.get(e);return{kind:`file`,name:n,path:e,status:r.status,adds:r.adds,dels:r.dels,binary:r.binary}}),r=e=>{let t=e.dirs.map(r);return{...e,dirs:t,adds:e.files.reduce((e,t)=>e+t.adds,0)+t.reduce((e,t)=>e+t.adds,0),dels:e.files.reduce((e,t)=>e+t.dels,0)+t.reduce((e,t)=>e+t.dels,0),fileCount:e.files.length+t.reduce((e,t)=>e+t.fileCount,0)}};return r(n)}function L({bar:e,branch:t,stat:n,mode:r,wrap:i,preview:o,onModeChange:c,onWrapChange:l,onPreviewChange:m,onAction:h}){return(0,w.jsxs)(`div`,{"data-slot":`git-toolbar`,className:`flex flex-wrap items-center gap-x-2.5 gap-y-1.5 border-b border-border px-4 py-2 md:px-6`,children:[t?(0,w.jsx)(y,{branch:t}):null,n?(0,w.jsx)(B,{stat:n}):null,(0,w.jsxs)(`span`,{className:`ml-auto flex items-center gap-1`,children:[(0,w.jsx)(`span`,{className:`hidden items-center gap-1 md:flex`,children:(0,w.jsx)(v,{mode:r,wrap:i,preview:o,onModeChange:c,onWrapChange:l,onPreviewChange:m})}),e.secondary.map(e=>(0,w.jsx)(z,{action:e,variant:`outline`,onAction:h},e.id)),(0,w.jsx)(z,{action:e.primary,variant:`primary`,onAction:h}),e.menu.length>0?(0,w.jsxs)(f,{children:[(0,w.jsx)(s,{asChild:!0,children:(0,w.jsx)(a,{variant:`ghost`,size:`icon-sm`,"aria-label":`More git actions`,children:(0,w.jsx)(p,{"aria-hidden":`true`})})}),(0,w.jsx)(u,{align:`end`,"data-slot":`git-toolbar-menu`,children:e.menu.map(e=>(0,w.jsxs)(d,{disabled:!e.enabled,title:e.reason,onSelect:()=>h(e.id),children:[R[e.id],e.label]},e.id))})]}):null]})]})}var R={commit:(0,w.jsx)(g,{"aria-hidden":`true`}),push:(0,w.jsx)(x,{"aria-hidden":`true`}),"create-pr":(0,w.jsx)(_,{"aria-hidden":`true`}),"view-pr":(0,w.jsx)(m,{"aria-hidden":`true`}),"open-terminal":(0,w.jsx)(l,{"aria-hidden":`true`})};function z({action:e,variant:t,onAction:n}){return e.id===`view-pr`?r(e.href)?(0,w.jsx)(a,{asChild:!0,variant:t,size:`sm`,"data-action":e.id,children:(0,w.jsxs)(`a`,{href:e.href,target:`_blank`,rel:`noopener noreferrer`,children:[R[e.id],e.label]})}):(0,w.jsxs)(a,{variant:t,size:`sm`,"data-action":e.id,disabled:!0,title:`View PR unavailable — the recorded PR link is not an http(s) URL`,children:[R[e.id],e.label]}):(0,w.jsxs)(a,{variant:t,size:`sm`,"data-action":e.id,disabled:!e.enabled,title:e.enabled?void 0:e.reason,onClick:()=>n(e.id),children:[R[e.id],e.label]})}function B({stat:e}){return(0,w.jsx)(`span`,{"data-slot":`changes-stat`,children:(0,w.jsx)(b,{stat:{adds:V(e.adds),dels:V(e.dels),files:e.files}})})}function V(e){let[t,n]=(0,C.useState)(e),r=(0,C.useRef)(e);return(0,C.useEffect)(()=>{let t=r.current;if(t===e)return;if(typeof window.matchMedia==`function`&&window.matchMedia(`(prefers-reduced-motion: reduce)`).matches||typeof requestAnimationFrame!=`function`){r.current=e,n(e);return}let i=performance.now(),a=0,o=s=>{let c=Math.min(1,(s-i)/350),l=1-(1-c)**3;n(Math.round(t+(e-t)*l)),c<1?a=requestAnimationFrame(o):r.current=e};return a=requestAnimationFrame(o),()=>{cancelAnimationFrame(a),r.current=e,n(e)}},[e]),t}export{T as a,F as i,L as n,I as r,B as t};
@@ -1 +0,0 @@
1
- import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{Ar as r,F as i,Ft as a,Gi as o,Hi as s,I as c,Ji as l,Jt as u,Ki as d,M as f,N as p,P as m,R as h,Wr as g,Wt as ee,a as te,ea as _,er as v,fr as y,hr as b,m as x,mr as S,n as C,pr as w,r as T}from"./toaster-Hj_czp_o.js";import{i as E,r as D,t as O}from"./button-CjSjKnkd.js";import{u as ne}from"./use-automations-XKvBTPM-.js";import{R as re}from"./editable-title-CJSWyCcL.js";import{t as k}from"./arrow-left-BxBdc5DC.js";import{a as A,d as j,o as M,p as N,r as ie}from"./reference-chip-Bx_mG9QG.js";import{T as ae,a as oe,b as P,c as se,i as ce,l as F,o as le}from"./composer-DZx3cwQW.js";import{n as ue}from"./trash-2-EdjdGvEo.js";import{t as de}from"./check-DAAMuI4o.js";import{t as fe}from"./chevron-left-CvcqxpQZ.js";import{t as pe}from"./chevron-right-DKiL3NWw.js";import{n as I}from"./git-merge-B7oVXcKc.js";import{g as me}from"./dropdown-menu-DkEK7m00.js";import{t as L}from"./external-link-DPKRidDg.js";import{n as he,t as ge}from"./triangle-alert-DpH3QFz6.js";import{r as _e,t as ve}from"./centered-state-T0J7VmBb.js";import{t as ye}from"./message-square-BOO9s3qX.js";import{t as be}from"./refresh-cw-BaFyjVUz.js";import{_ as xe,c as R,d as Se,f as z,g as Ce,h as B,i as we,m as Te,n as Ee,o as De,p as V,s as H}from"./use-now-CrM50BFB.js";import{t as U}from"./tag-DLwUkUsN.js";import{t as W}from"./x-BkwTUDpG.js";import{r as G}from"./token-metrics-C149OWmd.js";import{t as Oe}from"./textarea-Bb0_Hz53.js";import{n as K,t as q}from"./use-submit-shortcut-BJ10ZshV.js";import{t as ke}from"./markdown-Bmfy_1Ll.js";import{O as Ae,_ as J,b as je,f as Me,g as Y,h as Ne,m as Pe,p as X,v as Fe,x as Ie,y as Z}from"./index-CiQrbvAq.js";import{t as Le}from"./lib-BQXq3kEf.js";import{a as Re,c as ze,i as Be,n as Ve,o as He,r as Ue,t as We}from"./agent-task-pickers-C3ydGatB.js";import{t as Ge}from"./diff-LG2cl0PE.js";import{t as Ke}from"./tab-link-BVItTl_Y.js";var Q=e(t(),1),$=n();function qe({className:e,...t}){return(0,$.jsx)(`div`,{"data-slot":`skeleton`,className:D(`animate-pulse rounded-md bg-accent`,e),...t})}function Je(e){let t=new Set;for(let n of e)for(let e of n.labels)t.add(e);return[...t].sort((e,t)=>e.toLowerCase().localeCompare(t.toLowerCase()))}function Ye(e,t={}){let n=(t.query??``).trim().toLowerCase(),r=t.labels??[],i=n.replace(/^#/,``),a=i!==``&&/^\d+$/.test(i);return e.filter(e=>r.length>0&&!r.every(t=>e.labels.includes(t))?!1:n===``?!0:a?String(e.number).includes(i):`#${e.number} ${e.title} ${e.author} ${e.body??``}`.toLowerCase().includes(n))}function Xe(e,t){let n=t===`oldest`?1:-1;return[...e].sort((e,t)=>e.createdAt===t.createdAt?(e.number-t.number)*n:e.createdAt<t.createdAt?-n:n)}function Ze(e,t){return e.trim()!==``&&t===0}function Qe(e){if(!e||!/^[0-9a-fA-F]{6}$/.test(e))return{borderColor:`var(--border)`,color:`var(--muted-foreground)`};let t=`#${e}`;return{backgroundColor:`${t}22`,borderColor:`${t}66`,color:`color-mix(in srgb, ${t} 50%, var(--foreground))`}}function $e({item:e,workflows:t,skills:n,workflow:r,onWorkflowChange:i,selectedSkills:a,onSkillsChange:s,engine:c,onEngineChange:u,queuedRunId:d,onQueued:f}){let p=l(),m=ee(),te=e.kind===`pr`?`PR`:`issue`,_=a.filter(e=>n.some(t=>t.name===e)),[y]=(0,Q.useState)(()=>He(e)),[b,S]=(0,Q.useState)(()=>J(e.url)||y),w=Y(c),E=(0,Q.useRef)(null);(0,Q.useEffect)(()=>{Z(e.url,b===y?``:b)},[e.url,b,y]);let D=h(),ne=(0,Q.useMemo)(()=>oe(se(m.data?.promptTemplates),D.data?.capabilities),[m.data?.promptTemplates,D.data?.capabilities]),k=e=>{let t=E.current,n=b===y?b.length:t?.selectionStart??b.length,r=le(b,n,e);S(r.text),requestAnimationFrame(()=>{E.current?.focus(),E.current?.setSelectionRange(r.caret,r.caret)})},A=ce(ne,_),j=(0,Q.useRef)(b);j.current=b;let M=(0,Q.useRef)(``);(0,Q.useEffect)(()=>{let e=F(j.current,M.current,A,y);M.current=e.applied,e.text!==j.current&&S(e.text)},[A,y]);let N=o({mutationFn:async()=>w.canRun?v(Be(e,r,_,b,Pe(w))):null,onSuccess:t=>{if(t===null)return;let n=`runs`in t?t.runs[0]:t;n&&f(e.url,n.id),C(`Added to the queue — ${te} #${e.number}`),_.length>0&&m.data!==void 0&&g({skillUsage:_.reduce((e,t)=>P(e,t),m.data.skillUsage)}).then(()=>p.invalidateQueries({queryKey:x.uiState})).catch(()=>{}),Z(e.url,``),S(y),M.current=``,p.invalidateQueries({queryKey:x.runs.all})},onError:e=>C(e.message,{tone:`danger`})}),ie=e=>{q({key:e.key,shiftKey:e.shiftKey,metaKey:e.metaKey,ctrlKey:e.ctrlKey,altKey:e.altKey,repeat:e.repeat,isComposing:e.nativeEvent.isComposing})&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),!N.isPending&&w.canRun&&N.mutate())},ae=e=>s(a.includes(e)?a.filter(t=>t!==e):[...a,e]);return(0,$.jsxs)(`section`,{"data-slot":`gh-hand`,className:`mt-7 rounded-lg border border-border bg-card p-4`,children:[(0,$.jsxs)(`h3`,{className:`flex items-center gap-1.5 text-[11px] font-semibold tracking-[.04em] text-soft-foreground uppercase`,children:[(0,$.jsx)(re,{"aria-hidden":`true`,className:`size-3.5 text-violet`}),`Hand this to the agent`]}),(0,$.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-2`,children:[(0,$.jsx)(Ve,{workflows:t,value:r,onChange:i}),(0,$.jsx)(We,{skills:n,skillUsage:m.data?.skillUsage,selected:_,onToggle:ae}),(0,$.jsx)(X,{pick:c,onChange:u,disabled:N.isPending||!w.canRun,accounts:!0}),(0,$.jsx)(Ue,{resolved:w,dataSlot:`gh-provider-gate`}),(0,$.jsx)(Me,{templates:ne,onInsert:k})]}),_.length>0?(0,$.jsx)(`div`,{"data-slot":`gh-skill-chips`,className:`mt-2.5 flex flex-wrap gap-1.5`,children:_.map(e=>(0,$.jsxs)(`button`,{type:`button`,"data-slot":`gh-skill-chip`,"data-skill":e,onClick:()=>ae(e),title:`Remove this skill`,className:`inline-flex items-center gap-1 rounded-full border border-border bg-muted px-2 py-px font-mono text-[11px] font-medium text-foreground transition-colors hover:bg-danger/10 hover:text-danger`,children:[e,(0,$.jsx)(W,{"aria-hidden":`true`,className:`size-3`})]},e))}):null,(0,$.jsx)(Oe,{ref:E,"data-slot":`gh-custom-prompt`,"aria-label":`Custom prompt`,"aria-keyshortcuts":`Control+Enter Meta+Enter`,value:b,onChange:e=>S(e.target.value),onKeyDown:ie,placeholder:`Instructions for the agent… (#${e.number} and its link are always sent)`,className:`mt-3 min-h-20 text-[13px]`}),(0,$.jsxs)(`div`,{className:`mt-4 flex flex-wrap items-center gap-2.5`,children:[(0,$.jsxs)(O,{variant:`contrast`,"data-action":`gh-run`,disabled:N.isPending||!w.canRun,onClick:()=>N.mutate(),children:[(0,$.jsx)(ue,{"aria-hidden":`true`,className:`size-3.5`}),`Run agent on this `,te]}),(0,$.jsx)(`kbd`,{"aria-hidden":`true`,className:`rounded-[5px] border border-b-2 border-border bg-card px-[5px] py-px font-mono text-[10.5px] font-medium text-muted-foreground`,children:K()}),d?(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`span`,{"data-slot":`gh-queued`,className:`flex items-center gap-1 text-xs font-medium text-success`,children:[(0,$.jsx)(de,{"aria-hidden":`true`,className:`size-3.5`}),`queued`]}),(0,$.jsx)(T,{to:`/tasks/${d}`,"data-slot":`gh-view-run`,className:`text-xs font-semibold text-violet hover:underline`,children:`View task →`})]}):null]})]})}var et=50,tt=100,nt=350;function rt(e,t){let[n,r]=(0,Q.useState)(e);return(0,Q.useEffect)(()=>{let n=setTimeout(()=>r(e),t);return()=>clearTimeout(n)},[e,t]),n}var it=600;function at(e,t){let[n,r]=(0,Q.useState)(null),i=(0,Q.useRef)(t);return(0,Q.useEffect)(()=>{i.current=t}),(0,Q.useEffect)(()=>{if(!e||!n||typeof IntersectionObserver>`u`)return;let t=new IntersectionObserver(e=>{e.some(e=>e.isIntersecting)&&i.current()},{root:n.closest(`[data-slot="gh-list"]`),rootMargin:`0px 0px ${it}px 0px`});return t.observe(n),()=>t.disconnect()},[e,n]),r}function ot({view:e,changes:t=!1,index:n=!1}){let{n:r}=s(),i=m(et),d=h().data?.capabilities?.automations===!0,p=(0,Q.useMemo)(()=>{let e=i.data?.pages;if(!e||e.length===0)return;let t=e[0],n=e[e.length-1];if(!(!t||!n))return{...t,available:t.available??!1,issues:e.flatMap(e=>e.issues??[]),prs:e.flatMap(e=>e.prs??[]),labelColors:Object.assign({},...e.map(e=>e.labelColors??{})),issuesNextCursor:n.issuesNextCursor,prsNextCursor:n.prsNextCursor}},[i.data]),v=ee(),b=v.data?.githubSort===`oldest`?`oldest`:`newest`,S=(0,Q.useMemo)(()=>p?.available?Xe(p.prs,b):[],[p,b]),E=r===void 0?null:Number.parseInt(r,10),re=(0,Q.useMemo)(()=>{if(!p?.available)return[];let t=new Set;e===`prs`&&E!==null&&Number.isInteger(E)&&t.add(E);for(let e of S){if(t.size>=tt)break;t.add(e.number)}return[...t]},[p,S,e,E]),k=f(re,e===`prs`),A=k.data?.available?k.data.checks:void 0,j=l(),M=e=>{j.setQueryData(x.uiState,t=>({...t,githubView:e})),g({githubView:e}).then(e=>j.setQueryData(x.uiState,e)).catch(e=>{C(e instanceof Error?e.message:String(e),{tone:`danger`}),j.invalidateQueries({queryKey:x.uiState})})},ie=e=>{j.setQueryData(x.uiState,t=>({...t,githubSort:e})),g({githubSort:e}).then(e=>j.setQueryData(x.uiState,e)).catch(e=>{C(e instanceof Error?e.message:String(e),{tone:`danger`}),j.invalidateQueries({queryKey:x.uiState})})},oe=(0,Q.useRef)(null),P=o({mutationFn:()=>y({refresh:!0,limit:et}),onSuccess:()=>{j.invalidateQueries({queryKey:x.githubPages(et)}),j.invalidateQueries({queryKey:x.githubChecks(re)});let e=oe.current;if(!e){j.removeQueries({queryKey:[`github`,`comments`]});return}let t=x.githubComments(e.kind,e.number);w(e.kind,e.number,{refresh:!0}).then(e=>j.setQueryData(t,e)).catch(()=>{}),j.removeQueries({queryKey:[`github`,`comments`],predicate:e=>e.queryHash!==_(t)})},onError:e=>C(e.message,{tone:`danger`})}),se=u(),ce=a(),[F,le]=(0,Q.useState)(()=>Fe().workflow),[ue,de]=(0,Q.useState)(()=>Fe().skills),[fe,pe]=Ne();(0,Q.useEffect)(()=>{je({workflow:F,skills:[...ue]})},[F,ue]);let I=se.data?.workflows;(0,Q.useEffect)(()=>{I&&F!==null&&!I.some(e=>e.name===F)&&le(null)},[I,F]);let me=ce.data,L=v.data?.skillUsage,ye=(0,Q.useMemo)(()=>ae(me??[],L),[me,L]),[R,Se]=(0,Q.useState)(new Map),[z,Ce]=(0,Q.useState)(``),[B,we]=(0,Q.useState)([]),Te=z.trim()!==``||B.length>0,Ee=(0,Q.useRef)(null),De=at(i.hasNextPage&&!i.isFetchingNextPage&&!i.isFetchNextPageError&&!Te,()=>void i.fetchNextPage()),V=rt(z,nt),H=(0,Q.useMemo)(()=>p?.available?e===`issues`?Xe(p.issues,b):S:[],[p,e,b,S]),U=Ze(V,(0,Q.useMemo)(()=>Ye(H,{query:V,labels:B}).length,[H,V,B])),W=c(e===`issues`?`issue`:`pr`,V,U);if(n&&v.data?.githubView===`prs`)return(0,$.jsx)(te,{to:`/github/prs`,replace:!0});if(!p)return i.isError?(0,$.jsx)(`div`,{"data-route":`github`,className:`flex min-h-full flex-col`,children:(0,$.jsx)(ve,{icon:(0,$.jsx)(ge,{}),tone:`danger`,title:`Could not load GitHub`,subtitle:i.error.message})}):(0,$.jsx)(Ie,{});if(oe.current=null,!p.available)return(0,$.jsx)(`div`,{"data-route":`github`,className:`flex min-h-full flex-col`,children:(0,$.jsx)(ve,{icon:(0,$.jsx)(Ae,{}),tone:`neutral`,title:`GitHub is unavailable here`,subtitle:p.reason??`unknown reason`,actions:(0,$.jsx)(O,{variant:`outline`,"data-action":`gh-retry`,disabled:P.isPending,onClick:()=>P.mutate(),children:`Try again`}),children:(0,$.jsxs)(`p`,{className:`text-xs leading-relaxed text-soft-foreground`,children:[`The tab needs the `,(0,$.jsx)(`span`,{className:`font-mono`,children:`gh`}),` CLI, logged in (`,(0,$.jsx)(`span`,{className:`font-mono`,children:`gh auth login`}),`), and a repo with a GitHub remote. Everything else in the cockpit works without it.`]})})});let Oe=H,K=Ye(Oe,{query:z,labels:B}),q=U&&W.data?.available?W.data:null,ke=new Set(K.map(e=>e.number)),J=q?Xe(Ye(q.items,{labels:B}).filter(e=>!ke.has(e.number)),b):[],Me=z.trim()!==``&&z.trim()!==V.trim()||U&&W.isPending,Y={...q?.labelColors??{},...p.labelColors??{}},Pe=Je(Oe),X=r===void 0?null:Number.parseInt(r,10),Z=X===null?K[0]??J[0]??null:Oe.find(e=>e.number===X)??J.find(e=>e.number===X)??null;oe.current=Z?{kind:Z.kind,number:Z.number}:null;let Re=e===`issues`?`/github`:`/github/prs`,Be=U&&(W.data?.available===!1||W.isError),Ve=W.data?.available===!1?W.data.reason??`unknown reason`:W.error instanceof Error?W.error.message:`the search request failed`,He=Te?Me?(0,$.jsxs)(`p`,{className:`flex items-center gap-1.5`,children:[(0,$.jsx)(_e,{"aria-hidden":`true`,className:`size-3.5 motion-safe:animate-spin`}),`Searching GitHub for “`,z.trim(),`”…`]}):J.length>0?null:Be?(0,$.jsxs)(`p`,{children:[`No open `,e===`issues`?`issues`:`pull requests`,` match your filter, and GitHub could not be searched: `,Ve,`.`]}):q?(0,$.jsxs)(`p`,{children:[`No `,e===`issues`?`issues`:`pull requests`,` match your filter — open, closed or merged.`]}):(0,$.jsxs)(`p`,{children:[`No open `,e===`issues`?`issues`:`pull requests`,` match your filter.`]}):(0,$.jsxs)(`p`,{children:[`No open `,e===`issues`?`issues`:`pull requests`,`.`]});return(0,$.jsx)(ze,{name:`gh`,route:`github`,selected:r!==void 0,list:(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`header`,{"data-slot":`gh-header`,className:`sticky top-0 z-10 border-b border-border bg-background/95 px-4 pt-3 backdrop-blur`,children:[(0,$.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2.5`,children:[(0,$.jsx)(`h1`,{className:`text-lg font-semibold`,children:`GitHub`}),p.repo?(0,$.jsx)(`span`,{"data-slot":`gh-repo`,className:`min-w-0 truncate font-mono text-[11px] text-soft-foreground`,children:p.repo}):null,d?(0,$.jsx)(T,{to:`/automations/new`,className:`ml-auto shrink-0 text-[10px] font-medium text-primary hover:underline`,children:`Set up automations`}):null,(0,$.jsxs)(`button`,{type:`button`,"data-slot":`gh-refresh`,title:`Refresh from GitHub`,disabled:P.isPending,onClick:()=>P.mutate(),className:D(`flex shrink-0 items-center gap-1 rounded-full border border-border px-1.5 py-px text-[10px] font-medium text-soft-foreground transition-colors hover:bg-muted hover:text-foreground disabled:opacity-55`,!d&&`ml-auto`),children:[(0,$.jsx)(be,{"aria-hidden":`true`,className:D(`size-[9px]`,P.isPending&&`motion-safe:animate-spin`)}),p.syncedAt?`synced ${G(p.syncedAt)} ago`:`refresh`]})]}),(0,$.jsxs)(`div`,{"data-slot":`gh-tabs`,className:`mt-2.5 flex items-end gap-1`,children:[(0,$.jsxs)(Ke,{to:`/github`,active:e===`issues`,onClick:()=>M(`issues`),children:[`Issues · `,st(p.issuesTotal??p.issues.length)]}),(0,$.jsxs)(Ke,{to:`/github/prs`,active:e===`prs`,onClick:()=>M(`prs`),children:[`Pull requests · `,st(p.prsTotal??p.prs.length)]})]}),(0,$.jsxs)(`div`,{className:`mt-2.5 flex flex-wrap items-center gap-2 pb-3`,children:[(0,$.jsxs)(`div`,{className:`relative min-w-[11rem] flex-1`,children:[(0,$.jsx)(xe,{"aria-hidden":`true`,className:`pointer-events-none absolute top-1/2 left-2 size-3.5 -translate-y-1/2 text-soft-foreground`}),(0,$.jsx)(`input`,{type:`search`,"data-slot":`gh-search`,"aria-label":`Search ${e}`,placeholder:`Search #id, title, author…`,value:z,onChange:e=>Ce(e.target.value),className:`w-full rounded-md border border-input bg-card py-1 pr-2 pl-7 text-[13px] outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50`})]}),(0,$.jsx)(lt,{options:Pe,colors:Y,selected:B,onChange:we}),(0,$.jsx)(ne,{slot:`gh-sort`,label:`Sort order`,value:b,options:[{value:`newest`,label:`Newest`},{value:`oldest`,label:`Oldest`}],onChange:ie,className:`shrink-0`})]})]}),K.length===0?He&&(0,$.jsx)(`div`,{"data-slot":`gh-empty`,className:`px-4 py-4 text-sm text-soft-foreground`,children:He}):(0,$.jsx)(`div`,{ref:e=>{Ee.current=e?.closest(`[data-slot="gh-list"]`)??null},"data-slot":`gh-rows`,"data-virtualized":`true`,className:`px-2 py-2`,children:(0,$.jsx)(Le,{scrollRef:Ee,children:K.map(t=>(0,$.jsx)(`div`,{className:`pb-0.5`,children:(0,$.jsx)(ct,{item:t,view:e,colors:Y,active:Z?.url===t.url,queued:R.has(t.url),checks:t.kind===`pr`?A?.[t.number]??t.checks:t.checks})},t.url))})}),i.hasNextPage&&!Te&&K.length>0?(0,$.jsx)(`div`,{ref:De,"data-slot":`gh-load-more`,className:`flex min-h-6 items-center justify-center gap-1.5 px-4 pb-3 text-xs text-soft-foreground`,children:i.isFetchingNextPage?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(_e,{"aria-hidden":`true`,className:`size-3.5 motion-safe:animate-spin`}),`Loading more…`]}):i.isFetchNextPageError?(0,$.jsxs)($.Fragment,{children:[`Could not load more.`,(0,$.jsx)(`button`,{type:`button`,"data-slot":`gh-load-more-retry`,onClick:()=>void i.fetchNextPage(),className:`font-medium text-primary hover:underline`,children:`Retry`})]}):null}):null,J.length>0?(0,$.jsxs)(`div`,{"data-slot":`gh-search-hits`,children:[(0,$.jsxs)(`p`,{className:`px-4 pt-2 pb-1 text-[11px] font-medium tracking-wide text-soft-foreground uppercase`,children:[`Found on GitHub`,q?.truncated?` (first matches)`:``]}),(0,$.jsx)(`ul`,{className:`flex flex-col gap-0.5 px-2 pb-2`,children:J.map(t=>(0,$.jsx)(ct,{item:t,view:e,colors:Y,active:Z?.url===t.url,queued:R.has(t.url),checks:t.kind===`pr`?A?.[t.number]??t.checks:t.checks},t.url))})]}):null]}),detail:(0,$.jsx)($.Fragment,{children:Z?(0,$.jsx)(dt,{item:Z,listPath:Re,colors:Y,changes:t,checks:Z.kind===`pr`?A?.[Z.number]??Z.checks:Z.checks,children:(0,$.jsx)($e,{item:Z,workflows:se.data?.workflows??[],skills:ye,workflow:F,onWorkflowChange:le,selectedSkills:ue,onSkillsChange:de,engine:fe,onEngineChange:pe,queuedRunId:R.get(Z.url)??null,onQueued:(e,t)=>Se(n=>new Map(n).set(e,t))},Z.url)}):(0,$.jsx)(ve,{icon:e===`issues`?(0,$.jsx)(N,{}):(0,$.jsx)(he,{}),tone:`neutral`,heading:`h2`,title:X===null?`Nothing selected`:`Not found`,subtitle:X===null?`No open ${e===`issues`?`issues`:`pull requests`} to show.`:`#${X} is not among the open ${e===`issues`?`issues`:`pull requests`}. Search for ${X} above to look it up on GitHub, closed and merged included.`})})})}function st(e){return String(e)}function ct({item:e,view:t,colors:n,active:r,queued:i,checks:a}){let o=e.kind===`issue`?N:he,s=l(),c=()=>{s.prefetchQuery({queryKey:x.githubComments(e.kind,e.number),queryFn:({signal:t})=>w(e.kind,e.number,{},{signal:t}),staleTime:6e4})};return(0,$.jsx)(`li`,{children:(0,$.jsxs)(T,{to:`${t===`issues`?`/github/issues`:`/github/prs`}/${e.number}`,draggable:!0,onDragStart:t=>{try{t.dataTransfer.setData(`text/plain`,Re(e)),t.dataTransfer.effectAllowed=`copy`}catch{}},onMouseEnter:c,onFocus:c,"data-slot":`gh-row`,"data-number":e.number,"aria-current":r?`page`:void 0,title:`Drag into the composer to prefill a task`,className:D(`flex flex-col gap-1 rounded-md px-2.5 py-2 transition-colors hover:bg-muted`,r&&`bg-muted`),children:[(0,$.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,$.jsx)(o,{"aria-hidden":`true`,className:D(`size-3.5 shrink-0`,e.kind===`issue`?`text-success`:`text-violet`)}),(0,$.jsx)(`span`,{className:D(`min-w-0 truncate text-[13px] font-medium`,r&&`font-semibold`),children:e.title})]}),(0,$.jsxs)(`span`,{className:`flex items-center gap-2 pl-[22px] font-mono text-[10.5px] text-muted-foreground`,children:[(0,$.jsxs)(`span`,{children:[`#`,e.number]}),(0,$.jsx)(`span`,{className:`min-w-0 truncate`,children:e.author}),(0,$.jsx)(`span`,{children:G(e.createdAt)}),(0,$.jsx)(kt,{count:e.comments}),a?(0,$.jsx)(jt,{checks:a}):null,i?(0,$.jsx)(`span`,{"data-slot":`gh-queued-flag`,className:`font-sans font-medium text-violet`,children:`↗ run queued`}):null]}),e.labels.length>0?(0,$.jsx)(`span`,{className:`flex flex-wrap gap-1 pl-[22px]`,children:e.labels.map(e=>(0,$.jsx)(ut,{label:e,color:n[e]},e))}):null]})})}function lt({options:e,colors:t,selected:n,onChange:r}){let[i,a]=(0,Q.useState)(!1),o=e=>r(n.includes(e)?n.filter(t=>t!==e):[...n,e]);return(0,$.jsxs)(ie,{open:i,onOpenChange:a,children:[(0,$.jsx)(M,{asChild:!0,children:(0,$.jsxs)(`button`,{type:`button`,"data-slot":`gh-label-filter`,disabled:e.length===0,className:D(`flex shrink-0 items-center gap-1 rounded-md border border-input bg-card px-2 py-1 text-[12px] font-medium text-muted-foreground transition-colors hover:text-foreground disabled:opacity-50`,n.length>0&&`border-primary/60 text-foreground`),children:[(0,$.jsx)(U,{"aria-hidden":`true`,className:`size-3.5`}),n.length>0?`Labels · ${n.length}`:`Labels`]})}),(0,$.jsx)(A,{align:`end`,sideOffset:6,className:`w-60 p-0`,children:(0,$.jsxs)(Ee,{children:[(0,$.jsx)(De,{placeholder:`Filter labels…`}),(0,$.jsxs)(R,{className:`max-h-[min(16rem,calc(var(--radix-popover-content-available-height)-3rem))]`,children:[(0,$.jsx)(we,{children:`No labels.`}),n.length>0?(0,$.jsxs)(H,{value:`__clear__`,onSelect:()=>r([]),className:`text-soft-foreground`,children:[`Clear `,n.length,` filter`,n.length>1?`s`:``]}):null,e.map(e=>{let r=n.includes(e);return(0,$.jsxs)(H,{value:e,onSelect:()=>o(e),children:[(0,$.jsx)(`span`,{"aria-hidden":`true`,className:`size-2.5 shrink-0 rounded-full border`,style:Qe(t[e])}),(0,$.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e}),r?(0,$.jsx)(de,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-primary`}):null]},e)})]})]})})]})}function ut({label:e,color:t}){return(0,$.jsx)(`span`,{"data-slot":`gh-label`,"data-label":e,style:Qe(t),className:`rounded-full border px-1.5 py-px text-[10px] font-medium`,children:e})}function dt({item:e,listPath:t,colors:n,children:r,changes:i,checks:a}){let o=e.kind===`pr`?`pull request`:`issue`,s=p(e.kind,e.number),c=s.data?.detail?.body??e.body,l=s.data?.detail?.additions??e.additions,u=s.data?.detail?.deletions??e.deletions,d=e.kind===`pr`&&!!(l||u);return(0,$.jsxs)(`article`,{"data-slot":`gh-detail-inner`,className:`min-w-0 px-4 py-4 md:px-7 md:py-5`,children:[(0,$.jsxs)(T,{to:t,"data-slot":`gh-back`,className:`mb-3 inline-flex items-center gap-1.5 text-xs font-medium text-muted-foreground hover:text-foreground md:hidden`,children:[(0,$.jsx)(k,{"aria-hidden":`true`,className:`size-3.5`}),`Back to the list`]}),(0,$.jsxs)(`p`,{"data-slot":`gh-meta`,className:`flex flex-wrap items-center gap-x-1.5 font-mono text-[10.5px] text-soft-foreground`,children:[(0,$.jsxs)(`span`,{children:[`#`,e.number]}),`·`,(0,$.jsx)(`span`,{children:o}),`·`,(0,$.jsxs)(`span`,{children:[`opened by `,e.author]}),`·`,(0,$.jsxs)(`span`,{children:[G(e.createdAt),` ago`]}),e.comments?(0,$.jsxs)($.Fragment,{children:[`·`,(0,$.jsx)(kt,{count:e.comments})]}):null,d?(0,$.jsxs)($.Fragment,{children:[`·`,(0,$.jsxs)(`span`,{"data-slot":`gh-diffstat`,children:[(0,$.jsxs)(`span`,{className:`text-success`,children:[`+`,l??0]}),` `,(0,$.jsxs)(`span`,{className:`text-danger`,children:[`−`,u??0]})]})]}):null,`·`,E(e.url)?(0,$.jsxs)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,"data-slot":`gh-open-link`,className:`inline-flex items-center gap-0.5 text-muted-foreground hover:text-foreground hover:underline`,children:[`open on GitHub`,(0,$.jsx)(L,{"aria-hidden":`true`,className:`size-2.5`})]}):(0,$.jsx)(`span`,{"data-slot":`gh-open-link`,className:`text-muted-foreground`,children:`open on GitHub`})]}),(0,$.jsx)(`h2`,{className:`mt-2 text-xl leading-snug font-semibold`,children:e.title}),e.kind===`pr`?(0,$.jsxs)(`nav`,{"aria-label":`Pull request detail`,className:`mt-4 flex border-b border-border`,children:[(0,$.jsx)(Ke,{to:`/github/prs/${e.number}`,active:!i,children:`Conversation`}),(0,$.jsx)(Ke,{to:`/github/prs/${e.number}/changes`,active:i,children:`Changes`})]}):null,e.labels.length>0||a?(0,$.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-1.5`,children:[e.labels.map(e=>(0,$.jsx)(ut,{label:e,color:n[e]},e)),a?(0,$.jsx)(At,{checks:a,url:e.url}):null]}):null,i&&e.kind===`pr`?(0,$.jsx)(ht,{item:e}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`div`,{"data-slot":`gh-body`,className:`mt-5 text-sm`,children:c?(0,$.jsx)(ke,{children:c}):(0,$.jsx)(`p`,{className:`text-soft-foreground`,children:`(no description)`})}),(0,$.jsx)(gt,{item:e,colors:n}),e.kind===`pr`?(0,$.jsx)(mt,{number:e.number}):null,r]})]})}var ft={squash:`Squash and merge`,merge:`Create a merge commit`,rebase:`Rebase and merge`};function pt({state:e}){let t=`size-4 shrink-0`;return e===`passing`?(0,$.jsx)(I,{"aria-hidden":`true`,"data-slot":`gh-merge-status-passing`,className:D(t,`text-success`)}):e===`failing`?(0,$.jsx)(j,{"aria-hidden":`true`,"data-slot":`gh-merge-status-failing`,className:D(t,`text-danger`)}):e===`pending`?(0,$.jsx)(_e,{"aria-hidden":`true`,"data-slot":`gh-merge-status-pending`,className:D(t,`animate-spin text-warning`)}):(0,$.jsx)(me,{"aria-hidden":`true`,"data-slot":`gh-merge-status-unknown`,className:D(t,`text-soft-foreground`)})}function mt({number:e}){let t=l(),n=d({queryKey:x.githubMergeState(e),queryFn:({signal:t})=>b(e,{},{signal:t}),retry:!1}),i=n.data?.available?n.data.mergeState:null,[a,s]=(0,Q.useState)(null),[c,u]=(0,Q.useState)(!1),[f,p]=(0,Q.useState)(!1),m=o({mutationFn:()=>b(e,{refresh:!0}),onSuccess:n=>t.setQueryData(x.githubMergeState(e),n),onError:e=>C(e instanceof Error?e.message:String(e),{tone:`danger`})}),h=a&&i?.methods.includes(a)?a:i?.defaultMethod??i?.methods[0]??null,g=o({mutationFn:()=>{if(!i||!h)throw Error(`No merge method is available.`);return r(e,{method:h,expectedHeadSha:i.headSha,...f&&i.canOverride?{overrideRules:!0}:{}})},onSuccess:()=>{u(!1),C(`Pull request #${e} merged`),t.invalidateQueries({queryKey:x.githubMergeState(e)}),t.invalidateQueries({queryKey:x.githubPages(et)}),t.invalidateQueries({queryKey:x.githubComments(`pr`,e)})},onError:n=>{C(n instanceof Error?n.message:String(n),{tone:`danger`}),t.invalidateQueries({queryKey:x.githubMergeState(e)})}});if(n.isPending)return(0,$.jsx)(qe,{"data-slot":`gh-merge-loading`,className:`mt-6 h-32 w-full`});if(!i)return(0,$.jsxs)(`section`,{"data-slot":`gh-merge-unavailable`,className:`mt-6 rounded-lg border border-border bg-card p-4 text-sm`,children:[(0,$.jsx)(`p`,{className:`font-medium`,children:`Merge status unavailable`}),(0,$.jsx)(`p`,{className:`mt-1 text-xs text-soft-foreground`,children:n.data?.available===!1?n.data.reason:`GitHub could not load merge requirements.`})]});let ee=i.state===`merged`?`Merged`:i.state===`closed`?`Closed`:i.isDraft?`Draft`:i.mergeable===`conflicting`?`Conflicts must be resolved`:i.canMerge?`Ready to merge`:`Merge blocked`,te=i.reviewDecision===`approved`?`passing`:i.reviewDecision===`unknown`?`unknown`:`failing`,_=i.mergeable===`mergeable`?`passing`:i.mergeable===`conflicting`?`failing`:`unknown`,v=!!(h&&(i.canMerge||i.canOverride&&f));return(0,$.jsxs)(`section`,{"data-slot":`gh-merge-box`,"aria-live":`polite`,className:`mt-6 rounded-lg border border-border bg-card p-4`,children:[(0,$.jsxs)(`div`,{className:`flex items-start gap-3`,children:[i.canMerge?(0,$.jsx)(de,{"aria-hidden":`true`,className:`mt-0.5 size-5 shrink-0 text-success`}):(0,$.jsx)(ge,{"aria-hidden":`true`,className:`mt-0.5 size-5 shrink-0 text-warning`}),(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,$.jsx)(`h3`,{className:`font-semibold`,children:ee}),(0,$.jsxs)(O,{type:`button`,variant:`ghost`,size:`sm`,disabled:m.isPending,onClick:()=>m.mutate(),children:[(0,$.jsx)(be,{"aria-hidden":`true`,className:D(`size-3.5`,m.isPending&&`animate-spin`)}),`Refresh`]})]}),(0,$.jsxs)(`p`,{className:`mt-1 font-mono text-[11px] text-soft-foreground`,children:[i.headRef,` (`,i.headSha.slice(0,7),`) → `,i.baseRef]}),(0,$.jsxs)(`ul`,{className:`mt-3 space-y-2 text-xs`,children:[(0,$.jsxs)(`li`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(pt,{state:te}),(0,$.jsxs)(`span`,{children:[`Reviews: `,i.reviewDecision.replaceAll(`-`,` `)]})]}),(0,$.jsxs)(`li`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(pt,{state:_}),(0,$.jsxs)(`span`,{children:[`Conflicts: `,i.mergeable===`conflicting`?`present`:i.mergeable===`mergeable`?`none`:`unknown`]})]}),i.checks.length===0&&i.checksTier!==`none`?(0,$.jsx)(`li`,{children:`No checks configured`}):i.checks.map(e=>(0,$.jsxs)(`li`,{className:`flex items-center justify-between gap-3`,children:[(0,$.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,$.jsx)(pt,{state:e.state}),(0,$.jsxs)(`span`,{children:[e.name,` · `,e.state,e.required===!0?` · required`:e.required===null?` · requiredness unknown`:``]})]}),e.url&&E(e.url)?(0,$.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,className:`text-muted-foreground underline`,children:`details`}):null]},e.name)),i.checksTier===`aggregate`||i.checksTier===`none`?(0,$.jsxs)(`li`,{"data-slot":`gh-merge-checks-degraded`,className:`flex items-start gap-2`,children:[(0,$.jsx)(pt,{state:`unknown`}),(0,$.jsxs)(`span`,{className:`min-w-0`,children:[i.checksTier===`aggregate`?`Only the rolled-up check state is readable here — per-check detail is not.`:`This token cannot read the checks on this pull request.`,i.checksReason?(0,$.jsx)(`span`,{className:`mt-0.5 block break-words text-soft-foreground`,children:i.checksReason}):null]})]}):null,i.blockers.filter(e=>!(e.code===`checks-unknown`&&i.checksTier===`none`)).map(e=>(0,$.jsx)(`li`,{className:`text-soft-foreground`,children:e.message},e.code))]}),i.canOverride?(0,$.jsxs)(`label`,{className:`mt-4 flex cursor-pointer items-start gap-2 rounded-md border border-warning/40 bg-warning/5 p-3 text-xs`,children:[(0,$.jsx)(`input`,{type:`checkbox`,checked:f,onChange:e=>p(e.target.checked),className:`mt-0.5 size-4 accent-primary`}),(0,$.jsxs)(`span`,{children:[(0,$.jsx)(`span`,{className:`block font-medium`,children:`Merge without waiting for requirements`}),(0,$.jsx)(`span`,{className:`mt-0.5 block text-soft-foreground`,children:`GitHub will allow this only if your permissions can bypass the repository rules.`})]})]}):null,i.state===`open`&&i.methods.length>0?(0,$.jsxs)(`div`,{className:`mt-4 flex flex-col gap-2 sm:flex-row`,children:[(0,$.jsx)(`select`,{"aria-label":`Merge method`,value:h??``,onChange:e=>s(e.target.value),className:`h-9 min-w-0 flex-1 rounded-md border border-input bg-background px-3 text-sm outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50`,children:i.methods.map(e=>(0,$.jsx)(`option`,{value:e,children:ft[e]},e))}),(0,$.jsx)(O,{disabled:!v,onClick:()=>u(!0),children:h?ft[h]:`Merge`})]}):null]})]}),(0,$.jsx)(Se,{open:c,onOpenChange:u,children:(0,$.jsxs)(z,{"data-slot":`gh-merge-confirm`,showCloseButton:!1,children:[(0,$.jsxs)(B,{children:[(0,$.jsxs)(Ce,{children:[h?ft[h]:`Merge`,` pull request #`,e,`?`]}),(0,$.jsxs)(V,{children:[`This will merge “`,i.title,`” into `,i.baseRef,`. GitHub will re-check the exact reviewed head before changing the repository.`,f&&i.canOverride?` You are asking GitHub to bypass unmet repository requirements; GitHub may refuse if your permissions do not allow it.`:``]})]}),g.error?(0,$.jsx)(`p`,{className:`text-sm text-danger`,children:g.error.message}):null,(0,$.jsxs)(Te,{children:[(0,$.jsx)(O,{variant:`outline`,disabled:g.isPending,onClick:()=>u(!1),children:`Cancel`}),(0,$.jsx)(O,{disabled:g.isPending,onClick:()=>g.mutate(),children:g.isPending?`Merging…`:h?ft[h]:`Merge`})]})]})})]})}function ht({item:e}){let t=l(),n=i(e.number),[r,a]=(0,Q.useState)(``),[o,s]=(0,Q.useState)(null),c=n.data,u=c?.available?c.files.filter(e=>e.path.toLowerCase().includes(r.toLowerCase())):[],d=u.findIndex(e=>e.path===o);(0,Q.useEffect)(()=>{u.length>0&&!u.some(e=>e.path===o)&&s(u[0].path)},[c?.available?c.headSha:``,r]);let f=async()=>{let n=c?.available?c.headSha:null,r=await S(e.number,{refresh:!0});t.setQueryData([`github`,`pr-changes`,e.number],r),r.available&&n&&n!==r.headSha&&(s(r.files[0]?.path??null),C(`The reviewed revision changed.`))};if(n.isPending)return(0,$.jsx)(`p`,{"aria-live":`polite`,className:`mt-6 text-sm text-muted-foreground`,children:`Loading changed files…`});if(n.isError||!c)return(0,$.jsx)(`p`,{className:`mt-6 text-sm text-danger`,children:`Changed files could not be loaded.`});if(!c.available)return(0,$.jsx)(`p`,{className:`mt-6 text-sm text-muted-foreground`,children:c.reason});let p=u.map(e=>({path:e.path,...e.previousPath?{oldPath:e.previousPath}:{},status:e.status===`removed`?`deleted`:e.status===`changed`?`modified`:e.status,adds:e.additions,dels:e.deletions,binary:e.patchUnavailableReason===`binary`,patch:e.patch??``})),m=E(e.url)?`${e.url}/files`:null,h=u.find(e=>e.path===o);return(0,$.jsxs)(`section`,{"data-slot":`gh-pr-changes`,className:`mt-5 min-w-0`,children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-xs`,children:[(0,$.jsxs)(`strong`,{children:[c.files.length,` changed files`]}),(0,$.jsxs)(`span`,{className:`text-success`,children:[`+`,c.additions]}),(0,$.jsxs)(`span`,{className:`text-danger`,children:[`−`,c.deletions]}),(0,$.jsxs)(`span`,{className:`font-mono text-muted-foreground`,title:c.headSha,children:[`head `,c.headSha.slice(0,8)]}),(0,$.jsx)(O,{type:`button`,variant:`outline`,size:`sm`,className:`ml-auto min-h-11`,onClick:()=>void f(),children:`Refresh`})]}),c.truncated?(0,$.jsxs)(`p`,{role:`status`,className:`mt-3 rounded-md border border-warning/40 bg-warning/10 p-3 text-xs`,children:[c.reason??`This response is incomplete.`,` `,m?(0,$.jsx)(`a`,{href:m,target:`_blank`,rel:`noopener noreferrer`,className:`underline`,children:`Open all files on GitHub`}):null]}):null,(0,$.jsxs)(`div`,{className:`mt-4 grid min-w-0 gap-4 lg:grid-cols-[240px_minmax(0,1fr)]`,children:[(0,$.jsxs)(`aside`,{className:`min-w-0`,children:[(0,$.jsx)(`input`,{"aria-label":`Filter changed files`,value:r,onChange:e=>a(e.target.value),placeholder:`Filter files…`,className:`min-h-11 w-full rounded-md border border-input bg-background px-3 text-sm`}),(0,$.jsx)(`select`,{"aria-label":`Select changed file`,value:o??``,onChange:e=>s(e.target.value),className:`mt-2 min-h-11 w-full rounded-md border border-input bg-background px-2 text-sm outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 lg:hidden`,children:u.map(e=>(0,$.jsx)(`option`,{children:e.path},e.path))}),(0,$.jsx)(`ul`,{className:`mt-2 hidden max-h-[60vh] overflow-auto lg:block`,children:u.map(e=>(0,$.jsx)(`li`,{children:(0,$.jsxs)(`button`,{type:`button`,onClick:()=>s(e.path),className:D(`min-h-11 w-full truncate rounded px-2 text-left text-xs`,o===e.path&&`bg-muted font-medium`),title:e.path,children:[e.status,` · `,e.path,` `,(0,$.jsxs)(`span`,{className:`text-success`,children:[`+`,e.additions]}),` `,(0,$.jsxs)(`span`,{className:`text-danger`,children:[`−`,e.deletions]})]})},e.path))})]}),(0,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsxs)(`div`,{className:`mb-2 flex justify-end gap-1`,children:[(0,$.jsx)(O,{"aria-label":`Previous file`,variant:`outline`,size:`icon`,className:`min-h-11 min-w-11`,disabled:d<=0,onClick:()=>s(u[d-1]?.path??null),children:(0,$.jsx)(fe,{})}),(0,$.jsx)(O,{"aria-label":`Next file`,variant:`outline`,size:`icon`,className:`min-h-11 min-w-11`,disabled:d<0||d>=u.length-1,onClick:()=>s(u[d+1]?.path??null),children:(0,$.jsx)(pe,{})})]}),u.length===0?(0,$.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`No changed files match this filter.`}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(Ge,{files:p.filter(e=>e.path===o),wrap:!0,className:`min-w-0`}),h&&!h.patch?(0,$.jsxs)(`p`,{className:`rounded-b border border-border p-3 text-xs text-muted-foreground`,children:[`Patch unavailable: `,h.patchUnavailableReason??`not-provided`,`.`]}):null]})]})]})]})}function gt({item:e,colors:t}){let n=p(e.kind,e.number),r=n.data,i=(0,Q.useMemo)(()=>{let e=[...(r?.comments??[]).map(e=>({row:`comment`,comment:e})),...(r?.events??[]).map(e=>({row:`event`,event:e}))],t=e=>{let t=Date.parse(_t(e));return Number.isNaN(t)?-1/0:t};return e.sort((e,n)=>t(e)-t(n))},[r?.comments,r?.events]);return n.isPending?(0,$.jsxs)(`section`,{"data-slot":`gh-thread-loading`,className:`mt-6 border-t border-border pt-5`,children:[(0,$.jsx)(qe,{className:`mb-3 h-3 w-24`}),(0,$.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,$.jsx)(qe,{className:`h-14 w-full`}),(0,$.jsx)(qe,{className:`h-14 w-full`})]})]}):!r||!r.available?(0,$.jsxs)(`section`,{"data-slot":`gh-thread-error`,className:`mt-6 border-t border-border pt-5 text-xs text-soft-foreground`,children:[(0,$.jsxs)(`span`,{children:[`Couldn’t load comments — `,r?.reason??(n.error instanceof Error?n.error.message:`could not load comments`),`. `]}),(0,$.jsxs)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,className:`inline-flex items-center gap-0.5 text-muted-foreground hover:text-foreground hover:underline`,children:[`open on GitHub`,(0,$.jsx)(L,{"aria-hidden":`true`,className:`size-2.5`})]})]}):i.length===0?null:(0,$.jsxs)(`section`,{"data-slot":`gh-thread`,className:`mt-6 border-t border-border pt-5`,children:[(0,$.jsxs)(`h3`,{"data-slot":`gh-thread-header`,className:`mb-4 text-[11px] font-semibold tracking-wide text-soft-foreground uppercase`,children:[`Activity · `,r.comments.length,` comment`,r.comments.length===1?``:`s`]}),(0,$.jsx)(`ul`,{className:`flex flex-col gap-5`,children:vt(i).map(e=>e.group===`commits`?(0,$.jsx)(yt,{commits:e.commits,colors:t},e.commits[0].id):e.entry.row===`comment`?(0,$.jsx)(Tt,{comment:e.entry.comment},`${e.entry.comment.kind}-${e.entry.comment.id}`):(0,$.jsx)(xt,{event:e.entry.event,colors:t},e.entry.event.id))}),r.truncated?(0,$.jsxs)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,"data-slot":`gh-thread-truncated`,className:`mt-4 inline-flex items-center gap-0.5 text-xs text-soft-foreground hover:text-foreground hover:underline`,children:[`thread truncated — open on GitHub`,(0,$.jsx)(L,{"aria-hidden":`true`,className:`size-2.5`})]}):null]})}var _t=e=>e.row===`comment`?e.comment.createdAt:e.event.createdAt;function vt(e){let t=[],n=[],r=()=>{n.length!==0&&(n.length===1?t.push({group:`single`,entry:{row:`event`,event:n[0]}}):t.push({group:`commits`,commits:n}),n=[])};for(let i of e){if(i.row===`event`&&i.event.kind===`committed`&&i.row===`event`){let e=n[n.length-1];e&&e.actor!==i.event.actor&&r(),n.push(i.event);continue}r(),t.push({group:`single`,entry:i})}return r(),t}function yt({commits:e,colors:t}){let[n,r]=(0,Q.useState)(!1),i=e[0]?.actor??`?`;return n?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`li`,{"data-slot":`gh-commit-group`,"data-open":`true`,className:`min-w-0`,children:(0,$.jsxs)(`button`,{type:`button`,"aria-expanded":!0,onClick:()=>r(!1),className:`flex items-center gap-1.5 font-mono text-[11px] text-soft-foreground hover:text-foreground`,children:[(0,$.jsx)(`span`,{"aria-hidden":`true`,children:bt.committed}),(0,$.jsx)(`span`,{className:`font-sans font-medium text-foreground`,children:i}),(0,$.jsxs)(`span`,{children:[`added `,e.length,` commits`]})]})}),e.map(e=>(0,$.jsx)(xt,{event:e,colors:t},e.id))]}):(0,$.jsx)(`li`,{"data-slot":`gh-commit-group`,"data-open":`false`,className:`min-w-0`,children:(0,$.jsxs)(`button`,{type:`button`,"aria-expanded":!1,onClick:()=>r(!0),className:`flex items-center gap-1.5 font-mono text-[11px] text-soft-foreground hover:text-foreground`,children:[(0,$.jsx)(`span`,{"aria-hidden":`true`,children:bt.committed}),(0,$.jsx)(`span`,{className:`font-sans font-medium text-foreground`,children:i}),(0,$.jsxs)(`span`,{children:[`added `,e.length,` commits`]}),(0,$.jsx)(`span`,{className:`shrink-0`,children:G(e[e.length-1].createdAt)})]})})}var bt={committed:`⚙`,labeled:`◆`,unlabeled:`◇`,assigned:`◍`,unassigned:`◌`,merged:`⑃`,closed:`⊘`,reopened:`⊙`,head_ref_force_pushed:`↻`,"cross-referenced":`↗`,renamed:`✎`};function xt({event:e,colors:t}){return(0,$.jsxs)(`li`,{"data-slot":`gh-event-row`,"data-kind":e.kind,className:D(`flex min-w-0 items-center gap-1.5 font-mono text-[11px] text-soft-foreground`,e.kind===`merged`&&`text-accent-foreground`),children:[(0,$.jsx)(`span`,{"aria-hidden":`true`,className:`shrink-0`,children:bt[e.kind]}),(0,$.jsx)(`span`,{className:`font-sans font-medium text-foreground`,children:e.actor}),(0,$.jsx)(St,{event:e,colors:t}),(0,$.jsx)(`span`,{className:`shrink-0`,children:G(e.createdAt)}),e.url?(0,$.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,"aria-label":`open ${e.kind} on GitHub`,className:`ml-auto shrink-0 text-muted-foreground hover:text-foreground`,children:(0,$.jsx)(L,{"aria-hidden":`true`,className:`size-2.5`})}):null]})}function St({event:e,colors:t}){switch(e.kind){case`committed`:return(0,$.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5`,children:[(0,$.jsx)(`span`,{className:`shrink-0`,children:`committed`}),e.sha?(0,$.jsx)(`span`,{className:`shrink-0 text-muted-foreground`,children:e.sha.slice(0,7)}):null,e.message?(0,$.jsx)(`span`,{className:`truncate font-sans text-foreground`,children:e.message}):null,(0,$.jsx)(Ct,{checks:e.checks})]});case`labeled`:case`unlabeled`:return(0,$.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5`,children:[(0,$.jsx)(`span`,{className:`shrink-0`,children:e.kind===`labeled`?`added the`:`removed the`}),e.label?(0,$.jsx)(`span`,{"data-slot":`gh-event-label`,style:Qe(e.label.color??t[e.label.name]),className:`max-w-[12rem] truncate rounded-full border px-1.5 py-px font-sans text-[10px]`,children:e.label.name}):null,(0,$.jsx)(`span`,{className:`shrink-0`,children:`label`})]});case`assigned`:case`unassigned`:return(0,$.jsxs)(`span`,{className:`truncate`,children:[e.kind===`assigned`?`assigned`:`unassigned`,` `,e.subject??`someone`]});case`merged`:return(0,$.jsx)(`span`,{children:`merged this`});case`closed`:return(0,$.jsx)(`span`,{children:`closed this`});case`reopened`:return(0,$.jsx)(`span`,{children:`reopened this`});case`head_ref_force_pushed`:return(0,$.jsx)(`span`,{children:`force-pushed`});case`renamed`:return(0,$.jsxs)(`span`,{className:`truncate`,children:[`renamed this to `,e.subject??`—`]});case`cross-referenced`:return(0,$.jsxs)(`span`,{className:`truncate`,children:[`referenced this in `,e.refNumber?`#${e.refNumber}`:`another thread`,e.refTitle?` ${e.refTitle}`:``]})}}function Ct({checks:e}){return e?(0,$.jsx)(`span`,{"data-slot":`gh-commit-checks`,"data-checks":e,"aria-label":`checks ${e}`,className:D(`shrink-0`,Ot[e]),children:Dt[e]}):null}var wt={approved:{label:`approved`,tone:`border-success/40 text-success`},changes_requested:{label:`changes requested`,tone:`border-danger/40 text-danger`},commented:{label:`commented`,tone:`border-border text-muted-foreground`},dismissed:{label:`dismissed`,tone:`border-border text-muted-foreground`}};function Tt({comment:e}){let t=e.reviewState?wt[e.reviewState]:null;return(0,$.jsxs)(`li`,{"data-slot":`gh-thread-entry`,"data-kind":e.kind,className:`min-w-0`,children:[(0,$.jsxs)(`div`,{className:`mb-1.5 flex items-center gap-1.5 font-mono text-[11px] text-soft-foreground`,children:[(0,$.jsx)(Et,{url:e.avatarUrl,login:e.author}),(0,$.jsx)(`span`,{className:`font-sans font-medium text-foreground`,children:e.author}),(0,$.jsx)(`span`,{children:G(e.createdAt)}),t?(0,$.jsx)(`span`,{"data-slot":`gh-review-chip`,"data-review-state":e.reviewState,className:D(`rounded-full border px-1.5 py-px font-sans text-[10px] font-medium`,t.tone),children:t.label}):null,(0,$.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,"aria-label":`open comment on GitHub`,className:`ml-auto shrink-0 text-muted-foreground hover:text-foreground`,children:(0,$.jsx)(L,{"aria-hidden":`true`,className:`size-2.5`})})]}),(0,$.jsx)(`div`,{"data-slot":`gh-thread-body`,className:`text-sm`,children:e.body?(0,$.jsx)(ke,{children:e.body}):(0,$.jsx)(`p`,{className:`text-soft-foreground`,children:`(no body)`})})]})}function Et({url:e,login:t}){let[n,r]=(0,Q.useState)(!1);return e&&!n?(0,$.jsx)(`img`,{src:e,alt:``,width:16,height:16,loading:`lazy`,onError:()=>r(!0),"data-slot":`gh-avatar`,className:`size-4 shrink-0 rounded-full`}):(0,$.jsx)(`span`,{"data-slot":`gh-avatar-fallback`,"aria-hidden":`true`,className:`flex size-4 shrink-0 items-center justify-center rounded-full bg-muted text-[8px] font-semibold text-muted-foreground uppercase`,children:t.slice(0,1)||`?`})}var Dt={passing:`✓`,failing:`✗`,pending:`○`},Ot={passing:`text-success`,failing:`text-danger`,pending:`text-muted-foreground`};function kt({count:e}){return e?(0,$.jsxs)(`span`,{"data-slot":`gh-comment-count`,"data-count":e,"aria-label":`${e} comment${e===1?``:`s`}`,className:`inline-flex shrink-0 items-center gap-0.5`,children:[(0,$.jsx)(ye,{"aria-hidden":`true`,className:`size-3`}),e]}):null}function At({checks:e,url:t}){let n=D(`text-[11px] font-medium`,Ot[e],t&&`hover:underline`),r=`${Dt[e]} checks ${e}`;return t?(0,$.jsx)(`a`,{href:`${t}/checks`,target:`_blank`,rel:`noopener noreferrer`,"data-slot":`gh-checks`,"data-checks":e,className:n,children:r}):(0,$.jsx)(`span`,{"data-slot":`gh-checks`,"data-checks":e,className:n,children:r})}function jt({checks:e}){return(0,$.jsx)(`span`,{"data-slot":`gh-row-checks`,"data-checks":e,title:`checks ${e}`,"aria-label":`checks ${e}`,className:D(`shrink-0 font-sans text-[11px] font-semibold`,Ot[e]),children:Dt[e]})}export{ot as GithubRoute};