@awesome-flow/noise 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (109) hide show
  1. package/dist/abstract/index.cjs +4234 -0
  2. package/dist/abstract/index.cjs.map +1 -0
  3. package/dist/abstract/index.d.cts +137 -0
  4. package/dist/abstract/index.d.ts +137 -0
  5. package/dist/abstract/index.js +4271 -0
  6. package/dist/abstract/index.js.map +1 -0
  7. package/dist/handle-types-D-v5S53h.d.cts +22 -0
  8. package/dist/handle-types-D-v5S53h.d.ts +22 -0
  9. package/dist/layout/index.cjs +164 -0
  10. package/dist/layout/index.cjs.map +1 -0
  11. package/dist/layout/index.d.cts +26 -0
  12. package/dist/layout/index.d.ts +26 -0
  13. package/dist/layout/index.js +136 -0
  14. package/dist/layout/index.js.map +1 -0
  15. package/dist/modules/index.cjs +71 -0
  16. package/dist/modules/index.cjs.map +1 -0
  17. package/dist/modules/index.d.cts +18 -0
  18. package/dist/modules/index.d.ts +18 -0
  19. package/dist/modules/index.js +34 -0
  20. package/dist/modules/index.js.map +1 -0
  21. package/dist/node-props-CeZ8Oshz.d.ts +161 -0
  22. package/dist/node-props-hKW-_KOU.d.cts +161 -0
  23. package/dist/nodes/generators/index.cjs +640 -0
  24. package/dist/nodes/generators/index.cjs.map +1 -0
  25. package/dist/nodes/generators/index.d.cts +38 -0
  26. package/dist/nodes/generators/index.d.ts +38 -0
  27. package/dist/nodes/generators/index.js +592 -0
  28. package/dist/nodes/generators/index.js.map +1 -0
  29. package/dist/nodes/groups/index.cjs +104 -0
  30. package/dist/nodes/groups/index.cjs.map +1 -0
  31. package/dist/nodes/groups/index.d.cts +7 -0
  32. package/dist/nodes/groups/index.d.ts +7 -0
  33. package/dist/nodes/groups/index.js +78 -0
  34. package/dist/nodes/groups/index.js.map +1 -0
  35. package/dist/nodes/index.cjs +2830 -0
  36. package/dist/nodes/index.cjs.map +1 -0
  37. package/dist/nodes/index.d.cts +16 -0
  38. package/dist/nodes/index.d.ts +16 -0
  39. package/dist/nodes/index.js +2840 -0
  40. package/dist/nodes/index.js.map +1 -0
  41. package/dist/nodes/modifiers/index.cjs +1593 -0
  42. package/dist/nodes/modifiers/index.cjs.map +1 -0
  43. package/dist/nodes/modifiers/index.d.cts +32 -0
  44. package/dist/nodes/modifiers/index.d.ts +32 -0
  45. package/dist/nodes/modifiers/index.js +1612 -0
  46. package/dist/nodes/modifiers/index.js.map +1 -0
  47. package/dist/nodes/output/index.cjs +210 -0
  48. package/dist/nodes/output/index.cjs.map +1 -0
  49. package/dist/nodes/output/index.d.cts +13 -0
  50. package/dist/nodes/output/index.d.ts +13 -0
  51. package/dist/nodes/output/index.js +181 -0
  52. package/dist/nodes/output/index.js.map +1 -0
  53. package/dist/nodes/selectors/index.cjs +136 -0
  54. package/dist/nodes/selectors/index.cjs.map +1 -0
  55. package/dist/nodes/selectors/index.d.cts +16 -0
  56. package/dist/nodes/selectors/index.d.ts +16 -0
  57. package/dist/nodes/selectors/index.js +113 -0
  58. package/dist/nodes/selectors/index.js.map +1 -0
  59. package/dist/nodes/transformers/index.cjs +477 -0
  60. package/dist/nodes/transformers/index.cjs.map +1 -0
  61. package/dist/nodes/transformers/index.d.cts +22 -0
  62. package/dist/nodes/transformers/index.d.ts +22 -0
  63. package/dist/nodes/transformers/index.js +459 -0
  64. package/dist/nodes/transformers/index.js.map +1 -0
  65. package/dist/properties-BxwtU6i9.d.cts +9 -0
  66. package/dist/properties-BxwtU6i9.d.ts +9 -0
  67. package/dist/templates/generators/index.cjs +1714 -0
  68. package/dist/templates/generators/index.cjs.map +1 -0
  69. package/dist/templates/generators/index.d.cts +89 -0
  70. package/dist/templates/generators/index.d.ts +89 -0
  71. package/dist/templates/generators/index.js +1723 -0
  72. package/dist/templates/generators/index.js.map +1 -0
  73. package/dist/templates/groups/index.cjs +1690 -0
  74. package/dist/templates/groups/index.cjs.map +1 -0
  75. package/dist/templates/groups/index.d.cts +11 -0
  76. package/dist/templates/groups/index.d.ts +11 -0
  77. package/dist/templates/groups/index.js +1711 -0
  78. package/dist/templates/groups/index.js.map +1 -0
  79. package/dist/templates/index.cjs +1758 -0
  80. package/dist/templates/index.cjs.map +1 -0
  81. package/dist/templates/index.d.cts +15 -0
  82. package/dist/templates/index.d.ts +15 -0
  83. package/dist/templates/index.js +1745 -0
  84. package/dist/templates/index.js.map +1 -0
  85. package/dist/templates/modifiers/index.cjs +1708 -0
  86. package/dist/templates/modifiers/index.cjs.map +1 -0
  87. package/dist/templates/modifiers/index.d.cts +71 -0
  88. package/dist/templates/modifiers/index.d.ts +71 -0
  89. package/dist/templates/modifiers/index.js +1720 -0
  90. package/dist/templates/modifiers/index.js.map +1 -0
  91. package/dist/templates/output/index.cjs +1696 -0
  92. package/dist/templates/output/index.cjs.map +1 -0
  93. package/dist/templates/output/index.d.cts +29 -0
  94. package/dist/templates/output/index.d.ts +29 -0
  95. package/dist/templates/output/index.js +1714 -0
  96. package/dist/templates/output/index.js.map +1 -0
  97. package/dist/templates/selectors/index.cjs +1692 -0
  98. package/dist/templates/selectors/index.cjs.map +1 -0
  99. package/dist/templates/selectors/index.d.cts +22 -0
  100. package/dist/templates/selectors/index.d.ts +22 -0
  101. package/dist/templates/selectors/index.js +1712 -0
  102. package/dist/templates/selectors/index.js.map +1 -0
  103. package/dist/templates/transformers/index.cjs +1698 -0
  104. package/dist/templates/transformers/index.cjs.map +1 -0
  105. package/dist/templates/transformers/index.d.cts +40 -0
  106. package/dist/templates/transformers/index.d.ts +40 -0
  107. package/dist/templates/transformers/index.js +1715 -0
  108. package/dist/templates/transformers/index.js.map +1 -0
  109. package/package.json +111 -0
