@teamflojo/floimg-studio-ui 0.9.0 → 0.9.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { jsxs as d, jsx as e, Fragment as J } from "react/jsx-runtime";
2
- import { memo as oe, useRef as te, useCallback as M, useState as W, useEffect as H, useMemo as G, useContext as Be, useLayoutEffect as st, createContext as He, useDeferredValue as lt, useId as we } from "react";
3
- import dt, { Handle as D, Position as P, applyNodeChanges as ct, applyEdgeChanges as mt, MarkerType as ut, Background as pt, BackgroundVariant as ht, Controls as ft, MiniMap as gt, useReactFlow as Ue, ReactFlowProvider as xt } from "reactflow";
2
+ import { memo as oe, useRef as te, useCallback as M, useState as T, useEffect as H, useMemo as G, useContext as Be, useLayoutEffect as st, createContext as He, useDeferredValue as lt, useId as we } from "react";
3
+ import dt, { Handle as P, Position as O, applyNodeChanges as ct, applyEdgeChanges as mt, MarkerType as ut, Background as pt, BackgroundVariant as ht, Controls as ft, MiniMap as gt, useReactFlow as Ue, ReactFlowProvider as xt } from "reactflow";
4
4
  import { create as Ve } from "zustand";
5
5
  import { useQuery as be } from "@tanstack/react-query";
