@teamflojo/floimg-studio-ui 0.2.2 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +117 -0
- package/dist/api/client.d.ts +2 -6
- package/dist/index.js +765 -721
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { memo as
|
|
3
|
-
import Ne, { Handle as
|
|
4
|
-
import { create as
|
|
5
|
-
import { useQuery as
|
|
1
|
+
import { jsxs as n, jsx as e, Fragment as B } from "react/jsx-runtime";
|
|
2
|
+
import { memo as G, useRef as te, useCallback as W, useState as C, useEffect as U, useMemo as ie } from "react";
|
|
3
|
+
import Ne, { Handle as P, Position as $, applyNodeChanges as ze, applyEdgeChanges as Ce, MarkerType as Ie, Background as Se, Controls as Le, MiniMap as We, ReactFlowProvider as Ae, useReactFlow as Pe } from "reactflow";
|
|
4
|
+
import { create as ue } from "zustand";
|
|
5
|
+
import { useQuery as K } from "@tanstack/react-query";
|
|
6
6
|
function $e(r, l) {
|
|
7
7
|
let t;
|
|
8
8
|
try {
|
|
@@ -20,28 +20,28 @@ function $e(r, l) {
|
|
|
20
20
|
removeItem: (i) => t.removeItem(i)
|
|
21
21
|
};
|
|
22
22
|
}
|
|
23
|
-
const
|
|
23
|
+
const re = (r) => (l) => {
|
|
24
24
|
try {
|
|
25
25
|
const t = r(l);
|
|
26
26
|
return t instanceof Promise ? t : {
|
|
27
|
-
then(
|
|
28
|
-
return
|
|
27
|
+
then(o) {
|
|
28
|
+
return re(o)(t);
|
|
29
29
|
},
|
|
30
|
-
catch(
|
|
30
|
+
catch(o) {
|
|
31
31
|
return this;
|
|
32
32
|
}
|
|
33
33
|
};
|
|
34
34
|
} catch (t) {
|
|
35
35
|
return {
|
|
36
|
-
then(
|
|
36
|
+
then(o) {
|
|
37
37
|
return this;
|
|
38
38
|
},
|
|
39
|
-
catch(
|
|
40
|
-
return
|
|
39
|
+
catch(o) {
|
|
40
|
+
return re(o)(t);
|
|
41
41
|
}
|
|
42
42
|
};
|
|
43
43
|
}
|
|
44
|
-
},
|
|
44
|
+
}, je = (r, l) => (t, o, i) => {
|
|
45
45
|
let s = {
|
|
46
46
|
storage: $e(() => localStorage),
|
|
47
47
|
partialize: (v) => v,
|
|
@@ -61,11 +61,11 @@ const Y = (r) => (l) => {
|
|
|
61
61
|
`[zustand persist middleware] Unable to update item '${s.name}', the given storage is currently unavailable.`
|
|
62
62
|
), t(...v);
|
|
63
63
|
},
|
|
64
|
-
|
|
64
|
+
o,
|
|
65
65
|
i
|
|
66
66
|
);
|
|
67
67
|
const c = () => {
|
|
68
|
-
const v = s.partialize({ ...
|
|
68
|
+
const v = s.partialize({ ...o() });
|
|
69
69
|
return m.setItem(s.name, {
|
|
70
70
|
state: v,
|
|
71
71
|
version: s.version
|
|
@@ -74,28 +74,28 @@ const Y = (r) => (l) => {
|
|
|
74
74
|
i.setState = (v, w) => (u(v, w), c());
|
|
75
75
|
const h = r(
|
|
76
76
|
(...v) => (t(...v), c()),
|
|
77
|
-
|
|
77
|
+
o,
|
|
78
78
|
i
|
|
79
79
|
);
|
|
80
80
|
i.getInitialState = () => h;
|
|
81
|
-
let
|
|
81
|
+
let b;
|
|
82
82
|
const y = () => {
|
|
83
83
|
var v, w;
|
|
84
84
|
if (!m) return;
|
|
85
85
|
p = !1, d.forEach((g) => {
|
|
86
|
-
var
|
|
87
|
-
return g((
|
|
86
|
+
var N;
|
|
87
|
+
return g((N = o()) != null ? N : h);
|
|
88
88
|
});
|
|
89
|
-
const
|
|
90
|
-
return
|
|
89
|
+
const x = ((w = s.onRehydrateStorage) == null ? void 0 : w.call(s, (v = o()) != null ? v : h)) || void 0;
|
|
90
|
+
return re(m.getItem.bind(m))(s.name).then((g) => {
|
|
91
91
|
if (g)
|
|
92
92
|
if (typeof g.version == "number" && g.version !== s.version) {
|
|
93
93
|
if (s.migrate) {
|
|
94
|
-
const
|
|
94
|
+
const N = s.migrate(
|
|
95
95
|
g.state,
|
|
96
96
|
g.version
|
|
97
97
|
);
|
|
98
|
-
return
|
|
98
|
+
return N instanceof Promise ? N.then((A) => [!0, A]) : [!0, N];
|
|
99
99
|
}
|
|
100
100
|
console.error(
|
|
101
101
|
"State loaded from storage couldn't be migrated since no migrate function was provided"
|
|
@@ -104,17 +104,17 @@ const Y = (r) => (l) => {
|
|
|
104
104
|
return [!1, g.state];
|
|
105
105
|
return [!1, void 0];
|
|
106
106
|
}).then((g) => {
|
|
107
|
-
var
|
|
108
|
-
const [
|
|
109
|
-
if (
|
|
110
|
-
|
|
111
|
-
(
|
|
112
|
-
), t(
|
|
107
|
+
var N;
|
|
108
|
+
const [A, k] = g;
|
|
109
|
+
if (b = s.merge(
|
|
110
|
+
k,
|
|
111
|
+
(N = o()) != null ? N : h
|
|
112
|
+
), t(b, !0), A)
|
|
113
113
|
return c();
|
|
114
114
|
}).then(() => {
|
|
115
|
-
|
|
115
|
+
x == null || x(b, void 0), b = o(), p = !0, a.forEach((g) => g(b));
|
|
116
116
|
}).catch((g) => {
|
|
117
|
-
|
|
117
|
+
x == null || x(void 0, g);
|
|
118
118
|
});
|
|
119
119
|
};
|
|
120
120
|
return i.persist = {
|
|
@@ -136,9 +136,9 @@ const Y = (r) => (l) => {
|
|
|
136
136
|
onFinishHydration: (v) => (a.add(v), () => {
|
|
137
137
|
a.delete(v);
|
|
138
138
|
})
|
|
139
|
-
}, s.skipHydration || y(),
|
|
140
|
-
},
|
|
141
|
-
async function
|
|
139
|
+
}, s.skipHydration || y(), b || h;
|
|
140
|
+
}, ge = je, j = "/api";
|
|
141
|
+
async function T(r, l) {
|
|
142
142
|
const t = await fetch(r, {
|
|
143
143
|
...l,
|
|
144
144
|
headers: {
|
|
@@ -147,44 +147,44 @@ async function j(r, l) {
|
|
|
147
147
|
}
|
|
148
148
|
});
|
|
149
149
|
if (!t.ok) {
|
|
150
|
-
const
|
|
151
|
-
throw new Error(
|
|
150
|
+
const o = await t.json().catch(() => ({ error: "Unknown error" }));
|
|
151
|
+
throw new Error(o.error || `HTTP ${t.status}`);
|
|
152
152
|
}
|
|
153
153
|
return t.json();
|
|
154
154
|
}
|
|
155
|
-
async function
|
|
156
|
-
return
|
|
155
|
+
async function Me() {
|
|
156
|
+
return T(`${j}/nodes/generators`);
|
|
157
157
|
}
|
|
158
158
|
async function De() {
|
|
159
|
-
return
|
|
159
|
+
return T(`${j}/nodes/transforms`);
|
|
160
160
|
}
|
|
161
161
|
async function Te() {
|
|
162
|
-
return
|
|
162
|
+
return T(`${j}/nodes/text`);
|
|
163
163
|
}
|
|
164
164
|
async function Ue() {
|
|
165
|
-
return
|
|
165
|
+
return T(`${j}/nodes/vision`);
|
|
166
166
|
}
|
|
167
167
|
async function Oe(r, l, t) {
|
|
168
|
-
return
|
|
168
|
+
return T(`${j}/execute/sync`, {
|
|
169
169
|
method: "POST",
|
|
170
170
|
body: JSON.stringify({ nodes: r, edges: l, aiProviders: t })
|
|
171
171
|
});
|
|
172
172
|
}
|
|
173
173
|
async function Re(r, l) {
|
|
174
|
-
return
|
|
174
|
+
return T(`${j}/export/yaml`, {
|
|
175
175
|
method: "POST",
|
|
176
176
|
body: JSON.stringify({ nodes: r, edges: l })
|
|
177
177
|
});
|
|
178
178
|
}
|
|
179
179
|
async function Ee() {
|
|
180
|
-
return
|
|
180
|
+
return T(`${j}/images`);
|
|
181
181
|
}
|
|
182
|
-
function
|
|
183
|
-
return `${
|
|
182
|
+
function le(r) {
|
|
183
|
+
return `${j}/images/${r}/blob`;
|
|
184
184
|
}
|
|
185
185
|
async function Be(r) {
|
|
186
186
|
try {
|
|
187
|
-
return await
|
|
187
|
+
return await T(`${j}/images/${r}/workflow`);
|
|
188
188
|
} catch {
|
|
189
189
|
return null;
|
|
190
190
|
}
|
|
@@ -192,75 +192,75 @@ async function Be(r) {
|
|
|
192
192
|
async function Ve(r) {
|
|
193
193
|
const l = new FormData();
|
|
194
194
|
l.append("file", r);
|
|
195
|
-
const t = await fetch(`${
|
|
195
|
+
const t = await fetch(`${j}/uploads`, {
|
|
196
196
|
method: "POST",
|
|
197
197
|
body: l
|
|
198
198
|
});
|
|
199
199
|
if (!t.ok) {
|
|
200
|
-
const
|
|
201
|
-
throw new Error(
|
|
200
|
+
const o = await t.json().catch(() => ({ error: "Upload failed" }));
|
|
201
|
+
throw new Error(o.error || `HTTP ${t.status}`);
|
|
202
202
|
}
|
|
203
203
|
return t.json();
|
|
204
204
|
}
|
|
205
205
|
async function Ge() {
|
|
206
|
-
return
|
|
206
|
+
return T(`${j}/uploads`);
|
|
207
207
|
}
|
|
208
208
|
async function Fe(r) {
|
|
209
|
-
const l = await fetch(`${
|
|
209
|
+
const l = await fetch(`${j}/uploads/${r}`, {
|
|
210
210
|
method: "DELETE"
|
|
211
211
|
});
|
|
212
212
|
if (!l.ok)
|
|
213
213
|
throw new Error(`Failed to delete upload: ${l.status}`);
|
|
214
214
|
}
|
|
215
|
-
function
|
|
216
|
-
return `${
|
|
215
|
+
function he(r) {
|
|
216
|
+
return `${j}/uploads/${r}/blob`;
|
|
217
217
|
}
|
|
218
218
|
async function He(r) {
|
|
219
|
-
return
|
|
219
|
+
return T(`${j}/import`, {
|
|
220
220
|
method: "POST",
|
|
221
221
|
body: JSON.stringify({ yaml: r })
|
|
222
222
|
});
|
|
223
223
|
}
|
|
224
224
|
async function _e(r) {
|
|
225
|
-
return
|
|
225
|
+
return T(`${j}/import/validate`, {
|
|
226
226
|
method: "POST",
|
|
227
227
|
body: JSON.stringify({ yaml: r })
|
|
228
228
|
});
|
|
229
229
|
}
|
|
230
230
|
async function Ke(r) {
|
|
231
|
-
return
|
|
231
|
+
return T(`${j}/generate/workflow`, {
|
|
232
232
|
method: "POST",
|
|
233
233
|
body: JSON.stringify(r)
|
|
234
234
|
});
|
|
235
235
|
}
|
|
236
236
|
async function qe() {
|
|
237
|
-
return
|
|
237
|
+
return T(`${j}/generate/status`);
|
|
238
238
|
}
|
|
239
|
-
const
|
|
240
|
-
|
|
239
|
+
const de = "http://localhost:11434", ce = "http://localhost:1234", V = ue()(
|
|
240
|
+
ge(
|
|
241
241
|
(r, l) => ({
|
|
242
242
|
ai: {
|
|
243
243
|
ollama: {
|
|
244
|
-
baseUrl:
|
|
244
|
+
baseUrl: de,
|
|
245
245
|
enabled: !1
|
|
246
246
|
},
|
|
247
247
|
lmstudio: {
|
|
248
|
-
baseUrl:
|
|
248
|
+
baseUrl: ce,
|
|
249
249
|
enabled: !1
|
|
250
250
|
}
|
|
251
251
|
},
|
|
252
252
|
showSettings: !1,
|
|
253
|
-
setAIProvider: (t,
|
|
253
|
+
setAIProvider: (t, o) => {
|
|
254
254
|
r((i) => ({
|
|
255
255
|
ai: {
|
|
256
256
|
...i.ai,
|
|
257
|
-
[t]:
|
|
257
|
+
[t]: o
|
|
258
258
|
}
|
|
259
259
|
}));
|
|
260
260
|
},
|
|
261
261
|
clearAIProvider: (t) => {
|
|
262
|
-
r((
|
|
263
|
-
const i = { ...
|
|
262
|
+
r((o) => {
|
|
263
|
+
const i = { ...o.ai };
|
|
264
264
|
return delete i[t], { ai: i };
|
|
265
265
|
});
|
|
266
266
|
},
|
|
@@ -268,8 +268,8 @@ const ie = "http://localhost:11434", le = "http://localhost:1234", O = me()(
|
|
|
268
268
|
closeSettings: () => r({ showSettings: !1 }),
|
|
269
269
|
getConfiguredProviders: () => {
|
|
270
270
|
var i, s, p, d, a, m, c;
|
|
271
|
-
const { ai: t } = l(),
|
|
272
|
-
return (i = t.openai) != null && i.enabled && t.openai.apiKey && (
|
|
271
|
+
const { ai: t } = l(), o = {};
|
|
272
|
+
return (i = t.openai) != null && i.enabled && t.openai.apiKey && (o.openai = { apiKey: t.openai.apiKey }), (s = t.anthropic) != null && s.enabled && t.anthropic.apiKey && (o.anthropic = { apiKey: t.anthropic.apiKey }), (p = t.gemini) != null && p.enabled && t.gemini.apiKey && (o.gemini = { apiKey: t.gemini.apiKey }), (d = t.grok) != null && d.enabled && t.grok.apiKey && (o.grok = { apiKey: t.grok.apiKey }), (a = t.openrouter) != null && a.enabled && t.openrouter.apiKey && (o.openrouter = { apiKey: t.openrouter.apiKey }), (m = t.ollama) != null && m.enabled && (o.ollama = { baseUrl: t.ollama.baseUrl || de }), (c = t.lmstudio) != null && c.enabled && (o.lmstudio = { baseUrl: t.lmstudio.baseUrl || ce }), o;
|
|
273
273
|
}
|
|
274
274
|
}),
|
|
275
275
|
{
|
|
@@ -280,15 +280,15 @@ const ie = "http://localhost:11434", le = "http://localhost:1234", O = me()(
|
|
|
280
280
|
)
|
|
281
281
|
);
|
|
282
282
|
let Je = 0;
|
|
283
|
-
function
|
|
283
|
+
function H() {
|
|
284
284
|
return `node_${++Je}`;
|
|
285
285
|
}
|
|
286
|
-
function
|
|
286
|
+
function me() {
|
|
287
287
|
const r = Date.now(), l = Math.random().toString(36).substring(2, 8);
|
|
288
288
|
return `wf_${r}_${l}`;
|
|
289
289
|
}
|
|
290
|
-
const
|
|
291
|
-
|
|
290
|
+
const f = ue()(
|
|
291
|
+
ge(
|
|
292
292
|
(r, l) => ({
|
|
293
293
|
nodes: [],
|
|
294
294
|
edges: [],
|
|
@@ -314,16 +314,16 @@ const k = me()(
|
|
|
314
314
|
nodeStatus: {}
|
|
315
315
|
},
|
|
316
316
|
loadTemplate: (t) => {
|
|
317
|
-
const
|
|
318
|
-
const d =
|
|
319
|
-
return
|
|
317
|
+
const o = /* @__PURE__ */ new Map(), i = t.workflow.nodes.map((p) => {
|
|
318
|
+
const d = H();
|
|
319
|
+
return o.set(p.id, d), {
|
|
320
320
|
id: d,
|
|
321
321
|
type: p.type,
|
|
322
322
|
position: p.position,
|
|
323
323
|
data: p.data
|
|
324
324
|
};
|
|
325
325
|
}), s = t.workflow.edges.map((p) => {
|
|
326
|
-
const d =
|
|
326
|
+
const d = o.get(p.source) || p.source, a = o.get(p.target) || p.target;
|
|
327
327
|
return {
|
|
328
328
|
id: `edge_${d}_${a}`,
|
|
329
329
|
source: d,
|
|
@@ -364,10 +364,10 @@ const k = me()(
|
|
|
364
364
|
});
|
|
365
365
|
},
|
|
366
366
|
togglePreview: (t) => {
|
|
367
|
-
r((
|
|
367
|
+
r((o) => ({
|
|
368
368
|
previewVisible: {
|
|
369
|
-
...
|
|
370
|
-
[t]:
|
|
369
|
+
...o.previewVisible,
|
|
370
|
+
[t]: o.previewVisible[t] === !1
|
|
371
371
|
// default true, toggle
|
|
372
372
|
}
|
|
373
373
|
}));
|
|
@@ -376,14 +376,14 @@ const k = me()(
|
|
|
376
376
|
setTransforms: (t) => r({ transforms: t }),
|
|
377
377
|
setTextProviders: (t) => r({ textProviders: t }),
|
|
378
378
|
setVisionProviders: (t) => r({ visionProviders: t }),
|
|
379
|
-
addNode: (t,
|
|
379
|
+
addNode: (t, o) => {
|
|
380
380
|
var d, a, m;
|
|
381
|
-
const i =
|
|
381
|
+
const i = H();
|
|
382
382
|
let s;
|
|
383
383
|
if (t.type === "generator")
|
|
384
384
|
s = {
|
|
385
385
|
generatorName: t.name,
|
|
386
|
-
params:
|
|
386
|
+
params: Q(t),
|
|
387
387
|
isAI: t.isAI,
|
|
388
388
|
// Track if this is an AI generator (can accept text input)
|
|
389
389
|
acceptsReferenceImages: t.acceptsReferenceImages,
|
|
@@ -396,7 +396,7 @@ const k = me()(
|
|
|
396
396
|
// Track which provider this transform belongs to
|
|
397
397
|
isAI: t.isAI,
|
|
398
398
|
// Track if this is an AI transform (can accept text input)
|
|
399
|
-
params:
|
|
399
|
+
params: Q(t),
|
|
400
400
|
acceptsReferenceImages: t.acceptsReferenceImages,
|
|
401
401
|
maxReferenceImages: t.maxReferenceImages
|
|
402
402
|
};
|
|
@@ -411,14 +411,14 @@ const k = me()(
|
|
|
411
411
|
providerName: t.name,
|
|
412
412
|
providerLabel: t.label,
|
|
413
413
|
// Human-readable label (e.g., "Gemini Vision")
|
|
414
|
-
params:
|
|
414
|
+
params: Q(t)
|
|
415
415
|
};
|
|
416
416
|
else if (t.type === "text")
|
|
417
417
|
s = {
|
|
418
418
|
providerName: t.name,
|
|
419
419
|
providerLabel: t.label,
|
|
420
420
|
// Human-readable label (e.g., "Gemini Text")
|
|
421
|
-
params:
|
|
421
|
+
params: Q(t)
|
|
422
422
|
};
|
|
423
423
|
else {
|
|
424
424
|
const c = ((d = t.params) == null ? void 0 : d.properties) || {}, u = ((a = c.provider) == null ? void 0 : a.default) || "filesystem";
|
|
@@ -430,31 +430,31 @@ const k = me()(
|
|
|
430
430
|
const p = {
|
|
431
431
|
id: i,
|
|
432
432
|
type: t.type,
|
|
433
|
-
position:
|
|
433
|
+
position: o,
|
|
434
434
|
data: s
|
|
435
435
|
};
|
|
436
436
|
r((c) => ({
|
|
437
437
|
nodes: [...c.nodes, p]
|
|
438
438
|
}));
|
|
439
439
|
},
|
|
440
|
-
updateNodeData: (t,
|
|
440
|
+
updateNodeData: (t, o) => {
|
|
441
441
|
r((i) => ({
|
|
442
442
|
nodes: i.nodes.map(
|
|
443
|
-
(s) => s.id === t ? { ...s, data: { ...s.data, ...
|
|
443
|
+
(s) => s.id === t ? { ...s, data: { ...s.data, ...o } } : s
|
|
444
444
|
)
|
|
445
445
|
}));
|
|
446
446
|
},
|
|
447
447
|
deleteNode: (t) => {
|
|
448
|
-
r((
|
|
449
|
-
nodes:
|
|
450
|
-
edges:
|
|
451
|
-
selectedNodeId:
|
|
448
|
+
r((o) => ({
|
|
449
|
+
nodes: o.nodes.filter((i) => i.id !== t),
|
|
450
|
+
edges: o.edges.filter((i) => i.source !== t && i.target !== t),
|
|
451
|
+
selectedNodeId: o.selectedNodeId === t ? null : o.selectedNodeId
|
|
452
452
|
}));
|
|
453
453
|
},
|
|
454
454
|
duplicateNode: (t) => {
|
|
455
|
-
const
|
|
455
|
+
const o = l(), i = o.nodes.find((d) => d.id === t);
|
|
456
456
|
if (!i) return;
|
|
457
|
-
const s =
|
|
457
|
+
const s = H(), p = {
|
|
458
458
|
...i,
|
|
459
459
|
id: s,
|
|
460
460
|
position: {
|
|
@@ -466,7 +466,7 @@ const k = me()(
|
|
|
466
466
|
selected: !1
|
|
467
467
|
};
|
|
468
468
|
r({
|
|
469
|
-
nodes: [...
|
|
469
|
+
nodes: [...o.nodes, p],
|
|
470
470
|
selectedNodeId: s
|
|
471
471
|
// Select the new node
|
|
472
472
|
});
|
|
@@ -474,8 +474,8 @@ const k = me()(
|
|
|
474
474
|
setNodes: (t) => r({ nodes: t }),
|
|
475
475
|
addEdge: (t) => {
|
|
476
476
|
if (!t.source || !t.target) return;
|
|
477
|
-
const
|
|
478
|
-
id:
|
|
477
|
+
const o = [t.sourceHandle, t.targetHandle].filter(Boolean).join("_"), s = {
|
|
478
|
+
id: o ? `edge_${t.source}_${t.target}_${o}` : `edge_${t.source}_${t.target}`,
|
|
479
479
|
source: t.source,
|
|
480
480
|
target: t.target,
|
|
481
481
|
sourceHandle: t.sourceHandle ?? void 0,
|
|
@@ -486,25 +486,25 @@ const k = me()(
|
|
|
486
486
|
}));
|
|
487
487
|
},
|
|
488
488
|
deleteEdge: (t) => {
|
|
489
|
-
r((
|
|
490
|
-
edges:
|
|
489
|
+
r((o) => ({
|
|
490
|
+
edges: o.edges.filter((i) => i.id !== t)
|
|
491
491
|
}));
|
|
492
492
|
},
|
|
493
493
|
setEdges: (t) => r({ edges: t }),
|
|
494
494
|
setSelectedNode: (t) => r({ selectedNodeId: t }),
|
|
495
495
|
execute: async () => {
|
|
496
|
-
const { nodes: t, edges:
|
|
496
|
+
const { nodes: t, edges: o } = l(), i = t.map((a) => ({
|
|
497
497
|
id: a.id,
|
|
498
498
|
type: a.type,
|
|
499
499
|
position: a.position,
|
|
500
500
|
data: a.data
|
|
501
|
-
})), s =
|
|
501
|
+
})), s = o.map((a) => ({
|
|
502
502
|
id: a.id,
|
|
503
503
|
source: a.source,
|
|
504
504
|
target: a.target,
|
|
505
505
|
sourceHandle: a.sourceHandle ?? void 0,
|
|
506
506
|
targetHandle: a.targetHandle ?? void 0
|
|
507
|
-
})), p =
|
|
507
|
+
})), p = V.getState().getConfiguredProviders(), d = {};
|
|
508
508
|
for (const a of t)
|
|
509
509
|
d[a.id] = "running";
|
|
510
510
|
r({
|
|
@@ -559,12 +559,12 @@ const k = me()(
|
|
|
559
559
|
}
|
|
560
560
|
},
|
|
561
561
|
exportToYaml: async () => {
|
|
562
|
-
const { nodes: t, edges:
|
|
562
|
+
const { nodes: t, edges: o } = l(), i = t.map((d) => ({
|
|
563
563
|
id: d.id,
|
|
564
564
|
type: d.type,
|
|
565
565
|
position: d.position,
|
|
566
566
|
data: d.data
|
|
567
|
-
})), s =
|
|
567
|
+
})), s = o.map((d) => ({
|
|
568
568
|
id: d.id,
|
|
569
569
|
source: d.source,
|
|
570
570
|
target: d.target,
|
|
@@ -573,16 +573,16 @@ const k = me()(
|
|
|
573
573
|
}));
|
|
574
574
|
return (await Re(i, s)).yaml;
|
|
575
575
|
},
|
|
576
|
-
importFromYaml: (t,
|
|
576
|
+
importFromYaml: (t, o, i) => {
|
|
577
577
|
const s = /* @__PURE__ */ new Map(), p = t.map((a) => {
|
|
578
|
-
const m =
|
|
578
|
+
const m = H();
|
|
579
579
|
return s.set(a.id, m), {
|
|
580
580
|
id: m,
|
|
581
581
|
type: a.type,
|
|
582
582
|
position: a.position,
|
|
583
583
|
data: a.data
|
|
584
584
|
};
|
|
585
|
-
}), d =
|
|
585
|
+
}), d = o.map((a) => {
|
|
586
586
|
const m = s.get(a.source) || a.source, c = s.get(a.target) || a.target;
|
|
587
587
|
return {
|
|
588
588
|
id: `edge_${m}_${c}`,
|
|
@@ -635,7 +635,7 @@ const k = me()(
|
|
|
635
635
|
},
|
|
636
636
|
saveWorkflow: (t) => {
|
|
637
637
|
const {
|
|
638
|
-
nodes:
|
|
638
|
+
nodes: o,
|
|
639
639
|
edges: i,
|
|
640
640
|
activeWorkflowId: s,
|
|
641
641
|
activeWorkflowName: p,
|
|
@@ -644,7 +644,7 @@ const k = me()(
|
|
|
644
644
|
} = l(), m = Date.now();
|
|
645
645
|
if (s) {
|
|
646
646
|
const c = d.map(
|
|
647
|
-
(u) => u.id === s ? { ...u, name: t || p, nodes:
|
|
647
|
+
(u) => u.id === s ? { ...u, name: t || p, nodes: o, edges: i, updatedAt: m } : u
|
|
648
648
|
);
|
|
649
649
|
return r({
|
|
650
650
|
savedWorkflows: c,
|
|
@@ -652,10 +652,10 @@ const k = me()(
|
|
|
652
652
|
hasUnsavedChanges: !1
|
|
653
653
|
}), s;
|
|
654
654
|
} else {
|
|
655
|
-
const c =
|
|
655
|
+
const c = me(), u = {
|
|
656
656
|
id: c,
|
|
657
657
|
name: t || p,
|
|
658
|
-
nodes:
|
|
658
|
+
nodes: o,
|
|
659
659
|
edges: i,
|
|
660
660
|
createdAt: m,
|
|
661
661
|
updatedAt: m,
|
|
@@ -670,7 +670,7 @@ const k = me()(
|
|
|
670
670
|
}
|
|
671
671
|
},
|
|
672
672
|
loadWorkflow: (t) => {
|
|
673
|
-
const { savedWorkflows:
|
|
673
|
+
const { savedWorkflows: o } = l(), i = o.find((s) => s.id === t);
|
|
674
674
|
i && r({
|
|
675
675
|
nodes: i.nodes,
|
|
676
676
|
edges: i.edges,
|
|
@@ -691,7 +691,7 @@ const k = me()(
|
|
|
691
691
|
});
|
|
692
692
|
},
|
|
693
693
|
deleteWorkflow: (t) => {
|
|
694
|
-
const { savedWorkflows:
|
|
694
|
+
const { savedWorkflows: o, activeWorkflowId: i } = l(), s = o.filter((p) => p.id !== t);
|
|
695
695
|
r(i === t ? {
|
|
696
696
|
savedWorkflows: s,
|
|
697
697
|
nodes: [],
|
|
@@ -712,92 +712,92 @@ const k = me()(
|
|
|
712
712
|
}
|
|
713
713
|
} : { savedWorkflows: s });
|
|
714
714
|
},
|
|
715
|
-
renameWorkflow: (t,
|
|
715
|
+
renameWorkflow: (t, o) => {
|
|
716
716
|
const { savedWorkflows: i, activeWorkflowId: s } = l(), p = i.map(
|
|
717
|
-
(d) => d.id === t ? { ...d, name:
|
|
717
|
+
(d) => d.id === t ? { ...d, name: o, updatedAt: Date.now() } : d
|
|
718
718
|
);
|
|
719
719
|
r({
|
|
720
720
|
savedWorkflows: p,
|
|
721
|
-
...s === t ? { activeWorkflowName:
|
|
721
|
+
...s === t ? { activeWorkflowName: o } : {}
|
|
722
722
|
});
|
|
723
723
|
},
|
|
724
724
|
duplicateWorkflow: (t) => {
|
|
725
|
-
const { savedWorkflows:
|
|
725
|
+
const { savedWorkflows: o } = l(), i = o.find((a) => a.id === t);
|
|
726
726
|
if (!i) return "";
|
|
727
|
-
const s = Date.now(), p =
|
|
727
|
+
const s = Date.now(), p = me(), d = {
|
|
728
728
|
...i,
|
|
729
729
|
id: p,
|
|
730
730
|
name: `${i.name} (Copy)`,
|
|
731
731
|
createdAt: s,
|
|
732
732
|
updatedAt: s
|
|
733
733
|
};
|
|
734
|
-
return r({ savedWorkflows: [...
|
|
734
|
+
return r({ savedWorkflows: [...o, d] }), p;
|
|
735
735
|
},
|
|
736
736
|
loadGeneratedWorkflow: (t) => {
|
|
737
|
-
const
|
|
738
|
-
const u =
|
|
739
|
-
|
|
740
|
-
const h = m.nodeType.split(":"),
|
|
737
|
+
const o = /* @__PURE__ */ new Map(), i = 250, s = 150, p = 3, d = t.nodes.map((m, c) => {
|
|
738
|
+
const u = H();
|
|
739
|
+
o.set(m.id, u);
|
|
740
|
+
const h = m.nodeType.split(":"), b = h[0], y = Math.floor(c / p), w = {
|
|
741
741
|
x: 100 + c % p * i,
|
|
742
742
|
y: 100 + y * s
|
|
743
743
|
};
|
|
744
|
-
let
|
|
745
|
-
if (
|
|
746
|
-
|
|
744
|
+
let x;
|
|
745
|
+
if (b === "generator")
|
|
746
|
+
x = {
|
|
747
747
|
generatorName: h.slice(1).join(":"),
|
|
748
748
|
params: m.parameters,
|
|
749
749
|
isAI: !0
|
|
750
750
|
// Assume AI since we're generating from AI
|
|
751
751
|
};
|
|
752
|
-
else if (
|
|
752
|
+
else if (b === "transform") {
|
|
753
753
|
const g = h[1];
|
|
754
|
-
|
|
754
|
+
x = {
|
|
755
755
|
operation: h.slice(2).join(":"),
|
|
756
756
|
providerName: g,
|
|
757
757
|
params: m.parameters
|
|
758
758
|
};
|
|
759
|
-
} else if (
|
|
760
|
-
|
|
759
|
+
} else if (b === "input")
|
|
760
|
+
x = {
|
|
761
761
|
uploadId: void 0,
|
|
762
762
|
filename: void 0,
|
|
763
763
|
mime: void 0
|
|
764
764
|
};
|
|
765
|
-
else if (
|
|
766
|
-
|
|
765
|
+
else if (b === "vision")
|
|
766
|
+
x = {
|
|
767
767
|
providerName: h.slice(1).join(":"),
|
|
768
768
|
params: m.parameters
|
|
769
769
|
};
|
|
770
|
-
else if (
|
|
771
|
-
const g = h.slice(1).join(":"),
|
|
770
|
+
else if (b === "text") {
|
|
771
|
+
const g = h.slice(1).join(":"), N = m.parameters.jsonSchema, A = N != null && N.properties ? {
|
|
772
772
|
type: "object",
|
|
773
773
|
properties: Object.fromEntries(
|
|
774
|
-
Object.entries(
|
|
775
|
-
|
|
774
|
+
Object.entries(N.properties).map(([k, L]) => [
|
|
775
|
+
k,
|
|
776
776
|
{
|
|
777
|
-
type:
|
|
778
|
-
description:
|
|
777
|
+
type: L.type || "string",
|
|
778
|
+
description: L.description
|
|
779
779
|
}
|
|
780
780
|
])
|
|
781
781
|
)
|
|
782
782
|
} : void 0;
|
|
783
|
-
|
|
783
|
+
x = {
|
|
784
784
|
providerName: g,
|
|
785
785
|
params: m.parameters,
|
|
786
|
-
outputSchema:
|
|
786
|
+
outputSchema: A
|
|
787
787
|
};
|
|
788
788
|
} else
|
|
789
|
-
|
|
789
|
+
x = {
|
|
790
790
|
destination: m.parameters.destination || "./output/image.png",
|
|
791
791
|
provider: m.parameters.provider || "filesystem"
|
|
792
792
|
};
|
|
793
793
|
return {
|
|
794
794
|
id: u,
|
|
795
|
-
type:
|
|
795
|
+
type: b,
|
|
796
796
|
position: w,
|
|
797
|
-
data:
|
|
797
|
+
data: x
|
|
798
798
|
};
|
|
799
799
|
}), a = t.edges.map((m) => {
|
|
800
|
-
const c =
|
|
800
|
+
const c = o.get(m.source) || m.source, u = o.get(m.target) || m.target, h = [m.sourceHandle, m.targetHandle].filter(Boolean).join("_");
|
|
801
801
|
return {
|
|
802
802
|
id: h ? `edge_${c}_${u}_${h}` : `edge_${c}_${u}`,
|
|
803
803
|
source: c,
|
|
@@ -835,24 +835,24 @@ const k = me()(
|
|
|
835
835
|
}
|
|
836
836
|
)
|
|
837
837
|
);
|
|
838
|
-
function
|
|
838
|
+
function Q(r) {
|
|
839
839
|
var t;
|
|
840
840
|
const l = {};
|
|
841
841
|
if ((t = r.params) != null && t.properties)
|
|
842
|
-
for (const [
|
|
843
|
-
i.default !== void 0 && (l[
|
|
842
|
+
for (const [o, i] of Object.entries(r.params.properties))
|
|
843
|
+
i.default !== void 0 && (l[o] = i.default);
|
|
844
844
|
return l;
|
|
845
845
|
}
|
|
846
|
-
function
|
|
846
|
+
function F(r) {
|
|
847
847
|
return r === "running" ? "border-yellow-400 animate-pulse" : r === "completed" ? "border-green-500" : r === "error" ? "border-red-500" : "";
|
|
848
848
|
}
|
|
849
|
-
function
|
|
850
|
-
const t =
|
|
849
|
+
function ae({ nodeId: r, color: l }) {
|
|
850
|
+
const t = f((i) => i.previewVisible[r] !== !1), o = f((i) => i.togglePreview);
|
|
851
851
|
return /* @__PURE__ */ e(
|
|
852
852
|
"button",
|
|
853
853
|
{
|
|
854
854
|
onClick: (i) => {
|
|
855
|
-
i.stopPropagation(),
|
|
855
|
+
i.stopPropagation(), o(r);
|
|
856
856
|
},
|
|
857
857
|
className: `ml-auto p-1 rounded hover:bg-gray-200 dark:hover:bg-zinc-600 transition-colors ${t ? "opacity-100" : "opacity-40"}`,
|
|
858
858
|
title: t ? "Hide preview" : "Show preview",
|
|
@@ -876,32 +876,32 @@ function X({ nodeId: r, color: l }) {
|
|
|
876
876
|
}
|
|
877
877
|
);
|
|
878
878
|
}
|
|
879
|
-
const Qe =
|
|
879
|
+
const Qe = G(function({
|
|
880
880
|
id: l,
|
|
881
881
|
data: t,
|
|
882
|
-
selected:
|
|
882
|
+
selected: o
|
|
883
883
|
}) {
|
|
884
|
-
const i =
|
|
885
|
-
return /* @__PURE__ */
|
|
884
|
+
const i = f((u) => u.execution.previews[l]), s = f((u) => u.execution.nodeStatus[l]), p = f((u) => u.previewVisible[l] !== !1), a = F(s) || (o ? "border-blue-500" : "border-blue-200"), m = t.isAI, c = t.acceptsReferenceImages;
|
|
885
|
+
return /* @__PURE__ */ n(
|
|
886
886
|
"div",
|
|
887
887
|
{
|
|
888
888
|
className: `rounded-lg border-2 bg-white dark:bg-zinc-800 shadow-md min-w-[180px] overflow-hidden ${a}`,
|
|
889
889
|
children: [
|
|
890
890
|
m && /* @__PURE__ */ e(
|
|
891
|
-
|
|
891
|
+
P,
|
|
892
892
|
{
|
|
893
893
|
type: "target",
|
|
894
|
-
position:
|
|
894
|
+
position: $.Top,
|
|
895
895
|
id: "text",
|
|
896
896
|
className: "w-3 h-3 !bg-pink-500",
|
|
897
897
|
title: "Text input (optional prompt from text/vision node)"
|
|
898
898
|
}
|
|
899
899
|
),
|
|
900
900
|
c && /* @__PURE__ */ e(
|
|
901
|
-
|
|
901
|
+
P,
|
|
902
902
|
{
|
|
903
903
|
type: "target",
|
|
904
|
-
position:
|
|
904
|
+
position: $.Left,
|
|
905
905
|
id: "references",
|
|
906
906
|
className: "w-3 h-3 !bg-violet-500",
|
|
907
907
|
style: { top: "50%" },
|
|
@@ -909,60 +909,60 @@ const Qe = E(function({
|
|
|
909
909
|
}
|
|
910
910
|
),
|
|
911
911
|
i && p && /* @__PURE__ */ e("div", { className: "bg-gray-100 dark:bg-zinc-900 border-b border-gray-200 dark:border-zinc-700", children: /* @__PURE__ */ e("img", { src: i, alt: "Preview", className: "w-full h-24 object-contain" }) }),
|
|
912
|
-
/* @__PURE__ */
|
|
913
|
-
/* @__PURE__ */
|
|
912
|
+
/* @__PURE__ */ n("div", { className: "px-4 py-3", children: [
|
|
913
|
+
/* @__PURE__ */ n("div", { className: "flex items-center gap-2 mb-2", children: [
|
|
914
914
|
/* @__PURE__ */ e("div", { className: "w-3 h-3 rounded-full bg-blue-500" }),
|
|
915
915
|
/* @__PURE__ */ e("span", { className: "font-semibold text-sm text-blue-700 dark:text-blue-400", children: t.generatorName }),
|
|
916
|
-
/* @__PURE__ */ e(
|
|
916
|
+
/* @__PURE__ */ e(ae, { nodeId: l, color: "text-blue-500 dark:text-blue-400" })
|
|
917
917
|
] }),
|
|
918
918
|
m && /* @__PURE__ */ e("div", { className: "text-[10px] text-pink-500 dark:text-pink-400 mb-1", children: "↑ Connect text node for dynamic prompt" }),
|
|
919
919
|
c && /* @__PURE__ */ e("div", { className: "text-[10px] text-violet-500 dark:text-violet-400 mb-1", children: "← Connect reference images" }),
|
|
920
|
-
/* @__PURE__ */ e("div", { className: "text-xs text-gray-500 dark:text-zinc-400", children: Object.entries(t.params).filter(([, u]) => typeof u != "object" || u === null).slice(0, 2).map(([u, h]) => /* @__PURE__ */
|
|
920
|
+
/* @__PURE__ */ e("div", { className: "text-xs text-gray-500 dark:text-zinc-400", children: Object.entries(t.params).filter(([, u]) => typeof u != "object" || u === null).slice(0, 2).map(([u, h]) => /* @__PURE__ */ n("div", { className: "truncate", children: [
|
|
921
921
|
u,
|
|
922
922
|
": ",
|
|
923
923
|
String(h).slice(0, 20)
|
|
924
924
|
] }, u)) })
|
|
925
925
|
] }),
|
|
926
|
-
/* @__PURE__ */ e(
|
|
926
|
+
/* @__PURE__ */ e(P, { type: "source", position: $.Right, className: "w-3 h-3 !bg-blue-500" })
|
|
927
927
|
]
|
|
928
928
|
}
|
|
929
929
|
);
|
|
930
|
-
}), Ye =
|
|
930
|
+
}), Ye = G(function({
|
|
931
931
|
id: l,
|
|
932
932
|
data: t,
|
|
933
|
-
selected:
|
|
933
|
+
selected: o
|
|
934
934
|
}) {
|
|
935
|
-
const i =
|
|
936
|
-
return /* @__PURE__ */
|
|
935
|
+
const i = f((u) => u.execution.previews[l]), s = f((u) => u.execution.nodeStatus[l]), p = f((u) => u.previewVisible[l] !== !1), a = F(s) || (o ? "border-teal-500" : "border-teal-200"), m = t.isAI, c = t.acceptsReferenceImages;
|
|
936
|
+
return /* @__PURE__ */ n(
|
|
937
937
|
"div",
|
|
938
938
|
{
|
|
939
939
|
className: `rounded-lg border-2 bg-white dark:bg-zinc-800 shadow-md min-w-[180px] overflow-hidden ${a}`,
|
|
940
940
|
children: [
|
|
941
941
|
m && /* @__PURE__ */ e(
|
|
942
|
-
|
|
942
|
+
P,
|
|
943
943
|
{
|
|
944
944
|
type: "target",
|
|
945
|
-
position:
|
|
945
|
+
position: $.Top,
|
|
946
946
|
id: "text",
|
|
947
947
|
className: "w-3 h-3 !bg-pink-500",
|
|
948
948
|
title: "Text input (optional prompt from text/vision node)"
|
|
949
949
|
}
|
|
950
950
|
),
|
|
951
|
-
/* @__PURE__ */ e(
|
|
951
|
+
/* @__PURE__ */ e(P, { type: "target", position: $.Left, id: "image", className: "w-3 h-3 !bg-teal-500" }),
|
|
952
952
|
c && /* @__PURE__ */ e(
|
|
953
|
-
|
|
953
|
+
P,
|
|
954
954
|
{
|
|
955
955
|
type: "target",
|
|
956
|
-
position:
|
|
956
|
+
position: $.Bottom,
|
|
957
957
|
id: "references",
|
|
958
958
|
className: "w-3 h-3 !bg-violet-500",
|
|
959
959
|
title: `Reference images (up to ${t.maxReferenceImages || 13})`
|
|
960
960
|
}
|
|
961
961
|
),
|
|
962
962
|
i && p && /* @__PURE__ */ e("div", { className: "bg-gray-100 dark:bg-zinc-900 border-b border-gray-200 dark:border-zinc-700", children: /* @__PURE__ */ e("img", { src: i, alt: "Preview", className: "w-full h-24 object-contain" }) }),
|
|
963
|
-
/* @__PURE__ */
|
|
964
|
-
/* @__PURE__ */
|
|
965
|
-
m ? /* @__PURE__ */
|
|
963
|
+
/* @__PURE__ */ n("div", { className: "px-4 py-3", children: [
|
|
964
|
+
/* @__PURE__ */ n("div", { className: "flex items-center gap-2 mb-2", children: [
|
|
965
|
+
m ? /* @__PURE__ */ n("svg", { className: "w-3 h-3 text-purple-500", fill: "currentColor", viewBox: "0 0 20 20", children: [
|
|
966
966
|
/* @__PURE__ */ e("path", { d: "M13 7H7v6h6V7z" }),
|
|
967
967
|
/* @__PURE__ */ e(
|
|
968
968
|
"path",
|
|
@@ -981,7 +981,7 @@ const Qe = E(function({
|
|
|
981
981
|
}
|
|
982
982
|
),
|
|
983
983
|
/* @__PURE__ */ e(
|
|
984
|
-
|
|
984
|
+
ae,
|
|
985
985
|
{
|
|
986
986
|
nodeId: l,
|
|
987
987
|
color: m ? "text-purple-500 dark:text-purple-400" : "text-teal-500 dark:text-teal-400"
|
|
@@ -990,25 +990,25 @@ const Qe = E(function({
|
|
|
990
990
|
] }),
|
|
991
991
|
m && /* @__PURE__ */ e("div", { className: "text-[10px] text-pink-500 dark:text-pink-400 mb-1", children: "↑ Connect text node for dynamic prompt" }),
|
|
992
992
|
c && /* @__PURE__ */ e("div", { className: "text-[10px] text-violet-500 dark:text-violet-400 mb-1", children: "↓ Connect reference images" }),
|
|
993
|
-
/* @__PURE__ */ e("div", { className: "text-xs text-gray-500 dark:text-zinc-400", children: Object.entries(t.params).filter(([, u]) => typeof u != "object" || u === null).slice(0, 2).map(([u, h]) => /* @__PURE__ */
|
|
993
|
+
/* @__PURE__ */ e("div", { className: "text-xs text-gray-500 dark:text-zinc-400", children: Object.entries(t.params).filter(([, u]) => typeof u != "object" || u === null).slice(0, 2).map(([u, h]) => /* @__PURE__ */ n("div", { className: "truncate", children: [
|
|
994
994
|
u,
|
|
995
995
|
": ",
|
|
996
996
|
String(h).slice(0, 20)
|
|
997
997
|
] }, u)) })
|
|
998
998
|
] }),
|
|
999
|
-
/* @__PURE__ */ e(
|
|
999
|
+
/* @__PURE__ */ e(P, { type: "source", position: $.Right, className: "w-3 h-3 !bg-teal-500" })
|
|
1000
1000
|
]
|
|
1001
1001
|
}
|
|
1002
1002
|
);
|
|
1003
|
-
}), Xe =
|
|
1004
|
-
const i =
|
|
1005
|
-
return /* @__PURE__ */
|
|
1003
|
+
}), Xe = G(function({ id: l, data: t, selected: o }) {
|
|
1004
|
+
const i = f((d) => d.execution.nodeStatus[l]), p = F(i) || (o ? "border-green-500" : "border-green-200");
|
|
1005
|
+
return /* @__PURE__ */ n(
|
|
1006
1006
|
"div",
|
|
1007
1007
|
{
|
|
1008
1008
|
className: `px-4 py-3 rounded-lg border-2 bg-white dark:bg-zinc-800 shadow-md min-w-[180px] ${p}`,
|
|
1009
1009
|
children: [
|
|
1010
|
-
/* @__PURE__ */ e(
|
|
1011
|
-
/* @__PURE__ */
|
|
1010
|
+
/* @__PURE__ */ e(P, { type: "target", position: $.Left, className: "w-3 h-3 !bg-green-500" }),
|
|
1011
|
+
/* @__PURE__ */ n("div", { className: "flex items-center gap-2 mb-2", children: [
|
|
1012
1012
|
/* @__PURE__ */ e("div", { className: "w-3 h-3 rounded-full bg-green-500" }),
|
|
1013
1013
|
/* @__PURE__ */ e("span", { className: "font-semibold text-sm text-green-700 dark:text-green-400", children: "Save" })
|
|
1014
1014
|
] }),
|
|
@@ -1016,44 +1016,44 @@ const Qe = E(function({
|
|
|
1016
1016
|
]
|
|
1017
1017
|
}
|
|
1018
1018
|
);
|
|
1019
|
-
}), Ze =
|
|
1020
|
-
const i =
|
|
1019
|
+
}), Ze = G(function({ id: l, data: t, selected: o }) {
|
|
1020
|
+
const i = f((w) => w.execution.previews[l]), s = f((w) => w.execution.nodeStatus[l]), p = f((w) => w.previewVisible[l] !== !1), d = f((w) => w.updateNodeData), a = te(null), c = F(s) || (o ? "border-amber-500" : "border-amber-200"), u = W(
|
|
1021
1021
|
async (w) => {
|
|
1022
1022
|
try {
|
|
1023
|
-
const
|
|
1023
|
+
const x = await Ve(w);
|
|
1024
1024
|
d(l, {
|
|
1025
|
-
uploadId:
|
|
1026
|
-
filename:
|
|
1027
|
-
mime:
|
|
1025
|
+
uploadId: x.id,
|
|
1026
|
+
filename: x.filename,
|
|
1027
|
+
mime: x.mime
|
|
1028
1028
|
});
|
|
1029
|
-
} catch (
|
|
1030
|
-
console.error("Upload failed:",
|
|
1029
|
+
} catch (x) {
|
|
1030
|
+
console.error("Upload failed:", x);
|
|
1031
1031
|
}
|
|
1032
1032
|
},
|
|
1033
1033
|
[l, d]
|
|
1034
|
-
), h =
|
|
1034
|
+
), h = W(
|
|
1035
1035
|
(w) => {
|
|
1036
1036
|
w.preventDefault(), w.stopPropagation();
|
|
1037
|
-
const
|
|
1038
|
-
|
|
1037
|
+
const x = w.dataTransfer.files[0];
|
|
1038
|
+
x && x.type.startsWith("image/") && u(x);
|
|
1039
1039
|
},
|
|
1040
1040
|
[u]
|
|
1041
|
-
),
|
|
1041
|
+
), b = W((w) => {
|
|
1042
1042
|
w.preventDefault(), w.stopPropagation();
|
|
1043
|
-
}, []), y =
|
|
1043
|
+
}, []), y = W(
|
|
1044
1044
|
(w) => {
|
|
1045
1045
|
var g;
|
|
1046
|
-
const
|
|
1047
|
-
|
|
1046
|
+
const x = (g = w.target.files) == null ? void 0 : g[0];
|
|
1047
|
+
x && u(x);
|
|
1048
1048
|
},
|
|
1049
1049
|
[u]
|
|
1050
|
-
), v = i || (t.uploadId ?
|
|
1051
|
-
return /* @__PURE__ */
|
|
1050
|
+
), v = i || (t.uploadId ? he(t.uploadId) : null);
|
|
1051
|
+
return /* @__PURE__ */ n(
|
|
1052
1052
|
"div",
|
|
1053
1053
|
{
|
|
1054
1054
|
className: `rounded-lg border-2 bg-white dark:bg-zinc-800 shadow-md min-w-[180px] overflow-hidden ${c}`,
|
|
1055
1055
|
onDrop: h,
|
|
1056
|
-
onDragOver:
|
|
1056
|
+
onDragOver: b,
|
|
1057
1057
|
children: [
|
|
1058
1058
|
v && p ? /* @__PURE__ */ e("div", { className: "bg-gray-100 dark:bg-zinc-900 border-b border-gray-200 dark:border-zinc-700", children: /* @__PURE__ */ e("img", { src: v, alt: "Uploaded", className: "w-full h-24 object-contain" }) }) : v ? null : /* @__PURE__ */ e(
|
|
1059
1059
|
"div",
|
|
@@ -1063,7 +1063,7 @@ const Qe = E(function({
|
|
|
1063
1063
|
var w;
|
|
1064
1064
|
return (w = a.current) == null ? void 0 : w.click();
|
|
1065
1065
|
},
|
|
1066
|
-
children: /* @__PURE__ */
|
|
1066
|
+
children: /* @__PURE__ */ n("div", { className: "text-center text-amber-600 dark:text-amber-400", children: [
|
|
1067
1067
|
/* @__PURE__ */ e("div", { className: "text-2xl mb-1", children: "+" }),
|
|
1068
1068
|
/* @__PURE__ */ e("div", { className: "text-xs", children: "Drop image or click" })
|
|
1069
1069
|
] })
|
|
@@ -1079,41 +1079,41 @@ const Qe = E(function({
|
|
|
1079
1079
|
onChange: y
|
|
1080
1080
|
}
|
|
1081
1081
|
),
|
|
1082
|
-
/* @__PURE__ */
|
|
1083
|
-
/* @__PURE__ */
|
|
1082
|
+
/* @__PURE__ */ n("div", { className: "px-4 py-3", children: [
|
|
1083
|
+
/* @__PURE__ */ n("div", { className: "flex items-center gap-2 mb-2", children: [
|
|
1084
1084
|
/* @__PURE__ */ e("div", { className: "w-3 h-3 rounded-full bg-amber-500" }),
|
|
1085
1085
|
/* @__PURE__ */ e("span", { className: "font-semibold text-sm text-amber-700 dark:text-amber-400", children: "Input" }),
|
|
1086
|
-
/* @__PURE__ */ e(
|
|
1086
|
+
/* @__PURE__ */ e(ae, { nodeId: l, color: "text-amber-500 dark:text-amber-400" })
|
|
1087
1087
|
] }),
|
|
1088
1088
|
/* @__PURE__ */ e("div", { className: "text-xs text-gray-500 dark:text-zinc-400 truncate", children: t.filename || "No image selected" })
|
|
1089
1089
|
] }),
|
|
1090
|
-
/* @__PURE__ */ e(
|
|
1090
|
+
/* @__PURE__ */ e(P, { type: "source", position: $.Right, className: "w-3 h-3 !bg-amber-500" })
|
|
1091
1091
|
]
|
|
1092
1092
|
}
|
|
1093
1093
|
);
|
|
1094
|
-
}), et =
|
|
1094
|
+
}), et = G(function({
|
|
1095
1095
|
id: l,
|
|
1096
1096
|
data: t,
|
|
1097
|
-
selected:
|
|
1097
|
+
selected: o
|
|
1098
1098
|
}) {
|
|
1099
1099
|
var c, u, h;
|
|
1100
|
-
const i =
|
|
1100
|
+
const i = f((b) => b.execution.nodeStatus[l]), s = f((b) => {
|
|
1101
1101
|
var y;
|
|
1102
|
-
return (y =
|
|
1103
|
-
}), d =
|
|
1104
|
-
return /* @__PURE__ */
|
|
1102
|
+
return (y = b.execution.dataOutputs) == null ? void 0 : y[l];
|
|
1103
|
+
}), d = F(i) || (o ? "border-cyan-500" : "border-cyan-200"), a = (c = t.outputSchema) != null && c.properties ? Object.entries(t.outputSchema.properties) : [], m = a.length > 0;
|
|
1104
|
+
return /* @__PURE__ */ n(
|
|
1105
1105
|
"div",
|
|
1106
1106
|
{
|
|
1107
1107
|
className: `rounded-lg border-2 bg-white dark:bg-zinc-800 shadow-md min-w-[180px] overflow-hidden ${d}`,
|
|
1108
1108
|
children: [
|
|
1109
|
-
/* @__PURE__ */ e(
|
|
1110
|
-
s && /* @__PURE__ */ e("div", { className: "bg-cyan-50 dark:bg-cyan-900/30 border-b border-cyan-100 dark:border-cyan-800 p-2 max-h-24 overflow-auto", children: /* @__PURE__ */
|
|
1109
|
+
/* @__PURE__ */ e(P, { type: "target", position: $.Left, className: "w-3 h-3 !bg-cyan-500" }),
|
|
1110
|
+
s && /* @__PURE__ */ e("div", { className: "bg-cyan-50 dark:bg-cyan-900/30 border-b border-cyan-100 dark:border-cyan-800 p-2 max-h-24 overflow-auto", children: /* @__PURE__ */ n("pre", { className: "text-xs text-cyan-800 dark:text-cyan-200 whitespace-pre-wrap", children: [
|
|
1111
1111
|
(u = s.content) == null ? void 0 : u.slice(0, 200),
|
|
1112
1112
|
(((h = s.content) == null ? void 0 : h.length) || 0) > 200 && "..."
|
|
1113
1113
|
] }) }),
|
|
1114
|
-
/* @__PURE__ */
|
|
1115
|
-
/* @__PURE__ */
|
|
1116
|
-
/* @__PURE__ */
|
|
1114
|
+
/* @__PURE__ */ n("div", { className: "px-4 py-3", children: [
|
|
1115
|
+
/* @__PURE__ */ n("div", { className: "flex items-center gap-2 mb-2", children: [
|
|
1116
|
+
/* @__PURE__ */ n("svg", { className: "w-3 h-3 text-cyan-500", fill: "currentColor", viewBox: "0 0 20 20", children: [
|
|
1117
1117
|
/* @__PURE__ */ e("path", { d: "M10 12a2 2 0 100-4 2 2 0 000 4z" }),
|
|
1118
1118
|
/* @__PURE__ */ e(
|
|
1119
1119
|
"path",
|
|
@@ -1126,73 +1126,73 @@ const Qe = E(function({
|
|
|
1126
1126
|
] }),
|
|
1127
1127
|
/* @__PURE__ */ e("span", { className: "font-semibold text-sm text-cyan-700 dark:text-cyan-400", children: t.providerLabel || t.providerName })
|
|
1128
1128
|
] }),
|
|
1129
|
-
/* @__PURE__ */ e("div", { className: "text-xs text-gray-500 dark:text-zinc-400", children: t.params.prompt ? /* @__PURE__ */
|
|
1129
|
+
/* @__PURE__ */ e("div", { className: "text-xs text-gray-500 dark:text-zinc-400", children: t.params.prompt ? /* @__PURE__ */ n("div", { className: "truncate", children: [
|
|
1130
1130
|
String(t.params.prompt).slice(0, 30),
|
|
1131
1131
|
"..."
|
|
1132
1132
|
] }) : null }),
|
|
1133
|
-
m && /* @__PURE__ */
|
|
1133
|
+
m && /* @__PURE__ */ n("div", { className: "mt-2 pt-2 border-t border-cyan-200 dark:border-cyan-800", children: [
|
|
1134
1134
|
/* @__PURE__ */ e("div", { className: "text-[10px] text-cyan-500 dark:text-cyan-400 font-medium mb-1", children: "Outputs:" }),
|
|
1135
|
-
a.map(([
|
|
1135
|
+
a.map(([b]) => /* @__PURE__ */ n(
|
|
1136
1136
|
"div",
|
|
1137
1137
|
{
|
|
1138
1138
|
className: "text-[10px] text-gray-500 dark:text-zinc-400 flex items-center gap-1",
|
|
1139
1139
|
children: [
|
|
1140
1140
|
/* @__PURE__ */ e("span", { className: "w-1.5 h-1.5 rounded-full bg-cyan-400" }),
|
|
1141
|
-
|
|
1141
|
+
b
|
|
1142
1142
|
]
|
|
1143
1143
|
},
|
|
1144
|
-
|
|
1144
|
+
b
|
|
1145
1145
|
))
|
|
1146
1146
|
] })
|
|
1147
1147
|
] }),
|
|
1148
|
-
m ? /* @__PURE__ */
|
|
1148
|
+
m ? /* @__PURE__ */ n(B, { children: [
|
|
1149
1149
|
/* @__PURE__ */ e(
|
|
1150
|
-
|
|
1150
|
+
P,
|
|
1151
1151
|
{
|
|
1152
1152
|
type: "source",
|
|
1153
|
-
position:
|
|
1153
|
+
position: $.Right,
|
|
1154
1154
|
id: "output",
|
|
1155
1155
|
className: "w-3 h-3 !bg-cyan-500",
|
|
1156
1156
|
style: { top: "50%" },
|
|
1157
1157
|
title: "Full JSON output"
|
|
1158
1158
|
}
|
|
1159
1159
|
),
|
|
1160
|
-
a.map(([
|
|
1161
|
-
|
|
1160
|
+
a.map(([b, y], v) => /* @__PURE__ */ e(
|
|
1161
|
+
P,
|
|
1162
1162
|
{
|
|
1163
1163
|
type: "source",
|
|
1164
|
-
position:
|
|
1165
|
-
id: `output.${
|
|
1164
|
+
position: $.Right,
|
|
1165
|
+
id: `output.${b}`,
|
|
1166
1166
|
className: "w-2.5 h-2.5 !bg-cyan-400",
|
|
1167
1167
|
style: {
|
|
1168
1168
|
top: `${70 + v * 14}%`
|
|
1169
1169
|
},
|
|
1170
|
-
title: `${
|
|
1170
|
+
title: `${b}: ${y.description || y.type}`
|
|
1171
1171
|
},
|
|
1172
|
-
|
|
1172
|
+
b
|
|
1173
1173
|
))
|
|
1174
|
-
] }) : /* @__PURE__ */ e(
|
|
1174
|
+
] }) : /* @__PURE__ */ e(P, { type: "source", position: $.Right, className: "w-3 h-3 !bg-cyan-500" })
|
|
1175
1175
|
]
|
|
1176
1176
|
}
|
|
1177
1177
|
);
|
|
1178
|
-
}), tt =
|
|
1178
|
+
}), tt = G(function({ id: l, data: t, selected: o }) {
|
|
1179
1179
|
var c, u, h;
|
|
1180
|
-
const i =
|
|
1180
|
+
const i = f((b) => b.execution.nodeStatus[l]), s = f((b) => {
|
|
1181
1181
|
var y;
|
|
1182
|
-
return (y =
|
|
1183
|
-
}), d =
|
|
1184
|
-
return /* @__PURE__ */
|
|
1182
|
+
return (y = b.execution.dataOutputs) == null ? void 0 : y[l];
|
|
1183
|
+
}), d = F(i) || (o ? "border-pink-500" : "border-pink-200"), a = (c = t.outputSchema) != null && c.properties ? Object.entries(t.outputSchema.properties) : [], m = a.length > 0;
|
|
1184
|
+
return /* @__PURE__ */ n(
|
|
1185
1185
|
"div",
|
|
1186
1186
|
{
|
|
1187
1187
|
className: `rounded-lg border-2 bg-white dark:bg-zinc-800 shadow-md min-w-[180px] overflow-hidden ${d}`,
|
|
1188
1188
|
children: [
|
|
1189
|
-
/* @__PURE__ */ e(
|
|
1190
|
-
s && /* @__PURE__ */ e("div", { className: "bg-pink-50 dark:bg-pink-900/30 border-b border-pink-100 dark:border-pink-800 p-2 max-h-24 overflow-auto", children: /* @__PURE__ */
|
|
1189
|
+
/* @__PURE__ */ e(P, { type: "target", position: $.Left, className: "w-3 h-3 !bg-pink-500" }),
|
|
1190
|
+
s && /* @__PURE__ */ e("div", { className: "bg-pink-50 dark:bg-pink-900/30 border-b border-pink-100 dark:border-pink-800 p-2 max-h-24 overflow-auto", children: /* @__PURE__ */ n("pre", { className: "text-xs text-pink-800 dark:text-pink-200 whitespace-pre-wrap", children: [
|
|
1191
1191
|
(u = s.content) == null ? void 0 : u.slice(0, 200),
|
|
1192
1192
|
(((h = s.content) == null ? void 0 : h.length) || 0) > 200 && "..."
|
|
1193
1193
|
] }) }),
|
|
1194
|
-
/* @__PURE__ */
|
|
1195
|
-
/* @__PURE__ */
|
|
1194
|
+
/* @__PURE__ */ n("div", { className: "px-4 py-3", children: [
|
|
1195
|
+
/* @__PURE__ */ n("div", { className: "flex items-center gap-2 mb-2", children: [
|
|
1196
1196
|
/* @__PURE__ */ e("svg", { className: "w-3 h-3 text-pink-500", fill: "currentColor", viewBox: "0 0 20 20", children: /* @__PURE__ */ e(
|
|
1197
1197
|
"path",
|
|
1198
1198
|
{
|
|
@@ -1203,52 +1203,52 @@ const Qe = E(function({
|
|
|
1203
1203
|
) }),
|
|
1204
1204
|
/* @__PURE__ */ e("span", { className: "font-semibold text-sm text-pink-700 dark:text-pink-400", children: t.providerLabel || t.providerName })
|
|
1205
1205
|
] }),
|
|
1206
|
-
/* @__PURE__ */ e("div", { className: "text-xs text-gray-500 dark:text-zinc-400", children: t.params.prompt ? /* @__PURE__ */
|
|
1206
|
+
/* @__PURE__ */ e("div", { className: "text-xs text-gray-500 dark:text-zinc-400", children: t.params.prompt ? /* @__PURE__ */ n("div", { className: "truncate", children: [
|
|
1207
1207
|
String(t.params.prompt).slice(0, 30),
|
|
1208
1208
|
"..."
|
|
1209
1209
|
] }) : null }),
|
|
1210
|
-
m && /* @__PURE__ */
|
|
1210
|
+
m && /* @__PURE__ */ n("div", { className: "mt-2 pt-2 border-t border-pink-200 dark:border-pink-800", children: [
|
|
1211
1211
|
/* @__PURE__ */ e("div", { className: "text-[10px] text-pink-500 dark:text-pink-400 font-medium mb-1", children: "Outputs:" }),
|
|
1212
|
-
a.map(([
|
|
1212
|
+
a.map(([b]) => /* @__PURE__ */ n(
|
|
1213
1213
|
"div",
|
|
1214
1214
|
{
|
|
1215
1215
|
className: "text-[10px] text-gray-500 dark:text-zinc-400 flex items-center gap-1",
|
|
1216
1216
|
children: [
|
|
1217
1217
|
/* @__PURE__ */ e("span", { className: "w-1.5 h-1.5 rounded-full bg-pink-400" }),
|
|
1218
|
-
|
|
1218
|
+
b
|
|
1219
1219
|
]
|
|
1220
1220
|
},
|
|
1221
|
-
|
|
1221
|
+
b
|
|
1222
1222
|
))
|
|
1223
1223
|
] })
|
|
1224
1224
|
] }),
|
|
1225
|
-
m ? /* @__PURE__ */
|
|
1225
|
+
m ? /* @__PURE__ */ n(B, { children: [
|
|
1226
1226
|
/* @__PURE__ */ e(
|
|
1227
|
-
|
|
1227
|
+
P,
|
|
1228
1228
|
{
|
|
1229
1229
|
type: "source",
|
|
1230
|
-
position:
|
|
1230
|
+
position: $.Right,
|
|
1231
1231
|
id: "output",
|
|
1232
1232
|
className: "w-3 h-3 !bg-pink-500",
|
|
1233
1233
|
style: { top: "50%" },
|
|
1234
1234
|
title: "Full JSON output"
|
|
1235
1235
|
}
|
|
1236
1236
|
),
|
|
1237
|
-
a.map(([
|
|
1238
|
-
|
|
1237
|
+
a.map(([b, y], v) => /* @__PURE__ */ e(
|
|
1238
|
+
P,
|
|
1239
1239
|
{
|
|
1240
1240
|
type: "source",
|
|
1241
|
-
position:
|
|
1242
|
-
id: `output.${
|
|
1241
|
+
position: $.Right,
|
|
1242
|
+
id: `output.${b}`,
|
|
1243
1243
|
className: "w-2.5 h-2.5 !bg-pink-400",
|
|
1244
1244
|
style: {
|
|
1245
1245
|
top: `${70 + v * 14}%`
|
|
1246
1246
|
},
|
|
1247
|
-
title: `${
|
|
1247
|
+
title: `${b}: ${y.description || y.type}`
|
|
1248
1248
|
},
|
|
1249
|
-
|
|
1249
|
+
b
|
|
1250
1250
|
))
|
|
1251
|
-
] }) : /* @__PURE__ */ e(
|
|
1251
|
+
] }) : /* @__PURE__ */ e(P, { type: "source", position: $.Right, className: "w-3 h-3 !bg-pink-500" })
|
|
1252
1252
|
]
|
|
1253
1253
|
}
|
|
1254
1254
|
);
|
|
@@ -1273,41 +1273,41 @@ const Qe = E(function({
|
|
|
1273
1273
|
strokeWidth: 2
|
|
1274
1274
|
}
|
|
1275
1275
|
};
|
|
1276
|
-
function
|
|
1277
|
-
const r =
|
|
1276
|
+
function ot() {
|
|
1277
|
+
const r = f((h) => h.nodes), l = f((h) => h.edges), t = f((h) => h.setNodes), o = f((h) => h.setEdges), i = f((h) => h.addEdge), s = f((h) => h.setSelectedNode), p = W(
|
|
1278
1278
|
(h) => {
|
|
1279
|
-
const { source:
|
|
1280
|
-
if (!
|
|
1281
|
-
const v = r.find((g) => g.id ===
|
|
1279
|
+
const { source: b, target: y } = h;
|
|
1280
|
+
if (!b || !y) return !1;
|
|
1281
|
+
const v = r.find((g) => g.id === b), w = r.find((g) => g.id === y);
|
|
1282
1282
|
return !(!v || !w || v.type === "save" || w.type === "generator" || w.type === "input" || l.find(
|
|
1283
1283
|
(g) => g.target === y && g.targetHandle === h.targetHandle
|
|
1284
|
-
) ||
|
|
1284
|
+
) || b === y);
|
|
1285
1285
|
},
|
|
1286
1286
|
[r, l]
|
|
1287
|
-
), d =
|
|
1287
|
+
), d = W(
|
|
1288
1288
|
(h) => {
|
|
1289
1289
|
t(ze(h, r));
|
|
1290
1290
|
},
|
|
1291
1291
|
[r, t]
|
|
1292
|
-
), a =
|
|
1292
|
+
), a = W(
|
|
1293
1293
|
(h) => {
|
|
1294
|
-
|
|
1294
|
+
o(Ce(h, l));
|
|
1295
1295
|
},
|
|
1296
|
-
[l,
|
|
1297
|
-
), m =
|
|
1296
|
+
[l, o]
|
|
1297
|
+
), m = W(
|
|
1298
1298
|
(h) => {
|
|
1299
1299
|
i(h);
|
|
1300
1300
|
},
|
|
1301
1301
|
[i]
|
|
1302
|
-
), c =
|
|
1303
|
-
(h,
|
|
1304
|
-
s(
|
|
1302
|
+
), c = W(
|
|
1303
|
+
(h, b) => {
|
|
1304
|
+
s(b.id);
|
|
1305
1305
|
},
|
|
1306
1306
|
[s]
|
|
1307
|
-
), u =
|
|
1307
|
+
), u = W(() => {
|
|
1308
1308
|
s(null);
|
|
1309
1309
|
}, [s]);
|
|
1310
|
-
return /* @__PURE__ */ e("div", { className: "h-full w-full", children: /* @__PURE__ */
|
|
1310
|
+
return /* @__PURE__ */ e("div", { className: "h-full w-full", children: /* @__PURE__ */ n(
|
|
1311
1311
|
Ne,
|
|
1312
1312
|
{
|
|
1313
1313
|
nodes: r,
|
|
@@ -1335,8 +1335,8 @@ function nt() {
|
|
|
1335
1335
|
}
|
|
1336
1336
|
) });
|
|
1337
1337
|
}
|
|
1338
|
-
function
|
|
1339
|
-
const [l, t] =
|
|
1338
|
+
function nt({ onSelect: r }) {
|
|
1339
|
+
const [l, t] = C([]), [o, i] = C(!0), [s, p] = C(null), d = async () => {
|
|
1340
1340
|
try {
|
|
1341
1341
|
i(!0);
|
|
1342
1342
|
const c = await Ge();
|
|
@@ -1347,18 +1347,18 @@ function ot({ onSelect: r }) {
|
|
|
1347
1347
|
i(!1);
|
|
1348
1348
|
}
|
|
1349
1349
|
};
|
|
1350
|
-
|
|
1350
|
+
U(() => {
|
|
1351
1351
|
d();
|
|
1352
1352
|
}, []);
|
|
1353
1353
|
const a = async (c, u) => {
|
|
1354
1354
|
if (u.stopPropagation(), !!confirm("Delete this upload?"))
|
|
1355
1355
|
try {
|
|
1356
|
-
await Fe(c), t((h) => h.filter((
|
|
1356
|
+
await Fe(c), t((h) => h.filter((b) => b.id !== c));
|
|
1357
1357
|
} catch (h) {
|
|
1358
1358
|
console.error("Failed to delete:", h);
|
|
1359
1359
|
}
|
|
1360
1360
|
}, m = (c) => c < 1024 ? `${c} B` : c < 1024 * 1024 ? `${(c / 1024).toFixed(1)} KB` : `${(c / (1024 * 1024)).toFixed(1)} MB`;
|
|
1361
|
-
return
|
|
1361
|
+
return o ? /* @__PURE__ */ e("div", { className: "p-4 text-center text-gray-500 dark:text-zinc-400", children: "Loading uploads..." }) : s ? /* @__PURE__ */ n("div", { className: "p-4 text-center text-red-500 dark:text-red-400", children: [
|
|
1362
1362
|
s,
|
|
1363
1363
|
/* @__PURE__ */ e(
|
|
1364
1364
|
"button",
|
|
@@ -1368,7 +1368,7 @@ function ot({ onSelect: r }) {
|
|
|
1368
1368
|
children: "Retry"
|
|
1369
1369
|
}
|
|
1370
1370
|
)
|
|
1371
|
-
] }) : l.length === 0 ? /* @__PURE__ */ e("div", { className: "p-4 text-center text-gray-500 dark:text-zinc-400", children: "No uploads yet. Drag an image onto an Input node to upload." }) : /* @__PURE__ */ e("div", { className: "p-2", children: /* @__PURE__ */ e("div", { className: "grid grid-cols-2 gap-2", children: l.map((c) => /* @__PURE__ */
|
|
1371
|
+
] }) : l.length === 0 ? /* @__PURE__ */ e("div", { className: "p-4 text-center text-gray-500 dark:text-zinc-400", children: "No uploads yet. Drag an image onto an Input node to upload." }) : /* @__PURE__ */ e("div", { className: "p-2", children: /* @__PURE__ */ e("div", { className: "grid grid-cols-2 gap-2", children: l.map((c) => /* @__PURE__ */ n(
|
|
1372
1372
|
"div",
|
|
1373
1373
|
{
|
|
1374
1374
|
className: "relative group rounded border border-gray-200 dark:border-zinc-700 overflow-hidden cursor-pointer hover:border-amber-400 dark:hover:border-amber-500 transition-colors",
|
|
@@ -1377,7 +1377,7 @@ function ot({ onSelect: r }) {
|
|
|
1377
1377
|
/* @__PURE__ */ e(
|
|
1378
1378
|
"img",
|
|
1379
1379
|
{
|
|
1380
|
-
src:
|
|
1380
|
+
src: he(c.id),
|
|
1381
1381
|
alt: c.filename,
|
|
1382
1382
|
className: "w-full h-20 object-cover"
|
|
1383
1383
|
}
|
|
@@ -1398,33 +1398,33 @@ function ot({ onSelect: r }) {
|
|
|
1398
1398
|
)) }) });
|
|
1399
1399
|
}
|
|
1400
1400
|
function st() {
|
|
1401
|
-
const r =
|
|
1401
|
+
const r = f((k) => k.setGenerators), l = f((k) => k.setTransforms), t = f((k) => k.setTextProviders), o = f((k) => k.setVisionProviders), i = f((k) => k.generators), s = f((k) => k.transforms), p = f((k) => k.textProviders), d = f((k) => k.visionProviders), a = f((k) => k.addNode), [m, c] = C(!1), { data: u } = K({
|
|
1402
1402
|
queryKey: ["generators"],
|
|
1403
|
-
queryFn:
|
|
1404
|
-
}), { data: h } =
|
|
1403
|
+
queryFn: Me
|
|
1404
|
+
}), { data: h } = K({
|
|
1405
1405
|
queryKey: ["transforms"],
|
|
1406
1406
|
queryFn: De
|
|
1407
|
-
}), { data:
|
|
1407
|
+
}), { data: b } = K({
|
|
1408
1408
|
queryKey: ["textProviders"],
|
|
1409
1409
|
queryFn: Te
|
|
1410
|
-
}), { data: y } =
|
|
1410
|
+
}), { data: y } = K({
|
|
1411
1411
|
queryKey: ["visionProviders"],
|
|
1412
1412
|
queryFn: Ue
|
|
1413
1413
|
});
|
|
1414
|
-
|
|
1414
|
+
U(() => {
|
|
1415
1415
|
u && r(u);
|
|
1416
|
-
}, [u, r]),
|
|
1416
|
+
}, [u, r]), U(() => {
|
|
1417
1417
|
h && l(h);
|
|
1418
|
-
}, [h, l]),
|
|
1419
|
-
|
|
1420
|
-
}, [
|
|
1421
|
-
y &&
|
|
1422
|
-
}, [y,
|
|
1423
|
-
const v = (
|
|
1424
|
-
|
|
1425
|
-
}, w = (
|
|
1426
|
-
a(
|
|
1427
|
-
},
|
|
1418
|
+
}, [h, l]), U(() => {
|
|
1419
|
+
b && t(b);
|
|
1420
|
+
}, [b, t]), U(() => {
|
|
1421
|
+
y && o(y);
|
|
1422
|
+
}, [y, o]);
|
|
1423
|
+
const v = (k, L) => {
|
|
1424
|
+
k.dataTransfer.setData("application/json", JSON.stringify(L)), k.dataTransfer.effectAllowed = "move";
|
|
1425
|
+
}, w = (k) => {
|
|
1426
|
+
a(k, { x: 250, y: 150 + Math.random() * 100 });
|
|
1427
|
+
}, x = {
|
|
1428
1428
|
id: "input:upload",
|
|
1429
1429
|
type: "input",
|
|
1430
1430
|
name: "upload",
|
|
@@ -1456,25 +1456,25 @@ function st() {
|
|
|
1456
1456
|
}
|
|
1457
1457
|
}
|
|
1458
1458
|
}
|
|
1459
|
-
},
|
|
1460
|
-
(
|
|
1461
|
-
const S =
|
|
1462
|
-
return
|
|
1459
|
+
}, N = i.reduce(
|
|
1460
|
+
(k, L) => {
|
|
1461
|
+
const S = L.category || "Other";
|
|
1462
|
+
return k[S] || (k[S] = []), k[S].push(L), k;
|
|
1463
1463
|
},
|
|
1464
1464
|
{}
|
|
1465
|
-
),
|
|
1466
|
-
(
|
|
1467
|
-
const S =
|
|
1468
|
-
return
|
|
1465
|
+
), A = s.reduce(
|
|
1466
|
+
(k, L) => {
|
|
1467
|
+
const S = L.category || "Other";
|
|
1468
|
+
return k[S] || (k[S] = []), k[S].push(L), k;
|
|
1469
1469
|
},
|
|
1470
1470
|
{}
|
|
1471
1471
|
);
|
|
1472
|
-
return /* @__PURE__ */ e("div", { className: "w-64 bg-gray-50 dark:bg-zinc-800 border-r border-gray-200 dark:border-zinc-700 overflow-y-auto", children: /* @__PURE__ */
|
|
1472
|
+
return /* @__PURE__ */ e("div", { className: "w-64 bg-gray-50 dark:bg-zinc-800 border-r border-gray-200 dark:border-zinc-700 overflow-y-auto", children: /* @__PURE__ */ n("div", { className: "p-4", children: [
|
|
1473
1473
|
/* @__PURE__ */ e("h2", { className: "text-lg font-semibold text-gray-800 dark:text-white mb-4", children: "Nodes" }),
|
|
1474
|
-
/* @__PURE__ */
|
|
1475
|
-
/* @__PURE__ */
|
|
1474
|
+
/* @__PURE__ */ n("div", { className: "mb-6", children: [
|
|
1475
|
+
/* @__PURE__ */ n("div", { className: "flex items-center justify-between mb-2", children: [
|
|
1476
1476
|
/* @__PURE__ */ e("h3", { className: "text-sm font-medium text-amber-600 dark:text-amber-400 uppercase tracking-wide", children: "Input" }),
|
|
1477
|
-
/* @__PURE__ */
|
|
1477
|
+
/* @__PURE__ */ n(
|
|
1478
1478
|
"button",
|
|
1479
1479
|
{
|
|
1480
1480
|
onClick: () => c(!m),
|
|
@@ -1486,12 +1486,12 @@ function st() {
|
|
|
1486
1486
|
}
|
|
1487
1487
|
)
|
|
1488
1488
|
] }),
|
|
1489
|
-
/* @__PURE__ */
|
|
1489
|
+
/* @__PURE__ */ n(
|
|
1490
1490
|
"div",
|
|
1491
1491
|
{
|
|
1492
1492
|
draggable: !0,
|
|
1493
|
-
onDragStart: (
|
|
1494
|
-
onDoubleClick: () => w(
|
|
1493
|
+
onDragStart: (k) => v(k, x),
|
|
1494
|
+
onDoubleClick: () => w(x),
|
|
1495
1495
|
className: "px-3 py-2 bg-amber-50 dark:bg-amber-900/30 border border-amber-200 dark:border-amber-700 rounded cursor-grab active:cursor-grabbing hover:bg-amber-100 dark:hover:bg-amber-900/50 transition-colors",
|
|
1496
1496
|
children: [
|
|
1497
1497
|
/* @__PURE__ */ e("div", { className: "text-sm font-medium text-amber-700 dark:text-amber-300", children: "Upload Image" }),
|
|
@@ -1499,17 +1499,17 @@ function st() {
|
|
|
1499
1499
|
]
|
|
1500
1500
|
}
|
|
1501
1501
|
),
|
|
1502
|
-
m && /* @__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(
|
|
1502
|
+
m && /* @__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(nt, {}) })
|
|
1503
1503
|
] }),
|
|
1504
|
-
/* @__PURE__ */
|
|
1504
|
+
/* @__PURE__ */ n("div", { className: "mb-6", children: [
|
|
1505
1505
|
/* @__PURE__ */ e("h3", { className: "text-sm font-medium text-blue-600 dark:text-blue-400 uppercase tracking-wide mb-2", children: "Generators" }),
|
|
1506
|
-
Object.entries(
|
|
1507
|
-
/* @__PURE__ */ e("div", { className: "text-xs text-gray-500 dark:text-zinc-400 mb-1", children:
|
|
1508
|
-
|
|
1506
|
+
Object.entries(N).map(([k, L]) => /* @__PURE__ */ n("div", { className: "mb-3", children: [
|
|
1507
|
+
/* @__PURE__ */ e("div", { className: "text-xs text-gray-500 dark:text-zinc-400 mb-1", children: k }),
|
|
1508
|
+
L.map((S) => /* @__PURE__ */ n(
|
|
1509
1509
|
"div",
|
|
1510
1510
|
{
|
|
1511
1511
|
draggable: !0,
|
|
1512
|
-
onDragStart: (
|
|
1512
|
+
onDragStart: (R) => v(R, S),
|
|
1513
1513
|
onDoubleClick: () => w(S),
|
|
1514
1514
|
className: "px-3 py-2 bg-blue-50 dark:bg-blue-900/30 border border-blue-200 dark:border-blue-700 rounded mb-1 cursor-grab active:cursor-grabbing hover:bg-blue-100 dark:hover:bg-blue-900/50 transition-colors",
|
|
1515
1515
|
children: [
|
|
@@ -1519,17 +1519,17 @@ function st() {
|
|
|
1519
1519
|
},
|
|
1520
1520
|
S.id
|
|
1521
1521
|
))
|
|
1522
|
-
] },
|
|
1522
|
+
] }, k))
|
|
1523
1523
|
] }),
|
|
1524
|
-
/* @__PURE__ */
|
|
1524
|
+
/* @__PURE__ */ n("div", { className: "mb-6", children: [
|
|
1525
1525
|
/* @__PURE__ */ e("h3", { className: "text-sm font-medium text-teal-600 dark:text-teal-400 uppercase tracking-wide mb-2", children: "Transforms" }),
|
|
1526
|
-
Object.entries(
|
|
1527
|
-
/* @__PURE__ */ e("div", { className: "text-xs text-gray-500 dark:text-zinc-400 mb-1", children:
|
|
1528
|
-
|
|
1526
|
+
Object.entries(A).map(([k, L]) => /* @__PURE__ */ n("div", { className: "mb-3", children: [
|
|
1527
|
+
/* @__PURE__ */ e("div", { className: "text-xs text-gray-500 dark:text-zinc-400 mb-1", children: k }),
|
|
1528
|
+
L.map((S) => /* @__PURE__ */ n(
|
|
1529
1529
|
"div",
|
|
1530
1530
|
{
|
|
1531
1531
|
draggable: !0,
|
|
1532
|
-
onDragStart: (
|
|
1532
|
+
onDragStart: (R) => v(R, S),
|
|
1533
1533
|
onDoubleClick: () => w(S),
|
|
1534
1534
|
className: "px-3 py-2 bg-teal-50 dark:bg-teal-900/30 border border-teal-200 dark:border-teal-700 rounded mb-1 cursor-grab active:cursor-grabbing hover:bg-teal-100 dark:hover:bg-teal-900/50 transition-colors",
|
|
1535
1535
|
children: [
|
|
@@ -1539,49 +1539,49 @@ function st() {
|
|
|
1539
1539
|
},
|
|
1540
1540
|
S.id
|
|
1541
1541
|
))
|
|
1542
|
-
] },
|
|
1542
|
+
] }, k))
|
|
1543
1543
|
] }),
|
|
1544
|
-
p.length > 0 && /* @__PURE__ */
|
|
1544
|
+
p.length > 0 && /* @__PURE__ */ n("div", { className: "mb-6", children: [
|
|
1545
1545
|
/* @__PURE__ */ e("h3", { className: "text-sm font-medium text-pink-600 dark:text-pink-400 uppercase tracking-wide mb-2", children: "AI Text" }),
|
|
1546
|
-
p.map((
|
|
1546
|
+
p.map((k) => /* @__PURE__ */ n(
|
|
1547
1547
|
"div",
|
|
1548
1548
|
{
|
|
1549
1549
|
draggable: !0,
|
|
1550
|
-
onDragStart: (
|
|
1551
|
-
onDoubleClick: () => w(
|
|
1550
|
+
onDragStart: (L) => v(L, k),
|
|
1551
|
+
onDoubleClick: () => w(k),
|
|
1552
1552
|
className: "px-3 py-2 bg-pink-50 dark:bg-pink-900/30 border border-pink-200 dark:border-pink-700 rounded mb-1 cursor-grab active:cursor-grabbing hover:bg-pink-100 dark:hover:bg-pink-900/50 transition-colors",
|
|
1553
1553
|
children: [
|
|
1554
|
-
/* @__PURE__ */ e("div", { className: "text-sm font-medium text-pink-700 dark:text-pink-300", children:
|
|
1555
|
-
|
|
1554
|
+
/* @__PURE__ */ e("div", { className: "text-sm font-medium text-pink-700 dark:text-pink-300", children: k.label }),
|
|
1555
|
+
k.description && /* @__PURE__ */ e("div", { className: "text-xs text-gray-500 dark:text-zinc-400 truncate", children: k.description })
|
|
1556
1556
|
]
|
|
1557
1557
|
},
|
|
1558
|
-
|
|
1558
|
+
k.id
|
|
1559
1559
|
))
|
|
1560
1560
|
] }),
|
|
1561
|
-
d.length > 0 && /* @__PURE__ */
|
|
1561
|
+
d.length > 0 && /* @__PURE__ */ n("div", { className: "mb-6", children: [
|
|
1562
1562
|
/* @__PURE__ */ e("h3", { className: "text-sm font-medium text-cyan-600 dark:text-cyan-400 uppercase tracking-wide mb-2", children: "AI Vision" }),
|
|
1563
|
-
d.map((
|
|
1563
|
+
d.map((k) => /* @__PURE__ */ n(
|
|
1564
1564
|
"div",
|
|
1565
1565
|
{
|
|
1566
1566
|
draggable: !0,
|
|
1567
|
-
onDragStart: (
|
|
1568
|
-
onDoubleClick: () => w(
|
|
1567
|
+
onDragStart: (L) => v(L, k),
|
|
1568
|
+
onDoubleClick: () => w(k),
|
|
1569
1569
|
className: "px-3 py-2 bg-cyan-50 dark:bg-cyan-900/30 border border-cyan-200 dark:border-cyan-700 rounded mb-1 cursor-grab active:cursor-grabbing hover:bg-cyan-100 dark:hover:bg-cyan-900/50 transition-colors",
|
|
1570
1570
|
children: [
|
|
1571
|
-
/* @__PURE__ */ e("div", { className: "text-sm font-medium text-cyan-700 dark:text-cyan-300", children:
|
|
1572
|
-
|
|
1571
|
+
/* @__PURE__ */ e("div", { className: "text-sm font-medium text-cyan-700 dark:text-cyan-300", children: k.label }),
|
|
1572
|
+
k.description && /* @__PURE__ */ e("div", { className: "text-xs text-gray-500 dark:text-zinc-400 truncate", children: k.description })
|
|
1573
1573
|
]
|
|
1574
1574
|
},
|
|
1575
|
-
|
|
1575
|
+
k.id
|
|
1576
1576
|
))
|
|
1577
1577
|
] }),
|
|
1578
|
-
/* @__PURE__ */
|
|
1578
|
+
/* @__PURE__ */ n("div", { className: "mb-6", children: [
|
|
1579
1579
|
/* @__PURE__ */ e("h3", { className: "text-sm font-medium text-green-600 dark:text-green-400 uppercase tracking-wide mb-2", children: "Output" }),
|
|
1580
|
-
/* @__PURE__ */
|
|
1580
|
+
/* @__PURE__ */ n(
|
|
1581
1581
|
"div",
|
|
1582
1582
|
{
|
|
1583
1583
|
draggable: !0,
|
|
1584
|
-
onDragStart: (
|
|
1584
|
+
onDragStart: (k) => v(k, g),
|
|
1585
1585
|
onDoubleClick: () => w(g),
|
|
1586
1586
|
className: "px-3 py-2 bg-green-50 dark:bg-green-900/30 border border-green-200 dark:border-green-700 rounded cursor-grab active:cursor-grabbing hover:bg-green-100 dark:hover:bg-green-900/50 transition-colors",
|
|
1587
1587
|
children: [
|
|
@@ -1594,17 +1594,17 @@ function st() {
|
|
|
1594
1594
|
] }) });
|
|
1595
1595
|
}
|
|
1596
1596
|
function it() {
|
|
1597
|
-
var
|
|
1598
|
-
const r =
|
|
1597
|
+
var b, y, v, w;
|
|
1598
|
+
const r = f((x) => x.selectedNodeId), l = f((x) => x.nodes), t = f((x) => x.generators), o = f((x) => x.transforms), i = f((x) => x.textProviders), s = f((x) => x.visionProviders), p = f((x) => x.updateNodeData), d = f((x) => x.deleteNode), a = l.find((x) => x.id === r);
|
|
1599
1599
|
if (!a)
|
|
1600
1600
|
return /* @__PURE__ */ e("div", { className: "w-80 bg-gray-50 dark:bg-zinc-800 border-l border-gray-200 dark:border-zinc-700 p-4", children: /* @__PURE__ */ e("div", { className: "text-gray-500 dark:text-zinc-400 text-sm", children: "Select a node to edit its properties" }) });
|
|
1601
1601
|
let m, c = "";
|
|
1602
1602
|
if (a.type === "generator") {
|
|
1603
|
-
const
|
|
1604
|
-
m = (
|
|
1603
|
+
const x = a.data, g = t.find((N) => N.name === x.generatorName);
|
|
1604
|
+
m = (b = g == null ? void 0 : g.params) == null ? void 0 : b.properties, c = (g == null ? void 0 : g.label) || x.generatorName;
|
|
1605
1605
|
} else if (a.type === "transform") {
|
|
1606
|
-
const
|
|
1607
|
-
m = (y = g == null ? void 0 : g.params) == null ? void 0 : y.properties, c = (g == null ? void 0 : g.label) ||
|
|
1606
|
+
const x = a.data, g = o.find((N) => N.name === x.operation);
|
|
1607
|
+
m = (y = g == null ? void 0 : g.params) == null ? void 0 : y.properties, c = (g == null ? void 0 : g.label) || x.operation;
|
|
1608
1608
|
} else if (a.type === "save") {
|
|
1609
1609
|
const g = a.data.provider === "floimg-cloud";
|
|
1610
1610
|
c = g ? "Save to FloImg Cloud" : "Save", m = {
|
|
@@ -1615,50 +1615,50 @@ function it() {
|
|
|
1615
1615
|
}
|
|
1616
1616
|
};
|
|
1617
1617
|
} else if (a.type === "text") {
|
|
1618
|
-
const
|
|
1619
|
-
m = (v = g == null ? void 0 : g.params) == null ? void 0 : v.properties, c = (g == null ? void 0 : g.label) ||
|
|
1618
|
+
const x = a.data, g = i.find((N) => N.name === x.providerName);
|
|
1619
|
+
m = (v = g == null ? void 0 : g.params) == null ? void 0 : v.properties, c = (g == null ? void 0 : g.label) || x.providerName;
|
|
1620
1620
|
} else if (a.type === "vision") {
|
|
1621
|
-
const
|
|
1622
|
-
m = (w = g == null ? void 0 : g.params) == null ? void 0 : w.properties, c = (g == null ? void 0 : g.label) ||
|
|
1621
|
+
const x = a.data, g = s.find((N) => N.name === x.providerName);
|
|
1622
|
+
m = (w = g == null ? void 0 : g.params) == null ? void 0 : w.properties, c = (g == null ? void 0 : g.label) || x.providerName;
|
|
1623
1623
|
}
|
|
1624
|
-
const u = (
|
|
1624
|
+
const u = (x, g) => {
|
|
1625
1625
|
if (a.type === "generator") {
|
|
1626
|
-
const
|
|
1626
|
+
const N = a.data;
|
|
1627
1627
|
p(a.id, {
|
|
1628
|
-
params: { ...
|
|
1628
|
+
params: { ...N.params, [x]: g }
|
|
1629
1629
|
});
|
|
1630
1630
|
} else if (a.type === "transform") {
|
|
1631
|
-
const
|
|
1631
|
+
const N = a.data;
|
|
1632
1632
|
p(a.id, {
|
|
1633
|
-
params: { ...
|
|
1633
|
+
params: { ...N.params, [x]: g }
|
|
1634
1634
|
});
|
|
1635
1635
|
} else if (a.type === "save")
|
|
1636
|
-
p(a.id, { [
|
|
1636
|
+
p(a.id, { [x]: g });
|
|
1637
1637
|
else if (a.type === "text") {
|
|
1638
|
-
const
|
|
1638
|
+
const N = a.data;
|
|
1639
1639
|
p(a.id, {
|
|
1640
|
-
params: { ...
|
|
1640
|
+
params: { ...N.params, [x]: g }
|
|
1641
1641
|
});
|
|
1642
1642
|
} else if (a.type === "vision") {
|
|
1643
|
-
const
|
|
1643
|
+
const N = a.data;
|
|
1644
1644
|
p(a.id, {
|
|
1645
|
-
params: { ...
|
|
1645
|
+
params: { ...N.params, [x]: g }
|
|
1646
1646
|
});
|
|
1647
1647
|
}
|
|
1648
|
-
}, h = (
|
|
1648
|
+
}, h = (x) => {
|
|
1649
1649
|
if (a.type === "generator")
|
|
1650
|
-
return a.data.params[
|
|
1650
|
+
return a.data.params[x];
|
|
1651
1651
|
if (a.type === "transform")
|
|
1652
|
-
return a.data.params[
|
|
1652
|
+
return a.data.params[x];
|
|
1653
1653
|
if (a.type === "save")
|
|
1654
|
-
return a.data[
|
|
1654
|
+
return a.data[x];
|
|
1655
1655
|
if (a.type === "text")
|
|
1656
|
-
return a.data.params[
|
|
1656
|
+
return a.data.params[x];
|
|
1657
1657
|
if (a.type === "vision")
|
|
1658
|
-
return a.data.params[
|
|
1658
|
+
return a.data.params[x];
|
|
1659
1659
|
};
|
|
1660
|
-
return /* @__PURE__ */ e("div", { className: "w-80 bg-gray-50 dark:bg-zinc-800 border-l border-gray-200 dark:border-zinc-700 overflow-y-auto", children: /* @__PURE__ */
|
|
1661
|
-
/* @__PURE__ */
|
|
1660
|
+
return /* @__PURE__ */ e("div", { className: "w-80 bg-gray-50 dark:bg-zinc-800 border-l border-gray-200 dark:border-zinc-700 overflow-y-auto", children: /* @__PURE__ */ n("div", { className: "p-4", children: [
|
|
1661
|
+
/* @__PURE__ */ n("div", { className: "flex items-center justify-between mb-4", children: [
|
|
1662
1662
|
/* @__PURE__ */ e("h2", { className: "text-lg font-semibold text-gray-800 dark:text-white", children: c }),
|
|
1663
1663
|
/* @__PURE__ */ e(
|
|
1664
1664
|
"button",
|
|
@@ -1669,15 +1669,15 @@ function it() {
|
|
|
1669
1669
|
}
|
|
1670
1670
|
)
|
|
1671
1671
|
] }),
|
|
1672
|
-
/* @__PURE__ */ e("div", { className: "space-y-4", children: m && Object.entries(m).map(([
|
|
1672
|
+
/* @__PURE__ */ e("div", { className: "space-y-4", children: m && Object.entries(m).map(([x, g]) => /* @__PURE__ */ e(
|
|
1673
1673
|
lt,
|
|
1674
1674
|
{
|
|
1675
|
-
name:
|
|
1675
|
+
name: x,
|
|
1676
1676
|
field: g,
|
|
1677
|
-
value: h(
|
|
1678
|
-
onChange: (
|
|
1677
|
+
value: h(x),
|
|
1678
|
+
onChange: (N) => u(x, N)
|
|
1679
1679
|
},
|
|
1680
|
-
|
|
1680
|
+
x
|
|
1681
1681
|
)) }),
|
|
1682
1682
|
(a.type === "text" || a.type === "vision") && /* @__PURE__ */ e(
|
|
1683
1683
|
dt,
|
|
@@ -1689,15 +1689,15 @@ function it() {
|
|
|
1689
1689
|
)
|
|
1690
1690
|
] }) });
|
|
1691
1691
|
}
|
|
1692
|
-
function lt({ name: r, field: l, value: t, onChange:
|
|
1692
|
+
function lt({ name: r, field: l, value: t, onChange: o }) {
|
|
1693
1693
|
const i = l.title || r, s = "w-full px-3 py-2 border border-gray-300 dark:border-zinc-600 rounded-md shadow-sm focus:ring-teal-500 focus:border-teal-500 bg-white dark:bg-zinc-900 text-gray-900 dark:text-zinc-100";
|
|
1694
|
-
return l.enum ? /* @__PURE__ */
|
|
1694
|
+
return l.enum ? /* @__PURE__ */ n("div", { children: [
|
|
1695
1695
|
/* @__PURE__ */ e("label", { className: "block text-sm font-medium text-gray-700 dark:text-zinc-300 mb-1", children: i }),
|
|
1696
|
-
/* @__PURE__ */
|
|
1696
|
+
/* @__PURE__ */ n(
|
|
1697
1697
|
"select",
|
|
1698
1698
|
{
|
|
1699
1699
|
value: String(t || ""),
|
|
1700
|
-
onChange: (p) =>
|
|
1700
|
+
onChange: (p) => o(p.target.value),
|
|
1701
1701
|
className: s,
|
|
1702
1702
|
children: [
|
|
1703
1703
|
/* @__PURE__ */ e("option", { value: "", children: "Select..." }),
|
|
@@ -1706,40 +1706,40 @@ function lt({ name: r, field: l, value: t, onChange: n }) {
|
|
|
1706
1706
|
}
|
|
1707
1707
|
),
|
|
1708
1708
|
l.description && /* @__PURE__ */ e("p", { className: "mt-1 text-xs text-gray-500 dark:text-zinc-400", children: l.description })
|
|
1709
|
-
] }) : l.type === "number" ? /* @__PURE__ */
|
|
1709
|
+
] }) : l.type === "number" ? /* @__PURE__ */ n("div", { children: [
|
|
1710
1710
|
/* @__PURE__ */ e("label", { className: "block text-sm font-medium text-gray-700 dark:text-zinc-300 mb-1", children: i }),
|
|
1711
1711
|
/* @__PURE__ */ e(
|
|
1712
1712
|
"input",
|
|
1713
1713
|
{
|
|
1714
1714
|
type: "number",
|
|
1715
1715
|
value: t !== void 0 ? Number(t) : "",
|
|
1716
|
-
onChange: (p) =>
|
|
1716
|
+
onChange: (p) => o(Number(p.target.value)),
|
|
1717
1717
|
min: l.minimum,
|
|
1718
1718
|
max: l.maximum,
|
|
1719
1719
|
className: s
|
|
1720
1720
|
}
|
|
1721
1721
|
),
|
|
1722
1722
|
l.description && /* @__PURE__ */ e("p", { className: "mt-1 text-xs text-gray-500 dark:text-zinc-400", children: l.description })
|
|
1723
|
-
] }) : l.type === "boolean" ? /* @__PURE__ */
|
|
1723
|
+
] }) : l.type === "boolean" ? /* @__PURE__ */ n("div", { className: "flex items-center gap-2", children: [
|
|
1724
1724
|
/* @__PURE__ */ e(
|
|
1725
1725
|
"input",
|
|
1726
1726
|
{
|
|
1727
1727
|
type: "checkbox",
|
|
1728
1728
|
checked: !!t,
|
|
1729
|
-
onChange: (p) =>
|
|
1729
|
+
onChange: (p) => o(p.target.checked),
|
|
1730
1730
|
className: "h-4 w-4 text-teal-600 focus:ring-teal-500 border-gray-300 dark:border-zinc-600 rounded bg-white dark:bg-zinc-900"
|
|
1731
1731
|
}
|
|
1732
1732
|
),
|
|
1733
1733
|
/* @__PURE__ */ e("label", { className: "text-sm font-medium text-gray-700 dark:text-zinc-300", children: i })
|
|
1734
|
-
] }) : r.toLowerCase().includes("color") && typeof t == "string" && t.startsWith("#") ? /* @__PURE__ */
|
|
1734
|
+
] }) : r.toLowerCase().includes("color") && typeof t == "string" && t.startsWith("#") ? /* @__PURE__ */ n("div", { children: [
|
|
1735
1735
|
/* @__PURE__ */ e("label", { className: "block text-sm font-medium text-gray-700 dark:text-zinc-300 mb-1", children: i }),
|
|
1736
|
-
/* @__PURE__ */
|
|
1736
|
+
/* @__PURE__ */ n("div", { className: "flex gap-2", children: [
|
|
1737
1737
|
/* @__PURE__ */ e(
|
|
1738
1738
|
"input",
|
|
1739
1739
|
{
|
|
1740
1740
|
type: "color",
|
|
1741
1741
|
value: String(t || "#000000"),
|
|
1742
|
-
onChange: (p) =>
|
|
1742
|
+
onChange: (p) => o(p.target.value),
|
|
1743
1743
|
className: "h-10 w-14 p-1 border border-gray-300 dark:border-zinc-600 rounded"
|
|
1744
1744
|
}
|
|
1745
1745
|
),
|
|
@@ -1748,12 +1748,12 @@ function lt({ name: r, field: l, value: t, onChange: n }) {
|
|
|
1748
1748
|
{
|
|
1749
1749
|
type: "text",
|
|
1750
1750
|
value: String(t || ""),
|
|
1751
|
-
onChange: (p) =>
|
|
1751
|
+
onChange: (p) => o(p.target.value),
|
|
1752
1752
|
className: s + " flex-1"
|
|
1753
1753
|
}
|
|
1754
1754
|
)
|
|
1755
1755
|
] })
|
|
1756
|
-
] }) : l.type === "object" ? /* @__PURE__ */
|
|
1756
|
+
] }) : l.type === "object" ? /* @__PURE__ */ n("div", { children: [
|
|
1757
1757
|
/* @__PURE__ */ e("label", { className: "block text-sm font-medium text-gray-700 dark:text-zinc-300 mb-1", children: i }),
|
|
1758
1758
|
/* @__PURE__ */ e(
|
|
1759
1759
|
"textarea",
|
|
@@ -1761,7 +1761,7 @@ function lt({ name: r, field: l, value: t, onChange: n }) {
|
|
|
1761
1761
|
value: t ? JSON.stringify(t, null, 2) : "{}",
|
|
1762
1762
|
onChange: (p) => {
|
|
1763
1763
|
try {
|
|
1764
|
-
|
|
1764
|
+
o(JSON.parse(p.target.value));
|
|
1765
1765
|
} catch {
|
|
1766
1766
|
}
|
|
1767
1767
|
},
|
|
@@ -1770,13 +1770,13 @@ function lt({ name: r, field: l, value: t, onChange: n }) {
|
|
|
1770
1770
|
}
|
|
1771
1771
|
),
|
|
1772
1772
|
l.description && /* @__PURE__ */ e("p", { className: "mt-1 text-xs text-gray-500 dark:text-zinc-400", children: l.description })
|
|
1773
|
-
] }) : /* @__PURE__ */
|
|
1773
|
+
] }) : /* @__PURE__ */ n("div", { children: [
|
|
1774
1774
|
/* @__PURE__ */ e("label", { className: "block text-sm font-medium text-gray-700 dark:text-zinc-300 mb-1", children: i }),
|
|
1775
1775
|
r === "prompt" || r === "code" || r === "text" ? /* @__PURE__ */ e(
|
|
1776
1776
|
"textarea",
|
|
1777
1777
|
{
|
|
1778
1778
|
value: String(t || ""),
|
|
1779
|
-
onChange: (p) =>
|
|
1779
|
+
onChange: (p) => o(p.target.value),
|
|
1780
1780
|
rows: 3,
|
|
1781
1781
|
className: s
|
|
1782
1782
|
}
|
|
@@ -1785,7 +1785,7 @@ function lt({ name: r, field: l, value: t, onChange: n }) {
|
|
|
1785
1785
|
{
|
|
1786
1786
|
type: "text",
|
|
1787
1787
|
value: String(t || ""),
|
|
1788
|
-
onChange: (p) =>
|
|
1788
|
+
onChange: (p) => o(p.target.value),
|
|
1789
1789
|
className: s
|
|
1790
1790
|
}
|
|
1791
1791
|
),
|
|
@@ -1793,13 +1793,13 @@ function lt({ name: r, field: l, value: t, onChange: n }) {
|
|
|
1793
1793
|
] });
|
|
1794
1794
|
}
|
|
1795
1795
|
function dt({ nodeId: r, outputSchema: l, updateNodeData: t }) {
|
|
1796
|
-
const [
|
|
1797
|
-
if (!
|
|
1796
|
+
const [o, i] = C(""), s = (l == null ? void 0 : l.properties) || {}, p = Object.entries(s), d = () => {
|
|
1797
|
+
if (!o.trim()) return;
|
|
1798
1798
|
const u = {
|
|
1799
1799
|
type: "object",
|
|
1800
1800
|
properties: {
|
|
1801
1801
|
...s,
|
|
1802
|
-
[
|
|
1802
|
+
[o.trim()]: { type: "string" }
|
|
1803
1803
|
}
|
|
1804
1804
|
};
|
|
1805
1805
|
t(r, { outputSchema: u }), i("");
|
|
@@ -1829,25 +1829,25 @@ function dt({ nodeId: r, outputSchema: l, updateNodeData: t }) {
|
|
|
1829
1829
|
}
|
|
1830
1830
|
});
|
|
1831
1831
|
};
|
|
1832
|
-
return /* @__PURE__ */
|
|
1833
|
-
/* @__PURE__ */
|
|
1832
|
+
return /* @__PURE__ */ n("div", { className: "mt-6 pt-4 border-t border-gray-200 dark:border-zinc-700", children: [
|
|
1833
|
+
/* @__PURE__ */ n("div", { className: "flex items-center justify-between mb-3", children: [
|
|
1834
1834
|
/* @__PURE__ */ e("h3", { className: "text-sm font-medium text-gray-700 dark:text-zinc-300", children: "Output Schema" }),
|
|
1835
1835
|
/* @__PURE__ */ e("span", { className: "text-xs text-gray-500 dark:text-zinc-500", children: p.length > 0 ? `${p.length} output${p.length > 1 ? "s" : ""}` : "No outputs defined" })
|
|
1836
1836
|
] }),
|
|
1837
1837
|
/* @__PURE__ */ e("p", { className: "text-xs text-gray-500 dark:text-zinc-400 mb-3", children: "Define output properties to enable connecting individual JSON fields to other nodes." }),
|
|
1838
|
-
p.length > 0 && /* @__PURE__ */ e("div", { className: "space-y-2 mb-3", children: p.map(([u, h]) => /* @__PURE__ */
|
|
1838
|
+
p.length > 0 && /* @__PURE__ */ e("div", { className: "space-y-2 mb-3", children: p.map(([u, h]) => /* @__PURE__ */ n(
|
|
1839
1839
|
"div",
|
|
1840
1840
|
{
|
|
1841
1841
|
className: "flex items-center gap-2 p-2 bg-pink-50 dark:bg-pink-900/20 rounded border border-pink-200 dark:border-pink-800",
|
|
1842
1842
|
children: [
|
|
1843
|
-
/* @__PURE__ */
|
|
1844
|
-
/* @__PURE__ */
|
|
1843
|
+
/* @__PURE__ */ n("div", { className: "flex-1 min-w-0", children: [
|
|
1844
|
+
/* @__PURE__ */ n("div", { className: "flex items-center gap-2", children: [
|
|
1845
1845
|
/* @__PURE__ */ e("span", { className: "text-sm font-medium text-pink-700 dark:text-pink-300 truncate", children: u }),
|
|
1846
|
-
/* @__PURE__ */
|
|
1846
|
+
/* @__PURE__ */ n(
|
|
1847
1847
|
"select",
|
|
1848
1848
|
{
|
|
1849
1849
|
value: h.type,
|
|
1850
|
-
onChange: (
|
|
1850
|
+
onChange: (b) => m(u, b.target.value),
|
|
1851
1851
|
className: "text-xs px-1.5 py-0.5 rounded border border-pink-300 dark:border-pink-700 bg-white dark:bg-zinc-800 text-gray-700 dark:text-zinc-300",
|
|
1852
1852
|
children: [
|
|
1853
1853
|
/* @__PURE__ */ e("option", { value: "string", children: "string" }),
|
|
@@ -1864,7 +1864,7 @@ function dt({ nodeId: r, outputSchema: l, updateNodeData: t }) {
|
|
|
1864
1864
|
{
|
|
1865
1865
|
type: "text",
|
|
1866
1866
|
value: h.description || "",
|
|
1867
|
-
onChange: (
|
|
1867
|
+
onChange: (b) => c(u, b.target.value),
|
|
1868
1868
|
placeholder: "Description (optional)",
|
|
1869
1869
|
className: "mt-1 w-full text-xs px-2 py-1 rounded border border-pink-200 dark:border-pink-700 bg-white dark:bg-zinc-800 text-gray-600 dark:text-zinc-400 placeholder-gray-400 dark:placeholder-zinc-500"
|
|
1870
1870
|
}
|
|
@@ -1891,12 +1891,12 @@ function dt({ nodeId: r, outputSchema: l, updateNodeData: t }) {
|
|
|
1891
1891
|
},
|
|
1892
1892
|
u
|
|
1893
1893
|
)) }),
|
|
1894
|
-
/* @__PURE__ */
|
|
1894
|
+
/* @__PURE__ */ n("div", { className: "flex gap-2", children: [
|
|
1895
1895
|
/* @__PURE__ */ e(
|
|
1896
1896
|
"input",
|
|
1897
1897
|
{
|
|
1898
1898
|
type: "text",
|
|
1899
|
-
value:
|
|
1899
|
+
value: o,
|
|
1900
1900
|
onChange: (u) => i(u.target.value),
|
|
1901
1901
|
onKeyDown: (u) => u.key === "Enter" && d(),
|
|
1902
1902
|
placeholder: "Property name...",
|
|
@@ -1907,7 +1907,7 @@ function dt({ nodeId: r, outputSchema: l, updateNodeData: t }) {
|
|
|
1907
1907
|
"button",
|
|
1908
1908
|
{
|
|
1909
1909
|
onClick: d,
|
|
1910
|
-
disabled: !
|
|
1910
|
+
disabled: !o.trim(),
|
|
1911
1911
|
className: "px-3 py-1.5 text-sm font-medium text-white bg-pink-500 rounded hover:bg-pink-600 disabled:opacity-50 disabled:cursor-not-allowed",
|
|
1912
1912
|
children: "Add"
|
|
1913
1913
|
}
|
|
@@ -1917,15 +1917,15 @@ function dt({ nodeId: r, outputSchema: l, updateNodeData: t }) {
|
|
|
1917
1917
|
] });
|
|
1918
1918
|
}
|
|
1919
1919
|
function ct(r, l) {
|
|
1920
|
-
const t = new Map(r.map((d) => [d.id, d])),
|
|
1920
|
+
const t = new Map(r.map((d) => [d.id, d])), o = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Map();
|
|
1921
1921
|
for (const d of r)
|
|
1922
|
-
|
|
1922
|
+
o.set(d.id, 0), i.set(d.id, []);
|
|
1923
1923
|
for (const d of l) {
|
|
1924
1924
|
const a = i.get(d.source) || [];
|
|
1925
|
-
a.push(d.target), i.set(d.source, a),
|
|
1925
|
+
a.push(d.target), i.set(d.source, a), o.set(d.target, (o.get(d.target) || 0) + 1);
|
|
1926
1926
|
}
|
|
1927
1927
|
const s = [];
|
|
1928
|
-
for (const [d, a] of
|
|
1928
|
+
for (const [d, a] of o)
|
|
1929
1929
|
a === 0 && s.push(d);
|
|
1930
1930
|
const p = [];
|
|
1931
1931
|
for (; s.length > 0; ) {
|
|
@@ -1933,8 +1933,8 @@ function ct(r, l) {
|
|
|
1933
1933
|
a && p.push(a);
|
|
1934
1934
|
const m = i.get(d) || [];
|
|
1935
1935
|
for (const c of m) {
|
|
1936
|
-
const u = (
|
|
1937
|
-
|
|
1936
|
+
const u = (o.get(c) || 1) - 1;
|
|
1937
|
+
o.set(c, u), u === 0 && s.push(c);
|
|
1938
1938
|
}
|
|
1939
1939
|
}
|
|
1940
1940
|
return p;
|
|
@@ -1943,21 +1943,21 @@ function mt(r) {
|
|
|
1943
1943
|
const l = r.type || "node", t = r.id.replace(/[^a-zA-Z0-9]/g, "_");
|
|
1944
1944
|
return `${l}_${t}`;
|
|
1945
1945
|
}
|
|
1946
|
-
function
|
|
1946
|
+
function _(r) {
|
|
1947
1947
|
return typeof r == "string" ? r.includes(`
|
|
1948
1948
|
`) ? "`" + r.replace(/`/g, "\\`").replace(/\$/g, "\\$") + "`" : JSON.stringify(r) : JSON.stringify(r, null, 2);
|
|
1949
1949
|
}
|
|
1950
1950
|
function pt(r, l, t) {
|
|
1951
|
-
const
|
|
1951
|
+
const o = t.get(r.id), i = [], s = l.find((d) => d.target === r.id), p = s ? t.get(s.source) : null;
|
|
1952
1952
|
switch (r.type) {
|
|
1953
1953
|
case "generator": {
|
|
1954
1954
|
const d = r.data;
|
|
1955
1955
|
i.push(d.generatorName);
|
|
1956
|
-
const a = d.params || {}, m = Object.entries(a).filter(([, c]) => c !== void 0 && c !== "").map(([c, u]) => ` ${c}: ${
|
|
1956
|
+
const a = d.params || {}, m = Object.entries(a).filter(([, c]) => c !== void 0 && c !== "").map(([c, u]) => ` ${c}: ${_(u)}`).join(`,
|
|
1957
1957
|
`);
|
|
1958
1958
|
return {
|
|
1959
1959
|
code: `// Generate image using ${d.generatorName}
|
|
1960
|
-
const ${
|
|
1960
|
+
const ${o} = await ${d.generatorName}({
|
|
1961
1961
|
${m}
|
|
1962
1962
|
});`,
|
|
1963
1963
|
imports: i
|
|
@@ -1966,25 +1966,25 @@ ${m}
|
|
|
1966
1966
|
case "input":
|
|
1967
1967
|
return {
|
|
1968
1968
|
code: `// Load input image
|
|
1969
|
-
const ${
|
|
1969
|
+
const ${o} = await flo.loadImage("./input.png");`,
|
|
1970
1970
|
imports: []
|
|
1971
1971
|
};
|
|
1972
1972
|
case "transform": {
|
|
1973
|
-
const d = r.data, a = d.params || {}, m = Object.entries(a).filter(([, u]) => u !== void 0 && u !== "").map(([u, h]) => `${u}: ${
|
|
1973
|
+
const d = r.data, a = d.params || {}, m = Object.entries(a).filter(([, u]) => u !== void 0 && u !== "").map(([u, h]) => `${u}: ${_(h)}`).join(", "), c = p || "image";
|
|
1974
1974
|
return {
|
|
1975
1975
|
code: `// Apply ${d.operation} transform
|
|
1976
|
-
const ${
|
|
1976
|
+
const ${o} = await flo.transform(${c}, "${d.operation}"${m ? `, { ${m} }` : ""});`,
|
|
1977
1977
|
imports: []
|
|
1978
1978
|
};
|
|
1979
1979
|
}
|
|
1980
1980
|
case "vision": {
|
|
1981
1981
|
const d = r.data;
|
|
1982
1982
|
i.push(d.providerName);
|
|
1983
|
-
const a = d.params || {}, m = p || "image", c = Object.entries(a).filter(([, u]) => u !== void 0 && u !== "").map(([u, h]) => ` ${u}: ${
|
|
1983
|
+
const a = d.params || {}, m = p || "image", c = Object.entries(a).filter(([, u]) => u !== void 0 && u !== "").map(([u, h]) => ` ${u}: ${_(h)}`).join(`,
|
|
1984
1984
|
`);
|
|
1985
1985
|
return {
|
|
1986
1986
|
code: `// Analyze image with ${d.providerName}
|
|
1987
|
-
const ${
|
|
1987
|
+
const ${o} = await ${d.providerName}.analyze(${m}, {
|
|
1988
1988
|
${c}
|
|
1989
1989
|
});`,
|
|
1990
1990
|
imports: i
|
|
@@ -1993,11 +1993,11 @@ ${c}
|
|
|
1993
1993
|
case "text": {
|
|
1994
1994
|
const d = r.data;
|
|
1995
1995
|
i.push(d.providerName);
|
|
1996
|
-
const a = d.params || {}, m = Object.entries(a).filter(([, c]) => c !== void 0 && c !== "").map(([c, u]) => ` ${c}: ${
|
|
1996
|
+
const a = d.params || {}, m = Object.entries(a).filter(([, c]) => c !== void 0 && c !== "").map(([c, u]) => ` ${c}: ${_(u)}`).join(`,
|
|
1997
1997
|
`);
|
|
1998
1998
|
return {
|
|
1999
1999
|
code: `// Generate text with ${d.providerName}
|
|
2000
|
-
const ${
|
|
2000
|
+
const ${o} = await ${d.providerName}.generate({
|
|
2001
2001
|
${m}
|
|
2002
2002
|
});`,
|
|
2003
2003
|
imports: i
|
|
@@ -2007,7 +2007,7 @@ ${m}
|
|
|
2007
2007
|
const d = r.data;
|
|
2008
2008
|
return {
|
|
2009
2009
|
code: `// Save result
|
|
2010
|
-
await flo.save(${p || "result"}, ${
|
|
2010
|
+
await flo.save(${p || "result"}, ${_(d.destination)});`,
|
|
2011
2011
|
imports: []
|
|
2012
2012
|
};
|
|
2013
2013
|
}
|
|
@@ -2022,12 +2022,12 @@ function ut(r, l) {
|
|
|
2022
2022
|
if (r.length === 0)
|
|
2023
2023
|
return `// Empty workflow
|
|
2024
2024
|
// Add nodes to your canvas to generate code`;
|
|
2025
|
-
const t = ct(r, l),
|
|
2025
|
+
const t = ct(r, l), o = /* @__PURE__ */ new Map();
|
|
2026
2026
|
for (const m of t)
|
|
2027
|
-
|
|
2027
|
+
o.set(m.id, mt(m));
|
|
2028
2028
|
const i = /* @__PURE__ */ new Set(), s = [];
|
|
2029
2029
|
for (const m of t) {
|
|
2030
|
-
const { code: c, imports: u } = pt(m, l,
|
|
2030
|
+
const { code: c, imports: u } = pt(m, l, o);
|
|
2031
2031
|
s.push(c);
|
|
2032
2032
|
for (const h of u)
|
|
2033
2033
|
i.add(h);
|
|
@@ -2059,14 +2059,14 @@ runWorkflow().catch(console.error);
|
|
|
2059
2059
|
` + a;
|
|
2060
2060
|
}
|
|
2061
2061
|
function gt({ isOpen: r, onClose: l, onImport: t }) {
|
|
2062
|
-
const [
|
|
2063
|
-
if (!
|
|
2062
|
+
const [o, i] = C(""), [s, p] = C(!1), [d, a] = C(null), [m, c] = C(!1), u = W(async () => {
|
|
2063
|
+
if (!o.trim()) {
|
|
2064
2064
|
a({ message: "Please enter or paste YAML content" });
|
|
2065
2065
|
return;
|
|
2066
2066
|
}
|
|
2067
2067
|
p(!0), a(null);
|
|
2068
2068
|
try {
|
|
2069
|
-
const g = await He(
|
|
2069
|
+
const g = await He(o);
|
|
2070
2070
|
g.success ? (t(g.nodes, g.edges, g.name), i(""), l()) : a({
|
|
2071
2071
|
message: g.error || "Import failed",
|
|
2072
2072
|
line: g.line,
|
|
@@ -2077,52 +2077,52 @@ function gt({ isOpen: r, onClose: l, onImport: t }) {
|
|
|
2077
2077
|
} finally {
|
|
2078
2078
|
p(!1);
|
|
2079
2079
|
}
|
|
2080
|
-
}, [
|
|
2081
|
-
if (!
|
|
2080
|
+
}, [o, t, l]), h = W(async () => {
|
|
2081
|
+
if (!o.trim()) {
|
|
2082
2082
|
a({ message: "Please enter or paste YAML content" });
|
|
2083
2083
|
return;
|
|
2084
2084
|
}
|
|
2085
2085
|
p(!0), a(null);
|
|
2086
2086
|
try {
|
|
2087
|
-
const g = await _e(
|
|
2087
|
+
const g = await _e(o);
|
|
2088
2088
|
g.valid ? (a(null), a({ message: "Valid YAML!" }), setTimeout(() => a(null), 2e3)) : g.errors.length > 0 && a(g.errors[0]);
|
|
2089
2089
|
} catch (g) {
|
|
2090
2090
|
a({ message: g instanceof Error ? g.message : "Validation failed" });
|
|
2091
2091
|
} finally {
|
|
2092
2092
|
p(!1);
|
|
2093
2093
|
}
|
|
2094
|
-
}, [
|
|
2094
|
+
}, [o]), b = W(async (g) => {
|
|
2095
2095
|
if (!g.name.endsWith(".yaml") && !g.name.endsWith(".yml")) {
|
|
2096
2096
|
a({ message: "Please upload a .yaml or .yml file" });
|
|
2097
2097
|
return;
|
|
2098
2098
|
}
|
|
2099
2099
|
try {
|
|
2100
|
-
const
|
|
2101
|
-
i(
|
|
2100
|
+
const N = await g.text();
|
|
2101
|
+
i(N), a(null);
|
|
2102
2102
|
} catch {
|
|
2103
2103
|
a({ message: "Failed to read file" });
|
|
2104
2104
|
}
|
|
2105
|
-
}, []), y =
|
|
2105
|
+
}, []), y = W((g) => {
|
|
2106
2106
|
g.preventDefault(), c(!0);
|
|
2107
|
-
}, []), v =
|
|
2107
|
+
}, []), v = W((g) => {
|
|
2108
2108
|
g.preventDefault(), c(!1);
|
|
2109
|
-
}, []), w =
|
|
2109
|
+
}, []), w = W(
|
|
2110
2110
|
(g) => {
|
|
2111
2111
|
g.preventDefault(), c(!1);
|
|
2112
|
-
const
|
|
2113
|
-
|
|
2112
|
+
const N = g.dataTransfer.files[0];
|
|
2113
|
+
N && b(N);
|
|
2114
2114
|
},
|
|
2115
|
-
[
|
|
2116
|
-
),
|
|
2115
|
+
[b]
|
|
2116
|
+
), x = W(
|
|
2117
2117
|
(g) => {
|
|
2118
|
-
var
|
|
2119
|
-
const
|
|
2120
|
-
|
|
2118
|
+
var A;
|
|
2119
|
+
const N = (A = g.target.files) == null ? void 0 : A[0];
|
|
2120
|
+
N && b(N);
|
|
2121
2121
|
},
|
|
2122
|
-
[
|
|
2122
|
+
[b]
|
|
2123
2123
|
);
|
|
2124
|
-
return r ? /* @__PURE__ */ e("div", { className: "fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50", children: /* @__PURE__ */
|
|
2125
|
-
/* @__PURE__ */
|
|
2124
|
+
return r ? /* @__PURE__ */ e("div", { className: "fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50", children: /* @__PURE__ */ n("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: [
|
|
2125
|
+
/* @__PURE__ */ n("div", { className: "flex items-center justify-between px-4 py-3 border-b border-gray-200 dark:border-zinc-700", children: [
|
|
2126
2126
|
/* @__PURE__ */ e("h3", { className: "text-lg font-semibold text-gray-900 dark:text-white", children: "Import Workflow" }),
|
|
2127
2127
|
/* @__PURE__ */ e(
|
|
2128
2128
|
"button",
|
|
@@ -2141,9 +2141,9 @@ function gt({ isOpen: r, onClose: l, onImport: t }) {
|
|
|
2141
2141
|
}
|
|
2142
2142
|
)
|
|
2143
2143
|
] }),
|
|
2144
|
-
/* @__PURE__ */
|
|
2144
|
+
/* @__PURE__ */ n("div", { className: "p-4 flex-1 overflow-auto", children: [
|
|
2145
2145
|
/* @__PURE__ */ e("p", { className: "text-sm text-gray-600 dark:text-zinc-400 mb-4", children: "Paste YAML content or drag and drop a .yaml file to import a workflow." }),
|
|
2146
|
-
/* @__PURE__ */
|
|
2146
|
+
/* @__PURE__ */ n(
|
|
2147
2147
|
"div",
|
|
2148
2148
|
{
|
|
2149
2149
|
onDragOver: y,
|
|
@@ -2156,12 +2156,12 @@ function gt({ isOpen: r, onClose: l, onImport: t }) {
|
|
|
2156
2156
|
{
|
|
2157
2157
|
type: "file",
|
|
2158
2158
|
accept: ".yaml,.yml",
|
|
2159
|
-
onChange:
|
|
2159
|
+
onChange: x,
|
|
2160
2160
|
className: "hidden",
|
|
2161
2161
|
id: "yaml-file-input"
|
|
2162
2162
|
}
|
|
2163
2163
|
),
|
|
2164
|
-
/* @__PURE__ */
|
|
2164
|
+
/* @__PURE__ */ n(
|
|
2165
2165
|
"label",
|
|
2166
2166
|
{
|
|
2167
2167
|
htmlFor: "yaml-file-input",
|
|
@@ -2199,7 +2199,7 @@ function gt({ isOpen: r, onClose: l, onImport: t }) {
|
|
|
2199
2199
|
/* @__PURE__ */ e(
|
|
2200
2200
|
"textarea",
|
|
2201
2201
|
{
|
|
2202
|
-
value:
|
|
2202
|
+
value: o,
|
|
2203
2203
|
onChange: (g) => {
|
|
2204
2204
|
i(g.target.value), a(null);
|
|
2205
2205
|
},
|
|
@@ -2225,13 +2225,13 @@ steps:
|
|
|
2225
2225
|
className: "w-full h-64 p-3 font-mono text-sm bg-gray-100 dark:bg-zinc-900 border border-gray-300 dark:border-zinc-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-teal-500 text-gray-800 dark:text-zinc-200"
|
|
2226
2226
|
}
|
|
2227
2227
|
),
|
|
2228
|
-
d && /* @__PURE__ */
|
|
2228
|
+
d && /* @__PURE__ */ n(
|
|
2229
2229
|
"div",
|
|
2230
2230
|
{
|
|
2231
2231
|
className: `mt-4 p-3 rounded-lg text-sm ${d.message === "Valid YAML!" ? "bg-green-50 dark:bg-green-900/30 text-green-700 dark:text-green-400" : "bg-red-50 dark:bg-red-900/30 text-red-700 dark:text-red-400"}`,
|
|
2232
2232
|
children: [
|
|
2233
2233
|
/* @__PURE__ */ e("span", { className: "font-medium", children: d.message }),
|
|
2234
|
-
d.line && /* @__PURE__ */
|
|
2234
|
+
d.line && /* @__PURE__ */ n("span", { className: "ml-2 text-xs", children: [
|
|
2235
2235
|
"(line ",
|
|
2236
2236
|
d.line,
|
|
2237
2237
|
d.column ? `, column ${d.column}` : "",
|
|
@@ -2241,26 +2241,26 @@ steps:
|
|
|
2241
2241
|
}
|
|
2242
2242
|
)
|
|
2243
2243
|
] }),
|
|
2244
|
-
/* @__PURE__ */
|
|
2244
|
+
/* @__PURE__ */ n("div", { className: "flex justify-between items-center px-4 py-3 border-t border-gray-200 dark:border-zinc-700", children: [
|
|
2245
2245
|
/* @__PURE__ */ e("span", { className: "text-xs text-gray-500 dark:text-zinc-400", children: "Use with floimg CLI: floimg run workflow.yaml" }),
|
|
2246
|
-
/* @__PURE__ */
|
|
2246
|
+
/* @__PURE__ */ n("div", { className: "flex gap-2", children: [
|
|
2247
2247
|
/* @__PURE__ */ e(
|
|
2248
2248
|
"button",
|
|
2249
2249
|
{
|
|
2250
2250
|
onClick: h,
|
|
2251
|
-
disabled: s || !
|
|
2251
|
+
disabled: s || !o.trim(),
|
|
2252
2252
|
className: "px-4 py-2 text-sm font-medium text-gray-700 dark:text-zinc-200 bg-white dark:bg-zinc-700 border border-gray-300 dark:border-zinc-600 rounded-md hover:bg-gray-50 dark:hover:bg-zinc-600 disabled:opacity-50 disabled:cursor-not-allowed",
|
|
2253
2253
|
children: "Validate"
|
|
2254
2254
|
}
|
|
2255
2255
|
),
|
|
2256
|
-
/* @__PURE__ */
|
|
2256
|
+
/* @__PURE__ */ n(
|
|
2257
2257
|
"button",
|
|
2258
2258
|
{
|
|
2259
2259
|
onClick: u,
|
|
2260
|
-
disabled: s || !
|
|
2260
|
+
disabled: s || !o.trim(),
|
|
2261
2261
|
className: "px-4 py-2 text-sm font-medium text-white bg-teal-600 rounded-md hover:bg-teal-700 disabled:opacity-50 disabled:cursor-not-allowed flex items-center gap-2",
|
|
2262
2262
|
children: [
|
|
2263
|
-
s && /* @__PURE__ */
|
|
2263
|
+
s && /* @__PURE__ */ n("svg", { className: "animate-spin h-4 w-4", viewBox: "0 0 24 24", fill: "none", children: [
|
|
2264
2264
|
/* @__PURE__ */ e(
|
|
2265
2265
|
"circle",
|
|
2266
2266
|
{
|
|
@@ -2293,51 +2293,51 @@ function ht({
|
|
|
2293
2293
|
brandingSlot: r,
|
|
2294
2294
|
beforeActionsSlot: l,
|
|
2295
2295
|
afterActionsSlot: t,
|
|
2296
|
-
hideAttribution:
|
|
2296
|
+
hideAttribution: o = !1,
|
|
2297
2297
|
hideWorkflowLibrary: i = !1
|
|
2298
2298
|
} = {}) {
|
|
2299
|
-
const s =
|
|
2300
|
-
|
|
2301
|
-
const
|
|
2302
|
-
|
|
2299
|
+
const s = f((z) => z.execution), p = f((z) => z.execute), d = f((z) => z.exportToYaml), a = f((z) => z.importFromYaml), m = f((z) => z.nodes), c = f((z) => z.edges), u = V((z) => z.openSettings), h = f((z) => z.activeWorkflowName), b = f((z) => z.hasUnsavedChanges), y = f((z) => z.saveWorkflow), v = f((z) => z.toggleLibrary), w = f((z) => z.setActiveWorkflowName), x = f((z) => z.selectedNodeId), g = f((z) => z.duplicateNode), [N, A] = C(!1), [k, L] = C(!1), [S, R] = C("yaml"), [J, Y] = C(""), [I, M] = C(""), [E, O] = C(null), [xe, X] = C(!1), [oe, Z] = C("");
|
|
2300
|
+
U(() => {
|
|
2301
|
+
const z = () => {
|
|
2302
|
+
O("New workflow created"), setTimeout(() => O(null), 2e3);
|
|
2303
2303
|
};
|
|
2304
|
-
return window.addEventListener("new-workflow-created",
|
|
2304
|
+
return window.addEventListener("new-workflow-created", z), () => window.removeEventListener("new-workflow-created", z);
|
|
2305
2305
|
}, []);
|
|
2306
|
-
const
|
|
2307
|
-
m.length !== 0 && (y(),
|
|
2306
|
+
const ee = W(() => {
|
|
2307
|
+
m.length !== 0 && (y(), O("Saved!"), setTimeout(() => O(null), 2e3));
|
|
2308
2308
|
}, [m.length, y]), be = () => {
|
|
2309
|
-
|
|
2310
|
-
},
|
|
2311
|
-
const
|
|
2312
|
-
|
|
2313
|
-
},
|
|
2314
|
-
|
|
2315
|
-
}, [
|
|
2316
|
-
|
|
2317
|
-
function
|
|
2318
|
-
(
|
|
2309
|
+
Z(h), X(!0);
|
|
2310
|
+
}, ne = () => {
|
|
2311
|
+
const z = oe.trim();
|
|
2312
|
+
z && z !== h && w(z), X(!1);
|
|
2313
|
+
}, se = W(() => {
|
|
2314
|
+
x && g(x);
|
|
2315
|
+
}, [x, g]);
|
|
2316
|
+
U(() => {
|
|
2317
|
+
function z(D) {
|
|
2318
|
+
(D.metaKey || D.ctrlKey) && D.key === "s" && (D.preventDefault(), ee()), (D.metaKey || D.ctrlKey) && D.key === "d" && (D.preventDefault(), se());
|
|
2319
2319
|
}
|
|
2320
|
-
return document.addEventListener("keydown",
|
|
2321
|
-
}, [
|
|
2320
|
+
return document.addEventListener("keydown", z), () => document.removeEventListener("keydown", z);
|
|
2321
|
+
}, [ee, se]);
|
|
2322
2322
|
const fe = async () => {
|
|
2323
2323
|
await p();
|
|
2324
2324
|
}, ke = async () => {
|
|
2325
|
-
const
|
|
2326
|
-
|
|
2327
|
-
const
|
|
2328
|
-
|
|
2325
|
+
const z = await d();
|
|
2326
|
+
Y(z);
|
|
2327
|
+
const D = ut(m, c);
|
|
2328
|
+
M(D), A(!0);
|
|
2329
2329
|
}, ve = () => {
|
|
2330
|
-
const
|
|
2331
|
-
navigator.clipboard.writeText(
|
|
2332
|
-
}, ye =
|
|
2333
|
-
(
|
|
2334
|
-
a(
|
|
2330
|
+
const z = S === "yaml" ? J : I;
|
|
2331
|
+
navigator.clipboard.writeText(z);
|
|
2332
|
+
}, ye = W(
|
|
2333
|
+
(z, D, we) => {
|
|
2334
|
+
a(z, D, we), O("Workflow imported!"), setTimeout(() => O(null), 2e3);
|
|
2335
2335
|
},
|
|
2336
2336
|
[a]
|
|
2337
2337
|
);
|
|
2338
|
-
return /* @__PURE__ */
|
|
2339
|
-
/* @__PURE__ */
|
|
2340
|
-
/* @__PURE__ */
|
|
2338
|
+
return /* @__PURE__ */ n(B, { children: [
|
|
2339
|
+
/* @__PURE__ */ n("div", { className: "h-14 bg-white dark:bg-zinc-800 border-b border-gray-200 dark:border-zinc-700 flex items-center justify-between px-4", children: [
|
|
2340
|
+
/* @__PURE__ */ n("div", { className: "flex items-center gap-4", children: [
|
|
2341
2341
|
!i && /* @__PURE__ */ e(
|
|
2342
2342
|
"button",
|
|
2343
2343
|
{
|
|
@@ -2355,10 +2355,10 @@ function ht({
|
|
|
2355
2355
|
) })
|
|
2356
2356
|
}
|
|
2357
2357
|
),
|
|
2358
|
-
/* @__PURE__ */
|
|
2358
|
+
/* @__PURE__ */ n("div", { className: "flex items-baseline gap-2", children: [
|
|
2359
2359
|
/* @__PURE__ */ e("h1", { className: "text-xl font-bold text-gray-800 dark:text-white", children: "FloImg Studio" }),
|
|
2360
2360
|
r,
|
|
2361
|
-
!
|
|
2361
|
+
!o && /* @__PURE__ */ e(
|
|
2362
2362
|
"a",
|
|
2363
2363
|
{
|
|
2364
2364
|
href: "https://flojo.io",
|
|
@@ -2369,16 +2369,16 @@ function ht({
|
|
|
2369
2369
|
}
|
|
2370
2370
|
)
|
|
2371
2371
|
] }),
|
|
2372
|
-
/* @__PURE__ */
|
|
2372
|
+
/* @__PURE__ */ n("div", { className: "flex items-center gap-2", children: [
|
|
2373
2373
|
xe ? /* @__PURE__ */ e(
|
|
2374
2374
|
"input",
|
|
2375
2375
|
{
|
|
2376
2376
|
type: "text",
|
|
2377
|
-
value:
|
|
2378
|
-
onChange: (
|
|
2379
|
-
onBlur:
|
|
2380
|
-
onKeyDown: (
|
|
2381
|
-
|
|
2377
|
+
value: oe,
|
|
2378
|
+
onChange: (z) => Z(z.target.value),
|
|
2379
|
+
onBlur: ne,
|
|
2380
|
+
onKeyDown: (z) => {
|
|
2381
|
+
z.key === "Enter" && ne(), z.key === "Escape" && (Z(h), X(!1));
|
|
2382
2382
|
},
|
|
2383
2383
|
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",
|
|
2384
2384
|
autoFocus: !0
|
|
@@ -2392,16 +2392,16 @@ function ht({
|
|
|
2392
2392
|
children: h
|
|
2393
2393
|
}
|
|
2394
2394
|
),
|
|
2395
|
-
|
|
2396
|
-
|
|
2395
|
+
b && /* @__PURE__ */ e("span", { className: "text-xs text-amber-600 dark:text-amber-400", children: "(unsaved)" }),
|
|
2396
|
+
E && /* @__PURE__ */ e("span", { className: "text-xs text-green-600 dark:text-green-400", children: E })
|
|
2397
2397
|
] }),
|
|
2398
|
-
/* @__PURE__ */
|
|
2398
|
+
/* @__PURE__ */ n("span", { className: "text-sm text-gray-500 dark:text-zinc-400", children: [
|
|
2399
2399
|
m.length,
|
|
2400
2400
|
" node",
|
|
2401
2401
|
m.length !== 1 ? "s" : ""
|
|
2402
2402
|
] })
|
|
2403
2403
|
] }),
|
|
2404
|
-
/* @__PURE__ */
|
|
2404
|
+
/* @__PURE__ */ n("div", { className: "flex items-center gap-3", children: [
|
|
2405
2405
|
l,
|
|
2406
2406
|
/* @__PURE__ */ e(
|
|
2407
2407
|
"button",
|
|
@@ -2409,7 +2409,7 @@ function ht({
|
|
|
2409
2409
|
onClick: u,
|
|
2410
2410
|
className: "p-2 text-gray-500 dark:text-zinc-400 hover:text-gray-700 dark:hover:text-zinc-200 hover:bg-gray-100 dark:hover:bg-zinc-700 rounded-md",
|
|
2411
2411
|
title: "AI Settings",
|
|
2412
|
-
children: /* @__PURE__ */
|
|
2412
|
+
children: /* @__PURE__ */ n("svg", { className: "h-5 w-5", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: [
|
|
2413
2413
|
/* @__PURE__ */ e(
|
|
2414
2414
|
"path",
|
|
2415
2415
|
{
|
|
@@ -2434,7 +2434,7 @@ function ht({
|
|
|
2434
2434
|
/* @__PURE__ */ e(
|
|
2435
2435
|
"button",
|
|
2436
2436
|
{
|
|
2437
|
-
onClick:
|
|
2437
|
+
onClick: ee,
|
|
2438
2438
|
disabled: m.length === 0,
|
|
2439
2439
|
className: "p-2 text-gray-500 dark:text-zinc-400 hover:text-gray-700 dark:hover:text-zinc-200 hover:bg-gray-100 dark:hover:bg-zinc-700 rounded-md disabled:opacity-50 disabled:cursor-not-allowed",
|
|
2440
2440
|
title: "Save Workflow (Cmd+S)",
|
|
@@ -2452,7 +2452,7 @@ function ht({
|
|
|
2452
2452
|
/* @__PURE__ */ e(
|
|
2453
2453
|
"button",
|
|
2454
2454
|
{
|
|
2455
|
-
onClick: () =>
|
|
2455
|
+
onClick: () => L(!0),
|
|
2456
2456
|
className: "px-4 py-2 text-sm font-medium text-gray-700 dark:text-zinc-200 bg-white dark:bg-zinc-700 border border-gray-300 dark:border-zinc-600 rounded-md hover:bg-gray-50 dark:hover:bg-zinc-600",
|
|
2457
2457
|
children: "Import"
|
|
2458
2458
|
}
|
|
@@ -2472,8 +2472,8 @@ function ht({
|
|
|
2472
2472
|
onClick: fe,
|
|
2473
2473
|
disabled: m.length === 0 || s.status === "running",
|
|
2474
2474
|
className: "px-4 py-2 text-sm font-medium text-white bg-teal-600 rounded-md hover:bg-teal-700 disabled:opacity-50 disabled:cursor-not-allowed flex items-center gap-2",
|
|
2475
|
-
children: s.status === "running" ? /* @__PURE__ */
|
|
2476
|
-
/* @__PURE__ */
|
|
2475
|
+
children: s.status === "running" ? /* @__PURE__ */ n(B, { children: [
|
|
2476
|
+
/* @__PURE__ */ n("svg", { className: "animate-spin h-4 w-4", viewBox: "0 0 24 24", fill: "none", children: [
|
|
2477
2477
|
/* @__PURE__ */ e(
|
|
2478
2478
|
"circle",
|
|
2479
2479
|
{
|
|
@@ -2495,8 +2495,8 @@ function ht({
|
|
|
2495
2495
|
)
|
|
2496
2496
|
] }),
|
|
2497
2497
|
"Running..."
|
|
2498
|
-
] }) : /* @__PURE__ */
|
|
2499
|
-
/* @__PURE__ */
|
|
2498
|
+
] }) : /* @__PURE__ */ n(B, { children: [
|
|
2499
|
+
/* @__PURE__ */ n("svg", { className: "h-4 w-4", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: [
|
|
2500
2500
|
/* @__PURE__ */ e(
|
|
2501
2501
|
"path",
|
|
2502
2502
|
{
|
|
@@ -2523,35 +2523,35 @@ function ht({
|
|
|
2523
2523
|
t
|
|
2524
2524
|
] })
|
|
2525
2525
|
] }),
|
|
2526
|
-
s.status === "completed" && s.imageIds.length > 0 && /* @__PURE__ */ e("div", { className: "bg-green-50 dark:bg-green-900/30 border-b border-green-200 dark:border-green-800 px-4 py-3", children: /* @__PURE__ */
|
|
2527
|
-
/* @__PURE__ */
|
|
2526
|
+
s.status === "completed" && s.imageIds.length > 0 && /* @__PURE__ */ e("div", { className: "bg-green-50 dark:bg-green-900/30 border-b border-green-200 dark:border-green-800 px-4 py-3", children: /* @__PURE__ */ n("div", { className: "flex items-center gap-4", children: [
|
|
2527
|
+
/* @__PURE__ */ n("span", { className: "text-green-700 dark:text-green-400 font-medium", children: [
|
|
2528
2528
|
"Generated ",
|
|
2529
2529
|
s.imageIds.length,
|
|
2530
2530
|
" image",
|
|
2531
2531
|
s.imageIds.length !== 1 ? "s" : ""
|
|
2532
2532
|
] }),
|
|
2533
|
-
/* @__PURE__ */ e("div", { className: "flex gap-2", children: s.imageUrls.slice(0, 4).map((
|
|
2533
|
+
/* @__PURE__ */ e("div", { className: "flex gap-2", children: s.imageUrls.slice(0, 4).map((z, D) => /* @__PURE__ */ e("a", { href: z, target: "_blank", rel: "noopener noreferrer", className: "block", children: /* @__PURE__ */ e(
|
|
2534
2534
|
"img",
|
|
2535
2535
|
{
|
|
2536
|
-
src:
|
|
2536
|
+
src: z,
|
|
2537
2537
|
alt: "Generated",
|
|
2538
2538
|
className: "h-12 w-12 object-cover rounded border border-green-300 dark:border-green-700"
|
|
2539
2539
|
}
|
|
2540
|
-
) },
|
|
2540
|
+
) }, D)) })
|
|
2541
2541
|
] }) }),
|
|
2542
|
-
s.status === "error" && /* @__PURE__ */ e("div", { className: "bg-red-50 dark:bg-red-900/30 border-b border-red-200 dark:border-red-800 px-4 py-3", children: /* @__PURE__ */
|
|
2542
|
+
s.status === "error" && /* @__PURE__ */ e("div", { className: "bg-red-50 dark:bg-red-900/30 border-b border-red-200 dark:border-red-800 px-4 py-3", children: /* @__PURE__ */ n("span", { className: "text-red-700 dark:text-red-400", children: [
|
|
2543
2543
|
"Error: ",
|
|
2544
2544
|
s.error
|
|
2545
2545
|
] }) }),
|
|
2546
|
-
|
|
2547
|
-
/* @__PURE__ */
|
|
2548
|
-
/* @__PURE__ */
|
|
2546
|
+
N && /* @__PURE__ */ e("div", { className: "fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50", children: /* @__PURE__ */ n("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: [
|
|
2547
|
+
/* @__PURE__ */ n("div", { className: "flex items-center justify-between px-4 py-3 border-b border-gray-200 dark:border-zinc-700", children: [
|
|
2548
|
+
/* @__PURE__ */ n("div", { className: "flex items-center gap-4", children: [
|
|
2549
2549
|
/* @__PURE__ */ e("h3", { className: "text-lg font-semibold text-gray-900 dark:text-white", children: "Export Workflow" }),
|
|
2550
|
-
/* @__PURE__ */
|
|
2550
|
+
/* @__PURE__ */ n("div", { className: "flex gap-1 bg-gray-100 dark:bg-zinc-700 rounded-lg p-1", children: [
|
|
2551
2551
|
/* @__PURE__ */ e(
|
|
2552
2552
|
"button",
|
|
2553
2553
|
{
|
|
2554
|
-
onClick: () =>
|
|
2554
|
+
onClick: () => R("yaml"),
|
|
2555
2555
|
className: `px-3 py-1 text-sm font-medium rounded-md transition-colors ${S === "yaml" ? "bg-white dark:bg-zinc-600 text-gray-900 dark:text-white shadow-sm" : "text-gray-600 dark:text-zinc-400 hover:text-gray-900 dark:hover:text-white"}`,
|
|
2556
2556
|
children: "YAML"
|
|
2557
2557
|
}
|
|
@@ -2559,7 +2559,7 @@ function ht({
|
|
|
2559
2559
|
/* @__PURE__ */ e(
|
|
2560
2560
|
"button",
|
|
2561
2561
|
{
|
|
2562
|
-
onClick: () =>
|
|
2562
|
+
onClick: () => R("javascript"),
|
|
2563
2563
|
className: `px-3 py-1 text-sm font-medium rounded-md transition-colors ${S === "javascript" ? "bg-white dark:bg-zinc-600 text-gray-900 dark:text-white shadow-sm" : "text-gray-600 dark:text-zinc-400 hover:text-gray-900 dark:hover:text-white"}`,
|
|
2564
2564
|
children: "JavaScript"
|
|
2565
2565
|
}
|
|
@@ -2569,7 +2569,7 @@ function ht({
|
|
|
2569
2569
|
/* @__PURE__ */ e(
|
|
2570
2570
|
"button",
|
|
2571
2571
|
{
|
|
2572
|
-
onClick: () =>
|
|
2572
|
+
onClick: () => A(!1),
|
|
2573
2573
|
className: "text-gray-500 dark:text-zinc-400 hover:text-gray-700 dark:hover:text-zinc-200",
|
|
2574
2574
|
children: /* @__PURE__ */ e("svg", { className: "h-6 w-6", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ e(
|
|
2575
2575
|
"path",
|
|
@@ -2583,10 +2583,10 @@ function ht({
|
|
|
2583
2583
|
}
|
|
2584
2584
|
)
|
|
2585
2585
|
] }),
|
|
2586
|
-
/* @__PURE__ */ e("div", { className: "p-4 overflow-auto flex-1", children: /* @__PURE__ */ e("pre", { className: "bg-gray-100 dark:bg-zinc-900 p-4 rounded text-sm font-mono whitespace-pre-wrap text-gray-800 dark:text-zinc-200", children: S === "yaml" ?
|
|
2587
|
-
/* @__PURE__ */
|
|
2586
|
+
/* @__PURE__ */ e("div", { className: "p-4 overflow-auto flex-1", children: /* @__PURE__ */ e("pre", { className: "bg-gray-100 dark:bg-zinc-900 p-4 rounded text-sm font-mono whitespace-pre-wrap text-gray-800 dark:text-zinc-200", children: S === "yaml" ? J : I }) }),
|
|
2587
|
+
/* @__PURE__ */ n("div", { className: "flex justify-between items-center px-4 py-3 border-t border-gray-200 dark:border-zinc-700", children: [
|
|
2588
2588
|
/* @__PURE__ */ e("span", { className: "text-xs text-gray-500 dark:text-zinc-400", children: S === "yaml" ? "Use with floimg CLI: floimg run workflow.yaml" : "Run with Node.js or Bun" }),
|
|
2589
|
-
/* @__PURE__ */
|
|
2589
|
+
/* @__PURE__ */ n("div", { className: "flex gap-2", children: [
|
|
2590
2590
|
/* @__PURE__ */ e(
|
|
2591
2591
|
"button",
|
|
2592
2592
|
{
|
|
@@ -2598,7 +2598,7 @@ function ht({
|
|
|
2598
2598
|
/* @__PURE__ */ e(
|
|
2599
2599
|
"button",
|
|
2600
2600
|
{
|
|
2601
|
-
onClick: () =>
|
|
2601
|
+
onClick: () => A(!1),
|
|
2602
2602
|
className: "px-4 py-2 text-sm font-medium text-white bg-teal-600 rounded-md hover:bg-teal-700",
|
|
2603
2603
|
children: "Close"
|
|
2604
2604
|
}
|
|
@@ -2609,20 +2609,20 @@ function ht({
|
|
|
2609
2609
|
/* @__PURE__ */ e(
|
|
2610
2610
|
gt,
|
|
2611
2611
|
{
|
|
2612
|
-
isOpen:
|
|
2613
|
-
onClose: () =>
|
|
2612
|
+
isOpen: k,
|
|
2613
|
+
onClose: () => L(!1),
|
|
2614
2614
|
onImport: ye
|
|
2615
2615
|
}
|
|
2616
2616
|
)
|
|
2617
2617
|
] });
|
|
2618
2618
|
}
|
|
2619
2619
|
function xt() {
|
|
2620
|
-
const r =
|
|
2621
|
-
data:
|
|
2620
|
+
const r = f((a) => a.loadTemplate), [l, t] = C(null), {
|
|
2621
|
+
data: o,
|
|
2622
2622
|
isLoading: i,
|
|
2623
2623
|
error: s,
|
|
2624
2624
|
refetch: p
|
|
2625
|
-
} =
|
|
2625
|
+
} = K({
|
|
2626
2626
|
queryKey: ["images"],
|
|
2627
2627
|
queryFn: Ee,
|
|
2628
2628
|
refetchInterval: 5e3
|
|
@@ -2652,18 +2652,18 @@ function xt() {
|
|
|
2652
2652
|
t(null);
|
|
2653
2653
|
}
|
|
2654
2654
|
};
|
|
2655
|
-
return i ? /* @__PURE__ */ e("div", { className: "p-8 text-center text-gray-500 dark:text-zinc-400", children: "Loading images..." }) : s ? /* @__PURE__ */
|
|
2655
|
+
return i ? /* @__PURE__ */ e("div", { className: "p-8 text-center text-gray-500 dark:text-zinc-400", children: "Loading images..." }) : s ? /* @__PURE__ */ n("div", { className: "p-8 text-center text-red-500 dark:text-red-400", children: [
|
|
2656
2656
|
"Error loading images: ",
|
|
2657
2657
|
s instanceof Error ? s.message : "Unknown error"
|
|
2658
|
-
] }) : !
|
|
2658
|
+
] }) : !o || o.length === 0 ? /* @__PURE__ */ n("div", { className: "p-8 text-center text-gray-500 dark:text-zinc-400", children: [
|
|
2659
2659
|
/* @__PURE__ */ e("div", { className: "text-lg mb-2", children: "No images yet" }),
|
|
2660
2660
|
/* @__PURE__ */ e("div", { className: "text-sm", children: "Create a workflow and click Execute to generate images" })
|
|
2661
|
-
] }) : /* @__PURE__ */
|
|
2662
|
-
/* @__PURE__ */
|
|
2663
|
-
/* @__PURE__ */
|
|
2664
|
-
/* @__PURE__ */
|
|
2661
|
+
] }) : /* @__PURE__ */ n("div", { className: "p-4 bg-gray-100 dark:bg-zinc-900 min-h-full", children: [
|
|
2662
|
+
/* @__PURE__ */ n("div", { className: "flex items-center justify-between mb-4", children: [
|
|
2663
|
+
/* @__PURE__ */ n("div", { children: [
|
|
2664
|
+
/* @__PURE__ */ n("h2", { className: "text-lg font-semibold text-gray-800 dark:text-white", children: [
|
|
2665
2665
|
"Images (",
|
|
2666
|
-
|
|
2666
|
+
o.length,
|
|
2667
2667
|
")"
|
|
2668
2668
|
] }),
|
|
2669
2669
|
/* @__PURE__ */ e("p", { className: "text-xs text-gray-500 dark:text-zinc-500", children: "Your generated images" })
|
|
@@ -2677,7 +2677,7 @@ function xt() {
|
|
|
2677
2677
|
}
|
|
2678
2678
|
)
|
|
2679
2679
|
] }),
|
|
2680
|
-
/* @__PURE__ */ e("div", { className: "grid grid-cols-2 md:grid-cols-3 lg:grid-cols-4 gap-4", children:
|
|
2680
|
+
/* @__PURE__ */ e("div", { className: "grid grid-cols-2 md:grid-cols-3 lg:grid-cols-4 gap-4", children: o.map((a) => /* @__PURE__ */ e(
|
|
2681
2681
|
bt,
|
|
2682
2682
|
{
|
|
2683
2683
|
image: a,
|
|
@@ -2689,20 +2689,20 @@ function xt() {
|
|
|
2689
2689
|
] });
|
|
2690
2690
|
}
|
|
2691
2691
|
function bt({ image: r, onLoadWorkflow: l, isLoading: t }) {
|
|
2692
|
-
const
|
|
2693
|
-
return /* @__PURE__ */
|
|
2694
|
-
/* @__PURE__ */
|
|
2692
|
+
const o = (s) => new Date(s).toLocaleString(), i = (s) => s < 1024 ? `${s} B` : s < 1048576 ? `${(s / 1024).toFixed(1)} KB` : `${(s / 1048576).toFixed(1)} MB`;
|
|
2693
|
+
return /* @__PURE__ */ n("div", { className: "bg-white dark:bg-zinc-800 rounded-lg border border-gray-200 dark:border-zinc-700 overflow-hidden shadow-sm hover:shadow-md transition-shadow group", children: [
|
|
2694
|
+
/* @__PURE__ */ n("div", { className: "relative", children: [
|
|
2695
2695
|
/* @__PURE__ */ e(
|
|
2696
2696
|
"a",
|
|
2697
2697
|
{
|
|
2698
|
-
href:
|
|
2698
|
+
href: le(r.id),
|
|
2699
2699
|
target: "_blank",
|
|
2700
2700
|
rel: "noopener noreferrer",
|
|
2701
2701
|
className: "block aspect-square bg-gray-100 dark:bg-zinc-900",
|
|
2702
2702
|
children: /* @__PURE__ */ e(
|
|
2703
2703
|
"img",
|
|
2704
2704
|
{
|
|
2705
|
-
src:
|
|
2705
|
+
src: le(r.id),
|
|
2706
2706
|
alt: r.filename,
|
|
2707
2707
|
className: "w-full h-full object-cover",
|
|
2708
2708
|
loading: "lazy"
|
|
@@ -2722,14 +2722,14 @@ function bt({ image: r, onLoadWorkflow: l, isLoading: t }) {
|
|
|
2722
2722
|
}
|
|
2723
2723
|
) })
|
|
2724
2724
|
] }),
|
|
2725
|
-
/* @__PURE__ */
|
|
2725
|
+
/* @__PURE__ */ n("div", { className: "p-3", children: [
|
|
2726
2726
|
/* @__PURE__ */ e("div", { className: "text-sm font-medium text-gray-800 dark:text-white truncate", children: r.filename }),
|
|
2727
|
-
/* @__PURE__ */
|
|
2727
|
+
/* @__PURE__ */ n("div", { className: "text-xs text-gray-500 dark:text-zinc-400 mt-1", children: [
|
|
2728
2728
|
r.mime,
|
|
2729
2729
|
" • ",
|
|
2730
2730
|
i(r.size)
|
|
2731
2731
|
] }),
|
|
2732
|
-
/* @__PURE__ */ e("div", { className: "text-xs text-gray-400 dark:text-zinc-500 mt-1", children:
|
|
2732
|
+
/* @__PURE__ */ e("div", { className: "text-xs text-gray-400 dark:text-zinc-500 mt-1", children: o(r.createdAt) })
|
|
2733
2733
|
] })
|
|
2734
2734
|
] });
|
|
2735
2735
|
}
|
|
@@ -3137,7 +3137,7 @@ const ft = {
|
|
|
3137
3137
|
],
|
|
3138
3138
|
edges: [{ id: "e1", source: "gen-1", target: "transform-1" }]
|
|
3139
3139
|
}
|
|
3140
|
-
},
|
|
3140
|
+
}, q = [
|
|
3141
3141
|
// Charts
|
|
3142
3142
|
ft,
|
|
3143
3143
|
kt,
|
|
@@ -3153,29 +3153,29 @@ const ft = {
|
|
|
3153
3153
|
It
|
|
3154
3154
|
];
|
|
3155
3155
|
function St() {
|
|
3156
|
-
const r = new Set(
|
|
3156
|
+
const r = new Set(q.map((l) => l.category));
|
|
3157
3157
|
return Array.from(r).sort();
|
|
3158
3158
|
}
|
|
3159
3159
|
function Ft(r) {
|
|
3160
|
-
return
|
|
3160
|
+
return q.filter((l) => l.category === r);
|
|
3161
3161
|
}
|
|
3162
|
-
function
|
|
3163
|
-
return
|
|
3162
|
+
function pe(r) {
|
|
3163
|
+
return q.find((l) => l.id === r);
|
|
3164
3164
|
}
|
|
3165
3165
|
function Ht(r) {
|
|
3166
3166
|
const l = r.toLowerCase();
|
|
3167
|
-
return
|
|
3167
|
+
return q.filter(
|
|
3168
3168
|
(t) => {
|
|
3169
|
-
var
|
|
3170
|
-
return t.name.toLowerCase().includes(l) || t.description.toLowerCase().includes(l) || t.category.toLowerCase().includes(l) || t.generator.toLowerCase().includes(l) || ((
|
|
3169
|
+
var o;
|
|
3170
|
+
return t.name.toLowerCase().includes(l) || t.description.toLowerCase().includes(l) || t.category.toLowerCase().includes(l) || t.generator.toLowerCase().includes(l) || ((o = t.tags) == null ? void 0 : o.some((i) => i.toLowerCase().includes(l)));
|
|
3171
3171
|
}
|
|
3172
3172
|
);
|
|
3173
3173
|
}
|
|
3174
3174
|
function Lt({ onSelect: r }) {
|
|
3175
|
-
const [l, t] =
|
|
3176
|
-
let d =
|
|
3177
|
-
if (l && (d = d.filter((a) => a.category === l)),
|
|
3178
|
-
const a =
|
|
3175
|
+
const [l, t] = C(null), [o, i] = C(""), s = ie(() => St(), []), p = ie(() => {
|
|
3176
|
+
let d = q;
|
|
3177
|
+
if (l && (d = d.filter((a) => a.category === l)), o) {
|
|
3178
|
+
const a = o.toLowerCase();
|
|
3179
3179
|
d = d.filter(
|
|
3180
3180
|
(m) => {
|
|
3181
3181
|
var c;
|
|
@@ -3184,24 +3184,24 @@ function Lt({ onSelect: r }) {
|
|
|
3184
3184
|
);
|
|
3185
3185
|
}
|
|
3186
3186
|
return d;
|
|
3187
|
-
}, [l,
|
|
3188
|
-
return /* @__PURE__ */
|
|
3189
|
-
/* @__PURE__ */
|
|
3187
|
+
}, [l, o]);
|
|
3188
|
+
return /* @__PURE__ */ n("div", { className: "p-6", children: [
|
|
3189
|
+
/* @__PURE__ */ n("div", { className: "mb-6", children: [
|
|
3190
3190
|
/* @__PURE__ */ e("h2", { className: "text-2xl font-bold text-gray-900 dark:text-white mb-2", children: "Templates" }),
|
|
3191
3191
|
/* @__PURE__ */ e("p", { className: "text-gray-600 dark:text-zinc-400", children: "Start with a pre-built workflow. Click any template to load it into the editor." })
|
|
3192
3192
|
] }),
|
|
3193
|
-
/* @__PURE__ */
|
|
3193
|
+
/* @__PURE__ */ n("div", { className: "flex flex-wrap gap-4 mb-6", children: [
|
|
3194
3194
|
/* @__PURE__ */ e(
|
|
3195
3195
|
"input",
|
|
3196
3196
|
{
|
|
3197
3197
|
type: "text",
|
|
3198
3198
|
placeholder: "Search templates...",
|
|
3199
|
-
value:
|
|
3199
|
+
value: o,
|
|
3200
3200
|
onChange: (d) => i(d.target.value),
|
|
3201
3201
|
className: "px-4 py-2 border border-gray-300 dark:border-zinc-600 rounded-lg bg-white dark:bg-zinc-800 text-gray-900 dark:text-white focus:ring-2 focus:ring-teal-500 focus:border-transparent w-64"
|
|
3202
3202
|
}
|
|
3203
3203
|
),
|
|
3204
|
-
/* @__PURE__ */
|
|
3204
|
+
/* @__PURE__ */ n("div", { className: "flex gap-2 flex-wrap", children: [
|
|
3205
3205
|
/* @__PURE__ */ e(
|
|
3206
3206
|
"button",
|
|
3207
3207
|
{
|
|
@@ -3232,13 +3232,13 @@ function Lt({ onSelect: r }) {
|
|
|
3232
3232
|
] });
|
|
3233
3233
|
}
|
|
3234
3234
|
function Wt({ template: r, onSelect: l }) {
|
|
3235
|
-
const t = r.workflow.nodes.length,
|
|
3235
|
+
const t = r.workflow.nodes.length, o = r.workflow.edges.length, i = {
|
|
3236
3236
|
quickchart: "bg-blue-100 text-blue-800 dark:bg-blue-900/30 dark:text-blue-300",
|
|
3237
3237
|
mermaid: "bg-pink-100 text-pink-800 dark:bg-pink-900/30 dark:text-pink-300",
|
|
3238
3238
|
qr: "bg-green-100 text-green-800 dark:bg-green-900/30 dark:text-green-300",
|
|
3239
3239
|
d3: "bg-orange-100 text-orange-800 dark:bg-orange-900/30 dark:text-orange-300"
|
|
3240
3240
|
};
|
|
3241
|
-
return /* @__PURE__ */
|
|
3241
|
+
return /* @__PURE__ */ n("div", { className: "bg-white dark:bg-zinc-800 rounded-lg border border-gray-200 dark:border-zinc-700 overflow-hidden hover:shadow-lg transition-shadow", children: [
|
|
3242
3242
|
/* @__PURE__ */ e("div", { className: "aspect-video bg-gray-100 dark:bg-zinc-900 flex items-center justify-center p-4", children: r.preview ? /* @__PURE__ */ e(
|
|
3243
3243
|
"img",
|
|
3244
3244
|
{
|
|
@@ -3246,7 +3246,7 @@ function Wt({ template: r, onSelect: l }) {
|
|
|
3246
3246
|
alt: r.name,
|
|
3247
3247
|
className: "max-w-full max-h-full object-contain"
|
|
3248
3248
|
}
|
|
3249
|
-
) : /* @__PURE__ */
|
|
3249
|
+
) : /* @__PURE__ */ n("div", { className: "text-center text-gray-400 dark:text-zinc-500", children: [
|
|
3250
3250
|
/* @__PURE__ */ e(
|
|
3251
3251
|
"svg",
|
|
3252
3252
|
{
|
|
@@ -3267,8 +3267,8 @@ function Wt({ template: r, onSelect: l }) {
|
|
|
3267
3267
|
),
|
|
3268
3268
|
/* @__PURE__ */ e("span", { className: "text-sm", children: "No preview" })
|
|
3269
3269
|
] }) }),
|
|
3270
|
-
/* @__PURE__ */
|
|
3271
|
-
/* @__PURE__ */
|
|
3270
|
+
/* @__PURE__ */ n("div", { className: "p-4", children: [
|
|
3271
|
+
/* @__PURE__ */ n("div", { className: "flex items-start justify-between mb-2", children: [
|
|
3272
3272
|
/* @__PURE__ */ e("h3", { className: "text-lg font-semibold text-gray-900 dark:text-white", children: r.name }),
|
|
3273
3273
|
/* @__PURE__ */ e(
|
|
3274
3274
|
"span",
|
|
@@ -3279,8 +3279,8 @@ function Wt({ template: r, onSelect: l }) {
|
|
|
3279
3279
|
)
|
|
3280
3280
|
] }),
|
|
3281
3281
|
/* @__PURE__ */ e("p", { className: "text-sm text-gray-600 dark:text-zinc-400 mb-3", children: r.description }),
|
|
3282
|
-
/* @__PURE__ */
|
|
3283
|
-
/* @__PURE__ */
|
|
3282
|
+
/* @__PURE__ */ n("div", { className: "flex items-center gap-4 text-xs text-gray-500 dark:text-zinc-500 mb-4", children: [
|
|
3283
|
+
/* @__PURE__ */ n("span", { className: "flex items-center gap-1", children: [
|
|
3284
3284
|
/* @__PURE__ */ e("svg", { className: "w-4 h-4", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ e(
|
|
3285
3285
|
"path",
|
|
3286
3286
|
{
|
|
@@ -3294,7 +3294,7 @@ function Wt({ template: r, onSelect: l }) {
|
|
|
3294
3294
|
" node",
|
|
3295
3295
|
t !== 1 ? "s" : ""
|
|
3296
3296
|
] }),
|
|
3297
|
-
|
|
3297
|
+
o > 0 && /* @__PURE__ */ n("span", { className: "flex items-center gap-1", children: [
|
|
3298
3298
|
/* @__PURE__ */ e("svg", { className: "w-4 h-4", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ e(
|
|
3299
3299
|
"path",
|
|
3300
3300
|
{
|
|
@@ -3304,9 +3304,9 @@ function Wt({ template: r, onSelect: l }) {
|
|
|
3304
3304
|
d: "M13 7l5 5m0 0l-5 5m5-5H6"
|
|
3305
3305
|
}
|
|
3306
3306
|
) }),
|
|
3307
|
-
|
|
3307
|
+
o,
|
|
3308
3308
|
" edge",
|
|
3309
|
-
|
|
3309
|
+
o !== 1 ? "s" : ""
|
|
3310
3310
|
] })
|
|
3311
3311
|
] }),
|
|
3312
3312
|
r.tags && r.tags.length > 0 && /* @__PURE__ */ e("div", { className: "flex flex-wrap gap-1 mb-4", children: r.tags.slice(0, 4).map((s) => /* @__PURE__ */ e(
|
|
@@ -3332,23 +3332,23 @@ function At({
|
|
|
3332
3332
|
workflow: r,
|
|
3333
3333
|
isActive: l,
|
|
3334
3334
|
onLoad: t,
|
|
3335
|
-
onDelete:
|
|
3335
|
+
onDelete: o,
|
|
3336
3336
|
onRename: i,
|
|
3337
3337
|
onDuplicate: s
|
|
3338
3338
|
}) {
|
|
3339
|
-
const [p, d] =
|
|
3339
|
+
const [p, d] = C(!1), [a, m] = C(r.name), [c, u] = C(!1), h = () => {
|
|
3340
3340
|
a.trim() && a !== r.name && i(a.trim()), d(!1);
|
|
3341
|
-
},
|
|
3342
|
-
const v = new Date(y),
|
|
3343
|
-
return g < 1 ? "Just now" : g < 60 ? `${g}m ago` :
|
|
3341
|
+
}, b = (y) => {
|
|
3342
|
+
const v = new Date(y), x = (/* @__PURE__ */ new Date()).getTime() - v.getTime(), g = Math.floor(x / 6e4), N = Math.floor(x / 36e5), A = Math.floor(x / 864e5);
|
|
3343
|
+
return g < 1 ? "Just now" : g < 60 ? `${g}m ago` : N < 24 ? `${N}h ago` : A < 7 ? `${A}d ago` : v.toLocaleDateString();
|
|
3344
3344
|
};
|
|
3345
|
-
return /* @__PURE__ */
|
|
3345
|
+
return /* @__PURE__ */ n(
|
|
3346
3346
|
"div",
|
|
3347
3347
|
{
|
|
3348
3348
|
className: `group relative p-3 rounded-lg border transition-colors ${l ? "bg-teal-50 dark:bg-teal-900/20 border-teal-200 dark:border-teal-800" : "bg-white dark:bg-zinc-800 border-zinc-200 dark:border-zinc-700 hover:border-zinc-300 dark:hover:border-zinc-600"}`,
|
|
3349
3349
|
children: [
|
|
3350
|
-
/* @__PURE__ */
|
|
3351
|
-
/* @__PURE__ */
|
|
3350
|
+
/* @__PURE__ */ n("div", { className: "flex items-start justify-between gap-2", children: [
|
|
3351
|
+
/* @__PURE__ */ n("button", { onClick: t, className: "flex-1 text-left min-w-0", children: [
|
|
3352
3352
|
p ? /* @__PURE__ */ e(
|
|
3353
3353
|
"input",
|
|
3354
3354
|
{
|
|
@@ -3364,13 +3364,13 @@ function At({
|
|
|
3364
3364
|
onClick: (y) => y.stopPropagation()
|
|
3365
3365
|
}
|
|
3366
3366
|
) : /* @__PURE__ */ e("span", { className: "block text-sm font-medium text-zinc-900 dark:text-zinc-100 truncate", children: r.name }),
|
|
3367
|
-
/* @__PURE__ */
|
|
3367
|
+
/* @__PURE__ */ n("span", { className: "block text-xs text-zinc-500 dark:text-zinc-400 mt-0.5", children: [
|
|
3368
3368
|
r.nodes.length,
|
|
3369
3369
|
" nodes · Updated ",
|
|
3370
|
-
|
|
3370
|
+
b(r.updatedAt)
|
|
3371
3371
|
] })
|
|
3372
3372
|
] }),
|
|
3373
|
-
/* @__PURE__ */
|
|
3373
|
+
/* @__PURE__ */ n("div", { className: "relative", children: [
|
|
3374
3374
|
/* @__PURE__ */ e(
|
|
3375
3375
|
"button",
|
|
3376
3376
|
{
|
|
@@ -3381,9 +3381,9 @@ function At({
|
|
|
3381
3381
|
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" }) })
|
|
3382
3382
|
}
|
|
3383
3383
|
),
|
|
3384
|
-
c && /* @__PURE__ */
|
|
3384
|
+
c && /* @__PURE__ */ n(B, { children: [
|
|
3385
3385
|
/* @__PURE__ */ e("div", { className: "fixed inset-0 z-10", onClick: () => u(!1) }),
|
|
3386
|
-
/* @__PURE__ */
|
|
3386
|
+
/* @__PURE__ */ n("div", { className: "absolute right-0 top-full mt-1 w-36 bg-white dark:bg-zinc-800 rounded-lg shadow-lg border border-zinc-200 dark:border-zinc-700 py-1 z-20", children: [
|
|
3387
3387
|
/* @__PURE__ */ e(
|
|
3388
3388
|
"button",
|
|
3389
3389
|
{
|
|
@@ -3408,7 +3408,7 @@ function At({
|
|
|
3408
3408
|
"button",
|
|
3409
3409
|
{
|
|
3410
3410
|
onClick: (y) => {
|
|
3411
|
-
y.stopPropagation(), window.confirm("Delete this workflow?") &&
|
|
3411
|
+
y.stopPropagation(), window.confirm("Delete this workflow?") && o(), u(!1);
|
|
3412
3412
|
},
|
|
3413
3413
|
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",
|
|
3414
3414
|
children: "Delete"
|
|
@@ -3424,13 +3424,13 @@ function At({
|
|
|
3424
3424
|
);
|
|
3425
3425
|
}
|
|
3426
3426
|
function Pt() {
|
|
3427
|
-
const r =
|
|
3427
|
+
const r = f((c) => c.showLibrary), l = f((c) => c.toggleLibrary), t = f((c) => c.savedWorkflows), o = f((c) => c.activeWorkflowId), i = f((c) => c.loadWorkflow), s = f((c) => c.deleteWorkflow), p = f((c) => c.renameWorkflow), d = f((c) => c.duplicateWorkflow), a = f((c) => c.newWorkflow);
|
|
3428
3428
|
if (!r) return null;
|
|
3429
3429
|
const m = [...t].sort((c, u) => u.updatedAt - c.updatedAt);
|
|
3430
|
-
return /* @__PURE__ */
|
|
3430
|
+
return /* @__PURE__ */ n(B, { children: [
|
|
3431
3431
|
/* @__PURE__ */ e("div", { className: "fixed inset-0 bg-black/20 dark:bg-black/40 z-40", onClick: l }),
|
|
3432
|
-
/* @__PURE__ */
|
|
3433
|
-
/* @__PURE__ */
|
|
3432
|
+
/* @__PURE__ */ n("div", { className: "fixed left-0 top-0 bottom-0 w-80 bg-zinc-50 dark:bg-zinc-900 border-r border-zinc-200 dark:border-zinc-700 z-50 flex flex-col shadow-xl", children: [
|
|
3433
|
+
/* @__PURE__ */ n("div", { className: "flex items-center justify-between px-4 py-3 border-b border-zinc-200 dark:border-zinc-700", children: [
|
|
3434
3434
|
/* @__PURE__ */ e("h2", { className: "text-lg font-semibold text-zinc-900 dark:text-zinc-100", children: "My Workflows" }),
|
|
3435
3435
|
/* @__PURE__ */ e(
|
|
3436
3436
|
"button",
|
|
@@ -3449,7 +3449,7 @@ function Pt() {
|
|
|
3449
3449
|
}
|
|
3450
3450
|
)
|
|
3451
3451
|
] }),
|
|
3452
|
-
/* @__PURE__ */ e("div", { className: "p-4 border-b border-zinc-200 dark:border-zinc-700", children: /* @__PURE__ */
|
|
3452
|
+
/* @__PURE__ */ e("div", { className: "p-4 border-b border-zinc-200 dark:border-zinc-700", children: /* @__PURE__ */ n(
|
|
3453
3453
|
"button",
|
|
3454
3454
|
{
|
|
3455
3455
|
onClick: () => {
|
|
@@ -3470,7 +3470,7 @@ function Pt() {
|
|
|
3470
3470
|
]
|
|
3471
3471
|
}
|
|
3472
3472
|
) }),
|
|
3473
|
-
/* @__PURE__ */ e("div", { className: "flex-1 overflow-y-auto p-4", children: m.length === 0 ? /* @__PURE__ */
|
|
3473
|
+
/* @__PURE__ */ e("div", { className: "flex-1 overflow-y-auto p-4", children: m.length === 0 ? /* @__PURE__ */ n("div", { className: "text-center py-8", children: [
|
|
3474
3474
|
/* @__PURE__ */ e("div", { className: "w-12 h-12 mx-auto mb-3 rounded-full bg-zinc-200 dark:bg-zinc-700 flex items-center justify-center", children: /* @__PURE__ */ e(
|
|
3475
3475
|
"svg",
|
|
3476
3476
|
{
|
|
@@ -3495,7 +3495,7 @@ function Pt() {
|
|
|
3495
3495
|
At,
|
|
3496
3496
|
{
|
|
3497
3497
|
workflow: c,
|
|
3498
|
-
isActive: c.id ===
|
|
3498
|
+
isActive: c.id === o,
|
|
3499
3499
|
onLoad: () => {
|
|
3500
3500
|
i(c.id), l();
|
|
3501
3501
|
},
|
|
@@ -3505,7 +3505,7 @@ function Pt() {
|
|
|
3505
3505
|
},
|
|
3506
3506
|
c.id
|
|
3507
3507
|
)) }) }),
|
|
3508
|
-
/* @__PURE__ */
|
|
3508
|
+
/* @__PURE__ */ n("div", { className: "px-4 py-3 border-t border-zinc-200 dark:border-zinc-700 text-xs text-zinc-500 dark:text-zinc-400", children: [
|
|
3509
3509
|
t.length,
|
|
3510
3510
|
" workflow",
|
|
3511
3511
|
t.length !== 1 ? "s" : "",
|
|
@@ -3550,7 +3550,7 @@ const $t = [
|
|
|
3550
3550
|
placeholder: "sk-or-...",
|
|
3551
3551
|
docsUrl: "https://openrouter.ai/keys"
|
|
3552
3552
|
}
|
|
3553
|
-
],
|
|
3553
|
+
], jt = [
|
|
3554
3554
|
{
|
|
3555
3555
|
id: "ollama",
|
|
3556
3556
|
name: "Ollama",
|
|
@@ -3566,8 +3566,8 @@ const $t = [
|
|
|
3566
3566
|
docsUrl: "https://lmstudio.ai"
|
|
3567
3567
|
}
|
|
3568
3568
|
];
|
|
3569
|
-
function
|
|
3570
|
-
const l =
|
|
3569
|
+
function Mt({ provider: r }) {
|
|
3570
|
+
const l = V((h) => h.ai), t = V((h) => h.setAIProvider), o = l[r.id], i = (o == null ? void 0 : o.enabled) ?? !1, s = (o == null ? void 0 : o.apiKey) ?? "", [p, d] = C(s), [a, m] = C(!1), c = () => {
|
|
3571
3571
|
t(r.id, {
|
|
3572
3572
|
apiKey: p,
|
|
3573
3573
|
enabled: !i
|
|
@@ -3578,9 +3578,9 @@ function jt({ provider: r }) {
|
|
|
3578
3578
|
enabled: i
|
|
3579
3579
|
});
|
|
3580
3580
|
};
|
|
3581
|
-
return /* @__PURE__ */
|
|
3582
|
-
/* @__PURE__ */
|
|
3583
|
-
/* @__PURE__ */
|
|
3581
|
+
return /* @__PURE__ */ n("div", { className: "flex items-start gap-4 p-4 border border-gray-200 dark:border-zinc-700 rounded-lg", children: [
|
|
3582
|
+
/* @__PURE__ */ n("div", { className: "flex-1 min-w-0", children: [
|
|
3583
|
+
/* @__PURE__ */ n("div", { className: "flex items-center gap-2", children: [
|
|
3584
3584
|
/* @__PURE__ */ e("span", { className: "font-medium text-gray-900 dark:text-white", children: r.name }),
|
|
3585
3585
|
/* @__PURE__ */ e(
|
|
3586
3586
|
"a",
|
|
@@ -3594,7 +3594,7 @@ function jt({ provider: r }) {
|
|
|
3594
3594
|
)
|
|
3595
3595
|
] }),
|
|
3596
3596
|
/* @__PURE__ */ e("p", { className: "text-sm text-gray-500 dark:text-zinc-400 mt-0.5", children: r.description }),
|
|
3597
|
-
/* @__PURE__ */ e("div", { className: "mt-2 flex items-center gap-2", children: /* @__PURE__ */
|
|
3597
|
+
/* @__PURE__ */ e("div", { className: "mt-2 flex items-center gap-2", children: /* @__PURE__ */ n("div", { className: "relative flex-1", children: [
|
|
3598
3598
|
/* @__PURE__ */ e(
|
|
3599
3599
|
"input",
|
|
3600
3600
|
{
|
|
@@ -3648,7 +3648,7 @@ function jt({ provider: r }) {
|
|
|
3648
3648
|
] });
|
|
3649
3649
|
}
|
|
3650
3650
|
function Dt({ provider: r }) {
|
|
3651
|
-
const l =
|
|
3651
|
+
const l = V((c) => c.ai), t = V((c) => c.setAIProvider), o = l[r.id], i = (o == null ? void 0 : o.enabled) ?? !1, s = (o == null ? void 0 : o.baseUrl) ?? r.defaultUrl, [p, d] = C(s), a = () => {
|
|
3652
3652
|
t(r.id, {
|
|
3653
3653
|
baseUrl: p,
|
|
3654
3654
|
enabled: !i
|
|
@@ -3659,9 +3659,9 @@ function Dt({ provider: r }) {
|
|
|
3659
3659
|
enabled: i
|
|
3660
3660
|
});
|
|
3661
3661
|
};
|
|
3662
|
-
return /* @__PURE__ */
|
|
3663
|
-
/* @__PURE__ */
|
|
3664
|
-
/* @__PURE__ */
|
|
3662
|
+
return /* @__PURE__ */ n("div", { className: "flex items-start gap-4 p-4 border border-gray-200 dark:border-zinc-700 rounded-lg", children: [
|
|
3663
|
+
/* @__PURE__ */ n("div", { className: "flex-1 min-w-0", children: [
|
|
3664
|
+
/* @__PURE__ */ n("div", { className: "flex items-center gap-2", children: [
|
|
3665
3665
|
/* @__PURE__ */ e("span", { className: "font-medium text-gray-900 dark:text-white", children: r.name }),
|
|
3666
3666
|
/* @__PURE__ */ e(
|
|
3667
3667
|
"a",
|
|
@@ -3703,10 +3703,10 @@ function Dt({ provider: r }) {
|
|
|
3703
3703
|
] });
|
|
3704
3704
|
}
|
|
3705
3705
|
function Tt() {
|
|
3706
|
-
const r =
|
|
3707
|
-
return r ? /* @__PURE__ */ e("div", { className: "fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50", children: /* @__PURE__ */
|
|
3708
|
-
/* @__PURE__ */
|
|
3709
|
-
/* @__PURE__ */
|
|
3706
|
+
const r = V((t) => t.showSettings), l = V((t) => t.closeSettings);
|
|
3707
|
+
return r ? /* @__PURE__ */ e("div", { className: "fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50", children: /* @__PURE__ */ n("div", { className: "bg-white dark:bg-zinc-800 rounded-lg shadow-xl max-w-xl w-full mx-4 max-h-[85vh] flex flex-col", children: [
|
|
3708
|
+
/* @__PURE__ */ n("div", { className: "flex items-center justify-between px-6 py-4 border-b border-gray-200 dark:border-zinc-700", children: [
|
|
3709
|
+
/* @__PURE__ */ n("div", { children: [
|
|
3710
3710
|
/* @__PURE__ */ e("h2", { className: "text-lg font-semibold text-gray-900 dark:text-white", children: "AI Provider Settings" }),
|
|
3711
3711
|
/* @__PURE__ */ e("p", { className: "text-sm text-gray-500 dark:text-zinc-400 mt-0.5", children: "Configure your AI providers for vision and text generation" })
|
|
3712
3712
|
] }),
|
|
@@ -3727,16 +3727,16 @@ function Tt() {
|
|
|
3727
3727
|
}
|
|
3728
3728
|
)
|
|
3729
3729
|
] }),
|
|
3730
|
-
/* @__PURE__ */
|
|
3731
|
-
/* @__PURE__ */
|
|
3730
|
+
/* @__PURE__ */ n("div", { className: "flex-1 overflow-y-auto p-6 space-y-6", children: [
|
|
3731
|
+
/* @__PURE__ */ n("section", { children: [
|
|
3732
3732
|
/* @__PURE__ */ e("h3", { className: "text-sm font-medium text-gray-700 dark:text-zinc-300 mb-3", children: "Cloud Providers" }),
|
|
3733
|
-
/* @__PURE__ */ e("div", { className: "space-y-3", children: $t.map((t) => /* @__PURE__ */ e(
|
|
3733
|
+
/* @__PURE__ */ e("div", { className: "space-y-3", children: $t.map((t) => /* @__PURE__ */ e(Mt, { provider: t }, t.id)) })
|
|
3734
3734
|
] }),
|
|
3735
|
-
/* @__PURE__ */
|
|
3735
|
+
/* @__PURE__ */ n("section", { children: [
|
|
3736
3736
|
/* @__PURE__ */ e("h3", { className: "text-sm font-medium text-gray-700 dark:text-zinc-300 mb-3", children: "Local Providers" }),
|
|
3737
|
-
/* @__PURE__ */ e("div", { className: "space-y-3", children:
|
|
3737
|
+
/* @__PURE__ */ e("div", { className: "space-y-3", children: jt.map((t) => /* @__PURE__ */ e(Dt, { provider: t }, t.id)) })
|
|
3738
3738
|
] }),
|
|
3739
|
-
/* @__PURE__ */ e("div", { className: "bg-blue-50 dark:bg-blue-900/20 border border-blue-200 dark:border-blue-800 rounded-lg p-4", children: /* @__PURE__ */
|
|
3739
|
+
/* @__PURE__ */ e("div", { className: "bg-blue-50 dark:bg-blue-900/20 border border-blue-200 dark:border-blue-800 rounded-lg p-4", children: /* @__PURE__ */ n("div", { className: "flex items-start gap-3", children: [
|
|
3740
3740
|
/* @__PURE__ */ e(
|
|
3741
3741
|
"svg",
|
|
3742
3742
|
{
|
|
@@ -3755,7 +3755,7 @@ function Tt() {
|
|
|
3755
3755
|
)
|
|
3756
3756
|
}
|
|
3757
3757
|
),
|
|
3758
|
-
/* @__PURE__ */
|
|
3758
|
+
/* @__PURE__ */ n("div", { children: [
|
|
3759
3759
|
/* @__PURE__ */ e("p", { className: "text-sm font-medium text-blue-900 dark:text-blue-300", children: "Your keys stay local" }),
|
|
3760
3760
|
/* @__PURE__ */ e("p", { className: "text-sm text-blue-700 dark:text-blue-400 mt-1", children: "API keys are stored in your browser only and sent directly to providers. They never pass through our servers." })
|
|
3761
3761
|
] })
|
|
@@ -3772,54 +3772,54 @@ function Tt() {
|
|
|
3772
3772
|
] }) }) : null;
|
|
3773
3773
|
}
|
|
3774
3774
|
function Ut({ isOpen: r, onClose: l, onApplyWorkflow: t }) {
|
|
3775
|
-
const [
|
|
3776
|
-
|
|
3777
|
-
r && u === null && qe().then((
|
|
3778
|
-
h(
|
|
3775
|
+
const [o, i] = C([]), [s, p] = C(""), [d, a] = C(!1), [m, c] = C(null), [u, h] = C(null), [b, y] = C(""), [v, w] = C(), [x, g] = C(!1), [N, A] = C(), k = te(null), L = te(null);
|
|
3776
|
+
U(() => {
|
|
3777
|
+
r && u === null && qe().then((I) => {
|
|
3778
|
+
h(I.available), y(I.message), w(I.reason), g(I.isCloudDeployment ?? !1), A(I.supportUrl);
|
|
3779
3779
|
}).catch(() => {
|
|
3780
|
-
h(!1), y("Failed to check AI availability");
|
|
3780
|
+
h(!1), y("Failed to check AI availability"), w("service_unavailable");
|
|
3781
3781
|
});
|
|
3782
|
-
}, [r, u]),
|
|
3783
|
-
r &&
|
|
3784
|
-
}, [r]),
|
|
3785
|
-
var
|
|
3786
|
-
(
|
|
3787
|
-
}, [
|
|
3788
|
-
const
|
|
3782
|
+
}, [r, u]), U(() => {
|
|
3783
|
+
r && L.current && L.current.focus();
|
|
3784
|
+
}, [r]), U(() => {
|
|
3785
|
+
var I;
|
|
3786
|
+
(I = k.current) == null || I.scrollIntoView({ behavior: "smooth" });
|
|
3787
|
+
}, [o]);
|
|
3788
|
+
const S = W(async () => {
|
|
3789
3789
|
if (!s.trim() || d) return;
|
|
3790
|
-
const
|
|
3790
|
+
const I = {
|
|
3791
3791
|
role: "user",
|
|
3792
3792
|
content: s.trim(),
|
|
3793
3793
|
timestamp: Date.now()
|
|
3794
3794
|
};
|
|
3795
|
-
i((
|
|
3795
|
+
i((M) => [...M, I]), p(""), a(!0), c(null);
|
|
3796
3796
|
try {
|
|
3797
|
-
const
|
|
3798
|
-
prompt:
|
|
3799
|
-
history:
|
|
3800
|
-
}),
|
|
3797
|
+
const M = await Ke({
|
|
3798
|
+
prompt: I.content,
|
|
3799
|
+
history: o
|
|
3800
|
+
}), E = {
|
|
3801
3801
|
role: "assistant",
|
|
3802
|
-
content:
|
|
3803
|
-
workflow:
|
|
3802
|
+
content: M.message,
|
|
3803
|
+
workflow: M.workflow,
|
|
3804
3804
|
timestamp: Date.now()
|
|
3805
3805
|
};
|
|
3806
|
-
i((
|
|
3807
|
-
} catch (
|
|
3808
|
-
c(
|
|
3806
|
+
i((O) => [...O, E]), !M.success && M.error && c(M.error);
|
|
3807
|
+
} catch (M) {
|
|
3808
|
+
c(M instanceof Error ? M.message : "Failed to generate workflow");
|
|
3809
3809
|
} finally {
|
|
3810
3810
|
a(!1);
|
|
3811
3811
|
}
|
|
3812
|
-
}, [s, d,
|
|
3813
|
-
|
|
3814
|
-
},
|
|
3815
|
-
t(
|
|
3816
|
-
},
|
|
3812
|
+
}, [s, d, o]), R = (I) => {
|
|
3813
|
+
I.key === "Enter" && !I.shiftKey && (I.preventDefault(), S());
|
|
3814
|
+
}, J = (I) => {
|
|
3815
|
+
t(I), l();
|
|
3816
|
+
}, Y = () => {
|
|
3817
3817
|
i([]), c(null);
|
|
3818
3818
|
};
|
|
3819
|
-
return r ? /* @__PURE__ */ e("div", { className: "fixed inset-0 bg-black/50 flex items-center justify-center z-50", children: /* @__PURE__ */
|
|
3820
|
-
/* @__PURE__ */
|
|
3821
|
-
/* @__PURE__ */
|
|
3822
|
-
/* @__PURE__ */
|
|
3819
|
+
return r ? /* @__PURE__ */ e("div", { className: "fixed inset-0 bg-black/50 flex items-center justify-center z-50", children: /* @__PURE__ */ n("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: [
|
|
3820
|
+
/* @__PURE__ */ n("div", { className: "flex items-center justify-between px-4 py-3 border-b border-gray-200 dark:border-zinc-700", children: [
|
|
3821
|
+
/* @__PURE__ */ n("div", { className: "flex items-center gap-3", children: [
|
|
3822
|
+
/* @__PURE__ */ n("div", { className: "flex items-center gap-2", children: [
|
|
3823
3823
|
/* @__PURE__ */ e(
|
|
3824
3824
|
"svg",
|
|
3825
3825
|
{
|
|
@@ -3842,11 +3842,11 @@ function Ut({ isOpen: r, onClose: l, onApplyWorkflow: t }) {
|
|
|
3842
3842
|
] }),
|
|
3843
3843
|
/* @__PURE__ */ e("span", { className: "text-xs bg-teal-100 dark:bg-teal-900 text-teal-700 dark:text-teal-300 px-2 py-0.5 rounded", children: "Gemini 3 Pro" })
|
|
3844
3844
|
] }),
|
|
3845
|
-
/* @__PURE__ */
|
|
3846
|
-
|
|
3845
|
+
/* @__PURE__ */ n("div", { className: "flex items-center gap-2", children: [
|
|
3846
|
+
o.length > 0 && /* @__PURE__ */ e(
|
|
3847
3847
|
"button",
|
|
3848
3848
|
{
|
|
3849
|
-
onClick:
|
|
3849
|
+
onClick: Y,
|
|
3850
3850
|
className: "p-2 text-gray-500 dark:text-zinc-400 hover:text-gray-700 dark:hover:text-zinc-200 hover:bg-gray-100 dark:hover:bg-zinc-700 rounded",
|
|
3851
3851
|
title: "New Chat",
|
|
3852
3852
|
children: /* @__PURE__ */ e("svg", { className: "h-5 w-5", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ e(
|
|
@@ -3878,9 +3878,26 @@ function Ut({ isOpen: r, onClose: l, onApplyWorkflow: t }) {
|
|
|
3878
3878
|
)
|
|
3879
3879
|
] })
|
|
3880
3880
|
] }),
|
|
3881
|
-
/* @__PURE__ */
|
|
3882
|
-
u === !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__ */
|
|
3883
|
-
/* @__PURE__ */ e(
|
|
3881
|
+
/* @__PURE__ */ n("div", { className: "flex-1 overflow-auto p-4 space-y-4", children: [
|
|
3882
|
+
u === !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__ */ n("div", { className: "flex items-start gap-3", children: [
|
|
3883
|
+
v === "tier_limit" ? /* @__PURE__ */ e(
|
|
3884
|
+
"svg",
|
|
3885
|
+
{
|
|
3886
|
+
className: "h-5 w-5 text-amber-600 dark:text-amber-400 mt-0.5",
|
|
3887
|
+
fill: "none",
|
|
3888
|
+
viewBox: "0 0 24 24",
|
|
3889
|
+
stroke: "currentColor",
|
|
3890
|
+
children: /* @__PURE__ */ e(
|
|
3891
|
+
"path",
|
|
3892
|
+
{
|
|
3893
|
+
strokeLinecap: "round",
|
|
3894
|
+
strokeLinejoin: "round",
|
|
3895
|
+
strokeWidth: 2,
|
|
3896
|
+
d: "M12 15v2m-6 4h12a2 2 0 002-2v-6a2 2 0 00-2-2H6a2 2 0 00-2 2v6a2 2 0 002 2zm10-10V7a4 4 0 00-8 0v4h8z"
|
|
3897
|
+
}
|
|
3898
|
+
)
|
|
3899
|
+
}
|
|
3900
|
+
) : /* @__PURE__ */ e(
|
|
3884
3901
|
"svg",
|
|
3885
3902
|
{
|
|
3886
3903
|
className: "h-5 w-5 text-amber-600 dark:text-amber-400 mt-0.5",
|
|
@@ -3898,13 +3915,40 @@ function Ut({ isOpen: r, onClose: l, onApplyWorkflow: t }) {
|
|
|
3898
3915
|
)
|
|
3899
3916
|
}
|
|
3900
3917
|
),
|
|
3901
|
-
/* @__PURE__ */
|
|
3902
|
-
/* @__PURE__ */ e("p", { className: "font-medium text-amber-800 dark:text-amber-200", children: "AI Generation Not Available" }),
|
|
3903
|
-
/* @__PURE__ */ e("p", { className: "text-sm text-amber-700 dark:text-amber-300 mt-1", children:
|
|
3904
|
-
/* @__PURE__ */
|
|
3918
|
+
/* @__PURE__ */ n("div", { children: [
|
|
3919
|
+
/* @__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" }),
|
|
3920
|
+
/* @__PURE__ */ e("p", { className: "text-sm text-amber-700 dark:text-amber-300 mt-1", children: b }),
|
|
3921
|
+
/* @__PURE__ */ n("div", { className: "flex flex-col sm:flex-row gap-2 mt-3", children: [
|
|
3922
|
+
v === "tier_limit" && /* @__PURE__ */ e(
|
|
3923
|
+
"a",
|
|
3924
|
+
{
|
|
3925
|
+
href: "/pricing",
|
|
3926
|
+
className: "text-sm font-medium text-teal-600 hover:text-teal-700 dark:text-teal-400 dark:hover:text-teal-300",
|
|
3927
|
+
children: "View Plans"
|
|
3928
|
+
}
|
|
3929
|
+
),
|
|
3930
|
+
v === "service_unavailable" && N && /* @__PURE__ */ e(
|
|
3931
|
+
"a",
|
|
3932
|
+
{
|
|
3933
|
+
href: N,
|
|
3934
|
+
className: "text-sm font-medium text-amber-700 hover:text-amber-800 dark:text-amber-400 dark:hover:text-amber-300",
|
|
3935
|
+
children: "Contact Support"
|
|
3936
|
+
}
|
|
3937
|
+
),
|
|
3938
|
+
v === "not_configured" && !x && /* @__PURE__ */ e(
|
|
3939
|
+
"a",
|
|
3940
|
+
{
|
|
3941
|
+
href: "https://floimg.com/docs/studio/ai-workflows",
|
|
3942
|
+
target: "_blank",
|
|
3943
|
+
rel: "noopener noreferrer",
|
|
3944
|
+
className: "text-sm font-medium text-teal-600 hover:text-teal-700 dark:text-teal-400 dark:hover:text-teal-300",
|
|
3945
|
+
children: "View Setup Guide"
|
|
3946
|
+
}
|
|
3947
|
+
)
|
|
3948
|
+
] })
|
|
3905
3949
|
] })
|
|
3906
3950
|
] }) }),
|
|
3907
|
-
|
|
3951
|
+
o.length === 0 && u !== !1 && /* @__PURE__ */ n("div", { className: "text-center py-8", children: [
|
|
3908
3952
|
/* @__PURE__ */ e("div", { className: "inline-flex items-center justify-center w-16 h-16 bg-teal-100 dark:bg-teal-900/50 rounded-full mb-4", children: /* @__PURE__ */ e(
|
|
3909
3953
|
"svg",
|
|
3910
3954
|
{
|
|
@@ -3931,62 +3975,62 @@ function Ut({ isOpen: r, onClose: l, onApplyWorkflow: t }) {
|
|
|
3931
3975
|
"Generate an image with Gemini, then use it as a reference to create a variation with different lighting",
|
|
3932
3976
|
"Create a product mockup: generate a minimalist logo, then composite it onto a t-shirt image",
|
|
3933
3977
|
"Build an AI art pipeline: generate a base image, apply artistic style transfer, then upscale to 4K"
|
|
3934
|
-
].map((
|
|
3978
|
+
].map((I, M) => /* @__PURE__ */ n(
|
|
3935
3979
|
"button",
|
|
3936
3980
|
{
|
|
3937
|
-
onClick: () => p(
|
|
3981
|
+
onClick: () => p(I),
|
|
3938
3982
|
className: "block w-full text-left text-sm px-4 py-2 bg-gray-100 dark:bg-zinc-700 hover:bg-gray-200 dark:hover:bg-zinc-600 rounded-lg text-gray-700 dark:text-zinc-300 transition-colors",
|
|
3939
3983
|
children: [
|
|
3940
3984
|
'"',
|
|
3941
|
-
|
|
3985
|
+
I,
|
|
3942
3986
|
'"'
|
|
3943
3987
|
]
|
|
3944
3988
|
},
|
|
3945
|
-
|
|
3989
|
+
M
|
|
3946
3990
|
)) })
|
|
3947
3991
|
] }),
|
|
3948
|
-
|
|
3992
|
+
o.map((I, M) => /* @__PURE__ */ e(
|
|
3949
3993
|
"div",
|
|
3950
3994
|
{
|
|
3951
|
-
className: `flex ${
|
|
3952
|
-
children: /* @__PURE__ */
|
|
3995
|
+
className: `flex ${I.role === "user" ? "justify-end" : "justify-start"}`,
|
|
3996
|
+
children: /* @__PURE__ */ n(
|
|
3953
3997
|
"div",
|
|
3954
3998
|
{
|
|
3955
|
-
className: `max-w-[80%] rounded-lg px-4 py-3 ${
|
|
3999
|
+
className: `max-w-[80%] rounded-lg px-4 py-3 ${I.role === "user" ? "bg-teal-600 text-white" : "bg-gray-100 dark:bg-zinc-700 text-gray-900 dark:text-white"}`,
|
|
3956
4000
|
children: [
|
|
3957
|
-
/* @__PURE__ */ e("p", { className: "text-sm whitespace-pre-wrap", children:
|
|
3958
|
-
|
|
3959
|
-
/* @__PURE__ */
|
|
4001
|
+
/* @__PURE__ */ e("p", { className: "text-sm whitespace-pre-wrap", children: I.content }),
|
|
4002
|
+
I.role === "assistant" && I.workflow && /* @__PURE__ */ n("div", { className: "mt-3 pt-3 border-t border-gray-200 dark:border-zinc-600", children: [
|
|
4003
|
+
/* @__PURE__ */ n("div", { className: "flex items-center justify-between mb-2", children: [
|
|
3960
4004
|
/* @__PURE__ */ e("span", { className: "text-xs font-medium text-gray-500 dark:text-zinc-400", children: "Generated Workflow" }),
|
|
3961
4005
|
/* @__PURE__ */ e(
|
|
3962
4006
|
"button",
|
|
3963
4007
|
{
|
|
3964
|
-
onClick: () =>
|
|
4008
|
+
onClick: () => J(I.workflow),
|
|
3965
4009
|
className: "text-xs px-3 py-1 bg-teal-600 hover:bg-teal-700 text-white rounded transition-colors",
|
|
3966
4010
|
children: "Apply to Canvas"
|
|
3967
4011
|
}
|
|
3968
4012
|
)
|
|
3969
4013
|
] }),
|
|
3970
|
-
/* @__PURE__ */ e("div", { className: "bg-white dark:bg-zinc-800 rounded p-2 text-xs", children: /* @__PURE__ */
|
|
3971
|
-
|
|
4014
|
+
/* @__PURE__ */ e("div", { className: "bg-white dark:bg-zinc-800 rounded p-2 text-xs", children: /* @__PURE__ */ n("div", { className: "space-y-1", children: [
|
|
4015
|
+
I.workflow.nodes.map((E, O) => /* @__PURE__ */ n(
|
|
3972
4016
|
"div",
|
|
3973
4017
|
{
|
|
3974
4018
|
className: "flex items-center gap-2 text-gray-600 dark:text-zinc-300",
|
|
3975
4019
|
children: [
|
|
3976
|
-
/* @__PURE__ */ e("span", { className: "font-mono bg-gray-100 dark:bg-zinc-700 px-1.5 py-0.5 rounded", children:
|
|
3977
|
-
|
|
4020
|
+
/* @__PURE__ */ e("span", { className: "font-mono bg-gray-100 dark:bg-zinc-700 px-1.5 py-0.5 rounded", children: E.nodeType.split(":").pop() }),
|
|
4021
|
+
E.label && /* @__PURE__ */ n("span", { className: "text-gray-400", children: [
|
|
3978
4022
|
"(",
|
|
3979
|
-
|
|
4023
|
+
E.label,
|
|
3980
4024
|
")"
|
|
3981
4025
|
] })
|
|
3982
4026
|
]
|
|
3983
4027
|
},
|
|
3984
|
-
|
|
4028
|
+
O
|
|
3985
4029
|
)),
|
|
3986
|
-
|
|
3987
|
-
|
|
4030
|
+
I.workflow.edges.length > 0 && /* @__PURE__ */ n("div", { className: "text-gray-400 dark:text-zinc-500 pt-1", children: [
|
|
4031
|
+
I.workflow.edges.length,
|
|
3988
4032
|
" connection",
|
|
3989
|
-
|
|
4033
|
+
I.workflow.edges.length !== 1 ? "s" : ""
|
|
3990
4034
|
] })
|
|
3991
4035
|
] }) })
|
|
3992
4036
|
] })
|
|
@@ -3994,10 +4038,10 @@ function Ut({ isOpen: r, onClose: l, onApplyWorkflow: t }) {
|
|
|
3994
4038
|
}
|
|
3995
4039
|
)
|
|
3996
4040
|
},
|
|
3997
|
-
|
|
4041
|
+
M
|
|
3998
4042
|
)),
|
|
3999
|
-
d && /* @__PURE__ */ e("div", { className: "flex justify-start", children: /* @__PURE__ */ e("div", { className: "bg-gray-100 dark:bg-zinc-700 rounded-lg px-4 py-3", children: /* @__PURE__ */
|
|
4000
|
-
/* @__PURE__ */
|
|
4043
|
+
d && /* @__PURE__ */ e("div", { className: "flex justify-start", children: /* @__PURE__ */ e("div", { className: "bg-gray-100 dark:bg-zinc-700 rounded-lg px-4 py-3", children: /* @__PURE__ */ n("div", { className: "flex items-center gap-2", children: [
|
|
4044
|
+
/* @__PURE__ */ n("div", { className: "flex space-x-1", children: [
|
|
4001
4045
|
/* @__PURE__ */ e("div", { className: "w-2 h-2 bg-gray-400 dark:bg-zinc-500 rounded-full animate-bounce" }),
|
|
4002
4046
|
/* @__PURE__ */ e(
|
|
4003
4047
|
"div",
|
|
@@ -4017,17 +4061,17 @@ function Ut({ isOpen: r, onClose: l, onApplyWorkflow: t }) {
|
|
|
4017
4061
|
/* @__PURE__ */ e("span", { className: "text-sm text-gray-500 dark:text-zinc-400", children: "Generating workflow..." })
|
|
4018
4062
|
] }) }) }),
|
|
4019
4063
|
m && /* @__PURE__ */ e("div", { className: "bg-red-50 dark:bg-red-900/30 border border-red-200 dark:border-red-800 rounded-lg p-3", children: /* @__PURE__ */ e("p", { className: "text-sm text-red-700 dark:text-red-300", children: m }) }),
|
|
4020
|
-
/* @__PURE__ */ e("div", { ref:
|
|
4064
|
+
/* @__PURE__ */ e("div", { ref: k })
|
|
4021
4065
|
] }),
|
|
4022
|
-
/* @__PURE__ */
|
|
4023
|
-
/* @__PURE__ */
|
|
4066
|
+
/* @__PURE__ */ n("div", { className: "border-t border-gray-200 dark:border-zinc-700 p-4", children: [
|
|
4067
|
+
/* @__PURE__ */ n("div", { className: "flex gap-2", children: [
|
|
4024
4068
|
/* @__PURE__ */ e(
|
|
4025
4069
|
"textarea",
|
|
4026
4070
|
{
|
|
4027
|
-
ref:
|
|
4071
|
+
ref: L,
|
|
4028
4072
|
value: s,
|
|
4029
|
-
onChange: (
|
|
4030
|
-
onKeyDown:
|
|
4073
|
+
onChange: (I) => p(I.target.value),
|
|
4074
|
+
onKeyDown: R,
|
|
4031
4075
|
placeholder: u === !1 ? "AI generation not available" : "Describe what workflow you want to create...",
|
|
4032
4076
|
disabled: d || u === !1,
|
|
4033
4077
|
rows: 2,
|
|
@@ -4037,7 +4081,7 @@ function Ut({ isOpen: r, onClose: l, onApplyWorkflow: t }) {
|
|
|
4037
4081
|
/* @__PURE__ */ e(
|
|
4038
4082
|
"button",
|
|
4039
4083
|
{
|
|
4040
|
-
onClick:
|
|
4084
|
+
onClick: S,
|
|
4041
4085
|
disabled: !s.trim() || d || u === !1,
|
|
4042
4086
|
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",
|
|
4043
4087
|
children: /* @__PURE__ */ e("svg", { className: "h-5 w-5", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ e(
|
|
@@ -4057,7 +4101,7 @@ function Ut({ isOpen: r, onClose: l, onApplyWorkflow: t }) {
|
|
|
4057
4101
|
] }) }) : null;
|
|
4058
4102
|
}
|
|
4059
4103
|
function Ot() {
|
|
4060
|
-
const { screenToFlowPosition: r } = Pe(), l =
|
|
4104
|
+
const { screenToFlowPosition: r } = Pe(), l = f((i) => i.addNode), t = W(
|
|
4061
4105
|
(i) => {
|
|
4062
4106
|
i.preventDefault();
|
|
4063
4107
|
const s = i.dataTransfer.getData("application/json");
|
|
@@ -4073,20 +4117,20 @@ function Ot() {
|
|
|
4073
4117
|
}
|
|
4074
4118
|
},
|
|
4075
4119
|
[l, r]
|
|
4076
|
-
),
|
|
4120
|
+
), o = W((i) => {
|
|
4077
4121
|
i.preventDefault(), i.dataTransfer.dropEffect = "move";
|
|
4078
4122
|
}, []);
|
|
4079
|
-
return /* @__PURE__ */ e("div", { className: "flex-1", onDrop: t, onDragOver:
|
|
4123
|
+
return /* @__PURE__ */ e("div", { className: "flex-1", onDrop: t, onDragOver: o, children: /* @__PURE__ */ e(ot, {}) });
|
|
4080
4124
|
}
|
|
4081
4125
|
function _t() {
|
|
4082
|
-
const [r, l] =
|
|
4083
|
-
|
|
4126
|
+
const [r, l] = C("editor"), [t, o] = C(!1), i = f((a) => a.loadTemplate), s = f((a) => a.loadGeneratedWorkflow);
|
|
4127
|
+
U(() => {
|
|
4084
4128
|
const m = new URLSearchParams(window.location.search).get("template");
|
|
4085
4129
|
if (m) {
|
|
4086
|
-
const c =
|
|
4130
|
+
const c = pe(m);
|
|
4087
4131
|
c && (i(c), window.history.replaceState({}, "", window.location.pathname));
|
|
4088
4132
|
}
|
|
4089
|
-
}, [i]),
|
|
4133
|
+
}, [i]), U(() => {
|
|
4090
4134
|
const a = () => {
|
|
4091
4135
|
l("editor");
|
|
4092
4136
|
};
|
|
@@ -4094,33 +4138,33 @@ function _t() {
|
|
|
4094
4138
|
window.removeEventListener("workflow-loaded", a);
|
|
4095
4139
|
};
|
|
4096
4140
|
}, []);
|
|
4097
|
-
const p =
|
|
4141
|
+
const p = W(
|
|
4098
4142
|
(a) => {
|
|
4099
|
-
const m =
|
|
4143
|
+
const m = pe(a);
|
|
4100
4144
|
m && (i(m), l("editor"));
|
|
4101
4145
|
},
|
|
4102
4146
|
[i]
|
|
4103
|
-
), d =
|
|
4147
|
+
), d = W(
|
|
4104
4148
|
(a) => {
|
|
4105
4149
|
s(a), l("editor");
|
|
4106
4150
|
},
|
|
4107
4151
|
[s]
|
|
4108
4152
|
);
|
|
4109
|
-
return /* @__PURE__ */
|
|
4153
|
+
return /* @__PURE__ */ n(Ae, { children: [
|
|
4110
4154
|
/* @__PURE__ */ e(Tt, {}),
|
|
4111
4155
|
/* @__PURE__ */ e(
|
|
4112
4156
|
Ut,
|
|
4113
4157
|
{
|
|
4114
4158
|
isOpen: t,
|
|
4115
|
-
onClose: () =>
|
|
4159
|
+
onClose: () => o(!1),
|
|
4116
4160
|
onApplyWorkflow: d
|
|
4117
4161
|
}
|
|
4118
4162
|
),
|
|
4119
4163
|
/* @__PURE__ */ e(Pt, {}),
|
|
4120
|
-
/* @__PURE__ */
|
|
4164
|
+
/* @__PURE__ */ n("div", { className: "h-screen flex flex-col bg-gray-100 dark:bg-zinc-900", children: [
|
|
4121
4165
|
/* @__PURE__ */ e(ht, {}),
|
|
4122
|
-
/* @__PURE__ */ e("div", { className: "bg-white dark:bg-zinc-800 border-b border-gray-200 dark:border-zinc-700", children: /* @__PURE__ */
|
|
4123
|
-
/* @__PURE__ */
|
|
4166
|
+
/* @__PURE__ */ e("div", { className: "bg-white dark:bg-zinc-800 border-b border-gray-200 dark:border-zinc-700", children: /* @__PURE__ */ n("div", { className: "flex items-center justify-between", children: [
|
|
4167
|
+
/* @__PURE__ */ n("div", { className: "flex", children: [
|
|
4124
4168
|
/* @__PURE__ */ e(
|
|
4125
4169
|
"button",
|
|
4126
4170
|
{
|
|
@@ -4146,10 +4190,10 @@ function _t() {
|
|
|
4146
4190
|
}
|
|
4147
4191
|
)
|
|
4148
4192
|
] }),
|
|
4149
|
-
/* @__PURE__ */
|
|
4193
|
+
/* @__PURE__ */ n(
|
|
4150
4194
|
"button",
|
|
4151
4195
|
{
|
|
4152
|
-
onClick: () =>
|
|
4196
|
+
onClick: () => o(!0),
|
|
4153
4197
|
className: "mr-4 px-4 py-1.5 text-sm font-medium text-white bg-gradient-to-r from-teal-500 to-cyan-500 hover:from-teal-600 hover:to-cyan-600 rounded-full flex items-center gap-2 transition-all shadow-sm hover:shadow",
|
|
4154
4198
|
children: [
|
|
4155
4199
|
/* @__PURE__ */ e("svg", { className: "h-4 w-4", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ e(
|
|
@@ -4166,8 +4210,8 @@ function _t() {
|
|
|
4166
4210
|
}
|
|
4167
4211
|
)
|
|
4168
4212
|
] }) }),
|
|
4169
|
-
/* @__PURE__ */
|
|
4170
|
-
r === "editor" && /* @__PURE__ */
|
|
4213
|
+
/* @__PURE__ */ n("div", { className: "flex-1 flex overflow-hidden", children: [
|
|
4214
|
+
r === "editor" && /* @__PURE__ */ n(B, { children: [
|
|
4171
4215
|
/* @__PURE__ */ e(st, {}),
|
|
4172
4216
|
/* @__PURE__ */ e(Ot, {}),
|
|
4173
4217
|
/* @__PURE__ */ e(it, {})
|
|
@@ -4187,14 +4231,14 @@ export {
|
|
|
4187
4231
|
st as NodePalette,
|
|
4188
4232
|
Lt as TemplateGallery,
|
|
4189
4233
|
ht as Toolbar,
|
|
4190
|
-
|
|
4191
|
-
|
|
4234
|
+
nt as UploadGallery,
|
|
4235
|
+
ot as WorkflowEditor,
|
|
4192
4236
|
Pt as WorkflowLibrary,
|
|
4193
4237
|
St as getCategories,
|
|
4194
|
-
|
|
4238
|
+
pe as getTemplateById,
|
|
4195
4239
|
Ft as getTemplatesByCategory,
|
|
4196
4240
|
Ht as searchTemplates,
|
|
4197
|
-
|
|
4198
|
-
|
|
4241
|
+
q as templates,
|
|
4242
|
+
f as useWorkflowStore
|
|
4199
4243
|
};
|
|
4200
4244
|
//# sourceMappingURL=index.js.map
|