@workglow/tasks 0.2.15 → 0.2.17

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 (88) hide show
  1. package/README.md +10 -9
  2. package/dist/browser.js +860 -648
  3. package/dist/browser.js.map +41 -41
  4. package/dist/bun.js +860 -648
  5. package/dist/bun.js.map +41 -41
  6. package/dist/electron.js +860 -648
  7. package/dist/electron.js.map +41 -41
  8. package/dist/node.js +860 -648
  9. package/dist/node.js.map +41 -41
  10. package/dist/task/ArrayTask.d.ts +4 -5
  11. package/dist/task/ArrayTask.d.ts.map +1 -1
  12. package/dist/task/DateFormatTask.d.ts +3 -2
  13. package/dist/task/DateFormatTask.d.ts.map +1 -1
  14. package/dist/task/DebugLogTask.d.ts +2 -1
  15. package/dist/task/DebugLogTask.d.ts.map +1 -1
  16. package/dist/task/InputTask.d.ts +2 -1
  17. package/dist/task/InputTask.d.ts.map +1 -1
  18. package/dist/task/JavaScriptTask.d.ts +4 -1
  19. package/dist/task/JavaScriptTask.d.ts.map +1 -1
  20. package/dist/task/JsonPathTask.d.ts +3 -2
  21. package/dist/task/JsonPathTask.d.ts.map +1 -1
  22. package/dist/task/LambdaTask.d.ts +7 -6
  23. package/dist/task/LambdaTask.d.ts.map +1 -1
  24. package/dist/task/OutputTask.d.ts +2 -1
  25. package/dist/task/OutputTask.d.ts.map +1 -1
  26. package/dist/task/RegexTask.d.ts +3 -2
  27. package/dist/task/RegexTask.d.ts.map +1 -1
  28. package/dist/task/SplitTask.d.ts +3 -2
  29. package/dist/task/SplitTask.d.ts.map +1 -1
  30. package/dist/task/TemplateTask.d.ts +3 -2
  31. package/dist/task/TemplateTask.d.ts.map +1 -1
  32. package/dist/task/image/ImageBlurTask.d.ts +3 -2
  33. package/dist/task/image/ImageBlurTask.d.ts.map +1 -1
  34. package/dist/task/image/ImageBorderTask.d.ts +3 -2
  35. package/dist/task/image/ImageBorderTask.d.ts.map +1 -1
  36. package/dist/task/image/ImageBrightnessTask.d.ts +3 -2
  37. package/dist/task/image/ImageBrightnessTask.d.ts.map +1 -1
  38. package/dist/task/image/ImageContrastTask.d.ts +3 -2
  39. package/dist/task/image/ImageContrastTask.d.ts.map +1 -1
  40. package/dist/task/image/ImageCropTask.d.ts +3 -2
  41. package/dist/task/image/ImageCropTask.d.ts.map +1 -1
  42. package/dist/task/image/ImageFlipTask.d.ts +3 -2
  43. package/dist/task/image/ImageFlipTask.d.ts.map +1 -1
  44. package/dist/task/image/ImageGrayscaleTask.d.ts +3 -2
  45. package/dist/task/image/ImageGrayscaleTask.d.ts.map +1 -1
  46. package/dist/task/image/ImageInvertTask.d.ts +3 -2
  47. package/dist/task/image/ImageInvertTask.d.ts.map +1 -1
  48. package/dist/task/image/ImagePixelateTask.d.ts +3 -2
  49. package/dist/task/image/ImagePixelateTask.d.ts.map +1 -1
  50. package/dist/task/image/ImagePosterizeTask.d.ts +3 -2
  51. package/dist/task/image/ImagePosterizeTask.d.ts.map +1 -1
  52. package/dist/task/image/ImageResizeTask.d.ts +3 -2
  53. package/dist/task/image/ImageResizeTask.d.ts.map +1 -1
  54. package/dist/task/image/ImageRotateTask.d.ts +3 -2
  55. package/dist/task/image/ImageRotateTask.d.ts.map +1 -1
  56. package/dist/task/image/ImageSepiaTask.d.ts +3 -2
  57. package/dist/task/image/ImageSepiaTask.d.ts.map +1 -1
  58. package/dist/task/image/ImageTextTask.d.ts +3 -2
  59. package/dist/task/image/ImageTextTask.d.ts.map +1 -1
  60. package/dist/task/image/ImageThresholdTask.d.ts +3 -2
  61. package/dist/task/image/ImageThresholdTask.d.ts.map +1 -1
  62. package/dist/task/image/ImageTintTask.d.ts +3 -2
  63. package/dist/task/image/ImageTintTask.d.ts.map +1 -1
  64. package/dist/task/image/ImageTransparencyTask.d.ts +3 -2
  65. package/dist/task/image/ImageTransparencyTask.d.ts.map +1 -1
  66. package/dist/task/image/ImageWatermarkTask.d.ts +3 -2
  67. package/dist/task/image/ImageWatermarkTask.d.ts.map +1 -1
  68. package/dist/task/string/StringConcatTask.d.ts +3 -2
  69. package/dist/task/string/StringConcatTask.d.ts.map +1 -1
  70. package/dist/task/string/StringIncludesTask.d.ts +3 -2
  71. package/dist/task/string/StringIncludesTask.d.ts.map +1 -1
  72. package/dist/task/string/StringJoinTask.d.ts +3 -2
  73. package/dist/task/string/StringJoinTask.d.ts.map +1 -1
  74. package/dist/task/string/StringLengthTask.d.ts +3 -2
  75. package/dist/task/string/StringLengthTask.d.ts.map +1 -1
  76. package/dist/task/string/StringLowerCaseTask.d.ts +3 -2
  77. package/dist/task/string/StringLowerCaseTask.d.ts.map +1 -1
  78. package/dist/task/string/StringReplaceTask.d.ts +3 -2
  79. package/dist/task/string/StringReplaceTask.d.ts.map +1 -1
  80. package/dist/task/string/StringSliceTask.d.ts +3 -2
  81. package/dist/task/string/StringSliceTask.d.ts.map +1 -1
  82. package/dist/task/string/StringTemplateTask.d.ts +3 -2
  83. package/dist/task/string/StringTemplateTask.d.ts.map +1 -1
  84. package/dist/task/string/StringTrimTask.d.ts +3 -2
  85. package/dist/task/string/StringTrimTask.d.ts.map +1 -1
  86. package/dist/task/string/StringUpperCaseTask.d.ts +3 -2
  87. package/dist/task/string/StringUpperCaseTask.d.ts.map +1 -1
  88. package/package.json +9 -9
