@hypen-space/core 0.2.2 → 0.2.3

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.
@@ -0,0 +1,811 @@
1
+ let wasm;
2
+
3
+ let cachedUint8ArrayMemory0 = null;
4
+
5
+ function getUint8ArrayMemory0() {
6
+ if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
7
+ cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
8
+ }
9
+ return cachedUint8ArrayMemory0;
10
+ }
11
+
12
+ let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
13
+
14
+ cachedTextDecoder.decode();
15
+
16
+ const MAX_SAFARI_DECODE_BYTES = 2146435072;
17
+ let numBytesDecoded = 0;
18
+ function decodeText(ptr, len) {
19
+ numBytesDecoded += len;
20
+ if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
21
+ cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
22
+ cachedTextDecoder.decode();
23
+ numBytesDecoded = len;
24
+ }
25
+ return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
26
+ }
27
+
28
+ function getStringFromWasm0(ptr, len) {
29
+ ptr = ptr >>> 0;
30
+ return decodeText(ptr, len);
31
+ }
32
+
33
+ function addToExternrefTable0(obj) {
34
+ const idx = wasm.__externref_table_alloc();
35
+ wasm.__wbindgen_export_2.set(idx, obj);
36
+ return idx;
37
+ }
38
+
39
+ function handleError(f, args) {
40
+ try {
41
+ return f.apply(this, args);
42
+ } catch (e) {
43
+ const idx = addToExternrefTable0(e);
44
+ wasm.__wbindgen_exn_store(idx);
45
+ }
46
+ }
47
+
48
+ function getArrayU8FromWasm0(ptr, len) {
49
+ ptr = ptr >>> 0;
50
+ return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
51
+ }
52
+
53
+ function isLikeNone(x) {
54
+ return x === undefined || x === null;
55
+ }
56
+
57
+ let cachedDataViewMemory0 = null;
58
+
59
+ function getDataViewMemory0() {
60
+ if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
61
+ cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
62
+ }
63
+ return cachedDataViewMemory0;
64
+ }
65
+
66
+ function debugString(val) {
67
+ // primitive types
68
+ const type = typeof val;
69
+ if (type == 'number' || type == 'boolean' || val == null) {
70
+ return `${val}`;
71
+ }
72
+ if (type == 'string') {
73
+ return `"${val}"`;
74
+ }
75
+ if (type == 'symbol') {
76
+ const description = val.description;
77
+ if (description == null) {
78
+ return 'Symbol';
79
+ } else {
80
+ return `Symbol(${description})`;
81
+ }
82
+ }
83
+ if (type == 'function') {
84
+ const name = val.name;
85
+ if (typeof name == 'string' && name.length > 0) {
86
+ return `Function(${name})`;
87
+ } else {
88
+ return 'Function';
89
+ }
90
+ }
91
+ // objects
92
+ if (Array.isArray(val)) {
93
+ const length = val.length;
94
+ let debug = '[';
95
+ if (length > 0) {
96
+ debug += debugString(val[0]);
97
+ }
98
+ for(let i = 1; i < length; i++) {
99
+ debug += ', ' + debugString(val[i]);
100
+ }
101
+ debug += ']';
102
+ return debug;
103
+ }
104
+ // Test for built-in
105
+ const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val));
106
+ let className;
107
+ if (builtInMatches && builtInMatches.length > 1) {
108
+ className = builtInMatches[1];
109
+ } else {
110
+ // Failed to match the standard '[object ClassName]'
111
+ return toString.call(val);
112
+ }
113
+ if (className == 'Object') {
114
+ // we're a user defined class or Object
115
+ // JSON.stringify avoids problems with cycles, and is generally much
116
+ // easier than looping through ownProperties of `val`.
117
+ try {
118
+ return 'Object(' + JSON.stringify(val) + ')';
119
+ } catch (_) {
120
+ return 'Object';
121
+ }
122
+ }
123
+ // errors
124
+ if (val instanceof Error) {
125
+ return `${val.name}: ${val.message}\n${val.stack}`;
126
+ }
127
+ // TODO we could test for more things here, like `Set`s and `Map`s.
128
+ return className;
129
+ }
130
+
131
+ let WASM_VECTOR_LEN = 0;
132
+
133
+ const cachedTextEncoder = new TextEncoder();
134
+
135
+ if (!('encodeInto' in cachedTextEncoder)) {
136
+ cachedTextEncoder.encodeInto = function (arg, view) {
137
+ const buf = cachedTextEncoder.encode(arg);
138
+ view.set(buf);
139
+ return {
140
+ read: arg.length,
141
+ written: buf.length
142
+ };
143
+ }
144
+ }
145
+
146
+ function passStringToWasm0(arg, malloc, realloc) {
147
+
148
+ if (realloc === undefined) {
149
+ const buf = cachedTextEncoder.encode(arg);
150
+ const ptr = malloc(buf.length, 1) >>> 0;
151
+ getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
152
+ WASM_VECTOR_LEN = buf.length;
153
+ return ptr;
154
+ }
155
+
156
+ let len = arg.length;
157
+ let ptr = malloc(len, 1) >>> 0;
158
+
159
+ const mem = getUint8ArrayMemory0();
160
+
161
+ let offset = 0;
162
+
163
+ for (; offset < len; offset++) {
164
+ const code = arg.charCodeAt(offset);
165
+ if (code > 0x7F) break;
166
+ mem[ptr + offset] = code;
167
+ }
168
+
169
+ if (offset !== len) {
170
+ if (offset !== 0) {
171
+ arg = arg.slice(offset);
172
+ }
173
+ ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
174
+ const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
175
+ const ret = cachedTextEncoder.encodeInto(arg, view);
176
+
177
+ offset += ret.written;
178
+ ptr = realloc(ptr, len, offset, 1) >>> 0;
179
+ }
180
+
181
+ WASM_VECTOR_LEN = offset;
182
+ return ptr;
183
+ }
184
+
185
+ function takeFromExternrefTable0(idx) {
186
+ const value = wasm.__wbindgen_export_2.get(idx);
187
+ wasm.__externref_table_dealloc(idx);
188
+ return value;
189
+ }
190
+
191
+ function passArrayJsValueToWasm0(array, malloc) {
192
+ const ptr = malloc(array.length * 4, 4) >>> 0;
193
+ for (let i = 0; i < array.length; i++) {
194
+ const add = addToExternrefTable0(array[i]);
195
+ getDataViewMemory0().setUint32(ptr + 4 * i, add, true);
196
+ }
197
+ WASM_VECTOR_LEN = array.length;
198
+ return ptr;
199
+ }
200
+ /**
201
+ * Export patches as JSON string (for debugging)
202
+ * @param {any} patches
203
+ * @returns {string}
204
+ */
205
+ export function patchesToJson(patches) {
206
+ let deferred2_0;
207
+ let deferred2_1;
208
+ try {
209
+ const ret = wasm.patchesToJson(patches);
210
+ var ptr1 = ret[0];
211
+ var len1 = ret[1];
212
+ if (ret[3]) {
213
+ ptr1 = 0; len1 = 0;
214
+ throw takeFromExternrefTable0(ret[2]);
215
+ }
216
+ deferred2_0 = ptr1;
217
+ deferred2_1 = len1;
218
+ return getStringFromWasm0(ptr1, len1);
219
+ } finally {
220
+ wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
221
+ }
222
+ }
223
+
224
+ /**
225
+ * Parse Hypen DSL and return AST as JSON
226
+ * @param {string} source
227
+ * @returns {string}
228
+ */
229
+ export function parseToJson(source) {
230
+ let deferred3_0;
231
+ let deferred3_1;
232
+ try {
233
+ const ptr0 = passStringToWasm0(source, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
234
+ const len0 = WASM_VECTOR_LEN;
235
+ const ret = wasm.parseToJson(ptr0, len0);
236
+ var ptr2 = ret[0];
237
+ var len2 = ret[1];
238
+ if (ret[3]) {
239
+ ptr2 = 0; len2 = 0;
240
+ throw takeFromExternrefTable0(ret[2]);
241
+ }
242
+ deferred3_0 = ptr2;
243
+ deferred3_1 = len2;
244
+ return getStringFromWasm0(ptr2, len2);
245
+ } finally {
246
+ wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
247
+ }
248
+ }
249
+
250
+ export function main() {
251
+ wasm.main();
252
+ }
253
+
254
+ const WasmEngineFinalization = (typeof FinalizationRegistry === 'undefined')
255
+ ? { register: () => {}, unregister: () => {} }
256
+ : new FinalizationRegistry(ptr => wasm.__wbg_wasmengine_free(ptr >>> 0, 1));
257
+ /**
258
+ * WASM-exported engine instance
259
+ * Uses Rc<RefCell<>> instead of Send+Sync for WASM single-threaded environment
260
+ */
261
+ export class WasmEngine {
262
+
263
+ __destroy_into_raw() {
264
+ const ptr = this.__wbg_ptr;
265
+ this.__wbg_ptr = 0;
266
+ WasmEngineFinalization.unregister(this);
267
+ return ptr;
268
+ }
269
+
270
+ free() {
271
+ const ptr = this.__destroy_into_raw();
272
+ wasm.__wbg_wasmengine_free(ptr, 0);
273
+ }
274
+ /**
275
+ * Create a new engine instance
276
+ */
277
+ constructor() {
278
+ const ret = wasm.wasmengine_new();
279
+ this.__wbg_ptr = ret >>> 0;
280
+ WasmEngineFinalization.register(this, this.__wbg_ptr, this);
281
+ return this;
282
+ }
283
+ /**
284
+ * Parse and render Hypen DSL source code
285
+ * @param {string} source
286
+ */
287
+ renderSource(source) {
288
+ const ptr0 = passStringToWasm0(source, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
289
+ const len0 = WASM_VECTOR_LEN;
290
+ const ret = wasm.wasmengine_renderSource(this.__wbg_ptr, ptr0, len0);
291
+ if (ret[1]) {
292
+ throw takeFromExternrefTable0(ret[0]);
293
+ }
294
+ }
295
+ /**
296
+ * Set the render callback that receives patches
297
+ * @param {Function} callback
298
+ */
299
+ setRenderCallback(callback) {
300
+ wasm.wasmengine_setRenderCallback(this.__wbg_ptr, callback);
301
+ }
302
+ /**
303
+ * Set the component resolver callback
304
+ * The resolver receives (componentName, contextPath) and should return
305
+ * { source: string, path: string } or null
306
+ *
307
+ * contextPath is the path of the component that's referencing this component
308
+ * The returned path should be the resolved absolute path to the component file
309
+ * @param {Function} resolver
310
+ */
311
+ setComponentResolver(resolver) {
312
+ wasm.wasmengine_setComponentResolver(this.__wbg_ptr, resolver);
313
+ }
314
+ /**
315
+ * Register a primitive element (like Text, Button, etc.) to skip component resolution
316
+ * This prevents unnecessary resolver calls for built-in DOM elements
317
+ * @param {string} name
318
+ */
319
+ registerPrimitive(name) {
320
+ const ptr0 = passStringToWasm0(name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
321
+ const len0 = WASM_VECTOR_LEN;
322
+ wasm.wasmengine_registerPrimitive(this.__wbg_ptr, ptr0, len0);
323
+ }
324
+ /**
325
+ * Render a component source (for lazy loading routes)
326
+ * This allows rendering a component on-demand
327
+ * @param {string} source
328
+ */
329
+ renderLazyComponent(source) {
330
+ const ptr0 = passStringToWasm0(source, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
331
+ const len0 = WASM_VECTOR_LEN;
332
+ const ret = wasm.wasmengine_renderLazyComponent(this.__wbg_ptr, ptr0, len0);
333
+ if (ret[1]) {
334
+ throw takeFromExternrefTable0(ret[0]);
335
+ }
336
+ }
337
+ /**
338
+ * Render a component into a specific parent node (subtree rendering)
339
+ * This is used for lazy routing where components are rendered on-demand into route containers
340
+ *
341
+ * # Arguments
342
+ * * `source` - The Hypen DSL source to parse and render
343
+ * * `parent_node_id_str` - The serialized node ID string of the parent element
344
+ * * `state_js` - The state to use for rendering (as JsValue)
345
+ * @param {string} source
346
+ * @param {string} parent_node_id_str
347
+ * @param {any} state_js
348
+ */
349
+ renderInto(source, parent_node_id_str, state_js) {
350
+ const ptr0 = passStringToWasm0(source, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
351
+ const len0 = WASM_VECTOR_LEN;
352
+ const ptr1 = passStringToWasm0(parent_node_id_str, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
353
+ const len1 = WASM_VECTOR_LEN;
354
+ const ret = wasm.wasmengine_renderInto(this.__wbg_ptr, ptr0, len0, ptr1, len1, state_js);
355
+ if (ret[1]) {
356
+ throw takeFromExternrefTable0(ret[0]);
357
+ }
358
+ }
359
+ /**
360
+ * Update state from JavaScript
361
+ * @param {any} state_patch
362
+ */
363
+ updateState(state_patch) {
364
+ const ret = wasm.wasmengine_updateState(this.__wbg_ptr, state_patch);
365
+ if (ret[1]) {
366
+ throw takeFromExternrefTable0(ret[0]);
367
+ }
368
+ }
369
+ /**
370
+ * Update state using sparse path-value pairs
371
+ * More efficient than updateState for large state objects when only a few paths changed
372
+ *
373
+ * # Arguments
374
+ * * `paths_js` - Array of changed paths (e.g., ["user.name", "count"])
375
+ * * `values_js` - Object mapping paths to their new values (e.g., { "user.name": "Bob", "count": 42 })
376
+ * @param {any} paths_js
377
+ * @param {any} values_js
378
+ */
379
+ updateStateSparse(paths_js, values_js) {
380
+ const ret = wasm.wasmengine_updateStateSparse(this.__wbg_ptr, paths_js, values_js);
381
+ if (ret[1]) {
382
+ throw takeFromExternrefTable0(ret[0]);
383
+ }
384
+ }
385
+ /**
386
+ * Dispatch an action
387
+ * @param {string} name
388
+ * @param {any} payload
389
+ */
390
+ dispatchAction(name, payload) {
391
+ const ptr0 = passStringToWasm0(name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
392
+ const len0 = WASM_VECTOR_LEN;
393
+ const ret = wasm.wasmengine_dispatchAction(this.__wbg_ptr, ptr0, len0, payload);
394
+ if (ret[1]) {
395
+ throw takeFromExternrefTable0(ret[0]);
396
+ }
397
+ }
398
+ /**
399
+ * Register an action handler
400
+ * @param {string} action_name
401
+ * @param {Function} handler
402
+ */
403
+ onAction(action_name, handler) {
404
+ const ptr0 = passStringToWasm0(action_name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
405
+ const len0 = WASM_VECTOR_LEN;
406
+ wasm.wasmengine_onAction(this.__wbg_ptr, ptr0, len0, handler);
407
+ }
408
+ /**
409
+ * Clear the engine tree (useful when switching samples)
410
+ */
411
+ clearTree() {
412
+ wasm.wasmengine_clearTree(this.__wbg_ptr);
413
+ }
414
+ /**
415
+ * Debug method to inspect parsed components
416
+ * @param {string} source
417
+ * @returns {string}
418
+ */
419
+ debugParseComponent(source) {
420
+ let deferred3_0;
421
+ let deferred3_1;
422
+ try {
423
+ const ptr0 = passStringToWasm0(source, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
424
+ const len0 = WASM_VECTOR_LEN;
425
+ const ret = wasm.wasmengine_debugParseComponent(this.__wbg_ptr, ptr0, len0);
426
+ var ptr2 = ret[0];
427
+ var len2 = ret[1];
428
+ if (ret[3]) {
429
+ ptr2 = 0; len2 = 0;
430
+ throw takeFromExternrefTable0(ret[2]);
431
+ }
432
+ deferred3_0 = ptr2;
433
+ deferred3_1 = len2;
434
+ return getStringFromWasm0(ptr2, len2);
435
+ } finally {
436
+ wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
437
+ }
438
+ }
439
+ /**
440
+ * Initialize a module
441
+ * @param {string} name
442
+ * @param {string[]} actions
443
+ * @param {string[]} state_keys
444
+ * @param {any} initial_state
445
+ */
446
+ setModule(name, actions, state_keys, initial_state) {
447
+ const ptr0 = passStringToWasm0(name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
448
+ const len0 = WASM_VECTOR_LEN;
449
+ const ptr1 = passArrayJsValueToWasm0(actions, wasm.__wbindgen_malloc);
450
+ const len1 = WASM_VECTOR_LEN;
451
+ const ptr2 = passArrayJsValueToWasm0(state_keys, wasm.__wbindgen_malloc);
452
+ const len2 = WASM_VECTOR_LEN;
453
+ const ret = wasm.wasmengine_setModule(this.__wbg_ptr, ptr0, len0, ptr1, len1, ptr2, len2, initial_state);
454
+ if (ret[1]) {
455
+ throw takeFromExternrefTable0(ret[0]);
456
+ }
457
+ }
458
+ /**
459
+ * Get the current revision number
460
+ * @returns {bigint}
461
+ */
462
+ getRevision() {
463
+ const ret = wasm.wasmengine_getRevision(this.__wbg_ptr);
464
+ return BigInt.asUintN(64, ret);
465
+ }
466
+ }
467
+ if (Symbol.dispose) WasmEngine.prototype[Symbol.dispose] = WasmEngine.prototype.free;
468
+
469
+ const EXPECTED_RESPONSE_TYPES = new Set(['basic', 'cors', 'default']);
470
+
471
+ async function __wbg_load(module, imports) {
472
+ if (typeof Response === 'function' && module instanceof Response) {
473
+ if (typeof WebAssembly.instantiateStreaming === 'function') {
474
+ try {
475
+ return await WebAssembly.instantiateStreaming(module, imports);
476
+
477
+ } catch (e) {
478
+ const validResponse = module.ok && EXPECTED_RESPONSE_TYPES.has(module.type);
479
+
480
+ if (validResponse && module.headers.get('Content-Type') !== 'application/wasm') {
481
+ 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);
482
+
483
+ } else {
484
+ throw e;
485
+ }
486
+ }
487
+ }
488
+
489
+ const bytes = await module.arrayBuffer();
490
+ return await WebAssembly.instantiate(bytes, imports);
491
+
492
+ } else {
493
+ const instance = await WebAssembly.instantiate(module, imports);
494
+
495
+ if (instance instanceof WebAssembly.Instance) {
496
+ return { instance, module };
497
+
498
+ } else {
499
+ return instance;
500
+ }
501
+ }
502
+ }
503
+
504
+ function __wbg_get_imports() {
505
+ const imports = {};
506
+ imports.wbg = {};
507
+ imports.wbg.__wbg_Error_e17e777aac105295 = function(arg0, arg1) {
508
+ const ret = Error(getStringFromWasm0(arg0, arg1));
509
+ return ret;
510
+ };
511
+ imports.wbg.__wbg_call_13410aac570ffff7 = function() { return handleError(function (arg0, arg1) {
512
+ const ret = arg0.call(arg1);
513
+ return ret;
514
+ }, arguments) };
515
+ imports.wbg.__wbg_call_641db1bb5db5a579 = function() { return handleError(function (arg0, arg1, arg2, arg3) {
516
+ const ret = arg0.call(arg1, arg2, arg3);
517
+ return ret;
518
+ }, arguments) };
519
+ imports.wbg.__wbg_call_a5400b25a865cfd8 = function() { return handleError(function (arg0, arg1, arg2) {
520
+ const ret = arg0.call(arg1, arg2);
521
+ return ret;
522
+ }, arguments) };
523
+ imports.wbg.__wbg_done_75ed0ee6dd243d9d = function(arg0) {
524
+ const ret = arg0.done;
525
+ return ret;
526
+ };
527
+ imports.wbg.__wbg_entries_2be2f15bd5554996 = function(arg0) {
528
+ const ret = Object.entries(arg0);
529
+ return ret;
530
+ };
531
+ imports.wbg.__wbg_error_99981e16d476aa5c = function(arg0) {
532
+ console.error(arg0);
533
+ };
534
+ imports.wbg.__wbg_get_0da715ceaecea5c8 = function(arg0, arg1) {
535
+ const ret = arg0[arg1 >>> 0];
536
+ return ret;
537
+ };
538
+ imports.wbg.__wbg_get_458e874b43b18b25 = function() { return handleError(function (arg0, arg1) {
539
+ const ret = Reflect.get(arg0, arg1);
540
+ return ret;
541
+ }, arguments) };
542
+ imports.wbg.__wbg_instanceof_ArrayBuffer_67f3012529f6a2dd = function(arg0) {
543
+ let result;
544
+ try {
545
+ result = arg0 instanceof ArrayBuffer;
546
+ } catch (_) {
547
+ result = false;
548
+ }
549
+ const ret = result;
550
+ return ret;
551
+ };
552
+ imports.wbg.__wbg_instanceof_Map_ebb01a5b6b5ffd0b = function(arg0) {
553
+ let result;
554
+ try {
555
+ result = arg0 instanceof Map;
556
+ } catch (_) {
557
+ result = false;
558
+ }
559
+ const ret = result;
560
+ return ret;
561
+ };
562
+ imports.wbg.__wbg_instanceof_Uint8Array_9a8378d955933db7 = function(arg0) {
563
+ let result;
564
+ try {
565
+ result = arg0 instanceof Uint8Array;
566
+ } catch (_) {
567
+ result = false;
568
+ }
569
+ const ret = result;
570
+ return ret;
571
+ };
572
+ imports.wbg.__wbg_isArray_030cce220591fb41 = function(arg0) {
573
+ const ret = Array.isArray(arg0);
574
+ return ret;
575
+ };
576
+ imports.wbg.__wbg_isSafeInteger_1c0d1af5542e102a = function(arg0) {
577
+ const ret = Number.isSafeInteger(arg0);
578
+ return ret;
579
+ };
580
+ imports.wbg.__wbg_iterator_f370b34483c71a1c = function() {
581
+ const ret = Symbol.iterator;
582
+ return ret;
583
+ };
584
+ imports.wbg.__wbg_length_186546c51cd61acd = function(arg0) {
585
+ const ret = arg0.length;
586
+ return ret;
587
+ };
588
+ imports.wbg.__wbg_length_6bb7e81f9d7713e4 = function(arg0) {
589
+ const ret = arg0.length;
590
+ return ret;
591
+ };
592
+ imports.wbg.__wbg_log_6c7b5f4f00b8ce3f = function(arg0) {
593
+ console.log(arg0);
594
+ };
595
+ imports.wbg.__wbg_new_19c25a3f2fa63a02 = function() {
596
+ const ret = new Object();
597
+ return ret;
598
+ };
599
+ imports.wbg.__wbg_new_1f3a344cf3123716 = function() {
600
+ const ret = new Array();
601
+ return ret;
602
+ };
603
+ imports.wbg.__wbg_new_2ff1f68f3676ea53 = function() {
604
+ const ret = new Map();
605
+ return ret;
606
+ };
607
+ imports.wbg.__wbg_new_638ebfaedbf32a5e = function(arg0) {
608
+ const ret = new Uint8Array(arg0);
609
+ return ret;
610
+ };
611
+ imports.wbg.__wbg_next_5b3530e612fde77d = function(arg0) {
612
+ const ret = arg0.next;
613
+ return ret;
614
+ };
615
+ imports.wbg.__wbg_next_692e82279131b03c = function() { return handleError(function (arg0) {
616
+ const ret = arg0.next();
617
+ return ret;
618
+ }, arguments) };
619
+ imports.wbg.__wbg_prototypesetcall_3d4a26c1ed734349 = function(arg0, arg1, arg2) {
620
+ Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), arg2);
621
+ };
622
+ imports.wbg.__wbg_set_3f1d0b984ed272ed = function(arg0, arg1, arg2) {
623
+ arg0[arg1] = arg2;
624
+ };
625
+ imports.wbg.__wbg_set_90f6c0f7bd8c0415 = function(arg0, arg1, arg2) {
626
+ arg0[arg1 >>> 0] = arg2;
627
+ };
628
+ imports.wbg.__wbg_set_b7f1cf4fae26fe2a = function(arg0, arg1, arg2) {
629
+ const ret = arg0.set(arg1, arg2);
630
+ return ret;
631
+ };
632
+ imports.wbg.__wbg_value_dd9372230531eade = function(arg0) {
633
+ const ret = arg0.value;
634
+ return ret;
635
+ };
636
+ imports.wbg.__wbg_wbindgenbigintgetasi64_ac743ece6ab9bba1 = function(arg0, arg1) {
637
+ const v = arg1;
638
+ const ret = typeof(v) === 'bigint' ? v : undefined;
639
+ getDataViewMemory0().setBigInt64(arg0 + 8 * 1, isLikeNone(ret) ? BigInt(0) : ret, true);
640
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
641
+ };
642
+ imports.wbg.__wbg_wbindgenbooleanget_3fe6f642c7d97746 = function(arg0) {
643
+ const v = arg0;
644
+ const ret = typeof(v) === 'boolean' ? v : undefined;
645
+ return isLikeNone(ret) ? 0xFFFFFF : ret ? 1 : 0;
646
+ };
647
+ imports.wbg.__wbg_wbindgendebugstring_99ef257a3ddda34d = function(arg0, arg1) {
648
+ const ret = debugString(arg1);
649
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
650
+ const len1 = WASM_VECTOR_LEN;
651
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
652
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
653
+ };
654
+ imports.wbg.__wbg_wbindgenin_d7a1ee10933d2d55 = function(arg0, arg1) {
655
+ const ret = arg0 in arg1;
656
+ return ret;
657
+ };
658
+ imports.wbg.__wbg_wbindgenisbigint_ecb90cc08a5a9154 = function(arg0) {
659
+ const ret = typeof(arg0) === 'bigint';
660
+ return ret;
661
+ };
662
+ imports.wbg.__wbg_wbindgenisfunction_8cee7dce3725ae74 = function(arg0) {
663
+ const ret = typeof(arg0) === 'function';
664
+ return ret;
665
+ };
666
+ imports.wbg.__wbg_wbindgenisnull_f3037694abe4d97a = function(arg0) {
667
+ const ret = arg0 === null;
668
+ return ret;
669
+ };
670
+ imports.wbg.__wbg_wbindgenisobject_307a53c6bd97fbf8 = function(arg0) {
671
+ const val = arg0;
672
+ const ret = typeof(val) === 'object' && val !== null;
673
+ return ret;
674
+ };
675
+ imports.wbg.__wbg_wbindgenisstring_d4fa939789f003b0 = function(arg0) {
676
+ const ret = typeof(arg0) === 'string';
677
+ return ret;
678
+ };
679
+ imports.wbg.__wbg_wbindgenisundefined_c4b71d073b92f3c5 = function(arg0) {
680
+ const ret = arg0 === undefined;
681
+ return ret;
682
+ };
683
+ imports.wbg.__wbg_wbindgenjsvaleq_e6f2ad59ccae1b58 = function(arg0, arg1) {
684
+ const ret = arg0 === arg1;
685
+ return ret;
686
+ };
687
+ imports.wbg.__wbg_wbindgenjsvallooseeq_9bec8c9be826bed1 = function(arg0, arg1) {
688
+ const ret = arg0 == arg1;
689
+ return ret;
690
+ };
691
+ imports.wbg.__wbg_wbindgennumberget_f74b4c7525ac05cb = function(arg0, arg1) {
692
+ const obj = arg1;
693
+ const ret = typeof(obj) === 'number' ? obj : undefined;
694
+ getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true);
695
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
696
+ };
697
+ imports.wbg.__wbg_wbindgenstringget_0f16a6ddddef376f = function(arg0, arg1) {
698
+ const obj = arg1;
699
+ const ret = typeof(obj) === 'string' ? obj : undefined;
700
+ var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
701
+ var len1 = WASM_VECTOR_LEN;
702
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
703
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
704
+ };
705
+ imports.wbg.__wbg_wbindgenthrow_451ec1a8469d7eb6 = function(arg0, arg1) {
706
+ throw new Error(getStringFromWasm0(arg0, arg1));
707
+ };
708
+ imports.wbg.__wbindgen_cast_2241b6af4c4b2941 = function(arg0, arg1) {
709
+ // Cast intrinsic for `Ref(String) -> Externref`.
710
+ const ret = getStringFromWasm0(arg0, arg1);
711
+ return ret;
712
+ };
713
+ imports.wbg.__wbindgen_cast_4625c577ab2ec9ee = function(arg0) {
714
+ // Cast intrinsic for `U64 -> Externref`.
715
+ const ret = BigInt.asUintN(64, arg0);
716
+ return ret;
717
+ };
718
+ imports.wbg.__wbindgen_cast_9ae0607507abb057 = function(arg0) {
719
+ // Cast intrinsic for `I64 -> Externref`.
720
+ const ret = arg0;
721
+ return ret;
722
+ };
723
+ imports.wbg.__wbindgen_cast_d6cd19b81560fd6e = function(arg0) {
724
+ // Cast intrinsic for `F64 -> Externref`.
725
+ const ret = arg0;
726
+ return ret;
727
+ };
728
+ imports.wbg.__wbindgen_init_externref_table = function() {
729
+ const table = wasm.__wbindgen_export_2;
730
+ const offset = table.grow(4);
731
+ table.set(0, undefined);
732
+ table.set(offset + 0, undefined);
733
+ table.set(offset + 1, null);
734
+ table.set(offset + 2, true);
735
+ table.set(offset + 3, false);
736
+ ;
737
+ };
738
+
739
+ return imports;
740
+ }
741
+
742
+ function __wbg_init_memory(imports, memory) {
743
+
744
+ }
745
+
746
+ function __wbg_finalize_init(instance, module) {
747
+ wasm = instance.exports;
748
+ __wbg_init.__wbindgen_wasm_module = module;
749
+ cachedDataViewMemory0 = null;
750
+ cachedUint8ArrayMemory0 = null;
751
+
752
+
753
+ wasm.__wbindgen_start();
754
+ return wasm;
755
+ }
756
+
757
+ function initSync(module) {
758
+ if (wasm !== undefined) return wasm;
759
+
760
+
761
+ if (typeof module !== 'undefined') {
762
+ if (Object.getPrototypeOf(module) === Object.prototype) {
763
+ ({module} = module)
764
+ } else {
765
+ console.warn('using deprecated parameters for `initSync()`; pass a single object instead')
766
+ }
767
+ }
768
+
769
+ const imports = __wbg_get_imports();
770
+
771
+ __wbg_init_memory(imports);
772
+
773
+ if (!(module instanceof WebAssembly.Module)) {
774
+ module = new WebAssembly.Module(module);
775
+ }
776
+
777
+ const instance = new WebAssembly.Instance(module, imports);
778
+
779
+ return __wbg_finalize_init(instance, module);
780
+ }
781
+
782
+ async function __wbg_init(module_or_path) {
783
+ if (wasm !== undefined) return wasm;
784
+
785
+
786
+ if (typeof module_or_path !== 'undefined') {
787
+ if (Object.getPrototypeOf(module_or_path) === Object.prototype) {
788
+ ({module_or_path} = module_or_path)
789
+ } else {
790
+ console.warn('using deprecated parameters for the initialization function; pass a single object instead')
791
+ }
792
+ }
793
+
794
+ if (typeof module_or_path === 'undefined') {
795
+ module_or_path = new URL('hypen_engine_bg.wasm', import.meta.url);
796
+ }
797
+ const imports = __wbg_get_imports();
798
+
799
+ if (typeof module_or_path === 'string' || (typeof Request === 'function' && module_or_path instanceof Request) || (typeof URL === 'function' && module_or_path instanceof URL)) {
800
+ module_or_path = fetch(module_or_path);
801
+ }
802
+
803
+ __wbg_init_memory(imports);
804
+
805
+ const { instance, module } = await __wbg_load(await module_or_path, imports);
806
+
807
+ return __wbg_finalize_init(instance, module);
808
+ }
809
+
810
+ export { initSync };
811
+ export default __wbg_init;