@ai-development-environment/server 0.0.99 → 0.0.101

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 (126) hide show
  1. package/package.json +1 -1
  2. package/standalone/.next/BUILD_ID +1 -1
  3. package/standalone/.next/build-manifest.json +3 -3
  4. package/standalone/.next/prerender-manifest.json +3 -3
  5. package/standalone/.next/server/app/[locale]/(dashboard)/actions/page.js.nft.json +1 -1
  6. package/standalone/.next/server/app/[locale]/(dashboard)/actions/page_client-reference-manifest.js +1 -1
  7. package/standalone/.next/server/app/[locale]/(dashboard)/apps/[appId]/page.js.nft.json +1 -1
  8. package/standalone/.next/server/app/[locale]/(dashboard)/apps/[appId]/page_client-reference-manifest.js +1 -1
  9. package/standalone/.next/server/app/[locale]/(dashboard)/builds/[buildId]/output/route.js.nft.json +1 -1
  10. package/standalone/.next/server/app/[locale]/(dashboard)/changes/page.js.nft.json +1 -1
  11. package/standalone/.next/server/app/[locale]/(dashboard)/changes/page_client-reference-manifest.js +1 -1
  12. package/standalone/.next/server/app/[locale]/(dashboard)/commands/runs/[runId]/output/route.js.nft.json +1 -1
  13. package/standalone/.next/server/app/[locale]/(dashboard)/comments/page.js.nft.json +1 -1
  14. package/standalone/.next/server/app/[locale]/(dashboard)/comments/page_client-reference-manifest.js +1 -1
  15. package/standalone/.next/server/app/[locale]/(dashboard)/github-cache/page.js.nft.json +1 -1
  16. package/standalone/.next/server/app/[locale]/(dashboard)/github-cache/page_client-reference-manifest.js +1 -1
  17. package/standalone/.next/server/app/[locale]/(dashboard)/jira/tickets/[issueKey]/page.js.nft.json +1 -1
  18. package/standalone/.next/server/app/[locale]/(dashboard)/jira/tickets/[issueKey]/page_client-reference-manifest.js +1 -1
  19. package/standalone/.next/server/app/[locale]/(dashboard)/jira/tickets/page.js.nft.json +1 -1
  20. package/standalone/.next/server/app/[locale]/(dashboard)/jira/tickets/page_client-reference-manifest.js +1 -1
  21. package/standalone/.next/server/app/[locale]/(dashboard)/plans/[runId]/page.js.nft.json +1 -1
  22. package/standalone/.next/server/app/[locale]/(dashboard)/plans/[runId]/page_client-reference-manifest.js +1 -1
  23. package/standalone/.next/server/app/[locale]/(dashboard)/plans/page.js.nft.json +1 -1
  24. package/standalone/.next/server/app/[locale]/(dashboard)/plans/page_client-reference-manifest.js +1 -1
  25. package/standalone/.next/server/app/[locale]/(dashboard)/pull-requests/[owner]/[repository]/[number]/page.js.nft.json +1 -1
  26. package/standalone/.next/server/app/[locale]/(dashboard)/pull-requests/[owner]/[repository]/[number]/page_client-reference-manifest.js +1 -1
  27. package/standalone/.next/server/app/[locale]/(dashboard)/pull-requests/page.js.nft.json +1 -1
  28. package/standalone/.next/server/app/[locale]/(dashboard)/pull-requests/page_client-reference-manifest.js +1 -1
  29. package/standalone/.next/server/app/[locale]/(dashboard)/sessions/[runId]/page.js.nft.json +1 -1
  30. package/standalone/.next/server/app/[locale]/(dashboard)/sessions/[runId]/page_client-reference-manifest.js +1 -1
  31. package/standalone/.next/server/app/[locale]/(dashboard)/sessions/page.js.nft.json +1 -1
  32. package/standalone/.next/server/app/[locale]/(dashboard)/sessions/page_client-reference-manifest.js +1 -1
  33. package/standalone/.next/server/app/[locale]/(dashboard)/usage/page.js.nft.json +1 -1
  34. package/standalone/.next/server/app/[locale]/(dashboard)/usage/page_client-reference-manifest.js +1 -1
  35. package/standalone/.next/server/app/[locale]/(dashboard)/workflows/[workflowId]/edit/page.js.nft.json +1 -1
  36. package/standalone/.next/server/app/[locale]/(dashboard)/workflows/[workflowId]/edit/page_client-reference-manifest.js +1 -1
  37. package/standalone/.next/server/app/[locale]/(dashboard)/workflows/new/page.js.nft.json +1 -1
  38. package/standalone/.next/server/app/[locale]/(dashboard)/workflows/new/page_client-reference-manifest.js +1 -1
  39. package/standalone/.next/server/app/[locale]/(dashboard)/worktrees/[worktreeId]/page.js.nft.json +1 -1
  40. package/standalone/.next/server/app/[locale]/(dashboard)/worktrees/[worktreeId]/page_client-reference-manifest.js +1 -1
  41. package/standalone/.next/server/app/[locale]/(dashboard)/worktrees/page.js.nft.json +1 -1
  42. package/standalone/.next/server/app/[locale]/(dashboard)/worktrees/page_client-reference-manifest.js +1 -1
  43. package/standalone/.next/server/app/_global-error.html +1 -1
  44. package/standalone/.next/server/app/_global-error.rsc +1 -1
  45. package/standalone/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
  46. package/standalone/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  47. package/standalone/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  48. package/standalone/.next/server/app/_not-found.html +1 -1
  49. package/standalone/.next/server/app/_not-found.rsc +1 -1
  50. package/standalone/.next/server/app/_not-found.segments/_full.segment.rsc +1 -1
  51. package/standalone/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
  52. package/standalone/.next/server/app/_not-found.segments/_tree.segment.rsc +1 -1
  53. package/standalone/.next/server/app/api/agent/build-artifact-transfers/[transferId]/complete/route.js.nft.json +1 -1
  54. package/standalone/.next/server/app/api/agent/build-artifact-transfers/[transferId]/download/route.js.nft.json +1 -1
  55. package/standalone/.next/server/app/api/agent/build-artifact-transfers/[transferId]/route.js.nft.json +1 -1
  56. package/standalone/.next/server/app/api/agent/build-artifact-transfers/[transferId]/upload/route.js.nft.json +1 -1
  57. package/standalone/.next/server/app/api/agent/run-attachments/[attachmentId]/route.js.nft.json +1 -1
  58. package/standalone/.next/server/app/api/build-artifact-uploads/[uploadId]/route.js.nft.json +1 -1
  59. package/standalone/.next/server/app/api/codebases/by-path/route.js.nft.json +1 -1
  60. package/standalone/.next/server/app/api/codebases/route.js.nft.json +1 -1
  61. package/standalone/.next/server/app/api/graphql/route.js.nft.json +1 -1
  62. package/standalone/.next/server/app/api/ios/apns-devices/route.js.nft.json +1 -1
  63. package/standalone/.next/server/app/api/ios/devices/export.tsv/route.js.nft.json +1 -1
  64. package/standalone/.next/server/app/api/ios/enrollment/start/route.js.nft.json +1 -1
  65. package/standalone/.next/server/app/api/ios/notification-devices/route.js.nft.json +1 -1
  66. package/standalone/.next/server/app/api/mcp/route.js.nft.json +1 -1
  67. package/standalone/.next/server/app/api/public/builds/[buildId]/artifacts/[artifactId]/manifest.plist/route.js.nft.json +1 -1
  68. package/standalone/.next/server/app/api/public/builds/[buildId]/artifacts/[artifactId]/route.js.nft.json +1 -1
  69. package/standalone/.next/server/app/api/public/github/webhook/route.js.nft.json +1 -1
  70. package/standalone/.next/server/app/api/public/gitlab/webhook/route.js.nft.json +1 -1
  71. package/standalone/.next/server/app/api/public/ios/enrollment-profile/route.js.nft.json +1 -1
  72. package/standalone/.next/server/app/api/public/ios/profile-response/route.js.nft.json +1 -1
  73. package/standalone/.next/server/app/api/public/jira/webhook/route.js.nft.json +1 -1
  74. package/standalone/.next/server/app/api/public/sse/[token]/route.js.nft.json +1 -1
  75. package/standalone/.next/server/app/api/sse/history/export/route.js.nft.json +1 -1
  76. package/standalone/.next/server/app/api/telemetry/analytics-events/route.js.nft.json +1 -1
  77. package/standalone/.next/server/app/api/telemetry/console-logs/route.js.nft.json +1 -1
  78. package/standalone/.next/server/app/api/telemetry/export/route.js.nft.json +1 -1
  79. package/standalone/.next/server/app/api/tools/call/route.js.nft.json +1 -1
  80. package/standalone/.next/server/app/api/tools/catalog/route.js.nft.json +1 -1
  81. package/standalone/.next/server/app/api/worktrees/[worktreeId]/diff-image/route.js.nft.json +1 -1
  82. package/standalone/.next/server/chunks/[root-of-the-server]__03aos_4._.js +1 -1
  83. package/standalone/.next/server/chunks/_0e8lp3p._.js +1 -1
  84. package/standalone/.next/server/chunks/_0fwwxlu._.js +1 -1
  85. package/standalone/.next/server/chunks/_0h78qjg._.js +1 -1
  86. package/standalone/.next/server/chunks/_0ndnc91._.js +1 -1
  87. package/standalone/.next/server/chunks/_0wpfe7q._.js +1 -1
  88. package/standalone/.next/server/chunks/_1-vdyhc._.js +1 -1
  89. package/standalone/.next/server/chunks/_1gt6607._.js +1 -1
  90. package/standalone/.next/server/chunks/_1jwsn5v._.js +1 -1
  91. package/standalone/.next/server/chunks/_1qjb83a._.js +1 -1
  92. package/standalone/.next/server/chunks/_1zwfwcs._.js +1 -1
  93. package/standalone/.next/server/chunks/ssr/[root-of-the-server]__03lyeon._.js +1 -1
  94. package/standalone/.next/server/chunks/ssr/[root-of-the-server]__0y7gd01._.js +1 -1
  95. package/standalone/.next/server/chunks/ssr/[root-of-the-server]__10jrizr._.js +1 -1
  96. package/standalone/.next/server/chunks/ssr/[root-of-the-server]__1rcvzx1._.js +1 -1
  97. package/standalone/.next/server/chunks/ssr/_0gsta10._.js +1 -1
  98. package/standalone/.next/server/chunks/ssr/_0k25g0q._.js +1 -1
  99. package/standalone/.next/server/chunks/ssr/_0mbr53g._.js +1 -1
  100. package/standalone/.next/server/chunks/ssr/_0p8nq_k._.js +1 -1
  101. package/standalone/.next/server/chunks/ssr/_1gn4tn4._.js +1 -1
  102. package/standalone/.next/server/chunks/ssr/src_components_workflows_workflow-editor_tsx_1eo69h2._.js +1 -1
  103. package/standalone/.next/server/middleware-build-manifest.js +3 -3
  104. package/standalone/.next/server/pages/404.html +1 -1
  105. package/standalone/.next/server/pages/500.html +1 -1
  106. package/standalone/.next/server/server-reference-manifest.js +1 -1
  107. package/standalone/.next/server/server-reference-manifest.json +1 -1
  108. package/standalone/.next/static/chunks/{436x7m1mvj6hx.js → 0a2njf53y1b_a.js} +5 -5
  109. package/standalone/.next/static/chunks/{3rg_-g4l65tdm.js → 0ih1_jixkezy9.js} +1 -1
  110. package/standalone/.next/static/chunks/{1y_k2l4tani4i.js → 1-95dtd9sp1ri.js} +1 -1
  111. package/standalone/.next/static/chunks/117mbxzvbdo5r.js +38 -0
  112. package/standalone/.next/static/chunks/{1fvp3ex0gde7v.js → 1e_b3ymyt3673.js} +1 -1
  113. package/standalone/.next/static/chunks/{13dmoqt_x5qg3.js → 1hlskd2wydmjh.js} +1 -1
  114. package/standalone/.next/static/chunks/{28xljttzejclr.js → 1s-wwfg3sdyjh.js} +4 -4
  115. package/standalone/.next/static/chunks/2hviq_ydapgns.js +3 -0
  116. package/standalone/.next/static/chunks/33pqqy7c3sgg7.js +38 -0
  117. package/standalone/.next/static/chunks/{3fps7kmx8mnhr.js → 3oslbazmmg72z.js} +5 -5
  118. package/standalone/.next/static/chunks/{19o8lqhow_wle.js → 3psu0owhqo5ri.js} +6 -6
  119. package/standalone/.next/static/chunks/{3_08sih2rcs9k.js → 3swi28-0k8olm.js} +1 -1
  120. package/standalone/.next/static/chunks/{2lod_i2dzh949.js → 42ywmggw6zx17.js} +2 -2
  121. package/standalone/.next/static/chunks/0lriz5ed2mmt1.js +0 -3
  122. package/standalone/.next/static/chunks/3-pqgzhb67rrw.js +0 -38
  123. package/standalone/.next/static/chunks/3plqps194w7h1.js +0 -38
  124. /package/standalone/.next/static/{Pro8D0Hv2IhphMUT1Ihzv → y9Hi8CBWpu_MxfgH-bM8Z}/_buildManifest.js +0 -0
  125. /package/standalone/.next/static/{Pro8D0Hv2IhphMUT1Ihzv → y9Hi8CBWpu_MxfgH-bM8Z}/_clientMiddlewareManifest.js +0 -0
  126. /package/standalone/.next/static/{Pro8D0Hv2IhphMUT1Ihzv → y9Hi8CBWpu_MxfgH-bM8Z}/_ssgManifest.js +0 -0