6
6
  function bt(t, o) {
@@ -46,8 +46,8 @@ const Ie = (t) => (o) => {
46
46
  storage: bt(() => localStorage),
47
47
  partialize: (b) => b,
48
48
  version: 0,
49
- merge: (b, k) => ({
50
- ...k,
49
+ merge: (b, y) => ({
50
+ ...y,
51
51
  ...b
52
52
  }),
53
53
  ...o
@@ -71,7 +71,7 @@ const Ie = (t) => (o) => {
71
71
  version: i.version
72
72
  });
73
73
  }, l = a.setState;
74
- a.setState = (b, k) => (l(b, k), c());
74
+ a.setState = (b, y) => (l(b, y), c());
75
75
  const f = t(
76
76
  (...b) => (n(...b), c()),
77
77
  r,
@@ -79,23 +79,23 @@ const Ie = (t) => (o) => {
79
79
  );
80
80
  a.getInitialState = () => f;
81
81
  let g;
82
- const w = () => {
83
- var b, k;
82
+ const v = () => {
83
+ var b, y;
84
84
  if (!p) return;
85
85
  m = !1, u.forEach((h) => {
86
- var v;
87
- return h((v = r()) != null ? v : f);
86
+ var w;
87
+ return h((w = r()) != null ? w : f);
88
88
  });
89
- const C = ((k = i.onRehydrateStorage) == null ? void 0 : k.call(i, (b = r()) != null ? b : f)) || void 0;
89
+ const C = ((y = i.onRehydrateStorage) == null ? void 0 : y.call(i, (b = r()) != null ? b : f)) || void 0;
90
90
  return Ie(p.getItem.bind(p))(i.name).then((h) => {
91
91
  if (h)
92
92
  if (typeof h.version == "number" && h.version !== i.version) {
93
93
  if (i.migrate) {
94
- const v = i.migrate(
94
+ const w = i.migrate(
95
95
  h.state,
96
96
  h.version
97
97
  );
98
- return v instanceof Promise ? v.then((y) => [!0, y]) : [!0, v];
98
+ return w instanceof Promise ? w.then((k) => [!0, k]) : [!0, w];
99
99
  }
100
100
  console.error(
101
101
  "State loaded from storage couldn't be migrated since no migrate function was provided"
@@ -104,12 +104,12 @@ const Ie = (t) => (o) => {
104
104
  return [!1, h.state];
105
105
  return [!1, void 0];
106
106
  }).then((h) => {
107
- var v;
108
- const [y, T] = h;
107
+ var w;
108
+ const [k, L] = h;
109
109
  if (g = i.merge(
110
- T,
111
- (v = r()) != null ? v : f
112
- ), n(g, !0), y)
110
+ L,
111
+ (w = r()) != null ? w : f
112
+ ), n(g, !0), k)
113
113
  return c();
114
114
  }).then(() => {
115
115
  C == null || C(g, void 0), g = r(), m = !0, s.forEach((h) => h(g));
@@ -128,7 +128,7 @@ const Ie = (t) => (o) => {
128
128
  p == null || p.removeItem(i.name);
129
129
  },
130
130
  getOptions: () => i,
131
- rehydrate: () => w(),
131
+ rehydrate: () => v(),
132
132
  hasHydrated: () => m,
133
133
  onHydrate: (b) => (u.add(b), () => {
134
134
  u.delete(b);
@@ -136,7 +136,7 @@ const Ie = (t) => (o) => {
136
136
  onFinishHydration: (b) => (s.add(b), () => {
137
137
  s.delete(b);
138
138
  })
139
- }, i.skipHydration || w(), g || f;
139
+ }, i.skipHydration || v(), g || f;
140
140
  }, Fe = vt;
141
141
  function wt(t, o) {
142
142
  var r;
@@ -178,15 +178,15 @@ function kt(t, o) {
178
178
  const p = i[s], c = p.id;
179
179
  if (m.set(p.id, c), p.type !== "input") {
180
180
  if (p.type === "generator") {
181
- const l = p.data, f = { ...l.params }, g = o.find((v) => v.target === p.id && v.targetHandle === "text"), w = g ? m.get(g.source) : void 0, b = g == null ? void 0 : g.sourceHandle, k = b == null ? void 0 : b.match(/^out\[(\d+)\]$/);
182
- if (k && g && n.has(g.source) && g) {
183
- const v = parseInt(k[1], 10), y = m.get(g.source);
184
- f._promptFromVar = `${y}_${v}`;
185
- } else w && (f._promptFromVar = w, b != null && b.startsWith("output.") && (f._promptFromProperty = b.slice(7)));
186
- const h = o.filter((v) => v.target === p.id && v.targetHandle === "references");
181
+ const l = p.data, f = { ...l.params }, g = o.find((w) => w.target === p.id && w.targetHandle === "text"), v = g ? m.get(g.source) : void 0, b = g == null ? void 0 : g.sourceHandle, y = b == null ? void 0 : b.match(/^out\[(\d+)\]$/);
182
+ if (y && g && n.has(g.source) && g) {
183
+ const w = parseInt(y[1], 10), k = m.get(g.source);
184
+ f._promptFromVar = `${k}_${w}`;
185
+ } else v && (f._promptFromVar = v, b != null && b.startsWith("output.") && (f._promptFromProperty = b.slice(7)));
186
+ const h = o.filter((w) => w.target === p.id && w.targetHandle === "references");
187
187
  if (h.length > 0) {
188
- const v = h.map((y) => m.get(y.source)).filter((y) => y !== void 0);
189
- v.length > 0 && (f._referenceImageVars = v);
188
+ const w = h.map((k) => m.get(k.source)).filter((k) => k !== void 0);
189
+ w.length > 0 && (f._referenceImageVars = w);
190
190
  }
191
191
  u.push({
192
192
  kind: "generate",
@@ -195,26 +195,44 @@ function kt(t, o) {
195
195
  out: c
196
196
  });
197
197
  } else if (p.type === "transform") {
198
- const l = p.data, f = o.find((v) => v.target === p.id && (v.targetHandle === "image" || !v.targetHandle)), g = f ? m.get(f.source) : void 0;
199
- if (!g)
198
+ const l = p.data, f = l.operation === "composite", g = o.find((k) => k.target !== p.id ? !1 : f ? k.targetHandle === "base" || k.targetHandle === "image" || !k.targetHandle : k.targetHandle === "image" || !k.targetHandle), v = g ? m.get(g.source) : void 0;
199
+ if (!v)
200
200
  throw new Error("Transform node requires an input image connection");
201
- const w = o.find((v) => v.target === p.id && v.targetHandle === "text"), b = w ? m.get(w.source) : void 0, k = w == null ? void 0 : w.sourceHandle, C = { ...l.params };
202
- b && (C._promptFromVar = b, k != null && k.startsWith("output.") && (C._promptFromProperty = k.slice(7)));
203
- const h = o.filter((v) => v.target === p.id && v.targetHandle === "references");
204
- if (h.length > 0) {
205
- const v = h.map((y) => m.get(y.source)).filter((y) => y !== void 0);
206
- v.length > 0 && (C._referenceImageVars = v);
201
+ const b = o.find((k) => k.target === p.id && k.targetHandle === "text"), y = b ? m.get(b.source) : void 0, C = b == null ? void 0 : b.sourceHandle, h = { ...l.params };
202
+ y && (h._promptFromVar = y, C != null && C.startsWith("output.") && (h._promptFromProperty = C.slice(7)));
203
+ const w = o.filter((k) => k.target === p.id && k.targetHandle === "references");
204
+ if (w.length > 0) {
205
+ const k = w.map((L) => m.get(L.source)).filter((L) => L !== void 0);
206
+ k.length > 0 && (h._referenceImageVars = k);
207
+ }
208
+ if (f) {
209
+ const k = o.filter((L) => {
210
+ var _;
211
+ return L.target === p.id && ((_ = L.targetHandle) == null ? void 0 : _.startsWith("overlays["));
212
+ }).sort((L, _) => {
213
+ var S, I, D, B;
214
+ const W = parseInt(((I = (S = L.targetHandle) == null ? void 0 : S.match(/\[(\d+)\]/)) == null ? void 0 : I[1]) || "0", 10), x = parseInt(((B = (D = _.targetHandle) == null ? void 0 : D.match(/\[(\d+)\]/)) == null ? void 0 : B[1]) || "0", 10);
215
+ return W - x;
216
+ });
217
+ if (k.length > 0) {
218
+ const L = k.map((_) => {
219
+ var S, I;
220
+ const W = m.get(_.source), x = parseInt(((I = (S = _.targetHandle) == null ? void 0 : S.match(/\[(\d+)\]/)) == null ? void 0 : I[1]) || "0", 10);
221
+ return W ? { varName: W, index: x } : null;
222
+ }).filter((_) => _ !== null);
223
+ L.length > 0 && (h._overlayImageVars = L);
224
+ }
207
225
  }
208
226
  u.push({
209
227
  kind: "transform",
210
228
  op: l.operation,
211
- in: g,
212
- params: C,
229
+ in: v,
230
+ params: h,
213
231
  out: c,
214
232
  ...l.providerName && { provider: l.providerName }
215
233
  });
216
234
  } else if (p.type === "save") {
217
- const l = p.data, f = o.find((w) => w.target === p.id), g = f ? m.get(f.source) : void 0;
235
+ const l = p.data, f = o.find((v) => v.target === p.id), g = f ? m.get(f.source) : void 0;
218
236
  if (!g)
219
237
  throw new Error("Save node requires an input connection");
220
238
  u.push({
@@ -227,16 +245,16 @@ function kt(t, o) {
227
245
  const l = p.data, f = o.find((C) => C.target === p.id && (C.targetHandle === "image" || !C.targetHandle)), g = f ? m.get(f.source) : void 0;
228
246
  if (!g)
229
247
  throw new Error("Vision node requires an input image connection");
230
- const w = o.find((C) => C.target === p.id && C.targetHandle === "context"), b = w ? m.get(w.source) : void 0, k = { ...l.params };
231
- b && (k._contextFromVar = b), u.push({
248
+ const v = o.find((C) => C.target === p.id && C.targetHandle === "context"), b = v ? m.get(v.source) : void 0, y = { ...l.params };
249
+ b && (y._contextFromVar = b), u.push({
232
250
  kind: "vision",
233
251
  provider: l.providerName,
234
252
  in: g,
235
- params: k,
253
+ params: y,
236
254
  out: c
237
255
  });
238
256
  } else if (p.type === "text") {
239
- const l = p.data, f = o.find((w) => w.target === p.id), g = f ? m.get(f.source) : void 0;
257
+ const l = p.data, f = o.find((v) => v.target === p.id), g = f ? m.get(f.source) : void 0;
240
258
  u.push({
241
259
  kind: "text",
242
260
  provider: l.providerName,
@@ -245,31 +263,31 @@ function kt(t, o) {
245
263
  out: c
246
264
  });
247
265
  } else if (p.type === "fanout") {
248
- const l = p.data, f = o.find((k) => k.target === p.id), g = f ? m.get(f.source) : void 0, w = l.count || 3, b = Array.from({ length: w }, (k, C) => `${c}_${C}`);
266
+ const l = p.data, f = o.find((y) => y.target === p.id), g = f ? m.get(f.source) : void 0, v = l.count || 3, b = Array.from({ length: v }, (y, C) => `${c}_${C}`);
249
267
  u.push({
250
268
  kind: "fan-out",
251
269
  in: g || "",
252
270
  mode: l.mode || "count",
253
- count: w,
271
+ count: v,
254
272
  arrayProperty: l.arrayProperty,
255
273
  out: b
256
274
  });
257
275
  } else if (p.type === "collect") {
258
- const l = p.data, g = o.filter((b) => b.target === p.id).map((b) => m.get(b.source)).filter((b) => b !== void 0), w = l.waitMode || "all";
276
+ const l = p.data, g = o.filter((b) => b.target === p.id).map((b) => m.get(b.source)).filter((b) => b !== void 0), v = l.waitMode || "all";
259
277
  u.push({
260
278
  kind: "collect",
261
279
  in: g,
262
- waitMode: w,
263
- ...w === "available" && { minRequired: Math.max(1, l.expectedInputs || 1) },
280
+ waitMode: v,
281
+ ...v === "available" && { minRequired: Math.max(1, l.expectedInputs || 1) },
264
282
  out: c
265
283
  });
266
284
  } else if (p.type === "router") {
267
- const l = p.data, f = o.find((C) => C.target === p.id && C.targetHandle === "candidates"), g = o.find((C) => C.target === p.id && C.targetHandle === "selection"), w = f ? m.get(f.source) : void 0, b = g ? m.get(g.source) : void 0, k = l.selectionType === "value" ? "property" : l.selectionType || "index";
285
+ const l = p.data, f = o.find((C) => C.target === p.id && C.targetHandle === "candidates"), g = o.find((C) => C.target === p.id && C.targetHandle === "selection"), v = f ? m.get(f.source) : void 0, b = g ? m.get(g.source) : void 0, y = l.selectionType === "value" ? "property" : l.selectionType || "index";
268
286
  u.push({
269
287
  kind: "router",
270
- in: w || "",
288
+ in: v || "",
271
289
  selectionIn: b || "",
272
- selectionType: k,
290
+ selectionType: y,
273
291
  selectionProperty: l.selectionProperty || "winner",
274
292
  out: c
275
293
  });
@@ -343,13 +361,13 @@ async function _t(t) {
343
361
  function Ke(t) {
344
362
  return `${Y}/uploads/${t}/blob`;
345
363
  }
346
- async function Mt(t) {
364
+ async function Wt(t) {
347
365
  return ae(`${Y}/import`, {
348
366
  method: "POST",
349
367
  body: JSON.stringify({ yaml: t })
350
368
  });
351
369
  }
352
- async function Wt(t) {
370
+ async function Mt(t) {
353
371
  return ae(`${Y}/import/validate`, {
354
372
  method: "POST",
355
373
  body: JSON.stringify({ yaml: t })
@@ -1201,8 +1219,8 @@ const N = Ve()(
1201
1219
  })), { pipeline: u, nodeToVar: s } = kt(i, m), p = {};
1202
1220
  for (const f of i)
1203
1221
  if (f.type === "input") {
1204
- const g = f.data, w = s.get(f.id);
1205
- g.uploadId && w && (p[w] = g.uploadId);
1222
+ const g = f.data, v = s.get(f.id);
1223
+ g.uploadId && v && (p[v] = g.uploadId);
1206
1224
  }
1207
1225
  const c = A.getState().getConfiguredProviders(), l = {};
1208
1226
  for (const f of r)
@@ -1234,58 +1252,58 @@ const N = Ve()(
1234
1252
  aiProviders: c
1235
1253
  },
1236
1254
  {
1237
- onMessage: (w) => {
1255
+ onMessage: (v) => {
1238
1256
  const b = o();
1239
- if (w.type, w.type === "execution.step") {
1240
- const k = w.data, C = {
1257
+ if (v.type, v.type === "execution.step") {
1258
+ const y = v.data, C = {
1241
1259
  ...b.execution.nodeStatus,
1242
- [k.id]: k.status
1243
- }, h = b.execution.nodeTiming[k.id] || {};
1244
- let v = { ...b.execution.nodeTiming };
1245
- if (k.status === "running")
1246
- v[k.id] = { startTime: Date.now() };
1247
- else if (k.status === "completed" || k.status === "error") {
1260
+ [y.id]: y.status
1261
+ }, h = b.execution.nodeTiming[y.id] || {};
1262
+ let w = { ...b.execution.nodeTiming };
1263
+ if (y.status === "running")
1264
+ w[y.id] = { startTime: Date.now() };
1265
+ else if (y.status === "completed" || y.status === "error") {
1248
1266
  const _ = h.startTime || Date.now();
1249
- v[k.id] = {
1267
+ w[y.id] = {
1250
1268
  ...h,
1251
1269
  duration: Date.now() - _
1252
1270
  };
1253
1271
  }
1254
- const y = k.preview ? { ...b.execution.previews, [k.id]: k.preview } : b.execution.previews, T = k.dataType && k.content ? {
1272
+ const k = y.preview ? { ...b.execution.previews, [y.id]: y.preview } : b.execution.previews, L = y.dataType && y.content ? {
1255
1273
  ...b.execution.dataOutputs,
1256
- [k.id]: {
1257
- dataType: k.dataType,
1258
- content: k.content,
1259
- parsed: k.parsed
1274
+ [y.id]: {
1275
+ dataType: y.dataType,
1276
+ content: y.content,
1277
+ parsed: y.parsed
1260
1278
  }
1261
1279
  } : b.execution.dataOutputs;
1262
1280
  t({
1263
1281
  execution: {
1264
1282
  ...b.execution,
1265
1283
  nodeStatus: C,
1266
- nodeTiming: v,
1267
- previews: y,
1268
- dataOutputs: T
1284
+ nodeTiming: w,
1285
+ previews: k,
1286
+ dataOutputs: L
1269
1287
  }
1270
1288
  });
1271
1289
  }
1272
- if (w.type === "execution.completed") {
1273
- const k = { ...b.execution.nodeStatus };
1274
- for (const y of Object.keys(k))
1275
- (k[y] === "pending" || k[y] === "running") && (k[y] = "completed");
1290
+ if (v.type === "execution.completed") {
1291
+ const y = { ...b.execution.nodeStatus };
1292
+ for (const k of Object.keys(y))
1293
+ (y[k] === "pending" || y[k] === "running") && (y[k] = "completed");
1276
1294
  const C = ce ? Date.now() - ce : 0;
1277
1295
  ce = null;
1278
1296
  const h = Object.entries(
1279
1297
  b.execution.previews
1280
- ).map(([y, T]) => {
1281
- const _ = b.nodes.find((S) => S.id === y), L = _ == null ? void 0 : _.data;
1298
+ ).map(([k, L]) => {
1299
+ const _ = b.nodes.find((S) => S.id === k), W = _ == null ? void 0 : _.data;
1282
1300
  let x = "Unknown Node";
1283
- return L && "generatorName" in L ? x = L.generatorName : L && "operation" in L ? x = L.operation : _ != null && _.type && (x = _.type.charAt(0).toUpperCase() + _.type.slice(1)), {
1284
- nodeId: y,
1301
+ return W && "generatorName" in W ? x = W.generatorName : W && "operation" in W ? x = W.operation : _ != null && _.type && (x = _.type.charAt(0).toUpperCase() + _.type.slice(1)), {
1302
+ nodeId: k,
1285
1303
  nodeName: x,
1286
- preview: T
1304
+ preview: L
1287
1305
  };
1288
- }), v = {
1306
+ }), w = {
1289
1307
  id: `run_${Date.now()}_${Math.random().toString(36).substring(2, 8)}`,
1290
1308
  timestamp: Date.now(),
1291
1309
  status: "completed",
@@ -1293,71 +1311,71 @@ const N = Ve()(
1293
1311
  nodeCount: b.nodes.length,
1294
1312
  outputs: h
1295
1313
  };
1296
- o().addExecutionRun(v), t({
1314
+ o().addExecutionRun(w), t({
1297
1315
  execution: {
1298
1316
  ...b.execution,
1299
1317
  status: "completed",
1300
- imageIds: w.data.imageIds,
1301
- imageUrls: w.data.imageUrls,
1302
- nodeStatus: k
1318
+ imageIds: v.data.imageIds,
1319
+ imageUrls: v.data.imageUrls,
1320
+ nodeStatus: y
1303
1321
  }
1304
1322
  }), f();
1305
1323
  }
1306
- if (w.type === "execution.error") {
1307
- const k = { ...b.execution.nodeStatus };
1308
- w.data.id && (k[w.data.id] = "error");
1324
+ if (v.type === "execution.error") {
1325
+ const y = { ...b.execution.nodeStatus };
1326
+ v.data.id && (y[v.data.id] = "error");
1309
1327
  const C = ce ? Date.now() - ce : 0;
1310
1328
  ce = null;
1311
1329
  const h = Object.entries(
1312
1330
  b.execution.previews
1313
- ).map(([y, T]) => {
1314
- const _ = b.nodes.find((S) => S.id === y), L = _ == null ? void 0 : _.data;
1331
+ ).map(([k, L]) => {
1332
+ const _ = b.nodes.find((S) => S.id === k), W = _ == null ? void 0 : _.data;
1315
1333
  let x = "Unknown Node";
1316
- return L && "generatorName" in L ? x = L.generatorName : L && "operation" in L ? x = L.operation : _ != null && _.type && (x = _.type.charAt(0).toUpperCase() + _.type.slice(1)), { nodeId: y, nodeName: x, preview: T };
1317
- }), v = {
1334
+ return W && "generatorName" in W ? x = W.generatorName : W && "operation" in W ? x = W.operation : _ != null && _.type && (x = _.type.charAt(0).toUpperCase() + _.type.slice(1)), { nodeId: k, nodeName: x, preview: L };
1335
+ }), w = {
1318
1336
  id: `run_${Date.now()}_${Math.random().toString(36).substring(2, 8)}`,
1319
1337
  timestamp: Date.now(),
1320
1338
  status: "error",
1321
1339
  duration: C,
1322
1340
  nodeCount: b.nodes.length,
1323
1341
  outputs: h,
1324
- error: w.data.error,
1325
- errorNodeId: w.data.id
1342
+ error: v.data.error,
1343
+ errorNodeId: v.data.id
1326
1344
  };
1327
- o().addExecutionRun(v), t({
1345
+ o().addExecutionRun(w), t({
1328
1346
  execution: {
1329
1347
  ...b.execution,
1330
1348
  status: "error",
1331
- nodeStatus: k,
1332
- error: w.data.error,
1333
- errorNodeId: w.data.id,
1349
+ nodeStatus: y,
1350
+ error: v.data.error,
1351
+ errorNodeId: v.data.id,
1334
1352
  // Structured error metadata from backend
1335
- errorCode: w.data.errorCode,
1336
- errorCategory: w.data.errorCategory,
1337
- retryable: w.data.retryable
1353
+ errorCode: v.data.errorCode,
1354
+ errorCategory: v.data.errorCategory,
1355
+ retryable: v.data.retryable
1338
1356
  }
1339
- }), g(new Error(w.data.error));
1357
+ }), g(new Error(v.data.error));
1340
1358
  }
1341
1359
  },
1342
- onError: (w) => {
1343
- const b = o(), k = {};
1360
+ onError: (v) => {
1361
+ const b = o(), y = {};
1344
1362
  for (const C of Object.keys(b.execution.nodeStatus))
1345
- k[C] = "error";
1363
+ y[C] = "error";
1346
1364
  t({
1347
1365
  execution: {
1348
1366
  ...b.execution,
1349
1367
  status: "error",
1350
- nodeStatus: k,
1351
- error: w.message
1368
+ nodeStatus: y,
1369
+ error: v.message
1352
1370
  }
1353
- }), g(w);
1371
+ }), g(v);
1354
1372
  },
1355
1373
  onClose: () => {
1356
1374
  ge = null;
1357
- const w = o();
1358
- w.execution.status === "running" && (t({
1375
+ const v = o();
1376
+ v.execution.status === "running" && (t({
1359
1377
  execution: {
1360
- ...w.execution,
1378
+ ...v.execution,
1361
1379
  status: "error",
1362
1380
  error: "Connection closed unexpectedly"
1363
1381
  }
@@ -1572,46 +1590,46 @@ const N = Ve()(
1572
1590
  return t({ savedWorkflows: [...a, s] }), u;
1573
1591
  },
1574
1592
  loadGeneratedWorkflow: (r) => {
1575
- var k, C;
1593
+ var y, C;
1576
1594
  const a = /* @__PURE__ */ new Map(), i = 300, m = 180, u = /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Map();
1577
1595
  for (const h of r.nodes)
1578
1596
  u.set(h.id, []), s.set(h.id, []);
1579
1597
  for (const h of r.edges)
1580
- (k = u.get(h.target)) == null || k.push(h.source), (C = s.get(h.source)) == null || C.push(h.target);
1598
+ (y = u.get(h.target)) == null || y.push(h.source), (C = s.get(h.source)) == null || C.push(h.target);
1581
1599
  const p = /* @__PURE__ */ new Map(), c = /* @__PURE__ */ new Set();
1582
1600
  function l(h) {
1583
1601
  if (p.has(h)) return p.get(h);
1584
1602
  if (c.has(h)) return 0;
1585
1603
  c.add(h);
1586
- const v = u.get(h) || [];
1587
- if (v.length === 0)
1604
+ const w = u.get(h) || [];
1605
+ if (w.length === 0)
1588
1606
  return p.set(h, 0), 0;
1589
- const T = Math.max(...v.map(l)) + 1;
1590
- return p.set(h, T), T;
1607
+ const L = Math.max(...w.map(l)) + 1;
1608
+ return p.set(h, L), L;
1591
1609
  }
1592
1610
  for (const h of r.nodes)
1593
1611
  l(h.id);
1594
1612
  const f = /* @__PURE__ */ new Map();
1595
1613
  for (const h of r.nodes) {
1596
- const v = p.get(h.id) || 0;
1597
- f.has(v) || f.set(v, []), f.get(v).push(h.id);
1614
+ const w = p.get(h.id) || 0;
1615
+ f.has(w) || f.set(w, []), f.get(w).push(h.id);
1598
1616
  }
1599
1617
  const g = /* @__PURE__ */ new Map();
1600
- for (const [h, v] of f) {
1601
- const y = v.length * m, T = 100 + (y > m ? -y / 4 : 0);
1602
- v.forEach((_, L) => {
1618
+ for (const [h, w] of f) {
1619
+ const k = w.length * m, L = 100 + (k > m ? -k / 4 : 0);
1620
+ w.forEach((_, W) => {
1603
1621
  g.set(_, {
1604
1622
  x: 100 + h * i,
1605
- y: T + L * m
1623
+ y: L + W * m
1606
1624
  });
1607
1625
  });
1608
1626
  }
1609
- const w = r.nodes.map((h) => {
1610
- const v = me();
1611
- a.set(h.id, v);
1612
- const y = h.nodeType.split(":"), T = g.get(h.id) || { x: 100, y: 100 };
1613
- if (y[0] === "flow") {
1614
- const x = y[1];
1627
+ const v = r.nodes.map((h) => {
1628
+ const w = me();
1629
+ a.set(h.id, w);
1630
+ const k = h.nodeType.split(":"), L = g.get(h.id) || { x: 100, y: 100 };
1631
+ if (k[0] === "flow") {
1632
+ const x = k[1];
1615
1633
  let S;
1616
1634
  return x === "fanout" ? S = {
1617
1635
  mode: h.parameters.mode || "count",
@@ -1626,17 +1644,17 @@ const N = Ve()(
1626
1644
  outputCount: 1,
1627
1645
  contextProperty: h.parameters.contextProperty
1628
1646
  }, {
1629
- id: v,
1647
+ id: w,
1630
1648
  type: x,
1631
- position: T,
1649
+ position: L,
1632
1650
  data: S
1633
1651
  };
1634
1652
  }
1635
- const _ = y[0];
1636
- let L;
1653
+ const _ = k[0];
1654
+ let W;
1637
1655
  if (_ === "generator") {
1638
- const x = y.slice(1).join(":"), S = o().generators.find((I) => I.name === x);
1639
- L = {
1656
+ const x = k.slice(1).join(":"), S = o().generators.find((I) => I.name === x);
1657
+ W = {
1640
1658
  generatorName: x,
1641
1659
  params: h.parameters,
1642
1660
  isAI: (S == null ? void 0 : S.isAI) ?? !0,
@@ -1645,10 +1663,10 @@ const N = Ve()(
1645
1663
  maxReferenceImages: S == null ? void 0 : S.maxReferenceImages
1646
1664
  };
1647
1665
  } else if (_ === "transform") {
1648
- const x = y[1], S = y.slice(2).join(":"), I = o().transforms.find(
1649
- (O) => O.providerName === x && O.name === S
1666
+ const x = k[1], S = k.slice(2).join(":"), I = o().transforms.find(
1667
+ (D) => D.providerName === x && D.name === S
1650
1668
  );
1651
- L = {
1669
+ W = {
1652
1670
  operation: S,
1653
1671
  providerName: x,
1654
1672
  params: h.parameters,
@@ -1657,22 +1675,22 @@ const N = Ve()(
1657
1675
  maxReferenceImages: I == null ? void 0 : I.maxReferenceImages
1658
1676
  };
1659
1677
  } else if (_ === "input")
1660
- L = {
1678
+ W = {
1661
1679
  uploadId: void 0,
1662
1680
  filename: void 0,
1663
1681
  mime: void 0
1664
1682
  };
1665
1683
  else if (_ === "vision")
1666
- L = {
1667
- providerName: y.slice(1).join(":"),
1684
+ W = {
1685
+ providerName: k.slice(1).join(":"),
1668
1686
  params: h.parameters
1669
1687
  };
1670
1688
  else if (_ === "text") {
1671
- const x = y.slice(1).join(":"), S = h.parameters.jsonSchema, I = S != null && S.properties ? {
1689
+ const x = k.slice(1).join(":"), S = h.parameters.jsonSchema, I = S != null && S.properties ? {
1672
1690
  type: "object",
1673
1691
  properties: Object.fromEntries(
1674
- Object.entries(S.properties).map(([O, B]) => [
1675
- O,
1692
+ Object.entries(S.properties).map(([D, B]) => [
1693
+ D,
1676
1694
  {
1677
1695
  type: B.type || "string",
1678
1696
  description: B.description
@@ -1680,34 +1698,34 @@ const N = Ve()(
1680
1698
  ])
1681
1699
  )
1682
1700
  } : void 0;
1683
- L = {
1701
+ W = {
1684
1702
  providerName: x,
1685
1703
  params: h.parameters,
1686
1704
  outputSchema: I
1687
1705
  };
1688
1706
  } else
1689
- L = {
1707
+ W = {
1690
1708
  destination: h.parameters.destination || "./output/image.png",
1691
1709
  provider: h.parameters.provider || "filesystem"
1692
1710
  };
1693
1711
  return {
1694
- id: v,
1712
+ id: w,
1695
1713
  type: _,
1696
- position: T,
1697
- data: L
1714
+ position: L,
1715
+ data: W
1698
1716
  };
1699
1717
  }), b = r.edges.map((h) => {
1700
- const v = a.get(h.source) || h.source, y = a.get(h.target) || h.target, T = [h.sourceHandle, h.targetHandle].filter(Boolean).join("_");
1718
+ const w = a.get(h.source) || h.source, k = a.get(h.target) || h.target, L = [h.sourceHandle, h.targetHandle].filter(Boolean).join("_");
1701
1719
  return {
1702
- id: T ? `edge_${v}_${y}_${T}` : `edge_${v}_${y}`,
1703
- source: v,
1704
- target: y,
1720
+ id: L ? `edge_${w}_${k}_${L}` : `edge_${w}_${k}`,
1721
+ source: w,
1722
+ target: k,
1705
1723
  sourceHandle: h.sourceHandle ?? void 0,
1706
1724
  targetHandle: h.targetHandle ?? void 0
1707
1725
  };
1708
1726
  });
1709
1727
  t({
1710
- nodes: w,
1728
+ nodes: v,
1711
1729
  edges: b,
1712
1730
  selectedNodeId: null,
1713
1731
  currentTemplateId: null,
@@ -1829,7 +1847,7 @@ function ze(t) {
1829
1847
  return `${n}m ${r}s`;
1830
1848
  }
1831
1849
  function se({ nodeId: t }) {
1832
- const o = N((i) => i.execution.nodeStatus[t]), n = N((i) => i.execution.nodeTiming[t]), [r, a] = W(0);
1850
+ const o = N((i) => i.execution.nodeStatus[t]), n = N((i) => i.execution.nodeTiming[t]), [r, a] = T(0);
1833
1851
  if (H(() => {
1834
1852
  if (o !== "running" || !(n != null && n.startTime))
1835
1853
  return;
@@ -1853,7 +1871,7 @@ function se({ nodeId: t }) {
1853
1871
  }
1854
1872
  return null;
1855
1873
  }
1856
- function We({ nodeId: t, color: o }) {
1874
+ function Me({ nodeId: t, color: o }) {
1857
1875
  const n = N((a) => a.previewVisible[t] !== !1), r = N((a) => a.togglePreview);
1858
1876
  return /* @__PURE__ */ e(
1859
1877
  "button",
@@ -1906,20 +1924,20 @@ const Kt = oe(function({
1906
1924
  className: `floimg-node floimg-node--generator relative min-w-[190px] overflow-hidden ${r ? "selected" : ""} ${u}`,
1907
1925
  children: [
1908
1926
  s && /* @__PURE__ */ e(
1909
- D,
1927
+ P,
1910
1928
  {
1911
1929
  type: "target",
1912
- position: P.Top,
1930
+ position: O.Top,
1913
1931
  id: "text",
1914
1932
  className: "!w-3 !h-3 !bg-pink-500 !border-2 !border-white dark:!border-zinc-800",
1915
1933
  title: "Text input (optional prompt from text/vision node)"
1916
1934
  }
1917
1935
  ),
1918
1936
  p && /* @__PURE__ */ e(
1919
- D,
1937
+ P,
1920
1938
  {
1921
1939
  type: "target",
1922
- position: P.Left,
1940
+ position: O.Left,
1923
1941
  id: "references",
1924
1942
  className: "!w-3 !h-3 !bg-violet-500 !border-2 !border-white dark:!border-zinc-800",
1925
1943
  style: { top: "50%" },
@@ -1933,7 +1951,7 @@ const Kt = oe(function({
1933
1951
  /* @__PURE__ */ e("div", { className: "floimg-node__icon bg-blue-500/10", children: /* @__PURE__ */ e("div", { className: "w-2 h-2 rounded-full bg-blue-500" }) }),
1934
1952
  /* @__PURE__ */ e("span", { className: "floimg-node__title text-blue-600 dark:text-blue-400", children: n.generatorName }),
1935
1953
  /* @__PURE__ */ e(
1936
- We,
1954
+ Me,
1937
1955
  {
1938
1956
  nodeId: o,
1939
1957
  color: "text-zinc-400 hover:text-zinc-600 dark:hover:text-zinc-300"
@@ -1959,10 +1977,10 @@ const Kt = oe(function({
1959
1977
  ] }, c)) })
1960
1978
  ] }),
1961
1979
  /* @__PURE__ */ e(
1962
- D,
1980
+ P,
1963
1981
  {
1964
1982
  type: "source",
1965
- position: P.Right,
1983
+ position: O.Right,
1966
1984
  className: "!w-3 !h-3 !bg-blue-500 !border-2 !border-white dark:!border-zinc-800"
1967
1985
  }
1968
1986
  )
@@ -1981,29 +1999,29 @@ const Kt = oe(function({
1981
1999
  className: `floimg-node ${s ? "floimg-node--ai-transform" : "floimg-node--transform"} relative min-w-[190px] overflow-hidden ${r ? "selected" : ""} ${u}`,
1982
2000
  children: [
1983
2001
  s && /* @__PURE__ */ e(
1984
- D,
2002
+ P,
1985
2003
  {
1986
2004
  type: "target",
1987
- position: P.Top,
2005
+ position: O.Top,
1988
2006
  id: "text",
1989
2007
  className: "!w-3 !h-3 !bg-pink-500 !border-2 !border-white dark:!border-zinc-800",
1990
2008
  title: "Text input (optional prompt from text/vision node)"
1991
2009
  }
1992
2010
  ),
1993
2011
  /* @__PURE__ */ e(
1994
- D,
2012
+ P,
1995
2013
  {
1996
2014
  type: "target",
1997
- position: P.Left,
2015
+ position: O.Left,
1998
2016
  id: "image",
1999
2017
  className: "!w-3 !h-3 !bg-teal-500 !border-2 !border-white dark:!border-zinc-800"
2000
2018
  }
2001
2019
  ),
2002
2020
  p && /* @__PURE__ */ e(
2003
- D,
2021
+ P,
2004
2022
  {
2005
2023
  type: "target",
2006
- position: P.Bottom,
2024
+ position: O.Bottom,
2007
2025
  id: "references",
2008
2026
  className: "!w-3 !h-3 !bg-violet-500 !border-2 !border-white dark:!border-zinc-800",
2009
2027
  title: `Reference images (up to ${n.maxReferenceImages || 13})`
@@ -2032,7 +2050,7 @@ const Kt = oe(function({
2032
2050
  }
2033
2051
  ),
2034
2052
  /* @__PURE__ */ e(
2035
- We,
2053
+ Me,
2036
2054
  {
2037
2055
  nodeId: o,
2038
2056
  color: "text-zinc-400 hover:text-zinc-600 dark:hover:text-zinc-300"
@@ -2058,10 +2076,10 @@ const Kt = oe(function({
2058
2076
  ] }, l)) })
2059
2077
  ] }),
2060
2078
  /* @__PURE__ */ e(
2061
- D,
2079
+ P,
2062
2080
  {
2063
2081
  type: "source",
2064
- position: P.Right,
2082
+ position: O.Right,
2065
2083
  className: `!w-3 !h-3 ${s ? "!bg-indigo-500" : "!bg-teal-500"} !border-2 !border-white dark:!border-zinc-800`
2066
2084
  }
2067
2085
  )
@@ -2076,10 +2094,10 @@ const Kt = oe(function({
2076
2094
  className: `floimg-node floimg-node--save relative min-w-[190px] ${r ? "selected" : ""} ${i}`,
2077
2095
  children: [
2078
2096
  /* @__PURE__ */ e(
2079
- D,
2097
+ P,
2080
2098
  {
2081
2099
  type: "target",
2082
- position: P.Left,
2100
+ position: O.Left,
2083
2101
  className: "!w-3 !h-3 !bg-emerald-500 !border-2 !border-white dark:!border-zinc-800"
2084
2102
  }
2085
2103
  ),
@@ -2106,22 +2124,22 @@ const Kt = oe(function({
2106
2124
  const a = N((b) => b.execution.previews[o]), i = N((b) => b.execution.nodeStatus[o]), m = N((b) => b.previewVisible[o] !== !1), u = N((b) => b.updateNodeData), s = te(null), p = ie(i), c = M(
2107
2125
  async (b) => {
2108
2126
  try {
2109
- const k = await It(b);
2127
+ const y = await It(b);
2110
2128
  u(o, {
2111
- uploadId: k.id,
2112
- filename: k.filename,
2113
- mime: k.mime
2129
+ uploadId: y.id,
2130
+ filename: y.filename,
2131
+ mime: y.mime
2114
2132
  });
2115
- } catch (k) {
2116
- console.error("Upload failed:", k);
2133
+ } catch (y) {
2134
+ console.error("Upload failed:", y);
2117
2135
  }
2118
2136
  },
2119
2137
  [o, u]
2120
2138
  ), l = M(
2121
2139
  (b) => {
2122
2140
  b.preventDefault(), b.stopPropagation();
2123
- const k = b.dataTransfer.files[0];
2124
- k && k.type.startsWith("image/") && c(k);
2141
+ const y = b.dataTransfer.files[0];
2142
+ y && y.type.startsWith("image/") && c(y);
2125
2143
  },
2126
2144
  [c]
2127
2145
  ), f = M((b) => {
@@ -2129,11 +2147,11 @@ const Kt = oe(function({
2129
2147
  }, []), g = M(
2130
2148
  (b) => {
2131
2149
  var C;
2132
- const k = (C = b.target.files) == null ? void 0 : C[0];
2133
- k && c(k);
2150
+ const y = (C = b.target.files) == null ? void 0 : C[0];
2151
+ y && c(y);
2134
2152
  },
2135
2153
  [c]
2136
- ), w = a || (n.uploadId ? Ke(n.uploadId) : null);
2154
+ ), v = a || (n.uploadId ? Ke(n.uploadId) : null);
2137
2155
  return /* @__PURE__ */ d(
2138
2156
  "div",
2139
2157
  {
@@ -2141,7 +2159,7 @@ const Kt = oe(function({
2141
2159
  onDrop: l,
2142
2160
  onDragOver: f,
2143
2161
  children: [
2144
- w && m ? /* @__PURE__ */ e("div", { className: "floimg-node__preview", children: /* @__PURE__ */ e("img", { src: w, alt: "Uploaded", className: "w-full h-20 object-contain rounded-md" }) }) : w ? null : /* @__PURE__ */ e(
2162
+ v && m ? /* @__PURE__ */ e("div", { className: "floimg-node__preview", children: /* @__PURE__ */ e("img", { src: v, alt: "Uploaded", className: "w-full h-20 object-contain rounded-md" }) }) : v ? null : /* @__PURE__ */ e(
2145
2163
  "div",
2146
2164
  {
2147
2165
  className: "h-20 flex items-center justify-center cursor-pointer bg-amber-50/50 dark:bg-amber-900/20 hover:bg-amber-100/50 dark:hover:bg-amber-900/30 transition-colors border-b border-amber-100/50 dark:border-amber-800/30",
@@ -2205,7 +2223,7 @@ const Kt = oe(function({
2205
2223
  ) }),
2206
2224
  /* @__PURE__ */ e("span", { className: "floimg-node__title text-amber-600 dark:text-amber-400", children: "Input" }),
2207
2225
  /* @__PURE__ */ e(
2208
- We,
2226
+ Me,
2209
2227
  {
2210
2228
  nodeId: o,
2211
2229
  color: "text-zinc-400 hover:text-zinc-600 dark:hover:text-zinc-300"
@@ -2214,10 +2232,10 @@ const Kt = oe(function({
2214
2232
  ] }),
2215
2233
  /* @__PURE__ */ e("div", { className: "floimg-node__content", children: /* @__PURE__ */ e("div", { className: "floimg-node__param truncate", children: n.filename || "No image selected" }) }),
2216
2234
  /* @__PURE__ */ e(
2217
- D,
2235
+ P,
2218
2236
  {
2219
2237
  type: "source",
2220
- position: P.Right,
2238
+ position: O.Right,
2221
2239
  className: "!w-3 !h-3 !bg-amber-500 !border-2 !border-white dark:!border-zinc-800"
2222
2240
  }
2223
2241
  )
@@ -2231,8 +2249,8 @@ const Kt = oe(function({
2231
2249
  }) {
2232
2250
  var c, l, f;
2233
2251
  const a = N((g) => g.execution.nodeStatus[o]), i = N((g) => {
2234
- var w;
2235
- return (w = g.execution.dataOutputs) == null ? void 0 : w[o];
2252
+ var v;
2253
+ return (v = g.execution.dataOutputs) == null ? void 0 : v[o];
2236
2254
  }), m = N((g) => g.openOutputInspector), u = ie(a), s = (c = n.outputSchema) != null && c.properties ? Object.entries(n.outputSchema.properties) : [], p = s.length > 0;
2237
2255
  return /* @__PURE__ */ d(
2238
2256
  "div",
@@ -2240,20 +2258,20 @@ const Kt = oe(function({
2240
2258
  className: `floimg-node floimg-node--vision relative min-w-[190px] overflow-hidden ${r ? "selected" : ""} ${u}`,
2241
2259
  children: [
2242
2260
  /* @__PURE__ */ e(
2243
- D,
2261
+ P,
2244
2262
  {
2245
2263
  type: "target",
2246
- position: P.Top,
2264
+ position: O.Top,
2247
2265
  id: "context",
2248
2266
  className: "!w-3 !h-3 !bg-pink-500 !border-2 !border-white dark:!border-zinc-800",
2249
2267
  title: "Context input (optional - from text/vision node for evaluation context)"
2250
2268
  }
2251
2269
  ),
2252
2270
  /* @__PURE__ */ e(
2253
- D,
2271
+ P,
2254
2272
  {
2255
2273
  type: "target",
2256
- position: P.Left,
2274
+ position: O.Left,
2257
2275
  id: "image",
2258
2276
  className: "!w-3 !h-3 !bg-cyan-500 !border-2 !border-white dark:!border-zinc-800",
2259
2277
  title: "Image input"
@@ -2298,7 +2316,7 @@ const Kt = oe(function({
2298
2316
  ] }) : null,
2299
2317
  p && /* @__PURE__ */ d("div", { className: "mt-2 pt-2 border-t border-zinc-100 dark:border-zinc-700/50", children: [
2300
2318
  /* @__PURE__ */ e("div", { className: "text-[10px] text-cyan-500 dark:text-cyan-400 font-medium mb-1", children: "Outputs:" }),
2301
- s.map(([g]) => /* @__PURE__ */ d(
2319
+ s.slice(0, 3).map(([g]) => /* @__PURE__ */ d(
2302
2320
  "div",
2303
2321
  {
2304
2322
  className: "text-[10px] text-zinc-500 dark:text-zinc-400 flex items-center gap-1",
@@ -2308,40 +2326,45 @@ const Kt = oe(function({
2308
2326
  ]
2309
2327
  },
2310
2328
  g
2311
- ))
2329
+ )),
2330
+ s.length > 3 && /* @__PURE__ */ d("div", { className: "text-[10px] text-zinc-400 dark:text-zinc-500 mt-0.5", children: [
2331
+ "+",
2332
+ s.length - 3,
2333
+ " more"
2334
+ ] })
2312
2335
  ] })
2313
2336
  ] }),
2314
2337
  p ? /* @__PURE__ */ d(J, { children: [
2315
2338
  /* @__PURE__ */ e(
2316
- D,
2339
+ P,
2317
2340
  {
2318
2341
  type: "source",
2319
- position: P.Right,
2342
+ position: O.Right,
2320
2343
  id: "output",
2321
2344
  className: "!w-3 !h-3 !bg-cyan-500 !border-2 !border-white dark:!border-zinc-800",
2322
2345
  style: { top: "50%" },
2323
2346
  title: "Full JSON output"
2324
2347
  }
2325
2348
  ),
2326
- s.map(([g, w], b) => /* @__PURE__ */ e(
2327
- D,
2349
+ s.map(([g, v], b) => /* @__PURE__ */ e(
2350
+ P,
2328
2351
  {
2329
2352
  type: "source",
2330
- position: P.Right,
2353
+ position: O.Right,
2331
2354
  id: `output.${g}`,
2332
2355
  className: "!w-2.5 !h-2.5 !bg-cyan-400 !border-2 !border-white dark:!border-zinc-800",
2333
2356
  style: {
2334
2357
  top: `${70 + b * 14}%`
2335
2358
  },
2336
- title: `${g}: ${w.description || w.type}`
2359
+ title: `${g}: ${v.description || v.type}`
2337
2360
  },
2338
2361
  g
2339
2362
  ))
2340
2363
  ] }) : /* @__PURE__ */ e(
2341
- D,
2364
+ P,
2342
2365
  {
2343
2366
  type: "source",
2344
- position: P.Right,
2367
+ position: O.Right,
2345
2368
  className: "!w-3 !h-3 !bg-cyan-500 !border-2 !border-white dark:!border-zinc-800"
2346
2369
  }
2347
2370
  )
@@ -2351,8 +2374,8 @@ const Kt = oe(function({
2351
2374
  }), Qt = oe(function({ id: o, data: n, selected: r }) {
2352
2375
  var c, l, f;
2353
2376
  const a = N((g) => g.execution.nodeStatus[o]), i = N((g) => {
2354
- var w;
2355
- return (w = g.execution.dataOutputs) == null ? void 0 : w[o];
2377
+ var v;
2378
+ return (v = g.execution.dataOutputs) == null ? void 0 : v[o];
2356
2379
  }), m = N((g) => g.openOutputInspector), u = ie(a), s = (c = n.outputSchema) != null && c.properties ? Object.entries(n.outputSchema.properties) : [], p = s.length > 0;
2357
2380
  return /* @__PURE__ */ d(
2358
2381
  "div",
@@ -2360,10 +2383,10 @@ const Kt = oe(function({
2360
2383
  className: `floimg-node floimg-node--text relative min-w-[190px] overflow-hidden ${r ? "selected" : ""} ${u}`,
2361
2384
  children: [
2362
2385
  /* @__PURE__ */ e(
2363
- D,
2386
+ P,
2364
2387
  {
2365
2388
  type: "target",
2366
- position: P.Left,
2389
+ position: O.Left,
2367
2390
  className: "!w-3 !h-3 !bg-pink-500 !border-2 !border-white dark:!border-zinc-800"
2368
2391
  }
2369
2392
  ),
@@ -2403,7 +2426,7 @@ const Kt = oe(function({
2403
2426
  ] }) : null,
2404
2427
  p && /* @__PURE__ */ d("div", { className: "mt-2 pt-2 border-t border-zinc-100 dark:border-zinc-700/50", children: [
2405
2428
  /* @__PURE__ */ e("div", { className: "text-[10px] text-pink-500 dark:text-pink-400 font-medium mb-1", children: "Outputs:" }),
2406
- s.map(([g]) => /* @__PURE__ */ d(
2429
+ s.slice(0, 3).map(([g]) => /* @__PURE__ */ d(
2407
2430
  "div",
2408
2431
  {
2409
2432
  className: "text-[10px] text-zinc-500 dark:text-zinc-400 flex items-center gap-1",
@@ -2413,40 +2436,45 @@ const Kt = oe(function({
2413
2436
  ]
2414
2437
  },
2415
2438
  g
2416
- ))
2439
+ )),
2440
+ s.length > 3 && /* @__PURE__ */ d("div", { className: "text-[10px] text-zinc-400 dark:text-zinc-500 mt-0.5", children: [
2441
+ "+",
2442
+ s.length - 3,
2443
+ " more"
2444
+ ] })
2417
2445
  ] })
2418
2446
  ] }),
2419
2447
  p ? /* @__PURE__ */ d(J, { children: [
2420
2448
  /* @__PURE__ */ e(
2421
- D,
2449
+ P,
2422
2450
  {
2423
2451
  type: "source",
2424
- position: P.Right,
2452
+ position: O.Right,
2425
2453
  id: "output",
2426
2454
  className: "!w-3 !h-3 !bg-pink-500 !border-2 !border-white dark:!border-zinc-800",
2427
2455
  style: { top: "50%" },
2428
2456
  title: "Full JSON output"
2429
2457
  }
2430
2458
  ),
2431
- s.map(([g, w], b) => /* @__PURE__ */ e(
2432
- D,
2459
+ s.map(([g, v], b) => /* @__PURE__ */ e(
2460
+ P,
2433
2461
  {
2434
2462
  type: "source",
2435
- position: P.Right,
2463
+ position: O.Right,
2436
2464
  id: `output.${g}`,
2437
2465
  className: "!w-2.5 !h-2.5 !bg-pink-400 !border-2 !border-white dark:!border-zinc-800",
2438
2466
  style: {
2439
2467
  top: `${70 + b * 14}%`
2440
2468
  },
2441
- title: `${g}: ${w.description || w.type}`
2469
+ title: `${g}: ${v.description || v.type}`
2442
2470
  },
2443
2471
  g
2444
2472
  ))
2445
2473
  ] }) : /* @__PURE__ */ e(
2446
- D,
2474
+ P,
2447
2475
  {
2448
2476
  type: "source",
2449
- position: P.Right,
2477
+ position: O.Right,
2450
2478
  className: "!w-3 !h-3 !bg-pink-500 !border-2 !border-white dark:!border-zinc-800"
2451
2479
  }
2452
2480
  )
@@ -2465,10 +2493,10 @@ const Kt = oe(function({
2465
2493
  className: `floimg-node floimg-node--iterative relative min-w-[170px] overflow-hidden ${r ? "selected" : ""} ${i}`,
2466
2494
  children: [
2467
2495
  /* @__PURE__ */ e(
2468
- D,
2496
+ P,
2469
2497
  {
2470
2498
  type: "target",
2471
- position: P.Left,
2499
+ position: O.Left,
2472
2500
  id: "input",
2473
2501
  className: "!w-3 !h-3 !bg-orange-500 !border-2 !border-white dark:!border-zinc-800",
2474
2502
  style: { top: "50%" }
@@ -2510,10 +2538,10 @@ const Kt = oe(function({
2510
2538
  " copies"
2511
2539
  ] }) }) }),
2512
2540
  Array.from({ length: m }).map((u, s) => /* @__PURE__ */ e(
2513
- D,
2541
+ P,
2514
2542
  {
2515
2543
  type: "source",
2516
- position: P.Right,
2544
+ position: O.Right,
2517
2545
  id: `out[${s}]`,
2518
2546
  className: "!w-2.5 !h-2.5 !bg-orange-400 !border-2 !border-white dark:!border-zinc-800",
2519
2547
  style: {
@@ -2538,10 +2566,10 @@ const Kt = oe(function({
2538
2566
  className: `floimg-node floimg-node--iterative relative min-w-[170px] overflow-hidden ${r ? "selected" : ""} ${i}`,
2539
2567
  children: [
2540
2568
  Array.from({ length: m }).map((u, s) => /* @__PURE__ */ e(
2541
- D,
2569
+ P,
2542
2570
  {
2543
2571
  type: "target",
2544
- position: P.Left,
2572
+ position: O.Left,
2545
2573
  id: `in[${s}]`,
2546
2574
  className: "!w-2.5 !h-2.5 !bg-orange-400 !border-2 !border-white dark:!border-zinc-800",
2547
2575
  style: {
@@ -2580,10 +2608,10 @@ const Kt = oe(function({
2580
2608
  ] }),
2581
2609
  /* @__PURE__ */ e("div", { className: "floimg-node__content", children: /* @__PURE__ */ e("div", { className: "floimg-node__param", children: n.waitMode === "all" ? "Wait for all" : "Use available" }) }),
2582
2610
  /* @__PURE__ */ e(
2583
- D,
2611
+ P,
2584
2612
  {
2585
2613
  type: "source",
2586
- position: P.Right,
2614
+ position: O.Right,
2587
2615
  id: "output",
2588
2616
  className: "!w-3 !h-3 !bg-orange-500 !border-2 !border-white dark:!border-zinc-800",
2589
2617
  style: { top: "50%" }
@@ -2604,10 +2632,10 @@ const Kt = oe(function({
2604
2632
  className: `floimg-node floimg-node--iterative relative min-w-[170px] overflow-hidden ${r ? "selected" : ""} ${i}`,
2605
2633
  children: [
2606
2634
  /* @__PURE__ */ e(
2607
- D,
2635
+ P,
2608
2636
  {
2609
2637
  type: "target",
2610
- position: P.Left,
2638
+ position: O.Left,
2611
2639
  id: "candidates",
2612
2640
  className: "!w-3 !h-3 !bg-amber-500 !border-2 !border-white dark:!border-zinc-800",
2613
2641
  style: { top: "35%" },
@@ -2615,10 +2643,10 @@ const Kt = oe(function({
2615
2643
  }
2616
2644
  ),
2617
2645
  /* @__PURE__ */ e(
2618
- D,
2646
+ P,
2619
2647
  {
2620
2648
  type: "target",
2621
- position: P.Left,
2649
+ position: O.Left,
2622
2650
  id: "selection",
2623
2651
  className: "!w-3 !h-3 !bg-cyan-500 !border-2 !border-white dark:!border-zinc-800",
2624
2652
  style: { top: "65%" },
@@ -2666,10 +2694,10 @@ const Kt = oe(function({
2666
2694
  ] }) })
2667
2695
  ] }),
2668
2696
  /* @__PURE__ */ e(
2669
- D,
2697
+ P,
2670
2698
  {
2671
2699
  type: "source",
2672
- position: P.Right,
2700
+ position: O.Right,
2673
2701
  id: "winner",
2674
2702
  className: "!w-3 !h-3 !bg-amber-500 !border-2 !border-white dark:!border-zinc-800",
2675
2703
  style: { top: m ? "35%" : "50%" },
@@ -2677,10 +2705,10 @@ const Kt = oe(function({
2677
2705
  }
2678
2706
  ),
2679
2707
  m && /* @__PURE__ */ e(
2680
- D,
2708
+ P,
2681
2709
  {
2682
2710
  type: "source",
2683
- position: P.Right,
2711
+ position: O.Right,
2684
2712
  id: "context",
2685
2713
  className: "!w-3 !h-3 !bg-pink-500 !border-2 !border-white dark:!border-zinc-800",
2686
2714
  style: { top: "65%" },
@@ -2721,15 +2749,15 @@ const Kt = oe(function({
2721
2749
  function nr() {
2722
2750
  const t = N((g) => g.nodes), o = N((g) => g.edges), n = N((g) => g.setNodes), r = N((g) => g.setEdges), a = N((g) => g.addEdge), i = N((g) => g.setSelectedNode), m = G(() => tr, []), u = M(
2723
2751
  (g) => {
2724
- const { source: w, target: b, targetHandle: k } = g;
2725
- if (!w || !b) return !1;
2726
- const C = t.find((v) => v.id === w), h = t.find((v) => v.id === b);
2752
+ const { source: v, target: b, targetHandle: y } = g;
2753
+ if (!v || !b) return !1;
2754
+ const C = t.find((w) => w.id === v), h = t.find((w) => w.id === b);
2727
2755
  if (!C || !h || C.type === "save") return !1;
2728
2756
  if (h.type === "generator") {
2729
- const v = h.data;
2730
- return !!(k === "text" && v.isAI || k === "references" && v.acceptsReferenceImages);
2757
+ const w = h.data;
2758
+ return !!(y === "text" && w.isAI || y === "references" && w.acceptsReferenceImages);
2731
2759
  }
2732
- return !(h.type === "input" || w === b);
2760
+ return !(h.type === "input" || v === b);
2733
2761
  },
2734
2762
  [t]
2735
2763
  ), s = M(
@@ -2745,22 +2773,22 @@ function nr() {
2745
2773
  ), c = M(
2746
2774
  (g) => {
2747
2775
  if (!(g.targetHandle === "references")) {
2748
- const b = o.filter((k) => {
2749
- if (k.target !== g.target) return !1;
2750
- const C = k.targetHandle || null, h = g.targetHandle || null;
2751
- return C === h || (g.targetHandle === "text" || g.targetHandle === "image") && !k.targetHandle || !g.targetHandle && k.targetHandle === "image";
2776
+ const b = o.filter((y) => {
2777
+ if (y.target !== g.target) return !1;
2778
+ const C = y.targetHandle || null, h = g.targetHandle || null;
2779
+ return C === h || (g.targetHandle === "text" || g.targetHandle === "image") && !y.targetHandle || !g.targetHandle && y.targetHandle === "image";
2752
2780
  });
2753
2781
  if (b.length > 0) {
2754
- const k = new Set(b.map((C) => C.id));
2755
- r(o.filter((C) => !k.has(C.id)));
2782
+ const y = new Set(b.map((C) => C.id));
2783
+ r(o.filter((C) => !y.has(C.id)));
2756
2784
  }
2757
2785
  }
2758
2786
  a(g);
2759
2787
  },
2760
2788
  [a, o, r]
2761
2789
  ), l = M(
2762
- (g, w) => {
2763
- i(w.id);
2790
+ (g, v) => {
2791
+ i(v.id);
2764
2792
  },
2765
2793
  [i]
2766
2794
  ), f = M(() => {
@@ -2806,7 +2834,7 @@ function nr() {
2806
2834
  ) });
2807
2835
  }
2808
2836
  function or({ onSelect: t }) {
2809
- const [o, n] = W([]), [r, a] = W(!0), [i, m] = W(null), u = async () => {
2837
+ const [o, n] = T([]), [r, a] = T(!0), [i, m] = T(null), u = async () => {
2810
2838
  try {
2811
2839
  a(!0);
2812
2840
  const c = await Lt();
@@ -2916,7 +2944,7 @@ function re({
2916
2944
  );
2917
2945
  }
2918
2946
  function ar() {
2919
- const t = N((x) => x.setGenerators), o = N((x) => x.setTransforms), n = N((x) => x.setTextProviders), r = N((x) => x.setVisionProviders), a = N((x) => x.generators), i = N((x) => x.transforms), m = N((x) => x.textProviders), u = N((x) => x.visionProviders), s = N((x) => x.addNode), [p, c] = W(!1), { data: l } = be({
2947
+ const t = N((x) => x.setGenerators), o = N((x) => x.setTransforms), n = N((x) => x.setTextProviders), r = N((x) => x.setVisionProviders), a = N((x) => x.generators), i = N((x) => x.transforms), m = N((x) => x.textProviders), u = N((x) => x.visionProviders), s = N((x) => x.addNode), [p, c] = T(!1), { data: l } = be({
2920
2948
  queryKey: ["generators"],
2921
2949
  queryFn: yt
2922
2950
  }), { data: f } = be({
@@ -2925,7 +2953,7 @@ function ar() {
2925
2953
  }), { data: g } = be({
2926
2954
  queryKey: ["textProviders"],
2927
2955
  queryFn: zt
2928
- }), { data: w } = be({
2956
+ }), { data: v } = be({
2929
2957
  queryKey: ["visionProviders"],
2930
2958
  queryFn: Ct
2931
2959
  });
@@ -2936,11 +2964,11 @@ function ar() {
2936
2964
  }, [f, o]), H(() => {
2937
2965
  g && n(g);
2938
2966
  }, [g, n]), H(() => {
2939
- w && r(w);
2940
- }, [w, r]);
2967
+ v && r(v);
2968
+ }, [v, r]);
2941
2969
  const b = (x, S) => {
2942
2970
  x.dataTransfer.setData("application/json", JSON.stringify(S)), x.dataTransfer.effectAllowed = "move";
2943
- }, k = (x) => {
2971
+ }, y = (x) => {
2944
2972
  s(x, { x: 250, y: 150 + Math.random() * 100 });
2945
2973
  }, C = {
2946
2974
  id: "input:upload",
@@ -2974,7 +3002,7 @@ function ar() {
2974
3002
  }
2975
3003
  }
2976
3004
  }
2977
- }, v = {
3005
+ }, w = {
2978
3006
  id: "fanout:default",
2979
3007
  type: "fanout",
2980
3008
  name: "fanout",
@@ -3006,7 +3034,7 @@ function ar() {
3006
3034
  }
3007
3035
  }
3008
3036
  }
3009
- }, y = {
3037
+ }, k = {
3010
3038
  id: "collect:default",
3011
3039
  type: "collect",
3012
3040
  name: "collect",
@@ -3033,7 +3061,7 @@ function ar() {
3033
3061
  }
3034
3062
  }
3035
3063
  }
3036
- }, T = {
3064
+ }, L = {
3037
3065
  id: "router:default",
3038
3066
  type: "router",
3039
3067
  name: "router",
@@ -3077,7 +3105,7 @@ function ar() {
3077
3105
  return x[I] || (x[I] = []), x[I].push(S), x;
3078
3106
  },
3079
3107
  {}
3080
- ), L = i.reduce(
3108
+ ), W = i.reduce(
3081
3109
  (x, S) => {
3082
3110
  const I = S.category || "Other";
3083
3111
  return x[I] || (x[I] = []), x[I].push(S), x;
@@ -3108,7 +3136,7 @@ function ar() {
3108
3136
  definition: C,
3109
3137
  colorVariant: "amber",
3110
3138
  onDragStart: b,
3111
- onDoubleClick: k
3139
+ onDoubleClick: y
3112
3140
  }
3113
3141
  ),
3114
3142
  p && /* @__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(or, {}) })
@@ -3123,7 +3151,7 @@ function ar() {
3123
3151
  definition: I,
3124
3152
  colorVariant: "blue",
3125
3153
  onDragStart: b,
3126
- onDoubleClick: k
3154
+ onDoubleClick: y
3127
3155
  },
3128
3156
  I.id
3129
3157
  ))
@@ -3131,7 +3159,7 @@ function ar() {
3131
3159
  ] }),
3132
3160
  /* @__PURE__ */ d("div", { className: "floimg-sidebar__section", children: [
3133
3161
  /* @__PURE__ */ e("h3", { className: "floimg-sidebar__header !text-teal-600 dark:!text-teal-400", children: "Transforms" }),
3134
- Object.entries(L).map(([x, S]) => /* @__PURE__ */ d("div", { className: "mb-3", children: [
3162
+ Object.entries(W).map(([x, S]) => /* @__PURE__ */ d("div", { className: "mb-3", children: [
3135
3163
  /* @__PURE__ */ e("div", { className: "floimg-sidebar__category", children: x }),
3136
3164
  S.map((I) => /* @__PURE__ */ e(
3137
3165
  re,
@@ -3139,7 +3167,7 @@ function ar() {
3139
3167
  definition: I,
3140
3168
  colorVariant: "teal",
3141
3169
  onDragStart: b,
3142
- onDoubleClick: k
3170
+ onDoubleClick: y
3143
3171
  },
3144
3172
  I.id
3145
3173
  ))
@@ -3153,7 +3181,7 @@ function ar() {
3153
3181
  definition: x,
3154
3182
  colorVariant: "pink",
3155
3183
  onDragStart: b,
3156
- onDoubleClick: k
3184
+ onDoubleClick: y
3157
3185
  },
3158
3186
  x.id
3159
3187
  ))
@@ -3166,7 +3194,7 @@ function ar() {
3166
3194
  definition: x,
3167
3195
  colorVariant: "cyan",
3168
3196
  onDragStart: b,
3169
- onDoubleClick: k
3197
+ onDoubleClick: y
3170
3198
  },
3171
3199
  x.id
3172
3200
  ))
@@ -3176,28 +3204,28 @@ function ar() {
3176
3204
  /* @__PURE__ */ e(
3177
3205
  re,
3178
3206
  {
3179
- definition: v,
3207
+ definition: w,
3180
3208
  colorVariant: "orange",
3181
3209
  onDragStart: b,
3182
- onDoubleClick: k
3210
+ onDoubleClick: y
3183
3211
  }
3184
3212
  ),
3185
3213
  /* @__PURE__ */ e(
3186
3214
  re,
3187
3215
  {
3188
- definition: y,
3216
+ definition: k,
3189
3217
  colorVariant: "orange",
3190
3218
  onDragStart: b,
3191
- onDoubleClick: k
3219
+ onDoubleClick: y
3192
3220
  }
3193
3221
  ),
3194
3222
  /* @__PURE__ */ e(
3195
3223
  re,
3196
3224
  {
3197
- definition: T,
3225
+ definition: L,
3198
3226
  colorVariant: "amber",
3199
3227
  onDragStart: b,
3200
- onDoubleClick: k
3228
+ onDoubleClick: y
3201
3229
  }
3202
3230
  )
3203
3231
  ] }),
@@ -3209,45 +3237,45 @@ function ar() {
3209
3237
  definition: h,
3210
3238
  colorVariant: "emerald",
3211
3239
  onDragStart: b,
3212
- onDoubleClick: k
3240
+ onDoubleClick: y
3213
3241
  }
3214
3242
  )
3215
3243
  ] })
3216
3244
  ] }),
3217
3245
  /* @__PURE__ */ e("div", { className: "px-4 py-2 mt-auto border-t border-gray-200 dark:border-zinc-700", children: /* @__PURE__ */ d("div", { className: "text-xs text-gray-400 dark:text-zinc-500", children: [
3218
3246
  "FloImg Studio v",
3219
- "0.9.0",
3247
+ "0.9.2",
3220
3248
  !1
3221
3249
  ] }) })
3222
3250
  ] });
3223
3251
  }
3224
3252
  function ir() {
3225
- var w, b, k, C;
3253
+ var v, b, y, C;
3226
3254
  const t = N((h) => h.selectedNodeId), o = N((h) => h.nodes), n = N((h) => h.generators), r = N((h) => h.transforms), a = N((h) => h.textProviders), i = N((h) => h.visionProviders), m = N((h) => h.updateNodeData), u = N((h) => h.deleteNode), s = o.find((h) => h.id === t);
3227
3255
  if (!s)
3228
3256
  return null;
3229
3257
  let p, c = "";
3230
3258
  if (s.type === "generator") {
3231
- const h = s.data, v = n.find((y) => y.name === h.generatorName);
3232
- p = (w = v == null ? void 0 : v.params) == null ? void 0 : w.properties, c = (v == null ? void 0 : v.label) || h.generatorName;
3259
+ const h = s.data, w = n.find((k) => k.name === h.generatorName);
3260
+ p = (v = w == null ? void 0 : w.params) == null ? void 0 : v.properties, c = (w == null ? void 0 : w.label) || h.generatorName;
3233
3261
  } else if (s.type === "transform") {
3234
- const h = s.data, v = r.find((y) => y.name === h.operation);
3235
- p = (b = v == null ? void 0 : v.params) == null ? void 0 : b.properties, c = (v == null ? void 0 : v.label) || h.operation;
3262
+ const h = s.data, w = r.find((k) => k.name === h.operation);
3263
+ p = (b = w == null ? void 0 : w.params) == null ? void 0 : b.properties, c = (w == null ? void 0 : w.label) || h.operation;
3236
3264
  } else if (s.type === "save") {
3237
- const v = s.data.provider === "cloud";
3238
- c = v ? "Save to FloImg Cloud" : "Save", p = {
3265
+ const w = s.data.provider === "cloud";
3266
+ c = w ? "Save to FloImg Cloud" : "Save", p = {
3239
3267
  destination: {
3240
3268
  type: "string",
3241
- title: v ? "Filename" : "Destination",
3242
- description: v ? "Filename for cloud storage" : "File path to save the image"
3269
+ title: w ? "Filename" : "Destination",
3270
+ description: w ? "Filename for cloud storage" : "File path to save the image"
3243
3271
  }
3244
3272
  };
3245
3273
  } else if (s.type === "text") {
3246
- const h = s.data, v = a.find((y) => y.name === h.providerName);
3247
- p = (k = v == null ? void 0 : v.params) == null ? void 0 : k.properties, c = (v == null ? void 0 : v.label) || h.providerName;
3274
+ const h = s.data, w = a.find((k) => k.name === h.providerName);
3275
+ p = (y = w == null ? void 0 : w.params) == null ? void 0 : y.properties, c = (w == null ? void 0 : w.label) || h.providerName;
3248
3276
  } else if (s.type === "vision") {
3249
- const h = s.data, v = i.find((y) => y.name === h.providerName);
3250
- p = (C = v == null ? void 0 : v.params) == null ? void 0 : C.properties, c = (v == null ? void 0 : v.label) || h.providerName;
3277
+ const h = s.data, w = i.find((k) => k.name === h.providerName);
3278
+ p = (C = w == null ? void 0 : w.params) == null ? void 0 : C.properties, c = (w == null ? void 0 : w.label) || h.providerName;
3251
3279
  } else s.type === "fanout" ? (c = "Fan-Out", p = {
3252
3280
  mode: {
3253
3281
  type: "string",
@@ -3306,30 +3334,30 @@ function ir() {
3306
3334
  description: "Optional property to pass through (e.g., 'refinement')"
3307
3335
  }
3308
3336
  });
3309
- const l = (h, v) => {
3337
+ const l = (h, w) => {
3310
3338
  if (s.type === "generator") {
3311
- const y = s.data;
3339
+ const k = s.data;
3312
3340
  m(s.id, {
3313
- params: { ...y.params, [h]: v }
3341
+ params: { ...k.params, [h]: w }
3314
3342
  });
3315
3343
  } else if (s.type === "transform") {
3316
- const y = s.data;
3344
+ const k = s.data;
3317
3345
  m(s.id, {
3318
- params: { ...y.params, [h]: v }
3346
+ params: { ...k.params, [h]: w }
3319
3347
  });
3320
3348
  } else if (s.type === "save")
3321
- m(s.id, { [h]: v });
3349
+ m(s.id, { [h]: w });
3322
3350
  else if (s.type === "text") {
3323
- const y = s.data;
3351
+ const k = s.data;
3324
3352
  m(s.id, {
3325
- params: { ...y.params, [h]: v }
3353
+ params: { ...k.params, [h]: w }
3326
3354
  });
3327
3355
  } else if (s.type === "vision") {
3328
- const y = s.data;
3356
+ const k = s.data;
3329
3357
  m(s.id, {
3330
- params: { ...y.params, [h]: v }
3358
+ params: { ...k.params, [h]: w }
3331
3359
  });
3332
- } else (s.type === "fanout" || s.type === "collect" || s.type === "router") && m(s.id, { [h]: v });
3360
+ } else (s.type === "fanout" || s.type === "collect" || s.type === "router") && m(s.id, { [h]: w });
3333
3361
  }, f = (h) => {
3334
3362
  if (s.type === "generator")
3335
3363
  return s.data.params[h];
@@ -3347,22 +3375,22 @@ function ir() {
3347
3375
  return s.data[h];
3348
3376
  if (s.type === "router")
3349
3377
  return s.data[h];
3350
- }, g = (h, v) => {
3378
+ }, g = (h, w) => {
3351
3379
  if (s.type === "generator" && s.data.generatorName === "shapes") {
3352
- const y = f("shapeType") || "rectangle", T = f("fillType") || "solid";
3353
- if (h === "sides") return y === "polygon";
3354
- if (h === "points" || h === "innerRadius") return y === "star";
3355
- if (h === "cornerRadius") return y === "rectangle";
3356
- if (h === "fillColor") return T === "solid";
3380
+ const k = f("shapeType") || "rectangle", L = f("fillType") || "solid";
3381
+ if (h === "sides") return k === "polygon";
3382
+ if (h === "points" || h === "innerRadius") return k === "star";
3383
+ if (h === "cornerRadius") return k === "rectangle";
3384
+ if (h === "fillColor") return L === "solid";
3357
3385
  if (h === "gradientType" || h === "gradientColor1" || h === "gradientColor2" || h === "gradientAngle")
3358
- return T === "gradient";
3386
+ return L === "gradient";
3359
3387
  if (h === "patternType" || h === "patternColor" || h === "patternBackground" || h === "patternScale")
3360
- return T === "pattern";
3388
+ return L === "pattern";
3361
3389
  }
3362
3390
  if (s.type === "fanout") {
3363
- const y = s.data.mode || "count";
3364
- if (h === "count") return y === "count";
3365
- if (h === "arrayProperty") return y === "array";
3391
+ const k = s.data.mode || "count";
3392
+ if (h === "count") return k === "count";
3393
+ if (h === "arrayProperty") return k === "array";
3366
3394
  }
3367
3395
  return !0;
3368
3396
  };
@@ -3371,13 +3399,13 @@ function ir() {
3371
3399
  /* @__PURE__ */ e("h2", { className: "floimg-inspector__title", children: c }),
3372
3400
  /* @__PURE__ */ e("button", { onClick: () => u(s.id), className: "floimg-inspector__delete", children: "Delete" })
3373
3401
  ] }),
3374
- /* @__PURE__ */ e("div", { className: "space-y-4", children: p && Object.entries(p).filter(([h, v]) => g(h)).map(([h, v]) => /* @__PURE__ */ e(
3402
+ /* @__PURE__ */ e("div", { className: "space-y-4", children: p && Object.entries(p).filter(([h, w]) => g(h)).map(([h, w]) => /* @__PURE__ */ e(
3375
3403
  sr,
3376
3404
  {
3377
3405
  name: h,
3378
- field: v,
3406
+ field: w,
3379
3407
  value: f(h),
3380
- onChange: (y) => l(h, y)
3408
+ onChange: (k) => l(h, k)
3381
3409
  },
3382
3410
  h
3383
3411
  )) }),
@@ -3495,7 +3523,7 @@ function sr({ name: t, field: o, value: n, onChange: r }) {
3495
3523
  ] });
3496
3524
  }
3497
3525
  function lr({ nodeId: t, outputSchema: o, updateNodeData: n }) {
3498
- const [r, a] = W(""), i = (o == null ? void 0 : o.properties) || {}, m = Object.entries(i), u = () => {
3526
+ const [r, a] = T(""), i = (o == null ? void 0 : o.properties) || {}, m = Object.entries(i), u = () => {
3499
3527
  if (!r.trim()) return;
3500
3528
  const l = {
3501
3529
  type: "object",
@@ -3727,21 +3755,21 @@ function gr(t, o) {
3727
3755
  ), !0) : o ? t.some((n) => o.includes(n)) || t.includes("*") : !0;
3728
3756
  }
3729
3757
  const xr = (t, o, n = !1) => {
3730
- const { alt: r, meta: a, mod: i, shift: m, ctrl: u, keys: s, useKey: p } = o, { code: c, key: l, ctrlKey: f, metaKey: g, shiftKey: w, altKey: b } = t, k = de(c);
3758
+ const { alt: r, meta: a, mod: i, shift: m, ctrl: u, keys: s, useKey: p } = o, { code: c, key: l, ctrlKey: f, metaKey: g, shiftKey: v, altKey: b } = t, y = de(c);
3731
3759
  if (p && (s == null ? void 0 : s.length) === 1 && s.includes(l))
3732
3760
  return !0;
3733
- if (!(s != null && s.includes(k)) && !["ctrl", "control", "unknown", "meta", "alt", "shift", "os"].includes(k))
3761
+ if (!(s != null && s.includes(y)) && !["ctrl", "control", "unknown", "meta", "alt", "shift", "os"].includes(y))
3734
3762
  return !1;
3735
3763
  if (!n) {
3736
- if (r !== b && k !== "alt" || m !== w && k !== "shift")
3764
+ if (r !== b && y !== "alt" || m !== v && y !== "shift")
3737
3765
  return !1;
3738
3766
  if (i) {
3739
3767
  if (!g && !f)
3740
3768
  return !1;
3741
- } else if (a !== g && k !== "meta" && k !== "os" || u !== f && k !== "ctrl" && k !== "control")
3769
+ } else if (a !== g && y !== "meta" && y !== "os" || u !== f && y !== "ctrl" && y !== "control")
3742
3770
  return !1;
3743
3771
  }
3744
- return s && s.length === 1 && s.includes(k) ? !0 : s ? cr(s) : !s;
3772
+ return s && s.length === 1 && s.includes(y) ? !0 : s ? cr(s) : !s;
3745
3773
  }, br = He(void 0), vr = () => Be(br);
3746
3774
  function et(t, o) {
3747
3775
  return t && o && typeof t == "object" && typeof o == "object" ? Object.keys(t).length === Object.keys(o).length && // @ts-expect-error TS7053
@@ -3772,27 +3800,27 @@ function zr(t, o, n, r) {
3772
3800
  return Nr(() => {
3773
3801
  if ((l == null ? void 0 : l.enabled) === !1 || !gr(f, l == null ? void 0 : l.scopes))
3774
3802
  return;
3775
- let w = [], b;
3776
- const k = (y, T = !1) => {
3803
+ let v = [], b;
3804
+ const y = (k, L = !1) => {
3777
3805
  var _;
3778
- if (!(hr(y) && !Xe(y, l == null ? void 0 : l.enableOnFormTags))) {
3806
+ if (!(hr(k) && !Xe(k, l == null ? void 0 : l.enableOnFormTags))) {
3779
3807
  if (a.current !== null) {
3780
- const L = a.current.getRootNode();
3781
- if ((L instanceof Document || L instanceof ShadowRoot) && L.activeElement !== a.current && !a.current.contains(L.activeElement)) {
3782
- Re(y);
3808
+ const W = a.current.getRootNode();
3809
+ if ((W instanceof Document || W instanceof ShadowRoot) && W.activeElement !== a.current && !a.current.contains(W.activeElement)) {
3810
+ Re(k);
3783
3811
  return;
3784
3812
  }
3785
3813
  }
3786
- (_ = y.target) != null && _.isContentEditable && !(l != null && l.enableOnContentEditable) || Ce(u, l == null ? void 0 : l.delimiter).forEach((L) => {
3787
- var S, I, O, B;
3788
- if (L.includes((l == null ? void 0 : l.splitKey) ?? "+") && L.includes((l == null ? void 0 : l.sequenceSplitKey) ?? ">")) {
3814
+ (_ = k.target) != null && _.isContentEditable && !(l != null && l.enableOnContentEditable) || Ce(u, l == null ? void 0 : l.delimiter).forEach((W) => {
3815
+ var S, I, D, B;
3816
+ if (W.includes((l == null ? void 0 : l.splitKey) ?? "+") && W.includes((l == null ? void 0 : l.sequenceSplitKey) ?? ">")) {
3789
3817
  console.warn(
3790
- `Hotkey ${L} contains both ${(l == null ? void 0 : l.splitKey) ?? "+"} and ${(l == null ? void 0 : l.sequenceSplitKey) ?? ">"} which is not supported.`
3818
+ `Hotkey ${W} contains both ${(l == null ? void 0 : l.splitKey) ?? "+"} and ${(l == null ? void 0 : l.sequenceSplitKey) ?? ">"} which is not supported.`
3791
3819
  );
3792
3820
  return;
3793
3821
  }
3794
3822
  const x = Se(
3795
- L,
3823
+ W,
3796
3824
  l == null ? void 0 : l.splitKey,
3797
3825
  l == null ? void 0 : l.sequenceSplitKey,
3798
3826
  l == null ? void 0 : l.useKey,
@@ -3800,38 +3828,38 @@ function zr(t, o, n, r) {
3800
3828
  );
3801
3829
  if (x.isSequence) {
3802
3830
  b = setTimeout(() => {
3803
- w = [];
3831
+ v = [];
3804
3832
  }, (l == null ? void 0 : l.sequenceTimeoutMs) ?? 1e3);
3805
- const K = x.useKey ? y.key : de(y.code);
3833
+ const K = x.useKey ? k.key : de(k.code);
3806
3834
  if (Ye(K.toLowerCase()))
3807
3835
  return;
3808
- w.push(K);
3809
- const Q = (S = x.keys) == null ? void 0 : S[w.length - 1];
3836
+ v.push(K);
3837
+ const Q = (S = x.keys) == null ? void 0 : S[v.length - 1];
3810
3838
  if (K !== Q) {
3811
- w = [], b && clearTimeout(b);
3839
+ v = [], b && clearTimeout(b);
3812
3840
  return;
3813
3841
  }
3814
- w.length === ((I = x.keys) == null ? void 0 : I.length) && (c.current(y, x), b && clearTimeout(b), w = []);
3815
- } else if (xr(y, x, l == null ? void 0 : l.ignoreModifiers) || (O = x.keys) != null && O.includes("*")) {
3816
- if ((B = l == null ? void 0 : l.ignoreEventWhen) != null && B.call(l, y) || T && i.current)
3842
+ v.length === ((I = x.keys) == null ? void 0 : I.length) && (c.current(k, x), b && clearTimeout(b), v = []);
3843
+ } else if (xr(k, x, l == null ? void 0 : l.ignoreModifiers) || (D = x.keys) != null && D.includes("*")) {
3844
+ if ((B = l == null ? void 0 : l.ignoreEventWhen) != null && B.call(l, k) || L && i.current)
3817
3845
  return;
3818
- if (mr(y, x, l == null ? void 0 : l.preventDefault), !ur(y, x, l == null ? void 0 : l.enabled)) {
3819
- Re(y);
3846
+ if (mr(k, x, l == null ? void 0 : l.preventDefault), !ur(k, x, l == null ? void 0 : l.enabled)) {
3847
+ Re(k);
3820
3848
  return;
3821
3849
  }
3822
- c.current(y, x), T || (i.current = !0);
3850
+ c.current(k, x), L || (i.current = !0);
3823
3851
  }
3824
3852
  });
3825
3853
  }
3826
- }, C = (y) => {
3827
- y.code !== void 0 && (Qe(de(y.code)), ((l == null ? void 0 : l.keydown) === void 0 && (l == null ? void 0 : l.keyup) !== !0 || l != null && l.keydown) && k(y));
3828
- }, h = (y) => {
3829
- y.code !== void 0 && (Ze(de(y.code)), i.current = !1, l != null && l.keyup && k(y, !0));
3830
- }, v = a.current || (m == null ? void 0 : m.document) || document;
3831
- return v.addEventListener("keyup", h, m == null ? void 0 : m.eventListenerOptions), v.addEventListener("keydown", C, m == null ? void 0 : m.eventListenerOptions), g && Ce(u, l == null ? void 0 : l.delimiter).forEach(
3832
- (y) => g.addHotkey(
3854
+ }, C = (k) => {
3855
+ k.code !== void 0 && (Qe(de(k.code)), ((l == null ? void 0 : l.keydown) === void 0 && (l == null ? void 0 : l.keyup) !== !0 || l != null && l.keydown) && y(k));
3856
+ }, h = (k) => {
3857
+ k.code !== void 0 && (Ze(de(k.code)), i.current = !1, l != null && l.keyup && y(k, !0));
3858
+ }, w = a.current || (m == null ? void 0 : m.document) || document;
3859
+ return w.addEventListener("keyup", h, m == null ? void 0 : m.eventListenerOptions), w.addEventListener("keydown", C, m == null ? void 0 : m.eventListenerOptions), g && Ce(u, l == null ? void 0 : l.delimiter).forEach(
3860
+ (k) => g.addHotkey(
3833
3861
  Se(
3834
- y,
3862
+ k,
3835
3863
  l == null ? void 0 : l.splitKey,
3836
3864
  l == null ? void 0 : l.sequenceSplitKey,
3837
3865
  l == null ? void 0 : l.useKey,
@@ -3839,17 +3867,17 @@ function zr(t, o, n, r) {
3839
3867
  )
3840
3868
  )
3841
3869
  ), () => {
3842
- v.removeEventListener("keyup", h, m == null ? void 0 : m.eventListenerOptions), v.removeEventListener("keydown", C, m == null ? void 0 : m.eventListenerOptions), g && Ce(u, l == null ? void 0 : l.delimiter).forEach(
3843
- (y) => g.removeHotkey(
3870
+ w.removeEventListener("keyup", h, m == null ? void 0 : m.eventListenerOptions), w.removeEventListener("keydown", C, m == null ? void 0 : m.eventListenerOptions), g && Ce(u, l == null ? void 0 : l.delimiter).forEach(
3871
+ (k) => g.removeHotkey(
3844
3872
  Se(
3845
- y,
3873
+ k,
3846
3874
  l == null ? void 0 : l.splitKey,
3847
3875
  l == null ? void 0 : l.sequenceSplitKey,
3848
3876
  l == null ? void 0 : l.useKey,
3849
3877
  l == null ? void 0 : l.description
3850
3878
  )
3851
3879
  )
3852
- ), w = [], b && clearTimeout(b);
3880
+ ), v = [], b && clearTimeout(b);
3853
3881
  };
3854
3882
  }, [u, l, f]), a;
3855
3883
  }
@@ -3879,15 +3907,15 @@ function V(t, o, n = {}) {
3879
3907
  );
3880
3908
  }
3881
3909
  function Sr(t = {}) {
3882
- const { onToggleAIChat: o } = t, n = Ue(), r = N((j) => j.nodes), a = N((j) => j.selectedNodeId), i = N((j) => j.execution), m = N((j) => j.hasUnsavedChanges), u = N((j) => j.saveWorkflow), s = N((j) => j.execute), p = N((j) => j.cancelExecution), c = N((j) => j.duplicateNode), l = N((j) => j.setSelectedNode), f = N((j) => j.toggleLibrary), g = N((j) => j.newWorkflow), w = A((j) => j.openSettings), b = A((j) => j.openShortcutsModal), k = A((j) => j.openCommandPalette), C = A((j) => j.closeCommandPalette), h = A((j) => j.closeShortcutsModal), v = A((j) => j.closeSettings), y = A((j) => j.showCommandPalette), T = A((j) => j.openExport), _ = A((j) => j.openImport), L = A((j) => j.requestNewWorkflow), x = M(() => {
3910
+ const { onToggleAIChat: o } = t, n = Ue(), r = N((j) => j.nodes), a = N((j) => j.selectedNodeId), i = N((j) => j.execution), m = N((j) => j.hasUnsavedChanges), u = N((j) => j.saveWorkflow), s = N((j) => j.execute), p = N((j) => j.cancelExecution), c = N((j) => j.duplicateNode), l = N((j) => j.setSelectedNode), f = N((j) => j.toggleLibrary), g = N((j) => j.newWorkflow), v = A((j) => j.openSettings), b = A((j) => j.openShortcutsModal), y = A((j) => j.openCommandPalette), C = A((j) => j.closeCommandPalette), h = A((j) => j.closeShortcutsModal), w = A((j) => j.closeSettings), k = A((j) => j.showCommandPalette), L = A((j) => j.openExport), _ = A((j) => j.openImport), W = A((j) => j.requestNewWorkflow), x = M(() => {
3883
3911
  r.length !== 0 && u();
3884
3912
  }, [r.length, u]), S = M(() => {
3885
3913
  r.length === 0 || i.status === "running" || s();
3886
3914
  }, [r.length, i.status, s]), I = M(() => {
3887
- L(m, g);
3888
- }, [L, m, g]), O = M(() => {
3889
- r.length !== 0 && (T == null || T());
3890
- }, [r.length, T]), B = M(() => {
3915
+ W(m, g);
3916
+ }, [W, m, g]), D = M(() => {
3917
+ r.length !== 0 && (L == null || L());
3918
+ }, [r.length, L]), B = M(() => {
3891
3919
  _ == null || _();
3892
3920
  }, [_]), K = M(() => {
3893
3921
  i.status === "running" && p();
@@ -3901,34 +3929,34 @@ function Sr(t = {}) {
3901
3929
  }))
3902
3930
  );
3903
3931
  }, [n]), $ = M(() => {
3904
- C == null || C(), h == null || h(), v == null || v(), l(null), n == null || n.setNodes(
3932
+ C == null || C(), h == null || h(), w == null || w(), l(null), n == null || n.setNodes(
3905
3933
  (j) => j.map((fe) => ({
3906
3934
  ...fe,
3907
3935
  selected: !1
3908
3936
  }))
3909
3937
  );
3910
- }, [l, n, C, h, v]), F = M(() => {
3938
+ }, [l, n, C, h, w]), F = M(() => {
3911
3939
  n == null || n.zoomIn();
3912
3940
  }, [n]), z = M(() => {
3913
3941
  n == null || n.zoomOut();
3914
3942
  }, [n]), R = M(() => {
3915
3943
  n == null || n.fitView({ padding: 0.2 });
3916
3944
  }, [n]), U = M(() => {
3917
- y ? C == null || C() : k == null || k();
3918
- }, [y, k, C]), Z = M(() => {
3945
+ k ? C == null || C() : y == null || y();
3946
+ }, [k, y, C]), Z = M(() => {
3919
3947
  b == null || b();
3920
3948
  }, [b]), X = M(() => {
3921
3949
  o == null || o();
3922
3950
  }, [o]), ee = M(() => {
3923
3951
  f();
3924
3952
  }, [f]), ue = M(() => {
3925
- w();
3926
- }, [w]);
3927
- return V("save", x), V("execute", S), V("newWorkflow", I), V("exportWorkflow", O), V("importWorkflow", B), V("cancelExecution", K), V("duplicate", Q), V("selectAll", q), V("deselect", $), V("zoomIn", F), V("zoomOut", z), V("zoomFit", R), V("commandPalette", U), V("showShortcuts", Z), V("toggleAIChat", X), V("toggleLibrary", ee), V("settings", ue), {
3953
+ v();
3954
+ }, [v]);
3955
+ return V("save", x), V("execute", S), V("newWorkflow", I), V("exportWorkflow", D), V("importWorkflow", B), V("cancelExecution", K), V("duplicate", Q), V("selectAll", q), V("deselect", $), V("zoomIn", F), V("zoomOut", z), V("zoomFit", R), V("commandPalette", U), V("showShortcuts", Z), V("toggleAIChat", X), V("toggleLibrary", ee), V("settings", ue), {
3928
3956
  handleSave: x,
3929
3957
  handleExecute: S,
3930
3958
  handleNewWorkflow: I,
3931
- handleExport: O,
3959
+ handleExport: D,
3932
3960
  handleImport: B,
3933
3961
  handleDuplicate: Q,
3934
3962
  handleSelectAll: q,
@@ -3991,7 +4019,7 @@ function _r(t) {
3991
4019
  r === "mod" ? n.push(rt()) : r === "ctrl" || r === "control" ? n.push(ye() ? "⌃" : "Ctrl") : r === "alt" || r === "option" ? n.push(nt()) : r === "shift" ? n.push(ot()) : r === "meta" || r === "cmd" || r === "command" ? n.push("⌘") : ke[r] ? n.push(ke[r]) : n.push(r.toUpperCase());
3992
4020
  return n;
3993
4021
  }
3994
- function Mr(t, o) {
4022
+ function Wr(t, o) {
3995
4023
  const n = new Map(t.map((u) => [u.id, u])), r = /* @__PURE__ */ new Map(), a = /* @__PURE__ */ new Map();
3996
4024
  for (const u of t)
3997
4025
  r.set(u.id, 0), a.set(u.id, []);
@@ -4014,7 +4042,7 @@ function Mr(t, o) {
4014
4042
  }
4015
4043
  return m;
4016
4044
  }
4017
- function Wr(t) {
4045
+ function Mr(t) {
4018
4046
  const o = t.type || "node", n = t.id.replace(/[^a-zA-Z0-9]/g, "_");
4019
4047
  return `${o}_${n}`;
4020
4048
  }
@@ -4097,9 +4125,9 @@ function jr(t, o) {
4097
4125
  if (t.length === 0)
4098
4126
  return `// Empty workflow
4099
4127
  // Add nodes to your canvas to generate code`;
4100
- const n = Mr(t, o), r = /* @__PURE__ */ new Map();
4128
+ const n = Wr(t, o), r = /* @__PURE__ */ new Map();
4101
4129
  for (const p of n)
4102
- r.set(p.id, Wr(p));
4130
+ r.set(p.id, Mr(p));
4103
4131
  const a = /* @__PURE__ */ new Set(), i = [];
4104
4132
  for (const p of n) {
4105
4133
  const { code: c, imports: l } = Tr(p, o, r);
@@ -4134,14 +4162,14 @@ runWorkflow().catch(console.error);
4134
4162
  ` + s;
4135
4163
  }
4136
4164
  function Er({ isOpen: t, onClose: o, onImport: n }) {
4137
- const [r, a] = W(""), [i, m] = W(!1), [u, s] = W(null), [p, c] = W(!1), l = M(async () => {
4165
+ const [r, a] = T(""), [i, m] = T(!1), [u, s] = T(null), [p, c] = T(!1), l = M(async () => {
4138
4166
  if (!r.trim()) {
4139
4167
  s({ message: "Please enter or paste YAML content" });
4140
4168
  return;
4141
4169
  }
4142
4170
  m(!0), s(null);
4143
4171
  try {
4144
- const h = await Mt(r);
4172
+ const h = await Wt(r);
4145
4173
  h.success ? (n(h.nodes, h.edges, h.name), a(""), o()) : s({
4146
4174
  message: h.error || "Import failed",
4147
4175
  line: h.line,
@@ -4159,7 +4187,7 @@ function Er({ isOpen: t, onClose: o, onImport: n }) {
4159
4187
  }
4160
4188
  m(!0), s(null);
4161
4189
  try {
4162
- const h = await Wt(r);
4190
+ const h = await Mt(r);
4163
4191
  h.valid ? (s(null), s({ message: "Valid YAML!" }), setTimeout(() => s(null), 2e3)) : h.errors.length > 0 && s(h.errors[0]);
4164
4192
  } catch (h) {
4165
4193
  s({ message: h instanceof Error ? h.message : "Validation failed" });
@@ -4172,27 +4200,27 @@ function Er({ isOpen: t, onClose: o, onImport: n }) {
4172
4200
  return;
4173
4201
  }
4174
4202
  try {
4175
- const v = await h.text();
4176
- a(v), s(null);
4203
+ const w = await h.text();
4204
+ a(w), s(null);
4177
4205
  } catch {
4178
4206
  s({ message: "Failed to read file" });
4179
4207
  }
4180
- }, []), w = M((h) => {
4208
+ }, []), v = M((h) => {
4181
4209
  h.preventDefault(), c(!0);
4182
4210
  }, []), b = M((h) => {
4183
4211
  h.preventDefault(), c(!1);
4184
- }, []), k = M(
4212
+ }, []), y = M(
4185
4213
  (h) => {
4186
4214
  h.preventDefault(), c(!1);
4187
- const v = h.dataTransfer.files[0];
4188
- v && g(v);
4215
+ const w = h.dataTransfer.files[0];
4216
+ w && g(w);
4189
4217
  },
4190
4218
  [g]
4191
4219
  ), C = M(
4192
4220
  (h) => {
4193
- var y;
4194
- const v = (y = h.target.files) == null ? void 0 : y[0];
4195
- v && g(v);
4221
+ var k;
4222
+ const w = (k = h.target.files) == null ? void 0 : k[0];
4223
+ w && g(w);
4196
4224
  },
4197
4225
  [g]
4198
4226
  );
@@ -4221,9 +4249,9 @@ function Er({ isOpen: t, onClose: o, onImport: n }) {
4221
4249
  /* @__PURE__ */ d(
4222
4250
  "div",
4223
4251
  {
4224
- onDragOver: w,
4252
+ onDragOver: v,
4225
4253
  onDragLeave: b,
4226
- onDrop: k,
4254
+ onDrop: y,
4227
4255
  className: `border-2 border-dashed rounded-lg p-4 mb-4 text-center transition-colors ${p ? "border-teal-500 bg-teal-50 dark:bg-teal-900/20" : "border-gray-300 dark:border-zinc-600"}`,
4228
4256
  children: [
4229
4257
  /* @__PURE__ */ e(
@@ -4372,7 +4400,7 @@ function $r({
4372
4400
  hideAttribution: a = !1,
4373
4401
  hideWorkflowLibrary: i = !1
4374
4402
  } = {}) {
4375
- const m = N((E) => E.execution), u = N((E) => E.execute), s = N((E) => E.cancelExecution), p = N((E) => E.exportToYaml), c = N((E) => E.importFromYaml), l = N((E) => E.nodes), f = N((E) => E.edges), g = A((E) => E.openSettings), w = N((E) => E.activeWorkflowName), b = N((E) => E.hasUnsavedChanges), k = N((E) => E.saveWorkflow), C = N((E) => E.toggleLibrary), h = N((E) => E.setActiveWorkflowName), v = Ir("save"), [y, T] = W(!1), [_, L] = W(!1), [x, S] = W("yaml"), [I, O] = W(""), [B, K] = W(""), [Q, q] = W(null), [$, F] = W(!1), [z, R] = W("");
4403
+ const m = N((E) => E.execution), u = N((E) => E.execute), s = N((E) => E.cancelExecution), p = N((E) => E.exportToYaml), c = N((E) => E.importFromYaml), l = N((E) => E.nodes), f = N((E) => E.edges), g = A((E) => E.openSettings), v = N((E) => E.activeWorkflowName), b = N((E) => E.hasUnsavedChanges), y = N((E) => E.saveWorkflow), C = N((E) => E.toggleLibrary), h = N((E) => E.setActiveWorkflowName), w = Ir("save"), [k, L] = T(!1), [_, W] = T(!1), [x, S] = T("yaml"), [I, D] = T(""), [B, K] = T(""), [Q, q] = T(null), [$, F] = T(!1), [z, R] = T("");
4376
4404
  H(() => {
4377
4405
  const E = () => {
4378
4406
  q("New workflow created"), setTimeout(() => q(null), 2e3);
@@ -4380,19 +4408,19 @@ function $r({
4380
4408
  return window.addEventListener("new-workflow-created", E), () => window.removeEventListener("new-workflow-created", E);
4381
4409
  }, []);
4382
4410
  const U = M(() => {
4383
- l.length !== 0 && (k(), q("Saved!"), setTimeout(() => q(null), 2e3));
4384
- }, [l.length, k]), Z = () => {
4385
- R(w), F(!0);
4411
+ l.length !== 0 && (y(), q("Saved!"), setTimeout(() => q(null), 2e3));
4412
+ }, [l.length, y]), Z = () => {
4413
+ R(v), F(!0);
4386
4414
  }, X = () => {
4387
4415
  const E = z.trim();
4388
- E && E !== w && h(E), F(!1);
4416
+ E && E !== v && h(E), F(!1);
4389
4417
  }, ee = async () => {
4390
4418
  await u();
4391
4419
  }, ue = async () => {
4392
4420
  const E = await p();
4393
- O(E);
4421
+ D(E);
4394
4422
  const Ne = jr(l, f);
4395
- K(Ne), T(!0);
4423
+ K(Ne), L(!0);
4396
4424
  }, j = () => {
4397
4425
  const E = x === "yaml" ? I : B;
4398
4426
  navigator.clipboard.writeText(E);
@@ -4437,7 +4465,7 @@ function $r({
4437
4465
  onChange: (E) => R(E.target.value),
4438
4466
  onBlur: X,
4439
4467
  onKeyDown: (E) => {
4440
- E.key === "Enter" && X(), E.key === "Escape" && (R(w), F(!1));
4468
+ E.key === "Enter" && X(), E.key === "Escape" && (R(v), F(!1));
4441
4469
  },
4442
4470
  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",
4443
4471
  autoFocus: !0
@@ -4448,7 +4476,7 @@ function $r({
4448
4476
  onClick: Z,
4449
4477
  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",
4450
4478
  title: "Click to rename",
4451
- children: w
4479
+ children: v
4452
4480
  }
4453
4481
  ),
4454
4482
  b && /* @__PURE__ */ e("span", { className: "text-xs text-amber-600 dark:text-amber-400", children: "(unsaved)" }),
@@ -4488,7 +4516,7 @@ function $r({
4488
4516
  onClick: U,
4489
4517
  disabled: l.length === 0,
4490
4518
  className: "floimg-toolbar__btn disabled:opacity-50 disabled:cursor-not-allowed",
4491
- title: `Save Workflow${v ? ` (${Lr(v)})` : ""}`,
4519
+ title: `Save Workflow${w ? ` (${Lr(w)})` : ""}`,
4492
4520
  children: /* @__PURE__ */ e("svg", { className: "h-5 w-5", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ e(
4493
4521
  "path",
4494
4522
  {
@@ -4500,7 +4528,7 @@ function $r({
4500
4528
  ) })
4501
4529
  }
4502
4530
  ),
4503
- /* @__PURE__ */ e("button", { onClick: () => L(!0), className: "floimg-toolbar__btn-secondary", children: "Import" }),
4531
+ /* @__PURE__ */ e("button", { onClick: () => W(!0), className: "floimg-toolbar__btn-secondary", children: "Import" }),
4504
4532
  /* @__PURE__ */ e(
4505
4533
  "button",
4506
4534
  {
@@ -4567,7 +4595,7 @@ function $r({
4567
4595
  "Error: ",
4568
4596
  m.error
4569
4597
  ] }) }),
4570
- y && /* @__PURE__ */ e("div", { className: "fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50", children: /* @__PURE__ */ d("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: [
4598
+ k && /* @__PURE__ */ e("div", { className: "fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50", children: /* @__PURE__ */ d("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: [
4571
4599
  /* @__PURE__ */ d("div", { className: "flex items-center justify-between px-4 py-3 border-b border-gray-200 dark:border-zinc-700", children: [
4572
4600
  /* @__PURE__ */ d("div", { className: "flex items-center gap-4", children: [
4573
4601
  /* @__PURE__ */ e("h3", { className: "text-lg font-semibold text-gray-900 dark:text-white", children: "Export Workflow" }),
@@ -4593,7 +4621,7 @@ function $r({
4593
4621
  /* @__PURE__ */ e(
4594
4622
  "button",
4595
4623
  {
4596
- onClick: () => T(!1),
4624
+ onClick: () => L(!1),
4597
4625
  className: "text-gray-500 dark:text-zinc-400 hover:text-gray-700 dark:hover:text-zinc-200",
4598
4626
  children: /* @__PURE__ */ e("svg", { className: "h-6 w-6", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ e(
4599
4627
  "path",
@@ -4622,7 +4650,7 @@ function $r({
4622
4650
  /* @__PURE__ */ e(
4623
4651
  "button",
4624
4652
  {
4625
- onClick: () => T(!1),
4653
+ onClick: () => L(!1),
4626
4654
  className: "px-4 py-2 text-sm font-medium text-white bg-teal-600 rounded-md hover:bg-teal-700",
4627
4655
  children: "Close"
4628
4656
  }
@@ -4634,14 +4662,14 @@ function $r({
4634
4662
  Er,
4635
4663
  {
4636
4664
  isOpen: _,
4637
- onClose: () => L(!1),
4665
+ onClose: () => W(!1),
4638
4666
  onImport: fe
4639
4667
  }
4640
4668
  )
4641
4669
  ] });
4642
4670
  }
4643
4671
  function Ar({ run: t, onClose: o }) {
4644
- const [n, r] = W(null), a = t.status === "error";
4672
+ const [n, r] = T(null), a = t.status === "error";
4645
4673
  H(() => {
4646
4674
  const c = (l) => {
4647
4675
  l.key === "Escape" && o();
@@ -4666,8 +4694,8 @@ function Ar({ run: t, onClose: o }) {
4666
4694
  }, p = (c, l) => {
4667
4695
  const f = document.createElement("a");
4668
4696
  f.href = l;
4669
- const g = l.match(/data:image\/(\w+);/), w = g ? g[1] : "png";
4670
- f.download = `${c.replace(/[^a-zA-Z0-9]/g, "_")}.${w}`, document.body.appendChild(f), f.click(), document.body.removeChild(f);
4697
+ const g = l.match(/data:image\/(\w+);/), v = g ? g[1] : "png";
4698
+ f.download = `${c.replace(/[^a-zA-Z0-9]/g, "_")}.${v}`, document.body.appendChild(f), f.click(), document.body.removeChild(f);
4671
4699
  };
4672
4700
  return /* @__PURE__ */ e(
4673
4701
  "div",
@@ -4939,7 +4967,7 @@ function Ar({ run: t, onClose: o }) {
4939
4967
  );
4940
4968
  }
4941
4969
  function Rr({ runs: t, onClose: o }) {
4942
- const [n, r] = W(0), a = G(() => Math.max(...t.map((s) => s.outputs.length)), [t]), i = G(
4970
+ const [n, r] = T(0), a = G(() => Math.max(...t.map((s) => s.outputs.length)), [t]), i = G(
4943
4971
  () => t.map((s) => s.outputs[n]),
4944
4972
  [t, n]
4945
4973
  ), m = (s) => s < 1e3 ? `${s}ms` : `${(s / 1e3).toFixed(1)}s`, u = (s) => new Date(s).toLocaleTimeString(void 0, {
@@ -5145,7 +5173,7 @@ function Hr(t, o) {
5145
5173
  r.href = n, r.download = o, document.body.appendChild(r), r.click(), document.body.removeChild(r), URL.revokeObjectURL(n);
5146
5174
  }
5147
5175
  function Ur({ isGuest: t = !1, signUpUrl: o, onShare: n }) {
5148
- const r = N((x) => x.executionHistory), a = N((x) => x.clearHistory), i = N((x) => x.pinnedRunIds), m = N((x) => x.togglePinRun), [u, s] = W(null), [p, c] = W(!1), [l, f] = W([]), [g, w] = W(!1), { pinnedRuns: b, unpinnedRuns: k } = G(() => {
5176
+ const r = N((x) => x.executionHistory), a = N((x) => x.clearHistory), i = N((x) => x.pinnedRunIds), m = N((x) => x.togglePinRun), [u, s] = T(null), [p, c] = T(!1), [l, f] = T([]), [g, v] = T(!1), { pinnedRuns: b, unpinnedRuns: y } = G(() => {
5149
5177
  const x = [], S = [];
5150
5178
  for (const I of r)
5151
5179
  i.includes(I.id) ? x.push(I) : S.push(I);
@@ -5155,21 +5183,21 @@ function Ur({ isGuest: t = !1, signUpUrl: o, onShare: n }) {
5155
5183
  [r, l]
5156
5184
  ), h = (x) => {
5157
5185
  f((S) => S.includes(x) ? S.filter((I) => I !== x) : S.length >= 4 ? S : [...S, x]);
5158
- }, v = () => {
5186
+ }, w = () => {
5159
5187
  c(!1), f([]);
5160
- }, [y, T] = W(!1), _ = async () => {
5161
- T(!0);
5188
+ }, [k, L] = T(!1), _ = async () => {
5189
+ L(!0);
5162
5190
  try {
5163
5191
  await Le(r);
5164
5192
  } finally {
5165
- T(!1);
5193
+ L(!1);
5166
5194
  }
5167
- }, L = async () => {
5168
- T(!0);
5195
+ }, W = async () => {
5196
+ L(!0);
5169
5197
  try {
5170
5198
  await Le(b);
5171
5199
  } finally {
5172
- T(!1);
5200
+ L(!1);
5173
5201
  }
5174
5202
  };
5175
5203
  return r.length === 0 ? /* @__PURE__ */ d("div", { className: "p-8 text-center text-zinc-500 dark:text-zinc-400", children: [
@@ -5221,7 +5249,7 @@ function Ur({ isGuest: t = !1, signUpUrl: o, onShare: n }) {
5221
5249
  /* @__PURE__ */ e(
5222
5250
  "button",
5223
5251
  {
5224
- onClick: v,
5252
+ onClick: w,
5225
5253
  className: "text-sm text-zinc-500 hover:text-zinc-700 dark:hover:text-zinc-300",
5226
5254
  children: "Cancel"
5227
5255
  }
@@ -5229,7 +5257,7 @@ function Ur({ isGuest: t = !1, signUpUrl: o, onShare: n }) {
5229
5257
  /* @__PURE__ */ d(
5230
5258
  "button",
5231
5259
  {
5232
- onClick: () => w(!0),
5260
+ onClick: () => v(!0),
5233
5261
  disabled: l.length < 2,
5234
5262
  className: "px-3 py-1.5 text-sm bg-teal-600 text-white rounded-lg hover:bg-teal-700 disabled:opacity-50 disabled:cursor-not-allowed",
5235
5263
  children: [
@@ -5251,19 +5279,19 @@ function Ur({ isGuest: t = !1, signUpUrl: o, onShare: n }) {
5251
5279
  b.length > 0 && /* @__PURE__ */ e(
5252
5280
  "button",
5253
5281
  {
5254
- onClick: L,
5255
- disabled: y,
5282
+ onClick: W,
5283
+ disabled: k,
5256
5284
  className: "text-sm text-zinc-500 hover:text-teal-600 dark:hover:text-teal-400 disabled:opacity-50",
5257
- children: y ? "Exporting..." : "Export Pinned"
5285
+ children: k ? "Exporting..." : "Export Pinned"
5258
5286
  }
5259
5287
  ),
5260
5288
  /* @__PURE__ */ e(
5261
5289
  "button",
5262
5290
  {
5263
5291
  onClick: _,
5264
- disabled: y,
5292
+ disabled: k,
5265
5293
  className: "text-sm text-zinc-500 hover:text-teal-600 dark:hover:text-teal-400 disabled:opacity-50",
5266
- children: y ? "Exporting..." : "Export All"
5294
+ children: k ? "Exporting..." : "Export All"
5267
5295
  }
5268
5296
  ),
5269
5297
  /* @__PURE__ */ e(
@@ -5301,7 +5329,7 @@ function Ur({ isGuest: t = !1, signUpUrl: o, onShare: n }) {
5301
5329
  x.id
5302
5330
  )) })
5303
5331
  ] }),
5304
- /* @__PURE__ */ e("div", { className: "space-y-3", children: k.map((x) => /* @__PURE__ */ e(
5332
+ /* @__PURE__ */ e("div", { className: "space-y-3", children: y.map((x) => /* @__PURE__ */ e(
5305
5333
  Pe,
5306
5334
  {
5307
5335
  run: x,
@@ -5322,7 +5350,7 @@ function Ur({ isGuest: t = !1, signUpUrl: o, onShare: n }) {
5322
5350
  {
5323
5351
  runs: C,
5324
5352
  onClose: () => {
5325
- w(!1), v();
5353
+ v(!1), w();
5326
5354
  }
5327
5355
  }
5328
5356
  )
@@ -5963,7 +5991,7 @@ async function Fr(t) {
5963
5991
  }
5964
5992
  }
5965
5993
  function Kr({ onSelect: t, apiUrl: o = Vr }) {
5966
- const [n, r] = W(null), [a, i] = W(""), { data: m = _e, isLoading: u } = be({
5994
+ const [n, r] = T(null), [a, i] = T(""), { data: m = _e, isLoading: u } = be({
5967
5995
  queryKey: ["templates", o],
5968
5996
  queryFn: () => Fr(o),
5969
5997
  staleTime: 5 * 60 * 1e3,
@@ -5982,7 +6010,7 @@ function Kr({ onSelect: t, apiUrl: o = Vr }) {
5982
6010
  c = c.filter(
5983
6011
  (f) => {
5984
6012
  var g;
5985
- return f.name.toLowerCase().includes(l) || f.description.toLowerCase().includes(l) || f.generator.toLowerCase().includes(l) || ((g = f.tags) == null ? void 0 : g.some((w) => w.toLowerCase().includes(l)));
6013
+ return f.name.toLowerCase().includes(l) || f.description.toLowerCase().includes(l) || f.generator.toLowerCase().includes(l) || ((g = f.tags) == null ? void 0 : g.some((v) => v.toLowerCase().includes(l)));
5986
6014
  }
5987
6015
  );
5988
6016
  }
@@ -6153,11 +6181,11 @@ function Gr({
6153
6181
  onRename: a,
6154
6182
  onDuplicate: i
6155
6183
  }) {
6156
- const [m, u] = W(!1), [s, p] = W(t.name), [c, l] = W(!1), f = () => {
6184
+ const [m, u] = T(!1), [s, p] = T(t.name), [c, l] = T(!1), f = () => {
6157
6185
  s.trim() && s !== t.name && a(s.trim()), u(!1);
6158
- }, g = (w) => {
6159
- const b = new Date(w), C = (/* @__PURE__ */ new Date()).getTime() - b.getTime(), h = Math.floor(C / 6e4), v = Math.floor(C / 36e5), y = Math.floor(C / 864e5);
6160
- return h < 1 ? "Just now" : h < 60 ? `${h}m ago` : v < 24 ? `${v}h ago` : y < 7 ? `${y}d ago` : b.toLocaleDateString();
6186
+ }, g = (v) => {
6187
+ const b = new Date(v), C = (/* @__PURE__ */ new Date()).getTime() - b.getTime(), h = Math.floor(C / 6e4), w = Math.floor(C / 36e5), k = Math.floor(C / 864e5);
6188
+ return h < 1 ? "Just now" : h < 60 ? `${h}m ago` : w < 24 ? `${w}h ago` : k < 7 ? `${k}d ago` : b.toLocaleDateString();
6161
6189
  };
6162
6190
  return /* @__PURE__ */ d(
6163
6191
  "div",
@@ -6171,14 +6199,14 @@ function Gr({
6171
6199
  {
6172
6200
  type: "text",
6173
6201
  value: s,
6174
- onChange: (w) => p(w.target.value),
6202
+ onChange: (v) => p(v.target.value),
6175
6203
  onBlur: f,
6176
- onKeyDown: (w) => {
6177
- w.key === "Enter" && f(), w.key === "Escape" && (p(t.name), u(!1));
6204
+ onKeyDown: (v) => {
6205
+ v.key === "Enter" && f(), v.key === "Escape" && (p(t.name), u(!1));
6178
6206
  },
6179
6207
  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",
6180
6208
  autoFocus: !0,
6181
- onClick: (w) => w.stopPropagation()
6209
+ onClick: (v) => v.stopPropagation()
6182
6210
  }
6183
6211
  ) : /* @__PURE__ */ e("span", { className: "block text-sm font-medium text-zinc-900 dark:text-zinc-100 truncate", children: t.name }),
6184
6212
  /* @__PURE__ */ d("span", { className: "block text-xs text-zinc-500 dark:text-zinc-400 mt-0.5", children: [
@@ -6191,8 +6219,8 @@ function Gr({
6191
6219
  /* @__PURE__ */ e(
6192
6220
  "button",
6193
6221
  {
6194
- onClick: (w) => {
6195
- w.stopPropagation(), l(!c);
6222
+ onClick: (v) => {
6223
+ v.stopPropagation(), l(!c);
6196
6224
  },
6197
6225
  className: "p-1 text-zinc-400 hover:text-zinc-600 dark:hover:text-zinc-300 rounded opacity-0 group-hover:opacity-100 transition-opacity",
6198
6226
  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" }) })
@@ -6204,8 +6232,8 @@ function Gr({
6204
6232
  /* @__PURE__ */ e(
6205
6233
  "button",
6206
6234
  {
6207
- onClick: (w) => {
6208
- w.stopPropagation(), u(!0), l(!1);
6235
+ onClick: (v) => {
6236
+ v.stopPropagation(), u(!0), l(!1);
6209
6237
  },
6210
6238
  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",
6211
6239
  children: "Rename"
@@ -6214,8 +6242,8 @@ function Gr({
6214
6242
  /* @__PURE__ */ e(
6215
6243
  "button",
6216
6244
  {
6217
- onClick: (w) => {
6218
- w.stopPropagation(), i(), l(!1);
6245
+ onClick: (v) => {
6246
+ v.stopPropagation(), i(), l(!1);
6219
6247
  },
6220
6248
  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",
6221
6249
  children: "Duplicate"
@@ -6224,8 +6252,8 @@ function Gr({
6224
6252
  /* @__PURE__ */ e(
6225
6253
  "button",
6226
6254
  {
6227
- onClick: (w) => {
6228
- w.stopPropagation(), window.confirm("Delete this workflow?") && r(), l(!1);
6255
+ onClick: (v) => {
6256
+ v.stopPropagation(), window.confirm("Delete this workflow?") && r(), l(!1);
6229
6257
  },
6230
6258
  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",
6231
6259
  children: "Delete"
@@ -6384,7 +6412,7 @@ const Yr = [
6384
6412
  }
6385
6413
  ];
6386
6414
  function Zr({ provider: t }) {
6387
- const o = A((f) => f.ai), n = A((f) => f.setAIProvider), r = o[t.id], a = (r == null ? void 0 : r.enabled) ?? !1, i = (r == null ? void 0 : r.apiKey) ?? "", [m, u] = W(i), [s, p] = W(!1), c = () => {
6415
+ const o = A((f) => f.ai), n = A((f) => f.setAIProvider), r = o[t.id], a = (r == null ? void 0 : r.enabled) ?? !1, i = (r == null ? void 0 : r.apiKey) ?? "", [m, u] = T(i), [s, p] = T(!1), c = () => {
6388
6416
  n(t.id, {
6389
6417
  apiKey: m,
6390
6418
  enabled: !a
@@ -6465,7 +6493,7 @@ function Zr({ provider: t }) {
6465
6493
  ] });
6466
6494
  }
6467
6495
  function Xr({ provider: t }) {
6468
- const o = A((c) => c.ai), n = A((c) => c.setAIProvider), r = o[t.id], a = (r == null ? void 0 : r.enabled) ?? !1, i = (r == null ? void 0 : r.baseUrl) ?? t.defaultUrl, [m, u] = W(i), s = () => {
6496
+ const o = A((c) => c.ai), n = A((c) => c.setAIProvider), r = o[t.id], a = (r == null ? void 0 : r.enabled) ?? !1, i = (r == null ? void 0 : r.baseUrl) ?? t.defaultUrl, [m, u] = T(i), s = () => {
6469
6497
  n(t.id, {
6470
6498
  baseUrl: m,
6471
6499
  enabled: !a
@@ -6590,12 +6618,12 @@ function en() {
6590
6618
  }
6591
6619
  let pe = null;
6592
6620
  function tn({ isOpen: t, onClose: o, onApplyWorkflow: n }) {
6593
- const [r, a] = W([]), [i, m] = W(""), [u, s] = W(!1), [p, c] = W(null), [l, f] = W(""), [g, w] = W(null), [b, k] = W(null), [C, h] = W(""), [v, y] = W(), [T, _] = W(!1), [L, x] = W(), S = te(null), I = te(null);
6621
+ const [r, a] = T([]), [i, m] = T(""), [u, s] = T(!1), [p, c] = T(null), [l, f] = T(""), [g, v] = T(null), [b, y] = T(null), [C, h] = T(""), [w, k] = T(), [L, _] = T(!1), [W, x] = T(), S = te(null), I = te(null);
6594
6622
  H(() => {
6595
6623
  t && b === null && Tt().then(($) => {
6596
- k($.available), h($.message), y($.reason), _($.isCloudDeployment ?? !1), x($.supportUrl);
6624
+ y($.available), h($.message), k($.reason), _($.isCloudDeployment ?? !1), x($.supportUrl);
6597
6625
  }).catch(() => {
6598
- k(!1), h("Failed to check AI availability"), y("service_unavailable");
6626
+ y(!1), h("Failed to check AI availability"), k("service_unavailable");
6599
6627
  });
6600
6628
  }, [t, b]), H(() => {
6601
6629
  t && I.current && I.current.focus();
@@ -6603,24 +6631,24 @@ function tn({ isOpen: t, onClose: o, onApplyWorkflow: n }) {
6603
6631
  var $;
6604
6632
  ($ = S.current) == null || $.scrollIntoView({ behavior: "smooth" });
6605
6633
  }, [r]);
6606
- const O = M(() => {
6634
+ const D = M(() => {
6607
6635
  if (!i.trim() || u) return;
6608
6636
  const $ = {
6609
6637
  role: "user",
6610
6638
  content: i.trim(),
6611
6639
  timestamp: Date.now()
6612
6640
  };
6613
- a((z) => [...z, $]), m(""), s(!0), w(null), c(null), f("");
6641
+ a((z) => [...z, $]), m(""), s(!0), v(null), c(null), f("");
6614
6642
  let F;
6615
6643
  pe = qe(
6616
6644
  "/api/generate/workflow/stream",
6617
6645
  { prompt: $.content, history: r },
6618
6646
  {
6619
6647
  onMessage: (z) => {
6620
- z.type, z.type === "generation.progress" && (c(z.data.phase), f(z.data.message)), z.type === "generation.completed" && (F = z.data), z.type === "generation.error" && w(z.data.error);
6648
+ z.type, z.type === "generation.progress" && (c(z.data.phase), f(z.data.message)), z.type === "generation.completed" && (F = z.data), z.type === "generation.error" && v(z.data.error);
6621
6649
  },
6622
6650
  onError: (z) => {
6623
- pe = null, w(z.message || "Failed to generate workflow"), s(!1), c(null);
6651
+ pe = null, v(z.message || "Failed to generate workflow"), s(!1), c(null);
6624
6652
  },
6625
6653
  onClose: () => {
6626
6654
  pe = null;
@@ -6637,11 +6665,11 @@ function tn({ isOpen: t, onClose: o, onApplyWorkflow: n }) {
6637
6665
  }, [i, u, r]), B = M(() => {
6638
6666
  pe && (pe.abort(), pe = null), s(!1), c(null), f("");
6639
6667
  }, []), K = ($) => {
6640
- $.key === "Enter" && !$.shiftKey && ($.preventDefault(), O());
6668
+ $.key === "Enter" && !$.shiftKey && ($.preventDefault(), D());
6641
6669
  }, Q = ($) => {
6642
6670
  n($), o();
6643
6671
  }, q = () => {
6644
- a([]), w(null);
6672
+ a([]), v(null);
6645
6673
  };
6646
6674
  return t ? /* @__PURE__ */ e("div", { className: "fixed inset-0 bg-black/50 flex items-center justify-center z-50", children: /* @__PURE__ */ d("div", { className: "bg-white dark:bg-zinc-800 rounded-lg shadow-xl w-full max-w-2xl mx-4 h-[80vh] flex flex-col", children: [
6647
6675
  /* @__PURE__ */ d("div", { className: "flex items-center justify-between px-4 py-3 border-b border-gray-200 dark:border-zinc-700", children: [
@@ -6707,7 +6735,7 @@ function tn({ isOpen: t, onClose: o, onApplyWorkflow: n }) {
6707
6735
  ] }),
6708
6736
  /* @__PURE__ */ d("div", { className: "flex-1 overflow-auto p-4 space-y-4", children: [
6709
6737
  b === !1 && /* @__PURE__ */ e("div", { className: "bg-amber-50 dark:bg-amber-900/30 border border-amber-200 dark:border-amber-800 rounded-lg p-4", children: /* @__PURE__ */ d("div", { className: "flex items-start gap-3", children: [
6710
- v === "tier_limit" ? /* @__PURE__ */ e(
6738
+ w === "tier_limit" ? /* @__PURE__ */ e(
6711
6739
  "svg",
6712
6740
  {
6713
6741
  className: "h-5 w-5 text-amber-600 dark:text-amber-400 mt-0.5",
@@ -6743,10 +6771,10 @@ function tn({ isOpen: t, onClose: o, onApplyWorkflow: n }) {
6743
6771
  }
6744
6772
  ),
6745
6773
  /* @__PURE__ */ d("div", { children: [
6746
- /* @__PURE__ */ e("p", { className: "font-medium text-amber-800 dark:text-amber-200", children: v === "tier_limit" ? "AI Workflow Generation Not Available" : "AI Generation Not Available" }),
6774
+ /* @__PURE__ */ e("p", { className: "font-medium text-amber-800 dark:text-amber-200", children: w === "tier_limit" ? "AI Workflow Generation Not Available" : "AI Generation Not Available" }),
6747
6775
  /* @__PURE__ */ e("p", { className: "text-sm text-amber-700 dark:text-amber-300 mt-1", children: C }),
6748
6776
  /* @__PURE__ */ d("div", { className: "flex flex-col sm:flex-row gap-2 mt-3", children: [
6749
- v === "tier_limit" && /* @__PURE__ */ e(
6777
+ w === "tier_limit" && /* @__PURE__ */ e(
6750
6778
  "a",
6751
6779
  {
6752
6780
  href: "/pricing",
@@ -6754,15 +6782,15 @@ function tn({ isOpen: t, onClose: o, onApplyWorkflow: n }) {
6754
6782
  children: "View Plans"
6755
6783
  }
6756
6784
  ),
6757
- v === "service_unavailable" && L && /* @__PURE__ */ e(
6785
+ w === "service_unavailable" && W && /* @__PURE__ */ e(
6758
6786
  "a",
6759
6787
  {
6760
- href: L,
6788
+ href: W,
6761
6789
  className: "text-sm font-medium text-amber-700 hover:text-amber-800 dark:text-amber-400 dark:hover:text-amber-300",
6762
6790
  children: "Contact Support"
6763
6791
  }
6764
6792
  ),
6765
- v === "not_configured" && !T && /* @__PURE__ */ e(
6793
+ w === "not_configured" && !L && /* @__PURE__ */ e(
6766
6794
  "a",
6767
6795
  {
6768
6796
  href: "https://floimg.com/docs/studio/ai-workflows",
@@ -7019,7 +7047,7 @@ function tn({ isOpen: t, onClose: o, onApplyWorkflow: n }) {
7019
7047
  /* @__PURE__ */ e(
7020
7048
  "button",
7021
7049
  {
7022
- onClick: O,
7050
+ onClick: D,
7023
7051
  disabled: !i.trim() || u || b === !1,
7024
7052
  className: "self-end px-4 py-2 bg-teal-600 hover:bg-teal-700 disabled:opacity-50 disabled:cursor-not-allowed text-white rounded-lg transition-colors",
7025
7053
  children: /* @__PURE__ */ e("svg", { className: "h-5 w-5", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ e(
@@ -7040,7 +7068,7 @@ function tn({ isOpen: t, onClose: o, onApplyWorkflow: n }) {
7040
7068
  }
7041
7069
  const rn = 20, nn = 500, on = 1e5;
7042
7070
  function an({ isOpen: t, onClose: o, nodeLabel: n, output: r }) {
7043
- const [a, i] = W("formatted"), [m, u] = W(!1), s = M(() => {
7071
+ const [a, i] = T("formatted"), [m, u] = T(!1), s = M(() => {
7044
7072
  const c = a === "formatted" && r.parsed ? JSON.stringify(r.parsed, null, 2) : r.content;
7045
7073
  navigator.clipboard.writeText(c).then(() => {
7046
7074
  u(!0), setTimeout(() => u(!1), 2e3);
@@ -7179,9 +7207,9 @@ function an({ isOpen: t, onClose: o, nodeLabel: n, output: r }) {
7179
7207
  ] }) });
7180
7208
  }
7181
7209
  function sn({ data: t }) {
7182
- return /* @__PURE__ */ e("div", { className: "font-mono text-sm", children: /* @__PURE__ */ e(Me, { value: t, depth: 0, maxDepth: rn }) });
7210
+ return /* @__PURE__ */ e("div", { className: "font-mono text-sm", children: /* @__PURE__ */ e(We, { value: t, depth: 0, maxDepth: rn }) });
7183
7211
  }
7184
- function Me({ value: t, depth: o, keyName: n, maxDepth: r }) {
7212
+ function We({ value: t, depth: o, keyName: n, maxDepth: r }) {
7185
7213
  const a = o * 16;
7186
7214
  if (o >= r)
7187
7215
  return /* @__PURE__ */ d("div", { style: { marginLeft: a }, className: "py-0.5", children: [
@@ -7256,7 +7284,7 @@ function Me({ value: t, depth: o, keyName: n, maxDepth: r }) {
7256
7284
  ] })
7257
7285
  ] }),
7258
7286
  !n && /* @__PURE__ */ e("span", { className: "text-gray-500 dark:text-zinc-500 py-0.5 block", children: "[" }),
7259
- i.map((u, s) => /* @__PURE__ */ e(Me, { value: u, depth: o + 1, maxDepth: r }, s)),
7287
+ i.map((u, s) => /* @__PURE__ */ e(We, { value: u, depth: o + 1, maxDepth: r }, s)),
7260
7288
  m > 0 && /* @__PURE__ */ d("div", { style: { marginLeft: (o + 1) * 16 }, className: "py-0.5 text-zinc-500 italic", children: [
7261
7289
  "...and ",
7262
7290
  m,
@@ -7278,7 +7306,7 @@ function Me({ value: t, depth: o, keyName: n, maxDepth: r }) {
7278
7306
  /* @__PURE__ */ e("span", { className: "text-gray-500 dark:text-zinc-500", children: "{" })
7279
7307
  ] }),
7280
7308
  !n && /* @__PURE__ */ e("span", { className: "text-gray-500 dark:text-zinc-500 py-0.5 block", children: "{" }),
7281
- i.map(([m, u]) => /* @__PURE__ */ e(Me, { value: u, depth: o + 1, keyName: m, maxDepth: r }, m)),
7309
+ i.map(([m, u]) => /* @__PURE__ */ e(We, { value: u, depth: o + 1, keyName: m, maxDepth: r }, m)),
7282
7310
  /* @__PURE__ */ e("div", { style: { marginLeft: n ? 0 : a }, className: "py-0.5", children: /* @__PURE__ */ e("span", { className: "text-gray-500 dark:text-zinc-500", children: "}" }) })
7283
7311
  ] });
7284
7312
  }
@@ -7363,14 +7391,14 @@ function dn(t, o, n, r) {
7363
7391
  }
7364
7392
  }
7365
7393
  function cn({ onToggleAIChat: t }) {
7366
- const o = A((z) => z.showCommandPalette), n = A((z) => z.closeCommandPalette), r = A((z) => z.keyboard), [a, i] = W(""), m = lt(a), [u, s] = W(0), p = we(), c = je(o), l = te(null), f = N((z) => z.nodes), g = N((z) => z.selectedNodeId), w = N((z) => z.execution), b = N((z) => z.saveWorkflow), k = N((z) => z.execute), C = N((z) => z.duplicateNode), h = N((z) => z.toggleLibrary), v = N((z) => z.newWorkflow), y = A((z) => z.openSettings), T = A((z) => z.openShortcutsModal), _ = A((z) => z.openExport), L = A((z) => z.openImport), x = A((z) => z.requestNewWorkflow), S = N((z) => z.hasUnsavedChanges), I = M(
7394
+ const o = A((z) => z.showCommandPalette), n = A((z) => z.closeCommandPalette), r = A((z) => z.keyboard), [a, i] = T(""), m = lt(a), [u, s] = T(0), p = we(), c = je(o), l = te(null), f = N((z) => z.nodes), g = N((z) => z.selectedNodeId), v = N((z) => z.execution), b = N((z) => z.saveWorkflow), y = N((z) => z.execute), C = N((z) => z.duplicateNode), h = N((z) => z.toggleLibrary), w = N((z) => z.newWorkflow), k = A((z) => z.openSettings), L = A((z) => z.openShortcutsModal), _ = A((z) => z.openExport), W = A((z) => z.openImport), x = A((z) => z.requestNewWorkflow), S = N((z) => z.hasUnsavedChanges), I = M(
7367
7395
  (z) => {
7368
7396
  var U;
7369
7397
  const R = he.find((Z) => Z.action === z);
7370
7398
  return R ? ((U = r == null ? void 0 : r.shortcuts) == null ? void 0 : U[z]) !== void 0 ? r.shortcuts[z] ?? null : R.defaultBinding : null;
7371
7399
  },
7372
7400
  [r]
7373
- ), O = G(() => [
7401
+ ), D = G(() => [
7374
7402
  // Workflow commands
7375
7403
  {
7376
7404
  id: "save",
@@ -7389,9 +7417,9 @@ function cn({ onToggleAIChat: t }) {
7389
7417
  category: "workflow",
7390
7418
  shortcut: I("execute") ?? void 0,
7391
7419
  action: () => {
7392
- f.length > 0 && w.status !== "running" && k();
7420
+ f.length > 0 && v.status !== "running" && y();
7393
7421
  },
7394
- enabled: () => f.length > 0 && w.status !== "running",
7422
+ enabled: () => f.length > 0 && v.status !== "running",
7395
7423
  keywords: ["run", "execute", "start"]
7396
7424
  },
7397
7425
  {
@@ -7400,7 +7428,7 @@ function cn({ onToggleAIChat: t }) {
7400
7428
  category: "workflow",
7401
7429
  shortcut: I("newWorkflow") ?? void 0,
7402
7430
  action: () => {
7403
- n == null || n(), x(S, v);
7431
+ n == null || n(), x(S, w);
7404
7432
  },
7405
7433
  keywords: ["new", "create", "blank"]
7406
7434
  },
@@ -7420,7 +7448,7 @@ function cn({ onToggleAIChat: t }) {
7420
7448
  name: "Import Workflow",
7421
7449
  category: "workflow",
7422
7450
  shortcut: I("importWorkflow") ?? void 0,
7423
- action: () => L == null ? void 0 : L(),
7451
+ action: () => W == null ? void 0 : W(),
7424
7452
  keywords: ["import", "upload", "load"]
7425
7453
  },
7426
7454
  // Editing commands
@@ -7457,7 +7485,7 @@ function cn({ onToggleAIChat: t }) {
7457
7485
  name: "Open Settings",
7458
7486
  category: "ui",
7459
7487
  shortcut: I("settings") ?? void 0,
7460
- action: () => y(),
7488
+ action: () => k(),
7461
7489
  keywords: ["settings", "preferences", "api", "keys"]
7462
7490
  },
7463
7491
  {
@@ -7465,36 +7493,36 @@ function cn({ onToggleAIChat: t }) {
7465
7493
  name: "Show Keyboard Shortcuts",
7466
7494
  category: "ui",
7467
7495
  shortcut: I("showShortcuts") ?? void 0,
7468
- action: () => T == null ? void 0 : T(),
7496
+ action: () => L == null ? void 0 : L(),
7469
7497
  keywords: ["shortcuts", "keyboard", "hotkeys", "help"]
7470
7498
  }
7471
7499
  ], [
7472
7500
  f.length,
7473
7501
  g,
7474
- w.status,
7502
+ v.status,
7475
7503
  S,
7476
7504
  b,
7477
- k,
7478
- v,
7505
+ y,
7506
+ w,
7479
7507
  C,
7480
7508
  h,
7481
- y,
7482
- T,
7483
- _,
7509
+ k,
7484
7510
  L,
7511
+ _,
7512
+ W,
7485
7513
  t,
7486
7514
  I,
7487
7515
  n,
7488
7516
  x
7489
7517
  ]), B = G(() => {
7490
- if (!m.trim()) return O;
7518
+ if (!m.trim()) return D;
7491
7519
  const z = m.toLowerCase();
7492
- return O.filter((R) => {
7520
+ return D.filter((R) => {
7493
7521
  var X;
7494
7522
  const U = R.name.toLowerCase().includes(z), Z = (X = R.keywords) == null ? void 0 : X.some((ee) => ee.toLowerCase().includes(z));
7495
7523
  return U || Z;
7496
7524
  });
7497
- }, [O, m]), K = G(() => {
7525
+ }, [D, m]), K = G(() => {
7498
7526
  const z = {
7499
7527
  workflow: [],
7500
7528
  editing: [],
@@ -7606,7 +7634,7 @@ function cn({ onToggleAIChat: t }) {
7606
7634
  return R.length === 0 ? null : /* @__PURE__ */ d("div", { className: "mb-2", children: [
7607
7635
  /* @__PURE__ */ e("div", { className: "px-4 py-1 text-xs font-semibold text-zinc-500 dark:text-zinc-400 uppercase tracking-wider", children: Ge[z] || z }),
7608
7636
  R.map((U) => {
7609
- const Z = F(), X = Z === u, ee = !U.enabled || U.enabled(), ue = ee ? null : dn(U, f, g, w.status);
7637
+ const Z = F(), X = Z === u, ee = !U.enabled || U.enabled(), ue = ee ? null : dn(U, f, g, v.status);
7610
7638
  return /* @__PURE__ */ d(
7611
7639
  "button",
7612
7640
  {
@@ -7659,7 +7687,7 @@ function cn({ onToggleAIChat: t }) {
7659
7687
  );
7660
7688
  }
7661
7689
  function mn() {
7662
- const t = A((c) => c.showShortcutsModal), o = A((c) => c.closeShortcutsModal), n = A((c) => c.keyboard), [r, a] = W(""), i = we(), m = je(t), u = (c) => {
7690
+ const t = A((c) => c.showShortcutsModal), o = A((c) => c.closeShortcutsModal), n = A((c) => c.keyboard), [r, a] = T(""), i = we(), m = je(t), u = (c) => {
7663
7691
  var f;
7664
7692
  const l = he.find((g) => g.action === c);
7665
7693
  return l ? ((f = n == null ? void 0 : n.shortcuts) == null ? void 0 : f[c]) !== void 0 ? n.shortcuts[c] ?? null : l.defaultBinding : null;
@@ -7674,7 +7702,7 @@ function mn() {
7674
7702
  };
7675
7703
  for (const g of Object.keys(c))
7676
7704
  f[g] = c[g].filter(
7677
- (w) => w.name.toLowerCase().includes(l) || w.description.toLowerCase().includes(l)
7705
+ (v) => v.name.toLowerCase().includes(l) || v.description.toLowerCase().includes(l)
7678
7706
  );
7679
7707
  return f;
7680
7708
  }
@@ -7872,14 +7900,14 @@ function hn() {
7872
7900
  return /* @__PURE__ */ e("div", { className: "flex-1", onDrop: n, onDragOver: r, children: /* @__PURE__ */ e(nr, {}) });
7873
7901
  }
7874
7902
  function wn() {
7875
- const [t, o] = W("editor"), [n, r] = W(!1), a = N((x) => x.loadTemplate), i = N((x) => x.loadGeneratedWorkflow), m = N((x) => x.loadRemixImage), u = N((x) => x.inspectedNodeId), s = N((x) => x.execution.dataOutputs), p = N((x) => x.closeOutputInspector), c = N((x) => x.nodes), l = N((x) => x.selectedNodeId), f = N((x) => x.unseenRunCount), g = N((x) => x.hasUnseenErrors), w = N((x) => x.markRunsAsSeen), b = u ? c.find((x) => x.id === u) : null, k = u ? s[u] : null;
7903
+ const [t, o] = T("editor"), [n, r] = T(!1), a = N((x) => x.loadTemplate), i = N((x) => x.loadGeneratedWorkflow), m = N((x) => x.loadRemixImage), u = N((x) => x.inspectedNodeId), s = N((x) => x.execution.dataOutputs), p = N((x) => x.closeOutputInspector), c = N((x) => x.nodes), l = N((x) => x.selectedNodeId), f = N((x) => x.unseenRunCount), g = N((x) => x.hasUnseenErrors), v = N((x) => x.markRunsAsSeen), b = u ? c.find((x) => x.id === u) : null, y = u ? s[u] : null;
7876
7904
  H(() => {
7877
7905
  const x = new URLSearchParams(window.location.search), S = x.get("template"), I = x.get("remixImage");
7878
7906
  S ? (async () => {
7879
7907
  try {
7880
- const O = await fetch(`${Oe}/api/templates/${S}`);
7881
- if (O.ok) {
7882
- const K = (await O.json()).template;
7908
+ const D = await fetch(`${Oe}/api/templates/${S}`);
7909
+ if (D.ok) {
7910
+ const K = (await D.json()).template;
7883
7911
  a(K);
7884
7912
  }
7885
7913
  } catch {
@@ -7899,8 +7927,8 @@ function wn() {
7899
7927
  try {
7900
7928
  const S = await fetch(`${Oe}/api/templates/${x}`);
7901
7929
  if (S.ok) {
7902
- const O = (await S.json()).template;
7903
- a(O), o("editor");
7930
+ const D = (await S.json()).template;
7931
+ a(D), o("editor");
7904
7932
  }
7905
7933
  } catch {
7906
7934
  }
@@ -7911,25 +7939,25 @@ function wn() {
7911
7939
  i(x), o("editor");
7912
7940
  },
7913
7941
  [i]
7914
- ), v = M(() => {
7942
+ ), w = M(() => {
7915
7943
  r((x) => !x);
7916
- }, []), y = M(() => {
7917
- o("history"), w();
7918
- }, [w]), T = A((x) => x.showNewWorkflowConfirm), _ = A((x) => x.confirmNewWorkflow), L = A((x) => x.cancelNewWorkflow);
7944
+ }, []), k = M(() => {
7945
+ o("history"), v();
7946
+ }, [v]), L = A((x) => x.showNewWorkflowConfirm), _ = A((x) => x.confirmNewWorkflow), W = A((x) => x.cancelNewWorkflow);
7919
7947
  return /* @__PURE__ */ d(xt, { children: [
7920
- /* @__PURE__ */ e(pn, { onToggleAIChat: v }),
7921
- /* @__PURE__ */ e(cn, { onToggleAIChat: v }),
7948
+ /* @__PURE__ */ e(pn, { onToggleAIChat: w }),
7949
+ /* @__PURE__ */ e(cn, { onToggleAIChat: w }),
7922
7950
  /* @__PURE__ */ e(mn, {}),
7923
7951
  /* @__PURE__ */ e(
7924
7952
  un,
7925
7953
  {
7926
- isOpen: T,
7954
+ isOpen: L,
7927
7955
  title: "Unsaved Changes",
7928
7956
  message: "You have unsaved changes. Creating a new workflow will discard them. Are you sure you want to continue?",
7929
7957
  confirmText: "Create New",
7930
7958
  cancelText: "Keep Editing",
7931
7959
  onConfirm: _,
7932
- onCancel: L,
7960
+ onCancel: W,
7933
7961
  destructive: !0
7934
7962
  }
7935
7963
  ),
@@ -7942,14 +7970,14 @@ function wn() {
7942
7970
  onApplyWorkflow: h
7943
7971
  }
7944
7972
  ),
7945
- b && k && /* @__PURE__ */ e(
7973
+ b && y && /* @__PURE__ */ e(
7946
7974
  an,
7947
7975
  {
7948
7976
  isOpen: !0,
7949
7977
  onClose: p,
7950
7978
  nodeId: u,
7951
7979
  nodeLabel: b.data.providerLabel || b.type || "Node",
7952
- output: k
7980
+ output: y
7953
7981
  }
7954
7982
  ),
7955
7983
  /* @__PURE__ */ e(Jr, {}),
@@ -7968,7 +7996,7 @@ function wn() {
7968
7996
  /* @__PURE__ */ d(
7969
7997
  "button",
7970
7998
  {
7971
- onClick: y,
7999
+ onClick: k,
7972
8000
  className: `floimg-tab ${t === "history" ? "floimg-tab--active" : ""} relative`,
7973
8001
  children: [
7974
8002
  "History",