@teamflojo/floimg-studio-ui 0.1.5 → 0.1.7

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