import{S as Y,i as A,s as F,e as k,w as q,k as G,c as w,a as I,x as N,d as _,m as H,b as E,f as S,g as P,M as V,y as j,W as K,q as h,o as D,B as z,l as B,p as L,P as C,Q as M,X as R,Y as T,n as U,a8 as J}from"../../../chunks/index-e2bb409a.js";import{p as Z}from"../../../chunks/stores-9025718b.js";import{E as ee,a as te}from"../../../chunks/error-06511b87.js";import"../../../chunks/get-102ab8d2.js";import"../../../chunks/_baseGet-42226e95.js";import"../../../chunks/preload-helper-60cab3ee.js";function O(a){let o,r,e,t,l,f,i,u,m;function b(s){a[9](s)}let g={language:"json"};return a[0]!==void 0&&(g.value=a[0]),t=new ee({props:g}),R.push(()=>T(t,"value",b)),t.$on("save",a[10]),u=new te({props:{error:a[2]}}),{c(){o=k("div"),r=k("div"),e=k("div"),q(t.$$.fragment),f=G(),i=k("div"),q(u.$$.fragment),this.h()},l(s){o=w(s,"DIV",{class:!0,style:!0});var d=I(o);r=w(d,"DIV",{class:!0,style:!0});var c=I(r);e=w(c,"DIV",{class:!0});var p=I(e);N(t.$$.fragment,p),p.forEach(_),f=H(c),i=w(c,"DIV",{class:!0,style:!0});var v=I(i);N(u.$$.fragment,v),v.forEach(_),c.forEach(_),d.forEach(_),this.h()},h(){E(e,"class","w-full h-4/6"),E(i,"class","w-full h-2/6 border-t-2"),S(i,"border-color","#171812"),E(r,"class","w-8/12 border-r-2"),S(r,"border-color","#171812"),E(o,"class","flex flex-column h-screen"),S(o,"background-color","#272822")},m(s,d){P(s,o,d),V(o,r),V(r,e),j(t,e,null),V(r,f),V(r,i),j(u,i,null),m=!0},p(s,d){const c={};!l&&d&1&&(l=!0,c.value=s[0],K(()=>l=!1)),t.$set(c);const p={};d&4&&(p.error=s[2]),u.$set(p)},i(s){m||(h(t.$$.fragment,s),h(u.$$.fragment,s),m=!0)},o(s){D(t.$$.fragment,s),D(u.$$.fragment,s),m=!1},d(s){s&&_(o),z(t),z(u)}}}function re(a){let o,r,e=a[1]&&O(a);return{c(){e&&e.c(),o=B()},l(t){e&&e.l(t),o=B()},m(t,l){e&&e.m(t,l),P(t,o,l),r=!0},p(t,[l]){t[1]?e?(e.p(t,l),l&2&&h(e,1)):(e=O(t),e.c(),h(e,1),e.m(o.parentNode,o)):e&&(U(),D(e,1,1,()=>{e=null}),L())},i(t){r||(h(e),r=!0)},o(t){D(e),r=!1},d(t){e&&e.d(t),t&&_(o)}}}function se(a,o,r){let e,t,l,f;C(a,Z,n=>r(7,l=n));const i=M("stores").activeConfigIndex;C(a,i,n=>r(12,e=n));const u=M("stores").models;C(a,u,n=>r(8,f=n));const m=M("stores").activeClient;C(a,m,n=>r(13,t=n));const b=M("services");let g,s,d,c;async function p(n){!n||v(n)}function v(n){r(0,s=JSON.stringify(n,null,2)),g=s}async function $(n){try{if(n===g)return;r(2,d=null);const y=b.sanitize(b.parse(n)),{data:x}=await t.updateModel(y);console.log("Model updated",{version:x.version,model:x}),v(x),await t.createModelIndexes(y);const X=e;J(i,e=-1,e),J(i,e=X,e)}catch(y){r(2,d=y)}}function Q(n){s=n,r(0,s)}const W=()=>$(s);return a.$$.update=()=>{a.$$.dirty&386&&(c||r(1,c=f[l.params.model])),a.$$.dirty&3&&!s&&p(c)},[s,c,d,i,u,m,$,l,f,Q,W]}class ue extends Y{constructor(o){super(),A(this,o,se,re,F,{})}}export{ue as default};
