import{E as e,Kt as t,Xt as n,qt as r,rn as i,sn as a,t as o,vn as s,x as c,yn as l}from"./useApi-CXAk43j3.js";import{t as u}from"./browser-DVDf39JZ.js";var d=e.extend({name:`progressspinner`,style:`
    .p-progressspinner {
        position: relative;
        margin: 0 auto;
        width: 100px;
        height: 100px;
        display: inline-block;
    }

    .p-progressspinner::before {
        content: '';
        display: block;
        padding-top: 100%;
    }

    .p-progressspinner-spin {
        height: 100%;
        transform-origin: center center;
        width: 100%;
        position: absolute;
        top: 0;
        bottom: 0;
        left: 0;
        right: 0;
        margin: auto;
        animation: p-progressspinner-rotate 2s linear infinite;
    }

    .p-progressspinner-circle {
        stroke-dasharray: 89, 200;
        stroke-dashoffset: 0;
        stroke: dt('progressspinner.colorOne');
        animation:
            p-progressspinner-dash 1.5s ease-in-out infinite,
            p-progressspinner-color 6s ease-in-out infinite;
        stroke-linecap: round;
    }

    @keyframes p-progressspinner-rotate {
        100% {
            transform: rotate(360deg);
        }
    }
    @keyframes p-progressspinner-dash {
        0% {
            stroke-dasharray: 1, 200;
            stroke-dashoffset: 0;
        }
        50% {
            stroke-dasharray: 89, 200;
            stroke-dashoffset: -35px;
        }
        100% {
            stroke-dasharray: 89, 200;
            stroke-dashoffset: -124px;
        }
    }
    @keyframes p-progressspinner-color {
        100%,
        0% {
            stroke: dt('progressspinner.color.one');
        }
        40% {
            stroke: dt('progressspinner.color.two');
        }
        66% {
            stroke: dt('progressspinner.color.three');
        }
        80%,
        90% {
            stroke: dt('progressspinner.color.four');
        }
    }
`,classes:{root:`p-progressspinner`,spin:`p-progressspinner-spin`,circle:`p-progressspinner-circle`}}),f={name:`ProgressSpinner`,extends:{name:`BaseProgressSpinner`,extends:c,props:{strokeWidth:{type:String,default:`2`},fill:{type:String,default:`none`},animationDuration:{type:String,default:`2s`}},style:d,provide:function(){return{$pcProgressSpinner:this,$parentInstance:this}}},inheritAttrs:!1,computed:{svgStyle:function(){return{"animation-duration":this.animationDuration}}}},p=[`fill`,`stroke-width`];function m(e,t,o,s,c,l){return a(),n(`div`,i({class:e.cx(`root`),role:`progressbar`},e.ptmi(`root`)),[(a(),n(`svg`,i({class:e.cx(`spin`),viewBox:`25 25 50 50`,style:l.svgStyle},e.ptm(`spin`)),[r(`circle`,i({class:e.cx(`circle`),cx:`50`,cy:`50`,r:`20`,fill:e.fill,"stroke-width":e.strokeWidth,strokeMiterlimit:`10`},e.ptm(`circle`)),null,16,p)],16))],16)}f.render=m;var h=l(null),g=l(!1),_=l(null);function v(){let e=o();async function t(){g.value=!0,_.value=null;try{let{data:t,error:n}=await e.GET(`/api/contents`,{});n?_.value=`Failed to load contents`:h.value=t??null}finally{g.value=!1}}async function n(t){let{data:n,error:r}=await e.GET(`/api/contents/{path}`,{params:{path:{path:t}}});if(r)throw Error(`Failed to load path: ${t}`);return n}async function r(e){let t=await n(e);if(!t||t.type!==`file`||typeof t.content!=`string`)throw Error(`No file content for ${e}`);let r=t.content;return e.endsWith(`.ga`)?JSON.parse(r):u(r)}async function i(t,n,r){let i={name:r.name,path:r.path,type:r.type,writable:r.writable,created:r.created,last_modified:r.last_modified,size:null,mimetype:r.mimetype??null,format:`text`,content:n},{data:a,error:o}=await e.PUT(`/api/contents/{path}`,{params:{path:{path:t}},headers:{"If-Unmodified-Since":r.last_modified},body:i});if(o||!a)throw Error(o?.status===409?`Conflict: file was modified externally. Re-open to get the latest version.`:`Failed to save file`);return a}async function a(t){let{data:n,error:r}=await e.POST(`/api/contents/{path}/checkpoints`,{params:{path:{path:t}}});if(r||!n)throw Error(`Failed to create checkpoint`);return n}async function s(t,n){let{error:r}=await e.POST(`/api/contents/{path}/checkpoints/{checkpoint_id}`,{params:{path:{path:t,checkpoint_id:n}}});if(r)throw Error(`Failed to restore checkpoint`)}return{root:h,loading:g,error:_,fetchRoot:t,fetchPath:n,loadWorkflowContent:r,writeFile:i,createCheckpoint:a,restoreCheckpoint:s}}var y=s({});function b(e){return y[e]||(y[e]={results:{},loading:{},error:{}}),y[e]}function x(e){delete y[e]}function S(e,t){let n=y[e];if(n)for(let e of Object.keys(n.results))e!==t&&delete n.results[e]}function C(e){let n=o(),r=t(()=>b(e).results.validate??null),i=t(()=>b(e).results.lint??null),a=t(()=>b(e).results.clean??null),s=t(()=>b(e).results.roundtrip??null),c=t(()=>b(e).results.export??null),l=t(()=>b(e).results.convert??null),u=t(()=>b(e).loading.validate??!1),d=t(()=>b(e).loading.lint??!1),f=t(()=>b(e).loading.clean??!1),p=t(()=>b(e).loading.roundtrip??!1),m=t(()=>b(e).loading.export??!1),h=t(()=>b(e).loading.convert??!1),g=t(()=>b(e).error.validate??null),_=t(()=>b(e).error.lint??null),v=t(()=>b(e).error.clean??null),y=t(()=>b(e).error.roundtrip??null),x=t(()=>b(e).error.export??null),S=t(()=>b(e).error.convert??null);async function C(t={}){let r=b(e);r.loading.validate=!0,r.error.validate=null;try{let{data:i,error:a}=await n.POST(`/workflows/{workflow_path}/validate`,{params:{path:{workflow_path:e},query:{strict_structure:t.strict_structure??!1,strict_encoding:t.strict_encoding??!1,mode:t.mode??void 0,clean_first:t.clean_first??!1}}});a?r.error.validate=`Failed to validate workflow`:r.results.validate=i??null}finally{r.loading.validate=!1}}async function w(t={}){let r=b(e);r.loading.lint=!0,r.error.lint=null;try{let{data:i,error:a}=await n.POST(`/workflows/{workflow_path}/lint`,{params:{path:{workflow_path:e},query:{strict_structure:t.strict_structure??!1,strict_encoding:t.strict_encoding??!1}}});a?r.error.lint=`Failed to lint workflow`:r.results.lint=i??null}finally{r.loading.lint=!1}}async function T(t={}){let r=b(e);r.loading.clean=!0,r.error.clean=null;try{let{data:i,error:a}=await n.POST(`/workflows/{workflow_path}/clean`,{params:{path:{workflow_path:e},query:{dry_run:t.dry_run??!1}}});a?r.error.clean=`Failed to clean workflow`:r.results.clean=i??null}finally{r.loading.clean=!1}}async function E(t={}){let r=b(e);r.loading.roundtrip=!0,r.error.roundtrip=null;try{let{data:i,error:a}=await n.POST(`/workflows/{workflow_path}/roundtrip`,{params:{path:{workflow_path:e},query:{strict_structure:t.strict_structure??!1,strict_encoding:t.strict_encoding??!1,strict_state:t.strict_state??!1,include_content:!0}}});a?r.error.roundtrip=`Failed to run roundtrip`:r.results.roundtrip=i??null}finally{r.loading.roundtrip=!1}}async function D(t={}){let r=b(e);r.loading.export=!0,r.error.export=null;try{let{data:i,error:a}=await n.POST(`/workflows/{workflow_path}/export`,{params:{path:{workflow_path:e},query:{dry_run:t.dry_run??!1}}});a?r.error.export=`Failed to export workflow`:r.results.export=i??null}finally{r.loading.export=!1}}async function O(t={}){let r=b(e);r.loading.convert=!0,r.error.convert=null;try{let{data:i,error:a}=await n.POST(`/workflows/{workflow_path}/convert`,{params:{path:{workflow_path:e},query:{dry_run:t.dry_run??!1}}});a?r.error.convert=`Failed to convert workflow`:r.results.convert=i??null}finally{r.loading.convert=!1}}return{validateResult:r,lintResult:i,cleanResult:a,roundtripResult:s,exportResult:c,convertResult:l,validateLoading:u,lintLoading:d,cleanLoading:f,roundtripLoading:p,exportLoading:m,convertLoading:h,validateError:g,lintError:_,cleanError:v,roundtripError:y,exportError:x,convertError:S,runValidate:C,runLint:w,runClean:T,runRoundtrip:E,runExport:D,runConvert:O}}export{f as a,v as i,S as n,C as r,x as t};