package/dist/browser.js CHANGED
@@ -1746,11 +1746,11 @@ class ArrayTaskRunner extends GraphAsTaskRunner {
1746
1746
  async executeTaskChildren(_input) {
1747
1747
  return super.executeTaskChildren({});
1748
1748
  }
1749
- async executeTaskChildrenReactive() {
1750
- return this.task.subGraph.runReactive({});
1749
+ async executeTaskChildrenPreview() {
1750
+ return this.task.subGraph.runPreview({});
1751
1751
  }
1752
- async executeTaskReactive(input, output) {
1753
- await super.executeTaskReactive(input, output);
1752
+ async executeTaskPreview(input) {
1753
+ await super.executeTaskPreview(input);
1754
1754
  if (this.task.hasChildren()) {
1755
1755
  this.task.runOutputData = this.task.executeMerge(input, this.task.runOutputData);
1756
1756
  }
@@ -4447,6 +4447,29 @@ import {
4447
4447
  Task as Task36,
4448
4448
  Workflow as Workflow11
4449
4449
  } from "@workglow/task-graph";
4450
+ function formatDate(input) {
4451
+ const dateInput = /^\d+$/.test(input.value) ? Number(input.value) : input.value;
4452
+ const date = new Date(dateInput);
4453
+ if (isNaN(date.getTime())) {
4454
+ throw new Error(`Invalid date: ${input.value}`);
4455
+ }
4456
+ const format = input.format ?? "iso";
4457
+ const locale = input.locale;
4458
+ const timeZone = input.timeZone;
4459
+ switch (format) {
4460
+ case "iso":
4461
+ return date.toISOString();
4462
+ case "date":
4463
+ return date.toLocaleDateString(locale, timeZone ? { timeZone } : undefined);
4464
+ case "time":
4465
+ return date.toLocaleTimeString(locale, timeZone ? { timeZone } : undefined);
4466
+ case "unix":
4467
+ return String(date.getTime());
4468
+ case "datetime":
4469
+ default:
4470
+ return date.toLocaleString(locale, timeZone ? { timeZone } : undefined);
4471
+ }
4472
+ }
4450
4473
  var inputSchema36 = {
4451
4474
  type: "object",
4452
4475
  properties: {
@@ -4501,35 +4524,11 @@ class DateFormatTask extends Task36 {
4501
4524
  static outputSchema() {
4502
4525
  return outputSchema36;
4503
4526
  }
4504
- async executeReactive(input, _output, _context) {
4505
- const dateInput = /^\d+$/.test(input.value) ? Number(input.value) : input.value;
4506
- const date = new Date(dateInput);
4507
- if (isNaN(date.getTime())) {
4508
- throw new Error(`Invalid date: ${input.value}`);
4509
- }
4510
- const format = input.format ?? "iso";
4511
- const locale = input.locale;
4512
- const timeZone = input.timeZone;
4513
- let result;
4514
- switch (format) {
4515
- case "iso":
4516
- result = date.toISOString();
4517
- break;
4518
- case "date":
4519
- result = date.toLocaleDateString(locale, timeZone ? { timeZone } : undefined);
4520
- break;
4521
- case "time":
4522
- result = date.toLocaleTimeString(locale, timeZone ? { timeZone } : undefined);
4523
- break;
4524
- case "unix":
4525
- result = String(date.getTime());
4526
- break;
4527
- case "datetime":
4528
- default:
4529
- result = date.toLocaleString(locale, timeZone ? { timeZone } : undefined);
4530
- break;
4531
- }
4532
- return { result };
4527
+ async execute(input, _context) {
4528
+ return { result: formatDate(input) };
4529
+ }
4530
+ async executePreview(input, _context) {
4531
+ return { result: formatDate(input) };
4533
4532
  }
4534
4533
  }
4535
4534
  Workflow11.prototype.dateFormat = CreateWorkflow10(DateFormatTask);
@@ -4561,6 +4560,17 @@ var outputSchema37 = {
4561
4560
  properties: {},
4562
4561
  additionalProperties: true
4563
4562
  };
4563
+ function logAndPassthrough(input, log_level) {
4564
+ const inputRecord = input;
4565
+ if (log_level === "dir") {
4566
+ console.dir(inputRecord, { depth: null });
4567
+ } else {
4568
+ console[log_level](inputRecord);
4569
+ }
4570
+ const output = {};
4571
+ Object.assign(output, inputRecord);
4572
+ return output;
4573
+ }
4564
4574
 
4565
4575
  class DebugLogTask extends Task37 {
4566
4576
  static type = "DebugLogTask";
@@ -4580,16 +4590,11 @@ class DebugLogTask extends Task37 {
4580
4590
  static outputSchema() {
4581
4591
  return outputSchema37;
4582
4592
  }
4583
- async executeReactive(input, output) {
4584
- const log_level = this.config.log_level ?? DEFAULT_LOG_LEVEL;
4585
- const inputRecord = input;
4586
- if (log_level === "dir") {
4587
- console.dir(inputRecord, { depth: null });
4588
- } else {
4589
- console[log_level](inputRecord);
4590
- }
4591
- Object.assign(output, inputRecord);
4592
- return output;
4593
+ async execute(input) {
4594
+ return logAndPassthrough(input, this.config.log_level ?? DEFAULT_LOG_LEVEL);
4595
+ }
4596
+ async executePreview(input) {
4597
+ return logAndPassthrough(input, this.config.log_level ?? DEFAULT_LOG_LEVEL);
4593
4598
  }
4594
4599
  }
4595
4600
  var debugLog = (input, config = {}) => {
@@ -5879,6 +5884,49 @@ async function produceImageOutput(inputImage, run) {
5879
5884
  }
5880
5885
 
5881
5886
  // src/task/image/ImageBlurTask.ts
5887
+ async function applyBlur(input) {
5888
+ const { radius = 1 } = input;
5889
+ const image = await produceImageOutput(input.image, (img) => {
5890
+ const { data: src, width, height, channels } = img;
5891
+ const kernelSize = radius * 2 + 1;
5892
+ const tmp = new Uint8ClampedArray(src.length);
5893
+ for (let y = 0;y < height; y++) {
5894
+ for (let c = 0;c < channels; c++) {
5895
+ let sum = 0;
5896
+ for (let k = -radius;k <= radius; k++) {
5897
+ const x = Math.max(0, Math.min(k, width - 1));
5898
+ sum += src[(y * width + x) * channels + c];
5899
+ }
5900
+ tmp[y * width * channels + c] = sum / kernelSize + 0.5 | 0;
5901
+ for (let x = 1;x < width; x++) {
5902
+ const addX = Math.min(x + radius, width - 1);
5903
+ const removeX = Math.max(x - radius - 1, 0);
5904
+ sum += src[(y * width + addX) * channels + c] - src[(y * width + removeX) * channels + c];
5905
+ tmp[(y * width + x) * channels + c] = sum / kernelSize + 0.5 | 0;
5906
+ }
5907
+ }
5908
+ }
5909
+ const dst = new Uint8ClampedArray(src.length);
5910
+ for (let x = 0;x < width; x++) {
5911
+ for (let c = 0;c < channels; c++) {
5912
+ let sum = 0;
5913
+ for (let k = -radius;k <= radius; k++) {
5914
+ const y = Math.max(0, Math.min(k, height - 1));
5915
+ sum += tmp[(y * width + x) * channels + c];
5916
+ }
5917
+ dst[x * channels + c] = sum / kernelSize + 0.5 | 0;
5918
+ for (let y = 1;y < height; y++) {
5919
+ const addY = Math.min(y + radius, height - 1);
5920
+ const removeY = Math.max(y - radius - 1, 0);
5921
+ sum += tmp[(addY * width + x) * channels + c] - tmp[(removeY * width + x) * channels + c];
5922
+ dst[(y * width + x) * channels + c] = sum / kernelSize + 0.5 | 0;
5923
+ }
5924
+ }
5925
+ }
5926
+ return { data: dst, width, height, channels };
5927
+ });
5928
+ return { image };
5929
+ }
5882
5930
  var inputSchema41 = {
5883
5931
  type: "object",
5884
5932
  properties: {
@@ -5915,48 +5963,11 @@ class ImageBlurTask extends Task42 {
5915
5963
  static outputSchema() {
5916
5964
  return outputSchema40;
5917
5965
  }
5918
- async executeReactive(input, _output, _context) {
5919
- const { radius = 1 } = input;
5920
- const image = await produceImageOutput(input.image, (img) => {
5921
- const { data: src, width, height, channels } = img;
5922
- const kernelSize = radius * 2 + 1;
5923
- const tmp = new Uint8ClampedArray(src.length);
5924
- for (let y = 0;y < height; y++) {
5925
- for (let c = 0;c < channels; c++) {
5926
- let sum = 0;
5927
- for (let k = -radius;k <= radius; k++) {
5928
- const x = Math.max(0, Math.min(k, width - 1));
5929
- sum += src[(y * width + x) * channels + c];
5930
- }
5931
- tmp[y * width * channels + c] = sum / kernelSize + 0.5 | 0;
5932
- for (let x = 1;x < width; x++) {
5933
- const addX = Math.min(x + radius, width - 1);
5934
- const removeX = Math.max(x - radius - 1, 0);
5935
- sum += src[(y * width + addX) * channels + c] - src[(y * width + removeX) * channels + c];
5936
- tmp[(y * width + x) * channels + c] = sum / kernelSize + 0.5 | 0;
5937
- }
5938
- }
5939
- }
5940
- const dst = new Uint8ClampedArray(src.length);
5941
- for (let x = 0;x < width; x++) {
5942
- for (let c = 0;c < channels; c++) {
5943
- let sum = 0;
5944
- for (let k = -radius;k <= radius; k++) {
5945
- const y = Math.max(0, Math.min(k, height - 1));
5946
- sum += tmp[(y * width + x) * channels + c];
5947
- }
5948
- dst[x * channels + c] = sum / kernelSize + 0.5 | 0;
5949
- for (let y = 1;y < height; y++) {
5950
- const addY = Math.min(y + radius, height - 1);
5951
- const removeY = Math.max(y - radius - 1, 0);
5952
- sum += tmp[(addY * width + x) * channels + c] - tmp[(removeY * width + x) * channels + c];
5953
- dst[(y * width + x) * channels + c] = sum / kernelSize + 0.5 | 0;
5954
- }
5955
- }
5956
- }
5957
- return { data: dst, width, height, channels };
5958
- });
5959
- return { image };
5966
+ async execute(input, _context) {
5967
+ return await applyBlur(input);
5968
+ }
5969
+ async executePreview(input, _context) {
5970
+ return await applyBlur(input);
5960
5971
  }
5961
5972
  }
5962
5973
  Workflow17.prototype.imageBlur = CreateWorkflow16(ImageBlurTask);
@@ -5967,6 +5978,39 @@ import {
5967
5978
  Workflow as Workflow18
5968
5979
  } from "@workglow/task-graph";
5969
5980
  import { resolveColor } from "@workglow/util/media";
5981
+ async function applyBorder(input) {
5982
+ const { borderWidth: bw = 1 } = input;
5983
+ const color = resolveColor(input.color);
5984
+ const image = await produceImageOutput(input.image, (img) => {
5985
+ const { data: src, width: srcW, height: srcH, channels: srcCh } = img;
5986
+ const outCh = 4;
5987
+ const dstW = srcW + bw * 2;
5988
+ const dstH = srcH + bw * 2;
5989
+ const dst = new Uint8ClampedArray(dstW * dstH * outCh);
5990
+ const r = color.r;
5991
+ const g = color.g;
5992
+ const b = color.b;
5993
+ const a = color.a;
5994
+ for (let i = 0;i < dst.length; i += outCh) {
5995
+ dst[i] = r;
5996
+ dst[i + 1] = g;
5997
+ dst[i + 2] = b;
5998
+ dst[i + 3] = a;
5999
+ }
6000
+ for (let y = 0;y < srcH; y++) {
6001
+ for (let x = 0;x < srcW; x++) {
6002
+ const srcIdx = (y * srcW + x) * srcCh;
6003
+ const dstIdx = ((y + bw) * dstW + (x + bw)) * outCh;
6004
+ dst[dstIdx] = src[srcIdx];
6005
+ dst[dstIdx + 1] = srcCh >= 3 ? src[srcIdx + 1] : src[srcIdx];
6006
+ dst[dstIdx + 2] = srcCh >= 3 ? src[srcIdx + 2] : src[srcIdx];
6007
+ dst[dstIdx + 3] = srcCh === 4 ? src[srcIdx + 3] : 255;
6008
+ }
6009
+ }
6010
+ return { data: dst, width: dstW, height: dstH, channels: outCh };
6011
+ });
6012
+ return { image };
6013
+ }
5970
6014
  var inputSchema42 = {
5971
6015
  type: "object",
5972
6016
  properties: {
@@ -6003,38 +6047,11 @@ class ImageBorderTask extends Task43 {
6003
6047
  static outputSchema() {
6004
6048
  return outputSchema41;
6005
6049
  }
6006
- async executeReactive(input, _output, _context) {
6007
- const { borderWidth: bw = 1 } = input;
6008
- const color = resolveColor(input.color);
6009
- const image = await produceImageOutput(input.image, (img) => {
6010
- const { data: src, width: srcW, height: srcH, channels: srcCh } = img;
6011
- const outCh = 4;
6012
- const dstW = srcW + bw * 2;
6013
- const dstH = srcH + bw * 2;
6014
- const dst = new Uint8ClampedArray(dstW * dstH * outCh);
6015
- const r = color.r;
6016
- const g = color.g;
6017
- const b = color.b;
6018
- const a = color.a;
6019
- for (let i = 0;i < dst.length; i += outCh) {
6020
- dst[i] = r;
6021
- dst[i + 1] = g;
6022
- dst[i + 2] = b;
6023
- dst[i + 3] = a;
6024
- }
6025
- for (let y = 0;y < srcH; y++) {
6026
- for (let x = 0;x < srcW; x++) {
6027
- const srcIdx = (y * srcW + x) * srcCh;
6028
- const dstIdx = ((y + bw) * dstW + (x + bw)) * outCh;
6029
- dst[dstIdx] = src[srcIdx];
6030
- dst[dstIdx + 1] = srcCh >= 3 ? src[srcIdx + 1] : src[srcIdx];
6031
- dst[dstIdx + 2] = srcCh >= 3 ? src[srcIdx + 2] : src[srcIdx];
6032
- dst[dstIdx + 3] = srcCh === 4 ? src[srcIdx + 3] : 255;
6033
- }
6034
- }
6035
- return { data: dst, width: dstW, height: dstH, channels: outCh };
6036
- });
6037
- return { image };
6050
+ async execute(input, _context) {
6051
+ return await applyBorder(input);
6052
+ }
6053
+ async executePreview(input, _context) {
6054
+ return await applyBorder(input);
6038
6055
  }
6039
6056
  }
6040
6057
  Workflow18.prototype.imageBorder = CreateWorkflow17(ImageBorderTask);
@@ -6044,6 +6061,27 @@ import {
6044
6061
  Task as Task44,
6045
6062
  Workflow as Workflow19
6046
6063
  } from "@workglow/task-graph";
6064
+ async function applyBrightness(input) {
6065
+ const amount = input.amount ?? 0;
6066
+ const image = await produceImageOutput(input.image, (img) => {
6067
+ const { data: src, width, height, channels } = img;
6068
+ const dst = new Uint8ClampedArray(src.length);
6069
+ if (channels === 4) {
6070
+ for (let i = 0;i < src.length; i += 4) {
6071
+ dst[i] = src[i] + amount;
6072
+ dst[i + 1] = src[i + 1] + amount;
6073
+ dst[i + 2] = src[i + 2] + amount;
6074
+ dst[i + 3] = src[i + 3];
6075
+ }
6076
+ } else {
6077
+ for (let i = 0;i < src.length; i++) {
6078
+ dst[i] = src[i] + amount;
6079
+ }
6080
+ }
6081
+ return { data: dst, width, height, channels };
6082
+ });
6083
+ return { image };
6084
+ }
6047
6085
  var inputSchema43 = {
6048
6086
  type: "object",
6049
6087
  properties: {
@@ -6080,26 +6118,11 @@ class ImageBrightnessTask extends Task44 {
6080
6118
  static outputSchema() {
6081
6119
  return outputSchema42;
6082
6120
  }
6083
- async executeReactive(input, _output, _context) {
6084
- const amount = input.amount ?? 0;
6085
- const image = await produceImageOutput(input.image, (img) => {
6086
- const { data: src, width, height, channels } = img;
6087
- const dst = new Uint8ClampedArray(src.length);
6088
- if (channels === 4) {
6089
- for (let i = 0;i < src.length; i += 4) {
6090
- dst[i] = src[i] + amount;
6091
- dst[i + 1] = src[i + 1] + amount;
6092
- dst[i + 2] = src[i + 2] + amount;
6093
- dst[i + 3] = src[i + 3];
6094
- }
6095
- } else {
6096
- for (let i = 0;i < src.length; i++) {
6097
- dst[i] = src[i] + amount;
6098
- }
6099
- }
6100
- return { data: dst, width, height, channels };
6101
- });
6102
- return { image };
6121
+ async execute(input, _context) {
6122
+ return await applyBrightness(input);
6123
+ }
6124
+ async executePreview(input, _context) {
6125
+ return await applyBrightness(input);
6103
6126
  }
6104
6127
  }
6105
6128
  Workflow19.prototype.imageBrightness = CreateWorkflow18(ImageBrightnessTask);
@@ -6109,6 +6132,32 @@ import {
6109
6132
  Task as Task45,
6110
6133
  Workflow as Workflow20
6111
6134
  } from "@workglow/task-graph";
6135
+ async function applyContrast(input) {
6136
+ const amount = input.amount ?? 0;
6137
+ const image = await produceImageOutput(input.image, (img) => {
6138
+ const { data: src, width, height, channels } = img;
6139
+ const factor = 259 * (amount + 255) / (255 * (259 - amount));
6140
+ const lut = new Uint8ClampedArray(256);
6141
+ for (let i = 0;i < 256; i++) {
6142
+ lut[i] = factor * (i - 128) + 128;
6143
+ }
6144
+ const dst = new Uint8ClampedArray(src.length);
6145
+ if (channels === 4) {
6146
+ for (let i = 0;i < src.length; i += 4) {
6147
+ dst[i] = lut[src[i]];
6148
+ dst[i + 1] = lut[src[i + 1]];
6149
+ dst[i + 2] = lut[src[i + 2]];
6150
+ dst[i + 3] = src[i + 3];
6151
+ }
6152
+ } else {
6153
+ for (let i = 0;i < src.length; i++) {
6154
+ dst[i] = lut[src[i]];
6155
+ }
6156
+ }
6157
+ return { data: dst, width, height, channels };
6158
+ });
6159
+ return { image };
6160
+ }
6112
6161
  var inputSchema44 = {
6113
6162
  type: "object",
6114
6163
  properties: {
@@ -6145,31 +6194,11 @@ class ImageContrastTask extends Task45 {
6145
6194
  static outputSchema() {
6146
6195
  return outputSchema43;
6147
6196
  }
6148
- async executeReactive(input, _output, _context) {
6149
- const amount = input.amount ?? 0;
6150
- const image = await produceImageOutput(input.image, (img) => {
6151
- const { data: src, width, height, channels } = img;
6152
- const factor = 259 * (amount + 255) / (255 * (259 - amount));
6153
- const lut = new Uint8ClampedArray(256);
6154
- for (let i = 0;i < 256; i++) {
6155
- lut[i] = factor * (i - 128) + 128;
6156
- }
6157
- const dst = new Uint8ClampedArray(src.length);
6158
- if (channels === 4) {
6159
- for (let i = 0;i < src.length; i += 4) {
6160
- dst[i] = lut[src[i]];
6161
- dst[i + 1] = lut[src[i + 1]];
6162
- dst[i + 2] = lut[src[i + 2]];
6163
- dst[i + 3] = src[i + 3];
6164
- }
6165
- } else {
6166
- for (let i = 0;i < src.length; i++) {
6167
- dst[i] = lut[src[i]];
6168
- }
6169
- }
6170
- return { data: dst, width, height, channels };
6171
- });
6172
- return { image };
6197
+ async execute(input, _context) {
6198
+ return await applyContrast(input);
6199
+ }
6200
+ async executePreview(input, _context) {
6201
+ return await applyContrast(input);
6173
6202
  }
6174
6203
  }
6175
6204
  Workflow20.prototype.imageContrast = CreateWorkflow19(ImageContrastTask);
@@ -6179,6 +6208,31 @@ import {
6179
6208
  Task as Task46,
6180
6209
  Workflow as Workflow21
6181
6210
  } from "@workglow/task-graph";
6211
+ async function cropImage(input) {
6212
+ const { x: rawX, y: rawY, width: rawW, height: rawH } = input;
6213
+ const image = await produceImageOutput(input.image, (img) => {
6214
+ const { data: src, width: srcW, height: srcH, channels } = img;
6215
+ if (srcW < 1 || srcH < 1) {
6216
+ throw new RangeError("Cannot crop an empty image");
6217
+ }
6218
+ if (rawX < 0 || rawX >= srcW || rawY < 0 || rawY >= srcH) {
6219
+ throw new RangeError("Crop origin is outside the source image bounds");
6220
+ }
6221
+ const x = rawX;
6222
+ const y = rawY;
6223
+ const w = Math.min(rawW, srcW - x);
6224
+ const h = Math.min(rawH, srcH - y);
6225
+ const dst = new Uint8ClampedArray(w * h * channels);
6226
+ const rowBytes = w * channels;
6227
+ for (let row = 0;row < h; row++) {
6228
+ const srcOffset = ((y + row) * srcW + x) * channels;
6229
+ const dstOffset = row * rowBytes;
6230
+ dst.set(src.subarray(srcOffset, srcOffset + rowBytes), dstOffset);
6231
+ }
6232
+ return { data: dst, width: w, height: h, channels };
6233
+ });
6234
+ return { image };
6235
+ }
6182
6236
  var inputSchema45 = {
6183
6237
  type: "object",
6184
6238
  properties: {
@@ -6211,30 +6265,11 @@ class ImageCropTask extends Task46 {
6211
6265
  static outputSchema() {
6212
6266
  return outputSchema44;
6213
6267
  }
6214
- async executeReactive(input, _output, _context) {
6215
- const { x: rawX, y: rawY, width: rawW, height: rawH } = input;
6216
- const image = await produceImageOutput(input.image, (img) => {
6217
- const { data: src, width: srcW, height: srcH, channels } = img;
6218
- if (srcW < 1 || srcH < 1) {
6219
- throw new RangeError("Cannot crop an empty image");
6220
- }
6221
- if (rawX < 0 || rawX >= srcW || rawY < 0 || rawY >= srcH) {
6222
- throw new RangeError("Crop origin is outside the source image bounds");
6223
- }
6224
- const x = rawX;
6225
- const y = rawY;
6226
- const w = Math.min(rawW, srcW - x);
6227
- const h = Math.min(rawH, srcH - y);
6228
- const dst = new Uint8ClampedArray(w * h * channels);
6229
- const rowBytes = w * channels;
6230
- for (let row = 0;row < h; row++) {
6231
- const srcOffset = ((y + row) * srcW + x) * channels;
6232
- const dstOffset = row * rowBytes;
6233
- dst.set(src.subarray(srcOffset, srcOffset + rowBytes), dstOffset);
6234
- }
6235
- return { data: dst, width: w, height: h, channels };
6236
- });
6237
- return { image };
6268
+ async execute(input, _context) {
6269
+ return await cropImage(input);
6270
+ }
6271
+ async executePreview(input, _context) {
6272
+ return await cropImage(input);
6238
6273
  }
6239
6274
  }
6240
6275
  Workflow21.prototype.imageCrop = CreateWorkflow20(ImageCropTask);
@@ -6244,6 +6279,33 @@ import {
6244
6279
  Task as Task47,
6245
6280
  Workflow as Workflow22
6246
6281
  } from "@workglow/task-graph";
6282
+ async function flipImage(input) {
6283
+ const { direction } = input;
6284
+ const image = await produceImageOutput(input.image, (img) => {
6285
+ const { data: src, width, height, channels } = img;
6286
+ const dst = new Uint8ClampedArray(src.length);
6287
+ const rowBytes = width * channels;
6288
+ if (direction === "vertical") {
6289
+ for (let y = 0;y < height; y++) {
6290
+ const srcOffset = y * rowBytes;
6291
+ const dstOffset = (height - 1 - y) * rowBytes;
6292
+ dst.set(src.subarray(srcOffset, srcOffset + rowBytes), dstOffset);
6293
+ }
6294
+ } else {
6295
+ for (let y = 0;y < height; y++) {
6296
+ for (let x = 0;x < width; x++) {
6297
+ const srcIdx = (y * width + x) * channels;
6298
+ const dstIdx = (y * width + (width - 1 - x)) * channels;
6299
+ for (let c = 0;c < channels; c++) {
6300
+ dst[dstIdx + c] = src[srcIdx + c];
6301
+ }
6302
+ }
6303
+ }
6304
+ }
6305
+ return { data: dst, width, height, channels };
6306
+ });
6307
+ return { image };
6308
+ }
6247
6309
  var inputSchema46 = {
6248
6310
  type: "object",
6249
6311
  properties: {
@@ -6278,32 +6340,11 @@ class ImageFlipTask extends Task47 {
6278
6340
  static outputSchema() {
6279
6341
  return outputSchema45;
6280
6342
  }
6281
- async executeReactive(input, _output, _context) {
6282
- const { direction } = input;
6283
- const image = await produceImageOutput(input.image, (img) => {
6284
- const { data: src, width, height, channels } = img;
6285
- const dst = new Uint8ClampedArray(src.length);
6286
- const rowBytes = width * channels;
6287
- if (direction === "vertical") {
6288
- for (let y = 0;y < height; y++) {
6289
- const srcOffset = y * rowBytes;
6290
- const dstOffset = (height - 1 - y) * rowBytes;
6291
- dst.set(src.subarray(srcOffset, srcOffset + rowBytes), dstOffset);
6292
- }
6293
- } else {
6294
- for (let y = 0;y < height; y++) {
6295
- for (let x = 0;x < width; x++) {
6296
- const srcIdx = (y * width + x) * channels;
6297
- const dstIdx = (y * width + (width - 1 - x)) * channels;
6298
- for (let c = 0;c < channels; c++) {
6299
- dst[dstIdx + c] = src[srcIdx + c];
6300
- }
6301
- }
6302
- }
6303
- }
6304
- return { data: dst, width, height, channels };
6305
- });
6306
- return { image };
6343
+ async execute(input, _context) {
6344
+ return await flipImage(input);
6345
+ }
6346
+ async executePreview(input, _context) {
6347
+ return await flipImage(input);
6307
6348
  }
6308
6349
  }
6309
6350
  Workflow22.prototype.imageFlip = CreateWorkflow21(ImageFlipTask);
@@ -6313,6 +6354,22 @@ import {
6313
6354
  Task as Task48,
6314
6355
  Workflow as Workflow23
6315
6356
  } from "@workglow/task-graph";
6357
+ async function applyGrayscale(input) {
6358
+ const image = await produceImageOutput(input.image, (img) => {
6359
+ const { data: src, width, height, channels } = img;
6360
+ if (channels === 1) {
6361
+ return { data: new Uint8ClampedArray(src), width, height, channels: 1 };
6362
+ }
6363
+ const pixelCount = width * height;
6364
+ const dst = new Uint8ClampedArray(pixelCount);
6365
+ for (let i = 0;i < pixelCount; i++) {
6366
+ const idx = i * channels;
6367
+ dst[i] = src[idx] * 77 + src[idx + 1] * 150 + src[idx + 2] * 29 >> 8;
6368
+ }
6369
+ return { data: dst, width, height, channels: 1 };
6370
+ });
6371
+ return { image };
6372
+ }
6316
6373
  var inputSchema47 = {
6317
6374
  type: "object",
6318
6375
  properties: {
@@ -6341,21 +6398,11 @@ class ImageGrayscaleTask extends Task48 {
6341
6398
  static outputSchema() {
6342
6399
  return outputSchema46;
6343
6400
  }
6344
- async executeReactive(input, _output, _context) {
6345
- const image = await produceImageOutput(input.image, (img) => {
6346
- const { data: src, width, height, channels } = img;
6347
- if (channels === 1) {
6348
- return { data: new Uint8ClampedArray(src), width, height, channels: 1 };
6349
- }
6350
- const pixelCount = width * height;
6351
- const dst = new Uint8ClampedArray(pixelCount);
6352
- for (let i = 0;i < pixelCount; i++) {
6353
- const idx = i * channels;
6354
- dst[i] = src[idx] * 77 + src[idx + 1] * 150 + src[idx + 2] * 29 >> 8;
6355
- }
6356
- return { data: dst, width, height, channels: 1 };
6357
- });
6358
- return { image };
6401
+ async execute(input, _context) {
6402
+ return await applyGrayscale(input);
6403
+ }
6404
+ async executePreview(input, _context) {
6405
+ return await applyGrayscale(input);
6359
6406
  }
6360
6407
  }
6361
6408
  Workflow23.prototype.imageGrayscale = CreateWorkflow22(ImageGrayscaleTask);
@@ -6365,6 +6412,26 @@ import {
6365
6412
  Task as Task49,
6366
6413
  Workflow as Workflow24
6367
6414
  } from "@workglow/task-graph";
6415
+ async function invertImage(input) {
6416
+ const image = await produceImageOutput(input.image, (img) => {
6417
+ const { data: src, width, height, channels } = img;
6418
+ const dst = new Uint8ClampedArray(src.length);
6419
+ if (channels === 4) {
6420
+ for (let i = 0;i < src.length; i += 4) {
6421
+ dst[i] = 255 - src[i];
6422
+ dst[i + 1] = 255 - src[i + 1];
6423
+ dst[i + 2] = 255 - src[i + 2];
6424
+ dst[i + 3] = src[i + 3];
6425
+ }
6426
+ } else {
6427
+ for (let i = 0;i < src.length; i++) {
6428
+ dst[i] = 255 - src[i];
6429
+ }
6430
+ }
6431
+ return { data: dst, width, height, channels };
6432
+ });
6433
+ return { image };
6434
+ }
6368
6435
  var inputSchema48 = {
6369
6436
  type: "object",
6370
6437
  properties: {
@@ -6393,25 +6460,11 @@ class ImageInvertTask extends Task49 {
6393
6460
  static outputSchema() {
6394
6461
  return outputSchema47;
6395
6462
  }
6396
- async executeReactive(input, _output, _context) {
6397
- const image = await produceImageOutput(input.image, (img) => {
6398
- const { data: src, width, height, channels } = img;
6399
- const dst = new Uint8ClampedArray(src.length);
6400
- if (channels === 4) {
6401
- for (let i = 0;i < src.length; i += 4) {
6402
- dst[i] = 255 - src[i];
6403
- dst[i + 1] = 255 - src[i + 1];
6404
- dst[i + 2] = 255 - src[i + 2];
6405
- dst[i + 3] = src[i + 3];
6406
- }
6407
- } else {
6408
- for (let i = 0;i < src.length; i++) {
6409
- dst[i] = 255 - src[i];
6410
- }
6411
- }
6412
- return { data: dst, width, height, channels };
6413
- });
6414
- return { image };
6463
+ async execute(input, _context) {
6464
+ return await invertImage(input);
6465
+ }
6466
+ async executePreview(input, _context) {
6467
+ return await invertImage(input);
6415
6468
  }
6416
6469
  }
6417
6470
  Workflow24.prototype.imageInvert = CreateWorkflow23(ImageInvertTask);
@@ -6421,6 +6474,40 @@ import {
6421
6474
  Task as Task50,
6422
6475
  Workflow as Workflow25
6423
6476
  } from "@workglow/task-graph";
6477
+ async function pixelateImage(input) {
6478
+ const { blockSize = 8 } = input;
6479
+ const image = await produceImageOutput(input.image, (img) => {
6480
+ const { data: src, width, height, channels } = img;
6481
+ const dst = new Uint8ClampedArray(src.length);
6482
+ for (let by = 0;by < height; by += blockSize) {
6483
+ const blockH = Math.min(blockSize, height - by);
6484
+ for (let bx = 0;bx < width; bx += blockSize) {
6485
+ const blockW = Math.min(blockSize, width - bx);
6486
+ const blockArea = blockW * blockH;
6487
+ const sums = new Array(channels).fill(0);
6488
+ for (let y = by;y < by + blockH; y++) {
6489
+ for (let x = bx;x < bx + blockW; x++) {
6490
+ const idx = (y * width + x) * channels;
6491
+ for (let c = 0;c < channels; c++) {
6492
+ sums[c] += src[idx + c];
6493
+ }
6494
+ }
6495
+ }
6496
+ const avg = sums.map((s) => s / blockArea + 0.5 | 0);
6497
+ for (let y = by;y < by + blockH; y++) {
6498
+ for (let x = bx;x < bx + blockW; x++) {
6499
+ const idx = (y * width + x) * channels;
6500
+ for (let c = 0;c < channels; c++) {
6501
+ dst[idx + c] = avg[c];
6502
+ }
6503
+ }
6504
+ }
6505
+ }
6506
+ }
6507
+ return { data: dst, width, height, channels };
6508
+ });
6509
+ return { image };
6510
+ }
6424
6511
  var inputSchema49 = {
6425
6512
  type: "object",
6426
6513
  properties: {
@@ -6456,39 +6543,11 @@ class ImagePixelateTask extends Task50 {
6456
6543
  static outputSchema() {
6457
6544
  return outputSchema48;
6458
6545
  }
6459
- async executeReactive(input, _output, _context) {
6460
- const { blockSize = 8 } = input;
6461
- const image = await produceImageOutput(input.image, (img) => {
6462
- const { data: src, width, height, channels } = img;
6463
- const dst = new Uint8ClampedArray(src.length);
6464
- for (let by = 0;by < height; by += blockSize) {
6465
- const blockH = Math.min(blockSize, height - by);
6466
- for (let bx = 0;bx < width; bx += blockSize) {
6467
- const blockW = Math.min(blockSize, width - bx);
6468
- const blockArea = blockW * blockH;
6469
- const sums = new Array(channels).fill(0);
6470
- for (let y = by;y < by + blockH; y++) {
6471
- for (let x = bx;x < bx + blockW; x++) {
6472
- const idx = (y * width + x) * channels;
6473
- for (let c = 0;c < channels; c++) {
6474
- sums[c] += src[idx + c];
6475
- }
6476
- }
6477
- }
6478
- const avg = sums.map((s) => s / blockArea + 0.5 | 0);
6479
- for (let y = by;y < by + blockH; y++) {
6480
- for (let x = bx;x < bx + blockW; x++) {
6481
- const idx = (y * width + x) * channels;
6482
- for (let c = 0;c < channels; c++) {
6483
- dst[idx + c] = avg[c];
6484
- }
6485
- }
6486
- }
6487
- }
6488
- }
6489
- return { data: dst, width, height, channels };
6490
- });
6491
- return { image };
6546
+ async execute(input, _context) {
6547
+ return await pixelateImage(input);
6548
+ }
6549
+ async executePreview(input, _context) {
6550
+ return await pixelateImage(input);
6492
6551
  }
6493
6552
  }
6494
6553
  Workflow25.prototype.imagePixelate = CreateWorkflow24(ImagePixelateTask);
@@ -6498,6 +6557,32 @@ import {
6498
6557
  Task as Task51,
6499
6558
  Workflow as Workflow26
6500
6559
  } from "@workglow/task-graph";
6560
+ async function posterizeImage(input) {
6561
+ const levels = input.levels ?? 4;
6562
+ const image = await produceImageOutput(input.image, (img) => {
6563
+ const { data: src, width, height, channels } = img;
6564
+ const step = 255 / (levels - 1);
6565
+ const lut = new Uint8ClampedArray(256);
6566
+ for (let i = 0;i < 256; i++) {
6567
+ lut[i] = Math.round(Math.round(i / step) * step);
6568
+ }
6569
+ const dst = new Uint8ClampedArray(src.length);
6570
+ if (channels === 4) {
6571
+ for (let i = 0;i < src.length; i += 4) {
6572
+ dst[i] = lut[src[i]];
6573
+ dst[i + 1] = lut[src[i + 1]];
6574
+ dst[i + 2] = lut[src[i + 2]];
6575
+ dst[i + 3] = src[i + 3];
6576
+ }
6577
+ } else {
6578
+ for (let i = 0;i < src.length; i++) {
6579
+ dst[i] = lut[src[i]];
6580
+ }
6581
+ }
6582
+ return { data: dst, width, height, channels };
6583
+ });
6584
+ return { image };
6585
+ }
6501
6586
  var inputSchema50 = {
6502
6587
  type: "object",
6503
6588
  properties: {
@@ -6534,31 +6619,11 @@ class ImagePosterizeTask extends Task51 {
6534
6619
  static outputSchema() {
6535
6620
  return outputSchema49;
6536
6621
  }
6537
- async executeReactive(input, _output, _context) {
6538
- const levels = input.levels ?? 4;
6539
- const image = await produceImageOutput(input.image, (img) => {
6540
- const { data: src, width, height, channels } = img;
6541
- const step = 255 / (levels - 1);
6542
- const lut = new Uint8ClampedArray(256);
6543
- for (let i = 0;i < 256; i++) {
6544
- lut[i] = Math.round(Math.round(i / step) * step);
6545
- }
6546
- const dst = new Uint8ClampedArray(src.length);
6547
- if (channels === 4) {
6548
- for (let i = 0;i < src.length; i += 4) {
6549
- dst[i] = lut[src[i]];
6550
- dst[i + 1] = lut[src[i + 1]];
6551
- dst[i + 2] = lut[src[i + 2]];
6552
- dst[i + 3] = src[i + 3];
6553
- }
6554
- } else {
6555
- for (let i = 0;i < src.length; i++) {
6556
- dst[i] = lut[src[i]];
6557
- }
6558
- }
6559
- return { data: dst, width, height, channels };
6560
- });
6561
- return { image };
6622
+ async execute(input, _context) {
6623
+ return await posterizeImage(input);
6624
+ }
6625
+ async executePreview(input, _context) {
6626
+ return await posterizeImage(input);
6562
6627
  }
6563
6628
  }
6564
6629
  Workflow26.prototype.imagePosterize = CreateWorkflow25(ImagePosterizeTask);
@@ -6570,6 +6635,26 @@ import {
6570
6635
  Task as Task52,
6571
6636
  Workflow as Workflow27
6572
6637
  } from "@workglow/task-graph";
6638
+ async function resizeImage(input) {
6639
+ const { width: dstW, height: dstH } = input;
6640
+ const image = await produceImageOutput(input.image, (img) => {
6641
+ const { data: src, width: srcW, height: srcH, channels } = img;
6642
+ const dst = new Uint8ClampedArray(dstW * dstH * channels);
6643
+ for (let dy = 0;dy < dstH; dy++) {
6644
+ const srcY = Math.min(Math.floor(dy * srcH / dstH), srcH - 1);
6645
+ for (let dx = 0;dx < dstW; dx++) {
6646
+ const srcX = Math.min(Math.floor(dx * srcW / dstW), srcW - 1);
6647
+ const srcIdx = (srcY * srcW + srcX) * channels;
6648
+ const dstIdx = (dy * dstW + dx) * channels;
6649
+ for (let c = 0;c < channels; c++) {
6650
+ dst[dstIdx + c] = src[srcIdx + c];
6651
+ }
6652
+ }
6653
+ }
6654
+ return { data: dst, width: dstW, height: dstH, channels };
6655
+ });
6656
+ return { image };
6657
+ }
6573
6658
  var inputSchema51 = {
6574
6659
  type: "object",
6575
6660
  properties: {
@@ -6605,25 +6690,11 @@ class ImageResizeTask extends Task52 {
6605
6690
  static outputSchema() {
6606
6691
  return outputSchema50;
6607
6692
  }
6608
- async executeReactive(input, _output, _context) {
6609
- const { width: dstW, height: dstH } = input;
6610
- const image = await produceImageOutput(input.image, (img) => {
6611
- const { data: src, width: srcW, height: srcH, channels } = img;
6612
- const dst = new Uint8ClampedArray(dstW * dstH * channels);
6613
- for (let dy = 0;dy < dstH; dy++) {
6614
- const srcY = Math.min(Math.floor(dy * srcH / dstH), srcH - 1);
6615
- for (let dx = 0;dx < dstW; dx++) {
6616
- const srcX = Math.min(Math.floor(dx * srcW / dstW), srcW - 1);
6617
- const srcIdx = (srcY * srcW + srcX) * channels;
6618
- const dstIdx = (dy * dstW + dx) * channels;
6619
- for (let c = 0;c < channels; c++) {
6620
- dst[dstIdx + c] = src[srcIdx + c];
6621
- }
6622
- }
6623
- }
6624
- return { data: dst, width: dstW, height: dstH, channels };
6625
- });
6626
- return { image };
6693
+ async execute(input, _context) {
6694
+ return await resizeImage(input);
6695
+ }
6696
+ async executePreview(input, _context) {
6697
+ return await resizeImage(input);
6627
6698
  }
6628
6699
  }
6629
6700
  Workflow27.prototype.imageResize = CreateWorkflow26(ImageResizeTask);
@@ -6633,6 +6704,38 @@ import {
6633
6704
  Task as Task53,
6634
6705
  Workflow as Workflow28
6635
6706
  } from "@workglow/task-graph";
6707
+ async function rotateImage(input) {
6708
+ const { angle } = input;
6709
+ const image = await produceImageOutput(input.image, (img) => {
6710
+ const { data: src, width: srcW, height: srcH, channels } = img;
6711
+ const swap = angle === 90 || angle === 270;
6712
+ const dstW = swap ? srcH : srcW;
6713
+ const dstH = swap ? srcW : srcH;
6714
+ const dst = new Uint8ClampedArray(dstW * dstH * channels);
6715
+ for (let sy = 0;sy < srcH; sy++) {
6716
+ for (let sx = 0;sx < srcW; sx++) {
6717
+ let dx, dy;
6718
+ if (angle === 90) {
6719
+ dx = srcH - 1 - sy;
6720
+ dy = sx;
6721
+ } else if (angle === 180) {
6722
+ dx = srcW - 1 - sx;
6723
+ dy = srcH - 1 - sy;
6724
+ } else {
6725
+ dx = sy;
6726
+ dy = srcW - 1 - sx;
6727
+ }
6728
+ const srcIdx = (sy * srcW + sx) * channels;
6729
+ const dstIdx = (dy * dstW + dx) * channels;
6730
+ for (let c = 0;c < channels; c++) {
6731
+ dst[dstIdx + c] = src[srcIdx + c];
6732
+ }
6733
+ }
6734
+ }
6735
+ return { data: dst, width: dstW, height: dstH, channels };
6736
+ });
6737
+ return { image };
6738
+ }
6636
6739
  var inputSchema52 = {
6637
6740
  type: "object",
6638
6741
  properties: {
@@ -6667,37 +6770,11 @@ class ImageRotateTask extends Task53 {
6667
6770
  static outputSchema() {
6668
6771
  return outputSchema51;
6669
6772
  }
6670
- async executeReactive(input, _output, _context) {
6671
- const { angle } = input;
6672
- const image = await produceImageOutput(input.image, (img) => {
6673
- const { data: src, width: srcW, height: srcH, channels } = img;
6674
- const swap = angle === 90 || angle === 270;
6675
- const dstW = swap ? srcH : srcW;
6676
- const dstH = swap ? srcW : srcH;
6677
- const dst = new Uint8ClampedArray(dstW * dstH * channels);
6678
- for (let sy = 0;sy < srcH; sy++) {
6679
- for (let sx = 0;sx < srcW; sx++) {
6680
- let dx, dy;
6681
- if (angle === 90) {
6682
- dx = srcH - 1 - sy;
6683
- dy = sx;
6684
- } else if (angle === 180) {
6685
- dx = srcW - 1 - sx;
6686
- dy = srcH - 1 - sy;
6687
- } else {
6688
- dx = sy;
6689
- dy = srcW - 1 - sx;
6690
- }
6691
- const srcIdx = (sy * srcW + sx) * channels;
6692
- const dstIdx = (dy * dstW + dx) * channels;
6693
- for (let c = 0;c < channels; c++) {
6694
- dst[dstIdx + c] = src[srcIdx + c];
6695
- }
6696
- }
6697
- }
6698
- return { data: dst, width: dstW, height: dstH, channels };
6699
- });
6700
- return { image };
6773
+ async execute(input, _context) {
6774
+ return await rotateImage(input);
6775
+ }
6776
+ async executePreview(input, _context) {
6777
+ return await rotateImage(input);
6701
6778
  }
6702
6779
  }
6703
6780
  Workflow28.prototype.imageRotate = CreateWorkflow27(ImageRotateTask);
@@ -6707,6 +6784,32 @@ import {
6707
6784
  Task as Task54,
6708
6785
  Workflow as Workflow29
6709
6786
  } from "@workglow/task-graph";
6787
+ async function applySepia(input) {
6788
+ const image = await produceImageOutput(input.image, (img) => {
6789
+ const { data: src, width, height, channels } = img;
6790
+ const dst = new Uint8ClampedArray(src.length);
6791
+ const pixelCount = width * height;
6792
+ for (let i = 0;i < pixelCount; i++) {
6793
+ const idx = i * channels;
6794
+ const r = channels === 1 ? src[idx] : src[idx];
6795
+ const g = channels === 1 ? src[idx] : src[idx + 1];
6796
+ const b = channels === 1 ? src[idx] : src[idx + 2];
6797
+ const outR = r * 402 + g * 787 + b * 194 >> 10;
6798
+ const outG = r * 357 + g * 702 + b * 172 >> 10;
6799
+ const outB = r * 279 + g * 547 + b * 134 >> 10;
6800
+ dst[idx] = outR > 255 ? 255 : outR;
6801
+ if (channels >= 3) {
6802
+ dst[idx + 1] = outG > 255 ? 255 : outG;
6803
+ dst[idx + 2] = outB > 255 ? 255 : outB;
6804
+ }
6805
+ if (channels === 4) {
6806
+ dst[idx + 3] = src[idx + 3];
6807
+ }
6808
+ }
6809
+ return { data: dst, width, height, channels };
6810
+ });
6811
+ return { image };
6812
+ }
6710
6813
  var inputSchema53 = {
6711
6814
  type: "object",
6712
6815
  properties: {
@@ -6735,31 +6838,11 @@ class ImageSepiaTask extends Task54 {
6735
6838
  static outputSchema() {
6736
6839
  return outputSchema52;
6737
6840
  }
6738
- async executeReactive(input, _output, _context) {
6739
- const image = await produceImageOutput(input.image, (img) => {
6740
- const { data: src, width, height, channels } = img;
6741
- const dst = new Uint8ClampedArray(src.length);
6742
- const pixelCount = width * height;
6743
- for (let i = 0;i < pixelCount; i++) {
6744
- const idx = i * channels;
6745
- const r = channels === 1 ? src[idx] : src[idx];
6746
- const g = channels === 1 ? src[idx] : src[idx + 1];
6747
- const b = channels === 1 ? src[idx] : src[idx + 2];
6748
- const outR = r * 402 + g * 787 + b * 194 >> 10;
6749
- const outG = r * 357 + g * 702 + b * 172 >> 10;
6750
- const outB = r * 279 + g * 547 + b * 134 >> 10;
6751
- dst[idx] = outR > 255 ? 255 : outR;
6752
- if (channels >= 3) {
6753
- dst[idx + 1] = outG > 255 ? 255 : outG;
6754
- dst[idx + 2] = outB > 255 ? 255 : outB;
6755
- }
6756
- if (channels === 4) {
6757
- dst[idx + 3] = src[idx + 3];
6758
- }
6759
- }
6760
- return { data: dst, width, height, channels };
6761
- });
6762
- return { image };
6841
+ async execute(input, _context) {
6842
+ return await applySepia(input);
6843
+ }
6844
+ async executePreview(input, _context) {
6845
+ return await applySepia(input);
6763
6846
  }
6764
6847
  }
6765
6848
  Workflow29.prototype.imageSepia = CreateWorkflow28(ImageSepiaTask);
@@ -6924,6 +7007,48 @@ function hasUsableBackgroundImage(value) {
6924
7007
  const candidate = value;
6925
7008
  return typeof candidate.width === "number" && typeof candidate.height === "number" && typeof candidate.channels === "number" && candidate.data !== undefined;
6926
7009
  }
7010
+ async function renderImageText(input) {
7011
+ const color = resolveColor2(input.color);
7012
+ const fontSize = input.fontSize ?? 24;
7013
+ const font = input.font ?? "sans-serif";
7014
+ const bold = input.bold ?? false;
7015
+ const italic = input.italic ?? false;
7016
+ const position = input.position ?? "middle-center";
7017
+ const backgroundImage = "image" in input ? input.image : undefined;
7018
+ let image;
7019
+ if (hasUsableBackgroundImage(backgroundImage)) {
7020
+ image = await produceImageOutput(backgroundImage, async (background) => {
7021
+ const overlay = await renderImageTextToRgba({
7022
+ text: input.text,
7023
+ font,
7024
+ fontSize,
7025
+ bold,
7026
+ italic,
7027
+ color,
7028
+ width: background.width,
7029
+ height: background.height,
7030
+ position
7031
+ });
7032
+ return compositeTextOverBackground(background, overlay);
7033
+ });
7034
+ } else {
7035
+ if (!("width" in input) || !("height" in input) || typeof input.width !== "number" || typeof input.height !== "number") {
7036
+ throw new Error("ImageTextTask: width and height are required when no background image is provided");
7037
+ }
7038
+ image = await renderImageTextToRgba({
7039
+ text: input.text,
7040
+ font,
7041
+ fontSize,
7042
+ bold,
7043
+ italic,
7044
+ color,
7045
+ width: input.width,
7046
+ height: input.height,
7047
+ position
7048
+ });
7049
+ }
7050
+ return { image };
7051
+ }
6927
7052
 
6928
7053
  class ImageTextTask extends Task55 {
6929
7054
  static type = "ImageTextTask";
@@ -6943,47 +7068,11 @@ class ImageTextTask extends Task55 {
6943
7068
  delete defaults.height;
6944
7069
  return defaults;
6945
7070
  }
6946
- async executeReactive(input, _output, _context) {
6947
- const color = resolveColor2(input.color);
6948
- const fontSize = input.fontSize ?? 24;
6949
- const font = input.font ?? "sans-serif";
6950
- const bold = input.bold ?? false;
6951
- const italic = input.italic ?? false;
6952
- const position = input.position ?? "middle-center";
6953
- const backgroundImage = "image" in input ? input.image : undefined;
6954
- let image;
6955
- if (hasUsableBackgroundImage(backgroundImage)) {
6956
- image = await produceImageOutput(backgroundImage, async (background) => {
6957
- const overlay = await renderImageTextToRgba({
6958
- text: input.text,
6959
- font,
6960
- fontSize,
6961
- bold,
6962
- italic,
6963
- color,
6964
- width: background.width,
6965
- height: background.height,
6966
- position
6967
- });
6968
- return compositeTextOverBackground(background, overlay);
6969
- });
6970
- } else {
6971
- if (!("width" in input) || !("height" in input) || typeof input.width !== "number" || typeof input.height !== "number") {
6972
- throw new Error("ImageTextTask: width and height are required when no background image is provided");
6973
- }
6974
- image = await renderImageTextToRgba({
6975
- text: input.text,
6976
- font,
6977
- fontSize,
6978
- bold,
6979
- italic,
6980
- color,
6981
- width: input.width,
6982
- height: input.height,
6983
- position
6984
- });
6985
- }
6986
- return { image };
7071
+ async execute(input, _context) {
7072
+ return await renderImageText(input);
7073
+ }
7074
+ async executePreview(input, _context) {
7075
+ return await renderImageText(input);
6987
7076
  }
6988
7077
  }
6989
7078
  Workflow30.prototype.imageText = CreateWorkflow29(ImageTextTask);
@@ -6993,6 +7082,26 @@ import {
6993
7082
  Task as Task56,
6994
7083
  Workflow as Workflow31
6995
7084
  } from "@workglow/task-graph";
7085
+ async function applyThreshold(input) {
7086
+ const threshold = input.threshold ?? 128;
7087
+ const image = await produceImageOutput(input.image, (img) => {
7088
+ const { data: src, width, height, channels } = img;
7089
+ const pixelCount = width * height;
7090
+ const dst = new Uint8ClampedArray(pixelCount);
7091
+ for (let i = 0;i < pixelCount; i++) {
7092
+ const idx = i * channels;
7093
+ let gray;
7094
+ if (channels === 1) {
7095
+ gray = src[idx];
7096
+ } else {
7097
+ gray = src[idx] * 77 + src[idx + 1] * 150 + src[idx + 2] * 29 >> 8;
7098
+ }
7099
+ dst[i] = gray >= threshold ? 255 : 0;
7100
+ }
7101
+ return { data: dst, width, height, channels: 1 };
7102
+ });
7103
+ return { image };
7104
+ }
6996
7105
  var inputSchema55 = {
6997
7106
  type: "object",
6998
7107
  properties: {
@@ -7029,25 +7138,11 @@ class ImageThresholdTask extends Task56 {
7029
7138
  static outputSchema() {
7030
7139
  return outputSchema54;
7031
7140
  }
7032
- async executeReactive(input, _output, _context) {
7033
- const threshold = input.threshold ?? 128;
7034
- const image = await produceImageOutput(input.image, (img) => {
7035
- const { data: src, width, height, channels } = img;
7036
- const pixelCount = width * height;
7037
- const dst = new Uint8ClampedArray(pixelCount);
7038
- for (let i = 0;i < pixelCount; i++) {
7039
- const idx = i * channels;
7040
- let gray;
7041
- if (channels === 1) {
7042
- gray = src[idx];
7043
- } else {
7044
- gray = src[idx] * 77 + src[idx + 1] * 150 + src[idx + 2] * 29 >> 8;
7045
- }
7046
- dst[i] = gray >= threshold ? 255 : 0;
7047
- }
7048
- return { data: dst, width, height, channels: 1 };
7049
- });
7050
- return { image };
7141
+ async execute(input, _context) {
7142
+ return await applyThreshold(input);
7143
+ }
7144
+ async executePreview(input, _context) {
7145
+ return await applyThreshold(input);
7051
7146
  }
7052
7147
  }
7053
7148
  Workflow31.prototype.imageThreshold = CreateWorkflow30(ImageThresholdTask);
@@ -7058,6 +7153,40 @@ import {
7058
7153
  Workflow as Workflow32
7059
7154
  } from "@workglow/task-graph";
7060
7155
  import { resolveColor as resolveColor3 } from "@workglow/util/media";
7156
+ async function applyTint(input) {
7157
+ const { r: tr, g: tg, b: tb } = resolveColor3(input.color);
7158
+ const amount = input.amount ?? 0.5;
7159
+ const invAmount = 1 - amount;
7160
+ const tintR = tr * amount;
7161
+ const tintG = tg * amount;
7162
+ const tintB = tb * amount;
7163
+ const image = await produceImageOutput(input.image, (img) => {
7164
+ const { data: src, width, height, channels } = img;
7165
+ const pixelCount = width * height;
7166
+ if (channels === 1) {
7167
+ const dst2 = new Uint8ClampedArray(pixelCount * 3);
7168
+ for (let i = 0;i < pixelCount; i++) {
7169
+ const gray = src[i];
7170
+ dst2[i * 3] = gray * invAmount + tintR;
7171
+ dst2[i * 3 + 1] = gray * invAmount + tintG;
7172
+ dst2[i * 3 + 2] = gray * invAmount + tintB;
7173
+ }
7174
+ return { data: dst2, width, height, channels: 3 };
7175
+ }
7176
+ const dst = new Uint8ClampedArray(src.length);
7177
+ for (let i = 0;i < pixelCount; i++) {
7178
+ const idx = i * channels;
7179
+ dst[idx] = src[idx] * invAmount + tintR;
7180
+ dst[idx + 1] = src[idx + 1] * invAmount + tintG;
7181
+ dst[idx + 2] = src[idx + 2] * invAmount + tintB;
7182
+ if (channels === 4) {
7183
+ dst[idx + 3] = src[idx + 3];
7184
+ }
7185
+ }
7186
+ return { data: dst, width, height, channels };
7187
+ });
7188
+ return { image };
7189
+ }
7061
7190
  var inputSchema56 = {
7062
7191
  type: "object",
7063
7192
  properties: {
@@ -7095,39 +7224,11 @@ class ImageTintTask extends Task57 {
7095
7224
  static outputSchema() {
7096
7225
  return outputSchema55;
7097
7226
  }
7098
- async executeReactive(input, _output, _context) {
7099
- const { r: tr, g: tg, b: tb } = resolveColor3(input.color);
7100
- const amount = input.amount ?? 0.5;
7101
- const invAmount = 1 - amount;
7102
- const tintR = tr * amount;
7103
- const tintG = tg * amount;
7104
- const tintB = tb * amount;
7105
- const image = await produceImageOutput(input.image, (img) => {
7106
- const { data: src, width, height, channels } = img;
7107
- const pixelCount = width * height;
7108
- if (channels === 1) {
7109
- const dst2 = new Uint8ClampedArray(pixelCount * 3);
7110
- for (let i = 0;i < pixelCount; i++) {
7111
- const gray = src[i];
7112
- dst2[i * 3] = gray * invAmount + tintR;
7113
- dst2[i * 3 + 1] = gray * invAmount + tintG;
7114
- dst2[i * 3 + 2] = gray * invAmount + tintB;
7115
- }
7116
- return { data: dst2, width, height, channels: 3 };
7117
- }
7118
- const dst = new Uint8ClampedArray(src.length);
7119
- for (let i = 0;i < pixelCount; i++) {
7120
- const idx = i * channels;
7121
- dst[idx] = src[idx] * invAmount + tintR;
7122
- dst[idx + 1] = src[idx + 1] * invAmount + tintG;
7123
- dst[idx + 2] = src[idx + 2] * invAmount + tintB;
7124
- if (channels === 4) {
7125
- dst[idx + 3] = src[idx + 3];
7126
- }
7127
- }
7128
- return { data: dst, width, height, channels };
7129
- });
7130
- return { image };
7227
+ async execute(input, _context) {
7228
+ return await applyTint(input);
7229
+ }
7230
+ async executePreview(input, _context) {
7231
+ return await applyTint(input);
7131
7232
  }
7132
7233
  }
7133
7234
  Workflow32.prototype.imageTint = CreateWorkflow31(ImageTintTask);
@@ -7137,6 +7238,26 @@ import {
7137
7238
  Task as Task58,
7138
7239
  Workflow as Workflow33
7139
7240
  } from "@workglow/task-graph";
7241
+ async function applyTransparency(input) {
7242
+ const { opacity } = input;
7243
+ const image = await produceImageOutput(input.image, (img) => {
7244
+ const { data: src, width, height, channels: srcCh } = img;
7245
+ const pixelCount = width * height;
7246
+ const dst = new Uint8ClampedArray(pixelCount * 4);
7247
+ const alphaScale = Math.round(opacity * 255);
7248
+ for (let i = 0;i < pixelCount; i++) {
7249
+ const srcIdx = i * srcCh;
7250
+ const dstIdx = i * 4;
7251
+ dst[dstIdx] = src[srcIdx];
7252
+ dst[dstIdx + 1] = srcCh >= 3 ? src[srcIdx + 1] : src[srcIdx];
7253
+ dst[dstIdx + 2] = srcCh >= 3 ? src[srcIdx + 2] : src[srcIdx];
7254
+ const srcAlpha = srcCh === 4 ? src[srcIdx + 3] : 255;
7255
+ dst[dstIdx + 3] = (srcAlpha * alphaScale + 127) / 255;
7256
+ }
7257
+ return { data: dst, width, height, channels: 4 };
7258
+ });
7259
+ return { image };
7260
+ }
7140
7261
  var inputSchema57 = {
7141
7262
  type: "object",
7142
7263
  properties: {
@@ -7175,25 +7296,11 @@ class ImageTransparencyTask extends Task58 {
7175
7296
  static outputSchema() {
7176
7297
  return outputSchema56;
7177
7298
  }
7178
- async executeReactive(input, _output, _context) {
7179
- const { opacity } = input;
7180
- const image = await produceImageOutput(input.image, (img) => {
7181
- const { data: src, width, height, channels: srcCh } = img;
7182
- const pixelCount = width * height;
7183
- const dst = new Uint8ClampedArray(pixelCount * 4);
7184
- const alphaScale = Math.round(opacity * 255);
7185
- for (let i = 0;i < pixelCount; i++) {
7186
- const srcIdx = i * srcCh;
7187
- const dstIdx = i * 4;
7188
- dst[dstIdx] = src[srcIdx];
7189
- dst[dstIdx + 1] = srcCh >= 3 ? src[srcIdx + 1] : src[srcIdx];
7190
- dst[dstIdx + 2] = srcCh >= 3 ? src[srcIdx + 2] : src[srcIdx];
7191
- const srcAlpha = srcCh === 4 ? src[srcIdx + 3] : 255;
7192
- dst[dstIdx + 3] = (srcAlpha * alphaScale + 127) / 255;
7193
- }
7194
- return { data: dst, width, height, channels: 4 };
7195
- });
7196
- return { image };
7299
+ async execute(input, _context) {
7300
+ return await applyTransparency(input);
7301
+ }
7302
+ async executePreview(input, _context) {
7303
+ return await applyTransparency(input);
7197
7304
  }
7198
7305
  }
7199
7306
  Workflow33.prototype.imageTransparency = CreateWorkflow32(ImageTransparencyTask);
@@ -7203,6 +7310,54 @@ import {
7203
7310
  Task as Task59,
7204
7311
  Workflow as Workflow34
7205
7312
  } from "@workglow/task-graph";
7313
+ async function applyWatermark(input) {
7314
+ const { spacing = 64, opacity = 0.3, pattern = "diagonal-lines" } = input;
7315
+ const image = await produceImageOutput(input.image, (img) => {
7316
+ const { data: src, width, height, channels: srcCh } = img;
7317
+ const outCh = 4;
7318
+ const dst = new Uint8ClampedArray(width * height * outCh);
7319
+ const lineWidth = 2;
7320
+ const dotRadius = Math.max(2, spacing >> 3);
7321
+ const dotRadiusSq = dotRadius * dotRadius;
7322
+ const half = spacing >> 1;
7323
+ const alpha = Math.round(opacity * 255);
7324
+ for (let y = 0;y < height; y++) {
7325
+ for (let x = 0;x < width; x++) {
7326
+ const srcIdx = (y * width + x) * srcCh;
7327
+ const dstIdx = (y * width + x) * outCh;
7328
+ const sr = src[srcIdx];
7329
+ const sg = srcCh >= 3 ? src[srcIdx + 1] : sr;
7330
+ const sb = srcCh >= 3 ? src[srcIdx + 2] : sr;
7331
+ const sa = srcCh === 4 ? src[srcIdx + 3] : 255;
7332
+ let isPattern = false;
7333
+ if (pattern === "diagonal-lines") {
7334
+ isPattern = (x + y) % spacing < lineWidth;
7335
+ } else if (pattern === "grid") {
7336
+ isPattern = x % spacing < lineWidth || y % spacing < lineWidth;
7337
+ } else {
7338
+ const dx = x % spacing - half;
7339
+ const dy = y % spacing - half;
7340
+ isPattern = dx * dx + dy * dy < dotRadiusSq;
7341
+ }
7342
+ if (isPattern) {
7343
+ const blend = alpha;
7344
+ const invBlend = 255 - blend;
7345
+ dst[dstIdx] = (sr * invBlend + 255 * blend + 127) / 255;
7346
+ dst[dstIdx + 1] = (sg * invBlend + 255 * blend + 127) / 255;
7347
+ dst[dstIdx + 2] = (sb * invBlend + 255 * blend + 127) / 255;
7348
+ dst[dstIdx + 3] = sa;
7349
+ } else {
7350
+ dst[dstIdx] = sr;
7351
+ dst[dstIdx + 1] = sg;
7352
+ dst[dstIdx + 2] = sb;
7353
+ dst[dstIdx + 3] = sa;
7354
+ }
7355
+ }
7356
+ }
7357
+ return { data: dst, width, height, channels: outCh };
7358
+ });
7359
+ return { image };
7360
+ }
7206
7361
  var inputSchema58 = {
7207
7362
  type: "object",
7208
7363
  properties: {
@@ -7253,58 +7408,19 @@ class ImageWatermarkTask extends Task59 {
7253
7408
  static outputSchema() {
7254
7409
  return outputSchema57;
7255
7410
  }
7256
- async executeReactive(input, _output, _context) {
7257
- const { spacing = 64, opacity = 0.3, pattern = "diagonal-lines" } = input;
7258
- const image = await produceImageOutput(input.image, (img) => {
7259
- const { data: src, width, height, channels: srcCh } = img;
7260
- const outCh = 4;
7261
- const dst = new Uint8ClampedArray(width * height * outCh);
7262
- const lineWidth = 2;
7263
- const dotRadius = Math.max(2, spacing >> 3);
7264
- const dotRadiusSq = dotRadius * dotRadius;
7265
- const half = spacing >> 1;
7266
- const alpha = Math.round(opacity * 255);
7267
- for (let y = 0;y < height; y++) {
7268
- for (let x = 0;x < width; x++) {
7269
- const srcIdx = (y * width + x) * srcCh;
7270
- const dstIdx = (y * width + x) * outCh;
7271
- const sr = src[srcIdx];
7272
- const sg = srcCh >= 3 ? src[srcIdx + 1] : sr;
7273
- const sb = srcCh >= 3 ? src[srcIdx + 2] : sr;
7274
- const sa = srcCh === 4 ? src[srcIdx + 3] : 255;
7275
- let isPattern = false;
7276
- if (pattern === "diagonal-lines") {
7277
- isPattern = (x + y) % spacing < lineWidth;
7278
- } else if (pattern === "grid") {
7279
- isPattern = x % spacing < lineWidth || y % spacing < lineWidth;
7280
- } else {
7281
- const dx = x % spacing - half;
7282
- const dy = y % spacing - half;
7283
- isPattern = dx * dx + dy * dy < dotRadiusSq;
7284
- }
7285
- if (isPattern) {
7286
- const blend = alpha;
7287
- const invBlend = 255 - blend;
7288
- dst[dstIdx] = (sr * invBlend + 255 * blend + 127) / 255;
7289
- dst[dstIdx + 1] = (sg * invBlend + 255 * blend + 127) / 255;
7290
- dst[dstIdx + 2] = (sb * invBlend + 255 * blend + 127) / 255;
7291
- dst[dstIdx + 3] = sa;
7292
- } else {
7293
- dst[dstIdx] = sr;
7294
- dst[dstIdx + 1] = sg;
7295
- dst[dstIdx + 2] = sb;
7296
- dst[dstIdx + 3] = sa;
7297
- }
7298
- }
7299
- }
7300
- return { data: dst, width, height, channels: outCh };
7301
- });
7302
- return { image };
7411
+ async execute(input, _context) {
7412
+ return await applyWatermark(input);
7413
+ }
7414
+ async executePreview(input, _context) {
7415
+ return await applyWatermark(input);
7303
7416
  }
7304
7417
  }
7305
7418
  Workflow34.prototype.imageWatermark = CreateWorkflow33(ImageWatermarkTask);
7306
7419
  // src/task/InputTask.ts
7307
7420
  import { CreateWorkflow as CreateWorkflow34, Task as Task60, Workflow as Workflow35 } from "@workglow/task-graph";
7421
+ function passthroughInput(input) {
7422
+ return input;
7423
+ }
7308
7424
 
7309
7425
  class InputTask extends Task60 {
7310
7426
  static type = "InputTask";
@@ -7334,8 +7450,11 @@ class InputTask extends Task60 {
7334
7450
  outputSchema() {
7335
7451
  return this.config?.outputSchema ?? this.constructor.outputSchema();
7336
7452
  }
7337
- async executeReactive(input) {
7338
- return input;
7453
+ async execute(input, _context) {
7454
+ return passthroughInput(input);
7455
+ }
7456
+ async executePreview(input) {
7457
+ return passthroughInput(input);
7339
7458
  }
7340
7459
  async* executeStream(input, context) {
7341
7460
  if (context.inputStreams) {
@@ -11831,6 +11950,23 @@ Interpreter["Status"] = Interpreter.Status;
11831
11950
 
11832
11951
  // src/task/JavaScriptTask.ts
11833
11952
  var isValidIdentifier = (key) => /^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(key);
11953
+ function runJavaScript(input2, configuredCode) {
11954
+ const output = {};
11955
+ const code = input2.javascript_code || configuredCode;
11956
+ if (code) {
11957
+ try {
11958
+ const inputVariables = Object.keys(input2).filter((key) => key !== "javascript_code").filter(isValidIdentifier);
11959
+ const inputVariablesString = inputVariables.map((key) => `var ${key} = ${JSON.stringify(input2[key])};`).join(`
11960
+ `);
11961
+ const myInterpreter = new Interpreter(`${inputVariablesString} ${code}`);
11962
+ myInterpreter.run();
11963
+ output.output = myInterpreter.value;
11964
+ } catch (e) {
11965
+ throw new TaskInvalidInputError3(`JavaScript execution failed: ${e instanceof Error ? e.message : String(e)}`);
11966
+ }
11967
+ }
11968
+ return output;
11969
+ }
11834
11970
  var configSchema = {
11835
11971
  type: "object",
11836
11972
  properties: {
@@ -11910,21 +12046,11 @@ class JavaScriptTask extends Task61 {
11910
12046
  }
11911
12047
  return inputSchema59;
11912
12048
  }
11913
- async executeReactive(input2, output) {
11914
- const code = input2.javascript_code || this.config.javascript_code;
11915
- if (code) {
11916
- try {
11917
- const inputVariables = Object.keys(input2).filter((key) => key !== "javascript_code").filter(isValidIdentifier);
11918
- const inputVariablesString = inputVariables.map((key) => `var ${key} = ${JSON.stringify(input2[key])};`).join(`
11919
- `);
11920
- const myInterpreter = new Interpreter(`${inputVariablesString} ${code}`);
11921
- myInterpreter.run();
11922
- output.output = myInterpreter.value;
11923
- } catch (e) {
11924
- throw new TaskInvalidInputError3(`JavaScript execution failed: ${e instanceof Error ? e.message : String(e)}`);
11925
- }
11926
- }
11927
- return output;
12049
+ async execute(input2) {
12050
+ return runJavaScript(input2, this.config.javascript_code);
12051
+ }
12052
+ async executePreview(input2) {
12053
+ return runJavaScript(input2, this.config.javascript_code);
11928
12054
  }
11929
12055
  }
11930
12056
  var javaScript = (input2, config = {}) => {
@@ -11985,6 +12111,10 @@ function resolvePath(obj, segments) {
11985
12111
  const next2 = obj[head];
11986
12112
  return resolvePath(next2, tail);
11987
12113
  }
12114
+ function extractJsonPath(value, path) {
12115
+ const segments = path.split(".");
12116
+ return resolvePath(value, segments);
12117
+ }
11988
12118
 
11989
12119
  class JsonPathTask extends Task62 {
11990
12120
  static type = "JsonPathTask";
@@ -11997,10 +12127,11 @@ class JsonPathTask extends Task62 {
11997
12127
  static outputSchema() {
11998
12128
  return outputSchema59;
11999
12129
  }
12000
- async executeReactive(input2, _output, _context) {
12001
- const segments = input2.path.split(".");
12002
- const result = resolvePath(input2.value, segments);
12003
- return { result };
12130
+ async execute(input2, _context) {
12131
+ return { result: extractJsonPath(input2.value, input2.path) };
12132
+ }
12133
+ async executePreview(input2, _context) {
12134
+ return { result: extractJsonPath(input2.value, input2.path) };
12004
12135
  }
12005
12136
  }
12006
12137
  Workflow37.prototype.jsonPath = CreateWorkflow36(JsonPathTask);
@@ -12094,7 +12225,7 @@ var lambdaTaskConfigSchema = {
12094
12225
  properties: {
12095
12226
  ...TaskConfigSchema33["properties"],
12096
12227
  execute: {},
12097
- executeReactive: {}
12228
+ executePreview: {}
12098
12229
  },
12099
12230
  additionalProperties: false
12100
12231
  };
@@ -12138,8 +12269,8 @@ class LambdaTask extends Task63 {
12138
12269
  return false;
12139
12270
  }
12140
12271
  constructor(config = {}) {
12141
- if (!config.execute && !config.executeReactive) {
12142
- throw new TaskConfigurationError4("LambdaTask must have either execute or executeReactive function in config");
12272
+ if (!config.execute && !config.executePreview) {
12273
+ throw new TaskConfigurationError4("LambdaTask must have either execute or executePreview function in config");
12143
12274
  }
12144
12275
  super(config);
12145
12276
  }
@@ -12149,11 +12280,11 @@ class LambdaTask extends Task63 {
12149
12280
  }
12150
12281
  return {};
12151
12282
  }
12152
- async executeReactive(input2, output, context) {
12153
- if (typeof this.config.executeReactive === "function") {
12154
- return await this.config.executeReactive(input2, output, context) ?? output;
12283
+ async executePreview(input2, context) {
12284
+ if (typeof this.config.executePreview === "function") {
12285
+ return await this.config.executePreview(input2, context);
12155
12286
  }
12156
- return output;
12287
+ return;
12157
12288
  }
12158
12289
  }
12159
12290
  function lambda(input2, config) {
@@ -13433,6 +13564,9 @@ var merge = (input2, config = {}) => {
13433
13564
  Workflow45.prototype.merge = CreateWorkflow44(MergeTask);
13434
13565
  // src/task/OutputTask.ts
13435
13566
  import { CreateWorkflow as CreateWorkflow45, Task as Task70, Workflow as Workflow46 } from "@workglow/task-graph";
13567
+ function passthroughInput2(input2) {
13568
+ return input2;
13569
+ }
13436
13570
 
13437
13571
  class OutputTask extends Task70 {
13438
13572
  static type = "OutputTask";
@@ -13463,8 +13597,11 @@ class OutputTask extends Task70 {
13463
13597
  outputSchema() {
13464
13598
  return this.config?.outputSchema ?? this.constructor.outputSchema();
13465
13599
  }
13466
- async executeReactive(input2) {
13467
- return input2;
13600
+ async execute(input2, _context) {
13601
+ return passthroughInput2(input2);
13602
+ }
13603
+ async executePreview(input2) {
13604
+ return passthroughInput2(input2);
13468
13605
  }
13469
13606
  async* executeStream(input2, context) {
13470
13607
  if (context.inputStreams) {
@@ -13500,6 +13637,32 @@ function hasNestedQuantifiers(pattern) {
13500
13637
  const withoutClasses = pattern.replace(/\[(?:[^\]\\]|\\.)*\]/g, "X");
13501
13638
  return /\([^)]*[+*][^)]*\)[+*?]|\([^)]*[+*][^)]*\)\{/.test(withoutClasses);
13502
13639
  }
13640
+ function executeRegex(input2) {
13641
+ const bracketCount = (input2.pattern.match(/\[/g) ?? []).length;
13642
+ if (bracketCount > MAX_BRACKET_COUNT) {
13643
+ throw new TaskInvalidInputError4("Regex pattern rejected: too many '[' characters (potential ReDoS). " + "Simplify the pattern to reduce complexity.");
13644
+ }
13645
+ if (hasNestedQuantifiers(input2.pattern)) {
13646
+ throw new TaskInvalidInputError4("Regex pattern rejected: nested quantifiers detected (potential ReDoS). " + "Simplify the pattern to avoid catastrophic backtracking.");
13647
+ }
13648
+ const flags = input2.flags ?? "";
13649
+ const regex = new RegExp(input2.pattern, flags);
13650
+ if (flags.includes("g")) {
13651
+ const allMatches = Array.from(input2.value.matchAll(new RegExp(input2.pattern, flags)));
13652
+ return {
13653
+ match: allMatches.length > 0,
13654
+ matches: allMatches.map((m) => m[0])
13655
+ };
13656
+ }
13657
+ const result = regex.exec(input2.value);
13658
+ if (!result) {
13659
+ return { match: false, matches: [] };
13660
+ }
13661
+ return {
13662
+ match: true,
13663
+ matches: result.slice(0)
13664
+ };
13665
+ }
13503
13666
  var inputSchema65 = {
13504
13667
  type: "object",
13505
13668
  properties: {
@@ -13553,31 +13716,11 @@ class RegexTask extends Task71 {
13553
13716
  static outputSchema() {
13554
13717
  return outputSchema64;
13555
13718
  }
13556
- async executeReactive(input2, _output, _context) {
13557
- const bracketCount = (input2.pattern.match(/\[/g) ?? []).length;
13558
- if (bracketCount > MAX_BRACKET_COUNT) {
13559
- throw new TaskInvalidInputError4("Regex pattern rejected: too many '[' characters (potential ReDoS). " + "Simplify the pattern to reduce complexity.");
13560
- }
13561
- if (hasNestedQuantifiers(input2.pattern)) {
13562
- throw new TaskInvalidInputError4("Regex pattern rejected: nested quantifiers detected (potential ReDoS). " + "Simplify the pattern to avoid catastrophic backtracking.");
13563
- }
13564
- const flags = input2.flags ?? "";
13565
- const regex = new RegExp(input2.pattern, flags);
13566
- if (flags.includes("g")) {
13567
- const allMatches = Array.from(input2.value.matchAll(new RegExp(input2.pattern, flags)));
13568
- return {
13569
- match: allMatches.length > 0,
13570
- matches: allMatches.map((m) => m[0])
13571
- };
13572
- }
13573
- const result = regex.exec(input2.value);
13574
- if (!result) {
13575
- return { match: false, matches: [] };
13576
- }
13577
- return {
13578
- match: true,
13579
- matches: result.slice(0)
13580
- };
13719
+ async execute(input2, _context) {
13720
+ return executeRegex(input2);
13721
+ }
13722
+ async executePreview(input2, _context) {
13723
+ return executeRegex(input2);
13581
13724
  }
13582
13725
  }
13583
13726
  Workflow47.prototype.regex = CreateWorkflow46(RegexTask);
@@ -13901,6 +14044,17 @@ var outputSchema72 = {
13901
14044
  properties: {},
13902
14045
  additionalProperties: true
13903
14046
  };
14047
+ function fanoutToIndexedOutputs(inputValue) {
14048
+ const output = {};
14049
+ if (Array.isArray(inputValue)) {
14050
+ inputValue.forEach((item, index) => {
14051
+ output[`output_${index}`] = item;
14052
+ });
14053
+ } else {
14054
+ output.output_0 = inputValue;
14055
+ }
14056
+ return output;
14057
+ }
13904
14058
 
13905
14059
  class SplitTask extends Task79 {
13906
14060
  static type = "SplitTask";
@@ -13914,17 +14068,11 @@ class SplitTask extends Task79 {
13914
14068
  static outputSchema() {
13915
14069
  return outputSchema72;
13916
14070
  }
13917
- async executeReactive(input2) {
13918
- const inputValue = input2.input;
13919
- const output = {};
13920
- if (Array.isArray(inputValue)) {
13921
- inputValue.forEach((item, index) => {
13922
- output[`output_${index}`] = item;
13923
- });
13924
- } else {
13925
- output.output_0 = inputValue;
13926
- }
13927
- return output;
14071
+ async execute(input2, _context) {
14072
+ return fanoutToIndexedOutputs(input2.input);
14073
+ }
14074
+ async executePreview(input2) {
14075
+ return fanoutToIndexedOutputs(input2.input);
13928
14076
  }
13929
14077
  }
13930
14078
  var split = (input2, config = {}) => {
@@ -13938,6 +14086,9 @@ import {
13938
14086
  Task as Task80,
13939
14087
  Workflow as Workflow56
13940
14088
  } from "@workglow/task-graph";
14089
+ function concatStrings(input2) {
14090
+ return Object.values(input2).join("");
14091
+ }
13941
14092
  var inputSchema74 = {
13942
14093
  type: "object",
13943
14094
  properties: {},
@@ -13967,8 +14118,11 @@ class StringConcatTask extends Task80 {
13967
14118
  static outputSchema() {
13968
14119
  return outputSchema73;
13969
14120
  }
13970
- async executeReactive(input2, _output, _context) {
13971
- return { text: Object.values(input2).join("") };
14121
+ async execute(input2, _context) {
14122
+ return { text: concatStrings(input2) };
14123
+ }
14124
+ async executePreview(input2, _context) {
14125
+ return { text: concatStrings(input2) };
13972
14126
  }
13973
14127
  }
13974
14128
  Workflow56.prototype.stringConcat = CreateWorkflow55(StringConcatTask);
@@ -13978,6 +14132,9 @@ import {
13978
14132
  Task as Task81,
13979
14133
  Workflow as Workflow57
13980
14134
  } from "@workglow/task-graph";
14135
+ function stringIncludes(text, search) {
14136
+ return text.includes(search);
14137
+ }
13981
14138
  var inputSchema75 = {
13982
14139
  type: "object",
13983
14140
  properties: {
@@ -14019,8 +14176,11 @@ class StringIncludesTask extends Task81 {
14019
14176
  static outputSchema() {
14020
14177
  return outputSchema74;
14021
14178
  }
14022
- async executeReactive(input2, _output, _context) {
14023
- return { included: input2.text.includes(input2.search) };
14179
+ async execute(input2, _context) {
14180
+ return { included: stringIncludes(input2.text, input2.search) };
14181
+ }
14182
+ async executePreview(input2, _context) {
14183
+ return { included: stringIncludes(input2.text, input2.search) };
14024
14184
  }
14025
14185
  }
14026
14186
  Workflow57.prototype.stringIncludes = CreateWorkflow56(StringIncludesTask);
@@ -14030,6 +14190,9 @@ import {
14030
14190
  Task as Task82,
14031
14191
  Workflow as Workflow58
14032
14192
  } from "@workglow/task-graph";
14193
+ function joinStrings(texts, separator) {
14194
+ return texts.join(separator ?? "");
14195
+ }
14033
14196
  var inputSchema76 = {
14034
14197
  type: "object",
14035
14198
  properties: {
@@ -14073,9 +14236,11 @@ class StringJoinTask extends Task82 {
14073
14236
  static outputSchema() {
14074
14237
  return outputSchema75;
14075
14238
  }
14076
- async executeReactive(input2, _output, _context) {
14077
- const separator = input2.separator ?? "";
14078
- return { text: input2.texts.join(separator) };
14239
+ async execute(input2, _context) {
14240
+ return { text: joinStrings(input2.texts, input2.separator) };
14241
+ }
14242
+ async executePreview(input2, _context) {
14243
+ return { text: joinStrings(input2.texts, input2.separator) };
14079
14244
  }
14080
14245
  }
14081
14246
  Workflow58.prototype.stringJoin = CreateWorkflow57(StringJoinTask);
@@ -14085,6 +14250,9 @@ import {
14085
14250
  Task as Task83,
14086
14251
  Workflow as Workflow59
14087
14252
  } from "@workglow/task-graph";
14253
+ function stringLength(text) {
14254
+ return text.length;
14255
+ }
14088
14256
  var inputSchema77 = {
14089
14257
  type: "object",
14090
14258
  properties: {
@@ -14121,8 +14289,11 @@ class StringLengthTask extends Task83 {
14121
14289
  static outputSchema() {
14122
14290
  return outputSchema76;
14123
14291
  }
14124
- async executeReactive(input2, _output, _context) {
14125
- return { length: input2.text.length };
14292
+ async execute(input2, _context) {
14293
+ return { length: stringLength(input2.text) };
14294
+ }
14295
+ async executePreview(input2, _context) {
14296
+ return { length: stringLength(input2.text) };
14126
14297
  }
14127
14298
  }
14128
14299
  Workflow59.prototype.stringLength = CreateWorkflow58(StringLengthTask);
@@ -14132,6 +14303,9 @@ import {
14132
14303
  Task as Task84,
14133
14304
  Workflow as Workflow60
14134
14305
  } from "@workglow/task-graph";
14306
+ function toLowerCase(text) {
14307
+ return text.toLowerCase();
14308
+ }
14135
14309
  var inputSchema78 = {
14136
14310
  type: "object",
14137
14311
  properties: {
@@ -14168,8 +14342,11 @@ class StringLowerCaseTask extends Task84 {
14168
14342
  static outputSchema() {
14169
14343
  return outputSchema77;
14170
14344
  }
14171
- async executeReactive(input2, _output, _context) {
14172
- return { text: input2.text.toLowerCase() };
14345
+ async execute(input2, _context) {
14346
+ return { text: toLowerCase(input2.text) };
14347
+ }
14348
+ async executePreview(input2, _context) {
14349
+ return { text: toLowerCase(input2.text) };
14173
14350
  }
14174
14351
  }
14175
14352
  Workflow60.prototype.stringLowerCase = CreateWorkflow59(StringLowerCaseTask);
@@ -14179,6 +14356,9 @@ import {
14179
14356
  Task as Task85,
14180
14357
  Workflow as Workflow61
14181
14358
  } from "@workglow/task-graph";
14359
+ function replaceString(text, search, replace) {
14360
+ return text.replaceAll(search, replace);
14361
+ }
14182
14362
  var inputSchema79 = {
14183
14363
  type: "object",
14184
14364
  properties: {
@@ -14225,8 +14405,11 @@ class StringReplaceTask extends Task85 {
14225
14405
  static outputSchema() {
14226
14406
  return outputSchema78;
14227
14407
  }
14228
- async executeReactive(input2, _output, _context) {
14229
- return { text: input2.text.replaceAll(input2.search, input2.replace) };
14408
+ async execute(input2, _context) {
14409
+ return { text: replaceString(input2.text, input2.search, input2.replace) };
14410
+ }
14411
+ async executePreview(input2, _context) {
14412
+ return { text: replaceString(input2.text, input2.search, input2.replace) };
14230
14413
  }
14231
14414
  }
14232
14415
  Workflow61.prototype.stringReplace = CreateWorkflow60(StringReplaceTask);
@@ -14236,6 +14419,9 @@ import {
14236
14419
  Task as Task86,
14237
14420
  Workflow as Workflow62
14238
14421
  } from "@workglow/task-graph";
14422
+ function sliceString(text, start, end) {
14423
+ return text.slice(start, end);
14424
+ }
14239
14425
  var inputSchema80 = {
14240
14426
  type: "object",
14241
14427
  properties: {
@@ -14282,8 +14468,11 @@ class StringSliceTask extends Task86 {
14282
14468
  static outputSchema() {
14283
14469
  return outputSchema79;
14284
14470
  }
14285
- async executeReactive(input2, _output, _context) {
14286
- return { text: input2.text.slice(input2.start, input2.end) };
14471
+ async execute(input2, _context) {
14472
+ return { text: sliceString(input2.text, input2.start, input2.end) };
14473
+ }
14474
+ async executePreview(input2, _context) {
14475
+ return { text: sliceString(input2.text, input2.start, input2.end) };
14287
14476
  }
14288
14477
  }
14289
14478
  Workflow62.prototype.stringSlice = CreateWorkflow61(StringSliceTask);
@@ -14293,6 +14482,13 @@ import {
14293
14482
  Task as Task87,
14294
14483
  Workflow as Workflow63
14295
14484
  } from "@workglow/task-graph";
14485
+ function renderStringTemplate(template, values) {
14486
+ let text = template;
14487
+ for (const [key, value] of Object.entries(values)) {
14488
+ text = text.replaceAll(`{{${key}}}`, String(value));
14489
+ }
14490
+ return text;
14491
+ }
14296
14492
  var inputSchema81 = {
14297
14493
  type: "object",
14298
14494
  properties: {
@@ -14335,12 +14531,11 @@ class StringTemplateTask extends Task87 {
14335
14531
  static outputSchema() {
14336
14532
  return outputSchema80;
14337
14533
  }
14338
- async executeReactive(input2, _output, _context) {
14339
- let text = input2.template;
14340
- for (const [key, value] of Object.entries(input2.values)) {
14341
- text = text.replaceAll(`{{${key}}}`, String(value));
14342
- }
14343
- return { text };
14534
+ async execute(input2, _context) {
14535
+ return { text: renderStringTemplate(input2.template, input2.values) };
14536
+ }
14537
+ async executePreview(input2, _context) {
14538
+ return { text: renderStringTemplate(input2.template, input2.values) };
14344
14539
  }
14345
14540
  }
14346
14541
  Workflow63.prototype.stringTemplate = CreateWorkflow62(StringTemplateTask);
@@ -14350,6 +14545,9 @@ import {
14350
14545
  Task as Task88,
14351
14546
  Workflow as Workflow64
14352
14547
  } from "@workglow/task-graph";
14548
+ function trimString(text) {
14549
+ return text.trim();
14550
+ }
14353
14551
  var inputSchema82 = {
14354
14552
  type: "object",
14355
14553
  properties: {
@@ -14386,8 +14584,11 @@ class StringTrimTask extends Task88 {
14386
14584
  static outputSchema() {
14387
14585
  return outputSchema81;
14388
14586
  }
14389
- async executeReactive(input2, _output, _context) {
14390
- return { text: input2.text.trim() };
14587
+ async execute(input2, _context) {
14588
+ return { text: trimString(input2.text) };
14589
+ }
14590
+ async executePreview(input2, _context) {
14591
+ return { text: trimString(input2.text) };
14391
14592
  }
14392
14593
  }
14393
14594
  Workflow64.prototype.stringTrim = CreateWorkflow63(StringTrimTask);
@@ -14397,6 +14598,9 @@ import {
14397
14598
  Task as Task89,
14398
14599
  Workflow as Workflow65
14399
14600
  } from "@workglow/task-graph";
14601
+ function toUpperCase(text) {
14602
+ return text.toUpperCase();
14603
+ }
14400
14604
  var inputSchema83 = {
14401
14605
  type: "object",
14402
14606
  properties: {
@@ -14433,8 +14637,11 @@ class StringUpperCaseTask extends Task89 {
14433
14637
  static outputSchema() {
14434
14638
  return outputSchema82;
14435
14639
  }
14436
- async executeReactive(input2, _output, _context) {
14437
- return { text: input2.text.toUpperCase() };
14640
+ async execute(input2, _context) {
14641
+ return { text: toUpperCase(input2.text) };
14642
+ }
14643
+ async executePreview(input2, _context) {
14644
+ return { text: toUpperCase(input2.text) };
14438
14645
  }
14439
14646
  }
14440
14647
  Workflow65.prototype.stringUpperCase = CreateWorkflow64(StringUpperCaseTask);
@@ -14444,6 +14651,24 @@ import {
14444
14651
  Task as Task90,
14445
14652
  Workflow as Workflow66
14446
14653
  } from "@workglow/task-graph";
14654
+ function renderTemplate(template, values) {
14655
+ return template.replace(/\{\{([^{}]+)\}\}/g, (_match, expr) => {
14656
+ const [path, defaultValue] = expr.split("|").map((s) => s.trim());
14657
+ const segments = path.split(".");
14658
+ let current = values;
14659
+ for (const segment of segments) {
14660
+ if (current === null || current === undefined || typeof current !== "object") {
14661
+ current = undefined;
14662
+ break;
14663
+ }
14664
+ current = current[segment];
14665
+ }
14666
+ if (current !== undefined && current !== null) {
14667
+ return String(current);
14668
+ }
14669
+ return defaultValue !== undefined ? defaultValue : "";
14670
+ });
14671
+ }
14447
14672
  var inputSchema84 = {
14448
14673
  type: "object",
14449
14674
  properties: {
@@ -14486,24 +14711,11 @@ class TemplateTask extends Task90 {
14486
14711
  static outputSchema() {
14487
14712
  return outputSchema83;
14488
14713
  }
14489
- async executeReactive(input2, _output, _context) {
14490
- const result = input2.template.replace(/\{\{([^}]+)\}\}/g, (_match, expr) => {
14491
- const [path, defaultValue] = expr.split("|").map((s) => s.trim());
14492
- const segments = path.split(".");
14493
- let current = input2.values;
14494
- for (const segment of segments) {
14495
- if (current === null || current === undefined || typeof current !== "object") {
14496
- current = undefined;
14497
- break;
14498
- }
14499
- current = current[segment];
14500
- }
14501
- if (current !== undefined && current !== null) {
14502
- return String(current);
14503
- }
14504
- return defaultValue !== undefined ? defaultValue : "";
14505
- });
14506
- return { result };
14714
+ async execute(input2, _context) {
14715
+ return { result: renderTemplate(input2.template, input2.values) };
14716
+ }
14717
+ async executePreview(input2, _context) {
14718
+ return { result: renderTemplate(input2.template, input2.values) };
14507
14719
  }
14508
14720
  }
14509
14721
  Workflow66.prototype.template = CreateWorkflow65(TemplateTask);
@@ -15506,4 +15718,4 @@ export {
15506
15718
  ArrayTask
15507
15719
  };
15508
15720
 
15509
- //# debugId=C12051EC74980D7364756E2164756E21
15721
+ //# debugId=55A0E96F7226DD2664756E2164756E21