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