@babsey/code-graph 0.3.1 → 0.4.0

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.
@@ -1,15 +1,15 @@
1
- import Z from "mustache";
2
- import { reactive as D, defineComponent as F, createElementBlock as p, openBlock as d, toDisplayString as G, markRaw as z, computed as O, createElementVNode as u, withDirectives as de, vModelText as le, createStaticVNode as se, toRef as Be, onMounted as fe, onBeforeUnmount as ze, watch as He, createBlock as j, unref as w, withCtx as ee, createVNode as L, normalizeProps as pt, guardReactiveProps as ht, renderSlot as ne, mergeProps as mt, ref as V, onUpdated as Le, normalizeStyle as ve, normalizeClass as Y, createCommentVNode as M, withModifiers as te, Fragment as B, createTextVNode as ft, withKeys as he, renderList as J, nextTick as vt, inject as gt, Transition as bt, resolveDynamicComponent as Me, shallowReadonly as _t } from "vue";
3
- import { v4 as K } from "uuid";
4
- import { AbstractNode as yt, NodeInterface as A, getGraphNodeTypeString as Ue, Graph as Ct, GraphTemplate as It, GRAPH_NODE_TYPE_PREFIX as wt, GRAPH_INPUT_NODE_TYPE as kt, GRAPH_OUTPUT_NODE_TYPE as Nt, Editor as xt } from "@baklavajs/core";
5
- import { NodeInterfaceType as X, BaklavaInterfaceTypes as Ot, setType as $ } from "@baklavajs/interface-types";
6
- import { allowMultipleConnections as Q, applyResult as Ae, BaseEngine as Tt, sortTopologically as Et } from "@baklavajs/engine";
7
- import { displayInSidebar as De, CheckboxInterfaceComponent as $t, useGraph as ge, IntegerInterfaceComponent as Mt, TextInputInterfaceComponent as Fe, NumberInterfaceComponent as Gt, SelectInterfaceComponent as St, SliderInterfaceComponent as Pt, TextareaInputInterfaceComponent as Vt, IntegerInterface as Rt, TextInputInterface as be, DEFAULT_TOOLBAR_COMMANDS as jt, Commands as q, BaklavaEditor as Bt, Components as me, useViewModel as oe, useTemporaryConnection as zt, useTransform as Ht, useNodeCategories as Lt, DEFAULT_SETTINGS as Ut, useCommandHandler as At, useHistory as Dt, useClipboard as Ft, registerDeleteNodesCommand as Wt, registerSaveSubgraphCommand as Yt, registerSwitchToMainGraphCommand as Kt, registerSidebarCommands as Xt, registerZoomToFitCommands as qt, setViewNodeProperties as Jt } from "@baklavajs/renderer-vue";
8
- import Qt from "toposort";
9
- import { SequentialHook as Ge } from "@baklavajs/events";
10
- import { usePointer as Zt } from "@vueuse/core";
11
- Z.escape = (n) => n;
12
- class We extends yt {
1
+ import ce from "mustache";
2
+ import { reactive as te, defineComponent as F, createElementBlock as b, openBlock as p, toDisplayString as L, markRaw as W, computed as P, createElementVNode as m, withDirectives as ke, vModelText as xe, createStaticVNode as fe, toRef as Me, ref as H, createVNode as G, unref as O, mergeModels as Ue, useModel as xt, resolveComponent as Ze, createCommentVNode as j, onMounted as Se, onBeforeUnmount as et, watch as tt, createBlock as B, withCtx as ee, normalizeProps as It, guardReactiveProps as Nt, renderSlot as q, mergeProps as Et, onUpdated as nt, normalizeStyle as Pe, normalizeClass as ne, withModifiers as le, Fragment as U, createTextVNode as ot, withKeys as Oe, renderList as se, nextTick as Tt, resolveDynamicComponent as De, inject as Ot, Transition as $t, shallowReadonly as Mt } from "vue";
3
+ import { v4 as re } from "uuid";
4
+ import { AbstractNode as St, NodeInterface as J, getGraphNodeTypeString as st, Graph as Pt, GraphTemplate as Gt, GRAPH_NODE_TYPE_PREFIX as At, GRAPH_INPUT_NODE_TYPE as Rt, GRAPH_OUTPUT_NODE_TYPE as jt, Editor as Lt } from "@baklavajs/core";
5
+ import { NodeInterfaceType as ae, BaklavaInterfaceTypes as Vt, setType as V } from "@baklavajs/interface-types";
6
+ import { allowMultipleConnections as de, applyResult as rt, BaseEngine as Bt, sortTopologically as Ht } from "@baklavajs/engine";
7
+ import { displayInSidebar as at, CheckboxInterfaceComponent as zt, useGraph as Ge, IntegerInterfaceComponent as Ut, TextInputInterfaceComponent as it, NumberInterfaceComponent as Dt, SelectInterfaceComponent as Ft, SliderInterfaceComponent as Wt, TextareaInputInterfaceComponent as Yt, IntegerInterface as Xt, TextInputInterface as Ae, DEFAULT_TOOLBAR_COMMANDS as Kt, Commands as ue, BaklavaEditor as qt, Components as $e, useViewModel as me, useTemporaryConnection as Jt, useTransform as Qt, useNodeCategories as Zt, DEFAULT_SETTINGS as en, useCommandHandler as tn, useHistory as nn, useClipboard as on, registerDeleteNodesCommand as sn, registerSaveSubgraphCommand as rn, registerSwitchToMainGraphCommand as an, registerSidebarCommands as ln, registerZoomToFitCommands as un, setViewNodeProperties as dn } from "@baklavajs/renderer-vue";
8
+ import cn from "toposort";
9
+ import { SequentialHook as Fe } from "@baklavajs/events";
10
+ import { usePointer as pn } from "@vueuse/core";
11
+ ce.escape = (n) => n;
12
+ class lt extends St {
13
13
  state;
14
14
  isCodeNode = !0;
15
15
  name = "";
@@ -17,7 +17,7 @@ class We extends yt {
17
17
  inputs = {};
18
18
  outputs = {};
19
19
  constructor() {
20
- super(), this.initializeIo(), this.twoColumn = !0, this.state = D({
20
+ super(), this.initializeIo(), this.twoColumn = !0, this.state = te({
21
21
  codeTemplate: "",
22
22
  hidden: !1,
23
23
  integrated: !1,
@@ -27,7 +27,7 @@ class We extends yt {
27
27
  script: "",
28
28
  variableName: "a"
29
29
  }), this.codeTemplate = function() {
30
- return `${this.name}(${en(this.codeNodeInputs).join(", ")})`;
30
+ return `${this.name}(${hn(this.codeNodeInputs).join(", ")})`;
31
31
  };
32
32
  }
33
33
  get code() {
@@ -121,14 +121,14 @@ class We extends yt {
121
121
  let s = [];
122
122
  if (t !== "outputs" && this.inputs[e]) {
123
123
  const o = this.graph.connections.filter(
124
- (a) => a.to.id === this.inputs[e]?.id || a.from.id === this.inputs[e]?.id
125
- ).map((a) => a.from.nodeId);
124
+ (r) => r.to.id === this.inputs[e]?.id || r.from.id === this.inputs[e]?.id
125
+ ).map((r) => r.from.nodeId);
126
126
  o && (s = s.concat(o));
127
127
  }
128
128
  if (t !== "inputs" && this.outputs[e]) {
129
129
  const o = this.graph.connections.filter(
130
- (a) => a.from.id === this.outputs[e]?.id || a.from.id === this.outputs[e]?.id
131
- ).map((a) => a.to.nodeId);
130
+ (r) => r.from.id === this.outputs[e]?.id || r.from.id === this.outputs[e]?.id
131
+ ).map((r) => r.to.nodeId);
132
132
  o && (s = s.concat(o));
133
133
  }
134
134
  return !s || s.length == 0 ? [] : s.map((o) => this.graph.findNodeById(o));
@@ -144,7 +144,7 @@ class We extends yt {
144
144
  * Render code of this node.
145
145
  */
146
146
  renderCode(e) {
147
- return Z.render(this.state.codeTemplate, e);
147
+ return ce.render(this.state.codeTemplate, e);
148
148
  }
149
149
  /**
150
150
  * Update code templates.
@@ -189,7 +189,7 @@ class We extends yt {
189
189
  this.state.props = e;
190
190
  }
191
191
  }
192
- class _e extends We {
192
+ class Re extends lt {
193
193
  /**
194
194
  * The default implementation does nothing.
195
195
  * Overwrite this method to do calculation.
@@ -202,58 +202,58 @@ class _e extends We {
202
202
  return this.lockCode || (s._code = this.renderCode({ inputs: e, ...t })), this.updateOutputValues(s), s;
203
203
  };
204
204
  load(e) {
205
- super.load(e), Ye(this.graph, e);
205
+ super.load(e), ut(this.graph, e);
206
206
  }
207
207
  save() {
208
208
  const e = super.save();
209
- return tn(this.graph, e), e;
209
+ return fn(this.graph, e), e;
210
210
  }
211
211
  }
212
- const en = (n, e = !0) => {
212
+ const hn = (n, e = !0) => {
213
213
  const t = [], s = Object.keys(n);
214
214
  return s.forEach((o) => {
215
215
  if (n[o]?.hidden) return;
216
216
  const i = e && t.length < s.indexOf(o) ? `${o}=` : "";
217
217
  t.push(`${i}{{ inputs.${o} }}`);
218
218
  }), t;
219
- }, Ye = (n, e) => {
219
+ }, ut = (n, e) => {
220
220
  if (!n) return;
221
221
  const t = n.findNodeById(e.id);
222
222
  if (!t || t.subgraph) return;
223
223
  const s = t;
224
- s.state && (s.state.integrated = e.integrated, s.state.modules = e.modules, s.state.props = e.props), Object.entries(e.inputs).forEach(([o, a]) => {
225
- o !== "_code" && s.inputs[o] && (s.inputs[o].hidden = a.hidden);
226
- }), Object.entries(e.outputs).forEach(([o, a]) => {
227
- o !== "_code" && s.outputs[o] && (s.outputs[o].hidden = a.hidden);
224
+ s.state && (s.state.integrated = e.integrated, s.state.modules = e.modules, s.state.props = e.props), Object.entries(e.inputs).forEach(([o, r]) => {
225
+ o !== "_code" && s.inputs[o] && (s.inputs[o].hidden = r.hidden);
226
+ }), Object.entries(e.outputs).forEach(([o, r]) => {
227
+ o !== "_code" && s.outputs[o] && (s.outputs[o].hidden = r.hidden);
228
228
  });
229
- }, tn = (n, e) => {
229
+ }, fn = (n, e) => {
230
230
  if (!n) return;
231
231
  const t = n.findNodeById(e.id);
232
232
  if (!t || t.subgraph) return;
233
233
  const s = t;
234
- s.state && (e.integrated = s.state.integrated, e.modules = s.state.modules), Object.entries(e.inputs).forEach(([o, a]) => {
235
- o !== "_code" && s.inputs[o] && (a.hidden = s.inputs[o].hidden);
236
- }), Object.entries(e.outputs).forEach(([o, a]) => {
237
- o !== "_code" && s.outputs[o] && (a.hidden = s.outputs[o].hidden);
234
+ s.state && (e.integrated = s.state.integrated, e.modules = s.state.modules), Object.entries(e.inputs).forEach(([o, r]) => {
235
+ o !== "_code" && s.inputs[o] && (r.hidden = s.inputs[o].hidden);
236
+ }), Object.entries(e.outputs).forEach(([o, r]) => {
237
+ o !== "_code" && s.outputs[o] && (r.hidden = s.outputs[o].hidden);
238
238
  });
239
- }, nn = ["title"], ye = /* @__PURE__ */ F({
239
+ }, mn = ["title"], je = /* @__PURE__ */ F({
240
240
  __name: "CodeNodeInterface",
241
241
  props: {
242
242
  intf: {}
243
243
  },
244
244
  setup(n) {
245
- return (e, t) => (d(), p("div", {
245
+ return (e, t) => (p(), b("div", {
246
246
  title: n.intf.value
247
- }, G(n.intf.name), 9, nn));
247
+ }, L(n.intf.name), 9, mn));
248
248
  }
249
249
  });
250
- class R extends A {
250
+ class D extends J {
251
251
  isCodeNode = !0;
252
252
  code;
253
253
  state;
254
254
  type = null;
255
255
  constructor(e, t) {
256
- super(e, t), this.setComponent(z(ye)), this.state = D({
256
+ super(e, t), this.setComponent(W(je)), this.state = te({
257
257
  optional: !1
258
258
  });
259
259
  }
@@ -268,9 +268,9 @@ class R extends A {
268
268
  return this.state.optional = e, this.setHidden(e), this;
269
269
  }
270
270
  }
271
- class ae extends R {
271
+ class ve extends D {
272
272
  constructor(e = "", t) {
273
- super(e, t), this.setComponent(z(ye)), this.use(De, !0);
273
+ super(e, t), this.setComponent(W(je)), this.use(at, !0);
274
274
  }
275
275
  get value() {
276
276
  return super.value;
@@ -279,69 +279,69 @@ class ae extends R {
279
279
  super.value = e, this.name !== "_code" && this.setHidden(!1);
280
280
  }
281
281
  }
282
- const Ke = new X("boolean"), sn = new X("dict"), Xe = new X("list"), U = new X("node"), Ce = new X("number"), Ie = new X("string"), qe = new X("tuple"), mo = (n) => {
283
- new Ot(n.editor, { viewPlugin: n }).addTypes(Ke, sn, Xe, U, Ce, Ie, qe);
282
+ const dt = new ae("boolean"), vn = new ae("dict"), ct = new ae("list"), X = new ae("node"), Le = new ae("number"), Ve = new ae("string"), pt = new ae("tuple"), or = (n) => {
283
+ new Vt(n.editor, { viewPlugin: n }).addTypes(dt, vn, ct, X, Le, Ve, pt);
284
284
  };
285
- class fo extends ae {
285
+ class sr extends ve {
286
286
  constructor(e, t) {
287
- super(e, t), this.setComponent(z($t)), this.use($, Ke);
287
+ super(e, t), this.setComponent(W(zt)), this.use(V, dt);
288
288
  }
289
289
  getValue = () => this.value ? "True" : "False";
290
290
  }
291
- class on extends R {
291
+ class gn extends D {
292
292
  isCodeNodeOutput = !0;
293
293
  suffix = "";
294
294
  constructor(e = "", t = "") {
295
- super(e, ""), this.suffix = t, this.setComponent(z(ye));
295
+ super(e, ""), this.suffix = t, this.setComponent(W(je));
296
296
  }
297
297
  get codeValue() {
298
298
  return this.node?.outputs._code.value ?? "";
299
299
  }
300
300
  get node() {
301
- const { graph: e } = ge();
301
+ const { graph: e } = Ge();
302
302
  return e.value.findNodeById(this.nodeId);
303
303
  }
304
304
  }
305
- class we extends ae {
305
+ class Be extends ve {
306
306
  min;
307
307
  max;
308
308
  constructor(e, t, s, o) {
309
- super(e, t), this.min = s, this.max = o, this.use($, Ce);
309
+ super(e, t), this.min = s, this.max = o, this.use(V, Le);
310
310
  }
311
311
  validate(e) {
312
312
  return (this.min === void 0 || e >= this.min) && (this.max === void 0 || e <= this.max);
313
313
  }
314
314
  }
315
- class vo extends we {
316
- component = z(Mt);
315
+ class rr extends Be {
316
+ component = W(Ut);
317
317
  validate(e) {
318
318
  return Number.isInteger(e) && super.validate(e);
319
319
  }
320
320
  }
321
- class go extends ae {
321
+ class ar extends ve {
322
322
  constructor(e = "", t = "") {
323
- super(e, t), this.setComponent(z(Fe)), this.use($, Xe);
323
+ super(e, t), this.setComponent(W(it)), this.use(V, ct);
324
324
  }
325
325
  getValue = () => `[${this.value}]`;
326
326
  }
327
- class bo extends we {
328
- component = z(Gt);
327
+ class ir extends Be {
328
+ component = W(Dt);
329
329
  }
330
- class ke extends ae {
330
+ class He extends ve {
331
331
  constructor(e, t) {
332
- super(e, t), this.use($, Ie);
332
+ super(e, t), this.use(V, Ve);
333
333
  }
334
334
  getValue = () => `"${this.value}"`;
335
335
  }
336
- class _o extends ke {
337
- component = z(St);
336
+ class lr extends He {
337
+ component = W(Ft);
338
338
  items;
339
339
  constructor(e, t, s) {
340
340
  super(e, t), this.items = s;
341
341
  }
342
342
  }
343
- class yo extends we {
344
- component = z(Pt);
343
+ class ur extends Be {
344
+ component = W(Wt);
345
345
  min;
346
346
  max;
347
347
  constructor(e, t, s, o) {
@@ -349,7 +349,7 @@ class yo extends we {
349
349
  }
350
350
  getValue = () => `${Math.round(this.value * 1e3) / 1e3}`;
351
351
  }
352
- const an = F({
352
+ const bn = F({
353
353
  props: {
354
354
  intf: {
355
355
  type: Object,
@@ -362,58 +362,58 @@ const an = F({
362
362
  },
363
363
  emits: ["update:modelValue"],
364
364
  setup(n, { emit: e }) {
365
- return { v: O({
365
+ return { v: P({
366
366
  get: () => n.modelValue,
367
367
  set: (s) => {
368
368
  e("update:modelValue", s);
369
369
  }
370
370
  }) };
371
371
  }
372
- }), P = (n, e) => {
372
+ }), A = (n, e) => {
373
373
  const t = n.__vccOpts || n;
374
374
  for (const [s, o] of e)
375
375
  t[s] = o;
376
376
  return t;
377
- }, rn = { style: { position: "relative" } }, dn = { style: { "font-size": "12px", padding: "0 6px", position: "absolute", top: "-8px", "background-color": "var(--baklava-node-color-background)" } }, ln = ["placeholder", "title"];
378
- function un(n, e, t, s, o, a) {
379
- return d(), p("div", rn, [
380
- u("label", dn, G(n.intf.name), 1),
381
- de(u("input", {
377
+ }, yn = { style: { position: "relative" } }, _n = { style: { "font-size": "12px", padding: "0 6px", position: "absolute", top: "-8px", "background-color": "var(--baklava-node-color-background)" } }, Cn = ["placeholder", "title"];
378
+ function wn(n, e, t, s, o, r) {
379
+ return p(), b("div", yn, [
380
+ m("label", _n, L(n.intf.name), 1),
381
+ ke(m("input", {
382
382
  "onUpdate:modelValue": e[0] || (e[0] = (i) => n.v = i),
383
383
  type: "text",
384
384
  class: "baklava-input",
385
385
  placeholder: n.intf.name,
386
386
  title: n.intf.name
387
- }, null, 8, ln), [
388
- [le, n.v]
387
+ }, null, 8, Cn), [
388
+ [xe, n.v]
389
389
  ])
390
390
  ]);
391
391
  }
392
- const cn = /* @__PURE__ */ P(an, [["render", un]]);
393
- class Co extends ke {
394
- component = z(cn);
392
+ const kn = /* @__PURE__ */ A(bn, [["render", wn]]);
393
+ class dr extends He {
394
+ component = W(kn);
395
395
  }
396
- class Io extends ke {
397
- component = z(Vt);
396
+ class cr extends He {
397
+ component = W(Yt);
398
398
  }
399
- class wo extends ae {
399
+ class pr extends ve {
400
400
  constructor(e = "", t = "") {
401
- super(e, t), this.setComponent(z(Fe)), this.use($, qe);
401
+ super(e, t), this.setComponent(W(it)), this.use(V, pt);
402
402
  }
403
403
  getValue = () => `(${this.value})`;
404
404
  }
405
- function ko(n) {
406
- return class extends _e {
405
+ function hr(n) {
406
+ return class extends Re {
407
407
  type = n.type;
408
408
  inputs = {};
409
409
  outputs = {};
410
410
  constructor() {
411
411
  super(), this._title = n.title ?? n.type, this.executeFactory("input", n.inputs), this.executeFactory("output", n.outputs), n.calculate && (this.calculate = (e, t) => n.calculate.call(this, { inputs: e, ...t })), n.onCreate?.call(this), this.name = n.name ?? n.type, this.updateModules(n.modules), n.variableName != null && (this.state.variableName = n.variableName), n.codeTemplate && (this.codeTemplate = n.codeTemplate), this.addInput(
412
412
  "_code",
413
- new R("", []).use($, U).use(Q).setHidden(!0)
413
+ new D("", []).use(V, X).use(de).setHidden(!0)
414
414
  ), this.addOutput(
415
415
  "_code",
416
- new R("", []).use($, U).use(Q).setHidden(!0)
416
+ new D("", []).use(V, X).use(de).setHidden(!0)
417
417
  );
418
418
  }
419
419
  onPlaced() {
@@ -439,10 +439,10 @@ function ko(n) {
439
439
  }
440
440
  };
441
441
  }
442
- class pn extends _e {
442
+ class xn extends Re {
443
443
  }
444
- function No(n) {
445
- return class extends pn {
444
+ function fr(n) {
445
+ return class extends xn {
446
446
  type = n.type;
447
447
  inputs = {};
448
448
  outputs = {};
@@ -452,10 +452,10 @@ function No(n) {
452
452
  constructor() {
453
453
  super(), this._title = n.title ?? n.type, this.executeFactory("input", n.inputs), this.executeFactory("output", n.outputs), n.calculate && (this.calculate = (e, t) => n.calculate?.call(this, e, t)), n.onCreate?.call(this), this.name = n.name ?? n.type, this.updateModules(n.modules), n.codeTemplate && (this.codeTemplate = n.codeTemplate), n.variableName && (this.state.variableName = n.variableName), this.addInput(
454
454
  "_code",
455
- new R("", []).use($, U).use(Q).setHidden(!0)
455
+ new D("", []).use(V, X).use(de).setHidden(!0)
456
456
  ), this.addOutput(
457
457
  "_code",
458
- new R("", []).use($, U).use(Q).setHidden(!0)
458
+ new D("", []).use(V, X).use(de).setHidden(!0)
459
459
  ), this.staticInputKeys.push("_code"), this.staticOutputKeys.push("_code");
460
460
  }
461
461
  onPlaced() {
@@ -487,19 +487,19 @@ function No(n) {
487
487
  if (!this.inputs[t]) {
488
488
  const s = e.inputs[t].value;
489
489
  let o;
490
- typeof s == "number" ? o = new Rt(t, s).use($, Ce) : o = new be(t, JSON.stringify(s)).use($, Ie), o.use(De, !0), this.addInput(t, o);
490
+ typeof s == "number" ? o = new Xt(t, s).use(V, Le) : o = new Ae(t, JSON.stringify(s)).use(V, Ve), o.use(at, !0), this.addInput(t, o);
491
491
  }
492
492
  this.inputs[t] && (this.inputs[t].load(e.inputs[t]), this.inputs[t].nodeId = this.id);
493
493
  }
494
494
  for (const t of Object.keys(e.outputs))
495
495
  if (!this.staticOutputKeys.includes(t)) {
496
496
  if (!this.outputs[t]) {
497
- const s = new on(t);
497
+ const s = new gn(t);
498
498
  this.addOutput(t, s);
499
499
  }
500
500
  this.outputs[t] && (this.outputs[t].load(e.outputs[t]), this.outputs[t].nodeId = this.id);
501
501
  }
502
- Ye(this.graph, e), this.preventUpdate = !1, this.events.loaded.emit(this);
502
+ ut(this.graph, e), this.preventUpdate = !1, this.events.loaded.emit(this);
503
503
  }
504
504
  onUpdate() {
505
505
  if (this.preventUpdate) return;
@@ -514,13 +514,13 @@ function No(n) {
514
514
  return s;
515
515
  }
516
516
  updateInterfaces(e, t, s) {
517
- const o = e === "input" ? this.staticInputKeys : this.staticOutputKeys, a = e === "input" ? this.inputs : this.outputs;
518
- for (const i of Object.keys(a))
517
+ const o = e === "input" ? this.staticInputKeys : this.staticOutputKeys, r = e === "input" ? this.inputs : this.outputs;
518
+ for (const i of Object.keys(r))
519
519
  o.includes(i) || t[i] && !s.includes(i) || (e === "input" ? this.removeInput(i) : this.removeOutput(i));
520
520
  for (const i of Object.keys(t)) {
521
- if (a[i]) continue;
522
- const r = t[i]();
523
- e === "input" ? this.addInput(i, r) : this.addOutput(i, r);
521
+ if (r[i]) continue;
522
+ const a = t[i]();
523
+ e === "input" ? this.addInput(i, a) : this.addOutput(i, a);
524
524
  }
525
525
  }
526
526
  updateProps(e) {
@@ -534,11 +534,11 @@ function No(n) {
534
534
  }
535
535
  };
536
536
  }
537
- const Se = "__baklava_SubgraphInputNode", Pe = "__baklava_SubgraphOutputNode";
538
- class Je extends _e {
537
+ const We = "__baklava_SubgraphInputNode", Ye = "__baklava_SubgraphOutputNode";
538
+ class ht extends Re {
539
539
  graphInterfaceId;
540
540
  constructor() {
541
- super(), this.graphInterfaceId = K();
541
+ super(), this.graphInterfaceId = re();
542
542
  }
543
543
  onPlaced() {
544
544
  super.onPlaced(), this.initializeIo();
@@ -555,35 +555,35 @@ class Je extends _e {
555
555
  update() {
556
556
  }
557
557
  }
558
- class Qe extends Je {
558
+ class ft extends ht {
559
559
  static isGraphInputNode(e) {
560
- return e.type === Se;
560
+ return e.type === We;
561
561
  }
562
- type = Se;
562
+ type = We;
563
563
  inputs = {
564
- name: new A("Name", "Input")
564
+ name: new J("Name", "Input")
565
565
  };
566
566
  outputs = {
567
- placeholder: new A("Value", void 0)
567
+ placeholder: new J("Value", void 0)
568
568
  };
569
569
  }
570
- class Ze extends Je {
570
+ class mt extends ht {
571
571
  static isGraphOutputNode(e) {
572
- return e.type === Pe;
572
+ return e.type === Ye;
573
573
  }
574
- type = Pe;
574
+ type = Ye;
575
575
  inputs = {
576
- name: new A("Name", "Output"),
577
- placeholder: new A("Value", void 0)
576
+ name: new J("Name", "Output"),
577
+ placeholder: new J("Value", void 0)
578
578
  };
579
579
  outputs = {
580
- output: new A("Output", void 0).setHidden(!0)
580
+ output: new J("Output", void 0).setHidden(!0)
581
581
  };
582
582
  calculate = ({ placeholder: e }) => ({
583
583
  output: e
584
584
  });
585
585
  }
586
- const hn = [
586
+ const In = [
587
587
  "component",
588
588
  "connectionCount",
589
589
  "events",
@@ -598,9 +598,9 @@ const hn = [
598
598
  "templateId",
599
599
  "value"
600
600
  ];
601
- function mn(n) {
602
- return class extends We {
603
- type = Ue(n);
601
+ function Nn(n) {
602
+ return class extends lt {
603
+ type = st(n);
604
604
  get title() {
605
605
  return this._title;
606
606
  }
@@ -622,18 +622,18 @@ function mn(n) {
622
622
  if (!s.engine || typeof s.engine != "object")
623
623
  throw new Error(`GraphNode ${this.id}: calculate called but no engine provided in context`);
624
624
  const o = s.engine.getInputValues(this.subgraph);
625
- for (const r of this.subgraph.inputs)
626
- o.set(r.nodeInterfaceId, t[r.id]);
627
- const a = await s.engine.runGraph(
625
+ for (const a of this.subgraph.inputs)
626
+ o.set(a.nodeInterfaceId, t[a.id]);
627
+ const r = await s.engine.runGraph(
628
628
  this.subgraph,
629
629
  o,
630
630
  s.globalValues
631
631
  );
632
- s.engine.pause(), Ae(a, s.engine.editor), s.engine.resume();
632
+ s.engine.pause(), rt(r, s.engine.editor), s.engine.resume();
633
633
  const i = {};
634
- for (const r of this.subgraph.outputs)
635
- i[r.id] = a.get(r.nodeId)?.get("output");
636
- return i._calculationResults = a, this.lockCode || (i._code = this.renderCode({ inputs: t, ...s.globalValues })), this.updateOutputValues(i), i;
634
+ for (const a of this.subgraph.outputs)
635
+ i[a.id] = r.get(a.nodeId)?.get("output");
636
+ return i._calculationResults = r, this.lockCode || (i._code = this.renderCode({ inputs: t, ...s.globalValues })), this.updateOutputValues(i), i;
637
637
  };
638
638
  load(t) {
639
639
  if (!this.subgraph) throw new Error("Cannot load a graph node without a graph");
@@ -663,7 +663,7 @@ function mn(n) {
663
663
  * Render code of this node.
664
664
  */
665
665
  renderCode(t) {
666
- return this.subgraph ? this.subgraph.renderCode({ nodes: this.subgraph.scriptedCodeNodes }) : Z.render(this.state.codeTemplate, t);
666
+ return this.subgraph ? this.subgraph.renderCode({ nodes: this.subgraph.scriptedCodeNodes }) : ce.render(this.state.codeTemplate, t);
667
667
  }
668
668
  updateInterfaces() {
669
669
  if (!this.subgraph) throw new Error("Trying to update interfaces without graph instance");
@@ -677,11 +677,11 @@ function mn(n) {
677
677
  this.subgraph.outputs.some((s) => s.id === t) || this.removeOutput(t);
678
678
  this.addInput(
679
679
  "_code",
680
- new R("", []).use($, U).use(Q).setHidden(!0)
680
+ new D("", []).use(V, X).use(de).setHidden(!0)
681
681
  ), this.addOutput(
682
682
  "_code",
683
- new R("", []).use($, U).use(Q).setHidden(!0)
684
- ), this.addOutput("_calculationResults", new A("_calculationResults", void 0).setHidden(!0));
683
+ new D("", []).use(V, X).use(de).setHidden(!0)
684
+ ), this.addOutput("_calculationResults", new J("_calculationResults", void 0).setHidden(!0));
685
685
  }
686
686
  /**
687
687
  * When we create a interface in the graph node, we hide certain properties of the interface in the subgraph.
@@ -689,31 +689,31 @@ function mn(n) {
689
689
  * These properties should be proxied to the subgraph interface, so they behave the same as the original interface.
690
690
  */
691
691
  createProxyInterface(t, s) {
692
- const o = new R(t.name, void 0);
692
+ const o = new D(t.name, void 0);
693
693
  return new Proxy(o, {
694
- get: (a, i) => {
695
- if (hn.includes(i) || i in a || typeof i == "string" && i.startsWith("__v_"))
696
- return Reflect.get(a, i);
697
- let r;
698
- s ? r = this.subgraph?.nodes.find(
699
- (_) => Qe.isGraphInputNode(_) && _.graphInterfaceId === t.id
700
- )?.outputs.placeholder.id : r = this.subgraph?.nodes.find(
701
- (_) => Ze.isGraphOutputNode(_) && _.graphInterfaceId === t.id
694
+ get: (r, i) => {
695
+ if (In.includes(i) || i in r || typeof i == "string" && i.startsWith("__v_"))
696
+ return Reflect.get(r, i);
697
+ let a;
698
+ s ? a = this.subgraph?.nodes.find(
699
+ (C) => ft.isGraphInputNode(C) && C.graphInterfaceId === t.id
700
+ )?.outputs.placeholder.id : a = this.subgraph?.nodes.find(
701
+ (C) => mt.isGraphOutputNode(C) && C.graphInterfaceId === t.id
702
702
  )?.inputs.placeholder.id;
703
- const c = this.subgraph?.connections.find((g) => r === (s ? g.from : g.to)?.id), h = s ? c?.to : c?.from;
704
- if (h) return Reflect.get(h, i);
703
+ const l = this.subgraph?.connections.find((f) => a === (s ? f.from : f.to)?.id), d = s ? l?.to : l?.from;
704
+ if (d) return Reflect.get(d, i);
705
705
  }
706
706
  });
707
707
  }
708
708
  };
709
709
  }
710
- Z.escape = (n) => n;
711
- class fn {
710
+ ce.escape = (n) => n;
711
+ class ze {
712
712
  _id;
713
713
  _state;
714
714
  viewModel;
715
715
  constructor() {
716
- this._id = K(), this._state = D({
716
+ this._id = re(), this._state = te({
717
717
  lockCode: !1,
718
718
  modules: {},
719
719
  script: "",
@@ -777,13 +777,23 @@ class fn {
777
777
  * Render code script.
778
778
  */
779
779
  renderCode(e) {
780
- this.state.script = Z.render(this.state.template || "", e);
780
+ this.state.script = ce.render(this.state.template || "", e);
781
781
  }
782
782
  }
783
- const Oo = (n) => {
783
+ class vr extends ze {
784
+ constructor() {
785
+ super(), this.loadTemplate(import("./python-CKuCd7tg.js"));
786
+ }
787
+ }
788
+ class gr extends ze {
789
+ constructor() {
790
+ super(), this.loadTemplate(import("./javascript-DK1c6Ap1.js"));
791
+ }
792
+ }
793
+ const br = (n) => {
784
794
  n.allowMultipleConnections = !0;
785
795
  };
786
- class vn extends Tt {
796
+ class En extends Bt {
787
797
  order = /* @__PURE__ */ new Map();
788
798
  constructor(e) {
789
799
  super(e);
@@ -792,34 +802,32 @@ class vn extends Tt {
792
802
  super.start(), this.recalculateOrder = !0, this.calculateWithoutData();
793
803
  }
794
804
  async runGraph(e, t, s) {
795
- this.order.has(e.id) || this.order.set(e.id, Et(e));
796
- const { calculationOrder: o, connectionsFromNode: a } = this.order.get(e.id), i = /* @__PURE__ */ new Map();
797
- for (const r of o) {
798
- const c = {};
799
- Object.entries(r.inputs).forEach(([g, _]) => {
800
- c[g] = this.getInterfaceValue(t, _.id);
801
- }), r.isCodeNode && (r.updateCodeTemplate(), r.updateOutputNames()), this.events.beforeNodeCalculation.emit({ inputValues: c, node: r });
802
- let h;
803
- if (r.calculate) {
804
- if (h = await r.calculate(c, { globalValues: s, engine: this }), a.has(r))
805
- for (const [g, _] of Object.entries(h))
806
- this.hooks.transferData.execute(h[g], _), a.get(r).forEach((m) => {
807
- t.set(m.to.id, _);
808
- });
805
+ this.order.has(e.id) || this.order.set(e.id, Ht(e));
806
+ const { calculationOrder: o, connectionsFromNode: r } = this.order.get(e.id), i = /* @__PURE__ */ new Map();
807
+ for (const a of o) {
808
+ const l = {};
809
+ Object.entries(a.inputs).forEach(([f, C]) => {
810
+ l[f] = this.getInterfaceValue(t, C.id);
811
+ }), a.isCodeNode && (a.updateCodeTemplate(), a.updateOutputNames()), this.events.beforeNodeCalculation.emit({ inputValues: l, node: a });
812
+ let d;
813
+ if (a.calculate) {
814
+ if (d = await a.calculate(l, { globalValues: s, engine: this }), r.has(a))
815
+ for (const [f, C] of Object.entries(d))
816
+ this.hooks.transferData.execute(d[f], C), r.get(a).forEach((h) => t.set(h.to.id, C));
809
817
  } else {
810
- h = {};
811
- for (const [g, _] of Object.entries(r.outputs))
812
- h[g] = this.getInterfaceValue(t, _.id);
818
+ d = {};
819
+ for (const [f, C] of Object.entries(a.outputs))
820
+ d[f] = this.getInterfaceValue(t, C.id);
813
821
  }
814
- this.events.afterNodeCalculation.emit({ outputValues: h, node: r }), i.set(r.id, new Map(Object.entries(h))), a.has(r) && a.get(r).forEach((g) => {
815
- const _ = Object.entries(r.outputs).find(([, k]) => k.id === g.from.id)?.[0];
816
- if (!_)
822
+ this.events.afterNodeCalculation.emit({ outputValues: d, node: a }), i.set(a.id, new Map(Object.entries(d))), r.has(a) && r.get(a).forEach((f) => {
823
+ const C = Object.entries(a.outputs).find(([, N]) => N.id === f.from.id)?.[0];
824
+ if (!C)
817
825
  throw new Error(
818
- `Could not find key for interface ${g.from.id}
826
+ `Could not find key for interface ${f.from.id}
819
827
  This is likely an internal issue. Please report it on GitHub.`
820
828
  );
821
- const m = this.hooks.transferData.execute(h[_], g);
822
- g.to.allowMultipleConnections ? t.has(g.to.id) ? t.get(g.to.id).push(m) : t.set(g.to.id, [m]) : t.set(g.to.id, m);
829
+ const h = this.hooks.transferData.execute(d[C], f);
830
+ f.to.allowMultipleConnections ? t.has(f.to.id) ? t.get(f.to.id).push(h) : t.set(f.to.id, [h]) : t.set(f.to.id, h);
823
831
  });
824
832
  }
825
833
  return i;
@@ -851,7 +859,29 @@ This is likely an internal issue. Please report it on GitHub.`
851
859
  return e.get(t);
852
860
  }
853
861
  }
854
- const gn = {}, bn = {
862
+ const Tn = {}, On = {
863
+ xmlns: "http://www.w3.org/2000/svg",
864
+ width: "24",
865
+ height: "24",
866
+ viewBox: "0 0 24 24",
867
+ fill: "none",
868
+ stroke: "currentColor",
869
+ "stroke-width": "2",
870
+ "stroke-linecap": "round",
871
+ "stroke-linejoin": "round",
872
+ class: "baklava-icon icon icon-tabler icons-tabler-outline icon-tabler-check"
873
+ };
874
+ function $n(n, e) {
875
+ return p(), b("svg", On, [...e[0] || (e[0] = [
876
+ m("path", {
877
+ stroke: "none",
878
+ d: "M0 0h24v24H0z",
879
+ fill: "none"
880
+ }, null, -1),
881
+ m("path", { d: "M5 12l5 5l10 -10" }, null, -1)
882
+ ])]);
883
+ }
884
+ const Mn = /* @__PURE__ */ A(Tn, [["render", $n]]), Sn = {}, Pn = {
855
885
  xmlns: "http://www.w3.org/2000/svg",
856
886
  width: "24",
857
887
  height: "24",
@@ -863,17 +893,40 @@ const gn = {}, bn = {
863
893
  "stroke-linejoin": "round",
864
894
  class: "baklava-icon icon icon-tabler icons-tabler-outline icon-tabler-code-variable"
865
895
  };
866
- function _n(n, e) {
867
- return d(), p("svg", bn, [...e[0] || (e[0] = [
868
- u("path", {
896
+ function Gn(n, e) {
897
+ return p(), b("svg", Pn, [...e[0] || (e[0] = [
898
+ m("path", {
899
+ stroke: "none",
900
+ d: "M0 0h24v24H0z",
901
+ fill: "none"
902
+ }, null, -1),
903
+ m("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)
904
+ ])]);
905
+ }
906
+ const An = /* @__PURE__ */ A(Sn, [["render", Gn]]), Rn = {}, jn = {
907
+ xmlns: "http://www.w3.org/2000/svg",
908
+ width: "24",
909
+ height: "24",
910
+ viewBox: "0 0 24 24",
911
+ fill: "none",
912
+ stroke: "currentColor",
913
+ "stroke-width": "2",
914
+ "stroke-linecap": "round",
915
+ "stroke-linejoin": "round",
916
+ class: "baklava-icon icon icon-tabler icons-tabler-outline icon-tabler-copy"
917
+ };
918
+ function Ln(n, e) {
919
+ return p(), b("svg", jn, [...e[0] || (e[0] = [
920
+ m("path", {
869
921
  stroke: "none",
870
922
  d: "M0 0h24v24H0z",
871
923
  fill: "none"
872
924
  }, null, -1),
873
- u("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)
925
+ m("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),
926
+ m("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)
874
927
  ])]);
875
928
  }
876
- const yn = /* @__PURE__ */ P(gn, [["render", _n]]), Cn = {}, In = {
929
+ const Vn = /* @__PURE__ */ A(Rn, [["render", Ln]]), Bn = {}, Hn = {
877
930
  xmlns: "http://www.w3.org/2000/svg",
878
931
  width: "24",
879
932
  height: "24",
@@ -885,19 +938,19 @@ const yn = /* @__PURE__ */ P(gn, [["render", _n]]), Cn = {}, In = {
885
938
  "stroke-linejoin": "round",
886
939
  class: "baklava-icon icon icon-tabler icons-tabler-outline icon-tabler-dots-vertical"
887
940
  };
888
- function wn(n, e) {
889
- return d(), p("svg", In, [...e[0] || (e[0] = [
890
- u("path", {
941
+ function zn(n, e) {
942
+ return p(), b("svg", Hn, [...e[0] || (e[0] = [
943
+ m("path", {
891
944
  stroke: "none",
892
945
  d: "M0 0h24v24H0z",
893
946
  fill: "none"
894
947
  }, null, -1),
895
- u("path", { d: "M12 12m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0" }, null, -1),
896
- u("path", { d: "M12 19m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0" }, null, -1),
897
- u("path", { d: "M12 5m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0" }, null, -1)
948
+ m("path", { d: "M12 12m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0" }, null, -1),
949
+ m("path", { d: "M12 19m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0" }, null, -1),
950
+ m("path", { d: "M12 5m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0" }, null, -1)
898
951
  ])]);
899
952
  }
900
- const kn = /* @__PURE__ */ P(Cn, [["render", wn]]), Nn = {}, xn = {
953
+ const Un = /* @__PURE__ */ A(Bn, [["render", zn]]), Dn = {}, Fn = {
901
954
  xmlns: "http://www.w3.org/2000/svg",
902
955
  width: "24",
903
956
  height: "24",
@@ -905,17 +958,17 @@ const kn = /* @__PURE__ */ P(Cn, [["render", wn]]), Nn = {}, xn = {
905
958
  fill: "currentColor",
906
959
  class: "baklava-icon icon icon-tabler icons-tabler-filled icon-tabler-layout-sidebar-left-collapse"
907
960
  };
908
- function On(n, e) {
909
- return d(), p("svg", xn, [...e[0] || (e[0] = [
910
- u("path", {
961
+ function Wn(n, e) {
962
+ return p(), b("svg", Fn, [...e[0] || (e[0] = [
963
+ m("path", {
911
964
  stroke: "none",
912
965
  d: "M0 0h24v24H0z",
913
966
  fill: "none"
914
967
  }, null, -1),
915
- u("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)
968
+ m("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)
916
969
  ])]);
917
970
  }
918
- const Tn = /* @__PURE__ */ P(Nn, [["render", On]]), En = {}, $n = {
971
+ const Yn = /* @__PURE__ */ A(Dn, [["render", Wn]]), Xn = {}, Kn = {
919
972
  xmlns: "http://www.w3.org/2000/svg",
920
973
  width: "24",
921
974
  height: "24",
@@ -923,17 +976,17 @@ const Tn = /* @__PURE__ */ P(Nn, [["render", On]]), En = {}, $n = {
923
976
  fill: "currentColor",
924
977
  class: "baklava-icon icon icon-tabler icons-tabler-filled icon-tabler-layout-sidebar-left-expand"
925
978
  };
926
- function Mn(n, e) {
927
- return d(), p("svg", $n, [...e[0] || (e[0] = [
928
- u("path", {
979
+ function qn(n, e) {
980
+ return p(), b("svg", Kn, [...e[0] || (e[0] = [
981
+ m("path", {
929
982
  stroke: "none",
930
983
  d: "M0 0h24v24H0z",
931
984
  fill: "none"
932
985
  }, null, -1),
933
- u("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)
986
+ m("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)
934
987
  ])]);
935
988
  }
936
- const Gn = /* @__PURE__ */ P(En, [["render", Mn]]), Sn = {}, Pn = {
989
+ const Jn = /* @__PURE__ */ A(Xn, [["render", qn]]), Qn = {}, Zn = {
937
990
  xmlns: "http://www.w3.org/2000/svg",
938
991
  width: "24",
939
992
  height: "24",
@@ -941,17 +994,17 @@ const Gn = /* @__PURE__ */ P(En, [["render", Mn]]), Sn = {}, Pn = {
941
994
  fill: "currentColor",
942
995
  class: "baklava-icon icon icon-tabler icons-tabler-filled icon-tabler-layout-sidebar-right"
943
996
  };
944
- function Vn(n, e) {
945
- return d(), p("svg", Pn, [...e[0] || (e[0] = [
946
- u("path", {
997
+ function eo(n, e) {
998
+ return p(), b("svg", Zn, [...e[0] || (e[0] = [
999
+ m("path", {
947
1000
  stroke: "none",
948
1001
  d: "M0 0h24v24H0z",
949
1002
  fill: "none"
950
1003
  }, null, -1),
951
- u("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)
1004
+ m("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)
952
1005
  ])]);
953
1006
  }
954
- const Rn = /* @__PURE__ */ P(Sn, [["render", Vn]]), jn = {}, Bn = {
1007
+ const to = /* @__PURE__ */ A(Qn, [["render", eo]]), no = {}, oo = {
955
1008
  xmlns: "http://www.w3.org/2000/svg",
956
1009
  width: "24",
957
1010
  height: "24",
@@ -959,17 +1012,17 @@ const Rn = /* @__PURE__ */ P(Sn, [["render", Vn]]), jn = {}, Bn = {
959
1012
  fill: "currentColor",
960
1013
  class: "baklava-icon icon icon-tabler icons-tabler-filled icon-tabler-layout-sidebar-right-collapse"
961
1014
  };
962
- function zn(n, e) {
963
- return d(), p("svg", Bn, [...e[0] || (e[0] = [
964
- u("path", {
1015
+ function so(n, e) {
1016
+ return p(), b("svg", oo, [...e[0] || (e[0] = [
1017
+ m("path", {
965
1018
  stroke: "none",
966
1019
  d: "M0 0h24v24H0z",
967
1020
  fill: "none"
968
1021
  }, null, -1),
969
- u("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)
1022
+ m("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)
970
1023
  ])]);
971
1024
  }
972
- const Hn = /* @__PURE__ */ P(jn, [["render", zn]]), Ln = {}, Un = {
1025
+ const ro = /* @__PURE__ */ A(no, [["render", so]]), ao = {}, io = {
973
1026
  xmlns: "http://www.w3.org/2000/svg",
974
1027
  width: "24",
975
1028
  height: "24",
@@ -977,17 +1030,17 @@ const Hn = /* @__PURE__ */ P(jn, [["render", zn]]), Ln = {}, Un = {
977
1030
  fill: "currentColor",
978
1031
  class: "baklava-icon icon icon-tabler icons-tabler-filled icon-tabler-layout-sidebar-right-expand"
979
1032
  };
980
- function An(n, e) {
981
- return d(), p("svg", Un, [...e[0] || (e[0] = [
982
- u("path", {
1033
+ function lo(n, e) {
1034
+ return p(), b("svg", io, [...e[0] || (e[0] = [
1035
+ m("path", {
983
1036
  stroke: "none",
984
1037
  d: "M0 0h24v24H0z",
985
1038
  fill: "none"
986
1039
  }, null, -1),
987
- u("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)
1040
+ m("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)
988
1041
  ])]);
989
1042
  }
990
- const Dn = /* @__PURE__ */ P(Ln, [["render", An]]), Fn = {}, Wn = {
1043
+ const uo = /* @__PURE__ */ A(ao, [["render", lo]]), co = {}, po = {
991
1044
  xmlns: "http://www.w3.org/2000/svg",
992
1045
  width: "24",
993
1046
  height: "24",
@@ -999,12 +1052,12 @@ const Dn = /* @__PURE__ */ P(Ln, [["render", An]]), Fn = {}, Wn = {
999
1052
  "stroke-linejoin": "round",
1000
1053
  class: "baklava-icon icon icon-tabler icons-tabler-outline icon-tabler-lock-code"
1001
1054
  };
1002
- function Yn(n, e) {
1003
- return d(), p("svg", Wn, [...e[0] || (e[0] = [
1004
- se('<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)
1055
+ function ho(n, e) {
1056
+ return p(), b("svg", po, [...e[0] || (e[0] = [
1057
+ fe('<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)
1005
1058
  ])]);
1006
1059
  }
1007
- const Kn = /* @__PURE__ */ P(Fn, [["render", Yn]]), Xn = {}, qn = {
1060
+ const vt = /* @__PURE__ */ A(co, [["render", ho]]), fo = {}, mo = {
1008
1061
  xmlns: "http://www.w3.org/2000/svg",
1009
1062
  width: "24",
1010
1063
  height: "24",
@@ -1016,17 +1069,40 @@ const Kn = /* @__PURE__ */ P(Fn, [["render", Yn]]), Xn = {}, qn = {
1016
1069
  "stroke-linejoin": "round",
1017
1070
  class: "baklava-icon icon icon-tabler icons-tabler-outline icon-tabler-player-play"
1018
1071
  };
1019
- function Jn(n, e) {
1020
- return d(), p("svg", qn, [...e[0] || (e[0] = [
1021
- u("path", {
1072
+ function vo(n, e) {
1073
+ return p(), b("svg", mo, [...e[0] || (e[0] = [
1074
+ m("path", {
1075
+ stroke: "none",
1076
+ d: "M0 0h24v24H0z",
1077
+ fill: "none"
1078
+ }, null, -1),
1079
+ m("path", { d: "M7 4v16l13 -8z" }, null, -1)
1080
+ ])]);
1081
+ }
1082
+ const go = /* @__PURE__ */ A(fo, [["render", vo]]), bo = {}, yo = {
1083
+ xmlns: "http://www.w3.org/2000/svg",
1084
+ width: "24",
1085
+ height: "24",
1086
+ viewBox: "0 0 24 24",
1087
+ fill: "none",
1088
+ stroke: "currentColor",
1089
+ "stroke-width": "2",
1090
+ "stroke-linecap": "round",
1091
+ "stroke-linejoin": "round",
1092
+ class: "baklava-icon icon icon-tabler icons-tabler-outline icon-tabler-plus"
1093
+ };
1094
+ function _o(n, e) {
1095
+ return p(), b("svg", yo, [...e[0] || (e[0] = [
1096
+ m("path", {
1022
1097
  stroke: "none",
1023
1098
  d: "M0 0h24v24H0z",
1024
1099
  fill: "none"
1025
1100
  }, null, -1),
1026
- u("path", { d: "M7 4v16l13 -8z" }, null, -1)
1101
+ m("path", { d: "M12 5l0 14" }, null, -1),
1102
+ m("path", { d: "M5 12l14 0" }, null, -1)
1027
1103
  ])]);
1028
1104
  }
1029
- const Qn = /* @__PURE__ */ P(Xn, [["render", Jn]]), Zn = {}, es = {
1105
+ const Co = /* @__PURE__ */ A(bo, [["render", _o]]), wo = {}, ko = {
1030
1106
  xmlns: "http://www.w3.org/2000/svg",
1031
1107
  width: "24",
1032
1108
  height: "24",
@@ -1038,12 +1114,12 @@ const Qn = /* @__PURE__ */ P(Xn, [["render", Jn]]), Zn = {}, es = {
1038
1114
  "stroke-linejoin": "round",
1039
1115
  class: "baklava-icon icon icon-tabler icons-tabler-outline icon-tabler-schema"
1040
1116
  };
1041
- function ts(n, e) {
1042
- return d(), p("svg", es, [...e[0] || (e[0] = [
1043
- se('<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)
1117
+ function xo(n, e) {
1118
+ return p(), b("svg", ko, [...e[0] || (e[0] = [
1119
+ fe('<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)
1044
1120
  ])]);
1045
1121
  }
1046
- const ns = /* @__PURE__ */ P(Zn, [["render", ts]]), ss = {}, os = {
1122
+ const Io = /* @__PURE__ */ A(wo, [["render", xo]]), No = {}, Eo = {
1047
1123
  xmlns: "http://www.w3.org/2000/svg",
1048
1124
  width: "24",
1049
1125
  height: "24",
@@ -1055,12 +1131,12 @@ const ns = /* @__PURE__ */ P(Zn, [["render", ts]]), ss = {}, os = {
1055
1131
  "stroke-linejoin": "round",
1056
1132
  class: "baklava-icon icon icon-tabler icons-tabler-outline icon-tabler-schema-off"
1057
1133
  };
1058
- function as(n, e) {
1059
- return d(), p("svg", os, [...e[0] || (e[0] = [
1060
- se('<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)
1134
+ function To(n, e) {
1135
+ return p(), b("svg", Eo, [...e[0] || (e[0] = [
1136
+ fe('<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)
1061
1137
  ])]);
1062
1138
  }
1063
- const is = /* @__PURE__ */ P(ss, [["render", as]]), rs = {}, ds = {
1139
+ const Oo = /* @__PURE__ */ A(No, [["render", To]]), $o = {}, Mo = {
1064
1140
  xmlns: "http://www.w3.org/2000/svg",
1065
1141
  width: "24",
1066
1142
  height: "24",
@@ -1072,12 +1148,12 @@ const is = /* @__PURE__ */ P(ss, [["render", as]]), rs = {}, ds = {
1072
1148
  "stroke-linejoin": "round",
1073
1149
  class: "baklava-icon icon icon-tabler icons-tabler-outline icon-tabler-transition-bottom"
1074
1150
  };
1075
- function ls(n, e) {
1076
- return d(), p("svg", ds, [...e[0] || (e[0] = [
1077
- se('<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)
1151
+ function So(n, e) {
1152
+ return p(), b("svg", Mo, [...e[0] || (e[0] = [
1153
+ fe('<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)
1078
1154
  ])]);
1079
1155
  }
1080
- const us = /* @__PURE__ */ P(rs, [["render", ls]]), cs = {}, ps = {
1156
+ const Po = /* @__PURE__ */ A($o, [["render", So]]), Go = {}, Ao = {
1081
1157
  xmlns: "http://www.w3.org/2000/svg",
1082
1158
  width: "24",
1083
1159
  height: "24",
@@ -1089,60 +1165,83 @@ const us = /* @__PURE__ */ P(rs, [["render", ls]]), cs = {}, ps = {
1089
1165
  "stroke-linejoin": "round",
1090
1166
  class: "baklava-icon icon icon-tabler icons-tabler-outline icon-tabler-trash-off"
1091
1167
  };
1092
- function hs(n, e) {
1093
- return d(), p("svg", ps, [...e[0] || (e[0] = [
1094
- se('<path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M3 3l18 18"></path><path d="M4 7h3m4 0h9"></path><path d="M10 11l0 6"></path><path d="M14 14l0 3"></path><path d="M5 7l1 12a2 2 0 0 0 2 2h8a2 2 0 0 0 2 -2l.077 -.923"></path><path d="M18.384 14.373l.616 -7.373"></path><path d="M9 5v-1a1 1 0 0 1 1 -1h4a1 1 0 0 1 1 1v3"></path>', 8)
1168
+ function Ro(n, e) {
1169
+ return p(), b("svg", Ao, [...e[0] || (e[0] = [
1170
+ fe('<path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M3 3l18 18"></path><path d="M4 7h3m4 0h9"></path><path d="M10 11l0 6"></path><path d="M14 14l0 3"></path><path d="M5 7l1 12a2 2 0 0 0 2 2h8a2 2 0 0 0 2 -2l.077 -.923"></path><path d="M18.384 14.373l.616 -7.373"></path><path d="M9 5v-1a1 1 0 0 1 1 -1h4a1 1 0 0 1 1 1v3"></path>', 8)
1171
+ ])]);
1172
+ }
1173
+ const jo = /* @__PURE__ */ A(Go, [["render", Ro]]), Lo = {}, Vo = {
1174
+ xmlns: "http://www.w3.org/2000/svg",
1175
+ width: "24",
1176
+ height: "24",
1177
+ viewBox: "0 0 24 24",
1178
+ fill: "none",
1179
+ stroke: "currentColor",
1180
+ "stroke-width": "2",
1181
+ "stroke-linecap": "round",
1182
+ "stroke-linejoin": "round",
1183
+ class: "baklava-icon icon icon-tabler icons-tabler-outline icon-tabler-x"
1184
+ };
1185
+ function Bo(n, e) {
1186
+ return p(), b("svg", Vo, [...e[0] || (e[0] = [
1187
+ m("path", {
1188
+ stroke: "none",
1189
+ d: "M0 0h24v24H0z",
1190
+ fill: "none"
1191
+ }, null, -1),
1192
+ m("path", { d: "M18 6l-12 12" }, null, -1),
1193
+ m("path", { d: "M6 6l12 12" }, null, -1)
1095
1194
  ])]);
1096
1195
  }
1097
- const ms = /* @__PURE__ */ P(cs, [["render", hs]]), et = "CLEAR_ALL", tt = "RUN_ENGINE", nt = "TOGGLE_MINIMAP", st = "TOGGLE_PALETTE", fs = (n, e, t) => {
1196
+ const Ho = /* @__PURE__ */ A(Lo, [["render", Bo]]), gt = "CLEAR_ALL", bt = "RUN_ENGINE", yt = "TOGGLE_MINIMAP", _t = "TOGGLE_PALETTE", zo = (n, e, t) => {
1098
1197
  const s = t.zoomToFit.paddingLeft;
1099
- e.registerCommand(st, {
1198
+ e.registerCommand(_t, {
1100
1199
  execute: () => {
1101
1200
  t.palette.enabled = !t.palette.enabled, t.zoomToFit.paddingLeft = t.palette.enabled ? s : 50;
1102
1201
  },
1103
1202
  canExecute: () => !0
1104
- }), e.registerCommand(et, {
1203
+ }), e.registerCommand(gt, {
1105
1204
  execute: () => n.value.clear(),
1106
1205
  canExecute: () => n.value.nodes.length > 0
1107
- }), e.registerCommand(nt, {
1206
+ }), e.registerCommand(yt, {
1108
1207
  execute: () => t.enableMinimap = !t.enableMinimap,
1109
1208
  canExecute: () => n.value.nodes.length > 1
1110
1209
  });
1111
- }, vs = (n) => {
1210
+ }, Uo = (n) => {
1112
1211
  const e = {
1113
- command: tt,
1212
+ command: bt,
1114
1213
  title: "Run",
1115
1214
  // Tooltip text
1116
- icon: O(() => Qn)
1215
+ icon: P(() => go)
1117
1216
  }, t = {
1118
- command: st,
1217
+ command: _t,
1119
1218
  title: "Toggle palette",
1120
1219
  // Tooltip text
1121
- icon: O(() => n.palette.enabled ? Tn : Gn)
1220
+ icon: P(() => n.palette.enabled ? Yn : Jn)
1122
1221
  }, s = {
1123
- command: et,
1222
+ command: gt,
1124
1223
  title: "Clear all",
1125
1224
  // Tooltip text
1126
- icon: O(() => ms)
1225
+ icon: P(() => jo)
1127
1226
  }, o = {
1128
- command: nt,
1227
+ command: yt,
1129
1228
  title: "Toggle minimap",
1130
1229
  // Tooltip text
1131
- icon: O(() => n.enableMinimap ? is : ns)
1230
+ icon: P(() => n.enableMinimap ? Oo : Io)
1132
1231
  };
1133
- n.toolbar.commands = [t, e, ...jt, s, o];
1134
- }, gs = (n, e) => {
1135
- e.registerCommand(tt, {
1232
+ n.toolbar.commands = [t, e, ...Kt, s, o];
1233
+ }, Do = (n, e) => {
1234
+ e.registerCommand(bt, {
1136
1235
  execute: () => n.runOnce(null),
1137
1236
  canExecute: () => !0
1138
1237
  });
1139
1238
  };
1140
- function bs(n) {
1239
+ function Fo(n) {
1141
1240
  const e = Symbol("CodeEngineToken");
1142
- n.engine = new vn(n.editor), gs(n.engine, n.commandHandler), n.loadEditor = (t) => {
1143
- n.engine?.pause(), n.displayedGraph.clear(), n.editor.load(t), n.commandHandler.executeCommand(q.CLEAR_CLIPBOARD_COMMAND), n.commandHandler.executeCommand(q.CLEAR_HISTORY_COMMAND), n.engine?.resume(), n.engine?.runOnce(null);
1241
+ n.engine = new En(n.editor), Do(n.engine, n.commandHandler), n.loadEditor = (t) => {
1242
+ n.engine?.pause(), n.displayedGraph.clear(), n.editor.load(t), n.commandHandler.executeCommand(ue.CLEAR_CLIPBOARD_COMMAND), n.commandHandler.executeCommand(ue.CLEAR_HISTORY_COMMAND), n.engine?.resume(), n.engine?.runOnce(null);
1144
1243
  }, n.newGraph = () => {
1145
- n.engine?.pause(), n.displayedGraph.clear(), n.commandHandler.executeCommand(q.CLEAR_CLIPBOARD_COMMAND), n.commandHandler.executeCommand(q.CLEAR_HISTORY_COMMAND), n.displayedGraph.id = K(), n.engine?.resume(), n.engine?.runOnce(null);
1244
+ n.engine?.pause(), n.displayedGraph.clear(), n.commandHandler.executeCommand(ue.CLEAR_CLIPBOARD_COMMAND), n.commandHandler.executeCommand(ue.CLEAR_HISTORY_COMMAND), n.displayedGraph.id = re(), n.engine?.resume(), n.engine?.runOnce(null);
1146
1245
  }, n.subscribe = () => {
1147
1246
  n.displayedGraph.events.addConnection.subscribe(e, (t) => {
1148
1247
  const s = n.displayedGraph.findNodeById(t.to.nodeId);
@@ -1157,19 +1256,19 @@ function bs(n) {
1157
1256
  }), n.engine?.events.beforeRun.subscribe(e, () => {
1158
1257
  n.engine?.pause(), n.displayedGraph.sortNodes(), n.engine?.resume();
1159
1258
  }), n.engine?.events.afterRun.subscribe(e, (t) => {
1160
- n.engine?.pause(), Ae(t, n.editor), n.code.state.lockCode || n.code.renderCode({
1259
+ n.engine?.pause(), rt(t, n.editor), n.code.state.lockCode || n.code.renderCode({
1161
1260
  nodes: n.editor.graph.scriptedCodeNodes,
1162
- modules: n.editor.graph.modules
1261
+ modules: n.editor.code.modules
1163
1262
  }), n.engine?.resume();
1164
1263
  });
1165
1264
  }, n.unsubscribe = () => {
1166
1265
  n.displayedGraph.events.addConnection.unsubscribe(e), n.displayedGraph.events.removeConnection.unsubscribe(e), n.engine?.events.beforeRun.unsubscribe(e), n.engine?.events.afterRun.unsubscribe(e);
1167
1266
  };
1168
1267
  }
1169
- class ue extends Ct {
1268
+ class Ie extends Pt {
1170
1269
  code = null;
1171
1270
  editor;
1172
- _state = D({
1271
+ _state = te({
1173
1272
  codeTemplate: "{{ #nodes }}{{ script }}{{ /nodes }}",
1174
1273
  lockCode: !1
1175
1274
  });
@@ -1177,7 +1276,7 @@ class ue extends Ct {
1177
1276
  super(e, t), this.editor = e, this.template = t, e.code && (this.code = e.code);
1178
1277
  }
1179
1278
  get codeNodes() {
1180
- return ot(this);
1279
+ return Ct(this);
1181
1280
  }
1182
1281
  get connections() {
1183
1282
  return super.connections;
@@ -1278,7 +1377,7 @@ class ue extends Ct {
1278
1377
  * Render code script.
1279
1378
  */
1280
1379
  renderCode(e) {
1281
- return Z.render(this.state?.codeTemplate || "", e);
1380
+ return ce.render(this.state?.codeTemplate || "", e);
1282
1381
  }
1283
1382
  /**
1284
1383
  * Sort code nodes.
@@ -1288,40 +1387,40 @@ class ue extends Ct {
1288
1387
  try {
1289
1388
  let e = this.nodeIds;
1290
1389
  const t = this.connections.filter(
1291
- (a) => e.includes(a.to.nodeId) && e.includes(a.from.nodeId)
1292
- ).map((a) => [a.to.nodeId, a.from.nodeId]);
1293
- e.reverse(), e = Qt.array(e, t), e.reverse();
1294
- const s = this.nodes.map((a) => a.id).filter((a) => !e.includes(a));
1390
+ (r) => e.includes(r.to.nodeId) && e.includes(r.from.nodeId)
1391
+ ).map((r) => [r.to.nodeId, r.from.nodeId]);
1392
+ e.reverse(), e = cn.array(e, t), e.reverse();
1393
+ const s = this.nodes.map((r) => r.id).filter((r) => !e.includes(r));
1295
1394
  e = [...e, ...s];
1296
- const o = e.map((a) => this.findNodeById(a));
1395
+ const o = e.map((r) => this.findNodeById(r));
1297
1396
  o && (this.nodes = o);
1298
1397
  } catch {
1299
1398
  console.warn("Failed to sort nodes.");
1300
1399
  }
1301
1400
  }
1302
1401
  }
1303
- const ot = (n) => {
1402
+ const Ct = (n) => {
1304
1403
  const e = [];
1305
1404
  return n.nodes.length === 0 || n.nodes.forEach((t) => {
1306
- t && (t.hasOwnProperty("subgraph") ? e.push(...ot(t.subgraph)) : t.hasOwnProperty("isCodeNode") && e.push(t));
1405
+ t && (t.hasOwnProperty("subgraph") ? e.push(...Ct(t.subgraph)) : t.hasOwnProperty("isCodeNode") && e.push(t));
1307
1406
  }), e;
1308
- }, To = (n = 0, e = 100) => ({
1407
+ }, yr = (n = 0, e = 100) => ({
1309
1408
  x: n * 420,
1310
1409
  y: e
1311
- }), Eo = (n) => {
1410
+ }), _r = (n) => {
1312
1411
  const e = { ...n.position };
1313
1412
  return e.x -= 440, e.y += 50, e;
1314
1413
  };
1315
- function _s(n, e) {
1414
+ function Wo(n, e) {
1316
1415
  return Object.fromEntries(Object.entries(n).filter(e));
1317
1416
  }
1318
- function ys(n, e) {
1417
+ function Yo(n, e) {
1319
1418
  return Object.fromEntries(Object.entries(n).map(([t, s]) => [t, e(s)]));
1320
1419
  }
1321
- class ce extends It {
1420
+ class Ne extends Gt {
1322
1421
  /** Create a new GraphTemplate from the nodes and connections inside the graph instance */
1323
1422
  static fromGraph(e, t) {
1324
- return new ce(e.save(), t);
1423
+ return new Ne(e.save(), t);
1325
1424
  }
1326
1425
  constructor(e, t) {
1327
1426
  super(e, t);
@@ -1334,52 +1433,52 @@ class ce extends It {
1334
1433
  * or load the state into the provided graph instance.
1335
1434
  */
1336
1435
  createGraph(e) {
1337
- const t = /* @__PURE__ */ new Map(), s = (m) => {
1338
- const k = K();
1339
- return t.set(m, k), k;
1340
- }, o = (m) => {
1341
- const k = t.get(m);
1342
- if (!k) throw new Error(`Unable to create graph from template: Could not map old id ${m} to new id`);
1343
- return k;
1344
- }, a = (m) => ys(m, (k) => ({
1345
- id: s(k.id),
1346
- templateId: k.id,
1347
- value: k.value
1348
- })), i = this.nodes.map((m) => ({
1349
- ...m,
1350
- id: s(m.id),
1351
- inputs: a(m.inputs),
1352
- outputs: a(m.outputs)
1353
- })), r = this.connections.map((m) => ({
1354
- id: s(m.id),
1355
- from: o(m.from),
1356
- to: o(m.to)
1357
- })), c = this.inputs.map((m) => ({
1358
- id: m.id,
1359
- name: m.name,
1360
- nodeId: o(m.nodeId),
1361
- nodeInterfaceId: o(m.nodeInterfaceId)
1362
- })), h = this.outputs.map((m) => ({
1363
- id: m.id,
1364
- name: m.name,
1365
- nodeId: o(m.nodeId),
1366
- nodeInterfaceId: o(m.nodeInterfaceId)
1367
- })), g = {
1368
- id: K(),
1436
+ const t = /* @__PURE__ */ new Map(), s = (h) => {
1437
+ const N = re();
1438
+ return t.set(h, N), N;
1439
+ }, o = (h) => {
1440
+ const N = t.get(h);
1441
+ if (!N) throw new Error(`Unable to create graph from template: Could not map old id ${h} to new id`);
1442
+ return N;
1443
+ }, r = (h) => Yo(h, (N) => ({
1444
+ id: s(N.id),
1445
+ templateId: N.id,
1446
+ value: N.value
1447
+ })), i = this.nodes.map((h) => ({
1448
+ ...h,
1449
+ id: s(h.id),
1450
+ inputs: r(h.inputs),
1451
+ outputs: r(h.outputs)
1452
+ })), a = this.connections.map((h) => ({
1453
+ id: s(h.id),
1454
+ from: o(h.from),
1455
+ to: o(h.to)
1456
+ })), l = this.inputs.map((h) => ({
1457
+ id: h.id,
1458
+ name: h.name,
1459
+ nodeId: o(h.nodeId),
1460
+ nodeInterfaceId: o(h.nodeInterfaceId)
1461
+ })), d = this.outputs.map((h) => ({
1462
+ id: h.id,
1463
+ name: h.name,
1464
+ nodeId: o(h.nodeId),
1465
+ nodeInterfaceId: o(h.nodeInterfaceId)
1466
+ })), f = {
1467
+ id: re(),
1369
1468
  nodes: i,
1370
- connections: r,
1371
- inputs: c,
1372
- outputs: h
1469
+ connections: a,
1470
+ inputs: l,
1471
+ outputs: d
1373
1472
  };
1374
- return e || (e = new ue(this.editor)), e.load(g).forEach((m) => console.warn(m)), e.template = this, e;
1473
+ return e || (e = new Ie(this.editor)), e.load(f).forEach((h) => console.warn(h)), e.template = this, e;
1375
1474
  }
1376
1475
  }
1377
- const Cs = (n) => !(n instanceof ue);
1378
- function Is(n, e) {
1476
+ const Xo = (n) => !(n instanceof Ie);
1477
+ function Ko(n, e) {
1379
1478
  return { switchGraph: (s) => {
1380
1479
  let o;
1381
- if (Cs(s))
1382
- o = new ue(n.value), s.createGraph(o);
1480
+ if (Xo(s))
1481
+ o = new Ie(n.value), s.createGraph(o);
1383
1482
  else {
1384
1483
  if (s !== n.value.graph)
1385
1484
  throw new Error(
@@ -1390,32 +1489,601 @@ function Is(n, e) {
1390
1489
  e.value && e.value !== n.value.graph && e.value.destroy(), o.panning = o.panning ?? s.panning ?? { x: 0, y: 0 }, o.scaling = o.scaling ?? s.scaling ?? 1, o.selectedNodes = o.selectedNodes ?? [], o.sidebar = o.sidebar ?? { visible: !1, nodeId: "", optionName: "" }, e.value = o, o.code?.engine?.runOnce(null);
1391
1490
  } };
1392
1491
  }
1393
- const $o = /* @__PURE__ */ F({
1492
+ function qo(n) {
1493
+ return n && n.__esModule && Object.prototype.hasOwnProperty.call(n, "default") ? n.default : n;
1494
+ }
1495
+ var we = { exports: {} };
1496
+ var Jo = we.exports, Xe;
1497
+ function Qo() {
1498
+ return Xe || (Xe = 1, (function(n, e) {
1499
+ (function(s, o) {
1500
+ n.exports = o();
1501
+ })(Jo, function() {
1502
+ return (
1503
+ /******/
1504
+ (function() {
1505
+ var t = {
1506
+ /***/
1507
+ 686: (
1508
+ /***/
1509
+ (function(r, i, a) {
1510
+ a.d(i, {
1511
+ default: function() {
1512
+ return (
1513
+ /* binding */
1514
+ $
1515
+ );
1516
+ }
1517
+ });
1518
+ var l = a(279), d = /* @__PURE__ */ a.n(l), f = a(370), C = /* @__PURE__ */ a.n(f), h = a(817), N = /* @__PURE__ */ a.n(h);
1519
+ function v(g) {
1520
+ try {
1521
+ return document.execCommand(g);
1522
+ } catch {
1523
+ return !1;
1524
+ }
1525
+ }
1526
+ var w = function(c) {
1527
+ var _ = N()(c);
1528
+ return v("cut"), _;
1529
+ }, u = w;
1530
+ function y(g) {
1531
+ var c = document.documentElement.getAttribute("dir") === "rtl", _ = document.createElement("textarea");
1532
+ _.style.fontSize = "12pt", _.style.border = "0", _.style.padding = "0", _.style.margin = "0", _.style.position = "absolute", _.style[c ? "right" : "left"] = "-9999px";
1533
+ var x = window.pageYOffset || document.documentElement.scrollTop;
1534
+ return _.style.top = "".concat(x, "px"), _.setAttribute("readonly", ""), _.value = g, _;
1535
+ }
1536
+ var M = function(c, _) {
1537
+ var x = y(c);
1538
+ _.container.appendChild(x);
1539
+ var I = N()(x);
1540
+ return v("copy"), x.remove(), I;
1541
+ }, T = function(c) {
1542
+ var _ = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {
1543
+ container: document.body
1544
+ }, x = "";
1545
+ return typeof c == "string" ? x = M(c, _) : c instanceof HTMLInputElement && !["text", "search", "url", "tel", "password"].includes(c?.type) ? x = M(c.value, _) : (x = N()(c), v("copy")), x;
1546
+ }, S = T;
1547
+ function Q(g) {
1548
+ "@babel/helpers - typeof";
1549
+ return typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? Q = function(_) {
1550
+ return typeof _;
1551
+ } : Q = function(_) {
1552
+ return _ && typeof Symbol == "function" && _.constructor === Symbol && _ !== Symbol.prototype ? "symbol" : typeof _;
1553
+ }, Q(g);
1554
+ }
1555
+ var Z = function() {
1556
+ var c = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}, _ = c.action, x = _ === void 0 ? "copy" : _, I = c.container, E = c.target, Y = c.text;
1557
+ if (x !== "copy" && x !== "cut")
1558
+ throw new Error('Invalid "action" value, use either "copy" or "cut"');
1559
+ if (E !== void 0)
1560
+ if (E && Q(E) === "object" && E.nodeType === 1) {
1561
+ if (x === "copy" && E.hasAttribute("disabled"))
1562
+ throw new Error('Invalid "target" attribute. Please use "readonly" instead of "disabled" attribute');
1563
+ if (x === "cut" && (E.hasAttribute("readonly") || E.hasAttribute("disabled")))
1564
+ throw new Error(`Invalid "target" attribute. You can't cut text from elements with "readonly" or "disabled" attributes`);
1565
+ } else
1566
+ throw new Error('Invalid "target" value, use a valid Element');
1567
+ if (Y)
1568
+ return S(Y, {
1569
+ container: I
1570
+ });
1571
+ if (E)
1572
+ return x === "cut" ? u(E) : S(E, {
1573
+ container: I
1574
+ });
1575
+ }, pe = Z;
1576
+ function K(g) {
1577
+ "@babel/helpers - typeof";
1578
+ return typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? K = function(_) {
1579
+ return typeof _;
1580
+ } : K = function(_) {
1581
+ return _ && typeof Symbol == "function" && _.constructor === Symbol && _ !== Symbol.prototype ? "symbol" : typeof _;
1582
+ }, K(g);
1583
+ }
1584
+ function k(g, c) {
1585
+ if (!(g instanceof c))
1586
+ throw new TypeError("Cannot call a class as a function");
1587
+ }
1588
+ function R(g, c) {
1589
+ for (var _ = 0; _ < c.length; _++) {
1590
+ var x = c[_];
1591
+ x.enumerable = x.enumerable || !1, x.configurable = !0, "value" in x && (x.writable = !0), Object.defineProperty(g, x.key, x);
1592
+ }
1593
+ }
1594
+ function z(g, c, _) {
1595
+ return c && R(g.prototype, c), _ && R(g, _), g;
1596
+ }
1597
+ function ge(g, c) {
1598
+ if (typeof c != "function" && c !== null)
1599
+ throw new TypeError("Super expression must either be null or a function");
1600
+ g.prototype = Object.create(c && c.prototype, { constructor: { value: g, writable: !0, configurable: !0 } }), c && he(g, c);
1601
+ }
1602
+ function he(g, c) {
1603
+ return he = Object.setPrototypeOf || function(x, I) {
1604
+ return x.__proto__ = I, x;
1605
+ }, he(g, c);
1606
+ }
1607
+ function Ee(g) {
1608
+ var c = Te();
1609
+ return function() {
1610
+ var x = oe(g), I;
1611
+ if (c) {
1612
+ var E = oe(this).constructor;
1613
+ I = Reflect.construct(x, arguments, E);
1614
+ } else
1615
+ I = x.apply(this, arguments);
1616
+ return be(this, I);
1617
+ };
1618
+ }
1619
+ function be(g, c) {
1620
+ return c && (K(c) === "object" || typeof c == "function") ? c : ye(g);
1621
+ }
1622
+ function ye(g) {
1623
+ if (g === void 0)
1624
+ throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
1625
+ return g;
1626
+ }
1627
+ function Te() {
1628
+ if (typeof Reflect > "u" || !Reflect.construct || Reflect.construct.sham) return !1;
1629
+ if (typeof Proxy == "function") return !0;
1630
+ try {
1631
+ return Date.prototype.toString.call(Reflect.construct(Date, [], function() {
1632
+ })), !0;
1633
+ } catch {
1634
+ return !1;
1635
+ }
1636
+ }
1637
+ function oe(g) {
1638
+ return oe = Object.setPrototypeOf ? Object.getPrototypeOf : function(_) {
1639
+ return _.__proto__ || Object.getPrototypeOf(_);
1640
+ }, oe(g);
1641
+ }
1642
+ function ie(g, c) {
1643
+ var _ = "data-clipboard-".concat(g);
1644
+ if (c.hasAttribute(_))
1645
+ return c.getAttribute(_);
1646
+ }
1647
+ var _e = /* @__PURE__ */ (function(g) {
1648
+ ge(_, g);
1649
+ var c = Ee(_);
1650
+ function _(x, I) {
1651
+ var E;
1652
+ return k(this, _), E = c.call(this), E.resolveOptions(I), E.listenClick(x), E;
1653
+ }
1654
+ return z(_, [{
1655
+ key: "resolveOptions",
1656
+ value: function() {
1657
+ var I = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
1658
+ this.action = typeof I.action == "function" ? I.action : this.defaultAction, this.target = typeof I.target == "function" ? I.target : this.defaultTarget, this.text = typeof I.text == "function" ? I.text : this.defaultText, this.container = K(I.container) === "object" ? I.container : document.body;
1659
+ }
1660
+ /**
1661
+ * Adds a click event listener to the passed trigger.
1662
+ * @param {String|HTMLElement|HTMLCollection|NodeList} trigger
1663
+ */
1664
+ }, {
1665
+ key: "listenClick",
1666
+ value: function(I) {
1667
+ var E = this;
1668
+ this.listener = C()(I, "click", function(Y) {
1669
+ return E.onClick(Y);
1670
+ });
1671
+ }
1672
+ /**
1673
+ * Defines a new `ClipboardAction` on each click event.
1674
+ * @param {Event} e
1675
+ */
1676
+ }, {
1677
+ key: "onClick",
1678
+ value: function(I) {
1679
+ var E = I.delegateTarget || I.currentTarget, Y = this.action(E) || "copy", Ce = pe({
1680
+ action: Y,
1681
+ container: this.container,
1682
+ target: this.target(E),
1683
+ text: this.text(E)
1684
+ });
1685
+ this.emit(Ce ? "success" : "error", {
1686
+ action: Y,
1687
+ text: Ce,
1688
+ trigger: E,
1689
+ clearSelection: function() {
1690
+ E && E.focus(), window.getSelection().removeAllRanges();
1691
+ }
1692
+ });
1693
+ }
1694
+ /**
1695
+ * Default `action` lookup function.
1696
+ * @param {Element} trigger
1697
+ */
1698
+ }, {
1699
+ key: "defaultAction",
1700
+ value: function(I) {
1701
+ return ie("action", I);
1702
+ }
1703
+ /**
1704
+ * Default `target` lookup function.
1705
+ * @param {Element} trigger
1706
+ */
1707
+ }, {
1708
+ key: "defaultTarget",
1709
+ value: function(I) {
1710
+ var E = ie("target", I);
1711
+ if (E)
1712
+ return document.querySelector(E);
1713
+ }
1714
+ /**
1715
+ * Allow fire programmatically a copy action
1716
+ * @param {String|HTMLElement} target
1717
+ * @param {Object} options
1718
+ * @returns Text copied.
1719
+ */
1720
+ }, {
1721
+ key: "defaultText",
1722
+ /**
1723
+ * Default `text` lookup function.
1724
+ * @param {Element} trigger
1725
+ */
1726
+ value: function(I) {
1727
+ return ie("text", I);
1728
+ }
1729
+ /**
1730
+ * Destroy lifecycle.
1731
+ */
1732
+ }, {
1733
+ key: "destroy",
1734
+ value: function() {
1735
+ this.listener.destroy();
1736
+ }
1737
+ }], [{
1738
+ key: "copy",
1739
+ value: function(I) {
1740
+ var E = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {
1741
+ container: document.body
1742
+ };
1743
+ return S(I, E);
1744
+ }
1745
+ /**
1746
+ * Allow fire programmatically a cut action
1747
+ * @param {String|HTMLElement} target
1748
+ * @returns Text cutted.
1749
+ */
1750
+ }, {
1751
+ key: "cut",
1752
+ value: function(I) {
1753
+ return u(I);
1754
+ }
1755
+ /**
1756
+ * Returns the support of the given action, or all actions if no action is
1757
+ * given.
1758
+ * @param {String} [action]
1759
+ */
1760
+ }, {
1761
+ key: "isSupported",
1762
+ value: function() {
1763
+ var I = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : ["copy", "cut"], E = typeof I == "string" ? [I] : I, Y = !!document.queryCommandSupported;
1764
+ return E.forEach(function(Ce) {
1765
+ Y = Y && !!document.queryCommandSupported(Ce);
1766
+ }), Y;
1767
+ }
1768
+ }]), _;
1769
+ })(d()), $ = _e;
1770
+ })
1771
+ ),
1772
+ /***/
1773
+ 828: (
1774
+ /***/
1775
+ (function(r) {
1776
+ var i = 9;
1777
+ if (typeof Element < "u" && !Element.prototype.matches) {
1778
+ var a = Element.prototype;
1779
+ a.matches = a.matchesSelector || a.mozMatchesSelector || a.msMatchesSelector || a.oMatchesSelector || a.webkitMatchesSelector;
1780
+ }
1781
+ function l(d, f) {
1782
+ for (; d && d.nodeType !== i; ) {
1783
+ if (typeof d.matches == "function" && d.matches(f))
1784
+ return d;
1785
+ d = d.parentNode;
1786
+ }
1787
+ }
1788
+ r.exports = l;
1789
+ })
1790
+ ),
1791
+ /***/
1792
+ 438: (
1793
+ /***/
1794
+ (function(r, i, a) {
1795
+ var l = a(828);
1796
+ function d(h, N, v, w, u) {
1797
+ var y = C.apply(this, arguments);
1798
+ return h.addEventListener(v, y, u), {
1799
+ destroy: function() {
1800
+ h.removeEventListener(v, y, u);
1801
+ }
1802
+ };
1803
+ }
1804
+ function f(h, N, v, w, u) {
1805
+ return typeof h.addEventListener == "function" ? d.apply(null, arguments) : typeof v == "function" ? d.bind(null, document).apply(null, arguments) : (typeof h == "string" && (h = document.querySelectorAll(h)), Array.prototype.map.call(h, function(y) {
1806
+ return d(y, N, v, w, u);
1807
+ }));
1808
+ }
1809
+ function C(h, N, v, w) {
1810
+ return function(u) {
1811
+ u.delegateTarget = l(u.target, N), u.delegateTarget && w.call(h, u);
1812
+ };
1813
+ }
1814
+ r.exports = f;
1815
+ })
1816
+ ),
1817
+ /***/
1818
+ 879: (
1819
+ /***/
1820
+ (function(r, i) {
1821
+ i.node = function(a) {
1822
+ return a !== void 0 && a instanceof HTMLElement && a.nodeType === 1;
1823
+ }, i.nodeList = function(a) {
1824
+ var l = Object.prototype.toString.call(a);
1825
+ return a !== void 0 && (l === "[object NodeList]" || l === "[object HTMLCollection]") && "length" in a && (a.length === 0 || i.node(a[0]));
1826
+ }, i.string = function(a) {
1827
+ return typeof a == "string" || a instanceof String;
1828
+ }, i.fn = function(a) {
1829
+ var l = Object.prototype.toString.call(a);
1830
+ return l === "[object Function]";
1831
+ };
1832
+ })
1833
+ ),
1834
+ /***/
1835
+ 370: (
1836
+ /***/
1837
+ (function(r, i, a) {
1838
+ var l = a(879), d = a(438);
1839
+ function f(v, w, u) {
1840
+ if (!v && !w && !u)
1841
+ throw new Error("Missing required arguments");
1842
+ if (!l.string(w))
1843
+ throw new TypeError("Second argument must be a String");
1844
+ if (!l.fn(u))
1845
+ throw new TypeError("Third argument must be a Function");
1846
+ if (l.node(v))
1847
+ return C(v, w, u);
1848
+ if (l.nodeList(v))
1849
+ return h(v, w, u);
1850
+ if (l.string(v))
1851
+ return N(v, w, u);
1852
+ throw new TypeError("First argument must be a String, HTMLElement, HTMLCollection, or NodeList");
1853
+ }
1854
+ function C(v, w, u) {
1855
+ return v.addEventListener(w, u), {
1856
+ destroy: function() {
1857
+ v.removeEventListener(w, u);
1858
+ }
1859
+ };
1860
+ }
1861
+ function h(v, w, u) {
1862
+ return Array.prototype.forEach.call(v, function(y) {
1863
+ y.addEventListener(w, u);
1864
+ }), {
1865
+ destroy: function() {
1866
+ Array.prototype.forEach.call(v, function(y) {
1867
+ y.removeEventListener(w, u);
1868
+ });
1869
+ }
1870
+ };
1871
+ }
1872
+ function N(v, w, u) {
1873
+ return d(document.body, v, w, u);
1874
+ }
1875
+ r.exports = f;
1876
+ })
1877
+ ),
1878
+ /***/
1879
+ 817: (
1880
+ /***/
1881
+ (function(r) {
1882
+ function i(a) {
1883
+ var l;
1884
+ if (a.nodeName === "SELECT")
1885
+ a.focus(), l = a.value;
1886
+ else if (a.nodeName === "INPUT" || a.nodeName === "TEXTAREA") {
1887
+ var d = a.hasAttribute("readonly");
1888
+ d || a.setAttribute("readonly", ""), a.select(), a.setSelectionRange(0, a.value.length), d || a.removeAttribute("readonly"), l = a.value;
1889
+ } else {
1890
+ a.hasAttribute("contenteditable") && a.focus();
1891
+ var f = window.getSelection(), C = document.createRange();
1892
+ C.selectNodeContents(a), f.removeAllRanges(), f.addRange(C), l = f.toString();
1893
+ }
1894
+ return l;
1895
+ }
1896
+ r.exports = i;
1897
+ })
1898
+ ),
1899
+ /***/
1900
+ 279: (
1901
+ /***/
1902
+ (function(r) {
1903
+ function i() {
1904
+ }
1905
+ i.prototype = {
1906
+ on: function(a, l, d) {
1907
+ var f = this.e || (this.e = {});
1908
+ return (f[a] || (f[a] = [])).push({
1909
+ fn: l,
1910
+ ctx: d
1911
+ }), this;
1912
+ },
1913
+ once: function(a, l, d) {
1914
+ var f = this;
1915
+ function C() {
1916
+ f.off(a, C), l.apply(d, arguments);
1917
+ }
1918
+ return C._ = l, this.on(a, C, d);
1919
+ },
1920
+ emit: function(a) {
1921
+ var l = [].slice.call(arguments, 1), d = ((this.e || (this.e = {}))[a] || []).slice(), f = 0, C = d.length;
1922
+ for (f; f < C; f++)
1923
+ d[f].fn.apply(d[f].ctx, l);
1924
+ return this;
1925
+ },
1926
+ off: function(a, l) {
1927
+ var d = this.e || (this.e = {}), f = d[a], C = [];
1928
+ if (f && l)
1929
+ for (var h = 0, N = f.length; h < N; h++)
1930
+ f[h].fn !== l && f[h].fn._ !== l && C.push(f[h]);
1931
+ return C.length ? d[a] = C : delete d[a], this;
1932
+ }
1933
+ }, r.exports = i, r.exports.TinyEmitter = i;
1934
+ })
1935
+ )
1936
+ /******/
1937
+ }, s = {};
1938
+ function o(r) {
1939
+ if (s[r])
1940
+ return s[r].exports;
1941
+ var i = s[r] = {
1942
+ /******/
1943
+ // no module.id needed
1944
+ /******/
1945
+ // no module.loaded needed
1946
+ /******/
1947
+ exports: {}
1948
+ /******/
1949
+ };
1950
+ return t[r](i, i.exports, o), i.exports;
1951
+ }
1952
+ return (function() {
1953
+ o.n = function(r) {
1954
+ var i = r && r.__esModule ? (
1955
+ /******/
1956
+ function() {
1957
+ return r.default;
1958
+ }
1959
+ ) : (
1960
+ /******/
1961
+ function() {
1962
+ return r;
1963
+ }
1964
+ );
1965
+ return o.d(i, { a: i }), i;
1966
+ };
1967
+ })(), (function() {
1968
+ o.d = function(r, i) {
1969
+ for (var a in i)
1970
+ o.o(i, a) && !o.o(r, a) && Object.defineProperty(r, a, { enumerable: !0, get: i[a] });
1971
+ };
1972
+ })(), (function() {
1973
+ o.o = function(r, i) {
1974
+ return Object.prototype.hasOwnProperty.call(r, i);
1975
+ };
1976
+ })(), o(686);
1977
+ })().default
1978
+ );
1979
+ });
1980
+ })(we)), we.exports;
1981
+ }
1982
+ var Zo = Qo();
1983
+ const es = /* @__PURE__ */ qo(Zo), ts = (n) => ({
1984
+ toClipboard(e, t) {
1985
+ return new Promise((s, o) => {
1986
+ const r = document.createElement("button"), i = new es(r, {
1987
+ text: () => e,
1988
+ action: () => "copy",
1989
+ container: t !== void 0 ? t : document.body
1990
+ });
1991
+ i.on("success", (a) => {
1992
+ i.destroy(), s(a);
1993
+ }), i.on("error", (a) => {
1994
+ i.destroy(), o(a);
1995
+ }), document.body.appendChild(r), r.click(), document.body.removeChild(r);
1996
+ });
1997
+ }
1998
+ }), ns = {
1999
+ key: 0,
2000
+ class: "baklava-button"
2001
+ }, os = /* @__PURE__ */ F({
2002
+ __name: "CopyToClipboard",
2003
+ props: { text: String },
2004
+ setup(n) {
2005
+ const { toClipboard: e } = ts(), s = Me(n, "text"), o = H(!1), r = async () => {
2006
+ try {
2007
+ await e(s.value), o.value = !0, setTimeout(() => o.value = !1, 1500), console.log("Copied to clipboard");
2008
+ } catch (i) {
2009
+ console.error(i);
2010
+ }
2011
+ };
2012
+ return (i, a) => (p(), b("div", null, [
2013
+ o.value ? (p(), b("button", ns, [
2014
+ G(O(Mn))
2015
+ ])) : (p(), b("button", {
2016
+ key: 1,
2017
+ onClick: r,
2018
+ class: "baklava-button"
2019
+ }, [
2020
+ G(O(Vn))
2021
+ ]))
2022
+ ]));
2023
+ }
2024
+ }), ss = { class: "code-editor" }, rs = { class: "code-buttons" }, Cr = /* @__PURE__ */ F({
2025
+ __name: "CodeEditor",
2026
+ props: /* @__PURE__ */ Ue({
2027
+ locked: { type: Boolean },
2028
+ extensions: {}
2029
+ }, {
2030
+ modelValue: { required: !0, type: String },
2031
+ modelModifiers: {}
2032
+ }),
2033
+ emits: /* @__PURE__ */ Ue(["update:locked"], ["update:modelValue"]),
2034
+ setup(n, { emit: e }) {
2035
+ const t = xt(n, "modelValue"), s = e, o = (r) => s("update:locked", r);
2036
+ return (r, i) => {
2037
+ const a = Ze("codemirror");
2038
+ return p(), b("div", ss, [
2039
+ m("div", rs, [
2040
+ n.locked ? (p(), b("button", {
2041
+ key: 0,
2042
+ class: "baklava-button",
2043
+ title: "The code is locked.",
2044
+ onClick: i[0] || (i[0] = (l) => o(!1))
2045
+ }, [
2046
+ G(O(vt))
2047
+ ])) : j("", !0),
2048
+ G(os, { text: n.modelValue }, null, 8, ["text"])
2049
+ ]),
2050
+ G(a, {
2051
+ modelValue: t.value,
2052
+ "onUpdate:modelValue": i[1] || (i[1] = (l) => t.value = l),
2053
+ extensions: n.extensions,
2054
+ class: "codemirror",
2055
+ style: { height: "100%" },
2056
+ onKeydown: i[2] || (i[2] = (l) => o(!0))
2057
+ }, null, 8, ["modelValue", "extensions"])
2058
+ ]);
2059
+ };
2060
+ }
2061
+ }), wr = /* @__PURE__ */ F({
1394
2062
  __name: "CodeGraphEditor",
1395
2063
  props: {
1396
2064
  viewModel: {}
1397
2065
  },
1398
2066
  setup(n) {
1399
- const t = Be(n, "viewModel"), s = (o) => o.events.update.emit(null);
1400
- return fe(() => {
2067
+ const t = Me(n, "viewModel"), s = (o) => o.events.update.emit(null);
2068
+ return Se(() => {
1401
2069
  t.value.subscribe && t.value.subscribe(), t.value.engine?.start();
1402
- }), ze(() => {
2070
+ }), et(() => {
1403
2071
  t.value.unsubscribe && t.value.unsubscribe(), t.value.engine?.stop();
1404
- }), He(t, (o, a) => {
1405
- a && a.unsubscribe(), o && o.subscribe();
1406
- }), (o, a) => (d(), j(w(Bt), { viewModel: t.value }, {
2072
+ }), tt(t, (o, r) => {
2073
+ r && r.unsubscribe(), o && o.subscribe();
2074
+ }), (o, r) => (p(), B(O(qt), { viewModel: t.value }, {
1407
2075
  palette: ee(() => [
1408
- L(w(Ls))
2076
+ G(O(As))
1409
2077
  ]),
1410
2078
  node: ee((i) => [
1411
- L(w(Ps), mt(i, {
1412
- onUpdate: (r) => s(i.node)
2079
+ G(O(gs), Et(i, {
2080
+ onUpdate: (a) => s(i.node)
1413
2081
  }), null, 16, ["onUpdate"])
1414
2082
  ]),
1415
2083
  sidebar: ee((i) => [
1416
- L(w(Qs), pt(ht(i)), {
1417
- codeEditor: ee(({ node: r }) => [
1418
- ne(o.$slots, "sidebarCodeEditor", { node: r })
2084
+ G(O($s), It(Nt(i)), {
2085
+ codeEditor: ee(({ node: a }) => [
2086
+ q(o.$slots, "sidebarCodeEditor", { node: a })
1419
2087
  ]),
1420
2088
  _: 3
1421
2089
  }, 16)
@@ -1423,27 +2091,27 @@ const $o = /* @__PURE__ */ F({
1423
2091
  _: 3
1424
2092
  }, 8, ["viewModel"]));
1425
2093
  }
1426
- }), ws = { class: "code-graph-info" }, Mo = /* @__PURE__ */ F({
2094
+ }), as = { class: "code-graph-info" }, kr = /* @__PURE__ */ F({
1427
2095
  __name: "CodeGraphInfo",
1428
2096
  props: {
1429
2097
  viewModel: {}
1430
2098
  },
1431
2099
  setup(n) {
1432
- return (e, t) => (d(), p("div", ws, [
1433
- u("div", null, "Editor graph: " + G(n.viewModel.editor.graph.shortId), 1),
1434
- u("div", null, "Displayed graph: " + G(n.viewModel.displayedGraph.shortId), 1),
1435
- u("div", null, "Graphs: " + G(n.viewModel.editor.graphIds), 1),
1436
- u("div", null, "Graph templates: " + G(n.viewModel.editor.graphTemplateIds), 1),
1437
- u("div", null, "Engine status: " + G(n.viewModel.engine?.status), 1)
2100
+ return (e, t) => (p(), b("div", as, [
2101
+ m("div", null, "Editor graph: " + L(n.viewModel.editor.graph.shortId), 1),
2102
+ m("div", null, "Displayed graph: " + L(n.viewModel.displayedGraph.shortId), 1),
2103
+ m("div", null, "Graphs: " + L(n.viewModel.editor.graphIds), 1),
2104
+ m("div", null, "Graph templates: " + L(n.viewModel.editor.graphTemplateIds), 1),
2105
+ m("div", null, "Engine status: " + L(n.viewModel.engine?.status), 1)
1438
2106
  ]));
1439
2107
  }
1440
- }), ks = ["id", "data-node-type"], Ns = {
2108
+ }), is = ["id", "data-node-type"], ls = {
1441
2109
  class: "__title-label",
1442
2110
  style: { "flex-grow": "1" }
1443
- }, xs = { key: 0 }, Os = {
2111
+ }, us = { key: 0 }, ds = {
1444
2112
  class: "__menu",
1445
2113
  style: { display: "flex" }
1446
- }, Ts = { class: "__outputs" }, Es = { key: 0 }, $s = ["id", "title"], Ms = { class: "__inputs" }, Gs = { key: 0 }, Ss = ["id", "title"], Ps = /* @__PURE__ */ F({
2114
+ }, cs = { class: "__outputs" }, ps = { key: 0 }, hs = ["id", "title"], fs = { class: "__inputs" }, ms = { key: 0 }, vs = ["id", "title"], gs = /* @__PURE__ */ F({
1447
2115
  __name: "CodeGraphNode",
1448
2116
  props: {
1449
2117
  node: {},
@@ -1452,366 +2120,275 @@ const $o = /* @__PURE__ */ F({
1452
2120
  },
1453
2121
  emits: ["select", "start-drag", "update"],
1454
2122
  setup(n, { emit: e }) {
1455
- const t = me.ContextMenu, s = me.NodeInterface, o = n, a = O(() => o.node), i = e, { viewModel: r } = oe(), { graph: c, switchGraph: h } = ge(), g = V(null), _ = V(!1), m = V(""), k = V(null), b = V(!1);
1456
- let I = 0, l = 0;
1457
- const f = V(!1), N = O(() => {
1458
- const C = [
2123
+ const t = $e.ContextMenu, s = $e.NodeInterface, o = n, r = P(() => o.node), i = e, { viewModel: a } = me(), { graph: l, switchGraph: d } = Ge(), f = H(null), C = H(!1), h = H(""), N = H(null), v = H(!1);
2124
+ let w = 0, u = 0;
2125
+ const y = H(!1), M = P(() => {
2126
+ const $ = [
1459
2127
  { value: "edit", label: "Edit" },
1460
2128
  { value: "rename", label: "Rename" },
1461
2129
  { value: "delete", label: "Delete" }
1462
2130
  ];
1463
- return o.node.type.startsWith(wt) && C.push({ value: "editSubgraph", label: "Edit Subgraph" }), C;
1464
- }), y = O(() => ({
2131
+ return o.node.type.startsWith(At) && $.push({ value: "editSubgraph", label: "Edit Subgraph" }), $;
2132
+ }), T = P(() => ({
1465
2133
  "--selected": o.selected,
1466
2134
  "--dragging": o.dragging,
1467
2135
  "--two-column": !!o.node.twoColumn,
1468
- "--hidden": a.value.state?.hidden
1469
- })), T = O(() => ({
1470
- "--reverse-y": o.node.reverseY ?? r.value.settings.nodes.reverseY
1471
- })), ie = O(() => ({
2136
+ "--hidden": r.value.state?.hidden
2137
+ })), S = P(() => ({
2138
+ "--reverse-y": o.node.reverseY ?? a.value.settings.nodes.reverseY
2139
+ })), Q = P(() => ({
1472
2140
  top: `${o.node.position?.y ?? 0}px`,
1473
2141
  left: `${o.node.position?.x ?? 0}px`,
1474
- "--width": `${o.node.width ?? r.value.settings.nodes.defaultWidth}px`
1475
- })), W = O(() => Object.values(o.node.inputs).filter((C) => !C.hidden)), pe = O(() => Object.values(o.node.outputs).filter((C) => !C.hidden)), re = () => {
2142
+ "--width": `${o.node.width ?? a.value.settings.nodes.defaultWidth}px`
2143
+ })), Z = P(() => Object.values(o.node.inputs).filter(($) => !$.hidden)), pe = P(() => Object.values(o.node.outputs).filter(($) => !$.hidden)), K = () => {
1476
2144
  i("select");
1477
- }, v = (C) => {
1478
- o.selected || re(), i("start-drag", C);
1479
- }, S = () => {
1480
- f.value = !0;
1481
- }, H = () => {
1482
- const C = r.value.displayedGraph.sidebar;
1483
- C.nodeId = "", C.visible = !1;
1484
- }, Ne = () => {
1485
- const C = r.value.displayedGraph.sidebar;
1486
- C.nodeId = o.node.id, C.visible = !0;
1487
- }, rt = () => {
1488
- const C = r.value.displayedGraph.sidebar;
1489
- C.nodeId = o.node.id;
1490
- }, dt = async (C) => {
1491
- switch (C) {
2145
+ }, k = ($) => {
2146
+ o.selected || K(), i("start-drag", $);
2147
+ }, R = () => {
2148
+ y.value = !0;
2149
+ }, z = () => {
2150
+ const $ = a.value.displayedGraph.sidebar;
2151
+ $.nodeId = "", $.visible = !1;
2152
+ }, ge = () => {
2153
+ const $ = a.value.displayedGraph.sidebar;
2154
+ $.nodeId = o.node.id, $.visible = !0;
2155
+ }, he = () => {
2156
+ const $ = a.value.displayedGraph.sidebar;
2157
+ $.nodeId = o.node.id;
2158
+ }, Ee = async ($) => {
2159
+ switch ($) {
1492
2160
  case "edit":
1493
- Ne();
2161
+ ge();
1494
2162
  break;
1495
2163
  case "delete":
1496
- c.value.removeNode(o.node);
2164
+ l.value.removeNode(o.node);
1497
2165
  break;
1498
2166
  case "rename":
1499
- m.value = o.node.title, _.value = !0, await vt(), k.value?.focus();
2167
+ h.value = o.node.title, C.value = !0, await Tt(), N.value?.focus();
1500
2168
  break;
1501
2169
  case "editSubgraph":
1502
- h(o.node.template);
2170
+ d(o.node.template);
1503
2171
  break;
1504
2172
  }
1505
- }, xe = () => {
1506
- a.value.title = m.value, _.value = !1;
1507
- }, Oe = () => {
1508
- g.value && r.value.hooks.renderNode.execute({ node: o.node, el: g.value });
1509
- }, lt = (C) => {
1510
- b.value = !0, I = o.node.width, l = C.clientX, C.preventDefault();
1511
- }, Te = (C) => {
1512
- a.value.state && (a.value.state.integrated = C, i("update"));
1513
- }, Ee = (C) => {
1514
- if (!b.value) return;
1515
- const E = C.clientX - l, x = I + E / c.value.scaling, ut = r.value.settings.nodes.minWidth, ct = r.value.settings.nodes.maxWidth;
1516
- a.value.width = Math.max(ut, Math.min(ct, x));
1517
- }, $e = () => {
1518
- b.value = !1;
2173
+ }, be = () => {
2174
+ r.value.title = h.value, C.value = !1;
2175
+ }, ye = () => {
2176
+ f.value && a.value.hooks.renderNode.execute({ node: o.node, el: f.value });
2177
+ }, Te = ($) => {
2178
+ v.value = !0, w = o.node.width, u = $.clientX, $.preventDefault();
2179
+ }, oe = ($) => {
2180
+ r.value.state && (r.value.state.integrated = $, i("update"));
2181
+ }, ie = ($) => {
2182
+ if (!v.value) return;
2183
+ const g = $.clientX - u, c = w + g / l.value.scaling, _ = a.value.settings.nodes.minWidth, x = a.value.settings.nodes.maxWidth;
2184
+ r.value.width = Math.max(_, Math.min(x, c));
2185
+ }, _e = () => {
2186
+ v.value = !1;
1519
2187
  };
1520
- return fe(() => {
1521
- Oe(), window.addEventListener("mousemove", Ee), window.addEventListener("mouseup", $e);
1522
- }), Le(Oe), ze(() => {
1523
- window.removeEventListener("mousemove", Ee), window.removeEventListener("mouseup", $e);
1524
- }), (C, E) => (d(), p("div", {
1525
- id: a.value.id,
2188
+ return Se(() => {
2189
+ ye(), window.addEventListener("mousemove", ie), window.addEventListener("mouseup", _e);
2190
+ }), nt(ye), et(() => {
2191
+ window.removeEventListener("mousemove", ie), window.removeEventListener("mouseup", _e);
2192
+ }), ($, g) => (p(), b("div", {
2193
+ id: r.value.id,
1526
2194
  ref_key: "el",
1527
- ref: g,
1528
- class: Y([y.value, "baklava-node"]),
1529
- "data-node-type": a.value.type,
1530
- style: ve(ie.value),
1531
- onPointerdown: re
2195
+ ref: f,
2196
+ class: ne([T.value, "baklava-node"]),
2197
+ "data-node-type": r.value.type,
2198
+ style: Pe(Q.value),
2199
+ onPointerdown: K
1532
2200
  }, [
1533
- w(r).settings.nodes.resizable ? (d(), p("div", {
2201
+ O(a).settings.nodes.resizable ? (p(), b("div", {
1534
2202
  key: 0,
1535
2203
  class: "__resize-handle",
1536
- onMousedown: lt
1537
- }, null, 32)) : M("", !0),
1538
- u("div", {
2204
+ onMousedown: Te
2205
+ }, null, 32)) : j("", !0),
2206
+ m("div", {
1539
2207
  class: "__title",
1540
- onPointerdown: te(v, ["self", "stop"]),
1541
- onContextmenu: te(S, ["prevent"])
2208
+ onPointerdown: le(k, ["self", "stop"]),
2209
+ onContextmenu: le(R, ["prevent"])
1542
2210
  }, [
1543
- a.value.inputs._code ? (d(), j(w(Ve), {
2211
+ r.value.inputs._code ? (p(), B(O(Ke), {
1544
2212
  key: 0,
1545
- node: a.value,
1546
- intf: a.value.inputs._code,
1547
- title: a.value.inputs._code.value,
2213
+ node: r.value,
2214
+ intf: r.value.inputs._code,
2215
+ title: r.value.inputs._code.value,
1548
2216
  class: "--input",
1549
2217
  "data-interface-type": "node",
1550
2218
  style: { "flex-grow": "0" }
1551
- }, null, 8, ["node", "intf", "title"])) : M("", !0),
1552
- _.value ? de((d(), p("input", {
2219
+ }, null, 8, ["node", "intf", "title"])) : j("", !0),
2220
+ C.value ? ke((p(), b("input", {
1553
2221
  key: 2,
1554
2222
  ref_key: "renameInputEl",
1555
- ref: k,
1556
- "onUpdate:modelValue": E[4] || (E[4] = (x) => m.value = x),
2223
+ ref: N,
2224
+ "onUpdate:modelValue": g[4] || (g[4] = (c) => h.value = c),
1557
2225
  class: "baklava-input",
1558
2226
  placeholder: "Node Name",
1559
2227
  style: { "flex-grow": "1" },
1560
2228
  type: "text",
1561
- onBlur: xe,
1562
- onKeydown: he(xe, ["enter"])
2229
+ onBlur: be,
2230
+ onKeydown: Oe(be, ["enter"])
1563
2231
  }, null, 544)), [
1564
- [le, m.value]
1565
- ]) : (d(), p(B, { key: 1 }, [
1566
- u("div", Ns, [
1567
- a.value.idx > -1 ? (d(), p("span", xs, G(a.value.idx + 1) + " - ", 1)) : M("", !0),
1568
- ft(G(a.value.title) + " " + G(a.value.graph.shortId) + " " + G(a.value.shortId), 1)
2232
+ [xe, h.value]
2233
+ ]) : (p(), b(U, { key: 1 }, [
2234
+ m("div", ls, [
2235
+ r.value.idx > -1 ? (p(), b("span", us, L(r.value.idx + 1) + " - ", 1)) : j("", !0),
2236
+ ot(L(r.value.title) + " " + L(r.value.graph.shortId) + " " + L(r.value.shortId), 1)
1569
2237
  ]),
1570
- u("div", Os, [
1571
- a.value.isCodeNode ? (d(), p(B, { key: 0 }, [
1572
- a.value.state.lockCode ? (d(), j(w(Kn), {
2238
+ m("div", ds, [
2239
+ r.value.isCodeNode ? (p(), b(U, { key: 0 }, [
2240
+ r.value.state.lockCode ? (p(), B(O(vt), {
1573
2241
  key: 0,
1574
2242
  class: "--clickable mx-1",
1575
- onClick: E[0] || (E[0] = (x) => a.value.lockCode = !1)
1576
- })) : M("", !0),
1577
- a.value.state.integrated ? (d(), j(w(yn), {
2243
+ onClick: g[0] || (g[0] = (c) => r.value.lockCode = !1)
2244
+ })) : j("", !0),
2245
+ r.value.state.integrated ? (p(), B(O(An), {
1578
2246
  key: 1,
1579
2247
  class: "--clickable mx-1",
1580
- onClick: E[1] || (E[1] = (x) => Te(!1))
1581
- })) : (d(), j(w(us), {
2248
+ onClick: g[1] || (g[1] = (c) => oe(!1))
2249
+ })) : (p(), B(O(Po), {
1582
2250
  key: 2,
1583
2251
  class: "--clickable mx-1",
1584
- onClick: E[2] || (E[2] = (x) => Te(!0))
2252
+ onClick: g[2] || (g[2] = (c) => oe(!0))
1585
2253
  })),
1586
- !w(r).displayedGraph.sidebar.visible && w(r).displayedGraph.sidebar.nodeId !== a.value.id ? (d(), j(w(Dn), {
2254
+ !O(a).displayedGraph.sidebar.visible && O(a).displayedGraph.sidebar.nodeId !== r.value.id ? (p(), B(O(uo), {
1587
2255
  key: 3,
1588
2256
  class: "--clickable mx-1",
1589
- onClick: Ne
1590
- })) : w(r).displayedGraph.sidebar.visible && w(r).displayedGraph.sidebar.nodeId !== a.value.id ? (d(), j(w(Rn), {
2257
+ onClick: ge
2258
+ })) : O(a).displayedGraph.sidebar.visible && O(a).displayedGraph.sidebar.nodeId !== r.value.id ? (p(), B(O(to), {
1591
2259
  key: 4,
1592
2260
  class: "--clickable mx-1",
1593
- onClick: rt
1594
- })) : (d(), j(w(Hn), {
2261
+ onClick: he
2262
+ })) : (p(), B(O(ro), {
1595
2263
  key: 5,
1596
2264
  class: "--clickable mx-1",
1597
- onClick: H
2265
+ onClick: z
1598
2266
  }))
1599
- ], 64)) : M("", !0),
1600
- L(w(kn), {
2267
+ ], 64)) : j("", !0),
2268
+ G(O(Un), {
1601
2269
  class: "--clickable mx-1",
1602
- onClick: S
2270
+ onClick: R
1603
2271
  }),
1604
- L(w(t), {
1605
- modelValue: f.value,
1606
- "onUpdate:modelValue": E[3] || (E[3] = (x) => f.value = x),
2272
+ G(O(t), {
2273
+ modelValue: y.value,
2274
+ "onUpdate:modelValue": g[3] || (g[3] = (c) => y.value = c),
1607
2275
  x: 0,
1608
2276
  y: 0,
1609
- items: N.value,
1610
- onClick: dt
2277
+ items: M.value,
2278
+ onClick: Ee
1611
2279
  }, null, 8, ["modelValue", "items"])
1612
2280
  ])
1613
2281
  ], 64)),
1614
- a.value.outputs._code ? (d(), j(w(Ve), {
2282
+ r.value.outputs._code ? (p(), B(O(Ke), {
1615
2283
  key: 3,
1616
- node: a.value,
1617
- intf: a.value.outputs._code,
2284
+ node: r.value,
2285
+ intf: r.value.outputs._code,
1618
2286
  class: "--output",
1619
- title: a.value.outputs._code.value,
2287
+ title: r.value.outputs._code.value,
1620
2288
  "data-interface-type": "node"
1621
- }, null, 8, ["node", "intf", "title"])) : M("", !0)
2289
+ }, null, 8, ["node", "intf", "title"])) : j("", !0)
1622
2290
  ], 32),
1623
- u("div", {
1624
- class: Y(["__content", T.value]),
1625
- onKeydown: E[5] || (E[5] = he(te(() => {
2291
+ m("div", {
2292
+ class: ne(["__content", S.value]),
2293
+ onKeydown: g[5] || (g[5] = Oe(le(() => {
1626
2294
  }, ["stop"]), ["delete"])),
1627
- onContextmenu: E[6] || (E[6] = te(() => {
2295
+ onContextmenu: g[6] || (g[6] = le(() => {
1628
2296
  }, ["prevent"]))
1629
2297
  }, [
1630
- u("div", Ts, [
1631
- (d(!0), p(B, null, J(pe.value, (x) => (d(), p(B, {
1632
- key: x.id
2298
+ m("div", cs, [
2299
+ (p(!0), b(U, null, se(pe.value, (c) => (p(), b(U, {
2300
+ key: c.id
1633
2301
  }, [
1634
- a.value.state?.hidden ? (d(), p("div", Es, [
1635
- x.port ? (d(), p("div", {
2302
+ r.value.state?.hidden ? (p(), b("div", ps, [
2303
+ c.port ? (p(), b("div", {
1636
2304
  key: 0,
1637
- id: x.id,
1638
- title: x.name,
2305
+ id: c.id,
2306
+ title: c.name,
1639
2307
  class: "baklava-node-interface --output --connected"
1640
- }, [...E[7] || (E[7] = [
1641
- u("div", { class: "__port" }, null, -1)
1642
- ])], 8, $s)) : M("", !0)
1643
- ])) : ne(C.$slots, "nodeInterface", {
2308
+ }, [...g[7] || (g[7] = [
2309
+ m("div", { class: "__port" }, null, -1)
2310
+ ])], 8, hs)) : j("", !0)
2311
+ ])) : q($.$slots, "nodeInterface", {
1644
2312
  key: 1,
1645
2313
  type: "output",
1646
- node: a.value,
1647
- intf: x
2314
+ node: r.value,
2315
+ intf: c
1648
2316
  }, () => [
1649
- L(w(s), {
1650
- node: a.value,
1651
- intf: x,
1652
- title: x.value
2317
+ G(O(s), {
2318
+ node: r.value,
2319
+ intf: c,
2320
+ title: c.value
1653
2321
  }, null, 8, ["node", "intf", "title"])
1654
2322
  ])
1655
2323
  ], 64))), 128))
1656
2324
  ]),
1657
- u("div", Ms, [
1658
- (d(!0), p(B, null, J(W.value, (x) => (d(), p(B, {
1659
- key: x.id
2325
+ m("div", fs, [
2326
+ (p(!0), b(U, null, se(Z.value, (c) => (p(), b(U, {
2327
+ key: c.id
1660
2328
  }, [
1661
- a.value.state?.hidden ? (d(), p("div", Gs, [
1662
- x.port ? (d(), p("div", {
2329
+ r.value.state?.hidden ? (p(), b("div", ms, [
2330
+ c.port ? (p(), b("div", {
1663
2331
  key: 0,
1664
- id: x.id,
1665
- title: x.name,
2332
+ id: c.id,
2333
+ title: c.name,
1666
2334
  class: "baklava-node-interface --input --connected"
1667
- }, [...E[8] || (E[8] = [
1668
- u("div", { class: "__port" }, null, -1)
1669
- ])], 8, Ss)) : M("", !0)
1670
- ])) : ne(C.$slots, "nodeInterface", {
2335
+ }, [...g[8] || (g[8] = [
2336
+ m("div", { class: "__port" }, null, -1)
2337
+ ])], 8, vs)) : j("", !0)
2338
+ ])) : q($.$slots, "nodeInterface", {
1671
2339
  key: 1,
1672
- node: a.value,
1673
- intf: x,
2340
+ node: r.value,
2341
+ intf: c,
1674
2342
  type: "input"
1675
2343
  }, () => [
1676
- L(w(s), {
1677
- node: a.value,
1678
- intf: x,
1679
- title: x.value
2344
+ G(O(s), {
2345
+ node: r.value,
2346
+ intf: c,
2347
+ title: c.value
1680
2348
  }, null, 8, ["node", "intf", "title"])
1681
2349
  ])
1682
2350
  ], 64))), 128))
1683
2351
  ])
1684
2352
  ], 34)
1685
- ], 46, ks));
2353
+ ], 46, is));
1686
2354
  }
1687
- }), Vs = ["id"], Rs = { class: "align-middle" }, Ve = /* @__PURE__ */ F({
2355
+ }), bs = ["id"], ys = { class: "align-middle" }, Ke = /* @__PURE__ */ F({
1688
2356
  __name: "CodeGraphNodeInterface",
1689
2357
  props: {
1690
2358
  node: {},
1691
2359
  intf: {}
1692
2360
  },
1693
2361
  setup(n) {
1694
- const e = n, { viewModel: t } = oe(), { hoveredOver: s, temporaryConnection: o } = zt(), a = V(null), i = O(() => e.intf.connectionCount > 0), r = O(() => ({
2362
+ const e = n, { viewModel: t } = me(), { hoveredOver: s, temporaryConnection: o } = Jt(), r = H(null), i = P(() => e.intf.connectionCount > 0), a = P(() => ({
1695
2363
  "--connected": i.value
1696
- })), c = () => {
2364
+ })), l = () => {
1697
2365
  s(e.intf);
1698
- }, h = () => {
2366
+ }, d = () => {
1699
2367
  s(void 0);
1700
- }, g = () => {
1701
- a.value && t.value.hooks.renderInterface.execute({ intf: e.intf, el: a.value });
2368
+ }, f = () => {
2369
+ r.value && t.value.hooks.renderInterface.execute({ intf: e.intf, el: r.value });
1702
2370
  };
1703
- return fe(g), Le(g), (_, m) => (d(), p("div", {
2371
+ return Se(f), nt(f), (C, h) => (p(), b("div", {
1704
2372
  id: n.intf.id,
1705
2373
  ref_key: "el",
1706
- ref: a,
1707
- class: Y(["baklava-node-interface", r.value])
2374
+ ref: r,
2375
+ class: ne(["baklava-node-interface", a.value])
1708
2376
  }, [
1709
- n.intf.port ? (d(), p("div", {
2377
+ n.intf.port ? (p(), b("div", {
1710
2378
  key: 0,
1711
- class: Y(["__port", { "--selected": w(o)?.from === n.intf }]),
1712
- onPointerover: c,
1713
- onPointerout: h
1714
- }, null, 34)) : M("", !0),
1715
- u("span", Rs, [
1716
- ne(_.$slots, "default")
2379
+ class: ne(["__port", { "--selected": O(o)?.from === n.intf }]),
2380
+ onPointerover: l,
2381
+ onPointerout: d
2382
+ }, null, 34)) : j("", !0),
2383
+ m("span", ys, [
2384
+ q(C.$slots, "default")
1717
2385
  ])
1718
- ], 10, Vs));
1719
- }
1720
- }), js = {
1721
- class: "baklava-node --palette",
1722
- style: { "margin-top": "-20px", "margin-bottom": "20px" }
1723
- }, Bs = {
1724
- key: 0,
1725
- style: { display: "flex", "justify-content": "space-between" }
1726
- }, zs = ["onClick"], Hs = {
1727
- key: 0,
1728
- style: { margin: "auto 0", "font-size": "12px" }
1729
- }, Ls = /* @__PURE__ */ F({
1730
- __name: "CodeNodePalette",
1731
- setup(n) {
1732
- const e = me.PaletteEntry, { viewModel: t } = oe(), { x: s, y: o } = Zt(), { transform: a } = Ht(), i = Lt(t), r = gt("editorEl"), c = V(""), h = V(null), g = () => c.value ? i.value.filter(
1733
- (b) => b.name.toLowerCase().includes(c.value.toLowerCase()) || Object.values(b.nodeTypes).some(
1734
- (I) => I.title.toLowerCase().includes(c.value.toLowerCase())
1735
- )
1736
- ) : i.value, _ = (b) => c.value ? _s(b, (I) => {
1737
- const l = I[1];
1738
- return l.category.includes(c.value.toLowerCase()) || l.title?.toLowerCase().includes(c.value.toLowerCase());
1739
- }) : b, m = O(() => {
1740
- if (!h.value || !r?.value) return {};
1741
- const { left: b, top: I } = r.value.getBoundingClientRect();
1742
- return {
1743
- top: `${o.value - I}px`,
1744
- left: `${s.value - b}px`
1745
- };
1746
- }), k = (b, I) => {
1747
- h.value = {
1748
- type: b,
1749
- nodeInformation: I
1750
- };
1751
- const l = () => {
1752
- const f = D(new I.type());
1753
- t.value.displayedGraph.addNode(f);
1754
- const N = r.value.getBoundingClientRect(), [y, T] = a(s.value - N.left, o.value - N.top);
1755
- f.position.x = y, f.position.y = T, h.value = null, document.removeEventListener("pointerup", l);
1756
- };
1757
- document.addEventListener("pointerup", l);
1758
- };
1759
- return (b, I) => (d(), p(B, null, [
1760
- u("div", {
1761
- class: Y([{ "--open": w(t).settings.palette.enabled }, "baklava-node-palette"]),
1762
- onContextmenu: I[1] || (I[1] = te(() => {
1763
- }, ["stop", "prevent"]))
1764
- }, [
1765
- u("div", js, [
1766
- de(u("input", {
1767
- "onUpdate:modelValue": I[0] || (I[0] = (l) => c.value = l),
1768
- type: "text",
1769
- class: "baklava-input",
1770
- title: "Filter nodes",
1771
- onKeyup: g
1772
- }, null, 544), [
1773
- [le, c.value]
1774
- ])
1775
- ]),
1776
- (d(!0), p(B, null, J(g(), (l) => (d(), p("section", {
1777
- key: l.name
1778
- }, [
1779
- l.name !== "default" ? (d(), p("h3", Bs, [
1780
- u("div", {
1781
- onClick: (f) => c.value = l.name,
1782
- style: { cursor: "pointer" }
1783
- }, G(l.name), 9, zs),
1784
- Object.keys(_(l.nodeTypes)).length < Object.values(l.nodeTypes).length ? (d(), p("div", Hs, " ( " + G(Object.keys(_(l.nodeTypes)).length) + " / " + G(Object.values(l.nodeTypes).length) + " ) ", 1)) : M("", !0)
1785
- ])) : M("", !0),
1786
- (d(!0), p(B, null, J(_(l.nodeTypes), (f, N) => (d(), j(w(e), {
1787
- key: N,
1788
- type: N,
1789
- title: f.title,
1790
- onPointerdown: (y) => k(N, f)
1791
- }, null, 8, ["type", "title", "onPointerdown"]))), 128))
1792
- ]))), 128))
1793
- ], 34),
1794
- L(bt, { name: "fade" }, {
1795
- default: ee(() => [
1796
- h.value ? (d(), p("div", {
1797
- key: 0,
1798
- class: "baklava-dragged-node",
1799
- style: ve(m.value)
1800
- }, [
1801
- L(w(e), {
1802
- type: h.value.type,
1803
- title: h.value.nodeInformation.title
1804
- }, null, 8, ["type", "title"])
1805
- ], 4)) : M("", !0)
1806
- ]),
1807
- _: 1
1808
- })
1809
- ], 64));
2386
+ ], 10, bs));
1810
2387
  }
1811
- }), Us = ["title"], As = {
2388
+ }), _s = ["title"], Cs = {
1812
2389
  key: 0,
1813
2390
  class: "__label"
1814
- }, Re = /* @__PURE__ */ F({
2391
+ }, qe = /* @__PURE__ */ F({
1815
2392
  __name: "SidebarCheckbox",
1816
2393
  props: {
1817
2394
  disabled: { type: Boolean },
@@ -1822,257 +2399,409 @@ const $o = /* @__PURE__ */ F({
1822
2399
  emits: ["update:modelValue"],
1823
2400
  setup(n, { emit: e }) {
1824
2401
  const t = e;
1825
- return (s, o) => (d(), p("div", {
1826
- class: Y(["baklava-checkbox", { "--checked": n.inversed ? !n.modelValue : n.modelValue, "--disabled": n.disabled }]),
2402
+ return (s, o) => (p(), b("div", {
2403
+ class: ne(["baklava-checkbox", { "--checked": n.inversed ? !n.modelValue : n.modelValue, "--disabled": n.disabled }]),
1827
2404
  title: n.name,
1828
- onClick: o[0] || (o[0] = (a) => t("update:modelValue", !n.modelValue))
2405
+ onClick: o[0] || (o[0] = (r) => t("update:modelValue", !n.modelValue))
1829
2406
  }, [
1830
- o[1] || (o[1] = u("div", { class: "__checkmark-container" }, [
1831
- u("svg", {
2407
+ o[1] || (o[1] = m("div", { class: "__checkmark-container" }, [
2408
+ m("svg", {
1832
2409
  xmlns: "http://www.w3.org/2000/svg",
1833
2410
  width: "18",
1834
2411
  height: "18",
1835
2412
  viewBox: "0 0 18 18"
1836
2413
  }, [
1837
- u("path", {
2414
+ m("path", {
1838
2415
  class: "__checkmark",
1839
2416
  d: "M 6 5 L 6 10 L 16 10",
1840
2417
  transform: "rotate(-45 10 10)"
1841
2418
  })
1842
2419
  ])
1843
2420
  ], -1)),
1844
- n.name ? (d(), p("div", As, G(n.name), 1)) : M("", !0)
1845
- ], 10, Us));
2421
+ n.name ? (p(), b("div", Cs, L(n.name), 1)) : j("", !0)
2422
+ ], 10, _s));
1846
2423
  }
1847
- }), Ds = { class: "__header" }, Fs = { class: "__node-name" }, Ws = { class: "__interfaces" }, Ys = { class: "__inputs" }, Ks = { style: { display: "flex" } }, Xs = { class: "__outputs" }, qs = {
2424
+ }), ws = { class: "__header" }, ks = { class: "__node-name" }, xs = { class: "__interfaces" }, Is = { class: "__inputs" }, Ns = { style: { display: "flex" } }, Es = { class: "__outputs" }, Ts = {
1848
2425
  key: 0,
1849
2426
  class: "__interface"
1850
- }, Js = { style: { display: "flex" } }, Qs = /* @__PURE__ */ F({
2427
+ }, Os = { style: { display: "flex" } }, $s = /* @__PURE__ */ F({
1851
2428
  __name: "CodeGraphSidebar",
1852
2429
  setup(n) {
1853
- const { viewModel: e } = oe(), { graph: t } = ge(), s = V(null), o = Be(e.value.settings.sidebar, "width"), a = O(() => e.value.settings.sidebar.resizable);
1854
- let i = 0, r = 0;
1855
- const c = O(() => {
1856
- const f = t.value.sidebar.nodeId;
1857
- return t.value.nodes.find((N) => N.id === f);
1858
- }), h = O(() => c.value), g = O(() => ({
2430
+ const { viewModel: e } = me(), { graph: t } = Ge(), s = H(null), o = Me(e.value.settings.sidebar, "width"), r = P(() => e.value.settings.sidebar.resizable);
2431
+ let i = 0, a = 0;
2432
+ const l = P(() => {
2433
+ const y = t.value.sidebar.nodeId;
2434
+ return t.value.nodes.find((M) => M.id === y);
2435
+ }), d = P(() => l.value), f = P(() => ({
1859
2436
  width: `${o.value}px`
1860
- })), _ = O(() => h.value ? Object.values(h.value.inputs).filter((f) => f.displayInSidebar && f.component) : []), m = O(() => h.value ? Object.values(h.value.outputs).filter((f) => f.displayInSidebar && f.component) : []), k = () => {
2437
+ })), C = P(() => d.value ? Object.values(d.value.inputs).filter((y) => y.displayInSidebar && y.component) : []), h = P(() => d.value ? Object.values(d.value.outputs).filter((y) => y.displayInSidebar && y.component) : []), N = () => {
1861
2438
  t.value.sidebar.visible = !1;
1862
- }, b = () => {
1863
- c.value?.events.update.emit(null);
1864
- }, I = (f) => {
1865
- i = o.value, r = f.clientX, window.addEventListener("mousemove", l), window.addEventListener(
2439
+ }, v = () => {
2440
+ l.value?.events.update.emit(null);
2441
+ }, w = (y) => {
2442
+ i = o.value, a = y.clientX, window.addEventListener("mousemove", u), window.addEventListener(
1866
2443
  "mouseup",
1867
2444
  () => {
1868
- window.removeEventListener("mousemove", l);
2445
+ window.removeEventListener("mousemove", u);
1869
2446
  },
1870
2447
  { once: !0 }
1871
2448
  );
1872
- }, l = (f) => {
1873
- const N = s.value?.parentElement?.getBoundingClientRect().width ?? 500, y = f.clientX - r;
1874
- let T = i - y;
1875
- T < 300 ? T = 300 : T > 0.9 * N && (T = 0.9 * N), o.value = T;
2449
+ }, u = (y) => {
2450
+ const M = s.value?.parentElement?.getBoundingClientRect().width ?? 500, T = y.clientX - a;
2451
+ let S = i - T;
2452
+ S < 300 ? S = 300 : S > 0.9 * M && (S = 0.9 * M), o.value = S;
1876
2453
  };
1877
- return (f, N) => (d(), p("div", {
1878
- class: Y([{ "--open": w(t).sidebar.visible }, "baklava-sidebar"]),
1879
- style: ve(g.value),
2454
+ return (y, M) => (p(), b("div", {
2455
+ class: ne([{ "--open": O(t).sidebar.visible }, "baklava-sidebar"]),
2456
+ style: Pe(f.value),
1880
2457
  ref_key: "el",
1881
2458
  ref: s
1882
2459
  }, [
1883
- a.value ? (d(), p("div", {
2460
+ r.value ? (p(), b("div", {
1884
2461
  key: 0,
1885
2462
  class: "__resizer",
1886
- onMousedown: I
1887
- }, null, 32)) : M("", !0),
1888
- c.value ? (d(), p(B, { key: 1 }, [
1889
- u("div", Ds, [
1890
- u("button", {
2463
+ onMousedown: w
2464
+ }, null, 32)) : j("", !0),
2465
+ l.value ? (p(), b(U, { key: 1 }, [
2466
+ m("div", ws, [
2467
+ m("button", {
1891
2468
  tabindex: "-1",
1892
2469
  class: "__close",
1893
- onClick: k
2470
+ onClick: N
1894
2471
  }, "×"),
1895
- u("div", Fs, [
1896
- u("b", null, G(c.value.title), 1)
2472
+ m("div", ks, [
2473
+ m("b", null, L(l.value.title), 1)
1897
2474
  ])
1898
2475
  ]),
1899
- u("div", Ws, [
1900
- u("div", Ys, [
1901
- (d(!0), p(B, null, J(_.value, (y) => (d(), p("div", {
1902
- key: y.id,
2476
+ m("div", xs, [
2477
+ m("div", Is, [
2478
+ (p(!0), b(U, null, se(C.value, (T) => (p(), b("div", {
2479
+ key: T.id,
1903
2480
  class: "__interface"
1904
2481
  }, [
1905
- u("div", Ks, [
1906
- L(Re, {
1907
- modelValue: y.hidden,
2482
+ m("div", Ns, [
2483
+ G(qe, {
2484
+ modelValue: T.hidden,
1908
2485
  "onUpdate:modelValue": [
1909
- (T) => y.hidden = T,
1910
- N[0] || (N[0] = () => c.value?.events.update.emit(null))
2486
+ (S) => T.hidden = S,
2487
+ M[0] || (M[0] = () => l.value?.events.update.emit(null))
1911
2488
  ],
1912
- disabled: !y.optional,
2489
+ disabled: !T.optional,
1913
2490
  inversed: "",
1914
2491
  style: { "padding-right": "8px" }
1915
2492
  }, null, 8, ["modelValue", "onUpdate:modelValue", "disabled"]),
1916
- (d(), j(Me(y.component), {
1917
- modelValue: y.value,
1918
- "onUpdate:modelValue": (T) => y.value = T,
1919
- node: c.value,
1920
- intf: y,
2493
+ (p(), B(De(T.component), {
2494
+ modelValue: T.value,
2495
+ "onUpdate:modelValue": (S) => T.value = S,
2496
+ node: l.value,
2497
+ intf: T,
1921
2498
  style: { width: "100%" }
1922
2499
  }, null, 8, ["modelValue", "onUpdate:modelValue", "node", "intf"]))
1923
2500
  ])
1924
2501
  ]))), 128))
1925
2502
  ]),
1926
- u("div", Xs, [
1927
- h.value && h.value.state ? (d(), p("div", qs, [
1928
- N[3] || (N[3] = u("label", null, "Variable name", -1)),
1929
- de(u("input", {
1930
- "onUpdate:modelValue": N[1] || (N[1] = (y) => h.value.state.variableName = y),
2503
+ m("div", Es, [
2504
+ d.value && d.value.state ? (p(), b("div", Ts, [
2505
+ M[3] || (M[3] = m("label", null, "Variable name", -1)),
2506
+ ke(m("input", {
2507
+ "onUpdate:modelValue": M[1] || (M[1] = (T) => d.value.state.variableName = T),
1931
2508
  type: "text",
1932
2509
  class: "baklava-input",
1933
2510
  title: "Variable name",
1934
- onBlur: b,
1935
- onKeydown: he(b, ["enter"])
2511
+ onBlur: v,
2512
+ onKeydown: Oe(v, ["enter"])
1936
2513
  }, null, 544), [
1937
- [le, h.value.state.variableName]
2514
+ [xe, d.value.state.variableName]
1938
2515
  ])
1939
- ])) : M("", !0),
1940
- (d(!0), p(B, null, J(m.value, (y) => (d(), p("div", {
1941
- key: y.id,
2516
+ ])) : j("", !0),
2517
+ (p(!0), b(U, null, se(h.value, (T) => (p(), b("div", {
2518
+ key: T.id,
1942
2519
  class: "__interface"
1943
2520
  }, [
1944
- u("div", Js, [
1945
- L(Re, {
1946
- modelValue: y.hidden,
2521
+ m("div", Os, [
2522
+ G(qe, {
2523
+ modelValue: T.hidden,
1947
2524
  "onUpdate:modelValue": [
1948
- (T) => y.hidden = T,
1949
- N[2] || (N[2] = () => c.value?.events.update.emit(null))
2525
+ (S) => T.hidden = S,
2526
+ M[2] || (M[2] = () => l.value?.events.update.emit(null))
1950
2527
  ],
1951
- disabled: !y.optional,
2528
+ disabled: !T.optional,
1952
2529
  inversed: "",
1953
2530
  style: { "padding-right": "8px" }
1954
2531
  }, null, 8, ["modelValue", "onUpdate:modelValue", "disabled"]),
1955
- (d(), j(Me(y.component), {
1956
- modelValue: y.value,
1957
- "onUpdate:modelValue": (T) => y.value = T,
1958
- node: c.value,
1959
- intf: y,
2532
+ (p(), B(De(T.component), {
2533
+ modelValue: T.value,
2534
+ "onUpdate:modelValue": (S) => T.value = S,
2535
+ node: l.value,
2536
+ intf: T,
1960
2537
  style: { width: "100%" }
1961
2538
  }, null, 8, ["modelValue", "onUpdate:modelValue", "node", "intf"]))
1962
2539
  ])
1963
2540
  ]))), 128))
1964
2541
  ])
1965
2542
  ]),
1966
- ne(f.$slots, "codeEditor", { node: c.value })
1967
- ], 64)) : M("", !0)
2543
+ q(y.$slots, "codeEditor", { node: l.value })
2544
+ ], 64)) : j("", !0)
1968
2545
  ], 6));
1969
2546
  }
2547
+ }), Ms = {
2548
+ class: "baklava-node --palette",
2549
+ style: { "margin-top": "-20px", "margin-bottom": "20px" }
2550
+ }, Ss = {
2551
+ key: 0,
2552
+ style: { display: "flex", "justify-content": "space-between" }
2553
+ }, Ps = ["onClick"], Gs = {
2554
+ key: 0,
2555
+ style: { margin: "auto 0", "font-size": "12px" }
2556
+ }, As = /* @__PURE__ */ F({
2557
+ __name: "CodeNodePalette",
2558
+ setup(n) {
2559
+ const e = $e.PaletteEntry, { viewModel: t } = me(), { x: s, y: o } = pn(), { transform: r } = Qt(), i = Zt(t), a = Ot("editorEl"), l = H(""), d = H(null), f = () => l.value ? i.value.filter(
2560
+ (v) => v.name.toLowerCase().includes(l.value.toLowerCase()) || Object.values(v.nodeTypes).some(
2561
+ (w) => w.title.toLowerCase().includes(l.value.toLowerCase())
2562
+ )
2563
+ ) : i.value, C = (v) => l.value ? Wo(v, (w) => {
2564
+ const u = w[1];
2565
+ return u.category.includes(l.value.toLowerCase()) || u.title?.toLowerCase().includes(l.value.toLowerCase());
2566
+ }) : v, h = P(() => {
2567
+ if (!d.value || !a?.value) return {};
2568
+ const { left: v, top: w } = a.value.getBoundingClientRect();
2569
+ return {
2570
+ top: `${o.value - w}px`,
2571
+ left: `${s.value - v}px`
2572
+ };
2573
+ }), N = (v, w) => {
2574
+ d.value = {
2575
+ type: v,
2576
+ nodeInformation: w
2577
+ };
2578
+ const u = () => {
2579
+ const y = te(new w.type());
2580
+ t.value.displayedGraph.addNode(y);
2581
+ const M = a.value.getBoundingClientRect(), [T, S] = r(s.value - M.left, o.value - M.top);
2582
+ y.position.x = T, y.position.y = S, d.value = null, document.removeEventListener("pointerup", u);
2583
+ };
2584
+ document.addEventListener("pointerup", u);
2585
+ };
2586
+ return (v, w) => (p(), b(U, null, [
2587
+ m("div", {
2588
+ class: ne([{ "--open": O(t).settings.palette.enabled }, "baklava-node-palette"]),
2589
+ onContextmenu: w[1] || (w[1] = le(() => {
2590
+ }, ["stop", "prevent"]))
2591
+ }, [
2592
+ m("div", Ms, [
2593
+ ke(m("input", {
2594
+ "onUpdate:modelValue": w[0] || (w[0] = (u) => l.value = u),
2595
+ type: "text",
2596
+ class: "baklava-input",
2597
+ title: "Filter nodes",
2598
+ onKeyup: f
2599
+ }, null, 544), [
2600
+ [xe, l.value]
2601
+ ])
2602
+ ]),
2603
+ (p(!0), b(U, null, se(f(), (u) => (p(), b("section", {
2604
+ key: u.name
2605
+ }, [
2606
+ u.name !== "default" ? (p(), b("h3", Ss, [
2607
+ m("div", {
2608
+ onClick: (y) => l.value = u.name,
2609
+ style: { cursor: "pointer" }
2610
+ }, L(u.name), 9, Ps),
2611
+ Object.keys(C(u.nodeTypes)).length < Object.values(u.nodeTypes).length ? (p(), b("div", Gs, " ( " + L(Object.keys(C(u.nodeTypes)).length) + " / " + L(Object.values(u.nodeTypes).length) + " ) ", 1)) : j("", !0)
2612
+ ])) : j("", !0),
2613
+ (p(!0), b(U, null, se(C(u.nodeTypes), (y, M) => (p(), B(O(e), {
2614
+ key: M,
2615
+ type: M,
2616
+ title: y.title,
2617
+ onPointerdown: (T) => N(M, y)
2618
+ }, null, 8, ["type", "title", "onPointerdown"]))), 128))
2619
+ ]))), 128))
2620
+ ], 34),
2621
+ G($t, { name: "fade" }, {
2622
+ default: ee(() => [
2623
+ d.value ? (p(), b("div", {
2624
+ key: 0,
2625
+ class: "baklava-dragged-node",
2626
+ style: Pe(h.value)
2627
+ }, [
2628
+ G(O(e), {
2629
+ type: d.value.type,
2630
+ title: d.value.nodeInformation.title
2631
+ }, null, 8, ["type", "title"])
2632
+ ], 4)) : j("", !0)
2633
+ ]),
2634
+ _: 1
2635
+ })
2636
+ ], 64));
2637
+ }
2638
+ }), Rs = {}, js = { class: "prependIcon" }, Ls = { class: "appendIcon" };
2639
+ function Vs(n, e) {
2640
+ const t = Ze("router-link");
2641
+ return p(), B(t, { class: "navItem" }, {
2642
+ default: ee(() => [
2643
+ m("span", js, [
2644
+ q(n.$slots, "prependIcon")
2645
+ ]),
2646
+ q(n.$slots, "default"),
2647
+ m("span", Ls, [
2648
+ q(n.$slots, "appendIcon")
2649
+ ])
2650
+ ]),
2651
+ _: 3
2652
+ });
2653
+ }
2654
+ const Je = /* @__PURE__ */ A(Rs, [["render", Vs]]), Bs = { class: "navbar" }, Hs = ["onClick"], xr = /* @__PURE__ */ F({
2655
+ __name: "NavBar",
2656
+ props: {
2657
+ viewModel: {},
2658
+ editorStates: {},
2659
+ routes: {}
2660
+ },
2661
+ emits: ["click:remove"],
2662
+ setup(n, { emit: e }) {
2663
+ const t = e, s = (o) => {
2664
+ t("click:remove", o);
2665
+ };
2666
+ return (o, r) => (p(), b("nav", Bs, [
2667
+ q(o.$slots, "prepend"),
2668
+ (p(!0), b(U, null, se(n.editorStates, (i) => (p(), B(Je, {
2669
+ key: i.graph.id,
2670
+ class: ne({ active: i.graph.id === n.viewModel.displayedGraph.id }),
2671
+ to: { name: n.routes?.edit ?? "edit", params: { editorId: i.graph.id } }
2672
+ }, {
2673
+ appendIcon: ee(() => [
2674
+ m("button", {
2675
+ class: "remove",
2676
+ onClick: le((a) => s(i.graph.id), ["prevent"])
2677
+ }, [
2678
+ G(O(Ho))
2679
+ ], 8, Hs)
2680
+ ]),
2681
+ default: ee(() => [
2682
+ ot(L(i.graph.id.slice(0, 6)) + " ", 1)
2683
+ ]),
2684
+ _: 2
2685
+ }, 1032, ["class", "to"]))), 128)),
2686
+ q(o.$slots, "append", {}, () => [
2687
+ G(Je, {
2688
+ to: { name: n.routes?.new ?? "new" },
2689
+ class: "navItem"
2690
+ }, {
2691
+ default: ee(() => [
2692
+ G(O(Co), { class: "plus" })
2693
+ ]),
2694
+ _: 1
2695
+ }, 8, ["to"])
2696
+ ])
2697
+ ]));
2698
+ }
1970
2699
  });
1971
- class at extends Qe {
2700
+ class wt extends ft {
1972
2701
  _title = "Subgraph Input";
1973
2702
  inputs = {
1974
- _code: new R("", "").use($, U).setHidden(!0),
1975
- name: new be("Name", "Input").setPort(!1)
2703
+ _code: new D("", "").use(V, X).setHidden(!0),
2704
+ name: new Ae("Name", "Input").setPort(!1)
1976
2705
  };
1977
2706
  outputs = {
1978
- _code: new R("", "").use($, U).setHidden(!0),
1979
- placeholder: new A("Connection", void 0)
2707
+ _code: new D("", "").use(V, X).setHidden(!0),
2708
+ placeholder: new J("Connection", void 0)
1980
2709
  };
1981
2710
  }
1982
- class it extends Ze {
2711
+ class kt extends mt {
1983
2712
  _title = "Subgraph Output";
1984
2713
  inputs = {
1985
- _code: new R("", "").use($, U).setHidden(!0),
1986
- name: new be("Name", "Output").setPort(!1),
1987
- placeholder: new A("Connection", void 0)
2714
+ _code: new D("", "").use(V, X).setHidden(!0),
2715
+ name: new Ae("Name", "Output").setPort(!1),
2716
+ placeholder: new J("Connection", void 0)
1988
2717
  };
1989
2718
  outputs = {
1990
- _code: new R("", "").use($, U).setHidden(!0),
1991
- output: new A("Output", void 0).setHidden(!0)
2719
+ _code: new D("", "").use(V, X).setHidden(!0),
2720
+ output: new J("Output", void 0).setHidden(!0)
1992
2721
  };
1993
2722
  }
1994
- const Zs = "CREATE_SUBGRAPH", je = [kt, Nt];
1995
- function eo(n, e, t) {
1996
- const s = () => n.value.selectedNodes.filter((a) => !je.includes(a.type)).length > 0, o = () => {
1997
- const { viewModel: a } = oe(), i = n.value, r = n.value.editor;
2723
+ const zs = "CREATE_SUBGRAPH", Qe = [Rt, jt];
2724
+ function Us(n, e, t) {
2725
+ const s = () => n.value.selectedNodes.filter((r) => !Qe.includes(r.type)).length > 0, o = () => {
2726
+ const { viewModel: r } = me(), i = n.value, a = n.value.editor;
1998
2727
  if (i.selectedNodes.length === 0) return;
1999
- const c = i.selectedNodes.filter((v) => !je.includes(v.type)), h = c.flatMap((v) => Object.values(v.inputs)), g = c.flatMap((v) => Object.values(v.outputs)), _ = i.connections.filter(
2000
- (v) => !g.includes(v.from) && h.includes(v.to)
2001
- ), m = i.connections.filter(
2002
- (v) => g.includes(v.from) && !h.includes(v.to)
2003
- ), k = i.connections.filter(
2004
- (v) => g.includes(v.from) && h.includes(v.to)
2005
- ), b = c.map((v) => v.save()), I = k.map((v) => ({
2006
- id: v.id,
2007
- from: v.from.id,
2008
- to: v.to.id
2009
- })), l = /* @__PURE__ */ new Map(), { xLeft: f, xRight: N, yTop: y } = to(c);
2010
- for (const [v, S] of _.entries()) {
2011
- const H = new at();
2012
- H.inputs.name.value = S.to.name, b.push({
2013
- ...H.save(),
2014
- position: { x: N - a.value.settings.nodes.defaultWidth - 100, y: y + v * 200 }
2015
- }), I.push({ id: K(), from: H.outputs.placeholder.id, to: S.to.id }), l.set(S.to.id, H.graphInterfaceId);
2728
+ const l = i.selectedNodes.filter((k) => !Qe.includes(k.type)), d = l.flatMap((k) => Object.values(k.inputs)), f = l.flatMap((k) => Object.values(k.outputs)), C = i.connections.filter(
2729
+ (k) => !f.includes(k.from) && d.includes(k.to)
2730
+ ), h = i.connections.filter(
2731
+ (k) => f.includes(k.from) && !d.includes(k.to)
2732
+ ), N = i.connections.filter(
2733
+ (k) => f.includes(k.from) && d.includes(k.to)
2734
+ ), v = l.map((k) => k.save()), w = N.map((k) => ({
2735
+ id: k.id,
2736
+ from: k.from.id,
2737
+ to: k.to.id
2738
+ })), u = /* @__PURE__ */ new Map(), { xLeft: y, xRight: M, yTop: T } = Ds(l);
2739
+ for (const [k, R] of C.entries()) {
2740
+ const z = new wt();
2741
+ z.inputs.name.value = R.to.name, v.push({
2742
+ ...z.save(),
2743
+ position: { x: M - r.value.settings.nodes.defaultWidth - 100, y: T + k * 200 }
2744
+ }), w.push({ id: re(), from: z.outputs.placeholder.id, to: R.to.id }), u.set(R.to.id, z.graphInterfaceId);
2016
2745
  }
2017
- for (const [v, S] of m.entries()) {
2018
- const H = new it();
2019
- H.inputs.name.value = S.from.name, b.push({
2020
- ...H.save(),
2021
- position: { x: f + 100, y: y + v * 200 }
2022
- }), I.push({ id: K(), from: S.from.id, to: H.inputs.placeholder.id }), l.set(S.from.id, H.graphInterfaceId);
2746
+ for (const [k, R] of h.entries()) {
2747
+ const z = new kt();
2748
+ z.inputs.name.value = R.from.name, v.push({
2749
+ ...z.save(),
2750
+ position: { x: y + 100, y: T + k * 200 }
2751
+ }), w.push({ id: re(), from: R.from.id, to: z.inputs.placeholder.id }), u.set(R.from.id, z.graphInterfaceId);
2023
2752
  }
2024
- const T = D(
2025
- new ce(
2753
+ const S = te(
2754
+ new Ne(
2026
2755
  {
2027
- connections: I,
2028
- nodes: b,
2756
+ connections: w,
2757
+ nodes: v,
2029
2758
  // ignored, but still providing to make TS happy
2030
2759
  inputs: [],
2031
2760
  outputs: []
2032
2761
  },
2033
- r
2762
+ a
2034
2763
  )
2035
2764
  );
2036
- r.addGraphTemplate(T);
2037
- const ie = r.nodeTypes.get(Ue(T));
2038
- if (!ie) throw new Error("Unable to create subgraph: Could not find corresponding graph node type");
2765
+ a.addGraphTemplate(S);
2766
+ const Q = a.nodeTypes.get(st(S));
2767
+ if (!Q) throw new Error("Unable to create subgraph: Could not find corresponding graph node type");
2039
2768
  i.activeTransactions++;
2040
- const W = D(new ie.type());
2041
- i.addNode(W);
2769
+ const Z = te(new Q.type());
2770
+ i.addNode(Z);
2042
2771
  const pe = Math.round(
2043
- c.map((v) => v.position.x).reduce((v, S) => v + S, 0) / c.length
2044
- ), re = Math.round(
2045
- c.map((v) => v.position.y).reduce((v, S) => v + S, 0) / c.length
2772
+ l.map((k) => k.position.x).reduce((k, R) => k + R, 0) / l.length
2773
+ ), K = Math.round(
2774
+ l.map((k) => k.position.y).reduce((k, R) => k + R, 0) / l.length
2046
2775
  );
2047
- W.position.x = pe, W.position.y = re, _.forEach((v) => {
2048
- i.removeConnection(v), i.addConnection(v.from, W.inputs[l.get(v.to.id)]);
2049
- }), m.forEach((v) => {
2050
- i.removeConnection(v), i.addConnection(W.outputs[l.get(v.from.id)], v.to);
2051
- }), c.forEach((v) => i.removeNode(v)), i.activeTransactions--, e.canExecuteCommand(q.SAVE_SUBGRAPH_COMMAND) && e.executeCommand(q.SAVE_SUBGRAPH_COMMAND), t(T), n.value.panning = { ...i.panning }, n.value.scaling = i.scaling;
2776
+ Z.position.x = pe, Z.position.y = K, C.forEach((k) => {
2777
+ i.removeConnection(k), i.addConnection(k.from, Z.inputs[u.get(k.to.id)]);
2778
+ }), h.forEach((k) => {
2779
+ i.removeConnection(k), i.addConnection(Z.outputs[u.get(k.from.id)], k.to);
2780
+ }), l.forEach((k) => i.removeNode(k)), i.activeTransactions--, e.canExecuteCommand(ue.SAVE_SUBGRAPH_COMMAND) && e.executeCommand(ue.SAVE_SUBGRAPH_COMMAND), t(S), n.value.panning = { ...i.panning }, n.value.scaling = i.scaling;
2052
2781
  };
2053
- e.registerCommand(Zs, {
2782
+ e.registerCommand(zs, {
2054
2783
  canExecute: s,
2055
2784
  execute: o
2056
2785
  });
2057
2786
  }
2058
- function to(n) {
2059
- const e = n.reduce((o, a) => {
2060
- const i = a.position.x;
2787
+ function Ds(n) {
2788
+ const e = n.reduce((o, r) => {
2789
+ const i = r.position.x;
2061
2790
  return i < o ? i : o;
2062
- }, 1 / 0), t = n.reduce((o, a) => {
2063
- const i = a.position.y;
2791
+ }, 1 / 0), t = n.reduce((o, r) => {
2792
+ const i = r.position.y;
2064
2793
  return i < o ? i : o;
2065
2794
  }, 1 / 0);
2066
- return { xLeft: n.reduce((o, a) => {
2067
- const i = a.position.x + a.width;
2795
+ return { xLeft: n.reduce((o, r) => {
2796
+ const i = r.position.x + r.width;
2068
2797
  return i > o ? i : o;
2069
2798
  }, -1 / 0), xRight: e, yTop: t };
2070
2799
  }
2071
- class no extends xt {
2800
+ class Fs extends Lt {
2072
2801
  code;
2073
2802
  graph;
2074
2803
  constructor(e) {
2075
- super(), this.code = e, this.graph = new ue(this);
2804
+ super(), this.code = e, this.graph = new Ie(this);
2076
2805
  }
2077
2806
  get graphIds() {
2078
2807
  const e = [];
@@ -2089,7 +2818,7 @@ class no extends xt {
2089
2818
  addGraphTemplate(e) {
2090
2819
  if (this.events.beforeAddGraphTemplate.emit(e).prevented) return;
2091
2820
  this._graphTemplates.push(e), this.graphTemplateEvents.addTarget(e.events), this.graphTemplateHooks.addTarget(e.hooks);
2092
- const t = mn(e);
2821
+ const t = Nn(e);
2093
2822
  this.registerNodeType(t, { category: "Subgraphs", title: e.name }), this.events.addGraphTemplate.emit(e);
2094
2823
  }
2095
2824
  /**
@@ -2102,7 +2831,7 @@ class no extends xt {
2102
2831
  for (super._loading = !0, e = this.hooks.load.execute(e); this.graphTemplates.length > 0; )
2103
2832
  this.removeGraphTemplate(this.graphTemplates[0]);
2104
2833
  e.graphTemplates.forEach((s) => {
2105
- const o = new ce(s, this);
2834
+ const o = new Ne(s, this);
2106
2835
  this.addGraphTemplate(o);
2107
2836
  });
2108
2837
  const t = this.graph.load(e.graph);
@@ -2120,113 +2849,123 @@ class no extends xt {
2120
2849
  this.code.state.modules[e] = t;
2121
2850
  }
2122
2851
  }
2123
- function Go(n) {
2124
- const e = V(n?.code ?? new fn()), t = V(n?.existingEditor ?? new no(e.value)), s = Symbol("ViewModelToken"), o = V(null), a = _t(o), { switchGraph: i } = Is(t, o), r = O(() => a.value && a.value !== t.value.graph), c = D(Ut());
2125
- c.nodes.defaultWidth = 400;
2126
- const h = At(), g = Dt(a, h), _ = Ft(a, t, h), m = {
2852
+ function Ir(n) {
2853
+ const e = H(n?.code ?? new ze()), t = H(n?.existingEditor ?? new Fs(e.value)), s = Symbol("ViewModelToken"), o = H(null), r = Mt(o), { switchGraph: i } = Ko(t, o), a = P(() => r.value && r.value !== t.value.graph), l = te(en());
2854
+ l.nodes.defaultWidth = 400;
2855
+ const d = tn(), f = nn(r, d), C = on(r, t, d), h = {
2127
2856
  /** Called whenever a node is rendered */
2128
- renderNode: new Ge(null),
2857
+ renderNode: new Fe(null),
2129
2858
  /** Called whenever an interface is rendered */
2130
- renderInterface: new Ge(null)
2131
- }, k = D({
2132
- clipboard: _,
2859
+ renderInterface: new Fe(null)
2860
+ }, N = te({
2861
+ clipboard: C,
2133
2862
  code: e,
2134
- commandHandler: h,
2135
- displayedGraph: a,
2863
+ commandHandler: d,
2864
+ displayedGraph: r,
2136
2865
  editor: t,
2137
- history: g,
2138
- hooks: m,
2139
- isSubgraph: r,
2140
- settings: c,
2866
+ history: f,
2867
+ hooks: h,
2868
+ isSubgraph: a,
2869
+ settings: l,
2141
2870
  switchGraph: i
2142
2871
  });
2143
- return e.value.registerViewModel(k), bs(k), Wt(a, h), eo(a, h, i), Yt(a, h), Kt(a, h, i), Xt(a, h), qt(a, h, c), fs(a, h, c), vs(c), He(
2872
+ return e.value.registerViewModel(N), Fo(N), sn(r, d), Us(r, d, i), rn(r, d), an(r, d, i), ln(r, d), un(r, d, l), zo(r, d, l), Uo(l), tt(
2144
2873
  t,
2145
- (b, I) => {
2146
- I && (I.events.registerGraph.unsubscribe(s), I.graphEvents.beforeAddNode.unsubscribe(s), b.nodeHooks.beforeLoad.unsubscribe(s), b.nodeHooks.afterSave.unsubscribe(s), b.graphTemplateHooks.beforeLoad.unsubscribe(s), b.graphTemplateHooks.afterSave.unsubscribe(s), b.graph.hooks.load.unsubscribe(s), b.graph.hooks.save.unsubscribe(s)), b && (b.nodeHooks.beforeLoad.subscribe(s, (l, f) => (f.position = l.position ?? { x: 0, y: 0 }, f.width = l.width ?? c.nodes.defaultWidth, f.twoColumn = l.twoColumn ?? !1, l)), b.nodeHooks.afterSave.subscribe(s, (l, f) => (l.position = f.position, l.width = f.width, l.twoColumn = f.twoColumn, l)), b.graphTemplateHooks.beforeLoad.subscribe(s, (l, f) => (f.panning = l.panning, f.scaling = l.scaling, l)), b.graphTemplateHooks.afterSave.subscribe(s, (l, f) => (l.panning = f.panning, l.scaling = f.scaling, l)), b.graph.hooks.load.subscribe(s, (l, f) => (f.panning = l.panning, f.scaling = l.scaling, l)), b.graph.hooks.save.subscribe(s, (l, f) => (l.panning = f.panning, l.scaling = f.scaling, l)), b.graphEvents.beforeAddNode.subscribe(
2874
+ (v, w) => {
2875
+ w && (w.events.registerGraph.unsubscribe(s), w.graphEvents.beforeAddNode.unsubscribe(s), v.nodeHooks.beforeLoad.unsubscribe(s), v.nodeHooks.afterSave.unsubscribe(s), v.graphTemplateHooks.beforeLoad.unsubscribe(s), v.graphTemplateHooks.afterSave.unsubscribe(s), v.graph.hooks.load.unsubscribe(s), v.graph.hooks.save.unsubscribe(s)), v && (v.nodeHooks.beforeLoad.subscribe(s, (u, y) => (y.position = u.position ?? { x: 0, y: 0 }, y.width = u.width ?? l.nodes.defaultWidth, y.twoColumn = u.twoColumn ?? !1, u)), v.nodeHooks.afterSave.subscribe(s, (u, y) => (u.position = y.position, u.width = y.width, u.twoColumn = y.twoColumn, u)), v.graphTemplateHooks.beforeLoad.subscribe(s, (u, y) => (y.panning = u.panning, y.scaling = u.scaling, u)), v.graphTemplateHooks.afterSave.subscribe(s, (u, y) => (u.panning = y.panning, u.scaling = y.scaling, u)), v.graph.hooks.load.subscribe(s, (u, y) => (y.panning = u.panning, y.scaling = u.scaling, u)), v.graph.hooks.save.subscribe(s, (u, y) => (u.panning = y.panning, u.scaling = y.scaling, u)), v.graphEvents.beforeAddNode.subscribe(
2147
2876
  s,
2148
- (l) => Jt(l, { defaultWidth: c.nodes.defaultWidth })
2149
- ), t.value.registerNodeType(at, { category: "Subgraphs" }), t.value.registerNodeType(it, { category: "Subgraphs" }), i(b.graph));
2877
+ (u) => dn(u, { defaultWidth: l.nodes.defaultWidth })
2878
+ ), t.value.registerNodeType(wt, { category: "Subgraphs" }), t.value.registerNodeType(kt, { category: "Subgraphs" }), i(v.graph));
2150
2879
  },
2151
2880
  { immediate: !0 }
2152
- ), k;
2881
+ ), N;
2153
2882
  }
2154
2883
  export {
2155
- We as AbstractCodeNode,
2156
- et as CLEAR_ALL_COMMAND,
2157
- Zs as CREATE_SUBGRAPH_COMMAND,
2158
- fo as CheckboxInterface,
2159
- fn as Code,
2160
- vn as CodeEngine,
2161
- ue as CodeGraph,
2162
- $o as CodeGraphEditor,
2163
- Mo as CodeGraphInfo,
2164
- Qe as CodeGraphInputNode,
2165
- Ps as CodeGraphNode,
2166
- Ve as CodeGraphNodeInterface,
2167
- Ze as CodeGraphOutputNode,
2168
- Qs as CodeGraphSidebar,
2169
- ce as CodeGraphTemplate,
2170
- _e as CodeNode,
2171
- ae as CodeNodeInputInterface,
2172
- R as CodeNodeInterface,
2173
- ye as CodeNodeInterfaceComponent,
2174
- on as CodeNodeOutputInterface,
2175
- Ls as CodeNodePalette,
2176
- yn as CodeVariable,
2177
- kn as DotsVertical,
2178
- pn as DynamicCodeNode,
2179
- Se as GRAPH_INPUT_NODE_TYPE,
2180
- Pe as GRAPH_OUTPUT_NODE_TYPE,
2181
- vo as IntegerInterface,
2182
- Tn as LayoutSidebarLeftCollapse,
2183
- Gn as LayoutSidebarLeftExpand,
2184
- Rn as LayoutSidebarRight,
2185
- Hn as LayoutSidebarRightCollapse,
2186
- Dn as LayoutSidebarRightExpand,
2187
- go as ListInputInterface,
2188
- Kn as LockCode,
2189
- bo as NumberInterface,
2190
- Qn as PlayerPlay,
2191
- tt as RUN_ENGINE_COMMAND,
2192
- ns as Schema,
2193
- is as SchemaOff,
2194
- _o as SelectInterface,
2195
- Re as SidebarCheckbox,
2196
- yo as SliderInterface,
2197
- at as SubgraphInputNode,
2198
- it as SubgraphOutputNode,
2199
- nt as TOGGLE_MINIMAP_COMMAND,
2200
- st as TOGGLE_PALETTE_COMMAND,
2201
- Co as TextInputInterface,
2202
- cn as TextInputInterfaceComponent,
2203
- Io as TextareaInputInterface,
2204
- us as TransitionBottom,
2205
- ms as TrashOff,
2206
- wo as TupleInputInterface,
2207
- mo as addDefaultInterfaceTypes,
2208
- Oo as allowMultipleConnections,
2209
- Ke as booleanType,
2210
- mn as createCodeGraphNodeType,
2211
- ko as defineCodeNode,
2212
- No as defineDynamicCodeNode,
2213
- sn as dictType,
2214
- en as formatInputs,
2215
- ot as getCodeNodes,
2216
- To as getPositionAtColumn,
2217
- Eo as getPositionBeforeNode,
2218
- Xe as listType,
2219
- Ye as loadNodeState,
2220
- U as nodeType,
2221
- Ce as numberType,
2222
- bs as registerCodeEngine,
2223
- eo as registerCreateSubgraphCommand,
2224
- fs as registerCustomCommands,
2225
- gs as registerRunEngineCommands,
2226
- tn as saveNodeState,
2227
- Ie as stringType,
2228
- qe as tupleType,
2229
- vs as updateToolbarItems,
2230
- Go as useCodeGraph,
2231
- Is as useSwitchCodeGraph
2884
+ lt as AbstractCodeNode,
2885
+ gt as CLEAR_ALL_COMMAND,
2886
+ zs as CREATE_SUBGRAPH_COMMAND,
2887
+ Mn as Check,
2888
+ sr as CheckboxInterface,
2889
+ ze as Code,
2890
+ Cr as CodeEditor,
2891
+ En as CodeEngine,
2892
+ Ie as CodeGraph,
2893
+ wr as CodeGraphEditor,
2894
+ kr as CodeGraphInfo,
2895
+ ft as CodeGraphInputNode,
2896
+ gs as CodeGraphNode,
2897
+ Ke as CodeGraphNodeInterface,
2898
+ mt as CodeGraphOutputNode,
2899
+ $s as CodeGraphSidebar,
2900
+ Ne as CodeGraphTemplate,
2901
+ Re as CodeNode,
2902
+ ve as CodeNodeInputInterface,
2903
+ D as CodeNodeInterface,
2904
+ je as CodeNodeInterfaceComponent,
2905
+ gn as CodeNodeOutputInterface,
2906
+ As as CodeNodePalette,
2907
+ An as CodeVariable,
2908
+ Vn as Copy,
2909
+ os as CopyToClipboard,
2910
+ Un as DotsVertical,
2911
+ xn as DynamicCodeNode,
2912
+ We as GRAPH_INPUT_NODE_TYPE,
2913
+ Ye as GRAPH_OUTPUT_NODE_TYPE,
2914
+ rr as IntegerInterface,
2915
+ gr as JavascriptCode,
2916
+ Yn as LayoutSidebarLeftCollapse,
2917
+ Jn as LayoutSidebarLeftExpand,
2918
+ to as LayoutSidebarRight,
2919
+ ro as LayoutSidebarRightCollapse,
2920
+ uo as LayoutSidebarRightExpand,
2921
+ ar as ListInputInterface,
2922
+ vt as LockCode,
2923
+ xr as NavBar,
2924
+ Je as NavItem,
2925
+ ir as NumberInterface,
2926
+ go as PlayerPlay,
2927
+ Co as Plus,
2928
+ vr as PythonCode,
2929
+ bt as RUN_ENGINE_COMMAND,
2930
+ Io as Schema,
2931
+ Oo as SchemaOff,
2932
+ lr as SelectInterface,
2933
+ qe as SidebarCheckbox,
2934
+ ur as SliderInterface,
2935
+ wt as SubgraphInputNode,
2936
+ kt as SubgraphOutputNode,
2937
+ yt as TOGGLE_MINIMAP_COMMAND,
2938
+ _t as TOGGLE_PALETTE_COMMAND,
2939
+ dr as TextInputInterface,
2940
+ kn as TextInputInterfaceComponent,
2941
+ cr as TextareaInputInterface,
2942
+ Po as TransitionBottom,
2943
+ jo as TrashOff,
2944
+ pr as TupleInputInterface,
2945
+ Ho as X,
2946
+ or as addDefaultInterfaceTypes,
2947
+ br as allowMultipleConnections,
2948
+ dt as booleanType,
2949
+ Nn as createCodeGraphNodeType,
2950
+ hr as defineCodeNode,
2951
+ fr as defineDynamicCodeNode,
2952
+ vn as dictType,
2953
+ hn as formatInputs,
2954
+ Ct as getCodeNodes,
2955
+ yr as getPositionAtColumn,
2956
+ _r as getPositionBeforeNode,
2957
+ ct as listType,
2958
+ ut as loadNodeState,
2959
+ X as nodeType,
2960
+ Le as numberType,
2961
+ Fo as registerCodeEngine,
2962
+ Us as registerCreateSubgraphCommand,
2963
+ zo as registerCustomCommands,
2964
+ Do as registerRunEngineCommands,
2965
+ fn as saveNodeState,
2966
+ Ve as stringType,
2967
+ pt as tupleType,
2968
+ Uo as updateToolbarItems,
2969
+ Ir as useCodeGraph,
2970
+ Ko as useSwitchCodeGraph
2232
2971
  };