@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/node.js CHANGED
@@ -2155,11 +2155,11 @@ class ArrayTaskRunner extends GraphAsTaskRunner {
2155
2155
  async executeTaskChildren(_input) {
2156
2156
  return super.executeTaskChildren({});
2157
2157
  }
2158
- async executeTaskChildrenReactive() {
2159
- return this.task.subGraph.runReactive({});
2158
+ async executeTaskChildrenPreview() {
2159
+ return this.task.subGraph.runPreview({});
2160
2160
  }
2161
- async executeTaskReactive(input, output) {
2162
- await super.executeTaskReactive(input, output);
2161
+ async executeTaskPreview(input) {
2162
+ await super.executeTaskPreview(input);
2163
2163
  if (this.task.hasChildren()) {
2164
2164
  this.task.runOutputData = this.task.executeMerge(input, this.task.runOutputData);
2165
2165
  }
@@ -4856,6 +4856,29 @@ import {
4856
4856
  Task as Task36,
4857
4857
  Workflow as Workflow11
4858
4858
  } from "@workglow/task-graph";
4859
+ function formatDate(input) {
4860
+ const dateInput = /^\d+$/.test(input.value) ? Number(input.value) : input.value;
4861
+ const date = new Date(dateInput);
4862
+ if (isNaN(date.getTime())) {
4863
+ throw new Error(`Invalid date: ${input.value}`);
4864
+ }
4865
+ const format = input.format ?? "iso";
4866
+ const locale = input.locale;
4867
+ const timeZone = input.timeZone;
4868
+ switch (format) {
4869
+ case "iso":
4870
+ return date.toISOString();
4871
+ case "date":
4872
+ return date.toLocaleDateString(locale, timeZone ? { timeZone } : undefined);
4873
+ case "time":
4874
+ return date.toLocaleTimeString(locale, timeZone ? { timeZone } : undefined);
4875
+ case "unix":
4876
+ return String(date.getTime());
4877
+ case "datetime":
4878
+ default:
4879
+ return date.toLocaleString(locale, timeZone ? { timeZone } : undefined);
4880
+ }
4881
+ }
4859
4882
  var inputSchema36 = {
4860
4883
  type: "object",
4861
4884
  properties: {
@@ -4910,35 +4933,11 @@ class DateFormatTask extends Task36 {
4910
4933
  static outputSchema() {
4911
4934
  return outputSchema36;
4912
4935
  }
4913
- async executeReactive(input, _output, _context) {
4914
- const dateInput = /^\d+$/.test(input.value) ? Number(input.value) : input.value;
4915
- const date = new Date(dateInput);
4916
- if (isNaN(date.getTime())) {
4917
- throw new Error(`Invalid date: ${input.value}`);
4918
- }
4919
- const format = input.format ?? "iso";
4920
- const locale = input.locale;
4921
- const timeZone = input.timeZone;
4922
- let result;
4923
- switch (format) {
4924
- case "iso":
4925
- result = date.toISOString();
4926
- break;
4927
- case "date":
4928
- result = date.toLocaleDateString(locale, timeZone ? { timeZone } : undefined);
4929
- break;
4930
- case "time":
4931
- result = date.toLocaleTimeString(locale, timeZone ? { timeZone } : undefined);
4932
- break;
4933
- case "unix":
4934
- result = String(date.getTime());
4935
- break;
4936
- case "datetime":
4937
- default:
4938
- result = date.toLocaleString(locale, timeZone ? { timeZone } : undefined);
4939
- break;
4940
- }
4941
- return { result };
4936
+ async execute(input, _context) {
4937
+ return { result: formatDate(input) };
4938
+ }
4939
+ async executePreview(input, _context) {
4940
+ return { result: formatDate(input) };
4942
4941
  }
4943
4942
  }
4944
4943
  Workflow11.prototype.dateFormat = CreateWorkflow10(DateFormatTask);
@@ -4970,6 +4969,17 @@ var outputSchema37 = {
4970
4969
  properties: {},
4971
4970
  additionalProperties: true
4972
4971
  };
4972
+ function logAndPassthrough(input, log_level) {
4973
+ const inputRecord = input;
4974
+ if (log_level === "dir") {
4975
+ console.dir(inputRecord, { depth: null });
4976
+ } else {
4977
+ console[log_level](inputRecord);
4978
+ }
4979
+ const output = {};
4980
+ Object.assign(output, inputRecord);
4981
+ return output;
4982
+ }
4973
4983
 
4974
4984
  class DebugLogTask extends Task37 {
4975
4985
  static type = "DebugLogTask";
@@ -4989,16 +4999,11 @@ class DebugLogTask extends Task37 {
4989
4999
  static outputSchema() {
4990
5000
  return outputSchema37;
4991
5001
  }
4992
- async executeReactive(input, output) {
4993
- const log_level = this.config.log_level ?? DEFAULT_LOG_LEVEL;
4994
- const inputRecord = input;
4995
- if (log_level === "dir") {
4996
- console.dir(inputRecord, { depth: null });
4997
- } else {
4998
- console[log_level](inputRecord);
4999
- }
5000
- Object.assign(output, inputRecord);
5001
- return output;
5002
+ async execute(input) {
5003
+ return logAndPassthrough(input, this.config.log_level ?? DEFAULT_LOG_LEVEL);
5004
+ }
5005
+ async executePreview(input) {
5006
+ return logAndPassthrough(input, this.config.log_level ?? DEFAULT_LOG_LEVEL);
5002
5007
  }
5003
5008
  }
5004
5009
  var debugLog = (input, config = {}) => {
@@ -5994,6 +5999,49 @@ async function produceImageOutput(inputImage, run) {
5994
5999
  }
5995
6000
 
5996
6001
  // src/task/image/ImageBlurTask.ts
6002
+ async function applyBlur(input) {
6003
+ const { radius = 1 } = input;
6004
+ const image = await produceImageOutput(input.image, (img) => {
6005
+ const { data: src, width, height, channels } = img;
6006
+ const kernelSize = radius * 2 + 1;
6007
+ const tmp = new Uint8ClampedArray(src.length);
6008
+ for (let y = 0;y < height; y++) {
6009
+ for (let c = 0;c < channels; c++) {
6010
+ let sum = 0;
6011
+ for (let k = -radius;k <= radius; k++) {
6012
+ const x = Math.max(0, Math.min(k, width - 1));
6013
+ sum += src[(y * width + x) * channels + c];
6014
+ }
6015
+ tmp[y * width * channels + c] = sum / kernelSize + 0.5 | 0;
6016
+ for (let x = 1;x < width; x++) {
6017
+ const addX = Math.min(x + radius, width - 1);
6018
+ const removeX = Math.max(x - radius - 1, 0);
6019
+ sum += src[(y * width + addX) * channels + c] - src[(y * width + removeX) * channels + c];
6020
+ tmp[(y * width + x) * channels + c] = sum / kernelSize + 0.5 | 0;
6021
+ }
6022
+ }
6023
+ }
6024
+ const dst = new Uint8ClampedArray(src.length);
6025
+ for (let x = 0;x < width; x++) {
6026
+ for (let c = 0;c < channels; c++) {
6027
+ let sum = 0;
6028
+ for (let k = -radius;k <= radius; k++) {
6029
+ const y = Math.max(0, Math.min(k, height - 1));
6030
+ sum += tmp[(y * width + x) * channels + c];
6031
+ }
6032
+ dst[x * channels + c] = sum / kernelSize + 0.5 | 0;
6033
+ for (let y = 1;y < height; y++) {
6034
+ const addY = Math.min(y + radius, height - 1);
6035
+ const removeY = Math.max(y - radius - 1, 0);
6036
+ sum += tmp[(addY * width + x) * channels + c] - tmp[(removeY * width + x) * channels + c];
6037
+ dst[(y * width + x) * channels + c] = sum / kernelSize + 0.5 | 0;
6038
+ }
6039
+ }
6040
+ }
6041
+ return { data: dst, width, height, channels };
6042
+ });
6043
+ return { image };
6044
+ }
5997
6045
  var inputSchema41 = {
5998
6046
  type: "object",
5999
6047
  properties: {
@@ -6030,48 +6078,11 @@ class ImageBlurTask extends Task42 {
6030
6078
  static outputSchema() {
6031
6079
  return outputSchema40;
6032
6080
  }
6033
- async executeReactive(input, _output, _context) {
6034
- const { radius = 1 } = input;
6035
- const image = await produceImageOutput(input.image, (img) => {
6036
- const { data: src, width, height, channels } = img;
6037
- const kernelSize = radius * 2 + 1;
6038
- const tmp = new Uint8ClampedArray(src.length);
6039
- for (let y = 0;y < height; y++) {
6040
- for (let c = 0;c < channels; c++) {
6041
- let sum = 0;
6042
- for (let k = -radius;k <= radius; k++) {
6043
- const x = Math.max(0, Math.min(k, width - 1));
6044
- sum += src[(y * width + x) * channels + c];
6045
- }
6046
- tmp[y * width * channels + c] = sum / kernelSize + 0.5 | 0;
6047
- for (let x = 1;x < width; x++) {
6048
- const addX = Math.min(x + radius, width - 1);
6049
- const removeX = Math.max(x - radius - 1, 0);
6050
- sum += src[(y * width + addX) * channels + c] - src[(y * width + removeX) * channels + c];
6051
- tmp[(y * width + x) * channels + c] = sum / kernelSize + 0.5 | 0;
6052
- }
6053
- }
6054
- }
6055
- const dst = new Uint8ClampedArray(src.length);
6056
- for (let x = 0;x < width; x++) {
6057
- for (let c = 0;c < channels; c++) {
6058
- let sum = 0;
6059
- for (let k = -radius;k <= radius; k++) {
6060
- const y = Math.max(0, Math.min(k, height - 1));
6061
- sum += tmp[(y * width + x) * channels + c];
6062
- }
6063
- dst[x * channels + c] = sum / kernelSize + 0.5 | 0;
6064
- for (let y = 1;y < height; y++) {
6065
- const addY = Math.min(y + radius, height - 1);
6066
- const removeY = Math.max(y - radius - 1, 0);
6067
- sum += tmp[(addY * width + x) * channels + c] - tmp[(removeY * width + x) * channels + c];
6068
- dst[(y * width + x) * channels + c] = sum / kernelSize + 0.5 | 0;
6069
- }
6070
- }
6071
- }
6072
- return { data: dst, width, height, channels };
6073
- });
6074
- return { image };
6081
+ async execute(input, _context) {
6082
+ return await applyBlur(input);
6083
+ }
6084
+ async executePreview(input, _context) {
6085
+ return await applyBlur(input);
6075
6086
  }
6076
6087
  }
6077
6088
  Workflow17.prototype.imageBlur = CreateWorkflow16(ImageBlurTask);
@@ -6082,6 +6093,39 @@ import {
6082
6093
  Workflow as Workflow18
6083
6094
  } from "@workglow/task-graph";
6084
6095
  import { resolveColor } from "@workglow/util/media";
6096
+ async function applyBorder(input) {
6097
+ const { borderWidth: bw = 1 } = input;
6098
+ const color = resolveColor(input.color);
6099
+ const image = await produceImageOutput(input.image, (img) => {
6100
+ const { data: src, width: srcW, height: srcH, channels: srcCh } = img;
6101
+ const outCh = 4;
6102
+ const dstW = srcW + bw * 2;
6103
+ const dstH = srcH + bw * 2;
6104
+ const dst = new Uint8ClampedArray(dstW * dstH * outCh);
6105
+ const r = color.r;
6106
+ const g = color.g;
6107
+ const b = color.b;
6108
+ const a = color.a;
6109
+ for (let i = 0;i < dst.length; i += outCh) {
6110
+ dst[i] = r;
6111
+ dst[i + 1] = g;
6112
+ dst[i + 2] = b;
6113
+ dst[i + 3] = a;
6114
+ }
6115
+ for (let y = 0;y < srcH; y++) {
6116
+ for (let x = 0;x < srcW; x++) {
6117
+ const srcIdx = (y * srcW + x) * srcCh;
6118
+ const dstIdx = ((y + bw) * dstW + (x + bw)) * outCh;
6119
+ dst[dstIdx] = src[srcIdx];
6120
+ dst[dstIdx + 1] = srcCh >= 3 ? src[srcIdx + 1] : src[srcIdx];
6121
+ dst[dstIdx + 2] = srcCh >= 3 ? src[srcIdx + 2] : src[srcIdx];
6122
+ dst[dstIdx + 3] = srcCh === 4 ? src[srcIdx + 3] : 255;
6123
+ }
6124
+ }
6125
+ return { data: dst, width: dstW, height: dstH, channels: outCh };
6126
+ });
6127
+ return { image };
6128
+ }
6085
6129
  var inputSchema42 = {
6086
6130
  type: "object",
6087
6131
  properties: {
@@ -6118,38 +6162,11 @@ class ImageBorderTask extends Task43 {
6118
6162
  static outputSchema() {
6119
6163
  return outputSchema41;
6120
6164
  }
6121
- async executeReactive(input, _output, _context) {
6122
- const { borderWidth: bw = 1 } = input;
6123
- const color = resolveColor(input.color);
6124
- const image = await produceImageOutput(input.image, (img) => {
6125
- const { data: src, width: srcW, height: srcH, channels: srcCh } = img;
6126
- const outCh = 4;
6127
- const dstW = srcW + bw * 2;
6128
- const dstH = srcH + bw * 2;
6129
- const dst = new Uint8ClampedArray(dstW * dstH * outCh);
6130
- const r = color.r;
6131
- const g = color.g;
6132
- const b = color.b;
6133
- const a = color.a;
6134
- for (let i = 0;i < dst.length; i += outCh) {
6135
- dst[i] = r;
6136
- dst[i + 1] = g;
6137
- dst[i + 2] = b;
6138
- dst[i + 3] = a;
6139
- }
6140
- for (let y = 0;y < srcH; y++) {
6141
- for (let x = 0;x < srcW; x++) {
6142
- const srcIdx = (y * srcW + x) * srcCh;
6143
- const dstIdx = ((y + bw) * dstW + (x + bw)) * outCh;
6144
- dst[dstIdx] = src[srcIdx];
6145
- dst[dstIdx + 1] = srcCh >= 3 ? src[srcIdx + 1] : src[srcIdx];
6146
- dst[dstIdx + 2] = srcCh >= 3 ? src[srcIdx + 2] : src[srcIdx];
6147
- dst[dstIdx + 3] = srcCh === 4 ? src[srcIdx + 3] : 255;
6148
- }
6149
- }
6150
- return { data: dst, width: dstW, height: dstH, channels: outCh };
6151
- });
6152
- return { image };
6165
+ async execute(input, _context) {
6166
+ return await applyBorder(input);
6167
+ }
6168
+ async executePreview(input, _context) {
6169
+ return await applyBorder(input);
6153
6170
  }
6154
6171
  }
6155
6172
  Workflow18.prototype.imageBorder = CreateWorkflow17(ImageBorderTask);
@@ -6159,6 +6176,27 @@ import {
6159
6176
  Task as Task44,
6160
6177
  Workflow as Workflow19
6161
6178
  } from "@workglow/task-graph";
6179
+ async function applyBrightness(input) {
6180
+ const amount = input.amount ?? 0;
6181
+ const image = await produceImageOutput(input.image, (img) => {
6182
+ const { data: src, width, height, channels } = img;
6183
+ const dst = new Uint8ClampedArray(src.length);
6184
+ if (channels === 4) {
6185
+ for (let i = 0;i < src.length; i += 4) {
6186
+ dst[i] = src[i] + amount;
6187
+ dst[i + 1] = src[i + 1] + amount;
6188
+ dst[i + 2] = src[i + 2] + amount;
6189
+ dst[i + 3] = src[i + 3];
6190
+ }
6191
+ } else {
6192
+ for (let i = 0;i < src.length; i++) {
6193
+ dst[i] = src[i] + amount;
6194
+ }
6195
+ }
6196
+ return { data: dst, width, height, channels };
6197
+ });
6198
+ return { image };
6199
+ }
6162
6200
  var inputSchema43 = {
6163
6201
  type: "object",
6164
6202
  properties: {
@@ -6195,26 +6233,11 @@ class ImageBrightnessTask extends Task44 {
6195
6233
  static outputSchema() {
6196
6234
  return outputSchema42;
6197
6235
  }
6198
- async executeReactive(input, _output, _context) {
6199
- const amount = input.amount ?? 0;
6200
- const image = await produceImageOutput(input.image, (img) => {
6201
- const { data: src, width, height, channels } = img;
6202
- const dst = new Uint8ClampedArray(src.length);
6203
- if (channels === 4) {
6204
- for (let i = 0;i < src.length; i += 4) {
6205
- dst[i] = src[i] + amount;
6206
- dst[i + 1] = src[i + 1] + amount;
6207
- dst[i + 2] = src[i + 2] + amount;
6208
- dst[i + 3] = src[i + 3];
6209
- }
6210
- } else {
6211
- for (let i = 0;i < src.length; i++) {
6212
- dst[i] = src[i] + amount;
6213
- }
6214
- }
6215
- return { data: dst, width, height, channels };
6216
- });
6217
- return { image };
6236
+ async execute(input, _context) {
6237
+ return await applyBrightness(input);
6238
+ }
6239
+ async executePreview(input, _context) {
6240
+ return await applyBrightness(input);
6218
6241
  }
6219
6242
  }
6220
6243
  Workflow19.prototype.imageBrightness = CreateWorkflow18(ImageBrightnessTask);
@@ -6224,6 +6247,32 @@ import {
6224
6247
  Task as Task45,
6225
6248
  Workflow as Workflow20
6226
6249
  } from "@workglow/task-graph";
6250
+ async function applyContrast(input) {
6251
+ const amount = input.amount ?? 0;
6252
+ const image = await produceImageOutput(input.image, (img) => {
6253
+ const { data: src, width, height, channels } = img;
6254
+ const factor = 259 * (amount + 255) / (255 * (259 - amount));
6255
+ const lut = new Uint8ClampedArray(256);
6256
+ for (let i = 0;i < 256; i++) {
6257
+ lut[i] = factor * (i - 128) + 128;
6258
+ }
6259
+ const dst = new Uint8ClampedArray(src.length);
6260
+ if (channels === 4) {
6261
+ for (let i = 0;i < src.length; i += 4) {
6262
+ dst[i] = lut[src[i]];
6263
+ dst[i + 1] = lut[src[i + 1]];
6264
+ dst[i + 2] = lut[src[i + 2]];
6265
+ dst[i + 3] = src[i + 3];
6266
+ }
6267
+ } else {
6268
+ for (let i = 0;i < src.length; i++) {
6269
+ dst[i] = lut[src[i]];
6270
+ }
6271
+ }
6272
+ return { data: dst, width, height, channels };
6273
+ });
6274
+ return { image };
6275
+ }
6227
6276
  var inputSchema44 = {
6228
6277
  type: "object",
6229
6278
  properties: {
@@ -6260,31 +6309,11 @@ class ImageContrastTask extends Task45 {
6260
6309
  static outputSchema() {
6261
6310
  return outputSchema43;
6262
6311
  }
6263
- async executeReactive(input, _output, _context) {
6264
- const amount = input.amount ?? 0;
6265
- const image = await produceImageOutput(input.image, (img) => {
6266
- const { data: src, width, height, channels } = img;
6267
- const factor = 259 * (amount + 255) / (255 * (259 - amount));
6268
- const lut = new Uint8ClampedArray(256);
6269
- for (let i = 0;i < 256; i++) {
6270
- lut[i] = factor * (i - 128) + 128;
6271
- }
6272
- const dst = new Uint8ClampedArray(src.length);
6273
- if (channels === 4) {
6274
- for (let i = 0;i < src.length; i += 4) {
6275
- dst[i] = lut[src[i]];
6276
- dst[i + 1] = lut[src[i + 1]];
6277
- dst[i + 2] = lut[src[i + 2]];
6278
- dst[i + 3] = src[i + 3];
6279
- }
6280
- } else {
6281
- for (let i = 0;i < src.length; i++) {
6282
- dst[i] = lut[src[i]];
6283
- }
6284
- }
6285
- return { data: dst, width, height, channels };
6286
- });
6287
- return { image };
6312
+ async execute(input, _context) {
6313
+ return await applyContrast(input);
6314
+ }
6315
+ async executePreview(input, _context) {
6316
+ return await applyContrast(input);
6288
6317
  }
6289
6318
  }
6290
6319
  Workflow20.prototype.imageContrast = CreateWorkflow19(ImageContrastTask);
@@ -6294,6 +6323,31 @@ import {
6294
6323
  Task as Task46,
6295
6324
  Workflow as Workflow21
6296
6325
  } from "@workglow/task-graph";
6326
+ async function cropImage(input) {
6327
+ const { x: rawX, y: rawY, width: rawW, height: rawH } = input;
6328
+ const image = await produceImageOutput(input.image, (img) => {
6329
+ const { data: src, width: srcW, height: srcH, channels } = img;
6330
+ if (srcW < 1 || srcH < 1) {
6331
+ throw new RangeError("Cannot crop an empty image");
6332
+ }
6333
+ if (rawX < 0 || rawX >= srcW || rawY < 0 || rawY >= srcH) {
6334
+ throw new RangeError("Crop origin is outside the source image bounds");
6335
+ }
6336
+ const x = rawX;
6337
+ const y = rawY;
6338
+ const w = Math.min(rawW, srcW - x);
6339
+ const h = Math.min(rawH, srcH - y);
6340
+ const dst = new Uint8ClampedArray(w * h * channels);
6341
+ const rowBytes = w * channels;
6342
+ for (let row = 0;row < h; row++) {
6343
+ const srcOffset = ((y + row) * srcW + x) * channels;
6344
+ const dstOffset = row * rowBytes;
6345
+ dst.set(src.subarray(srcOffset, srcOffset + rowBytes), dstOffset);
6346
+ }
6347
+ return { data: dst, width: w, height: h, channels };
6348
+ });
6349
+ return { image };
6350
+ }
6297
6351
  var inputSchema45 = {
6298
6352
  type: "object",
6299
6353
  properties: {
@@ -6326,30 +6380,11 @@ class ImageCropTask extends Task46 {
6326
6380
  static outputSchema() {
6327
6381
  return outputSchema44;
6328
6382
  }
6329
- async executeReactive(input, _output, _context) {
6330
- const { x: rawX, y: rawY, width: rawW, height: rawH } = input;
6331
- const image = await produceImageOutput(input.image, (img) => {
6332
- const { data: src, width: srcW, height: srcH, channels } = img;
6333
- if (srcW < 1 || srcH < 1) {
6334
- throw new RangeError("Cannot crop an empty image");
6335
- }
6336
- if (rawX < 0 || rawX >= srcW || rawY < 0 || rawY >= srcH) {
6337
- throw new RangeError("Crop origin is outside the source image bounds");
6338
- }
6339
- const x = rawX;
6340
- const y = rawY;
6341
- const w = Math.min(rawW, srcW - x);
6342
- const h = Math.min(rawH, srcH - y);
6343
- const dst = new Uint8ClampedArray(w * h * channels);
6344
- const rowBytes = w * channels;
6345
- for (let row = 0;row < h; row++) {
6346
- const srcOffset = ((y + row) * srcW + x) * channels;
6347
- const dstOffset = row * rowBytes;
6348
- dst.set(src.subarray(srcOffset, srcOffset + rowBytes), dstOffset);
6349
- }
6350
- return { data: dst, width: w, height: h, channels };
6351
- });
6352
- return { image };
6383
+ async execute(input, _context) {
6384
+ return await cropImage(input);
6385
+ }
6386
+ async executePreview(input, _context) {
6387
+ return await cropImage(input);
6353
6388
  }
6354
6389
  }
6355
6390
  Workflow21.prototype.imageCrop = CreateWorkflow20(ImageCropTask);
@@ -6359,6 +6394,33 @@ import {
6359
6394
  Task as Task47,
6360
6395
  Workflow as Workflow22
6361
6396
  } from "@workglow/task-graph";
6397
+ async function flipImage(input) {
6398
+ const { direction } = input;
6399
+ const image = await produceImageOutput(input.image, (img) => {
6400
+ const { data: src, width, height, channels } = img;
6401
+ const dst = new Uint8ClampedArray(src.length);
6402
+ const rowBytes = width * channels;
6403
+ if (direction === "vertical") {
6404
+ for (let y = 0;y < height; y++) {
6405
+ const srcOffset = y * rowBytes;
6406
+ const dstOffset = (height - 1 - y) * rowBytes;
6407
+ dst.set(src.subarray(srcOffset, srcOffset + rowBytes), dstOffset);
6408
+ }
6409
+ } else {
6410
+ for (let y = 0;y < height; y++) {
6411
+ for (let x = 0;x < width; x++) {
6412
+ const srcIdx = (y * width + x) * channels;
6413
+ const dstIdx = (y * width + (width - 1 - x)) * channels;
6414
+ for (let c = 0;c < channels; c++) {
6415
+ dst[dstIdx + c] = src[srcIdx + c];
6416
+ }
6417
+ }
6418
+ }
6419
+ }
6420
+ return { data: dst, width, height, channels };
6421
+ });
6422
+ return { image };
6423
+ }
6362
6424
  var inputSchema46 = {
6363
6425
  type: "object",
6364
6426
  properties: {
@@ -6393,32 +6455,11 @@ class ImageFlipTask extends Task47 {
6393
6455
  static outputSchema() {
6394
6456
  return outputSchema45;
6395
6457
  }
6396
- async executeReactive(input, _output, _context) {
6397
- const { direction } = input;
6398
- const image = await produceImageOutput(input.image, (img) => {
6399
- const { data: src, width, height, channels } = img;
6400
- const dst = new Uint8ClampedArray(src.length);
6401
- const rowBytes = width * channels;
6402
- if (direction === "vertical") {
6403
- for (let y = 0;y < height; y++) {
6404
- const srcOffset = y * rowBytes;
6405
- const dstOffset = (height - 1 - y) * rowBytes;
6406
- dst.set(src.subarray(srcOffset, srcOffset + rowBytes), dstOffset);
6407
- }
6408
- } else {
6409
- for (let y = 0;y < height; y++) {
6410
- for (let x = 0;x < width; x++) {
6411
- const srcIdx = (y * width + x) * channels;
6412
- const dstIdx = (y * width + (width - 1 - x)) * channels;
6413
- for (let c = 0;c < channels; c++) {
6414
- dst[dstIdx + c] = src[srcIdx + c];
6415
- }
6416
- }
6417
- }
6418
- }
6419
- return { data: dst, width, height, channels };
6420
- });
6421
- return { image };
6458
+ async execute(input, _context) {
6459
+ return await flipImage(input);
6460
+ }
6461
+ async executePreview(input, _context) {
6462
+ return await flipImage(input);
6422
6463
  }
6423
6464
  }
6424
6465
  Workflow22.prototype.imageFlip = CreateWorkflow21(ImageFlipTask);
@@ -6428,6 +6469,22 @@ import {
6428
6469
  Task as Task48,
6429
6470
  Workflow as Workflow23
6430
6471
  } from "@workglow/task-graph";
6472
+ async function applyGrayscale(input) {
6473
+ const image = await produceImageOutput(input.image, (img) => {
6474
+ const { data: src, width, height, channels } = img;
6475
+ if (channels === 1) {
6476
+ return { data: new Uint8ClampedArray(src), width, height, channels: 1 };
6477
+ }
6478
+ const pixelCount = width * height;
6479
+ const dst = new Uint8ClampedArray(pixelCount);
6480
+ for (let i = 0;i < pixelCount; i++) {
6481
+ const idx = i * channels;
6482
+ dst[i] = src[idx] * 77 + src[idx + 1] * 150 + src[idx + 2] * 29 >> 8;
6483
+ }
6484
+ return { data: dst, width, height, channels: 1 };
6485
+ });
6486
+ return { image };
6487
+ }
6431
6488
  var inputSchema47 = {
6432
6489
  type: "object",
6433
6490
  properties: {
@@ -6456,21 +6513,11 @@ class ImageGrayscaleTask extends Task48 {
6456
6513
  static outputSchema() {
6457
6514
  return outputSchema46;
6458
6515
  }
6459
- async executeReactive(input, _output, _context) {
6460
- const image = await produceImageOutput(input.image, (img) => {
6461
- const { data: src, width, height, channels } = img;
6462
- if (channels === 1) {
6463
- return { data: new Uint8ClampedArray(src), width, height, channels: 1 };
6464
- }
6465
- const pixelCount = width * height;
6466
- const dst = new Uint8ClampedArray(pixelCount);
6467
- for (let i = 0;i < pixelCount; i++) {
6468
- const idx = i * channels;
6469
- dst[i] = src[idx] * 77 + src[idx + 1] * 150 + src[idx + 2] * 29 >> 8;
6470
- }
6471
- return { data: dst, width, height, channels: 1 };
6472
- });
6473
- return { image };
6516
+ async execute(input, _context) {
6517
+ return await applyGrayscale(input);
6518
+ }
6519
+ async executePreview(input, _context) {
6520
+ return await applyGrayscale(input);
6474
6521
  }
6475
6522
  }
6476
6523
  Workflow23.prototype.imageGrayscale = CreateWorkflow22(ImageGrayscaleTask);
@@ -6480,6 +6527,26 @@ import {
6480
6527
  Task as Task49,
6481
6528
  Workflow as Workflow24
6482
6529
  } from "@workglow/task-graph";
6530
+ async function invertImage(input) {
6531
+ const image = await produceImageOutput(input.image, (img) => {
6532
+ const { data: src, width, height, channels } = img;
6533
+ const dst = new Uint8ClampedArray(src.length);
6534
+ if (channels === 4) {
6535
+ for (let i = 0;i < src.length; i += 4) {
6536
+ dst[i] = 255 - src[i];
6537
+ dst[i + 1] = 255 - src[i + 1];
6538
+ dst[i + 2] = 255 - src[i + 2];
6539
+ dst[i + 3] = src[i + 3];
6540
+ }
6541
+ } else {
6542
+ for (let i = 0;i < src.length; i++) {
6543
+ dst[i] = 255 - src[i];
6544
+ }
6545
+ }
6546
+ return { data: dst, width, height, channels };
6547
+ });
6548
+ return { image };
6549
+ }
6483
6550
  var inputSchema48 = {
6484
6551
  type: "object",
6485
6552
  properties: {
@@ -6508,25 +6575,11 @@ class ImageInvertTask extends Task49 {
6508
6575
  static outputSchema() {
6509
6576
  return outputSchema47;
6510
6577
  }
6511
- async executeReactive(input, _output, _context) {
6512
- const image = await produceImageOutput(input.image, (img) => {
6513
- const { data: src, width, height, channels } = img;
6514
- const dst = new Uint8ClampedArray(src.length);
6515
- if (channels === 4) {
6516
- for (let i = 0;i < src.length; i += 4) {
6517
- dst[i] = 255 - src[i];
6518
- dst[i + 1] = 255 - src[i + 1];
6519
- dst[i + 2] = 255 - src[i + 2];
6520
- dst[i + 3] = src[i + 3];
6521
- }
6522
- } else {
6523
- for (let i = 0;i < src.length; i++) {
6524
- dst[i] = 255 - src[i];
6525
- }
6526
- }
6527
- return { data: dst, width, height, channels };
6528
- });
6529
- return { image };
6578
+ async execute(input, _context) {
6579
+ return await invertImage(input);
6580
+ }
6581
+ async executePreview(input, _context) {
6582
+ return await invertImage(input);
6530
6583
  }
6531
6584
  }
6532
6585
  Workflow24.prototype.imageInvert = CreateWorkflow23(ImageInvertTask);
@@ -6536,6 +6589,40 @@ import {
6536
6589
  Task as Task50,
6537
6590
  Workflow as Workflow25
6538
6591
  } from "@workglow/task-graph";
6592
+ async function pixelateImage(input) {
6593
+ const { blockSize = 8 } = input;
6594
+ const image = await produceImageOutput(input.image, (img) => {
6595
+ const { data: src, width, height, channels } = img;
6596
+ const dst = new Uint8ClampedArray(src.length);
6597
+ for (let by = 0;by < height; by += blockSize) {
6598
+ const blockH = Math.min(blockSize, height - by);
6599
+ for (let bx = 0;bx < width; bx += blockSize) {
6600
+ const blockW = Math.min(blockSize, width - bx);
6601
+ const blockArea = blockW * blockH;
6602
+ const sums = new Array(channels).fill(0);
6603
+ for (let y = by;y < by + blockH; y++) {
6604
+ for (let x = bx;x < bx + blockW; x++) {
6605
+ const idx = (y * width + x) * channels;
6606
+ for (let c = 0;c < channels; c++) {
6607
+ sums[c] += src[idx + c];
6608
+ }
6609
+ }
6610
+ }
6611
+ const avg = sums.map((s) => s / blockArea + 0.5 | 0);
6612
+ for (let y = by;y < by + blockH; y++) {
6613
+ for (let x = bx;x < bx + blockW; x++) {
6614
+ const idx = (y * width + x) * channels;
6615
+ for (let c = 0;c < channels; c++) {
6616
+ dst[idx + c] = avg[c];
6617
+ }
6618
+ }
6619
+ }
6620
+ }
6621
+ }
6622
+ return { data: dst, width, height, channels };
6623
+ });
6624
+ return { image };
6625
+ }
6539
6626
  var inputSchema49 = {
6540
6627
  type: "object",
6541
6628
  properties: {
@@ -6571,39 +6658,11 @@ class ImagePixelateTask extends Task50 {
6571
6658
  static outputSchema() {
6572
6659
  return outputSchema48;
6573
6660
  }
6574
- async executeReactive(input, _output, _context) {
6575
- const { blockSize = 8 } = input;
6576
- const image = await produceImageOutput(input.image, (img) => {
6577
- const { data: src, width, height, channels } = img;
6578
- const dst = new Uint8ClampedArray(src.length);
6579
- for (let by = 0;by < height; by += blockSize) {
6580
- const blockH = Math.min(blockSize, height - by);
6581
- for (let bx = 0;bx < width; bx += blockSize) {
6582
- const blockW = Math.min(blockSize, width - bx);
6583
- const blockArea = blockW * blockH;
6584
- const sums = new Array(channels).fill(0);
6585
- for (let y = by;y < by + blockH; y++) {
6586
- for (let x = bx;x < bx + blockW; x++) {
6587
- const idx = (y * width + x) * channels;
6588
- for (let c = 0;c < channels; c++) {
6589
- sums[c] += src[idx + c];
6590
- }
6591
- }
6592
- }
6593
- const avg = sums.map((s) => s / blockArea + 0.5 | 0);
6594
- for (let y = by;y < by + blockH; y++) {
6595
- for (let x = bx;x < bx + blockW; x++) {
6596
- const idx = (y * width + x) * channels;
6597
- for (let c = 0;c < channels; c++) {
6598
- dst[idx + c] = avg[c];
6599
- }
6600
- }
6601
- }
6602
- }
6603
- }
6604
- return { data: dst, width, height, channels };
6605
- });
6606
- return { image };
6661
+ async execute(input, _context) {
6662
+ return await pixelateImage(input);
6663
+ }
6664
+ async executePreview(input, _context) {
6665
+ return await pixelateImage(input);
6607
6666
  }
6608
6667
  }
6609
6668
  Workflow25.prototype.imagePixelate = CreateWorkflow24(ImagePixelateTask);
@@ -6613,6 +6672,32 @@ import {
6613
6672
  Task as Task51,
6614
6673
  Workflow as Workflow26
6615
6674
  } from "@workglow/task-graph";
6675
+ async function posterizeImage(input) {
6676
+ const levels = input.levels ?? 4;
6677
+ const image = await produceImageOutput(input.image, (img) => {
6678
+ const { data: src, width, height, channels } = img;
6679
+ const step = 255 / (levels - 1);
6680
+ const lut = new Uint8ClampedArray(256);
6681
+ for (let i = 0;i < 256; i++) {
6682
+ lut[i] = Math.round(Math.round(i / step) * step);
6683
+ }
6684
+ const dst = new Uint8ClampedArray(src.length);
6685
+ if (channels === 4) {
6686
+ for (let i = 0;i < src.length; i += 4) {
6687
+ dst[i] = lut[src[i]];
6688
+ dst[i + 1] = lut[src[i + 1]];
6689
+ dst[i + 2] = lut[src[i + 2]];
6690
+ dst[i + 3] = src[i + 3];
6691
+ }
6692
+ } else {
6693
+ for (let i = 0;i < src.length; i++) {
6694
+ dst[i] = lut[src[i]];
6695
+ }
6696
+ }
6697
+ return { data: dst, width, height, channels };
6698
+ });
6699
+ return { image };
6700
+ }
6616
6701
  var inputSchema50 = {
6617
6702
  type: "object",
6618
6703
  properties: {
@@ -6649,31 +6734,11 @@ class ImagePosterizeTask extends Task51 {
6649
6734
  static outputSchema() {
6650
6735
  return outputSchema49;
6651
6736
  }
6652
- async executeReactive(input, _output, _context) {
6653
- const levels = input.levels ?? 4;
6654
- const image = await produceImageOutput(input.image, (img) => {
6655
- const { data: src, width, height, channels } = img;
6656
- const step = 255 / (levels - 1);
6657
- const lut = new Uint8ClampedArray(256);
6658
- for (let i = 0;i < 256; i++) {
6659
- lut[i] = Math.round(Math.round(i / step) * step);
6660
- }
6661
- const dst = new Uint8ClampedArray(src.length);
6662
- if (channels === 4) {
6663
- for (let i = 0;i < src.length; i += 4) {
6664
- dst[i] = lut[src[i]];
6665
- dst[i + 1] = lut[src[i + 1]];
6666
- dst[i + 2] = lut[src[i + 2]];
6667
- dst[i + 3] = src[i + 3];
6668
- }
6669
- } else {
6670
- for (let i = 0;i < src.length; i++) {
6671
- dst[i] = lut[src[i]];
6672
- }
6673
- }
6674
- return { data: dst, width, height, channels };
6675
- });
6676
- return { image };
6737
+ async execute(input, _context) {
6738
+ return await posterizeImage(input);
6739
+ }
6740
+ async executePreview(input, _context) {
6741
+ return await posterizeImage(input);
6677
6742
  }
6678
6743
  }
6679
6744
  Workflow26.prototype.imagePosterize = CreateWorkflow25(ImagePosterizeTask);
@@ -6685,6 +6750,26 @@ import {
6685
6750
  Task as Task52,
6686
6751
  Workflow as Workflow27
6687
6752
  } from "@workglow/task-graph";
6753
+ async function resizeImage(input) {
6754
+ const { width: dstW, height: dstH } = input;
6755
+ const image = await produceImageOutput(input.image, (img) => {
6756
+ const { data: src, width: srcW, height: srcH, channels } = img;
6757
+ const dst = new Uint8ClampedArray(dstW * dstH * channels);
6758
+ for (let dy = 0;dy < dstH; dy++) {
6759
+ const srcY = Math.min(Math.floor(dy * srcH / dstH), srcH - 1);
6760
+ for (let dx = 0;dx < dstW; dx++) {
6761
+ const srcX = Math.min(Math.floor(dx * srcW / dstW), srcW - 1);
6762
+ const srcIdx = (srcY * srcW + srcX) * channels;
6763
+ const dstIdx = (dy * dstW + dx) * channels;
6764
+ for (let c = 0;c < channels; c++) {
6765
+ dst[dstIdx + c] = src[srcIdx + c];
6766
+ }
6767
+ }
6768
+ }
6769
+ return { data: dst, width: dstW, height: dstH, channels };
6770
+ });
6771
+ return { image };
6772
+ }
6688
6773
  var inputSchema51 = {
6689
6774
  type: "object",
6690
6775
  properties: {
@@ -6720,25 +6805,11 @@ class ImageResizeTask extends Task52 {
6720
6805
  static outputSchema() {
6721
6806
  return outputSchema50;
6722
6807
  }
6723
- async executeReactive(input, _output, _context) {
6724
- const { width: dstW, height: dstH } = input;
6725
- const image = await produceImageOutput(input.image, (img) => {
6726
- const { data: src, width: srcW, height: srcH, channels } = img;
6727
- const dst = new Uint8ClampedArray(dstW * dstH * channels);
6728
- for (let dy = 0;dy < dstH; dy++) {
6729
- const srcY = Math.min(Math.floor(dy * srcH / dstH), srcH - 1);
6730
- for (let dx = 0;dx < dstW; dx++) {
6731
- const srcX = Math.min(Math.floor(dx * srcW / dstW), srcW - 1);
6732
- const srcIdx = (srcY * srcW + srcX) * channels;
6733
- const dstIdx = (dy * dstW + dx) * channels;
6734
- for (let c = 0;c < channels; c++) {
6735
- dst[dstIdx + c] = src[srcIdx + c];
6736
- }
6737
- }
6738
- }
6739
- return { data: dst, width: dstW, height: dstH, channels };
6740
- });
6741
- return { image };
6808
+ async execute(input, _context) {
6809
+ return await resizeImage(input);
6810
+ }
6811
+ async executePreview(input, _context) {
6812
+ return await resizeImage(input);
6742
6813
  }
6743
6814
  }
6744
6815
  Workflow27.prototype.imageResize = CreateWorkflow26(ImageResizeTask);
@@ -6748,6 +6819,38 @@ import {
6748
6819
  Task as Task53,
6749
6820
  Workflow as Workflow28
6750
6821
  } from "@workglow/task-graph";
6822
+ async function rotateImage(input) {
6823
+ const { angle } = input;
6824
+ const image = await produceImageOutput(input.image, (img) => {
6825
+ const { data: src, width: srcW, height: srcH, channels } = img;
6826
+ const swap = angle === 90 || angle === 270;
6827
+ const dstW = swap ? srcH : srcW;
6828
+ const dstH = swap ? srcW : srcH;
6829
+ const dst = new Uint8ClampedArray(dstW * dstH * channels);
6830
+ for (let sy = 0;sy < srcH; sy++) {
6831
+ for (let sx = 0;sx < srcW; sx++) {
6832
+ let dx, dy;
6833
+ if (angle === 90) {
6834
+ dx = srcH - 1 - sy;
6835
+ dy = sx;
6836
+ } else if (angle === 180) {
6837
+ dx = srcW - 1 - sx;
6838
+ dy = srcH - 1 - sy;
6839
+ } else {
6840
+ dx = sy;
6841
+ dy = srcW - 1 - sx;
6842
+ }
6843
+ const srcIdx = (sy * srcW + sx) * channels;
6844
+ const dstIdx = (dy * dstW + dx) * channels;
6845
+ for (let c = 0;c < channels; c++) {
6846
+ dst[dstIdx + c] = src[srcIdx + c];
6847
+ }
6848
+ }
6849
+ }
6850
+ return { data: dst, width: dstW, height: dstH, channels };
6851
+ });
6852
+ return { image };
6853
+ }
6751
6854
  var inputSchema52 = {
6752
6855
  type: "object",
6753
6856
  properties: {
@@ -6782,37 +6885,11 @@ class ImageRotateTask extends Task53 {
6782
6885
  static outputSchema() {
6783
6886
  return outputSchema51;
6784
6887
  }
6785
- async executeReactive(input, _output, _context) {
6786
- const { angle } = input;
6787
- const image = await produceImageOutput(input.image, (img) => {
6788
- const { data: src, width: srcW, height: srcH, channels } = img;
6789
- const swap = angle === 90 || angle === 270;
6790
- const dstW = swap ? srcH : srcW;
6791
- const dstH = swap ? srcW : srcH;
6792
- const dst = new Uint8ClampedArray(dstW * dstH * channels);
6793
- for (let sy = 0;sy < srcH; sy++) {
6794
- for (let sx = 0;sx < srcW; sx++) {
6795
- let dx, dy;
6796
- if (angle === 90) {
6797
- dx = srcH - 1 - sy;
6798
- dy = sx;
6799
- } else if (angle === 180) {
6800
- dx = srcW - 1 - sx;
6801
- dy = srcH - 1 - sy;
6802
- } else {
6803
- dx = sy;
6804
- dy = srcW - 1 - sx;
6805
- }
6806
- const srcIdx = (sy * srcW + sx) * channels;
6807
- const dstIdx = (dy * dstW + dx) * channels;
6808
- for (let c = 0;c < channels; c++) {
6809
- dst[dstIdx + c] = src[srcIdx + c];
6810
- }
6811
- }
6812
- }
6813
- return { data: dst, width: dstW, height: dstH, channels };
6814
- });
6815
- return { image };
6888
+ async execute(input, _context) {
6889
+ return await rotateImage(input);
6890
+ }
6891
+ async executePreview(input, _context) {
6892
+ return await rotateImage(input);
6816
6893
  }
6817
6894
  }
6818
6895
  Workflow28.prototype.imageRotate = CreateWorkflow27(ImageRotateTask);
@@ -6822,6 +6899,32 @@ import {
6822
6899
  Task as Task54,
6823
6900
  Workflow as Workflow29
6824
6901
  } from "@workglow/task-graph";
6902
+ async function applySepia(input) {
6903
+ const image = await produceImageOutput(input.image, (img) => {
6904
+ const { data: src, width, height, channels } = img;
6905
+ const dst = new Uint8ClampedArray(src.length);
6906
+ const pixelCount = width * height;
6907
+ for (let i = 0;i < pixelCount; i++) {
6908
+ const idx = i * channels;
6909
+ const r = channels === 1 ? src[idx] : src[idx];
6910
+ const g = channels === 1 ? src[idx] : src[idx + 1];
6911
+ const b = channels === 1 ? src[idx] : src[idx + 2];
6912
+ const outR = r * 402 + g * 787 + b * 194 >> 10;
6913
+ const outG = r * 357 + g * 702 + b * 172 >> 10;
6914
+ const outB = r * 279 + g * 547 + b * 134 >> 10;
6915
+ dst[idx] = outR > 255 ? 255 : outR;
6916
+ if (channels >= 3) {
6917
+ dst[idx + 1] = outG > 255 ? 255 : outG;
6918
+ dst[idx + 2] = outB > 255 ? 255 : outB;
6919
+ }
6920
+ if (channels === 4) {
6921
+ dst[idx + 3] = src[idx + 3];
6922
+ }
6923
+ }
6924
+ return { data: dst, width, height, channels };
6925
+ });
6926
+ return { image };
6927
+ }
6825
6928
  var inputSchema53 = {
6826
6929
  type: "object",
6827
6930
  properties: {
@@ -6850,31 +6953,11 @@ class ImageSepiaTask extends Task54 {
6850
6953
  static outputSchema() {
6851
6954
  return outputSchema52;
6852
6955
  }
6853
- async executeReactive(input, _output, _context) {
6854
- const image = await produceImageOutput(input.image, (img) => {
6855
- const { data: src, width, height, channels } = img;
6856
- const dst = new Uint8ClampedArray(src.length);
6857
- const pixelCount = width * height;
6858
- for (let i = 0;i < pixelCount; i++) {
6859
- const idx = i * channels;
6860
- const r = channels === 1 ? src[idx] : src[idx];
6861
- const g = channels === 1 ? src[idx] : src[idx + 1];
6862
- const b = channels === 1 ? src[idx] : src[idx + 2];
6863
- const outR = r * 402 + g * 787 + b * 194 >> 10;
6864
- const outG = r * 357 + g * 702 + b * 172 >> 10;
6865
- const outB = r * 279 + g * 547 + b * 134 >> 10;
6866
- dst[idx] = outR > 255 ? 255 : outR;
6867
- if (channels >= 3) {
6868
- dst[idx + 1] = outG > 255 ? 255 : outG;
6869
- dst[idx + 2] = outB > 255 ? 255 : outB;
6870
- }
6871
- if (channels === 4) {
6872
- dst[idx + 3] = src[idx + 3];
6873
- }
6874
- }
6875
- return { data: dst, width, height, channels };
6876
- });
6877
- return { image };
6956
+ async execute(input, _context) {
6957
+ return await applySepia(input);
6958
+ }
6959
+ async executePreview(input, _context) {
6960
+ return await applySepia(input);
6878
6961
  }
6879
6962
  }
6880
6963
  Workflow29.prototype.imageSepia = CreateWorkflow28(ImageSepiaTask);
@@ -7039,6 +7122,48 @@ function hasUsableBackgroundImage(value) {
7039
7122
  const candidate = value;
7040
7123
  return typeof candidate.width === "number" && typeof candidate.height === "number" && typeof candidate.channels === "number" && candidate.data !== undefined;
7041
7124
  }
7125
+ async function renderImageText(input) {
7126
+ const color = resolveColor2(input.color);
7127
+ const fontSize = input.fontSize ?? 24;
7128
+ const font = input.font ?? "sans-serif";
7129
+ const bold = input.bold ?? false;
7130
+ const italic = input.italic ?? false;
7131
+ const position = input.position ?? "middle-center";
7132
+ const backgroundImage = "image" in input ? input.image : undefined;
7133
+ let image;
7134
+ if (hasUsableBackgroundImage(backgroundImage)) {
7135
+ image = await produceImageOutput(backgroundImage, async (background) => {
7136
+ const overlay = await renderImageTextToRgba({
7137
+ text: input.text,
7138
+ font,
7139
+ fontSize,
7140
+ bold,
7141
+ italic,
7142
+ color,
7143
+ width: background.width,
7144
+ height: background.height,
7145
+ position
7146
+ });
7147
+ return compositeTextOverBackground(background, overlay);
7148
+ });
7149
+ } else {
7150
+ if (!("width" in input) || !("height" in input) || typeof input.width !== "number" || typeof input.height !== "number") {
7151
+ throw new Error("ImageTextTask: width and height are required when no background image is provided");
7152
+ }
7153
+ image = await renderImageTextToRgba({
7154
+ text: input.text,
7155
+ font,
7156
+ fontSize,
7157
+ bold,
7158
+ italic,
7159
+ color,
7160
+ width: input.width,
7161
+ height: input.height,
7162
+ position
7163
+ });
7164
+ }
7165
+ return { image };
7166
+ }
7042
7167
 
7043
7168
  class ImageTextTask extends Task55 {
7044
7169
  static type = "ImageTextTask";
@@ -7058,47 +7183,11 @@ class ImageTextTask extends Task55 {
7058
7183
  delete defaults.height;
7059
7184
  return defaults;
7060
7185
  }
7061
- async executeReactive(input, _output, _context) {
7062
- const color = resolveColor2(input.color);
7063
- const fontSize = input.fontSize ?? 24;
7064
- const font = input.font ?? "sans-serif";
7065
- const bold = input.bold ?? false;
7066
- const italic = input.italic ?? false;
7067
- const position = input.position ?? "middle-center";
7068
- const backgroundImage = "image" in input ? input.image : undefined;
7069
- let image;
7070
- if (hasUsableBackgroundImage(backgroundImage)) {
7071
- image = await produceImageOutput(backgroundImage, async (background) => {
7072
- const overlay = await renderImageTextToRgba({
7073
- text: input.text,
7074
- font,
7075
- fontSize,
7076
- bold,
7077
- italic,
7078
- color,
7079
- width: background.width,
7080
- height: background.height,
7081
- position
7082
- });
7083
- return compositeTextOverBackground(background, overlay);
7084
- });
7085
- } else {
7086
- if (!("width" in input) || !("height" in input) || typeof input.width !== "number" || typeof input.height !== "number") {
7087
- throw new Error("ImageTextTask: width and height are required when no background image is provided");
7088
- }
7089
- image = await renderImageTextToRgba({
7090
- text: input.text,
7091
- font,
7092
- fontSize,
7093
- bold,
7094
- italic,
7095
- color,
7096
- width: input.width,
7097
- height: input.height,
7098
- position
7099
- });
7100
- }
7101
- return { image };
7186
+ async execute(input, _context) {
7187
+ return await renderImageText(input);
7188
+ }
7189
+ async executePreview(input, _context) {
7190
+ return await renderImageText(input);
7102
7191
  }
7103
7192
  }
7104
7193
  Workflow30.prototype.imageText = CreateWorkflow29(ImageTextTask);
@@ -7108,6 +7197,26 @@ import {
7108
7197
  Task as Task56,
7109
7198
  Workflow as Workflow31
7110
7199
  } from "@workglow/task-graph";
7200
+ async function applyThreshold(input) {
7201
+ const threshold = input.threshold ?? 128;
7202
+ const image = await produceImageOutput(input.image, (img) => {
7203
+ const { data: src, width, height, channels } = img;
7204
+ const pixelCount = width * height;
7205
+ const dst = new Uint8ClampedArray(pixelCount);
7206
+ for (let i = 0;i < pixelCount; i++) {
7207
+ const idx = i * channels;
7208
+ let gray;
7209
+ if (channels === 1) {
7210
+ gray = src[idx];
7211
+ } else {
7212
+ gray = src[idx] * 77 + src[idx + 1] * 150 + src[idx + 2] * 29 >> 8;
7213
+ }
7214
+ dst[i] = gray >= threshold ? 255 : 0;
7215
+ }
7216
+ return { data: dst, width, height, channels: 1 };
7217
+ });
7218
+ return { image };
7219
+ }
7111
7220
  var inputSchema55 = {
7112
7221
  type: "object",
7113
7222
  properties: {
@@ -7144,25 +7253,11 @@ class ImageThresholdTask extends Task56 {
7144
7253
  static outputSchema() {
7145
7254
  return outputSchema54;
7146
7255
  }
7147
- async executeReactive(input, _output, _context) {
7148
- const threshold = input.threshold ?? 128;
7149
- const image = await produceImageOutput(input.image, (img) => {
7150
- const { data: src, width, height, channels } = img;
7151
- const pixelCount = width * height;
7152
- const dst = new Uint8ClampedArray(pixelCount);
7153
- for (let i = 0;i < pixelCount; i++) {
7154
- const idx = i * channels;
7155
- let gray;
7156
- if (channels === 1) {
7157
- gray = src[idx];
7158
- } else {
7159
- gray = src[idx] * 77 + src[idx + 1] * 150 + src[idx + 2] * 29 >> 8;
7160
- }
7161
- dst[i] = gray >= threshold ? 255 : 0;
7162
- }
7163
- return { data: dst, width, height, channels: 1 };
7164
- });
7165
- return { image };
7256
+ async execute(input, _context) {
7257
+ return await applyThreshold(input);
7258
+ }
7259
+ async executePreview(input, _context) {
7260
+ return await applyThreshold(input);
7166
7261
  }
7167
7262
  }
7168
7263
  Workflow31.prototype.imageThreshold = CreateWorkflow30(ImageThresholdTask);
@@ -7173,6 +7268,40 @@ import {
7173
7268
  Workflow as Workflow32
7174
7269
  } from "@workglow/task-graph";
7175
7270
  import { resolveColor as resolveColor3 } from "@workglow/util/media";
7271
+ async function applyTint(input) {
7272
+ const { r: tr, g: tg, b: tb } = resolveColor3(input.color);
7273
+ const amount = input.amount ?? 0.5;
7274
+ const invAmount = 1 - amount;
7275
+ const tintR = tr * amount;
7276
+ const tintG = tg * amount;
7277
+ const tintB = tb * amount;
7278
+ const image = await produceImageOutput(input.image, (img) => {
7279
+ const { data: src, width, height, channels } = img;
7280
+ const pixelCount = width * height;
7281
+ if (channels === 1) {
7282
+ const dst2 = new Uint8ClampedArray(pixelCount * 3);
7283
+ for (let i = 0;i < pixelCount; i++) {
7284
+ const gray = src[i];
7285
+ dst2[i * 3] = gray * invAmount + tintR;
7286
+ dst2[i * 3 + 1] = gray * invAmount + tintG;
7287
+ dst2[i * 3 + 2] = gray * invAmount + tintB;
7288
+ }
7289
+ return { data: dst2, width, height, channels: 3 };
7290
+ }
7291
+ const dst = new Uint8ClampedArray(src.length);
7292
+ for (let i = 0;i < pixelCount; i++) {
7293
+ const idx = i * channels;
7294
+ dst[idx] = src[idx] * invAmount + tintR;
7295
+ dst[idx + 1] = src[idx + 1] * invAmount + tintG;
7296
+ dst[idx + 2] = src[idx + 2] * invAmount + tintB;
7297
+ if (channels === 4) {
7298
+ dst[idx + 3] = src[idx + 3];
7299
+ }
7300
+ }
7301
+ return { data: dst, width, height, channels };
7302
+ });
7303
+ return { image };
7304
+ }
7176
7305
  var inputSchema56 = {
7177
7306
  type: "object",
7178
7307
  properties: {
@@ -7210,39 +7339,11 @@ class ImageTintTask extends Task57 {
7210
7339
  static outputSchema() {
7211
7340
  return outputSchema55;
7212
7341
  }
7213
- async executeReactive(input, _output, _context) {
7214
- const { r: tr, g: tg, b: tb } = resolveColor3(input.color);
7215
- const amount = input.amount ?? 0.5;
7216
- const invAmount = 1 - amount;
7217
- const tintR = tr * amount;
7218
- const tintG = tg * amount;
7219
- const tintB = tb * amount;
7220
- const image = await produceImageOutput(input.image, (img) => {
7221
- const { data: src, width, height, channels } = img;
7222
- const pixelCount = width * height;
7223
- if (channels === 1) {
7224
- const dst2 = new Uint8ClampedArray(pixelCount * 3);
7225
- for (let i = 0;i < pixelCount; i++) {
7226
- const gray = src[i];
7227
- dst2[i * 3] = gray * invAmount + tintR;
7228
- dst2[i * 3 + 1] = gray * invAmount + tintG;
7229
- dst2[i * 3 + 2] = gray * invAmount + tintB;
7230
- }
7231
- return { data: dst2, width, height, channels: 3 };
7232
- }
7233
- const dst = new Uint8ClampedArray(src.length);
7234
- for (let i = 0;i < pixelCount; i++) {
7235
- const idx = i * channels;
7236
- dst[idx] = src[idx] * invAmount + tintR;
7237
- dst[idx + 1] = src[idx + 1] * invAmount + tintG;
7238
- dst[idx + 2] = src[idx + 2] * invAmount + tintB;
7239
- if (channels === 4) {
7240
- dst[idx + 3] = src[idx + 3];
7241
- }
7242
- }
7243
- return { data: dst, width, height, channels };
7244
- });
7245
- return { image };
7342
+ async execute(input, _context) {
7343
+ return await applyTint(input);
7344
+ }
7345
+ async executePreview(input, _context) {
7346
+ return await applyTint(input);
7246
7347
  }
7247
7348
  }
7248
7349
  Workflow32.prototype.imageTint = CreateWorkflow31(ImageTintTask);
@@ -7252,6 +7353,26 @@ import {
7252
7353
  Task as Task58,
7253
7354
  Workflow as Workflow33
7254
7355
  } from "@workglow/task-graph";
7356
+ async function applyTransparency(input) {
7357
+ const { opacity } = input;
7358
+ const image = await produceImageOutput(input.image, (img) => {
7359
+ const { data: src, width, height, channels: srcCh } = img;
7360
+ const pixelCount = width * height;
7361
+ const dst = new Uint8ClampedArray(pixelCount * 4);
7362
+ const alphaScale = Math.round(opacity * 255);
7363
+ for (let i = 0;i < pixelCount; i++) {
7364
+ const srcIdx = i * srcCh;
7365
+ const dstIdx = i * 4;
7366
+ dst[dstIdx] = src[srcIdx];
7367
+ dst[dstIdx + 1] = srcCh >= 3 ? src[srcIdx + 1] : src[srcIdx];
7368
+ dst[dstIdx + 2] = srcCh >= 3 ? src[srcIdx + 2] : src[srcIdx];
7369
+ const srcAlpha = srcCh === 4 ? src[srcIdx + 3] : 255;
7370
+ dst[dstIdx + 3] = (srcAlpha * alphaScale + 127) / 255;
7371
+ }
7372
+ return { data: dst, width, height, channels: 4 };
7373
+ });
7374
+ return { image };
7375
+ }
7255
7376
  var inputSchema57 = {
7256
7377
  type: "object",
7257
7378
  properties: {
@@ -7290,25 +7411,11 @@ class ImageTransparencyTask extends Task58 {
7290
7411
  static outputSchema() {
7291
7412
  return outputSchema56;
7292
7413
  }
7293
- async executeReactive(input, _output, _context) {
7294
- const { opacity } = input;
7295
- const image = await produceImageOutput(input.image, (img) => {
7296
- const { data: src, width, height, channels: srcCh } = img;
7297
- const pixelCount = width * height;
7298
- const dst = new Uint8ClampedArray(pixelCount * 4);
7299
- const alphaScale = Math.round(opacity * 255);
7300
- for (let i = 0;i < pixelCount; i++) {
7301
- const srcIdx = i * srcCh;
7302
- const dstIdx = i * 4;
7303
- dst[dstIdx] = src[srcIdx];
7304
- dst[dstIdx + 1] = srcCh >= 3 ? src[srcIdx + 1] : src[srcIdx];
7305
- dst[dstIdx + 2] = srcCh >= 3 ? src[srcIdx + 2] : src[srcIdx];
7306
- const srcAlpha = srcCh === 4 ? src[srcIdx + 3] : 255;
7307
- dst[dstIdx + 3] = (srcAlpha * alphaScale + 127) / 255;
7308
- }
7309
- return { data: dst, width, height, channels: 4 };
7310
- });
7311
- return { image };
7414
+ async execute(input, _context) {
7415
+ return await applyTransparency(input);
7416
+ }
7417
+ async executePreview(input, _context) {
7418
+ return await applyTransparency(input);
7312
7419
  }
7313
7420
  }
7314
7421
  Workflow33.prototype.imageTransparency = CreateWorkflow32(ImageTransparencyTask);
@@ -7318,6 +7425,54 @@ import {
7318
7425
  Task as Task59,
7319
7426
  Workflow as Workflow34
7320
7427
  } from "@workglow/task-graph";
7428
+ async function applyWatermark(input) {
7429
+ const { spacing = 64, opacity = 0.3, pattern = "diagonal-lines" } = input;
7430
+ const image = await produceImageOutput(input.image, (img) => {
7431
+ const { data: src, width, height, channels: srcCh } = img;
7432
+ const outCh = 4;
7433
+ const dst = new Uint8ClampedArray(width * height * outCh);
7434
+ const lineWidth = 2;
7435
+ const dotRadius = Math.max(2, spacing >> 3);
7436
+ const dotRadiusSq = dotRadius * dotRadius;
7437
+ const half = spacing >> 1;
7438
+ const alpha = Math.round(opacity * 255);
7439
+ for (let y = 0;y < height; y++) {
7440
+ for (let x = 0;x < width; x++) {
7441
+ const srcIdx = (y * width + x) * srcCh;
7442
+ const dstIdx = (y * width + x) * outCh;
7443
+ const sr = src[srcIdx];
7444
+ const sg = srcCh >= 3 ? src[srcIdx + 1] : sr;
7445
+ const sb = srcCh >= 3 ? src[srcIdx + 2] : sr;
7446
+ const sa = srcCh === 4 ? src[srcIdx + 3] : 255;
7447
+ let isPattern = false;
7448
+ if (pattern === "diagonal-lines") {
7449
+ isPattern = (x + y) % spacing < lineWidth;
7450
+ } else if (pattern === "grid") {
7451
+ isPattern = x % spacing < lineWidth || y % spacing < lineWidth;
7452
+ } else {
7453
+ const dx = x % spacing - half;
7454
+ const dy = y % spacing - half;
7455
+ isPattern = dx * dx + dy * dy < dotRadiusSq;
7456
+ }
7457
+ if (isPattern) {
7458
+ const blend = alpha;
7459
+ const invBlend = 255 - blend;
7460
+ dst[dstIdx] = (sr * invBlend + 255 * blend + 127) / 255;
7461
+ dst[dstIdx + 1] = (sg * invBlend + 255 * blend + 127) / 255;
7462
+ dst[dstIdx + 2] = (sb * invBlend + 255 * blend + 127) / 255;
7463
+ dst[dstIdx + 3] = sa;
7464
+ } else {
7465
+ dst[dstIdx] = sr;
7466
+ dst[dstIdx + 1] = sg;
7467
+ dst[dstIdx + 2] = sb;
7468
+ dst[dstIdx + 3] = sa;
7469
+ }
7470
+ }
7471
+ }
7472
+ return { data: dst, width, height, channels: outCh };
7473
+ });
7474
+ return { image };
7475
+ }
7321
7476
  var inputSchema58 = {
7322
7477
  type: "object",
7323
7478
  properties: {
@@ -7368,58 +7523,19 @@ class ImageWatermarkTask extends Task59 {
7368
7523
  static outputSchema() {
7369
7524
  return outputSchema57;
7370
7525
  }
7371
- async executeReactive(input, _output, _context) {
7372
- const { spacing = 64, opacity = 0.3, pattern = "diagonal-lines" } = input;
7373
- const image = await produceImageOutput(input.image, (img) => {
7374
- const { data: src, width, height, channels: srcCh } = img;
7375
- const outCh = 4;
7376
- const dst = new Uint8ClampedArray(width * height * outCh);
7377
- const lineWidth = 2;
7378
- const dotRadius = Math.max(2, spacing >> 3);
7379
- const dotRadiusSq = dotRadius * dotRadius;
7380
- const half = spacing >> 1;
7381
- const alpha = Math.round(opacity * 255);
7382
- for (let y = 0;y < height; y++) {
7383
- for (let x = 0;x < width; x++) {
7384
- const srcIdx = (y * width + x) * srcCh;
7385
- const dstIdx = (y * width + x) * outCh;
7386
- const sr = src[srcIdx];
7387
- const sg = srcCh >= 3 ? src[srcIdx + 1] : sr;
7388
- const sb = srcCh >= 3 ? src[srcIdx + 2] : sr;
7389
- const sa = srcCh === 4 ? src[srcIdx + 3] : 255;
7390
- let isPattern = false;
7391
- if (pattern === "diagonal-lines") {
7392
- isPattern = (x + y) % spacing < lineWidth;
7393
- } else if (pattern === "grid") {
7394
- isPattern = x % spacing < lineWidth || y % spacing < lineWidth;
7395
- } else {
7396
- const dx = x % spacing - half;
7397
- const dy = y % spacing - half;
7398
- isPattern = dx * dx + dy * dy < dotRadiusSq;
7399
- }
7400
- if (isPattern) {
7401
- const blend = alpha;
7402
- const invBlend = 255 - blend;
7403
- dst[dstIdx] = (sr * invBlend + 255 * blend + 127) / 255;
7404
- dst[dstIdx + 1] = (sg * invBlend + 255 * blend + 127) / 255;
7405
- dst[dstIdx + 2] = (sb * invBlend + 255 * blend + 127) / 255;
7406
- dst[dstIdx + 3] = sa;
7407
- } else {
7408
- dst[dstIdx] = sr;
7409
- dst[dstIdx + 1] = sg;
7410
- dst[dstIdx + 2] = sb;
7411
- dst[dstIdx + 3] = sa;
7412
- }
7413
- }
7414
- }
7415
- return { data: dst, width, height, channels: outCh };
7416
- });
7417
- return { image };
7526
+ async execute(input, _context) {
7527
+ return await applyWatermark(input);
7528
+ }
7529
+ async executePreview(input, _context) {
7530
+ return await applyWatermark(input);
7418
7531
  }
7419
7532
  }
7420
7533
  Workflow34.prototype.imageWatermark = CreateWorkflow33(ImageWatermarkTask);
7421
7534
  // src/task/InputTask.ts
7422
7535
  import { CreateWorkflow as CreateWorkflow34, Task as Task60, Workflow as Workflow35 } from "@workglow/task-graph";
7536
+ function passthroughInput(input) {
7537
+ return input;
7538
+ }
7423
7539
 
7424
7540
  class InputTask extends Task60 {
7425
7541
  static type = "InputTask";
@@ -7449,8 +7565,11 @@ class InputTask extends Task60 {
7449
7565
  outputSchema() {
7450
7566
  return this.config?.outputSchema ?? this.constructor.outputSchema();
7451
7567
  }
7452
- async executeReactive(input) {
7453
- return input;
7568
+ async execute(input, _context) {
7569
+ return passthroughInput(input);
7570
+ }
7571
+ async executePreview(input) {
7572
+ return passthroughInput(input);
7454
7573
  }
7455
7574
  async* executeStream(input, context) {
7456
7575
  if (context.inputStreams) {
@@ -11946,6 +12065,23 @@ Interpreter["Status"] = Interpreter.Status;
11946
12065
 
11947
12066
  // src/task/JavaScriptTask.ts
11948
12067
  var isValidIdentifier = (key) => /^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(key);
12068
+ function runJavaScript(input2, configuredCode) {
12069
+ const output = {};
12070
+ const code = input2.javascript_code || configuredCode;
12071
+ if (code) {
12072
+ try {
12073
+ const inputVariables = Object.keys(input2).filter((key) => key !== "javascript_code").filter(isValidIdentifier);
12074
+ const inputVariablesString = inputVariables.map((key) => `var ${key} = ${JSON.stringify(input2[key])};`).join(`
12075
+ `);
12076
+ const myInterpreter = new Interpreter(`${inputVariablesString} ${code}`);
12077
+ myInterpreter.run();
12078
+ output.output = myInterpreter.value;
12079
+ } catch (e) {
12080
+ throw new TaskInvalidInputError3(`JavaScript execution failed: ${e instanceof Error ? e.message : String(e)}`);
12081
+ }
12082
+ }
12083
+ return output;
12084
+ }
11949
12085
  var configSchema = {
11950
12086
  type: "object",
11951
12087
  properties: {
@@ -12025,21 +12161,11 @@ class JavaScriptTask extends Task61 {
12025
12161
  }
12026
12162
  return inputSchema59;
12027
12163
  }
12028
- async executeReactive(input2, output) {
12029
- const code = input2.javascript_code || this.config.javascript_code;
12030
- if (code) {
12031
- try {
12032
- const inputVariables = Object.keys(input2).filter((key) => key !== "javascript_code").filter(isValidIdentifier);
12033
- const inputVariablesString = inputVariables.map((key) => `var ${key} = ${JSON.stringify(input2[key])};`).join(`
12034
- `);
12035
- const myInterpreter = new Interpreter(`${inputVariablesString} ${code}`);
12036
- myInterpreter.run();
12037
- output.output = myInterpreter.value;
12038
- } catch (e) {
12039
- throw new TaskInvalidInputError3(`JavaScript execution failed: ${e instanceof Error ? e.message : String(e)}`);
12040
- }
12041
- }
12042
- return output;
12164
+ async execute(input2) {
12165
+ return runJavaScript(input2, this.config.javascript_code);
12166
+ }
12167
+ async executePreview(input2) {
12168
+ return runJavaScript(input2, this.config.javascript_code);
12043
12169
  }
12044
12170
  }
12045
12171
  var javaScript = (input2, config = {}) => {
@@ -12100,6 +12226,10 @@ function resolvePath(obj, segments) {
12100
12226
  const next2 = obj[head];
12101
12227
  return resolvePath(next2, tail);
12102
12228
  }
12229
+ function extractJsonPath(value, path) {
12230
+ const segments = path.split(".");
12231
+ return resolvePath(value, segments);
12232
+ }
12103
12233
 
12104
12234
  class JsonPathTask extends Task62 {
12105
12235
  static type = "JsonPathTask";
@@ -12112,10 +12242,11 @@ class JsonPathTask extends Task62 {
12112
12242
  static outputSchema() {
12113
12243
  return outputSchema59;
12114
12244
  }
12115
- async executeReactive(input2, _output, _context) {
12116
- const segments = input2.path.split(".");
12117
- const result = resolvePath(input2.value, segments);
12118
- return { result };
12245
+ async execute(input2, _context) {
12246
+ return { result: extractJsonPath(input2.value, input2.path) };
12247
+ }
12248
+ async executePreview(input2, _context) {
12249
+ return { result: extractJsonPath(input2.value, input2.path) };
12119
12250
  }
12120
12251
  }
12121
12252
  Workflow37.prototype.jsonPath = CreateWorkflow36(JsonPathTask);
@@ -12209,7 +12340,7 @@ var lambdaTaskConfigSchema = {
12209
12340
  properties: {
12210
12341
  ...TaskConfigSchema33["properties"],
12211
12342
  execute: {},
12212
- executeReactive: {}
12343
+ executePreview: {}
12213
12344
  },
12214
12345
  additionalProperties: false
12215
12346
  };
@@ -12253,8 +12384,8 @@ class LambdaTask extends Task63 {
12253
12384
  return false;
12254
12385
  }
12255
12386
  constructor(config = {}) {
12256
- if (!config.execute && !config.executeReactive) {
12257
- throw new TaskConfigurationError4("LambdaTask must have either execute or executeReactive function in config");
12387
+ if (!config.execute && !config.executePreview) {
12388
+ throw new TaskConfigurationError4("LambdaTask must have either execute or executePreview function in config");
12258
12389
  }
12259
12390
  super(config);
12260
12391
  }
@@ -12264,11 +12395,11 @@ class LambdaTask extends Task63 {
12264
12395
  }
12265
12396
  return {};
12266
12397
  }
12267
- async executeReactive(input2, output, context) {
12268
- if (typeof this.config.executeReactive === "function") {
12269
- return await this.config.executeReactive(input2, output, context) ?? output;
12398
+ async executePreview(input2, context) {
12399
+ if (typeof this.config.executePreview === "function") {
12400
+ return await this.config.executePreview(input2, context);
12270
12401
  }
12271
- return output;
12402
+ return;
12272
12403
  }
12273
12404
  }
12274
12405
  function lambda(input2, config) {
@@ -13548,6 +13679,9 @@ var merge = (input2, config = {}) => {
13548
13679
  Workflow45.prototype.merge = CreateWorkflow44(MergeTask);
13549
13680
  // src/task/OutputTask.ts
13550
13681
  import { CreateWorkflow as CreateWorkflow45, Task as Task70, Workflow as Workflow46 } from "@workglow/task-graph";
13682
+ function passthroughInput2(input2) {
13683
+ return input2;
13684
+ }
13551
13685
 
13552
13686
  class OutputTask extends Task70 {
13553
13687
  static type = "OutputTask";
@@ -13578,8 +13712,11 @@ class OutputTask extends Task70 {
13578
13712
  outputSchema() {
13579
13713
  return this.config?.outputSchema ?? this.constructor.outputSchema();
13580
13714
  }
13581
- async executeReactive(input2) {
13582
- return input2;
13715
+ async execute(input2, _context) {
13716
+ return passthroughInput2(input2);
13717
+ }
13718
+ async executePreview(input2) {
13719
+ return passthroughInput2(input2);
13583
13720
  }
13584
13721
  async* executeStream(input2, context) {
13585
13722
  if (context.inputStreams) {
@@ -13615,6 +13752,32 @@ function hasNestedQuantifiers(pattern) {
13615
13752
  const withoutClasses = pattern.replace(/\[(?:[^\]\\]|\\.)*\]/g, "X");
13616
13753
  return /\([^)]*[+*][^)]*\)[+*?]|\([^)]*[+*][^)]*\)\{/.test(withoutClasses);
13617
13754
  }
13755
+ function executeRegex(input2) {
13756
+ const bracketCount = (input2.pattern.match(/\[/g) ?? []).length;
13757
+ if (bracketCount > MAX_BRACKET_COUNT) {
13758
+ throw new TaskInvalidInputError4("Regex pattern rejected: too many '[' characters (potential ReDoS). " + "Simplify the pattern to reduce complexity.");
13759
+ }
13760
+ if (hasNestedQuantifiers(input2.pattern)) {
13761
+ throw new TaskInvalidInputError4("Regex pattern rejected: nested quantifiers detected (potential ReDoS). " + "Simplify the pattern to avoid catastrophic backtracking.");
13762
+ }
13763
+ const flags = input2.flags ?? "";
13764
+ const regex = new RegExp(input2.pattern, flags);
13765
+ if (flags.includes("g")) {
13766
+ const allMatches = Array.from(input2.value.matchAll(new RegExp(input2.pattern, flags)));
13767
+ return {
13768
+ match: allMatches.length > 0,
13769
+ matches: allMatches.map((m) => m[0])
13770
+ };
13771
+ }
13772
+ const result = regex.exec(input2.value);
13773
+ if (!result) {
13774
+ return { match: false, matches: [] };
13775
+ }
13776
+ return {
13777
+ match: true,
13778
+ matches: result.slice(0)
13779
+ };
13780
+ }
13618
13781
  var inputSchema65 = {
13619
13782
  type: "object",
13620
13783
  properties: {
@@ -13668,31 +13831,11 @@ class RegexTask extends Task71 {
13668
13831
  static outputSchema() {
13669
13832
  return outputSchema64;
13670
13833
  }
13671
- async executeReactive(input2, _output, _context) {
13672
- const bracketCount = (input2.pattern.match(/\[/g) ?? []).length;
13673
- if (bracketCount > MAX_BRACKET_COUNT) {
13674
- throw new TaskInvalidInputError4("Regex pattern rejected: too many '[' characters (potential ReDoS). " + "Simplify the pattern to reduce complexity.");
13675
- }
13676
- if (hasNestedQuantifiers(input2.pattern)) {
13677
- throw new TaskInvalidInputError4("Regex pattern rejected: nested quantifiers detected (potential ReDoS). " + "Simplify the pattern to avoid catastrophic backtracking.");
13678
- }
13679
- const flags = input2.flags ?? "";
13680
- const regex = new RegExp(input2.pattern, flags);
13681
- if (flags.includes("g")) {
13682
- const allMatches = Array.from(input2.value.matchAll(new RegExp(input2.pattern, flags)));
13683
- return {
13684
- match: allMatches.length > 0,
13685
- matches: allMatches.map((m) => m[0])
13686
- };
13687
- }
13688
- const result = regex.exec(input2.value);
13689
- if (!result) {
13690
- return { match: false, matches: [] };
13691
- }
13692
- return {
13693
- match: true,
13694
- matches: result.slice(0)
13695
- };
13834
+ async execute(input2, _context) {
13835
+ return executeRegex(input2);
13836
+ }
13837
+ async executePreview(input2, _context) {
13838
+ return executeRegex(input2);
13696
13839
  }
13697
13840
  }
13698
13841
  Workflow47.prototype.regex = CreateWorkflow46(RegexTask);
@@ -14016,6 +14159,17 @@ var outputSchema72 = {
14016
14159
  properties: {},
14017
14160
  additionalProperties: true
14018
14161
  };
14162
+ function fanoutToIndexedOutputs(inputValue) {
14163
+ const output = {};
14164
+ if (Array.isArray(inputValue)) {
14165
+ inputValue.forEach((item, index) => {
14166
+ output[`output_${index}`] = item;
14167
+ });
14168
+ } else {
14169
+ output.output_0 = inputValue;
14170
+ }
14171
+ return output;
14172
+ }
14019
14173
 
14020
14174
  class SplitTask extends Task79 {
14021
14175
  static type = "SplitTask";
@@ -14029,17 +14183,11 @@ class SplitTask extends Task79 {
14029
14183
  static outputSchema() {
14030
14184
  return outputSchema72;
14031
14185
  }
14032
- async executeReactive(input2) {
14033
- const inputValue = input2.input;
14034
- const output = {};
14035
- if (Array.isArray(inputValue)) {
14036
- inputValue.forEach((item, index) => {
14037
- output[`output_${index}`] = item;
14038
- });
14039
- } else {
14040
- output.output_0 = inputValue;
14041
- }
14042
- return output;
14186
+ async execute(input2, _context) {
14187
+ return fanoutToIndexedOutputs(input2.input);
14188
+ }
14189
+ async executePreview(input2) {
14190
+ return fanoutToIndexedOutputs(input2.input);
14043
14191
  }
14044
14192
  }
14045
14193
  var split = (input2, config = {}) => {
@@ -14053,6 +14201,9 @@ import {
14053
14201
  Task as Task80,
14054
14202
  Workflow as Workflow56
14055
14203
  } from "@workglow/task-graph";
14204
+ function concatStrings(input2) {
14205
+ return Object.values(input2).join("");
14206
+ }
14056
14207
  var inputSchema74 = {
14057
14208
  type: "object",
14058
14209
  properties: {},
@@ -14082,8 +14233,11 @@ class StringConcatTask extends Task80 {
14082
14233
  static outputSchema() {
14083
14234
  return outputSchema73;
14084
14235
  }
14085
- async executeReactive(input2, _output, _context) {
14086
- return { text: Object.values(input2).join("") };
14236
+ async execute(input2, _context) {
14237
+ return { text: concatStrings(input2) };
14238
+ }
14239
+ async executePreview(input2, _context) {
14240
+ return { text: concatStrings(input2) };
14087
14241
  }
14088
14242
  }
14089
14243
  Workflow56.prototype.stringConcat = CreateWorkflow55(StringConcatTask);
@@ -14093,6 +14247,9 @@ import {
14093
14247
  Task as Task81,
14094
14248
  Workflow as Workflow57
14095
14249
  } from "@workglow/task-graph";
14250
+ function stringIncludes(text, search) {
14251
+ return text.includes(search);
14252
+ }
14096
14253
  var inputSchema75 = {
14097
14254
  type: "object",
14098
14255
  properties: {
@@ -14134,8 +14291,11 @@ class StringIncludesTask extends Task81 {
14134
14291
  static outputSchema() {
14135
14292
  return outputSchema74;
14136
14293
  }
14137
- async executeReactive(input2, _output, _context) {
14138
- return { included: input2.text.includes(input2.search) };
14294
+ async execute(input2, _context) {
14295
+ return { included: stringIncludes(input2.text, input2.search) };
14296
+ }
14297
+ async executePreview(input2, _context) {
14298
+ return { included: stringIncludes(input2.text, input2.search) };
14139
14299
  }
14140
14300
  }
14141
14301
  Workflow57.prototype.stringIncludes = CreateWorkflow56(StringIncludesTask);
@@ -14145,6 +14305,9 @@ import {
14145
14305
  Task as Task82,
14146
14306
  Workflow as Workflow58
14147
14307
  } from "@workglow/task-graph";
14308
+ function joinStrings(texts, separator) {
14309
+ return texts.join(separator ?? "");
14310
+ }
14148
14311
  var inputSchema76 = {
14149
14312
  type: "object",
14150
14313
  properties: {
@@ -14188,9 +14351,11 @@ class StringJoinTask extends Task82 {
14188
14351
  static outputSchema() {
14189
14352
  return outputSchema75;
14190
14353
  }
14191
- async executeReactive(input2, _output, _context) {
14192
- const separator = input2.separator ?? "";
14193
- return { text: input2.texts.join(separator) };
14354
+ async execute(input2, _context) {
14355
+ return { text: joinStrings(input2.texts, input2.separator) };
14356
+ }
14357
+ async executePreview(input2, _context) {
14358
+ return { text: joinStrings(input2.texts, input2.separator) };
14194
14359
  }
14195
14360
  }
14196
14361
  Workflow58.prototype.stringJoin = CreateWorkflow57(StringJoinTask);
@@ -14200,6 +14365,9 @@ import {
14200
14365
  Task as Task83,
14201
14366
  Workflow as Workflow59
14202
14367
  } from "@workglow/task-graph";
14368
+ function stringLength(text) {
14369
+ return text.length;
14370
+ }
14203
14371
  var inputSchema77 = {
14204
14372
  type: "object",
14205
14373
  properties: {
@@ -14236,8 +14404,11 @@ class StringLengthTask extends Task83 {
14236
14404
  static outputSchema() {
14237
14405
  return outputSchema76;
14238
14406
  }
14239
- async executeReactive(input2, _output, _context) {
14240
- return { length: input2.text.length };
14407
+ async execute(input2, _context) {
14408
+ return { length: stringLength(input2.text) };
14409
+ }
14410
+ async executePreview(input2, _context) {
14411
+ return { length: stringLength(input2.text) };
14241
14412
  }
14242
14413
  }
14243
14414
  Workflow59.prototype.stringLength = CreateWorkflow58(StringLengthTask);
@@ -14247,6 +14418,9 @@ import {
14247
14418
  Task as Task84,
14248
14419
  Workflow as Workflow60
14249
14420
  } from "@workglow/task-graph";
14421
+ function toLowerCase(text) {
14422
+ return text.toLowerCase();
14423
+ }
14250
14424
  var inputSchema78 = {
14251
14425
  type: "object",
14252
14426
  properties: {
@@ -14283,8 +14457,11 @@ class StringLowerCaseTask extends Task84 {
14283
14457
  static outputSchema() {
14284
14458
  return outputSchema77;
14285
14459
  }
14286
- async executeReactive(input2, _output, _context) {
14287
- return { text: input2.text.toLowerCase() };
14460
+ async execute(input2, _context) {
14461
+ return { text: toLowerCase(input2.text) };
14462
+ }
14463
+ async executePreview(input2, _context) {
14464
+ return { text: toLowerCase(input2.text) };
14288
14465
  }
14289
14466
  }
14290
14467
  Workflow60.prototype.stringLowerCase = CreateWorkflow59(StringLowerCaseTask);
@@ -14294,6 +14471,9 @@ import {
14294
14471
  Task as Task85,
14295
14472
  Workflow as Workflow61
14296
14473
  } from "@workglow/task-graph";
14474
+ function replaceString(text, search, replace) {
14475
+ return text.replaceAll(search, replace);
14476
+ }
14297
14477
  var inputSchema79 = {
14298
14478
  type: "object",
14299
14479
  properties: {
@@ -14340,8 +14520,11 @@ class StringReplaceTask extends Task85 {
14340
14520
  static outputSchema() {
14341
14521
  return outputSchema78;
14342
14522
  }
14343
- async executeReactive(input2, _output, _context) {
14344
- return { text: input2.text.replaceAll(input2.search, input2.replace) };
14523
+ async execute(input2, _context) {
14524
+ return { text: replaceString(input2.text, input2.search, input2.replace) };
14525
+ }
14526
+ async executePreview(input2, _context) {
14527
+ return { text: replaceString(input2.text, input2.search, input2.replace) };
14345
14528
  }
14346
14529
  }
14347
14530
  Workflow61.prototype.stringReplace = CreateWorkflow60(StringReplaceTask);
@@ -14351,6 +14534,9 @@ import {
14351
14534
  Task as Task86,
14352
14535
  Workflow as Workflow62
14353
14536
  } from "@workglow/task-graph";
14537
+ function sliceString(text, start, end) {
14538
+ return text.slice(start, end);
14539
+ }
14354
14540
  var inputSchema80 = {
14355
14541
  type: "object",
14356
14542
  properties: {
@@ -14397,8 +14583,11 @@ class StringSliceTask extends Task86 {
14397
14583
  static outputSchema() {
14398
14584
  return outputSchema79;
14399
14585
  }
14400
- async executeReactive(input2, _output, _context) {
14401
- return { text: input2.text.slice(input2.start, input2.end) };
14586
+ async execute(input2, _context) {
14587
+ return { text: sliceString(input2.text, input2.start, input2.end) };
14588
+ }
14589
+ async executePreview(input2, _context) {
14590
+ return { text: sliceString(input2.text, input2.start, input2.end) };
14402
14591
  }
14403
14592
  }
14404
14593
  Workflow62.prototype.stringSlice = CreateWorkflow61(StringSliceTask);
@@ -14408,6 +14597,13 @@ import {
14408
14597
  Task as Task87,
14409
14598
  Workflow as Workflow63
14410
14599
  } from "@workglow/task-graph";
14600
+ function renderStringTemplate(template, values) {
14601
+ let text = template;
14602
+ for (const [key, value] of Object.entries(values)) {
14603
+ text = text.replaceAll(`{{${key}}}`, String(value));
14604
+ }
14605
+ return text;
14606
+ }
14411
14607
  var inputSchema81 = {
14412
14608
  type: "object",
14413
14609
  properties: {
@@ -14450,12 +14646,11 @@ class StringTemplateTask extends Task87 {
14450
14646
  static outputSchema() {
14451
14647
  return outputSchema80;
14452
14648
  }
14453
- async executeReactive(input2, _output, _context) {
14454
- let text = input2.template;
14455
- for (const [key, value] of Object.entries(input2.values)) {
14456
- text = text.replaceAll(`{{${key}}}`, String(value));
14457
- }
14458
- return { text };
14649
+ async execute(input2, _context) {
14650
+ return { text: renderStringTemplate(input2.template, input2.values) };
14651
+ }
14652
+ async executePreview(input2, _context) {
14653
+ return { text: renderStringTemplate(input2.template, input2.values) };
14459
14654
  }
14460
14655
  }
14461
14656
  Workflow63.prototype.stringTemplate = CreateWorkflow62(StringTemplateTask);
@@ -14465,6 +14660,9 @@ import {
14465
14660
  Task as Task88,
14466
14661
  Workflow as Workflow64
14467
14662
  } from "@workglow/task-graph";
14663
+ function trimString(text) {
14664
+ return text.trim();
14665
+ }
14468
14666
  var inputSchema82 = {
14469
14667
  type: "object",
14470
14668
  properties: {
@@ -14501,8 +14699,11 @@ class StringTrimTask extends Task88 {
14501
14699
  static outputSchema() {
14502
14700
  return outputSchema81;
14503
14701
  }
14504
- async executeReactive(input2, _output, _context) {
14505
- return { text: input2.text.trim() };
14702
+ async execute(input2, _context) {
14703
+ return { text: trimString(input2.text) };
14704
+ }
14705
+ async executePreview(input2, _context) {
14706
+ return { text: trimString(input2.text) };
14506
14707
  }
14507
14708
  }
14508
14709
  Workflow64.prototype.stringTrim = CreateWorkflow63(StringTrimTask);
@@ -14512,6 +14713,9 @@ import {
14512
14713
  Task as Task89,
14513
14714
  Workflow as Workflow65
14514
14715
  } from "@workglow/task-graph";
14716
+ function toUpperCase(text) {
14717
+ return text.toUpperCase();
14718
+ }
14515
14719
  var inputSchema83 = {
14516
14720
  type: "object",
14517
14721
  properties: {
@@ -14548,8 +14752,11 @@ class StringUpperCaseTask extends Task89 {
14548
14752
  static outputSchema() {
14549
14753
  return outputSchema82;
14550
14754
  }
14551
- async executeReactive(input2, _output, _context) {
14552
- return { text: input2.text.toUpperCase() };
14755
+ async execute(input2, _context) {
14756
+ return { text: toUpperCase(input2.text) };
14757
+ }
14758
+ async executePreview(input2, _context) {
14759
+ return { text: toUpperCase(input2.text) };
14553
14760
  }
14554
14761
  }
14555
14762
  Workflow65.prototype.stringUpperCase = CreateWorkflow64(StringUpperCaseTask);
@@ -14559,6 +14766,24 @@ import {
14559
14766
  Task as Task90,
14560
14767
  Workflow as Workflow66
14561
14768
  } from "@workglow/task-graph";
14769
+ function renderTemplate(template, values) {
14770
+ return template.replace(/\{\{([^{}]+)\}\}/g, (_match, expr) => {
14771
+ const [path, defaultValue] = expr.split("|").map((s) => s.trim());
14772
+ const segments = path.split(".");
14773
+ let current = values;
14774
+ for (const segment of segments) {
14775
+ if (current === null || current === undefined || typeof current !== "object") {
14776
+ current = undefined;
14777
+ break;
14778
+ }
14779
+ current = current[segment];
14780
+ }
14781
+ if (current !== undefined && current !== null) {
14782
+ return String(current);
14783
+ }
14784
+ return defaultValue !== undefined ? defaultValue : "";
14785
+ });
14786
+ }
14562
14787
  var inputSchema84 = {
14563
14788
  type: "object",
14564
14789
  properties: {
@@ -14601,24 +14826,11 @@ class TemplateTask extends Task90 {
14601
14826
  static outputSchema() {
14602
14827
  return outputSchema83;
14603
14828
  }
14604
- async executeReactive(input2, _output, _context) {
14605
- const result = input2.template.replace(/\{\{([^}]+)\}\}/g, (_match, expr) => {
14606
- const [path, defaultValue] = expr.split("|").map((s) => s.trim());
14607
- const segments = path.split(".");
14608
- let current = input2.values;
14609
- for (const segment of segments) {
14610
- if (current === null || current === undefined || typeof current !== "object") {
14611
- current = undefined;
14612
- break;
14613
- }
14614
- current = current[segment];
14615
- }
14616
- if (current !== undefined && current !== null) {
14617
- return String(current);
14618
- }
14619
- return defaultValue !== undefined ? defaultValue : "";
14620
- });
14621
- return { result };
14829
+ async execute(input2, _context) {
14830
+ return { result: renderTemplate(input2.template, input2.values) };
14831
+ }
14832
+ async executePreview(input2, _context) {
14833
+ return { result: renderTemplate(input2.template, input2.values) };
14622
14834
  }
14623
14835
  }
14624
14836
  Workflow66.prototype.template = CreateWorkflow65(TemplateTask);
@@ -16326,4 +16538,4 @@ export {
16326
16538
  ArrayTask
16327
16539
  };
16328
16540
 
16329
- //# debugId=0C340BEB980722A064756E2164756E21
16541
+ //# debugId=5A05433CE5000E5A64756E2164756E21