@xopcai/xopc 0.0.193 → 0.0.194
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser-ext/manifest.json +1 -1
- package/dist/extensions/feishu/src/outbound/media-load.js +1 -1
- package/dist/extensions/telegram/xopc.extension.json +1 -1
- package/dist/gateway/static/root/assets/{agent-avatar-dicebear-DmNq0t2n.js → agent-avatar-dicebear-4ln7j-oZ.js} +1 -1
- package/dist/gateway/static/root/assets/{agents-BOo1rVn9.js → agents-C1Z-rurI.js} +1 -1
- package/dist/gateway/static/root/assets/{app-management-settings-panel-B3xStqSX.js → app-management-settings-panel-B0IMpHk8.js} +1 -1
- package/dist/gateway/static/root/assets/{appearance-settings-DglyenDq.js → appearance-settings-BG6ZGIUf.js} +1 -1
- package/dist/gateway/static/root/assets/{apps-page-DC9qPFTx.js → apps-page-CwsZENTk.js} +1 -1
- package/dist/gateway/static/root/assets/{archive-plugin-DvtcrBss.js → archive-plugin-BNpjG4FR.js} +1 -1
- package/dist/gateway/static/root/assets/{attachment-load-CALdq4xM.js → attachment-load-BK25C_hA.js} +1 -1
- package/dist/gateway/static/root/assets/{automations-page-BIGGKb0T.js → automations-page-BedezAfO.js} +1 -1
- package/dist/gateway/static/root/assets/{binary-plugins-GaVuvrDI.js → binary-plugins-fbFe6Jqc.js} +1 -1
- package/dist/gateway/static/root/assets/{block-editor-C2KrMYa_.js → block-editor-SQHwWg1e.js} +1 -1
- package/dist/gateway/static/root/assets/{browser-settings-page-CPW_E-xj.js → browser-settings-page-CC0_TfTy.js} +1 -1
- package/dist/gateway/static/root/assets/{browser-workflow-inputs-FfEEjhIS.js → browser-workflow-inputs-DuUQ_Ycz.js} +1 -1
- package/dist/gateway/static/root/assets/{browser-workflows-page-DFP9_UQk.js → browser-workflows-page-B8I2FmrM.js} +1 -1
- package/dist/gateway/static/root/assets/{capabilities-settings-panel-CsD8aGHU.js → capabilities-settings-panel-ditT6VRs.js} +1 -1
- package/dist/gateway/static/root/assets/{capability-presets-settings-panel-NCeyWH6Z.js → capability-presets-settings-panel-bNVds1ta.js} +1 -1
- package/dist/gateway/static/root/assets/{channels-settings-CknzwxNC.js → channels-settings-DhsWSbJ2.js} +1 -1
- package/dist/gateway/static/root/assets/{connectors-api-vaSrhPF8.js → connectors-api-Ne8mQrYN.js} +1 -1
- package/dist/gateway/static/root/assets/{connectors-page-DEGE7xp_.js → connectors-page-hZA9M1z_.js} +1 -1
- package/dist/gateway/static/root/assets/{cron-expression-BjFuXlGY.js → cron-expression-DtWb3YAh.js} +1 -1
- package/dist/gateway/static/root/assets/{dependency-picker-DOdkHdPv.js → dependency-picker-3vjdusik.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-Dz-Yf8Uu.js → desktop-pet-NmW7VWdO.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-settings-C8EHFEtd.js → desktop-pet-settings-DrdSI9lX.js} +1 -1
- package/dist/gateway/static/root/assets/{directory-picker-path-field-DKbfmZlZ.js → directory-picker-path-field-CG5XR1UD.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-debug-page-Dq0xsr_e.js → extension-debug-page-RjIezQyy.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-page-IgSLUyWP.js → extension-page-D9Elz9mr.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-settings-page-VC-8Pjn2.js → extension-settings-page-BvVjqFvm.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-config-api-CH2R7yqo.js → gateway-config-api-C-rYVz-n.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-settings-DLQJWaBQ.js → gateway-settings-CLS25-gm.js} +1 -1
- package/dist/gateway/static/root/assets/{heartbeat-settings-43loWoGb.js → heartbeat-settings-DSgDxtwJ.js} +1 -1
- package/dist/gateway/static/root/assets/{home-page-DqvpI6LC.js → home-page-CDpUUelT.js} +1 -1
- package/dist/gateway/static/root/assets/{index-BpkdvHH0.js → index-Cb9y6tVR.js} +8 -8
- package/dist/gateway/static/root/assets/index-DtEVsSU1.css +1 -0
- package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-DJDZes_8.js → keyboard-shortcuts-settings-RcHmSHYI.js} +1 -1
- package/dist/gateway/static/root/assets/{local-app-workbench-page-CvNQM6qm.js → local-app-workbench-page-DvzXo7dx.js} +1 -1
- package/dist/gateway/static/root/assets/{local-apps-page-C2ajOn1D.js → local-apps-page-s7PKLTvO.js} +1 -1
- package/dist/gateway/static/root/assets/{logs-page-BLm5yWqQ.js → logs-page-CNm5fu3L.js} +1 -1
- package/dist/gateway/static/root/assets/{management-settings--_eXnFVr.js → management-settings-CWUHBXje.js} +1 -1
- package/dist/gateway/static/root/assets/{markdown-split-iL2oi-x2.js → markdown-split-B-IuPr4L.js} +1 -1
- package/dist/gateway/static/root/assets/{media-plugins-BIbkLVpQ.js → media-plugins-CiejHVt4.js} +1 -1
- package/dist/gateway/static/root/assets/{notes-page-xFxaZ6gT.js → notes-page-BSJAwHqy.js} +1 -1
- package/dist/gateway/static/root/assets/{notes-workbench-PAftxL3V.js → notes-workbench-DTWRQ_EU.js} +2 -2
- package/dist/gateway/static/root/assets/{page-tabs-CROi9zm1.js → page-tabs-D6YJ6_l_.js} +1 -1
- package/dist/gateway/static/root/assets/{preview-open-alternatives-BwYcPjOM.js → preview-open-alternatives-Tw_G-6jb.js} +1 -1
- package/dist/gateway/static/root/assets/{product-open-page-BezeuVFd.js → product-open-page-BlB3QjTV.js} +1 -1
- package/dist/gateway/static/root/assets/{project-detail-page-CCdfZcw-.js → project-detail-page-DT7aWLWT.js} +1 -1
- package/dist/gateway/static/root/assets/{projects-page-DOG9zm5e.js → projects-page-B-i3U2fU.js} +1 -1
- package/dist/gateway/static/root/assets/{remote-access-hub-DQBFgveI.js → remote-access-hub-v-kXavTc.js} +1 -1
- package/dist/gateway/static/root/assets/{runtime-tools-settings-panel-Bs6tpSyX.js → runtime-tools-settings-panel-D59bftC7.js} +1 -1
- package/dist/gateway/static/root/assets/{schema-form-CWoSjz9s.js → schema-form-DyXqGA71.js} +1 -1
- package/dist/gateway/static/root/assets/{sessions-page-Db6L6M2H.js → sessions-page-tEfg1Pru.js} +1 -1
- package/dist/gateway/static/root/assets/settings-advanced-gate-tbguNxVJ.js +1 -0
- package/dist/gateway/static/root/assets/{settings-form-section-BJaMEHsX.js → settings-form-section-DZUGXwFO.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-loading-skeleton-sn4k17x7.js → settings-loading-skeleton-Lz1ec5lN.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-D2hfeFPX.js → settings-page-DLofKC7q.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-layout-CLtUsWsu.js → settings-page-layout-BdkN2U81.js} +1 -1
- package/dist/gateway/static/root/assets/{setup-status-panel-UmQC_uZ1.js → setup-status-panel-DQgoV7gj.js} +1 -1
- package/dist/gateway/static/root/assets/{share-preview-page-BJ58AluH.js → share-preview-page-DrZVv8tB.js} +1 -1
- package/dist/gateway/static/root/assets/{shares-settings-BZKn6Fdc.js → shares-settings-I2bBkyDb.js} +1 -1
- package/dist/gateway/static/root/assets/{skill-reload-api-Cx3i24w_.js → skill-reload-api-gFdcImEc.js} +1 -1
- package/dist/gateway/static/root/assets/{skills-page-DjUllGtk.js → skills-page-zOD__-H5.js} +1 -1
- package/dist/gateway/static/root/assets/{skills-page.utils-CZYIuE26.js → skills-page.utils-ZDcx95iD.js} +1 -1
- package/dist/gateway/static/root/assets/{system-settings-panel-DUrgdQMk.js → system-settings-panel-BJhat70L.js} +1 -1
- package/dist/gateway/static/root/assets/{task-detail-page-BGG2cFe9.js → task-detail-page-DoyREaFj.js} +1 -1
- package/dist/gateway/static/root/assets/{typed-models-lib-CRNMvvFX.js → typed-models-lib-B1p3wMFK.js} +1 -1
- package/dist/gateway/static/root/assets/{use-autosave-Dle3-zdQ.js → use-autosave-Frcfbncl.js} +1 -1
- package/dist/gateway/static/root/assets/{user-context-page-BLLmw5S1.js → user-context-page-DniWcH92.js} +1 -1
- package/dist/gateway/static/root/assets/{voice-api-key-field-BrWH0dCl.js → voice-api-key-field-CSNOUNF4.js} +1 -1
- package/dist/gateway/static/root/assets/{work-discovery-overlay-BZ1l9CFM.js → work-discovery-overlay-DTJGssPz.js} +1 -1
- package/dist/gateway/static/root/assets/work-discovery-page-Bt2-fzHu.js +1 -0
- package/dist/gateway/static/root/assets/{workflow-run-setup-panel-BK6e9yzK.js → workflow-run-setup-panel-D3uCmyag.js} +1 -1
- package/dist/gateway/static/root/assets/{workflows-page-Bp5JxQJa.js → workflows-page-Ba5fVQWY.js} +1 -1
- package/dist/gateway/static/root/index.html +2 -2
- package/dist/package.js +1 -1
- package/dist/src/agent/agent-manager.js +1 -1
- package/dist/src/agent/memory/create-memory-manager.js +1 -1
- package/dist/src/agent-runtime/index.js +1 -1
- package/dist/src/agent-runtime/runtime-profile.js +1 -1
- package/dist/src/cli/commands/channels.js +1 -1
- package/dist/src/cli/commands/connectors.js +1 -1
- package/dist/src/cli/commands/extension-marketplace.js +1 -1
- package/dist/src/cli/commands/gateway/lifecycle.js +1 -1
- package/dist/src/cli/commands/models.js +1 -1
- package/dist/src/cli/commands/onboard.js +1 -1
- package/dist/src/cli/commands/update.js +1 -1
- package/dist/src/config/agent-profile.js +1 -1
- package/dist/src/extensions/sdk/index.js +1 -1
- package/dist/src/gateway/agents-admin.js +1 -1
- package/dist/src/gateway/hono/routes/local-apps.js +1 -1
- package/dist/src/gateway/hono/routes/update.js +2 -2
- package/dist/src/gateway/index.js +1 -1
- package/dist/src/gateway/run-loop.js +1 -1
- package/dist/src/gateway/service.js +6 -6
- package/dist/src/infra/gateway-processes.js +1 -1
- package/dist/src/infra/update-restart.js +1 -1
- package/dist/src/infra/update-runner.js +2 -2
- package/dist/src/infra/update-startup.js +1 -1
- package/dist/src/tui/backends/gateway-realtime-backend.js +1 -1
- package/dist/src/work-discovery/analyzer.js +1 -2
- package/package.json +4 -4
- package/dist/gateway/static/root/assets/index-CFVjH-EK.css +0 -1
- package/dist/gateway/static/root/assets/settings-advanced-gate-CcO2bd6q.js +0 -1
- package/dist/gateway/static/root/assets/work-discovery-page-BnPF2vx7.js +0 -1
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./cn-JdwAhgNB.js";import{t as a}from"./messages-DQ5X6cXp.js";import{o,r as s}from"./locale-store-Bjvw7jtg.js";import{$c as c,Ao as l,Ds as u,G as d,Go as f,Gs as p,I as m,Mo as h,No as g,Oo as _,Po as v,Rs as y,Wo as b,Ys as x,_s as S,bs as C,cc as w,et as T,j as E,kl as D,ko as O,ou as k,qs as A,tt as j,yi as M}from"./index-
|
|
1
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./cn-JdwAhgNB.js";import{t as a}from"./messages-DQ5X6cXp.js";import{o,r as s}from"./locale-store-Bjvw7jtg.js";import{$c as c,Ao as l,Ds as u,G as d,Go as f,Gs as p,I as m,Mo as h,No as g,Oo as _,Po as v,Rs as y,Wo as b,Ys as x,_s as S,bs as C,cc as w,et as T,j as E,kl as D,ko as O,ou as k,qs as A,tt as j,yi as M}from"./index-Cb9y6tVR.js";var N=e(t(),1),P=n();function F(e){if(!e.trim())return null;try{return JSON.parse(e)}catch{return null}}function I(e){return typeof e.message==`string`&&e.message.trim()?e.message:typeof e.error==`string`&&e.error.trim()?e.error:e.error&&typeof e.error==`object`&&typeof e.error.message==`string`?e.error.message:`AI suggestion failed`}function L(e,t={}){let n=F(e.split(`
|
|
2
2
|
`).filter(e=>e.startsWith(`data:`)).map(e=>e.slice(5).trimStart()).join(`
|
|
3
3
|
`));if(!n)return null;if(n.type===`text_delta`&&typeof n.delta==`string`)return t.onDelta?.(n.delta),null;if(n.type===`thinking_delta`&&typeof n.delta==`string`)return t.onThinkingDelta?.(n.delta),null;if(n.type===`done`&&typeof n.text==`string`)return n.text;if(n.type===`error`)throw Error(I(n));return null}async function R(e,t={}){let n=await o(s(`/api/ai/text-assist`),{method:`POST`,headers:{Accept:`text/event-stream`},body:JSON.stringify(e)});if(!n.ok){let e=await n.json().catch(()=>({})),t=typeof e.error==`string`?e.error:e.error?.message;throw Error(t||`AI suggestion failed (${n.status})`)}if(!n.body){let e=await n.json().catch(()=>null);if(e?.text)return e;throw Error(`AI suggestion stream is empty`)}let r=n.body.getReader(),i=new TextDecoder,a=``,c=``,l=``;for(;;){let{done:e,value:n}=await r.read();if(n){a+=i.decode(n,{stream:!e});let r=a.split(/\r?\n\r?\n/);a=r.pop()??``;for(let e of r){let n=L(e,{onDelta:e=>{c+=e,t.onDelta?.(e)},onThinkingDelta:e=>{l+=e,t.onThinkingDelta?.(e)}});n!==null&&(c=n)}}if(e)break}if(a.trim()){let e=L(a,{onDelta:e=>{c+=e,t.onDelta?.(e)},onThinkingDelta:e=>{l+=e,t.onThinkingDelta?.(e)}});e!==null&&(c=e)}let u=c.trim();if(!u)throw Error(`AI returned an empty suggestion`);return{text:u,thinking:l.trim()||void 0}}function ee(){let[e,t]=(0,N.useState)(``),[n,r]=(0,N.useState)(``),[i,a]=(0,N.useState)(!1),[o,s]=(0,N.useState)(null);return{suggestion:e,thinking:n,loading:i,error:o,generate:(0,N.useCallback)(async e=>{a(!0),s(null),t(``),r(``);try{let n=await R(e,{onDelta:e=>{t(t=>t+e)},onThinkingDelta:e=>{r(t=>t+e)}});return t(n.text),r(n.thinking??``),n.text}catch(e){return s(e instanceof Error?e.message:`AI suggestion failed`),null}finally{a(!1)}},[]),reset:(0,N.useCallback)(()=>{t(``),r(``),s(null),a(!1)},[])}}var z=r(),te=5;function ne(e){return e.startsWith(`zh`)?{title:`AI 优化文案`,buttonTitle:`优化文案`,current:`当前内容`,suggestion:`AI 建议`,editedSuggestion:`审核并编辑建议`,thinking:`模型思考`,thinkingLoading:`思考中`,edit:`编辑`,preview:`预览`,loading:`正在生成建议...`,empty:`暂无内容`,generate:`生成建议`,regenerate:`重新生成`,applyCurrent:`应用当前内容`,replace:`替换`,append:`追加`,cancel:`取消`,close:`关闭`}:{title:`AI text assist`,buttonTitle:`Improve text`,current:`Current`,suggestion:`Suggestion`,editedSuggestion:`Review and edit suggestion`,thinking:`Model thinking`,thinkingLoading:`Thinking`,edit:`Edit`,preview:`Preview`,loading:`Generating suggestion...`,empty:`No content`,generate:`Generate suggestion`,regenerate:`Regenerate`,applyCurrent:`Apply current`,replace:`Replace`,append:`Append`,cancel:`Cancel`,close:`Close`}}function B(e){let t=(0,P.c)(239),{value:n,onApply:r,fieldId:a,fieldLabel:o,scenario:s,format:c,intent:u,locale:d,context:f,disabled:m,className:y,showLabel:b}=e,x=s===void 0?`generic.text`:s,T=c===void 0?`plain`:c,E=u===void 0?`improve`:u,j=b===void 0?!0:b,[F,I]=(0,N.useState)(!1),[L,R]=(0,N.useState)(n),[B,V]=(0,N.useState)(`preview`),[H,U]=(0,N.useState)(``),[W,ae]=(0,N.useState)(`edit`),[G,K]=(0,N.useState)(!0),[oe,se]=(0,N.useState)(!1),[ce,q]=(0,N.useState)(null),le=(0,N.useRef)(null),ue=(0,N.useRef)(!0),{suggestion:de,thinking:J,loading:Y,error:X,generate:fe,reset:pe}=ee(),me;t[0]===d?me=t[1]:(me=ne(d),t[0]=d,t[1]=me);let Z=me,he;t[2]!==Y||t[3]!==J?(he=Y&&J.trim().length>0,t[2]=Y,t[3]=J,t[4]=he):he=t[4];let Q=he,ge,_e;t[5]!==F||t[6]!==n?(ge=()=>{F||R(n)},_e=[F,n],t[5]=F,t[6]=n,t[7]=ge,t[8]=_e):(ge=t[7],_e=t[8]),(0,N.useEffect)(ge,_e);let ve,ye;t[9]===de?(ve=t[10],ye=t[11]):(ye=()=>{U(de)},ve=[de],t[9]=de,t[10]=ve,t[11]=ye),(0,N.useEffect)(ye,ve);let be,xe;t[12]===J?(be=t[13],xe=t[14]):(be=()=>{J.trim()&&K(!0)},xe=[J],t[12]=J,t[13]=be,t[14]=xe),(0,N.useEffect)(be,xe);let Se;t[15]!==Q||t[16]!==G?(Se=()=>{let e=le.current;!e||!Q||!G||ue.current&&(e.scrollTop=e.scrollHeight)},t[15]=Q,t[16]=G,t[17]=Se):Se=t[17];let Ce;t[18]!==Q||t[19]!==J||t[20]!==G?(Ce=[Q,J,G],t[18]=Q,t[19]=J,t[20]=G,t[21]=Ce):Ce=t[21],(0,N.useLayoutEffect)(Se,Ce);let we;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(we=()=>{let e=le.current;e&&(ue.current=e.scrollHeight-e.scrollTop-e.clientHeight<=te)},t[22]=we):we=t[22];let Te=we,Ee;t[23]!==f||t[24]!==a||t[25]!==o||t[26]!==T||t[27]!==fe||t[28]!==E||t[29]!==d||t[30]!==x?(Ee=async e=>{ae(`edit`),K(!0),ue.current=!0,await fe({intent:E,scenario:x,input:e,locale:d,field:{id:a,label:o,format:T},context:f})},t[23]=f,t[24]=a,t[25]=o,t[26]=T,t[27]=fe,t[28]=E,t[29]=d,t[30]=x,t[31]=Ee):Ee=t[31];let De=Ee,Oe;t[32]!==pe||t[33]!==n?(Oe=e=>{se(!!e.currentTarget.closest(`[role="dialog"]`)),q(document.querySelector(`.app-main-surface`)),R(n),V(`preview`),U(``),ae(`edit`),K(!0),pe(),I(!0)},t[32]=pe,t[33]=n,t[34]=Oe):Oe=t[34];let ke=Oe,Ae;t[35]!==L||t[36]!==De?(Ae=async()=>{await De(L)},t[35]=L,t[36]=De,t[37]=Ae):Ae=t[37];let je=Ae,Me;t[38]!==pe||t[39]!==n?(Me=()=>{I(!1),R(n),V(`preview`),U(``),ae(`edit`),K(!0),pe()},t[38]=pe,t[39]=n,t[40]=Me):Me=t[40];let $=Me,Ne;t[41]!==$||t[42]!==L||t[43]!==r?(Ne=()=>{r(L),$()},t[41]=$,t[42]=L,t[43]=r,t[44]=Ne):Ne=t[44];let Pe=Ne,Fe;t[45]!==$||t[46]!==H||t[47]!==r?(Fe=()=>{H.trim()&&(r(H),$())},t[45]=$,t[46]=H,t[47]=r,t[48]=Fe):Fe=t[48];let Ie=Fe,Le;t[49]!==$||t[50]!==L||t[51]!==H||t[52]!==r?(Le=()=>{if(!H.trim())return;let e=L.trimEnd();r(e?`${e}\n\n${H}`:H),$()},t[49]=$,t[50]=L,t[51]=H,t[52]=r,t[53]=Le):Le=t[53];let Re=Le,ze;t[54]!==H||t[55]!==X||t[56]!==Y?(ze=!Y&&!X&&H.trim().length>0,t[54]=H,t[55]=X,t[56]=Y,t[57]=ze):ze=t[57];let Be=ze,Ve=L!==n,He;t[58]!==H||t[59]!==X||t[60]!==J?(He=H.trim().length>0||J.trim().length>0||!!X,t[58]=H,t[59]=X,t[60]=J,t[61]=He):He=t[61];let Ue=He,We=!j&&`size-7 p-0`,Ge;t[62]!==y||t[63]!==We?(Ge=i(`h-7 gap-1 px-2 text-xs`,We,y),t[62]=y,t[63]=We,t[64]=Ge):Ge=t[64];let Ke=m||Y,qe;t[65]===Symbol.for(`react.memo_cache_sentinel`)?(qe=(0,z.jsx)(A,{className:`size-3.5`,strokeWidth:1.75,"aria-hidden":!0}),t[65]=qe):qe=t[65];let Je=j?Z.buttonTitle:null,Ye;t[66]!==Z.buttonTitle||t[67]!==ke||t[68]!==Ge||t[69]!==Ke||t[70]!==Je?(Ye=(0,z.jsxs)(S,{type:`button`,variant:`ghost`,className:Ge,title:Z.buttonTitle,"aria-label":Z.buttonTitle,disabled:Ke,onClick:ke,children:[qe,Je]}),t[66]=Z.buttonTitle,t[67]=ke,t[68]=Ge,t[69]=Ke,t[70]=Je,t[71]=Ye):Ye=t[71];let Xe;t[72]===$?Xe=t[73]:(Xe=e=>e?I(!0):$(),t[72]=$,t[73]=Xe);let Ze=ce??void 0,Qe=oe?`bg-transparent`:`bg-scrim`,$e;t[74]===Qe?$e=t[75]:($e=i(`xopc-dialog-overlay absolute inset-0 z-[80]`,Qe),t[74]=Qe,t[75]=$e);let et;t[76]===$e?et=t[77]:(et=(0,z.jsx)(h,{className:$e}),t[76]=$e,t[77]=et);let tt;t[78]===Z.title?tt=t[79]:(tt=(0,z.jsx)(v,{className:`text-base font-semibold text-fg`,children:Z.title}),t[78]=Z.title,t[79]=tt);let nt;t[80]===Symbol.for(`react.memo_cache_sentinel`)?(nt=(0,z.jsx)(C,{className:`size-5`,strokeWidth:1.75}),t[80]=nt):nt=t[80];let rt;t[81]===Z.close?rt=t[82]:(rt=(0,z.jsx)(O,{asChild:!0,children:(0,z.jsx)(S,{type:`button`,variant:`ghost`,className:`size-9 shrink-0 p-0`,"aria-label":Z.close,children:nt})}),t[81]=Z.close,t[82]=rt);let it;t[83]!==tt||t[84]!==rt?(it=(0,z.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between gap-2 border-b border-edge px-4 py-3`,children:[tt,rt]}),t[83]=tt,t[84]=rt,t[85]=it):it=t[85];let at;t[86]===Z.current?at=t[87]:(at=(0,z.jsx)(`div`,{className:`min-w-0 text-xs font-medium text-fg-muted`,children:Z.current}),t[86]=Z.current,t[87]=at);let ot=B===`edit`?`bg-surface-panel text-fg shadow-surface`:`text-fg-muted hover:bg-surface-hover`,st;t[88]===ot?st=t[89]:(st=i(`inline-flex h-7 items-center gap-1.5 rounded-md px-2 text-xs font-medium`,ot),t[88]=ot,t[89]=st);let ct,lt;t[90]===Symbol.for(`react.memo_cache_sentinel`)?(ct=()=>V(`edit`),lt=(0,z.jsx)(p,{className:`size-3.5 shrink-0`,strokeWidth:1.75,"aria-hidden":!0}),t[90]=ct,t[91]=lt):(ct=t[90],lt=t[91]);let ut;t[92]!==Z.edit||t[93]!==st?(ut=(0,z.jsxs)(`button`,{type:`button`,className:st,onClick:ct,children:[lt,Z.edit]}),t[92]=Z.edit,t[93]=st,t[94]=ut):ut=t[94];let dt=B===`preview`?`bg-surface-panel text-fg shadow-surface`:`text-fg-muted hover:bg-surface-hover`,ft;t[95]===dt?ft=t[96]:(ft=i(`inline-flex h-7 items-center gap-1.5 rounded-md px-2 text-xs font-medium`,dt),t[95]=dt,t[96]=ft);let pt,mt;t[97]===Symbol.for(`react.memo_cache_sentinel`)?(pt=()=>V(`preview`),mt=(0,z.jsx)(D,{className:`size-3.5 shrink-0`,strokeWidth:1.75,"aria-hidden":!0}),t[97]=pt,t[98]=mt):(pt=t[97],mt=t[98]);let ht;t[99]!==Z.preview||t[100]!==ft?(ht=(0,z.jsxs)(`button`,{type:`button`,className:ft,onClick:pt,children:[mt,Z.preview]}),t[99]=Z.preview,t[100]=ft,t[101]=ht):ht=t[101];let gt;t[102]!==ut||t[103]!==ht?(gt=(0,z.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1 rounded-lg border border-edge bg-surface-muted p-0.5`,children:[ut,ht]}),t[102]=ut,t[103]=ht,t[104]=gt):gt=t[104];let _t;t[105]!==at||t[106]!==gt?(_t=(0,z.jsxs)(`div`,{className:`mb-2 flex items-center justify-between gap-2`,children:[at,gt]}),t[105]=at,t[106]=gt,t[107]=_t):_t=t[107];let vt;t[108]!==L||t[109]!==B||t[110]!==T||t[111]!==Z.current||t[112]!==Z.empty?(vt=B===`preview`?(0,z.jsx)(`div`,{className:`min-h-0 flex-1 overflow-auto rounded-lg border border-edge bg-surface-base p-3 text-sm leading-6 text-fg`,children:T===`markdown`?(0,z.jsx)(M,{content:L||Z.empty,compact:!0,className:`text-sm`}):(0,z.jsx)(`pre`,{className:`whitespace-pre-wrap text-sm leading-6 text-fg`,children:L||Z.empty})}):(0,z.jsx)(`textarea`,{className:`min-h-0 flex-1 resize-none overflow-auto rounded-lg border border-edge bg-surface-base p-3 text-sm leading-6 text-fg outline-none focus:border-accent focus:ring-2 focus:ring-accent/25`,value:L,onChange:e=>R(e.currentTarget.value),placeholder:Z.empty,"aria-label":Z.current}),t[108]=L,t[109]=B,t[110]=T,t[111]=Z.current,t[112]=Z.empty,t[113]=vt):vt=t[113];let yt;t[114]!==_t||t[115]!==vt?(yt=(0,z.jsxs)(`div`,{className:`flex min-h-0 flex-col overflow-hidden`,children:[_t,vt]}),t[114]=_t,t[115]=vt,t[116]=yt):yt=t[116];let bt;t[117]===Z.editedSuggestion?bt=t[118]:(bt=(0,z.jsx)(`span`,{children:Z.editedSuggestion}),t[117]=Z.editedSuggestion,t[118]=bt);let xt;t[119]!==Z.loading||t[120]!==Y?(xt=Y?(0,z.jsx)(`span`,{className:`ml-2 font-normal`,children:Z.loading}):null,t[119]=Z.loading,t[120]=Y,t[121]=xt):xt=t[121];let St;t[122]!==bt||t[123]!==xt?(St=(0,z.jsxs)(`div`,{className:`min-w-0 text-xs font-medium text-fg-muted`,children:[bt,xt]}),t[122]=bt,t[123]=xt,t[124]=St):St=t[124];let Ct=W===`edit`?`bg-surface-panel text-fg shadow-surface`:`text-fg-muted hover:bg-surface-hover`,wt;t[125]===Ct?wt=t[126]:(wt=i(`inline-flex h-7 items-center gap-1.5 rounded-md px-2 text-xs font-medium`,Ct),t[125]=Ct,t[126]=wt);let Tt,Et;t[127]===Symbol.for(`react.memo_cache_sentinel`)?(Tt=()=>ae(`edit`),Et=(0,z.jsx)(p,{className:`size-3.5 shrink-0`,strokeWidth:1.75,"aria-hidden":!0}),t[127]=Tt,t[128]=Et):(Tt=t[127],Et=t[128]);let Dt;t[129]!==Z.edit||t[130]!==wt?(Dt=(0,z.jsxs)(`button`,{type:`button`,className:wt,onClick:Tt,children:[Et,Z.edit]}),t[129]=Z.edit,t[130]=wt,t[131]=Dt):Dt=t[131];let Ot=W===`preview`?`bg-surface-panel text-fg shadow-surface`:`text-fg-muted hover:bg-surface-hover`,kt;t[132]===Ot?kt=t[133]:(kt=i(`inline-flex h-7 items-center gap-1.5 rounded-md px-2 text-xs font-medium`,Ot),t[132]=Ot,t[133]=kt);let At,jt;t[134]===Symbol.for(`react.memo_cache_sentinel`)?(At=()=>ae(`preview`),jt=(0,z.jsx)(D,{className:`size-3.5 shrink-0`,strokeWidth:1.75,"aria-hidden":!0}),t[134]=At,t[135]=jt):(At=t[134],jt=t[135]);let Mt;t[136]!==Z.preview||t[137]!==kt?(Mt=(0,z.jsxs)(`button`,{type:`button`,className:kt,onClick:At,children:[jt,Z.preview]}),t[136]=Z.preview,t[137]=kt,t[138]=Mt):Mt=t[138];let Nt;t[139]!==Dt||t[140]!==Mt?(Nt=(0,z.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1 rounded-lg border border-edge bg-surface-muted p-0.5`,children:[Dt,Mt]}),t[139]=Dt,t[140]=Mt,t[141]=Nt):Nt=t[141];let Pt;t[142]!==St||t[143]!==Nt?(Pt=(0,z.jsxs)(`div`,{className:`mb-2 flex items-center justify-between gap-2`,children:[St,Nt]}),t[142]=St,t[143]=Nt,t[144]=Pt):Pt=t[144];let Ft=Q?`opacity-100`:`pointer-events-none opacity-0`,It;t[145]===Ft?It=t[146]:(It=i(`absolute inset-0 min-h-0 transition-opacity duration-200 ease-out motion-reduce:transition-none`,Ft),t[145]=Ft,t[146]=It);let Lt=!Q,Rt;t[147]===Symbol.for(`react.memo_cache_sentinel`)?(Rt=()=>K(re),t[147]=Rt):Rt=t[147];let zt;t[148]!==Z.thinkingLoading||t[149]!==Y?(zt=Y?(0,z.jsxs)(`span`,{className:`ml-1 font-normal`,children:[`· `,Z.thinkingLoading]}):null,t[148]=Z.thinkingLoading,t[149]=Y,t[150]=zt):zt=t[150];let Bt;t[151]!==Z.thinking||t[152]!==zt?(Bt=(0,z.jsxs)(`span`,{className:`min-w-0 truncate`,children:[Z.thinking,zt]}),t[151]=Z.thinking,t[152]=zt,t[153]=Bt):Bt=t[153];let Vt=G&&`rotate-180`,Ht;t[154]===Vt?Ht=t[155]:(Ht=i(`size-3.5 shrink-0 transition-transform`,Vt),t[154]=Vt,t[155]=Ht);let Ut;t[156]===Ht?Ut=t[157]:(Ut=(0,z.jsx)(k,{className:Ht,strokeWidth:1.75,"aria-hidden":!0}),t[156]=Ht,t[157]=Ut);let Wt;t[158]!==Bt||t[159]!==Ut?(Wt=(0,z.jsxs)(`button`,{type:`button`,className:`flex shrink-0 items-center justify-between gap-2 px-2.5 py-2 text-left text-xs font-medium text-fg-muted hover:text-fg`,onClick:Rt,children:[Bt,Ut]}),t[158]=Bt,t[159]=Ut,t[160]=Wt):Wt=t[160];let Gt;t[161]!==J||t[162]!==G?(Gt=G?(0,z.jsx)(`pre`,{ref:le,className:`min-h-0 flex-1 overflow-auto border-t border-edge px-2.5 py-2 whitespace-pre-wrap text-xs leading-5 text-fg-muted`,onScroll:Te,children:J}):null,t[161]=J,t[162]=G,t[163]=Gt):Gt=t[163];let Kt;t[164]!==Wt||t[165]!==Gt?(Kt=(0,z.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col rounded-lg border border-edge bg-surface-muted/70`,children:[Wt,Gt]}),t[164]=Wt,t[165]=Gt,t[166]=Kt):Kt=t[166];let qt;t[167]!==It||t[168]!==Lt||t[169]!==Kt?(qt=(0,z.jsx)(`div`,{className:It,"aria-hidden":Lt,children:Kt}),t[167]=It,t[168]=Lt,t[169]=Kt,t[170]=qt):qt=t[170];let Jt=Q?`pointer-events-none opacity-0`:`opacity-100`,Yt;t[171]===Jt?Yt=t[172]:(Yt=i(`absolute inset-0 min-h-0 transition-opacity duration-200 ease-out motion-reduce:transition-none`,Jt),t[171]=Jt,t[172]=Yt);let Xt;t[173]!==H||t[174]!==X||t[175]!==T||t[176]!==Z.empty||t[177]!==Z.loading||t[178]!==Z.suggestion||t[179]!==Y||t[180]!==W?(Xt=X?(0,z.jsx)(`pre`,{className:`h-full min-h-0 overflow-auto whitespace-pre-wrap rounded-lg border border-edge bg-surface-base p-3 text-sm leading-6 text-fg-muted`,children:X}):W===`preview`?(0,z.jsx)(`div`,{className:`h-full min-h-0 overflow-auto rounded-lg border border-edge bg-surface-base p-3 text-sm leading-6 text-fg`,children:Y&&!H.trim()?(0,z.jsx)(`p`,{className:`text-sm text-fg-muted`,children:Z.loading}):T===`markdown`?(0,z.jsx)(M,{content:H||Z.empty,compact:!0,className:`text-sm`}):(0,z.jsx)(`pre`,{className:`whitespace-pre-wrap text-sm leading-6 text-fg`,children:H||Z.empty})}):(0,z.jsx)(`textarea`,{className:`h-full min-h-0 w-full resize-none overflow-auto rounded-lg border border-edge bg-surface-base p-3 text-sm leading-6 text-fg outline-none focus:border-accent focus:ring-2 focus:ring-accent/25 disabled:text-fg-muted`,value:H,onChange:e=>U(e.currentTarget.value),disabled:Y,placeholder:Y?Z.loading:Z.empty,"aria-label":Z.suggestion}),t[173]=H,t[174]=X,t[175]=T,t[176]=Z.empty,t[177]=Z.loading,t[178]=Z.suggestion,t[179]=Y,t[180]=W,t[181]=Xt):Xt=t[181];let Zt;t[182]!==Yt||t[183]!==Xt?(Zt=(0,z.jsx)(`div`,{className:Yt,children:Xt}),t[182]=Yt,t[183]=Xt,t[184]=Zt):Zt=t[184];let Qt;t[185]!==qt||t[186]!==Zt?(Qt=(0,z.jsxs)(`div`,{className:`relative min-h-0 flex-1 overflow-hidden`,children:[qt,Zt]}),t[185]=qt,t[186]=Zt,t[187]=Qt):Qt=t[187];let $t;t[188]!==Pt||t[189]!==Qt?($t=(0,z.jsxs)(`div`,{className:`flex min-h-0 flex-col overflow-hidden`,children:[Pt,Qt]}),t[188]=Pt,t[189]=Qt,t[190]=$t):$t=t[190];let en;t[191]!==yt||t[192]!==$t?(en=(0,z.jsxs)(`div`,{className:`grid min-h-0 flex-1 grid-cols-1 gap-3 overflow-hidden p-4 md:grid-cols-2`,children:[yt,$t]}),t[191]=yt,t[192]=$t,t[193]=en):en=t[193];let tn;t[194]!==$||t[195]!==Z.cancel?(tn=(0,z.jsx)(S,{type:`button`,variant:`secondary`,onClick:$,children:Z.cancel}),t[194]=$,t[195]=Z.cancel,t[196]=tn):tn=t[196];let nn=!Ve,rn;t[197]!==Pe||t[198]!==Z.applyCurrent||t[199]!==nn?(rn=(0,z.jsx)(S,{type:`button`,variant:`secondary`,disabled:nn,onClick:Pe,children:Z.applyCurrent}),t[197]=Pe,t[198]=Z.applyCurrent,t[199]=nn,t[200]=rn):rn=t[200];let an;t[201]===je?an=t[202]:(an=()=>void je(),t[201]=je,t[202]=an);let on;t[203]===Ue?on=t[204]:(on=Ue?(0,z.jsx)(w,{className:`size-4`,strokeWidth:1.75,"aria-hidden":!0}):(0,z.jsx)(A,{className:`size-4`,strokeWidth:1.75,"aria-hidden":!0}),t[203]=Ue,t[204]=on);let sn=Ue?Z.regenerate:Z.generate,cn;t[205]!==Y||t[206]!==an||t[207]!==on||t[208]!==sn?(cn=(0,z.jsxs)(S,{type:`button`,variant:`secondary`,disabled:Y,onClick:an,children:[on,sn]}),t[205]=Y,t[206]=an,t[207]=on,t[208]=sn,t[209]=cn):cn=t[209];let ln=!Be,un;t[210]!==Re||t[211]!==Z.append||t[212]!==ln?(un=(0,z.jsx)(S,{type:`button`,variant:`secondary`,disabled:ln,onClick:Re,children:Z.append}),t[210]=Re,t[211]=Z.append,t[212]=ln,t[213]=un):un=t[213];let dn=!Be,fn;t[214]!==Ie||t[215]!==Z.replace||t[216]!==dn?(fn=(0,z.jsx)(S,{type:`button`,variant:`primary`,disabled:dn,onClick:Ie,children:Z.replace}),t[214]=Ie,t[215]=Z.replace,t[216]=dn,t[217]=fn):fn=t[217];let pn;t[218]!==fn||t[219]!==tn||t[220]!==rn||t[221]!==cn||t[222]!==un?(pn=(0,z.jsxs)(`div`,{className:`flex shrink-0 justify-end gap-2 border-t border-edge px-4 py-3`,children:[tn,rn,cn,un,fn]}),t[218]=fn,t[219]=tn,t[220]=rn,t[221]=cn,t[222]=un,t[223]=pn):pn=t[223];let mn;t[224]!==pn||t[225]!==it||t[226]!==en?(mn=(0,z.jsx)(`div`,{className:`absolute inset-0 z-[80] flex items-center justify-center p-4 pointer-events-none`,children:(0,z.jsxs)(l,{className:`xopc-dialog-content-pane pointer-events-auto flex h-[min(78vh,38rem)] w-full max-w-4xl flex-col overflow-hidden rounded-2xl border border-edge bg-surface-panel shadow-popover outline-none`,onOpenAutoFocus:ie,children:[it,en,pn]})}),t[224]=pn,t[225]=it,t[226]=en,t[227]=mn):mn=t[227];let hn;t[228]!==mn||t[229]!==Ze||t[230]!==et?(hn=(0,z.jsxs)(g,{container:Ze,children:[et,mn]}),t[228]=mn,t[229]=Ze,t[230]=et,t[231]=hn):hn=t[231];let gn;t[232]!==F||t[233]!==hn||t[234]!==Xe?(gn=(0,z.jsx)(_,{open:F,onOpenChange:Xe,children:hn}),t[232]=F,t[233]=hn,t[234]=Xe,t[235]=gn):gn=t[235];let _n;return t[236]!==gn||t[237]!==Ye?(_n=(0,z.jsxs)(z.Fragment,{children:[Ye,gn]}),t[236]=gn,t[237]=Ye,t[238]=_n):_n=t[238],_n}function re(e){return!e}function ie(e){return e.preventDefault()}function V(e){return!!(e&&e.type===`object`&&e.properties&&!Array.isArray(e.properties))}function H(e){let t=e.properties??{},n=new Set(e.required??[]);return Object.entries(t).map(([e,t])=>({key:e,schema:t,required:n.has(e)}))}function U(e,t){return!V(e)||!e?!0:H(e).every(e=>{if(!e.required)return!0;let n=t[e.key];return n==null?!1:typeof n==`string`?n.trim().length>0:!0})}function W(e,t){if(e)return V(e.inputSchema)?Object.keys(t.schemaInput).length>0?t.schemaInput:void 0:E(t.argValues)}function ae(e,t,n){let r=a(t).workflows;if(!e)return r.noInputSummary;let i=j(e,t);if(V(e.inputSchema)&&Object.keys(n.schemaInput).length>0)return Object.entries(n.schemaInput).map(([e,t])=>`${e}: ${String(t)}`).join(` · `);let o=Object.values(n.argValues).map(e=>e.trim()).filter(Boolean),s=n.goal.trim()||i.description;return s&&o.unshift(s),o.length>0?o.join(` · `):r.noInputSummary}function G(e,t,n=!0){return e?n?V(e.inputSchema)?U(e.inputSchema,t.schemaInput)?{valid:!0}:{valid:!1,reason:`schema-required`}:{valid:(d[e.name]??[]).every(e=>!e.required||!!t.argValues[e.key]?.trim())}:{valid:!1,reason:`raw-json`}:{valid:!1}}function K(e,t){return e[t]??t}function oe(e,t){let n=d[e]??[];if(n.length===0)return{};let r=t&&typeof t==`object`&&!Array.isArray(t)?t:{},i={};for(let e of n){let t=r[e.key];t!=null&&(i[e.key]=String(t))}return i}function se(e){let t=(0,P.c)(12),{examples:n,labels:r,onSelect:i}=e;if(n.length===0)return null;let a;t[0]===r.examplePrompts?a=t[1]:(a=(0,z.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:r.examplePrompts}),t[0]=r.examplePrompts,t[1]=a);let o;if(t[2]!==n||t[3]!==i){let e;t[5]===i?e=t[6]:(e=e=>(0,z.jsx)(`button`,{type:`button`,onClick:()=>i(e),className:`rounded-lg border border-edge bg-surface-base/50 px-3 py-2 text-left text-xs text-fg-muted hover:bg-surface-hover`,children:e.text},`${e.field}:${e.text}`),t[5]=i,t[6]=e),o=n.map(e),t[2]=n,t[3]=i,t[4]=o}else o=t[4];let s;t[7]===o?s=t[8]:(s=(0,z.jsx)(`div`,{className:`mt-2 flex flex-col gap-1.5`,children:o}),t[7]=o,t[8]=s);let c;return t[9]!==a||t[10]!==s?(c=(0,z.jsxs)(`div`,{children:[a,s]}),t[9]=a,t[10]=s,t[11]=c):c=t[11],c}function ce(e){let t=(0,P.c)(34),{workflowName:n,language:r,argValues:o,onArgValuesChange:s,goal:c,onGoalChange:l,examplePrompts:u,showGoal:f,inputClassName:p,aiAssist:m}=e,h;t[0]===u?h=t[1]:(h=u===void 0?[]:u,t[0]=u,t[1]=h);let g=h,_=f===void 0?!0:f,v,y,b,x,S,C,w;if(t[2]!==m||t[3]!==o||t[4]!==g||t[5]!==c||t[6]!==p||t[7]!==r||t[8]!==s||t[9]!==l||t[10]!==_||t[11]!==n){b=a(r).workflows;let e=d[n]??[];y=e.length>0;let u=i(`mt-1.5 w-full rounded-xl border border-edge bg-surface-base px-3 py-2 text-sm text-fg outline-none placeholder:text-fg-subtle focus:border-accent focus:ring-2 focus:ring-accent/20`,p),f;t[19]!==o||t[20]!==s||t[21]!==l?(f=e=>{T(e,l,e=>{s(e(o))})},t[19]=o,t[20]=s,t[21]=l,t[22]=f):f=t[22],v=f,x=`flex flex-col gap-3`,S=e.map(e=>{let t=K(b.args,e.labelKey),a=K(b.args,e.placeholderKey),c=o[e.key]??``;return(0,z.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,z.jsxs)(`span`,{className:`flex items-center justify-between gap-2`,children:[(0,z.jsxs)(`span`,{className:`text-xs font-medium text-fg-muted`,children:[t,e.required?` *`:``]}),e.multiline&&m?(0,z.jsx)(B,{value:c,onApply:t=>s({...o,[e.key]:t}),fieldId:`workflow.arg.${e.key}`,fieldLabel:t,scenario:m.argScenario??`workflow.arg`,locale:r,context:{...m.context,workflowName:n,workflowArgs:o,fieldKey:e.key},disabled:m.disabled,showLabel:!1}):null]}),e.multiline?(0,z.jsx)(`textarea`,{value:c,onChange:t=>s({...o,[e.key]:t.target.value}),placeholder:a,className:i(u,`min-h-20 resize-y`)}):(0,z.jsx)(`input`,{value:c,onChange:t=>s({...o,[e.key]:t.target.value}),placeholder:a,className:u})]},e.key)}),C=y&&g.length>0?(0,z.jsx)(se,{examples:g,labels:b,onSelect:v}):null,w=_?(0,z.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,z.jsxs)(`span`,{className:`flex items-center justify-between gap-2`,children:[(0,z.jsx)(`span`,{className:`text-xs font-medium text-fg-muted`,children:b.goalLabel}),m?(0,z.jsx)(B,{value:c,onApply:l,fieldId:`workflow.goal`,fieldLabel:b.goalLabel,scenario:m.goalScenario??`cron.workflowGoal`,locale:r,context:{...m.context,workflowName:n,workflowArgs:o},disabled:m.disabled,showLabel:!1}):null]}),(0,z.jsx)(`textarea`,{value:c,onChange:e=>l(e.target.value),placeholder:b.goalPlaceholder,className:i(u,`min-h-20 resize-y`)})]}):null,t[2]=m,t[3]=o,t[4]=g,t[5]=c,t[6]=p,t[7]=r,t[8]=s,t[9]=l,t[10]=_,t[11]=n,t[12]=v,t[13]=y,t[14]=b,t[15]=x,t[16]=S,t[17]=C,t[18]=w}else v=t[12],y=t[13],b=t[14],x=t[15],S=t[16],C=t[17],w=t[18];let E;t[23]!==v||t[24]!==g||t[25]!==y||t[26]!==b?(E=!y&&g.length>0?(0,z.jsx)(se,{examples:g,labels:b,onSelect:v}):null,t[23]=v,t[24]=g,t[25]=y,t[26]=b,t[27]=E):E=t[27];let D;return t[28]!==x||t[29]!==S||t[30]!==C||t[31]!==w||t[32]!==E?(D=(0,z.jsxs)(`div`,{className:x,children:[S,C,w,E]}),t[28]=x,t[29]=S,t[30]=C,t[31]=w,t[32]=E,t[33]=D):D=t[33],D}var q=`mt-1.5 w-full rounded-xl border border-edge bg-surface-base px-3 py-2 text-sm text-fg outline-none placeholder:text-fg-subtle focus:border-accent focus:ring-2 focus:ring-accent/20`;function le({schema:e,value:t,onChange:n,labels:r,aiAssist:a,onValidChange:o}){let s=(0,N.useMemo)(()=>H(e),[e]),[c,l]=(0,N.useState)(!1),[u,d]=(0,N.useState)(()=>JSON.stringify(t,null,2)),[f,p]=(0,N.useState)(null);if(s.length===0)return null;let m=(e,r)=>{let i={...t,[e]:r};(r===``||r===void 0)&&delete i[e],n(i),c&&d(JSON.stringify(i,null,2))},h=e=>{d(e);try{let t=e.trim()?JSON.parse(e):{};if(!t||typeof t!=`object`||Array.isArray(t)){p(r.rawJsonInvalid),o?.(!1);return}p(null),n(t),o?.(!0,t)}catch{p(r.rawJsonInvalid),o?.(!1)}};return(0,z.jsxs)(`section`,{className:`rounded-2xl bg-surface-panel/70 p-4 shadow-surface`,children:[(0,z.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,z.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:r.inputSchemaHeading}),(0,z.jsx)(`button`,{type:`button`,className:`text-xs font-medium text-accent-fg hover:underline`,onClick:()=>{let e=!c;l(e),e&&(d(JSON.stringify(t,null,2)),p(null),o?.(!0))},children:r.rawJson})]}),c?(0,z.jsxs)(`div`,{className:`mt-3`,children:[(0,z.jsx)(`textarea`,{value:u,onChange:e=>h(e.target.value),spellCheck:!1,className:i(q,`min-h-40 font-mono text-xs leading-5`)}),f?(0,z.jsx)(`p`,{className:`mt-1 text-xs text-red-600 dark:text-red-300`,children:f}):null]}):(0,z.jsx)(`div`,{className:`mt-3 grid gap-3`,children:s.map(e=>(0,z.jsx)(ue,{field:e,value:t[e.key],labels:r,aiAssist:a,allValues:t,onChange:t=>m(e.key,t)},e.key))})]})}function ue(e){let t=(0,P.c)(30),{field:n,value:r,labels:a,aiAssist:o,allValues:s,onChange:c}=e,l=n.schema.title||n.key,u=typeof n.schema.description==`string`?n.schema.description:void 0,d=Array.isArray(n.schema.type)?n.schema.type[0]:n.schema.type,p;t[0]===n.schema.enum?p=t[1]:(p=Array.isArray(n.schema.enum)?n.schema.enum:[],t[0]=n.schema.enum,t[1]=p);let m=p,h=!!o&&!m.length&&(d===`string`||!d),g=String(l),_=n.required?` *`:``,v;t[2]!==g||t[3]!==_?(v=(0,z.jsxs)(`span`,{className:`text-xs font-medium text-fg`,children:[g,_]}),t[2]=g,t[3]=_,t[4]=v):v=t[4];let y;t[5]!==o||t[6]!==s||t[7]!==n.key||t[8]!==n.schema||t[9]!==c||t[10]!==h||t[11]!==l||t[12]!==r?(y=h&&o?(0,z.jsx)(B,{value:typeof r==`string`?r:r==null?``:String(r),onApply:c,fieldId:`workflow.schema.${n.key}`,fieldLabel:String(l),scenario:o.scenario??`workflow.arg`,locale:o.locale,context:{...o.context,fieldKey:n.key,fieldSchema:n.schema,inputValues:s},disabled:o.disabled,showLabel:!1}):null,t[5]=o,t[6]=s,t[7]=n.key,t[8]=n.schema,t[9]=c,t[10]=h,t[11]=l,t[12]=r,t[13]=y):y=t[13];let x;t[14]!==v||t[15]!==y?(x=(0,z.jsxs)(`span`,{className:`flex items-center justify-between gap-2`,children:[v,y]}),t[14]=v,t[15]=y,t[16]=x):x=t[16];let S;t[17]===u?S=t[18]:(S=u?(0,z.jsx)(`p`,{className:`mt-0.5 text-xs leading-5 text-fg-subtle`,children:u}):null,t[17]=u,t[18]=S);let C;t[19]!==u||t[20]!==m||t[21]!==a||t[22]!==c||t[23]!==d||t[24]!==r?(C=m.length>0?(0,z.jsxs)(b,{value:r==null?``:String(r),onChange:e=>c(e.target.value),className:q,children:[(0,z.jsx)(f,{value:``}),m.map(de)]}):d===`boolean`?(0,z.jsxs)(b,{value:typeof r==`boolean`?String(r):``,onChange:e=>c(e.target.value===``?void 0:e.target.value===`true`),className:q,children:[(0,z.jsx)(f,{value:``}),(0,z.jsx)(f,{value:`true`,children:a.booleanTrue}),(0,z.jsx)(f,{value:`false`,children:a.booleanFalse})]}):d===`number`||d===`integer`?(0,z.jsx)(`input`,{type:`number`,value:typeof r==`number`||typeof r==`string`?String(r):``,onChange:e=>c(e.target.value===``?void 0:Number(e.target.value)),className:q}):(0,z.jsx)(`textarea`,{value:typeof r==`string`?r:r==null?``:String(r),onChange:e=>c(e.target.value),className:i(q,u&&u.length>80?`min-h-20 resize-y`:`min-h-10 resize-y`)}),t[19]=u,t[20]=m,t[21]=a,t[22]=c,t[23]=d,t[24]=r,t[25]=C):C=t[25];let w;return t[26]!==x||t[27]!==S||t[28]!==C?(w=(0,z.jsxs)(`div`,{className:`block`,children:[x,S,C]}),t[26]=x,t[27]=S,t[28]=C,t[29]=w):w=t[29],w}function de(e){return(0,z.jsx)(f,{value:String(e),children:String(e)},String(e))}function J(e){let t=(0,P.c)(12),{examples:n,labels:r,onSelect:i}=e;if(n.length===0)return null;let a;t[0]===r.examplePrompts?a=t[1]:(a=(0,z.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:r.examplePrompts}),t[0]=r.examplePrompts,t[1]=a);let o;if(t[2]!==n||t[3]!==i){let e;t[5]===i?e=t[6]:(e=e=>(0,z.jsx)(`button`,{type:`button`,onClick:()=>i(e),className:`rounded-lg border border-edge bg-surface-base/50 px-3 py-2 text-left text-xs text-fg-muted hover:bg-surface-hover`,children:e.text},`${e.field}:${e.text}`),t[5]=i,t[6]=e),o=n.map(e),t[2]=n,t[3]=i,t[4]=o}else o=t[4];let s;t[7]===o?s=t[8]:(s=(0,z.jsx)(`div`,{className:`mt-2 flex flex-col gap-1.5`,children:o}),t[7]=o,t[8]=s);let c;return t[9]!==a||t[10]!==s?(c=(0,z.jsxs)(`div`,{children:[a,s]}),t[9]=a,t[10]=s,t[11]=c):c=t[11],c}function Y(e){let t=(0,P.c)(114),{definition:n,language:r,value:o,onChange:s,aiAssist:c,inputClassName:l,onValidityChange:u}=e,d;t[0]===r?d=t[1]:(d=a(r),t[0]=r,t[1]=d);let f=d.workflows,p;t[2]!==n||t[3]!==r?(p=j(n,r),t[2]=n,t[3]=r,t[4]=p):p=t[4];let m=p,[h,g]=(0,N.useState)(!0),_;t[5]===m.examplePrompts?_=t[6]:(_=m.examplePrompts??[],t[5]=m.examplePrompts,t[6]=_);let v=_,y;t[7]===n.inputSchema?y=t[8]:(y=V(n.inputSchema),t[7]=n.inputSchema,t[8]=y);let b=y,x,S,C,w,T,E,D,O,k,A;if(t[9]!==c||t[10]!==n||t[11]!==v||t[12]!==b||t[13]!==l||t[14]!==f||t[15]!==r||t[16]!==m.description||t[17]!==s||t[18]!==u||t[19]!==h||t[20]!==o){T=Symbol.for(`react.early_return_sentinel`);bb0:{let e=i(`mt-1.5 w-full rounded-xl border border-edge bg-surface-base px-3 py-2 text-sm text-fg outline-none placeholder:text-fg-subtle focus:border-accent focus:ring-2 focus:ring-accent/20`,l),a;t[31]!==n||t[32]!==s||t[33]!==u||t[34]!==h?(a=(e,t)=>{let r=t===void 0?h:t;s(e),u?.(G(n,e,r))},t[31]=n,t[32]=s,t[33]=u,t[34]=h,t[35]=a):a=t[35];let d=a,p;t[36]!==d||t[37]!==o?(p=e=>d({...o,goal:e}),t[36]=d,t[37]=o,t[38]=p):p=t[38];let _=p,y;t[39]!==d||t[40]!==o?(y=e=>d({...o,schemaInput:e}),t[39]=d,t[40]=o,t[41]=y):y=t[41];let j=y,M;t[42]!==d||t[43]!==o?(M=e=>d({...o,argValues:e}),t[42]=d,t[43]=o,t[44]=M):M=t[44];let N=M,P;if(t[45]!==_||t[46]!==j||t[47]!==o.schemaInput?(P=e=>{if(e.field===`goal`){_(e.text);return}j({...o.schemaInput,[e.field]:e.text})},t[45]=_,t[46]=j,t[47]=o.schemaInput,t[48]=P):P=t[48],x=P,!b){let e;t[49]!==c||t[50]!==n.id||t[51]!==n.name||t[52]!==n.title||t[53]!==m.description?(e=c?{disabled:c.disabled,argScenario:c.inputScenario??`workflow.arg`,goalScenario:c.goalScenario??`workflow.goal`,context:{...c.context,workflowId:n.id,workflowName:n.name,workflowTitle:n.title,workflowDescription:m.description}}:void 0,t[49]=c,t[50]=n.id,t[51]=n.name,t[52]=n.title,t[53]=m.description,t[54]=e):e=t[54];let i;t[55]!==n.name||t[56]!==v||t[57]!==l||t[58]!==r||t[59]!==N||t[60]!==_||t[61]!==e||t[62]!==o.argValues||t[63]!==o.goal?(i=(0,z.jsx)(ce,{workflowName:n.name,language:r,argValues:o.argValues,onArgValuesChange:N,goal:o.goal,onGoalChange:_,examplePrompts:v,inputClassName:l,aiAssist:e}),t[55]=n.name,t[56]=v,t[57]=l,t[58]=r,t[59]=N,t[60]=_,t[61]=e,t[62]=o.argValues,t[63]=o.goal,t[64]=i):i=t[64],T=i;break bb0}C=`flex flex-col gap-3`,t[65]!==c||t[66]!==n||t[67]!==f.booleanFalse||t[68]!==f.booleanTrue||t[69]!==f.inputSchemaHeading||t[70]!==f.rawJson||t[71]!==f.rawJsonInvalid||t[72]!==r||t[73]!==m.description||t[74]!==u||t[75]!==j||t[76]!==o?(w=n.inputSchema?(0,z.jsx)(le,{schema:n.inputSchema,value:o.schemaInput,onChange:j,onValidChange:(e,t)=>{g(e),u?.(G(n,t?{...o,schemaInput:t}:o,e))},aiAssist:c?{locale:r,disabled:c.disabled,scenario:c.inputScenario??`workflow.arg`,context:{...c.context,workflowId:n.id,workflowName:n.name,workflowTitle:n.title,workflowDescription:m.description}}:void 0,labels:{inputSchemaHeading:f.inputSchemaHeading,rawJson:f.rawJson,rawJsonInvalid:f.rawJsonInvalid,booleanTrue:f.booleanTrue,booleanFalse:f.booleanFalse}}):null,t[65]=c,t[66]=n,t[67]=f.booleanFalse,t[68]=f.booleanTrue,t[69]=f.inputSchemaHeading,t[70]=f.rawJson,t[71]=f.rawJsonInvalid,t[72]=r,t[73]=m.description,t[74]=u,t[75]=j,t[76]=o,t[77]=w):w=t[77],A=`flex flex-col gap-1`;let F;t[78]===f.goalLabel?F=t[79]:(F=(0,z.jsx)(`span`,{className:`text-xs font-medium text-fg-muted`,children:f.goalLabel}),t[78]=f.goalLabel,t[79]=F);let I;t[80]!==c||t[81]!==n.id||t[82]!==n.name||t[83]!==n.title||t[84]!==f.goalLabel||t[85]!==r||t[86]!==m.description||t[87]!==_||t[88]!==o.goal||t[89]!==o.schemaInput?(I=c?(0,z.jsx)(B,{value:o.goal,onApply:_,fieldId:`workflow.goal`,fieldLabel:f.goalLabel,scenario:c.goalScenario??`workflow.goal`,locale:r,context:{...c.context,workflowId:n.id,workflowName:n.name,workflowTitle:n.title,workflowDescription:m.description,workflowInput:o.schemaInput},disabled:c.disabled,showLabel:!1}):null,t[80]=c,t[81]=n.id,t[82]=n.name,t[83]=n.title,t[84]=f.goalLabel,t[85]=r,t[86]=m.description,t[87]=_,t[88]=o.goal,t[89]=o.schemaInput,t[90]=I):I=t[90],t[91]!==F||t[92]!==I?(S=(0,z.jsxs)(`span`,{className:`flex items-center justify-between gap-2`,children:[F,I]}),t[91]=F,t[92]=I,t[93]=S):S=t[93],E=o.goal,t[94]===_?D=t[95]:(D=e=>_(e.target.value),t[94]=_,t[95]=D),O=f.goalPlaceholder,k=i(e,`min-h-20 resize-y`)}t[9]=c,t[10]=n,t[11]=v,t[12]=b,t[13]=l,t[14]=f,t[15]=r,t[16]=m.description,t[17]=s,t[18]=u,t[19]=h,t[20]=o,t[21]=x,t[22]=S,t[23]=C,t[24]=w,t[25]=T,t[26]=E,t[27]=D,t[28]=O,t[29]=k,t[30]=A}else x=t[21],S=t[22],C=t[23],w=t[24],T=t[25],E=t[26],D=t[27],O=t[28],k=t[29],A=t[30];if(T!==Symbol.for(`react.early_return_sentinel`))return T;let M;t[96]!==E||t[97]!==D||t[98]!==O||t[99]!==k?(M=(0,z.jsx)(`textarea`,{value:E,onChange:D,placeholder:O,className:k}),t[96]=E,t[97]=D,t[98]=O,t[99]=k,t[100]=M):M=t[100];let F;t[101]!==S||t[102]!==M||t[103]!==A?(F=(0,z.jsxs)(`div`,{className:A,children:[S,M]}),t[101]=S,t[102]=M,t[103]=A,t[104]=F):F=t[104];let I;t[105]!==x||t[106]!==v||t[107]!==f?(I=(0,z.jsx)(J,{examples:v,labels:f,onSelect:x}),t[105]=x,t[106]=v,t[107]=f,t[108]=I):I=t[108];let L;return t[109]!==C||t[110]!==w||t[111]!==F||t[112]!==I?(L=(0,z.jsxs)(`div`,{className:C,children:[w,F,I]}),t[109]=C,t[110]=w,t[111]=F,t[112]=I,t[113]=L):L=t[113],L}function X(e,t){let n=e.metadata.estimatedAgents;return n?n.min===n.max?m(t.agentScaleExact,{count:n.min}):m(t.agentScaleRange,{min:n.min,max:n.max}):m(t.agentScaleExact,{count:e.defaults.maxSubagents})}function fe(e){let t=(0,P.c)(41),{definition:n,language:r,value:o,onChange:s,mode:l,badgeLabel:d,aiAssist:f,inputClassName:p,showTimeout:h,defaultAdvancedOpen:g,onValidityChange:_}=e,v=h===void 0?!1:h,b=g===void 0?!1:g,S=a(r).workflows,[C,w]=(0,N.useState)(b),T;t[0]!==n||t[1]!==r?(T=j(n,r),t[0]=n,t[1]=r,t[2]=T):T=t[2];let E=T,D;t[3]!==n.defaults||t[4]!==o.concurrency?(D=o.concurrency.trim()?Number(o.concurrency):n.defaults.concurrency,t[3]=n.defaults,t[4]=o.concurrency,t[5]=D):D=t[5];let O=D,A;t[6]!==n.defaults||t[7]!==o.maxSubagents?(A=o.maxSubagents.trim()?Number(o.maxSubagents):n.defaults.maxSubagents,t[6]=n.defaults,t[7]=o.maxSubagents,t[8]=A):A=t[8];let M=A,F;t[9]!==n||t[10]!==r||t[11]!==o?(F=ae(n,r,o),t[9]=n,t[10]=r,t[11]=o,t[12]=F):F=t[12];let I=F,L=d??S.readyToStart,R;t[13]!==s||t[14]!==o?(R=e=>s({...o,...e}),t[13]=s,t[14]=o,t[15]=R):R=t[15];let ee=R,te=l===`automation`&&`rounded-xl bg-surface-panel/70 p-3 shadow-surface`,ne;t[16]===te?ne=t[17]:(ne=i(`space-y-4`,te),t[16]=te,t[17]=ne);let B=I||E.description,re;t[18]===B?re=t[19]:(re=(0,z.jsx)(`p`,{className:`mt-1 line-clamp-2 text-xs leading-5 text-fg-muted`,children:B}),t[18]=B,t[19]=re);let ie;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(ie=(0,z.jsx)(c,{className:`size-3.5 shrink-0 text-fg-subtle`,"aria-hidden":!0}),t[20]=ie):ie=t[20];let V;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(V=(0,z.jsx)(u,{className:`size-3.5 shrink-0 text-fg-subtle`,"aria-hidden":!0}),t[21]=V):V=t[21];let H;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(H=(0,z.jsx)(x,{className:`size-3.5 shrink-0 text-fg-subtle`,"aria-hidden":!0}),t[22]=H):H=t[22];let U;t[23]!==s||t[24]!==o?(U=e=>s({...o,...e}),t[23]=s,t[24]=o,t[25]=U):U=t[25];let W;t[26]===_?W=t[27]:(W=e=>{_?.(e)},t[26]=_,t[27]=W);let G;t[28]!==f||t[29]!==n||t[30]!==p||t[31]!==r||t[32]!==U||t[33]!==W||t[34]!==o?(G=(0,z.jsx)(Y,{definition:n,language:r,value:o,onChange:U,onValidityChange:W,aiAssist:f,inputClassName:p}),t[28]=f,t[29]=n,t[30]=p,t[31]=r,t[32]=U,t[33]=W,t[34]=o,t[35]=G):G=t[35];let K;t[36]===Symbol.for(`react.memo_cache_sentinel`)?(K=()=>w(pe),t[36]=K):K=t[36];let oe=S.advancedSettings,se=C&&`rotate-180`,ce;t[37]===se?ce=t[38]:(ce=i(`size-4 transition-transform`,se),t[37]=se,t[38]=ce);let q;return t[39]===ce?q=t[40]:(q=(0,z.jsx)(k,{className:ce}),t[39]=ce,t[40]=q),(0,z.jsxs)(`div`,{className:ne,children:[(0,z.jsxs)(`section`,{className:`rounded-2xl bg-surface-panel p-4 shadow-surface`,children:[(0,z.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,z.jsxs)(`div`,{className:`min-w-0`,children:[(0,z.jsx)(`h3`,{className:`truncate text-sm font-semibold text-fg`,children:S.runPlanPreview}),re]}),(0,z.jsx)(`span`,{className:`shrink-0 rounded-full bg-accent-soft px-2 py-1 text-[11px] font-medium text-accent-fg`,children:L})]}),(0,z.jsxs)(`div`,{className:`mt-4 grid gap-2 text-xs text-fg-muted sm:grid-cols-3`,children:[(0,z.jsxs)(`div`,{className:`flex items-center gap-2 rounded-xl bg-surface-panel px-2.5 py-2`,children:[ie,(0,z.jsx)(`span`,{children:m(S.phaseCount,{count:n.phases.length})})]}),(0,z.jsxs)(`div`,{className:`flex items-center gap-2 rounded-xl bg-surface-panel px-2.5 py-2`,children:[V,(0,z.jsx)(`span`,{children:X(n,S)})]}),(0,z.jsxs)(`div`,{className:`flex items-center gap-2 rounded-xl bg-surface-panel px-2.5 py-2`,children:[H,(0,z.jsx)(`span`,{children:m(S.runLimitsSummary,{concurrency:O,max:M})})]})]}),n.phases.length>0?(0,z.jsxs)(`div`,{className:`mt-4`,children:[(0,z.jsxs)(`div`,{className:`flex items-center gap-2 text-[11px] font-medium uppercase tracking-wide text-fg-subtle`,children:[(0,z.jsx)(y,{className:`size-3.5`,"aria-hidden":!0}),S.startPlanPhases]}),(0,z.jsx)(`div`,{className:`mt-2 flex flex-wrap items-center gap-1.5`,children:n.phases.map(me)})]}):null]}),G,(0,z.jsxs)(`div`,{className:`rounded-xl border border-edge`,children:[(0,z.jsxs)(`button`,{type:`button`,className:`flex w-full items-center justify-between px-3 py-2.5 text-left text-sm text-fg`,onClick:K,children:[oe,q]}),C?(0,z.jsxs)(`div`,{className:`grid gap-3 border-t border-edge px-3 pb-3 pt-3 sm:grid-cols-2`,children:[(0,z.jsx)(`input`,{value:o.concurrency,onChange:e=>ee({concurrency:e.target.value}),placeholder:m(S.concurrencyPlaceholder,{default:n.defaults.concurrency}),inputMode:`numeric`,className:`rounded-xl border border-edge bg-surface-base px-3 py-2 text-sm text-fg outline-none placeholder:text-fg-subtle focus:border-accent focus:ring-2 focus:ring-accent/20`}),(0,z.jsx)(`input`,{value:o.maxSubagents,onChange:e=>ee({maxSubagents:e.target.value}),placeholder:m(S.maxSubagentsPlaceholder,{default:n.defaults.maxSubagents}),inputMode:`numeric`,className:`rounded-xl border border-edge bg-surface-base px-3 py-2 text-sm text-fg outline-none placeholder:text-fg-subtle focus:border-accent focus:ring-2 focus:ring-accent/20`}),v?(0,z.jsx)(`input`,{value:o.timeoutSeconds??``,onChange:e=>ee({timeoutSeconds:e.target.value}),placeholder:m(S.timeoutSecondsPlaceholder,{default:n.defaults.timeoutSec}),inputMode:`numeric`,className:`rounded-xl border border-edge bg-surface-base px-3 py-2 text-sm text-fg outline-none placeholder:text-fg-subtle focus:border-accent focus:ring-2 focus:ring-accent/20`}):null]}):null]})]})}function pe(e){return!e}function me(e,t){return(0,z.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[t>0?(0,z.jsx)(`span`,{className:`text-fg-subtle`,children:`→`}):null,(0,z.jsx)(`span`,{className:`rounded-lg border border-edge-subtle bg-surface-panel px-2 py-1 text-[11px] text-fg-muted`,children:e.title})]},e.id)}export{B as a,G as i,oe as n,W as r,fe as t};
|
package/dist/gateway/static/root/assets/{workflows-page-Bp5JxQJa.js → workflows-page-Ba5fVQWY.js}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{d as i,f as a,l as o,t as s}from"./chunk-KS7C4IRE-BMhrPKJC.js";import{t as c}from"./check-DUBLcKHA.js";import{t as l}from"./cn-JdwAhgNB.js";import{t as u}from"./copy-to-clipboard-HOJ79TWv.js";import{t as d}from"./messages-DQ5X6cXp.js";import{l as f,n as p}from"./locale-store-Bjvw7jtg.js";import{i as m}from"./vendor-swr-BIWyz7Rc.js";import{$ as h,$c as g,A as _,B as v,Bc as y,C as b,Cs as x,Da as S,Ds as C,E as w,F as T,Go as E,H as D,I as O,J as k,K as A,Kc as j,L as M,La as N,Ll as P,M as F,N as I,Ni as L,Ns as R,P as z,Pc as B,Pl as V,Ps as H,Q as U,R as W,Rl as G,S as ee,Su as te,T as K,U as ne,Uo as q,V as re,W as ie,Wo as ae,X as oe,Xl as se,Y as ce,Yc as le,Z as J,Zc as ue,_ as de,_c as fe,_s as Y,ac as pe,b as me,bs as he,cl as ge,ct as _e,d as ve,dr as ye,ds as be,f as xe,fu as X,g as Se,h as Ce,hc as we,hl as Te,i as Ee,ic as De,it as Oe,iu as ke,jl as Ae,lt as je,m as Me,ot as Ne,ou as Pe,p as Fe,q as Ie,qs as Le,rl as Re,rt as ze,sc as Be,st as Ve,tt as He,u as Ue,ut as We,uu as Ge,v as Ke,vr as qe,w as Je,x as Ye,xc as Xe,y as Ze,yi as Qe,z as $e}from"./index-BpkdvHH0.js";import{t as et}from"./page-tabs-CROi9zm1.js";import{i as tt,r as nt,t as rt}from"./workflow-run-setup-panel-BK6e9yzK.js";import{a as it,c as at,i as ot,l as st,n as ct,o as lt,r as ut,s as dt,t as ft}from"./style-TIDOdKy0.js";var Z=e(t(),1),Q=n(),pt=[`queued`,`running`,`succeeded`,`attention`],mt=new Set([`failed`,`timeout`,`cancelled`]);function ht(e){return e.metadata?.sessionKey?.trim()||null}function gt(e,t){return e.length<=t?e:`${e.slice(0,t-1)}…`}function _t(e,t){if(!e||typeof e!=`object`)return null;let n=e;for(let e of t){let t=n[e];if(typeof t==`string`&&t.trim())return t.trim()}return null}function vt(e,t=90){let n=e.metadata?.input?.goal?.trim()||(typeof e.metadata?.input?.payload==`string`?e.metadata.input.payload.trim():null)||_t(e.metadata?.input?.payload,[`query`,`goal`,`prompt`,`input`,`message`])||_t(e.metadata?.input?.variables,[`query`,`goal`,`prompt`,`input`,`message`]);return n?gt(n,t):null}function yt(e,t=90){return vt(e,t)??gt(e.title?.trim()||e.definitionId,t)}function bt(e,t=44){return gt(e.title?.trim()||e.definitionId,t)}function xt(e,t){let n=t.trim().toLowerCase();return n?[vt(e,500),e.title,e.definitionId,e.id].filter(Boolean).join(` `).toLowerCase().includes(n):!0}function St(e,t){let n=t.workflowFilterId.trim();return e.filter(e=>n&&e.definitionId!==n||!$e(e,t.triggerFilter??`all`)?!1:xt(e,t.searchQuery))}function Ct(e){return e.completedAtMs??e.createdAtMs}function wt(e,t){return e.status===`queued`?`queued`:e.status===`running`?`running`:e.status===`succeeded`?`succeeded`:mt.has(e.status)?`attention`:null}function Tt(e,t){let n=[...t];return e===`queued`?n.sort((e,t)=>e.createdAtMs-t.createdAtMs):e===`running`?n.sort((e,t)=>(t.startedAtMs??t.createdAtMs)-(e.startedAtMs??e.createdAtMs)):n.sort((e,t)=>Ct(t)-Ct(e))}function Et(e,t){let n={queued:[],running:[],succeeded:[],attention:[]};for(let r of e){let e=wt(r,t);e&&n[e].push(r)}return pt.map(e=>{if(e===`succeeded`){let t=Tt(`succeeded`,n.succeeded);return{id:e,runs:t,totalInWindow:t.length}}return{id:e,runs:Tt(e,n[e])}})}function Dt(e,t,n){let r=Math.round((t-e)/1e3);if(r<60)return Oe(-r,`second`,n);let i=Math.round(r/60);if(i<60)return Oe(-i,`minute`,n);let a=Math.round(i/60);return a<48?Oe(-a,`hour`,n):Oe(-Math.round(a/24),`day`,n)}function Ot(e){return e.status===`queued`||e.status===`running`}function kt(e){return e.status===`failed`||e.status===`timeout`||e.status===`cancelled`}var $=r(),At=(0,Z.memo)(function(e){let t=(0,Q.c)(76),{run:n,language:r,localeTag:i,nowMs:a,selected:o,onOpen:s,onOpenChat:c,onCancel:u,onRetry:f}=e,p=d(r).workflows,[m,h]=(0,Z.useState)(!1),g;t[0]===n?g=t[1]:(g=ht(n),t[0]=n,t[1]=g);let _=!g,y;t[2]===n?y=t[3]:(y=Ot(n),t[2]=n,t[3]=y);let b=y,x=n.status===`running`||n.status===`queued`,S;t[4]!==n.metrics.agentCount||t[5]!==n.metrics.doneAgentCount?(S=n.metrics.agentCount>0?Math.round(n.metrics.doneAgentCount/n.metrics.agentCount*100):0,t[4]=n.metrics.agentCount,t[5]=n.metrics.doneAgentCount,t[6]=S):S=t[6];let C=S,w=n.metrics.errorAgentCount>0,T=n.startedAtMs??n.createdAtMs,E=z(b?a-T:n.metrics.durationMs),D=O(p.taskArtifacts,{count:n.metrics.artifactCount}),k;t[7]===n?k=t[8]:(k=yt(n),t[7]=n,t[8]=k);let A=k,j;t[9]===n?j=t[10]:(j=bt(n),t[9]=n,t[10]=j);let M=j,N;t[11]!==s||t[12]!==n?(N=()=>{s(n)},t[11]=s,t[12]=n,t[13]=N):N=t[13];let P=N,F;t[14]!==_||t[15]!==c||t[16]!==n?(F=()=>{_||c(n)},t[14]=_,t[15]=c,t[16]=n,t[17]=F):F=t[17];let I=F,L=o&&`ring-1 ring-accent/30`,B;t[18]===L?B=t[19]:(B=l(`group relative min-h-24 overflow-hidden rounded-lg bg-surface-panel p-3 shadow-surface transition-colors`,L,`hover:bg-surface-hover`),t[18]=L,t[19]=B);let V;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(V=l(`w-full text-left`,be.focusRingPanel),t[20]=V):V=t[20];let H;t[21]===A?H=t[22]:(H=(0,$.jsx)(`div`,{className:`line-clamp-2 text-sm font-medium leading-5 text-fg`,children:A}),t[21]=A,t[22]=H);let U;t[23]===M?U=t[24]:(U=(0,$.jsx)(`div`,{className:`mt-1 truncate text-[11px] font-medium text-fg-muted`,children:M}),t[23]=M,t[24]=U);let W;t[25]!==H||t[26]!==U?(W=(0,$.jsxs)(`div`,{className:`min-w-0`,children:[H,U]}),t[25]=H,t[26]=U,t[27]=W):W=t[27];let G;t[28]===n.status?G=t[29]:(G=l(`shrink-0 rounded-full px-2 py-0.5 text-[10px] font-semibold shadow-sm`,v(n.status)),t[28]=n.status,t[29]=G);let ee;t[30]!==i||t[31]!==a||t[32]!==T?(ee=Dt(T,a,i),t[30]=i,t[31]=a,t[32]=T,t[33]=ee):ee=t[33];let te;t[34]===ee?te=t[35]:(te=(0,$.jsx)(`span`,{children:ee}),t[34]=ee,t[35]=te);let K=E===`—`?null:(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`span`,{"aria-hidden":!0,children:`·`}),(0,$.jsx)(`span`,{children:O(p.taskElapsed,{duration:E})})]}),ne;t[36]!==te||t[37]!==K?(ne=(0,$.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-1.5 text-[11px] text-fg-subtle`,children:[te,K]}),t[36]=te,t[37]=K,t[38]=ne):ne=t[38];let q=n.metrics.artifactCount>0?(0,$.jsx)(`span`,{className:`rounded-full bg-surface-hover px-2 py-0.5 font-medium text-fg-muted`,children:D}):null,re=o?(0,$.jsx)(`span`,{className:`font-medium text-accent-fg`,children:p.taskOpenDetails}):null,ie;t[39]!==q||t[40]!==re?(ie=(0,$.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-2 text-[11px] text-fg-subtle`,children:[q,re]}),t[39]=q,t[40]=re,t[41]=ie):ie=t[41];let ae=_&&`cursor-not-allowed text-fg-disabled hover:bg-transparent`,oe;t[42]===ae?oe=t[43]:(oe=l(`rounded-md px-2 py-1 text-xs font-medium`,`text-accent-fg hover:bg-accent-soft`,be.focusRingPanel,ae),t[42]=ae,t[43]=oe);let se;t[44]!==_||t[45]!==I||t[46]!==p.continueInChat||t[47]!==oe?(se=(0,$.jsx)(`button`,{type:`button`,className:oe,disabled:_,onClick:I,children:p.continueInChat}),t[44]=_,t[45]=I,t[46]=p.continueInChat,t[47]=oe,t[48]=se):se=t[48];let ce;t[49]===Symbol.for(`react.memo_cache_sentinel`)?(ce=l(`rounded-md px-2 py-1 text-xs font-medium text-fg-muted hover:bg-surface-hover hover:text-fg`,be.focusRingPanel),t[49]=ce):ce=t[49];let le;t[50]!==P||t[51]!==p.taskOpenDetails?(le=(0,$.jsx)(`button`,{type:`button`,className:ce,onClick:P,children:p.taskOpenDetails}),t[50]=P,t[51]=p.taskOpenDetails,t[52]=le):le=t[52];let J;t[53]!==se||t[54]!==le?(J=(0,$.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-2 border-t border-edge-subtle pt-2`,children:[se,le]}),t[53]=se,t[54]=le,t[55]=J):J=t[55];let ue;t[56]===h?ue=t[57]:(ue=()=>h(Mt),t[56]=h,t[57]=ue);let de;t[58]===Symbol.for(`react.memo_cache_sentinel`)?(de=(0,$.jsx)(Ae,{className:`size-4`,"aria-hidden":!0}),t[58]=de):de=t[58];let fe;t[59]!==p.taskActionsAria||t[60]!==m||t[61]!==ue?(fe=(0,$.jsx)(Y,{variant:`ghost`,className:`size-7 p-0 opacity-0 group-hover:opacity-100 group-focus-within:opacity-100`,"aria-label":p.taskActionsAria,"aria-expanded":m,onClick:ue,children:de}),t[59]=p.taskActionsAria,t[60]=m,t[61]=ue,t[62]=fe):fe=t[62];let pe;t[63]!==b||t[64]!==p.cancel||t[65]!==p.rerun||t[66]!==p.taskCloseMenu||t[67]!==m||t[68]!==u||t[69]!==f||t[70]!==n||t[71]!==h?(pe=m?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`button`,{type:`button`,className:`fixed inset-0 z-10 cursor-default`,"aria-label":p.taskCloseMenu,onClick:()=>h(!1)}),(0,$.jsxs)(`div`,{className:`absolute right-0 z-20 mt-1 min-w-36 rounded-lg border border-edge bg-surface-panel py-1 shadow-surface`,children:[b?(0,$.jsx)(jt,{label:p.cancel,tone:`danger`,onClick:()=>{h(!1),u(n.id)}}):null,kt(n)?(0,$.jsx)(jt,{label:p.rerun,onClick:()=>{h(!1),f(n.id)}}):null]})]}):null,t[63]=b,t[64]=p.cancel,t[65]=p.rerun,t[66]=p.taskCloseMenu,t[67]=m,t[68]=u,t[69]=f,t[70]=n,t[71]=h,t[72]=pe):pe=t[72];let me;return t[73]!==fe||t[74]!==pe?(me=(0,$.jsxs)(`div`,{className:`absolute right-2 top-2`,children:[fe,pe]}),t[73]=fe,t[74]=pe,t[75]=me):me=t[75],(0,$.jsxs)(`div`,{className:B,children:[(0,$.jsxs)(`button`,{type:`button`,onClick:P,"aria-label":`${p.taskOpenDetails}: ${A}`,"aria-current":o?`true`:void 0,className:V,children:[(0,$.jsxs)(`div`,{className:`pr-7`,children:[(0,$.jsxs)(`div`,{className:`flex min-w-0 items-start justify-between gap-2`,children:[W,(0,$.jsx)(`span`,{className:G,children:p.status[n.status]??n.status})]}),ne]}),x?(0,$.jsxs)(`div`,{className:`mt-2.5`,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-2 text-[11px] text-fg-muted`,children:[(0,$.jsx)(`span`,{children:O(p.agentProgress,{done:n.metrics.doneAgentCount,total:n.metrics.agentCount})}),(0,$.jsxs)(`span`,{children:[C,`%`]})]}),(0,$.jsx)(`div`,{className:`mt-1.5 h-1.5 overflow-hidden rounded-full bg-surface-hover`,children:(0,$.jsx)(`div`,{className:`h-full rounded-full bg-accent transition-all`,style:{width:`${C}%`}})})]}):null,ie,w?(0,$.jsxs)(`div`,{className:`mt-2 flex items-center gap-1 text-[11px] text-amber-700 dark:text-amber-300`,children:[(0,$.jsx)(R,{className:`size-3 shrink-0`,"aria-hidden":!0}),O(p.runRowErrorSummary,{count:n.metrics.errorAgentCount})]}):null]}),J,me]})});function jt(e){let t=(0,Q.c)(8),{label:n,disabled:r,tone:i,onClick:a}=e,o=r?`cursor-not-allowed text-fg-subtle`:`text-fg hover:bg-surface-hover`,s=i===`danger`&&!r&&`text-red-600 dark:text-red-300`,c;t[0]!==o||t[1]!==s?(c=l(`block w-full px-3 py-1.5 text-left text-xs`,o,s),t[0]=o,t[1]=s,t[2]=c):c=t[2];let u;return t[3]!==r||t[4]!==n||t[5]!==a||t[6]!==c?(u=(0,$.jsx)(`button`,{type:`button`,disabled:r,onClick:a,className:c,children:n}),t[3]=r,t[4]=n,t[5]=a,t[6]=c,t[7]=u):u=t[7],u}function Mt(e){return!e}function Nt(e,t){return t.boardColumns[e]}var Pt=(0,Z.memo)(function(e){let t=(0,Q.c)(17),{column:n,language:r,localeTag:i,nowMs:a,selectedRunId:o,loading:s,onOpenRun:c,onOpenRunChat:u,onCancelRun:f,onRetryRun:p}=e,m=d(r).workflows,[h,g]=(0,Z.useState)(!1),_=n.id===`succeeded`,v=_?5:n.runs.length,y;t[0]!==v||t[1]!==n.runs||t[2]!==h||t[3]!==_?(y=_&&!h?n.runs.slice(0,v):n.runs,t[0]=v,t[1]=n.runs,t[2]=h,t[3]=_,t[4]=y):y=t[4];let b=y,x=_&&n.runs.length>5&&!h,S=_&&h,C;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(C=l(`flex max-h-full w-72 min-w-72 max-w-72 shrink-0 flex-col overflow-y-auto rounded-lg bg-surface-base shadow-surface`),t[5]=C):C=t[5];let w;t[6]===n.runs.length?w=t[7]:(w=(0,$.jsx)(`span`,{className:`shrink-0 text-xs text-fg-subtle`,children:n.runs.length}),t[6]=n.runs.length,t[7]=w);let T;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,$.jsx)(Ae,{className:`size-4 shrink-0 text-fg-subtle`,"aria-hidden":!0}),t[8]=T):T=t[8];let E=s&&b.length===0?(0,$.jsx)(Ft,{}):b.length===0?(0,$.jsx)(`div`,{className:`rounded-lg bg-surface-panel/70 px-3 py-6 text-center text-xs text-fg-subtle`,children:m.boardColumnEmpty}):b.map(e=>(0,$.jsx)(At,{run:e,language:r,localeTag:i,nowMs:a,selected:e.id===o,onOpen:c,onOpenChat:u,onCancel:f,onRetry:p},e.id)),D=x?(0,$.jsx)(Y,{variant:`ghost`,className:`h-8 w-full text-xs`,onClick:()=>g(!0),children:O(m.boardExpandSucceeded,{count:Math.min(n.runs.length,n.totalInWindow??n.runs.length)})}):null,k;t[9]!==S||t[10]!==m||t[11]!==g?(k=S?(0,$.jsx)(Y,{variant:`ghost`,className:`h-8 w-full text-xs`,onClick:()=>g(!1),children:m.boardCollapseSucceeded}):null,t[9]=S,t[10]=m,t[11]=g,t[12]=k):k=t[12];let A;return t[13]!==E||t[14]!==D||t[15]!==k?(A=(0,$.jsxs)(`div`,{className:`mx-2 mt-3 grid min-h-0 min-w-0 content-start gap-2 pb-2 pr-1 [scrollbar-gutter:stable]`,children:[E,D,k]}),t[13]=E,t[14]=D,t[15]=k,t[16]=A):A=t[16],(0,$.jsxs)(`section`,{className:C,"aria-label":Nt(n.id,m),children:[(0,$.jsxs)(`header`,{className:`flex shrink-0 items-center justify-between gap-2 p-3`,children:[(0,$.jsxs)(`div`,{className:`flex min-w-0 items-baseline gap-2`,children:[(0,$.jsx)(`h2`,{className:`truncate text-sm font-semibold text-fg`,children:Nt(n.id,m)}),w]}),T]}),A]})});function Ft(){let e=(0,Q.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,$.jsxs)(`article`,{className:`min-h-24 rounded-lg bg-surface-panel p-3 shadow-surface`,"aria-hidden":`true`,children:[(0,$.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,$.jsx)(S,{className:`size-4/5`}),(0,$.jsx)(S,{className:`mt-2 h-3 w-24`})]}),(0,$.jsx)(S,{className:`h-5 w-14 rounded-full`})]}),(0,$.jsx)(S,{className:`mt-3 h-3 w-2/3`}),(0,$.jsx)(S,{className:`mt-4 h-5 w-20 rounded-full`})]}),e[0]=t):t=e[0],t}function It(e){return e instanceof Element?!!e.closest(`a,button,input,select,textarea,[contenteditable="true"],[draggable="true"],[data-board-pan-skip="true"]`):!0}var Lt=(0,Z.memo)(function(e){let t=(0,Q.c)(54),{runs:n,language:r,localeTag:i,labels:a,searchQuery:o,workflowFilterId:s,triggerFilter:c,selectedRunId:l,loading:u,onOpenRun:d,onOpenRunChat:f,onCancelRun:p,onRetryRun:m,onStart:h}=e,g;t[0]===n?g=t[1]:(g=n.some(Rt),t[0]=n,t[1]=g);let _=g,v=(0,Z.useRef)(null),y=(0,Z.useRef)(null),[b,x]=(0,Z.useState)(zt),[S,C]=(0,Z.useState)(!1),w,T;t[2]===_?(w=t[3],T=t[4]):(w=()=>{if(!_)return;let e=window.setInterval(()=>x(Date.now()),1e3);return()=>window.clearInterval(e)},T=[_],t[2]=_,t[3]=w,t[4]=T),(0,Z.useEffect)(w,T);let E;t[5]!==b||t[6]!==n||t[7]!==o||t[8]!==c||t[9]!==s?(E=Et(St(n,{searchQuery:o,workflowFilterId:s,triggerFilter:c}),b),t[5]=b,t[6]=n,t[7]=o,t[8]=c,t[9]=s,t[10]=E):E=t[10];let D=E,O=D.reduce(Bt,0),k;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(k=e=>{let t=y.current;!t||t.pointerId!==e.pointerId||(y.current=null,C(!1),e.currentTarget.hasPointerCapture?.(e.pointerId)&&e.currentTarget.releasePointerCapture(e.pointerId))},t[11]=k):k=t[11];let A=k,j;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(j=e=>{if(e.button!==0||It(e.target))return;let t=v.current;t&&(y.current={pointerId:e.pointerId,startX:e.clientX,scrollLeft:t.scrollLeft,active:!1},e.currentTarget.setPointerCapture(e.pointerId))},t[12]=j):j=t[12];let M=j,N;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(N=e=>{let t=y.current,n=v.current;if(!t||!n||t.pointerId!==e.pointerId)return;let r=e.clientX-t.startX;!t.active&&Math.abs(r)<5||(t.active||(t.active=!0,C(!0)),e.preventDefault(),n.scrollLeft=t.scrollLeft-r)},t[13]=N):N=t[13];let P=N;if(!u&&O===0){let e;t[14]===a.boardEmptyTitle?e=t[15]:(e=(0,$.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:a.boardEmptyTitle}),t[14]=a.boardEmptyTitle,t[15]=e);let n;t[16]===a.boardEmptyHint?n=t[17]:(n=(0,$.jsx)(`p`,{className:`mx-auto mt-2 max-w-md text-sm leading-6 text-fg-muted`,children:a.boardEmptyHint}),t[16]=a.boardEmptyHint,t[17]=n);let r;t[18]!==a.boardStart||t[19]!==h?(r=(0,$.jsx)(`div`,{className:`mt-4 flex justify-center`,children:(0,$.jsx)(Y,{variant:`primary`,onClick:h,children:a.boardStart})}),t[18]=a.boardStart,t[19]=h,t[20]=r):r=t[20];let i;return t[21]!==r||t[22]!==e||t[23]!==n?(i=(0,$.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col items-center justify-center rounded-2xl border border-dashed border-edge bg-surface-panel/40 px-6 py-12 text-center`,children:[e,n,r]}),t[21]=r,t[22]=e,t[23]=n,t[24]=i):i=t[24],i}let F=S?`cursor-grabbing select-none`:`cursor-grab`,I;t[25]===F?I=t[26]:(I=[`min-h-0 h-full min-w-0 overflow-x-auto rounded-lg p-2`,F],t[25]=F,t[26]=I);let L=I.join(` `),R;t[27]===Symbol.for(`react.memo_cache_sentinel`)?(R=e=>{y.current?.pointerId===e.pointerId&&(y.current=null,C(!1))},t[27]=R):R=t[27];let z;if(t[28]!==D||t[29]!==r||t[30]!==u||t[31]!==i||t[32]!==b||t[33]!==p||t[34]!==d||t[35]!==f||t[36]!==m||t[37]!==l){let e;t[39]!==r||t[40]!==u||t[41]!==i||t[42]!==b||t[43]!==p||t[44]!==d||t[45]!==f||t[46]!==m||t[47]!==l?(e=e=>(0,$.jsx)(Pt,{column:e,language:r,localeTag:i,nowMs:b,selectedRunId:l,loading:u,onOpenRun:d,onOpenRunChat:f,onCancelRun:p,onRetryRun:m},e.id),t[39]=r,t[40]=u,t[41]=i,t[42]=b,t[43]=p,t[44]=d,t[45]=f,t[46]=m,t[47]=l,t[48]=e):e=t[48],z=D.map(e),t[28]=D,t[29]=r,t[30]=u,t[31]=i,t[32]=b,t[33]=p,t[34]=d,t[35]=f,t[36]=m,t[37]=l,t[38]=z}else z=t[38];let B;t[49]===z?B=t[50]:(B=(0,$.jsx)(`div`,{className:`flex min-h-full min-w-max items-start gap-3 pr-4`,children:z}),t[49]=z,t[50]=B);let V;return t[51]!==L||t[52]!==B?(V=(0,$.jsx)(`div`,{ref:v,className:L,onPointerDown:M,onPointerMove:P,onPointerUp:A,onPointerCancel:A,onLostPointerCapture:R,children:B}),t[51]=L,t[52]=B,t[53]=V):V=t[53],V});function Rt(e){return e.status===`queued`||e.status===`running`}function zt(){return Date.now()}function Bt(e,t){return e+t.runs.length}function Vt(e,t){let n=e.metadata.estimatedAgents;return n?n.min===n.max?O(t.agentScaleExact,{count:n.min}):O(t.agentScaleRange,{min:n.min,max:n.max}):null}function Ht(e){let t=(0,Q.c)(73),{definition:n,language:r,labels:i,onPick:a,onDetail:o,onEdit:s}=e,c;t[0]!==n||t[1]!==r?(c=He(n,r),t[0]=n,t[1]=r,t[2]=c):c=t[2];let u=c,d;t[3]!==n||t[4]!==i?(d=Vt(n,i),t[3]=n,t[4]=i,t[5]=d):d=t[5];let f=d,p=n.metadata.source===`user`,m=p?`bg-accent-soft text-accent-fg`:`bg-surface-muted text-fg-muted`,h;t[6]===m?h=t[7]:(h=l(`rounded-full px-2 py-0.5 text-[10px] font-medium`,m),t[6]=m,t[7]=h);let _=p?i.badgeUser:i.badgeBuiltin,v;t[8]!==h||t[9]!==_?(v=(0,$.jsx)(`span`,{className:h,children:_}),t[8]=h,t[9]=_,t[10]=v):v=t[10];let y;t[11]!==n.inputSchema||t[12]!==i.inputSchemaBadge?(y=n.inputSchema?(0,$.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded-full bg-surface-muted px-2 py-0.5 text-[10px] text-fg-subtle`,children:[(0,$.jsx)(Ge,{className:`size-2.5`,"aria-hidden":!0}),i.inputSchemaBadge]}):null,t[11]=n.inputSchema,t[12]=i.inputSchemaBadge,t[13]=y):y=t[13];let b;t[14]!==v||t[15]!==y?(b=(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[v,y]}),t[14]=v,t[15]=y,t[16]=b):b=t[16];let x;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(x=l(`mt-2 line-clamp-2 text-left text-sm font-semibold leading-5 text-fg hover:text-accent-fg`,be.focusRingPanel),t[17]=x):x=t[17];let S;t[18]!==n||t[19]!==o?(S=()=>o(n),t[18]=n,t[19]=o,t[20]=S):S=t[20];let w;t[21]!==n.title||t[22]!==S?(w=(0,$.jsx)(`button`,{type:`button`,className:x,onClick:S,children:n.title}),t[21]=n.title,t[22]=S,t[23]=w):w=t[23];let T;t[24]!==w||t[25]!==b?(T=(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[b,w]}),t[24]=w,t[25]=b,t[26]=T):T=t[26];let E=`${p?i.editWorkflow:i.copyAndEditWorkflow}: ${n.title}`,D;t[27]!==n||t[28]!==s?(D=()=>s(n),t[27]=n,t[28]=s,t[29]=D):D=t[29];let k;t[30]===p?k=t[31]:(k=p?(0,$.jsx)(Xe,{className:`size-3.5`,"aria-hidden":!0}):(0,$.jsx)(G,{className:`size-3.5`,"aria-hidden":!0}),t[30]=p,t[31]=k);let A;t[32]!==E||t[33]!==D||t[34]!==k?(A=(0,$.jsx)(Y,{type:`button`,variant:`ghost`,className:`size-8 shrink-0 p-0`,"aria-label":E,onClick:D,children:k}),t[32]=E,t[33]=D,t[34]=k,t[35]=A):A=t[35];let j;t[36]!==T||t[37]!==A?(j=(0,$.jsxs)(`div`,{className:`flex min-w-0 items-start justify-between gap-3`,children:[T,A]}),t[36]=T,t[37]=A,t[38]=j):j=t[38];let M=u.whenToUse||u.description||n.description,N;t[39]===M?N=t[40]:(N=(0,$.jsx)(`p`,{className:`mt-2 line-clamp-2 text-xs leading-5 text-fg-muted`,children:M}),t[39]=M,t[40]=N);let P;t[41]===Symbol.for(`react.memo_cache_sentinel`)?(P=(0,$.jsx)(g,{className:`size-3`,"aria-hidden":!0}),t[41]=P):P=t[41];let F;t[42]!==n.phases.length||t[43]!==i.phaseCount?(F=O(i.phaseCount,{count:n.phases.length}),t[42]=n.phases.length,t[43]=i.phaseCount,t[44]=F):F=t[44];let I;t[45]===F?I=t[46]:(I=(0,$.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[P,F]}),t[45]=F,t[46]=I);let L;t[47]===f?L=t[48]:(L=f?(0,$.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,$.jsx)(C,{className:`size-3`,"aria-hidden":!0}),f]}):null,t[47]=f,t[48]=L);let R;t[49]!==I||t[50]!==L?(R=(0,$.jsxs)(`div`,{className:`mt-auto flex flex-wrap items-center gap-3 pt-4 text-[11px] text-fg-subtle`,children:[I,L]}),t[49]=I,t[50]=L,t[51]=R):R=t[51];let z;t[52]!==n||t[53]!==a?(z=()=>a(n),t[52]=n,t[53]=a,t[54]=z):z=t[54];let B;t[55]===Symbol.for(`react.memo_cache_sentinel`)?(B=(0,$.jsx)(fe,{className:`size-3.5`,"aria-hidden":!0}),t[55]=B):B=t[55];let V;t[56]!==i.configureAndRun||t[57]!==z?(V=(0,$.jsxs)(Y,{type:`button`,variant:`primary`,className:`h-8 flex-1 rounded-lg text-xs`,onClick:z,children:[B,i.configureAndRun]}),t[56]=i.configureAndRun,t[57]=z,t[58]=V):V=t[58];let H;t[59]!==n||t[60]!==o?(H=()=>o(n),t[59]=n,t[60]=o,t[61]=H):H=t[61];let U;t[62]!==i.viewDetails||t[63]!==H?(U=(0,$.jsx)(Y,{type:`button`,variant:`secondary`,className:`h-8 rounded-lg text-xs`,onClick:H,children:i.viewDetails}),t[62]=i.viewDetails,t[63]=H,t[64]=U):U=t[64];let W;t[65]!==V||t[66]!==U?(W=(0,$.jsxs)(`div`,{className:`mt-3 flex items-center gap-2 border-t border-edge-subtle pt-3`,children:[V,U]}),t[65]=V,t[66]=U,t[67]=W):W=t[67];let ee;return t[68]!==j||t[69]!==N||t[70]!==R||t[71]!==W?(ee=(0,$.jsxs)(`article`,{className:`flex min-h-48 flex-col rounded-xl border border-edge-subtle bg-surface-base p-4 transition-colors hover:border-edge hover:bg-surface-hover/35`,children:[j,N,R,W]}),t[68]=j,t[69]=N,t[70]=R,t[71]=W,t[72]=ee):ee=t[72],ee}function Ut(e){let t=(0,Q.c)(44),{definitions:n,runs:r,language:i,onPick:a,onDetail:o,onEdit:s}=e,[c]=(0,Z.useState)(Kt),u=d(i).workflows,f=i===`zh`?`zh-CN`:`en-US`,[p,m]=(0,Z.useState)(``),[h,g]=(0,Z.useState)(`all`),[_,v]=(0,Z.useState)(`all`),y;t[0]!==h||t[1]!==n||t[2]!==p||t[3]!==_?(y=I(n,p,h,_),t[0]=h,t[1]=n,t[2]=p,t[3]=_,t[4]=y):y=t[4];let b=y,x;if(t[5]!==n||t[6]!==r){let e=new Map(n.map(Gt)),i=new Set;x=[...r].sort(Wt).flatMap(t=>{if(i.has(t.definitionId))return[];let n=e.get(t.definitionId);return n?(i.add(t.definitionId),[{definition:n,lastRunAtMs:t.startedAtMs??t.createdAtMs}]):[]}).slice(0,3),t[5]=n,t[6]=r,t[7]=x}else x=t[7];let S=x,C=O(u.workflowCount,{count:b.length}),w;t[8]===C?w=t[9]:(w=(0,$.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:C}),t[8]=C,t[9]=w);let T=u.sourceFilterAria,D;t[10]!==u.sources||t[11]!==v||t[12]!==_?(D=oe.map(e=>(0,$.jsx)(`button`,{type:`button`,className:l(`h-8 rounded-md px-2.5 text-xs font-medium transition-colors`,_===e?`bg-surface-base text-fg shadow-surface`:`text-fg-muted hover:text-fg`,be.focusRingPanel),"aria-pressed":_===e,onClick:()=>v(e),children:u.sources[e]},e)),t[10]=u.sources,t[11]=v,t[12]=_,t[13]=D):D=t[13];let k;t[14]!==u.sourceFilterAria||t[15]!==D?(k=(0,$.jsx)(`div`,{className:`flex rounded-lg bg-surface-muted p-0.5`,role:`group`,"aria-label":T,children:D}),t[14]=u.sourceFilterAria,t[15]=D,t[16]=k):k=t[16];let j=u.categoryFilterAria,M;t[17]===g?M=t[18]:(M=e=>g(e.target.value),t[17]=g,t[18]=M);let N;t[19]===u.categories?N=t[20]:(N=A.map(e=>(0,$.jsx)(E,{value:e,children:u.categories[e]},e)),t[19]=u.categories,t[20]=N);let P;t[21]!==h||t[22]!==u.categoryFilterAria||t[23]!==M||t[24]!==N?(P=(0,$.jsx)(ae,{value:h,"aria-label":j,onChange:M,className:`h-9 min-w-36 rounded-lg border border-edge bg-surface-base px-2.5 text-xs font-medium text-fg shadow-surface`,children:N}),t[21]=h,t[22]=u.categoryFilterAria,t[23]=M,t[24]=N,t[25]=P):P=t[25];let F;t[26]!==P||t[27]!==k?(F=(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[k,P]}),t[26]=P,t[27]=k,t[28]=F):F=t[28];let L;t[29]===Symbol.for(`react.memo_cache_sentinel`)?(L=(0,$.jsx)(De,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-subtle`,"aria-hidden":!0}),t[29]=L):L=t[29];let R;t[30]===m?R=t[31]:(R=e=>m(e.target.value),t[30]=m,t[31]=R);let z=u.librarySearchPlaceholder,B;t[32]===Symbol.for(`react.memo_cache_sentinel`)?(B=l(`h-10 w-full rounded-lg border border-edge bg-surface-base py-2 pl-10 pr-3 text-sm text-fg`,`placeholder:text-fg-muted`,be.focusRingPanel),t[32]=B):B=t[32];let V;t[33]!==u.librarySearchPlaceholder||t[34]!==p||t[35]!==R?(V=(0,$.jsxs)(`div`,{className:`relative max-w-xl`,children:[L,(0,$.jsx)(`input`,{value:p,onChange:R,placeholder:z,className:B})]}),t[33]=u.librarySearchPlaceholder,t[34]=p,t[35]=R,t[36]=V):V=t[36];let H;return t[37]!==b||t[38]!==u||t[39]!==i||t[40]!==o||t[41]!==s||t[42]!==a?(H=b.length===0?(0,$.jsxs)(`div`,{className:`flex min-h-64 flex-col items-center justify-center px-4 py-12 text-center`,children:[(0,$.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:u.noDefinitions}),(0,$.jsx)(`p`,{className:`mt-1 max-w-sm text-xs leading-5 text-fg-muted`,children:u.noDefinitionsHint})]}):(0,$.jsx)(`div`,{className:`grid grid-cols-1 gap-3 pt-4 sm:grid-cols-2 xl:grid-cols-3`,children:b.map(e=>(0,$.jsx)(Ht,{definition:e,language:i,labels:u,onPick:a,onDetail:o,onEdit:s},e.id))}),t[37]=b,t[38]=u,t[39]=i,t[40]=o,t[41]=s,t[42]=a,t[43]=H):H=t[43],(0,$.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-5`,children:[S.length>0&&!p&&h===`all`&&_===`all`?(0,$.jsxs)(`section`,{"aria-labelledby":`recent-workflows-heading`,children:[(0,$.jsx)(`h2`,{id:`recent-workflows-heading`,className:`text-sm font-semibold text-fg`,children:u.recentlyUsed}),(0,$.jsx)(`div`,{className:`mt-2 flex flex-wrap gap-2`,children:S.map(e=>{let{definition:t,lastRunAtMs:n}=e;return(0,$.jsxs)(`button`,{type:`button`,className:l(`flex min-w-52 flex-1 items-center justify-between gap-3 rounded-lg border border-edge-subtle bg-surface-base px-3 py-2 text-left hover:bg-surface-hover`,`sm:max-w-sm`,be.focusRingPanel),onClick:()=>a(t),children:[(0,$.jsxs)(`span`,{className:`min-w-0`,children:[(0,$.jsx)(`span`,{className:`block truncate text-sm font-medium text-fg`,children:t.title}),(0,$.jsx)(`span`,{className:`mt-0.5 block text-[11px] text-fg-subtle`,children:Dt(n,c,f)})]}),(0,$.jsx)(fe,{className:`size-3.5 shrink-0 text-accent-fg`,"aria-hidden":!0})]},t.id)})})]}):null,(0,$.jsxs)(`section`,{"aria-labelledby":`all-workflows-heading`,children:[(0,$.jsxs)(`div`,{className:`flex flex-col gap-3 border-b border-edge-subtle pb-4`,children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h2`,{id:`all-workflows-heading`,className:`text-sm font-semibold text-fg`,children:u.allWorkflows}),w]}),F]}),V]}),H]})]})}function Wt(e,t){return(t.startedAtMs??t.createdAtMs)-(e.startedAtMs??e.createdAtMs)}function Gt(e){return[e.id,e]}function Kt(){return Date.now()}var qt=(0,Z.memo)(function(e){let t=(0,Q.c)(108),{run:n,language:r,localeTag:i,nowMs:a,onOpen:o,onOpenChat:s,onCancel:c,onRetry:u}=e,f,p,m,h,g,_,y,b,x,S,C,w,T,E,D,k,A;if(t[0]!==r||t[1]!==i||t[2]!==a||t[3]!==o||t[4]!==n){m=d(r).workflows;let e;t[22]===n?e=t[23]:(e=Ot(n),t[22]=n,t[23]=e),f=e;let s;t[24]===n?s=t[25]:(s=kt(n),t[24]=n,t[25]=s),h=s;let c;t[26]===n?c=t[27]:(c=ht(n),t[26]=n,t[27]=c),p=!!c;let u=n.startedAtMs??n.createdAtMs,j=z(f?a-u:n.metrics.durationMs),M;t[28]!==n.metrics.agentCount||t[29]!==n.metrics.doneAgentCount?(M=n.metrics.agentCount>0?Math.round(n.metrics.doneAgentCount/n.metrics.agentCount*100):0,t[28]=n.metrics.agentCount,t[29]=n.metrics.doneAgentCount,t[30]=M):M=t[30];let N=M;x=`group border-b border-edge-subtle last:border-b-0`,b=`flex min-w-0 flex-col gap-3 p-3 transition-colors hover:bg-surface-hover/55 sm:px-4 lg:flex-row lg:items-center`,k=`button`,t[31]!==o||t[32]!==n?(A=()=>o(n),t[31]=o,t[32]=n,t[33]=A):A=t[33],t[34]===Symbol.for(`react.memo_cache_sentinel`)?(_=l(`min-w-0 flex-1 text-left`,be.focusRingPanel),t[34]=_):_=t[34];let P=m.taskOpenDetails,F;t[35]===n?F=t[36]:(F=yt(n),t[35]=n,t[36]=F),y=`${P}: ${F}`,E=`flex min-w-0 items-start gap-3`;let I;t[37]===n.status?I=t[38]:(I=l(`mt-0.5 shrink-0 rounded-full px-2 py-0.5 text-[10px] font-semibold`,v(n.status)),t[37]=n.status,t[38]=I),D=(0,$.jsx)(`span`,{className:I,children:m.status[n.status]??n.status}),g=`min-w-0 flex-1`;let L;t[39]===n?L=t[40]:(L=yt(n),t[39]=n,t[40]=L),t[41]===L?S=t[42]:(S=(0,$.jsx)(`span`,{className:`block truncate text-sm font-medium text-fg`,children:L}),t[41]=L,t[42]=S);let B;t[43]===n?B=t[44]:(B=bt(n),t[43]=n,t[44]=B);let V;t[45]===B?V=t[46]:(V=(0,$.jsx)(`span`,{className:`truncate font-medium`,children:B}),t[45]=B,t[46]=V);let H;t[47]===Symbol.for(`react.memo_cache_sentinel`)?(H=(0,$.jsx)(`span`,{"aria-hidden":!0,children:`·`}),t[47]=H):H=t[47];let U;t[48]!==i||t[49]!==a||t[50]!==u?(U=Dt(u,a,i),t[48]=i,t[49]=a,t[50]=u,t[51]=U):U=t[51];let W;t[52]===U?W=t[53]:(W=(0,$.jsx)(`span`,{children:U}),t[52]=U,t[53]=W);let G=j===`—`?null:(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`span`,{"aria-hidden":!0,children:`·`}),(0,$.jsx)(`span`,{children:O(m.taskElapsed,{duration:j})})]});t[54]!==V||t[55]!==W||t[56]!==G?(C=(0,$.jsxs)(`span`,{className:`mt-1 flex flex-wrap items-center gap-x-2 gap-y-1 text-xs text-fg-muted`,children:[V,H,W,G]}),t[54]=V,t[55]=W,t[56]=G,t[57]=C):C=t[57],w=f&&n.metrics.agentCount>0?(0,$.jsxs)(`span`,{className:`mt-2 block max-w-md`,children:[(0,$.jsxs)(`span`,{className:`flex items-center justify-between text-[11px] text-fg-subtle`,children:[(0,$.jsx)(`span`,{children:O(m.agentProgress,{done:n.metrics.doneAgentCount,total:n.metrics.agentCount})}),(0,$.jsxs)(`span`,{className:`tabular-nums`,children:[N,`%`]})]}),(0,$.jsx)(`span`,{className:`mt-1 block h-1.5 overflow-hidden rounded-full bg-surface-muted`,children:(0,$.jsx)(`span`,{className:`block h-full rounded-full bg-accent transition-[width] duration-200 motion-reduce:transition-none`,style:{width:`${N}%`}})})]}):null,T=n.metrics.errorAgentCount>0?(0,$.jsxs)(`span`,{className:`mt-2 flex items-center gap-1 text-[11px] text-amber-700 dark:text-amber-300`,children:[(0,$.jsx)(R,{className:`size-3 shrink-0`,"aria-hidden":!0}),O(m.runRowErrorSummary,{count:n.metrics.errorAgentCount})]}):null,t[0]=r,t[1]=i,t[2]=a,t[3]=o,t[4]=n,t[5]=f,t[6]=p,t[7]=m,t[8]=h,t[9]=g,t[10]=_,t[11]=y,t[12]=b,t[13]=x,t[14]=S,t[15]=C,t[16]=w,t[17]=T,t[18]=E,t[19]=D,t[20]=k,t[21]=A}else f=t[5],p=t[6],m=t[7],h=t[8],g=t[9],_=t[10],y=t[11],b=t[12],x=t[13],S=t[14],C=t[15],w=t[16],T=t[17],E=t[18],D=t[19],k=t[20],A=t[21];let j;t[58]!==g||t[59]!==S||t[60]!==C||t[61]!==w||t[62]!==T?(j=(0,$.jsxs)(`span`,{className:g,children:[S,C,w,T]}),t[58]=g,t[59]=S,t[60]=C,t[61]=w,t[62]=T,t[63]=j):j=t[63];let M;t[64]!==j||t[65]!==E||t[66]!==D?(M=(0,$.jsxs)(`div`,{className:E,children:[D,j]}),t[64]=j,t[65]=E,t[66]=D,t[67]=M):M=t[67];let N;t[68]!==_||t[69]!==y||t[70]!==M||t[71]!==k||t[72]!==A?(N=(0,$.jsx)(`button`,{type:k,onClick:A,className:_,"aria-label":y,children:M}),t[68]=_,t[69]=y,t[70]=M,t[71]=k,t[72]=A,t[73]=N):N=t[73];let P;t[74]!==m.rerun||t[75]!==u||t[76]!==h||t[77]!==n.id?(P=h?(0,$.jsx)(Y,{type:`button`,variant:`primary`,className:`h-8 rounded-lg text-xs`,onClick:()=>u(n.id),children:m.rerun}):null,t[74]=m.rerun,t[75]=u,t[76]=h,t[77]=n.id,t[78]=P):P=t[78];let F;t[79]!==p||t[80]!==m.continueInChat||t[81]!==s||t[82]!==n?(F=n.status===`succeeded`&&p?(0,$.jsx)(Y,{type:`button`,variant:`secondary`,className:`h-8 rounded-lg text-xs`,onClick:()=>s(n),children:m.continueInChat}):null,t[79]=p,t[80]=m.continueInChat,t[81]=s,t[82]=n,t[83]=F):F=t[83];let I;t[84]!==f||t[85]!==m.cancel||t[86]!==c||t[87]!==n.id?(I=f?(0,$.jsx)(Y,{type:`button`,variant:`ghost`,className:`h-8 rounded-lg text-xs text-red-600 dark:text-red-300`,onClick:()=>c(n.id),children:m.cancel}):null,t[84]=f,t[85]=m.cancel,t[86]=c,t[87]=n.id,t[88]=I):I=t[88];let L;t[89]!==o||t[90]!==n?(L=()=>o(n),t[89]=o,t[90]=n,t[91]=L):L=t[91];let B;t[92]===Symbol.for(`react.memo_cache_sentinel`)?(B=(0,$.jsx)(ke,{className:`size-4`,"aria-hidden":!0}),t[92]=B):B=t[92];let V;t[93]!==m.taskOpenDetails||t[94]!==L?(V=(0,$.jsx)(Y,{type:`button`,variant:`ghost`,className:`size-8 p-0`,"aria-label":m.taskOpenDetails,onClick:L,children:B}),t[93]=m.taskOpenDetails,t[94]=L,t[95]=V):V=t[95];let H;t[96]!==P||t[97]!==F||t[98]!==I||t[99]!==V?(H=(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center justify-end gap-1.5 pl-7 lg:pl-0`,children:[P,F,I,V]}),t[96]=P,t[97]=F,t[98]=I,t[99]=V,t[100]=H):H=t[100];let U;t[101]!==b||t[102]!==N||t[103]!==H?(U=(0,$.jsxs)(`div`,{className:b,children:[N,H]}),t[101]=b,t[102]=N,t[103]=H,t[104]=U):U=t[104];let W;return t[105]!==x||t[106]!==U?(W=(0,$.jsx)(`article`,{className:x,children:U}),t[105]=x,t[106]=U,t[107]=W):W=t[107],W});function Jt(e){let t=(0,Q.c)(17),{vm:n}=e,{labels:r,language:i,loading:a,ownerAgentId:o,agentOptions:c,setOwnerAgentId:l,refreshAll:u}=n,f;t[0]!==c||t[1]!==r.agentFilterAria||t[2]!==i||t[3]!==o||t[4]!==l?(f=c.length>1?(0,$.jsx)(ae,{value:o??``,"aria-label":r.agentFilterAria,onChange:e=>l(e.target.value),className:`h-9 min-w-32 rounded-lg border border-edge bg-surface-panel px-2.5 text-xs font-medium text-fg shadow-surface`,children:c.map(e=>(0,$.jsx)(E,{value:e.id,children:ye(e,d(i).agentsSettings)},e.id))}):null,t[0]=c,t[1]=r.agentFilterAria,t[2]=i,t[3]=o,t[4]=l,t[5]=f):f=t[5];let p;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,$.jsx)(we,{className:`size-4`,"aria-hidden":!0}),t[6]=p):p=t[6];let m;t[7]===r.addWorkflow?m=t[8]:(m=(0,$.jsx)(Y,{asChild:!0,variant:`primary`,className:`h-9 rounded-lg`,children:(0,$.jsxs)(s,{to:`/workflows/new`,children:[p,r.addWorkflow]})}),t[7]=r.addWorkflow,t[8]=m);let h;t[9]!==r.refresh||t[10]!==a||t[11]!==u?(h=(0,$.jsx)(L,{className:`size-9 shrink-0 p-0`,loading:a,label:r.refresh,onClick:u}),t[9]=r.refresh,t[10]=a,t[11]=u,t[12]=h):h=t[12];let g;return t[13]!==f||t[14]!==m||t[15]!==h?(g=(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:[f,m,h]}),t[13]=f,t[14]=m,t[15]=h,t[16]=g):g=t[16],g}var Yt=new Set([`failed`,`timeout`,`cancelled`]),Xt=[{id:`runs`,icon:j},{id:`library`,icon:le}],Zt={failed:0,timeout:0,cancelled:0,running:1,queued:2,succeeded:3};function Qt(e){return Yt.has(e.status)}function $t(e,t){return t===`all`?!0:t===`attention`?Qt(e):e.status===t}function en(e){return[...e].sort((e,t)=>{let n=(Zt[e.status]??4)-(Zt[t.status]??4);if(n!==0)return n;if(e.status===`queued`&&t.status===`queued`)return e.createdAtMs-t.createdAtMs;let r=e.completedAtMs??e.startedAtMs??e.createdAtMs;return(t.completedAtMs??t.startedAtMs??t.createdAtMs)-r})}function tn(e,t){return e===`Home`?`runs`:e===`End`?`library`:e===`ArrowLeft`||e===`ArrowRight`?t===`runs`?`library`:`runs`:null}function nn(){let e=(0,Q.c)(2),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,$.jsx)(S,{className:`h-5 w-16 rounded-full`}),e[0]=t):t=e[0];let n;return e[1]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,$.jsxs)(`div`,{className:`flex items-center gap-3 border-b border-edge-subtle p-4 last:border-b-0`,"aria-hidden":`true`,children:[t,(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,$.jsx)(S,{className:`h-4 w-52 max-w-full`}),(0,$.jsx)(S,{className:`mt-2 h-3 w-36 max-w-full`})]}),(0,$.jsx)(S,{className:`hidden h-8 w-20 rounded-lg sm:block`})]}),e[1]=n):n=e[1],n}function rn(e){let t=(0,Q.c)(30),{vm:n}=e,{language:r,localeTag:i,labels:a,hasToken:o,definitions:s,runs:c,searchQuery:u,setSearchQuery:d,workflowFilterId:f,setWorkflowFilterId:p,triggerFilter:m,setTriggerFilter:h,statusFilter:g,setStatusFilter:_,clearRunFilters:v,pageTab:b,setPageTab:x,runLayout:S,setRunLayout:C,openRunDetails:w,openRunInChat:T,openDefinitionDetails:D,openWorkflowEditor:O,startWorkflow:k,actionError:A,loading:j,error:M,cancelRun:P,retryRun:F}=n,I=N(cn),L=N(sn),z=Date.now(),B=en(c.filter(Qt)),V;t[0]===g?V=t[1]:(V=e=>$t(e,g),t[0]=g,t[1]=V);let H=en(St(c,{searchQuery:u,workflowFilterId:f,triggerFilter:m}).filter(V)),U=!!(u||f||m!==`all`||g!==`all`),W,G;if(t[2]!==L||t[3]!==o||t[4]!==a.librarySubtitle||t[5]!==a.runsSubtitle||t[6]!==a.title||t[7]!==b||t[8]!==I||t[9]!==n?(W=()=>{if(!o){L();return}return I({startExtra:null,main:(0,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:a.title}),(0,$.jsx)(`p`,{className:`truncate text-xs text-fg-muted`,children:b===`runs`?a.runsSubtitle:a.librarySubtitle})]}),end:(0,$.jsx)(Jt,{vm:n})}),()=>L()},G=[L,o,a.librarySubtitle,a.runsSubtitle,a.title,b,I,n],t[2]=L,t[3]=o,t[4]=a.librarySubtitle,t[5]=a.runsSubtitle,t[6]=a.title,t[7]=b,t[8]=I,t[9]=n,t[10]=W,t[11]=G):(W=t[10],G=t[11]),(0,Z.useLayoutEffect)(W,G),!o){let e;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(Te,{className:`size-10 text-accent-fg`,"aria-hidden":!0}),t[12]=e):e=t[12];let n;t[13]===a.title?n=t[14]:(n=(0,$.jsx)(`h1`,{className:`mt-4 text-xl font-semibold text-fg`,children:a.title}),t[13]=a.title,t[14]=n);let r;t[15]===a.needToken?r=t[16]:(r=(0,$.jsx)(`p`,{className:`mt-2 max-w-md text-sm leading-6 text-fg-muted`,children:a.needToken}),t[15]=a.needToken,t[16]=r);let i;return t[17]!==n||t[18]!==r?(i=(0,$.jsx)(`main`,{className:`min-h-0 flex-1 overflow-auto bg-surface-panel`,children:(0,$.jsxs)(`div`,{className:`flex w-full flex-col items-center px-3 py-16 text-center sm:px-5 xl:px-6`,children:[e,n,r]})}),t[17]=n,t[18]=r,t[19]=i):i=t[19],i}let ee=a.pageTabsAria,te=Xt.map(e=>{let{id:t,icon:n}=e;return(0,$.jsxs)(`button`,{id:`workflow-tab-${t}`,type:`button`,role:`tab`,"aria-selected":b===t,"aria-controls":`workflow-panel-${t}`,tabIndex:b===t?0:-1,draggable:!1,className:l(`relative inline-flex shrink-0 items-center gap-1.5 rounded-lg px-3 py-2 text-sm font-medium`,`transition-transform duration-150 ease-out active:scale-95 motion-reduce:transition-none motion-reduce:active:scale-100`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,b===t?`bg-accent-soft text-accent-fg`:`text-fg-muted hover:bg-surface-hover hover:text-fg`),onClick:()=>x(t),onKeyDown:e=>{let n=tn(e.key,t);n&&(e.preventDefault(),x(n),window.requestAnimationFrame(()=>{document.getElementById(`workflow-tab-${n}`)?.focus()}))},children:[(0,$.jsx)(n,{className:`size-3.5 shrink-0`,strokeWidth:1.75,"aria-hidden":!0}),(0,$.jsx)(`span`,{children:a.pageTabs[t]}),t===`runs`&&B.length>0?(0,$.jsx)(`span`,{className:`rounded-full bg-red-500/15 px-1.5 py-0.5 text-[10px] font-semibold text-red-700 dark:text-red-300`,children:B.length}):null]},t)}),K;t[20]!==a.pageTabsAria||t[21]!==te?(K=(0,$.jsx)(`nav`,{className:`-mx-1 flex gap-1 overflow-x-auto px-1 pb-1`,"aria-label":ee,role:`tablist`,children:te}),t[20]=a.pageTabsAria,t[21]=te,t[22]=K):K=t[22];let ne;t[23]!==A||t[24]!==M?(ne=A??M?(0,$.jsx)(`div`,{className:`mt-4 rounded-lg border border-red-500/25 bg-red-500/10 px-3 py-2 text-sm text-red-700 dark:text-red-300`,role:`alert`,children:A??M}):null,t[23]=A,t[24]=M,t[25]=ne):ne=t[25];let q=b===`runs`?(0,$.jsxs)(`div`,{id:`workflow-panel-runs`,role:`tabpanel`,"aria-labelledby":`workflow-tab-runs`,className:`flex flex-col gap-4 py-4`,children:[B.length>0?(0,$.jsx)(`section`,{className:`rounded-xl border border-amber-500/30 bg-amber-500/8 px-4 py-3`,"aria-labelledby":`workflow-attention-heading`,children:(0,$.jsxs)(`div`,{className:`flex flex-col gap-3 lg:flex-row lg:items-center lg:justify-between`,children:[(0,$.jsxs)(`div`,{className:`flex min-w-0 items-start gap-3`,children:[(0,$.jsx)(R,{className:`mt-0.5 size-4 shrink-0 text-amber-700 dark:text-amber-300`,"aria-hidden":!0}),(0,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,$.jsx)(`h2`,{id:`workflow-attention-heading`,className:`text-sm font-semibold text-fg`,children:a.attentionTitle}),(0,$.jsx)(`span`,{className:`rounded-full bg-amber-500/15 px-2 py-0.5 text-[10px] font-semibold text-amber-800 dark:text-amber-200`,children:B.length})]}),(0,$.jsxs)(`p`,{className:`mt-1 truncate text-xs text-fg-muted`,children:[yt(B[0]),` · `,Dt(B[0].completedAtMs??B[0].createdAtMs,z,i)]}),(0,$.jsx)(`p`,{className:`mt-1 text-xs text-fg-subtle`,children:a.attentionHint})]})]}),(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2 pl-7 lg:pl-0`,children:[(0,$.jsx)(Y,{type:`button`,variant:`secondary`,className:`h-8 rounded-lg text-xs`,onClick:()=>w(B[0]),children:a.attentionView}),(0,$.jsx)(Y,{type:`button`,variant:`primary`,className:`h-8 rounded-lg text-xs`,onClick:()=>void F(B[0].id),children:a.rerun})]})]})}):null,(0,$.jsx)(`section`,{className:`flex flex-col gap-3 rounded-xl border border-edge-subtle bg-surface-base p-3`,"aria-label":a.runFiltersAria,children:(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,$.jsxs)(`div`,{className:`relative min-w-52 flex-1 sm:max-w-sm`,children:[(0,$.jsx)(De,{className:`pointer-events-none absolute left-2.5 top-1/2 size-4 -translate-y-1/2 text-fg-subtle`,"aria-hidden":!0}),(0,$.jsx)(`input`,{value:u,onChange:e=>d(e.target.value),placeholder:a.runsSearchPlaceholder,className:l(`h-9 w-full rounded-lg border border-edge bg-surface-panel py-2 pl-9 pr-3 text-sm text-fg shadow-surface`,`placeholder:text-fg-muted`,be.focusRingPanel)})]}),(0,$.jsx)(ae,{value:g,"aria-label":a.statusFilterAria,onChange:e=>_(e.target.value),className:`h-9 min-w-32 rounded-lg border border-edge bg-surface-panel px-2.5 text-xs font-medium text-fg shadow-surface`,children:[`all`,`attention`,`running`,`queued`,`succeeded`].map(e=>(0,$.jsx)(E,{value:e,children:a.runStatuses[e]},e))}),(0,$.jsxs)(ae,{value:m,"aria-label":a.boardTriggerFilterAria,onChange:e=>h(e.target.value),className:`h-9 min-w-[7.5rem] rounded-lg border border-edge bg-surface-panel px-2.5 text-xs font-medium text-fg shadow-surface`,children:[(0,$.jsx)(E,{value:`all`,children:a.boardTriggerFilterAll}),(0,$.jsx)(E,{value:`automation`,children:a.boardTriggerFilterAutomation}),(0,$.jsx)(E,{value:`webui`,children:a.boardTriggerFilterWebui}),(0,$.jsx)(E,{value:`chat`,children:a.boardTriggerFilterChat}),(0,$.jsx)(E,{value:`api`,children:a.boardTriggerFilterApi})]}),(0,$.jsxs)(ae,{value:f,"aria-label":a.boardWorkflowFilterAria,onChange:e=>p(e.target.value),className:`h-9 min-w-40 rounded-lg border border-edge bg-surface-panel px-2.5 text-xs font-medium text-fg shadow-surface`,children:[(0,$.jsx)(E,{value:``,children:a.boardWorkflowFilterAll}),s.map(on)]}),U?(0,$.jsxs)(Y,{type:`button`,variant:`ghost`,className:`h-9 rounded-lg text-xs`,onClick:v,children:[(0,$.jsx)(he,{className:`size-3.5`,"aria-hidden":!0}),a.clearFilters]}):null,(0,$.jsxs)(`div`,{className:`ml-auto flex rounded-lg bg-surface-muted p-0.5`,role:`group`,"aria-label":a.layoutAria,children:[(0,$.jsxs)(`button`,{type:`button`,className:l(`inline-flex h-8 items-center gap-1.5 rounded-md px-2.5 text-xs font-medium transition-colors`,S===`list`?`bg-surface-panel text-fg shadow-surface`:`text-fg-muted hover:text-fg`,be.focusRingPanel),"aria-pressed":S===`list`,onClick:()=>C(`list`),children:[(0,$.jsx)(y,{className:`size-3.5`,"aria-hidden":!0}),a.runLayouts.list]}),(0,$.jsxs)(`button`,{type:`button`,className:l(`inline-flex h-8 items-center gap-1.5 rounded-md px-2.5 text-xs font-medium transition-colors`,S===`board`?`bg-surface-panel text-fg shadow-surface`:`text-fg-muted hover:text-fg`,be.focusRingPanel),"aria-pressed":S===`board`,onClick:()=>C(`board`),children:[(0,$.jsx)(ue,{className:`size-3.5`,"aria-hidden":!0}),a.runLayouts.board]})]})]})}),S===`list`?(0,$.jsxs)(`section`,{className:`overflow-hidden rounded-xl border border-edge-subtle bg-surface-base`,"aria-labelledby":`workflow-runs-heading`,children:[(0,$.jsxs)(`header`,{className:`flex items-start justify-between gap-3 border-b border-edge-subtle px-4 py-3`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h2`,{id:`workflow-runs-heading`,className:`text-sm font-semibold text-fg`,children:a.allRuns}),(0,$.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:a.allRunsHint})]}),(0,$.jsx)(`span`,{className:`rounded-full bg-surface-muted px-2 py-0.5 text-xs font-semibold tabular-nums text-fg-muted`,children:H.length})]}),j&&H.length===0?Array.from({length:4}).map(an):H.length>0?H.map(e=>(0,$.jsx)(qt,{run:e,language:r,localeTag:i,nowMs:z,onOpen:w,onOpenChat:T,onCancel:e=>void P(e),onRetry:e=>void F(e)},e.id)):(0,$.jsxs)(`div`,{className:`flex min-h-64 flex-col items-center justify-center px-4 py-12 text-center`,children:[(0,$.jsx)(Te,{className:`size-8 text-fg-subtle`,"aria-hidden":!0}),(0,$.jsx)(`h3`,{className:`mt-3 text-sm font-semibold text-fg`,children:U?a.noRunResultsTitle:a.noRunsTitle}),(0,$.jsx)(`p`,{className:`mt-1 max-w-md text-xs leading-5 text-fg-muted`,children:U?a.noRunResultsHint:a.noRunsStartHint}),(0,$.jsx)(Y,{type:`button`,variant:U?`secondary`:`primary`,className:`mt-4 h-9 rounded-lg text-xs`,onClick:U?v:()=>x(`library`),children:U?a.clearFilters:a.chooseWorkflow})]})]}):(0,$.jsx)(`div`,{className:`h-[min(72vh,48rem)] min-h-[24rem] w-full sm:min-h-[28rem]`,children:(0,$.jsx)(Lt,{runs:H,language:r,localeTag:i,labels:{boardEmptyTitle:a.boardEmptyTitle,boardEmptyHint:a.boardEmptyHint,boardStart:a.chooseWorkflow,loading:a.loading},searchQuery:``,workflowFilterId:``,triggerFilter:`all`,selectedRunId:null,loading:j,onOpenRun:w,onOpenRunChat:T,onCancelRun:e=>void P(e),onRetryRun:e=>void F(e),onStart:()=>x(`library`)})})]}):(0,$.jsxs)(`section`,{id:`workflow-panel-library`,role:`tabpanel`,"aria-labelledby":`workflow-tab-library`,className:`py-5`,children:[(0,$.jsxs)(`div`,{className:`mb-5`,children:[(0,$.jsx)(`h2`,{id:`workflow-library-heading`,className:`text-base font-semibold text-fg`,children:a.libraryTitle}),(0,$.jsx)(`p`,{className:`mt-1 max-w-2xl text-sm leading-6 text-fg-muted`,children:a.libraryDescription})]}),(0,$.jsx)(Ut,{definitions:s,runs:c,language:r,onPick:k,onDetail:D,onEdit:O})]}),re;return t[26]!==ne||t[27]!==q||t[28]!==K?(re=(0,$.jsx)(`main`,{className:`min-h-0 flex-1 overflow-y-auto bg-surface-panel`,children:(0,$.jsxs)(`div`,{className:`mx-auto flex min-h-full w-full max-w-[96rem] flex-col px-3 py-5 sm:px-5 xl:px-6`,children:[K,ne,q]})}),t[26]=ne,t[27]=q,t[28]=K,t[29]=re):re=t[29],re}function an(e,t){return(0,$.jsx)(nn,{},t)}function on(e){return(0,$.jsx)(E,{value:e.id,children:e.title},e.id)}function sn(e){return e.clearPageHeader}function cn(e){return e.setPageHeader}function ln(){let e=(0,Q.c)(114),t=p(mn),n;e[0]===t?n=e[1]:(n=d(t),e[0]=t,e[1]=n);let r=n.workflows,i=t===`zh`?`zh-CN`:`en-US`,s=f(pn),c=!!s,l=o(),[u,g]=a(),_;e[2]===u?_=e[3]:(_=u.get(`q`)??``,e[2]=u,e[3]=_);let v=_,y;e[4]===u?y=e[5]:(y=u.get(`wf`)?.trim()??``,e[4]=u,e[5]=y);let b=y,x;e[6]===u?x=e[7]:(x=u.get(`trigger`)?.trim()||`all`,e[6]=u,e[7]=x);let S=x,C,w,T,E;if(e[8]!==u){let t=u.get(`status`)?.trim()??``,n=u.get(`tab`)?.trim()??``,r=u.get(`layout`)?.trim()??``;C=u.get(`agent`)?.trim()??``,w=Ie.has(n)?n:`runs`,T=ce.has(r)?r:`list`,E=U.has(t)?t:`all`,e[8]=u,e[9]=C,e[10]=w,e[11]=T,e[12]=E}else C=e[9],w=e[10],T=e[11],E=e[12];let D=E,[O,A]=(0,Z.useState)(null),j;e[13]!==c||e[14]!==s?(j=c?[`workflow-agents`,s]:null,e[13]=c,e[14]=s,e[15]=j):j=e[15];let M;e[16]===Symbol.for(`react.memo_cache_sentinel`)?(M={revalidateOnFocus:!1},e[16]=M):M=e[16];let N=m(j,qe,M),P;bb0:{let e=N.data?.agents??[];if(C&&(e.length===0||e.some(e=>e.id===C))){P=C;break bb0}P=N.data?.defaultId}let F=P,I;e[17]!==c||e[18]!==s?(I=c?[`workflow-definitions`,s]:null,e[17]=c,e[18]=s,e[19]=I):I=e[19];let L;e[20]===Symbol.for(`react.memo_cache_sentinel`)?(L={revalidateOnFocus:!1},e[20]=L):L=e[20];let R=m(I,de,L),z;e[21]!==c||e[22]!==F||e[23]!==s?(z=c&&F?[`workflow-runs`,s,F]:null,e[21]=c,e[22]=F,e[23]=s,e[24]=z):z=e[24];let B;e[25]===F?B=e[26]:(B=()=>Ze(100,{ownerAgentId:F}),e[25]=F,e[26]=B);let V;e[27]===Symbol.for(`react.memo_cache_sentinel`)?(V={revalidateOnFocus:!1,refreshInterval:dn},e[27]=V):V=e[27];let H=m(z,B,V),W;e[28]===R.data?W=e[29]:(W=R.data??[],e[28]=R.data,e[29]=W);let G=W,te;e[30]===H.data?te=e[31]:(te=H.data??[],e[30]=H.data,e[31]=te);let K=te,ne;e[32]===g?ne=e[33]:(ne=e=>{g(t=>{let n=new URLSearchParams(t);return e(n),n},{replace:!0})},e[32]=g,e[33]=ne);let q=ne,ae;e[34]===q?ae=e[35]:(ae=e=>q(t=>{let n=e.trim();n?t.set(`q`,n):t.delete(`q`)}),e[34]=q,e[35]=ae);let oe=ae,se;e[36]===q?se=e[37]:(se=e=>q(t=>{let n=e.trim();n?t.set(ie,n):t.delete(ie)}),e[36]=q,e[37]=se);let le=se,ue;e[38]===q?ue=e[39]:(ue=e=>q(t=>{let n=e.trim();n?t.set(`wf`,n):t.delete(`wf`)}),e[38]=q,e[39]=ue);let fe=ue,Y;e[40]===q?Y=e[41]:(Y=e=>q(t=>{e&&e!==`all`?t.set(h,e):t.delete(h)}),e[40]=q,e[41]=Y);let pe=Y,me;e[42]===q?me=e[43]:(me=e=>q(t=>{e===`runs`?t.delete(`tab`):t.set(`tab`,e)}),e[42]=q,e[43]=me);let he=me,ge;e[44]===q?ge=e[45]:(ge=e=>q(t=>{e===`list`?t.delete(k):t.set(k,e)}),e[44]=q,e[45]=ge);let _e=ge,ye;e[46]===q?ye=e[47]:(ye=e=>q(t=>{e===`all`?t.delete(J):t.set(J,e)}),e[46]=q,e[47]=ye);let be=ye,xe;e[48]===q?xe=e[49]:(xe=()=>q(un),e[48]=q,e[49]=xe);let X=xe,Se=F?`?agentId=${encodeURIComponent(F)}`:``,Ce;e[50]!==l||e[51]!==Se?(Ce=e=>l(`/workflows/${e.id}${Se}`),e[50]=l,e[51]=Se,e[52]=Ce):Ce=e[52];let we=Ce,Te=we,Ee;e[53]!==l||e[54]!==F||e[55]!==Se?(Ee=e=>{l(e.metadata.source===`user`?`/workflows/${e.id}/edit${Se}`:`/workflows/new?copy=${encodeURIComponent(e.id)}${F?`&agentId=${encodeURIComponent(F)}`:``}`)},e[53]=l,e[54]=F,e[55]=Se,e[56]=Ee):Ee=e[56];let De=Ee,Oe;e[57]!==l||e[58]!==Se?(Oe=e=>l(`/workflows/runs/${e.id}${Se}`),e[57]=l,e[58]=Se,e[59]=Oe):Oe=e[59];let ke=Oe,Ae;e[60]===l?Ae=e[61]:(Ae=e=>{let t=ht(e);t&&l(re(t))},e[60]=l,e[61]=Ae);let je=Ae,Me;e[62]!==r.cancelFailed||e[63]!==F||e[64]!==H?(Me=async e=>{try{await ve(e,{ownerAgentId:F}),await H.mutate()}catch(e){let t=e;A(t instanceof Error?t.message:r.cancelFailed)}},e[62]=r.cancelFailed,e[63]=F,e[64]=H,e[65]=Me):Me=e[65];let Ne=Me,Pe;e[66]!==r.retryFailed||e[67]!==l||e[68]!==F||e[69]!==Se?(Pe=async e=>{try{l(`/workflows/runs/${(await ee(e,{ownerAgentId:F})).runId}${Se}`)}catch(e){let t=e;A(t instanceof Error?t.message:r.retryFailed)}},e[66]=r.retryFailed,e[67]=l,e[68]=F,e[69]=Se,e[70]=Pe):Pe=e[70];let Fe=Pe,Le,Re;e[71]===H?(Le=e[72],Re=e[73]):(Le=()=>{let e=()=>void H.mutate();return window.addEventListener(`workflow-run-updated`,e),window.addEventListener(`workflow-run-error`,e),()=>{window.removeEventListener(`workflow-run-updated`,e),window.removeEventListener(`workflow-run-error`,e)}},Re=[H],e[71]=H,e[72]=Le,e[73]=Re),(0,Z.useEffect)(Le,Re);let ze;e[74]!==N||e[75]!==R||e[76]!==H?(ze=()=>{Promise.all([N.mutate(),R.mutate(),H.mutate()])},e[74]=N,e[75]=R,e[76]=H,e[77]=ze):ze=e[77];let Be=ze,Ve=N.isLoading||R.isLoading||H.isLoading,He=N.error?.message??R.error?.message??H.error?.message??null,Ue;e[78]===N.data?.agents?Ue=e[79]:(Ue=N.data?.agents??[],e[78]=N.data?.agents,e[79]=Ue);let We;return e[80]!==O||e[81]!==Ne||e[82]!==X||e[83]!==G||e[84]!==He||e[85]!==c||e[86]!==r||e[87]!==t||e[88]!==Ve||e[89]!==i||e[90]!==we||e[91]!==ke||e[92]!==je||e[93]!==De||e[94]!==F||e[95]!==w||e[96]!==Be||e[97]!==Fe||e[98]!==T||e[99]!==K||e[100]!==v||e[101]!==le||e[102]!==he||e[103]!==_e||e[104]!==oe||e[105]!==be||e[106]!==pe||e[107]!==fe||e[108]!==Te||e[109]!==D||e[110]!==Ue||e[111]!==S||e[112]!==b?(We={language:t,localeTag:i,labels:r,hasToken:c,searchQuery:v,setSearchQuery:oe,ownerAgentId:F,agentOptions:Ue,setOwnerAgentId:le,workflowFilterId:b,setWorkflowFilterId:fe,triggerFilter:S,setTriggerFilter:pe,statusFilter:D,setStatusFilter:be,clearRunFilters:X,pageTab:w,setPageTab:he,runLayout:T,setRunLayout:_e,definitions:G,runs:K,openDefinitionDetails:we,startWorkflow:Te,openWorkflowEditor:De,openRunDetails:ke,openRunInChat:je,actionError:O,loading:Ve,error:He,refreshAll:Be,cancelRun:Ne,retryRun:Fe},e[80]=O,e[81]=Ne,e[82]=X,e[83]=G,e[84]=He,e[85]=c,e[86]=r,e[87]=t,e[88]=Ve,e[89]=i,e[90]=we,e[91]=ke,e[92]=je,e[93]=De,e[94]=F,e[95]=w,e[96]=Be,e[97]=Fe,e[98]=T,e[99]=K,e[100]=v,e[101]=le,e[102]=he,e[103]=_e,e[104]=oe,e[105]=be,e[106]=pe,e[107]=fe,e[108]=Te,e[109]=D,e[110]=Ue,e[111]=S,e[112]=b,e[113]=We):We=e[113],We}function un(e){e.delete(`q`),e.delete(`wf`),e.delete(h),e.delete(J)}function dn(e){return e?.some(fn)?3e3:0}function fn(e){return e.status===`queued`||e.status===`running`}function pn(e){return e.token}function mn(e){return e.language}function hn(){let e=(0,Q.c)(2),t=ln(),n;return e[0]===t?n=e[1]:(n=(0,$.jsx)(rn,{vm:t}),e[0]=t,e[1]=n),n}function gn(e){return{title:e.title,description:e.description,version:e.version,inputSchema:e.inputSchema,outputSchema:e.outputSchema,defaults:e.defaults,tags:e.metadata.tags,whenToUse:e.metadata.whenToUse,estimatedAgents:e.metadata.estimatedAgents,permissions:e.permissions,resources:e.resources}}function _n(e,t){let n=new Set(t);if(!n.has(e))return e;for(let t=2;t<1e3;t+=1){let r=`${e}_${t}`;if(!n.has(r))return r}return`${e}_${Date.now()}`}function vn(e){if(!(e instanceof Error))return null;let t=e;if(t.status!==409||!t.body||typeof t.body!=`object`)return null;let n=t.body,r=typeof n.currentRevision==`number`?n.currentRevision:0;return n.code===`WORKFLOW_NAME_EXISTS`&&typeof n.name==`string`&&typeof n.suggestedName==`string`?{code:`WORKFLOW_NAME_EXISTS`,name:n.name,currentRevision:r,suggestedName:n.suggestedName}:n.code===`WORKFLOW_REVISION_CONFLICT`?{code:`WORKFLOW_REVISION_CONFLICT`,currentRevision:r}:null}var yn={padding:.24,minZoom:.45,maxZoom:1};function bn({language:e,ownerAgentId:t,saving:n,initialDraft:r,initialName:i,existingNames:a,saveConflict:o,onSave:c,onSaveAndStart:u,onClearSaveConflict:d,onReloadLatest:f}){let p=zn(e),[m,h]=(0,Z.useState)(`my_workflow`),[_,v]=(0,Z.useState)(()=>Mn()),[y,x]=(0,Z.useState)(()=>({title:p.untitled,description:``,tags:[`custom`]})),[S,C]=(0,Z.useState)(`agent-1`),[T,E,D]=dt(_.nodes.map(e=>An(e,e.id===`agent-1`))),[O,k]=(0,Z.useState)(``),[A,j]=(0,Z.useState)(``),[M,N]=(0,Z.useState)(!1),[P,F]=(0,Z.useState)(null),[I,L]=(0,Z.useState)(null),[R,z]=(0,Z.useState)(!!r),[B,V]=(0,Z.useState)(null),[H,U]=(0,Z.useState)(`idle`),[W,G]=(0,Z.useState)(0),[ee,K]=(0,Z.useState)([]),[ne,q]=(0,Z.useState)(null),re=(0,Z.useRef)(``),ie=(0,Z.useRef)(``),ae=(0,Z.useRef)(void 0),oe=(0,Z.useRef)(void 0),se=(0,Z.useRef)(!1),ce=(0,Z.useRef)(null),[le,J]=(0,Z.useState)(0);(0,Z.useEffect)(()=>{let e=`${r?.mode??`new`}:${r?.name??i}:${r?.baseRevision??0}:${r?.repairPrompt??``}`;re.current!==e&&(re.current=e,h(r?.name??i),v(structuredClone(r?.graph??Mn())),J(e=>e+1),x(structuredClone(r?.manifest??{title:p.untitled,description:``,tags:[`custom`]})),C(r?.graph.nodes.find(e=>e.kind===`agent`)?.id??`agent-1`),k(r?.repairPrompt??``),F(null),L(null),z(!!r),j(``),V(null),G(r?.baseRevision??0),K([]),q(null),ae.current=void 0,oe.current=void 0,U(`idle`))},[p.untitled,r,i]),(0,Z.useEffect)(()=>{r?.mode===`edit`&&Ke(r.name).then(K).catch(()=>K([]))},[r?.mode,r?.name]),(0,Z.useEffect)(()=>{if(!m.trim())return;let e=window.setTimeout(()=>{w(m,_).then(V).catch(()=>V(null))},350);return()=>window.clearTimeout(e)},[_,m]),(0,Z.useEffect)(()=>{if(!m.trim())return;U(`saving`);let e=window.setTimeout(()=>{b({id:ae.current,workflowName:m,graph:_,manifest:y,baseRevision:W,expectedUpdatedAtMs:oe.current}).then(e=>{ae.current=e.id,oe.current=e.updatedAtMs,U(`saved`)}).catch(()=>U(`error`))},900);return()=>window.clearTimeout(e)},[W,_,y,m]);let ue=(0,Z.useMemo)(()=>Pn(_,P?.graph??null),[_,P?.graph]),de=(0,Z.useMemo)(()=>{if(!P)return _;let e=new Set(P.graph.nodes.map(e=>e.id)),t=_.nodes.filter(t=>!e.has(t.id));return{...P.graph,nodes:[...P.graph.nodes,...t]}},[_,P]);(0,Z.useLayoutEffect)(()=>{E(e=>{let t=new Map(e.map(e=>[e.id,e]));return de.nodes.map(e=>({...t.get(e.id),...An(e,e.id===S,ue.nodeStates.get(e.id))}))})},[de.nodes,ue.nodeStates,S,E]),(0,Z.useEffect)(()=>{let e=ce.current;if(!e||de.nodes.length===0)return;let t=window.requestAnimationFrame(()=>{e.fitView(yn)});return()=>window.cancelAnimationFrame(t)},[de.nodes.length,le]);let me=(0,Z.useMemo)(()=>de.edges.map(jn),[de.edges]),he=_.nodes.find(e=>e.id===S)??null,_e=(0,Z.useMemo)(()=>new Set(a),[a]),ve=r?.mode!==`edit`&&_e.has(m),ye=ve?_n(m,_e):m,Se=B?.valid===!0&&!ve&&!n&&!M,Ce=(0,Z.useCallback)(e=>{v(t=>{let n=t.nodes.map(t=>t.id!==e.id||t.position.x===e.position.x&&t.position.y===e.position.y?t:{...t,position:e.position});return n.some((e,n)=>e!==t.nodes[n])?{...t,nodes:n}:t})},[]),we=(0,Z.useCallback)(e=>{let t=e.filter(e=>e.type!==`select`);t.length!==0&&v(e=>({...e,edges:it(t,e.edges.map(jn)).map(e=>({id:e.id,source:e.source,target:e.target,sourcePort:e.sourceHandle===`true`||e.sourceHandle===`false`?e.sourceHandle:void 0}))}))},[]),Ee=(0,Z.useCallback)(e=>{!e.source||!e.target||v(t=>({...t,edges:ot({...e,id:`edge-${crypto.randomUUID()}`},t.edges.map(jn)).map(e=>({id:e.id,source:e.source,target:e.target,sourcePort:e.sourceHandle===`true`||e.sourceHandle===`false`?e.sourceHandle:void 0}))}))},[]),De=(0,Z.useCallback)((e,t)=>{v(n=>({...n,nodes:n.nodes.map(n=>n.id===e?t(n):n)}))},[]),Oe=e=>{let t=`${e}-${crypto.randomUUID().slice(0,8)}`,n=Nn(e,t,_.nodes.length);v(e=>{let r=e.nodes.find(e=>e.id===S&&e.kind!==`output`),i=r?[{id:`edge-${crypto.randomUUID()}`,source:r.id,target:t}]:[];return{...e,nodes:[...e.nodes,n],edges:[...e.edges,...i]}}),J(e=>e+1),C(t)},ke=()=>{!he||he.kind===`input`||he.kind===`output`||(v(e=>({...e,nodes:e.nodes.filter(e=>e.id!==he.id),edges:e.edges.filter(e=>e.source!==he.id&&e.target!==he.id)})),J(e=>e+1),C(``))},Ae=(0,Z.useCallback)(async()=>{if(O.trim()){N(!0);try{let n=await xe({prompt:O,agentId:t,language:e===`zh`?`zh`:`en`,mode:r||_.nodes.length>3?`improve`:`create`,existingGraph:_}),i=r?.mode===`edit`?r.name:_n(n.name,_e);L(i===n.name?null:n.name),F(i===n.name?n:{...n,name:i}),z(!0),J(e=>e+1),C(n.graph.nodes.find(e=>e.kind===`agent`)?.id??``)}finally{N(!1)}}},[O,_e,_,r,e,t]);(0,Z.useEffect)(()=>{let e=r?.repairPrompt?.trim();!e||O.trim()!==e||M||P||ie.current===e||(ie.current=e,Ae())},[O,Ae,M,r?.repairPrompt,P]);let je=()=>{F(null),L(null),C(_.nodes.find(e=>e.kind===`agent`)?.id??``),J(e=>e+1)},Me=async()=>{if(!(!P||n||se.current)){se.current=!0;try{let e=await c({name:P.name,graph:P.graph,manifest:P.manifest,expectedRevision:W});if(!e)return;h(e.name),v(structuredClone(e.graph)),x(gn(e)),V(P.validation),G(e.revision),F(null),L(null),k(``),C(e.graph.nodes.find(e=>e.kind===`agent`)?.id??``),ae.current&&await Fe(ae.current).catch(()=>void 0)}catch{}finally{se.current=!1}}},Ne=async e=>{if(!Se||se.current)return;se.current=!0;let t={name:m,graph:_,manifest:y,expectedRevision:W};try{if(e)await u({...t,goal:A.trim()||y.description||m});else{let e=await c(t);if(!e)return;G(e.revision)}ae.current&&await Fe(ae.current).catch(()=>void 0)}catch{return}finally{se.current=!1}},Pe=async e=>{if(!(ne!==null||r?.mode!==`edit`)){q(e);try{let t=await Ye(r.name,e,W);v(t.graph),J(e=>e+1),x(gn(t)),G(t.revision),C(t.graph.nodes.find(e=>e.kind===`agent`)?.id??``),K(await Ke(r.name))}finally{q(null)}}};return(0,$.jsxs)(`main`,{className:`flex min-h-0 flex-1 flex-col overflow-hidden bg-surface-panel`,children:[(0,$.jsxs)(`header`,{className:`flex shrink-0 items-center gap-3 border-b border-edge px-4 py-3`,children:[(0,$.jsx)(s,{to:`/workflows`,className:l(`inline-flex size-9 shrink-0 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover hover:text-fg`,be.focusRingPanel),"aria-label":e===`zh`?`返回工作流`:`Back to workflows`,children:(0,$.jsx)(te,{className:`size-4`,"aria-hidden":!0})}),(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,$.jsx)(`h1`,{className:`text-base font-semibold text-fg`,children:r?.mode===`edit`?p.editTitle:p.createTitle}),(0,$.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:p.subtitle})]}),(0,$.jsx)(`span`,{className:l(`text-xs`,H===`error`?`text-danger`:`text-fg-subtle`),children:H===`saving`?p.savingDraft:H===`saved`?p.savedDraft:H===`error`?p.draftError:``})]}),o?(0,$.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center gap-2 border-b border-warning/30 bg-warning/5 px-4 py-2 text-sm text-fg`,children:[(0,$.jsx)(`span`,{className:`min-w-0 flex-1`,children:o.code===`WORKFLOW_NAME_EXISTS`?e===`zh`?`内部名称“${o.name}”已被使用。`:`The internal name “${o.name}” is already in use.`:e===`zh`?`这个工作流已更新到版本 ${o.currentRevision}。`:`This workflow has changed to revision ${o.currentRevision}.`}),o.code===`WORKFLOW_NAME_EXISTS`?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(Y,{variant:`secondary`,className:`h-8`,onClick:()=>{h(o.suggestedName),d()},children:e===`zh`?`使用 ${o.suggestedName}`:`Use ${o.suggestedName}`}),(0,$.jsx)(s,{className:`text-sm font-medium text-accent-fg hover:underline`,to:`/workflows/${encodeURIComponent(o.name)}`,children:e===`zh`?`打开已有工作流`:`Open existing`})]}):(0,$.jsx)(Y,{variant:`secondary`,className:`h-8`,onClick:f,children:e===`zh`?`加载最新版本`:`Load latest`})]}):null,!o&&ve?(0,$.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center gap-2 border-b border-warning/30 bg-warning/5 px-4 py-2 text-sm text-fg`,children:[(0,$.jsx)(`span`,{className:`min-w-0 flex-1`,children:e===`zh`?`内部名称“${m}”已被使用。`:`The internal name “${m}” is already in use.`}),(0,$.jsx)(Y,{variant:`secondary`,className:`h-8`,onClick:()=>h(ye),children:e===`zh`?`使用 ${ye}`:`Use ${ye}`})]}):null,!o&&!ve&&I&&P?(0,$.jsx)(`div`,{className:`shrink-0 border-b border-accent/20 bg-accent/5 px-4 py-2 text-sm text-fg-muted`,children:e===`zh`?`“${I}”已存在,方案将保存为“${P.name}”。`:`“${I}” already exists. This proposal will be saved as “${P.name}”.`}):null,R?(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-y-auto lg:flex-row lg:overflow-hidden`,children:[(0,$.jsxs)(`section`,{className:`flex min-h-[32rem] min-w-0 flex-1 flex-col bg-surface-base lg:min-h-0`,children:[(0,$.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center gap-2 border-b border-edge px-3 py-2`,children:[(0,$.jsxs)(`div`,{className:`mr-2 min-w-36`,children:[(0,$.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:p.flowTitle}),(0,$.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:p.stepCount(_.nodes.length)})]}),(0,$.jsxs)(Y,{variant:`secondary`,className:`h-8 rounded-lg text-xs`,disabled:!!P,onClick:()=>Oe(`agent`),children:[(0,$.jsx)(X,{className:`size-3.5`}),p.addAgent]}),(0,$.jsxs)(Y,{variant:`secondary`,className:`h-8 rounded-lg text-xs`,disabled:!!P,onClick:()=>Oe(`decision`),children:[(0,$.jsx)(Te,{className:`size-3.5`}),p.addDecision]}),(0,$.jsxs)(Y,{variant:`secondary`,className:`h-8 rounded-lg text-xs`,disabled:!!P,onClick:()=>Oe(`merge`),children:[(0,$.jsx)(g,{className:`size-3.5`}),p.addMerge]}),(0,$.jsx)(`span`,{className:`ml-auto text-xs text-fg-subtle`,children:p.canvasHint})]}),(0,$.jsx)(`div`,{className:`relative min-h-72 flex-1`,children:_.nodes.length>0?(0,$.jsxs)(lt,{"aria-label":p.flowAria,nodes:T,edges:me,nodeTypes:Dn,onNodesChange:D,onEdgesChange:we,onConnect:Ee,nodesDraggable:!P,nodesConnectable:!P,onNodeClick:(e,t)=>C(t.id),onNodeDragStart:(e,t)=>C(t.id),onNodeDragStop:(e,t)=>Ce(t),onInit:e=>{ce.current=e,window.requestAnimationFrame(()=>{e.fitView(yn)})},fitView:!0,fitViewOptions:yn,minZoom:.25,maxZoom:1.5,deleteKeyCode:null,proOptions:{hideAttribution:!0},children:[(0,$.jsx)(ft,{color:`var(--color-edge)`,gap:22,size:1}),(0,$.jsx)(ct,{showInteractive:!1,className:`!border-edge !bg-surface-panel !shadow-surface`})]}):(0,$.jsx)(`div`,{className:`flex h-full items-center justify-center px-6 text-center text-sm text-fg-muted`,children:p.emptyFlow})})]}),(0,$.jsx)(`aside`,{className:`flex w-full shrink-0 flex-col border-t border-edge bg-surface-panel lg:w-[22rem] lg:border-l lg:border-t-0`,children:(0,$.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-4`,children:P?(0,$.jsx)(Sn,{proposal:P,diff:ue,copy:p,saving:n,onAccept:()=>void Me(),onReject:je}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`section`,{children:[(0,$.jsx)(`label`,{className:`block text-xs font-medium text-fg`,htmlFor:`workflow-title`,children:p.humanTitle}),(0,$.jsx)(`input`,{id:`workflow-title`,value:y.title??``,onChange:e=>x(t=>({...t,title:e.target.value})),className:kn}),(0,$.jsx)(`label`,{className:`mt-3 block text-xs font-medium text-fg`,htmlFor:`workflow-description`,children:p.task}),(0,$.jsx)(`textarea`,{id:`workflow-description`,value:y.description??``,onChange:e=>x(t=>({...t,description:e.target.value})),className:`${kn} min-h-20 resize-y`}),(0,$.jsxs)(`details`,{className:`mt-4 border-t border-edge pt-3`,children:[(0,$.jsx)(`summary`,{className:`cursor-pointer text-xs font-medium text-fg-muted`,children:p.advanced}),(0,$.jsx)(`label`,{className:`mt-3 block text-xs font-medium text-fg`,htmlFor:`workflow-name`,children:p.workflowName}),(0,$.jsx)(`input`,{id:`workflow-name`,value:m,onChange:e=>h(Ln(e.target.value)),className:kn}),ve?(0,$.jsx)(`p`,{className:`mt-1 text-xs text-danger`,children:e===`zh`?`该内部名称已被使用,请换一个名称。`:`This internal name is already in use.`}):null,r?.mode===`edit`&&ee.length>0?(0,$.jsxs)(`div`,{className:`mt-4 border-t border-edge pt-3`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2 text-xs font-medium text-fg-muted`,children:[(0,$.jsx)(ge,{className:`size-3.5`}),p.versions,` · v`,W]}),(0,$.jsx)(`div`,{className:`mt-2 space-y-1`,children:ee.map(t=>(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-2 rounded-lg px-2 py-1.5 hover:bg-surface-hover`,children:[(0,$.jsxs)(`span`,{className:`min-w-0 text-xs text-fg-muted`,children:[`v`,t.revision,` · `,ze(t.createdAtMs,e)]}),t.revision===W?(0,$.jsx)(`span`,{className:`text-xs text-fg-subtle`,children:p.currentVersion}):(0,$.jsxs)(Y,{variant:`ghost`,className:`h-7 shrink-0 px-2 text-xs`,disabled:ne!==null,onClick:()=>void Pe(t.revision),children:[(0,$.jsx)(Be,{className:`size-3`}),ne===t.revision?p.restoring:p.restore]})]},t.revision))})]}):null]})]}),(0,$.jsx)(`div`,{className:`my-4 border-t border-edge`}),he?(0,$.jsx)(On,{node:he,copy:p,updateNode:De,onDelete:ke}):(0,$.jsx)(`div`,{className:`py-8 text-center text-sm text-fg-muted`,children:p.selectNode}),B&&!B.valid?(0,$.jsxs)(`section`,{className:`mt-4 rounded-lg border border-danger/30 bg-danger/5 p-3`,children:[(0,$.jsx)(`h3`,{className:`text-xs font-medium text-danger`,children:p.needsAttention}),(0,$.jsx)(`ul`,{className:`mt-2 space-y-1 text-xs text-danger`,children:B.errors.slice(0,5).map((e,t)=>(0,$.jsxs)(`li`,{children:[`• `,e.message]},`${e.code}-${t}`))})]}):null]})})})]}),(0,$.jsx)(`footer`,{className:`shrink-0 border-t border-edge bg-surface-panel p-3`,children:(0,$.jsxs)(`div`,{className:`flex flex-col gap-2 lg:flex-row lg:items-center`,children:[(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-center gap-2`,children:[(0,$.jsx)(Le,{className:`size-4 shrink-0 text-accent-fg`}),(0,$.jsx)(`input`,{value:O,onChange:e=>k(e.target.value),onKeyDown:e=>{e.key===`Enter`&&Ae()},placeholder:p.aiPlaceholder,className:`${kn} mt-0 flex-1`}),(0,$.jsx)(Y,{variant:`secondary`,className:`h-10 shrink-0`,disabled:!!P||M||!O.trim(),onClick:()=>void Ae(),children:M?p.designing:p.applyWithAi})]}),(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(`input`,{value:A,onChange:e=>j(e.target.value),placeholder:p.testGoal,className:`${kn} mt-0 w-52`}),(0,$.jsxs)(Y,{variant:`secondary`,disabled:!Se,onClick:()=>void Ne(!1),children:[(0,$.jsx)(pe,{className:`size-4`}),p.publish]}),(0,$.jsxs)(Y,{variant:`primary`,disabled:!Se,onClick:()=>void Ne(!0),children:[(0,$.jsx)(fe,{className:`size-4`}),p.publishAndRun]})]})]})})]}):(0,$.jsx)(xn,{copy:p,prompt:O,generating:M,onPromptChange:k,onGenerate:()=>void Ae(),onManual:()=>z(!0)})]})}function xn(e){let t=(0,Q.c)(38),{copy:n,prompt:r,generating:i,onPromptChange:a,onGenerate:o,onManual:s}=e,c;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,$.jsx)(`div`,{className:`flex size-11 items-center justify-center rounded-2xl bg-accent-soft text-accent-fg`,children:(0,$.jsx)(Le,{className:`size-5`})}),t[0]=c):c=t[0];let l;t[1]===n.introTitle?l=t[2]:(l=(0,$.jsx)(`h2`,{className:`mt-5 text-2xl font-semibold text-fg`,children:n.introTitle}),t[1]=n.introTitle,t[2]=l);let u;t[3]===n.introDescription?u=t[4]:(u=(0,$.jsx)(`p`,{className:`mt-2 text-sm leading-6 text-fg-muted`,children:n.introDescription}),t[3]=n.introDescription,t[4]=u);let d;t[5]===a?d=t[6]:(d=e=>a(e.target.value),t[5]=a,t[6]=d);let f;t[7]!==n.introPlaceholder||t[8]!==r||t[9]!==d?(f=(0,$.jsx)(`textarea`,{value:r,onChange:d,placeholder:n.introPlaceholder,className:`${kn} mt-6 h-auto min-h-32 resize-y py-3 text-base leading-6`}),t[7]=n.introPlaceholder,t[8]=r,t[9]=d,t[10]=f):f=t[10];let p;if(t[11]!==n.examples||t[12]!==a){let e;t[14]===a?e=t[15]:(e=e=>(0,$.jsx)(`button`,{type:`button`,className:`rounded-full border border-edge bg-surface-panel px-3 py-1.5 text-xs text-fg-muted hover:bg-surface-hover hover:text-fg`,onClick:()=>a(e),children:e},e),t[14]=a,t[15]=e),p=n.examples.map(e),t[11]=n.examples,t[12]=a,t[13]=p}else p=t[13];let m;t[16]===p?m=t[17]:(m=(0,$.jsx)(`div`,{className:`mt-3 flex flex-wrap gap-2`,children:p}),t[16]=p,t[17]=m);let h;t[18]!==i||t[19]!==r?(h=!r.trim()||i,t[18]=i,t[19]=r,t[20]=h):h=t[20];let g;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,$.jsx)(Le,{className:`size-4`}),t[21]=g):g=t[21];let _=i?n.designing:n.designWorkflow,v;t[22]!==o||t[23]!==_||t[24]!==h?(v=(0,$.jsxs)(Y,{variant:`primary`,disabled:h,onClick:o,children:[g,_]}),t[22]=o,t[23]=_,t[24]=h,t[25]=v):v=t[25];let y;t[26]!==n.manualStart||t[27]!==s?(y=(0,$.jsx)(Y,{variant:`ghost`,onClick:s,children:n.manualStart}),t[26]=n.manualStart,t[27]=s,t[28]=y):y=t[28];let b;t[29]!==v||t[30]!==y?(b=(0,$.jsxs)(`div`,{className:`mt-6 flex flex-wrap items-center gap-3`,children:[v,y]}),t[29]=v,t[30]=y,t[31]=b):b=t[31];let x;return t[32]!==b||t[33]!==l||t[34]!==u||t[35]!==f||t[36]!==m?(x=(0,$.jsx)(`section`,{className:`flex min-h-0 flex-1 items-center justify-center overflow-y-auto bg-surface-base px-5 py-10`,children:(0,$.jsxs)(`div`,{className:`w-full max-w-2xl`,children:[c,l,u,f,m,b]})}),t[32]=b,t[33]=l,t[34]=u,t[35]=f,t[36]=m,t[37]=x):x=t[37],x}function Sn(e){let t=(0,Q.c)(74),{proposal:n,diff:r,copy:i,saving:a,onAccept:o,onReject:s}=e,l;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,$.jsx)(`span`,{className:`flex size-8 shrink-0 items-center justify-center rounded-xl bg-accent-soft text-accent-fg`,children:(0,$.jsx)(Le,{className:`size-4`})}),t[0]=l):l=t[0];let u;t[1]===i.proposalTitle?u=t[2]:(u=(0,$.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:i.proposalTitle}),t[1]=i.proposalTitle,t[2]=u);let d;t[3]===i.proposalHint?d=t[4]:(d=(0,$.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:i.proposalHint}),t[3]=i.proposalHint,t[4]=d);let f;t[5]!==u||t[6]!==d?(f=(0,$.jsxs)(`div`,{className:`flex items-start gap-2`,children:[l,(0,$.jsxs)(`div`,{className:`min-w-0`,children:[u,d]})]}),t[5]=u,t[6]=d,t[7]=f):f=t[7];let p=n.manifest.title||n.name,m;t[8]===p?m=t[9]:(m=(0,$.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:p}),t[8]=p,t[9]=m);let h=n.explanation||n.manifest.description,g;t[10]===h?g=t[11]:(g=(0,$.jsx)(`p`,{className:`mt-2 text-sm leading-6 text-fg-muted`,children:h}),t[10]=h,t[11]=g);let _;t[12]===i.added?_=t[13]:(_=(0,$.jsx)(`dt`,{className:`text-fg-subtle`,children:i.added}),t[12]=i.added,t[13]=_);let v;t[14]===r.addedIds.length?v=t[15]:(v=(0,$.jsx)(`dd`,{className:`mt-1 font-semibold text-success`,children:r.addedIds.length}),t[14]=r.addedIds.length,t[15]=v);let y;t[16]!==v||t[17]!==_?(y=(0,$.jsxs)(`div`,{className:`rounded-lg bg-success-soft p-2`,children:[_,v]}),t[16]=v,t[17]=_,t[18]=y):y=t[18];let b;t[19]===i.changed?b=t[20]:(b=(0,$.jsx)(`dt`,{className:`text-fg-subtle`,children:i.changed}),t[19]=i.changed,t[20]=b);let x=r.changedIds.length+r.connectionChanges,S;t[21]===x?S=t[22]:(S=(0,$.jsx)(`dd`,{className:`mt-1 font-semibold text-accent-fg`,children:x}),t[21]=x,t[22]=S);let C;t[23]!==b||t[24]!==S?(C=(0,$.jsxs)(`div`,{className:`rounded-lg bg-accent-soft p-2`,children:[b,S]}),t[23]=b,t[24]=S,t[25]=C):C=t[25];let w;t[26]===i.removed?w=t[27]:(w=(0,$.jsx)(`dt`,{className:`text-fg-subtle`,children:i.removed}),t[26]=i.removed,t[27]=w);let T;t[28]===r.removedIds.length?T=t[29]:(T=(0,$.jsx)(`dd`,{className:`mt-1 font-semibold text-danger`,children:r.removedIds.length}),t[28]=r.removedIds.length,t[29]=T);let E;t[30]!==w||t[31]!==T?(E=(0,$.jsxs)(`div`,{className:`rounded-lg bg-danger/5 p-2`,children:[w,T]}),t[30]=w,t[31]=T,t[32]=E):E=t[32];let D;t[33]!==y||t[34]!==C||t[35]!==E?(D=(0,$.jsxs)(`dl`,{className:`mt-3 grid grid-cols-3 gap-2 text-center text-xs`,children:[y,C,E]}),t[33]=y,t[34]=C,t[35]=E,t[36]=D):D=t[36];let O;t[37]!==D||t[38]!==m||t[39]!==g?(O=(0,$.jsxs)(`div`,{className:`mt-4 rounded-xl border border-edge bg-surface-base/50 p-3`,children:[m,g,D]}),t[37]=D,t[38]=m,t[39]=g,t[40]=O):O=t[40];let k;t[41]!==i.assumptions||t[42]!==n.assumptions?(k=n.assumptions.length?(0,$.jsx)(wn,{title:i.assumptions,items:n.assumptions}):null,t[41]=i.assumptions,t[42]=n.assumptions,t[43]=k):k=t[43];let A;t[44]!==i.risks||t[45]!==n.risks?(A=n.risks.length?(0,$.jsx)(wn,{title:i.risks,items:n.risks}):null,t[44]=i.risks,t[45]=n.risks,t[46]=A):A=t[46];let j;t[47]!==i.permissions||t[48]!==n.permissionsSummary?(j=n.permissionsSummary.length?(0,$.jsx)(wn,{title:i.permissions,items:n.permissionsSummary}):null,t[47]=i.permissions,t[48]=n.permissionsSummary,t[49]=j):j=t[49];let M;t[50]!==n.validation.errors||t[51]!==n.validation.valid?(M=n.validation.valid?null:(0,$.jsx)(`div`,{className:`mt-4 rounded-xl border border-danger/30 bg-danger/5 p-3 text-xs text-danger`,children:n.validation.errors.slice(0,4).map(Cn)}),t[50]=n.validation.errors,t[51]=n.validation.valid,t[52]=M):M=t[52];let N=a||!n.validation.valid,P;t[53]===Symbol.for(`react.memo_cache_sentinel`)?(P=(0,$.jsx)(c,{className:`size-4`}),t[53]=P):P=t[53];let F=a?i.savingProposal:i.acceptAndSave,I;t[54]!==o||t[55]!==N||t[56]!==F?(I=(0,$.jsxs)(Y,{variant:`primary`,disabled:N,onClick:o,children:[P,F]}),t[54]=o,t[55]=N,t[56]=F,t[57]=I):I=t[57];let L;t[58]===Symbol.for(`react.memo_cache_sentinel`)?(L=(0,$.jsx)(he,{className:`size-4`}),t[58]=L):L=t[58];let R;t[59]!==i.rejectProposal||t[60]!==s||t[61]!==a?(R=(0,$.jsxs)(Y,{variant:`ghost`,disabled:a,onClick:s,children:[L,i.rejectProposal]}),t[59]=i.rejectProposal,t[60]=s,t[61]=a,t[62]=R):R=t[62];let z;t[63]!==I||t[64]!==R?(z=(0,$.jsxs)(`div`,{className:`mt-5 grid gap-2`,children:[I,R]}),t[63]=I,t[64]=R,t[65]=z):z=t[65];let B;return t[66]!==O||t[67]!==k||t[68]!==A||t[69]!==j||t[70]!==M||t[71]!==z||t[72]!==f?(B=(0,$.jsxs)(`section`,{children:[f,O,k,A,j,M,z]}),t[66]=O,t[67]=k,t[68]=A,t[69]=j,t[70]=M,t[71]=z,t[72]=f,t[73]=B):B=t[73],B}function Cn(e){return(0,$.jsxs)(`p`,{children:[`• `,e.message]},`${e.code}:${e.message}`)}function wn(e){let t=(0,Q.c)(9),{title:n,items:r}=e,i;t[0]===n?i=t[1]:(i=(0,$.jsx)(`h3`,{className:`text-xs font-semibold uppercase tracking-wide text-fg-subtle`,children:n}),t[0]=n,t[1]=i);let a;t[2]===r?a=t[3]:(a=r.slice(0,4).map(Tn),t[2]=r,t[3]=a);let o;t[4]===a?o=t[5]:(o=(0,$.jsx)(`ul`,{className:`mt-2 space-y-1 text-xs leading-5 text-fg-muted`,children:a}),t[4]=a,t[5]=o);let s;return t[6]!==i||t[7]!==o?(s=(0,$.jsxs)(`section`,{className:`mt-4`,children:[i,o]}),t[6]=i,t[7]=o,t[8]=s):s=t[8],s}function Tn(e){return(0,$.jsxs)(`li`,{children:[`• `,e]},e)}function En(e){let t=(0,Q.c)(34),{data:n,selected:r}=e,i=n.workflowNode,a=n.diffState,o;t[0]===i.kind?o=t[1]:(o=i.kind===`input`?(0,$.jsx)(Re,{}):i.kind===`agent`?(0,$.jsx)(X,{}):i.kind===`decision`?(0,$.jsx)(Te,{}):i.kind===`merge`?(0,$.jsx)(g,{}):(0,$.jsx)(fe,{}),t[0]=i.kind,t[1]=o);let s=o,c=r?`border-accent ring-2 ring-accent/20`:`border-edge`,u=a===`added`&&`border-success ring-2 ring-success/15`,d=a===`changed`&&`border-accent ring-2 ring-accent/15`,f=a===`removed`&&`border-dashed border-danger opacity-55`,p;t[2]!==c||t[3]!==u||t[4]!==d||t[5]!==f?(p=l(`w-52 rounded-xl border bg-surface-panel p-3 shadow-surface transition-colors`,c,u,d,f),t[2]=c,t[3]=u,t[4]=d,t[5]=f,t[6]=p):p=t[6];let m;t[7]===i.kind?m=t[8]:(m=i.kind===`input`?null:(0,$.jsx)(ut,{type:`target`,position:st.Left,className:`!size-2.5 !border-2 !border-surface-panel !bg-fg-subtle`}),t[7]=i.kind,t[8]=m);let h;t[9]===s?h=t[10]:(h=(0,$.jsx)(`span`,{className:`mt-0.5 [&>svg]:size-4 text-accent-fg`,children:s}),t[9]=s,t[10]=h);let _;t[11]===i.title?_=t[12]:(_=(0,$.jsx)(`strong`,{className:`block truncate text-sm font-medium text-fg`,children:i.title}),t[11]=i.title,t[12]=_);let v;t[13]!==i.description||t[14]!==i.kind?(v=i.description||Rn(i.kind),t[13]=i.description,t[14]=i.kind,t[15]=v):v=t[15];let y;t[16]===v?y=t[17]:(y=(0,$.jsx)(`span`,{className:`mt-1 block line-clamp-2 text-xs leading-4 text-fg-muted`,children:v}),t[16]=v,t[17]=y);let b;t[18]!==y||t[19]!==_?(b=(0,$.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[_,y]}),t[18]=y,t[19]=_,t[20]=b):b=t[20];let x;t[21]===a?x=t[22]:(x=a?(0,$.jsx)(`span`,{className:l(`rounded-full px-1.5 py-0.5 text-[10px] font-medium`,a===`added`?`bg-success-soft text-success`:a===`removed`?`bg-danger/10 text-danger`:`bg-accent-soft text-accent-fg`),children:a===`added`?`+`:a===`removed`?`−`:`Δ`}):null,t[21]=a,t[22]=x);let S;t[23]!==b||t[24]!==x||t[25]!==h?(S=(0,$.jsxs)(`div`,{className:`flex items-start gap-2`,children:[h,b,x]}),t[23]=b,t[24]=x,t[25]=h,t[26]=S):S=t[26];let C;t[27]===i.kind?C=t[28]:(C=i.kind===`decision`?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(ut,{id:`true`,type:`source`,position:st.Right,style:{top:`38%`},className:`!size-2.5 !border-2 !border-surface-panel !bg-success`}),(0,$.jsx)(ut,{id:`false`,type:`source`,position:st.Right,style:{top:`70%`},className:`!size-2.5 !border-2 !border-surface-panel !bg-danger`})]}):i.kind===`output`?null:(0,$.jsx)(ut,{type:`source`,position:st.Right,className:`!size-2.5 !border-2 !border-surface-panel !bg-accent`}),t[27]=i.kind,t[28]=C);let w;return t[29]!==S||t[30]!==C||t[31]!==p||t[32]!==m?(w=(0,$.jsxs)(`div`,{className:p,children:[m,S,C]}),t[29]=S,t[30]=C,t[31]=p,t[32]=m,t[33]=w):w=t[33],w}var Dn={workflow:En};function On(e){let t=(0,Q.c)(71),{node:n,copy:r,updateNode:i,onDelete:a}=e,o;t[0]!==n.id||t[1]!==i?(o=e=>i(n.id,t=>({...t,...e})),t[0]=n.id,t[1]=i,t[2]=o):o=t[2];let s=o,c;t[3]!==n.id||t[4]!==i?(c=e=>i(n.id,t=>({...t,config:{...t.config,...e}})),t[3]=n.id,t[4]=i,t[5]=c):c=t[5];let l=c,u;t[6]===r.stepSettings?u=t[7]:(u=(0,$.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:r.stepSettings}),t[6]=r.stepSettings,t[7]=u);let d;t[8]!==r.remove||t[9]!==n.kind||t[10]!==a?(d=n.kind!==`input`&&n.kind!==`output`?(0,$.jsxs)(Y,{variant:`ghost`,className:`h-8 px-2 text-danger`,onClick:a,children:[(0,$.jsx)(H,{className:`size-3.5`}),r.remove]}):null,t[8]=r.remove,t[9]=n.kind,t[10]=a,t[11]=d):d=t[11];let f;t[12]!==u||t[13]!==d?(f=(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[u,d]}),t[12]=u,t[13]=d,t[14]=f):f=t[14];let p;t[15]===r.stepName?p=t[16]:(p=(0,$.jsx)(`label`,{className:`mt-3 block text-xs font-medium text-fg`,htmlFor:`node-title`,children:r.stepName}),t[15]=r.stepName,t[16]=p);let m;t[17]===s?m=t[18]:(m=e=>s({title:e.target.value}),t[17]=s,t[18]=m);let h;t[19]!==n.title||t[20]!==m?(h=(0,$.jsx)(`input`,{id:`node-title`,value:n.title,onChange:m,className:kn}),t[19]=n.title,t[20]=m,t[21]=h):h=t[21];let g;t[22]===r.stepPurpose?g=t[23]:(g=(0,$.jsx)(`label`,{className:`mt-3 block text-xs font-medium text-fg`,htmlFor:`node-description`,children:r.stepPurpose}),t[22]=r.stepPurpose,t[23]=g);let _=n.description??``,v;t[24]===s?v=t[25]:(v=e=>s({description:e.target.value}),t[24]=s,t[25]=v);let y;t[26]!==_||t[27]!==v?(y=(0,$.jsx)(`textarea`,{id:`node-description`,value:_,onChange:v,className:`${kn} min-h-16 resize-y`}),t[26]=_,t[27]=v,t[28]=y):y=t[28];let b;t[29]!==r.advanced||t[30]!==r.defaultModel||t[31]!==r.instructions||t[32]!==r.model||t[33]!==n.config||t[34]!==n.kind||t[35]!==l?(b=n.kind===`agent`?(0,$.jsx)($.Fragment,{children:(0,$.jsxs)(`details`,{className:`mt-4 border-t border-edge pt-3`,children:[(0,$.jsx)(`summary`,{className:`cursor-pointer text-xs font-medium text-fg-muted`,children:r.advanced}),(0,$.jsx)(`label`,{className:`mt-3 block text-xs font-medium text-fg`,htmlFor:`node-prompt`,children:r.instructions}),(0,$.jsx)(`textarea`,{id:`node-prompt`,value:String(n.config.prompt??``),onChange:e=>l({prompt:e.target.value}),className:`${kn} min-h-36 resize-y`}),(0,$.jsx)(`label`,{className:`mt-3 block text-xs font-medium text-fg`,htmlFor:`node-model`,children:r.model}),(0,$.jsx)(`input`,{id:`node-model`,value:String(n.config.model??``),onChange:e=>l({model:e.target.value||void 0}),placeholder:r.defaultModel,className:kn})]})}):null,t[29]=r.advanced,t[30]=r.defaultModel,t[31]=r.instructions,t[32]=r.model,t[33]=n.config,t[34]=n.kind,t[35]=l,t[36]=b):b=t[36];let x;t[37]!==r.compareValue||t[38]!==r.condition||t[39]!==r.contains||t[40]!==r.equals||t[41]!==r.exists||t[42]!==r.notEquals||t[43]!==r.valuePath||t[44]!==n.config||t[45]!==n.kind||t[46]!==l?(x=n.kind===`decision`?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`label`,{className:`mt-3 block text-xs font-medium text-fg`,htmlFor:`decision-path`,children:r.valuePath}),(0,$.jsx)(`input`,{id:`decision-path`,value:n.config.rule?.path??``,onChange:e=>l({rule:{...n.config.rule??{operator:`exists`},path:e.target.value}}),placeholder:`result.approved`,className:kn}),(0,$.jsx)(`label`,{className:`mt-3 block text-xs font-medium text-fg`,id:`decision-operator-label`,children:r.condition}),(0,$.jsx)(q,{value:n.config.rule?.operator??`exists`,placeholder:r.condition,allowEmpty:!1,ariaLabelledBy:`decision-operator-label`,options:[{value:`exists`,label:r.exists},{value:`equals`,label:r.equals},{value:`not_equals`,label:r.notEquals},{value:`contains`,label:r.contains}],onChange:e=>l({rule:{...n.config.rule??{path:``},operator:e}})}),n.config.rule?.operator===`exists`?null:(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`label`,{className:`mt-3 block text-xs font-medium text-fg`,htmlFor:`decision-value`,children:r.compareValue}),(0,$.jsx)(`input`,{id:`decision-value`,value:String(n.config.rule?.value??``),onChange:e=>l({rule:{...n.config.rule,value:e.target.value}}),className:kn})]})]}):null,t[37]=r.compareValue,t[38]=r.condition,t[39]=r.contains,t[40]=r.equals,t[41]=r.exists,t[42]=r.notEquals,t[43]=r.valuePath,t[44]=n.config,t[45]=n.kind,t[46]=l,t[47]=x):x=t[47];let S;t[48]!==r.combineAs||t[49]!==r.listResults||t[50]!==r.namedResults||t[51]!==n.config||t[52]!==n.kind||t[53]!==l?(S=n.kind===`merge`?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`label`,{className:`mt-3 block text-xs font-medium text-fg`,id:`merge-mode-label`,children:r.combineAs}),(0,$.jsx)(q,{value:String(n.config.mode??`object`),placeholder:r.combineAs,allowEmpty:!1,ariaLabelledBy:`merge-mode-label`,options:[{value:`object`,label:r.namedResults},{value:`array`,label:r.listResults}],onChange:e=>l({mode:e})})]}):null,t[48]=r.combineAs,t[49]=r.listResults,t[50]=r.namedResults,t[51]=n.config,t[52]=n.kind,t[53]=l,t[54]=S):S=t[54];let C;t[55]!==r.autoSummary||t[56]!==r.summaryTemplate||t[57]!==n.config||t[58]!==n.kind||t[59]!==l?(C=n.kind===`output`?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`label`,{className:`mt-3 block text-xs font-medium text-fg`,htmlFor:`output-summary`,children:r.summaryTemplate}),(0,$.jsx)(`textarea`,{id:`output-summary`,value:String(n.config.summary??``),onChange:e=>l({summary:e.target.value||void 0}),placeholder:r.autoSummary,className:`${kn} min-h-20 resize-y`})]}):null,t[55]=r.autoSummary,t[56]=r.summaryTemplate,t[57]=n.config,t[58]=n.kind,t[59]=l,t[60]=C):C=t[60];let w;return t[61]!==y||t[62]!==b||t[63]!==x||t[64]!==S||t[65]!==C||t[66]!==f||t[67]!==p||t[68]!==h||t[69]!==g?(w=(0,$.jsxs)(`section`,{children:[f,p,h,g,y,b,x,S,C]}),t[61]=y,t[62]=b,t[63]=x,t[64]=S,t[65]=C,t[66]=f,t[67]=p,t[68]=h,t[69]=g,t[70]=w):w=t[70],w}var kn=`mt-1 block h-10 w-full rounded-lg border border-edge bg-surface-subtle px-3 text-sm text-fg outline-none placeholder:text-fg-subtle focus:border-edge-strong`;function An(e,t=!1,n){return{id:e.id,type:`workflow`,position:e.position,selected:t,data:{workflowNode:e,diffState:n}}}function jn(e){return{id:e.id,source:e.source,target:e.target,sourceHandle:e.sourcePort===`true`||e.sourcePort===`false`?e.sourcePort:void 0,markerEnd:{type:at.ArrowClosed},style:{stroke:`var(--color-fg-subtle)`,strokeWidth:1.5}}}function Mn(){return{schemaVersion:1,nodes:[{id:`input`,kind:`input`,title:`Input`,description:`What the user provides`,position:{x:0,y:120},config:{}},{id:`agent-1`,kind:`agent`,title:`Do the work`,description:`Understand and complete the request`,phaseId:`work`,position:{x:300,y:120},config:{prompt:`Complete this goal: {{goal}}
|
|
1
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{d as i,f as a,l as o,t as s}from"./chunk-KS7C4IRE-BMhrPKJC.js";import{t as c}from"./check-DUBLcKHA.js";import{t as l}from"./cn-JdwAhgNB.js";import{t as u}from"./copy-to-clipboard-HOJ79TWv.js";import{t as d}from"./messages-DQ5X6cXp.js";import{l as f,n as p}from"./locale-store-Bjvw7jtg.js";import{i as m}from"./vendor-swr-BIWyz7Rc.js";import{$ as h,$c as g,A as _,B as v,Bc as y,C as b,Cs as x,Da as S,Ds as C,E as w,F as T,Go as E,H as D,I as O,J as k,K as A,Kc as j,L as M,La as N,Ll as P,M as F,N as I,Ni as L,Ns as R,P as z,Pc as B,Pl as V,Ps as H,Q as U,R as W,Rl as G,S as ee,Su as te,T as K,U as ne,Uo as q,V as re,W as ie,Wo as ae,X as oe,Xl as se,Y as ce,Yc as le,Z as J,Zc as ue,_ as de,_c as fe,_s as Y,ac as pe,b as me,bs as he,cl as ge,ct as _e,d as ve,dr as ye,ds as be,f as xe,fu as X,g as Se,h as Ce,hc as we,hl as Te,i as Ee,ic as De,it as Oe,iu as ke,jl as Ae,lt as je,m as Me,ot as Ne,ou as Pe,p as Fe,q as Ie,qs as Le,rl as Re,rt as ze,sc as Be,st as Ve,tt as He,u as Ue,ut as We,uu as Ge,v as Ke,vr as qe,w as Je,x as Ye,xc as Xe,y as Ze,yi as Qe,z as $e}from"./index-Cb9y6tVR.js";import{t as et}from"./page-tabs-D6YJ6_l_.js";import{i as tt,r as nt,t as rt}from"./workflow-run-setup-panel-D3uCmyag.js";import{a as it,c as at,i as ot,l as st,n as ct,o as lt,r as ut,s as dt,t as ft}from"./style-TIDOdKy0.js";var Z=e(t(),1),Q=n(),pt=[`queued`,`running`,`succeeded`,`attention`],mt=new Set([`failed`,`timeout`,`cancelled`]);function ht(e){return e.metadata?.sessionKey?.trim()||null}function gt(e,t){return e.length<=t?e:`${e.slice(0,t-1)}…`}function _t(e,t){if(!e||typeof e!=`object`)return null;let n=e;for(let e of t){let t=n[e];if(typeof t==`string`&&t.trim())return t.trim()}return null}function vt(e,t=90){let n=e.metadata?.input?.goal?.trim()||(typeof e.metadata?.input?.payload==`string`?e.metadata.input.payload.trim():null)||_t(e.metadata?.input?.payload,[`query`,`goal`,`prompt`,`input`,`message`])||_t(e.metadata?.input?.variables,[`query`,`goal`,`prompt`,`input`,`message`]);return n?gt(n,t):null}function yt(e,t=90){return vt(e,t)??gt(e.title?.trim()||e.definitionId,t)}function bt(e,t=44){return gt(e.title?.trim()||e.definitionId,t)}function xt(e,t){let n=t.trim().toLowerCase();return n?[vt(e,500),e.title,e.definitionId,e.id].filter(Boolean).join(` `).toLowerCase().includes(n):!0}function St(e,t){let n=t.workflowFilterId.trim();return e.filter(e=>n&&e.definitionId!==n||!$e(e,t.triggerFilter??`all`)?!1:xt(e,t.searchQuery))}function Ct(e){return e.completedAtMs??e.createdAtMs}function wt(e,t){return e.status===`queued`?`queued`:e.status===`running`?`running`:e.status===`succeeded`?`succeeded`:mt.has(e.status)?`attention`:null}function Tt(e,t){let n=[...t];return e===`queued`?n.sort((e,t)=>e.createdAtMs-t.createdAtMs):e===`running`?n.sort((e,t)=>(t.startedAtMs??t.createdAtMs)-(e.startedAtMs??e.createdAtMs)):n.sort((e,t)=>Ct(t)-Ct(e))}function Et(e,t){let n={queued:[],running:[],succeeded:[],attention:[]};for(let r of e){let e=wt(r,t);e&&n[e].push(r)}return pt.map(e=>{if(e===`succeeded`){let t=Tt(`succeeded`,n.succeeded);return{id:e,runs:t,totalInWindow:t.length}}return{id:e,runs:Tt(e,n[e])}})}function Dt(e,t,n){let r=Math.round((t-e)/1e3);if(r<60)return Oe(-r,`second`,n);let i=Math.round(r/60);if(i<60)return Oe(-i,`minute`,n);let a=Math.round(i/60);return a<48?Oe(-a,`hour`,n):Oe(-Math.round(a/24),`day`,n)}function Ot(e){return e.status===`queued`||e.status===`running`}function kt(e){return e.status===`failed`||e.status===`timeout`||e.status===`cancelled`}var $=r(),At=(0,Z.memo)(function(e){let t=(0,Q.c)(76),{run:n,language:r,localeTag:i,nowMs:a,selected:o,onOpen:s,onOpenChat:c,onCancel:u,onRetry:f}=e,p=d(r).workflows,[m,h]=(0,Z.useState)(!1),g;t[0]===n?g=t[1]:(g=ht(n),t[0]=n,t[1]=g);let _=!g,y;t[2]===n?y=t[3]:(y=Ot(n),t[2]=n,t[3]=y);let b=y,x=n.status===`running`||n.status===`queued`,S;t[4]!==n.metrics.agentCount||t[5]!==n.metrics.doneAgentCount?(S=n.metrics.agentCount>0?Math.round(n.metrics.doneAgentCount/n.metrics.agentCount*100):0,t[4]=n.metrics.agentCount,t[5]=n.metrics.doneAgentCount,t[6]=S):S=t[6];let C=S,w=n.metrics.errorAgentCount>0,T=n.startedAtMs??n.createdAtMs,E=z(b?a-T:n.metrics.durationMs),D=O(p.taskArtifacts,{count:n.metrics.artifactCount}),k;t[7]===n?k=t[8]:(k=yt(n),t[7]=n,t[8]=k);let A=k,j;t[9]===n?j=t[10]:(j=bt(n),t[9]=n,t[10]=j);let M=j,N;t[11]!==s||t[12]!==n?(N=()=>{s(n)},t[11]=s,t[12]=n,t[13]=N):N=t[13];let P=N,F;t[14]!==_||t[15]!==c||t[16]!==n?(F=()=>{_||c(n)},t[14]=_,t[15]=c,t[16]=n,t[17]=F):F=t[17];let I=F,L=o&&`ring-1 ring-accent/30`,B;t[18]===L?B=t[19]:(B=l(`group relative min-h-24 overflow-hidden rounded-lg bg-surface-panel p-3 shadow-surface transition-colors`,L,`hover:bg-surface-hover`),t[18]=L,t[19]=B);let V;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(V=l(`w-full text-left`,be.focusRingPanel),t[20]=V):V=t[20];let H;t[21]===A?H=t[22]:(H=(0,$.jsx)(`div`,{className:`line-clamp-2 text-sm font-medium leading-5 text-fg`,children:A}),t[21]=A,t[22]=H);let U;t[23]===M?U=t[24]:(U=(0,$.jsx)(`div`,{className:`mt-1 truncate text-[11px] font-medium text-fg-muted`,children:M}),t[23]=M,t[24]=U);let W;t[25]!==H||t[26]!==U?(W=(0,$.jsxs)(`div`,{className:`min-w-0`,children:[H,U]}),t[25]=H,t[26]=U,t[27]=W):W=t[27];let G;t[28]===n.status?G=t[29]:(G=l(`shrink-0 rounded-full px-2 py-0.5 text-[10px] font-semibold shadow-sm`,v(n.status)),t[28]=n.status,t[29]=G);let ee;t[30]!==i||t[31]!==a||t[32]!==T?(ee=Dt(T,a,i),t[30]=i,t[31]=a,t[32]=T,t[33]=ee):ee=t[33];let te;t[34]===ee?te=t[35]:(te=(0,$.jsx)(`span`,{children:ee}),t[34]=ee,t[35]=te);let K=E===`—`?null:(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`span`,{"aria-hidden":!0,children:`·`}),(0,$.jsx)(`span`,{children:O(p.taskElapsed,{duration:E})})]}),ne;t[36]!==te||t[37]!==K?(ne=(0,$.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-1.5 text-[11px] text-fg-subtle`,children:[te,K]}),t[36]=te,t[37]=K,t[38]=ne):ne=t[38];let q=n.metrics.artifactCount>0?(0,$.jsx)(`span`,{className:`rounded-full bg-surface-hover px-2 py-0.5 font-medium text-fg-muted`,children:D}):null,re=o?(0,$.jsx)(`span`,{className:`font-medium text-accent-fg`,children:p.taskOpenDetails}):null,ie;t[39]!==q||t[40]!==re?(ie=(0,$.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-2 text-[11px] text-fg-subtle`,children:[q,re]}),t[39]=q,t[40]=re,t[41]=ie):ie=t[41];let ae=_&&`cursor-not-allowed text-fg-disabled hover:bg-transparent`,oe;t[42]===ae?oe=t[43]:(oe=l(`rounded-md px-2 py-1 text-xs font-medium`,`text-accent-fg hover:bg-accent-soft`,be.focusRingPanel,ae),t[42]=ae,t[43]=oe);let se;t[44]!==_||t[45]!==I||t[46]!==p.continueInChat||t[47]!==oe?(se=(0,$.jsx)(`button`,{type:`button`,className:oe,disabled:_,onClick:I,children:p.continueInChat}),t[44]=_,t[45]=I,t[46]=p.continueInChat,t[47]=oe,t[48]=se):se=t[48];let ce;t[49]===Symbol.for(`react.memo_cache_sentinel`)?(ce=l(`rounded-md px-2 py-1 text-xs font-medium text-fg-muted hover:bg-surface-hover hover:text-fg`,be.focusRingPanel),t[49]=ce):ce=t[49];let le;t[50]!==P||t[51]!==p.taskOpenDetails?(le=(0,$.jsx)(`button`,{type:`button`,className:ce,onClick:P,children:p.taskOpenDetails}),t[50]=P,t[51]=p.taskOpenDetails,t[52]=le):le=t[52];let J;t[53]!==se||t[54]!==le?(J=(0,$.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-2 border-t border-edge-subtle pt-2`,children:[se,le]}),t[53]=se,t[54]=le,t[55]=J):J=t[55];let ue;t[56]===h?ue=t[57]:(ue=()=>h(Mt),t[56]=h,t[57]=ue);let de;t[58]===Symbol.for(`react.memo_cache_sentinel`)?(de=(0,$.jsx)(Ae,{className:`size-4`,"aria-hidden":!0}),t[58]=de):de=t[58];let fe;t[59]!==p.taskActionsAria||t[60]!==m||t[61]!==ue?(fe=(0,$.jsx)(Y,{variant:`ghost`,className:`size-7 p-0 opacity-0 group-hover:opacity-100 group-focus-within:opacity-100`,"aria-label":p.taskActionsAria,"aria-expanded":m,onClick:ue,children:de}),t[59]=p.taskActionsAria,t[60]=m,t[61]=ue,t[62]=fe):fe=t[62];let pe;t[63]!==b||t[64]!==p.cancel||t[65]!==p.rerun||t[66]!==p.taskCloseMenu||t[67]!==m||t[68]!==u||t[69]!==f||t[70]!==n||t[71]!==h?(pe=m?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`button`,{type:`button`,className:`fixed inset-0 z-10 cursor-default`,"aria-label":p.taskCloseMenu,onClick:()=>h(!1)}),(0,$.jsxs)(`div`,{className:`absolute right-0 z-20 mt-1 min-w-36 rounded-lg border border-edge bg-surface-panel py-1 shadow-surface`,children:[b?(0,$.jsx)(jt,{label:p.cancel,tone:`danger`,onClick:()=>{h(!1),u(n.id)}}):null,kt(n)?(0,$.jsx)(jt,{label:p.rerun,onClick:()=>{h(!1),f(n.id)}}):null]})]}):null,t[63]=b,t[64]=p.cancel,t[65]=p.rerun,t[66]=p.taskCloseMenu,t[67]=m,t[68]=u,t[69]=f,t[70]=n,t[71]=h,t[72]=pe):pe=t[72];let me;return t[73]!==fe||t[74]!==pe?(me=(0,$.jsxs)(`div`,{className:`absolute right-2 top-2`,children:[fe,pe]}),t[73]=fe,t[74]=pe,t[75]=me):me=t[75],(0,$.jsxs)(`div`,{className:B,children:[(0,$.jsxs)(`button`,{type:`button`,onClick:P,"aria-label":`${p.taskOpenDetails}: ${A}`,"aria-current":o?`true`:void 0,className:V,children:[(0,$.jsxs)(`div`,{className:`pr-7`,children:[(0,$.jsxs)(`div`,{className:`flex min-w-0 items-start justify-between gap-2`,children:[W,(0,$.jsx)(`span`,{className:G,children:p.status[n.status]??n.status})]}),ne]}),x?(0,$.jsxs)(`div`,{className:`mt-2.5`,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-2 text-[11px] text-fg-muted`,children:[(0,$.jsx)(`span`,{children:O(p.agentProgress,{done:n.metrics.doneAgentCount,total:n.metrics.agentCount})}),(0,$.jsxs)(`span`,{children:[C,`%`]})]}),(0,$.jsx)(`div`,{className:`mt-1.5 h-1.5 overflow-hidden rounded-full bg-surface-hover`,children:(0,$.jsx)(`div`,{className:`h-full rounded-full bg-accent transition-all`,style:{width:`${C}%`}})})]}):null,ie,w?(0,$.jsxs)(`div`,{className:`mt-2 flex items-center gap-1 text-[11px] text-amber-700 dark:text-amber-300`,children:[(0,$.jsx)(R,{className:`size-3 shrink-0`,"aria-hidden":!0}),O(p.runRowErrorSummary,{count:n.metrics.errorAgentCount})]}):null]}),J,me]})});function jt(e){let t=(0,Q.c)(8),{label:n,disabled:r,tone:i,onClick:a}=e,o=r?`cursor-not-allowed text-fg-subtle`:`text-fg hover:bg-surface-hover`,s=i===`danger`&&!r&&`text-red-600 dark:text-red-300`,c;t[0]!==o||t[1]!==s?(c=l(`block w-full px-3 py-1.5 text-left text-xs`,o,s),t[0]=o,t[1]=s,t[2]=c):c=t[2];let u;return t[3]!==r||t[4]!==n||t[5]!==a||t[6]!==c?(u=(0,$.jsx)(`button`,{type:`button`,disabled:r,onClick:a,className:c,children:n}),t[3]=r,t[4]=n,t[5]=a,t[6]=c,t[7]=u):u=t[7],u}function Mt(e){return!e}function Nt(e,t){return t.boardColumns[e]}var Pt=(0,Z.memo)(function(e){let t=(0,Q.c)(17),{column:n,language:r,localeTag:i,nowMs:a,selectedRunId:o,loading:s,onOpenRun:c,onOpenRunChat:u,onCancelRun:f,onRetryRun:p}=e,m=d(r).workflows,[h,g]=(0,Z.useState)(!1),_=n.id===`succeeded`,v=_?5:n.runs.length,y;t[0]!==v||t[1]!==n.runs||t[2]!==h||t[3]!==_?(y=_&&!h?n.runs.slice(0,v):n.runs,t[0]=v,t[1]=n.runs,t[2]=h,t[3]=_,t[4]=y):y=t[4];let b=y,x=_&&n.runs.length>5&&!h,S=_&&h,C;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(C=l(`flex max-h-full w-72 min-w-72 max-w-72 shrink-0 flex-col overflow-y-auto rounded-lg bg-surface-base shadow-surface`),t[5]=C):C=t[5];let w;t[6]===n.runs.length?w=t[7]:(w=(0,$.jsx)(`span`,{className:`shrink-0 text-xs text-fg-subtle`,children:n.runs.length}),t[6]=n.runs.length,t[7]=w);let T;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,$.jsx)(Ae,{className:`size-4 shrink-0 text-fg-subtle`,"aria-hidden":!0}),t[8]=T):T=t[8];let E=s&&b.length===0?(0,$.jsx)(Ft,{}):b.length===0?(0,$.jsx)(`div`,{className:`rounded-lg bg-surface-panel/70 px-3 py-6 text-center text-xs text-fg-subtle`,children:m.boardColumnEmpty}):b.map(e=>(0,$.jsx)(At,{run:e,language:r,localeTag:i,nowMs:a,selected:e.id===o,onOpen:c,onOpenChat:u,onCancel:f,onRetry:p},e.id)),D=x?(0,$.jsx)(Y,{variant:`ghost`,className:`h-8 w-full text-xs`,onClick:()=>g(!0),children:O(m.boardExpandSucceeded,{count:Math.min(n.runs.length,n.totalInWindow??n.runs.length)})}):null,k;t[9]!==S||t[10]!==m||t[11]!==g?(k=S?(0,$.jsx)(Y,{variant:`ghost`,className:`h-8 w-full text-xs`,onClick:()=>g(!1),children:m.boardCollapseSucceeded}):null,t[9]=S,t[10]=m,t[11]=g,t[12]=k):k=t[12];let A;return t[13]!==E||t[14]!==D||t[15]!==k?(A=(0,$.jsxs)(`div`,{className:`mx-2 mt-3 grid min-h-0 min-w-0 content-start gap-2 pb-2 pr-1 [scrollbar-gutter:stable]`,children:[E,D,k]}),t[13]=E,t[14]=D,t[15]=k,t[16]=A):A=t[16],(0,$.jsxs)(`section`,{className:C,"aria-label":Nt(n.id,m),children:[(0,$.jsxs)(`header`,{className:`flex shrink-0 items-center justify-between gap-2 p-3`,children:[(0,$.jsxs)(`div`,{className:`flex min-w-0 items-baseline gap-2`,children:[(0,$.jsx)(`h2`,{className:`truncate text-sm font-semibold text-fg`,children:Nt(n.id,m)}),w]}),T]}),A]})});function Ft(){let e=(0,Q.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,$.jsxs)(`article`,{className:`min-h-24 rounded-lg bg-surface-panel p-3 shadow-surface`,"aria-hidden":`true`,children:[(0,$.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,$.jsx)(S,{className:`size-4/5`}),(0,$.jsx)(S,{className:`mt-2 h-3 w-24`})]}),(0,$.jsx)(S,{className:`h-5 w-14 rounded-full`})]}),(0,$.jsx)(S,{className:`mt-3 h-3 w-2/3`}),(0,$.jsx)(S,{className:`mt-4 h-5 w-20 rounded-full`})]}),e[0]=t):t=e[0],t}function It(e){return e instanceof Element?!!e.closest(`a,button,input,select,textarea,[contenteditable="true"],[draggable="true"],[data-board-pan-skip="true"]`):!0}var Lt=(0,Z.memo)(function(e){let t=(0,Q.c)(54),{runs:n,language:r,localeTag:i,labels:a,searchQuery:o,workflowFilterId:s,triggerFilter:c,selectedRunId:l,loading:u,onOpenRun:d,onOpenRunChat:f,onCancelRun:p,onRetryRun:m,onStart:h}=e,g;t[0]===n?g=t[1]:(g=n.some(Rt),t[0]=n,t[1]=g);let _=g,v=(0,Z.useRef)(null),y=(0,Z.useRef)(null),[b,x]=(0,Z.useState)(zt),[S,C]=(0,Z.useState)(!1),w,T;t[2]===_?(w=t[3],T=t[4]):(w=()=>{if(!_)return;let e=window.setInterval(()=>x(Date.now()),1e3);return()=>window.clearInterval(e)},T=[_],t[2]=_,t[3]=w,t[4]=T),(0,Z.useEffect)(w,T);let E;t[5]!==b||t[6]!==n||t[7]!==o||t[8]!==c||t[9]!==s?(E=Et(St(n,{searchQuery:o,workflowFilterId:s,triggerFilter:c}),b),t[5]=b,t[6]=n,t[7]=o,t[8]=c,t[9]=s,t[10]=E):E=t[10];let D=E,O=D.reduce(Bt,0),k;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(k=e=>{let t=y.current;!t||t.pointerId!==e.pointerId||(y.current=null,C(!1),e.currentTarget.hasPointerCapture?.(e.pointerId)&&e.currentTarget.releasePointerCapture(e.pointerId))},t[11]=k):k=t[11];let A=k,j;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(j=e=>{if(e.button!==0||It(e.target))return;let t=v.current;t&&(y.current={pointerId:e.pointerId,startX:e.clientX,scrollLeft:t.scrollLeft,active:!1},e.currentTarget.setPointerCapture(e.pointerId))},t[12]=j):j=t[12];let M=j,N;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(N=e=>{let t=y.current,n=v.current;if(!t||!n||t.pointerId!==e.pointerId)return;let r=e.clientX-t.startX;!t.active&&Math.abs(r)<5||(t.active||(t.active=!0,C(!0)),e.preventDefault(),n.scrollLeft=t.scrollLeft-r)},t[13]=N):N=t[13];let P=N;if(!u&&O===0){let e;t[14]===a.boardEmptyTitle?e=t[15]:(e=(0,$.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:a.boardEmptyTitle}),t[14]=a.boardEmptyTitle,t[15]=e);let n;t[16]===a.boardEmptyHint?n=t[17]:(n=(0,$.jsx)(`p`,{className:`mx-auto mt-2 max-w-md text-sm leading-6 text-fg-muted`,children:a.boardEmptyHint}),t[16]=a.boardEmptyHint,t[17]=n);let r;t[18]!==a.boardStart||t[19]!==h?(r=(0,$.jsx)(`div`,{className:`mt-4 flex justify-center`,children:(0,$.jsx)(Y,{variant:`primary`,onClick:h,children:a.boardStart})}),t[18]=a.boardStart,t[19]=h,t[20]=r):r=t[20];let i;return t[21]!==r||t[22]!==e||t[23]!==n?(i=(0,$.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col items-center justify-center rounded-2xl border border-dashed border-edge bg-surface-panel/40 px-6 py-12 text-center`,children:[e,n,r]}),t[21]=r,t[22]=e,t[23]=n,t[24]=i):i=t[24],i}let F=S?`cursor-grabbing select-none`:`cursor-grab`,I;t[25]===F?I=t[26]:(I=[`min-h-0 h-full min-w-0 overflow-x-auto rounded-lg p-2`,F],t[25]=F,t[26]=I);let L=I.join(` `),R;t[27]===Symbol.for(`react.memo_cache_sentinel`)?(R=e=>{y.current?.pointerId===e.pointerId&&(y.current=null,C(!1))},t[27]=R):R=t[27];let z;if(t[28]!==D||t[29]!==r||t[30]!==u||t[31]!==i||t[32]!==b||t[33]!==p||t[34]!==d||t[35]!==f||t[36]!==m||t[37]!==l){let e;t[39]!==r||t[40]!==u||t[41]!==i||t[42]!==b||t[43]!==p||t[44]!==d||t[45]!==f||t[46]!==m||t[47]!==l?(e=e=>(0,$.jsx)(Pt,{column:e,language:r,localeTag:i,nowMs:b,selectedRunId:l,loading:u,onOpenRun:d,onOpenRunChat:f,onCancelRun:p,onRetryRun:m},e.id),t[39]=r,t[40]=u,t[41]=i,t[42]=b,t[43]=p,t[44]=d,t[45]=f,t[46]=m,t[47]=l,t[48]=e):e=t[48],z=D.map(e),t[28]=D,t[29]=r,t[30]=u,t[31]=i,t[32]=b,t[33]=p,t[34]=d,t[35]=f,t[36]=m,t[37]=l,t[38]=z}else z=t[38];let B;t[49]===z?B=t[50]:(B=(0,$.jsx)(`div`,{className:`flex min-h-full min-w-max items-start gap-3 pr-4`,children:z}),t[49]=z,t[50]=B);let V;return t[51]!==L||t[52]!==B?(V=(0,$.jsx)(`div`,{ref:v,className:L,onPointerDown:M,onPointerMove:P,onPointerUp:A,onPointerCancel:A,onLostPointerCapture:R,children:B}),t[51]=L,t[52]=B,t[53]=V):V=t[53],V});function Rt(e){return e.status===`queued`||e.status===`running`}function zt(){return Date.now()}function Bt(e,t){return e+t.runs.length}function Vt(e,t){let n=e.metadata.estimatedAgents;return n?n.min===n.max?O(t.agentScaleExact,{count:n.min}):O(t.agentScaleRange,{min:n.min,max:n.max}):null}function Ht(e){let t=(0,Q.c)(73),{definition:n,language:r,labels:i,onPick:a,onDetail:o,onEdit:s}=e,c;t[0]!==n||t[1]!==r?(c=He(n,r),t[0]=n,t[1]=r,t[2]=c):c=t[2];let u=c,d;t[3]!==n||t[4]!==i?(d=Vt(n,i),t[3]=n,t[4]=i,t[5]=d):d=t[5];let f=d,p=n.metadata.source===`user`,m=p?`bg-accent-soft text-accent-fg`:`bg-surface-muted text-fg-muted`,h;t[6]===m?h=t[7]:(h=l(`rounded-full px-2 py-0.5 text-[10px] font-medium`,m),t[6]=m,t[7]=h);let _=p?i.badgeUser:i.badgeBuiltin,v;t[8]!==h||t[9]!==_?(v=(0,$.jsx)(`span`,{className:h,children:_}),t[8]=h,t[9]=_,t[10]=v):v=t[10];let y;t[11]!==n.inputSchema||t[12]!==i.inputSchemaBadge?(y=n.inputSchema?(0,$.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded-full bg-surface-muted px-2 py-0.5 text-[10px] text-fg-subtle`,children:[(0,$.jsx)(Ge,{className:`size-2.5`,"aria-hidden":!0}),i.inputSchemaBadge]}):null,t[11]=n.inputSchema,t[12]=i.inputSchemaBadge,t[13]=y):y=t[13];let b;t[14]!==v||t[15]!==y?(b=(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[v,y]}),t[14]=v,t[15]=y,t[16]=b):b=t[16];let x;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(x=l(`mt-2 line-clamp-2 text-left text-sm font-semibold leading-5 text-fg hover:text-accent-fg`,be.focusRingPanel),t[17]=x):x=t[17];let S;t[18]!==n||t[19]!==o?(S=()=>o(n),t[18]=n,t[19]=o,t[20]=S):S=t[20];let w;t[21]!==n.title||t[22]!==S?(w=(0,$.jsx)(`button`,{type:`button`,className:x,onClick:S,children:n.title}),t[21]=n.title,t[22]=S,t[23]=w):w=t[23];let T;t[24]!==w||t[25]!==b?(T=(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[b,w]}),t[24]=w,t[25]=b,t[26]=T):T=t[26];let E=`${p?i.editWorkflow:i.copyAndEditWorkflow}: ${n.title}`,D;t[27]!==n||t[28]!==s?(D=()=>s(n),t[27]=n,t[28]=s,t[29]=D):D=t[29];let k;t[30]===p?k=t[31]:(k=p?(0,$.jsx)(Xe,{className:`size-3.5`,"aria-hidden":!0}):(0,$.jsx)(G,{className:`size-3.5`,"aria-hidden":!0}),t[30]=p,t[31]=k);let A;t[32]!==E||t[33]!==D||t[34]!==k?(A=(0,$.jsx)(Y,{type:`button`,variant:`ghost`,className:`size-8 shrink-0 p-0`,"aria-label":E,onClick:D,children:k}),t[32]=E,t[33]=D,t[34]=k,t[35]=A):A=t[35];let j;t[36]!==T||t[37]!==A?(j=(0,$.jsxs)(`div`,{className:`flex min-w-0 items-start justify-between gap-3`,children:[T,A]}),t[36]=T,t[37]=A,t[38]=j):j=t[38];let M=u.whenToUse||u.description||n.description,N;t[39]===M?N=t[40]:(N=(0,$.jsx)(`p`,{className:`mt-2 line-clamp-2 text-xs leading-5 text-fg-muted`,children:M}),t[39]=M,t[40]=N);let P;t[41]===Symbol.for(`react.memo_cache_sentinel`)?(P=(0,$.jsx)(g,{className:`size-3`,"aria-hidden":!0}),t[41]=P):P=t[41];let F;t[42]!==n.phases.length||t[43]!==i.phaseCount?(F=O(i.phaseCount,{count:n.phases.length}),t[42]=n.phases.length,t[43]=i.phaseCount,t[44]=F):F=t[44];let I;t[45]===F?I=t[46]:(I=(0,$.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[P,F]}),t[45]=F,t[46]=I);let L;t[47]===f?L=t[48]:(L=f?(0,$.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,$.jsx)(C,{className:`size-3`,"aria-hidden":!0}),f]}):null,t[47]=f,t[48]=L);let R;t[49]!==I||t[50]!==L?(R=(0,$.jsxs)(`div`,{className:`mt-auto flex flex-wrap items-center gap-3 pt-4 text-[11px] text-fg-subtle`,children:[I,L]}),t[49]=I,t[50]=L,t[51]=R):R=t[51];let z;t[52]!==n||t[53]!==a?(z=()=>a(n),t[52]=n,t[53]=a,t[54]=z):z=t[54];let B;t[55]===Symbol.for(`react.memo_cache_sentinel`)?(B=(0,$.jsx)(fe,{className:`size-3.5`,"aria-hidden":!0}),t[55]=B):B=t[55];let V;t[56]!==i.configureAndRun||t[57]!==z?(V=(0,$.jsxs)(Y,{type:`button`,variant:`primary`,className:`h-8 flex-1 rounded-lg text-xs`,onClick:z,children:[B,i.configureAndRun]}),t[56]=i.configureAndRun,t[57]=z,t[58]=V):V=t[58];let H;t[59]!==n||t[60]!==o?(H=()=>o(n),t[59]=n,t[60]=o,t[61]=H):H=t[61];let U;t[62]!==i.viewDetails||t[63]!==H?(U=(0,$.jsx)(Y,{type:`button`,variant:`secondary`,className:`h-8 rounded-lg text-xs`,onClick:H,children:i.viewDetails}),t[62]=i.viewDetails,t[63]=H,t[64]=U):U=t[64];let W;t[65]!==V||t[66]!==U?(W=(0,$.jsxs)(`div`,{className:`mt-3 flex items-center gap-2 border-t border-edge-subtle pt-3`,children:[V,U]}),t[65]=V,t[66]=U,t[67]=W):W=t[67];let ee;return t[68]!==j||t[69]!==N||t[70]!==R||t[71]!==W?(ee=(0,$.jsxs)(`article`,{className:`flex min-h-48 flex-col rounded-xl border border-edge-subtle bg-surface-base p-4 transition-colors hover:border-edge hover:bg-surface-hover/35`,children:[j,N,R,W]}),t[68]=j,t[69]=N,t[70]=R,t[71]=W,t[72]=ee):ee=t[72],ee}function Ut(e){let t=(0,Q.c)(44),{definitions:n,runs:r,language:i,onPick:a,onDetail:o,onEdit:s}=e,[c]=(0,Z.useState)(Kt),u=d(i).workflows,f=i===`zh`?`zh-CN`:`en-US`,[p,m]=(0,Z.useState)(``),[h,g]=(0,Z.useState)(`all`),[_,v]=(0,Z.useState)(`all`),y;t[0]!==h||t[1]!==n||t[2]!==p||t[3]!==_?(y=I(n,p,h,_),t[0]=h,t[1]=n,t[2]=p,t[3]=_,t[4]=y):y=t[4];let b=y,x;if(t[5]!==n||t[6]!==r){let e=new Map(n.map(Gt)),i=new Set;x=[...r].sort(Wt).flatMap(t=>{if(i.has(t.definitionId))return[];let n=e.get(t.definitionId);return n?(i.add(t.definitionId),[{definition:n,lastRunAtMs:t.startedAtMs??t.createdAtMs}]):[]}).slice(0,3),t[5]=n,t[6]=r,t[7]=x}else x=t[7];let S=x,C=O(u.workflowCount,{count:b.length}),w;t[8]===C?w=t[9]:(w=(0,$.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:C}),t[8]=C,t[9]=w);let T=u.sourceFilterAria,D;t[10]!==u.sources||t[11]!==v||t[12]!==_?(D=oe.map(e=>(0,$.jsx)(`button`,{type:`button`,className:l(`h-8 rounded-md px-2.5 text-xs font-medium transition-colors`,_===e?`bg-surface-base text-fg shadow-surface`:`text-fg-muted hover:text-fg`,be.focusRingPanel),"aria-pressed":_===e,onClick:()=>v(e),children:u.sources[e]},e)),t[10]=u.sources,t[11]=v,t[12]=_,t[13]=D):D=t[13];let k;t[14]!==u.sourceFilterAria||t[15]!==D?(k=(0,$.jsx)(`div`,{className:`flex rounded-lg bg-surface-muted p-0.5`,role:`group`,"aria-label":T,children:D}),t[14]=u.sourceFilterAria,t[15]=D,t[16]=k):k=t[16];let j=u.categoryFilterAria,M;t[17]===g?M=t[18]:(M=e=>g(e.target.value),t[17]=g,t[18]=M);let N;t[19]===u.categories?N=t[20]:(N=A.map(e=>(0,$.jsx)(E,{value:e,children:u.categories[e]},e)),t[19]=u.categories,t[20]=N);let P;t[21]!==h||t[22]!==u.categoryFilterAria||t[23]!==M||t[24]!==N?(P=(0,$.jsx)(ae,{value:h,"aria-label":j,onChange:M,className:`h-9 min-w-36 rounded-lg border border-edge bg-surface-base px-2.5 text-xs font-medium text-fg shadow-surface`,children:N}),t[21]=h,t[22]=u.categoryFilterAria,t[23]=M,t[24]=N,t[25]=P):P=t[25];let F;t[26]!==P||t[27]!==k?(F=(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[k,P]}),t[26]=P,t[27]=k,t[28]=F):F=t[28];let L;t[29]===Symbol.for(`react.memo_cache_sentinel`)?(L=(0,$.jsx)(De,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-subtle`,"aria-hidden":!0}),t[29]=L):L=t[29];let R;t[30]===m?R=t[31]:(R=e=>m(e.target.value),t[30]=m,t[31]=R);let z=u.librarySearchPlaceholder,B;t[32]===Symbol.for(`react.memo_cache_sentinel`)?(B=l(`h-10 w-full rounded-lg border border-edge bg-surface-base py-2 pl-10 pr-3 text-sm text-fg`,`placeholder:text-fg-muted`,be.focusRingPanel),t[32]=B):B=t[32];let V;t[33]!==u.librarySearchPlaceholder||t[34]!==p||t[35]!==R?(V=(0,$.jsxs)(`div`,{className:`relative max-w-xl`,children:[L,(0,$.jsx)(`input`,{value:p,onChange:R,placeholder:z,className:B})]}),t[33]=u.librarySearchPlaceholder,t[34]=p,t[35]=R,t[36]=V):V=t[36];let H;return t[37]!==b||t[38]!==u||t[39]!==i||t[40]!==o||t[41]!==s||t[42]!==a?(H=b.length===0?(0,$.jsxs)(`div`,{className:`flex min-h-64 flex-col items-center justify-center px-4 py-12 text-center`,children:[(0,$.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:u.noDefinitions}),(0,$.jsx)(`p`,{className:`mt-1 max-w-sm text-xs leading-5 text-fg-muted`,children:u.noDefinitionsHint})]}):(0,$.jsx)(`div`,{className:`grid grid-cols-1 gap-3 pt-4 sm:grid-cols-2 xl:grid-cols-3`,children:b.map(e=>(0,$.jsx)(Ht,{definition:e,language:i,labels:u,onPick:a,onDetail:o,onEdit:s},e.id))}),t[37]=b,t[38]=u,t[39]=i,t[40]=o,t[41]=s,t[42]=a,t[43]=H):H=t[43],(0,$.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-5`,children:[S.length>0&&!p&&h===`all`&&_===`all`?(0,$.jsxs)(`section`,{"aria-labelledby":`recent-workflows-heading`,children:[(0,$.jsx)(`h2`,{id:`recent-workflows-heading`,className:`text-sm font-semibold text-fg`,children:u.recentlyUsed}),(0,$.jsx)(`div`,{className:`mt-2 flex flex-wrap gap-2`,children:S.map(e=>{let{definition:t,lastRunAtMs:n}=e;return(0,$.jsxs)(`button`,{type:`button`,className:l(`flex min-w-52 flex-1 items-center justify-between gap-3 rounded-lg border border-edge-subtle bg-surface-base px-3 py-2 text-left hover:bg-surface-hover`,`sm:max-w-sm`,be.focusRingPanel),onClick:()=>a(t),children:[(0,$.jsxs)(`span`,{className:`min-w-0`,children:[(0,$.jsx)(`span`,{className:`block truncate text-sm font-medium text-fg`,children:t.title}),(0,$.jsx)(`span`,{className:`mt-0.5 block text-[11px] text-fg-subtle`,children:Dt(n,c,f)})]}),(0,$.jsx)(fe,{className:`size-3.5 shrink-0 text-accent-fg`,"aria-hidden":!0})]},t.id)})})]}):null,(0,$.jsxs)(`section`,{"aria-labelledby":`all-workflows-heading`,children:[(0,$.jsxs)(`div`,{className:`flex flex-col gap-3 border-b border-edge-subtle pb-4`,children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h2`,{id:`all-workflows-heading`,className:`text-sm font-semibold text-fg`,children:u.allWorkflows}),w]}),F]}),V]}),H]})]})}function Wt(e,t){return(t.startedAtMs??t.createdAtMs)-(e.startedAtMs??e.createdAtMs)}function Gt(e){return[e.id,e]}function Kt(){return Date.now()}var qt=(0,Z.memo)(function(e){let t=(0,Q.c)(108),{run:n,language:r,localeTag:i,nowMs:a,onOpen:o,onOpenChat:s,onCancel:c,onRetry:u}=e,f,p,m,h,g,_,y,b,x,S,C,w,T,E,D,k,A;if(t[0]!==r||t[1]!==i||t[2]!==a||t[3]!==o||t[4]!==n){m=d(r).workflows;let e;t[22]===n?e=t[23]:(e=Ot(n),t[22]=n,t[23]=e),f=e;let s;t[24]===n?s=t[25]:(s=kt(n),t[24]=n,t[25]=s),h=s;let c;t[26]===n?c=t[27]:(c=ht(n),t[26]=n,t[27]=c),p=!!c;let u=n.startedAtMs??n.createdAtMs,j=z(f?a-u:n.metrics.durationMs),M;t[28]!==n.metrics.agentCount||t[29]!==n.metrics.doneAgentCount?(M=n.metrics.agentCount>0?Math.round(n.metrics.doneAgentCount/n.metrics.agentCount*100):0,t[28]=n.metrics.agentCount,t[29]=n.metrics.doneAgentCount,t[30]=M):M=t[30];let N=M;x=`group border-b border-edge-subtle last:border-b-0`,b=`flex min-w-0 flex-col gap-3 p-3 transition-colors hover:bg-surface-hover/55 sm:px-4 lg:flex-row lg:items-center`,k=`button`,t[31]!==o||t[32]!==n?(A=()=>o(n),t[31]=o,t[32]=n,t[33]=A):A=t[33],t[34]===Symbol.for(`react.memo_cache_sentinel`)?(_=l(`min-w-0 flex-1 text-left`,be.focusRingPanel),t[34]=_):_=t[34];let P=m.taskOpenDetails,F;t[35]===n?F=t[36]:(F=yt(n),t[35]=n,t[36]=F),y=`${P}: ${F}`,E=`flex min-w-0 items-start gap-3`;let I;t[37]===n.status?I=t[38]:(I=l(`mt-0.5 shrink-0 rounded-full px-2 py-0.5 text-[10px] font-semibold`,v(n.status)),t[37]=n.status,t[38]=I),D=(0,$.jsx)(`span`,{className:I,children:m.status[n.status]??n.status}),g=`min-w-0 flex-1`;let L;t[39]===n?L=t[40]:(L=yt(n),t[39]=n,t[40]=L),t[41]===L?S=t[42]:(S=(0,$.jsx)(`span`,{className:`block truncate text-sm font-medium text-fg`,children:L}),t[41]=L,t[42]=S);let B;t[43]===n?B=t[44]:(B=bt(n),t[43]=n,t[44]=B);let V;t[45]===B?V=t[46]:(V=(0,$.jsx)(`span`,{className:`truncate font-medium`,children:B}),t[45]=B,t[46]=V);let H;t[47]===Symbol.for(`react.memo_cache_sentinel`)?(H=(0,$.jsx)(`span`,{"aria-hidden":!0,children:`·`}),t[47]=H):H=t[47];let U;t[48]!==i||t[49]!==a||t[50]!==u?(U=Dt(u,a,i),t[48]=i,t[49]=a,t[50]=u,t[51]=U):U=t[51];let W;t[52]===U?W=t[53]:(W=(0,$.jsx)(`span`,{children:U}),t[52]=U,t[53]=W);let G=j===`—`?null:(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`span`,{"aria-hidden":!0,children:`·`}),(0,$.jsx)(`span`,{children:O(m.taskElapsed,{duration:j})})]});t[54]!==V||t[55]!==W||t[56]!==G?(C=(0,$.jsxs)(`span`,{className:`mt-1 flex flex-wrap items-center gap-x-2 gap-y-1 text-xs text-fg-muted`,children:[V,H,W,G]}),t[54]=V,t[55]=W,t[56]=G,t[57]=C):C=t[57],w=f&&n.metrics.agentCount>0?(0,$.jsxs)(`span`,{className:`mt-2 block max-w-md`,children:[(0,$.jsxs)(`span`,{className:`flex items-center justify-between text-[11px] text-fg-subtle`,children:[(0,$.jsx)(`span`,{children:O(m.agentProgress,{done:n.metrics.doneAgentCount,total:n.metrics.agentCount})}),(0,$.jsxs)(`span`,{className:`tabular-nums`,children:[N,`%`]})]}),(0,$.jsx)(`span`,{className:`mt-1 block h-1.5 overflow-hidden rounded-full bg-surface-muted`,children:(0,$.jsx)(`span`,{className:`block h-full rounded-full bg-accent transition-[width] duration-200 motion-reduce:transition-none`,style:{width:`${N}%`}})})]}):null,T=n.metrics.errorAgentCount>0?(0,$.jsxs)(`span`,{className:`mt-2 flex items-center gap-1 text-[11px] text-amber-700 dark:text-amber-300`,children:[(0,$.jsx)(R,{className:`size-3 shrink-0`,"aria-hidden":!0}),O(m.runRowErrorSummary,{count:n.metrics.errorAgentCount})]}):null,t[0]=r,t[1]=i,t[2]=a,t[3]=o,t[4]=n,t[5]=f,t[6]=p,t[7]=m,t[8]=h,t[9]=g,t[10]=_,t[11]=y,t[12]=b,t[13]=x,t[14]=S,t[15]=C,t[16]=w,t[17]=T,t[18]=E,t[19]=D,t[20]=k,t[21]=A}else f=t[5],p=t[6],m=t[7],h=t[8],g=t[9],_=t[10],y=t[11],b=t[12],x=t[13],S=t[14],C=t[15],w=t[16],T=t[17],E=t[18],D=t[19],k=t[20],A=t[21];let j;t[58]!==g||t[59]!==S||t[60]!==C||t[61]!==w||t[62]!==T?(j=(0,$.jsxs)(`span`,{className:g,children:[S,C,w,T]}),t[58]=g,t[59]=S,t[60]=C,t[61]=w,t[62]=T,t[63]=j):j=t[63];let M;t[64]!==j||t[65]!==E||t[66]!==D?(M=(0,$.jsxs)(`div`,{className:E,children:[D,j]}),t[64]=j,t[65]=E,t[66]=D,t[67]=M):M=t[67];let N;t[68]!==_||t[69]!==y||t[70]!==M||t[71]!==k||t[72]!==A?(N=(0,$.jsx)(`button`,{type:k,onClick:A,className:_,"aria-label":y,children:M}),t[68]=_,t[69]=y,t[70]=M,t[71]=k,t[72]=A,t[73]=N):N=t[73];let P;t[74]!==m.rerun||t[75]!==u||t[76]!==h||t[77]!==n.id?(P=h?(0,$.jsx)(Y,{type:`button`,variant:`primary`,className:`h-8 rounded-lg text-xs`,onClick:()=>u(n.id),children:m.rerun}):null,t[74]=m.rerun,t[75]=u,t[76]=h,t[77]=n.id,t[78]=P):P=t[78];let F;t[79]!==p||t[80]!==m.continueInChat||t[81]!==s||t[82]!==n?(F=n.status===`succeeded`&&p?(0,$.jsx)(Y,{type:`button`,variant:`secondary`,className:`h-8 rounded-lg text-xs`,onClick:()=>s(n),children:m.continueInChat}):null,t[79]=p,t[80]=m.continueInChat,t[81]=s,t[82]=n,t[83]=F):F=t[83];let I;t[84]!==f||t[85]!==m.cancel||t[86]!==c||t[87]!==n.id?(I=f?(0,$.jsx)(Y,{type:`button`,variant:`ghost`,className:`h-8 rounded-lg text-xs text-red-600 dark:text-red-300`,onClick:()=>c(n.id),children:m.cancel}):null,t[84]=f,t[85]=m.cancel,t[86]=c,t[87]=n.id,t[88]=I):I=t[88];let L;t[89]!==o||t[90]!==n?(L=()=>o(n),t[89]=o,t[90]=n,t[91]=L):L=t[91];let B;t[92]===Symbol.for(`react.memo_cache_sentinel`)?(B=(0,$.jsx)(ke,{className:`size-4`,"aria-hidden":!0}),t[92]=B):B=t[92];let V;t[93]!==m.taskOpenDetails||t[94]!==L?(V=(0,$.jsx)(Y,{type:`button`,variant:`ghost`,className:`size-8 p-0`,"aria-label":m.taskOpenDetails,onClick:L,children:B}),t[93]=m.taskOpenDetails,t[94]=L,t[95]=V):V=t[95];let H;t[96]!==P||t[97]!==F||t[98]!==I||t[99]!==V?(H=(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center justify-end gap-1.5 pl-7 lg:pl-0`,children:[P,F,I,V]}),t[96]=P,t[97]=F,t[98]=I,t[99]=V,t[100]=H):H=t[100];let U;t[101]!==b||t[102]!==N||t[103]!==H?(U=(0,$.jsxs)(`div`,{className:b,children:[N,H]}),t[101]=b,t[102]=N,t[103]=H,t[104]=U):U=t[104];let W;return t[105]!==x||t[106]!==U?(W=(0,$.jsx)(`article`,{className:x,children:U}),t[105]=x,t[106]=U,t[107]=W):W=t[107],W});function Jt(e){let t=(0,Q.c)(17),{vm:n}=e,{labels:r,language:i,loading:a,ownerAgentId:o,agentOptions:c,setOwnerAgentId:l,refreshAll:u}=n,f;t[0]!==c||t[1]!==r.agentFilterAria||t[2]!==i||t[3]!==o||t[4]!==l?(f=c.length>1?(0,$.jsx)(ae,{value:o??``,"aria-label":r.agentFilterAria,onChange:e=>l(e.target.value),className:`h-9 min-w-32 rounded-lg border border-edge bg-surface-panel px-2.5 text-xs font-medium text-fg shadow-surface`,children:c.map(e=>(0,$.jsx)(E,{value:e.id,children:ye(e,d(i).agentsSettings)},e.id))}):null,t[0]=c,t[1]=r.agentFilterAria,t[2]=i,t[3]=o,t[4]=l,t[5]=f):f=t[5];let p;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,$.jsx)(we,{className:`size-4`,"aria-hidden":!0}),t[6]=p):p=t[6];let m;t[7]===r.addWorkflow?m=t[8]:(m=(0,$.jsx)(Y,{asChild:!0,variant:`primary`,className:`h-9 rounded-lg`,children:(0,$.jsxs)(s,{to:`/workflows/new`,children:[p,r.addWorkflow]})}),t[7]=r.addWorkflow,t[8]=m);let h;t[9]!==r.refresh||t[10]!==a||t[11]!==u?(h=(0,$.jsx)(L,{className:`size-9 shrink-0 p-0`,loading:a,label:r.refresh,onClick:u}),t[9]=r.refresh,t[10]=a,t[11]=u,t[12]=h):h=t[12];let g;return t[13]!==f||t[14]!==m||t[15]!==h?(g=(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:[f,m,h]}),t[13]=f,t[14]=m,t[15]=h,t[16]=g):g=t[16],g}var Yt=new Set([`failed`,`timeout`,`cancelled`]),Xt=[{id:`runs`,icon:j},{id:`library`,icon:le}],Zt={failed:0,timeout:0,cancelled:0,running:1,queued:2,succeeded:3};function Qt(e){return Yt.has(e.status)}function $t(e,t){return t===`all`?!0:t===`attention`?Qt(e):e.status===t}function en(e){return[...e].sort((e,t)=>{let n=(Zt[e.status]??4)-(Zt[t.status]??4);if(n!==0)return n;if(e.status===`queued`&&t.status===`queued`)return e.createdAtMs-t.createdAtMs;let r=e.completedAtMs??e.startedAtMs??e.createdAtMs;return(t.completedAtMs??t.startedAtMs??t.createdAtMs)-r})}function tn(e,t){return e===`Home`?`runs`:e===`End`?`library`:e===`ArrowLeft`||e===`ArrowRight`?t===`runs`?`library`:`runs`:null}function nn(){let e=(0,Q.c)(2),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,$.jsx)(S,{className:`h-5 w-16 rounded-full`}),e[0]=t):t=e[0];let n;return e[1]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,$.jsxs)(`div`,{className:`flex items-center gap-3 border-b border-edge-subtle p-4 last:border-b-0`,"aria-hidden":`true`,children:[t,(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,$.jsx)(S,{className:`h-4 w-52 max-w-full`}),(0,$.jsx)(S,{className:`mt-2 h-3 w-36 max-w-full`})]}),(0,$.jsx)(S,{className:`hidden h-8 w-20 rounded-lg sm:block`})]}),e[1]=n):n=e[1],n}function rn(e){let t=(0,Q.c)(30),{vm:n}=e,{language:r,localeTag:i,labels:a,hasToken:o,definitions:s,runs:c,searchQuery:u,setSearchQuery:d,workflowFilterId:f,setWorkflowFilterId:p,triggerFilter:m,setTriggerFilter:h,statusFilter:g,setStatusFilter:_,clearRunFilters:v,pageTab:b,setPageTab:x,runLayout:S,setRunLayout:C,openRunDetails:w,openRunInChat:T,openDefinitionDetails:D,openWorkflowEditor:O,startWorkflow:k,actionError:A,loading:j,error:M,cancelRun:P,retryRun:F}=n,I=N(cn),L=N(sn),z=Date.now(),B=en(c.filter(Qt)),V;t[0]===g?V=t[1]:(V=e=>$t(e,g),t[0]=g,t[1]=V);let H=en(St(c,{searchQuery:u,workflowFilterId:f,triggerFilter:m}).filter(V)),U=!!(u||f||m!==`all`||g!==`all`),W,G;if(t[2]!==L||t[3]!==o||t[4]!==a.librarySubtitle||t[5]!==a.runsSubtitle||t[6]!==a.title||t[7]!==b||t[8]!==I||t[9]!==n?(W=()=>{if(!o){L();return}return I({startExtra:null,main:(0,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:a.title}),(0,$.jsx)(`p`,{className:`truncate text-xs text-fg-muted`,children:b===`runs`?a.runsSubtitle:a.librarySubtitle})]}),end:(0,$.jsx)(Jt,{vm:n})}),()=>L()},G=[L,o,a.librarySubtitle,a.runsSubtitle,a.title,b,I,n],t[2]=L,t[3]=o,t[4]=a.librarySubtitle,t[5]=a.runsSubtitle,t[6]=a.title,t[7]=b,t[8]=I,t[9]=n,t[10]=W,t[11]=G):(W=t[10],G=t[11]),(0,Z.useLayoutEffect)(W,G),!o){let e;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(Te,{className:`size-10 text-accent-fg`,"aria-hidden":!0}),t[12]=e):e=t[12];let n;t[13]===a.title?n=t[14]:(n=(0,$.jsx)(`h1`,{className:`mt-4 text-xl font-semibold text-fg`,children:a.title}),t[13]=a.title,t[14]=n);let r;t[15]===a.needToken?r=t[16]:(r=(0,$.jsx)(`p`,{className:`mt-2 max-w-md text-sm leading-6 text-fg-muted`,children:a.needToken}),t[15]=a.needToken,t[16]=r);let i;return t[17]!==n||t[18]!==r?(i=(0,$.jsx)(`main`,{className:`min-h-0 flex-1 overflow-auto bg-surface-panel`,children:(0,$.jsxs)(`div`,{className:`flex w-full flex-col items-center px-3 py-16 text-center sm:px-5 xl:px-6`,children:[e,n,r]})}),t[17]=n,t[18]=r,t[19]=i):i=t[19],i}let ee=a.pageTabsAria,te=Xt.map(e=>{let{id:t,icon:n}=e;return(0,$.jsxs)(`button`,{id:`workflow-tab-${t}`,type:`button`,role:`tab`,"aria-selected":b===t,"aria-controls":`workflow-panel-${t}`,tabIndex:b===t?0:-1,draggable:!1,className:l(`relative inline-flex shrink-0 items-center gap-1.5 rounded-lg px-3 py-2 text-sm font-medium`,`transition-transform duration-150 ease-out active:scale-95 motion-reduce:transition-none motion-reduce:active:scale-100`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,b===t?`bg-accent-soft text-accent-fg`:`text-fg-muted hover:bg-surface-hover hover:text-fg`),onClick:()=>x(t),onKeyDown:e=>{let n=tn(e.key,t);n&&(e.preventDefault(),x(n),window.requestAnimationFrame(()=>{document.getElementById(`workflow-tab-${n}`)?.focus()}))},children:[(0,$.jsx)(n,{className:`size-3.5 shrink-0`,strokeWidth:1.75,"aria-hidden":!0}),(0,$.jsx)(`span`,{children:a.pageTabs[t]}),t===`runs`&&B.length>0?(0,$.jsx)(`span`,{className:`rounded-full bg-red-500/15 px-1.5 py-0.5 text-[10px] font-semibold text-red-700 dark:text-red-300`,children:B.length}):null]},t)}),K;t[20]!==a.pageTabsAria||t[21]!==te?(K=(0,$.jsx)(`nav`,{className:`-mx-1 flex gap-1 overflow-x-auto px-1 pb-1`,"aria-label":ee,role:`tablist`,children:te}),t[20]=a.pageTabsAria,t[21]=te,t[22]=K):K=t[22];let ne;t[23]!==A||t[24]!==M?(ne=A??M?(0,$.jsx)(`div`,{className:`mt-4 rounded-lg border border-red-500/25 bg-red-500/10 px-3 py-2 text-sm text-red-700 dark:text-red-300`,role:`alert`,children:A??M}):null,t[23]=A,t[24]=M,t[25]=ne):ne=t[25];let q=b===`runs`?(0,$.jsxs)(`div`,{id:`workflow-panel-runs`,role:`tabpanel`,"aria-labelledby":`workflow-tab-runs`,className:`flex flex-col gap-4 py-4`,children:[B.length>0?(0,$.jsx)(`section`,{className:`rounded-xl border border-amber-500/30 bg-amber-500/8 px-4 py-3`,"aria-labelledby":`workflow-attention-heading`,children:(0,$.jsxs)(`div`,{className:`flex flex-col gap-3 lg:flex-row lg:items-center lg:justify-between`,children:[(0,$.jsxs)(`div`,{className:`flex min-w-0 items-start gap-3`,children:[(0,$.jsx)(R,{className:`mt-0.5 size-4 shrink-0 text-amber-700 dark:text-amber-300`,"aria-hidden":!0}),(0,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,$.jsx)(`h2`,{id:`workflow-attention-heading`,className:`text-sm font-semibold text-fg`,children:a.attentionTitle}),(0,$.jsx)(`span`,{className:`rounded-full bg-amber-500/15 px-2 py-0.5 text-[10px] font-semibold text-amber-800 dark:text-amber-200`,children:B.length})]}),(0,$.jsxs)(`p`,{className:`mt-1 truncate text-xs text-fg-muted`,children:[yt(B[0]),` · `,Dt(B[0].completedAtMs??B[0].createdAtMs,z,i)]}),(0,$.jsx)(`p`,{className:`mt-1 text-xs text-fg-subtle`,children:a.attentionHint})]})]}),(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2 pl-7 lg:pl-0`,children:[(0,$.jsx)(Y,{type:`button`,variant:`secondary`,className:`h-8 rounded-lg text-xs`,onClick:()=>w(B[0]),children:a.attentionView}),(0,$.jsx)(Y,{type:`button`,variant:`primary`,className:`h-8 rounded-lg text-xs`,onClick:()=>void F(B[0].id),children:a.rerun})]})]})}):null,(0,$.jsx)(`section`,{className:`flex flex-col gap-3 rounded-xl border border-edge-subtle bg-surface-base p-3`,"aria-label":a.runFiltersAria,children:(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,$.jsxs)(`div`,{className:`relative min-w-52 flex-1 sm:max-w-sm`,children:[(0,$.jsx)(De,{className:`pointer-events-none absolute left-2.5 top-1/2 size-4 -translate-y-1/2 text-fg-subtle`,"aria-hidden":!0}),(0,$.jsx)(`input`,{value:u,onChange:e=>d(e.target.value),placeholder:a.runsSearchPlaceholder,className:l(`h-9 w-full rounded-lg border border-edge bg-surface-panel py-2 pl-9 pr-3 text-sm text-fg shadow-surface`,`placeholder:text-fg-muted`,be.focusRingPanel)})]}),(0,$.jsx)(ae,{value:g,"aria-label":a.statusFilterAria,onChange:e=>_(e.target.value),className:`h-9 min-w-32 rounded-lg border border-edge bg-surface-panel px-2.5 text-xs font-medium text-fg shadow-surface`,children:[`all`,`attention`,`running`,`queued`,`succeeded`].map(e=>(0,$.jsx)(E,{value:e,children:a.runStatuses[e]},e))}),(0,$.jsxs)(ae,{value:m,"aria-label":a.boardTriggerFilterAria,onChange:e=>h(e.target.value),className:`h-9 min-w-[7.5rem] rounded-lg border border-edge bg-surface-panel px-2.5 text-xs font-medium text-fg shadow-surface`,children:[(0,$.jsx)(E,{value:`all`,children:a.boardTriggerFilterAll}),(0,$.jsx)(E,{value:`automation`,children:a.boardTriggerFilterAutomation}),(0,$.jsx)(E,{value:`webui`,children:a.boardTriggerFilterWebui}),(0,$.jsx)(E,{value:`chat`,children:a.boardTriggerFilterChat}),(0,$.jsx)(E,{value:`api`,children:a.boardTriggerFilterApi})]}),(0,$.jsxs)(ae,{value:f,"aria-label":a.boardWorkflowFilterAria,onChange:e=>p(e.target.value),className:`h-9 min-w-40 rounded-lg border border-edge bg-surface-panel px-2.5 text-xs font-medium text-fg shadow-surface`,children:[(0,$.jsx)(E,{value:``,children:a.boardWorkflowFilterAll}),s.map(on)]}),U?(0,$.jsxs)(Y,{type:`button`,variant:`ghost`,className:`h-9 rounded-lg text-xs`,onClick:v,children:[(0,$.jsx)(he,{className:`size-3.5`,"aria-hidden":!0}),a.clearFilters]}):null,(0,$.jsxs)(`div`,{className:`ml-auto flex rounded-lg bg-surface-muted p-0.5`,role:`group`,"aria-label":a.layoutAria,children:[(0,$.jsxs)(`button`,{type:`button`,className:l(`inline-flex h-8 items-center gap-1.5 rounded-md px-2.5 text-xs font-medium transition-colors`,S===`list`?`bg-surface-panel text-fg shadow-surface`:`text-fg-muted hover:text-fg`,be.focusRingPanel),"aria-pressed":S===`list`,onClick:()=>C(`list`),children:[(0,$.jsx)(y,{className:`size-3.5`,"aria-hidden":!0}),a.runLayouts.list]}),(0,$.jsxs)(`button`,{type:`button`,className:l(`inline-flex h-8 items-center gap-1.5 rounded-md px-2.5 text-xs font-medium transition-colors`,S===`board`?`bg-surface-panel text-fg shadow-surface`:`text-fg-muted hover:text-fg`,be.focusRingPanel),"aria-pressed":S===`board`,onClick:()=>C(`board`),children:[(0,$.jsx)(ue,{className:`size-3.5`,"aria-hidden":!0}),a.runLayouts.board]})]})]})}),S===`list`?(0,$.jsxs)(`section`,{className:`overflow-hidden rounded-xl border border-edge-subtle bg-surface-base`,"aria-labelledby":`workflow-runs-heading`,children:[(0,$.jsxs)(`header`,{className:`flex items-start justify-between gap-3 border-b border-edge-subtle px-4 py-3`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h2`,{id:`workflow-runs-heading`,className:`text-sm font-semibold text-fg`,children:a.allRuns}),(0,$.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:a.allRunsHint})]}),(0,$.jsx)(`span`,{className:`rounded-full bg-surface-muted px-2 py-0.5 text-xs font-semibold tabular-nums text-fg-muted`,children:H.length})]}),j&&H.length===0?Array.from({length:4}).map(an):H.length>0?H.map(e=>(0,$.jsx)(qt,{run:e,language:r,localeTag:i,nowMs:z,onOpen:w,onOpenChat:T,onCancel:e=>void P(e),onRetry:e=>void F(e)},e.id)):(0,$.jsxs)(`div`,{className:`flex min-h-64 flex-col items-center justify-center px-4 py-12 text-center`,children:[(0,$.jsx)(Te,{className:`size-8 text-fg-subtle`,"aria-hidden":!0}),(0,$.jsx)(`h3`,{className:`mt-3 text-sm font-semibold text-fg`,children:U?a.noRunResultsTitle:a.noRunsTitle}),(0,$.jsx)(`p`,{className:`mt-1 max-w-md text-xs leading-5 text-fg-muted`,children:U?a.noRunResultsHint:a.noRunsStartHint}),(0,$.jsx)(Y,{type:`button`,variant:U?`secondary`:`primary`,className:`mt-4 h-9 rounded-lg text-xs`,onClick:U?v:()=>x(`library`),children:U?a.clearFilters:a.chooseWorkflow})]})]}):(0,$.jsx)(`div`,{className:`h-[min(72vh,48rem)] min-h-[24rem] w-full sm:min-h-[28rem]`,children:(0,$.jsx)(Lt,{runs:H,language:r,localeTag:i,labels:{boardEmptyTitle:a.boardEmptyTitle,boardEmptyHint:a.boardEmptyHint,boardStart:a.chooseWorkflow,loading:a.loading},searchQuery:``,workflowFilterId:``,triggerFilter:`all`,selectedRunId:null,loading:j,onOpenRun:w,onOpenRunChat:T,onCancelRun:e=>void P(e),onRetryRun:e=>void F(e),onStart:()=>x(`library`)})})]}):(0,$.jsxs)(`section`,{id:`workflow-panel-library`,role:`tabpanel`,"aria-labelledby":`workflow-tab-library`,className:`py-5`,children:[(0,$.jsxs)(`div`,{className:`mb-5`,children:[(0,$.jsx)(`h2`,{id:`workflow-library-heading`,className:`text-base font-semibold text-fg`,children:a.libraryTitle}),(0,$.jsx)(`p`,{className:`mt-1 max-w-2xl text-sm leading-6 text-fg-muted`,children:a.libraryDescription})]}),(0,$.jsx)(Ut,{definitions:s,runs:c,language:r,onPick:k,onDetail:D,onEdit:O})]}),re;return t[26]!==ne||t[27]!==q||t[28]!==K?(re=(0,$.jsx)(`main`,{className:`min-h-0 flex-1 overflow-y-auto bg-surface-panel`,children:(0,$.jsxs)(`div`,{className:`mx-auto flex min-h-full w-full max-w-[96rem] flex-col px-3 py-5 sm:px-5 xl:px-6`,children:[K,ne,q]})}),t[26]=ne,t[27]=q,t[28]=K,t[29]=re):re=t[29],re}function an(e,t){return(0,$.jsx)(nn,{},t)}function on(e){return(0,$.jsx)(E,{value:e.id,children:e.title},e.id)}function sn(e){return e.clearPageHeader}function cn(e){return e.setPageHeader}function ln(){let e=(0,Q.c)(114),t=p(mn),n;e[0]===t?n=e[1]:(n=d(t),e[0]=t,e[1]=n);let r=n.workflows,i=t===`zh`?`zh-CN`:`en-US`,s=f(pn),c=!!s,l=o(),[u,g]=a(),_;e[2]===u?_=e[3]:(_=u.get(`q`)??``,e[2]=u,e[3]=_);let v=_,y;e[4]===u?y=e[5]:(y=u.get(`wf`)?.trim()??``,e[4]=u,e[5]=y);let b=y,x;e[6]===u?x=e[7]:(x=u.get(`trigger`)?.trim()||`all`,e[6]=u,e[7]=x);let S=x,C,w,T,E;if(e[8]!==u){let t=u.get(`status`)?.trim()??``,n=u.get(`tab`)?.trim()??``,r=u.get(`layout`)?.trim()??``;C=u.get(`agent`)?.trim()??``,w=Ie.has(n)?n:`runs`,T=ce.has(r)?r:`list`,E=U.has(t)?t:`all`,e[8]=u,e[9]=C,e[10]=w,e[11]=T,e[12]=E}else C=e[9],w=e[10],T=e[11],E=e[12];let D=E,[O,A]=(0,Z.useState)(null),j;e[13]!==c||e[14]!==s?(j=c?[`workflow-agents`,s]:null,e[13]=c,e[14]=s,e[15]=j):j=e[15];let M;e[16]===Symbol.for(`react.memo_cache_sentinel`)?(M={revalidateOnFocus:!1},e[16]=M):M=e[16];let N=m(j,qe,M),P;bb0:{let e=N.data?.agents??[];if(C&&(e.length===0||e.some(e=>e.id===C))){P=C;break bb0}P=N.data?.defaultId}let F=P,I;e[17]!==c||e[18]!==s?(I=c?[`workflow-definitions`,s]:null,e[17]=c,e[18]=s,e[19]=I):I=e[19];let L;e[20]===Symbol.for(`react.memo_cache_sentinel`)?(L={revalidateOnFocus:!1},e[20]=L):L=e[20];let R=m(I,de,L),z;e[21]!==c||e[22]!==F||e[23]!==s?(z=c&&F?[`workflow-runs`,s,F]:null,e[21]=c,e[22]=F,e[23]=s,e[24]=z):z=e[24];let B;e[25]===F?B=e[26]:(B=()=>Ze(100,{ownerAgentId:F}),e[25]=F,e[26]=B);let V;e[27]===Symbol.for(`react.memo_cache_sentinel`)?(V={revalidateOnFocus:!1,refreshInterval:dn},e[27]=V):V=e[27];let H=m(z,B,V),W;e[28]===R.data?W=e[29]:(W=R.data??[],e[28]=R.data,e[29]=W);let G=W,te;e[30]===H.data?te=e[31]:(te=H.data??[],e[30]=H.data,e[31]=te);let K=te,ne;e[32]===g?ne=e[33]:(ne=e=>{g(t=>{let n=new URLSearchParams(t);return e(n),n},{replace:!0})},e[32]=g,e[33]=ne);let q=ne,ae;e[34]===q?ae=e[35]:(ae=e=>q(t=>{let n=e.trim();n?t.set(`q`,n):t.delete(`q`)}),e[34]=q,e[35]=ae);let oe=ae,se;e[36]===q?se=e[37]:(se=e=>q(t=>{let n=e.trim();n?t.set(ie,n):t.delete(ie)}),e[36]=q,e[37]=se);let le=se,ue;e[38]===q?ue=e[39]:(ue=e=>q(t=>{let n=e.trim();n?t.set(`wf`,n):t.delete(`wf`)}),e[38]=q,e[39]=ue);let fe=ue,Y;e[40]===q?Y=e[41]:(Y=e=>q(t=>{e&&e!==`all`?t.set(h,e):t.delete(h)}),e[40]=q,e[41]=Y);let pe=Y,me;e[42]===q?me=e[43]:(me=e=>q(t=>{e===`runs`?t.delete(`tab`):t.set(`tab`,e)}),e[42]=q,e[43]=me);let he=me,ge;e[44]===q?ge=e[45]:(ge=e=>q(t=>{e===`list`?t.delete(k):t.set(k,e)}),e[44]=q,e[45]=ge);let _e=ge,ye;e[46]===q?ye=e[47]:(ye=e=>q(t=>{e===`all`?t.delete(J):t.set(J,e)}),e[46]=q,e[47]=ye);let be=ye,xe;e[48]===q?xe=e[49]:(xe=()=>q(un),e[48]=q,e[49]=xe);let X=xe,Se=F?`?agentId=${encodeURIComponent(F)}`:``,Ce;e[50]!==l||e[51]!==Se?(Ce=e=>l(`/workflows/${e.id}${Se}`),e[50]=l,e[51]=Se,e[52]=Ce):Ce=e[52];let we=Ce,Te=we,Ee;e[53]!==l||e[54]!==F||e[55]!==Se?(Ee=e=>{l(e.metadata.source===`user`?`/workflows/${e.id}/edit${Se}`:`/workflows/new?copy=${encodeURIComponent(e.id)}${F?`&agentId=${encodeURIComponent(F)}`:``}`)},e[53]=l,e[54]=F,e[55]=Se,e[56]=Ee):Ee=e[56];let De=Ee,Oe;e[57]!==l||e[58]!==Se?(Oe=e=>l(`/workflows/runs/${e.id}${Se}`),e[57]=l,e[58]=Se,e[59]=Oe):Oe=e[59];let ke=Oe,Ae;e[60]===l?Ae=e[61]:(Ae=e=>{let t=ht(e);t&&l(re(t))},e[60]=l,e[61]=Ae);let je=Ae,Me;e[62]!==r.cancelFailed||e[63]!==F||e[64]!==H?(Me=async e=>{try{await ve(e,{ownerAgentId:F}),await H.mutate()}catch(e){let t=e;A(t instanceof Error?t.message:r.cancelFailed)}},e[62]=r.cancelFailed,e[63]=F,e[64]=H,e[65]=Me):Me=e[65];let Ne=Me,Pe;e[66]!==r.retryFailed||e[67]!==l||e[68]!==F||e[69]!==Se?(Pe=async e=>{try{l(`/workflows/runs/${(await ee(e,{ownerAgentId:F})).runId}${Se}`)}catch(e){let t=e;A(t instanceof Error?t.message:r.retryFailed)}},e[66]=r.retryFailed,e[67]=l,e[68]=F,e[69]=Se,e[70]=Pe):Pe=e[70];let Fe=Pe,Le,Re;e[71]===H?(Le=e[72],Re=e[73]):(Le=()=>{let e=()=>void H.mutate();return window.addEventListener(`workflow-run-updated`,e),window.addEventListener(`workflow-run-error`,e),()=>{window.removeEventListener(`workflow-run-updated`,e),window.removeEventListener(`workflow-run-error`,e)}},Re=[H],e[71]=H,e[72]=Le,e[73]=Re),(0,Z.useEffect)(Le,Re);let ze;e[74]!==N||e[75]!==R||e[76]!==H?(ze=()=>{Promise.all([N.mutate(),R.mutate(),H.mutate()])},e[74]=N,e[75]=R,e[76]=H,e[77]=ze):ze=e[77];let Be=ze,Ve=N.isLoading||R.isLoading||H.isLoading,He=N.error?.message??R.error?.message??H.error?.message??null,Ue;e[78]===N.data?.agents?Ue=e[79]:(Ue=N.data?.agents??[],e[78]=N.data?.agents,e[79]=Ue);let We;return e[80]!==O||e[81]!==Ne||e[82]!==X||e[83]!==G||e[84]!==He||e[85]!==c||e[86]!==r||e[87]!==t||e[88]!==Ve||e[89]!==i||e[90]!==we||e[91]!==ke||e[92]!==je||e[93]!==De||e[94]!==F||e[95]!==w||e[96]!==Be||e[97]!==Fe||e[98]!==T||e[99]!==K||e[100]!==v||e[101]!==le||e[102]!==he||e[103]!==_e||e[104]!==oe||e[105]!==be||e[106]!==pe||e[107]!==fe||e[108]!==Te||e[109]!==D||e[110]!==Ue||e[111]!==S||e[112]!==b?(We={language:t,localeTag:i,labels:r,hasToken:c,searchQuery:v,setSearchQuery:oe,ownerAgentId:F,agentOptions:Ue,setOwnerAgentId:le,workflowFilterId:b,setWorkflowFilterId:fe,triggerFilter:S,setTriggerFilter:pe,statusFilter:D,setStatusFilter:be,clearRunFilters:X,pageTab:w,setPageTab:he,runLayout:T,setRunLayout:_e,definitions:G,runs:K,openDefinitionDetails:we,startWorkflow:Te,openWorkflowEditor:De,openRunDetails:ke,openRunInChat:je,actionError:O,loading:Ve,error:He,refreshAll:Be,cancelRun:Ne,retryRun:Fe},e[80]=O,e[81]=Ne,e[82]=X,e[83]=G,e[84]=He,e[85]=c,e[86]=r,e[87]=t,e[88]=Ve,e[89]=i,e[90]=we,e[91]=ke,e[92]=je,e[93]=De,e[94]=F,e[95]=w,e[96]=Be,e[97]=Fe,e[98]=T,e[99]=K,e[100]=v,e[101]=le,e[102]=he,e[103]=_e,e[104]=oe,e[105]=be,e[106]=pe,e[107]=fe,e[108]=Te,e[109]=D,e[110]=Ue,e[111]=S,e[112]=b,e[113]=We):We=e[113],We}function un(e){e.delete(`q`),e.delete(`wf`),e.delete(h),e.delete(J)}function dn(e){return e?.some(fn)?3e3:0}function fn(e){return e.status===`queued`||e.status===`running`}function pn(e){return e.token}function mn(e){return e.language}function hn(){let e=(0,Q.c)(2),t=ln(),n;return e[0]===t?n=e[1]:(n=(0,$.jsx)(rn,{vm:t}),e[0]=t,e[1]=n),n}function gn(e){return{title:e.title,description:e.description,version:e.version,inputSchema:e.inputSchema,outputSchema:e.outputSchema,defaults:e.defaults,tags:e.metadata.tags,whenToUse:e.metadata.whenToUse,estimatedAgents:e.metadata.estimatedAgents,permissions:e.permissions,resources:e.resources}}function _n(e,t){let n=new Set(t);if(!n.has(e))return e;for(let t=2;t<1e3;t+=1){let r=`${e}_${t}`;if(!n.has(r))return r}return`${e}_${Date.now()}`}function vn(e){if(!(e instanceof Error))return null;let t=e;if(t.status!==409||!t.body||typeof t.body!=`object`)return null;let n=t.body,r=typeof n.currentRevision==`number`?n.currentRevision:0;return n.code===`WORKFLOW_NAME_EXISTS`&&typeof n.name==`string`&&typeof n.suggestedName==`string`?{code:`WORKFLOW_NAME_EXISTS`,name:n.name,currentRevision:r,suggestedName:n.suggestedName}:n.code===`WORKFLOW_REVISION_CONFLICT`?{code:`WORKFLOW_REVISION_CONFLICT`,currentRevision:r}:null}var yn={padding:.24,minZoom:.45,maxZoom:1};function bn({language:e,ownerAgentId:t,saving:n,initialDraft:r,initialName:i,existingNames:a,saveConflict:o,onSave:c,onSaveAndStart:u,onClearSaveConflict:d,onReloadLatest:f}){let p=zn(e),[m,h]=(0,Z.useState)(`my_workflow`),[_,v]=(0,Z.useState)(()=>Mn()),[y,x]=(0,Z.useState)(()=>({title:p.untitled,description:``,tags:[`custom`]})),[S,C]=(0,Z.useState)(`agent-1`),[T,E,D]=dt(_.nodes.map(e=>An(e,e.id===`agent-1`))),[O,k]=(0,Z.useState)(``),[A,j]=(0,Z.useState)(``),[M,N]=(0,Z.useState)(!1),[P,F]=(0,Z.useState)(null),[I,L]=(0,Z.useState)(null),[R,z]=(0,Z.useState)(!!r),[B,V]=(0,Z.useState)(null),[H,U]=(0,Z.useState)(`idle`),[W,G]=(0,Z.useState)(0),[ee,K]=(0,Z.useState)([]),[ne,q]=(0,Z.useState)(null),re=(0,Z.useRef)(``),ie=(0,Z.useRef)(``),ae=(0,Z.useRef)(void 0),oe=(0,Z.useRef)(void 0),se=(0,Z.useRef)(!1),ce=(0,Z.useRef)(null),[le,J]=(0,Z.useState)(0);(0,Z.useEffect)(()=>{let e=`${r?.mode??`new`}:${r?.name??i}:${r?.baseRevision??0}:${r?.repairPrompt??``}`;re.current!==e&&(re.current=e,h(r?.name??i),v(structuredClone(r?.graph??Mn())),J(e=>e+1),x(structuredClone(r?.manifest??{title:p.untitled,description:``,tags:[`custom`]})),C(r?.graph.nodes.find(e=>e.kind===`agent`)?.id??`agent-1`),k(r?.repairPrompt??``),F(null),L(null),z(!!r),j(``),V(null),G(r?.baseRevision??0),K([]),q(null),ae.current=void 0,oe.current=void 0,U(`idle`))},[p.untitled,r,i]),(0,Z.useEffect)(()=>{r?.mode===`edit`&&Ke(r.name).then(K).catch(()=>K([]))},[r?.mode,r?.name]),(0,Z.useEffect)(()=>{if(!m.trim())return;let e=window.setTimeout(()=>{w(m,_).then(V).catch(()=>V(null))},350);return()=>window.clearTimeout(e)},[_,m]),(0,Z.useEffect)(()=>{if(!m.trim())return;U(`saving`);let e=window.setTimeout(()=>{b({id:ae.current,workflowName:m,graph:_,manifest:y,baseRevision:W,expectedUpdatedAtMs:oe.current}).then(e=>{ae.current=e.id,oe.current=e.updatedAtMs,U(`saved`)}).catch(()=>U(`error`))},900);return()=>window.clearTimeout(e)},[W,_,y,m]);let ue=(0,Z.useMemo)(()=>Pn(_,P?.graph??null),[_,P?.graph]),de=(0,Z.useMemo)(()=>{if(!P)return _;let e=new Set(P.graph.nodes.map(e=>e.id)),t=_.nodes.filter(t=>!e.has(t.id));return{...P.graph,nodes:[...P.graph.nodes,...t]}},[_,P]);(0,Z.useLayoutEffect)(()=>{E(e=>{let t=new Map(e.map(e=>[e.id,e]));return de.nodes.map(e=>({...t.get(e.id),...An(e,e.id===S,ue.nodeStates.get(e.id))}))})},[de.nodes,ue.nodeStates,S,E]),(0,Z.useEffect)(()=>{let e=ce.current;if(!e||de.nodes.length===0)return;let t=window.requestAnimationFrame(()=>{e.fitView(yn)});return()=>window.cancelAnimationFrame(t)},[de.nodes.length,le]);let me=(0,Z.useMemo)(()=>de.edges.map(jn),[de.edges]),he=_.nodes.find(e=>e.id===S)??null,_e=(0,Z.useMemo)(()=>new Set(a),[a]),ve=r?.mode!==`edit`&&_e.has(m),ye=ve?_n(m,_e):m,Se=B?.valid===!0&&!ve&&!n&&!M,Ce=(0,Z.useCallback)(e=>{v(t=>{let n=t.nodes.map(t=>t.id!==e.id||t.position.x===e.position.x&&t.position.y===e.position.y?t:{...t,position:e.position});return n.some((e,n)=>e!==t.nodes[n])?{...t,nodes:n}:t})},[]),we=(0,Z.useCallback)(e=>{let t=e.filter(e=>e.type!==`select`);t.length!==0&&v(e=>({...e,edges:it(t,e.edges.map(jn)).map(e=>({id:e.id,source:e.source,target:e.target,sourcePort:e.sourceHandle===`true`||e.sourceHandle===`false`?e.sourceHandle:void 0}))}))},[]),Ee=(0,Z.useCallback)(e=>{!e.source||!e.target||v(t=>({...t,edges:ot({...e,id:`edge-${crypto.randomUUID()}`},t.edges.map(jn)).map(e=>({id:e.id,source:e.source,target:e.target,sourcePort:e.sourceHandle===`true`||e.sourceHandle===`false`?e.sourceHandle:void 0}))}))},[]),De=(0,Z.useCallback)((e,t)=>{v(n=>({...n,nodes:n.nodes.map(n=>n.id===e?t(n):n)}))},[]),Oe=e=>{let t=`${e}-${crypto.randomUUID().slice(0,8)}`,n=Nn(e,t,_.nodes.length);v(e=>{let r=e.nodes.find(e=>e.id===S&&e.kind!==`output`),i=r?[{id:`edge-${crypto.randomUUID()}`,source:r.id,target:t}]:[];return{...e,nodes:[...e.nodes,n],edges:[...e.edges,...i]}}),J(e=>e+1),C(t)},ke=()=>{!he||he.kind===`input`||he.kind===`output`||(v(e=>({...e,nodes:e.nodes.filter(e=>e.id!==he.id),edges:e.edges.filter(e=>e.source!==he.id&&e.target!==he.id)})),J(e=>e+1),C(``))},Ae=(0,Z.useCallback)(async()=>{if(O.trim()){N(!0);try{let n=await xe({prompt:O,agentId:t,language:e===`zh`?`zh`:`en`,mode:r||_.nodes.length>3?`improve`:`create`,existingGraph:_}),i=r?.mode===`edit`?r.name:_n(n.name,_e);L(i===n.name?null:n.name),F(i===n.name?n:{...n,name:i}),z(!0),J(e=>e+1),C(n.graph.nodes.find(e=>e.kind===`agent`)?.id??``)}finally{N(!1)}}},[O,_e,_,r,e,t]);(0,Z.useEffect)(()=>{let e=r?.repairPrompt?.trim();!e||O.trim()!==e||M||P||ie.current===e||(ie.current=e,Ae())},[O,Ae,M,r?.repairPrompt,P]);let je=()=>{F(null),L(null),C(_.nodes.find(e=>e.kind===`agent`)?.id??``),J(e=>e+1)},Me=async()=>{if(!(!P||n||se.current)){se.current=!0;try{let e=await c({name:P.name,graph:P.graph,manifest:P.manifest,expectedRevision:W});if(!e)return;h(e.name),v(structuredClone(e.graph)),x(gn(e)),V(P.validation),G(e.revision),F(null),L(null),k(``),C(e.graph.nodes.find(e=>e.kind===`agent`)?.id??``),ae.current&&await Fe(ae.current).catch(()=>void 0)}catch{}finally{se.current=!1}}},Ne=async e=>{if(!Se||se.current)return;se.current=!0;let t={name:m,graph:_,manifest:y,expectedRevision:W};try{if(e)await u({...t,goal:A.trim()||y.description||m});else{let e=await c(t);if(!e)return;G(e.revision)}ae.current&&await Fe(ae.current).catch(()=>void 0)}catch{return}finally{se.current=!1}},Pe=async e=>{if(!(ne!==null||r?.mode!==`edit`)){q(e);try{let t=await Ye(r.name,e,W);v(t.graph),J(e=>e+1),x(gn(t)),G(t.revision),C(t.graph.nodes.find(e=>e.kind===`agent`)?.id??``),K(await Ke(r.name))}finally{q(null)}}};return(0,$.jsxs)(`main`,{className:`flex min-h-0 flex-1 flex-col overflow-hidden bg-surface-panel`,children:[(0,$.jsxs)(`header`,{className:`flex shrink-0 items-center gap-3 border-b border-edge px-4 py-3`,children:[(0,$.jsx)(s,{to:`/workflows`,className:l(`inline-flex size-9 shrink-0 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover hover:text-fg`,be.focusRingPanel),"aria-label":e===`zh`?`返回工作流`:`Back to workflows`,children:(0,$.jsx)(te,{className:`size-4`,"aria-hidden":!0})}),(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,$.jsx)(`h1`,{className:`text-base font-semibold text-fg`,children:r?.mode===`edit`?p.editTitle:p.createTitle}),(0,$.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:p.subtitle})]}),(0,$.jsx)(`span`,{className:l(`text-xs`,H===`error`?`text-danger`:`text-fg-subtle`),children:H===`saving`?p.savingDraft:H===`saved`?p.savedDraft:H===`error`?p.draftError:``})]}),o?(0,$.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center gap-2 border-b border-warning/30 bg-warning/5 px-4 py-2 text-sm text-fg`,children:[(0,$.jsx)(`span`,{className:`min-w-0 flex-1`,children:o.code===`WORKFLOW_NAME_EXISTS`?e===`zh`?`内部名称“${o.name}”已被使用。`:`The internal name “${o.name}” is already in use.`:e===`zh`?`这个工作流已更新到版本 ${o.currentRevision}。`:`This workflow has changed to revision ${o.currentRevision}.`}),o.code===`WORKFLOW_NAME_EXISTS`?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(Y,{variant:`secondary`,className:`h-8`,onClick:()=>{h(o.suggestedName),d()},children:e===`zh`?`使用 ${o.suggestedName}`:`Use ${o.suggestedName}`}),(0,$.jsx)(s,{className:`text-sm font-medium text-accent-fg hover:underline`,to:`/workflows/${encodeURIComponent(o.name)}`,children:e===`zh`?`打开已有工作流`:`Open existing`})]}):(0,$.jsx)(Y,{variant:`secondary`,className:`h-8`,onClick:f,children:e===`zh`?`加载最新版本`:`Load latest`})]}):null,!o&&ve?(0,$.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center gap-2 border-b border-warning/30 bg-warning/5 px-4 py-2 text-sm text-fg`,children:[(0,$.jsx)(`span`,{className:`min-w-0 flex-1`,children:e===`zh`?`内部名称“${m}”已被使用。`:`The internal name “${m}” is already in use.`}),(0,$.jsx)(Y,{variant:`secondary`,className:`h-8`,onClick:()=>h(ye),children:e===`zh`?`使用 ${ye}`:`Use ${ye}`})]}):null,!o&&!ve&&I&&P?(0,$.jsx)(`div`,{className:`shrink-0 border-b border-accent/20 bg-accent/5 px-4 py-2 text-sm text-fg-muted`,children:e===`zh`?`“${I}”已存在,方案将保存为“${P.name}”。`:`“${I}” already exists. This proposal will be saved as “${P.name}”.`}):null,R?(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-y-auto lg:flex-row lg:overflow-hidden`,children:[(0,$.jsxs)(`section`,{className:`flex min-h-[32rem] min-w-0 flex-1 flex-col bg-surface-base lg:min-h-0`,children:[(0,$.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center gap-2 border-b border-edge px-3 py-2`,children:[(0,$.jsxs)(`div`,{className:`mr-2 min-w-36`,children:[(0,$.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:p.flowTitle}),(0,$.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:p.stepCount(_.nodes.length)})]}),(0,$.jsxs)(Y,{variant:`secondary`,className:`h-8 rounded-lg text-xs`,disabled:!!P,onClick:()=>Oe(`agent`),children:[(0,$.jsx)(X,{className:`size-3.5`}),p.addAgent]}),(0,$.jsxs)(Y,{variant:`secondary`,className:`h-8 rounded-lg text-xs`,disabled:!!P,onClick:()=>Oe(`decision`),children:[(0,$.jsx)(Te,{className:`size-3.5`}),p.addDecision]}),(0,$.jsxs)(Y,{variant:`secondary`,className:`h-8 rounded-lg text-xs`,disabled:!!P,onClick:()=>Oe(`merge`),children:[(0,$.jsx)(g,{className:`size-3.5`}),p.addMerge]}),(0,$.jsx)(`span`,{className:`ml-auto text-xs text-fg-subtle`,children:p.canvasHint})]}),(0,$.jsx)(`div`,{className:`relative min-h-72 flex-1`,children:_.nodes.length>0?(0,$.jsxs)(lt,{"aria-label":p.flowAria,nodes:T,edges:me,nodeTypes:Dn,onNodesChange:D,onEdgesChange:we,onConnect:Ee,nodesDraggable:!P,nodesConnectable:!P,onNodeClick:(e,t)=>C(t.id),onNodeDragStart:(e,t)=>C(t.id),onNodeDragStop:(e,t)=>Ce(t),onInit:e=>{ce.current=e,window.requestAnimationFrame(()=>{e.fitView(yn)})},fitView:!0,fitViewOptions:yn,minZoom:.25,maxZoom:1.5,deleteKeyCode:null,proOptions:{hideAttribution:!0},children:[(0,$.jsx)(ft,{color:`var(--color-edge)`,gap:22,size:1}),(0,$.jsx)(ct,{showInteractive:!1,className:`!border-edge !bg-surface-panel !shadow-surface`})]}):(0,$.jsx)(`div`,{className:`flex h-full items-center justify-center px-6 text-center text-sm text-fg-muted`,children:p.emptyFlow})})]}),(0,$.jsx)(`aside`,{className:`flex w-full shrink-0 flex-col border-t border-edge bg-surface-panel lg:w-[22rem] lg:border-l lg:border-t-0`,children:(0,$.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-4`,children:P?(0,$.jsx)(Sn,{proposal:P,diff:ue,copy:p,saving:n,onAccept:()=>void Me(),onReject:je}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`section`,{children:[(0,$.jsx)(`label`,{className:`block text-xs font-medium text-fg`,htmlFor:`workflow-title`,children:p.humanTitle}),(0,$.jsx)(`input`,{id:`workflow-title`,value:y.title??``,onChange:e=>x(t=>({...t,title:e.target.value})),className:kn}),(0,$.jsx)(`label`,{className:`mt-3 block text-xs font-medium text-fg`,htmlFor:`workflow-description`,children:p.task}),(0,$.jsx)(`textarea`,{id:`workflow-description`,value:y.description??``,onChange:e=>x(t=>({...t,description:e.target.value})),className:`${kn} min-h-20 resize-y`}),(0,$.jsxs)(`details`,{className:`mt-4 border-t border-edge pt-3`,children:[(0,$.jsx)(`summary`,{className:`cursor-pointer text-xs font-medium text-fg-muted`,children:p.advanced}),(0,$.jsx)(`label`,{className:`mt-3 block text-xs font-medium text-fg`,htmlFor:`workflow-name`,children:p.workflowName}),(0,$.jsx)(`input`,{id:`workflow-name`,value:m,onChange:e=>h(Ln(e.target.value)),className:kn}),ve?(0,$.jsx)(`p`,{className:`mt-1 text-xs text-danger`,children:e===`zh`?`该内部名称已被使用,请换一个名称。`:`This internal name is already in use.`}):null,r?.mode===`edit`&&ee.length>0?(0,$.jsxs)(`div`,{className:`mt-4 border-t border-edge pt-3`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2 text-xs font-medium text-fg-muted`,children:[(0,$.jsx)(ge,{className:`size-3.5`}),p.versions,` · v`,W]}),(0,$.jsx)(`div`,{className:`mt-2 space-y-1`,children:ee.map(t=>(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-2 rounded-lg px-2 py-1.5 hover:bg-surface-hover`,children:[(0,$.jsxs)(`span`,{className:`min-w-0 text-xs text-fg-muted`,children:[`v`,t.revision,` · `,ze(t.createdAtMs,e)]}),t.revision===W?(0,$.jsx)(`span`,{className:`text-xs text-fg-subtle`,children:p.currentVersion}):(0,$.jsxs)(Y,{variant:`ghost`,className:`h-7 shrink-0 px-2 text-xs`,disabled:ne!==null,onClick:()=>void Pe(t.revision),children:[(0,$.jsx)(Be,{className:`size-3`}),ne===t.revision?p.restoring:p.restore]})]},t.revision))})]}):null]})]}),(0,$.jsx)(`div`,{className:`my-4 border-t border-edge`}),he?(0,$.jsx)(On,{node:he,copy:p,updateNode:De,onDelete:ke}):(0,$.jsx)(`div`,{className:`py-8 text-center text-sm text-fg-muted`,children:p.selectNode}),B&&!B.valid?(0,$.jsxs)(`section`,{className:`mt-4 rounded-lg border border-danger/30 bg-danger/5 p-3`,children:[(0,$.jsx)(`h3`,{className:`text-xs font-medium text-danger`,children:p.needsAttention}),(0,$.jsx)(`ul`,{className:`mt-2 space-y-1 text-xs text-danger`,children:B.errors.slice(0,5).map((e,t)=>(0,$.jsxs)(`li`,{children:[`• `,e.message]},`${e.code}-${t}`))})]}):null]})})})]}),(0,$.jsx)(`footer`,{className:`shrink-0 border-t border-edge bg-surface-panel p-3`,children:(0,$.jsxs)(`div`,{className:`flex flex-col gap-2 lg:flex-row lg:items-center`,children:[(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-center gap-2`,children:[(0,$.jsx)(Le,{className:`size-4 shrink-0 text-accent-fg`}),(0,$.jsx)(`input`,{value:O,onChange:e=>k(e.target.value),onKeyDown:e=>{e.key===`Enter`&&Ae()},placeholder:p.aiPlaceholder,className:`${kn} mt-0 flex-1`}),(0,$.jsx)(Y,{variant:`secondary`,className:`h-10 shrink-0`,disabled:!!P||M||!O.trim(),onClick:()=>void Ae(),children:M?p.designing:p.applyWithAi})]}),(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(`input`,{value:A,onChange:e=>j(e.target.value),placeholder:p.testGoal,className:`${kn} mt-0 w-52`}),(0,$.jsxs)(Y,{variant:`secondary`,disabled:!Se,onClick:()=>void Ne(!1),children:[(0,$.jsx)(pe,{className:`size-4`}),p.publish]}),(0,$.jsxs)(Y,{variant:`primary`,disabled:!Se,onClick:()=>void Ne(!0),children:[(0,$.jsx)(fe,{className:`size-4`}),p.publishAndRun]})]})]})})]}):(0,$.jsx)(xn,{copy:p,prompt:O,generating:M,onPromptChange:k,onGenerate:()=>void Ae(),onManual:()=>z(!0)})]})}function xn(e){let t=(0,Q.c)(38),{copy:n,prompt:r,generating:i,onPromptChange:a,onGenerate:o,onManual:s}=e,c;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,$.jsx)(`div`,{className:`flex size-11 items-center justify-center rounded-2xl bg-accent-soft text-accent-fg`,children:(0,$.jsx)(Le,{className:`size-5`})}),t[0]=c):c=t[0];let l;t[1]===n.introTitle?l=t[2]:(l=(0,$.jsx)(`h2`,{className:`mt-5 text-2xl font-semibold text-fg`,children:n.introTitle}),t[1]=n.introTitle,t[2]=l);let u;t[3]===n.introDescription?u=t[4]:(u=(0,$.jsx)(`p`,{className:`mt-2 text-sm leading-6 text-fg-muted`,children:n.introDescription}),t[3]=n.introDescription,t[4]=u);let d;t[5]===a?d=t[6]:(d=e=>a(e.target.value),t[5]=a,t[6]=d);let f;t[7]!==n.introPlaceholder||t[8]!==r||t[9]!==d?(f=(0,$.jsx)(`textarea`,{value:r,onChange:d,placeholder:n.introPlaceholder,className:`${kn} mt-6 h-auto min-h-32 resize-y py-3 text-base leading-6`}),t[7]=n.introPlaceholder,t[8]=r,t[9]=d,t[10]=f):f=t[10];let p;if(t[11]!==n.examples||t[12]!==a){let e;t[14]===a?e=t[15]:(e=e=>(0,$.jsx)(`button`,{type:`button`,className:`rounded-full border border-edge bg-surface-panel px-3 py-1.5 text-xs text-fg-muted hover:bg-surface-hover hover:text-fg`,onClick:()=>a(e),children:e},e),t[14]=a,t[15]=e),p=n.examples.map(e),t[11]=n.examples,t[12]=a,t[13]=p}else p=t[13];let m;t[16]===p?m=t[17]:(m=(0,$.jsx)(`div`,{className:`mt-3 flex flex-wrap gap-2`,children:p}),t[16]=p,t[17]=m);let h;t[18]!==i||t[19]!==r?(h=!r.trim()||i,t[18]=i,t[19]=r,t[20]=h):h=t[20];let g;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,$.jsx)(Le,{className:`size-4`}),t[21]=g):g=t[21];let _=i?n.designing:n.designWorkflow,v;t[22]!==o||t[23]!==_||t[24]!==h?(v=(0,$.jsxs)(Y,{variant:`primary`,disabled:h,onClick:o,children:[g,_]}),t[22]=o,t[23]=_,t[24]=h,t[25]=v):v=t[25];let y;t[26]!==n.manualStart||t[27]!==s?(y=(0,$.jsx)(Y,{variant:`ghost`,onClick:s,children:n.manualStart}),t[26]=n.manualStart,t[27]=s,t[28]=y):y=t[28];let b;t[29]!==v||t[30]!==y?(b=(0,$.jsxs)(`div`,{className:`mt-6 flex flex-wrap items-center gap-3`,children:[v,y]}),t[29]=v,t[30]=y,t[31]=b):b=t[31];let x;return t[32]!==b||t[33]!==l||t[34]!==u||t[35]!==f||t[36]!==m?(x=(0,$.jsx)(`section`,{className:`flex min-h-0 flex-1 items-center justify-center overflow-y-auto bg-surface-base px-5 py-10`,children:(0,$.jsxs)(`div`,{className:`w-full max-w-2xl`,children:[c,l,u,f,m,b]})}),t[32]=b,t[33]=l,t[34]=u,t[35]=f,t[36]=m,t[37]=x):x=t[37],x}function Sn(e){let t=(0,Q.c)(74),{proposal:n,diff:r,copy:i,saving:a,onAccept:o,onReject:s}=e,l;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,$.jsx)(`span`,{className:`flex size-8 shrink-0 items-center justify-center rounded-xl bg-accent-soft text-accent-fg`,children:(0,$.jsx)(Le,{className:`size-4`})}),t[0]=l):l=t[0];let u;t[1]===i.proposalTitle?u=t[2]:(u=(0,$.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:i.proposalTitle}),t[1]=i.proposalTitle,t[2]=u);let d;t[3]===i.proposalHint?d=t[4]:(d=(0,$.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:i.proposalHint}),t[3]=i.proposalHint,t[4]=d);let f;t[5]!==u||t[6]!==d?(f=(0,$.jsxs)(`div`,{className:`flex items-start gap-2`,children:[l,(0,$.jsxs)(`div`,{className:`min-w-0`,children:[u,d]})]}),t[5]=u,t[6]=d,t[7]=f):f=t[7];let p=n.manifest.title||n.name,m;t[8]===p?m=t[9]:(m=(0,$.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:p}),t[8]=p,t[9]=m);let h=n.explanation||n.manifest.description,g;t[10]===h?g=t[11]:(g=(0,$.jsx)(`p`,{className:`mt-2 text-sm leading-6 text-fg-muted`,children:h}),t[10]=h,t[11]=g);let _;t[12]===i.added?_=t[13]:(_=(0,$.jsx)(`dt`,{className:`text-fg-subtle`,children:i.added}),t[12]=i.added,t[13]=_);let v;t[14]===r.addedIds.length?v=t[15]:(v=(0,$.jsx)(`dd`,{className:`mt-1 font-semibold text-success`,children:r.addedIds.length}),t[14]=r.addedIds.length,t[15]=v);let y;t[16]!==v||t[17]!==_?(y=(0,$.jsxs)(`div`,{className:`rounded-lg bg-success-soft p-2`,children:[_,v]}),t[16]=v,t[17]=_,t[18]=y):y=t[18];let b;t[19]===i.changed?b=t[20]:(b=(0,$.jsx)(`dt`,{className:`text-fg-subtle`,children:i.changed}),t[19]=i.changed,t[20]=b);let x=r.changedIds.length+r.connectionChanges,S;t[21]===x?S=t[22]:(S=(0,$.jsx)(`dd`,{className:`mt-1 font-semibold text-accent-fg`,children:x}),t[21]=x,t[22]=S);let C;t[23]!==b||t[24]!==S?(C=(0,$.jsxs)(`div`,{className:`rounded-lg bg-accent-soft p-2`,children:[b,S]}),t[23]=b,t[24]=S,t[25]=C):C=t[25];let w;t[26]===i.removed?w=t[27]:(w=(0,$.jsx)(`dt`,{className:`text-fg-subtle`,children:i.removed}),t[26]=i.removed,t[27]=w);let T;t[28]===r.removedIds.length?T=t[29]:(T=(0,$.jsx)(`dd`,{className:`mt-1 font-semibold text-danger`,children:r.removedIds.length}),t[28]=r.removedIds.length,t[29]=T);let E;t[30]!==w||t[31]!==T?(E=(0,$.jsxs)(`div`,{className:`rounded-lg bg-danger/5 p-2`,children:[w,T]}),t[30]=w,t[31]=T,t[32]=E):E=t[32];let D;t[33]!==y||t[34]!==C||t[35]!==E?(D=(0,$.jsxs)(`dl`,{className:`mt-3 grid grid-cols-3 gap-2 text-center text-xs`,children:[y,C,E]}),t[33]=y,t[34]=C,t[35]=E,t[36]=D):D=t[36];let O;t[37]!==D||t[38]!==m||t[39]!==g?(O=(0,$.jsxs)(`div`,{className:`mt-4 rounded-xl border border-edge bg-surface-base/50 p-3`,children:[m,g,D]}),t[37]=D,t[38]=m,t[39]=g,t[40]=O):O=t[40];let k;t[41]!==i.assumptions||t[42]!==n.assumptions?(k=n.assumptions.length?(0,$.jsx)(wn,{title:i.assumptions,items:n.assumptions}):null,t[41]=i.assumptions,t[42]=n.assumptions,t[43]=k):k=t[43];let A;t[44]!==i.risks||t[45]!==n.risks?(A=n.risks.length?(0,$.jsx)(wn,{title:i.risks,items:n.risks}):null,t[44]=i.risks,t[45]=n.risks,t[46]=A):A=t[46];let j;t[47]!==i.permissions||t[48]!==n.permissionsSummary?(j=n.permissionsSummary.length?(0,$.jsx)(wn,{title:i.permissions,items:n.permissionsSummary}):null,t[47]=i.permissions,t[48]=n.permissionsSummary,t[49]=j):j=t[49];let M;t[50]!==n.validation.errors||t[51]!==n.validation.valid?(M=n.validation.valid?null:(0,$.jsx)(`div`,{className:`mt-4 rounded-xl border border-danger/30 bg-danger/5 p-3 text-xs text-danger`,children:n.validation.errors.slice(0,4).map(Cn)}),t[50]=n.validation.errors,t[51]=n.validation.valid,t[52]=M):M=t[52];let N=a||!n.validation.valid,P;t[53]===Symbol.for(`react.memo_cache_sentinel`)?(P=(0,$.jsx)(c,{className:`size-4`}),t[53]=P):P=t[53];let F=a?i.savingProposal:i.acceptAndSave,I;t[54]!==o||t[55]!==N||t[56]!==F?(I=(0,$.jsxs)(Y,{variant:`primary`,disabled:N,onClick:o,children:[P,F]}),t[54]=o,t[55]=N,t[56]=F,t[57]=I):I=t[57];let L;t[58]===Symbol.for(`react.memo_cache_sentinel`)?(L=(0,$.jsx)(he,{className:`size-4`}),t[58]=L):L=t[58];let R;t[59]!==i.rejectProposal||t[60]!==s||t[61]!==a?(R=(0,$.jsxs)(Y,{variant:`ghost`,disabled:a,onClick:s,children:[L,i.rejectProposal]}),t[59]=i.rejectProposal,t[60]=s,t[61]=a,t[62]=R):R=t[62];let z;t[63]!==I||t[64]!==R?(z=(0,$.jsxs)(`div`,{className:`mt-5 grid gap-2`,children:[I,R]}),t[63]=I,t[64]=R,t[65]=z):z=t[65];let B;return t[66]!==O||t[67]!==k||t[68]!==A||t[69]!==j||t[70]!==M||t[71]!==z||t[72]!==f?(B=(0,$.jsxs)(`section`,{children:[f,O,k,A,j,M,z]}),t[66]=O,t[67]=k,t[68]=A,t[69]=j,t[70]=M,t[71]=z,t[72]=f,t[73]=B):B=t[73],B}function Cn(e){return(0,$.jsxs)(`p`,{children:[`• `,e.message]},`${e.code}:${e.message}`)}function wn(e){let t=(0,Q.c)(9),{title:n,items:r}=e,i;t[0]===n?i=t[1]:(i=(0,$.jsx)(`h3`,{className:`text-xs font-semibold uppercase tracking-wide text-fg-subtle`,children:n}),t[0]=n,t[1]=i);let a;t[2]===r?a=t[3]:(a=r.slice(0,4).map(Tn),t[2]=r,t[3]=a);let o;t[4]===a?o=t[5]:(o=(0,$.jsx)(`ul`,{className:`mt-2 space-y-1 text-xs leading-5 text-fg-muted`,children:a}),t[4]=a,t[5]=o);let s;return t[6]!==i||t[7]!==o?(s=(0,$.jsxs)(`section`,{className:`mt-4`,children:[i,o]}),t[6]=i,t[7]=o,t[8]=s):s=t[8],s}function Tn(e){return(0,$.jsxs)(`li`,{children:[`• `,e]},e)}function En(e){let t=(0,Q.c)(34),{data:n,selected:r}=e,i=n.workflowNode,a=n.diffState,o;t[0]===i.kind?o=t[1]:(o=i.kind===`input`?(0,$.jsx)(Re,{}):i.kind===`agent`?(0,$.jsx)(X,{}):i.kind===`decision`?(0,$.jsx)(Te,{}):i.kind===`merge`?(0,$.jsx)(g,{}):(0,$.jsx)(fe,{}),t[0]=i.kind,t[1]=o);let s=o,c=r?`border-accent ring-2 ring-accent/20`:`border-edge`,u=a===`added`&&`border-success ring-2 ring-success/15`,d=a===`changed`&&`border-accent ring-2 ring-accent/15`,f=a===`removed`&&`border-dashed border-danger opacity-55`,p;t[2]!==c||t[3]!==u||t[4]!==d||t[5]!==f?(p=l(`w-52 rounded-xl border bg-surface-panel p-3 shadow-surface transition-colors`,c,u,d,f),t[2]=c,t[3]=u,t[4]=d,t[5]=f,t[6]=p):p=t[6];let m;t[7]===i.kind?m=t[8]:(m=i.kind===`input`?null:(0,$.jsx)(ut,{type:`target`,position:st.Left,className:`!size-2.5 !border-2 !border-surface-panel !bg-fg-subtle`}),t[7]=i.kind,t[8]=m);let h;t[9]===s?h=t[10]:(h=(0,$.jsx)(`span`,{className:`mt-0.5 [&>svg]:size-4 text-accent-fg`,children:s}),t[9]=s,t[10]=h);let _;t[11]===i.title?_=t[12]:(_=(0,$.jsx)(`strong`,{className:`block truncate text-sm font-medium text-fg`,children:i.title}),t[11]=i.title,t[12]=_);let v;t[13]!==i.description||t[14]!==i.kind?(v=i.description||Rn(i.kind),t[13]=i.description,t[14]=i.kind,t[15]=v):v=t[15];let y;t[16]===v?y=t[17]:(y=(0,$.jsx)(`span`,{className:`mt-1 block line-clamp-2 text-xs leading-4 text-fg-muted`,children:v}),t[16]=v,t[17]=y);let b;t[18]!==y||t[19]!==_?(b=(0,$.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[_,y]}),t[18]=y,t[19]=_,t[20]=b):b=t[20];let x;t[21]===a?x=t[22]:(x=a?(0,$.jsx)(`span`,{className:l(`rounded-full px-1.5 py-0.5 text-[10px] font-medium`,a===`added`?`bg-success-soft text-success`:a===`removed`?`bg-danger/10 text-danger`:`bg-accent-soft text-accent-fg`),children:a===`added`?`+`:a===`removed`?`−`:`Δ`}):null,t[21]=a,t[22]=x);let S;t[23]!==b||t[24]!==x||t[25]!==h?(S=(0,$.jsxs)(`div`,{className:`flex items-start gap-2`,children:[h,b,x]}),t[23]=b,t[24]=x,t[25]=h,t[26]=S):S=t[26];let C;t[27]===i.kind?C=t[28]:(C=i.kind===`decision`?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(ut,{id:`true`,type:`source`,position:st.Right,style:{top:`38%`},className:`!size-2.5 !border-2 !border-surface-panel !bg-success`}),(0,$.jsx)(ut,{id:`false`,type:`source`,position:st.Right,style:{top:`70%`},className:`!size-2.5 !border-2 !border-surface-panel !bg-danger`})]}):i.kind===`output`?null:(0,$.jsx)(ut,{type:`source`,position:st.Right,className:`!size-2.5 !border-2 !border-surface-panel !bg-accent`}),t[27]=i.kind,t[28]=C);let w;return t[29]!==S||t[30]!==C||t[31]!==p||t[32]!==m?(w=(0,$.jsxs)(`div`,{className:p,children:[m,S,C]}),t[29]=S,t[30]=C,t[31]=p,t[32]=m,t[33]=w):w=t[33],w}var Dn={workflow:En};function On(e){let t=(0,Q.c)(71),{node:n,copy:r,updateNode:i,onDelete:a}=e,o;t[0]!==n.id||t[1]!==i?(o=e=>i(n.id,t=>({...t,...e})),t[0]=n.id,t[1]=i,t[2]=o):o=t[2];let s=o,c;t[3]!==n.id||t[4]!==i?(c=e=>i(n.id,t=>({...t,config:{...t.config,...e}})),t[3]=n.id,t[4]=i,t[5]=c):c=t[5];let l=c,u;t[6]===r.stepSettings?u=t[7]:(u=(0,$.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:r.stepSettings}),t[6]=r.stepSettings,t[7]=u);let d;t[8]!==r.remove||t[9]!==n.kind||t[10]!==a?(d=n.kind!==`input`&&n.kind!==`output`?(0,$.jsxs)(Y,{variant:`ghost`,className:`h-8 px-2 text-danger`,onClick:a,children:[(0,$.jsx)(H,{className:`size-3.5`}),r.remove]}):null,t[8]=r.remove,t[9]=n.kind,t[10]=a,t[11]=d):d=t[11];let f;t[12]!==u||t[13]!==d?(f=(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[u,d]}),t[12]=u,t[13]=d,t[14]=f):f=t[14];let p;t[15]===r.stepName?p=t[16]:(p=(0,$.jsx)(`label`,{className:`mt-3 block text-xs font-medium text-fg`,htmlFor:`node-title`,children:r.stepName}),t[15]=r.stepName,t[16]=p);let m;t[17]===s?m=t[18]:(m=e=>s({title:e.target.value}),t[17]=s,t[18]=m);let h;t[19]!==n.title||t[20]!==m?(h=(0,$.jsx)(`input`,{id:`node-title`,value:n.title,onChange:m,className:kn}),t[19]=n.title,t[20]=m,t[21]=h):h=t[21];let g;t[22]===r.stepPurpose?g=t[23]:(g=(0,$.jsx)(`label`,{className:`mt-3 block text-xs font-medium text-fg`,htmlFor:`node-description`,children:r.stepPurpose}),t[22]=r.stepPurpose,t[23]=g);let _=n.description??``,v;t[24]===s?v=t[25]:(v=e=>s({description:e.target.value}),t[24]=s,t[25]=v);let y;t[26]!==_||t[27]!==v?(y=(0,$.jsx)(`textarea`,{id:`node-description`,value:_,onChange:v,className:`${kn} min-h-16 resize-y`}),t[26]=_,t[27]=v,t[28]=y):y=t[28];let b;t[29]!==r.advanced||t[30]!==r.defaultModel||t[31]!==r.instructions||t[32]!==r.model||t[33]!==n.config||t[34]!==n.kind||t[35]!==l?(b=n.kind===`agent`?(0,$.jsx)($.Fragment,{children:(0,$.jsxs)(`details`,{className:`mt-4 border-t border-edge pt-3`,children:[(0,$.jsx)(`summary`,{className:`cursor-pointer text-xs font-medium text-fg-muted`,children:r.advanced}),(0,$.jsx)(`label`,{className:`mt-3 block text-xs font-medium text-fg`,htmlFor:`node-prompt`,children:r.instructions}),(0,$.jsx)(`textarea`,{id:`node-prompt`,value:String(n.config.prompt??``),onChange:e=>l({prompt:e.target.value}),className:`${kn} min-h-36 resize-y`}),(0,$.jsx)(`label`,{className:`mt-3 block text-xs font-medium text-fg`,htmlFor:`node-model`,children:r.model}),(0,$.jsx)(`input`,{id:`node-model`,value:String(n.config.model??``),onChange:e=>l({model:e.target.value||void 0}),placeholder:r.defaultModel,className:kn})]})}):null,t[29]=r.advanced,t[30]=r.defaultModel,t[31]=r.instructions,t[32]=r.model,t[33]=n.config,t[34]=n.kind,t[35]=l,t[36]=b):b=t[36];let x;t[37]!==r.compareValue||t[38]!==r.condition||t[39]!==r.contains||t[40]!==r.equals||t[41]!==r.exists||t[42]!==r.notEquals||t[43]!==r.valuePath||t[44]!==n.config||t[45]!==n.kind||t[46]!==l?(x=n.kind===`decision`?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`label`,{className:`mt-3 block text-xs font-medium text-fg`,htmlFor:`decision-path`,children:r.valuePath}),(0,$.jsx)(`input`,{id:`decision-path`,value:n.config.rule?.path??``,onChange:e=>l({rule:{...n.config.rule??{operator:`exists`},path:e.target.value}}),placeholder:`result.approved`,className:kn}),(0,$.jsx)(`label`,{className:`mt-3 block text-xs font-medium text-fg`,id:`decision-operator-label`,children:r.condition}),(0,$.jsx)(q,{value:n.config.rule?.operator??`exists`,placeholder:r.condition,allowEmpty:!1,ariaLabelledBy:`decision-operator-label`,options:[{value:`exists`,label:r.exists},{value:`equals`,label:r.equals},{value:`not_equals`,label:r.notEquals},{value:`contains`,label:r.contains}],onChange:e=>l({rule:{...n.config.rule??{path:``},operator:e}})}),n.config.rule?.operator===`exists`?null:(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`label`,{className:`mt-3 block text-xs font-medium text-fg`,htmlFor:`decision-value`,children:r.compareValue}),(0,$.jsx)(`input`,{id:`decision-value`,value:String(n.config.rule?.value??``),onChange:e=>l({rule:{...n.config.rule,value:e.target.value}}),className:kn})]})]}):null,t[37]=r.compareValue,t[38]=r.condition,t[39]=r.contains,t[40]=r.equals,t[41]=r.exists,t[42]=r.notEquals,t[43]=r.valuePath,t[44]=n.config,t[45]=n.kind,t[46]=l,t[47]=x):x=t[47];let S;t[48]!==r.combineAs||t[49]!==r.listResults||t[50]!==r.namedResults||t[51]!==n.config||t[52]!==n.kind||t[53]!==l?(S=n.kind===`merge`?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`label`,{className:`mt-3 block text-xs font-medium text-fg`,id:`merge-mode-label`,children:r.combineAs}),(0,$.jsx)(q,{value:String(n.config.mode??`object`),placeholder:r.combineAs,allowEmpty:!1,ariaLabelledBy:`merge-mode-label`,options:[{value:`object`,label:r.namedResults},{value:`array`,label:r.listResults}],onChange:e=>l({mode:e})})]}):null,t[48]=r.combineAs,t[49]=r.listResults,t[50]=r.namedResults,t[51]=n.config,t[52]=n.kind,t[53]=l,t[54]=S):S=t[54];let C;t[55]!==r.autoSummary||t[56]!==r.summaryTemplate||t[57]!==n.config||t[58]!==n.kind||t[59]!==l?(C=n.kind===`output`?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`label`,{className:`mt-3 block text-xs font-medium text-fg`,htmlFor:`output-summary`,children:r.summaryTemplate}),(0,$.jsx)(`textarea`,{id:`output-summary`,value:String(n.config.summary??``),onChange:e=>l({summary:e.target.value||void 0}),placeholder:r.autoSummary,className:`${kn} min-h-20 resize-y`})]}):null,t[55]=r.autoSummary,t[56]=r.summaryTemplate,t[57]=n.config,t[58]=n.kind,t[59]=l,t[60]=C):C=t[60];let w;return t[61]!==y||t[62]!==b||t[63]!==x||t[64]!==S||t[65]!==C||t[66]!==f||t[67]!==p||t[68]!==h||t[69]!==g?(w=(0,$.jsxs)(`section`,{children:[f,p,h,g,y,b,x,S,C]}),t[61]=y,t[62]=b,t[63]=x,t[64]=S,t[65]=C,t[66]=f,t[67]=p,t[68]=h,t[69]=g,t[70]=w):w=t[70],w}var kn=`mt-1 block h-10 w-full rounded-lg border border-edge bg-surface-subtle px-3 text-sm text-fg outline-none placeholder:text-fg-subtle focus:border-edge-strong`;function An(e,t=!1,n){return{id:e.id,type:`workflow`,position:e.position,selected:t,data:{workflowNode:e,diffState:n}}}function jn(e){return{id:e.id,source:e.source,target:e.target,sourceHandle:e.sourcePort===`true`||e.sourcePort===`false`?e.sourcePort:void 0,markerEnd:{type:at.ArrowClosed},style:{stroke:`var(--color-fg-subtle)`,strokeWidth:1.5}}}function Mn(){return{schemaVersion:1,nodes:[{id:`input`,kind:`input`,title:`Input`,description:`What the user provides`,position:{x:0,y:120},config:{}},{id:`agent-1`,kind:`agent`,title:`Do the work`,description:`Understand and complete the request`,phaseId:`work`,position:{x:300,y:120},config:{prompt:`Complete this goal: {{goal}}
|
|
2
2
|
|
|
3
3
|
User input:
|
|
4
4
|
{{input}}`,maxIterations:12}},{id:`output`,kind:`output`,title:`Result`,description:`A clear answer for the user`,position:{x:620,y:120},config:{}}],edges:[{id:`input-agent`,source:`input`,target:`agent-1`},{id:`agent-output`,source:`agent-1`,target:`output`}]}}function Nn(e,t,n){let r={x:280+n%3*280,y:80+Math.floor(n/3)*180};return e===`agent`?{id:t,kind:e,title:`New AI step`,description:`Describe what this step should accomplish`,phaseId:`work`,position:r,config:{prompt:`Use the previous results to complete this step:
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
<link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png?v=20260713-1" />
|
|
12
12
|
<link rel="manifest" href="/site.webmanifest?v=20260713-1" />
|
|
13
13
|
<title>XOPC — Turn goals into loops. Keep what matters moving.</title>
|
|
14
|
-
<script type="module" crossorigin src="/assets/index-
|
|
14
|
+
<script type="module" crossorigin src="/assets/index-Cb9y6tVR.js"></script>
|
|
15
15
|
<link rel="modulepreload" crossorigin href="/assets/rolldown-runtime-aKtaBQYM.js">
|
|
16
16
|
<link rel="modulepreload" crossorigin href="/assets/preload-helper-zJ_50EbN.js">
|
|
17
17
|
<link rel="modulepreload" crossorigin href="/assets/vendor-react-BOUWij0V.js">
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
<link rel="modulepreload" crossorigin href="/assets/gateway-startup-retry--2njcDpC.js">
|
|
34
34
|
<link rel="modulepreload" crossorigin href="/assets/activity-store-BwmdJ5pv.js">
|
|
35
35
|
<link rel="modulepreload" crossorigin href="/assets/theme-store-DtxpMC5S.js">
|
|
36
|
-
<link rel="stylesheet" crossorigin href="/assets/index-
|
|
36
|
+
<link rel="stylesheet" crossorigin href="/assets/index-DtEVsSU1.css">
|
|
37
37
|
</head>
|
|
38
38
|
<body>
|
|
39
39
|
<div id="root"></div>
|
package/dist/package.js
CHANGED
|
@@ -4,6 +4,7 @@ import { init_logger } from "../utils/logger.js";
|
|
|
4
4
|
import { getSessionMetadata } from "../storage/sqlite/session-repository.js";
|
|
5
5
|
import { getSessionConfig } from "../storage/sqlite/config-repository.js";
|
|
6
6
|
import "../storage/sqlite/index.js";
|
|
7
|
+
import { checkBoundary } from "../agent-runtime/boundary-guard.js";
|
|
7
8
|
import { getAgentDefaultModelRef, init_schema } from "../config/schema.js";
|
|
8
9
|
import { applyConfigOverrides } from "../config/runtime-overrides.js";
|
|
9
10
|
import { expandWorkspacePathString, init_workspace_path } from "../config/workspace-path.js";
|
|
@@ -37,7 +38,6 @@ import { UserContextCoordinator } from "./memory/user-context-coordinator.js";
|
|
|
37
38
|
import { WorkspaceRuntimeRegistry } from "./workspace-runtime/registry.js";
|
|
38
39
|
import { BackgroundReviewCoordinator } from "./background-review/coordinator.js";
|
|
39
40
|
import { maybeRequestChannelExecApproval } from "../channels/exec-approval-runtime.js";
|
|
40
|
-
import { checkBoundary } from "../agent-runtime/boundary-guard.js";
|
|
41
41
|
import { SkillFilesystemWatcher } from "./skills/filesystem-watcher.js";
|
|
42
42
|
import { ProjectTrustStore, hasTrustRequiringProjectResources } from "../project-trust/trust-store.js";
|
|
43
43
|
import { basename, resolve, sep } from "node:path";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
+
import { buildMemoryRuntime } from "../../agent-runtime/memory-runtime.js";
|
|
1
2
|
import { isMemorySubsystemEnabled } from "./memory-config.js";
|
|
2
3
|
import { BuiltinMemoryProvider } from "./builtin-provider.js";
|
|
3
4
|
import { MemoryManager } from "./manager.js";
|
|
4
5
|
import { loadMemoryPluginProviders } from "./plugin-discovery.js";
|
|
5
|
-
import { buildMemoryRuntime } from "../../agent-runtime/memory-runtime.js";
|
|
6
6
|
//#region src/agent/memory/create-memory-manager.ts
|
|
7
7
|
function createMemoryManagerFromConfig(config) {
|
|
8
8
|
const routing = resolveMemoryManagerOptions(config);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { buildMemoryRuntime } from "./memory-runtime.js";
|
|
2
1
|
import { checkBoundary } from "./boundary-guard.js";
|
|
3
2
|
import { resolveModelRole } from "./model-router.js";
|
|
4
3
|
import { buildRuntimeToolRegistry } from "./tool-registry.js";
|
|
4
|
+
import { buildMemoryRuntime } from "./memory-runtime.js";
|
|
5
5
|
import { resolveWorkflow, validateWorkflowForRuntime } from "./workflow-runtime.js";
|
|
6
6
|
import { buildAgentRuntimeProfile } from "./runtime-profile.js";
|
|
7
7
|
import { appendAgentRunEvent, createAgentRunTrace, finishAgentRunTrace, hashEffectiveManifest } from "./run-trace.js";
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { buildAgentManifestPromptSection } from "../agent-manifest/prompt.js";
|
|
2
2
|
import "../agent-manifest/index.js";
|
|
3
|
-
import { buildMemoryRuntime } from "./memory-runtime.js";
|
|
4
3
|
import { checkBoundary } from "./boundary-guard.js";
|
|
5
4
|
import { resolveModelRole } from "./model-router.js";
|
|
6
5
|
import { buildRuntimeToolRegistry } from "./tool-registry.js";
|
|
6
|
+
import { buildMemoryRuntime } from "./memory-runtime.js";
|
|
7
7
|
import { resolveWorkflow, validateWorkflowForRuntime } from "./workflow-runtime.js";
|
|
8
8
|
//#region src/agent-runtime/runtime-profile.ts
|
|
9
9
|
function buildAgentRuntimeProfile(params) {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { buildChannelCatalogForConfig, init_channel_catalog_service } from "../../channels/catalog/channel-catalog-service.js";
|
|
2
2
|
import { init_loader, loadConfig, saveConfig } from "../../config/loader.js";
|
|
3
|
+
import { formatExamples, register } from "../registry.js";
|
|
3
4
|
import { listChannelPairingState } from "../../channels/pairing/pairing-service.js";
|
|
4
5
|
import { approveChannelPairingFromCli } from "../../channels/pairing/approve-cli.js";
|
|
5
|
-
import { formatExamples, register } from "../registry.js";
|
|
6
6
|
import { colors } from "../utils/colors.js";
|
|
7
7
|
import { Command } from "commander";
|
|
8
8
|
//#region src/cli/commands/channels.ts
|