nodi-modular 0.0.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.
package/README.md ADDED
@@ -0,0 +1,22 @@
1
+ # Nodi modular
2
+
3
+ [![npm version](https://img.shields.io/npm/v/nodi-modular.svg?style=flat)](https://www.npmjs.com/package/nodi-modular)
4
+
5
+ Modular is a module project designed to import node graphs created in Nodi in JSON format, enabling the extraction of geometric data generated based on the node graph structure.
6
+
7
+ It is provided in WebAssembly format, making it usable not only in web frontend applications but also in various applications that support WebAssembly.
8
+
9
+ ## Installation
10
+
11
+ ```bash
12
+ npm install nodi-modular
13
+ ```
14
+
15
+ or yarn
16
+
17
+ ```bash
18
+ yarn add nodi-modular
19
+ ```
20
+
21
+ ## Usage
22
+
package/index.d.ts ADDED
@@ -0,0 +1,459 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+ export interface MeshInteropHandle {
4
+ count: number;
5
+ vertices: number;
6
+ normals: number;
7
+ indices: IndicesInteropHandle | undefined;
8
+ transform: TransformInterop | undefined;
9
+ }
10
+
11
+ export type NodeSectionInterop = { type: "section"; content: NodeFolderInterop } | { type: "item"; content: NodeItemInterop };
12
+
13
+ export interface NodeItemInterop {
14
+ key: string;
15
+ name: string;
16
+ }
17
+
18
+ export type NodeFolderInterop = IndexMap<string, NodeSectionInterop>;
19
+
20
+ export interface NodeMapInterop {
21
+ folder: NodeFolderInterop;
22
+ }
23
+
24
+ export interface DataTreeInterop {
25
+ outputs: IndexMap<string, string>;
26
+ }
27
+
28
+ export interface NodeCreationSetting {
29
+ id: string;
30
+ variant: string;
31
+ name?: string;
32
+ label?: string;
33
+ properties: NodePropertyInterop[];
34
+ enabled?: boolean;
35
+ visible?: boolean;
36
+ }
37
+
38
+ export interface EvaluationInterop {
39
+ processedNodes: NodeId[];
40
+ geometryIdentifiers: GeometryIdentifier[];
41
+ }
42
+
43
+ export type GeometryInteropHandleProxy = { type: "Mesh"; content: MeshInteropHandle } | { type: "Curve"; content: CurveInteropHandle } | { type: "Group"; content: GroupInteropHandle };
44
+
45
+ export interface GeometryIdentifier {
46
+ nodeId?: NodeId;
47
+ outputId: OutputId;
48
+ geometryId: ID<GeometryProxy>;
49
+ transform: TransformInterop;
50
+ }
51
+
52
+ export interface EdgeInterop {
53
+ source: EdgeUnitInterop<OutputId>;
54
+ destination: EdgeUnitInterop<InputId>;
55
+ empty: boolean;
56
+ }
57
+
58
+ export interface EdgeUnitInterop<IO> {
59
+ node: NodeId;
60
+ io: IO;
61
+ }
62
+
63
+ export interface IOInterop {
64
+ id: string;
65
+ name: string;
66
+ accessType: string;
67
+ connections: string[];
68
+ }
69
+
70
+ export type GeometryInteropVec = GeometryInterop[];
71
+
72
+ export type NodeConnectionInteropVec = NodeConnectionInterop[];
73
+
74
+ export type NodePropertyInteropVec = NodePropertyInterop[];
75
+
76
+ export type NodeInteropVec = NodeInterop[];
77
+
78
+ export type EdgeInteropVec = EdgeInterop[];
79
+
80
+ export interface CurveInteropHandle {
81
+ count: number;
82
+ vertices: number;
83
+ transform: TransformInterop | undefined;
84
+ }
85
+
86
+ export interface NodePropertyInterop {
87
+ name: string;
88
+ value: NodePropertyValue;
89
+ connected?: boolean;
90
+ disabled?: boolean;
91
+ }
92
+
93
+ export interface GeometrySpreadsheet {
94
+ points: Point3<number>[];
95
+ curves: CurveProxy[];
96
+ surfaces: SurfaceProxy[];
97
+ meshes: MeshInterop[];
98
+ }
99
+
100
+ export type TransformInterop = number[];
101
+
102
+ export interface GroupInteropHandle {
103
+ objects: GeometryInteropHandleProxy[];
104
+ }
105
+
106
+
107
+ /// Manually added types due to limitations in the `wasm-bindgen` & `tsify` crates.
108
+ export type ID<T = any> = string;
109
+ export type NodeId = ID;
110
+ export type InputId = ID;
111
+ export type OutputId = ID;
112
+
113
+ export type IndexMap<K, V> = Map<K, V>;
114
+
115
+ export type U1 = 1;
116
+ export type U2 = 2;
117
+ export type U3 = 3;
118
+
119
+ /// Define vector & point types with FixedLengthArray
120
+ type BuildTuple<L extends number, T, R extends any[] = []> = R['length'] extends L ? R : BuildTuple<L, T, [T, ...R]>;
121
+ type FixedLengthArray<T, L extends number> = BuildTuple<L, T>;
122
+ export type OPoint<T, D extends number> = FixedLengthArray<T, D>;
123
+ export type OVector<T, D extends number> = FixedLengthArray<T, D>;
124
+ export type Point<T, D extends number> = OPoint<T, D>;
125
+ export type SVector<T, D extends number> = OVector<T, D>;
126
+ export type Point2<T = number> = Point<T, 2>;
127
+ export type Vector2<T = number> = SVector<T, 2>;
128
+ export type Point3<T = number> = Point<T, 3>;
129
+ export type Vector3<T = number> = SVector<T, 3>;
130
+ export type Transform3<T = number> = FixedLengthArray<T, 16>;
131
+
132
+
133
+ export interface NodeInterop {
134
+ variant: string;
135
+ id: string;
136
+ name: string;
137
+ label: string | undefined;
138
+ inputs: IOInterop[];
139
+ outputs: IOInterop[];
140
+ properties: NodePropertyInterop[];
141
+ enabled: boolean;
142
+ visible: boolean;
143
+ meta: NodeMetaInterop;
144
+ }
145
+
146
+ export interface NodeEntityInterop {
147
+ variant: string;
148
+ id: string;
149
+ name: string;
150
+ label: string | undefined;
151
+ inputs: string[];
152
+ outputs: string[];
153
+ enabled: boolean;
154
+ visible: boolean;
155
+ }
156
+
157
+ export interface NodeMetaInterop {
158
+ error: string | undefined;
159
+ hasGeometry: boolean;
160
+ }
161
+
162
+ export interface NodeConnectionInterop {
163
+ outputNodeId: string;
164
+ outputIndex: number;
165
+ inputNodeId: string;
166
+ inputIndex: number;
167
+ }
168
+
169
+ export interface IndicesInteropHandle {
170
+ count: number;
171
+ indices: number;
172
+ }
173
+
174
+ export interface NodePropertyCategoryValue {
175
+ candidates: Map<string, number>;
176
+ selected: number;
177
+ }
178
+
179
+ export interface NodePropertyRangeValue {
180
+ value: number;
181
+ min: number | undefined;
182
+ max: number | undefined;
183
+ step: number | undefined;
184
+ }
185
+
186
+ export type NodePropertyValue = { type: "Number"; content: number } | { type: "Range"; content: NodePropertyRangeValue } | { type: "Range2d"; content: [NodePropertyRangeValue, NodePropertyRangeValue] } | { type: "String"; content: string } | { type: "Bool"; content: boolean } | { type: "NumberVector"; content: number[] } | { type: "Category"; content: NodePropertyCategoryValue } | { type: "Vector2d"; content: [number, number] } | { type: "Vector3d"; content: [number, number, number] } | { type: "Point2d"; content: [number, number] } | { type: "Point3d"; content: [number, number, number] } | { type: "Points2d"; content: [number, number][] };
187
+
188
+ export interface SubGraphNode {
189
+ sources: NodeId[];
190
+ destinations: NodeId[];
191
+ }
192
+
193
+ export interface SubGraph<T, U> {
194
+ nodes: IndexMap<NodeId, SubGraphNode<T, U>>;
195
+ }
196
+
197
+ export type GraphMappingTypes = "None" | "Bezier" | "Linear" | "Sine";
198
+
199
+ export interface Node<T> {
200
+ id: NodeId;
201
+ name: string;
202
+ label: string | undefined;
203
+ input: InputIOManager;
204
+ output: OutputIOManager;
205
+ entity: T;
206
+ enabled: boolean;
207
+ visible: boolean;
208
+ }
209
+
210
+ export type OutputIOManager = IOManager<OutputId, InputId>;
211
+
212
+ export type InputIOManager = IOManager<InputId, OutputId>;
213
+
214
+ export interface IOManager<T, U> {
215
+ parameters: IOParameter<T, U>[];
216
+ }
217
+
218
+ export interface Connection {
219
+ source: NodeParameter<OutputId>;
220
+ destination: NodeParameter<InputId>;
221
+ }
222
+
223
+ export interface NodeParameter<T> {
224
+ nodeId: NodeId;
225
+ parameterId: T;
226
+ parameterIndex: number;
227
+ }
228
+
229
+ export interface Prune<T, U> {
230
+ connectedComponents: SubGraph<T, U>[];
231
+ bypass: Connection[] | undefined;
232
+ }
233
+
234
+ export interface Graph<T, U> {
235
+ nodes: IndexMap<NodeId, Node<T, U>>;
236
+ }
237
+
238
+
239
+ export type NurbsCurve3D<T = number> = {
240
+ control_points: Point3<T>[];
241
+ knots: T[];
242
+ degree: T;
243
+ };
244
+
245
+ export interface PointCloudInterop {
246
+ vertices: [number, number, number][];
247
+ transform: Transform3<number>;
248
+ }
249
+
250
+ export type GeometryProxy = { variant: "Curve"; data: CurveProxy } | { variant: "Surface"; data: SurfaceProxy } | { variant: "Extrusion"; data: Extrusion<SurfaceProxy> } | { variant: "Brep"; data: Brep } | { variant: "Mesh"; data: Mesh } | { variant: "BBox"; data: OrientedBox } | { variant: "Group"; data: Group };
251
+
252
+ export type NurbsCurve = NurbsCurve3D<number>;
253
+
254
+
255
+ export type LineCurve3D = {
256
+ a: Point3;
257
+ b: Point3;
258
+ };
259
+
260
+ export interface OrientedBox {
261
+ plane: Plane;
262
+ bounds: BoundingBox3D;
263
+ }
264
+
265
+ /**
266
+ * Represents a mesh.
267
+ */
268
+ export interface Mesh {
269
+ vertices: Point3<number>[];
270
+ normals: Vector3<number>[] | undefined;
271
+ uv: Vector2<number>[] | undefined;
272
+ index: [number, number, number][];
273
+ }
274
+
275
+ export interface ArcCurve {
276
+ plane: Plane;
277
+ startAngle: number;
278
+ endAngle: number;
279
+ radius: number;
280
+ }
281
+
282
+
283
+ export type BoundingBox3D = {
284
+ min: Vector3;
285
+ max: Vector3;
286
+ };
287
+
288
+ export type GeometryInterop = { type: "Mesh"; content: MeshInterop } | { type: "Curve"; content: CurveInterop } | { type: "Point"; content: PointCloudInterop } | { type: "Plane"; content: Plane } | { type: "Group"; content: GeometryInterop[] };
289
+
290
+ export interface CurveInterop {
291
+ vertices: [number, number, number][];
292
+ transform: Transform3<number> | undefined;
293
+ }
294
+
295
+ export type SurfaceProxy = { variant: "Circular"; data: CircularSurface } | { variant: "Hemisphere"; data: HemisphereSurface } | { variant: "Triangle"; data: TriangleSurface } | { variant: "Plane"; data: PlaneSurface } | { variant: "NURBS"; data: NurbsSurface } | { variant: "Trimmed"; data: TrimmedSurface<SurfaceProxy, CurveProxy> };
296
+
297
+
298
+ export type Triangle3D = {
299
+ a: Point3;
300
+ b: Point3;
301
+ c: Point3;
302
+ };
303
+
304
+ export interface HemisphereSurface {
305
+ plane: Plane;
306
+ radius: number;
307
+ }
308
+
309
+ export interface Domain {
310
+ min: number;
311
+ max: number;
312
+ }
313
+
314
+ export interface Plane {
315
+ origin: Point3<number>;
316
+ normal: Vector3<number>;
317
+ xAxis: Vector3<number>;
318
+ yAxis: Vector3<number>;
319
+ }
320
+
321
+ export interface MeshInterop {
322
+ vertices: [number, number, number][];
323
+ normals: [number, number, number][];
324
+ uv?: [number, number][];
325
+ faces?: [number, number, number][];
326
+ transform?: Transform3<number>;
327
+ }
328
+
329
+ export type TriangleSurface = Triangle3D;
330
+
331
+ export interface PlaneSurface {
332
+ plane: Plane;
333
+ x: Domain;
334
+ y: Domain;
335
+ }
336
+
337
+ export type CurveProxy = { variant: "Line"; data: LineCurve3D } | { variant: "Arc"; data: ArcCurve } | { variant: "Circle"; data: CircleCurve } | { variant: "Rectangle"; data: RectangleCurve } | { variant: "Polyline"; data: PolylineCurve3D } | { variant: "NURBS"; data: NurbsCurve };
338
+
339
+
340
+ export type PolylineCurve3D = {
341
+ points: Point3[];
342
+ };
343
+
344
+
345
+ export type NurbsSurface3D<T = number> = {
346
+ control_points: Point3<T>[][];
347
+ u_knots: T[];
348
+ v_knots: T[];
349
+ u_degree: T;
350
+ v_degree: T;
351
+ };
352
+
353
+ export type NurbsSurface = NurbsSurface3D<number>;
354
+
355
+ export interface CircularSurface {
356
+ plane: Plane;
357
+ radius: number;
358
+ }
359
+
360
+ export interface RectangleCurve {
361
+ plane: Plane;
362
+ x: Domain;
363
+ y: Domain;
364
+ }
365
+
366
+ export interface CircleCurve {
367
+ plane: Plane;
368
+ radius: number;
369
+ }
370
+
371
+ export class Modular {
372
+ free(): void;
373
+ /**
374
+ * @returns {Modular}
375
+ */
376
+ static new(): Modular;
377
+ /**
378
+ * @param {string} input
379
+ */
380
+ loadGraph(input: string): void;
381
+ /**
382
+ * @returns {Graph}
383
+ */
384
+ exportGraph(): Graph;
385
+ clearGraph(): void;
386
+ /**
387
+ * @returns {Promise<EvaluationInterop>}
388
+ */
389
+ evaluate(): Promise<EvaluationInterop>;
390
+ /**
391
+ * @param {string} id
392
+ * @param {NodePropertyInterop} prop
393
+ * @returns {Promise<boolean>}
394
+ */
395
+ changeNodeProperty(id: string, prop: NodePropertyInterop): Promise<boolean>;
396
+ /**
397
+ * @returns {(NodeInterop)[]}
398
+ */
399
+ getNodes(): (NodeInterop)[];
400
+ /**
401
+ * @param {GeometryIdentifier} identifier
402
+ * @returns {GeometryInterop | undefined}
403
+ */
404
+ findGeometryInteropById(identifier: GeometryIdentifier): GeometryInterop | undefined;
405
+ /**
406
+ * @param {GeometryIdentifier} identifier
407
+ * @returns {GeometryProxy | undefined}
408
+ */
409
+ findGeometryById(identifier: GeometryIdentifier): GeometryProxy | undefined;
410
+ }
411
+
412
+ export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
413
+
414
+ export interface InitOutput {
415
+ readonly memory: WebAssembly.Memory;
416
+ readonly __wbg_modular_free: (a: number, b: number) => void;
417
+ readonly modular_new: () => number;
418
+ readonly modular_loadGraph: (a: number, b: number, c: number) => Array;
419
+ readonly modular_exportGraph: (a: number) => number;
420
+ readonly modular_clearGraph: (a: number) => void;
421
+ readonly modular_evaluate: (a: number) => number;
422
+ readonly modular_changeNodeProperty: (a: number, b: number, c: number, d: number) => number;
423
+ readonly modular_getNodes: (a: number) => Array;
424
+ readonly modular_findGeometryInteropById: (a: number, b: number) => number;
425
+ readonly modular_findGeometryById: (a: number, b: number) => number;
426
+ readonly __wbindgen_malloc: (a: number, b: number) => number;
427
+ readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
428
+ readonly __wbindgen_export_2: WebAssembly.Table;
429
+ readonly __wbindgen_export_3: WebAssembly.Table;
430
+ readonly closure537_externref_shim: (a: number, b: number, c: number) => void;
431
+ readonly __externref_table_dealloc: (a: number) => void;
432
+ readonly __externref_drop_slice: (a: number, b: number) => void;
433
+ readonly __wbindgen_free: (a: number, b: number, c: number) => void;
434
+ readonly __wbindgen_exn_store: (a: number) => void;
435
+ readonly __externref_table_alloc: () => number;
436
+ readonly closure822_externref_shim: (a: number, b: number, c: number, d: number) => void;
437
+ readonly __wbindgen_start: () => void;
438
+ }
439
+
440
+ export type SyncInitInput = BufferSource | WebAssembly.Module;
441
+ /**
442
+ * Instantiates the given `module`, which can either be bytes or
443
+ * a precompiled `WebAssembly.Module`.
444
+ *
445
+ * @param {{ module: SyncInitInput }} module - Passing `SyncInitInput` directly is deprecated.
446
+ *
447
+ * @returns {InitOutput}
448
+ */
449
+ export function initSync(module: { module: SyncInitInput } | SyncInitInput): InitOutput;
450
+
451
+ /**
452
+ * If `module_or_path` is {RequestInfo} or {URL}, makes a request and
453
+ * for everything else, calls `WebAssembly.instantiate` directly.
454
+ *
455
+ * @param {{ module_or_path: InitInput | Promise<InitInput> }} module_or_path - Passing `InitInput` directly is deprecated.
456
+ *
457
+ * @returns {Promise<InitOutput>}
458
+ */
459
+ export default function __wbg_init (module_or_path?: { module_or_path: InitInput | Promise<InitInput> } | InitInput | Promise<InitInput>): Promise<InitOutput>;
package/index.js ADDED
@@ -0,0 +1,781 @@
1
+ let wasm;
2
+
3
+ let WASM_VECTOR_LEN = 0;
4
+
5
+ let cachedUint8ArrayMemory0 = null;
6
+
7
+ function getUint8ArrayMemory0() {
8
+ if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
9
+ cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
10
+ }
11
+ return cachedUint8ArrayMemory0;
12
+ }
13
+
14
+ const cachedTextEncoder = (typeof TextEncoder !== 'undefined' ? new TextEncoder('utf-8') : { encode: () => { throw Error('TextEncoder not available') } } );
15
+
16
+ const encodeString = (typeof cachedTextEncoder.encodeInto === 'function'
17
+ ? function (arg, view) {
18
+ return cachedTextEncoder.encodeInto(arg, view);
19
+ }
20
+ : function (arg, view) {
21
+ const buf = cachedTextEncoder.encode(arg);
22
+ view.set(buf);
23
+ return {
24
+ read: arg.length,
25
+ written: buf.length
26
+ };
27
+ });
28
+
29
+ function passStringToWasm0(arg, malloc, realloc) {
30
+
31
+ if (realloc === undefined) {
32
+ const buf = cachedTextEncoder.encode(arg);
33
+ const ptr = malloc(buf.length, 1) >>> 0;
34
+ getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
35
+ WASM_VECTOR_LEN = buf.length;
36
+ return ptr;
37
+ }
38
+
39
+ let len = arg.length;
40
+ let ptr = malloc(len, 1) >>> 0;
41
+
42
+ const mem = getUint8ArrayMemory0();
43
+
44
+ let offset = 0;
45
+
46
+ for (; offset < len; offset++) {
47
+ const code = arg.charCodeAt(offset);
48
+ if (code > 0x7F) break;
49
+ mem[ptr + offset] = code;
50
+ }
51
+
52
+ if (offset !== len) {
53
+ if (offset !== 0) {
54
+ arg = arg.slice(offset);
55
+ }
56
+ ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
57
+ const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
58
+ const ret = encodeString(arg, view);
59
+
60
+ offset += ret.written;
61
+ ptr = realloc(ptr, len, offset, 1) >>> 0;
62
+ }
63
+
64
+ WASM_VECTOR_LEN = offset;
65
+ return ptr;
66
+ }
67
+
68
+ function isLikeNone(x) {
69
+ return x === undefined || x === null;
70
+ }
71
+
72
+ let cachedDataViewMemory0 = null;
73
+
74
+ function getDataViewMemory0() {
75
+ if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
76
+ cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
77
+ }
78
+ return cachedDataViewMemory0;
79
+ }
80
+
81
+ const cachedTextDecoder = (typeof TextDecoder !== 'undefined' ? new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }) : { decode: () => { throw Error('TextDecoder not available') } } );
82
+
83
+ if (typeof TextDecoder !== 'undefined') { cachedTextDecoder.decode(); };
84
+
85
+ function getStringFromWasm0(ptr, len) {
86
+ ptr = ptr >>> 0;
87
+ return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
88
+ }
89
+
90
+ function debugString(val) {
91
+ // primitive types
92
+ const type = typeof val;
93
+ if (type == 'number' || type == 'boolean' || val == null) {
94
+ return `${val}`;
95
+ }
96
+ if (type == 'string') {
97
+ return `"${val}"`;
98
+ }
99
+ if (type == 'symbol') {
100
+ const description = val.description;
101
+ if (description == null) {
102
+ return 'Symbol';
103
+ } else {
104
+ return `Symbol(${description})`;
105
+ }
106
+ }
107
+ if (type == 'function') {
108
+ const name = val.name;
109
+ if (typeof name == 'string' && name.length > 0) {
110
+ return `Function(${name})`;
111
+ } else {
112
+ return 'Function';
113
+ }
114
+ }
115
+ // objects
116
+ if (Array.isArray(val)) {
117
+ const length = val.length;
118
+ let debug = '[';
119
+ if (length > 0) {
120
+ debug += debugString(val[0]);
121
+ }
122
+ for(let i = 1; i < length; i++) {
123
+ debug += ', ' + debugString(val[i]);
124
+ }
125
+ debug += ']';
126
+ return debug;
127
+ }
128
+ // Test for built-in
129
+ const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val));
130
+ let className;
131
+ if (builtInMatches.length > 1) {
132
+ className = builtInMatches[1];
133
+ } else {
134
+ // Failed to match the standard '[object ClassName]'
135
+ return toString.call(val);
136
+ }
137
+ if (className == 'Object') {
138
+ // we're a user defined class or Object
139
+ // JSON.stringify avoids problems with cycles, and is generally much
140
+ // easier than looping through ownProperties of `val`.
141
+ try {
142
+ return 'Object(' + JSON.stringify(val) + ')';
143
+ } catch (_) {
144
+ return 'Object';
145
+ }
146
+ }
147
+ // errors
148
+ if (val instanceof Error) {
149
+ return `${val.name}: ${val.message}\n${val.stack}`;
150
+ }
151
+ // TODO we could test for more things here, like `Set`s and `Map`s.
152
+ return className;
153
+ }
154
+
155
+ const CLOSURE_DTORS = (typeof FinalizationRegistry === 'undefined')
156
+ ? { register: () => {}, unregister: () => {} }
157
+ : new FinalizationRegistry(state => {
158
+ wasm.__wbindgen_export_3.get(state.dtor)(state.a, state.b)
159
+ });
160
+
161
+ function makeMutClosure(arg0, arg1, dtor, f) {
162
+ const state = { a: arg0, b: arg1, cnt: 1, dtor };
163
+ const real = (...args) => {
164
+ // First up with a closure we increment the internal reference
165
+ // count. This ensures that the Rust closure environment won't
166
+ // be deallocated while we're invoking it.
167
+ state.cnt++;
168
+ const a = state.a;
169
+ state.a = 0;
170
+ try {
171
+ return f(a, state.b, ...args);
172
+ } finally {
173
+ if (--state.cnt === 0) {
174
+ wasm.__wbindgen_export_3.get(state.dtor)(a, state.b);
175
+ CLOSURE_DTORS.unregister(state);
176
+ } else {
177
+ state.a = a;
178
+ }
179
+ }
180
+ };
181
+ real.original = state;
182
+ CLOSURE_DTORS.register(real, state, state);
183
+ return real;
184
+ }
185
+ function __wbg_adapter_52(arg0, arg1, arg2) {
186
+ wasm.closure537_externref_shim(arg0, arg1, arg2);
187
+ }
188
+
189
+ function takeFromExternrefTable0(idx) {
190
+ const value = wasm.__wbindgen_export_2.get(idx);
191
+ wasm.__externref_table_dealloc(idx);
192
+ return value;
193
+ }
194
+
195
+ function getArrayJsValueFromWasm0(ptr, len) {
196
+ ptr = ptr >>> 0;
197
+ const mem = getDataViewMemory0();
198
+ const result = [];
199
+ for (let i = ptr; i < ptr + 4 * len; i += 4) {
200
+ result.push(wasm.__wbindgen_export_2.get(mem.getUint32(i, true)));
201
+ }
202
+ wasm.__externref_drop_slice(ptr, len);
203
+ return result;
204
+ }
205
+
206
+ function notDefined(what) { return () => { throw new Error(`${what} is not defined`); }; }
207
+
208
+ function addToExternrefTable0(obj) {
209
+ const idx = wasm.__externref_table_alloc();
210
+ wasm.__wbindgen_export_2.set(idx, obj);
211
+ return idx;
212
+ }
213
+
214
+ function handleError(f, args) {
215
+ try {
216
+ return f.apply(this, args);
217
+ } catch (e) {
218
+ const idx = addToExternrefTable0(e);
219
+ wasm.__wbindgen_exn_store(idx);
220
+ }
221
+ }
222
+ function __wbg_adapter_130(arg0, arg1, arg2, arg3) {
223
+ wasm.closure822_externref_shim(arg0, arg1, arg2, arg3);
224
+ }
225
+
226
+ const __wbindgen_enum_RequestCredentials = ["omit", "same-origin", "include"];
227
+
228
+ const __wbindgen_enum_RequestMode = ["same-origin", "no-cors", "cors", "navigate"];
229
+
230
+ const ModularFinalization = (typeof FinalizationRegistry === 'undefined')
231
+ ? { register: () => {}, unregister: () => {} }
232
+ : new FinalizationRegistry(ptr => wasm.__wbg_modular_free(ptr >>> 0, 1));
233
+
234
+ export class Modular {
235
+
236
+ static __wrap(ptr) {
237
+ ptr = ptr >>> 0;
238
+ const obj = Object.create(Modular.prototype);
239
+ obj.__wbg_ptr = ptr;
240
+ ModularFinalization.register(obj, obj.__wbg_ptr, obj);
241
+ return obj;
242
+ }
243
+
244
+ __destroy_into_raw() {
245
+ const ptr = this.__wbg_ptr;
246
+ this.__wbg_ptr = 0;
247
+ ModularFinalization.unregister(this);
248
+ return ptr;
249
+ }
250
+
251
+ free() {
252
+ const ptr = this.__destroy_into_raw();
253
+ wasm.__wbg_modular_free(ptr, 0);
254
+ }
255
+ /**
256
+ * @returns {Modular}
257
+ */
258
+ static new() {
259
+ const ret = wasm.modular_new();
260
+ return Modular.__wrap(ret);
261
+ }
262
+ /**
263
+ * @param {string} input
264
+ */
265
+ loadGraph(input) {
266
+ const ptr0 = passStringToWasm0(input, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
267
+ const len0 = WASM_VECTOR_LEN;
268
+ const ret = wasm.modular_loadGraph(this.__wbg_ptr, ptr0, len0);
269
+ if (ret[1]) {
270
+ throw takeFromExternrefTable0(ret[0]);
271
+ }
272
+ }
273
+ /**
274
+ * @returns {Graph}
275
+ */
276
+ exportGraph() {
277
+ const ret = wasm.modular_exportGraph(this.__wbg_ptr);
278
+ return ret;
279
+ }
280
+ clearGraph() {
281
+ wasm.modular_clearGraph(this.__wbg_ptr);
282
+ }
283
+ /**
284
+ * @returns {Promise<EvaluationInterop>}
285
+ */
286
+ evaluate() {
287
+ const ret = wasm.modular_evaluate(this.__wbg_ptr);
288
+ return ret;
289
+ }
290
+ /**
291
+ * @param {string} id
292
+ * @param {NodePropertyInterop} prop
293
+ * @returns {Promise<boolean>}
294
+ */
295
+ changeNodeProperty(id, prop) {
296
+ const ptr0 = passStringToWasm0(id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
297
+ const len0 = WASM_VECTOR_LEN;
298
+ const ret = wasm.modular_changeNodeProperty(this.__wbg_ptr, ptr0, len0, prop);
299
+ return ret;
300
+ }
301
+ /**
302
+ * @returns {(NodeInterop)[]}
303
+ */
304
+ getNodes() {
305
+ const ret = wasm.modular_getNodes(this.__wbg_ptr);
306
+ var v1 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();
307
+ wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
308
+ return v1;
309
+ }
310
+ /**
311
+ * @param {GeometryIdentifier} identifier
312
+ * @returns {GeometryInterop | undefined}
313
+ */
314
+ findGeometryInteropById(identifier) {
315
+ const ret = wasm.modular_findGeometryInteropById(this.__wbg_ptr, identifier);
316
+ return ret;
317
+ }
318
+ /**
319
+ * @param {GeometryIdentifier} identifier
320
+ * @returns {GeometryProxy | undefined}
321
+ */
322
+ findGeometryById(identifier) {
323
+ const ret = wasm.modular_findGeometryById(this.__wbg_ptr, identifier);
324
+ return ret;
325
+ }
326
+ }
327
+
328
+ async function __wbg_load(module, imports) {
329
+ if (typeof Response === 'function' && module instanceof Response) {
330
+ if (typeof WebAssembly.instantiateStreaming === 'function') {
331
+ try {
332
+ return await WebAssembly.instantiateStreaming(module, imports);
333
+
334
+ } catch (e) {
335
+ if (module.headers.get('Content-Type') != 'application/wasm') {
336
+ console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n", e);
337
+
338
+ } else {
339
+ throw e;
340
+ }
341
+ }
342
+ }
343
+
344
+ const bytes = await module.arrayBuffer();
345
+ return await WebAssembly.instantiate(bytes, imports);
346
+
347
+ } else {
348
+ const instance = await WebAssembly.instantiate(module, imports);
349
+
350
+ if (instance instanceof WebAssembly.Instance) {
351
+ return { instance, module };
352
+
353
+ } else {
354
+ return instance;
355
+ }
356
+ }
357
+ }
358
+
359
+ function __wbg_get_imports() {
360
+ const imports = {};
361
+ imports.wbg = {};
362
+ imports.wbg.__wbindgen_string_get = function(arg0, arg1) {
363
+ const obj = arg1;
364
+ const ret = typeof(obj) === 'string' ? obj : undefined;
365
+ var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
366
+ var len1 = WASM_VECTOR_LEN;
367
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
368
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
369
+ };
370
+ imports.wbg.__wbindgen_is_string = function(arg0) {
371
+ const ret = typeof(arg0) === 'string';
372
+ return ret;
373
+ };
374
+ imports.wbg.__wbindgen_is_object = function(arg0) {
375
+ const val = arg0;
376
+ const ret = typeof(val) === 'object' && val !== null;
377
+ return ret;
378
+ };
379
+ imports.wbg.__wbindgen_number_get = function(arg0, arg1) {
380
+ const obj = arg1;
381
+ const ret = typeof(obj) === 'number' ? obj : undefined;
382
+ getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true);
383
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
384
+ };
385
+ imports.wbg.__wbindgen_error_new = function(arg0, arg1) {
386
+ const ret = new Error(getStringFromWasm0(arg0, arg1));
387
+ return ret;
388
+ };
389
+ imports.wbg.__wbindgen_boolean_get = function(arg0) {
390
+ const v = arg0;
391
+ const ret = typeof(v) === 'boolean' ? (v ? 1 : 0) : 2;
392
+ return ret;
393
+ };
394
+ imports.wbg.__wbindgen_string_new = function(arg0, arg1) {
395
+ const ret = getStringFromWasm0(arg0, arg1);
396
+ return ret;
397
+ };
398
+ imports.wbg.__wbindgen_as_number = function(arg0) {
399
+ const ret = +arg0;
400
+ return ret;
401
+ };
402
+ imports.wbg.__wbindgen_is_bigint = function(arg0) {
403
+ const ret = typeof(arg0) === 'bigint';
404
+ return ret;
405
+ };
406
+ imports.wbg.__wbindgen_in = function(arg0, arg1) {
407
+ const ret = arg0 in arg1;
408
+ return ret;
409
+ };
410
+ imports.wbg.__wbindgen_bigint_from_i64 = function(arg0) {
411
+ const ret = arg0;
412
+ return ret;
413
+ };
414
+ imports.wbg.__wbindgen_jsval_eq = function(arg0, arg1) {
415
+ const ret = arg0 === arg1;
416
+ return ret;
417
+ };
418
+ imports.wbg.__wbindgen_bigint_from_u64 = function(arg0) {
419
+ const ret = BigInt.asUintN(64, arg0);
420
+ return ret;
421
+ };
422
+ imports.wbg.__wbindgen_is_undefined = function(arg0) {
423
+ const ret = arg0 === undefined;
424
+ return ret;
425
+ };
426
+ imports.wbg.__wbg_queueMicrotask_848aa4969108a57e = function(arg0) {
427
+ const ret = arg0.queueMicrotask;
428
+ return ret;
429
+ };
430
+ imports.wbg.__wbindgen_is_function = function(arg0) {
431
+ const ret = typeof(arg0) === 'function';
432
+ return ret;
433
+ };
434
+ imports.wbg.__wbindgen_cb_drop = function(arg0) {
435
+ const obj = arg0.original;
436
+ if (obj.cnt-- == 1) {
437
+ obj.a = 0;
438
+ return true;
439
+ }
440
+ const ret = false;
441
+ return ret;
442
+ };
443
+ imports.wbg.__wbg_queueMicrotask_c5419c06eab41e73 = typeof queueMicrotask == 'function' ? queueMicrotask : notDefined('queueMicrotask');
444
+ imports.wbg.__wbindgen_jsval_loose_eq = function(arg0, arg1) {
445
+ const ret = arg0 == arg1;
446
+ return ret;
447
+ };
448
+ imports.wbg.__wbg_String_b9412f8799faab3e = function(arg0, arg1) {
449
+ const ret = String(arg1);
450
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
451
+ const len1 = WASM_VECTOR_LEN;
452
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
453
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
454
+ };
455
+ imports.wbg.__wbindgen_number_new = function(arg0) {
456
+ const ret = arg0;
457
+ return ret;
458
+ };
459
+ imports.wbg.__wbg_getwithrefkey_edc2c8960f0f1191 = function(arg0, arg1) {
460
+ const ret = arg0[arg1];
461
+ return ret;
462
+ };
463
+ imports.wbg.__wbg_set_f975102236d3c502 = function(arg0, arg1, arg2) {
464
+ arg0[arg1] = arg2;
465
+ };
466
+ imports.wbg.__wbg_now_d3cbc9581625f686 = function(arg0) {
467
+ const ret = arg0.now();
468
+ return ret;
469
+ };
470
+ imports.wbg.__wbg_crypto_d05b68a3572bb8ca = function(arg0) {
471
+ const ret = arg0.crypto;
472
+ return ret;
473
+ };
474
+ imports.wbg.__wbg_process_b02b3570280d0366 = function(arg0) {
475
+ const ret = arg0.process;
476
+ return ret;
477
+ };
478
+ imports.wbg.__wbg_versions_c1cb42213cedf0f5 = function(arg0) {
479
+ const ret = arg0.versions;
480
+ return ret;
481
+ };
482
+ imports.wbg.__wbg_node_43b1089f407e4ec2 = function(arg0) {
483
+ const ret = arg0.node;
484
+ return ret;
485
+ };
486
+ imports.wbg.__wbg_require_9a7e0f667ead4995 = function() { return handleError(function () {
487
+ const ret = module.require;
488
+ return ret;
489
+ }, arguments) };
490
+ imports.wbg.__wbg_msCrypto_10fc94afee92bd76 = function(arg0) {
491
+ const ret = arg0.msCrypto;
492
+ return ret;
493
+ };
494
+ imports.wbg.__wbg_randomFillSync_b70ccbdf4926a99d = function() { return handleError(function (arg0, arg1) {
495
+ arg0.randomFillSync(arg1);
496
+ }, arguments) };
497
+ imports.wbg.__wbg_getRandomValues_7e42b4fb8779dc6d = function() { return handleError(function (arg0, arg1) {
498
+ arg0.getRandomValues(arg1);
499
+ }, arguments) };
500
+ imports.wbg.__wbg_get_5419cf6b954aa11d = function(arg0, arg1) {
501
+ const ret = arg0[arg1 >>> 0];
502
+ return ret;
503
+ };
504
+ imports.wbg.__wbg_length_f217bbbf7e8e4df4 = function(arg0) {
505
+ const ret = arg0.length;
506
+ return ret;
507
+ };
508
+ imports.wbg.__wbg_new_034f913e7636e987 = function() {
509
+ const ret = new Array();
510
+ return ret;
511
+ };
512
+ imports.wbg.__wbg_newnoargs_1ede4bf2ebbaaf43 = function(arg0, arg1) {
513
+ const ret = new Function(getStringFromWasm0(arg0, arg1));
514
+ return ret;
515
+ };
516
+ imports.wbg.__wbg_new_7a87a0376e40533b = function() {
517
+ const ret = new Map();
518
+ return ret;
519
+ };
520
+ imports.wbg.__wbg_next_13b477da1eaa3897 = function(arg0) {
521
+ const ret = arg0.next;
522
+ return ret;
523
+ };
524
+ imports.wbg.__wbg_next_b06e115d1b01e10b = function() { return handleError(function (arg0) {
525
+ const ret = arg0.next();
526
+ return ret;
527
+ }, arguments) };
528
+ imports.wbg.__wbg_done_983b5ffcaec8c583 = function(arg0) {
529
+ const ret = arg0.done;
530
+ return ret;
531
+ };
532
+ imports.wbg.__wbg_value_2ab8a198c834c26a = function(arg0) {
533
+ const ret = arg0.value;
534
+ return ret;
535
+ };
536
+ imports.wbg.__wbg_iterator_695d699a44d6234c = function() {
537
+ const ret = Symbol.iterator;
538
+ return ret;
539
+ };
540
+ imports.wbg.__wbg_get_ef828680c64da212 = function() { return handleError(function (arg0, arg1) {
541
+ const ret = Reflect.get(arg0, arg1);
542
+ return ret;
543
+ }, arguments) };
544
+ imports.wbg.__wbg_call_a9ef466721e824f2 = function() { return handleError(function (arg0, arg1) {
545
+ const ret = arg0.call(arg1);
546
+ return ret;
547
+ }, arguments) };
548
+ imports.wbg.__wbg_new_e69b5f66fda8f13c = function() {
549
+ const ret = new Object();
550
+ return ret;
551
+ };
552
+ imports.wbg.__wbg_self_bf91bf94d9e04084 = function() { return handleError(function () {
553
+ const ret = self.self;
554
+ return ret;
555
+ }, arguments) };
556
+ imports.wbg.__wbg_window_52dd9f07d03fd5f8 = function() { return handleError(function () {
557
+ const ret = window.window;
558
+ return ret;
559
+ }, arguments) };
560
+ imports.wbg.__wbg_globalThis_05c129bf37fcf1be = function() { return handleError(function () {
561
+ const ret = globalThis.globalThis;
562
+ return ret;
563
+ }, arguments) };
564
+ imports.wbg.__wbg_global_3eca19bb09e9c484 = function() { return handleError(function () {
565
+ const ret = global.global;
566
+ return ret;
567
+ }, arguments) };
568
+ imports.wbg.__wbg_set_425e70f7c64ac962 = function(arg0, arg1, arg2) {
569
+ arg0[arg1 >>> 0] = arg2;
570
+ };
571
+ imports.wbg.__wbg_isArray_6f3b47f09adb61b5 = function(arg0) {
572
+ const ret = Array.isArray(arg0);
573
+ return ret;
574
+ };
575
+ imports.wbg.__wbg_instanceof_ArrayBuffer_74945570b4a62ec7 = function(arg0) {
576
+ let result;
577
+ try {
578
+ result = arg0 instanceof ArrayBuffer;
579
+ } catch (_) {
580
+ result = false;
581
+ }
582
+ const ret = result;
583
+ return ret;
584
+ };
585
+ imports.wbg.__wbg_call_3bfa248576352471 = function() { return handleError(function (arg0, arg1, arg2) {
586
+ const ret = arg0.call(arg1, arg2);
587
+ return ret;
588
+ }, arguments) };
589
+ imports.wbg.__wbg_instanceof_Map_f96986929e7e89ed = function(arg0) {
590
+ let result;
591
+ try {
592
+ result = arg0 instanceof Map;
593
+ } catch (_) {
594
+ result = false;
595
+ }
596
+ const ret = result;
597
+ return ret;
598
+ };
599
+ imports.wbg.__wbg_set_277a63e77c89279f = function(arg0, arg1, arg2) {
600
+ const ret = arg0.set(arg1, arg2);
601
+ return ret;
602
+ };
603
+ imports.wbg.__wbg_isSafeInteger_b9dff570f01a9100 = function(arg0) {
604
+ const ret = Number.isSafeInteger(arg0);
605
+ return ret;
606
+ };
607
+ imports.wbg.__wbg_entries_c02034de337d3ee2 = function(arg0) {
608
+ const ret = Object.entries(arg0);
609
+ return ret;
610
+ };
611
+ imports.wbg.__wbg_new_1073970097e5a420 = function(arg0, arg1) {
612
+ try {
613
+ var state0 = {a: arg0, b: arg1};
614
+ var cb0 = (arg0, arg1) => {
615
+ const a = state0.a;
616
+ state0.a = 0;
617
+ try {
618
+ return __wbg_adapter_130(a, state0.b, arg0, arg1);
619
+ } finally {
620
+ state0.a = a;
621
+ }
622
+ };
623
+ const ret = new Promise(cb0);
624
+ return ret;
625
+ } finally {
626
+ state0.a = state0.b = 0;
627
+ }
628
+ };
629
+ imports.wbg.__wbg_resolve_0aad7c1484731c99 = function(arg0) {
630
+ const ret = Promise.resolve(arg0);
631
+ return ret;
632
+ };
633
+ imports.wbg.__wbg_then_748f75edfb032440 = function(arg0, arg1) {
634
+ const ret = arg0.then(arg1);
635
+ return ret;
636
+ };
637
+ imports.wbg.__wbg_buffer_ccaed51a635d8a2d = function(arg0) {
638
+ const ret = arg0.buffer;
639
+ return ret;
640
+ };
641
+ imports.wbg.__wbg_newwithbyteoffsetandlength_7e3eb787208af730 = function(arg0, arg1, arg2) {
642
+ const ret = new Uint8Array(arg0, arg1 >>> 0, arg2 >>> 0);
643
+ return ret;
644
+ };
645
+ imports.wbg.__wbg_new_fec2611eb9180f95 = function(arg0) {
646
+ const ret = new Uint8Array(arg0);
647
+ return ret;
648
+ };
649
+ imports.wbg.__wbg_set_ec2fcf81bc573fd9 = function(arg0, arg1, arg2) {
650
+ arg0.set(arg1, arg2 >>> 0);
651
+ };
652
+ imports.wbg.__wbg_length_9254c4bd3b9f23c4 = function(arg0) {
653
+ const ret = arg0.length;
654
+ return ret;
655
+ };
656
+ imports.wbg.__wbg_instanceof_Uint8Array_df0761410414ef36 = function(arg0) {
657
+ let result;
658
+ try {
659
+ result = arg0 instanceof Uint8Array;
660
+ } catch (_) {
661
+ result = false;
662
+ }
663
+ const ret = result;
664
+ return ret;
665
+ };
666
+ imports.wbg.__wbg_newwithlength_76462a666eca145f = function(arg0) {
667
+ const ret = new Uint8Array(arg0 >>> 0);
668
+ return ret;
669
+ };
670
+ imports.wbg.__wbg_subarray_975a06f9dbd16995 = function(arg0, arg1, arg2) {
671
+ const ret = arg0.subarray(arg1 >>> 0, arg2 >>> 0);
672
+ return ret;
673
+ };
674
+ imports.wbg.__wbindgen_bigint_get_as_i64 = function(arg0, arg1) {
675
+ const v = arg1;
676
+ const ret = typeof(v) === 'bigint' ? v : undefined;
677
+ getDataViewMemory0().setBigInt64(arg0 + 8 * 1, isLikeNone(ret) ? BigInt(0) : ret, true);
678
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
679
+ };
680
+ imports.wbg.__wbindgen_debug_string = function(arg0, arg1) {
681
+ const ret = debugString(arg1);
682
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
683
+ const len1 = WASM_VECTOR_LEN;
684
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
685
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
686
+ };
687
+ imports.wbg.__wbindgen_throw = function(arg0, arg1) {
688
+ throw new Error(getStringFromWasm0(arg0, arg1));
689
+ };
690
+ imports.wbg.__wbindgen_memory = function() {
691
+ const ret = wasm.memory;
692
+ return ret;
693
+ };
694
+ imports.wbg.__wbindgen_closure_wrapper2519 = function(arg0, arg1, arg2) {
695
+ const ret = makeMutClosure(arg0, arg1, 538, __wbg_adapter_52);
696
+ return ret;
697
+ };
698
+ imports.wbg.__wbindgen_init_externref_table = function() {
699
+ const table = wasm.__wbindgen_export_2;
700
+ const offset = table.grow(4);
701
+ table.set(0, undefined);
702
+ table.set(offset + 0, undefined);
703
+ table.set(offset + 1, null);
704
+ table.set(offset + 2, true);
705
+ table.set(offset + 3, false);
706
+ ;
707
+ };
708
+
709
+ return imports;
710
+ }
711
+
712
+ function __wbg_init_memory(imports, memory) {
713
+
714
+ }
715
+
716
+ function __wbg_finalize_init(instance, module) {
717
+ wasm = instance.exports;
718
+ __wbg_init.__wbindgen_wasm_module = module;
719
+ cachedDataViewMemory0 = null;
720
+ cachedUint8ArrayMemory0 = null;
721
+
722
+
723
+ wasm.__wbindgen_start();
724
+ return wasm;
725
+ }
726
+
727
+ function initSync(module) {
728
+ if (wasm !== undefined) return wasm;
729
+
730
+
731
+ if (typeof module !== 'undefined') {
732
+ if (Object.getPrototypeOf(module) === Object.prototype) {
733
+ ({module} = module)
734
+ } else {
735
+ console.warn('using deprecated parameters for `initSync()`; pass a single object instead')
736
+ }
737
+ }
738
+
739
+ const imports = __wbg_get_imports();
740
+
741
+ __wbg_init_memory(imports);
742
+
743
+ if (!(module instanceof WebAssembly.Module)) {
744
+ module = new WebAssembly.Module(module);
745
+ }
746
+
747
+ const instance = new WebAssembly.Instance(module, imports);
748
+
749
+ return __wbg_finalize_init(instance, module);
750
+ }
751
+
752
+ async function __wbg_init(module_or_path) {
753
+ if (wasm !== undefined) return wasm;
754
+
755
+
756
+ if (typeof module_or_path !== 'undefined') {
757
+ if (Object.getPrototypeOf(module_or_path) === Object.prototype) {
758
+ ({module_or_path} = module_or_path)
759
+ } else {
760
+ console.warn('using deprecated parameters for the initialization function; pass a single object instead')
761
+ }
762
+ }
763
+
764
+ if (typeof module_or_path === 'undefined') {
765
+ module_or_path = new URL('index_bg.wasm', import.meta.url);
766
+ }
767
+ const imports = __wbg_get_imports();
768
+
769
+ if (typeof module_or_path === 'string' || (typeof Request === 'function' && module_or_path instanceof Request) || (typeof URL === 'function' && module_or_path instanceof URL)) {
770
+ module_or_path = fetch(module_or_path);
771
+ }
772
+
773
+ __wbg_init_memory(imports);
774
+
775
+ const { instance, module } = await __wbg_load(await module_or_path, imports);
776
+
777
+ return __wbg_finalize_init(instance, module);
778
+ }
779
+
780
+ export { initSync };
781
+ export default __wbg_init;
package/index_bg.wasm ADDED
Binary file
package/package.json ADDED
@@ -0,0 +1,29 @@
1
+ {
2
+ "name": "nodi-modular",
3
+ "type": "module",
4
+ "collaborators": [
5
+ "Masatatsu Nakamura <masatatsu.nakamura@gmail.com"
6
+ ],
7
+ "description": "Modular is a module project designed to import node graphs created in Nodi in JSON format, enabling the extraction of geometric data generated based on the node graph structure.",
8
+ "version": "0.0.0",
9
+ "license": "MIT",
10
+ "repository": {
11
+ "type": "git",
12
+ "url": "https://github.com/Nodi3d/modular"
13
+ },
14
+ "files": [
15
+ "index_bg.wasm",
16
+ "index.js",
17
+ "index.d.ts"
18
+ ],
19
+ "main": "index.js",
20
+ "homepage": "https://github.com/Nodi3d/modular",
21
+ "types": "index.d.ts",
22
+ "sideEffects": [
23
+ "./snippets/*"
24
+ ],
25
+ "keywords": [
26
+ "modeling",
27
+ "3d"
28
+ ]
29
+ }