@kreuzberg/wasm 4.0.0-rc.25 → 4.0.0-rc.26

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,1904 @@
1
+
2
+ let imports = {};
3
+ imports['__wbindgen_placeholder__'] = module.exports;
4
+
5
+ function addToExternrefTable0(obj) {
6
+ const idx = wasm.__externref_table_alloc();
7
+ wasm.__wbindgen_externrefs.set(idx, obj);
8
+ return idx;
9
+ }
10
+
11
+ const CLOSURE_DTORS = (typeof FinalizationRegistry === 'undefined')
12
+ ? { register: () => {}, unregister: () => {} }
13
+ : new FinalizationRegistry(state => state.dtor(state.a, state.b));
14
+
15
+ function debugString(val) {
16
+ // primitive types
17
+ const type = typeof val;
18
+ if (type == 'number' || type == 'boolean' || val == null) {
19
+ return `${val}`;
20
+ }
21
+ if (type == 'string') {
22
+ return `"${val}"`;
23
+ }
24
+ if (type == 'symbol') {
25
+ const description = val.description;
26
+ if (description == null) {
27
+ return 'Symbol';
28
+ } else {
29
+ return `Symbol(${description})`;
30
+ }
31
+ }
32
+ if (type == 'function') {
33
+ const name = val.name;
34
+ if (typeof name == 'string' && name.length > 0) {
35
+ return `Function(${name})`;
36
+ } else {
37
+ return 'Function';
38
+ }
39
+ }
40
+ // objects
41
+ if (Array.isArray(val)) {
42
+ const length = val.length;
43
+ let debug = '[';
44
+ if (length > 0) {
45
+ debug += debugString(val[0]);
46
+ }
47
+ for(let i = 1; i < length; i++) {
48
+ debug += ', ' + debugString(val[i]);
49
+ }
50
+ debug += ']';
51
+ return debug;
52
+ }
53
+ // Test for built-in
54
+ const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val));
55
+ let className;
56
+ if (builtInMatches && builtInMatches.length > 1) {
57
+ className = builtInMatches[1];
58
+ } else {
59
+ // Failed to match the standard '[object ClassName]'
60
+ return toString.call(val);
61
+ }
62
+ if (className == 'Object') {
63
+ // we're a user defined class or Object
64
+ // JSON.stringify avoids problems with cycles, and is generally much
65
+ // easier than looping through ownProperties of `val`.
66
+ try {
67
+ return 'Object(' + JSON.stringify(val) + ')';
68
+ } catch (_) {
69
+ return 'Object';
70
+ }
71
+ }
72
+ // errors
73
+ if (val instanceof Error) {
74
+ return `${val.name}: ${val.message}\n${val.stack}`;
75
+ }
76
+ // TODO we could test for more things here, like `Set`s and `Map`s.
77
+ return className;
78
+ }
79
+
80
+ function getArrayU8FromWasm0(ptr, len) {
81
+ ptr = ptr >>> 0;
82
+ return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
83
+ }
84
+
85
+ function getCachedStringFromWasm0(ptr, len) {
86
+ if (ptr === 0) {
87
+ return getFromExternrefTable0(len);
88
+ } else {
89
+ return getStringFromWasm0(ptr, len);
90
+ }
91
+ }
92
+
93
+ let cachedDataViewMemory0 = null;
94
+ function getDataViewMemory0() {
95
+ if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
96
+ cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
97
+ }
98
+ return cachedDataViewMemory0;
99
+ }
100
+
101
+ function getFromExternrefTable0(idx) { return wasm.__wbindgen_externrefs.get(idx); }
102
+
103
+ function getStringFromWasm0(ptr, len) {
104
+ ptr = ptr >>> 0;
105
+ return decodeText(ptr, len);
106
+ }
107
+
108
+ let cachedUint8ArrayMemory0 = null;
109
+ function getUint8ArrayMemory0() {
110
+ if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
111
+ cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
112
+ }
113
+ return cachedUint8ArrayMemory0;
114
+ }
115
+
116
+ function handleError(f, args) {
117
+ try {
118
+ return f.apply(this, args);
119
+ } catch (e) {
120
+ const idx = addToExternrefTable0(e);
121
+ wasm.__wbindgen_exn_store(idx);
122
+ }
123
+ }
124
+
125
+ function isLikeNone(x) {
126
+ return x === undefined || x === null;
127
+ }
128
+
129
+ function makeMutClosure(arg0, arg1, dtor, f) {
130
+ const state = { a: arg0, b: arg1, cnt: 1, dtor };
131
+ const real = (...args) => {
132
+
133
+ // First up with a closure we increment the internal reference
134
+ // count. This ensures that the Rust closure environment won't
135
+ // be deallocated while we're invoking it.
136
+ state.cnt++;
137
+ const a = state.a;
138
+ state.a = 0;
139
+ try {
140
+ return f(a, state.b, ...args);
141
+ } finally {
142
+ state.a = a;
143
+ real._wbg_cb_unref();
144
+ }
145
+ };
146
+ real._wbg_cb_unref = () => {
147
+ if (--state.cnt === 0) {
148
+ state.dtor(state.a, state.b);
149
+ state.a = 0;
150
+ CLOSURE_DTORS.unregister(state);
151
+ }
152
+ };
153
+ CLOSURE_DTORS.register(real, state, state);
154
+ return real;
155
+ }
156
+
157
+ function passArrayJsValueToWasm0(array, malloc) {
158
+ const ptr = malloc(array.length * 4, 4) >>> 0;
159
+ for (let i = 0; i < array.length; i++) {
160
+ const add = addToExternrefTable0(array[i]);
161
+ getDataViewMemory0().setUint32(ptr + 4 * i, add, true);
162
+ }
163
+ WASM_VECTOR_LEN = array.length;
164
+ return ptr;
165
+ }
166
+
167
+ function passStringToWasm0(arg, malloc, realloc) {
168
+ if (realloc === undefined) {
169
+ const buf = cachedTextEncoder.encode(arg);
170
+ const ptr = malloc(buf.length, 1) >>> 0;
171
+ getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
172
+ WASM_VECTOR_LEN = buf.length;
173
+ return ptr;
174
+ }
175
+
176
+ let len = arg.length;
177
+ let ptr = malloc(len, 1) >>> 0;
178
+
179
+ const mem = getUint8ArrayMemory0();
180
+
181
+ let offset = 0;
182
+
183
+ for (; offset < len; offset++) {
184
+ const code = arg.charCodeAt(offset);
185
+ if (code > 0x7F) break;
186
+ mem[ptr + offset] = code;
187
+ }
188
+ if (offset !== len) {
189
+ if (offset !== 0) {
190
+ arg = arg.slice(offset);
191
+ }
192
+ ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
193
+ const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
194
+ const ret = cachedTextEncoder.encodeInto(arg, view);
195
+
196
+ offset += ret.written;
197
+ ptr = realloc(ptr, len, offset, 1) >>> 0;
198
+ }
199
+
200
+ WASM_VECTOR_LEN = offset;
201
+ return ptr;
202
+ }
203
+
204
+ function takeFromExternrefTable0(idx) {
205
+ const value = wasm.__wbindgen_externrefs.get(idx);
206
+ wasm.__externref_table_dealloc(idx);
207
+ return value;
208
+ }
209
+
210
+ let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
211
+ cachedTextDecoder.decode();
212
+ function decodeText(ptr, len) {
213
+ return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
214
+ }
215
+
216
+ const cachedTextEncoder = new TextEncoder();
217
+
218
+ if (!('encodeInto' in cachedTextEncoder)) {
219
+ cachedTextEncoder.encodeInto = function (arg, view) {
220
+ const buf = cachedTextEncoder.encode(arg);
221
+ view.set(buf);
222
+ return {
223
+ read: arg.length,
224
+ written: buf.length
225
+ };
226
+ }
227
+ }
228
+
229
+ let WASM_VECTOR_LEN = 0;
230
+
231
+ function wasm_bindgen_68ee60ea9ccb8413___convert__closures_____invoke___wasm_bindgen_68ee60ea9ccb8413___JsValue_____(arg0, arg1, arg2) {
232
+ wasm.wasm_bindgen_68ee60ea9ccb8413___convert__closures_____invoke___wasm_bindgen_68ee60ea9ccb8413___JsValue_____(arg0, arg1, arg2);
233
+ }
234
+
235
+ function wasm_bindgen_68ee60ea9ccb8413___convert__closures_____invoke___wasm_bindgen_68ee60ea9ccb8413___JsValue__wasm_bindgen_68ee60ea9ccb8413___JsValue_____(arg0, arg1, arg2, arg3) {
236
+ wasm.wasm_bindgen_68ee60ea9ccb8413___convert__closures_____invoke___wasm_bindgen_68ee60ea9ccb8413___JsValue__wasm_bindgen_68ee60ea9ccb8413___JsValue_____(arg0, arg1, arg2, arg3);
237
+ }
238
+
239
+ const ModuleInfoFinalization = (typeof FinalizationRegistry === 'undefined')
240
+ ? { register: () => {}, unregister: () => {} }
241
+ : new FinalizationRegistry(ptr => wasm.__wbg_moduleinfo_free(ptr >>> 0, 1));
242
+
243
+ /**
244
+ * Get information about the WASM module
245
+ */
246
+ class ModuleInfo {
247
+ static __wrap(ptr) {
248
+ ptr = ptr >>> 0;
249
+ const obj = Object.create(ModuleInfo.prototype);
250
+ obj.__wbg_ptr = ptr;
251
+ ModuleInfoFinalization.register(obj, obj.__wbg_ptr, obj);
252
+ return obj;
253
+ }
254
+ __destroy_into_raw() {
255
+ const ptr = this.__wbg_ptr;
256
+ this.__wbg_ptr = 0;
257
+ ModuleInfoFinalization.unregister(this);
258
+ return ptr;
259
+ }
260
+ free() {
261
+ const ptr = this.__destroy_into_raw();
262
+ wasm.__wbg_moduleinfo_free(ptr, 0);
263
+ }
264
+ /**
265
+ * Get the module name
266
+ * @returns {string}
267
+ */
268
+ name() {
269
+ const ret = wasm.moduleinfo_name(this.__wbg_ptr);
270
+ var v1 = getCachedStringFromWasm0(ret[0], ret[1]);
271
+ if (ret[0] !== 0) { wasm.__wbindgen_free(ret[0], ret[1], 1); }
272
+ return v1;
273
+ }
274
+ /**
275
+ * Get the module version
276
+ * @returns {string}
277
+ */
278
+ version() {
279
+ const ret = wasm.moduleinfo_version(this.__wbg_ptr);
280
+ var v1 = getCachedStringFromWasm0(ret[0], ret[1]);
281
+ if (ret[0] !== 0) { wasm.__wbindgen_free(ret[0], ret[1], 1); }
282
+ return v1;
283
+ }
284
+ }
285
+ if (Symbol.dispose) ModuleInfo.prototype[Symbol.dispose] = ModuleInfo.prototype.free;
286
+ exports.ModuleInfo = ModuleInfo;
287
+
288
+ /**
289
+ * Batch extract from multiple byte arrays (asynchronous).
290
+ *
291
+ * Asynchronously processes multiple document byte arrays in parallel.
292
+ * Non-blocking alternative to `batchExtractBytesSync`.
293
+ *
294
+ * # JavaScript Parameters
295
+ *
296
+ * * `dataList: Uint8Array[]` - Array of document bytes
297
+ * * `mimeTypes: string[]` - Array of MIME types (must match dataList length)
298
+ * * `config?: object` - Optional extraction configuration (applied to all)
299
+ *
300
+ * # Returns
301
+ *
302
+ * `Promise<object[]>` - Promise resolving to array of ExtractionResults
303
+ *
304
+ * # Throws
305
+ *
306
+ * Rejects if dataList and mimeTypes lengths don't match.
307
+ *
308
+ * # Example
309
+ *
310
+ * ```javascript
311
+ * import { batchExtractBytes } from '@kreuzberg/wasm';
312
+ *
313
+ * const responses = await Promise.all([
314
+ * fetch('doc1.pdf'),
315
+ * fetch('doc2.docx')
316
+ * ]);
317
+ *
318
+ * const buffers = await Promise.all(
319
+ * responses.map(r => r.arrayBuffer().then(b => new Uint8Array(b)))
320
+ * );
321
+ *
322
+ * const results = await batchExtractBytes(
323
+ * buffers,
324
+ * ['application/pdf', 'application/vnd.openxmlformats-officedocument.wordprocessingml.document'],
325
+ * null
326
+ * );
327
+ * ```
328
+ * @param {Uint8Array[]} data_list
329
+ * @param {string[]} mime_types
330
+ * @param {any | null} [config]
331
+ * @returns {Promise<any>}
332
+ */
333
+ function batchExtractBytes(data_list, mime_types, config) {
334
+ const ptr0 = passArrayJsValueToWasm0(data_list, wasm.__wbindgen_malloc);
335
+ const len0 = WASM_VECTOR_LEN;
336
+ const ptr1 = passArrayJsValueToWasm0(mime_types, wasm.__wbindgen_malloc);
337
+ const len1 = WASM_VECTOR_LEN;
338
+ const ret = wasm.batchExtractBytes(ptr0, len0, ptr1, len1, isLikeNone(config) ? 0 : addToExternrefTable0(config));
339
+ return ret;
340
+ }
341
+ exports.batchExtractBytes = batchExtractBytes;
342
+
343
+ /**
344
+ * Batch extract from multiple byte arrays (synchronous).
345
+ *
346
+ * Processes multiple document byte arrays in parallel. All documents use the
347
+ * same extraction configuration.
348
+ *
349
+ * # JavaScript Parameters
350
+ *
351
+ * * `dataList: Uint8Array[]` - Array of document bytes
352
+ * * `mimeTypes: string[]` - Array of MIME types (must match dataList length)
353
+ * * `config?: object` - Optional extraction configuration (applied to all)
354
+ *
355
+ * # Returns
356
+ *
357
+ * `object[]` - Array of ExtractionResults in the same order as inputs
358
+ *
359
+ * # Throws
360
+ *
361
+ * Throws if dataList and mimeTypes lengths don't match.
362
+ *
363
+ * # Example
364
+ *
365
+ * ```javascript
366
+ * import { batchExtractBytesSync } from '@kreuzberg/wasm';
367
+ *
368
+ * const buffers = [buffer1, buffer2, buffer3];
369
+ * const mimeTypes = ['application/pdf', 'text/plain', 'image/png'];
370
+ * const results = batchExtractBytesSync(buffers, mimeTypes, null);
371
+ *
372
+ * results.forEach((result, i) => {
373
+ * console.log(`Document ${i}: ${result.content.substring(0, 50)}...`);
374
+ * });
375
+ * ```
376
+ * @param {Uint8Array[]} data_list
377
+ * @param {string[]} mime_types
378
+ * @param {any | null} [config]
379
+ * @returns {any}
380
+ */
381
+ function batchExtractBytesSync(data_list, mime_types, config) {
382
+ const ptr0 = passArrayJsValueToWasm0(data_list, wasm.__wbindgen_malloc);
383
+ const len0 = WASM_VECTOR_LEN;
384
+ const ptr1 = passArrayJsValueToWasm0(mime_types, wasm.__wbindgen_malloc);
385
+ const len1 = WASM_VECTOR_LEN;
386
+ const ret = wasm.batchExtractBytesSync(ptr0, len0, ptr1, len1, isLikeNone(config) ? 0 : addToExternrefTable0(config));
387
+ if (ret[2]) {
388
+ throw takeFromExternrefTable0(ret[1]);
389
+ }
390
+ return takeFromExternrefTable0(ret[0]);
391
+ }
392
+ exports.batchExtractBytesSync = batchExtractBytesSync;
393
+
394
+ /**
395
+ * Batch extract from multiple Files or Blobs (asynchronous).
396
+ *
397
+ * Processes multiple web File or Blob objects in parallel using the FileReader API.
398
+ * Only available in browser environments.
399
+ *
400
+ * # JavaScript Parameters
401
+ *
402
+ * * `files: (File | Blob)[]` - Array of files or blobs to extract
403
+ * * `config?: object` - Optional extraction configuration (applied to all)
404
+ *
405
+ * # Returns
406
+ *
407
+ * `Promise<object[]>` - Promise resolving to array of ExtractionResults
408
+ *
409
+ * # Example
410
+ *
411
+ * ```javascript
412
+ * import { batchExtractFiles } from '@kreuzberg/wasm';
413
+ *
414
+ * // From file input with multiple files
415
+ * const fileInput = document.getElementById('file-input');
416
+ * const files = Array.from(fileInput.files);
417
+ *
418
+ * const results = await batchExtractFiles(files, null);
419
+ * console.log(`Processed ${results.length} files`);
420
+ * ```
421
+ * @param {File[]} files
422
+ * @param {any | null} [config]
423
+ * @returns {Promise<any>}
424
+ */
425
+ function batchExtractFiles(files, config) {
426
+ const ptr0 = passArrayJsValueToWasm0(files, wasm.__wbindgen_malloc);
427
+ const len0 = WASM_VECTOR_LEN;
428
+ const ret = wasm.batchExtractFiles(ptr0, len0, isLikeNone(config) ? 0 : addToExternrefTable0(config));
429
+ return ret;
430
+ }
431
+ exports.batchExtractFiles = batchExtractFiles;
432
+
433
+ /**
434
+ * Batch extract from multiple files (synchronous) - NOT AVAILABLE IN WASM.
435
+ *
436
+ * File system operations are not available in WebAssembly environments.
437
+ * Use `batchExtractBytesSync` or `batchExtractBytes` instead.
438
+ *
439
+ * # Throws
440
+ *
441
+ * Always throws: "File operations are not available in WASM. Use batchExtractBytesSync or batchExtractBytes instead."
442
+ * @returns {any}
443
+ */
444
+ function batchExtractFilesSync() {
445
+ const ret = wasm.batchExtractFilesSync();
446
+ if (ret[2]) {
447
+ throw takeFromExternrefTable0(ret[1]);
448
+ }
449
+ return takeFromExternrefTable0(ret[0]);
450
+ }
451
+ exports.batchExtractFilesSync = batchExtractFilesSync;
452
+
453
+ /**
454
+ * Clear all registered OCR backends.
455
+ *
456
+ * # Returns
457
+ *
458
+ * Ok if clearing succeeds, Err if an error occurs.
459
+ *
460
+ * # Example
461
+ *
462
+ * ```javascript
463
+ * clearOcrBackends();
464
+ * ```
465
+ */
466
+ function clear_ocr_backends() {
467
+ const ret = wasm.clear_ocr_backends();
468
+ if (ret[1]) {
469
+ throw takeFromExternrefTable0(ret[0]);
470
+ }
471
+ }
472
+ exports.clear_ocr_backends = clear_ocr_backends;
473
+
474
+ /**
475
+ * Clear all registered post-processors.
476
+ *
477
+ * # Returns
478
+ *
479
+ * Ok if clearing succeeds, Err if an error occurs.
480
+ *
481
+ * # Example
482
+ *
483
+ * ```javascript
484
+ * clearPostProcessors();
485
+ * ```
486
+ */
487
+ function clear_post_processors() {
488
+ const ret = wasm.clear_post_processors();
489
+ if (ret[1]) {
490
+ throw takeFromExternrefTable0(ret[0]);
491
+ }
492
+ }
493
+ exports.clear_post_processors = clear_post_processors;
494
+
495
+ /**
496
+ * Clear all registered validators.
497
+ *
498
+ * # Returns
499
+ *
500
+ * Ok if clearing succeeds, Err if an error occurs.
501
+ *
502
+ * # Example
503
+ *
504
+ * ```javascript
505
+ * clearValidators();
506
+ * ```
507
+ */
508
+ function clear_validators() {
509
+ const ret = wasm.clear_validators();
510
+ if (ret[1]) {
511
+ throw takeFromExternrefTable0(ret[0]);
512
+ }
513
+ }
514
+ exports.clear_validators = clear_validators;
515
+
516
+ /**
517
+ * Detect MIME type from raw file bytes.
518
+ *
519
+ * Uses magic byte signatures and content analysis to detect the MIME type of
520
+ * a document from its binary content. Falls back to text detection if binary
521
+ * detection fails.
522
+ *
523
+ * # JavaScript Parameters
524
+ *
525
+ * * `data: Uint8Array` - The raw file bytes
526
+ *
527
+ * # Returns
528
+ *
529
+ * `string` - The detected MIME type (e.g., "application/pdf", "image/png")
530
+ *
531
+ * # Throws
532
+ *
533
+ * Throws an error if MIME type cannot be determined from the content.
534
+ *
535
+ * # Example
536
+ *
537
+ * ```javascript
538
+ * import { detectMimeFromBytes } from '@kreuzberg/wasm';
539
+ * import { readFileSync } from 'fs';
540
+ *
541
+ * const pdfBytes = readFileSync('document.pdf');
542
+ * const mimeType = detectMimeFromBytes(new Uint8Array(pdfBytes));
543
+ * console.log(mimeType); // "application/pdf"
544
+ * ```
545
+ * @param {Uint8Array} data
546
+ * @returns {string}
547
+ */
548
+ function detectMimeFromBytes(data) {
549
+ const ret = wasm.detectMimeFromBytes(data);
550
+ if (ret[3]) {
551
+ throw takeFromExternrefTable0(ret[2]);
552
+ }
553
+ var v1 = getCachedStringFromWasm0(ret[0], ret[1]);
554
+ if (ret[0] !== 0) { wasm.__wbindgen_free(ret[0], ret[1], 1); }
555
+ return v1;
556
+ }
557
+ exports.detectMimeFromBytes = detectMimeFromBytes;
558
+
559
+ /**
560
+ * Discover configuration file in the project hierarchy.
561
+ *
562
+ * In WebAssembly environments, configuration discovery is not available because
563
+ * there is no file system access. This function always returns an error with a
564
+ * descriptive message directing users to use `loadConfigFromString()` instead.
565
+ *
566
+ * # JavaScript Parameters
567
+ *
568
+ * None
569
+ *
570
+ * # Returns
571
+ *
572
+ * Never returns successfully.
573
+ *
574
+ * # Throws
575
+ *
576
+ * Always throws an error with message:
577
+ * "discoverConfig is not available in WebAssembly (no file system access). Use loadConfigFromString() instead."
578
+ *
579
+ * # Example
580
+ *
581
+ * ```javascript
582
+ * import { discoverConfig } from '@kreuzberg/wasm';
583
+ *
584
+ * try {
585
+ * const config = discoverConfig();
586
+ * } catch (e) {
587
+ * console.error(e.message);
588
+ * // "discoverConfig is not available in WebAssembly (no file system access).
589
+ * // Use loadConfigFromString() instead."
590
+ * }
591
+ * ```
592
+ * @returns {any}
593
+ */
594
+ function discoverConfig() {
595
+ const ret = wasm.discoverConfig();
596
+ if (ret[2]) {
597
+ throw takeFromExternrefTable0(ret[1]);
598
+ }
599
+ return takeFromExternrefTable0(ret[0]);
600
+ }
601
+ exports.discoverConfig = discoverConfig;
602
+
603
+ /**
604
+ * Extract content from a byte array (asynchronous).
605
+ *
606
+ * Asynchronously extracts text, tables, images, and metadata from a document.
607
+ * Non-blocking alternative to `extractBytesSync` suitable for large documents
608
+ * or browser environments.
609
+ *
610
+ * # JavaScript Parameters
611
+ *
612
+ * * `data: Uint8Array` - The document bytes to extract
613
+ * * `mimeType: string` - MIME type of the data (e.g., "application/pdf")
614
+ * * `config?: object` - Optional extraction configuration
615
+ *
616
+ * # Returns
617
+ *
618
+ * `Promise<object>` - Promise resolving to ExtractionResult
619
+ *
620
+ * # Throws
621
+ *
622
+ * Rejects if data is malformed or MIME type is unsupported.
623
+ *
624
+ * # Example
625
+ *
626
+ * ```javascript
627
+ * import { extractBytes } from '@kreuzberg/wasm';
628
+ *
629
+ * // Fetch from URL
630
+ * const response = await fetch('document.pdf');
631
+ * const arrayBuffer = await response.arrayBuffer();
632
+ * const data = new Uint8Array(arrayBuffer);
633
+ *
634
+ * const result = await extractBytes(data, 'application/pdf', null);
635
+ * console.log(result.content.substring(0, 100));
636
+ * ```
637
+ * @param {Uint8Array} data
638
+ * @param {string} mime_type
639
+ * @param {any | null} [config]
640
+ * @returns {Promise<any>}
641
+ */
642
+ function extractBytes(data, mime_type, config) {
643
+ const ptr0 = passStringToWasm0(mime_type, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
644
+ const len0 = WASM_VECTOR_LEN;
645
+ const ret = wasm.extractBytes(data, ptr0, len0, isLikeNone(config) ? 0 : addToExternrefTable0(config));
646
+ return ret;
647
+ }
648
+ exports.extractBytes = extractBytes;
649
+
650
+ /**
651
+ * Extract content from a byte array (synchronous).
652
+ *
653
+ * Extracts text, tables, images, and metadata from a document represented as bytes.
654
+ * This is a synchronous, blocking operation suitable for smaller documents or when
655
+ * async execution is not available.
656
+ *
657
+ * # JavaScript Parameters
658
+ *
659
+ * * `data: Uint8Array` - The document bytes to extract
660
+ * * `mimeType: string` - MIME type of the data (e.g., "application/pdf", "image/png")
661
+ * * `config?: object` - Optional extraction configuration
662
+ *
663
+ * # Returns
664
+ *
665
+ * `object` - ExtractionResult with extracted content and metadata
666
+ *
667
+ * # Throws
668
+ *
669
+ * Throws an error if data is malformed or MIME type is unsupported.
670
+ *
671
+ * # Example
672
+ *
673
+ * ```javascript
674
+ * import { extractBytesSync } from '@kreuzberg/wasm';
675
+ * import { readFileSync } from 'fs';
676
+ *
677
+ * const buffer = readFileSync('document.pdf');
678
+ * const data = new Uint8Array(buffer);
679
+ * const result = extractBytesSync(data, 'application/pdf', null);
680
+ * console.log(result.content);
681
+ * ```
682
+ * @param {Uint8Array} data
683
+ * @param {string} mime_type
684
+ * @param {any | null} [config]
685
+ * @returns {any}
686
+ */
687
+ function extractBytesSync(data, mime_type, config) {
688
+ const ptr0 = passStringToWasm0(mime_type, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
689
+ const len0 = WASM_VECTOR_LEN;
690
+ const ret = wasm.extractBytesSync(data, ptr0, len0, isLikeNone(config) ? 0 : addToExternrefTable0(config));
691
+ if (ret[2]) {
692
+ throw takeFromExternrefTable0(ret[1]);
693
+ }
694
+ return takeFromExternrefTable0(ret[0]);
695
+ }
696
+ exports.extractBytesSync = extractBytesSync;
697
+
698
+ /**
699
+ * Extract content from a web File or Blob (asynchronous).
700
+ *
701
+ * Extracts content from a web File (from `<input type="file">`) or Blob object
702
+ * using the FileReader API. Only available in browser environments.
703
+ *
704
+ * # JavaScript Parameters
705
+ *
706
+ * * `file: File | Blob` - The file or blob to extract
707
+ * * `mimeType?: string` - Optional MIME type hint (auto-detected if omitted)
708
+ * * `config?: object` - Optional extraction configuration
709
+ *
710
+ * # Returns
711
+ *
712
+ * `Promise<object>` - Promise resolving to ExtractionResult
713
+ *
714
+ * # Throws
715
+ *
716
+ * Rejects if file cannot be read or is malformed.
717
+ *
718
+ * # Example
719
+ *
720
+ * ```javascript
721
+ * import { extractFile } from '@kreuzberg/wasm';
722
+ *
723
+ * // From file input
724
+ * const fileInput = document.getElementById('file-input');
725
+ * const file = fileInput.files[0];
726
+ *
727
+ * const result = await extractFile(file, null, null);
728
+ * console.log(`Extracted ${result.content.length} characters`);
729
+ * ```
730
+ * @param {File} file
731
+ * @param {string | null} [mime_type]
732
+ * @param {any | null} [config]
733
+ * @returns {Promise<any>}
734
+ */
735
+ function extractFile(file, mime_type, config) {
736
+ var ptr0 = isLikeNone(mime_type) ? 0 : passStringToWasm0(mime_type, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
737
+ var len0 = WASM_VECTOR_LEN;
738
+ const ret = wasm.extractFile(file, ptr0, len0, isLikeNone(config) ? 0 : addToExternrefTable0(config));
739
+ return ret;
740
+ }
741
+ exports.extractFile = extractFile;
742
+
743
+ /**
744
+ * Extract content from a file (synchronous) - NOT AVAILABLE IN WASM.
745
+ *
746
+ * File system operations are not available in WebAssembly environments.
747
+ * Use `extractBytesSync` or `extractBytes` instead.
748
+ *
749
+ * # Throws
750
+ *
751
+ * Always throws: "File operations are not available in WASM. Use extractBytesSync or extractBytes instead."
752
+ * @returns {any}
753
+ */
754
+ function extractFileSync() {
755
+ const ret = wasm.extractFileSync();
756
+ if (ret[2]) {
757
+ throw takeFromExternrefTable0(ret[1]);
758
+ }
759
+ return takeFromExternrefTable0(ret[0]);
760
+ }
761
+ exports.extractFileSync = extractFileSync;
762
+
763
+ /**
764
+ * Get file extensions for a given MIME type.
765
+ *
766
+ * Looks up all known file extensions that correspond to the specified MIME type.
767
+ * Returns a JavaScript Array of extension strings (without leading dots).
768
+ *
769
+ * # JavaScript Parameters
770
+ *
771
+ * * `mimeType: string` - The MIME type to look up (e.g., "application/pdf")
772
+ *
773
+ * # Returns
774
+ *
775
+ * `string[]` - Array of file extensions for the MIME type
776
+ *
777
+ * # Throws
778
+ *
779
+ * Throws an error if the MIME type is not recognized.
780
+ *
781
+ * # Example
782
+ *
783
+ * ```javascript
784
+ * import { getExtensionsForMime } from '@kreuzberg/wasm';
785
+ *
786
+ * const pdfExts = getExtensionsForMime('application/pdf');
787
+ * console.log(pdfExts); // ["pdf"]
788
+ *
789
+ * const jpegExts = getExtensionsForMime('image/jpeg');
790
+ * console.log(jpegExts); // ["jpg", "jpeg"]
791
+ * ```
792
+ * @param {string} mime_type
793
+ * @returns {Array<any>}
794
+ */
795
+ function getExtensionsForMime(mime_type) {
796
+ const ptr0 = passStringToWasm0(mime_type, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
797
+ const len0 = WASM_VECTOR_LEN;
798
+ const ret = wasm.getExtensionsForMime(ptr0, len0);
799
+ if (ret[2]) {
800
+ throw takeFromExternrefTable0(ret[1]);
801
+ }
802
+ return takeFromExternrefTable0(ret[0]);
803
+ }
804
+ exports.getExtensionsForMime = getExtensionsForMime;
805
+
806
+ /**
807
+ * Get MIME type from file extension.
808
+ *
809
+ * Looks up the MIME type associated with a given file extension.
810
+ * Returns None if the extension is not recognized.
811
+ *
812
+ * # JavaScript Parameters
813
+ *
814
+ * * `extension: string` - The file extension (with or without leading dot)
815
+ *
816
+ * # Returns
817
+ *
818
+ * `string | null` - The MIME type if found, null otherwise
819
+ *
820
+ * # Example
821
+ *
822
+ * ```javascript
823
+ * import { getMimeFromExtension } from '@kreuzberg/wasm';
824
+ *
825
+ * const pdfMime = getMimeFromExtension('pdf');
826
+ * console.log(pdfMime); // "application/pdf"
827
+ *
828
+ * const docMime = getMimeFromExtension('docx');
829
+ * console.log(docMime); // "application/vnd.openxmlformats-officedocument.wordprocessingml.document"
830
+ *
831
+ * const unknownMime = getMimeFromExtension('unknown');
832
+ * console.log(unknownMime); // null
833
+ * ```
834
+ * @param {string} extension
835
+ * @returns {string}
836
+ */
837
+ function getMimeFromExtension(extension) {
838
+ const ptr0 = passStringToWasm0(extension, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
839
+ const len0 = WASM_VECTOR_LEN;
840
+ const ret = wasm.getMimeFromExtension(ptr0, len0);
841
+ var v2 = getCachedStringFromWasm0(ret[0], ret[1]);
842
+ if (ret[0] !== 0) { wasm.__wbindgen_free(ret[0], ret[1], 1); }
843
+ return v2;
844
+ }
845
+ exports.getMimeFromExtension = getMimeFromExtension;
846
+
847
+ /**
848
+ * Get module information
849
+ * @returns {ModuleInfo}
850
+ */
851
+ function get_module_info() {
852
+ const ret = wasm.get_module_info();
853
+ return ModuleInfo.__wrap(ret);
854
+ }
855
+ exports.get_module_info = get_module_info;
856
+
857
+ /**
858
+ * Initialize the WASM module
859
+ * This function should be called once at application startup
860
+ */
861
+ function init() {
862
+ wasm.init();
863
+ }
864
+ exports.init = init;
865
+
866
+ /**
867
+ * @param {number} _num_threads
868
+ * @returns {Promise<any>}
869
+ */
870
+ function initThreadPool(_num_threads) {
871
+ const ret = wasm.initThreadPool(_num_threads);
872
+ return ret;
873
+ }
874
+ exports.initThreadPool = initThreadPool;
875
+
876
+ /**
877
+ * Helper function to initialize the thread pool with error handling
878
+ * Accepts the number of threads to use for the thread pool.
879
+ * Returns true if initialization succeeded, false for graceful degradation.
880
+ *
881
+ * This function wraps init_thread_pool with panic handling to ensure graceful
882
+ * degradation if thread pool initialization fails. The application will continue
883
+ * to work in single-threaded mode if the thread pool cannot be initialized.
884
+ * @param {number} num_threads
885
+ * @returns {boolean}
886
+ */
887
+ function init_thread_pool_safe(num_threads) {
888
+ const ret = wasm.init_thread_pool_safe(num_threads);
889
+ return ret !== 0;
890
+ }
891
+ exports.init_thread_pool_safe = init_thread_pool_safe;
892
+
893
+ /**
894
+ * Establishes a binding between an external Pdfium WASM module and `pdfium-render`'s WASM module.
895
+ * This function should be called from Javascript once the external Pdfium WASM module has been loaded
896
+ * into the browser. It is essential that this function is called _before_ initializing
897
+ * `pdfium-render` from within Rust code. For an example, see:
898
+ * <https://github.com/ajrcarey/pdfium-render/blob/master/examples/index.html>
899
+ * @param {any} pdfium_wasm_module
900
+ * @param {any} local_wasm_module
901
+ * @param {boolean} debug
902
+ * @returns {boolean}
903
+ */
904
+ function initialize_pdfium_render(pdfium_wasm_module, local_wasm_module, debug) {
905
+ const ret = wasm.initialize_pdfium_render(pdfium_wasm_module, local_wasm_module, debug);
906
+ return ret !== 0;
907
+ }
908
+ exports.initialize_pdfium_render = initialize_pdfium_render;
909
+
910
+ /**
911
+ * List all registered OCR backend names.
912
+ *
913
+ * # Returns
914
+ *
915
+ * Array of OCR backend names, or Err if an error occurs.
916
+ *
917
+ * # Example
918
+ *
919
+ * ```javascript
920
+ * const backends = listOcrBackends();
921
+ * console.log(backends); // ["tesseract", "custom-ocr", ...]
922
+ * ```
923
+ * @returns {Array<any>}
924
+ */
925
+ function list_ocr_backends() {
926
+ const ret = wasm.list_ocr_backends();
927
+ if (ret[2]) {
928
+ throw takeFromExternrefTable0(ret[1]);
929
+ }
930
+ return takeFromExternrefTable0(ret[0]);
931
+ }
932
+ exports.list_ocr_backends = list_ocr_backends;
933
+
934
+ /**
935
+ * List all registered post-processor names.
936
+ *
937
+ * # Returns
938
+ *
939
+ * Array of post-processor names, or Err if an error occurs.
940
+ *
941
+ * # Example
942
+ *
943
+ * ```javascript
944
+ * const processors = listPostProcessors();
945
+ * console.log(processors); // ["my-post-processor", ...]
946
+ * ```
947
+ * @returns {Array<any>}
948
+ */
949
+ function list_post_processors() {
950
+ const ret = wasm.list_post_processors();
951
+ if (ret[2]) {
952
+ throw takeFromExternrefTable0(ret[1]);
953
+ }
954
+ return takeFromExternrefTable0(ret[0]);
955
+ }
956
+ exports.list_post_processors = list_post_processors;
957
+
958
+ /**
959
+ * List all registered validator names.
960
+ *
961
+ * # Returns
962
+ *
963
+ * Array of validator names, or Err if an error occurs.
964
+ *
965
+ * # Example
966
+ *
967
+ * ```javascript
968
+ * const validators = listValidators();
969
+ * console.log(validators); // ["min-content-length", ...]
970
+ * ```
971
+ * @returns {Array<any>}
972
+ */
973
+ function list_validators() {
974
+ const ret = wasm.list_validators();
975
+ if (ret[2]) {
976
+ throw takeFromExternrefTable0(ret[1]);
977
+ }
978
+ return takeFromExternrefTable0(ret[0]);
979
+ }
980
+ exports.list_validators = list_validators;
981
+
982
+ /**
983
+ * Load configuration from a string in the specified format.
984
+ *
985
+ * Parses configuration content from TOML, YAML, or JSON formats and returns
986
+ * a JavaScript object representing the ExtractionConfig. This is the primary
987
+ * way to load configuration in WebAssembly environments since file system
988
+ * access is not available.
989
+ *
990
+ * # JavaScript Parameters
991
+ *
992
+ * * `content: string` - The configuration content as a string
993
+ * * `format: string` - The format of the content: "toml", "yaml", or "json"
994
+ *
995
+ * # Returns
996
+ *
997
+ * `object` - JavaScript object representing the ExtractionConfig
998
+ *
999
+ * # Throws
1000
+ *
1001
+ * Throws an error if:
1002
+ * - The content is invalid for the specified format
1003
+ * - The format is not one of "toml", "yaml", or "json"
1004
+ * - Required configuration fields are missing or invalid
1005
+ *
1006
+ * # Example
1007
+ *
1008
+ * ```javascript
1009
+ * import { loadConfigFromString } from '@kreuzberg/wasm';
1010
+ *
1011
+ * // Load from TOML string
1012
+ * const tomlConfig = `
1013
+ * use_cache = true
1014
+ * enable_quality_processing = true
1015
+ * `;
1016
+ * const config1 = loadConfigFromString(tomlConfig, 'toml');
1017
+ * console.log(config1.use_cache); // true
1018
+ *
1019
+ * // Load from YAML string
1020
+ * const yamlConfig = `
1021
+ * use_cache: true
1022
+ * enable_quality_processing: true
1023
+ * `;
1024
+ * const config2 = loadConfigFromString(yamlConfig, 'yaml');
1025
+ *
1026
+ * // Load from JSON string
1027
+ * const jsonConfig = `{"use_cache": true, "enable_quality_processing": true}`;
1028
+ * const config3 = loadConfigFromString(jsonConfig, 'json');
1029
+ * ```
1030
+ * @param {string} content
1031
+ * @param {string} format
1032
+ * @returns {any}
1033
+ */
1034
+ function loadConfigFromString(content, format) {
1035
+ const ptr0 = passStringToWasm0(content, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1036
+ const len0 = WASM_VECTOR_LEN;
1037
+ const ptr1 = passStringToWasm0(format, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1038
+ const len1 = WASM_VECTOR_LEN;
1039
+ const ret = wasm.loadConfigFromString(ptr0, len0, ptr1, len1);
1040
+ if (ret[2]) {
1041
+ throw takeFromExternrefTable0(ret[1]);
1042
+ }
1043
+ return takeFromExternrefTable0(ret[0]);
1044
+ }
1045
+ exports.loadConfigFromString = loadConfigFromString;
1046
+
1047
+ /**
1048
+ * Normalize a MIME type string.
1049
+ *
1050
+ * Normalizes a MIME type by converting to lowercase and removing parameters
1051
+ * (e.g., "application/json; charset=utf-8" becomes "application/json").
1052
+ * This is useful for consistent MIME type comparison.
1053
+ *
1054
+ * # JavaScript Parameters
1055
+ *
1056
+ * * `mimeType: string` - The MIME type string to normalize
1057
+ *
1058
+ * # Returns
1059
+ *
1060
+ * `string` - The normalized MIME type
1061
+ *
1062
+ * # Example
1063
+ *
1064
+ * ```javascript
1065
+ * import { normalizeMimeType } from '@kreuzberg/wasm';
1066
+ *
1067
+ * const normalized1 = normalizeMimeType('Application/JSON');
1068
+ * console.log(normalized1); // "application/json"
1069
+ *
1070
+ * const normalized2 = normalizeMimeType('text/html; charset=utf-8');
1071
+ * console.log(normalized2); // "text/html"
1072
+ *
1073
+ * const normalized3 = normalizeMimeType('Text/Plain; charset=ISO-8859-1');
1074
+ * console.log(normalized3); // "text/plain"
1075
+ * ```
1076
+ * @param {string} mime_type
1077
+ * @returns {string}
1078
+ */
1079
+ function normalizeMimeType(mime_type) {
1080
+ const ptr0 = passStringToWasm0(mime_type, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1081
+ const len0 = WASM_VECTOR_LEN;
1082
+ const ret = wasm.normalizeMimeType(ptr0, len0);
1083
+ var v2 = getCachedStringFromWasm0(ret[0], ret[1]);
1084
+ if (ret[0] !== 0) { wasm.__wbindgen_free(ret[0], ret[1], 1); }
1085
+ return v2;
1086
+ }
1087
+ exports.normalizeMimeType = normalizeMimeType;
1088
+
1089
+ /**
1090
+ * A callback function that can be invoked by Pdfium's `FPDF_LoadCustomDocument()` function,
1091
+ * wrapping around `crate::utils::files::read_block_from_callback()` to shuffle data buffers
1092
+ * from our WASM memory heap to Pdfium's WASM memory heap as they are loaded.
1093
+ * @param {number} param
1094
+ * @param {number} position
1095
+ * @param {number} pBuf
1096
+ * @param {number} size
1097
+ * @returns {number}
1098
+ */
1099
+ function read_block_from_callback_wasm(param, position, pBuf, size) {
1100
+ const ret = wasm.read_block_from_callback_wasm(param, position, pBuf, size);
1101
+ return ret;
1102
+ }
1103
+ exports.read_block_from_callback_wasm = read_block_from_callback_wasm;
1104
+
1105
+ /**
1106
+ * Register a custom OCR backend.
1107
+ *
1108
+ * # Arguments
1109
+ *
1110
+ * * `backend` - JavaScript object implementing the OcrBackendProtocol interface:
1111
+ * - `name(): string` - Unique backend name
1112
+ * - `supportedLanguages(): string[]` - Array of language codes the backend supports
1113
+ * - `processImage(imageBase64: string, language: string): Promise<string>` - Process image and return JSON result
1114
+ *
1115
+ * # Returns
1116
+ *
1117
+ * Ok if registration succeeds, Err with description if it fails.
1118
+ *
1119
+ * # Example
1120
+ *
1121
+ * ```javascript
1122
+ * registerOcrBackend({
1123
+ * name: () => "custom-ocr",
1124
+ * supportedLanguages: () => ["en", "es", "fr"],
1125
+ * processImage: async (imageBase64, language) => {
1126
+ * const buffer = Buffer.from(imageBase64, "base64");
1127
+ * // Process image with custom OCR engine
1128
+ * const text = await customOcrEngine.recognize(buffer, language);
1129
+ * return JSON.stringify({
1130
+ * content: text,
1131
+ * mime_type: "text/plain",
1132
+ * metadata: {}
1133
+ * });
1134
+ * }
1135
+ * });
1136
+ * ```
1137
+ * @param {any} backend
1138
+ */
1139
+ function register_ocr_backend(backend) {
1140
+ const ret = wasm.register_ocr_backend(backend);
1141
+ if (ret[1]) {
1142
+ throw takeFromExternrefTable0(ret[0]);
1143
+ }
1144
+ }
1145
+ exports.register_ocr_backend = register_ocr_backend;
1146
+
1147
+ /**
1148
+ * Register a custom post-processor.
1149
+ *
1150
+ * # Arguments
1151
+ *
1152
+ * * `processor` - JavaScript object implementing the PostProcessorProtocol interface:
1153
+ * - `name(): string` - Unique processor name
1154
+ * - `process(jsonString: string): Promise<string>` - Process function that takes JSON input
1155
+ * - `processingStage(): "early" | "middle" | "late"` - Optional processing stage (defaults to "middle")
1156
+ *
1157
+ * # Returns
1158
+ *
1159
+ * Ok if registration succeeds, Err with description if it fails.
1160
+ *
1161
+ * # Example
1162
+ *
1163
+ * ```javascript
1164
+ * registerPostProcessor({
1165
+ * name: () => "my-post-processor",
1166
+ * processingStage: () => "middle",
1167
+ * process: async (jsonString) => {
1168
+ * const result = JSON.parse(jsonString);
1169
+ * // Process the extraction result
1170
+ * result.metadata.processed_by = "my-post-processor";
1171
+ * return JSON.stringify(result);
1172
+ * }
1173
+ * });
1174
+ * ```
1175
+ * @param {any} processor
1176
+ */
1177
+ function register_post_processor(processor) {
1178
+ const ret = wasm.register_post_processor(processor);
1179
+ if (ret[1]) {
1180
+ throw takeFromExternrefTable0(ret[0]);
1181
+ }
1182
+ }
1183
+ exports.register_post_processor = register_post_processor;
1184
+
1185
+ /**
1186
+ * Register a custom validator.
1187
+ *
1188
+ * # Arguments
1189
+ *
1190
+ * * `validator` - JavaScript object implementing the ValidatorProtocol interface:
1191
+ * - `name(): string` - Unique validator name
1192
+ * - `validate(jsonString: string): Promise<string>` - Validation function returning empty string on success, error message on failure
1193
+ * - `priority(): number` - Optional priority (defaults to 50, higher runs first)
1194
+ *
1195
+ * # Returns
1196
+ *
1197
+ * Ok if registration succeeds, Err with description if it fails.
1198
+ *
1199
+ * # Example
1200
+ *
1201
+ * ```javascript
1202
+ * registerValidator({
1203
+ * name: () => "min-content-length",
1204
+ * priority: () => 100,
1205
+ * validate: async (jsonString) => {
1206
+ * const result = JSON.parse(jsonString);
1207
+ * if (result.content.length < 100) {
1208
+ * return "Content too short"; // Validation failure
1209
+ * }
1210
+ * return ""; // Success
1211
+ * }
1212
+ * });
1213
+ * ```
1214
+ * @param {any} validator
1215
+ */
1216
+ function register_validator(validator) {
1217
+ const ret = wasm.register_validator(validator);
1218
+ if (ret[1]) {
1219
+ throw takeFromExternrefTable0(ret[0]);
1220
+ }
1221
+ }
1222
+ exports.register_validator = register_validator;
1223
+
1224
+ /**
1225
+ * Unregister an OCR backend by name.
1226
+ *
1227
+ * # Arguments
1228
+ *
1229
+ * * `name` - Name of the OCR backend to unregister
1230
+ *
1231
+ * # Returns
1232
+ *
1233
+ * Ok if unregistration succeeds, Err if the backend is not found or other error occurs.
1234
+ *
1235
+ * # Example
1236
+ *
1237
+ * ```javascript
1238
+ * unregisterOcrBackend("custom-ocr");
1239
+ * ```
1240
+ * @param {string} name
1241
+ */
1242
+ function unregister_ocr_backend(name) {
1243
+ const ptr0 = passStringToWasm0(name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1244
+ const len0 = WASM_VECTOR_LEN;
1245
+ const ret = wasm.unregister_ocr_backend(ptr0, len0);
1246
+ if (ret[1]) {
1247
+ throw takeFromExternrefTable0(ret[0]);
1248
+ }
1249
+ }
1250
+ exports.unregister_ocr_backend = unregister_ocr_backend;
1251
+
1252
+ /**
1253
+ * Unregister a post-processor by name.
1254
+ *
1255
+ * # Arguments
1256
+ *
1257
+ * * `name` - Name of the post-processor to unregister
1258
+ *
1259
+ * # Returns
1260
+ *
1261
+ * Ok if unregistration succeeds, Err if the processor is not found or other error occurs.
1262
+ *
1263
+ * # Example
1264
+ *
1265
+ * ```javascript
1266
+ * unregisterPostProcessor("my-post-processor");
1267
+ * ```
1268
+ * @param {string} name
1269
+ */
1270
+ function unregister_post_processor(name) {
1271
+ const ptr0 = passStringToWasm0(name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1272
+ const len0 = WASM_VECTOR_LEN;
1273
+ const ret = wasm.unregister_post_processor(ptr0, len0);
1274
+ if (ret[1]) {
1275
+ throw takeFromExternrefTable0(ret[0]);
1276
+ }
1277
+ }
1278
+ exports.unregister_post_processor = unregister_post_processor;
1279
+
1280
+ /**
1281
+ * Unregister a validator by name.
1282
+ *
1283
+ * # Arguments
1284
+ *
1285
+ * * `name` - Name of the validator to unregister
1286
+ *
1287
+ * # Returns
1288
+ *
1289
+ * Ok if unregistration succeeds, Err if the validator is not found or other error occurs.
1290
+ *
1291
+ * # Example
1292
+ *
1293
+ * ```javascript
1294
+ * unregisterValidator("min-content-length");
1295
+ * ```
1296
+ * @param {string} name
1297
+ */
1298
+ function unregister_validator(name) {
1299
+ const ptr0 = passStringToWasm0(name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1300
+ const len0 = WASM_VECTOR_LEN;
1301
+ const ret = wasm.unregister_validator(ptr0, len0);
1302
+ if (ret[1]) {
1303
+ throw takeFromExternrefTable0(ret[0]);
1304
+ }
1305
+ }
1306
+ exports.unregister_validator = unregister_validator;
1307
+
1308
+ /**
1309
+ * Version of the kreuzberg-wasm binding
1310
+ * @returns {string}
1311
+ */
1312
+ function version() {
1313
+ const ret = wasm.version();
1314
+ var v1 = getCachedStringFromWasm0(ret[0], ret[1]);
1315
+ if (ret[0] !== 0) { wasm.__wbindgen_free(ret[0], ret[1], 1); }
1316
+ return v1;
1317
+ }
1318
+ exports.version = version;
1319
+
1320
+ /**
1321
+ * A callback function that can be invoked by Pdfium's `FPDF_SaveAsCopy()` and `FPDF_SaveWithVersion()`
1322
+ * functions, wrapping around `crate::utils::files::write_block_from_callback()` to shuffle data buffers
1323
+ * from Pdfium's WASM memory heap to our WASM memory heap as they are written.
1324
+ * @param {number} param
1325
+ * @param {number} buf
1326
+ * @param {number} size
1327
+ * @returns {number}
1328
+ */
1329
+ function write_block_from_callback_wasm(param, buf, size) {
1330
+ const ret = wasm.write_block_from_callback_wasm(param, buf, size);
1331
+ return ret;
1332
+ }
1333
+ exports.write_block_from_callback_wasm = write_block_from_callback_wasm;
1334
+
1335
+ exports.__wbg_Error_52673b7de5a0ca89 = function(arg0, arg1) {
1336
+ var v0 = getCachedStringFromWasm0(arg0, arg1);
1337
+ const ret = Error(v0);
1338
+ return ret;
1339
+ };
1340
+
1341
+ exports.__wbg_Number_2d1dcfcf4ec51736 = function(arg0) {
1342
+ const ret = Number(arg0);
1343
+ return ret;
1344
+ };
1345
+
1346
+ exports.__wbg_String_8f0eb39a4a4c2f66 = function(arg0, arg1) {
1347
+ const ret = String(arg1);
1348
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1349
+ const len1 = WASM_VECTOR_LEN;
1350
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
1351
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
1352
+ };
1353
+
1354
+ exports.__wbg___wbindgen_bigint_get_as_i64_6e32f5e6aff02e1d = function(arg0, arg1) {
1355
+ const v = arg1;
1356
+ const ret = typeof(v) === 'bigint' ? v : undefined;
1357
+ getDataViewMemory0().setBigInt64(arg0 + 8 * 1, isLikeNone(ret) ? BigInt(0) : ret, true);
1358
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
1359
+ };
1360
+
1361
+ exports.__wbg___wbindgen_boolean_get_dea25b33882b895b = function(arg0) {
1362
+ const v = arg0;
1363
+ const ret = typeof(v) === 'boolean' ? v : undefined;
1364
+ return isLikeNone(ret) ? 0xFFFFFF : ret ? 1 : 0;
1365
+ };
1366
+
1367
+ exports.__wbg___wbindgen_debug_string_adfb662ae34724b6 = function(arg0, arg1) {
1368
+ const ret = debugString(arg1);
1369
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1370
+ const len1 = WASM_VECTOR_LEN;
1371
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
1372
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
1373
+ };
1374
+
1375
+ exports.__wbg___wbindgen_in_0d3e1e8f0c669317 = function(arg0, arg1) {
1376
+ const ret = arg0 in arg1;
1377
+ return ret;
1378
+ };
1379
+
1380
+ exports.__wbg___wbindgen_is_bigint_0e1a2e3f55cfae27 = function(arg0) {
1381
+ const ret = typeof(arg0) === 'bigint';
1382
+ return ret;
1383
+ };
1384
+
1385
+ exports.__wbg___wbindgen_is_function_8d400b8b1af978cd = function(arg0) {
1386
+ const ret = typeof(arg0) === 'function';
1387
+ return ret;
1388
+ };
1389
+
1390
+ exports.__wbg___wbindgen_is_object_ce774f3490692386 = function(arg0) {
1391
+ const val = arg0;
1392
+ const ret = typeof(val) === 'object' && val !== null;
1393
+ return ret;
1394
+ };
1395
+
1396
+ exports.__wbg___wbindgen_is_string_704ef9c8fc131030 = function(arg0) {
1397
+ const ret = typeof(arg0) === 'string';
1398
+ return ret;
1399
+ };
1400
+
1401
+ exports.__wbg___wbindgen_is_undefined_f6b95eab589e0269 = function(arg0) {
1402
+ const ret = arg0 === undefined;
1403
+ return ret;
1404
+ };
1405
+
1406
+ exports.__wbg___wbindgen_jsval_eq_b6101cc9cef1fe36 = function(arg0, arg1) {
1407
+ const ret = arg0 === arg1;
1408
+ return ret;
1409
+ };
1410
+
1411
+ exports.__wbg___wbindgen_jsval_loose_eq_766057600fdd1b0d = function(arg0, arg1) {
1412
+ const ret = arg0 == arg1;
1413
+ return ret;
1414
+ };
1415
+
1416
+ exports.__wbg___wbindgen_number_get_9619185a74197f95 = function(arg0, arg1) {
1417
+ const obj = arg1;
1418
+ const ret = typeof(obj) === 'number' ? obj : undefined;
1419
+ getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true);
1420
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
1421
+ };
1422
+
1423
+ exports.__wbg___wbindgen_string_get_a2a31e16edf96e42 = function(arg0, arg1) {
1424
+ const obj = arg1;
1425
+ const ret = typeof(obj) === 'string' ? obj : undefined;
1426
+ var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1427
+ var len1 = WASM_VECTOR_LEN;
1428
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
1429
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
1430
+ };
1431
+
1432
+ exports.__wbg___wbindgen_throw_dd24417ed36fc46e = function(arg0, arg1) {
1433
+ var v0 = getCachedStringFromWasm0(arg0, arg1);
1434
+ throw new Error(v0);
1435
+ };
1436
+
1437
+ exports.__wbg__wbg_cb_unref_87dfb5aaa0cbcea7 = function(arg0) {
1438
+ arg0._wbg_cb_unref();
1439
+ };
1440
+
1441
+ exports.__wbg_addEventListener_6a82629b3d430a48 = function() { return handleError(function (arg0, arg1, arg2, arg3) {
1442
+ var v0 = getCachedStringFromWasm0(arg1, arg2);
1443
+ arg0.addEventListener(v0, arg3);
1444
+ }, arguments) };
1445
+
1446
+ exports.__wbg_apply_52e9ae668d017009 = function() { return handleError(function (arg0, arg1, arg2) {
1447
+ const ret = arg0.apply(arg1, arg2);
1448
+ return ret;
1449
+ }, arguments) };
1450
+
1451
+ exports.__wbg_call_3020136f7a2d6e44 = function() { return handleError(function (arg0, arg1, arg2) {
1452
+ const ret = arg0.call(arg1, arg2);
1453
+ return ret;
1454
+ }, arguments) };
1455
+
1456
+ exports.__wbg_call_abb4ff46ce38be40 = function() { return handleError(function (arg0, arg1) {
1457
+ const ret = arg0.call(arg1);
1458
+ return ret;
1459
+ }, arguments) };
1460
+
1461
+ exports.__wbg_call_c8baa5c5e72d274e = function() { return handleError(function (arg0, arg1, arg2, arg3) {
1462
+ const ret = arg0.call(arg1, arg2, arg3);
1463
+ return ret;
1464
+ }, arguments) };
1465
+
1466
+ exports.__wbg_construct_8d61a09a064d7a0e = function() { return handleError(function (arg0, arg1) {
1467
+ const ret = Reflect.construct(arg0, arg1);
1468
+ return ret;
1469
+ }, arguments) };
1470
+
1471
+ exports.__wbg_debug_9d0c87ddda3dc485 = function(arg0) {
1472
+ console.debug(arg0);
1473
+ };
1474
+
1475
+ exports.__wbg_decode_47d91d32f8c229af = function() { return handleError(function (arg0, arg1, arg2, arg3) {
1476
+ const ret = arg1.decode(getArrayU8FromWasm0(arg2, arg3));
1477
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1478
+ const len1 = WASM_VECTOR_LEN;
1479
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
1480
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
1481
+ }, arguments) };
1482
+
1483
+ exports.__wbg_done_62ea16af4ce34b24 = function(arg0) {
1484
+ const ret = arg0.done;
1485
+ return ret;
1486
+ };
1487
+
1488
+ exports.__wbg_entries_83c79938054e065f = function(arg0) {
1489
+ const ret = Object.entries(arg0);
1490
+ return ret;
1491
+ };
1492
+
1493
+ exports.__wbg_error_7534b8e9a36f1ab4 = function(arg0, arg1) {
1494
+ var v0 = getCachedStringFromWasm0(arg0, arg1);
1495
+ if (arg0 !== 0) { wasm.__wbindgen_free(arg0, arg1, 1); }
1496
+ console.error(v0);
1497
+ };
1498
+
1499
+ exports.__wbg_error_7bc7d576a6aaf855 = function(arg0) {
1500
+ console.error(arg0);
1501
+ };
1502
+
1503
+ exports.__wbg_from_29a8414a7a7cd19d = function(arg0) {
1504
+ const ret = Array.from(arg0);
1505
+ return ret;
1506
+ };
1507
+
1508
+ exports.__wbg_getRandomValues_1c61fac11405ffdc = function() { return handleError(function (arg0, arg1) {
1509
+ globalThis.crypto.getRandomValues(getArrayU8FromWasm0(arg0, arg1));
1510
+ }, arguments) };
1511
+
1512
+ exports.__wbg_getTime_ad1e9878a735af08 = function(arg0) {
1513
+ const ret = arg0.getTime();
1514
+ return ret;
1515
+ };
1516
+
1517
+ exports.__wbg_get_16458e8ef25ea5fa = function() { return handleError(function (arg0, arg1) {
1518
+ const ret = arg0.get(arg1 >>> 0);
1519
+ return ret;
1520
+ }, arguments) };
1521
+
1522
+ exports.__wbg_get_6b7bd52aca3f9671 = function(arg0, arg1) {
1523
+ const ret = arg0[arg1 >>> 0];
1524
+ return ret;
1525
+ };
1526
+
1527
+ exports.__wbg_get_af9dab7e9603ea93 = function() { return handleError(function (arg0, arg1) {
1528
+ const ret = Reflect.get(arg0, arg1);
1529
+ return ret;
1530
+ }, arguments) };
1531
+
1532
+ exports.__wbg_get_index_4e7b3f629a0ab9cd = function(arg0, arg1) {
1533
+ const ret = arg0[arg1 >>> 0];
1534
+ return ret;
1535
+ };
1536
+
1537
+ exports.__wbg_get_with_ref_key_1dc361bd10053bfe = function(arg0, arg1) {
1538
+ const ret = arg0[arg1];
1539
+ return ret;
1540
+ };
1541
+
1542
+ exports.__wbg_info_ce6bcc489c22f6f0 = function(arg0) {
1543
+ console.info(arg0);
1544
+ };
1545
+
1546
+ exports.__wbg_instanceof_ArrayBuffer_f3320d2419cd0355 = function(arg0) {
1547
+ let result;
1548
+ try {
1549
+ result = arg0 instanceof ArrayBuffer;
1550
+ } catch (_) {
1551
+ result = false;
1552
+ }
1553
+ const ret = result;
1554
+ return ret;
1555
+ };
1556
+
1557
+ exports.__wbg_instanceof_Map_084be8da74364158 = function(arg0) {
1558
+ let result;
1559
+ try {
1560
+ result = arg0 instanceof Map;
1561
+ } catch (_) {
1562
+ result = false;
1563
+ }
1564
+ const ret = result;
1565
+ return ret;
1566
+ };
1567
+
1568
+ exports.__wbg_instanceof_Uint8Array_da54ccc9d3e09434 = function(arg0) {
1569
+ let result;
1570
+ try {
1571
+ result = arg0 instanceof Uint8Array;
1572
+ } catch (_) {
1573
+ result = false;
1574
+ }
1575
+ const ret = result;
1576
+ return ret;
1577
+ };
1578
+
1579
+ exports.__wbg_isArray_51fd9e6422c0a395 = function(arg0) {
1580
+ const ret = Array.isArray(arg0);
1581
+ return ret;
1582
+ };
1583
+
1584
+ exports.__wbg_isSafeInteger_ae7d3f054d55fa16 = function(arg0) {
1585
+ const ret = Number.isSafeInteger(arg0);
1586
+ return ret;
1587
+ };
1588
+
1589
+ exports.__wbg_iterator_27b7c8b35ab3e86b = function() {
1590
+ const ret = Symbol.iterator;
1591
+ return ret;
1592
+ };
1593
+
1594
+ exports.__wbg_length_22ac23eaec9d8053 = function(arg0) {
1595
+ const ret = arg0.length;
1596
+ return ret;
1597
+ };
1598
+
1599
+ exports.__wbg_length_3a9ca660d3d3391b = function(arg0) {
1600
+ const ret = arg0.length;
1601
+ return ret;
1602
+ };
1603
+
1604
+ exports.__wbg_length_bd124cfd1a9444fe = function(arg0) {
1605
+ const ret = arg0.length;
1606
+ return ret;
1607
+ };
1608
+
1609
+ exports.__wbg_length_d45040a40c570362 = function(arg0) {
1610
+ const ret = arg0.length;
1611
+ return ret;
1612
+ };
1613
+
1614
+ exports.__wbg_log_1d990106d99dacb7 = function(arg0) {
1615
+ console.log(arg0);
1616
+ };
1617
+
1618
+ exports.__wbg_new_0_23cedd11d9b40c9d = function() {
1619
+ const ret = new Date();
1620
+ return ret;
1621
+ };
1622
+
1623
+ exports.__wbg_new_111dde64cffa8ba1 = function() { return handleError(function () {
1624
+ const ret = new FileReader();
1625
+ return ret;
1626
+ }, arguments) };
1627
+
1628
+ exports.__wbg_new_1ba21ce319a06297 = function() {
1629
+ const ret = new Object();
1630
+ return ret;
1631
+ };
1632
+
1633
+ exports.__wbg_new_25f239778d6112b9 = function() {
1634
+ const ret = new Array();
1635
+ return ret;
1636
+ };
1637
+
1638
+ exports.__wbg_new_6421f6084cc5bc5a = function(arg0) {
1639
+ const ret = new Uint8Array(arg0);
1640
+ return ret;
1641
+ };
1642
+
1643
+ exports.__wbg_new_8a6f238a6ece86ea = function() {
1644
+ const ret = new Error();
1645
+ return ret;
1646
+ };
1647
+
1648
+ exports.__wbg_new_b546ae120718850e = function() {
1649
+ const ret = new Map();
1650
+ return ret;
1651
+ };
1652
+
1653
+ exports.__wbg_new_ff12d2b041fb48f1 = function(arg0, arg1) {
1654
+ try {
1655
+ var state0 = {a: arg0, b: arg1};
1656
+ var cb0 = (arg0, arg1) => {
1657
+ const a = state0.a;
1658
+ state0.a = 0;
1659
+ try {
1660
+ return wasm_bindgen_68ee60ea9ccb8413___convert__closures_____invoke___wasm_bindgen_68ee60ea9ccb8413___JsValue__wasm_bindgen_68ee60ea9ccb8413___JsValue_____(a, state0.b, arg0, arg1);
1661
+ } finally {
1662
+ state0.a = a;
1663
+ }
1664
+ };
1665
+ const ret = new Promise(cb0);
1666
+ return ret;
1667
+ } finally {
1668
+ state0.a = state0.b = 0;
1669
+ }
1670
+ };
1671
+
1672
+ exports.__wbg_new_no_args_cb138f77cf6151ee = function(arg0, arg1) {
1673
+ var v0 = getCachedStringFromWasm0(arg0, arg1);
1674
+ const ret = new Function(v0);
1675
+ return ret;
1676
+ };
1677
+
1678
+ exports.__wbg_new_with_label_a21974f868c72f0c = function() { return handleError(function (arg0, arg1) {
1679
+ var v0 = getCachedStringFromWasm0(arg0, arg1);
1680
+ const ret = new TextDecoder(v0);
1681
+ return ret;
1682
+ }, arguments) };
1683
+
1684
+ exports.__wbg_new_with_length_12c6de4fac33117a = function(arg0) {
1685
+ const ret = new Array(arg0 >>> 0);
1686
+ return ret;
1687
+ };
1688
+
1689
+ exports.__wbg_next_138a17bbf04e926c = function(arg0) {
1690
+ const ret = arg0.next;
1691
+ return ret;
1692
+ };
1693
+
1694
+ exports.__wbg_next_3cfe5c0fe2a4cc53 = function() { return handleError(function (arg0) {
1695
+ const ret = arg0.next();
1696
+ return ret;
1697
+ }, arguments) };
1698
+
1699
+ exports.__wbg_of_122077a9318f8376 = function(arg0, arg1, arg2, arg3, arg4) {
1700
+ const ret = Array.of(arg0, arg1, arg2, arg3, arg4);
1701
+ return ret;
1702
+ };
1703
+
1704
+ exports.__wbg_of_6505a0eb509da02e = function(arg0) {
1705
+ const ret = Array.of(arg0);
1706
+ return ret;
1707
+ };
1708
+
1709
+ exports.__wbg_of_7779827fa663eec8 = function(arg0, arg1, arg2) {
1710
+ const ret = Array.of(arg0, arg1, arg2);
1711
+ return ret;
1712
+ };
1713
+
1714
+ exports.__wbg_of_b8cd42ebb79fb759 = function(arg0, arg1) {
1715
+ const ret = Array.of(arg0, arg1);
1716
+ return ret;
1717
+ };
1718
+
1719
+ exports.__wbg_of_fdf875aa87d9498c = function(arg0, arg1, arg2, arg3) {
1720
+ const ret = Array.of(arg0, arg1, arg2, arg3);
1721
+ return ret;
1722
+ };
1723
+
1724
+ exports.__wbg_prototypesetcall_dfe9b766cdc1f1fd = function(arg0, arg1, arg2) {
1725
+ Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), arg2);
1726
+ };
1727
+
1728
+ exports.__wbg_push_7d9be8f38fc13975 = function(arg0, arg1) {
1729
+ const ret = arg0.push(arg1);
1730
+ return ret;
1731
+ };
1732
+
1733
+ exports.__wbg_queueMicrotask_9b549dfce8865860 = function(arg0) {
1734
+ const ret = arg0.queueMicrotask;
1735
+ return ret;
1736
+ };
1737
+
1738
+ exports.__wbg_queueMicrotask_fca69f5bfad613a5 = function(arg0) {
1739
+ queueMicrotask(arg0);
1740
+ };
1741
+
1742
+ exports.__wbg_readAsArrayBuffer_0aca937439be3197 = function() { return handleError(function (arg0, arg1) {
1743
+ arg0.readAsArrayBuffer(arg1);
1744
+ }, arguments) };
1745
+
1746
+ exports.__wbg_reject_e9f21cdd3c968ce3 = function(arg0) {
1747
+ const ret = Promise.reject(arg0);
1748
+ return ret;
1749
+ };
1750
+
1751
+ exports.__wbg_resolve_fd5bfbaa4ce36e1e = function(arg0) {
1752
+ const ret = Promise.resolve(arg0);
1753
+ return ret;
1754
+ };
1755
+
1756
+ exports.__wbg_result_893437a1eaacc4df = function() { return handleError(function (arg0) {
1757
+ const ret = arg0.result;
1758
+ return ret;
1759
+ }, arguments) };
1760
+
1761
+ exports.__wbg_set_3f1d0b984ed272ed = function(arg0, arg1, arg2) {
1762
+ arg0[arg1] = arg2;
1763
+ };
1764
+
1765
+ exports.__wbg_set_7df433eea03a5c14 = function(arg0, arg1, arg2) {
1766
+ arg0[arg1 >>> 0] = arg2;
1767
+ };
1768
+
1769
+ exports.__wbg_set_bc3a432bdcd60886 = function(arg0, arg1, arg2) {
1770
+ arg0.set(arg1, arg2 >>> 0);
1771
+ };
1772
+
1773
+ exports.__wbg_set_c50d03a32da17043 = function() { return handleError(function (arg0, arg1, arg2) {
1774
+ arg0.set(arg1 >>> 0, arg2);
1775
+ }, arguments) };
1776
+
1777
+ exports.__wbg_set_efaaf145b9377369 = function(arg0, arg1, arg2) {
1778
+ const ret = arg0.set(arg1, arg2);
1779
+ return ret;
1780
+ };
1781
+
1782
+ exports.__wbg_slice_27b3dfe21d8ce752 = function(arg0, arg1, arg2) {
1783
+ const ret = arg0.slice(arg1 >>> 0, arg2 >>> 0);
1784
+ return ret;
1785
+ };
1786
+
1787
+ exports.__wbg_stack_0ed75d68575b0f3c = function(arg0, arg1) {
1788
+ const ret = arg1.stack;
1789
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1790
+ const len1 = WASM_VECTOR_LEN;
1791
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
1792
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
1793
+ };
1794
+
1795
+ exports.__wbg_static_accessor_GLOBAL_769e6b65d6557335 = function() {
1796
+ const ret = typeof global === 'undefined' ? null : global;
1797
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
1798
+ };
1799
+
1800
+ exports.__wbg_static_accessor_GLOBAL_THIS_60cf02db4de8e1c1 = function() {
1801
+ const ret = typeof globalThis === 'undefined' ? null : globalThis;
1802
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
1803
+ };
1804
+
1805
+ exports.__wbg_static_accessor_SELF_08f5a74c69739274 = function() {
1806
+ const ret = typeof self === 'undefined' ? null : self;
1807
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
1808
+ };
1809
+
1810
+ exports.__wbg_static_accessor_WINDOW_a8924b26aa92d024 = function() {
1811
+ const ret = typeof window === 'undefined' ? null : window;
1812
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
1813
+ };
1814
+
1815
+ exports.__wbg_subarray_845f2f5bce7d061a = function(arg0, arg1, arg2) {
1816
+ const ret = arg0.subarray(arg1 >>> 0, arg2 >>> 0);
1817
+ return ret;
1818
+ };
1819
+
1820
+ exports.__wbg_then_429f7caf1026411d = function(arg0, arg1, arg2) {
1821
+ const ret = arg0.then(arg1, arg2);
1822
+ return ret;
1823
+ };
1824
+
1825
+ exports.__wbg_then_4f95312d68691235 = function(arg0, arg1) {
1826
+ const ret = arg0.then(arg1);
1827
+ return ret;
1828
+ };
1829
+
1830
+ exports.__wbg_type_cb833fc71b5282fb = function(arg0, arg1) {
1831
+ const ret = arg1.type;
1832
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1833
+ const len1 = WASM_VECTOR_LEN;
1834
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
1835
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
1836
+ };
1837
+
1838
+ exports.__wbg_value_57b7b035e117f7ee = function(arg0) {
1839
+ const ret = arg0.value;
1840
+ return ret;
1841
+ };
1842
+
1843
+ exports.__wbg_warn_6e567d0d926ff881 = function(arg0) {
1844
+ console.warn(arg0);
1845
+ };
1846
+
1847
+ exports.__wbindgen_cast_4625c577ab2ec9ee = function(arg0) {
1848
+ // Cast intrinsic for `U64 -> Externref`.
1849
+ const ret = BigInt.asUintN(64, arg0);
1850
+ return ret;
1851
+ };
1852
+
1853
+ exports.__wbindgen_cast_7e9c58eeb11b0a6f = function(arg0, arg1) {
1854
+ var v0 = getCachedStringFromWasm0(arg0, arg1);
1855
+ // Cast intrinsic for `Ref(CachedString) -> Externref`.
1856
+ const ret = v0;
1857
+ return ret;
1858
+ };
1859
+
1860
+ exports.__wbindgen_cast_965f3ca5bc091f01 = function(arg0, arg1) {
1861
+ // Cast intrinsic for `Closure(Closure { dtor_idx: 1976, function: Function { arguments: [Externref], shim_idx: 1977, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
1862
+ const ret = makeMutClosure(arg0, arg1, wasm.wasm_bindgen_68ee60ea9ccb8413___closure__destroy___dyn_core_f96ffdd67f65b3d8___ops__function__FnMut__wasm_bindgen_68ee60ea9ccb8413___JsValue____Output_______, wasm_bindgen_68ee60ea9ccb8413___convert__closures_____invoke___wasm_bindgen_68ee60ea9ccb8413___JsValue_____);
1863
+ return ret;
1864
+ };
1865
+
1866
+ exports.__wbindgen_cast_9ae0607507abb057 = function(arg0) {
1867
+ // Cast intrinsic for `I64 -> Externref`.
1868
+ const ret = arg0;
1869
+ return ret;
1870
+ };
1871
+
1872
+ exports.__wbindgen_cast_cb9088102bce6b30 = function(arg0, arg1) {
1873
+ // Cast intrinsic for `Ref(Slice(U8)) -> NamedExternref("Uint8Array")`.
1874
+ const ret = getArrayU8FromWasm0(arg0, arg1);
1875
+ return ret;
1876
+ };
1877
+
1878
+ exports.__wbindgen_cast_d6cd19b81560fd6e = function(arg0) {
1879
+ // Cast intrinsic for `F64 -> Externref`.
1880
+ const ret = arg0;
1881
+ return ret;
1882
+ };
1883
+
1884
+ exports.__wbindgen_init_externref_table = function() {
1885
+ const table = wasm.__wbindgen_externrefs;
1886
+ const offset = table.grow(4);
1887
+ table.set(0, undefined);
1888
+ table.set(offset + 0, undefined);
1889
+ table.set(offset + 1, null);
1890
+ table.set(offset + 2, true);
1891
+ table.set(offset + 3, false);
1892
+ };
1893
+
1894
+ exports.__wbindgen_object_is_undefined = function(arg0) {
1895
+ const ret = arg0 === undefined;
1896
+ return ret;
1897
+ };
1898
+
1899
+ const wasmPath = `${__dirname}/kreuzberg_wasm_bg.wasm`;
1900
+ const wasmBytes = require('fs').readFileSync(wasmPath);
1901
+ const wasmModule = new WebAssembly.Module(wasmBytes);
1902
+ const wasm = exports.__wasm = new WebAssembly.Instance(wasmModule, imports).exports;
1903
+
1904
+ wasm.__wbindgen_start();