import"./api-DyiqpKJK.js";import{u as T,W as _}from"./WorkflowStudio-FCyhGD4y.js";/* empty css                     *//* empty css                 */import{e as x,q as R,r as N,s as B,i as C,t as D,a as F}from"./element-ui-D3x2y3TA.js";import{v as j,c as I,i as y,V as U,w as W,J as c,K as l,U as g,G as A,a2 as k,B as J,x as K,O as L,a9 as M,H as $,k as G,u as b,y as u}from"./vue-core-DL-LgTX0.js";import{_ as q}from"./index-BMvodlwc.js";import"./ui-components-DQ7-U3pr.js";import"./js-yaml-yTPt38rv.js";import"./elkjs-Dm5QV7uy.js";const H={class:"input-hint"},P=j({__name:"TestRunningDialog",props:{startRunning:{type:Function}},setup(v){const i=y(_.TEST_RUNNING_OPEN),m=y(_.WORKFLOW_DATA),V=T().nodeSchemaMap,w=v,o=I(()=>{for(const t of m?.value.nodes||[]){const e=V.get(t.type);if(e&&e.is_trigger)return e}}),s=U({}),h=t=>{const e=o.value?.outputs?.[t]?.type;return!(e==="str"||e==="bool"||e==="float"||e==="int")};W(o,()=>{for(const t of Object.keys(s))delete s[t];if(o.value?.outputs)for(const t of Object.keys(o.value.outputs))s[t]=""});const f=()=>{i&&(i.value=!1)},E=()=>{if(!m?.value||!o.value)return;const t={};for(const[e,a]of Object.entries(s)){if(!a.trim())continue;const p=o.value?.outputs?.[e];if(p)try{switch(p.type){case"str":t[e]=a;break;case"int":t[e]=parseInt(a);break;case"float":t[e]=parseFloat(a);break;case"bool":const r=a.toLowerCase();if(r==="true"||r==="1")t[e]=!0;else if(r==="false"||r==="0")t[e]=!1;else throw new Error(`布尔值格式错误: ${a}`);break;default:t[e]=JSON.parse(a)}}catch(r){F.error(`解析${e}字段时出错: ${r.message}`);return}}w.startRunning(m.value,t),f()};return(t,e)=>{const a=B,p=N,r=R,S=C,d=x;return u(),c(b(D),{modelValue:b(i),"onUpdate:modelValue":e[0]||(e[0]=n=>G(i)?i.value=n:null),title:"测试运行 · 模拟触发","align-center":""},{default:l(()=>[o.value?(u(),c(r,{key:0,model:s,"label-position":"right","label-width":"auto"},{default:l(()=>[J("p",H," 请提供"+L(o.value.name)+"的模拟输出（复杂数据格式需以JSON格式书写） ",1),(u(!0),K($,null,M(Object.keys(s),n=>(u(),c(p,{label:n},{default:l(()=>[g(a,{placeholder:"请输入："+(o.value?.outputs?.[n]?.type??"未知类型"),type:h(n)?"textarea":"text",modelValue:s[n],"onUpdate:modelValue":O=>s[n]=O},null,8,["placeholder","type","modelValue","onUpdate:modelValue"])]),_:2},1032,["label"]))),256))]),_:1},8,["model"])):(u(),c(S,{key:1,icon:"warning",title:"不可测试","sub-title":"当前工作流没有Trigger类型节点，暂不支持测试运行"}))]),footer:l(()=>[g(d,{onClick:f},{default:l(()=>[...e[1]||(e[1]=[k("取消",-1)])]),_:1}),o.value?(u(),c(d,{key:0,onClick:E,type:"primary"},{default:l(()=>[...e[2]||(e[2]=[k("运行",-1)])]),_:1})):A("",!0)]),_:1},8,["modelValue"])}}}),re=q(P,[["__scopeId","data-v-5d56af4b"]]);export{re as default};