@@ -0,0 +1,2830 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __commonJS = (cb, mod) => function __require() {
8
+ return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
9
+ };
10
+ var __export = (target, all) => {
11
+ for (var name in all)
12
+ __defProp(target, name, { get: all[name], enumerable: true });
13
+ };
14
+ var __copyProps = (to, from, except, desc) => {
15
+ if (from && typeof from === "object" || typeof from === "function") {
16
+ for (let key of __getOwnPropNames(from))
17
+ if (!__hasOwnProp.call(to, key) && key !== except)
18
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
19
+ }
20
+ return to;
21
+ };
22
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
23
+ // If the importer is in node compatibility mode or this is not an ESM
24
+ // file that has been converted to a CommonJS file using a Babel-
25
+ // compatible transform (i.e. "__esModule" has not been set), then set
26
+ // "default" to the CommonJS "module.exports" for node compatibility.
27
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
28
+ mod
29
+ ));
30
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
31
+
32
+ // ../../node_modules/fast-deep-equal/index.js
33
+ var require_fast_deep_equal = __commonJS({
34
+ "../../node_modules/fast-deep-equal/index.js"(exports2, module2) {
35
+ "use strict";
36
+ module2.exports = function equal(a, b) {
37
+ if (a === b)
38
+ return true;
39
+ if (a && b && typeof a == "object" && typeof b == "object") {
40
+ if (a.constructor !== b.constructor)
41
+ return false;
42
+ var length, i, keys;
43
+ if (Array.isArray(a)) {
44
+ length = a.length;
45
+ if (length != b.length)
46
+ return false;
47
+ for (i = length; i-- !== 0; )
48
+ if (!equal(a[i], b[i]))
49
+ return false;
50
+ return true;
51
+ }
52
+ if (a.constructor === RegExp)
53
+ return a.source === b.source && a.flags === b.flags;
54
+ if (a.valueOf !== Object.prototype.valueOf)
55
+ return a.valueOf() === b.valueOf();
56
+ if (a.toString !== Object.prototype.toString)
57
+ return a.toString() === b.toString();
58
+ keys = Object.keys(a);
59
+ length = keys.length;
60
+ if (length !== Object.keys(b).length)
61
+ return false;
62
+ for (i = length; i-- !== 0; )
63
+ if (!Object.prototype.hasOwnProperty.call(b, keys[i]))
64
+ return false;
65
+ for (i = length; i-- !== 0; ) {
66
+ var key = keys[i];
67
+ if (!equal(a[key], b[key]))
68
+ return false;
69
+ }
70
+ return true;
71
+ }
72
+ return a !== a && b !== b;
73
+ };
74
+ }
75
+ });
76
+
77
+ // src/nodes/index.ts
78
+ var nodes_exports = {};
79
+ __export(nodes_exports, {
80
+ ModuleGroupNode: () => node_module_group_default,
81
+ NoiseAbsNode: () => noise_abs_node_default,
82
+ NoiseBillowNode: () => noise_billow_node_default,
83
+ NoiseBlendNode: () => noise_blend_node_default,
84
+ NoiseCheckerboardNode: () => noise_checkerboard_node_default,
85
+ NoiseClampNode: () => noise_clamp_node_default,
86
+ NoiseCombineNode: () => noise_combine_node_default,
87
+ NoiseConstNode: () => noise_const_node_default,
88
+ NoiseCurveNode: () => noise_curve_node_default,
89
+ NoiseCylindersNode: () => noise_cylinders_node_default,
90
+ NoiseDisplaceNode: () => noise_displace_node_default,
91
+ NoiseExponentNode: () => noise_exponent_node_default,
92
+ NoiseInvertNode: () => noise_invert_node_default,
93
+ NoiseLoggerNode: () => noise_logger_node_default,
94
+ NoiseNormalizeNode: () => noise_normalize_node_default,
95
+ NoiseOutputNode: () => noise_output_node_default,
96
+ NoisePerlinNode: () => noise_perlin_node_default,
97
+ NoiseRawTextureNode: () => noise_raw_texture_node_default,
98
+ NoiseRidgedMultiNode: () => noise_ridgedmulti_node_default,
99
+ NoiseRotatePointNode: () => noise_rotate_point_node_default,
100
+ NoiseScaleBiasNode: () => noise_scale_bias_node_default,
101
+ NoiseScalePointNode: () => noise_scale_point_node_default,
102
+ NoiseSelectNode: () => noise_select_node_default,
103
+ NoiseSimplexNode: () => noise_simplex_node_default,
104
+ NoiseSpheresNode: () => noise_spheres_node_default,
105
+ NoiseTerraceNode: () => noise_terrace_node_default,
106
+ NoiseTranslatePointNode: () => noise_translate_point_node_default,
107
+ NoiseTurbulenceNode: () => noise_turbulence_node_default,
108
+ NoiseVoronoiNode: () => noise_voronoi_node_default,
109
+ PositionConstNode: () => position_const_node_default,
110
+ PositionGridNode: () => position_grid_node_default,
111
+ PositionsLoggerNode: () => positions_logger_node_default,
112
+ VariableCombineNode: () => variable_combine_node_default,
113
+ VariablePropertyNode: () => variable_property_node_default,
114
+ VariableValueNode: () => variable_value_node_default
115
+ });
116
+ module.exports = __toCommonJS(nodes_exports);
117
+
118
+ // src/nodes/generators/noise-billow-node.tsx
119
+ var import_layout = require("@awesome-flow/core/layout");
120
+ var import_react2 = require("react");
121
+ var import_generator = require("libnoise-ts/module/generator");
122
+ var import_hooks2 = require("@awesome-flow/core/hooks");
123
+ var import_abstract2 = require("@awesome-flow/core/abstract");
124
+
125
+ // src/layout/node-property-variables.tsx
126
+ var import_hooks = require("@awesome-flow/core/hooks");
127
+ var import_react = require("react");
128
+ var import_core2 = require("@mantine/core");
129
+ var import_utils = require("@awesome-flow/core/utils");
130
+ var import_abstract = require("@awesome-flow/core/abstract");
131
+
132
+ // src/layout/node-value-input.tsx
133
+ var import_core = require("@mantine/core");
134
+ var import_jsx_runtime = require("react/jsx-runtime");
135
+ function NodeValueInput({ value, disabled, step, onChange }) {
136
+ if (value === void 0 || value === null) {
137
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, {});
138
+ }
139
+ switch (typeof value) {
140
+ case "boolean": {
141
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
142
+ import_core.Switch,
143
+ {
144
+ checked: value,
145
+ disabled,
146
+ onChange: (e) => onChange(e.currentTarget.checked)
147
+ }
148
+ );
149
+ }
150
+ case "number": {
151
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_core.NumberInput, { value, disabled, step, onChange: (e) => onChange(e) });
152
+ }
153
+ case "string": {
154
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
155
+ import_core.Input,
156
+ {
157
+ value,
158
+ disabled,
159
+ onChange: (e) => onChange(e.currentTarget.value)
160
+ }
161
+ );
162
+ }
163
+ default:
164
+ throw new Error(`Unknown input node for value of type: ${typeof value} (${value})`);
165
+ }
166
+ }
167
+ var node_value_input_default = NodeValueInput;
168
+
169
+ // src/layout/node-property-input.tsx
170
+ var import_jsx_runtime2 = require("react/jsx-runtime");
171
+ function NodePropertyInput({ property, onChange }) {
172
+ if (!property) {
173
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_jsx_runtime2.Fragment, {});
174
+ }
175
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
176
+ node_value_input_default,
177
+ {
178
+ value: property.value,
179
+ disabled: property.disabled,
180
+ step: property.step,
181
+ onChange: (value) => onChange(property.name, value)
182
+ }
183
+ );
184
+ }
185
+ var node_property_input_default = NodePropertyInput;
186
+
187
+ // src/layout/node-property-variables.tsx
188
+ var import_jsx_runtime3 = require("react/jsx-runtime");
189
+ function NodePropertyVariables({
190
+ data,
191
+ nodeId,
192
+ onPropertiesChange,
193
+ except = import_abstract.nodeDataPropertyExcept
194
+ }) {
195
+ const [properties, setProperties] = (0, import_react.useState)(() => {
196
+ const keys = (0, import_utils.getObjectKeys)(data, except);
197
+ const dataProps = {};
198
+ for (const key of keys) {
199
+ dataProps[key] = {
200
+ name: key,
201
+ value: data[key]
202
+ };
203
+ }
204
+ return dataProps;
205
+ });
206
+ const updateNodeData = (0, import_hooks.useUpdateNodeData)();
207
+ const incoming = (0, import_hooks.useIncomingNodeData)(nodeId);
208
+ const resetAllDisabled = (0, import_react.useCallback)(() => {
209
+ const keys = Object.keys(properties);
210
+ keys.forEach((k) => {
211
+ properties[k].disabled = false;
212
+ });
213
+ setProperties(properties);
214
+ }, []);
215
+ const updatePropertyValue = (0, import_react.useCallback)((name, value, disabled) => {
216
+ let property = properties[name];
217
+ if (property) {
218
+ property.value = value;
219
+ } else {
220
+ property = {
221
+ name,
222
+ value
223
+ };
224
+ }
225
+ property.disabled = disabled;
226
+ setProperties({ ...properties, [name]: property });
227
+ updateNodeData(nodeId, { [name]: value });
228
+ }, []);
229
+ (0, import_react.useEffect)(() => {
230
+ resetAllDisabled();
231
+ if (incoming?.length) {
232
+ for (const connection of incoming) {
233
+ if (connection.property && properties[connection.property.name] !== void 0) {
234
+ updatePropertyValue(connection.property.name, connection.property.value, true);
235
+ }
236
+ }
237
+ }
238
+ }, [incoming]);
239
+ (0, import_react.useEffect)(() => {
240
+ if (onPropertiesChange) {
241
+ onPropertiesChange(properties);
242
+ }
243
+ }, [onPropertiesChange, properties]);
244
+ const nodes = (0, import_react.useMemo)(() => {
245
+ return Object.keys(properties).map((key) => {
246
+ const property = properties[key];
247
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_core2.Group, { children: [
248
+ property.name,
249
+ ":",
250
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(node_property_input_default, { property, onChange: updatePropertyValue })
251
+ ] }, key);
252
+ });
253
+ }, [properties, updatePropertyValue]);
254
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_core2.Stack, { children: nodes });
255
+ }
256
+ var node_property_variables_default = NodePropertyVariables;
257
+
258
+ // src/nodes/generators/noise-billow-node.tsx
259
+ var import_jsx_runtime4 = require("react/jsx-runtime");
260
+ function NoiseBillowNode({ id, selected, data, type }) {
261
+ const updateComputedData = (0, import_hooks2.useUpdateNodeComputedData)();
262
+ const module2 = (0, import_react2.useMemo)(() => new import_generator.Billow(), []);
263
+ const onPropertiesChange = (0, import_react2.useCallback)(
264
+ (properties) => {
265
+ Object.keys(properties).forEach((k) => {
266
+ module2[k] = properties[k].value;
267
+ });
268
+ updateComputedData(id, { module: module2 });
269
+ },
270
+ [id, module2, updateComputedData]
271
+ );
272
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_layout.NodeContainer, { id, selected, data, type, children: [
273
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
274
+ node_property_variables_default,
275
+ {
276
+ data,
277
+ except: import_abstract2.nodeDataPropertyExcept,
278
+ nodeId: id,
279
+ onPropertiesChange
280
+ }
281
+ ),
282
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_layout.NodeTrackConnections, { handles: data.handles, nodeId: id, type: "target" })
283
+ ] });
284
+ }
285
+ var noise_billow_node_default = NoiseBillowNode;
286
+
287
+ // src/nodes/generators/noise-checkerboard-node.tsx
288
+ var import_layout2 = require("@awesome-flow/core/layout");
289
+ var import_react3 = require("react");
290
+ var import_generator2 = require("libnoise-ts/module/generator");
291
+ var import_hooks3 = require("@awesome-flow/core/hooks");
292
+ var import_jsx_runtime5 = require("react/jsx-runtime");
293
+ function NoiseCheckerboardNode({ id, selected, data, type }) {
294
+ const updateComputedData = (0, import_hooks3.useUpdateNodeComputedData)();
295
+ const module2 = (0, import_react3.useMemo)(() => new import_generator2.Checkerboard(), []);
296
+ (0, import_react3.useEffect)(() => {
297
+ updateComputedData(id, { module: module2 });
298
+ }, [id, module2, updateComputedData]);
299
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_layout2.NodeContainer, { id, selected, data, type });
300
+ }
301
+ var noise_checkerboard_node_default = NoiseCheckerboardNode;
302
+
303
+ // src/nodes/generators/noise-const-node.tsx
304
+ var import_layout3 = require("@awesome-flow/core/layout");
305
+ var import_react4 = require("react");
306
+ var import_core3 = require("@mantine/core");
307
+ var import_hooks4 = require("@awesome-flow/core/hooks");
308
+ var import_generator3 = require("libnoise-ts/module/generator");
309
+ var import_jsx_runtime6 = require("react/jsx-runtime");
310
+ function NoiseConstNode({ id, selected, data, type }) {
311
+ const [min, setMin] = (0, import_react4.useState)(data.min);
312
+ const [max, setMax] = (0, import_react4.useState)(data.max);
313
+ const [noise, setNoise] = (0, import_react4.useState)(data.noise);
314
+ const updateNodeData = (0, import_hooks4.useUpdateNodeData)();
315
+ const updateComputedData = (0, import_hooks4.useUpdateNodeComputedData)();
316
+ const module2 = (0, import_react4.useMemo)(() => new import_generator3.Const(), []);
317
+ (0, import_react4.useEffect)(() => {
318
+ module2.value = noise;
319
+ updateNodeData(id, { noise, min, max });
320
+ updateComputedData(id, { module: module2 });
321
+ }, [noise, min, max, module2, updateNodeData, id, updateComputedData]);
322
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_layout3.NodeContainer, { id, selected, data, type, children: /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_core3.Stack, { children: [
323
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_core3.Group, { children: [
324
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_core3.NumberInput, { size: "xs", w: 100, value: min, onChange: (e) => setMin(Number(e)) }),
325
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_core3.NumberInput, { size: "xs", w: 100, value: max, onChange: (e) => setMax(Number(e)) })
326
+ ] }),
327
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_core3.Group, { children: [
328
+ "noise:",
329
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
330
+ import_core3.NumberInput,
331
+ {
332
+ size: "xs",
333
+ value: noise,
334
+ onChange: (e) => setNoise(Number(e)),
335
+ max,
336
+ min,
337
+ step: 0.1
338
+ }
339
+ )
340
+ ] })
341
+ ] }) });
342
+ }
343
+ var noise_const_node_default = NoiseConstNode;
344
+
345
+ // src/nodes/generators/noise-cylinders-node.tsx
346
+ var import_layout4 = require("@awesome-flow/core/layout");
347
+ var import_react5 = require("react");
348
+ var import_generator4 = require("libnoise-ts/module/generator");
349
+ var import_hooks5 = require("@awesome-flow/core/hooks");
350
+ var import_jsx_runtime7 = require("react/jsx-runtime");
351
+ function NoiseCylindersNode({ id, selected, data, type }) {
352
+ const updateComputedData = (0, import_hooks5.useUpdateNodeComputedData)();
353
+ const module2 = (0, import_react5.useMemo)(() => new import_generator4.Cylinders(), []);
354
+ const onPropertiesChange = (0, import_react5.useCallback)(
355
+ (properties) => {
356
+ Object.keys(properties).forEach((k) => {
357
+ module2[k] = properties[k].value;
358
+ });
359
+ updateComputedData(id, { module: module2 });
360
+ },
361
+ [id, module2, updateComputedData]
362
+ );
363
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_layout4.NodeContainer, { id, selected, data, type, children: [
364
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(node_property_variables_default, { data, nodeId: id, onPropertiesChange }),
365
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_layout4.NodeTrackConnections, { handles: data.handles, nodeId: id, type: "target" })
366
+ ] });
367
+ }
368
+ var noise_cylinders_node_default = NoiseCylindersNode;
369
+
370
+ // src/nodes/generators/noise-perlin-node.tsx
371
+ var import_layout5 = require("@awesome-flow/core/layout");
372
+ var import_react6 = require("react");
373
+ var import_generator5 = require("libnoise-ts/module/generator");
374
+ var import_hooks6 = require("@awesome-flow/core/hooks");
375
+ var import_jsx_runtime8 = require("react/jsx-runtime");
376
+ function NoisePerlinNode({ id, selected, data, type }) {
377
+ const updateComputedData = (0, import_hooks6.useUpdateNodeComputedData)();
378
+ const module2 = (0, import_react6.useMemo)(() => new import_generator5.Perlin(), []);
379
+ const onPropertiesChange = (0, import_react6.useCallback)(
380
+ (properties) => {
381
+ Object.keys(properties).forEach((k) => {
382
+ module2[k] = properties[k].value;
383
+ });
384
+ updateComputedData(id, { module: module2 });
385
+ },
386
+ [id, module2, updateComputedData]
387
+ );
388
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_layout5.NodeContainer, { id, selected, data, type, children: [
389
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(node_property_variables_default, { data, nodeId: id, onPropertiesChange }),
390
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_layout5.NodeTrackConnections, { handles: data.handles, nodeId: id, type: "target" })
391
+ ] });
392
+ }
393
+ var noise_perlin_node_default = NoisePerlinNode;
394
+
395
+ // src/nodes/generators/noise-ridgedmulti-node.tsx
396
+ var import_layout6 = require("@awesome-flow/core/layout");
397
+ var import_react7 = require("react");
398
+ var import_generator6 = require("libnoise-ts/module/generator");
399
+ var import_hooks7 = require("@awesome-flow/core/hooks");
400
+ var import_jsx_runtime9 = require("react/jsx-runtime");
401
+ function NoiseRidgedMultiNode({ id, selected, data, type }) {
402
+ const updateComputedData = (0, import_hooks7.useUpdateNodeComputedData)();
403
+ const module2 = (0, import_react7.useMemo)(() => new import_generator6.RidgedMulti(), []);
404
+ const onPropertiesChange = (0, import_react7.useCallback)((properties) => {
405
+ Object.keys(properties).forEach((k) => module2[k] = properties[k].value);
406
+ updateComputedData(id, { module: module2 });
407
+ }, []);
408
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(import_layout6.NodeContainer, { id, selected, data, type, children: [
409
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(node_property_variables_default, { data, nodeId: id, onPropertiesChange }),
410
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_layout6.NodeTrackConnections, { handles: data.handles, nodeId: id, type: "target" })
411
+ ] });
412
+ }
413
+ var noise_ridgedmulti_node_default = NoiseRidgedMultiNode;
414
+
415
+ // src/nodes/generators/noise-simplex-node.tsx
416
+ var import_layout7 = require("@awesome-flow/core/layout");
417
+ var import_react8 = require("react");
418
+ var import_hooks8 = require("@awesome-flow/core/hooks");
419
+
420
+ // src/modules/simplex-module.ts
421
+ var import_Module = __toESM(require("libnoise-ts/module/Module"), 1);
422
+ var import_simplex_noise = require("simplex-noise");
423
+ var SimplexModule = class extends import_Module.default {
424
+ noise;
425
+ constructor(random) {
426
+ super();
427
+ this.noise = (0, import_simplex_noise.createNoise3D)(random);
428
+ }
429
+ getValue(x, y, z) {
430
+ return this.noise(x, y, z);
431
+ }
432
+ };
433
+
434
+ // src/nodes/generators/noise-simplex-node.tsx
435
+ var import_jsx_runtime10 = require("react/jsx-runtime");
436
+ function NoiseSimplexNode({ id, selected, data, type }) {
437
+ const updateComputedData = (0, import_hooks8.useUpdateNodeComputedData)();
438
+ const module2 = (0, import_react8.useMemo)(() => new SimplexModule(), []);
439
+ (0, import_react8.useEffect)(() => {
440
+ updateComputedData(id, { module: module2 });
441
+ }, []);
442
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_layout7.NodeContainer, { id, selected, data, type });
443
+ }
444
+ var noise_simplex_node_default = NoiseSimplexNode;
445
+
446
+ // src/nodes/generators/noise-spheres-node.tsx
447
+ var import_layout8 = require("@awesome-flow/core/layout");
448
+ var import_react9 = require("react");
449
+ var import_generator7 = require("libnoise-ts/module/generator");
450
+ var import_hooks9 = require("@awesome-flow/core/hooks");
451
+ var import_jsx_runtime11 = require("react/jsx-runtime");
452
+ function NoiseSpheresNode({ id, selected, data, type }) {
453
+ const updateComputedData = (0, import_hooks9.useUpdateNodeComputedData)();
454
+ const module2 = (0, import_react9.useMemo)(() => new import_generator7.Spheres(), []);
455
+ const onPropertiesChange = (0, import_react9.useCallback)((properties) => {
456
+ Object.keys(properties).forEach((k) => module2[k] = properties[k].value);
457
+ updateComputedData(id, { module: module2 });
458
+ }, []);
459
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(import_layout8.NodeContainer, { id, selected, data, type, children: [
460
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(node_property_variables_default, { data, nodeId: id, onPropertiesChange }),
461
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_layout8.NodeTrackConnections, { handles: data.handles, nodeId: id, type: "target" })
462
+ ] });
463
+ }
464
+ var noise_spheres_node_default = NoiseSpheresNode;
465
+
466
+ // src/nodes/generators/noise-voronoi-node.tsx
467
+ var import_layout9 = require("@awesome-flow/core/layout");
468
+ var import_react10 = require("react");
469
+ var import_generator8 = require("libnoise-ts/module/generator");
470
+ var import_hooks10 = require("@awesome-flow/core/hooks");
471
+ var import_jsx_runtime12 = require("react/jsx-runtime");
472
+ function NoiseVoronoiNode({ id, selected, data, type }) {
473
+ const updateComputedData = (0, import_hooks10.useUpdateNodeComputedData)();
474
+ const onPropertiesChange = (0, import_react10.useCallback)(
475
+ (properties) => {
476
+ const module2 = new import_generator8.Voronoi(
477
+ properties.frequency.value,
478
+ properties.displacement.value,
479
+ properties.distance.value,
480
+ properties.seed.value
481
+ );
482
+ updateComputedData(id, { module: module2 });
483
+ },
484
+ []
485
+ );
486
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_layout9.NodeContainer, { id, selected, data, type, children: [
487
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(node_property_variables_default, { data, nodeId: id, onPropertiesChange }),
488
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_layout9.NodeTrackConnections, { handles: data.handles, nodeId: id, type: "target" })
489
+ ] });
490
+ }
491
+ var noise_voronoi_node_default = NoiseVoronoiNode;
492
+
493
+ // src/nodes/generators/position-const-node.tsx
494
+ var import_layout10 = require("@awesome-flow/core/layout");
495
+ var import_react11 = require("react");
496
+ var import_core4 = require("@mantine/core");
497
+ var import_hooks11 = require("@awesome-flow/core/hooks");
498
+ var import_jsx_runtime13 = require("react/jsx-runtime");
499
+ function PositionConstNode({ id, selected, data, type }) {
500
+ const position = data.position ?? { x: 0, y: 0, z: 0 };
501
+ const [x, setX] = (0, import_react11.useState)(position.x);
502
+ const [y, setY] = (0, import_react11.useState)(position.y);
503
+ const [z, setZ] = (0, import_react11.useState)(position.z);
504
+ const updateNodeData = (0, import_hooks11.useUpdateNodeData)();
505
+ const updateComputedData = (0, import_hooks11.useUpdateNodeComputedData)();
506
+ (0, import_react11.useEffect)(() => {
507
+ const position2 = { x, y, z };
508
+ updateNodeData(id, {
509
+ position: position2
510
+ });
511
+ updateComputedData(id, {
512
+ positions: [position2]
513
+ });
514
+ }, [x, y, z]);
515
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_layout10.NodeContainer, { id, selected, data, type, children: /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_core4.Stack, { children: [
516
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_core4.Group, { children: [
517
+ "x: ",
518
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_core4.NumberInput, { size: "xs", w: 100, value: x, onChange: (e) => setX(Number(e)) })
519
+ ] }),
520
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_core4.Group, { children: [
521
+ "y: ",
522
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_core4.NumberInput, { size: "xs", w: 100, value: y, onChange: (e) => setY(Number(e)) })
523
+ ] }),
524
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_core4.Group, { children: [
525
+ "z: ",
526
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_core4.NumberInput, { size: "xs", w: 100, value: z, onChange: (e) => setZ(Number(e)) })
527
+ ] })
528
+ ] }) });
529
+ }
530
+ var position_const_node_default = PositionConstNode;
531
+
532
+ // src/nodes/generators/position-grid-node.tsx
533
+ var import_layout11 = require("@awesome-flow/core/layout");
534
+ var import_react12 = require("react");
535
+ var import_core5 = require("@mantine/core");
536
+ var import_hooks12 = require("@awesome-flow/core/hooks");
537
+ var import_jsx_runtime14 = require("react/jsx-runtime");
538
+ function PositionGridNode({ id, selected, data, type }) {
539
+ const [x, setX] = (0, import_react12.useState)(data.center?.x);
540
+ const [y, setY] = (0, import_react12.useState)(data.center?.y);
541
+ const [z, setZ] = (0, import_react12.useState)(data.center?.z);
542
+ const [radius, setRadius] = (0, import_react12.useState)(data.radius);
543
+ const updateNodeData = (0, import_hooks12.useUpdateNodeData)();
544
+ const updateComputedData = (0, import_hooks12.useUpdateNodeComputedData)();
545
+ (0, import_react12.useEffect)(() => {
546
+ updateNodeData(id, {
547
+ center: { x, y, z }
548
+ });
549
+ }, [x, y, z]);
550
+ (0, import_react12.useEffect)(() => {
551
+ updateNodeData(id, {
552
+ radius
553
+ });
554
+ }, [radius]);
555
+ (0, import_react12.useEffect)(() => {
556
+ const positions = [];
557
+ for (let i = -radius; i < radius; i++) {
558
+ for (let j = -radius; j < radius; j++) {
559
+ positions.push({ x: x + i, y: y + j, z });
560
+ }
561
+ }
562
+ updateComputedData(id, {
563
+ positions
564
+ });
565
+ }, [x, y, z, radius]);
566
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_layout11.NodeContainer, { id, selected, data, type, children: /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_core5.Stack, { children: [
567
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_core5.Group, { children: [
568
+ "x: ",
569
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_core5.NumberInput, { size: "xs", w: 100, value: x, onChange: (e) => setX(Number(e)) })
570
+ ] }),
571
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_core5.Group, { children: [
572
+ "y: ",
573
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_core5.NumberInput, { size: "xs", w: 100, value: y, onChange: (e) => setY(Number(e)) })
574
+ ] }),
575
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_core5.Group, { children: [
576
+ "z: ",
577
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_core5.NumberInput, { size: "xs", w: 100, value: z, onChange: (e) => setZ(Number(e)) })
578
+ ] }),
579
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_core5.Group, { children: [
580
+ "r: ",
581
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_core5.NumberInput, { size: "xs", w: 100, value: radius, onChange: (e) => setRadius(Number(e)) })
582
+ ] })
583
+ ] }) });
584
+ }
585
+ var position_grid_node_default = PositionGridNode;
586
+
587
+ // src/nodes/generators/variable-property-node.tsx
588
+ var import_layout12 = require("@awesome-flow/core/layout");
589
+ var import_react13 = require("react");
590
+ var import_core6 = require("@mantine/core");
591
+ var import_hooks13 = require("@awesome-flow/core/hooks");
592
+ var import_utils2 = require("@awesome-flow/core/utils");
593
+ var import_abstract3 = require("@awesome-flow/core/abstract");
594
+ var import_jsx_runtime15 = require("react/jsx-runtime");
595
+ function VariablePropertyNode({
596
+ id,
597
+ selected,
598
+ data,
599
+ type
600
+ }) {
601
+ const [options3, setOptions] = (0, import_react13.useState)({});
602
+ const [selectedProperty, setSelectedProperty] = (0, import_react13.useState)(data.property);
603
+ const updateNodeData = (0, import_hooks13.useUpdateNodeData)();
604
+ const outgoing = (0, import_hooks13.useOutgoingNodes)(id);
605
+ const incoming = (0, import_hooks13.useIncomingNodeData)(id);
606
+ (0, import_react13.useEffect)(() => {
607
+ if (outgoing?.length) {
608
+ const { data: data2 } = outgoing[0];
609
+ const properties = (0, import_utils2.getObjectPropertyMap)(data2, import_abstract3.nodeDataPropertyExcept);
610
+ setOptions(properties);
611
+ if (!selectedProperty) {
612
+ const keys = Object.keys(properties);
613
+ if (keys.length) {
614
+ setSelectedProperty({
615
+ name: keys[0],
616
+ value: properties[keys[0]]
617
+ });
618
+ }
619
+ }
620
+ } else {
621
+ setSelectedProperty(null);
622
+ }
623
+ }, [outgoing]);
624
+ (0, import_react13.useEffect)(() => {
625
+ if (!incoming?.length && selectedProperty?.disabled) {
626
+ setSelectedProperty({ ...selectedProperty, disabled: false });
627
+ } else if (incoming?.length && selectedProperty) {
628
+ const incomingValue = incoming[0].value;
629
+ if (incomingValue !== void 0 && incomingValue !== null) {
630
+ setSelectedProperty({
631
+ name: selectedProperty.name,
632
+ value: incomingValue,
633
+ disabled: true
634
+ });
635
+ }
636
+ }
637
+ }, [incoming]);
638
+ (0, import_react13.useEffect)(() => {
639
+ if (selectedProperty) {
640
+ updateNodeData(id, { property: selectedProperty });
641
+ }
642
+ }, [selectedProperty]);
643
+ const onPropertyChange = (0, import_react13.useCallback)(
644
+ (selected2) => {
645
+ setSelectedProperty({
646
+ name: selected2,
647
+ value: options3[selected2]
648
+ });
649
+ },
650
+ [options3]
651
+ );
652
+ const onValueChange = (0, import_react13.useCallback)((name, value) => {
653
+ setSelectedProperty({
654
+ name,
655
+ value
656
+ });
657
+ }, []);
658
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_layout12.NodeContainer, { id, selected, data, type, children: [
659
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_core6.Stack, { align: "center", children: [
660
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
661
+ import_layout12.NodeCombobox,
662
+ {
663
+ options: options3,
664
+ onChange: onPropertyChange,
665
+ selected: selectedProperty?.name,
666
+ hideListValues: true
667
+ }
668
+ ),
669
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(node_property_input_default, { property: selectedProperty, onChange: onValueChange })
670
+ ] }),
671
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_layout12.NodeTrackConnections, { handles: data.handles, nodeId: id })
672
+ ] });
673
+ }
674
+ var variable_property_node_default = VariablePropertyNode;
675
+
676
+ // src/nodes/generators/variable-value-node.tsx
677
+ var import_layout13 = require("@awesome-flow/core/layout");
678
+ var import_react14 = require("react");
679
+ var import_hooks14 = require("@awesome-flow/core/hooks");
680
+ var import_jsx_runtime16 = require("react/jsx-runtime");
681
+ function VariableValueNode({ id, selected, data, type }) {
682
+ const [value, setValue] = (0, import_react14.useState)(data.value || 0);
683
+ const updateNodeData = (0, import_hooks14.useUpdateNodeData)();
684
+ const onValueChange = (0, import_react14.useCallback)((newValue) => {
685
+ updateNodeData(id, { value: newValue });
686
+ setValue(newValue);
687
+ }, []);
688
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(import_layout13.NodeContainer, { id, selected, data, type, children: [
689
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(node_value_input_default, { value, onChange: onValueChange }),
690
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_layout13.NodeTrackConnections, { handles: data.handles, nodeId: id, type: "source" })
691
+ ] });
692
+ }
693
+ var variable_value_node_default = VariableValueNode;
694
+
695
+ // src/nodes/groups/node-module-group.tsx
696
+ var import_layout14 = require("@awesome-flow/core/layout");
697
+ var import_react15 = require("@xyflow/react");
698
+ var import_abstract4 = require("@awesome-flow/core/abstract");
699
+ var import_react16 = require("react");
700
+ var import_shallow = require("zustand/shallow");
701
+ var import_core7 = require("@mantine/core");
702
+ var import_jsx_runtime17 = require("react/jsx-runtime");
703
+ function ModuleGroupNode({
704
+ id,
705
+ selected,
706
+ data,
707
+ type,
708
+ width,
709
+ height
710
+ }) {
711
+ const context = (0, import_react16.useContext)(import_abstract4.FlowContext);
712
+ const updateNodeInternals = (0, import_react15.useUpdateNodeInternals)();
713
+ const triggerNodeChanges = (0, import_react15.useStore)((s) => s.triggerNodeChanges);
714
+ const { groupNodes, setGroupCollapsed } = context.useFlowStore(
715
+ (0, import_react16.useCallback)(
716
+ (state) => ({ groupNodes: state.groups[id], setGroupCollapsed: state.setGroupCollapsed }),
717
+ []
718
+ )
719
+ );
720
+ const intersectingNode = context.useInteractivityStore(
721
+ (0, import_react16.useCallback)((state) => state.nodeIntersectionTargets[id], [id]),
722
+ import_shallow.shallow
723
+ );
724
+ (0, import_react16.useEffect)(() => {
725
+ updateNodeInternals(id);
726
+ }, [width, height]);
727
+ (0, import_react16.useEffect)(() => {
728
+ triggerNodeChanges([
729
+ {
730
+ id,
731
+ type: "select",
732
+ selected: !!intersectingNode
733
+ }
734
+ ]);
735
+ }, [intersectingNode]);
736
+ const onCollapsed = (0, import_react16.useCallback)((collapsed) => {
737
+ setGroupCollapsed(id, collapsed);
738
+ }, []);
739
+ const size = (0, import_react16.useMemo)(() => {
740
+ return {
741
+ width: data.initialSize?.width || 100,
742
+ height: data.initialSize?.height || 50
743
+ };
744
+ }, [data.initialSize]);
745
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
746
+ import_layout14.NodeContainer,
747
+ {
748
+ id,
749
+ selected,
750
+ data,
751
+ title: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_core7.Group, { justify: "space-between", children: /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_core7.Group, { gap: "xs", children: [
752
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_core7.Badge, { size: "xs", variant: "outline", radius: "xs", color: "gray", children: groupNodes?.length || 0 }),
753
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_layout14.NodeCollapse, { nodeId: id, isCollapsed: data.isCollapsed, onCollapsed })
754
+ ] }) }),
755
+ type,
756
+ children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
757
+ import_react15.NodeResizer,
758
+ {
759
+ nodeId: id,
760
+ minWidth: size.width,
761
+ minHeight: size.height,
762
+ isVisible: selected && !data.isCollapsed
763
+ }
764
+ )
765
+ }
766
+ );
767
+ }
768
+ var node_module_group_default = ModuleGroupNode;
769
+
770
+ // src/nodes/modifiers/noise-abs-node.tsx
771
+ var import_layout15 = require("@awesome-flow/core/layout");
772
+ var import_react17 = require("react");
773
+ var import_hooks15 = require("@awesome-flow/core/hooks");
774
+ var import_modifier = require("libnoise-ts/module/modifier");
775
+ var import_jsx_runtime18 = require("react/jsx-runtime");
776
+ function NoiseAbsNode({ id, selected, data, type }) {
777
+ const incoming = (0, import_hooks15.useIncomingComputedData)(id);
778
+ const updateComputedData = (0, import_hooks15.useUpdateNodeComputedData)();
779
+ (0, import_react17.useEffect)(() => {
780
+ if (incoming?.length > 0) {
781
+ const module2 = new import_modifier.Abs(incoming[0].module);
782
+ updateComputedData(id, { module: module2 });
783
+ }
784
+ }, [incoming]);
785
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_layout15.NodeContainer, { id, selected, data, type, children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_layout15.NodeTrackConnections, { handles: data.handles, nodeId: id, type: "target" }) });
786
+ }
787
+ var noise_abs_node_default = NoiseAbsNode;
788
+
789
+ // src/nodes/modifiers/noise-clamp-node.tsx
790
+ var import_layout16 = require("@awesome-flow/core/layout");
791
+ var import_react18 = require("react");
792
+ var import_core8 = require("@mantine/core");
793
+ var import_hooks16 = require("@awesome-flow/core/hooks");
794
+ var import_modifier2 = require("libnoise-ts/module/modifier");
795
+ var import_jsx_runtime19 = require("react/jsx-runtime");
796
+ function NoiseClampNode({ id, selected, data, type }) {
797
+ const [lowerBound, setLowerBound] = (0, import_react18.useState)(data.lowerBound);
798
+ const [upperBound, setUpperBound] = (0, import_react18.useState)(data.upperBound);
799
+ const incoming = (0, import_hooks16.useIncomingComputedData)(id);
800
+ const updateNodeData = (0, import_hooks16.useUpdateNodeData)();
801
+ const updateComputedData = (0, import_hooks16.useUpdateNodeComputedData)();
802
+ (0, import_react18.useEffect)(() => {
803
+ if (incoming?.length) {
804
+ const module2 = new import_modifier2.Clamp(incoming[0].module, lowerBound, upperBound);
805
+ updateComputedData(id, { module: module2 });
806
+ }
807
+ updateNodeData(id, { lowerBound, upperBound });
808
+ }, [incoming, lowerBound, upperBound]);
809
+ return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(import_layout16.NodeContainer, { id, selected, data, type, children: [
810
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_core8.Stack, { children: /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(import_core8.Group, { children: [
811
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
812
+ import_core8.NumberInput,
813
+ {
814
+ size: "xs",
815
+ w: 100,
816
+ value: lowerBound,
817
+ onChange: (e) => setLowerBound(Number(e)),
818
+ step: 0.1
819
+ }
820
+ ),
821
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
822
+ import_core8.NumberInput,
823
+ {
824
+ size: "xs",
825
+ w: 100,
826
+ value: upperBound,
827
+ onChange: (e) => setUpperBound(Number(e)),
828
+ step: 0.1
829
+ }
830
+ )
831
+ ] }) }),
832
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_layout16.NodeTrackConnections, { handles: data.handles, nodeId: id, type: "target" })
833
+ ] });
834
+ }
835
+ var noise_clamp_node_default = NoiseClampNode;
836
+
837
+ // src/nodes/modifiers/noise-combine-node.tsx
838
+ var import_layout17 = require("@awesome-flow/core/layout");
839
+ var import_react19 = require("react");
840
+ var import_hooks17 = require("@awesome-flow/core/hooks");
841
+ var import_icons_react = require("@tabler/icons-react");
842
+
843
+ // src/abstract/operations.ts
844
+ var import_combiner = require("libnoise-ts/module/combiner");
845
+ var noiseCombineModuleMap = {
846
+ ["add" /* add */]: import_combiner.Add,
847
+ ["max" /* max */]: import_combiner.Max,
848
+ ["min" /* min */]: import_combiner.Min,
849
+ ["multiply" /* multiply */]: import_combiner.Multiply,
850
+ ["power" /* power */]: import_combiner.Power
851
+ };
852
+
853
+ // src/nodes/modifiers/noise-combine-node.tsx
854
+ var import_jsx_runtime20 = require("react/jsx-runtime");
855
+ var options = {
856
+ add: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_icons_react.IconPlus, {}),
857
+ min: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_icons_react.IconChevronLeft, {}),
858
+ max: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_icons_react.IconChevronRight, {}),
859
+ multiply: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_icons_react.IconAsterisk, {}),
860
+ power: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_icons_react.IconChevronUp, {})
861
+ };
862
+ function NoiseCombineNode({ id, selected, data, type }) {
863
+ const updateNodeData = (0, import_hooks17.useUpdateNodeData)();
864
+ const updateComputedData = (0, import_hooks17.useUpdateNodeComputedData)();
865
+ const incoming = (0, import_hooks17.useIncomingComputedData)(id);
866
+ (0, import_react19.useEffect)(() => {
867
+ const ModuleFactory = noiseCombineModuleMap[data.operation];
868
+ if (incoming?.length > 1) {
869
+ const module2 = new ModuleFactory(incoming[0].module, incoming[1].module);
870
+ updateComputedData(id, { module: module2 });
871
+ }
872
+ }, [data.operation, incoming]);
873
+ const onChange = (0, import_react19.useCallback)((operation) => {
874
+ updateNodeData(id, { operation });
875
+ }, []);
876
+ return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(import_layout17.NodeContainer, { id, selected, data, type, children: [
877
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_layout17.NodeCombobox, { options, selected: data.operation, onChange }),
878
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_layout17.NodeTrackConnections, { handles: data.handles, nodeId: id, type: "target" })
879
+ ] });
880
+ }
881
+ var noise_combine_node_default = NoiseCombineNode;
882
+
883
+ // src/nodes/modifiers/noise-curve-node.tsx
884
+ var import_layout18 = require("@awesome-flow/core/layout");
885
+ var import_core9 = require("@mantine/core");
886
+ var import_hooks18 = require("@awesome-flow/core/hooks");
887
+
888
+ // ../../node_modules/@mantine/form/esm/use-form.mjs
889
+ var import_react26 = require("react");
890
+
891
+ // ../../node_modules/@mantine/form/esm/actions/actions.mjs
892
+ var import_react20 = require("react");
893
+ function validateFormName(name) {
894
+ if (!/^[0-9a-zA-Z-]+$/.test(name)) {
895
+ throw new Error(
896
+ `[@mantine/use-form] Form name "${name}" is invalid, it should contain only letters, numbers and dashes`
897
+ );
898
+ }
899
+ }
900
+ var useIsomorphicEffect = typeof window !== "undefined" ? import_react20.useLayoutEffect : import_react20.useEffect;
901
+ function useFormEvent(eventKey, handler) {
902
+ useIsomorphicEffect(() => {
903
+ if (eventKey) {
904
+ window.addEventListener(eventKey, handler);
905
+ return () => window.removeEventListener(eventKey, handler);
906
+ }
907
+ return void 0;
908
+ }, [eventKey]);
909
+ }
910
+ function useFormActions(name, form) {
911
+ if (name) {
912
+ validateFormName(name);
913
+ }
914
+ useFormEvent(
915
+ `mantine-form:${name}:set-field-value`,
916
+ (event) => form.setFieldValue(event.detail.path, event.detail.value)
917
+ );
918
+ useFormEvent(
919
+ `mantine-form:${name}:set-values`,
920
+ (event) => form.setValues(event.detail)
921
+ );
922
+ useFormEvent(
923
+ `mantine-form:${name}:set-initial-values`,
924
+ (event) => form.setInitialValues(event.detail)
925
+ );
926
+ useFormEvent(
927
+ `mantine-form:${name}:set-errors`,
928
+ (event) => form.setErrors(event.detail)
929
+ );
930
+ useFormEvent(
931
+ `mantine-form:${name}:set-field-error`,
932
+ (event) => form.setFieldError(event.detail.path, event.detail.error)
933
+ );
934
+ useFormEvent(
935
+ `mantine-form:${name}:clear-field-error`,
936
+ (event) => form.clearFieldError(event.detail)
937
+ );
938
+ useFormEvent(`mantine-form:${name}:clear-errors`, form.clearErrors);
939
+ useFormEvent(`mantine-form:${name}:reset`, form.reset);
940
+ useFormEvent(`mantine-form:${name}:validate`, form.validate);
941
+ useFormEvent(
942
+ `mantine-form:${name}:validate-field`,
943
+ (event) => form.validateField(event.detail)
944
+ );
945
+ useFormEvent(
946
+ `mantine-form:${name}:reorder-list-item`,
947
+ (event) => form.reorderListItem(event.detail.path, event.detail.payload)
948
+ );
949
+ useFormEvent(
950
+ `mantine-form:${name}:remove-list-item`,
951
+ (event) => form.removeListItem(event.detail.path, event.detail.index)
952
+ );
953
+ useFormEvent(
954
+ `mantine-form:${name}:insert-list-item`,
955
+ (event) => form.insertListItem(event.detail.path, event.detail.item, event.detail.index)
956
+ );
957
+ useFormEvent(
958
+ `mantine-form:${name}:set-dirty`,
959
+ (event) => form.setDirty(event.detail)
960
+ );
961
+ useFormEvent(
962
+ `mantine-form:${name}:set-touched`,
963
+ (event) => form.setTouched(event.detail)
964
+ );
965
+ useFormEvent(
966
+ `mantine-form:${name}:reset-dirty`,
967
+ (event) => form.resetDirty(event.detail)
968
+ );
969
+ useFormEvent(`mantine-form:${name}:reset-touched`, form.resetTouched);
970
+ }
971
+
972
+ // ../../node_modules/@mantine/form/esm/get-input-on-change/get-input-on-change.mjs
973
+ function getInputOnChange(setValue) {
974
+ return (val) => {
975
+ if (!val) {
976
+ setValue(val);
977
+ } else if (typeof val === "function") {
978
+ setValue(val);
979
+ } else if (typeof val === "object" && "nativeEvent" in val) {
980
+ const { currentTarget } = val;
981
+ if (currentTarget instanceof HTMLInputElement) {
982
+ if (currentTarget.type === "checkbox") {
983
+ setValue(currentTarget.checked);
984
+ } else {
985
+ setValue(currentTarget.value);
986
+ }
987
+ } else if (currentTarget instanceof HTMLTextAreaElement || currentTarget instanceof HTMLSelectElement) {
988
+ setValue(currentTarget.value);
989
+ }
990
+ } else {
991
+ setValue(val);
992
+ }
993
+ };
994
+ }
995
+
996
+ // ../../node_modules/@mantine/form/esm/hooks/use-form-errors/use-form-errors.mjs
997
+ var import_react21 = require("react");
998
+
999
+ // ../../node_modules/@mantine/form/esm/hooks/use-form-errors/filter-errors/filter-errors.mjs
1000
+ function filterErrors(errors) {
1001
+ if (errors === null || typeof errors !== "object") {
1002
+ return {};
1003
+ }
1004
+ return Object.keys(errors).reduce((acc, key) => {
1005
+ const errorValue = errors[key];
1006
+ if (errorValue !== void 0 && errorValue !== null && errorValue !== false) {
1007
+ acc[key] = errorValue;
1008
+ }
1009
+ return acc;
1010
+ }, {});
1011
+ }
1012
+
1013
+ // ../../node_modules/@mantine/form/esm/hooks/use-form-errors/use-form-errors.mjs
1014
+ function useFormErrors(initialErrors) {
1015
+ const [errorsState, setErrorsState] = (0, import_react21.useState)(filterErrors(initialErrors));
1016
+ const setErrors = (0, import_react21.useCallback)((errors) => {
1017
+ setErrorsState(
1018
+ (current) => filterErrors(typeof errors === "function" ? errors(current) : errors)
1019
+ );
1020
+ }, []);
1021
+ const clearErrors = (0, import_react21.useCallback)(() => setErrorsState({}), []);
1022
+ const clearFieldError = (0, import_react21.useCallback)(
1023
+ (path) => {
1024
+ if (errorsState[path] === void 0) {
1025
+ return;
1026
+ }
1027
+ setErrors((current) => {
1028
+ const errors = { ...current };
1029
+ delete errors[path];
1030
+ return errors;
1031
+ });
1032
+ },
1033
+ [errorsState]
1034
+ );
1035
+ const setFieldError = (0, import_react21.useCallback)(
1036
+ (path, error) => {
1037
+ if (error == null || error === false) {
1038
+ clearFieldError(path);
1039
+ } else if (errorsState[path] !== error) {
1040
+ setErrors((current) => ({ ...current, [path]: error }));
1041
+ }
1042
+ },
1043
+ [errorsState]
1044
+ );
1045
+ return {
1046
+ errorsState,
1047
+ setErrors,
1048
+ clearErrors,
1049
+ setFieldError,
1050
+ clearFieldError
1051
+ };
1052
+ }
1053
+
1054
+ // ../../node_modules/@mantine/form/esm/hooks/use-form-list/use-form-list.mjs
1055
+ var import_react22 = require("react");
1056
+
1057
+ // ../../node_modules/@mantine/form/esm/lists/clear-list-state.mjs
1058
+ function clearListState(field, state) {
1059
+ if (state === null || typeof state !== "object") {
1060
+ return {};
1061
+ }
1062
+ const clone = { ...state };
1063
+ Object.keys(state).forEach((errorKey) => {
1064
+ if (errorKey.includes(`${String(field)}.`)) {
1065
+ delete clone[errorKey];
1066
+ }
1067
+ });
1068
+ return clone;
1069
+ }
1070
+
1071
+ // ../../node_modules/@mantine/form/esm/lists/change-error-indices.mjs
1072
+ function getIndexFromKeyAfterPath(key, path) {
1073
+ const split = key.substring(path.length + 1).split(".")[0];
1074
+ return parseInt(split, 10);
1075
+ }
1076
+ function changeErrorIndices(path, index, errors, change) {
1077
+ if (index === void 0) {
1078
+ return errors;
1079
+ }
1080
+ const pathString = `${String(path)}`;
1081
+ let clearedErrors = errors;
1082
+ if (change === -1) {
1083
+ clearedErrors = clearListState(`${pathString}.${index}`, clearedErrors);
1084
+ }
1085
+ const cloned = { ...clearedErrors };
1086
+ const changedKeys = /* @__PURE__ */ new Set();
1087
+ Object.entries(clearedErrors).filter(([key]) => {
1088
+ if (!key.startsWith(`${pathString}.`)) {
1089
+ return false;
1090
+ }
1091
+ const currIndex = getIndexFromKeyAfterPath(key, pathString);
1092
+ if (Number.isNaN(currIndex)) {
1093
+ return false;
1094
+ }
1095
+ return currIndex >= index;
1096
+ }).forEach(([key, value]) => {
1097
+ const currIndex = getIndexFromKeyAfterPath(key, pathString);
1098
+ const newKey = key.replace(
1099
+ `${pathString}.${currIndex}`,
1100
+ `${pathString}.${currIndex + change}`
1101
+ );
1102
+ cloned[newKey] = value;
1103
+ changedKeys.add(newKey);
1104
+ if (!changedKeys.has(key)) {
1105
+ delete cloned[key];
1106
+ }
1107
+ });
1108
+ return cloned;
1109
+ }
1110
+
1111
+ // ../../node_modules/@mantine/form/esm/lists/reorder-errors.mjs
1112
+ function reorderErrors(path, { from, to }, errors) {
1113
+ const oldKeyStart = `${path}.${from}`;
1114
+ const newKeyStart = `${path}.${to}`;
1115
+ const clone = { ...errors };
1116
+ Object.keys(errors).every((key) => {
1117
+ let oldKey;
1118
+ let newKey;
1119
+ if (key.startsWith(oldKeyStart)) {
1120
+ oldKey = key;
1121
+ newKey = key.replace(oldKeyStart, newKeyStart);
1122
+ }
1123
+ if (key.startsWith(newKeyStart)) {
1124
+ oldKey = key.replace(newKeyStart, oldKeyStart);
1125
+ newKey = key;
1126
+ }
1127
+ if (oldKey && newKey) {
1128
+ const value1 = clone[oldKey];
1129
+ const value2 = clone[newKey];
1130
+ value2 === void 0 ? delete clone[oldKey] : clone[oldKey] = value2;
1131
+ value1 === void 0 ? delete clone[newKey] : clone[newKey] = value1;
1132
+ return false;
1133
+ }
1134
+ return true;
1135
+ });
1136
+ return clone;
1137
+ }
1138
+
1139
+ // ../../node_modules/klona/full/index.mjs
1140
+ function set(obj, key, val) {
1141
+ if (typeof val.value === "object")
1142
+ val.value = klona(val.value);
1143
+ if (!val.enumerable || val.get || val.set || !val.configurable || !val.writable || key === "__proto__") {
1144
+ Object.defineProperty(obj, key, val);
1145
+ } else
1146
+ obj[key] = val.value;
1147
+ }
1148
+ function klona(x) {
1149
+ if (typeof x !== "object")
1150
+ return x;
1151
+ var i = 0, k, list, tmp, str = Object.prototype.toString.call(x);
1152
+ if (str === "[object Object]") {
1153
+ tmp = Object.create(x.__proto__ || null);
1154
+ } else if (str === "[object Array]") {
1155
+ tmp = Array(x.length);
1156
+ } else if (str === "[object Set]") {
1157
+ tmp = /* @__PURE__ */ new Set();
1158
+ x.forEach(function(val) {
1159
+ tmp.add(klona(val));
1160
+ });
1161
+ } else if (str === "[object Map]") {
1162
+ tmp = /* @__PURE__ */ new Map();
1163
+ x.forEach(function(val, key) {
1164
+ tmp.set(klona(key), klona(val));
1165
+ });
1166
+ } else if (str === "[object Date]") {
1167
+ tmp = /* @__PURE__ */ new Date(+x);
1168
+ } else if (str === "[object RegExp]") {
1169
+ tmp = new RegExp(x.source, x.flags);
1170
+ } else if (str === "[object DataView]") {
1171
+ tmp = new x.constructor(klona(x.buffer));
1172
+ } else if (str === "[object ArrayBuffer]") {
1173
+ tmp = x.slice(0);
1174
+ } else if (str.slice(-6) === "Array]") {
1175
+ tmp = new x.constructor(x);
1176
+ }
1177
+ if (tmp) {
1178
+ for (list = Object.getOwnPropertySymbols(x); i < list.length; i++) {
1179
+ set(tmp, list[i], Object.getOwnPropertyDescriptor(x, list[i]));
1180
+ }
1181
+ for (i = 0, list = Object.getOwnPropertyNames(x); i < list.length; i++) {
1182
+ if (Object.hasOwnProperty.call(tmp, k = list[i]) && tmp[k] === x[k])
1183
+ continue;
1184
+ set(tmp, k, Object.getOwnPropertyDescriptor(x, k));
1185
+ }
1186
+ }
1187
+ return tmp || x;
1188
+ }
1189
+
1190
+ // ../../node_modules/@mantine/form/esm/paths/get-splitted-path.mjs
1191
+ function getSplittedPath(path) {
1192
+ if (typeof path !== "string") {
1193
+ return [];
1194
+ }
1195
+ return path.split(".");
1196
+ }
1197
+
1198
+ // ../../node_modules/@mantine/form/esm/paths/get-path.mjs
1199
+ function getPath(path, values) {
1200
+ const splittedPath = getSplittedPath(path);
1201
+ if (splittedPath.length === 0 || typeof values !== "object" || values === null) {
1202
+ return void 0;
1203
+ }
1204
+ let value = values[splittedPath[0]];
1205
+ for (let i = 1; i < splittedPath.length; i += 1) {
1206
+ if (value === void 0) {
1207
+ break;
1208
+ }
1209
+ value = value[splittedPath[i]];
1210
+ }
1211
+ return value;
1212
+ }
1213
+
1214
+ // ../../node_modules/@mantine/form/esm/paths/set-path.mjs
1215
+ function setPath(path, value, values) {
1216
+ const splittedPath = getSplittedPath(path);
1217
+ if (splittedPath.length === 0) {
1218
+ return values;
1219
+ }
1220
+ const cloned = klona(values);
1221
+ if (splittedPath.length === 1) {
1222
+ cloned[splittedPath[0]] = value;
1223
+ return cloned;
1224
+ }
1225
+ let val = cloned[splittedPath[0]];
1226
+ for (let i = 1; i < splittedPath.length - 1; i += 1) {
1227
+ if (val === void 0) {
1228
+ return cloned;
1229
+ }
1230
+ val = val[splittedPath[i]];
1231
+ }
1232
+ val[splittedPath[splittedPath.length - 1]] = value;
1233
+ return cloned;
1234
+ }
1235
+
1236
+ // ../../node_modules/@mantine/form/esm/paths/reorder-path.mjs
1237
+ function reorderPath(path, { from, to }, values) {
1238
+ const currentValue = getPath(path, values);
1239
+ if (!Array.isArray(currentValue)) {
1240
+ return values;
1241
+ }
1242
+ const cloned = [...currentValue];
1243
+ const item = currentValue[from];
1244
+ cloned.splice(from, 1);
1245
+ cloned.splice(to, 0, item);
1246
+ return setPath(path, cloned, values);
1247
+ }
1248
+
1249
+ // ../../node_modules/@mantine/form/esm/paths/insert-path.mjs
1250
+ function insertPath(path, value, index, values) {
1251
+ const currentValue = getPath(path, values);
1252
+ if (!Array.isArray(currentValue)) {
1253
+ return values;
1254
+ }
1255
+ const cloned = [...currentValue];
1256
+ cloned.splice(typeof index === "number" ? index : cloned.length, 0, value);
1257
+ return setPath(path, cloned, values);
1258
+ }
1259
+
1260
+ // ../../node_modules/@mantine/form/esm/paths/remove-path.mjs
1261
+ function removePath(path, index, values) {
1262
+ const currentValue = getPath(path, values);
1263
+ if (!Array.isArray(currentValue)) {
1264
+ return values;
1265
+ }
1266
+ return setPath(
1267
+ path,
1268
+ currentValue.filter((_, itemIndex) => itemIndex !== index),
1269
+ values
1270
+ );
1271
+ }
1272
+
1273
+ // ../../node_modules/@mantine/form/esm/hooks/use-form-list/use-form-list.mjs
1274
+ function useFormList({
1275
+ $values,
1276
+ $errors,
1277
+ $status
1278
+ }) {
1279
+ const reorderListItem = (0, import_react22.useCallback)((path, payload) => {
1280
+ $status.clearFieldDirty(path);
1281
+ $errors.setErrors((errs) => reorderErrors(path, payload, errs));
1282
+ $values.setValues({
1283
+ values: reorderPath(path, payload, $values.refValues.current),
1284
+ updateState: true
1285
+ });
1286
+ }, []);
1287
+ const removeListItem = (0, import_react22.useCallback)((path, index) => {
1288
+ $status.clearFieldDirty(path);
1289
+ $errors.setErrors((errs) => changeErrorIndices(path, index, errs, -1));
1290
+ $values.setValues({
1291
+ values: removePath(path, index, $values.refValues.current),
1292
+ updateState: true
1293
+ });
1294
+ }, []);
1295
+ const insertListItem = (0, import_react22.useCallback)((path, item, index) => {
1296
+ $status.clearFieldDirty(path);
1297
+ $errors.setErrors((errs) => changeErrorIndices(path, index, errs, 1));
1298
+ $values.setValues({
1299
+ values: insertPath(path, item, index, $values.refValues.current),
1300
+ updateState: true
1301
+ });
1302
+ }, []);
1303
+ return { reorderListItem, removeListItem, insertListItem };
1304
+ }
1305
+
1306
+ // ../../node_modules/@mantine/form/esm/hooks/use-form-status/use-form-status.mjs
1307
+ var import_react23 = require("react");
1308
+ var import_fast_deep_equal = __toESM(require_fast_deep_equal(), 1);
1309
+
1310
+ // ../../node_modules/@mantine/form/esm/get-status/get-status.mjs
1311
+ function getStatus(status, path) {
1312
+ const paths = Object.keys(status);
1313
+ if (typeof path === "string") {
1314
+ const nestedPaths = paths.filter((statusPath) => statusPath.startsWith(`${path}.`));
1315
+ return status[path] || nestedPaths.some((statusPath) => status[statusPath]) || false;
1316
+ }
1317
+ return paths.some((statusPath) => status[statusPath]);
1318
+ }
1319
+
1320
+ // ../../node_modules/@mantine/form/esm/hooks/use-form-status/use-form-status.mjs
1321
+ function useFormStatus({
1322
+ initialDirty,
1323
+ initialTouched,
1324
+ mode,
1325
+ $values
1326
+ }) {
1327
+ const [touchedState, setTouchedState] = (0, import_react23.useState)(initialTouched);
1328
+ const [dirtyState, setDirtyState] = (0, import_react23.useState)(initialDirty);
1329
+ const touchedRef = (0, import_react23.useRef)(initialTouched);
1330
+ const dirtyRef = (0, import_react23.useRef)(initialDirty);
1331
+ const setTouched = (0, import_react23.useCallback)((values) => {
1332
+ const resolvedValues = typeof values === "function" ? values(touchedRef.current) : values;
1333
+ touchedRef.current = resolvedValues;
1334
+ if (mode === "controlled") {
1335
+ setTouchedState(resolvedValues);
1336
+ }
1337
+ }, []);
1338
+ const setDirty = (0, import_react23.useCallback)((values) => {
1339
+ const resolvedValues = typeof values === "function" ? values(dirtyRef.current) : values;
1340
+ dirtyRef.current = resolvedValues;
1341
+ if (mode === "controlled") {
1342
+ setDirtyState(resolvedValues);
1343
+ }
1344
+ }, []);
1345
+ const resetTouched = (0, import_react23.useCallback)(() => setTouched({}), []);
1346
+ const resetDirty = (values) => {
1347
+ const newSnapshot = values ? { ...values, ...$values.refValues.current } : $values.refValues.current;
1348
+ $values.setValuesSnapshot(newSnapshot);
1349
+ setDirty({});
1350
+ };
1351
+ const setFieldTouched = (0, import_react23.useCallback)((path, touched) => {
1352
+ setTouched((currentTouched) => {
1353
+ if (getStatus(currentTouched, path) === touched) {
1354
+ return currentTouched;
1355
+ }
1356
+ return { ...currentTouched, [path]: touched };
1357
+ });
1358
+ }, []);
1359
+ const setFieldDirty = (0, import_react23.useCallback)((path, dirty) => {
1360
+ setDirty((currentDirty) => {
1361
+ if (getStatus(currentDirty, path) === dirty) {
1362
+ return currentDirty;
1363
+ }
1364
+ return { ...currentDirty, [path]: dirty };
1365
+ });
1366
+ }, []);
1367
+ const isTouched = (0, import_react23.useCallback)(
1368
+ (path) => getStatus(touchedRef.current, path),
1369
+ []
1370
+ );
1371
+ const clearFieldDirty = (0, import_react23.useCallback)(
1372
+ (path) => setDirty((current) => {
1373
+ if (typeof path !== "string") {
1374
+ return current;
1375
+ }
1376
+ const result = clearListState(path, current);
1377
+ delete result[path];
1378
+ if ((0, import_fast_deep_equal.default)(result, current)) {
1379
+ return current;
1380
+ }
1381
+ return result;
1382
+ }),
1383
+ []
1384
+ );
1385
+ const isDirty = (0, import_react23.useCallback)((path) => {
1386
+ if (path) {
1387
+ const overriddenValue = getPath(path, dirtyRef.current);
1388
+ if (typeof overriddenValue === "boolean") {
1389
+ return overriddenValue;
1390
+ }
1391
+ const sliceOfValues = getPath(path, $values.refValues.current);
1392
+ const sliceOfInitialValues = getPath(path, $values.valuesSnapshot.current);
1393
+ return !(0, import_fast_deep_equal.default)(sliceOfValues, sliceOfInitialValues);
1394
+ }
1395
+ const isOverridden = Object.keys(dirtyRef.current).length > 0;
1396
+ if (isOverridden) {
1397
+ return getStatus(dirtyRef.current);
1398
+ }
1399
+ return !(0, import_fast_deep_equal.default)($values.refValues.current, $values.valuesSnapshot.current);
1400
+ }, []);
1401
+ const getDirty = (0, import_react23.useCallback)(() => dirtyRef.current, []);
1402
+ const getTouched = (0, import_react23.useCallback)(() => touchedRef.current, []);
1403
+ return {
1404
+ touchedState,
1405
+ dirtyState,
1406
+ touchedRef,
1407
+ dirtyRef,
1408
+ setTouched,
1409
+ setDirty,
1410
+ resetDirty,
1411
+ resetTouched,
1412
+ isTouched,
1413
+ setFieldTouched,
1414
+ setFieldDirty,
1415
+ setTouchedState,
1416
+ setDirtyState,
1417
+ clearFieldDirty,
1418
+ isDirty,
1419
+ getDirty,
1420
+ getTouched
1421
+ };
1422
+ }
1423
+
1424
+ // ../../node_modules/@mantine/form/esm/hooks/use-form-values/use-form-values.mjs
1425
+ var import_react24 = require("react");
1426
+ function useFormValues({
1427
+ initialValues,
1428
+ onValuesChange,
1429
+ mode
1430
+ }) {
1431
+ const initialized = (0, import_react24.useRef)(false);
1432
+ const [stateValues, setStateValues] = (0, import_react24.useState)(initialValues || {});
1433
+ const refValues = (0, import_react24.useRef)(stateValues);
1434
+ const valuesSnapshot = (0, import_react24.useRef)(stateValues);
1435
+ const setValues = (0, import_react24.useCallback)(
1436
+ ({
1437
+ values,
1438
+ subscribers,
1439
+ updateState = true,
1440
+ mergeWithPreviousValues = true
1441
+ }) => {
1442
+ const previousValues = refValues.current;
1443
+ const resolvedValues = values instanceof Function ? values(refValues.current) : values;
1444
+ const updatedValues = mergeWithPreviousValues ? { ...previousValues, ...resolvedValues } : resolvedValues;
1445
+ refValues.current = updatedValues;
1446
+ updateState && setStateValues(updatedValues);
1447
+ onValuesChange?.(updatedValues, previousValues);
1448
+ subscribers?.filter(Boolean).forEach((subscriber) => subscriber({ updatedValues, previousValues }));
1449
+ },
1450
+ [onValuesChange]
1451
+ );
1452
+ const setFieldValue = (0, import_react24.useCallback)((payload) => {
1453
+ const currentValue = getPath(payload.path, refValues.current);
1454
+ const updatedValue = payload.value instanceof Function ? payload.value(currentValue) : payload.value;
1455
+ if (currentValue !== updatedValue) {
1456
+ const previousValues = refValues.current;
1457
+ const updatedValues = setPath(payload.path, updatedValue, refValues.current);
1458
+ setValues({ values: updatedValues, updateState: payload.updateState });
1459
+ payload.subscribers?.filter(Boolean).forEach(
1460
+ (subscriber) => subscriber({ path: payload.path, updatedValues, previousValues })
1461
+ );
1462
+ }
1463
+ }, []);
1464
+ const setValuesSnapshot = (0, import_react24.useCallback)((payload) => {
1465
+ valuesSnapshot.current = payload;
1466
+ }, []);
1467
+ const initialize = (0, import_react24.useCallback)((values, onInitialize) => {
1468
+ if (!initialized.current) {
1469
+ initialized.current = true;
1470
+ setValues({ values, updateState: mode === "controlled" });
1471
+ setValuesSnapshot(values);
1472
+ onInitialize();
1473
+ }
1474
+ }, []);
1475
+ const resetValues = (0, import_react24.useCallback)(() => {
1476
+ setValues({
1477
+ values: valuesSnapshot.current,
1478
+ updateState: true,
1479
+ mergeWithPreviousValues: false
1480
+ });
1481
+ }, []);
1482
+ const getValues = (0, import_react24.useCallback)(() => refValues.current, []);
1483
+ return {
1484
+ initialized,
1485
+ stateValues,
1486
+ refValues,
1487
+ valuesSnapshot,
1488
+ setValues,
1489
+ setFieldValue,
1490
+ resetValues,
1491
+ setValuesSnapshot,
1492
+ initialize,
1493
+ getValues
1494
+ };
1495
+ }
1496
+
1497
+ // ../../node_modules/@mantine/form/esm/hooks/use-form-watch/use-form-watch.mjs
1498
+ var import_react25 = require("react");
1499
+ function useFormWatch({
1500
+ $status
1501
+ }) {
1502
+ const subscribers = (0, import_react25.useRef)(
1503
+ {}
1504
+ );
1505
+ const watch = (0, import_react25.useCallback)((path, callback) => {
1506
+ (0, import_react25.useEffect)(() => {
1507
+ subscribers.current[path] = subscribers.current[path] || [];
1508
+ subscribers.current[path].push(callback);
1509
+ return () => {
1510
+ subscribers.current[path] = subscribers.current[path].filter((cb) => cb !== callback);
1511
+ };
1512
+ }, [callback]);
1513
+ }, []);
1514
+ const getFieldSubscribers = (0, import_react25.useCallback)((path) => {
1515
+ if (!subscribers.current[path]) {
1516
+ return [];
1517
+ }
1518
+ return subscribers.current[path].map(
1519
+ (callback) => (input) => callback({
1520
+ previousValue: getPath(path, input.previousValues),
1521
+ value: getPath(path, input.updatedValues),
1522
+ touched: $status.isTouched(path),
1523
+ dirty: $status.isDirty(path)
1524
+ })
1525
+ );
1526
+ }, []);
1527
+ return {
1528
+ subscribers,
1529
+ watch,
1530
+ getFieldSubscribers
1531
+ };
1532
+ }
1533
+
1534
+ // ../../node_modules/@mantine/form/esm/validate/validate-values.mjs
1535
+ function getValidationResults(errors) {
1536
+ const filteredErrors = filterErrors(errors);
1537
+ return { hasErrors: Object.keys(filteredErrors).length > 0, errors: filteredErrors };
1538
+ }
1539
+ function validateRulesRecord(rules, values, path = "", errors = {}) {
1540
+ if (typeof rules !== "object" || rules === null) {
1541
+ return errors;
1542
+ }
1543
+ return Object.keys(rules).reduce((acc, ruleKey) => {
1544
+ const rule = rules[ruleKey];
1545
+ const rulePath = `${path === "" ? "" : `${path}.`}${ruleKey}`;
1546
+ const value = getPath(rulePath, values);
1547
+ let arrayValidation = false;
1548
+ if (typeof rule === "function") {
1549
+ acc[rulePath] = rule(value, values, rulePath);
1550
+ }
1551
+ if (typeof rule === "object" && Array.isArray(value)) {
1552
+ arrayValidation = true;
1553
+ value.forEach(
1554
+ (_item, index) => validateRulesRecord(rule, values, `${rulePath}.${index}`, acc)
1555
+ );
1556
+ }
1557
+ if (typeof rule === "object" && typeof value === "object" && value !== null) {
1558
+ if (!arrayValidation) {
1559
+ validateRulesRecord(rule, values, rulePath, acc);
1560
+ }
1561
+ }
1562
+ return acc;
1563
+ }, errors);
1564
+ }
1565
+ function validateValues(validate, values) {
1566
+ if (typeof validate === "function") {
1567
+ return getValidationResults(validate(values));
1568
+ }
1569
+ return getValidationResults(validateRulesRecord(validate, values));
1570
+ }
1571
+
1572
+ // ../../node_modules/@mantine/form/esm/validate/validate-field-value.mjs
1573
+ function validateFieldValue(path, rules, values) {
1574
+ if (typeof path !== "string") {
1575
+ return { hasError: false, error: null };
1576
+ }
1577
+ const results = validateValues(rules, values);
1578
+ const pathInError = Object.keys(results.errors).find(
1579
+ (errorKey) => path.split(".").every((pathPart, i) => pathPart === errorKey.split(".")[i])
1580
+ );
1581
+ return { hasError: !!pathInError, error: pathInError ? results.errors[pathInError] : null };
1582
+ }
1583
+
1584
+ // ../../node_modules/@mantine/form/esm/form-index.mjs
1585
+ var FORM_INDEX = "__MANTINE_FORM_INDEX__";
1586
+
1587
+ // ../../node_modules/@mantine/form/esm/validate/should-validate-on-change.mjs
1588
+ function shouldValidateOnChange(path, validateInputOnChange) {
1589
+ if (!validateInputOnChange) {
1590
+ return false;
1591
+ }
1592
+ if (typeof validateInputOnChange === "boolean") {
1593
+ return validateInputOnChange;
1594
+ }
1595
+ if (Array.isArray(validateInputOnChange)) {
1596
+ return validateInputOnChange.includes(path.replace(/[.][0-9]/g, `.${FORM_INDEX}`));
1597
+ }
1598
+ return false;
1599
+ }
1600
+
1601
+ // ../../node_modules/@mantine/form/esm/use-form.mjs
1602
+ function useForm({
1603
+ name,
1604
+ mode = "controlled",
1605
+ initialValues,
1606
+ initialErrors = {},
1607
+ initialDirty = {},
1608
+ initialTouched = {},
1609
+ clearInputErrorOnChange = true,
1610
+ validateInputOnChange = false,
1611
+ validateInputOnBlur = false,
1612
+ onValuesChange,
1613
+ transformValues = (values) => values,
1614
+ enhanceGetInputProps,
1615
+ validate: rules
1616
+ } = {}) {
1617
+ const $errors = useFormErrors(initialErrors);
1618
+ const $values = useFormValues({ initialValues, onValuesChange, mode });
1619
+ const $status = useFormStatus({ initialDirty, initialTouched, $values, mode });
1620
+ const $list = useFormList({ $values, $errors, $status });
1621
+ const $watch = useFormWatch({ $status });
1622
+ const [formKey, setFormKey] = (0, import_react26.useState)(0);
1623
+ const [fieldKeys, setFieldKeys] = (0, import_react26.useState)({});
1624
+ const reset = (0, import_react26.useCallback)(() => {
1625
+ $values.resetValues();
1626
+ $errors.clearErrors();
1627
+ $status.resetDirty();
1628
+ $status.resetTouched();
1629
+ mode === "uncontrolled" && setFormKey((key2) => key2 + 1);
1630
+ }, []);
1631
+ const initialize = (0, import_react26.useCallback)((values) => {
1632
+ $values.initialize(values, () => mode === "uncontrolled" && setFormKey((key2) => key2 + 1));
1633
+ }, []);
1634
+ const setFieldValue = (0, import_react26.useCallback)(
1635
+ (path, value, options3) => {
1636
+ const shouldValidate = shouldValidateOnChange(path, validateInputOnChange);
1637
+ $status.clearFieldDirty(path);
1638
+ $status.setFieldTouched(path, true);
1639
+ !shouldValidate && clearInputErrorOnChange && $errors.clearFieldError(path);
1640
+ $values.setFieldValue({
1641
+ path,
1642
+ value,
1643
+ updateState: mode === "controlled",
1644
+ subscribers: [
1645
+ ...$watch.getFieldSubscribers(path),
1646
+ shouldValidate ? (payload) => {
1647
+ const validationResults = validateFieldValue(path, rules, payload.updatedValues);
1648
+ validationResults.hasError ? $errors.setFieldError(path, validationResults.error) : $errors.clearFieldError(path);
1649
+ } : null,
1650
+ options3?.forceUpdate !== false && mode !== "controlled" ? () => setFieldKeys((keys) => ({
1651
+ ...keys,
1652
+ [path]: (keys[path] || 0) + 1
1653
+ })) : null
1654
+ ]
1655
+ });
1656
+ },
1657
+ [onValuesChange, rules]
1658
+ );
1659
+ const setValues = (0, import_react26.useCallback)(
1660
+ (values) => {
1661
+ const previousValues = $values.refValues.current;
1662
+ $values.setValues({ values, updateState: mode === "controlled" });
1663
+ clearInputErrorOnChange && $errors.clearErrors();
1664
+ mode === "uncontrolled" && setFormKey((key2) => key2 + 1);
1665
+ Object.keys($watch.subscribers.current).forEach((path) => {
1666
+ const value = getPath(path, $values.refValues.current);
1667
+ const previousValue = getPath(path, previousValues);
1668
+ if (value !== previousValue) {
1669
+ $watch.getFieldSubscribers(path).forEach((cb) => cb({ previousValues, updatedValues: $values.refValues.current }));
1670
+ }
1671
+ });
1672
+ },
1673
+ [onValuesChange, clearInputErrorOnChange]
1674
+ );
1675
+ const validate = (0, import_react26.useCallback)(() => {
1676
+ const results = validateValues(rules, $values.refValues.current);
1677
+ $errors.setErrors(results.errors);
1678
+ return results;
1679
+ }, [rules]);
1680
+ const validateField = (0, import_react26.useCallback)(
1681
+ (path) => {
1682
+ const results = validateFieldValue(path, rules, $values.refValues.current);
1683
+ results.hasError ? $errors.setFieldError(path, results.error) : $errors.clearFieldError(path);
1684
+ return results;
1685
+ },
1686
+ [rules]
1687
+ );
1688
+ const getInputProps = (path, { type = "input", withError = true, withFocus = true, ...otherOptions } = {}) => {
1689
+ const onChange = getInputOnChange(
1690
+ (value) => setFieldValue(path, value, { forceUpdate: false })
1691
+ );
1692
+ const payload = { onChange };
1693
+ if (withError) {
1694
+ payload.error = $errors.errorsState[path];
1695
+ }
1696
+ if (type === "checkbox") {
1697
+ payload[mode === "controlled" ? "checked" : "defaultChecked"] = getPath(
1698
+ path,
1699
+ $values.refValues.current
1700
+ );
1701
+ } else {
1702
+ payload[mode === "controlled" ? "value" : "defaultValue"] = getPath(
1703
+ path,
1704
+ $values.refValues.current
1705
+ );
1706
+ }
1707
+ if (withFocus) {
1708
+ payload.onFocus = () => $status.setFieldTouched(path, true);
1709
+ payload.onBlur = () => {
1710
+ if (shouldValidateOnChange(path, validateInputOnBlur)) {
1711
+ const validationResults = validateFieldValue(path, rules, $values.refValues.current);
1712
+ validationResults.hasError ? $errors.setFieldError(path, validationResults.error) : $errors.clearFieldError(path);
1713
+ }
1714
+ };
1715
+ }
1716
+ return Object.assign(
1717
+ payload,
1718
+ enhanceGetInputProps?.({
1719
+ inputProps: payload,
1720
+ field: path,
1721
+ options: { type, withError, withFocus, ...otherOptions },
1722
+ form
1723
+ })
1724
+ );
1725
+ };
1726
+ const onSubmit = (handleSubmit, handleValidationFailure) => (event) => {
1727
+ event?.preventDefault();
1728
+ const results = validate();
1729
+ if (results.hasErrors) {
1730
+ handleValidationFailure?.(results.errors, $values.refValues.current, event);
1731
+ } else {
1732
+ handleSubmit?.(transformValues($values.refValues.current), event);
1733
+ }
1734
+ };
1735
+ const getTransformedValues = (input) => transformValues(input || $values.refValues.current);
1736
+ const onReset = (0, import_react26.useCallback)((event) => {
1737
+ event.preventDefault();
1738
+ reset();
1739
+ }, []);
1740
+ const isValid = (0, import_react26.useCallback)(
1741
+ (path) => path ? !validateFieldValue(path, rules, $values.refValues.current).hasError : !validateValues(rules, $values.refValues.current).hasErrors,
1742
+ [rules]
1743
+ );
1744
+ const key = (path) => `${formKey}-${path}-${fieldKeys[path] || 0}`;
1745
+ const form = {
1746
+ watch: $watch.watch,
1747
+ initialized: $values.initialized.current,
1748
+ values: $values.stateValues,
1749
+ getValues: $values.getValues,
1750
+ setInitialValues: $values.setValuesSnapshot,
1751
+ initialize,
1752
+ setValues,
1753
+ setFieldValue,
1754
+ errors: $errors.errorsState,
1755
+ setErrors: $errors.setErrors,
1756
+ setFieldError: $errors.setFieldError,
1757
+ clearFieldError: $errors.clearFieldError,
1758
+ clearErrors: $errors.clearErrors,
1759
+ resetDirty: $status.resetDirty,
1760
+ setTouched: $status.setTouched,
1761
+ setDirty: $status.setDirty,
1762
+ isTouched: $status.isTouched,
1763
+ resetTouched: $status.resetTouched,
1764
+ isDirty: $status.isDirty,
1765
+ getTouched: $status.getTouched,
1766
+ getDirty: $status.getDirty,
1767
+ reorderListItem: $list.reorderListItem,
1768
+ insertListItem: $list.insertListItem,
1769
+ removeListItem: $list.removeListItem,
1770
+ reset,
1771
+ validate,
1772
+ validateField,
1773
+ getInputProps,
1774
+ onSubmit,
1775
+ onReset,
1776
+ isValid,
1777
+ getTransformedValues,
1778
+ key
1779
+ };
1780
+ useFormActions(name, form);
1781
+ return form;
1782
+ }
1783
+
1784
+ // src/nodes/modifiers/noise-curve-node.tsx
1785
+ var import_react27 = require("react");
1786
+ var import_modifier3 = require("libnoise-ts/module/modifier");
1787
+ var import_util = require("libnoise-ts/util");
1788
+ var import_icons_react2 = require("@tabler/icons-react");
1789
+ var import_hooks19 = require("@mantine/hooks");
1790
+ var import_abstract5 = require("@awesome-flow/core/abstract");
1791
+ var import_jsx_runtime21 = require("react/jsx-runtime");
1792
+ function NoiseCurveNode({ id, selected, data, type }) {
1793
+ const incoming = (0, import_hooks18.useIncomingComputedData)(id);
1794
+ const updateNodeData = (0, import_hooks18.useUpdateNodeData)();
1795
+ const updateComputedData = (0, import_hooks18.useUpdateNodeComputedData)();
1796
+ const [values, setValues] = (0, import_react27.useState)([]);
1797
+ const form = useForm({
1798
+ mode: "uncontrolled",
1799
+ initialValues: {
1800
+ points: []
1801
+ },
1802
+ validateInputOnChange: [`points.${FORM_INDEX}.input`],
1803
+ clearInputErrorOnChange: true,
1804
+ validate: {
1805
+ points: {
1806
+ input: (value, values2) => {
1807
+ const counts = {};
1808
+ values2.points.forEach((x) => {
1809
+ counts[x.input] = (counts[x.input] || 0) + 1;
1810
+ });
1811
+ return counts[value] > 1;
1812
+ }
1813
+ }
1814
+ },
1815
+ onValuesChange: (0, import_react27.useCallback)((values2) => {
1816
+ if (form.isValid()) {
1817
+ const points = values2.points.map((v) => ({ input: v.input, output: v.output }));
1818
+ setValues(points);
1819
+ updateNodeData(id, { points });
1820
+ }
1821
+ form.validate();
1822
+ }, [])
1823
+ });
1824
+ (0, import_react27.useEffect)(() => {
1825
+ const points = data.points?.length ? data.points.map((v) => ({ input: v.input, output: v.output, key: (0, import_hooks19.randomId)() })) : [1, 2, 3, 4].map(() => ({ input: 0, output: 0, key: (0, import_hooks19.randomId)() }));
1826
+ form.initialize({ points });
1827
+ }, []);
1828
+ (0, import_react27.useEffect)(() => {
1829
+ if (incoming?.length && values?.length >= 4) {
1830
+ const module2 = new import_modifier3.Curve(
1831
+ incoming[0].module,
1832
+ values.map((p) => new import_util.Tuple(p.input, p.output))
1833
+ );
1834
+ updateComputedData(id, { module: module2 });
1835
+ }
1836
+ }, [values, incoming]);
1837
+ const fields = form.getValues().points.map((item, index) => /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(import_core9.Group, { mt: "xs", children: [
1838
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
1839
+ import_core9.NumberInput,
1840
+ {
1841
+ size: "xs",
1842
+ w: 100,
1843
+ placeholder: "Input Value",
1844
+ ...form.getInputProps(`points.${index}.input`),
1845
+ step: 0.1
1846
+ },
1847
+ form.key(`points.${index}.input`)
1848
+ ),
1849
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
1850
+ import_core9.NumberInput,
1851
+ {
1852
+ size: "xs",
1853
+ w: 100,
1854
+ placeholder: "Output Value",
1855
+ ...form.getInputProps(`points.${index}.output`),
1856
+ step: 0.1
1857
+ },
1858
+ form.key(`points.${index}.output`)
1859
+ ),
1860
+ data.state === import_abstract5.NodeState.edit && values.length > 4 && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
1861
+ import_core9.ActionIcon,
1862
+ {
1863
+ color: "red",
1864
+ variant: "outline",
1865
+ size: "sm",
1866
+ onClick: () => form.removeListItem("points", index),
1867
+ children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_icons_react2.IconX, { size: "1rem" })
1868
+ }
1869
+ )
1870
+ ] }, item.key));
1871
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(import_layout18.NodeContainer, { id, selected, type, data, children: [
1872
+ fields,
1873
+ data.state === import_abstract5.NodeState.edit && /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(import_jsx_runtime21.Fragment, { children: [
1874
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_core9.Space, { h: 10 }),
1875
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
1876
+ import_core9.Button,
1877
+ {
1878
+ variant: "outline",
1879
+ size: "xs",
1880
+ fullWidth: true,
1881
+ onClick: () => form.insertListItem("points", { input: 0, output: 0, key: (0, import_hooks19.randomId)() }),
1882
+ children: "Add control point"
1883
+ }
1884
+ )
1885
+ ] }),
1886
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_layout18.NodeTrackConnections, { handles: data.handles, nodeId: id, type: "target" })
1887
+ ] });
1888
+ }
1889
+ var noise_curve_node_default = NoiseCurveNode;
1890
+
1891
+ // src/nodes/modifiers/noise-exponent-node.tsx
1892
+ var import_layout19 = require("@awesome-flow/core/layout");
1893
+ var import_react28 = require("react");
1894
+ var import_core10 = require("@mantine/core");
1895
+ var import_hooks20 = require("@awesome-flow/core/hooks");
1896
+ var import_modifier4 = require("libnoise-ts/module/modifier");
1897
+ var import_jsx_runtime22 = require("react/jsx-runtime");
1898
+ function NoiseExponentNode({ id, selected, data, type }) {
1899
+ const [exponent, setExponent] = (0, import_react28.useState)(data.exponent);
1900
+ const incoming = (0, import_hooks20.useIncomingComputedData)(id);
1901
+ const updateNodeData = (0, import_hooks20.useUpdateNodeData)();
1902
+ const updateComputedData = (0, import_hooks20.useUpdateNodeComputedData)();
1903
+ (0, import_react28.useEffect)(() => {
1904
+ if (incoming?.length > 0) {
1905
+ const module2 = new import_modifier4.Exponent(incoming[0].module, exponent);
1906
+ updateComputedData(id, { module: module2 });
1907
+ }
1908
+ updateNodeData(id, { exponent });
1909
+ }, [incoming, exponent]);
1910
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(import_layout19.NodeContainer, { id, selected, data, type, children: [
1911
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_core10.Stack, { children: /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(import_core10.Group, { children: [
1912
+ "Exponent:",
1913
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
1914
+ import_core10.NumberInput,
1915
+ {
1916
+ size: "xs",
1917
+ value: exponent,
1918
+ onChange: (e) => setExponent(Number(e)),
1919
+ step: 0.1
1920
+ }
1921
+ )
1922
+ ] }) }),
1923
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_layout19.NodeTrackConnections, { handles: data.handles, nodeId: id, type: "target" })
1924
+ ] });
1925
+ }
1926
+ var noise_exponent_node_default = NoiseExponentNode;
1927
+
1928
+ // src/nodes/modifiers/noise-invert-node.tsx
1929
+ var import_layout20 = require("@awesome-flow/core/layout");
1930
+ var import_react29 = require("react");
1931
+ var import_hooks21 = require("@awesome-flow/core/hooks");
1932
+ var import_modifier5 = require("libnoise-ts/module/modifier");
1933
+ var import_jsx_runtime23 = require("react/jsx-runtime");
1934
+ function NoiseInvertNode({ id, selected, data, type }) {
1935
+ const incoming = (0, import_hooks21.useIncomingComputedData)(id);
1936
+ const updateComputedData = (0, import_hooks21.useUpdateNodeComputedData)();
1937
+ (0, import_react29.useEffect)(() => {
1938
+ if (incoming?.length > 0) {
1939
+ const module2 = new import_modifier5.Invert(incoming[0].module);
1940
+ updateComputedData(id, { module: module2 });
1941
+ }
1942
+ }, [incoming]);
1943
+ return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_layout20.NodeContainer, { id, selected, data, type, children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_layout20.NodeTrackConnections, { handles: data.handles, nodeId: id, type: "target" }) });
1944
+ }
1945
+ var noise_invert_node_default = NoiseInvertNode;
1946
+
1947
+ // src/nodes/modifiers/noise-normalize-node.tsx
1948
+ var import_layout21 = require("@awesome-flow/core/layout");
1949
+ var import_react30 = require("react");
1950
+ var import_core11 = require("@mantine/core");
1951
+ var import_hooks22 = require("@awesome-flow/core/hooks");
1952
+
1953
+ // src/modules/normalize-noise-module.ts
1954
+ var import_modifier6 = __toESM(require("libnoise-ts/module/modifier"), 1);
1955
+ var NormalizeNoiseModule = class extends import_modifier6.default {
1956
+ constructor(source, lowerBound, upperBound) {
1957
+ super(source);
1958
+ this.lowerBound = lowerBound;
1959
+ this.upperBound = upperBound;
1960
+ }
1961
+ getValue(x, y, z) {
1962
+ return normalize(this.sourceModule.getValue(x, y, z), this.lowerBound, this.upperBound);
1963
+ }
1964
+ };
1965
+ function normalize(value, min, max) {
1966
+ return (value - min) / (max - min);
1967
+ }
1968
+
1969
+ // src/nodes/modifiers/noise-normalize-node.tsx
1970
+ var import_jsx_runtime24 = require("react/jsx-runtime");
1971
+ function NoiseNormalizeNode({ id, selected, data, type }) {
1972
+ const [intervalStart, setIntervalStart] = (0, import_react30.useState)(data.intervalStart);
1973
+ const [intervalEnd, setIntervalEnd] = (0, import_react30.useState)(data.intervalEnd);
1974
+ const incoming = (0, import_hooks22.useIncomingComputedData)(id);
1975
+ const updateNodeData = (0, import_hooks22.useUpdateNodeData)();
1976
+ const updateComputedData = (0, import_hooks22.useUpdateNodeComputedData)();
1977
+ (0, import_react30.useEffect)(() => {
1978
+ if (incoming?.length) {
1979
+ const source = incoming[0].module;
1980
+ const module2 = new NormalizeNoiseModule(source, intervalStart, intervalEnd);
1981
+ updateComputedData(id, { module: module2 });
1982
+ }
1983
+ updateNodeData(id, { intervalStart, intervalEnd });
1984
+ }, [incoming, intervalStart, intervalEnd]);
1985
+ return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_layout21.NodeContainer, { id, selected, data, type, children: [
1986
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_core11.Stack, { children: /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_core11.Group, { children: [
1987
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
1988
+ import_core11.NumberInput,
1989
+ {
1990
+ size: "xs",
1991
+ w: 100,
1992
+ value: intervalStart,
1993
+ onChange: (e) => setIntervalStart(Number(e))
1994
+ }
1995
+ ),
1996
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
1997
+ import_core11.NumberInput,
1998
+ {
1999
+ size: "xs",
2000
+ w: 100,
2001
+ value: intervalEnd,
2002
+ onChange: (e) => setIntervalEnd(Number(e))
2003
+ }
2004
+ )
2005
+ ] }) }),
2006
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_layout21.NodeTrackConnections, { handles: data.handles, nodeId: id, type: "target" })
2007
+ ] });
2008
+ }
2009
+ var noise_normalize_node_default = NoiseNormalizeNode;
2010
+
2011
+ // src/nodes/modifiers/noise-scale-bias-node.tsx
2012
+ var import_layout22 = require("@awesome-flow/core/layout");
2013
+ var import_react31 = require("react");
2014
+ var import_core12 = require("@mantine/core");
2015
+ var import_hooks23 = require("@awesome-flow/core/hooks");
2016
+ var import_modifier7 = require("libnoise-ts/module/modifier");
2017
+ var import_jsx_runtime25 = require("react/jsx-runtime");
2018
+ function NoiseScaleBiasNode({ id, selected, data, type }) {
2019
+ const [scale, setScale] = (0, import_react31.useState)(data.scale);
2020
+ const [bias, setBias] = (0, import_react31.useState)(data.bias);
2021
+ const incoming = (0, import_hooks23.useIncomingComputedData)(id);
2022
+ const updateNodeData = (0, import_hooks23.useUpdateNodeData)();
2023
+ const updateComputedData = (0, import_hooks23.useUpdateNodeComputedData)();
2024
+ (0, import_react31.useEffect)(() => {
2025
+ if (incoming?.length > 0) {
2026
+ const module2 = new import_modifier7.ScaleBias(incoming[0].module, scale, bias);
2027
+ updateComputedData(id, { module: module2 });
2028
+ }
2029
+ updateNodeData(id, { scale, bias });
2030
+ }, [incoming, scale, bias]);
2031
+ return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(import_layout22.NodeContainer, { id, selected, data, type, children: [
2032
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(import_core12.Stack, { children: [
2033
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(import_core12.Group, { children: [
2034
+ "Scale:",
2035
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
2036
+ import_core12.NumberInput,
2037
+ {
2038
+ size: "xs",
2039
+ w: 100,
2040
+ value: scale,
2041
+ onChange: (e) => setScale(Number(e)),
2042
+ step: 0.1
2043
+ }
2044
+ )
2045
+ ] }),
2046
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(import_core12.Group, { children: [
2047
+ "Bias:",
2048
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
2049
+ import_core12.NumberInput,
2050
+ {
2051
+ size: "xs",
2052
+ w: 100,
2053
+ value: bias,
2054
+ onChange: (e) => setBias(Number(e)),
2055
+ step: 0.1
2056
+ }
2057
+ )
2058
+ ] })
2059
+ ] }),
2060
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_layout22.NodeTrackConnections, { handles: data.handles, nodeId: id, type: "target" })
2061
+ ] });
2062
+ }
2063
+ var noise_scale_bias_node_default = NoiseScaleBiasNode;
2064
+
2065
+ // src/nodes/modifiers/noise-terrace-node.tsx
2066
+ var import_layout23 = require("@awesome-flow/core/layout");
2067
+ var import_core13 = require("@mantine/core");
2068
+ var import_hooks24 = require("@awesome-flow/core/hooks");
2069
+ var import_react32 = require("react");
2070
+ var import_modifier8 = require("libnoise-ts/module/modifier");
2071
+ var import_icons_react3 = require("@tabler/icons-react");
2072
+ var import_hooks25 = require("@mantine/hooks");
2073
+ var import_abstract6 = require("@awesome-flow/core/abstract");
2074
+ var import_jsx_runtime26 = require("react/jsx-runtime");
2075
+ function NoiseTerraceNode({ id, selected, data, type }) {
2076
+ const incoming = (0, import_hooks24.useIncomingComputedData)(id);
2077
+ const updateNodeData = (0, import_hooks24.useUpdateNodeData)();
2078
+ const updateComputedData = (0, import_hooks24.useUpdateNodeComputedData)();
2079
+ const [values, setValues] = (0, import_react32.useState)([]);
2080
+ const form = useForm({
2081
+ mode: "uncontrolled",
2082
+ initialValues: {
2083
+ points: []
2084
+ },
2085
+ validateInputOnChange: [`points.${FORM_INDEX}.input`],
2086
+ clearInputErrorOnChange: true,
2087
+ onValuesChange: (0, import_react32.useCallback)((values2) => {
2088
+ if (form.isValid()) {
2089
+ const points = values2.points.map((v) => v.value);
2090
+ setValues(points);
2091
+ updateNodeData(id, { points });
2092
+ }
2093
+ form.validate();
2094
+ }, [])
2095
+ });
2096
+ (0, import_react32.useEffect)(() => {
2097
+ const points = data.points?.length ? data.points.map((v) => ({ value: v, key: (0, import_hooks25.randomId)() })) : [1, 2].map(() => ({ value: 0, key: (0, import_hooks25.randomId)() }));
2098
+ form.initialize({ points });
2099
+ }, []);
2100
+ (0, import_react32.useEffect)(() => {
2101
+ if (incoming?.length && values?.length >= 2) {
2102
+ const module2 = new import_modifier8.Terrace(incoming[0].module, values);
2103
+ updateComputedData(id, { module: module2 });
2104
+ }
2105
+ }, [values, incoming]);
2106
+ const fields = form.getValues().points.map((item, index) => /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(import_core13.Group, { mt: "xs", children: [
2107
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
2108
+ import_core13.NumberInput,
2109
+ {
2110
+ size: "xs",
2111
+ placeholder: "Input Value",
2112
+ ...form.getInputProps(`points.${index}.value`),
2113
+ step: 0.1
2114
+ },
2115
+ form.key(`points.${index}.value`)
2116
+ ),
2117
+ data.state === import_abstract6.NodeState.edit && values.length > 2 && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
2118
+ import_core13.ActionIcon,
2119
+ {
2120
+ color: "red",
2121
+ variant: "outline",
2122
+ size: "sm",
2123
+ onClick: () => form.removeListItem("points", index),
2124
+ children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_icons_react3.IconX, { size: "1rem" })
2125
+ }
2126
+ )
2127
+ ] }, item.key));
2128
+ return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(import_layout23.NodeContainer, { id, selected, type, data, children: [
2129
+ fields,
2130
+ data.state === import_abstract6.NodeState.edit && /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(import_jsx_runtime26.Fragment, { children: [
2131
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_core13.Space, { h: 10 }),
2132
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
2133
+ import_core13.Button,
2134
+ {
2135
+ variant: "outline",
2136
+ size: "xs",
2137
+ fullWidth: true,
2138
+ onClick: () => form.insertListItem("points", { value: 0, key: (0, import_hooks25.randomId)() }),
2139
+ children: "Add control point"
2140
+ }
2141
+ )
2142
+ ] }),
2143
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_layout23.NodeTrackConnections, { handles: data.handles, nodeId: id, type: "target" })
2144
+ ] });
2145
+ }
2146
+ var noise_terrace_node_default = NoiseTerraceNode;
2147
+
2148
+ // src/nodes/modifiers/variable-combine-node.tsx
2149
+ var import_layout24 = require("@awesome-flow/core/layout");
2150
+ var import_react33 = require("react");
2151
+ var import_hooks26 = require("@awesome-flow/core/hooks");
2152
+ var import_icons_react4 = require("@tabler/icons-react");
2153
+ var import_jsx_runtime27 = require("react/jsx-runtime");
2154
+ var options2 = {
2155
+ add: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_icons_react4.IconPlus, {}),
2156
+ divide: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_icons_react4.IconDivide, {}),
2157
+ min: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_icons_react4.IconChevronLeft, {}),
2158
+ max: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_icons_react4.IconChevronRight, {}),
2159
+ multiply: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_icons_react4.IconAsterisk, {}),
2160
+ power: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_icons_react4.IconChevronUp, {})
2161
+ };
2162
+ function VariableCombineNode({
2163
+ id,
2164
+ selected,
2165
+ data,
2166
+ type
2167
+ }) {
2168
+ const [operation, setOperation] = (0, import_react33.useState)(data.operation);
2169
+ const [value, setValue] = (0, import_react33.useState)(data.value);
2170
+ const updateNodeData = (0, import_hooks26.useUpdateNodeData)();
2171
+ const incoming = (0, import_hooks26.useIncomingNodeData)(id);
2172
+ (0, import_react33.useEffect)(() => {
2173
+ if (incoming?.length > 1) {
2174
+ const result = getOperationResult(operation, incoming[0].value, incoming[1].value);
2175
+ setValue(result);
2176
+ updateNodeData(id, { value: result });
2177
+ }
2178
+ }, [operation, incoming]);
2179
+ const onChange = (0, import_react33.useCallback)((op) => {
2180
+ updateNodeData(id, { operation: op });
2181
+ setOperation(op);
2182
+ }, []);
2183
+ return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(import_layout24.NodeContainer, { id, selected, data, type, children: [
2184
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_layout24.NodeCombobox, { options: options2, selected: operation, onChange }),
2185
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(node_value_input_default, { value, onChange: () => {
2186
+ }, disabled: true }),
2187
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_layout24.NodeTrackConnections, { handles: data.handles, nodeId: id, type: "target" })
2188
+ ] });
2189
+ }
2190
+ function getOperationResult(operation, value1, value2) {
2191
+ switch (operation) {
2192
+ case "add" /* add */:
2193
+ return Number(value1) + Number(value2);
2194
+ case "divide" /* divide */:
2195
+ return Number(value1) / (Number(value2) || 1);
2196
+ case "max" /* max */:
2197
+ return Number(value1) > Number(value2) ? value1 : value2;
2198
+ case "min" /* min */:
2199
+ return Number(value1) < Number(value2) ? value1 : value2;
2200
+ case "multiply" /* multiply */:
2201
+ return Number(value1) * Number(value2);
2202
+ case "power" /* power */:
2203
+ return Number(value1) ** Number(value2);
2204
+ }
2205
+ }
2206
+ var variable_combine_node_default = VariableCombineNode;
2207
+
2208
+ // src/nodes/output/noise-logger-node.tsx
2209
+ var import_layout26 = require("@awesome-flow/core/layout");
2210
+ var import_react34 = require("react");
2211
+ var import_core14 = require("@mantine/core");
2212
+ var import_hooks27 = require("@awesome-flow/core/hooks");
2213
+ var import_jsx_runtime28 = require("react/jsx-runtime");
2214
+ function NoiseLoggerNode({ id, selected, data, type }) {
2215
+ const incoming = (0, import_hooks27.useIncomingComputedData)(id);
2216
+ const noise = (0, import_react34.useMemo)(() => incoming?.map((p) => p.noise).flat(), [incoming]);
2217
+ return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(import_layout26.NodeContainer, { id, selected, data, type, children: [
2218
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(import_core14.Text, { children: [
2219
+ "Size: ",
2220
+ noise?.length || 0
2221
+ ] }),
2222
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_core14.Divider, { h: 5 }),
2223
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_core14.Stack, { children: noise?.map((v, i) => /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(import_core14.Text, { children: [
2224
+ v.position?.x,
2225
+ ":",
2226
+ v.position?.y,
2227
+ ":",
2228
+ v.position?.z,
2229
+ ": ",
2230
+ v.value
2231
+ ] }, i)) }),
2232
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_layout26.NodeTrackConnections, { handles: data.handles, nodeId: id, type: "target" })
2233
+ ] });
2234
+ }
2235
+ var noise_logger_node_default = NoiseLoggerNode;
2236
+
2237
+ // src/nodes/output/noise-output-node.tsx
2238
+ var import_layout27 = require("@awesome-flow/core/layout");
2239
+ var import_hooks28 = require("@awesome-flow/core/hooks");
2240
+ var import_core15 = require("@mantine/core");
2241
+ var import_react35 = require("react");
2242
+ var import_jsx_runtime29 = require("react/jsx-runtime");
2243
+ function NoiseOutputNode({ id, selected, data, type }) {
2244
+ const [generating, setGenerating] = (0, import_react35.useState)(false);
2245
+ const updateComputedData = (0, import_hooks28.useUpdateNodeComputedData)();
2246
+ const incomingModules = (0, import_hooks28.useIncomingComputedData)(id, 8 /* module */);
2247
+ const incomingPositions = (0, import_hooks28.useIncomingComputedData)(
2248
+ id,
2249
+ 4 /* position */
2250
+ );
2251
+ (0, import_react35.useEffect)(() => {
2252
+ if (incomingPositions?.length && incomingModules?.length) {
2253
+ const { module: module2 } = incomingModules[0];
2254
+ if (module2) {
2255
+ setGenerating(true);
2256
+ }
2257
+ }
2258
+ }, [incomingModules, incomingPositions]);
2259
+ (0, import_react35.useEffect)(() => {
2260
+ if (incomingPositions?.length && incomingModules?.length) {
2261
+ const { module: module2 } = incomingModules[0];
2262
+ if (module2 && generating) {
2263
+ const noise = [];
2264
+ for (const input of incomingPositions) {
2265
+ for (const position of input.positions) {
2266
+ const value = module2.getValue(position.x, position.y, position.z);
2267
+ noise.push({
2268
+ position,
2269
+ value
2270
+ });
2271
+ }
2272
+ }
2273
+ console.log("SET COMPUTED DATA");
2274
+ updateComputedData(id, { noise, module: module2 });
2275
+ setGenerating(false);
2276
+ }
2277
+ }
2278
+ }, [generating]);
2279
+ return /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(import_layout27.NodeContainer, { id, selected, data, type, children: [
2280
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(import_core15.Box, { pos: "relative", children: [
2281
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
2282
+ import_core15.LoadingOverlay,
2283
+ {
2284
+ visible: generating,
2285
+ zIndex: 1e3,
2286
+ overlayProps: { radius: "sm", blur: 2 }
2287
+ }
2288
+ ),
2289
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(import_core15.Stack, { children: [
2290
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(import_core15.Group, { children: [
2291
+ "Position Inputs: ",
2292
+ incomingPositions?.length
2293
+ ] }),
2294
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(import_core15.Group, { children: [
2295
+ "Module Inputs: ",
2296
+ incomingModules?.length
2297
+ ] })
2298
+ ] })
2299
+ ] }),
2300
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_layout27.NodeTrackConnections, { handles: data.handles, nodeId: id, type: "target" })
2301
+ ] });
2302
+ }
2303
+ var noise_output_node_default = NoiseOutputNode;
2304
+
2305
+ // src/nodes/output/noise-raw-texture-node.tsx
2306
+ var import_layout28 = require("@awesome-flow/core/layout");
2307
+ var import_react36 = require("react");
2308
+ var import_hooks29 = require("@awesome-flow/core/hooks");
2309
+ var import_core16 = require("@mantine/core");
2310
+ var import_jsx_runtime30 = require("react/jsx-runtime");
2311
+ function NoiseRawTextureNode({ id, selected, data, type }) {
2312
+ const updateComputedData = (0, import_hooks29.useUpdateNodeComputedData)();
2313
+ const [dataLength, setDataLength] = (0, import_react36.useState)(0);
2314
+ const [resolution, setResolution] = (0, import_react36.useState)(0);
2315
+ const incoming = (0, import_hooks29.useIncomingComputedData)(id);
2316
+ const noise = (0, import_react36.useMemo)(() => incoming?.map((p) => p.noise).flat(), [incoming]);
2317
+ (0, import_react36.useEffect)(() => {
2318
+ if (noise?.length) {
2319
+ const size = Math.ceil(Math.sqrt(noise.length));
2320
+ const colors = noise.map((n) => [n.value * 255, n.value * 255, n.value * 255, 255]).flat();
2321
+ const dataArray = new Uint8Array(size * size * 4);
2322
+ dataArray.set(colors);
2323
+ setResolution(size);
2324
+ setDataLength(dataArray.length);
2325
+ updateComputedData(id, { textureData: dataArray, textureResolution: size });
2326
+ }
2327
+ }, [noise]);
2328
+ return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(import_layout28.NodeContainer, { id, selected, data, type, children: [
2329
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(import_core16.Stack, { children: [
2330
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(import_core16.Group, { children: [
2331
+ "Resolution: ",
2332
+ resolution,
2333
+ "x",
2334
+ resolution
2335
+ ] }),
2336
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(import_core16.Group, { children: [
2337
+ "Input Length: ",
2338
+ noise?.length || 0
2339
+ ] }),
2340
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(import_core16.Group, { children: [
2341
+ "Output Length (",
2342
+ resolution,
2343
+ "*",
2344
+ resolution,
2345
+ "*4): ",
2346
+ dataLength
2347
+ ] })
2348
+ ] }),
2349
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_layout28.NodeTrackConnections, { handles: data.handles, nodeId: id, type: "target" })
2350
+ ] });
2351
+ }
2352
+ var noise_raw_texture_node_default = NoiseRawTextureNode;
2353
+
2354
+ // src/nodes/output/positions-logger-node.tsx
2355
+ var import_layout29 = require("@awesome-flow/core/layout");
2356
+ var import_react37 = require("react");
2357
+ var import_core17 = require("@mantine/core");
2358
+ var import_hooks30 = require("@awesome-flow/core/hooks");
2359
+ var import_jsx_runtime31 = require("react/jsx-runtime");
2360
+ function PositionsLoggerNode({ id, selected, data, type }) {
2361
+ const incoming = (0, import_hooks30.useIncomingComputedData)(id);
2362
+ const positions = (0, import_react37.useMemo)(() => {
2363
+ return incoming?.map((p) => p.positions).flat();
2364
+ }, [incoming]);
2365
+ return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(import_layout29.NodeContainer, { id, selected, data, type, children: [
2366
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(import_core17.Text, { children: [
2367
+ "Size: ",
2368
+ positions?.length || 0
2369
+ ] }),
2370
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_core17.Divider, { h: 5 }),
2371
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_core17.Stack, { children: positions?.map((v, i) => /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(import_core17.Text, { children: [
2372
+ v.x,
2373
+ ":",
2374
+ v.y,
2375
+ ":",
2376
+ v.z
2377
+ ] }, i)) }),
2378
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_layout29.NodeTrackConnections, { handles: data.handles, nodeId: id, type: "target" })
2379
+ ] });
2380
+ }
2381
+ var positions_logger_node_default = PositionsLoggerNode;
2382
+
2383
+ // src/nodes/selectors/noise-blend-node.tsx
2384
+ var import_layout30 = require("@awesome-flow/core/layout");
2385
+ var import_react38 = require("react");
2386
+ var import_hooks31 = require("@awesome-flow/core/hooks");
2387
+ var import_selector = require("libnoise-ts/module/selector");
2388
+ var import_core18 = require("@mantine/core");
2389
+ var import_jsx_runtime32 = require("react/jsx-runtime");
2390
+ function NoiseBlendNode({ id, selected, data, type }) {
2391
+ const incoming = (0, import_hooks31.useIncomingComputedData)(id);
2392
+ const updateComputedData = (0, import_hooks31.useUpdateNodeComputedData)();
2393
+ (0, import_react38.useEffect)(() => {
2394
+ if (incoming?.length > 2) {
2395
+ const module2 = new import_selector.Blend(incoming[0].module, incoming[1].module, incoming[2].module);
2396
+ updateComputedData(id, { module: module2 });
2397
+ }
2398
+ }, [id, incoming, updateComputedData]);
2399
+ return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(import_layout30.NodeContainer, { id, selected, data, type, children: [
2400
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(import_core18.Group, { children: [
2401
+ "Modules: ",
2402
+ incoming?.length
2403
+ ] }),
2404
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(import_layout30.NodeTrackConnections, { handles: data.handles, nodeId: id, type: "target" })
2405
+ ] });
2406
+ }
2407
+ var noise_blend_node_default = NoiseBlendNode;
2408
+
2409
+ // src/nodes/selectors/noise-select-node.tsx
2410
+ var import_layout31 = require("@awesome-flow/core/layout");
2411
+ var import_react39 = require("react");
2412
+ var import_hooks32 = require("@awesome-flow/core/hooks");
2413
+ var import_selector2 = require("libnoise-ts/module/selector");
2414
+ var import_core19 = require("@mantine/core");
2415
+ var import_jsx_runtime33 = require("react/jsx-runtime");
2416
+ function NoiseSelectNode({ id, selected, data, type }) {
2417
+ const [edgeFalloff, setEdgeFalloff] = (0, import_react39.useState)(data.edgeFalloff);
2418
+ const [lowerBound, setLowerBound] = (0, import_react39.useState)(data.lowerBound);
2419
+ const [upperBound, setUpperBound] = (0, import_react39.useState)(data.upperBound);
2420
+ const incoming = (0, import_hooks32.useIncomingComputedData)(id);
2421
+ const updateNodeData = (0, import_hooks32.useUpdateNodeData)();
2422
+ const updateComputedData = (0, import_hooks32.useUpdateNodeComputedData)();
2423
+ (0, import_react39.useEffect)(() => {
2424
+ if (incoming?.length > 2) {
2425
+ const module2 = new import_selector2.Select(
2426
+ incoming[0].module,
2427
+ incoming[1].module,
2428
+ incoming[2].module,
2429
+ edgeFalloff,
2430
+ lowerBound,
2431
+ upperBound
2432
+ );
2433
+ updateComputedData(id, { module: module2 });
2434
+ }
2435
+ updateNodeData(id, { edgeFalloff, lowerBound, upperBound });
2436
+ }, [incoming, edgeFalloff, lowerBound, upperBound, updateNodeData, id, updateComputedData]);
2437
+ return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(import_layout31.NodeContainer, { id, selected, data, type, children: [
2438
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(import_core19.Stack, { children: [
2439
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(import_core19.Group, { children: [
2440
+ "Edge Falloff:",
2441
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
2442
+ import_core19.NumberInput,
2443
+ {
2444
+ size: "xs",
2445
+ w: 100,
2446
+ value: edgeFalloff,
2447
+ onChange: (e) => setEdgeFalloff(Number(e)),
2448
+ step: 0.1
2449
+ }
2450
+ )
2451
+ ] }),
2452
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(import_core19.Group, { children: [
2453
+ "Lower Bound:",
2454
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
2455
+ import_core19.NumberInput,
2456
+ {
2457
+ size: "xs",
2458
+ w: 100,
2459
+ value: lowerBound,
2460
+ onChange: (e) => setLowerBound(Number(e)),
2461
+ step: 0.1
2462
+ }
2463
+ )
2464
+ ] }),
2465
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(import_core19.Group, { children: [
2466
+ "Upper Bound:",
2467
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
2468
+ import_core19.NumberInput,
2469
+ {
2470
+ size: "xs",
2471
+ w: 100,
2472
+ value: upperBound,
2473
+ onChange: (e) => setUpperBound(Number(e)),
2474
+ step: 0.1
2475
+ }
2476
+ )
2477
+ ] }),
2478
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(import_core19.Group, { children: [
2479
+ "Modules: ",
2480
+ incoming?.length
2481
+ ] })
2482
+ ] }),
2483
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_layout31.NodeTrackConnections, { handles: data.handles, nodeId: id, type: "target" })
2484
+ ] });
2485
+ }
2486
+ var noise_select_node_default = NoiseSelectNode;
2487
+
2488
+ // src/nodes/transformers/noise-displace-node.tsx
2489
+ var import_layout32 = require("@awesome-flow/core/layout");
2490
+ var import_react40 = require("react");
2491
+ var import_hooks33 = require("@awesome-flow/core/hooks");
2492
+ var import_transformer = require("libnoise-ts/module/transformer");
2493
+ var import_core20 = require("@mantine/core");
2494
+ var import_jsx_runtime34 = require("react/jsx-runtime");
2495
+ function NoiseDisplaceNode({ id, selected, data, type }) {
2496
+ const updateComputedData = (0, import_hooks33.useUpdateNodeComputedData)();
2497
+ const incomingHandleData = (0, import_hooks33.useIncomingHandleData)(id, data.handles);
2498
+ const { sourceModule, xModule, yModule, zModule } = (0, import_react40.useMemo)(() => {
2499
+ return {
2500
+ sourceModule: incomingHandleData["source" /* sourceModule */],
2501
+ xModule: incomingHandleData["x-module" /* xModule */],
2502
+ yModule: incomingHandleData["y-module" /* yModule */],
2503
+ zModule: incomingHandleData["z-module" /* zModule */]
2504
+ };
2505
+ }, [incomingHandleData]);
2506
+ (0, import_react40.useEffect)(() => {
2507
+ if (sourceModule && xModule && yModule && zModule) {
2508
+ const module2 = new import_transformer.Displace(
2509
+ sourceModule[0].module,
2510
+ xModule[0].module,
2511
+ yModule[0].module,
2512
+ zModule[0].module
2513
+ );
2514
+ updateComputedData(id, { module: module2 });
2515
+ }
2516
+ }, [id, updateComputedData, sourceModule, xModule, yModule, zModule]);
2517
+ const { sourceColor, xColor, yColor, zColor } = (0, import_react40.useMemo)(() => {
2518
+ return {
2519
+ sourceColor: sourceModule ? "green" : "orange",
2520
+ xColor: xModule ? "green" : "orange",
2521
+ yColor: yModule ? "green" : "orange",
2522
+ zColor: zModule ? "green" : "orange"
2523
+ };
2524
+ }, [sourceModule, xModule, yModule, zModule]);
2525
+ return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(import_layout32.NodeContainer, { id, selected, data, type, children: [
2526
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(import_core20.Stack, { align: "center", children: [
2527
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_core20.Badge, { color: sourceColor, children: "Source Module" }),
2528
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_core20.Badge, { color: xColor, children: "X Module" }),
2529
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_core20.Badge, { color: yColor, children: "Y Module" }),
2530
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_core20.Badge, { color: zColor, children: "Z Module" })
2531
+ ] }),
2532
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_layout32.NodeTrackConnections, { handles: data.handles, nodeId: id, type: "target" })
2533
+ ] });
2534
+ }
2535
+ var noise_displace_node_default = NoiseDisplaceNode;
2536
+
2537
+ // src/nodes/transformers/noise-rotate-point-node.tsx
2538
+ var import_layout33 = require("@awesome-flow/core/layout");
2539
+ var import_react41 = require("react");
2540
+ var import_hooks34 = require("@awesome-flow/core/hooks");
2541
+ var import_core21 = require("@mantine/core");
2542
+ var import_transformer2 = require("libnoise-ts/module/transformer");
2543
+ var import_jsx_runtime35 = require("react/jsx-runtime");
2544
+ function NoiseRotatePointNode({
2545
+ id,
2546
+ selected,
2547
+ data,
2548
+ type
2549
+ }) {
2550
+ const [xAngle, setXAngle] = (0, import_react41.useState)(data.xAngle);
2551
+ const [yAngle, setYAngle] = (0, import_react41.useState)(data.yAngle);
2552
+ const [zAngle, setZAngle] = (0, import_react41.useState)(data.zAngle);
2553
+ const incoming = (0, import_hooks34.useIncomingComputedData)(id);
2554
+ const updateNodeData = (0, import_hooks34.useUpdateNodeData)();
2555
+ const updateComputedData = (0, import_hooks34.useUpdateNodeComputedData)();
2556
+ (0, import_react41.useEffect)(() => {
2557
+ if (incoming?.length) {
2558
+ const module2 = new import_transformer2.RotatePoint(incoming[0].module, xAngle, yAngle, zAngle);
2559
+ updateComputedData(id, { module: module2 });
2560
+ }
2561
+ updateNodeData(id, { xAngle, yAngle, zAngle });
2562
+ }, [id, updateComputedData, updateNodeData, incoming, xAngle, yAngle, zAngle]);
2563
+ return /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(import_layout33.NodeContainer, { id, selected, data, type, children: [
2564
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(import_core21.Stack, { children: [
2565
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(import_core21.Group, { children: [
2566
+ "X Angle:",
2567
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
2568
+ import_core21.NumberInput,
2569
+ {
2570
+ size: "xs",
2571
+ w: 100,
2572
+ value: xAngle,
2573
+ onChange: (e) => setXAngle(Number(e)),
2574
+ step: 0.01
2575
+ }
2576
+ )
2577
+ ] }),
2578
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(import_core21.Group, { children: [
2579
+ "Y Angle:",
2580
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
2581
+ import_core21.NumberInput,
2582
+ {
2583
+ size: "xs",
2584
+ w: 100,
2585
+ value: yAngle,
2586
+ onChange: (e) => setYAngle(Number(e)),
2587
+ step: 0.01
2588
+ }
2589
+ )
2590
+ ] }),
2591
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(import_core21.Group, { children: [
2592
+ "Z Angle:",
2593
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
2594
+ import_core21.NumberInput,
2595
+ {
2596
+ size: "xs",
2597
+ w: 100,
2598
+ value: zAngle,
2599
+ onChange: (e) => setZAngle(Number(e)),
2600
+ step: 0.01
2601
+ }
2602
+ )
2603
+ ] })
2604
+ ] }),
2605
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_layout33.NodeTrackConnections, { handles: data.handles, nodeId: id, type: "target" })
2606
+ ] });
2607
+ }
2608
+ var noise_rotate_point_node_default = NoiseRotatePointNode;
2609
+
2610
+ // src/nodes/transformers/noise-scale-point-node.tsx
2611
+ var import_layout34 = require("@awesome-flow/core/layout");
2612
+ var import_react42 = require("react");
2613
+ var import_hooks35 = require("@awesome-flow/core/hooks");
2614
+ var import_core22 = require("@mantine/core");
2615
+ var import_transformer3 = require("libnoise-ts/module/transformer");
2616
+ var import_jsx_runtime36 = require("react/jsx-runtime");
2617
+ function NoiseScalePointNode({
2618
+ id,
2619
+ selected,
2620
+ data,
2621
+ type
2622
+ }) {
2623
+ const [xScale, setXScale] = (0, import_react42.useState)(data.xScale);
2624
+ const [yScale, setYScale] = (0, import_react42.useState)(data.yScale);
2625
+ const [zScale, setZScale] = (0, import_react42.useState)(data.zScale);
2626
+ const incoming = (0, import_hooks35.useIncomingComputedData)(id);
2627
+ const updateNodeData = (0, import_hooks35.useUpdateNodeData)();
2628
+ const updateComputedData = (0, import_hooks35.useUpdateNodeComputedData)();
2629
+ (0, import_react42.useEffect)(() => {
2630
+ if (incoming?.length) {
2631
+ const module2 = new import_transformer3.ScalePoint(incoming[0].module, xScale, yScale, zScale);
2632
+ updateComputedData(id, { module: module2 });
2633
+ }
2634
+ updateNodeData(id, { xScale, yScale, zScale });
2635
+ }, [id, incoming, updateComputedData, updateNodeData, xScale, yScale, zScale]);
2636
+ return /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(import_layout34.NodeContainer, { id, selected, data, type, children: [
2637
+ /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(import_core22.Stack, { children: [
2638
+ /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(import_core22.Group, { children: [
2639
+ "X Scale:",
2640
+ /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
2641
+ import_core22.NumberInput,
2642
+ {
2643
+ size: "xs",
2644
+ w: 100,
2645
+ value: xScale,
2646
+ onChange: (e) => setXScale(Number(e)),
2647
+ step: 0.01
2648
+ }
2649
+ )
2650
+ ] }),
2651
+ /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(import_core22.Group, { children: [
2652
+ "Y Scale:",
2653
+ /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
2654
+ import_core22.NumberInput,
2655
+ {
2656
+ size: "xs",
2657
+ w: 100,
2658
+ value: yScale,
2659
+ onChange: (e) => setYScale(Number(e)),
2660
+ step: 0.01
2661
+ }
2662
+ )
2663
+ ] }),
2664
+ /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(import_core22.Group, { children: [
2665
+ "Z Scale:",
2666
+ /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
2667
+ import_core22.NumberInput,
2668
+ {
2669
+ size: "xs",
2670
+ w: 100,
2671
+ value: zScale,
2672
+ onChange: (e) => setZScale(Number(e)),
2673
+ step: 0.01
2674
+ }
2675
+ )
2676
+ ] })
2677
+ ] }),
2678
+ /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(import_layout34.NodeTrackConnections, { handles: data.handles, nodeId: id, type: "target" })
2679
+ ] });
2680
+ }
2681
+ var noise_scale_point_node_default = NoiseScalePointNode;
2682
+
2683
+ // src/nodes/transformers/noise-translate-point-node.tsx
2684
+ var import_layout35 = require("@awesome-flow/core/layout");
2685
+ var import_react43 = require("react");
2686
+ var import_hooks36 = require("@awesome-flow/core/hooks");
2687
+ var import_core23 = require("@mantine/core");
2688
+ var import_transformer4 = require("libnoise-ts/module/transformer");
2689
+ var import_jsx_runtime37 = require("react/jsx-runtime");
2690
+ function NoiseTranslatePointNode({
2691
+ id,
2692
+ selected,
2693
+ data,
2694
+ type
2695
+ }) {
2696
+ const [translateX, setTranslateX] = (0, import_react43.useState)(data.translateX);
2697
+ const [translateY, setTranslateY] = (0, import_react43.useState)(data.translateY);
2698
+ const [translateZ, setTranslateZ] = (0, import_react43.useState)(data.translateZ);
2699
+ const incoming = (0, import_hooks36.useIncomingComputedData)(id);
2700
+ const updateNodeData = (0, import_hooks36.useUpdateNodeData)();
2701
+ const updateComputedData = (0, import_hooks36.useUpdateNodeComputedData)();
2702
+ (0, import_react43.useEffect)(() => {
2703
+ if (incoming?.length) {
2704
+ const module2 = new import_transformer4.TranslatePoint(incoming[0].module, translateX, translateY, translateZ);
2705
+ updateComputedData(id, { module: module2 });
2706
+ }
2707
+ updateNodeData(id, { translateX, translateY, translateZ });
2708
+ }, [id, incoming, translateX, translateY, translateZ, updateComputedData, updateNodeData]);
2709
+ return /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(import_layout35.NodeContainer, { id, selected, data, type, children: [
2710
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(import_core23.Stack, { children: [
2711
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(import_core23.Group, { children: [
2712
+ "Translate X:",
2713
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
2714
+ import_core23.NumberInput,
2715
+ {
2716
+ size: "xs",
2717
+ w: 100,
2718
+ value: translateX,
2719
+ onChange: (e) => setTranslateX(Number(e)),
2720
+ step: 1
2721
+ }
2722
+ )
2723
+ ] }),
2724
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(import_core23.Group, { children: [
2725
+ "Translate Y:",
2726
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
2727
+ import_core23.NumberInput,
2728
+ {
2729
+ size: "xs",
2730
+ w: 100,
2731
+ value: translateY,
2732
+ onChange: (e) => setTranslateY(Number(e)),
2733
+ step: 1
2734
+ }
2735
+ )
2736
+ ] }),
2737
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(import_core23.Group, { children: [
2738
+ "Translate Z:",
2739
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
2740
+ import_core23.NumberInput,
2741
+ {
2742
+ size: "xs",
2743
+ w: 100,
2744
+ value: translateZ,
2745
+ onChange: (e) => setTranslateZ(Number(e)),
2746
+ step: 1
2747
+ }
2748
+ )
2749
+ ] })
2750
+ ] }),
2751
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_layout35.NodeTrackConnections, { handles: data.handles, nodeId: id, type: "target" })
2752
+ ] });
2753
+ }
2754
+ var noise_translate_point_node_default = NoiseTranslatePointNode;
2755
+
2756
+ // src/nodes/transformers/noise-turbulence-node .tsx
2757
+ var import_layout36 = require("@awesome-flow/core/layout");
2758
+ var import_react44 = require("react");
2759
+ var import_hooks37 = require("@awesome-flow/core/hooks");
2760
+ var import_transformer5 = require("libnoise-ts/module/transformer");
2761
+ var import_jsx_runtime38 = require("react/jsx-runtime");
2762
+ function NoiseTurbulenceNode({
2763
+ id,
2764
+ selected,
2765
+ data,
2766
+ type
2767
+ }) {
2768
+ const [properties, setProperties] = (0, import_react44.useState)(null);
2769
+ const incoming = (0, import_hooks37.useIncomingComputedData)(id);
2770
+ const updateComputedData = (0, import_hooks37.useUpdateNodeComputedData)();
2771
+ const onPropertiesChange = (0, import_react44.useCallback)((props) => {
2772
+ setProperties(props);
2773
+ }, []);
2774
+ (0, import_react44.useEffect)(() => {
2775
+ if (incoming?.length) {
2776
+ const module2 = new import_transformer5.Turbulence(
2777
+ incoming[0].module,
2778
+ properties.frequency.value,
2779
+ properties.power.value,
2780
+ properties.roughness.value,
2781
+ properties.seed.value
2782
+ );
2783
+ updateComputedData(id, { module: module2 });
2784
+ }
2785
+ }, [id, incoming, properties, updateComputedData]);
2786
+ return /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(import_layout36.NodeContainer, { id, selected, data, type, children: [
2787
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(node_property_variables_default, { data, nodeId: id, onPropertiesChange }),
2788
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(import_layout36.NodeTrackConnections, { handles: data.handles, nodeId: id, type: "target" })
2789
+ ] });
2790
+ }
2791
+ var noise_turbulence_node_default = NoiseTurbulenceNode;
2792
+ // Annotate the CommonJS export names for ESM import in node:
2793
+ 0 && (module.exports = {
2794
+ ModuleGroupNode,
2795
+ NoiseAbsNode,
2796
+ NoiseBillowNode,
2797
+ NoiseBlendNode,
2798
+ NoiseCheckerboardNode,
2799
+ NoiseClampNode,
2800
+ NoiseCombineNode,
2801
+ NoiseConstNode,
2802
+ NoiseCurveNode,
2803
+ NoiseCylindersNode,
2804
+ NoiseDisplaceNode,
2805
+ NoiseExponentNode,
2806
+ NoiseInvertNode,
2807
+ NoiseLoggerNode,
2808
+ NoiseNormalizeNode,
2809
+ NoiseOutputNode,
2810
+ NoisePerlinNode,
2811
+ NoiseRawTextureNode,
2812
+ NoiseRidgedMultiNode,
2813
+ NoiseRotatePointNode,
2814
+ NoiseScaleBiasNode,
2815
+ NoiseScalePointNode,
2816
+ NoiseSelectNode,
2817
+ NoiseSimplexNode,
2818
+ NoiseSpheresNode,
2819
+ NoiseTerraceNode,
2820
+ NoiseTranslatePointNode,
2821
+ NoiseTurbulenceNode,
2822
+ NoiseVoronoiNode,
2823
+ PositionConstNode,
2824
+ PositionGridNode,
2825
+ PositionsLoggerNode,
2826
+ VariableCombineNode,
2827
+ VariablePropertyNode,
2828
+ VariableValueNode
2829
+ });
2830
+ //# sourceMappingURL=index.cjs.map