@ruvector/edge-full 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.
@@ -0,0 +1,1452 @@
1
+ let wasm;
2
+
3
+ function addToExternrefTable0(obj) {
4
+ const idx = wasm.__externref_table_alloc();
5
+ wasm.__wbindgen_externrefs.set(idx, obj);
6
+ return idx;
7
+ }
8
+
9
+ function debugString(val) {
10
+ // primitive types
11
+ const type = typeof val;
12
+ if (type == 'number' || type == 'boolean' || val == null) {
13
+ return `${val}`;
14
+ }
15
+ if (type == 'string') {
16
+ return `"${val}"`;
17
+ }
18
+ if (type == 'symbol') {
19
+ const description = val.description;
20
+ if (description == null) {
21
+ return 'Symbol';
22
+ } else {
23
+ return `Symbol(${description})`;
24
+ }
25
+ }
26
+ if (type == 'function') {
27
+ const name = val.name;
28
+ if (typeof name == 'string' && name.length > 0) {
29
+ return `Function(${name})`;
30
+ } else {
31
+ return 'Function';
32
+ }
33
+ }
34
+ // objects
35
+ if (Array.isArray(val)) {
36
+ const length = val.length;
37
+ let debug = '[';
38
+ if (length > 0) {
39
+ debug += debugString(val[0]);
40
+ }
41
+ for(let i = 1; i < length; i++) {
42
+ debug += ', ' + debugString(val[i]);
43
+ }
44
+ debug += ']';
45
+ return debug;
46
+ }
47
+ // Test for built-in
48
+ const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val));
49
+ let className;
50
+ if (builtInMatches && builtInMatches.length > 1) {
51
+ className = builtInMatches[1];
52
+ } else {
53
+ // Failed to match the standard '[object ClassName]'
54
+ return toString.call(val);
55
+ }
56
+ if (className == 'Object') {
57
+ // we're a user defined class or Object
58
+ // JSON.stringify avoids problems with cycles, and is generally much
59
+ // easier than looping through ownProperties of `val`.
60
+ try {
61
+ return 'Object(' + JSON.stringify(val) + ')';
62
+ } catch (_) {
63
+ return 'Object';
64
+ }
65
+ }
66
+ // errors
67
+ if (val instanceof Error) {
68
+ return `${val.name}: ${val.message}\n${val.stack}`;
69
+ }
70
+ // TODO we could test for more things here, like `Set`s and `Map`s.
71
+ return className;
72
+ }
73
+
74
+ function getArrayF32FromWasm0(ptr, len) {
75
+ ptr = ptr >>> 0;
76
+ return getFloat32ArrayMemory0().subarray(ptr / 4, ptr / 4 + len);
77
+ }
78
+
79
+ function getArrayU8FromWasm0(ptr, len) {
80
+ ptr = ptr >>> 0;
81
+ return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
82
+ }
83
+
84
+ let cachedDataViewMemory0 = null;
85
+ function getDataViewMemory0() {
86
+ if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
87
+ cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
88
+ }
89
+ return cachedDataViewMemory0;
90
+ }
91
+
92
+ let cachedFloat32ArrayMemory0 = null;
93
+ function getFloat32ArrayMemory0() {
94
+ if (cachedFloat32ArrayMemory0 === null || cachedFloat32ArrayMemory0.byteLength === 0) {
95
+ cachedFloat32ArrayMemory0 = new Float32Array(wasm.memory.buffer);
96
+ }
97
+ return cachedFloat32ArrayMemory0;
98
+ }
99
+
100
+ function getStringFromWasm0(ptr, len) {
101
+ ptr = ptr >>> 0;
102
+ return decodeText(ptr, len);
103
+ }
104
+
105
+ let cachedUint8ArrayMemory0 = null;
106
+ function getUint8ArrayMemory0() {
107
+ if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
108
+ cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
109
+ }
110
+ return cachedUint8ArrayMemory0;
111
+ }
112
+
113
+ function handleError(f, args) {
114
+ try {
115
+ return f.apply(this, args);
116
+ } catch (e) {
117
+ const idx = addToExternrefTable0(e);
118
+ wasm.__wbindgen_exn_store(idx);
119
+ }
120
+ }
121
+
122
+ function isLikeNone(x) {
123
+ return x === undefined || x === null;
124
+ }
125
+
126
+ function passArray8ToWasm0(arg, malloc) {
127
+ const ptr = malloc(arg.length * 1, 1) >>> 0;
128
+ getUint8ArrayMemory0().set(arg, ptr / 1);
129
+ WASM_VECTOR_LEN = arg.length;
130
+ return ptr;
131
+ }
132
+
133
+ function passArrayF32ToWasm0(arg, malloc) {
134
+ const ptr = malloc(arg.length * 4, 4) >>> 0;
135
+ getFloat32ArrayMemory0().set(arg, ptr / 4);
136
+ WASM_VECTOR_LEN = arg.length;
137
+ return ptr;
138
+ }
139
+
140
+ function passStringToWasm0(arg, malloc, realloc) {
141
+ if (realloc === undefined) {
142
+ const buf = cachedTextEncoder.encode(arg);
143
+ const ptr = malloc(buf.length, 1) >>> 0;
144
+ getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
145
+ WASM_VECTOR_LEN = buf.length;
146
+ return ptr;
147
+ }
148
+
149
+ let len = arg.length;
150
+ let ptr = malloc(len, 1) >>> 0;
151
+
152
+ const mem = getUint8ArrayMemory0();
153
+
154
+ let offset = 0;
155
+
156
+ for (; offset < len; offset++) {
157
+ const code = arg.charCodeAt(offset);
158
+ if (code > 0x7F) break;
159
+ mem[ptr + offset] = code;
160
+ }
161
+ if (offset !== len) {
162
+ if (offset !== 0) {
163
+ arg = arg.slice(offset);
164
+ }
165
+ ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
166
+ const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
167
+ const ret = cachedTextEncoder.encodeInto(arg, view);
168
+
169
+ offset += ret.written;
170
+ ptr = realloc(ptr, len, offset, 1) >>> 0;
171
+ }
172
+
173
+ WASM_VECTOR_LEN = offset;
174
+ return ptr;
175
+ }
176
+
177
+ function takeFromExternrefTable0(idx) {
178
+ const value = wasm.__wbindgen_externrefs.get(idx);
179
+ wasm.__externref_table_dealloc(idx);
180
+ return value;
181
+ }
182
+
183
+ let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
184
+ cachedTextDecoder.decode();
185
+ const MAX_SAFARI_DECODE_BYTES = 2146435072;
186
+ let numBytesDecoded = 0;
187
+ function decodeText(ptr, len) {
188
+ numBytesDecoded += len;
189
+ if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
190
+ cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
191
+ cachedTextDecoder.decode();
192
+ numBytesDecoded = len;
193
+ }
194
+ return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
195
+ }
196
+
197
+ const cachedTextEncoder = new TextEncoder();
198
+
199
+ if (!('encodeInto' in cachedTextEncoder)) {
200
+ cachedTextEncoder.encodeInto = function (arg, view) {
201
+ const buf = cachedTextEncoder.encode(arg);
202
+ view.set(buf);
203
+ return {
204
+ read: arg.length,
205
+ written: buf.length
206
+ };
207
+ }
208
+ }
209
+
210
+ let WASM_VECTOR_LEN = 0;
211
+
212
+ const WasmAdaptiveCompressorFinalization = (typeof FinalizationRegistry === 'undefined')
213
+ ? { register: () => {}, unregister: () => {} }
214
+ : new FinalizationRegistry(ptr => wasm.__wbg_wasmadaptivecompressor_free(ptr >>> 0, 1));
215
+
216
+ const WasmCryptoFinalization = (typeof FinalizationRegistry === 'undefined')
217
+ ? { register: () => {}, unregister: () => {} }
218
+ : new FinalizationRegistry(ptr => wasm.__wbg_wasmcrypto_free(ptr >>> 0, 1));
219
+
220
+ const WasmHnswIndexFinalization = (typeof FinalizationRegistry === 'undefined')
221
+ ? { register: () => {}, unregister: () => {} }
222
+ : new FinalizationRegistry(ptr => wasm.__wbg_wasmhnswindex_free(ptr >>> 0, 1));
223
+
224
+ const WasmHybridKeyPairFinalization = (typeof FinalizationRegistry === 'undefined')
225
+ ? { register: () => {}, unregister: () => {} }
226
+ : new FinalizationRegistry(ptr => wasm.__wbg_wasmhybridkeypair_free(ptr >>> 0, 1));
227
+
228
+ const WasmIdentityFinalization = (typeof FinalizationRegistry === 'undefined')
229
+ ? { register: () => {}, unregister: () => {} }
230
+ : new FinalizationRegistry(ptr => wasm.__wbg_wasmidentity_free(ptr >>> 0, 1));
231
+
232
+ const WasmQuantizerFinalization = (typeof FinalizationRegistry === 'undefined')
233
+ ? { register: () => {}, unregister: () => {} }
234
+ : new FinalizationRegistry(ptr => wasm.__wbg_wasmquantizer_free(ptr >>> 0, 1));
235
+
236
+ const WasmRaftNodeFinalization = (typeof FinalizationRegistry === 'undefined')
237
+ ? { register: () => {}, unregister: () => {} }
238
+ : new FinalizationRegistry(ptr => wasm.__wbg_wasmraftnode_free(ptr >>> 0, 1));
239
+
240
+ const WasmSemanticMatcherFinalization = (typeof FinalizationRegistry === 'undefined')
241
+ ? { register: () => {}, unregister: () => {} }
242
+ : new FinalizationRegistry(ptr => wasm.__wbg_wasmsemanticmatcher_free(ptr >>> 0, 1));
243
+
244
+ const WasmSpikingNetworkFinalization = (typeof FinalizationRegistry === 'undefined')
245
+ ? { register: () => {}, unregister: () => {} }
246
+ : new FinalizationRegistry(ptr => wasm.__wbg_wasmspikingnetwork_free(ptr >>> 0, 1));
247
+
248
+ /**
249
+ * WASM-compatible network-aware adaptive compression
250
+ */
251
+ export class WasmAdaptiveCompressor {
252
+ __destroy_into_raw() {
253
+ const ptr = this.__wbg_ptr;
254
+ this.__wbg_ptr = 0;
255
+ WasmAdaptiveCompressorFinalization.unregister(this);
256
+ return ptr;
257
+ }
258
+ free() {
259
+ const ptr = this.__destroy_into_raw();
260
+ wasm.__wbg_wasmadaptivecompressor_free(ptr, 0);
261
+ }
262
+ /**
263
+ * Update network metrics (bandwidth in Mbps, latency in ms)
264
+ * @param {number} bandwidth_mbps
265
+ * @param {number} latency_ms
266
+ */
267
+ updateMetrics(bandwidth_mbps, latency_ms) {
268
+ wasm.wasmadaptivecompressor_updateMetrics(this.__wbg_ptr, bandwidth_mbps, latency_ms);
269
+ }
270
+ /**
271
+ * Create new adaptive compressor
272
+ */
273
+ constructor() {
274
+ const ret = wasm.wasmadaptivecompressor_new();
275
+ this.__wbg_ptr = ret >>> 0;
276
+ WasmAdaptiveCompressorFinalization.register(this, this.__wbg_ptr, this);
277
+ return this;
278
+ }
279
+ /**
280
+ * Compress vector based on network conditions
281
+ * @param {Float32Array} data
282
+ * @returns {any}
283
+ */
284
+ compress(data) {
285
+ const ptr0 = passArrayF32ToWasm0(data, wasm.__wbindgen_malloc);
286
+ const len0 = WASM_VECTOR_LEN;
287
+ const ret = wasm.wasmadaptivecompressor_compress(this.__wbg_ptr, ptr0, len0);
288
+ return ret;
289
+ }
290
+ /**
291
+ * Get current network condition
292
+ * @returns {string}
293
+ */
294
+ condition() {
295
+ let deferred1_0;
296
+ let deferred1_1;
297
+ try {
298
+ const ret = wasm.wasmadaptivecompressor_condition(this.__wbg_ptr);
299
+ deferred1_0 = ret[0];
300
+ deferred1_1 = ret[1];
301
+ return getStringFromWasm0(ret[0], ret[1]);
302
+ } finally {
303
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
304
+ }
305
+ }
306
+ }
307
+ if (Symbol.dispose) WasmAdaptiveCompressor.prototype[Symbol.dispose] = WasmAdaptiveCompressor.prototype.free;
308
+
309
+ /**
310
+ * WASM-compatible cryptographic utilities
311
+ */
312
+ export class WasmCrypto {
313
+ __destroy_into_raw() {
314
+ const ptr = this.__wbg_ptr;
315
+ this.__wbg_ptr = 0;
316
+ WasmCryptoFinalization.unregister(this);
317
+ return ptr;
318
+ }
319
+ free() {
320
+ const ptr = this.__destroy_into_raw();
321
+ wasm.__wbg_wasmcrypto_free(ptr, 0);
322
+ }
323
+ /**
324
+ * Generate a local CID for data
325
+ * @param {Uint8Array} data
326
+ * @returns {string}
327
+ */
328
+ static generateCid(data) {
329
+ let deferred2_0;
330
+ let deferred2_1;
331
+ try {
332
+ const ptr0 = passArray8ToWasm0(data, wasm.__wbindgen_malloc);
333
+ const len0 = WASM_VECTOR_LEN;
334
+ const ret = wasm.wasmcrypto_generateCid(ptr0, len0);
335
+ deferred2_0 = ret[0];
336
+ deferred2_1 = ret[1];
337
+ return getStringFromWasm0(ret[0], ret[1]);
338
+ } finally {
339
+ wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
340
+ }
341
+ }
342
+ /**
343
+ * SHA-256 hash of string as hex
344
+ * @param {string} text
345
+ * @returns {string}
346
+ */
347
+ static sha256String(text) {
348
+ let deferred2_0;
349
+ let deferred2_1;
350
+ try {
351
+ const ptr0 = passStringToWasm0(text, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
352
+ const len0 = WASM_VECTOR_LEN;
353
+ const ret = wasm.wasmcrypto_sha256String(ptr0, len0);
354
+ deferred2_0 = ret[0];
355
+ deferred2_1 = ret[1];
356
+ return getStringFromWasm0(ret[0], ret[1]);
357
+ } finally {
358
+ wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
359
+ }
360
+ }
361
+ /**
362
+ * SHA-256 hash as hex string
363
+ * @param {Uint8Array} data
364
+ * @returns {string}
365
+ */
366
+ static sha256(data) {
367
+ let deferred2_0;
368
+ let deferred2_1;
369
+ try {
370
+ const ptr0 = passArray8ToWasm0(data, wasm.__wbindgen_malloc);
371
+ const len0 = WASM_VECTOR_LEN;
372
+ const ret = wasm.wasmcrypto_sha256(ptr0, len0);
373
+ deferred2_0 = ret[0];
374
+ deferred2_1 = ret[1];
375
+ return getStringFromWasm0(ret[0], ret[1]);
376
+ } finally {
377
+ wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
378
+ }
379
+ }
380
+ /**
381
+ * Decrypt data with AES-256-GCM
382
+ * @param {any} encrypted
383
+ * @param {string} key_hex
384
+ * @returns {Uint8Array}
385
+ */
386
+ static decrypt(encrypted, key_hex) {
387
+ const ptr0 = passStringToWasm0(key_hex, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
388
+ const len0 = WASM_VECTOR_LEN;
389
+ const ret = wasm.wasmcrypto_decrypt(encrypted, ptr0, len0);
390
+ if (ret[3]) {
391
+ throw takeFromExternrefTable0(ret[2]);
392
+ }
393
+ var v2 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
394
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
395
+ return v2;
396
+ }
397
+ /**
398
+ * Encrypt data with AES-256-GCM (key as hex)
399
+ * @param {Uint8Array} data
400
+ * @param {string} key_hex
401
+ * @returns {any}
402
+ */
403
+ static encrypt(data, key_hex) {
404
+ const ptr0 = passArray8ToWasm0(data, wasm.__wbindgen_malloc);
405
+ const len0 = WASM_VECTOR_LEN;
406
+ const ptr1 = passStringToWasm0(key_hex, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
407
+ const len1 = WASM_VECTOR_LEN;
408
+ const ret = wasm.wasmcrypto_encrypt(ptr0, len0, ptr1, len1);
409
+ if (ret[2]) {
410
+ throw takeFromExternrefTable0(ret[1]);
411
+ }
412
+ return takeFromExternrefTable0(ret[0]);
413
+ }
414
+ }
415
+ if (Symbol.dispose) WasmCrypto.prototype[Symbol.dispose] = WasmCrypto.prototype.free;
416
+
417
+ /**
418
+ * WASM-compatible HNSW index for fast vector similarity search
419
+ */
420
+ export class WasmHnswIndex {
421
+ static __wrap(ptr) {
422
+ ptr = ptr >>> 0;
423
+ const obj = Object.create(WasmHnswIndex.prototype);
424
+ obj.__wbg_ptr = ptr;
425
+ WasmHnswIndexFinalization.register(obj, obj.__wbg_ptr, obj);
426
+ return obj;
427
+ }
428
+ __destroy_into_raw() {
429
+ const ptr = this.__wbg_ptr;
430
+ this.__wbg_ptr = 0;
431
+ WasmHnswIndexFinalization.unregister(this);
432
+ return ptr;
433
+ }
434
+ free() {
435
+ const ptr = this.__destroy_into_raw();
436
+ wasm.__wbg_wasmhnswindex_free(ptr, 0);
437
+ }
438
+ /**
439
+ * Create with custom parameters (m = connections per node, ef = search width)
440
+ * @param {number} m
441
+ * @param {number} ef_construction
442
+ * @returns {WasmHnswIndex}
443
+ */
444
+ static withParams(m, ef_construction) {
445
+ const ret = wasm.wasmhnswindex_withParams(m, ef_construction);
446
+ return WasmHnswIndex.__wrap(ret);
447
+ }
448
+ /**
449
+ * Get number of vectors in index
450
+ * @returns {number}
451
+ */
452
+ len() {
453
+ const ret = wasm.wasmhnswindex_len(this.__wbg_ptr);
454
+ return ret >>> 0;
455
+ }
456
+ /**
457
+ * Create new HNSW index with default parameters
458
+ */
459
+ constructor() {
460
+ const ret = wasm.wasmhnswindex_new();
461
+ this.__wbg_ptr = ret >>> 0;
462
+ WasmHnswIndexFinalization.register(this, this.__wbg_ptr, this);
463
+ return this;
464
+ }
465
+ /**
466
+ * Insert a vector with an ID
467
+ * @param {string} id
468
+ * @param {Float32Array} vector
469
+ */
470
+ insert(id, vector) {
471
+ const ptr0 = passStringToWasm0(id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
472
+ const len0 = WASM_VECTOR_LEN;
473
+ const ptr1 = passArrayF32ToWasm0(vector, wasm.__wbindgen_malloc);
474
+ const len1 = WASM_VECTOR_LEN;
475
+ wasm.wasmhnswindex_insert(this.__wbg_ptr, ptr0, len0, ptr1, len1);
476
+ }
477
+ /**
478
+ * Search for k nearest neighbors, returns JSON array of {id, distance}
479
+ * @param {Float32Array} query
480
+ * @param {number} k
481
+ * @returns {any}
482
+ */
483
+ search(query, k) {
484
+ const ptr0 = passArrayF32ToWasm0(query, wasm.__wbindgen_malloc);
485
+ const len0 = WASM_VECTOR_LEN;
486
+ const ret = wasm.wasmhnswindex_search(this.__wbg_ptr, ptr0, len0, k);
487
+ return ret;
488
+ }
489
+ /**
490
+ * Check if index is empty
491
+ * @returns {boolean}
492
+ */
493
+ isEmpty() {
494
+ const ret = wasm.wasmhnswindex_isEmpty(this.__wbg_ptr);
495
+ return ret !== 0;
496
+ }
497
+ }
498
+ if (Symbol.dispose) WasmHnswIndex.prototype[Symbol.dispose] = WasmHnswIndex.prototype.free;
499
+
500
+ /**
501
+ * WASM-compatible hybrid post-quantum signatures (Ed25519 + Dilithium-style)
502
+ */
503
+ export class WasmHybridKeyPair {
504
+ __destroy_into_raw() {
505
+ const ptr = this.__wbg_ptr;
506
+ this.__wbg_ptr = 0;
507
+ WasmHybridKeyPairFinalization.unregister(this);
508
+ return ptr;
509
+ }
510
+ free() {
511
+ const ptr = this.__destroy_into_raw();
512
+ wasm.__wbg_wasmhybridkeypair_free(ptr, 0);
513
+ }
514
+ /**
515
+ * Get public key bytes as hex
516
+ * @returns {string}
517
+ */
518
+ publicKeyHex() {
519
+ let deferred1_0;
520
+ let deferred1_1;
521
+ try {
522
+ const ret = wasm.wasmhybridkeypair_publicKeyHex(this.__wbg_ptr);
523
+ deferred1_0 = ret[0];
524
+ deferred1_1 = ret[1];
525
+ return getStringFromWasm0(ret[0], ret[1]);
526
+ } finally {
527
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
528
+ }
529
+ }
530
+ /**
531
+ * Generate new hybrid keypair
532
+ */
533
+ constructor() {
534
+ const ret = wasm.wasmhybridkeypair_new();
535
+ this.__wbg_ptr = ret >>> 0;
536
+ WasmHybridKeyPairFinalization.register(this, this.__wbg_ptr, this);
537
+ return this;
538
+ }
539
+ /**
540
+ * Sign message with hybrid signature
541
+ * @param {Uint8Array} message
542
+ * @returns {string}
543
+ */
544
+ sign(message) {
545
+ let deferred2_0;
546
+ let deferred2_1;
547
+ try {
548
+ const ptr0 = passArray8ToWasm0(message, wasm.__wbindgen_malloc);
549
+ const len0 = WASM_VECTOR_LEN;
550
+ const ret = wasm.wasmhybridkeypair_sign(this.__wbg_ptr, ptr0, len0);
551
+ deferred2_0 = ret[0];
552
+ deferred2_1 = ret[1];
553
+ return getStringFromWasm0(ret[0], ret[1]);
554
+ } finally {
555
+ wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
556
+ }
557
+ }
558
+ /**
559
+ * Verify hybrid signature (pubkey and signature both as JSON)
560
+ * @param {string} public_key_json
561
+ * @param {Uint8Array} message
562
+ * @param {string} signature_json
563
+ * @returns {boolean}
564
+ */
565
+ static verify(public_key_json, message, signature_json) {
566
+ const ptr0 = passStringToWasm0(public_key_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
567
+ const len0 = WASM_VECTOR_LEN;
568
+ const ptr1 = passArray8ToWasm0(message, wasm.__wbindgen_malloc);
569
+ const len1 = WASM_VECTOR_LEN;
570
+ const ptr2 = passStringToWasm0(signature_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
571
+ const len2 = WASM_VECTOR_LEN;
572
+ const ret = wasm.wasmhybridkeypair_verify(ptr0, len0, ptr1, len1, ptr2, len2);
573
+ return ret !== 0;
574
+ }
575
+ }
576
+ if (Symbol.dispose) WasmHybridKeyPair.prototype[Symbol.dispose] = WasmHybridKeyPair.prototype.free;
577
+
578
+ /**
579
+ * WASM-compatible Identity Manager for Ed25519/X25519 cryptography
580
+ */
581
+ export class WasmIdentity {
582
+ __destroy_into_raw() {
583
+ const ptr = this.__wbg_ptr;
584
+ this.__wbg_ptr = 0;
585
+ WasmIdentityFinalization.unregister(this);
586
+ return ptr;
587
+ }
588
+ free() {
589
+ const ptr = this.__destroy_into_raw();
590
+ wasm.__wbg_wasmidentity_free(ptr, 0);
591
+ }
592
+ /**
593
+ * Sign raw bytes and return signature as hex
594
+ * @param {Uint8Array} data
595
+ * @returns {string}
596
+ */
597
+ signBytes(data) {
598
+ let deferred2_0;
599
+ let deferred2_1;
600
+ try {
601
+ const ptr0 = passArray8ToWasm0(data, wasm.__wbindgen_malloc);
602
+ const len0 = WASM_VECTOR_LEN;
603
+ const ret = wasm.wasmidentity_signBytes(this.__wbg_ptr, ptr0, len0);
604
+ deferred2_0 = ret[0];
605
+ deferred2_1 = ret[1];
606
+ return getStringFromWasm0(ret[0], ret[1]);
607
+ } finally {
608
+ wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
609
+ }
610
+ }
611
+ /**
612
+ * Generate a random nonce
613
+ * @returns {string}
614
+ */
615
+ static generateNonce() {
616
+ let deferred1_0;
617
+ let deferred1_1;
618
+ try {
619
+ const ret = wasm.wasmidentity_generateNonce();
620
+ deferred1_0 = ret[0];
621
+ deferred1_1 = ret[1];
622
+ return getStringFromWasm0(ret[0], ret[1]);
623
+ } finally {
624
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
625
+ }
626
+ }
627
+ /**
628
+ * Get Ed25519 public key as hex string
629
+ * @returns {string}
630
+ */
631
+ publicKeyHex() {
632
+ let deferred1_0;
633
+ let deferred1_1;
634
+ try {
635
+ const ret = wasm.wasmidentity_publicKeyHex(this.__wbg_ptr);
636
+ deferred1_0 = ret[0];
637
+ deferred1_1 = ret[1];
638
+ return getStringFromWasm0(ret[0], ret[1]);
639
+ } finally {
640
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
641
+ }
642
+ }
643
+ /**
644
+ * Create a signed registration for this identity
645
+ * @param {string} agent_id
646
+ * @param {any} capabilities
647
+ * @returns {any}
648
+ */
649
+ createRegistration(agent_id, capabilities) {
650
+ const ptr0 = passStringToWasm0(agent_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
651
+ const len0 = WASM_VECTOR_LEN;
652
+ const ret = wasm.wasmidentity_createRegistration(this.__wbg_ptr, ptr0, len0, capabilities);
653
+ if (ret[2]) {
654
+ throw takeFromExternrefTable0(ret[1]);
655
+ }
656
+ return takeFromExternrefTable0(ret[0]);
657
+ }
658
+ /**
659
+ * Get X25519 public key as hex string (for key exchange)
660
+ * @returns {string}
661
+ */
662
+ x25519PublicKeyHex() {
663
+ let deferred1_0;
664
+ let deferred1_1;
665
+ try {
666
+ const ret = wasm.wasmidentity_x25519PublicKeyHex(this.__wbg_ptr);
667
+ deferred1_0 = ret[0];
668
+ deferred1_1 = ret[1];
669
+ return getStringFromWasm0(ret[0], ret[1]);
670
+ } finally {
671
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
672
+ }
673
+ }
674
+ /**
675
+ * Create a new identity with generated keys
676
+ */
677
+ constructor() {
678
+ const ret = wasm.wasmidentity_new();
679
+ this.__wbg_ptr = ret >>> 0;
680
+ WasmIdentityFinalization.register(this, this.__wbg_ptr, this);
681
+ return this;
682
+ }
683
+ /**
684
+ * Sign a message and return signature as hex
685
+ * @param {string} message
686
+ * @returns {string}
687
+ */
688
+ sign(message) {
689
+ let deferred2_0;
690
+ let deferred2_1;
691
+ try {
692
+ const ptr0 = passStringToWasm0(message, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
693
+ const len0 = WASM_VECTOR_LEN;
694
+ const ret = wasm.wasmidentity_sign(this.__wbg_ptr, ptr0, len0);
695
+ deferred2_0 = ret[0];
696
+ deferred2_1 = ret[1];
697
+ return getStringFromWasm0(ret[0], ret[1]);
698
+ } finally {
699
+ wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
700
+ }
701
+ }
702
+ /**
703
+ * Verify a signature (static method)
704
+ * @param {string} public_key_hex
705
+ * @param {string} message
706
+ * @param {string} signature_hex
707
+ * @returns {boolean}
708
+ */
709
+ static verify(public_key_hex, message, signature_hex) {
710
+ const ptr0 = passStringToWasm0(public_key_hex, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
711
+ const len0 = WASM_VECTOR_LEN;
712
+ const ptr1 = passStringToWasm0(message, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
713
+ const len1 = WASM_VECTOR_LEN;
714
+ const ptr2 = passStringToWasm0(signature_hex, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
715
+ const len2 = WASM_VECTOR_LEN;
716
+ const ret = wasm.wasmidentity_verify(ptr0, len0, ptr1, len1, ptr2, len2);
717
+ return ret !== 0;
718
+ }
719
+ }
720
+ if (Symbol.dispose) WasmIdentity.prototype[Symbol.dispose] = WasmIdentity.prototype.free;
721
+
722
+ /**
723
+ * WASM-compatible vector quantization utilities
724
+ */
725
+ export class WasmQuantizer {
726
+ __destroy_into_raw() {
727
+ const ptr = this.__wbg_ptr;
728
+ this.__wbg_ptr = 0;
729
+ WasmQuantizerFinalization.unregister(this);
730
+ return ptr;
731
+ }
732
+ free() {
733
+ const ptr = this.__destroy_into_raw();
734
+ wasm.__wbg_wasmquantizer_free(ptr, 0);
735
+ }
736
+ /**
737
+ * Binary quantize a vector (32x compression)
738
+ * @param {Float32Array} vector
739
+ * @returns {Uint8Array}
740
+ */
741
+ static binaryQuantize(vector) {
742
+ const ptr0 = passArrayF32ToWasm0(vector, wasm.__wbindgen_malloc);
743
+ const len0 = WASM_VECTOR_LEN;
744
+ const ret = wasm.wasmquantizer_binaryQuantize(ptr0, len0);
745
+ var v2 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
746
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
747
+ return v2;
748
+ }
749
+ /**
750
+ * Scalar quantize a vector (4x compression)
751
+ * @param {Float32Array} vector
752
+ * @returns {any}
753
+ */
754
+ static scalarQuantize(vector) {
755
+ const ptr0 = passArrayF32ToWasm0(vector, wasm.__wbindgen_malloc);
756
+ const len0 = WASM_VECTOR_LEN;
757
+ const ret = wasm.wasmquantizer_scalarQuantize(ptr0, len0);
758
+ return ret;
759
+ }
760
+ /**
761
+ * Compute hamming distance between binary quantized vectors
762
+ * @param {Uint8Array} a
763
+ * @param {Uint8Array} b
764
+ * @returns {number}
765
+ */
766
+ static hammingDistance(a, b) {
767
+ const ptr0 = passArray8ToWasm0(a, wasm.__wbindgen_malloc);
768
+ const len0 = WASM_VECTOR_LEN;
769
+ const ptr1 = passArray8ToWasm0(b, wasm.__wbindgen_malloc);
770
+ const len1 = WASM_VECTOR_LEN;
771
+ const ret = wasm.wasmquantizer_hammingDistance(ptr0, len0, ptr1, len1);
772
+ return ret >>> 0;
773
+ }
774
+ /**
775
+ * Reconstruct from scalar quantized
776
+ * @param {any} quantized
777
+ * @returns {Float32Array}
778
+ */
779
+ static scalarDequantize(quantized) {
780
+ const ret = wasm.wasmquantizer_scalarDequantize(quantized);
781
+ if (ret[3]) {
782
+ throw takeFromExternrefTable0(ret[2]);
783
+ }
784
+ var v1 = getArrayF32FromWasm0(ret[0], ret[1]).slice();
785
+ wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
786
+ return v1;
787
+ }
788
+ }
789
+ if (Symbol.dispose) WasmQuantizer.prototype[Symbol.dispose] = WasmQuantizer.prototype.free;
790
+
791
+ /**
792
+ * WASM-compatible Raft consensus node
793
+ */
794
+ export class WasmRaftNode {
795
+ __destroy_into_raw() {
796
+ const ptr = this.__wbg_ptr;
797
+ this.__wbg_ptr = 0;
798
+ WasmRaftNodeFinalization.unregister(this);
799
+ return ptr;
800
+ }
801
+ free() {
802
+ const ptr = this.__destroy_into_raw();
803
+ wasm.__wbg_wasmraftnode_free(ptr, 0);
804
+ }
805
+ /**
806
+ * Append entry to log (leader only), returns log index or null
807
+ * @param {Uint8Array} data
808
+ * @returns {any}
809
+ */
810
+ appendEntry(data) {
811
+ const ptr0 = passArray8ToWasm0(data, wasm.__wbindgen_malloc);
812
+ const len0 = WASM_VECTOR_LEN;
813
+ const ret = wasm.wasmraftnode_appendEntry(this.__wbg_ptr, ptr0, len0);
814
+ return ret;
815
+ }
816
+ /**
817
+ * Get log length
818
+ * @returns {number}
819
+ */
820
+ getLogLength() {
821
+ const ret = wasm.wasmraftnode_getLogLength(this.__wbg_ptr);
822
+ return ret >>> 0;
823
+ }
824
+ /**
825
+ * Start an election (returns vote request as JSON)
826
+ * @returns {any}
827
+ */
828
+ startElection() {
829
+ const ret = wasm.wasmraftnode_startElection(this.__wbg_ptr);
830
+ return ret;
831
+ }
832
+ /**
833
+ * Get commit index
834
+ * @returns {bigint}
835
+ */
836
+ getCommitIndex() {
837
+ const ret = wasm.wasmraftnode_getCommitIndex(this.__wbg_ptr);
838
+ return BigInt.asUintN(64, ret);
839
+ }
840
+ /**
841
+ * Handle a vote request (returns vote response as JSON)
842
+ * @param {any} request
843
+ * @returns {any}
844
+ */
845
+ handleVoteRequest(request) {
846
+ const ret = wasm.wasmraftnode_handleVoteRequest(this.__wbg_ptr, request);
847
+ if (ret[2]) {
848
+ throw takeFromExternrefTable0(ret[1]);
849
+ }
850
+ return takeFromExternrefTable0(ret[0]);
851
+ }
852
+ /**
853
+ * Handle a vote response (returns true if we became leader)
854
+ * @param {any} response
855
+ * @returns {boolean}
856
+ */
857
+ handleVoteResponse(response) {
858
+ const ret = wasm.wasmraftnode_handleVoteResponse(this.__wbg_ptr, response);
859
+ if (ret[2]) {
860
+ throw takeFromExternrefTable0(ret[1]);
861
+ }
862
+ return ret[0] !== 0;
863
+ }
864
+ /**
865
+ * Create new Raft node with cluster members
866
+ * @param {string} node_id
867
+ * @param {any} members
868
+ */
869
+ constructor(node_id, members) {
870
+ const ptr0 = passStringToWasm0(node_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
871
+ const len0 = WASM_VECTOR_LEN;
872
+ const ret = wasm.wasmraftnode_new(ptr0, len0, members);
873
+ if (ret[2]) {
874
+ throw takeFromExternrefTable0(ret[1]);
875
+ }
876
+ this.__wbg_ptr = ret[0] >>> 0;
877
+ WasmRaftNodeFinalization.register(this, this.__wbg_ptr, this);
878
+ return this;
879
+ }
880
+ /**
881
+ * Get current term
882
+ * @returns {bigint}
883
+ */
884
+ term() {
885
+ const ret = wasm.wasmraftnode_term(this.__wbg_ptr);
886
+ return BigInt.asUintN(64, ret);
887
+ }
888
+ /**
889
+ * Get current state (Follower, Candidate, Leader)
890
+ * @returns {string}
891
+ */
892
+ state() {
893
+ let deferred1_0;
894
+ let deferred1_1;
895
+ try {
896
+ const ret = wasm.wasmraftnode_state(this.__wbg_ptr);
897
+ deferred1_0 = ret[0];
898
+ deferred1_1 = ret[1];
899
+ return getStringFromWasm0(ret[0], ret[1]);
900
+ } finally {
901
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
902
+ }
903
+ }
904
+ /**
905
+ * Check if this node is the leader
906
+ * @returns {boolean}
907
+ */
908
+ isLeader() {
909
+ const ret = wasm.wasmraftnode_isLeader(this.__wbg_ptr);
910
+ return ret !== 0;
911
+ }
912
+ }
913
+ if (Symbol.dispose) WasmRaftNode.prototype[Symbol.dispose] = WasmRaftNode.prototype.free;
914
+
915
+ /**
916
+ * WASM-compatible semantic task matcher for intelligent agent routing
917
+ */
918
+ export class WasmSemanticMatcher {
919
+ __destroy_into_raw() {
920
+ const ptr = this.__wbg_ptr;
921
+ this.__wbg_ptr = 0;
922
+ WasmSemanticMatcherFinalization.unregister(this);
923
+ return ptr;
924
+ }
925
+ free() {
926
+ const ptr = this.__destroy_into_raw();
927
+ wasm.__wbg_wasmsemanticmatcher_free(ptr, 0);
928
+ }
929
+ /**
930
+ * Get number of registered agents
931
+ * @returns {number}
932
+ */
933
+ agentCount() {
934
+ const ret = wasm.wasmsemanticmatcher_agentCount(this.__wbg_ptr);
935
+ return ret >>> 0;
936
+ }
937
+ /**
938
+ * Find best matching agent for a task, returns {agentId, score} or null
939
+ * @param {string} task_description
940
+ * @returns {any}
941
+ */
942
+ matchAgent(task_description) {
943
+ const ptr0 = passStringToWasm0(task_description, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
944
+ const len0 = WASM_VECTOR_LEN;
945
+ const ret = wasm.wasmsemanticmatcher_matchAgent(this.__wbg_ptr, ptr0, len0);
946
+ return ret;
947
+ }
948
+ /**
949
+ * Register an agent with capability description
950
+ * @param {string} agent_id
951
+ * @param {string} capabilities
952
+ */
953
+ registerAgent(agent_id, capabilities) {
954
+ const ptr0 = passStringToWasm0(agent_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
955
+ const len0 = WASM_VECTOR_LEN;
956
+ const ptr1 = passStringToWasm0(capabilities, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
957
+ const len1 = WASM_VECTOR_LEN;
958
+ wasm.wasmsemanticmatcher_registerAgent(this.__wbg_ptr, ptr0, len0, ptr1, len1);
959
+ }
960
+ /**
961
+ * Create new semantic matcher
962
+ */
963
+ constructor() {
964
+ const ret = wasm.wasmsemanticmatcher_new();
965
+ this.__wbg_ptr = ret >>> 0;
966
+ WasmSemanticMatcherFinalization.register(this, this.__wbg_ptr, this);
967
+ return this;
968
+ }
969
+ }
970
+ if (Symbol.dispose) WasmSemanticMatcher.prototype[Symbol.dispose] = WasmSemanticMatcher.prototype.free;
971
+
972
+ /**
973
+ * WASM-compatible spiking neural network for temporal pattern recognition
974
+ */
975
+ export class WasmSpikingNetwork {
976
+ __destroy_into_raw() {
977
+ const ptr = this.__wbg_ptr;
978
+ this.__wbg_ptr = 0;
979
+ WasmSpikingNetworkFinalization.unregister(this);
980
+ return ptr;
981
+ }
982
+ free() {
983
+ const ptr = this.__destroy_into_raw();
984
+ wasm.__wbg_wasmspikingnetwork_free(ptr, 0);
985
+ }
986
+ /**
987
+ * Apply STDP learning rule
988
+ * @param {Uint8Array} pre
989
+ * @param {Uint8Array} post
990
+ * @param {number} learning_rate
991
+ */
992
+ stdpUpdate(pre, post, learning_rate) {
993
+ const ptr0 = passArray8ToWasm0(pre, wasm.__wbindgen_malloc);
994
+ const len0 = WASM_VECTOR_LEN;
995
+ const ptr1 = passArray8ToWasm0(post, wasm.__wbindgen_malloc);
996
+ const len1 = WASM_VECTOR_LEN;
997
+ wasm.wasmspikingnetwork_stdpUpdate(this.__wbg_ptr, ptr0, len0, ptr1, len1, learning_rate);
998
+ }
999
+ /**
1000
+ * Create new spiking network
1001
+ * @param {number} input_size
1002
+ * @param {number} hidden_size
1003
+ * @param {number} output_size
1004
+ */
1005
+ constructor(input_size, hidden_size, output_size) {
1006
+ const ret = wasm.wasmspikingnetwork_new(input_size, hidden_size, output_size);
1007
+ this.__wbg_ptr = ret >>> 0;
1008
+ WasmSpikingNetworkFinalization.register(this, this.__wbg_ptr, this);
1009
+ return this;
1010
+ }
1011
+ /**
1012
+ * Reset network state
1013
+ */
1014
+ reset() {
1015
+ wasm.wasmspikingnetwork_reset(this.__wbg_ptr);
1016
+ }
1017
+ /**
1018
+ * Process input spikes and return output spikes
1019
+ * @param {Uint8Array} inputs
1020
+ * @returns {Uint8Array}
1021
+ */
1022
+ forward(inputs) {
1023
+ const ptr0 = passArray8ToWasm0(inputs, wasm.__wbindgen_malloc);
1024
+ const len0 = WASM_VECTOR_LEN;
1025
+ const ret = wasm.wasmspikingnetwork_forward(this.__wbg_ptr, ptr0, len0);
1026
+ var v2 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
1027
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
1028
+ return v2;
1029
+ }
1030
+ }
1031
+ if (Symbol.dispose) WasmSpikingNetwork.prototype[Symbol.dispose] = WasmSpikingNetwork.prototype.free;
1032
+
1033
+ /**
1034
+ * Initialize the WASM module (call once on load)
1035
+ */
1036
+ export function init() {
1037
+ wasm.init();
1038
+ }
1039
+
1040
+ /**
1041
+ * Get library version
1042
+ * @returns {string}
1043
+ */
1044
+ export function version() {
1045
+ let deferred1_0;
1046
+ let deferred1_1;
1047
+ try {
1048
+ const ret = wasm.version();
1049
+ deferred1_0 = ret[0];
1050
+ deferred1_1 = ret[1];
1051
+ return getStringFromWasm0(ret[0], ret[1]);
1052
+ } finally {
1053
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
1054
+ }
1055
+ }
1056
+
1057
+ const EXPECTED_RESPONSE_TYPES = new Set(['basic', 'cors', 'default']);
1058
+
1059
+ async function __wbg_load(module, imports) {
1060
+ if (typeof Response === 'function' && module instanceof Response) {
1061
+ if (typeof WebAssembly.instantiateStreaming === 'function') {
1062
+ try {
1063
+ return await WebAssembly.instantiateStreaming(module, imports);
1064
+ } catch (e) {
1065
+ const validResponse = module.ok && EXPECTED_RESPONSE_TYPES.has(module.type);
1066
+
1067
+ if (validResponse && module.headers.get('Content-Type') !== 'application/wasm') {
1068
+ 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);
1069
+
1070
+ } else {
1071
+ throw e;
1072
+ }
1073
+ }
1074
+ }
1075
+
1076
+ const bytes = await module.arrayBuffer();
1077
+ return await WebAssembly.instantiate(bytes, imports);
1078
+ } else {
1079
+ const instance = await WebAssembly.instantiate(module, imports);
1080
+
1081
+ if (instance instanceof WebAssembly.Instance) {
1082
+ return { instance, module };
1083
+ } else {
1084
+ return instance;
1085
+ }
1086
+ }
1087
+ }
1088
+
1089
+ function __wbg_get_imports() {
1090
+ const imports = {};
1091
+ imports.wbg = {};
1092
+ imports.wbg.__wbg_Error_52673b7de5a0ca89 = function(arg0, arg1) {
1093
+ const ret = Error(getStringFromWasm0(arg0, arg1));
1094
+ return ret;
1095
+ };
1096
+ imports.wbg.__wbg_Number_2d1dcfcf4ec51736 = function(arg0) {
1097
+ const ret = Number(arg0);
1098
+ return ret;
1099
+ };
1100
+ imports.wbg.__wbg_String_8f0eb39a4a4c2f66 = function(arg0, arg1) {
1101
+ const ret = String(arg1);
1102
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1103
+ const len1 = WASM_VECTOR_LEN;
1104
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
1105
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
1106
+ };
1107
+ imports.wbg.__wbg___wbindgen_bigint_get_as_i64_6e32f5e6aff02e1d = function(arg0, arg1) {
1108
+ const v = arg1;
1109
+ const ret = typeof(v) === 'bigint' ? v : undefined;
1110
+ getDataViewMemory0().setBigInt64(arg0 + 8 * 1, isLikeNone(ret) ? BigInt(0) : ret, true);
1111
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
1112
+ };
1113
+ imports.wbg.__wbg___wbindgen_boolean_get_dea25b33882b895b = function(arg0) {
1114
+ const v = arg0;
1115
+ const ret = typeof(v) === 'boolean' ? v : undefined;
1116
+ return isLikeNone(ret) ? 0xFFFFFF : ret ? 1 : 0;
1117
+ };
1118
+ imports.wbg.__wbg___wbindgen_debug_string_adfb662ae34724b6 = function(arg0, arg1) {
1119
+ const ret = debugString(arg1);
1120
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1121
+ const len1 = WASM_VECTOR_LEN;
1122
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
1123
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
1124
+ };
1125
+ imports.wbg.__wbg___wbindgen_in_0d3e1e8f0c669317 = function(arg0, arg1) {
1126
+ const ret = arg0 in arg1;
1127
+ return ret;
1128
+ };
1129
+ imports.wbg.__wbg___wbindgen_is_bigint_0e1a2e3f55cfae27 = function(arg0) {
1130
+ const ret = typeof(arg0) === 'bigint';
1131
+ return ret;
1132
+ };
1133
+ imports.wbg.__wbg___wbindgen_is_function_8d400b8b1af978cd = function(arg0) {
1134
+ const ret = typeof(arg0) === 'function';
1135
+ return ret;
1136
+ };
1137
+ imports.wbg.__wbg___wbindgen_is_object_ce774f3490692386 = function(arg0) {
1138
+ const val = arg0;
1139
+ const ret = typeof(val) === 'object' && val !== null;
1140
+ return ret;
1141
+ };
1142
+ imports.wbg.__wbg___wbindgen_is_string_704ef9c8fc131030 = function(arg0) {
1143
+ const ret = typeof(arg0) === 'string';
1144
+ return ret;
1145
+ };
1146
+ imports.wbg.__wbg___wbindgen_is_undefined_f6b95eab589e0269 = function(arg0) {
1147
+ const ret = arg0 === undefined;
1148
+ return ret;
1149
+ };
1150
+ imports.wbg.__wbg___wbindgen_jsval_eq_b6101cc9cef1fe36 = function(arg0, arg1) {
1151
+ const ret = arg0 === arg1;
1152
+ return ret;
1153
+ };
1154
+ imports.wbg.__wbg___wbindgen_jsval_loose_eq_766057600fdd1b0d = function(arg0, arg1) {
1155
+ const ret = arg0 == arg1;
1156
+ return ret;
1157
+ };
1158
+ imports.wbg.__wbg___wbindgen_number_get_9619185a74197f95 = function(arg0, arg1) {
1159
+ const obj = arg1;
1160
+ const ret = typeof(obj) === 'number' ? obj : undefined;
1161
+ getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true);
1162
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
1163
+ };
1164
+ imports.wbg.__wbg___wbindgen_string_get_a2a31e16edf96e42 = function(arg0, arg1) {
1165
+ const obj = arg1;
1166
+ const ret = typeof(obj) === 'string' ? obj : undefined;
1167
+ var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1168
+ var len1 = WASM_VECTOR_LEN;
1169
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
1170
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
1171
+ };
1172
+ imports.wbg.__wbg___wbindgen_throw_dd24417ed36fc46e = function(arg0, arg1) {
1173
+ throw new Error(getStringFromWasm0(arg0, arg1));
1174
+ };
1175
+ imports.wbg.__wbg_call_3020136f7a2d6e44 = function() { return handleError(function (arg0, arg1, arg2) {
1176
+ const ret = arg0.call(arg1, arg2);
1177
+ return ret;
1178
+ }, arguments) };
1179
+ imports.wbg.__wbg_call_abb4ff46ce38be40 = function() { return handleError(function (arg0, arg1) {
1180
+ const ret = arg0.call(arg1);
1181
+ return ret;
1182
+ }, arguments) };
1183
+ imports.wbg.__wbg_crypto_574e78ad8b13b65f = function(arg0) {
1184
+ const ret = arg0.crypto;
1185
+ return ret;
1186
+ };
1187
+ imports.wbg.__wbg_done_62ea16af4ce34b24 = function(arg0) {
1188
+ const ret = arg0.done;
1189
+ return ret;
1190
+ };
1191
+ imports.wbg.__wbg_error_7534b8e9a36f1ab4 = function(arg0, arg1) {
1192
+ let deferred0_0;
1193
+ let deferred0_1;
1194
+ try {
1195
+ deferred0_0 = arg0;
1196
+ deferred0_1 = arg1;
1197
+ console.error(getStringFromWasm0(arg0, arg1));
1198
+ } finally {
1199
+ wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
1200
+ }
1201
+ };
1202
+ imports.wbg.__wbg_getRandomValues_b8f5dbd5f3995a9e = function() { return handleError(function (arg0, arg1) {
1203
+ arg0.getRandomValues(arg1);
1204
+ }, arguments) };
1205
+ imports.wbg.__wbg_getTime_ad1e9878a735af08 = function(arg0) {
1206
+ const ret = arg0.getTime();
1207
+ return ret;
1208
+ };
1209
+ imports.wbg.__wbg_get_6b7bd52aca3f9671 = function(arg0, arg1) {
1210
+ const ret = arg0[arg1 >>> 0];
1211
+ return ret;
1212
+ };
1213
+ imports.wbg.__wbg_get_af9dab7e9603ea93 = function() { return handleError(function (arg0, arg1) {
1214
+ const ret = Reflect.get(arg0, arg1);
1215
+ return ret;
1216
+ }, arguments) };
1217
+ imports.wbg.__wbg_get_with_ref_key_1dc361bd10053bfe = function(arg0, arg1) {
1218
+ const ret = arg0[arg1];
1219
+ return ret;
1220
+ };
1221
+ imports.wbg.__wbg_instanceof_ArrayBuffer_f3320d2419cd0355 = function(arg0) {
1222
+ let result;
1223
+ try {
1224
+ result = arg0 instanceof ArrayBuffer;
1225
+ } catch (_) {
1226
+ result = false;
1227
+ }
1228
+ const ret = result;
1229
+ return ret;
1230
+ };
1231
+ imports.wbg.__wbg_instanceof_Uint8Array_da54ccc9d3e09434 = function(arg0) {
1232
+ let result;
1233
+ try {
1234
+ result = arg0 instanceof Uint8Array;
1235
+ } catch (_) {
1236
+ result = false;
1237
+ }
1238
+ const ret = result;
1239
+ return ret;
1240
+ };
1241
+ imports.wbg.__wbg_isArray_51fd9e6422c0a395 = function(arg0) {
1242
+ const ret = Array.isArray(arg0);
1243
+ return ret;
1244
+ };
1245
+ imports.wbg.__wbg_isSafeInteger_ae7d3f054d55fa16 = function(arg0) {
1246
+ const ret = Number.isSafeInteger(arg0);
1247
+ return ret;
1248
+ };
1249
+ imports.wbg.__wbg_iterator_27b7c8b35ab3e86b = function() {
1250
+ const ret = Symbol.iterator;
1251
+ return ret;
1252
+ };
1253
+ imports.wbg.__wbg_length_22ac23eaec9d8053 = function(arg0) {
1254
+ const ret = arg0.length;
1255
+ return ret;
1256
+ };
1257
+ imports.wbg.__wbg_length_d45040a40c570362 = function(arg0) {
1258
+ const ret = arg0.length;
1259
+ return ret;
1260
+ };
1261
+ imports.wbg.__wbg_msCrypto_a61aeb35a24c1329 = function(arg0) {
1262
+ const ret = arg0.msCrypto;
1263
+ return ret;
1264
+ };
1265
+ imports.wbg.__wbg_new_0_23cedd11d9b40c9d = function() {
1266
+ const ret = new Date();
1267
+ return ret;
1268
+ };
1269
+ imports.wbg.__wbg_new_1ba21ce319a06297 = function() {
1270
+ const ret = new Object();
1271
+ return ret;
1272
+ };
1273
+ imports.wbg.__wbg_new_25f239778d6112b9 = function() {
1274
+ const ret = new Array();
1275
+ return ret;
1276
+ };
1277
+ imports.wbg.__wbg_new_6421f6084cc5bc5a = function(arg0) {
1278
+ const ret = new Uint8Array(arg0);
1279
+ return ret;
1280
+ };
1281
+ imports.wbg.__wbg_new_8a6f238a6ece86ea = function() {
1282
+ const ret = new Error();
1283
+ return ret;
1284
+ };
1285
+ imports.wbg.__wbg_new_no_args_cb138f77cf6151ee = function(arg0, arg1) {
1286
+ const ret = new Function(getStringFromWasm0(arg0, arg1));
1287
+ return ret;
1288
+ };
1289
+ imports.wbg.__wbg_new_with_length_aa5eaf41d35235e5 = function(arg0) {
1290
+ const ret = new Uint8Array(arg0 >>> 0);
1291
+ return ret;
1292
+ };
1293
+ imports.wbg.__wbg_next_138a17bbf04e926c = function(arg0) {
1294
+ const ret = arg0.next;
1295
+ return ret;
1296
+ };
1297
+ imports.wbg.__wbg_next_3cfe5c0fe2a4cc53 = function() { return handleError(function (arg0) {
1298
+ const ret = arg0.next();
1299
+ return ret;
1300
+ }, arguments) };
1301
+ imports.wbg.__wbg_node_905d3e251edff8a2 = function(arg0) {
1302
+ const ret = arg0.node;
1303
+ return ret;
1304
+ };
1305
+ imports.wbg.__wbg_process_dc0fbacc7c1c06f7 = function(arg0) {
1306
+ const ret = arg0.process;
1307
+ return ret;
1308
+ };
1309
+ imports.wbg.__wbg_prototypesetcall_dfe9b766cdc1f1fd = function(arg0, arg1, arg2) {
1310
+ Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), arg2);
1311
+ };
1312
+ imports.wbg.__wbg_randomFillSync_ac0988aba3254290 = function() { return handleError(function (arg0, arg1) {
1313
+ arg0.randomFillSync(arg1);
1314
+ }, arguments) };
1315
+ imports.wbg.__wbg_require_60cc747a6bc5215a = function() { return handleError(function () {
1316
+ const ret = module.require;
1317
+ return ret;
1318
+ }, arguments) };
1319
+ imports.wbg.__wbg_set_3f1d0b984ed272ed = function(arg0, arg1, arg2) {
1320
+ arg0[arg1] = arg2;
1321
+ };
1322
+ imports.wbg.__wbg_set_7df433eea03a5c14 = function(arg0, arg1, arg2) {
1323
+ arg0[arg1 >>> 0] = arg2;
1324
+ };
1325
+ imports.wbg.__wbg_stack_0ed75d68575b0f3c = function(arg0, arg1) {
1326
+ const ret = arg1.stack;
1327
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1328
+ const len1 = WASM_VECTOR_LEN;
1329
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
1330
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
1331
+ };
1332
+ imports.wbg.__wbg_static_accessor_GLOBAL_769e6b65d6557335 = function() {
1333
+ const ret = typeof global === 'undefined' ? null : global;
1334
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
1335
+ };
1336
+ imports.wbg.__wbg_static_accessor_GLOBAL_THIS_60cf02db4de8e1c1 = function() {
1337
+ const ret = typeof globalThis === 'undefined' ? null : globalThis;
1338
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
1339
+ };
1340
+ imports.wbg.__wbg_static_accessor_SELF_08f5a74c69739274 = function() {
1341
+ const ret = typeof self === 'undefined' ? null : self;
1342
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
1343
+ };
1344
+ imports.wbg.__wbg_static_accessor_WINDOW_a8924b26aa92d024 = function() {
1345
+ const ret = typeof window === 'undefined' ? null : window;
1346
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
1347
+ };
1348
+ imports.wbg.__wbg_subarray_845f2f5bce7d061a = function(arg0, arg1, arg2) {
1349
+ const ret = arg0.subarray(arg1 >>> 0, arg2 >>> 0);
1350
+ return ret;
1351
+ };
1352
+ imports.wbg.__wbg_value_57b7b035e117f7ee = function(arg0) {
1353
+ const ret = arg0.value;
1354
+ return ret;
1355
+ };
1356
+ imports.wbg.__wbg_versions_c01dfd4722a88165 = function(arg0) {
1357
+ const ret = arg0.versions;
1358
+ return ret;
1359
+ };
1360
+ imports.wbg.__wbindgen_cast_2241b6af4c4b2941 = function(arg0, arg1) {
1361
+ // Cast intrinsic for `Ref(String) -> Externref`.
1362
+ const ret = getStringFromWasm0(arg0, arg1);
1363
+ return ret;
1364
+ };
1365
+ imports.wbg.__wbindgen_cast_4625c577ab2ec9ee = function(arg0) {
1366
+ // Cast intrinsic for `U64 -> Externref`.
1367
+ const ret = BigInt.asUintN(64, arg0);
1368
+ return ret;
1369
+ };
1370
+ imports.wbg.__wbindgen_cast_cb9088102bce6b30 = function(arg0, arg1) {
1371
+ // Cast intrinsic for `Ref(Slice(U8)) -> NamedExternref("Uint8Array")`.
1372
+ const ret = getArrayU8FromWasm0(arg0, arg1);
1373
+ return ret;
1374
+ };
1375
+ imports.wbg.__wbindgen_cast_d6cd19b81560fd6e = function(arg0) {
1376
+ // Cast intrinsic for `F64 -> Externref`.
1377
+ const ret = arg0;
1378
+ return ret;
1379
+ };
1380
+ imports.wbg.__wbindgen_init_externref_table = function() {
1381
+ const table = wasm.__wbindgen_externrefs;
1382
+ const offset = table.grow(4);
1383
+ table.set(0, undefined);
1384
+ table.set(offset + 0, undefined);
1385
+ table.set(offset + 1, null);
1386
+ table.set(offset + 2, true);
1387
+ table.set(offset + 3, false);
1388
+ };
1389
+
1390
+ return imports;
1391
+ }
1392
+
1393
+ function __wbg_finalize_init(instance, module) {
1394
+ wasm = instance.exports;
1395
+ __wbg_init.__wbindgen_wasm_module = module;
1396
+ cachedDataViewMemory0 = null;
1397
+ cachedFloat32ArrayMemory0 = null;
1398
+ cachedUint8ArrayMemory0 = null;
1399
+
1400
+
1401
+ wasm.__wbindgen_start();
1402
+ return wasm;
1403
+ }
1404
+
1405
+ function initSync(module) {
1406
+ if (wasm !== undefined) return wasm;
1407
+
1408
+
1409
+ if (typeof module !== 'undefined') {
1410
+ if (Object.getPrototypeOf(module) === Object.prototype) {
1411
+ ({module} = module)
1412
+ } else {
1413
+ console.warn('using deprecated parameters for `initSync()`; pass a single object instead')
1414
+ }
1415
+ }
1416
+
1417
+ const imports = __wbg_get_imports();
1418
+ if (!(module instanceof WebAssembly.Module)) {
1419
+ module = new WebAssembly.Module(module);
1420
+ }
1421
+ const instance = new WebAssembly.Instance(module, imports);
1422
+ return __wbg_finalize_init(instance, module);
1423
+ }
1424
+
1425
+ async function __wbg_init(module_or_path) {
1426
+ if (wasm !== undefined) return wasm;
1427
+
1428
+
1429
+ if (typeof module_or_path !== 'undefined') {
1430
+ if (Object.getPrototypeOf(module_or_path) === Object.prototype) {
1431
+ ({module_or_path} = module_or_path)
1432
+ } else {
1433
+ console.warn('using deprecated parameters for the initialization function; pass a single object instead')
1434
+ }
1435
+ }
1436
+
1437
+ if (typeof module_or_path === 'undefined') {
1438
+ module_or_path = new URL('ruvector_edge_bg.wasm', import.meta.url);
1439
+ }
1440
+ const imports = __wbg_get_imports();
1441
+
1442
+ if (typeof module_or_path === 'string' || (typeof Request === 'function' && module_or_path instanceof Request) || (typeof URL === 'function' && module_or_path instanceof URL)) {
1443
+ module_or_path = fetch(module_or_path);
1444
+ }
1445
+
1446
+ const { instance, module } = await __wbg_load(await module_or_path, imports);
1447
+
1448
+ return __wbg_finalize_init(instance, module);
1449
+ }
1450
+
1451
+ export { initSync };
1452
+ export default __wbg_init;