@genfeedai/workflow-ui 0.2.3 → 0.2.4

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.
Files changed (45) hide show
  1. package/dist/canvas.d.ts +22 -22
  2. package/dist/canvas.mjs +16 -16
  3. package/dist/{chunk-XPZAHIWY.mjs → chunk-2FUPL67V.mjs} +1592 -1044
  4. package/dist/{chunk-HWVTD2LC.mjs → chunk-53XDE62A.mjs} +818 -623
  5. package/dist/{chunk-PCIWWD37.mjs → chunk-7LV4UAUS.mjs} +19 -19
  6. package/dist/{chunk-7SKSRSS7.mjs → chunk-B4EAAKYF.mjs} +16 -16
  7. package/dist/{chunk-ZJD5WMR3.mjs → chunk-C6MQBJFC.mjs} +45 -13
  8. package/dist/{chunk-7H3WJJYS.mjs → chunk-ESVULCFY.mjs} +12 -6
  9. package/dist/{chunk-GWBGK3KL.mjs → chunk-FWJIAW2E.mjs} +82 -47
  10. package/dist/{chunk-R727OFBR.mjs → chunk-GPYIIWD5.mjs} +404 -350
  11. package/dist/{chunk-OQREHJXK.mjs → chunk-IYFWAJBB.mjs} +208 -203
  12. package/dist/{chunk-N5NJZTK4.mjs → chunk-MGLAKMDP.mjs} +23 -21
  13. package/dist/{chunk-LT3ZJJL6.mjs → chunk-OJWVEEMM.mjs} +497 -399
  14. package/dist/{chunk-ZD2BADZO.mjs → chunk-ORVDYXDP.mjs} +221 -175
  15. package/dist/{chunk-CV4M7CNU.mjs → chunk-QQVHGJ2G.mjs} +149 -142
  16. package/dist/{chunk-6PSJTBNV.mjs → chunk-U4QPE4CY.mjs} +387 -347
  17. package/dist/{chunk-EFXQT23N.mjs → chunk-VVQ4CH77.mjs} +5 -5
  18. package/dist/{chunk-VRN3UWE5.mjs → chunk-XRC3O5GK.mjs} +73 -73
  19. package/dist/{chunk-FT33LFII.mjs → chunk-YUIK4AHM.mjs} +1 -1
  20. package/dist/{chunk-FMJPFB6W.mjs → chunk-ZSITTZ4S.mjs} +630 -569
  21. package/dist/hooks.d.ts +37 -37
  22. package/dist/hooks.mjs +10 -10
  23. package/dist/index.d.ts +26 -11
  24. package/dist/index.mjs +99 -19
  25. package/dist/lib.d.ts +203 -203
  26. package/dist/lib.mjs +228 -198
  27. package/dist/nodes.d.ts +2 -2
  28. package/dist/nodes.mjs +12 -12
  29. package/dist/panels.d.ts +2 -3
  30. package/dist/panels.mjs +3 -3
  31. package/dist/provider.d.ts +2 -2
  32. package/dist/provider.mjs +2 -2
  33. package/dist/stores.d.ts +5 -5
  34. package/dist/stores.mjs +5 -5
  35. package/dist/toolbar.d.ts +42 -24
  36. package/dist/toolbar.mjs +4 -4
  37. package/dist/ui.d.ts +2 -2
  38. package/dist/ui.mjs +2 -2
  39. package/dist/{useCommentNavigation-BakbiiIc.d.ts → useRequiredInputs-ByoIS-fT.d.ts} +160 -160
  40. package/dist/{promptLibraryStore-Dl3Q3cP6.d.ts → workflowStore-Bsz0nd5c.d.ts} +368 -368
  41. package/dist/workflowStore-N2F7WIG3.mjs +2 -0
  42. package/package.json +77 -75
  43. package/src/styles/workflow-ui.css +56 -19
  44. package/dist/workflowStore-UAAKOOIK.mjs +0 -2
  45. package/dist/{types-IEKYuYhu.d.ts → types-CRXJnajq.d.ts} +1 -1
