@babsey/code-graph 0.11.0 → 0.11.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1189,7 +1189,7 @@ const oi = /* @__PURE__ */ ni(ai), ii = (e) => ({
1189
1189
  ]) : (m(), y(se, { key: 1 }, [
1190
1190
  h("div", vi, [
1191
1191
  a.value.idx > -1 ? (m(), y("span", _i, X(a.value.idx + 1) + " - ", 1)) : K("", !0),
1192
- Ss(" " + X(a.value.title) + " " + X(a.value.graph.shortId) + " " + X(a.value.shortId), 1)
1192
+ Ss(" " + X(a.value.title), 1)
1193
1193
  ]),
1194
1194
  h("div", yi, [
1195
1195
  a.value.isCodeNode ? (m(), y(se, { key: 0 }, [
@@ -1807,7 +1807,7 @@ const Ks = /* @__PURE__ */ B(hl, [["render", ml]]), rf = /* @__PURE__ */ Object.
1807
1807
  TextareaInputInterface: Ks
1808
1808
  }, Symbol.toStringTag, { value: "Module" })), vl = (e, t) => {
1809
1809
  switch (e) {
1810
- case "CheckBoxInterface":
1810
+ case "CheckboxInterface":
1811
1811
  return new gl(t.id, !!t.value);
1812
1812
  case "IntegerInterface":
1813
1813
  return new nr(
@@ -1927,8 +1927,9 @@ class bl extends le {
1927
1927
  class En extends kt {
1928
1928
  min;
1929
1929
  max;
1930
- constructor(t, n, s, r) {
1931
- super(t, n), this.min = s, this.max = r, this.use(wt, Qs);
1930
+ step;
1931
+ constructor(t, n, s, r, a) {
1932
+ super(t, n), this.min = s, this.max = r, this.step = a, this.use(wt, Qs);
1932
1933
  }
1933
1934
  validate(t) {
1934
1935
  return (this.min === void 0 || t >= this.min) && (this.max === void 0 || t <= this.max);
@@ -1972,6 +1973,7 @@ class Ml extends En {
1972
1973
  componentName = "SliderInterface";
1973
1974
  min = 0;
1974
1975
  max = 1;
1976
+ step = 0.01;
1975
1977
  getValue = () => `${Math.round(this.value * 1e3) / 1e3}`;
1976
1978
  }
1977
1979
  class Bt extends Rn {
@@ -1,4 +1,4 @@
1
- (function(m,r){typeof exports=="object"&&typeof module<"u"?r(exports,require("vue"),require("@baklavajs/renderer-vue"),require("@baklavajs/core"),require("@vueuse/core"),require("mustache"),require("uuid"),require("@baklavajs/interface-types"),require("@baklavajs/engine"),require("toposort"),require("@baklavajs/events")):typeof define=="function"&&define.amd?define(["exports","vue","@baklavajs/renderer-vue","@baklavajs/core","@vueuse/core","mustache","uuid","@baklavajs/interface-types","@baklavajs/engine","toposort","@baklavajs/events"],r):(m=typeof globalThis<"u"?globalThis:m||self,r(m["@babsey/code-graph"]={},m.vue,m["@baklavajs/renderer-vue"],m["@baklavajs/core"],m["@vueuse/core"],m.mustache,m.uuid,m["@baklavajs/interface-types"],m["@baklavajs/engine"],m.toposort,m["@baklavajs/events"]))})(this,(function(m,r,T,re,Qn,Ve,Ie,X,Ze,Ha,es){"use strict";const j=(e,t)=>{const n=e.__vccOpts||e;for(const[s,a]of t)n[s]=a;return n},Ga={},za={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"baklava-icon icon icon-tabler icons-tabler-outline icon-tabler-check"};function qa(e,t){return r.openBlock(),r.createElementBlock("svg",za,[...t[0]||(t[0]=[r.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),r.createElementVNode("path",{d:"M5 12l5 5l10 -10"},null,-1)])])}const ts=j(Ga,[["render",qa]]),Za={},Ka={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"baklava-icon icon icon-tabler icons-tabler-outline icon-tabler-chevron-down"};function Xa(e,t){return r.openBlock(),r.createElementBlock("svg",Ka,[...t[0]||(t[0]=[r.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none",style:{fill:"none",stroke:"none"}},null,-1),r.createElementVNode("path",{d:"M6 9l6 6l6 -6",fill:"none",style:{fill:"none"}},null,-1)])])}const ns=j(Za,[["render",Xa]]),Ja={},Qa={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"baklava-icon icon icon-tabler icons-tabler-outline icon-tabler-code-variable"};function er(e,t){return r.openBlock(),r.createElementBlock("svg",Qa,[...t[0]||(t[0]=[r.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),r.createElementVNode("path",{d:"M4 8m0 2a2 2 0 0 1 2 -2h12a2 2 0 0 1 2 2v4a2 2 0 0 1 -2 2h-12a2 2 0 0 1 -2 -2z"},null,-1)])])}const ss=j(Ja,[["render",er]]),tr={},nr={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"baklava-icon icon icon-tabler icons-tabler-outline icon-tabler-copy"};function sr(e,t){return r.openBlock(),r.createElementBlock("svg",nr,[...t[0]||(t[0]=[r.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),r.createElementVNode("path",{d:"M7 7m0 2.667a2.667 2.667 0 0 1 2.667 -2.667h8.666a2.667 2.667 0 0 1 2.667 2.667v8.666a2.667 2.667 0 0 1 -2.667 2.667h-8.666a2.667 2.667 0 0 1 -2.667 -2.667z"},null,-1),r.createElementVNode("path",{d:"M4.012 16.737a2.005 2.005 0 0 1 -1.012 -1.737v-10c0 -1.1 .9 -2 2 -2h10c.75 0 1.158 .385 1.5 1"},null,-1)])])}const as=j(tr,[["render",sr]]),ar={},rr={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"baklava-icon icon icon-tabler icons-tabler-outline icon-tabler-dots-vertical"};function or(e,t){return r.openBlock(),r.createElementBlock("svg",rr,[...t[0]||(t[0]=[r.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),r.createElementVNode("path",{d:"M12 12m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0"},null,-1),r.createElementVNode("path",{d:"M12 19m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0"},null,-1),r.createElementVNode("path",{d:"M12 5m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0"},null,-1)])])}const rs=j(ar,[["render",or]]),ir={},lr={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"baklava-icon icon icon-tabler icons-tabler-outline icon-tabler-download"};function dr(e,t){return r.openBlock(),r.createElementBlock("svg",lr,[...t[0]||(t[0]=[r.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),r.createElementVNode("path",{d:"M4 17v2a2 2 0 0 0 2 2h12a2 2 0 0 0 2 -2v-2"},null,-1),r.createElementVNode("path",{d:"M7 11l5 5l5 -5"},null,-1),r.createElementVNode("path",{d:"M12 4l0 12"},null,-1)])])}const os=j(ir,[["render",dr]]),cr={},ur={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"currentColor",class:"baklava-icon icon icon-tabler icons-tabler-filled icon-tabler-layout-sidebar-left-collapse"};function hr(e,t){return r.openBlock(),r.createElementBlock("svg",ur,[...t[0]||(t[0]=[r.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),r.createElementVNode("path",{d:"M18 3a3 3 0 0 1 2.995 2.824l.005 .176v12a3 3 0 0 1 -2.824 2.995l-.176 .005h-12a3 3 0 0 1 -2.995 -2.824l-.005 -.176v-12a3 3 0 0 1 2.824 -2.995l.176 -.005h12zm0 2h-9v14h9a1 1 0 0 0 .993 -.883l.007 -.117v-12a1 1 0 0 0 -.883 -.993l-.117 -.007zm-2.293 4.293a1 1 0 0 1 .083 1.32l-.083 .094l-1.292 1.293l1.292 1.293a1 1 0 0 1 .083 1.32l-.083 .094a1 1 0 0 1 -1.32 .083l-.094 -.083l-2 -2a1 1 0 0 1 -.083 -1.32l.083 -.094l2 -2a1 1 0 0 1 1.414 0z"},null,-1)])])}const fr=j(cr,[["render",hr]]),pr={},mr={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"currentColor",class:"baklava-icon icon icon-tabler icons-tabler-filled icon-tabler-layout-sidebar-left-expand"};function yr(e,t){return r.openBlock(),r.createElementBlock("svg",mr,[...t[0]||(t[0]=[r.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),r.createElementVNode("path",{d:"M18 3a3 3 0 0 1 2.995 2.824l.005 .176v12a3 3 0 0 1 -2.824 2.995l-.176 .005h-12a3 3 0 0 1 -2.995 -2.824l-.005 -.176v-12a3 3 0 0 1 2.824 -2.995l.176 -.005h12zm0 2h-9v14h9a1 1 0 0 0 .993 -.883l.007 -.117v-12a1 1 0 0 0 -.883 -.993l-.117 -.007zm-4.387 4.21l.094 .083l2 2a1 1 0 0 1 .083 1.32l-.083 .094l-2 2a1 1 0 0 1 -1.497 -1.32l.083 -.094l1.292 -1.293l-1.292 -1.293a1 1 0 0 1 -.083 -1.32l.083 -.094a1 1 0 0 1 1.32 -.083z"},null,-1)])])}const _r=j(pr,[["render",yr]]),gr={},kr={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"currentColor",class:"baklava-icon icon icon-tabler icons-tabler-filled icon-tabler-layout-sidebar-right"};function br(e,t){return r.openBlock(),r.createElementBlock("svg",kr,[...t[0]||(t[0]=[r.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),r.createElementVNode("path",{d:"M6 21a3 3 0 0 1 -3 -3v-12a3 3 0 0 1 3 -3h12a3 3 0 0 1 3 3v12a3 3 0 0 1 -3 3zm8 -16h-8a1 1 0 0 0 -1 1v12a1 1 0 0 0 1 1h8z"},null,-1)])])}const wr=j(gr,[["render",br]]),vr={},Nr={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"currentColor",class:"baklava-icon icon icon-tabler icons-tabler-filled icon-tabler-layout-sidebar-right-collapse"};function Cr(e,t){return r.openBlock(),r.createElementBlock("svg",Nr,[...t[0]||(t[0]=[r.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),r.createElementVNode("path",{d:"M18 3a3 3 0 0 1 2.995 2.824l.005 .176v12a3 3 0 0 1 -2.824 2.995l-.176 .005h-12a3 3 0 0 1 -2.995 -2.824l-.005 -.176v-12a3 3 0 0 1 2.824 -2.995l.176 -.005h12zm-3 2h-9a1 1 0 0 0 -.993 .883l-.007 .117v12a1 1 0 0 0 .883 .993l.117 .007h9v-14zm-5.387 4.21l.094 .083l2 2a1 1 0 0 1 .083 1.32l-.083 .094l-2 2a1 1 0 0 1 -1.497 -1.32l.083 -.094l1.292 -1.293l-1.292 -1.293a1 1 0 0 1 -.083 -1.32l.083 -.094a1 1 0 0 1 1.32 -.083z"},null,-1)])])}const is=j(vr,[["render",Cr]]),Sr={},Mr={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"currentColor",class:"baklava-icon icon icon-tabler icons-tabler-filled icon-tabler-layout-sidebar-right-expand"};function Or(e,t){return r.openBlock(),r.createElementBlock("svg",Mr,[...t[0]||(t[0]=[r.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),r.createElementVNode("path",{d:"M18 3a3 3 0 0 1 2.995 2.824l.005 .176v12a3 3 0 0 1 -2.824 2.995l-.176 .005h-12a3 3 0 0 1 -2.995 -2.824l-.005 -.176v-12a3 3 0 0 1 2.824 -2.995l.176 -.005h12zm-3 2h-9a1 1 0 0 0 -.993 .883l-.007 .117v12a1 1 0 0 0 .883 .993l.117 .007h9v-14zm-3.293 4.293a1 1 0 0 1 .083 1.32l-.083 .094l-1.292 1.293l1.292 1.293a1 1 0 0 1 .083 1.32l-.083 .094a1 1 0 0 1 -1.32 .083l-.094 -.083l-2 -2a1 1 0 0 1 -.083 -1.32l.083 -.094l2 -2a1 1 0 0 1 1.414 0z"},null,-1)])])}const jt=j(Sr,[["render",Or]]),Er={},Tr={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"baklava-icon icon icon-tabler icons-tabler-outline icon-tabler-lock-code"};function Ir(e,t){return r.openBlock(),r.createElementBlock("svg",Tr,[...t[0]||(t[0]=[r.createStaticVNode('<path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M11.5 21h-4.5a2 2 0 0 1 -2 -2v-6a2 2 0 0 1 2 -2h10a2 2 0 0 1 2 2"></path><path d="M11 16a1 1 0 1 0 2 0a1 1 0 0 0 -2 0"></path><path d="M8 11v-4a4 4 0 1 1 8 0v4"></path><path d="M20 21l2 -2l-2 -2"></path><path d="M17 17l-2 2l2 2"></path>',6)])])}const Ht=j(Er,[["render",Ir]]),Dr={},xr={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"baklava-icon icon icon-tabler icons-tabler-outline icon-tabler-player-play"};function Yr(e,t){return r.openBlock(),r.createElementBlock("svg",xr,[...t[0]||(t[0]=[r.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),r.createElementVNode("path",{d:"M7 4v16l13 -8z"},null,-1)])])}const Rr=j(Dr,[["render",Yr]]),Br={},Vr={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"baklava-icon icon icon-tabler icons-tabler-outline icon-tabler-plus"};function Pr(e,t){return r.openBlock(),r.createElementBlock("svg",Vr,[...t[0]||(t[0]=[r.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),r.createElementVNode("path",{d:"M12 5l0 14"},null,-1),r.createElementVNode("path",{d:"M5 12l14 0"},null,-1)])])}const ls=j(Br,[["render",Pr]]),Lr={},Ar={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"baklava-icon icon icon-tabler icons-tabler-outline icon-tabler-restore"};function $r(e,t){return r.openBlock(),r.createElementBlock("svg",Ar,[...t[0]||(t[0]=[r.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),r.createElementVNode("path",{d:"M3.06 13a9 9 0 1 0 .49 -4.087"},null,-1),r.createElementVNode("path",{d:"M3 4.001v5h5"},null,-1),r.createElementVNode("path",{d:"M12 12m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0"},null,-1)])])}const ds=j(Lr,[["render",$r]]),Ur={},Fr={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"baklava-icon icon icon-tabler icons-tabler-outline icon-tabler-schema"};function Wr(e,t){return r.openBlock(),r.createElementBlock("svg",Fr,[...t[0]||(t[0]=[r.createStaticVNode('<path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M5 2h5v4h-5z"></path><path d="M15 10h5v4h-5z"></path><path d="M5 18h5v4h-5z"></path><path d="M5 10h5v4h-5z"></path><path d="M10 12h5"></path><path d="M7.5 6v4"></path><path d="M7.5 14v4"></path>',8)])])}const cs=j(Ur,[["render",Wr]]),jr={},Hr={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"baklava-icon icon icon-tabler icons-tabler-outline icon-tabler-schema-off"};function Gr(e,t){return r.openBlock(),r.createElementBlock("svg",Hr,[...t[0]||(t[0]=[r.createStaticVNode('<path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M6 2h4v4m-4 0h-1v-1"></path><path d="M15 11v-1h5v4h-2"></path><path d="M5 18h5v4h-5z"></path><path d="M5 10h5v4h-5z"></path><path d="M10 12h2"></path><path d="M7.5 7.5v2.5"></path><path d="M7.5 14v4"></path><path d="M3 3l18 18"></path>',9)])])}const us=j(jr,[["render",Gr]]),zr={},qr={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"baklava-icon icon icon-tabler icons-tabler-outline icon-tabler-transition-bottom"};function Zr(e,t){return r.openBlock(),r.createElementBlock("svg",qr,[...t[0]||(t[0]=[r.createStaticVNode('<path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M21 18a3 3 0 0 1 -3 3h-12a3 3 0 0 1 -3 -3"></path><path d="M3 3m0 3a3 3 0 0 1 3 -3h12a3 3 0 0 1 3 3v0a3 3 0 0 1 -3 3h-12a3 3 0 0 1 -3 -3z"></path><path d="M12 9v8"></path><path d="M9 14l3 3l3 -3"></path>',5)])])}const hs=j(zr,[["render",Zr]]),Kr={},Xr={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"baklava-icon icon icon-tabler icons-tabler-outline icon-tabler-upload"};function Jr(e,t){return r.openBlock(),r.createElementBlock("svg",Xr,[...t[0]||(t[0]=[r.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),r.createElementVNode("path",{d:"M4 17v2a2 2 0 0 0 2 2h12a2 2 0 0 0 2 -2v-2"},null,-1),r.createElementVNode("path",{d:"M7 9l5 -5l5 5"},null,-1),r.createElementVNode("path",{d:"M12 4l0 12"},null,-1)])])}const fs=j(Kr,[["render",Jr]]),Qr={},eo={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"baklava-icon icon icon-tabler icons-tabler-outline icon-tabler-x"};function to(e,t){return r.openBlock(),r.createElementBlock("svg",eo,[...t[0]||(t[0]=[r.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),r.createElementVNode("path",{d:"M18 6l-12 12"},null,-1),r.createElementVNode("path",{d:"M6 6l12 12"},null,-1)])])}const ps=j(Qr,[["render",to]]),no=Object.freeze(Object.defineProperty({__proto__:null,Check:ts,ChevronDown:ns,CodeVariable:ss,Copy:as,DotsVertical:rs,Download:os,LayoutSidebarLeftCollapse:fr,LayoutSidebarLeftExpand:_r,LayoutSidebarRight:wr,LayoutSidebarRightCollapse:is,LayoutSidebarRightExpand:jt,LockCode:Ht,PlayerPlay:Rr,Plus:ls,Restore:ds,Schema:cs,SchemaOff:us,TransitionBottom:hs,Upload:fs,X:ps},Symbol.toStringTag,{value:"Module"}));function so(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var ht={exports:{}};var ao=ht.exports,ms;function ro(){return ms||(ms=1,(function(e,t){(function(s,a){e.exports=a()})(ao,function(){return(function(){var n={686:(function(o,i,l){l.d(i,{default:function(){return G}});var d=l(279),c=l.n(d),u=l(370),_=l.n(u),p=l(817),I=l.n(p);function k(w){try{return document.execCommand(w)}catch{return!1}}var S=function(N){var v=I()(N);return k("cut"),v},f=S;function b(w){var N=document.documentElement.getAttribute("dir")==="rtl",v=document.createElement("textarea");v.style.fontSize="12pt",v.style.border="0",v.style.padding="0",v.style.margin="0",v.style.position="absolute",v.style[N?"right":"left"]="-9999px";var O=window.pageYOffset||document.documentElement.scrollTop;return v.style.top="".concat(O,"px"),v.setAttribute("readonly",""),v.value=w,v}var A=function(N,v){var O=b(N);v.container.appendChild(O);var D=I()(O);return k("copy"),O.remove(),D},R=function(N){var v=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{container:document.body},O="";return typeof N=="string"?O=A(N,v):N instanceof HTMLInputElement&&!["text","search","url","tel","password"].includes(N?.type)?O=A(N.value,v):(O=I()(N),k("copy")),O},W=R;function Se(w){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Se=function(v){return typeof v}:Se=function(v){return v&&typeof Symbol=="function"&&v.constructor===Symbol&&v!==Symbol.prototype?"symbol":typeof v},Se(w)}var Me=function(){var N=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},v=N.action,O=v===void 0?"copy":v,D=N.container,B=N.target,ce=N.text;if(O!=="copy"&&O!=="cut")throw new Error('Invalid "action" value, use either "copy" or "cut"');if(B!==void 0)if(B&&Se(B)==="object"&&B.nodeType===1){if(O==="copy"&&B.hasAttribute("disabled"))throw new Error('Invalid "target" attribute. Please use "readonly" instead of "disabled" attribute');if(O==="cut"&&(B.hasAttribute("readonly")||B.hasAttribute("disabled")))throw new Error(`Invalid "target" attribute. You can't cut text from elements with "readonly" or "disabled" attributes`)}else throw new Error('Invalid "target" value, use a valid Element');if(ce)return W(ce,{container:D});if(B)return O==="cut"?f(B):W(B,{container:D})},ct=Me;function me(w){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?me=function(v){return typeof v}:me=function(v){return v&&typeof Symbol=="function"&&v.constructor===Symbol&&v!==Symbol.prototype?"symbol":typeof v},me(w)}function M(w,N){if(!(w instanceof N))throw new TypeError("Cannot call a class as a function")}function Z(w,N){for(var v=0;v<N.length;v++){var O=N[v];O.enumerable=O.enumerable||!1,O.configurable=!0,"value"in O&&(O.writable=!0),Object.defineProperty(w,O.key,O)}}function ee(w,N,v){return N&&Z(w.prototype,N),v&&Z(w,v),w}function Xn(w,N){if(typeof N!="function"&&N!==null)throw new TypeError("Super expression must either be null or a function");w.prototype=Object.create(N&&N.prototype,{constructor:{value:w,writable:!0,configurable:!0}}),N&&ut(w,N)}function ut(w,N){return ut=Object.setPrototypeOf||function(O,D){return O.__proto__=D,O},ut(w,N)}function $t(w){var N=Ft();return function(){var O=Be(w),D;if(N){var B=Be(this).constructor;D=Reflect.construct(O,arguments,B)}else D=O.apply(this,arguments);return Ut(this,D)}}function Ut(w,N){return N&&(me(N)==="object"||typeof N=="function")?N:Jn(w)}function Jn(w){if(w===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return w}function Ft(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch{return!1}}function Be(w){return Be=Object.setPrototypeOf?Object.getPrototypeOf:function(v){return v.__proto__||Object.getPrototypeOf(v)},Be(w)}function qe(w,N){var v="data-clipboard-".concat(w);if(N.hasAttribute(v))return N.getAttribute(v)}var $=(function(w){Xn(v,w);var N=$t(v);function v(O,D){var B;return M(this,v),B=N.call(this),B.resolveOptions(D),B.listenClick(O),B}return ee(v,[{key:"resolveOptions",value:function(){var D=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.action=typeof D.action=="function"?D.action:this.defaultAction,this.target=typeof D.target=="function"?D.target:this.defaultTarget,this.text=typeof D.text=="function"?D.text:this.defaultText,this.container=me(D.container)==="object"?D.container:document.body}},{key:"listenClick",value:function(D){var B=this;this.listener=_()(D,"click",function(ce){return B.onClick(ce)})}},{key:"onClick",value:function(D){var B=D.delegateTarget||D.currentTarget,ce=this.action(B)||"copy",Wt=ct({action:ce,container:this.container,target:this.target(B),text:this.text(B)});this.emit(Wt?"success":"error",{action:ce,text:Wt,trigger:B,clearSelection:function(){B&&B.focus(),window.getSelection().removeAllRanges()}})}},{key:"defaultAction",value:function(D){return qe("action",D)}},{key:"defaultTarget",value:function(D){var B=qe("target",D);if(B)return document.querySelector(B)}},{key:"defaultText",value:function(D){return qe("text",D)}},{key:"destroy",value:function(){this.listener.destroy()}}],[{key:"copy",value:function(D){var B=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{container:document.body};return W(D,B)}},{key:"cut",value:function(D){return f(D)}},{key:"isSupported",value:function(){var D=arguments.length>0&&arguments[0]!==void 0?arguments[0]:["copy","cut"],B=typeof D=="string"?[D]:D,ce=!!document.queryCommandSupported;return B.forEach(function(Wt){ce=ce&&!!document.queryCommandSupported(Wt)}),ce}}]),v})(c()),G=$}),828:(function(o){var i=9;if(typeof Element<"u"&&!Element.prototype.matches){var l=Element.prototype;l.matches=l.matchesSelector||l.mozMatchesSelector||l.msMatchesSelector||l.oMatchesSelector||l.webkitMatchesSelector}function d(c,u){for(;c&&c.nodeType!==i;){if(typeof c.matches=="function"&&c.matches(u))return c;c=c.parentNode}}o.exports=d}),438:(function(o,i,l){var d=l(828);function c(p,I,k,S,f){var b=_.apply(this,arguments);return p.addEventListener(k,b,f),{destroy:function(){p.removeEventListener(k,b,f)}}}function u(p,I,k,S,f){return typeof p.addEventListener=="function"?c.apply(null,arguments):typeof k=="function"?c.bind(null,document).apply(null,arguments):(typeof p=="string"&&(p=document.querySelectorAll(p)),Array.prototype.map.call(p,function(b){return c(b,I,k,S,f)}))}function _(p,I,k,S){return function(f){f.delegateTarget=d(f.target,I),f.delegateTarget&&S.call(p,f)}}o.exports=u}),879:(function(o,i){i.node=function(l){return l!==void 0&&l instanceof HTMLElement&&l.nodeType===1},i.nodeList=function(l){var d=Object.prototype.toString.call(l);return l!==void 0&&(d==="[object NodeList]"||d==="[object HTMLCollection]")&&"length"in l&&(l.length===0||i.node(l[0]))},i.string=function(l){return typeof l=="string"||l instanceof String},i.fn=function(l){var d=Object.prototype.toString.call(l);return d==="[object Function]"}}),370:(function(o,i,l){var d=l(879),c=l(438);function u(k,S,f){if(!k&&!S&&!f)throw new Error("Missing required arguments");if(!d.string(S))throw new TypeError("Second argument must be a String");if(!d.fn(f))throw new TypeError("Third argument must be a Function");if(d.node(k))return _(k,S,f);if(d.nodeList(k))return p(k,S,f);if(d.string(k))return I(k,S,f);throw new TypeError("First argument must be a String, HTMLElement, HTMLCollection, or NodeList")}function _(k,S,f){return k.addEventListener(S,f),{destroy:function(){k.removeEventListener(S,f)}}}function p(k,S,f){return Array.prototype.forEach.call(k,function(b){b.addEventListener(S,f)}),{destroy:function(){Array.prototype.forEach.call(k,function(b){b.removeEventListener(S,f)})}}}function I(k,S,f){return c(document.body,k,S,f)}o.exports=u}),817:(function(o){function i(l){var d;if(l.nodeName==="SELECT")l.focus(),d=l.value;else if(l.nodeName==="INPUT"||l.nodeName==="TEXTAREA"){var c=l.hasAttribute("readonly");c||l.setAttribute("readonly",""),l.select(),l.setSelectionRange(0,l.value.length),c||l.removeAttribute("readonly"),d=l.value}else{l.hasAttribute("contenteditable")&&l.focus();var u=window.getSelection(),_=document.createRange();_.selectNodeContents(l),u.removeAllRanges(),u.addRange(_),d=u.toString()}return d}o.exports=i}),279:(function(o){function i(){}i.prototype={on:function(l,d,c){var u=this.e||(this.e={});return(u[l]||(u[l]=[])).push({fn:d,ctx:c}),this},once:function(l,d,c){var u=this;function _(){u.off(l,_),d.apply(c,arguments)}return _._=d,this.on(l,_,c)},emit:function(l){var d=[].slice.call(arguments,1),c=((this.e||(this.e={}))[l]||[]).slice(),u=0,_=c.length;for(u;u<_;u++)c[u].fn.apply(c[u].ctx,d);return this},off:function(l,d){var c=this.e||(this.e={}),u=c[l],_=[];if(u&&d)for(var p=0,I=u.length;p<I;p++)u[p].fn!==d&&u[p].fn._!==d&&_.push(u[p]);return _.length?c[l]=_:delete c[l],this}},o.exports=i,o.exports.TinyEmitter=i})},s={};function a(o){if(s[o])return s[o].exports;var i=s[o]={exports:{}};return n[o](i,i.exports,a),i.exports}return(function(){a.n=function(o){var i=o&&o.__esModule?function(){return o.default}:function(){return o};return a.d(i,{a:i}),i}})(),(function(){a.d=function(o,i){for(var l in i)a.o(i,l)&&!a.o(o,l)&&Object.defineProperty(o,l,{enumerable:!0,get:i[l]})}})(),(function(){a.o=function(o,i){return Object.prototype.hasOwnProperty.call(o,i)}})(),a(686)})().default})})(ht)),ht.exports}var oo=ro();const io=so(oo),lo=e=>({toClipboard(t,n){return new Promise((s,a)=>{const o=document.createElement("button"),i=new io(o,{text:()=>t,action:()=>"copy",container:n!==void 0?n:document.body});i.on("success",l=>{i.destroy(),s(l)}),i.on("error",l=>{i.destroy(),a(l)}),document.body.appendChild(o),o.click(),document.body.removeChild(o)})}}),co={key:0,class:"baklava-button"},ys=r.defineComponent({__name:"CopyToClipboard",props:{text:String},setup(e){const{toClipboard:t}=lo(),n=e,s=r.toRef(n,"text"),a=r.ref(!1),o=async()=>{try{await t(s.value),a.value=!0,setTimeout(()=>a.value=!1,1500),console.log("Copied to clipboard")}catch(i){console.error(i)}};return(i,l)=>(r.openBlock(),r.createElementBlock("div",null,[a.value?(r.openBlock(),r.createElementBlock("button",co,[r.createVNode(r.unref(ts))])):(r.openBlock(),r.createElementBlock("button",{key:1,onClick:o,class:"baklava-button"},[r.createVNode(r.unref(as))]))]))}}),uo={class:"code-editor"},ho={class:"code-buttons"},fo=r.defineComponent({__name:"CodeEditor",props:r.mergeModels({locked:{type:Boolean},extensions:{}},{modelValue:{required:!0},modelModifiers:{}}),emits:r.mergeModels(["update:locked"],["update:modelValue"]),setup(e,{emit:t}){const n=r.useModel(e,"modelValue"),s=t,a=o=>s("update:locked",o);return(o,i)=>{const l=r.resolveComponent("codemirror");return r.openBlock(),r.createElementBlock("div",uo,[r.createElementVNode("div",ho,[e.locked?(r.openBlock(),r.createElementBlock("button",{key:0,class:"baklava-button",title:"The code is locked.",onClick:i[0]||(i[0]=d=>a(!1))},[r.createVNode(r.unref(Ht))])):r.createCommentVNode("",!0),r.createVNode(ys,{text:e.modelValue},null,8,["text"])]),r.createVNode(l,{modelValue:n.value,"onUpdate:modelValue":i[1]||(i[1]=d=>n.value=d),extensions:e.extensions,class:"codemirror",style:{height:"100%"},onKeydown:i[2]||(i[2]=d=>a(!0))},null,8,["modelValue","extensions"])])}}}),po=r.defineComponent({__name:"CodeGraphEditor",props:{viewModel:{}},setup(e){const t=e,n=r.toRef(t,"viewModel"),s=a=>a.events.update.emit(null);return r.onMounted(n.value.onMounted),r.onBeforeUnmount(n.value.onBeforeUnmount),r.watch(n,(a,o)=>{o&&o.onBeforeUnmount(),a&&a.onMounted()}),(a,o)=>(r.openBlock(),r.createBlock(r.unref(T.BaklavaEditor),{viewModel:n.value},{palette:r.withCtx(()=>[r.createVNode(r.unref(ws))]),node:r.withCtx(i=>[r.createVNode(r.unref(_s),r.mergeProps(i,{onUpdate:l=>s(i.node)}),null,16,["onUpdate"])]),sidebar:r.withCtx(i=>[r.createVNode(r.unref(gs),r.normalizeProps(r.guardReactiveProps(i)),{codeEditor:r.withCtx(({node:l})=>[r.renderSlot(a.$slots,"sidebarCodeEditor",{node:l})]),_:3},16)]),_:3},8,["viewModel"]))}}),mo={class:"code-graph-info"},yo=r.defineComponent({__name:"CodeGraphInfo",props:{viewModel:{}},setup(e){return(t,n)=>(r.openBlock(),r.createElementBlock("div",mo,[r.createElementVNode("div",null,"Editor graph: "+r.toDisplayString(e.viewModel.editor.graph.shortId),1),r.createElementVNode("div",null,"Displayed graph: "+r.toDisplayString(e.viewModel.displayedGraph.shortId),1),r.createElementVNode("div",null,"Graphs: "+r.toDisplayString(e.viewModel.editor.graphIds),1),r.createElementVNode("div",null,"Graph templates: "+r.toDisplayString(e.viewModel.editor.graphTemplateIds),1),r.createElementVNode("div",null,"Engine status: "+r.toDisplayString(e.viewModel.engine?.status),1)]))}}),_o=["data-node-type","id"],go={class:"__title-label",style:{"flex-grow":"1"}},ko={key:0},bo={class:"__menu",style:{display:"flex"}},wo={class:"__outputs"},vo={key:0},No=["id","title"],Co={class:"__inputs"},So={key:0},Mo=["id","title"],_s=r.defineComponent({__name:"CodeGraphNode",props:{node:{},selected:{type:Boolean,default:!1},dragging:{type:Boolean}},emits:["select","start-drag","update"],setup(e,{emit:t}){const n=T.Components.ContextMenu,s=T.Components.NodeInterface,a=e,o=r.computed(()=>a.node),i=t,{viewModel:l}=T.useViewModel(),{graph:d,switchGraph:c}=T.useGraph(),u=r.ref(null),_=r.ref(!1),p=r.ref(""),I=r.ref(null),k=r.ref(!1);let S=0,f=0;const b=r.ref(!1),A=r.computed(()=>{const $=[{value:"edit",label:"Edit"},{value:"rename",label:"Rename"},{value:"delete",label:"Delete"}];return a.node.type.startsWith(re.GRAPH_NODE_TYPE_PREFIX)&&$.push({value:"editSubgraph",label:"Edit Subgraph"}),$}),R=r.computed(()=>({"--selected":a.selected,"--dragging":a.dragging,"--two-column":!!a.node.twoColumn,"--hidden":o.value.state?.hidden})),W=r.computed(()=>({"--reverse-y":a.node.reverseY??l.value.settings.nodes.reverseY})),Se=r.computed(()=>({top:`${a.node.position?.y??0}px`,left:`${a.node.position?.x??0}px`,"--width":`${a.node.width??l.value.settings.nodes.defaultWidth}px`})),Me=r.computed(()=>Object.values(a.node.inputs).filter($=>!$.hidden)),ct=r.computed(()=>Object.values(a.node.outputs).filter($=>!$.hidden)),me=()=>{Xn(),i("select")},M=$=>{a.selected||me(),i("start-drag",$)},Z=()=>{b.value=!0},ee=()=>{const $=l.value.displayedGraph.sidebar;$.nodeId=a.node.id,$.visible=!0},Xn=()=>{const $=l.value.displayedGraph.sidebar;$.nodeId=a.node.id},ut=async $=>{switch($){case"edit":ee();break;case"delete":d.value.removeNode(a.node);break;case"rename":p.value=a.node.title,_.value=!0,await r.nextTick(),I.value?.focus();break;case"editSubgraph":c(a.node.template);break}},$t=()=>{o.value.title=p.value,o.value.events.titleChanged.emit(o.value.title),_.value=!1},Ut=()=>{u.value&&l.value.hooks.renderNode.execute({node:a.node,el:u.value})},Jn=$=>{k.value=!0,S=a.node.width,f=$.clientX,$.preventDefault()},Ft=$=>{o.value.state&&(o.value.state.integrated=$,i("update"))},Be=$=>{if(!k.value)return;const G=$.clientX-f,w=S+G/d.value.scaling,N=l.value.settings.nodes.minWidth,v=l.value.settings.nodes.maxWidth;o.value.width=Math.max(N,Math.min(v,w))},qe=()=>{k.value=!1};return r.onMounted(()=>{Ut(),window.addEventListener("mousemove",Be),window.addEventListener("mouseup",qe)}),r.onUpdated(Ut),r.onBeforeUnmount(()=>{window.removeEventListener("mousemove",Be),window.removeEventListener("mouseup",qe)}),($,G)=>(r.openBlock(),r.createElementBlock("div",{class:r.normalizeClass([R.value,"baklava-node"]),"data-node-type":o.value.type,id:o.value.id,style:r.normalizeStyle(Se.value),ref_key:"el",ref:u,onPointerdown:me},[r.unref(l).settings.nodes.resizable?(r.openBlock(),r.createElementBlock("div",{key:0,class:"__resize-handle",onMousedown:Jn},null,32)):r.createCommentVNode("",!0),r.createElementVNode("div",{class:"__title",onPointerdown:r.withModifiers(M,["self","stop"]),onContextmenu:r.withModifiers(Z,["prevent"])},[o.value.inputs._code?(r.openBlock(),r.createBlock(r.unref(Gt),{key:0,intf:o.value.inputs._code,node:o.value,title:o.value.inputs._code.value,class:"--input","data-interface-type":"node",style:{"flex-grow":"0"}},null,8,["intf","node","title"])):r.createCommentVNode("",!0),_.value?r.withDirectives((r.openBlock(),r.createElementBlock("input",{key:2,ref_key:"renameInputEl",ref:I,"onUpdate:modelValue":G[4]||(G[4]=w=>p.value=w),class:"baklava-input",placeholder:"Title",style:{"flex-grow":"1"},type:"text",onBlur:$t,onKeydown:r.withKeys($t,["enter"])},null,544)),[[r.vModelText,p.value]]):(r.openBlock(),r.createElementBlock(r.Fragment,{key:1},[r.createElementVNode("div",go,[o.value.idx>-1?(r.openBlock(),r.createElementBlock("span",ko,r.toDisplayString(o.value.idx+1)+" - ",1)):r.createCommentVNode("",!0),r.createTextVNode(" "+r.toDisplayString(o.value.title)+" "+r.toDisplayString(o.value.graph.shortId)+" "+r.toDisplayString(o.value.shortId),1)]),r.createElementVNode("div",bo,[o.value.isCodeNode?(r.openBlock(),r.createElementBlock(r.Fragment,{key:0},[o.value.state.lockCode?(r.openBlock(),r.createBlock(r.unref(Ht),{key:0,class:"--clickable mx-1",onClick:G[0]||(G[0]=w=>o.value.lockCode=!1)})):r.createCommentVNode("",!0),o.value.isSelected&&!r.unref(l).displayedGraph.sidebar.visible?(r.openBlock(),r.createBlock(r.unref(jt),{key:1,class:"--clickable mx-1",onClick:ee})):r.createCommentVNode("",!0),o.value.hasConnectedOutputNodes?(r.openBlock(),r.createElementBlock(r.Fragment,{key:2},[o.value.state.integrated?(r.openBlock(),r.createBlock(r.unref(ss),{key:1,class:"--clickable mx-1",onClick:G[2]||(G[2]=w=>Ft(!1))})):(r.openBlock(),r.createBlock(r.unref(hs),{key:0,class:"--clickable mx-1",onClick:G[1]||(G[1]=w=>Ft(!0))}))],64)):r.createCommentVNode("",!0)],64)):r.createCommentVNode("",!0),r.createVNode(r.unref(rs),{class:"--clickable mx-1",onClick:Z}),r.createVNode(r.unref(n),{modelValue:b.value,"onUpdate:modelValue":G[3]||(G[3]=w=>b.value=w),x:0,y:0,items:A.value,onClick:ut},null,8,["modelValue","items"])])],64)),o.value.outputs._code?(r.openBlock(),r.createBlock(r.unref(Gt),{key:3,node:o.value,intf:o.value.outputs._code,class:"--output",title:o.value.outputs._code.value,"data-interface-type":"node"},null,8,["node","intf","title"])):r.createCommentVNode("",!0)],32),r.createElementVNode("div",{class:r.normalizeClass(["__content",W.value]),onKeydown:G[5]||(G[5]=r.withKeys(r.withModifiers(()=>{},["stop"]),["delete"])),onContextmenu:G[6]||(G[6]=r.withModifiers(()=>{},["prevent"]))},[r.createElementVNode("div",wo,[(r.openBlock(!0),r.createElementBlock(r.Fragment,null,r.renderList(ct.value,w=>(r.openBlock(),r.createElementBlock(r.Fragment,{key:w.id},[o.value.state?.hidden?(r.openBlock(),r.createElementBlock("div",vo,[w.port?(r.openBlock(),r.createElementBlock("div",{key:0,id:w.id,title:w.name,class:"baklava-node-interface --output --connected"},[...G[7]||(G[7]=[r.createElementVNode("div",{class:"__port"},null,-1)])],8,No)):r.createCommentVNode("",!0)])):r.renderSlot($.$slots,"nodeInterface",{key:1,type:"output",node:o.value,intf:w},()=>[r.createVNode(r.unref(s),{node:o.value,intf:w,title:w.value},null,8,["node","intf","title"])])],64))),128))]),r.createElementVNode("div",Co,[(r.openBlock(!0),r.createElementBlock(r.Fragment,null,r.renderList(Me.value,w=>(r.openBlock(),r.createElementBlock(r.Fragment,{key:w.id},[o.value.state?.hidden?(r.openBlock(),r.createElementBlock("div",So,[w.port?(r.openBlock(),r.createElementBlock("div",{key:0,id:w.id,title:w.name,class:"baklava-node-interface --input --connected"},[...G[8]||(G[8]=[r.createElementVNode("div",{class:"__port"},null,-1)])],8,Mo)):r.createCommentVNode("",!0)])):r.renderSlot($.$slots,"nodeInterface",{key:1,node:o.value,intf:w,type:"input"},()=>[r.createVNode(r.unref(s),{node:o.value,intf:w,title:w.value},null,8,["node","intf","title"])])],64))),128))])],34)],46,_o))}}),Oo=["id"],Eo={class:"align-middle"},Gt=r.defineComponent({__name:"CodeGraphNodeInterface",props:{node:{},intf:{}},setup(e){const t=e,{viewModel:n}=T.useViewModel(),{hoveredOver:s,temporaryConnection:a}=T.useTemporaryConnection(),o=r.ref(null),i=r.computed(()=>t.intf.connectionCount>0),l=r.computed(()=>({"--connected":i.value})),d=()=>{s(t.intf)},c=()=>{s(void 0)},u=()=>{o.value&&n.value.hooks.renderInterface.execute({intf:t.intf,el:o.value})};return r.onMounted(u),r.onUpdated(u),(_,p)=>(r.openBlock(),r.createElementBlock("div",{id:e.intf.id,ref_key:"el",ref:o,class:r.normalizeClass(["baklava-node-interface",l.value])},[e.intf.port?(r.openBlock(),r.createElementBlock("div",{key:0,class:r.normalizeClass([{"--selected":r.unref(a)?.from===e.intf},"__port"]),onPointerover:d,onPointerout:c},null,34)):r.createCommentVNode("",!0),r.createElementVNode("span",Eo,[r.renderSlot(_.$slots,"default")])],10,Oo))}}),To=["title"],Io={key:0,class:"__label"},zt=r.defineComponent({__name:"SidebarCheckbox",props:{disabled:{type:Boolean},inversed:{type:Boolean},modelValue:{type:Boolean},name:{}},emits:["update:modelValue"],setup(e,{emit:t}){const n=t;return(s,a)=>(r.openBlock(),r.createElementBlock("div",{class:r.normalizeClass(["baklava-checkbox",{"--checked":e.inversed?!e.modelValue:e.modelValue,"--disabled":e.disabled}]),title:e.name,onClick:a[0]||(a[0]=o=>n("update:modelValue",!e.modelValue))},[a[1]||(a[1]=r.createElementVNode("div",{class:"__checkmark-container"},[r.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",viewBox:"0 0 18 18"},[r.createElementVNode("path",{class:"__checkmark",d:"M 6 5 L 6 10 L 16 10",transform:"rotate(-45 10 10)"})])],-1)),e.name?(r.openBlock(),r.createElementBlock("div",Io,r.toDisplayString(e.name),1)):r.createCommentVNode("",!0)],10,To))}}),Do={class:"__header"},xo={class:"__node-name"},Yo={class:"__interfaces"},Ro={class:"__inputs"},Bo={style:{display:"flex"}},Vo={class:"__outputs"},Po={key:0,class:"__interface"},Lo=["placeholder"],Ao={style:{display:"flex"}},gs=r.defineComponent({__name:"CodeGraphSidebar",setup(e){const{viewModel:t}=T.useViewModel(),{graph:n}=T.useGraph(),s=r.ref(null),a=r.toRef(t.value.settings.sidebar,"width"),o=r.computed(()=>t.value.settings.sidebar.resizable);let i=0,l=0;const d=r.computed(()=>{const b=n.value.sidebar.nodeId;return n.value.nodes.find(A=>A.id===b)}),c=r.computed(()=>d.value),u=r.computed(()=>({width:`${a.value}px`})),_=r.computed(()=>c.value?Object.values(c.value.inputs).filter(b=>b.displayInSidebar&&b.component):[]),p=r.computed(()=>c.value?Object.values(c.value.outputs).filter(b=>b.displayInSidebar&&b.component):[]),I=()=>{n.value.sidebar.visible=!1},k=()=>{d.value&&(d.value.state.variableNameNumberAppendix=c.value.state.variableName.length===0,d.value.events.update.emit(null))},S=b=>{i=a.value,l=b.clientX,window.addEventListener("mousemove",f),window.addEventListener("mouseup",()=>{window.removeEventListener("mousemove",f)},{once:!0})},f=b=>{const A=s.value?.parentElement?.getBoundingClientRect().width??500,R=b.clientX-l;let W=i-R;W<300?W=300:W>.9*A&&(W=.9*A),a.value=W};return(b,A)=>(r.openBlock(),r.createElementBlock("div",{class:r.normalizeClass([{"--open":r.unref(n).sidebar.visible},"baklava-sidebar"]),style:r.normalizeStyle(u.value),ref_key:"el",ref:s},[o.value?(r.openBlock(),r.createElementBlock("div",{key:0,class:"__resizer",onMousedown:S},null,32)):r.createCommentVNode("",!0),d.value?(r.openBlock(),r.createElementBlock(r.Fragment,{key:1},[r.createElementVNode("div",Do,[r.createElementVNode("button",{tabindex:"-1",class:"__close",onClick:I},"×"),r.createElementVNode("div",xo,[r.createElementVNode("b",null,r.toDisplayString(d.value.title),1)])]),r.createElementVNode("div",Yo,[r.createElementVNode("div",Ro,[(r.openBlock(!0),r.createElementBlock(r.Fragment,null,r.renderList(_.value,R=>(r.openBlock(),r.createElementBlock("div",{key:R.id,class:"__interface"},[r.createElementVNode("div",Bo,[R.hidden!=null?(r.openBlock(),r.createBlock(zt,{key:0,modelValue:R.hidden,"onUpdate:modelValue":[W=>R.hidden=W,A[0]||(A[0]=()=>d.value?.events.update.emit(null))],disabled:!R.optional,inversed:"",style:{"padding-right":"8px"}},null,8,["modelValue","onUpdate:modelValue","disabled"])):r.createCommentVNode("",!0),(r.openBlock(),r.createBlock(r.resolveDynamicComponent(R.component),{modelValue:R.value,"onUpdate:modelValue":W=>R.value=W,node:d.value,intf:R,style:{width:"100%"}},null,8,["modelValue","onUpdate:modelValue","node","intf"]))])]))),128))]),r.createElementVNode("div",Vo,[c.value&&c.value.state?(r.openBlock(),r.createElementBlock("div",Po,[A[3]||(A[3]=r.createElementVNode("label",null,"Variable name",-1)),r.withDirectives(r.createElementVNode("input",{"onUpdate:modelValue":A[1]||(A[1]=R=>c.value.state.variableName=R),placeholder:c.value.variableName,type:"text",class:"baklava-input",title:"Variable name",onBlur:k,onKeydown:r.withKeys(k,["enter"])},null,40,Lo),[[r.vModelText,c.value.state.variableName]])])):r.createCommentVNode("",!0),(r.openBlock(!0),r.createElementBlock(r.Fragment,null,r.renderList(p.value,R=>(r.openBlock(),r.createElementBlock("div",{key:R.id,class:"__interface"},[r.createElementVNode("div",Ao,[R.hidden!=null?(r.openBlock(),r.createBlock(zt,{key:0,modelValue:R.hidden,"onUpdate:modelValue":[W=>R.hidden=W,A[2]||(A[2]=()=>d.value?.events.update.emit(null))],disabled:!R.optional,inversed:"",style:{"padding-right":"8px"}},null,8,["modelValue","onUpdate:modelValue","disabled"])):r.createCommentVNode("",!0),(r.openBlock(),r.createBlock(r.resolveDynamicComponent(R.component),{modelValue:R.value,"onUpdate:modelValue":W=>R.value=W,node:d.value,intf:R,style:{width:"100%"}},null,8,["modelValue","onUpdate:modelValue","node","intf"]))])]))),128))])]),r.renderSlot(b.$slots,"codeEditor",{node:d.value})],64)):r.createCommentVNode("",!0)],6))}});function ks(e,t){return Object.fromEntries(Object.entries(e).filter(t))}function bs(e,t){return Object.fromEntries(Object.entries(e).map(([n,s])=>[n,t(s)]))}const $o={class:"baklava-node --palette",style:{"margin-top":"-20px","margin-bottom":"20px"}},Uo={key:0,style:{display:"flex","justify-content":"space-between"}},Fo=["onClick"],Wo={key:0,style:{margin:"auto 0","font-size":"12px"}},ws=r.defineComponent({__name:"CodeNodePalette",setup(e){const t=T.Components.PaletteEntry,{viewModel:n}=T.useViewModel(),{x:s,y:a}=Qn.usePointer(),{transform:o}=T.useTransform(),i=T.useNodeCategories(n),l=r.inject("editorEl"),d=r.ref(""),c=r.ref(null),u=()=>d.value?i.value.filter(k=>k.name.toLowerCase().includes(d.value.toLowerCase())||Object.values(k.nodeTypes).some(S=>S.title.toLowerCase().includes(d.value.toLowerCase()))):i.value,_=k=>d.value?ks(k,S=>{const f=S[1];return f.category.includes(d.value.toLowerCase())||f.title?.toLowerCase().includes(d.value.toLowerCase())}):k,p=r.computed(()=>{if(!c.value||!l?.value)return{};const{left:k,top:S}=l.value.getBoundingClientRect();return{top:`${a.value-S}px`,left:`${s.value-k}px`}}),I=(k,S)=>{c.value={type:k,nodeInformation:S};const f=()=>{const b=r.reactive(new S.type);n.value.displayedGraph.addNode(b);const A=l.value.getBoundingClientRect(),[R,W]=o(s.value-A.left,a.value-A.top);b.position.x=R,b.position.y=W,c.value=null,document.removeEventListener("pointerup",f)};document.addEventListener("pointerup",f)};return(k,S)=>(r.openBlock(),r.createElementBlock(r.Fragment,null,[r.createElementVNode("div",{class:r.normalizeClass([{"--open":r.unref(n).settings.palette.enabled},"baklava-node-palette"]),onContextmenu:S[1]||(S[1]=r.withModifiers(()=>{},["stop","prevent"]))},[r.createElementVNode("div",$o,[r.withDirectives(r.createElementVNode("input",{"onUpdate:modelValue":S[0]||(S[0]=f=>d.value=f),type:"text",class:"baklava-input",title:"Filter nodes",onKeyup:u},null,544),[[r.vModelText,d.value]])]),(r.openBlock(!0),r.createElementBlock(r.Fragment,null,r.renderList(u(),f=>(r.openBlock(),r.createElementBlock("section",{key:f.name},[f.name!=="default"?(r.openBlock(),r.createElementBlock("h3",Uo,[r.createElementVNode("div",{onClick:b=>d.value=f.name,style:{cursor:"pointer"}},r.toDisplayString(f.name),9,Fo),Object.keys(_(f.nodeTypes)).length<Object.values(f.nodeTypes).length?(r.openBlock(),r.createElementBlock("div",Wo," ( "+r.toDisplayString(Object.keys(_(f.nodeTypes)).length)+" / "+r.toDisplayString(Object.values(f.nodeTypes).length)+" ) ",1)):r.createCommentVNode("",!0)])):r.createCommentVNode("",!0),(r.openBlock(!0),r.createElementBlock(r.Fragment,null,r.renderList(_(f.nodeTypes),(b,A)=>(r.openBlock(),r.createBlock(r.unref(t),{key:A,title:b.title,type:A,onPointerdown:R=>I(A,b)},null,8,["title","type","onPointerdown"]))),128))]))),128))],34),r.createVNode(r.Transition,{name:"fade"},{default:r.withCtx(()=>[c.value?(r.openBlock(),r.createElementBlock("div",{key:0,class:"baklava-dragged-node",style:r.normalizeStyle(p.value)},[r.createVNode(r.unref(t),{type:c.value.type,title:c.value.nodeInformation.title},null,8,["type","title"])],4)):r.createCommentVNode("",!0)]),_:1})],64))}}),jo={},Ho={class:"prependIcon"},Go={class:"appendIcon"};function zo(e,t){const n=r.resolveComponent("router-link");return r.openBlock(),r.createBlock(n,{class:"navItem"},{default:r.withCtx(()=>[r.createElementVNode("span",Ho,[r.renderSlot(e.$slots,"prependIcon")]),r.renderSlot(e.$slots,"default"),r.createElementVNode("span",Go,[r.renderSlot(e.$slots,"appendIcon")])]),_:3})}const qt=j(jo,[["render",zo]]),qo={class:"navbar"},Zo=["onClick"],Ko=r.defineComponent({__name:"NavBar",props:{viewModel:{},editorStates:{},routes:{}},emits:["click:remove"],setup(e,{emit:t}){const n=t,s=a=>{n("click:remove",a)};return(a,o)=>(r.openBlock(),r.createElementBlock("nav",qo,[r.renderSlot(a.$slots,"prepend"),(r.openBlock(!0),r.createElementBlock(r.Fragment,null,r.renderList(e.editorStates,i=>(r.openBlock(),r.createBlock(qt,{key:i.graph.id,class:r.normalizeClass({active:i.graph.id===e.viewModel.displayedGraph.id}),to:{name:e.routes?.edit??"edit",params:{editorId:i.graph.id}}},{appendIcon:r.withCtx(()=>[r.createElementVNode("button",{class:"remove",onClick:r.withModifiers(l=>s(i.graph.id),["prevent"])},[r.createVNode(r.unref(ps))],8,Zo)]),default:r.withCtx(()=>[r.createTextVNode(r.toDisplayString(i.graph.id.slice(0,6))+" ",1)]),_:2},1032,["class","to"]))),128)),r.renderSlot(a.$slots,"append",{},()=>[r.createVNode(qt,{to:{name:e.routes?.new??"new"},class:"navItem"},{default:r.withCtx(()=>[r.createVNode(r.unref(ls),{class:"plus"})]),_:1},8,["to"])])]))}}),Xo=["title"],ft=r.defineComponent({__name:"CodeNodeInterface",props:{intf:{}},setup(e){return(t,n)=>(r.openBlock(),r.createElementBlock("div",{title:e.intf.value},r.toDisplayString(e.intf.name),9,Xo))}}),Jo=r.defineComponent({props:{intf:{type:Object,required:!0},modelValue:{type:String,required:!0}},emits:["update:modelValue"],setup(e,{emit:t}){return{v:r.computed({get:()=>e.modelValue,set:s=>{t("update:modelValue",s)}})}}}),Qo={style:{position:"relative"}},ei={style:{"font-size":"12px",padding:"0 6px",position:"absolute",top:"-10px","background-color":"var(--baklava-node-color-background)"}},ti=["placeholder","title"];function ni(e,t,n,s,a,o){return r.openBlock(),r.createElementBlock("div",Qo,[r.createElementVNode("label",ei,r.toDisplayString(e.intf.name),1),r.withDirectives(r.createElementVNode("input",{"onUpdate:modelValue":t[0]||(t[0]=i=>e.v=i),type:"text",class:"baklava-input",placeholder:e.intf.name,title:e.intf.name},null,8,ti),[[r.vModelText,e.v]])])}const pt=j(Jo,[["render",ni]]),si=r.defineComponent({components:{"i-arrow":ns},props:{intf:{type:Object,required:!0}},setup(e){const t=r.ref(null),n=r.ref(!1),s=r.computed(()=>e.intf.items.find(i=>typeof i=="string"?i===e.intf.value:i.value===e.intf.value)),a=r.computed(()=>s.value?typeof s.value=="string"?s.value:s.value.text:""),o=i=>{e.intf.value=typeof i=="string"?i:i.value};return Qn.onClickOutside(t,()=>{n.value=!1}),{el:t,open:n,selectedItem:s,selectedText:a,setSelected:o}}}),ai=["title"],ri={style:{"font-size":"12px",padding:"0 6px",position:"absolute",top:"-10px","background-color":"var(--baklava-node-color-background)"}},oi={class:"__selected"},ii={class:"__text"},li={class:"__icon"},di={class:"__dropdown"},ci=["onClick"];function ui(e,t,n,s,a,o){const i=r.resolveComponent("i-arrow");return r.openBlock(),r.createElementBlock("div",{ref:"el",class:r.normalizeClass(["baklava-select",{"--open":e.open}]),title:e.intf.name,onClick:t[0]||(t[0]=l=>e.open=!e.open)},[r.createElementVNode("label",ri,r.toDisplayString(e.intf.name),1),r.createElementVNode("div",oi,[r.createElementVNode("div",ii,r.toDisplayString(e.selectedText),1),r.createElementVNode("div",li,[r.createVNode(i)])]),r.createVNode(r.Transition,{name:"slide-fade"},{default:r.withCtx(()=>[r.withDirectives(r.createElementVNode("div",di,[(r.openBlock(!0),r.createElementBlock(r.Fragment,null,r.renderList(e.intf.items,(l,d)=>(r.openBlock(),r.createElementBlock("div",{key:d,class:r.normalizeClass(["item",{"--active":l===e.selectedItem}]),onClick:c=>e.setSelected(l)},r.toDisplayString(typeof l=="string"?l:l.text),11,ci))),128))],512),[[r.vShow,e.open]])]),_:1})],10,ai)}const vs=j(si,[["render",ui]]),hi=r.defineComponent({props:{intf:{type:Object,required:!0},modelValue:{type:String,required:!0}},emits:["update:modelValue"],setup(e,{emit:t}){return{v:r.computed({get:()=>e.modelValue,set:s=>{t("update:modelValue",s)}})}}}),fi={style:{"font-size":"12px",padding:"0 6px",position:"absolute",top:"-6px","background-color":"var(--baklava-node-color-background)"}},pi=["placeholder","title"];function mi(e,t,n,s,a,o){return r.openBlock(),r.createElementBlock("div",null,[r.createElementVNode("label",fi,r.toDisplayString(e.intf.name),1),r.withDirectives(r.createElementVNode("textarea",{"onUpdate:modelValue":t[0]||(t[0]=i=>e.v=i),rows:"5",class:"baklava-input",placeholder:e.intf.name,title:e.intf.name},null,8,pi),[[r.vModelText,e.v]])])}const Ns=j(hi,[["render",mi]]),yi=Object.freeze(Object.defineProperty({__proto__:null,CodeEditor:fo,CodeGraphEditor:po,CodeGraphInfo:yo,CodeGraphNode:_s,CodeGraphNodeInterface:Gt,CodeGraphSidebar:gs,CodeNodeInterface:ft,CodeNodePalette:ws,CopyToClipboard:ys,NavBar:Ko,NavItem:qt,SelectInterface:vs,SidebarCheckbox:zt,TextInputInterface:pt,TextareaInputInterface:Ns},Symbol.toStringTag,{value:"Module"})),Cs=(e,t)=>{switch(e){case"CheckBoxInterface":return new Os(t.id,!!t.value);case"IntegerInterface":return new tn(t.id,Number(t.value),t.min,t.max);case"ListInputInterface":return new Ts(t.id,String(t.value));case"NumberInterface":return new nn(t.id,Number(t.value),t.min,t.max);case"SelectInterface":return new Is(t.id,t.value,t.items);case"SliderInterface":return new Ds(t.id,Number(t.value),t.min,t.max);case"TupleInputInterface":return new xs(t.id,String(t.value));default:return new Xe(t.id,String(t.value))}},Ss=(e,t=!0)=>{const n=[],s=Object.keys(e);return s.forEach(a=>{if(e[a]?.hidden)return;const i=t&&n.length<s.indexOf(a)?`${a}=`:"";n.push(`${i}{{ inputs.${a} }}`)}),n},Zt=new X.NodeInterfaceType("boolean"),Ms=new X.NodeInterfaceType("dict"),Kt=new X.NodeInterfaceType("list"),mt=new X.NodeInterfaceType("node"),Xt=new X.NodeInterfaceType("number"),Jt=new X.NodeInterfaceType("string"),Qt=new X.NodeInterfaceType("tuple"),_i=e=>{new X.BaklavaInterfaceTypes(e.editor,{viewPlugin:e}).addTypes(Zt,Ms,Kt,mt,Xt,Jt,Qt)};class J extends re.NodeInterface{component=r.markRaw(ft);isCodeNode=!0;code;componentName="";state=r.reactive({optional:!1});type=null;get optional(){return this.state.optional}get shortId(){return this.id.slice(0,6)}getValue=()=>`${this.value??"None"}`;load(t){this.id=t.id,this.templateId=t.templateId,!["_code","out"].includes(this.name)&&(this.value=t.value,this.hidden=t.hidden,t.component&&(this.componentName=t.component),t.optional&&(this.state.optional=t.optional),this.hooks.load.execute(t))}save(){const t={id:this.id,templateId:this.templateId,value:""};return["_code","out"].includes(this.name)||(t.value=this.value,t.hidden=this.hidden,this.componentName&&(t.component=this.componentName),this.state.optional&&(t.optional=this.state.optional)),this.hooks.save.execute(t)}setOptional(t){return this.state.optional=t,this.setHidden(t),this}}const Ke=e=>{e.addInput("_code",new J("_code",[]).use(X.setTypeForMultipleConnections,mt).use(Ze.allowMultipleConnections).setHidden(!0)),e.addOutput("_code",new J("_code",[]).use(X.setTypeForMultipleConnections,mt).use(Ze.allowMultipleConnections).setHidden(!0))};class Pe extends J{component=r.markRaw(ft);constructor(t="",n){super(t,n),this.use(T.displayInSidebar,!0)}get value(){return super.value}set value(t){super.value=t,this.name!=="_code"&&this.setHidden(!1)}}class Os extends Pe{component=r.markRaw(T.CheckboxInterfaceComponent);componentName="CheckboxInterface";constructor(t,n){super(t,n),this.use(X.setType,Zt)}getValue=()=>this.value?"True":"False"}class Es extends J{component=r.markRaw(ft);isCodeNodeOutput=!0;suffix="";constructor(t="",n=""){super(t,""),this.suffix=n}get codeValue(){return this.node?.outputs._code?.value??""}get node(){const{graph:t}=T.useGraph();return t.value.findNodeById(this.nodeId)}}class en extends Pe{min;max;constructor(t,n,s,a){super(t,n),this.min=s,this.max=a,this.use(X.setType,Xt)}validate(t){return(this.min===void 0||t>=this.min)&&(this.max===void 0||t<=this.max)}}class tn extends en{component=r.markRaw(T.IntegerInterfaceComponent);componentName="IntegerInterface";validate(t){return Number.isInteger(t)&&super.validate(t)}}class Ts extends Pe{component=r.markRaw(pt);componentName="ListInputInterface";constructor(t,n=""){super(t,n),this.use(X.setType,Kt)}getValue=()=>`[${this.value}]`}class nn extends en{component=r.markRaw(T.NumberInterfaceComponent);componentName="NumberInterface"}class sn extends Pe{constructor(t,n){super(t,n),this.use(X.setType,Jt)}getValue=()=>`"${this.value}"`}class Is extends sn{component=r.markRaw(vs);componentName="SelectInterface";items=[];constructor(t,n,s){super(t,n),s&&(this.items=s)}}class Ds extends en{component=r.markRaw(T.SliderInterfaceComponent);componentName="SliderInterface";min=0;max=1;getValue=()=>`${Math.round(this.value*1e3)/1e3}`}class Xe extends sn{component=r.markRaw(pt)}class gi extends sn{component=r.markRaw(Ns)}class xs extends Pe{component=r.markRaw(pt);componentName="TupleInputInterface";constructor(t,n=""){super(t,n),this.use(X.setType,Qt)}getValue=()=>`(${this.value})`}Ve.escape=e=>e;class an extends re.AbstractNode{_variableName="";codeTemplate;isCodeNode=!0;mask=null;name="";state;inputs={};outputs={};constructor(){super(),this.initializeIo(),this.twoColumn=!0,this.state=r.reactive({codeTemplate:"",hidden:!1,integrated:!1,lockCode:!1,modules:[],props:null,script:"",variableName:""}),this.codeTemplate=function(){return`${this.name}(${Ss(this.codeNodeInputs).join(", ")})`}}get code(){return this.graph.code}get codeNodeInputs(){return Object.fromEntries(Object.entries(this.inputs).filter(t=>t[1].isCodeNode&&t[1].type!="node"))}get codeNodeOutputs(){return Object.fromEntries(Object.entries(this.outputs).filter(t=>t[1].isCodeNode&&t[1].type!="node"))}get graph(){return super.graph}get hasConnectedOutputNodes(){return this.getConnectedNodes("outputs").length>0}get idx(){return this.graph.nodes.filter(t=>!t.state.integrated).indexOf(this)??-1}get idxByType(){return this.graph.getNodesByType(this.type).indexOf(this)??-1}get idxByVariableNames(){return this.graph.getNodesByVariableName(this._variableName).filter(t=>!t.state.integrated).indexOf(this)??-1}get isSelected(){return this.graph.selectedNodeIds.includes(this.id)}get lockCode(){return this.state.lockCode}set lockCode(t){this.state.lockCode=t,this.events.update.emit(null)}get optionalInputs(){return Object.fromEntries(Object.entries(this.codeNodeInputs).filter(t=>t[1].optional))}get requiredInputs(){return Object.fromEntries(Object.entries(this.codeNodeInputs).filter(t=>!t[1].optional))}get script(){return this.outputs._code?.value??""}set script(t){this.outputs._code&&(this.outputs._code.value=t),this.events.update.emit(null)}get shortId(){return this.id.slice(0,6)}get subgraph(){}get variableName(){return this.state.variableName||this._variableName?this.state.variableName||this._variableName+(this.idxByVariableNames+1):""}set variableName(t){this._variableName=t}getConnectedNodeByInterface(t,n){const s=this.getConnectedNodesByInterface(t,n);return s.length>0?s[0]:null}getConnectedNodes(t){let n=[];if(t!=="inputs"){const s=this.graph.connections.filter(a=>a.from.name!=="_code").filter(a=>a.from.nodeId===this.id).map(a=>a.to.nodeId);s&&(n=n.concat(s))}if(t!=="outputs"){const s=this.graph.connections.filter(a=>a.from.name!=="_code").filter(a=>a.to.nodeId===this.id).map(a=>a.from.nodeId);s&&(n=n.concat(s))}return!n||n.length==0?[]:n.map(s=>this.graph.findNodeById(s))}getConnectedNodesByInterface(t,n){let s=[];if(n!=="outputs"&&this.inputs[t]){const a=this.graph.connections.filter(o=>o.to.id===this.inputs[t]?.id||o.from.id===this.inputs[t]?.id).map(o=>o.from.nodeId);a&&(s=s.concat(a))}if(n!=="inputs"&&this.outputs[t]){const a=this.graph.connections.filter(o=>o.from.id===this.outputs[t]?.id||o.from.id===this.outputs[t]?.id).map(o=>o.to.nodeId);a&&(s=s.concat(a))}return!s||s.length==0?[]:s.map(a=>this.graph.findNodeById(a))}remove(){this.graph?.removeNode(this)}renderCode(t){return Object.keys(t.inputs).filter(n=>Array.isArray(t.inputs[n])&&n!=="_code").forEach(n=>{const s=[...t.inputs[n]];s.reverse(),t.inputs[n]=`[${s.join(", ")}]`}),Ve.render(this.state.codeTemplate,t)}updateCodeTemplate(){this.state.codeTemplate=this.codeTemplate.call(this)}updateModules(t){if(t)this.state.modules=t;else if(this.type.includes(".")){const n=this.type.split(".");this.state.modules.push(n.slice(0,n.length-1).join("."))}}updateOutputNames(){Object.values(this.codeNodeOutputs).forEach(t=>{t.name=this.state.integrated?"":this.variableName+t.suffix})}updateOutputValues(t){Object.keys(this.outputs).forEach(n=>{n!=="_code"&&(t[n]=this.state.integrated?t._code:this.outputs[n].name)})}updateProps(t){this.state.props=t}updateInputValues(t){const n=Object.keys(this.inputs);Object.keys(t).forEach(s=>{!n.includes(s)||!this.inputs[s]||(this.inputs[s].value=t[s],this.inputs[s].setHidden(!1))})}}class yt extends an{calculate=(t,n)=>{const s={};return this.lockCode||(s._code=this.renderCode({inputs:t,...n})),this.updateOutputValues(s),s};executeFactory(t,n){Object.keys(n||{}).forEach(s=>{const a=n[s]();t==="input"?this.addInput(s,a):this.addOutput(s,a)})}load(t){super.load(t),this.afterLoaded()}save(){return super.save()}}function ki(e){return class extends yt{type=e.type;inputs={};outputs={};constructor(){super(),this._title=e.title??e.type,this.executeFactory("input",e.inputs),this.executeFactory("output",e.outputs),e.calculate&&(this.calculate=(t,n)=>e.calculate.call(this,t,n)),e.onCreate?.call(this),this.name=e.name??e.type,this.updateModules(e.modules),e.codeTemplate&&(this.codeTemplate=e.codeTemplate),e.variableName!=null&&(this.variableName=e.variableName),Ke(this)}afterGraphLoaded(){e.afterGraphLoaded?.call(this)}afterLoaded(){e.afterLoaded?.call(this)}beforeRun(){e.beforeRun?.call(this)}onPlaced(){e.onPlaced?.call(this)}onConnected(){e.onConnected?.call(this)}onDestroy(){e.onDestroy?.call(this)}onUnconnected(){e.onUnconnected?.call(this)}update(){e.update?.call(this)}}}class Ys extends yt{}function bi(e){return class extends Ys{type=e.type;inputs={};outputs={};preventUpdate=!1;staticInputKeys=Object.keys(e.inputs??{});staticOutputKeys=Object.keys(e.outputs??{});constructor(){super(),this._title=e.title??e.type,this.executeFactory("input",e.inputs),this.executeFactory("output",e.outputs),e.calculate&&(this.calculate=(t,n)=>e.calculate?.call(this,t,n)),e.onCreate?.call(this),this.name=e.name??e.type,this.updateModules(e.modules),e.codeTemplate&&(this.codeTemplate=e.codeTemplate),e.variableName&&(this.variableName=e.variableName),Ke(this),this.staticInputKeys.push("_code"),this.staticOutputKeys.push("_code")}afterGraphLoaded(){e.afterGraphLoaded?.call(this)}afterLoaded(){e.afterLoaded?.call(this)}beforeRun(){e.beforeRun?.call(this)}onPlaced(){this.events.update.subscribe(this,t=>{t&&(t.type==="input"&&this.staticInputKeys.includes(t.name)||t.type==="output"&&this.staticOutputKeys.includes(t.name))&&this.onUpdate()}),this.onUpdate(),e.onPlaced?.call(this)}onConnected(){e.onConnected?.call(this)}onDestroy(){e.onDestroy?.call(this)}onUnconnected(){e.onUnconnected?.call(this)}update(){e.update?.call(this)}load(t){this.preventUpdate=!0,this.hooks.beforeLoad.execute(t),this.id=t.id,this.title=t.title;for(const n of this.staticInputKeys)this.inputs[n].load(t.inputs[n]),this.inputs[n].nodeId=this.id;for(const n of this.staticOutputKeys)this.outputs[n].load(t.outputs[n]),this.outputs[n].nodeId=this.id;this.preventUpdate=!1,this.onUpdate(),this.preventUpdate=!0;for(const n of Object.keys(t.inputs))if(!(this.staticInputKeys.includes(n)||!t.inputs[n])){if(!this.inputs[n]){const s=t.inputs[n],a=s.value;let o;s.component?o=Cs(s.component,{...s,id:n}):typeof a=="number"?0<a&&a<1?o=new nn(n,Number(a)):o=new tn(n,Number(a)):o=new Xe(n,String(a)),o.use(T.displayInSidebar,!0),this.addInput(n,o)}this.inputs[n]&&(this.inputs[n].load(t.inputs[n]),this.inputs[n].nodeId=this.id)}for(const n of Object.keys(t.outputs))if(!(this.staticOutputKeys.includes(n)||!t.outputs[n])){if(!this.outputs[n]){const s=new Es(n);this.addOutput(n,s)}this.outputs[n]&&(this.outputs[n].load(t.outputs[n]),this.outputs[n].nodeId=this.id)}this.preventUpdate=!1,this.events.loaded.emit(this)}onUpdate(){if(!e.onUpdate||this.preventUpdate)return;this.graph&&this.graph.activeTransactions++;const t=this.getStaticValues(this.staticInputKeys,this.inputs),n=this.getStaticValues(this.staticOutputKeys,this.outputs),s=e.onUpdate.call(this,t,n);this.updateInterfaces("input",s.inputs??{},s.forceUpdateInputs??[]),this.updateInterfaces("output",s.outputs??{},s.forceUpdateOutputs??[]),this.graph&&this.graph.activeTransactions--}getStaticValues(t,n){const s={};for(const a of t)s[a]=n[a].value;return s}updateInputInterfaces(t={},n=[]){this.updateInterfaces("input",t,n)}updateInterfaces(t,n={},s=[]){const a=t==="input"?this.staticInputKeys:this.staticOutputKeys,o=t==="input"?this.inputs:this.outputs;for(const i of Object.keys(o))a.includes(i)||n[i]&&!s.includes(i)||(t==="input"?this.removeInput(i):this.removeOutput(i));for(const i of Object.keys(n)){if(o[i])continue;const l=n[i]();t==="input"?this.addInput(i,l):this.addOutput(i,l)}}updateProps(t){this.state.props=t,this.onUpdate()}}}Ve.escape=e=>e;class _t{_id;_state;viewModel;constructor(){this._id=Ie.v4(),this._state=r.reactive({lockCode:!1,modules:{},script:"",template:""})}get engine(){return this.viewModel?.engine}get graph(){return this.viewModel?.editor.graph}get id(){return this._id}get lockCode(){return this.state.lockCode}set lockCode(t){this.state.lockCode=t,t||this.engine?.runOnce({})}get modules(){const t=[];return this.graph?.codeNodes.filter(n=>n.state.modules?.length>0).forEach(n=>t.push(...n.state.modules)),t?(t.sort(),Array.from(new Set(t.map(n=>this.state.modules[n])))):[]}get script(){return this.state.script}get shortId(){return this.id.slice(0,6)}get state(){return this._state}clear(){this.state.script=""}async loadTemplate(t){t.then(n=>{this._state.template=n.default??""})}registerViewModel(t){this.viewModel=t}renderCode(t){this.state.script=Ve.render(this.state.template??"",t??{})}}class wi extends _t{constructor(){super(),this.loadTemplate(Promise.resolve().then(()=>Bu))}}class vi extends _t{constructor(){super(),this.loadTemplate(Promise.resolve().then(()=>Vu))}}const gt=350;class Le extends re.Graph{code=null;editor;_state=r.reactive({codeTemplate:"{{ #nodes }}{{ script }}{{ /nodes }}",lockCode:!1});constructor(t,n){super(t,n),this.editor=t,this.template=n,t.code&&(this.code=t.code)}get codeNodes(){return rn(this)}get connections(){return super.connections}set connections(t){this._connections=t}get nodeIds(){return this.nodes.map(t=>t.id)}get nodes(){return super.nodes}set nodes(t){this._nodes=t}get scriptedCodeNodes(){return this.nodes.filter(t=>!t.state?.integrated)}get selectedNodeIds(){return this.selectedNodes.map(t=>t.id)}get shortId(){return this.id.slice(0,6)}get state(){return this._state}get visibleNodes(){return this.nodes.filter(t=>!t.state?.hidden)}addNode(t,n){return t.state&&n&&(t.state.props=n),super.addNode(t)}addNodeAtCoordinates=(t,n={x:0,y:0},s)=>(this.addNode(t,s),t.position&&(t.position=n),t);addConnection(t,n){return t&&t?.name!=="_code"&&(t.hidden=!1),n&&n?.name!=="_code"&&(n.hidden=!1),super.addConnection(t,n)}beforeRun(){this.nodes.forEach(t=>t.beforeRun())}clear(){this.selectedNodes=[],this._nodes=[],this._connections=[]}findNodeByType(t){return this.nodes.find(n=>n.type===t)}getNodesByType(t){return this.nodes.filter(n=>n.type===t)}getNodesByVariableName(t){return this.nodes.filter(n=>[n.state.variableName,n._variableName].includes(t))}hasConnection(t,n){return this.connections.some(s=>s.from.id===t.id&&s.to.id===n.id)}load(t){const n=super.load(t);return this.nodes.forEach(s=>s.afterGraphLoaded()),n}renderCode(t){return Ve.render(this.state?.codeTemplate||"",t)}sortNodes(){if(!(this.nodes.length===0||this.connections.length===0))try{let t=this.nodeIds;const n=this.connections.filter(o=>t.includes(o.to.nodeId)&&t.includes(o.from.nodeId)).map(o=>[o.to.nodeId,o.from.nodeId]);t.reverse(),t=Ha.array(t,n),t.reverse();const s=this.nodes.map(o=>o.id).filter(o=>!t.includes(o));t=[...t,...s];const a=t.map(o=>this.findNodeById(o));a&&(this.nodes=a)}catch{console.warn("Failed to sort nodes.")}}sortNodesByRank(){if(this.nodes.length===0)return;const t=new Map;this.nodes.forEach(s=>{const a=this.editor.nodeTypes.get(s.type).orderRank;t.has(a)?t.set(a,[...t.get(a),s]):t.set(a,[s])});const n=Array.from(t.keys());n.sort((s,a)=>s-a),this.nodes=n.flatMap(s=>t.get(s))}}const rn=e=>{const t=[];return e.nodes.length===0||e.nodes.forEach(n=>{n&&(n.hasOwnProperty("subgraph")?t.push(...rn(n.subgraph)):n.hasOwnProperty("isCodeNode")&&t.push(n))}),t},Ni=(e=0,t=100)=>({x:e*(gt+70),y:t}),Ci=e=>{const t={...e.position};return t.x-=gt+70,t.y+=50,t},on="__baklava_SubgraphInputNode",ln="__baklava_SubgraphOutputNode";class Rs extends yt{graphInterfaceId;constructor(){super(),this.graphInterfaceId=Ie.v4(),Ke(this),this.variableName="s"}onPlaced(){super.onPlaced(),this.initializeIo()}load(t){super.load(t),this.graphInterfaceId=t.graphInterfaceId}save(){return{...super.save(),graphInterfaceId:this.graphInterfaceId}}afterGraphLoaded(){}afterLoaded(){}beforeRun(){}onConnected(){}onUnconnected(){}update(){}}class dn extends Rs{static isGraphInputNode(t){return t.type===on}type=on;inputs={name:new J("Name","Input")};outputs={placeholder:new J("Value",void 0)}}class cn extends Rs{static isGraphOutputNode(t){return t.type===ln}type=ln;inputs={name:new J("Name","Output"),placeholder:new J("Value",void 0)};outputs={output:new J("Output",void 0).setHidden(!0)};calculate=({placeholder:t})=>({output:t})}class un extends dn{_title="Subgraph Input";inputs={name:new Xe("Name","Input").setPort(!1)};outputs={placeholder:new J("Connection",void 0)}}class hn extends cn{_title="Subgraph Output";inputs={name:new Xe("Name","Output").setPort(!1),placeholder:new J("Connection",void 0)};outputs={output:new J("Output",void 0).setHidden(!0)}}const Bs="CREATE_SUBGRAPH",Vs=[re.GRAPH_INPUT_NODE_TYPE,re.GRAPH_OUTPUT_NODE_TYPE];function Ps(e,t,n){const s=()=>e.value.selectedNodes.filter(o=>!Vs.includes(o.type)).length>0,a=()=>{const{viewModel:o}=T.useViewModel(),i=e.value,l=e.value.editor;if(i.selectedNodes.length===0)return;const d=i.selectedNodes.filter(M=>!Vs.includes(M.type)),c=d.flatMap(M=>Object.values(M.inputs)),u=d.flatMap(M=>Object.values(M.outputs)),_=i.connections.filter(M=>!u.includes(M.from)&&c.includes(M.to)),p=i.connections.filter(M=>u.includes(M.from)&&!c.includes(M.to)),I=i.connections.filter(M=>u.includes(M.from)&&c.includes(M.to)),k=d.map(M=>M.save()),S=I.map(M=>({id:M.id,from:M.from.id,to:M.to.id})),f=new Map,{xLeft:b,xRight:A,yTop:R}=Si(d);for(const[M,Z]of _.entries()){const ee=new un;ee.inputs.name.value=Z.to.name,k.push({...ee.save(),position:{x:A-o.value.settings.nodes.defaultWidth-100,y:R+M*200}}),S.push({id:Ie.v4(),from:ee.outputs.placeholder.id,to:Z.to.id}),f.set(Z.to.id,ee.graphInterfaceId)}for(const[M,Z]of p.entries()){const ee=new hn;ee.inputs.name.value=Z.from.name,k.push({...ee.save(),position:{x:b+100,y:R+M*200}}),S.push({id:Ie.v4(),from:Z.from.id,to:ee.inputs.placeholder.id}),f.set(Z.from.id,ee.graphInterfaceId)}const W=r.reactive(new dt({connections:S,nodes:k,inputs:[],outputs:[]},l));l.addGraphTemplate(W);const Se=l.nodeTypes.get(re.getGraphNodeTypeString(W));if(!Se)throw new Error("Unable to create subgraph: Could not find corresponding graph node type");i.activeTransactions++;const Me=r.reactive(new Se.type);i.addNode(Me);const ct=Math.round(d.map(M=>M.position.x).reduce((M,Z)=>M+Z,0)/d.length),me=Math.round(d.map(M=>M.position.y).reduce((M,Z)=>M+Z,0)/d.length);Me.position.x=ct,Me.position.y=me,_.forEach(M=>{i.removeConnection(M),i.addConnection(M.from,Me.inputs[f.get(M.to.id)])}),p.forEach(M=>{i.removeConnection(M),i.addConnection(Me.outputs[f.get(M.from.id)],M.to)}),d.forEach(M=>i.removeNode(M)),i.activeTransactions--,t.canExecuteCommand(T.Commands.SAVE_SUBGRAPH_COMMAND)&&t.executeCommand(T.Commands.SAVE_SUBGRAPH_COMMAND),n(W),e.value.panning={...i.panning},e.value.scaling=i.scaling};t.registerCommand(Bs,{canExecute:s,execute:a})}function Si(e){const t=e.reduce((a,o)=>{const i=o.position.x;return i<a?i:a},1/0),n=e.reduce((a,o)=>{const i=o.position.y;return i<a?i:a},1/0);return{xLeft:e.reduce((a,o)=>{const i=o.position.x+o.width;return i>a?i:a},-1/0),xRight:t,yTop:n}}const Mi=["component","connectionCount","events","hidden","hooks","id","isCodeNode","isInput","name","nodeId","port","templateId","value"];function Ls(e){return class extends an{type=re.getGraphNodeTypeString(e);get title(){return this._title}set title(n){this.template.name=n}inputs={};outputs={};template=e;subgraph;calculate=async(n,s)=>{if(!this.subgraph)throw new Error(`GraphNode ${this.id}: calculate called without subgraph being initialized`);if(!s.engine||typeof s.engine!="object")throw new Error(`GraphNode ${this.id}: calculate called but no engine provided in context`);const a=s.engine.getInputValues(this.subgraph);for(const l of this.subgraph.inputs)a.set(l.nodeInterfaceId,n[l.id]);const o=await s.engine.runGraph(this.subgraph,a,s.globalValues);s.engine.pause(),Ze.applyResult(o,s.engine.editor),s.engine.resume();const i={};for(const l of this.subgraph.outputs)i[l.id]=o.get(l.nodeId)?.get("output");return i._calculationResults=o,this.lockCode||(i._code=this.renderCode({inputs:n,...s.globalValues})),this.updateOutputValues(i),i};load(n){if(!this.subgraph)throw new Error("Cannot load a graph node without a graph");if(!this.template)throw new Error("Unable to load graph node without graph template");this.subgraph.load(n.graphState),super.load(n)}save(){if(!this.subgraph)throw new Error("Cannot save a graph node without a graph");return{...super.save(),graphState:this.subgraph.save()}}onPlaced(){this.template.events.updated.subscribe(this,()=>this.initialize()),this.template.events.nameChanged.subscribe(this,n=>{this._title=n}),this.initialize()}onDestroy(){this.template.events.updated.unsubscribe(this),this.template.events.nameChanged.unsubscribe(this),this.subgraph?.destroy()}initialize(){this.subgraph&&this.subgraph.destroy(),this.subgraph=this.template.createGraph(),this._title=this.template.name;const n=this.template.nodes.find(s=>s.type==="__baklava_SubgraphOutputNode");this.variableName=n?.inputs.name?.value??"s",this.updateInterfaces(),this.state.codeTemplate=`{{ #nodes }}{{ script }}
1
+ (function(m,r){typeof exports=="object"&&typeof module<"u"?r(exports,require("vue"),require("@baklavajs/renderer-vue"),require("@baklavajs/core"),require("@vueuse/core"),require("mustache"),require("uuid"),require("@baklavajs/interface-types"),require("@baklavajs/engine"),require("toposort"),require("@baklavajs/events")):typeof define=="function"&&define.amd?define(["exports","vue","@baklavajs/renderer-vue","@baklavajs/core","@vueuse/core","mustache","uuid","@baklavajs/interface-types","@baklavajs/engine","toposort","@baklavajs/events"],r):(m=typeof globalThis<"u"?globalThis:m||self,r(m["@babsey/code-graph"]={},m.vue,m["@baklavajs/renderer-vue"],m["@baklavajs/core"],m["@vueuse/core"],m.mustache,m.uuid,m["@baklavajs/interface-types"],m["@baklavajs/engine"],m.toposort,m["@baklavajs/events"]))})(this,(function(m,r,T,re,Qn,Ve,Ie,X,Ze,Ha,es){"use strict";const j=(e,t)=>{const n=e.__vccOpts||e;for(const[s,a]of t)n[s]=a;return n},Ga={},za={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"baklava-icon icon icon-tabler icons-tabler-outline icon-tabler-check"};function qa(e,t){return r.openBlock(),r.createElementBlock("svg",za,[...t[0]||(t[0]=[r.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),r.createElementVNode("path",{d:"M5 12l5 5l10 -10"},null,-1)])])}const ts=j(Ga,[["render",qa]]),Za={},Ka={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"baklava-icon icon icon-tabler icons-tabler-outline icon-tabler-chevron-down"};function Xa(e,t){return r.openBlock(),r.createElementBlock("svg",Ka,[...t[0]||(t[0]=[r.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none",style:{fill:"none",stroke:"none"}},null,-1),r.createElementVNode("path",{d:"M6 9l6 6l6 -6",fill:"none",style:{fill:"none"}},null,-1)])])}const ns=j(Za,[["render",Xa]]),Ja={},Qa={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"baklava-icon icon icon-tabler icons-tabler-outline icon-tabler-code-variable"};function er(e,t){return r.openBlock(),r.createElementBlock("svg",Qa,[...t[0]||(t[0]=[r.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),r.createElementVNode("path",{d:"M4 8m0 2a2 2 0 0 1 2 -2h12a2 2 0 0 1 2 2v4a2 2 0 0 1 -2 2h-12a2 2 0 0 1 -2 -2z"},null,-1)])])}const ss=j(Ja,[["render",er]]),tr={},nr={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"baklava-icon icon icon-tabler icons-tabler-outline icon-tabler-copy"};function sr(e,t){return r.openBlock(),r.createElementBlock("svg",nr,[...t[0]||(t[0]=[r.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),r.createElementVNode("path",{d:"M7 7m0 2.667a2.667 2.667 0 0 1 2.667 -2.667h8.666a2.667 2.667 0 0 1 2.667 2.667v8.666a2.667 2.667 0 0 1 -2.667 2.667h-8.666a2.667 2.667 0 0 1 -2.667 -2.667z"},null,-1),r.createElementVNode("path",{d:"M4.012 16.737a2.005 2.005 0 0 1 -1.012 -1.737v-10c0 -1.1 .9 -2 2 -2h10c.75 0 1.158 .385 1.5 1"},null,-1)])])}const as=j(tr,[["render",sr]]),ar={},rr={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"baklava-icon icon icon-tabler icons-tabler-outline icon-tabler-dots-vertical"};function or(e,t){return r.openBlock(),r.createElementBlock("svg",rr,[...t[0]||(t[0]=[r.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),r.createElementVNode("path",{d:"M12 12m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0"},null,-1),r.createElementVNode("path",{d:"M12 19m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0"},null,-1),r.createElementVNode("path",{d:"M12 5m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0"},null,-1)])])}const rs=j(ar,[["render",or]]),ir={},lr={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"baklava-icon icon icon-tabler icons-tabler-outline icon-tabler-download"};function dr(e,t){return r.openBlock(),r.createElementBlock("svg",lr,[...t[0]||(t[0]=[r.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),r.createElementVNode("path",{d:"M4 17v2a2 2 0 0 0 2 2h12a2 2 0 0 0 2 -2v-2"},null,-1),r.createElementVNode("path",{d:"M7 11l5 5l5 -5"},null,-1),r.createElementVNode("path",{d:"M12 4l0 12"},null,-1)])])}const os=j(ir,[["render",dr]]),cr={},ur={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"currentColor",class:"baklava-icon icon icon-tabler icons-tabler-filled icon-tabler-layout-sidebar-left-collapse"};function hr(e,t){return r.openBlock(),r.createElementBlock("svg",ur,[...t[0]||(t[0]=[r.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),r.createElementVNode("path",{d:"M18 3a3 3 0 0 1 2.995 2.824l.005 .176v12a3 3 0 0 1 -2.824 2.995l-.176 .005h-12a3 3 0 0 1 -2.995 -2.824l-.005 -.176v-12a3 3 0 0 1 2.824 -2.995l.176 -.005h12zm0 2h-9v14h9a1 1 0 0 0 .993 -.883l.007 -.117v-12a1 1 0 0 0 -.883 -.993l-.117 -.007zm-2.293 4.293a1 1 0 0 1 .083 1.32l-.083 .094l-1.292 1.293l1.292 1.293a1 1 0 0 1 .083 1.32l-.083 .094a1 1 0 0 1 -1.32 .083l-.094 -.083l-2 -2a1 1 0 0 1 -.083 -1.32l.083 -.094l2 -2a1 1 0 0 1 1.414 0z"},null,-1)])])}const fr=j(cr,[["render",hr]]),pr={},mr={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"currentColor",class:"baklava-icon icon icon-tabler icons-tabler-filled icon-tabler-layout-sidebar-left-expand"};function yr(e,t){return r.openBlock(),r.createElementBlock("svg",mr,[...t[0]||(t[0]=[r.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),r.createElementVNode("path",{d:"M18 3a3 3 0 0 1 2.995 2.824l.005 .176v12a3 3 0 0 1 -2.824 2.995l-.176 .005h-12a3 3 0 0 1 -2.995 -2.824l-.005 -.176v-12a3 3 0 0 1 2.824 -2.995l.176 -.005h12zm0 2h-9v14h9a1 1 0 0 0 .993 -.883l.007 -.117v-12a1 1 0 0 0 -.883 -.993l-.117 -.007zm-4.387 4.21l.094 .083l2 2a1 1 0 0 1 .083 1.32l-.083 .094l-2 2a1 1 0 0 1 -1.497 -1.32l.083 -.094l1.292 -1.293l-1.292 -1.293a1 1 0 0 1 -.083 -1.32l.083 -.094a1 1 0 0 1 1.32 -.083z"},null,-1)])])}const _r=j(pr,[["render",yr]]),gr={},kr={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"currentColor",class:"baklava-icon icon icon-tabler icons-tabler-filled icon-tabler-layout-sidebar-right"};function br(e,t){return r.openBlock(),r.createElementBlock("svg",kr,[...t[0]||(t[0]=[r.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),r.createElementVNode("path",{d:"M6 21a3 3 0 0 1 -3 -3v-12a3 3 0 0 1 3 -3h12a3 3 0 0 1 3 3v12a3 3 0 0 1 -3 3zm8 -16h-8a1 1 0 0 0 -1 1v12a1 1 0 0 0 1 1h8z"},null,-1)])])}const wr=j(gr,[["render",br]]),vr={},Nr={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"currentColor",class:"baklava-icon icon icon-tabler icons-tabler-filled icon-tabler-layout-sidebar-right-collapse"};function Cr(e,t){return r.openBlock(),r.createElementBlock("svg",Nr,[...t[0]||(t[0]=[r.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),r.createElementVNode("path",{d:"M18 3a3 3 0 0 1 2.995 2.824l.005 .176v12a3 3 0 0 1 -2.824 2.995l-.176 .005h-12a3 3 0 0 1 -2.995 -2.824l-.005 -.176v-12a3 3 0 0 1 2.824 -2.995l.176 -.005h12zm-3 2h-9a1 1 0 0 0 -.993 .883l-.007 .117v12a1 1 0 0 0 .883 .993l.117 .007h9v-14zm-5.387 4.21l.094 .083l2 2a1 1 0 0 1 .083 1.32l-.083 .094l-2 2a1 1 0 0 1 -1.497 -1.32l.083 -.094l1.292 -1.293l-1.292 -1.293a1 1 0 0 1 -.083 -1.32l.083 -.094a1 1 0 0 1 1.32 -.083z"},null,-1)])])}const is=j(vr,[["render",Cr]]),Sr={},Mr={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"currentColor",class:"baklava-icon icon icon-tabler icons-tabler-filled icon-tabler-layout-sidebar-right-expand"};function Or(e,t){return r.openBlock(),r.createElementBlock("svg",Mr,[...t[0]||(t[0]=[r.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),r.createElementVNode("path",{d:"M18 3a3 3 0 0 1 2.995 2.824l.005 .176v12a3 3 0 0 1 -2.824 2.995l-.176 .005h-12a3 3 0 0 1 -2.995 -2.824l-.005 -.176v-12a3 3 0 0 1 2.824 -2.995l.176 -.005h12zm-3 2h-9a1 1 0 0 0 -.993 .883l-.007 .117v12a1 1 0 0 0 .883 .993l.117 .007h9v-14zm-3.293 4.293a1 1 0 0 1 .083 1.32l-.083 .094l-1.292 1.293l1.292 1.293a1 1 0 0 1 .083 1.32l-.083 .094a1 1 0 0 1 -1.32 .083l-.094 -.083l-2 -2a1 1 0 0 1 -.083 -1.32l.083 -.094l2 -2a1 1 0 0 1 1.414 0z"},null,-1)])])}const jt=j(Sr,[["render",Or]]),Er={},Tr={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"baklava-icon icon icon-tabler icons-tabler-outline icon-tabler-lock-code"};function Ir(e,t){return r.openBlock(),r.createElementBlock("svg",Tr,[...t[0]||(t[0]=[r.createStaticVNode('<path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M11.5 21h-4.5a2 2 0 0 1 -2 -2v-6a2 2 0 0 1 2 -2h10a2 2 0 0 1 2 2"></path><path d="M11 16a1 1 0 1 0 2 0a1 1 0 0 0 -2 0"></path><path d="M8 11v-4a4 4 0 1 1 8 0v4"></path><path d="M20 21l2 -2l-2 -2"></path><path d="M17 17l-2 2l2 2"></path>',6)])])}const Ht=j(Er,[["render",Ir]]),Dr={},xr={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"baklava-icon icon icon-tabler icons-tabler-outline icon-tabler-player-play"};function Yr(e,t){return r.openBlock(),r.createElementBlock("svg",xr,[...t[0]||(t[0]=[r.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),r.createElementVNode("path",{d:"M7 4v16l13 -8z"},null,-1)])])}const Rr=j(Dr,[["render",Yr]]),Br={},Vr={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"baklava-icon icon icon-tabler icons-tabler-outline icon-tabler-plus"};function Pr(e,t){return r.openBlock(),r.createElementBlock("svg",Vr,[...t[0]||(t[0]=[r.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),r.createElementVNode("path",{d:"M12 5l0 14"},null,-1),r.createElementVNode("path",{d:"M5 12l14 0"},null,-1)])])}const ls=j(Br,[["render",Pr]]),Lr={},Ar={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"baklava-icon icon icon-tabler icons-tabler-outline icon-tabler-restore"};function $r(e,t){return r.openBlock(),r.createElementBlock("svg",Ar,[...t[0]||(t[0]=[r.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),r.createElementVNode("path",{d:"M3.06 13a9 9 0 1 0 .49 -4.087"},null,-1),r.createElementVNode("path",{d:"M3 4.001v5h5"},null,-1),r.createElementVNode("path",{d:"M12 12m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0"},null,-1)])])}const ds=j(Lr,[["render",$r]]),Ur={},Fr={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"baklava-icon icon icon-tabler icons-tabler-outline icon-tabler-schema"};function Wr(e,t){return r.openBlock(),r.createElementBlock("svg",Fr,[...t[0]||(t[0]=[r.createStaticVNode('<path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M5 2h5v4h-5z"></path><path d="M15 10h5v4h-5z"></path><path d="M5 18h5v4h-5z"></path><path d="M5 10h5v4h-5z"></path><path d="M10 12h5"></path><path d="M7.5 6v4"></path><path d="M7.5 14v4"></path>',8)])])}const cs=j(Ur,[["render",Wr]]),jr={},Hr={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"baklava-icon icon icon-tabler icons-tabler-outline icon-tabler-schema-off"};function Gr(e,t){return r.openBlock(),r.createElementBlock("svg",Hr,[...t[0]||(t[0]=[r.createStaticVNode('<path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M6 2h4v4m-4 0h-1v-1"></path><path d="M15 11v-1h5v4h-2"></path><path d="M5 18h5v4h-5z"></path><path d="M5 10h5v4h-5z"></path><path d="M10 12h2"></path><path d="M7.5 7.5v2.5"></path><path d="M7.5 14v4"></path><path d="M3 3l18 18"></path>',9)])])}const us=j(jr,[["render",Gr]]),zr={},qr={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"baklava-icon icon icon-tabler icons-tabler-outline icon-tabler-transition-bottom"};function Zr(e,t){return r.openBlock(),r.createElementBlock("svg",qr,[...t[0]||(t[0]=[r.createStaticVNode('<path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M21 18a3 3 0 0 1 -3 3h-12a3 3 0 0 1 -3 -3"></path><path d="M3 3m0 3a3 3 0 0 1 3 -3h12a3 3 0 0 1 3 3v0a3 3 0 0 1 -3 3h-12a3 3 0 0 1 -3 -3z"></path><path d="M12 9v8"></path><path d="M9 14l3 3l3 -3"></path>',5)])])}const hs=j(zr,[["render",Zr]]),Kr={},Xr={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"baklava-icon icon icon-tabler icons-tabler-outline icon-tabler-upload"};function Jr(e,t){return r.openBlock(),r.createElementBlock("svg",Xr,[...t[0]||(t[0]=[r.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),r.createElementVNode("path",{d:"M4 17v2a2 2 0 0 0 2 2h12a2 2 0 0 0 2 -2v-2"},null,-1),r.createElementVNode("path",{d:"M7 9l5 -5l5 5"},null,-1),r.createElementVNode("path",{d:"M12 4l0 12"},null,-1)])])}const fs=j(Kr,[["render",Jr]]),Qr={},eo={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"baklava-icon icon icon-tabler icons-tabler-outline icon-tabler-x"};function to(e,t){return r.openBlock(),r.createElementBlock("svg",eo,[...t[0]||(t[0]=[r.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),r.createElementVNode("path",{d:"M18 6l-12 12"},null,-1),r.createElementVNode("path",{d:"M6 6l12 12"},null,-1)])])}const ps=j(Qr,[["render",to]]),no=Object.freeze(Object.defineProperty({__proto__:null,Check:ts,ChevronDown:ns,CodeVariable:ss,Copy:as,DotsVertical:rs,Download:os,LayoutSidebarLeftCollapse:fr,LayoutSidebarLeftExpand:_r,LayoutSidebarRight:wr,LayoutSidebarRightCollapse:is,LayoutSidebarRightExpand:jt,LockCode:Ht,PlayerPlay:Rr,Plus:ls,Restore:ds,Schema:cs,SchemaOff:us,TransitionBottom:hs,Upload:fs,X:ps},Symbol.toStringTag,{value:"Module"}));function so(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var ht={exports:{}};var ao=ht.exports,ms;function ro(){return ms||(ms=1,(function(e,t){(function(s,a){e.exports=a()})(ao,function(){return(function(){var n={686:(function(o,i,l){l.d(i,{default:function(){return G}});var d=l(279),c=l.n(d),u=l(370),_=l.n(u),p=l(817),I=l.n(p);function k(w){try{return document.execCommand(w)}catch{return!1}}var S=function(N){var v=I()(N);return k("cut"),v},f=S;function b(w){var N=document.documentElement.getAttribute("dir")==="rtl",v=document.createElement("textarea");v.style.fontSize="12pt",v.style.border="0",v.style.padding="0",v.style.margin="0",v.style.position="absolute",v.style[N?"right":"left"]="-9999px";var O=window.pageYOffset||document.documentElement.scrollTop;return v.style.top="".concat(O,"px"),v.setAttribute("readonly",""),v.value=w,v}var A=function(N,v){var O=b(N);v.container.appendChild(O);var D=I()(O);return k("copy"),O.remove(),D},R=function(N){var v=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{container:document.body},O="";return typeof N=="string"?O=A(N,v):N instanceof HTMLInputElement&&!["text","search","url","tel","password"].includes(N?.type)?O=A(N.value,v):(O=I()(N),k("copy")),O},W=R;function Se(w){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Se=function(v){return typeof v}:Se=function(v){return v&&typeof Symbol=="function"&&v.constructor===Symbol&&v!==Symbol.prototype?"symbol":typeof v},Se(w)}var Me=function(){var N=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},v=N.action,O=v===void 0?"copy":v,D=N.container,B=N.target,ce=N.text;if(O!=="copy"&&O!=="cut")throw new Error('Invalid "action" value, use either "copy" or "cut"');if(B!==void 0)if(B&&Se(B)==="object"&&B.nodeType===1){if(O==="copy"&&B.hasAttribute("disabled"))throw new Error('Invalid "target" attribute. Please use "readonly" instead of "disabled" attribute');if(O==="cut"&&(B.hasAttribute("readonly")||B.hasAttribute("disabled")))throw new Error(`Invalid "target" attribute. You can't cut text from elements with "readonly" or "disabled" attributes`)}else throw new Error('Invalid "target" value, use a valid Element');if(ce)return W(ce,{container:D});if(B)return O==="cut"?f(B):W(B,{container:D})},ct=Me;function me(w){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?me=function(v){return typeof v}:me=function(v){return v&&typeof Symbol=="function"&&v.constructor===Symbol&&v!==Symbol.prototype?"symbol":typeof v},me(w)}function M(w,N){if(!(w instanceof N))throw new TypeError("Cannot call a class as a function")}function Z(w,N){for(var v=0;v<N.length;v++){var O=N[v];O.enumerable=O.enumerable||!1,O.configurable=!0,"value"in O&&(O.writable=!0),Object.defineProperty(w,O.key,O)}}function ee(w,N,v){return N&&Z(w.prototype,N),v&&Z(w,v),w}function Xn(w,N){if(typeof N!="function"&&N!==null)throw new TypeError("Super expression must either be null or a function");w.prototype=Object.create(N&&N.prototype,{constructor:{value:w,writable:!0,configurable:!0}}),N&&ut(w,N)}function ut(w,N){return ut=Object.setPrototypeOf||function(O,D){return O.__proto__=D,O},ut(w,N)}function $t(w){var N=Ft();return function(){var O=Be(w),D;if(N){var B=Be(this).constructor;D=Reflect.construct(O,arguments,B)}else D=O.apply(this,arguments);return Ut(this,D)}}function Ut(w,N){return N&&(me(N)==="object"||typeof N=="function")?N:Jn(w)}function Jn(w){if(w===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return w}function Ft(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch{return!1}}function Be(w){return Be=Object.setPrototypeOf?Object.getPrototypeOf:function(v){return v.__proto__||Object.getPrototypeOf(v)},Be(w)}function qe(w,N){var v="data-clipboard-".concat(w);if(N.hasAttribute(v))return N.getAttribute(v)}var $=(function(w){Xn(v,w);var N=$t(v);function v(O,D){var B;return M(this,v),B=N.call(this),B.resolveOptions(D),B.listenClick(O),B}return ee(v,[{key:"resolveOptions",value:function(){var D=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.action=typeof D.action=="function"?D.action:this.defaultAction,this.target=typeof D.target=="function"?D.target:this.defaultTarget,this.text=typeof D.text=="function"?D.text:this.defaultText,this.container=me(D.container)==="object"?D.container:document.body}},{key:"listenClick",value:function(D){var B=this;this.listener=_()(D,"click",function(ce){return B.onClick(ce)})}},{key:"onClick",value:function(D){var B=D.delegateTarget||D.currentTarget,ce=this.action(B)||"copy",Wt=ct({action:ce,container:this.container,target:this.target(B),text:this.text(B)});this.emit(Wt?"success":"error",{action:ce,text:Wt,trigger:B,clearSelection:function(){B&&B.focus(),window.getSelection().removeAllRanges()}})}},{key:"defaultAction",value:function(D){return qe("action",D)}},{key:"defaultTarget",value:function(D){var B=qe("target",D);if(B)return document.querySelector(B)}},{key:"defaultText",value:function(D){return qe("text",D)}},{key:"destroy",value:function(){this.listener.destroy()}}],[{key:"copy",value:function(D){var B=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{container:document.body};return W(D,B)}},{key:"cut",value:function(D){return f(D)}},{key:"isSupported",value:function(){var D=arguments.length>0&&arguments[0]!==void 0?arguments[0]:["copy","cut"],B=typeof D=="string"?[D]:D,ce=!!document.queryCommandSupported;return B.forEach(function(Wt){ce=ce&&!!document.queryCommandSupported(Wt)}),ce}}]),v})(c()),G=$}),828:(function(o){var i=9;if(typeof Element<"u"&&!Element.prototype.matches){var l=Element.prototype;l.matches=l.matchesSelector||l.mozMatchesSelector||l.msMatchesSelector||l.oMatchesSelector||l.webkitMatchesSelector}function d(c,u){for(;c&&c.nodeType!==i;){if(typeof c.matches=="function"&&c.matches(u))return c;c=c.parentNode}}o.exports=d}),438:(function(o,i,l){var d=l(828);function c(p,I,k,S,f){var b=_.apply(this,arguments);return p.addEventListener(k,b,f),{destroy:function(){p.removeEventListener(k,b,f)}}}function u(p,I,k,S,f){return typeof p.addEventListener=="function"?c.apply(null,arguments):typeof k=="function"?c.bind(null,document).apply(null,arguments):(typeof p=="string"&&(p=document.querySelectorAll(p)),Array.prototype.map.call(p,function(b){return c(b,I,k,S,f)}))}function _(p,I,k,S){return function(f){f.delegateTarget=d(f.target,I),f.delegateTarget&&S.call(p,f)}}o.exports=u}),879:(function(o,i){i.node=function(l){return l!==void 0&&l instanceof HTMLElement&&l.nodeType===1},i.nodeList=function(l){var d=Object.prototype.toString.call(l);return l!==void 0&&(d==="[object NodeList]"||d==="[object HTMLCollection]")&&"length"in l&&(l.length===0||i.node(l[0]))},i.string=function(l){return typeof l=="string"||l instanceof String},i.fn=function(l){var d=Object.prototype.toString.call(l);return d==="[object Function]"}}),370:(function(o,i,l){var d=l(879),c=l(438);function u(k,S,f){if(!k&&!S&&!f)throw new Error("Missing required arguments");if(!d.string(S))throw new TypeError("Second argument must be a String");if(!d.fn(f))throw new TypeError("Third argument must be a Function");if(d.node(k))return _(k,S,f);if(d.nodeList(k))return p(k,S,f);if(d.string(k))return I(k,S,f);throw new TypeError("First argument must be a String, HTMLElement, HTMLCollection, or NodeList")}function _(k,S,f){return k.addEventListener(S,f),{destroy:function(){k.removeEventListener(S,f)}}}function p(k,S,f){return Array.prototype.forEach.call(k,function(b){b.addEventListener(S,f)}),{destroy:function(){Array.prototype.forEach.call(k,function(b){b.removeEventListener(S,f)})}}}function I(k,S,f){return c(document.body,k,S,f)}o.exports=u}),817:(function(o){function i(l){var d;if(l.nodeName==="SELECT")l.focus(),d=l.value;else if(l.nodeName==="INPUT"||l.nodeName==="TEXTAREA"){var c=l.hasAttribute("readonly");c||l.setAttribute("readonly",""),l.select(),l.setSelectionRange(0,l.value.length),c||l.removeAttribute("readonly"),d=l.value}else{l.hasAttribute("contenteditable")&&l.focus();var u=window.getSelection(),_=document.createRange();_.selectNodeContents(l),u.removeAllRanges(),u.addRange(_),d=u.toString()}return d}o.exports=i}),279:(function(o){function i(){}i.prototype={on:function(l,d,c){var u=this.e||(this.e={});return(u[l]||(u[l]=[])).push({fn:d,ctx:c}),this},once:function(l,d,c){var u=this;function _(){u.off(l,_),d.apply(c,arguments)}return _._=d,this.on(l,_,c)},emit:function(l){var d=[].slice.call(arguments,1),c=((this.e||(this.e={}))[l]||[]).slice(),u=0,_=c.length;for(u;u<_;u++)c[u].fn.apply(c[u].ctx,d);return this},off:function(l,d){var c=this.e||(this.e={}),u=c[l],_=[];if(u&&d)for(var p=0,I=u.length;p<I;p++)u[p].fn!==d&&u[p].fn._!==d&&_.push(u[p]);return _.length?c[l]=_:delete c[l],this}},o.exports=i,o.exports.TinyEmitter=i})},s={};function a(o){if(s[o])return s[o].exports;var i=s[o]={exports:{}};return n[o](i,i.exports,a),i.exports}return(function(){a.n=function(o){var i=o&&o.__esModule?function(){return o.default}:function(){return o};return a.d(i,{a:i}),i}})(),(function(){a.d=function(o,i){for(var l in i)a.o(i,l)&&!a.o(o,l)&&Object.defineProperty(o,l,{enumerable:!0,get:i[l]})}})(),(function(){a.o=function(o,i){return Object.prototype.hasOwnProperty.call(o,i)}})(),a(686)})().default})})(ht)),ht.exports}var oo=ro();const io=so(oo),lo=e=>({toClipboard(t,n){return new Promise((s,a)=>{const o=document.createElement("button"),i=new io(o,{text:()=>t,action:()=>"copy",container:n!==void 0?n:document.body});i.on("success",l=>{i.destroy(),s(l)}),i.on("error",l=>{i.destroy(),a(l)}),document.body.appendChild(o),o.click(),document.body.removeChild(o)})}}),co={key:0,class:"baklava-button"},ys=r.defineComponent({__name:"CopyToClipboard",props:{text:String},setup(e){const{toClipboard:t}=lo(),n=e,s=r.toRef(n,"text"),a=r.ref(!1),o=async()=>{try{await t(s.value),a.value=!0,setTimeout(()=>a.value=!1,1500),console.log("Copied to clipboard")}catch(i){console.error(i)}};return(i,l)=>(r.openBlock(),r.createElementBlock("div",null,[a.value?(r.openBlock(),r.createElementBlock("button",co,[r.createVNode(r.unref(ts))])):(r.openBlock(),r.createElementBlock("button",{key:1,onClick:o,class:"baklava-button"},[r.createVNode(r.unref(as))]))]))}}),uo={class:"code-editor"},ho={class:"code-buttons"},fo=r.defineComponent({__name:"CodeEditor",props:r.mergeModels({locked:{type:Boolean},extensions:{}},{modelValue:{required:!0},modelModifiers:{}}),emits:r.mergeModels(["update:locked"],["update:modelValue"]),setup(e,{emit:t}){const n=r.useModel(e,"modelValue"),s=t,a=o=>s("update:locked",o);return(o,i)=>{const l=r.resolveComponent("codemirror");return r.openBlock(),r.createElementBlock("div",uo,[r.createElementVNode("div",ho,[e.locked?(r.openBlock(),r.createElementBlock("button",{key:0,class:"baklava-button",title:"The code is locked.",onClick:i[0]||(i[0]=d=>a(!1))},[r.createVNode(r.unref(Ht))])):r.createCommentVNode("",!0),r.createVNode(ys,{text:e.modelValue},null,8,["text"])]),r.createVNode(l,{modelValue:n.value,"onUpdate:modelValue":i[1]||(i[1]=d=>n.value=d),extensions:e.extensions,class:"codemirror",style:{height:"100%"},onKeydown:i[2]||(i[2]=d=>a(!0))},null,8,["modelValue","extensions"])])}}}),po=r.defineComponent({__name:"CodeGraphEditor",props:{viewModel:{}},setup(e){const t=e,n=r.toRef(t,"viewModel"),s=a=>a.events.update.emit(null);return r.onMounted(n.value.onMounted),r.onBeforeUnmount(n.value.onBeforeUnmount),r.watch(n,(a,o)=>{o&&o.onBeforeUnmount(),a&&a.onMounted()}),(a,o)=>(r.openBlock(),r.createBlock(r.unref(T.BaklavaEditor),{viewModel:n.value},{palette:r.withCtx(()=>[r.createVNode(r.unref(ws))]),node:r.withCtx(i=>[r.createVNode(r.unref(_s),r.mergeProps(i,{onUpdate:l=>s(i.node)}),null,16,["onUpdate"])]),sidebar:r.withCtx(i=>[r.createVNode(r.unref(gs),r.normalizeProps(r.guardReactiveProps(i)),{codeEditor:r.withCtx(({node:l})=>[r.renderSlot(a.$slots,"sidebarCodeEditor",{node:l})]),_:3},16)]),_:3},8,["viewModel"]))}}),mo={class:"code-graph-info"},yo=r.defineComponent({__name:"CodeGraphInfo",props:{viewModel:{}},setup(e){return(t,n)=>(r.openBlock(),r.createElementBlock("div",mo,[r.createElementVNode("div",null,"Editor graph: "+r.toDisplayString(e.viewModel.editor.graph.shortId),1),r.createElementVNode("div",null,"Displayed graph: "+r.toDisplayString(e.viewModel.displayedGraph.shortId),1),r.createElementVNode("div",null,"Graphs: "+r.toDisplayString(e.viewModel.editor.graphIds),1),r.createElementVNode("div",null,"Graph templates: "+r.toDisplayString(e.viewModel.editor.graphTemplateIds),1),r.createElementVNode("div",null,"Engine status: "+r.toDisplayString(e.viewModel.engine?.status),1)]))}}),_o=["data-node-type","id"],go={class:"__title-label",style:{"flex-grow":"1"}},ko={key:0},bo={class:"__menu",style:{display:"flex"}},wo={class:"__outputs"},vo={key:0},No=["id","title"],Co={class:"__inputs"},So={key:0},Mo=["id","title"],_s=r.defineComponent({__name:"CodeGraphNode",props:{node:{},selected:{type:Boolean,default:!1},dragging:{type:Boolean}},emits:["select","start-drag","update"],setup(e,{emit:t}){const n=T.Components.ContextMenu,s=T.Components.NodeInterface,a=e,o=r.computed(()=>a.node),i=t,{viewModel:l}=T.useViewModel(),{graph:d,switchGraph:c}=T.useGraph(),u=r.ref(null),_=r.ref(!1),p=r.ref(""),I=r.ref(null),k=r.ref(!1);let S=0,f=0;const b=r.ref(!1),A=r.computed(()=>{const $=[{value:"edit",label:"Edit"},{value:"rename",label:"Rename"},{value:"delete",label:"Delete"}];return a.node.type.startsWith(re.GRAPH_NODE_TYPE_PREFIX)&&$.push({value:"editSubgraph",label:"Edit Subgraph"}),$}),R=r.computed(()=>({"--selected":a.selected,"--dragging":a.dragging,"--two-column":!!a.node.twoColumn,"--hidden":o.value.state?.hidden})),W=r.computed(()=>({"--reverse-y":a.node.reverseY??l.value.settings.nodes.reverseY})),Se=r.computed(()=>({top:`${a.node.position?.y??0}px`,left:`${a.node.position?.x??0}px`,"--width":`${a.node.width??l.value.settings.nodes.defaultWidth}px`})),Me=r.computed(()=>Object.values(a.node.inputs).filter($=>!$.hidden)),ct=r.computed(()=>Object.values(a.node.outputs).filter($=>!$.hidden)),me=()=>{Xn(),i("select")},M=$=>{a.selected||me(),i("start-drag",$)},Z=()=>{b.value=!0},ee=()=>{const $=l.value.displayedGraph.sidebar;$.nodeId=a.node.id,$.visible=!0},Xn=()=>{const $=l.value.displayedGraph.sidebar;$.nodeId=a.node.id},ut=async $=>{switch($){case"edit":ee();break;case"delete":d.value.removeNode(a.node);break;case"rename":p.value=a.node.title,_.value=!0,await r.nextTick(),I.value?.focus();break;case"editSubgraph":c(a.node.template);break}},$t=()=>{o.value.title=p.value,o.value.events.titleChanged.emit(o.value.title),_.value=!1},Ut=()=>{u.value&&l.value.hooks.renderNode.execute({node:a.node,el:u.value})},Jn=$=>{k.value=!0,S=a.node.width,f=$.clientX,$.preventDefault()},Ft=$=>{o.value.state&&(o.value.state.integrated=$,i("update"))},Be=$=>{if(!k.value)return;const G=$.clientX-f,w=S+G/d.value.scaling,N=l.value.settings.nodes.minWidth,v=l.value.settings.nodes.maxWidth;o.value.width=Math.max(N,Math.min(v,w))},qe=()=>{k.value=!1};return r.onMounted(()=>{Ut(),window.addEventListener("mousemove",Be),window.addEventListener("mouseup",qe)}),r.onUpdated(Ut),r.onBeforeUnmount(()=>{window.removeEventListener("mousemove",Be),window.removeEventListener("mouseup",qe)}),($,G)=>(r.openBlock(),r.createElementBlock("div",{class:r.normalizeClass([R.value,"baklava-node"]),"data-node-type":o.value.type,id:o.value.id,style:r.normalizeStyle(Se.value),ref_key:"el",ref:u,onPointerdown:me},[r.unref(l).settings.nodes.resizable?(r.openBlock(),r.createElementBlock("div",{key:0,class:"__resize-handle",onMousedown:Jn},null,32)):r.createCommentVNode("",!0),r.createElementVNode("div",{class:"__title",onPointerdown:r.withModifiers(M,["self","stop"]),onContextmenu:r.withModifiers(Z,["prevent"])},[o.value.inputs._code?(r.openBlock(),r.createBlock(r.unref(Gt),{key:0,intf:o.value.inputs._code,node:o.value,title:o.value.inputs._code.value,class:"--input","data-interface-type":"node",style:{"flex-grow":"0"}},null,8,["intf","node","title"])):r.createCommentVNode("",!0),_.value?r.withDirectives((r.openBlock(),r.createElementBlock("input",{key:2,ref_key:"renameInputEl",ref:I,"onUpdate:modelValue":G[4]||(G[4]=w=>p.value=w),class:"baklava-input",placeholder:"Title",style:{"flex-grow":"1"},type:"text",onBlur:$t,onKeydown:r.withKeys($t,["enter"])},null,544)),[[r.vModelText,p.value]]):(r.openBlock(),r.createElementBlock(r.Fragment,{key:1},[r.createElementVNode("div",go,[o.value.idx>-1?(r.openBlock(),r.createElementBlock("span",ko,r.toDisplayString(o.value.idx+1)+" - ",1)):r.createCommentVNode("",!0),r.createTextVNode(" "+r.toDisplayString(o.value.title),1)]),r.createElementVNode("div",bo,[o.value.isCodeNode?(r.openBlock(),r.createElementBlock(r.Fragment,{key:0},[o.value.state.lockCode?(r.openBlock(),r.createBlock(r.unref(Ht),{key:0,class:"--clickable mx-1",onClick:G[0]||(G[0]=w=>o.value.lockCode=!1)})):r.createCommentVNode("",!0),o.value.isSelected&&!r.unref(l).displayedGraph.sidebar.visible?(r.openBlock(),r.createBlock(r.unref(jt),{key:1,class:"--clickable mx-1",onClick:ee})):r.createCommentVNode("",!0),o.value.hasConnectedOutputNodes?(r.openBlock(),r.createElementBlock(r.Fragment,{key:2},[o.value.state.integrated?(r.openBlock(),r.createBlock(r.unref(ss),{key:1,class:"--clickable mx-1",onClick:G[2]||(G[2]=w=>Ft(!1))})):(r.openBlock(),r.createBlock(r.unref(hs),{key:0,class:"--clickable mx-1",onClick:G[1]||(G[1]=w=>Ft(!0))}))],64)):r.createCommentVNode("",!0)],64)):r.createCommentVNode("",!0),r.createVNode(r.unref(rs),{class:"--clickable mx-1",onClick:Z}),r.createVNode(r.unref(n),{modelValue:b.value,"onUpdate:modelValue":G[3]||(G[3]=w=>b.value=w),x:0,y:0,items:A.value,onClick:ut},null,8,["modelValue","items"])])],64)),o.value.outputs._code?(r.openBlock(),r.createBlock(r.unref(Gt),{key:3,node:o.value,intf:o.value.outputs._code,class:"--output",title:o.value.outputs._code.value,"data-interface-type":"node"},null,8,["node","intf","title"])):r.createCommentVNode("",!0)],32),r.createElementVNode("div",{class:r.normalizeClass(["__content",W.value]),onKeydown:G[5]||(G[5]=r.withKeys(r.withModifiers(()=>{},["stop"]),["delete"])),onContextmenu:G[6]||(G[6]=r.withModifiers(()=>{},["prevent"]))},[r.createElementVNode("div",wo,[(r.openBlock(!0),r.createElementBlock(r.Fragment,null,r.renderList(ct.value,w=>(r.openBlock(),r.createElementBlock(r.Fragment,{key:w.id},[o.value.state?.hidden?(r.openBlock(),r.createElementBlock("div",vo,[w.port?(r.openBlock(),r.createElementBlock("div",{key:0,id:w.id,title:w.name,class:"baklava-node-interface --output --connected"},[...G[7]||(G[7]=[r.createElementVNode("div",{class:"__port"},null,-1)])],8,No)):r.createCommentVNode("",!0)])):r.renderSlot($.$slots,"nodeInterface",{key:1,type:"output",node:o.value,intf:w},()=>[r.createVNode(r.unref(s),{node:o.value,intf:w,title:w.value},null,8,["node","intf","title"])])],64))),128))]),r.createElementVNode("div",Co,[(r.openBlock(!0),r.createElementBlock(r.Fragment,null,r.renderList(Me.value,w=>(r.openBlock(),r.createElementBlock(r.Fragment,{key:w.id},[o.value.state?.hidden?(r.openBlock(),r.createElementBlock("div",So,[w.port?(r.openBlock(),r.createElementBlock("div",{key:0,id:w.id,title:w.name,class:"baklava-node-interface --input --connected"},[...G[8]||(G[8]=[r.createElementVNode("div",{class:"__port"},null,-1)])],8,Mo)):r.createCommentVNode("",!0)])):r.renderSlot($.$slots,"nodeInterface",{key:1,node:o.value,intf:w,type:"input"},()=>[r.createVNode(r.unref(s),{node:o.value,intf:w,title:w.value},null,8,["node","intf","title"])])],64))),128))])],34)],46,_o))}}),Oo=["id"],Eo={class:"align-middle"},Gt=r.defineComponent({__name:"CodeGraphNodeInterface",props:{node:{},intf:{}},setup(e){const t=e,{viewModel:n}=T.useViewModel(),{hoveredOver:s,temporaryConnection:a}=T.useTemporaryConnection(),o=r.ref(null),i=r.computed(()=>t.intf.connectionCount>0),l=r.computed(()=>({"--connected":i.value})),d=()=>{s(t.intf)},c=()=>{s(void 0)},u=()=>{o.value&&n.value.hooks.renderInterface.execute({intf:t.intf,el:o.value})};return r.onMounted(u),r.onUpdated(u),(_,p)=>(r.openBlock(),r.createElementBlock("div",{id:e.intf.id,ref_key:"el",ref:o,class:r.normalizeClass(["baklava-node-interface",l.value])},[e.intf.port?(r.openBlock(),r.createElementBlock("div",{key:0,class:r.normalizeClass([{"--selected":r.unref(a)?.from===e.intf},"__port"]),onPointerover:d,onPointerout:c},null,34)):r.createCommentVNode("",!0),r.createElementVNode("span",Eo,[r.renderSlot(_.$slots,"default")])],10,Oo))}}),To=["title"],Io={key:0,class:"__label"},zt=r.defineComponent({__name:"SidebarCheckbox",props:{disabled:{type:Boolean},inversed:{type:Boolean},modelValue:{type:Boolean},name:{}},emits:["update:modelValue"],setup(e,{emit:t}){const n=t;return(s,a)=>(r.openBlock(),r.createElementBlock("div",{class:r.normalizeClass(["baklava-checkbox",{"--checked":e.inversed?!e.modelValue:e.modelValue,"--disabled":e.disabled}]),title:e.name,onClick:a[0]||(a[0]=o=>n("update:modelValue",!e.modelValue))},[a[1]||(a[1]=r.createElementVNode("div",{class:"__checkmark-container"},[r.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",viewBox:"0 0 18 18"},[r.createElementVNode("path",{class:"__checkmark",d:"M 6 5 L 6 10 L 16 10",transform:"rotate(-45 10 10)"})])],-1)),e.name?(r.openBlock(),r.createElementBlock("div",Io,r.toDisplayString(e.name),1)):r.createCommentVNode("",!0)],10,To))}}),Do={class:"__header"},xo={class:"__node-name"},Yo={class:"__interfaces"},Ro={class:"__inputs"},Bo={style:{display:"flex"}},Vo={class:"__outputs"},Po={key:0,class:"__interface"},Lo=["placeholder"],Ao={style:{display:"flex"}},gs=r.defineComponent({__name:"CodeGraphSidebar",setup(e){const{viewModel:t}=T.useViewModel(),{graph:n}=T.useGraph(),s=r.ref(null),a=r.toRef(t.value.settings.sidebar,"width"),o=r.computed(()=>t.value.settings.sidebar.resizable);let i=0,l=0;const d=r.computed(()=>{const b=n.value.sidebar.nodeId;return n.value.nodes.find(A=>A.id===b)}),c=r.computed(()=>d.value),u=r.computed(()=>({width:`${a.value}px`})),_=r.computed(()=>c.value?Object.values(c.value.inputs).filter(b=>b.displayInSidebar&&b.component):[]),p=r.computed(()=>c.value?Object.values(c.value.outputs).filter(b=>b.displayInSidebar&&b.component):[]),I=()=>{n.value.sidebar.visible=!1},k=()=>{d.value&&(d.value.state.variableNameNumberAppendix=c.value.state.variableName.length===0,d.value.events.update.emit(null))},S=b=>{i=a.value,l=b.clientX,window.addEventListener("mousemove",f),window.addEventListener("mouseup",()=>{window.removeEventListener("mousemove",f)},{once:!0})},f=b=>{const A=s.value?.parentElement?.getBoundingClientRect().width??500,R=b.clientX-l;let W=i-R;W<300?W=300:W>.9*A&&(W=.9*A),a.value=W};return(b,A)=>(r.openBlock(),r.createElementBlock("div",{class:r.normalizeClass([{"--open":r.unref(n).sidebar.visible},"baklava-sidebar"]),style:r.normalizeStyle(u.value),ref_key:"el",ref:s},[o.value?(r.openBlock(),r.createElementBlock("div",{key:0,class:"__resizer",onMousedown:S},null,32)):r.createCommentVNode("",!0),d.value?(r.openBlock(),r.createElementBlock(r.Fragment,{key:1},[r.createElementVNode("div",Do,[r.createElementVNode("button",{tabindex:"-1",class:"__close",onClick:I},"×"),r.createElementVNode("div",xo,[r.createElementVNode("b",null,r.toDisplayString(d.value.title),1)])]),r.createElementVNode("div",Yo,[r.createElementVNode("div",Ro,[(r.openBlock(!0),r.createElementBlock(r.Fragment,null,r.renderList(_.value,R=>(r.openBlock(),r.createElementBlock("div",{key:R.id,class:"__interface"},[r.createElementVNode("div",Bo,[R.hidden!=null?(r.openBlock(),r.createBlock(zt,{key:0,modelValue:R.hidden,"onUpdate:modelValue":[W=>R.hidden=W,A[0]||(A[0]=()=>d.value?.events.update.emit(null))],disabled:!R.optional,inversed:"",style:{"padding-right":"8px"}},null,8,["modelValue","onUpdate:modelValue","disabled"])):r.createCommentVNode("",!0),(r.openBlock(),r.createBlock(r.resolveDynamicComponent(R.component),{modelValue:R.value,"onUpdate:modelValue":W=>R.value=W,node:d.value,intf:R,style:{width:"100%"}},null,8,["modelValue","onUpdate:modelValue","node","intf"]))])]))),128))]),r.createElementVNode("div",Vo,[c.value&&c.value.state?(r.openBlock(),r.createElementBlock("div",Po,[A[3]||(A[3]=r.createElementVNode("label",null,"Variable name",-1)),r.withDirectives(r.createElementVNode("input",{"onUpdate:modelValue":A[1]||(A[1]=R=>c.value.state.variableName=R),placeholder:c.value.variableName,type:"text",class:"baklava-input",title:"Variable name",onBlur:k,onKeydown:r.withKeys(k,["enter"])},null,40,Lo),[[r.vModelText,c.value.state.variableName]])])):r.createCommentVNode("",!0),(r.openBlock(!0),r.createElementBlock(r.Fragment,null,r.renderList(p.value,R=>(r.openBlock(),r.createElementBlock("div",{key:R.id,class:"__interface"},[r.createElementVNode("div",Ao,[R.hidden!=null?(r.openBlock(),r.createBlock(zt,{key:0,modelValue:R.hidden,"onUpdate:modelValue":[W=>R.hidden=W,A[2]||(A[2]=()=>d.value?.events.update.emit(null))],disabled:!R.optional,inversed:"",style:{"padding-right":"8px"}},null,8,["modelValue","onUpdate:modelValue","disabled"])):r.createCommentVNode("",!0),(r.openBlock(),r.createBlock(r.resolveDynamicComponent(R.component),{modelValue:R.value,"onUpdate:modelValue":W=>R.value=W,node:d.value,intf:R,style:{width:"100%"}},null,8,["modelValue","onUpdate:modelValue","node","intf"]))])]))),128))])]),r.renderSlot(b.$slots,"codeEditor",{node:d.value})],64)):r.createCommentVNode("",!0)],6))}});function ks(e,t){return Object.fromEntries(Object.entries(e).filter(t))}function bs(e,t){return Object.fromEntries(Object.entries(e).map(([n,s])=>[n,t(s)]))}const $o={class:"baklava-node --palette",style:{"margin-top":"-20px","margin-bottom":"20px"}},Uo={key:0,style:{display:"flex","justify-content":"space-between"}},Fo=["onClick"],Wo={key:0,style:{margin:"auto 0","font-size":"12px"}},ws=r.defineComponent({__name:"CodeNodePalette",setup(e){const t=T.Components.PaletteEntry,{viewModel:n}=T.useViewModel(),{x:s,y:a}=Qn.usePointer(),{transform:o}=T.useTransform(),i=T.useNodeCategories(n),l=r.inject("editorEl"),d=r.ref(""),c=r.ref(null),u=()=>d.value?i.value.filter(k=>k.name.toLowerCase().includes(d.value.toLowerCase())||Object.values(k.nodeTypes).some(S=>S.title.toLowerCase().includes(d.value.toLowerCase()))):i.value,_=k=>d.value?ks(k,S=>{const f=S[1];return f.category.includes(d.value.toLowerCase())||f.title?.toLowerCase().includes(d.value.toLowerCase())}):k,p=r.computed(()=>{if(!c.value||!l?.value)return{};const{left:k,top:S}=l.value.getBoundingClientRect();return{top:`${a.value-S}px`,left:`${s.value-k}px`}}),I=(k,S)=>{c.value={type:k,nodeInformation:S};const f=()=>{const b=r.reactive(new S.type);n.value.displayedGraph.addNode(b);const A=l.value.getBoundingClientRect(),[R,W]=o(s.value-A.left,a.value-A.top);b.position.x=R,b.position.y=W,c.value=null,document.removeEventListener("pointerup",f)};document.addEventListener("pointerup",f)};return(k,S)=>(r.openBlock(),r.createElementBlock(r.Fragment,null,[r.createElementVNode("div",{class:r.normalizeClass([{"--open":r.unref(n).settings.palette.enabled},"baklava-node-palette"]),onContextmenu:S[1]||(S[1]=r.withModifiers(()=>{},["stop","prevent"]))},[r.createElementVNode("div",$o,[r.withDirectives(r.createElementVNode("input",{"onUpdate:modelValue":S[0]||(S[0]=f=>d.value=f),type:"text",class:"baklava-input",title:"Filter nodes",onKeyup:u},null,544),[[r.vModelText,d.value]])]),(r.openBlock(!0),r.createElementBlock(r.Fragment,null,r.renderList(u(),f=>(r.openBlock(),r.createElementBlock("section",{key:f.name},[f.name!=="default"?(r.openBlock(),r.createElementBlock("h3",Uo,[r.createElementVNode("div",{onClick:b=>d.value=f.name,style:{cursor:"pointer"}},r.toDisplayString(f.name),9,Fo),Object.keys(_(f.nodeTypes)).length<Object.values(f.nodeTypes).length?(r.openBlock(),r.createElementBlock("div",Wo," ( "+r.toDisplayString(Object.keys(_(f.nodeTypes)).length)+" / "+r.toDisplayString(Object.values(f.nodeTypes).length)+" ) ",1)):r.createCommentVNode("",!0)])):r.createCommentVNode("",!0),(r.openBlock(!0),r.createElementBlock(r.Fragment,null,r.renderList(_(f.nodeTypes),(b,A)=>(r.openBlock(),r.createBlock(r.unref(t),{key:A,title:b.title,type:A,onPointerdown:R=>I(A,b)},null,8,["title","type","onPointerdown"]))),128))]))),128))],34),r.createVNode(r.Transition,{name:"fade"},{default:r.withCtx(()=>[c.value?(r.openBlock(),r.createElementBlock("div",{key:0,class:"baklava-dragged-node",style:r.normalizeStyle(p.value)},[r.createVNode(r.unref(t),{type:c.value.type,title:c.value.nodeInformation.title},null,8,["type","title"])],4)):r.createCommentVNode("",!0)]),_:1})],64))}}),jo={},Ho={class:"prependIcon"},Go={class:"appendIcon"};function zo(e,t){const n=r.resolveComponent("router-link");return r.openBlock(),r.createBlock(n,{class:"navItem"},{default:r.withCtx(()=>[r.createElementVNode("span",Ho,[r.renderSlot(e.$slots,"prependIcon")]),r.renderSlot(e.$slots,"default"),r.createElementVNode("span",Go,[r.renderSlot(e.$slots,"appendIcon")])]),_:3})}const qt=j(jo,[["render",zo]]),qo={class:"navbar"},Zo=["onClick"],Ko=r.defineComponent({__name:"NavBar",props:{viewModel:{},editorStates:{},routes:{}},emits:["click:remove"],setup(e,{emit:t}){const n=t,s=a=>{n("click:remove",a)};return(a,o)=>(r.openBlock(),r.createElementBlock("nav",qo,[r.renderSlot(a.$slots,"prepend"),(r.openBlock(!0),r.createElementBlock(r.Fragment,null,r.renderList(e.editorStates,i=>(r.openBlock(),r.createBlock(qt,{key:i.graph.id,class:r.normalizeClass({active:i.graph.id===e.viewModel.displayedGraph.id}),to:{name:e.routes?.edit??"edit",params:{editorId:i.graph.id}}},{appendIcon:r.withCtx(()=>[r.createElementVNode("button",{class:"remove",onClick:r.withModifiers(l=>s(i.graph.id),["prevent"])},[r.createVNode(r.unref(ps))],8,Zo)]),default:r.withCtx(()=>[r.createTextVNode(r.toDisplayString(i.graph.id.slice(0,6))+" ",1)]),_:2},1032,["class","to"]))),128)),r.renderSlot(a.$slots,"append",{},()=>[r.createVNode(qt,{to:{name:e.routes?.new??"new"},class:"navItem"},{default:r.withCtx(()=>[r.createVNode(r.unref(ls),{class:"plus"})]),_:1},8,["to"])])]))}}),Xo=["title"],ft=r.defineComponent({__name:"CodeNodeInterface",props:{intf:{}},setup(e){return(t,n)=>(r.openBlock(),r.createElementBlock("div",{title:e.intf.value},r.toDisplayString(e.intf.name),9,Xo))}}),Jo=r.defineComponent({props:{intf:{type:Object,required:!0},modelValue:{type:String,required:!0}},emits:["update:modelValue"],setup(e,{emit:t}){return{v:r.computed({get:()=>e.modelValue,set:s=>{t("update:modelValue",s)}})}}}),Qo={style:{position:"relative"}},ei={style:{"font-size":"12px",padding:"0 6px",position:"absolute",top:"-10px","background-color":"var(--baklava-node-color-background)"}},ti=["placeholder","title"];function ni(e,t,n,s,a,o){return r.openBlock(),r.createElementBlock("div",Qo,[r.createElementVNode("label",ei,r.toDisplayString(e.intf.name),1),r.withDirectives(r.createElementVNode("input",{"onUpdate:modelValue":t[0]||(t[0]=i=>e.v=i),type:"text",class:"baklava-input",placeholder:e.intf.name,title:e.intf.name},null,8,ti),[[r.vModelText,e.v]])])}const pt=j(Jo,[["render",ni]]),si=r.defineComponent({components:{"i-arrow":ns},props:{intf:{type:Object,required:!0}},setup(e){const t=r.ref(null),n=r.ref(!1),s=r.computed(()=>e.intf.items.find(i=>typeof i=="string"?i===e.intf.value:i.value===e.intf.value)),a=r.computed(()=>s.value?typeof s.value=="string"?s.value:s.value.text:""),o=i=>{e.intf.value=typeof i=="string"?i:i.value};return Qn.onClickOutside(t,()=>{n.value=!1}),{el:t,open:n,selectedItem:s,selectedText:a,setSelected:o}}}),ai=["title"],ri={style:{"font-size":"12px",padding:"0 6px",position:"absolute",top:"-10px","background-color":"var(--baklava-node-color-background)"}},oi={class:"__selected"},ii={class:"__text"},li={class:"__icon"},di={class:"__dropdown"},ci=["onClick"];function ui(e,t,n,s,a,o){const i=r.resolveComponent("i-arrow");return r.openBlock(),r.createElementBlock("div",{ref:"el",class:r.normalizeClass(["baklava-select",{"--open":e.open}]),title:e.intf.name,onClick:t[0]||(t[0]=l=>e.open=!e.open)},[r.createElementVNode("label",ri,r.toDisplayString(e.intf.name),1),r.createElementVNode("div",oi,[r.createElementVNode("div",ii,r.toDisplayString(e.selectedText),1),r.createElementVNode("div",li,[r.createVNode(i)])]),r.createVNode(r.Transition,{name:"slide-fade"},{default:r.withCtx(()=>[r.withDirectives(r.createElementVNode("div",di,[(r.openBlock(!0),r.createElementBlock(r.Fragment,null,r.renderList(e.intf.items,(l,d)=>(r.openBlock(),r.createElementBlock("div",{key:d,class:r.normalizeClass(["item",{"--active":l===e.selectedItem}]),onClick:c=>e.setSelected(l)},r.toDisplayString(typeof l=="string"?l:l.text),11,ci))),128))],512),[[r.vShow,e.open]])]),_:1})],10,ai)}const vs=j(si,[["render",ui]]),hi=r.defineComponent({props:{intf:{type:Object,required:!0},modelValue:{type:String,required:!0}},emits:["update:modelValue"],setup(e,{emit:t}){return{v:r.computed({get:()=>e.modelValue,set:s=>{t("update:modelValue",s)}})}}}),fi={style:{"font-size":"12px",padding:"0 6px",position:"absolute",top:"-6px","background-color":"var(--baklava-node-color-background)"}},pi=["placeholder","title"];function mi(e,t,n,s,a,o){return r.openBlock(),r.createElementBlock("div",null,[r.createElementVNode("label",fi,r.toDisplayString(e.intf.name),1),r.withDirectives(r.createElementVNode("textarea",{"onUpdate:modelValue":t[0]||(t[0]=i=>e.v=i),rows:"5",class:"baklava-input",placeholder:e.intf.name,title:e.intf.name},null,8,pi),[[r.vModelText,e.v]])])}const Ns=j(hi,[["render",mi]]),yi=Object.freeze(Object.defineProperty({__proto__:null,CodeEditor:fo,CodeGraphEditor:po,CodeGraphInfo:yo,CodeGraphNode:_s,CodeGraphNodeInterface:Gt,CodeGraphSidebar:gs,CodeNodeInterface:ft,CodeNodePalette:ws,CopyToClipboard:ys,NavBar:Ko,NavItem:qt,SelectInterface:vs,SidebarCheckbox:zt,TextInputInterface:pt,TextareaInputInterface:Ns},Symbol.toStringTag,{value:"Module"})),Cs=(e,t)=>{switch(e){case"CheckboxInterface":return new Os(t.id,!!t.value);case"IntegerInterface":return new tn(t.id,Number(t.value),t.min,t.max);case"ListInputInterface":return new Ts(t.id,String(t.value));case"NumberInterface":return new nn(t.id,Number(t.value),t.min,t.max);case"SelectInterface":return new Is(t.id,t.value,t.items);case"SliderInterface":return new Ds(t.id,Number(t.value),t.min,t.max);case"TupleInputInterface":return new xs(t.id,String(t.value));default:return new Xe(t.id,String(t.value))}},Ss=(e,t=!0)=>{const n=[],s=Object.keys(e);return s.forEach(a=>{if(e[a]?.hidden)return;const i=t&&n.length<s.indexOf(a)?`${a}=`:"";n.push(`${i}{{ inputs.${a} }}`)}),n},Zt=new X.NodeInterfaceType("boolean"),Ms=new X.NodeInterfaceType("dict"),Kt=new X.NodeInterfaceType("list"),mt=new X.NodeInterfaceType("node"),Xt=new X.NodeInterfaceType("number"),Jt=new X.NodeInterfaceType("string"),Qt=new X.NodeInterfaceType("tuple"),_i=e=>{new X.BaklavaInterfaceTypes(e.editor,{viewPlugin:e}).addTypes(Zt,Ms,Kt,mt,Xt,Jt,Qt)};class J extends re.NodeInterface{component=r.markRaw(ft);isCodeNode=!0;code;componentName="";state=r.reactive({optional:!1});type=null;get optional(){return this.state.optional}get shortId(){return this.id.slice(0,6)}getValue=()=>`${this.value??"None"}`;load(t){this.id=t.id,this.templateId=t.templateId,!["_code","out"].includes(this.name)&&(this.value=t.value,this.hidden=t.hidden,t.component&&(this.componentName=t.component),t.optional&&(this.state.optional=t.optional),this.hooks.load.execute(t))}save(){const t={id:this.id,templateId:this.templateId,value:""};return["_code","out"].includes(this.name)||(t.value=this.value,t.hidden=this.hidden,this.componentName&&(t.component=this.componentName),this.state.optional&&(t.optional=this.state.optional)),this.hooks.save.execute(t)}setOptional(t){return this.state.optional=t,this.setHidden(t),this}}const Ke=e=>{e.addInput("_code",new J("_code",[]).use(X.setTypeForMultipleConnections,mt).use(Ze.allowMultipleConnections).setHidden(!0)),e.addOutput("_code",new J("_code",[]).use(X.setTypeForMultipleConnections,mt).use(Ze.allowMultipleConnections).setHidden(!0))};class Pe extends J{component=r.markRaw(ft);constructor(t="",n){super(t,n),this.use(T.displayInSidebar,!0)}get value(){return super.value}set value(t){super.value=t,this.name!=="_code"&&this.setHidden(!1)}}class Os extends Pe{component=r.markRaw(T.CheckboxInterfaceComponent);componentName="CheckboxInterface";constructor(t,n){super(t,n),this.use(X.setType,Zt)}getValue=()=>this.value?"True":"False"}class Es extends J{component=r.markRaw(ft);isCodeNodeOutput=!0;suffix="";constructor(t="",n=""){super(t,""),this.suffix=n}get codeValue(){return this.node?.outputs._code?.value??""}get node(){const{graph:t}=T.useGraph();return t.value.findNodeById(this.nodeId)}}class en extends Pe{min;max;step;constructor(t,n,s,a,o){super(t,n),this.min=s,this.max=a,this.step=o,this.use(X.setType,Xt)}validate(t){return(this.min===void 0||t>=this.min)&&(this.max===void 0||t<=this.max)}}class tn extends en{component=r.markRaw(T.IntegerInterfaceComponent);componentName="IntegerInterface";validate(t){return Number.isInteger(t)&&super.validate(t)}}class Ts extends Pe{component=r.markRaw(pt);componentName="ListInputInterface";constructor(t,n=""){super(t,n),this.use(X.setType,Kt)}getValue=()=>`[${this.value}]`}class nn extends en{component=r.markRaw(T.NumberInterfaceComponent);componentName="NumberInterface"}class sn extends Pe{constructor(t,n){super(t,n),this.use(X.setType,Jt)}getValue=()=>`"${this.value}"`}class Is extends sn{component=r.markRaw(vs);componentName="SelectInterface";items=[];constructor(t,n,s){super(t,n),s&&(this.items=s)}}class Ds extends en{component=r.markRaw(T.SliderInterfaceComponent);componentName="SliderInterface";min=0;max=1;step=.01;getValue=()=>`${Math.round(this.value*1e3)/1e3}`}class Xe extends sn{component=r.markRaw(pt)}class gi extends sn{component=r.markRaw(Ns)}class xs extends Pe{component=r.markRaw(pt);componentName="TupleInputInterface";constructor(t,n=""){super(t,n),this.use(X.setType,Qt)}getValue=()=>`(${this.value})`}Ve.escape=e=>e;class an extends re.AbstractNode{_variableName="";codeTemplate;isCodeNode=!0;mask=null;name="";state;inputs={};outputs={};constructor(){super(),this.initializeIo(),this.twoColumn=!0,this.state=r.reactive({codeTemplate:"",hidden:!1,integrated:!1,lockCode:!1,modules:[],props:null,script:"",variableName:""}),this.codeTemplate=function(){return`${this.name}(${Ss(this.codeNodeInputs).join(", ")})`}}get code(){return this.graph.code}get codeNodeInputs(){return Object.fromEntries(Object.entries(this.inputs).filter(t=>t[1].isCodeNode&&t[1].type!="node"))}get codeNodeOutputs(){return Object.fromEntries(Object.entries(this.outputs).filter(t=>t[1].isCodeNode&&t[1].type!="node"))}get graph(){return super.graph}get hasConnectedOutputNodes(){return this.getConnectedNodes("outputs").length>0}get idx(){return this.graph.nodes.filter(t=>!t.state.integrated).indexOf(this)??-1}get idxByType(){return this.graph.getNodesByType(this.type).indexOf(this)??-1}get idxByVariableNames(){return this.graph.getNodesByVariableName(this._variableName).filter(t=>!t.state.integrated).indexOf(this)??-1}get isSelected(){return this.graph.selectedNodeIds.includes(this.id)}get lockCode(){return this.state.lockCode}set lockCode(t){this.state.lockCode=t,this.events.update.emit(null)}get optionalInputs(){return Object.fromEntries(Object.entries(this.codeNodeInputs).filter(t=>t[1].optional))}get requiredInputs(){return Object.fromEntries(Object.entries(this.codeNodeInputs).filter(t=>!t[1].optional))}get script(){return this.outputs._code?.value??""}set script(t){this.outputs._code&&(this.outputs._code.value=t),this.events.update.emit(null)}get shortId(){return this.id.slice(0,6)}get subgraph(){}get variableName(){return this.state.variableName||this._variableName?this.state.variableName||this._variableName+(this.idxByVariableNames+1):""}set variableName(t){this._variableName=t}getConnectedNodeByInterface(t,n){const s=this.getConnectedNodesByInterface(t,n);return s.length>0?s[0]:null}getConnectedNodes(t){let n=[];if(t!=="inputs"){const s=this.graph.connections.filter(a=>a.from.name!=="_code").filter(a=>a.from.nodeId===this.id).map(a=>a.to.nodeId);s&&(n=n.concat(s))}if(t!=="outputs"){const s=this.graph.connections.filter(a=>a.from.name!=="_code").filter(a=>a.to.nodeId===this.id).map(a=>a.from.nodeId);s&&(n=n.concat(s))}return!n||n.length==0?[]:n.map(s=>this.graph.findNodeById(s))}getConnectedNodesByInterface(t,n){let s=[];if(n!=="outputs"&&this.inputs[t]){const a=this.graph.connections.filter(o=>o.to.id===this.inputs[t]?.id||o.from.id===this.inputs[t]?.id).map(o=>o.from.nodeId);a&&(s=s.concat(a))}if(n!=="inputs"&&this.outputs[t]){const a=this.graph.connections.filter(o=>o.from.id===this.outputs[t]?.id||o.from.id===this.outputs[t]?.id).map(o=>o.to.nodeId);a&&(s=s.concat(a))}return!s||s.length==0?[]:s.map(a=>this.graph.findNodeById(a))}remove(){this.graph?.removeNode(this)}renderCode(t){return Object.keys(t.inputs).filter(n=>Array.isArray(t.inputs[n])&&n!=="_code").forEach(n=>{const s=[...t.inputs[n]];s.reverse(),t.inputs[n]=`[${s.join(", ")}]`}),Ve.render(this.state.codeTemplate,t)}updateCodeTemplate(){this.state.codeTemplate=this.codeTemplate.call(this)}updateModules(t){if(t)this.state.modules=t;else if(this.type.includes(".")){const n=this.type.split(".");this.state.modules.push(n.slice(0,n.length-1).join("."))}}updateOutputNames(){Object.values(this.codeNodeOutputs).forEach(t=>{t.name=this.state.integrated?"":this.variableName+t.suffix})}updateOutputValues(t){Object.keys(this.outputs).forEach(n=>{n!=="_code"&&(t[n]=this.state.integrated?t._code:this.outputs[n].name)})}updateProps(t){this.state.props=t}updateInputValues(t){const n=Object.keys(this.inputs);Object.keys(t).forEach(s=>{!n.includes(s)||!this.inputs[s]||(this.inputs[s].value=t[s],this.inputs[s].setHidden(!1))})}}class yt extends an{calculate=(t,n)=>{const s={};return this.lockCode||(s._code=this.renderCode({inputs:t,...n})),this.updateOutputValues(s),s};executeFactory(t,n){Object.keys(n||{}).forEach(s=>{const a=n[s]();t==="input"?this.addInput(s,a):this.addOutput(s,a)})}load(t){super.load(t),this.afterLoaded()}save(){return super.save()}}function ki(e){return class extends yt{type=e.type;inputs={};outputs={};constructor(){super(),this._title=e.title??e.type,this.executeFactory("input",e.inputs),this.executeFactory("output",e.outputs),e.calculate&&(this.calculate=(t,n)=>e.calculate.call(this,t,n)),e.onCreate?.call(this),this.name=e.name??e.type,this.updateModules(e.modules),e.codeTemplate&&(this.codeTemplate=e.codeTemplate),e.variableName!=null&&(this.variableName=e.variableName),Ke(this)}afterGraphLoaded(){e.afterGraphLoaded?.call(this)}afterLoaded(){e.afterLoaded?.call(this)}beforeRun(){e.beforeRun?.call(this)}onPlaced(){e.onPlaced?.call(this)}onConnected(){e.onConnected?.call(this)}onDestroy(){e.onDestroy?.call(this)}onUnconnected(){e.onUnconnected?.call(this)}update(){e.update?.call(this)}}}class Ys extends yt{}function bi(e){return class extends Ys{type=e.type;inputs={};outputs={};preventUpdate=!1;staticInputKeys=Object.keys(e.inputs??{});staticOutputKeys=Object.keys(e.outputs??{});constructor(){super(),this._title=e.title??e.type,this.executeFactory("input",e.inputs),this.executeFactory("output",e.outputs),e.calculate&&(this.calculate=(t,n)=>e.calculate?.call(this,t,n)),e.onCreate?.call(this),this.name=e.name??e.type,this.updateModules(e.modules),e.codeTemplate&&(this.codeTemplate=e.codeTemplate),e.variableName&&(this.variableName=e.variableName),Ke(this),this.staticInputKeys.push("_code"),this.staticOutputKeys.push("_code")}afterGraphLoaded(){e.afterGraphLoaded?.call(this)}afterLoaded(){e.afterLoaded?.call(this)}beforeRun(){e.beforeRun?.call(this)}onPlaced(){this.events.update.subscribe(this,t=>{t&&(t.type==="input"&&this.staticInputKeys.includes(t.name)||t.type==="output"&&this.staticOutputKeys.includes(t.name))&&this.onUpdate()}),this.onUpdate(),e.onPlaced?.call(this)}onConnected(){e.onConnected?.call(this)}onDestroy(){e.onDestroy?.call(this)}onUnconnected(){e.onUnconnected?.call(this)}update(){e.update?.call(this)}load(t){this.preventUpdate=!0,this.hooks.beforeLoad.execute(t),this.id=t.id,this.title=t.title;for(const n of this.staticInputKeys)this.inputs[n].load(t.inputs[n]),this.inputs[n].nodeId=this.id;for(const n of this.staticOutputKeys)this.outputs[n].load(t.outputs[n]),this.outputs[n].nodeId=this.id;this.preventUpdate=!1,this.onUpdate(),this.preventUpdate=!0;for(const n of Object.keys(t.inputs))if(!(this.staticInputKeys.includes(n)||!t.inputs[n])){if(!this.inputs[n]){const s=t.inputs[n],a=s.value;let o;s.component?o=Cs(s.component,{...s,id:n}):typeof a=="number"?0<a&&a<1?o=new nn(n,Number(a)):o=new tn(n,Number(a)):o=new Xe(n,String(a)),o.use(T.displayInSidebar,!0),this.addInput(n,o)}this.inputs[n]&&(this.inputs[n].load(t.inputs[n]),this.inputs[n].nodeId=this.id)}for(const n of Object.keys(t.outputs))if(!(this.staticOutputKeys.includes(n)||!t.outputs[n])){if(!this.outputs[n]){const s=new Es(n);this.addOutput(n,s)}this.outputs[n]&&(this.outputs[n].load(t.outputs[n]),this.outputs[n].nodeId=this.id)}this.preventUpdate=!1,this.events.loaded.emit(this)}onUpdate(){if(!e.onUpdate||this.preventUpdate)return;this.graph&&this.graph.activeTransactions++;const t=this.getStaticValues(this.staticInputKeys,this.inputs),n=this.getStaticValues(this.staticOutputKeys,this.outputs),s=e.onUpdate.call(this,t,n);this.updateInterfaces("input",s.inputs??{},s.forceUpdateInputs??[]),this.updateInterfaces("output",s.outputs??{},s.forceUpdateOutputs??[]),this.graph&&this.graph.activeTransactions--}getStaticValues(t,n){const s={};for(const a of t)s[a]=n[a].value;return s}updateInputInterfaces(t={},n=[]){this.updateInterfaces("input",t,n)}updateInterfaces(t,n={},s=[]){const a=t==="input"?this.staticInputKeys:this.staticOutputKeys,o=t==="input"?this.inputs:this.outputs;for(const i of Object.keys(o))a.includes(i)||n[i]&&!s.includes(i)||(t==="input"?this.removeInput(i):this.removeOutput(i));for(const i of Object.keys(n)){if(o[i])continue;const l=n[i]();t==="input"?this.addInput(i,l):this.addOutput(i,l)}}updateProps(t){this.state.props=t,this.onUpdate()}}}Ve.escape=e=>e;class _t{_id;_state;viewModel;constructor(){this._id=Ie.v4(),this._state=r.reactive({lockCode:!1,modules:{},script:"",template:""})}get engine(){return this.viewModel?.engine}get graph(){return this.viewModel?.editor.graph}get id(){return this._id}get lockCode(){return this.state.lockCode}set lockCode(t){this.state.lockCode=t,t||this.engine?.runOnce({})}get modules(){const t=[];return this.graph?.codeNodes.filter(n=>n.state.modules?.length>0).forEach(n=>t.push(...n.state.modules)),t?(t.sort(),Array.from(new Set(t.map(n=>this.state.modules[n])))):[]}get script(){return this.state.script}get shortId(){return this.id.slice(0,6)}get state(){return this._state}clear(){this.state.script=""}async loadTemplate(t){t.then(n=>{this._state.template=n.default??""})}registerViewModel(t){this.viewModel=t}renderCode(t){this.state.script=Ve.render(this.state.template??"",t??{})}}class wi extends _t{constructor(){super(),this.loadTemplate(Promise.resolve().then(()=>Bu))}}class vi extends _t{constructor(){super(),this.loadTemplate(Promise.resolve().then(()=>Vu))}}const gt=350;class Le extends re.Graph{code=null;editor;_state=r.reactive({codeTemplate:"{{ #nodes }}{{ script }}{{ /nodes }}",lockCode:!1});constructor(t,n){super(t,n),this.editor=t,this.template=n,t.code&&(this.code=t.code)}get codeNodes(){return rn(this)}get connections(){return super.connections}set connections(t){this._connections=t}get nodeIds(){return this.nodes.map(t=>t.id)}get nodes(){return super.nodes}set nodes(t){this._nodes=t}get scriptedCodeNodes(){return this.nodes.filter(t=>!t.state?.integrated)}get selectedNodeIds(){return this.selectedNodes.map(t=>t.id)}get shortId(){return this.id.slice(0,6)}get state(){return this._state}get visibleNodes(){return this.nodes.filter(t=>!t.state?.hidden)}addNode(t,n){return t.state&&n&&(t.state.props=n),super.addNode(t)}addNodeAtCoordinates=(t,n={x:0,y:0},s)=>(this.addNode(t,s),t.position&&(t.position=n),t);addConnection(t,n){return t&&t?.name!=="_code"&&(t.hidden=!1),n&&n?.name!=="_code"&&(n.hidden=!1),super.addConnection(t,n)}beforeRun(){this.nodes.forEach(t=>t.beforeRun())}clear(){this.selectedNodes=[],this._nodes=[],this._connections=[]}findNodeByType(t){return this.nodes.find(n=>n.type===t)}getNodesByType(t){return this.nodes.filter(n=>n.type===t)}getNodesByVariableName(t){return this.nodes.filter(n=>[n.state.variableName,n._variableName].includes(t))}hasConnection(t,n){return this.connections.some(s=>s.from.id===t.id&&s.to.id===n.id)}load(t){const n=super.load(t);return this.nodes.forEach(s=>s.afterGraphLoaded()),n}renderCode(t){return Ve.render(this.state?.codeTemplate||"",t)}sortNodes(){if(!(this.nodes.length===0||this.connections.length===0))try{let t=this.nodeIds;const n=this.connections.filter(o=>t.includes(o.to.nodeId)&&t.includes(o.from.nodeId)).map(o=>[o.to.nodeId,o.from.nodeId]);t.reverse(),t=Ha.array(t,n),t.reverse();const s=this.nodes.map(o=>o.id).filter(o=>!t.includes(o));t=[...t,...s];const a=t.map(o=>this.findNodeById(o));a&&(this.nodes=a)}catch{console.warn("Failed to sort nodes.")}}sortNodesByRank(){if(this.nodes.length===0)return;const t=new Map;this.nodes.forEach(s=>{const a=this.editor.nodeTypes.get(s.type).orderRank;t.has(a)?t.set(a,[...t.get(a),s]):t.set(a,[s])});const n=Array.from(t.keys());n.sort((s,a)=>s-a),this.nodes=n.flatMap(s=>t.get(s))}}const rn=e=>{const t=[];return e.nodes.length===0||e.nodes.forEach(n=>{n&&(n.hasOwnProperty("subgraph")?t.push(...rn(n.subgraph)):n.hasOwnProperty("isCodeNode")&&t.push(n))}),t},Ni=(e=0,t=100)=>({x:e*(gt+70),y:t}),Ci=e=>{const t={...e.position};return t.x-=gt+70,t.y+=50,t},on="__baklava_SubgraphInputNode",ln="__baklava_SubgraphOutputNode";class Rs extends yt{graphInterfaceId;constructor(){super(),this.graphInterfaceId=Ie.v4(),Ke(this),this.variableName="s"}onPlaced(){super.onPlaced(),this.initializeIo()}load(t){super.load(t),this.graphInterfaceId=t.graphInterfaceId}save(){return{...super.save(),graphInterfaceId:this.graphInterfaceId}}afterGraphLoaded(){}afterLoaded(){}beforeRun(){}onConnected(){}onUnconnected(){}update(){}}class dn extends Rs{static isGraphInputNode(t){return t.type===on}type=on;inputs={name:new J("Name","Input")};outputs={placeholder:new J("Value",void 0)}}class cn extends Rs{static isGraphOutputNode(t){return t.type===ln}type=ln;inputs={name:new J("Name","Output"),placeholder:new J("Value",void 0)};outputs={output:new J("Output",void 0).setHidden(!0)};calculate=({placeholder:t})=>({output:t})}class un extends dn{_title="Subgraph Input";inputs={name:new Xe("Name","Input").setPort(!1)};outputs={placeholder:new J("Connection",void 0)}}class hn extends cn{_title="Subgraph Output";inputs={name:new Xe("Name","Output").setPort(!1),placeholder:new J("Connection",void 0)};outputs={output:new J("Output",void 0).setHidden(!0)}}const Bs="CREATE_SUBGRAPH",Vs=[re.GRAPH_INPUT_NODE_TYPE,re.GRAPH_OUTPUT_NODE_TYPE];function Ps(e,t,n){const s=()=>e.value.selectedNodes.filter(o=>!Vs.includes(o.type)).length>0,a=()=>{const{viewModel:o}=T.useViewModel(),i=e.value,l=e.value.editor;if(i.selectedNodes.length===0)return;const d=i.selectedNodes.filter(M=>!Vs.includes(M.type)),c=d.flatMap(M=>Object.values(M.inputs)),u=d.flatMap(M=>Object.values(M.outputs)),_=i.connections.filter(M=>!u.includes(M.from)&&c.includes(M.to)),p=i.connections.filter(M=>u.includes(M.from)&&!c.includes(M.to)),I=i.connections.filter(M=>u.includes(M.from)&&c.includes(M.to)),k=d.map(M=>M.save()),S=I.map(M=>({id:M.id,from:M.from.id,to:M.to.id})),f=new Map,{xLeft:b,xRight:A,yTop:R}=Si(d);for(const[M,Z]of _.entries()){const ee=new un;ee.inputs.name.value=Z.to.name,k.push({...ee.save(),position:{x:A-o.value.settings.nodes.defaultWidth-100,y:R+M*200}}),S.push({id:Ie.v4(),from:ee.outputs.placeholder.id,to:Z.to.id}),f.set(Z.to.id,ee.graphInterfaceId)}for(const[M,Z]of p.entries()){const ee=new hn;ee.inputs.name.value=Z.from.name,k.push({...ee.save(),position:{x:b+100,y:R+M*200}}),S.push({id:Ie.v4(),from:Z.from.id,to:ee.inputs.placeholder.id}),f.set(Z.from.id,ee.graphInterfaceId)}const W=r.reactive(new dt({connections:S,nodes:k,inputs:[],outputs:[]},l));l.addGraphTemplate(W);const Se=l.nodeTypes.get(re.getGraphNodeTypeString(W));if(!Se)throw new Error("Unable to create subgraph: Could not find corresponding graph node type");i.activeTransactions++;const Me=r.reactive(new Se.type);i.addNode(Me);const ct=Math.round(d.map(M=>M.position.x).reduce((M,Z)=>M+Z,0)/d.length),me=Math.round(d.map(M=>M.position.y).reduce((M,Z)=>M+Z,0)/d.length);Me.position.x=ct,Me.position.y=me,_.forEach(M=>{i.removeConnection(M),i.addConnection(M.from,Me.inputs[f.get(M.to.id)])}),p.forEach(M=>{i.removeConnection(M),i.addConnection(Me.outputs[f.get(M.from.id)],M.to)}),d.forEach(M=>i.removeNode(M)),i.activeTransactions--,t.canExecuteCommand(T.Commands.SAVE_SUBGRAPH_COMMAND)&&t.executeCommand(T.Commands.SAVE_SUBGRAPH_COMMAND),n(W),e.value.panning={...i.panning},e.value.scaling=i.scaling};t.registerCommand(Bs,{canExecute:s,execute:a})}function Si(e){const t=e.reduce((a,o)=>{const i=o.position.x;return i<a?i:a},1/0),n=e.reduce((a,o)=>{const i=o.position.y;return i<a?i:a},1/0);return{xLeft:e.reduce((a,o)=>{const i=o.position.x+o.width;return i>a?i:a},-1/0),xRight:t,yTop:n}}const Mi=["component","connectionCount","events","hidden","hooks","id","isCodeNode","isInput","name","nodeId","port","templateId","value"];function Ls(e){return class extends an{type=re.getGraphNodeTypeString(e);get title(){return this._title}set title(n){this.template.name=n}inputs={};outputs={};template=e;subgraph;calculate=async(n,s)=>{if(!this.subgraph)throw new Error(`GraphNode ${this.id}: calculate called without subgraph being initialized`);if(!s.engine||typeof s.engine!="object")throw new Error(`GraphNode ${this.id}: calculate called but no engine provided in context`);const a=s.engine.getInputValues(this.subgraph);for(const l of this.subgraph.inputs)a.set(l.nodeInterfaceId,n[l.id]);const o=await s.engine.runGraph(this.subgraph,a,s.globalValues);s.engine.pause(),Ze.applyResult(o,s.engine.editor),s.engine.resume();const i={};for(const l of this.subgraph.outputs)i[l.id]=o.get(l.nodeId)?.get("output");return i._calculationResults=o,this.lockCode||(i._code=this.renderCode({inputs:n,...s.globalValues})),this.updateOutputValues(i),i};load(n){if(!this.subgraph)throw new Error("Cannot load a graph node without a graph");if(!this.template)throw new Error("Unable to load graph node without graph template");this.subgraph.load(n.graphState),super.load(n)}save(){if(!this.subgraph)throw new Error("Cannot save a graph node without a graph");return{...super.save(),graphState:this.subgraph.save()}}onPlaced(){this.template.events.updated.subscribe(this,()=>this.initialize()),this.template.events.nameChanged.subscribe(this,n=>{this._title=n}),this.initialize()}onDestroy(){this.template.events.updated.unsubscribe(this),this.template.events.nameChanged.unsubscribe(this),this.subgraph?.destroy()}initialize(){this.subgraph&&this.subgraph.destroy(),this.subgraph=this.template.createGraph(),this._title=this.template.name;const n=this.template.nodes.find(s=>s.type==="__baklava_SubgraphOutputNode");this.variableName=n?.inputs.name?.value??"s",this.updateInterfaces(),this.state.codeTemplate=`{{ #nodes }}{{ script }}
2
2
  {{ /nodes }}`,this.events.update.emit(null)}renderCode(n){return this.subgraph?this.subgraph.renderCode({nodes:this.subgraph.scriptedCodeNodes}):Ve.render(this.state.codeTemplate,n)}updateInterfaces(){if(!this.subgraph)throw new Error("Trying to update interfaces without graph instance");for(const n of this.subgraph.inputs)n.id in this.inputs?this.inputs[n.id].name=n.name:this.addInput(n.id,this.createProxyInterface(n,!0));for(const n of Object.keys(this.inputs))this.subgraph.inputs.some(s=>s.id===n)||this.removeInput(n);for(const n of this.subgraph.outputs)n.id in this.outputs?this.outputs[n.id].name=n.name:this.addOutput(n.id,this.createProxyInterface(n,!1));for(const n of Object.keys(this.outputs))this.subgraph.outputs.some(s=>s.id===n)||this.removeOutput(n);Ke(this),this.addOutput("_calculationResults",new re.NodeInterface("_calculationResults",void 0).setHidden(!0))}createProxyInterface(n,s){const a=new J(n.name,void 0);return new Proxy(a,{get:(o,i)=>{if(Mi.includes(i)||i in o||typeof i=="string"&&i.startsWith("__v_"))return Reflect.get(o,i);let l;s?l=this.subgraph?.nodes.find(_=>dn.isGraphInputNode(_)&&_.graphInterfaceId===n.id)?.outputs.placeholder.id:l=this.subgraph?.nodes.find(_=>cn.isGraphOutputNode(_)&&_.graphInterfaceId===n.id)?.inputs.placeholder.id;const d=this.subgraph?.connections.find(u=>l===(s?u.from:u.to)?.id),c=s?d?.to:d?.from;if(c)return Reflect.get(c,i)}})}}}var As;function y(){return As.apply(null,arguments)}function Oi(e){As=e}function oe(e){return e instanceof Array||Object.prototype.toString.call(e)==="[object Array]"}function De(e){return e!=null&&Object.prototype.toString.call(e)==="[object Object]"}function V(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function fn(e){if(Object.getOwnPropertyNames)return Object.getOwnPropertyNames(e).length===0;var t;for(t in e)if(V(e,t))return!1;return!0}function Q(e){return e===void 0}function ye(e){return typeof e=="number"||Object.prototype.toString.call(e)==="[object Number]"}function Je(e){return e instanceof Date||Object.prototype.toString.call(e)==="[object Date]"}function $s(e,t){var n=[],s,a=e.length;for(s=0;s<a;++s)n.push(t(e[s],s));return n}function Oe(e,t){for(var n in t)V(t,n)&&(e[n]=t[n]);return V(t,"toString")&&(e.toString=t.toString),V(t,"valueOf")&&(e.valueOf=t.valueOf),e}function ue(e,t,n,s){return fa(e,t,n,s,!0).utc()}function Ei(){return{empty:!1,unusedTokens:[],unusedInput:[],overflow:-2,charsLeftOver:0,nullInput:!1,invalidEra:null,invalidMonth:null,invalidFormat:!1,userInvalidated:!1,iso:!1,parsedDateParts:[],era:null,meridiem:null,rfc2822:!1,weekdayMismatch:!1}}function E(e){return e._pf==null&&(e._pf=Ei()),e._pf}var pn;Array.prototype.some?pn=Array.prototype.some:pn=function(e){var t=Object(this),n=t.length>>>0,s;for(s=0;s<n;s++)if(s in t&&e.call(this,t[s],s,t))return!0;return!1};function mn(e){var t=null,n=!1,s=e._d&&!isNaN(e._d.getTime());if(s&&(t=E(e),n=pn.call(t.parsedDateParts,function(a){return a!=null}),s=t.overflow<0&&!t.empty&&!t.invalidEra&&!t.invalidMonth&&!t.invalidWeekday&&!t.weekdayMismatch&&!t.nullInput&&!t.invalidFormat&&!t.userInvalidated&&(!t.meridiem||t.meridiem&&n),e._strict&&(s=s&&t.charsLeftOver===0&&t.unusedTokens.length===0&&t.bigHour===void 0)),Object.isFrozen==null||!Object.isFrozen(e))e._isValid=s;else return s;return e._isValid}function kt(e){var t=ue(NaN);return e!=null?Oe(E(t),e):E(t).userInvalidated=!0,t}var Us=y.momentProperties=[],yn=!1;function _n(e,t){var n,s,a,o=Us.length;if(Q(t._isAMomentObject)||(e._isAMomentObject=t._isAMomentObject),Q(t._i)||(e._i=t._i),Q(t._f)||(e._f=t._f),Q(t._l)||(e._l=t._l),Q(t._strict)||(e._strict=t._strict),Q(t._tzm)||(e._tzm=t._tzm),Q(t._isUTC)||(e._isUTC=t._isUTC),Q(t._offset)||(e._offset=t._offset),Q(t._pf)||(e._pf=E(t)),Q(t._locale)||(e._locale=t._locale),o>0)for(n=0;n<o;n++)s=Us[n],a=t[s],Q(a)||(e[s]=a);return e}function Qe(e){_n(this,e),this._d=new Date(e._d!=null?e._d.getTime():NaN),this.isValid()||(this._d=new Date(NaN)),yn===!1&&(yn=!0,y.updateOffset(this),yn=!1)}function ie(e){return e instanceof Qe||e!=null&&e._isAMomentObject!=null}function Fs(e){y.suppressDeprecationWarnings===!1&&typeof console<"u"&&console.warn&&console.warn("Deprecation warning: "+e)}function ne(e,t){var n=!0;return Oe(function(){if(y.deprecationHandler!=null&&y.deprecationHandler(null,e),n){var s=[],a,o,i,l=arguments.length;for(o=0;o<l;o++){if(a="",typeof arguments[o]=="object"){a+=`
3
3
  [`+o+"] ";for(i in arguments[0])V(arguments[0],i)&&(a+=i+": "+arguments[0][i]+", ");a=a.slice(0,-2)}else a=arguments[o];s.push(a)}Fs(e+`
4
4
  Arguments: `+Array.prototype.slice.call(s).join("")+`
@@ -7,7 +7,8 @@ export interface IValidator {
7
7
  export declare class BaseNumericInterface extends CodeNodeInputInterface<number> implements IValidator {
8
8
  min?: number;
9
9
  max?: number;
10
- constructor(name: string, value: number, min?: number, max?: number);
10
+ step?: number;
11
+ constructor(name: string, value: number, min?: number, max?: number, step?: number);
11
12
  validate(v: number): boolean;
12
13
  }
13
14
  export declare const useBaseNumericInterface: (intf: Ref<NodeInterface<number>>, precision?: number) => {
@@ -5,5 +5,6 @@ export declare class SliderInterface extends BaseNumericInterface {
5
5
  componentName: string;
6
6
  min: number;
7
7
  max: number;
8
+ step: number;
8
9
  getValue: () => string;
9
10
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@babsey/code-graph",
3
- "version": "0.11.0",
3
+ "version": "0.11.2",
4
4
  "author": "babsey <spreizer@web.de>",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -47,7 +47,7 @@
47
47
  "devDependencies": {
48
48
  "@tsconfig/node-lts": "~24.0",
49
49
  "@types/mustache": "~4.2",
50
- "@types/node": "~25.0",
50
+ "@types/node": "~25.1",
51
51
  "@types/toposort": "~2.0",
52
52
  "@vitejs/plugin-vue": "~6.0",
53
53
  "@vue/eslint-config-prettier": "~10.2",