@runfusion/fusion 0.38.1 → 0.40.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (193) hide show
  1. package/bin.mjs +20 -0
  2. package/dist/automation-store-EKXXEE2S.js +10 -0
  3. package/dist/automation-store-PLNG3X72.js +10 -0
  4. package/dist/automation-store-RDDYZFUJ.js +10 -0
  5. package/dist/bin.js +72539 -40364
  6. package/dist/chunk-2JI3F6MG.js +948 -0
  7. package/dist/chunk-4L6CLWJC.js +8345 -0
  8. package/dist/chunk-4VNS5WPM.js +42 -0
  9. package/dist/chunk-5RGECGQL.js +1139 -0
  10. package/dist/chunk-6JDLN7IL.js +409 -0
  11. package/dist/chunk-AICJATVW.js +948 -0
  12. package/dist/chunk-AWKNRUOR.js +1148 -0
  13. package/dist/chunk-BHM3UYWS.js +4651 -0
  14. package/dist/chunk-BMUXDSBF.js +4647 -0
  15. package/dist/chunk-GETECT6V.js +353 -0
  16. package/dist/chunk-GUV4QQT3.js +1143 -0
  17. package/dist/chunk-JKQO7YYZ.js +8369 -0
  18. package/dist/chunk-LYZVU6UV.js +409 -0
  19. package/dist/chunk-MAN4WYHO.js +353 -0
  20. package/dist/chunk-MCUG2Z7M.js +4651 -0
  21. package/dist/chunk-PSDYB45U.js +948 -0
  22. package/dist/chunk-RR2HM46R.js +8345 -0
  23. package/dist/chunk-RXMQ5OMY.js +9226 -0
  24. package/dist/chunk-S2EVJUY3.js +353 -0
  25. package/dist/chunk-UXR5XZFZ.js +409 -0
  26. package/dist/client/.vite/manifest.json +457 -155
  27. package/dist/client/assets/AgentDetailView-BrETpTDj.js +18 -0
  28. package/dist/client/assets/AgentPermissionPolicyEditor-BP6d1LFG.js +6 -0
  29. package/dist/client/assets/AgentsView-COx3draV.js +29 -0
  30. package/dist/client/assets/{AgentsView-BI_CESkd.css → AgentsView-DfznJDek.css} +1 -1
  31. package/dist/client/assets/ChatView-CrVSqQK_.js +6 -0
  32. package/dist/client/assets/DevServerView-DXQ1LX4H.js +1 -0
  33. package/dist/client/assets/DirectoryPicker-B_8ICSPl.js +1 -0
  34. package/dist/client/assets/{DirectoryPicker-DzKVmxOf.css → DirectoryPicker-DTKtd8L2.css} +1 -1
  35. package/dist/client/assets/DocumentsView-DmNB9rJZ.js +1 -0
  36. package/dist/client/assets/DocumentsView-WfVoTZt8.css +1 -0
  37. package/dist/client/assets/EvalsView-72w3_AO6.js +1 -0
  38. package/dist/client/assets/{ExperimentalAgentOnboardingModal-lXM--LV-.js → ExperimentalAgentOnboardingModal-Be4oaohM.js} +41 -41
  39. package/dist/client/assets/GoalsView-DI66UsjT.css +1 -0
  40. package/dist/client/assets/GoalsView-DkEXO_mx.js +2 -0
  41. package/dist/client/assets/InsightsView-_-wd4BOJ.js +11 -0
  42. package/dist/client/assets/MemoryView-BOCIc8HT.js +2 -0
  43. package/dist/client/assets/NodesView-7VInxyf_.css +1 -0
  44. package/dist/client/assets/NodesView-DTQP1j4H.js +14 -0
  45. package/dist/client/assets/PiExtensionsManager-BqaI9GKX.js +11 -0
  46. package/dist/client/assets/PluginManager-DYaVwsXd.js +1 -0
  47. package/dist/client/assets/{PluginManager-BJQXdUmV.css → PluginManager-UHVLvWWl.css} +1 -1
  48. package/dist/client/assets/PullRequestView-Dk9a7jRZ.js +6 -0
  49. package/dist/client/assets/PullRequestView-WQIS0zUC.css +1 -0
  50. package/dist/client/assets/ReliabilityView-B-i5SOoD.js +1 -0
  51. package/dist/client/assets/ReliabilityView-eoKBhBc4.css +1 -0
  52. package/dist/client/assets/ResearchView-C2Gx8jC9.js +1 -0
  53. package/dist/client/assets/SecretsView-Db2HAGi2.js +1 -0
  54. package/dist/client/assets/SessionTerminal-BiigPP2l.css +1 -0
  55. package/dist/client/assets/SessionTerminal-DwlNZLlr.js +2 -0
  56. package/dist/client/assets/{SettingsModal-Cy42vswI.js → SettingsModal-B-d30TVy.js} +1 -1
  57. package/dist/client/assets/SettingsModal-Dje7N0hv.js +31 -0
  58. package/dist/client/assets/SettingsModal-bJvc9aHl.css +1 -0
  59. package/dist/client/assets/SettingsModal-nF_GaeeK.css +1 -0
  60. package/dist/client/assets/SetupWizardModal-CIqFbkrD.css +1 -0
  61. package/dist/client/assets/SetupWizardModal-Cw3RdN83.js +1 -0
  62. package/dist/client/assets/SkillsView-3bhGyWs1.css +1 -0
  63. package/dist/client/assets/SkillsView-BGyynaI4.js +1 -0
  64. package/dist/client/assets/StashRecoveryView-CFaU-hym.js +1 -0
  65. package/dist/client/assets/{TodoView-Cx9cVhq7.css → TodoView-7xIh-Fmi.css} +1 -1
  66. package/dist/client/assets/TodoView-Djjwcb49.js +6 -0
  67. package/dist/client/assets/WorkflowNodeEditor-Po5uv_dN.css +1 -0
  68. package/dist/client/assets/WorkflowNodeEditor-vnXnKvAr.js +8 -0
  69. package/dist/client/assets/{addon-fit-C7jRorKK.js → addon-fit-B4jkcKk4.js} +1 -1
  70. package/dist/client/assets/addon-unicode11-Cdne2Sj4.js +1 -0
  71. package/dist/client/assets/{addon-web-links-CkJwd4cQ.js → addon-web-links-CRNLzj7m.js} +1 -1
  72. package/dist/client/assets/{addon-webgl-BjvOw43o.js → addon-webgl-CeCSULF1.js} +1 -1
  73. package/dist/client/assets/app-CTRT_hQh.js +13 -0
  74. package/dist/client/assets/app-CVg6W-HU.js +13 -0
  75. package/dist/client/assets/app-CY3pQXOr.js +13 -0
  76. package/dist/client/assets/app-DNh04p5I.js +13 -0
  77. package/dist/client/assets/app-DhHgtB9j.js +13 -0
  78. package/dist/client/assets/app-NL_hPGDS.js +13 -0
  79. package/dist/client/assets/common-BRyX4VxB.js +1 -0
  80. package/dist/client/assets/common-CN9QPI2d.js +1 -0
  81. package/dist/client/assets/common-CNbjPELi.js +1 -0
  82. package/dist/client/assets/common-DFDqu_n0.js +1 -0
  83. package/dist/client/assets/common-DgWWKG8Z.js +1 -0
  84. package/dist/client/assets/common-X6PzBnVA.js +1 -0
  85. package/dist/client/assets/{createLucideIcon-BazL2hk5.js → createLucideIcon-BYvOGRiO.js} +2 -2
  86. package/dist/client/assets/dashboard-view-BgiLoG1G.css +1 -0
  87. package/dist/client/assets/{dashboard-view-DqWnXEbq.css → dashboard-view-CuUPQZzi.css} +1 -1
  88. package/dist/client/assets/dashboard-view-DOEa6gWS.js +1 -0
  89. package/dist/client/assets/dashboard-view-DlKsVySD.js +3 -0
  90. package/dist/client/assets/dashboard-view-O5j3PSGY.js +8101 -0
  91. package/dist/client/assets/errors-07IrmOYM.js +1 -0
  92. package/dist/client/assets/errors-BPsCufin.js +1 -0
  93. package/dist/client/assets/errors-CcVDgqlA.js +1 -0
  94. package/dist/client/assets/errors-D-i_Bxc6.js +1 -0
  95. package/dist/client/assets/errors-DDdWAK-U.js +1 -0
  96. package/dist/client/assets/errors-DOF5Td3F.js +1 -0
  97. package/dist/client/assets/{folder-open-Doam5g-y.js → folder-open-BtEAEp7E.js} +1 -1
  98. package/dist/client/assets/index-BHGM5W8a.css +1 -0
  99. package/dist/client/assets/index-CW4OzecJ.js +793 -0
  100. package/dist/client/assets/{upload-BUfrZl69.js → upload-Y9NiLQ9o.js} +1 -1
  101. package/dist/client/assets/{users-XNGnYBJb.js → users-B13HD4Tp.js} +1 -1
  102. package/dist/client/assets/vendor-i18n-CV0mwX_-.js +9 -0
  103. package/dist/client/assets/{vendor-react-K0fH_qHe.js → vendor-react-D37HfzIf.js} +1 -1
  104. package/dist/client/assets/vendor-reactflow-C5ap-Sga.css +1 -0
  105. package/dist/client/assets/vendor-reactflow-CRZcPCXF.js +15 -0
  106. package/dist/client/assets/{vendor-xterm-DzcZoU0P.js → vendor-xterm-tcedd2Jt.js} +1 -1
  107. package/dist/client/assets/x-CqNX_9E2.js +61 -0
  108. package/dist/client/assets/zoom-out-CSTHbJgD.js +21 -0
  109. package/dist/client/index.html +7 -4
  110. package/dist/client/sw.js +36 -1
  111. package/dist/client/version.json +1 -1
  112. package/dist/droid-cli/package.json +2 -2
  113. package/dist/extension.js +67616 -44149
  114. package/dist/extract-zip-WL55Z3AU.js +2497 -0
  115. package/dist/index.min-CHQ3ABYJ.js +2926 -0
  116. package/dist/memory-dreams-7USISKVE.js +32 -0
  117. package/dist/memory-dreams-PBPISUDD.js +32 -0
  118. package/dist/memory-dreams-XNO2B2QF.js +32 -0
  119. package/dist/migration-EH2YOCYQ.js +15 -0
  120. package/dist/migration-PLGTTKL5.js +15 -0
  121. package/dist/migration-WZEZK22R.js +15 -0
  122. package/dist/pi-claude-cli/package.json +2 -2
  123. package/dist/plugin-sdk/index.d.ts +97 -0
  124. package/dist/plugin-sdk/index.js +55 -0
  125. package/dist/plugins/fusion-plugin-acp-runtime/bundled.js +17286 -0
  126. package/dist/plugins/fusion-plugin-acp-runtime/manifest.json +13 -0
  127. package/dist/plugins/fusion-plugin-acp-runtime/package.json +11 -0
  128. package/dist/plugins/fusion-plugin-cli-printing-press/package.json +2 -3
  129. package/dist/plugins/fusion-plugin-cli-printing-press/src/dashboard-interop.d.ts +19 -0
  130. package/dist/plugins/fusion-plugin-cli-printing-press/src/index.ts +0 -3
  131. package/dist/plugins/fusion-plugin-compound-engineering/bundled.js +1984 -0
  132. package/dist/plugins/fusion-plugin-compound-engineering/manifest.json +56 -0
  133. package/dist/plugins/fusion-plugin-compound-engineering/package.json +11 -0
  134. package/dist/plugins/fusion-plugin-cursor-runtime/bundled.js +5 -0
  135. package/dist/plugins/fusion-plugin-cursor-runtime/package.json +1 -1
  136. package/dist/plugins/fusion-plugin-dependency-graph/bundled.js +5 -0
  137. package/dist/plugins/fusion-plugin-dependency-graph/package.json +1 -1
  138. package/dist/plugins/fusion-plugin-droid-runtime/bundled.js +43 -4
  139. package/dist/plugins/fusion-plugin-droid-runtime/package.json +1 -1
  140. package/dist/plugins/fusion-plugin-hermes-runtime/bundled.js +5 -0
  141. package/dist/plugins/fusion-plugin-hermes-runtime/package.json +1 -1
  142. package/dist/plugins/fusion-plugin-openclaw-runtime/bundled.js +5 -0
  143. package/dist/plugins/fusion-plugin-openclaw-runtime/package.json +1 -1
  144. package/dist/plugins/fusion-plugin-paperclip-runtime/bundled.js +5 -0
  145. package/dist/plugins/fusion-plugin-paperclip-runtime/package.json +1 -1
  146. package/dist/plugins/fusion-plugin-reports/package.json +2 -2
  147. package/dist/plugins/fusion-plugin-reports/src/__tests__/review-panel.test.ts +3 -3
  148. package/dist/plugins/fusion-plugin-reports/src/index.ts +0 -1
  149. package/dist/plugins/fusion-plugin-roadmap/bundled.js +5 -0
  150. package/dist/plugins/fusion-plugin-roadmap/package.json +1 -1
  151. package/dist/plugins/fusion-plugin-whatsapp-chat/package.json +2 -2
  152. package/dist/routine-store-GIJ6MXWY.js +10 -0
  153. package/dist/routine-store-HTVC2PUQ.js +10 -0
  154. package/dist/routine-store-KGHZBPDF.js +10 -0
  155. package/package.json +24 -10
  156. package/skill/fusion/SKILL.md +1 -1
  157. package/skill/fusion/references/engine-tools.md +79 -3
  158. package/skill/fusion/references/extension-tools.md +79 -4
  159. package/skill/fusion/references/fusion-capabilities.md +12 -4
  160. package/dist/client/assets/AgentDetailView-DuRYmHK3.js +0 -18
  161. package/dist/client/assets/AgentPermissionPolicyEditor-ClY32kYN.js +0 -6
  162. package/dist/client/assets/AgentsView-UbCAHs_i.js +0 -29
  163. package/dist/client/assets/ChatView-DDDjYRKc.js +0 -6
  164. package/dist/client/assets/DevServerView-DY5GlJcD.js +0 -1
  165. package/dist/client/assets/DirectoryPicker-B4VRL2BH.js +0 -1
  166. package/dist/client/assets/DocumentsView-gv4zG3aT.css +0 -1
  167. package/dist/client/assets/DocumentsView-tqpIZ9t9.js +0 -1
  168. package/dist/client/assets/EvalsView-C_Br3ry8.js +0 -1
  169. package/dist/client/assets/GoalsView-B65urz9k.css +0 -1
  170. package/dist/client/assets/GoalsView-CI3Bzs1b.js +0 -1
  171. package/dist/client/assets/InsightsView-BYfsVobi.js +0 -11
  172. package/dist/client/assets/MemoryView-DT4vIhaW.js +0 -2
  173. package/dist/client/assets/NodesView-DT4pXowv.css +0 -1
  174. package/dist/client/assets/NodesView-Dx6HFqjI.js +0 -14
  175. package/dist/client/assets/PiExtensionsManager-BcGBnNiC.js +0 -6
  176. package/dist/client/assets/PluginManager-T_XZ7iNI.js +0 -1
  177. package/dist/client/assets/ReliabilityView-C1C1j1SD.js +0 -1
  178. package/dist/client/assets/ReliabilityView-D9AsVv5l.css +0 -1
  179. package/dist/client/assets/ResearchView-Bv4igpnv.js +0 -1
  180. package/dist/client/assets/SecretsView-C4VX2ZTa.js +0 -1
  181. package/dist/client/assets/SettingsModal-CLEkhLK_.js +0 -31
  182. package/dist/client/assets/SettingsModal-DZrJ5PFH.css +0 -1
  183. package/dist/client/assets/SettingsModal-D_uIvf6n.css +0 -1
  184. package/dist/client/assets/SetupWizardModal-CGYGKurR.css +0 -1
  185. package/dist/client/assets/SetupWizardModal-LqloAL4J.js +0 -1
  186. package/dist/client/assets/SkillsView-CUbSBeZ2.css +0 -1
  187. package/dist/client/assets/SkillsView-I1SDKaRz.js +0 -1
  188. package/dist/client/assets/StashRecoveryView-DMUUR3cy.js +0 -1
  189. package/dist/client/assets/TodoView-PKvJKjtV.js +0 -6
  190. package/dist/client/assets/dashboard-view-BWGH_fAq.js +0 -63
  191. package/dist/client/assets/dashboard-view-D4XVI1XP.js +0 -21
  192. package/dist/client/assets/index-BS-jSWPW.js +0 -742
  193. package/dist/client/assets/index-ktpD_W3I.css +0 -1