package/dist/lib.mjs CHANGED
@@ -1,135 +1,71 @@
1
- import { easing, getEasingFunction } from './chunk-6PSJTBNV.mjs';
2
- export { CubicBezierEditor, DEFAULT_CUSTOM_BEZIER, DEFAULT_IMAGE_MODEL, DEFAULT_LIPSYNC_MODEL, DEFAULT_LLM_MODEL, DEFAULT_VIDEO_MODEL, EASING_BEZIER_MAP, EASING_PRESETS, IMAGE_MODELS, IMAGE_MODEL_ID_MAP, IMAGE_MODEL_MAP, LIPSYNC_MODELS, LIPSYNC_SYNC_MODES, LLM_MODELS, LLM_MODEL_ID_MAP, LLM_MODEL_MAP, PRESET_BEZIERS, VIDEO_MODELS, VIDEO_MODEL_ID_MAP, VIDEO_MODEL_MAP, applySpeedCurve, createAsymmetricEase, createBezierEasing, easing, evaluateBezier, generateHandlesFromSchema, getAllEasingNames, getEasingBezier, getEasingDisplayName, getEasingFunction, getImageModelLabel, getLLMModelLabel, getLipSyncModelLabel, getMediaFromNode, getPresetBezier, getVideoModelLabel, isSchemaHandle, lipSyncModelSupportsImage } from './chunk-6PSJTBNV.mjs';
3
- export { calculateWorkflowCost, formatCost } from './chunk-N5NJZTK4.mjs';
4
- export { CONNECTION_FIELDS, extractEnumValues, getImageDimensions, getSchemaDefaults, getVideoMetadata, supportsImageInput, validateRequiredSchemaFields } from './chunk-EFXQT23N.mjs';
1
+ export { calculateWorkflowCost, formatCost } from './chunk-MGLAKMDP.mjs';
2
+ import { easing, getEasingFunction } from './chunk-U4QPE4CY.mjs';
3
+ export { CubicBezierEditor, DEFAULT_CUSTOM_BEZIER, DEFAULT_IMAGE_MODEL, DEFAULT_LIPSYNC_MODEL, DEFAULT_LLM_MODEL, DEFAULT_VIDEO_MODEL, EASING_BEZIER_MAP, EASING_PRESETS, IMAGE_MODELS, IMAGE_MODEL_ID_MAP, IMAGE_MODEL_MAP, LIPSYNC_MODELS, LIPSYNC_SYNC_MODES, LLM_MODELS, LLM_MODEL_ID_MAP, LLM_MODEL_MAP, PRESET_BEZIERS, VIDEO_MODELS, VIDEO_MODEL_ID_MAP, VIDEO_MODEL_MAP, applySpeedCurve, createAsymmetricEase, createBezierEasing, easing, evaluateBezier, generateHandlesFromSchema, getAllEasingNames, getEasingBezier, getEasingDisplayName, getEasingFunction, getImageModelLabel, getLLMModelLabel, getLipSyncModelLabel, getMediaFromNode, getPresetBezier, getVideoModelLabel, isSchemaHandle, lipSyncModelSupportsImage } from './chunk-U4QPE4CY.mjs';
4
+ export { CONNECTION_FIELDS, extractEnumValues, getImageDimensions, getSchemaDefaults, getVideoMetadata, supportsImageInput, validateRequiredSchemaFields } from './chunk-VVQ4CH77.mjs';
5
5
 
