@xopcai/xopc 0.0.260 → 0.0.263
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/icons/icon-128.png +0 -0
- package/dist/browser-ext/icons/icon-16.png +0 -0
- package/dist/browser-ext/icons/icon-32.png +0 -0
- package/dist/browser-ext/icons/icon-48.png +0 -0
- package/dist/browser-ext/manifest.json +1 -1
- package/dist/extensions/telegram/xopc.extension.json +1 -1
- package/dist/gateway/static/root/apple-touch-icon.png +0 -0
- package/dist/gateway/static/root/assets/{agent-avatar-dicebear-DQXGuDU1.js → agent-avatar-dicebear-CGfZj39N.js} +1 -1
- package/dist/gateway/static/root/assets/{agent-defaults-settings-panel-B-adIdqU.js → agent-defaults-settings-panel-BEfQ37Md.js} +1 -1
- package/dist/gateway/static/root/assets/{agents-tEnV2m4V.js → agents-D04Sobl9.js} +1 -1
- package/dist/gateway/static/root/assets/{app-management-settings-panel-DpPFwi9Y.js → app-management-settings-panel-BPHAGj40.js} +1 -1
- package/dist/gateway/static/root/assets/{appearance-settings-CMZNnWrt.js → appearance-settings-1c8VsdQr.js} +1 -1
- package/dist/gateway/static/root/assets/{apps-page-CjUC3jZ3.js → apps-page-CRuJkEs4.js} +1 -1
- package/dist/gateway/static/root/assets/{archive-plugin-CDO9Z4tl.js → archive-plugin-BO0zh3JH.js} +1 -1
- package/dist/gateway/static/root/assets/{attachment-load-B0OLG7F4.js → attachment-load-hM6hZczY.js} +1 -1
- package/dist/gateway/static/root/assets/{automations-page-DkRGPgbA.js → automations-page-DQFZUB4m.js} +1 -1
- package/dist/gateway/static/root/assets/{automations-workspace-DToID01H.js → automations-workspace-B4Rm1r01.js} +1 -1
- package/dist/gateway/static/root/assets/{binary-plugins-C9cQvqON.js → binary-plugins-BycS7-SL.js} +1 -1
- package/dist/gateway/static/root/assets/{block-editor-CuhEms-L.js → block-editor-BKWv_VZ-.js} +1 -1
- package/dist/gateway/static/root/assets/{browser-automations-page-D4ylF3c0.js → browser-automations-page-CH1MCd_B.js} +1 -1
- package/dist/gateway/static/root/assets/{browser-settings-page-BIYTKzLB.js → browser-settings-page-C6fxxddT.js} +1 -1
- package/dist/gateway/static/root/assets/{capabilities-settings-panel-DLaPx1nq.js → capabilities-settings-panel-CO33biQC.js} +1 -1
- package/dist/gateway/static/root/assets/{channels-settings-jIVF8Nin.js → channels-settings-B9SXtr0p.js} +1 -1
- package/dist/gateway/static/root/assets/{chat-terminal-dock-BIdsO11x.js → chat-terminal-dock-CdajkVWX.js} +1 -1
- package/dist/gateway/static/root/assets/{connectors-page-CIslIJFt.js → connectors-page-Dv9Gc04W.js} +1 -1
- package/dist/gateway/static/root/assets/{cron-expression-Dgkeyu7p.js → cron-expression-IQ7L7Yfo.js} +1 -1
- package/dist/gateway/static/root/assets/{date-picker-De7tAQEZ.js → date-picker-_8L4XYi4.js} +1 -1
- package/dist/gateway/static/root/assets/{dependency-picker-BzPt6TdE.js → dependency-picker-DqKQ7zii.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-BPOx0awZ.js → desktop-pet-B5Hj8onM.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-settings-CLo3YMLt.js → desktop-pet-settings-Cx9eOnxz.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-debug-page-DDEyLbVr.js → extension-debug-page-C0E8G0L3.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-page-D1NUZpPd.js → extension-page-DwU54hPO.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-settings-page-BJhuMrU_.js → extension-settings-page-CoHiKnkT.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-settings-v2JeDF9-.js → gateway-settings-D9eRbAgP.js} +1 -1
- package/dist/gateway/static/root/assets/{heartbeat-settings-1W8w4lhI.js → heartbeat-settings-Bo6VHm0J.js} +1 -1
- package/dist/gateway/static/root/assets/{home-page-BSKKIfeQ.js → home-page-E1AzAvyw.js} +1 -1
- package/dist/gateway/static/root/assets/{index-BKCWDzbV.css → index-CRJrO4GI.css} +1 -1
- package/dist/gateway/static/root/assets/{index-BXdV0Oia.js → index-pmcvQ5pq.js} +47 -47
- package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-COT94SO3.js → keyboard-shortcuts-settings-Nzl7HzsR.js} +1 -1
- package/dist/gateway/static/root/assets/{local-app-workbench-page-DUs-vc7c.js → local-app-workbench-page-yIMJ_WdU.js} +1 -1
- package/dist/gateway/static/root/assets/{local-apps-page-C6rKhNyX.js → local-apps-page-DRQoDm9I.js} +1 -1
- package/dist/gateway/static/root/assets/{logs-page-D_qfxg72.js → logs-page-Cdpl_Ccj.js} +1 -1
- package/dist/gateway/static/root/assets/{management-settings-DSH7NnVw.js → management-settings-U81XMIVy.js} +1 -1
- package/dist/gateway/static/root/assets/{media-plugins-Cf6kUNl_.js → media-plugins-D9ajlmEo.js} +1 -1
- package/dist/gateway/static/root/assets/{mobile-pairing-wizard-CILSkJVm.js → mobile-pairing-wizard-DFAUuhB5.js} +1 -1
- package/dist/gateway/static/root/assets/{note-detail-panel-p09JcANK.js → note-detail-panel-Cx0UW1ml.js} +3 -3
- package/dist/gateway/static/root/assets/{notes-page-CFNvIB8t.js → notes-page-CqWid6rN.js} +1 -1
- package/dist/gateway/static/root/assets/{page-tabs-BE7aDmYf.js → page-tabs-CXo5GsOJ.js} +1 -1
- package/dist/gateway/static/root/assets/{preview-open-alternatives-C9TdeSFT.js → preview-open-alternatives-Ct078fbo.js} +1 -1
- package/dist/gateway/static/root/assets/{project-detail-page-CM2vs8CY.js → project-detail-page-DloclfjI.js} +1 -1
- package/dist/gateway/static/root/assets/{projects-page-DA-zzY8B.js → projects-page-DPbVBxEl.js} +1 -1
- package/dist/gateway/static/root/assets/{remote-access-hub--sgDiADe.js → remote-access-hub-BkFDpVBV.js} +1 -1
- package/dist/gateway/static/root/assets/{runtime-tools-settings-panel-DkshrVpk.js → runtime-tools-settings-panel-DPIpVABf.js} +1 -1
- package/dist/gateway/static/root/assets/{schema-form-tLOl1ZAH.js → schema-form-B_1CsQnV.js} +1 -1
- package/dist/gateway/static/root/assets/{sessions-page-C_TdKlUD.js → sessions-page-Cu-O03Ah.js} +1 -1
- package/dist/gateway/static/root/assets/settings-advanced-gate-D3b1Fj9k.js +1 -0
- package/dist/gateway/static/root/assets/{settings-form-section-Dxkw4v4H.js → settings-form-section-DpAFw7dA.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-Bqk8W4z_.js → settings-page-KGC3Nc4j.js} +1 -1
- package/dist/gateway/static/root/assets/{setup-status-panel-DWd6faoE.js → setup-status-panel-DUnPvWv4.js} +1 -1
- package/dist/gateway/static/root/assets/{share-preview-page-j2tIceho.js → share-preview-page-Bz49xVj2.js} +1 -1
- package/dist/gateway/static/root/assets/{shares-settings-oDcCqSFK.js → shares-settings-BdnefOpB.js} +1 -1
- package/dist/gateway/static/root/assets/{skill-reload-api-CwBaDY-N.js → skill-reload-api-CArff6hI.js} +1 -1
- package/dist/gateway/static/root/assets/{skills-page-CTmhlyZc.js → skills-page-CqASoG63.js} +1 -1
- package/dist/gateway/static/root/assets/{skills-page.utils-DOvugRyA.js → skills-page.utils-DpNBvHVa.js} +1 -1
- package/dist/gateway/static/root/assets/{system-settings-panel-BnYP6VIv.js → system-settings-panel-CjYfWbkg.js} +1 -1
- package/dist/gateway/static/root/assets/{task-detail-page-A2JXlr_r.js → task-detail-page-1ciKj-G2.js} +1 -1
- package/dist/gateway/static/root/assets/{tunnel-api-BmDqq1-x.js → tunnel-api-BeTjaQ30.js} +1 -1
- package/dist/gateway/static/root/assets/{use-autosave-BzsVGQQM.js → use-autosave-DMeAoaFH.js} +1 -1
- package/dist/gateway/static/root/assets/{user-model-page-CkO83New.js → user-model-page-CqF2Sz0B.js} +1 -1
- package/dist/gateway/static/root/assets/{voice-api-key-field-BjOEAtzw.js → voice-api-key-field-BpCCTqEw.js} +1 -1
- package/dist/gateway/static/root/assets/{work-discovery-overlay-CrtXygYb.js → work-discovery-overlay-CHKBgPVw.js} +1 -1
- package/dist/gateway/static/root/assets/{workflow-run-setup-panel-Darl4tuN.js → workflow-run-setup-panel-C7a3xXM2.js} +1 -1
- package/dist/gateway/static/root/assets/{workflows-page-BTdeeQSn.js → workflows-page-B-qyam4R.js} +1 -1
- package/dist/gateway/static/root/favicon-16x16.png +0 -0
- package/dist/gateway/static/root/favicon-32x32.png +0 -0
- package/dist/gateway/static/root/favicon.ico +0 -0
- package/dist/gateway/static/root/favicon.png +0 -0
- package/dist/gateway/static/root/favicon.svg +1 -1
- package/dist/gateway/static/root/index.html +8 -8
- package/dist/gateway/static/root/logo-dark.svg +1 -1
- package/dist/gateway/static/root/logo.svg +1 -1
- package/dist/gateway/static/root/pwa-192x192.png +0 -0
- package/dist/gateway/static/root/pwa-512x512.png +0 -0
- package/dist/package.js +1 -1
- package/dist/src/agent/agent-manager.js +4 -4
- package/dist/src/agent/background-review/run-background-review.js +1 -1
- package/dist/src/agent/embedded/model-runtime.js +1 -1
- package/dist/src/agent/embedded/run-for-session.js +1 -1
- package/dist/src/agent/image/prepare-image-for-model.d.ts +13 -0
- package/dist/src/agent/image/prepare-image-for-model.js +55 -0
- package/dist/src/agent/image/tool-model-config.js +1 -1
- package/dist/src/agent/inbound/attachment-pipeline.js +7 -5
- package/dist/src/agent/mcp/oauth/mcp-oauth-store.js +1 -1
- package/dist/src/agent/service.js +2 -2
- package/dist/src/agent/session/session-inspector.js +1 -1
- package/dist/src/agent/skills/hub-lock.js +1 -1
- package/dist/src/agent/tasks/task-judge-service.js +3 -3
- package/dist/src/agent/tools/media-read-tool.js +3 -3
- package/dist/src/ai-assist/text-assist.js +1 -1
- package/dist/src/auth/credentials.js +2 -2
- package/dist/src/auth/oauth/xopc-cloud.js +1 -1
- package/dist/src/auth/profiles/store.js +1 -1
- package/dist/src/auth/sync-provider-auth.js +2 -2
- package/dist/src/automations/service/automation-service.js +21 -8
- package/dist/src/browser/providers/browser-ext-install.js +1 -1
- package/dist/src/cli/commands/doctor/checks/provider-auth.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/config/index.js +4 -4
- package/dist/src/config/loader.js +2 -2
- package/dist/src/config/models-json.js +1 -1
- package/dist/src/extensions/lockfile.js +1 -1
- package/dist/src/extensions/update.js +1 -1
- package/dist/src/gateway/agents-admin.js +1 -1
- package/dist/src/gateway/file-path-classifier.js +1 -1
- package/dist/src/gateway/hono/lib/config-payload.js +1 -1
- package/dist/src/gateway/hono/routes/auth-registry-extensions.js +1 -1
- package/dist/src/gateway/hono/routes/connectors.js +1 -1
- package/dist/src/gateway/hono/routes/media.js +1 -1
- package/dist/src/gateway/hono/routes/models.js +1 -1
- package/dist/src/gateway/hono/routes/voice.js +18 -0
- package/dist/src/gateway/service/config-coordinator.js +2 -2
- package/dist/src/gateway/service.js +14 -7
- package/dist/src/infra/update-restart.js +1 -1
- package/dist/src/infra/update-runner.js +1 -1
- package/dist/src/media/store.js +11 -2
- package/dist/src/providers/auth-runtime/resolve-auth.js +1 -1
- package/dist/src/providers/index.js +2 -2
- package/dist/src/providers/model-registry.js +1 -1
- package/dist/src/providers/register-runtime-providers.js +1 -1
- package/dist/src/tui/tui-startup-resources.js +1 -1
- package/dist/src/tui/tui.js +1 -1
- package/dist/src/voice/realtime/agentEngine.js +71 -17
- package/dist/src/voice/realtime/conversation-context.d.ts +2 -0
- package/dist/src/voice/realtime/conversation-context.js +13 -4
- package/dist/src/voice/realtime/persona-context.d.ts +19 -0
- package/dist/src/voice/realtime/persona-context.js +126 -0
- package/dist/src/voice/realtime/runtime.d.ts +1 -0
- package/dist/src/voice/realtime/runtime.js +16 -0
- package/dist/src/voice/realtime/speakable-segmenter.d.ts +4 -1
- package/dist/src/voice/realtime/speakable-segmenter.js +11 -3
- package/dist/src/work-discovery/service.js +1 -1
- package/dist/src/workflows/service/workflow-run-service.js +1 -1
- package/package.json +4 -3
- package/dist/gateway/static/root/assets/settings-advanced-gate-Cpf80P_r.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{a as i,n as a,o,r as s,s as c,t as l}from"./dist-CpzYSoz7.js";import{n as u,r as d}from"./popover-select-CKBYnT3c.js";import{t as f}from"./markdown-view-D-FLW0dt.js";import{t as p}from"./x-B_N4OPjy.js";import{t as m}from"./messages-CIDIpI4Y.js";import{i as h,r as g}from"./locale-store-CHtOF1kO.js";import{t as _}from"./cn-JdwAhgNB.js";import{t as v}from"./button-B11EPpor.js";import{Fs as y,Ks as b,Or as x,ar as S,ec as C,fu as w,ic as T,kr as E,ll as D,nc as O,ur as k,vc as ee,yr as A,zl as j}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{a as i,n as a,o,r as s,s as c,t as l}from"./dist-CpzYSoz7.js";import{n as u,r as d}from"./popover-select-CKBYnT3c.js";import{t as f}from"./markdown-view-D-FLW0dt.js";import{t as p}from"./x-B_N4OPjy.js";import{t as m}from"./messages-CIDIpI4Y.js";import{i as h,r as g}from"./locale-store-CHtOF1kO.js";import{t as _}from"./cn-JdwAhgNB.js";import{t as v}from"./button-B11EPpor.js";import{Fs as y,Ks as b,Or as x,ar as S,ec as C,fu as w,ic as T,kr as E,ll as D,nc as O,ur as k,vc as ee,yr as A,zl as j}from"./index-pmcvQ5pq.js";var M=e(t(),1),N=n();function P(e){if(!e.trim())return null;try{return JSON.parse(e)}catch{return null}}function F(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 I(e,t={}){let n=P(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(F(n));return null}async function L(e,t={}){let n=await h(g(`/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=``,o=``,s=``;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=I(e,{onDelta:e=>{o+=e,t.onDelta?.(e)},onThinkingDelta:e=>{s+=e,t.onThinkingDelta?.(e)}});n!==null&&(o=n)}}if(e)break}if(a.trim()){let e=I(a,{onDelta:e=>{o+=e,t.onDelta?.(e)},onThinkingDelta:e=>{s+=e,t.onThinkingDelta?.(e)}});e!==null&&(o=e)}let c=o.trim();if(!c)throw Error(`AI returned an empty suggestion`);return{text:c,thinking:s.trim()||void 0}}function te(){let[e,t]=(0,M.useState)(``),[n,r]=(0,M.useState)(``),[i,a]=(0,M.useState)(!1),[o,s]=(0,M.useState)(null);return{suggestion:e,thinking:n,loading:i,error:o,generate:(0,M.useCallback)(async e=>{a(!0),s(null),t(``),r(``);try{let n=await L(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,M.useCallback)(()=>{t(``),r(``),s(null),a(!1)},[])}}var R=r(),ne=5;function re(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 z(e){let t=(0,N.c)(239),{value:n,onApply:r,fieldId:u,fieldLabel:d,scenario:m,format:h,intent:g,locale:y,context:b,disabled:x,className:S,showLabel:T}=e,E=m===void 0?`generic.text`:m,D=h===void 0?`plain`:h,k=g===void 0?`improve`:g,A=T===void 0?!0:T,[P,F]=(0,M.useState)(!1),[I,L]=(0,M.useState)(n),[z,B]=(0,M.useState)(`preview`),[V,H]=(0,M.useState)(``),[U,oe]=(0,M.useState)(`edit`),[W,G]=(0,M.useState)(!0),[se,ce]=(0,M.useState)(!1),[K,q]=(0,M.useState)(null),le=(0,M.useRef)(null),ue=(0,M.useRef)(!0),{suggestion:de,thinking:J,loading:Y,error:X,generate:fe,reset:pe}=te(),me;t[0]===y?me=t[1]:(me=re(y),t[0]=y,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]!==P||t[6]!==n?(ge=()=>{P||L(n)},_e=[P,n],t[5]=P,t[6]=n,t[7]=ge,t[8]=_e):(ge=t[7],_e=t[8]),(0,M.useEffect)(ge,_e);let ve,ye;t[9]===de?(ve=t[10],ye=t[11]):(ye=()=>{H(de)},ve=[de],t[9]=de,t[10]=ve,t[11]=ye),(0,M.useEffect)(ye,ve);let be,xe;t[12]===J?(be=t[13],xe=t[14]):(be=()=>{J.trim()&&G(!0)},xe=[J],t[12]=J,t[13]=be,t[14]=xe),(0,M.useEffect)(be,xe);let Se;t[15]!==Q||t[16]!==W?(Se=()=>{let e=le.current;!e||!Q||!W||ue.current&&(e.scrollTop=e.scrollHeight)},t[15]=Q,t[16]=W,t[17]=Se):Se=t[17];let Ce;t[18]!==Q||t[19]!==J||t[20]!==W?(Ce=[Q,J,W],t[18]=Q,t[19]=J,t[20]=W,t[21]=Ce):Ce=t[21],(0,M.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<=ne)},t[22]=we):we=t[22];let Te=we,Ee;t[23]!==b||t[24]!==u||t[25]!==d||t[26]!==D||t[27]!==fe||t[28]!==k||t[29]!==y||t[30]!==E?(Ee=async e=>{oe(`edit`),G(!0),ue.current=!0,await fe({intent:k,scenario:E,input:e,locale:y,field:{id:u,label:d,format:D},context:b})},t[23]=b,t[24]=u,t[25]=d,t[26]=D,t[27]=fe,t[28]=k,t[29]=y,t[30]=E,t[31]=Ee):Ee=t[31];let De=Ee,Oe;t[32]!==pe||t[33]!==n?(Oe=e=>{ce(!!e.currentTarget.closest(`[role="dialog"]`)),q(document.querySelector(`.app-main-surface`)),L(n),B(`preview`),H(``),oe(`edit`),G(!0),pe(),F(!0)},t[32]=pe,t[33]=n,t[34]=Oe):Oe=t[34];let ke=Oe,Ae;t[35]!==I||t[36]!==De?(Ae=async()=>{await De(I)},t[35]=I,t[36]=De,t[37]=Ae):Ae=t[37];let je=Ae,Me;t[38]!==pe||t[39]!==n?(Me=()=>{F(!1),L(n),B(`preview`),H(``),oe(`edit`),G(!0),pe()},t[38]=pe,t[39]=n,t[40]=Me):Me=t[40];let $=Me,Ne;t[41]!==$||t[42]!==I||t[43]!==r?(Ne=()=>{r(I),$()},t[41]=$,t[42]=I,t[43]=r,t[44]=Ne):Ne=t[44];let Pe=Ne,Fe;t[45]!==$||t[46]!==V||t[47]!==r?(Fe=()=>{V.trim()&&(r(V),$())},t[45]=$,t[46]=V,t[47]=r,t[48]=Fe):Fe=t[48];let Ie=Fe,Le;t[49]!==$||t[50]!==I||t[51]!==V||t[52]!==r?(Le=()=>{if(!V.trim())return;let e=I.trimEnd();r(e?`${e}\n\n${V}`:V),$()},t[49]=$,t[50]=I,t[51]=V,t[52]=r,t[53]=Le):Le=t[53];let Re=Le,ze;t[54]!==V||t[55]!==X||t[56]!==Y?(ze=!Y&&!X&&V.trim().length>0,t[54]=V,t[55]=X,t[56]=Y,t[57]=ze):ze=t[57];let Be=ze,Ve=I!==n,He;t[58]!==V||t[59]!==X||t[60]!==J?(He=V.trim().length>0||J.trim().length>0||!!X,t[58]=V,t[59]=X,t[60]=J,t[61]=He):He=t[61];let Ue=He,We=!A&&`size-7 p-0`,Ge;t[62]!==S||t[63]!==We?(Ge=_(`h-7 gap-1 px-2 text-xs`,We,S),t[62]=S,t[63]=We,t[64]=Ge):Ge=t[64];let Ke=x||Y,qe;t[65]===Symbol.for(`react.memo_cache_sentinel`)?(qe=(0,R.jsx)(O,{className:`size-3.5`,strokeWidth:1.75,"aria-hidden":!0}),t[65]=qe):qe=t[65];let Je=A?Z.buttonTitle:null,Ye;t[66]!==Z.buttonTitle||t[67]!==ke||t[68]!==Ge||t[69]!==Ke||t[70]!==Je?(Ye=(0,R.jsxs)(v,{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?F(!0):$(),t[72]=$,t[73]=Xe);let Ze=K??void 0,Qe=se?`bg-transparent`:`bg-scrim`,$e;t[74]===Qe?$e=t[75]:($e=_(`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,R.jsx)(i,{className:$e}),t[76]=$e,t[77]=et);let tt;t[78]===Z.title?tt=t[79]:(tt=(0,R.jsx)(c,{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,R.jsx)(p,{className:`size-5`,strokeWidth:1.75}),t[80]=nt):nt=t[80];let rt;t[81]===Z.close?rt=t[82]:(rt=(0,R.jsx)(a,{asChild:!0,children:(0,R.jsx)(v,{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,R.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,R.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=z===`edit`?`bg-surface-panel text-fg shadow-surface`:`text-fg-muted hover:bg-surface-hover`,st;t[88]===ot?st=t[89]:(st=_(`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=()=>B(`edit`),lt=(0,R.jsx)(C,{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,R.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=z===`preview`?`bg-surface-panel text-fg shadow-surface`:`text-fg-muted hover:bg-surface-hover`,ft;t[95]===dt?ft=t[96]:(ft=_(`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=()=>B(`preview`),mt=(0,R.jsx)(j,{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,R.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,R.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,R.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]!==I||t[109]!==z||t[110]!==D||t[111]!==Z.current||t[112]!==Z.empty?(vt=z===`preview`?(0,R.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:D===`markdown`?(0,R.jsx)(f,{content:I||Z.empty,compact:!0,className:`text-sm`}):(0,R.jsx)(`pre`,{className:`whitespace-pre-wrap text-sm leading-6 text-fg`,children:I||Z.empty})}):(0,R.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:I,onChange:e=>L(e.currentTarget.value),placeholder:Z.empty,"aria-label":Z.current}),t[108]=I,t[109]=z,t[110]=D,t[111]=Z.current,t[112]=Z.empty,t[113]=vt):vt=t[113];let yt;t[114]!==_t||t[115]!==vt?(yt=(0,R.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,R.jsx)(`span`,{children:Z.editedSuggestion}),t[117]=Z.editedSuggestion,t[118]=bt);let xt;t[119]!==Z.loading||t[120]!==Y?(xt=Y?(0,R.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,R.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=U===`edit`?`bg-surface-panel text-fg shadow-surface`:`text-fg-muted hover:bg-surface-hover`,wt;t[125]===Ct?wt=t[126]:(wt=_(`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=()=>oe(`edit`),Et=(0,R.jsx)(C,{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,R.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=U===`preview`?`bg-surface-panel text-fg shadow-surface`:`text-fg-muted hover:bg-surface-hover`,kt;t[132]===Ot?kt=t[133]:(kt=_(`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=()=>oe(`preview`),jt=(0,R.jsx)(j,{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,R.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,R.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,R.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=_(`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=()=>G(ie),t[147]=Rt):Rt=t[147];let zt;t[148]!==Z.thinkingLoading||t[149]!==Y?(zt=Y?(0,R.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,R.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=W&&`rotate-180`,Ht;t[154]===Vt?Ht=t[155]:(Ht=_(`size-3.5 shrink-0 transition-transform`,Vt),t[154]=Vt,t[155]=Ht);let Ut;t[156]===Ht?Ut=t[157]:(Ut=(0,R.jsx)(w,{className:Ht,strokeWidth:1.75,"aria-hidden":!0}),t[156]=Ht,t[157]=Ut);let Wt;t[158]!==Bt||t[159]!==Ut?(Wt=(0,R.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]!==W?(Gt=W?(0,R.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]=W,t[163]=Gt):Gt=t[163];let Kt;t[164]!==Wt||t[165]!==Gt?(Kt=(0,R.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,R.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=_(`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]!==V||t[174]!==X||t[175]!==D||t[176]!==Z.empty||t[177]!==Z.loading||t[178]!==Z.suggestion||t[179]!==Y||t[180]!==U?(Xt=X?(0,R.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}):U===`preview`?(0,R.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&&!V.trim()?(0,R.jsx)(`p`,{className:`text-sm text-fg-muted`,children:Z.loading}):D===`markdown`?(0,R.jsx)(f,{content:V||Z.empty,compact:!0,className:`text-sm`}):(0,R.jsx)(`pre`,{className:`whitespace-pre-wrap text-sm leading-6 text-fg`,children:V||Z.empty})}):(0,R.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:V,onChange:e=>H(e.currentTarget.value),disabled:Y,placeholder:Y?Z.loading:Z.empty,"aria-label":Z.suggestion}),t[173]=V,t[174]=X,t[175]=D,t[176]=Z.empty,t[177]=Z.loading,t[178]=Z.suggestion,t[179]=Y,t[180]=U,t[181]=Xt):Xt=t[181];let Zt;t[182]!==Yt||t[183]!==Xt?(Zt=(0,R.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,R.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,R.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,R.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,R.jsx)(v,{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,R.jsx)(v,{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,R.jsx)(ee,{className:`size-4`,strokeWidth:1.75,"aria-hidden":!0}):(0,R.jsx)(O,{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,R.jsxs)(v,{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,R.jsx)(v,{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,R.jsx)(v,{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,R.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,R.jsx)(`div`,{className:`absolute inset-0 z-[80] flex items-center justify-center p-4 pointer-events-none`,children:(0,R.jsxs)(s,{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:ae,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,R.jsxs)(o,{container:Ze,children:[et,mn]}),t[228]=mn,t[229]=Ze,t[230]=et,t[231]=hn):hn=t[231];let gn;t[232]!==P||t[233]!==hn||t[234]!==Xe?(gn=(0,R.jsx)(l,{open:P,onOpenChange:Xe,children:hn}),t[232]=P,t[233]=hn,t[234]=Xe,t[235]=gn):gn=t[235];let _n;return t[236]!==gn||t[237]!==Ye?(_n=(0,R.jsxs)(R.Fragment,{children:[Ye,gn]}),t[236]=gn,t[237]=Ye,t[238]=_n):_n=t[238],_n}function ie(e){return!e}function ae(e){return e.preventDefault()}function B(e){return!!(e&&e.type===`object`&&e.properties&&!Array.isArray(e.properties))}function V(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 H(e,t){return!B(e)||!e?!0:V(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 U(e,t){if(e)return B(e.inputSchema)?Object.keys(t.schemaInput).length>0?t.schemaInput:void 0:S(t.argValues)}function oe(e,t,n){let r=m(t).workflows;if(!e)return r.noInputSummary;let i=E(e,t);if(B(e.inputSchema)&&Object.keys(n.schemaInput).length>0)return Object.entries(n.schemaInput).map(([e,t])=>`${e}: ${String(t)}`).join(` · `);let a=Object.values(n.argValues).map(e=>e.trim()).filter(Boolean),o=n.goal.trim()||i.description;return o&&a.unshift(o),a.length>0?a.join(` · `):r.noInputSummary}function W(e,t,n=!0){return e?n?B(e.inputSchema)?H(e.inputSchema,t.schemaInput)?{valid:!0}:{valid:!1,reason:`schema-required`}:{valid:(A[e.name]??[]).every(e=>!e.required||!!t.argValues[e.key]?.trim())}:{valid:!1,reason:`raw-json`}:{valid:!1}}function G(e,t){return e[t]??t}function se(e,t){let n=A[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 ce(e){let t=(0,N.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,R.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,R.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,R.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,R.jsxs)(`div`,{children:[a,s]}),t[9]=a,t[10]=s,t[11]=c):c=t[11],c}function K(e){let t=(0,N.c)(34),{workflowName:n,language:r,argValues:i,onArgValuesChange:a,goal:o,onGoalChange:s,examplePrompts:c,showGoal:l,inputClassName:u,aiAssist:d}=e,f;t[0]===c?f=t[1]:(f=c===void 0?[]:c,t[0]=c,t[1]=f);let p=f,h=l===void 0?!0:l,g,v,y,b,S,C,w;if(t[2]!==d||t[3]!==i||t[4]!==p||t[5]!==o||t[6]!==u||t[7]!==r||t[8]!==a||t[9]!==s||t[10]!==h||t[11]!==n){y=m(r).workflows;let e=A[n]??[];v=e.length>0;let c=_(`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`,u),l;t[19]!==i||t[20]!==a||t[21]!==s?(l=e=>{x(e,s,e=>{a(e(i))})},t[19]=i,t[20]=a,t[21]=s,t[22]=l):l=t[22],g=l,b=`flex flex-col gap-3`,S=e.map(e=>{let t=G(y.args,e.labelKey),o=G(y.args,e.placeholderKey),s=i[e.key]??``;return(0,R.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,R.jsxs)(`span`,{className:`flex items-center justify-between gap-2`,children:[(0,R.jsxs)(`span`,{className:`text-xs font-medium text-fg-muted`,children:[t,e.required?` *`:``]}),e.multiline&&d?(0,R.jsx)(z,{value:s,onApply:t=>a({...i,[e.key]:t}),fieldId:`workflow.arg.${e.key}`,fieldLabel:t,scenario:d.argScenario??`workflow.arg`,locale:r,context:{...d.context,workflowName:n,workflowArgs:i,fieldKey:e.key},disabled:d.disabled,showLabel:!1}):null]}),e.multiline?(0,R.jsx)(`textarea`,{value:s,onChange:t=>a({...i,[e.key]:t.target.value}),placeholder:o,className:_(c,`min-h-20 resize-y`)}):(0,R.jsx)(`input`,{value:s,onChange:t=>a({...i,[e.key]:t.target.value}),placeholder:o,className:c})]},e.key)}),C=v&&p.length>0?(0,R.jsx)(ce,{examples:p,labels:y,onSelect:g}):null,w=h?(0,R.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,R.jsxs)(`span`,{className:`flex items-center justify-between gap-2`,children:[(0,R.jsx)(`span`,{className:`text-xs font-medium text-fg-muted`,children:y.goalLabel}),d?(0,R.jsx)(z,{value:o,onApply:s,fieldId:`workflow.goal`,fieldLabel:y.goalLabel,scenario:d.goalScenario??`cron.workflowGoal`,locale:r,context:{...d.context,workflowName:n,workflowArgs:i},disabled:d.disabled,showLabel:!1}):null]}),(0,R.jsx)(`textarea`,{value:o,onChange:e=>s(e.target.value),placeholder:y.goalPlaceholder,className:_(c,`min-h-20 resize-y`)})]}):null,t[2]=d,t[3]=i,t[4]=p,t[5]=o,t[6]=u,t[7]=r,t[8]=a,t[9]=s,t[10]=h,t[11]=n,t[12]=g,t[13]=v,t[14]=y,t[15]=b,t[16]=S,t[17]=C,t[18]=w}else g=t[12],v=t[13],y=t[14],b=t[15],S=t[16],C=t[17],w=t[18];let T;t[23]!==g||t[24]!==p||t[25]!==v||t[26]!==y?(T=!v&&p.length>0?(0,R.jsx)(ce,{examples:p,labels:y,onSelect:g}):null,t[23]=g,t[24]=p,t[25]=v,t[26]=y,t[27]=T):T=t[27];let E;return t[28]!==b||t[29]!==S||t[30]!==C||t[31]!==w||t[32]!==T?(E=(0,R.jsxs)(`div`,{className:b,children:[S,C,w,T]}),t[28]=b,t[29]=S,t[30]=C,t[31]=w,t[32]=T,t[33]=E):E=t[33],E}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:i,onValidChange:a}){let o=(0,M.useMemo)(()=>V(e),[e]),[s,c]=(0,M.useState)(!1),[l,u]=(0,M.useState)(()=>JSON.stringify(t,null,2)),[d,f]=(0,M.useState)(null);if(o.length===0)return null;let p=(e,r)=>{let i={...t,[e]:r};(r===``||r===void 0)&&delete i[e],n(i),s&&u(JSON.stringify(i,null,2))},m=e=>{u(e);try{let t=e.trim()?JSON.parse(e):{};if(!t||typeof t!=`object`||Array.isArray(t)){f(r.rawJsonInvalid),a?.(!1);return}f(null),n(t),a?.(!0,t)}catch{f(r.rawJsonInvalid),a?.(!1)}};return(0,R.jsxs)(`section`,{className:`rounded-2xl bg-surface-panel/70 p-4 shadow-surface`,children:[(0,R.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,R.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:r.inputSchemaHeading}),(0,R.jsx)(`button`,{type:`button`,className:`text-xs font-medium text-accent-fg hover:underline`,onClick:()=>{let e=!s;c(e),e&&(u(JSON.stringify(t,null,2)),f(null),a?.(!0))},children:r.rawJson})]}),s?(0,R.jsxs)(`div`,{className:`mt-3`,children:[(0,R.jsx)(`textarea`,{value:l,onChange:e=>m(e.target.value),spellCheck:!1,className:_(q,`min-h-40 font-mono text-xs leading-5`)}),d?(0,R.jsx)(`p`,{className:`mt-1 text-xs text-red-600 dark:text-red-300`,children:d}):null]}):(0,R.jsx)(`div`,{className:`mt-3 grid gap-3`,children:o.map(e=>(0,R.jsx)(ue,{field:e,value:t[e.key],labels:r,aiAssist:i,allValues:t,onChange:t=>p(e.key,t)},e.key))})]})}function ue(e){let t=(0,N.c)(30),{field:n,value:r,labels:i,aiAssist:a,allValues:o,onChange:s}=e,c=n.schema.title||n.key,l=typeof n.schema.description==`string`?n.schema.description:void 0,f=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=!!a&&!m.length&&(f===`string`||!f),g=String(c),v=n.required?` *`:``,y;t[2]!==g||t[3]!==v?(y=(0,R.jsxs)(`span`,{className:`text-xs font-medium text-fg`,children:[g,v]}),t[2]=g,t[3]=v,t[4]=y):y=t[4];let b;t[5]!==a||t[6]!==o||t[7]!==n.key||t[8]!==n.schema||t[9]!==s||t[10]!==h||t[11]!==c||t[12]!==r?(b=h&&a?(0,R.jsx)(z,{value:typeof r==`string`?r:r==null?``:String(r),onApply:s,fieldId:`workflow.schema.${n.key}`,fieldLabel:String(c),scenario:a.scenario??`workflow.arg`,locale:a.locale,context:{...a.context,fieldKey:n.key,fieldSchema:n.schema,inputValues:o},disabled:a.disabled,showLabel:!1}):null,t[5]=a,t[6]=o,t[7]=n.key,t[8]=n.schema,t[9]=s,t[10]=h,t[11]=c,t[12]=r,t[13]=b):b=t[13];let x;t[14]!==y||t[15]!==b?(x=(0,R.jsxs)(`span`,{className:`flex items-center justify-between gap-2`,children:[y,b]}),t[14]=y,t[15]=b,t[16]=x):x=t[16];let S;t[17]===l?S=t[18]:(S=l?(0,R.jsx)(`p`,{className:`mt-0.5 text-xs leading-5 text-fg-subtle`,children:l}):null,t[17]=l,t[18]=S);let C;t[19]!==l||t[20]!==m||t[21]!==i||t[22]!==s||t[23]!==f||t[24]!==r?(C=m.length>0?(0,R.jsxs)(u,{value:r==null?``:String(r),onChange:e=>s(e.target.value),className:q,children:[(0,R.jsx)(d,{value:``}),m.map(de)]}):f===`boolean`?(0,R.jsxs)(u,{value:typeof r==`boolean`?String(r):``,onChange:e=>s(e.target.value===``?void 0:e.target.value===`true`),className:q,children:[(0,R.jsx)(d,{value:``}),(0,R.jsx)(d,{value:`true`,children:i.booleanTrue}),(0,R.jsx)(d,{value:`false`,children:i.booleanFalse})]}):f===`number`||f===`integer`?(0,R.jsx)(`input`,{type:`number`,value:typeof r==`number`||typeof r==`string`?String(r):``,onChange:e=>s(e.target.value===``?void 0:Number(e.target.value)),className:q}):(0,R.jsx)(`textarea`,{value:typeof r==`string`?r:r==null?``:String(r),onChange:e=>s(e.target.value),className:_(q,l&&l.length>80?`min-h-20 resize-y`:`min-h-10 resize-y`)}),t[19]=l,t[20]=m,t[21]=i,t[22]=s,t[23]=f,t[24]=r,t[25]=C):C=t[25];let w;return t[26]!==x||t[27]!==S||t[28]!==C?(w=(0,R.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,R.jsx)(d,{value:String(e),children:String(e)},String(e))}function J(e){let t=(0,N.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,R.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,R.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,R.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,R.jsxs)(`div`,{children:[a,s]}),t[9]=a,t[10]=s,t[11]=c):c=t[11],c}function Y(e){let t=(0,N.c)(114),{definition:n,language:r,value:i,onChange:a,aiAssist:o,inputClassName:s,onValidityChange:c}=e,l;t[0]===r?l=t[1]:(l=m(r),t[0]=r,t[1]=l);let u=l.workflows,d;t[2]!==n||t[3]!==r?(d=E(n,r),t[2]=n,t[3]=r,t[4]=d):d=t[4];let f=d,[p,h]=(0,M.useState)(!0),g;t[5]===f.examplePrompts?g=t[6]:(g=f.examplePrompts??[],t[5]=f.examplePrompts,t[6]=g);let v=g,y;t[7]===n.inputSchema?y=t[8]:(y=B(n.inputSchema),t[7]=n.inputSchema,t[8]=y);let b=y,x,S,C,w,T,D,O,k,ee,A;if(t[9]!==o||t[10]!==n||t[11]!==v||t[12]!==b||t[13]!==s||t[14]!==u||t[15]!==r||t[16]!==f.description||t[17]!==a||t[18]!==c||t[19]!==p||t[20]!==i){T=Symbol.for(`react.early_return_sentinel`);bb0:{let e=_(`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`,s),l;t[31]!==n||t[32]!==a||t[33]!==c||t[34]!==p?(l=(e,t)=>{let r=t===void 0?p:t;a(e),c?.(W(n,e,r))},t[31]=n,t[32]=a,t[33]=c,t[34]=p,t[35]=l):l=t[35];let d=l,m;t[36]!==d||t[37]!==i?(m=e=>d({...i,goal:e}),t[36]=d,t[37]=i,t[38]=m):m=t[38];let g=m,y;t[39]!==d||t[40]!==i?(y=e=>d({...i,schemaInput:e}),t[39]=d,t[40]=i,t[41]=y):y=t[41];let E=y,j;t[42]!==d||t[43]!==i?(j=e=>d({...i,argValues:e}),t[42]=d,t[43]=i,t[44]=j):j=t[44];let M=j,N;if(t[45]!==g||t[46]!==E||t[47]!==i.schemaInput?(N=e=>{if(e.field===`goal`){g(e.text);return}E({...i.schemaInput,[e.field]:e.text})},t[45]=g,t[46]=E,t[47]=i.schemaInput,t[48]=N):N=t[48],x=N,!b){let e;t[49]!==o||t[50]!==n.id||t[51]!==n.name||t[52]!==n.title||t[53]!==f.description?(e=o?{disabled:o.disabled,argScenario:o.inputScenario??`workflow.arg`,goalScenario:o.goalScenario??`workflow.goal`,context:{...o.context,workflowId:n.id,workflowName:n.name,workflowTitle:n.title,workflowDescription:f.description}}:void 0,t[49]=o,t[50]=n.id,t[51]=n.name,t[52]=n.title,t[53]=f.description,t[54]=e):e=t[54];let a;t[55]!==n.name||t[56]!==v||t[57]!==s||t[58]!==r||t[59]!==M||t[60]!==g||t[61]!==e||t[62]!==i.argValues||t[63]!==i.goal?(a=(0,R.jsx)(K,{workflowName:n.name,language:r,argValues:i.argValues,onArgValuesChange:M,goal:i.goal,onGoalChange:g,examplePrompts:v,inputClassName:s,aiAssist:e}),t[55]=n.name,t[56]=v,t[57]=s,t[58]=r,t[59]=M,t[60]=g,t[61]=e,t[62]=i.argValues,t[63]=i.goal,t[64]=a):a=t[64],T=a;break bb0}C=`flex flex-col gap-3`,t[65]!==o||t[66]!==n||t[67]!==u.booleanFalse||t[68]!==u.booleanTrue||t[69]!==u.inputSchemaHeading||t[70]!==u.rawJson||t[71]!==u.rawJsonInvalid||t[72]!==r||t[73]!==f.description||t[74]!==c||t[75]!==E||t[76]!==i?(w=n.inputSchema?(0,R.jsx)(le,{schema:n.inputSchema,value:i.schemaInput,onChange:E,onValidChange:(e,t)=>{h(e),c?.(W(n,t?{...i,schemaInput:t}:i,e))},aiAssist:o?{locale:r,disabled:o.disabled,scenario:o.inputScenario??`workflow.arg`,context:{...o.context,workflowId:n.id,workflowName:n.name,workflowTitle:n.title,workflowDescription:f.description}}:void 0,labels:{inputSchemaHeading:u.inputSchemaHeading,rawJson:u.rawJson,rawJsonInvalid:u.rawJsonInvalid,booleanTrue:u.booleanTrue,booleanFalse:u.booleanFalse}}):null,t[65]=o,t[66]=n,t[67]=u.booleanFalse,t[68]=u.booleanTrue,t[69]=u.inputSchemaHeading,t[70]=u.rawJson,t[71]=u.rawJsonInvalid,t[72]=r,t[73]=f.description,t[74]=c,t[75]=E,t[76]=i,t[77]=w):w=t[77],A=`flex flex-col gap-1`;let P;t[78]===u.goalLabel?P=t[79]:(P=(0,R.jsx)(`span`,{className:`text-xs font-medium text-fg-muted`,children:u.goalLabel}),t[78]=u.goalLabel,t[79]=P);let F;t[80]!==o||t[81]!==n.id||t[82]!==n.name||t[83]!==n.title||t[84]!==u.goalLabel||t[85]!==r||t[86]!==f.description||t[87]!==g||t[88]!==i.goal||t[89]!==i.schemaInput?(F=o?(0,R.jsx)(z,{value:i.goal,onApply:g,fieldId:`workflow.goal`,fieldLabel:u.goalLabel,scenario:o.goalScenario??`workflow.goal`,locale:r,context:{...o.context,workflowId:n.id,workflowName:n.name,workflowTitle:n.title,workflowDescription:f.description,workflowInput:i.schemaInput},disabled:o.disabled,showLabel:!1}):null,t[80]=o,t[81]=n.id,t[82]=n.name,t[83]=n.title,t[84]=u.goalLabel,t[85]=r,t[86]=f.description,t[87]=g,t[88]=i.goal,t[89]=i.schemaInput,t[90]=F):F=t[90],t[91]!==P||t[92]!==F?(S=(0,R.jsxs)(`span`,{className:`flex items-center justify-between gap-2`,children:[P,F]}),t[91]=P,t[92]=F,t[93]=S):S=t[93],D=i.goal,t[94]===g?O=t[95]:(O=e=>g(e.target.value),t[94]=g,t[95]=O),k=u.goalPlaceholder,ee=_(e,`min-h-20 resize-y`)}t[9]=o,t[10]=n,t[11]=v,t[12]=b,t[13]=s,t[14]=u,t[15]=r,t[16]=f.description,t[17]=a,t[18]=c,t[19]=p,t[20]=i,t[21]=x,t[22]=S,t[23]=C,t[24]=w,t[25]=T,t[26]=D,t[27]=O,t[28]=k,t[29]=ee,t[30]=A}else x=t[21],S=t[22],C=t[23],w=t[24],T=t[25],D=t[26],O=t[27],k=t[28],ee=t[29],A=t[30];if(T!==Symbol.for(`react.early_return_sentinel`))return T;let j;t[96]!==D||t[97]!==O||t[98]!==k||t[99]!==ee?(j=(0,R.jsx)(`textarea`,{value:D,onChange:O,placeholder:k,className:ee}),t[96]=D,t[97]=O,t[98]=k,t[99]=ee,t[100]=j):j=t[100];let P;t[101]!==S||t[102]!==j||t[103]!==A?(P=(0,R.jsxs)(`div`,{className:A,children:[S,j]}),t[101]=S,t[102]=j,t[103]=A,t[104]=P):P=t[104];let F;t[105]!==x||t[106]!==v||t[107]!==u?(F=(0,R.jsx)(J,{examples:v,labels:u,onSelect:x}),t[105]=x,t[106]=v,t[107]=u,t[108]=F):F=t[108];let I;return t[109]!==C||t[110]!==w||t[111]!==P||t[112]!==F?(I=(0,R.jsxs)(`div`,{className:C,children:[w,P,F]}),t[109]=C,t[110]=w,t[111]=P,t[112]=F,t[113]=I):I=t[113],I}function X(e,t){let n=e.metadata.estimatedAgents;return n?n.min===n.max?k(t.agentScaleExact,{count:n.min}):k(t.agentScaleRange,{min:n.min,max:n.max}):k(t.agentScaleExact,{count:e.defaults.maxSubagents})}function fe(e){let t=(0,N.c)(41),{definition:n,language:r,value:i,onChange:a,mode:o,badgeLabel:s,aiAssist:c,inputClassName:l,showTimeout:u,defaultAdvancedOpen:d,onValidityChange:f}=e,p=u===void 0?!1:u,h=d===void 0?!1:d,g=m(r).workflows,[v,x]=(0,M.useState)(h),S;t[0]!==n||t[1]!==r?(S=E(n,r),t[0]=n,t[1]=r,t[2]=S):S=t[2];let C=S,O;t[3]!==n.defaults||t[4]!==i.concurrency?(O=i.concurrency.trim()?Number(i.concurrency):n.defaults.concurrency,t[3]=n.defaults,t[4]=i.concurrency,t[5]=O):O=t[5];let ee=O,A;t[6]!==n.defaults||t[7]!==i.maxSubagents?(A=i.maxSubagents.trim()?Number(i.maxSubagents):n.defaults.maxSubagents,t[6]=n.defaults,t[7]=i.maxSubagents,t[8]=A):A=t[8];let j=A,P;t[9]!==n||t[10]!==r||t[11]!==i?(P=oe(n,r,i),t[9]=n,t[10]=r,t[11]=i,t[12]=P):P=t[12];let F=P,I=s??g.readyToStart,L;t[13]!==a||t[14]!==i?(L=e=>a({...i,...e}),t[13]=a,t[14]=i,t[15]=L):L=t[15];let te=L,ne=o===`automation`&&`rounded-xl bg-surface-panel/70 p-3 shadow-surface`,re;t[16]===ne?re=t[17]:(re=_(`space-y-4`,ne),t[16]=ne,t[17]=re);let z=F||C.description,ie;t[18]===z?ie=t[19]:(ie=(0,R.jsx)(`p`,{className:`mt-1 line-clamp-2 text-xs leading-5 text-fg-muted`,children:z}),t[18]=z,t[19]=ie);let ae;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(ae=(0,R.jsx)(D,{className:`size-3.5 shrink-0 text-fg-subtle`,"aria-hidden":!0}),t[20]=ae):ae=t[20];let B;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(B=(0,R.jsx)(y,{className:`size-3.5 shrink-0 text-fg-subtle`,"aria-hidden":!0}),t[21]=B):B=t[21];let V;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(V=(0,R.jsx)(T,{className:`size-3.5 shrink-0 text-fg-subtle`,"aria-hidden":!0}),t[22]=V):V=t[22];let H;t[23]!==a||t[24]!==i?(H=e=>a({...i,...e}),t[23]=a,t[24]=i,t[25]=H):H=t[25];let U;t[26]===f?U=t[27]:(U=e=>{f?.(e)},t[26]=f,t[27]=U);let W;t[28]!==c||t[29]!==n||t[30]!==l||t[31]!==r||t[32]!==H||t[33]!==U||t[34]!==i?(W=(0,R.jsx)(Y,{definition:n,language:r,value:i,onChange:H,onValidityChange:U,aiAssist:c,inputClassName:l}),t[28]=c,t[29]=n,t[30]=l,t[31]=r,t[32]=H,t[33]=U,t[34]=i,t[35]=W):W=t[35];let G;t[36]===Symbol.for(`react.memo_cache_sentinel`)?(G=()=>x(pe),t[36]=G):G=t[36];let se=g.advancedSettings,ce=v&&`rotate-180`,K;t[37]===ce?K=t[38]:(K=_(`size-4 transition-transform`,ce),t[37]=ce,t[38]=K);let q;return t[39]===K?q=t[40]:(q=(0,R.jsx)(w,{className:K}),t[39]=K,t[40]=q),(0,R.jsxs)(`div`,{className:re,children:[(0,R.jsxs)(`section`,{className:`rounded-2xl bg-surface-panel p-4 shadow-surface`,children:[(0,R.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,R.jsxs)(`div`,{className:`min-w-0`,children:[(0,R.jsx)(`h3`,{className:`truncate text-sm font-semibold text-fg`,children:g.runPlanPreview}),ie]}),(0,R.jsx)(`span`,{className:`shrink-0 rounded-full bg-accent-soft px-2 py-1 text-[11px] font-medium text-accent-fg`,children:I})]}),(0,R.jsxs)(`div`,{className:`mt-4 grid gap-2 text-xs text-fg-muted sm:grid-cols-3`,children:[(0,R.jsxs)(`div`,{className:`flex items-center gap-2 rounded-xl bg-surface-panel px-2.5 py-2`,children:[ae,(0,R.jsx)(`span`,{children:k(g.phaseCount,{count:n.phases.length})})]}),(0,R.jsxs)(`div`,{className:`flex items-center gap-2 rounded-xl bg-surface-panel px-2.5 py-2`,children:[B,(0,R.jsx)(`span`,{children:X(n,g)})]}),(0,R.jsxs)(`div`,{className:`flex items-center gap-2 rounded-xl bg-surface-panel px-2.5 py-2`,children:[V,(0,R.jsx)(`span`,{children:k(g.runLimitsSummary,{concurrency:ee,max:j})})]})]}),n.phases.length>0?(0,R.jsxs)(`div`,{className:`mt-4`,children:[(0,R.jsxs)(`div`,{className:`flex items-center gap-2 text-[11px] font-medium uppercase tracking-wide text-fg-subtle`,children:[(0,R.jsx)(b,{className:`size-3.5`,"aria-hidden":!0}),g.startPlanPhases]}),(0,R.jsx)(`div`,{className:`mt-2 flex flex-wrap items-center gap-1.5`,children:n.phases.map(me)})]}):null]}),W,(0,R.jsxs)(`div`,{className:`rounded-xl border border-edge`,children:[(0,R.jsxs)(`button`,{type:`button`,className:`flex w-full items-center justify-between px-3 py-2.5 text-left text-sm text-fg`,onClick:G,children:[se,q]}),v?(0,R.jsxs)(`div`,{className:`grid gap-3 border-t border-edge px-3 pb-3 pt-3 sm:grid-cols-2`,children:[(0,R.jsx)(`input`,{value:i.concurrency,onChange:e=>te({concurrency:e.target.value}),placeholder:k(g.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,R.jsx)(`input`,{value:i.maxSubagents,onChange:e=>te({maxSubagents:e.target.value}),placeholder:k(g.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`}),p?(0,R.jsx)(`input`,{value:i.timeoutSeconds??``,onChange:e=>te({timeoutSeconds:e.target.value}),placeholder:k(g.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,R.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[t>0?(0,R.jsx)(`span`,{className:`text-fg-subtle`,children:`→`}):null,(0,R.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{z as a,W as i,se as n,U as r,fe as t};
|
package/dist/gateway/static/root/assets/{workflows-page-BTdeeQSn.js → workflows-page-B-qyam4R.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{c as i,d as a,h as o,l as s,p as c,t as l}from"./chunk-KS7C4IRE-Cq1tE_3b.js";import{a as u,c as d,i as f,n as p,o as m,r as h,s as g,t as _}from"./dist-CpzYSoz7.js";import{t as v}from"./check-DUBLcKHA.js";import{n as y,r as b,t as x}from"./popover-select-CKBYnT3c.js";import{t as S}from"./copy-Dv6d4Dvw.js";import{t as C}from"./download-Dk-ZjtO6.js";import{t as w}from"./markdown-view-D-FLW0dt.js";import{t as T}from"./plus-Q2yW6OE7.js";import{t as E}from"./x-B_N4OPjy.js";import{t as D}from"./copy-to-clipboard-HOJ79TWv.js";import{t as O}from"./messages-CIDIpI4Y.js";import{n as k,s as A}from"./locale-store-CHtOF1kO.js";import{t as j}from"./cn-JdwAhgNB.js";import{i as M}from"./vendor-swr-BIWyz7Rc.js";import{t as N}from"./button-B11EPpor.js";import{i as P}from"./theme-store-CyYxQYpT.js";import{t as F}from"./skeleton-BwbyijEw.js";import{$l as I,A as L,Ac as R,Al as z,Au as B,Bl as V,C as H,Cr as U,D as W,Dr as G,E as K,Ec as q,Er as ee,Fr as te,Fs as ne,Gl as re,Hc as ie,Hi as ae,Hs as J,Ir as oe,Ll as se,Lr as ce,Mr as le,Nn as Y,Ns as ue,O as de,Pl as X,Pr as fe,Rr as pe,Rs as me,S as he,Sr as ge,T as _e,Tl as ve,Tr as ye,Vs as be,Xc as xe,_ as Se,_c as Ce,_r as we,_u as Te,al as Ee,as as De,b as Oe,br as ke,ca as Ae,cr as je,d as Me,da as Ne,dr as Pe,en as Fe,f as Ie,fr as Le,fu as Re,g as ze,gr as Be,h as Ve,hc as He,hr as Ue,i as We,ir as Ge,iu as Ke,jr as qe,k as Je,kr as Ye,ll as Xe,lr as Ze,m as Qe,ml as $e,mr as et,nc as tt,nl as nt,or as rt,p as it,pc as at,pr as ot,rn as st,ro as ct,sl as lt,sr as ut,u as dt,ur as ft,uu as pt,v as mt,vr as ht,w as gt,wr as _t,x as vt,xr as yt,xu as bt,y as xt,yl as St,yu as Ct}from"./index-BXdV0Oia.js";import{l as wt}from"./vendor-codemirror-DFxP3B9T.js";import{t as Tt}from"./code-editor-CXIH8jQw.js";import{t as Et}from"./page-tabs-BE7aDmYf.js";import{n as Dt,t as Ot}from"./tab-completion-input-D64VNmiA.js";import{i as kt,r as At,t as jt}from"./workflow-run-setup-panel-Darl4tuN.js";import{t as Mt}from"./tab-completion-input.utils-BP3NH_du.js";import{a as Nt,c as Pt,i as Ft,l as It,n as Lt,o as Rt,r as zt,s as Bt,t as Vt}from"./style-TIDOdKy0.js";var Z=e(t(),1),Q=n(),Ht=[`queued`,`running`,`succeeded`,`attention`],Ut=new Set([`failed`,`timeout`,`cancelled`]);function Wt(e){return e.metadata?.sessionKey?.trim()||null}function Gt(e,t){return e.length<=t?e:`${e.slice(0,t-1)}…`}function Kt(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 qt(e,t=90){let n=e.metadata?.input?.goal?.trim()||(typeof e.metadata?.input?.payload==`string`?e.metadata.input.payload.trim():null)||Kt(e.metadata?.input?.payload,[`query`,`goal`,`prompt`,`input`,`message`])||Kt(e.metadata?.input?.variables,[`query`,`goal`,`prompt`,`input`,`message`]);return n?Gt(n,t):null}function Jt(e,t=90){return qt(e,t)??Gt(e.title?.trim()||e.definitionId,t)}function Yt(e,t=44){return Gt(e.title?.trim()||e.definitionId,t)}function Xt(e,t){let n=t.trim().toLowerCase();return n?[qt(e,500),e.title,e.definitionId,e.id].filter(Boolean).join(` `).toLowerCase().includes(n):!0}function Zt(e,t){let n=t.workflowFilterId.trim();return e.filter(e=>n&&e.definitionId!==n||!ot(e,t.triggerFilter??`all`)?!1:Xt(e,t.searchQuery))}function Qt(e){return e.completedAtMs??e.createdAtMs}function $t(e,t){return e.status===`queued`?`queued`:e.status===`running`?`running`:e.status===`succeeded`?`succeeded`:Ut.has(e.status)?`attention`:null}function en(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)=>Qt(t)-Qt(e))}function tn(e,t){let n={queued:[],running:[],succeeded:[],attention:[]};for(let r of e){let e=$t(r,t);e&&n[e].push(r)}return Ht.map(e=>{if(e===`succeeded`){let t=en(`succeeded`,n.succeeded);return{id:e,runs:t,totalInWindow:t.length}}return{id:e,runs:en(e,n[e])}})}function nn(e,t,n){let r=Math.round((t-e)/1e3);if(r<60)return le(-r,`second`,n);let i=Math.round(r/60);if(i<60)return le(-i,`minute`,n);let a=Math.round(i/60);return a<48?le(-a,`hour`,n):le(-Math.round(a/24),`day`,n)}function rn(e){return e.status===`queued`||e.status===`running`}function an(e){return e.status===`failed`||e.status===`timeout`||e.status===`cancelled`}var $=r(),on=(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:l,onRetry:u}=e,d=O(r).workflows,[f,p]=(0,Z.useState)(!1),m;t[0]===n?m=t[1]:(m=Wt(n),t[0]=n,t[1]=m);let h=!m,g;t[2]===n?g=t[3]:(g=rn(n),t[2]=n,t[3]=g);let _=g,v=n.status===`running`||n.status===`queued`,y;t[4]!==n.metrics.agentCount||t[5]!==n.metrics.doneAgentCount?(y=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]=y):y=t[6];let b=y,x=n.metrics.errorAgentCount>0,S=n.startedAtMs??n.createdAtMs,C=je(_?a-S:n.metrics.durationMs),w=ft(d.taskArtifacts,{count:n.metrics.artifactCount}),T;t[7]===n?T=t[8]:(T=Jt(n),t[7]=n,t[8]=T);let E=T,D;t[9]===n?D=t[10]:(D=Yt(n),t[9]=n,t[10]=D);let k=D,A;t[11]!==s||t[12]!==n?(A=()=>{s(n)},t[11]=s,t[12]=n,t[13]=A):A=t[13];let M=A,P;t[14]!==h||t[15]!==c||t[16]!==n?(P=()=>{h||c(n)},t[14]=h,t[15]=c,t[16]=n,t[17]=P):P=t[17];let F=P,I=o&&`ring-1 ring-accent/30`,L;t[18]===I?L=t[19]:(L=j(`group relative min-h-24 overflow-hidden rounded-lg bg-surface-panel p-3 shadow-surface transition-colors`,I,`hover:bg-surface-hover`),t[18]=I,t[19]=L);let R;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(R=j(`w-full text-left`,De.focusRingPanel),t[20]=R):R=t[20];let z;t[21]===E?z=t[22]:(z=(0,$.jsx)(`div`,{className:`line-clamp-2 text-sm font-medium leading-5 text-fg`,children:E}),t[21]=E,t[22]=z);let B;t[23]===k?B=t[24]:(B=(0,$.jsx)(`div`,{className:`mt-1 truncate text-[11px] font-medium text-fg-muted`,children:k}),t[23]=k,t[24]=B);let H;t[25]!==z||t[26]!==B?(H=(0,$.jsxs)(`div`,{className:`min-w-0`,children:[z,B]}),t[25]=z,t[26]=B,t[27]=H):H=t[27];let U;t[28]===n.status?U=t[29]:(U=j(`shrink-0 rounded-full px-2 py-0.5 text-[10px] font-semibold shadow-sm`,et(n.status)),t[28]=n.status,t[29]=U);let W;t[30]!==i||t[31]!==a||t[32]!==S?(W=nn(S,a,i),t[30]=i,t[31]=a,t[32]=S,t[33]=W):W=t[33];let G;t[34]===W?G=t[35]:(G=(0,$.jsx)(`span`,{children:W}),t[34]=W,t[35]=G);let K=C===`—`?null:(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`span`,{"aria-hidden":!0,children:`·`}),(0,$.jsx)(`span`,{children:ft(d.taskElapsed,{duration:C})})]}),q;t[36]!==G||t[37]!==K?(q=(0,$.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-1.5 text-[11px] text-fg-subtle`,children:[G,K]}),t[36]=G,t[37]=K,t[38]=q):q=t[38];let ee=n.metrics.artifactCount>0?(0,$.jsx)(`span`,{className:`rounded-full bg-surface-hover px-2 py-0.5 font-medium text-fg-muted`,children:w}):null,te=o?(0,$.jsx)(`span`,{className:`font-medium text-accent-fg`,children:d.taskOpenDetails}):null,ne;t[39]!==ee||t[40]!==te?(ne=(0,$.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-2 text-[11px] text-fg-subtle`,children:[ee,te]}),t[39]=ee,t[40]=te,t[41]=ne):ne=t[41];let re=h&&`cursor-not-allowed text-fg-disabled hover:bg-transparent`,ie;t[42]===re?ie=t[43]:(ie=j(`rounded-md px-2 py-1 text-xs font-medium`,`text-accent-fg hover:bg-accent-soft`,De.focusRingPanel,re),t[42]=re,t[43]=ie);let ae;t[44]!==h||t[45]!==F||t[46]!==d.continueInChat||t[47]!==ie?(ae=(0,$.jsx)(`button`,{type:`button`,className:ie,disabled:h,onClick:F,children:d.continueInChat}),t[44]=h,t[45]=F,t[46]=d.continueInChat,t[47]=ie,t[48]=ae):ae=t[48];let J;t[49]===Symbol.for(`react.memo_cache_sentinel`)?(J=j(`rounded-md px-2 py-1 text-xs font-medium text-fg-muted hover:bg-surface-hover hover:text-fg`,De.focusRingPanel),t[49]=J):J=t[49];let oe;t[50]!==M||t[51]!==d.taskOpenDetails?(oe=(0,$.jsx)(`button`,{type:`button`,className:J,onClick:M,children:d.taskOpenDetails}),t[50]=M,t[51]=d.taskOpenDetails,t[52]=oe):oe=t[52];let se;t[53]!==ae||t[54]!==oe?(se=(0,$.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-2 border-t border-edge-subtle pt-2`,children:[ae,oe]}),t[53]=ae,t[54]=oe,t[55]=se):se=t[55];let ce;t[56]===p?ce=t[57]:(ce=()=>p(cn),t[56]=p,t[57]=ce);let le;t[58]===Symbol.for(`react.memo_cache_sentinel`)?(le=(0,$.jsx)(V,{className:`size-4`,"aria-hidden":!0}),t[58]=le):le=t[58];let Y;t[59]!==d.taskActionsAria||t[60]!==f||t[61]!==ce?(Y=(0,$.jsx)(N,{variant:`ghost`,className:`size-7 p-0 opacity-0 group-hover:opacity-100 group-focus-within:opacity-100`,"aria-label":d.taskActionsAria,"aria-expanded":f,onClick:ce,children:le}),t[59]=d.taskActionsAria,t[60]=f,t[61]=ce,t[62]=Y):Y=t[62];let ue;t[63]!==_||t[64]!==d.cancel||t[65]!==d.rerun||t[66]!==d.taskCloseMenu||t[67]!==f||t[68]!==l||t[69]!==u||t[70]!==n||t[71]!==p?(ue=f?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`button`,{type:`button`,className:`fixed inset-0 z-10 cursor-default`,"aria-label":d.taskCloseMenu,onClick:()=>p(!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:[_?(0,$.jsx)(sn,{label:d.cancel,tone:`danger`,onClick:()=>{p(!1),l(n.id)}}):null,an(n)?(0,$.jsx)(sn,{label:d.rerun,onClick:()=>{p(!1),u(n.id)}}):null]})]}):null,t[63]=_,t[64]=d.cancel,t[65]=d.rerun,t[66]=d.taskCloseMenu,t[67]=f,t[68]=l,t[69]=u,t[70]=n,t[71]=p,t[72]=ue):ue=t[72];let de;return t[73]!==Y||t[74]!==ue?(de=(0,$.jsxs)(`div`,{className:`absolute right-2 top-2`,children:[Y,ue]}),t[73]=Y,t[74]=ue,t[75]=de):de=t[75],(0,$.jsxs)(`div`,{className:L,children:[(0,$.jsxs)(`button`,{type:`button`,onClick:M,"aria-label":`${d.taskOpenDetails}: ${E}`,"aria-current":o?`true`:void 0,className:R,children:[(0,$.jsxs)(`div`,{className:`pr-7`,children:[(0,$.jsxs)(`div`,{className:`flex min-w-0 items-start justify-between gap-2`,children:[H,(0,$.jsx)(`span`,{className:U,children:d.status[n.status]??n.status})]}),q]}),v?(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:ft(d.agentProgress,{done:n.metrics.doneAgentCount,total:n.metrics.agentCount})}),(0,$.jsxs)(`span`,{children:[b,`%`]})]}),(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:`${b}%`}})})]}):null,ne,x?(0,$.jsxs)(`div`,{className:`mt-2 flex items-center gap-1 text-[11px] text-amber-700 dark:text-amber-300`,children:[(0,$.jsx)(be,{className:`size-3 shrink-0`,"aria-hidden":!0}),ft(d.runRowErrorSummary,{count:n.metrics.errorAgentCount})]}):null]}),se,de]})});function sn(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=j(`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 l;return t[3]!==r||t[4]!==n||t[5]!==a||t[6]!==c?(l=(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]=l):l=t[7],l}function cn(e){return!e}function ln(e,t){return t.boardColumns[e]}var un=(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:l,onCancelRun:u,onRetryRun:d}=e,f=O(r).workflows,[p,m]=(0,Z.useState)(!1),h=n.id===`succeeded`,g=h?5:n.runs.length,_;t[0]!==g||t[1]!==n.runs||t[2]!==p||t[3]!==h?(_=h&&!p?n.runs.slice(0,g):n.runs,t[0]=g,t[1]=n.runs,t[2]=p,t[3]=h,t[4]=_):_=t[4];let v=_,y=h&&n.runs.length>5&&!p,b=h&&p,x;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(x=j(`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]=x):x=t[5];let S;t[6]===n.runs.length?S=t[7]:(S=(0,$.jsx)(`span`,{className:`shrink-0 text-xs text-fg-subtle`,children:n.runs.length}),t[6]=n.runs.length,t[7]=S);let C;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,$.jsx)(V,{className:`size-4 shrink-0 text-fg-subtle`,"aria-hidden":!0}),t[8]=C):C=t[8];let w=s&&v.length===0?(0,$.jsx)(dn,{}):v.length===0?(0,$.jsx)(`div`,{className:`rounded-lg bg-surface-panel/70 px-3 py-6 text-center text-xs text-fg-subtle`,children:f.boardColumnEmpty}):v.map(e=>(0,$.jsx)(on,{run:e,language:r,localeTag:i,nowMs:a,selected:e.id===o,onOpen:c,onOpenChat:l,onCancel:u,onRetry:d},e.id)),T=y?(0,$.jsx)(N,{variant:`ghost`,className:`h-8 w-full text-xs`,onClick:()=>m(!0),children:ft(f.boardExpandSucceeded,{count:Math.min(n.runs.length,n.totalInWindow??n.runs.length)})}):null,E;t[9]!==b||t[10]!==f||t[11]!==m?(E=b?(0,$.jsx)(N,{variant:`ghost`,className:`h-8 w-full text-xs`,onClick:()=>m(!1),children:f.boardCollapseSucceeded}):null,t[9]=b,t[10]=f,t[11]=m,t[12]=E):E=t[12];let D;return t[13]!==w||t[14]!==T||t[15]!==E?(D=(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:[w,T,E]}),t[13]=w,t[14]=T,t[15]=E,t[16]=D):D=t[16],(0,$.jsxs)(`section`,{className:x,"aria-label":ln(n.id,f),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:ln(n.id,f)}),S]}),C]}),D]})});function dn(){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)(F,{className:`size-4/5`}),(0,$.jsx)(F,{className:`mt-2 h-3 w-24`})]}),(0,$.jsx)(F,{className:`h-5 w-14 rounded-full`})]}),(0,$.jsx)(F,{className:`mt-3 h-3 w-2/3`}),(0,$.jsx)(F,{className:`mt-4 h-5 w-20 rounded-full`})]}),e[0]=t):t=e[0],t}function fn(e){return e instanceof Element?!!e.closest(`a,button,input,select,textarea,[contenteditable="true"],[draggable="true"],[data-board-pan-skip="true"]`):!0}var pn=(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(mn),t[0]=n,t[1]=g);let _=g,v=(0,Z.useRef)(null),y=(0,Z.useRef)(null),[b,x]=(0,Z.useState)(hn),[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=tn(Zt(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(gn,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||fn(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,P;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(P=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]=P):P=t[13];let F=P;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)(N,{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 I=S?`cursor-grabbing select-none`:`cursor-grab`,L;t[25]===I?L=t[26]:(L=[`min-h-0 h-full min-w-0 overflow-x-auto rounded-lg p-2`,I],t[25]=I,t[26]=L);let R=L.join(` `),z;t[27]===Symbol.for(`react.memo_cache_sentinel`)?(z=e=>{y.current?.pointerId===e.pointerId&&(y.current=null,C(!1))},t[27]=z):z=t[27];let B;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)(un,{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],B=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]=B}else B=t[38];let V;t[49]===B?V=t[50]:(V=(0,$.jsx)(`div`,{className:`flex min-h-full min-w-max items-start gap-3 pr-4`,children:B}),t[49]=B,t[50]=V);let H;return t[51]!==R||t[52]!==V?(H=(0,$.jsx)(`div`,{ref:v,className:R,onPointerDown:M,onPointerMove:F,onPointerUp:A,onPointerCancel:A,onLostPointerCapture:z,children:V}),t[51]=R,t[52]=V,t[53]=H):H=t[53],H});function mn(e){return e.status===`queued`||e.status===`running`}function hn(){return Date.now()}function gn(e,t){return e+t.runs.length}function _n(e,t){let n=e.metadata.estimatedAgents;return n?n.min===n.max?ft(t.agentScaleExact,{count:n.min}):ft(t.agentScaleRange,{min:n.min,max:n.max}):null}function vn(e){let t=(0,Q.c)(77),{definition:n,language:r,labels:i,onPick:a,onDetail:o,onEdit:s,savedForProject:c}=e,l;t[0]!==n||t[1]!==r?(l=Ye(n,r),t[0]=n,t[1]=r,t[2]=l):l=t[2];let u=l,d;t[3]!==n||t[4]!==i?(d=_n(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=j(`rounded-full px-2 py-0.5 text-[10px] font-medium`,m),t[6]=m,t[7]=h);let g=p?i.badgeUser:i.badgeBuiltin,_;t[8]!==h||t[9]!==g?(_=(0,$.jsx)(`span`,{className:h,children:g}),t[8]=h,t[9]=g,t[10]=_):_=t[10];let v;t[11]!==n.inputSchema||t[12]!==i.inputSchemaBadge?(v=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)(Te,{className:`size-2.5`,"aria-hidden":!0}),i.inputSchemaBadge]}):null,t[11]=n.inputSchema,t[12]=i.inputSchemaBadge,t[13]=v):v=t[13];let y;t[14]!==i.projectWorkflowBadge||t[15]!==c?(y=c?(0,$.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded-full bg-success-soft px-2 py-0.5 text-[10px] text-success`,children:[(0,$.jsx)(bt,{className:`size-2.5`,"aria-hidden":!0}),i.projectWorkflowBadge]}):null,t[14]=i.projectWorkflowBadge,t[15]=c,t[16]=y):y=t[16];let b;t[17]!==_||t[18]!==v||t[19]!==y?(b=(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[_,v,y]}),t[17]=_,t[18]=v,t[19]=y,t[20]=b):b=t[20];let x;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(x=j(`mt-2 line-clamp-2 text-left text-sm font-semibold leading-5 text-fg hover:text-accent-fg`,De.focusRingPanel),t[21]=x):x=t[21];let S;t[22]!==n||t[23]!==o?(S=()=>o(n),t[22]=n,t[23]=o,t[24]=S):S=t[24];let C;t[25]!==n.title||t[26]!==S?(C=(0,$.jsx)(`button`,{type:`button`,className:x,onClick:S,children:n.title}),t[25]=n.title,t[26]=S,t[27]=C):C=t[27];let w;t[28]!==C||t[29]!==b?(w=(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[b,C]}),t[28]=C,t[29]=b,t[30]=w):w=t[30];let T=`${p?i.editWorkflow:i.copyAndEditWorkflow}: ${n.title}`,E;t[31]!==n||t[32]!==s?(E=()=>s(n),t[31]=n,t[32]=s,t[33]=E):E=t[33];let D;t[34]===p?D=t[35]:(D=p?(0,$.jsx)(R,{className:`size-3.5`,"aria-hidden":!0}):(0,$.jsx)(re,{className:`size-3.5`,"aria-hidden":!0}),t[34]=p,t[35]=D);let O;t[36]!==T||t[37]!==E||t[38]!==D?(O=(0,$.jsx)(N,{type:`button`,variant:`ghost`,className:`size-8 shrink-0 p-0`,"aria-label":T,onClick:E,children:D}),t[36]=T,t[37]=E,t[38]=D,t[39]=O):O=t[39];let k;t[40]!==w||t[41]!==O?(k=(0,$.jsxs)(`div`,{className:`flex min-w-0 items-start justify-between gap-3`,children:[w,O]}),t[40]=w,t[41]=O,t[42]=k):k=t[42];let A=u.whenToUse||u.description||n.description,M;t[43]===A?M=t[44]:(M=(0,$.jsx)(`p`,{className:`mt-2 line-clamp-2 text-xs leading-5 text-fg-muted`,children:A}),t[43]=A,t[44]=M);let P;t[45]===Symbol.for(`react.memo_cache_sentinel`)?(P=(0,$.jsx)(Xe,{className:`size-3`,"aria-hidden":!0}),t[45]=P):P=t[45];let F;t[46]!==n.phases.length||t[47]!==i.phaseCount?(F=ft(i.phaseCount,{count:n.phases.length}),t[46]=n.phases.length,t[47]=i.phaseCount,t[48]=F):F=t[48];let I;t[49]===F?I=t[50]:(I=(0,$.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[P,F]}),t[49]=F,t[50]=I);let L;t[51]===f?L=t[52]:(L=f?(0,$.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,$.jsx)(ne,{className:`size-3`,"aria-hidden":!0}),f]}):null,t[51]=f,t[52]=L);let z;t[53]!==I||t[54]!==L?(z=(0,$.jsxs)(`div`,{className:`mt-auto flex flex-wrap items-center gap-3 pt-4 text-[11px] text-fg-subtle`,children:[I,L]}),t[53]=I,t[54]=L,t[55]=z):z=t[55];let B;t[56]!==n||t[57]!==a?(B=()=>a(n),t[56]=n,t[57]=a,t[58]=B):B=t[58];let V;t[59]===Symbol.for(`react.memo_cache_sentinel`)?(V=(0,$.jsx)(q,{className:`size-3.5`,"aria-hidden":!0}),t[59]=V):V=t[59];let H;t[60]!==i.configureAndRun||t[61]!==B?(H=(0,$.jsxs)(N,{type:`button`,variant:`secondary`,className:`h-8 flex-1 rounded-lg text-xs`,onClick:B,children:[V,i.configureAndRun]}),t[60]=i.configureAndRun,t[61]=B,t[62]=H):H=t[62];let U;t[63]!==n||t[64]!==o?(U=()=>o(n),t[63]=n,t[64]=o,t[65]=U):U=t[65];let W;t[66]!==i.viewDetails||t[67]!==U?(W=(0,$.jsx)(N,{type:`button`,variant:`secondary`,className:`h-8 rounded-lg text-xs`,onClick:U,children:i.viewDetails}),t[66]=i.viewDetails,t[67]=U,t[68]=W):W=t[68];let G;t[69]!==H||t[70]!==W?(G=(0,$.jsxs)(`div`,{className:`mt-3 flex items-center gap-2 border-t border-edge-subtle pt-3`,children:[H,W]}),t[69]=H,t[70]=W,t[71]=G):G=t[71];let K;return t[72]!==k||t[73]!==M||t[74]!==z||t[75]!==G?(K=(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:[k,M,z,G]}),t[72]=k,t[73]=M,t[74]=z,t[75]=G,t[76]=K):K=t[76],K}function yn(e){let t=(0,Q.c)(45),{definitions:n,runs:r,language:i,projectPresetDefinitionIds:a,onPick:o,onDetail:s,onEdit:c}=e,[l]=(0,Z.useState)(Sn),u=O(i).workflows,d=i===`zh`?`zh-CN`:`en-US`,[f,p]=(0,Z.useState)(``),[m,h]=(0,Z.useState)(`all`),[g,_]=(0,Z.useState)(`all`),v;t[0]!==m||t[1]!==n||t[2]!==f||t[3]!==g?(v=ut(n,f,m,g),t[0]=m,t[1]=n,t[2]=f,t[3]=g,t[4]=v):v=t[4];let x=v,S;if(t[5]!==n||t[6]!==r){let e=new Map(n.map(xn)),i=new Set;S=[...r].sort(bn).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]=S}else S=t[7];let C=S,w=ft(u.workflowCount,{count:x.length}),T;t[8]===w?T=t[9]:(T=(0,$.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:w}),t[8]=w,t[9]=T);let E=u.sourceFilterAria,D;t[10]!==u.sources||t[11]!==_||t[12]!==g?(D=_t.map(e=>(0,$.jsx)(`button`,{type:`button`,className:j(`h-8 rounded-md px-2.5 text-xs font-medium transition-colors`,g===e?`bg-surface-base text-fg shadow-surface`:`text-fg-muted hover:text-fg`,De.focusRingPanel),"aria-pressed":g===e,onClick:()=>_(e),children:u.sources[e]},e)),t[10]=u.sources,t[11]=_,t[12]=g,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":E,children:D}),t[14]=u.sourceFilterAria,t[15]=D,t[16]=k):k=t[16];let A=u.categoryFilterAria,M;t[17]===h?M=t[18]:(M=e=>h(e.target.value),t[17]=h,t[18]=M);let N;t[19]===u.categories?N=t[20]:(N=ke.map(e=>(0,$.jsx)(b,{value:e,children:u.categories[e]},e)),t[19]=u.categories,t[20]=N);let P;t[21]!==m||t[22]!==u.categoryFilterAria||t[23]!==M||t[24]!==N?(P=(0,$.jsx)(y,{value:m,"aria-label":A,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]=m,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 I;t[29]===Symbol.for(`react.memo_cache_sentinel`)?(I=(0,$.jsx)(at,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-subtle`,"aria-hidden":!0}),t[29]=I):I=t[29];let L;t[30]===p?L=t[31]:(L=e=>p(e.target.value),t[30]=p,t[31]=L);let R=u.librarySearchPlaceholder,z;t[32]===Symbol.for(`react.memo_cache_sentinel`)?(z=j(`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`,De.focusRingPanel),t[32]=z):z=t[32];let B;t[33]!==u.librarySearchPlaceholder||t[34]!==f||t[35]!==L?(B=(0,$.jsxs)(`div`,{className:`relative max-w-xl`,children:[I,(0,$.jsx)(`input`,{value:f,onChange:L,placeholder:R,className:z})]}),t[33]=u.librarySearchPlaceholder,t[34]=f,t[35]=L,t[36]=B):B=t[36];let V;return t[37]!==x||t[38]!==u||t[39]!==i||t[40]!==s||t[41]!==c||t[42]!==o||t[43]!==a?(V=x.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:x.map(e=>(0,$.jsx)(vn,{definition:e,language:i,labels:u,savedForProject:a?.has(e.id)??!1,onPick:o,onDetail:s,onEdit:c},e.id))}),t[37]=x,t[38]=u,t[39]=i,t[40]=s,t[41]=c,t[42]=o,t[43]=a,t[44]=V):V=t[44],(0,$.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-5`,children:[C.length>0&&!f&&m===`all`&&g===`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:C.map(e=>{let{definition:t,lastRunAtMs:n}=e;return(0,$.jsxs)(`button`,{type:`button`,className:j(`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`,De.focusRingPanel),onClick:()=>o(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:nn(n,l,d)})]}),(0,$.jsx)(q,{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}),T]}),F]}),B]}),V]})]})}function bn(e,t){return(t.startedAtMs??t.createdAtMs)-(e.startedAtMs??e.createdAtMs)}function xn(e){return[e.id,e]}function Sn(){return Date.now()}var Cn=(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:l}=e,u,d,f,p,m,h,g,_,v,y,b,x,S,C,w,T,E;if(t[0]!==r||t[1]!==i||t[2]!==a||t[3]!==o||t[4]!==n){f=O(r).workflows;let e;t[22]===n?e=t[23]:(e=rn(n),t[22]=n,t[23]=e),u=e;let s;t[24]===n?s=t[25]:(s=an(n),t[24]=n,t[25]=s),p=s;let c;t[26]===n?c=t[27]:(c=Wt(n),t[26]=n,t[27]=c),d=!!c;let l=n.startedAtMs??n.createdAtMs,D=je(u?a-l:n.metrics.durationMs),k;t[28]!==n.metrics.agentCount||t[29]!==n.metrics.doneAgentCount?(k=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]=k):k=t[30];let A=k;v=`group border-b border-edge-subtle last:border-b-0`,_=`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`,T=`button`,t[31]!==o||t[32]!==n?(E=()=>o(n),t[31]=o,t[32]=n,t[33]=E):E=t[33],t[34]===Symbol.for(`react.memo_cache_sentinel`)?(h=j(`min-w-0 flex-1 text-left`,De.focusRingPanel),t[34]=h):h=t[34];let M=f.taskOpenDetails,N;t[35]===n?N=t[36]:(N=Jt(n),t[35]=n,t[36]=N),g=`${M}: ${N}`,C=`flex min-w-0 items-start gap-3`;let P;t[37]===n.status?P=t[38]:(P=j(`mt-0.5 shrink-0 rounded-full px-2 py-0.5 text-[10px] font-semibold`,et(n.status)),t[37]=n.status,t[38]=P),w=(0,$.jsx)(`span`,{className:P,children:f.status[n.status]??n.status}),m=`min-w-0 flex-1`;let F;t[39]===n?F=t[40]:(F=Jt(n),t[39]=n,t[40]=F),t[41]===F?y=t[42]:(y=(0,$.jsx)(`span`,{className:`block truncate text-sm font-medium text-fg`,children:F}),t[41]=F,t[42]=y);let I;t[43]===n?I=t[44]:(I=Yt(n),t[43]=n,t[44]=I);let L;t[45]===I?L=t[46]:(L=(0,$.jsx)(`span`,{className:`truncate font-medium`,children:I}),t[45]=I,t[46]=L);let R;t[47]===Symbol.for(`react.memo_cache_sentinel`)?(R=(0,$.jsx)(`span`,{"aria-hidden":!0,children:`·`}),t[47]=R):R=t[47];let z;t[48]!==i||t[49]!==a||t[50]!==l?(z=nn(l,a,i),t[48]=i,t[49]=a,t[50]=l,t[51]=z):z=t[51];let B;t[52]===z?B=t[53]:(B=(0,$.jsx)(`span`,{children:z}),t[52]=z,t[53]=B);let V=D===`—`?null:(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`span`,{"aria-hidden":!0,children:`·`}),(0,$.jsx)(`span`,{children:ft(f.taskElapsed,{duration:D})})]});t[54]!==L||t[55]!==B||t[56]!==V?(b=(0,$.jsxs)(`span`,{className:`mt-1 flex flex-wrap items-center gap-x-2 gap-y-1 text-xs text-fg-muted`,children:[L,R,B,V]}),t[54]=L,t[55]=B,t[56]=V,t[57]=b):b=t[57],x=u&&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:ft(f.agentProgress,{done:n.metrics.doneAgentCount,total:n.metrics.agentCount})}),(0,$.jsxs)(`span`,{className:`tabular-nums`,children:[A,`%`]})]}),(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:`${A}%`}})})]}):null,S=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)(be,{className:`size-3 shrink-0`,"aria-hidden":!0}),ft(f.runRowErrorSummary,{count:n.metrics.errorAgentCount})]}):null,t[0]=r,t[1]=i,t[2]=a,t[3]=o,t[4]=n,t[5]=u,t[6]=d,t[7]=f,t[8]=p,t[9]=m,t[10]=h,t[11]=g,t[12]=_,t[13]=v,t[14]=y,t[15]=b,t[16]=x,t[17]=S,t[18]=C,t[19]=w,t[20]=T,t[21]=E}else u=t[5],d=t[6],f=t[7],p=t[8],m=t[9],h=t[10],g=t[11],_=t[12],v=t[13],y=t[14],b=t[15],x=t[16],S=t[17],C=t[18],w=t[19],T=t[20],E=t[21];let D;t[58]!==m||t[59]!==y||t[60]!==b||t[61]!==x||t[62]!==S?(D=(0,$.jsxs)(`span`,{className:m,children:[y,b,x,S]}),t[58]=m,t[59]=y,t[60]=b,t[61]=x,t[62]=S,t[63]=D):D=t[63];let k;t[64]!==D||t[65]!==C||t[66]!==w?(k=(0,$.jsxs)(`div`,{className:C,children:[w,D]}),t[64]=D,t[65]=C,t[66]=w,t[67]=k):k=t[67];let A;t[68]!==h||t[69]!==g||t[70]!==k||t[71]!==T||t[72]!==E?(A=(0,$.jsx)(`button`,{type:T,onClick:E,className:h,"aria-label":g,children:k}),t[68]=h,t[69]=g,t[70]=k,t[71]=T,t[72]=E,t[73]=A):A=t[73];let M;t[74]!==f.rerun||t[75]!==l||t[76]!==p||t[77]!==n.id?(M=p?(0,$.jsx)(N,{type:`button`,variant:`primary`,className:`h-8 rounded-lg text-xs`,onClick:()=>l(n.id),children:f.rerun}):null,t[74]=f.rerun,t[75]=l,t[76]=p,t[77]=n.id,t[78]=M):M=t[78];let P;t[79]!==d||t[80]!==f.continueInChat||t[81]!==s||t[82]!==n?(P=n.status===`succeeded`&&d?(0,$.jsx)(N,{type:`button`,variant:`secondary`,className:`h-8 rounded-lg text-xs`,onClick:()=>s(n),children:f.continueInChat}):null,t[79]=d,t[80]=f.continueInChat,t[81]=s,t[82]=n,t[83]=P):P=t[83];let F;t[84]!==u||t[85]!==f.cancel||t[86]!==c||t[87]!==n.id?(F=u?(0,$.jsx)(N,{type:`button`,variant:`ghost`,className:`h-8 rounded-lg text-xs text-red-600 dark:text-red-300`,onClick:()=>c(n.id),children:f.cancel}):null,t[84]=u,t[85]=f.cancel,t[86]=c,t[87]=n.id,t[88]=F):F=t[88];let I;t[89]!==o||t[90]!==n?(I=()=>o(n),t[89]=o,t[90]=n,t[91]=I):I=t[91];let L;t[92]===Symbol.for(`react.memo_cache_sentinel`)?(L=(0,$.jsx)(pt,{className:`size-4`,"aria-hidden":!0}),t[92]=L):L=t[92];let R;t[93]!==f.taskOpenDetails||t[94]!==I?(R=(0,$.jsx)(N,{type:`button`,variant:`ghost`,className:`size-8 p-0`,"aria-label":f.taskOpenDetails,onClick:I,children:L}),t[93]=f.taskOpenDetails,t[94]=I,t[95]=R):R=t[95];let z;t[96]!==M||t[97]!==P||t[98]!==F||t[99]!==R?(z=(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center justify-end gap-1.5 pl-7 lg:pl-0`,children:[M,P,F,R]}),t[96]=M,t[97]=P,t[98]=F,t[99]=R,t[100]=z):z=t[100];let B;t[101]!==_||t[102]!==A||t[103]!==z?(B=(0,$.jsxs)(`div`,{className:_,children:[A,z]}),t[101]=_,t[102]=A,t[103]=z,t[104]=B):B=t[104];let V;return t[105]!==v||t[106]!==B?(V=(0,$.jsx)(`article`,{className:v,children:B}),t[105]=v,t[106]=B,t[107]=V):V=t[107],V});function wn(e){let t=(0,Q.c)(17),{vm:n}=e,{labels:r,language:i,loading:a,ownerAgentId:o,agentOptions:s,setOwnerAgentId:c,refreshAll:u}=n,d;t[0]!==s||t[1]!==r.agentFilterAria||t[2]!==i||t[3]!==o||t[4]!==c?(d=s.length>1?(0,$.jsx)(y,{value:o??``,"aria-label":r.agentFilterAria,onChange:e=>c(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:s.map(e=>(0,$.jsx)(b,{value:e.id,children:Fe(e,O(i).agentsSettings)},e.id))}):null,t[0]=s,t[1]=r.agentFilterAria,t[2]=i,t[3]=o,t[4]=c,t[5]=d):d=t[5];let f;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,$.jsx)(T,{className:`size-4`,"aria-hidden":!0}),t[6]=f):f=t[6];let p;t[7]===r.addWorkflow?p=t[8]:(p=(0,$.jsx)(N,{asChild:!0,variant:`primary`,className:`h-9 rounded-lg`,children:(0,$.jsxs)(l,{to:`/workflows/new`,children:[f,r.addWorkflow]})}),t[7]=r.addWorkflow,t[8]=p);let m;t[9]!==r.refresh||t[10]!==a||t[11]!==u?(m=(0,$.jsx)(ae,{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]=m):m=t[12];let h;return t[13]!==d||t[14]!==p||t[15]!==m?(h=(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:[d,p,m]}),t[13]=d,t[14]=p,t[15]=m,t[16]=h):h=t[16],h}var Tn=new Set([`failed`,`timeout`,`cancelled`]),En=[{id:`runs`,icon:nt},{id:`library`,icon:Ee}],Dn={failed:0,timeout:0,cancelled:0,running:1,queued:2,succeeded:3};function On(e){return Tn.has(e.status)}function kn(e,t){return t===`all`?!0:t===`attention`?On(e):e.status===t}function An(e){return[...e].sort((e,t)=>{let n=(Dn[e.status]??4)-(Dn[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 jn(e,t){return e===`Home`?`runs`:e===`End`?`library`:e===`ArrowLeft`||e===`ArrowRight`?t===`runs`?`library`:`runs`:null}function Mn(){let e=(0,Q.c)(2),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,$.jsx)(F,{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)(F,{className:`h-4 w-52 max-w-full`}),(0,$.jsx)(F,{className:`mt-2 h-3 w-36 max-w-full`})]}),(0,$.jsx)(F,{className:`hidden h-8 w-20 rounded-lg sm:block`})]}),e[1]=n):n=e[1],n}function Nn(e){let t=(0,Q.c)(27),{vm:n}=e,{language:r,localeTag:i,labels:a,hasToken:o,definitions:s,projectPresetDefinitionIds:c,runs:l,searchQuery:u,setSearchQuery:d,workflowFilterId:f,setWorkflowFilterId:p,triggerFilter:m,setTriggerFilter:h,statusFilter:g,setStatusFilter:_,clearRunFilters:v,pageTab:x,setPageTab:S,runLayout:C,setRunLayout:w,openRunDetails:T,openRunInChat:D,openDefinitionDetails:O,openWorkflowEditor:k,startWorkflow:A,actionError:M,loading:P,error:F,cancelRun:I,retryRun:L}=n,R=ct(Ln),z=ct(In),B=Date.now(),V=An(l.filter(On)),H;t[0]===g?H=t[1]:(H=e=>kn(e,g),t[0]=g,t[1]=H);let U=An(Zt(l,{searchQuery:u,workflowFilterId:f,triggerFilter:m}).filter(H)),W=!!(u||f||m!==`all`||g!==`all`),G,K;if(t[2]!==z||t[3]!==o||t[4]!==a.title||t[5]!==R||t[6]!==n?(G=()=>{if(!o){z();return}return R({startExtra:null,main:(0,$.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:a.title}),end:(0,$.jsx)(wn,{vm:n})}),()=>z()},K=[z,o,a.title,R,n],t[2]=z,t[3]=o,t[4]=a.title,t[5]=R,t[6]=n,t[7]=G,t[8]=K):(G=t[7],K=t[8]),(0,Z.useLayoutEffect)(G,K),!o){let e;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(ve,{className:`size-10 text-accent-fg`,"aria-hidden":!0}),t[9]=e):e=t[9];let n;t[10]===a.title?n=t[11]:(n=(0,$.jsx)(`h1`,{className:`mt-4 text-xl font-semibold text-fg`,children:a.title}),t[10]=a.title,t[11]=n);let r;t[12]===a.needToken?r=t[13]:(r=(0,$.jsx)(`p`,{className:`mt-2 max-w-md text-sm leading-6 text-fg-muted`,children:a.needToken}),t[12]=a.needToken,t[13]=r);let i;return t[14]!==n||t[15]!==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[14]=n,t[15]=r,t[16]=i):i=t[16],i}let q=a.pageTabsAria,ee=En.map(e=>{let{id:t,icon:n}=e;return(0,$.jsxs)(`button`,{id:`workflow-tab-${t}`,type:`button`,role:`tab`,"aria-selected":x===t,"aria-controls":`workflow-panel-${t}`,tabIndex:x===t?0:-1,draggable:!1,className:j(`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-[0.98] motion-reduce:transition-none motion-reduce:active:scale-100`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,x===t?`bg-accent-soft text-accent-fg`:`text-fg-muted hover:bg-surface-hover hover:text-fg`),onClick:()=>S(t),onKeyDown:e=>{let n=jn(e.key,t);n&&(e.preventDefault(),S(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`&&V.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:V.length}):null]},t)}),te;t[17]!==a.pageTabsAria||t[18]!==ee?(te=(0,$.jsx)(`nav`,{className:`-mx-1 flex gap-1 overflow-x-auto px-1 pb-1`,"aria-label":q,role:`tablist`,children:ee}),t[17]=a.pageTabsAria,t[18]=ee,t[19]=te):te=t[19];let ne;t[20]!==M||t[21]!==F?(ne=M??F?(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:M??F}):null,t[20]=M,t[21]=F,t[22]=ne):ne=t[22];let re=x===`runs`?(0,$.jsxs)(`div`,{id:`workflow-panel-runs`,role:`tabpanel`,"aria-labelledby":`workflow-tab-runs`,className:`flex flex-col gap-4 py-4`,children:[V.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)(be,{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:V.length})]}),(0,$.jsxs)(`p`,{className:`mt-1 truncate text-xs text-fg-muted`,children:[Jt(V[0]),` · `,nn(V[0].completedAtMs??V[0].createdAtMs,B,i)]})]})]}),(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2 pl-7 lg:pl-0`,children:[(0,$.jsx)(N,{type:`button`,variant:`secondary`,className:`h-8 rounded-lg text-xs`,onClick:()=>T(V[0]),children:a.attentionView}),(0,$.jsx)(N,{type:`button`,variant:`primary`,className:`h-8 rounded-lg text-xs`,onClick:()=>void L(V[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)(at,{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:j(`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`,De.focusRingPanel)})]}),(0,$.jsx)(y,{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)(b,{value:e,children:a.runStatuses[e]},e))}),(0,$.jsxs)(y,{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)(b,{value:`all`,children:a.boardTriggerFilterAll}),(0,$.jsx)(b,{value:`automation`,children:a.boardTriggerFilterAutomation}),(0,$.jsx)(b,{value:`webui`,children:a.boardTriggerFilterWebui}),(0,$.jsx)(b,{value:`chat`,children:a.boardTriggerFilterChat}),(0,$.jsx)(b,{value:`api`,children:a.boardTriggerFilterApi})]}),(0,$.jsxs)(y,{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)(b,{value:``,children:a.boardWorkflowFilterAll}),s.map(Fn)]}),W?(0,$.jsxs)(N,{type:`button`,variant:`ghost`,className:`h-9 rounded-lg text-xs`,onClick:v,children:[(0,$.jsx)(E,{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:j(`inline-flex h-8 items-center gap-1.5 rounded-md px-2.5 text-xs font-medium transition-colors`,C===`list`?`bg-surface-panel text-fg shadow-surface`:`text-fg-muted hover:text-fg`,De.focusRingPanel),"aria-pressed":C===`list`,onClick:()=>w(`list`),children:[(0,$.jsx)(xe,{className:`size-3.5`,"aria-hidden":!0}),a.runLayouts.list]}),(0,$.jsxs)(`button`,{type:`button`,className:j(`inline-flex h-8 items-center gap-1.5 rounded-md px-2.5 text-xs font-medium transition-colors`,C===`board`?`bg-surface-panel text-fg shadow-surface`:`text-fg-muted hover:text-fg`,De.focusRingPanel),"aria-pressed":C===`board`,onClick:()=>w(`board`),children:[(0,$.jsx)(lt,{className:`size-3.5`,"aria-hidden":!0}),a.runLayouts.board]})]})]})}),C===`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,$.jsx)(`h2`,{id:`workflow-runs-heading`,className:`text-sm font-semibold text-fg`,children:a.allRuns}),(0,$.jsx)(`span`,{className:`rounded-full bg-surface-muted px-2 py-0.5 text-xs font-semibold tabular-nums text-fg-muted`,children:U.length})]}),P&&U.length===0?Array.from({length:4}).map(Pn):U.length>0?U.map(e=>(0,$.jsx)(Cn,{run:e,language:r,localeTag:i,nowMs:B,onOpen:T,onOpenChat:D,onCancel:e=>void I(e),onRetry:e=>void L(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)(ve,{className:`size-8 text-fg-subtle`,"aria-hidden":!0}),(0,$.jsx)(`h3`,{className:`mt-3 text-sm font-semibold text-fg`,children:W?a.noRunResultsTitle:a.noRunsTitle}),(0,$.jsx)(`p`,{className:`mt-1 max-w-md text-xs leading-5 text-fg-muted`,children:W?a.noRunResultsHint:a.noRunsStartHint}),(0,$.jsx)(N,{type:`button`,variant:W?`secondary`:`primary`,className:`mt-4 h-9 rounded-lg text-xs`,onClick:W?v:()=>S(`library`),children:W?a.clearFilters:a.chooseWorkflow})]})]}):(0,$.jsx)(`div`,{className:`h-[min(72vh,48rem)] min-h-[24rem] w-full sm:min-h-[28rem]`,children:(0,$.jsx)(pn,{runs:U,language:r,localeTag:i,labels:{boardEmptyTitle:a.boardEmptyTitle,boardEmptyHint:a.boardEmptyHint,boardStart:a.chooseWorkflow,loading:a.loading},searchQuery:``,workflowFilterId:``,triggerFilter:`all`,selectedRunId:null,loading:P,onOpenRun:T,onOpenRunChat:D,onCancelRun:e=>void I(e),onRetryRun:e=>void L(e),onStart:()=>S(`library`)})})]}):(0,$.jsx)(`section`,{id:`workflow-panel-library`,role:`tabpanel`,"aria-labelledby":`workflow-tab-library`,className:`py-5`,children:(0,$.jsx)(yn,{definitions:s,runs:l,language:r,projectPresetDefinitionIds:c,onPick:A,onDetail:O,onEdit:k})}),ie;return t[23]!==ne||t[24]!==re||t[25]!==te?(ie=(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:[te,ne,re]})}),t[23]=ne,t[24]=re,t[25]=te,t[26]=ie):ie=t[26],ie}function Pn(e,t){return(0,$.jsx)(Mn,{},t)}function Fn(e){return(0,$.jsx)(b,{value:e.id,children:e.title},e.id)}function In(e){return e.clearPageHeader}function Ln(e){return e.setPageHeader}function Rn(){let e=(0,Q.c)(131),t=k(Wn),n;e[0]===t?n=e[1]:(n=O(t),e[0]=t,e[1]=n);let r=n.workflows,i=t===`zh`?`zh-CN`:`en-US`,s=A(Un),c=!!s,l=a(),[u,d]=o(),f;e[2]===u?f=e[3]:(f=u.get(`q`)??``,e[2]=u,e[3]=f);let p=f,m;e[4]===u?m=e[5]:(m=u.get(`wf`)?.trim()??``,e[4]=u,e[5]=m);let h=m,g;e[6]===u?g=e[7]:(g=u.get(`trigger`)?.trim()||`all`,e[6]=u,e[7]=g);let _=g,v,y,b,x,S;if(e[8]!==u){let t=u.get(`status`)?.trim()??``,n=u.get(`tab`)?.trim()??``,r=u.get(`layout`)?.trim()??``;v=u.get(`agent`)?.trim()??``,b=u.get(`projectId`)?.trim()||void 0,y=yt.has(n)?n:`runs`,x=U.has(r)?r:`list`,S=ee.has(t)?t:`all`,e[8]=u,e[9]=v,e[10]=y,e[11]=b,e[12]=x,e[13]=S}else v=e[9],y=e[10],b=e[11],x=e[12],S=e[13];let C=S,[w,T]=(0,Z.useState)(null),E;e[14]!==c||e[15]!==s?(E=c?[`workflow-agents`,s]:null,e[14]=c,e[15]=s,e[16]=E):E=e[16];let D;e[17]===Symbol.for(`react.memo_cache_sentinel`)?(D={revalidateOnFocus:!1},e[17]=D):D=e[17];let j=M(E,st,D),N;bb0:{let e=j.data?.agents??[];if(v&&(e.length===0||e.some(e=>e.id===v))){N=v;break bb0}N=j.data?.defaultId}let P=N,F;e[18]!==c||e[19]!==s?(F=c?[`workflow-definitions`,s]:null,e[18]=c,e[19]=s,e[20]=F):F=e[20];let I;e[21]===Symbol.for(`react.memo_cache_sentinel`)?(I={revalidateOnFocus:!1},e[21]=I):I=e[21];let L=M(F,xt,I),R;e[22]!==c||e[23]!==b||e[24]!==s?(R=c&&b?[`workflow-project-presets`,s,b]:null,e[22]=c,e[23]=b,e[24]=s,e[25]=R):R=e[25];let z;e[26]===b?z=e[27]:(z=()=>mt(b),e[26]=b,e[27]=z);let B;e[28]===Symbol.for(`react.memo_cache_sentinel`)?(B={revalidateOnFocus:!1},e[28]=B):B=e[28];let V=M(R,z,B),H;e[29]!==c||e[30]!==P||e[31]!==b||e[32]!==s?(H=c&&P?[`workflow-runs`,s,P,b??``]:null,e[29]=c,e[30]=P,e[31]=b,e[32]=s,e[33]=H):H=e[33];let W;e[34]!==P||e[35]!==b?(W=()=>vt(100,{ownerAgentId:P,projectId:b}),e[34]=P,e[35]=b,e[36]=W):W=e[36];let K;e[37]===Symbol.for(`react.memo_cache_sentinel`)?(K={revalidateOnFocus:!1,refreshInterval:Vn},e[37]=K):K=e[37];let q=M(H,W,K),te;e[38]===L.data?te=e[39]:(te=L.data??[],e[38]=L.data,e[39]=te);let ne=te,re;e[40]===q.data?re=e[41]:(re=q.data??[],e[40]=q.data,e[41]=re);let ie=re,ae;e[42]===d?ae=e[43]:(ae=e=>{d(t=>{let n=new URLSearchParams(t);return e(n),n},{replace:!0})},e[42]=d,e[43]=ae);let J=ae,oe;e[44]===J?oe=e[45]:(oe=e=>J(t=>{let n=e.trim();n?t.set(`q`,n):t.delete(`q`)}),e[44]=J,e[45]=oe);let se=oe,ce;e[46]===J?ce=e[47]:(ce=e=>J(t=>{let n=e.trim();n?t.set(ht,n):t.delete(ht)}),e[46]=J,e[47]=ce);let le=ce,Y;e[48]===J?Y=e[49]:(Y=e=>J(t=>{let n=e.trim();n?t.set(`wf`,n):t.delete(`wf`)}),e[48]=J,e[49]=Y);let ue=Y,de;e[50]===J?de=e[51]:(de=e=>J(t=>{e&&e!==`all`?t.set(G,e):t.delete(G)}),e[50]=J,e[51]=de);let X=de,fe;e[52]===J?fe=e[53]:(fe=e=>J(t=>{e===`runs`?t.delete(`tab`):t.set(`tab`,e)}),e[52]=J,e[53]=fe);let pe=fe,me;e[54]===J?me=e[55]:(me=e=>J(t=>{e===`list`?t.delete(ge):t.set(ge,e)}),e[54]=J,e[55]=me);let he=me,ve;e[56]===J?ve=e[57]:(ve=e=>J(t=>{e===`all`?t.delete(ye):t.set(ye,e)}),e[56]=J,e[57]=ve);let be=ve,xe;e[58]===J?xe=e[59]:(xe=()=>J(Bn),e[58]=J,e[59]=xe);let Se=xe,Ce;if(e[60]!==P||e[61]!==b){let t=new URLSearchParams;P&&t.set(`agentId`,P),b&&t.set(`projectId`,b),Ce=t.size?`?${t.toString()}`:``,e[60]=P,e[61]=b,e[62]=Ce}else Ce=e[62];let we=Ce,Te;e[63]!==l||e[64]!==we?(Te=e=>l(`/workflows/${e.id}${we}`),e[63]=l,e[64]=we,e[65]=Te):Te=e[65];let Ee=Te,De=Ee,Oe;e[66]!==l||e[67]!==we?(Oe=e=>{let t=new URLSearchParams(we.slice(1));e.metadata.source!==`user`&&t.set(`copy`,e.id),l(e.metadata.source===`user`?`/workflows/${e.id}/edit${we}`:`/workflows/new${t.size?`?${t.toString()}`:``}`)},e[66]=l,e[67]=we,e[68]=Oe):Oe=e[68];let ke=Oe,Ae;e[69]!==l||e[70]!==we?(Ae=e=>l(`/workflows/runs/${e.id}${we}`),e[69]=l,e[70]=we,e[71]=Ae):Ae=e[71];let je=Ae,Ne;e[72]===l?Ne=e[73]:(Ne=e=>{let t=Wt(e);t&&l(Ue(t))},e[72]=l,e[73]=Ne);let Pe=Ne,Fe;e[74]!==r.cancelFailed||e[75]!==P||e[76]!==q?(Fe=async e=>{try{await Me(e,{ownerAgentId:P}),await q.mutate()}catch(e){let t=e;T(t instanceof Error?t.message:r.cancelFailed)}},e[74]=r.cancelFailed,e[75]=P,e[76]=q,e[77]=Fe):Fe=e[77];let Ie=Fe,Le;e[78]!==r.retryFailed||e[79]!==l||e[80]!==P||e[81]!==we?(Le=async e=>{try{l(`/workflows/runs/${(await _e(e,{ownerAgentId:P})).runId}${we}`)}catch(e){let t=e;T(t instanceof Error?t.message:r.retryFailed)}},e[78]=r.retryFailed,e[79]=l,e[80]=P,e[81]=we,e[82]=Le):Le=e[82];let Re=Le,ze,Be;e[83]===q?(ze=e[84],Be=e[85]):(ze=()=>{let e=()=>void q.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)}},Be=[q],e[83]=q,e[84]=ze,e[85]=Be),(0,Z.useEffect)(ze,Be);let Ve;e[86]!==j||e[87]!==L||e[88]!==V||e[89]!==q?(Ve=()=>{Promise.all([j.mutate(),L.mutate(),V.mutate(),q.mutate()])},e[86]=j,e[87]=L,e[88]=V,e[89]=q,e[90]=Ve):Ve=e[90];let He=Ve,We=j.isLoading||L.isLoading||q.isLoading||V.isLoading,Ge=j.error?.message??L.error?.message??q.error?.message??V.error?.message??null,Ke;e[91]===j.data?.agents?Ke=e[92]:(Ke=j.data?.agents??[],e[91]=j.data?.agents,e[92]=Ke);let qe;e[93]===V.data?qe=e[94]:(qe=new Set((V.data??[]).map(zn)),e[93]=V.data,e[94]=qe);let Je;return e[95]!==w||e[96]!==Ie||e[97]!==Se||e[98]!==ne||e[99]!==Ge||e[100]!==c||e[101]!==r||e[102]!==t||e[103]!==We||e[104]!==i||e[105]!==Ee||e[106]!==je||e[107]!==Pe||e[108]!==ke||e[109]!==P||e[110]!==y||e[111]!==b||e[112]!==He||e[113]!==Re||e[114]!==x||e[115]!==ie||e[116]!==p||e[117]!==le||e[118]!==pe||e[119]!==he||e[120]!==se||e[121]!==be||e[122]!==X||e[123]!==ue||e[124]!==De||e[125]!==C||e[126]!==Ke||e[127]!==qe||e[128]!==_||e[129]!==h?(Je={language:t,localeTag:i,labels:r,hasToken:c,searchQuery:p,setSearchQuery:se,ownerAgentId:P,projectId:b,agentOptions:Ke,setOwnerAgentId:le,workflowFilterId:h,setWorkflowFilterId:ue,triggerFilter:_,setTriggerFilter:X,statusFilter:C,setStatusFilter:be,clearRunFilters:Se,pageTab:y,setPageTab:pe,runLayout:x,setRunLayout:he,definitions:ne,projectPresetDefinitionIds:qe,runs:ie,openDefinitionDetails:Ee,startWorkflow:De,openWorkflowEditor:ke,openRunDetails:je,openRunInChat:Pe,actionError:w,loading:We,error:Ge,refreshAll:He,cancelRun:Ie,retryRun:Re},e[95]=w,e[96]=Ie,e[97]=Se,e[98]=ne,e[99]=Ge,e[100]=c,e[101]=r,e[102]=t,e[103]=We,e[104]=i,e[105]=Ee,e[106]=je,e[107]=Pe,e[108]=ke,e[109]=P,e[110]=y,e[111]=b,e[112]=He,e[113]=Re,e[114]=x,e[115]=ie,e[116]=p,e[117]=le,e[118]=pe,e[119]=he,e[120]=se,e[121]=be,e[122]=X,e[123]=ue,e[124]=De,e[125]=C,e[126]=Ke,e[127]=qe,e[128]=_,e[129]=h,e[130]=Je):Je=e[130],Je}function zn(e){return e.definitionId}function Bn(e){e.delete(`q`),e.delete(`wf`),e.delete(G),e.delete(ye)}function Vn(e){return e?.some(Hn)?3e3:0}function Hn(e){return e.status===`queued`||e.status===`running`}function Un(e){return e.token}function Wn(e){return e.language}function Gn(){let e=(0,Q.c)(2),t=Rn(),n;return e[0]===t?n=e[1]:(n=(0,$.jsx)(Nn,{vm:t}),e[0]=t,e[1]=n),n}function Kn(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,examplePrompts:e.metadata.examplePrompts,i18n:e.metadata.i18n,permissions:e.permissions,resources:e.resources,connectors:e.connectors}}function qn(e){let t=(0,Q.c)(3),n;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=wt(),t[0]=n):n=t[0];let r=n,i;return t[1]===e?i=t[2]:(i=(0,$.jsx)(Tt,{...e,language:r}),t[1]=e,t[2]=i),i}function Jn({initialSource:e,resetKey:t,fileName:n,language:r,readOnly:i=!0,error:a,onChange:o,allowImport:s=!1,className:c=`h-[28rem]`}){let l=Yn(r),u=P(e=>e.resolved)===`dark`,[d,f]=(0,Z.useState)(e),[p,m]=(0,Z.useState)(0),[h,g]=(0,Z.useState)(!1),[_,y]=(0,Z.useState)(null),b=(0,Z.useRef)(null),x=(0,Z.useRef)(null),S=(0,Z.useRef)(null),w=(0,Z.useRef)(e);w.current=e,(0,Z.useEffect)(()=>{f(w.current),m(e=>e+1)},[t]),(0,Z.useEffect)(()=>{let e=e=>{let t=S.current;t&&y(Xn(t.startHeight+e.clientY-t.startY))},t=()=>{S.current=null,document.body.style.removeProperty(`cursor`),document.body.style.removeProperty(`user-select`)};return window.addEventListener(`pointermove`,e),window.addEventListener(`pointerup`,t),window.addEventListener(`pointercancel`,t),()=>{window.removeEventListener(`pointermove`,e),window.removeEventListener(`pointerup`,t),window.removeEventListener(`pointercancel`,t),t()}},[]);let T=e=>{b.current&&(e.preventDefault(),S.current={startY:e.clientY,startHeight:b.current.getBoundingClientRect().height},document.body.style.cursor=`row-resize`,document.body.style.userSelect=`none`)},E=e=>{e.key!==`ArrowUp`&&e.key!==`ArrowDown`||(e.preventDefault(),y(Xn((_??b.current?.getBoundingClientRect().height??448)+(e.key===`ArrowDown`?24:-24))))},O=e=>{f(e),o?.(e)};return(0,$.jsxs)(`section`,{ref:b,className:`relative flex min-h-0 flex-col overflow-hidden rounded-xl border border-edge bg-surface-base ${c}`,style:_===null?void 0:{height:_,minHeight:280,flex:`none`},children:[(0,$.jsxs)(`header`,{className:`flex shrink-0 flex-wrap items-center gap-2 border-b border-edge bg-surface-panel px-3 py-2`,children:[(0,$.jsxs)(`div`,{className:`mr-auto flex items-center gap-2 text-xs text-fg-muted`,children:[(0,$.jsx)(se,{className:`size-3.5`,"aria-hidden":!0}),(0,$.jsx)(`span`,{children:l.title}),(0,$.jsx)(`span`,{className:a?`text-danger`:`text-success`,children:a?l.invalid:l.valid})]}),i?null:(0,$.jsx)(N,{type:`button`,variant:`ghost`,className:`h-8 px-2 text-xs`,disabled:!!a,onClick:()=>{try{O(`${JSON.stringify(JSON.parse(d),null,2)}\n`),m(e=>e+1)}catch{}},children:l.format}),s?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`input`,{ref:x,type:`file`,accept:`application/json,.json`,className:`hidden`,onChange:e=>{let t=e.target.files?.[0];e.target.value=``,t&&t.text().then(e=>{O(e),m(e=>e+1)})}}),(0,$.jsxs)(N,{type:`button`,variant:`ghost`,className:`h-8 px-2 text-xs`,onClick:()=>x.current?.click(),children:[(0,$.jsx)(me,{className:`size-3.5`,"aria-hidden":!0}),l.import]})]}):null,(0,$.jsxs)(N,{type:`button`,variant:`ghost`,className:`h-8 px-2 text-xs`,onClick:()=>void D(d).then(e=>{e&&(g(!0),window.setTimeout(()=>g(!1),1500))}),children:[h?(0,$.jsx)(v,{className:`size-3.5`,"aria-hidden":!0}):(0,$.jsx)(I,{className:`size-3.5`,"aria-hidden":!0}),h?l.copied:l.copy]}),(0,$.jsxs)(N,{type:`button`,variant:`ghost`,className:`h-8 px-2 text-xs`,onClick:()=>{let e=URL.createObjectURL(new Blob([d],{type:`application/json;charset=utf-8`})),t=document.createElement(`a`);t.href=e,t.download=n,t.click(),URL.revokeObjectURL(e)},children:[(0,$.jsx)(C,{className:`size-3.5`,"aria-hidden":!0}),l.download]})]}),a?(0,$.jsx)(`div`,{className:`shrink-0 border-b border-danger/25 bg-danger/5 px-4 py-2 text-xs text-danger`,children:a}):null,(0,$.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,$.jsx)(qn,{initialContent:d,onChange:O,isDark:u,readOnly:i,lineWrap:!1},`${t}:${p}`)}),(0,$.jsx)(`div`,{role:`separator`,"aria-orientation":`horizontal`,"aria-label":l.resize,title:l.resize,tabIndex:0,className:`group absolute inset-x-0 bottom-0 z-10 flex h-3 touch-none cursor-row-resize items-end justify-center border-t border-transparent outline-none hover:border-accent/40 focus:border-accent/40`,onPointerDown:T,onKeyDown:E,onDoubleClick:()=>y(null),children:(0,$.jsx)(`span`,{className:`mb-1 h-0.5 w-10 rounded-full bg-edge-strong transition-colors group-hover:bg-accent group-focus:bg-accent`})})]})}function Yn(e){return e===`zh`?{title:`工作流定义 · JSON`,valid:`有效`,invalid:`需要修复`,format:`格式化`,copy:`复制`,copied:`已复制`,download:`下载`,import:`导入`,resize:`上下拖动调整源码区域高度`}:{title:`Workflow definition · JSON`,valid:`Valid`,invalid:`Needs attention`,format:`Format`,copy:`Copy`,copied:`Copied`,download:`Download`,import:`Import`,resize:`Drag vertically to resize the source area`}}function Xn(e){let t=typeof window>`u`?960:Math.max(280,window.innerHeight-96);return Math.min(t,Math.max(280,Math.round(e)))}function Zn(e){return Qn(e.name,e.graph,Kn(e))}function Qn(e,t,n){return{formatVersion:1,name:e,manifest:structuredClone(n),graph:structuredClone(t)}}function $n(e){return Qn(e.name,e.graph,{title:e.title,description:e.description,version:e.version,defaults:e.defaults,tags:e.tags,estimatedAgents:e.estimatedAgents,permissions:e.permissions,resources:e.resources,connectors:e.connectors,inputSchema:e.inputSchema,outputSchema:e.outputSchema,whenToUse:e.whenToUse,examplePrompts:e.examplePrompts,i18n:e.i18n})}function er(e,t){let n=lr(e),r=lr(t);if(n.length*r.length>25e4)return ur(n,r);let i=Array.from({length:n.length+1},()=>new Uint32Array(r.length+1));for(let e=n.length-1;e>=0;--e)for(let t=r.length-1;t>=0;--t)i[e][t]=n[e]===r[t]?i[e+1][t+1]+1:Math.max(i[e+1][t],i[e][t+1]);let a=[],o=0,s=0;for(;o<n.length&&s<r.length;)n[o]===r[s]?(a.push({kind:`same`,beforeLine:o+1,afterLine:s+1,text:n[o]}),o+=1,s+=1):i[o+1][s]>=i[o][s+1]?(a.push({kind:`removed`,beforeLine:o+1,text:n[o]}),o+=1):(a.push({kind:`added`,afterLine:s+1,text:r[s]}),s+=1);for(;o<n.length;)a.push({kind:`removed`,beforeLine:++o,text:n[o-1]});for(;s<r.length;)a.push({kind:`added`,afterLine:++s,text:r[s-1]});return a}function tr(e){return`${JSON.stringify(e,null,2)}\n`}function nr(e){let t;try{t=JSON.parse(e)}catch(e){return{ok:!1,error:e instanceof Error?e.message:`Invalid JSON.`}}if(!or(t))return cr(`The source root must be a JSON object.`);if(t.formatVersion!==1)return cr(`formatVersion must be 1.`);if(typeof t.name!=`string`||!/^[a-z][a-z0-9_-]*$/.test(t.name))return cr(`name must use lowercase letters, numbers, underscores, or hyphens.`);if(!or(t.manifest))return cr(`manifest must be an object.`);let n=rr(t.manifest);if(n)return cr(n);if(!or(t.graph))return cr(`graph must be an object.`);if(t.graph.schemaVersion!==1)return cr(`graph.schemaVersion must be 1.`);if(!Array.isArray(t.graph.nodes))return cr(`graph.nodes must be an array.`);if(!Array.isArray(t.graph.edges))return cr(`graph.edges must be an array.`);for(let[e,n]of t.graph.nodes.entries()){let t=ir(n,e);if(t)return cr(t)}for(let[e,n]of t.graph.edges.entries()){let t=ar(n,e);if(t)return cr(t)}return{ok:!0,document:t}}function rr(e){for(let t of[`title`,`description`,`version`,`whenToUse`])if(e[t]!==void 0&&typeof e[t]!=`string`)return`manifest.${t} must be a string.`;return e.tags!==void 0&&(!Array.isArray(e.tags)||e.tags.some(e=>typeof e!=`string`))?`manifest.tags must be an array of strings.`:e.defaults!==void 0&&!or(e.defaults)?`manifest.defaults must be an object.`:null}function ir(e,t){return or(e)?typeof e.id!=`string`||!e.id?`graph.nodes[${t}].id must be a non-empty string.`:[`input`,`agent`,`decision`,`merge`,`output`].includes(String(e.kind))?typeof e.title==`string`?!or(e.position)||!sr(e.position.x)||!sr(e.position.y)?`graph.nodes[${t}].position must contain finite x and y values.`:or(e.config)?null:`graph.nodes[${t}].config must be an object.`:`graph.nodes[${t}].title must be a string.`:`graph.nodes[${t}].kind is invalid.`:`graph.nodes[${t}] must be an object.`}function ar(e,t){if(!or(e))return`graph.edges[${t}] must be an object.`;for(let n of[`id`,`source`,`target`])if(typeof e[n]!=`string`||!e[n])return`graph.edges[${t}].${n} must be a non-empty string.`;return e.sourcePort!==void 0&&![`true`,`false`,`default`].includes(String(e.sourcePort))?`graph.edges[${t}].sourcePort is invalid.`:null}function or(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function sr(e){return typeof e==`number`&&Number.isFinite(e)}function cr(e){return{ok:!1,error:e}}function lr(e){let t=e.split(`
|
|
1
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{c as i,d as a,h as o,l as s,p as c,t as l}from"./chunk-KS7C4IRE-Cq1tE_3b.js";import{a as u,c as d,i as f,n as p,o as m,r as h,s as g,t as _}from"./dist-CpzYSoz7.js";import{t as v}from"./check-DUBLcKHA.js";import{n as y,r as b,t as x}from"./popover-select-CKBYnT3c.js";import{t as S}from"./copy-Dv6d4Dvw.js";import{t as C}from"./download-Dk-ZjtO6.js";import{t as w}from"./markdown-view-D-FLW0dt.js";import{t as T}from"./plus-Q2yW6OE7.js";import{t as E}from"./x-B_N4OPjy.js";import{t as D}from"./copy-to-clipboard-HOJ79TWv.js";import{t as O}from"./messages-CIDIpI4Y.js";import{n as k,s as A}from"./locale-store-CHtOF1kO.js";import{t as j}from"./cn-JdwAhgNB.js";import{i as M}from"./vendor-swr-BIWyz7Rc.js";import{t as N}from"./button-B11EPpor.js";import{i as P}from"./theme-store-CyYxQYpT.js";import{t as F}from"./skeleton-BwbyijEw.js";import{$l as I,A as L,Ac as R,Al as z,Au as B,Bl as V,C as H,Cr as U,D as W,Dr as G,E as K,Ec as q,Er as ee,Fr as te,Fs as ne,Gl as re,Hc as ie,Hi as ae,Hs as J,Ir as oe,Ll as se,Lr as ce,Mr as le,Nn as Y,Ns as ue,O as de,Pl as X,Pr as fe,Rr as pe,Rs as me,S as he,Sr as ge,T as _e,Tl as ve,Tr as ye,Vs as be,Xc as xe,_ as Se,_c as Ce,_r as we,_u as Te,al as Ee,as as De,b as Oe,br as ke,ca as Ae,cr as je,d as Me,da as Ne,dr as Pe,en as Fe,f as Ie,fr as Le,fu as Re,g as ze,gr as Be,h as Ve,hc as He,hr as Ue,i as We,ir as Ge,iu as Ke,jr as qe,k as Je,kr as Ye,ll as Xe,lr as Ze,m as Qe,ml as $e,mr as et,nc as tt,nl as nt,or as rt,p as it,pc as at,pr as ot,rn as st,ro as ct,sl as lt,sr as ut,u as dt,ur as ft,uu as pt,v as mt,vr as ht,w as gt,wr as _t,x as vt,xr as yt,xu as bt,y as xt,yl as St,yu as Ct}from"./index-pmcvQ5pq.js";import{l as wt}from"./vendor-codemirror-DFxP3B9T.js";import{t as Tt}from"./code-editor-CXIH8jQw.js";import{t as Et}from"./page-tabs-CXo5GsOJ.js";import{n as Dt,t as Ot}from"./tab-completion-input-D64VNmiA.js";import{i as kt,r as At,t as jt}from"./workflow-run-setup-panel-C7a3xXM2.js";import{t as Mt}from"./tab-completion-input.utils-BP3NH_du.js";import{a as Nt,c as Pt,i as Ft,l as It,n as Lt,o as Rt,r as zt,s as Bt,t as Vt}from"./style-TIDOdKy0.js";var Z=e(t(),1),Q=n(),Ht=[`queued`,`running`,`succeeded`,`attention`],Ut=new Set([`failed`,`timeout`,`cancelled`]);function Wt(e){return e.metadata?.sessionKey?.trim()||null}function Gt(e,t){return e.length<=t?e:`${e.slice(0,t-1)}…`}function Kt(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 qt(e,t=90){let n=e.metadata?.input?.goal?.trim()||(typeof e.metadata?.input?.payload==`string`?e.metadata.input.payload.trim():null)||Kt(e.metadata?.input?.payload,[`query`,`goal`,`prompt`,`input`,`message`])||Kt(e.metadata?.input?.variables,[`query`,`goal`,`prompt`,`input`,`message`]);return n?Gt(n,t):null}function Jt(e,t=90){return qt(e,t)??Gt(e.title?.trim()||e.definitionId,t)}function Yt(e,t=44){return Gt(e.title?.trim()||e.definitionId,t)}function Xt(e,t){let n=t.trim().toLowerCase();return n?[qt(e,500),e.title,e.definitionId,e.id].filter(Boolean).join(` `).toLowerCase().includes(n):!0}function Zt(e,t){let n=t.workflowFilterId.trim();return e.filter(e=>n&&e.definitionId!==n||!ot(e,t.triggerFilter??`all`)?!1:Xt(e,t.searchQuery))}function Qt(e){return e.completedAtMs??e.createdAtMs}function $t(e,t){return e.status===`queued`?`queued`:e.status===`running`?`running`:e.status===`succeeded`?`succeeded`:Ut.has(e.status)?`attention`:null}function en(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)=>Qt(t)-Qt(e))}function tn(e,t){let n={queued:[],running:[],succeeded:[],attention:[]};for(let r of e){let e=$t(r,t);e&&n[e].push(r)}return Ht.map(e=>{if(e===`succeeded`){let t=en(`succeeded`,n.succeeded);return{id:e,runs:t,totalInWindow:t.length}}return{id:e,runs:en(e,n[e])}})}function nn(e,t,n){let r=Math.round((t-e)/1e3);if(r<60)return le(-r,`second`,n);let i=Math.round(r/60);if(i<60)return le(-i,`minute`,n);let a=Math.round(i/60);return a<48?le(-a,`hour`,n):le(-Math.round(a/24),`day`,n)}function rn(e){return e.status===`queued`||e.status===`running`}function an(e){return e.status===`failed`||e.status===`timeout`||e.status===`cancelled`}var $=r(),on=(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:l,onRetry:u}=e,d=O(r).workflows,[f,p]=(0,Z.useState)(!1),m;t[0]===n?m=t[1]:(m=Wt(n),t[0]=n,t[1]=m);let h=!m,g;t[2]===n?g=t[3]:(g=rn(n),t[2]=n,t[3]=g);let _=g,v=n.status===`running`||n.status===`queued`,y;t[4]!==n.metrics.agentCount||t[5]!==n.metrics.doneAgentCount?(y=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]=y):y=t[6];let b=y,x=n.metrics.errorAgentCount>0,S=n.startedAtMs??n.createdAtMs,C=je(_?a-S:n.metrics.durationMs),w=ft(d.taskArtifacts,{count:n.metrics.artifactCount}),T;t[7]===n?T=t[8]:(T=Jt(n),t[7]=n,t[8]=T);let E=T,D;t[9]===n?D=t[10]:(D=Yt(n),t[9]=n,t[10]=D);let k=D,A;t[11]!==s||t[12]!==n?(A=()=>{s(n)},t[11]=s,t[12]=n,t[13]=A):A=t[13];let M=A,P;t[14]!==h||t[15]!==c||t[16]!==n?(P=()=>{h||c(n)},t[14]=h,t[15]=c,t[16]=n,t[17]=P):P=t[17];let F=P,I=o&&`ring-1 ring-accent/30`,L;t[18]===I?L=t[19]:(L=j(`group relative min-h-24 overflow-hidden rounded-lg bg-surface-panel p-3 shadow-surface transition-colors`,I,`hover:bg-surface-hover`),t[18]=I,t[19]=L);let R;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(R=j(`w-full text-left`,De.focusRingPanel),t[20]=R):R=t[20];let z;t[21]===E?z=t[22]:(z=(0,$.jsx)(`div`,{className:`line-clamp-2 text-sm font-medium leading-5 text-fg`,children:E}),t[21]=E,t[22]=z);let B;t[23]===k?B=t[24]:(B=(0,$.jsx)(`div`,{className:`mt-1 truncate text-[11px] font-medium text-fg-muted`,children:k}),t[23]=k,t[24]=B);let H;t[25]!==z||t[26]!==B?(H=(0,$.jsxs)(`div`,{className:`min-w-0`,children:[z,B]}),t[25]=z,t[26]=B,t[27]=H):H=t[27];let U;t[28]===n.status?U=t[29]:(U=j(`shrink-0 rounded-full px-2 py-0.5 text-[10px] font-semibold shadow-sm`,et(n.status)),t[28]=n.status,t[29]=U);let W;t[30]!==i||t[31]!==a||t[32]!==S?(W=nn(S,a,i),t[30]=i,t[31]=a,t[32]=S,t[33]=W):W=t[33];let G;t[34]===W?G=t[35]:(G=(0,$.jsx)(`span`,{children:W}),t[34]=W,t[35]=G);let K=C===`—`?null:(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`span`,{"aria-hidden":!0,children:`·`}),(0,$.jsx)(`span`,{children:ft(d.taskElapsed,{duration:C})})]}),q;t[36]!==G||t[37]!==K?(q=(0,$.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-1.5 text-[11px] text-fg-subtle`,children:[G,K]}),t[36]=G,t[37]=K,t[38]=q):q=t[38];let ee=n.metrics.artifactCount>0?(0,$.jsx)(`span`,{className:`rounded-full bg-surface-hover px-2 py-0.5 font-medium text-fg-muted`,children:w}):null,te=o?(0,$.jsx)(`span`,{className:`font-medium text-accent-fg`,children:d.taskOpenDetails}):null,ne;t[39]!==ee||t[40]!==te?(ne=(0,$.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-2 text-[11px] text-fg-subtle`,children:[ee,te]}),t[39]=ee,t[40]=te,t[41]=ne):ne=t[41];let re=h&&`cursor-not-allowed text-fg-disabled hover:bg-transparent`,ie;t[42]===re?ie=t[43]:(ie=j(`rounded-md px-2 py-1 text-xs font-medium`,`text-accent-fg hover:bg-accent-soft`,De.focusRingPanel,re),t[42]=re,t[43]=ie);let ae;t[44]!==h||t[45]!==F||t[46]!==d.continueInChat||t[47]!==ie?(ae=(0,$.jsx)(`button`,{type:`button`,className:ie,disabled:h,onClick:F,children:d.continueInChat}),t[44]=h,t[45]=F,t[46]=d.continueInChat,t[47]=ie,t[48]=ae):ae=t[48];let J;t[49]===Symbol.for(`react.memo_cache_sentinel`)?(J=j(`rounded-md px-2 py-1 text-xs font-medium text-fg-muted hover:bg-surface-hover hover:text-fg`,De.focusRingPanel),t[49]=J):J=t[49];let oe;t[50]!==M||t[51]!==d.taskOpenDetails?(oe=(0,$.jsx)(`button`,{type:`button`,className:J,onClick:M,children:d.taskOpenDetails}),t[50]=M,t[51]=d.taskOpenDetails,t[52]=oe):oe=t[52];let se;t[53]!==ae||t[54]!==oe?(se=(0,$.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-2 border-t border-edge-subtle pt-2`,children:[ae,oe]}),t[53]=ae,t[54]=oe,t[55]=se):se=t[55];let ce;t[56]===p?ce=t[57]:(ce=()=>p(cn),t[56]=p,t[57]=ce);let le;t[58]===Symbol.for(`react.memo_cache_sentinel`)?(le=(0,$.jsx)(V,{className:`size-4`,"aria-hidden":!0}),t[58]=le):le=t[58];let Y;t[59]!==d.taskActionsAria||t[60]!==f||t[61]!==ce?(Y=(0,$.jsx)(N,{variant:`ghost`,className:`size-7 p-0 opacity-0 group-hover:opacity-100 group-focus-within:opacity-100`,"aria-label":d.taskActionsAria,"aria-expanded":f,onClick:ce,children:le}),t[59]=d.taskActionsAria,t[60]=f,t[61]=ce,t[62]=Y):Y=t[62];let ue;t[63]!==_||t[64]!==d.cancel||t[65]!==d.rerun||t[66]!==d.taskCloseMenu||t[67]!==f||t[68]!==l||t[69]!==u||t[70]!==n||t[71]!==p?(ue=f?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`button`,{type:`button`,className:`fixed inset-0 z-10 cursor-default`,"aria-label":d.taskCloseMenu,onClick:()=>p(!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:[_?(0,$.jsx)(sn,{label:d.cancel,tone:`danger`,onClick:()=>{p(!1),l(n.id)}}):null,an(n)?(0,$.jsx)(sn,{label:d.rerun,onClick:()=>{p(!1),u(n.id)}}):null]})]}):null,t[63]=_,t[64]=d.cancel,t[65]=d.rerun,t[66]=d.taskCloseMenu,t[67]=f,t[68]=l,t[69]=u,t[70]=n,t[71]=p,t[72]=ue):ue=t[72];let de;return t[73]!==Y||t[74]!==ue?(de=(0,$.jsxs)(`div`,{className:`absolute right-2 top-2`,children:[Y,ue]}),t[73]=Y,t[74]=ue,t[75]=de):de=t[75],(0,$.jsxs)(`div`,{className:L,children:[(0,$.jsxs)(`button`,{type:`button`,onClick:M,"aria-label":`${d.taskOpenDetails}: ${E}`,"aria-current":o?`true`:void 0,className:R,children:[(0,$.jsxs)(`div`,{className:`pr-7`,children:[(0,$.jsxs)(`div`,{className:`flex min-w-0 items-start justify-between gap-2`,children:[H,(0,$.jsx)(`span`,{className:U,children:d.status[n.status]??n.status})]}),q]}),v?(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:ft(d.agentProgress,{done:n.metrics.doneAgentCount,total:n.metrics.agentCount})}),(0,$.jsxs)(`span`,{children:[b,`%`]})]}),(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:`${b}%`}})})]}):null,ne,x?(0,$.jsxs)(`div`,{className:`mt-2 flex items-center gap-1 text-[11px] text-amber-700 dark:text-amber-300`,children:[(0,$.jsx)(be,{className:`size-3 shrink-0`,"aria-hidden":!0}),ft(d.runRowErrorSummary,{count:n.metrics.errorAgentCount})]}):null]}),se,de]})});function sn(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=j(`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 l;return t[3]!==r||t[4]!==n||t[5]!==a||t[6]!==c?(l=(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]=l):l=t[7],l}function cn(e){return!e}function ln(e,t){return t.boardColumns[e]}var un=(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:l,onCancelRun:u,onRetryRun:d}=e,f=O(r).workflows,[p,m]=(0,Z.useState)(!1),h=n.id===`succeeded`,g=h?5:n.runs.length,_;t[0]!==g||t[1]!==n.runs||t[2]!==p||t[3]!==h?(_=h&&!p?n.runs.slice(0,g):n.runs,t[0]=g,t[1]=n.runs,t[2]=p,t[3]=h,t[4]=_):_=t[4];let v=_,y=h&&n.runs.length>5&&!p,b=h&&p,x;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(x=j(`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]=x):x=t[5];let S;t[6]===n.runs.length?S=t[7]:(S=(0,$.jsx)(`span`,{className:`shrink-0 text-xs text-fg-subtle`,children:n.runs.length}),t[6]=n.runs.length,t[7]=S);let C;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,$.jsx)(V,{className:`size-4 shrink-0 text-fg-subtle`,"aria-hidden":!0}),t[8]=C):C=t[8];let w=s&&v.length===0?(0,$.jsx)(dn,{}):v.length===0?(0,$.jsx)(`div`,{className:`rounded-lg bg-surface-panel/70 px-3 py-6 text-center text-xs text-fg-subtle`,children:f.boardColumnEmpty}):v.map(e=>(0,$.jsx)(on,{run:e,language:r,localeTag:i,nowMs:a,selected:e.id===o,onOpen:c,onOpenChat:l,onCancel:u,onRetry:d},e.id)),T=y?(0,$.jsx)(N,{variant:`ghost`,className:`h-8 w-full text-xs`,onClick:()=>m(!0),children:ft(f.boardExpandSucceeded,{count:Math.min(n.runs.length,n.totalInWindow??n.runs.length)})}):null,E;t[9]!==b||t[10]!==f||t[11]!==m?(E=b?(0,$.jsx)(N,{variant:`ghost`,className:`h-8 w-full text-xs`,onClick:()=>m(!1),children:f.boardCollapseSucceeded}):null,t[9]=b,t[10]=f,t[11]=m,t[12]=E):E=t[12];let D;return t[13]!==w||t[14]!==T||t[15]!==E?(D=(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:[w,T,E]}),t[13]=w,t[14]=T,t[15]=E,t[16]=D):D=t[16],(0,$.jsxs)(`section`,{className:x,"aria-label":ln(n.id,f),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:ln(n.id,f)}),S]}),C]}),D]})});function dn(){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)(F,{className:`size-4/5`}),(0,$.jsx)(F,{className:`mt-2 h-3 w-24`})]}),(0,$.jsx)(F,{className:`h-5 w-14 rounded-full`})]}),(0,$.jsx)(F,{className:`mt-3 h-3 w-2/3`}),(0,$.jsx)(F,{className:`mt-4 h-5 w-20 rounded-full`})]}),e[0]=t):t=e[0],t}function fn(e){return e instanceof Element?!!e.closest(`a,button,input,select,textarea,[contenteditable="true"],[draggable="true"],[data-board-pan-skip="true"]`):!0}var pn=(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(mn),t[0]=n,t[1]=g);let _=g,v=(0,Z.useRef)(null),y=(0,Z.useRef)(null),[b,x]=(0,Z.useState)(hn),[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=tn(Zt(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(gn,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||fn(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,P;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(P=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]=P):P=t[13];let F=P;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)(N,{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 I=S?`cursor-grabbing select-none`:`cursor-grab`,L;t[25]===I?L=t[26]:(L=[`min-h-0 h-full min-w-0 overflow-x-auto rounded-lg p-2`,I],t[25]=I,t[26]=L);let R=L.join(` `),z;t[27]===Symbol.for(`react.memo_cache_sentinel`)?(z=e=>{y.current?.pointerId===e.pointerId&&(y.current=null,C(!1))},t[27]=z):z=t[27];let B;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)(un,{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],B=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]=B}else B=t[38];let V;t[49]===B?V=t[50]:(V=(0,$.jsx)(`div`,{className:`flex min-h-full min-w-max items-start gap-3 pr-4`,children:B}),t[49]=B,t[50]=V);let H;return t[51]!==R||t[52]!==V?(H=(0,$.jsx)(`div`,{ref:v,className:R,onPointerDown:M,onPointerMove:F,onPointerUp:A,onPointerCancel:A,onLostPointerCapture:z,children:V}),t[51]=R,t[52]=V,t[53]=H):H=t[53],H});function mn(e){return e.status===`queued`||e.status===`running`}function hn(){return Date.now()}function gn(e,t){return e+t.runs.length}function _n(e,t){let n=e.metadata.estimatedAgents;return n?n.min===n.max?ft(t.agentScaleExact,{count:n.min}):ft(t.agentScaleRange,{min:n.min,max:n.max}):null}function vn(e){let t=(0,Q.c)(77),{definition:n,language:r,labels:i,onPick:a,onDetail:o,onEdit:s,savedForProject:c}=e,l;t[0]!==n||t[1]!==r?(l=Ye(n,r),t[0]=n,t[1]=r,t[2]=l):l=t[2];let u=l,d;t[3]!==n||t[4]!==i?(d=_n(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=j(`rounded-full px-2 py-0.5 text-[10px] font-medium`,m),t[6]=m,t[7]=h);let g=p?i.badgeUser:i.badgeBuiltin,_;t[8]!==h||t[9]!==g?(_=(0,$.jsx)(`span`,{className:h,children:g}),t[8]=h,t[9]=g,t[10]=_):_=t[10];let v;t[11]!==n.inputSchema||t[12]!==i.inputSchemaBadge?(v=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)(Te,{className:`size-2.5`,"aria-hidden":!0}),i.inputSchemaBadge]}):null,t[11]=n.inputSchema,t[12]=i.inputSchemaBadge,t[13]=v):v=t[13];let y;t[14]!==i.projectWorkflowBadge||t[15]!==c?(y=c?(0,$.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded-full bg-success-soft px-2 py-0.5 text-[10px] text-success`,children:[(0,$.jsx)(bt,{className:`size-2.5`,"aria-hidden":!0}),i.projectWorkflowBadge]}):null,t[14]=i.projectWorkflowBadge,t[15]=c,t[16]=y):y=t[16];let b;t[17]!==_||t[18]!==v||t[19]!==y?(b=(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[_,v,y]}),t[17]=_,t[18]=v,t[19]=y,t[20]=b):b=t[20];let x;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(x=j(`mt-2 line-clamp-2 text-left text-sm font-semibold leading-5 text-fg hover:text-accent-fg`,De.focusRingPanel),t[21]=x):x=t[21];let S;t[22]!==n||t[23]!==o?(S=()=>o(n),t[22]=n,t[23]=o,t[24]=S):S=t[24];let C;t[25]!==n.title||t[26]!==S?(C=(0,$.jsx)(`button`,{type:`button`,className:x,onClick:S,children:n.title}),t[25]=n.title,t[26]=S,t[27]=C):C=t[27];let w;t[28]!==C||t[29]!==b?(w=(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[b,C]}),t[28]=C,t[29]=b,t[30]=w):w=t[30];let T=`${p?i.editWorkflow:i.copyAndEditWorkflow}: ${n.title}`,E;t[31]!==n||t[32]!==s?(E=()=>s(n),t[31]=n,t[32]=s,t[33]=E):E=t[33];let D;t[34]===p?D=t[35]:(D=p?(0,$.jsx)(R,{className:`size-3.5`,"aria-hidden":!0}):(0,$.jsx)(re,{className:`size-3.5`,"aria-hidden":!0}),t[34]=p,t[35]=D);let O;t[36]!==T||t[37]!==E||t[38]!==D?(O=(0,$.jsx)(N,{type:`button`,variant:`ghost`,className:`size-8 shrink-0 p-0`,"aria-label":T,onClick:E,children:D}),t[36]=T,t[37]=E,t[38]=D,t[39]=O):O=t[39];let k;t[40]!==w||t[41]!==O?(k=(0,$.jsxs)(`div`,{className:`flex min-w-0 items-start justify-between gap-3`,children:[w,O]}),t[40]=w,t[41]=O,t[42]=k):k=t[42];let A=u.whenToUse||u.description||n.description,M;t[43]===A?M=t[44]:(M=(0,$.jsx)(`p`,{className:`mt-2 line-clamp-2 text-xs leading-5 text-fg-muted`,children:A}),t[43]=A,t[44]=M);let P;t[45]===Symbol.for(`react.memo_cache_sentinel`)?(P=(0,$.jsx)(Xe,{className:`size-3`,"aria-hidden":!0}),t[45]=P):P=t[45];let F;t[46]!==n.phases.length||t[47]!==i.phaseCount?(F=ft(i.phaseCount,{count:n.phases.length}),t[46]=n.phases.length,t[47]=i.phaseCount,t[48]=F):F=t[48];let I;t[49]===F?I=t[50]:(I=(0,$.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[P,F]}),t[49]=F,t[50]=I);let L;t[51]===f?L=t[52]:(L=f?(0,$.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,$.jsx)(ne,{className:`size-3`,"aria-hidden":!0}),f]}):null,t[51]=f,t[52]=L);let z;t[53]!==I||t[54]!==L?(z=(0,$.jsxs)(`div`,{className:`mt-auto flex flex-wrap items-center gap-3 pt-4 text-[11px] text-fg-subtle`,children:[I,L]}),t[53]=I,t[54]=L,t[55]=z):z=t[55];let B;t[56]!==n||t[57]!==a?(B=()=>a(n),t[56]=n,t[57]=a,t[58]=B):B=t[58];let V;t[59]===Symbol.for(`react.memo_cache_sentinel`)?(V=(0,$.jsx)(q,{className:`size-3.5`,"aria-hidden":!0}),t[59]=V):V=t[59];let H;t[60]!==i.configureAndRun||t[61]!==B?(H=(0,$.jsxs)(N,{type:`button`,variant:`secondary`,className:`h-8 flex-1 rounded-lg text-xs`,onClick:B,children:[V,i.configureAndRun]}),t[60]=i.configureAndRun,t[61]=B,t[62]=H):H=t[62];let U;t[63]!==n||t[64]!==o?(U=()=>o(n),t[63]=n,t[64]=o,t[65]=U):U=t[65];let W;t[66]!==i.viewDetails||t[67]!==U?(W=(0,$.jsx)(N,{type:`button`,variant:`secondary`,className:`h-8 rounded-lg text-xs`,onClick:U,children:i.viewDetails}),t[66]=i.viewDetails,t[67]=U,t[68]=W):W=t[68];let G;t[69]!==H||t[70]!==W?(G=(0,$.jsxs)(`div`,{className:`mt-3 flex items-center gap-2 border-t border-edge-subtle pt-3`,children:[H,W]}),t[69]=H,t[70]=W,t[71]=G):G=t[71];let K;return t[72]!==k||t[73]!==M||t[74]!==z||t[75]!==G?(K=(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:[k,M,z,G]}),t[72]=k,t[73]=M,t[74]=z,t[75]=G,t[76]=K):K=t[76],K}function yn(e){let t=(0,Q.c)(45),{definitions:n,runs:r,language:i,projectPresetDefinitionIds:a,onPick:o,onDetail:s,onEdit:c}=e,[l]=(0,Z.useState)(Sn),u=O(i).workflows,d=i===`zh`?`zh-CN`:`en-US`,[f,p]=(0,Z.useState)(``),[m,h]=(0,Z.useState)(`all`),[g,_]=(0,Z.useState)(`all`),v;t[0]!==m||t[1]!==n||t[2]!==f||t[3]!==g?(v=ut(n,f,m,g),t[0]=m,t[1]=n,t[2]=f,t[3]=g,t[4]=v):v=t[4];let x=v,S;if(t[5]!==n||t[6]!==r){let e=new Map(n.map(xn)),i=new Set;S=[...r].sort(bn).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]=S}else S=t[7];let C=S,w=ft(u.workflowCount,{count:x.length}),T;t[8]===w?T=t[9]:(T=(0,$.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:w}),t[8]=w,t[9]=T);let E=u.sourceFilterAria,D;t[10]!==u.sources||t[11]!==_||t[12]!==g?(D=_t.map(e=>(0,$.jsx)(`button`,{type:`button`,className:j(`h-8 rounded-md px-2.5 text-xs font-medium transition-colors`,g===e?`bg-surface-base text-fg shadow-surface`:`text-fg-muted hover:text-fg`,De.focusRingPanel),"aria-pressed":g===e,onClick:()=>_(e),children:u.sources[e]},e)),t[10]=u.sources,t[11]=_,t[12]=g,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":E,children:D}),t[14]=u.sourceFilterAria,t[15]=D,t[16]=k):k=t[16];let A=u.categoryFilterAria,M;t[17]===h?M=t[18]:(M=e=>h(e.target.value),t[17]=h,t[18]=M);let N;t[19]===u.categories?N=t[20]:(N=ke.map(e=>(0,$.jsx)(b,{value:e,children:u.categories[e]},e)),t[19]=u.categories,t[20]=N);let P;t[21]!==m||t[22]!==u.categoryFilterAria||t[23]!==M||t[24]!==N?(P=(0,$.jsx)(y,{value:m,"aria-label":A,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]=m,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 I;t[29]===Symbol.for(`react.memo_cache_sentinel`)?(I=(0,$.jsx)(at,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-subtle`,"aria-hidden":!0}),t[29]=I):I=t[29];let L;t[30]===p?L=t[31]:(L=e=>p(e.target.value),t[30]=p,t[31]=L);let R=u.librarySearchPlaceholder,z;t[32]===Symbol.for(`react.memo_cache_sentinel`)?(z=j(`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`,De.focusRingPanel),t[32]=z):z=t[32];let B;t[33]!==u.librarySearchPlaceholder||t[34]!==f||t[35]!==L?(B=(0,$.jsxs)(`div`,{className:`relative max-w-xl`,children:[I,(0,$.jsx)(`input`,{value:f,onChange:L,placeholder:R,className:z})]}),t[33]=u.librarySearchPlaceholder,t[34]=f,t[35]=L,t[36]=B):B=t[36];let V;return t[37]!==x||t[38]!==u||t[39]!==i||t[40]!==s||t[41]!==c||t[42]!==o||t[43]!==a?(V=x.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:x.map(e=>(0,$.jsx)(vn,{definition:e,language:i,labels:u,savedForProject:a?.has(e.id)??!1,onPick:o,onDetail:s,onEdit:c},e.id))}),t[37]=x,t[38]=u,t[39]=i,t[40]=s,t[41]=c,t[42]=o,t[43]=a,t[44]=V):V=t[44],(0,$.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-5`,children:[C.length>0&&!f&&m===`all`&&g===`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:C.map(e=>{let{definition:t,lastRunAtMs:n}=e;return(0,$.jsxs)(`button`,{type:`button`,className:j(`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`,De.focusRingPanel),onClick:()=>o(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:nn(n,l,d)})]}),(0,$.jsx)(q,{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}),T]}),F]}),B]}),V]})]})}function bn(e,t){return(t.startedAtMs??t.createdAtMs)-(e.startedAtMs??e.createdAtMs)}function xn(e){return[e.id,e]}function Sn(){return Date.now()}var Cn=(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:l}=e,u,d,f,p,m,h,g,_,v,y,b,x,S,C,w,T,E;if(t[0]!==r||t[1]!==i||t[2]!==a||t[3]!==o||t[4]!==n){f=O(r).workflows;let e;t[22]===n?e=t[23]:(e=rn(n),t[22]=n,t[23]=e),u=e;let s;t[24]===n?s=t[25]:(s=an(n),t[24]=n,t[25]=s),p=s;let c;t[26]===n?c=t[27]:(c=Wt(n),t[26]=n,t[27]=c),d=!!c;let l=n.startedAtMs??n.createdAtMs,D=je(u?a-l:n.metrics.durationMs),k;t[28]!==n.metrics.agentCount||t[29]!==n.metrics.doneAgentCount?(k=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]=k):k=t[30];let A=k;v=`group border-b border-edge-subtle last:border-b-0`,_=`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`,T=`button`,t[31]!==o||t[32]!==n?(E=()=>o(n),t[31]=o,t[32]=n,t[33]=E):E=t[33],t[34]===Symbol.for(`react.memo_cache_sentinel`)?(h=j(`min-w-0 flex-1 text-left`,De.focusRingPanel),t[34]=h):h=t[34];let M=f.taskOpenDetails,N;t[35]===n?N=t[36]:(N=Jt(n),t[35]=n,t[36]=N),g=`${M}: ${N}`,C=`flex min-w-0 items-start gap-3`;let P;t[37]===n.status?P=t[38]:(P=j(`mt-0.5 shrink-0 rounded-full px-2 py-0.5 text-[10px] font-semibold`,et(n.status)),t[37]=n.status,t[38]=P),w=(0,$.jsx)(`span`,{className:P,children:f.status[n.status]??n.status}),m=`min-w-0 flex-1`;let F;t[39]===n?F=t[40]:(F=Jt(n),t[39]=n,t[40]=F),t[41]===F?y=t[42]:(y=(0,$.jsx)(`span`,{className:`block truncate text-sm font-medium text-fg`,children:F}),t[41]=F,t[42]=y);let I;t[43]===n?I=t[44]:(I=Yt(n),t[43]=n,t[44]=I);let L;t[45]===I?L=t[46]:(L=(0,$.jsx)(`span`,{className:`truncate font-medium`,children:I}),t[45]=I,t[46]=L);let R;t[47]===Symbol.for(`react.memo_cache_sentinel`)?(R=(0,$.jsx)(`span`,{"aria-hidden":!0,children:`·`}),t[47]=R):R=t[47];let z;t[48]!==i||t[49]!==a||t[50]!==l?(z=nn(l,a,i),t[48]=i,t[49]=a,t[50]=l,t[51]=z):z=t[51];let B;t[52]===z?B=t[53]:(B=(0,$.jsx)(`span`,{children:z}),t[52]=z,t[53]=B);let V=D===`—`?null:(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`span`,{"aria-hidden":!0,children:`·`}),(0,$.jsx)(`span`,{children:ft(f.taskElapsed,{duration:D})})]});t[54]!==L||t[55]!==B||t[56]!==V?(b=(0,$.jsxs)(`span`,{className:`mt-1 flex flex-wrap items-center gap-x-2 gap-y-1 text-xs text-fg-muted`,children:[L,R,B,V]}),t[54]=L,t[55]=B,t[56]=V,t[57]=b):b=t[57],x=u&&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:ft(f.agentProgress,{done:n.metrics.doneAgentCount,total:n.metrics.agentCount})}),(0,$.jsxs)(`span`,{className:`tabular-nums`,children:[A,`%`]})]}),(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:`${A}%`}})})]}):null,S=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)(be,{className:`size-3 shrink-0`,"aria-hidden":!0}),ft(f.runRowErrorSummary,{count:n.metrics.errorAgentCount})]}):null,t[0]=r,t[1]=i,t[2]=a,t[3]=o,t[4]=n,t[5]=u,t[6]=d,t[7]=f,t[8]=p,t[9]=m,t[10]=h,t[11]=g,t[12]=_,t[13]=v,t[14]=y,t[15]=b,t[16]=x,t[17]=S,t[18]=C,t[19]=w,t[20]=T,t[21]=E}else u=t[5],d=t[6],f=t[7],p=t[8],m=t[9],h=t[10],g=t[11],_=t[12],v=t[13],y=t[14],b=t[15],x=t[16],S=t[17],C=t[18],w=t[19],T=t[20],E=t[21];let D;t[58]!==m||t[59]!==y||t[60]!==b||t[61]!==x||t[62]!==S?(D=(0,$.jsxs)(`span`,{className:m,children:[y,b,x,S]}),t[58]=m,t[59]=y,t[60]=b,t[61]=x,t[62]=S,t[63]=D):D=t[63];let k;t[64]!==D||t[65]!==C||t[66]!==w?(k=(0,$.jsxs)(`div`,{className:C,children:[w,D]}),t[64]=D,t[65]=C,t[66]=w,t[67]=k):k=t[67];let A;t[68]!==h||t[69]!==g||t[70]!==k||t[71]!==T||t[72]!==E?(A=(0,$.jsx)(`button`,{type:T,onClick:E,className:h,"aria-label":g,children:k}),t[68]=h,t[69]=g,t[70]=k,t[71]=T,t[72]=E,t[73]=A):A=t[73];let M;t[74]!==f.rerun||t[75]!==l||t[76]!==p||t[77]!==n.id?(M=p?(0,$.jsx)(N,{type:`button`,variant:`primary`,className:`h-8 rounded-lg text-xs`,onClick:()=>l(n.id),children:f.rerun}):null,t[74]=f.rerun,t[75]=l,t[76]=p,t[77]=n.id,t[78]=M):M=t[78];let P;t[79]!==d||t[80]!==f.continueInChat||t[81]!==s||t[82]!==n?(P=n.status===`succeeded`&&d?(0,$.jsx)(N,{type:`button`,variant:`secondary`,className:`h-8 rounded-lg text-xs`,onClick:()=>s(n),children:f.continueInChat}):null,t[79]=d,t[80]=f.continueInChat,t[81]=s,t[82]=n,t[83]=P):P=t[83];let F;t[84]!==u||t[85]!==f.cancel||t[86]!==c||t[87]!==n.id?(F=u?(0,$.jsx)(N,{type:`button`,variant:`ghost`,className:`h-8 rounded-lg text-xs text-red-600 dark:text-red-300`,onClick:()=>c(n.id),children:f.cancel}):null,t[84]=u,t[85]=f.cancel,t[86]=c,t[87]=n.id,t[88]=F):F=t[88];let I;t[89]!==o||t[90]!==n?(I=()=>o(n),t[89]=o,t[90]=n,t[91]=I):I=t[91];let L;t[92]===Symbol.for(`react.memo_cache_sentinel`)?(L=(0,$.jsx)(pt,{className:`size-4`,"aria-hidden":!0}),t[92]=L):L=t[92];let R;t[93]!==f.taskOpenDetails||t[94]!==I?(R=(0,$.jsx)(N,{type:`button`,variant:`ghost`,className:`size-8 p-0`,"aria-label":f.taskOpenDetails,onClick:I,children:L}),t[93]=f.taskOpenDetails,t[94]=I,t[95]=R):R=t[95];let z;t[96]!==M||t[97]!==P||t[98]!==F||t[99]!==R?(z=(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center justify-end gap-1.5 pl-7 lg:pl-0`,children:[M,P,F,R]}),t[96]=M,t[97]=P,t[98]=F,t[99]=R,t[100]=z):z=t[100];let B;t[101]!==_||t[102]!==A||t[103]!==z?(B=(0,$.jsxs)(`div`,{className:_,children:[A,z]}),t[101]=_,t[102]=A,t[103]=z,t[104]=B):B=t[104];let V;return t[105]!==v||t[106]!==B?(V=(0,$.jsx)(`article`,{className:v,children:B}),t[105]=v,t[106]=B,t[107]=V):V=t[107],V});function wn(e){let t=(0,Q.c)(17),{vm:n}=e,{labels:r,language:i,loading:a,ownerAgentId:o,agentOptions:s,setOwnerAgentId:c,refreshAll:u}=n,d;t[0]!==s||t[1]!==r.agentFilterAria||t[2]!==i||t[3]!==o||t[4]!==c?(d=s.length>1?(0,$.jsx)(y,{value:o??``,"aria-label":r.agentFilterAria,onChange:e=>c(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:s.map(e=>(0,$.jsx)(b,{value:e.id,children:Fe(e,O(i).agentsSettings)},e.id))}):null,t[0]=s,t[1]=r.agentFilterAria,t[2]=i,t[3]=o,t[4]=c,t[5]=d):d=t[5];let f;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,$.jsx)(T,{className:`size-4`,"aria-hidden":!0}),t[6]=f):f=t[6];let p;t[7]===r.addWorkflow?p=t[8]:(p=(0,$.jsx)(N,{asChild:!0,variant:`primary`,className:`h-9 rounded-lg`,children:(0,$.jsxs)(l,{to:`/workflows/new`,children:[f,r.addWorkflow]})}),t[7]=r.addWorkflow,t[8]=p);let m;t[9]!==r.refresh||t[10]!==a||t[11]!==u?(m=(0,$.jsx)(ae,{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]=m):m=t[12];let h;return t[13]!==d||t[14]!==p||t[15]!==m?(h=(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:[d,p,m]}),t[13]=d,t[14]=p,t[15]=m,t[16]=h):h=t[16],h}var Tn=new Set([`failed`,`timeout`,`cancelled`]),En=[{id:`runs`,icon:nt},{id:`library`,icon:Ee}],Dn={failed:0,timeout:0,cancelled:0,running:1,queued:2,succeeded:3};function On(e){return Tn.has(e.status)}function kn(e,t){return t===`all`?!0:t===`attention`?On(e):e.status===t}function An(e){return[...e].sort((e,t)=>{let n=(Dn[e.status]??4)-(Dn[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 jn(e,t){return e===`Home`?`runs`:e===`End`?`library`:e===`ArrowLeft`||e===`ArrowRight`?t===`runs`?`library`:`runs`:null}function Mn(){let e=(0,Q.c)(2),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,$.jsx)(F,{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)(F,{className:`h-4 w-52 max-w-full`}),(0,$.jsx)(F,{className:`mt-2 h-3 w-36 max-w-full`})]}),(0,$.jsx)(F,{className:`hidden h-8 w-20 rounded-lg sm:block`})]}),e[1]=n):n=e[1],n}function Nn(e){let t=(0,Q.c)(27),{vm:n}=e,{language:r,localeTag:i,labels:a,hasToken:o,definitions:s,projectPresetDefinitionIds:c,runs:l,searchQuery:u,setSearchQuery:d,workflowFilterId:f,setWorkflowFilterId:p,triggerFilter:m,setTriggerFilter:h,statusFilter:g,setStatusFilter:_,clearRunFilters:v,pageTab:x,setPageTab:S,runLayout:C,setRunLayout:w,openRunDetails:T,openRunInChat:D,openDefinitionDetails:O,openWorkflowEditor:k,startWorkflow:A,actionError:M,loading:P,error:F,cancelRun:I,retryRun:L}=n,R=ct(Ln),z=ct(In),B=Date.now(),V=An(l.filter(On)),H;t[0]===g?H=t[1]:(H=e=>kn(e,g),t[0]=g,t[1]=H);let U=An(Zt(l,{searchQuery:u,workflowFilterId:f,triggerFilter:m}).filter(H)),W=!!(u||f||m!==`all`||g!==`all`),G,K;if(t[2]!==z||t[3]!==o||t[4]!==a.title||t[5]!==R||t[6]!==n?(G=()=>{if(!o){z();return}return R({startExtra:null,main:(0,$.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:a.title}),end:(0,$.jsx)(wn,{vm:n})}),()=>z()},K=[z,o,a.title,R,n],t[2]=z,t[3]=o,t[4]=a.title,t[5]=R,t[6]=n,t[7]=G,t[8]=K):(G=t[7],K=t[8]),(0,Z.useLayoutEffect)(G,K),!o){let e;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(ve,{className:`size-10 text-accent-fg`,"aria-hidden":!0}),t[9]=e):e=t[9];let n;t[10]===a.title?n=t[11]:(n=(0,$.jsx)(`h1`,{className:`mt-4 text-xl font-semibold text-fg`,children:a.title}),t[10]=a.title,t[11]=n);let r;t[12]===a.needToken?r=t[13]:(r=(0,$.jsx)(`p`,{className:`mt-2 max-w-md text-sm leading-6 text-fg-muted`,children:a.needToken}),t[12]=a.needToken,t[13]=r);let i;return t[14]!==n||t[15]!==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[14]=n,t[15]=r,t[16]=i):i=t[16],i}let q=a.pageTabsAria,ee=En.map(e=>{let{id:t,icon:n}=e;return(0,$.jsxs)(`button`,{id:`workflow-tab-${t}`,type:`button`,role:`tab`,"aria-selected":x===t,"aria-controls":`workflow-panel-${t}`,tabIndex:x===t?0:-1,draggable:!1,className:j(`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-[0.98] motion-reduce:transition-none motion-reduce:active:scale-100`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,x===t?`bg-accent-soft text-accent-fg`:`text-fg-muted hover:bg-surface-hover hover:text-fg`),onClick:()=>S(t),onKeyDown:e=>{let n=jn(e.key,t);n&&(e.preventDefault(),S(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`&&V.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:V.length}):null]},t)}),te;t[17]!==a.pageTabsAria||t[18]!==ee?(te=(0,$.jsx)(`nav`,{className:`-mx-1 flex gap-1 overflow-x-auto px-1 pb-1`,"aria-label":q,role:`tablist`,children:ee}),t[17]=a.pageTabsAria,t[18]=ee,t[19]=te):te=t[19];let ne;t[20]!==M||t[21]!==F?(ne=M??F?(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:M??F}):null,t[20]=M,t[21]=F,t[22]=ne):ne=t[22];let re=x===`runs`?(0,$.jsxs)(`div`,{id:`workflow-panel-runs`,role:`tabpanel`,"aria-labelledby":`workflow-tab-runs`,className:`flex flex-col gap-4 py-4`,children:[V.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)(be,{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:V.length})]}),(0,$.jsxs)(`p`,{className:`mt-1 truncate text-xs text-fg-muted`,children:[Jt(V[0]),` · `,nn(V[0].completedAtMs??V[0].createdAtMs,B,i)]})]})]}),(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2 pl-7 lg:pl-0`,children:[(0,$.jsx)(N,{type:`button`,variant:`secondary`,className:`h-8 rounded-lg text-xs`,onClick:()=>T(V[0]),children:a.attentionView}),(0,$.jsx)(N,{type:`button`,variant:`primary`,className:`h-8 rounded-lg text-xs`,onClick:()=>void L(V[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)(at,{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:j(`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`,De.focusRingPanel)})]}),(0,$.jsx)(y,{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)(b,{value:e,children:a.runStatuses[e]},e))}),(0,$.jsxs)(y,{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)(b,{value:`all`,children:a.boardTriggerFilterAll}),(0,$.jsx)(b,{value:`automation`,children:a.boardTriggerFilterAutomation}),(0,$.jsx)(b,{value:`webui`,children:a.boardTriggerFilterWebui}),(0,$.jsx)(b,{value:`chat`,children:a.boardTriggerFilterChat}),(0,$.jsx)(b,{value:`api`,children:a.boardTriggerFilterApi})]}),(0,$.jsxs)(y,{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)(b,{value:``,children:a.boardWorkflowFilterAll}),s.map(Fn)]}),W?(0,$.jsxs)(N,{type:`button`,variant:`ghost`,className:`h-9 rounded-lg text-xs`,onClick:v,children:[(0,$.jsx)(E,{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:j(`inline-flex h-8 items-center gap-1.5 rounded-md px-2.5 text-xs font-medium transition-colors`,C===`list`?`bg-surface-panel text-fg shadow-surface`:`text-fg-muted hover:text-fg`,De.focusRingPanel),"aria-pressed":C===`list`,onClick:()=>w(`list`),children:[(0,$.jsx)(xe,{className:`size-3.5`,"aria-hidden":!0}),a.runLayouts.list]}),(0,$.jsxs)(`button`,{type:`button`,className:j(`inline-flex h-8 items-center gap-1.5 rounded-md px-2.5 text-xs font-medium transition-colors`,C===`board`?`bg-surface-panel text-fg shadow-surface`:`text-fg-muted hover:text-fg`,De.focusRingPanel),"aria-pressed":C===`board`,onClick:()=>w(`board`),children:[(0,$.jsx)(lt,{className:`size-3.5`,"aria-hidden":!0}),a.runLayouts.board]})]})]})}),C===`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,$.jsx)(`h2`,{id:`workflow-runs-heading`,className:`text-sm font-semibold text-fg`,children:a.allRuns}),(0,$.jsx)(`span`,{className:`rounded-full bg-surface-muted px-2 py-0.5 text-xs font-semibold tabular-nums text-fg-muted`,children:U.length})]}),P&&U.length===0?Array.from({length:4}).map(Pn):U.length>0?U.map(e=>(0,$.jsx)(Cn,{run:e,language:r,localeTag:i,nowMs:B,onOpen:T,onOpenChat:D,onCancel:e=>void I(e),onRetry:e=>void L(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)(ve,{className:`size-8 text-fg-subtle`,"aria-hidden":!0}),(0,$.jsx)(`h3`,{className:`mt-3 text-sm font-semibold text-fg`,children:W?a.noRunResultsTitle:a.noRunsTitle}),(0,$.jsx)(`p`,{className:`mt-1 max-w-md text-xs leading-5 text-fg-muted`,children:W?a.noRunResultsHint:a.noRunsStartHint}),(0,$.jsx)(N,{type:`button`,variant:W?`secondary`:`primary`,className:`mt-4 h-9 rounded-lg text-xs`,onClick:W?v:()=>S(`library`),children:W?a.clearFilters:a.chooseWorkflow})]})]}):(0,$.jsx)(`div`,{className:`h-[min(72vh,48rem)] min-h-[24rem] w-full sm:min-h-[28rem]`,children:(0,$.jsx)(pn,{runs:U,language:r,localeTag:i,labels:{boardEmptyTitle:a.boardEmptyTitle,boardEmptyHint:a.boardEmptyHint,boardStart:a.chooseWorkflow,loading:a.loading},searchQuery:``,workflowFilterId:``,triggerFilter:`all`,selectedRunId:null,loading:P,onOpenRun:T,onOpenRunChat:D,onCancelRun:e=>void I(e),onRetryRun:e=>void L(e),onStart:()=>S(`library`)})})]}):(0,$.jsx)(`section`,{id:`workflow-panel-library`,role:`tabpanel`,"aria-labelledby":`workflow-tab-library`,className:`py-5`,children:(0,$.jsx)(yn,{definitions:s,runs:l,language:r,projectPresetDefinitionIds:c,onPick:A,onDetail:O,onEdit:k})}),ie;return t[23]!==ne||t[24]!==re||t[25]!==te?(ie=(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:[te,ne,re]})}),t[23]=ne,t[24]=re,t[25]=te,t[26]=ie):ie=t[26],ie}function Pn(e,t){return(0,$.jsx)(Mn,{},t)}function Fn(e){return(0,$.jsx)(b,{value:e.id,children:e.title},e.id)}function In(e){return e.clearPageHeader}function Ln(e){return e.setPageHeader}function Rn(){let e=(0,Q.c)(131),t=k(Wn),n;e[0]===t?n=e[1]:(n=O(t),e[0]=t,e[1]=n);let r=n.workflows,i=t===`zh`?`zh-CN`:`en-US`,s=A(Un),c=!!s,l=a(),[u,d]=o(),f;e[2]===u?f=e[3]:(f=u.get(`q`)??``,e[2]=u,e[3]=f);let p=f,m;e[4]===u?m=e[5]:(m=u.get(`wf`)?.trim()??``,e[4]=u,e[5]=m);let h=m,g;e[6]===u?g=e[7]:(g=u.get(`trigger`)?.trim()||`all`,e[6]=u,e[7]=g);let _=g,v,y,b,x,S;if(e[8]!==u){let t=u.get(`status`)?.trim()??``,n=u.get(`tab`)?.trim()??``,r=u.get(`layout`)?.trim()??``;v=u.get(`agent`)?.trim()??``,b=u.get(`projectId`)?.trim()||void 0,y=yt.has(n)?n:`runs`,x=U.has(r)?r:`list`,S=ee.has(t)?t:`all`,e[8]=u,e[9]=v,e[10]=y,e[11]=b,e[12]=x,e[13]=S}else v=e[9],y=e[10],b=e[11],x=e[12],S=e[13];let C=S,[w,T]=(0,Z.useState)(null),E;e[14]!==c||e[15]!==s?(E=c?[`workflow-agents`,s]:null,e[14]=c,e[15]=s,e[16]=E):E=e[16];let D;e[17]===Symbol.for(`react.memo_cache_sentinel`)?(D={revalidateOnFocus:!1},e[17]=D):D=e[17];let j=M(E,st,D),N;bb0:{let e=j.data?.agents??[];if(v&&(e.length===0||e.some(e=>e.id===v))){N=v;break bb0}N=j.data?.defaultId}let P=N,F;e[18]!==c||e[19]!==s?(F=c?[`workflow-definitions`,s]:null,e[18]=c,e[19]=s,e[20]=F):F=e[20];let I;e[21]===Symbol.for(`react.memo_cache_sentinel`)?(I={revalidateOnFocus:!1},e[21]=I):I=e[21];let L=M(F,xt,I),R;e[22]!==c||e[23]!==b||e[24]!==s?(R=c&&b?[`workflow-project-presets`,s,b]:null,e[22]=c,e[23]=b,e[24]=s,e[25]=R):R=e[25];let z;e[26]===b?z=e[27]:(z=()=>mt(b),e[26]=b,e[27]=z);let B;e[28]===Symbol.for(`react.memo_cache_sentinel`)?(B={revalidateOnFocus:!1},e[28]=B):B=e[28];let V=M(R,z,B),H;e[29]!==c||e[30]!==P||e[31]!==b||e[32]!==s?(H=c&&P?[`workflow-runs`,s,P,b??``]:null,e[29]=c,e[30]=P,e[31]=b,e[32]=s,e[33]=H):H=e[33];let W;e[34]!==P||e[35]!==b?(W=()=>vt(100,{ownerAgentId:P,projectId:b}),e[34]=P,e[35]=b,e[36]=W):W=e[36];let K;e[37]===Symbol.for(`react.memo_cache_sentinel`)?(K={revalidateOnFocus:!1,refreshInterval:Vn},e[37]=K):K=e[37];let q=M(H,W,K),te;e[38]===L.data?te=e[39]:(te=L.data??[],e[38]=L.data,e[39]=te);let ne=te,re;e[40]===q.data?re=e[41]:(re=q.data??[],e[40]=q.data,e[41]=re);let ie=re,ae;e[42]===d?ae=e[43]:(ae=e=>{d(t=>{let n=new URLSearchParams(t);return e(n),n},{replace:!0})},e[42]=d,e[43]=ae);let J=ae,oe;e[44]===J?oe=e[45]:(oe=e=>J(t=>{let n=e.trim();n?t.set(`q`,n):t.delete(`q`)}),e[44]=J,e[45]=oe);let se=oe,ce;e[46]===J?ce=e[47]:(ce=e=>J(t=>{let n=e.trim();n?t.set(ht,n):t.delete(ht)}),e[46]=J,e[47]=ce);let le=ce,Y;e[48]===J?Y=e[49]:(Y=e=>J(t=>{let n=e.trim();n?t.set(`wf`,n):t.delete(`wf`)}),e[48]=J,e[49]=Y);let ue=Y,de;e[50]===J?de=e[51]:(de=e=>J(t=>{e&&e!==`all`?t.set(G,e):t.delete(G)}),e[50]=J,e[51]=de);let X=de,fe;e[52]===J?fe=e[53]:(fe=e=>J(t=>{e===`runs`?t.delete(`tab`):t.set(`tab`,e)}),e[52]=J,e[53]=fe);let pe=fe,me;e[54]===J?me=e[55]:(me=e=>J(t=>{e===`list`?t.delete(ge):t.set(ge,e)}),e[54]=J,e[55]=me);let he=me,ve;e[56]===J?ve=e[57]:(ve=e=>J(t=>{e===`all`?t.delete(ye):t.set(ye,e)}),e[56]=J,e[57]=ve);let be=ve,xe;e[58]===J?xe=e[59]:(xe=()=>J(Bn),e[58]=J,e[59]=xe);let Se=xe,Ce;if(e[60]!==P||e[61]!==b){let t=new URLSearchParams;P&&t.set(`agentId`,P),b&&t.set(`projectId`,b),Ce=t.size?`?${t.toString()}`:``,e[60]=P,e[61]=b,e[62]=Ce}else Ce=e[62];let we=Ce,Te;e[63]!==l||e[64]!==we?(Te=e=>l(`/workflows/${e.id}${we}`),e[63]=l,e[64]=we,e[65]=Te):Te=e[65];let Ee=Te,De=Ee,Oe;e[66]!==l||e[67]!==we?(Oe=e=>{let t=new URLSearchParams(we.slice(1));e.metadata.source!==`user`&&t.set(`copy`,e.id),l(e.metadata.source===`user`?`/workflows/${e.id}/edit${we}`:`/workflows/new${t.size?`?${t.toString()}`:``}`)},e[66]=l,e[67]=we,e[68]=Oe):Oe=e[68];let ke=Oe,Ae;e[69]!==l||e[70]!==we?(Ae=e=>l(`/workflows/runs/${e.id}${we}`),e[69]=l,e[70]=we,e[71]=Ae):Ae=e[71];let je=Ae,Ne;e[72]===l?Ne=e[73]:(Ne=e=>{let t=Wt(e);t&&l(Ue(t))},e[72]=l,e[73]=Ne);let Pe=Ne,Fe;e[74]!==r.cancelFailed||e[75]!==P||e[76]!==q?(Fe=async e=>{try{await Me(e,{ownerAgentId:P}),await q.mutate()}catch(e){let t=e;T(t instanceof Error?t.message:r.cancelFailed)}},e[74]=r.cancelFailed,e[75]=P,e[76]=q,e[77]=Fe):Fe=e[77];let Ie=Fe,Le;e[78]!==r.retryFailed||e[79]!==l||e[80]!==P||e[81]!==we?(Le=async e=>{try{l(`/workflows/runs/${(await _e(e,{ownerAgentId:P})).runId}${we}`)}catch(e){let t=e;T(t instanceof Error?t.message:r.retryFailed)}},e[78]=r.retryFailed,e[79]=l,e[80]=P,e[81]=we,e[82]=Le):Le=e[82];let Re=Le,ze,Be;e[83]===q?(ze=e[84],Be=e[85]):(ze=()=>{let e=()=>void q.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)}},Be=[q],e[83]=q,e[84]=ze,e[85]=Be),(0,Z.useEffect)(ze,Be);let Ve;e[86]!==j||e[87]!==L||e[88]!==V||e[89]!==q?(Ve=()=>{Promise.all([j.mutate(),L.mutate(),V.mutate(),q.mutate()])},e[86]=j,e[87]=L,e[88]=V,e[89]=q,e[90]=Ve):Ve=e[90];let He=Ve,We=j.isLoading||L.isLoading||q.isLoading||V.isLoading,Ge=j.error?.message??L.error?.message??q.error?.message??V.error?.message??null,Ke;e[91]===j.data?.agents?Ke=e[92]:(Ke=j.data?.agents??[],e[91]=j.data?.agents,e[92]=Ke);let qe;e[93]===V.data?qe=e[94]:(qe=new Set((V.data??[]).map(zn)),e[93]=V.data,e[94]=qe);let Je;return e[95]!==w||e[96]!==Ie||e[97]!==Se||e[98]!==ne||e[99]!==Ge||e[100]!==c||e[101]!==r||e[102]!==t||e[103]!==We||e[104]!==i||e[105]!==Ee||e[106]!==je||e[107]!==Pe||e[108]!==ke||e[109]!==P||e[110]!==y||e[111]!==b||e[112]!==He||e[113]!==Re||e[114]!==x||e[115]!==ie||e[116]!==p||e[117]!==le||e[118]!==pe||e[119]!==he||e[120]!==se||e[121]!==be||e[122]!==X||e[123]!==ue||e[124]!==De||e[125]!==C||e[126]!==Ke||e[127]!==qe||e[128]!==_||e[129]!==h?(Je={language:t,localeTag:i,labels:r,hasToken:c,searchQuery:p,setSearchQuery:se,ownerAgentId:P,projectId:b,agentOptions:Ke,setOwnerAgentId:le,workflowFilterId:h,setWorkflowFilterId:ue,triggerFilter:_,setTriggerFilter:X,statusFilter:C,setStatusFilter:be,clearRunFilters:Se,pageTab:y,setPageTab:pe,runLayout:x,setRunLayout:he,definitions:ne,projectPresetDefinitionIds:qe,runs:ie,openDefinitionDetails:Ee,startWorkflow:De,openWorkflowEditor:ke,openRunDetails:je,openRunInChat:Pe,actionError:w,loading:We,error:Ge,refreshAll:He,cancelRun:Ie,retryRun:Re},e[95]=w,e[96]=Ie,e[97]=Se,e[98]=ne,e[99]=Ge,e[100]=c,e[101]=r,e[102]=t,e[103]=We,e[104]=i,e[105]=Ee,e[106]=je,e[107]=Pe,e[108]=ke,e[109]=P,e[110]=y,e[111]=b,e[112]=He,e[113]=Re,e[114]=x,e[115]=ie,e[116]=p,e[117]=le,e[118]=pe,e[119]=he,e[120]=se,e[121]=be,e[122]=X,e[123]=ue,e[124]=De,e[125]=C,e[126]=Ke,e[127]=qe,e[128]=_,e[129]=h,e[130]=Je):Je=e[130],Je}function zn(e){return e.definitionId}function Bn(e){e.delete(`q`),e.delete(`wf`),e.delete(G),e.delete(ye)}function Vn(e){return e?.some(Hn)?3e3:0}function Hn(e){return e.status===`queued`||e.status===`running`}function Un(e){return e.token}function Wn(e){return e.language}function Gn(){let e=(0,Q.c)(2),t=Rn(),n;return e[0]===t?n=e[1]:(n=(0,$.jsx)(Nn,{vm:t}),e[0]=t,e[1]=n),n}function Kn(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,examplePrompts:e.metadata.examplePrompts,i18n:e.metadata.i18n,permissions:e.permissions,resources:e.resources,connectors:e.connectors}}function qn(e){let t=(0,Q.c)(3),n;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=wt(),t[0]=n):n=t[0];let r=n,i;return t[1]===e?i=t[2]:(i=(0,$.jsx)(Tt,{...e,language:r}),t[1]=e,t[2]=i),i}function Jn({initialSource:e,resetKey:t,fileName:n,language:r,readOnly:i=!0,error:a,onChange:o,allowImport:s=!1,className:c=`h-[28rem]`}){let l=Yn(r),u=P(e=>e.resolved)===`dark`,[d,f]=(0,Z.useState)(e),[p,m]=(0,Z.useState)(0),[h,g]=(0,Z.useState)(!1),[_,y]=(0,Z.useState)(null),b=(0,Z.useRef)(null),x=(0,Z.useRef)(null),S=(0,Z.useRef)(null),w=(0,Z.useRef)(e);w.current=e,(0,Z.useEffect)(()=>{f(w.current),m(e=>e+1)},[t]),(0,Z.useEffect)(()=>{let e=e=>{let t=S.current;t&&y(Xn(t.startHeight+e.clientY-t.startY))},t=()=>{S.current=null,document.body.style.removeProperty(`cursor`),document.body.style.removeProperty(`user-select`)};return window.addEventListener(`pointermove`,e),window.addEventListener(`pointerup`,t),window.addEventListener(`pointercancel`,t),()=>{window.removeEventListener(`pointermove`,e),window.removeEventListener(`pointerup`,t),window.removeEventListener(`pointercancel`,t),t()}},[]);let T=e=>{b.current&&(e.preventDefault(),S.current={startY:e.clientY,startHeight:b.current.getBoundingClientRect().height},document.body.style.cursor=`row-resize`,document.body.style.userSelect=`none`)},E=e=>{e.key!==`ArrowUp`&&e.key!==`ArrowDown`||(e.preventDefault(),y(Xn((_??b.current?.getBoundingClientRect().height??448)+(e.key===`ArrowDown`?24:-24))))},O=e=>{f(e),o?.(e)};return(0,$.jsxs)(`section`,{ref:b,className:`relative flex min-h-0 flex-col overflow-hidden rounded-xl border border-edge bg-surface-base ${c}`,style:_===null?void 0:{height:_,minHeight:280,flex:`none`},children:[(0,$.jsxs)(`header`,{className:`flex shrink-0 flex-wrap items-center gap-2 border-b border-edge bg-surface-panel px-3 py-2`,children:[(0,$.jsxs)(`div`,{className:`mr-auto flex items-center gap-2 text-xs text-fg-muted`,children:[(0,$.jsx)(se,{className:`size-3.5`,"aria-hidden":!0}),(0,$.jsx)(`span`,{children:l.title}),(0,$.jsx)(`span`,{className:a?`text-danger`:`text-success`,children:a?l.invalid:l.valid})]}),i?null:(0,$.jsx)(N,{type:`button`,variant:`ghost`,className:`h-8 px-2 text-xs`,disabled:!!a,onClick:()=>{try{O(`${JSON.stringify(JSON.parse(d),null,2)}\n`),m(e=>e+1)}catch{}},children:l.format}),s?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`input`,{ref:x,type:`file`,accept:`application/json,.json`,className:`hidden`,onChange:e=>{let t=e.target.files?.[0];e.target.value=``,t&&t.text().then(e=>{O(e),m(e=>e+1)})}}),(0,$.jsxs)(N,{type:`button`,variant:`ghost`,className:`h-8 px-2 text-xs`,onClick:()=>x.current?.click(),children:[(0,$.jsx)(me,{className:`size-3.5`,"aria-hidden":!0}),l.import]})]}):null,(0,$.jsxs)(N,{type:`button`,variant:`ghost`,className:`h-8 px-2 text-xs`,onClick:()=>void D(d).then(e=>{e&&(g(!0),window.setTimeout(()=>g(!1),1500))}),children:[h?(0,$.jsx)(v,{className:`size-3.5`,"aria-hidden":!0}):(0,$.jsx)(I,{className:`size-3.5`,"aria-hidden":!0}),h?l.copied:l.copy]}),(0,$.jsxs)(N,{type:`button`,variant:`ghost`,className:`h-8 px-2 text-xs`,onClick:()=>{let e=URL.createObjectURL(new Blob([d],{type:`application/json;charset=utf-8`})),t=document.createElement(`a`);t.href=e,t.download=n,t.click(),URL.revokeObjectURL(e)},children:[(0,$.jsx)(C,{className:`size-3.5`,"aria-hidden":!0}),l.download]})]}),a?(0,$.jsx)(`div`,{className:`shrink-0 border-b border-danger/25 bg-danger/5 px-4 py-2 text-xs text-danger`,children:a}):null,(0,$.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,$.jsx)(qn,{initialContent:d,onChange:O,isDark:u,readOnly:i,lineWrap:!1},`${t}:${p}`)}),(0,$.jsx)(`div`,{role:`separator`,"aria-orientation":`horizontal`,"aria-label":l.resize,title:l.resize,tabIndex:0,className:`group absolute inset-x-0 bottom-0 z-10 flex h-3 touch-none cursor-row-resize items-end justify-center border-t border-transparent outline-none hover:border-accent/40 focus:border-accent/40`,onPointerDown:T,onKeyDown:E,onDoubleClick:()=>y(null),children:(0,$.jsx)(`span`,{className:`mb-1 h-0.5 w-10 rounded-full bg-edge-strong transition-colors group-hover:bg-accent group-focus:bg-accent`})})]})}function Yn(e){return e===`zh`?{title:`工作流定义 · JSON`,valid:`有效`,invalid:`需要修复`,format:`格式化`,copy:`复制`,copied:`已复制`,download:`下载`,import:`导入`,resize:`上下拖动调整源码区域高度`}:{title:`Workflow definition · JSON`,valid:`Valid`,invalid:`Needs attention`,format:`Format`,copy:`Copy`,copied:`Copied`,download:`Download`,import:`Import`,resize:`Drag vertically to resize the source area`}}function Xn(e){let t=typeof window>`u`?960:Math.max(280,window.innerHeight-96);return Math.min(t,Math.max(280,Math.round(e)))}function Zn(e){return Qn(e.name,e.graph,Kn(e))}function Qn(e,t,n){return{formatVersion:1,name:e,manifest:structuredClone(n),graph:structuredClone(t)}}function $n(e){return Qn(e.name,e.graph,{title:e.title,description:e.description,version:e.version,defaults:e.defaults,tags:e.tags,estimatedAgents:e.estimatedAgents,permissions:e.permissions,resources:e.resources,connectors:e.connectors,inputSchema:e.inputSchema,outputSchema:e.outputSchema,whenToUse:e.whenToUse,examplePrompts:e.examplePrompts,i18n:e.i18n})}function er(e,t){let n=lr(e),r=lr(t);if(n.length*r.length>25e4)return ur(n,r);let i=Array.from({length:n.length+1},()=>new Uint32Array(r.length+1));for(let e=n.length-1;e>=0;--e)for(let t=r.length-1;t>=0;--t)i[e][t]=n[e]===r[t]?i[e+1][t+1]+1:Math.max(i[e+1][t],i[e][t+1]);let a=[],o=0,s=0;for(;o<n.length&&s<r.length;)n[o]===r[s]?(a.push({kind:`same`,beforeLine:o+1,afterLine:s+1,text:n[o]}),o+=1,s+=1):i[o+1][s]>=i[o][s+1]?(a.push({kind:`removed`,beforeLine:o+1,text:n[o]}),o+=1):(a.push({kind:`added`,afterLine:s+1,text:r[s]}),s+=1);for(;o<n.length;)a.push({kind:`removed`,beforeLine:++o,text:n[o-1]});for(;s<r.length;)a.push({kind:`added`,afterLine:++s,text:r[s-1]});return a}function tr(e){return`${JSON.stringify(e,null,2)}\n`}function nr(e){let t;try{t=JSON.parse(e)}catch(e){return{ok:!1,error:e instanceof Error?e.message:`Invalid JSON.`}}if(!or(t))return cr(`The source root must be a JSON object.`);if(t.formatVersion!==1)return cr(`formatVersion must be 1.`);if(typeof t.name!=`string`||!/^[a-z][a-z0-9_-]*$/.test(t.name))return cr(`name must use lowercase letters, numbers, underscores, or hyphens.`);if(!or(t.manifest))return cr(`manifest must be an object.`);let n=rr(t.manifest);if(n)return cr(n);if(!or(t.graph))return cr(`graph must be an object.`);if(t.graph.schemaVersion!==1)return cr(`graph.schemaVersion must be 1.`);if(!Array.isArray(t.graph.nodes))return cr(`graph.nodes must be an array.`);if(!Array.isArray(t.graph.edges))return cr(`graph.edges must be an array.`);for(let[e,n]of t.graph.nodes.entries()){let t=ir(n,e);if(t)return cr(t)}for(let[e,n]of t.graph.edges.entries()){let t=ar(n,e);if(t)return cr(t)}return{ok:!0,document:t}}function rr(e){for(let t of[`title`,`description`,`version`,`whenToUse`])if(e[t]!==void 0&&typeof e[t]!=`string`)return`manifest.${t} must be a string.`;return e.tags!==void 0&&(!Array.isArray(e.tags)||e.tags.some(e=>typeof e!=`string`))?`manifest.tags must be an array of strings.`:e.defaults!==void 0&&!or(e.defaults)?`manifest.defaults must be an object.`:null}function ir(e,t){return or(e)?typeof e.id!=`string`||!e.id?`graph.nodes[${t}].id must be a non-empty string.`:[`input`,`agent`,`decision`,`merge`,`output`].includes(String(e.kind))?typeof e.title==`string`?!or(e.position)||!sr(e.position.x)||!sr(e.position.y)?`graph.nodes[${t}].position must contain finite x and y values.`:or(e.config)?null:`graph.nodes[${t}].config must be an object.`:`graph.nodes[${t}].title must be a string.`:`graph.nodes[${t}].kind is invalid.`:`graph.nodes[${t}] must be an object.`}function ar(e,t){if(!or(e))return`graph.edges[${t}] must be an object.`;for(let n of[`id`,`source`,`target`])if(typeof e[n]!=`string`||!e[n])return`graph.edges[${t}].${n} must be a non-empty string.`;return e.sourcePort!==void 0&&![`true`,`false`,`default`].includes(String(e.sourcePort))?`graph.edges[${t}].sourcePort is invalid.`:null}function or(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function sr(e){return typeof e==`number`&&Number.isFinite(e)}function cr(e){return{ok:!1,error:e}}function lr(e){let t=e.split(`
|
|
2
2
|
`);return t.at(-1)===``&&t.pop(),t}function ur(e,t){let n=0;for(;n<e.length&&n<t.length&&e[n]===t[n];)n+=1;let r=0;for(;r<e.length-n&&r<t.length-n&&e[e.length-r-1]===t[t.length-r-1];)r+=1;return[...e.slice(0,n).map((e,t)=>({kind:`same`,beforeLine:t+1,afterLine:t+1,text:e})),...e.slice(n,e.length-r).map((e,t)=>({kind:`removed`,beforeLine:n+t+1,text:e})),...t.slice(n,t.length-r).map((e,t)=>({kind:`added`,afterLine:n+t+1,text:e})),...e.slice(e.length-r).map((n,i)=>({kind:`same`,beforeLine:e.length-r+i+1,afterLine:t.length-r+i+1,text:n}))]}function dr(e){let t=(0,Q.c)(31),{comparison:n,language:r,onClose:i}=e,a;t[0]===n?a=t[1]:(a=n?er(n.before,n.after):[],t[0]=n,t[1]=a);let o=a,s;t[2]===o?s=t[3]:(s=o.filter(pr),t[2]=o,t[3]=s);let c=s.length,l=!!n,d;t[4]===i?d=t[5]:(d=e=>{e||i()},t[4]=i,t[5]=d);let v;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,$.jsx)(u,{className:`xopc-dialog-overlay fixed inset-0 z-50 bg-scrim backdrop-blur-[2px]`}),t[6]=v):v=t[6];let y=r===`zh`?`源码变更`:`Source changes`,b;t[7]===y?b=t[8]:(b=(0,$.jsx)(g,{className:`text-base font-semibold text-fg`,children:y}),t[7]=y,t[8]=b);let x=n?`${n.beforeLabel} → ${n.afterLabel} · ${r===`zh`?`${c} 行变更`:`${c} changed lines`}`:``,S;t[9]===x?S=t[10]:(S=(0,$.jsx)(f,{className:`mt-1 text-xs text-fg-muted`,children:x}),t[9]=x,t[10]=S);let C;t[11]!==b||t[12]!==S?(C=(0,$.jsxs)(`div`,{children:[b,S]}),t[11]=b,t[12]=S,t[13]=C):C=t[13];let w=r===`zh`?`关闭`:`Close`,T;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,$.jsx)(E,{className:`size-4`}),t[14]=T):T=t[14];let D;t[15]===w?D=t[16]:(D=(0,$.jsx)(p,{asChild:!0,children:(0,$.jsx)(N,{type:`button`,variant:`ghost`,className:`size-8 p-0`,"aria-label":w,children:T})}),t[15]=w,t[16]=D);let O;t[17]!==C||t[18]!==D?(O=(0,$.jsxs)(`header`,{className:`flex shrink-0 items-start justify-between gap-4 border-b border-edge px-5 py-4`,children:[C,D]}),t[17]=C,t[18]=D,t[19]=O):O=t[19];let k;t[20]===o?k=t[21]:(k=o.map(fr),t[20]=o,t[21]=k);let A;t[22]===k?A=t[23]:(A=(0,$.jsx)(`div`,{className:`min-h-0 flex-1 overflow-auto bg-surface-base py-3 font-mono text-xs leading-5`,children:k}),t[22]=k,t[23]=A);let j;t[24]!==O||t[25]!==A?(j=(0,$.jsxs)(m,{children:[v,(0,$.jsxs)(h,{className:`xopc-dialog-content fixed left-1/2 top-1/2 z-50 flex h-[min(46rem,calc(100vh-2rem))] w-[min(64rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-2xl border border-edge bg-surface-panel shadow-float`,children:[O,A]})]}),t[24]=O,t[25]=A,t[26]=j):j=t[26];let M;return t[27]!==j||t[28]!==l||t[29]!==d?(M=(0,$.jsx)(_,{open:l,onOpenChange:d,children:j}),t[27]=j,t[28]=l,t[29]=d,t[30]=M):M=t[30],M}function fr(e,t){return(0,$.jsxs)(`div`,{className:e.kind===`added`?`grid min-w-max grid-cols-[3rem_3rem_1.5rem_minmax(40rem,1fr)] bg-success/10 text-success`:e.kind===`removed`?`grid min-w-max grid-cols-[3rem_3rem_1.5rem_minmax(40rem,1fr)] bg-danger/10 text-danger`:`grid min-w-max grid-cols-[3rem_3rem_1.5rem_minmax(40rem,1fr)] text-fg-muted`,children:[(0,$.jsx)(`span`,{className:`select-none border-r border-edge-subtle pr-2 text-right text-fg-subtle`,children:e.beforeLine??``}),(0,$.jsx)(`span`,{className:`select-none border-r border-edge-subtle pr-2 text-right text-fg-subtle`,children:e.afterLine??``}),(0,$.jsx)(`span`,{className:`select-none text-center`,children:e.kind===`added`?`+`:e.kind===`removed`?`−`:` `}),(0,$.jsx)(`span`,{className:`whitespace-pre pr-5`,children:e.text||` `})]},`${t}:${e.kind}`)}function pr(e){return e.kind!==`same`}function mr(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 hr(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 gr={padding:.24,minZoom:.45,maxZoom:1};function _r({language:e,ownerAgentId:t,saving:n,initialDraft:r,initialName:a,existingNames:o,saveConflict:c,onSave:u,onSaveAndStart:d,onClearSaveConflict:f,onReloadLatest:p}){let m=Ir(e),[h,g]=(0,Z.useState)(`my_workflow`),[_,v]=(0,Z.useState)(()=>kr()),[y,b]=(0,Z.useState)(()=>({title:m.untitled,description:``,tags:[`custom`]})),[x,S]=(0,Z.useState)(`agent-1`),[C,w,T]=Bt(_.nodes.map(e=>Dr(e,e.id===`agent-1`))),[E,D]=(0,Z.useState)(``),[O,k]=(0,Z.useState)(``),[A,M]=(0,Z.useState)(!1),[P,F]=(0,Z.useState)(null),[I,R]=(0,Z.useState)(null),[z,V]=(0,Z.useState)(!!r),[H,U]=(0,Z.useState)(null),[G,K]=(0,Z.useState)(`idle`),[ee,te]=(0,Z.useState)(0),[ne,re]=(0,Z.useState)([]),[ie,ae]=(0,Z.useState)(null),J=(0,Z.useRef)(``),oe=(0,Z.useRef)(``),se=(0,Z.useRef)(void 0),ce=(0,Z.useRef)(void 0),le=(0,Z.useRef)(``),Y=(0,Z.useRef)(!1),ue=(0,Z.useRef)(null),[de,X]=(0,Z.useState)(0),[fe,pe]=(0,Z.useState)(`canvas`),[me,he]=(0,Z.useState)(``),[ge,_e]=(0,Z.useState)(0),[ye,be]=(0,Z.useState)(null),[xe,Se]=(0,Z.useState)(null),[we,Te]=(0,Z.useState)(null),Ee=s(!!ye);i((0,Z.useCallback)(e=>{ye&&(e.preventDefault(),e.returnValue=``)},[ye])),(0,Z.useEffect)(()=>{Ee.state===`blocked`&&(window.confirm(e===`zh`?`源码仍有错误。要放弃这些修改吗?`:`The source still has errors. Discard these changes?`)?Ee.proceed():Ee.reset())},[Ee,e]),(0,Z.useEffect)(()=>{let e=`${r?.mode??`new`}:${r?.name??a}:${r?.baseRevision??0}:${r?.repairPrompt??``}`;if(J.current===e)return;J.current=e,g(r?.name??a),v(structuredClone(r?.graph??kr())),X(e=>e+1),b(structuredClone(r?.manifest??{title:m.untitled,description:``,tags:[`custom`]})),S(r?.graph.nodes.find(e=>e.kind===`agent`)?.id??`agent-1`),D(r?.repairPrompt??``),F(null),R(null),V(!!r),k(``),U(null),te(r?.baseRevision??0),re([]),ae(null),se.current=void 0,ce.current=void 0,K(`idle`),pe(`canvas`);let t=tr(Qn(r?.name??a,r?.graph??kr(),r?.manifest??{title:m.untitled,description:``,tags:[`custom`]}));le.current=t,he(t),_e(e=>e+1),be(null),Se(null),Te(null)},[m.untitled,r,a]),(0,Z.useEffect)(()=>{r?.mode===`edit`&&Oe(r.name).then(re).catch(()=>re([]))},[r?.mode,r?.name]),(0,Z.useEffect)(()=>{if(!h.trim())return;let e=!0,t=window.setTimeout(()=>{L(h,_,y).then(t=>{e&&U(t)}).catch(()=>{e&&U(null)})},350);return()=>{e=!1,window.clearTimeout(t)}},[_,y,h]),(0,Z.useEffect)(()=>{if(!h.trim())return;K(`saving`);let e=window.setTimeout(()=>{W({id:se.current,workflowName:h,graph:_,manifest:y,baseRevision:ee,expectedUpdatedAtMs:ce.current}).then(e=>{se.current=e.id,ce.current=e.updatedAtMs,K(`saved`)}).catch(()=>K(`error`))},900);return()=>window.clearTimeout(e)},[ee,_,y,h]);let ke=(0,Z.useMemo)(()=>jr(_,P?.graph??null),[_,P?.graph]),Ae=(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)(()=>{w(e=>{let t=new Map(e.map(e=>[e.id,e]));return Ae.nodes.map(e=>({...t.get(e.id),...Dr(e,e.id===x,ke.nodeStates.get(e.id))}))})},[Ae.nodes,ke.nodeStates,x,w]),(0,Z.useEffect)(()=>{let e=ue.current;if(!e||Ae.nodes.length===0)return;let t=window.requestAnimationFrame(()=>{e.fitView(gr)});return()=>window.cancelAnimationFrame(t)},[Ae.nodes.length,de]);let je=(0,Z.useMemo)(()=>Ae.edges.map(Or),[Ae.edges]),Me=_.nodes.find(e=>e.id===x)??null,Ne=(0,Z.useMemo)(()=>new Set(o),[o]),Pe=r?.mode!==`edit`&&Ne.has(h),Fe=Pe?mr(h,Ne):h,Le=H?.valid===!0&&!Pe&&!n&&!A&&ye===null,Re=e=>{if(!(e===fe||P)&&!(e===`canvas`&&ye)){if(e===`source`){let e=tr(Qn(h,_,y));le.current=e,he(e),_e(e=>e+1),be(null)}pe(e)}},ze=t=>{le.current=t;let n=nr(t);if(!n.ok){be(n.error);return}if(r?.mode===`edit`&&n.document.name!==r.name){be(e===`zh`?`已发布工作流的内部名称不能修改。`:`The internal name of a published workflow cannot be changed.`);return}be(null),U(null),g(n.document.name),v(structuredClone(n.document.graph)),b(structuredClone(n.document.manifest)),S(e=>n.document.graph.nodes.some(t=>t.id===e)?e:n.document.graph.nodes.find(e=>e.kind===`agent`)?.id??``),X(e=>e+1)},Be=e=>{if(g(e),fe!==`source`)return;let t=nr(le.current);if(!t.ok)return;let n=tr({...t.document,name:e});le.current=n,he(n),_e(e=>e+1),ze(n)},Ue=e=>{let t=Kn(e);if(g(e.name),v(structuredClone(e.graph)),b(t),te(e.revision),be(null),fe===`source`){let n=tr(Qn(e.name,e.graph,t));le.current=n,he(n),_e(e=>e+1)}},We=(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})},[]),Ge=(0,Z.useCallback)(e=>{let t=e.filter(e=>e.type!==`select`);t.length!==0&&v(e=>({...e,edges:Nt(t,e.edges.map(Or)).map(e=>({id:e.id,source:e.source,target:e.target,sourcePort:e.sourceHandle===`true`||e.sourceHandle===`false`?e.sourceHandle:void 0}))}))},[]),Ke=(0,Z.useCallback)(e=>{!e.source||!e.target||v(t=>({...t,edges:Ft({...e,id:`edge-${crypto.randomUUID()}`},t.edges.map(Or)).map(e=>({id:e.id,source:e.source,target:e.target,sourcePort:e.sourceHandle===`true`||e.sourceHandle===`false`?e.sourceHandle:void 0}))}))},[]),Je=(0,Z.useCallback)((e,t)=>{v(n=>({...n,nodes:n.nodes.map(n=>n.id===e?t(n):n)}))},[]),Ye=e=>{let t=`${e}-${crypto.randomUUID().slice(0,8)}`,n=Ar(e,t,_.nodes.length);v(e=>{let r=e.nodes.find(e=>e.id===x&&e.kind!==`output`),i=r?[{id:`edge-${crypto.randomUUID()}`,source:r.id,target:t}]:[];return{...e,nodes:[...e.nodes,n],edges:[...e.edges,...i]}}),X(e=>e+1),S(t)},Ze=()=>{!Me||Me.kind===`input`||Me.kind===`output`||(v(e=>({...e,nodes:e.nodes.filter(e=>e.id!==Me.id),edges:e.edges.filter(e=>e.source!==Me.id&&e.target!==Me.id)})),X(e=>e+1),S(``))},Qe=(0,Z.useCallback)(async()=>{if(E.trim()){M(!0);try{let n=await Ie({prompt:E,agentId:t,language:e===`zh`?`zh`:`en`,mode:r||_.nodes.length>3?`improve`:`create`,existingGraph:_}),i=r?.mode===`edit`?r.name:mr(n.name,Ne);R(i===n.name?null:n.name),F(i===n.name?n:{...n,name:i}),V(!0),X(e=>e+1),S(n.graph.nodes.find(e=>e.kind===`agent`)?.id??``)}finally{M(!1)}}},[E,Ne,_,r,e,t]);(0,Z.useEffect)(()=>{let e=r?.repairPrompt?.trim();!e||E.trim()!==e||A||P||oe.current===e||(oe.current=e,Qe())},[E,Qe,A,r?.repairPrompt,P]);let $e=()=>{F(null),R(null),S(_.nodes.find(e=>e.kind===`agent`)?.id??``),X(e=>e+1)},et=async()=>{if(!(!P||n||Y.current)){Y.current=!0;try{let e=await u({name:P.name,graph:P.graph,manifest:P.manifest,expectedRevision:ee});if(!e)return;Ue(e),U(P.validation),F(null),R(null),D(``),S(e.graph.nodes.find(e=>e.kind===`agent`)?.id??``),se.current&&await it(se.current).catch(()=>void 0)}catch{}finally{Y.current=!1}}},nt=async e=>{if(!Le||Y.current)return;Y.current=!0;let t={name:h,graph:_,manifest:y,expectedRevision:ee};try{if(e)await d({...t,goal:O.trim()||y.description||h});else{let e=await u(t);if(!e)return;Ue(e)}se.current&&await it(se.current).catch(()=>void 0)}catch{return}finally{Y.current=!1}},rt=async e=>{if(!(ie!==null||r?.mode!==`edit`)){ae(e);try{let t=await gt(r.name,e,ee);Ue(t),X(e=>e+1),S(t.graph.nodes.find(e=>e.kind===`agent`)?.id??``),re(await Oe(r.name))}finally{ae(null)}}},at=async t=>{if(!(xe!==null||r?.mode!==`edit`)){Se(t);try{Te({before:tr(Zn(await Ve(r.name,t))),after:tr(Qn(h,_,y)),beforeLabel:`v${t}`,afterLabel:e===`zh`?`当前草稿 · v${ee}`:`Current draft · v${ee}`})}finally{Se(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)(l,{to:`/workflows`,className:j(`inline-flex size-9 shrink-0 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover hover:text-fg`,De.focusRingPanel),"aria-label":e===`zh`?`返回工作流`:`Back to workflows`,children:(0,$.jsx)(B,{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`?m.editTitle:m.createTitle}),(0,$.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:m.subtitle})]}),z?(0,$.jsx)(`div`,{className:`flex rounded-lg bg-surface-base p-1`,role:`tablist`,"aria-label":e===`zh`?`工作流编辑视图`:`Workflow editor view`,children:[`canvas`,`source`].map(t=>(0,$.jsx)(`button`,{type:`button`,role:`tab`,"aria-selected":fe===t,disabled:!!P||t===`canvas`&&!!ye,className:j(`rounded-md px-3 py-1.5 text-xs font-medium disabled:cursor-not-allowed disabled:opacity-50`,fe===t?`bg-surface-panel text-fg shadow-surface`:`text-fg-muted hover:text-fg`),onClick:()=>Re(t),children:t===`canvas`?e===`zh`?`画布`:`Canvas`:e===`zh`?`源码`:`Source`},t))}):null,(0,$.jsx)(`span`,{className:j(`text-xs`,G===`error`?`text-danger`:`text-fg-subtle`),children:G===`saving`?m.savingDraft:G===`saved`?m.savedDraft:G===`error`?m.draftError:``})]}),c?(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:c.code===`WORKFLOW_NAME_EXISTS`?e===`zh`?`内部名称“${c.name}”已被使用。`:`The internal name “${c.name}” is already in use.`:e===`zh`?`这个工作流已更新到版本 ${c.currentRevision}。`:`This workflow has changed to revision ${c.currentRevision}.`}),c.code===`WORKFLOW_NAME_EXISTS`?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(N,{variant:`secondary`,className:`h-8`,onClick:()=>{Be(c.suggestedName),f()},children:e===`zh`?`使用 ${c.suggestedName}`:`Use ${c.suggestedName}`}),(0,$.jsx)(l,{className:`text-sm font-medium text-accent-fg hover:underline`,to:`/workflows/${encodeURIComponent(c.name)}`,children:e===`zh`?`打开已有工作流`:`Open existing`})]}):(0,$.jsx)(N,{variant:`secondary`,className:`h-8`,onClick:p,children:e===`zh`?`加载最新版本`:`Load latest`})]}):null,!c&&Pe?(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`?`内部名称“${h}”已被使用。`:`The internal name “${h}” is already in use.`}),(0,$.jsx)(N,{variant:`secondary`,className:`h-8`,onClick:()=>Be(Fe),children:e===`zh`?`使用 ${Fe}`:`Use ${Fe}`})]}):null,!c&&!Pe&&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,z?(0,$.jsxs)($.Fragment,{children:[fe===`source`?(0,$.jsx)(`div`,{className:`flex min-h-0 flex-1 items-start overflow-y-auto bg-surface-base p-4`,children:(0,$.jsx)(Jn,{initialSource:me,resetKey:ge,fileName:`${h||`workflow`}.workflow.json`,language:e,readOnly:!1,error:ye,onChange:ze,allowImport:!0,className:`min-h-[32rem] flex-1`})}):(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:m.flowTitle}),(0,$.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:m.stepCount(_.nodes.length)})]}),(0,$.jsxs)(N,{variant:`secondary`,className:`h-8 rounded-lg text-xs`,disabled:!!P,onClick:()=>Ye(`agent`),children:[(0,$.jsx)(Ct,{className:`size-3.5`}),m.addAgent]}),(0,$.jsxs)(N,{variant:`secondary`,className:`h-8 rounded-lg text-xs`,disabled:!!P,onClick:()=>Ye(`decision`),children:[(0,$.jsx)(ve,{className:`size-3.5`}),m.addDecision]}),(0,$.jsxs)(N,{variant:`secondary`,className:`h-8 rounded-lg text-xs`,disabled:!!P,onClick:()=>Ye(`merge`),children:[(0,$.jsx)(Xe,{className:`size-3.5`}),m.addMerge]}),(0,$.jsx)(`span`,{className:`ml-auto text-xs text-fg-subtle`,children:m.canvasHint})]}),(0,$.jsx)(`div`,{className:`relative min-h-72 flex-1`,children:_.nodes.length>0?(0,$.jsxs)(Rt,{"aria-label":m.flowAria,nodes:C,edges:je,nodeTypes:wr,onNodesChange:T,onEdgesChange:Ge,onConnect:Ke,nodesDraggable:!P,nodesConnectable:!P,onNodeClick:(e,t)=>S(t.id),onNodeDragStart:(e,t)=>S(t.id),onNodeDragStop:(e,t)=>We(t),onInit:e=>{ue.current=e,window.requestAnimationFrame(()=>{e.fitView(gr)})},fitView:!0,fitViewOptions:gr,minZoom:.25,maxZoom:1.5,deleteKeyCode:null,proOptions:{hideAttribution:!0},children:[(0,$.jsx)(Vt,{color:`var(--color-edge)`,gap:22,size:1}),(0,$.jsx)(Lt,{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:m.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)(yr,{proposal:P,diff:ke,copy:m,saving:n,onAccept:()=>void et(),onReject:$e}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`section`,{children:[(0,$.jsx)(`label`,{className:`block text-xs font-medium text-fg`,htmlFor:`workflow-title`,children:m.humanTitle}),(0,$.jsx)(`input`,{id:`workflow-title`,value:y.title??``,onChange:e=>b(t=>({...t,title:e.target.value})),className:Er}),(0,$.jsx)(`label`,{className:`mt-3 block text-xs font-medium text-fg`,htmlFor:`workflow-description`,children:m.task}),(0,$.jsx)(`textarea`,{id:`workflow-description`,value:y.description??``,onChange:e=>b(t=>({...t,description:e.target.value})),className:`${Er} 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:m.advanced}),(0,$.jsx)(`label`,{className:`mt-3 block text-xs font-medium text-fg`,htmlFor:`workflow-name`,children:m.workflowName}),(0,$.jsx)(`input`,{id:`workflow-name`,value:h,disabled:r?.mode===`edit`,onChange:e=>g(Pr(e.target.value)),className:`${Er} disabled:cursor-not-allowed disabled:opacity-60`}),Pe?(0,$.jsx)(`p`,{className:`mt-1 text-xs text-danger`,children:e===`zh`?`该内部名称已被使用,请换一个名称。`:`This internal name is already in use.`}):null,r?.mode===`edit`&&ne.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)(St,{className:`size-3.5`}),m.versions,` · v`,ee]}),(0,$.jsx)(`div`,{className:`mt-2 space-y-1`,children:ne.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,` · `,qe(t.createdAtMs,e)]}),t.revision===ee?(0,$.jsx)(`span`,{className:`text-xs text-fg-subtle`,children:m.currentVersion}):(0,$.jsxs)(`span`,{className:`flex shrink-0 items-center gap-1`,children:[(0,$.jsx)(N,{variant:`ghost`,className:`h-7 px-2 text-xs`,disabled:xe!==null,onClick:()=>void at(t.revision),children:xe===t.revision?e===`zh`?`加载中…`:`Loading…`:e===`zh`?`对比`:`Compare`}),(0,$.jsxs)(N,{variant:`ghost`,className:`h-7 px-2 text-xs`,disabled:ie!==null,onClick:()=>void rt(t.revision),children:[(0,$.jsx)(Ce,{className:`size-3`}),ie===t.revision?m.restoring:m.restore]})]})]},t.revision))})]}):null]})]}),(0,$.jsx)(`div`,{className:`my-4 border-t border-edge`}),Me?(0,$.jsx)(Tr,{node:Me,copy:m,updateNode:Je,onDelete:Ze}):(0,$.jsx)(`div`,{className:`py-8 text-center text-sm text-fg-muted`,children:m.selectNode}),H&&!H.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:m.needsAttention}),(0,$.jsx)(`ul`,{className:`mt-2 space-y-1 text-xs text-danger`,children:H.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:[fe===`canvas`?(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-center gap-2`,children:[(0,$.jsx)(tt,{className:`size-4 shrink-0 text-accent-fg`}),(0,$.jsx)(Ot,{value:E,onChange:e=>D(e.target.value),suggestion:Mt(m.aiPlaceholder),onAcceptSuggestion:D,onKeyDown:e=>{e.key===`Enter`&&Qe()},placeholder:m.aiPlaceholder,className:`${Er} mt-0 flex-1`}),(0,$.jsx)(N,{variant:`secondary`,className:`h-10 shrink-0`,disabled:!!P||A||!E.trim(),onClick:()=>void Qe(),children:A?m.designing:m.applyWithAi})]}):(0,$.jsx)(`p`,{className:`min-w-0 flex-1 text-xs text-fg-muted`,children:ye?e===`zh`?`修复源码错误后才能切换画布或保存。`:`Fix source errors before switching to the canvas or saving.`:e===`zh`?`源码与画布使用同一个草稿。`:`Source and canvas share the same draft.`}),(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(`input`,{value:O,onChange:e=>k(e.target.value),placeholder:m.testGoal,className:`${Er} mt-0 w-52`}),(0,$.jsxs)(N,{variant:`secondary`,disabled:!Le,onClick:()=>void nt(!1),children:[(0,$.jsx)(He,{className:`size-4`}),m.publish]}),(0,$.jsxs)(N,{variant:`primary`,disabled:!Le,onClick:()=>void nt(!0),children:[(0,$.jsx)(q,{className:`size-4`}),m.publishAndRun]})]})]})})]}):(0,$.jsx)(vr,{copy:m,prompt:E,generating:A,onPromptChange:D,onGenerate:()=>void Qe(),onManual:()=>V(!0)}),(0,$.jsx)(dr,{comparison:we,language:e,onClose:()=>Te(null)})]})}function vr(e){let t=(0,Q.c)(42),{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)(tt,{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?f=t[8]:(f=Mt(n.introPlaceholder),t[7]=n.introPlaceholder,t[8]=f);let p;t[9]!==n.introPlaceholder||t[10]!==a||t[11]!==r||t[12]!==d||t[13]!==f?(p=(0,$.jsx)(Dt,{value:r,onChange:d,suggestion:f,onAcceptSuggestion:a,placeholder:n.introPlaceholder,className:`${Er} mt-6 h-auto min-h-32 resize-y py-3 text-base leading-6`}),t[9]=n.introPlaceholder,t[10]=a,t[11]=r,t[12]=d,t[13]=f,t[14]=p):p=t[14];let m;if(t[15]!==n.examples||t[16]!==a){let e;t[18]===a?e=t[19]:(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[18]=a,t[19]=e),m=n.examples.map(e),t[15]=n.examples,t[16]=a,t[17]=m}else m=t[17];let h;t[20]===m?h=t[21]:(h=(0,$.jsx)(`div`,{className:`mt-3 flex flex-wrap gap-2`,children:m}),t[20]=m,t[21]=h);let g;t[22]!==i||t[23]!==r?(g=!r.trim()||i,t[22]=i,t[23]=r,t[24]=g):g=t[24];let _;t[25]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,$.jsx)(tt,{className:`size-4`}),t[25]=_):_=t[25];let v=i?n.designing:n.designWorkflow,y;t[26]!==o||t[27]!==v||t[28]!==g?(y=(0,$.jsxs)(N,{variant:`primary`,disabled:g,onClick:o,children:[_,v]}),t[26]=o,t[27]=v,t[28]=g,t[29]=y):y=t[29];let b;t[30]!==n.manualStart||t[31]!==s?(b=(0,$.jsx)(N,{variant:`ghost`,onClick:s,children:n.manualStart}),t[30]=n.manualStart,t[31]=s,t[32]=b):b=t[32];let x;t[33]!==y||t[34]!==b?(x=(0,$.jsxs)(`div`,{className:`mt-6 flex flex-wrap items-center gap-3`,children:[y,b]}),t[33]=y,t[34]=b,t[35]=x):x=t[35];let S;return t[36]!==x||t[37]!==l||t[38]!==u||t[39]!==p||t[40]!==h?(S=(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,p,h,x]})}),t[36]=x,t[37]=l,t[38]=u,t[39]=p,t[40]=h,t[41]=S):S=t[41],S}function yr(e){let t=(0,Q.c)(74),{proposal:n,diff:r,copy:i,saving:a,onAccept:o,onReject:s}=e,c;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,$.jsx)(`span`,{className:`flex size-8 shrink-0 items-center justify-center rounded-xl bg-accent-soft text-accent-fg`,children:(0,$.jsx)(tt,{className:`size-4`})}),t[0]=c):c=t[0];let l;t[1]===i.proposalTitle?l=t[2]:(l=(0,$.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:i.proposalTitle}),t[1]=i.proposalTitle,t[2]=l);let u;t[3]===i.proposalHint?u=t[4]:(u=(0,$.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:i.proposalHint}),t[3]=i.proposalHint,t[4]=u);let d;t[5]!==l||t[6]!==u?(d=(0,$.jsxs)(`div`,{className:`flex items-start gap-2`,children:[c,(0,$.jsxs)(`div`,{className:`min-w-0`,children:[l,u]})]}),t[5]=l,t[6]=u,t[7]=d):d=t[7];let f=n.manifest.title||n.name,p;t[8]===f?p=t[9]:(p=(0,$.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:f}),t[8]=f,t[9]=p);let m=n.explanation||n.manifest.description,h;t[10]===m?h=t[11]:(h=(0,$.jsx)(`p`,{className:`mt-2 text-sm leading-6 text-fg-muted`,children:m}),t[10]=m,t[11]=h);let g;t[12]===i.added?g=t[13]:(g=(0,$.jsx)(`dt`,{className:`text-fg-subtle`,children:i.added}),t[12]=i.added,t[13]=g);let _;t[14]===r.addedIds.length?_=t[15]:(_=(0,$.jsx)(`dd`,{className:`mt-1 font-semibold text-success`,children:r.addedIds.length}),t[14]=r.addedIds.length,t[15]=_);let y;t[16]!==_||t[17]!==g?(y=(0,$.jsxs)(`div`,{className:`rounded-lg bg-success-soft p-2`,children:[g,_]}),t[16]=_,t[17]=g,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 D;t[30]!==w||t[31]!==T?(D=(0,$.jsxs)(`div`,{className:`rounded-lg bg-danger/5 p-2`,children:[w,T]}),t[30]=w,t[31]=T,t[32]=D):D=t[32];let O;t[33]!==y||t[34]!==C||t[35]!==D?(O=(0,$.jsxs)(`dl`,{className:`mt-3 grid grid-cols-3 gap-2 text-center text-xs`,children:[y,C,D]}),t[33]=y,t[34]=C,t[35]=D,t[36]=O):O=t[36];let k;t[37]!==O||t[38]!==p||t[39]!==h?(k=(0,$.jsxs)(`div`,{className:`mt-4 rounded-xl border border-edge bg-surface-base/50 p-3`,children:[p,h,O]}),t[37]=O,t[38]=p,t[39]=h,t[40]=k):k=t[40];let A;t[41]!==i.assumptions||t[42]!==n.assumptions?(A=n.assumptions.length?(0,$.jsx)(xr,{title:i.assumptions,items:n.assumptions}):null,t[41]=i.assumptions,t[42]=n.assumptions,t[43]=A):A=t[43];let j;t[44]!==i.risks||t[45]!==n.risks?(j=n.risks.length?(0,$.jsx)(xr,{title:i.risks,items:n.risks}):null,t[44]=i.risks,t[45]=n.risks,t[46]=j):j=t[46];let M;t[47]!==i.permissions||t[48]!==n.permissionsSummary?(M=n.permissionsSummary.length?(0,$.jsx)(xr,{title:i.permissions,items:n.permissionsSummary}):null,t[47]=i.permissions,t[48]=n.permissionsSummary,t[49]=M):M=t[49];let P;t[50]!==n.validation.errors||t[51]!==n.validation.valid?(P=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(br)}),t[50]=n.validation.errors,t[51]=n.validation.valid,t[52]=P):P=t[52];let F=a||!n.validation.valid,I;t[53]===Symbol.for(`react.memo_cache_sentinel`)?(I=(0,$.jsx)(v,{className:`size-4`}),t[53]=I):I=t[53];let L=a?i.savingProposal:i.acceptAndSave,R;t[54]!==o||t[55]!==F||t[56]!==L?(R=(0,$.jsxs)(N,{variant:`primary`,disabled:F,onClick:o,children:[I,L]}),t[54]=o,t[55]=F,t[56]=L,t[57]=R):R=t[57];let z;t[58]===Symbol.for(`react.memo_cache_sentinel`)?(z=(0,$.jsx)(E,{className:`size-4`}),t[58]=z):z=t[58];let B;t[59]!==i.rejectProposal||t[60]!==s||t[61]!==a?(B=(0,$.jsxs)(N,{variant:`ghost`,disabled:a,onClick:s,children:[z,i.rejectProposal]}),t[59]=i.rejectProposal,t[60]=s,t[61]=a,t[62]=B):B=t[62];let V;t[63]!==R||t[64]!==B?(V=(0,$.jsxs)(`div`,{className:`mt-5 grid gap-2`,children:[R,B]}),t[63]=R,t[64]=B,t[65]=V):V=t[65];let H;return t[66]!==k||t[67]!==A||t[68]!==j||t[69]!==M||t[70]!==P||t[71]!==V||t[72]!==d?(H=(0,$.jsxs)(`section`,{children:[d,k,A,j,M,P,V]}),t[66]=k,t[67]=A,t[68]=j,t[69]=M,t[70]=P,t[71]=V,t[72]=d,t[73]=H):H=t[73],H}function br(e){return(0,$.jsxs)(`p`,{children:[`• `,e.message]},`${e.code}:${e.message}`)}function xr(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(Sr),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 Sr(e){return(0,$.jsxs)(`li`,{children:[`• `,e]},e)}function Cr(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)($e,{}):i.kind===`agent`?(0,$.jsx)(Ct,{}):i.kind===`decision`?(0,$.jsx)(ve,{}):i.kind===`merge`?(0,$.jsx)(Xe,{}):(0,$.jsx)(q,{}),t[0]=i.kind,t[1]=o);let s=o,c=r?`border-accent ring-2 ring-accent/20`:`border-edge`,l=a===`added`&&`border-success ring-2 ring-success/15`,u=a===`changed`&&`border-accent ring-2 ring-accent/15`,d=a===`removed`&&`border-dashed border-danger opacity-55`,f;t[2]!==c||t[3]!==l||t[4]!==u||t[5]!==d?(f=j(`w-52 rounded-xl border bg-surface-panel p-3 shadow-surface transition-colors`,c,l,u,d),t[2]=c,t[3]=l,t[4]=u,t[5]=d,t[6]=f):f=t[6];let p;t[7]===i.kind?p=t[8]:(p=i.kind===`input`?null:(0,$.jsx)(zt,{type:`target`,position:It.Left,className:`!size-2.5 !border-2 !border-surface-panel !bg-fg-subtle`}),t[7]=i.kind,t[8]=p);let m;t[9]===s?m=t[10]:(m=(0,$.jsx)(`span`,{className:`mt-0.5 [&>svg]:size-4 text-accent-fg`,children:s}),t[9]=s,t[10]=m);let h;t[11]===i.title?h=t[12]:(h=(0,$.jsx)(`strong`,{className:`block truncate text-sm font-medium text-fg`,children:i.title}),t[11]=i.title,t[12]=h);let g;t[13]!==i.description||t[14]!==i.kind?(g=i.description||Fr(i.kind),t[13]=i.description,t[14]=i.kind,t[15]=g):g=t[15];let _;t[16]===g?_=t[17]:(_=(0,$.jsx)(`span`,{className:`mt-1 block line-clamp-2 text-xs leading-4 text-fg-muted`,children:g}),t[16]=g,t[17]=_);let v;t[18]!==_||t[19]!==h?(v=(0,$.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[h,_]}),t[18]=_,t[19]=h,t[20]=v):v=t[20];let y;t[21]===a?y=t[22]:(y=a?(0,$.jsx)(`span`,{className:j(`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]=y);let b;t[23]!==v||t[24]!==y||t[25]!==m?(b=(0,$.jsxs)(`div`,{className:`flex items-start gap-2`,children:[m,v,y]}),t[23]=v,t[24]=y,t[25]=m,t[26]=b):b=t[26];let x;t[27]===i.kind?x=t[28]:(x=i.kind===`decision`?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(zt,{id:`true`,type:`source`,position:It.Right,style:{top:`38%`},className:`!size-2.5 !border-2 !border-surface-panel !bg-success`}),(0,$.jsx)(zt,{id:`false`,type:`source`,position:It.Right,style:{top:`70%`},className:`!size-2.5 !border-2 !border-surface-panel !bg-danger`})]}):i.kind===`output`?null:(0,$.jsx)(zt,{type:`source`,position:It.Right,className:`!size-2.5 !border-2 !border-surface-panel !bg-accent`}),t[27]=i.kind,t[28]=x);let S;return t[29]!==b||t[30]!==x||t[31]!==f||t[32]!==p?(S=(0,$.jsxs)(`div`,{className:f,children:[p,b,x]}),t[29]=b,t[30]=x,t[31]=f,t[32]=p,t[33]=S):S=t[33],S}var wr={workflow:Cr};function Tr(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)(N,{variant:`ghost`,className:`h-8 px-2 text-danger`,onClick:a,children:[(0,$.jsx)(J,{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:Er}),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:`${Er} 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:`${Er} 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:Er})]})}):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 S;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?(S=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:Er}),(0,$.jsx)(`label`,{className:`mt-3 block text-xs font-medium text-fg`,id:`decision-operator-label`,children:r.condition}),(0,$.jsx)(x,{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:Er})]})]}):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]=S):S=t[47];let C;t[48]!==r.combineAs||t[49]!==r.listResults||t[50]!==r.namedResults||t[51]!==n.config||t[52]!==n.kind||t[53]!==l?(C=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)(x,{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]=C):C=t[54];let w;t[55]!==r.autoSummary||t[56]!==r.summaryTemplate||t[57]!==n.config||t[58]!==n.kind||t[59]!==l?(w=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:`${Er} 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]=w):w=t[60];let T;return t[61]!==y||t[62]!==b||t[63]!==S||t[64]!==C||t[65]!==w||t[66]!==f||t[67]!==p||t[68]!==h||t[69]!==g?(T=(0,$.jsxs)(`section`,{children:[f,p,h,g,y,b,S,C,w]}),t[61]=y,t[62]=b,t[63]=S,t[64]=C,t[65]=w,t[66]=f,t[67]=p,t[68]=h,t[69]=g,t[70]=T):T=t[70],T}var Er=`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 Dr(e,t=!1,n){return{id:e.id,type:`workflow`,position:e.position,selected:t,data:{workflowNode:e,diffState:n}}}function Or(e){return{id:e.id,source:e.source,target:e.target,sourceHandle:e.sourcePort===`true`||e.sourcePort===`false`?e.sourcePort:void 0,markerEnd:{type:Pt.ArrowClosed},style:{stroke:`var(--color-fg-subtle)`,strokeWidth:1.5}}}function kr(){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}}
|
|
3
3
|
|
|
4
4
|
User input:
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|