@@ -0,0 +1,8 @@
1
+ import{r as o,j as e,b as qa}from"./vendor-react-D37HfzIf.js";import{R as Ga,u as Ha,a as Ua,b as Ka,i as Ya,B as Ja,C as Xa,M as Qa}from"./vendor-reactflow-CRZcPCXF.js";import{c as Za,es as Vt,et as _e,eu as la,ev as eo,ew as to,ex as so,ey as ia,z as ae,j as ut,J as je,T as Pe,B as ao,aj as oo,a as Fe,U as be,b8 as ra,dM as no,i as ft,dN as Fs,ao as da,b7 as qt,b as Re,m as Gt,b6 as lo,ez as io,eA as ro,eB as co,eC as uo,dS as fo,p as mo,eD as Is,v as po,eE as wo,eF as ho,eG as go,eH as xo,eI as bo,eJ as ko,dK as vo,eK as jo,eL as No,eM as yo,eN as Ms,eO as As,eP as Rs,eQ as Co,eR as So,eS as Eo,eT as Fo,eU as Io,eV as Mo,eW as Ao,eX as Ro,eY as Po,eZ as Do,e_ as Ps,e$ as zo,f0 as Ds,f1 as zs,f2 as To,f3 as Lt,f4 as Lo,f5 as ca,f6 as Oo,f7 as Ts,f8 as $o,bT as Ls,ei as ua,M as Wo,X as Ht,L as Ee,bK as _o,f9 as Ot,cD as fa,bx as Bo,em as Vo,by as qo,b0 as Go,cH as Ho,fa as Uo,fb as Ko,fc as Yo,fd as Os,fe as Jo,ff as Xo,fg as Qo,b3 as ct,av as $e,fh as Zo,fi as en,fj as tn,fk as sn,cr as an,fl as on,fm as nn}from"./index-CW4OzecJ.js";import{u as ke}from"./vendor-i18n-CV0mwX_-.js";import{U as ln}from"./upload-Y9NiLQ9o.js";import"./vendor-xterm-tcedd2Jt.js";import"./vendor-codemirror-jBKmHyH0.js";/**
2
+ * @license lucide-react v1.7.0 - ISC
3
+ *
4
+ * This source code is licensed under the ISC license.
5
+ * See the LICENSE file in the root directory of this source tree.
6
+ */const rn=[["path",{d:"m16 6 4 14",key:"ji33uf"}],["path",{d:"M12 6v14",key:"1n7gus"}],["path",{d:"M8 8v12",key:"1gg7y9"}],["path",{d:"M4 4v16",key:"6qkkli"}]],dn=Za("library",rn),cn=80,un=24,$s=16,Ws=eo+cn,fn=0,mn=0,$t=la+un;function pn(a){return!(_e(a.id)||a.parentId)}function wn(a,d){const i=new Set(a),g=new Map,l=new Map;for(const N of a)l.set(N,0);for(const N of d)N.data?.kind!=="rework"&&(!i.has(N.source)||!i.has(N.target)||N.source!==N.target&&((g.get(N.source)??g.set(N.source,[]).get(N.source)).push(N.target),l.set(N.target,(l.get(N.target)??0)+1)));const w=a.filter(N=>N==="start"),D=w.length?w:a.filter(N=>(l.get(N)??0)===0),u=new Map,P=a.length+1,M=[];for(const N of D)u.set(N,0),M.push(N);let C=a.length*a.length+a.length+1;for(;M.length&&C-- >0;){const N=M.shift(),p=u.get(N)??0;for(const c of g.get(N)??[]){const j=p+1,h=u.get(c);(h===void 0||j>h)&&j<=P&&(u.set(c,j),M.push(c))}}let z=0;for(const N of u.values())N>z&&(z=N);const b=u.size?z+1:0;for(const N of a)u.has(N)||u.set(N,b);return u}function _s(a,d,i){const g=a.filter(pn),l=g.map(C=>C.id),w=wn(l,d),D=new Map(g.map(C=>[C.id,C])),u=new Map,P=new Map;for(const C of l){const z=w.get(C)??0;(P.get(z)??P.set(z,[]).get(z)).push(C)}const M=i.length>0;for(const[C,z]of P){const b=[...z].sort((c,j)=>{const h=D.get(c),T=D.get(j);return h.position.y!==T.position.y?h.position.y-T.position.y:c<j?-1:c>j?1:0}),N=fn+C*Ws;if(!M){b.forEach((c,j)=>{u.set(c,{x:N,y:mn+j*$t})});continue}const p=new Map;for(const c of b){const j=D.get(c),h=j.data.column??(Vt(j.position.y,i)?Vt(j.position.y,i):void 0);if(!h){u.set(c,{x:N,y:j.position.y});continue}const T=i.findIndex(v=>v.id===h),k=T>=0?T:0,R=to(k),U=R+$s,ee=R+so-la-$s,B=Math.max(1,Math.floor((ee-U)/$t)+1),K=p.get(h??`__idx${k}`)??0,de=K%B,_=Math.floor(K/B),Y=U+de*$t,ce=N+_*(Ws/2);u.set(c,{x:ce,y:Y}),p.set(h??`__idx${k}`,K+1)}}return u}function Bs(a,d){return a.map(i=>{const g=d.get(i.id);return g?{...i,position:g}:i})}let Vs=0;function hn(){return Vs+=1,`col-${Date.now().toString(36)}-${Vs}`}function qs({columns:a,onChange:d,violations:i,readOnly:g,projectId:l,addToast:w,columnAgentsEnabled:D}){const{t:u}=ke("app"),[P,M]=o.useState([]),[C,z]=o.useState([]),[b,N]=o.useState(!0),[p,c]=o.useState(null);o.useEffect(()=>{let v=!1;return ia(l).then(S=>{v||M(S)}).catch(S=>{v||w(ae(S)||u("workflowColumns.traitsLoadFailed","Failed to load traits"),"error")}),()=>{v=!0}},[l,w,u]),o.useEffect(()=>{let v=!1;return N(!0),c(null),Promise.resolve(ut(void 0,l)).then(S=>{v||(z(S??[]),N(!1))}).catch(S=>{if(v)return;const $=ae(S)||u("workflowColumns.agentsLoadFailed","Failed to load agents");c($),N(!1),w($,"error")}),()=>{v=!0}},[l,w,u]);const j=o.useMemo(()=>C.map(v=>v.id).join(","),[C]),h=o.useMemo(()=>{const v=new Map;for(const S of C)v.set(S.id,S);return v},[j]),T=o.useCallback((v,S)=>{d(a.map($=>{if($.id!==v)return $;if(!S){const{agent:W,...ne}=$;return ne}return{...$,agent:S}}))},[a,d]),k=o.useCallback((v,S)=>{if(!S){T(v,void 0);return}const $=a.find(W=>W.id===v)?.agent;T(v,{agentId:S,mode:$?.mode??"defer"})},[a,T]),R=o.useCallback((v,S)=>{const $=a.find(W=>W.id===v)?.agent;$&&T(v,{...$,mode:S})},[a,T]),U=g||!D||b||!!p,ee=i.filter(v=>v.columnId===null),B=o.useCallback(v=>i.filter(S=>S.columnId===v),[i]),K=o.useCallback(()=>{const v=hn();d([...a,{id:v,name:u("workflowColumns.newColumnName","New column"),traits:[]}])},[a,d,u]),de=o.useCallback((v,S)=>{d(a.map($=>$.id===v?{...$,name:S}:$))},[a,d]),_=o.useCallback(v=>{d(a.filter(S=>S.id!==v))},[a,d]),Y=o.useCallback((v,S)=>{const $=v+S;if($<0||$>=a.length)return;const W=[...a];[W[v],W[$]]=[W[$],W[v]],d(W)},[a,d]),ce=o.useCallback((v,S)=>{d(a.map($=>{if($.id!==v)return $;const W=$.traits.some(ne=>ne.trait===S);return{...$,traits:W?$.traits.filter(ne=>ne.trait!==S):[...$.traits,{trait:S}]}}))},[a,d]);return e.jsxs("aside",{className:"wf-column-panel","data-testid":"wf-column-panel",children:[e.jsxs("header",{className:"wf-column-panel-header",children:[e.jsx("h3",{children:u("workflowColumns.title","Columns")}),e.jsxs("button",{className:"wf-column-add",onClick:K,disabled:g,title:g?u("workflowColumns.readOnlyHint","Built-in workflows are read-only — duplicate to edit"):void 0,children:[e.jsx(je,{size:13})," ",u("workflowColumns.add","Add column")]})]}),ee.length>0&&e.jsx("div",{className:"wf-column-panel-errors",role:"alert",children:ee.map((v,S)=>e.jsxs("p",{className:"wf-column-violation",children:[e.jsx(Pe,{size:12,"aria-hidden":!0})," ",v.message]},`${v.code}-${S}`))}),a.length===0?e.jsx("p",{className:"wf-column-panel-empty",children:u("workflowColumns.empty","No columns yet. Add a column to place nodes into board lanes.")}):e.jsx("ul",{className:"wf-column-list",children:a.map((v,S)=>{const $=B(v.id),W=v.agent?.agentId,ne=W?h.get(W):void 0,re=!!W&&!b&&!p&&!ne,le=ne?.name??(re?u("workflowColumns.agentNotFound","Agent not found — {{id}}",{id:W??""}):W);return e.jsxs("li",{className:`wf-column-item${$.length?" wf-column-item--error":""}`,"data-testid":`wf-column-${v.id}`,"data-column-error":$.length?"true":void 0,children:[e.jsxs("div",{className:"wf-column-item-head",children:[e.jsx("input",{className:"wf-column-name","aria-label":u("workflowColumns.nameLabel","Column name"),value:v.name,disabled:g,onChange:Q=>de(v.id,Q.target.value)}),W&&e.jsxs("span",{className:`wf-column-agent-badge${re?" wf-column-agent-badge--stale":""}`,"data-testid":`wf-column-agent-badge-${v.id}`,title:v.agent?.mode==="override"?u("workflowColumns.agentBadgeOverride","Column agent (override)"):u("workflowColumns.agentBadgeDefer","Column agent (defer)"),children:[e.jsx(ao,{size:11,"aria-hidden":!0})," ",le]}),e.jsxs("div",{className:"wf-column-item-actions",children:[e.jsx("button",{className:"wf-column-move","aria-label":u("workflowColumns.moveUp","Move column up"),disabled:g||S===0,onClick:()=>Y(S,-1),children:e.jsx(oo,{size:13})}),e.jsx("button",{className:"wf-column-move","aria-label":u("workflowColumns.moveDown","Move column down"),disabled:g||S===a.length-1,onClick:()=>Y(S,1),children:e.jsx(Fe,{size:13})}),e.jsx("button",{className:"wf-column-remove","aria-label":u("workflowColumns.remove","Remove column"),disabled:g,onClick:()=>_(v.id),children:e.jsx(be,{size:13})})]})]}),$.map((Q,se)=>e.jsxs("p",{className:"wf-column-violation",role:"alert",children:[e.jsx(Pe,{size:12,"aria-hidden":!0})," ",Q.message]},`${Q.code}-${se}`)),e.jsxs("div",{className:"wf-column-traits",children:[e.jsx("span",{className:"wf-column-traits-label",children:u("workflowColumns.traits","Traits")}),e.jsx("div",{className:"wf-column-trait-options",children:P.map(Q=>{const se=v.traits.some(E=>E.trait===Q.id);return e.jsxs("label",{className:"wf-column-trait",title:Q.description,children:[e.jsx("input",{type:"checkbox",checked:se,disabled:g,onChange:()=>ce(v.id,Q.id)}),e.jsx("span",{children:Q.name})]},Q.id)})})]}),e.jsxs("div",{className:"wf-column-agent",children:[e.jsx("span",{className:"wf-column-agent-label",children:u("workflowColumns.agent","Column agent")}),e.jsxs("select",{className:"wf-column-agent-select","data-testid":`wf-column-agent-select-${v.id}`,"aria-label":u("workflowColumns.agentLabel","Column agent"),value:W??"",disabled:U,title:D?g?u("workflowColumns.readOnlyHint","Built-in workflows are read-only — duplicate to edit"):void 0:u("workflowColumns.agentFlagHint","Enable both experimentalFeatures.workflowColumns and experimentalFeatures.workflowGraphExecutor to staff columns with agents"),onChange:Q=>k(v.id,Q.target.value),children:[e.jsx("option",{value:"",children:u("workflowColumns.agentNone","(none)")}),re&&W&&e.jsx("option",{value:W,children:u("workflowColumns.agentNotFound","Agent not found — {{id}}",{id:W})}),C.map(Q=>e.jsx("option",{value:Q.id,children:Q.name},Q.id))]}),p&&e.jsxs("p",{className:"wf-column-agent-error",role:"alert",children:[e.jsx(Pe,{size:12,"aria-hidden":!0})," ",p]}),re&&e.jsxs("p",{className:"wf-column-agent-stale",role:"alert","data-testid":`wf-column-agent-stale-${v.id}`,children:[e.jsx(Pe,{size:12,"aria-hidden":!0})," ",u("workflowColumns.agentNotFound","Agent not found — {{id}}",{id:W??""})]}),W&&e.jsxs("div",{className:"wf-column-agent-mode",role:"radiogroup","aria-label":u("workflowColumns.agentMode","Agent mode"),children:[e.jsxs("label",{className:"wf-column-agent-mode-option",children:[e.jsx("input",{type:"radio",name:`wf-column-agent-mode-${v.id}`,checked:(v.agent?.mode??"defer")==="defer",disabled:U,onChange:()=>R(v.id,"defer")}),e.jsx("span",{title:u("workflowColumns.agentModeDeferHint","Column agent applies only when the work carries no agent/model settings of its own"),children:u("workflowColumns.agentModeDefer","Defer")})]}),e.jsxs("label",{className:"wf-column-agent-mode-option",children:[e.jsx("input",{type:"radio",name:`wf-column-agent-mode-${v.id}`,checked:v.agent?.mode==="override",disabled:U,onChange:()=>R(v.id,"override")}),e.jsx("span",{title:u("workflowColumns.agentModeOverrideHint","Column agent supersedes node- and task-level agent/model settings"),children:u("workflowColumns.agentModeOverride","Override")})]})]})]})]},v.id)})})]})}const gn=["string","text","number","boolean","enum","multi-enum","date","url"],Gs={string:["input"],text:["textarea","input"],number:["input"],boolean:["toggle"],enum:["select","radio","chips"],"multi-enum":["chips"],date:["input"],url:["input"]},xn=["#4f7cff","#22c55e","#f59e0b","#ef4444","#a855f7","#06b6d4","#ec4899","#64748b"];function mt(a){return a==="enum"||a==="multi-enum"}function bn(a){return a.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")}let Hs=0;function kn(){return Hs+=1,`field-${Date.now().toString(36)}-${Hs}`}function vn({field:a}){const d=o.useMemo(()=>{if(mt(a.type)){const g=a.options?.[0];return g?a.type==="multi-enum"?{node:e.jsx("span",{className:"card-field-badge card-field-badge--multi",title:a.name,children:(a.options??[]).slice(0,2).map(l=>e.jsx("span",{className:"card-field-badge-token",style:l.color?{backgroundColor:l.color,borderColor:l.color,color:"#fff"}:void 0,children:l.label},l.value))})}:{node:e.jsx("span",{className:"card-field-badge card-field-badge--enum",title:`${a.name}: ${g.label}`,style:g.color?{backgroundColor:g.color,borderColor:g.color,color:"#fff"}:void 0,children:g.label})}:null}if(a.type==="boolean")return{node:e.jsx("span",{className:"card-field-badge card-field-badge--boolean",title:a.name,children:a.name})};const i=a.type==="number"?"42":a.type==="date"?"2026-06-04":a.type==="url"?"example.com":a.name;return{node:e.jsx("span",{className:"card-field-badge",title:a.name,children:i})}},[a]);return d?e.jsx("div",{className:"wf-field-preview","data-testid":`wf-field-preview-${a.id}`,children:e.jsx("div",{className:"card-field-badges",children:d.node})}):null}function Us({fields:a,onChange:d,readOnly:i,addToast:g}){const{t:l}=ke("app"),[w,D]=o.useState(null),u=o.useCallback((c,j)=>{d(a.map(h=>h.id===c?{...h,...j}:h))},[a,d]),P=o.useCallback(()=>{const c=kn();d([...a,{id:c,name:l("workflowFields.newFieldName","New field"),type:"string"}])},[a,d,l]),M=o.useCallback(c=>{d(a.filter(j=>j.id!==c))},[a,d]),C=o.useCallback((c,j)=>{const h=bn(j);if(h){if(h!==c&&a.some(T=>T.id===h)){g(l("workflowFields.duplicateId","A field with that id already exists"),"error");return}u(c,{id:h})}},[a,u,g,l]),z=o.useCallback((c,j)=>{const h=a.find(k=>k.id===c);if(!h)return;const T={type:j};mt(j)?(!h.options||h.options.length===0)&&(T.options=[{value:"option-1",label:l("workflowFields.newOptionLabel","Option 1")}]):T.options=void 0,h.render?.widget&&!Gs[j].includes(h.render.widget)&&(T.render={...h.render,widget:void 0}),T.default=void 0,u(c,T)},[a,u,l]),b=o.useCallback((c,j)=>u(c,{options:j}),[u]),N=o.useCallback((c,j)=>{const h=!j||j.placement===void 0&&j.widget===void 0&&!j.badge;u(c,{render:h?void 0:j})},[u]),p=c=>{const j=k=>u(c.id,{default:k});if(c.type==="boolean")return e.jsxs("label",{className:"wf-field--checkbox",children:[e.jsx("input",{type:"checkbox",checked:c.default===!0,disabled:i,onChange:k=>j(k.target.checked)}),e.jsx("span",{children:l("workflowFields.defaultTrue","Default on")})]});if(mt(c.type)){const k=c.type==="multi-enum"?Array.isArray(c.default)?c.default[0]??"":"":typeof c.default=="string"?c.default:"";return e.jsxs("select",{"aria-label":l("workflowFields.defaultLabel","Default value"),value:k,disabled:i,onChange:R=>{const U=R.target.value;if(U==="")return j(void 0);j(c.type==="multi-enum"?[U]:U)},children:[e.jsx("option",{value:"",children:l("workflowFields.noDefault","— none —")}),(c.options??[]).map(R=>e.jsx("option",{value:R.value,children:R.label},R.value))]})}const h=c.type==="number"?"number":c.type==="date"?"date":c.type==="url"?"url":"text",T=c.type==="number"?typeof c.default=="number"?String(c.default):"":typeof c.default=="string"?c.default:"";return e.jsx("input",{type:h,"aria-label":l("workflowFields.defaultLabel","Default value"),defaultValue:T,disabled:i,onBlur:k=>{const R=k.target.value;if(R==="")return j(void 0);j(c.type==="number"?Number(R):R)}})};return e.jsxs("aside",{className:"wf-fields-panel","data-testid":"wf-fields-panel",children:[e.jsxs("header",{className:"wf-fields-panel-header",children:[e.jsx("h3",{children:l("workflowFields.title","Fields")}),e.jsxs("button",{className:"wf-fields-add",onClick:P,disabled:i,title:i?l("workflowFields.readOnlyHint","Built-in workflows are read-only — duplicate to edit"):void 0,children:[e.jsx(je,{size:13})," ",l("workflowFields.add","Add field")]})]}),a.length===0?e.jsx("p",{className:"wf-fields-panel-empty",children:l("workflowFields.empty","No custom fields yet. Add a field to extend the task form and cards.")}):e.jsx("ul",{className:"wf-fields-list",children:a.map(c=>{const j=Gs[c.type],h=c.render?.placement??"detail",T=w===c.id;return e.jsxs("li",{className:"wf-field-item","data-testid":`wf-field-${c.id}`,children:[e.jsxs("div",{className:"wf-field-item-head",children:[e.jsx("input",{className:"wf-field-name","aria-label":l("workflowFields.nameLabel","Field name"),value:c.name,disabled:i,onChange:k=>u(c.id,{name:k.target.value})}),e.jsx("button",{className:"wf-field-remove","aria-label":l("workflowFields.remove","Remove field"),disabled:i,onClick:()=>M(c.id),children:e.jsx(be,{size:13})})]}),e.jsx("div",{className:"wf-field-id-row",children:T?e.jsxs(e.Fragment,{children:[e.jsx("input",{className:"wf-field-id","aria-label":l("workflowFields.idLabel","Field id"),defaultValue:c.id,disabled:i,onBlur:k=>{C(c.id,k.target.value),D(null)}}),e.jsxs("p",{className:"wf-field-id-warn",role:"note",children:[e.jsx(Pe,{size:11,"aria-hidden":!0})," ",l("workflowFields.idWarn","Changing the id discards values stored under the old id (remove + add).")]})]}):e.jsxs(e.Fragment,{children:[e.jsx("code",{className:"wf-field-id-static",children:c.id}),e.jsx("button",{className:"wf-field-id-edit",disabled:i,onClick:()=>D(c.id),children:l("workflowFields.editId","Edit id")})]})}),e.jsxs("div",{className:"wf-field-row",children:[e.jsxs("label",{className:"wf-field-sub",children:[e.jsx("span",{children:l("workflowFields.typeLabel","Type")}),e.jsx("select",{value:c.type,disabled:i,onChange:k=>z(c.id,k.target.value),children:gn.map(k=>e.jsx("option",{value:k,children:k},k))})]}),e.jsxs("label",{className:"wf-field--checkbox wf-field-required",children:[e.jsx("input",{type:"checkbox",checked:c.required===!0,disabled:i,onChange:k=>u(c.id,{required:k.target.checked||void 0})}),e.jsx("span",{children:l("workflowFields.required","Required")})]})]}),e.jsxs("label",{className:"wf-field-sub",children:[e.jsx("span",{children:l("workflowFields.default","Default")}),p(c)]}),mt(c.type)&&e.jsxs("div",{className:"wf-field-options","data-testid":`wf-field-options-${c.id}`,children:[e.jsx("span",{className:"wf-field-options-label",children:l("workflowFields.options","Options")}),(c.options??[]).map((k,R)=>e.jsxs("div",{className:"wf-field-option-row",children:[e.jsx("input",{className:"wf-field-option-value","aria-label":l("workflowFields.optionValue","Option value"),value:k.value,disabled:i,onChange:U=>{const ee=[...c.options??[]];ee[R]={...k,value:U.target.value},b(c.id,ee)}}),e.jsx("input",{className:"wf-field-option-label","aria-label":l("workflowFields.optionLabel","Option label"),value:k.label,disabled:i,onChange:U=>{const ee=[...c.options??[]];ee[R]={...k,label:U.target.value},b(c.id,ee)}}),e.jsx("div",{className:"wf-field-option-colors",role:"group","aria-label":l("workflowFields.optionColor","Option color"),children:xn.map(U=>e.jsx("button",{type:"button",className:`wf-field-color-swatch${k.color===U?" is-active":""}`,style:{backgroundColor:U},"aria-label":U,"aria-pressed":k.color===U,disabled:i,onClick:()=>{const ee=[...c.options??[]];ee[R]={...k,color:k.color===U?void 0:U},b(c.id,ee)}},U))}),e.jsx("button",{className:"wf-field-option-remove","aria-label":l("workflowFields.removeOption","Remove option"),disabled:i,onClick:()=>b(c.id,(c.options??[]).filter((U,ee)=>ee!==R)),children:e.jsx(be,{size:12})})]},R)),e.jsxs("button",{className:"wf-field-option-add",disabled:i,onClick:()=>{const k=(c.options??[]).length+1;b(c.id,[...c.options??[],{value:`option-${k}`,label:l("workflowFields.optionN","Option {{n}}",{n:k})}])},children:[e.jsx(je,{size:12})," ",l("workflowFields.addOption","Add option")]})]}),e.jsxs("div",{className:"wf-field-render",children:[e.jsxs("label",{className:"wf-field-sub",children:[e.jsx("span",{children:l("workflowFields.placement","Placement")}),e.jsxs("select",{value:h,disabled:i,onChange:k=>N(c.id,{...c.render,placement:k.target.value}),children:[e.jsx("option",{value:"detail",children:l("workflowFields.placementDetail","Detail (inline)")}),e.jsx("option",{value:"detail-section",children:l("workflowFields.placementSection","Detail section")}),e.jsx("option",{value:"card",children:l("workflowFields.placementCard","Card badge")})]})]}),e.jsxs("label",{className:"wf-field-sub",children:[e.jsx("span",{children:l("workflowFields.widget","Widget")}),e.jsxs("select",{value:c.render?.widget??"",disabled:i,onChange:k=>N(c.id,{...c.render,widget:k.target.value||void 0}),children:[e.jsx("option",{value:"",children:l("workflowFields.widgetDefault","Default")}),j.map(k=>e.jsx("option",{value:k,children:k},k))]})]}),e.jsxs("label",{className:"wf-field--checkbox",children:[e.jsx("input",{type:"checkbox",checked:c.render?.badge===!0,disabled:i,onChange:k=>N(c.id,{...c.render,badge:k.target.checked||void 0})}),e.jsx("span",{children:l("workflowFields.badge","Render as badge")})]})]}),h==="card"&&e.jsx(vn,{field:c})]},c.id)})})]})}const jn={planningProvider:{group:"models",label:"Plan/Triage provider",description:"Provider used when planning or triaging tasks."},planningModelId:{group:"models",label:"Plan/Triage model",description:"Model used when planning or triaging tasks."},planningFallbackProvider:{group:"models",label:"Plan/Triage fallback provider"},planningFallbackModelId:{group:"models",label:"Plan/Triage fallback model"},executionProvider:{group:"models",label:"Executor provider",description:"Provider used by task implementation agents."},executionModelId:{group:"models",label:"Executor model",description:"Model used by task implementation agents."},validatorProvider:{group:"models",label:"Reviewer provider",description:"Provider used by review and validation agents."},validatorModelId:{group:"models",label:"Reviewer model",description:"Model used by review and validation agents."},validatorFallbackProvider:{group:"models",label:"Reviewer fallback provider"},validatorFallbackModelId:{group:"models",label:"Reviewer fallback model"},titleSummarizerProvider:{group:"models",label:"Title summarizer provider"},titleSummarizerModelId:{group:"models",label:"Title summarizer model"},requirePrApproval:{group:"review",label:"Require PR approval"},requirePlanApproval:{group:"review",label:"Require plan approval"},reviewHandoffPolicy:{group:"review",label:"Review handoff policy"},maxReviewerContextRetries:{group:"review",label:"Reviewer context retries"},maxReviewerFallbackRetries:{group:"review",label:"Reviewer fallback retries"},reflectionEnabled:{group:"review",label:"Reflection enabled"},workflowStepTimeoutMs:{group:"steps",label:"Step timeout"},workflowStepScopeEnforcement:{group:"steps",label:"Step scope enforcement"},planOnlyScopeLeakEnforcement:{group:"steps",label:"Plan-only scope leak enforcement"},workflowRevisionForkOnScopeMismatch:{group:"steps",label:"Fork revision on scope mismatch"},strictScopeEnforcement:{group:"steps",label:"Strict scope enforcement"},runStepsInNewSessions:{group:"steps",label:"Run steps in new sessions"},maxParallelSteps:{group:"steps",label:"Max parallel steps"},buildRetryCount:{group:"steps",label:"Build retry count"},verificationFixRetries:{group:"steps",label:"Verification fix retries"},maxPostReviewFixes:{group:"steps",label:"Post-review fix passes"}},Nn=["models","review","steps","advanced"],yn={models:"Models",review:"Review & Approval",steps:"Step Execution",advanced:"Advanced"};function ma(a){return jn[a.id]??{group:"advanced",label:a.name,description:a.description}}function Cn(a){const d=new Map;for(const i of a){const g=ma(i).group,l=d.get(g)??[];l.push(i),d.set(g,l)}return Nn.map(i=>({group:i,settings:d.get(i)??[]})).filter(i=>i.settings.length>0)}function Be({htmlFor:a,label:d,help:i,error:g,scope:l,disabled:w,clearable:D,onClear:u,children:P}){const{t:M}=ke("app");return e.jsxs("div",{className:`settings-field-row${w?" is-disabled":""}`,children:[e.jsxs("div",{className:"settings-field-row-head",children:[e.jsx("label",{className:"settings-field-row-label",htmlFor:a,children:d}),l&&e.jsx("span",{className:`settings-field-row-scope settings-field-row-scope--${l}`,"data-testid":"settings-field-row-scope",children:l})]}),e.jsxs("div",{className:"settings-field-row-control",children:[P,D&&e.jsx("button",{type:"button",className:"settings-field-row-clear","aria-label":M("settings.clearToDefault","Reset to default"),title:M("settings.clearToDefault","Reset to default"),disabled:w,onClick:u,children:e.jsx(ra,{size:13,"aria-hidden":!0})})]}),i&&e.jsx("p",{className:"settings-field-row-help",children:i}),g&&e.jsx("p",{className:"settings-field-row-error",role:"alert",children:g})]})}function Sn({descriptor:a,value:d,onChange:i,error:g,clearable:l}){const{key:w,label:D,help:u,scope:P,disabled:M}=a;return e.jsx(Be,{htmlFor:w,label:D,help:u,error:g,scope:P,disabled:M,clearable:l,onClear:()=>i(null),children:e.jsx("label",{className:"settings-toggle",children:e.jsx("input",{id:w,type:"checkbox",checked:d===!0,disabled:M,onChange:C=>i(C.target.checked)})})})}function En({descriptor:a,value:d,onChange:i,error:g,clearable:l}){const{key:w,label:D,help:u,scope:P,disabled:M,min:C,max:z,step:b,placeholder:N}=a;return e.jsx(Be,{htmlFor:w,label:D,help:u,error:g,scope:P,disabled:M,clearable:l,onClear:()=>i(null),children:e.jsx("input",{id:w,className:"settings-number",type:"number",value:d??"",min:C,max:z,step:b,placeholder:N,disabled:M,onChange:p=>{const c=p.target.value;if(c==="")return i(null);const j=Number(c);Number.isNaN(j)||i(j)}})})}function Ks({descriptor:a,value:d,onChange:i,error:g,clearable:l}){const{key:w,label:D,help:u,scope:P,disabled:M,options:C}=a;return e.jsx(Be,{htmlFor:w,label:D,help:u,error:g,scope:P,disabled:M,clearable:l,onClear:()=>i(null),children:e.jsx("select",{id:w,className:"settings-select",value:d??"",disabled:M,onChange:z=>i(z.target.value),children:C.map(z=>e.jsx("option",{value:z.value,children:z.label},z.value))})})}function Fn({descriptor:a,value:d,onChange:i,error:g,clearable:l}){const{key:w,label:D,help:u,scope:P,disabled:M,placeholder:C}=a;return e.jsx(Be,{htmlFor:w,label:D,help:u,error:g,scope:P,disabled:M,clearable:l,onClear:()=>i(null),children:e.jsx("input",{id:w,className:"settings-text",type:"text",value:d??"",placeholder:C,disabled:M,onChange:z=>i(z.target.value)})})}function In({descriptor:a,value:d,onChange:i,error:g,clearable:l}){const{key:w,label:D,help:u,scope:P,disabled:M,placeholder:C}=a;return e.jsx(Be,{htmlFor:w,label:D,help:u,error:g,scope:P,disabled:M,clearable:l,onClear:()=>i(null),children:e.jsx("textarea",{id:w,className:"settings-textarea",value:d??"",placeholder:C,disabled:M,rows:3,onChange:z=>i(z.target.value)})})}const Mn=["string","text","number","boolean","enum","multi-enum"],Ys={string:["input"],text:["textarea","input"],number:["input"],boolean:["toggle"],enum:["select","radio","chips"],"multi-enum":["chips"]},An=["#4f7cff","#22c55e","#f59e0b","#ef4444","#a855f7","#06b6d4","#ec4899","#64748b"];function Wt(a){return a==="enum"||a==="multi-enum"}function Rn(a){return a.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")}let Js=0;function Pn(){return Js+=1,`setting-${Date.now().toString(36)}-${Js}`}function Dn({settings:a,onChange:d,readOnly:i,addToast:g}){const{t:l}=ke("app"),[w,D]=o.useState(null),u=o.useCallback((p,c)=>{d(a.map(j=>j.id===p?{...j,...c}:j))},[a,d]),P=o.useCallback(()=>{d([...a,{id:Pn(),name:l("workflowSettings.newSettingName","New setting"),type:"string"}])},[a,d,l]),M=o.useCallback(p=>d(a.filter(c=>c.id!==p)),[a,d]),C=o.useCallback((p,c)=>{const j=Rn(c);if(j){if(j!==p&&a.some(h=>h.id===j)){g(l("workflowSettings.duplicateId","A setting with that id already exists"),"error");return}u(p,{id:j})}},[a,u,g,l]),z=o.useCallback((p,c)=>{const j=a.find(T=>T.id===p);if(!j)return;const h={type:c};Wt(c)?(!j.options||j.options.length===0)&&(h.options=[{value:"option-1",label:l("workflowSettings.newOptionLabel","Option 1")}]):h.options=void 0,j.render?.widget&&!Ys[c].includes(j.render.widget)&&(h.render=void 0),h.default=void 0,u(p,h)},[a,u,l]),b=o.useCallback((p,c)=>u(p,{options:c}),[u]),N=p=>{const c=T=>u(p.id,{default:T});if(p.type==="boolean")return e.jsxs("label",{className:"wf-setting--checkbox",children:[e.jsx("input",{type:"checkbox",checked:p.default===!0,disabled:i,onChange:T=>c(T.target.checked)}),e.jsx("span",{children:l("workflowSettings.defaultTrue","Default on")})]});if(Wt(p.type)){const T=p.type==="multi-enum"?Array.isArray(p.default)?p.default[0]??"":"":typeof p.default=="string"?p.default:"";return e.jsxs("select",{"aria-label":l("workflowSettings.defaultLabel","Default value"),value:T,disabled:i,onChange:k=>{const R=k.target.value;if(R==="")return c(void 0);c(p.type==="multi-enum"?[R]:R)},children:[e.jsx("option",{value:"",children:l("workflowSettings.noDefault","— none —")}),(p.options??[]).map(k=>e.jsx("option",{value:k.value,children:k.label},k.value))]})}const j=p.type==="number"?"number":"text",h=p.type==="number"?typeof p.default=="number"?String(p.default):"":typeof p.default=="string"?p.default:"";return e.jsx("input",{type:j,"aria-label":l("workflowSettings.defaultLabel","Default value"),defaultValue:h,disabled:i,onBlur:T=>{const k=T.target.value;if(k==="")return c(void 0);c(p.type==="number"?Number(k):k)}})};return e.jsxs("div",{className:"wf-settings-tabpanel","data-testid":"wf-settings-definitions",children:[e.jsx("div",{className:"wf-settings-tabpanel-head",children:e.jsxs("button",{className:"wf-settings-add",onClick:P,disabled:i,title:i?l("workflowSettings.readOnlyHint","Built-in workflows are read-only — duplicate to edit"):void 0,children:[e.jsx(je,{size:13})," ",l("workflowSettings.add","Add setting")]})}),i&&e.jsx("p",{className:"wf-settings-note wf-settings-note--info",role:"note",children:l("workflowSettings.builtinDefinitionsReadOnly","Built-in workflow — declarations are read-only. Values are editable below.")}),a.length===0?e.jsx("p",{className:"wf-settings-empty",children:l("workflowSettings.empty","No settings declared yet. Add a setting to expose a typed, per-project knob.")}):e.jsx("ul",{className:"wf-settings-list",children:a.map(p=>{const c=Ys[p.type],j=w===p.id;return e.jsxs("li",{className:"wf-setting-item","data-testid":`wf-setting-${p.id}`,children:[e.jsxs("div",{className:"wf-setting-item-head",children:[e.jsx("input",{className:"wf-setting-name","aria-label":l("workflowSettings.nameLabel","Setting name"),value:p.name,disabled:i,onChange:h=>u(p.id,{name:h.target.value})}),e.jsx("button",{className:"wf-setting-remove","aria-label":l("workflowSettings.remove","Remove setting"),disabled:i,onClick:()=>M(p.id),children:e.jsx(be,{size:13})})]}),e.jsx("div",{className:"wf-setting-id-row",children:j?e.jsxs(e.Fragment,{children:[e.jsx("input",{className:"wf-setting-id","aria-label":l("workflowSettings.idLabel","Setting id"),defaultValue:p.id,disabled:i,onBlur:h=>{C(p.id,h.target.value),D(null)}}),e.jsxs("p",{className:"wf-setting-id-warn",role:"note",children:[e.jsx(Pe,{size:11,"aria-hidden":!0})," ",l("workflowSettings.idWarn","Changing the id discards values stored under the old id (remove + add).")]})]}):e.jsxs(e.Fragment,{children:[e.jsx("code",{className:"wf-setting-id-static",children:p.id}),e.jsx("button",{className:"wf-setting-id-edit",disabled:i,onClick:()=>D(p.id),children:l("workflowSettings.editId","Edit id")})]})}),e.jsxs("div",{className:"wf-setting-row",children:[e.jsxs("label",{className:"wf-setting-sub",children:[e.jsx("span",{children:l("workflowSettings.typeLabel","Type")}),e.jsx("select",{value:p.type,disabled:i,onChange:h=>z(p.id,h.target.value),children:Mn.map(h=>e.jsx("option",{value:h,children:h},h))})]}),e.jsxs("label",{className:"wf-setting-sub",children:[e.jsx("span",{children:l("workflowSettings.widget","Widget")}),e.jsxs("select",{value:p.render?.widget??"",disabled:i,onChange:h=>u(p.id,{render:h.target.value?{widget:h.target.value}:void 0}),children:[e.jsx("option",{value:"",children:l("workflowSettings.widgetDefault","Default")}),c.map(h=>e.jsx("option",{value:h,children:h},h))]})]})]}),e.jsxs("label",{className:"wf-setting-sub",children:[e.jsx("span",{children:l("workflowSettings.default","Default")}),N(p)]}),e.jsxs("label",{className:"wf-setting-sub",children:[e.jsx("span",{children:l("workflowSettings.description","Description")}),e.jsx("input",{"aria-label":l("workflowSettings.descriptionLabel","Setting description"),value:p.description??"",disabled:i,onChange:h=>u(p.id,{description:h.target.value||void 0})})]}),Wt(p.type)&&e.jsxs("div",{className:"wf-setting-options","data-testid":`wf-setting-options-${p.id}`,children:[e.jsx("span",{className:"wf-setting-options-label",children:l("workflowSettings.options","Options")}),(p.options??[]).map((h,T)=>e.jsxs("div",{className:"wf-setting-option-row",children:[e.jsx("input",{className:"wf-setting-option-value","aria-label":l("workflowSettings.optionValue","Option value"),value:h.value,disabled:i,onChange:k=>{const R=[...p.options??[]];R[T]={...h,value:k.target.value},b(p.id,R)}}),e.jsx("input",{className:"wf-setting-option-label","aria-label":l("workflowSettings.optionLabel","Option label"),value:h.label,disabled:i,onChange:k=>{const R=[...p.options??[]];R[T]={...h,label:k.target.value},b(p.id,R)}}),e.jsx("div",{className:"wf-setting-option-colors",role:"group","aria-label":l("workflowSettings.optionColor","Option color"),children:An.map(k=>e.jsx("button",{type:"button",className:`wf-setting-color-swatch${h.color===k?" is-active":""}`,style:{backgroundColor:k},"aria-label":k,"aria-pressed":h.color===k,disabled:i,onClick:()=>{const R=[...p.options??[]];R[T]={...h,color:h.color===k?void 0:k},b(p.id,R)}},k))}),e.jsx("button",{className:"wf-setting-option-remove","aria-label":l("workflowSettings.removeOption","Remove option"),disabled:i,onClick:()=>b(p.id,(p.options??[]).filter((k,R)=>R!==T)),children:e.jsx(be,{size:12})})]},T)),e.jsxs("button",{className:"wf-setting-option-add",disabled:i,onClick:()=>{const h=(p.options??[]).length+1;b(p.id,[...p.options??[],{value:`option-${h}`,label:l("workflowSettings.optionN","Option {{n}}",{n:h})}])},children:[e.jsx(je,{size:12})," ",l("workflowSettings.addOption","Add option")]})]})]},p.id)})})]})}function zn(a){if(typeof a=="string")return a;try{return JSON.stringify(a)}catch{return String(a)}}const Tn=[{id:"planning",providerId:"planningProvider",modelId:"planningModelId",label:"Plan/Triage Model",help:"Provider and model used when planning or triaging tasks. Leave unset to inherit from the default lane."},{id:"execution",providerId:"executionProvider",modelId:"executionModelId",label:"Executor Model",help:"Provider and model used by task implementation agents. Leave unset to inherit from the default lane."},{id:"validator",providerId:"validatorProvider",modelId:"validatorModelId",label:"Reviewer Model",help:"Provider and model used by review and validation agents. Leave unset to inherit from the default lane."},{id:"planning-fallback",providerId:"planningFallbackProvider",modelId:"planningFallbackModelId",label:"Planning Fallback Model",help:"Fallback provider and model used when the primary Plan/Triage model cannot be used."},{id:"validator-fallback",providerId:"validatorFallbackProvider",modelId:"validatorFallbackModelId",label:"Reviewer Fallback Model",help:"Fallback provider and model used when the primary Reviewer model cannot be used."},{id:"title-summarizer",providerId:"titleSummarizerProvider",modelId:"titleSummarizerModelId",label:"Title Summarizer Model",help:"Provider and model used for title summarization when this workflow declares the lane."},{id:"title-summarizer-fallback",providerId:"titleSummarizerFallbackProvider",modelId:"titleSummarizerFallbackModelId",label:"Title Summarizer Fallback Model",help:"Fallback provider and model used for title summarization when this workflow declares the lane."}];function Ln(a){if(!a)return null;const d=a.indexOf("/");return d<=0||d===a.length-1?null:{provider:a.slice(0,d),modelId:a.slice(d+1)}}function On({workflowId:a,settings:d,boundProjectId:i,currentProjectId:g,addToast:l}){const{t:w}=ke("app"),[D,u]=o.useState(null),[P,M]=o.useState(!1),[C,z]=o.useState({}),[b,N]=o.useState({}),[p,c]=o.useState(!1),[j,h]=o.useState(!1),[T,k]=o.useState([]),[R,U]=o.useState(!1),[ee,B]=o.useState([]),[K,de]=o.useState([]),_=o.useRef(0),Y=o.useRef(0),ce=o.useMemo(()=>new Map(d.map(f=>[f.id,f])),[d]),v=o.useMemo(()=>Tn.filter(f=>{const A=ce.get(f.providerId),V=ce.get(f.modelId);return A?.type==="string"&&V?.type==="string"}),[ce]),S=o.useMemo(()=>new Set(v.flatMap(f=>[f.providerId,f.modelId])),[v]),$=i!==void 0&&g!==void 0&&g!==i,W=o.useCallback(async()=>{if(i===void 0)return;const f=++_.current;M(!0);try{const A=await no(a,i);_.current===f&&(u(A),z({}),N({}))}catch{_.current===f&&l(w("workflowSettings.loadFailed","Failed to load setting values"),"error")}finally{_.current===f&&M(!1)}},[a,i,l,w]);if(o.useEffect(()=>{W()},[W]),o.useEffect(()=>{if(i===void 0||v.length===0){k([]),B([]),de([]),U(!1);return}const f=++Y.current;U(!0),ft().then(A=>{Y.current===f&&(k(A.models??[]),B(A.favoriteProviders??[]),de(A.favoriteModels??[]))}).catch(()=>{Y.current===f&&(k([]),B([]),de([]),l(w("workflowSettings.modelsLoadFailed","Failed to load available models"),"error"))}).finally(()=>{Y.current===f&&U(!1)})},[i,v.length,l,w]),i===void 0)return e.jsx("div",{className:"wf-settings-tabpanel","data-testid":"wf-settings-values",children:e.jsx("p",{className:"wf-settings-note wf-settings-note--info",role:"note",children:w("workflowSettings.requiresProject","Open a project to view and edit per-project setting values.")})});const ne=f=>{if(Object.prototype.hasOwnProperty.call(C,f.id)){const A=C[f.id];return A===null?f.default:A}return D?.effective?.[f.id]??f.default},re=f=>Object.prototype.hasOwnProperty.call(C,f.id)?C[f.id]!==null:D?Object.prototype.hasOwnProperty.call(D.stored,f.id):!1,le=(f,A)=>{z(V=>({...V,[f]:A})),N(V=>{if(!V[f])return V;const Z={...V};return delete Z[f],Z})},Q=f=>le(f,null),se=(f,A)=>{const V=Ln(A);z(Z=>({...Z,[f.providerId]:V?.provider??null,[f.modelId]:V?.modelId??null})),N(Z=>{if(!Z[f.providerId]&&!Z[f.modelId])return Z;const ie={...Z};return delete ie[f.providerId],delete ie[f.modelId],ie})},E=Object.keys(C).length>0,H=o.useCallback(async()=>{if(!E)return;const f=new Set(Object.keys(C));c(!0);try{const A=await Fs(a,C,i);u(A),z(V=>{const Z={...V};for(const ie of f)delete Z[ie];return Z}),N({}),l(w("workflowSettings.valuesSaved","Setting values saved"),"success")}catch(A){if(A instanceof da&&A.status===400&&A.details){const V=A.details.rejections??[];if(V.length>0){const Z={};for(const ie of V)Z[ie.settingId]=ie;N(Z),l(w("workflowSettings.valuesRejected","Some values were rejected — see the highlighted fields"),"error");return}}l(w("workflowSettings.saveFailed","Failed to save setting values"),"error")}finally{c(!1)}},[E,a,C,i,l,w]),s=f=>{const A=ce.get(f);return A?ne(A):void 0},ue=f=>{const A=ce.get(f);return A?re(A):!1},Ne=f=>{const A=s(f.providerId),V=s(f.modelId),Z=typeof A=="string"&&typeof V=="string"?`${A}/${V}`:"",ie=b[f.providerId]?.message??b[f.modelId]?.message,J=ue(f.providerId)||ue(f.modelId),he=R||T.length===0,X=!R&&T.length===0?` ${w("workflowSettings.noModelsAvailable","No models are available. Configure authentication before selecting a workflow model.")}`:"";return e.jsxs("div",{className:"wf-settings-value-item","data-testid":`wf-settings-value-${f.id}`,children:[e.jsx(Be,{htmlFor:`wf-model-lane-${f.id}`,label:f.label,help:`${f.help}${X}`,error:ie,scope:"project",disabled:R,clearable:J,onClear:()=>se(f,""),children:e.jsx(Gt,{id:`wf-model-lane-${f.id}`,label:f.label,models:T,value:Z,onChange:fe=>se(f,fe),placeholder:w("workflowSettings.selectModel","Select a model…"),defaultOptionLabel:w("workflowSettings.useInheritedModel","Use inherited/default model"),disabled:he,favoriteProviders:ee,favoriteModels:K})}),J&&e.jsx("span",{className:"wf-settings-customized","data-testid":`wf-settings-customized-${f.id}`,children:w("workflowSettings.customized","Customized")})]},f.id)},oe=f=>{const A=ne(f),V=b[f.id]?.message,Z=re(f),ie=ma(f),J={key:f.id,label:ie.label,help:ie.description??f.description,scope:"project"},he=Z;switch(f.type){case"boolean":return e.jsx(Sn,{descriptor:J,value:A===!0,error:V,clearable:he,onChange:X=>X===null?Q(f.id):le(f.id,X)});case"number":return e.jsx(En,{descriptor:J,value:typeof A=="number"?A:null,error:V,clearable:he,onChange:X=>X===null?Q(f.id):le(f.id,X)});case"enum":return e.jsx(Ks,{descriptor:{...J,options:(f.options??[]).map(X=>({value:X.value,label:X.label}))},value:typeof A=="string"?A:null,error:V,clearable:he,onChange:X=>X===null?Q(f.id):le(f.id,X)});case"multi-enum":{const X=Array.isArray(A)?A[0]??null:null;return e.jsx(Ks,{descriptor:{...J,options:(f.options??[]).map(fe=>({value:fe.value,label:fe.label}))},value:X,error:V,clearable:he,onChange:fe=>fe===null?Q(f.id):le(f.id,[fe])})}case"text":return e.jsx(In,{descriptor:J,value:typeof A=="string"?A:null,error:V,clearable:he,onChange:X=>X===null||X===""?Q(f.id):le(f.id,X)});case"string":default:return e.jsx(Fn,{descriptor:J,value:typeof A=="string"?A:null,error:V,clearable:he,onChange:X=>X===null||X===""?Q(f.id):le(f.id,X)})}},De=D?.orphaned??[],Xe=o.useCallback(async f=>{try{const A=await Fs(a,{[f]:null},i);u(A),l(w("workflowSettings.orphanDeleted","Orphaned value removed"),"success")}catch{l(w("workflowSettings.saveFailed","Failed to save setting values"),"error")}},[a,i,l,w]);return e.jsxs("div",{className:"wf-settings-tabpanel","data-testid":"wf-settings-values",children:[$&&e.jsxs("p",{className:"wf-settings-note wf-settings-note--warn",role:"note","data-testid":"wf-settings-stale-notice",children:[e.jsx(Pe,{size:12,"aria-hidden":!0})," ",w("workflowSettings.staleContext","Values shown are for project {{project}} — reopen the editor to edit values for the current project.",{project:i})]}),e.jsx("div",{className:"wf-settings-values-head",children:e.jsxs("button",{className:"wf-settings-save-values",onClick:H,disabled:!E||p||$,"data-testid":"wf-settings-save-values",children:[e.jsx(qt,{size:13})," ",w("workflowSettings.saveValues","Save values")]})}),d.length===0?e.jsx("p",{className:"wf-settings-empty",children:P?w("workflowSettings.loading","Loading…"):w("workflowSettings.noDeclarations","This workflow declares no settings, so there are no values to edit.")}):e.jsx("div",{className:"wf-settings-values-list",children:Cn(d).map(({group:f,settings:A})=>{const V=new Set(A.map(J=>J.id)),Z=f==="models"?v.filter(J=>V.has(J.providerId)&&V.has(J.modelId)):[],ie=A.filter(J=>!S.has(J.id));return e.jsxs("section",{className:"wf-settings-value-group","data-testid":`wf-settings-group-${f}`,children:[e.jsx("h4",{className:"wf-settings-value-group-title",children:w(`workflowSettings.group.${f}`,yn[f])}),Z.map(J=>Ne(J)),ie.map(J=>e.jsxs("div",{className:"wf-settings-value-item","data-testid":`wf-settings-value-${J.id}`,children:[oe(J),re(J)&&e.jsx("span",{className:"wf-settings-customized","data-testid":`wf-settings-customized-${J.id}`,children:w("workflowSettings.customized","Customized")})]},J.id))]},f)})}),De.length>0&&e.jsxs("div",{className:"wf-settings-orphaned","data-testid":"wf-settings-orphaned",children:[e.jsxs("button",{className:"wf-settings-orphaned-toggle",onClick:()=>h(f=>!f),"aria-expanded":j,children:[j?e.jsx(Fe,{size:13}):e.jsx(Re,{size:13})," ",w("workflowSettings.orphanedTitle","Orphaned values ({{count}})",{count:De.length})]}),j&&e.jsxs("div",{className:"wf-settings-orphaned-body",children:[e.jsx("p",{className:"wf-settings-note wf-settings-note--muted",role:"note",children:w("workflowSettings.orphanedNote","These stored values no longer match a current declaration (the setting was retyped or removed). They are ignored by the engine; delete them to clean up.")}),e.jsx("ul",{className:"wf-settings-orphaned-list",children:De.map(f=>e.jsxs("li",{className:"wf-settings-orphaned-row","data-testid":`wf-settings-orphan-${f.id}`,children:[e.jsx("code",{className:"wf-settings-orphan-id",children:f.id}),e.jsx("span",{className:"wf-settings-orphan-value",children:zn(f.value)}),e.jsx("button",{className:"wf-settings-orphan-delete","aria-label":w("workflowSettings.deleteOrphan","Delete orphaned value"),disabled:$||p,onClick:()=>Xe(f.id),children:e.jsx(be,{size:12})})]},f.id))})]})]}),d.length>0&&e.jsxs("p",{className:"wf-settings-reset-hint",role:"note",children:[e.jsx(ra,{size:11,"aria-hidden":!0})," ",w("workflowSettings.clearHint","Use the reset control on a row to clear a value back to its declaration default.")]})]})}function Xs({workflowId:a,settings:d,onChange:i,readOnly:g,projectId:l,addToast:w,initialTab:D}){const{t:u}=ke("app"),[P,M]=o.useState(()=>D??(d.length>0?"values":"definitions")),C=o.useRef({workflowId:a,projectId:l});C.current.workflowId!==a&&(C.current={workflowId:a,projectId:l});const z=C.current.projectId;return e.jsxs("aside",{className:"wf-settings-panel","data-testid":"wf-settings-panel",children:[e.jsx("header",{className:"wf-settings-panel-header",children:e.jsx("h3",{children:u("workflowSettings.title","Settings")})}),e.jsxs("div",{className:"wf-settings-tabs",role:"tablist",children:[e.jsx("button",{role:"tab","aria-selected":P==="definitions",className:`wf-settings-tab${P==="definitions"?" is-active":""}`,onClick:()=>M("definitions"),"data-testid":"wf-settings-tab-definitions",children:u("workflowSettings.definitionsTab","Definitions")}),e.jsx("button",{role:"tab","aria-selected":P==="values",className:`wf-settings-tab${P==="values"?" is-active":""}`,onClick:()=>M("values"),"data-testid":"wf-settings-tab-values",children:u("workflowSettings.valuesTab","Values")})]}),P==="definitions"?e.jsx(Dn,{settings:d,onChange:i,readOnly:g,addToast:w}):e.jsx(On,{workflowId:a,settings:d,boundProjectId:z,currentProjectId:l,addToast:w},a)]})}function pa({row:a,depth:d,selectedNodeId:i,selectedEdgeId:g,onSelectNode:l,onSelectEdge:w}){const{t:D}=ke("app"),u=a.children.length>0,[P,M]=o.useState(d===0),C=i===a.id;return e.jsxs("div",{className:"mobile-wf-node-group",children:[e.jsxs("div",{className:`mobile-wf-node-row${C?" mobile-wf-node-row--selected":""}`,style:{"--mobile-wf-depth":String(d)},"data-testid":`mobile-wf-node-${a.id}`,children:[e.jsxs("button",{type:"button",className:"mobile-wf-node-main",onClick:()=>l(a.id),"aria-current":C?"true":void 0,children:[e.jsx("span",{className:"mobile-wf-node-kind",children:a.kind}),e.jsxs("span",{className:"mobile-wf-node-text",children:[e.jsx("span",{className:"mobile-wf-node-title",children:a.label}),a.summary?e.jsx("span",{className:"mobile-wf-node-summary",children:a.summary}):null]}),a.editable?e.jsx(lo,{size:14,"aria-hidden":!0}):null]}),u?e.jsx("button",{type:"button",className:"mobile-wf-node-expand","aria-expanded":P,"aria-label":P?D("common.collapse","Collapse"):D("common.expand","Expand"),onClick:()=>M(z=>!z),children:P?e.jsx(Fe,{size:16}):e.jsx(Re,{size:16})}):null]}),(a.columnName||a.outgoing.length>0)&&e.jsxs("div",{className:"mobile-wf-node-meta",style:{"--mobile-wf-depth":String(d)},children:[a.columnName?e.jsx("span",{className:"mobile-wf-column-chip",children:a.columnName}):null,a.outgoing.map(z=>e.jsxs("button",{type:"button",className:`mobile-wf-edge-chip${g===z.id?" mobile-wf-edge-chip--selected":""}`,"data-testid":`mobile-wf-edge-${z.id}`,onClick:()=>w(z.id),children:[e.jsx(io,{size:12,"aria-hidden":!0}),e.jsx("span",{children:z.label}),e.jsx("span",{className:"mobile-wf-edge-target",children:z.targetLabel})]},z.id))]}),u&&P?e.jsx("div",{className:"mobile-wf-node-children",children:a.children.map(z=>e.jsx(pa,{row:z,depth:d+1,selectedNodeId:i,selectedEdgeId:g,onSelectNode:l,onSelectEdge:w},z.id))}):null]})}function $n({rows:a,selectedNodeId:d,selectedEdgeId:i,onSelectNode:g,onSelectEdge:l}){const{t:w}=ke("app");return a.length===0?e.jsx("div",{className:"mobile-wf-graph-empty","data-testid":"mobile-wf-graph-empty",children:w("workflowNodes.mobileGraphEmpty","No graph nodes yet.")}):e.jsx("div",{className:"mobile-wf-graph","data-testid":"mobile-wf-graph",children:a.map(D=>e.jsx(pa,{row:D,depth:0,selectedNodeId:d,selectedEdgeId:i,onSelectNode:g,onSelectEdge:l},D.id))})}function Wn(a){return typeof a.label=="string"&&a.label.trim()?a.label:String(a.data?.condition??"success")}function Qs(a){return a.data.label||a.id}function Zs(a,d){const i=Math.round(a.position.y),g=Math.round(d.position.y);return i!==g?i-g:Math.round(a.position.x)-Math.round(d.position.x)}function _n(a,d){const i=new Map(a.map(g=>[g.id,g.name||g.id]));for(const g of d){if(!_e(g.id))continue;const l=ro(g.id);i.has(l)||i.set(l,g.data.label||l)}return i}function Bn(a,d,i=[],g={},l){const w=_n(i,a),D=new Map(a.map(b=>[b.id,b])),u=new Map,P=new Map;for(const b of a){if(!b.parentId)continue;const N=u.get(b.parentId)??[];N.push(b),u.set(b.parentId,N)}for(const b of u.values())b.sort(Zs);for(const b of d){const N=P.get(b.source)??[];N.push(b),P.set(b.source,N)}const M=b=>{const N=D.get(b.target);return{id:b.id,source:b.source,target:b.target,targetLabel:N?Qs(N):b.target,label:Wn(b),kind:typeof b.data?.kind=="string"?b.data.kind:void 0}},C=b=>{const N=(u.get(b.id)??[]).map(C),p=b.data.column;return{id:b.id,label:Qs(b),kind:b.data.kind,summary:uo(b.data,g,l),columnName:p?w.get(p)??p:void 0,editable:b.data.kind!=="start"&&b.data.kind!=="end"&&!_e(b.id),parentId:b.parentId,templateLocalId:b.parentId?co(b.parentId,b.id):void 0,outgoing:(P.get(b.id)??[]).map(M),children:N}};return a.filter(b=>!b.parentId&&!_e(b.id)).sort(Zs).map(C)}function Vn(a){switch(typeof a?.seam=="string"?a.seam:""){case"planning":return"Generate the task plan and write the planning artifact that downstream workflow nodes consume.";case"execute":return"Run Fusion's standard implementation prompt for this task, generated from the task spec, current project context, workflow fields, and available tools.";case"step-execute":return"Run Fusion's step implementation prompt for the active planned step in the task worktree.";case"review":return"Run Fusion's review boundary for completed implementation work and route the task based on the review result.";case"merge":return"Run Fusion's merge boundary: verify merge readiness, apply the configured merge strategy, and update the final task state.";default:return""}}const qn=[{id:"claude-code",name:"Claude Code",tier:"native"},{id:"codex",name:"Codex",tier:"hybrid"},{id:"droid",name:"Droid",tier:"hybrid"},{id:"pi",name:"Pi",tier:"hybrid"},{id:"generic",name:"Generic CLI",tier:"generic"}],We=a=>a.startsWith("builtin:");function ea(a,d){return a&&d?`${a}/${d}`:""}function ta(a){if(!a)return{provider:"",modelId:""};const d=a.indexOf("/");return d===-1?{provider:"",modelId:""}:{provider:a.slice(0,d),modelId:a.slice(d+1)}}function _t(a,d,i,g,l,w,D){const{ir:u,layout:P}=ca(a,i,g,l.length?l:void 0,w.length?w:void 0,D.length?D:void 0);return JSON.stringify({name:a,description:d,ir:u,layout:P})}let sa=0;function aa(){return sa+=1,`n-${Date.now().toString(36)}-${sa}`}const Gn=["step-headings","json-steps"],Hn=["approve","revise","rethink","unavailable"],oa=["in-review","merged","failed","awaiting-approval","task-created","workflow-notify"],Bt="__custom",na=[{kind:"prompt",label:"Prompt",icon:Bo},{kind:"prompt",label:"User input",icon:Vo,presetConfig:{awaitInput:!0}},{kind:"script",label:"Script",icon:qo},{kind:"gate",label:"Gate",icon:Go},{kind:"merge",label:"Merge boundary",icon:Ho},{kind:"hold",label:"Hold",icon:Uo,presetConfig:{release:"manual"}},{kind:"split",label:"Split",icon:Ko},{kind:"join",label:"Join",icon:Yo,presetConfig:{mode:"all",onBranchFailure:"collect"}},{kind:"foreach",label:"For-each step",icon:Os,presetConfig:{source:"task-steps"}},{kind:"loop",label:"Loop",icon:Os,presetConfig:{maxIterations:3,exitWhen:{type:"output-contains",value:"DONE"}}},{kind:"step-review",label:"Step review",icon:Jo,presetConfig:{type:"code"}},{kind:"parse-steps",label:"Parse steps",icon:fa,presetConfig:{artifact:"PROMPT.md",parser:"step-headings"}},{kind:"code",label:"Code",icon:Xo,presetConfig:{source:""}},{kind:"notify",label:"Notify",icon:Qo,presetConfig:{event:"in-review",title:"{{taskTitle}}",message:""}}];function Un(a){const d={name:a.name,gateMode:a.gateMode??"advisory"};return a.description&&(d.description=a.description),a.mode==="script"?(a.scriptName&&(d.scriptName=a.scriptName),{kind:"script",label:a.name,config:d}):(d.prompt=a.prompt??"",d.toolMode=a.toolMode==="coding"?"coding":"readonly",a.modelProvider&&a.modelId&&(d.modelProvider=a.modelProvider,d.modelId=a.modelId),{kind:"prompt",label:a.name,config:d})}const Kn=new Set(["prompt","script","gate","code","hold","split","join","foreach","loop","step-review","parse-steps","notify","merge"]);function Yn({workflows:a,onCreate:d,onDesign:i,onClose:g}){const{t:l}=ke("app"),[w,D]=o.useState(""),[u,P]=o.useState(""),[M,C]=o.useState(null),[z,b]=o.useState(!1),[N,p]=o.useState(!1),[c,j]=o.useState(""),[h,T]=o.useState(!1),[k,R]=o.useState(null),U=o.useRef(null),[ee,B]=o.useState(!1),K=o.useRef(null),de=o.useRef([]),_=o.useMemo(()=>{const E={id:null,name:l("workflows.templateBlank","Blank"),description:l("workflows.templateBlankDescription","Start from an empty start → end graph."),nodeCount:0,builtin:!1},H=a.filter(oe=>oe.kind!=="fragment"),s=oe=>({id:oe.id,name:oe.name,description:oe.description??"",nodeCount:oe.ir.nodes.length,source:oe,builtin:We(oe.id)}),ue=H.filter(oe=>We(oe.id)).map(s),Ne=H.filter(oe=>!We(oe.id)).map(s);return[E,...ue,...Ne]},[a,l]),[Y,ce]=o.useState(0),v=_[Y]??_[0];o.useEffect(()=>{K.current?.focus()},[]);const S=o.useCallback(E=>{const H=_[E];H&&(ce(E),ee||(H.id===null?(D(""),P("")):(D(l("workflows.templateCopyName","{{name}} copy",{name:H.name})),P(H.description))),M&&C(null))},[_,ee,M,l]),$=o.useCallback(E=>{if(E.key==="ArrowDown"||E.key==="ArrowRight"){E.preventDefault();const H=Math.min(Y+1,_.length-1);S(H),de.current[H]?.focus()}else if(E.key==="ArrowUp"||E.key==="ArrowLeft"){E.preventDefault();const H=Math.max(Y-1,0);S(H),de.current[H]?.focus()}else(E.key==="Enter"||E.key===" ")&&(E.preventDefault(),S(Y),K.current?.focus())},[Y,_.length,S]),W=ua(g),ne=o.useCallback(async E=>{E.preventDefault();const H=w.trim();if(!H){C(l("workflows.createNameRequired","Enter a workflow name"));return}b(!0),C(null);try{await d(H,u.trim(),v)}catch(s){C(ae(s)||l("workflows.createFailed","Failed to create workflow")),b(!1)}},[w,u,v,d,l]),re=o.useCallback(async()=>{const E=c.trim();if(!E){R(l("workflows.aiPromptRequired","Describe the workflow you want"));return}const H=new AbortController;U.current=H,T(!0),R(null);try{await i(E,w.trim(),H.signal)}catch(s){if(H.signal.aborted)return;R(ae(s)||l("workflows.aiFailed","Failed to design workflow"))}finally{U.current===H&&(U.current=null),T(!1)}},[c,w,i,l]),le=o.useCallback(()=>{U.current?.abort(),T(!1)},[]),Q=_.findIndex(E=>E.id!==null&&E.builtin),se=_.findIndex(E=>E.id!==null&&!E.builtin);return e.jsx("div",{className:"modal-overlay open wf-create-overlay",...W,children:e.jsxs("div",{className:"modal wf-create-modal","data-testid":"wf-create-dialog",role:"dialog","aria-modal":"true","aria-label":l("workflows.createTitle","New workflow"),onClick:E=>E.stopPropagation(),onKeyDown:E=>{E.key==="Escape"&&(E.stopPropagation(),g())},children:[e.jsxs("div",{className:"modal-header",children:[e.jsx("h3",{children:l("workflows.createTitle","New workflow")}),e.jsx("button",{type:"button",className:"modal-close",onClick:g,"aria-label":l("actions.close","Close"),children:e.jsx(Ht,{size:16})})]}),e.jsxs("form",{onSubmit:ne,children:[e.jsxs("div",{className:"modal-body",children:[e.jsxs("div",{className:"wf-ai-create","aria-busy":h,"data-testid":"wf-ai-create",children:[e.jsxs("button",{type:"button",className:"wf-ai-toggle","data-testid":"wf-ai-toggle","aria-expanded":N,onClick:()=>{p(E=>!E),R(null)},children:[e.jsx($e,{size:13})," ",l("workflows.aiToggle","Describe it instead")]}),N&&e.jsxs("div",{className:"wf-ai-create-body",children:[e.jsx("textarea",{className:"wf-ai-prompt","data-testid":"wf-ai-prompt",rows:3,value:c,disabled:h,placeholder:l("workflows.aiPromptPlaceholder","e.g. Run lint and tests before merge, then post a changelog comment after merge"),onChange:E=>{j(E.target.value),k&&R(null)}}),k&&e.jsx("p",{className:"wf-create-error",role:"alert","data-testid":"wf-ai-error",children:k}),e.jsxs("div",{className:"wf-ai-actions",children:[e.jsxs("button",{type:"button",className:"btn btn-primary wf-ai-submit","data-testid":"wf-ai-submit",disabled:h,onClick:()=>void re(),children:[h?e.jsx(Ee,{size:13,className:"wf-spin"}):e.jsx($e,{size:13})," ",l("workflows.aiSubmit","Design with AI")]}),h&&e.jsx("button",{type:"button",className:"btn wf-ai-cancel","data-testid":"wf-ai-cancel",onClick:le,children:l("common.cancel","Cancel")})]})]})]}),e.jsxs("div",{className:"wf-field",children:[e.jsx("span",{id:"wf-template-label",children:l("workflows.templatePickerLabel","Start from")}),e.jsx("div",{className:"wf-template-list",role:"radiogroup","aria-labelledby":"wf-template-label","data-testid":"wf-template-list",children:_.map((E,H)=>{const s=H===Y,ue=E.id??"blank";return e.jsxs("div",{children:[H===Q&&Q>=0&&e.jsx("p",{className:"wf-template-section",children:l("workflows.templateSectionBuiltin","Built-in workflows")}),H===se&&se>=0&&e.jsx("p",{className:"wf-template-section",children:l("workflows.templateSectionYours","Your workflows")}),e.jsxs("div",{ref:Ne=>{de.current[H]=Ne},role:"radio","aria-checked":s,tabIndex:s?0:-1,className:`wf-template-option${s?" selected":""}`,"data-testid":E.id===null?"wf-template-option-blank":`wf-template-option-${E.id}`,onClick:()=>{S(H),de.current[H]?.focus()},onKeyDown:$,children:[e.jsx("span",{className:"wf-template-option-name",children:E.name}),E.description&&e.jsx("span",{className:"wf-template-option-desc",children:E.description}),E.id!==null&&e.jsx("span",{className:"wf-template-option-count",children:l("workflows.templateNodeCount","{{count}} nodes",{count:E.nodeCount})})]})]},ue)})})]}),e.jsxs("label",{className:"wf-field",children:[e.jsx("span",{children:l("workflows.createName","Name")}),e.jsx("input",{ref:K,"data-testid":"wf-create-name",value:w,onChange:E=>{D(E.target.value),B(!0),M&&C(null)}})]}),e.jsxs("label",{className:"wf-field",children:[e.jsx("span",{children:l("workflows.createDescription","Description (optional)")}),e.jsx("textarea",{rows:2,"data-testid":"wf-create-description",value:u,onChange:E=>P(E.target.value)})]}),M&&e.jsx("p",{className:"wf-create-error",role:"alert","data-testid":"wf-create-error",children:M})]}),e.jsxs("div",{className:"modal-actions",children:[e.jsx("button",{type:"button",className:"btn",onClick:g,children:l("common.cancel","Cancel")}),e.jsxs("button",{type:"submit",className:"btn btn-primary","data-testid":"wf-create-submit",disabled:z,children:[z?e.jsx(Ee,{size:13,className:"wf-spin"}):null," ",l("workflows.createSubmit","Create")]})]})]})]})})}function Jn({onClose:a,addToast:d,projectId:i,initialPanel:g,initialAction:l,initialWorkflowId:w,modalRef:D}){const[u,P]=o.useState([]),[M,C]=o.useState(null),b=mo()==="mobile",[N,p]=o.useState(()=>typeof window>"u"||typeof window.matchMedia!="function"?!1:window.matchMedia(Is).matches),[c,j]=o.useState(!1),[h,T]=o.useState(!1),[k,R]=o.useState(null),[U,ee]=o.useState(!1),[B,K,de]=Ha([]),[_,Y,ce]=Ua([]),[v,S]=o.useState(null),[$,W]=o.useState(null),[ne,re]=o.useState(!1),[le,Q]=o.useState(!1),[se,E]=o.useState(()=>g==="settings"?"settings":"graph"),H=b||le,{t:s}=ke("app"),{confirm:ue}=po(),[Ne,oe]=o.useState(l==="create"),De=o.useRef(null),Xe=o.useRef(null),[f,A]=o.useState(""),[V,Z]=o.useState(""),[ie,J]=o.useState(!1),[he,X]=o.useState(!1),fe=o.useRef(null),[te,Ve]=o.useState([]),[ye,qe]=o.useState([]),[Ce,Qe]=o.useState([]),pt=o.useRef(null),[Ut,wa]=o.useState([]),[ha,ga]=o.useState([...Gn]),[wt,xa]=o.useState([]),[ht,ba]=o.useState([]),Kt="fusion:wf-templates-collapsed",[ze,ka]=o.useState(()=>{try{const t=localStorage.getItem(Kt);return t!=null?t==="1":typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia(Is).matches}catch{return!1}}),[Ze,Yt]=o.useState(""),[et,Jt]=o.useState(null),Xt="fusion:wf-sidebar-columns-collapsed",Qt="fusion:wf-sidebar-fields-collapsed",Zt="fusion:wf-sidebar-settings-collapsed",[Ge,va]=o.useState(()=>{try{return localStorage.getItem(Xt)==="1"}catch{return!1}}),[He,ja]=o.useState(()=>{try{return localStorage.getItem(Qt)==="1"}catch{return!1}}),[Ue,Na]=o.useState(()=>{try{return localStorage.getItem(Zt)==="1"}catch{return!1}});o.useEffect(()=>{try{localStorage.setItem(Xt,Ge?"1":"0")}catch{}},[Ge]),o.useEffect(()=>{try{localStorage.setItem(Qt,He?"1":"0")}catch{}},[He]),o.useEffect(()=>{try{localStorage.setItem(Zt,Ue?"1":"0")}catch{}},[Ue]);const{setViewport:es}=Ka(),gt=o.useRef(null),tt=o.useMemo(()=>`fusion:wf-migration-notice-dismissed${i?`:${i}`:""}`,[i]),[ya,ts]=o.useState(!1),[ss,xt]=o.useState(null),[as,os]=o.useState([]),[ns,ls]=o.useState(!1),st=o.useRef(null),[bt,kt]=o.useState(!1),[at,vt]=o.useState(""),[ge,jt]=o.useState(!1),[Te,Le]=o.useState(null),ot=o.useRef(null),Nt=o.useRef(!1),F=o.useMemo(()=>u.find(t=>t.id===M),[u,M]),q=!!F&&We(F.id),is=o.useRef(M);is.current=M;const Ca=o.useMemo(()=>!F||q?!1:!B.some(t=>Kn.has(t.data.kind)),[F,q,B]),{experimentalFeatures:rs}=wo(i),ds=rs?.workflowColumns===!0&&rs?.workflowGraphExecutor===!0;o.useEffect(()=>{let t=!1;return ia(i).then(n=>{t||wa(n)}).catch(()=>{}),()=>{t=!0}},[i]),o.useEffect(()=>{let t=!1;return ho(i).then(n=>{!t&&n.length>0&&ga(n)}).catch(()=>{}),()=>{t=!0}},[i]),o.useEffect(()=>{let t=!1;return go().then(n=>{t||xa(n.templates??[])}).catch(()=>{}),xo().then(n=>{t||ba(n.templates??[])}).catch(()=>{}),()=>{t=!0}},[]),o.useEffect(()=>{try{localStorage.setItem(Kt,ze?"1":"0")}catch{}},[ze]),o.useEffect(()=>{v&&re(!1)},[v]),o.useEffect(()=>{g==="settings"&&E("settings")},[g]);const yt=o.useMemo(()=>u.filter(t=>t.kind==="fragment"),[u]),me=o.useMemo(()=>{const t=Ze.trim().toLowerCase(),n=I=>!t||I.toLowerCase().includes(t),r=(I,G)=>I.name.localeCompare(G.name),x=[...yt].sort(r).filter(I=>n(I.name)),y=[...wt].sort(r).filter(I=>n(I.name)),O=[...ht].sort((I,G)=>I.template.name.localeCompare(G.template.name)).filter(I=>n(I.template.name));return{fragmentEntries:x,stepEntries:y,pluginEntries:O}},[yt,wt,ht,Ze]),Ct=yt.length+wt.length+ht.length,cs=Ct>0,St=o.useMemo(()=>te.length?bo(te,Ut):[],[te,Ut]),Ie=o.useMemo(()=>ko(B,te),[B,te]),us=St.filter(t=>t.severity==="error").length,Ke=o.useMemo(()=>q||!F||fe.current===null?!1:_t(f,V,B,_,te,ye,Ce)!==fe.current,[q,F,f,V,B,_,te,ye,Ce]),Oe=o.useCallback(async()=>{j(!0);try{const t=await vo(i);P(t),C(n=>n&&t.some(r=>r.id===n)?n:l!=="create"&&w&&t.some(r=>r.id===w)?w:b?null:t[0]?.id??null)}catch(t){d(ae(t)||"Failed to load workflows","error")}finally{j(!1)}},[i,d,b,l,w]);o.useEffect(()=>{Oe()},[Oe]),o.useEffect(()=>{!w||!b||!N||M===w&&Xe.current!==w&&(Xe.current=w,p(!1))},[M,w,b,N]);const fs=o.useRef(!1);o.useEffect(()=>{if(fs.current)return;fs.current=!0;let t=!1;return(async()=>{try{const n=await jo(i);if(t)return;if(n.migrated>0){if(await Oe(),t)return;let r=!1;try{r=localStorage.getItem(tt)==="1"}catch{}r||ts(!0)}}catch{}})(),()=>{t=!0}},[i,Oe,tt]);const Sa=o.useCallback(()=>{ts(!1);try{localStorage.setItem(tt,"1")}catch{}},[tt]),nt=o.useCallback(async()=>{if(F)try{await No(F.id,i)}catch(t){d(ae(t)||s("workflows.exportFailed","Failed to export workflow"),"error")}},[F,i,d,s]),Ea=o.useCallback(async t=>{const n=t.target.files?.[0];if(st.current&&(st.current.value=""),!!n){xt(null),os([]),ls(!0);try{const r=await n.text();let x;try{x=JSON.parse(r)}catch{xt(s("workflows.importInvalidJson","That file isn't valid JSON."));return}const y=await yo(x,i);await Oe(),C(y.workflow.id),p(!1),d(s("workflows.imported",'Imported workflow "{{name}}"',{name:y.workflow.name}),"success"),y.strippedApprovalFlags&&d(s("workflows.importStripped","Auto-approval flags were removed from imported nodes"),"warning"),y.warnings.length>0&&os(y.warnings)}catch(r){r instanceof da&&r.status>=400&&r.status<500?xt(ae(r)||s("workflows.importFailed","Import failed")):d(ae(r)||s("workflows.importFailed","Import failed"),"error")}finally{ls(!1)}}},[i,Oe,d,s]);o.useEffect(()=>{if(!F){K([]),Y([]),Ve([]),qe([]),Qe([]),A(""),Z(""),fe.current=null;return}const t=Ms(F),n=As(F),r=Rs(F),x=Co(F),y=_s(t.nodes,t.edges,n),O=Bs(t.nodes,y);K(O),Y(t.edges),Ve(n),qe(r),Qe(x),A(F.name),Z(F.description??""),J(!1),X(!1),fe.current=_t(F.name,F.description??"",O,t.edges,n,r,x),S(null),W(null),R(null),es({x:0,y:0,zoom:1},{duration:0}),Nt.current?(Nt.current=!1,ee(!0)):ee(!1)},[F,K,Y,es]);const Et=o.useRef(!1);o.useEffect(()=>{if(g!=="settings"||Et.current||!F)return;const t=pt.current;t&&(Et.current=!0,t.scrollIntoView({behavior:"smooth",inline:"end",block:"nearest"}))},[g,F]),o.useEffect(()=>()=>{Et.current=!1},[g]);const[Ft,ms]=o.useState(null);o.useEffect(()=>{K(t=>{const n=t.filter(r=>!_e(r.id)&&r.type!=="group");return[...So(te),...n]})},[te,K]);const Fa=o.useCallback(t=>{const n=Eo(t,_,B);if("error"in n){n.error==="cycle"&&d(s("workflowNodes.cycleBlocked","That connection would create a cycle — only rework edges inside a for-each template may loop back"),"warning");return}Y(r=>[...r,n.edge])},[_,B,Y,d,s]),Ia=o.useCallback((t,n)=>{if(_e(n.id)||te.length===0)return;const r=Vt(n.position.y,te);r&&K(x=>x.map(y=>y.id===n.id?{...y,data:{...y.data,column:r}}:y))},[te,K]),lt=o.useCallback((t,n,r)=>{const x=aa(),y=n??(t==="merge"?"Merge boundary":t.charAt(0).toUpperCase()+t.slice(1)),O=t==="gate"?{gateMode:"gate"}:{},I=r?{...O,...r}:O;if(t==="foreach"||t==="loop"){const G=Fo(x,aa()),we=t==="foreach"?s("workflowNodes.stepExecuteLabel","Step execute"):s("workflowNodes.loopStepLabel","Loop step"),Se=t==="foreach"?{seam:"step-execute"}:{prompt:""};K(Tt=>[...Tt,{id:x,type:t,position:{x:200+Tt.length*40,y:240+Tt.length%3*70},data:{kind:t,label:y,config:I,templateEmpty:!1},style:{width:Mo,height:Io},deletable:!0},{id:G,type:"prompt",position:{x:Ro,y:Ao},parentId:x,extent:"parent",data:{kind:"prompt",label:we,config:Se},deletable:!0}]),S(x);return}K(G=>[...G,{id:x,type:t,position:{x:200+G.length*40,y:240+G.length%3*70},data:{kind:t,label:y,config:I},deletable:!0}]),S(x)},[K,s]),it=o.useCallback(t=>{if(q)return;const{kind:n,label:r,config:x}=Un(t);lt(n,r,x)},[q,lt]),ps=o.useCallback(t=>{if(q)return!1;const n=Po(t.ir,B);if(n.length>0)return Jt(n.join(", ")),!1;Jt(null);const r=Do(B,_,t.ir,{x:240,y:200+B.length%4*40},t.layout);return K(r.nodes),Y(r.edges),S(r.insertedNodeIds[0]??null),!0},[q,B,_,K,Y]),ws=o.useCallback(()=>{K(t=>Bs(t,_s(t,_,te)))},[K,_,te]),hs=o.useCallback(async()=>{if(!F||q)return;const t=at.trim();if(!t){Le(s("workflows.aiPromptRequired","Describe the workflow you want"));return}const n=new AbortController;ot.current=n;const r=F;jt(!0),Le(null);try{const x=await Ps({prompt:t,workflowId:r.id},i,n.signal);if(is.current!==r.id){d(s("workflows.aiStaleDiscarded","Discarded AI design — you switched workflows"),"warning");return}if(!await ue({title:s("workflows.aiReplaceTitle","Replace graph?"),message:s("workflows.aiReplaceConfirm","Replace the current graph with the AI design? Unsaved changes will be lost."),confirmLabel:s("workflows.aiReplaceConfirmLabel","Replace"),danger:!0}))return;const O=Ms({...r,ir:x.ir,layout:x.layout});K(O.nodes),Y(O.edges),Ve(As({...r,ir:x.ir})),qe(Rs({...r,ir:x.ir})),S(null),W(null),R(null),ee(x.interpreterOnly),x.strippedApprovalFlags&&d(s("workflows.importStripped","Auto-approval flags were removed from imported nodes"),"warning"),kt(!1),vt("")}catch(x){if(n.signal.aborted)return;Le(ae(x)||s("workflows.aiFailed","Failed to design workflow"))}finally{ot.current===n&&(ot.current=null),jt(!1)}},[F,q,at,i,ue,s,K,Y,d]),gs=o.useCallback(()=>{ot.current?.abort(),jt(!1)},[]),L=o.useCallback(t=>{v&&K(n=>n.map(r=>r.id===v?{...r,data:{...r.data,..."config"in t?{config:typeof t.config=="function"?t.config(r.data.config??{}):{...r.data.config??{},...t.config}}:t}}:r))},[v,K]),It=o.useCallback(t=>{$&&Y(n=>n.map(r=>{if(r.id!==$)return r;const x=t.condition??r.data?.condition??"success",y=t.rework??r.data?.kind==="rework";return{...r,label:y?`${Ds(x)} (rework)`:Ds(x),data:{...r.data??{},condition:x,kind:y?"rework":void 0},type:y?"step":void 0,animated:y,className:zo(x,y)}}))},[$,Y]),xs=o.useCallback(t=>{const n=new Set(t);let r=null;K(x=>(r=zs(x,_,n),r.nodes)),r&&Y(r.edges),v!==null&&n.has(v)&&S(null),$!==null&&n.has($)&&W(null)},[_,K,Y,v,$]),Ma=o.useCallback(async({nodes:t,edges:n})=>{if(q)return!1;const r=new Set([...t.map(I=>I.id),...n.map(I=>I.id)]),x=zs(B,_,r),y=new Set(B.map(I=>I.id));for(const I of x.nodes)y.delete(I.id);const O=new Set(_.map(I=>I.id));for(const I of x.edges)O.delete(I.id);return y.size===0&&O.size===0?!1:{nodes:B.filter(I=>y.has(I.id)),edges:_.filter(I=>O.has(I.id))}},[q,B,_]),Aa=o.useCallback(()=>{S(null),gt.current?.focus()},[]),Ra=o.useCallback(()=>{W(null),gt.current?.focus()},[]),Ye=o.useCallback(()=>{oe(!1),De.current?.focus()},[]),Pa=o.useCallback(async(t,n,r)=>{const x=r.source!==void 0?To(r.source.ir,r.source.layout):{ir:nn(t),layout:on()},y=await Lt({name:t,description:n||void 0,kind:"workflow",ir:x.ir,layout:x.layout},i);P(O=>[...O,y]),C(y.id),p(!1),d(s("workflows.created",'Created workflow "{{name}}"',{name:y.name}),"success"),Ye()},[i,d,s,Ye]),Da=o.useCallback(async(t,n,r)=>{const x=await Ps({prompt:t},i,r),y=`AI: ${t.slice(0,30)}`,I=await Lt({name:n||y,kind:"workflow",ir:x.ir,layout:x.layout},i);Nt.current=x.interpreterOnly,P(G=>[...G,I]),C(I.id),p(!1),d(s("workflows.created",'Created workflow "{{name}}"',{name:I.name}),"success"),x.strippedApprovalFlags&&d(s("workflows.importStripped","Auto-approval flags were removed from imported nodes"),"warning"),Ye()},[i,d,s,Ye]),bs=o.useCallback(async()=>{if(!(!F||We(F.id)||!await ue({title:s("workflows.deleteTitle","Delete workflow?"),message:s("workflows.deleteMessage",'Delete workflow "{{name}}"? This cannot be undone.',{name:F.name}),confirmLabel:s("common.delete","Delete"),danger:!0})))try{await Lo(F.id,i),P(n=>n.filter(r=>r.id!==F.id)),C(null),b&&p(!0),d(s("workflows.deleted","Workflow deleted"),"success")}catch(n){d(ae(n)||s("workflows.deleteFailed","Failed to delete workflow"),"error")}},[F,i,d,ue,s,b]),ks=o.useCallback(async()=>{if(F)try{const t=await Lt({name:`${F.name} (copy)`,description:F.description,ir:F.ir,layout:F.layout},i);P(n=>[...n,t]),C(t.id),p(!1),d(`Duplicated to "${t.name}" — editable`,"success")}catch(t){d(ae(t)||"Failed to duplicate workflow","error")}},[F,i,d]),vs=o.useCallback(async()=>{if(F&&!We(F.id)){if(Ie.length>0){const t=s("workflowColumns.unplacedCount","{{count}} nodes not placed in a column",{count:Ie.length});R(t),d(t,"error");return}if(us>0){const t=s("workflowColumns.compositionBlocked","Resolve trait conflicts on highlighted columns before saving");R(t),d(t,"error");return}T(!0),R(null),ee(!1),ms(null);try{const t=f.trim()||F.name,{ir:n,layout:r}=ca(t,B,_,te.length?te:void 0,ye.length?ye:void 0,Ce.length?Ce:void 0),x=t!==F.name,y=V!==(F.description??""),O=async G=>{P(we=>we.map(Se=>Se.id===G.id?G:Se)),fe.current=_t(G.name,G.description??"",B,_,te,ye,Ce),A(G.name),Z(G.description??"");try{await Oo(G.id,i),d(s("workflows.saved","Workflow saved"),"success")}catch(we){const Se=ae(we)||"";Se.includes("require the workflow interpreter (deferred)")?ee(!0):R(Se||s("workflows.savedNotCompilable","Workflow saved but cannot be compiled"))}},I={ir:n,layout:r,...x?{name:t}:{},...y?{description:V}:{}};try{await O(await Ts(F.id,I,i))}catch(G){if(!(G?.details?.policyEscalation===!0))throw G;if(!window.confirm(`${ae(G)}
7
+
8
+ ${s("workflowColumns.confirmPolicyEscalation","Bind it anyway? The column agent will run with broader permissions than this project's default.")}`)){d(s("workflowColumns.escalationDeclined","Save cancelled — column agent binding not confirmed"),"error");return}await O(await Ts(F.id,{...I,confirmPolicyEscalation:!0},i))}}catch(t){const n=ae(t)||s("workflows.saveFailed","Failed to save workflow"),r=/node '([^']+)'/.exec(n);r&&B.some(x=>x.id===r[1])&&ms({nodeId:r[1],message:n}),R(n),d(n,"error")}finally{T(!1)}}},[F,f,V,B,_,te,ye,Ce,Ie,us,i,d,s]),Mt=o.useMemo(()=>{const t=new Set(Ie),n=new Map;for(const r of B)r.parentId&&n.set(r.parentId,(n.get(r.parentId)??0)+1);return B.map(r=>{let x;t.has(r.id)&&(x=s("workflowColumns.nodeUnplaced","Not placed in a column")),Ft?.nodeId===r.id&&(x=Ft.message);const y=r.data.kind==="foreach"||r.data.kind==="loop",O=r.data.kind==="loop"?s("workflowNodes.loopEmptyHint","Drag loop steps here"):s("workflowNodes.foreachEmptyHint","Drag a step-execute node here"),I=y?(n.get(r.id)??0)===0:void 0;return x===r.data.errorBadge&&(!y||I===r.data.templateEmpty&&r.data.emptyHint===O)?r:{...r,data:{...r.data,errorBadge:x,...y?{templateEmpty:I,emptyHint:O}:{}}}})},[B,Ie,Ft,s]),m=B.find(t=>t.id===v)??null,js=m!==null&&m.data.kind!=="start"&&m.data.kind!=="end",za=b&&js&&!ne,ve=_.find(t=>t.id===$)??null,[At,Ns]=o.useState(!1),ys=o.useCallback(()=>{Ns(t=>!t)},[]),Ta=o.useCallback(t=>{!At||t.key!=="Escape"||(t.preventDefault(),t.stopPropagation(),Ns(!1))},[At]),Cs=m&&(m.data.kind==="prompt"||m.data.kind==="gate")?String(m.data.config?.prompt??(q?Vn(m.data.config):"")):"",Ss=o.useMemo(()=>{if(!ve)return"readonly";const t=B.find(n=>n.id===ve.source);return $o(t?.data.kind)},[ve,B]),Rt=o.useMemo(()=>{const t=F?.ir;return t&&t.version==="v2"&&Array.isArray(t.artifacts)?t.artifacts.map(n=>n.key):[]},[F]),[Me,Pt]=o.useState([]),[xe,rt]=o.useState([]);o.useEffect(()=>{rt([])},[i]);const[Je,Es]=o.useState([]),[La,Oa]=o.useState(qn);o.useEffect(()=>{let t=!1;return Promise.resolve(ft()).then(n=>{!t&&n?.models&&Pt(n.models)}).catch(()=>{}),Promise.resolve(ut()).then(n=>{!t&&Array.isArray(n)&&rt(n)}).catch(()=>{}),Promise.resolve(Ls(i)).then(n=>{!t&&Array.isArray(n)&&Es(n)}).catch(()=>{}),()=>{t=!0}},[i]);const Dt=o.useMemo(()=>({models:Me.map(t=>({provider:t.provider,id:t.id,name:t.name})),agents:xe.map(t=>({id:t.id,name:t.name})),skills:Je.map(t=>({id:t.id,name:t.name}))}),[Me,xe,Je]),$a=o.useMemo(()=>Bn(Mt,_,te,Dt,s),[Mt,_,te,Dt,s]),pe=m?.data.config?.executor??"model",Ae=o.useMemo(()=>{const t=m?.data.column??(m?.parentId?B.find(r=>r.id===m.parentId)?.data.column:void 0);if(!t)return;const n=te.find(r=>r.id===t);if(!(!n?.agent||n.agent.mode!=="override"))return n.agent},[m?.data.column,m?.parentId,B,te]),Wa=o.useMemo(()=>Ae?xe.find(t=>t.id===Ae.agentId):void 0,[Ae,xe]);o.useEffect(()=>{if(pe!=="cli-agent")return;let t=!1;return fetch("/api/cli-agents").then(n=>n.ok?n.json():null).then(n=>{t||!n?.adapters||Oa(n.adapters)}).catch(()=>{}),()=>{t=!0}},[pe]),o.useEffect(()=>{if(m?.data.kind==="step-review"&&Me.length===0){ft().then(t=>Pt(t.models)).catch(t=>{d(ae(t)||"Failed to load models","error")});return}!m||m.data.kind!=="prompt"&&m.data.kind!=="gate"||(pe==="model"&&Me.length===0?ft().then(t=>Pt(t.models)).catch(t=>{d(ae(t)||"Failed to load models","error")}):pe==="agent"&&xe.length===0?ut(void 0,i).then(rt).catch(t=>{d(ae(t)||"Failed to load agents","error")}):pe==="skill"&&Je.length===0&&Ls(i).then(Es).catch(t=>{d(ae(t)||"Failed to load skills","error")}))},[pe,m?.id,m?.data.kind,i,d,Me.length,xe.length,Je.length]);const dt=o.useCallback(t=>{if(!Ke){t();return}ue({title:s("workflows.discardTitle","Discard unsaved changes?"),message:s("workflows.discardMessage","You have unsaved changes to this workflow. Discard them?"),confirmLabel:s("workflows.discardConfirm","Discard"),danger:!0}).then(n=>{n&&t()})},[Ke,ue,s]),zt=o.useCallback(()=>{dt(a)},[dt,a]),_a=o.useCallback(t=>{if(t===M){p(!1);return}dt(()=>{C(t),p(!1)})},[dt,M]);o.useEffect(()=>{if(!Ae||xe.length>0)return;let t=!1;return Promise.resolve(ut(void 0,i)).then(n=>{t||rt(n??[])}).catch(n=>{t||d(ae(n)||"Failed to load agents","error")}),()=>{t=!0}},[Ae,xe.length,i,d]);const Ba=ua(zt),Va=At&&(m?.data.kind==="prompt"||m?.data.kind==="gate")?qa.createPortal(e.jsxs("div",{className:"wf-prompt-editor wf-prompt-editor--fullscreen",onKeyDown:Ta,children:[e.jsxs("div",{className:"wf-prompt-fullscreen-header",children:[e.jsx("span",{children:s("workflowEditor.editingPrompt","Editing Prompt")}),e.jsx("button",{type:"button",className:"btn btn-sm wf-prompt-expand-btn",onClick:ys,"aria-label":s("workflowEditor.collapsePrompt","Collapse prompt editor"),title:s("workflowEditor.collapsePrompt","Collapse prompt editor"),children:e.jsx(Wo,{size:14})})]}),e.jsxs("label",{className:"wf-field",children:[e.jsx("span",{children:"Prompt"}),e.jsx("textarea",{rows:void 0,value:Cs,readOnly:q,onChange:t=>L({config:{prompt:t.target.value}}),autoFocus:!0})]})]}),document.body):null;return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"modal-overlay open wf-editor-overlay",...Ba,children:e.jsxs("div",{className:"modal wf-editor-modal",ref:D,onClick:t=>t.stopPropagation(),onKeyDown:t=>{if(t.key!=="Escape"||Ne)return;const r=t.target.tagName;r==="INPUT"||r==="TEXTAREA"||r==="SELECT"||(t.stopPropagation(),zt())},children:[e.jsxs("header",{className:"wf-editor-header",children:[e.jsx("h2",{children:"Workflows"}),e.jsx("button",{className:"wf-editor-close",onClick:zt,"aria-label":"Close workflow editor",children:e.jsx(Ht,{size:18})})]}),ya?e.jsxs("div",{className:"wf-migration-notice",role:"status","data-testid":"wf-migration-notice",children:[e.jsx("span",{className:"wf-migration-notice-text",children:s("workflows.migrationNotice",'Your legacy workflow steps were converted — find them as templates in the palette and as the "Migrated steps" workflow.')}),e.jsx("button",{type:"button",className:"wf-migration-notice-dismiss","data-testid":"wf-migration-notice-dismiss",onClick:Sa,"aria-label":s("common.dismiss","Dismiss"),children:e.jsx(Ht,{size:14})})]}):null,e.jsxs("div",{className:`wf-editor-body${N?" wf-editor-body--list-stage":" wf-editor-body--editor-stage"}${H?" wf-editor-body--simple-layout":""}${za?" wf-editor-body--mobile-node-detail":""}`,children:[e.jsxs("aside",{className:"wf-editor-sidebar",children:[e.jsxs("button",{className:"wf-editor-new",ref:De,"data-testid":"wf-new-workflow",onClick:()=>oe(!0),children:[e.jsx(je,{size:14})," ",s("workflows.newWorkflow","New workflow")]}),e.jsxs("button",{type:"button",className:"wf-editor-import","data-testid":"wf-import",disabled:ns,onClick:()=>st.current?.click(),title:s("workflows.importTooltip","Import a workflow from a JSON file"),children:[ns?e.jsx(Ee,{size:14,className:"wf-spin"}):e.jsx(ln,{size:14})," ",s("workflows.import","Import")]}),e.jsx("input",{ref:st,type:"file",accept:".json",className:"wf-editor-import-input","data-testid":"wf-import-input",style:{display:"none"},onChange:Ea}),ss&&e.jsx("div",{className:"wf-editor-import-error",role:"alert","data-testid":"wf-import-error",children:ss}),as.length>0&&e.jsx("div",{className:"wf-editor-import-warnings","data-testid":"wf-import-warnings",children:as.map((t,n)=>e.jsx("p",{className:"wf-editor-import-warning",children:t},n))}),b&&u.length>0&&!F?e.jsx("div",{className:"wf-editor-select-note","data-testid":"wf-mobile-select-note",children:s("workflows.mobileSelectNote","Select a workflow to edit.")}):null,c?e.jsxs("div",{className:"wf-editor-empty",children:[e.jsx(Ee,{size:16,className:"wf-spin"})," Loading…"]}):u.length===0?e.jsx("div",{className:"wf-editor-empty",children:"No workflows yet."}):e.jsx("ul",{className:"wf-editor-list",children:u.map(t=>e.jsx("li",{children:e.jsx("button",{className:`wf-editor-list-item${t.id===M?" active":""}`,onClick:()=>_a(t.id),children:t.name})},t.id))}),F&&!H&&e.jsxs("div",{className:"wf-sidebar-panels",children:[e.jsxs("section",{className:"wf-sidebar-section","data-testid":"wf-sidebar-columns-section",children:[e.jsxs("button",{type:"button",className:"wf-sidebar-section-toggle","aria-expanded":!Ge,"data-testid":"wf-sidebar-columns-toggle",onClick:()=>va(t=>!t),children:[Ge?e.jsx(Re,{size:13}):e.jsx(Fe,{size:13}),e.jsx("span",{children:s("workflowColumns.title","Columns")})]}),!Ge&&e.jsx(qs,{columns:te,onChange:Ve,violations:St,readOnly:q,projectId:i,addToast:d,columnAgentsEnabled:ds})]}),e.jsxs("section",{className:"wf-sidebar-section","data-testid":"wf-sidebar-fields-section",children:[e.jsxs("button",{type:"button",className:"wf-sidebar-section-toggle","aria-expanded":!He,"data-testid":"wf-sidebar-fields-toggle",onClick:()=>ja(t=>!t),children:[He?e.jsx(Re,{size:13}):e.jsx(Fe,{size:13}),e.jsx("span",{children:s("workflowFields.title","Fields")})]}),!He&&e.jsx(Us,{fields:ye,onChange:qe,readOnly:q,addToast:d})]}),e.jsxs("section",{className:"wf-sidebar-section","data-testid":"wf-sidebar-settings-section",children:[e.jsxs("button",{type:"button",className:"wf-sidebar-section-toggle","aria-expanded":!Ue,"data-testid":"wf-sidebar-settings-toggle",onClick:()=>Na(t=>!t),children:[Ue?e.jsx(Re,{size:13}):e.jsx(Fe,{size:13}),e.jsx("span",{children:s("workflowSettings.title","Settings")})]}),!Ue&&e.jsx("div",{ref:pt,className:"wf-settings-panel-wrap",children:e.jsx(Xs,{workflowId:F.id,settings:Ce,onChange:Qe,readOnly:q,projectId:i,addToast:d,initialTab:"values"})})]})]})]}),e.jsxs("section",{className:"wf-editor-canvas-wrap",children:[e.jsxs("button",{type:"button",className:"wf-editor-mobile-back",onClick:()=>p(!0),"aria-label":s("workflows.backToWorkflowList","Back to workflows"),children:[e.jsx(_o,{size:16}),e.jsx("span",{children:s("common.back","Back")})]}),F?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"wf-name-strip",children:[q?e.jsx("span",{className:"wf-workflow-name wf-workflow-name--readonly","data-testid":"wf-workflow-name",children:F.name}):ie?e.jsx("input",{className:"wf-workflow-name-input","data-testid":"wf-workflow-name-input",autoFocus:!0,value:f,"aria-label":s("workflows.nameLabel","Workflow name"),onChange:t=>A(t.target.value),onKeyDown:t=>{t.key==="Enter"?(t.preventDefault(),f.trim()||A(F.name),J(!1)):t.key==="Escape"&&(t.preventDefault(),A(F.name),J(!1))},onBlur:()=>{f.trim()||A(F.name),J(!1)}}):e.jsx("button",{type:"button",className:"wf-workflow-name","data-testid":"wf-workflow-name",onClick:()=>J(!0),title:s("workflows.clickToRename","Click to rename"),children:f||F.name}),q?F.description?e.jsx("span",{className:"wf-workflow-description wf-workflow-description--readonly","data-testid":"wf-workflow-description",children:F.description}):null:he?e.jsx("input",{className:"wf-workflow-description-input","data-testid":"wf-workflow-description-input",autoFocus:!0,value:V,"aria-label":s("workflows.descriptionLabel","Workflow description"),placeholder:s("workflows.descriptionPlaceholder","Add a description"),onChange:t=>Z(t.target.value),onKeyDown:t=>{t.key==="Enter"?(t.preventDefault(),X(!1)):t.key==="Escape"&&(t.preventDefault(),Z(F.description??""),X(!1))},onBlur:()=>X(!1)}):e.jsx("button",{type:"button",className:"wf-workflow-description","data-testid":"wf-workflow-description",onClick:()=>X(!0),title:s("workflows.clickToEditDescription","Click to edit description"),children:V||s("workflows.descriptionPlaceholder","Add a description")}),!b&&e.jsxs("button",{type:"button",className:"wf-layout-toggle","data-testid":"wf-layout-toggle","aria-pressed":le,onClick:()=>Q(t=>!t),children:[le?e.jsx(Ot,{size:14}):e.jsx(fa,{size:14}),e.jsx("span",{children:le?s("workflows.showCanvasEditor","Show canvas editor"):s("workflows.showSimpleEditor","Show simple editor")})]})]}),H&&e.jsxs("div",{className:"wf-mobile-shell","data-testid":"wf-mobile-shell",children:[e.jsx("nav",{className:"wf-mobile-tabs","aria-label":s("workflows.mobileEditorNav","Workflow editor sections"),children:[["graph",s("workflowNodes.mobileGraph","Graph")],["add",s("workflowNodes.mobileAdd","Add")],["settings",s("workflowSettings.title","Settings")],["fields",s("workflowFields.title","Fields")],["columns",s("workflowColumns.title","Columns")],["actions",s("workflowNodes.mobileActions","Actions")]].map(([t,n])=>e.jsx("button",{type:"button",className:`wf-mobile-tab${se===t?" wf-mobile-tab--active":""}`,"aria-current":se===t?"page":void 0,"data-testid":`wf-mobile-tab-${t}`,onClick:()=>E(t),children:n},t))}),e.jsxs("div",{className:"wf-mobile-panel","data-testid":`wf-mobile-panel-${se}`,children:[se==="graph"&&e.jsx($n,{rows:$a,selectedNodeId:v,selectedEdgeId:$,onSelectNode:t=>{S(t),W(null),re(!1)},onSelectEdge:t=>{W(t),S(null)}}),se==="add"&&e.jsx("div",{className:"wf-mobile-add",children:q?e.jsx("p",{className:"wf-inspector-note wf-inspector-note--info",children:s("workflows.readOnlyBuiltin","Read-only built-in workflow")}):e.jsxs(e.Fragment,{children:[e.jsxs("section",{className:"wf-mobile-add-section",children:[e.jsx("h3",{children:s("workflowNodes.mobileNodeKinds","Node types")}),e.jsx("div",{className:"wf-mobile-add-grid",children:na.map(({kind:t,label:n,icon:r,presetConfig:x})=>e.jsxs("button",{type:"button",className:"wf-mobile-add-option","data-testid":`wf-mobile-add-${t}-${n.toLowerCase().replace(/[^a-z0-9]+/g,"-")}`,onClick:()=>{lt(t,n,x),E("graph")},children:[e.jsx(r,{size:16,"aria-hidden":!0}),e.jsx("span",{children:n})]},n))})]}),cs&&e.jsxs("section",{className:"wf-mobile-add-section",children:[e.jsx("h3",{children:s("workflowNodes.templatesSection","Templates")}),Ct>8&&e.jsx("input",{type:"text",className:"wf-templates-filter wf-mobile-template-filter","data-testid":"wf-mobile-template-filter",value:Ze,onChange:t=>Yt(t.target.value),placeholder:s("workflowNodes.templateFilterPlaceholder","Filter templates"),"aria-label":s("workflowNodes.templateFilterLabel","Filter templates")}),et&&e.jsx("div",{className:"wf-templates-conflict",role:"alert","data-testid":"wf-mobile-tpl-conflict",children:s("workflowNodes.templateSeamConflict",`This fragment duplicates the "{{seam}}" seam already on the canvas, so it can't be inserted.`,{seam:et})}),me.fragmentEntries.length>0&&e.jsxs("div",{className:"wf-mobile-template-group",children:[e.jsx("h4",{children:s("workflowNodes.templatesFragments","Fragments")}),me.fragmentEntries.map(t=>e.jsx("button",{type:"button",className:"wf-mobile-template-option","data-testid":`wf-mobile-tpl-fragment-${t.id}`,onClick:()=>{ps(t)&&E("graph")},children:t.name},t.id))]}),me.stepEntries.length>0&&e.jsxs("div",{className:"wf-mobile-template-group",children:[e.jsx("h4",{children:s("workflowNodes.templatesBuiltinSteps","Built-in steps")}),me.stepEntries.map(t=>e.jsx("button",{type:"button",className:"wf-mobile-template-option","data-testid":`wf-mobile-tpl-step-${t.id}`,onClick:()=>{it(t),E("graph")},children:t.name},t.id))]}),me.pluginEntries.length>0&&e.jsxs("div",{className:"wf-mobile-template-group",children:[e.jsx("h4",{children:s("workflowNodes.templatesPluginSteps","Plugin steps")}),me.pluginEntries.map(({pluginId:t,template:n})=>e.jsxs("button",{type:"button",className:"wf-mobile-template-option","data-testid":`wf-mobile-tpl-plugin-${n.id}`,onClick:()=>{it(n),E("graph")},children:[e.jsx("span",{children:n.name}),e.jsx("span",{className:"wf-templates-badge",children:t})]},`${t}:${n.id}`))]})]})]})}),se==="settings"&&F&&e.jsx("div",{ref:pt,className:"wf-mobile-destination",children:e.jsx(Xs,{workflowId:F.id,settings:Ce,onChange:Qe,readOnly:q,projectId:i,addToast:d,initialTab:"values"})}),se==="fields"&&e.jsx("div",{className:"wf-mobile-destination",children:e.jsx(Us,{fields:ye,onChange:qe,readOnly:q,addToast:d})}),se==="columns"&&e.jsx("div",{className:"wf-mobile-destination",children:e.jsx(qs,{columns:te,onChange:Ve,violations:St,readOnly:q,projectId:i,addToast:d,columnAgentsEnabled:ds})}),se==="actions"&&e.jsx("div",{className:"wf-mobile-actions",children:q?e.jsxs(e.Fragment,{children:[e.jsx("p",{className:"wf-inspector-note wf-inspector-note--info",children:s("workflows.readOnlyBuiltin","Read-only built-in workflow")}),e.jsxs("button",{className:"wf-editor-action","data-testid":"wf-mobile-export",onClick:nt,children:[e.jsx(ct,{size:15})," ",s("workflows.export","Export")]}),e.jsxs("button",{className:"wf-editor-save wf-editor-duplicate-primary","data-testid":"wf-mobile-duplicate",onClick:ks,children:[e.jsx(je,{size:15})," ",s("workflows.duplicateToCustomize","Duplicate to customize")]})]}):e.jsxs(e.Fragment,{children:[e.jsxs("button",{className:"wf-editor-save","data-testid":"wf-mobile-save",onClick:vs,disabled:h,children:[h?e.jsx(Ee,{size:15,className:"wf-spin"}):e.jsx(qt,{size:15}),s("common.save","Save")]}),e.jsxs("button",{className:"wf-editor-action","data-testid":"wf-mobile-ai-edit",onClick:()=>kt(t=>!t),children:[e.jsx($e,{size:15})," ",s("workflows.aiEdit","Design with AI")]}),bt&&e.jsxs("div",{className:"wf-ai-panel wf-mobile-ai-panel","data-testid":"wf-mobile-ai-panel",role:"dialog","aria-busy":ge,children:[e.jsx("textarea",{className:"wf-ai-prompt","data-testid":"wf-mobile-ai-edit-prompt",rows:4,value:at,disabled:ge,placeholder:s("workflows.aiPromptPlaceholder","e.g. Run lint and tests before merge, then post a changelog comment after merge"),onChange:t=>{vt(t.target.value),Te&&Le(null)}}),Te&&e.jsx("p",{className:"wf-create-error",role:"alert","data-testid":"wf-mobile-ai-edit-error",children:Te}),e.jsxs("div",{className:"wf-ai-actions",children:[e.jsxs("button",{type:"button",className:"btn btn-primary wf-ai-submit","data-testid":"wf-mobile-ai-edit-submit",disabled:ge,onClick:()=>void hs(),children:[ge?e.jsx(Ee,{size:13,className:"wf-spin"}):e.jsx($e,{size:13}),s("workflows.aiSubmit","Design with AI")]}),ge&&e.jsx("button",{type:"button",className:"btn wf-ai-cancel",onClick:gs,children:s("common.cancel","Cancel")})]})]}),e.jsxs("button",{className:"wf-editor-action","data-testid":"wf-mobile-auto-layout",onClick:ws,children:[e.jsx(Ot,{size:15})," ",s("workflowNodes.autoLayout","Auto-layout")]}),e.jsxs("button",{className:"wf-editor-action","data-testid":"wf-mobile-export",onClick:nt,disabled:Ke,children:[e.jsx(ct,{size:15})," ",s("workflows.export","Export")]}),e.jsxs("button",{className:"wf-editor-delete","data-testid":"wf-mobile-delete",onClick:bs,children:[e.jsx(be,{size:15})," ",s("common.delete","Delete")]})]})})]})]}),q?e.jsxs("div",{className:"wf-editor-readonly-banner",role:"status","data-testid":"wf-readonly-banner",children:[e.jsx("span",{className:"wf-editor-readonly-note",children:s("workflows.readOnlyBuiltin","Read-only built-in workflow")}),e.jsxs("button",{className:"wf-editor-action","data-testid":"wf-export",onClick:nt,title:s("workflows.exportTooltip","Download as JSON — contains your full prompt and command text"),children:[e.jsx(ct,{size:13})," ",s("workflows.export","Export")]}),e.jsxs("button",{className:"wf-editor-save wf-editor-duplicate-primary",onClick:ks,children:[e.jsx(je,{size:13})," ",s("workflows.duplicateToCustomize","Duplicate to customize")]})]}):e.jsxs("div",{className:"wf-editor-toolbar",children:[e.jsx("div",{className:"wf-editor-palette",children:na.map(({kind:t,label:n,icon:r,presetConfig:x})=>e.jsxs("button",{className:"wf-palette-btn",onClick:()=>lt(t,n,x),children:[e.jsx(r,{size:13})," ",n]},n))}),e.jsxs("div",{className:"wf-editor-actions",children:[e.jsxs("div",{className:"wf-ai-edit-wrap",children:[e.jsxs("button",{className:"wf-editor-action","data-testid":"wf-ai-edit","aria-expanded":bt,onClick:()=>{kt(t=>!t),Le(null)},children:[e.jsx($e,{size:13})," ",s("workflows.aiEdit","Design with AI")]}),bt&&e.jsxs("div",{className:"wf-ai-panel","data-testid":"wf-ai-panel",role:"dialog","aria-busy":ge,"aria-label":s("workflows.aiEdit","Design with AI"),children:[e.jsx("textarea",{className:"wf-ai-prompt","data-testid":"wf-ai-edit-prompt",rows:3,value:at,disabled:ge,placeholder:s("workflows.aiPromptPlaceholder","e.g. Run lint and tests before merge, then post a changelog comment after merge"),onChange:t=>{vt(t.target.value),Te&&Le(null)}}),Te&&e.jsx("p",{className:"wf-create-error",role:"alert","data-testid":"wf-ai-edit-error",children:Te}),e.jsxs("div",{className:"wf-ai-actions",children:[e.jsxs("button",{type:"button",className:"btn btn-primary wf-ai-submit","data-testid":"wf-ai-edit-submit",disabled:ge,onClick:()=>void hs(),children:[ge?e.jsx(Ee,{size:13,className:"wf-spin"}):e.jsx($e,{size:13})," ",s("workflows.aiSubmit","Design with AI")]}),ge&&e.jsx("button",{type:"button",className:"btn wf-ai-cancel","data-testid":"wf-ai-edit-cancel",onClick:gs,children:s("common.cancel","Cancel")})]})]})]}),e.jsxs("button",{className:"wf-editor-action",onClick:ws,"data-testid":"wf-auto-layout",children:[e.jsx(Ot,{size:13})," ",s("workflowNodes.autoLayout","Auto-layout")]}),e.jsxs("button",{className:"wf-editor-action","data-testid":"wf-export",onClick:nt,disabled:Ke,title:Ke?s("workflows.exportDirtyTooltip","Save before exporting"):s("workflows.exportTooltip","Download as JSON — contains your full prompt and command text"),children:[e.jsx(ct,{size:13})," ",s("workflows.export","Export")]}),e.jsxs("button",{className:"wf-editor-delete",onClick:bs,children:[e.jsx(be,{size:13})," ",s("common.delete","Delete")]}),e.jsxs("button",{className:"wf-editor-save",onClick:vs,disabled:h,children:[h?e.jsx(Ee,{size:13,className:"wf-spin"}):e.jsx(qt,{size:13})," ",s("common.save","Save")]})]})]}),cs&&e.jsxs("section",{className:"wf-templates","data-testid":"wf-palette-templates","aria-label":s("workflowNodes.templatesSection","Templates"),children:[e.jsxs("div",{className:"wf-templates-header",children:[e.jsxs("button",{type:"button",className:"wf-templates-toggle","aria-expanded":!ze,"data-testid":"wf-templates-toggle",onClick:()=>ka(t=>!t),children:[ze?e.jsx(Re,{size:13}):e.jsx(Fe,{size:13}),e.jsx(dn,{size:13})," ",s("workflowNodes.templatesSection","Templates")]}),!ze&&Ct>8&&e.jsx("input",{type:"text",className:"wf-templates-filter","data-testid":"wf-template-filter",value:Ze,onChange:t=>Yt(t.target.value),placeholder:s("workflowNodes.templateFilterPlaceholder","Filter templates"),"aria-label":s("workflowNodes.templateFilterLabel","Filter templates")})]}),!ze&&e.jsxs("div",{className:"wf-templates-body",children:[et&&e.jsx("div",{className:"wf-templates-conflict",role:"alert","data-testid":"wf-tpl-conflict",children:s("workflowNodes.templateSeamConflict",`This fragment duplicates the "{{seam}}" seam already on the canvas, so it can't be inserted.`,{seam:et})}),me.fragmentEntries.length>0&&e.jsxs("div",{className:"wf-templates-group",children:[e.jsx("h4",{className:"wf-templates-group-title",children:s("workflowNodes.templatesFragments","Fragments")}),e.jsx("div",{className:"wf-templates-entries",children:me.fragmentEntries.map(t=>e.jsx("button",{type:"button",className:"wf-templates-entry","data-testid":`wf-tpl-fragment-${t.id}`,disabled:q,"aria-label":s("workflowNodes.insertTemplate","Insert template {{name}}",{name:t.name}),onClick:()=>ps(t),children:t.name},t.id))})]}),me.stepEntries.length>0&&e.jsxs("div",{className:"wf-templates-group",children:[e.jsx("h4",{className:"wf-templates-group-title",children:s("workflowNodes.templatesBuiltinSteps","Built-in steps")}),e.jsx("div",{className:"wf-templates-entries",children:me.stepEntries.map(t=>e.jsx("button",{type:"button",className:"wf-templates-entry","data-testid":`wf-tpl-step-${t.id}`,disabled:q,"aria-label":s("workflowNodes.insertTemplate","Insert template {{name}}",{name:t.name}),onClick:()=>it(t),children:t.name},t.id))})]}),me.pluginEntries.length>0&&e.jsxs("div",{className:"wf-templates-group",children:[e.jsx("h4",{className:"wf-templates-group-title",children:s("workflowNodes.templatesPluginSteps","Plugin steps")}),e.jsx("div",{className:"wf-templates-entries",children:me.pluginEntries.map(({pluginId:t,template:n})=>e.jsxs("button",{type:"button",className:"wf-templates-entry","data-testid":`wf-tpl-plugin-${n.id}`,disabled:q,"aria-label":s("workflowNodes.insertTemplate","Insert template {{name}}",{name:n.name}),onClick:()=>it(n),children:[n.name,e.jsx("span",{className:"wf-templates-badge",children:t})]},`${t}:${n.id}`))})]})]})]}),k&&e.jsx("div",{className:"wf-editor-banner",role:"alert",children:k}),U&&e.jsx("div",{className:"wf-editor-banner wf-editor-banner--info",role:"status","data-testid":"wf-interpreter-only-banner",children:s("workflowNodes.interpreterOnly","This workflow branches, so it runs on the graph interpreter — it can't compile to the linear step engine, but it will still run.")}),Ie.length>0&&e.jsx("div",{className:"wf-editor-banner wf-editor-banner--warn",role:"alert","data-testid":"wf-unplaced-summary",children:s("workflowColumns.unplacedCount","{{count}} nodes not placed in a column",{count:Ie.length})}),e.jsxs("div",{className:"wf-editor-canvas",ref:gt,tabIndex:-1,children:[b&&ne&&m&&m.data.kind!=="start"&&m.data.kind!=="end"&&e.jsxs("button",{type:"button",className:"wf-inspector-toggle wf-inspector-toggle--collapsed","data-testid":"wf-inspector-toggle","aria-expanded":"false",onClick:()=>re(!1),children:[e.jsx(Re,{size:13}),e.jsx("span",{children:s("workflowNodes.showInspector","Show node details")})]}),Ca&&e.jsx("div",{className:"wf-trivial-hint",role:"status","data-testid":"wf-trivial-hint",children:s("workflowNodes.trivialGraphHint","This workflow only runs start → end. Add steps from the palette above to build it out.")}),e.jsx(Zo.Provider,{value:Dt,children:e.jsxs(Ya,{nodes:Mt,edges:_,nodeTypes:tn,onNodesChange:de,onEdgesChange:ce,onConnect:Fa,onNodeDragStop:Ia,deleteKeyCode:q?null:["Backspace","Delete"],onBeforeDelete:Ma,onNodesDelete:Aa,onEdgesDelete:Ra,onNodeClick:(t,n)=>{S(n.id),W(null),re(!1)},onEdgeClick:(t,n)=>{W(n.id),S(null)},onPaneClick:()=>{S(null),W(null)},defaultEdgeOptions:{interactionWidth:en},defaultViewport:{x:0,y:0,zoom:1},children:[e.jsx(Ja,{}),e.jsx(Xa,{}),e.jsx(Qa,{pannable:!0,zoomable:!0})]})})]})]}):e.jsxs("div",{className:"wf-editor-empty wf-editor-canvas-empty wf-editor-onboard",children:[e.jsx(sn,{className:"wf-editor-onboard-icon",size:40,"aria-hidden":!0}),e.jsx("h3",{className:"wf-editor-onboard-title",children:s("workflows.emptyTitle","No workflow selected")}),e.jsx("p",{className:"wf-editor-onboard-text",children:s("workflows.emptyDescription","Workflows orchestrate the steps and gates that run around task execution. Create one to start arranging that flow.")}),e.jsxs("button",{className:"wf-editor-save wf-editor-onboard-cta","data-testid":"wf-empty-create",onClick:()=>oe(!0),children:[e.jsx(je,{size:14})," ",s("workflows.newWorkflow","New workflow")]})]})]}),js&&!(b&&ne)&&!(le&&!b)&&e.jsxs("aside",{className:"wf-editor-inspector","data-testid":"wf-node-inspector",children:[e.jsxs("div",{className:"wf-inspector-heading",children:[e.jsx("h3",{children:"Node"}),b&&e.jsxs("button",{type:"button",className:"wf-inspector-toggle wf-inspector-toggle--expanded","data-testid":"wf-inspector-toggle","aria-expanded":"true",onClick:()=>{H?S(null):re(!0)},children:[e.jsx(Fe,{size:13}),e.jsx("span",{children:s("workflowNodes.collapseInspector","Collapse")})]})]}),q&&e.jsx("p",{className:"wf-inspector-note wf-inspector-note--info",children:"Read-only built-in — duplicate the workflow to edit nodes."}),e.jsx("fieldset",{className:"wf-inspector-fields",disabled:q,children:e.jsxs("label",{className:"wf-field",children:[e.jsx("span",{children:"Name"}),e.jsx("input",{value:m.data.label,onChange:t=>L({label:t.target.value})})]})}),m.data.kind==="prompt"||m.data.kind==="gate"?e.jsxs("div",{className:"wf-prompt-editor",children:[e.jsxs("label",{className:"wf-field",children:[e.jsx("span",{children:"Prompt"}),e.jsx("textarea",{rows:5,value:Cs,readOnly:q,onChange:t=>L({config:{prompt:t.target.value}})})]}),e.jsx("button",{type:"button",className:"btn btn-sm wf-prompt-expand-btn wf-prompt-expand-btn--inline",onClick:ys,"aria-label":s("workflowEditor.expandPrompt","Expand prompt editor"),title:s("workflowEditor.expandPrompt","Expand prompt editor"),children:e.jsx(an,{size:14})})]}):null,e.jsxs("fieldset",{className:"wf-inspector-fields",disabled:q,children:[m.data.kind==="prompt"?e.jsxs(e.Fragment,{children:[e.jsxs("label",{className:"wf-field",children:[e.jsx("span",{children:"Executor"}),e.jsxs("select",{value:pe,onChange:t=>L({config:{executor:t.target.value}}),children:[e.jsx("option",{value:"model",children:"Model"}),e.jsx("option",{value:"agent",children:"Agent"}),e.jsx("option",{value:"skill",children:"Skill"}),e.jsx("option",{value:"cli",children:"CLI / script"}),e.jsx("option",{value:"cli-agent",children:s("workflowEditor.cliAgent.executorOption")})]})]}),Ae&&e.jsx("p",{className:"wf-inspector-note wf-inspector-note--warn","data-testid":"wf-node-overridden-by-column-agent",children:s("workflowColumns.overriddenByColumnAgent","Overridden by column agent {{name}} — this node's executor settings are superseded.",{name:Wa?.name??s("workflowColumns.agentNotFound","Agent not found — {{id}}",{id:Ae.agentId})})}),pe==="model"&&e.jsxs("label",{className:"wf-field",children:[e.jsx("span",{children:"Model"}),e.jsx(Gt,{label:"Model",models:Me,value:ea(String(m.data.config?.modelProvider??""),String(m.data.config?.modelId??"")),onChange:t=>{const{provider:n,modelId:r}=ta(t);L({config:{modelProvider:n||void 0,modelId:r||void 0}})}})]}),pe==="agent"&&(()=>{const t=String(m.data.config?.agentId??""),n=t!==""&&!xe.some(r=>r.id===t);return e.jsxs("label",{className:"wf-field",children:[e.jsx("span",{children:"Agent"}),e.jsxs("select",{value:t,onChange:r=>L({config:{agentId:r.target.value||void 0}}),children:[e.jsx("option",{value:"",children:"— select agent —"}),n&&e.jsx("option",{value:t,children:s("workflowColumns.agentNotFound","Agent not found — {{id}}",{id:t})}),xe.map(r=>e.jsx("option",{value:r.id,children:r.name},r.id))]}),n&&e.jsx("p",{className:"wf-inspector-note wf-inspector-note--warn","data-testid":"wf-node-agent-stale",children:s("workflowColumns.agentNotFound","Agent not found — {{id}}",{id:t})})]})})(),pe==="skill"&&e.jsxs("label",{className:"wf-field",children:[e.jsx("span",{children:"Skill"}),e.jsxs("select",{value:String(m.data.config?.skillName??""),onChange:t=>L({config:{skillName:t.target.value||void 0}}),children:[e.jsx("option",{value:"",children:"— select skill —"}),Je.map(t=>e.jsx("option",{value:t.name,children:t.name},t.id))]})]}),pe==="cli"&&e.jsxs(e.Fragment,{children:[e.jsxs("label",{className:"wf-field",children:[e.jsx("span",{children:"CLI mode"}),e.jsxs("select",{value:String(m.data.config?.cliMode??"command"),onChange:t=>L({config:{cliMode:t.target.value}}),children:[e.jsx("option",{value:"command",children:"Command"}),e.jsx("option",{value:"script",children:"Named script"})]})]}),(m.data.config?.cliMode??"command")==="command"?e.jsxs("label",{className:"wf-field",children:[e.jsx("span",{children:"Command"}),e.jsx("textarea",{rows:3,placeholder:"npm test -- --runInBand",value:String(m.data.config?.cliCommand??""),onChange:t=>L({config:{cliCommand:t.target.value}})}),e.jsx("p",{className:"wf-inspector-note wf-inspector-note--info",children:"Runs an arbitrary command in the task worktree. The first time this exact command runs, the task pauses for your approval. The node prompt is passed via FUSION_NODE_PROMPT."}),e.jsxs("label",{className:"wf-field wf-field--checkbox",children:[e.jsx("input",{type:"checkbox",checked:m.data.config?.cliSkipApproval===!0,onChange:t=>L({config:{cliSkipApproval:t.target.checked}})}),e.jsx("span",{children:"Skip first-run approval (runs without pausing)"})]})]}):e.jsxs("label",{className:"wf-field",children:[e.jsx("span",{children:"Script name"}),e.jsx("input",{value:String(m.data.config?.scriptName??""),onChange:t=>L({config:{scriptName:t.target.value}})}),e.jsx("span",{className:"wf-inspector-note",children:"Named script from project settings. The node prompt is passed via FUSION_NODE_PROMPT."})]})]}),pe==="cli-agent"&&e.jsxs("div",{"data-testid":"cli-agent-config",children:[e.jsxs("label",{className:"wf-field",children:[e.jsx("span",{children:s("workflowEditor.cliAgent.adapterLabel")}),e.jsxs("select",{"data-testid":"cli-agent-adapter",value:String(m.data.config?.cliAdapterId??""),onChange:t=>L({config:{cliAdapterId:t.target.value||void 0}}),children:[e.jsx("option",{value:"",children:s("workflowEditor.cliAgent.adapterPlaceholder")}),La.map(t=>e.jsxs("option",{value:t.id,children:[t.name," (",s(`workflowEditor.cliAgent.tier.${t.tier}`),")"]},t.id))]}),e.jsx("span",{className:"wf-inspector-note",children:s("workflowEditor.cliAgent.adapterNote")})]}),e.jsxs("label",{className:"wf-field wf-field--checkbox",children:[e.jsx("input",{type:"checkbox","data-testid":"cli-agent-autonomy",checked:!!m.data.config?.cliAutonomy?.autoApprove,onChange:t=>L({config:{cliAutonomy:{...m.data.config?.cliAutonomy??{},autoApprove:t.target.checked}}})}),e.jsx("span",{children:s("workflowEditor.cliAgent.autonomyLabel")})]}),!!m.data.config?.cliAutonomy?.autoApprove&&e.jsx("p",{className:"wf-inspector-note wf-inspector-note--info",children:s("workflowEditor.cliAgent.autonomyNote")}),e.jsxs("label",{className:"wf-field",children:[e.jsx("span",{children:s("workflowEditor.cliAgent.notifyLabel")}),e.jsxs("select",{"data-testid":"cli-agent-notify",value:String(m.data.config?.cliNotify?.mode??"banner"),onChange:t=>L({config:{cliNotify:{mode:t.target.value}}}),children:[e.jsx("option",{value:"banner",children:s("workflowEditor.cliAgent.notify.banner")}),e.jsx("option",{value:"banner+notify",children:s("workflowEditor.cliAgent.notify.bannerNotify")})]}),e.jsx("span",{className:"wf-inspector-note",children:s("workflowEditor.cliAgent.notifyNote")})]})]}),e.jsxs("label",{className:"wf-field wf-field--checkbox",children:[e.jsx("input",{type:"checkbox",checked:!!m.data.config?.autoApprove,onChange:t=>L({config:{autoApprove:t.target.checked}})}),e.jsx("span",{children:"Auto-approve requests"})]}),!!m.data.config?.autoApprove&&e.jsx("p",{className:"wf-inspector-note",children:"Runs without pausing for approval — e.g. a CLI command executes on its first run without waiting for your sign-off."}),e.jsxs("label",{className:"wf-field",children:[e.jsx("span",{children:"Max retries"}),e.jsx("input",{type:"number",min:1,max:10,placeholder:"default",value:m.data.config?.maxRetries!=null?String(m.data.config.maxRetries):"",onChange:t=>{const n=t.target.value.trim();if(n==="")L({config:r=>{const x={...r};return delete x.maxRetries,x}});else{const r=parseInt(n,10);isNaN(r)||L({config:{maxRetries:r}})}}})]}),e.jsxs("label",{className:"wf-field wf-field--checkbox",children:[e.jsx("input",{type:"checkbox",checked:!!m.data.config?.awaitInput,onChange:t=>L({config:{awaitInput:t.target.checked}})}),e.jsx("span",{children:"Wait for user input"})]}),!!m.data.config?.awaitInput&&e.jsx("p",{className:"wf-inspector-note wf-inspector-note--info",children:"This node pauses the task until you reply in the task's comments and unpause. The Prompt field above is shown to the user as the question."})]}):null,m.data.kind==="script"?e.jsxs("label",{className:"wf-field",children:[e.jsx("span",{children:"Script name"}),e.jsx("input",{value:String(m.data.config?.scriptName??""),onChange:t=>L({config:{scriptName:t.target.value}})})]}):null,m.data.kind==="hold"?e.jsxs("label",{className:"wf-field",children:[e.jsx("span",{children:s("workflowNodes.releaseCondition","Release condition")}),e.jsxs("select",{value:String(m.data.config?.release??"manual"),onChange:t=>L({config:{release:t.target.value}}),children:[e.jsx("option",{value:"manual",children:s("workflowNodes.releaseManual","Manual promote")}),e.jsx("option",{value:"timer",children:s("workflowNodes.releaseTimer","Timer")}),e.jsx("option",{value:"capacity",children:s("workflowNodes.releaseCapacity","Downstream capacity")}),e.jsx("option",{value:"dependency",children:s("workflowNodes.releaseDependency","Dependency complete")}),e.jsx("option",{value:"external-event",children:s("workflowNodes.releaseExternal","External event")})]})]}):null,m.data.kind==="join"?e.jsxs(e.Fragment,{children:[e.jsxs("label",{className:"wf-field",children:[e.jsx("span",{children:s("workflowNodes.joinMode","Join mode")}),e.jsxs("select",{value:(()=>{const t=m.data.config?.mode;return t&&typeof t=="object"&&"quorum"in t?"quorum":typeof t=="string"?t:"all"})(),onChange:t=>{const n=t.target.value;L(n==="quorum"?{config:{mode:{quorum:2}}}:{config:{mode:n}})},children:[e.jsx("option",{value:"all",children:s("workflowNodes.joinAll","All branches")}),e.jsx("option",{value:"any",children:s("workflowNodes.joinAny","Any branch")}),e.jsx("option",{value:"quorum",children:s("workflowNodes.joinQuorum","Quorum (n)")})]})]}),(()=>{const t=m.data.config?.mode;return t&&typeof t=="object"&&"quorum"in t})()&&e.jsxs("label",{className:"wf-field",children:[e.jsx("span",{children:s("workflowNodes.quorumN","Quorum count (n)")}),e.jsx("input",{type:"number",min:1,value:String(m.data.config?.mode?.quorum??2),onChange:t=>{const n=parseInt(t.target.value,10);isNaN(n)||L({config:{mode:{quorum:n}}})}})]}),e.jsxs("label",{className:"wf-field",children:[e.jsx("span",{children:s("workflowNodes.failurePolicy","On branch failure")}),e.jsxs("select",{value:String(m.data.config?.onBranchFailure??"collect"),onChange:t=>L({config:{onBranchFailure:t.target.value}}),children:[e.jsx("option",{value:"collect",children:s("workflowNodes.failureCollect","Collect (wait for all)")}),e.jsx("option",{value:"fail-fast",children:s("workflowNodes.failureFailFast","Fail-fast (cancel siblings)")})]})]})]}):null,m.data.kind==="split"?e.jsx("p",{className:"wf-inspector-note wf-inspector-note--info",children:s("workflowNodes.splitNote","Branches run concurrently from this node. Execute and merge seams are not allowed inside a branch.")}):null,m.data.kind==="foreach"?(()=>{const t=String(m.data.config?.mode??"sequential"),n=t==="parallel";return e.jsxs(e.Fragment,{children:[e.jsxs("label",{className:"wf-field",children:[e.jsx("span",{children:s("workflowNodes.foreachMode","Mode")}),e.jsxs("select",{value:t,onChange:r=>{const x=r.target.value;L({config:y=>({...y,mode:x,...x==="parallel"&&y.isolation==="shared"?{isolation:"worktree"}:{}})})},children:[e.jsx("option",{value:"sequential",children:s("workflowNodes.foreachSequential","Sequential")}),e.jsx("option",{value:"parallel",children:s("workflowNodes.foreachParallel","Parallel")})]})]}),e.jsxs("label",{className:"wf-field",children:[e.jsx("span",{children:s("workflowNodes.foreachIsolation","Isolation")}),e.jsxs("select",{value:String(m.data.config?.isolation??(n?"worktree":"shared")),onChange:r=>L({config:{isolation:r.target.value}}),children:[e.jsx("option",{value:"shared",disabled:n,children:s("workflowNodes.foreachShared","Shared worktree")}),e.jsx("option",{value:"worktree",children:s("workflowNodes.foreachWorktree","Per-step worktree")})]})]}),n&&e.jsxs("label",{className:"wf-field",children:[e.jsx("span",{children:s("workflowNodes.foreachConcurrency","Concurrency")}),e.jsx("input",{type:"number",min:1,max:8,placeholder:"2",value:m.data.config?.concurrency!=null?String(m.data.config.concurrency):"",onChange:r=>{const x=r.target.value.trim();if(x==="")L({config:y=>{const O={...y};return delete O.concurrency,O}});else{const y=parseInt(x,10);isNaN(y)||L({config:{concurrency:y}})}}})]}),e.jsxs("label",{className:"wf-field",children:[e.jsx("span",{children:s("workflowNodes.foreachMaxRework","Max rework cycles")}),e.jsx("input",{type:"number",min:1,max:10,placeholder:"3",value:m.data.config?.maxReworkCycles!=null?String(m.data.config.maxReworkCycles):"",onChange:r=>{const x=r.target.value.trim();if(x==="")L({config:y=>{const O={...y};return delete O.maxReworkCycles,O}});else{const y=parseInt(x,10);isNaN(y)||L({config:{maxReworkCycles:y}})}}})]}),e.jsx("p",{className:"wf-inspector-note wf-inspector-note--info",children:s("workflowNodes.foreachNote","Expands once per planned step. Drop a step-execute node (and optional step-review) into the region.")})]})})():null,m.data.kind==="loop"?(()=>{const t=m.data.config?.exitWhen&&typeof m.data.config.exitWhen=="object"?m.data.config.exitWhen:{type:"output-contains",value:"DONE"},n=String(t.type??"output-contains"),r=String(n==="output-matches"?t.pattern??"":t.value??"");return e.jsxs(e.Fragment,{children:[e.jsxs("label",{className:"wf-field",children:[e.jsx("span",{children:s("workflowNodes.loopExitType","Exit condition")}),e.jsxs("select",{value:n,onChange:x=>{const y=x.target.value;L({config:O=>{const I=O.exitWhen&&typeof O.exitWhen=="object"?O.exitWhen:{},G=String(y==="output-matches"?I.pattern??I.value??"":I.value??I.pattern??""),we={...I,type:y};return delete we.pattern,delete we.value,{...O,exitWhen:y==="output-matches"?{...we,pattern:G}:{...we,value:G}}}})},children:[e.jsx("option",{value:"output-contains",children:s("workflowNodes.loopOutputContains","Output contains")}),e.jsx("option",{value:"output-matches",children:s("workflowNodes.loopOutputMatches","Output matches regex")})]})]}),e.jsxs("label",{className:"wf-field",children:[e.jsx("span",{children:n==="output-matches"?s("workflowNodes.loopPattern","Pattern"):s("workflowNodes.loopValue","Value")}),e.jsx("input",{value:r,placeholder:n==="output-matches"?"DONE|COMPLETE":"DONE",onChange:x=>{const y=x.target.value;L({config:O=>{const I=O.exitWhen&&typeof O.exitWhen=="object"?O.exitWhen:{};return{...O,exitWhen:n==="output-matches"?{...I,type:n,pattern:y}:{...I,type:n,value:y}}}})}})]}),e.jsxs("label",{className:"wf-field",children:[e.jsx("span",{children:s("workflowNodes.loopNodeId","Watch node id (optional)")}),e.jsx("input",{value:String(t.nodeId??""),placeholder:s("workflowNodes.loopNodeIdPlaceholder","Template exit node"),onChange:x=>{const y=x.target.value.trim();L({config:O=>{const G={...O.exitWhen&&typeof O.exitWhen=="object"?O.exitWhen:{type:"output-contains",value:"DONE"}};return y?G.nodeId=y:delete G.nodeId,{...O,exitWhen:G}}})}})]}),e.jsxs("label",{className:"wf-field",children:[e.jsx("span",{children:s("workflowNodes.loopMaxIterations","Max iterations")}),e.jsx("input",{type:"number",min:1,max:50,placeholder:"3",value:m.data.config?.maxIterations!=null?String(m.data.config.maxIterations):"",onChange:x=>{const y=x.target.value.trim();L({config:O=>{const I={...O};if(y==="")delete I.maxIterations;else{const G=parseInt(y,10);isNaN(G)||(I.maxIterations=G)}return I}})}})]}),e.jsxs("label",{className:"wf-field",children:[e.jsx("span",{children:s("workflowNodes.loopTimeoutMs","Timeout (ms)")}),e.jsx("input",{type:"number",min:1,max:36e5,placeholder:"300000",value:m.data.config?.timeoutMs!=null?String(m.data.config.timeoutMs):"",onChange:x=>{const y=x.target.value.trim();L({config:O=>{const I={...O};if(y==="")delete I.timeoutMs;else{const G=parseInt(y,10);isNaN(G)||(I.timeoutMs=G)}return I}})}})]}),e.jsx("p",{className:"wf-inspector-note wf-inspector-note--info",children:s("workflowNodes.loopNote","Repeats the template until the selected output matches, an iteration limit is reached, or the timeout expires.")})]})})():null,m.data.kind==="step-review"?e.jsxs(e.Fragment,{children:[e.jsxs("label",{className:"wf-field",children:[e.jsx("span",{children:s("workflowNodes.reviewType","Review type")}),e.jsxs("select",{value:String(m.data.config?.type??"code"),onChange:t=>L({config:{type:t.target.value}}),children:[e.jsx("option",{value:"plan",children:s("workflowNodes.reviewPlan","Plan review")}),e.jsx("option",{value:"code",children:s("workflowNodes.reviewCode","Code review")})]})]}),e.jsxs("label",{className:"wf-field",children:[e.jsx("span",{children:s("workflowNodes.reviewModel","Review model (optional)")}),e.jsx(Gt,{label:s("workflowNodes.reviewModel","Review model (optional)"),models:Me,value:ea(String(m.data.config?.modelProvider??""),String(m.data.config?.modelId??"")),onChange:t=>{const{provider:n,modelId:r}=ta(t);L({config:{modelProvider:n||void 0,modelId:r||void 0,model:t||void 0}})}})]}),e.jsx("p",{className:"wf-inspector-note wf-inspector-note--info",children:s("workflowNodes.reviewNote","Verdicts route as outcome edges. Click an outgoing edge to set its verdict and rework behavior.")})]}):null,m.data.kind==="parse-steps"?e.jsxs(e.Fragment,{children:[Rt.length>0?e.jsxs("label",{className:"wf-field",children:[e.jsx("span",{children:s("workflowNodes.parseArtifact","Artifact")}),e.jsx("select",{value:String(m.data.config?.artifact??Rt[0]),onChange:t=>L({config:{artifact:t.target.value}}),children:Rt.map(t=>e.jsx("option",{value:t,children:t},t))})]}):e.jsxs("label",{className:"wf-field",children:[e.jsx("span",{children:s("workflowNodes.parseArtifact","Artifact")}),e.jsx("input",{placeholder:"PROMPT.md",value:String(m.data.config?.artifact??"PROMPT.md"),onChange:t=>L({config:{artifact:t.target.value}})})]}),e.jsxs("label",{className:"wf-field",children:[e.jsx("span",{children:s("workflowNodes.parseParser","Parser")}),e.jsx("select",{value:String(m.data.config?.parser??"step-headings"),onChange:t=>L({config:{parser:t.target.value}}),children:Array.from(new Set([String(m.data.config?.parser??"step-headings"),...ha])).map(t=>e.jsx("option",{value:t,children:t},t))})]})]}):null,m.data.kind==="code"?e.jsxs(e.Fragment,{children:[e.jsxs("label",{className:"wf-field",children:[e.jsx("span",{children:s("workflowNodes.codeSource","Source (TypeScript)")}),e.jsx("textarea",{className:"wf-code-source",rows:8,spellCheck:!1,placeholder:'export default async (ctx) => ({ outcome: "success" });',value:String(m.data.config?.source??""),onChange:t=>L({config:{source:t.target.value}})})]}),e.jsxs("label",{className:"wf-field",children:[e.jsx("span",{children:s("workflowNodes.codeTimeout","Timeout (ms)")}),e.jsx("input",{type:"number",min:1,placeholder:"30000",value:m.data.config?.timeoutMs!=null?String(m.data.config.timeoutMs):"",onChange:t=>{const n=t.target.value.trim();if(n==="")L({config:r=>{const x={...r};return delete x.timeoutMs,x}});else{const r=parseInt(n,10);isNaN(r)||L({config:{timeoutMs:r}})}}})]}),e.jsx("p",{className:"wf-inspector-note wf-inspector-note--info",children:s("workflowNodes.codeNote","Runs sandboxed TypeScript. Syntax is validated at save.")})]}):null,m.data.kind==="notify"?(()=>{const t=String(m.data.config?.event??"workflow-notify"),n=!oa.includes(t);return e.jsxs(e.Fragment,{children:[e.jsxs("label",{className:"wf-field",children:[e.jsx("span",{children:s("workflowNodes.notifyEvent","Event type")}),e.jsxs("select",{value:n?Bt:t,onChange:r=>{const x=r.target.value;L({config:{event:x===Bt?"custom-event":x}})},children:[oa.map(r=>e.jsx("option",{value:r,children:r},r)),e.jsx("option",{value:Bt,children:s("workflowNodes.notifyCustom","Custom")})]})]}),n?e.jsxs("label",{className:"wf-field",children:[e.jsx("span",{children:s("workflowNodes.notifyCustomEvent","Custom event")}),e.jsx("input",{value:t,placeholder:"custom-event",onChange:r=>L({config:{event:r.target.value}})})]}):null,e.jsxs("label",{className:"wf-field",children:[e.jsx("span",{children:s("workflowNodes.notifyTitle","Title (optional)")}),e.jsx("input",{value:String(m.data.config?.title??"{{taskTitle}}"),placeholder:"{{taskTitle}}",onChange:r=>L({config:{title:r.target.value}})})]}),e.jsxs("label",{className:"wf-field",children:[e.jsx("span",{children:s("workflowNodes.notifyMessage","Message (optional)")}),e.jsx("textarea",{rows:4,value:String(m.data.config?.message??""),placeholder:"Task {{taskId}} reached {{workflowName}}",onChange:r=>L({config:{message:r.target.value}})})]}),e.jsx("p",{className:"wf-inspector-note wf-inspector-note--info",children:s("workflowNodes.notifyNote","Templates may use {{taskTitle}}, {{taskId}}, {{workflowName}}, and {{context:key}}.")})]})})():null,m.data.kind==="prompt"||m.data.kind==="gate"||m.data.kind==="script"?e.jsxs("label",{className:"wf-field",children:[e.jsx("span",{children:s("workflowNodes.gateMode","Gate mode")}),e.jsxs("select",{value:String(m.data.config?.gateMode??(m.data.kind==="prompt"?"advisory":"gate")),onChange:t=>L({config:{gateMode:t.target.value}}),children:[e.jsx("option",{value:"advisory",children:s("workflowNodes.advisory","Advisory")}),e.jsx("option",{value:"gate",children:s("workflowNodes.gateBlocks","Gate (blocks)")})]})]}):m.data.kind==="merge"?e.jsx("p",{className:"wf-inspector-note",children:s("workflowNodes.mergeBoundaryNote","Steps before this marker run pre-merge; steps after run post-merge.")}):null]}),!q&&e.jsxs("button",{type:"button",className:"wf-editor-delete wf-inspector-delete","data-testid":"wf-delete-node",onClick:()=>{xs([m.id]),S(null)},children:[e.jsx(be,{size:13})," ",s("workflowNodes.deleteNode","Delete node")]})]}),ve&&e.jsxs("aside",{className:"wf-editor-inspector","data-testid":"wf-edge-inspector",children:[e.jsx("h3",{children:s("workflowNodes.edgeInspector","Edge")}),e.jsx("fieldset",{className:"wf-inspector-fields",disabled:q,children:Ss==="verdicts"?e.jsxs(e.Fragment,{children:[e.jsxs("label",{className:"wf-field",children:[e.jsx("span",{children:s("workflowNodes.edgeVerdict","Review verdict")}),e.jsxs("select",{"data-testid":"wf-edge-verdict",value:(()=>{const t=String(ve.data?.condition??"success");return t.startsWith("outcome:")?t.slice(8):""})(),onChange:t=>{const n=t.target.value;It({condition:n?`outcome:${n}`:"success"})},children:[e.jsx("option",{value:"",children:s("workflowNodes.edgeNoVerdict","— success (no verdict) —")}),Hn.map(t=>e.jsx("option",{value:t,children:t},t))]})]}),e.jsxs("label",{className:"wf-field wf-field--checkbox",children:[e.jsx("input",{type:"checkbox","data-testid":"wf-edge-rework",checked:ve.data?.kind==="rework",onChange:t=>It({rework:t.target.checked})}),e.jsx("span",{children:s("workflowNodes.edgeRework","Rework edge (loop back, bounded)")})]}),e.jsx("p",{className:"wf-inspector-note wf-inspector-note--info",children:s("workflowNodes.edgeReworkNote","Rework edges are the only legal cycles — they loop back within the for-each step instance, bounded by Max rework cycles.")})]}):Ss==="conditions"?e.jsxs("label",{className:"wf-field",children:[e.jsx("span",{children:s("workflowNodes.edgeCondition","Condition")}),e.jsxs("select",{"data-testid":"wf-edge-condition",value:String(ve.data?.condition??"success"),onChange:t=>It({condition:t.target.value}),children:[e.jsx("option",{value:"success",children:"success"}),e.jsx("option",{value:"failure",children:"failure"})]})]}):e.jsx("p",{className:"wf-inspector-note",children:s("workflowNodes.edgeConditionLabel","Condition: {{condition}}",{condition:String(ve.data?.condition??"success")})})}),!q&&e.jsxs("button",{type:"button",className:"wf-editor-delete wf-inspector-delete","data-testid":"wf-delete-edge",onClick:()=>{xs([ve.id]),W(null)},children:[e.jsx(be,{size:13})," ",s("workflowNodes.deleteEdge","Delete edge")]})]})]}),Ne&&e.jsx(Yn,{workflows:u,onCreate:Pa,onDesign:Da,onClose:Ye})]})}),Va]})}function ol({isOpen:a,onClose:d,addToast:i,projectId:g,initialPanel:l,initialAction:w,initialWorkflowId:D}){const u=o.useRef(null);return fo(u,a,"fusion:workflow-node-editor-size"),a?e.jsx(Ga,{children:e.jsx(Jn,{onClose:d,addToast:i,projectId:g,initialPanel:l,initialAction:w,initialWorkflowId:D,modalRef:u})}):null}export{ol as WorkflowNodeEditor};
@@ -1 +1 @@
1
- import{g}from"./vendor-react-K0fH_qHe.js";function _(i,s){for(var o=0;o<s.length;o++){const t=s[o];if(typeof t!="string"&&!Array.isArray(t)){for(const e in t)if(e!=="default"&&!(e in i)){const r=Object.getOwnPropertyDescriptor(t,e);r&&Object.defineProperty(i,e,r.get?r:{enumerable:!0,get:()=>t[e]})}}}return Object.freeze(Object.defineProperty(i,Symbol.toStringTag,{value:"Module"}))}var a={exports:{}},d;function y(){return d||(d=1,(function(i,s){(function(o,t){i.exports=t()})(self,(()=>(()=>{var o={};return(()=>{var t=o;Object.defineProperty(t,"__esModule",{value:!0}),t.FitAddon=void 0,t.FitAddon=class{activate(e){this._terminal=e}dispose(){}fit(){const e=this.proposeDimensions();if(!e||!this._terminal||isNaN(e.cols)||isNaN(e.rows))return;const r=this._terminal._core;this._terminal.rows===e.rows&&this._terminal.cols===e.cols||(r._renderService.clear(),this._terminal.resize(e.cols,e.rows))}proposeDimensions(){if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;const e=this._terminal._core,r=e._renderService.dimensions;if(r.css.cell.width===0||r.css.cell.height===0)return;const c=this._terminal.options.scrollback===0?0:e.viewport.scrollBarWidth,l=window.getComputedStyle(this._terminal.element.parentElement),m=parseInt(l.getPropertyValue("height")),u=Math.max(0,parseInt(l.getPropertyValue("width"))),n=window.getComputedStyle(this._terminal.element),h=m-(parseInt(n.getPropertyValue("padding-top"))+parseInt(n.getPropertyValue("padding-bottom"))),f=u-(parseInt(n.getPropertyValue("padding-right"))+parseInt(n.getPropertyValue("padding-left")))-c;return{cols:Math.max(2,Math.floor(f/r.css.cell.width)),rows:Math.max(1,Math.floor(h/r.css.cell.height))}}}})(),o})()))})(a)),a.exports}var p=y();const w=g(p),x=_({__proto__:null,default:w},[p]);export{x as a};
1
+ import{g}from"./vendor-react-D37HfzIf.js";function _(i,s){for(var o=0;o<s.length;o++){const t=s[o];if(typeof t!="string"&&!Array.isArray(t)){for(const e in t)if(e!=="default"&&!(e in i)){const r=Object.getOwnPropertyDescriptor(t,e);r&&Object.defineProperty(i,e,r.get?r:{enumerable:!0,get:()=>t[e]})}}}return Object.freeze(Object.defineProperty(i,Symbol.toStringTag,{value:"Module"}))}var a={exports:{}},d;function y(){return d||(d=1,(function(i,s){(function(o,t){i.exports=t()})(self,(()=>(()=>{var o={};return(()=>{var t=o;Object.defineProperty(t,"__esModule",{value:!0}),t.FitAddon=void 0,t.FitAddon=class{activate(e){this._terminal=e}dispose(){}fit(){const e=this.proposeDimensions();if(!e||!this._terminal||isNaN(e.cols)||isNaN(e.rows))return;const r=this._terminal._core;this._terminal.rows===e.rows&&this._terminal.cols===e.cols||(r._renderService.clear(),this._terminal.resize(e.cols,e.rows))}proposeDimensions(){if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;const e=this._terminal._core,r=e._renderService.dimensions;if(r.css.cell.width===0||r.css.cell.height===0)return;const c=this._terminal.options.scrollback===0?0:e.viewport.scrollBarWidth,l=window.getComputedStyle(this._terminal.element.parentElement),m=parseInt(l.getPropertyValue("height")),u=Math.max(0,parseInt(l.getPropertyValue("width"))),n=window.getComputedStyle(this._terminal.element),h=m-(parseInt(n.getPropertyValue("padding-top"))+parseInt(n.getPropertyValue("padding-bottom"))),f=u-(parseInt(n.getPropertyValue("padding-right"))+parseInt(n.getPropertyValue("padding-left")))-c;return{cols:Math.max(2,Math.floor(f/r.css.cell.width)),rows:Math.max(1,Math.floor(h/r.css.cell.height))}}}})(),o})()))})(a)),a.exports}var p=y();const w=g(p),x=_({__proto__:null,default:w},[p]);export{x as a};
@@ -0,0 +1 @@
1
+ import{g as j}from"./vendor-react-D37HfzIf.js";function A(U,y){for(var g=0;g<y.length;g++){const p=y[g];if(typeof p!="string"&&!Array.isArray(p)){for(const _ in p)if(_!=="default"&&!(_ in U)){const w=Object.getOwnPropertyDescriptor(p,_);w&&Object.defineProperty(U,_,w.get?w:{enumerable:!0,get:()=>p[_]})}}}return Object.freeze(Object.defineProperty(U,Symbol.toStringTag,{value:"Module"}))}var P={exports:{}},O=P.exports,b;function E(){return b||(b=1,(function(U,y){(function(g,p){U.exports=p()})(O,(()=>(()=>{var g={433:(u,i,c)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.UnicodeV11=void 0;const l=c(938),a=[[768,879],[1155,1161],[1425,1469],[1471,1471],[1473,1474],[1476,1477],[1479,1479],[1536,1541],[1552,1562],[1564,1564],[1611,1631],[1648,1648],[1750,1757],[1759,1764],[1767,1768],[1770,1773],[1807,1807],[1809,1809],[1840,1866],[1958,1968],[2027,2035],[2045,2045],[2070,2073],[2075,2083],[2085,2087],[2089,2093],[2137,2139],[2259,2306],[2362,2362],[2364,2364],[2369,2376],[2381,2381],[2385,2391],[2402,2403],[2433,2433],[2492,2492],[2497,2500],[2509,2509],[2530,2531],[2558,2558],[2561,2562],[2620,2620],[2625,2626],[2631,2632],[2635,2637],[2641,2641],[2672,2673],[2677,2677],[2689,2690],[2748,2748],[2753,2757],[2759,2760],[2765,2765],[2786,2787],[2810,2815],[2817,2817],[2876,2876],[2879,2879],[2881,2884],[2893,2893],[2902,2902],[2914,2915],[2946,2946],[3008,3008],[3021,3021],[3072,3072],[3076,3076],[3134,3136],[3142,3144],[3146,3149],[3157,3158],[3170,3171],[3201,3201],[3260,3260],[3263,3263],[3270,3270],[3276,3277],[3298,3299],[3328,3329],[3387,3388],[3393,3396],[3405,3405],[3426,3427],[3530,3530],[3538,3540],[3542,3542],[3633,3633],[3636,3642],[3655,3662],[3761,3761],[3764,3772],[3784,3789],[3864,3865],[3893,3893],[3895,3895],[3897,3897],[3953,3966],[3968,3972],[3974,3975],[3981,3991],[3993,4028],[4038,4038],[4141,4144],[4146,4151],[4153,4154],[4157,4158],[4184,4185],[4190,4192],[4209,4212],[4226,4226],[4229,4230],[4237,4237],[4253,4253],[4448,4607],[4957,4959],[5906,5908],[5938,5940],[5970,5971],[6002,6003],[6068,6069],[6071,6077],[6086,6086],[6089,6099],[6109,6109],[6155,6158],[6277,6278],[6313,6313],[6432,6434],[6439,6440],[6450,6450],[6457,6459],[6679,6680],[6683,6683],[6742,6742],[6744,6750],[6752,6752],[6754,6754],[6757,6764],[6771,6780],[6783,6783],[6832,6846],[6912,6915],[6964,6964],[6966,6970],[6972,6972],[6978,6978],[7019,7027],[7040,7041],[7074,7077],[7080,7081],[7083,7085],[7142,7142],[7144,7145],[7149,7149],[7151,7153],[7212,7219],[7222,7223],[7376,7378],[7380,7392],[7394,7400],[7405,7405],[7412,7412],[7416,7417],[7616,7673],[7675,7679],[8203,8207],[8234,8238],[8288,8292],[8294,8303],[8400,8432],[11503,11505],[11647,11647],[11744,11775],[12330,12333],[12441,12442],[42607,42610],[42612,42621],[42654,42655],[42736,42737],[43010,43010],[43014,43014],[43019,43019],[43045,43046],[43204,43205],[43232,43249],[43263,43263],[43302,43309],[43335,43345],[43392,43394],[43443,43443],[43446,43449],[43452,43453],[43493,43493],[43561,43566],[43569,43570],[43573,43574],[43587,43587],[43596,43596],[43644,43644],[43696,43696],[43698,43700],[43703,43704],[43710,43711],[43713,43713],[43756,43757],[43766,43766],[44005,44005],[44008,44008],[44013,44013],[64286,64286],[65024,65039],[65056,65071],[65279,65279],[65529,65531]],h=[[66045,66045],[66272,66272],[66422,66426],[68097,68099],[68101,68102],[68108,68111],[68152,68154],[68159,68159],[68325,68326],[68900,68903],[69446,69456],[69633,69633],[69688,69702],[69759,69761],[69811,69814],[69817,69818],[69821,69821],[69837,69837],[69888,69890],[69927,69931],[69933,69940],[70003,70003],[70016,70017],[70070,70078],[70089,70092],[70191,70193],[70196,70196],[70198,70199],[70206,70206],[70367,70367],[70371,70378],[70400,70401],[70459,70460],[70464,70464],[70502,70508],[70512,70516],[70712,70719],[70722,70724],[70726,70726],[70750,70750],[70835,70840],[70842,70842],[70847,70848],[70850,70851],[71090,71093],[71100,71101],[71103,71104],[71132,71133],[71219,71226],[71229,71229],[71231,71232],[71339,71339],[71341,71341],[71344,71349],[71351,71351],[71453,71455],[71458,71461],[71463,71467],[71727,71735],[71737,71738],[72148,72151],[72154,72155],[72160,72160],[72193,72202],[72243,72248],[72251,72254],[72263,72263],[72273,72278],[72281,72283],[72330,72342],[72344,72345],[72752,72758],[72760,72765],[72767,72767],[72850,72871],[72874,72880],[72882,72883],[72885,72886],[73009,73014],[73018,73018],[73020,73021],[73023,73029],[73031,73031],[73104,73105],[73109,73109],[73111,73111],[73459,73460],[78896,78904],[92912,92916],[92976,92982],[94031,94031],[94095,94098],[113821,113822],[113824,113827],[119143,119145],[119155,119170],[119173,119179],[119210,119213],[119362,119364],[121344,121398],[121403,121452],[121461,121461],[121476,121476],[121499,121503],[121505,121519],[122880,122886],[122888,122904],[122907,122913],[122915,122916],[122918,122922],[123184,123190],[123628,123631],[125136,125142],[125252,125258],[917505,917505],[917536,917631],[917760,917999]],s=[[4352,4447],[8986,8987],[9001,9002],[9193,9196],[9200,9200],[9203,9203],[9725,9726],[9748,9749],[9800,9811],[9855,9855],[9875,9875],[9889,9889],[9898,9899],[9917,9918],[9924,9925],[9934,9934],[9940,9940],[9962,9962],[9970,9971],[9973,9973],[9978,9978],[9981,9981],[9989,9989],[9994,9995],[10024,10024],[10060,10060],[10062,10062],[10067,10069],[10071,10071],[10133,10135],[10160,10160],[10175,10175],[11035,11036],[11088,11088],[11093,11093],[11904,11929],[11931,12019],[12032,12245],[12272,12283],[12288,12329],[12334,12350],[12353,12438],[12443,12543],[12549,12591],[12593,12686],[12688,12730],[12736,12771],[12784,12830],[12832,12871],[12880,19903],[19968,42124],[42128,42182],[43360,43388],[44032,55203],[63744,64255],[65040,65049],[65072,65106],[65108,65126],[65128,65131],[65281,65376],[65504,65510]],e=[[94176,94179],[94208,100343],[100352,101106],[110592,110878],[110928,110930],[110948,110951],[110960,111355],[126980,126980],[127183,127183],[127374,127374],[127377,127386],[127488,127490],[127504,127547],[127552,127560],[127568,127569],[127584,127589],[127744,127776],[127789,127797],[127799,127868],[127870,127891],[127904,127946],[127951,127955],[127968,127984],[127988,127988],[127992,128062],[128064,128064],[128066,128252],[128255,128317],[128331,128334],[128336,128359],[128378,128378],[128405,128406],[128420,128420],[128507,128591],[128640,128709],[128716,128716],[128720,128722],[128725,128725],[128747,128748],[128756,128762],[128992,129003],[129293,129393],[129395,129398],[129402,129442],[129445,129450],[129454,129482],[129485,129535],[129648,129651],[129656,129658],[129664,129666],[129680,129685],[131072,196605],[196608,262141]];let r;function d(t,n){let o,f=0,v=n.length-1;if(t<n[0][0]||t>n[v][1])return!1;for(;v>=f;)if(o=f+v>>1,t>n[o][1])f=o+1;else{if(!(t<n[o][0]))return!0;v=o-1}return!1}i.UnicodeV11=class{constructor(){if(this.version="11",!r){r=new Uint8Array(65536),r.fill(1),r[0]=0,r.fill(0,1,32),r.fill(0,127,160);for(let t=0;t<a.length;++t)r.fill(0,a[t][0],a[t][1]+1);for(let t=0;t<s.length;++t)r.fill(2,s[t][0],s[t][1]+1)}}wcwidth(t){return t<32?0:t<127?1:t<65536?r[t]:d(t,h)?0:d(t,e)?2:1}charProperties(t,n){let o=this.wcwidth(t),f=o===0&&n!==0;if(f){const v=l.UnicodeService.extractWidth(n);v===0?f=!1:v>o&&(o=v)}return l.UnicodeService.createPropertyValue(0,o,f)}}},345:(u,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.runAndSubscribe=i.forwardEvent=i.EventEmitter=void 0,i.EventEmitter=class{constructor(){this._listeners=[],this._disposed=!1}get event(){return this._event||(this._event=c=>(this._listeners.push(c),{dispose:()=>{if(!this._disposed){for(let l=0;l<this._listeners.length;l++)if(this._listeners[l]===c)return void this._listeners.splice(l,1)}}})),this._event}fire(c,l){const a=[];for(let h=0;h<this._listeners.length;h++)a.push(this._listeners[h]);for(let h=0;h<a.length;h++)a[h].call(void 0,c,l)}dispose(){this.clearListeners(),this._disposed=!0}clearListeners(){this._listeners&&(this._listeners.length=0)}},i.forwardEvent=function(c,l){return c((a=>l.fire(a)))},i.runAndSubscribe=function(c,l){return l(void 0),c((a=>l(a)))}},490:(u,i,c)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.UnicodeV6=void 0;const l=c(938),a=[[768,879],[1155,1158],[1160,1161],[1425,1469],[1471,1471],[1473,1474],[1476,1477],[1479,1479],[1536,1539],[1552,1557],[1611,1630],[1648,1648],[1750,1764],[1767,1768],[1770,1773],[1807,1807],[1809,1809],[1840,1866],[1958,1968],[2027,2035],[2305,2306],[2364,2364],[2369,2376],[2381,2381],[2385,2388],[2402,2403],[2433,2433],[2492,2492],[2497,2500],[2509,2509],[2530,2531],[2561,2562],[2620,2620],[2625,2626],[2631,2632],[2635,2637],[2672,2673],[2689,2690],[2748,2748],[2753,2757],[2759,2760],[2765,2765],[2786,2787],[2817,2817],[2876,2876],[2879,2879],[2881,2883],[2893,2893],[2902,2902],[2946,2946],[3008,3008],[3021,3021],[3134,3136],[3142,3144],[3146,3149],[3157,3158],[3260,3260],[3263,3263],[3270,3270],[3276,3277],[3298,3299],[3393,3395],[3405,3405],[3530,3530],[3538,3540],[3542,3542],[3633,3633],[3636,3642],[3655,3662],[3761,3761],[3764,3769],[3771,3772],[3784,3789],[3864,3865],[3893,3893],[3895,3895],[3897,3897],[3953,3966],[3968,3972],[3974,3975],[3984,3991],[3993,4028],[4038,4038],[4141,4144],[4146,4146],[4150,4151],[4153,4153],[4184,4185],[4448,4607],[4959,4959],[5906,5908],[5938,5940],[5970,5971],[6002,6003],[6068,6069],[6071,6077],[6086,6086],[6089,6099],[6109,6109],[6155,6157],[6313,6313],[6432,6434],[6439,6440],[6450,6450],[6457,6459],[6679,6680],[6912,6915],[6964,6964],[6966,6970],[6972,6972],[6978,6978],[7019,7027],[7616,7626],[7678,7679],[8203,8207],[8234,8238],[8288,8291],[8298,8303],[8400,8431],[12330,12335],[12441,12442],[43014,43014],[43019,43019],[43045,43046],[64286,64286],[65024,65039],[65056,65059],[65279,65279],[65529,65531]],h=[[68097,68099],[68101,68102],[68108,68111],[68152,68154],[68159,68159],[119143,119145],[119155,119170],[119173,119179],[119210,119213],[119362,119364],[917505,917505],[917536,917631],[917760,917999]];let s;i.UnicodeV6=class{constructor(){if(this.version="6",!s){s=new Uint8Array(65536),s.fill(1),s[0]=0,s.fill(0,1,32),s.fill(0,127,160),s.fill(2,4352,4448),s[9001]=2,s[9002]=2,s.fill(2,11904,42192),s[12351]=1,s.fill(2,44032,55204),s.fill(2,63744,64256),s.fill(2,65040,65050),s.fill(2,65072,65136),s.fill(2,65280,65377),s.fill(2,65504,65511);for(let e=0;e<a.length;++e)s.fill(0,a[e][0],a[e][1]+1)}}wcwidth(e){return e<32?0:e<127?1:e<65536?s[e]:(function(r,d){let t,n=0,o=d.length-1;if(r<d[0][0]||r>d[o][1])return!1;for(;o>=n;)if(t=n+o>>1,r>d[t][1])n=t+1;else{if(!(r<d[t][0]))return!0;o=t-1}return!1})(e,h)?0:e>=131072&&e<=196605||e>=196608&&e<=262141?2:1}charProperties(e,r){let d=this.wcwidth(e),t=d===0&&r!==0;if(t){const n=l.UnicodeService.extractWidth(r);n===0?t=!1:n>d&&(d=n)}return l.UnicodeService.createPropertyValue(0,d,t)}}},938:(u,i,c)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.UnicodeService=void 0;const l=c(345),a=c(490);class h{static extractShouldJoin(e){return(1&e)!=0}static extractWidth(e){return e>>1&3}static extractCharKind(e){return e>>3}static createPropertyValue(e,r,d=!1){return(16777215&e)<<3|(3&r)<<1|(d?1:0)}constructor(){this._providers=Object.create(null),this._active="",this._onChange=new l.EventEmitter,this.onChange=this._onChange.event;const e=new a.UnicodeV6;this.register(e),this._active=e.version,this._activeProvider=e}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(e){if(!this._providers[e])throw new Error(`unknown Unicode version "${e}"`);this._active=e,this._activeProvider=this._providers[e],this._onChange.fire(e)}register(e){this._providers[e.version]=e}wcwidth(e){return this._activeProvider.wcwidth(e)}getStringCellWidth(e){let r=0,d=0;const t=e.length;for(let n=0;n<t;++n){let o=e.charCodeAt(n);if(55296<=o&&o<=56319){if(++n>=t)return r+this.wcwidth(o);const x=e.charCodeAt(n);56320<=x&&x<=57343?o=1024*(o-55296)+x-56320+65536:r+=this.wcwidth(x)}const f=this.charProperties(o,d);let v=h.extractWidth(f);h.extractShouldJoin(f)&&(v-=h.extractWidth(d)),r+=v,d=f}return r}charProperties(e,r){return this._activeProvider.charProperties(e,r)}}i.UnicodeService=h}},p={};function _(u){var i=p[u];if(i!==void 0)return i.exports;var c=p[u]={exports:{}};return g[u](c,c.exports,_),c.exports}var w={};return(()=>{var u=w;Object.defineProperty(u,"__esModule",{value:!0}),u.Unicode11Addon=void 0;const i=_(433);u.Unicode11Addon=class{activate(c){c.unicode.register(new i.UnicodeV11)}dispose(){}}})(),w})()))})(P)),P.exports}var S=E();const V=j(S),m=A({__proto__:null,default:V},[S]);export{m as a};
@@ -1 +1 @@
1
- import{g as O}from"./vendor-react-K0fH_qHe.js";function j(b,k){for(var _=0;_<k.length;_++){const l=k[_];if(typeof l!="string"&&!Array.isArray(l)){for(const u in l)if(u!=="default"&&!(u in b)){const L=Object.getOwnPropertyDescriptor(l,u);L&&Object.defineProperty(b,u,L.get?L:{enumerable:!0,get:()=>l[u]})}}}return Object.freeze(Object.defineProperty(b,Symbol.toStringTag,{value:"Module"}))}var w={exports:{}},$;function A(){return $||($=1,(function(b,k){(function(_,l){b.exports=l()})(self,(()=>(()=>{var _={6:(p,d)=>{function h(s){try{const e=new URL(s),t=e.password&&e.username?`${e.protocol}//${e.username}:${e.password}@${e.host}`:e.username?`${e.protocol}//${e.username}@${e.host}`:`${e.protocol}//${e.host}`;return s.toLocaleLowerCase().startsWith(t.toLocaleLowerCase())}catch{return!1}}Object.defineProperty(d,"__esModule",{value:!0}),d.LinkComputer=d.WebLinkProvider=void 0,d.WebLinkProvider=class{constructor(s,e,t,r={}){this._terminal=s,this._regex=e,this._handler=t,this._options=r}provideLinks(s,e){const t=f.computeLink(s,this._regex,this._terminal,this._handler);e(this._addCallbacks(t))}_addCallbacks(s){return s.map((e=>(e.leave=this._options.leave,e.hover=(t,r)=>{if(this._options.hover){const{range:c}=e;this._options.hover(t,r,c)}},e)))}};class f{static computeLink(e,t,r,c){const g=new RegExp(t.source,(t.flags||"")+"g"),[n,o]=f._getWindowedLineStrings(e-1,r),i=n.join("");let a;const x=[];for(;a=g.exec(i);){const v=a[0];if(!h(v))continue;const[m,W]=f._mapStrIdx(r,o,0,a.index),[y,P]=f._mapStrIdx(r,m,W,v.length);if(m===-1||W===-1||y===-1||P===-1)continue;const S={start:{x:W+1,y:m+1},end:{x:P,y:y+1}};x.push({range:S,text:v,activate:c})}return x}static _getWindowedLineStrings(e,t){let r,c=e,g=e,n=0,o="";const i=[];if(r=t.buffer.active.getLine(e)){const a=r.translateToString(!0);if(r.isWrapped&&a[0]!==" "){for(n=0;(r=t.buffer.active.getLine(--c))&&n<2048&&(o=r.translateToString(!0),n+=o.length,i.push(o),r.isWrapped&&o.indexOf(" ")===-1););i.reverse()}for(i.push(a),n=0;(r=t.buffer.active.getLine(++g))&&r.isWrapped&&n<2048&&(o=r.translateToString(!0),n+=o.length,i.push(o),o.indexOf(" ")===-1););}return[i,c]}static _mapStrIdx(e,t,r,c){const g=e.buffer.active,n=g.getNullCell();let o=r;for(;c;){const i=g.getLine(t);if(!i)return[-1,-1];for(let a=o;a<i.length;++a){i.getCell(a,n);const x=n.getChars();if(n.getWidth()&&(c-=x.length||1,a===i.length-1&&x==="")){const v=g.getLine(t+1);v&&v.isWrapped&&(v.getCell(0,n),n.getWidth()===2&&(c+=1))}if(c<0)return[t,a]}t++,o=0}return[t,o]}}d.LinkComputer=f}},l={};function u(p){var d=l[p];if(d!==void 0)return d.exports;var h=l[p]={exports:{}};return _[p](h,h.exports,u),h.exports}var L={};return(()=>{var p=L;Object.defineProperty(p,"__esModule",{value:!0}),p.WebLinksAddon=void 0;const d=u(6),h=/(https?|HTTPS?):[/]{2}[^\s"'!*(){}|\\\^<>`]*[^\s"':,.!?{}|\\\^~\[\]`()<>]/;function f(s,e){const t=window.open();if(t){try{t.opener=null}catch{}t.location.href=e}else console.warn("Opening link blocked as opener could not be cleared")}p.WebLinksAddon=class{constructor(s=f,e={}){this._handler=s,this._options=e}activate(s){this._terminal=s;const e=this._options,t=e.urlRegex||h;this._linkProvider=this._terminal.registerLinkProvider(new d.WebLinkProvider(this._terminal,t,this._handler,e))}dispose(){this._linkProvider?.dispose()}}})(),L})()))})(w)),w.exports}var C=A();const T=O(C),E=j({__proto__:null,default:T},[C]);export{E as a};
1
+ import{g as O}from"./vendor-react-D37HfzIf.js";function j(b,k){for(var _=0;_<k.length;_++){const l=k[_];if(typeof l!="string"&&!Array.isArray(l)){for(const u in l)if(u!=="default"&&!(u in b)){const L=Object.getOwnPropertyDescriptor(l,u);L&&Object.defineProperty(b,u,L.get?L:{enumerable:!0,get:()=>l[u]})}}}return Object.freeze(Object.defineProperty(b,Symbol.toStringTag,{value:"Module"}))}var w={exports:{}},$;function A(){return $||($=1,(function(b,k){(function(_,l){b.exports=l()})(self,(()=>(()=>{var _={6:(p,d)=>{function h(s){try{const e=new URL(s),t=e.password&&e.username?`${e.protocol}//${e.username}:${e.password}@${e.host}`:e.username?`${e.protocol}//${e.username}@${e.host}`:`${e.protocol}//${e.host}`;return s.toLocaleLowerCase().startsWith(t.toLocaleLowerCase())}catch{return!1}}Object.defineProperty(d,"__esModule",{value:!0}),d.LinkComputer=d.WebLinkProvider=void 0,d.WebLinkProvider=class{constructor(s,e,t,r={}){this._terminal=s,this._regex=e,this._handler=t,this._options=r}provideLinks(s,e){const t=f.computeLink(s,this._regex,this._terminal,this._handler);e(this._addCallbacks(t))}_addCallbacks(s){return s.map((e=>(e.leave=this._options.leave,e.hover=(t,r)=>{if(this._options.hover){const{range:c}=e;this._options.hover(t,r,c)}},e)))}};class f{static computeLink(e,t,r,c){const g=new RegExp(t.source,(t.flags||"")+"g"),[n,o]=f._getWindowedLineStrings(e-1,r),i=n.join("");let a;const x=[];for(;a=g.exec(i);){const v=a[0];if(!h(v))continue;const[m,W]=f._mapStrIdx(r,o,0,a.index),[y,P]=f._mapStrIdx(r,m,W,v.length);if(m===-1||W===-1||y===-1||P===-1)continue;const S={start:{x:W+1,y:m+1},end:{x:P,y:y+1}};x.push({range:S,text:v,activate:c})}return x}static _getWindowedLineStrings(e,t){let r,c=e,g=e,n=0,o="";const i=[];if(r=t.buffer.active.getLine(e)){const a=r.translateToString(!0);if(r.isWrapped&&a[0]!==" "){for(n=0;(r=t.buffer.active.getLine(--c))&&n<2048&&(o=r.translateToString(!0),n+=o.length,i.push(o),r.isWrapped&&o.indexOf(" ")===-1););i.reverse()}for(i.push(a),n=0;(r=t.buffer.active.getLine(++g))&&r.isWrapped&&n<2048&&(o=r.translateToString(!0),n+=o.length,i.push(o),o.indexOf(" ")===-1););}return[i,c]}static _mapStrIdx(e,t,r,c){const g=e.buffer.active,n=g.getNullCell();let o=r;for(;c;){const i=g.getLine(t);if(!i)return[-1,-1];for(let a=o;a<i.length;++a){i.getCell(a,n);const x=n.getChars();if(n.getWidth()&&(c-=x.length||1,a===i.length-1&&x==="")){const v=g.getLine(t+1);v&&v.isWrapped&&(v.getCell(0,n),n.getWidth()===2&&(c+=1))}if(c<0)return[t,a]}t++,o=0}return[t,o]}}d.LinkComputer=f}},l={};function u(p){var d=l[p];if(d!==void 0)return d.exports;var h=l[p]={exports:{}};return _[p](h,h.exports,u),h.exports}var L={};return(()=>{var p=L;Object.defineProperty(p,"__esModule",{value:!0}),p.WebLinksAddon=void 0;const d=u(6),h=/(https?|HTTPS?):[/]{2}[^\s"'!*(){}|\\\^<>`]*[^\s"':,.!?{}|\\\^~\[\]`()<>]/;function f(s,e){const t=window.open();if(t){try{t.opener=null}catch{}t.location.href=e}else console.warn("Opening link blocked as opener could not be cleared")}p.WebLinksAddon=class{constructor(s=f,e={}){this._handler=s,this._options=e}activate(s){this._terminal=s;const e=this._options,t=e.urlRegex||h;this._linkProvider=this._terminal.registerLinkProvider(new d.WebLinkProvider(this._terminal,t,this._handler,e))}dispose(){this._linkProvider?.dispose()}}})(),L})()))})(w)),w.exports}var C=A();const T=O(C),E=j({__proto__:null,default:T},[C]);export{E as a};
@@ -1,4 +1,4 @@
1
- import{g as Se}from"./vendor-react-K0fH_qHe.js";function Te(ne,ve){for(var re=0;re<ve.length;re++){const Q=ve[re];if(typeof Q!="string"&&!Array.isArray(Q)){for(const V in Q)if(V!=="default"&&!(V in ne)){const oe=Object.getOwnPropertyDescriptor(Q,V);oe&&Object.defineProperty(ne,V,oe.get?oe:{enumerable:!0,get:()=>Q[V]})}}}return Object.freeze(Object.defineProperty(ne,Symbol.toStringTag,{value:"Module"}))}var me={exports:{}},Me;function De(){return Me||(Me=1,(function(ne,ve){(function(re,Q){ne.exports=Q()})(self,(()=>(()=>{var re={965:(D,e,c)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.GlyphRenderer=void 0;const l=c(374),o=c(509),r=c(855),d=c(859),m=c(381),_=11,i=_*Float32Array.BYTES_PER_ELEMENT;let t,g=0,R=0,C=0;class b extends d.Disposable{constructor(n,p,u,h){super(),this._terminal=n,this._gl=p,this._dimensions=u,this._optionsService=h,this._activeBuffer=0,this._vertices={count:0,attributes:new Float32Array(0),attributesBuffers:[new Float32Array(0),new Float32Array(0)]};const s=this._gl;o.TextureAtlas.maxAtlasPages===void 0&&(o.TextureAtlas.maxAtlasPages=Math.min(32,(0,l.throwIfFalsy)(s.getParameter(s.MAX_TEXTURE_IMAGE_UNITS))),o.TextureAtlas.maxTextureSize=(0,l.throwIfFalsy)(s.getParameter(s.MAX_TEXTURE_SIZE))),this._program=(0,l.throwIfFalsy)((0,m.createProgram)(s,`#version 300 es
1
+ import{g as Se}from"./vendor-react-D37HfzIf.js";function Te(ne,ve){for(var re=0;re<ve.length;re++){const Q=ve[re];if(typeof Q!="string"&&!Array.isArray(Q)){for(const V in Q)if(V!=="default"&&!(V in ne)){const oe=Object.getOwnPropertyDescriptor(Q,V);oe&&Object.defineProperty(ne,V,oe.get?oe:{enumerable:!0,get:()=>Q[V]})}}}return Object.freeze(Object.defineProperty(ne,Symbol.toStringTag,{value:"Module"}))}var me={exports:{}},Me;function De(){return Me||(Me=1,(function(ne,ve){(function(re,Q){ne.exports=Q()})(self,(()=>(()=>{var re={965:(D,e,c)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.GlyphRenderer=void 0;const l=c(374),o=c(509),r=c(855),d=c(859),m=c(381),_=11,i=_*Float32Array.BYTES_PER_ELEMENT;let t,g=0,R=0,C=0;class b extends d.Disposable{constructor(n,p,u,h){super(),this._terminal=n,this._gl=p,this._dimensions=u,this._optionsService=h,this._activeBuffer=0,this._vertices={count:0,attributes:new Float32Array(0),attributesBuffers:[new Float32Array(0),new Float32Array(0)]};const s=this._gl;o.TextureAtlas.maxAtlasPages===void 0&&(o.TextureAtlas.maxAtlasPages=Math.min(32,(0,l.throwIfFalsy)(s.getParameter(s.MAX_TEXTURE_IMAGE_UNITS))),o.TextureAtlas.maxTextureSize=(0,l.throwIfFalsy)(s.getParameter(s.MAX_TEXTURE_SIZE))),this._program=(0,l.throwIfFalsy)((0,m.createProgram)(s,`#version 300 es
2
2
  layout (location = 0) in vec2 a_unitquad;
3
3
  layout (location = 1) in vec2 a_cellpos;
4
4
  layout (location = 2) in vec2 a_offset;