@teamflojo/floimg-studio-ui 0.1.4 → 0.1.6

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.
package/dist/index.js CHANGED
@@ -1,9 +1,9 @@
1
- import { jsxs as m, jsx as e, Fragment as j } from "react/jsx-runtime";
2
- import { memo as T, useRef as ge, useCallback as C, useState as N, useEffect as $, useMemo as X } from "react";
3
- import pe, { Handle as I, Position as L, applyNodeChanges as he, applyEdgeChanges as fe, MarkerType as be, Background as xe, Controls as ke, MiniMap as we, ReactFlowProvider as ve } from "reactflow";
4
- import { create as oe } from "zustand";
5
- import { useQuery as q } from "@tanstack/react-query";
6
- function ye(r, s) {
1
+ import { jsxs as c, jsx as e, Fragment as P } from "react/jsx-runtime";
2
+ import { memo as T, useRef as xe, useCallback as C, useState as N, useEffect as M, useMemo as te } from "react";
3
+ import ke, { Handle as L, Position as W, applyNodeChanges as we, applyEdgeChanges as ve, MarkerType as ye, Background as Ne, Controls as ze, MiniMap as Ce, ReactFlowProvider as Se } from "reactflow";
4
+ import { create as se } from "zustand";
5
+ import { useQuery as _ } from "@tanstack/react-query";
6
+ function Ie(r, i) {
7
7
  let t;
8
8
  try {
9
9
  t = r();
@@ -11,238 +11,250 @@ function ye(r, s) {
11
11
  return;
12
12
  }
13
13
  return {
14
- getItem: (n) => {
15
- var i;
16
- const l = (c) => c === null ? null : JSON.parse(c, void 0), a = (i = t.getItem(n)) != null ? i : null;
17
- return a instanceof Promise ? a.then(l) : l(a);
14
+ getItem: (s) => {
15
+ var d;
16
+ const m = (n) => n === null ? null : JSON.parse(n, void 0), o = (d = t.getItem(s)) != null ? d : null;
17
+ return o instanceof Promise ? o.then(m) : m(o);
18
18
  },
19
- setItem: (n, i) => t.setItem(n, JSON.stringify(i, void 0)),
20
- removeItem: (n) => t.removeItem(n)
19
+ setItem: (s, d) => t.setItem(s, JSON.stringify(d, void 0)),
20
+ removeItem: (s) => t.removeItem(s)
21
21
  };
22
22
  }
23
- const _ = (r) => (s) => {
23
+ const H = (r) => (i) => {
24
24
  try {
25
- const t = r(s);
25
+ const t = r(i);
26
26
  return t instanceof Promise ? t : {
27
- then(o) {
28
- return _(o)(t);
27
+ then(a) {
28
+ return H(a)(t);
29
29
  },
30
- catch(o) {
30
+ catch(a) {
31
31
  return this;
32
32
  }
33
33
  };
34
34
  } catch (t) {
35
35
  return {
36
- then(o) {
36
+ then(a) {
37
37
  return this;
38
38
  },
39
- catch(o) {
40
- return _(o)(t);
39
+ catch(a) {
40
+ return H(a)(t);
41
41
  }
42
42
  };
43
43
  }
44
- }, Ne = (r, s) => (t, o, n) => {
45
- let i = {
46
- storage: ye(() => localStorage),
44
+ }, Le = (r, i) => (t, a, s) => {
45
+ let d = {
46
+ storage: Ie(() => localStorage),
47
47
  partialize: (g) => g,
48
48
  version: 0,
49
- merge: (g, w) => ({
50
- ...w,
49
+ merge: (g, v) => ({
50
+ ...v,
51
51
  ...g
52
52
  }),
53
- ...s
54
- }, l = !1;
55
- const a = /* @__PURE__ */ new Set(), c = /* @__PURE__ */ new Set();
56
- let u = i.storage;
53
+ ...i
54
+ }, m = !1;
55
+ const o = /* @__PURE__ */ new Set(), n = /* @__PURE__ */ new Set();
56
+ let u = d.storage;
57
57
  if (!u)
58
58
  return r(
59
59
  (...g) => {
60
60
  console.warn(
61
- `[zustand persist middleware] Unable to update item '${i.name}', the given storage is currently unavailable.`
61
+ `[zustand persist middleware] Unable to update item '${d.name}', the given storage is currently unavailable.`
62
62
  ), t(...g);
63
63
  },
64
- o,
65
- n
64
+ a,
65
+ s
66
66
  );
67
- const d = () => {
68
- const g = i.partialize({ ...o() });
69
- return u.setItem(i.name, {
67
+ const l = () => {
68
+ const g = d.partialize({ ...a() });
69
+ return u.setItem(d.name, {
70
70
  state: g,
71
- version: i.version
71
+ version: d.version
72
72
  });
73
- }, p = n.setState;
74
- n.setState = (g, w) => (p(g, w), d());
75
- const h = r(
76
- (...g) => (t(...g), d()),
77
- o,
78
- n
73
+ }, p = s.setState;
74
+ s.setState = (g, v) => (p(g, v), l());
75
+ const f = r(
76
+ (...g) => (t(...g), l()),
77
+ a,
78
+ s
79
79
  );
80
- n.getInitialState = () => h;
80
+ s.getInitialState = () => f;
81
81
  let b;
82
- const x = () => {
83
- var g, w;
82
+ const k = () => {
83
+ var g, v;
84
84
  if (!u) return;
85
- l = !1, a.forEach((y) => {
85
+ m = !1, o.forEach((h) => {
86
86
  var z;
87
- return y((z = o()) != null ? z : h);
87
+ return h((z = a()) != null ? z : f);
88
88
  });
89
- const k = ((w = i.onRehydrateStorage) == null ? void 0 : w.call(i, (g = o()) != null ? g : h)) || void 0;
90
- return _(u.getItem.bind(u))(i.name).then((y) => {
91
- if (y)
92
- if (typeof y.version == "number" && y.version !== i.version) {
93
- if (i.migrate) {
94
- const z = i.migrate(
95
- y.state,
96
- y.version
89
+ const w = ((v = d.onRehydrateStorage) == null ? void 0 : v.call(d, (g = a()) != null ? g : f)) || void 0;
90
+ return H(u.getItem.bind(u))(d.name).then((h) => {
91
+ if (h)
92
+ if (typeof h.version == "number" && h.version !== d.version) {
93
+ if (d.migrate) {
94
+ const z = d.migrate(
95
+ h.state,
96
+ h.version
97
97
  );
98
- return z instanceof Promise ? z.then((W) => [!0, W]) : [!0, z];
98
+ return z instanceof Promise ? z.then((S) => [!0, S]) : [!0, z];
99
99
  }
100
100
  console.error(
101
101
  "State loaded from storage couldn't be migrated since no migrate function was provided"
102
102
  );
103
103
  } else
104
- return [!1, y.state];
104
+ return [!1, h.state];
105
105
  return [!1, void 0];
106
- }).then((y) => {
106
+ }).then((h) => {
107
107
  var z;
108
- const [W, O] = y;
109
- if (b = i.merge(
110
- O,
111
- (z = o()) != null ? z : h
112
- ), t(b, !0), W)
113
- return d();
108
+ const [S, B] = h;
109
+ if (b = d.merge(
110
+ B,
111
+ (z = a()) != null ? z : f
112
+ ), t(b, !0), S)
113
+ return l();
114
114
  }).then(() => {
115
- k == null || k(b, void 0), b = o(), l = !0, c.forEach((y) => y(b));
116
- }).catch((y) => {
117
- k == null || k(void 0, y);
115
+ w == null || w(b, void 0), b = a(), m = !0, n.forEach((h) => h(b));
116
+ }).catch((h) => {
117
+ w == null || w(void 0, h);
118
118
  });
119
119
  };
120
- return n.persist = {
120
+ return s.persist = {
121
121
  setOptions: (g) => {
122
- i = {
123
- ...i,
122
+ d = {
123
+ ...d,
124
124
  ...g
125
125
  }, g.storage && (u = g.storage);
126
126
  },
127
127
  clearStorage: () => {
128
- u == null || u.removeItem(i.name);
128
+ u == null || u.removeItem(d.name);
129
129
  },
130
- getOptions: () => i,
131
- rehydrate: () => x(),
132
- hasHydrated: () => l,
133
- onHydrate: (g) => (a.add(g), () => {
134
- a.delete(g);
130
+ getOptions: () => d,
131
+ rehydrate: () => k(),
132
+ hasHydrated: () => m,
133
+ onHydrate: (g) => (o.add(g), () => {
134
+ o.delete(g);
135
135
  }),
136
- onFinishHydration: (g) => (c.add(g), () => {
137
- c.delete(g);
136
+ onFinishHydration: (g) => (n.add(g), () => {
137
+ n.delete(g);
138
138
  })
139
- }, i.skipHydration || x(), b || h;
140
- }, ne = Ne, S = "/api";
141
- async function D(r, s) {
139
+ }, d.skipHydration || k(), b || f;
140
+ }, ie = Le, I = "/api";
141
+ async function A(r, i) {
142
142
  const t = await fetch(r, {
143
- ...s,
143
+ ...i,
144
144
  headers: {
145
145
  "Content-Type": "application/json",
146
- ...s == null ? void 0 : s.headers
146
+ ...i == null ? void 0 : i.headers
147
147
  }
148
148
  });
149
149
  if (!t.ok) {
150
- const o = await t.json().catch(() => ({ error: "Unknown error" }));
151
- throw new Error(o.error || `HTTP ${t.status}`);
150
+ const a = await t.json().catch(() => ({ error: "Unknown error" }));
151
+ throw new Error(a.error || `HTTP ${t.status}`);
152
152
  }
153
153
  return t.json();
154
154
  }
155
- async function ze() {
156
- return D(`${S}/nodes/generators`);
155
+ async function We() {
156
+ return A(`${I}/nodes/generators`);
157
157
  }
158
- async function Ce() {
159
- return D(`${S}/nodes/transforms`);
158
+ async function Ae() {
159
+ return A(`${I}/nodes/transforms`);
160
160
  }
161
- async function Se(r, s, t) {
162
- return D(`${S}/execute/sync`, {
161
+ async function De(r, i, t) {
162
+ return A(`${I}/execute/sync`, {
163
163
  method: "POST",
164
- body: JSON.stringify({ nodes: r, edges: s, aiProviders: t })
164
+ body: JSON.stringify({ nodes: r, edges: i, aiProviders: t })
165
165
  });
166
166
  }
167
- async function Ie(r, s) {
168
- return D(`${S}/export/yaml`, {
167
+ async function $e(r, i) {
168
+ return A(`${I}/export/yaml`, {
169
169
  method: "POST",
170
- body: JSON.stringify({ nodes: r, edges: s })
170
+ body: JSON.stringify({ nodes: r, edges: i })
171
171
  });
172
172
  }
173
- async function Le() {
174
- return D(`${S}/images`);
173
+ async function Me() {
174
+ return A(`${I}/images`);
175
175
  }
176
- function G(r) {
177
- return `${S}/images/${r}/blob`;
176
+ function F(r) {
177
+ return `${I}/images/${r}/blob`;
178
178
  }
179
- async function We(r) {
179
+ async function je(r) {
180
180
  try {
181
- return await D(`${S}/images/${r}/workflow`);
181
+ return await A(`${I}/images/${r}/workflow`);
182
182
  } catch {
183
183
  return null;
184
184
  }
185
185
  }
186
- async function Ae(r) {
187
- const s = new FormData();
188
- s.append("file", r);
189
- const t = await fetch(`${S}/uploads`, {
186
+ async function Pe(r) {
187
+ const i = new FormData();
188
+ i.append("file", r);
189
+ const t = await fetch(`${I}/uploads`, {
190
190
  method: "POST",
191
- body: s
191
+ body: i
192
192
  });
193
193
  if (!t.ok) {
194
- const o = await t.json().catch(() => ({ error: "Upload failed" }));
195
- throw new Error(o.error || `HTTP ${t.status}`);
194
+ const a = await t.json().catch(() => ({ error: "Upload failed" }));
195
+ throw new Error(a.error || `HTTP ${t.status}`);
196
196
  }
197
197
  return t.json();
198
198
  }
199
- async function $e() {
200
- return D(`${S}/uploads`);
199
+ async function Te() {
200
+ return A(`${I}/uploads`);
201
201
  }
202
- async function De(r) {
203
- const s = await fetch(`${S}/uploads/${r}`, {
202
+ async function Ue(r) {
203
+ const i = await fetch(`${I}/uploads/${r}`, {
204
204
  method: "DELETE"
205
205
  });
206
- if (!s.ok)
207
- throw new Error(`Failed to delete upload: ${s.status}`);
206
+ if (!i.ok)
207
+ throw new Error(`Failed to delete upload: ${i.status}`);
208
208
  }
209
- function se(r) {
210
- return `${S}/uploads/${r}/blob`;
209
+ function de(r) {
210
+ return `${I}/uploads/${r}/blob`;
211
211
  }
212
- const Z = "http://localhost:11434", ee = "http://localhost:1234", A = oe()(
213
- ne(
214
- (r, s) => ({
212
+ async function Ee(r) {
213
+ return A(`${I}/import`, {
214
+ method: "POST",
215
+ body: JSON.stringify({ yaml: r })
216
+ });
217
+ }
218
+ async function Oe(r) {
219
+ return A(`${I}/import/validate`, {
220
+ method: "POST",
221
+ body: JSON.stringify({ yaml: r })
222
+ });
223
+ }
224
+ const re = "http://localhost:11434", ae = "http://localhost:1234", $ = se()(
225
+ ie(
226
+ (r, i) => ({
215
227
  ai: {
216
228
  ollama: {
217
- baseUrl: Z,
229
+ baseUrl: re,
218
230
  enabled: !1
219
231
  },
220
232
  lmstudio: {
221
- baseUrl: ee,
233
+ baseUrl: ae,
222
234
  enabled: !1
223
235
  }
224
236
  },
225
237
  showSettings: !1,
226
- setAIProvider: (t, o) => {
227
- r((n) => ({
238
+ setAIProvider: (t, a) => {
239
+ r((s) => ({
228
240
  ai: {
229
- ...n.ai,
230
- [t]: o
241
+ ...s.ai,
242
+ [t]: a
231
243
  }
232
244
  }));
233
245
  },
234
246
  clearAIProvider: (t) => {
235
- r((o) => {
236
- const n = { ...o.ai };
237
- return delete n[t], { ai: n };
247
+ r((a) => {
248
+ const s = { ...a.ai };
249
+ return delete s[t], { ai: s };
238
250
  });
239
251
  },
240
252
  openSettings: () => r({ showSettings: !0 }),
241
253
  closeSettings: () => r({ showSettings: !1 }),
242
254
  getConfiguredProviders: () => {
243
- var n, i, l, a, c, u;
244
- const { ai: t } = s(), o = {};
245
- return (n = t.openai) != null && n.enabled && t.openai.apiKey && (o.openai = { apiKey: t.openai.apiKey }), (i = t.anthropic) != null && i.enabled && t.anthropic.apiKey && (o.anthropic = { apiKey: t.anthropic.apiKey }), (l = t.gemini) != null && l.enabled && t.gemini.apiKey && (o.gemini = { apiKey: t.gemini.apiKey }), (a = t.openrouter) != null && a.enabled && t.openrouter.apiKey && (o.openrouter = { apiKey: t.openrouter.apiKey }), (c = t.ollama) != null && c.enabled && (o.ollama = { baseUrl: t.ollama.baseUrl || Z }), (u = t.lmstudio) != null && u.enabled && (o.lmstudio = { baseUrl: t.lmstudio.baseUrl || ee }), o;
255
+ var s, d, m, o, n, u;
256
+ const { ai: t } = i(), a = {};
257
+ return (s = t.openai) != null && s.enabled && t.openai.apiKey && (a.openai = { apiKey: t.openai.apiKey }), (d = t.anthropic) != null && d.enabled && t.anthropic.apiKey && (a.anthropic = { apiKey: t.anthropic.apiKey }), (m = t.gemini) != null && m.enabled && t.gemini.apiKey && (a.gemini = { apiKey: t.gemini.apiKey }), (o = t.openrouter) != null && o.enabled && t.openrouter.apiKey && (a.openrouter = { apiKey: t.openrouter.apiKey }), (n = t.ollama) != null && n.enabled && (a.ollama = { baseUrl: t.ollama.baseUrl || re }), (u = t.lmstudio) != null && u.enabled && (a.lmstudio = { baseUrl: t.lmstudio.baseUrl || ae }), a;
246
258
  }
247
259
  }),
248
260
  {
@@ -252,17 +264,17 @@ const Z = "http://localhost:11434", ee = "http://localhost:1234", A = oe()(
252
264
  }
253
265
  )
254
266
  );
255
- let Pe = 0;
256
- function te() {
257
- return `node_${++Pe}`;
267
+ let Be = 0;
268
+ function K() {
269
+ return `node_${++Be}`;
258
270
  }
259
- function re() {
260
- const r = Date.now(), s = Math.random().toString(36).substring(2, 8);
261
- return `wf_${r}_${s}`;
271
+ function oe() {
272
+ const r = Date.now(), i = Math.random().toString(36).substring(2, 8);
273
+ return `wf_${r}_${i}`;
262
274
  }
263
- const f = oe()(
264
- ne(
265
- (r, s) => ({
275
+ const x = se()(
276
+ ie(
277
+ (r, i) => ({
266
278
  nodes: [],
267
279
  edges: [],
268
280
  selectedNodeId: null,
@@ -284,25 +296,25 @@ const f = oe()(
284
296
  nodeStatus: {}
285
297
  },
286
298
  loadTemplate: (t) => {
287
- const o = /* @__PURE__ */ new Map(), n = t.workflow.nodes.map((l) => {
288
- const a = te();
289
- return o.set(l.id, a), {
290
- id: a,
291
- type: l.type,
292
- position: l.position,
293
- data: l.data
299
+ const a = /* @__PURE__ */ new Map(), s = t.workflow.nodes.map((m) => {
300
+ const o = K();
301
+ return a.set(m.id, o), {
302
+ id: o,
303
+ type: m.type,
304
+ position: m.position,
305
+ data: m.data
294
306
  };
295
- }), i = t.workflow.edges.map((l) => {
296
- const a = o.get(l.source) || l.source, c = o.get(l.target) || l.target;
307
+ }), d = t.workflow.edges.map((m) => {
308
+ const o = a.get(m.source) || m.source, n = a.get(m.target) || m.target;
297
309
  return {
298
- id: `edge_${a}_${c}`,
299
- source: a,
300
- target: c
310
+ id: `edge_${o}_${n}`,
311
+ source: o,
312
+ target: n
301
313
  };
302
314
  });
303
315
  r({
304
- nodes: n,
305
- edges: i,
316
+ nodes: s,
317
+ edges: d,
306
318
  selectedNodeId: null,
307
319
  currentTemplateId: t.id,
308
320
  previewVisible: {},
@@ -332,114 +344,128 @@ const f = oe()(
332
344
  });
333
345
  },
334
346
  togglePreview: (t) => {
335
- r((o) => ({
347
+ r((a) => ({
336
348
  previewVisible: {
337
- ...o.previewVisible,
338
- [t]: o.previewVisible[t] === !1
349
+ ...a.previewVisible,
350
+ [t]: a.previewVisible[t] === !1
339
351
  // default true, toggle
340
352
  }
341
353
  }));
342
354
  },
343
355
  setGenerators: (t) => r({ generators: t }),
344
356
  setTransforms: (t) => r({ transforms: t }),
345
- addNode: (t, o) => {
346
- const n = te();
347
- let i;
348
- t.type === "generator" ? i = {
349
- generatorName: t.name,
350
- params: R(t)
351
- } : t.type === "transform" ? i = {
352
- operation: t.name,
353
- params: R(t)
354
- } : t.type === "input" ? i = {
355
- uploadId: void 0,
356
- filename: void 0,
357
- mime: void 0
358
- } : t.type === "vision" ? i = {
359
- providerName: t.name,
360
- params: R(t)
361
- } : t.type === "text" ? i = {
362
- providerName: t.name,
363
- params: R(t)
364
- } : i = {
365
- destination: "./output/image.png",
366
- provider: "filesystem"
367
- };
368
- const l = {
369
- id: n,
357
+ addNode: (t, a) => {
358
+ var o, n, u;
359
+ const s = K();
360
+ let d;
361
+ if (t.type === "generator")
362
+ d = {
363
+ generatorName: t.name,
364
+ params: R(t)
365
+ };
366
+ else if (t.type === "transform")
367
+ d = {
368
+ operation: t.name,
369
+ params: R(t)
370
+ };
371
+ else if (t.type === "input")
372
+ d = {
373
+ uploadId: void 0,
374
+ filename: void 0,
375
+ mime: void 0
376
+ };
377
+ else if (t.type === "vision")
378
+ d = {
379
+ providerName: t.name,
380
+ params: R(t)
381
+ };
382
+ else if (t.type === "text")
383
+ d = {
384
+ providerName: t.name,
385
+ params: R(t)
386
+ };
387
+ else {
388
+ const l = ((o = t.params) == null ? void 0 : o.properties) || {}, p = ((n = l.provider) == null ? void 0 : n.default) || "filesystem";
389
+ d = {
390
+ destination: ((u = l.destination) == null ? void 0 : u.default) || "./output/image.png",
391
+ provider: p
392
+ };
393
+ }
394
+ const m = {
395
+ id: s,
370
396
  type: t.type,
371
- position: o,
372
- data: i
397
+ position: a,
398
+ data: d
373
399
  };
374
- r((a) => ({
375
- nodes: [...a.nodes, l]
400
+ r((l) => ({
401
+ nodes: [...l.nodes, m]
376
402
  }));
377
403
  },
378
- updateNodeData: (t, o) => {
379
- r((n) => ({
380
- nodes: n.nodes.map(
381
- (i) => i.id === t ? { ...i, data: { ...i.data, ...o } } : i
404
+ updateNodeData: (t, a) => {
405
+ r((s) => ({
406
+ nodes: s.nodes.map(
407
+ (d) => d.id === t ? { ...d, data: { ...d.data, ...a } } : d
382
408
  )
383
409
  }));
384
410
  },
385
411
  deleteNode: (t) => {
386
- r((o) => ({
387
- nodes: o.nodes.filter((n) => n.id !== t),
388
- edges: o.edges.filter((n) => n.source !== t && n.target !== t),
389
- selectedNodeId: o.selectedNodeId === t ? null : o.selectedNodeId
412
+ r((a) => ({
413
+ nodes: a.nodes.filter((s) => s.id !== t),
414
+ edges: a.edges.filter((s) => s.source !== t && s.target !== t),
415
+ selectedNodeId: a.selectedNodeId === t ? null : a.selectedNodeId
390
416
  }));
391
417
  },
392
418
  setNodes: (t) => r({ nodes: t }),
393
419
  addEdge: (t) => {
394
420
  if (!t.source || !t.target) return;
395
- const n = {
421
+ const s = {
396
422
  id: `edge_${t.source}_${t.target}`,
397
423
  source: t.source,
398
424
  target: t.target
399
425
  };
400
- r((i) => ({
401
- edges: [...i.edges, n]
426
+ r((d) => ({
427
+ edges: [...d.edges, s]
402
428
  }));
403
429
  },
404
430
  deleteEdge: (t) => {
405
- r((o) => ({
406
- edges: o.edges.filter((n) => n.id !== t)
431
+ r((a) => ({
432
+ edges: a.edges.filter((s) => s.id !== t)
407
433
  }));
408
434
  },
409
435
  setEdges: (t) => r({ edges: t }),
410
436
  setSelectedNode: (t) => r({ selectedNodeId: t }),
411
437
  execute: async () => {
412
- const { nodes: t, edges: o } = s(), n = t.map((c) => ({
413
- id: c.id,
414
- type: c.type,
415
- position: c.position,
416
- data: c.data
417
- })), i = o.map((c) => ({
418
- id: c.id,
419
- source: c.source,
420
- target: c.target
421
- })), l = A.getState().getConfiguredProviders(), a = {};
422
- for (const c of t)
423
- a[c.id] = "running";
438
+ const { nodes: t, edges: a } = i(), s = t.map((n) => ({
439
+ id: n.id,
440
+ type: n.type,
441
+ position: n.position,
442
+ data: n.data
443
+ })), d = a.map((n) => ({
444
+ id: n.id,
445
+ source: n.source,
446
+ target: n.target
447
+ })), m = $.getState().getConfiguredProviders(), o = {};
448
+ for (const n of t)
449
+ o[n.id] = "running";
424
450
  r({
425
451
  execution: {
426
452
  status: "running",
427
453
  imageIds: [],
428
454
  previews: {},
429
455
  dataOutputs: {},
430
- nodeStatus: a
456
+ nodeStatus: o
431
457
  }
432
458
  });
433
459
  try {
434
- const c = await Se(n, i, l), u = {};
435
- for (const d of t)
436
- u[d.id] = c.status === "completed" ? "completed" : "error";
437
- c.status === "completed" ? r({
460
+ const n = await De(s, d, m), u = {};
461
+ for (const l of t)
462
+ u[l.id] = n.status === "completed" ? "completed" : "error";
463
+ n.status === "completed" ? r({
438
464
  execution: {
439
465
  status: "completed",
440
- imageIds: c.imageIds,
441
- previews: c.previews || {},
442
- dataOutputs: c.dataOutputs || {},
466
+ imageIds: n.imageIds,
467
+ previews: n.previews || {},
468
+ dataOutputs: n.dataOutputs || {},
443
469
  nodeStatus: u
444
470
  }
445
471
  }) : r({
@@ -449,13 +475,13 @@ const f = oe()(
449
475
  previews: {},
450
476
  dataOutputs: {},
451
477
  nodeStatus: u,
452
- error: c.error
478
+ error: n.error
453
479
  }
454
480
  });
455
- } catch (c) {
481
+ } catch (n) {
456
482
  const u = {};
457
- for (const d of t)
458
- u[d.id] = "error";
483
+ for (const l of t)
484
+ u[l.id] = "error";
459
485
  r({
460
486
  execution: {
461
487
  status: "error",
@@ -463,23 +489,58 @@ const f = oe()(
463
489
  previews: {},
464
490
  dataOutputs: {},
465
491
  nodeStatus: u,
466
- error: c instanceof Error ? c.message : "Unknown error"
492
+ error: n instanceof Error ? n.message : "Unknown error"
467
493
  }
468
494
  });
469
495
  }
470
496
  },
471
497
  exportToYaml: async () => {
472
- const { nodes: t, edges: o } = s(), n = t.map((a) => ({
473
- id: a.id,
474
- type: a.type,
475
- position: a.position,
476
- data: a.data
477
- })), i = o.map((a) => ({
478
- id: a.id,
479
- source: a.source,
480
- target: a.target
498
+ const { nodes: t, edges: a } = i(), s = t.map((o) => ({
499
+ id: o.id,
500
+ type: o.type,
501
+ position: o.position,
502
+ data: o.data
503
+ })), d = a.map((o) => ({
504
+ id: o.id,
505
+ source: o.source,
506
+ target: o.target
481
507
  }));
482
- return (await Ie(n, i)).yaml;
508
+ return (await $e(s, d)).yaml;
509
+ },
510
+ importFromYaml: (t, a, s) => {
511
+ const d = /* @__PURE__ */ new Map(), m = t.map((n) => {
512
+ const u = K();
513
+ return d.set(n.id, u), {
514
+ id: u,
515
+ type: n.type,
516
+ position: n.position,
517
+ data: n.data
518
+ };
519
+ }), o = a.map((n) => {
520
+ const u = d.get(n.source) || n.source, l = d.get(n.target) || n.target;
521
+ return {
522
+ id: `edge_${u}_${l}`,
523
+ source: u,
524
+ target: l
525
+ };
526
+ });
527
+ r({
528
+ nodes: m,
529
+ edges: o,
530
+ selectedNodeId: null,
531
+ currentTemplateId: null,
532
+ previewVisible: {},
533
+ activeWorkflowId: null,
534
+ activeWorkflowName: s || "Imported Workflow",
535
+ hasUnsavedChanges: !0,
536
+ execution: {
537
+ status: "idle",
538
+ imageIds: [],
539
+ previews: {},
540
+ dataOutputs: {},
541
+ nodeStatus: {}
542
+ }
543
+ });
483
544
  },
484
545
  // Workflow persistence methods
485
546
  markDirty: () => r({ hasUnsavedChanges: !0 }),
@@ -506,50 +567,50 @@ const f = oe()(
506
567
  },
507
568
  saveWorkflow: (t) => {
508
569
  const {
509
- nodes: o,
510
- edges: n,
511
- activeWorkflowId: i,
512
- activeWorkflowName: l,
513
- savedWorkflows: a,
514
- currentTemplateId: c
515
- } = s(), u = Date.now();
516
- if (i) {
517
- const d = a.map(
518
- (p) => p.id === i ? { ...p, name: t || l, nodes: o, edges: n, updatedAt: u } : p
570
+ nodes: a,
571
+ edges: s,
572
+ activeWorkflowId: d,
573
+ activeWorkflowName: m,
574
+ savedWorkflows: o,
575
+ currentTemplateId: n
576
+ } = i(), u = Date.now();
577
+ if (d) {
578
+ const l = o.map(
579
+ (p) => p.id === d ? { ...p, name: t || m, nodes: a, edges: s, updatedAt: u } : p
519
580
  );
520
581
  return r({
521
- savedWorkflows: d,
522
- activeWorkflowName: t || l,
582
+ savedWorkflows: l,
583
+ activeWorkflowName: t || m,
523
584
  hasUnsavedChanges: !1
524
- }), i;
585
+ }), d;
525
586
  } else {
526
- const d = re(), p = {
527
- id: d,
528
- name: t || l,
529
- nodes: o,
530
- edges: n,
587
+ const l = oe(), p = {
588
+ id: l,
589
+ name: t || m,
590
+ nodes: a,
591
+ edges: s,
531
592
  createdAt: u,
532
593
  updatedAt: u,
533
- templateId: c || void 0
594
+ templateId: n || void 0
534
595
  };
535
596
  return r({
536
- savedWorkflows: [...a, p],
537
- activeWorkflowId: d,
538
- activeWorkflowName: t || l,
597
+ savedWorkflows: [...o, p],
598
+ activeWorkflowId: l,
599
+ activeWorkflowName: t || m,
539
600
  hasUnsavedChanges: !1
540
- }), d;
601
+ }), l;
541
602
  }
542
603
  },
543
604
  loadWorkflow: (t) => {
544
- const { savedWorkflows: o } = s(), n = o.find((i) => i.id === t);
545
- n && r({
546
- nodes: n.nodes,
547
- edges: n.edges,
605
+ const { savedWorkflows: a } = i(), s = a.find((d) => d.id === t);
606
+ s && r({
607
+ nodes: s.nodes,
608
+ edges: s.edges,
548
609
  selectedNodeId: null,
549
- currentTemplateId: n.templateId || null,
610
+ currentTemplateId: s.templateId || null,
550
611
  previewVisible: {},
551
612
  activeWorkflowId: t,
552
- activeWorkflowName: n.name,
613
+ activeWorkflowName: s.name,
553
614
  hasUnsavedChanges: !1,
554
615
  execution: {
555
616
  status: "idle",
@@ -561,9 +622,9 @@ const f = oe()(
561
622
  });
562
623
  },
563
624
  deleteWorkflow: (t) => {
564
- const { savedWorkflows: o, activeWorkflowId: n } = s(), i = o.filter((l) => l.id !== t);
565
- r(n === t ? {
566
- savedWorkflows: i,
625
+ const { savedWorkflows: a, activeWorkflowId: s } = i(), d = a.filter((m) => m.id !== t);
626
+ r(s === t ? {
627
+ savedWorkflows: d,
567
628
  nodes: [],
568
629
  edges: [],
569
630
  selectedNodeId: null,
@@ -579,28 +640,28 @@ const f = oe()(
579
640
  dataOutputs: {},
580
641
  nodeStatus: {}
581
642
  }
582
- } : { savedWorkflows: i });
643
+ } : { savedWorkflows: d });
583
644
  },
584
- renameWorkflow: (t, o) => {
585
- const { savedWorkflows: n, activeWorkflowId: i } = s(), l = n.map(
586
- (a) => a.id === t ? { ...a, name: o, updatedAt: Date.now() } : a
645
+ renameWorkflow: (t, a) => {
646
+ const { savedWorkflows: s, activeWorkflowId: d } = i(), m = s.map(
647
+ (o) => o.id === t ? { ...o, name: a, updatedAt: Date.now() } : o
587
648
  );
588
649
  r({
589
- savedWorkflows: l,
590
- ...i === t ? { activeWorkflowName: o } : {}
650
+ savedWorkflows: m,
651
+ ...d === t ? { activeWorkflowName: a } : {}
591
652
  });
592
653
  },
593
654
  duplicateWorkflow: (t) => {
594
- const { savedWorkflows: o } = s(), n = o.find((c) => c.id === t);
595
- if (!n) return "";
596
- const i = Date.now(), l = re(), a = {
597
- ...n,
598
- id: l,
599
- name: `${n.name} (Copy)`,
600
- createdAt: i,
601
- updatedAt: i
655
+ const { savedWorkflows: a } = i(), s = a.find((n) => n.id === t);
656
+ if (!s) return "";
657
+ const d = Date.now(), m = oe(), o = {
658
+ ...s,
659
+ id: m,
660
+ name: `${s.name} (Copy)`,
661
+ createdAt: d,
662
+ updatedAt: d
602
663
  };
603
- return r({ savedWorkflows: [...o, a] }), l;
664
+ return r({ savedWorkflows: [...a, o] }), m;
604
665
  }
605
666
  }),
606
667
  {
@@ -614,26 +675,26 @@ const f = oe()(
614
675
  );
615
676
  function R(r) {
616
677
  var t;
617
- const s = {};
678
+ const i = {};
618
679
  if ((t = r.params) != null && t.properties)
619
- for (const [o, n] of Object.entries(r.params.properties))
620
- n.default !== void 0 && (s[o] = n.default);
621
- return s;
680
+ for (const [a, s] of Object.entries(r.params.properties))
681
+ s.default !== void 0 && (i[a] = s.default);
682
+ return i;
622
683
  }
623
- function M(r) {
684
+ function U(r) {
624
685
  return r === "running" ? "border-yellow-400 animate-pulse" : r === "completed" ? "border-green-500" : r === "error" ? "border-red-500" : "";
625
686
  }
626
- function H({ nodeId: r, color: s }) {
627
- const t = f((n) => n.previewVisible[r] !== !1), o = f((n) => n.togglePreview);
687
+ function Q({ nodeId: r, color: i }) {
688
+ const t = x((s) => s.previewVisible[r] !== !1), a = x((s) => s.togglePreview);
628
689
  return /* @__PURE__ */ e(
629
690
  "button",
630
691
  {
631
- onClick: (n) => {
632
- n.stopPropagation(), o(r);
692
+ onClick: (s) => {
693
+ s.stopPropagation(), a(r);
633
694
  },
634
695
  className: `ml-auto p-1 rounded hover:bg-gray-200 dark:hover:bg-zinc-600 transition-colors ${t ? "opacity-100" : "opacity-40"}`,
635
696
  title: t ? "Hide preview" : "Show preview",
636
- children: /* @__PURE__ */ e("svg", { className: `w-3.5 h-3.5 ${s}`, fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: t ? /* @__PURE__ */ e(
697
+ children: /* @__PURE__ */ e("svg", { className: `w-3.5 h-3.5 ${i}`, fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: t ? /* @__PURE__ */ e(
637
698
  "path",
638
699
  {
639
700
  strokeLinecap: "round",
@@ -653,72 +714,72 @@ function H({ nodeId: r, color: s }) {
653
714
  }
654
715
  );
655
716
  }
656
- const je = T(function({
657
- id: s,
717
+ const Re = T(function({
718
+ id: i,
658
719
  data: t,
659
- selected: o
720
+ selected: a
660
721
  }) {
661
- const n = f((u) => u.execution.previews[s]), i = f((u) => u.execution.nodeStatus[s]), l = f((u) => u.previewVisible[s] !== !1), c = M(i) || (o ? "border-blue-500" : "border-blue-200");
662
- return /* @__PURE__ */ m(
722
+ const s = x((u) => u.execution.previews[i]), d = x((u) => u.execution.nodeStatus[i]), m = x((u) => u.previewVisible[i] !== !1), n = U(d) || (a ? "border-blue-500" : "border-blue-200");
723
+ return /* @__PURE__ */ c(
663
724
  "div",
664
725
  {
665
- className: `rounded-lg border-2 bg-white dark:bg-zinc-800 shadow-md min-w-[180px] overflow-hidden ${c}`,
726
+ className: `rounded-lg border-2 bg-white dark:bg-zinc-800 shadow-md min-w-[180px] overflow-hidden ${n}`,
666
727
  children: [
667
- n && l && /* @__PURE__ */ e("div", { className: "bg-gray-100 dark:bg-zinc-900 border-b border-gray-200 dark:border-zinc-700", children: /* @__PURE__ */ e("img", { src: n, alt: "Preview", className: "w-full h-24 object-contain" }) }),
668
- /* @__PURE__ */ m("div", { className: "px-4 py-3", children: [
669
- /* @__PURE__ */ m("div", { className: "flex items-center gap-2 mb-2", children: [
728
+ s && m && /* @__PURE__ */ e("div", { className: "bg-gray-100 dark:bg-zinc-900 border-b border-gray-200 dark:border-zinc-700", children: /* @__PURE__ */ e("img", { src: s, alt: "Preview", className: "w-full h-24 object-contain" }) }),
729
+ /* @__PURE__ */ c("div", { className: "px-4 py-3", children: [
730
+ /* @__PURE__ */ c("div", { className: "flex items-center gap-2 mb-2", children: [
670
731
  /* @__PURE__ */ e("div", { className: "w-3 h-3 rounded-full bg-blue-500" }),
671
732
  /* @__PURE__ */ e("span", { className: "font-semibold text-sm text-blue-700 dark:text-blue-400", children: t.generatorName }),
672
- /* @__PURE__ */ e(H, { nodeId: s, color: "text-blue-500 dark:text-blue-400" })
733
+ /* @__PURE__ */ e(Q, { nodeId: i, color: "text-blue-500 dark:text-blue-400" })
673
734
  ] }),
674
- /* @__PURE__ */ e("div", { className: "text-xs text-gray-500 dark:text-zinc-400", children: Object.entries(t.params).slice(0, 2).map(([u, d]) => /* @__PURE__ */ m("div", { className: "truncate", children: [
735
+ /* @__PURE__ */ e("div", { className: "text-xs text-gray-500 dark:text-zinc-400", children: Object.entries(t.params).filter(([, u]) => typeof u != "object" || u === null).slice(0, 2).map(([u, l]) => /* @__PURE__ */ c("div", { className: "truncate", children: [
675
736
  u,
676
737
  ": ",
677
- String(d).slice(0, 20)
738
+ String(l).slice(0, 20)
678
739
  ] }, u)) })
679
740
  ] }),
680
- /* @__PURE__ */ e(I, { type: "source", position: L.Right, className: "w-3 h-3 !bg-blue-500" })
741
+ /* @__PURE__ */ e(L, { type: "source", position: W.Right, className: "w-3 h-3 !bg-blue-500" })
681
742
  ]
682
743
  }
683
744
  );
684
- }), Te = T(function({
685
- id: s,
745
+ }), Fe = T(function({
746
+ id: i,
686
747
  data: t,
687
- selected: o
748
+ selected: a
688
749
  }) {
689
- const n = f((u) => u.execution.previews[s]), i = f((u) => u.execution.nodeStatus[s]), l = f((u) => u.previewVisible[s] !== !1), c = M(i) || (o ? "border-teal-500" : "border-teal-200");
690
- return /* @__PURE__ */ m(
750
+ const s = x((u) => u.execution.previews[i]), d = x((u) => u.execution.nodeStatus[i]), m = x((u) => u.previewVisible[i] !== !1), n = U(d) || (a ? "border-teal-500" : "border-teal-200");
751
+ return /* @__PURE__ */ c(
691
752
  "div",
692
753
  {
693
- className: `rounded-lg border-2 bg-white dark:bg-zinc-800 shadow-md min-w-[180px] overflow-hidden ${c}`,
754
+ className: `rounded-lg border-2 bg-white dark:bg-zinc-800 shadow-md min-w-[180px] overflow-hidden ${n}`,
694
755
  children: [
695
- /* @__PURE__ */ e(I, { type: "target", position: L.Left, className: "w-3 h-3 !bg-teal-500" }),
696
- n && l && /* @__PURE__ */ e("div", { className: "bg-gray-100 dark:bg-zinc-900 border-b border-gray-200 dark:border-zinc-700", children: /* @__PURE__ */ e("img", { src: n, alt: "Preview", className: "w-full h-24 object-contain" }) }),
697
- /* @__PURE__ */ m("div", { className: "px-4 py-3", children: [
698
- /* @__PURE__ */ m("div", { className: "flex items-center gap-2 mb-2", children: [
756
+ /* @__PURE__ */ e(L, { type: "target", position: W.Left, className: "w-3 h-3 !bg-teal-500" }),
757
+ s && m && /* @__PURE__ */ e("div", { className: "bg-gray-100 dark:bg-zinc-900 border-b border-gray-200 dark:border-zinc-700", children: /* @__PURE__ */ e("img", { src: s, alt: "Preview", className: "w-full h-24 object-contain" }) }),
758
+ /* @__PURE__ */ c("div", { className: "px-4 py-3", children: [
759
+ /* @__PURE__ */ c("div", { className: "flex items-center gap-2 mb-2", children: [
699
760
  /* @__PURE__ */ e("div", { className: "w-3 h-3 rounded-full bg-teal-500" }),
700
761
  /* @__PURE__ */ e("span", { className: "font-semibold text-sm text-teal-700 dark:text-teal-400", children: t.operation }),
701
- /* @__PURE__ */ e(H, { nodeId: s, color: "text-teal-500 dark:text-teal-400" })
762
+ /* @__PURE__ */ e(Q, { nodeId: i, color: "text-teal-500 dark:text-teal-400" })
702
763
  ] }),
703
- /* @__PURE__ */ e("div", { className: "text-xs text-gray-500 dark:text-zinc-400", children: Object.entries(t.params).slice(0, 2).map(([u, d]) => /* @__PURE__ */ m("div", { className: "truncate", children: [
764
+ /* @__PURE__ */ e("div", { className: "text-xs text-gray-500 dark:text-zinc-400", children: Object.entries(t.params).filter(([, u]) => typeof u != "object" || u === null).slice(0, 2).map(([u, l]) => /* @__PURE__ */ c("div", { className: "truncate", children: [
704
765
  u,
705
766
  ": ",
706
- String(d).slice(0, 20)
767
+ String(l).slice(0, 20)
707
768
  ] }, u)) })
708
769
  ] }),
709
- /* @__PURE__ */ e(I, { type: "source", position: L.Right, className: "w-3 h-3 !bg-teal-500" })
770
+ /* @__PURE__ */ e(L, { type: "source", position: W.Right, className: "w-3 h-3 !bg-teal-500" })
710
771
  ]
711
772
  }
712
773
  );
713
- }), Me = T(function({ id: s, data: t, selected: o }) {
714
- const n = f((a) => a.execution.nodeStatus[s]), l = M(n) || (o ? "border-green-500" : "border-green-200");
715
- return /* @__PURE__ */ m(
774
+ }), Ve = T(function({ id: i, data: t, selected: a }) {
775
+ const s = x((o) => o.execution.nodeStatus[i]), m = U(s) || (a ? "border-green-500" : "border-green-200");
776
+ return /* @__PURE__ */ c(
716
777
  "div",
717
778
  {
718
- className: `px-4 py-3 rounded-lg border-2 bg-white dark:bg-zinc-800 shadow-md min-w-[180px] ${l}`,
779
+ className: `px-4 py-3 rounded-lg border-2 bg-white dark:bg-zinc-800 shadow-md min-w-[180px] ${m}`,
719
780
  children: [
720
- /* @__PURE__ */ e(I, { type: "target", position: L.Left, className: "w-3 h-3 !bg-green-500" }),
721
- /* @__PURE__ */ m("div", { className: "flex items-center gap-2 mb-2", children: [
781
+ /* @__PURE__ */ e(L, { type: "target", position: W.Left, className: "w-3 h-3 !bg-green-500" }),
782
+ /* @__PURE__ */ c("div", { className: "flex items-center gap-2 mb-2", children: [
722
783
  /* @__PURE__ */ e("div", { className: "w-3 h-3 rounded-full bg-green-500" }),
723
784
  /* @__PURE__ */ e("span", { className: "font-semibold text-sm text-green-700 dark:text-green-400", children: "Save" })
724
785
  ] }),
@@ -726,54 +787,54 @@ const je = T(function({
726
787
  ]
727
788
  }
728
789
  );
729
- }), Ue = T(function({ id: s, data: t, selected: o }) {
730
- const n = f((w) => w.execution.previews[s]), i = f((w) => w.execution.nodeStatus[s]), l = f((w) => w.previewVisible[s] !== !1), a = f((w) => w.updateNodeData), c = ge(null), d = M(i) || (o ? "border-amber-500" : "border-amber-200"), p = C(
731
- async (w) => {
790
+ }), Ge = T(function({ id: i, data: t, selected: a }) {
791
+ const s = x((v) => v.execution.previews[i]), d = x((v) => v.execution.nodeStatus[i]), m = x((v) => v.previewVisible[i] !== !1), o = x((v) => v.updateNodeData), n = xe(null), l = U(d) || (a ? "border-amber-500" : "border-amber-200"), p = C(
792
+ async (v) => {
732
793
  try {
733
- const k = await Ae(w);
734
- a(s, {
735
- uploadId: k.id,
736
- filename: k.filename,
737
- mime: k.mime
794
+ const w = await Pe(v);
795
+ o(i, {
796
+ uploadId: w.id,
797
+ filename: w.filename,
798
+ mime: w.mime
738
799
  });
739
- } catch (k) {
740
- console.error("Upload failed:", k);
800
+ } catch (w) {
801
+ console.error("Upload failed:", w);
741
802
  }
742
803
  },
743
- [s, a]
744
- ), h = C(
745
- (w) => {
746
- w.preventDefault(), w.stopPropagation();
747
- const k = w.dataTransfer.files[0];
748
- k && k.type.startsWith("image/") && p(k);
804
+ [i, o]
805
+ ), f = C(
806
+ (v) => {
807
+ v.preventDefault(), v.stopPropagation();
808
+ const w = v.dataTransfer.files[0];
809
+ w && w.type.startsWith("image/") && p(w);
749
810
  },
750
811
  [p]
751
- ), b = C((w) => {
752
- w.preventDefault(), w.stopPropagation();
753
- }, []), x = C(
754
- (w) => {
755
- var y;
756
- const k = (y = w.target.files) == null ? void 0 : y[0];
757
- k && p(k);
812
+ ), b = C((v) => {
813
+ v.preventDefault(), v.stopPropagation();
814
+ }, []), k = C(
815
+ (v) => {
816
+ var h;
817
+ const w = (h = v.target.files) == null ? void 0 : h[0];
818
+ w && p(w);
758
819
  },
759
820
  [p]
760
- ), g = n || (t.uploadId ? se(t.uploadId) : null);
761
- return /* @__PURE__ */ m(
821
+ ), g = s || (t.uploadId ? de(t.uploadId) : null);
822
+ return /* @__PURE__ */ c(
762
823
  "div",
763
824
  {
764
- className: `rounded-lg border-2 bg-white dark:bg-zinc-800 shadow-md min-w-[180px] overflow-hidden ${d}`,
765
- onDrop: h,
825
+ className: `rounded-lg border-2 bg-white dark:bg-zinc-800 shadow-md min-w-[180px] overflow-hidden ${l}`,
826
+ onDrop: f,
766
827
  onDragOver: b,
767
828
  children: [
768
- g && l ? /* @__PURE__ */ e("div", { className: "bg-gray-100 dark:bg-zinc-900 border-b border-gray-200 dark:border-zinc-700", children: /* @__PURE__ */ e("img", { src: g, alt: "Uploaded", className: "w-full h-24 object-contain" }) }) : g ? null : /* @__PURE__ */ e(
829
+ g && m ? /* @__PURE__ */ e("div", { className: "bg-gray-100 dark:bg-zinc-900 border-b border-gray-200 dark:border-zinc-700", children: /* @__PURE__ */ e("img", { src: g, alt: "Uploaded", className: "w-full h-24 object-contain" }) }) : g ? null : /* @__PURE__ */ e(
769
830
  "div",
770
831
  {
771
832
  className: "bg-amber-50 dark:bg-amber-900/30 border-b border-amber-100 dark:border-amber-800 h-24 flex items-center justify-center cursor-pointer hover:bg-amber-100 dark:hover:bg-amber-900/50 transition-colors",
772
833
  onClick: () => {
773
- var w;
774
- return (w = c.current) == null ? void 0 : w.click();
834
+ var v;
835
+ return (v = n.current) == null ? void 0 : v.click();
775
836
  },
776
- children: /* @__PURE__ */ m("div", { className: "text-center text-amber-600 dark:text-amber-400", children: [
837
+ children: /* @__PURE__ */ c("div", { className: "text-center text-amber-600 dark:text-amber-400", children: [
777
838
  /* @__PURE__ */ e("div", { className: "text-2xl mb-1", children: "+" }),
778
839
  /* @__PURE__ */ e("div", { className: "text-xs", children: "Drop image or click" })
779
840
  ] })
@@ -782,48 +843,48 @@ const je = T(function({
782
843
  /* @__PURE__ */ e(
783
844
  "input",
784
845
  {
785
- ref: c,
846
+ ref: n,
786
847
  type: "file",
787
848
  accept: "image/*",
788
849
  className: "hidden",
789
- onChange: x
850
+ onChange: k
790
851
  }
791
852
  ),
792
- /* @__PURE__ */ m("div", { className: "px-4 py-3", children: [
793
- /* @__PURE__ */ m("div", { className: "flex items-center gap-2 mb-2", children: [
853
+ /* @__PURE__ */ c("div", { className: "px-4 py-3", children: [
854
+ /* @__PURE__ */ c("div", { className: "flex items-center gap-2 mb-2", children: [
794
855
  /* @__PURE__ */ e("div", { className: "w-3 h-3 rounded-full bg-amber-500" }),
795
856
  /* @__PURE__ */ e("span", { className: "font-semibold text-sm text-amber-700 dark:text-amber-400", children: "Input" }),
796
- /* @__PURE__ */ e(H, { nodeId: s, color: "text-amber-500 dark:text-amber-400" })
857
+ /* @__PURE__ */ e(Q, { nodeId: i, color: "text-amber-500 dark:text-amber-400" })
797
858
  ] }),
798
859
  /* @__PURE__ */ e("div", { className: "text-xs text-gray-500 dark:text-zinc-400 truncate", children: t.filename || "No image selected" })
799
860
  ] }),
800
- /* @__PURE__ */ e(I, { type: "source", position: L.Right, className: "w-3 h-3 !bg-amber-500" })
861
+ /* @__PURE__ */ e(L, { type: "source", position: W.Right, className: "w-3 h-3 !bg-amber-500" })
801
862
  ]
802
863
  }
803
864
  );
804
- }), Ee = T(function({
805
- id: s,
865
+ }), qe = T(function({
866
+ id: i,
806
867
  data: t,
807
- selected: o
868
+ selected: a
808
869
  }) {
809
- var c, u;
810
- const n = f((d) => d.execution.nodeStatus[s]), i = f((d) => {
870
+ var n, u;
871
+ const s = x((l) => l.execution.nodeStatus[i]), d = x((l) => {
811
872
  var p;
812
- return (p = d.execution.dataOutputs) == null ? void 0 : p[s];
813
- }), a = M(n) || (o ? "border-cyan-500" : "border-cyan-200");
814
- return /* @__PURE__ */ m(
873
+ return (p = l.execution.dataOutputs) == null ? void 0 : p[i];
874
+ }), o = U(s) || (a ? "border-cyan-500" : "border-cyan-200");
875
+ return /* @__PURE__ */ c(
815
876
  "div",
816
877
  {
817
- className: `rounded-lg border-2 bg-white dark:bg-zinc-800 shadow-md min-w-[180px] overflow-hidden ${a}`,
878
+ className: `rounded-lg border-2 bg-white dark:bg-zinc-800 shadow-md min-w-[180px] overflow-hidden ${o}`,
818
879
  children: [
819
- /* @__PURE__ */ e(I, { type: "target", position: L.Left, className: "w-3 h-3 !bg-cyan-500" }),
820
- i && /* @__PURE__ */ e("div", { className: "bg-cyan-50 dark:bg-cyan-900/30 border-b border-cyan-100 dark:border-cyan-800 p-2 max-h-24 overflow-auto", children: /* @__PURE__ */ m("pre", { className: "text-xs text-cyan-800 dark:text-cyan-200 whitespace-pre-wrap", children: [
821
- (c = i.content) == null ? void 0 : c.slice(0, 200),
822
- (((u = i.content) == null ? void 0 : u.length) || 0) > 200 && "..."
880
+ /* @__PURE__ */ e(L, { type: "target", position: W.Left, className: "w-3 h-3 !bg-cyan-500" }),
881
+ d && /* @__PURE__ */ e("div", { className: "bg-cyan-50 dark:bg-cyan-900/30 border-b border-cyan-100 dark:border-cyan-800 p-2 max-h-24 overflow-auto", children: /* @__PURE__ */ c("pre", { className: "text-xs text-cyan-800 dark:text-cyan-200 whitespace-pre-wrap", children: [
882
+ (n = d.content) == null ? void 0 : n.slice(0, 200),
883
+ (((u = d.content) == null ? void 0 : u.length) || 0) > 200 && "..."
823
884
  ] }) }),
824
- /* @__PURE__ */ m("div", { className: "px-4 py-3", children: [
825
- /* @__PURE__ */ m("div", { className: "flex items-center gap-2 mb-2", children: [
826
- /* @__PURE__ */ m("svg", { className: "w-3 h-3 text-cyan-500", fill: "currentColor", viewBox: "0 0 20 20", children: [
885
+ /* @__PURE__ */ c("div", { className: "px-4 py-3", children: [
886
+ /* @__PURE__ */ c("div", { className: "flex items-center gap-2 mb-2", children: [
887
+ /* @__PURE__ */ c("svg", { className: "w-3 h-3 text-cyan-500", fill: "currentColor", viewBox: "0 0 20 20", children: [
827
888
  /* @__PURE__ */ e("path", { d: "M10 12a2 2 0 100-4 2 2 0 000 4z" }),
828
889
  /* @__PURE__ */ e(
829
890
  "path",
@@ -836,33 +897,33 @@ const je = T(function({
836
897
  ] }),
837
898
  /* @__PURE__ */ e("span", { className: "font-semibold text-sm text-cyan-700 dark:text-cyan-400", children: t.providerName })
838
899
  ] }),
839
- /* @__PURE__ */ e("div", { className: "text-xs text-gray-500 dark:text-zinc-400", children: t.params.prompt ? /* @__PURE__ */ m("div", { className: "truncate", children: [
900
+ /* @__PURE__ */ e("div", { className: "text-xs text-gray-500 dark:text-zinc-400", children: t.params.prompt ? /* @__PURE__ */ c("div", { className: "truncate", children: [
840
901
  String(t.params.prompt).slice(0, 30),
841
902
  "..."
842
903
  ] }) : null })
843
904
  ] }),
844
- /* @__PURE__ */ e(I, { type: "source", position: L.Right, className: "w-3 h-3 !bg-cyan-500" })
905
+ /* @__PURE__ */ e(L, { type: "source", position: W.Right, className: "w-3 h-3 !bg-cyan-500" })
845
906
  ]
846
907
  }
847
908
  );
848
- }), Oe = T(function({ id: s, data: t, selected: o }) {
849
- var c, u;
850
- const n = f((d) => d.execution.nodeStatus[s]), i = f((d) => {
909
+ }), Ke = T(function({ id: i, data: t, selected: a }) {
910
+ var n, u;
911
+ const s = x((l) => l.execution.nodeStatus[i]), d = x((l) => {
851
912
  var p;
852
- return (p = d.execution.dataOutputs) == null ? void 0 : p[s];
853
- }), a = M(n) || (o ? "border-pink-500" : "border-pink-200");
854
- return /* @__PURE__ */ m(
913
+ return (p = l.execution.dataOutputs) == null ? void 0 : p[i];
914
+ }), o = U(s) || (a ? "border-pink-500" : "border-pink-200");
915
+ return /* @__PURE__ */ c(
855
916
  "div",
856
917
  {
857
- className: `rounded-lg border-2 bg-white dark:bg-zinc-800 shadow-md min-w-[180px] overflow-hidden ${a}`,
918
+ className: `rounded-lg border-2 bg-white dark:bg-zinc-800 shadow-md min-w-[180px] overflow-hidden ${o}`,
858
919
  children: [
859
- /* @__PURE__ */ e(I, { type: "target", position: L.Left, className: "w-3 h-3 !bg-pink-500" }),
860
- i && /* @__PURE__ */ e("div", { className: "bg-pink-50 dark:bg-pink-900/30 border-b border-pink-100 dark:border-pink-800 p-2 max-h-24 overflow-auto", children: /* @__PURE__ */ m("pre", { className: "text-xs text-pink-800 dark:text-pink-200 whitespace-pre-wrap", children: [
861
- (c = i.content) == null ? void 0 : c.slice(0, 200),
862
- (((u = i.content) == null ? void 0 : u.length) || 0) > 200 && "..."
920
+ /* @__PURE__ */ e(L, { type: "target", position: W.Left, className: "w-3 h-3 !bg-pink-500" }),
921
+ d && /* @__PURE__ */ e("div", { className: "bg-pink-50 dark:bg-pink-900/30 border-b border-pink-100 dark:border-pink-800 p-2 max-h-24 overflow-auto", children: /* @__PURE__ */ c("pre", { className: "text-xs text-pink-800 dark:text-pink-200 whitespace-pre-wrap", children: [
922
+ (n = d.content) == null ? void 0 : n.slice(0, 200),
923
+ (((u = d.content) == null ? void 0 : u.length) || 0) > 200 && "..."
863
924
  ] }) }),
864
- /* @__PURE__ */ m("div", { className: "px-4 py-3", children: [
865
- /* @__PURE__ */ m("div", { className: "flex items-center gap-2 mb-2", children: [
925
+ /* @__PURE__ */ c("div", { className: "px-4 py-3", children: [
926
+ /* @__PURE__ */ c("div", { className: "flex items-center gap-2 mb-2", children: [
866
927
  /* @__PURE__ */ e("svg", { className: "w-3 h-3 text-pink-500", fill: "currentColor", viewBox: "0 0 20 20", children: /* @__PURE__ */ e(
867
928
  "path",
868
929
  {
@@ -873,27 +934,27 @@ const je = T(function({
873
934
  ) }),
874
935
  /* @__PURE__ */ e("span", { className: "font-semibold text-sm text-pink-700 dark:text-pink-400", children: t.providerName })
875
936
  ] }),
876
- /* @__PURE__ */ e("div", { className: "text-xs text-gray-500 dark:text-zinc-400", children: t.params.prompt ? /* @__PURE__ */ m("div", { className: "truncate", children: [
937
+ /* @__PURE__ */ e("div", { className: "text-xs text-gray-500 dark:text-zinc-400", children: t.params.prompt ? /* @__PURE__ */ c("div", { className: "truncate", children: [
877
938
  String(t.params.prompt).slice(0, 30),
878
939
  "..."
879
940
  ] }) : null })
880
941
  ] }),
881
- /* @__PURE__ */ e(I, { type: "source", position: L.Right, className: "w-3 h-3 !bg-pink-500" })
942
+ /* @__PURE__ */ e(L, { type: "source", position: W.Right, className: "w-3 h-3 !bg-pink-500" })
882
943
  ]
883
944
  }
884
945
  );
885
- }), Be = {
886
- generator: je,
887
- transform: Te,
888
- save: Me,
889
- input: Ue,
890
- vision: Ee,
891
- text: Oe
892
- }, Re = {
946
+ }), _e = {
947
+ generator: Re,
948
+ transform: Fe,
949
+ save: Ve,
950
+ input: Ge,
951
+ vision: qe,
952
+ text: Ke
953
+ }, He = {
893
954
  type: "smoothstep",
894
955
  animated: !1,
895
956
  markerEnd: {
896
- type: be.ArrowClosed,
957
+ type: ye.ArrowClosed,
897
958
  color: "#64748b",
898
959
  width: 20,
899
960
  height: 20
@@ -903,142 +964,145 @@ const je = T(function({
903
964
  strokeWidth: 2
904
965
  }
905
966
  };
906
- function Ge() {
907
- const r = f((h) => h.nodes), s = f((h) => h.edges), t = f((h) => h.setNodes), o = f((h) => h.setEdges), n = f((h) => h.addEdge), i = f((h) => h.setSelectedNode), l = C(
908
- (h) => {
909
- const { source: b, target: x } = h;
910
- if (!b || !x) return !1;
911
- const g = r.find((y) => y.id === b), w = r.find((y) => y.id === x);
912
- return !(!g || !w || g.type === "save" || w.type === "generator" || w.type === "input" || s.find((y) => y.target === x) || b === x);
967
+ function Qe() {
968
+ const r = x((f) => f.nodes), i = x((f) => f.edges), t = x((f) => f.setNodes), a = x((f) => f.setEdges), s = x((f) => f.addEdge), d = x((f) => f.setSelectedNode), m = C(
969
+ (f) => {
970
+ const { source: b, target: k } = f;
971
+ if (!b || !k) return !1;
972
+ const g = r.find((h) => h.id === b), v = r.find((h) => h.id === k);
973
+ return !(!g || !v || g.type === "save" || v.type === "generator" || v.type === "input" || i.find((h) => h.target === k) || b === k);
913
974
  },
914
- [r, s]
915
- ), a = C(
916
- (h) => {
917
- t(he(h, r));
975
+ [r, i]
976
+ ), o = C(
977
+ (f) => {
978
+ t(we(f, r));
918
979
  },
919
980
  [r, t]
920
- ), c = C(
921
- (h) => {
922
- o(fe(h, s));
981
+ ), n = C(
982
+ (f) => {
983
+ a(ve(f, i));
923
984
  },
924
- [s, o]
985
+ [i, a]
925
986
  ), u = C(
926
- (h) => {
927
- n(h);
987
+ (f) => {
988
+ s(f);
928
989
  },
929
- [n]
930
- ), d = C(
931
- (h, b) => {
932
- i(b.id);
990
+ [s]
991
+ ), l = C(
992
+ (f, b) => {
993
+ d(b.id);
933
994
  },
934
- [i]
995
+ [d]
935
996
  ), p = C(() => {
936
- i(null);
937
- }, [i]);
938
- return /* @__PURE__ */ e("div", { className: "h-full w-full", children: /* @__PURE__ */ m(
939
- pe,
997
+ d(null);
998
+ }, [d]);
999
+ return /* @__PURE__ */ e("div", { className: "h-full w-full", children: /* @__PURE__ */ c(
1000
+ ke,
940
1001
  {
941
1002
  nodes: r,
942
- edges: s,
943
- onNodesChange: a,
944
- onEdgesChange: c,
1003
+ edges: i,
1004
+ onNodesChange: o,
1005
+ onEdgesChange: n,
945
1006
  onConnect: u,
946
- onNodeClick: d,
1007
+ onNodeClick: l,
947
1008
  onPaneClick: p,
948
- nodeTypes: Be,
949
- defaultEdgeOptions: Re,
950
- isValidConnection: l,
1009
+ nodeTypes: _e,
1010
+ defaultEdgeOptions: He,
1011
+ isValidConnection: m,
1012
+ nodesDraggable: !0,
1013
+ nodesConnectable: !0,
1014
+ elementsSelectable: !0,
951
1015
  proOptions: { hideAttribution: !0 },
952
1016
  fitView: !0,
953
1017
  snapToGrid: !0,
954
1018
  snapGrid: [15, 15],
955
1019
  children: [
956
- /* @__PURE__ */ e(xe, {}),
957
- /* @__PURE__ */ e(ke, {}),
958
- /* @__PURE__ */ e(we, { nodeStrokeWidth: 3, zoomable: !0, pannable: !0 })
1020
+ /* @__PURE__ */ e(Ne, {}),
1021
+ /* @__PURE__ */ e(ze, {}),
1022
+ /* @__PURE__ */ e(Ce, { nodeStrokeWidth: 3, zoomable: !0, pannable: !0 })
959
1023
  ]
960
1024
  }
961
1025
  ) });
962
1026
  }
963
- function Fe({ onSelect: r }) {
964
- const [s, t] = N([]), [o, n] = N(!0), [i, l] = N(null), a = async () => {
1027
+ function Je({ onSelect: r }) {
1028
+ const [i, t] = N([]), [a, s] = N(!0), [d, m] = N(null), o = async () => {
965
1029
  try {
966
- n(!0);
967
- const d = await $e();
968
- t(d), l(null);
969
- } catch (d) {
970
- l(d instanceof Error ? d.message : "Failed to load uploads");
1030
+ s(!0);
1031
+ const l = await Te();
1032
+ t(l), m(null);
1033
+ } catch (l) {
1034
+ m(l instanceof Error ? l.message : "Failed to load uploads");
971
1035
  } finally {
972
- n(!1);
1036
+ s(!1);
973
1037
  }
974
1038
  };
975
- $(() => {
976
- a();
1039
+ M(() => {
1040
+ o();
977
1041
  }, []);
978
- const c = async (d, p) => {
1042
+ const n = async (l, p) => {
979
1043
  if (p.stopPropagation(), !!confirm("Delete this upload?"))
980
1044
  try {
981
- await De(d), t((h) => h.filter((b) => b.id !== d));
982
- } catch (h) {
983
- console.error("Failed to delete:", h);
1045
+ await Ue(l), t((f) => f.filter((b) => b.id !== l));
1046
+ } catch (f) {
1047
+ console.error("Failed to delete:", f);
984
1048
  }
985
- }, u = (d) => d < 1024 ? `${d} B` : d < 1024 * 1024 ? `${(d / 1024).toFixed(1)} KB` : `${(d / (1024 * 1024)).toFixed(1)} MB`;
986
- return o ? /* @__PURE__ */ e("div", { className: "p-4 text-center text-gray-500 dark:text-zinc-400", children: "Loading uploads..." }) : i ? /* @__PURE__ */ m("div", { className: "p-4 text-center text-red-500 dark:text-red-400", children: [
987
- i,
1049
+ }, u = (l) => l < 1024 ? `${l} B` : l < 1024 * 1024 ? `${(l / 1024).toFixed(1)} KB` : `${(l / (1024 * 1024)).toFixed(1)} MB`;
1050
+ return a ? /* @__PURE__ */ e("div", { className: "p-4 text-center text-gray-500 dark:text-zinc-400", children: "Loading uploads..." }) : d ? /* @__PURE__ */ c("div", { className: "p-4 text-center text-red-500 dark:text-red-400", children: [
1051
+ d,
988
1052
  /* @__PURE__ */ e(
989
1053
  "button",
990
1054
  {
991
- onClick: a,
1055
+ onClick: o,
992
1056
  className: "ml-2 text-teal-500 dark:text-teal-400 hover:underline",
993
1057
  children: "Retry"
994
1058
  }
995
1059
  )
996
- ] }) : s.length === 0 ? /* @__PURE__ */ e("div", { className: "p-4 text-center text-gray-500 dark:text-zinc-400", children: "No uploads yet. Drag an image onto an Input node to upload." }) : /* @__PURE__ */ e("div", { className: "p-2", children: /* @__PURE__ */ e("div", { className: "grid grid-cols-2 gap-2", children: s.map((d) => /* @__PURE__ */ m(
1060
+ ] }) : i.length === 0 ? /* @__PURE__ */ e("div", { className: "p-4 text-center text-gray-500 dark:text-zinc-400", children: "No uploads yet. Drag an image onto an Input node to upload." }) : /* @__PURE__ */ e("div", { className: "p-2", children: /* @__PURE__ */ e("div", { className: "grid grid-cols-2 gap-2", children: i.map((l) => /* @__PURE__ */ c(
997
1061
  "div",
998
1062
  {
999
1063
  className: "relative group rounded border border-gray-200 dark:border-zinc-700 overflow-hidden cursor-pointer hover:border-amber-400 dark:hover:border-amber-500 transition-colors",
1000
- onClick: () => r == null ? void 0 : r(d),
1064
+ onClick: () => r == null ? void 0 : r(l),
1001
1065
  children: [
1002
1066
  /* @__PURE__ */ e(
1003
1067
  "img",
1004
1068
  {
1005
- src: se(d.id),
1006
- alt: d.filename,
1069
+ src: de(l.id),
1070
+ alt: l.filename,
1007
1071
  className: "w-full h-20 object-cover"
1008
1072
  }
1009
1073
  ),
1010
1074
  /* @__PURE__ */ e("div", { className: "absolute inset-0 bg-black/50 opacity-0 group-hover:opacity-100 transition-opacity flex items-center justify-center", children: /* @__PURE__ */ e(
1011
1075
  "button",
1012
1076
  {
1013
- onClick: (p) => c(d.id, p),
1077
+ onClick: (p) => n(l.id, p),
1014
1078
  className: "p-1 bg-red-500 rounded text-white text-xs hover:bg-red-600",
1015
1079
  children: "Delete"
1016
1080
  }
1017
1081
  ) }),
1018
- /* @__PURE__ */ e("div", { className: "p-1 text-xs truncate bg-white dark:bg-zinc-800 text-gray-800 dark:text-zinc-200", children: d.filename }),
1019
- /* @__PURE__ */ e("div", { className: "px-1 pb-1 text-xs text-gray-400 dark:text-zinc-500 bg-white dark:bg-zinc-800", children: u(d.size) })
1082
+ /* @__PURE__ */ e("div", { className: "p-1 text-xs truncate bg-white dark:bg-zinc-800 text-gray-800 dark:text-zinc-200", children: l.filename }),
1083
+ /* @__PURE__ */ e("div", { className: "px-1 pb-1 text-xs text-gray-400 dark:text-zinc-500 bg-white dark:bg-zinc-800", children: u(l.size) })
1020
1084
  ]
1021
1085
  },
1022
- d.id
1086
+ l.id
1023
1087
  )) }) });
1024
1088
  }
1025
- function Ve() {
1026
- const r = f((g) => g.setGenerators), s = f((g) => g.setTransforms), t = f((g) => g.generators), o = f((g) => g.transforms), n = f((g) => g.addNode), [i, l] = N(!1), { data: a } = q({
1089
+ function Ye() {
1090
+ const r = x((g) => g.setGenerators), i = x((g) => g.setTransforms), t = x((g) => g.generators), a = x((g) => g.transforms), s = x((g) => g.addNode), [d, m] = N(!1), { data: o } = _({
1027
1091
  queryKey: ["generators"],
1028
- queryFn: ze
1029
- }), { data: c } = q({
1092
+ queryFn: We
1093
+ }), { data: n } = _({
1030
1094
  queryKey: ["transforms"],
1031
- queryFn: Ce
1095
+ queryFn: Ae
1032
1096
  });
1033
- $(() => {
1034
- a && r(a);
1035
- }, [a, r]), $(() => {
1036
- c && s(c);
1037
- }, [c, s]);
1038
- const u = (g, w) => {
1039
- g.dataTransfer.setData("application/json", JSON.stringify(w)), g.dataTransfer.effectAllowed = "move";
1040
- }, d = (g) => {
1041
- n(g, { x: 250, y: 150 + Math.random() * 100 });
1097
+ M(() => {
1098
+ o && r(o);
1099
+ }, [o, r]), M(() => {
1100
+ n && i(n);
1101
+ }, [n, i]);
1102
+ const u = (g, v) => {
1103
+ g.dataTransfer.setData("application/json", JSON.stringify(v)), g.dataTransfer.effectAllowed = "move";
1104
+ }, l = (g) => {
1105
+ s(g, { x: 250, y: 150 + Math.random() * 100 });
1042
1106
  }, p = {
1043
1107
  id: "input:upload",
1044
1108
  type: "input",
@@ -1050,7 +1114,7 @@ function Ve() {
1050
1114
  type: "object",
1051
1115
  properties: {}
1052
1116
  }
1053
- }, h = {
1117
+ }, f = {
1054
1118
  id: "save:filesystem",
1055
1119
  type: "save",
1056
1120
  name: "save",
@@ -1064,45 +1128,49 @@ function Ve() {
1064
1128
  type: "string",
1065
1129
  title: "Destination",
1066
1130
  default: "./output/image.png"
1131
+ },
1132
+ provider: {
1133
+ type: "string",
1134
+ default: "filesystem"
1067
1135
  }
1068
1136
  }
1069
1137
  }
1070
1138
  }, b = t.reduce(
1071
- (g, w) => {
1072
- const k = w.category || "Other";
1073
- return g[k] || (g[k] = []), g[k].push(w), g;
1139
+ (g, v) => {
1140
+ const w = v.category || "Other";
1141
+ return g[w] || (g[w] = []), g[w].push(v), g;
1074
1142
  },
1075
1143
  {}
1076
- ), x = o.reduce(
1077
- (g, w) => {
1078
- const k = w.category || "Other";
1079
- return g[k] || (g[k] = []), g[k].push(w), g;
1144
+ ), k = a.reduce(
1145
+ (g, v) => {
1146
+ const w = v.category || "Other";
1147
+ return g[w] || (g[w] = []), g[w].push(v), g;
1080
1148
  },
1081
1149
  {}
1082
1150
  );
1083
- return /* @__PURE__ */ e("div", { className: "w-64 bg-gray-50 dark:bg-zinc-800 border-r border-gray-200 dark:border-zinc-700 overflow-y-auto", children: /* @__PURE__ */ m("div", { className: "p-4", children: [
1151
+ return /* @__PURE__ */ e("div", { className: "w-64 bg-gray-50 dark:bg-zinc-800 border-r border-gray-200 dark:border-zinc-700 overflow-y-auto", children: /* @__PURE__ */ c("div", { className: "p-4", children: [
1084
1152
  /* @__PURE__ */ e("h2", { className: "text-lg font-semibold text-gray-800 dark:text-white mb-4", children: "Nodes" }),
1085
- /* @__PURE__ */ m("div", { className: "mb-6", children: [
1086
- /* @__PURE__ */ m("div", { className: "flex items-center justify-between mb-2", children: [
1153
+ /* @__PURE__ */ c("div", { className: "mb-6", children: [
1154
+ /* @__PURE__ */ c("div", { className: "flex items-center justify-between mb-2", children: [
1087
1155
  /* @__PURE__ */ e("h3", { className: "text-sm font-medium text-amber-600 dark:text-amber-400 uppercase tracking-wide", children: "Input" }),
1088
- /* @__PURE__ */ m(
1156
+ /* @__PURE__ */ c(
1089
1157
  "button",
1090
1158
  {
1091
- onClick: () => l(!i),
1159
+ onClick: () => m(!d),
1092
1160
  className: "text-xs text-amber-600 dark:text-amber-400 hover:text-amber-700 dark:hover:text-amber-300",
1093
1161
  children: [
1094
- i ? "Hide" : "Browse",
1162
+ d ? "Hide" : "Browse",
1095
1163
  " Uploads"
1096
1164
  ]
1097
1165
  }
1098
1166
  )
1099
1167
  ] }),
1100
- /* @__PURE__ */ m(
1168
+ /* @__PURE__ */ c(
1101
1169
  "div",
1102
1170
  {
1103
1171
  draggable: !0,
1104
1172
  onDragStart: (g) => u(g, p),
1105
- onDoubleClick: () => d(p),
1173
+ onDoubleClick: () => l(p),
1106
1174
  className: "px-3 py-2 bg-amber-50 dark:bg-amber-900/30 border border-amber-200 dark:border-amber-700 rounded cursor-grab active:cursor-grabbing hover:bg-amber-100 dark:hover:bg-amber-900/50 transition-colors",
1107
1175
  children: [
1108
1176
  /* @__PURE__ */ e("div", { className: "text-sm font-medium text-amber-700 dark:text-amber-300", children: "Upload Image" }),
@@ -1110,56 +1178,56 @@ function Ve() {
1110
1178
  ]
1111
1179
  }
1112
1180
  ),
1113
- i && /* @__PURE__ */ e("div", { className: "mt-2 border border-amber-200 dark:border-amber-700 rounded bg-white dark:bg-zinc-900 max-h-64 overflow-y-auto", children: /* @__PURE__ */ e(Fe, {}) })
1181
+ d && /* @__PURE__ */ e("div", { className: "mt-2 border border-amber-200 dark:border-amber-700 rounded bg-white dark:bg-zinc-900 max-h-64 overflow-y-auto", children: /* @__PURE__ */ e(Je, {}) })
1114
1182
  ] }),
1115
- /* @__PURE__ */ m("div", { className: "mb-6", children: [
1183
+ /* @__PURE__ */ c("div", { className: "mb-6", children: [
1116
1184
  /* @__PURE__ */ e("h3", { className: "text-sm font-medium text-blue-600 dark:text-blue-400 uppercase tracking-wide mb-2", children: "Generators" }),
1117
- Object.entries(b).map(([g, w]) => /* @__PURE__ */ m("div", { className: "mb-3", children: [
1185
+ Object.entries(b).map(([g, v]) => /* @__PURE__ */ c("div", { className: "mb-3", children: [
1118
1186
  /* @__PURE__ */ e("div", { className: "text-xs text-gray-500 dark:text-zinc-400 mb-1", children: g }),
1119
- w.map((k) => /* @__PURE__ */ m(
1187
+ v.map((w) => /* @__PURE__ */ c(
1120
1188
  "div",
1121
1189
  {
1122
1190
  draggable: !0,
1123
- onDragStart: (y) => u(y, k),
1124
- onDoubleClick: () => d(k),
1191
+ onDragStart: (h) => u(h, w),
1192
+ onDoubleClick: () => l(w),
1125
1193
  className: "px-3 py-2 bg-blue-50 dark:bg-blue-900/30 border border-blue-200 dark:border-blue-700 rounded mb-1 cursor-grab active:cursor-grabbing hover:bg-blue-100 dark:hover:bg-blue-900/50 transition-colors",
1126
1194
  children: [
1127
- /* @__PURE__ */ e("div", { className: "text-sm font-medium text-blue-700 dark:text-blue-300", children: k.label }),
1128
- k.description && /* @__PURE__ */ e("div", { className: "text-xs text-gray-500 dark:text-zinc-400 truncate", children: k.description })
1195
+ /* @__PURE__ */ e("div", { className: "text-sm font-medium text-blue-700 dark:text-blue-300", children: w.label }),
1196
+ w.description && /* @__PURE__ */ e("div", { className: "text-xs text-gray-500 dark:text-zinc-400 truncate", children: w.description })
1129
1197
  ]
1130
1198
  },
1131
- k.id
1199
+ w.id
1132
1200
  ))
1133
1201
  ] }, g))
1134
1202
  ] }),
1135
- /* @__PURE__ */ m("div", { className: "mb-6", children: [
1203
+ /* @__PURE__ */ c("div", { className: "mb-6", children: [
1136
1204
  /* @__PURE__ */ e("h3", { className: "text-sm font-medium text-teal-600 dark:text-teal-400 uppercase tracking-wide mb-2", children: "Transforms" }),
1137
- Object.entries(x).map(([g, w]) => /* @__PURE__ */ m("div", { className: "mb-3", children: [
1205
+ Object.entries(k).map(([g, v]) => /* @__PURE__ */ c("div", { className: "mb-3", children: [
1138
1206
  /* @__PURE__ */ e("div", { className: "text-xs text-gray-500 dark:text-zinc-400 mb-1", children: g }),
1139
- w.map((k) => /* @__PURE__ */ m(
1207
+ v.map((w) => /* @__PURE__ */ c(
1140
1208
  "div",
1141
1209
  {
1142
1210
  draggable: !0,
1143
- onDragStart: (y) => u(y, k),
1144
- onDoubleClick: () => d(k),
1211
+ onDragStart: (h) => u(h, w),
1212
+ onDoubleClick: () => l(w),
1145
1213
  className: "px-3 py-2 bg-teal-50 dark:bg-teal-900/30 border border-teal-200 dark:border-teal-700 rounded mb-1 cursor-grab active:cursor-grabbing hover:bg-teal-100 dark:hover:bg-teal-900/50 transition-colors",
1146
1214
  children: [
1147
- /* @__PURE__ */ e("div", { className: "text-sm font-medium text-teal-700 dark:text-teal-300", children: k.label }),
1148
- k.description && /* @__PURE__ */ e("div", { className: "text-xs text-gray-500 dark:text-zinc-400 truncate", children: k.description })
1215
+ /* @__PURE__ */ e("div", { className: "text-sm font-medium text-teal-700 dark:text-teal-300", children: w.label }),
1216
+ w.description && /* @__PURE__ */ e("div", { className: "text-xs text-gray-500 dark:text-zinc-400 truncate", children: w.description })
1149
1217
  ]
1150
1218
  },
1151
- k.id
1219
+ w.id
1152
1220
  ))
1153
1221
  ] }, g))
1154
1222
  ] }),
1155
- /* @__PURE__ */ m("div", { className: "mb-6", children: [
1223
+ /* @__PURE__ */ c("div", { className: "mb-6", children: [
1156
1224
  /* @__PURE__ */ e("h3", { className: "text-sm font-medium text-green-600 dark:text-green-400 uppercase tracking-wide mb-2", children: "Output" }),
1157
- /* @__PURE__ */ m(
1225
+ /* @__PURE__ */ c(
1158
1226
  "div",
1159
1227
  {
1160
1228
  draggable: !0,
1161
- onDragStart: (g) => u(g, h),
1162
- onDoubleClick: () => d(h),
1229
+ onDragStart: (g) => u(g, f),
1230
+ onDoubleClick: () => l(f),
1163
1231
  className: "px-3 py-2 bg-green-50 dark:bg-green-900/30 border border-green-200 dark:border-green-700 rounded cursor-grab active:cursor-grabbing hover:bg-green-100 dark:hover:bg-green-900/50 transition-colors",
1164
1232
  children: [
1165
1233
  /* @__PURE__ */ e("div", { className: "text-sm font-medium text-green-700 dark:text-green-300", children: "Save" }),
@@ -1170,120 +1238,120 @@ function Ve() {
1170
1238
  ] })
1171
1239
  ] }) });
1172
1240
  }
1173
- function Ke() {
1174
- var p, h;
1175
- const r = f((b) => b.selectedNodeId), s = f((b) => b.nodes), t = f((b) => b.generators), o = f((b) => b.transforms), n = f((b) => b.updateNodeData), i = f((b) => b.deleteNode), l = s.find((b) => b.id === r);
1176
- if (!l)
1241
+ function Xe() {
1242
+ var p, f;
1243
+ const r = x((b) => b.selectedNodeId), i = x((b) => b.nodes), t = x((b) => b.generators), a = x((b) => b.transforms), s = x((b) => b.updateNodeData), d = x((b) => b.deleteNode), m = i.find((b) => b.id === r);
1244
+ if (!m)
1177
1245
  return /* @__PURE__ */ e("div", { className: "w-80 bg-gray-50 dark:bg-zinc-800 border-l border-gray-200 dark:border-zinc-700 p-4", children: /* @__PURE__ */ e("div", { className: "text-gray-500 dark:text-zinc-400 text-sm", children: "Select a node to edit its properties" }) });
1178
- let a, c = "";
1179
- if (l.type === "generator") {
1180
- const b = l.data, x = t.find((g) => g.name === b.generatorName);
1181
- a = (p = x == null ? void 0 : x.params) == null ? void 0 : p.properties, c = (x == null ? void 0 : x.label) || b.generatorName;
1182
- } else if (l.type === "transform") {
1183
- const b = l.data, x = o.find((g) => g.name === b.operation);
1184
- a = (h = x == null ? void 0 : x.params) == null ? void 0 : h.properties, c = (x == null ? void 0 : x.label) || b.operation;
1185
- } else l.type === "save" && (c = "Save", a = {
1246
+ let o, n = "";
1247
+ if (m.type === "generator") {
1248
+ const b = m.data, k = t.find((g) => g.name === b.generatorName);
1249
+ o = (p = k == null ? void 0 : k.params) == null ? void 0 : p.properties, n = (k == null ? void 0 : k.label) || b.generatorName;
1250
+ } else if (m.type === "transform") {
1251
+ const b = m.data, k = a.find((g) => g.name === b.operation);
1252
+ o = (f = k == null ? void 0 : k.params) == null ? void 0 : f.properties, n = (k == null ? void 0 : k.label) || b.operation;
1253
+ } else m.type === "save" && (n = "Save", o = {
1186
1254
  destination: {
1187
1255
  type: "string",
1188
1256
  title: "Destination",
1189
1257
  description: "File path to save the image"
1190
1258
  }
1191
1259
  });
1192
- const u = (b, x) => {
1193
- if (l.type === "generator") {
1194
- const g = l.data;
1195
- n(l.id, {
1196
- params: { ...g.params, [b]: x }
1260
+ const u = (b, k) => {
1261
+ if (m.type === "generator") {
1262
+ const g = m.data;
1263
+ s(m.id, {
1264
+ params: { ...g.params, [b]: k }
1197
1265
  });
1198
- } else if (l.type === "transform") {
1199
- const g = l.data;
1200
- n(l.id, {
1201
- params: { ...g.params, [b]: x }
1266
+ } else if (m.type === "transform") {
1267
+ const g = m.data;
1268
+ s(m.id, {
1269
+ params: { ...g.params, [b]: k }
1202
1270
  });
1203
- } else l.type === "save" && n(l.id, { [b]: x });
1204
- }, d = (b) => {
1205
- if (l.type === "generator")
1206
- return l.data.params[b];
1207
- if (l.type === "transform")
1208
- return l.data.params[b];
1209
- if (l.type === "save")
1210
- return l.data[b];
1271
+ } else m.type === "save" && s(m.id, { [b]: k });
1272
+ }, l = (b) => {
1273
+ if (m.type === "generator")
1274
+ return m.data.params[b];
1275
+ if (m.type === "transform")
1276
+ return m.data.params[b];
1277
+ if (m.type === "save")
1278
+ return m.data[b];
1211
1279
  };
1212
- return /* @__PURE__ */ e("div", { className: "w-80 bg-gray-50 dark:bg-zinc-800 border-l border-gray-200 dark:border-zinc-700 overflow-y-auto", children: /* @__PURE__ */ m("div", { className: "p-4", children: [
1213
- /* @__PURE__ */ m("div", { className: "flex items-center justify-between mb-4", children: [
1214
- /* @__PURE__ */ e("h2", { className: "text-lg font-semibold text-gray-800 dark:text-white", children: c }),
1280
+ return /* @__PURE__ */ e("div", { className: "w-80 bg-gray-50 dark:bg-zinc-800 border-l border-gray-200 dark:border-zinc-700 overflow-y-auto", children: /* @__PURE__ */ c("div", { className: "p-4", children: [
1281
+ /* @__PURE__ */ c("div", { className: "flex items-center justify-between mb-4", children: [
1282
+ /* @__PURE__ */ e("h2", { className: "text-lg font-semibold text-gray-800 dark:text-white", children: n }),
1215
1283
  /* @__PURE__ */ e(
1216
1284
  "button",
1217
1285
  {
1218
- onClick: () => i(l.id),
1286
+ onClick: () => d(m.id),
1219
1287
  className: "text-red-500 hover:text-red-700 dark:text-red-400 dark:hover:text-red-300 text-sm",
1220
1288
  children: "Delete"
1221
1289
  }
1222
1290
  )
1223
1291
  ] }),
1224
- /* @__PURE__ */ e("div", { className: "space-y-4", children: a && Object.entries(a).map(([b, x]) => /* @__PURE__ */ e(
1225
- qe,
1292
+ /* @__PURE__ */ e("div", { className: "space-y-4", children: o && Object.entries(o).map(([b, k]) => /* @__PURE__ */ e(
1293
+ Ze,
1226
1294
  {
1227
1295
  name: b,
1228
- field: x,
1229
- value: d(b),
1296
+ field: k,
1297
+ value: l(b),
1230
1298
  onChange: (g) => u(b, g)
1231
1299
  },
1232
1300
  b
1233
1301
  )) })
1234
1302
  ] }) });
1235
1303
  }
1236
- function qe({ name: r, field: s, value: t, onChange: o }) {
1237
- const n = s.title || r, i = "w-full px-3 py-2 border border-gray-300 dark:border-zinc-600 rounded-md shadow-sm focus:ring-teal-500 focus:border-teal-500 bg-white dark:bg-zinc-900 text-gray-900 dark:text-zinc-100";
1238
- return s.enum ? /* @__PURE__ */ m("div", { children: [
1239
- /* @__PURE__ */ e("label", { className: "block text-sm font-medium text-gray-700 dark:text-zinc-300 mb-1", children: n }),
1240
- /* @__PURE__ */ m(
1304
+ function Ze({ name: r, field: i, value: t, onChange: a }) {
1305
+ const s = i.title || r, d = "w-full px-3 py-2 border border-gray-300 dark:border-zinc-600 rounded-md shadow-sm focus:ring-teal-500 focus:border-teal-500 bg-white dark:bg-zinc-900 text-gray-900 dark:text-zinc-100";
1306
+ return i.enum ? /* @__PURE__ */ c("div", { children: [
1307
+ /* @__PURE__ */ e("label", { className: "block text-sm font-medium text-gray-700 dark:text-zinc-300 mb-1", children: s }),
1308
+ /* @__PURE__ */ c(
1241
1309
  "select",
1242
1310
  {
1243
1311
  value: String(t || ""),
1244
- onChange: (l) => o(l.target.value),
1245
- className: i,
1312
+ onChange: (m) => a(m.target.value),
1313
+ className: d,
1246
1314
  children: [
1247
1315
  /* @__PURE__ */ e("option", { value: "", children: "Select..." }),
1248
- s.enum.map((l) => /* @__PURE__ */ e("option", { value: l, children: l }, l))
1316
+ i.enum.map((m) => /* @__PURE__ */ e("option", { value: m, children: m }, m))
1249
1317
  ]
1250
1318
  }
1251
1319
  ),
1252
- s.description && /* @__PURE__ */ e("p", { className: "mt-1 text-xs text-gray-500 dark:text-zinc-400", children: s.description })
1253
- ] }) : s.type === "number" ? /* @__PURE__ */ m("div", { children: [
1254
- /* @__PURE__ */ e("label", { className: "block text-sm font-medium text-gray-700 dark:text-zinc-300 mb-1", children: n }),
1320
+ i.description && /* @__PURE__ */ e("p", { className: "mt-1 text-xs text-gray-500 dark:text-zinc-400", children: i.description })
1321
+ ] }) : i.type === "number" ? /* @__PURE__ */ c("div", { children: [
1322
+ /* @__PURE__ */ e("label", { className: "block text-sm font-medium text-gray-700 dark:text-zinc-300 mb-1", children: s }),
1255
1323
  /* @__PURE__ */ e(
1256
1324
  "input",
1257
1325
  {
1258
1326
  type: "number",
1259
1327
  value: t !== void 0 ? Number(t) : "",
1260
- onChange: (l) => o(Number(l.target.value)),
1261
- min: s.minimum,
1262
- max: s.maximum,
1263
- className: i
1328
+ onChange: (m) => a(Number(m.target.value)),
1329
+ min: i.minimum,
1330
+ max: i.maximum,
1331
+ className: d
1264
1332
  }
1265
1333
  ),
1266
- s.description && /* @__PURE__ */ e("p", { className: "mt-1 text-xs text-gray-500 dark:text-zinc-400", children: s.description })
1267
- ] }) : s.type === "boolean" ? /* @__PURE__ */ m("div", { className: "flex items-center gap-2", children: [
1334
+ i.description && /* @__PURE__ */ e("p", { className: "mt-1 text-xs text-gray-500 dark:text-zinc-400", children: i.description })
1335
+ ] }) : i.type === "boolean" ? /* @__PURE__ */ c("div", { className: "flex items-center gap-2", children: [
1268
1336
  /* @__PURE__ */ e(
1269
1337
  "input",
1270
1338
  {
1271
1339
  type: "checkbox",
1272
1340
  checked: !!t,
1273
- onChange: (l) => o(l.target.checked),
1341
+ onChange: (m) => a(m.target.checked),
1274
1342
  className: "h-4 w-4 text-teal-600 focus:ring-teal-500 border-gray-300 dark:border-zinc-600 rounded bg-white dark:bg-zinc-900"
1275
1343
  }
1276
1344
  ),
1277
- /* @__PURE__ */ e("label", { className: "text-sm font-medium text-gray-700 dark:text-zinc-300", children: n })
1278
- ] }) : r.toLowerCase().includes("color") && typeof t == "string" && t.startsWith("#") ? /* @__PURE__ */ m("div", { children: [
1279
- /* @__PURE__ */ e("label", { className: "block text-sm font-medium text-gray-700 dark:text-zinc-300 mb-1", children: n }),
1280
- /* @__PURE__ */ m("div", { className: "flex gap-2", children: [
1345
+ /* @__PURE__ */ e("label", { className: "text-sm font-medium text-gray-700 dark:text-zinc-300", children: s })
1346
+ ] }) : r.toLowerCase().includes("color") && typeof t == "string" && t.startsWith("#") ? /* @__PURE__ */ c("div", { children: [
1347
+ /* @__PURE__ */ e("label", { className: "block text-sm font-medium text-gray-700 dark:text-zinc-300 mb-1", children: s }),
1348
+ /* @__PURE__ */ c("div", { className: "flex gap-2", children: [
1281
1349
  /* @__PURE__ */ e(
1282
1350
  "input",
1283
1351
  {
1284
1352
  type: "color",
1285
1353
  value: String(t || "#000000"),
1286
- onChange: (l) => o(l.target.value),
1354
+ onChange: (m) => a(m.target.value),
1287
1355
  className: "h-10 w-14 p-1 border border-gray-300 dark:border-zinc-600 rounded"
1288
1356
  }
1289
1357
  ),
@@ -1292,142 +1360,142 @@ function qe({ name: r, field: s, value: t, onChange: o }) {
1292
1360
  {
1293
1361
  type: "text",
1294
1362
  value: String(t || ""),
1295
- onChange: (l) => o(l.target.value),
1296
- className: i + " flex-1"
1363
+ onChange: (m) => a(m.target.value),
1364
+ className: d + " flex-1"
1297
1365
  }
1298
1366
  )
1299
1367
  ] })
1300
- ] }) : s.type === "object" ? /* @__PURE__ */ m("div", { children: [
1301
- /* @__PURE__ */ e("label", { className: "block text-sm font-medium text-gray-700 dark:text-zinc-300 mb-1", children: n }),
1368
+ ] }) : i.type === "object" ? /* @__PURE__ */ c("div", { children: [
1369
+ /* @__PURE__ */ e("label", { className: "block text-sm font-medium text-gray-700 dark:text-zinc-300 mb-1", children: s }),
1302
1370
  /* @__PURE__ */ e(
1303
1371
  "textarea",
1304
1372
  {
1305
1373
  value: t ? JSON.stringify(t, null, 2) : "{}",
1306
- onChange: (l) => {
1374
+ onChange: (m) => {
1307
1375
  try {
1308
- o(JSON.parse(l.target.value));
1376
+ a(JSON.parse(m.target.value));
1309
1377
  } catch {
1310
1378
  }
1311
1379
  },
1312
1380
  rows: 4,
1313
- className: i + " font-mono text-xs"
1381
+ className: d + " font-mono text-xs"
1314
1382
  }
1315
1383
  ),
1316
- s.description && /* @__PURE__ */ e("p", { className: "mt-1 text-xs text-gray-500 dark:text-zinc-400", children: s.description })
1317
- ] }) : /* @__PURE__ */ m("div", { children: [
1318
- /* @__PURE__ */ e("label", { className: "block text-sm font-medium text-gray-700 dark:text-zinc-300 mb-1", children: n }),
1384
+ i.description && /* @__PURE__ */ e("p", { className: "mt-1 text-xs text-gray-500 dark:text-zinc-400", children: i.description })
1385
+ ] }) : /* @__PURE__ */ c("div", { children: [
1386
+ /* @__PURE__ */ e("label", { className: "block text-sm font-medium text-gray-700 dark:text-zinc-300 mb-1", children: s }),
1319
1387
  r === "prompt" || r === "code" || r === "text" ? /* @__PURE__ */ e(
1320
1388
  "textarea",
1321
1389
  {
1322
1390
  value: String(t || ""),
1323
- onChange: (l) => o(l.target.value),
1391
+ onChange: (m) => a(m.target.value),
1324
1392
  rows: 3,
1325
- className: i
1393
+ className: d
1326
1394
  }
1327
1395
  ) : /* @__PURE__ */ e(
1328
1396
  "input",
1329
1397
  {
1330
1398
  type: "text",
1331
1399
  value: String(t || ""),
1332
- onChange: (l) => o(l.target.value),
1333
- className: i
1400
+ onChange: (m) => a(m.target.value),
1401
+ className: d
1334
1402
  }
1335
1403
  ),
1336
- s.description && /* @__PURE__ */ e("p", { className: "mt-1 text-xs text-gray-500 dark:text-zinc-400", children: s.description })
1404
+ i.description && /* @__PURE__ */ e("p", { className: "mt-1 text-xs text-gray-500 dark:text-zinc-400", children: i.description })
1337
1405
  ] });
1338
1406
  }
1339
- function _e(r, s) {
1340
- const t = new Map(r.map((a) => [a.id, a])), o = /* @__PURE__ */ new Map(), n = /* @__PURE__ */ new Map();
1341
- for (const a of r)
1342
- o.set(a.id, 0), n.set(a.id, []);
1343
- for (const a of s) {
1344
- const c = n.get(a.source) || [];
1345
- c.push(a.target), n.set(a.source, c), o.set(a.target, (o.get(a.target) || 0) + 1);
1407
+ function et(r, i) {
1408
+ const t = new Map(r.map((o) => [o.id, o])), a = /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Map();
1409
+ for (const o of r)
1410
+ a.set(o.id, 0), s.set(o.id, []);
1411
+ for (const o of i) {
1412
+ const n = s.get(o.source) || [];
1413
+ n.push(o.target), s.set(o.source, n), a.set(o.target, (a.get(o.target) || 0) + 1);
1346
1414
  }
1347
- const i = [];
1348
- for (const [a, c] of o)
1349
- c === 0 && i.push(a);
1350
- const l = [];
1351
- for (; i.length > 0; ) {
1352
- const a = i.shift(), c = t.get(a);
1353
- c && l.push(c);
1354
- const u = n.get(a) || [];
1355
- for (const d of u) {
1356
- const p = (o.get(d) || 1) - 1;
1357
- o.set(d, p), p === 0 && i.push(d);
1415
+ const d = [];
1416
+ for (const [o, n] of a)
1417
+ n === 0 && d.push(o);
1418
+ const m = [];
1419
+ for (; d.length > 0; ) {
1420
+ const o = d.shift(), n = t.get(o);
1421
+ n && m.push(n);
1422
+ const u = s.get(o) || [];
1423
+ for (const l of u) {
1424
+ const p = (a.get(l) || 1) - 1;
1425
+ a.set(l, p), p === 0 && d.push(l);
1358
1426
  }
1359
1427
  }
1360
- return l;
1428
+ return m;
1361
1429
  }
1362
- function He(r) {
1363
- const s = r.type || "node", t = r.id.replace(/[^a-zA-Z0-9]/g, "_");
1364
- return `${s}_${t}`;
1430
+ function tt(r) {
1431
+ const i = r.type || "node", t = r.id.replace(/[^a-zA-Z0-9]/g, "_");
1432
+ return `${i}_${t}`;
1365
1433
  }
1366
- function U(r) {
1434
+ function E(r) {
1367
1435
  return typeof r == "string" ? r.includes(`
1368
1436
  `) ? "`" + r.replace(/`/g, "\\`").replace(/\$/g, "\\$") + "`" : JSON.stringify(r) : JSON.stringify(r, null, 2);
1369
1437
  }
1370
- function Je(r, s, t) {
1371
- const o = t.get(r.id), n = [], i = s.find((a) => a.target === r.id), l = i ? t.get(i.source) : null;
1438
+ function rt(r, i, t) {
1439
+ const a = t.get(r.id), s = [], d = i.find((o) => o.target === r.id), m = d ? t.get(d.source) : null;
1372
1440
  switch (r.type) {
1373
1441
  case "generator": {
1374
- const a = r.data;
1375
- n.push(a.generatorName);
1376
- const c = a.params || {}, u = Object.entries(c).filter(([, d]) => d !== void 0 && d !== "").map(([d, p]) => ` ${d}: ${U(p)}`).join(`,
1442
+ const o = r.data;
1443
+ s.push(o.generatorName);
1444
+ const n = o.params || {}, u = Object.entries(n).filter(([, l]) => l !== void 0 && l !== "").map(([l, p]) => ` ${l}: ${E(p)}`).join(`,
1377
1445
  `);
1378
1446
  return {
1379
- code: `// Generate image using ${a.generatorName}
1380
- const ${o} = await ${a.generatorName}({
1447
+ code: `// Generate image using ${o.generatorName}
1448
+ const ${a} = await ${o.generatorName}({
1381
1449
  ${u}
1382
1450
  });`,
1383
- imports: n
1451
+ imports: s
1384
1452
  };
1385
1453
  }
1386
1454
  case "input":
1387
1455
  return {
1388
1456
  code: `// Load input image
1389
- const ${o} = await flo.loadImage("./input.png");`,
1457
+ const ${a} = await flo.loadImage("./input.png");`,
1390
1458
  imports: []
1391
1459
  };
1392
1460
  case "transform": {
1393
- const a = r.data, c = a.params || {}, u = Object.entries(c).filter(([, p]) => p !== void 0 && p !== "").map(([p, h]) => `${p}: ${U(h)}`).join(", "), d = l || "image";
1461
+ const o = r.data, n = o.params || {}, u = Object.entries(n).filter(([, p]) => p !== void 0 && p !== "").map(([p, f]) => `${p}: ${E(f)}`).join(", "), l = m || "image";
1394
1462
  return {
1395
- code: `// Apply ${a.operation} transform
1396
- const ${o} = await flo.transform(${d}, "${a.operation}"${u ? `, { ${u} }` : ""});`,
1463
+ code: `// Apply ${o.operation} transform
1464
+ const ${a} = await flo.transform(${l}, "${o.operation}"${u ? `, { ${u} }` : ""});`,
1397
1465
  imports: []
1398
1466
  };
1399
1467
  }
1400
1468
  case "vision": {
1401
- const a = r.data;
1402
- n.push(a.providerName);
1403
- const c = a.params || {}, u = l || "image", d = Object.entries(c).filter(([, p]) => p !== void 0 && p !== "").map(([p, h]) => ` ${p}: ${U(h)}`).join(`,
1469
+ const o = r.data;
1470
+ s.push(o.providerName);
1471
+ const n = o.params || {}, u = m || "image", l = Object.entries(n).filter(([, p]) => p !== void 0 && p !== "").map(([p, f]) => ` ${p}: ${E(f)}`).join(`,
1404
1472
  `);
1405
1473
  return {
1406
- code: `// Analyze image with ${a.providerName}
1407
- const ${o} = await ${a.providerName}.analyze(${u}, {
1408
- ${d}
1474
+ code: `// Analyze image with ${o.providerName}
1475
+ const ${a} = await ${o.providerName}.analyze(${u}, {
1476
+ ${l}
1409
1477
  });`,
1410
- imports: n
1478
+ imports: s
1411
1479
  };
1412
1480
  }
1413
1481
  case "text": {
1414
- const a = r.data;
1415
- n.push(a.providerName);
1416
- const c = a.params || {}, u = Object.entries(c).filter(([, d]) => d !== void 0 && d !== "").map(([d, p]) => ` ${d}: ${U(p)}`).join(`,
1482
+ const o = r.data;
1483
+ s.push(o.providerName);
1484
+ const n = o.params || {}, u = Object.entries(n).filter(([, l]) => l !== void 0 && l !== "").map(([l, p]) => ` ${l}: ${E(p)}`).join(`,
1417
1485
  `);
1418
1486
  return {
1419
- code: `// Generate text with ${a.providerName}
1420
- const ${o} = await ${a.providerName}.generate({
1487
+ code: `// Generate text with ${o.providerName}
1488
+ const ${a} = await ${o.providerName}.generate({
1421
1489
  ${u}
1422
1490
  });`,
1423
- imports: n
1491
+ imports: s
1424
1492
  };
1425
1493
  }
1426
1494
  case "save": {
1427
- const a = r.data;
1495
+ const o = r.data;
1428
1496
  return {
1429
1497
  code: `// Save result
1430
- await flo.save(${l || "result"}, ${U(a.destination)});`,
1498
+ await flo.save(${m || "result"}, ${E(o.destination)});`,
1431
1499
  imports: []
1432
1500
  };
1433
1501
  }
@@ -1438,33 +1506,33 @@ await flo.save(${l || "result"}, ${U(a.destination)});`,
1438
1506
  };
1439
1507
  }
1440
1508
  }
1441
- function Qe(r, s) {
1509
+ function at(r, i) {
1442
1510
  if (r.length === 0)
1443
1511
  return `// Empty workflow
1444
1512
  // Add nodes to your canvas to generate code`;
1445
- const t = _e(r, s), o = /* @__PURE__ */ new Map();
1513
+ const t = et(r, i), a = /* @__PURE__ */ new Map();
1446
1514
  for (const u of t)
1447
- o.set(u.id, He(u));
1448
- const n = /* @__PURE__ */ new Set(), i = [];
1515
+ a.set(u.id, tt(u));
1516
+ const s = /* @__PURE__ */ new Set(), d = [];
1449
1517
  for (const u of t) {
1450
- const { code: d, imports: p } = Je(u, s, o);
1451
- i.push(d);
1452
- for (const h of p)
1453
- n.add(h);
1518
+ const { code: l, imports: p } = rt(u, i, a);
1519
+ d.push(l);
1520
+ for (const f of p)
1521
+ s.add(f);
1454
1522
  }
1455
- const l = [];
1456
- n.size > 0 && l.push(`import { ${Array.from(n).join(", ")} } from "@teamflojo/floimg";`), l.push('import * as flo from "@teamflojo/floimg";');
1457
- const a = `/**
1523
+ const m = [];
1524
+ s.size > 0 && m.push(`import { ${Array.from(s).join(", ")} } from "@teamflojo/floimg";`), m.push('import * as flo from "@teamflojo/floimg";');
1525
+ const o = `/**
1458
1526
  * FloImg Workflow
1459
1527
  * Generated by FloImg Studio
1460
1528
  * https://floimg.com
1461
1529
  */
1462
1530
 
1463
- `, c = `
1531
+ `, n = `
1464
1532
  async function runWorkflow() {
1465
- ${i.map(
1533
+ ${d.map(
1466
1534
  (u) => u.split(`
1467
- `).map((d) => " " + d).join(`
1535
+ `).map((l) => " " + l).join(`
1468
1536
  `)
1469
1537
  ).join(`
1470
1538
 
@@ -1474,55 +1542,291 @@ ${i.map(
1474
1542
  // Run the workflow
1475
1543
  runWorkflow().catch(console.error);
1476
1544
  `;
1477
- return a + l.join(`
1545
+ return o + m.join(`
1478
1546
  `) + `
1479
- ` + c;
1547
+ ` + n;
1548
+ }
1549
+ function ot({ isOpen: r, onClose: i, onImport: t }) {
1550
+ const [a, s] = N(""), [d, m] = N(!1), [o, n] = N(null), [u, l] = N(!1), p = C(async () => {
1551
+ if (!a.trim()) {
1552
+ n({ message: "Please enter or paste YAML content" });
1553
+ return;
1554
+ }
1555
+ m(!0), n(null);
1556
+ try {
1557
+ const h = await Ee(a);
1558
+ h.success ? (t(h.nodes, h.edges, h.name), s(""), i()) : n({
1559
+ message: h.error || "Import failed",
1560
+ line: h.line,
1561
+ column: h.column
1562
+ });
1563
+ } catch (h) {
1564
+ n({ message: h instanceof Error ? h.message : "Import failed" });
1565
+ } finally {
1566
+ m(!1);
1567
+ }
1568
+ }, [a, t, i]), f = C(async () => {
1569
+ if (!a.trim()) {
1570
+ n({ message: "Please enter or paste YAML content" });
1571
+ return;
1572
+ }
1573
+ m(!0), n(null);
1574
+ try {
1575
+ const h = await Oe(a);
1576
+ h.valid ? (n(null), n({ message: "Valid YAML!" }), setTimeout(() => n(null), 2e3)) : h.errors.length > 0 && n(h.errors[0]);
1577
+ } catch (h) {
1578
+ n({ message: h instanceof Error ? h.message : "Validation failed" });
1579
+ } finally {
1580
+ m(!1);
1581
+ }
1582
+ }, [a]), b = C(async (h) => {
1583
+ if (!h.name.endsWith(".yaml") && !h.name.endsWith(".yml")) {
1584
+ n({ message: "Please upload a .yaml or .yml file" });
1585
+ return;
1586
+ }
1587
+ try {
1588
+ const z = await h.text();
1589
+ s(z), n(null);
1590
+ } catch {
1591
+ n({ message: "Failed to read file" });
1592
+ }
1593
+ }, []), k = C((h) => {
1594
+ h.preventDefault(), l(!0);
1595
+ }, []), g = C((h) => {
1596
+ h.preventDefault(), l(!1);
1597
+ }, []), v = C(
1598
+ (h) => {
1599
+ h.preventDefault(), l(!1);
1600
+ const z = h.dataTransfer.files[0];
1601
+ z && b(z);
1602
+ },
1603
+ [b]
1604
+ ), w = C(
1605
+ (h) => {
1606
+ var S;
1607
+ const z = (S = h.target.files) == null ? void 0 : S[0];
1608
+ z && b(z);
1609
+ },
1610
+ [b]
1611
+ );
1612
+ return r ? /* @__PURE__ */ e("div", { className: "fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50", children: /* @__PURE__ */ c("div", { className: "bg-white dark:bg-zinc-800 rounded-lg shadow-xl max-w-2xl w-full mx-4 max-h-[80vh] flex flex-col", children: [
1613
+ /* @__PURE__ */ c("div", { className: "flex items-center justify-between px-4 py-3 border-b border-gray-200 dark:border-zinc-700", children: [
1614
+ /* @__PURE__ */ e("h3", { className: "text-lg font-semibold text-gray-900 dark:text-white", children: "Import Workflow" }),
1615
+ /* @__PURE__ */ e(
1616
+ "button",
1617
+ {
1618
+ onClick: i,
1619
+ className: "text-gray-500 dark:text-zinc-400 hover:text-gray-700 dark:hover:text-zinc-200",
1620
+ children: /* @__PURE__ */ e("svg", { className: "h-6 w-6", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ e(
1621
+ "path",
1622
+ {
1623
+ strokeLinecap: "round",
1624
+ strokeLinejoin: "round",
1625
+ strokeWidth: 2,
1626
+ d: "M6 18L18 6M6 6l12 12"
1627
+ }
1628
+ ) })
1629
+ }
1630
+ )
1631
+ ] }),
1632
+ /* @__PURE__ */ c("div", { className: "p-4 flex-1 overflow-auto", children: [
1633
+ /* @__PURE__ */ e("p", { className: "text-sm text-gray-600 dark:text-zinc-400 mb-4", children: "Paste YAML content or drag and drop a .yaml file to import a workflow." }),
1634
+ /* @__PURE__ */ c(
1635
+ "div",
1636
+ {
1637
+ onDragOver: k,
1638
+ onDragLeave: g,
1639
+ onDrop: v,
1640
+ className: `border-2 border-dashed rounded-lg p-4 mb-4 text-center transition-colors ${u ? "border-teal-500 bg-teal-50 dark:bg-teal-900/20" : "border-gray-300 dark:border-zinc-600"}`,
1641
+ children: [
1642
+ /* @__PURE__ */ e(
1643
+ "input",
1644
+ {
1645
+ type: "file",
1646
+ accept: ".yaml,.yml",
1647
+ onChange: w,
1648
+ className: "hidden",
1649
+ id: "yaml-file-input"
1650
+ }
1651
+ ),
1652
+ /* @__PURE__ */ c(
1653
+ "label",
1654
+ {
1655
+ htmlFor: "yaml-file-input",
1656
+ className: "cursor-pointer text-sm text-gray-600 dark:text-zinc-400",
1657
+ children: [
1658
+ /* @__PURE__ */ e(
1659
+ "svg",
1660
+ {
1661
+ className: "h-8 w-8 mx-auto mb-2 text-gray-400 dark:text-zinc-500",
1662
+ fill: "none",
1663
+ viewBox: "0 0 24 24",
1664
+ stroke: "currentColor",
1665
+ children: /* @__PURE__ */ e(
1666
+ "path",
1667
+ {
1668
+ strokeLinecap: "round",
1669
+ strokeLinejoin: "round",
1670
+ strokeWidth: 2,
1671
+ d: "M7 16a4 4 0 01-.88-7.903A5 5 0 1115.9 6L16 6a5 5 0 011 9.9M15 13l-3-3m0 0l-3 3m3-3v12"
1672
+ }
1673
+ )
1674
+ }
1675
+ ),
1676
+ /* @__PURE__ */ e("span", { className: "text-teal-600 dark:text-teal-400 hover:underline", children: "Click to upload" }),
1677
+ " ",
1678
+ "or drag and drop",
1679
+ /* @__PURE__ */ e("br", {}),
1680
+ /* @__PURE__ */ e("span", { className: "text-xs", children: ".yaml or .yml files" })
1681
+ ]
1682
+ }
1683
+ )
1684
+ ]
1685
+ }
1686
+ ),
1687
+ /* @__PURE__ */ e(
1688
+ "textarea",
1689
+ {
1690
+ value: a,
1691
+ onChange: (h) => {
1692
+ s(h.target.value), n(null);
1693
+ },
1694
+ placeholder: `name: My Workflow
1695
+ steps:
1696
+ - kind: generate
1697
+ generator: quickchart
1698
+ params:
1699
+ type: bar
1700
+ data:
1701
+ labels: [Q1, Q2, Q3, Q4]
1702
+ datasets:
1703
+ - label: Revenue
1704
+ data: [12, 19, 8, 15]
1705
+ out: v0
1706
+
1707
+ - kind: transform
1708
+ op: resize
1709
+ in: v0
1710
+ params:
1711
+ width: 800
1712
+ out: v1`,
1713
+ className: "w-full h-64 p-3 font-mono text-sm bg-gray-100 dark:bg-zinc-900 border border-gray-300 dark:border-zinc-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-teal-500 text-gray-800 dark:text-zinc-200"
1714
+ }
1715
+ ),
1716
+ o && /* @__PURE__ */ c(
1717
+ "div",
1718
+ {
1719
+ className: `mt-4 p-3 rounded-lg text-sm ${o.message === "Valid YAML!" ? "bg-green-50 dark:bg-green-900/30 text-green-700 dark:text-green-400" : "bg-red-50 dark:bg-red-900/30 text-red-700 dark:text-red-400"}`,
1720
+ children: [
1721
+ /* @__PURE__ */ e("span", { className: "font-medium", children: o.message }),
1722
+ o.line && /* @__PURE__ */ c("span", { className: "ml-2 text-xs", children: [
1723
+ "(line ",
1724
+ o.line,
1725
+ o.column ? `, column ${o.column}` : "",
1726
+ ")"
1727
+ ] })
1728
+ ]
1729
+ }
1730
+ )
1731
+ ] }),
1732
+ /* @__PURE__ */ c("div", { className: "flex justify-between items-center px-4 py-3 border-t border-gray-200 dark:border-zinc-700", children: [
1733
+ /* @__PURE__ */ e("span", { className: "text-xs text-gray-500 dark:text-zinc-400", children: "Use with floimg CLI: floimg run workflow.yaml" }),
1734
+ /* @__PURE__ */ c("div", { className: "flex gap-2", children: [
1735
+ /* @__PURE__ */ e(
1736
+ "button",
1737
+ {
1738
+ onClick: f,
1739
+ disabled: d || !a.trim(),
1740
+ className: "px-4 py-2 text-sm font-medium text-gray-700 dark:text-zinc-200 bg-white dark:bg-zinc-700 border border-gray-300 dark:border-zinc-600 rounded-md hover:bg-gray-50 dark:hover:bg-zinc-600 disabled:opacity-50 disabled:cursor-not-allowed",
1741
+ children: "Validate"
1742
+ }
1743
+ ),
1744
+ /* @__PURE__ */ c(
1745
+ "button",
1746
+ {
1747
+ onClick: p,
1748
+ disabled: d || !a.trim(),
1749
+ className: "px-4 py-2 text-sm font-medium text-white bg-teal-600 rounded-md hover:bg-teal-700 disabled:opacity-50 disabled:cursor-not-allowed flex items-center gap-2",
1750
+ children: [
1751
+ d && /* @__PURE__ */ c("svg", { className: "animate-spin h-4 w-4", viewBox: "0 0 24 24", fill: "none", children: [
1752
+ /* @__PURE__ */ e(
1753
+ "circle",
1754
+ {
1755
+ className: "opacity-25",
1756
+ cx: "12",
1757
+ cy: "12",
1758
+ r: "10",
1759
+ stroke: "currentColor",
1760
+ strokeWidth: "4"
1761
+ }
1762
+ ),
1763
+ /* @__PURE__ */ e(
1764
+ "path",
1765
+ {
1766
+ className: "opacity-75",
1767
+ fill: "currentColor",
1768
+ d: "M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"
1769
+ }
1770
+ )
1771
+ ] }),
1772
+ "Import"
1773
+ ]
1774
+ }
1775
+ )
1776
+ ] })
1777
+ ] })
1778
+ ] }) }) : null;
1480
1779
  }
1481
- function Ye({
1780
+ function nt({
1482
1781
  brandingSlot: r,
1483
- beforeActionsSlot: s,
1782
+ beforeActionsSlot: i,
1484
1783
  afterActionsSlot: t,
1485
- hideAttribution: o = !1
1784
+ hideAttribution: a = !1
1486
1785
  } = {}) {
1487
- const n = f((v) => v.execution), i = f((v) => v.execute), l = f((v) => v.exportToYaml), a = f((v) => v.nodes), c = f((v) => v.edges), u = A((v) => v.openSettings), d = f((v) => v.activeWorkflowName), p = f((v) => v.hasUnsavedChanges), h = f((v) => v.saveWorkflow), b = f((v) => v.toggleLibrary), x = f((v) => v.setActiveWorkflowName), [g, w] = N(!1), [k, y] = N("yaml"), [z, W] = N(""), [O, ie] = N(""), [J, B] = N(null), [de, F] = N(!1), [Q, V] = N("");
1488
- $(() => {
1489
- const v = () => {
1490
- B("New workflow created"), setTimeout(() => B(null), 2e3);
1786
+ const s = x((y) => y.execution), d = x((y) => y.execute), m = x((y) => y.exportToYaml), o = x((y) => y.importFromYaml), n = x((y) => y.nodes), u = x((y) => y.edges), l = $((y) => y.openSettings), p = x((y) => y.activeWorkflowName), f = x((y) => y.hasUnsavedChanges), b = x((y) => y.saveWorkflow), k = x((y) => y.toggleLibrary), g = x((y) => y.setActiveWorkflowName), [v, w] = N(!1), [h, z] = N(!1), [S, B] = N("yaml"), [J, le] = N(""), [Y, ce] = N(""), [X, j] = N(null), [me, V] = N(!1), [Z, G] = N("");
1787
+ M(() => {
1788
+ const y = () => {
1789
+ j("New workflow created"), setTimeout(() => j(null), 2e3);
1491
1790
  };
1492
- return window.addEventListener("new-workflow-created", v), () => window.removeEventListener("new-workflow-created", v);
1791
+ return window.addEventListener("new-workflow-created", y), () => window.removeEventListener("new-workflow-created", y);
1493
1792
  }, []);
1494
- const K = C(() => {
1495
- a.length !== 0 && (h(), B("Saved!"), setTimeout(() => B(null), 2e3));
1496
- }, [a.length, h]), le = () => {
1497
- V(d), F(!0);
1498
- }, Y = () => {
1499
- const v = Q.trim();
1500
- v && v !== d && x(v), F(!1);
1793
+ const q = C(() => {
1794
+ n.length !== 0 && (b(), j("Saved!"), setTimeout(() => j(null), 2e3));
1795
+ }, [n.length, b]), ue = () => {
1796
+ G(p), V(!0);
1797
+ }, ee = () => {
1798
+ const y = Z.trim();
1799
+ y && y !== p && g(y), V(!1);
1501
1800
  };
1502
- $(() => {
1503
- function v(P) {
1504
- (P.metaKey || P.ctrlKey) && P.key === "s" && (P.preventDefault(), K());
1801
+ M(() => {
1802
+ function y(D) {
1803
+ (D.metaKey || D.ctrlKey) && D.key === "s" && (D.preventDefault(), q());
1505
1804
  }
1506
- return document.addEventListener("keydown", v), () => document.removeEventListener("keydown", v);
1507
- }, [K]);
1508
- const ce = async () => {
1509
- await i();
1510
- }, me = async () => {
1511
- const v = await l();
1512
- W(v);
1513
- const P = Qe(a, c);
1514
- ie(P), w(!0);
1515
- }, ue = () => {
1516
- const v = k === "yaml" ? z : O;
1517
- navigator.clipboard.writeText(v);
1518
- };
1519
- return /* @__PURE__ */ m(j, { children: [
1520
- /* @__PURE__ */ m("div", { className: "h-14 bg-white dark:bg-zinc-800 border-b border-gray-200 dark:border-zinc-700 flex items-center justify-between px-4", children: [
1521
- /* @__PURE__ */ m("div", { className: "flex items-center gap-4", children: [
1805
+ return document.addEventListener("keydown", y), () => document.removeEventListener("keydown", y);
1806
+ }, [q]);
1807
+ const ge = async () => {
1808
+ await d();
1809
+ }, pe = async () => {
1810
+ const y = await m();
1811
+ le(y);
1812
+ const D = at(n, u);
1813
+ ce(D), w(!0);
1814
+ }, he = () => {
1815
+ const y = S === "yaml" ? J : Y;
1816
+ navigator.clipboard.writeText(y);
1817
+ }, fe = C(
1818
+ (y, D, be) => {
1819
+ o(y, D, be), j("Workflow imported!"), setTimeout(() => j(null), 2e3);
1820
+ },
1821
+ [o]
1822
+ );
1823
+ return /* @__PURE__ */ c(P, { children: [
1824
+ /* @__PURE__ */ c("div", { className: "h-14 bg-white dark:bg-zinc-800 border-b border-gray-200 dark:border-zinc-700 flex items-center justify-between px-4", children: [
1825
+ /* @__PURE__ */ c("div", { className: "flex items-center gap-4", children: [
1522
1826
  /* @__PURE__ */ e(
1523
1827
  "button",
1524
1828
  {
1525
- onClick: b,
1829
+ onClick: k,
1526
1830
  className: "p-2 text-gray-500 dark:text-zinc-400 hover:text-gray-700 dark:hover:text-zinc-200 hover:bg-gray-100 dark:hover:bg-zinc-700 rounded-md",
1527
1831
  title: "My Workflows",
1528
1832
  children: /* @__PURE__ */ e("svg", { className: "h-5 w-5", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ e(
@@ -1536,10 +1840,10 @@ function Ye({
1536
1840
  ) })
1537
1841
  }
1538
1842
  ),
1539
- /* @__PURE__ */ m("div", { className: "flex items-baseline gap-2", children: [
1540
- /* @__PURE__ */ e("h1", { className: "text-xl font-bold text-gray-800 dark:text-white", children: "floimg Studio" }),
1843
+ /* @__PURE__ */ c("div", { className: "flex items-baseline gap-2", children: [
1844
+ /* @__PURE__ */ e("h1", { className: "text-xl font-bold text-gray-800 dark:text-white", children: "FloImg Studio" }),
1541
1845
  r,
1542
- !o && /* @__PURE__ */ e(
1846
+ !a && /* @__PURE__ */ e(
1543
1847
  "a",
1544
1848
  {
1545
1849
  href: "https://flojo.io",
@@ -1550,16 +1854,16 @@ function Ye({
1550
1854
  }
1551
1855
  )
1552
1856
  ] }),
1553
- /* @__PURE__ */ m("div", { className: "flex items-center gap-2", children: [
1554
- de ? /* @__PURE__ */ e(
1857
+ /* @__PURE__ */ c("div", { className: "flex items-center gap-2", children: [
1858
+ me ? /* @__PURE__ */ e(
1555
1859
  "input",
1556
1860
  {
1557
1861
  type: "text",
1558
- value: Q,
1559
- onChange: (v) => V(v.target.value),
1560
- onBlur: Y,
1561
- onKeyDown: (v) => {
1562
- v.key === "Enter" && Y(), v.key === "Escape" && (V(d), F(!1));
1862
+ value: Z,
1863
+ onChange: (y) => G(y.target.value),
1864
+ onBlur: ee,
1865
+ onKeyDown: (y) => {
1866
+ y.key === "Enter" && ee(), y.key === "Escape" && (G(p), V(!1));
1563
1867
  },
1564
1868
  className: "w-48 px-2 py-1 text-sm font-medium bg-white dark:bg-zinc-900 border border-teal-500 rounded focus:outline-none focus:ring-1 focus:ring-teal-500 text-gray-900 dark:text-zinc-100",
1565
1869
  autoFocus: !0
@@ -1567,30 +1871,30 @@ function Ye({
1567
1871
  ) : /* @__PURE__ */ e(
1568
1872
  "button",
1569
1873
  {
1570
- onClick: le,
1874
+ onClick: ue,
1571
1875
  className: "text-sm text-gray-700 dark:text-zinc-300 font-medium hover:text-gray-900 dark:hover:text-zinc-100 rounded px-2 py-1 -mx-2 hover:bg-gray-100 dark:hover:bg-zinc-700 transition-colors",
1572
1876
  title: "Click to rename",
1573
- children: d
1877
+ children: p
1574
1878
  }
1575
1879
  ),
1576
- p && /* @__PURE__ */ e("span", { className: "text-xs text-amber-600 dark:text-amber-400", children: "(unsaved)" }),
1577
- J && /* @__PURE__ */ e("span", { className: "text-xs text-green-600 dark:text-green-400", children: J })
1880
+ f && /* @__PURE__ */ e("span", { className: "text-xs text-amber-600 dark:text-amber-400", children: "(unsaved)" }),
1881
+ X && /* @__PURE__ */ e("span", { className: "text-xs text-green-600 dark:text-green-400", children: X })
1578
1882
  ] }),
1579
- /* @__PURE__ */ m("span", { className: "text-sm text-gray-500 dark:text-zinc-400", children: [
1580
- a.length,
1883
+ /* @__PURE__ */ c("span", { className: "text-sm text-gray-500 dark:text-zinc-400", children: [
1884
+ n.length,
1581
1885
  " node",
1582
- a.length !== 1 ? "s" : ""
1886
+ n.length !== 1 ? "s" : ""
1583
1887
  ] })
1584
1888
  ] }),
1585
- /* @__PURE__ */ m("div", { className: "flex items-center gap-3", children: [
1586
- s,
1889
+ /* @__PURE__ */ c("div", { className: "flex items-center gap-3", children: [
1890
+ i,
1587
1891
  /* @__PURE__ */ e(
1588
1892
  "button",
1589
1893
  {
1590
- onClick: u,
1894
+ onClick: l,
1591
1895
  className: "p-2 text-gray-500 dark:text-zinc-400 hover:text-gray-700 dark:hover:text-zinc-200 hover:bg-gray-100 dark:hover:bg-zinc-700 rounded-md",
1592
1896
  title: "AI Settings",
1593
- children: /* @__PURE__ */ m("svg", { className: "h-5 w-5", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: [
1897
+ children: /* @__PURE__ */ c("svg", { className: "h-5 w-5", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: [
1594
1898
  /* @__PURE__ */ e(
1595
1899
  "path",
1596
1900
  {
@@ -1615,8 +1919,8 @@ function Ye({
1615
1919
  /* @__PURE__ */ e(
1616
1920
  "button",
1617
1921
  {
1618
- onClick: K,
1619
- disabled: a.length === 0,
1922
+ onClick: q,
1923
+ disabled: n.length === 0,
1620
1924
  className: "p-2 text-gray-500 dark:text-zinc-400 hover:text-gray-700 dark:hover:text-zinc-200 hover:bg-gray-100 dark:hover:bg-zinc-700 rounded-md disabled:opacity-50 disabled:cursor-not-allowed",
1621
1925
  title: "Save Workflow (Cmd+S)",
1622
1926
  children: /* @__PURE__ */ e("svg", { className: "h-5 w-5", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ e(
@@ -1633,8 +1937,16 @@ function Ye({
1633
1937
  /* @__PURE__ */ e(
1634
1938
  "button",
1635
1939
  {
1636
- onClick: me,
1637
- disabled: a.length === 0,
1940
+ onClick: () => z(!0),
1941
+ className: "px-4 py-2 text-sm font-medium text-gray-700 dark:text-zinc-200 bg-white dark:bg-zinc-700 border border-gray-300 dark:border-zinc-600 rounded-md hover:bg-gray-50 dark:hover:bg-zinc-600",
1942
+ children: "Import"
1943
+ }
1944
+ ),
1945
+ /* @__PURE__ */ e(
1946
+ "button",
1947
+ {
1948
+ onClick: pe,
1949
+ disabled: n.length === 0,
1638
1950
  className: "px-4 py-2 text-sm font-medium text-gray-700 dark:text-zinc-200 bg-white dark:bg-zinc-700 border border-gray-300 dark:border-zinc-600 rounded-md hover:bg-gray-50 dark:hover:bg-zinc-600 disabled:opacity-50 disabled:cursor-not-allowed",
1639
1951
  children: "Export"
1640
1952
  }
@@ -1642,11 +1954,11 @@ function Ye({
1642
1954
  /* @__PURE__ */ e(
1643
1955
  "button",
1644
1956
  {
1645
- onClick: ce,
1646
- disabled: a.length === 0 || n.status === "running",
1957
+ onClick: ge,
1958
+ disabled: n.length === 0 || s.status === "running",
1647
1959
  className: "px-4 py-2 text-sm font-medium text-white bg-teal-600 rounded-md hover:bg-teal-700 disabled:opacity-50 disabled:cursor-not-allowed flex items-center gap-2",
1648
- children: n.status === "running" ? /* @__PURE__ */ m(j, { children: [
1649
- /* @__PURE__ */ m("svg", { className: "animate-spin h-4 w-4", viewBox: "0 0 24 24", fill: "none", children: [
1960
+ children: s.status === "running" ? /* @__PURE__ */ c(P, { children: [
1961
+ /* @__PURE__ */ c("svg", { className: "animate-spin h-4 w-4", viewBox: "0 0 24 24", fill: "none", children: [
1650
1962
  /* @__PURE__ */ e(
1651
1963
  "circle",
1652
1964
  {
@@ -1668,8 +1980,8 @@ function Ye({
1668
1980
  )
1669
1981
  ] }),
1670
1982
  "Running..."
1671
- ] }) : /* @__PURE__ */ m(j, { children: [
1672
- /* @__PURE__ */ m("svg", { className: "h-4 w-4", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: [
1983
+ ] }) : /* @__PURE__ */ c(P, { children: [
1984
+ /* @__PURE__ */ c("svg", { className: "h-4 w-4", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: [
1673
1985
  /* @__PURE__ */ e(
1674
1986
  "path",
1675
1987
  {
@@ -1696,54 +2008,54 @@ function Ye({
1696
2008
  t
1697
2009
  ] })
1698
2010
  ] }),
1699
- n.status === "completed" && n.imageIds.length > 0 && /* @__PURE__ */ e("div", { className: "bg-green-50 dark:bg-green-900/30 border-b border-green-200 dark:border-green-800 px-4 py-3", children: /* @__PURE__ */ m("div", { className: "flex items-center gap-4", children: [
1700
- /* @__PURE__ */ m("span", { className: "text-green-700 dark:text-green-400 font-medium", children: [
2011
+ s.status === "completed" && s.imageIds.length > 0 && /* @__PURE__ */ e("div", { className: "bg-green-50 dark:bg-green-900/30 border-b border-green-200 dark:border-green-800 px-4 py-3", children: /* @__PURE__ */ c("div", { className: "flex items-center gap-4", children: [
2012
+ /* @__PURE__ */ c("span", { className: "text-green-700 dark:text-green-400 font-medium", children: [
1701
2013
  "Generated ",
1702
- n.imageIds.length,
2014
+ s.imageIds.length,
1703
2015
  " image",
1704
- n.imageIds.length !== 1 ? "s" : ""
2016
+ s.imageIds.length !== 1 ? "s" : ""
1705
2017
  ] }),
1706
- /* @__PURE__ */ e("div", { className: "flex gap-2", children: n.imageIds.slice(0, 4).map((v) => /* @__PURE__ */ e(
2018
+ /* @__PURE__ */ e("div", { className: "flex gap-2", children: s.imageIds.slice(0, 4).map((y) => /* @__PURE__ */ e(
1707
2019
  "a",
1708
2020
  {
1709
- href: G(v),
2021
+ href: F(y),
1710
2022
  target: "_blank",
1711
2023
  rel: "noopener noreferrer",
1712
2024
  className: "block",
1713
2025
  children: /* @__PURE__ */ e(
1714
2026
  "img",
1715
2027
  {
1716
- src: G(v),
2028
+ src: F(y),
1717
2029
  alt: "Generated",
1718
2030
  className: "h-12 w-12 object-cover rounded border border-green-300 dark:border-green-700"
1719
2031
  }
1720
2032
  )
1721
2033
  },
1722
- v
2034
+ y
1723
2035
  )) })
1724
2036
  ] }) }),
1725
- n.status === "error" && /* @__PURE__ */ e("div", { className: "bg-red-50 dark:bg-red-900/30 border-b border-red-200 dark:border-red-800 px-4 py-3", children: /* @__PURE__ */ m("span", { className: "text-red-700 dark:text-red-400", children: [
2037
+ s.status === "error" && /* @__PURE__ */ e("div", { className: "bg-red-50 dark:bg-red-900/30 border-b border-red-200 dark:border-red-800 px-4 py-3", children: /* @__PURE__ */ c("span", { className: "text-red-700 dark:text-red-400", children: [
1726
2038
  "Error: ",
1727
- n.error
2039
+ s.error
1728
2040
  ] }) }),
1729
- g && /* @__PURE__ */ e("div", { className: "fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50", children: /* @__PURE__ */ m("div", { className: "bg-white dark:bg-zinc-800 rounded-lg shadow-xl max-w-2xl w-full mx-4 max-h-[80vh] flex flex-col", children: [
1730
- /* @__PURE__ */ m("div", { className: "flex items-center justify-between px-4 py-3 border-b border-gray-200 dark:border-zinc-700", children: [
1731
- /* @__PURE__ */ m("div", { className: "flex items-center gap-4", children: [
2041
+ v && /* @__PURE__ */ e("div", { className: "fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50", children: /* @__PURE__ */ c("div", { className: "bg-white dark:bg-zinc-800 rounded-lg shadow-xl max-w-2xl w-full mx-4 max-h-[80vh] flex flex-col", children: [
2042
+ /* @__PURE__ */ c("div", { className: "flex items-center justify-between px-4 py-3 border-b border-gray-200 dark:border-zinc-700", children: [
2043
+ /* @__PURE__ */ c("div", { className: "flex items-center gap-4", children: [
1732
2044
  /* @__PURE__ */ e("h3", { className: "text-lg font-semibold text-gray-900 dark:text-white", children: "Export Workflow" }),
1733
- /* @__PURE__ */ m("div", { className: "flex gap-1 bg-gray-100 dark:bg-zinc-700 rounded-lg p-1", children: [
2045
+ /* @__PURE__ */ c("div", { className: "flex gap-1 bg-gray-100 dark:bg-zinc-700 rounded-lg p-1", children: [
1734
2046
  /* @__PURE__ */ e(
1735
2047
  "button",
1736
2048
  {
1737
- onClick: () => y("yaml"),
1738
- className: `px-3 py-1 text-sm font-medium rounded-md transition-colors ${k === "yaml" ? "bg-white dark:bg-zinc-600 text-gray-900 dark:text-white shadow-sm" : "text-gray-600 dark:text-zinc-400 hover:text-gray-900 dark:hover:text-white"}`,
2049
+ onClick: () => B("yaml"),
2050
+ className: `px-3 py-1 text-sm font-medium rounded-md transition-colors ${S === "yaml" ? "bg-white dark:bg-zinc-600 text-gray-900 dark:text-white shadow-sm" : "text-gray-600 dark:text-zinc-400 hover:text-gray-900 dark:hover:text-white"}`,
1739
2051
  children: "YAML"
1740
2052
  }
1741
2053
  ),
1742
2054
  /* @__PURE__ */ e(
1743
2055
  "button",
1744
2056
  {
1745
- onClick: () => y("javascript"),
1746
- className: `px-3 py-1 text-sm font-medium rounded-md transition-colors ${k === "javascript" ? "bg-white dark:bg-zinc-600 text-gray-900 dark:text-white shadow-sm" : "text-gray-600 dark:text-zinc-400 hover:text-gray-900 dark:hover:text-white"}`,
2057
+ onClick: () => B("javascript"),
2058
+ className: `px-3 py-1 text-sm font-medium rounded-md transition-colors ${S === "javascript" ? "bg-white dark:bg-zinc-600 text-gray-900 dark:text-white shadow-sm" : "text-gray-600 dark:text-zinc-400 hover:text-gray-900 dark:hover:text-white"}`,
1747
2059
  children: "JavaScript"
1748
2060
  }
1749
2061
  )
@@ -1766,14 +2078,14 @@ function Ye({
1766
2078
  }
1767
2079
  )
1768
2080
  ] }),
1769
- /* @__PURE__ */ e("div", { className: "p-4 overflow-auto flex-1", children: /* @__PURE__ */ e("pre", { className: "bg-gray-100 dark:bg-zinc-900 p-4 rounded text-sm font-mono whitespace-pre-wrap text-gray-800 dark:text-zinc-200", children: k === "yaml" ? z : O }) }),
1770
- /* @__PURE__ */ m("div", { className: "flex justify-between items-center px-4 py-3 border-t border-gray-200 dark:border-zinc-700", children: [
1771
- /* @__PURE__ */ e("span", { className: "text-xs text-gray-500 dark:text-zinc-400", children: k === "yaml" ? "Use with floimg CLI: floimg run workflow.yaml" : "Run with Node.js or Bun" }),
1772
- /* @__PURE__ */ m("div", { className: "flex gap-2", children: [
2081
+ /* @__PURE__ */ e("div", { className: "p-4 overflow-auto flex-1", children: /* @__PURE__ */ e("pre", { className: "bg-gray-100 dark:bg-zinc-900 p-4 rounded text-sm font-mono whitespace-pre-wrap text-gray-800 dark:text-zinc-200", children: S === "yaml" ? J : Y }) }),
2082
+ /* @__PURE__ */ c("div", { className: "flex justify-between items-center px-4 py-3 border-t border-gray-200 dark:border-zinc-700", children: [
2083
+ /* @__PURE__ */ e("span", { className: "text-xs text-gray-500 dark:text-zinc-400", children: S === "yaml" ? "Use with floimg CLI: floimg run workflow.yaml" : "Run with Node.js or Bun" }),
2084
+ /* @__PURE__ */ c("div", { className: "flex gap-2", children: [
1773
2085
  /* @__PURE__ */ e(
1774
2086
  "button",
1775
2087
  {
1776
- onClick: ue,
2088
+ onClick: he,
1777
2089
  className: "px-4 py-2 text-sm font-medium text-gray-700 dark:text-zinc-200 bg-white dark:bg-zinc-700 border border-gray-300 dark:border-zinc-600 rounded-md hover:bg-gray-50 dark:hover:bg-zinc-600",
1778
2090
  children: "Copy to Clipboard"
1779
2091
  }
@@ -1788,28 +2100,36 @@ function Ye({
1788
2100
  )
1789
2101
  ] })
1790
2102
  ] })
1791
- ] }) })
2103
+ ] }) }),
2104
+ /* @__PURE__ */ e(
2105
+ ot,
2106
+ {
2107
+ isOpen: h,
2108
+ onClose: () => z(!1),
2109
+ onImport: fe
2110
+ }
2111
+ )
1792
2112
  ] });
1793
2113
  }
1794
- function Xe() {
1795
- const r = f((c) => c.loadTemplate), [s, t] = N(null), {
1796
- data: o,
1797
- isLoading: n,
1798
- error: i,
1799
- refetch: l
1800
- } = q({
2114
+ function st() {
2115
+ const r = x((n) => n.loadTemplate), [i, t] = N(null), {
2116
+ data: a,
2117
+ isLoading: s,
2118
+ error: d,
2119
+ refetch: m
2120
+ } = _({
1801
2121
  queryKey: ["images"],
1802
- queryFn: Le,
2122
+ queryFn: Me,
1803
2123
  refetchInterval: 5e3
1804
2124
  // Auto-refresh every 5 seconds
1805
- }), a = async (c) => {
1806
- t(c);
2125
+ }), o = async (n) => {
2126
+ t(n);
1807
2127
  try {
1808
- const u = await We(c);
2128
+ const u = await je(n);
1809
2129
  if (u != null && u.workflow) {
1810
- const d = {
1811
- id: `image-${c}`,
1812
- name: `Workflow from ${c}`,
2130
+ const l = {
2131
+ id: `image-${n}`,
2132
+ name: `Workflow from ${n}`,
1813
2133
  description: "Loaded from gallery image",
1814
2134
  category: "Gallery",
1815
2135
  generator: "unknown",
@@ -1818,7 +2138,7 @@ function Xe() {
1818
2138
  edges: u.workflow.edges
1819
2139
  }
1820
2140
  };
1821
- r(d), window.dispatchEvent(new CustomEvent("workflow-loaded"));
2141
+ r(l), window.dispatchEvent(new CustomEvent("workflow-loaded"));
1822
2142
  } else
1823
2143
  alert("No workflow metadata available for this image");
1824
2144
  } catch (u) {
@@ -1827,56 +2147,56 @@ function Xe() {
1827
2147
  t(null);
1828
2148
  }
1829
2149
  };
1830
- return n ? /* @__PURE__ */ e("div", { className: "p-8 text-center text-gray-500 dark:text-zinc-400", children: "Loading images..." }) : i ? /* @__PURE__ */ m("div", { className: "p-8 text-center text-red-500 dark:text-red-400", children: [
2150
+ return s ? /* @__PURE__ */ e("div", { className: "p-8 text-center text-gray-500 dark:text-zinc-400", children: "Loading images..." }) : d ? /* @__PURE__ */ c("div", { className: "p-8 text-center text-red-500 dark:text-red-400", children: [
1831
2151
  "Error loading images: ",
1832
- i instanceof Error ? i.message : "Unknown error"
1833
- ] }) : !o || o.length === 0 ? /* @__PURE__ */ m("div", { className: "p-8 text-center text-gray-500 dark:text-zinc-400", children: [
2152
+ d instanceof Error ? d.message : "Unknown error"
2153
+ ] }) : !a || a.length === 0 ? /* @__PURE__ */ c("div", { className: "p-8 text-center text-gray-500 dark:text-zinc-400", children: [
1834
2154
  /* @__PURE__ */ e("div", { className: "text-lg mb-2", children: "No images yet" }),
1835
2155
  /* @__PURE__ */ e("div", { className: "text-sm", children: "Create a workflow and click Execute to generate images" })
1836
- ] }) : /* @__PURE__ */ m("div", { className: "p-4 bg-gray-100 dark:bg-zinc-900 min-h-full", children: [
1837
- /* @__PURE__ */ m("div", { className: "flex items-center justify-between mb-4", children: [
1838
- /* @__PURE__ */ m("h2", { className: "text-lg font-semibold text-gray-800 dark:text-white", children: [
2156
+ ] }) : /* @__PURE__ */ c("div", { className: "p-4 bg-gray-100 dark:bg-zinc-900 min-h-full", children: [
2157
+ /* @__PURE__ */ c("div", { className: "flex items-center justify-between mb-4", children: [
2158
+ /* @__PURE__ */ c("h2", { className: "text-lg font-semibold text-gray-800 dark:text-white", children: [
1839
2159
  "Gallery (",
1840
- o.length,
2160
+ a.length,
1841
2161
  " image",
1842
- o.length !== 1 ? "s" : "",
2162
+ a.length !== 1 ? "s" : "",
1843
2163
  ")"
1844
2164
  ] }),
1845
2165
  /* @__PURE__ */ e(
1846
2166
  "button",
1847
2167
  {
1848
- onClick: () => l(),
2168
+ onClick: () => m(),
1849
2169
  className: "text-sm text-teal-600 dark:text-teal-400 hover:text-teal-700 dark:hover:text-violet-300",
1850
2170
  children: "Refresh"
1851
2171
  }
1852
2172
  )
1853
2173
  ] }),
1854
- /* @__PURE__ */ e("div", { className: "grid grid-cols-2 md:grid-cols-3 lg:grid-cols-4 gap-4", children: o.map((c) => /* @__PURE__ */ e(
1855
- Ze,
2174
+ /* @__PURE__ */ e("div", { className: "grid grid-cols-2 md:grid-cols-3 lg:grid-cols-4 gap-4", children: a.map((n) => /* @__PURE__ */ e(
2175
+ it,
1856
2176
  {
1857
- image: c,
1858
- onLoadWorkflow: () => a(c.id),
1859
- isLoading: s === c.id
2177
+ image: n,
2178
+ onLoadWorkflow: () => o(n.id),
2179
+ isLoading: i === n.id
1860
2180
  },
1861
- c.id
2181
+ n.id
1862
2182
  )) })
1863
2183
  ] });
1864
2184
  }
1865
- function Ze({ image: r, onLoadWorkflow: s, isLoading: t }) {
1866
- const o = (i) => new Date(i).toLocaleString(), n = (i) => i < 1024 ? `${i} B` : i < 1048576 ? `${(i / 1024).toFixed(1)} KB` : `${(i / 1048576).toFixed(1)} MB`;
1867
- return /* @__PURE__ */ m("div", { className: "bg-white dark:bg-zinc-800 rounded-lg border border-gray-200 dark:border-zinc-700 overflow-hidden shadow-sm hover:shadow-md transition-shadow group", children: [
1868
- /* @__PURE__ */ m("div", { className: "relative", children: [
2185
+ function it({ image: r, onLoadWorkflow: i, isLoading: t }) {
2186
+ const a = (d) => new Date(d).toLocaleString(), s = (d) => d < 1024 ? `${d} B` : d < 1048576 ? `${(d / 1024).toFixed(1)} KB` : `${(d / 1048576).toFixed(1)} MB`;
2187
+ return /* @__PURE__ */ c("div", { className: "bg-white dark:bg-zinc-800 rounded-lg border border-gray-200 dark:border-zinc-700 overflow-hidden shadow-sm hover:shadow-md transition-shadow group", children: [
2188
+ /* @__PURE__ */ c("div", { className: "relative", children: [
1869
2189
  /* @__PURE__ */ e(
1870
2190
  "a",
1871
2191
  {
1872
- href: G(r.id),
2192
+ href: F(r.id),
1873
2193
  target: "_blank",
1874
2194
  rel: "noopener noreferrer",
1875
2195
  className: "block aspect-square bg-gray-100 dark:bg-zinc-900",
1876
2196
  children: /* @__PURE__ */ e(
1877
2197
  "img",
1878
2198
  {
1879
- src: G(r.id),
2199
+ src: F(r.id),
1880
2200
  alt: r.filename,
1881
2201
  className: "w-full h-full object-cover",
1882
2202
  loading: "lazy"
@@ -1887,8 +2207,8 @@ function Ze({ image: r, onLoadWorkflow: s, isLoading: t }) {
1887
2207
  /* @__PURE__ */ e("div", { className: "absolute inset-0 bg-black/50 opacity-0 group-hover:opacity-100 transition-opacity flex items-center justify-center", children: /* @__PURE__ */ e(
1888
2208
  "button",
1889
2209
  {
1890
- onClick: (i) => {
1891
- i.preventDefault(), s();
2210
+ onClick: (d) => {
2211
+ d.preventDefault(), i();
1892
2212
  },
1893
2213
  disabled: t,
1894
2214
  className: "px-3 py-1.5 bg-teal-600 text-white text-sm rounded-lg hover:bg-teal-700 disabled:opacity-50",
@@ -1896,18 +2216,18 @@ function Ze({ image: r, onLoadWorkflow: s, isLoading: t }) {
1896
2216
  }
1897
2217
  ) })
1898
2218
  ] }),
1899
- /* @__PURE__ */ m("div", { className: "p-3", children: [
2219
+ /* @__PURE__ */ c("div", { className: "p-3", children: [
1900
2220
  /* @__PURE__ */ e("div", { className: "text-sm font-medium text-gray-800 dark:text-white truncate", children: r.filename }),
1901
- /* @__PURE__ */ m("div", { className: "text-xs text-gray-500 dark:text-zinc-400 mt-1", children: [
2221
+ /* @__PURE__ */ c("div", { className: "text-xs text-gray-500 dark:text-zinc-400 mt-1", children: [
1902
2222
  r.mime,
1903
2223
  " • ",
1904
- n(r.size)
2224
+ s(r.size)
1905
2225
  ] }),
1906
- /* @__PURE__ */ e("div", { className: "text-xs text-gray-400 dark:text-zinc-500 mt-1", children: o(r.createdAt) })
2226
+ /* @__PURE__ */ e("div", { className: "text-xs text-gray-400 dark:text-zinc-500 mt-1", children: a(r.createdAt) })
1907
2227
  ] })
1908
2228
  ] });
1909
2229
  }
1910
- const et = {
2230
+ const dt = {
1911
2231
  id: "sales-dashboard",
1912
2232
  name: "Sales Dashboard",
1913
2233
  description: "Quarterly revenue bar chart with gradient styling",
@@ -1957,7 +2277,7 @@ const et = {
1957
2277
  ],
1958
2278
  edges: []
1959
2279
  }
1960
- }, tt = {
2280
+ }, lt = {
1961
2281
  id: "user-growth",
1962
2282
  name: "User Growth Line Chart",
1963
2283
  description: "Monthly user growth with smooth bezier curves",
@@ -2005,7 +2325,7 @@ const et = {
2005
2325
  ],
2006
2326
  edges: []
2007
2327
  }
2008
- }, rt = {
2328
+ }, ct = {
2009
2329
  id: "api-flow",
2010
2330
  name: "API Request Flow",
2011
2331
  description: "Sequence diagram showing API authentication flow",
@@ -2047,7 +2367,7 @@ const et = {
2047
2367
  ],
2048
2368
  edges: []
2049
2369
  }
2050
- }, at = {
2370
+ }, mt = {
2051
2371
  id: "system-architecture",
2052
2372
  name: "System Architecture",
2053
2373
  description: "Microservices architecture diagram",
@@ -2105,7 +2425,7 @@ const et = {
2105
2425
  ],
2106
2426
  edges: []
2107
2427
  }
2108
- }, ot = {
2428
+ }, ut = {
2109
2429
  id: "git-workflow",
2110
2430
  name: "Git Branch Workflow",
2111
2431
  description: "Git branching strategy with feature and release branches",
@@ -2148,7 +2468,7 @@ const et = {
2148
2468
  ],
2149
2469
  edges: []
2150
2470
  }
2151
- }, nt = {
2471
+ }, gt = {
2152
2472
  id: "website-qr",
2153
2473
  name: "Website QR Code",
2154
2474
  description: "QR code linking to your website with custom styling",
@@ -2176,7 +2496,7 @@ const et = {
2176
2496
  ],
2177
2497
  edges: []
2178
2498
  }
2179
- }, st = {
2499
+ }, pt = {
2180
2500
  id: "wifi-qr",
2181
2501
  name: "WiFi QR Code",
2182
2502
  description: "Scannable QR code for WiFi network access",
@@ -2204,7 +2524,7 @@ const et = {
2204
2524
  ],
2205
2525
  edges: []
2206
2526
  }
2207
- }, it = {
2527
+ }, ht = {
2208
2528
  id: "chart-watermark",
2209
2529
  name: "Chart with Watermark",
2210
2530
  description: "Bar chart with company watermark and rounded corners",
@@ -2270,7 +2590,7 @@ const et = {
2270
2590
  { id: "e2", source: "transform-1", target: "transform-2" }
2271
2591
  ]
2272
2592
  }
2273
- }, dt = {
2593
+ }, ft = {
2274
2594
  id: "diagram-webp",
2275
2595
  name: "Diagram to WebP",
2276
2596
  description: "Mermaid diagram converted to optimized WebP format",
@@ -2311,108 +2631,108 @@ const et = {
2311
2631
  ],
2312
2632
  edges: [{ id: "e1", source: "gen-1", target: "transform-1" }]
2313
2633
  }
2314
- }, E = [
2634
+ }, O = [
2315
2635
  // Charts
2316
- et,
2317
- tt,
2636
+ dt,
2637
+ lt,
2318
2638
  // Diagrams
2319
- rt,
2320
- at,
2321
- ot,
2639
+ ct,
2640
+ mt,
2641
+ ut,
2322
2642
  // QR Codes
2323
- nt,
2324
- st,
2643
+ gt,
2644
+ pt,
2325
2645
  // Pipelines
2326
- it,
2327
- dt
2646
+ ht,
2647
+ ft
2328
2648
  ];
2329
- function lt() {
2330
- const r = new Set(E.map((s) => s.category));
2649
+ function bt() {
2650
+ const r = new Set(O.map((i) => i.category));
2331
2651
  return Array.from(r).sort();
2332
2652
  }
2333
- function zt(r) {
2334
- return E.filter((s) => s.category === r);
2653
+ function $t(r) {
2654
+ return O.filter((i) => i.category === r);
2335
2655
  }
2336
- function ae(r) {
2337
- return E.find((s) => s.id === r);
2656
+ function ne(r) {
2657
+ return O.find((i) => i.id === r);
2338
2658
  }
2339
- function Ct(r) {
2340
- const s = r.toLowerCase();
2341
- return E.filter(
2659
+ function Mt(r) {
2660
+ const i = r.toLowerCase();
2661
+ return O.filter(
2342
2662
  (t) => {
2343
- var o;
2344
- return t.name.toLowerCase().includes(s) || t.description.toLowerCase().includes(s) || t.category.toLowerCase().includes(s) || t.generator.toLowerCase().includes(s) || ((o = t.tags) == null ? void 0 : o.some((n) => n.toLowerCase().includes(s)));
2663
+ var a;
2664
+ return t.name.toLowerCase().includes(i) || t.description.toLowerCase().includes(i) || t.category.toLowerCase().includes(i) || t.generator.toLowerCase().includes(i) || ((a = t.tags) == null ? void 0 : a.some((s) => s.toLowerCase().includes(i)));
2345
2665
  }
2346
2666
  );
2347
2667
  }
2348
- function ct({ onSelect: r }) {
2349
- const [s, t] = N(null), [o, n] = N(""), i = X(() => lt(), []), l = X(() => {
2350
- let a = E;
2351
- if (s && (a = a.filter((c) => c.category === s)), o) {
2352
- const c = o.toLowerCase();
2353
- a = a.filter(
2668
+ function xt({ onSelect: r }) {
2669
+ const [i, t] = N(null), [a, s] = N(""), d = te(() => bt(), []), m = te(() => {
2670
+ let o = O;
2671
+ if (i && (o = o.filter((n) => n.category === i)), a) {
2672
+ const n = a.toLowerCase();
2673
+ o = o.filter(
2354
2674
  (u) => {
2355
- var d;
2356
- return u.name.toLowerCase().includes(c) || u.description.toLowerCase().includes(c) || u.generator.toLowerCase().includes(c) || ((d = u.tags) == null ? void 0 : d.some((p) => p.toLowerCase().includes(c)));
2675
+ var l;
2676
+ return u.name.toLowerCase().includes(n) || u.description.toLowerCase().includes(n) || u.generator.toLowerCase().includes(n) || ((l = u.tags) == null ? void 0 : l.some((p) => p.toLowerCase().includes(n)));
2357
2677
  }
2358
2678
  );
2359
2679
  }
2360
- return a;
2361
- }, [s, o]);
2362
- return /* @__PURE__ */ m("div", { className: "p-6", children: [
2363
- /* @__PURE__ */ m("div", { className: "mb-6", children: [
2680
+ return o;
2681
+ }, [i, a]);
2682
+ return /* @__PURE__ */ c("div", { className: "p-6", children: [
2683
+ /* @__PURE__ */ c("div", { className: "mb-6", children: [
2364
2684
  /* @__PURE__ */ e("h2", { className: "text-2xl font-bold text-gray-900 dark:text-white mb-2", children: "Templates" }),
2365
2685
  /* @__PURE__ */ e("p", { className: "text-gray-600 dark:text-zinc-400", children: "Start with a pre-built workflow. Click any template to load it into the editor." })
2366
2686
  ] }),
2367
- /* @__PURE__ */ m("div", { className: "flex flex-wrap gap-4 mb-6", children: [
2687
+ /* @__PURE__ */ c("div", { className: "flex flex-wrap gap-4 mb-6", children: [
2368
2688
  /* @__PURE__ */ e(
2369
2689
  "input",
2370
2690
  {
2371
2691
  type: "text",
2372
2692
  placeholder: "Search templates...",
2373
- value: o,
2374
- onChange: (a) => n(a.target.value),
2693
+ value: a,
2694
+ onChange: (o) => s(o.target.value),
2375
2695
  className: "px-4 py-2 border border-gray-300 dark:border-zinc-600 rounded-lg bg-white dark:bg-zinc-800 text-gray-900 dark:text-white focus:ring-2 focus:ring-teal-500 focus:border-transparent w-64"
2376
2696
  }
2377
2697
  ),
2378
- /* @__PURE__ */ m("div", { className: "flex gap-2 flex-wrap", children: [
2698
+ /* @__PURE__ */ c("div", { className: "flex gap-2 flex-wrap", children: [
2379
2699
  /* @__PURE__ */ e(
2380
2700
  "button",
2381
2701
  {
2382
2702
  onClick: () => t(null),
2383
- className: `px-3 py-1.5 rounded-full text-sm font-medium transition-colors ${s === null ? "bg-teal-600 text-white" : "bg-gray-200 dark:bg-zinc-700 text-gray-700 dark:text-zinc-300 hover:bg-gray-300 dark:hover:bg-zinc-600"}`,
2703
+ className: `px-3 py-1.5 rounded-full text-sm font-medium transition-colors ${i === null ? "bg-teal-600 text-white" : "bg-gray-200 dark:bg-zinc-700 text-gray-700 dark:text-zinc-300 hover:bg-gray-300 dark:hover:bg-zinc-600"}`,
2384
2704
  children: "All"
2385
2705
  }
2386
2706
  ),
2387
- i.map((a) => /* @__PURE__ */ e(
2707
+ d.map((o) => /* @__PURE__ */ e(
2388
2708
  "button",
2389
2709
  {
2390
- onClick: () => t(a),
2391
- className: `px-3 py-1.5 rounded-full text-sm font-medium transition-colors ${s === a ? "bg-teal-600 text-white" : "bg-gray-200 dark:bg-zinc-700 text-gray-700 dark:text-zinc-300 hover:bg-gray-300 dark:hover:bg-zinc-600"}`,
2392
- children: a
2710
+ onClick: () => t(o),
2711
+ className: `px-3 py-1.5 rounded-full text-sm font-medium transition-colors ${i === o ? "bg-teal-600 text-white" : "bg-gray-200 dark:bg-zinc-700 text-gray-700 dark:text-zinc-300 hover:bg-gray-300 dark:hover:bg-zinc-600"}`,
2712
+ children: o
2393
2713
  },
2394
- a
2714
+ o
2395
2715
  ))
2396
2716
  ] })
2397
2717
  ] }),
2398
- l.length === 0 ? /* @__PURE__ */ e("div", { className: "text-center py-12 text-gray-500 dark:text-zinc-400", children: "No templates found matching your criteria." }) : /* @__PURE__ */ e("div", { className: "grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6", children: l.map((a) => /* @__PURE__ */ e(
2399
- mt,
2718
+ m.length === 0 ? /* @__PURE__ */ e("div", { className: "text-center py-12 text-gray-500 dark:text-zinc-400", children: "No templates found matching your criteria." }) : /* @__PURE__ */ e("div", { className: "grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6", children: m.map((o) => /* @__PURE__ */ e(
2719
+ kt,
2400
2720
  {
2401
- template: a,
2402
- onSelect: () => r(a.id)
2721
+ template: o,
2722
+ onSelect: () => r(o.id)
2403
2723
  },
2404
- a.id
2724
+ o.id
2405
2725
  )) })
2406
2726
  ] });
2407
2727
  }
2408
- function mt({ template: r, onSelect: s }) {
2409
- const t = r.workflow.nodes.length, o = r.workflow.edges.length, n = {
2728
+ function kt({ template: r, onSelect: i }) {
2729
+ const t = r.workflow.nodes.length, a = r.workflow.edges.length, s = {
2410
2730
  quickchart: "bg-blue-100 text-blue-800 dark:bg-blue-900/30 dark:text-blue-300",
2411
2731
  mermaid: "bg-pink-100 text-pink-800 dark:bg-pink-900/30 dark:text-pink-300",
2412
2732
  qr: "bg-green-100 text-green-800 dark:bg-green-900/30 dark:text-green-300",
2413
2733
  d3: "bg-orange-100 text-orange-800 dark:bg-orange-900/30 dark:text-orange-300"
2414
2734
  };
2415
- return /* @__PURE__ */ m("div", { className: "bg-white dark:bg-zinc-800 rounded-lg border border-gray-200 dark:border-zinc-700 overflow-hidden hover:shadow-lg transition-shadow", children: [
2735
+ return /* @__PURE__ */ c("div", { className: "bg-white dark:bg-zinc-800 rounded-lg border border-gray-200 dark:border-zinc-700 overflow-hidden hover:shadow-lg transition-shadow", children: [
2416
2736
  /* @__PURE__ */ e("div", { className: "aspect-video bg-gray-100 dark:bg-zinc-900 flex items-center justify-center p-4", children: r.preview ? /* @__PURE__ */ e(
2417
2737
  "img",
2418
2738
  {
@@ -2420,7 +2740,7 @@ function mt({ template: r, onSelect: s }) {
2420
2740
  alt: r.name,
2421
2741
  className: "max-w-full max-h-full object-contain"
2422
2742
  }
2423
- ) : /* @__PURE__ */ m("div", { className: "text-center text-gray-400 dark:text-zinc-500", children: [
2743
+ ) : /* @__PURE__ */ c("div", { className: "text-center text-gray-400 dark:text-zinc-500", children: [
2424
2744
  /* @__PURE__ */ e(
2425
2745
  "svg",
2426
2746
  {
@@ -2441,20 +2761,20 @@ function mt({ template: r, onSelect: s }) {
2441
2761
  ),
2442
2762
  /* @__PURE__ */ e("span", { className: "text-sm", children: "No preview" })
2443
2763
  ] }) }),
2444
- /* @__PURE__ */ m("div", { className: "p-4", children: [
2445
- /* @__PURE__ */ m("div", { className: "flex items-start justify-between mb-2", children: [
2764
+ /* @__PURE__ */ c("div", { className: "p-4", children: [
2765
+ /* @__PURE__ */ c("div", { className: "flex items-start justify-between mb-2", children: [
2446
2766
  /* @__PURE__ */ e("h3", { className: "text-lg font-semibold text-gray-900 dark:text-white", children: r.name }),
2447
2767
  /* @__PURE__ */ e(
2448
2768
  "span",
2449
2769
  {
2450
- className: `px-2 py-0.5 rounded text-xs font-medium ${n[r.generator] || "bg-gray-100 text-gray-800 dark:bg-zinc-700 dark:text-zinc-300"}`,
2770
+ className: `px-2 py-0.5 rounded text-xs font-medium ${s[r.generator] || "bg-gray-100 text-gray-800 dark:bg-zinc-700 dark:text-zinc-300"}`,
2451
2771
  children: r.generator
2452
2772
  }
2453
2773
  )
2454
2774
  ] }),
2455
2775
  /* @__PURE__ */ e("p", { className: "text-sm text-gray-600 dark:text-zinc-400 mb-3", children: r.description }),
2456
- /* @__PURE__ */ m("div", { className: "flex items-center gap-4 text-xs text-gray-500 dark:text-zinc-500 mb-4", children: [
2457
- /* @__PURE__ */ m("span", { className: "flex items-center gap-1", children: [
2776
+ /* @__PURE__ */ c("div", { className: "flex items-center gap-4 text-xs text-gray-500 dark:text-zinc-500 mb-4", children: [
2777
+ /* @__PURE__ */ c("span", { className: "flex items-center gap-1", children: [
2458
2778
  /* @__PURE__ */ e("svg", { className: "w-4 h-4", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ e(
2459
2779
  "path",
2460
2780
  {
@@ -2468,7 +2788,7 @@ function mt({ template: r, onSelect: s }) {
2468
2788
  " node",
2469
2789
  t !== 1 ? "s" : ""
2470
2790
  ] }),
2471
- o > 0 && /* @__PURE__ */ m("span", { className: "flex items-center gap-1", children: [
2791
+ a > 0 && /* @__PURE__ */ c("span", { className: "flex items-center gap-1", children: [
2472
2792
  /* @__PURE__ */ e("svg", { className: "w-4 h-4", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ e(
2473
2793
  "path",
2474
2794
  {
@@ -2478,23 +2798,23 @@ function mt({ template: r, onSelect: s }) {
2478
2798
  d: "M13 7l5 5m0 0l-5 5m5-5H6"
2479
2799
  }
2480
2800
  ) }),
2481
- o,
2801
+ a,
2482
2802
  " edge",
2483
- o !== 1 ? "s" : ""
2803
+ a !== 1 ? "s" : ""
2484
2804
  ] })
2485
2805
  ] }),
2486
- r.tags && r.tags.length > 0 && /* @__PURE__ */ e("div", { className: "flex flex-wrap gap-1 mb-4", children: r.tags.slice(0, 4).map((i) => /* @__PURE__ */ e(
2806
+ r.tags && r.tags.length > 0 && /* @__PURE__ */ e("div", { className: "flex flex-wrap gap-1 mb-4", children: r.tags.slice(0, 4).map((d) => /* @__PURE__ */ e(
2487
2807
  "span",
2488
2808
  {
2489
2809
  className: "px-2 py-0.5 bg-gray-100 dark:bg-zinc-700 text-gray-600 dark:text-zinc-400 rounded text-xs",
2490
- children: i
2810
+ children: d
2491
2811
  },
2492
- i
2812
+ d
2493
2813
  )) }),
2494
2814
  /* @__PURE__ */ e(
2495
2815
  "button",
2496
2816
  {
2497
- onClick: s,
2817
+ onClick: i,
2498
2818
  className: "w-full py-2 px-4 bg-teal-600 hover:bg-teal-700 text-white rounded-lg font-medium transition-colors",
2499
2819
  children: "Use Template"
2500
2820
  }
@@ -2502,67 +2822,67 @@ function mt({ template: r, onSelect: s }) {
2502
2822
  ] })
2503
2823
  ] });
2504
2824
  }
2505
- function ut({
2825
+ function wt({
2506
2826
  workflow: r,
2507
- isActive: s,
2827
+ isActive: i,
2508
2828
  onLoad: t,
2509
- onDelete: o,
2510
- onRename: n,
2511
- onDuplicate: i
2829
+ onDelete: a,
2830
+ onRename: s,
2831
+ onDuplicate: d
2512
2832
  }) {
2513
- const [l, a] = N(!1), [c, u] = N(r.name), [d, p] = N(!1), h = () => {
2514
- c.trim() && c !== r.name && n(c.trim()), a(!1);
2515
- }, b = (x) => {
2516
- const g = new Date(x), k = (/* @__PURE__ */ new Date()).getTime() - g.getTime(), y = Math.floor(k / 6e4), z = Math.floor(k / 36e5), W = Math.floor(k / 864e5);
2517
- return y < 1 ? "Just now" : y < 60 ? `${y}m ago` : z < 24 ? `${z}h ago` : W < 7 ? `${W}d ago` : g.toLocaleDateString();
2833
+ const [m, o] = N(!1), [n, u] = N(r.name), [l, p] = N(!1), f = () => {
2834
+ n.trim() && n !== r.name && s(n.trim()), o(!1);
2835
+ }, b = (k) => {
2836
+ const g = new Date(k), w = (/* @__PURE__ */ new Date()).getTime() - g.getTime(), h = Math.floor(w / 6e4), z = Math.floor(w / 36e5), S = Math.floor(w / 864e5);
2837
+ return h < 1 ? "Just now" : h < 60 ? `${h}m ago` : z < 24 ? `${z}h ago` : S < 7 ? `${S}d ago` : g.toLocaleDateString();
2518
2838
  };
2519
- return /* @__PURE__ */ m(
2839
+ return /* @__PURE__ */ c(
2520
2840
  "div",
2521
2841
  {
2522
- className: `group relative p-3 rounded-lg border transition-colors ${s ? "bg-teal-50 dark:bg-teal-900/20 border-teal-200 dark:border-teal-800" : "bg-white dark:bg-zinc-800 border-zinc-200 dark:border-zinc-700 hover:border-zinc-300 dark:hover:border-zinc-600"}`,
2842
+ className: `group relative p-3 rounded-lg border transition-colors ${i ? "bg-teal-50 dark:bg-teal-900/20 border-teal-200 dark:border-teal-800" : "bg-white dark:bg-zinc-800 border-zinc-200 dark:border-zinc-700 hover:border-zinc-300 dark:hover:border-zinc-600"}`,
2523
2843
  children: [
2524
- /* @__PURE__ */ m("div", { className: "flex items-start justify-between gap-2", children: [
2525
- /* @__PURE__ */ m("button", { onClick: t, className: "flex-1 text-left min-w-0", children: [
2526
- l ? /* @__PURE__ */ e(
2844
+ /* @__PURE__ */ c("div", { className: "flex items-start justify-between gap-2", children: [
2845
+ /* @__PURE__ */ c("button", { onClick: t, className: "flex-1 text-left min-w-0", children: [
2846
+ m ? /* @__PURE__ */ e(
2527
2847
  "input",
2528
2848
  {
2529
2849
  type: "text",
2530
- value: c,
2531
- onChange: (x) => u(x.target.value),
2532
- onBlur: h,
2533
- onKeyDown: (x) => {
2534
- x.key === "Enter" && h(), x.key === "Escape" && (u(r.name), a(!1));
2850
+ value: n,
2851
+ onChange: (k) => u(k.target.value),
2852
+ onBlur: f,
2853
+ onKeyDown: (k) => {
2854
+ k.key === "Enter" && f(), k.key === "Escape" && (u(r.name), o(!1));
2535
2855
  },
2536
2856
  className: "w-full px-1 py-0.5 text-sm font-medium bg-white dark:bg-zinc-900 border border-teal-500 rounded focus:outline-none focus:ring-1 focus:ring-teal-500",
2537
2857
  autoFocus: !0,
2538
- onClick: (x) => x.stopPropagation()
2858
+ onClick: (k) => k.stopPropagation()
2539
2859
  }
2540
2860
  ) : /* @__PURE__ */ e("span", { className: "block text-sm font-medium text-zinc-900 dark:text-zinc-100 truncate", children: r.name }),
2541
- /* @__PURE__ */ m("span", { className: "block text-xs text-zinc-500 dark:text-zinc-400 mt-0.5", children: [
2861
+ /* @__PURE__ */ c("span", { className: "block text-xs text-zinc-500 dark:text-zinc-400 mt-0.5", children: [
2542
2862
  r.nodes.length,
2543
2863
  " nodes · Updated ",
2544
2864
  b(r.updatedAt)
2545
2865
  ] })
2546
2866
  ] }),
2547
- /* @__PURE__ */ m("div", { className: "relative", children: [
2867
+ /* @__PURE__ */ c("div", { className: "relative", children: [
2548
2868
  /* @__PURE__ */ e(
2549
2869
  "button",
2550
2870
  {
2551
- onClick: (x) => {
2552
- x.stopPropagation(), p(!d);
2871
+ onClick: (k) => {
2872
+ k.stopPropagation(), p(!l);
2553
2873
  },
2554
2874
  className: "p-1 text-zinc-400 hover:text-zinc-600 dark:hover:text-zinc-300 rounded opacity-0 group-hover:opacity-100 transition-opacity",
2555
2875
  children: /* @__PURE__ */ e("svg", { className: "w-4 h-4", fill: "currentColor", viewBox: "0 0 20 20", children: /* @__PURE__ */ e("path", { d: "M10 6a2 2 0 110-4 2 2 0 010 4zM10 12a2 2 0 110-4 2 2 0 010 4zM10 18a2 2 0 110-4 2 2 0 010 4z" }) })
2556
2876
  }
2557
2877
  ),
2558
- d && /* @__PURE__ */ m(j, { children: [
2878
+ l && /* @__PURE__ */ c(P, { children: [
2559
2879
  /* @__PURE__ */ e("div", { className: "fixed inset-0 z-10", onClick: () => p(!1) }),
2560
- /* @__PURE__ */ m("div", { className: "absolute right-0 top-full mt-1 w-36 bg-white dark:bg-zinc-800 rounded-lg shadow-lg border border-zinc-200 dark:border-zinc-700 py-1 z-20", children: [
2880
+ /* @__PURE__ */ c("div", { className: "absolute right-0 top-full mt-1 w-36 bg-white dark:bg-zinc-800 rounded-lg shadow-lg border border-zinc-200 dark:border-zinc-700 py-1 z-20", children: [
2561
2881
  /* @__PURE__ */ e(
2562
2882
  "button",
2563
2883
  {
2564
- onClick: (x) => {
2565
- x.stopPropagation(), a(!0), p(!1);
2884
+ onClick: (k) => {
2885
+ k.stopPropagation(), o(!0), p(!1);
2566
2886
  },
2567
2887
  className: "w-full px-3 py-1.5 text-left text-sm text-zinc-700 dark:text-zinc-300 hover:bg-zinc-100 dark:hover:bg-zinc-700",
2568
2888
  children: "Rename"
@@ -2571,8 +2891,8 @@ function ut({
2571
2891
  /* @__PURE__ */ e(
2572
2892
  "button",
2573
2893
  {
2574
- onClick: (x) => {
2575
- x.stopPropagation(), i(), p(!1);
2894
+ onClick: (k) => {
2895
+ k.stopPropagation(), d(), p(!1);
2576
2896
  },
2577
2897
  className: "w-full px-3 py-1.5 text-left text-sm text-zinc-700 dark:text-zinc-300 hover:bg-zinc-100 dark:hover:bg-zinc-700",
2578
2898
  children: "Duplicate"
@@ -2581,8 +2901,8 @@ function ut({
2581
2901
  /* @__PURE__ */ e(
2582
2902
  "button",
2583
2903
  {
2584
- onClick: (x) => {
2585
- x.stopPropagation(), window.confirm("Delete this workflow?") && o(), p(!1);
2904
+ onClick: (k) => {
2905
+ k.stopPropagation(), window.confirm("Delete this workflow?") && a(), p(!1);
2586
2906
  },
2587
2907
  className: "w-full px-3 py-1.5 text-left text-sm text-red-600 dark:text-red-400 hover:bg-zinc-100 dark:hover:bg-zinc-700",
2588
2908
  children: "Delete"
@@ -2592,24 +2912,24 @@ function ut({
2592
2912
  ] })
2593
2913
  ] })
2594
2914
  ] }),
2595
- s && /* @__PURE__ */ e("span", { className: "absolute top-2 right-2 w-2 h-2 bg-teal-500 rounded-full" })
2915
+ i && /* @__PURE__ */ e("span", { className: "absolute top-2 right-2 w-2 h-2 bg-teal-500 rounded-full" })
2596
2916
  ]
2597
2917
  }
2598
2918
  );
2599
2919
  }
2600
- function gt() {
2601
- const r = f((d) => d.showLibrary), s = f((d) => d.toggleLibrary), t = f((d) => d.savedWorkflows), o = f((d) => d.activeWorkflowId), n = f((d) => d.loadWorkflow), i = f((d) => d.deleteWorkflow), l = f((d) => d.renameWorkflow), a = f((d) => d.duplicateWorkflow), c = f((d) => d.newWorkflow);
2920
+ function vt() {
2921
+ const r = x((l) => l.showLibrary), i = x((l) => l.toggleLibrary), t = x((l) => l.savedWorkflows), a = x((l) => l.activeWorkflowId), s = x((l) => l.loadWorkflow), d = x((l) => l.deleteWorkflow), m = x((l) => l.renameWorkflow), o = x((l) => l.duplicateWorkflow), n = x((l) => l.newWorkflow);
2602
2922
  if (!r) return null;
2603
- const u = [...t].sort((d, p) => p.updatedAt - d.updatedAt);
2604
- return /* @__PURE__ */ m(j, { children: [
2605
- /* @__PURE__ */ e("div", { className: "fixed inset-0 bg-black/20 dark:bg-black/40 z-40", onClick: s }),
2606
- /* @__PURE__ */ m("div", { className: "fixed left-0 top-0 bottom-0 w-80 bg-zinc-50 dark:bg-zinc-900 border-r border-zinc-200 dark:border-zinc-700 z-50 flex flex-col shadow-xl", children: [
2607
- /* @__PURE__ */ m("div", { className: "flex items-center justify-between px-4 py-3 border-b border-zinc-200 dark:border-zinc-700", children: [
2923
+ const u = [...t].sort((l, p) => p.updatedAt - l.updatedAt);
2924
+ return /* @__PURE__ */ c(P, { children: [
2925
+ /* @__PURE__ */ e("div", { className: "fixed inset-0 bg-black/20 dark:bg-black/40 z-40", onClick: i }),
2926
+ /* @__PURE__ */ c("div", { className: "fixed left-0 top-0 bottom-0 w-80 bg-zinc-50 dark:bg-zinc-900 border-r border-zinc-200 dark:border-zinc-700 z-50 flex flex-col shadow-xl", children: [
2927
+ /* @__PURE__ */ c("div", { className: "flex items-center justify-between px-4 py-3 border-b border-zinc-200 dark:border-zinc-700", children: [
2608
2928
  /* @__PURE__ */ e("h2", { className: "text-lg font-semibold text-zinc-900 dark:text-zinc-100", children: "My Workflows" }),
2609
2929
  /* @__PURE__ */ e(
2610
2930
  "button",
2611
2931
  {
2612
- onClick: s,
2932
+ onClick: i,
2613
2933
  className: "p-1 text-zinc-500 hover:text-zinc-700 dark:hover:text-zinc-300 rounded",
2614
2934
  children: /* @__PURE__ */ e("svg", { className: "w-5 h-5", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ e(
2615
2935
  "path",
@@ -2623,11 +2943,11 @@ function gt() {
2623
2943
  }
2624
2944
  )
2625
2945
  ] }),
2626
- /* @__PURE__ */ e("div", { className: "p-4 border-b border-zinc-200 dark:border-zinc-700", children: /* @__PURE__ */ m(
2946
+ /* @__PURE__ */ e("div", { className: "p-4 border-b border-zinc-200 dark:border-zinc-700", children: /* @__PURE__ */ c(
2627
2947
  "button",
2628
2948
  {
2629
2949
  onClick: () => {
2630
- c(), s(), window.dispatchEvent(new window.CustomEvent("new-workflow-created"));
2950
+ n(), i(), window.dispatchEvent(new window.CustomEvent("new-workflow-created"));
2631
2951
  },
2632
2952
  className: "w-full flex items-center justify-center gap-2 px-4 py-2 text-sm font-medium text-white bg-teal-600 rounded-lg hover:bg-teal-700 transition-colors",
2633
2953
  children: [
@@ -2644,7 +2964,7 @@ function gt() {
2644
2964
  ]
2645
2965
  }
2646
2966
  ) }),
2647
- /* @__PURE__ */ e("div", { className: "flex-1 overflow-y-auto p-4", children: u.length === 0 ? /* @__PURE__ */ m("div", { className: "text-center py-8", children: [
2967
+ /* @__PURE__ */ e("div", { className: "flex-1 overflow-y-auto p-4", children: u.length === 0 ? /* @__PURE__ */ c("div", { className: "text-center py-8", children: [
2648
2968
  /* @__PURE__ */ e("div", { className: "w-12 h-12 mx-auto mb-3 rounded-full bg-zinc-200 dark:bg-zinc-700 flex items-center justify-center", children: /* @__PURE__ */ e(
2649
2969
  "svg",
2650
2970
  {
@@ -2665,21 +2985,21 @@ function gt() {
2665
2985
  ) }),
2666
2986
  /* @__PURE__ */ e("p", { className: "text-sm text-zinc-500 dark:text-zinc-400", children: "No saved workflows yet" }),
2667
2987
  /* @__PURE__ */ e("p", { className: "text-xs text-zinc-400 dark:text-zinc-500 mt-1", children: "Build a workflow and save it to see it here" })
2668
- ] }) : /* @__PURE__ */ e("div", { className: "space-y-2", children: u.map((d) => /* @__PURE__ */ e(
2669
- ut,
2988
+ ] }) : /* @__PURE__ */ e("div", { className: "space-y-2", children: u.map((l) => /* @__PURE__ */ e(
2989
+ wt,
2670
2990
  {
2671
- workflow: d,
2672
- isActive: d.id === o,
2991
+ workflow: l,
2992
+ isActive: l.id === a,
2673
2993
  onLoad: () => {
2674
- n(d.id), s();
2994
+ s(l.id), i();
2675
2995
  },
2676
- onDelete: () => i(d.id),
2677
- onRename: (p) => l(d.id, p),
2678
- onDuplicate: () => a(d.id)
2996
+ onDelete: () => d(l.id),
2997
+ onRename: (p) => m(l.id, p),
2998
+ onDuplicate: () => o(l.id)
2679
2999
  },
2680
- d.id
3000
+ l.id
2681
3001
  )) }) }),
2682
- /* @__PURE__ */ m("div", { className: "px-4 py-3 border-t border-zinc-200 dark:border-zinc-700 text-xs text-zinc-500 dark:text-zinc-400", children: [
3002
+ /* @__PURE__ */ c("div", { className: "px-4 py-3 border-t border-zinc-200 dark:border-zinc-700 text-xs text-zinc-500 dark:text-zinc-400", children: [
2683
3003
  t.length,
2684
3004
  " workflow",
2685
3005
  t.length !== 1 ? "s" : "",
@@ -2688,7 +3008,7 @@ function gt() {
2688
3008
  ] })
2689
3009
  ] });
2690
3010
  }
2691
- const pt = [
3011
+ const yt = [
2692
3012
  {
2693
3013
  id: "openai",
2694
3014
  name: "OpenAI",
@@ -2717,7 +3037,7 @@ const pt = [
2717
3037
  placeholder: "sk-or-...",
2718
3038
  docsUrl: "https://openrouter.ai/keys"
2719
3039
  }
2720
- ], ht = [
3040
+ ], Nt = [
2721
3041
  {
2722
3042
  id: "ollama",
2723
3043
  name: "Ollama",
@@ -2733,21 +3053,21 @@ const pt = [
2733
3053
  docsUrl: "https://lmstudio.ai"
2734
3054
  }
2735
3055
  ];
2736
- function ft({ provider: r }) {
2737
- const s = A((h) => h.ai), t = A((h) => h.setAIProvider), o = s[r.id], n = (o == null ? void 0 : o.enabled) ?? !1, i = (o == null ? void 0 : o.apiKey) ?? "", [l, a] = N(i), [c, u] = N(!1), d = () => {
3056
+ function zt({ provider: r }) {
3057
+ const i = $((f) => f.ai), t = $((f) => f.setAIProvider), a = i[r.id], s = (a == null ? void 0 : a.enabled) ?? !1, d = (a == null ? void 0 : a.apiKey) ?? "", [m, o] = N(d), [n, u] = N(!1), l = () => {
2738
3058
  t(r.id, {
2739
- apiKey: l,
2740
- enabled: !n
3059
+ apiKey: m,
3060
+ enabled: !s
2741
3061
  });
2742
- }, p = (h) => {
2743
- a(h), t(r.id, {
2744
- apiKey: h,
2745
- enabled: n
3062
+ }, p = (f) => {
3063
+ o(f), t(r.id, {
3064
+ apiKey: f,
3065
+ enabled: s
2746
3066
  });
2747
3067
  };
2748
- return /* @__PURE__ */ m("div", { className: "flex items-start gap-4 p-4 border border-gray-200 dark:border-zinc-700 rounded-lg", children: [
2749
- /* @__PURE__ */ m("div", { className: "flex-1 min-w-0", children: [
2750
- /* @__PURE__ */ m("div", { className: "flex items-center gap-2", children: [
3068
+ return /* @__PURE__ */ c("div", { className: "flex items-start gap-4 p-4 border border-gray-200 dark:border-zinc-700 rounded-lg", children: [
3069
+ /* @__PURE__ */ c("div", { className: "flex-1 min-w-0", children: [
3070
+ /* @__PURE__ */ c("div", { className: "flex items-center gap-2", children: [
2751
3071
  /* @__PURE__ */ e("span", { className: "font-medium text-gray-900 dark:text-white", children: r.name }),
2752
3072
  /* @__PURE__ */ e(
2753
3073
  "a",
@@ -2761,13 +3081,13 @@ function ft({ provider: r }) {
2761
3081
  )
2762
3082
  ] }),
2763
3083
  /* @__PURE__ */ e("p", { className: "text-sm text-gray-500 dark:text-zinc-400 mt-0.5", children: r.description }),
2764
- /* @__PURE__ */ e("div", { className: "mt-2 flex items-center gap-2", children: /* @__PURE__ */ m("div", { className: "relative flex-1", children: [
3084
+ /* @__PURE__ */ e("div", { className: "mt-2 flex items-center gap-2", children: /* @__PURE__ */ c("div", { className: "relative flex-1", children: [
2765
3085
  /* @__PURE__ */ e(
2766
3086
  "input",
2767
3087
  {
2768
- type: c ? "text" : "password",
2769
- value: l,
2770
- onChange: (h) => p(h.target.value),
3088
+ type: n ? "text" : "password",
3089
+ value: m,
3090
+ onChange: (f) => p(f.target.value),
2771
3091
  placeholder: r.placeholder,
2772
3092
  className: "w-full px-3 py-1.5 text-sm border border-gray-300 dark:border-zinc-600 rounded bg-white dark:bg-zinc-800 text-gray-900 dark:text-white placeholder-gray-400 dark:placeholder-zinc-500"
2773
3093
  }
@@ -2776,9 +3096,9 @@ function ft({ provider: r }) {
2776
3096
  "button",
2777
3097
  {
2778
3098
  type: "button",
2779
- onClick: () => u(!c),
3099
+ onClick: () => u(!n),
2780
3100
  className: "absolute right-2 top-1/2 -translate-y-1/2 text-gray-400 hover:text-gray-600 dark:hover:text-zinc-300",
2781
- children: /* @__PURE__ */ e("svg", { className: "w-4 h-4", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: c ? /* @__PURE__ */ e(
3101
+ children: /* @__PURE__ */ e("svg", { className: "w-4 h-4", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: n ? /* @__PURE__ */ e(
2782
3102
  "path",
2783
3103
  {
2784
3104
  strokeLinecap: "round",
@@ -2802,33 +3122,33 @@ function ft({ provider: r }) {
2802
3122
  /* @__PURE__ */ e("div", { className: "flex items-center", children: /* @__PURE__ */ e(
2803
3123
  "button",
2804
3124
  {
2805
- onClick: d,
2806
- className: `relative inline-flex h-6 w-11 items-center rounded-full transition-colors ${n ? "bg-teal-600" : "bg-gray-300 dark:bg-zinc-600"}`,
3125
+ onClick: l,
3126
+ className: `relative inline-flex h-6 w-11 items-center rounded-full transition-colors ${s ? "bg-teal-600" : "bg-gray-300 dark:bg-zinc-600"}`,
2807
3127
  children: /* @__PURE__ */ e(
2808
3128
  "span",
2809
3129
  {
2810
- className: `inline-block h-4 w-4 transform rounded-full bg-white transition-transform ${n ? "translate-x-6" : "translate-x-1"}`
3130
+ className: `inline-block h-4 w-4 transform rounded-full bg-white transition-transform ${s ? "translate-x-6" : "translate-x-1"}`
2811
3131
  }
2812
3132
  )
2813
3133
  }
2814
3134
  ) })
2815
3135
  ] });
2816
3136
  }
2817
- function bt({ provider: r }) {
2818
- const s = A((d) => d.ai), t = A((d) => d.setAIProvider), o = s[r.id], n = (o == null ? void 0 : o.enabled) ?? !1, i = (o == null ? void 0 : o.baseUrl) ?? r.defaultUrl, [l, a] = N(i), c = () => {
3137
+ function Ct({ provider: r }) {
3138
+ const i = $((l) => l.ai), t = $((l) => l.setAIProvider), a = i[r.id], s = (a == null ? void 0 : a.enabled) ?? !1, d = (a == null ? void 0 : a.baseUrl) ?? r.defaultUrl, [m, o] = N(d), n = () => {
2819
3139
  t(r.id, {
2820
- baseUrl: l,
2821
- enabled: !n
3140
+ baseUrl: m,
3141
+ enabled: !s
2822
3142
  });
2823
- }, u = (d) => {
2824
- a(d), t(r.id, {
2825
- baseUrl: d,
2826
- enabled: n
3143
+ }, u = (l) => {
3144
+ o(l), t(r.id, {
3145
+ baseUrl: l,
3146
+ enabled: s
2827
3147
  });
2828
3148
  };
2829
- return /* @__PURE__ */ m("div", { className: "flex items-start gap-4 p-4 border border-gray-200 dark:border-zinc-700 rounded-lg", children: [
2830
- /* @__PURE__ */ m("div", { className: "flex-1 min-w-0", children: [
2831
- /* @__PURE__ */ m("div", { className: "flex items-center gap-2", children: [
3149
+ return /* @__PURE__ */ c("div", { className: "flex items-start gap-4 p-4 border border-gray-200 dark:border-zinc-700 rounded-lg", children: [
3150
+ /* @__PURE__ */ c("div", { className: "flex-1 min-w-0", children: [
3151
+ /* @__PURE__ */ c("div", { className: "flex items-center gap-2", children: [
2832
3152
  /* @__PURE__ */ e("span", { className: "font-medium text-gray-900 dark:text-white", children: r.name }),
2833
3153
  /* @__PURE__ */ e(
2834
3154
  "a",
@@ -2847,8 +3167,8 @@ function bt({ provider: r }) {
2847
3167
  "input",
2848
3168
  {
2849
3169
  type: "text",
2850
- value: l,
2851
- onChange: (d) => u(d.target.value),
3170
+ value: m,
3171
+ onChange: (l) => u(l.target.value),
2852
3172
  placeholder: r.defaultUrl,
2853
3173
  className: "w-full px-3 py-1.5 text-sm border border-gray-300 dark:border-zinc-600 rounded bg-white dark:bg-zinc-800 text-gray-900 dark:text-white placeholder-gray-400 dark:placeholder-zinc-500"
2854
3174
  }
@@ -2857,30 +3177,30 @@ function bt({ provider: r }) {
2857
3177
  /* @__PURE__ */ e("div", { className: "flex items-center", children: /* @__PURE__ */ e(
2858
3178
  "button",
2859
3179
  {
2860
- onClick: c,
2861
- className: `relative inline-flex h-6 w-11 items-center rounded-full transition-colors ${n ? "bg-teal-600" : "bg-gray-300 dark:bg-zinc-600"}`,
3180
+ onClick: n,
3181
+ className: `relative inline-flex h-6 w-11 items-center rounded-full transition-colors ${s ? "bg-teal-600" : "bg-gray-300 dark:bg-zinc-600"}`,
2862
3182
  children: /* @__PURE__ */ e(
2863
3183
  "span",
2864
3184
  {
2865
- className: `inline-block h-4 w-4 transform rounded-full bg-white transition-transform ${n ? "translate-x-6" : "translate-x-1"}`
3185
+ className: `inline-block h-4 w-4 transform rounded-full bg-white transition-transform ${s ? "translate-x-6" : "translate-x-1"}`
2866
3186
  }
2867
3187
  )
2868
3188
  }
2869
3189
  ) })
2870
3190
  ] });
2871
3191
  }
2872
- function xt() {
2873
- const r = A((t) => t.showSettings), s = A((t) => t.closeSettings);
2874
- return r ? /* @__PURE__ */ e("div", { className: "fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50", children: /* @__PURE__ */ m("div", { className: "bg-white dark:bg-zinc-800 rounded-lg shadow-xl max-w-xl w-full mx-4 max-h-[85vh] flex flex-col", children: [
2875
- /* @__PURE__ */ m("div", { className: "flex items-center justify-between px-6 py-4 border-b border-gray-200 dark:border-zinc-700", children: [
2876
- /* @__PURE__ */ m("div", { children: [
3192
+ function St() {
3193
+ const r = $((t) => t.showSettings), i = $((t) => t.closeSettings);
3194
+ return r ? /* @__PURE__ */ e("div", { className: "fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50", children: /* @__PURE__ */ c("div", { className: "bg-white dark:bg-zinc-800 rounded-lg shadow-xl max-w-xl w-full mx-4 max-h-[85vh] flex flex-col", children: [
3195
+ /* @__PURE__ */ c("div", { className: "flex items-center justify-between px-6 py-4 border-b border-gray-200 dark:border-zinc-700", children: [
3196
+ /* @__PURE__ */ c("div", { children: [
2877
3197
  /* @__PURE__ */ e("h2", { className: "text-lg font-semibold text-gray-900 dark:text-white", children: "AI Provider Settings" }),
2878
3198
  /* @__PURE__ */ e("p", { className: "text-sm text-gray-500 dark:text-zinc-400 mt-0.5", children: "Configure your AI providers for vision and text generation" })
2879
3199
  ] }),
2880
3200
  /* @__PURE__ */ e(
2881
3201
  "button",
2882
3202
  {
2883
- onClick: s,
3203
+ onClick: i,
2884
3204
  className: "text-gray-500 dark:text-zinc-400 hover:text-gray-700 dark:hover:text-zinc-200",
2885
3205
  children: /* @__PURE__ */ e("svg", { className: "h-6 w-6", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ e(
2886
3206
  "path",
@@ -2894,16 +3214,16 @@ function xt() {
2894
3214
  }
2895
3215
  )
2896
3216
  ] }),
2897
- /* @__PURE__ */ m("div", { className: "flex-1 overflow-y-auto p-6 space-y-6", children: [
2898
- /* @__PURE__ */ m("section", { children: [
3217
+ /* @__PURE__ */ c("div", { className: "flex-1 overflow-y-auto p-6 space-y-6", children: [
3218
+ /* @__PURE__ */ c("section", { children: [
2899
3219
  /* @__PURE__ */ e("h3", { className: "text-sm font-medium text-gray-700 dark:text-zinc-300 mb-3", children: "Cloud Providers" }),
2900
- /* @__PURE__ */ e("div", { className: "space-y-3", children: pt.map((t) => /* @__PURE__ */ e(ft, { provider: t }, t.id)) })
3220
+ /* @__PURE__ */ e("div", { className: "space-y-3", children: yt.map((t) => /* @__PURE__ */ e(zt, { provider: t }, t.id)) })
2901
3221
  ] }),
2902
- /* @__PURE__ */ m("section", { children: [
3222
+ /* @__PURE__ */ c("section", { children: [
2903
3223
  /* @__PURE__ */ e("h3", { className: "text-sm font-medium text-gray-700 dark:text-zinc-300 mb-3", children: "Local Providers" }),
2904
- /* @__PURE__ */ e("div", { className: "space-y-3", children: ht.map((t) => /* @__PURE__ */ e(bt, { provider: t }, t.id)) })
3224
+ /* @__PURE__ */ e("div", { className: "space-y-3", children: Nt.map((t) => /* @__PURE__ */ e(Ct, { provider: t }, t.id)) })
2905
3225
  ] }),
2906
- /* @__PURE__ */ e("div", { className: "bg-blue-50 dark:bg-blue-900/20 border border-blue-200 dark:border-blue-800 rounded-lg p-4", children: /* @__PURE__ */ m("div", { className: "flex items-start gap-3", children: [
3226
+ /* @__PURE__ */ e("div", { className: "bg-blue-50 dark:bg-blue-900/20 border border-blue-200 dark:border-blue-800 rounded-lg p-4", children: /* @__PURE__ */ c("div", { className: "flex items-start gap-3", children: [
2907
3227
  /* @__PURE__ */ e(
2908
3228
  "svg",
2909
3229
  {
@@ -2922,7 +3242,7 @@ function xt() {
2922
3242
  )
2923
3243
  }
2924
3244
  ),
2925
- /* @__PURE__ */ m("div", { children: [
3245
+ /* @__PURE__ */ c("div", { children: [
2926
3246
  /* @__PURE__ */ e("p", { className: "text-sm font-medium text-blue-900 dark:text-blue-300", children: "Your keys stay local" }),
2927
3247
  /* @__PURE__ */ e("p", { className: "text-sm text-blue-700 dark:text-blue-400 mt-1", children: "API keys are stored in your browser only and sent directly to providers. They never pass through our servers." })
2928
3248
  ] })
@@ -2931,67 +3251,67 @@ function xt() {
2931
3251
  /* @__PURE__ */ e("div", { className: "flex justify-end px-6 py-4 border-t border-gray-200 dark:border-zinc-700", children: /* @__PURE__ */ e(
2932
3252
  "button",
2933
3253
  {
2934
- onClick: s,
3254
+ onClick: i,
2935
3255
  className: "px-4 py-2 text-sm font-medium text-white bg-teal-600 rounded-md hover:bg-teal-700",
2936
3256
  children: "Done"
2937
3257
  }
2938
3258
  ) })
2939
3259
  ] }) }) : null;
2940
3260
  }
2941
- function St() {
2942
- const [r, s] = N("editor"), t = f((a) => a.addNode), o = f((a) => a.loadTemplate);
2943
- $(() => {
2944
- const c = new URLSearchParams(window.location.search).get("template");
2945
- if (c) {
2946
- const u = ae(c);
2947
- u && (o(u), window.history.replaceState({}, "", window.location.pathname));
3261
+ function jt() {
3262
+ const [r, i] = N("editor"), t = x((o) => o.addNode), a = x((o) => o.loadTemplate);
3263
+ M(() => {
3264
+ const n = new URLSearchParams(window.location.search).get("template");
3265
+ if (n) {
3266
+ const u = ne(n);
3267
+ u && (a(u), window.history.replaceState({}, "", window.location.pathname));
2948
3268
  }
2949
- }, [o]), $(() => {
2950
- const a = () => {
2951
- s("editor");
3269
+ }, [a]), M(() => {
3270
+ const o = () => {
3271
+ i("editor");
2952
3272
  };
2953
- return window.addEventListener("workflow-loaded", a), () => {
2954
- window.removeEventListener("workflow-loaded", a);
3273
+ return window.addEventListener("workflow-loaded", o), () => {
3274
+ window.removeEventListener("workflow-loaded", o);
2955
3275
  };
2956
3276
  }, []);
2957
- const n = C(
2958
- (a) => {
2959
- const c = ae(a);
2960
- c && (o(c), s("editor"));
3277
+ const s = C(
3278
+ (o) => {
3279
+ const n = ne(o);
3280
+ n && (a(n), i("editor"));
2961
3281
  },
2962
- [o]
2963
- ), i = C(
2964
- (a) => {
3282
+ [a]
3283
+ ), d = C(
3284
+ (o) => {
2965
3285
  var u;
2966
- a.preventDefault();
2967
- const c = a.dataTransfer.getData("application/json");
2968
- if (c)
3286
+ o.preventDefault();
3287
+ const n = o.dataTransfer.getData("application/json");
3288
+ if (n)
2969
3289
  try {
2970
- const d = JSON.parse(c), p = (u = document.querySelector(".react-flow")) == null ? void 0 : u.getBoundingClientRect();
3290
+ const l = JSON.parse(n), p = (u = document.querySelector(".react-flow")) == null ? void 0 : u.getBoundingClientRect();
2971
3291
  if (!p) return;
2972
- const h = {
2973
- x: a.clientX - p.left,
2974
- y: a.clientY - p.top
3292
+ const f = {
3293
+ x: o.clientX - p.left,
3294
+ y: o.clientY - p.top
2975
3295
  };
2976
- t(d, h);
2977
- } catch (d) {
2978
- console.error("Failed to parse dropped node:", d);
3296
+ t(l, f);
3297
+ } catch (l) {
3298
+ console.error("Failed to parse dropped node:", l);
2979
3299
  }
2980
3300
  },
2981
3301
  [t]
2982
- ), l = C((a) => {
2983
- a.preventDefault(), a.dataTransfer.dropEffect = "move";
3302
+ ), m = C((o) => {
3303
+ o.preventDefault(), o.dataTransfer.dropEffect = "move";
2984
3304
  }, []);
2985
- return /* @__PURE__ */ m(ve, { children: [
2986
- /* @__PURE__ */ e(xt, {}),
2987
- /* @__PURE__ */ e(gt, {}),
2988
- /* @__PURE__ */ m("div", { className: "h-screen flex flex-col bg-gray-100 dark:bg-zinc-900", children: [
2989
- /* @__PURE__ */ e(Ye, {}),
2990
- /* @__PURE__ */ e("div", { className: "bg-white dark:bg-zinc-800 border-b border-gray-200 dark:border-zinc-700", children: /* @__PURE__ */ m("div", { className: "flex", children: [
3305
+ return /* @__PURE__ */ c(Se, { children: [
3306
+ /* @__PURE__ */ e(St, {}),
3307
+ /* @__PURE__ */ e(vt, {}),
3308
+ /* @__PURE__ */ c("div", { className: "h-screen flex flex-col bg-gray-100 dark:bg-zinc-900", children: [
3309
+ /* @__PURE__ */ e(nt, {}),
3310
+ /* @__PURE__ */ e("div", { className: "bg-white dark:bg-zinc-800 border-b border-gray-200 dark:border-zinc-700", children: /* @__PURE__ */ c("div", { className: "flex", children: [
2991
3311
  /* @__PURE__ */ e(
2992
3312
  "button",
2993
3313
  {
2994
- onClick: () => s("editor"),
3314
+ onClick: () => i("editor"),
2995
3315
  className: `px-6 py-3 text-sm font-medium border-b-2 transition-colors ${r === "editor" ? "border-teal-500 text-teal-600 dark:text-teal-400" : "border-transparent text-gray-500 dark:text-zinc-400 hover:text-gray-700 dark:hover:text-zinc-200"}`,
2996
3316
  children: "Editor"
2997
3317
  }
@@ -2999,7 +3319,7 @@ function St() {
2999
3319
  /* @__PURE__ */ e(
3000
3320
  "button",
3001
3321
  {
3002
- onClick: () => s("gallery"),
3322
+ onClick: () => i("gallery"),
3003
3323
  className: `px-6 py-3 text-sm font-medium border-b-2 transition-colors ${r === "gallery" ? "border-teal-500 text-teal-600 dark:text-teal-400" : "border-transparent text-gray-500 dark:text-zinc-400 hover:text-gray-700 dark:hover:text-zinc-200"}`,
3004
3324
  children: "Gallery"
3005
3325
  }
@@ -3007,40 +3327,40 @@ function St() {
3007
3327
  /* @__PURE__ */ e(
3008
3328
  "button",
3009
3329
  {
3010
- onClick: () => s("templates"),
3330
+ onClick: () => i("templates"),
3011
3331
  className: `px-6 py-3 text-sm font-medium border-b-2 transition-colors ${r === "templates" ? "border-teal-500 text-teal-600 dark:text-teal-400" : "border-transparent text-gray-500 dark:text-zinc-400 hover:text-gray-700 dark:hover:text-zinc-200"}`,
3012
3332
  children: "Templates"
3013
3333
  }
3014
3334
  )
3015
3335
  ] }) }),
3016
- /* @__PURE__ */ m("div", { className: "flex-1 flex overflow-hidden", children: [
3017
- r === "editor" && /* @__PURE__ */ m(j, { children: [
3018
- /* @__PURE__ */ e(Ve, {}),
3019
- /* @__PURE__ */ e("div", { className: "flex-1", onDrop: i, onDragOver: l, children: /* @__PURE__ */ e(Ge, {}) }),
3020
- /* @__PURE__ */ e(Ke, {})
3336
+ /* @__PURE__ */ c("div", { className: "flex-1 flex overflow-hidden", children: [
3337
+ r === "editor" && /* @__PURE__ */ c(P, { children: [
3338
+ /* @__PURE__ */ e(Ye, {}),
3339
+ /* @__PURE__ */ e("div", { className: "flex-1", onDrop: d, onDragOver: m, children: /* @__PURE__ */ e(Qe, {}) }),
3340
+ /* @__PURE__ */ e(Xe, {})
3021
3341
  ] }),
3022
- r === "gallery" && /* @__PURE__ */ e("div", { className: "flex-1 overflow-auto", children: /* @__PURE__ */ e(Xe, {}) }),
3023
- r === "templates" && /* @__PURE__ */ e("div", { className: "flex-1 overflow-auto", children: /* @__PURE__ */ e(ct, { onSelect: n }) })
3342
+ r === "gallery" && /* @__PURE__ */ e("div", { className: "flex-1 overflow-auto", children: /* @__PURE__ */ e(st, {}) }),
3343
+ r === "templates" && /* @__PURE__ */ e("div", { className: "flex-1 overflow-auto", children: /* @__PURE__ */ e(xt, { onSelect: s }) })
3024
3344
  ] })
3025
3345
  ] })
3026
3346
  ] });
3027
3347
  }
3028
3348
  export {
3029
- xt as AISettings,
3030
- St as App,
3031
- Xe as Gallery,
3032
- Ke as NodeInspector,
3033
- Ve as NodePalette,
3034
- ct as TemplateGallery,
3035
- Ye as Toolbar,
3036
- Fe as UploadGallery,
3037
- Ge as WorkflowEditor,
3038
- gt as WorkflowLibrary,
3039
- lt as getCategories,
3040
- ae as getTemplateById,
3041
- zt as getTemplatesByCategory,
3042
- Ct as searchTemplates,
3043
- E as templates,
3044
- f as useWorkflowStore
3349
+ St as AISettings,
3350
+ jt as App,
3351
+ st as Gallery,
3352
+ Xe as NodeInspector,
3353
+ Ye as NodePalette,
3354
+ xt as TemplateGallery,
3355
+ nt as Toolbar,
3356
+ Je as UploadGallery,
3357
+ Qe as WorkflowEditor,
3358
+ vt as WorkflowLibrary,
3359
+ bt as getCategories,
3360
+ ne as getTemplateById,
3361
+ $t as getTemplatesByCategory,
3362
+ Mt as searchTemplates,
3363
+ O as templates,
3364
+ x as useWorkflowStore
3045
3365
  };
3046
3366
  //# sourceMappingURL=index.js.map