import{d as _,r as v,b as u,ev as R,f as o,c as d,w as i,u as e,bO as x,eA as B,eB as C,eK as h,ex as f,e as b}from"./outputWidgets.74ac2ec4.js";import{W as w}from"./workspaces.2898fa49.js";import{S as A}from"./scripts.274c8d77.js";import{R as T,S as N,a as $,L as D}from"./SourceCode.6ffa4a36.js";import{B as P}from"./BaseLayout.872fac06.js";import{a as U}from"./asyncComputed.f88a4b94.js";import{_ as E}from"./RunButton.vue_vue_type_script_setup_true_lang.94a782d9.js";import{A as F}from"./FormItem.bf6c91bc.js";import{F as L}from"./Form.9d6d8c17.js";import{N as K}from"./NavbarControls.15eddc8e.js";import{_ as V}from"./SaveButton.vue_vue_type_script_setup_true_lang.95286835.js";import{S as M}from"./StageRunSelector.9f43f118.js";import{c as W}from"./index.f7c43892.js";import{A as q}from"./index.ba7b32c9.js";import{A as y,T as I}from"./TabPane.ad00156c.js";import"./runnerData.ae84c16f.js";import"./url.c37f3fbe.js";import"./record.a15934e9.js";import"./pubsub.6d093b2e.js";import"./uuid.ef799a73.js";import"./icons.f62d7c23.js";import"./jobs.0128b9a3.js";import"./validations.b55cc691.js";import"./string.ae0d3257.js";import"./toggleHighContrast.42a118d0.js";import"./index.4627b22e.js";import"./Card.0feb78fb.js";import"./Text.039f7ef4.js";import"./Base.bd01be9c.js";import"./hasIn.88fbb4e5.js";import"./index.baf3b153.js";import"./popupNotifcation.aec81c2d.js";import"./Link.81322bd7.js";import"./DocsButton.vue_vue_type_script_setup_true_lang.30b53c7c.js";import"./Paragraph.d67398fc.js";import"./Modal.fae7bce9.js";import"./ant-design.ba20537e.js";import"./index.8324d637.js";import"./index.2a3cd704.js";import"./index.af32770e.js";(function(){try{var n=typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},c=new Error().stack;c&&(n._sentryDebugIds=n._sentryDebugIds||{},n._sentryDebugIds[c]="5c711560-e6ef-448a-907a-aef511de8864",n._sentryDebugIdIdentifier="sentry-dbid-5c711560-e6ef-448a-907a-aef511de8864")}catch{}})();const H={style:{width:"100%",display:"flex","flex-direction":"column"}},O=_({__name:"ScriptTester",props:{script:{},logService:{},stageRunId:{}},emits:["update-stage-run-id"],setup(n,{emit:c}){const t=n,g=v(!1),l=async()=>{g.value=!0;try{const r=t.stageRunId?await t.script.run(t.stageRunId):await t.script.test();r.stderr&&t.logService.log({type:"stderr",log:r.stderr}),r.stdout&&t.logService.log({type:"stdout",log:r.stdout})}finally{g.value=!1,t.stageRunId&&c("update-stage-run-id",null)}};return(r,m)=>(u(),R("div",H,[o(E,{loading:g.value,disabled:r.script.hasChanges(),onClick:l,onSave:m[0]||(m[0]=a=>r.script.save())},null,8,["loading","disabled"])]))}}),j=_({__name:"ScriptSettings",props:{script:{}},setup(n){const t=v(n.script);return(g,l)=>(u(),d(e(L),{layout:"vertical"},{default:i(()=>[o(e(F),{label:"Name",required:""},{default:i(()=>[o(e(x),{value:t.value.title,"onUpdate:value":l[0]||(l[0]=r=>t.value.title=r)},null,8,["value"])]),_:1}),o(T,{runtime:t.value},null,8,["runtime"])]),_:1}))}}),z={style:{width:"50%"}},G={style:{width:"50%"}},Ue=_({__name:"ScriptEditor",setup(n){const c=B(),t=C();function g(){c.push({name:"home"})}const l=v("source-code"),r=v("preview"),m=v(null),{result:a}=U(()=>Promise.all([w.get(),A.get(t.params.id),w.readTestData()]).then(([S,s,p])=>(s.updateInitialState("test_data",p),h({workspace:S,script:s})))),k=D.create();return(S,s)=>(u(),d(P,null,{navbar:i(()=>[e(a)?(u(),d(e(W),{key:0,title:e(a).script.title,style:{padding:"5px 10px"},onBack:g},{extra:i(()=>[o(K,{"show-save-button":!1,"editing-model":e(a).script},null,8,["editing-model"])]),_:1},8,["title"])):f("",!0)]),content:i(()=>[e(a)?(u(),d(e(q),{key:0,gap:"40",style:{width:"calc(100% - 80px)"}},{default:i(()=>[b("div",z,[o(e(I),{"active-key":l.value,"onUpdate:activeKey":s[0]||(s[0]=p=>l.value=p)},{rightExtra:i(()=>[o(V,{model:e(a).script},null,8,["model"])]),default:i(()=>[o(e(y),{key:"source-code",tab:"Source code"}),o(e(y),{key:"settings",tab:"Settings"})]),_:1},8,["active-key"]),l.value==="source-code"?(u(),d(N,{key:0,script:e(a).script,workspace:e(a).workspace},null,8,["script","workspace"])):f("",!0),e(a).script&&l.value==="settings"?(u(),d(j,{key:1,script:e(a).script},null,8,["script"])):f("",!0)]),b("div",G,[o(e(I),{"active-key":r.value,"onUpdate:activeKey":s[1]||(s[1]=p=>r.value=p)},{default:i(()=>[o(e(y),{key:"preview",tab:"Preview"}),f("",!0)]),_:1},8,["active-key"]),e(a).script&&r.value==="preview"?(u(),d(O,{key:0,ref:"tester",script:e(a).script,"log-service":e(k),"stage-run-id":m.value,onUpdateStageRunId:s[2]||(s[2]=p=>m.value=p)},null,8,["script","log-service","stage-run-id"])):f("",!0),r.value==="test-data"?(u(),d(M,{key:1,ref:"stageRunSelector",stage:e(a).script,"stage-run-id":m.value,onUpdateStageRunId:s[3]||(s[3]=p=>m.value=p)},null,8,["stage","stage-run-id"])):f("",!0)])]),_:1})):f("",!0)]),footer:i(()=>[o($,{runtime:"forms","log-service":e(k)},null,8,["log-service"])]),_:1}))}});export{Ue as default};
//# sourceMappingURL=ScriptEditor.dc9b320c.js.map