@@ -1,4 +1,4 @@
1
- (globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,106134,e=>{"use strict";var l=e.i(843476),t=e.i(154548),i=e.i(508734),s=e.i(762368),a=e.i(772382),r=e.i(580860),n=e.i(456420);let o=(0,n.default)("grip-vertical",[["circle",{cx:"9",cy:"12",r:"1",key:"1vctgf"}],["circle",{cx:"9",cy:"5",r:"1",key:"hp0tcf"}],["circle",{cx:"9",cy:"19",r:"1",key:"fkjjf6"}],["circle",{cx:"15",cy:"12",r:"1",key:"1tmaij"}],["circle",{cx:"15",cy:"5",r:"1",key:"19l28e"}],["circle",{cx:"15",cy:"19",r:"1",key:"f4zoj3"}]]);var c=e.i(895065);let d=(0,n.default)("mouse-pointer-2-off",[["path",{d:"m15.55 8.45 5.138 2.087a.5.5 0 0 1-.063.947l-6.124 1.58a2 2 0 0 0-1.438 1.435l-1.579 6.126a.5.5 0 0 1-.947.063L8.45 15.551",key:"1qoshx"}],["path",{d:"M22 2 2 22",key:"y4kqgn"}],["path",{d:"m6.816 11.528-2.779-6.84a.495.495 0 0 1 .651-.651l6.84 2.779",key:"mymuvk"}]]);var u=e.i(77071),p=e.i(566595),h=e.i(856522),x=e.i(730274),m=e.i(166794),f=e.i(573474),g=e.i(725981),j=e.i(948148),v=e.i(271645),b=e.i(929592),y=e.i(487486),w=e.i(519455),k=e.i(515288),C=e.i(257428),S=e.i(776639),N=e.i(82612),I=e.i(542450),T=e.i(793479),E=e.i(950594),F=e.i(906197),O=e.i(967489),A=e.i(302747),P=e.i(759684),L=e.i(980376),D=e.i(987968),R=e.i(677572),W=e.i(624687),M=e.i(746798),$=e.i(520133),q=e.i(462777),B=e.i(637611),V=e.i(672510),z=e.i(274757),G=e.i(716327),U=e.i(983913),H=e.i(814760),K=e.i(266136);let _=`query RunProviderCatalog($worktreeId: ID) {
1
+ (globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,106134,e=>{"use strict";var l=e.i(843476),t=e.i(154548),i=e.i(508734),s=e.i(762368),a=e.i(772382),r=e.i(580860),n=e.i(456420);let o=(0,n.default)("grip-vertical",[["circle",{cx:"9",cy:"12",r:"1",key:"1vctgf"}],["circle",{cx:"9",cy:"5",r:"1",key:"hp0tcf"}],["circle",{cx:"9",cy:"19",r:"1",key:"fkjjf6"}],["circle",{cx:"15",cy:"12",r:"1",key:"1tmaij"}],["circle",{cx:"15",cy:"5",r:"1",key:"19l28e"}],["circle",{cx:"15",cy:"19",r:"1",key:"f4zoj3"}]]);var c=e.i(895065);let d=(0,n.default)("mouse-pointer-2-off",[["path",{d:"m15.55 8.45 5.138 2.087a.5.5 0 0 1-.063.947l-6.124 1.58a2 2 0 0 0-1.438 1.435l-1.579 6.126a.5.5 0 0 1-.947.063L8.45 15.551",key:"1qoshx"}],["path",{d:"M22 2 2 22",key:"y4kqgn"}],["path",{d:"m6.816 11.528-2.779-6.84a.495.495 0 0 1 .651-.651l6.84 2.779",key:"mymuvk"}]]);var u=e.i(77071),p=e.i(566595),h=e.i(856522),x=e.i(730274),m=e.i(166794),f=e.i(573474),g=e.i(725981),j=e.i(948148),v=e.i(271645),b=e.i(929592),y=e.i(487486),w=e.i(519455),k=e.i(515288),C=e.i(257428),S=e.i(776639),N=e.i(82612),I=e.i(542450),T=e.i(793479),E=e.i(950594),F=e.i(906197),O=e.i(967489),A=e.i(302747),L=e.i(759684),P=e.i(980376),D=e.i(987968),R=e.i(677572),W=e.i(624687),M=e.i(746798),$=e.i(520133),q=e.i(462777),B=e.i(637611),V=e.i(672510),z=e.i(274757),G=e.i(716327),U=e.i(983913),H=e.i(814760),K=e.i(266136);let _=`query RunProviderCatalog($worktreeId: ID) {
2
2
  runProviderCatalog(worktreeId: $worktreeId) {
3
3
  key
4
4
  label
@@ -45,7 +45,7 @@
45
45
  githubActionsWorkflowRuns(source: WORKFLOW_AUTOMATION, codebaseRepositoryId: $codebaseRepositoryId, first: 25) {
46
46
  items { id displayTitle headBranch }
47
47
  }
48
- }`,variables:{codebaseRepositoryId:l},map:e=>e.githubActionsWorkflowRuns?.items.map(e=>({value:e.id,label:e.displayTitle||e.id,description:e.headBranch??void 0}))??[]};default:return null}}(e,l),[e,l]),i=t?JSON.stringify({query:t.query,variables:t.variables}):null,[s,a]=(0,v.useState)({key:"",options:[],error:!1});return((0,v.useEffect)(()=>{if(!t||!i)return;let e=!1;return(0,B.controlPlaneRequest)(t.query,t.variables).then(l=>{e||a({key:i,options:t.map(l),error:!1})}).catch(()=>{e||a({key:i,options:[],error:!0})}),()=>{e=!0}},[t,i]),t&&i)?s.key!==i?{options:[],loading:!0,fallback:!1}:{options:s.options,loading:!1,fallback:s.error||0===s.options.length}:{options:[],loading:!1,fallback:!0}}var eF=e.i(159888);let eO=(0,n.default)("pen-line",[["path",{d:"M13 21h8",key:"1jsn5i"}],["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}]]);var eA=e.i(808562);function eP(e){return!!e&&"object"==typeof e&&!Array.isArray(e)&&"SESSION"===e.source}function eL(e){return e&&"object"==typeof e&&!Array.isArray(e)&&"LITERAL"===e.source?e.value:e}function eD(){let e=(0,j.useTranslations)("workflows");return(0,l.jsx)(I.FieldDescription,{className:"text-[10px]",children:e("interpolationHelp",{token:"{{path}}",example:"{{worktree.baseBranch}}"})})}function eR({mode:e,onValueChange:t}){let i=(0,j.useTranslations)("workflows");return(0,l.jsxs)(eA.ToggleGroup,{"aria-label":i("valueModeToggle"),onValueChange:e=>{("literal"===e||"session"===e)&&t(e)},size:"sm",spacing:0,type:"single",value:e,variant:"outline",children:[(0,l.jsxs)(M.Tooltip,{children:[(0,l.jsx)(M.TooltipTrigger,{asChild:!0,children:(0,l.jsx)(eA.ToggleGroupItem,{"aria-label":i("valueModeLiteral"),className:"size-7 px-0 aria-checked:bg-accent aria-checked:text-accent-foreground",value:"literal",children:(0,l.jsx)(eO,{className:"size-3.5"})})}),(0,l.jsx)(M.TooltipContent,{children:i("valueModeLiteral")})]}),(0,l.jsxs)(M.Tooltip,{children:[(0,l.jsx)(M.TooltipTrigger,{asChild:!0,children:(0,l.jsx)(eA.ToggleGroupItem,{"aria-label":i("valueModeSession"),className:"size-7 px-0 aria-checked:bg-accent aria-checked:text-accent-foreground",value:"session",children:(0,l.jsx)(eF.Braces,{className:"size-3.5"})})}),(0,l.jsx)(M.TooltipContent,{children:i("valueModeSession")})]})]})}function eW({label:e,help:t,allowCustomSessionPath:i=!0,defaultSessionPath:s,sessionEnabled:a,interpolationEnabled:r=!1,value:n,onChange:o,sessionPaths:c,children:d}){let u=(0,j.useTranslations)("workflows"),p=(0,v.useId)(),h=eP(n)?"session":"literal",x=c.map(({path:e,description:l})=>({value:e,label:e,description:l}));return(0,l.jsxs)(I.Field,{children:[(0,l.jsxs)("div",{className:"flex items-end justify-between gap-2",children:[(0,l.jsx)(I.FieldLabel,{className:"text-xs",htmlFor:p,children:e}),a&&(0,l.jsx)(eR,{mode:h,onValueChange:e=>o("session"===e?{source:"SESSION",path:c.find(({path:e})=>e===s)?.path??c[0]?.path??""}:"")})]}),"session"===h?(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(U.SearchableSelect,{allowCustomValue:i,ariaLabel:u("sessionBindingLabel"),emptyMessage:u("noOptions"),onValueChange:e=>o({source:"SESSION",path:e}),options:x,placeholder:u("sessionPathPlaceholder"),searchPlaceholder:u("searchPlaceholder"),value:eP(n)?n.path:""}),(0,l.jsx)(I.FieldDescription,{className:"text-[10px]",children:u("sessionBindingHelp")})]}):(0,l.jsxs)(l.Fragment,{children:[d(eL(n),o,p),t&&(0,l.jsx)(I.FieldDescription,{className:"text-[10px]",children:t}),r&&(0,l.jsx)(eD,{})]})]})}function eM(e){return"string"==typeof e?e:""}function e$(e,l){if(!l)return null;let t=e[l];return"string"==typeof t&&t.length>0?t:null}function eq(e){return!!e.valueModes?.includes("session")}function eB(e){return!!e.valueModes?.includes("interpolation")}function eV({field:e,value:t,onChange:i}){let s=(0,j.useTranslations)("workflows"),a=(0,v.useId)(),r=e.options?.kind==="static"?e.options.options:[];return(0,l.jsxs)(I.Field,{children:[(0,l.jsx)(I.FieldLabel,{className:"text-xs",htmlFor:a,children:e.label}),(0,l.jsxs)(O.Select,{onValueChange:e=>i(e),value:eM(eL(t)),children:[(0,l.jsx)(O.SelectTrigger,{className:"w-full",id:a,children:(0,l.jsx)(O.SelectValue,{placeholder:s("selectPlaceholder")})}),(0,l.jsx)(O.SelectContent,{children:r.map(e=>(0,l.jsx)(O.SelectItem,{value:e.value,children:e.label??e.value},e.value))})]}),e.help&&(0,l.jsx)(I.FieldDescription,{className:"text-[10px]",children:e.help})]})}function ez({field:e,value:t,onChange:i,sessionPaths:s}){return(0,l.jsx)(eW,{help:e.help,interpolationEnabled:eB(e),label:e.label,onChange:i,sessionEnabled:eq(e),sessionPaths:s,value:t,children:(t,i,s)=>e.multiline?(0,l.jsx)(W.Textarea,{className:"min-h-20 text-sm",id:s,onChange:e=>i(e.target.value),placeholder:e.placeholder,value:eM(t)}):(0,l.jsx)(T.Input,{id:s,onChange:e=>i(e.target.value),placeholder:e.placeholder,value:eM(t)})})}function eG({field:e,value:t,onChange:i,sessionPaths:s}){return(0,l.jsx)(eW,{help:e.help,label:e.label,onChange:i,sessionEnabled:eq(e),sessionPaths:s,value:t,children:(t,i,s)=>(0,l.jsx)(T.Input,{id:s,max:e.maximum,min:e.minimum,onChange:e=>i(""===e.target.value?void 0:Number(e.target.value)),placeholder:e.placeholder,step:e.integer?1:void 0,type:"number",value:"number"==typeof t&&Number.isFinite(t)?String(t):""})})}function eU({field:e,value:t,onChange:i}){let s=(0,v.useId)();return(0,l.jsxs)(I.Field,{orientation:"horizontal",children:[(0,l.jsx)(C.Checkbox,{checked:!0===eL(t),id:s,onCheckedChange:e=>i(!0===e)}),(0,l.jsxs)(I.FieldContent,{children:[(0,l.jsx)(I.FieldLabel,{className:"text-xs",htmlFor:s,children:e.label}),e.help&&(0,l.jsx)(I.FieldDescription,{className:"text-[10px]",children:e.help})]})]})}function eH({field:e,value:t,onChange:i}){let s=Array.isArray(t)?t.map(String):[];return(0,l.jsxs)(I.Field,{children:[(0,l.jsx)(I.FieldLabel,{className:"text-xs",children:e.label}),(0,l.jsx)(K.McpPresetPicker,{kind:e.presetKind,onChange:i,selectedIds:s,showAvailability:null==e.presetKind}),e.help&&(0,l.jsx)(I.FieldDescription,{className:"text-[10px]",children:e.help})]})}function eK({field:e,config:t,value:i,onChange:s,sessionPaths:a}){let r=(0,j.useTranslations)("workflows"),n=e.options?.kind==="resource"?e.options:null,o=e$(t,n?.scopeFrom),{options:c,loading:d}=eE(n?.resource??"codebase",o),u=n?.sessionPath,p=u?a.filter(({path:e})=>{let[l,t]=u.split(".");return e===u||e.startsWith(`${l}.`)&&e.endsWith(`.${t}`)}):a;return(0,l.jsx)(eW,{allowCustomSessionPath:!u,defaultSessionPath:u,help:e.help,interpolationEnabled:eB(e),label:e.label,onChange:s,sessionEnabled:eq(e),sessionPaths:p,value:i,children:(t,i)=>(0,l.jsx)(U.SearchableSelect,{allowCustomValue:!0,ariaLabel:e.label,disabled:d,emptyMessage:r("noOptions"),onValueChange:i,options:c,placeholder:e.placeholder??r("selectPlaceholder"),searchPlaceholder:r("searchPlaceholder"),value:eM(t)})})}function e_({field:e,config:t,value:i,onChange:s}){let a=(0,j.useTranslations)("workflows"),r=e.options?.kind==="resource"?e.options:null,n=e$(t,r?.scopeFrom),{options:o,loading:c}=eE(r?.resource??"codebase",n),d=Array.isArray(i)?i.map(String):[],u=o.filter(e=>!d.includes(e.value));return(0,l.jsxs)(I.Field,{children:[(0,l.jsx)(I.FieldLabel,{className:"text-xs",children:e.label}),(0,l.jsx)(F.ItemGroup,{className:"gap-1.5",children:d.map(e=>(0,l.jsxs)(F.Item,{size:"xs",variant:"muted",children:[(0,l.jsx)(F.ItemContent,{className:"min-w-0",children:(0,l.jsx)(F.ItemTitle,{className:"block truncate text-xs",children:o.find(l=>l.value===e)?.label??e})}),(0,l.jsx)(F.ItemActions,{children:(0,l.jsxs)(M.Tooltip,{children:[(0,l.jsx)(M.TooltipTrigger,{asChild:!0,children:(0,l.jsx)(w.Button,{"aria-label":a("removeRow"),className:"size-7",onClick:()=>{s(d.filter(l=>l!==e))},size:"icon",type:"button",variant:"ghost",children:(0,l.jsx)(f.Trash2,{className:"size-3.5"})})}),(0,l.jsx)(M.TooltipContent,{children:a("removeRow")})]})})]},e))}),(0,l.jsx)(U.SearchableSelect,{allowCustomValue:!0,ariaLabel:e.label,disabled:c,emptyMessage:a("noOptions"),onValueChange:e=>{e&&!d.includes(e)&&s([...d,e])},options:u,placeholder:e.placeholder??a("addRow"),searchPlaceholder:a("searchPlaceholder"),value:""}),e.help&&(0,l.jsx)(I.FieldDescription,{className:"text-[10px]",children:e.help}),eB(e)&&(0,l.jsx)(eD,{})]})}function eX({field:e,value:t,onChange:i}){let s=(0,j.useTranslations)("workflows"),a=Array.isArray(t)?t.map(String):[];return(0,l.jsxs)(I.Field,{children:[(0,l.jsx)(I.FieldLabel,{className:"text-xs",children:e.label}),(0,l.jsx)(I.FieldGroup,{className:"gap-1.5",children:a.map((t,r)=>(0,l.jsxs)(E.InputGroup,{children:[(0,l.jsx)(E.InputGroupInput,{onChange:e=>{let l;return l=e.target.value,i(a.map((e,t)=>t===r?l:e))},placeholder:e.placeholder,value:t}),(0,l.jsx)(E.InputGroupAddon,{align:"inline-end",children:(0,l.jsxs)(M.Tooltip,{children:[(0,l.jsx)(M.TooltipTrigger,{asChild:!0,children:(0,l.jsx)(E.InputGroupButton,{"aria-label":s("removeRow"),onClick:()=>i(a.filter((e,l)=>l!==r)),size:"icon-xs",children:(0,l.jsx)(f.Trash2,{className:"size-3.5"})})}),(0,l.jsx)(M.TooltipContent,{children:s("removeRow")})]})})]},r))}),(0,l.jsxs)(w.Button,{onClick:()=>i([...a,""]),size:"sm",type:"button",variant:"outline",children:[(0,l.jsx)(u.Plus,{className:"size-3.5"})," ",s("addRow")]}),e.help&&(0,l.jsx)(I.FieldDescription,{className:"text-[10px]",children:e.help}),eB(e)&&(0,l.jsx)(eD,{})]})}function eJ({field:e,value:t,onChange:i}){let s=(0,j.useTranslations)("workflows"),a=t&&"object"==typeof t&&!Array.isArray(t)?Object.entries(t).map(([e,l])=>[e,l]):[],r=e=>{let l={};for(let[t,i]of e)t&&(l[t]=i);i(l)};return(0,l.jsxs)(I.Field,{children:[(0,l.jsx)(I.FieldLabel,{className:"text-xs",children:e.label}),(0,l.jsx)(I.FieldGroup,{className:"gap-1.5",children:a.map(([e,t],i)=>(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)(T.Input,{className:"w-2/5",onChange:e=>r(a.map((l,t)=>t===i?[e.target.value,l[1]]:l)),placeholder:s("recordKeyPlaceholder"),value:e}),(0,l.jsx)(T.Input,{className:"min-w-0 flex-1",onChange:e=>r(a.map((l,t)=>t===i?[l[0],e.target.value]:l)),placeholder:s("recordValuePlaceholder"),value:eM(t)}),(0,l.jsxs)(M.Tooltip,{children:[(0,l.jsx)(M.TooltipTrigger,{asChild:!0,children:(0,l.jsx)(w.Button,{"aria-label":s("removeRow"),className:"size-7 shrink-0",onClick:()=>r(a.filter((e,l)=>l!==i)),size:"icon",type:"button",variant:"ghost",children:(0,l.jsx)(f.Trash2,{className:"size-3.5"})})}),(0,l.jsx)(M.TooltipContent,{children:s("removeRow")})]})]},i))}),(0,l.jsxs)(w.Button,{onClick:()=>r([...a,["",""]]),size:"sm",type:"button",variant:"outline",children:[(0,l.jsx)(u.Plus,{className:"size-3.5"})," ",s("addRow")]}),e.help&&(0,l.jsx)(I.FieldDescription,{className:"text-[10px]",children:e.help}),eB(e)&&(0,l.jsx)(eD,{})]})}function eQ({field:e,value:t,onChange:i}){let s=(0,v.useId)(),[a,r]=(0,v.useState)(()=>void 0===t?"":JSON.stringify(t,null,2)),[n,o]=(0,v.useState)(null),c=(0,v.useRef)(a);return(0,v.useEffect)(()=>{let e=void 0===t?"":JSON.stringify(t,null,2);e!==c.current&&(r(e),c.current=e,o(null))},[t]),(0,l.jsxs)(I.Field,{"data-invalid":!!n,children:[(0,l.jsx)(I.FieldLabel,{className:"text-xs",htmlFor:s,children:e.label}),(0,l.jsx)(W.Textarea,{"aria-invalid":!!n,className:"min-h-24 font-mono text-xs",id:s,onChange:e=>(e=>{if(r(e),""===e.trim()){c.current="",o(null),i(void 0);return}try{let l=JSON.parse(e);c.current=JSON.stringify(l,null,2),o(null),i(l)}catch(e){o(e instanceof Error?e.message:String(e))}})(e.target.value),placeholder:e.placeholder,value:a}),n?(0,l.jsx)(I.FieldError,{className:"text-[10px]",children:n}):(0,l.jsxs)(l.Fragment,{children:[e.help&&(0,l.jsx)(I.FieldDescription,{className:"text-[10px]",children:e.help}),eB(e)&&(0,l.jsx)(eD,{})]})]})}function eY(e){let{field:t,value:i,onChange:s,sessionPaths:a}=e,r=(0,j.useTranslations)("workflows"),n=function(e){if(null==e)return ek;if("object"!=typeof e||Array.isArray(e))return null;if("ALL"===e.op||"ANY"===e.op){let l=e.conditions;if(!Array.isArray(l))return null;let t=[];for(let e of l){let l=eC(e);if(!l)return null;t.push(l)}return{mode:e.op,rows:t}}let l=eC(e);return l?{mode:"ALL",rows:[l]}:null}(i),o=a.map(({path:e,description:l})=>({value:e,label:e,description:l}));if(!n)return(0,l.jsxs)("div",{className:"space-y-1.5",children:[(0,l.jsx)(eQ,{...e}),(0,l.jsx)(I.FieldDescription,{className:"text-[10px]",children:r("conditionAdvanced")})]});let c=e=>s(function(e){if(0!==e.rows.length)return 1===e.rows.length?eS(e.rows[0]):{op:e.mode,conditions:e.rows.map(eS)}}(e)),d=(e,l)=>c({...n,rows:n.rows.map((t,i)=>i===e?{...t,...l}:t)});return(0,l.jsxs)(I.Field,{children:[(0,l.jsx)(I.FieldLabel,{className:"text-xs",children:t.label}),n.rows.length>1&&(0,l.jsxs)(O.Select,{onValueChange:e=>c({...n,mode:"ANY"===e?"ANY":"ALL"}),value:n.mode,children:[(0,l.jsx)(O.SelectTrigger,{"aria-label":r("conditionMatchMode"),className:"w-full",children:(0,l.jsx)(O.SelectValue,{})}),(0,l.jsxs)(O.SelectContent,{children:[(0,l.jsx)(O.SelectItem,{value:"ALL",children:r("conditionMatchAll")}),(0,l.jsx)(O.SelectItem,{value:"ANY",children:r("conditionMatchAny")})]})]}),(0,l.jsx)(I.FieldGroup,{className:"gap-1.5",children:n.rows.map((e,t)=>{var i;return(0,l.jsxs)("div",{className:"space-y-1.5 rounded-lg border p-2",children:[(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)("div",{className:"min-w-0 flex-1",children:(0,l.jsx)(U.SearchableSelect,{allowCustomValue:!0,ariaLabel:r("conditionField"),emptyMessage:r("noOptions"),onValueChange:e=>d(t,{path:e}),options:o,placeholder:r("sessionPathPlaceholder"),searchPlaceholder:r("searchPlaceholder"),value:e.path})}),(0,l.jsxs)(M.Tooltip,{children:[(0,l.jsx)(M.TooltipTrigger,{asChild:!0,children:(0,l.jsx)(w.Button,{"aria-label":r("removeRow"),className:"size-7 shrink-0",onClick:()=>c({...n,rows:n.rows.filter((e,l)=>l!==t)}),size:"icon",type:"button",variant:"ghost",children:(0,l.jsx)(f.Trash2,{className:"size-3.5"})})}),(0,l.jsx)(M.TooltipContent,{children:r("removeRow")})]})]}),(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsxs)(O.Select,{onValueChange:e=>d(t,{operator:e}),value:e.operator,children:[(0,l.jsx)(O.SelectTrigger,{"aria-label":r("conditionOperator"),className:"w-40 shrink-0",children:(0,l.jsx)(O.SelectValue,{})}),(0,l.jsx)(O.SelectContent,{children:ey.map(e=>(0,l.jsx)(O.SelectItem,{value:e.value,children:r(`conditionOperators.${e.value}`)},e.value))})]}),ew(e.operator)&&(0,l.jsxs)(l.Fragment,{children:[eP(e.value)?(0,l.jsx)("div",{className:"min-w-0 flex-1",children:(0,l.jsx)(U.SearchableSelect,{allowCustomValue:!0,ariaLabel:r("sessionBindingLabel"),emptyMessage:r("noOptions"),onValueChange:e=>d(t,{value:{source:"SESSION",path:e}}),options:o,placeholder:r("sessionPathPlaceholder"),searchPlaceholder:r("searchPlaceholder"),value:e.value.path})}):(0,l.jsx)(T.Input,{"aria-label":r("conditionValue"),className:"min-w-0 flex-1",onChange:e=>d(t,{value:eN(e.target.value)}),placeholder:r("conditionValuePlaceholder"),value:void 0===(i=e.value)?"":"string"==typeof i?eN(i)===i?i:JSON.stringify(i):JSON.stringify(i)??""}),(0,l.jsx)(eR,{mode:eP(e.value)?"session":"literal",onValueChange:e=>d(t,{value:"session"===e?{source:"SESSION",path:""}:""})})]})]})]},t)})}),(0,l.jsxs)(w.Button,{onClick:()=>c({...n,rows:[...n.rows,{path:"",operator:"EQ",value:""}]}),size:"sm",type:"button",variant:"outline",children:[(0,l.jsx)(u.Plus,{className:"size-3.5"})," ",r("addCondition")]}),(0,l.jsx)(I.FieldDescription,{className:"text-[10px]",children:n.rows.length?r("conditionHelp"):r("conditionEmpty")}),eB(t)&&(0,l.jsx)(eD,{})]})}function eZ(e){let{field:t,value:i,onChange:s}=e,a=(0,j.useTranslations)("workflows"),r=function(e){if(null==e)return[];if(!Array.isArray(e))return null;let l=[];for(let t of e){if(!t||"object"!=typeof t||Array.isArray(t)||Object.keys(t).filter(e=>"label"!==e&&"description"!==e).length>0||"string"!=typeof t.label||void 0!==t.description&&"string"!=typeof t.description)return null;l.push({label:t.label,description:t.description??""})}return l}(i);if(!r)return(0,l.jsxs)("div",{className:"space-y-1.5",children:[(0,l.jsx)(eQ,{...e}),(0,l.jsx)(I.FieldDescription,{className:"text-[10px]",children:a("choiceOptionsAdvanced")})]});let n=e=>s(function(e){if(0!==e.length)return e.map(({label:e,description:l})=>l?{label:e,description:l}:{label:e})}(e)),o=(e,l)=>n(r.map((t,i)=>i===e?{...t,...l}:t));return(0,l.jsxs)(I.Field,{children:[(0,l.jsx)(I.FieldLabel,{className:"text-xs",children:t.label}),(0,l.jsx)(I.FieldGroup,{className:"gap-1.5",children:r.map((e,t)=>(0,l.jsxs)("div",{className:"space-y-1.5 rounded-lg border p-2",children:[(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)(T.Input,{"aria-label":a("choiceOptionLabel"),className:"min-w-0 flex-1",onChange:e=>o(t,{label:e.target.value}),placeholder:a("choiceOptionLabel"),value:e.label}),(0,l.jsxs)(M.Tooltip,{children:[(0,l.jsx)(M.TooltipTrigger,{asChild:!0,children:(0,l.jsx)(w.Button,{"aria-label":a("removeRow"),className:"size-7 shrink-0",onClick:()=>n(r.filter((e,l)=>l!==t)),size:"icon",type:"button",variant:"ghost",children:(0,l.jsx)(f.Trash2,{className:"size-3.5"})})}),(0,l.jsx)(M.TooltipContent,{children:a("removeRow")})]})]}),(0,l.jsx)(T.Input,{"aria-label":a("choiceOptionDescription"),className:"text-xs",onChange:e=>o(t,{description:e.target.value}),placeholder:a("choiceOptionDescription"),value:e.description})]},t))}),(0,l.jsxs)(w.Button,{onClick:()=>n([...r,{label:"",description:""}]),size:"sm",type:"button",variant:"outline",children:[(0,l.jsx)(u.Plus,{className:"size-3.5"})," ",a("addChoiceOption")]}),(0,l.jsx)(I.FieldDescription,{className:"text-[10px]",children:r.length?a("choiceOptionsHelp"):a("choiceOptionsEmpty")}),eB(t)&&(0,l.jsx)(eD,{})]})}function e0(e){let{field:t,value:i,onChange:s}=e,a=(0,j.useTranslations)("workflows"),r=function(e){if(null==e)return[];if(!Array.isArray(e))return null;let l=[];for(let t of e){if(!t||"object"!=typeof t||Array.isArray(t)||Object.keys(t).filter(e=>"key"!==e&&"label"!==e&&"description"!==e).length>0||"string"!=typeof t.key||void 0!==t.label&&"string"!=typeof t.label||void 0!==t.description&&"string"!=typeof t.description)return null;l.push({key:t.key,label:t.label??"",description:t.description??""})}return l}(i);if(!r)return(0,l.jsxs)("div",{className:"space-y-1.5",children:[(0,l.jsx)(eQ,{...e}),(0,l.jsx)(I.FieldDescription,{className:"text-[10px]",children:a("triggerChoicesAdvanced")})]});let n=e=>s(function(e){if(0!==e.length)return e.map(({key:e,label:l,description:t})=>t?{key:e,label:l,description:t}:{key:e,label:l})}(e)),o=(e,l)=>n(r.map((t,i)=>i===e?{...t,...l}:t));return(0,l.jsxs)(I.Field,{children:[(0,l.jsx)(I.FieldLabel,{className:"text-xs",children:t.label}),(0,l.jsx)(I.FieldGroup,{className:"gap-1.5",children:r.map((e,t)=>(0,l.jsxs)("div",{className:"space-y-1.5 rounded-lg border p-2",children:[(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)(T.Input,{"aria-label":a("triggerChoiceLabel"),className:"min-w-0 flex-1",onChange:e=>{var l;let i;return l=e.target.value,i=r[t],void o(t,{label:l,...!i.key||i.key===eb(i.label)?{key:eb(l)}:{}})},placeholder:a("triggerChoiceLabel"),value:e.label}),(0,l.jsxs)(M.Tooltip,{children:[(0,l.jsx)(M.TooltipTrigger,{asChild:!0,children:(0,l.jsx)(w.Button,{"aria-label":a("removeRow"),className:"size-7 shrink-0",onClick:()=>n(r.filter((e,l)=>l!==t)),size:"icon",type:"button",variant:"ghost",children:(0,l.jsx)(f.Trash2,{className:"size-3.5"})})}),(0,l.jsx)(M.TooltipContent,{children:a("removeRow")})]})]}),(0,l.jsx)(T.Input,{"aria-label":a("triggerChoiceKey"),className:"font-mono text-xs",onChange:e=>o(t,{key:e.target.value}),placeholder:a("triggerChoiceKey"),value:e.key}),r.some((e,l)=>l!==t&&e.key===r[t].key)&&(0,l.jsx)(I.FieldError,{className:"text-[10px]",children:a("triggerChoiceKeyDuplicate")}),(0,l.jsx)(T.Input,{"aria-label":a("triggerChoiceDescription"),className:"text-xs",onChange:e=>o(t,{description:e.target.value}),placeholder:a("triggerChoiceDescription"),value:e.description})]},t))}),(0,l.jsxs)(w.Button,{onClick:()=>n([...r,{key:"",label:"",description:""}]),size:"sm",type:"button",variant:"outline",children:[(0,l.jsx)(u.Plus,{className:"size-3.5"})," ",a("addTriggerChoice")]}),(0,l.jsx)(I.FieldDescription,{className:"text-[10px]",children:r.length?a("triggerChoicesHelp"):a("triggerChoicesEmpty")})]})}let e1={provider:"provider",model:"model",effort:"effort"};function e2({field:e,config:t,onChange:i,sessionPaths:s}){let a=(0,j.useTranslations)("workflows"),r=e.modelKeys??e1,n=(0,v.useRef)(t);(0,v.useEffect)(()=>{n.current=t},[t]);let o=e=>{let l={...n.current};for(let[t,i]of Object.entries(e))void 0===i?delete l[t]:l[t]=i;n.current=l,i(l)},c=t[r.provider],d=t[r.model],u=t[r.effort],p=eP(c)||eP(d)||eP(u),h=function(e){let[l,t]=(0,v.useState)([]);return(0,v.useEffect)(()=>{let l=!1;return(0,B.controlPlaneRequest)(_,{worktreeId:e||null}).then(e=>{l||t(e.runProviderCatalog)}).catch(()=>{l||t([])}),()=>{l=!0}},[e]),l}(e$(t,r.scopeFrom)),x=[{key:r.provider,label:a("modelProvider"),value:c},{key:r.model,label:a("modelModel"),value:d},{key:r.effort,label:a("modelEffort"),value:u}],m=s.map(({path:e,description:l})=>({value:e,label:e,description:l}));return(0,l.jsxs)(I.Field,{children:[(0,l.jsxs)("div",{className:"flex items-end justify-between gap-2",children:[(0,l.jsx)(I.FieldLabel,{className:"text-xs",children:e.label}),(0,l.jsx)(eR,{mode:p?"session":"literal",onValueChange:e=>"session"===e?o({[r.provider]:{source:"SESSION",path:""},[r.model]:{source:"SESSION",path:""},[r.effort]:{source:"SESSION",path:""}}):o({[r.provider]:void 0,[r.model]:void 0,[r.effort]:void 0})})]}),p?(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(I.FieldGroup,{className:"gap-1.5",children:x.map(({key:e,label:t,value:i})=>(0,l.jsxs)(I.Field,{children:[(0,l.jsx)(I.FieldLabel,{className:"text-[10px] text-muted-foreground",children:t}),(0,l.jsx)(U.SearchableSelect,{allowCustomValue:!0,ariaLabel:t,emptyMessage:a("noOptions"),onValueChange:l=>o({[e]:{source:"SESSION",path:l}}),options:m,placeholder:a("sessionPathPlaceholder"),searchPlaceholder:a("searchPlaceholder"),value:eP(i)?i.path:""})]},e))}),(0,l.jsx)(I.FieldDescription,{className:"text-[10px]",children:a("sessionBindingHelp")})]}):(0,l.jsx)(H.ModelEffortPicker,{catalog:h,effort:eM(eL(u)),fullWidth:!0,model:eM(eL(d)),onEffortChange:e=>o({[r.effort]:e}),onModelChange:e=>o({[r.model]:e}),onProviderChange:e=>o({[r.provider]:e}),provider:eM(eL(c))}),e.help&&(0,l.jsx)(I.FieldDescription,{className:"text-[10px]",children:e.help})]})}function e5(e){switch(e.field.control){case"enum":return(0,l.jsx)(eV,{...e});case"text":return(0,l.jsx)(ez,{...e});case"number":return(0,l.jsx)(eG,{...e});case"boolean":return(0,l.jsx)(eU,{...e});case"resource":return(0,l.jsx)(eK,{...e});case"resourceMulti":return(0,l.jsx)(e_,{...e});case"stringList":return(0,l.jsx)(eX,{...e});case"record":return(0,l.jsx)(eJ,{...e});case"condition":return(0,l.jsx)(eY,{...e});case"choiceOptions":return(0,l.jsx)(eZ,{...e});case"triggerChoices":return(0,l.jsx)(e0,{...e});case"mcpPresetMulti":return(0,l.jsx)(eH,{...e});case"json":return(0,l.jsx)(eQ,{...e});default:return null}}function e3({config:e,onChange:t,defaultOpen:i,extraKeyCount:s}){let a=(0,j.useTranslations)("workflows"),[r,n]=(0,v.useState)(i),[o,c]=(0,v.useState)(()=>JSON.stringify(e,null,2)),[d,u]=(0,v.useState)(null),p=(0,v.useRef)(o);return(0,v.useEffect)(()=>{let l=JSON.stringify(e,null,2);l!==p.current&&(c(l),p.current=l,u(null))},[e]),(0,l.jsxs)(eg,{onOpenChange:n,open:r,children:[(0,l.jsx)(ej,{asChild:!0,children:(0,l.jsxs)(w.Button,{className:"w-full justify-between px-0 text-xs font-medium text-muted-foreground",type:"button",variant:"ghost",children:[(0,l.jsxs)("span",{children:[a("advancedJson"),s?` \xb7 ${a("extraKeys",{count:s})}`:""]}),(0,l.jsx)(G.ChevronDown,{className:`size-4 transition-transform ${r?"rotate-180":""}`})]})}),(0,l.jsxs)(ev,{className:"space-y-1.5 pt-1.5",children:[(0,l.jsx)(W.Textarea,{"aria-label":a("advancedJson"),"aria-invalid":!!d,className:"min-h-40 font-mono text-xs",onChange:e=>(e=>{c(e);try{let l=JSON.parse(e);if(!l||"object"!=typeof l||Array.isArray(l))throw Error(a("configMustBeObject"));p.current=JSON.stringify(l,null,2),u(null),t(l)}catch(e){u(e instanceof Error?e.message:String(e))}})(e.target.value),value:o}),d?(0,l.jsx)(I.FieldError,{className:"text-[10px]",children:d}):(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(I.FieldDescription,{className:"text-[10px]",children:a("advancedJsonHelp")}),(0,l.jsx)(eD,{})]})]})]})}function e6({kind:e,scope:t,config:i,onChange:s,sessionPaths:a}){let r=(0,j.useTranslations)("workflows"),n=(0,eI.getConfigDescriptor)(e,t);if(!n)return null;let o=new Set(n.fields.flatMap(e=>"model"===e.control&&e.modelKeys?[e.modelKeys.provider,e.modelKeys.model,e.modelKeys.effort]:[e.key])),c=Object.keys(i).filter(e=>!o.has(e));return(0,l.jsxs)(I.FieldGroup,{className:"gap-3",children:[(0,l.jsx)(I.FieldTitle,{className:"text-xs text-muted-foreground",children:r("configuration")}),n.fields.map(e=>e.visibleWhen&&i[e.visibleWhen.key]!==e.visibleWhen.equals?null:"model"===e.control?(0,l.jsx)(e2,{config:i,field:e,onChange:s,sessionPaths:a},e.key):(0,l.jsx)(e5,{config:i,field:e,onChange:l=>((e,l)=>{if(void 0===l){let l={...i};delete l[e],s(l);return}s({...i,[e]:l})})(e.key,l),sessionPaths:a,value:i[e.key]},e.key)),(0,l.jsx)(e3,{config:i,defaultOpen:!1,extraKeyCount:c.length,onChange:s})]})}var e7=e.i(895673),e8=e.i(349049),e4=e.i(399668),e9=e.i(619968),le=e.i(681735),ll=e.i(18718);let lt=`
48
+ }`,variables:{codebaseRepositoryId:l},map:e=>e.githubActionsWorkflowRuns?.items.map(e=>({value:e.id,label:e.displayTitle||e.id,description:e.headBranch??void 0}))??[]};default:return null}}(e,l),[e,l]),i=t?JSON.stringify({query:t.query,variables:t.variables}):null,[s,a]=(0,v.useState)({key:"",options:[],error:!1});return((0,v.useEffect)(()=>{if(!t||!i)return;let e=!1;return(0,B.controlPlaneRequest)(t.query,t.variables).then(l=>{e||a({key:i,options:t.map(l),error:!1})}).catch(()=>{e||a({key:i,options:[],error:!0})}),()=>{e=!0}},[t,i]),t&&i)?s.key!==i?{options:[],loading:!0,fallback:!1}:{options:s.options,loading:!1,fallback:s.error||0===s.options.length}:{options:[],loading:!1,fallback:!0}}var eF=e.i(159888);let eO=(0,n.default)("pen-line",[["path",{d:"M13 21h8",key:"1jsn5i"}],["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}]]);var eA=e.i(808562);function eL(e){return!!e&&"object"==typeof e&&!Array.isArray(e)&&"SESSION"===e.source}function eP(e){return e&&"object"==typeof e&&!Array.isArray(e)&&"LITERAL"===e.source?e.value:e}function eD(){let e=(0,j.useTranslations)("workflows");return(0,l.jsx)(I.FieldDescription,{className:"text-[10px]",children:e("interpolationHelp",{token:"{{path}}",example:"{{worktree.baseBranch}}"})})}function eR({mode:e,onValueChange:t}){let i=(0,j.useTranslations)("workflows");return(0,l.jsxs)(eA.ToggleGroup,{"aria-label":i("valueModeToggle"),onValueChange:e=>{("literal"===e||"session"===e)&&t(e)},size:"sm",spacing:0,type:"single",value:e,variant:"outline",children:[(0,l.jsxs)(M.Tooltip,{children:[(0,l.jsx)(M.TooltipTrigger,{asChild:!0,children:(0,l.jsx)(eA.ToggleGroupItem,{"aria-label":i("valueModeLiteral"),className:"size-7 px-0 aria-checked:bg-accent aria-checked:text-accent-foreground",value:"literal",children:(0,l.jsx)(eO,{className:"size-3.5"})})}),(0,l.jsx)(M.TooltipContent,{children:i("valueModeLiteral")})]}),(0,l.jsxs)(M.Tooltip,{children:[(0,l.jsx)(M.TooltipTrigger,{asChild:!0,children:(0,l.jsx)(eA.ToggleGroupItem,{"aria-label":i("valueModeSession"),className:"size-7 px-0 aria-checked:bg-accent aria-checked:text-accent-foreground",value:"session",children:(0,l.jsx)(eF.Braces,{className:"size-3.5"})})}),(0,l.jsx)(M.TooltipContent,{children:i("valueModeSession")})]})]})}function eW({label:e,help:t,allowCustomSessionPath:i=!0,clearLabel:s,defaultSessionPath:a,sessionEnabled:r,interpolationEnabled:n=!1,value:o,onChange:c,sessionPaths:d,children:u}){let p=(0,j.useTranslations)("workflows"),h=(0,v.useId)(),x=eL(o)?"session":"literal",m=d.map(({path:e,description:l})=>({value:e,label:e,description:l}));return(0,l.jsxs)(I.Field,{children:[(0,l.jsxs)("div",{className:"flex items-end justify-between gap-2",children:[(0,l.jsx)(I.FieldLabel,{className:"text-xs",htmlFor:h,children:e}),r&&(0,l.jsx)(eR,{mode:x,onValueChange:e=>c("session"===e?{source:"SESSION",path:d.find(({path:e})=>e===a)?.path??d[0]?.path??""}:"")})]}),"session"===x?(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(U.SearchableSelect,{allowCustomValue:i,ariaLabel:p("sessionBindingLabel"),clearLabel:s,emptyMessage:p("noOptions"),onValueChange:e=>c(e?{source:"SESSION",path:e}:void 0),options:m,placeholder:p("sessionPathPlaceholder"),searchPlaceholder:p("searchPlaceholder"),value:eL(o)?o.path:""}),(0,l.jsx)(I.FieldDescription,{className:"text-[10px]",children:p("sessionBindingHelp")})]}):(0,l.jsxs)(l.Fragment,{children:[u(eP(o),c,h),t&&(0,l.jsx)(I.FieldDescription,{className:"text-[10px]",children:t}),n&&(0,l.jsx)(eD,{})]})]})}function eM(e){return"string"==typeof e?e:""}function e$(e,l){if(!l)return null;let t=e[l];return"string"==typeof t&&t.length>0?t:null}function eq(e){return!!e.valueModes?.includes("session")}function eB(e){return!!e.valueModes?.includes("interpolation")}function eV({field:e,value:t,onChange:i}){let s=(0,j.useTranslations)("workflows"),a=(0,v.useId)(),r=e.options?.kind==="static"?e.options.options:[];return(0,l.jsxs)(I.Field,{children:[(0,l.jsx)(I.FieldLabel,{className:"text-xs",htmlFor:a,children:e.label}),(0,l.jsxs)(O.Select,{onValueChange:e=>i(e),value:eM(eP(t)),children:[(0,l.jsx)(O.SelectTrigger,{className:"w-full",id:a,children:(0,l.jsx)(O.SelectValue,{placeholder:s("selectPlaceholder")})}),(0,l.jsx)(O.SelectContent,{children:r.map(e=>(0,l.jsx)(O.SelectItem,{value:e.value,children:e.label??e.value},e.value))})]}),e.help&&(0,l.jsx)(I.FieldDescription,{className:"text-[10px]",children:e.help})]})}function ez({field:e,value:t,onChange:i,sessionPaths:s}){return(0,l.jsx)(eW,{help:e.help,interpolationEnabled:eB(e),label:e.label,onChange:i,sessionEnabled:eq(e),sessionPaths:s,value:t,children:(t,i,s)=>e.multiline?(0,l.jsx)(W.Textarea,{className:"min-h-20 text-sm",id:s,onChange:e=>i(e.target.value),placeholder:e.placeholder,value:eM(t)}):(0,l.jsx)(T.Input,{id:s,onChange:e=>i(e.target.value),placeholder:e.placeholder,value:eM(t)})})}function eG({field:e,value:t,onChange:i,sessionPaths:s}){return(0,l.jsx)(eW,{help:e.help,label:e.label,onChange:i,sessionEnabled:eq(e),sessionPaths:s,value:t,children:(t,i,s)=>(0,l.jsx)(T.Input,{id:s,max:e.maximum,min:e.minimum,onChange:e=>i(""===e.target.value?void 0:Number(e.target.value)),placeholder:e.placeholder,step:e.integer?1:void 0,type:"number",value:"number"==typeof t&&Number.isFinite(t)?String(t):""})})}function eU({field:e,value:t,onChange:i}){let s=(0,v.useId)();return(0,l.jsxs)(I.Field,{orientation:"horizontal",children:[(0,l.jsx)(C.Checkbox,{checked:!0===eP(t),id:s,onCheckedChange:e=>i(!0===e)}),(0,l.jsxs)(I.FieldContent,{children:[(0,l.jsx)(I.FieldLabel,{className:"text-xs",htmlFor:s,children:e.label}),e.help&&(0,l.jsx)(I.FieldDescription,{className:"text-[10px]",children:e.help})]})]})}function eH({field:e,value:t,onChange:i}){let s=Array.isArray(t)?t.map(String):[];return(0,l.jsxs)(I.Field,{children:[(0,l.jsx)(I.FieldLabel,{className:"text-xs",children:e.label}),(0,l.jsx)(K.McpPresetPicker,{kind:e.presetKind,onChange:i,selectedIds:s,showAvailability:null==e.presetKind}),e.help&&(0,l.jsx)(I.FieldDescription,{className:"text-[10px]",children:e.help})]})}function eK({field:e,config:t,value:i,onChange:s,sessionPaths:a}){let r=(0,j.useTranslations)("workflows"),n=e.options?.kind==="resource"?e.options:null,o=e$(t,n?.scopeFrom),{options:c,loading:d}=eE(n?.resource??"codebase",o),u=n?.sessionPath,p=e.required?void 0:r("notSet"),h=u?a.filter(({path:e})=>{let[l,t]=u.split(".");return e===u||e.startsWith(`${l}.`)&&e.endsWith(`.${t}`)}):a;return(0,l.jsx)(eW,{allowCustomSessionPath:!u,clearLabel:p,defaultSessionPath:u,help:e.help,interpolationEnabled:eB(e),label:e.label,onChange:s,sessionEnabled:eq(e),sessionPaths:h,value:i,children:(t,i)=>(0,l.jsx)(U.SearchableSelect,{allowCustomValue:!0,ariaLabel:e.label,clearLabel:p,disabled:d,emptyMessage:r("noOptions"),onValueChange:e=>i(e||void 0),options:c,placeholder:e.placeholder??r("selectPlaceholder"),searchPlaceholder:r("searchPlaceholder"),value:eM(t)})})}function e_({field:e,config:t,value:i,onChange:s}){let a=(0,j.useTranslations)("workflows"),r=e.options?.kind==="resource"?e.options:null,n=e$(t,r?.scopeFrom),{options:o,loading:c}=eE(r?.resource??"codebase",n),d=Array.isArray(i)?i.map(String):[],u=o.filter(e=>!d.includes(e.value));return(0,l.jsxs)(I.Field,{children:[(0,l.jsx)(I.FieldLabel,{className:"text-xs",children:e.label}),(0,l.jsx)(F.ItemGroup,{className:"gap-1.5",children:d.map(e=>(0,l.jsxs)(F.Item,{size:"xs",variant:"muted",children:[(0,l.jsx)(F.ItemContent,{className:"min-w-0",children:(0,l.jsx)(F.ItemTitle,{className:"block truncate text-xs",children:o.find(l=>l.value===e)?.label??e})}),(0,l.jsx)(F.ItemActions,{children:(0,l.jsxs)(M.Tooltip,{children:[(0,l.jsx)(M.TooltipTrigger,{asChild:!0,children:(0,l.jsx)(w.Button,{"aria-label":a("removeRow"),className:"size-7",onClick:()=>{s(d.filter(l=>l!==e))},size:"icon",type:"button",variant:"ghost",children:(0,l.jsx)(f.Trash2,{className:"size-3.5"})})}),(0,l.jsx)(M.TooltipContent,{children:a("removeRow")})]})})]},e))}),(0,l.jsx)(U.SearchableSelect,{allowCustomValue:!0,ariaLabel:e.label,disabled:c,emptyMessage:a("noOptions"),onValueChange:e=>{e&&!d.includes(e)&&s([...d,e])},options:u,placeholder:e.placeholder??a("addRow"),searchPlaceholder:a("searchPlaceholder"),value:""}),e.help&&(0,l.jsx)(I.FieldDescription,{className:"text-[10px]",children:e.help}),eB(e)&&(0,l.jsx)(eD,{})]})}function eX({field:e,value:t,onChange:i}){let s=(0,j.useTranslations)("workflows"),a=Array.isArray(t)?t.map(String):[];return(0,l.jsxs)(I.Field,{children:[(0,l.jsx)(I.FieldLabel,{className:"text-xs",children:e.label}),(0,l.jsx)(I.FieldGroup,{className:"gap-1.5",children:a.map((t,r)=>(0,l.jsxs)(E.InputGroup,{children:[(0,l.jsx)(E.InputGroupInput,{onChange:e=>{let l;return l=e.target.value,i(a.map((e,t)=>t===r?l:e))},placeholder:e.placeholder,value:t}),(0,l.jsx)(E.InputGroupAddon,{align:"inline-end",children:(0,l.jsxs)(M.Tooltip,{children:[(0,l.jsx)(M.TooltipTrigger,{asChild:!0,children:(0,l.jsx)(E.InputGroupButton,{"aria-label":s("removeRow"),onClick:()=>i(a.filter((e,l)=>l!==r)),size:"icon-xs",children:(0,l.jsx)(f.Trash2,{className:"size-3.5"})})}),(0,l.jsx)(M.TooltipContent,{children:s("removeRow")})]})})]},r))}),(0,l.jsxs)(w.Button,{onClick:()=>i([...a,""]),size:"sm",type:"button",variant:"outline",children:[(0,l.jsx)(u.Plus,{className:"size-3.5"})," ",s("addRow")]}),e.help&&(0,l.jsx)(I.FieldDescription,{className:"text-[10px]",children:e.help}),eB(e)&&(0,l.jsx)(eD,{})]})}function eJ({field:e,value:t,onChange:i}){let s=(0,j.useTranslations)("workflows"),a=t&&"object"==typeof t&&!Array.isArray(t)?Object.entries(t).map(([e,l])=>[e,l]):[],r=e=>{let l={};for(let[t,i]of e)t&&(l[t]=i);i(l)};return(0,l.jsxs)(I.Field,{children:[(0,l.jsx)(I.FieldLabel,{className:"text-xs",children:e.label}),(0,l.jsx)(I.FieldGroup,{className:"gap-1.5",children:a.map(([e,t],i)=>(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)(T.Input,{className:"w-2/5",onChange:e=>r(a.map((l,t)=>t===i?[e.target.value,l[1]]:l)),placeholder:s("recordKeyPlaceholder"),value:e}),(0,l.jsx)(T.Input,{className:"min-w-0 flex-1",onChange:e=>r(a.map((l,t)=>t===i?[l[0],e.target.value]:l)),placeholder:s("recordValuePlaceholder"),value:eM(t)}),(0,l.jsxs)(M.Tooltip,{children:[(0,l.jsx)(M.TooltipTrigger,{asChild:!0,children:(0,l.jsx)(w.Button,{"aria-label":s("removeRow"),className:"size-7 shrink-0",onClick:()=>r(a.filter((e,l)=>l!==i)),size:"icon",type:"button",variant:"ghost",children:(0,l.jsx)(f.Trash2,{className:"size-3.5"})})}),(0,l.jsx)(M.TooltipContent,{children:s("removeRow")})]})]},i))}),(0,l.jsxs)(w.Button,{onClick:()=>r([...a,["",""]]),size:"sm",type:"button",variant:"outline",children:[(0,l.jsx)(u.Plus,{className:"size-3.5"})," ",s("addRow")]}),e.help&&(0,l.jsx)(I.FieldDescription,{className:"text-[10px]",children:e.help}),eB(e)&&(0,l.jsx)(eD,{})]})}function eQ({field:e,value:t,onChange:i}){let s=(0,v.useId)(),[a,r]=(0,v.useState)(()=>void 0===t?"":JSON.stringify(t,null,2)),[n,o]=(0,v.useState)(null),c=(0,v.useRef)(a);return(0,v.useEffect)(()=>{let e=void 0===t?"":JSON.stringify(t,null,2);e!==c.current&&(r(e),c.current=e,o(null))},[t]),(0,l.jsxs)(I.Field,{"data-invalid":!!n,children:[(0,l.jsx)(I.FieldLabel,{className:"text-xs",htmlFor:s,children:e.label}),(0,l.jsx)(W.Textarea,{"aria-invalid":!!n,className:"min-h-24 font-mono text-xs",id:s,onChange:e=>(e=>{if(r(e),""===e.trim()){c.current="",o(null),i(void 0);return}try{let l=JSON.parse(e);c.current=JSON.stringify(l,null,2),o(null),i(l)}catch(e){o(e instanceof Error?e.message:String(e))}})(e.target.value),placeholder:e.placeholder,value:a}),n?(0,l.jsx)(I.FieldError,{className:"text-[10px]",children:n}):(0,l.jsxs)(l.Fragment,{children:[e.help&&(0,l.jsx)(I.FieldDescription,{className:"text-[10px]",children:e.help}),eB(e)&&(0,l.jsx)(eD,{})]})]})}function eY(e){let{field:t,value:i,onChange:s,sessionPaths:a}=e,r=(0,j.useTranslations)("workflows"),n=function(e){if(null==e)return ek;if("object"!=typeof e||Array.isArray(e))return null;if("ALL"===e.op||"ANY"===e.op){let l=e.conditions;if(!Array.isArray(l))return null;let t=[];for(let e of l){let l=eC(e);if(!l)return null;t.push(l)}return{mode:e.op,rows:t}}let l=eC(e);return l?{mode:"ALL",rows:[l]}:null}(i),o=a.map(({path:e,description:l})=>({value:e,label:e,description:l}));if(!n)return(0,l.jsxs)("div",{className:"space-y-1.5",children:[(0,l.jsx)(eQ,{...e}),(0,l.jsx)(I.FieldDescription,{className:"text-[10px]",children:r("conditionAdvanced")})]});let c=e=>s(function(e){if(0!==e.rows.length)return 1===e.rows.length?eS(e.rows[0]):{op:e.mode,conditions:e.rows.map(eS)}}(e)),d=(e,l)=>c({...n,rows:n.rows.map((t,i)=>i===e?{...t,...l}:t)});return(0,l.jsxs)(I.Field,{children:[(0,l.jsx)(I.FieldLabel,{className:"text-xs",children:t.label}),n.rows.length>1&&(0,l.jsxs)(O.Select,{onValueChange:e=>c({...n,mode:"ANY"===e?"ANY":"ALL"}),value:n.mode,children:[(0,l.jsx)(O.SelectTrigger,{"aria-label":r("conditionMatchMode"),className:"w-full",children:(0,l.jsx)(O.SelectValue,{})}),(0,l.jsxs)(O.SelectContent,{children:[(0,l.jsx)(O.SelectItem,{value:"ALL",children:r("conditionMatchAll")}),(0,l.jsx)(O.SelectItem,{value:"ANY",children:r("conditionMatchAny")})]})]}),(0,l.jsx)(I.FieldGroup,{className:"gap-1.5",children:n.rows.map((e,t)=>{var i;return(0,l.jsxs)("div",{className:"space-y-1.5 rounded-lg border p-2",children:[(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)("div",{className:"min-w-0 flex-1",children:(0,l.jsx)(U.SearchableSelect,{allowCustomValue:!0,ariaLabel:r("conditionField"),emptyMessage:r("noOptions"),onValueChange:e=>d(t,{path:e}),options:o,placeholder:r("sessionPathPlaceholder"),searchPlaceholder:r("searchPlaceholder"),value:e.path})}),(0,l.jsxs)(M.Tooltip,{children:[(0,l.jsx)(M.TooltipTrigger,{asChild:!0,children:(0,l.jsx)(w.Button,{"aria-label":r("removeRow"),className:"size-7 shrink-0",onClick:()=>c({...n,rows:n.rows.filter((e,l)=>l!==t)}),size:"icon",type:"button",variant:"ghost",children:(0,l.jsx)(f.Trash2,{className:"size-3.5"})})}),(0,l.jsx)(M.TooltipContent,{children:r("removeRow")})]})]}),(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsxs)(O.Select,{onValueChange:e=>d(t,{operator:e}),value:e.operator,children:[(0,l.jsx)(O.SelectTrigger,{"aria-label":r("conditionOperator"),className:"w-40 shrink-0",children:(0,l.jsx)(O.SelectValue,{})}),(0,l.jsx)(O.SelectContent,{children:ey.map(e=>(0,l.jsx)(O.SelectItem,{value:e.value,children:r(`conditionOperators.${e.value}`)},e.value))})]}),ew(e.operator)&&(0,l.jsxs)(l.Fragment,{children:[eL(e.value)?(0,l.jsx)("div",{className:"min-w-0 flex-1",children:(0,l.jsx)(U.SearchableSelect,{allowCustomValue:!0,ariaLabel:r("sessionBindingLabel"),emptyMessage:r("noOptions"),onValueChange:e=>d(t,{value:{source:"SESSION",path:e}}),options:o,placeholder:r("sessionPathPlaceholder"),searchPlaceholder:r("searchPlaceholder"),value:e.value.path})}):(0,l.jsx)(T.Input,{"aria-label":r("conditionValue"),className:"min-w-0 flex-1",onChange:e=>d(t,{value:eN(e.target.value)}),placeholder:r("conditionValuePlaceholder"),value:void 0===(i=e.value)?"":"string"==typeof i?eN(i)===i?i:JSON.stringify(i):JSON.stringify(i)??""}),(0,l.jsx)(eR,{mode:eL(e.value)?"session":"literal",onValueChange:e=>d(t,{value:"session"===e?{source:"SESSION",path:""}:""})})]})]})]},t)})}),(0,l.jsxs)(w.Button,{onClick:()=>c({...n,rows:[...n.rows,{path:"",operator:"EQ",value:""}]}),size:"sm",type:"button",variant:"outline",children:[(0,l.jsx)(u.Plus,{className:"size-3.5"})," ",r("addCondition")]}),(0,l.jsx)(I.FieldDescription,{className:"text-[10px]",children:n.rows.length?r("conditionHelp"):r("conditionEmpty")}),eB(t)&&(0,l.jsx)(eD,{})]})}function eZ(e){let{field:t,value:i,onChange:s}=e,a=(0,j.useTranslations)("workflows"),r=function(e){if(null==e)return[];if(!Array.isArray(e))return null;let l=[];for(let t of e){if(!t||"object"!=typeof t||Array.isArray(t)||Object.keys(t).filter(e=>"label"!==e&&"description"!==e).length>0||"string"!=typeof t.label||void 0!==t.description&&"string"!=typeof t.description)return null;l.push({label:t.label,description:t.description??""})}return l}(i);if(!r)return(0,l.jsxs)("div",{className:"space-y-1.5",children:[(0,l.jsx)(eQ,{...e}),(0,l.jsx)(I.FieldDescription,{className:"text-[10px]",children:a("choiceOptionsAdvanced")})]});let n=e=>s(function(e){if(0!==e.length)return e.map(({label:e,description:l})=>l?{label:e,description:l}:{label:e})}(e)),o=(e,l)=>n(r.map((t,i)=>i===e?{...t,...l}:t));return(0,l.jsxs)(I.Field,{children:[(0,l.jsx)(I.FieldLabel,{className:"text-xs",children:t.label}),(0,l.jsx)(I.FieldGroup,{className:"gap-1.5",children:r.map((e,t)=>(0,l.jsxs)("div",{className:"space-y-1.5 rounded-lg border p-2",children:[(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)(T.Input,{"aria-label":a("choiceOptionLabel"),className:"min-w-0 flex-1",onChange:e=>o(t,{label:e.target.value}),placeholder:a("choiceOptionLabel"),value:e.label}),(0,l.jsxs)(M.Tooltip,{children:[(0,l.jsx)(M.TooltipTrigger,{asChild:!0,children:(0,l.jsx)(w.Button,{"aria-label":a("removeRow"),className:"size-7 shrink-0",onClick:()=>n(r.filter((e,l)=>l!==t)),size:"icon",type:"button",variant:"ghost",children:(0,l.jsx)(f.Trash2,{className:"size-3.5"})})}),(0,l.jsx)(M.TooltipContent,{children:a("removeRow")})]})]}),(0,l.jsx)(T.Input,{"aria-label":a("choiceOptionDescription"),className:"text-xs",onChange:e=>o(t,{description:e.target.value}),placeholder:a("choiceOptionDescription"),value:e.description})]},t))}),(0,l.jsxs)(w.Button,{onClick:()=>n([...r,{label:"",description:""}]),size:"sm",type:"button",variant:"outline",children:[(0,l.jsx)(u.Plus,{className:"size-3.5"})," ",a("addChoiceOption")]}),(0,l.jsx)(I.FieldDescription,{className:"text-[10px]",children:r.length?a("choiceOptionsHelp"):a("choiceOptionsEmpty")}),eB(t)&&(0,l.jsx)(eD,{})]})}function e0(e){let{field:t,value:i,onChange:s}=e,a=(0,j.useTranslations)("workflows"),r=function(e){if(null==e)return[];if(!Array.isArray(e))return null;let l=[];for(let t of e){if(!t||"object"!=typeof t||Array.isArray(t)||Object.keys(t).filter(e=>"key"!==e&&"label"!==e&&"description"!==e).length>0||"string"!=typeof t.key||void 0!==t.label&&"string"!=typeof t.label||void 0!==t.description&&"string"!=typeof t.description)return null;l.push({key:t.key,label:t.label??"",description:t.description??""})}return l}(i);if(!r)return(0,l.jsxs)("div",{className:"space-y-1.5",children:[(0,l.jsx)(eQ,{...e}),(0,l.jsx)(I.FieldDescription,{className:"text-[10px]",children:a("triggerChoicesAdvanced")})]});let n=e=>s(function(e){if(0!==e.length)return e.map(({key:e,label:l,description:t})=>t?{key:e,label:l,description:t}:{key:e,label:l})}(e)),o=(e,l)=>n(r.map((t,i)=>i===e?{...t,...l}:t));return(0,l.jsxs)(I.Field,{children:[(0,l.jsx)(I.FieldLabel,{className:"text-xs",children:t.label}),(0,l.jsx)(I.FieldGroup,{className:"gap-1.5",children:r.map((e,t)=>(0,l.jsxs)("div",{className:"space-y-1.5 rounded-lg border p-2",children:[(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)(T.Input,{"aria-label":a("triggerChoiceLabel"),className:"min-w-0 flex-1",onChange:e=>{var l;let i;return l=e.target.value,i=r[t],void o(t,{label:l,...!i.key||i.key===eb(i.label)?{key:eb(l)}:{}})},placeholder:a("triggerChoiceLabel"),value:e.label}),(0,l.jsxs)(M.Tooltip,{children:[(0,l.jsx)(M.TooltipTrigger,{asChild:!0,children:(0,l.jsx)(w.Button,{"aria-label":a("removeRow"),className:"size-7 shrink-0",onClick:()=>n(r.filter((e,l)=>l!==t)),size:"icon",type:"button",variant:"ghost",children:(0,l.jsx)(f.Trash2,{className:"size-3.5"})})}),(0,l.jsx)(M.TooltipContent,{children:a("removeRow")})]})]}),(0,l.jsx)(T.Input,{"aria-label":a("triggerChoiceKey"),className:"font-mono text-xs",onChange:e=>o(t,{key:e.target.value}),placeholder:a("triggerChoiceKey"),value:e.key}),r.some((e,l)=>l!==t&&e.key===r[t].key)&&(0,l.jsx)(I.FieldError,{className:"text-[10px]",children:a("triggerChoiceKeyDuplicate")}),(0,l.jsx)(T.Input,{"aria-label":a("triggerChoiceDescription"),className:"text-xs",onChange:e=>o(t,{description:e.target.value}),placeholder:a("triggerChoiceDescription"),value:e.description})]},t))}),(0,l.jsxs)(w.Button,{onClick:()=>n([...r,{key:"",label:"",description:""}]),size:"sm",type:"button",variant:"outline",children:[(0,l.jsx)(u.Plus,{className:"size-3.5"})," ",a("addTriggerChoice")]}),(0,l.jsx)(I.FieldDescription,{className:"text-[10px]",children:r.length?a("triggerChoicesHelp"):a("triggerChoicesEmpty")})]})}let e1={provider:"provider",model:"model",effort:"effort"};function e2({field:e,config:t,onChange:i,sessionPaths:s}){let a=(0,j.useTranslations)("workflows"),r=e.modelKeys??e1,n=(0,v.useRef)(t);(0,v.useEffect)(()=>{n.current=t},[t]);let o=e=>{let l={...n.current};for(let[t,i]of Object.entries(e))void 0===i?delete l[t]:l[t]=i;n.current=l,i(l)},c=t[r.provider],d=t[r.model],u=t[r.effort],p=eL(c)||eL(d)||eL(u),h=function(e){let[l,t]=(0,v.useState)([]);return(0,v.useEffect)(()=>{let l=!1;return(0,B.controlPlaneRequest)(_,{worktreeId:e||null}).then(e=>{l||t(e.runProviderCatalog)}).catch(()=>{l||t([])}),()=>{l=!0}},[e]),l}(e$(t,r.scopeFrom)),x=[{key:r.provider,label:a("modelProvider"),value:c},{key:r.model,label:a("modelModel"),value:d},{key:r.effort,label:a("modelEffort"),value:u}],m=s.map(({path:e,description:l})=>({value:e,label:e,description:l}));return(0,l.jsxs)(I.Field,{children:[(0,l.jsxs)("div",{className:"flex items-end justify-between gap-2",children:[(0,l.jsx)(I.FieldLabel,{className:"text-xs",children:e.label}),(0,l.jsx)(eR,{mode:p?"session":"literal",onValueChange:e=>"session"===e?o({[r.provider]:{source:"SESSION",path:""},[r.model]:{source:"SESSION",path:""},[r.effort]:{source:"SESSION",path:""}}):o({[r.provider]:void 0,[r.model]:void 0,[r.effort]:void 0})})]}),p?(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(I.FieldGroup,{className:"gap-1.5",children:x.map(({key:e,label:t,value:i})=>(0,l.jsxs)(I.Field,{children:[(0,l.jsx)(I.FieldLabel,{className:"text-[10px] text-muted-foreground",children:t}),(0,l.jsx)(U.SearchableSelect,{allowCustomValue:!0,ariaLabel:t,emptyMessage:a("noOptions"),onValueChange:l=>o({[e]:{source:"SESSION",path:l}}),options:m,placeholder:a("sessionPathPlaceholder"),searchPlaceholder:a("searchPlaceholder"),value:eL(i)?i.path:""})]},e))}),(0,l.jsx)(I.FieldDescription,{className:"text-[10px]",children:a("sessionBindingHelp")})]}):(0,l.jsx)(H.ModelEffortPicker,{catalog:h,effort:eM(eP(u)),fullWidth:!0,model:eM(eP(d)),onEffortChange:e=>o({[r.effort]:e}),onModelChange:e=>o({[r.model]:e}),onProviderChange:e=>o({[r.provider]:e}),provider:eM(eP(c))}),e.help&&(0,l.jsx)(I.FieldDescription,{className:"text-[10px]",children:e.help})]})}function e5(e){switch(e.field.control){case"enum":return(0,l.jsx)(eV,{...e});case"text":return(0,l.jsx)(ez,{...e});case"number":return(0,l.jsx)(eG,{...e});case"boolean":return(0,l.jsx)(eU,{...e});case"resource":return(0,l.jsx)(eK,{...e});case"resourceMulti":return(0,l.jsx)(e_,{...e});case"stringList":return(0,l.jsx)(eX,{...e});case"record":return(0,l.jsx)(eJ,{...e});case"condition":return(0,l.jsx)(eY,{...e});case"choiceOptions":return(0,l.jsx)(eZ,{...e});case"triggerChoices":return(0,l.jsx)(e0,{...e});case"mcpPresetMulti":return(0,l.jsx)(eH,{...e});case"json":return(0,l.jsx)(eQ,{...e});default:return null}}function e3({config:e,onChange:t,defaultOpen:i,extraKeyCount:s}){let a=(0,j.useTranslations)("workflows"),[r,n]=(0,v.useState)(i),[o,c]=(0,v.useState)(()=>JSON.stringify(e,null,2)),[d,u]=(0,v.useState)(null),p=(0,v.useRef)(o);return(0,v.useEffect)(()=>{let l=JSON.stringify(e,null,2);l!==p.current&&(c(l),p.current=l,u(null))},[e]),(0,l.jsxs)(eg,{onOpenChange:n,open:r,children:[(0,l.jsx)(ej,{asChild:!0,children:(0,l.jsxs)(w.Button,{className:"w-full justify-between px-0 text-xs font-medium text-muted-foreground",type:"button",variant:"ghost",children:[(0,l.jsxs)("span",{children:[a("advancedJson"),s?` \xb7 ${a("extraKeys",{count:s})}`:""]}),(0,l.jsx)(G.ChevronDown,{className:`size-4 transition-transform ${r?"rotate-180":""}`})]})}),(0,l.jsxs)(ev,{className:"space-y-1.5 pt-1.5",children:[(0,l.jsx)(W.Textarea,{"aria-label":a("advancedJson"),"aria-invalid":!!d,className:"min-h-40 font-mono text-xs",onChange:e=>(e=>{c(e);try{let l=JSON.parse(e);if(!l||"object"!=typeof l||Array.isArray(l))throw Error(a("configMustBeObject"));p.current=JSON.stringify(l,null,2),u(null),t(l)}catch(e){u(e instanceof Error?e.message:String(e))}})(e.target.value),value:o}),d?(0,l.jsx)(I.FieldError,{className:"text-[10px]",children:d}):(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(I.FieldDescription,{className:"text-[10px]",children:a("advancedJsonHelp")}),(0,l.jsx)(eD,{})]})]})]})}function e6({kind:e,scope:t,config:i,onChange:s,sessionPaths:a}){let r=(0,j.useTranslations)("workflows"),n=(0,eI.getConfigDescriptor)(e,t);if(!n)return null;let o=new Set(n.fields.flatMap(e=>"model"===e.control&&e.modelKeys?[e.modelKeys.provider,e.modelKeys.model,e.modelKeys.effort]:[e.key])),c=Object.keys(i).filter(e=>!o.has(e));return(0,l.jsxs)(I.FieldGroup,{className:"gap-3",children:[(0,l.jsx)(I.FieldTitle,{className:"text-xs text-muted-foreground",children:r("configuration")}),n.fields.map(e=>e.visibleWhen&&i[e.visibleWhen.key]!==e.visibleWhen.equals?null:"model"===e.control?(0,l.jsx)(e2,{config:i,field:e,onChange:s,sessionPaths:a},e.key):(0,l.jsx)(e5,{config:i,field:e,onChange:l=>((e,l)=>{if(void 0===l){let l={...i};delete l[e],s(l);return}s({...i,[e]:l})})(e.key,l),sessionPaths:a,value:i[e.key]},e.key)),(0,l.jsx)(e3,{config:i,defaultOpen:!1,extraKeyCount:c.length,onChange:s})]})}var e7=e.i(895673),e8=e.i(349049),e4=e.i(399668),e9=e.i(619968),le=e.i(681735),ll=e.i(18718);let lt=`
49
49
  query WorkflowEditorCatalog($id: ID!) {
50
50
  workflowCatalog {
51
51
  schemaVersion globalConcurrency
@@ -57,16 +57,16 @@
57
57
  versionCount runCount createdAt updatedAt
58
58
  }
59
59
  }
60
- `;function li(e){return`${e}-${crypto.randomUUID()}`}function ls(e){let l=new Map;for(let t of e)l.set(t.category,[...l.get(t.category)??[],t]);return l}function la({children:e,details:t}){return(0,l.jsxs)(M.Tooltip,{children:[(0,l.jsx)(M.TooltipTrigger,{asChild:!0,children:(0,l.jsx)(F.Item,{asChild:!0,className:"gap-1.5 px-1.5 py-1",size:"xs",variant:"outline",children:e})}),(0,l.jsx)(M.TooltipContent,{className:"max-w-80 text-xs leading-relaxed",side:"right",children:t})]})}function lr(){let e=(0,j.useTranslations)("workflows"),i=(0,t.useStoreApi)(),s=(0,t.useStore)(e=>e.nodesDraggable||e.nodesConnectable||e.elementsSelectable),a=e(s?"lockSteps":"unlockSteps"),r="fill-none!";return(0,l.jsx)(t.ControlButton,{"aria-label":a,onClick:()=>i.setState({elementsSelectable:!s,nodesConnectable:!s,nodesDraggable:!s}),title:a,children:s?(0,l.jsx)(d,{className:r}):(0,l.jsx)(c.MousePointer2,{className:r})})}function ln({onToggle:e,shown:i}){let s=(0,j.useTranslations)("workflows")(i?"hideSessionData":"showSessionData"),n="fill-none!";return(0,l.jsx)(t.ControlButton,{"aria-label":s,onClick:e,title:s,children:i?(0,l.jsx)(r.EyeOff,{className:n}):(0,l.jsx)(a.Eye,{className:n})})}function lo({workflowId:e}){let n=(0,j.useTranslations)("workflows"),c=(0,e4.useWorkflowLabels)(),d=(0,$.useRouter)(),M=(0,v.useRef)(null),G=(0,v.useRef)(null),[U,H]=(0,v.useState)(null),[K,_]=(0,v.useState)(()=>(0,e9.emptyDefinition)()),[X,J]=(0,v.useState)(null),[Q,Y,Z]=(0,t.useNodesState)([]),[ee,el,et]=(0,t.useEdgesState)([]),[ei,es]=(0,v.useState)(null),[ea,er]=(0,v.useState)(null),[en,eo]=(0,v.useState)(null),[ec,ed]=(0,v.useState)(!1),[eu,ep]=(0,v.useState)("palette"),[eh,ex]=(0,v.useState)(""),[em,ef]=(0,v.useState)(!0),[eg,ej]=(0,v.useState)(!1),[ev,eb]=(0,v.useState)(null),[ey,ew]=(0,v.useState)(null),[ek,eC]=(0,v.useState)([]),[eS,eN]=(0,v.useState)("QUEUE"),[eT,eE]=(0,v.useState)("WORKTREE"),[eF,eO]=(0,v.useState)(1),[eA,eP]=(0,v.useState)(!0),[eL,eD]=(0,v.useState)("NON_EXCLUSIVE"),[eR,eW]=(0,v.useState)(!1),[eM,e$]=(0,v.useState)(!1),[eq,eB]=(0,v.useState)(!1),[eV,ez]=(0,v.useState)(!1),[eG,eU]=(0,v.useState)(null),eH=(0,v.useMemo)(()=>new Map(X?.steps.map(({kind:e,category:l})=>[e,l])??[]),[X]),eK=(0,v.useMemo)(()=>(0,V.computeWorkflowPathAvailability)(K,(0,le.buildPathLookup)(X)),[X,K]),e_=(0,v.useCallback)((e,l=ek)=>{let t=(0,e8.workflowFlowElements)(e,{diagnostics:l,categories:eH,provides:(0,le.providesByNodeMap)((0,V.computeWorkflowPathAvailability)(e,(0,le.buildPathLookup)(X)))});Y(t.nodes),el(t.edges)},[X,eH,ek,el,Y]);(0,v.useEffect)(()=>{let l=!1;return(0,B.controlPlaneRequest)(lt,{id:e??"__new__"}).then(e=>{if(l)return;let t=e.workflow?.draftDefinition??(0,e9.emptyDefinition)();J(e.workflowCatalog),H(e.workflow),_(t),eN(e.workflow?.overlapPolicy??"QUEUE"),eE(e.workflow?.overlapScope??"WORKTREE"),eO(e.workflow?.maxConcurrentRuns??1),eP(e.workflow?.completionNotificationsEnabled??!0),eD(e.workflow?.worktreeConcurrency??"NON_EXCLUSIVE"),eW(e.workflow?.blocksGitOperations??!1);let i=new Map(e.workflowCatalog.steps.map(({kind:e,category:l})=>[e,l])),s=(0,e8.workflowFlowElements)(t,{categories:i,provides:(0,le.providesByNodeMap)((0,V.computeWorkflowPathAvailability)(t,(0,le.buildPathLookup)(e.workflowCatalog)))});Y(s.nodes),el(s.edges)}).catch(e=>eb(e instanceof Error?e.message:String(e))).finally(()=>ef(!1)),()=>{l=!0}},[el,Y,e]);let eX=K.nodes.find(({id:e})=>e===ea)??null,eJ=K.triggers.find(({id:e})=>e===ea)??null,eQ=eX??eJ,eY=(0,v.useMemo)(()=>eX?X?.steps.find(({kind:e})=>e===eX.kind):eJ?X?.triggers.find(({kind:e})=>e===eJ.kind):void 0,[X,eX,eJ]),eZ=(0,v.useMemo)(()=>{let e=new Set,l=new Map(X?.triggers.map(e=>[e.kind,e])??[]);for(let t of K.triggers){for(let i of l.get(t.kind)?.seedPaths??[])e.add(i);for(let l of(0,V.resourceManualSeedPaths)(t.kind,t.config))e.add(l)}for(let l of eK.provides.values())for(let t of l)e.add(t);return[...e]},[eK,X,K]),e0=(0,v.useMemo)(()=>{let e=eX?eK.availableBefore.get(eX.id):void 0;return(0,z.expandSessionPaths)(e??eZ)},[eK,eZ,eX]),e1=(0,v.useMemo)(()=>{if(eX)return(0,le.displayProvidedPaths)(eX.id,eK.provides);if(eJ){let e=[...X?.triggers.find(e=>e.kind===eJ.kind)?.seedPaths??[],...(0,V.resourceManualSeedPaths)(eJ.kind,eJ.config)];return(0,z.expandSessionPaths)(e)}return[]},[eK,X,eX,eJ]),e2=(0,v.useCallback)(e=>{_(e),e_(e)},[e_]),e5=(0,v.useCallback)((e,l)=>{var t;let i=32*K.nodes.length,s=(t=l??{x:320+i,y:120+i},{id:li("node"),kind:e.kind,name:e.label,position:t,config:{},requiredPaths:[],providedPaths:[],retry:{maxAttempts:1,strategy:"EXPONENTIAL",delaySeconds:5},failurePolicy:"FAIL"});e2({...K,nodes:[...K.nodes,s]}),er(s.id)},[e2,K]),lc=(0,v.useCallback)(e=>{let l={id:li("trigger"),kind:e.kind,name:e.label,position:{x:0,y:100+140*K.triggers.length},config:{}};e2({...K,triggers:[...K.triggers,l]}),er(l.id)},[e2,K]),ld=(0,v.useCallback)(e=>{let l=new Set(e);e2({...K,nodes:K.nodes.filter(({id:e})=>!l.has(e)),triggers:K.triggers.filter(({id:e})=>!l.has(e)),edges:K.edges.filter(({source:e,target:t})=>!l.has(e)&&!l.has(t))}),ea&&l.has(ea)&&er(null)},[e2,K,ea]),lu=(0,v.useCallback)(e=>{let l=K.nodes.find(l=>l.id===e);if(!l)return;let t={...structuredClone(l),id:li("node"),name:`${l.name??l.kind} copy`,position:{x:l.position.x+36,y:l.position.y+36}};e2({...K,nodes:[...K.nodes,t]}),er(t.id)},[e2,K]),lp=(0,v.useCallback)(()=>lu(ea),[lu,ea]),lh=(0,v.useCallback)(()=>{lu(ei?.getNodes().find(({selected:e})=>e)?.id??null??ea)},[lu,ei,ea]),lx=(0,v.useMemo)(()=>({onDelete:e=>ld([e]),onDuplicate:e=>lu(e),onEdit:e=>{eo(null),er(e)}}),[lu,ld]);(0,v.useEffect)(()=>{let e=e=>{if((e.metaKey||e.ctrlKey)&&"d"===e.key.toLowerCase()){let l=e.target;l?.matches("input, textarea, [contenteditable=true]")||(e.preventDefault(),lh())}};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[lh]);let lm=(0,v.useCallback)(e=>{if(!e.source||!e.target)return;let l={id:li("edge"),source:e.source,target:e.target,sourceHandle:e.sourceHandle??"success",targetHandle:e.targetHandle??"input"};el(e=>(0,t.addEdge)(l,e)),_(e=>({...e,edges:[...e.edges,l]}))},[el]),lf=(0,v.useCallback)(e=>{et(e);let l=new Set(e.flatMap(e=>"remove"===e.type?[e.id]:[]));0!==l.size&&(_(e=>({...e,edges:e.edges.filter(({id:e})=>!l.has(e))})),eo(e=>e&&l.has(e)?null:e))},[et]),lg=(0,v.useCallback)(e=>{let l=new Set(e);el(e=>e.filter(({id:e})=>!l.has(e))),_(e=>({...e,edges:e.edges.filter(({id:e})=>!l.has(e))})),eo(e=>e&&l.has(e)?null:e)},[el]),lj=async()=>{ej(!0),eb(null),ew(null);try{if(U){let e=await (0,B.controlPlaneRequest)(`mutation SaveWorkflow($input: SaveWorkflowDraftInput!) {
60
+ `;function li(e){return`${e}-${crypto.randomUUID()}`}function ls(e){let l=new Map;for(let t of e)l.set(t.category,[...l.get(t.category)??[],t]);return l}function la({children:e,details:t}){return(0,l.jsxs)(M.Tooltip,{children:[(0,l.jsx)(M.TooltipTrigger,{asChild:!0,children:(0,l.jsx)(F.Item,{asChild:!0,className:"gap-1.5 px-1.5 py-1",size:"xs",variant:"outline",children:e})}),(0,l.jsx)(M.TooltipContent,{className:"max-w-80 text-xs leading-relaxed",side:"right",children:t})]})}function lr(){let e=(0,j.useTranslations)("workflows"),i=(0,t.useStoreApi)(),s=(0,t.useStore)(e=>e.nodesDraggable||e.nodesConnectable||e.elementsSelectable),a=e(s?"lockSteps":"unlockSteps"),r="fill-none!";return(0,l.jsx)(t.ControlButton,{"aria-label":a,onClick:()=>i.setState({elementsSelectable:!s,nodesConnectable:!s,nodesDraggable:!s}),title:a,children:s?(0,l.jsx)(d,{className:r}):(0,l.jsx)(c.MousePointer2,{className:r})})}function ln({onToggle:e,shown:i}){let s=(0,j.useTranslations)("workflows")(i?"hideSessionData":"showSessionData"),n="fill-none!";return(0,l.jsx)(t.ControlButton,{"aria-label":s,onClick:e,title:s,children:i?(0,l.jsx)(r.EyeOff,{className:n}):(0,l.jsx)(a.Eye,{className:n})})}function lo({workflowId:e}){let n=(0,j.useTranslations)("workflows"),c=(0,e4.useWorkflowLabels)(),d=(0,$.useRouter)(),M=(0,v.useRef)(null),G=(0,v.useRef)(null),[U,H]=(0,v.useState)(null),[K,_]=(0,v.useState)(()=>(0,e9.emptyDefinition)()),[X,J]=(0,v.useState)(null),[Q,Y,Z]=(0,t.useNodesState)([]),[ee,el,et]=(0,t.useEdgesState)([]),[ei,es]=(0,v.useState)(null),[ea,er]=(0,v.useState)(null),[en,eo]=(0,v.useState)(null),[ec,ed]=(0,v.useState)(!1),[eu,ep]=(0,v.useState)("palette"),[eh,ex]=(0,v.useState)(""),[em,ef]=(0,v.useState)(!0),[eg,ej]=(0,v.useState)(!1),[ev,eb]=(0,v.useState)(null),[ey,ew]=(0,v.useState)(null),[ek,eC]=(0,v.useState)([]),[eS,eN]=(0,v.useState)("QUEUE"),[eT,eE]=(0,v.useState)("WORKTREE"),[eF,eO]=(0,v.useState)(1),[eA,eL]=(0,v.useState)(!0),[eP,eD]=(0,v.useState)("NON_EXCLUSIVE"),[eR,eW]=(0,v.useState)(!1),[eM,e$]=(0,v.useState)(!1),[eq,eB]=(0,v.useState)(!1),[eV,ez]=(0,v.useState)(!1),[eG,eU]=(0,v.useState)(null),eH=(0,v.useMemo)(()=>new Map(X?.steps.map(({kind:e,category:l})=>[e,l])??[]),[X]),eK=(0,v.useMemo)(()=>(0,V.computeWorkflowPathAvailability)(K,(0,le.buildPathLookup)(X)),[X,K]),e_=(0,v.useCallback)((e,l=ek)=>{let t=(0,e8.workflowFlowElements)(e,{diagnostics:l,categories:eH,provides:(0,le.providesByNodeMap)((0,V.computeWorkflowPathAvailability)(e,(0,le.buildPathLookup)(X)))});Y(t.nodes),el(t.edges)},[X,eH,ek,el,Y]);(0,v.useEffect)(()=>{let l=!1;return(0,B.controlPlaneRequest)(lt,{id:e??"__new__"}).then(e=>{if(l)return;let t=e.workflow?.draftDefinition??(0,e9.emptyDefinition)();J(e.workflowCatalog),H(e.workflow),_(t),eN(e.workflow?.overlapPolicy??"QUEUE"),eE(e.workflow?.overlapScope??"WORKTREE"),eO(e.workflow?.maxConcurrentRuns??1),eL(e.workflow?.completionNotificationsEnabled??!0),eD(e.workflow?.worktreeConcurrency??"NON_EXCLUSIVE"),eW(e.workflow?.blocksGitOperations??!1);let i=new Map(e.workflowCatalog.steps.map(({kind:e,category:l})=>[e,l])),s=(0,e8.workflowFlowElements)(t,{categories:i,provides:(0,le.providesByNodeMap)((0,V.computeWorkflowPathAvailability)(t,(0,le.buildPathLookup)(e.workflowCatalog)))});Y(s.nodes),el(s.edges)}).catch(e=>eb(e instanceof Error?e.message:String(e))).finally(()=>ef(!1)),()=>{l=!0}},[el,Y,e]);let eX=K.nodes.find(({id:e})=>e===ea)??null,eJ=K.triggers.find(({id:e})=>e===ea)??null,eQ=eX??eJ,eY=(0,v.useMemo)(()=>eX?X?.steps.find(({kind:e})=>e===eX.kind):eJ?X?.triggers.find(({kind:e})=>e===eJ.kind):void 0,[X,eX,eJ]),eZ=(0,v.useMemo)(()=>{let e=new Set,l=new Map(X?.triggers.map(e=>[e.kind,e])??[]);for(let t of K.triggers){for(let i of l.get(t.kind)?.seedPaths??[])e.add(i);for(let l of(0,V.resourceManualSeedPaths)(t.kind,t.config))e.add(l)}for(let l of eK.provides.values())for(let t of l)e.add(t);return[...e]},[eK,X,K]),e0=(0,v.useMemo)(()=>{let e=eX?eK.availableBefore.get(eX.id):void 0;return(0,z.expandSessionPaths)(e??eZ)},[eK,eZ,eX]),e1=(0,v.useMemo)(()=>{if(eX)return(0,le.displayProvidedPaths)(eX.id,eK.provides);if(eJ){let e=[...X?.triggers.find(e=>e.kind===eJ.kind)?.seedPaths??[],...(0,V.resourceManualSeedPaths)(eJ.kind,eJ.config)];return(0,z.expandSessionPaths)(e)}return[]},[eK,X,eX,eJ]),e2=(0,v.useCallback)(e=>{_(e),e_(e)},[e_]),e5=(0,v.useCallback)((e,l)=>{var t;let i=32*K.nodes.length,s=(t=l??{x:320+i,y:120+i},{id:li("node"),kind:e.kind,name:e.label,position:t,config:{},requiredPaths:[],providedPaths:[],retry:{maxAttempts:1,strategy:"EXPONENTIAL",delaySeconds:5},failurePolicy:"FAIL"});e2({...K,nodes:[...K.nodes,s]}),er(s.id)},[e2,K]),lc=(0,v.useCallback)(e=>{let l={id:li("trigger"),kind:e.kind,name:e.label,position:{x:0,y:100+140*K.triggers.length},config:{}};e2({...K,triggers:[...K.triggers,l]}),er(l.id)},[e2,K]),ld=(0,v.useCallback)(e=>{let l=new Set(e);e2({...K,nodes:K.nodes.filter(({id:e})=>!l.has(e)),triggers:K.triggers.filter(({id:e})=>!l.has(e)),edges:K.edges.filter(({source:e,target:t})=>!l.has(e)&&!l.has(t))}),ea&&l.has(ea)&&er(null)},[e2,K,ea]),lu=(0,v.useCallback)(e=>{let l=K.nodes.find(l=>l.id===e);if(!l)return;let t={...structuredClone(l),id:li("node"),name:`${l.name??l.kind} copy`,position:{x:l.position.x+36,y:l.position.y+36}};e2({...K,nodes:[...K.nodes,t]}),er(t.id)},[e2,K]),lp=(0,v.useCallback)(()=>lu(ea),[lu,ea]),lh=(0,v.useCallback)(()=>{lu(ei?.getNodes().find(({selected:e})=>e)?.id??null??ea)},[lu,ei,ea]),lx=(0,v.useMemo)(()=>({onDelete:e=>ld([e]),onDuplicate:e=>lu(e),onEdit:e=>{eo(null),er(e)}}),[lu,ld]);(0,v.useEffect)(()=>{let e=e=>{if((e.metaKey||e.ctrlKey)&&"d"===e.key.toLowerCase()){let l=e.target;l?.matches("input, textarea, [contenteditable=true]")||(e.preventDefault(),lh())}};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[lh]);let lm=(0,v.useCallback)(e=>{if(!e.source||!e.target)return;let l={id:li("edge"),source:e.source,target:e.target,sourceHandle:e.sourceHandle??"success",targetHandle:e.targetHandle??"input"};el(e=>(0,t.addEdge)(l,e)),_(e=>({...e,edges:[...e.edges,l]}))},[el]),lf=(0,v.useCallback)(e=>{et(e);let l=new Set(e.flatMap(e=>"remove"===e.type?[e.id]:[]));0!==l.size&&(_(e=>({...e,edges:e.edges.filter(({id:e})=>!l.has(e))})),eo(e=>e&&l.has(e)?null:e))},[et]),lg=(0,v.useCallback)(e=>{let l=new Set(e);el(e=>e.filter(({id:e})=>!l.has(e))),_(e=>({...e,edges:e.edges.filter(({id:e})=>!l.has(e))})),eo(e=>e&&l.has(e)?null:e)},[el]),lj=async()=>{ej(!0),eb(null),ew(null);try{if(U){let e=await (0,B.controlPlaneRequest)(`mutation SaveWorkflow($input: SaveWorkflowDraftInput!) {
61
61
  saveWorkflowDraft(input: $input) {
62
62
  id name description draftDefinition activeVersionId enabled overlapPolicy overlapScope maxConcurrentRuns completionNotificationsEnabled exclusiveWorktree worktreeConcurrency blocksGitOperations archivedAt
63
63
  versionCount runCount createdAt updatedAt
64
64
  }
65
- }`,{input:{id:U.id,definition:K,overlapPolicy:eS,overlapScope:eT,maxConcurrentRuns:eF,completionNotificationsEnabled:eA,worktreeConcurrency:eL,blocksGitOperations:eR}});H(e.saveWorkflowDraft),_(e.saveWorkflowDraft.draftDefinition),ew(n("saved"))}else{let e=await (0,B.controlPlaneRequest)(`mutation CreateWorkflow($input: CreateWorkflowInput!) {
65
+ }`,{input:{id:U.id,definition:K,overlapPolicy:eS,overlapScope:eT,maxConcurrentRuns:eF,completionNotificationsEnabled:eA,worktreeConcurrency:eP,blocksGitOperations:eR}});H(e.saveWorkflowDraft),_(e.saveWorkflowDraft.draftDefinition),ew(n("saved"))}else{let e=await (0,B.controlPlaneRequest)(`mutation CreateWorkflow($input: CreateWorkflowInput!) {
66
66
  createWorkflow(input: $input) {
67
67
  id name description draftDefinition activeVersionId enabled overlapPolicy overlapScope maxConcurrentRuns completionNotificationsEnabled exclusiveWorktree worktreeConcurrency blocksGitOperations archivedAt
68
68
  versionCount runCount createdAt updatedAt
69
69
  }
70
- }`,{input:{name:K.name,description:K.description,definition:K,overlapPolicy:eS,overlapScope:eT,maxConcurrentRuns:eF,completionNotificationsEnabled:eA,worktreeConcurrency:eL,blocksGitOperations:eR}});H(e.createWorkflow),_(e.createWorkflow.draftDefinition),ew(n("saved")),d.replace(`/workflows/${e.createWorkflow.id}/edit`)}return!0}catch(e){return eb(e instanceof Error?e.message:String(e)),!1}finally{ej(!1)}},lv=async()=>{if(!U)return void await lj();try{let e=await (0,B.controlPlaneRequest)(`query ValidateWorkflow($id: ID!) {
70
+ }`,{input:{name:K.name,description:K.description,definition:K,overlapPolicy:eS,overlapScope:eT,maxConcurrentRuns:eF,completionNotificationsEnabled:eA,worktreeConcurrency:eP,blocksGitOperations:eR}});H(e.createWorkflow),_(e.createWorkflow.draftDefinition),ew(n("saved")),d.replace(`/workflows/${e.createWorkflow.id}/edit`)}return!0}catch(e){return eb(e instanceof Error?e.message:String(e)),!1}finally{ej(!1)}},lv=async()=>{if(!U)return void await lj();try{let e=await (0,B.controlPlaneRequest)(`query ValidateWorkflow($id: ID!) {
71
71
  validateWorkflowDraft(id: $id) { valid diagnostics { severity code message nodeId triggerId path } }
72
- }`,{id:U.id});eC(e.validateWorkflowDraft.diagnostics),e_(K,e.validateWorkflowDraft.diagnostics),ew(e.validateWorkflowDraft.valid?n("validationPassed"):n("validationFailed"))}catch(e){eb(e instanceof Error?e.message:String(e))}},lb=async()=>{if(!U)return void eb(n("saveBeforePublish"));ej(!0);try{if(!await lj())return;await (0,B.controlPlaneRequest)("mutation PublishWorkflow($id: ID!) { publishWorkflow(id: $id) { id version contentHash } }",{id:U.id}),ew(n("published")),d.push(`/workflows/${U.id}`)}catch(e){eb(e instanceof Error?e.message:String(e))}finally{ej(!1)}},ly=async()=>{try{let e=await (0,B.controlPlaneRequest)("mutation DuplicateWorkflow($input: CreateWorkflowInput!) { createWorkflow(input: $input) { id } }",{input:{name:`${K.name} copy`,description:K.description,definition:{...K,name:`${K.name} copy`},overlapPolicy:eS,overlapScope:eT,maxConcurrentRuns:eF,completionNotificationsEnabled:eA,worktreeConcurrency:eL,blocksGitOperations:eR}});d.push(`/workflows/${e.createWorkflow.id}/edit`)}catch(e){eb(e instanceof Error?e.message:String(e))}},lw=async()=>{try{let e=U?(await (0,B.controlPlaneRequest)("query ExportWorkflow($id: ID!) { exportWorkflow(id: $id) }",{id:U.id})).exportWorkflow:{format:"aide.workflow.export",schemaVersion:1,workflow:{name:K.name,description:K.description,overlapPolicy:eS,overlapScope:eT,maxConcurrentRuns:eF,completionNotificationsEnabled:eA,worktreeConcurrency:eL,blocksGitOperations:eR,definition:K}};(0,q.downloadJson)(e,`${(0,q.exportFileStem)(K.name)}.workflow.json`)}catch(e){eb(e instanceof Error?e.message:String(e))}},lk=async e=>{try{let l=JSON.parse(await e.text()),t="aide.workflow.export"===l.format&&l.workflow&&"object"==typeof l.workflow?l.workflow.definition:l;if(!t||"object"!=typeof t)throw Error(n("invalidImport"));ez(!1),eU(null),_(t),e_(t),ew(n("importLoaded"))}catch(e){eb(e instanceof Error?e.message:String(e))}},lC=e=>{e2({...K,nodes:K.nodes.map(l=>l.id===ea?{...l,...e}:l),triggers:K.triggers.map(l=>l.id===ea?{...l,...e}:l)})},lS=(0,v.useMemo)(()=>X?.steps.filter(e=>`${e.label} ${e.kind} ${e.category} ${e.description}`.toLowerCase().includes(eh.toLowerCase()))??[],[X,eh]),lN=(0,v.useMemo)(()=>X?.triggers.filter(e=>`${e.label} ${e.kind} ${e.category} ${e.description}`.toLowerCase().includes(eh.toLowerCase()))??[],[X,eh]),lI=(0,v.useMemo)(()=>`${K.triggers.map(({id:e})=>e).join()}|${K.nodes.map(({id:e})=>e).join()}|${K.edges.map(({id:e})=>e).join()}|${K.editor.handleLayout??"SIDES"}|${eq}`,[K,eq]),lT=(0,v.useMemo)(()=>eq?Q:Q.map(e=>e.data.provides.length?{...e,data:{...e.data,provides:[]}}:e),[Q,eq]),lE=(0,v.useMemo)(()=>[...ls(lS)],[lS]),lF=(0,v.useMemo)(()=>[...ls(lN)],[lN]),lO=K.editor.displayLayout??"REGULAR";return em?(0,l.jsxs)("div",{className:"space-y-4",children:[(0,l.jsxs)("div",{className:"space-y-2",children:[(0,l.jsx)(A.Skeleton,{className:"h-8 w-52"}),(0,l.jsx)(A.Skeleton,{className:"h-4 w-96"})]}),(0,l.jsxs)("div",{className:"grid gap-4 xl:grid-cols-[280px_minmax(0,1fr)]",children:[(0,l.jsx)(A.Skeleton,{className:"h-[min(78vh,860px)] min-h-[520px]"}),(0,l.jsx)(A.Skeleton,{className:"h-[min(78vh,860px)] min-h-[520px]"})]})]}):X?(0,l.jsxs)("div",{className:"space-y-4",children:[(0,l.jsxs)("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[(0,l.jsx)("div",{className:"flex min-w-0 items-start gap-2",children:(0,l.jsxs)("div",{children:[(0,l.jsx)("h1",{className:"text-2xl font-semibold tracking-tight",children:n("editor")}),(0,l.jsx)("p",{className:"text-sm text-muted-foreground",children:n("editorDescription")})]})}),(0,l.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,l.jsx)("input",{accept:"application/json,.json",className:"hidden",onChange:e=>{let l=e.target.files?.[0];l&&lk(l),e.target.value=""},ref:G,type:"file"}),(0,l.jsxs)(w.Button,{onClick:()=>ed(!0),variant:"outline",children:[(0,l.jsx)(m.Settings,{})," ",n("settings")]}),"BASIC"===lO&&(0,l.jsxs)(w.Button,{"aria-pressed":eV,onClick:()=>{ez(e=>!e),er(null),eo(null),eU(null)},variant:eV?"secondary":"outline",children:[eV?(0,l.jsx)(r.EyeOff,{}):(0,l.jsx)(a.Eye,{}),eV?n("exitBasicPreview"):n("previewBasicLayout")]}),(0,l.jsxs)(w.Button,{onClick:()=>G.current?.click(),variant:"outline",children:[(0,l.jsx)(g.Upload,{})," ",n("import")]}),(0,l.jsxs)(w.Button,{onClick:()=>void lw(),variant:"outline",children:[(0,l.jsx)(s.Download,{})," ",n("export")]}),U&&(0,l.jsxs)(w.Button,{onClick:()=>void ly(),variant:"outline",children:[(0,l.jsx)(i.Copy,{})," ",n("duplicate")]}),(0,l.jsxs)(w.Button,{disabled:eg,onClick:()=>void lj(),variant:"outline",children:[eg?(0,l.jsx)(D.Spinner,{}):(0,l.jsx)(h.Save,{})," ",n("saveDraft")]}),(0,l.jsxs)(w.Button,{disabled:eg,onClick:()=>void lb(),children:[(0,l.jsx)(x.Send,{})," ",n("publish")]})]})]}),ev&&(0,l.jsx)(b.Alert,{variant:"destructive",children:(0,l.jsx)(b.AlertDescription,{children:ev})}),ey&&(0,l.jsx)(b.Alert,{children:(0,l.jsx)(b.AlertDescription,{children:ey})}),(0,l.jsxs)("div",{className:"grid gap-4 xl:grid-cols-[280px_minmax(0,1fr)]",children:[(0,l.jsx)(k.Card,{"aria-disabled":eV,className:`flex h-[min(78vh,860px)] min-h-[520px] flex-col gap-0 py-0 ${eV?"pointer-events-none opacity-60":""}`,size:"sm",children:(0,l.jsxs)(R.Tabs,{className:"flex min-h-0 flex-1 gap-0",onValueChange:e=>ep(e),value:eu,children:[(0,l.jsx)("div",{className:"border-b p-2",children:(0,l.jsxs)(R.TabsList,{className:"w-full",children:[(0,l.jsx)(R.TabsTrigger,{value:"palette",children:n("steps")}),(0,l.jsx)(R.TabsTrigger,{value:"outline",children:n("outline")})]})}),(0,l.jsxs)(k.CardContent,{className:"flex min-h-0 flex-1 flex-col p-2",children:[(0,l.jsxs)(R.TabsContent,{className:"flex min-h-0 flex-1 flex-col gap-2",value:"palette",children:[(0,l.jsxs)(E.InputGroup,{children:[(0,l.jsx)(E.InputGroupAddon,{children:(0,l.jsx)(p.Search,{})}),(0,l.jsx)(E.InputGroupInput,{"aria-label":n("searchSteps"),onChange:e=>ex(e.target.value),placeholder:n("searchSteps"),value:eh})]}),lE.length||lF.length?(0,l.jsx)(P.ScrollArea,{className:"-mr-2 min-h-0 flex-1",children:(0,l.jsxs)("div",{className:"space-y-3 pr-2 pb-1",children:[lE.map(([e,t])=>(0,l.jsxs)("section",{children:[(0,l.jsx)("div",{className:"px-1 pb-1 text-[11px] font-medium tracking-wide text-muted-foreground uppercase",children:e}),(0,l.jsx)(F.ItemGroup,{className:"gap-1",children:t.map(e=>(0,l.jsx)(la,{details:e.details,children:(0,l.jsxs)("button",{className:"cursor-grab text-left",draggable:!0,onClick:()=>e5(e),onDragStart:l=>{l.dataTransfer.setData("application/aide-workflow-step",e.kind),l.dataTransfer.effectAllowed="copy"},type:"button",children:[(0,l.jsx)(F.ItemMedia,{children:(0,l.jsx)(o,{className:"size-3.5 text-muted-foreground"})}),(0,l.jsxs)(F.ItemContent,{className:"min-w-0",children:[(0,l.jsx)(F.ItemTitle,{className:"text-xs",children:e.label}),(0,l.jsx)(F.ItemDescription,{className:"line-clamp-2 text-[10px] leading-snug",children:e.description})]}),(0,l.jsxs)(F.ItemActions,{className:"flex-col items-end gap-0.5",children:[(0,l.jsx)(y.Badge,{className:"text-[9px]",variant:"outline",children:e.execution}),(e.mutatesExternal||e.mutatesWorktree)&&(0,l.jsx)(y.Badge,{className:"text-[9px]",variant:"outline",children:n("mutates")})]})]})},e.kind))})]},`step:${e}`)),lF.map(([e,t])=>(0,l.jsxs)("section",{children:[(0,l.jsxs)("div",{className:"px-1 pb-1 text-[11px] font-medium tracking-wide text-muted-foreground uppercase",children:[n("triggers")," · ",e]}),(0,l.jsx)(F.ItemGroup,{className:"gap-1",children:t.map(e=>(0,l.jsx)(la,{details:e.details,children:(0,l.jsxs)("button",{className:"text-left",onClick:()=>lc(e),type:"button",children:[(0,l.jsx)(F.ItemMedia,{children:(0,l.jsx)(u.Plus,{className:"size-3.5 text-muted-foreground"})}),(0,l.jsxs)(F.ItemContent,{className:"min-w-0",children:[(0,l.jsx)(F.ItemTitle,{className:"text-xs",children:e.label}),(0,l.jsx)(F.ItemDescription,{className:"line-clamp-2 text-[10px] leading-snug",children:e.description})]})]})},e.kind))})]},`trigger:${e}`))]})}):(0,l.jsx)(N.Empty,{className:"py-10",children:(0,l.jsx)(N.EmptyHeader,{children:(0,l.jsx)(N.EmptyTitle,{children:n("noOptions")})})})]}),(0,l.jsx)(R.TabsContent,{className:"min-h-0",value:"outline",children:(0,l.jsx)(P.ScrollArea,{className:"-mr-2 h-full",children:(0,l.jsx)(F.ItemGroup,{className:"gap-1 pr-2 pb-1",children:[...K.triggers,...K.nodes].map(e=>(0,l.jsx)(F.Item,{asChild:!0,className:"px-1.5 py-1",size:"xs",variant:e.id===ea?"muted":"outline",children:(0,l.jsx)("button",{"aria-current":e.id===ea,onClick:()=>er(e.id),type:"button",children:(0,l.jsxs)(F.ItemContent,{children:[(0,l.jsx)(F.ItemTitle,{children:e.name??c.kind(e.kind)}),(0,l.jsx)(F.ItemDescription,{children:c.kind(e.kind)})]})})},e.id))})})})]})]})}),(0,l.jsxs)("div",{className:"min-w-0 space-y-3",children:[eV?(0,l.jsx)(e8.WorkflowGraph,{categories:eH,definition:K,diagnostics:ek,onNodeClick:e=>eU(e),selectedNodeId:eG}):(0,l.jsxs)("div",{className:"relative h-[min(78vh,860px)] min-h-[520px] overflow-hidden rounded-xl border bg-muted/20",onDragOver:e=>{e.preventDefault(),e.dataTransfer.dropEffect="copy"},onDrop:e=>{e.preventDefault();let l=e.dataTransfer.getData("application/aide-workflow-step"),t=X.steps.find(e=>e.kind===l);t&&ei&&e5(t,ei.screenToFlowPosition({x:e.clientX,y:e.clientY}))},ref:M,children:[en&&(0,l.jsxs)(w.Button,{className:"absolute top-3 right-3 z-10 shadow-md",onClick:()=>lg([en]),size:"sm",variant:"destructive",children:[(0,l.jsx)(f.Trash2,{})," ",n("deleteConnection")]}),(0,l.jsx)(e8.WorkflowNodeActionsContext,{value:lx,children:(0,l.jsxs)(t.ReactFlow,{className:eM?e7.workflowFitLockPaneClass:void 0,colorMode:"system",deleteKeyCode:["Backspace","Delete"],edges:ee,fitView:!0,nodeTypes:e8.workflowNodeTypes,nodes:lT,onConnect:lm,onEdgeClick:(e,l)=>{er(null),eo(l.id)},onEdgesChange:lf,onInit:e=>es(e),onNodeClick:(e,l)=>{let t;eo(null),void 0!==(t=e.nativeEvent.pointerType)&&"mouse"!==t&&er(l.id)},onNodeDoubleClick:(e,l)=>{eo(null),er(l.id)},onNodeDragStop:(e,l)=>{_(e=>({...e,nodes:e.nodes.map(e=>e.id===l.id?{...e,position:l.position}:e),triggers:e.triggers.map(e=>e.id===l.id?{...e,position:l.position}:e)}))},onNodesChange:Z,onNodesDelete:e=>ld(e.map(({id:e})=>e)),onPaneClick:()=>eo(null),panOnDrag:!eM,preventScrolling:!eM,proOptions:{hideAttribution:!0},zoomOnDoubleClick:!1,zoomOnPinch:!eM,zoomOnScroll:!eM,children:[(0,l.jsx)(t.Background,{gap:20,size:1}),(0,l.jsxs)(t.Controls,{className:"overflow-hidden rounded-lg",showFitView:!eM,showInteractive:!1,showZoom:!eM,children:[(0,l.jsx)(e7.WorkflowFitLockButton,{locked:eM,onToggle:()=>e$(e=>!e)}),(0,l.jsx)(lr,{}),(0,l.jsx)(ln,{onToggle:()=>eB(e=>!e),shown:eq})]}),(0,l.jsx)(e7.WorkflowFitLock,{locked:eM,signature:lI}),!eM&&(0,l.jsx)(t.MiniMap,{className:"overflow-hidden rounded-xl border",maskColor:"transparent",nodeBorderRadius:e8.MINIMAP_NODE_RADIUS,pannable:!0,zoomable:!0})]})})]}),ek.length>0&&(0,l.jsxs)(k.Card,{children:[(0,l.jsx)(k.CardHeader,{children:(0,l.jsx)(k.CardTitle,{children:n("diagnostics")})}),(0,l.jsx)(k.CardContent,{children:(0,l.jsx)(F.ItemGroup,{className:"gap-2",children:ek.map((e,t)=>(0,l.jsx)(F.Item,{asChild:!0,size:"sm",variant:"outline",children:(0,l.jsxs)("button",{className:"text-left",onClick:()=>(eV?eU:er)(e.nodeId??e.triggerId),type:"button",children:[(0,l.jsx)(F.ItemContent,{children:(0,l.jsx)(F.ItemTitle,{children:e.message})}),(0,l.jsx)(F.ItemActions,{children:(0,l.jsx)(y.Badge,{variant:"ERROR"===e.severity?"destructive":"outline",children:c.diagnosticCode(e.code)})})]})},`${e.code}-${t}`))})})]})]})]}),(0,l.jsx)(S.Dialog,{onOpenChange:ed,open:ec,children:(0,l.jsxs)(S.DialogContent,{className:"sm:max-w-2xl",children:[(0,l.jsxs)(S.DialogHeader,{children:[(0,l.jsx)(S.DialogTitle,{children:n("workflowSettings")}),(0,l.jsx)(S.DialogDescription,{children:n("editorDescription")})]}),(0,l.jsxs)(I.FieldGroup,{className:"gap-5",children:[(0,l.jsxs)(I.FieldSet,{children:[(0,l.jsx)(I.FieldLegend,{variant:"label",children:n("detailsSection")}),(0,l.jsxs)(I.FieldGroup,{className:"gap-3",children:[(0,l.jsxs)(I.Field,{children:[(0,l.jsx)(I.FieldLabel,{htmlFor:"workflow-name",children:n("name")}),(0,l.jsx)(T.Input,{id:"workflow-name",onChange:e=>_(l=>({...l,name:e.target.value})),value:K.name})]}),(0,l.jsxs)(I.Field,{children:[(0,l.jsx)(I.FieldLabel,{htmlFor:"workflow-description",children:n("description")}),(0,l.jsx)(W.Textarea,{id:"workflow-description",onChange:e=>_(l=>({...l,description:e.target.value})),value:K.description})]})]})]}),(0,l.jsxs)(I.FieldSet,{children:[(0,l.jsx)(I.FieldLegend,{variant:"label",children:n("runningSection")}),(0,l.jsx)(I.FieldDescription,{children:n("runningSectionHelp")}),(0,l.jsxs)(I.FieldGroup,{className:"gap-3",children:[(0,l.jsxs)(I.Field,{children:[(0,l.jsx)(I.FieldLabel,{htmlFor:"workflow-overlap-policy",children:n("overlapPolicy")}),(0,l.jsxs)(O.Select,{onValueChange:eN,value:eS,children:[(0,l.jsx)(O.SelectTrigger,{className:"w-full",id:"workflow-overlap-policy",children:(0,l.jsx)(O.SelectValue,{})}),(0,l.jsxs)(O.SelectContent,{children:[(0,l.jsx)(O.SelectItem,{value:"QUEUE",children:n("overlap.QUEUE")}),(0,l.jsx)(O.SelectItem,{value:"CONCURRENT",children:n("overlap.CONCURRENT")}),(0,l.jsx)(O.SelectItem,{value:"COALESCE_LATEST",children:n("overlap.COALESCE_LATEST")})]})]}),(0,l.jsx)(I.FieldDescription,{children:n(`overlapHelp.${eS}`)})]}),"CONCURRENT"===eS&&(0,l.jsxs)(I.Field,{children:[(0,l.jsx)(I.FieldLabel,{htmlFor:"workflow-concurrency",children:n("maxConcurrentRuns")}),(0,l.jsx)(T.Input,{id:"workflow-concurrency",max:32,min:1,onChange:e=>eO(Number(e.target.value)),type:"number",value:eF}),(0,l.jsx)(I.FieldDescription,{children:n("maxConcurrentRunsHelp")})]}),(0,l.jsxs)(I.Field,{children:[(0,l.jsx)(I.FieldLabel,{htmlFor:"workflow-overlap-scope",children:n("overlapScope")}),(0,l.jsxs)(O.Select,{onValueChange:eE,value:eT,children:[(0,l.jsx)(O.SelectTrigger,{className:"w-full",id:"workflow-overlap-scope",children:(0,l.jsx)(O.SelectValue,{})}),(0,l.jsxs)(O.SelectContent,{children:[(0,l.jsx)(O.SelectItem,{value:"WORKTREE",children:n("overlapScopes.WORKTREE")}),(0,l.jsx)(O.SelectItem,{value:"GLOBAL",children:n("overlapScopes.GLOBAL")})]})]}),(0,l.jsx)(I.FieldDescription,{children:n(`overlapScopeHelp.${eT}`)})]}),(0,l.jsxs)(I.Field,{children:[(0,l.jsx)(I.FieldLabel,{htmlFor:"workflow-worktree-concurrency",children:n("worktreeConcurrency")}),(0,l.jsxs)(O.Select,{onValueChange:e=>{eD(e),eW("EXCLUSIVE"===e)},value:eL,children:[(0,l.jsx)(O.SelectTrigger,{className:"w-full",id:"workflow-worktree-concurrency",children:(0,l.jsx)(O.SelectValue,{})}),(0,l.jsxs)(O.SelectContent,{children:[(0,l.jsx)(O.SelectItem,{value:"EXCLUSIVE",children:n("worktreeConcurrencyModes.EXCLUSIVE")}),(0,l.jsx)(O.SelectItem,{value:"NON_EXCLUSIVE",children:n("worktreeConcurrencyModes.NON_EXCLUSIVE")}),(0,l.jsx)(O.SelectItem,{value:"EXCLUDED",children:n("worktreeConcurrencyModes.EXCLUDED")})]})]}),(0,l.jsx)(I.FieldDescription,{children:n(`worktreeConcurrencyHelp.${eL}`)})]}),(0,l.jsxs)(I.Field,{children:[(0,l.jsxs)("label",{className:"flex items-center gap-2 text-sm",children:[(0,l.jsx)(C.Checkbox,{checked:"EXCLUSIVE"===eL||eR,disabled:"EXCLUSIVE"===eL,onCheckedChange:e=>eW(!0===e)}),n("blocksGitOperations")]}),(0,l.jsx)(I.FieldDescription,{children:n("EXCLUSIVE"===eL?"blocksGitOperationsExclusiveHelp":"blocksGitOperationsHelp")})]}),(0,l.jsxs)(I.Field,{children:[(0,l.jsxs)("label",{className:"flex items-center gap-2 text-sm",children:[(0,l.jsx)(C.Checkbox,{checked:eA,onCheckedChange:e=>eP(!0===e)}),n("completionNotifications")]}),(0,l.jsx)(I.FieldDescription,{children:n("completionNotificationsHelp")})]})]})]}),(0,l.jsxs)(I.FieldSet,{children:[(0,l.jsx)(I.FieldLegend,{variant:"label",children:n("canvasSection")}),(0,l.jsxs)(I.FieldGroup,{className:"gap-3",children:[(0,l.jsxs)(I.Field,{children:[(0,l.jsx)(I.FieldLabel,{htmlFor:"workflow-display-layout",children:n("displayLayout")}),(0,l.jsxs)(O.Select,{onValueChange:e=>{e2({...K,editor:{...K.editor,displayLayout:e}}),"REGULAR"===e&&(ez(!1),eU(null))},value:lO,children:[(0,l.jsx)(O.SelectTrigger,{className:"w-full",id:"workflow-display-layout",children:(0,l.jsx)(O.SelectValue,{})}),(0,l.jsxs)(O.SelectContent,{children:[(0,l.jsx)(O.SelectItem,{value:"REGULAR",children:n("displayLayouts.REGULAR")}),(0,l.jsx)(O.SelectItem,{value:"BASIC",children:n("displayLayouts.BASIC")})]})]}),(0,l.jsx)(I.FieldDescription,{children:n(`displayLayoutHelp.${lO}`)})]}),(0,l.jsxs)(I.Field,{children:[(0,l.jsx)(I.FieldLabel,{htmlFor:"workflow-handle-layout",children:n("connectorLayout")}),(0,l.jsxs)(O.Select,{onValueChange:e=>e2({...K,editor:{...K.editor,handleLayout:e}}),value:K.editor.handleLayout??"SIDES",children:[(0,l.jsx)(O.SelectTrigger,{className:"w-full",id:"workflow-handle-layout",children:(0,l.jsx)(O.SelectValue,{})}),(0,l.jsxs)(O.SelectContent,{children:[(0,l.jsx)(O.SelectItem,{value:"SIDES",children:n("connectorLayouts.SIDES")}),(0,l.jsx)(O.SelectItem,{value:"TOP_BOTTOM",children:n("connectorLayouts.TOP_BOTTOM")})]})]})]})]})]}),(0,l.jsx)(w.Button,{className:"w-full",onClick:()=>void lv(),variant:"outline",children:n("validate")})]})]})}),(0,l.jsx)(L.Sheet,{onOpenChange:e=>{e||er(null)},open:!!eQ,children:(0,l.jsx)(L.SheetContent,{className:"overflow-y-auto sm:max-w-lg",children:eQ&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)(L.SheetHeader,{children:[(0,l.jsx)(L.SheetTitle,{children:eQ.name??c.kind(eQ.kind)}),(0,l.jsx)(L.SheetDescription,{children:eY?.description??c.kind(eQ.kind)})]}),(0,l.jsxs)(I.FieldGroup,{className:"gap-4 px-4",children:[eY&&(0,l.jsx)("p",{className:"rounded-lg border bg-muted/30 p-3 text-xs leading-relaxed text-muted-foreground",children:eY.details}),(0,l.jsxs)(I.Field,{children:[(0,l.jsx)(I.FieldLabel,{htmlFor:"node-name",children:n("name")}),(0,l.jsx)(T.Input,{id:"node-name",onChange:e=>lC({name:e.target.value}),value:eQ.name??""})]}),(0,eI.hasConfigDescriptor)(eQ.kind,eX?"step":"trigger")?(0,l.jsx)(e6,{config:eQ.config,kind:eQ.kind,onChange:e=>lC({config:e}),scope:eX?"step":"trigger",sessionPaths:e0},eQ.id):(0,l.jsxs)(I.Field,{children:[(0,l.jsx)(I.FieldTitle,{children:n("configuration")}),(0,l.jsx)(e3,{config:eQ.config,defaultOpen:!0,onChange:e=>lC({config:e})})]},eQ.id),(0,l.jsxs)(I.Field,{children:[(0,l.jsx)(I.FieldTitle,{children:eX?n("addsToSession"):n("seedsSession")}),e1.length>0?(0,l.jsx)(F.ItemGroup,{className:"gap-1 rounded-lg border bg-muted/30 p-2",children:e1.map(e=>(0,l.jsx)(F.Item,{className:"px-1 py-0",size:"xs",children:(0,l.jsxs)(F.ItemContent,{children:[(0,l.jsx)(F.ItemTitle,{children:(0,l.jsx)("code",{className:"text-[11px]",children:e.path})}),e.description&&(0,l.jsx)(F.ItemDescription,{className:"text-[10px]",children:e.description})]})},e.path))}):(0,l.jsx)(N.Empty,{className:"py-6",children:(0,l.jsx)(N.EmptyHeader,{children:(0,l.jsx)(N.EmptyTitle,{children:n("addsToSessionEmpty")})})})]}),eX&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)(I.Field,{children:[(0,l.jsx)(I.FieldLabel,{htmlFor:"required-paths",children:n("requiredPaths")}),(0,l.jsx)(T.Input,{id:"required-paths",onChange:e=>lC({requiredPaths:e.target.value.split(",").map(e=>e.trim()).filter(Boolean)}),value:eX.requiredPaths.join(", ")})]}),(0,l.jsxs)(I.Field,{children:[(0,l.jsx)(I.FieldLabel,{htmlFor:"provided-paths",children:n("providedPaths")}),(0,l.jsx)(T.Input,{id:"provided-paths",onChange:e=>lC({providedPaths:e.target.value.split(",").map(e=>e.trim()).filter(Boolean)}),value:eX.providedPaths.join(", ")})]}),(0,l.jsxs)("div",{className:"grid grid-cols-2 gap-3",children:[(0,l.jsxs)(I.Field,{children:[(0,l.jsx)(I.FieldLabel,{htmlFor:"retry-count",children:n("maxAttempts")}),(0,l.jsx)(T.Input,{id:"retry-count",max:20,min:1,onChange:e=>lC({retry:{...eX.retry,maxAttempts:Number(e.target.value)}}),type:"number",value:eX.retry.maxAttempts})]}),(0,l.jsxs)(I.Field,{children:[(0,l.jsx)(I.FieldLabel,{htmlFor:"failure-policy",children:n("failurePolicy")}),(0,l.jsxs)(O.Select,{onValueChange:e=>lC({failurePolicy:e}),value:eX.failurePolicy,children:[(0,l.jsx)(O.SelectTrigger,{className:"w-full",id:"failure-policy",children:(0,l.jsx)(O.SelectValue,{})}),(0,l.jsxs)(O.SelectContent,{children:[(0,l.jsx)(O.SelectItem,{value:"FAIL",children:n("failure.FAIL")}),(0,l.jsx)(O.SelectItem,{value:"CONTINUE",children:n("failure.CONTINUE")})]})]})]})]}),X.steps.find(({kind:e})=>e===eX.kind)?.mutatesExternal&&(0,l.jsx)(b.Alert,{variant:"destructive",children:(0,l.jsx)(b.AlertDescription,{children:n("idempotencyWarning")})})]})]}),(0,l.jsxs)(L.SheetFooter,{children:[eX&&(0,l.jsxs)(w.Button,{onClick:lp,variant:"outline",children:[(0,l.jsx)(i.Copy,{})," ",n("duplicateNode")]}),(0,l.jsxs)(w.Button,{onClick:()=>ld([eQ.id]),variant:"destructive",children:[(0,l.jsx)(f.Trash2,{})," ",n("deleteNode")]})]})]})})}),(0,l.jsx)(ll.WorkflowReadonlyInspector,{catalog:X,definition:K,onOpenChange:e=>{e||eU(null)},selectedId:eV?eG:null})]}):(0,l.jsx)(b.Alert,{variant:"destructive",children:(0,l.jsx)(b.AlertDescription,{children:ev})})}e.s(["WorkflowEditor",0,function(e){return(0,l.jsx)(t.ReactFlowProvider,{children:(0,l.jsx)(lo,{...e})})}],106134)}]);
72
+ }`,{id:U.id});eC(e.validateWorkflowDraft.diagnostics),e_(K,e.validateWorkflowDraft.diagnostics),ew(e.validateWorkflowDraft.valid?n("validationPassed"):n("validationFailed"))}catch(e){eb(e instanceof Error?e.message:String(e))}},lb=async()=>{if(!U)return void eb(n("saveBeforePublish"));ej(!0);try{if(!await lj())return;await (0,B.controlPlaneRequest)("mutation PublishWorkflow($id: ID!) { publishWorkflow(id: $id) { id version contentHash } }",{id:U.id}),ew(n("published")),d.push(`/workflows/${U.id}`)}catch(e){eb(e instanceof Error?e.message:String(e))}finally{ej(!1)}},ly=async()=>{try{let e=await (0,B.controlPlaneRequest)("mutation DuplicateWorkflow($input: CreateWorkflowInput!) { createWorkflow(input: $input) { id } }",{input:{name:`${K.name} copy`,description:K.description,definition:{...K,name:`${K.name} copy`},overlapPolicy:eS,overlapScope:eT,maxConcurrentRuns:eF,completionNotificationsEnabled:eA,worktreeConcurrency:eP,blocksGitOperations:eR}});d.push(`/workflows/${e.createWorkflow.id}/edit`)}catch(e){eb(e instanceof Error?e.message:String(e))}},lw=async()=>{try{let e=U?(await (0,B.controlPlaneRequest)("query ExportWorkflow($id: ID!) { exportWorkflow(id: $id) }",{id:U.id})).exportWorkflow:{format:"aide.workflow.export",schemaVersion:1,workflow:{name:K.name,description:K.description,overlapPolicy:eS,overlapScope:eT,maxConcurrentRuns:eF,completionNotificationsEnabled:eA,worktreeConcurrency:eP,blocksGitOperations:eR,definition:K}};(0,q.downloadJson)(e,`${(0,q.exportFileStem)(K.name)}.workflow.json`)}catch(e){eb(e instanceof Error?e.message:String(e))}},lk=async e=>{try{let l=JSON.parse(await e.text()),t="aide.workflow.export"===l.format&&l.workflow&&"object"==typeof l.workflow?l.workflow.definition:l;if(!t||"object"!=typeof t)throw Error(n("invalidImport"));ez(!1),eU(null),_(t),e_(t),ew(n("importLoaded"))}catch(e){eb(e instanceof Error?e.message:String(e))}},lC=e=>{e2({...K,nodes:K.nodes.map(l=>l.id===ea?{...l,...e}:l),triggers:K.triggers.map(l=>l.id===ea?{...l,...e}:l)})},lS=(0,v.useMemo)(()=>X?.steps.filter(e=>`${e.label} ${e.kind} ${e.category} ${e.description}`.toLowerCase().includes(eh.toLowerCase()))??[],[X,eh]),lN=(0,v.useMemo)(()=>X?.triggers.filter(e=>`${e.label} ${e.kind} ${e.category} ${e.description}`.toLowerCase().includes(eh.toLowerCase()))??[],[X,eh]),lI=(0,v.useMemo)(()=>`${K.triggers.map(({id:e})=>e).join()}|${K.nodes.map(({id:e})=>e).join()}|${K.edges.map(({id:e})=>e).join()}|${K.editor.handleLayout??"SIDES"}|${eq}`,[K,eq]),lT=(0,v.useMemo)(()=>eq?Q:Q.map(e=>e.data.provides.length?{...e,data:{...e.data,provides:[]}}:e),[Q,eq]),lE=(0,v.useMemo)(()=>[...ls(lS)],[lS]),lF=(0,v.useMemo)(()=>[...ls(lN)],[lN]),lO=K.editor.displayLayout??"REGULAR";return em?(0,l.jsxs)("div",{className:"space-y-4",children:[(0,l.jsxs)("div",{className:"space-y-2",children:[(0,l.jsx)(A.Skeleton,{className:"h-8 w-52"}),(0,l.jsx)(A.Skeleton,{className:"h-4 w-96"})]}),(0,l.jsxs)("div",{className:"grid gap-4 xl:grid-cols-[280px_minmax(0,1fr)]",children:[(0,l.jsx)(A.Skeleton,{className:"h-[min(78vh,860px)] min-h-[520px]"}),(0,l.jsx)(A.Skeleton,{className:"h-[min(78vh,860px)] min-h-[520px]"})]})]}):X?(0,l.jsxs)("div",{className:"space-y-4",children:[(0,l.jsxs)("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[(0,l.jsx)("div",{className:"flex min-w-0 items-start gap-2",children:(0,l.jsxs)("div",{children:[(0,l.jsx)("h1",{className:"text-2xl font-semibold tracking-tight",children:n("editor")}),(0,l.jsx)("p",{className:"text-sm text-muted-foreground",children:n("editorDescription")})]})}),(0,l.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,l.jsx)("input",{accept:"application/json,.json",className:"hidden",onChange:e=>{let l=e.target.files?.[0];l&&lk(l),e.target.value=""},ref:G,type:"file"}),(0,l.jsxs)(w.Button,{onClick:()=>ed(!0),variant:"outline",children:[(0,l.jsx)(m.Settings,{})," ",n("settings")]}),"BASIC"===lO&&(0,l.jsxs)(w.Button,{"aria-pressed":eV,onClick:()=>{ez(e=>!e),er(null),eo(null),eU(null)},variant:eV?"secondary":"outline",children:[eV?(0,l.jsx)(r.EyeOff,{}):(0,l.jsx)(a.Eye,{}),eV?n("exitBasicPreview"):n("previewBasicLayout")]}),(0,l.jsxs)(w.Button,{onClick:()=>G.current?.click(),variant:"outline",children:[(0,l.jsx)(g.Upload,{})," ",n("import")]}),(0,l.jsxs)(w.Button,{onClick:()=>void lw(),variant:"outline",children:[(0,l.jsx)(s.Download,{})," ",n("export")]}),U&&(0,l.jsxs)(w.Button,{onClick:()=>void ly(),variant:"outline",children:[(0,l.jsx)(i.Copy,{})," ",n("duplicate")]}),(0,l.jsxs)(w.Button,{disabled:eg,onClick:()=>void lj(),variant:"outline",children:[eg?(0,l.jsx)(D.Spinner,{}):(0,l.jsx)(h.Save,{})," ",n("saveDraft")]}),(0,l.jsxs)(w.Button,{disabled:eg,onClick:()=>void lb(),children:[(0,l.jsx)(x.Send,{})," ",n("publish")]})]})]}),ev&&(0,l.jsx)(b.Alert,{variant:"destructive",children:(0,l.jsx)(b.AlertDescription,{children:ev})}),ey&&(0,l.jsx)(b.Alert,{children:(0,l.jsx)(b.AlertDescription,{children:ey})}),(0,l.jsxs)("div",{className:"grid gap-4 xl:grid-cols-[280px_minmax(0,1fr)]",children:[(0,l.jsx)(k.Card,{"aria-disabled":eV,className:`flex h-[min(78vh,860px)] min-h-[520px] flex-col gap-0 py-0 ${eV?"pointer-events-none opacity-60":""}`,size:"sm",children:(0,l.jsxs)(R.Tabs,{className:"flex min-h-0 flex-1 gap-0",onValueChange:e=>ep(e),value:eu,children:[(0,l.jsx)("div",{className:"border-b p-2",children:(0,l.jsxs)(R.TabsList,{className:"w-full",children:[(0,l.jsx)(R.TabsTrigger,{value:"palette",children:n("steps")}),(0,l.jsx)(R.TabsTrigger,{value:"outline",children:n("outline")})]})}),(0,l.jsxs)(k.CardContent,{className:"flex min-h-0 flex-1 flex-col p-2",children:[(0,l.jsxs)(R.TabsContent,{className:"flex min-h-0 flex-1 flex-col gap-2",value:"palette",children:[(0,l.jsxs)(E.InputGroup,{children:[(0,l.jsx)(E.InputGroupAddon,{children:(0,l.jsx)(p.Search,{})}),(0,l.jsx)(E.InputGroupInput,{"aria-label":n("searchSteps"),onChange:e=>ex(e.target.value),placeholder:n("searchSteps"),value:eh})]}),lE.length||lF.length?(0,l.jsx)(L.ScrollArea,{className:"-mr-2 min-h-0 flex-1",children:(0,l.jsxs)("div",{className:"space-y-3 pr-2 pb-1",children:[lE.map(([e,t])=>(0,l.jsxs)("section",{children:[(0,l.jsx)("div",{className:"px-1 pb-1 text-[11px] font-medium tracking-wide text-muted-foreground uppercase",children:e}),(0,l.jsx)(F.ItemGroup,{className:"gap-1",children:t.map(e=>(0,l.jsx)(la,{details:e.details,children:(0,l.jsxs)("button",{className:"cursor-grab text-left",draggable:!0,onClick:()=>e5(e),onDragStart:l=>{l.dataTransfer.setData("application/aide-workflow-step",e.kind),l.dataTransfer.effectAllowed="copy"},type:"button",children:[(0,l.jsx)(F.ItemMedia,{children:(0,l.jsx)(o,{className:"size-3.5 text-muted-foreground"})}),(0,l.jsxs)(F.ItemContent,{className:"min-w-0",children:[(0,l.jsx)(F.ItemTitle,{className:"text-xs",children:e.label}),(0,l.jsx)(F.ItemDescription,{className:"line-clamp-2 text-[10px] leading-snug",children:e.description})]}),(0,l.jsxs)(F.ItemActions,{className:"flex-col items-end gap-0.5",children:[(0,l.jsx)(y.Badge,{className:"text-[9px]",variant:"outline",children:e.execution}),(e.mutatesExternal||e.mutatesWorktree)&&(0,l.jsx)(y.Badge,{className:"text-[9px]",variant:"outline",children:n("mutates")})]})]})},e.kind))})]},`step:${e}`)),lF.map(([e,t])=>(0,l.jsxs)("section",{children:[(0,l.jsxs)("div",{className:"px-1 pb-1 text-[11px] font-medium tracking-wide text-muted-foreground uppercase",children:[n("triggers")," · ",e]}),(0,l.jsx)(F.ItemGroup,{className:"gap-1",children:t.map(e=>(0,l.jsx)(la,{details:e.details,children:(0,l.jsxs)("button",{className:"text-left",onClick:()=>lc(e),type:"button",children:[(0,l.jsx)(F.ItemMedia,{children:(0,l.jsx)(u.Plus,{className:"size-3.5 text-muted-foreground"})}),(0,l.jsxs)(F.ItemContent,{className:"min-w-0",children:[(0,l.jsx)(F.ItemTitle,{className:"text-xs",children:e.label}),(0,l.jsx)(F.ItemDescription,{className:"line-clamp-2 text-[10px] leading-snug",children:e.description})]})]})},e.kind))})]},`trigger:${e}`))]})}):(0,l.jsx)(N.Empty,{className:"py-10",children:(0,l.jsx)(N.EmptyHeader,{children:(0,l.jsx)(N.EmptyTitle,{children:n("noOptions")})})})]}),(0,l.jsx)(R.TabsContent,{className:"min-h-0",value:"outline",children:(0,l.jsx)(L.ScrollArea,{className:"-mr-2 h-full",children:(0,l.jsx)(F.ItemGroup,{className:"gap-1 pr-2 pb-1",children:[...K.triggers,...K.nodes].map(e=>(0,l.jsx)(F.Item,{asChild:!0,className:"px-1.5 py-1",size:"xs",variant:e.id===ea?"muted":"outline",children:(0,l.jsx)("button",{"aria-current":e.id===ea,onClick:()=>er(e.id),type:"button",children:(0,l.jsxs)(F.ItemContent,{children:[(0,l.jsx)(F.ItemTitle,{children:e.name??c.kind(e.kind)}),(0,l.jsx)(F.ItemDescription,{children:c.kind(e.kind)})]})})},e.id))})})})]})]})}),(0,l.jsxs)("div",{className:"min-w-0 space-y-3",children:[eV?(0,l.jsx)(e8.WorkflowGraph,{categories:eH,definition:K,diagnostics:ek,onNodeClick:e=>eU(e),selectedNodeId:eG}):(0,l.jsxs)("div",{className:"relative h-[min(78vh,860px)] min-h-[520px] overflow-hidden rounded-xl border bg-muted/20",onDragOver:e=>{e.preventDefault(),e.dataTransfer.dropEffect="copy"},onDrop:e=>{e.preventDefault();let l=e.dataTransfer.getData("application/aide-workflow-step"),t=X.steps.find(e=>e.kind===l);t&&ei&&e5(t,ei.screenToFlowPosition({x:e.clientX,y:e.clientY}))},ref:M,children:[en&&(0,l.jsxs)(w.Button,{className:"absolute top-3 right-3 z-10 shadow-md",onClick:()=>lg([en]),size:"sm",variant:"destructive",children:[(0,l.jsx)(f.Trash2,{})," ",n("deleteConnection")]}),(0,l.jsx)(e8.WorkflowNodeActionsContext,{value:lx,children:(0,l.jsxs)(t.ReactFlow,{className:eM?e7.workflowFitLockPaneClass:void 0,colorMode:"system",deleteKeyCode:["Backspace","Delete"],edges:ee,fitView:!0,nodeTypes:e8.workflowNodeTypes,nodes:lT,onConnect:lm,onEdgeClick:(e,l)=>{er(null),eo(l.id)},onEdgesChange:lf,onInit:e=>es(e),onNodeClick:(e,l)=>{let t;eo(null),void 0!==(t=e.nativeEvent.pointerType)&&"mouse"!==t&&er(l.id)},onNodeDoubleClick:(e,l)=>{eo(null),er(l.id)},onNodeDragStop:(e,l)=>{_(e=>({...e,nodes:e.nodes.map(e=>e.id===l.id?{...e,position:l.position}:e),triggers:e.triggers.map(e=>e.id===l.id?{...e,position:l.position}:e)}))},onNodesChange:Z,onNodesDelete:e=>ld(e.map(({id:e})=>e)),onPaneClick:()=>eo(null),panOnDrag:!eM,preventScrolling:!eM,proOptions:{hideAttribution:!0},zoomOnDoubleClick:!1,zoomOnPinch:!eM,zoomOnScroll:!eM,children:[(0,l.jsx)(t.Background,{gap:20,size:1}),(0,l.jsxs)(t.Controls,{className:"overflow-hidden rounded-lg",showFitView:!eM,showInteractive:!1,showZoom:!eM,children:[(0,l.jsx)(e7.WorkflowFitLockButton,{locked:eM,onToggle:()=>e$(e=>!e)}),(0,l.jsx)(lr,{}),(0,l.jsx)(ln,{onToggle:()=>eB(e=>!e),shown:eq})]}),(0,l.jsx)(e7.WorkflowFitLock,{locked:eM,signature:lI}),!eM&&(0,l.jsx)(t.MiniMap,{className:"overflow-hidden rounded-xl border",maskColor:"transparent",nodeBorderRadius:e8.MINIMAP_NODE_RADIUS,pannable:!0,zoomable:!0})]})})]}),ek.length>0&&(0,l.jsxs)(k.Card,{children:[(0,l.jsx)(k.CardHeader,{children:(0,l.jsx)(k.CardTitle,{children:n("diagnostics")})}),(0,l.jsx)(k.CardContent,{children:(0,l.jsx)(F.ItemGroup,{className:"gap-2",children:ek.map((e,t)=>(0,l.jsx)(F.Item,{asChild:!0,size:"sm",variant:"outline",children:(0,l.jsxs)("button",{className:"text-left",onClick:()=>(eV?eU:er)(e.nodeId??e.triggerId),type:"button",children:[(0,l.jsx)(F.ItemContent,{children:(0,l.jsx)(F.ItemTitle,{children:e.message})}),(0,l.jsx)(F.ItemActions,{children:(0,l.jsx)(y.Badge,{variant:"ERROR"===e.severity?"destructive":"outline",children:c.diagnosticCode(e.code)})})]})},`${e.code}-${t}`))})})]})]})]}),(0,l.jsx)(S.Dialog,{onOpenChange:ed,open:ec,children:(0,l.jsxs)(S.DialogContent,{className:"sm:max-w-2xl",children:[(0,l.jsxs)(S.DialogHeader,{children:[(0,l.jsx)(S.DialogTitle,{children:n("workflowSettings")}),(0,l.jsx)(S.DialogDescription,{children:n("editorDescription")})]}),(0,l.jsxs)(I.FieldGroup,{className:"gap-5",children:[(0,l.jsxs)(I.FieldSet,{children:[(0,l.jsx)(I.FieldLegend,{variant:"label",children:n("detailsSection")}),(0,l.jsxs)(I.FieldGroup,{className:"gap-3",children:[(0,l.jsxs)(I.Field,{children:[(0,l.jsx)(I.FieldLabel,{htmlFor:"workflow-name",children:n("name")}),(0,l.jsx)(T.Input,{id:"workflow-name",onChange:e=>_(l=>({...l,name:e.target.value})),value:K.name})]}),(0,l.jsxs)(I.Field,{children:[(0,l.jsx)(I.FieldLabel,{htmlFor:"workflow-description",children:n("description")}),(0,l.jsx)(W.Textarea,{id:"workflow-description",onChange:e=>_(l=>({...l,description:e.target.value})),value:K.description})]})]})]}),(0,l.jsxs)(I.FieldSet,{children:[(0,l.jsx)(I.FieldLegend,{variant:"label",children:n("runningSection")}),(0,l.jsx)(I.FieldDescription,{children:n("runningSectionHelp")}),(0,l.jsxs)(I.FieldGroup,{className:"gap-3",children:[(0,l.jsxs)(I.Field,{children:[(0,l.jsx)(I.FieldLabel,{htmlFor:"workflow-overlap-policy",children:n("overlapPolicy")}),(0,l.jsxs)(O.Select,{onValueChange:eN,value:eS,children:[(0,l.jsx)(O.SelectTrigger,{className:"w-full",id:"workflow-overlap-policy",children:(0,l.jsx)(O.SelectValue,{})}),(0,l.jsxs)(O.SelectContent,{children:[(0,l.jsx)(O.SelectItem,{value:"QUEUE",children:n("overlap.QUEUE")}),(0,l.jsx)(O.SelectItem,{value:"CONCURRENT",children:n("overlap.CONCURRENT")}),(0,l.jsx)(O.SelectItem,{value:"COALESCE_LATEST",children:n("overlap.COALESCE_LATEST")})]})]}),(0,l.jsx)(I.FieldDescription,{children:n(`overlapHelp.${eS}`)})]}),"CONCURRENT"===eS&&(0,l.jsxs)(I.Field,{children:[(0,l.jsx)(I.FieldLabel,{htmlFor:"workflow-concurrency",children:n("maxConcurrentRuns")}),(0,l.jsx)(T.Input,{id:"workflow-concurrency",max:32,min:1,onChange:e=>eO(Number(e.target.value)),type:"number",value:eF}),(0,l.jsx)(I.FieldDescription,{children:n("maxConcurrentRunsHelp")})]}),(0,l.jsxs)(I.Field,{children:[(0,l.jsx)(I.FieldLabel,{htmlFor:"workflow-overlap-scope",children:n("overlapScope")}),(0,l.jsxs)(O.Select,{onValueChange:eE,value:eT,children:[(0,l.jsx)(O.SelectTrigger,{className:"w-full",id:"workflow-overlap-scope",children:(0,l.jsx)(O.SelectValue,{})}),(0,l.jsxs)(O.SelectContent,{children:[(0,l.jsx)(O.SelectItem,{value:"WORKTREE",children:n("overlapScopes.WORKTREE")}),(0,l.jsx)(O.SelectItem,{value:"GLOBAL",children:n("overlapScopes.GLOBAL")})]})]}),(0,l.jsx)(I.FieldDescription,{children:n(`overlapScopeHelp.${eT}`)})]}),(0,l.jsxs)(I.Field,{children:[(0,l.jsx)(I.FieldLabel,{htmlFor:"workflow-worktree-concurrency",children:n("worktreeConcurrency")}),(0,l.jsxs)(O.Select,{onValueChange:e=>{eD(e),eW("EXCLUSIVE"===e)},value:eP,children:[(0,l.jsx)(O.SelectTrigger,{className:"w-full",id:"workflow-worktree-concurrency",children:(0,l.jsx)(O.SelectValue,{})}),(0,l.jsxs)(O.SelectContent,{children:[(0,l.jsx)(O.SelectItem,{value:"EXCLUSIVE",children:n("worktreeConcurrencyModes.EXCLUSIVE")}),(0,l.jsx)(O.SelectItem,{value:"NON_EXCLUSIVE",children:n("worktreeConcurrencyModes.NON_EXCLUSIVE")}),(0,l.jsx)(O.SelectItem,{value:"EXCLUDED",children:n("worktreeConcurrencyModes.EXCLUDED")})]})]}),(0,l.jsx)(I.FieldDescription,{children:n(`worktreeConcurrencyHelp.${eP}`)})]}),(0,l.jsxs)(I.Field,{children:[(0,l.jsxs)("label",{className:"flex items-center gap-2 text-sm",children:[(0,l.jsx)(C.Checkbox,{checked:"EXCLUSIVE"===eP||eR,disabled:"EXCLUSIVE"===eP,onCheckedChange:e=>eW(!0===e)}),n("blocksGitOperations")]}),(0,l.jsx)(I.FieldDescription,{children:n("EXCLUSIVE"===eP?"blocksGitOperationsExclusiveHelp":"blocksGitOperationsHelp")})]}),(0,l.jsxs)(I.Field,{children:[(0,l.jsxs)("label",{className:"flex items-center gap-2 text-sm",children:[(0,l.jsx)(C.Checkbox,{checked:eA,onCheckedChange:e=>eL(!0===e)}),n("completionNotifications")]}),(0,l.jsx)(I.FieldDescription,{children:n("completionNotificationsHelp")})]})]})]}),(0,l.jsxs)(I.FieldSet,{children:[(0,l.jsx)(I.FieldLegend,{variant:"label",children:n("canvasSection")}),(0,l.jsxs)(I.FieldGroup,{className:"gap-3",children:[(0,l.jsxs)(I.Field,{children:[(0,l.jsx)(I.FieldLabel,{htmlFor:"workflow-display-layout",children:n("displayLayout")}),(0,l.jsxs)(O.Select,{onValueChange:e=>{e2({...K,editor:{...K.editor,displayLayout:e}}),"REGULAR"===e&&(ez(!1),eU(null))},value:lO,children:[(0,l.jsx)(O.SelectTrigger,{className:"w-full",id:"workflow-display-layout",children:(0,l.jsx)(O.SelectValue,{})}),(0,l.jsxs)(O.SelectContent,{children:[(0,l.jsx)(O.SelectItem,{value:"REGULAR",children:n("displayLayouts.REGULAR")}),(0,l.jsx)(O.SelectItem,{value:"BASIC",children:n("displayLayouts.BASIC")})]})]}),(0,l.jsx)(I.FieldDescription,{children:n(`displayLayoutHelp.${lO}`)})]}),(0,l.jsxs)(I.Field,{children:[(0,l.jsx)(I.FieldLabel,{htmlFor:"workflow-handle-layout",children:n("connectorLayout")}),(0,l.jsxs)(O.Select,{onValueChange:e=>e2({...K,editor:{...K.editor,handleLayout:e}}),value:K.editor.handleLayout??"SIDES",children:[(0,l.jsx)(O.SelectTrigger,{className:"w-full",id:"workflow-handle-layout",children:(0,l.jsx)(O.SelectValue,{})}),(0,l.jsxs)(O.SelectContent,{children:[(0,l.jsx)(O.SelectItem,{value:"SIDES",children:n("connectorLayouts.SIDES")}),(0,l.jsx)(O.SelectItem,{value:"TOP_BOTTOM",children:n("connectorLayouts.TOP_BOTTOM")})]})]})]})]})]}),(0,l.jsx)(w.Button,{className:"w-full",onClick:()=>void lv(),variant:"outline",children:n("validate")})]})]})}),(0,l.jsx)(P.Sheet,{onOpenChange:e=>{e||er(null)},open:!!eQ,children:(0,l.jsx)(P.SheetContent,{className:"overflow-y-auto sm:max-w-lg",children:eQ&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)(P.SheetHeader,{children:[(0,l.jsx)(P.SheetTitle,{children:eQ.name??c.kind(eQ.kind)}),(0,l.jsx)(P.SheetDescription,{children:eY?.description??c.kind(eQ.kind)})]}),(0,l.jsxs)(I.FieldGroup,{className:"gap-4 px-4",children:[eY&&(0,l.jsx)("p",{className:"rounded-lg border bg-muted/30 p-3 text-xs leading-relaxed text-muted-foreground",children:eY.details}),(0,l.jsxs)(I.Field,{children:[(0,l.jsx)(I.FieldLabel,{htmlFor:"node-name",children:n("name")}),(0,l.jsx)(T.Input,{id:"node-name",onChange:e=>lC({name:e.target.value}),value:eQ.name??""})]}),(0,eI.hasConfigDescriptor)(eQ.kind,eX?"step":"trigger")?(0,l.jsx)(e6,{config:eQ.config,kind:eQ.kind,onChange:e=>lC({config:e}),scope:eX?"step":"trigger",sessionPaths:e0},eQ.id):(0,l.jsxs)(I.Field,{children:[(0,l.jsx)(I.FieldTitle,{children:n("configuration")}),(0,l.jsx)(e3,{config:eQ.config,defaultOpen:!0,onChange:e=>lC({config:e})})]},eQ.id),(0,l.jsxs)(I.Field,{children:[(0,l.jsx)(I.FieldTitle,{children:eX?n("addsToSession"):n("seedsSession")}),e1.length>0?(0,l.jsx)(F.ItemGroup,{className:"gap-1 rounded-lg border bg-muted/30 p-2",children:e1.map(e=>(0,l.jsx)(F.Item,{className:"px-1 py-0",size:"xs",children:(0,l.jsxs)(F.ItemContent,{children:[(0,l.jsx)(F.ItemTitle,{children:(0,l.jsx)("code",{className:"text-[11px]",children:e.path})}),e.description&&(0,l.jsx)(F.ItemDescription,{className:"text-[10px]",children:e.description})]})},e.path))}):(0,l.jsx)(N.Empty,{className:"py-6",children:(0,l.jsx)(N.EmptyHeader,{children:(0,l.jsx)(N.EmptyTitle,{children:n("addsToSessionEmpty")})})})]}),eX&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)(I.Field,{children:[(0,l.jsx)(I.FieldLabel,{htmlFor:"required-paths",children:n("requiredPaths")}),(0,l.jsx)(T.Input,{id:"required-paths",onChange:e=>lC({requiredPaths:e.target.value.split(",").map(e=>e.trim()).filter(Boolean)}),value:eX.requiredPaths.join(", ")})]}),(0,l.jsxs)(I.Field,{children:[(0,l.jsx)(I.FieldLabel,{htmlFor:"provided-paths",children:n("providedPaths")}),(0,l.jsx)(T.Input,{id:"provided-paths",onChange:e=>lC({providedPaths:e.target.value.split(",").map(e=>e.trim()).filter(Boolean)}),value:eX.providedPaths.join(", ")})]}),(0,l.jsxs)("div",{className:"grid grid-cols-2 gap-3",children:[(0,l.jsxs)(I.Field,{children:[(0,l.jsx)(I.FieldLabel,{htmlFor:"retry-count",children:n("maxAttempts")}),(0,l.jsx)(T.Input,{id:"retry-count",max:20,min:1,onChange:e=>lC({retry:{...eX.retry,maxAttempts:Number(e.target.value)}}),type:"number",value:eX.retry.maxAttempts})]}),(0,l.jsxs)(I.Field,{children:[(0,l.jsx)(I.FieldLabel,{htmlFor:"failure-policy",children:n("failurePolicy")}),(0,l.jsxs)(O.Select,{onValueChange:e=>lC({failurePolicy:e}),value:eX.failurePolicy,children:[(0,l.jsx)(O.SelectTrigger,{className:"w-full",id:"failure-policy",children:(0,l.jsx)(O.SelectValue,{})}),(0,l.jsxs)(O.SelectContent,{children:[(0,l.jsx)(O.SelectItem,{value:"FAIL",children:n("failure.FAIL")}),(0,l.jsx)(O.SelectItem,{value:"CONTINUE",children:n("failure.CONTINUE")})]})]})]})]}),X.steps.find(({kind:e})=>e===eX.kind)?.mutatesExternal&&(0,l.jsx)(b.Alert,{variant:"destructive",children:(0,l.jsx)(b.AlertDescription,{children:n("idempotencyWarning")})})]})]}),(0,l.jsxs)(P.SheetFooter,{children:[eX&&(0,l.jsxs)(w.Button,{onClick:lp,variant:"outline",children:[(0,l.jsx)(i.Copy,{})," ",n("duplicateNode")]}),(0,l.jsxs)(w.Button,{onClick:()=>ld([eQ.id]),variant:"destructive",children:[(0,l.jsx)(f.Trash2,{})," ",n("deleteNode")]})]})]})})}),(0,l.jsx)(ll.WorkflowReadonlyInspector,{catalog:X,definition:K,onOpenChange:e=>{e||eU(null)},selectedId:eV?eG:null})]}):(0,l.jsx)(b.Alert,{variant:"destructive",children:(0,l.jsx)(b.AlertDescription,{children:ev})})}e.s(["WorkflowEditor",0,function(e){return(0,l.jsx)(t.ReactFlowProvider,{children:(0,l.jsx)(lo,{...e})})}],106134)}]);
@@ -1,4 +1,4 @@
1
- (globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,563707,e=>{"use strict";let t=(0,e.i(456420).default)("chevrons-up-down",[["path",{d:"m7 15 5 5 5-5",key:"1hf1tw"}],["path",{d:"m7 9 5-5 5 5",key:"sgt6xg"}]]);e.s(["ChevronsUpDown",0,t],563707)},741120,e=>{"use strict";let t=(0,e.i(456420).default)("refresh-cw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]]);e.s(["RefreshCw",0,t],741120)},856522,e=>{"use strict";let t=(0,e.i(456420).default)("save",[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]]);e.s(["Save",0,t],856522)},983913,e=>{"use strict";var t=e.i(843476),a=e.i(563707),s=e.i(271645),i=e.i(519455),r=e.i(317056),l=e.i(906197),n=e.i(337822),c=e.i(975157);e.s(["SearchableSelect",0,function({value:e,onValueChange:o,options:d,placeholder:u,searchPlaceholder:m,emptyMessage:h,ariaLabel:x,disabled:p,className:b,showSelectedDetails:j=!1,allowCustomValue:g=!1}){let[f,v]=(0,s.useState)(!1),[T,C]=(0,s.useState)(""),w=(0,s.useCallback)(e=>{e&&e.addEventListener("wheel",e=>e.stopPropagation())},[]),y=d.find(t=>t.value===e),N=y?.label??(e||u),S=T.trim(),A=g&&S.length>0&&!d.some(e=>e.value.toLowerCase()===S.toLowerCase()||e.label.toLowerCase()===S.toLowerCase());return(0,t.jsxs)(n.Popover,{onOpenChange:e=>{v(e),e||C("")},open:f,children:[(0,t.jsx)(n.PopoverTrigger,{asChild:!0,children:(0,t.jsxs)(i.Button,{"aria-expanded":f,"aria-label":x,className:(0,c.cn)("min-w-0 w-full justify-between font-normal",j&&y&&"h-auto min-h-8 py-2",b),disabled:p,role:"combobox",type:"button",variant:"outline",children:[j&&y?(0,t.jsxs)("span",{className:"min-w-0 text-left",children:[(0,t.jsx)("span",{className:"block truncate",children:y.label}),y.description&&(0,t.jsx)("span",{className:"block truncate text-xs text-muted-foreground",children:y.description}),y.secondaryDescription&&(0,t.jsx)("span",{className:"block truncate text-xs text-muted-foreground",children:y.secondaryDescription})]}):(0,t.jsx)("span",{className:"min-w-0 truncate",children:N}),(0,t.jsx)(a.ChevronsUpDown,{className:"shrink-0 opacity-50"})]})}),(0,t.jsx)(n.PopoverContent,{ref:w,align:"start",className:"z-70 max-h-[min(24rem,var(--radix-popover-content-available-height))] w-(--radix-popover-trigger-width) overflow-hidden p-0",children:(0,t.jsxs)(r.Command,{className:"min-h-0",label:m,children:[(0,t.jsx)(r.CommandInput,{"aria-label":m,autoFocus:!0,onValueChange:C,placeholder:m,value:T}),(0,t.jsxs)(r.CommandList,{className:"min-h-0 flex-1 max-h-64 overscroll-contain [scrollbar-width:thin] [&::-webkit-scrollbar]:block [&::-webkit-scrollbar]:w-2 [&::-webkit-scrollbar-thumb]:rounded-full [&::-webkit-scrollbar-thumb]:bg-border",children:[(0,t.jsx)(r.CommandEmpty,{children:h}),(0,t.jsxs)(r.CommandGroup,{children:[A&&(0,t.jsx)(r.CommandItem,{"aria-label":S,onSelect:()=>{o(S),C(""),v(!1)},value:S,children:(0,t.jsx)(l.Item,{className:"min-w-0 flex-1 border-0 p-0",size:"xs",children:(0,t.jsx)(l.ItemContent,{className:"min-w-0",children:(0,t.jsx)(l.ItemTitle,{className:"block truncate",children:S})})})}),d.map(a=>(0,t.jsx)(r.CommandItem,{"aria-label":[a.label,a.description,a.secondaryDescription].filter(Boolean).join(", "),"aria-selected":a.value===e,className:"items-start py-2","data-checked":a.value===e,disabled:a.disabled,keywords:[a.label,a.description??"",a.secondaryDescription??"",a.keywords??""],onSelect:()=>{o(a.value),C(""),v(!1)},value:a.value,children:(0,t.jsx)(l.Item,{className:"min-w-0 flex-1 border-0 p-0",size:"xs",children:(0,t.jsxs)(l.ItemContent,{className:"min-w-0",children:[(0,t.jsx)(l.ItemTitle,{className:"block truncate",children:a.label}),a.description&&(0,t.jsx)(l.ItemDescription,{className:"block truncate",children:a.description}),a.secondaryDescription&&(0,t.jsx)(l.ItemDescription,{className:"block truncate",children:a.secondaryDescription})]})})},a.value))]})]})]})})]})}])},900278,e=>{"use strict";var t=e.i(843476),a=e.i(809584),s=e.i(482022),i=e.i(77071),r=e.i(741120),l=e.i(856522),n=e.i(573474),c=e.i(861745),o=e.i(948148),d=e.i(271645),u=e.i(816484),m=e.i(983913),h=e.i(340953),x=e.i(929592),p=e.i(487486),b=e.i(519455),j=e.i(515288),g=e.i(82612),f=e.i(436589),v=e.i(793479),T=e.i(110204),C=e.i(967489),w=e.i(987968),y=e.i(784774),N=e.i(520133),S=e.i(637611),A=e.i(360583);let L="window total live cache errors averageMs pointsUsed pointsAvoided",E=["ALL","GRAPHQL","REST"],H=["ALL","LIVE","CACHE"],R=["ALL","GITHUB_API","GITHUB_SETTINGS","COMMENTS_PAGE","CODEBASE_REPOSITORY","PULL_REQUESTS_PAGE","PULL_REQUEST_DETAILS","ACTIONS_PAGE","WORKTREES","WORKTREE_PIPELINES","WORKTREE_AUTOMATION","AUTO_RETRY","WORKFLOW_AUTOMATION","ACTIONS_NOTIFICATIONS","CACHE_MANAGEMENT"];function O(e){return"LIVE"===e?"border-blue-500/30 bg-blue-500/10 text-blue-700 dark:text-blue-300":"ERROR"===e?"border-destructive/30 bg-destructive/10 text-destructive":"border-emerald-500/30 bg-emerald-500/10 text-emerald-700 dark:text-emerald-300"}function k({apiMetrics:e,snapshots:a}){let s=(0,o.useTranslations)("githubCache"),i=a.filter(e=>"graphql"===e.resource),r=a.filter(e=>"graphql"!==e.resource);return(0,t.jsxs)("div",{className:"grid gap-4 xl:grid-cols-2",children:[(0,t.jsx)(I,{title:s("graphqlRateTitle"),description:s("graphqlRateDescription"),metrics:e.find(e=>"GRAPHQL"===e.apiType)?.windows??[],snapshots:i}),(0,t.jsx)(I,{title:s("restRateTitle"),description:s("restRateDescription"),metrics:e.find(e=>"REST"===e.apiType)?.windows??[],snapshots:r})]})}function I({title:e,description:a,metrics:s,snapshots:i}){let r=(0,o.useTranslations)("githubCache");return(0,t.jsx)(M,{title:e,description:a,children:(0,t.jsxs)("div",{children:[0===i.length?(0,t.jsx)(q,{children:r("noRateData")}):(0,t.jsx)("div",{className:`grid gap-3 p-4 ${i.length>1?"sm:grid-cols-2":""}`,children:i.map(e=>{let a,s,i=(a=Date.parse(e.resetAt),!Number.isFinite(s=Date.parse(e.observedAt)-(a-36e5))||s<=0||s>=36e5?e.used:Math.max(e.used,Math.round(36e5*e.used/s)));return(0,t.jsx)(j.Card,{children:(0,t.jsxs)(j.CardContent,{children:[(0,t.jsxs)("div",{className:"flex justify-between",children:[(0,t.jsxs)("span",{className:"font-medium",children:[e.authentication," · ",e.resource]}),(0,t.jsxs)(p.Badge,{variant:"outline",children:[e.remaining," / ",e.limit]})]}),(0,t.jsxs)("dl",{className:"mt-3 grid grid-cols-2 gap-2 text-sm",children:[(0,t.jsx)("dt",{className:"text-muted-foreground",children:r("limit")}),(0,t.jsx)("dd",{children:e.limit}),(0,t.jsx)("dt",{className:"text-muted-foreground",children:r("remaining")}),(0,t.jsx)("dd",{children:e.remaining}),(0,t.jsx)("dt",{className:"text-muted-foreground",children:r("used")}),(0,t.jsx)("dd",{children:e.used}),(0,t.jsx)("dt",{className:"text-muted-foreground",children:r("estimated")}),(0,t.jsx)("dd",{className:i>e.limit?"font-medium text-destructive":void 0,children:i}),(0,t.jsx)("dt",{className:"text-muted-foreground",children:r("reset")}),(0,t.jsx)("dd",{children:(0,t.jsx)(u.DateTime,{value:e.resetAt})}),(0,t.jsx)("dt",{className:"text-muted-foreground",children:r("resource")}),(0,t.jsx)("dd",{children:e.resource}),(0,t.jsx)("dt",{className:"text-muted-foreground",children:r("observed")}),(0,t.jsx)("dd",{children:(0,t.jsx)(u.DateTime,{value:e.observedAt})})]})]})},`${e.authentication}-${e.resource}`)})}),(0,t.jsx)("div",{className:"grid grid-cols-2 gap-3 border-t p-4",children:s.map(e=>(0,t.jsx)(D,{metric:e},e.window))})]})})}function D({metric:e}){let s=(0,o.useTranslations)("githubCache");return(0,t.jsx)(j.Card,{children:(0,t.jsxs)(j.CardContent,{children:[(0,t.jsxs)("div",{className:"flex items-center justify-between",children:[(0,t.jsx)("span",{className:"font-medium",children:e.window}),(0,t.jsx)(a.Database,{className:"size-4 text-muted-foreground"})]}),(0,t.jsx)("p",{className:"mt-3 text-3xl font-semibold",children:e.total}),(0,t.jsx)("p",{className:"text-xs text-muted-foreground",children:s("average",{ms:e.averageMs})}),(0,t.jsxs)("div",{className:"mt-3 grid grid-cols-3 gap-2 text-xs",children:[(0,t.jsxs)("span",{children:[s("live")," ",e.live]}),(0,t.jsxs)("span",{children:[s("cache")," ",e.cache]}),(0,t.jsxs)("span",{children:[s("errors")," ",e.errors]})]}),(0,t.jsx)("p",{className:"mt-2 text-xs text-muted-foreground",children:s("points",{used:e.pointsUsed,avoided:e.pointsAvoided})})]})})}function $({metric:e}){return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("span",{className:"font-medium",children:e.total}),(0,t.jsxs)("span",{className:"ml-2 text-xs text-muted-foreground",children:["L ",e.live," · C ",e.cache," · E ",e.errors," · P"," ",e.pointsUsed,"/",e.pointsAvoided]})]})}function M({title:e,description:a,action:s,children:i}){return(0,t.jsxs)(j.Card,{className:"gap-0 py-0",children:[(0,t.jsxs)(j.CardHeader,{children:[(0,t.jsx)(j.CardTitle,{children:e}),(0,t.jsx)(j.CardDescription,{children:a}),s&&(0,t.jsx)(j.CardAction,{children:s})]}),i]})}function q({children:e}){return(0,t.jsx)(g.Empty,{className:"py-8",children:(0,t.jsx)(g.EmptyHeader,{children:(0,t.jsx)(g.EmptyDescription,{children:e})})})}function B({offset:e,setOffset:a,total:s}){let i=(0,o.useTranslations)("githubCache");return(0,t.jsxs)("div",{className:"flex items-center justify-between border-t p-3 text-sm",children:[(0,t.jsx)("span",{className:"text-muted-foreground",children:i("showing",{start:0===s?0:e+1,end:Math.min(e+50,s),total:s})}),(0,t.jsxs)("div",{className:"flex gap-2",children:[(0,t.jsx)(b.Button,{disabled:0===e,onClick:()=>a(Math.max(0,e-50)),size:"sm",variant:"outline",children:i("previous")}),(0,t.jsx)(b.Button,{disabled:e+50>=s,onClick:()=>a(e+50),size:"sm",variant:"outline",children:i("next")})]})]})}e.s(["GitHubCachePage",0,function(){let e=(0,o.useTranslations)("githubCache"),a=(0,o.useTranslations)("common"),j=(0,c.useLocale)(),[g,I]=(0,d.useState)(null),[D,P]=(0,d.useState)("5"),[G,_]=(0,d.useState)(""),[U,z]=(0,d.useState)("60"),[F,V]=(0,d.useState)({}),[K,W]=(0,d.useState)(0),[Q,J]=(0,d.useState)(0),[Y,X]=(0,d.useState)("ALL"),[Z,ee]=(0,d.useState)("ALL"),[et,ea]=(0,d.useState)("ALL"),[es,ei]=(0,d.useState)(!0),[er,el]=(0,d.useState)(null),[en,ec]=(0,d.useState)(null),eo=(0,d.useCallback)(async()=>{ei(!0);try{let e=await (0,S.controlPlaneRequest)(`query GitHubCachePage($limit: Int!, $callOffset: Int!, $entryOffset: Int!, $apiType: GitHubApiType, $requestSource: GitHubRequestSource, $callSource: GitHubCallSource) {
1
+ (globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,563707,e=>{"use strict";let t=(0,e.i(456420).default)("chevrons-up-down",[["path",{d:"m7 15 5 5 5-5",key:"1hf1tw"}],["path",{d:"m7 9 5-5 5 5",key:"sgt6xg"}]]);e.s(["ChevronsUpDown",0,t],563707)},741120,e=>{"use strict";let t=(0,e.i(456420).default)("refresh-cw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]]);e.s(["RefreshCw",0,t],741120)},856522,e=>{"use strict";let t=(0,e.i(456420).default)("save",[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]]);e.s(["Save",0,t],856522)},983913,e=>{"use strict";var t=e.i(843476),a=e.i(563707),s=e.i(271645),i=e.i(519455),r=e.i(317056),l=e.i(906197),n=e.i(337822),c=e.i(975157);e.s(["SearchableSelect",0,function({value:e,onValueChange:o,options:d,placeholder:u,searchPlaceholder:m,emptyMessage:h,ariaLabel:x,disabled:p,className:b,showSelectedDetails:j=!1,allowCustomValue:g=!1,clearLabel:f}){let[v,T]=(0,s.useState)(!1),[C,w]=(0,s.useState)(""),y=(0,s.useCallback)(e=>{e&&e.addEventListener("wheel",e=>e.stopPropagation())},[]),N=d.find(t=>t.value===e),S=N?.label??(e||u),A=C.trim(),L=g&&A.length>0&&!d.some(e=>e.value.toLowerCase()===A.toLowerCase()||e.label.toLowerCase()===A.toLowerCase());return(0,t.jsxs)(n.Popover,{onOpenChange:e=>{T(e),e||w("")},open:v,children:[(0,t.jsx)(n.PopoverTrigger,{asChild:!0,children:(0,t.jsxs)(i.Button,{"aria-expanded":v,"aria-label":x,className:(0,c.cn)("min-w-0 w-full justify-between font-normal",j&&N&&"h-auto min-h-8 py-2",b),disabled:p,role:"combobox",type:"button",variant:"outline",children:[j&&N?(0,t.jsxs)("span",{className:"min-w-0 text-left",children:[(0,t.jsx)("span",{className:"block truncate",children:N.label}),N.description&&(0,t.jsx)("span",{className:"block truncate text-xs text-muted-foreground",children:N.description}),N.secondaryDescription&&(0,t.jsx)("span",{className:"block truncate text-xs text-muted-foreground",children:N.secondaryDescription})]}):(0,t.jsx)("span",{className:"min-w-0 truncate",children:S}),(0,t.jsx)(a.ChevronsUpDown,{className:"shrink-0 opacity-50"})]})}),(0,t.jsx)(n.PopoverContent,{ref:y,align:"start",className:"z-70 max-h-[min(24rem,var(--radix-popover-content-available-height))] w-(--radix-popover-trigger-width) overflow-hidden p-0",children:(0,t.jsxs)(r.Command,{className:"min-h-0",label:m,children:[(0,t.jsx)(r.CommandInput,{"aria-label":m,autoFocus:!0,onValueChange:w,placeholder:m,value:C}),(0,t.jsxs)(r.CommandList,{className:"min-h-0 flex-1 max-h-64 overscroll-contain [scrollbar-width:thin] [&::-webkit-scrollbar]:block [&::-webkit-scrollbar]:w-2 [&::-webkit-scrollbar-thumb]:rounded-full [&::-webkit-scrollbar-thumb]:bg-border",children:[(0,t.jsx)(r.CommandEmpty,{children:h}),(0,t.jsxs)(r.CommandGroup,{children:[f&&e&&(0,t.jsx)(r.CommandItem,{"aria-label":f,onSelect:()=>{o(""),w(""),T(!1)},value:"__clear_selection__",children:f}),L&&(0,t.jsx)(r.CommandItem,{"aria-label":A,onSelect:()=>{o(A),w(""),T(!1)},value:A,children:(0,t.jsx)(l.Item,{className:"min-w-0 flex-1 border-0 p-0",size:"xs",children:(0,t.jsx)(l.ItemContent,{className:"min-w-0",children:(0,t.jsx)(l.ItemTitle,{className:"block truncate",children:A})})})}),d.map(a=>(0,t.jsx)(r.CommandItem,{"aria-label":[a.label,a.description,a.secondaryDescription].filter(Boolean).join(", "),"aria-selected":a.value===e,className:"items-start py-2","data-checked":a.value===e,disabled:a.disabled,keywords:[a.label,a.description??"",a.secondaryDescription??"",a.keywords??""],onSelect:()=>{o(a.value),w(""),T(!1)},value:a.value,children:(0,t.jsx)(l.Item,{className:"min-w-0 flex-1 border-0 p-0",size:"xs",children:(0,t.jsxs)(l.ItemContent,{className:"min-w-0",children:[(0,t.jsx)(l.ItemTitle,{className:"block truncate",children:a.label}),a.description&&(0,t.jsx)(l.ItemDescription,{className:"block truncate",children:a.description}),a.secondaryDescription&&(0,t.jsx)(l.ItemDescription,{className:"block truncate",children:a.secondaryDescription})]})})},a.value))]})]})]})})]})}])},900278,e=>{"use strict";var t=e.i(843476),a=e.i(809584),s=e.i(482022),i=e.i(77071),r=e.i(741120),l=e.i(856522),n=e.i(573474),c=e.i(861745),o=e.i(948148),d=e.i(271645),u=e.i(816484),m=e.i(983913),h=e.i(340953),x=e.i(929592),p=e.i(487486),b=e.i(519455),j=e.i(515288),g=e.i(82612),f=e.i(436589),v=e.i(793479),T=e.i(110204),C=e.i(967489),w=e.i(987968),y=e.i(784774),N=e.i(520133),S=e.i(637611),A=e.i(360583);let L="window total live cache errors averageMs pointsUsed pointsAvoided",E=["ALL","GRAPHQL","REST"],H=["ALL","LIVE","CACHE"],R=["ALL","GITHUB_API","GITHUB_SETTINGS","COMMENTS_PAGE","CODEBASE_REPOSITORY","PULL_REQUESTS_PAGE","PULL_REQUEST_DETAILS","ACTIONS_PAGE","WORKTREES","WORKTREE_PIPELINES","WORKTREE_AUTOMATION","AUTO_RETRY","WORKFLOW_AUTOMATION","ACTIONS_NOTIFICATIONS","CACHE_MANAGEMENT"];function O(e){return"LIVE"===e?"border-blue-500/30 bg-blue-500/10 text-blue-700 dark:text-blue-300":"ERROR"===e?"border-destructive/30 bg-destructive/10 text-destructive":"border-emerald-500/30 bg-emerald-500/10 text-emerald-700 dark:text-emerald-300"}function k({apiMetrics:e,snapshots:a}){let s=(0,o.useTranslations)("githubCache"),i=a.filter(e=>"graphql"===e.resource),r=a.filter(e=>"graphql"!==e.resource);return(0,t.jsxs)("div",{className:"grid gap-4 xl:grid-cols-2",children:[(0,t.jsx)(I,{title:s("graphqlRateTitle"),description:s("graphqlRateDescription"),metrics:e.find(e=>"GRAPHQL"===e.apiType)?.windows??[],snapshots:i}),(0,t.jsx)(I,{title:s("restRateTitle"),description:s("restRateDescription"),metrics:e.find(e=>"REST"===e.apiType)?.windows??[],snapshots:r})]})}function I({title:e,description:a,metrics:s,snapshots:i}){let r=(0,o.useTranslations)("githubCache");return(0,t.jsx)(M,{title:e,description:a,children:(0,t.jsxs)("div",{children:[0===i.length?(0,t.jsx)(q,{children:r("noRateData")}):(0,t.jsx)("div",{className:`grid gap-3 p-4 ${i.length>1?"sm:grid-cols-2":""}`,children:i.map(e=>{let a,s,i=(a=Date.parse(e.resetAt),!Number.isFinite(s=Date.parse(e.observedAt)-(a-36e5))||s<=0||s>=36e5?e.used:Math.max(e.used,Math.round(36e5*e.used/s)));return(0,t.jsx)(j.Card,{children:(0,t.jsxs)(j.CardContent,{children:[(0,t.jsxs)("div",{className:"flex justify-between",children:[(0,t.jsxs)("span",{className:"font-medium",children:[e.authentication," · ",e.resource]}),(0,t.jsxs)(p.Badge,{variant:"outline",children:[e.remaining," / ",e.limit]})]}),(0,t.jsxs)("dl",{className:"mt-3 grid grid-cols-2 gap-2 text-sm",children:[(0,t.jsx)("dt",{className:"text-muted-foreground",children:r("limit")}),(0,t.jsx)("dd",{children:e.limit}),(0,t.jsx)("dt",{className:"text-muted-foreground",children:r("remaining")}),(0,t.jsx)("dd",{children:e.remaining}),(0,t.jsx)("dt",{className:"text-muted-foreground",children:r("used")}),(0,t.jsx)("dd",{children:e.used}),(0,t.jsx)("dt",{className:"text-muted-foreground",children:r("estimated")}),(0,t.jsx)("dd",{className:i>e.limit?"font-medium text-destructive":void 0,children:i}),(0,t.jsx)("dt",{className:"text-muted-foreground",children:r("reset")}),(0,t.jsx)("dd",{children:(0,t.jsx)(u.DateTime,{value:e.resetAt})}),(0,t.jsx)("dt",{className:"text-muted-foreground",children:r("resource")}),(0,t.jsx)("dd",{children:e.resource}),(0,t.jsx)("dt",{className:"text-muted-foreground",children:r("observed")}),(0,t.jsx)("dd",{children:(0,t.jsx)(u.DateTime,{value:e.observedAt})})]})]})},`${e.authentication}-${e.resource}`)})}),(0,t.jsx)("div",{className:"grid grid-cols-2 gap-3 border-t p-4",children:s.map(e=>(0,t.jsx)(D,{metric:e},e.window))})]})})}function D({metric:e}){let s=(0,o.useTranslations)("githubCache");return(0,t.jsx)(j.Card,{children:(0,t.jsxs)(j.CardContent,{children:[(0,t.jsxs)("div",{className:"flex items-center justify-between",children:[(0,t.jsx)("span",{className:"font-medium",children:e.window}),(0,t.jsx)(a.Database,{className:"size-4 text-muted-foreground"})]}),(0,t.jsx)("p",{className:"mt-3 text-3xl font-semibold",children:e.total}),(0,t.jsx)("p",{className:"text-xs text-muted-foreground",children:s("average",{ms:e.averageMs})}),(0,t.jsxs)("div",{className:"mt-3 grid grid-cols-3 gap-2 text-xs",children:[(0,t.jsxs)("span",{children:[s("live")," ",e.live]}),(0,t.jsxs)("span",{children:[s("cache")," ",e.cache]}),(0,t.jsxs)("span",{children:[s("errors")," ",e.errors]})]}),(0,t.jsx)("p",{className:"mt-2 text-xs text-muted-foreground",children:s("points",{used:e.pointsUsed,avoided:e.pointsAvoided})})]})})}function $({metric:e}){return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("span",{className:"font-medium",children:e.total}),(0,t.jsxs)("span",{className:"ml-2 text-xs text-muted-foreground",children:["L ",e.live," · C ",e.cache," · E ",e.errors," · P"," ",e.pointsUsed,"/",e.pointsAvoided]})]})}function M({title:e,description:a,action:s,children:i}){return(0,t.jsxs)(j.Card,{className:"gap-0 py-0",children:[(0,t.jsxs)(j.CardHeader,{children:[(0,t.jsx)(j.CardTitle,{children:e}),(0,t.jsx)(j.CardDescription,{children:a}),s&&(0,t.jsx)(j.CardAction,{children:s})]}),i]})}function q({children:e}){return(0,t.jsx)(g.Empty,{className:"py-8",children:(0,t.jsx)(g.EmptyHeader,{children:(0,t.jsx)(g.EmptyDescription,{children:e})})})}function B({offset:e,setOffset:a,total:s}){let i=(0,o.useTranslations)("githubCache");return(0,t.jsxs)("div",{className:"flex items-center justify-between border-t p-3 text-sm",children:[(0,t.jsx)("span",{className:"text-muted-foreground",children:i("showing",{start:0===s?0:e+1,end:Math.min(e+50,s),total:s})}),(0,t.jsxs)("div",{className:"flex gap-2",children:[(0,t.jsx)(b.Button,{disabled:0===e,onClick:()=>a(Math.max(0,e-50)),size:"sm",variant:"outline",children:i("previous")}),(0,t.jsx)(b.Button,{disabled:e+50>=s,onClick:()=>a(e+50),size:"sm",variant:"outline",children:i("next")})]})]})}e.s(["GitHubCachePage",0,function(){let e=(0,o.useTranslations)("githubCache"),a=(0,o.useTranslations)("common"),j=(0,c.useLocale)(),[g,I]=(0,d.useState)(null),[D,P]=(0,d.useState)("5"),[G,_]=(0,d.useState)(""),[U,z]=(0,d.useState)("60"),[F,V]=(0,d.useState)({}),[K,W]=(0,d.useState)(0),[Q,J]=(0,d.useState)(0),[Y,X]=(0,d.useState)("ALL"),[Z,ee]=(0,d.useState)("ALL"),[et,ea]=(0,d.useState)("ALL"),[es,ei]=(0,d.useState)(!0),[er,el]=(0,d.useState)(null),[en,ec]=(0,d.useState)(null),eo=(0,d.useCallback)(async()=>{ei(!0);try{let e=await (0,S.controlPlaneRequest)(`query GitHubCachePage($limit: Int!, $callOffset: Int!, $entryOffset: Int!, $apiType: GitHubApiType, $requestSource: GitHubRequestSource, $callSource: GitHubCallSource) {
2
2
  githubSettings { tokenConfigured defaultJiraKeyRegex actionsNotificationPollIntervalSeconds cacheTtlSeconds updatedAt }
3
3
  githubCacheTtlOverrides { operation ttlSeconds builtIn createdAt updatedAt }
4
4
  githubCacheableGraphqlOperations
@@ -36,7 +36,7 @@
36
36
  files { path previousPath changeType additions deletions binary image }
37
37
  patch image binary truncated beforeAvailable afterAvailable
38
38
  }
39
- }`;e.s(["CODEBASE_FIELDS",0,r,"INSPECT_WORKTREE_DIFF_MUTATION",0,l,"INSPECT_WORKTREE_MUTATION",0,s,"WORKTREE_FIELDS",0,a],455329)},741120,e=>{"use strict";let t=(0,e.i(456420).default)("refresh-cw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]]);e.s(["RefreshCw",0,t],741120)},978740,e=>{"use strict";var t=e.i(843476),a=e.i(975157);e.s(["CoverageValue",0,function({className:e,percent:r,size:s="compact",value:l}){if("number"!=typeof l)return(0,t.jsx)(t.Fragment,{children:"—"});let i=Math.max(0,Math.min(1,l));return(0,t.jsxs)("span",{className:(0,a.cn)("inline-flex items-center tabular-nums","metric"===s?"gap-2 text-2xl font-semibold":"gap-1.5",e),children:[r(l),(0,t.jsx)("span",{"aria-hidden":"true",className:(0,a.cn)("shrink-0 rounded-full ring-1 ring-foreground/10","metric"===s?"size-7":"size-3.5",i>=.8?"text-emerald-500":i>=.5?"text-amber-500":"text-red-500"),"data-coverage-indicator":!0,style:{background:`conic-gradient(currentColor ${360*i}deg, var(--muted) 0deg)`}})]})}])},983913,e=>{"use strict";var t=e.i(843476),a=e.i(563707),r=e.i(271645),s=e.i(519455),l=e.i(317056),i=e.i(906197),n=e.i(337822),o=e.i(975157);e.s(["SearchableSelect",0,function({value:e,onValueChange:d,options:c,placeholder:u,searchPlaceholder:h,emptyMessage:p,ariaLabel:g,disabled:m,className:f,showSelectedDetails:x=!1,allowCustomValue:v=!1}){let[b,j]=(0,r.useState)(!1),[C,y]=(0,r.useState)(""),w=(0,r.useCallback)(e=>{e&&e.addEventListener("wheel",e=>e.stopPropagation())},[]),k=c.find(t=>t.value===e),S=k?.label??(e||u),N=C.trim(),I=v&&N.length>0&&!c.some(e=>e.value.toLowerCase()===N.toLowerCase()||e.label.toLowerCase()===N.toLowerCase());return(0,t.jsxs)(n.Popover,{onOpenChange:e=>{j(e),e||y("")},open:b,children:[(0,t.jsx)(n.PopoverTrigger,{asChild:!0,children:(0,t.jsxs)(s.Button,{"aria-expanded":b,"aria-label":g,className:(0,o.cn)("min-w-0 w-full justify-between font-normal",x&&k&&"h-auto min-h-8 py-2",f),disabled:m,role:"combobox",type:"button",variant:"outline",children:[x&&k?(0,t.jsxs)("span",{className:"min-w-0 text-left",children:[(0,t.jsx)("span",{className:"block truncate",children:k.label}),k.description&&(0,t.jsx)("span",{className:"block truncate text-xs text-muted-foreground",children:k.description}),k.secondaryDescription&&(0,t.jsx)("span",{className:"block truncate text-xs text-muted-foreground",children:k.secondaryDescription})]}):(0,t.jsx)("span",{className:"min-w-0 truncate",children:S}),(0,t.jsx)(a.ChevronsUpDown,{className:"shrink-0 opacity-50"})]})}),(0,t.jsx)(n.PopoverContent,{ref:w,align:"start",className:"z-70 max-h-[min(24rem,var(--radix-popover-content-available-height))] w-(--radix-popover-trigger-width) overflow-hidden p-0",children:(0,t.jsxs)(l.Command,{className:"min-h-0",label:h,children:[(0,t.jsx)(l.CommandInput,{"aria-label":h,autoFocus:!0,onValueChange:y,placeholder:h,value:C}),(0,t.jsxs)(l.CommandList,{className:"min-h-0 flex-1 max-h-64 overscroll-contain [scrollbar-width:thin] [&::-webkit-scrollbar]:block [&::-webkit-scrollbar]:w-2 [&::-webkit-scrollbar-thumb]:rounded-full [&::-webkit-scrollbar-thumb]:bg-border",children:[(0,t.jsx)(l.CommandEmpty,{children:p}),(0,t.jsxs)(l.CommandGroup,{children:[I&&(0,t.jsx)(l.CommandItem,{"aria-label":N,onSelect:()=>{d(N),y(""),j(!1)},value:N,children:(0,t.jsx)(i.Item,{className:"min-w-0 flex-1 border-0 p-0",size:"xs",children:(0,t.jsx)(i.ItemContent,{className:"min-w-0",children:(0,t.jsx)(i.ItemTitle,{className:"block truncate",children:N})})})}),c.map(a=>(0,t.jsx)(l.CommandItem,{"aria-label":[a.label,a.description,a.secondaryDescription].filter(Boolean).join(", "),"aria-selected":a.value===e,className:"items-start py-2","data-checked":a.value===e,disabled:a.disabled,keywords:[a.label,a.description??"",a.secondaryDescription??"",a.keywords??""],onSelect:()=>{d(a.value),y(""),j(!1)},value:a.value,children:(0,t.jsx)(i.Item,{className:"min-w-0 flex-1 border-0 p-0",size:"xs",children:(0,t.jsxs)(i.ItemContent,{className:"min-w-0",children:[(0,t.jsx)(i.ItemTitle,{className:"block truncate",children:a.label}),a.description&&(0,t.jsx)(i.ItemDescription,{className:"block truncate",children:a.description}),a.secondaryDescription&&(0,t.jsx)(i.ItemDescription,{className:"block truncate",children:a.secondaryDescription})]})})},a.value))]})]})]})})]})}])},845935,e=>{"use strict";var t=e.i(843476),a=e.i(271645),r=e.i(871091),s=e.i(741120),l=e.i(948148),i=e.i(983913),n=e.i(929592),o=e.i(519455),d=e.i(980376),c=e.i(987968),u=e.i(677572),h=e.i(462777),p=e.i(637611),g=e.i(816484),m=e.i(975157);function f({commits:e,onSelect:a,selectedSha:r,truncated:s}){let i=(0,l.useTranslations)("diffs");return e.length?(0,t.jsxs)("div",{className:"space-y-1",children:[(0,t.jsxs)("p",{className:"text-xs font-medium text-muted-foreground uppercase",children:[i("commits"),s?` \xb7 ${i("fileListTruncated")}`:""]}),(0,t.jsx)("ul",{className:"max-h-64 space-y-0.5 overflow-y-auto",children:e.map(e=>(0,t.jsx)("li",{children:(0,t.jsxs)("button",{"aria-current":e.sha===r,className:(0,m.cn)("w-full rounded-md px-2 py-1.5 text-left hover:bg-accent",e.sha===r&&"bg-accent"),onClick:()=>a(e.sha),type:"button",children:[(0,t.jsx)("span",{className:"block truncate text-sm",title:e.subject,children:e.subject}),(0,t.jsxs)("span",{className:"flex items-center gap-2 text-[0.7rem] text-muted-foreground",children:[(0,t.jsx)("code",{children:e.sha.slice(0,7)}),(0,t.jsx)("span",{className:"truncate",children:e.authorName}),(0,t.jsx)(g.DateTime,{value:e.authoredAt})]})]})},e.sha))})]}):(0,t.jsx)("p",{className:"px-2 py-4 text-sm text-muted-foreground",children:i("noCommits")})}var x=e.i(861745),v=e.i(967489),b=e.i(360583);let j="none";function C(e){return null===e?null:`${Math.round(100*e)}%`}function y({loading:e,onSelect:a,reports:r,selectedId:s,stale:i}){let n=(0,l.useTranslations)("diffs"),o=(0,x.useLocale)();return r.length?(0,t.jsxs)("div",{className:"flex flex-col items-start gap-1",children:[(0,t.jsxs)(v.Select,{onValueChange:a,value:s||j,children:[(0,t.jsx)(v.SelectTrigger,{"aria-label":n("selectCoverageReport"),className:"w-72",children:(0,t.jsx)(v.SelectValue,{placeholder:n("noCoverageOverlay")})}),(0,t.jsxs)(v.SelectContent,{children:[(0,t.jsx)(v.SelectItem,{value:j,children:n("noCoverageOverlay")}),r.map(e=>{let a,r,s;return(0,t.jsx)(v.SelectItem,{value:e.id,children:(a=(0,b.formatDateValue)(e.finishedAt??e.createdAt,"short",{locale:o}),r=C(e.lineCoverage),s=C(e.changedLineCoverage),[a,r&&n("coverageOverall",{percent:r}),s&&n("coverageChanged",{percent:s})].filter(Boolean).join(" · "))},e.id)})]})]}),e?(0,t.jsx)("p",{className:"text-xs text-muted-foreground",children:n("loadingCoverage")}):i?(0,t.jsx)("p",{className:"text-xs text-muted-foreground",children:n("coverageStale")}):null]}):null}var w=e.i(635416),k=e.i(96892),S=e.i(716327),N=e.i(867927),I=e.i(434322),T=e.i(726067),A=e.i(569644),D=e.i(550420),R=e.i(566595),P=e.i(978740),M=e.i(487486),E=e.i(793479),z=e.i(746798);let L=["name","module","coverage","additions","deletions","changeType"];function O(e){return"number"==typeof e?`${Math.round(100*e)}%`:"—"}function $(e){let t=e.lastIndexOf("/");return -1===t?e:e.slice(t+1)}function F({byCoverage:e,depth:a,file:r,onSelect:s,selected:l,showCoverage:i}){return(0,t.jsxs)(z.Tooltip,{children:[(0,t.jsx)(z.TooltipTrigger,{asChild:!0,children:(0,t.jsxs)("button",{"aria-current":l,className:(0,m.cn)("flex w-full items-center gap-2 rounded-md py-1.5 pr-2 text-left hover:bg-accent",l&&"bg-accent"),onClick:()=>s(r),style:{paddingLeft:12*a+8},type:"button",children:[r.image?(0,t.jsx)(D.Images,{className:"size-4 shrink-0 text-muted-foreground"}):(0,t.jsx)(I.FileCode2,{className:"size-4 shrink-0 text-muted-foreground"}),(0,t.jsxs)("span",{className:"min-w-0 flex-1",children:[(0,t.jsx)("span",{className:"block truncate font-mono text-xs",children:$(r.path)}),(r.module||i&&!e&&null!==r.lineCoverage)&&(0,t.jsxs)("span",{className:"block truncate text-[0.7rem] text-muted-foreground",children:[r.module,r.module&&i&&!e&&null!==r.lineCoverage?" · ":"",i&&!e&&null!==r.lineCoverage?`${Math.round(100*r.lineCoverage)}%`:""]})]}),e?(0,t.jsx)(P.CoverageValue,{className:"shrink-0 text-[0.7rem]",percent:O,value:r.lineCoverage}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(M.Badge,{className:"h-5 shrink-0 px-1.5",variant:"outline",children:r.changeType}),(0,t.jsxs)("span",{className:"shrink-0 text-[0.7rem] tabular-nums",children:[(0,t.jsxs)("span",{className:"text-diff-add-foreground",children:["+",r.additions??0]})," ",(0,t.jsxs)("span",{className:"text-diff-delete-foreground",children:["−",r.deletions??0]})]})]})]})}),(0,t.jsx)(z.TooltipContent,{className:"font-mono",side:"right",children:(0,t.jsx)("span",{className:"block break-all",children:$(r.path)})})]})}function W({byCoverage:e,collapsed:a,depth:r,nodes:s,onSelect:l,onToggle:i,selectedKey:n,showCoverage:o}){return(0,t.jsx)(t.Fragment,{children:s.map(s=>{if("file"===s.type)return(0,t.jsx)("li",{children:(0,t.jsx)(F,{byCoverage:e,depth:r,file:s.file,onSelect:l,selected:s.file.key===n,showCoverage:o})},s.file.key);let d=!a(s.path);return(0,t.jsxs)("li",{children:[(0,t.jsxs)("button",{"aria-expanded":d,className:"flex w-full items-center gap-2 rounded-md py-1.5 pr-2 text-left hover:bg-accent",onClick:()=>i(s.path),style:{paddingLeft:12*r+8},type:"button",children:[d?(0,t.jsx)(S.ChevronDown,{className:"size-3.5 shrink-0 text-muted-foreground"}):(0,t.jsx)(N.ChevronRight,{className:"size-3.5 shrink-0 text-muted-foreground"}),d?(0,t.jsx)(A.FolderOpen,{className:"size-4 shrink-0 text-muted-foreground"}):(0,t.jsx)(T.Folder,{className:"size-4 shrink-0 text-muted-foreground"}),(0,t.jsx)("span",{className:"min-w-0 flex-1 truncate font-mono text-xs font-medium",title:s.path,children:s.label}),(0,t.jsx)("span",{className:"shrink-0 text-[0.7rem] text-muted-foreground tabular-nums",children:function e(t){return"file"===t.type?1:t.children.reduce((t,a)=>t+e(a),0)}(s)})]}),d&&(0,t.jsx)("ul",{className:"space-y-0.5",children:(0,t.jsx)(W,{byCoverage:e,collapsed:a,depth:r+1,nodes:s.children,onSelect:l,onToggle:i,selectedKey:n,showCoverage:o})})]},s.path)})})}function q({files:e,onSelect:r,selectedKey:s,showCoverage:i,truncated:n}){let d=(0,l.useTranslations)("diffs"),[c,u]=(0,a.useState)(""),[h,p]=(0,a.useState)("name"),[g,m]=(0,a.useState)("asc"),[f,x]=(0,a.useState)(new Set),b=(0,a.useMemo)(()=>{let t=c.trim().toLocaleLowerCase();return[...t?e.filter(e=>e.path.toLocaleLowerCase().includes(t)||(e.module??"").toLocaleLowerCase().includes(t)):e].sort((e,t)=>{if("coverage"===h&&null===e.lineCoverage!=(null===t.lineCoverage))return null===e.lineCoverage?1:-1;let a=function(e,t,a){switch(a){case"module":return(e.module??"").localeCompare(t.module??"");case"coverage":return(e.lineCoverage??0)-(t.lineCoverage??0);case"additions":return(e.additions??0)-(t.additions??0);case"deletions":return(e.deletions??0)-(t.deletions??0);case"changeType":return e.changeType.localeCompare(t.changeType);default:return e.path.localeCompare(t.path)}}(e,t,h);return 0!==a?"asc"===g?a:-a:e.path.localeCompare(t.path)})},[g,e,c,h]),j=(0,a.useMemo)(()=>(function(e){let t={type:"folder",label:"",path:"",children:[]};for(let a of e){let e=a.path.split("/");e.pop();let r=t;for(let t of e){let e=r.path?`${r.path}/${t}`:t,a=r.children.find(t=>"folder"===t.type&&t.path===e);if(a){r=a;continue}let s={type:"folder",label:t,path:e,children:[]};r.children.push(s),r=s}r.children.push({type:"file",file:a})}let a=e=>[...e.children.filter(e=>"folder"===e.type).map(e=>({...e,children:a(e)})),...e.children.filter(e=>"file"===e.type)];return a(t).map(e=>"folder"===e.type?function e(t){let a={...t,children:t.children.map(t=>"folder"===t.type?e(t):t)};for(;1===a.children.length&&"folder"===a.children[0].type;){let e=a.children[0];a={...a,label:`${a.label}/${e.label}`,path:e.path,children:e.children}}return a}(e):e)})(b),[b]),C=c.trim().length>0;return(0,t.jsxs)("div",{className:"flex min-h-0 flex-col gap-2",children:[(0,t.jsxs)("div",{className:"relative",children:[(0,t.jsx)(R.Search,{className:"absolute top-2.5 left-3 size-4 text-muted-foreground"}),(0,t.jsx)(E.Input,{"aria-label":d("searchFiles"),className:"pl-9",onChange:e=>u(e.target.value),placeholder:d("searchFilesPlaceholder"),value:c})]}),(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsxs)(v.Select,{onValueChange:e=>p(e),value:h,children:[(0,t.jsx)(v.SelectTrigger,{"aria-label":d("sortFiles"),className:"h-8 flex-1",children:(0,t.jsx)(v.SelectValue,{})}),(0,t.jsx)(v.SelectContent,{children:L.filter(e=>i||"coverage"!==e).map(e=>(0,t.jsx)(v.SelectItem,{value:e,children:d(`fileSort.${e}`)},e))})]}),(0,t.jsx)(o.Button,{"aria-label":"asc"===g?d("sortAscending"):d("sortDescending"),className:"size-8",onClick:()=>m(e=>"asc"===e?"desc":"asc"),size:"icon",title:"asc"===g?d("sortAscending"):d("sortDescending"),variant:"outline",children:"asc"===g?(0,t.jsx)(k.ArrowUp,{className:"size-4"}):(0,t.jsx)(w.ArrowDown,{className:"size-4"})})]}),(0,t.jsxs)("p",{className:"text-xs text-muted-foreground",children:[d("fileCount",{count:b.length}),n?` \xb7 ${d("fileListTruncated")}`:""]}),(0,t.jsxs)("ul",{"aria-label":d("files"),className:"min-h-0 flex-1 space-y-0.5 overflow-y-auto",children:[(0,t.jsx)(W,{byCoverage:i&&"coverage"===h,collapsed:e=>!C&&f.has(e),depth:0,nodes:j,onSelect:r,onToggle:e=>x(t=>{let a=new Set(t);return a.delete(e)||a.add(e),a}),selectedKey:s,showCoverage:i}),!b.length&&(0,t.jsx)("li",{className:"px-2 py-4 text-sm text-muted-foreground",children:e.length?d("noMatchingFiles"):d("noFiles")})]})]})}var B=e.i(456420);let H=(0,B.default)("columns-2",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M12 3v18",key:"108xh3"}]]),G=(0,B.default)("rows-3",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M21 9H3",key:"1338ky"}],["path",{d:"M21 15H3",key:"9uk58r"}]]),_=(0,B.default)("text-wrap",[["path",{d:"m16 16-3 3 3 3",key:"117b85"}],["path",{d:"M3 12h14.5a1 1 0 0 1 0 7H13",key:"18xa6z"}],["path",{d:"M3 19h6",key:"1ygdsz"}],["path",{d:"M3 5h18",key:"1u36vt"}]]);e.i(983632);var U=e.i(272563),V=e.i(605345),K=e.i(142811),J=e.i(455329);function Y({commitSha:e,coverage:r,coverageStale:s,file:i,mode:n,onModeChange:d,onWrapChange:u,resetToken:g,scope:f,worktreeId:x,wrap:v}){let b=(0,l.useTranslations)("diffs"),j=(0,K.useDiffViewLabels)(),C=(0,K.useImageDiffLabels)(),{value:y,loading:w,error:k}=function(e,t=""){let[r,s]=(0,a.useState)(()=>({diffs:new Map,errors:new Map})),l=e?[t,e.worktreeId,e.scope,e.commitSha??"",e.previousPath??"",e.path??""].join(" "):null,i=l?r.diffs.get(l)??null:null,n=l?r.errors.get(l)??null:null,o=!!l&&!i&&!n;return(0,a.useEffect)(()=>{if(!e||!l||i||n)return;let t=!1,a=window.setTimeout(()=>{(0,p.controlPlaneRequest)(J.INSPECT_WORKTREE_DIFF_MUTATION,{input:{worktreeId:e.worktreeId,scope:e.scope,path:e.path,previousPath:e.previousPath,commitSha:e.commitSha,requestId:(0,h.createClientId)()}}).then(e=>{t||s(t=>({...t,diffs:new Map(t.diffs).set(l,e.inspectWorktreeDiff)}))}).catch(e=>{t||s(t=>({...t,errors:new Map(t.errors).set(l,e instanceof Error?e.message:String(e))}))})},150);return()=>{t=!0,window.clearTimeout(a)}},[l]),{value:i,loading:o,error:n}}(i?{worktreeId:x,scope:f,path:i.path,previousPath:i.previousPath,commitSha:e}:null,g),S=t=>{if(!i)return"";let a=new URLSearchParams({scope:f,path:i.path,side:t});return i.previousPath&&a.set("previousPath",i.previousPath),e&&a.set("commitSha",e),`/api/worktrees/${encodeURIComponent(x)}/diff-image?${a}`};return i?(0,t.jsxs)("div",{className:"flex min-w-0 flex-col gap-3",children:[(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,t.jsxs)("span",{className:"min-w-0 flex-1 truncate font-mono text-sm",title:i.path,children:[i.previousPath&&(0,t.jsxs)("span",{className:"text-muted-foreground",children:[i.previousPath," →"," "]}),i.path]}),(0,t.jsx)(M.Badge,{variant:"outline",children:i.changeType}),null!==i.lineCoverage&&(0,t.jsx)(P.CoverageValue,{className:"text-sm",percent:e=>"number"==typeof e?`${Math.round(100*e)}%`:"—",value:i.lineCoverage}),(0,t.jsxs)("div",{className:"flex items-center gap-1",children:[(0,t.jsx)(o.Button,{"aria-label":b("unifiedView"),"aria-pressed":"UNIFIED"===n,className:(0,m.cn)("UNIFIED"===n&&"bg-accent"),onClick:()=>d("UNIFIED"),size:"icon",title:b("unifiedView"),variant:"outline",children:(0,t.jsx)(G,{className:"size-4"})}),(0,t.jsx)(o.Button,{"aria-label":b("splitView"),"aria-pressed":"SPLIT"===n,className:(0,m.cn)("SPLIT"===n&&"bg-accent"),onClick:()=>d("SPLIT"),size:"icon",title:b("splitView"),variant:"outline",children:(0,t.jsx)(H,{className:"size-4"})}),(0,t.jsx)(o.Button,{"aria-label":b("toggleWrap"),"aria-pressed":v,className:(0,m.cn)(v&&"bg-accent"),onClick:()=>u(!v),size:"icon",title:b("toggleWrap"),variant:"outline",children:(0,t.jsx)(_,{className:"size-4"})})]})]}),w?(0,t.jsxs)("p",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[(0,t.jsx)(c.Spinner,{})," ",b("loadingDiff")]}):k?(0,t.jsx)("p",{className:"text-sm text-destructive",children:k}):y?.image?(0,t.jsx)(U.ImageDiff,{after:y.afterAvailable?S("AFTER"):null,before:y.beforeAvailable?S("BEFORE"):null,labels:C}):y?.patch?(0,t.jsx)(V.PatchDiffView,{coverage:r,coverageStale:s,labels:j,mode:n,patch:y.patch,truncated:y.truncated,wrap:v}):(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:b(y?.truncated?"diffTooLarge":y?.binary?"binaryFile":"noTextChanges")})]}):(0,t.jsx)("div",{className:"flex min-h-64 items-center justify-center rounded-md border text-sm text-muted-foreground",children:b("selectAFile")})}let Z=`query DiffWorktrees {
39
+ }`;e.s(["CODEBASE_FIELDS",0,r,"INSPECT_WORKTREE_DIFF_MUTATION",0,l,"INSPECT_WORKTREE_MUTATION",0,s,"WORKTREE_FIELDS",0,a],455329)},741120,e=>{"use strict";let t=(0,e.i(456420).default)("refresh-cw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]]);e.s(["RefreshCw",0,t],741120)},978740,e=>{"use strict";var t=e.i(843476),a=e.i(975157);e.s(["CoverageValue",0,function({className:e,percent:r,size:s="compact",value:l}){if("number"!=typeof l)return(0,t.jsx)(t.Fragment,{children:"—"});let i=Math.max(0,Math.min(1,l));return(0,t.jsxs)("span",{className:(0,a.cn)("inline-flex items-center tabular-nums","metric"===s?"gap-2 text-2xl font-semibold":"gap-1.5",e),children:[r(l),(0,t.jsx)("span",{"aria-hidden":"true",className:(0,a.cn)("shrink-0 rounded-full ring-1 ring-foreground/10","metric"===s?"size-7":"size-3.5",i>=.8?"text-emerald-500":i>=.5?"text-amber-500":"text-red-500"),"data-coverage-indicator":!0,style:{background:`conic-gradient(currentColor ${360*i}deg, var(--muted) 0deg)`}})]})}])},983913,e=>{"use strict";var t=e.i(843476),a=e.i(563707),r=e.i(271645),s=e.i(519455),l=e.i(317056),i=e.i(906197),n=e.i(337822),o=e.i(975157);e.s(["SearchableSelect",0,function({value:e,onValueChange:d,options:c,placeholder:u,searchPlaceholder:h,emptyMessage:p,ariaLabel:g,disabled:m,className:f,showSelectedDetails:x=!1,allowCustomValue:v=!1,clearLabel:b}){let[j,C]=(0,r.useState)(!1),[y,w]=(0,r.useState)(""),k=(0,r.useCallback)(e=>{e&&e.addEventListener("wheel",e=>e.stopPropagation())},[]),S=c.find(t=>t.value===e),N=S?.label??(e||u),I=y.trim(),T=v&&I.length>0&&!c.some(e=>e.value.toLowerCase()===I.toLowerCase()||e.label.toLowerCase()===I.toLowerCase());return(0,t.jsxs)(n.Popover,{onOpenChange:e=>{C(e),e||w("")},open:j,children:[(0,t.jsx)(n.PopoverTrigger,{asChild:!0,children:(0,t.jsxs)(s.Button,{"aria-expanded":j,"aria-label":g,className:(0,o.cn)("min-w-0 w-full justify-between font-normal",x&&S&&"h-auto min-h-8 py-2",f),disabled:m,role:"combobox",type:"button",variant:"outline",children:[x&&S?(0,t.jsxs)("span",{className:"min-w-0 text-left",children:[(0,t.jsx)("span",{className:"block truncate",children:S.label}),S.description&&(0,t.jsx)("span",{className:"block truncate text-xs text-muted-foreground",children:S.description}),S.secondaryDescription&&(0,t.jsx)("span",{className:"block truncate text-xs text-muted-foreground",children:S.secondaryDescription})]}):(0,t.jsx)("span",{className:"min-w-0 truncate",children:N}),(0,t.jsx)(a.ChevronsUpDown,{className:"shrink-0 opacity-50"})]})}),(0,t.jsx)(n.PopoverContent,{ref:k,align:"start",className:"z-70 max-h-[min(24rem,var(--radix-popover-content-available-height))] w-(--radix-popover-trigger-width) overflow-hidden p-0",children:(0,t.jsxs)(l.Command,{className:"min-h-0",label:h,children:[(0,t.jsx)(l.CommandInput,{"aria-label":h,autoFocus:!0,onValueChange:w,placeholder:h,value:y}),(0,t.jsxs)(l.CommandList,{className:"min-h-0 flex-1 max-h-64 overscroll-contain [scrollbar-width:thin] [&::-webkit-scrollbar]:block [&::-webkit-scrollbar]:w-2 [&::-webkit-scrollbar-thumb]:rounded-full [&::-webkit-scrollbar-thumb]:bg-border",children:[(0,t.jsx)(l.CommandEmpty,{children:p}),(0,t.jsxs)(l.CommandGroup,{children:[b&&e&&(0,t.jsx)(l.CommandItem,{"aria-label":b,onSelect:()=>{d(""),w(""),C(!1)},value:"__clear_selection__",children:b}),T&&(0,t.jsx)(l.CommandItem,{"aria-label":I,onSelect:()=>{d(I),w(""),C(!1)},value:I,children:(0,t.jsx)(i.Item,{className:"min-w-0 flex-1 border-0 p-0",size:"xs",children:(0,t.jsx)(i.ItemContent,{className:"min-w-0",children:(0,t.jsx)(i.ItemTitle,{className:"block truncate",children:I})})})}),c.map(a=>(0,t.jsx)(l.CommandItem,{"aria-label":[a.label,a.description,a.secondaryDescription].filter(Boolean).join(", "),"aria-selected":a.value===e,className:"items-start py-2","data-checked":a.value===e,disabled:a.disabled,keywords:[a.label,a.description??"",a.secondaryDescription??"",a.keywords??""],onSelect:()=>{d(a.value),w(""),C(!1)},value:a.value,children:(0,t.jsx)(i.Item,{className:"min-w-0 flex-1 border-0 p-0",size:"xs",children:(0,t.jsxs)(i.ItemContent,{className:"min-w-0",children:[(0,t.jsx)(i.ItemTitle,{className:"block truncate",children:a.label}),a.description&&(0,t.jsx)(i.ItemDescription,{className:"block truncate",children:a.description}),a.secondaryDescription&&(0,t.jsx)(i.ItemDescription,{className:"block truncate",children:a.secondaryDescription})]})})},a.value))]})]})]})})]})}])},845935,e=>{"use strict";var t=e.i(843476),a=e.i(271645),r=e.i(871091),s=e.i(741120),l=e.i(948148),i=e.i(983913),n=e.i(929592),o=e.i(519455),d=e.i(980376),c=e.i(987968),u=e.i(677572),h=e.i(462777),p=e.i(637611),g=e.i(816484),m=e.i(975157);function f({commits:e,onSelect:a,selectedSha:r,truncated:s}){let i=(0,l.useTranslations)("diffs");return e.length?(0,t.jsxs)("div",{className:"space-y-1",children:[(0,t.jsxs)("p",{className:"text-xs font-medium text-muted-foreground uppercase",children:[i("commits"),s?` \xb7 ${i("fileListTruncated")}`:""]}),(0,t.jsx)("ul",{className:"max-h-64 space-y-0.5 overflow-y-auto",children:e.map(e=>(0,t.jsx)("li",{children:(0,t.jsxs)("button",{"aria-current":e.sha===r,className:(0,m.cn)("w-full rounded-md px-2 py-1.5 text-left hover:bg-accent",e.sha===r&&"bg-accent"),onClick:()=>a(e.sha),type:"button",children:[(0,t.jsx)("span",{className:"block truncate text-sm",title:e.subject,children:e.subject}),(0,t.jsxs)("span",{className:"flex items-center gap-2 text-[0.7rem] text-muted-foreground",children:[(0,t.jsx)("code",{children:e.sha.slice(0,7)}),(0,t.jsx)("span",{className:"truncate",children:e.authorName}),(0,t.jsx)(g.DateTime,{value:e.authoredAt})]})]})},e.sha))})]}):(0,t.jsx)("p",{className:"px-2 py-4 text-sm text-muted-foreground",children:i("noCommits")})}var x=e.i(861745),v=e.i(967489),b=e.i(360583);let j="none";function C(e){return null===e?null:`${Math.round(100*e)}%`}function y({loading:e,onSelect:a,reports:r,selectedId:s,stale:i}){let n=(0,l.useTranslations)("diffs"),o=(0,x.useLocale)();return r.length?(0,t.jsxs)("div",{className:"flex flex-col items-start gap-1",children:[(0,t.jsxs)(v.Select,{onValueChange:a,value:s||j,children:[(0,t.jsx)(v.SelectTrigger,{"aria-label":n("selectCoverageReport"),className:"w-72",children:(0,t.jsx)(v.SelectValue,{placeholder:n("noCoverageOverlay")})}),(0,t.jsxs)(v.SelectContent,{children:[(0,t.jsx)(v.SelectItem,{value:j,children:n("noCoverageOverlay")}),r.map(e=>{let a,r,s;return(0,t.jsx)(v.SelectItem,{value:e.id,children:(a=(0,b.formatDateValue)(e.finishedAt??e.createdAt,"short",{locale:o}),r=C(e.lineCoverage),s=C(e.changedLineCoverage),[a,r&&n("coverageOverall",{percent:r}),s&&n("coverageChanged",{percent:s})].filter(Boolean).join(" · "))},e.id)})]})]}),e?(0,t.jsx)("p",{className:"text-xs text-muted-foreground",children:n("loadingCoverage")}):i?(0,t.jsx)("p",{className:"text-xs text-muted-foreground",children:n("coverageStale")}):null]}):null}var w=e.i(635416),k=e.i(96892),S=e.i(716327),N=e.i(867927),I=e.i(434322),T=e.i(726067),A=e.i(569644),D=e.i(550420),R=e.i(566595),P=e.i(978740),M=e.i(487486),E=e.i(793479),z=e.i(746798);let L=["name","module","coverage","additions","deletions","changeType"];function O(e){return"number"==typeof e?`${Math.round(100*e)}%`:"—"}function $(e){let t=e.lastIndexOf("/");return -1===t?e:e.slice(t+1)}function F({byCoverage:e,depth:a,file:r,onSelect:s,selected:l,showCoverage:i}){return(0,t.jsxs)(z.Tooltip,{children:[(0,t.jsx)(z.TooltipTrigger,{asChild:!0,children:(0,t.jsxs)("button",{"aria-current":l,className:(0,m.cn)("flex w-full items-center gap-2 rounded-md py-1.5 pr-2 text-left hover:bg-accent",l&&"bg-accent"),onClick:()=>s(r),style:{paddingLeft:12*a+8},type:"button",children:[r.image?(0,t.jsx)(D.Images,{className:"size-4 shrink-0 text-muted-foreground"}):(0,t.jsx)(I.FileCode2,{className:"size-4 shrink-0 text-muted-foreground"}),(0,t.jsxs)("span",{className:"min-w-0 flex-1",children:[(0,t.jsx)("span",{className:"block truncate font-mono text-xs",children:$(r.path)}),(r.module||i&&!e&&null!==r.lineCoverage)&&(0,t.jsxs)("span",{className:"block truncate text-[0.7rem] text-muted-foreground",children:[r.module,r.module&&i&&!e&&null!==r.lineCoverage?" · ":"",i&&!e&&null!==r.lineCoverage?`${Math.round(100*r.lineCoverage)}%`:""]})]}),e?(0,t.jsx)(P.CoverageValue,{className:"shrink-0 text-[0.7rem]",percent:O,value:r.lineCoverage}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(M.Badge,{className:"h-5 shrink-0 px-1.5",variant:"outline",children:r.changeType}),(0,t.jsxs)("span",{className:"shrink-0 text-[0.7rem] tabular-nums",children:[(0,t.jsxs)("span",{className:"text-diff-add-foreground",children:["+",r.additions??0]})," ",(0,t.jsxs)("span",{className:"text-diff-delete-foreground",children:["−",r.deletions??0]})]})]})]})}),(0,t.jsx)(z.TooltipContent,{className:"font-mono",side:"right",children:(0,t.jsx)("span",{className:"block break-all",children:$(r.path)})})]})}function W({byCoverage:e,collapsed:a,depth:r,nodes:s,onSelect:l,onToggle:i,selectedKey:n,showCoverage:o}){return(0,t.jsx)(t.Fragment,{children:s.map(s=>{if("file"===s.type)return(0,t.jsx)("li",{children:(0,t.jsx)(F,{byCoverage:e,depth:r,file:s.file,onSelect:l,selected:s.file.key===n,showCoverage:o})},s.file.key);let d=!a(s.path);return(0,t.jsxs)("li",{children:[(0,t.jsxs)("button",{"aria-expanded":d,className:"flex w-full items-center gap-2 rounded-md py-1.5 pr-2 text-left hover:bg-accent",onClick:()=>i(s.path),style:{paddingLeft:12*r+8},type:"button",children:[d?(0,t.jsx)(S.ChevronDown,{className:"size-3.5 shrink-0 text-muted-foreground"}):(0,t.jsx)(N.ChevronRight,{className:"size-3.5 shrink-0 text-muted-foreground"}),d?(0,t.jsx)(A.FolderOpen,{className:"size-4 shrink-0 text-muted-foreground"}):(0,t.jsx)(T.Folder,{className:"size-4 shrink-0 text-muted-foreground"}),(0,t.jsx)("span",{className:"min-w-0 flex-1 truncate font-mono text-xs font-medium",title:s.path,children:s.label}),(0,t.jsx)("span",{className:"shrink-0 text-[0.7rem] text-muted-foreground tabular-nums",children:function e(t){return"file"===t.type?1:t.children.reduce((t,a)=>t+e(a),0)}(s)})]}),d&&(0,t.jsx)("ul",{className:"space-y-0.5",children:(0,t.jsx)(W,{byCoverage:e,collapsed:a,depth:r+1,nodes:s.children,onSelect:l,onToggle:i,selectedKey:n,showCoverage:o})})]},s.path)})})}function _({files:e,onSelect:r,selectedKey:s,showCoverage:i,truncated:n}){let d=(0,l.useTranslations)("diffs"),[c,u]=(0,a.useState)(""),[h,p]=(0,a.useState)("name"),[g,m]=(0,a.useState)("asc"),[f,x]=(0,a.useState)(new Set),b=(0,a.useMemo)(()=>{let t=c.trim().toLocaleLowerCase();return[...t?e.filter(e=>e.path.toLocaleLowerCase().includes(t)||(e.module??"").toLocaleLowerCase().includes(t)):e].sort((e,t)=>{if("coverage"===h&&null===e.lineCoverage!=(null===t.lineCoverage))return null===e.lineCoverage?1:-1;let a=function(e,t,a){switch(a){case"module":return(e.module??"").localeCompare(t.module??"");case"coverage":return(e.lineCoverage??0)-(t.lineCoverage??0);case"additions":return(e.additions??0)-(t.additions??0);case"deletions":return(e.deletions??0)-(t.deletions??0);case"changeType":return e.changeType.localeCompare(t.changeType);default:return e.path.localeCompare(t.path)}}(e,t,h);return 0!==a?"asc"===g?a:-a:e.path.localeCompare(t.path)})},[g,e,c,h]),j=(0,a.useMemo)(()=>(function(e){let t={type:"folder",label:"",path:"",children:[]};for(let a of e){let e=a.path.split("/");e.pop();let r=t;for(let t of e){let e=r.path?`${r.path}/${t}`:t,a=r.children.find(t=>"folder"===t.type&&t.path===e);if(a){r=a;continue}let s={type:"folder",label:t,path:e,children:[]};r.children.push(s),r=s}r.children.push({type:"file",file:a})}let a=e=>[...e.children.filter(e=>"folder"===e.type).map(e=>({...e,children:a(e)})),...e.children.filter(e=>"file"===e.type)];return a(t).map(e=>"folder"===e.type?function e(t){let a={...t,children:t.children.map(t=>"folder"===t.type?e(t):t)};for(;1===a.children.length&&"folder"===a.children[0].type;){let e=a.children[0];a={...a,label:`${a.label}/${e.label}`,path:e.path,children:e.children}}return a}(e):e)})(b),[b]),C=c.trim().length>0;return(0,t.jsxs)("div",{className:"flex min-h-0 flex-col gap-2",children:[(0,t.jsxs)("div",{className:"relative",children:[(0,t.jsx)(R.Search,{className:"absolute top-2.5 left-3 size-4 text-muted-foreground"}),(0,t.jsx)(E.Input,{"aria-label":d("searchFiles"),className:"pl-9",onChange:e=>u(e.target.value),placeholder:d("searchFilesPlaceholder"),value:c})]}),(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsxs)(v.Select,{onValueChange:e=>p(e),value:h,children:[(0,t.jsx)(v.SelectTrigger,{"aria-label":d("sortFiles"),className:"h-8 flex-1",children:(0,t.jsx)(v.SelectValue,{})}),(0,t.jsx)(v.SelectContent,{children:L.filter(e=>i||"coverage"!==e).map(e=>(0,t.jsx)(v.SelectItem,{value:e,children:d(`fileSort.${e}`)},e))})]}),(0,t.jsx)(o.Button,{"aria-label":"asc"===g?d("sortAscending"):d("sortDescending"),className:"size-8",onClick:()=>m(e=>"asc"===e?"desc":"asc"),size:"icon",title:"asc"===g?d("sortAscending"):d("sortDescending"),variant:"outline",children:"asc"===g?(0,t.jsx)(k.ArrowUp,{className:"size-4"}):(0,t.jsx)(w.ArrowDown,{className:"size-4"})})]}),(0,t.jsxs)("p",{className:"text-xs text-muted-foreground",children:[d("fileCount",{count:b.length}),n?` \xb7 ${d("fileListTruncated")}`:""]}),(0,t.jsxs)("ul",{"aria-label":d("files"),className:"min-h-0 flex-1 space-y-0.5 overflow-y-auto",children:[(0,t.jsx)(W,{byCoverage:i&&"coverage"===h,collapsed:e=>!C&&f.has(e),depth:0,nodes:j,onSelect:r,onToggle:e=>x(t=>{let a=new Set(t);return a.delete(e)||a.add(e),a}),selectedKey:s,showCoverage:i}),!b.length&&(0,t.jsx)("li",{className:"px-2 py-4 text-sm text-muted-foreground",children:e.length?d("noMatchingFiles"):d("noFiles")})]})]})}var q=e.i(456420);let B=(0,q.default)("columns-2",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M12 3v18",key:"108xh3"}]]),H=(0,q.default)("rows-3",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M21 9H3",key:"1338ky"}],["path",{d:"M21 15H3",key:"9uk58r"}]]),G=(0,q.default)("text-wrap",[["path",{d:"m16 16-3 3 3 3",key:"117b85"}],["path",{d:"M3 12h14.5a1 1 0 0 1 0 7H13",key:"18xa6z"}],["path",{d:"M3 19h6",key:"1ygdsz"}],["path",{d:"M3 5h18",key:"1u36vt"}]]);e.i(983632);var U=e.i(272563),V=e.i(605345),K=e.i(142811),J=e.i(455329);function Y({commitSha:e,coverage:r,coverageStale:s,file:i,mode:n,onModeChange:d,onWrapChange:u,resetToken:g,scope:f,worktreeId:x,wrap:v}){let b=(0,l.useTranslations)("diffs"),j=(0,K.useDiffViewLabels)(),C=(0,K.useImageDiffLabels)(),{value:y,loading:w,error:k}=function(e,t=""){let[r,s]=(0,a.useState)(()=>({diffs:new Map,errors:new Map})),l=e?[t,e.worktreeId,e.scope,e.commitSha??"",e.previousPath??"",e.path??""].join(" "):null,i=l?r.diffs.get(l)??null:null,n=l?r.errors.get(l)??null:null,o=!!l&&!i&&!n;return(0,a.useEffect)(()=>{if(!e||!l||i||n)return;let t=!1,a=window.setTimeout(()=>{(0,p.controlPlaneRequest)(J.INSPECT_WORKTREE_DIFF_MUTATION,{input:{worktreeId:e.worktreeId,scope:e.scope,path:e.path,previousPath:e.previousPath,commitSha:e.commitSha,requestId:(0,h.createClientId)()}}).then(e=>{t||s(t=>({...t,diffs:new Map(t.diffs).set(l,e.inspectWorktreeDiff)}))}).catch(e=>{t||s(t=>({...t,errors:new Map(t.errors).set(l,e instanceof Error?e.message:String(e))}))})},150);return()=>{t=!0,window.clearTimeout(a)}},[l]),{value:i,loading:o,error:n}}(i?{worktreeId:x,scope:f,path:i.path,previousPath:i.previousPath,commitSha:e}:null,g),S=t=>{if(!i)return"";let a=new URLSearchParams({scope:f,path:i.path,side:t});return i.previousPath&&a.set("previousPath",i.previousPath),e&&a.set("commitSha",e),`/api/worktrees/${encodeURIComponent(x)}/diff-image?${a}`};return i?(0,t.jsxs)("div",{className:"flex min-w-0 flex-col gap-3",children:[(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,t.jsxs)("span",{className:"min-w-0 flex-1 truncate font-mono text-sm",title:i.path,children:[i.previousPath&&(0,t.jsxs)("span",{className:"text-muted-foreground",children:[i.previousPath," →"," "]}),i.path]}),(0,t.jsx)(M.Badge,{variant:"outline",children:i.changeType}),null!==i.lineCoverage&&(0,t.jsx)(P.CoverageValue,{className:"text-sm",percent:e=>"number"==typeof e?`${Math.round(100*e)}%`:"—",value:i.lineCoverage}),(0,t.jsxs)("div",{className:"flex items-center gap-1",children:[(0,t.jsx)(o.Button,{"aria-label":b("unifiedView"),"aria-pressed":"UNIFIED"===n,className:(0,m.cn)("UNIFIED"===n&&"bg-accent"),onClick:()=>d("UNIFIED"),size:"icon",title:b("unifiedView"),variant:"outline",children:(0,t.jsx)(H,{className:"size-4"})}),(0,t.jsx)(o.Button,{"aria-label":b("splitView"),"aria-pressed":"SPLIT"===n,className:(0,m.cn)("SPLIT"===n&&"bg-accent"),onClick:()=>d("SPLIT"),size:"icon",title:b("splitView"),variant:"outline",children:(0,t.jsx)(B,{className:"size-4"})}),(0,t.jsx)(o.Button,{"aria-label":b("toggleWrap"),"aria-pressed":v,className:(0,m.cn)(v&&"bg-accent"),onClick:()=>u(!v),size:"icon",title:b("toggleWrap"),variant:"outline",children:(0,t.jsx)(G,{className:"size-4"})})]})]}),w?(0,t.jsxs)("p",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[(0,t.jsx)(c.Spinner,{})," ",b("loadingDiff")]}):k?(0,t.jsx)("p",{className:"text-sm text-destructive",children:k}):y?.image?(0,t.jsx)(U.ImageDiff,{after:y.afterAvailable?S("AFTER"):null,before:y.beforeAvailable?S("BEFORE"):null,labels:C}):y?.patch?(0,t.jsx)(V.PatchDiffView,{coverage:r,coverageStale:s,labels:j,mode:n,patch:y.patch,truncated:y.truncated,wrap:v}):(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:b(y?.truncated?"diffTooLarge":y?.binary?"binaryFile":"noTextChanges")})]}):(0,t.jsx)("div",{className:"flex min-h-64 items-center justify-center rounded-md border text-sm text-muted-foreground",children:b("selectAFile")})}let Z=`query DiffWorktrees {
40
40
  worktreeOverview {
41
41
  agents {
42
42
  codebases {
@@ -76,4 +76,4 @@
76
76
  changedCoverageFiles { path coveredLineNumbers uncoveredLineNumbers }
77
77
  }
78
78
  }
79
- }`;var et=e.i(640572);let ea=[],er=new Map,es=["STAGED","UNSTAGED","UNTRACKED","BRANCH","COMMIT"];function el(e,t){return!!(e&&t&&e!==t)}e.s(["DiffsPage",0,function({initial:e={}}){let g=(0,l.useTranslations)("diffs"),[m,x]=(0,a.useState)([]),[v,b]=(0,a.useState)(e.worktreeId??""),[C,w]=(0,a.useState)(()=>es.includes(e.scope)?e.scope:"BRANCH"),[k,S]=(0,a.useState)("SPLIT"===e.mode?"SPLIT":"UNIFIED"),[N,I]=(0,a.useState)("0"!==e.wrap),[T,A]=(0,a.useState)(e.path??""),[D,R]=(0,a.useState)(e.commitSha??""),[P,M]=(0,a.useState)(e.coverageReportId??""),[E,z]=(0,a.useState)(null),[L,O]=(0,a.useState)(null),[$,F]=(0,a.useState)(!1),[W,B]=(0,a.useState)(null),[H,G]=(0,a.useState)(""),[_,U]=(0,a.useState)(!1),V=m.find(e=>e.id===v)??null,K=E?.worktreeId===v?E.detail:null,ei=E?.worktreeId===v?E.branchFiles:[],en=!!(v&&E?.worktreeId!==v),eo=function(e){let[t,r]=(0,a.useState)(null);return(0,a.useEffect)(()=>{if(!e)return;let t=!1;return(0,p.controlPlaneRequest)(X,{worktreeId:e}).then(a=>{t||r({worktreeId:e,reports:a.worktreeCoverageReports.filter(e=>"READY"===e.status&&e.build).map(e=>{let t=function(e){if(!e||"object"!=typeof e)return{headSha:null,codeStateHash:null};let t=e.worktree;return t&&"object"==typeof t?{headSha:"string"==typeof t.headSha?t.headSha:null,codeStateHash:"string"==typeof t.codeStateHash?t.codeStateHash:null}:{headSha:null,codeStateHash:null}}(e.build.snapshot);return{id:e.id,buildId:e.build.id,status:e.status,createdAt:e.createdAt,finishedAt:e.finishedAt,lineCoverage:e.coverageSummary?.lineCoverage??null,changedLineCoverage:e.coverageSummary?.changedLineCoverage??null,...t}})})}).catch(()=>{t||r({worktreeId:e,reports:ea})}),()=>{t=!0}},[e]),t?.worktreeId===e?t.reports:ea}(v),ed=eo.find(e=>e.id===P)??null,{files:ec,loading:eu}=function(e,t){let[r,s]=(0,a.useState)(null),[l,i]=(0,a.useState)(""),n=e?.id??"",o=e?.buildId??"";return(0,a.useEffect)(()=>{if(!n||!o)return;let e=!1;return(0,p.controlPlaneRequest)(ee,{buildId:o}).then(a=>{if(e)return;let r=a.build?.reports.find(e=>e.id===n),l=new Map;for(let e of r?.coverageFiles??[])l.set((0,et.relativeCoveragePath)(e.path,t),{lineCoverage:e.lineCoverage,module:e.target||null,covered:new Set,uncovered:new Set});for(let e of r?.changedCoverageFiles??[]){let t=l.get(e.path);l.set(e.path,{lineCoverage:t?.lineCoverage??null,module:t?.module??null,covered:new Set(e.coveredLineNumbers),uncovered:new Set(e.uncoveredLineNumbers)})}s({reportId:n,files:l})}).catch(()=>{e||i(n)}),()=>{e=!0}},[o,n,t]),{files:r?.reportId===n?r.files:er,loading:!!n&&r?.reportId!==n&&l!==n}}(ed,V?.folder??null),eh=!!(ed&&("COMMIT"===C?el(ed.headSha,D):"BRANCH"===C?el(ed.headSha,V?.headSha):ed.codeStateHash||V?.codeStateHash?!ed.codeStateHash||!V?.codeStateHash||el(ed.codeStateHash,V.codeStateHash):el(ed.headSha,V?.headSha)));(0,a.useEffect)(()=>{let e=!1;return(0,p.controlPlaneRequest)(Z).then(t=>{if(e)return;let a=t.worktreeOverview.agents.flatMap(e=>e.codebases.flatMap(e=>e.worktrees.map(t=>({...t,codebaseName:e.repository?.name??e.codebase.folder.split("/").at(-1)??e.codebase.folder}))));x(a),b(e=>e||!a.length?e:a[0].id)}).catch(t=>{e||B(t instanceof Error?t.message:String(t))}),()=>{e=!0}},[]),(0,a.useEffect)(()=>{if(!v)return;let e=!1,t=window.setTimeout(()=>{F(!0),B(null),(0,p.controlPlaneRequest)(Q,{id:v,requestId:(0,h.createClientId)()}).then(t=>{e||z({worktreeId:v,detail:t.inspectWorktree,branchFiles:(t.inspectWorktree.branchChanges??[]).map(e=>({...e,key:`${e.previousPath??""}:${e.path}`,lineCoverage:null,module:null}))})}).catch(t=>{e||(z({worktreeId:v,detail:null,branchFiles:[]}),B(t instanceof Error?t.message:String(t)))}).finally(()=>{e||F(!1)})},0);return()=>{e=!0,window.clearTimeout(t)}},[H,v]),(0,a.useEffect)(()=>{if("COMMIT"!==C||!v||!D)return;let e=!1;return(0,p.controlPlaneRequest)(J.INSPECT_WORKTREE_DIFF_MUTATION,{input:{worktreeId:v,scope:"COMMIT",path:null,previousPath:null,commitSha:D,requestId:(0,h.createClientId)()}}).then(t=>{e||O({worktreeId:v,sha:D,truncated:t.inspectWorktreeDiff.truncated,files:t.inspectWorktreeDiff.files.map(e=>({...e,key:`${e.previousPath??""}:${e.path}`,lineCoverage:null,module:null}))})}).catch(t=>{e||B(t instanceof Error?t.message:String(t))}),()=>{e=!0}},[D,C,v,H]);let ep=L&&L.worktreeId===v&&L.sha===D?L.files:[],eg=!!(L&&L.worktreeId===v&&L.sha===D&&L.truncated),em=(0,a.useMemo)(()=>{let e="BRANCH"===C?ei:"COMMIT"===C?ep:K?K.changes.filter(e=>"STAGED"===C?e.staged:"UNSTAGED"===C?e.unstaged:e.untracked).map(e=>({key:`${e.previousPath??""}:${e.path}`,path:e.path,previousPath:e.previousPath??null,changeType:e.changeType??"M",additions:"STAGED"===C?e.stagedAdditions:e.unstagedAdditions,deletions:"STAGED"===C?e.stagedDeletions:e.unstagedDeletions,binary:!1,image:!1,lineCoverage:null,module:null})):[];return ec.size?e.map(e=>{let t=ec.get(e.path);return t?{...e,lineCoverage:t.lineCoverage,module:t.module}:e}):e},[ei,L,D,ec,K,C]),ef=em.find(e=>e.path===T)??em[0]??null,ex=(0,a.useMemo)(()=>{let e=ef?ec.get(ef.path):void 0;if(e&&(e.covered.size||e.uncovered.size))return t=>e.covered.has(t)?"covered":e.uncovered.has(t)?"uncovered":null},[ec,ef]);(0,a.useEffect)(()=>{let e=new URLSearchParams;v&&e.set("worktree",v),e.set("scope",C),ef&&e.set("path",ef.path),"COMMIT"===C&&D&&e.set("commit",D),P&&e.set("coverage",P),"SPLIT"===k&&e.set("mode",k),N||e.set("wrap","0"),window.history.replaceState(null,"",`${location.pathname}?${e}`)},[D,P,k,C,ef,v,N]);let ev=(0,t.jsxs)("div",{className:"flex min-h-0 flex-col gap-3",children:["COMMIT"===C&&(0,t.jsx)(f,{commits:K?.commits??[],onSelect:e=>{R(e),A("")},selectedSha:D||null,truncated:K?.commitsTruncated??!1}),(0,t.jsx)(q,{files:em,onSelect:e=>{A(e.path),U(!1)},selectedKey:ef?.key??null,showCoverage:!!ed,truncated:"BRANCH"===C?K?.branchChangesTruncated??!1:"COMMIT"===C?eg:K?.changesTruncated??!1})]});return(0,t.jsxs)("div",{className:"flex w-full flex-col gap-6",children:[(0,t.jsxs)("div",{className:"flex flex-wrap items-start justify-between gap-4",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("h1",{className:"text-2xl font-semibold tracking-tight",children:g("title")}),(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:g("description")})]}),(0,t.jsxs)("div",{className:"flex flex-wrap items-start gap-2","data-slot":"diffs-toolbar",children:[(0,t.jsx)(y,{loading:eu,onSelect:e=>M(e===j?"":e),reports:eo,selectedId:P,stale:eh}),(0,t.jsx)(i.SearchableSelect,{ariaLabel:g("selectWorktree"),className:"w-72",emptyMessage:g("noWorktrees"),onValueChange:e=>{b(e),A(""),R("")},options:m.map(e=>({value:e.id,label:e.branch,description:e.codebaseName,secondaryDescription:e.relativePath,keywords:`${e.relativePath} ${e.folder}`})),placeholder:g("selectWorktree"),searchPlaceholder:g("searchWorktrees"),value:v}),(0,t.jsx)(o.Button,{"aria-label":g("refresh"),disabled:!v||$,onClick:()=>G((0,h.createClientId)()),size:"icon",title:g("refresh"),variant:"outline",children:(0,t.jsx)(s.RefreshCw,{className:"size-4"})})]})]}),W&&(0,t.jsx)(n.Alert,{variant:"destructive",children:(0,t.jsx)(n.AlertDescription,{children:W})}),(0,t.jsx)(u.Tabs,{onValueChange:e=>w(e),value:C,children:(0,t.jsx)(u.TabsList,{children:es.map(e=>(0,t.jsx)(u.TabsTrigger,{value:e,children:g(`scope.${e}`)},e))})}),v?($||en)&&!K?(0,t.jsxs)("p",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[(0,t.jsx)(c.Spinner,{})," ",g("loading")]}):(0,t.jsxs)("div",{className:"grid gap-4 md:grid-cols-[minmax(16rem,20rem)_minmax(0,1fr)]",children:[(0,t.jsx)("aside",{className:"sticky top-0 hidden max-h-[calc(100dvh-10rem)] min-h-0 md:flex md:flex-col",children:ev}),(0,t.jsx)("div",{className:"md:hidden",children:(0,t.jsxs)(d.Sheet,{onOpenChange:U,open:_,children:[(0,t.jsx)(d.SheetTrigger,{asChild:!0,children:(0,t.jsxs)(o.Button,{variant:"outline",children:[(0,t.jsx)(r.PanelLeft,{className:"size-4"})," ",g("files")]})}),(0,t.jsxs)(d.SheetContent,{className:"flex w-[min(22rem,90vw)] flex-col gap-3 p-4",side:"left",children:[(0,t.jsx)(d.SheetHeader,{className:"p-0",children:(0,t.jsx)(d.SheetTitle,{children:g("files")})}),ev]})]})}),(0,t.jsx)(Y,{commitSha:"COMMIT"===C&&D||null,coverage:ex,coverageStale:eh,file:ef,mode:k,onModeChange:S,onWrapChange:I,resetToken:`${v}:${H}`,scope:C,worktreeId:v,wrap:N})]}):(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:g("selectAWorktree")}),V?.pullRequest&&(0,t.jsx)("p",{className:"text-xs text-muted-foreground",children:g("linkedPullRequest",{number:V.pullRequest.number,title:V.pullRequest.title})})]})}],845935)},808562,e=>{"use strict";var t=e.i(843476),a=e.i(271645),r=e.i(30030),s=e.i(248425),l=e.i(842727),i=e.i(981140),n=e.i(369340),o=Object.defineProperty,d=a.forwardRef(o(function(e,a){let{pressed:r,defaultPressed:l,onPressedChange:o,...d}=e,[c,u]=(0,n.useControllableState)({prop:r,onChange:o,defaultProp:l??!1,caller:"Toggle"});return(0,t.jsx)(s.Primitive.button,{type:"button","aria-pressed":c,"data-state":c?"on":"off","data-disabled":e.disabled?"":void 0,...d,ref:a,onClick:(0,i.composeEventHandlers)(e.onClick,()=>{e.disabled||u(!c)})})},"name",{value:"Toggle",configurable:!0})),c=e.i(586318),u=Object.defineProperty,h=(e,t)=>u(e,"name",{value:t,configurable:!0}),p="ToggleGroup",[g,m]=(0,r.createContextScope)(p,[l.createRovingFocusGroupScope]),f=(0,l.createRovingFocusGroupScope)(),x=a.forwardRef(h(function(e,a){let{type:r,...s}=e;if("single"===r)return(0,t.jsx)(j,{role:"radiogroup",...s,ref:a});if("multiple"===r)return(0,t.jsx)(C,{role:"toolbar",...s,ref:a});throw Error(`Missing prop \`type\` expected on \`${p}\``)},"ToggleGroup")),[v,b]=g(p),j=a.forwardRef(h(function(e,r){let{value:s,defaultValue:l,onValueChange:i=h(()=>{},"onValueChange"),...o}=e,[d,c]=(0,n.useControllableState)({prop:s,defaultProp:l??"",onChange:i,caller:p});return(0,t.jsx)(v,{scope:e.__scopeToggleGroup,type:"single",value:a.useMemo(()=>d?[d]:[],[d]),onItemActivate:c,onItemDeactivate:a.useCallback(()=>c(""),[c]),children:(0,t.jsx)(k,{...o,ref:r})})},"ToggleGroupImplSingle")),C=a.forwardRef(h(function(e,r){let{value:s,defaultValue:l,onValueChange:i=h(()=>{},"onValueChange"),...o}=e,[d,c]=(0,n.useControllableState)({prop:s,defaultProp:l??[],onChange:i,caller:p}),u=a.useCallback(e=>c((t=[])=>[...t,e]),[c]),g=a.useCallback(e=>c((t=[])=>t.filter(t=>t!==e)),[c]);return(0,t.jsx)(v,{scope:e.__scopeToggleGroup,type:"multiple",value:d,onItemActivate:u,onItemDeactivate:g,children:(0,t.jsx)(k,{...o,ref:r})})},"ToggleGroupImplMultiple")),[y,w]=g(p),k=a.forwardRef(h(function(e,a){let{__scopeToggleGroup:r,disabled:i=!1,rovingFocus:n=!0,orientation:o,dir:d,loop:u=!0,...h}=e,p=f(r),g=(0,c.useDirection)(d),m={dir:g,...h};return(0,t.jsx)(y,{scope:r,rovingFocus:n,disabled:i,children:n?(0,t.jsx)(l.Root,{asChild:!0,...p,orientation:o,dir:g,loop:u,children:(0,t.jsx)(s.Primitive.div,{...m,ref:a})}):(0,t.jsx)(s.Primitive.div,{...m,ref:a})})},"ToggleGroupImpl")),S="ToggleGroupItem",N=a.forwardRef(h(function(e,r){let s=b(S,e.__scopeToggleGroup),i=w(S,e.__scopeToggleGroup),n=f(e.__scopeToggleGroup),o=s.value.includes(e.value),d=i.disabled||e.disabled,c={...e,pressed:o,disabled:d},u=a.useRef(null);return i.rovingFocus?(0,t.jsx)(l.Item,{asChild:!0,...n,focusable:!d,active:o,ref:u,children:(0,t.jsx)(I,{...c,ref:r})}):(0,t.jsx)(I,{...c,ref:r})},"ToggleGroupItem")),I=a.forwardRef(h(function(e,a){let{__scopeToggleGroup:r,value:s,...l}=e,i=b(S,r),n={role:"radio","aria-checked":e.pressed,"aria-pressed":void 0},o="single"===i.type?n:void 0;return(0,t.jsx)(d,{...o,...l,ref:a,onPressedChange:e=>{e?i.onItemActivate(s):i.onItemDeactivate(s)}})},"ToggleGroupItemImpl"));e.s(["Item",0,N,"Root",0,x,"ToggleGroup",0,x,"ToggleGroupItem",0,N,"createToggleGroupScope",0,m],459881);var T=e.i(459881),T=T,A=e.i(975157),D=e.i(225913),R=Object.defineProperty,P=a.forwardRef(R(function(e,a){let{pressed:r,defaultPressed:l,onPressedChange:o,...d}=e,[c,u]=(0,n.useControllableState)({prop:r,onChange:o,defaultProp:l??!1,caller:"Toggle"});return(0,t.jsx)(s.Primitive.button,{type:"button","aria-pressed":c,"data-state":c?"on":"off","data-disabled":e.disabled?"":void 0,...d,ref:a,onClick:(0,i.composeEventHandlers)(e.onClick,()=>{e.disabled||u(!c)})})},"name",{value:"Toggle",configurable:!0}));e.s(["Root",0,P,"Toggle",0,P],864225),e.i(864225);let M=(0,D.cva)("group/toggle inline-flex items-center justify-center gap-1 rounded-lg text-sm font-medium whitespace-nowrap transition-all outline-none hover:bg-muted hover:text-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 aria-pressed:bg-muted data-[state=on]:bg-muted dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",{variants:{variant:{default:"bg-transparent",outline:"border border-input bg-transparent hover:bg-muted"},size:{default:"h-8 min-w-8 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2",sm:"h-7 min-w-7 rounded-[min(var(--radius-md),12px)] px-2.5 text-[0.8rem] has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3.5",lg:"h-9 min-w-9 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2"}},defaultVariants:{variant:"default",size:"default"}}),E=a.createContext({size:"default",variant:"default",spacing:2,orientation:"horizontal"});e.s(["ToggleGroup",0,function({className:e,variant:a,size:r,spacing:s=2,orientation:l="horizontal",children:i,...n}){return(0,t.jsx)(T.Root,{"data-slot":"toggle-group","data-variant":a,"data-size":r,"data-spacing":s,"data-orientation":l,style:{"--gap":s},className:(0,A.cn)("group/toggle-group flex w-fit flex-row items-center gap-[--spacing(var(--gap))] rounded-lg data-[size=sm]:rounded-[min(var(--radius-md),10px)] data-vertical:flex-col data-vertical:items-stretch",e),...n,children:(0,t.jsx)(E.Provider,{value:{variant:a,size:r,spacing:s,orientation:l},children:i})})},"ToggleGroupItem",0,function({className:e,children:r,variant:s="default",size:l="default",...i}){let n=a.useContext(E);return(0,t.jsx)(T.Item,{"data-slot":"toggle-group-item","data-variant":n.variant||s,"data-size":n.size||l,"data-spacing":n.spacing,className:(0,A.cn)("shrink-0 group-data-[spacing=0]/toggle-group:rounded-none group-data-[spacing=0]/toggle-group:px-2 focus:z-10 focus-visible:z-10 group-data-[spacing=0]/toggle-group:has-data-[icon=inline-end]:pr-1.5 group-data-[spacing=0]/toggle-group:has-data-[icon=inline-start]:pl-1.5 group-data-horizontal/toggle-group:data-[spacing=0]:first:rounded-l-lg group-data-vertical/toggle-group:data-[spacing=0]:first:rounded-t-lg group-data-horizontal/toggle-group:data-[spacing=0]:last:rounded-r-lg group-data-vertical/toggle-group:data-[spacing=0]:last:rounded-b-lg group-data-horizontal/toggle-group:data-[spacing=0]:data-[variant=outline]:border-l-0 group-data-vertical/toggle-group:data-[spacing=0]:data-[variant=outline]:border-t-0 group-data-horizontal/toggle-group:data-[spacing=0]:data-[variant=outline]:first:border-l group-data-vertical/toggle-group:data-[spacing=0]:data-[variant=outline]:first:border-t",M({variant:n.variant||s,size:n.size||l}),e),...i,children:r})}],808562)},640572,e=>{"use strict";e.s(["relativeCoveragePath",0,function(e,t){let a=e.replaceAll("\\","/"),r=t?.replaceAll("\\","/").replace(/\/$/,"");return r?a===r?".":a.startsWith(`${r}/`)?a.slice(r.length+1):a:a}])}]);
79
+ }`;var et=e.i(640572);let ea=[],er=new Map,es=["STAGED","UNSTAGED","UNTRACKED","BRANCH","COMMIT"];function el(e,t){return!!(e&&t&&e!==t)}e.s(["DiffsPage",0,function({initial:e={}}){let g=(0,l.useTranslations)("diffs"),[m,x]=(0,a.useState)([]),[v,b]=(0,a.useState)(e.worktreeId??""),[C,w]=(0,a.useState)(()=>es.includes(e.scope)?e.scope:"BRANCH"),[k,S]=(0,a.useState)("SPLIT"===e.mode?"SPLIT":"UNIFIED"),[N,I]=(0,a.useState)("0"!==e.wrap),[T,A]=(0,a.useState)(e.path??""),[D,R]=(0,a.useState)(e.commitSha??""),[P,M]=(0,a.useState)(e.coverageReportId??""),[E,z]=(0,a.useState)(null),[L,O]=(0,a.useState)(null),[$,F]=(0,a.useState)(!1),[W,q]=(0,a.useState)(null),[B,H]=(0,a.useState)(""),[G,U]=(0,a.useState)(!1),V=m.find(e=>e.id===v)??null,K=E?.worktreeId===v?E.detail:null,ei=E?.worktreeId===v?E.branchFiles:[],en=!!(v&&E?.worktreeId!==v),eo=function(e){let[t,r]=(0,a.useState)(null);return(0,a.useEffect)(()=>{if(!e)return;let t=!1;return(0,p.controlPlaneRequest)(X,{worktreeId:e}).then(a=>{t||r({worktreeId:e,reports:a.worktreeCoverageReports.filter(e=>"READY"===e.status&&e.build).map(e=>{let t=function(e){if(!e||"object"!=typeof e)return{headSha:null,codeStateHash:null};let t=e.worktree;return t&&"object"==typeof t?{headSha:"string"==typeof t.headSha?t.headSha:null,codeStateHash:"string"==typeof t.codeStateHash?t.codeStateHash:null}:{headSha:null,codeStateHash:null}}(e.build.snapshot);return{id:e.id,buildId:e.build.id,status:e.status,createdAt:e.createdAt,finishedAt:e.finishedAt,lineCoverage:e.coverageSummary?.lineCoverage??null,changedLineCoverage:e.coverageSummary?.changedLineCoverage??null,...t}})})}).catch(()=>{t||r({worktreeId:e,reports:ea})}),()=>{t=!0}},[e]),t?.worktreeId===e?t.reports:ea}(v),ed=eo.find(e=>e.id===P)??null,{files:ec,loading:eu}=function(e,t){let[r,s]=(0,a.useState)(null),[l,i]=(0,a.useState)(""),n=e?.id??"",o=e?.buildId??"";return(0,a.useEffect)(()=>{if(!n||!o)return;let e=!1;return(0,p.controlPlaneRequest)(ee,{buildId:o}).then(a=>{if(e)return;let r=a.build?.reports.find(e=>e.id===n),l=new Map;for(let e of r?.coverageFiles??[])l.set((0,et.relativeCoveragePath)(e.path,t),{lineCoverage:e.lineCoverage,module:e.target||null,covered:new Set,uncovered:new Set});for(let e of r?.changedCoverageFiles??[]){let t=l.get(e.path);l.set(e.path,{lineCoverage:t?.lineCoverage??null,module:t?.module??null,covered:new Set(e.coveredLineNumbers),uncovered:new Set(e.uncoveredLineNumbers)})}s({reportId:n,files:l})}).catch(()=>{e||i(n)}),()=>{e=!0}},[o,n,t]),{files:r?.reportId===n?r.files:er,loading:!!n&&r?.reportId!==n&&l!==n}}(ed,V?.folder??null),eh=!!(ed&&("COMMIT"===C?el(ed.headSha,D):"BRANCH"===C?el(ed.headSha,V?.headSha):ed.codeStateHash||V?.codeStateHash?!ed.codeStateHash||!V?.codeStateHash||el(ed.codeStateHash,V.codeStateHash):el(ed.headSha,V?.headSha)));(0,a.useEffect)(()=>{let e=!1;return(0,p.controlPlaneRequest)(Z).then(t=>{if(e)return;let a=t.worktreeOverview.agents.flatMap(e=>e.codebases.flatMap(e=>e.worktrees.map(t=>({...t,codebaseName:e.repository?.name??e.codebase.folder.split("/").at(-1)??e.codebase.folder}))));x(a),b(e=>e||!a.length?e:a[0].id)}).catch(t=>{e||q(t instanceof Error?t.message:String(t))}),()=>{e=!0}},[]),(0,a.useEffect)(()=>{if(!v)return;let e=!1,t=window.setTimeout(()=>{F(!0),q(null),(0,p.controlPlaneRequest)(Q,{id:v,requestId:(0,h.createClientId)()}).then(t=>{e||z({worktreeId:v,detail:t.inspectWorktree,branchFiles:(t.inspectWorktree.branchChanges??[]).map(e=>({...e,key:`${e.previousPath??""}:${e.path}`,lineCoverage:null,module:null}))})}).catch(t=>{e||(z({worktreeId:v,detail:null,branchFiles:[]}),q(t instanceof Error?t.message:String(t)))}).finally(()=>{e||F(!1)})},0);return()=>{e=!0,window.clearTimeout(t)}},[B,v]),(0,a.useEffect)(()=>{if("COMMIT"!==C||!v||!D)return;let e=!1;return(0,p.controlPlaneRequest)(J.INSPECT_WORKTREE_DIFF_MUTATION,{input:{worktreeId:v,scope:"COMMIT",path:null,previousPath:null,commitSha:D,requestId:(0,h.createClientId)()}}).then(t=>{e||O({worktreeId:v,sha:D,truncated:t.inspectWorktreeDiff.truncated,files:t.inspectWorktreeDiff.files.map(e=>({...e,key:`${e.previousPath??""}:${e.path}`,lineCoverage:null,module:null}))})}).catch(t=>{e||q(t instanceof Error?t.message:String(t))}),()=>{e=!0}},[D,C,v,B]);let ep=L&&L.worktreeId===v&&L.sha===D?L.files:[],eg=!!(L&&L.worktreeId===v&&L.sha===D&&L.truncated),em=(0,a.useMemo)(()=>{let e="BRANCH"===C?ei:"COMMIT"===C?ep:K?K.changes.filter(e=>"STAGED"===C?e.staged:"UNSTAGED"===C?e.unstaged:e.untracked).map(e=>({key:`${e.previousPath??""}:${e.path}`,path:e.path,previousPath:e.previousPath??null,changeType:e.changeType??"M",additions:"STAGED"===C?e.stagedAdditions:e.unstagedAdditions,deletions:"STAGED"===C?e.stagedDeletions:e.unstagedDeletions,binary:!1,image:!1,lineCoverage:null,module:null})):[];return ec.size?e.map(e=>{let t=ec.get(e.path);return t?{...e,lineCoverage:t.lineCoverage,module:t.module}:e}):e},[ei,L,D,ec,K,C]),ef=em.find(e=>e.path===T)??em[0]??null,ex=(0,a.useMemo)(()=>{let e=ef?ec.get(ef.path):void 0;if(e&&(e.covered.size||e.uncovered.size))return t=>e.covered.has(t)?"covered":e.uncovered.has(t)?"uncovered":null},[ec,ef]);(0,a.useEffect)(()=>{let e=new URLSearchParams;v&&e.set("worktree",v),e.set("scope",C),ef&&e.set("path",ef.path),"COMMIT"===C&&D&&e.set("commit",D),P&&e.set("coverage",P),"SPLIT"===k&&e.set("mode",k),N||e.set("wrap","0"),window.history.replaceState(null,"",`${location.pathname}?${e}`)},[D,P,k,C,ef,v,N]);let ev=(0,t.jsxs)("div",{className:"flex min-h-0 flex-col gap-3",children:["COMMIT"===C&&(0,t.jsx)(f,{commits:K?.commits??[],onSelect:e=>{R(e),A("")},selectedSha:D||null,truncated:K?.commitsTruncated??!1}),(0,t.jsx)(_,{files:em,onSelect:e=>{A(e.path),U(!1)},selectedKey:ef?.key??null,showCoverage:!!ed,truncated:"BRANCH"===C?K?.branchChangesTruncated??!1:"COMMIT"===C?eg:K?.changesTruncated??!1})]});return(0,t.jsxs)("div",{className:"flex w-full flex-col gap-6",children:[(0,t.jsxs)("div",{className:"flex flex-wrap items-start justify-between gap-4",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("h1",{className:"text-2xl font-semibold tracking-tight",children:g("title")}),(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:g("description")})]}),(0,t.jsxs)("div",{className:"flex flex-wrap items-start gap-2","data-slot":"diffs-toolbar",children:[(0,t.jsx)(y,{loading:eu,onSelect:e=>M(e===j?"":e),reports:eo,selectedId:P,stale:eh}),(0,t.jsx)(i.SearchableSelect,{ariaLabel:g("selectWorktree"),className:"w-72",emptyMessage:g("noWorktrees"),onValueChange:e=>{b(e),A(""),R("")},options:m.map(e=>({value:e.id,label:e.branch,description:e.codebaseName,secondaryDescription:e.relativePath,keywords:`${e.relativePath} ${e.folder}`})),placeholder:g("selectWorktree"),searchPlaceholder:g("searchWorktrees"),value:v}),(0,t.jsx)(o.Button,{"aria-label":g("refresh"),disabled:!v||$,onClick:()=>H((0,h.createClientId)()),size:"icon",title:g("refresh"),variant:"outline",children:(0,t.jsx)(s.RefreshCw,{className:"size-4"})})]})]}),W&&(0,t.jsx)(n.Alert,{variant:"destructive",children:(0,t.jsx)(n.AlertDescription,{children:W})}),(0,t.jsx)(u.Tabs,{onValueChange:e=>w(e),value:C,children:(0,t.jsx)(u.TabsList,{children:es.map(e=>(0,t.jsx)(u.TabsTrigger,{value:e,children:g(`scope.${e}`)},e))})}),v?($||en)&&!K?(0,t.jsxs)("p",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[(0,t.jsx)(c.Spinner,{})," ",g("loading")]}):(0,t.jsxs)("div",{className:"grid gap-4 md:grid-cols-[minmax(16rem,20rem)_minmax(0,1fr)]",children:[(0,t.jsx)("aside",{className:"sticky top-0 hidden max-h-[calc(100dvh-10rem)] min-h-0 md:flex md:flex-col",children:ev}),(0,t.jsx)("div",{className:"md:hidden",children:(0,t.jsxs)(d.Sheet,{onOpenChange:U,open:G,children:[(0,t.jsx)(d.SheetTrigger,{asChild:!0,children:(0,t.jsxs)(o.Button,{variant:"outline",children:[(0,t.jsx)(r.PanelLeft,{className:"size-4"})," ",g("files")]})}),(0,t.jsxs)(d.SheetContent,{className:"flex w-[min(22rem,90vw)] flex-col gap-3 p-4",side:"left",children:[(0,t.jsx)(d.SheetHeader,{className:"p-0",children:(0,t.jsx)(d.SheetTitle,{children:g("files")})}),ev]})]})}),(0,t.jsx)(Y,{commitSha:"COMMIT"===C&&D||null,coverage:ex,coverageStale:eh,file:ef,mode:k,onModeChange:S,onWrapChange:I,resetToken:`${v}:${B}`,scope:C,worktreeId:v,wrap:N})]}):(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:g("selectAWorktree")}),V?.pullRequest&&(0,t.jsx)("p",{className:"text-xs text-muted-foreground",children:g("linkedPullRequest",{number:V.pullRequest.number,title:V.pullRequest.title})})]})}],845935)},808562,e=>{"use strict";var t=e.i(843476),a=e.i(271645),r=e.i(30030),s=e.i(248425),l=e.i(842727),i=e.i(981140),n=e.i(369340),o=Object.defineProperty,d=a.forwardRef(o(function(e,a){let{pressed:r,defaultPressed:l,onPressedChange:o,...d}=e,[c,u]=(0,n.useControllableState)({prop:r,onChange:o,defaultProp:l??!1,caller:"Toggle"});return(0,t.jsx)(s.Primitive.button,{type:"button","aria-pressed":c,"data-state":c?"on":"off","data-disabled":e.disabled?"":void 0,...d,ref:a,onClick:(0,i.composeEventHandlers)(e.onClick,()=>{e.disabled||u(!c)})})},"name",{value:"Toggle",configurable:!0})),c=e.i(586318),u=Object.defineProperty,h=(e,t)=>u(e,"name",{value:t,configurable:!0}),p="ToggleGroup",[g,m]=(0,r.createContextScope)(p,[l.createRovingFocusGroupScope]),f=(0,l.createRovingFocusGroupScope)(),x=a.forwardRef(h(function(e,a){let{type:r,...s}=e;if("single"===r)return(0,t.jsx)(j,{role:"radiogroup",...s,ref:a});if("multiple"===r)return(0,t.jsx)(C,{role:"toolbar",...s,ref:a});throw Error(`Missing prop \`type\` expected on \`${p}\``)},"ToggleGroup")),[v,b]=g(p),j=a.forwardRef(h(function(e,r){let{value:s,defaultValue:l,onValueChange:i=h(()=>{},"onValueChange"),...o}=e,[d,c]=(0,n.useControllableState)({prop:s,defaultProp:l??"",onChange:i,caller:p});return(0,t.jsx)(v,{scope:e.__scopeToggleGroup,type:"single",value:a.useMemo(()=>d?[d]:[],[d]),onItemActivate:c,onItemDeactivate:a.useCallback(()=>c(""),[c]),children:(0,t.jsx)(k,{...o,ref:r})})},"ToggleGroupImplSingle")),C=a.forwardRef(h(function(e,r){let{value:s,defaultValue:l,onValueChange:i=h(()=>{},"onValueChange"),...o}=e,[d,c]=(0,n.useControllableState)({prop:s,defaultProp:l??[],onChange:i,caller:p}),u=a.useCallback(e=>c((t=[])=>[...t,e]),[c]),g=a.useCallback(e=>c((t=[])=>t.filter(t=>t!==e)),[c]);return(0,t.jsx)(v,{scope:e.__scopeToggleGroup,type:"multiple",value:d,onItemActivate:u,onItemDeactivate:g,children:(0,t.jsx)(k,{...o,ref:r})})},"ToggleGroupImplMultiple")),[y,w]=g(p),k=a.forwardRef(h(function(e,a){let{__scopeToggleGroup:r,disabled:i=!1,rovingFocus:n=!0,orientation:o,dir:d,loop:u=!0,...h}=e,p=f(r),g=(0,c.useDirection)(d),m={dir:g,...h};return(0,t.jsx)(y,{scope:r,rovingFocus:n,disabled:i,children:n?(0,t.jsx)(l.Root,{asChild:!0,...p,orientation:o,dir:g,loop:u,children:(0,t.jsx)(s.Primitive.div,{...m,ref:a})}):(0,t.jsx)(s.Primitive.div,{...m,ref:a})})},"ToggleGroupImpl")),S="ToggleGroupItem",N=a.forwardRef(h(function(e,r){let s=b(S,e.__scopeToggleGroup),i=w(S,e.__scopeToggleGroup),n=f(e.__scopeToggleGroup),o=s.value.includes(e.value),d=i.disabled||e.disabled,c={...e,pressed:o,disabled:d},u=a.useRef(null);return i.rovingFocus?(0,t.jsx)(l.Item,{asChild:!0,...n,focusable:!d,active:o,ref:u,children:(0,t.jsx)(I,{...c,ref:r})}):(0,t.jsx)(I,{...c,ref:r})},"ToggleGroupItem")),I=a.forwardRef(h(function(e,a){let{__scopeToggleGroup:r,value:s,...l}=e,i=b(S,r),n={role:"radio","aria-checked":e.pressed,"aria-pressed":void 0},o="single"===i.type?n:void 0;return(0,t.jsx)(d,{...o,...l,ref:a,onPressedChange:e=>{e?i.onItemActivate(s):i.onItemDeactivate(s)}})},"ToggleGroupItemImpl"));e.s(["Item",0,N,"Root",0,x,"ToggleGroup",0,x,"ToggleGroupItem",0,N,"createToggleGroupScope",0,m],459881);var T=e.i(459881),T=T,A=e.i(975157),D=e.i(225913),R=Object.defineProperty,P=a.forwardRef(R(function(e,a){let{pressed:r,defaultPressed:l,onPressedChange:o,...d}=e,[c,u]=(0,n.useControllableState)({prop:r,onChange:o,defaultProp:l??!1,caller:"Toggle"});return(0,t.jsx)(s.Primitive.button,{type:"button","aria-pressed":c,"data-state":c?"on":"off","data-disabled":e.disabled?"":void 0,...d,ref:a,onClick:(0,i.composeEventHandlers)(e.onClick,()=>{e.disabled||u(!c)})})},"name",{value:"Toggle",configurable:!0}));e.s(["Root",0,P,"Toggle",0,P],864225),e.i(864225);let M=(0,D.cva)("group/toggle inline-flex items-center justify-center gap-1 rounded-lg text-sm font-medium whitespace-nowrap transition-all outline-none hover:bg-muted hover:text-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 aria-pressed:bg-muted data-[state=on]:bg-muted dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",{variants:{variant:{default:"bg-transparent",outline:"border border-input bg-transparent hover:bg-muted"},size:{default:"h-8 min-w-8 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2",sm:"h-7 min-w-7 rounded-[min(var(--radius-md),12px)] px-2.5 text-[0.8rem] has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3.5",lg:"h-9 min-w-9 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2"}},defaultVariants:{variant:"default",size:"default"}}),E=a.createContext({size:"default",variant:"default",spacing:2,orientation:"horizontal"});e.s(["ToggleGroup",0,function({className:e,variant:a,size:r,spacing:s=2,orientation:l="horizontal",children:i,...n}){return(0,t.jsx)(T.Root,{"data-slot":"toggle-group","data-variant":a,"data-size":r,"data-spacing":s,"data-orientation":l,style:{"--gap":s},className:(0,A.cn)("group/toggle-group flex w-fit flex-row items-center gap-[--spacing(var(--gap))] rounded-lg data-[size=sm]:rounded-[min(var(--radius-md),10px)] data-vertical:flex-col data-vertical:items-stretch",e),...n,children:(0,t.jsx)(E.Provider,{value:{variant:a,size:r,spacing:s,orientation:l},children:i})})},"ToggleGroupItem",0,function({className:e,children:r,variant:s="default",size:l="default",...i}){let n=a.useContext(E);return(0,t.jsx)(T.Item,{"data-slot":"toggle-group-item","data-variant":n.variant||s,"data-size":n.size||l,"data-spacing":n.spacing,className:(0,A.cn)("shrink-0 group-data-[spacing=0]/toggle-group:rounded-none group-data-[spacing=0]/toggle-group:px-2 focus:z-10 focus-visible:z-10 group-data-[spacing=0]/toggle-group:has-data-[icon=inline-end]:pr-1.5 group-data-[spacing=0]/toggle-group:has-data-[icon=inline-start]:pl-1.5 group-data-horizontal/toggle-group:data-[spacing=0]:first:rounded-l-lg group-data-vertical/toggle-group:data-[spacing=0]:first:rounded-t-lg group-data-horizontal/toggle-group:data-[spacing=0]:last:rounded-r-lg group-data-vertical/toggle-group:data-[spacing=0]:last:rounded-b-lg group-data-horizontal/toggle-group:data-[spacing=0]:data-[variant=outline]:border-l-0 group-data-vertical/toggle-group:data-[spacing=0]:data-[variant=outline]:border-t-0 group-data-horizontal/toggle-group:data-[spacing=0]:data-[variant=outline]:first:border-l group-data-vertical/toggle-group:data-[spacing=0]:data-[variant=outline]:first:border-t",M({variant:n.variant||s,size:n.size||l}),e),...i,children:r})}],808562)},640572,e=>{"use strict";e.s(["relativeCoveragePath",0,function(e,t){let a=e.replaceAll("\\","/"),r=t?.replaceAll("\\","/").replace(/\/$/,"");return r?a===r?".":a.startsWith(`${r}/`)?a.slice(r.length+1):a:a}])}]);