ruvector 0.1.55 → 0.1.56

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,694 @@
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 _assertClass(instance, klass) {
10
+ if (!(instance instanceof klass)) {
11
+ throw new Error(`expected instance of ${klass.name}`);
12
+ }
13
+ }
14
+
15
+ function getArrayF32FromWasm0(ptr, len) {
16
+ ptr = ptr >>> 0;
17
+ return getFloat32ArrayMemory0().subarray(ptr / 4, ptr / 4 + len);
18
+ }
19
+
20
+ function getArrayU8FromWasm0(ptr, len) {
21
+ ptr = ptr >>> 0;
22
+ return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
23
+ }
24
+
25
+ let cachedDataViewMemory0 = null;
26
+ function getDataViewMemory0() {
27
+ if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
28
+ cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
29
+ }
30
+ return cachedDataViewMemory0;
31
+ }
32
+
33
+ let cachedFloat32ArrayMemory0 = null;
34
+ function getFloat32ArrayMemory0() {
35
+ if (cachedFloat32ArrayMemory0 === null || cachedFloat32ArrayMemory0.byteLength === 0) {
36
+ cachedFloat32ArrayMemory0 = new Float32Array(wasm.memory.buffer);
37
+ }
38
+ return cachedFloat32ArrayMemory0;
39
+ }
40
+
41
+ function getStringFromWasm0(ptr, len) {
42
+ ptr = ptr >>> 0;
43
+ return decodeText(ptr, len);
44
+ }
45
+
46
+ let cachedUint8ArrayMemory0 = null;
47
+ function getUint8ArrayMemory0() {
48
+ if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
49
+ cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
50
+ }
51
+ return cachedUint8ArrayMemory0;
52
+ }
53
+
54
+ function handleError(f, args) {
55
+ try {
56
+ return f.apply(this, args);
57
+ } catch (e) {
58
+ const idx = addToExternrefTable0(e);
59
+ wasm.__wbindgen_exn_store(idx);
60
+ }
61
+ }
62
+
63
+ function isLikeNone(x) {
64
+ return x === undefined || x === null;
65
+ }
66
+
67
+ function passArray8ToWasm0(arg, malloc) {
68
+ const ptr = malloc(arg.length * 1, 1) >>> 0;
69
+ getUint8ArrayMemory0().set(arg, ptr / 1);
70
+ WASM_VECTOR_LEN = arg.length;
71
+ return ptr;
72
+ }
73
+
74
+ function passArrayF32ToWasm0(arg, malloc) {
75
+ const ptr = malloc(arg.length * 4, 4) >>> 0;
76
+ getFloat32ArrayMemory0().set(arg, ptr / 4);
77
+ WASM_VECTOR_LEN = arg.length;
78
+ return ptr;
79
+ }
80
+
81
+ function passArrayJsValueToWasm0(array, malloc) {
82
+ const ptr = malloc(array.length * 4, 4) >>> 0;
83
+ for (let i = 0; i < array.length; i++) {
84
+ const add = addToExternrefTable0(array[i]);
85
+ getDataViewMemory0().setUint32(ptr + 4 * i, add, true);
86
+ }
87
+ WASM_VECTOR_LEN = array.length;
88
+ return ptr;
89
+ }
90
+
91
+ function passStringToWasm0(arg, malloc, realloc) {
92
+ if (realloc === undefined) {
93
+ const buf = cachedTextEncoder.encode(arg);
94
+ const ptr = malloc(buf.length, 1) >>> 0;
95
+ getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
96
+ WASM_VECTOR_LEN = buf.length;
97
+ return ptr;
98
+ }
99
+
100
+ let len = arg.length;
101
+ let ptr = malloc(len, 1) >>> 0;
102
+
103
+ const mem = getUint8ArrayMemory0();
104
+
105
+ let offset = 0;
106
+
107
+ for (; offset < len; offset++) {
108
+ const code = arg.charCodeAt(offset);
109
+ if (code > 0x7F) break;
110
+ mem[ptr + offset] = code;
111
+ }
112
+ if (offset !== len) {
113
+ if (offset !== 0) {
114
+ arg = arg.slice(offset);
115
+ }
116
+ ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
117
+ const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
118
+ const ret = cachedTextEncoder.encodeInto(arg, view);
119
+
120
+ offset += ret.written;
121
+ ptr = realloc(ptr, len, offset, 1) >>> 0;
122
+ }
123
+
124
+ WASM_VECTOR_LEN = offset;
125
+ return ptr;
126
+ }
127
+
128
+ function takeFromExternrefTable0(idx) {
129
+ const value = wasm.__wbindgen_externrefs.get(idx);
130
+ wasm.__externref_table_dealloc(idx);
131
+ return value;
132
+ }
133
+
134
+ let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
135
+ cachedTextDecoder.decode();
136
+ const MAX_SAFARI_DECODE_BYTES = 2146435072;
137
+ let numBytesDecoded = 0;
138
+ function decodeText(ptr, len) {
139
+ numBytesDecoded += len;
140
+ if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
141
+ cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
142
+ cachedTextDecoder.decode();
143
+ numBytesDecoded = len;
144
+ }
145
+ return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
146
+ }
147
+
148
+ const cachedTextEncoder = new TextEncoder();
149
+
150
+ if (!('encodeInto' in cachedTextEncoder)) {
151
+ cachedTextEncoder.encodeInto = function (arg, view) {
152
+ const buf = cachedTextEncoder.encode(arg);
153
+ view.set(buf);
154
+ return {
155
+ read: arg.length,
156
+ written: buf.length
157
+ };
158
+ }
159
+ }
160
+
161
+ let WASM_VECTOR_LEN = 0;
162
+
163
+ const WasmEmbedderFinalization = (typeof FinalizationRegistry === 'undefined')
164
+ ? { register: () => {}, unregister: () => {} }
165
+ : new FinalizationRegistry(ptr => wasm.__wbg_wasmembedder_free(ptr >>> 0, 1));
166
+
167
+ const WasmEmbedderConfigFinalization = (typeof FinalizationRegistry === 'undefined')
168
+ ? { register: () => {}, unregister: () => {} }
169
+ : new FinalizationRegistry(ptr => wasm.__wbg_wasmembedderconfig_free(ptr >>> 0, 1));
170
+
171
+ /**
172
+ * Strategy for pooling token embeddings into a single sentence embedding
173
+ * @enum {0 | 1 | 2 | 3 | 4}
174
+ */
175
+ export const PoolingStrategy = Object.freeze({
176
+ /**
177
+ * Average all token embeddings (most common)
178
+ */
179
+ Mean: 0, "0": "Mean",
180
+ /**
181
+ * Use only the [CLS] token embedding
182
+ */
183
+ Cls: 1, "1": "Cls",
184
+ /**
185
+ * Take the maximum value across all tokens for each dimension
186
+ */
187
+ Max: 2, "2": "Max",
188
+ /**
189
+ * Mean pooling normalized by sqrt of sequence length
190
+ */
191
+ MeanSqrtLen: 3, "3": "MeanSqrtLen",
192
+ /**
193
+ * Use the last token embedding (for decoder models)
194
+ */
195
+ LastToken: 4, "4": "LastToken",
196
+ });
197
+
198
+ /**
199
+ * WASM-compatible embedder using Tract for inference
200
+ */
201
+ export class WasmEmbedder {
202
+ static __wrap(ptr) {
203
+ ptr = ptr >>> 0;
204
+ const obj = Object.create(WasmEmbedder.prototype);
205
+ obj.__wbg_ptr = ptr;
206
+ WasmEmbedderFinalization.register(obj, obj.__wbg_ptr, obj);
207
+ return obj;
208
+ }
209
+ __destroy_into_raw() {
210
+ const ptr = this.__wbg_ptr;
211
+ this.__wbg_ptr = 0;
212
+ WasmEmbedderFinalization.unregister(this);
213
+ return ptr;
214
+ }
215
+ free() {
216
+ const ptr = this.__destroy_into_raw();
217
+ wasm.__wbg_wasmembedder_free(ptr, 0);
218
+ }
219
+ /**
220
+ * Get maximum sequence length
221
+ * @returns {number}
222
+ */
223
+ maxLength() {
224
+ const ret = wasm.wasmembedder_maxLength(this.__wbg_ptr);
225
+ return ret >>> 0;
226
+ }
227
+ /**
228
+ * Compute similarity between two texts
229
+ * @param {string} text1
230
+ * @param {string} text2
231
+ * @returns {number}
232
+ */
233
+ similarity(text1, text2) {
234
+ const ptr0 = passStringToWasm0(text1, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
235
+ const len0 = WASM_VECTOR_LEN;
236
+ const ptr1 = passStringToWasm0(text2, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
237
+ const len1 = WASM_VECTOR_LEN;
238
+ const ret = wasm.wasmembedder_similarity(this.__wbg_ptr, ptr0, len0, ptr1, len1);
239
+ if (ret[2]) {
240
+ throw takeFromExternrefTable0(ret[1]);
241
+ }
242
+ return ret[0];
243
+ }
244
+ /**
245
+ * Generate embeddings for multiple texts
246
+ * @param {string[]} texts
247
+ * @returns {Float32Array}
248
+ */
249
+ embedBatch(texts) {
250
+ const ptr0 = passArrayJsValueToWasm0(texts, wasm.__wbindgen_malloc);
251
+ const len0 = WASM_VECTOR_LEN;
252
+ const ret = wasm.wasmembedder_embedBatch(this.__wbg_ptr, ptr0, len0);
253
+ if (ret[3]) {
254
+ throw takeFromExternrefTable0(ret[2]);
255
+ }
256
+ var v2 = getArrayF32FromWasm0(ret[0], ret[1]).slice();
257
+ wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
258
+ return v2;
259
+ }
260
+ /**
261
+ * Create embedder with custom configuration
262
+ * @param {Uint8Array} model_bytes
263
+ * @param {string} tokenizer_json
264
+ * @param {WasmEmbedderConfig} config
265
+ * @returns {WasmEmbedder}
266
+ */
267
+ static withConfig(model_bytes, tokenizer_json, config) {
268
+ const ptr0 = passArray8ToWasm0(model_bytes, wasm.__wbindgen_malloc);
269
+ const len0 = WASM_VECTOR_LEN;
270
+ const ptr1 = passStringToWasm0(tokenizer_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
271
+ const len1 = WASM_VECTOR_LEN;
272
+ _assertClass(config, WasmEmbedderConfig);
273
+ var ptr2 = config.__destroy_into_raw();
274
+ const ret = wasm.wasmembedder_withConfig(ptr0, len0, ptr1, len1, ptr2);
275
+ if (ret[2]) {
276
+ throw takeFromExternrefTable0(ret[1]);
277
+ }
278
+ return WasmEmbedder.__wrap(ret[0]);
279
+ }
280
+ /**
281
+ * Create a new embedder from model and tokenizer bytes
282
+ *
283
+ * # Arguments
284
+ * * `model_bytes` - ONNX model file bytes
285
+ * * `tokenizer_json` - Tokenizer JSON configuration
286
+ * @param {Uint8Array} model_bytes
287
+ * @param {string} tokenizer_json
288
+ */
289
+ constructor(model_bytes, tokenizer_json) {
290
+ const ptr0 = passArray8ToWasm0(model_bytes, wasm.__wbindgen_malloc);
291
+ const len0 = WASM_VECTOR_LEN;
292
+ const ptr1 = passStringToWasm0(tokenizer_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
293
+ const len1 = WASM_VECTOR_LEN;
294
+ const ret = wasm.wasmembedder_new(ptr0, len0, ptr1, len1);
295
+ if (ret[2]) {
296
+ throw takeFromExternrefTable0(ret[1]);
297
+ }
298
+ this.__wbg_ptr = ret[0] >>> 0;
299
+ WasmEmbedderFinalization.register(this, this.__wbg_ptr, this);
300
+ return this;
301
+ }
302
+ /**
303
+ * Get the embedding dimension
304
+ * @returns {number}
305
+ */
306
+ dimension() {
307
+ const ret = wasm.wasmembedder_dimension(this.__wbg_ptr);
308
+ return ret >>> 0;
309
+ }
310
+ /**
311
+ * Generate embedding for a single text
312
+ * @param {string} text
313
+ * @returns {Float32Array}
314
+ */
315
+ embedOne(text) {
316
+ const ptr0 = passStringToWasm0(text, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
317
+ const len0 = WASM_VECTOR_LEN;
318
+ const ret = wasm.wasmembedder_embedOne(this.__wbg_ptr, ptr0, len0);
319
+ if (ret[3]) {
320
+ throw takeFromExternrefTable0(ret[2]);
321
+ }
322
+ var v2 = getArrayF32FromWasm0(ret[0], ret[1]).slice();
323
+ wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
324
+ return v2;
325
+ }
326
+ }
327
+ if (Symbol.dispose) WasmEmbedder.prototype[Symbol.dispose] = WasmEmbedder.prototype.free;
328
+
329
+ /**
330
+ * Configuration for the WASM embedder
331
+ */
332
+ export class WasmEmbedderConfig {
333
+ static __wrap(ptr) {
334
+ ptr = ptr >>> 0;
335
+ const obj = Object.create(WasmEmbedderConfig.prototype);
336
+ obj.__wbg_ptr = ptr;
337
+ WasmEmbedderConfigFinalization.register(obj, obj.__wbg_ptr, obj);
338
+ return obj;
339
+ }
340
+ __destroy_into_raw() {
341
+ const ptr = this.__wbg_ptr;
342
+ this.__wbg_ptr = 0;
343
+ WasmEmbedderConfigFinalization.unregister(this);
344
+ return ptr;
345
+ }
346
+ free() {
347
+ const ptr = this.__destroy_into_raw();
348
+ wasm.__wbg_wasmembedderconfig_free(ptr, 0);
349
+ }
350
+ /**
351
+ * Set pooling strategy (0=Mean, 1=Cls, 2=Max, 3=MeanSqrtLen, 4=LastToken)
352
+ * @param {number} pooling
353
+ * @returns {WasmEmbedderConfig}
354
+ */
355
+ setPooling(pooling) {
356
+ const ptr = this.__destroy_into_raw();
357
+ const ret = wasm.wasmembedderconfig_setPooling(ptr, pooling);
358
+ return WasmEmbedderConfig.__wrap(ret);
359
+ }
360
+ /**
361
+ * Set whether to normalize embeddings
362
+ * @param {boolean} normalize
363
+ * @returns {WasmEmbedderConfig}
364
+ */
365
+ setNormalize(normalize) {
366
+ const ptr = this.__destroy_into_raw();
367
+ const ret = wasm.wasmembedderconfig_setNormalize(ptr, normalize);
368
+ return WasmEmbedderConfig.__wrap(ret);
369
+ }
370
+ /**
371
+ * Set maximum sequence length
372
+ * @param {number} max_length
373
+ * @returns {WasmEmbedderConfig}
374
+ */
375
+ setMaxLength(max_length) {
376
+ const ptr = this.__destroy_into_raw();
377
+ const ret = wasm.wasmembedderconfig_setMaxLength(ptr, max_length);
378
+ return WasmEmbedderConfig.__wrap(ret);
379
+ }
380
+ /**
381
+ * Create a new configuration
382
+ */
383
+ constructor() {
384
+ const ret = wasm.wasmembedderconfig_new();
385
+ this.__wbg_ptr = ret >>> 0;
386
+ WasmEmbedderConfigFinalization.register(this, this.__wbg_ptr, this);
387
+ return this;
388
+ }
389
+ }
390
+ if (Symbol.dispose) WasmEmbedderConfig.prototype[Symbol.dispose] = WasmEmbedderConfig.prototype.free;
391
+
392
+ /**
393
+ * Compute cosine similarity between two embedding vectors (JS-friendly)
394
+ * @param {Float32Array} a
395
+ * @param {Float32Array} b
396
+ * @returns {number}
397
+ */
398
+ export function cosineSimilarity(a, b) {
399
+ const ptr0 = passArrayF32ToWasm0(a, wasm.__wbindgen_malloc);
400
+ const len0 = WASM_VECTOR_LEN;
401
+ const ptr1 = passArrayF32ToWasm0(b, wasm.__wbindgen_malloc);
402
+ const len1 = WASM_VECTOR_LEN;
403
+ const ret = wasm.cosineSimilarity(ptr0, len0, ptr1, len1);
404
+ return ret;
405
+ }
406
+
407
+ /**
408
+ * Initialize panic hook for better error messages in WASM
409
+ */
410
+ export function init() {
411
+ wasm.init();
412
+ }
413
+
414
+ /**
415
+ * L2 normalize an embedding vector (JS-friendly)
416
+ * @param {Float32Array} embedding
417
+ * @returns {Float32Array}
418
+ */
419
+ export function normalizeL2(embedding) {
420
+ const ptr0 = passArrayF32ToWasm0(embedding, wasm.__wbindgen_malloc);
421
+ const len0 = WASM_VECTOR_LEN;
422
+ const ret = wasm.normalizeL2(ptr0, len0);
423
+ var v2 = getArrayF32FromWasm0(ret[0], ret[1]).slice();
424
+ wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
425
+ return v2;
426
+ }
427
+
428
+ /**
429
+ * Check if SIMD is available (for performance info)
430
+ * @returns {boolean}
431
+ */
432
+ export function simd_available() {
433
+ const ret = wasm.simd_available();
434
+ return ret !== 0;
435
+ }
436
+
437
+ /**
438
+ * Get the library version
439
+ * @returns {string}
440
+ */
441
+ export function version() {
442
+ let deferred1_0;
443
+ let deferred1_1;
444
+ try {
445
+ const ret = wasm.version();
446
+ deferred1_0 = ret[0];
447
+ deferred1_1 = ret[1];
448
+ return getStringFromWasm0(ret[0], ret[1]);
449
+ } finally {
450
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
451
+ }
452
+ }
453
+
454
+ const EXPECTED_RESPONSE_TYPES = new Set(['basic', 'cors', 'default']);
455
+
456
+ async function __wbg_load(module, imports) {
457
+ if (typeof Response === 'function' && module instanceof Response) {
458
+ if (typeof WebAssembly.instantiateStreaming === 'function') {
459
+ try {
460
+ return await WebAssembly.instantiateStreaming(module, imports);
461
+ } catch (e) {
462
+ const validResponse = module.ok && EXPECTED_RESPONSE_TYPES.has(module.type);
463
+
464
+ if (validResponse && module.headers.get('Content-Type') !== 'application/wasm') {
465
+ 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);
466
+
467
+ } else {
468
+ throw e;
469
+ }
470
+ }
471
+ }
472
+
473
+ const bytes = await module.arrayBuffer();
474
+ return await WebAssembly.instantiate(bytes, imports);
475
+ } else {
476
+ const instance = await WebAssembly.instantiate(module, imports);
477
+
478
+ if (instance instanceof WebAssembly.Instance) {
479
+ return { instance, module };
480
+ } else {
481
+ return instance;
482
+ }
483
+ }
484
+ }
485
+
486
+ function __wbg_get_imports() {
487
+ const imports = {};
488
+ imports.wbg = {};
489
+ imports.wbg.__wbg___wbindgen_is_function_8d400b8b1af978cd = function(arg0) {
490
+ const ret = typeof(arg0) === 'function';
491
+ return ret;
492
+ };
493
+ imports.wbg.__wbg___wbindgen_is_object_ce774f3490692386 = function(arg0) {
494
+ const val = arg0;
495
+ const ret = typeof(val) === 'object' && val !== null;
496
+ return ret;
497
+ };
498
+ imports.wbg.__wbg___wbindgen_is_string_704ef9c8fc131030 = function(arg0) {
499
+ const ret = typeof(arg0) === 'string';
500
+ return ret;
501
+ };
502
+ imports.wbg.__wbg___wbindgen_is_undefined_f6b95eab589e0269 = function(arg0) {
503
+ const ret = arg0 === undefined;
504
+ return ret;
505
+ };
506
+ imports.wbg.__wbg___wbindgen_string_get_a2a31e16edf96e42 = function(arg0, arg1) {
507
+ const obj = arg1;
508
+ const ret = typeof(obj) === 'string' ? obj : undefined;
509
+ var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
510
+ var len1 = WASM_VECTOR_LEN;
511
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
512
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
513
+ };
514
+ imports.wbg.__wbg___wbindgen_throw_dd24417ed36fc46e = function(arg0, arg1) {
515
+ throw new Error(getStringFromWasm0(arg0, arg1));
516
+ };
517
+ imports.wbg.__wbg_call_3020136f7a2d6e44 = function() { return handleError(function (arg0, arg1, arg2) {
518
+ const ret = arg0.call(arg1, arg2);
519
+ return ret;
520
+ }, arguments) };
521
+ imports.wbg.__wbg_call_abb4ff46ce38be40 = function() { return handleError(function (arg0, arg1) {
522
+ const ret = arg0.call(arg1);
523
+ return ret;
524
+ }, arguments) };
525
+ imports.wbg.__wbg_crypto_574e78ad8b13b65f = function(arg0) {
526
+ const ret = arg0.crypto;
527
+ return ret;
528
+ };
529
+ imports.wbg.__wbg_error_7534b8e9a36f1ab4 = function(arg0, arg1) {
530
+ let deferred0_0;
531
+ let deferred0_1;
532
+ try {
533
+ deferred0_0 = arg0;
534
+ deferred0_1 = arg1;
535
+ console.error(getStringFromWasm0(arg0, arg1));
536
+ } finally {
537
+ wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
538
+ }
539
+ };
540
+ imports.wbg.__wbg_getRandomValues_b8f5dbd5f3995a9e = function() { return handleError(function (arg0, arg1) {
541
+ arg0.getRandomValues(arg1);
542
+ }, arguments) };
543
+ imports.wbg.__wbg_length_22ac23eaec9d8053 = function(arg0) {
544
+ const ret = arg0.length;
545
+ return ret;
546
+ };
547
+ imports.wbg.__wbg_msCrypto_a61aeb35a24c1329 = function(arg0) {
548
+ const ret = arg0.msCrypto;
549
+ return ret;
550
+ };
551
+ imports.wbg.__wbg_new_8a6f238a6ece86ea = function() {
552
+ const ret = new Error();
553
+ return ret;
554
+ };
555
+ imports.wbg.__wbg_new_no_args_cb138f77cf6151ee = function(arg0, arg1) {
556
+ const ret = new Function(getStringFromWasm0(arg0, arg1));
557
+ return ret;
558
+ };
559
+ imports.wbg.__wbg_new_with_length_aa5eaf41d35235e5 = function(arg0) {
560
+ const ret = new Uint8Array(arg0 >>> 0);
561
+ return ret;
562
+ };
563
+ imports.wbg.__wbg_node_905d3e251edff8a2 = function(arg0) {
564
+ const ret = arg0.node;
565
+ return ret;
566
+ };
567
+ imports.wbg.__wbg_process_dc0fbacc7c1c06f7 = function(arg0) {
568
+ const ret = arg0.process;
569
+ return ret;
570
+ };
571
+ imports.wbg.__wbg_prototypesetcall_dfe9b766cdc1f1fd = function(arg0, arg1, arg2) {
572
+ Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), arg2);
573
+ };
574
+ imports.wbg.__wbg_randomFillSync_ac0988aba3254290 = function() { return handleError(function (arg0, arg1) {
575
+ arg0.randomFillSync(arg1);
576
+ }, arguments) };
577
+ imports.wbg.__wbg_require_60cc747a6bc5215a = function() { return handleError(function () {
578
+ const ret = module.require;
579
+ return ret;
580
+ }, arguments) };
581
+ imports.wbg.__wbg_stack_0ed75d68575b0f3c = function(arg0, arg1) {
582
+ const ret = arg1.stack;
583
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
584
+ const len1 = WASM_VECTOR_LEN;
585
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
586
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
587
+ };
588
+ imports.wbg.__wbg_static_accessor_GLOBAL_769e6b65d6557335 = function() {
589
+ const ret = typeof global === 'undefined' ? null : global;
590
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
591
+ };
592
+ imports.wbg.__wbg_static_accessor_GLOBAL_THIS_60cf02db4de8e1c1 = function() {
593
+ const ret = typeof globalThis === 'undefined' ? null : globalThis;
594
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
595
+ };
596
+ imports.wbg.__wbg_static_accessor_SELF_08f5a74c69739274 = function() {
597
+ const ret = typeof self === 'undefined' ? null : self;
598
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
599
+ };
600
+ imports.wbg.__wbg_static_accessor_WINDOW_a8924b26aa92d024 = function() {
601
+ const ret = typeof window === 'undefined' ? null : window;
602
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
603
+ };
604
+ imports.wbg.__wbg_subarray_845f2f5bce7d061a = function(arg0, arg1, arg2) {
605
+ const ret = arg0.subarray(arg1 >>> 0, arg2 >>> 0);
606
+ return ret;
607
+ };
608
+ imports.wbg.__wbg_versions_c01dfd4722a88165 = function(arg0) {
609
+ const ret = arg0.versions;
610
+ return ret;
611
+ };
612
+ imports.wbg.__wbindgen_cast_2241b6af4c4b2941 = function(arg0, arg1) {
613
+ // Cast intrinsic for `Ref(String) -> Externref`.
614
+ const ret = getStringFromWasm0(arg0, arg1);
615
+ return ret;
616
+ };
617
+ imports.wbg.__wbindgen_cast_cb9088102bce6b30 = function(arg0, arg1) {
618
+ // Cast intrinsic for `Ref(Slice(U8)) -> NamedExternref("Uint8Array")`.
619
+ const ret = getArrayU8FromWasm0(arg0, arg1);
620
+ return ret;
621
+ };
622
+ imports.wbg.__wbindgen_init_externref_table = function() {
623
+ const table = wasm.__wbindgen_externrefs;
624
+ const offset = table.grow(4);
625
+ table.set(0, undefined);
626
+ table.set(offset + 0, undefined);
627
+ table.set(offset + 1, null);
628
+ table.set(offset + 2, true);
629
+ table.set(offset + 3, false);
630
+ };
631
+
632
+ return imports;
633
+ }
634
+
635
+ function __wbg_finalize_init(instance, module) {
636
+ wasm = instance.exports;
637
+ __wbg_init.__wbindgen_wasm_module = module;
638
+ cachedDataViewMemory0 = null;
639
+ cachedFloat32ArrayMemory0 = null;
640
+ cachedUint8ArrayMemory0 = null;
641
+
642
+
643
+ wasm.__wbindgen_start();
644
+ return wasm;
645
+ }
646
+
647
+ function initSync(module) {
648
+ if (wasm !== undefined) return wasm;
649
+
650
+
651
+ if (typeof module !== 'undefined') {
652
+ if (Object.getPrototypeOf(module) === Object.prototype) {
653
+ ({module} = module)
654
+ } else {
655
+ console.warn('using deprecated parameters for `initSync()`; pass a single object instead')
656
+ }
657
+ }
658
+
659
+ const imports = __wbg_get_imports();
660
+ if (!(module instanceof WebAssembly.Module)) {
661
+ module = new WebAssembly.Module(module);
662
+ }
663
+ const instance = new WebAssembly.Instance(module, imports);
664
+ return __wbg_finalize_init(instance, module);
665
+ }
666
+
667
+ async function __wbg_init(module_or_path) {
668
+ if (wasm !== undefined) return wasm;
669
+
670
+
671
+ if (typeof module_or_path !== 'undefined') {
672
+ if (Object.getPrototypeOf(module_or_path) === Object.prototype) {
673
+ ({module_or_path} = module_or_path)
674
+ } else {
675
+ console.warn('using deprecated parameters for the initialization function; pass a single object instead')
676
+ }
677
+ }
678
+
679
+ if (typeof module_or_path === 'undefined') {
680
+ module_or_path = new URL('ruvector_onnx_embeddings_wasm_bg.wasm', import.meta.url);
681
+ }
682
+ const imports = __wbg_get_imports();
683
+
684
+ if (typeof module_or_path === 'string' || (typeof Request === 'function' && module_or_path instanceof Request) || (typeof URL === 'function' && module_or_path instanceof URL)) {
685
+ module_or_path = fetch(module_or_path);
686
+ }
687
+
688
+ const { instance, module } = await __wbg_load(await module_or_path, imports);
689
+
690
+ return __wbg_finalize_init(instance, module);
691
+ }
692
+
693
+ export { initSync };
694
+ export default __wbg_init;