6
- // src/lib/speedCurve.ts
7
- var INVERSE_TOLERANCE = 1e-6;
8
- var INVERSE_MAX_ITERATIONS = 32;
9
- var MONOTONICITY_SAMPLES = 256;
10
- var MONOTONICITY_TOLERANCE = 1e-6;
11
- var inverseCache = /* @__PURE__ */ new WeakMap();
12
- var monotonicityCache = /* @__PURE__ */ new WeakMap();
13
- function isMonotonicIncreasing(func) {
14
- const cached = monotonicityCache.get(func);
15
- if (cached !== void 0) {
16
- return cached;
17
- }
18
- let prev = func(0);
19
- for (let i = 1; i <= MONOTONICITY_SAMPLES; i++) {
20
- const value = func(i / MONOTONICITY_SAMPLES);
21
- if (value + MONOTONICITY_TOLERANCE < prev) {
22
- monotonicityCache.set(func, false);
23
- return false;
24
- }
25
- prev = value;
26
- }
27
- monotonicityCache.set(func, true);
28
- return true;
6
+ // src/lib/deduplicatedFetch.ts
7
+ var inFlightRequests = /* @__PURE__ */ new Map();
8
+ var responseCache = /* @__PURE__ */ new Map();
9
+ var CACHE_TTL = 5e3;
10
+ var pendingTimeouts = /* @__PURE__ */ new Map();
11
+ function getCacheKey(url, headers) {
12
+ if (!headers) return url;
13
+ const headerObj = headers instanceof Headers ? Object.fromEntries(headers.entries()) : Array.isArray(headers) ? Object.fromEntries(headers) : headers;
14
+ const sortedHeaders = Object.keys(headerObj).sort().map((k) => `${k}:${headerObj[k]}`).join("|");
15
+ return `${url}|${sortedHeaders}`;
29
16
  }
30
- function invertEasingValue(target, func) {
31
- if (target <= INVERSE_TOLERANCE) {
32
- return 0;
33
- }
34
- if (target >= 1 - INVERSE_TOLERANCE) {
35
- return 1;
17
+ async function deduplicatedFetch(url, options) {
18
+ const cacheKey = getCacheKey(url, options?.headers);
19
+ const cached = responseCache.get(cacheKey);
20
+ if (cached && Date.now() - cached.timestamp < CACHE_TTL) {
21
+ return new Response(cached.bodyText, {
22
+ headers: cached.headers,
23
+ status: cached.status
24
+ });
36
25
  }
37
- let low = 0;
38
- let high = 1;
39
- let mid = 0.5;
40
- for (let i = 0; i < INVERSE_MAX_ITERATIONS; i++) {
41
- mid = (low + high) / 2;
42
- const value = func(mid);
43
- const diff = value - target;
44
- if (Math.abs(diff) <= INVERSE_TOLERANCE) {
45
- break;
46
- }
47
- if (diff < 0) {
48
- low = mid;
49
- } else {
50
- high = mid;
26
+ const existingRequest = inFlightRequests.get(cacheKey);
27
+ if (existingRequest) {
28
+ await existingRequest;
29
+ const cachedData = responseCache.get(cacheKey);
30
+ if (cachedData) {
31
+ return new Response(cachedData.bodyText, {
32
+ headers: cachedData.headers,
33
+ status: cachedData.status
34
+ });
51
35
  }
36
+ return new Response(JSON.stringify({ error: "Cache miss" }), {
37
+ status: 500
38
+ });
52
39
  }
53
- return Math.min(1, Math.max(0, mid));
54
- }
55
- function getInverseEasing(func) {
56
- if (inverseCache.has(func)) {
57
- return inverseCache.get(func);
58
- }
59
- if (!isMonotonicIncreasing(func)) {
60
- inverseCache.set(func, null);
61
- return null;
62
- }
63
- const inverse = (value) => {
64
- const clamped = Math.max(0, Math.min(1, value));
65
- return invertEasingValue(clamped, func);
66
- };
67
- inverseCache.set(func, inverse);
68
- return inverse;
69
- }
70
- function mapTimeWithEasing(normalizedTime, func) {
71
- const inverse = getInverseEasing(func);
72
- if (!inverse) {
73
- return func(normalizedTime);
74
- }
75
- return inverse(normalizedTime);
76
- }
77
- function warpTime(originalTime, inputDuration = 5, outputDuration = 1.5, easingFunction = easing.easeInOutCubic) {
78
- const easingFunc = typeof easingFunction === "string" ? getEasingFunction(easingFunction) : easingFunction;
79
- const t = originalTime / inputDuration;
80
- const clamped = Math.max(0, Math.min(1, t));
81
- const eased = mapTimeWithEasing(clamped, easingFunc);
82
- return eased * outputDuration;
83
- }
84
- function calculateWarpedDuration(originalStart, originalDuration, inputDuration = 5, outputDuration = 1.5, easingFunction = easing.easeInOutCubic) {
85
- const warpedStart = warpTime(originalStart, inputDuration, outputDuration, easingFunction);
86
- const warpedEnd = warpTime(
87
- originalStart + originalDuration,
88
- inputDuration,
89
- outputDuration,
90
- easingFunction
91
- );
92
- return warpedEnd - warpedStart;
93
- }
94
- function validateWarpFunction(easingFunction = easing.easeInOutCubic, inputDuration = 5, outputDuration = 1.5, tolerance = 1e-3) {
95
- const errors = [];
96
- const startWarp = warpTime(0, inputDuration, outputDuration, easingFunction);
97
- if (Math.abs(startWarp - 0) > tolerance) {
98
- errors.push(`Start point should be 0, got ${startWarp}`);
99
- }
100
- const endWarp = warpTime(inputDuration, inputDuration, outputDuration, easingFunction);
101
- if (Math.abs(endWarp - outputDuration) > tolerance) {
102
- errors.push(`End point should be ${outputDuration}, got ${endWarp}`);
103
- }
104
- let prevWarp = 0;
105
- for (let t = 0; t <= inputDuration; t += inputDuration / 100) {
106
- const warp = warpTime(t, inputDuration, outputDuration, easingFunction);
107
- if (warp < prevWarp) {
108
- errors.push(`Monotonicity violation at t=${t.toFixed(2)}: ${warp} < ${prevWarp}`);
109
- break;
40
+ const requestPromise = fetch(url, options).then(async (response) => {
41
+ try {
42
+ const bodyText = await response.clone().text();
43
+ responseCache.set(cacheKey, {
44
+ bodyText,
45
+ headers: Object.fromEntries(response.headers.entries()),
46
+ status: response.status,
47
+ timestamp: Date.now()
48
+ });
49
+ } catch {
110
50
  }
111
- prevWarp = warp;
112
- }
113
- return { valid: errors.length === 0, errors };
51
+ return response;
52
+ }).finally(() => {
53
+ const timeoutId = setTimeout(() => {
54
+ inFlightRequests.delete(cacheKey);
55
+ pendingTimeouts.delete(cacheKey);
56
+ }, 50);
57
+ pendingTimeouts.set(cacheKey, timeoutId);
58
+ });
59
+ inFlightRequests.set(cacheKey, requestPromise);
60
+ return requestPromise;
114
61
  }
115
- function analyzeWarpCurve(easingFunction = easing.easeInOutCubic, inputDuration = 5, outputDuration = 1.5, samples = 100) {
116
- const speedMultipliers = [];
117
- const averageSpeed = inputDuration / outputDuration;
118
- for (let i = 0; i < samples; i++) {
119
- const t1 = i / samples * inputDuration;
120
- const t2 = (i + 1) / samples * inputDuration;
121
- const warp1 = warpTime(t1, inputDuration, outputDuration, easingFunction);
122
- const warp2 = warpTime(t2, inputDuration, outputDuration, easingFunction);
123
- const inputSegmentDuration = t2 - t1;
124
- const outputSegmentDuration = warp2 - warp1;
125
- const absoluteSpeed = inputSegmentDuration / (outputSegmentDuration + 1e-10);
126
- const speedMultiplier = absoluteSpeed / averageSpeed;
127
- speedMultipliers.push(speedMultiplier);
62
+ function clearFetchCache() {
63
+ responseCache.clear();
64
+ inFlightRequests.clear();
65
+ for (const timeoutId of pendingTimeouts.values()) {
66
+ clearTimeout(timeoutId);
128
67
  }
129
- const minSpeed = Math.min(...speedMultipliers);
130
- const maxSpeed = Math.max(...speedMultipliers);
131
- const avgSpeed = speedMultipliers.reduce((a, b) => a + b, 0) / speedMultipliers.length;
132
- return { speedMultipliers, minSpeed, maxSpeed, avgSpeed };
68
+ pendingTimeouts.clear();
133
69
  }
134
70
 
135
71
  // src/lib/gridSplitter.ts
@@ -188,14 +124,14 @@ function createGridForDimensions(width, height, rows, cols) {
188
124
  for (let row = 0; row < rows; row++) {
189
125
  for (let col = 0; col < cols; col++) {
190
126
  cells.push({
191
- x: Math.round(col * cellWidth),
192
- y: Math.round(row * cellHeight),
127
+ height: Math.round(cellHeight),
193
128
  width: Math.round(cellWidth),
194
- height: Math.round(cellHeight)
129
+ x: Math.round(col * cellWidth),
130
+ y: Math.round(row * cellHeight)
195
131
  });
196
132
  }
197
133
  }
198
- return { rows, cols, cells, confidence: 1 };
134
+ return { cells, cols, confidence: 1, rows };
199
135
  }
200
136
  async function detectGridWithDimensions(imageDataUrl, rows, cols) {
201
137
  return new Promise((resolve, reject) => {
@@ -238,11 +174,11 @@ function getGridCandidates(width, height) {
238
174
  const gridSymmetry = 1 - Math.abs(rows - cols) / Math.max(rows, cols);
239
175
  const score = cellARScore * 0.45 + layoutScore * 0.25 + cellCountScore * 0.15 + gridSymmetry * 0.15;
240
176
  candidates.push({
241
- rows,
242
- cols,
243
- cellWidth,
244
- cellHeight,
245
177
  cellAspectRatio,
178
+ cellHeight,
179
+ cellWidth,
180
+ cols,
181
+ rows,
246
182
  score
247
183
  });
248
184
  }
@@ -252,8 +188,16 @@ function getGridCandidates(width, height) {
252
188
  function analyzeGridFromImageData(imageData) {
253
189
  const { width, height, data } = imageData;
254
190
  const candidates = getGridCandidates(width, height);
255
- const verticalEdgeStrength = calculateVerticalEdgeProfile(data, width, height);
256
- const horizontalEdgeStrength = calculateHorizontalEdgeProfile(data, width, height);
191
+ const verticalEdgeStrength = calculateVerticalEdgeProfile(
192
+ data,
193
+ width,
194
+ height
195
+ );
196
+ const horizontalEdgeStrength = calculateHorizontalEdgeProfile(
197
+ data,
198
+ width,
199
+ height
200
+ );
257
201
  let bestCandidate = candidates[0];
258
202
  let bestCombinedScore = -Infinity;
259
203
  for (const candidate of candidates.slice(0, 8)) {
@@ -271,7 +215,12 @@ function analyzeGridFromImageData(imageData) {
271
215
  bestCandidate = candidate;
272
216
  }
273
217
  }
274
- const result = createGridForDimensions(width, height, bestCandidate.rows, bestCandidate.cols);
218
+ const result = createGridForDimensions(
219
+ width,
220
+ height,
221
+ bestCandidate.rows,
222
+ bestCandidate.cols
223
+ );
275
224
  result.confidence = bestCombinedScore;
276
225
  return result;
277
226
  }
@@ -320,7 +269,10 @@ function scoreGridByEdges(rows, cols, width, height, verticalProfile, horizontal
320
269
  const horizontalBaseline = horizontalSum / horizontalProfile.length;
321
270
  let totalRatio = 0;
322
271
  let divisions = 0;
323
- const searchWindow = Math.max(3, Math.floor(Math.min(width / cols, height / rows) * 0.03));
272
+ const searchWindow = Math.max(
273
+ 3,
274
+ Math.floor(Math.min(width / cols, height / rows) * 0.03)
275
+ );
324
276
  if (cols > 1) {
325
277
  const cellWidth = width / cols;
326
278
  for (let i = 1; i < cols; i++) {
@@ -417,7 +369,7 @@ function getImageDimensions2(base64DataUrl) {
417
369
  }
418
370
  const img = new Image();
419
371
  img.onload = () => {
420
- resolve({ width: img.naturalWidth, height: img.naturalHeight });
372
+ resolve({ height: img.naturalHeight, width: img.naturalWidth });
421
373
  };
422
374
  img.onerror = () => {
423
375
  resolve(null);
@@ -433,7 +385,7 @@ function getVideoDimensions(videoUrl) {
433
385
  }
434
386
  const video = document.createElement("video");
435
387
  video.onloadedmetadata = () => {
436
- resolve({ width: video.videoWidth, height: video.videoHeight });
388
+ resolve({ height: video.videoHeight, width: video.videoWidth });
437
389
  };
438
390
  video.onerror = () => {
439
391
  resolve(null);
@@ -448,7 +400,7 @@ var MAX_HEIGHT = 600;
448
400
  var NODE_CHROME_HEIGHT = 100;
449
401
  function calculateNodeSize(aspectRatio, baseWidth = 300) {
450
402
  if (!aspectRatio || aspectRatio <= 0 || !Number.isFinite(aspectRatio)) {
451
- return { width: 300, height: 300 };
403
+ return { height: 300, width: 300 };
452
404
  }
453
405
  let width = Math.max(MIN_WIDTH, Math.min(MAX_WIDTH, baseWidth));
454
406
  let contentHeight = width / aspectRatio;
@@ -476,87 +428,165 @@ function calculateNodeSize(aspectRatio, baseWidth = 300) {
476
428
  totalHeight = Math.max(MIN_HEIGHT, Math.min(MAX_HEIGHT, totalHeight));
477
429
  }
478
430
  return {
479
- width: Math.round(width),
480
- height: Math.round(totalHeight)
431
+ height: Math.round(totalHeight),
432
+ width: Math.round(width)
481
433
  };
482
434
  }
483
435
  function calculateNodeSizePreservingHeight(aspectRatio, currentHeight) {
484
436
  if (!aspectRatio || aspectRatio <= 0 || !Number.isFinite(aspectRatio)) {
485
- return { width: 300, height: currentHeight ?? 300 };
437
+ return { height: currentHeight ?? 300, width: 300 };
486
438
  }
487
439
  if (currentHeight !== void 0 && currentHeight >= MIN_HEIGHT && currentHeight <= MAX_HEIGHT) {
488
440
  const contentHeight = currentHeight - NODE_CHROME_HEIGHT;
489
441
  let width = contentHeight * aspectRatio;
490
442
  width = Math.max(MIN_WIDTH, Math.min(MAX_WIDTH, width));
491
443
  return {
492
- width: Math.round(width),
493
- height: Math.round(currentHeight)
444
+ height: Math.round(currentHeight),
445
+ width: Math.round(width)
494
446
  };
495
447
  }
496
448
  return calculateNodeSize(aspectRatio);
497
449
  }
498
450
 
499
- // src/lib/deduplicatedFetch.ts
500
- var inFlightRequests = /* @__PURE__ */ new Map();
501
- var responseCache = /* @__PURE__ */ new Map();
502
- var CACHE_TTL = 5e3;
503
- var pendingTimeouts = /* @__PURE__ */ new Map();
504
- function getCacheKey(url, headers) {
505
- if (!headers) return url;
506
- const headerObj = headers instanceof Headers ? Object.fromEntries(headers.entries()) : Array.isArray(headers) ? Object.fromEntries(headers) : headers;
507
- const sortedHeaders = Object.keys(headerObj).sort().map((k) => `${k}:${headerObj[k]}`).join("|");
508
- return `${url}|${sortedHeaders}`;
451
+ // src/lib/speedCurve.ts
452
+ var INVERSE_TOLERANCE = 1e-6;
453
+ var INVERSE_MAX_ITERATIONS = 32;
454
+ var MONOTONICITY_SAMPLES = 256;
455
+ var MONOTONICITY_TOLERANCE = 1e-6;
456
+ var inverseCache = /* @__PURE__ */ new WeakMap();
457
+ var monotonicityCache = /* @__PURE__ */ new WeakMap();
458
+ function isMonotonicIncreasing(func) {
459
+ const cached = monotonicityCache.get(func);
460
+ if (cached !== void 0) {
461
+ return cached;
462
+ }
463
+ let prev = func(0);
464
+ for (let i = 1; i <= MONOTONICITY_SAMPLES; i++) {
465
+ const value = func(i / MONOTONICITY_SAMPLES);
466
+ if (value + MONOTONICITY_TOLERANCE < prev) {
467
+ monotonicityCache.set(func, false);
468
+ return false;
469
+ }
470
+ prev = value;
471
+ }
472
+ monotonicityCache.set(func, true);
473
+ return true;
509
474
  }
510
- async function deduplicatedFetch(url, options) {
511
- const cacheKey = getCacheKey(url, options?.headers);
512
- const cached = responseCache.get(cacheKey);
513
- if (cached && Date.now() - cached.timestamp < CACHE_TTL) {
514
- return new Response(cached.bodyText, {
515
- status: cached.status,
516
- headers: cached.headers
517
- });
475
+ function invertEasingValue(target, func) {
476
+ if (target <= INVERSE_TOLERANCE) {
477
+ return 0;
518
478
  }
519
- const existingRequest = inFlightRequests.get(cacheKey);
520
- if (existingRequest) {
521
- await existingRequest;
522
- const cachedData = responseCache.get(cacheKey);
523
- if (cachedData) {
524
- return new Response(cachedData.bodyText, {
525
- status: cachedData.status,
526
- headers: cachedData.headers
527
- });
479
+ if (target >= 1 - INVERSE_TOLERANCE) {
480
+ return 1;
481
+ }
482
+ let low = 0;
483
+ let high = 1;
484
+ let mid = 0.5;
485
+ for (let i = 0; i < INVERSE_MAX_ITERATIONS; i++) {
486
+ mid = (low + high) / 2;
487
+ const value = func(mid);
488
+ const diff = value - target;
489
+ if (Math.abs(diff) <= INVERSE_TOLERANCE) {
490
+ break;
491
+ }
492
+ if (diff < 0) {
493
+ low = mid;
494
+ } else {
495
+ high = mid;
528
496
  }
529
- return new Response(JSON.stringify({ error: "Cache miss" }), { status: 500 });
530
497
  }
531
- const requestPromise = fetch(url, options).then(async (response) => {
532
- try {
533
- const bodyText = await response.clone().text();
534
- responseCache.set(cacheKey, {
535
- status: response.status,
536
- headers: Object.fromEntries(response.headers.entries()),
537
- bodyText,
538
- timestamp: Date.now()
539
- });
540
- } catch {
498
+ return Math.min(1, Math.max(0, mid));
499
+ }
500
+ function getInverseEasing(func) {
501
+ if (inverseCache.has(func)) {
502
+ return inverseCache.get(func);
503
+ }
504
+ if (!isMonotonicIncreasing(func)) {
505
+ inverseCache.set(func, null);
506
+ return null;
507
+ }
508
+ const inverse = (value) => {
509
+ const clamped = Math.max(0, Math.min(1, value));
510
+ return invertEasingValue(clamped, func);
511
+ };
512
+ inverseCache.set(func, inverse);
513
+ return inverse;
514
+ }
515
+ function mapTimeWithEasing(normalizedTime, func) {
516
+ const inverse = getInverseEasing(func);
517
+ if (!inverse) {
518
+ return func(normalizedTime);
519
+ }
520
+ return inverse(normalizedTime);
521
+ }
522
+ function warpTime(originalTime, inputDuration = 5, outputDuration = 1.5, easingFunction = easing.easeInOutCubic) {
523
+ const easingFunc = typeof easingFunction === "string" ? getEasingFunction(easingFunction) : easingFunction;
524
+ const t = originalTime / inputDuration;
525
+ const clamped = Math.max(0, Math.min(1, t));
526
+ const eased = mapTimeWithEasing(clamped, easingFunc);
527
+ return eased * outputDuration;
528
+ }
529
+ function calculateWarpedDuration(originalStart, originalDuration, inputDuration = 5, outputDuration = 1.5, easingFunction = easing.easeInOutCubic) {
530
+ const warpedStart = warpTime(
531
+ originalStart,
532
+ inputDuration,
533
+ outputDuration,
534
+ easingFunction
535
+ );
536
+ const warpedEnd = warpTime(
537
+ originalStart + originalDuration,
538
+ inputDuration,
539
+ outputDuration,
540
+ easingFunction
541
+ );
542
+ return warpedEnd - warpedStart;
543
+ }
544
+ function validateWarpFunction(easingFunction = easing.easeInOutCubic, inputDuration = 5, outputDuration = 1.5, tolerance = 1e-3) {
545
+ const errors = [];
546
+ const startWarp = warpTime(0, inputDuration, outputDuration, easingFunction);
547
+ if (Math.abs(startWarp - 0) > tolerance) {
548
+ errors.push(`Start point should be 0, got ${startWarp}`);
549
+ }
550
+ const endWarp = warpTime(
551
+ inputDuration,
552
+ inputDuration,
553
+ outputDuration,
554
+ easingFunction
555
+ );
556
+ if (Math.abs(endWarp - outputDuration) > tolerance) {
557
+ errors.push(`End point should be ${outputDuration}, got ${endWarp}`);
558
+ }
559
+ let prevWarp = 0;
560
+ for (let t = 0; t <= inputDuration; t += inputDuration / 100) {
561
+ const warp = warpTime(t, inputDuration, outputDuration, easingFunction);
562
+ if (warp < prevWarp) {
563
+ errors.push(
564
+ `Monotonicity violation at t=${t.toFixed(2)}: ${warp} < ${prevWarp}`
565
+ );
566
+ break;
541
567
  }
542
- return response;
543
- }).finally(() => {
544
- const timeoutId = setTimeout(() => {
545
- inFlightRequests.delete(cacheKey);
546
- pendingTimeouts.delete(cacheKey);
547
- }, 50);
548
- pendingTimeouts.set(cacheKey, timeoutId);
549
- });
550
- inFlightRequests.set(cacheKey, requestPromise);
551
- return requestPromise;
568
+ prevWarp = warp;
569
+ }
570
+ return { errors, valid: errors.length === 0 };
552
571
  }
553
- function clearFetchCache() {
554
- responseCache.clear();
555
- inFlightRequests.clear();
556
- for (const timeoutId of pendingTimeouts.values()) {
557
- clearTimeout(timeoutId);
572
+ function analyzeWarpCurve(easingFunction = easing.easeInOutCubic, inputDuration = 5, outputDuration = 1.5, samples = 100) {
573
+ const speedMultipliers = [];
574
+ const averageSpeed = inputDuration / outputDuration;
575
+ for (let i = 0; i < samples; i++) {
576
+ const t1 = i / samples * inputDuration;
577
+ const t2 = (i + 1) / samples * inputDuration;
578
+ const warp1 = warpTime(t1, inputDuration, outputDuration, easingFunction);
579
+ const warp2 = warpTime(t2, inputDuration, outputDuration, easingFunction);
580
+ const inputSegmentDuration = t2 - t1;
581
+ const outputSegmentDuration = warp2 - warp1;
582
+ const absoluteSpeed = inputSegmentDuration / (outputSegmentDuration + 1e-10);
583
+ const speedMultiplier = absoluteSpeed / averageSpeed;
584
+ speedMultipliers.push(speedMultiplier);
558
585
  }
559
- pendingTimeouts.clear();
586
+ const minSpeed = Math.min(...speedMultipliers);
587
+ const maxSpeed = Math.max(...speedMultipliers);
588
+ const avgSpeed = speedMultipliers.reduce((a, b) => a + b, 0) / speedMultipliers.length;
589
+ return { avgSpeed, maxSpeed, minSpeed, speedMultipliers };
560
590
  }
561
591
 
562
592
  export { analyzeWarpCurve, calculateNodeSize, calculateNodeSizePreservingHeight, calculateWarpedDuration, clearFetchCache, createGridForDimensions, deduplicatedFetch, detectAndSplitGrid, detectGrid, detectGridWithDimensions, getGridCandidates, getImageDimensions2 as getImageDimensionsFromDataUrl, getVideoDimensions as getVideoDimensionsFromUrl, splitImage, splitWithDimensions, validateWarpFunction, warpTime };
package/dist/nodes.d.ts CHANGED
@@ -41,8 +41,6 @@ interface BaseNodeProps extends NodeProps {
41
41
  declare function BaseNodeComponent({ id, type, data, selected, children, headerActions, title, titleElement, hideStatusIndicator, width, height, disabledInputs, }: BaseNodeProps): react_jsx_runtime.JSX.Element | null;
42
42
  declare const BaseNode: react.MemoExoticComponent<typeof BaseNodeComponent>;
43
43
 
44
- declare function NodeDetailModal(): react_jsx_runtime.JSX.Element | null;
45
-
46
44
  declare function WorkflowInputNodeComponent(props: NodeProps): react_jsx_runtime.JSX.Element;
47
45
  declare const WorkflowInputNode: react.MemoExoticComponent<typeof WorkflowInputNodeComponent>;
48
46
 
@@ -84,6 +82,8 @@ declare const PromptNode: react.MemoExoticComponent<typeof PromptNodeComponent>;
84
82
  declare function VideoInputNodeComponent(props: NodeProps): react_jsx_runtime.JSX.Element;
85
83
  declare const VideoInputNode: react.MemoExoticComponent<typeof VideoInputNodeComponent>;
86
84
 
85
+ declare function NodeDetailModal(): react_jsx_runtime.JSX.Element | null;
86
+
87
87
  declare function DownloadNodeComponent(props: NodeProps): react_jsx_runtime.JSX.Element;
88
88
  declare const DownloadNode: react.MemoExoticComponent<typeof DownloadNodeComponent>;
89
89
  /** @deprecated Use DownloadNode instead */
package/dist/nodes.mjs CHANGED
@@ -1,13 +1,13 @@
1
- export { AnimationNode, AnnotationNode, AudioInputNode, BaseNode, DownloadNode, ImageCompareNode, ImageGenNode, ImageGridSplitNode, ImageInputNode, LLMNode, LipSyncNode, MotionControlNode, NodeDetailModal, OutputGalleryNode, OutputNode, PromptConstructorNode, PromptNode, ReframeNode, ResizeNode, SubtitleNode, TextToSpeechNode, TranscribeNode, UpscaleNode, VideoFrameExtractNode, VideoGenNode, VideoInputNode, VideoStitchNode, VideoTrimNode, VoiceChangeNode, WorkflowInputNode, WorkflowOutputNode, WorkflowRefNode, nodeTypes, setWorkflowRefApi } from './chunk-XPZAHIWY.mjs';
2
- import './chunk-ZJD5WMR3.mjs';
3
- import './chunk-6PSJTBNV.mjs';
4
- import './chunk-GWBGK3KL.mjs';
5
- import './chunk-7SKSRSS7.mjs';
6
- import './chunk-EFXQT23N.mjs';
7
- import './chunk-CV4M7CNU.mjs';
8
- import './chunk-LDN7IX4Y.mjs';
9
- import './chunk-LT3ZJJL6.mjs';
10
- import './chunk-R727OFBR.mjs';
1
+ export { AnimationNode, AnnotationNode, AudioInputNode, BaseNode, DownloadNode, ImageCompareNode, ImageGenNode, ImageGridSplitNode, ImageInputNode, LLMNode, LipSyncNode, MotionControlNode, NodeDetailModal, OutputGalleryNode, OutputNode, PromptConstructorNode, PromptNode, ReframeNode, ResizeNode, SubtitleNode, TextToSpeechNode, TranscribeNode, UpscaleNode, VideoFrameExtractNode, VideoGenNode, VideoInputNode, VideoStitchNode, VideoTrimNode, VoiceChangeNode, WorkflowInputNode, WorkflowOutputNode, WorkflowRefNode, nodeTypes, setWorkflowRefApi } from './chunk-2FUPL67V.mjs';
2
+ import './chunk-C6MQBJFC.mjs';
3
+ import './chunk-FWJIAW2E.mjs';
4
+ import './chunk-B4EAAKYF.mjs';
5
+ import './chunk-U4QPE4CY.mjs';
6
+ import './chunk-VVQ4CH77.mjs';
11
7
  import './chunk-MLJJBBTB.mjs';
12
- import './chunk-FT33LFII.mjs';
13
- import './chunk-VRN3UWE5.mjs';
8
+ import './chunk-YUIK4AHM.mjs';
9
+ import './chunk-QQVHGJ2G.mjs';
10
+ import './chunk-LDN7IX4Y.mjs';
11
+ import './chunk-OJWVEEMM.mjs';
12
+ import './chunk-GPYIIWD5.mjs';
13
+ import './chunk-XRC3O5GK.mjs';
package/dist/panels.d.ts CHANGED
@@ -2,6 +2,8 @@ import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import * as react from 'react';
3
3
  import { HTMLAttributes, ReactNode } from 'react';
4
4
 
5
+ declare function DebugPanel(): react_jsx_runtime.JSX.Element;
6
+
5
7
  declare function NodePalette(): react_jsx_runtime.JSX.Element;
6
8
 
7
9
  interface PanelContainerProps extends HTMLAttributes<HTMLDivElement> {
@@ -16,7 +18,4 @@ interface PanelContainerProps extends HTMLAttributes<HTMLDivElement> {
16
18
  */
17
19
  declare const PanelContainer: react.ForwardRefExoticComponent<PanelContainerProps & react.RefAttributes<HTMLDivElement>>;
18
20
 
19
- declare function DebugPanelComponent(): react_jsx_runtime.JSX.Element;
20
- declare const DebugPanel: react.MemoExoticComponent<typeof DebugPanelComponent>;
21
-
22
21
  export { DebugPanel, NodePalette, PanelContainer };
package/dist/panels.mjs CHANGED
@@ -1,3 +1,3 @@
1
- export { DebugPanel, NodePalette, PanelContainer } from './chunk-OQREHJXK.mjs';
2
- import './chunk-LT3ZJJL6.mjs';
3
- import './chunk-R727OFBR.mjs';
1
+ export { DebugPanel, NodePalette, PanelContainer } from './chunk-IYFWAJBB.mjs';
2
+ import './chunk-OJWVEEMM.mjs';
3
+ import './chunk-GPYIIWD5.mjs';
@@ -1,7 +1,7 @@
1
+ import { W as WorkflowUIConfig } from './types-CRXJnajq.js';
2
+ export { F as FileUploadService, M as ModelBrowserModalProps, b as ModelSchemaService, P as PromptLibraryService, a as PromptPickerProps, c as WorkflowsApiService } from './types-CRXJnajq.js';
1
3
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
4
  import { ReactNode } from 'react';
3
- import { W as WorkflowUIConfig } from './types-IEKYuYhu.js';
4
- export { F as FileUploadService, M as ModelBrowserModalProps, b as ModelSchemaService, P as PromptLibraryService, a as PromptPickerProps, c as WorkflowsApiService } from './types-IEKYuYhu.js';
5
5
  import '@genfeedai/types';
6
6
 
7
7
  /**
package/dist/provider.mjs CHANGED
@@ -1,3 +1,3 @@
1
1
  import './chunk-MLJJBBTB.mjs';
2
- export { WorkflowUIProvider, useWorkflowUIConfig } from './chunk-FT33LFII.mjs';
3
- import './chunk-VRN3UWE5.mjs';
2
+ export { WorkflowUIProvider, useWorkflowUIConfig } from './chunk-YUIK4AHM.mjs';
3
+ import './chunk-XRC3O5GK.mjs';
package/dist/stores.d.ts CHANGED
@@ -1,12 +1,12 @@
1
- import { W as WorkflowStore } from './promptLibraryStore-Dl3Q3cP6.js';
2
- export { A as AnnotationShape, a as AnnotationTool, b as ArrowShape, B as BaseShape, C as CircleShape, D as DebugPayload, c as DefaultModelSettings, E as ExecutionStore, F as FreehandShape, J as Job, M as ModalType, N as NodeDetailTab, P as PROVIDER_INFO, d as ProviderConfig, e as ProviderSettings, R as RecentModel, f as RectangleShape, T as TextShape, g as ToolOptions, h as WorkflowData, i as WorkflowState, j as configurePromptLibrary, u as useAnnotationStore, k as useExecutionStore, l as usePromptEditorStore, m as usePromptLibraryStore, n as useSettingsStore, o as useUIStore, p as useWorkflowStore } from './promptLibraryStore-Dl3Q3cP6.js';
1
+ import { W as WorkflowStore } from './workflowStore-Bsz0nd5c.js';
2
+ export { A as AnnotationShape, a as AnnotationTool, b as ArrowShape, B as BaseShape, C as CircleShape, D as DebugPayload, c as DefaultModelSettings, E as ExecutionStore, F as FreehandShape, J as Job, M as ModalType, N as NodeDetailTab, P as PROVIDER_INFO, d as ProviderConfig, e as ProviderSettings, R as RecentModel, f as RectangleShape, T as TextShape, g as ToolOptions, h as WorkflowData, i as WorkflowState, j as configurePromptLibrary, u as useAnnotationStore, k as useExecutionStore, l as usePromptEditorStore, m as usePromptLibraryStore, n as useSettingsStore, o as useUIStore, p as useWorkflowStore } from './workflowStore-Bsz0nd5c.js';
3
+ export { C as ContextMenuType, u as useContextMenuStore } from './contextMenuStore-DMg0hJQ1.js';
3
4
  import * as _xyflow_react from '@xyflow/react';
4
5
  import * as _genfeedai_types from '@genfeedai/types';
5
- export { C as ContextMenuType, u as useContextMenuStore } from './contextMenuStore-DMg0hJQ1.js';
6
6
  import 'zustand';
7
- import 'zundo';
8
- import './types-IEKYuYhu.js';
7
+ import './types-CRXJnajq.js';
9
8
  import 'react';
9
+ import 'zundo';
10
10
 
11
11
  /**
12
12
  * Stable Zustand Selectors
package/dist/stores.mjs CHANGED
@@ -1,6 +1,6 @@
1
- export { useAnnotationStore, usePromptEditorStore } from './chunk-CV4M7CNU.mjs';
2
- export { createSelectGroupByNodeId, createSelectIsNodeSelected, createSelectNodeById, selectAddNode, selectAddNodesAndEdges, selectCreateGroup, selectDeleteGroup, selectDuplicateNode, selectEdgeStyle, selectEdges, selectFindCompatibleHandle, selectGetConnectedNodeIds, selectGetNodeById, selectGroups, selectIsDirty, selectIsLoading, selectIsSaving, selectIsValidConnection, selectNavigationTargetId, selectNodes, selectOnConnect, selectOnEdgesChange, selectOnNodesChange, selectRemoveEdge, selectRemoveNode, selectSelectedNodeIds, selectSetDirty, selectSetSelectedNodeIds, selectToggleNodeLock, selectUnlockAllNodes, selectUpdateNodeData, selectWorkflowId, selectWorkflowName, useContextMenuStore } from './chunk-PCIWWD37.mjs';
1
+ export { createSelectGroupByNodeId, createSelectIsNodeSelected, createSelectNodeById, selectAddNode, selectAddNodesAndEdges, selectCreateGroup, selectDeleteGroup, selectDuplicateNode, selectEdgeStyle, selectEdges, selectFindCompatibleHandle, selectGetConnectedNodeIds, selectGetNodeById, selectGroups, selectIsDirty, selectIsLoading, selectIsSaving, selectIsValidConnection, selectNavigationTargetId, selectNodes, selectOnConnect, selectOnEdgesChange, selectOnNodesChange, selectRemoveEdge, selectRemoveNode, selectSelectedNodeIds, selectSetDirty, selectSetSelectedNodeIds, selectToggleNodeLock, selectUnlockAllNodes, selectUpdateNodeData, selectWorkflowId, selectWorkflowName, useContextMenuStore } from './chunk-7LV4UAUS.mjs';
2
+ export { useAnnotationStore, usePromptEditorStore } from './chunk-QQVHGJ2G.mjs';
3
3
  import './chunk-LDN7IX4Y.mjs';
4
- export { PROVIDER_INFO, useExecutionStore, useSettingsStore, useUIStore } from './chunk-LT3ZJJL6.mjs';
5
- export { useWorkflowStore } from './chunk-R727OFBR.mjs';
6
- export { configurePromptLibrary, usePromptLibraryStore } from './chunk-VRN3UWE5.mjs';
4
+ export { PROVIDER_INFO, useExecutionStore, useSettingsStore, useUIStore } from './chunk-OJWVEEMM.mjs';
5
+ export { useWorkflowStore } from './chunk-GPYIIWD5.mjs';
6
+ export { configurePromptLibrary, usePromptLibraryStore } from './chunk-XRC3O5GK.mjs';