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 S}from"./outputWidgets.244ba1c8.js";import{W as w}from"./workspaces.5f7fbba3.js";import{S as A}from"./scripts.4a7ed91a.js";import{R as T,S as N,a as $,L as D}from"./SourceCode.b9aff759.js";import{B as P}from"./BaseLayout.8bb2298c.js";import{a as U}from"./asyncComputed.9805a381.js";import{_ as E}from"./RunButton.vue_vue_type_script_setup_true_lang.9ddddf9d.js";import{A as F}from"./FormItem.e7fba2a7.js";import{F as L}from"./Form.f49cd330.js";import{N as K}from"./NavbarControls.210f1bad.js";import{_ as V}from"./SaveButton.vue_vue_type_script_setup_true_lang.4dcb99e4.js";import{S as M}from"./StageRunSelector.f953f703.js";import{c as W}from"./index.29328ced.js";import{A as q}from"./index.08ab98c1.js";import{A as y,T as I}from"./TabPane.bad26671.js";import"./runnerData.64dc3fe3.js";import"./url.f5db59c1.js";import"./record.5766e9f8.js";import"./pubsub.f74b1921.js";import"./uuid.7f04de1c.js";import"./icons.a522dd78.js";import"./jobs.ac493abd.js";import"./validations.613a074b.js";import"./string.857814ea.js";import"./toggleHighContrast.e8369325.js";import"./index.6c491bc0.js";import"./Card.c3bad4d1.js";import"./Text.fbfa9a45.js";import"./Base.2351f159.js";import"./Typography.52981f51.js";import"./hasIn.d73516ff.js";import"./index.cc4549b3.js";import"./popupNotifcation.66c3e9dd.js";import"./Link.82df400a.js";import"./DocsButton.vue_vue_type_script_setup_true_lang.aee5d1fe.js";import"./Paragraph.bffb9dac.js";import"./Modal.ff9cdc66.js";import"./ant-design.2b0214de.js";import"./index.d38d9f1b.js";import"./index.b25a8e2d.js";import"./index.f8cee946.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]="0479a845-1147-4c9b-ab06-314933efd940",n._sentryDebugIdIdentifier="sentry-dbid-0479a845-1147-4c9b-ab06-314933efd940")}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%"}},Ee=_({__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(([k,s,p])=>(s.updateInitialState("test_data",p),h({workspace:k,script:s})))),b=D.create();return(k,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(()=>[S("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)]),S("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(b),"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(b)},null,8,["log-service"])]),_:1}))}});export{Ee as default};
//# sourceMappingURL=ScriptEditor.382249c5.js.map
